@letscooee/web-sdk 13.1.2 → 13.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.min.js CHANGED
@@ -1,4 +1,4 @@
1
- import{a as $s,b as Vs,c as lm,d as um,e as fm,f as pm,g as mm,h as hr,i as Ws,j as b,k as dm,l as hm,m as gm,n as ym,o as Tr}from"./chunk-LKRRFPUT.js";import{a as E,b as Z,c as Ci,d as cm,e as Hl,f as qr,g as wo}from"./chunk-V7UGKYBN.js";var $l=Hl(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});js.URLBuilder=void 0;var RE=(function(){function t(e){try{this.base=new URL(e),this.params=new URLSearchParams(this.base.search.slice(1))}catch(r){console.error("Un-parsable URL",r)}}return t.prototype.appendQueryParam=function(e,r){this.params.append(e,r?r.toString():"")},t.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},t.prototype.deleteQueryParam=function(e){this.params.delete(e)},t.prototype.getBase=function(){return this.base},t.prototype.getPath=function(){return this.base.pathname},t.prototype.getHostname=function(){return this.base.hostname},t.prototype.getParams=function(){return this.params},t.prototype.getQueryParam=function(e){if(!this.params)return"";var r=this.params.get(e);return!r||r==="undefined"||r==="null"?void 0:r},t.prototype.getQueryString=function(){return this.params.toString()},t.prototype.setPath=function(e){return this.base.pathname=e,this},t.prototype.setQueryParam=function(e,r){return this.params.set(e,r?r.toString():""),this},t.prototype.setQueryString=function(e){if(e)return e[0]==="?"&&(e=e.slice(1)),this.params=new URLSearchParams(e),this},t.prototype.toString=function(){var e=this.params.toString();return e===""?this.base.search="":this.base.search="?"+e,this.base.toString()},t})();js.URLBuilder=RE});var Im=Hl((Tm,Kl)=>{"use strict";(function(t){if(typeof Tm=="object"&&typeof Kl<"u")Kl.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e=this,e.localforage=t()}})(function(){var t,e,r;return(function n(o,i,s){function a(m,d){if(!i[m]){if(!o[m]){var _=typeof Ci=="function"&&Ci;if(!d&&_)return _(m,!0);if(l)return l(m,!0);var y=new Error("Cannot find module '"+m+"'");throw y.code="MODULE_NOT_FOUND",y}var C=i[m]={exports:{}};o[m][0].call(C.exports,function(N){var A=o[m][1][N];return a(A||N)},C,C.exports,n,o,i,s)}return i[m].exports}for(var l=typeof Ci=="function"&&Ci,f=0;f<s.length;f++)a(s[f]);return a})({1:[function(n,o,i){(function(s){"use strict";var a=s.MutationObserver||s.WebKitMutationObserver,l;if(a){var f=0,m=new a(N),d=s.document.createTextNode("");m.observe(d,{characterData:!0}),l=function(){d.data=f=++f%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var _=new s.MessageChannel;_.port1.onmessage=N,l=function(){_.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?l=function(){var B=s.document.createElement("script");B.onreadystatechange=function(){N(),B.onreadystatechange=null,B.parentNode.removeChild(B),B=null},s.document.documentElement.appendChild(B)}:l=function(){setTimeout(N,0)};var y,C=[];function N(){y=!0;for(var B,z,P=C.length;P;){for(z=C,C=[],B=-1;++B<P;)z[B]();P=C.length}y=!1}o.exports=A;function A(B){C.push(B)===1&&!y&&l()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,o,i){"use strict";var s=n(1);function a(){}var l={},f=["REJECTED"],m=["FULFILLED"],d=["PENDING"];o.exports=_;function _(X){if(typeof X!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,X!==a&&A(this,X)}_.prototype.catch=function(X){return this.then(null,X)},_.prototype.then=function(X,ce){if(typeof X!="function"&&this.state===m||typeof ce!="function"&&this.state===f)return this;var se=new this.constructor(a);if(this.state!==d){var de=this.state===m?X:ce;C(se,de,this.outcome)}else this.queue.push(new y(se,X,ce));return se};function y(X,ce,se){this.promise=X,typeof ce=="function"&&(this.onFulfilled=ce,this.callFulfilled=this.otherCallFulfilled),typeof se=="function"&&(this.onRejected=se,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(X){l.resolve(this.promise,X)},y.prototype.otherCallFulfilled=function(X){C(this.promise,this.onFulfilled,X)},y.prototype.callRejected=function(X){l.reject(this.promise,X)},y.prototype.otherCallRejected=function(X){C(this.promise,this.onRejected,X)};function C(X,ce,se){s(function(){var de;try{de=ce(se)}catch(Le){return l.reject(X,Le)}de===X?l.reject(X,new TypeError("Cannot resolve promise with itself")):l.resolve(X,de)})}l.resolve=function(X,ce){var se=B(N,ce);if(se.status==="error")return l.reject(X,se.value);var de=se.value;if(de)A(X,de);else{X.state=m,X.outcome=ce;for(var Le=-1,Se=X.queue.length;++Le<Se;)X.queue[Le].callFulfilled(ce)}return X},l.reject=function(X,ce){X.state=f,X.outcome=ce;for(var se=-1,de=X.queue.length;++se<de;)X.queue[se].callRejected(ce);return X};function N(X){var ce=X&&X.then;if(X&&(typeof X=="object"||typeof X=="function")&&typeof ce=="function")return function(){ce.apply(X,arguments)}}function A(X,ce){var se=!1;function de(Ge){se||(se=!0,l.reject(X,Ge))}function Le(Ge){se||(se=!0,l.resolve(X,Ge))}function Se(){ce(Le,de)}var Re=B(Se);Re.status==="error"&&de(Re.value)}function B(X,ce){var se={};try{se.value=X(ce),se.status="success"}catch(de){se.status="error",se.value=de}return se}_.resolve=z;function z(X){return X instanceof this?X:l.resolve(new this(a),X)}_.reject=P;function P(X){var ce=new this(a);return l.reject(ce,X)}_.all=Q;function Q(X){var ce=this;if(Object.prototype.toString.call(X)!=="[object Array]")return this.reject(new TypeError("must be an array"));var se=X.length,de=!1;if(!se)return this.resolve([]);for(var Le=new Array(se),Se=0,Re=-1,Ge=new this(a);++Re<se;)Qe(X[Re],Re);return Ge;function Qe(Bt,D){ce.resolve(Bt).then(R,function(V){de||(de=!0,l.reject(Ge,V))});function R(V){Le[D]=V,++Se===se&&!de&&(de=!0,l.resolve(Ge,Le))}}}_.race=Ee;function Ee(X){var ce=this;if(Object.prototype.toString.call(X)!=="[object Array]")return this.reject(new TypeError("must be an array"));var se=X.length,de=!1;if(!se)return this.resolve([]);for(var Le=-1,Se=new this(a);++Le<se;)Re(X[Le]);return Se;function Re(Ge){ce.resolve(Ge).then(function(Qe){de||(de=!0,l.resolve(Se,Qe))},function(Qe){de||(de=!0,l.reject(Se,Qe))})}}},{1:1}],3:[function(n,o,i){(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,o,i){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p};function a(p,w){if(!(p instanceof w))throw new TypeError("Cannot call a class as a function")}function l(){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 f=l();function m(){try{if(!f||!f.open)return!1;var p=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),w=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!p||w)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function d(p,w){p=p||[],w=w||{};try{return new Blob(p,w)}catch(S){if(S.name!=="TypeError")throw S;for(var g=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,T=new g,I=0;I<p.length;I+=1)T.append(p[I]);return T.getBlob(w.type)}}typeof Promise>"u"&&n(3);var _=Promise;function y(p,w){w&&p.then(function(g){w(null,g)},function(g){w(g)})}function C(p,w,g){typeof w=="function"&&p.then(w),typeof g=="function"&&p.catch(g)}function N(p){return typeof p!="string"&&(console.warn(p+" used as a key, but it is not a string."),p=String(p)),p}function A(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var B="local-forage-detect-blob-support",z=void 0,P={},Q=Object.prototype.toString,Ee="readonly",X="readwrite";function ce(p){for(var w=p.length,g=new ArrayBuffer(w),T=new Uint8Array(g),I=0;I<w;I++)T[I]=p.charCodeAt(I);return g}function se(p){return new _(function(w){var g=p.transaction(B,X),T=d([""]);g.objectStore(B).put(T,"key"),g.onabort=function(I){I.preventDefault(),I.stopPropagation(),w(!1)},g.oncomplete=function(){var I=navigator.userAgent.match(/Chrome\/(\d+)/),S=navigator.userAgent.match(/Edge\//);w(S||!I||parseInt(I[1],10)>=43)}}).catch(function(){return!1})}function de(p){return typeof z=="boolean"?_.resolve(z):se(p).then(function(w){return z=w,z})}function Le(p){var w=P[p.name],g={};g.promise=new _(function(T,I){g.resolve=T,g.reject=I}),w.deferredOperations.push(g),w.dbReady?w.dbReady=w.dbReady.then(function(){return g.promise}):w.dbReady=g.promise}function Se(p){var w=P[p.name],g=w.deferredOperations.pop();if(g)return g.resolve(),g.promise}function Re(p,w){var g=P[p.name],T=g.deferredOperations.pop();if(T)return T.reject(w),T.promise}function Ge(p,w){return new _(function(g,T){if(P[p.name]=P[p.name]||ze(),p.db)if(w)Le(p),p.db.close();else return g(p.db);var I=[p.name];w&&I.push(p.version);var S=f.open.apply(f,I);w&&(S.onupgradeneeded=function(M){var G=S.result;try{G.createObjectStore(p.storeName),M.oldVersion<=1&&G.createObjectStore(B)}catch(q){if(q.name==="ConstraintError")console.warn('The database "'+p.name+'" has been upgraded from version '+M.oldVersion+" to version "+M.newVersion+', but the storage "'+p.storeName+'" already exists.');else throw q}}),S.onerror=function(M){M.preventDefault(),T(S.error)},S.onsuccess=function(){var M=S.result;M.onversionchange=function(G){G.target.close()},g(M),Se(p)}})}function Qe(p){return Ge(p,!1)}function Bt(p){return Ge(p,!0)}function D(p,w){if(!p.db)return!0;var g=!p.db.objectStoreNames.contains(p.storeName),T=p.version<p.db.version,I=p.version>p.db.version;if(T&&(p.version!==w&&console.warn('The database "'+p.name+`" can't be downgraded from version `+p.db.version+" to version "+p.version+"."),p.version=p.db.version),I||g){if(g){var S=p.db.version+1;S>p.version&&(p.version=S)}return!0}return!1}function R(p){return new _(function(w,g){var T=new FileReader;T.onerror=g,T.onloadend=function(I){var S=btoa(I.target.result||"");w({__local_forage_encoded_blob:!0,data:S,type:p.type})},T.readAsBinaryString(p)})}function V(p){var w=ce(atob(p.data));return d([w],{type:p.type})}function k(p){return p&&p.__local_forage_encoded_blob}function H(p){var w=this,g=w._initReady().then(function(){var T=P[w._dbInfo.name];if(T&&T.dbReady)return T.dbReady});return C(g,p,p),g}function ne(p){Le(p);for(var w=P[p.name],g=w.forages,T=0;T<g.length;T++){var I=g[T];I._dbInfo.db&&(I._dbInfo.db.close(),I._dbInfo.db=null)}return p.db=null,Qe(p).then(function(S){return p.db=S,D(p)?Bt(p):S}).then(function(S){p.db=w.db=S;for(var M=0;M<g.length;M++)g[M]._dbInfo.db=S}).catch(function(S){throw Re(p,S),S})}function he(p,w,g,T){T===void 0&&(T=1);try{var I=p.db.transaction(p.storeName,w);g(null,I)}catch(S){if(T>0&&(!p.db||S.name==="InvalidStateError"||S.name==="NotFoundError"))return _.resolve().then(function(){if(!p.db||S.name==="NotFoundError"&&!p.db.objectStoreNames.contains(p.storeName)&&p.version<=p.db.version)return p.db&&(p.version=p.db.version+1),Bt(p)}).then(function(){return ne(p).then(function(){he(p,w,g,T-1)})}).catch(g);g(S)}}function ze(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function et(p){var w=this,g={db:null};if(p)for(var T in p)g[T]=p[T];var I=P[g.name];I||(I=ze(),P[g.name]=I),I.forages.push(w),w._initReady||(w._initReady=w.ready,w.ready=H);var S=[];function M(){return _.resolve()}for(var G=0;G<I.forages.length;G++){var q=I.forages[G];q!==w&&S.push(q._initReady().catch(M))}var Y=I.forages.slice(0);return _.all(S).then(function(){return g.db=I.db,Qe(g)}).then(function(J){return g.db=J,D(g,w._defaultConfig.version)?Bt(g):J}).then(function(J){g.db=I.db=J,w._dbInfo=g;for(var te=0;te<Y.length;te++){var ve=Y[te];ve!==w&&(ve._dbInfo.db=g.db,ve._dbInfo.version=g.version)}})}function tt(p,w){var g=this;p=N(p);var T=new _(function(I,S){g.ready().then(function(){he(g._dbInfo,Ee,function(M,G){if(M)return S(M);try{var q=G.objectStore(g._dbInfo.storeName),Y=q.get(p);Y.onsuccess=function(){var J=Y.result;J===void 0&&(J=null),k(J)&&(J=V(J)),I(J)},Y.onerror=function(){S(Y.error)}}catch(J){S(J)}})}).catch(S)});return y(T,w),T}function vt(p,w){var g=this,T=new _(function(I,S){g.ready().then(function(){he(g._dbInfo,Ee,function(M,G){if(M)return S(M);try{var q=G.objectStore(g._dbInfo.storeName),Y=q.openCursor(),J=1;Y.onsuccess=function(){var te=Y.result;if(te){var ve=te.value;k(ve)&&(ve=V(ve));var Oe=p(ve,te.key,J++);Oe!==void 0?I(Oe):te.continue()}else I()},Y.onerror=function(){S(Y.error)}}catch(te){S(te)}})}).catch(S)});return y(T,w),T}function Et(p,w,g){var T=this;p=N(p);var I=new _(function(S,M){var G;T.ready().then(function(){return G=T._dbInfo,Q.call(w)==="[object Blob]"?de(G.db).then(function(q){return q?w:R(w)}):w}).then(function(q){he(T._dbInfo,X,function(Y,J){if(Y)return M(Y);try{var te=J.objectStore(T._dbInfo.storeName);q===null&&(q=void 0);var ve=te.put(q,p);J.oncomplete=function(){q===void 0&&(q=null),S(q)},J.onabort=J.onerror=function(){var Oe=ve.error?ve.error:ve.transaction.error;M(Oe)}}catch(Oe){M(Oe)}})}).catch(M)});return y(I,g),I}function st(p,w){var g=this;p=N(p);var T=new _(function(I,S){g.ready().then(function(){he(g._dbInfo,X,function(M,G){if(M)return S(M);try{var q=G.objectStore(g._dbInfo.storeName),Y=q.delete(p);G.oncomplete=function(){I()},G.onerror=function(){S(Y.error)},G.onabort=function(){var J=Y.error?Y.error:Y.transaction.error;S(J)}}catch(J){S(J)}})}).catch(S)});return y(T,w),T}function we(p){var w=this,g=new _(function(T,I){w.ready().then(function(){he(w._dbInfo,X,function(S,M){if(S)return I(S);try{var G=M.objectStore(w._dbInfo.storeName),q=G.clear();M.oncomplete=function(){T()},M.onabort=M.onerror=function(){var Y=q.error?q.error:q.transaction.error;I(Y)}}catch(Y){I(Y)}})}).catch(I)});return y(g,p),g}function He(p){var w=this,g=new _(function(T,I){w.ready().then(function(){he(w._dbInfo,Ee,function(S,M){if(S)return I(S);try{var G=M.objectStore(w._dbInfo.storeName),q=G.count();q.onsuccess=function(){T(q.result)},q.onerror=function(){I(q.error)}}catch(Y){I(Y)}})}).catch(I)});return y(g,p),g}function Ae(p,w){var g=this,T=new _(function(I,S){if(p<0){I(null);return}g.ready().then(function(){he(g._dbInfo,Ee,function(M,G){if(M)return S(M);try{var q=G.objectStore(g._dbInfo.storeName),Y=!1,J=q.openKeyCursor();J.onsuccess=function(){var te=J.result;if(!te){I(null);return}p===0||Y?I(te.key):(Y=!0,te.advance(p))},J.onerror=function(){S(J.error)}}catch(te){S(te)}})}).catch(S)});return y(T,w),T}function $e(p){var w=this,g=new _(function(T,I){w.ready().then(function(){he(w._dbInfo,Ee,function(S,M){if(S)return I(S);try{var G=M.objectStore(w._dbInfo.storeName),q=G.openKeyCursor(),Y=[];q.onsuccess=function(){var J=q.result;if(!J){T(Y);return}Y.push(J.key),J.continue()},q.onerror=function(){I(q.error)}}catch(J){I(J)}})}).catch(I)});return y(g,p),g}function De(p,w){w=A.apply(this,arguments);var g=this.config();p=typeof p!="function"&&p||{},p.name||(p.name=p.name||g.name,p.storeName=p.storeName||g.storeName);var T=this,I;if(!p.name)I=_.reject("Invalid arguments");else{var S=p.name===g.name&&T._dbInfo.db,M=S?_.resolve(T._dbInfo.db):Qe(p).then(function(G){var q=P[p.name],Y=q.forages;q.db=G;for(var J=0;J<Y.length;J++)Y[J]._dbInfo.db=G;return G});p.storeName?I=M.then(function(G){if(G.objectStoreNames.contains(p.storeName)){var q=G.version+1;Le(p);var Y=P[p.name],J=Y.forages;G.close();for(var te=0;te<J.length;te++){var ve=J[te];ve._dbInfo.db=null,ve._dbInfo.version=q}var Oe=new _(function(Ne,nt){var Ze=f.open(p.name,q);Ze.onerror=function(Xt){var xi=Ze.result;xi.close(),nt(Xt)},Ze.onupgradeneeded=function(){var Xt=Ze.result;Xt.deleteObjectStore(p.storeName)},Ze.onsuccess=function(){var Xt=Ze.result;Xt.close(),Ne(Xt)}});return Oe.then(function(Ne){Y.db=Ne;for(var nt=0;nt<J.length;nt++){var Ze=J[nt];Ze._dbInfo.db=Ne,Se(Ze._dbInfo)}}).catch(function(Ne){throw(Re(p,Ne)||_.resolve()).catch(function(){}),Ne})}}):I=M.then(function(G){Le(p);var q=P[p.name],Y=q.forages;G.close();for(var J=0;J<Y.length;J++){var te=Y[J];te._dbInfo.db=null}var ve=new _(function(Oe,Ne){var nt=f.deleteDatabase(p.name);nt.onerror=function(){var Ze=nt.result;Ze&&Ze.close(),Ne(nt.error)},nt.onblocked=function(){console.warn('dropInstance blocked for database "'+p.name+'" until all open connections are closed')},nt.onsuccess=function(){var Ze=nt.result;Ze&&Ze.close(),Oe(Ze)}});return ve.then(function(Oe){q.db=Oe;for(var Ne=0;Ne<Y.length;Ne++){var nt=Y[Ne];Se(nt._dbInfo)}}).catch(function(Oe){throw(Re(p,Oe)||_.resolve()).catch(function(){}),Oe})})}return y(I,w),I}var $t={_driver:"asyncStorage",_initStorage:et,_support:m(),iterate:vt,getItem:tt,setItem:Et,removeItem:st,clear:we,length:He,key:Ae,keys:$e,dropInstance:De};function h(){return typeof openDatabase=="function"}var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u="~~local_forage_type~",v=/^~~local_forage_type~([^~]+)~/,x="__lfsc__:",O=x.length,W="arbf",ue="blob",_e="si08",ge="ui08",Me="uic8",ke="si16",rt="si32",pr="ur16",zr="ui32",_o="fl32",mr="fl64",dr=O+W.length,em=Object.prototype.toString;function tm(p){var w=p.length*.75,g=p.length,T,I=0,S,M,G,q;p[p.length-1]==="="&&(w--,p[p.length-2]==="="&&w--);var Y=new ArrayBuffer(w),J=new Uint8Array(Y);for(T=0;T<g;T+=4)S=c.indexOf(p[T]),M=c.indexOf(p[T+1]),G=c.indexOf(p[T+2]),q=c.indexOf(p[T+3]),J[I++]=S<<2|M>>4,J[I++]=(M&15)<<4|G>>2,J[I++]=(G&3)<<6|q&63;return Y}function Ll(p){var w=new Uint8Array(p),g="",T;for(T=0;T<w.length;T+=3)g+=c[w[T]>>2],g+=c[(w[T]&3)<<4|w[T+1]>>4],g+=c[(w[T+1]&15)<<2|w[T+2]>>6],g+=c[w[T+2]&63];return w.length%3===2?g=g.substring(0,g.length-1)+"=":w.length%3===1&&(g=g.substring(0,g.length-2)+"=="),g}function jv(p,w){var g="";if(p&&(g=em.call(p)),p&&(g==="[object ArrayBuffer]"||p.buffer&&em.call(p.buffer)==="[object ArrayBuffer]")){var T,I=x;p instanceof ArrayBuffer?(T=p,I+=W):(T=p.buffer,g==="[object Int8Array]"?I+=_e:g==="[object Uint8Array]"?I+=ge:g==="[object Uint8ClampedArray]"?I+=Me:g==="[object Int16Array]"?I+=ke:g==="[object Uint16Array]"?I+=pr:g==="[object Int32Array]"?I+=rt:g==="[object Uint32Array]"?I+=zr:g==="[object Float32Array]"?I+=_o:g==="[object Float64Array]"?I+=mr:w(new Error("Failed to get type for BinaryArray"))),w(I+Ll(T))}else if(g==="[object Blob]"){var S=new FileReader;S.onload=function(){var M=u+p.type+"~"+Ll(this.result);w(x+ue+M)},S.readAsArrayBuffer(p)}else try{w(JSON.stringify(p))}catch(M){console.error("Couldn't convert value into a JSON string: ",p),w(null,M)}}function Gv(p){if(p.substring(0,O)!==x)return JSON.parse(p);var w=p.substring(dr),g=p.substring(O,dr),T;if(g===ue&&v.test(w)){var I=w.match(v);T=I[1],w=w.substring(I[0].length)}var S=tm(w);switch(g){case W:return S;case ue:return d([S],{type:T});case _e:return new Int8Array(S);case ge:return new Uint8Array(S);case Me:return new Uint8ClampedArray(S);case ke:return new Int16Array(S);case pr:return new Uint16Array(S);case rt:return new Int32Array(S);case zr:return new Uint32Array(S);case _o:return new Float32Array(S);case mr:return new Float64Array(S);default:throw new Error("Unkown type: "+g)}}var Ml={serialize:jv,deserialize:Gv,stringToBuffer:tm,bufferToString:Ll};function rm(p,w,g,T){p.executeSql("CREATE TABLE IF NOT EXISTS "+w.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],g,T)}function zv(p){var w=this,g={db:null};if(p)for(var T in p)g[T]=typeof p[T]!="string"?p[T].toString():p[T];var I=new _(function(S,M){try{g.db=openDatabase(g.name,String(g.version),g.description,g.size)}catch(G){return M(G)}g.db.transaction(function(G){rm(G,g,function(){w._dbInfo=g,S()},function(q,Y){M(Y)})},M)});return g.serializer=Ml,I}function dn(p,w,g,T,I,S){p.executeSql(g,T,I,function(M,G){G.code===G.SYNTAX_ERR?M.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[w.storeName],function(q,Y){Y.rows.length?S(q,G):rm(q,w,function(){q.executeSql(g,T,I,S)},S)},S):S(M,G)},S)}function qv(p,w){var g=this;p=N(p);var T=new _(function(I,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(G){dn(G,M,"SELECT * FROM "+M.storeName+" WHERE key = ? LIMIT 1",[p],function(q,Y){var J=Y.rows.length?Y.rows.item(0).value:null;J&&(J=M.serializer.deserialize(J)),I(J)},function(q,Y){S(Y)})})}).catch(S)});return y(T,w),T}function Yv(p,w){var g=this,T=new _(function(I,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(G){dn(G,M,"SELECT * FROM "+M.storeName,[],function(q,Y){for(var J=Y.rows,te=J.length,ve=0;ve<te;ve++){var Oe=J.item(ve),Ne=Oe.value;if(Ne&&(Ne=M.serializer.deserialize(Ne)),Ne=p(Ne,Oe.key,ve+1),Ne!==void 0){I(Ne);return}}I()},function(q,Y){S(Y)})})}).catch(S)});return y(T,w),T}function nm(p,w,g,T){var I=this;p=N(p);var S=new _(function(M,G){I.ready().then(function(){w===void 0&&(w=null);var q=w,Y=I._dbInfo;Y.serializer.serialize(w,function(J,te){te?G(te):Y.db.transaction(function(ve){dn(ve,Y,"INSERT OR REPLACE INTO "+Y.storeName+" (key, value) VALUES (?, ?)",[p,J],function(){M(q)},function(Oe,Ne){G(Ne)})},function(ve){if(ve.code===ve.QUOTA_ERR){if(T>0){M(nm.apply(I,[p,q,g,T-1]));return}G(ve)}})})}).catch(G)});return y(S,g),S}function Kv(p,w,g){return nm.apply(this,[p,w,g,1])}function Xv(p,w){var g=this;p=N(p);var T=new _(function(I,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(G){dn(G,M,"DELETE FROM "+M.storeName+" WHERE key = ?",[p],function(){I()},function(q,Y){S(Y)})})}).catch(S)});return y(T,w),T}function Jv(p){var w=this,g=new _(function(T,I){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(M){dn(M,S,"DELETE FROM "+S.storeName,[],function(){T()},function(G,q){I(q)})})}).catch(I)});return y(g,p),g}function Qv(p){var w=this,g=new _(function(T,I){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(M){dn(M,S,"SELECT COUNT(key) as c FROM "+S.storeName,[],function(G,q){var Y=q.rows.item(0).c;T(Y)},function(G,q){I(q)})})}).catch(I)});return y(g,p),g}function Zv(p,w){var g=this,T=new _(function(I,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(G){dn(G,M,"SELECT key FROM "+M.storeName+" WHERE id = ? LIMIT 1",[p+1],function(q,Y){var J=Y.rows.length?Y.rows.item(0).key:null;I(J)},function(q,Y){S(Y)})})}).catch(S)});return y(T,w),T}function eE(p){var w=this,g=new _(function(T,I){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(M){dn(M,S,"SELECT key FROM "+S.storeName,[],function(G,q){for(var Y=[],J=0;J<q.rows.length;J++)Y.push(q.rows.item(J).key);T(Y)},function(G,q){I(q)})})}).catch(I)});return y(g,p),g}function tE(p){return new _(function(w,g){p.transaction(function(T){T.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(I,S){for(var M=[],G=0;G<S.rows.length;G++)M.push(S.rows.item(G).name);w({db:p,storeNames:M})},function(I,S){g(S)})},function(T){g(T)})})}function rE(p,w){w=A.apply(this,arguments);var g=this.config();p=typeof p!="function"&&p||{},p.name||(p.name=p.name||g.name,p.storeName=p.storeName||g.storeName);var T=this,I;return p.name?I=new _(function(S){var M;p.name===g.name?M=T._dbInfo.db:M=openDatabase(p.name,"","",0),p.storeName?S({db:M,storeNames:[p.storeName]}):S(tE(M))}).then(function(S){return new _(function(M,G){S.db.transaction(function(q){function Y(Oe){return new _(function(Ne,nt){q.executeSql("DROP TABLE IF EXISTS "+Oe,[],function(){Ne()},function(Ze,Xt){nt(Xt)})})}for(var J=[],te=0,ve=S.storeNames.length;te<ve;te++)J.push(Y(S.storeNames[te]));_.all(J).then(function(){M()}).catch(function(Oe){G(Oe)})},function(q){G(q)})})}):I=_.reject("Invalid arguments"),y(I,w),I}var nE={_driver:"webSQLStorage",_initStorage:zv,_support:h(),iterate:Yv,getItem:qv,setItem:Kv,removeItem:Xv,clear:Jv,length:Qv,key:Zv,keys:eE,dropInstance:rE};function oE(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function om(p,w){var g=p.name+"/";return p.storeName!==w.storeName&&(g+=p.storeName+"/"),g}function iE(){var p="_localforage_support_test";try{return localStorage.setItem(p,!0),localStorage.removeItem(p),!1}catch{return!0}}function sE(){return!iE()||localStorage.length>0}function aE(p){var w=this,g={};if(p)for(var T in p)g[T]=p[T];return g.keyPrefix=om(p,w._defaultConfig),sE()?(w._dbInfo=g,g.serializer=Ml,_.resolve()):_.reject()}function cE(p){var w=this,g=w.ready().then(function(){for(var T=w._dbInfo.keyPrefix,I=localStorage.length-1;I>=0;I--){var S=localStorage.key(I);S.indexOf(T)===0&&localStorage.removeItem(S)}});return y(g,p),g}function lE(p,w){var g=this;p=N(p);var T=g.ready().then(function(){var I=g._dbInfo,S=localStorage.getItem(I.keyPrefix+p);return S&&(S=I.serializer.deserialize(S)),S});return y(T,w),T}function uE(p,w){var g=this,T=g.ready().then(function(){for(var I=g._dbInfo,S=I.keyPrefix,M=S.length,G=localStorage.length,q=1,Y=0;Y<G;Y++){var J=localStorage.key(Y);if(J.indexOf(S)===0){var te=localStorage.getItem(J);if(te&&(te=I.serializer.deserialize(te)),te=p(te,J.substring(M),q++),te!==void 0)return te}}});return y(T,w),T}function fE(p,w){var g=this,T=g.ready().then(function(){var I=g._dbInfo,S;try{S=localStorage.key(p)}catch{S=null}return S&&(S=S.substring(I.keyPrefix.length)),S});return y(T,w),T}function pE(p){var w=this,g=w.ready().then(function(){for(var T=w._dbInfo,I=localStorage.length,S=[],M=0;M<I;M++){var G=localStorage.key(M);G.indexOf(T.keyPrefix)===0&&S.push(G.substring(T.keyPrefix.length))}return S});return y(g,p),g}function mE(p){var w=this,g=w.keys().then(function(T){return T.length});return y(g,p),g}function dE(p,w){var g=this;p=N(p);var T=g.ready().then(function(){var I=g._dbInfo;localStorage.removeItem(I.keyPrefix+p)});return y(T,w),T}function hE(p,w,g){var T=this;p=N(p);var I=T.ready().then(function(){w===void 0&&(w=null);var S=w;return new _(function(M,G){var q=T._dbInfo;q.serializer.serialize(w,function(Y,J){if(J)G(J);else try{localStorage.setItem(q.keyPrefix+p,Y),M(S)}catch(te){(te.name==="QuotaExceededError"||te.name==="NS_ERROR_DOM_QUOTA_REACHED")&&G(te),G(te)}})})});return y(I,g),I}function gE(p,w){if(w=A.apply(this,arguments),p=typeof p!="function"&&p||{},!p.name){var g=this.config();p.name=p.name||g.name,p.storeName=p.storeName||g.storeName}var T=this,I;return p.name?I=new _(function(S){p.storeName?S(om(p,T._defaultConfig)):S(p.name+"/")}).then(function(S){for(var M=localStorage.length-1;M>=0;M--){var G=localStorage.key(M);G.indexOf(S)===0&&localStorage.removeItem(G)}}):I=_.reject("Invalid arguments"),y(I,w),I}var yE={_driver:"localStorageWrapper",_initStorage:aE,_support:oE(),iterate:uE,getItem:lE,setItem:hE,removeItem:dE,clear:cE,length:mE,key:fE,keys:pE,dropInstance:gE},vE=function(w,g){return w===g||typeof w=="number"&&typeof g=="number"&&isNaN(w)&&isNaN(g)},EE=function(w,g){for(var T=w.length,I=0;I<T;){if(vE(w[I],g))return!0;I++}return!1},im=Array.isArray||function(p){return Object.prototype.toString.call(p)==="[object Array]"},Ii={},sm={},bo={INDEXEDDB:$t,WEBSQL:nE,LOCALSTORAGE:yE},_E=[bo.INDEXEDDB._driver,bo.WEBSQL._driver,bo.LOCALSTORAGE._driver],Hs=["dropInstance"],Bl=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Hs),bE={description:"",driver:_E.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function wE(p,w){p[w]=function(){var g=arguments;return p.ready().then(function(){return p[w].apply(p,g)})}}function Ul(){for(var p=1;p<arguments.length;p++){var w=arguments[p];if(w)for(var g in w)w.hasOwnProperty(g)&&(im(w[g])?arguments[0][g]=w[g].slice():arguments[0][g]=w[g])}return arguments[0]}var SE=(function(){function p(w){a(this,p);for(var g in bo)if(bo.hasOwnProperty(g)){var T=bo[g],I=T._driver;this[g]=I,Ii[I]||this.defineDriver(T)}this._defaultConfig=Ul({},bE),this._config=Ul({},this._defaultConfig,w),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return p.prototype.config=function(g){if((typeof g>"u"?"undefined":s(g))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var T in g){if(T==="storeName"&&(g[T]=g[T].replace(/\W/g,"_")),T==="version"&&typeof g[T]!="number")return new Error("Database version must be a number.");this._config[T]=g[T]}return"driver"in g&&g.driver?this.setDriver(this._config.driver):!0}else return typeof g=="string"?this._config[g]:this._config},p.prototype.defineDriver=function(g,T,I){var S=new _(function(M,G){try{var q=g._driver,Y=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!g._driver){G(Y);return}for(var J=Bl.concat("_initStorage"),te=0,ve=J.length;te<ve;te++){var Oe=J[te],Ne=!EE(Hs,Oe);if((Ne||g[Oe])&&typeof g[Oe]!="function"){G(Y);return}}var nt=function(){for(var xi=function(xE){return function(){var CE=new Error("Method "+xE+" is not implemented by the current driver"),am=_.reject(CE);return y(am,arguments[arguments.length-1]),am}},kl=0,IE=Hs.length;kl<IE;kl++){var Fl=Hs[kl];g[Fl]||(g[Fl]=xi(Fl))}};nt();var Ze=function(xi){Ii[q]&&console.info("Redefining LocalForage driver: "+q),Ii[q]=g,sm[q]=xi,M()};"_support"in g?g._support&&typeof g._support=="function"?g._support().then(Ze,G):Ze(!!g._support):Ze(!0)}catch(Xt){G(Xt)}});return C(S,T,I),S},p.prototype.driver=function(){return this._driver||null},p.prototype.getDriver=function(g,T,I){var S=Ii[g]?_.resolve(Ii[g]):_.reject(new Error("Driver not found."));return C(S,T,I),S},p.prototype.getSerializer=function(g){var T=_.resolve(Ml);return C(T,g),T},p.prototype.ready=function(g){var T=this,I=T._driverSet.then(function(){return T._ready===null&&(T._ready=T._initDriver()),T._ready});return C(I,g,g),I},p.prototype.setDriver=function(g,T,I){var S=this;im(g)||(g=[g]);var M=this._getSupportedDrivers(g);function G(){S._config.driver=S.driver()}function q(te){return S._extend(te),G(),S._ready=S._initStorage(S._config),S._ready}function Y(te){return function(){var ve=0;function Oe(){for(;ve<te.length;){var Ne=te[ve];return ve++,S._dbInfo=null,S._ready=null,S.getDriver(Ne).then(q).catch(Oe)}G();var nt=new Error("No available storage method found.");return S._driverSet=_.reject(nt),S._driverSet}return Oe()}}var J=this._driverSet!==null?this._driverSet.catch(function(){return _.resolve()}):_.resolve();return this._driverSet=J.then(function(){var te=M[0];return S._dbInfo=null,S._ready=null,S.getDriver(te).then(function(ve){S._driver=ve._driver,G(),S._wrapLibraryMethodsWithReady(),S._initDriver=Y(M)})}).catch(function(){G();var te=new Error("No available storage method found.");return S._driverSet=_.reject(te),S._driverSet}),C(this._driverSet,T,I),this._driverSet},p.prototype.supports=function(g){return!!sm[g]},p.prototype._extend=function(g){Ul(this,g)},p.prototype._getSupportedDrivers=function(g){for(var T=[],I=0,S=g.length;I<S;I++){var M=g[I];this.supports(M)&&T.push(M)}return T},p.prototype._wrapLibraryMethodsWithReady=function(){for(var g=0,T=Bl.length;g<T;g++)wE(this,Bl[g])},p.prototype.createInstance=function(g){return new p(g)},p})(),TE=new SE;o.exports=TE},{3:3}]},{},[4])(4)})});var Uf=Hl((ec,rg)=>{"use strict";(function(t,e){typeof ec=="object"&&typeof rg<"u"?e(ec):typeof define=="function"&&define.amd?define(["exports"],e):e((t=typeof globalThis<"u"?globalThis:t||self).Sqrl={})})(ec,function(t){"use strict";function e(D){var R,V,k=new Error(D);return R=k,V=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(R,V):R.__proto__=V,k}function r(D,R,V){var k=R.slice(0,V).split(/\n/),H=k.length,ne=k[H-1].length+1;throw e(D+=" at line "+H+" col "+ne+`:
1
+ import{a as $s,b as Vs,c as lm,d as um,e as fm,f as pm,g as mm,h as hr,i as Ws,j as b,k as dm,l as hm,m as gm,n as ym,o as Tr}from"./chunk-HZQME353.js";import{a as E,b as Z,c as Ci,d as cm,e as Hl,f as qr,g as wo}from"./chunk-V7UGKYBN.js";var $l=Hl(js=>{"use strict";Object.defineProperty(js,"__esModule",{value:!0});js.URLBuilder=void 0;var RE=(function(){function t(e){try{this.base=new URL(e),this.params=new URLSearchParams(this.base.search.slice(1))}catch(r){console.error("Un-parsable URL",r)}}return t.prototype.appendQueryParam=function(e,r){this.params.append(e,r?r.toString():"")},t.prototype.clearQueryParams=function(){return this.params=new URLSearchParams,this},t.prototype.deleteQueryParam=function(e){this.params.delete(e)},t.prototype.getBase=function(){return this.base},t.prototype.getPath=function(){return this.base.pathname},t.prototype.getHostname=function(){return this.base.hostname},t.prototype.getParams=function(){return this.params},t.prototype.getQueryParam=function(e){if(!this.params)return"";var r=this.params.get(e);return!r||r==="undefined"||r==="null"?void 0:r},t.prototype.getQueryString=function(){return this.params.toString()},t.prototype.setPath=function(e){return this.base.pathname=e,this},t.prototype.setQueryParam=function(e,r){return this.params.set(e,r?r.toString():""),this},t.prototype.setQueryString=function(e){if(e)return e[0]==="?"&&(e=e.slice(1)),this.params=new URLSearchParams(e),this},t.prototype.toString=function(){var e=this.params.toString();return e===""?this.base.search="":this.base.search="?"+e,this.base.toString()},t})();js.URLBuilder=RE});var Im=Hl((Tm,Kl)=>{"use strict";(function(t){if(typeof Tm=="object"&&typeof Kl<"u")Kl.exports=t();else if(typeof define=="function"&&define.amd)define([],t);else{var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e=this,e.localforage=t()}})(function(){var t,e,r;return(function n(o,i,s){function a(m,d){if(!i[m]){if(!o[m]){var _=typeof Ci=="function"&&Ci;if(!d&&_)return _(m,!0);if(l)return l(m,!0);var y=new Error("Cannot find module '"+m+"'");throw y.code="MODULE_NOT_FOUND",y}var C=i[m]={exports:{}};o[m][0].call(C.exports,function(N){var A=o[m][1][N];return a(A||N)},C,C.exports,n,o,i,s)}return i[m].exports}for(var l=typeof Ci=="function"&&Ci,f=0;f<s.length;f++)a(s[f]);return a})({1:[function(n,o,i){(function(s){"use strict";var a=s.MutationObserver||s.WebKitMutationObserver,l;if(a){var f=0,m=new a(N),d=s.document.createTextNode("");m.observe(d,{characterData:!0}),l=function(){d.data=f=++f%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var _=new s.MessageChannel;_.port1.onmessage=N,l=function(){_.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?l=function(){var B=s.document.createElement("script");B.onreadystatechange=function(){N(),B.onreadystatechange=null,B.parentNode.removeChild(B),B=null},s.document.documentElement.appendChild(B)}:l=function(){setTimeout(N,0)};var y,C=[];function N(){y=!0;for(var B,z,P=C.length;P;){for(z=C,C=[],B=-1;++B<P;)z[B]();P=C.length}y=!1}o.exports=A;function A(B){C.push(B)===1&&!y&&l()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,o,i){"use strict";var s=n(1);function a(){}var l={},f=["REJECTED"],m=["FULFILLED"],d=["PENDING"];o.exports=_;function _(X){if(typeof X!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,X!==a&&A(this,X)}_.prototype.catch=function(X){return this.then(null,X)},_.prototype.then=function(X,ce){if(typeof X!="function"&&this.state===m||typeof ce!="function"&&this.state===f)return this;var se=new this.constructor(a);if(this.state!==d){var de=this.state===m?X:ce;C(se,de,this.outcome)}else this.queue.push(new y(se,X,ce));return se};function y(X,ce,se){this.promise=X,typeof ce=="function"&&(this.onFulfilled=ce,this.callFulfilled=this.otherCallFulfilled),typeof se=="function"&&(this.onRejected=se,this.callRejected=this.otherCallRejected)}y.prototype.callFulfilled=function(X){l.resolve(this.promise,X)},y.prototype.otherCallFulfilled=function(X){C(this.promise,this.onFulfilled,X)},y.prototype.callRejected=function(X){l.reject(this.promise,X)},y.prototype.otherCallRejected=function(X){C(this.promise,this.onRejected,X)};function C(X,ce,se){s(function(){var de;try{de=ce(se)}catch(Le){return l.reject(X,Le)}de===X?l.reject(X,new TypeError("Cannot resolve promise with itself")):l.resolve(X,de)})}l.resolve=function(X,ce){var se=B(N,ce);if(se.status==="error")return l.reject(X,se.value);var de=se.value;if(de)A(X,de);else{X.state=m,X.outcome=ce;for(var Le=-1,Se=X.queue.length;++Le<Se;)X.queue[Le].callFulfilled(ce)}return X},l.reject=function(X,ce){X.state=f,X.outcome=ce;for(var se=-1,de=X.queue.length;++se<de;)X.queue[se].callRejected(ce);return X};function N(X){var ce=X&&X.then;if(X&&(typeof X=="object"||typeof X=="function")&&typeof ce=="function")return function(){ce.apply(X,arguments)}}function A(X,ce){var se=!1;function de(Ge){se||(se=!0,l.reject(X,Ge))}function Le(Ge){se||(se=!0,l.resolve(X,Ge))}function Se(){ce(Le,de)}var Re=B(Se);Re.status==="error"&&de(Re.value)}function B(X,ce){var se={};try{se.value=X(ce),se.status="success"}catch(de){se.status="error",se.value=de}return se}_.resolve=z;function z(X){return X instanceof this?X:l.resolve(new this(a),X)}_.reject=P;function P(X){var ce=new this(a);return l.reject(ce,X)}_.all=Q;function Q(X){var ce=this;if(Object.prototype.toString.call(X)!=="[object Array]")return this.reject(new TypeError("must be an array"));var se=X.length,de=!1;if(!se)return this.resolve([]);for(var Le=new Array(se),Se=0,Re=-1,Ge=new this(a);++Re<se;)Qe(X[Re],Re);return Ge;function Qe(Bt,D){ce.resolve(Bt).then(R,function(V){de||(de=!0,l.reject(Ge,V))});function R(V){Le[D]=V,++Se===se&&!de&&(de=!0,l.resolve(Ge,Le))}}}_.race=Ee;function Ee(X){var ce=this;if(Object.prototype.toString.call(X)!=="[object Array]")return this.reject(new TypeError("must be an array"));var se=X.length,de=!1;if(!se)return this.resolve([]);for(var Le=-1,Se=new this(a);++Le<se;)Re(X[Le]);return Se;function Re(Ge){ce.resolve(Ge).then(function(Qe){de||(de=!0,l.resolve(Se,Qe))},function(Qe){de||(de=!0,l.reject(Se,Qe))})}}},{1:1}],3:[function(n,o,i){(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,o,i){"use strict";var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p};function a(p,w){if(!(p instanceof w))throw new TypeError("Cannot call a class as a function")}function l(){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 f=l();function m(){try{if(!f||!f.open)return!1;var p=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),w=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!p||w)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function d(p,w){p=p||[],w=w||{};try{return new Blob(p,w)}catch(S){if(S.name!=="TypeError")throw S;for(var g=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,T=new g,I=0;I<p.length;I+=1)T.append(p[I]);return T.getBlob(w.type)}}typeof Promise>"u"&&n(3);var _=Promise;function y(p,w){w&&p.then(function(g){w(null,g)},function(g){w(g)})}function C(p,w,g){typeof w=="function"&&p.then(w),typeof g=="function"&&p.catch(g)}function N(p){return typeof p!="string"&&(console.warn(p+" used as a key, but it is not a string."),p=String(p)),p}function A(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var B="local-forage-detect-blob-support",z=void 0,P={},Q=Object.prototype.toString,Ee="readonly",X="readwrite";function ce(p){for(var w=p.length,g=new ArrayBuffer(w),T=new Uint8Array(g),I=0;I<w;I++)T[I]=p.charCodeAt(I);return g}function se(p){return new _(function(w){var g=p.transaction(B,X),T=d([""]);g.objectStore(B).put(T,"key"),g.onabort=function(I){I.preventDefault(),I.stopPropagation(),w(!1)},g.oncomplete=function(){var I=navigator.userAgent.match(/Chrome\/(\d+)/),S=navigator.userAgent.match(/Edge\//);w(S||!I||parseInt(I[1],10)>=43)}}).catch(function(){return!1})}function de(p){return typeof z=="boolean"?_.resolve(z):se(p).then(function(w){return z=w,z})}function Le(p){var w=P[p.name],g={};g.promise=new _(function(T,I){g.resolve=T,g.reject=I}),w.deferredOperations.push(g),w.dbReady?w.dbReady=w.dbReady.then(function(){return g.promise}):w.dbReady=g.promise}function Se(p){var w=P[p.name],g=w.deferredOperations.pop();if(g)return g.resolve(),g.promise}function Re(p,w){var g=P[p.name],T=g.deferredOperations.pop();if(T)return T.reject(w),T.promise}function Ge(p,w){return new _(function(g,T){if(P[p.name]=P[p.name]||ze(),p.db)if(w)Le(p),p.db.close();else return g(p.db);var I=[p.name];w&&I.push(p.version);var S=f.open.apply(f,I);w&&(S.onupgradeneeded=function(M){var G=S.result;try{G.createObjectStore(p.storeName),M.oldVersion<=1&&G.createObjectStore(B)}catch(q){if(q.name==="ConstraintError")console.warn('The database "'+p.name+'" has been upgraded from version '+M.oldVersion+" to version "+M.newVersion+', but the storage "'+p.storeName+'" already exists.');else throw q}}),S.onerror=function(M){M.preventDefault(),T(S.error)},S.onsuccess=function(){var M=S.result;M.onversionchange=function(G){G.target.close()},g(M),Se(p)}})}function Qe(p){return Ge(p,!1)}function Bt(p){return Ge(p,!0)}function D(p,w){if(!p.db)return!0;var g=!p.db.objectStoreNames.contains(p.storeName),T=p.version<p.db.version,I=p.version>p.db.version;if(T&&(p.version!==w&&console.warn('The database "'+p.name+`" can't be downgraded from version `+p.db.version+" to version "+p.version+"."),p.version=p.db.version),I||g){if(g){var S=p.db.version+1;S>p.version&&(p.version=S)}return!0}return!1}function R(p){return new _(function(w,g){var T=new FileReader;T.onerror=g,T.onloadend=function(I){var S=btoa(I.target.result||"");w({__local_forage_encoded_blob:!0,data:S,type:p.type})},T.readAsBinaryString(p)})}function V(p){var w=ce(atob(p.data));return d([w],{type:p.type})}function k(p){return p&&p.__local_forage_encoded_blob}function H(p){var w=this,g=w._initReady().then(function(){var T=P[w._dbInfo.name];if(T&&T.dbReady)return T.dbReady});return C(g,p,p),g}function ne(p){Le(p);for(var w=P[p.name],g=w.forages,T=0;T<g.length;T++){var I=g[T];I._dbInfo.db&&(I._dbInfo.db.close(),I._dbInfo.db=null)}return p.db=null,Qe(p).then(function(S){return p.db=S,D(p)?Bt(p):S}).then(function(S){p.db=w.db=S;for(var M=0;M<g.length;M++)g[M]._dbInfo.db=S}).catch(function(S){throw Re(p,S),S})}function he(p,w,g,T){T===void 0&&(T=1);try{var I=p.db.transaction(p.storeName,w);g(null,I)}catch(S){if(T>0&&(!p.db||S.name==="InvalidStateError"||S.name==="NotFoundError"))return _.resolve().then(function(){if(!p.db||S.name==="NotFoundError"&&!p.db.objectStoreNames.contains(p.storeName)&&p.version<=p.db.version)return p.db&&(p.version=p.db.version+1),Bt(p)}).then(function(){return ne(p).then(function(){he(p,w,g,T-1)})}).catch(g);g(S)}}function ze(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function et(p){var w=this,g={db:null};if(p)for(var T in p)g[T]=p[T];var I=P[g.name];I||(I=ze(),P[g.name]=I),I.forages.push(w),w._initReady||(w._initReady=w.ready,w.ready=H);var S=[];function M(){return _.resolve()}for(var G=0;G<I.forages.length;G++){var q=I.forages[G];q!==w&&S.push(q._initReady().catch(M))}var Y=I.forages.slice(0);return _.all(S).then(function(){return g.db=I.db,Qe(g)}).then(function(J){return g.db=J,D(g,w._defaultConfig.version)?Bt(g):J}).then(function(J){g.db=I.db=J,w._dbInfo=g;for(var te=0;te<Y.length;te++){var ve=Y[te];ve!==w&&(ve._dbInfo.db=g.db,ve._dbInfo.version=g.version)}})}function tt(p,w){var g=this;p=N(p);var T=new _(function(I,S){g.ready().then(function(){he(g._dbInfo,Ee,function(M,G){if(M)return S(M);try{var q=G.objectStore(g._dbInfo.storeName),Y=q.get(p);Y.onsuccess=function(){var J=Y.result;J===void 0&&(J=null),k(J)&&(J=V(J)),I(J)},Y.onerror=function(){S(Y.error)}}catch(J){S(J)}})}).catch(S)});return y(T,w),T}function vt(p,w){var g=this,T=new _(function(I,S){g.ready().then(function(){he(g._dbInfo,Ee,function(M,G){if(M)return S(M);try{var q=G.objectStore(g._dbInfo.storeName),Y=q.openCursor(),J=1;Y.onsuccess=function(){var te=Y.result;if(te){var ve=te.value;k(ve)&&(ve=V(ve));var Oe=p(ve,te.key,J++);Oe!==void 0?I(Oe):te.continue()}else I()},Y.onerror=function(){S(Y.error)}}catch(te){S(te)}})}).catch(S)});return y(T,w),T}function Et(p,w,g){var T=this;p=N(p);var I=new _(function(S,M){var G;T.ready().then(function(){return G=T._dbInfo,Q.call(w)==="[object Blob]"?de(G.db).then(function(q){return q?w:R(w)}):w}).then(function(q){he(T._dbInfo,X,function(Y,J){if(Y)return M(Y);try{var te=J.objectStore(T._dbInfo.storeName);q===null&&(q=void 0);var ve=te.put(q,p);J.oncomplete=function(){q===void 0&&(q=null),S(q)},J.onabort=J.onerror=function(){var Oe=ve.error?ve.error:ve.transaction.error;M(Oe)}}catch(Oe){M(Oe)}})}).catch(M)});return y(I,g),I}function st(p,w){var g=this;p=N(p);var T=new _(function(I,S){g.ready().then(function(){he(g._dbInfo,X,function(M,G){if(M)return S(M);try{var q=G.objectStore(g._dbInfo.storeName),Y=q.delete(p);G.oncomplete=function(){I()},G.onerror=function(){S(Y.error)},G.onabort=function(){var J=Y.error?Y.error:Y.transaction.error;S(J)}}catch(J){S(J)}})}).catch(S)});return y(T,w),T}function we(p){var w=this,g=new _(function(T,I){w.ready().then(function(){he(w._dbInfo,X,function(S,M){if(S)return I(S);try{var G=M.objectStore(w._dbInfo.storeName),q=G.clear();M.oncomplete=function(){T()},M.onabort=M.onerror=function(){var Y=q.error?q.error:q.transaction.error;I(Y)}}catch(Y){I(Y)}})}).catch(I)});return y(g,p),g}function He(p){var w=this,g=new _(function(T,I){w.ready().then(function(){he(w._dbInfo,Ee,function(S,M){if(S)return I(S);try{var G=M.objectStore(w._dbInfo.storeName),q=G.count();q.onsuccess=function(){T(q.result)},q.onerror=function(){I(q.error)}}catch(Y){I(Y)}})}).catch(I)});return y(g,p),g}function Ae(p,w){var g=this,T=new _(function(I,S){if(p<0){I(null);return}g.ready().then(function(){he(g._dbInfo,Ee,function(M,G){if(M)return S(M);try{var q=G.objectStore(g._dbInfo.storeName),Y=!1,J=q.openKeyCursor();J.onsuccess=function(){var te=J.result;if(!te){I(null);return}p===0||Y?I(te.key):(Y=!0,te.advance(p))},J.onerror=function(){S(J.error)}}catch(te){S(te)}})}).catch(S)});return y(T,w),T}function $e(p){var w=this,g=new _(function(T,I){w.ready().then(function(){he(w._dbInfo,Ee,function(S,M){if(S)return I(S);try{var G=M.objectStore(w._dbInfo.storeName),q=G.openKeyCursor(),Y=[];q.onsuccess=function(){var J=q.result;if(!J){T(Y);return}Y.push(J.key),J.continue()},q.onerror=function(){I(q.error)}}catch(J){I(J)}})}).catch(I)});return y(g,p),g}function De(p,w){w=A.apply(this,arguments);var g=this.config();p=typeof p!="function"&&p||{},p.name||(p.name=p.name||g.name,p.storeName=p.storeName||g.storeName);var T=this,I;if(!p.name)I=_.reject("Invalid arguments");else{var S=p.name===g.name&&T._dbInfo.db,M=S?_.resolve(T._dbInfo.db):Qe(p).then(function(G){var q=P[p.name],Y=q.forages;q.db=G;for(var J=0;J<Y.length;J++)Y[J]._dbInfo.db=G;return G});p.storeName?I=M.then(function(G){if(G.objectStoreNames.contains(p.storeName)){var q=G.version+1;Le(p);var Y=P[p.name],J=Y.forages;G.close();for(var te=0;te<J.length;te++){var ve=J[te];ve._dbInfo.db=null,ve._dbInfo.version=q}var Oe=new _(function(Ne,nt){var Ze=f.open(p.name,q);Ze.onerror=function(Xt){var xi=Ze.result;xi.close(),nt(Xt)},Ze.onupgradeneeded=function(){var Xt=Ze.result;Xt.deleteObjectStore(p.storeName)},Ze.onsuccess=function(){var Xt=Ze.result;Xt.close(),Ne(Xt)}});return Oe.then(function(Ne){Y.db=Ne;for(var nt=0;nt<J.length;nt++){var Ze=J[nt];Ze._dbInfo.db=Ne,Se(Ze._dbInfo)}}).catch(function(Ne){throw(Re(p,Ne)||_.resolve()).catch(function(){}),Ne})}}):I=M.then(function(G){Le(p);var q=P[p.name],Y=q.forages;G.close();for(var J=0;J<Y.length;J++){var te=Y[J];te._dbInfo.db=null}var ve=new _(function(Oe,Ne){var nt=f.deleteDatabase(p.name);nt.onerror=function(){var Ze=nt.result;Ze&&Ze.close(),Ne(nt.error)},nt.onblocked=function(){console.warn('dropInstance blocked for database "'+p.name+'" until all open connections are closed')},nt.onsuccess=function(){var Ze=nt.result;Ze&&Ze.close(),Oe(Ze)}});return ve.then(function(Oe){q.db=Oe;for(var Ne=0;Ne<Y.length;Ne++){var nt=Y[Ne];Se(nt._dbInfo)}}).catch(function(Oe){throw(Re(p,Oe)||_.resolve()).catch(function(){}),Oe})})}return y(I,w),I}var $t={_driver:"asyncStorage",_initStorage:et,_support:m(),iterate:vt,getItem:tt,setItem:Et,removeItem:st,clear:we,length:He,key:Ae,keys:$e,dropInstance:De};function h(){return typeof openDatabase=="function"}var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u="~~local_forage_type~",v=/^~~local_forage_type~([^~]+)~/,x="__lfsc__:",O=x.length,W="arbf",ue="blob",_e="si08",ge="ui08",Me="uic8",ke="si16",rt="si32",pr="ur16",zr="ui32",_o="fl32",mr="fl64",dr=O+W.length,em=Object.prototype.toString;function tm(p){var w=p.length*.75,g=p.length,T,I=0,S,M,G,q;p[p.length-1]==="="&&(w--,p[p.length-2]==="="&&w--);var Y=new ArrayBuffer(w),J=new Uint8Array(Y);for(T=0;T<g;T+=4)S=c.indexOf(p[T]),M=c.indexOf(p[T+1]),G=c.indexOf(p[T+2]),q=c.indexOf(p[T+3]),J[I++]=S<<2|M>>4,J[I++]=(M&15)<<4|G>>2,J[I++]=(G&3)<<6|q&63;return Y}function Ll(p){var w=new Uint8Array(p),g="",T;for(T=0;T<w.length;T+=3)g+=c[w[T]>>2],g+=c[(w[T]&3)<<4|w[T+1]>>4],g+=c[(w[T+1]&15)<<2|w[T+2]>>6],g+=c[w[T+2]&63];return w.length%3===2?g=g.substring(0,g.length-1)+"=":w.length%3===1&&(g=g.substring(0,g.length-2)+"=="),g}function jv(p,w){var g="";if(p&&(g=em.call(p)),p&&(g==="[object ArrayBuffer]"||p.buffer&&em.call(p.buffer)==="[object ArrayBuffer]")){var T,I=x;p instanceof ArrayBuffer?(T=p,I+=W):(T=p.buffer,g==="[object Int8Array]"?I+=_e:g==="[object Uint8Array]"?I+=ge:g==="[object Uint8ClampedArray]"?I+=Me:g==="[object Int16Array]"?I+=ke:g==="[object Uint16Array]"?I+=pr:g==="[object Int32Array]"?I+=rt:g==="[object Uint32Array]"?I+=zr:g==="[object Float32Array]"?I+=_o:g==="[object Float64Array]"?I+=mr:w(new Error("Failed to get type for BinaryArray"))),w(I+Ll(T))}else if(g==="[object Blob]"){var S=new FileReader;S.onload=function(){var M=u+p.type+"~"+Ll(this.result);w(x+ue+M)},S.readAsArrayBuffer(p)}else try{w(JSON.stringify(p))}catch(M){console.error("Couldn't convert value into a JSON string: ",p),w(null,M)}}function Gv(p){if(p.substring(0,O)!==x)return JSON.parse(p);var w=p.substring(dr),g=p.substring(O,dr),T;if(g===ue&&v.test(w)){var I=w.match(v);T=I[1],w=w.substring(I[0].length)}var S=tm(w);switch(g){case W:return S;case ue:return d([S],{type:T});case _e:return new Int8Array(S);case ge:return new Uint8Array(S);case Me:return new Uint8ClampedArray(S);case ke:return new Int16Array(S);case pr:return new Uint16Array(S);case rt:return new Int32Array(S);case zr:return new Uint32Array(S);case _o:return new Float32Array(S);case mr:return new Float64Array(S);default:throw new Error("Unkown type: "+g)}}var Ml={serialize:jv,deserialize:Gv,stringToBuffer:tm,bufferToString:Ll};function rm(p,w,g,T){p.executeSql("CREATE TABLE IF NOT EXISTS "+w.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],g,T)}function zv(p){var w=this,g={db:null};if(p)for(var T in p)g[T]=typeof p[T]!="string"?p[T].toString():p[T];var I=new _(function(S,M){try{g.db=openDatabase(g.name,String(g.version),g.description,g.size)}catch(G){return M(G)}g.db.transaction(function(G){rm(G,g,function(){w._dbInfo=g,S()},function(q,Y){M(Y)})},M)});return g.serializer=Ml,I}function dn(p,w,g,T,I,S){p.executeSql(g,T,I,function(M,G){G.code===G.SYNTAX_ERR?M.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[w.storeName],function(q,Y){Y.rows.length?S(q,G):rm(q,w,function(){q.executeSql(g,T,I,S)},S)},S):S(M,G)},S)}function qv(p,w){var g=this;p=N(p);var T=new _(function(I,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(G){dn(G,M,"SELECT * FROM "+M.storeName+" WHERE key = ? LIMIT 1",[p],function(q,Y){var J=Y.rows.length?Y.rows.item(0).value:null;J&&(J=M.serializer.deserialize(J)),I(J)},function(q,Y){S(Y)})})}).catch(S)});return y(T,w),T}function Yv(p,w){var g=this,T=new _(function(I,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(G){dn(G,M,"SELECT * FROM "+M.storeName,[],function(q,Y){for(var J=Y.rows,te=J.length,ve=0;ve<te;ve++){var Oe=J.item(ve),Ne=Oe.value;if(Ne&&(Ne=M.serializer.deserialize(Ne)),Ne=p(Ne,Oe.key,ve+1),Ne!==void 0){I(Ne);return}}I()},function(q,Y){S(Y)})})}).catch(S)});return y(T,w),T}function nm(p,w,g,T){var I=this;p=N(p);var S=new _(function(M,G){I.ready().then(function(){w===void 0&&(w=null);var q=w,Y=I._dbInfo;Y.serializer.serialize(w,function(J,te){te?G(te):Y.db.transaction(function(ve){dn(ve,Y,"INSERT OR REPLACE INTO "+Y.storeName+" (key, value) VALUES (?, ?)",[p,J],function(){M(q)},function(Oe,Ne){G(Ne)})},function(ve){if(ve.code===ve.QUOTA_ERR){if(T>0){M(nm.apply(I,[p,q,g,T-1]));return}G(ve)}})})}).catch(G)});return y(S,g),S}function Kv(p,w,g){return nm.apply(this,[p,w,g,1])}function Xv(p,w){var g=this;p=N(p);var T=new _(function(I,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(G){dn(G,M,"DELETE FROM "+M.storeName+" WHERE key = ?",[p],function(){I()},function(q,Y){S(Y)})})}).catch(S)});return y(T,w),T}function Jv(p){var w=this,g=new _(function(T,I){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(M){dn(M,S,"DELETE FROM "+S.storeName,[],function(){T()},function(G,q){I(q)})})}).catch(I)});return y(g,p),g}function Qv(p){var w=this,g=new _(function(T,I){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(M){dn(M,S,"SELECT COUNT(key) as c FROM "+S.storeName,[],function(G,q){var Y=q.rows.item(0).c;T(Y)},function(G,q){I(q)})})}).catch(I)});return y(g,p),g}function Zv(p,w){var g=this,T=new _(function(I,S){g.ready().then(function(){var M=g._dbInfo;M.db.transaction(function(G){dn(G,M,"SELECT key FROM "+M.storeName+" WHERE id = ? LIMIT 1",[p+1],function(q,Y){var J=Y.rows.length?Y.rows.item(0).key:null;I(J)},function(q,Y){S(Y)})})}).catch(S)});return y(T,w),T}function eE(p){var w=this,g=new _(function(T,I){w.ready().then(function(){var S=w._dbInfo;S.db.transaction(function(M){dn(M,S,"SELECT key FROM "+S.storeName,[],function(G,q){for(var Y=[],J=0;J<q.rows.length;J++)Y.push(q.rows.item(J).key);T(Y)},function(G,q){I(q)})})}).catch(I)});return y(g,p),g}function tE(p){return new _(function(w,g){p.transaction(function(T){T.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(I,S){for(var M=[],G=0;G<S.rows.length;G++)M.push(S.rows.item(G).name);w({db:p,storeNames:M})},function(I,S){g(S)})},function(T){g(T)})})}function rE(p,w){w=A.apply(this,arguments);var g=this.config();p=typeof p!="function"&&p||{},p.name||(p.name=p.name||g.name,p.storeName=p.storeName||g.storeName);var T=this,I;return p.name?I=new _(function(S){var M;p.name===g.name?M=T._dbInfo.db:M=openDatabase(p.name,"","",0),p.storeName?S({db:M,storeNames:[p.storeName]}):S(tE(M))}).then(function(S){return new _(function(M,G){S.db.transaction(function(q){function Y(Oe){return new _(function(Ne,nt){q.executeSql("DROP TABLE IF EXISTS "+Oe,[],function(){Ne()},function(Ze,Xt){nt(Xt)})})}for(var J=[],te=0,ve=S.storeNames.length;te<ve;te++)J.push(Y(S.storeNames[te]));_.all(J).then(function(){M()}).catch(function(Oe){G(Oe)})},function(q){G(q)})})}):I=_.reject("Invalid arguments"),y(I,w),I}var nE={_driver:"webSQLStorage",_initStorage:zv,_support:h(),iterate:Yv,getItem:qv,setItem:Kv,removeItem:Xv,clear:Jv,length:Qv,key:Zv,keys:eE,dropInstance:rE};function oE(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function om(p,w){var g=p.name+"/";return p.storeName!==w.storeName&&(g+=p.storeName+"/"),g}function iE(){var p="_localforage_support_test";try{return localStorage.setItem(p,!0),localStorage.removeItem(p),!1}catch{return!0}}function sE(){return!iE()||localStorage.length>0}function aE(p){var w=this,g={};if(p)for(var T in p)g[T]=p[T];return g.keyPrefix=om(p,w._defaultConfig),sE()?(w._dbInfo=g,g.serializer=Ml,_.resolve()):_.reject()}function cE(p){var w=this,g=w.ready().then(function(){for(var T=w._dbInfo.keyPrefix,I=localStorage.length-1;I>=0;I--){var S=localStorage.key(I);S.indexOf(T)===0&&localStorage.removeItem(S)}});return y(g,p),g}function lE(p,w){var g=this;p=N(p);var T=g.ready().then(function(){var I=g._dbInfo,S=localStorage.getItem(I.keyPrefix+p);return S&&(S=I.serializer.deserialize(S)),S});return y(T,w),T}function uE(p,w){var g=this,T=g.ready().then(function(){for(var I=g._dbInfo,S=I.keyPrefix,M=S.length,G=localStorage.length,q=1,Y=0;Y<G;Y++){var J=localStorage.key(Y);if(J.indexOf(S)===0){var te=localStorage.getItem(J);if(te&&(te=I.serializer.deserialize(te)),te=p(te,J.substring(M),q++),te!==void 0)return te}}});return y(T,w),T}function fE(p,w){var g=this,T=g.ready().then(function(){var I=g._dbInfo,S;try{S=localStorage.key(p)}catch{S=null}return S&&(S=S.substring(I.keyPrefix.length)),S});return y(T,w),T}function pE(p){var w=this,g=w.ready().then(function(){for(var T=w._dbInfo,I=localStorage.length,S=[],M=0;M<I;M++){var G=localStorage.key(M);G.indexOf(T.keyPrefix)===0&&S.push(G.substring(T.keyPrefix.length))}return S});return y(g,p),g}function mE(p){var w=this,g=w.keys().then(function(T){return T.length});return y(g,p),g}function dE(p,w){var g=this;p=N(p);var T=g.ready().then(function(){var I=g._dbInfo;localStorage.removeItem(I.keyPrefix+p)});return y(T,w),T}function hE(p,w,g){var T=this;p=N(p);var I=T.ready().then(function(){w===void 0&&(w=null);var S=w;return new _(function(M,G){var q=T._dbInfo;q.serializer.serialize(w,function(Y,J){if(J)G(J);else try{localStorage.setItem(q.keyPrefix+p,Y),M(S)}catch(te){(te.name==="QuotaExceededError"||te.name==="NS_ERROR_DOM_QUOTA_REACHED")&&G(te),G(te)}})})});return y(I,g),I}function gE(p,w){if(w=A.apply(this,arguments),p=typeof p!="function"&&p||{},!p.name){var g=this.config();p.name=p.name||g.name,p.storeName=p.storeName||g.storeName}var T=this,I;return p.name?I=new _(function(S){p.storeName?S(om(p,T._defaultConfig)):S(p.name+"/")}).then(function(S){for(var M=localStorage.length-1;M>=0;M--){var G=localStorage.key(M);G.indexOf(S)===0&&localStorage.removeItem(G)}}):I=_.reject("Invalid arguments"),y(I,w),I}var yE={_driver:"localStorageWrapper",_initStorage:aE,_support:oE(),iterate:uE,getItem:lE,setItem:hE,removeItem:dE,clear:cE,length:mE,key:fE,keys:pE,dropInstance:gE},vE=function(w,g){return w===g||typeof w=="number"&&typeof g=="number"&&isNaN(w)&&isNaN(g)},EE=function(w,g){for(var T=w.length,I=0;I<T;){if(vE(w[I],g))return!0;I++}return!1},im=Array.isArray||function(p){return Object.prototype.toString.call(p)==="[object Array]"},Ii={},sm={},bo={INDEXEDDB:$t,WEBSQL:nE,LOCALSTORAGE:yE},_E=[bo.INDEXEDDB._driver,bo.WEBSQL._driver,bo.LOCALSTORAGE._driver],Hs=["dropInstance"],Bl=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Hs),bE={description:"",driver:_E.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function wE(p,w){p[w]=function(){var g=arguments;return p.ready().then(function(){return p[w].apply(p,g)})}}function Ul(){for(var p=1;p<arguments.length;p++){var w=arguments[p];if(w)for(var g in w)w.hasOwnProperty(g)&&(im(w[g])?arguments[0][g]=w[g].slice():arguments[0][g]=w[g])}return arguments[0]}var SE=(function(){function p(w){a(this,p);for(var g in bo)if(bo.hasOwnProperty(g)){var T=bo[g],I=T._driver;this[g]=I,Ii[I]||this.defineDriver(T)}this._defaultConfig=Ul({},bE),this._config=Ul({},this._defaultConfig,w),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return p.prototype.config=function(g){if((typeof g>"u"?"undefined":s(g))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var T in g){if(T==="storeName"&&(g[T]=g[T].replace(/\W/g,"_")),T==="version"&&typeof g[T]!="number")return new Error("Database version must be a number.");this._config[T]=g[T]}return"driver"in g&&g.driver?this.setDriver(this._config.driver):!0}else return typeof g=="string"?this._config[g]:this._config},p.prototype.defineDriver=function(g,T,I){var S=new _(function(M,G){try{var q=g._driver,Y=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!g._driver){G(Y);return}for(var J=Bl.concat("_initStorage"),te=0,ve=J.length;te<ve;te++){var Oe=J[te],Ne=!EE(Hs,Oe);if((Ne||g[Oe])&&typeof g[Oe]!="function"){G(Y);return}}var nt=function(){for(var xi=function(xE){return function(){var CE=new Error("Method "+xE+" is not implemented by the current driver"),am=_.reject(CE);return y(am,arguments[arguments.length-1]),am}},kl=0,IE=Hs.length;kl<IE;kl++){var Fl=Hs[kl];g[Fl]||(g[Fl]=xi(Fl))}};nt();var Ze=function(xi){Ii[q]&&console.info("Redefining LocalForage driver: "+q),Ii[q]=g,sm[q]=xi,M()};"_support"in g?g._support&&typeof g._support=="function"?g._support().then(Ze,G):Ze(!!g._support):Ze(!0)}catch(Xt){G(Xt)}});return C(S,T,I),S},p.prototype.driver=function(){return this._driver||null},p.prototype.getDriver=function(g,T,I){var S=Ii[g]?_.resolve(Ii[g]):_.reject(new Error("Driver not found."));return C(S,T,I),S},p.prototype.getSerializer=function(g){var T=_.resolve(Ml);return C(T,g),T},p.prototype.ready=function(g){var T=this,I=T._driverSet.then(function(){return T._ready===null&&(T._ready=T._initDriver()),T._ready});return C(I,g,g),I},p.prototype.setDriver=function(g,T,I){var S=this;im(g)||(g=[g]);var M=this._getSupportedDrivers(g);function G(){S._config.driver=S.driver()}function q(te){return S._extend(te),G(),S._ready=S._initStorage(S._config),S._ready}function Y(te){return function(){var ve=0;function Oe(){for(;ve<te.length;){var Ne=te[ve];return ve++,S._dbInfo=null,S._ready=null,S.getDriver(Ne).then(q).catch(Oe)}G();var nt=new Error("No available storage method found.");return S._driverSet=_.reject(nt),S._driverSet}return Oe()}}var J=this._driverSet!==null?this._driverSet.catch(function(){return _.resolve()}):_.resolve();return this._driverSet=J.then(function(){var te=M[0];return S._dbInfo=null,S._ready=null,S.getDriver(te).then(function(ve){S._driver=ve._driver,G(),S._wrapLibraryMethodsWithReady(),S._initDriver=Y(M)})}).catch(function(){G();var te=new Error("No available storage method found.");return S._driverSet=_.reject(te),S._driverSet}),C(this._driverSet,T,I),this._driverSet},p.prototype.supports=function(g){return!!sm[g]},p.prototype._extend=function(g){Ul(this,g)},p.prototype._getSupportedDrivers=function(g){for(var T=[],I=0,S=g.length;I<S;I++){var M=g[I];this.supports(M)&&T.push(M)}return T},p.prototype._wrapLibraryMethodsWithReady=function(){for(var g=0,T=Bl.length;g<T;g++)wE(this,Bl[g])},p.prototype.createInstance=function(g){return new p(g)},p})(),TE=new SE;o.exports=TE},{3:3}]},{},[4])(4)})});var Uf=Hl((ec,rg)=>{"use strict";(function(t,e){typeof ec=="object"&&typeof rg<"u"?e(ec):typeof define=="function"&&define.amd?define(["exports"],e):e((t=typeof globalThis<"u"?globalThis:t||self).Sqrl={})})(ec,function(t){"use strict";function e(D){var R,V,k=new Error(D);return R=k,V=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(R,V):R.__proto__=V,k}function r(D,R,V){var k=R.slice(0,V).split(/\n/),H=k.length,ne=k[H-1].length+1;throw e(D+=" at line "+H+" col "+ne+`:
2
2
 
3
3
  `+R.split(/\n/)[H-1]+`
4
4
  `+Array(ne).join(" ")+"^")}e.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var n=new Function("return this")().Promise,o=!1;try{o=new Function("return (async function(){}).constructor")()}catch(D){if(!(D instanceof SyntaxError))throw D}function i(D,R){return Object.prototype.hasOwnProperty.call(D,R)}function s(D,R,V){for(var k in R)i(R,k)&&(R[k]==null||typeof R[k]!="object"||k!=="storage"&&k!=="prefixes"||V?D[k]=R[k]:D[k]=s({},R[k]));return D}var a=/^async +/,l=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,f=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,m=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,d=/[.*+\-?^${}()|[\]\\]/g;function _(D){return d.test(D)?D.replace(d,"\\$&"):D}function y(D,R){R.rmWhitespace&&(D=D.replace(/[\r\n]+/g,`
@@ -60,4 +60,4 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
60
60
  style="background-color: ${e.pagination.color?.rgba};">
61
61
  </span>
62
62
  `},navigation:{nextEl:t.querySelector(".swiper-button-next"),prevEl:t.querySelector(".swiper-button-prev")},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:!1,pauseOnMouseEnter:!1}:!1,autoHeight:!0};e.marquee&&r.autoplay&&typeof r.autoplay=="object"&&(r.speed=e.speed,r.autoplay.pauseOnMouseEnter=!0,t.style.setProperty("--swiper-wrapper-transition-timing-function","linear"));let n=new window.CooeeSDK.Swiper(t,r);return t.style.setProperty("--swiper-navigation-size",`${e.navigation.size}px`),n}function _l(t,e,r){let n={color:t.navigation.color?.rgba};return t.pagination.enabled&&(n.transform="translateY(-25%)"),K("div",{class:"swiper-container",ref:e,style:"max-width: 100%",children:[K("div",{class:"swiper-wrapper",children:r()}),t.navigation.enabled&&K("div",{class:"swiper-button-next",style:n,children:K("span",{})}),t.navigation.enabled&&K("div",{class:"swiper-button-prev",style:n,children:K("span",{})}),t.pagination.enabled&&K("div",{className:"swiper-pagination",style:{bottom:0,top:"unset",position:"relative",color:t.pagination.color?.rgba}})]})}var As=class extends Ue{componentDidMount(){wt(()=>{this.setState(()=>({checked:this.props.item.selected.value}))})}render(){return K("div",{style:this.getCompiledStyles(),className:"lc-checkbox",children:K("input",{type:"checkbox",checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:"auto"}})})}onChange(e){let{checked:r}=e.target;this.props.item.selected.value=r}getTypoStyles(){let e={},r=this.mediaStyle.typo??new at;return e.textAlign=r.alignment,e.justifyContent=r.alignment,e}getComponentStyles(){return Z(E({},this.getTypoStyles()),{display:"flex"})}};var pn=class extends Ue{constructor(e,r){super(e,r)}render(){let e=this.props.element[this.deviceTypeKey],r=e?.src||this.props.element.src||this.props.element.lg?.src;return K("img",{onClick:this.customOnClick.bind(this),className:"lc-image",alt:e?.name||"Image",onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:r,style:this.getCompiledStyles()})}customOnClick(e){this.props.element.clc?.at===be.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(e,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick("image")}getComponentStyles(){let e=this.mediaStyle.lout;if(!e||e.pos!=="absolute")return{};let r={zIndex:e.zIndex,cursor:this.props.element.clc?.at?"pointer":"auto"};return this.mediaStyle.size?.w&&(r.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(r.height=this.mediaStyle.size.h),r}handleMouseEnter(e){let r=this.props.element[this.deviceTypeKey]?.secondarySrc;r&&(e.currentTarget.src=r)}handleMouseLeave(e){e.currentTarget.src=this.props.element[this.deviceTypeKey]?.src}};var mn=class extends Ue{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return K("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:K(Hn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new Xo,r={display:"flex",gap:e.gap+"px",flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai};return e.wrap==="nowrap"&&e.scroll&&(e.dir==="column"?r["overflow-y"]="auto":r["overflow-x"]="auto"),r}};var Ds=class extends mn{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return K("div",{style:this.getCompiledStyles(),class:"lc-flexbox",children:K(wi,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.props.noLinks})})}};var Os=class extends Ue{render(){return K("select",{style:this.getCompiledStyles(),value:this.props.selectedVariant.selectedSellingPlan.value?.mID??"",onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){wt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new at;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.selectedVariant.sellingPlans?.length||(e.visibility="hidden"),E(E({},e),this.getTypoStyles())}createSelectItems(){let e=[],r=this.props.selectedVariant;if(!r.sellingPlans?.length)return[];this.props.triggerContext.triggerData.skipSubscribedItems?r.selectedSellingPlan.value||(r.sellingPlans[0].isSelected=!0,r.changeSellingPlan(r.sellingPlans[0])):e.push(K("option",{value:"",selected:!r.selectedSellingPlan,children:"One time purchase"}));for(let n of r.sellingPlans??[])e.push(K("option",{value:n.mID,selected:n.isSelected,children:n.name}));return e}onChange(e){let r=e.target.value;r?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(n=>n.mID===r):this.props.selectedVariant.selectedSellingPlan.value=void 0}};var MT=new RegExp('fill="#[a-zA-Z0-9]+"'),Ns=class extends Ue{constructor(){super()}render(){let e=this.getCompiledStyles(),r=this.getRating();return r||(e.display="none",r=""),K("div",{style:e,className:"lc-star-rating",dangerouslySetInnerHTML:{__html:r}})}getRating(){let e={size:this.props.element.iconSize,color:this.props.element.c.hex},r=Vo(this.props.element.fullStar,{svg:e},this.props.triggerContext),n=Vo(this.props.element.halfStart,{svg:e},this.props.triggerContext),o=this.props.review;if(!o?.rating)return"";let i="";if(this.props.element.showSingleStar)i=r;else{let s=5,a=`${o.rating}`.split(".");for(let l=0;l<+a[0];l++)i+=r,s--;a[1]&&(i+=n,s--);for(let l=0;l<s;l++)i+=r.replace(MT,'fill="#f1f1f1"')}return i}getComponentStyles(){return{display:"flex",alignItems:"center"}}};var Ps=class extends Ue{render(){return K("select",{style:this.getCompiledStyles(),value:this.props.item.selectedOrFirstVariant.value.mID,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:"lc-dropdown",children:this.createSelectItems()})}componentDidMount(){wt(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:!1}))})}getTypoStyles(){let e={},r=this.mediaStyle.typo??new at;return e.letterSpacing=r.letterSpacing,e.fontSize=r.fs+"px",e.lineHeight=r.lh,e.fontFamily="inherit",e.textAlign=r.alignment,e.fontWeight=r.fw,this.stylesConverter.getColourStyles(r.tc,"color",e),e.boxShadow="none",e}getComponentStyles(){let e={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"&&(e.visibility="hidden"),E(E({},e),this.getTypoStyles())}createSelectItems(){let e=[];for(let r of this.props.item.vars)e.push(K("option",{value:r.mID,disabled:!r.isAvailable,children:r.name}));return e}onChange(e){let r=e.target.value,n=this.props.item.vars.find(o=>o.mID===r);this.props.item.setSelectedVariant(n)}};var wv=()=>{let t=window.ShopifyAnalytics?.meta??{},e=t.selectedVariantId;if(e)return e;if(t.product?.variants?.length>0)return t.product.variants[0].id},zp=t=>{if(!t)return;let e;try{e=new URL(t)}catch{return}if(e.hostname!=="cdn.shopify.com")return t;let r=e.pathname.split(".");return r.length!==2?t:(e.pathname=r[0]+"_large."+r[1],e.toString())};var wi=class extends Ue{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}renderElement(e){if(!(e.hide||!this.matchWhenCondition(e.when))){if(e.t===4){let r=e;return r.l==="Star Rating"&&!this.props.item.reviews?.rating?void 0:K(Ds,{element:r,triggerContext:this.props.triggerContext,elements:r.elems,item:this.props.item,noLinks:this.props.noLinks})}if(e.t===6)return this.props.triggerContext.triggerData.isBundle()?K(As,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):void 0;if(e.t===13){let r=e,n=this.props.item,o=zp(n.variantImage??n.firstImageURL),i=zp(n.variantSecondaryImage??n.secondaryImageURL);r.lg=r.sm={src:o,name:n.name,secondarySrc:i};let s=K(pn,{element:r,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:K("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block"},children:s})}if(e.t===14)return this.renderProductTitle(e);if(e.t===15){let r=e;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name==="Default Title"?void 0:r.showChips?K("cooee-product-options-picker",{item:this.props.item}):K(Ps,{element:r,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?K(Os,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?K(Ns,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?K(vo,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):K(Hn,{elements:[e],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.attachListener(),this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}renderProductTitle(e){let r=K(Kt,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?r:K("a",{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:"block",textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:r})}customOnClick(e){this.sendTriggerClicked([this.props.item.toEmbed()],{from:e})}onMouseEnter(){this.setState(()=>({decoration:"underline"}))}onMouseLeave(){this.setState(()=>({decoration:"unset"}))}attachListener(){document.addEventListener("letscooee:variant-change",e=>{let r=e;if(!r.detail||this.props.item.mID!==r.detail.productID)return;let n=r.detail.variantID;this.props.item.setSelectedVariantByID(n)})}};var Eo=class extends Ue{productElement;constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"}))}render(){let e=Qn(this.props.element,this.getProductData(),this.props.triggerContext);if(this.productElement=new Cn(e),!(this.productElement.hide||!this.matchWhenCondition(this.productElement.when)))return K("div",{style:E({},this.getCompiledStyles()),class:"lc-single-product",children:K(wi,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,noLinks:this.productElement.noLinks})})}getComponentStyles(){return{flexShrink:0}}getProductData(){if(!this.props.item)return{};let e=this.props.item,r=e.selectedOrFirstVariant.value,n=e.getTemplateVariables();n.product.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(this.props.item.quantity):this.props.item.quantity;let o=this.props.triggerContext.triggerData.discount?.type===Jt.BXGY;return!r.hasEffectivePrice()&&o&&(n.product=Z(E(E({},n.product),Lt("effective_price",r.effectivePrice.value)),{price:""})),n.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(r.quantity):r.quantity,{product:n.product,variant:n.variant,svg:{color:"{{ svg.color }}",size:"{{ svg.size }}"}}}};var Ls=class extends Ue{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,r){super(e,r),this.configuration=Wr()?this.props.element.conf.sm:this.props.element.conf.lg,this.gap=(this.configuration.gap??15)+"px"}componentDidMount(){this.props.element.conf[this.deviceTypeKey].disp===2&&Ac().then(()=>{this.swiperInstance=El(this.swiperRef,this.props.element.conf[this.deviceTypeKey])})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.triggerContext.triggerData.items;e.splice(this.configuration.maxItems??10);let r;if(this.configuration.disp===2){let n=i=>{this.swiperRef=i},o=()=>e?.map(i=>K("div",{class:"swiper-slide",children:this.getProductFragment(i)}));r=K("div",{style:Z(E({},this.getCompiledStyles()),{display:"block"}),class:"lc-product-swiper-list",children:_l(this.configuration,n,o)})}else r=K("div",{style:this.getCompiledStyles(),class:"lc-product-list",children:e?.map((n,o)=>this.getProductFragment(n,o!==e.length-1))});return r}getComponentStyles(){let e=[0,2].includes(this.configuration.disp),r={display:e?"flex":"grid",justifyContent:"safe "+(this.mediaStyle.flex?.jc??"center"),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??"row"};if(r.flexDirection==="row"){if(e)r.maxWidth="100%",r.overflowY="auto";else if(this.configuration.disp===1){let n=this.props.triggerContext.triggerData,o=n.items.length,i;n.isBundle()?i=this.props.element.prod.symbol?.hide!==!0?o*2-1:o:i=this.props.element.conf[this.deviceTypeKey].maxInRow,r.gridTemplateColumns=`repeat(${i}, auto)`}}return r}getProductFragment(e,r=!1){return K(Lr,{children:[K(Eo,{element:this.props.element.prod,item:e,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&r&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&K("div",{style:{display:"flex",alignItems:"center",justifyContent:"center"},children:K(Kt,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var Ms=class extends Ue{swiperRef=null;swiperInstance=null;constructor(e,r){super(e,r)}componentDidMount(){Ac().then(()=>{this.swiperInstance=El(this.swiperRef,this.props.element.conf)})}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy()}render(){let e=this.props.element,r=o=>{this.swiperRef=o},n=()=>{let o=e.values?.map(a=>K("div",{class:"swiper-slide",onClick:l=>this.onClick(l,{clickAction:this.getClickAction(a)}),children:this.renderElement(a)}));if(!o?.length)return[];let i=e.conf,s=o.length;if(i.marquee&&s<=Number(i.maxInRow)){let a=Number(i.maxInRow)-s+1;for(let l=0;l<a;l++)o.push(o[l%s])}return o};return _l(e.conf,r,n)}getComponentStyles(){return{}}renderElement(e){let r=this.valueAddedSlide(this.props.element.slide,e);switch(r?.t){case 1:return K(pn,{element:r,triggerContext:this.props.triggerContext});case 4:return K(mn,{elements:r.elems,element:r,triggerContext:this.props.triggerContext});default:b.warn("Unknown slide type for carousal")}}valueAddedSlide(e,r){let n=Qn(e,{form:r},this.props.triggerContext);return Gt.getParsedElement(n)}getClickAction(e){return Qn(this.props.element.clc??{},{form:e},this.props.triggerContext)}};var Hn=class extends Ue{constructor(e,r){super(e,r),this.setState(()=>({decoration:"unset"})),wt(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}))})}renderElement(e){if(!e.hide){if(e.t===4){let r=e;return K(mn,{element:r,triggerContext:this.props.triggerContext,elements:r.elems})}if(e.t===61)return K(Rs,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?K(vo,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return K(Kt,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return K(pn,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return K(Ls,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return K(Eo,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return K(Ms,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return{}}};var Bs=class extends Ue{clickAction;isClickable;constructor(e,r){super(e,r),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===be.GO_TO_URL&&!!Uo(this.clickAction.gu?.u)||this.clickAction?.at===be.OPEN_CART||this.clickAction?.at===be.INITIATE_CHECKOUT}componentDidMount(){wt(()=>{let e=this.props.triggerContext.triggerData,r=this.props.triggerContext.selectedItems;e.calculateDiscountData(r,this.props.triggerContext.shouldGiveFBTDiscount)})}render(){return K(Lr,{children:[K("div",{style:this.getCompiledStyles(),class:"lc-container",onClick:e=>{this.onClick(e,{clickAction:this.clickAction})},children:K(Hn,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id==="preview"&&K("div",{class:"letscooee-preview-badge",children:["#",this.props.triggerContext.triggerData.shortID," preview"]})]})}getComponentStyles(){let e={position:"relative",overflow:"hidden",display:"block"};return this.isClickable&&(e.cursor="pointer"),e}};var it=class t{constructor(e){this.engagementTrigger=e;this.triggerContext=new Ir(new Date,this.engagementTrigger)}static currentEngagements=new Set;static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;triggerContext;observers=[];renderedCount=0;scrollSubscription;isExclusionWithBVariation;isProcessing=!1;renderSilently(){this.acquireProcessingLock()||this.render().finally(()=>this.releaseProcessingLock()).catch(e=>{ae(e,"render-widget",{triggerContext:this.triggerContext})})}destroy(){b.verbose(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),t.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID),sp(this.engagementTrigger.content?.afterDeleteJS)}matches(e){return this.engagementTrigger.shortID===e.shortID}async render(){if(this.engagementTrigger.shouldGetVariationImmediately()){let e=await this.getVariation();this.handleVariationResponse(e)}if(this.rootContainer=await this.getWidgetContainer(!0),!this.rootContainer){b.warn(`${this.engagementTrigger} no section found to render the widget`);return}this.afterRootContainerCreated(),await this.getVariationIfRequired(),await this.runChoresBeforeRender(),this.attachScroll(),this.checkAndSendEvent(),this.triggerContext.renderer=this,sp(this.engagementTrigger.content?.afterRenderJS)}async updateAndReRender(e){if(!this.acquireProcessingLock())try{this.updateItems(e.items,this.engagementTrigger.items),await this.update(e),await this.render()}finally{this.releaseProcessingLock()}}async update(e){this.engagementTrigger.variation=e.variation}async rerenderIfDeleted(){if(!this.rootContainer?.isConnected&&!this.acquireProcessingLock()){b.info(`${this.engagementTrigger} deleted. Will be re-rendered`);try{this.preDestroy(),await this.render()}finally{this.releaseProcessingLock()}}}updateAngularWidget(){return this.widgetElement?.isConnected?(this.widgetElement.update(),!0):!1}preDestroy(){this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect()})}acquireProcessingLock(){return this.isProcessing?(b.verbose(`Lock could not be acquired for ${this.engagementTrigger}`),!0):(b.verbose(`Acquiring rendering lock for ${this.engagementTrigger}`),this.isProcessing=!0,!1)}releaseProcessingLock(){b.verbose(`Releasing rendering lock for ${this.engagementTrigger}`),this.isProcessing=!1}afterRootContainerCreated(){}isAllOkToRender(){return!!this.engagementTrigger.widget}async getVariationIfRequired(){if(this.engagementTrigger.shouldSkipVariation()){b.verbose(`${this.engagementTrigger} already has necessary data to render`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e)}handleVariationResponse(e){if(!e)return;let r=this.engagementTrigger;b.log(`${r} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(r.items=e.items.map(n=>new xt(n)),r.nonMutableItems=e.items.map(n=>new xt(n))),e.bundleFrom&&(r.bundleFrom=new xt(e.bundleFrom)),e.discount&&(r.discount=e.discount),e.placement&&(r.placement=e.placement),e.props&&_t.hasKeys(e.props)&&(r.props=E(E({},r.props),e.props)),e.content&&(r.content=new rs(e.content)),r.widget=new ti(e.widget),r.contentID=e.contentID,r.variation=e.variation,r.placement=e.placement,r.manipulation=e.manipulation,r.entryAnimation=e.entryAnimation??"NONE",this.isExclusionWithBVariation=r.isExclusionTesting()&&r.variation==="b",this.isExclusionWithBVariation&&(this.rootContainer.style.height="0.5px")}addToRendered(){this.renderedCount++,b.info(`${this.engagementTrigger} rendered \u2705 ${Sh(this.renderedCount)} time`)}removeFromRendered(){this instanceof dt?dt.currentEngagements.delete(this):t.currentEngagements.delete(this)}async getVariation(){b.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id==="preview"};try{return(await Sv(e)).data}catch(r){if(r instanceof er&&r.response?.status===400)return;ae(r,"get-variation",{engagementTrigger:this.engagementTrigger});return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){b.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,r={root:null,rootMargin:`${e}px 0px ${e}px 0px`,threshold:0};return this.isInViewport()?this.getVariation():new Promise(n=>{let o=new IntersectionObserver((i,s)=>{i.forEach(async a=>{if(a.isIntersecting){b.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);let l=await this.getVariation();n(l),s.unobserve(this.rootContainer)}})},r);o.observe(this.rootContainer),this.observers.push(o)})}attachScroll(){this.scrollSubscription=po(window,"scroll").pipe(qt(t.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent()})}checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(t.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let n={};this.triggerContext.triggerData.items?.length&&(n.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let o=this.isExclusionWithBVariation?"CE Campaign Holdout":"CE Trigger Displayed",i=new xe(o,n,this.engagementTrigger);i.name==="CE Campaign Holdout"&&(i.trigger.holdout=!0),Mt(i),t.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe()}generateParentElementID(){return`letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let r=this.widgetElement=document.createElement(e);return r.cart=me.getCurrent(),r.triggerContext=this.triggerContext,r.engagementTrigger=this.engagementTrigger,r.setAttribute("engagement",this.engagementTrigger.shortID),this.rootContainer.appendChild(r),this.addToRendered(),this.injectOuterCSSOnly(),r}getParentElement(e,r=document){let n=r.getElementById(e);if(n)return n;let o=this.engagementTrigger.objective.toLowerCase().replaceAll("_","-"),i=this.engagementTrigger.shortID;return n=document.createElement("div"),n.id=e,n.className=`letscooee letscooee-engagement engagement-${i} lc-${o}`,n.dataset.engagementId=i,this.engagementTrigger.id==="preview"&&(n.className+=" letscooee-preview"),n.style.display="block",n.style.minHeight="0.5px",n.style.minWidth="0.5px",n}async startRendering(){let e=this.rootContainer,r=this.triggerContext.triggerData.hasSwiperElement();r&&(e=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:"open"}),ap(e)),this.injectCampaignCSS(r,e);let n=this.engagementTrigger.widget;Fh(Sf(Bs,{element:n.cont,triggerContext:this.triggerContext,elements:n.elems}),e),this.addToRendered()}injectCampaignCSS(e,r){let n=this.engagementTrigger.content?.outerCSS?.trim()??"",o=this.engagementTrigger.content?.innerCSS?.trim()??"";if(!n&&!o)return;let i=this.rootContainer.id;if(e){sn(o,r),this.injectOuterCSSOnly();return}let s=n+`
63
- ${o}`;sn(`#${i} { ${s} }`)}injectOuterCSSOnly(){let e=this.engagementTrigger.content?.outerCSS?.trim();if(!e)return;let r=this.rootContainer.id;sn(`#${r} { ${e} }`)}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,o=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,i=e.width*e.height,s=o/i*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return b.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let n=r.selector,o;if(n.includes(":shadow")){let l=n.split(":shadow");o=(await Sn(l[0].trim()))?.shadowRoot,n=l[1].trim(),o&&ap(o,!1)}b.verbose(`${this.engagementTrigger} attempt to render "${r.position}" "${n}"`);let i=await Sn(n,3,o??document);if(!i)return b.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let s=this.generateParentElementID(),a=this.getParentElement(s);if(!e)return a;switch(r.position){case At.BEFORE1:case At.BEFORE:{i.parentElement?.insertBefore(a,i);break}case At.INSIDE_FIRST1:case At.INSIDE_FIRST:{i.insertBefore(a,i.firstChild);break}case At.INSIDE_LAST1:case At.INSIDE_LAST:{i.appendChild(a);break}case At.AFTER1:case At.AFTER:default:i.parentElement?.insertBefore(a,i.nextSibling)}return a}async runChoresBeforeRender(){if(this.isExclusionWithBVariation)return;if(!this.isAllOkToRender()){b.info(`\u26A0\uFE0F ${this.engagementTrigger} could not be rendered`);return}b.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await hl(this.engagementTrigger)}catch(r){b.info(`\u203C\uFE0F${this.engagementTrigger} could not render as items failed to refresh`,r);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){b.info(`\u203C\uFE0F${this.engagementTrigger} could not render as no products promoted`);return}this.engagementTrigger.items=e,await this.startRendering()}updateItems(e,r){let n=this.getItemDiff(e,r),o=this.getItemDiff(r,e);r.push(...n);for(let i of o)Yr.remove(r,i)}getItemDiff(e,r){return e.filter(n=>!r.some(o=>o.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}};var dt=class extends it{static currentEngagements=new Set;constructor(e){super(e)}rerenderAfterCartOpened(){this.rerenderIfDeleted(),this.checkAndSendEvent()}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}checkAndSendEvent(){if(!Je.get().isOpen()&&fe().pageName!=="cart"){b.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}};var BT=t=>t,Tv=t=>t.filter(e=>e.removedNodes&&e.removedNodes.length>0);function Iv(t,e={childList:!0,subtree:!0},r=500,n=BT){return Qc(o=>{let i=new MutationObserver(s=>o(s));return i.observe(t,e),i},(o,i)=>i.disconnect()).pipe(un(o=>n(o)),Lp(o=>o.length>0),qt(r))}var bl=class t{constructor(e,r){this.engagementTrigger=e;this.element=r;this.cartItems=me.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){b.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){b.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let o of n)new t(e,o).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(m=>m.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(m=>m.mID===e.id.toString());if(!n)return;let o=new Mr(n),i=e.selling_plan_allocation?.selling_plan;if(i)for(let m of o.sellingPlans??[])m.mID===i.id.toString()&&(m.isSelected=!0,o.changeSellingPlan(m));let s=new xt(r);s.vars=[o],s.selectedOrFirstVariant.value=o;let a=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(a);let l=new St(this.engagementTrigger);l.placement.selector=`.${a}`,l.items=[s];let f=new dt(l);f.renderSilently(),this.watchForCartItemDeletion(f,a)}watchForCartItemDeletion(e,r){let n=new MutationObserver(o=>{o.forEach(i=>{i.removedNodes.forEach(s=>{s===this.element&&(b.verbose(`${r} has been removed`),e.destroy(),n.disconnect())})})});n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(r=>{if(!(e.includes(r.url)||e.includes(r.variant_id))&&(!e.includes(r.product_title)||r.variant_title&&!e.includes(r.variant_title)))return!1;let n=r.selling_plan_allocation?.selling_plan?.name;return!(n&&!e.includes(n))})}};var wl=class extends dt{constructor(e){super(e)}async update(e){await super.update(e),this.engagementTrigger.progressBarConfig.update(e.progressBarConfig),await this.checkMilestoneTryCatch(),this.updateAngularWidget()}isAllOkToRender(){return!!this.engagementTrigger.progressBarConfig}async startRendering(){if(this.updateAngularWidget()){this.addToRendered();return}this.createAngularWidget("cooee-progressbar"),await this.checkMilestoneTryCatch()}async checkMilestoneTryCatch(){try{await this.checkMilestone()}catch(e){ae(e,"apply-milestones",{engagementTrigger:this.engagementTrigger})}}async checkMilestone(){let e=await me.getCurrent().getNormalisedCart(),r=this.engagementTrigger.progressBarConfig,n=[],o=[],i=[],s,a,l=[...r.milestones];for(let A of l){if(A.rewardType!==Gl.FREE_AUTO_GIFT)continue;if(A.isUIOnly&&!A.allowATC){b.verbose(`Skipping milestone ${A.label} as it is UI only and does not allow ATC`);continue}let B=A.items[0],z=A.reached,P=e.items.find(Q=>(Q.vID===B.vID||Q.mID===B.mID)&&Q.properties._letscooee_campaign===this.engagementTrigger.shortID);z&&(s=A,a=P),P&&n.push(P),!z&&P&&r.removeIneligibleItem?(b.verbose(`Removing free gift ${P.vID} from cart`),i.push(P)):z&&!P&&(b.verbose(`Adding free gift ${B.vID} to cart`),o.push(B))}r.restrictToLatestFreebie&&s&&(a?(n=n.filter(A=>A.vID!==a.vID),o=[]):o=[s.items[0]],i.push(...n));let f={},m={};i.length&&i.forEach(A=>m[A.key??A.vID]=0),o.length&&o.forEach(A=>m[A.vID]=1);let d=r.coupons,_=[];if(d?.length){_=d.map(z=>z.couponCode);let A=me.getCurrent().discount_codes?.map(z=>z.code)??[];_.every(z=>A.some(P=>P===z))||(f.discount=_.join(","))}if(_t.hasKeys(m)&&(f.updates=m),!_t.hasKeys(f))return;let y=await pv(f,this.engagementTrigger),C=y?.items,N=[];for(let A of o){let B=C?.find(z=>_?.length?z.id+""===A.vID&&z.discounts?.some(P=>_.includes(P.title)):z.id+""===A.vID);B&&N.push(B)}if(!N.length){Je.get().refreshUI(y,!1);return}try{await Promise.all(N.map(A=>mv(A,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()})))}catch(A){ae(A,"add-private-attribute",{engagementTrigger:this.engagementTrigger,extra:{productAddedByCooee:N}})}finally{Je.get().refreshUI(y,!1)}}};var Us=class extends dt{constructor(e){super(e)}async update(e){await super.update(e),this.engagementTrigger.content.update(e.content),this.updateAngularWidget()}isAllOkToRender(){return!!this.engagementTrigger.content}async startRendering(){if(this.updateAngularWidget()){this.addToRendered();return}this.createAngularWidget("cooee-savings-bar")}};var Sl=class extends it{constructor(e){super(e)}isAllOkToRender(){return!!this.engagementTrigger.content?.videoConfig}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e,r=this.engagementTrigger.content.videoConfig;r.template==="FLOATING_POPUP"?e="cooee-video-popup":r.template==="STORY"?e="cooee-video-stories":e="cooee-video-playlist",this.createAngularWidget(e)}};var Tl=class extends it{constructor(e){super(e)}isAllOkToRender(){return!0}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}};var Il=class extends it{constructor(e){super(e)}isAllOkToRender(){return!0}async startRendering(){let e=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(e),document.addEventListener("letscooee:inbound:cta:add-bundle",this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(e){let r=this.engagementTrigger,n=`Engagement(id: ${r.engagementID}, shortID: ${r.shortID})`,o=e.detail;if(!_t.hasKeys(o)){b.error(`No detail received for ${n}`);return}b.log("Detail received for BYOB",o);let i=o.campaignID??o.campaignId??o.campaign_id;if(i!==r.shortID&&i!==r.engagementID){b.warn(`Current ${n} is not BYOB. Received: ${i}`);return}let s=o.items;if(!s?.length)return;let a=s.map(l=>new Dt({mID:l.product_id,vID:l.variant_id,quantity:l.quantity||1}));await new fn(this.triggerContext).execute({embeddedItems:a,clickAction:{at:be.ADD_BUNDLE,applyDiscount:!0}})}};var xl=class extends it{constructor(e){super(e)}isAllOkToRender(){return!0}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-collection-filter")}};var qp=!1,Yp=!1,Cl=null,Rl=null,xv=!1;function Cv(){xv||(xv=!0,wn(()=>{Iv(document.body,{childList:!0,subtree:!0},500,Tv).subscribe(()=>{it.currentEngagements.forEach(t=>t.rerenderIfDeleted()),dt.currentEngagements.forEach(t=>t.rerenderIfDeleted())})}))}function Kp(t){if(Cv(),qp){b.verbose("Cart widget processing in progress, queuing latest triggers"),Cl=t;return}qp=!0;try{UT(t)}finally{if(qp=!1,Cl){let e=Cl;Cl=null,b.verbose("Processing queued cart triggers"),Kp(e)}}}function Xp(t){if(Cv(),Yp){b.verbose("Page widget processing in progress, queuing latest triggers"),Rl=t;return}Yp=!0;try{kT(t)}finally{if(Yp=!1,Rl){let e=Rl;Rl=null,b.verbose("Processing queued page triggers"),Xp(e)}}}function UT(t){Av(dt.currentEngagements,t);for(let e of t){b.info(`${e} received as cart embed`);let r=Rv(dt.currentEngagements,e);if(r&&!e.isSubscriptionUpsell()){r.updateAndReRender(e).catch(o=>{ae(o,"update-and-re-render",{engagementTrigger:e})});continue}b.verbose(`${e} is new`);let n;if(e.isProgressBar())n=new wl(e);else if(e.isSubscriptionUpsell()){bl.renderCartUpsell(e);continue}else e.isSavingsBar()?n=new Us(e):n=new dt(e);dt.currentEngagements.add(n),n.renderSilently()}}function kT(t){Av(it.currentEngagements,t);for(let e of t){b.info(`${e} received as page embed`);let r=Rv(it.currentEngagements,e);if(r){r.updateAndReRender(e).catch(o=>{ae(o,"update-and-re-render",{engagementTrigger:e})});continue}b.verbose(`${e} is new`);let n;e.isShoppableVideo()?n=new Sl(e):e.isBYOB()?n=new Il(e):e.isStickyATC()?n=new Tl(e):e.isSavingsBar()?n=new Us(e):e.isCollectionFilter()?n=new xl(e):n=new it(e),it.currentEngagements.add(n),n.renderSilently()}}function Rv(t,e){for(let r of t)if(r.matches(e))return r}function Av(t,e){let r=new Set(e.map(n=>n.shortID));for(let n of t)r.has(n.engagementTrigger.shortID)||n.destroy()}var Ov=new zt,Dv=0;Ov.pipe(qt(50)).subscribe(async t=>{let e=await Fn();FT(e).catch(r=>{ae(r,"load-page-widgets",{extra:{firstLoad:t}})}),HT(e).catch(r=>{ae(r,"load-cart-widgets",{extra:{firstLoad:t}})})});function ks(t=!1){Sr(ur).then(()=>{Ov.next(t)})}function Nv(){dt.currentEngagements.forEach(t=>t.rerenderAfterCartOpened())}async function Sv(t){let e=await Fn();return Object.assign(t,e),Yt("/v1/engagement/get-variant",t)}async function FT(t){Dv++,Dv===1?b.info("Fetch page widgets (after \u23F0",So()+" of SDK load)"):b.info("Fetch page widgets");let e=E({},t);try{let r=await Yt("/v1/engagement/page-widgets",e);b.info(`Page widgets loaded in \u23F0 ${Tr(r.timeTakenMs)}`);let n=r.data.widgets.map(o=>new St(o));Xp(n)}catch(r){b.error("Error sending widget getter",r)}}async function HT(t){b.info("Fetch cart widgets");let e=E({},t);try{let r=await Yt("/v1/engagement/cart-widgets",e);b.info(`Cart widgets loaded in \u23F0 ${Tr(r.timeTakenMs)}`);let n=r.data.widgets.map(o=>new St(o));Kp(n)}catch(r){b.error("Error sending widget getter",r)}}function Pv(){let t=qe.get();!t.gaMeasurementID||!t.gaEnabled||VT()}async function $T(){let t=await Ye.get("gacid"),e=await WT();if(t!==e)return await Ye.set("gacid",e),e}async function VT(){let t=await $T();t&&gl({gaClientID:t})}async function WT(){let e=qe.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(r=>{window.gtag("get",e,"client_id",n=>{r(n)})})}async function Lv(t){b.verbose("Received app configuration",t),t.currencyCount=t.currencies?.length;let e=Ce.globalRef.config.update(t);Pv(),Je.initialize(),e.website&&(Ug(e.website.commonJS),sn(e.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.pipe(qt(10)).subscribe(async({open:r})=>{b.info("Cart drawer is now",r?"open":"closed"),r&&(Nv(),await jT())})}async function jT(){let t=await me.getCurrent().getNormalisedCart(),e={value:t.amount,currency:t.currency},r={items:t.items,amount:e,drawer:!0};Tt(new xe("View Cart",r))}var Al=class{runtimeData=fe();meddle(){let e=Ce.globalRef;e.account=e.account??[],e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods()}exposeMethods(){let e=Ce.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{ks()},e.loadExperiments=()=>{vl()},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=Ce.previewWidget.bind(Ce),e.previewPopup=Ce.previewPopup.bind(Ce),e.executeCTA=(r,n)=>{new fn(r).execute(n)},e.sendEvent=r=>{Tt(r)}}overwritePush(e,r){Nr(e,"push",r)}meddleAccount(){this.overwritePush(Ce.globalRef.account,(...e)=>{this.processAccount(e[0])}),Ce.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(Ce.globalRef.events,(...e)=>{this.processEvent(e[0])}),Ce.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(Ce.globalRef.profile,(...e)=>{this.processProfile(e[0])}),Ce.globalRef.profile.forEach(this.processProfile.bind(this))}processAccount(e){e&&(e.appID&&Ce.authenticate(e),e.flags&&(this.runtimeData.flags=e.flags))}processEvent(e){e&&(pm.includes(e[0])?Ce.sendEvent(e[0],e[1],E({occurred:this.runtimeData.jsLoadTime},e[2])):Ce.sendEvent(e[0],e[1],e[2]))}processProfile(e){e&&Ce.updateProfile(e)}processPageName(e){e&&Ce.setPageName(e)}meddlePage(){this.overwritePush(Ce.globalRef.page,(...e)=>{this.processPage(e[0])}),Ce.globalRef.page.forEach(this.processPage.bind(this))}processPage(e){e.currentItem&&GT(e.currentItem),e.currency&&(fe().currencyCode=e.currency),e.shopCurrency&&(this.runtimeData.shopCurrencyCode=e.shopCurrency),e.moneyFormat&&(this.runtimeData.moneyFormat=e.moneyFormat),e.jsLoad&&(this.runtimeData.jsLoadTime=e.jsLoad),e.locale&&(this.runtimeData.locale=e.locale),e.pageName&&Ce.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&me.getCurrent().update(e.cart),e.configurations&&Lv(e.configurations),e.customContext&&(this.runtimeData.customContext=E(E({},this.runtimeData.customContext),e.customContext))}async testCartUpdate(){if(fe().pageName!=="product"){window.alert("This feature is only available on a product page");return}let e=wv();if(e||(e=fe().currentItem?.vID),!e){window.alert("Could not find a variant to test. Please try a different product page");return}let r=new St({id:"preview",shortID:"1",redirectBehaviour:Qt.CART_DRAWER});await new fn(new Ir(new Date,r)).execute({clickAction:{at:be.ADD_TO_CART},embeddedItem:new Dt({vID:e})})}};function GT(t){let e=fe();if(e.currentItem&&e.currentItem.vID!==t.vID){let r=new CustomEvent("letscooee:variant-change",{detail:{variantID:t.vID,productID:t.mID}});document.dispatchEvent(r)}e.currentItem=new Dt(t)}var Si=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX="cooee".concat("-");static getString(e,r){return this.getItem(e)||r}static setString(e,r){this.setItem(e,r)}static remove(e){this.removeItem(e)}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,r){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),r)}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}};var zT=1e3,qT=10,Jp=0,Qp=new Date;function Zp(t){Si.remove("sleid"),Qp=t??new Date}function Mv(){if(window.scrollY){let t=kv();Bv(t)&&Uv(t)}wn(()=>{YT()})}function YT(){po(window,"scroll").pipe(qt(zT),un(()=>{let t=kv();if(t>100){b.warn("Received scroll percent is more than 100",t);return}if(Bv(t))return t})).subscribe(t=>{Uv(t)})}function Bv(t){return Math.abs(Jp-t)>=qT||Jp!==t&&t===100}function Uv(t){if(t==null)return;let e={percent:t,timeMS:new Date().getTime()-Qp.getTime()};Jp=t;let r=Si.getString("sleid",""),n=new xe("CE Scroll",e,null,r);Tt(n),Si.setString("sleid",n.id.toHexString()),Qp=new Date(n.occurred)}function kv(){let t=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/t*100)}function Fv(){KT()}function KT(){let t=window.fetch;window.fetch=async function(e,r){try{await XT(e,r)}catch(n){ae(n,"modify-graphql-request",{extra:{body:JSON.stringify(r?.body)}})}return t(e,r)},b.verbose("Securely overwritten window.fetch method for graphql query")}async function XT(t,e){let r=typeof t=="string"?t:t instanceof Request?t.url:"";if(!(r.includes("graphql.json")&&e?.method==="POST")||!e.body)return;let n;if(typeof e.body=="string")try{n=JSON.parse(e.body)}catch{return}else n=e.body;n?.variables?.input&&(b.verbose("Intercepted fetch request of:",r),n?.query.includes("cartCreate")&&(e.body=await JT(n),QT()))}async function JT(t){let e=t.variables.input.attributes??[],r=await $a("Buy Now");return t.variables.input.attributes=[...e,...r],JSON.stringify(t)}function QT(){let t=fe().currentItem;if(!t)return;let e=new xe("Buy Now Clicked",{items:[t]});Tt(e)}var Ti=class{constructor(e,r){this.selectors=e;this.eventName=r;this.selectorString=e.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let r=e.currentTarget,n=new xe(this.eventName,{class:r.className||void 0,tagName:r.tagName||void 0,id:r.id||void 0});Tt(n),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(e=>b.error(e))}async listen(){this.elements=await gf(this.selectorString),this.elements.forEach(e=>{e.addEventListener("click",this.clickListenerCallback)})}removeClickListener(e){this.elements?.forEach(r=>{r.removeEventListener("click",e)})}};var Dl=class t extends Ti{static selectors=[".product__thumbnail-list-inner > button","product-gallery-navigation > button",".product-media--thumb-container",".product-images-inner > img",".m-product-media",".swiper-button-control",".media__thumb",".slick-arrow",".productView-img-container.product-single__media",".product-gallery__thumbnail_item_inner"];constructor(){super(t.selectors,"Item Thumbnail Clicked")}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var Ol=class t extends Ti{static selectors=[".jdgm-widget.jdgm-preview-badge.jdgm-preview-badge--with-link.jdgm--done-setup","reviewsio-product-ratings",".ruk_rating_snippet.tracked:not(.hidden)","a > .loox-rating",".yotpo-reviews-star-ratings-widget",".yotpo.lp-hero__reviews",".pr-rating > a",".rivyoReviewWidget"];constructor(){super(t.selectors,"Review Clicked")}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var ZT=[".gokwik-checkout button","button.cart__checkout-button","button.cart__checkout","button#checkout","button#checkout2",'button[id*="checkout" i]','button[name*="checkout" i]','button[class*="checkout" i]'].join(",");function Hv(){wn(()=>{b.verbose("Execution order:","document ready"),eI()})}function eI(){let t=window.location.hash?.substring(1);if(t)if(t.includes("initiate-checkout")){document.dispatchEvent(new Event("letscooee:outbound:third-party-initiate-checkout"));let e=document.querySelector(ZT);if(!e){b.verbose("No clickable cart checkout button found");return}b.verbose("Clickable cart checkout button found",e),e.click()}else t.includes("open-cart-drawer")&&Je.get().open()}function Vv(){window.addEventListener("kp-modal:opened",()=>{fe().isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",t=>{let{token:e}=t.detail;e&&bi({goKwikToken:e})}),window.gokwikSdk?$v():window.addEventListener("gokwikLoaded",$v)}function $v(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let t=await me.getCurrent().getNormalisedCart(),e={via:"GoKwik",items:t.items,cartToken:t.token,amount:{value:t.amount,currency:t.currency}},r=new xe("Checkout Started",e);Tt(r)})}var Nl=class{static watch(){let e=localStorage.getItem("cooeeDebugTill"),r=gm();if(r==="1"||r==="on"){let n=this.getDebugMillis();gl({debugTill:n}),e||(e=n.toString(),localStorage.setItem("cooeeDebugTill",e))}r==="on"?sessionStorage.cooeeDebug="1":r==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&this.renderDebugBar(),e&&new Date(+e)<new Date&&localStorage.removeItem("cooeeDebugTill")}static renderDebugBar(){let e=document.createElement("cooee-debugger");e.logs=this.logs,wn(()=>{document.body.appendChild(e)})}static getDebugMillis(){return new Date().getTime()+360*60*1e3}};var Fs=class Fs extends hn{};wo(Fs,"storeName","app"),Fs.storage=Io(Fs.storeName);var Pl=Fs;var Ce=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(e){if(!window.cooeeSDKPreview){if(b.info("Initialising SDK"),kg(navigator.userAgent)){b.info("This seems to be a bot. Disabling SDK");return}this.initGlobalReference(e),await Gy(),this.autoAuthenticate(),new Al().meddle(),wm(),ks(!0),vl(),tI(),Zy(),av(),Fv(),Hv(),Mv(),Ol.getInstance().listenSilently(),Dl.getInstance().listenSilently(),Vv(),rI(),Nl.watch(),Pl.remove("conf").catch(r=>{b.error("Fail to remove App Config from local storage",r)})}}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(e){window.CooeeSDK||Nr(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,Nr(this.globalRef,"config",new qe),Nr(this.globalRef,"runtimeData",{sdkLoadTime:e,jsLoadTime:new Date,lastEnterActive:new Date}),Nr(this.globalRef,"uaParser",new br,!0),Nr(this.globalRef,"cart",me.getCurrent()),Nr(this.globalRef,"cartChange$",sv()),Nr(this.globalRef,"cartDrawerToggle$",Je.cartDrawerToggle$.asObservable()),b.verbose("Global reference initialised"),new Dc(()=>{this.globalRef.uaParser=new br})}static injectWidgetAssets(){Mg(hr.widgetURL,"cooee-widget-sdk"),ip()}static autoAuthenticate(){let e=tc();e&&this.authenticate({shopifyShop:e})}static authenticate(e){if(this.authenticated)return;b.info("Begin auth after \u23F0",So(),"of SDK load");let r=e.appID?.trim(),n=e.shopifyShop;if((df(r)||r.length!==24)&&df(n)){b.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,Wy(e)}static sendEvent(e,r,n){let o=new xe(e,r,n?.triggerData);n?.occurred&&(o.occurred=n.occurred),Tt(o)}static updateProfile(e){for(let r in e)if(r.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");bi(e)}static setPageName(e){if(!e)return;let r=fe(),n=r.pageName;if(e===n)return;if(r.pageName=e,um.some(s=>e.includes(s))){Zp();return}let o={};n&&(o.ps=n);let i=new xe("CE Screen View",o);i.occurred=r.jsLoadTime,Tt(i),Zp(i.occurred)}static previewPopup(e,r){new kn(r).render(e)}static previewWidget(e){new it(new St(e)).renderSilently()}};function tI(){window.CooeeSDK.cartChange$.subscribe(()=>{ks()})}function rI(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(t){b.error(t)}window.addEventListener("message",t=>{if(b.verbose("Received event",t),!t.origin.includes("letscooee.com")&&!t.origin.includes("localhost"))return;let e=t.data;typeof e=="object"&&(e.action==="POPUP_PREVIEW"?(Ce.previewPopup(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)):e.action==="WIDGET_PREVIEW"&&(Ce.previewWidget(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)))})}}var Wv=new Date;dm();ym();b.verbose("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(b.verbose("Execution order:","IIFE start"),await Ce.initForMerchantWebsiteOnly(Wv),await Ce.initForAll(),nI(),b.verbose("Execution order:","IIFE end")))());b.verbose("Execution order:","bottom");function nI(){hm()&&import("./debug-logs-6JXCRRRS.js").then(({printAllDebugLogs:t})=>t(Wv))}
63
+ ${o}`;sn(`#${i} { ${s} }`)}injectOuterCSSOnly(){let e=this.engagementTrigger.content?.outerCSS?.trim();if(!e)return;let r=this.rootContainer.id;sn(`#${r} { ${e} }`)}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return!1;let r=window.innerHeight||document.documentElement.clientHeight,o=(Math.min(e.bottom,r)-Math.max(e.top,0))*e.width,i=e.width*e.height,s=o/i*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let r=await this.createParentElementWithPlacement(e);if(r)return r;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let r=this.engagementTrigger.placement;if(!r?.selector)return b.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let n=r.selector,o;if(n.includes(":shadow")){let l=n.split(":shadow");o=(await Sn(l[0].trim()))?.shadowRoot,n=l[1].trim(),o&&ap(o,!1)}b.verbose(`${this.engagementTrigger} attempt to render "${r.position}" "${n}"`);let i=await Sn(n,3,o??document);if(!i)return b.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let s=this.generateParentElementID(),a=this.getParentElement(s);if(!e)return a;switch(r.position){case At.BEFORE1:case At.BEFORE:{i.parentElement?.insertBefore(a,i);break}case At.INSIDE_FIRST1:case At.INSIDE_FIRST:{i.insertBefore(a,i.firstChild);break}case At.INSIDE_LAST1:case At.INSIDE_LAST:{i.appendChild(a);break}case At.AFTER1:case At.AFTER:default:i.parentElement?.insertBefore(a,i.nextSibling)}return a}async runChoresBeforeRender(){if(this.isExclusionWithBVariation)return;if(!this.isAllOkToRender()){b.info(`\u26A0\uFE0F ${this.engagementTrigger} could not be rendered`);return}b.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await hl(this.engagementTrigger)}catch(r){b.info(`\u203C\uFE0F${this.engagementTrigger} could not render as items failed to refresh`,r);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){b.info(`\u203C\uFE0F${this.engagementTrigger} could not render as no products promoted`);return}this.engagementTrigger.items=e,await this.startRendering()}updateItems(e,r){let n=this.getItemDiff(e,r),o=this.getItemDiff(r,e);r.push(...n);for(let i of o)Yr.remove(r,i)}getItemDiff(e,r){return e.filter(n=>!r.some(o=>o.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}};var dt=class extends it{static currentEngagements=new Set;constructor(e){super(e)}rerenderAfterCartOpened(){this.rerenderIfDeleted(),this.checkAndSendEvent()}observeWidgetContainerInViewport(){return this.getVariation()}generateParentElementID(){let e=super.generateParentElementID();return this.engagementTrigger.isSubscriptionUpsell()&&(e+=`-${this.engagementTrigger.items[0].selectedOrFirstVariant.value.mID}`),e}checkAndSendEvent(){if(!Je.get().isOpen()&&fe().pageName!=="cart"){b.log("Do not send display event as neither the cart drawer nor the cart page is open.");return}return super.checkAndSendEvent()}};var BT=t=>t,Tv=t=>t.filter(e=>e.removedNodes&&e.removedNodes.length>0);function Iv(t,e={childList:!0,subtree:!0},r=500,n=BT){return Qc(o=>{let i=new MutationObserver(s=>o(s));return i.observe(t,e),i},(o,i)=>i.disconnect()).pipe(un(o=>n(o)),Lp(o=>o.length>0),qt(r))}var bl=class t{constructor(e,r){this.engagementTrigger=e;this.element=r;this.cartItems=me.getCurrent().items}cartItems;static renderCartUpsell(e){let r=e.placement;if(!r?.selector){b.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(r.selector));if(!n?.length){b.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let o of n)new t(e,o).render()}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.skipSubscribedItems&&e.selling_plan_allocation)return;let r=this.engagementTrigger.items.find(m=>m.mID===e.product_id.toString());if(!r)return;let n=r.vars.find(m=>m.mID===e.id.toString());if(!n)return;let o=new Mr(n),i=e.selling_plan_allocation?.selling_plan;if(i)for(let m of o.sellingPlans??[])m.mID===i.id.toString()&&(m.isSelected=!0,o.changeSellingPlan(m));let s=new xt(r);s.vars=[o],s.selectedOrFirstVariant.value=o;let a=`lc-cart-item-${this.engagementTrigger.shortID}-${r.mID}`;this.element.classList.add(a);let l=new St(this.engagementTrigger);l.placement.selector=`.${a}`,l.items=[s];let f=new dt(l);f.renderSilently(),this.watchForCartItemDeletion(f,a)}watchForCartItemDeletion(e,r){let n=new MutationObserver(o=>{o.forEach(i=>{i.removedNodes.forEach(s=>{s===this.element&&(b.verbose(`${r} has been removed`),e.destroy(),n.disconnect())})})});n.observe(this.element.parentElement,{childList:!0,subtree:!0})}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(r=>{if(!(e.includes(r.url)||e.includes(r.variant_id))&&(!e.includes(r.product_title)||r.variant_title&&!e.includes(r.variant_title)))return!1;let n=r.selling_plan_allocation?.selling_plan?.name;return!(n&&!e.includes(n))})}};var wl=class extends dt{constructor(e){super(e)}async update(e){await super.update(e),this.engagementTrigger.progressBarConfig.update(e.progressBarConfig),await this.checkMilestoneTryCatch(),this.updateAngularWidget()}isAllOkToRender(){return!!this.engagementTrigger.progressBarConfig}async startRendering(){if(this.updateAngularWidget()){this.addToRendered();return}this.createAngularWidget("cooee-progressbar"),await this.checkMilestoneTryCatch()}async checkMilestoneTryCatch(){try{await this.checkMilestone()}catch(e){ae(e,"apply-milestones",{engagementTrigger:this.engagementTrigger})}}async checkMilestone(){let e=await me.getCurrent().getNormalisedCart(),r=this.engagementTrigger.progressBarConfig,n=[],o=[],i=[],s,a,l=[...r.milestones];for(let A of l){if(A.rewardType!==Gl.FREE_AUTO_GIFT)continue;if(A.isUIOnly&&!A.allowATC){b.verbose(`Skipping milestone ${A.label} as it is UI only and does not allow ATC`);continue}let B=A.items[0],z=A.reached,P=e.items.find(Q=>(Q.vID===B.vID||Q.mID===B.mID)&&Q.properties._letscooee_campaign===this.engagementTrigger.shortID);z&&(s=A,a=P),P&&n.push(P),!z&&P&&r.removeIneligibleItem?(b.verbose(`Removing free gift ${P.vID} from cart`),i.push(P)):z&&!P&&(b.verbose(`Adding free gift ${B.vID} to cart`),o.push(B))}r.restrictToLatestFreebie&&s&&(a?(n=n.filter(A=>A.vID!==a.vID),o=[]):o=[s.items[0]],i.push(...n));let f={},m={};i.length&&i.forEach(A=>m[A.key??A.vID]=0),o.length&&o.forEach(A=>m[A.vID]=1);let d=r.coupons,_=[];if(d?.length){_=d.map(z=>z.couponCode);let A=me.getCurrent().discount_codes?.map(z=>z.code)??[];_.every(z=>A.some(P=>P===z))||(f.discount=_.join(","))}if(_t.hasKeys(m)&&(f.updates=m),!_t.hasKeys(f))return;let y=await pv(f,this.engagementTrigger),C=y?.items,N=[];for(let A of o){let B=C?.find(z=>_?.length?z.id+""===A.vID&&z.discounts?.some(P=>_.includes(P.title)):z.id+""===A.vID);B&&N.push(B)}if(!N.length){Je.get().refreshUI(y,!1);return}try{await Promise.all(N.map(A=>mv(A,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()})))}catch(A){ae(A,"add-private-attribute",{engagementTrigger:this.engagementTrigger,extra:{productAddedByCooee:N}})}finally{Je.get().refreshUI(y,!1)}}};var Us=class extends dt{constructor(e){super(e)}async update(e){await super.update(e),this.engagementTrigger.content.update(e.content),this.updateAngularWidget()}isAllOkToRender(){return!!this.engagementTrigger.content}async startRendering(){if(this.updateAngularWidget()){this.addToRendered();return}this.createAngularWidget("cooee-savings-bar")}};var Sl=class extends it{constructor(e){super(e)}isAllOkToRender(){return!!this.engagementTrigger.content?.videoConfig}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e,r=this.engagementTrigger.content.videoConfig;r.template==="FLOATING_POPUP"?e="cooee-video-popup":r.template==="STORY"?e="cooee-video-stories":e="cooee-video-playlist",this.createAngularWidget(e)}};var Tl=class extends it{constructor(e){super(e)}isAllOkToRender(){return!0}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-sticky-atc")}};var Il=class extends it{constructor(e){super(e)}isAllOkToRender(){return!0}async startRendering(){let e=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(e),document.addEventListener("letscooee:inbound:cta:add-bundle",this.inboundCTAListener.bind(this),!1)}async inboundCTAListener(e){let r=this.engagementTrigger,n=`Engagement(id: ${r.engagementID}, shortID: ${r.shortID})`,o=e.detail;if(!_t.hasKeys(o)){b.error(`No detail received for ${n}`);return}b.log("Detail received for BYOB",o);let i=o.campaignID??o.campaignId??o.campaign_id;if(i!==r.shortID&&i!==r.engagementID){b.warn(`Current ${n} is not BYOB. Received: ${i}`);return}let s=o.items;if(!s?.length)return;let a=s.map(l=>new Dt({mID:l.product_id,vID:l.variant_id,quantity:l.quantity||1}));await new fn(this.triggerContext).execute({embeddedItems:a,clickAction:{at:be.ADD_BUNDLE,applyDiscount:!0}})}};var xl=class extends it{constructor(e){super(e)}isAllOkToRender(){return!0}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget("cooee-collection-filter")}};var qp=!1,Yp=!1,Cl=null,Rl=null,xv=!1;function Cv(){xv||(xv=!0,wn(()=>{Iv(document.body,{childList:!0,subtree:!0},500,Tv).subscribe(()=>{it.currentEngagements.forEach(t=>t.rerenderIfDeleted()),dt.currentEngagements.forEach(t=>t.rerenderIfDeleted())})}))}function Kp(t){if(Cv(),qp){b.verbose("Cart widget processing in progress, queuing latest triggers"),Cl=t;return}qp=!0;try{UT(t)}finally{if(qp=!1,Cl){let e=Cl;Cl=null,b.verbose("Processing queued cart triggers"),Kp(e)}}}function Xp(t){if(Cv(),Yp){b.verbose("Page widget processing in progress, queuing latest triggers"),Rl=t;return}Yp=!0;try{kT(t)}finally{if(Yp=!1,Rl){let e=Rl;Rl=null,b.verbose("Processing queued page triggers"),Xp(e)}}}function UT(t){Av(dt.currentEngagements,t);for(let e of t){b.info(`${e} received as cart embed`);let r=Rv(dt.currentEngagements,e);if(r&&!e.isSubscriptionUpsell()){r.updateAndReRender(e).catch(o=>{ae(o,"update-and-re-render",{engagementTrigger:e})});continue}b.verbose(`${e} is new`);let n;if(e.isProgressBar())n=new wl(e);else if(e.isSubscriptionUpsell()){bl.renderCartUpsell(e);continue}else e.isSavingsBar()?n=new Us(e):n=new dt(e);dt.currentEngagements.add(n),n.renderSilently()}}function kT(t){Av(it.currentEngagements,t);for(let e of t){b.info(`${e} received as page embed`);let r=Rv(it.currentEngagements,e);if(r){r.updateAndReRender(e).catch(o=>{ae(o,"update-and-re-render",{engagementTrigger:e})});continue}b.verbose(`${e} is new`);let n;e.isShoppableVideo()?n=new Sl(e):e.isBYOB()?n=new Il(e):e.isStickyATC()?n=new Tl(e):e.isSavingsBar()?n=new Us(e):e.isCollectionFilter()?n=new xl(e):n=new it(e),it.currentEngagements.add(n),n.renderSilently()}}function Rv(t,e){for(let r of t)if(r.matches(e))return r}function Av(t,e){let r=new Set(e.map(n=>n.shortID));for(let n of t)r.has(n.engagementTrigger.shortID)||n.destroy()}var Ov=new zt,Dv=0;Ov.pipe(qt(50)).subscribe(async t=>{let e=await Fn();FT(e).catch(r=>{ae(r,"load-page-widgets",{extra:{firstLoad:t}})}),HT(e).catch(r=>{ae(r,"load-cart-widgets",{extra:{firstLoad:t}})})});function ks(t=!1){Sr(ur).then(()=>{Ov.next(t)})}function Nv(){dt.currentEngagements.forEach(t=>t.rerenderAfterCartOpened())}async function Sv(t){let e=await Fn();return Object.assign(t,e),Yt("/v1/engagement/get-variant",t)}async function FT(t){Dv++,Dv===1?b.info("Fetch page widgets (after \u23F0",So()+" of SDK load)"):b.info("Fetch page widgets");let e=E({},t);try{let r=await Yt("/v1/engagement/page-widgets",e);b.info(`Page widgets loaded in \u23F0 ${Tr(r.timeTakenMs)}`);let n=r.data.widgets.map(o=>new St(o));Xp(n)}catch(r){b.error("Error sending widget getter",r)}}async function HT(t){b.info("Fetch cart widgets");let e=E({},t);try{let r=await Yt("/v1/engagement/cart-widgets",e);b.info(`Cart widgets loaded in \u23F0 ${Tr(r.timeTakenMs)}`);let n=r.data.widgets.map(o=>new St(o));Kp(n)}catch(r){b.error("Error sending widget getter",r)}}function Pv(){let t=qe.get();!t.gaMeasurementID||!t.gaEnabled||VT()}async function $T(){let t=await Ye.get("gacid"),e=await WT();if(t!==e)return await Ye.set("gacid",e),e}async function VT(){let t=await $T();t&&gl({gaClientID:t})}async function WT(){let e=qe.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(r=>{window.gtag("get",e,"client_id",n=>{r(n)})})}async function Lv(t){b.verbose("Received app configuration",t),t.currencyCount=t.currencies?.length;let e=Ce.globalRef.config.update(t);Pv(),Je.initialize(),e.website&&(Ug(e.website.commonJS),sn(e.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.pipe(qt(10)).subscribe(async({open:r})=>{b.info("Cart drawer is now",r?"open":"closed"),r&&(Nv(),await jT())})}async function jT(){let t=await me.getCurrent().getNormalisedCart(),e={value:t.amount,currency:t.currency},r={items:t.items,amount:e,drawer:!0};Tt(new xe("View Cart",r))}var Al=class{runtimeData=fe();meddle(){let e=Ce.globalRef;e.account=e.account??[],e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleAccount(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods()}exposeMethods(){let e=Ce.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{ks()},e.loadExperiments=()=>{vl()},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=Ce.previewWidget.bind(Ce),e.previewPopup=Ce.previewPopup.bind(Ce),e.executeCTA=(r,n)=>{new fn(r).execute(n)},e.sendEvent=r=>{Tt(r)}}overwritePush(e,r){Nr(e,"push",r)}meddleAccount(){this.overwritePush(Ce.globalRef.account,(...e)=>{this.processAccount(e[0])}),Ce.globalRef.account.forEach(this.processAccount.bind(this))}meddleEvents(){this.overwritePush(Ce.globalRef.events,(...e)=>{this.processEvent(e[0])}),Ce.globalRef.events.forEach(this.processEvent.bind(this))}meddleProfile(){this.overwritePush(Ce.globalRef.profile,(...e)=>{this.processProfile(e[0])}),Ce.globalRef.profile.forEach(this.processProfile.bind(this))}processAccount(e){e&&(e.appID&&Ce.authenticate(e),e.flags&&(this.runtimeData.flags=e.flags))}processEvent(e){e&&(pm.includes(e[0])?Ce.sendEvent(e[0],e[1],E({occurred:this.runtimeData.jsLoadTime},e[2])):Ce.sendEvent(e[0],e[1],e[2]))}processProfile(e){e&&Ce.updateProfile(e)}processPageName(e){e&&Ce.setPageName(e)}meddlePage(){this.overwritePush(Ce.globalRef.page,(...e)=>{this.processPage(e[0])}),Ce.globalRef.page.forEach(this.processPage.bind(this))}processPage(e){e.currentItem&&GT(e.currentItem),e.currency&&(fe().currencyCode=e.currency),e.shopCurrency&&(this.runtimeData.shopCurrencyCode=e.shopCurrency),e.moneyFormat&&(this.runtimeData.moneyFormat=e.moneyFormat),e.jsLoad&&(this.runtimeData.jsLoadTime=e.jsLoad),e.locale&&(this.runtimeData.locale=e.locale),e.pageName&&Ce.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&me.getCurrent().update(e.cart),e.configurations&&Lv(e.configurations),e.customContext&&(this.runtimeData.customContext=E(E({},this.runtimeData.customContext),e.customContext))}async testCartUpdate(){if(fe().pageName!=="product"){window.alert("This feature is only available on a product page");return}let e=wv();if(e||(e=fe().currentItem?.vID),!e){window.alert("Could not find a variant to test. Please try a different product page");return}let r=new St({id:"preview",shortID:"1",redirectBehaviour:Qt.CART_DRAWER});await new fn(new Ir(new Date,r)).execute({clickAction:{at:be.ADD_TO_CART},embeddedItem:new Dt({vID:e})})}};function GT(t){let e=fe();if(e.currentItem&&e.currentItem.vID!==t.vID){let r=new CustomEvent("letscooee:variant-change",{detail:{variantID:t.vID,productID:t.mID}});document.dispatchEvent(r)}e.currentItem=new Dt(t)}var Si=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX="cooee".concat("-");static getString(e,r){return this.getItem(e)||r}static setString(e,r){this.setItem(e,r)}static remove(e){this.removeItem(e)}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,r){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),r)}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}};var zT=1e3,qT=10,Jp=0,Qp=new Date;function Zp(t){Si.remove("sleid"),Qp=t??new Date}function Mv(){if(window.scrollY){let t=kv();Bv(t)&&Uv(t)}wn(()=>{YT()})}function YT(){po(window,"scroll").pipe(qt(zT),un(()=>{let t=kv();if(t>100){b.warn("Received scroll percent is more than 100",t);return}if(Bv(t))return t})).subscribe(t=>{Uv(t)})}function Bv(t){return Math.abs(Jp-t)>=qT||Jp!==t&&t===100}function Uv(t){if(t==null)return;let e={percent:t,timeMS:new Date().getTime()-Qp.getTime()};Jp=t;let r=Si.getString("sleid",""),n=new xe("CE Scroll",e,null,r);Tt(n),Si.setString("sleid",n.id.toHexString()),Qp=new Date(n.occurred)}function kv(){let t=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/t*100)}function Fv(){KT()}function KT(){let t=window.fetch;try{window.fetch=async function(e,r){try{await XT(e,r)}catch(n){ae(n,"modify-graphql-request",{extra:{body:JSON.stringify(r?.body)}})}return t(e,r)}}catch(e){console.warn("Fail to override fetch.",`Cooee won't be able to track "Buy Now Clicked" KPI.`),b.error(e)}b.verbose("Securely overwritten window.fetch method for graphql query")}async function XT(t,e){let r=typeof t=="string"?t:t instanceof Request?t.url:"";if(!(r.includes("graphql.json")&&e?.method==="POST")||!e.body)return;let n;if(typeof e.body=="string")try{n=JSON.parse(e.body)}catch{return}else n=e.body;n?.variables?.input&&(b.verbose("Intercepted fetch request of:",r),n?.query.includes("cartCreate")&&(e.body=await JT(n),QT()))}async function JT(t){let e=t.variables.input.attributes??[],r=await $a("Buy Now");return t.variables.input.attributes=[...e,...r],JSON.stringify(t)}function QT(){let t=fe().currentItem;if(!t)return;let e=new xe("Buy Now Clicked",{items:[t]});Tt(e)}var Ti=class{constructor(e,r){this.selectors=e;this.eventName=r;this.selectorString=e.join(",")}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let r=e.currentTarget,n=new xe(this.eventName,{class:r.className||void 0,tagName:r.tagName||void 0,id:r.id||void 0});Tt(n),this.removeClickListener(this.clickListenerCallback)};listenSilently(){this.listen().catch(e=>b.error(e))}async listen(){this.elements=await gf(this.selectorString),this.elements.forEach(e=>{e.addEventListener("click",this.clickListenerCallback)})}removeClickListener(e){this.elements?.forEach(r=>{r.removeEventListener("click",e)})}};var Dl=class t extends Ti{static selectors=[".product__thumbnail-list-inner > button","product-gallery-navigation > button",".product-media--thumb-container",".product-images-inner > img",".m-product-media",".swiper-button-control",".media__thumb",".slick-arrow",".productView-img-container.product-single__media",".product-gallery__thumbnail_item_inner"];constructor(){super(t.selectors,"Item Thumbnail Clicked")}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var Ol=class t extends Ti{static selectors=[".jdgm-widget.jdgm-preview-badge.jdgm-preview-badge--with-link.jdgm--done-setup","reviewsio-product-ratings",".ruk_rating_snippet.tracked:not(.hidden)","a > .loox-rating",".yotpo-reviews-star-ratings-widget",".yotpo.lp-hero__reviews",".pr-rating > a",".rivyoReviewWidget"];constructor(){super(t.selectors,"Review Clicked")}static getInstance(){return this.INSTANCE||(this.INSTANCE=new t),this.INSTANCE}};var ZT=[".gokwik-checkout button","button.cart__checkout-button","button.cart__checkout","button#checkout","button#checkout2",'button[id*="checkout" i]','button[name*="checkout" i]','button[class*="checkout" i]'].join(",");function Hv(){wn(()=>{b.verbose("Execution order:","document ready"),eI()})}function eI(){let t=window.location.hash?.substring(1);if(t)if(t.includes("initiate-checkout")){document.dispatchEvent(new Event("letscooee:outbound:third-party-initiate-checkout"));let e=document.querySelector(ZT);if(!e){b.verbose("No clickable cart checkout button found");return}b.verbose("Clickable cart checkout button found",e),e.click()}else t.includes("open-cart-drawer")&&Je.get().open()}function Vv(){window.addEventListener("kp-modal:opened",()=>{fe().isGoKwikPopupOpen=!0}),window.addEventListener("user-loggedin",t=>{let{token:e}=t.detail;e&&bi({goKwikToken:e})}),window.gokwikSdk?$v():window.addEventListener("gokwikLoaded",$v)}function $v(){window.gokwikSdk&&window.gokwikSdk.on("checkout_initiated",async()=>{let t=await me.getCurrent().getNormalisedCart(),e={via:"GoKwik",items:t.items,cartToken:t.token,amount:{value:t.amount,currency:t.currency}},r=new xe("Checkout Started",e);Tt(r)})}var Nl=class{static watch(){let e=localStorage.getItem("cooeeDebugTill"),r=gm();if(r==="1"||r==="on"){let n=this.getDebugMillis();gl({debugTill:n}),e||(e=n.toString(),localStorage.setItem("cooeeDebugTill",e))}r==="on"?sessionStorage.cooeeDebug="1":r==="off"&&sessionStorage.removeItem("cooeeDebug"),sessionStorage.cooeeDebug&&this.renderDebugBar(),e&&new Date(+e)<new Date&&localStorage.removeItem("cooeeDebugTill")}static renderDebugBar(){let e=document.createElement("cooee-debugger");e.logs=this.logs,wn(()=>{document.body.appendChild(e)})}static getDebugMillis(){return new Date().getTime()+360*60*1e3}};var Fs=class Fs extends hn{};wo(Fs,"storeName","app"),Fs.storage=Io(Fs.storeName);var Pl=Fs;var Ce=class{static globalRef;static authenticated;static async initForMerchantWebsiteOnly(e){if(!window.cooeeSDKPreview){if(b.info("Initialising SDK"),kg(navigator.userAgent)){b.info("This seems to be a bot. Disabling SDK");return}this.initGlobalReference(e),await Gy(),this.autoAuthenticate(),new Al().meddle(),wm(),ks(!0),vl(),tI(),Zy(),av(),Fv(),Hv(),Mv(),Ol.getInstance().listenSilently(),Dl.getInstance().listenSilently(),Vv(),rI(),Nl.watch(),Pl.remove("conf").catch(r=>{b.error("Fail to remove App Config from local storage",r)})}}static async initForAll(){this.injectWidgetAssets()}static initGlobalReference(e){window.CooeeSDK||Nr(window,"CooeeSDK",{}),this.globalRef=window.CooeeSDK,Nr(this.globalRef,"config",new qe),Nr(this.globalRef,"runtimeData",{sdkLoadTime:e,jsLoadTime:new Date,lastEnterActive:new Date}),Nr(this.globalRef,"uaParser",new br,!0),Nr(this.globalRef,"cart",me.getCurrent()),Nr(this.globalRef,"cartChange$",sv()),Nr(this.globalRef,"cartDrawerToggle$",Je.cartDrawerToggle$.asObservable()),b.verbose("Global reference initialised"),new Dc(()=>{this.globalRef.uaParser=new br})}static injectWidgetAssets(){Mg(hr.widgetURL,"cooee-widget-sdk"),ip()}static autoAuthenticate(){let e=tc();e&&this.authenticate({shopifyShop:e})}static authenticate(e){if(this.authenticated)return;b.info("Begin auth after \u23F0",So(),"of SDK load");let r=e.appID?.trim(),n=e.shopifyShop;if((df(r)||r.length!==24)&&df(n)){b.warn("Cooee App ID or Shop name is not configured");return}this.authenticated=!0,Wy(e)}static sendEvent(e,r,n){let o=new xe(e,r,n?.triggerData);n?.occurred&&(o.occurred=n.occurred),Tt(o)}static updateProfile(e){for(let r in e)if(r.toLowerCase().startsWith("ce "))throw new Error("User property name cannot start with 'CE '");bi(e)}static setPageName(e){if(!e)return;let r=fe(),n=r.pageName;if(e===n)return;if(r.pageName=e,um.some(s=>e.includes(s))){Zp();return}let o={};n&&(o.ps=n);let i=new xe("CE Screen View",o);i.occurred=r.jsLoadTime,Tt(i),Zp(i.occurred)}static previewPopup(e,r){new kn(r).render(e)}static previewWidget(e){new it(new St(e)).renderSilently()}};function tI(){window.CooeeSDK.cartChange$.subscribe(()=>{ks()})}function rI(){if(window.opener){try{window.opener.postMessage({action:"COOEE_READY_FOR_PREVIEW"},"*")}catch(t){b.error(t)}window.addEventListener("message",t=>{if(b.verbose("Received event",t),!t.origin.includes("letscooee.com")&&!t.origin.includes("localhost"))return;let e=t.data;typeof e=="object"&&(e.action==="POPUP_PREVIEW"?(Ce.previewPopup(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)):e.action==="WIDGET_PREVIEW"&&(Ce.previewWidget(e.engagementTrigger),t.source?.postMessage({action:"PREVIEW_SUCCESSFUL"},t.origin)))})}}var Wv=new Date;dm();ym();b.verbose("Execution order:","top");window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=!0,(async()=>(b.verbose("Execution order:","IIFE start"),await Ce.initForMerchantWebsiteOnly(Wv),await Ce.initForAll(),nI(),b.verbose("Execution order:","IIFE end")))());b.verbose("Execution order:","bottom");function nI(){hm()&&import("./debug-logs-BU65RSYO.js").then(({printAllDebugLogs:t})=>t(Wv))}
@@ -1 +1 @@
1
- import{a as C,b}from"./chunk-6NOO6ZZV.js";import{e as g,f as h,i as u,l as f}from"./chunk-4P2RSDKV.js";import{Ba as l,Qa as c,X as m,pa as n,qa as i,ra as r,v as s}from"./chunk-K77Q3IPF.js";import"./chunk-V7UGKYBN.js";var _=class d{dialogRef=s(u);eventData=s(h);triggerData=s(g)().triggerData;onShareAndClose(p,o){p.stopPropagation();let{url:t,text:a}=b(this.triggerData,this.eventData.video,o!=="Clipboard");switch(o){case"Whatsapp":window.open(`https://wa.me/?text=${a}%20${t}`,"_blank","noopener,noreferrer");break;case"X(Twitter)":window.open(`https://x.com/intent/post?text=${a}&url=${t}`,"_blank","noopener,noreferrer");break;case"Clipboard":navigator.clipboard.writeText(t).catch(()=>{let e=document.createElement("textarea");e.value=t,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)});break;default:}o&&C(this.triggerData,this.eventData.video,this.eventData.index,o),this.dialogRef.close()}static \u0275fac=function(o){return new(o||d)};static \u0275cmp=m({type:d,selectors:[["cooee-share-dialog"]],decls:19,vars:0,consts:[[1,"share-dialog"],[1,"share-dialog-header"],["type","button","aria-label","Close",1,"close-button",3,"click"],["name","close","aria-hidden","true"],[1,"share-options"],["type","button","aria-label","Share on WhatsApp",1,"share-option",3,"click"],["name","whatsapp","aria-hidden","true"],["type","button","aria-label","Share on X",1,"share-option",3,"click"],["name","x-twitter","aria-hidden","true"],["type","button","aria-label","Copy link",1,"share-option",3,"click"],["name","copy","aria-hidden","true"]],template:function(o,t){o&1&&(n(0,"div",0)(1,"div",1)(2,"h3"),c(3,"Share"),i(),n(4,"button",2),l("click",function(e){return t.onShareAndClose(e)}),r(5,"cooee-icon",3),i()(),n(6,"div",4)(7,"button",5),l("click",function(e){return t.onShareAndClose(e,"Whatsapp")}),r(8,"cooee-icon",6),n(9,"span"),c(10,"Whatsapp"),i()(),n(11,"button",7),l("click",function(e){return t.onShareAndClose(e,"X(Twitter)")}),r(12,"cooee-icon",8),n(13,"span"),c(14,"X"),i()(),n(15,"button",9),l("click",function(e){return t.onShareAndClose(e,"Clipboard")}),r(16,"cooee-icon",10),n(17,"span"),c(18,"Copy link"),i()()()())},dependencies:[f],styles:["@keyframes _ngcontent-%COMP%_slideInScale{0%{opacity:0;transform:scale(.9) translateY(8px)}to{opacity:1;transform:scale(1) translateY(0)}}.share-dialog[_ngcontent-%COMP%]{background:#fff;border-radius:12px;padding:20px;min-width:280px;box-shadow:0 8px 32px #00000026;color:#333;animation:_ngcontent-%COMP%_slideInScale .25s ease-out}.share-dialog-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}.share-dialog-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-family:var(--lc-heading-family),serif;margin:0;font-size:18px;font-weight:600}.share-options[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;font-family:var(--lc-text-family),serif}.share-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;padding:12px 16px;background:#0002;border:1px solid #e9ecef;border-radius:8px;color:#333;font-size:16px;font-weight:500;cursor:pointer;transition:all .2s ease}.share-option[_ngcontent-%COMP%]:hover{background:#0004;border-color:#dee2e6;transform:translateY(-1px)}.share-option[_ngcontent-%COMP%]:active{transform:translateY(0)}.share-option[_ngcontent-%COMP%] cooee-icon[_ngcontent-%COMP%]{width:24px;height:24px}.share-option[_ngcontent-%COMP%] cooee-icon[name=whatsapp][_ngcontent-%COMP%]{color:#25d366}.share-option[_ngcontent-%COMP%] cooee-icon[name=x-twitter][_ngcontent-%COMP%], .share-option[_ngcontent-%COMP%] cooee-icon[name=copy][_ngcontent-%COMP%]{color:#000}.share-option[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1;text-align:left}button.close-button[_ngcontent-%COMP%]{background-color:transparent;border:none}button.close-button[_ngcontent-%COMP%] cooee-icon[name=close][_ngcontent-%COMP%]{border-radius:100%;color:#000}"]})};export{_ as ShareDialogComponent};
1
+ import{a as C,b}from"./chunk-FE5VYO2C.js";import{e as g,f as h,i as u,l as f}from"./chunk-UGPL2NMF.js";import{Ba as l,Qa as c,X as m,pa as n,qa as i,ra as r,v as s}from"./chunk-K77Q3IPF.js";import"./chunk-V7UGKYBN.js";var _=class d{dialogRef=s(u);eventData=s(h);triggerData=s(g)().triggerData;onShareAndClose(p,o){p.stopPropagation();let{url:t,text:a}=b(this.triggerData,this.eventData.video,o!=="Clipboard");switch(o){case"Whatsapp":window.open(`https://wa.me/?text=${a}%20${t}`,"_blank","noopener,noreferrer");break;case"X(Twitter)":window.open(`https://x.com/intent/post?text=${a}&url=${t}`,"_blank","noopener,noreferrer");break;case"Clipboard":navigator.clipboard.writeText(t).catch(()=>{let e=document.createElement("textarea");e.value=t,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)});break;default:}o&&C(this.triggerData,this.eventData.video,this.eventData.index,o),this.dialogRef.close()}static \u0275fac=function(o){return new(o||d)};static \u0275cmp=m({type:d,selectors:[["cooee-share-dialog"]],decls:19,vars:0,consts:[[1,"share-dialog"],[1,"share-dialog-header"],["type","button","aria-label","Close",1,"close-button",3,"click"],["name","close","aria-hidden","true"],[1,"share-options"],["type","button","aria-label","Share on WhatsApp",1,"share-option",3,"click"],["name","whatsapp","aria-hidden","true"],["type","button","aria-label","Share on X",1,"share-option",3,"click"],["name","x-twitter","aria-hidden","true"],["type","button","aria-label","Copy link",1,"share-option",3,"click"],["name","copy","aria-hidden","true"]],template:function(o,t){o&1&&(n(0,"div",0)(1,"div",1)(2,"h3"),c(3,"Share"),i(),n(4,"button",2),l("click",function(e){return t.onShareAndClose(e)}),r(5,"cooee-icon",3),i()(),n(6,"div",4)(7,"button",5),l("click",function(e){return t.onShareAndClose(e,"Whatsapp")}),r(8,"cooee-icon",6),n(9,"span"),c(10,"Whatsapp"),i()(),n(11,"button",7),l("click",function(e){return t.onShareAndClose(e,"X(Twitter)")}),r(12,"cooee-icon",8),n(13,"span"),c(14,"X"),i()(),n(15,"button",9),l("click",function(e){return t.onShareAndClose(e,"Clipboard")}),r(16,"cooee-icon",10),n(17,"span"),c(18,"Copy link"),i()()()())},dependencies:[f],styles:["@keyframes _ngcontent-%COMP%_slideInScale{0%{opacity:0;transform:scale(.9) translateY(8px)}to{opacity:1;transform:scale(1) translateY(0)}}.share-dialog[_ngcontent-%COMP%]{background:#fff;border-radius:12px;padding:20px;min-width:280px;box-shadow:0 8px 32px #00000026;color:#333;animation:_ngcontent-%COMP%_slideInScale .25s ease-out}.share-dialog-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}.share-dialog-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-family:var(--lc-heading-family),serif;margin:0;font-size:18px;font-weight:600}.share-options[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;font-family:var(--lc-text-family),serif}.share-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;padding:12px 16px;background:#0002;border:1px solid #e9ecef;border-radius:8px;color:#333;font-size:16px;font-weight:500;cursor:pointer;transition:all .2s ease}.share-option[_ngcontent-%COMP%]:hover{background:#0004;border-color:#dee2e6;transform:translateY(-1px)}.share-option[_ngcontent-%COMP%]:active{transform:translateY(0)}.share-option[_ngcontent-%COMP%] cooee-icon[_ngcontent-%COMP%]{width:24px;height:24px}.share-option[_ngcontent-%COMP%] cooee-icon[name=whatsapp][_ngcontent-%COMP%]{color:#25d366}.share-option[_ngcontent-%COMP%] cooee-icon[name=x-twitter][_ngcontent-%COMP%], .share-option[_ngcontent-%COMP%] cooee-icon[name=copy][_ngcontent-%COMP%]{color:#000}.share-option[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1;text-align:left}button.close-button[_ngcontent-%COMP%]{background-color:transparent;border:none}button.close-button[_ngcontent-%COMP%] cooee-icon[name=close][_ngcontent-%COMP%]{border-radius:100%;color:#000}"]})};export{_ as ShareDialogComponent};
@@ -1,2 +1,2 @@
1
- import{A as Ve,B as Ie,c as ue,j as U,q as k,r as we,s as be,v as _e,w as Ce,x as ye,y as xe,z as De}from"./chunk-TER5PVFC.js";import{a as Ee,b as Te}from"./chunk-6NOO6ZZV.js";import{c as me,e as ge,f as P,g as j,i as he,j as ve,k as fe,l as M}from"./chunk-4P2RSDKV.js";import"./chunk-T6RU7RSX.js";import{Ba as h,Da as s,E as _,Ga as F,Ha as B,I as K,Ia as H,L as G,La as V,M as Q,Ma as S,O as d,Ta as ie,Ua as oe,V as q,Va as ne,X as y,Za as re,ba as E,fb as se,ha as T,ia as x,ib as ae,ja as D,jb as de,kb as le,la as Y,ma as $,na as L,oa as u,pa as l,qa as a,ra as w,sa as J,sb as ce,ta as X,ua as Z,ub as pe,v,va as ee,wa as te,x as p,xa as A,y as m,za as C}from"./chunk-K77Q3IPF.js";import"./chunk-V7UGKYBN.js";var I="a-f\\d",Me=`#?[${I}]{3}[${I}]?`,Oe=`#?[${I}]{6}([${I}]{2})?`,Ne=new RegExp(`[^#${I}]`,"gi"),Re=new RegExp(`^${Me}$|^${Oe}$`,"i");function W(i,e={}){if(typeof i!="string"||Ne.test(i)||!Re.test(i))throw new TypeError("Expected a valid hex string");i=i.replace(/^#/,"");let t=1;i.length===8&&(t=Number.parseInt(i.slice(6,8),16)/255,i=i.slice(0,6)),i.length===4&&(t=Number.parseInt(i.slice(3,4).repeat(2),16)/255,i=i.slice(0,3)),i.length===3&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]);let o=Number.parseInt(i,16),n=o>>16,r=o>>8&255,f=o&255,b=typeof e.alpha=="number"?e.alpha:t;if(e.format==="array")return[n,r,f,b];if(e.format==="css"){let g=b===1?"":` / ${Number((b*100).toFixed(2))}%`;return`rgb(${n} ${r} ${f}${g})`}return{red:n,green:r,blue:f,alpha:b}}var c=class{h;a=100;g;constructor(e){e??={},this.h=e.h,this.a=e.a,this.g=e.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return W(this.hex,{format:"css",alpha:this.getAlpha()})}catch(e){return console.error("Invalid hex",e),"#000000"}}getAlpha(){return(this.a??100)/100}};var O=class i{static DEFAULT_FALLBACK=new c({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new c(e.c)),e.fb&&(this.fb=new c(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??i.DEFAULT_FALLBACK}};var N=class{size;enabled;color;constructor(e){e??={},this.enabled=e.enabled,this.size=e.size,this.color=new c(e.color)}};var R=class i{video=le.required();progress=_(0);constructor(){ae(e=>{let t=this.video(),o=()=>{this.progress.set(t.currentTime/t.duration*100)};t.addEventListener("timeupdate",o),e(()=>{t.removeEventListener("timeupdate",o)})})}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=y({type:i,selectors:[["cooee-video-progress-bar"]],inputs:{video:[1,"video"]},decls:3,vars:3,consts:[[1,"video-untracked-path"],["role","progressbar",1,"video-tracked-path"]],template:function(t,o){t&1&&(J(0,"div",0)(1,"div",1),Z(2,"div"),X()()),t&2&&(d(),S("width",o.progress(),"%"),T("aria-valuenow",o.progress()))},styles:["[_nghost-%COMP%]{display:block;width:100%;position:absolute;z-index:10;top:4px;padding-inline:8px;box-sizing:border-box}.video-untracked-path[_ngcontent-%COMP%], .video-tracked-path[_ngcontent-%COMP%]{height:4px;border-radius:var(--lc-video-progress-bar-radius)}.video-untracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-bg-color));width:100%;margin-bottom:2px}.video-tracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-color));transition:width .5s ease-in-out}@media (prefers-reduced-motion: reduce){.video-tracked-path[_ngcontent-%COMP%]{transition:none}}"]})};var z=class i{dialogState=de();dialog=v(fe);triggerData=v(ge)().triggerData;eventData=v(P);containerRef=v(q);async share(e){e.stopPropagation(),e.preventDefault(),k()&&we()?await this.shareNative():await this.shareWithDialog()}async shareNative(){let e=Te(this.triggerData,this.eventData.video,!1);await navigator.share(e),Ee(this.triggerData,this.eventData.video,this.eventData.index,"Native")}async shareWithDialog(){let e=await import("./share-dialog.component-SDFTICNQ.js");this.dialogState.emit(!0),this.dialog.open(e.ShareDialogComponent,{viewContainerRef:this.containerRef}).closed.subscribe(()=>this.dialogState.emit(!1))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=y({type:i,selectors:[["cooee-share-button"]],outputs:{dialogState:"dialogState"},decls:2,vars:0,consts:[["type","button","aria-label","Share video",3,"click"],["name","share"]],template:function(t,o){t&1&&(l(0,"button",0),h("click",function(r){return o.share(r)}),w(1,"cooee-icon",1),a())},dependencies:[M],styles:["button[_ngcontent-%COMP%]{width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent)}button[_ngcontent-%COMP%] cooee-icon[name=share][_ngcontent-%COMP%]{color:#fff}"]})};var ze=["swiperComp"],$e=["videoEl"],Le=(i,e)=>e.url;function Ae(i,e){i&1&&(l(0,"div",11),w(1,"div",15),a())}function Fe(i,e){if(i&1&&w(0,"source",13),i&2){let t=e.$implicit;u("type",re(t.mimeType))("src",t.url,G)}}function Be(i,e){i&1&&A(0)}function He(i,e){if(i&1){let t=C();l(0,"cooee-video-promoted-items",24),h("cardClick",function(n){p(t);let r=s(2).$implicit,f=s();return m(f.productCardClicked(n,r))}),a()}if(i&2){let t=s(2).$implicit;u("items",t.items)}}function je(i,e){if(i&1&&w(0,"cooee-video-card",23),i&2){let t=s(2).$implicit;u("card",t.card)}}function Ue(i,e){if(i&1){let t=C();w(0,"cooee-video-progress-bar",16),l(1,"div",17)(2,"cooee-mute-toggle",18),ne("mutedChange",function(n){p(t);let r=s(2);return oe(r.muted,n)||(r.muted=n),m(n)}),h("toggled",function(){p(t);let n=s(2);return m(n.muteToggled())}),a(),E(3,Be,1,0,"ng-container",8),a(),l(4,"div",19)(5,"cooee-share-button",20),h("dialogState",function(n){p(t);let r=s(2);return m(r.shareDialogOpen.set(n))}),a()(),l(6,"div",21),x(7,He,1,1,"cooee-video-promoted-items",22)(8,je,1,1,"cooee-video-card",23),a()}if(i&2){let t=s().$implicit,o=V(5),n=s(),r=V(9);u("video",o),d(2),ie("muted",n.muted),u("videoEl",o),d(),u("ngTemplateOutlet",r),d(4),D(t.items.length&&n.videoConfig.showItems()?7:t.card&&n.videoConfig.footerContent===n.VideoConfigFooterContent.CARD?8:-1)}}function We(i,e){if(i&1){let t=C();l(0,"cooee-item-detail",25),h("closeClick",function(){p(t);let n=s(2);return m(n.productModalClosed())}),a()}if(i&2){let t=s(2);u("item",t.selectedItem)("similarItems",t.selectedVideo.items)("template",t.videoConfig.itemDetailConfig.template)}}function Ke(i,e){if(i&1){let t=C();l(0,"div",6)(1,"div",9)(2,"div",10),x(3,Ae,2,0,"div",11),l(4,"video",12,2),h("click",function(){let n=p(t).$index,r=s();return m(r.currentIndex===n&&r.toggleMute())})("ended",function(){p(t);let n=V(5),r=s();return m(r.onVideoEnded(n))})("loadstart",function(){let n=p(t).$index,r=s();return m(r.onVideoLoadStart(n))})("canplay",function(){let n=p(t).$index,r=s();return m(r.onVideoCanPlay(n))}),$(6,Fe,1,3,"source",13,Le),a(),x(8,Ue,9,5),a(),x(9,We,1,3,"cooee-item-detail",14),a()()}if(i&2){let t=e.$implicit,o=e.$index,n=s();d(2),S("background-image",t.thumbnail?"url("+t.thumbnail+")":null),d(),D(n.shouldShowVideoSpinner(o)?3:-1),d(),u("ngClass",n.viewTemplateClassName)("muted",!0),T("preload",n.isVideoVisible(o)?"metadata":"none")("data-video-id",t.id)("autoplay",null),d(2),L(t.sources),d(2),D(n.currentIndex===o?8:-1),d(),D(n.selectedItem&&n.currentIndex===o?9:-1)}}function Ge(i,e){i&1&&A(0)}function Qe(i,e){if(i&1){let t=C();l(0,"button",26),h("click",function(){p(t);let n=s();return m(n.close())}),w(1,"cooee-icon",27),a()}}var ke=class i{swiperComponent;videoElements;VideoConfigFooterContent=_e;currentIndex=0;muted=_(!1);selectedItem=null;selectedVideo;detailPopupTemplate;viewTemplateClassName="lc-video-only-view";shareDialogOpen=_(!1);data=v(ve);elementRef=v(K);eventData=v(P);dialogRef=v(he);swiperInitialized=_(!1);swiperOptions=_(null);videos=[];videoConfig;triggerContext;engagementTrigger;isMobile=k();navigationConfig;cssLoadedPromise;resizeDebouncer=new be(this.onResize.bind(this));videoLoadingStates=new Map;constructor(){this.videos=this.data.videos,this.currentIndex=this.data.currentIndex,this.selectedItem=this.data.selectedItem??null,this.selectedVideo=this.videos[this.currentIndex],this.triggerContext=this.data.triggerContext,this.engagementTrigger=this.triggerContext.triggerData,this.videoConfig=this.engagementTrigger?.content?.videoConfig??new Ce,this.navigationConfig=new N({enabled:!0,size:50,color:new c({h:"#000000"})}),this.cssLoadedPromise=ue(this.elementRef.nativeElement.shadowRoot)}onKeyDown(e){e.preventDefault(),e.stopPropagation(),this.close()}async ngOnInit(){switch(this.muted.set(await U.get("muted",!1)),this.videoConfig.detailPopup.template){case"PRODUCT_DETAIL_VIEW":this.selectItemForDetailView(),this.viewTemplateClassName="lc-product-detail-view";break;case"VIDEO_ONLY_VIEW":this.viewTemplateClassName="lc-video-only-view";break}}ngAfterViewInit(){this.initializeSwiperWithVideoDimensions()}ngOnDestroy(){this.resizeDebouncer?.destroy()}initializeSwiperWithVideoDimensions(){this.applyOptimalVideoDimensions(),this.initSwiperOptions(),this.playActiveVideo(!1)}close(){let e=this.getCurrentVideoElement();this.dialogRef.close({lastVideo:this.videos[this.currentIndex],lastVideoIndex:this.currentIndex,lastVideoDuration:e?.currentTime})}getCurrentVideoElement(){return this.videoElements.get(this.currentIndex)?.nativeElement}moveToNextVideo(){this.swiperComponent.swiper.slideTo(this.currentIndex+1)}productModalClosed(){this.selectedItem=null}pauseAll(){this.videoElements.forEach(e=>e.nativeElement.pause())}toggleMute(){this.muted.update(e=>!e)}async muteToggled(){await U.set("muted",this.muted());let t=[this.muted()?"CE Video Muted":"CE Video Unmuted",{current:this.currentVideoProps()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(t)}playActiveVideo(e=!0){e&&this.pauseAll();let t=this.getCurrentVideoElement();t&&this.playVideo(t)}playVideo(e){e.currentTime=0,e.play().catch(t=>me.error(t))}onVideoEnded(e){if(this.currentIndex<this.videos.length-1)this.selectedItem||this.shareDialogOpen()?this.playVideo(e):this.moveToNextVideo();else{let t=this.getPreviousVideoDataForEvent(),o=["CE Last Video Ended",{previous:t},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(o),this.playVideo(e)}}onSlideChange(e){let t=this.getPreviousVideoDataForEvent();this.currentIndex=e.realIndex,this.selectedVideo=this.videos[this.currentIndex],this.eventData.video=this.selectedVideo,this.eventData.index=this.currentIndex,this.playActiveVideo(),this.isProductDetailView()?this.selectItemForDetailView():this.selectedItem=null;let o=this.currentVideoProps(),n={previous:t,current:o},r=new j("CE Video Changed",n,this.engagementTrigger);r.setVideos(this.videos[this.currentIndex]),window.CooeeSDK.sendEvent(r)}productCardClicked(e,t){let o={videoID:t.id,videoIndex:this.currentIndex},n=new j("CE More Item Info Clicked",{current:o},this.engagementTrigger);n.setVideos(t),window.CooeeSDK.sendEvent(n),this.selectedItem=e}onVideoLoadStart(e){this.videoLoadingStates.set(e,!0)}onVideoCanPlay(e){this.videoLoadingStates.set(e,!1)}shouldShowVideoSpinner(e){return this.swiperInitialized()?this.videoLoadingStates.get(e)===!0&&this.isVideoVisible(e):this.isVideoVisible(e)}isVideoVisible(e){let t=this.currentIndex-1,o=this.currentIndex+1;return e===this.currentIndex||e===t||e===o}async initSwiperOptions(){await this.cssLoadedPromise;let e=this.isMobile?1:"auto",t=0;this.isProductDetailView()&&(e="auto",t=10),this.swiperOptions.set({direction:this.isMobile?"vertical":"horizontal",effect:this.isMobile?"slide":"coverflow",slidesPerView:e,initialSlide:this.currentIndex,centeredSlides:!0,spaceBetween:t,coverflowEffect:{rotate:0,stretch:0,depth:400,modifier:1,slideShadows:!1},on:{init:o=>{this.swiperInitialized.set(!0),setTimeout(()=>{o.update()},100)}},mousewheel:{enabled:!this.isMobile,invert:!1,thresholdDelta:20}})}isProductDetailView(){return this.videoConfig.detailPopup.template==="PRODUCT_DETAIL_VIEW"}currentVideoProps(){return{videoID:this.videos[this.currentIndex].id,videoIndex:this.currentIndex}}getPreviousVideoDataForEvent(){let e=this.currentVideoProps(),t=this.videoElements.find(n=>n.nativeElement.dataset.videoId===this.videos[this.currentIndex].id)?.nativeElement;e.playedTillMS=Math.ceil(t?.currentTime*1e3);let o=t?.duration*1e3;return e.playedTillPercent=+(e.playedTillMS/o).toFixed(4),e}selectItemForDetailView(){this.selectedItem=this.isMobile?null:this.selectedVideo?.items?.[0]??null}applyOptimalVideoDimensions(){if(this.isMobile||this.isProductDetailView())return;let e=this.calculateOptimalVideoDimensions();e&&this.setVideoContainerDimensions(e.width,e.height)}calculateOptimalVideoDimensions(){let e=this.videos.map(g=>g.sources?.[0]).filter(g=>g?.width&&g?.height).map(g=>({width:g.width,height:g.height,aspectRatio:g.width/g.height}));if(e.length===0)return null;let t=e[0],o=window.innerWidth*.9,n=window.innerHeight*.9,r=o/t.width,f=n/t.height,b=Math.min(r,f);return{width:Math.floor(t.width*b),height:Math.floor(t.height*b)}}setVideoContainerDimensions(e,t){let o=this.elementRef.nativeElement;o.style.setProperty("--video-container-width",`${e}px`),o.style.setProperty("--video-container-height",`${t}px`)}onResize(){this.applyOptimalVideoDimensions()}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=y({type:i,selectors:[["cooee-video-detail-dialog"]],viewQuery:function(t,o){if(t&1&&(F(ze,7),F($e,5)),t&2){let n;B(n=H())&&(o.swiperComponent=n.first),B(n=H())&&(o.videoElements=n)}},hostAttrs:[1,"letscooee-widget"],hostBindings:function(t,o){t&1&&h("keydown.escape",function(r){return o.onKeyDown(r)},Q)},decls:10,vars:4,consts:[["swiperComp",""],["closeButtonTemplate",""],["videoEl",""],[1,"lc-shadow-inner",3,"ngClass"],[1,"video-swiper",3,"slideChange","options","navigationConfig"],["ngProjectAs","swiper-slides",5,["swiper-slides"]],[1,"swiper-slide","video-slide"],[1,"lc-desktop-controls"],[4,"ngTemplateOutlet"],[1,"lc-video-modal-row"],[1,"lc-video-container"],[1,"video-loading-overlay"],["playsinline","",1,"lc-video-el",3,"click","ended","loadstart","canplay","ngClass","muted"],[3,"src","type"],[1,"swiper-no-swiping","swiper-no-mousewheel",3,"item","similarItems","template"],[1,"loading-spinner"],[3,"video"],[1,"lc-video-controls"],[3,"mutedChange","toggled","muted","videoEl"],[1,"share-controls"],[3,"dialogState"],[1,"lc-card-container"],[3,"items"],[3,"card"],[3,"cardClick","items"],[1,"swiper-no-swiping","swiper-no-mousewheel",3,"closeClick","item","similarItems","template"],["type","button","aria-label","Close",1,"lc-close-button",3,"click"],["name","close","aria-hidden","true"]],template:function(t,o){if(t&1){let n=C();l(0,"div",3)(1,"cooee-swiper",4,0),h("slideChange",function(f){return p(n),m(o.onSlideChange(f))}),ee(3,5),$(4,Ke,10,10,"div",6,Y),te(),a(),l(6,"div",7),E(7,Ge,1,0,"ng-container",8),a()(),E(8,Qe,2,0,"ng-template",null,1,se)}if(t&2){let n=V(9);u("ngClass",o.viewTemplateClassName),d(),u("options",o.swiperOptions())("navigationConfig",o.navigationConfig),d(3),L(o.videos),d(3),u("ngTemplateOutlet",n)}},dependencies:[Ie,ye,Ve,z,R,pe,ce,De,xe,M],styles:[`:host{display:flex}.lc-shadow-inner{position:relative;width:100vw;height:100vh;display:flex}@media (min-width: 768px){.lc-shadow-inner{background-color:color-mix(in oklab,#000 70%,transparent);justify-content:center;align-items:center}}.video-swiper{--swiper-navigation-size: 50px;--swiper-navigation-color: white;width:100dvw;height:100dvh}.lc-product-detail-view .video-swiper{align-items:center}@media (min-width: 768px){.video-swiper{width:100%;height:100%;max-width:90vw;max-height:90vh}}.video-swiper>.swiper-wrapper{max-height:100%;pointer-events:none}.lc-product-detail-view .video-swiper>.swiper-wrapper{align-items:center}@media (max-width: 768px){.video-swiper>.swiper-button-prev{display:none!important}}@media (max-width: 768px){.video-swiper>.swiper-button-next{display:var(--lc-next-video-button-display)!important;width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent);color:#fff;inset:auto auto 12px 50%;transform:translate(-50%) rotate(90deg)}.video-swiper>.swiper-button-next:after{color:#fff;font-weight:900}}.video-swiper:has(cooee-item-detail)>.swiper-button-next{display:none!important}.video-slide{position:relative;display:flex;align-items:center;visibility:hidden;pointer-events:auto}.lc-product-detail-view .video-slide{width:40vw!important;height:70vh!important}@media (min-width: 768px){.lc-product-detail-view .video-slide{min-width:650px!important}}@media (max-width: 768px){.lc-product-detail-view .video-slide{width:100%!important;height:100%!important}}@media (min-width: 768px){.lc-video-only-view .video-slide{width:fit-content!important}}@media (min-width: 768px){.video-slide{border-radius:var(--lc-media-radius);overflow:hidden}}.video-slide.swiper-slide-active,.video-slide.swiper-slide-prev,.video-slide.swiper-slide-next{visibility:visible}video{width:100%;height:100%;object-fit:cover;position:relative;z-index:3}.lc-desktop-controls{position:absolute;top:2rem;right:4rem;z-index:10;display:flex;gap:.5rem}@media (max-width: 768px){.lc-desktop-controls{display:none}}.lc-video-controls{position:absolute;top:1rem;z-index:10;right:.5rem;display:flex;gap:.25rem}@media (min-width: 768px){.lc-video-controls .lc-close-button{display:none}}.share-controls{position:absolute;bottom:30%;right:.5rem;z-index:10;display:flex;gap:.25rem;flex-direction:column;justify-content:center;align-items:center}.lc-close-button{width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent)}.lc-video-container{position:relative;height:100%;width:100%;background:#000000b3 no-repeat center;background-size:cover}@media (min-width: 768px){.lc-product-detail-view .lc-video-container{width:50%}}@media (min-width: 768px){.lc-video-only-view .lc-video-container{width:var(--video-container-width, 100%);height:var(--video-container-height, 100%)}}.lc-card-container{position:absolute;bottom:12px;z-index:10;width:100%;padding-inline:12px;box-sizing:border-box}.lc-product-detail-view .lc-card-container{display:none}@media (max-width: 768px){.lc-product-detail-view .lc-card-container{display:block}}.lc-product-detail-view .lc-video-modal-row{display:flex;justify-content:center;height:100%;width:100%}.lc-video-only-view .lc-video-modal-row{display:block;height:100%}.lc-product-detail-view cooee-item-detail{--header-display: none;width:50%;flex:1}@media (max-width: 768px){.lc-product-detail-view cooee-item-detail{--header-display: flex;width:100%;height:70dvh;position:absolute;bottom:0;z-index:2147483646}}.lc-video-only-view cooee-item-detail{width:100%;height:70dvh;z-index:2147483646;bottom:0;position:absolute;border-radius:var(--lc-card-radius) var(--lc-card-radius) 0 0}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.video-loading-overlay{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;background-color:#0000004d;z-index:2}.video-loading-overlay .loading-spinner{width:30px;height:30px;border:3px solid rgba(255,255,255,.3);border-top:3px solid #fff;border-radius:50%;animation:spin 1s linear infinite}
1
+ import{A as Ve,B as Ie,c as ue,j as U,q as k,r as we,s as be,v as _e,w as Ce,x as ye,y as xe,z as De}from"./chunk-OAZIKL6G.js";import{a as Ee,b as Te}from"./chunk-FE5VYO2C.js";import{c as me,e as ge,f as P,g as j,i as he,j as ve,k as fe,l as M}from"./chunk-UGPL2NMF.js";import"./chunk-T6RU7RSX.js";import{Ba as h,Da as s,E as _,Ga as F,Ha as B,I as K,Ia as H,L as G,La as V,M as Q,Ma as S,O as d,Ta as ie,Ua as oe,V as q,Va as ne,X as y,Za as re,ba as E,fb as se,ha as T,ia as x,ib as ae,ja as D,jb as de,kb as le,la as Y,ma as $,na as L,oa as u,pa as l,qa as a,ra as w,sa as J,sb as ce,ta as X,ua as Z,ub as pe,v,va as ee,wa as te,x as p,xa as A,y as m,za as C}from"./chunk-K77Q3IPF.js";import"./chunk-V7UGKYBN.js";var I="a-f\\d",Me=`#?[${I}]{3}[${I}]?`,Oe=`#?[${I}]{6}([${I}]{2})?`,Ne=new RegExp(`[^#${I}]`,"gi"),Re=new RegExp(`^${Me}$|^${Oe}$`,"i");function W(i,e={}){if(typeof i!="string"||Ne.test(i)||!Re.test(i))throw new TypeError("Expected a valid hex string");i=i.replace(/^#/,"");let t=1;i.length===8&&(t=Number.parseInt(i.slice(6,8),16)/255,i=i.slice(0,6)),i.length===4&&(t=Number.parseInt(i.slice(3,4).repeat(2),16)/255,i=i.slice(0,3)),i.length===3&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]);let o=Number.parseInt(i,16),n=o>>16,r=o>>8&255,f=o&255,b=typeof e.alpha=="number"?e.alpha:t;if(e.format==="array")return[n,r,f,b];if(e.format==="css"){let g=b===1?"":` / ${Number((b*100).toFixed(2))}%`;return`rgb(${n} ${r} ${f}${g})`}return{red:n,green:r,blue:f,alpha:b}}var c=class{h;a=100;g;constructor(e){e??={},this.h=e.h,this.a=e.a,this.g=e.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return W(this.hex,{format:"css",alpha:this.getAlpha()})}catch(e){return console.error("Invalid hex",e),"#000000"}}getAlpha(){return(this.a??100)/100}};var O=class i{static DEFAULT_FALLBACK=new c({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new c(e.c)),e.fb&&(this.fb=new c(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??i.DEFAULT_FALLBACK}};var N=class{size;enabled;color;constructor(e){e??={},this.enabled=e.enabled,this.size=e.size,this.color=new c(e.color)}};var R=class i{video=le.required();progress=_(0);constructor(){ae(e=>{let t=this.video(),o=()=>{this.progress.set(t.currentTime/t.duration*100)};t.addEventListener("timeupdate",o),e(()=>{t.removeEventListener("timeupdate",o)})})}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=y({type:i,selectors:[["cooee-video-progress-bar"]],inputs:{video:[1,"video"]},decls:3,vars:3,consts:[[1,"video-untracked-path"],["role","progressbar",1,"video-tracked-path"]],template:function(t,o){t&1&&(J(0,"div",0)(1,"div",1),Z(2,"div"),X()()),t&2&&(d(),S("width",o.progress(),"%"),T("aria-valuenow",o.progress()))},styles:["[_nghost-%COMP%]{display:block;width:100%;position:absolute;z-index:10;top:4px;padding-inline:8px;box-sizing:border-box}.video-untracked-path[_ngcontent-%COMP%], .video-tracked-path[_ngcontent-%COMP%]{height:4px;border-radius:var(--lc-video-progress-bar-radius)}.video-untracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-bg-color));width:100%;margin-bottom:2px}.video-tracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-color));transition:width .5s ease-in-out}@media (prefers-reduced-motion: reduce){.video-tracked-path[_ngcontent-%COMP%]{transition:none}}"]})};var z=class i{dialogState=de();dialog=v(fe);triggerData=v(ge)().triggerData;eventData=v(P);containerRef=v(q);async share(e){e.stopPropagation(),e.preventDefault(),k()&&we()?await this.shareNative():await this.shareWithDialog()}async shareNative(){let e=Te(this.triggerData,this.eventData.video,!1);await navigator.share(e),Ee(this.triggerData,this.eventData.video,this.eventData.index,"Native")}async shareWithDialog(){let e=await import("./share-dialog.component-SVORYMIG.js");this.dialogState.emit(!0),this.dialog.open(e.ShareDialogComponent,{viewContainerRef:this.containerRef}).closed.subscribe(()=>this.dialogState.emit(!1))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=y({type:i,selectors:[["cooee-share-button"]],outputs:{dialogState:"dialogState"},decls:2,vars:0,consts:[["type","button","aria-label","Share video",3,"click"],["name","share"]],template:function(t,o){t&1&&(l(0,"button",0),h("click",function(r){return o.share(r)}),w(1,"cooee-icon",1),a())},dependencies:[M],styles:["button[_ngcontent-%COMP%]{width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent)}button[_ngcontent-%COMP%] cooee-icon[name=share][_ngcontent-%COMP%]{color:#fff}"]})};var ze=["swiperComp"],$e=["videoEl"],Le=(i,e)=>e.url;function Ae(i,e){i&1&&(l(0,"div",11),w(1,"div",15),a())}function Fe(i,e){if(i&1&&w(0,"source",13),i&2){let t=e.$implicit;u("type",re(t.mimeType))("src",t.url,G)}}function Be(i,e){i&1&&A(0)}function He(i,e){if(i&1){let t=C();l(0,"cooee-video-promoted-items",24),h("cardClick",function(n){p(t);let r=s(2).$implicit,f=s();return m(f.productCardClicked(n,r))}),a()}if(i&2){let t=s(2).$implicit;u("items",t.items)}}function je(i,e){if(i&1&&w(0,"cooee-video-card",23),i&2){let t=s(2).$implicit;u("card",t.card)}}function Ue(i,e){if(i&1){let t=C();w(0,"cooee-video-progress-bar",16),l(1,"div",17)(2,"cooee-mute-toggle",18),ne("mutedChange",function(n){p(t);let r=s(2);return oe(r.muted,n)||(r.muted=n),m(n)}),h("toggled",function(){p(t);let n=s(2);return m(n.muteToggled())}),a(),E(3,Be,1,0,"ng-container",8),a(),l(4,"div",19)(5,"cooee-share-button",20),h("dialogState",function(n){p(t);let r=s(2);return m(r.shareDialogOpen.set(n))}),a()(),l(6,"div",21),x(7,He,1,1,"cooee-video-promoted-items",22)(8,je,1,1,"cooee-video-card",23),a()}if(i&2){let t=s().$implicit,o=V(5),n=s(),r=V(9);u("video",o),d(2),ie("muted",n.muted),u("videoEl",o),d(),u("ngTemplateOutlet",r),d(4),D(t.items.length&&n.videoConfig.showItems()?7:t.card&&n.videoConfig.footerContent===n.VideoConfigFooterContent.CARD?8:-1)}}function We(i,e){if(i&1){let t=C();l(0,"cooee-item-detail",25),h("closeClick",function(){p(t);let n=s(2);return m(n.productModalClosed())}),a()}if(i&2){let t=s(2);u("item",t.selectedItem)("similarItems",t.selectedVideo.items)("template",t.videoConfig.itemDetailConfig.template)}}function Ke(i,e){if(i&1){let t=C();l(0,"div",6)(1,"div",9)(2,"div",10),x(3,Ae,2,0,"div",11),l(4,"video",12,2),h("click",function(){let n=p(t).$index,r=s();return m(r.currentIndex===n&&r.toggleMute())})("ended",function(){p(t);let n=V(5),r=s();return m(r.onVideoEnded(n))})("loadstart",function(){let n=p(t).$index,r=s();return m(r.onVideoLoadStart(n))})("canplay",function(){let n=p(t).$index,r=s();return m(r.onVideoCanPlay(n))}),$(6,Fe,1,3,"source",13,Le),a(),x(8,Ue,9,5),a(),x(9,We,1,3,"cooee-item-detail",14),a()()}if(i&2){let t=e.$implicit,o=e.$index,n=s();d(2),S("background-image",t.thumbnail?"url("+t.thumbnail+")":null),d(),D(n.shouldShowVideoSpinner(o)?3:-1),d(),u("ngClass",n.viewTemplateClassName)("muted",!0),T("preload",n.isVideoVisible(o)?"metadata":"none")("data-video-id",t.id)("autoplay",null),d(2),L(t.sources),d(2),D(n.currentIndex===o?8:-1),d(),D(n.selectedItem&&n.currentIndex===o?9:-1)}}function Ge(i,e){i&1&&A(0)}function Qe(i,e){if(i&1){let t=C();l(0,"button",26),h("click",function(){p(t);let n=s();return m(n.close())}),w(1,"cooee-icon",27),a()}}var ke=class i{swiperComponent;videoElements;VideoConfigFooterContent=_e;currentIndex=0;muted=_(!1);selectedItem=null;selectedVideo;detailPopupTemplate;viewTemplateClassName="lc-video-only-view";shareDialogOpen=_(!1);data=v(ve);elementRef=v(K);eventData=v(P);dialogRef=v(he);swiperInitialized=_(!1);swiperOptions=_(null);videos=[];videoConfig;triggerContext;engagementTrigger;isMobile=k();navigationConfig;cssLoadedPromise;resizeDebouncer=new be(this.onResize.bind(this));videoLoadingStates=new Map;constructor(){this.videos=this.data.videos,this.currentIndex=this.data.currentIndex,this.selectedItem=this.data.selectedItem??null,this.selectedVideo=this.videos[this.currentIndex],this.triggerContext=this.data.triggerContext,this.engagementTrigger=this.triggerContext.triggerData,this.videoConfig=this.engagementTrigger?.content?.videoConfig??new Ce,this.navigationConfig=new N({enabled:!0,size:50,color:new c({h:"#000000"})}),this.cssLoadedPromise=ue(this.elementRef.nativeElement.shadowRoot)}onKeyDown(e){e.preventDefault(),e.stopPropagation(),this.close()}async ngOnInit(){switch(this.muted.set(await U.get("muted",!1)),this.videoConfig.detailPopup.template){case"PRODUCT_DETAIL_VIEW":this.selectItemForDetailView(),this.viewTemplateClassName="lc-product-detail-view";break;case"VIDEO_ONLY_VIEW":this.viewTemplateClassName="lc-video-only-view";break}}ngAfterViewInit(){this.initializeSwiperWithVideoDimensions()}ngOnDestroy(){this.resizeDebouncer?.destroy()}initializeSwiperWithVideoDimensions(){this.applyOptimalVideoDimensions(),this.initSwiperOptions(),this.playActiveVideo(!1)}close(){let e=this.getCurrentVideoElement();this.dialogRef.close({lastVideo:this.videos[this.currentIndex],lastVideoIndex:this.currentIndex,lastVideoDuration:e?.currentTime})}getCurrentVideoElement(){return this.videoElements.get(this.currentIndex)?.nativeElement}moveToNextVideo(){this.swiperComponent.swiper.slideTo(this.currentIndex+1)}productModalClosed(){this.selectedItem=null}pauseAll(){this.videoElements.forEach(e=>e.nativeElement.pause())}toggleMute(){this.muted.update(e=>!e)}async muteToggled(){await U.set("muted",this.muted());let t=[this.muted()?"CE Video Muted":"CE Video Unmuted",{current:this.currentVideoProps()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(t)}playActiveVideo(e=!0){e&&this.pauseAll();let t=this.getCurrentVideoElement();t&&this.playVideo(t)}playVideo(e){e.currentTime=0,e.play().catch(t=>me.error(t))}onVideoEnded(e){if(this.currentIndex<this.videos.length-1)this.selectedItem||this.shareDialogOpen()?this.playVideo(e):this.moveToNextVideo();else{let t=this.getPreviousVideoDataForEvent(),o=["CE Last Video Ended",{previous:t},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(o),this.playVideo(e)}}onSlideChange(e){let t=this.getPreviousVideoDataForEvent();this.currentIndex=e.realIndex,this.selectedVideo=this.videos[this.currentIndex],this.eventData.video=this.selectedVideo,this.eventData.index=this.currentIndex,this.playActiveVideo(),this.isProductDetailView()?this.selectItemForDetailView():this.selectedItem=null;let o=this.currentVideoProps(),n={previous:t,current:o},r=new j("CE Video Changed",n,this.engagementTrigger);r.setVideos(this.videos[this.currentIndex]),window.CooeeSDK.sendEvent(r)}productCardClicked(e,t){let o={videoID:t.id,videoIndex:this.currentIndex},n=new j("CE More Item Info Clicked",{current:o},this.engagementTrigger);n.setVideos(t),window.CooeeSDK.sendEvent(n),this.selectedItem=e}onVideoLoadStart(e){this.videoLoadingStates.set(e,!0)}onVideoCanPlay(e){this.videoLoadingStates.set(e,!1)}shouldShowVideoSpinner(e){return this.swiperInitialized()?this.videoLoadingStates.get(e)===!0&&this.isVideoVisible(e):this.isVideoVisible(e)}isVideoVisible(e){let t=this.currentIndex-1,o=this.currentIndex+1;return e===this.currentIndex||e===t||e===o}async initSwiperOptions(){await this.cssLoadedPromise;let e=this.isMobile?1:"auto",t=0;this.isProductDetailView()&&(e="auto",t=10),this.swiperOptions.set({direction:this.isMobile?"vertical":"horizontal",effect:this.isMobile?"slide":"coverflow",slidesPerView:e,initialSlide:this.currentIndex,centeredSlides:!0,spaceBetween:t,coverflowEffect:{rotate:0,stretch:0,depth:400,modifier:1,slideShadows:!1},on:{init:o=>{this.swiperInitialized.set(!0),setTimeout(()=>{o.update()},100)}},mousewheel:{enabled:!this.isMobile,invert:!1,thresholdDelta:20}})}isProductDetailView(){return this.videoConfig.detailPopup.template==="PRODUCT_DETAIL_VIEW"}currentVideoProps(){return{videoID:this.videos[this.currentIndex].id,videoIndex:this.currentIndex}}getPreviousVideoDataForEvent(){let e=this.currentVideoProps(),t=this.videoElements.find(n=>n.nativeElement.dataset.videoId===this.videos[this.currentIndex].id)?.nativeElement;e.playedTillMS=Math.ceil(t?.currentTime*1e3);let o=t?.duration*1e3;return e.playedTillPercent=+(e.playedTillMS/o).toFixed(4),e}selectItemForDetailView(){this.selectedItem=this.isMobile?null:this.selectedVideo?.items?.[0]??null}applyOptimalVideoDimensions(){if(this.isMobile||this.isProductDetailView())return;let e=this.calculateOptimalVideoDimensions();e&&this.setVideoContainerDimensions(e.width,e.height)}calculateOptimalVideoDimensions(){let e=this.videos.map(g=>g.sources?.[0]).filter(g=>g?.width&&g?.height).map(g=>({width:g.width,height:g.height,aspectRatio:g.width/g.height}));if(e.length===0)return null;let t=e[0],o=window.innerWidth*.9,n=window.innerHeight*.9,r=o/t.width,f=n/t.height,b=Math.min(r,f);return{width:Math.floor(t.width*b),height:Math.floor(t.height*b)}}setVideoContainerDimensions(e,t){let o=this.elementRef.nativeElement;o.style.setProperty("--video-container-width",`${e}px`),o.style.setProperty("--video-container-height",`${t}px`)}onResize(){this.applyOptimalVideoDimensions()}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=y({type:i,selectors:[["cooee-video-detail-dialog"]],viewQuery:function(t,o){if(t&1&&(F(ze,7),F($e,5)),t&2){let n;B(n=H())&&(o.swiperComponent=n.first),B(n=H())&&(o.videoElements=n)}},hostAttrs:[1,"letscooee-widget"],hostBindings:function(t,o){t&1&&h("keydown.escape",function(r){return o.onKeyDown(r)},Q)},decls:10,vars:4,consts:[["swiperComp",""],["closeButtonTemplate",""],["videoEl",""],[1,"lc-shadow-inner",3,"ngClass"],[1,"video-swiper",3,"slideChange","options","navigationConfig"],["ngProjectAs","swiper-slides",5,["swiper-slides"]],[1,"swiper-slide","video-slide"],[1,"lc-desktop-controls"],[4,"ngTemplateOutlet"],[1,"lc-video-modal-row"],[1,"lc-video-container"],[1,"video-loading-overlay"],["playsinline","",1,"lc-video-el",3,"click","ended","loadstart","canplay","ngClass","muted"],[3,"src","type"],[1,"swiper-no-swiping","swiper-no-mousewheel",3,"item","similarItems","template"],[1,"loading-spinner"],[3,"video"],[1,"lc-video-controls"],[3,"mutedChange","toggled","muted","videoEl"],[1,"share-controls"],[3,"dialogState"],[1,"lc-card-container"],[3,"items"],[3,"card"],[3,"cardClick","items"],[1,"swiper-no-swiping","swiper-no-mousewheel",3,"closeClick","item","similarItems","template"],["type","button","aria-label","Close",1,"lc-close-button",3,"click"],["name","close","aria-hidden","true"]],template:function(t,o){if(t&1){let n=C();l(0,"div",3)(1,"cooee-swiper",4,0),h("slideChange",function(f){return p(n),m(o.onSlideChange(f))}),ee(3,5),$(4,Ke,10,10,"div",6,Y),te(),a(),l(6,"div",7),E(7,Ge,1,0,"ng-container",8),a()(),E(8,Qe,2,0,"ng-template",null,1,se)}if(t&2){let n=V(9);u("ngClass",o.viewTemplateClassName),d(),u("options",o.swiperOptions())("navigationConfig",o.navigationConfig),d(3),L(o.videos),d(3),u("ngTemplateOutlet",n)}},dependencies:[Ie,ye,Ve,z,R,pe,ce,De,xe,M],styles:[`:host{display:flex}.lc-shadow-inner{position:relative;width:100vw;height:100vh;display:flex}@media (min-width: 768px){.lc-shadow-inner{background-color:color-mix(in oklab,#000 70%,transparent);justify-content:center;align-items:center}}.video-swiper{--swiper-navigation-size: 50px;--swiper-navigation-color: white;width:100dvw;height:100dvh}.lc-product-detail-view .video-swiper{align-items:center}@media (min-width: 768px){.video-swiper{width:100%;height:100%;max-width:90vw;max-height:90vh}}.video-swiper>.swiper-wrapper{max-height:100%;pointer-events:none}.lc-product-detail-view .video-swiper>.swiper-wrapper{align-items:center}@media (max-width: 768px){.video-swiper>.swiper-button-prev{display:none!important}}@media (max-width: 768px){.video-swiper>.swiper-button-next{display:var(--lc-next-video-button-display)!important;width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent);color:#fff;inset:auto auto 12px 50%;transform:translate(-50%) rotate(90deg)}.video-swiper>.swiper-button-next:after{color:#fff;font-weight:900}}.video-swiper:has(cooee-item-detail)>.swiper-button-next{display:none!important}.video-slide{position:relative;display:flex;align-items:center;visibility:hidden;pointer-events:auto}.lc-product-detail-view .video-slide{width:40vw!important;height:70vh!important}@media (min-width: 768px){.lc-product-detail-view .video-slide{min-width:650px!important}}@media (max-width: 768px){.lc-product-detail-view .video-slide{width:100%!important;height:100%!important}}@media (min-width: 768px){.lc-video-only-view .video-slide{width:fit-content!important}}@media (min-width: 768px){.video-slide{border-radius:var(--lc-media-radius);overflow:hidden}}.video-slide.swiper-slide-active,.video-slide.swiper-slide-prev,.video-slide.swiper-slide-next{visibility:visible}video{width:100%;height:100%;object-fit:cover;position:relative;z-index:3}.lc-desktop-controls{position:absolute;top:2rem;right:4rem;z-index:10;display:flex;gap:.5rem}@media (max-width: 768px){.lc-desktop-controls{display:none}}.lc-video-controls{position:absolute;top:1rem;z-index:10;right:.5rem;display:flex;gap:.25rem}@media (min-width: 768px){.lc-video-controls .lc-close-button{display:none}}.share-controls{position:absolute;bottom:30%;right:.5rem;z-index:10;display:flex;gap:.25rem;flex-direction:column;justify-content:center;align-items:center}.lc-close-button{width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent)}.lc-video-container{position:relative;height:100%;width:100%;background:#000000b3 no-repeat center;background-size:cover}@media (min-width: 768px){.lc-product-detail-view .lc-video-container{width:50%}}@media (min-width: 768px){.lc-video-only-view .lc-video-container{width:var(--video-container-width, 100%);height:var(--video-container-height, 100%)}}.lc-card-container{position:absolute;bottom:12px;z-index:10;width:100%;padding-inline:12px;box-sizing:border-box}.lc-product-detail-view .lc-card-container{display:none}@media (max-width: 768px){.lc-product-detail-view .lc-card-container{display:block}}.lc-product-detail-view .lc-video-modal-row{display:flex;justify-content:center;height:100%;width:100%}.lc-video-only-view .lc-video-modal-row{display:block;height:100%}.lc-product-detail-view cooee-item-detail{--header-display: none;width:50%;flex:1}@media (max-width: 768px){.lc-product-detail-view cooee-item-detail{--header-display: flex;width:100%;height:70dvh;position:absolute;bottom:0;z-index:2147483646}}.lc-video-only-view cooee-item-detail{width:100%;height:70dvh;z-index:2147483646;bottom:0;position:absolute;border-radius:var(--lc-card-radius) var(--lc-card-radius) 0 0}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.video-loading-overlay{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;background-color:#0000004d;z-index:2}.video-loading-overlay .loading-spinner{width:30px;height:30px;border:3px solid rgba(255,255,255,.3);border-top:3px solid #fff;border-radius:50%;animation:spin 1s linear infinite}
2
2
  `],encapsulation:3})};export{ke as VideoDetailDialogComponent};