@letscooee/web-sdk 14.8.4 → 14.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { B, M, z as zn } from './main.min.js';
2
- import { i as iN, c as cf, a, F as FE, d as dD, q as qo, N as ND, b as bD, Z as Zo, A as Af, g as gv, f as fd, e as AD, h as ge, j as bv, t as tc, Y as Yf, R as Rv, M as Mf, k as Av, l as tm } from './widgets-DM4_RO8i-OIujcWJE.js';
2
+ import { i as iN, c as cf, a, F as FE, d as dD, q as qo, N as ND, b as bD, Z as Zo, A as Af, g as gv, f as fd, e as AD, h as ge, j as bv, t as tc, Y as Yf, R as Rv, M as Mf, k as Av, l as tm } from './widgets-CpAjP5CS-ClcfLYyf.js';
3
3
 
4
4
  function P(i,t){if(i&1&&(qo(0,`li`)(1,`span`,1),gv(2),bv(3,`date`),Zo(),gv(4,`\xA0 `),tc(5,`span`,2),bv(6,`safeHtml`),Zo()),i&2){let e=t.$implicit;fd(2),Yf(Rv(3,2,e.time,`hh:mm:ss a`)),fd(3),Mf(`innerHTML`,Av(6,5,e.message),tm);}}var _=class i{logs=iN.required();constructor(){}async shareLogs(){let t=this.logs().map(o=>`[${new Date(o.time).toLocaleString(`en-US`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,fractionalSecondDigits:3,hour12:false,timeZoneName:`short`})}] ${o.message}`).join(`
5
5
  `);t=t.replaceAll(`\xA0`,` `);let e=B();if(e&&(t+=`
package/dist/main.min.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var __require=(x=>typeof require!==`undefined`?require:typeof Proxy!==`undefined`?new Proxy(x,{get:(a,b)=>(typeof require!==`undefined`?require:a)[b]}):x)(function(x){if(typeof require!==`undefined`)return require.apply(this,arguments);throw Error('Calling `require` for "'+x+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")});var k$4=Object.create;var g=Object.defineProperty,l$4=Object.defineProperties,m$2=Object.getOwnPropertyDescriptor,n$1=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,p$2=Object.getPrototypeOf,h$3=Object.prototype.hasOwnProperty,j$3=Object.prototype.propertyIsEnumerable;var i$1=(a,b,c)=>b in a?g(a,b,{enumerable:true,configurable:true,writable:true,value:c}):a[b]=c,r$2=(a,b)=>{for(var c in b||={})h$3.call(b,c)&&i$1(a,c,b[c]);if(f)for(var c of f(b))j$3.call(b,c)&&i$1(a,c,b[c]);return a},s$2=(a,b)=>l$4(a,n$1(b));var t$1=(a=>typeof __require<`u`?__require:typeof Proxy<`u`?new Proxy(a,{get:(b,c)=>(typeof __require<`u`?__require:b)[c]}):a)(function(a){if(typeof __require<`u`)return __require.apply(this,arguments);throw Error(`Dynamic require of "`+a+`" is not supported`)});var u$2=(a,b)=>{var c={};for(var d in a)h$3.call(a,d)&&b.indexOf(d)<0&&(c[d]=a[d]);if(a!=null&&f)for(var d of f(a))b.indexOf(d)<0&&j$3.call(a,d)&&(c[d]=a[d]);return c};var v$1=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports),w$3=(a,b)=>{for(var c in b)g(a,c,{get:b[c],enumerable:true});},q$4=(a,b,c,d)=>{if(b&&typeof b==`object`||typeof b==`function`)for(let e of o(b))!h$3.call(a,e)&&e!==c&&g(a,e,{get:()=>b[e],enumerable:!(d=m$2(b,e))||d.enumerable});return a};var x$3=(a,b,c)=>(c=a!=null?k$4(p$2(a)):{},q$4(!a||!a.__esModule?g(c,`default`,{value:a,enumerable:true}):c,a));
2
2
 
3
- var dt$3=v$1((lt,Be)=>{(function(s){if(typeof lt==`object`&&typeof Be<`u`)Be.exports=s();else if(typeof define==`function`&&define.amd)define([],s);else {var n;typeof window<`u`?n=window:typeof global<`u`?n=global:typeof self<`u`?n=self:n=this,n.localforage=s();}})(function(){return (function u(v,I,w){function R(T,B){if(!I[T]){if(!v[T]){var p=typeof t$1==`function`&&t$1;if(!B&&p)return p(T,true);if(b)return b(T,true);var _=new Error(`Cannot find module '`+T+`'`);throw _.code=`MODULE_NOT_FOUND`,_}var A=I[T]={exports:{}};v[T][0].call(A.exports,function(O){var j=v[T][1][O];return R(j||O)},A,A.exports,u,v,I,w);}return I[T].exports}for(var b=typeof t$1==`function`&&t$1,m=0;m<w.length;m++)R(w[m]);return R})({1:[function(u,v,I){(function(w){var R=w.MutationObserver||w.WebKitMutationObserver,b;if(R){var m=0,T=new R(O),B=w.document.createTextNode(``);T.observe(B,{characterData:true}),b=function(){B.data=m=++m%2;};}else if(!w.setImmediate&&typeof w.MessageChannel<`u`){var p=new w.MessageChannel;p.port1.onmessage=O,b=function(){p.port2.postMessage(0);};}else `document`in w&&`onreadystatechange`in w.document.createElement(`script`)?b=function(){var M=w.document.createElement(`script`);M.onreadystatechange=function(){O(),M.onreadystatechange=null,M.parentNode.removeChild(M),M=null;},w.document.documentElement.appendChild(M);}:b=function(){setTimeout(O,0);};var _,A=[];function O(){_=true;for(var M,z,F=A.length;F;){for(z=A,A=[],M=-1;++M<F;)z[M]();F=A.length;}_=false;}v.exports=j;function j(M){A.push(M)===1&&!_&&b();}}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{});},{}],2:[function(u,v,I){var w=u(1);function R(){}var b={},m=[`REJECTED`],T=[`FULFILLED`],B=[`PENDING`];v.exports=p;function p(y){if(typeof y!=`function`)throw new TypeError(`resolver must be a function`);this.state=B,this.queue=[],this.outcome=void 0,y!==R&&j(this,y);}p.prototype.catch=function(y){return this.then(null,y)},p.prototype.then=function(y,C){if(typeof y!=`function`&&this.state===T||typeof C!=`function`&&this.state===m)return this;var D=new this.constructor(R);if(this.state!==B)A(D,this.state===T?y:C,this.outcome);else this.queue.push(new _(D,y,C));return D};function _(y,C,D){this.promise=y,typeof C==`function`&&(this.onFulfilled=C,this.callFulfilled=this.otherCallFulfilled),typeof D==`function`&&(this.onRejected=D,this.callRejected=this.otherCallRejected);}_.prototype.callFulfilled=function(y){b.resolve(this.promise,y);},_.prototype.otherCallFulfilled=function(y){A(this.promise,this.onFulfilled,y);},_.prototype.callRejected=function(y){b.reject(this.promise,y);},_.prototype.otherCallRejected=function(y){A(this.promise,this.onRejected,y);};function A(y,C,D){w(function(){var L;try{L=C(D);}catch(k){return b.reject(y,k)}L===y?b.reject(y,new TypeError(`Cannot resolve promise with itself`)):b.resolve(y,L);});}b.resolve=function(y,C){var D=M(O,C);if(D.status===`error`)return b.reject(y,D.value);var L=D.value;if(L)j(y,L);else {y.state=T,y.outcome=C;for(var k=-1,U=y.queue.length;++k<U;)y.queue[k].callFulfilled(C);}return y},b.reject=function(y,C){y.state=m,y.outcome=C;for(var D=-1,L=y.queue.length;++D<L;)y.queue[D].callRejected(C);return y};function O(y){var C=y&&y.then;if(y&&(typeof y==`object`||typeof y==`function`)&&typeof C==`function`)return function(){C.apply(y,arguments);}}function j(y,C){var D=false;function L($){D||(D=true,b.reject(y,$));}function k($){D||(D=true,b.resolve(y,$));}function U(){C(k,L);}var H=M(U);H.status===`error`&&L(H.value);}function M(y,C){var D={};try{D.value=y(C),D.status=`success`;}catch(L){D.status=`error`,D.value=L;}return D}p.resolve=z;function z(y){return y instanceof this?y:b.resolve(new this(R),y)}p.reject=F;function F(y){var C=new this(R);return b.reject(C,y)}p.all=Ie;function Ie(y){var C=this;if(Object.prototype.toString.call(y)!==`[object Array]`)return this.reject(new TypeError(`must be an array`));var D=y.length,L=false;if(!D)return this.resolve([]);for(var k=new Array(D),U=0,H=-1,$=new this(R);++H<D;)K(y[H],H);return $;function K(oe,le){C.resolve(oe).then(Se,function(ee){L||(L=true,b.reject($,ee));});function Se(ee){k[le]=ee,++U===D&&!L&&(L=true,b.resolve($,k));}}}p.race=Z;function Z(y){var C=this;if(Object.prototype.toString.call(y)!==`[object Array]`)return this.reject(new TypeError(`must be an array`));var D=y.length,L=false;if(!D)return this.resolve([]);for(var k=-1,U=new this(R);++k<D;)H(y[k]);return U;function H($){C.resolve($).then(function(K){L||(L=true,b.resolve(U,K));},function(K){L||(L=true,b.reject(U,K));});}}},{1:1}],3:[function(u,v,I){(function(w){typeof w.Promise!=`function`&&(w.Promise=u(2));}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{});},{2:2}],4:[function(u,v,I){var w=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e};function R(e,r){if(!(e instanceof r))throw new TypeError(`Cannot call a class as a function`)}function b(){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 m=b();function T(){try{if(!m||!m.open)return !1;var e=typeof openDatabase<`u`&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),r=typeof fetch==`function`&&fetch.toString().indexOf(`[native code`)!==-1;return (!e||r)&&typeof indexedDB<`u`&&typeof IDBKeyRange<`u`}catch{return false}}function B(e,r){e=e||[],r=r||{};try{return new Blob(e,r)}catch(o){if(o.name!==`TypeError`)throw o;for(var i=new(typeof BlobBuilder<`u`?BlobBuilder:typeof MSBlobBuilder<`u`?MSBlobBuilder:typeof MozBlobBuilder<`u`?MozBlobBuilder:WebKitBlobBuilder),a=0;a<e.length;a+=1)i.append(e[a]);return i.getBlob(r.type)}}typeof Promise>`u`&&u(3);var p=Promise;function _(e,r){r&&e.then(function(t){r(null,t);},function(t){r(t);});}function A(e,r,t){typeof r==`function`&&e.then(r),typeof t==`function`&&e.catch(t);}function O(e){return typeof e!=`string`&&(console.warn(e+` used as a key, but it is not a string.`),e=String(e)),e}function j(){if(arguments.length&&typeof arguments[arguments.length-1]==`function`)return arguments[arguments.length-1]}var M=`local-forage-detect-blob-support`,z=void 0,F={},Ie=Object.prototype.toString,Z=`readonly`,y=`readwrite`;function C(e){for(var r=e.length,t=new ArrayBuffer(r),i=new Uint8Array(t),a=0;a<r;a++)i[a]=e.charCodeAt(a);return t}function D(e){return new p(function(r){var t=e.transaction(M,y),i=B([``]);t.objectStore(M).put(i,`key`),t.onabort=function(a){a.preventDefault(),a.stopPropagation(),r(false);},t.oncomplete=function(){var a=navigator.userAgent.match(/Chrome\/(\d+)/);r(navigator.userAgent.match(/Edge\//)||!a||parseInt(a[1],10)>=43);};}).catch(function(){return false})}function L(e){return typeof z==`boolean`?p.resolve(z):D(e).then(function(r){return z=r,z})}function k(e){var r=F[e.name],t={};t.promise=new p(function(i,a){t.resolve=i,t.reject=a;}),r.deferredOperations.push(t),r.dbReady?r.dbReady=r.dbReady.then(function(){return t.promise}):r.dbReady=t.promise;}function U(e){var t=F[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function H(e,r){var i=F[e.name].deferredOperations.pop();if(i)return i.reject(r),i.promise}function $(e,r){return new p(function(t,i){if(F[e.name]=F[e.name]||$e(),e.db)if(r)k(e),e.db.close();else return t(e.db);var a=[e.name];r&&a.push(e.version);var o=m.open.apply(m,a);r&&(o.onupgradeneeded=function(c){var f=o.result;try{f.createObjectStore(e.storeName),c.oldVersion<=1&&f.createObjectStore(M);}catch(l){if(l.name===`ConstraintError`)console.warn(`The database "`+e.name+`" has been upgraded from version `+c.oldVersion+` to version `+c.newVersion+`, but the storage "`+e.storeName+`" already exists.`);else throw l}}),o.onerror=function(c){c.preventDefault(),i(o.error);},o.onsuccess=function(){var c=o.result;c.onversionchange=function(f){f.target.close();},t(c),U(e);};})}function K(e){return $(e,false)}function oe(e){return $(e,true)}function le(e,r){if(!e.db)return true;var t=!e.db.objectStoreNames.contains(e.storeName),i=e.version<e.db.version,a=e.version>e.db.version;if(i&&(e.version!==r&&console.warn(`The database "`+e.name+`" can't be downgraded from version `+e.db.version+` to version `+e.version+`.`),e.version=e.db.version),a||t){if(t){var o=e.db.version+1;o>e.version&&(e.version=o);}return true}return false}function Se(e){return new p(function(r,t){var i=new FileReader;i.onerror=t,i.onloadend=function(a){r({__local_forage_encoded_blob:true,data:btoa(a.target.result||``),type:e.type});},i.readAsBinaryString(e);})}function ee(e){return B([C(atob(e.data))],{type:e.type})}function He(e){return e&&e.__local_forage_encoded_blob}function At(e){var r=this,t=r._initReady().then(function(){var i=F[r._dbInfo.name];if(i&&i.dbReady)return i.dbReady});return A(t,e,e),t}function Ct(e){k(e);for(var r=F[e.name],t=r.forages,i=0;i<t.length;i++){var a=t[i];a._dbInfo.db&&(a._dbInfo.db.close(),a._dbInfo.db=null);}return e.db=null,K(e).then(function(o){return e.db=o,le(e)?oe(e):o}).then(function(o){e.db=r.db=o;for(var c=0;c<t.length;c++)t[c]._dbInfo.db=o;}).catch(function(o){throw H(e,o),o})}function q(e,r,t,i){i===void 0&&(i=1);try{t(null,e.db.transaction(e.storeName,r));}catch(o){if(i>0&&(!e.db||o.name===`InvalidStateError`||o.name===`NotFoundError`))return p.resolve().then(function(){if(!e.db||o.name===`NotFoundError`&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),oe(e)}).then(function(){return Ct(e).then(function(){q(e,r,t,i-1);})}).catch(t);t(o);}}function $e(){return {forages:[],db:null,dbReady:null,deferredOperations:[]}}function Nt(e){var r=this,t={db:null};if(e)for(var i in e)t[i]=e[i];var a=F[t.name];a||(a=$e(),F[t.name]=a),a.forages.push(r),r._initReady||(r._initReady=r.ready,r.ready=At);var o=[];function c(){return p.resolve()}for(var f=0;f<a.forages.length;f++){var l=a.forages[f];l!==r&&o.push(l._initReady().catch(c));}var d=a.forages.slice(0);return p.all(o).then(function(){return t.db=a.db,K(t)}).then(function(g){return t.db=g,le(t,r._defaultConfig.version)?oe(t):g}).then(function(g){t.db=a.db=g,r._dbInfo=t;for(var E=0;E<d.length;E++){var S=d[E];S!==r&&(S._dbInfo.db=t.db,S._dbInfo.version=t.version);}})}function xt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){q(t._dbInfo,Z,function(c,f){if(c)return o(c);try{var d=f.objectStore(t._dbInfo.storeName).get(e);d.onsuccess=function(){var g=d.result;g===void 0&&(g=null),He(g)&&(g=ee(g)),a(g);},d.onerror=function(){o(d.error);};}catch(g){o(g);}});}).catch(o);});return _(i,r),i}function Lt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){q(t._dbInfo,Z,function(c,f){if(c)return o(c);try{var d=f.objectStore(t._dbInfo.storeName).openCursor(),g=1;d.onsuccess=function(){var E=d.result;if(E){var S=E.value;He(S)&&(S=ee(S));var N=e(S,E.key,g++);N!==void 0?a(N):E.continue();}else a();},d.onerror=function(){o(d.error);};}catch(E){o(E);}});}).catch(o);});return _(i,r),i}function Ot(e,r,t){var i=this;e=O(e);var a=new p(function(o,c){var f;i.ready().then(function(){return f=i._dbInfo,Ie.call(r)===`[object Blob]`?L(f.db).then(function(l){return l?r:Se(r)}):r}).then(function(l){q(i._dbInfo,y,function(d,g){if(d)return c(d);try{var E=g.objectStore(i._dbInfo.storeName);l===null&&(l=void 0);var S=E.put(l,e);g.oncomplete=function(){l===void 0&&(l=null),o(l);},g.onabort=g.onerror=function(){c(S.error?S.error:S.transaction.error);};}catch(N){c(N);}});}).catch(c);});return _(a,t),a}function Pt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){q(t._dbInfo,y,function(c,f){if(c)return o(c);try{var d=f.objectStore(t._dbInfo.storeName).delete(e);f.oncomplete=function(){a();},f.onerror=function(){o(d.error);},f.onabort=function(){o(d.error?d.error:d.transaction.error);};}catch(g){o(g);}});}).catch(o);});return _(i,r),i}function Bt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){q(r._dbInfo,y,function(o,c){if(o)return a(o);try{var l=c.objectStore(r._dbInfo.storeName).clear();c.oncomplete=function(){i();},c.onabort=c.onerror=function(){a(l.error?l.error:l.transaction.error);};}catch(d){a(d);}});}).catch(a);});return _(t,e),t}function Vt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){q(r._dbInfo,Z,function(o,c){if(o)return a(o);try{var l=c.objectStore(r._dbInfo.storeName).count();l.onsuccess=function(){i(l.result);},l.onerror=function(){a(l.error);};}catch(d){a(d);}});}).catch(a);});return _(t,e),t}function Mt(e,r){var t=this,i=new p(function(a,o){if(e<0){a(null);return}t.ready().then(function(){q(t._dbInfo,Z,function(c,f){if(c)return o(c);try{var l=f.objectStore(t._dbInfo.storeName),d=!1,g=l.openKeyCursor();g.onsuccess=function(){var E=g.result;if(!E){a(null);return}e===0||d?a(E.key):(d=!0,E.advance(e));},g.onerror=function(){o(g.error);};}catch(E){o(E);}});}).catch(o);});return _(i,r),i}function Ft(e){var r=this,t=new p(function(i,a){r.ready().then(function(){q(r._dbInfo,Z,function(o,c){if(o)return a(o);try{var l=c.objectStore(r._dbInfo.storeName).openKeyCursor(),d=[];l.onsuccess=function(){var g=l.result;if(!g){i(d);return}d.push(g.key),g.continue();},l.onerror=function(){a(l.error);};}catch(g){a(g);}});}).catch(a);});return _(t,e),t}function kt(e,r){r=j.apply(this,arguments);var t=this.config();e=typeof e!=`function`&&e||{},e.name||(e.name=e.name||t.name,e.storeName=e.storeName||t.storeName);var i=this,a;if(!e.name)a=p.reject(`Invalid arguments`);else {var c=e.name===t.name&&i._dbInfo.db?p.resolve(i._dbInfo.db):K(e).then(function(f){var l=F[e.name],d=l.forages;l.db=f;for(var g=0;g<d.length;g++)d[g]._dbInfo.db=f;return f});e.storeName?a=c.then(function(f){if(f.objectStoreNames.contains(e.storeName)){var l=f.version+1;k(e);var d=F[e.name],g=d.forages;f.close();for(var E=0;E<g.length;E++){var S=g[E];S._dbInfo.db=null,S._dbInfo.version=l;}return new p(function(x,V){var P=m.open(e.name,l);P.onerror=function(G){P.result.close(),V(G);},P.onupgradeneeded=function(){P.result.deleteObjectStore(e.storeName);},P.onsuccess=function(){var G=P.result;G.close(),x(G);};}).then(function(x){d.db=x;for(var V=0;V<g.length;V++){var P=g[V];P._dbInfo.db=x,U(P._dbInfo);}}).catch(function(x){throw (H(e,x)||p.resolve()).catch(function(){}),x})}}):a=c.then(function(f){k(e);var l=F[e.name],d=l.forages;f.close();for(var g=0;g<d.length;g++){var E=d[g];E._dbInfo.db=null;}return new p(function(N,x){var V=m.deleteDatabase(e.name);V.onerror=function(){var P=V.result;P&&P.close(),x(V.error);},V.onblocked=function(){console.warn(`dropInstance blocked for database "`+e.name+`" until all open connections are closed`);},V.onsuccess=function(){var P=V.result;P&&P.close(),N(P);};}).then(function(N){l.db=N;for(var x=0;x<d.length;x++){var V=d[x];U(V._dbInfo);}}).catch(function(N){throw (H(e,N)||p.resolve()).catch(function(){}),N})});}return _(a,r),a}var Ut={_driver:`asyncStorage`,_initStorage:Nt,_support:T(),iterate:Lt,getItem:xt,setItem:Ot,removeItem:Pt,clear:Bt,length:Vt,key:Mt,keys:Ft,dropInstance:kt};function Wt(){return typeof openDatabase==`function`}var X=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Ht=`~~local_forage_type~`,Ge=/^~~local_forage_type~([^~]+)~/,de=`__lfsc__:`,De=de.length,Re=`arbf`,Ae=`blob`,Ye=`si08`,je=`ui08`,ze=`uic8`,Ke=`si16`,qe=`si32`,Xe=`ur16`,Je=`ui32`,Qe=`fl32`,Ze=`fl64`,et=De+Re.length,tt=Object.prototype.toString;function rt(e){var r=e.length*.75,t=e.length,i,a=0,o,c,f,l;e[e.length-1]===`=`&&(r--,e[e.length-2]===`=`&&r--);var d=new ArrayBuffer(r),g=new Uint8Array(d);for(i=0;i<t;i+=4)o=X.indexOf(e[i]),c=X.indexOf(e[i+1]),f=X.indexOf(e[i+2]),l=X.indexOf(e[i+3]),g[a++]=o<<2|c>>4,g[a++]=(c&15)<<4|f>>2,g[a++]=(f&3)<<6|l&63;return d}function Ce(e){var r=new Uint8Array(e),t=``,i;for(i=0;i<r.length;i+=3)t+=X[r[i]>>2],t+=X[(r[i]&3)<<4|r[i+1]>>4],t+=X[(r[i+1]&15)<<2|r[i+2]>>6],t+=X[r[i+2]&63];return r.length%3===2?t=t.substring(0,t.length-1)+`=`:r.length%3===1&&(t=t.substring(0,t.length-2)+`==`),t}function $t(e,r){var t=``;if(e&&(t=tt.call(e)),e&&(t===`[object ArrayBuffer]`||e.buffer&&tt.call(e.buffer)===`[object ArrayBuffer]`)){var i,a=de;e instanceof ArrayBuffer?(i=e,a+=Re):(i=e.buffer,t===`[object Int8Array]`?a+=Ye:t===`[object Uint8Array]`?a+=je:t===`[object Uint8ClampedArray]`?a+=ze:t===`[object Int16Array]`?a+=Ke:t===`[object Uint16Array]`?a+=Xe:t===`[object Int32Array]`?a+=qe:t===`[object Uint32Array]`?a+=Je:t===`[object Float32Array]`?a+=Qe:t===`[object Float64Array]`?a+=Ze:r(new Error(`Failed to get type for BinaryArray`))),r(a+Ce(i));}else if(t===`[object Blob]`){var o=new FileReader;o.onload=function(){var c=Ht+e.type+`~`+Ce(this.result);r(de+Ae+c);},o.readAsArrayBuffer(e);}else try{r(JSON.stringify(e));}catch(c){console.error(`Couldn't convert value into a JSON string: `,e),r(null,c);}}function Gt(e){if(e.substring(0,De)!==de)return JSON.parse(e);var r=e.substring(et),t=e.substring(De,et),i;if(t===Ae&&Ge.test(r)){var a=r.match(Ge);i=a[1],r=r.substring(a[0].length);}var o=rt(r);switch(t){case Re:return o;case Ae:return B([o],{type:i});case Ye:return new Int8Array(o);case je:return new Uint8Array(o);case ze:return new Uint8ClampedArray(o);case Ke:return new Int16Array(o);case Xe:return new Uint16Array(o);case qe:return new Int32Array(o);case Je:return new Uint32Array(o);case Qe:return new Float32Array(o);case Ze:return new Float64Array(o);default:throw new Error(`Unkown type: `+t)}}var Ne={serialize:$t,deserialize:Gt,stringToBuffer:rt,bufferToString:Ce};function nt(e,r,t,i){e.executeSql(`CREATE TABLE IF NOT EXISTS `+r.storeName+` (id INTEGER PRIMARY KEY, key unique, value)`,[],t,i);}function Yt(e){var r=this,t={db:null};if(e)for(var i in e)t[i]=typeof e[i]!=`string`?e[i].toString():e[i];var a=new p(function(o,c){try{t.db=openDatabase(t.name,String(t.version),t.description,t.size);}catch(f){return c(f)}t.db.transaction(function(f){nt(f,t,function(){r._dbInfo=t,o();},function(l,d){c(d);});},c);});return t.serializer=Ne,a}function J(e,r,t,i,a,o){e.executeSql(t,i,a,function(c,f){f.code===f.SYNTAX_ERR?c.executeSql(`SELECT name FROM sqlite_master WHERE type='table' AND name = ?`,[r.storeName],function(l,d){d.rows.length?o(l,f):nt(l,r,function(){l.executeSql(t,i,a,o);},o);},o):o(c,f);},o);}function jt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){var c=t._dbInfo;c.db.transaction(function(f){J(f,c,`SELECT * FROM `+c.storeName+` WHERE key = ? LIMIT 1`,[e],function(l,d){var g=d.rows.length?d.rows.item(0).value:null;g&&(g=c.serializer.deserialize(g)),a(g);},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function zt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){var c=t._dbInfo;c.db.transaction(function(f){J(f,c,`SELECT * FROM `+c.storeName,[],function(l,d){for(var g=d.rows,E=g.length,S=0;S<E;S++){var N=g.item(S),x=N.value;if(x&&(x=c.serializer.deserialize(x)),x=e(x,N.key,S+1),x!==void 0){a(x);return}}a();},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function ot(e,r,t,i){var a=this;e=O(e);var o=new p(function(c,f){a.ready().then(function(){r===void 0&&(r=null);var l=r,d=a._dbInfo;d.serializer.serialize(r,function(g,E){E?f(E):d.db.transaction(function(S){J(S,d,`INSERT OR REPLACE INTO `+d.storeName+` (key, value) VALUES (?, ?)`,[e,g],function(){c(l);},function(N,x){f(x);});},function(S){if(S.code===S.QUOTA_ERR){if(i>0){c(ot.apply(a,[e,l,t,i-1]));return}f(S);}});});}).catch(f);});return _(o,t),o}function Kt(e,r,t){return ot.apply(this,[e,r,t,1])}function qt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){var c=t._dbInfo;c.db.transaction(function(f){J(f,c,`DELETE FROM `+c.storeName+` WHERE key = ?`,[e],function(){a();},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function Xt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(c){J(c,o,`DELETE FROM `+o.storeName,[],function(){i();},function(f,l){a(l);});});}).catch(a);});return _(t,e),t}function Jt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(c){J(c,o,`SELECT COUNT(key) as c FROM `+o.storeName,[],function(f,l){var d=l.rows.item(0).c;i(d);},function(f,l){a(l);});});}).catch(a);});return _(t,e),t}function Qt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){var c=t._dbInfo;c.db.transaction(function(f){J(f,c,`SELECT key FROM `+c.storeName+` WHERE id = ? LIMIT 1`,[e+1],function(l,d){a(d.rows.length?d.rows.item(0).key:null);},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function Zt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(c){J(c,o,`SELECT key FROM `+o.storeName,[],function(f,l){for(var d=[],g=0;g<l.rows.length;g++)d.push(l.rows.item(g).key);i(d);},function(f,l){a(l);});});}).catch(a);});return _(t,e),t}function er(e){return new p(function(r,t){e.transaction(function(i){i.executeSql(`SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'`,[],function(a,o){for(var c=[],f=0;f<o.rows.length;f++)c.push(o.rows.item(f).name);r({db:e,storeNames:c});},function(a,o){t(o);});},function(i){t(i);});})}function tr(e,r){r=j.apply(this,arguments);var t=this.config();e=typeof e!=`function`&&e||{},e.name||(e.name=e.name||t.name,e.storeName=e.storeName||t.storeName);var i=this,a;return e.name?a=new p(function(o){var c;e.name===t.name?c=i._dbInfo.db:c=openDatabase(e.name,``,``,0),e.storeName?o({db:c,storeNames:[e.storeName]}):o(er(c));}).then(function(o){return new p(function(c,f){o.db.transaction(function(l){function d(N){return new p(function(x,V){l.executeSql(`DROP TABLE IF EXISTS `+N,[],function(){x();},function(P,G){V(G);});})}for(var g=[],E=0,S=o.storeNames.length;E<S;E++)g.push(d(o.storeNames[E]));p.all(g).then(function(){c();}).catch(function(N){f(N);});},function(l){f(l);});})}):a=p.reject(`Invalid arguments`),_(a,r),a}var rr={_driver:`webSQLStorage`,_initStorage:Yt,_support:Wt(),iterate:zt,getItem:jt,setItem:Kt,removeItem:qt,clear:Xt,length:Jt,key:Qt,keys:Zt,dropInstance:tr};function nr(){try{return typeof localStorage<`u`&&`setItem`in localStorage&&!!localStorage.setItem}catch{return false}}function it(e,r){var t=e.name+`/`;return e.storeName!==r.storeName&&(t+=e.storeName+`/`),t}function or(){var e=`_localforage_support_test`;try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return true}}function ir(){return !or()||localStorage.length>0}function ar(e){var r=this,t={};if(e)for(var i in e)t[i]=e[i];return t.keyPrefix=it(e,r._defaultConfig),ir()?(r._dbInfo=t,t.serializer=Ne,p.resolve()):p.reject()}function sr(e){var r=this,t=r.ready().then(function(){for(var i=r._dbInfo.keyPrefix,a=localStorage.length-1;a>=0;a--){var o=localStorage.key(a);o.indexOf(i)===0&&localStorage.removeItem(o);}});return _(t,e),t}function ur(e,r){var t=this;e=O(e);var i=t.ready().then(function(){var a=t._dbInfo,o=localStorage.getItem(a.keyPrefix+e);return o&&(o=a.serializer.deserialize(o)),o});return _(i,r),i}function cr(e,r){var t=this,i=t.ready().then(function(){for(var a=t._dbInfo,o=a.keyPrefix,c=o.length,f=localStorage.length,l=1,d=0;d<f;d++){var g=localStorage.key(d);if(g.indexOf(o)===0){var E=localStorage.getItem(g);if(E&&(E=a.serializer.deserialize(E)),E=e(E,g.substring(c),l++),E!==void 0)return E}}});return _(i,r),i}function fr(e,r){var t=this,i=t.ready().then(function(){var a=t._dbInfo,o;try{o=localStorage.key(e);}catch{o=null;}return o&&(o=o.substring(a.keyPrefix.length)),o});return _(i,r),i}function lr(e){var r=this,t=r.ready().then(function(){for(var i=r._dbInfo,a=localStorage.length,o=[],c=0;c<a;c++){var f=localStorage.key(c);f.indexOf(i.keyPrefix)===0&&o.push(f.substring(i.keyPrefix.length));}return o});return _(t,e),t}function dr(e){var t=this.keys().then(function(i){return i.length});return _(t,e),t}function mr(e,r){var t=this;e=O(e);var i=t.ready().then(function(){var a=t._dbInfo;localStorage.removeItem(a.keyPrefix+e);});return _(i,r),i}function gr(e,r,t){var i=this;e=O(e);var a=i.ready().then(function(){r===void 0&&(r=null);var o=r;return new p(function(c,f){var l=i._dbInfo;l.serializer.serialize(r,function(d,g){if(g)f(g);else try{localStorage.setItem(l.keyPrefix+e,d),c(o);}catch(E){(E.name===`QuotaExceededError`||E.name===`NS_ERROR_DOM_QUOTA_REACHED`)&&f(E),f(E);}});})});return _(a,t),a}function pr(e,r){if(r=j.apply(this,arguments),e=typeof e!=`function`&&e||{},!e.name){var t=this.config();e.name=e.name||t.name,e.storeName=e.storeName||t.storeName;}var i=this,a;return e.name?a=new p(function(o){e.storeName?o(it(e,i._defaultConfig)):o(e.name+`/`);}).then(function(o){for(var c=localStorage.length-1;c>=0;c--){var f=localStorage.key(c);f.indexOf(o)===0&&localStorage.removeItem(f);}}):a=p.reject(`Invalid arguments`),_(a,r),a}var hr={_driver:`localStorageWrapper`,_initStorage:ar,_support:nr(),iterate:cr,getItem:ur,setItem:gr,removeItem:mr,clear:sr,length:dr,key:fr,keys:lr,dropInstance:pr},vr=function(r,t){return r===t||typeof r==`number`&&typeof t==`number`&&isNaN(r)&&isNaN(t)},yr=function(r,t){for(var i=r.length,a=0;a<i;){if(vr(r[a],t))return true;a++;}return false},at=Array.isArray||function(e){return Object.prototype.toString.call(e)===`[object Array]`},ie={},st={},te={INDEXEDDB:Ut,WEBSQL:rr,LOCALSTORAGE:hr},Er=[te.INDEXEDDB._driver,te.WEBSQL._driver,te.LOCALSTORAGE._driver],me=[`dropInstance`],xe=[`clear`,`getItem`,`iterate`,`key`,`keys`,`length`,`removeItem`,`setItem`].concat(me),_r={description:``,driver:Er.slice(),name:`localforage`,size:4980736,storeName:`keyvaluepairs`,version:1};function br(e,r){e[r]=function(){var t=arguments;return e.ready().then(function(){return e[r].apply(e,t)})};}function Le(){for(var e=1;e<arguments.length;e++){var r=arguments[e];if(r)for(var t in r)r.hasOwnProperty(t)&&(at(r[t])?arguments[0][t]=r[t].slice():arguments[0][t]=r[t]);}return arguments[0]}v.exports=new((function(){function e(r){R(this,e);for(var t in te)if(te.hasOwnProperty(t)){var i=te[t],a=i._driver;this[t]=a,ie[a]||this.defineDriver(i);}this._defaultConfig=Le({},_r),this._config=Le({},this._defaultConfig,r),this._driverSet=null,this._initDriver=null,this._ready=false,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){});}return e.prototype.config=function(t){if((typeof t>`u`?`undefined`:w(t))===`object`){if(this._ready)return new Error(`Can't call config() after localforage has been used.`);for(var i in t){if(i===`storeName`&&(t[i]=t[i].replace(/\W/g,`_`)),i===`version`&&typeof t[i]!=`number`)return new Error(`Database version must be a number.`);this._config[i]=t[i];}return `driver`in t&&t.driver?this.setDriver(this._config.driver):true}else return typeof t==`string`?this._config[t]:this._config},e.prototype.defineDriver=function(t,i,a){var o=new p(function(c,f){try{var l=t._driver,d=new Error(`Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver`);if(!t._driver){f(d);return}for(var g=xe.concat(`_initStorage`),E=0,S=g.length;E<S;E++){var N=g[E];if((!yr(me,N)||t[N])&&typeof t[N]!=`function`){f(d);return}}var V=function(){for(var ae=function(Sr){return function(){var Dr=new Error(`Method `+Sr+` is not implemented by the current driver`),ut=p.reject(Dr);return _(ut,arguments[arguments.length-1]),ut}},Oe=0,Ir=me.length;Oe<Ir;Oe++){var Pe=me[Oe];t[Pe]||(t[Pe]=ae(Pe));}};V();var P=function(ae){ie[l]&&console.info(`Redefining LocalForage driver: `+l),ie[l]=t,st[l]=ae,c();};`_support`in t?t._support&&typeof t._support==`function`?t._support().then(P,f):P(!!t._support):P(!0);}catch(G){f(G);}});return A(o,i,a),o},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(t,i,a){var o=ie[t]?p.resolve(ie[t]):p.reject(new Error(`Driver not found.`));return A(o,i,a),o},e.prototype.getSerializer=function(t){var i=p.resolve(Ne);return A(i,t),i},e.prototype.ready=function(t){var i=this,a=i._driverSet.then(function(){return i._ready===null&&(i._ready=i._initDriver()),i._ready});return A(a,t,t),a},e.prototype.setDriver=function(t,i,a){var o=this;at(t)||(t=[t]);var c=this._getSupportedDrivers(t);function f(){o._config.driver=o.driver();}function l(E){return o._extend(E),f(),o._ready=o._initStorage(o._config),o._ready}function d(E){return function(){var S=0;function N(){for(;S<E.length;){var x=E[S];return S++,o._dbInfo=null,o._ready=null,o.getDriver(x).then(l).catch(N)}f();var V=new Error(`No available storage method found.`);return o._driverSet=p.reject(V),o._driverSet}return N()}}return this._driverSet=(this._driverSet!==null?this._driverSet.catch(function(){return p.resolve()}):p.resolve()).then(function(){var E=c[0];return o._dbInfo=null,o._ready=null,o.getDriver(E).then(function(S){o._driver=S._driver,f(),o._wrapLibraryMethodsWithReady(),o._initDriver=d(c);})}).catch(function(){f();var E=new Error(`No available storage method found.`);return o._driverSet=p.reject(E),o._driverSet}),A(this._driverSet,i,a),this._driverSet},e.prototype.supports=function(t){return !!st[t]},e.prototype._extend=function(t){Le(this,t);},e.prototype._getSupportedDrivers=function(t){for(var i=[],a=0,o=t.length;a<o;a++){var c=t[a];this.supports(c)&&i.push(c);}return i},e.prototype._wrapLibraryMethodsWithReady=function(){for(var t=0,i=xe.length;t<i;t++)br(this,xe[t]);},e.prototype.createInstance=function(t){return new e(t)},e})());},{3:3}]},{},[4])(4)});});var Dt$2=v$1((St,we)=>{(function(s){var n={};n.VERSION=`1.6.1`;var h,u={},v=function(m,T){return function(){return T.apply(m,arguments)}},I=function(){var m=arguments,T=m[0],B,p;for(p=1;p<m.length;p++)for(B in m[p])!(B in T)&&m[p].hasOwnProperty(B)&&(T[B]=m[p][B]);return T},w=function(m,T){return {value:m,name:T}};n.TRACE=w(1,`TRACE`),n.DEBUG=w(2,`DEBUG`),n.INFO=w(3,`INFO`),n.TIME=w(4,`TIME`),n.WARN=w(5,`WARN`),n.ERROR=w(8,`ERROR`),n.OFF=w(99,`OFF`);var R=function(m){this.context=m,this.setLevel(m.filterLevel),this.log=this.info;};R.prototype={setLevel:function(m){m&&`value`in m&&(this.context.filterLevel=m);},getLevel:function(){return this.context.filterLevel},enabledFor:function(m){var T=this.context.filterLevel;return m.value>=T.value},trace:function(){this.invoke(n.TRACE,arguments);},debug:function(){this.invoke(n.DEBUG,arguments);},info:function(){this.invoke(n.INFO,arguments);},warn:function(){this.invoke(n.WARN,arguments);},error:function(){this.invoke(n.ERROR,arguments);},time:function(m){typeof m==`string`&&m.length>0&&this.invoke(n.TIME,[m,`start`]);},timeEnd:function(m){typeof m==`string`&&m.length>0&&this.invoke(n.TIME,[m,`end`]);},invoke:function(m,T){h&&this.enabledFor(m)&&h(T,I({level:m},this.context));}};var b=new R({filterLevel:n.OFF});((function(){var m=n;m.enabledFor=v(b,b.enabledFor),m.trace=v(b,b.trace),m.debug=v(b,b.debug),m.time=v(b,b.time),m.timeEnd=v(b,b.timeEnd),m.info=v(b,b.info),m.warn=v(b,b.warn),m.error=v(b,b.error),m.log=m.info;}))(),n.setHandler=function(m){h=m;},n.setLevel=function(m){b.setLevel(m);for(var T in u)u.hasOwnProperty(T)&&u[T].setLevel(m);},n.getLevel=function(){return b.getLevel()},n.get=function(m){return u[m]||(u[m]=new R(I({name:m},b.context)))},n.createDefaultHandler=function(m){m=m||{},m.formatter=m.formatter||function(_,A){A.name&&_.unshift(`[`+A.name+`]`);};var T={},B=function(p,_){Function.prototype.apply.call(p,console,_);};return typeof console>`u`?function(){}:function(p,_){p=Array.prototype.slice.call(p);var A=console.log,O;_.level===n.TIME?(O=(_.name?`[`+_.name+`] `:``)+p[0],p[1]===`start`?console.time?console.time(O):T[O]=new Date().getTime():console.timeEnd?console.timeEnd(O):B(A,[O+`: `+(new Date().getTime()-T[O])+`ms`])):(_.level===n.WARN&&console.warn?A=console.warn:_.level===n.ERROR&&console.error?A=console.error:_.level===n.INFO&&console.info?A=console.info:_.level===n.DEBUG&&console.debug?A=console.debug:_.level===n.TRACE&&console.trace&&(A=console.trace),m.formatter(p,_),B(A,p));}},n.useDefaults=function(m){n.setLevel(m&&m.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(m));},n.setDefaults=n.useDefaults,typeof define==`function`&&define.amd?define(n):typeof we<`u`&&we.exports?we.exports=n:(n._prevLogger=s.Logger,n.noConflict=function(){return s.Logger=n._prevLogger,n},s.Logger=n);})(St);});var Ve$3=x$3(dt$3());function ge$3(s){return Ve$3.default.createInstance({name:`lc`,storeName:s,driver:Ve$3.default.LOCALSTORAGE})}var re$5=class re{static storage;static async get(n,h){return await this.storage?.getItem(n)??h}static set(n,h){return this.storage?.setItem(n,h)}static remove(n){return this.storage?.removeItem(n)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}};var ce$5=class ce extends re$5{static storeName=`usr`;static visitorOldId=null;static{this.storage=ge$3(this.storeName);}static getVisitorId(){return localStorage.getItem(`lc/${this.storeName}/vid`)}};var Me$2=`14.8.4`;var Fe$4=(function(s){return s[s.WEB=3]=`WEB`,s.WEB_SDK=`WEB_SDK`,s.SHOPIFY_APP=`SHOPIFY_APP`,s.SHOPIFY_THEME_EXTENSION=`SHOPIFY_THEME_EXTENSION`,s})(Fe$4||{});var Cr$4=Me$2.split(`-`)[0].split(`.`).slice(0,3).map(s=>s.padStart(2,`0`)).join(``),Zr$3=Fe$4.WEB_SDK,mt$4=`CooeeSDK`,Q$3=Me$2,en=parseInt(Cr$4,10);var tn=[`collection`,`product`,`cart`],rn=[{identifier:`#flo-checkout-wrapper`,gateway:`Shopflow`},{identifier:`#fastrr-main-container`,gateway:`Shiprocket`},{identifier:`#gokwik-modal-wrapper`,gateway:`Gokwik`},{identifier:`#zecpe`,gateway:`Ecom 360`}],nn=[`View Item`,`View Cart`,`View Collection`],on=[`CE Screen View`,`View Collection`,`View Item`,`View Cart`],an=`https://cdn.jsdelivr.net/npm/swiper@11`;var gt$3=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${Q$3}/dist`,fe$3={apiURL:`https://api.sdk.letscooee.com`,cdnApiURL:`https://cdn.sdk1.api.letscooee.com`,debug:false,mode:`production`,baseURL:gt$3,styleURL:`${gt$3}/styles.min.css`};var pe$4=class pe{static ISO_WITHOUT_MS_REGEX=new RegExp(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/);static isObject(n){return typeof n==`object`&&!Array.isArray(n)&&n!==null}static parseToAny(n){try{return JSON.parse(n.toString())}catch{}return n.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(n.toString()):n}static async sleep(n){return new Promise(h=>setTimeout(h,n))}static hasKeys(n){return n?Object.keys(n).length>=1:false}static convertObjectToArray(n,h){return h.reduce((u,v)=>(n.hasOwnProperty(v)&&n[v]!=null&&u.push({[v]:n[v]}),u),[])}static removeNullUndefinedKeys(n){return Object.keys(n).reduce((h,u)=>(n[u]!==null&&n[u]!==void 0&&(h[u]=n[u]),h),{})}static stringify(n){return JSON.stringify(n,function(h,u){return u===void 0?null:u})}};var he$4=class he{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;checkoutProvider;widgetCustomisation;currency;static get(){return window.CooeeSDK.config}update(n){return n??={},this.gaEnabled=n.gaEnabled,this.gaMeasurementID=n.gaMeasurementID,this.pixelPush=n.pixelPush,this.website=n.website??{},this.currencyCount=n.currencyCount??0,this.money=n.money,this.currency=n.currency,this.storefrontToken=n.storefrontToken,this.skipItemAttribute=n.skipItemAttribute,this.checkoutProvider=n.checkoutProvider,this.widgetCustomisation=n.widgetCustomisation,this}};var ve$4=class ve extends re$5{static storeName=`ses`;static{this.storage=ge$3(this.storeName);}};var pt$3=5,Nr$4=500,ne$4=class ne extends Error{request;response;status;requestBody;responseText;constructor(n){super(n),this.name=`FetchError`,Object.setPrototypeOf(this,new.target.prototype);}is40x(){return !!this.response&&this.response.status>=400&&this.response.status<500}};async function pn(s,n){let h=Date.now(),u;try{u=await xr$4(s,n);}catch{}let v=u?new Request(u.url,{method:n?.method||`GET`}):new Request(s,n);if(!u||!u.ok){let m=`Failed to fetch`;u?.statusText&&(m+=`: ${u.statusText}`);let T=new ne$4(m);throw T.request=v,T.response=u?.clone(),T.status=u?.status,T.requestBody=n?.body,T.responseText=await ht$4(u),T}let I,w=(u.headers.get(`content-type`)||``).toLowerCase(),R=u.headers.get(`content-length`),b=n?.method?.toUpperCase()||`GET`;if(u.status===204||u.status===205||b===`HEAD`||R===`0`)I=void 0;else if(w.includes(`application/json`)||w.includes(`application/problem+json`)||w.includes(`text/javascript`))try{I=await u.clone().json();}catch(m){let T=new ne$4(`Failed to parse JSON response: ${m?.message}`);throw T.request=v,T.response=u.clone(),T.status=u.status,T.requestBody=n?.body,T.responseText=await ht$4(u),T}else w.includes(`text/`)||w.includes(`image/svg+xml`)?I=await u.text():I=await u.arrayBuffer();return {data:I,status:u.status,statusText:u.statusText,headers:u.headers,timeTakenMs:Date.now()-h,options:n,request:v}}async function xr$4(s,n){let h=null,u;for(let v=0;v<=pt$3;v++){try{if(u=await fetch(s,n),u.ok||u.status>=400&&u.status<500)return u;h=new Error(`Server error: ${u.status} ${u.statusText}`);}catch(I){h=I instanceof Error?I:new Error(String(I));}if(v<pt$3){let I=Math.pow(2,v)*Nr$4;Y$2.info(`Request to ${s} failed. Retrying in ${I}ms...`),await new Promise(w=>setTimeout(w,I));}}if(u&&!u.ok)return u;throw h||new Error(`Request failed after retries`)}async function ht$4(s){if(s){try{return s=s.clone(),await s.json()}catch{}try{return await s.text()}catch{}}}var ye$4={},Ee$5,_e$3,yt$2,Et$3,vt$3;async function _t$3(){if(!_e$3)return vt$3??=Lr$3(),vt$3}async function Lr$3(){let{BrowserClient:s,Scope:n,defaultStackParser:h,getDefaultIntegrations:u,makeFetchTransport:v}=await import('./esm-B-weSuzB-cvHcxwma.js');Et$3=n;_e$3=new s({dsn:`https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520`,transport:v,stackParser:h,integrations:u({}).filter(w=>![`BrowserApiErrors`,`Breadcrumbs`,`GlobalHandlers`].includes(w.name)),environment:fe$3.mode,release:`web-sdk@${Q$3}`,debug:fe$3.debug,sampleRate:.5}),_e$3.init();}function ke$1(s,n,h){Y$2.error(`${n}:`,s),_t$3().then(()=>{let u=bt$2(h);if(u.setTag(`operation`,n),s instanceof ne$4){Or$4(u,s,n);return}u.captureException(s);});}function Tn(s,n,h){_t$3().then(()=>{bt$2(h).captureMessage(s,n??`error`);});}function Or$4(s,n,h){if(Pr$4(s,n),n.response){let u=n.response,v=n.responseText;s.setTag(`error.message`,n.message),u.status!=null&&s.setTag(`http.status_code`,u.status),u.statusText&&s.setTag(`http.status_text`,u.statusText),v&&typeof v==`object`&&`error`in v&&(s.setTag(`http.error_code`,v.error.code),s.setTag(`http.error_message`,v.error.message)),s.setExtras({responseText:n.responseText,statusText:u.statusText,responseType:u.type,redirected:u.redirected,responseUrl:u.url,originalError:n.message}),s.captureMessage(`${h} failed with ${u.status}`,`error`);return}if(n.request){s.captureMessage(`No response was received for ${h}`,`error`);return}}function Pr$4(s,n){let h=n.request;if(!h)return;s.setExtras({body:n.requestBody,headers:h.headers,method:h.method,url:h.url});let u=h.headers?.get(`Cooee-Retry-Attempt`);u!==null&&s.setTag(`retry.attempt`,u);}function wn(s){yt$2=s;}function In$1(s,n){ye$4[s]=r$2(r$2({},ye$4[s]),n);}function Sn$1(s){Ee$5=r$2(r$2({},Ee$5),s);}function bt$2(s){s??={};let{extra:n,tags:h}=s,u=new Et$3;if(u.setClient(_e$3),u.setUser(yt$2),s.triggerContext&&!s.engagementTrigger&&(s.engagementTrigger=s.triggerContext.triggerData),s.engagementTrigger){let v=s.engagementTrigger;u.setTags({"engagement.id":v.engagementID,"engagement.short_id":v.shortID,"engagement.objective":v.objective,"engagement.delivery_type":v.onsiteDeliveryType,"engagement.content_id":v.contentID,"engagement.variation":v.variation,"engagement.currency":v.currency});}return n&&u.setExtras(n),h&&u.setTags(h),Ee$5&&u.setTags(Ee$5),Object.keys(ye$4).forEach(v=>{u.setContext(v,ye$4[v]);}),u.setTag(`language`,navigator.language),u.setTag(`timezone`,Tt$1()),Br$4(u),u}function Br$4(s){window.Shopify&&(s.setTag(`shopify.shop`,window.Shopify.shop),s.setTag(`shopify.currency`,window.Shopify.currency?.active),s.setTag(`shopify.locale`,window.Shopify.locale),s.setTag(`theme.schema_name`,window.Shopify.theme?.schema_name),s.setTag(`theme.schema_version`,window.Shopify.theme?.schema_version));}var be$4=class be{static format(n,h){return h.replace(/{{\s*(\w+)\s*}}/,(v,I)=>{switch(I){case `amount`:return this.formatWithDelimiters(n,2);case `amount_no_decimals`:return this.formatWithDelimiters(n,0);case `amount_with_comma_separator`:return this.formatWithDelimiters(n,2,`.`,`,`);case `amount_no_decimals_with_comma_separator`:return this.formatWithDelimiters(n,0,`.`,`,`);case `amount_with_apostrophe_separator`:return this.formatWithDelimiters(n,2,`'`,`.`);case `amount_no_decimals_with_space_separator`:return this.formatWithDelimiters(n,0,` `);case `amount_with_space_separator`:return this.formatWithDelimiters(n,2,` `,`,`);case `amount_with_period_and_space_separator`:return this.formatWithDelimiters(n,2,` `,`.`);default:return v}})}static formatWithDelimiters(n,h=2,u=`,`,v=`.`){if(isNaN(n)||n==null)return `0`;let w=(n/100).toFixed(h).split(`.`);return w[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,`$1`+u)+(w[1]?v+w[1]:``)}};function Cn(s){return `(\u23F0 took: ${Ue$1(s)})`}function Ue$1(s){if(s<0)return `${s}ms`;let n=new Date(Date.UTC(0,0,0,0,0,0,s)),h=[];return n.getUTCMinutes()&&h.push(n.getUTCMinutes()+`m`),n.getUTCSeconds()&&h.push(n.getUTCSeconds()+`s`),n.getUTCMilliseconds()&&h.push(n.getUTCMilliseconds()+`ms`),h.length||h.push(`0ms`),h.join(` `)}function We$4(){return window.CooeeSDK.runtimeData}function Ln$1(){return Ue$1(Date.now()-We$4().sdkLoadTime.getTime())}function $n$1(s){try{return new URL(s)}catch{return}}function Gn$1(s,n){let h=s.indexOf(n);return h===-1?false:(s.splice(h,1),true)}function Yn$1(s,n,h=true){return {[s]:Vr$4(n,h),[s+`_wo_currency`]:n}}function Vr$4(s,n=false){if(s==0&&n)return `Free`;let h=We$4(),u=he$4.get(),v=h.shopCurrencyCode||u.currency,I=h.currencyCode;I||Y$2.warn(`Currency code is not set in RuntimeData`);let w=u.money?.format??h.moneyFormat,R;if(w&&v===I&&!u.money?.auto)R=be$4.format(s*100,w);else {let b={style:`currency`,currency:I||v,minimumFractionDigits:2,maximumFractionDigits:2,trailingZeroDisplay:`stripIfInteger`},m;try{m=new Intl.NumberFormat(wt$2(),b);}catch(T){return ke$1(T,`format-currency`,{extra:{currentCurrency:I,shopCurrency:v}}),``}R=m.format(s),R=R.replace(`₹`,`Rs. `),u.money?.showCurrency&&I!==`INR`&&(R=R.concat(` ${I}`));}return R}function jn$1(s){let n=wt$2();try{return new Intl.NumberFormat(n,{notation:`compact`}).format(s)}catch(h){return ke$1(h,`format-number`,{extra:{lang:n,value:s}}),s.toString()}}function wt$2(){let s=`en`;return typeof navigator<`u`&&(navigator.languages!==void 0&&navigator.languages.length>0?s=navigator.languages[0]:navigator.language&&(s=navigator.language)),s=s.split(`;`)[0],s=s.split(`-`)[0],s||`en`}var Te$2;function Tt$1(){if(Te$2)return Te$2;try{return Te$2=Intl.DateTimeFormat().resolvedOptions().timeZone,Te$2}catch{return ``}}function It$2(s){document.readyState!==`loading`?s():document.addEventListener(`DOMContentLoaded`,s);}function zn$1(s){let n=document.createElement(`span`);n.id=`snackbar`,n.innerText=s,document.body.appendChild(n),n.className=`cooee-snackbar show`,setTimeout(()=>{n.classList.remove(`show`),document.body.removeChild(n);},5e3);}async function Mr$4(s,n=7,h=document){let u=1,v=document.querySelectorAll(`nonexistent-tag`);for(;u<=n;){let I=Math.min(50*2**u,1e3);if(u>1&&await pe$4.sleep(I),v=h.querySelectorAll(s),v.length)return Y$2.verbose(`Attempt ${u}: ${v.length} elements found with ${s}`),v;Y$2.verbose(`Attempt ${u}: Elements not found with ${s}. Will retry after ${I}ms.`),u++;}return Y$2.verbose(`\u26A0\uFE0F Max attempts reached. Element not found with ${s}.`),v}async function Kn$1(s,n=10,h=document){return (await Mr$4(s,n,h)).item(0)}async function Fr$1(s){let[n,h,u]=await Promise.all([ce$5.get(`did`),ve$4.get(`id`,``),ce$5.get(`sessionNumber`,1)]),v={letscooee_did:n,letscooee_sid:h,letscooee_sn:`${u}`,__letscooee_time:new Date().toLocaleString()};return s&&(v.__letscooee_via=s),v}async function qn$1(s){let n=await Fr$1(s);return Object.entries(n).map(([h,u])=>({key:h,value:u.toString()}))}function Xn$1(s,n,h,u=false){Object.defineProperty(s,n,{enumerable:false,configurable:false,writable:u,value:h});}function Jn$1(s){if(s%100>=11&&s%100<=13)return s+`th`;switch(s%10){case 1:return s+`st`;case 2:return s+`nd`;case 3:return s+`rd`;default:return s+`th`}}var W$2=x$3(Dt$2());var Y$2=class Y{static debuggerEl;static infoLogs=[];static log(...n){W$2.default.info(...n);}static verbose(...n){W$2.default.debug(...n);}static error(...n){W$2.default.error(...n);}static warn(...n){W$2.default.warn(...n);}static info(...n){W$2.default.info(...n),this.infoLogs.push({time:new Date,message:n.join(` `)}),this.addToDebugger();}static trace(...n){W$2.default.trace(...n);}static addToDebugger(){sessionStorage.cooeeDebug&&(this.debuggerEl=this.debuggerEl??document.querySelector(`cooee-debugger`),this.debuggerEl&&this.debuggerEl&&(this.debuggerEl.logs=[...this.infoLogs]));}};function ro$1(s=mt$4){W$2.default.useDefaults({formatter:function(n){n.unshift(`${s} (v${Q$3}):`);}}),kr$5()&&(localStorage.cooeeLogLevel=`TRACE`),localStorage.cooeeLogLevel?W$2.default.setLevel(W$2.default[localStorage.cooeeLogLevel]):W$2.default.setLevel(W$2.default.OFF);}function kr$5(){let s=Rt$3();return s===`1`||s===`on`}function Rt$3(){return new URL(location.href).searchParams?.get(`cooee-debug`)}function no$1(){let s=[`display: inline-block;`,`font-size: 14px;`,`background: linear-gradient(90deg, #d52dc8 25%, #2179e2 82%);`,`color: white;`,`padding: 4px;`,`border-radius: 4px;`].join(` `),n=`
3
+ var dt$3=v$1((lt,Be)=>{(function(s){if(typeof lt==`object`&&typeof Be<`u`)Be.exports=s();else if(typeof define==`function`&&define.amd)define([],s);else {var n;typeof window<`u`?n=window:typeof global<`u`?n=global:typeof self<`u`?n=self:n=this,n.localforage=s();}})(function(){return (function u(v,I,w){function R(T,B){if(!I[T]){if(!v[T]){var p=typeof t$1==`function`&&t$1;if(!B&&p)return p(T,true);if(b)return b(T,true);var _=new Error(`Cannot find module '`+T+`'`);throw _.code=`MODULE_NOT_FOUND`,_}var A=I[T]={exports:{}};v[T][0].call(A.exports,function(O){var j=v[T][1][O];return R(j||O)},A,A.exports,u,v,I,w);}return I[T].exports}for(var b=typeof t$1==`function`&&t$1,m=0;m<w.length;m++)R(w[m]);return R})({1:[function(u,v,I){(function(w){var R=w.MutationObserver||w.WebKitMutationObserver,b;if(R){var m=0,T=new R(O),B=w.document.createTextNode(``);T.observe(B,{characterData:true}),b=function(){B.data=m=++m%2;};}else if(!w.setImmediate&&typeof w.MessageChannel<`u`){var p=new w.MessageChannel;p.port1.onmessage=O,b=function(){p.port2.postMessage(0);};}else `document`in w&&`onreadystatechange`in w.document.createElement(`script`)?b=function(){var M=w.document.createElement(`script`);M.onreadystatechange=function(){O(),M.onreadystatechange=null,M.parentNode.removeChild(M),M=null;},w.document.documentElement.appendChild(M);}:b=function(){setTimeout(O,0);};var _,A=[];function O(){_=true;for(var M,z,F=A.length;F;){for(z=A,A=[],M=-1;++M<F;)z[M]();F=A.length;}_=false;}v.exports=j;function j(M){A.push(M)===1&&!_&&b();}}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{});},{}],2:[function(u,v,I){var w=u(1);function R(){}var b={},m=[`REJECTED`],T=[`FULFILLED`],B=[`PENDING`];v.exports=p;function p(y){if(typeof y!=`function`)throw new TypeError(`resolver must be a function`);this.state=B,this.queue=[],this.outcome=void 0,y!==R&&j(this,y);}p.prototype.catch=function(y){return this.then(null,y)},p.prototype.then=function(y,C){if(typeof y!=`function`&&this.state===T||typeof C!=`function`&&this.state===m)return this;var D=new this.constructor(R);if(this.state!==B)A(D,this.state===T?y:C,this.outcome);else this.queue.push(new _(D,y,C));return D};function _(y,C,D){this.promise=y,typeof C==`function`&&(this.onFulfilled=C,this.callFulfilled=this.otherCallFulfilled),typeof D==`function`&&(this.onRejected=D,this.callRejected=this.otherCallRejected);}_.prototype.callFulfilled=function(y){b.resolve(this.promise,y);},_.prototype.otherCallFulfilled=function(y){A(this.promise,this.onFulfilled,y);},_.prototype.callRejected=function(y){b.reject(this.promise,y);},_.prototype.otherCallRejected=function(y){A(this.promise,this.onRejected,y);};function A(y,C,D){w(function(){var L;try{L=C(D);}catch(k){return b.reject(y,k)}L===y?b.reject(y,new TypeError(`Cannot resolve promise with itself`)):b.resolve(y,L);});}b.resolve=function(y,C){var D=M(O,C);if(D.status===`error`)return b.reject(y,D.value);var L=D.value;if(L)j(y,L);else {y.state=T,y.outcome=C;for(var k=-1,U=y.queue.length;++k<U;)y.queue[k].callFulfilled(C);}return y},b.reject=function(y,C){y.state=m,y.outcome=C;for(var D=-1,L=y.queue.length;++D<L;)y.queue[D].callRejected(C);return y};function O(y){var C=y&&y.then;if(y&&(typeof y==`object`||typeof y==`function`)&&typeof C==`function`)return function(){C.apply(y,arguments);}}function j(y,C){var D=false;function L($){D||(D=true,b.reject(y,$));}function k($){D||(D=true,b.resolve(y,$));}function U(){C(k,L);}var H=M(U);H.status===`error`&&L(H.value);}function M(y,C){var D={};try{D.value=y(C),D.status=`success`;}catch(L){D.status=`error`,D.value=L;}return D}p.resolve=z;function z(y){return y instanceof this?y:b.resolve(new this(R),y)}p.reject=F;function F(y){var C=new this(R);return b.reject(C,y)}p.all=Ie;function Ie(y){var C=this;if(Object.prototype.toString.call(y)!==`[object Array]`)return this.reject(new TypeError(`must be an array`));var D=y.length,L=false;if(!D)return this.resolve([]);for(var k=new Array(D),U=0,H=-1,$=new this(R);++H<D;)K(y[H],H);return $;function K(oe,le){C.resolve(oe).then(Se,function(ee){L||(L=true,b.reject($,ee));});function Se(ee){k[le]=ee,++U===D&&!L&&(L=true,b.resolve($,k));}}}p.race=Z;function Z(y){var C=this;if(Object.prototype.toString.call(y)!==`[object Array]`)return this.reject(new TypeError(`must be an array`));var D=y.length,L=false;if(!D)return this.resolve([]);for(var k=-1,U=new this(R);++k<D;)H(y[k]);return U;function H($){C.resolve($).then(function(K){L||(L=true,b.resolve(U,K));},function(K){L||(L=true,b.reject(U,K));});}}},{1:1}],3:[function(u,v,I){(function(w){typeof w.Promise!=`function`&&(w.Promise=u(2));}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{});},{2:2}],4:[function(u,v,I){var w=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e};function R(e,r){if(!(e instanceof r))throw new TypeError(`Cannot call a class as a function`)}function b(){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 m=b();function T(){try{if(!m||!m.open)return !1;var e=typeof openDatabase<`u`&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),r=typeof fetch==`function`&&fetch.toString().indexOf(`[native code`)!==-1;return (!e||r)&&typeof indexedDB<`u`&&typeof IDBKeyRange<`u`}catch{return false}}function B(e,r){e=e||[],r=r||{};try{return new Blob(e,r)}catch(o){if(o.name!==`TypeError`)throw o;for(var i=new(typeof BlobBuilder<`u`?BlobBuilder:typeof MSBlobBuilder<`u`?MSBlobBuilder:typeof MozBlobBuilder<`u`?MozBlobBuilder:WebKitBlobBuilder),a=0;a<e.length;a+=1)i.append(e[a]);return i.getBlob(r.type)}}typeof Promise>`u`&&u(3);var p=Promise;function _(e,r){r&&e.then(function(t){r(null,t);},function(t){r(t);});}function A(e,r,t){typeof r==`function`&&e.then(r),typeof t==`function`&&e.catch(t);}function O(e){return typeof e!=`string`&&(console.warn(e+` used as a key, but it is not a string.`),e=String(e)),e}function j(){if(arguments.length&&typeof arguments[arguments.length-1]==`function`)return arguments[arguments.length-1]}var M=`local-forage-detect-blob-support`,z=void 0,F={},Ie=Object.prototype.toString,Z=`readonly`,y=`readwrite`;function C(e){for(var r=e.length,t=new ArrayBuffer(r),i=new Uint8Array(t),a=0;a<r;a++)i[a]=e.charCodeAt(a);return t}function D(e){return new p(function(r){var t=e.transaction(M,y),i=B([``]);t.objectStore(M).put(i,`key`),t.onabort=function(a){a.preventDefault(),a.stopPropagation(),r(false);},t.oncomplete=function(){var a=navigator.userAgent.match(/Chrome\/(\d+)/);r(navigator.userAgent.match(/Edge\//)||!a||parseInt(a[1],10)>=43);};}).catch(function(){return false})}function L(e){return typeof z==`boolean`?p.resolve(z):D(e).then(function(r){return z=r,z})}function k(e){var r=F[e.name],t={};t.promise=new p(function(i,a){t.resolve=i,t.reject=a;}),r.deferredOperations.push(t),r.dbReady?r.dbReady=r.dbReady.then(function(){return t.promise}):r.dbReady=t.promise;}function U(e){var t=F[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function H(e,r){var i=F[e.name].deferredOperations.pop();if(i)return i.reject(r),i.promise}function $(e,r){return new p(function(t,i){if(F[e.name]=F[e.name]||$e(),e.db)if(r)k(e),e.db.close();else return t(e.db);var a=[e.name];r&&a.push(e.version);var o=m.open.apply(m,a);r&&(o.onupgradeneeded=function(c){var f=o.result;try{f.createObjectStore(e.storeName),c.oldVersion<=1&&f.createObjectStore(M);}catch(l){if(l.name===`ConstraintError`)console.warn(`The database "`+e.name+`" has been upgraded from version `+c.oldVersion+` to version `+c.newVersion+`, but the storage "`+e.storeName+`" already exists.`);else throw l}}),o.onerror=function(c){c.preventDefault(),i(o.error);},o.onsuccess=function(){var c=o.result;c.onversionchange=function(f){f.target.close();},t(c),U(e);};})}function K(e){return $(e,false)}function oe(e){return $(e,true)}function le(e,r){if(!e.db)return true;var t=!e.db.objectStoreNames.contains(e.storeName),i=e.version<e.db.version,a=e.version>e.db.version;if(i&&(e.version!==r&&console.warn(`The database "`+e.name+`" can't be downgraded from version `+e.db.version+` to version `+e.version+`.`),e.version=e.db.version),a||t){if(t){var o=e.db.version+1;o>e.version&&(e.version=o);}return true}return false}function Se(e){return new p(function(r,t){var i=new FileReader;i.onerror=t,i.onloadend=function(a){r({__local_forage_encoded_blob:true,data:btoa(a.target.result||``),type:e.type});},i.readAsBinaryString(e);})}function ee(e){return B([C(atob(e.data))],{type:e.type})}function He(e){return e&&e.__local_forage_encoded_blob}function At(e){var r=this,t=r._initReady().then(function(){var i=F[r._dbInfo.name];if(i&&i.dbReady)return i.dbReady});return A(t,e,e),t}function Ct(e){k(e);for(var r=F[e.name],t=r.forages,i=0;i<t.length;i++){var a=t[i];a._dbInfo.db&&(a._dbInfo.db.close(),a._dbInfo.db=null);}return e.db=null,K(e).then(function(o){return e.db=o,le(e)?oe(e):o}).then(function(o){e.db=r.db=o;for(var c=0;c<t.length;c++)t[c]._dbInfo.db=o;}).catch(function(o){throw H(e,o),o})}function q(e,r,t,i){i===void 0&&(i=1);try{t(null,e.db.transaction(e.storeName,r));}catch(o){if(i>0&&(!e.db||o.name===`InvalidStateError`||o.name===`NotFoundError`))return p.resolve().then(function(){if(!e.db||o.name===`NotFoundError`&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),oe(e)}).then(function(){return Ct(e).then(function(){q(e,r,t,i-1);})}).catch(t);t(o);}}function $e(){return {forages:[],db:null,dbReady:null,deferredOperations:[]}}function Nt(e){var r=this,t={db:null};if(e)for(var i in e)t[i]=e[i];var a=F[t.name];a||(a=$e(),F[t.name]=a),a.forages.push(r),r._initReady||(r._initReady=r.ready,r.ready=At);var o=[];function c(){return p.resolve()}for(var f=0;f<a.forages.length;f++){var l=a.forages[f];l!==r&&o.push(l._initReady().catch(c));}var d=a.forages.slice(0);return p.all(o).then(function(){return t.db=a.db,K(t)}).then(function(g){return t.db=g,le(t,r._defaultConfig.version)?oe(t):g}).then(function(g){t.db=a.db=g,r._dbInfo=t;for(var E=0;E<d.length;E++){var S=d[E];S!==r&&(S._dbInfo.db=t.db,S._dbInfo.version=t.version);}})}function xt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){q(t._dbInfo,Z,function(c,f){if(c)return o(c);try{var d=f.objectStore(t._dbInfo.storeName).get(e);d.onsuccess=function(){var g=d.result;g===void 0&&(g=null),He(g)&&(g=ee(g)),a(g);},d.onerror=function(){o(d.error);};}catch(g){o(g);}});}).catch(o);});return _(i,r),i}function Lt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){q(t._dbInfo,Z,function(c,f){if(c)return o(c);try{var d=f.objectStore(t._dbInfo.storeName).openCursor(),g=1;d.onsuccess=function(){var E=d.result;if(E){var S=E.value;He(S)&&(S=ee(S));var N=e(S,E.key,g++);N!==void 0?a(N):E.continue();}else a();},d.onerror=function(){o(d.error);};}catch(E){o(E);}});}).catch(o);});return _(i,r),i}function Ot(e,r,t){var i=this;e=O(e);var a=new p(function(o,c){var f;i.ready().then(function(){return f=i._dbInfo,Ie.call(r)===`[object Blob]`?L(f.db).then(function(l){return l?r:Se(r)}):r}).then(function(l){q(i._dbInfo,y,function(d,g){if(d)return c(d);try{var E=g.objectStore(i._dbInfo.storeName);l===null&&(l=void 0);var S=E.put(l,e);g.oncomplete=function(){l===void 0&&(l=null),o(l);},g.onabort=g.onerror=function(){c(S.error?S.error:S.transaction.error);};}catch(N){c(N);}});}).catch(c);});return _(a,t),a}function Pt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){q(t._dbInfo,y,function(c,f){if(c)return o(c);try{var d=f.objectStore(t._dbInfo.storeName).delete(e);f.oncomplete=function(){a();},f.onerror=function(){o(d.error);},f.onabort=function(){o(d.error?d.error:d.transaction.error);};}catch(g){o(g);}});}).catch(o);});return _(i,r),i}function Bt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){q(r._dbInfo,y,function(o,c){if(o)return a(o);try{var l=c.objectStore(r._dbInfo.storeName).clear();c.oncomplete=function(){i();},c.onabort=c.onerror=function(){a(l.error?l.error:l.transaction.error);};}catch(d){a(d);}});}).catch(a);});return _(t,e),t}function Vt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){q(r._dbInfo,Z,function(o,c){if(o)return a(o);try{var l=c.objectStore(r._dbInfo.storeName).count();l.onsuccess=function(){i(l.result);},l.onerror=function(){a(l.error);};}catch(d){a(d);}});}).catch(a);});return _(t,e),t}function Mt(e,r){var t=this,i=new p(function(a,o){if(e<0){a(null);return}t.ready().then(function(){q(t._dbInfo,Z,function(c,f){if(c)return o(c);try{var l=f.objectStore(t._dbInfo.storeName),d=!1,g=l.openKeyCursor();g.onsuccess=function(){var E=g.result;if(!E){a(null);return}e===0||d?a(E.key):(d=!0,E.advance(e));},g.onerror=function(){o(g.error);};}catch(E){o(E);}});}).catch(o);});return _(i,r),i}function Ft(e){var r=this,t=new p(function(i,a){r.ready().then(function(){q(r._dbInfo,Z,function(o,c){if(o)return a(o);try{var l=c.objectStore(r._dbInfo.storeName).openKeyCursor(),d=[];l.onsuccess=function(){var g=l.result;if(!g){i(d);return}d.push(g.key),g.continue();},l.onerror=function(){a(l.error);};}catch(g){a(g);}});}).catch(a);});return _(t,e),t}function kt(e,r){r=j.apply(this,arguments);var t=this.config();e=typeof e!=`function`&&e||{},e.name||(e.name=e.name||t.name,e.storeName=e.storeName||t.storeName);var i=this,a;if(!e.name)a=p.reject(`Invalid arguments`);else {var c=e.name===t.name&&i._dbInfo.db?p.resolve(i._dbInfo.db):K(e).then(function(f){var l=F[e.name],d=l.forages;l.db=f;for(var g=0;g<d.length;g++)d[g]._dbInfo.db=f;return f});e.storeName?a=c.then(function(f){if(f.objectStoreNames.contains(e.storeName)){var l=f.version+1;k(e);var d=F[e.name],g=d.forages;f.close();for(var E=0;E<g.length;E++){var S=g[E];S._dbInfo.db=null,S._dbInfo.version=l;}return new p(function(x,V){var P=m.open(e.name,l);P.onerror=function(G){P.result.close(),V(G);},P.onupgradeneeded=function(){P.result.deleteObjectStore(e.storeName);},P.onsuccess=function(){var G=P.result;G.close(),x(G);};}).then(function(x){d.db=x;for(var V=0;V<g.length;V++){var P=g[V];P._dbInfo.db=x,U(P._dbInfo);}}).catch(function(x){throw (H(e,x)||p.resolve()).catch(function(){}),x})}}):a=c.then(function(f){k(e);var l=F[e.name],d=l.forages;f.close();for(var g=0;g<d.length;g++){var E=d[g];E._dbInfo.db=null;}return new p(function(N,x){var V=m.deleteDatabase(e.name);V.onerror=function(){var P=V.result;P&&P.close(),x(V.error);},V.onblocked=function(){console.warn(`dropInstance blocked for database "`+e.name+`" until all open connections are closed`);},V.onsuccess=function(){var P=V.result;P&&P.close(),N(P);};}).then(function(N){l.db=N;for(var x=0;x<d.length;x++){var V=d[x];U(V._dbInfo);}}).catch(function(N){throw (H(e,N)||p.resolve()).catch(function(){}),N})});}return _(a,r),a}var Ut={_driver:`asyncStorage`,_initStorage:Nt,_support:T(),iterate:Lt,getItem:xt,setItem:Ot,removeItem:Pt,clear:Bt,length:Vt,key:Mt,keys:Ft,dropInstance:kt};function Wt(){return typeof openDatabase==`function`}var X=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Ht=`~~local_forage_type~`,Ge=/^~~local_forage_type~([^~]+)~/,de=`__lfsc__:`,De=de.length,Re=`arbf`,Ae=`blob`,Ye=`si08`,je=`ui08`,ze=`uic8`,Ke=`si16`,qe=`si32`,Xe=`ur16`,Je=`ui32`,Qe=`fl32`,Ze=`fl64`,et=De+Re.length,tt=Object.prototype.toString;function rt(e){var r=e.length*.75,t=e.length,i,a=0,o,c,f,l;e[e.length-1]===`=`&&(r--,e[e.length-2]===`=`&&r--);var d=new ArrayBuffer(r),g=new Uint8Array(d);for(i=0;i<t;i+=4)o=X.indexOf(e[i]),c=X.indexOf(e[i+1]),f=X.indexOf(e[i+2]),l=X.indexOf(e[i+3]),g[a++]=o<<2|c>>4,g[a++]=(c&15)<<4|f>>2,g[a++]=(f&3)<<6|l&63;return d}function Ce(e){var r=new Uint8Array(e),t=``,i;for(i=0;i<r.length;i+=3)t+=X[r[i]>>2],t+=X[(r[i]&3)<<4|r[i+1]>>4],t+=X[(r[i+1]&15)<<2|r[i+2]>>6],t+=X[r[i+2]&63];return r.length%3===2?t=t.substring(0,t.length-1)+`=`:r.length%3===1&&(t=t.substring(0,t.length-2)+`==`),t}function $t(e,r){var t=``;if(e&&(t=tt.call(e)),e&&(t===`[object ArrayBuffer]`||e.buffer&&tt.call(e.buffer)===`[object ArrayBuffer]`)){var i,a=de;e instanceof ArrayBuffer?(i=e,a+=Re):(i=e.buffer,t===`[object Int8Array]`?a+=Ye:t===`[object Uint8Array]`?a+=je:t===`[object Uint8ClampedArray]`?a+=ze:t===`[object Int16Array]`?a+=Ke:t===`[object Uint16Array]`?a+=Xe:t===`[object Int32Array]`?a+=qe:t===`[object Uint32Array]`?a+=Je:t===`[object Float32Array]`?a+=Qe:t===`[object Float64Array]`?a+=Ze:r(new Error(`Failed to get type for BinaryArray`))),r(a+Ce(i));}else if(t===`[object Blob]`){var o=new FileReader;o.onload=function(){var c=Ht+e.type+`~`+Ce(this.result);r(de+Ae+c);},o.readAsArrayBuffer(e);}else try{r(JSON.stringify(e));}catch(c){console.error(`Couldn't convert value into a JSON string: `,e),r(null,c);}}function Gt(e){if(e.substring(0,De)!==de)return JSON.parse(e);var r=e.substring(et),t=e.substring(De,et),i;if(t===Ae&&Ge.test(r)){var a=r.match(Ge);i=a[1],r=r.substring(a[0].length);}var o=rt(r);switch(t){case Re:return o;case Ae:return B([o],{type:i});case Ye:return new Int8Array(o);case je:return new Uint8Array(o);case ze:return new Uint8ClampedArray(o);case Ke:return new Int16Array(o);case Xe:return new Uint16Array(o);case qe:return new Int32Array(o);case Je:return new Uint32Array(o);case Qe:return new Float32Array(o);case Ze:return new Float64Array(o);default:throw new Error(`Unkown type: `+t)}}var Ne={serialize:$t,deserialize:Gt,stringToBuffer:rt,bufferToString:Ce};function nt(e,r,t,i){e.executeSql(`CREATE TABLE IF NOT EXISTS `+r.storeName+` (id INTEGER PRIMARY KEY, key unique, value)`,[],t,i);}function Yt(e){var r=this,t={db:null};if(e)for(var i in e)t[i]=typeof e[i]!=`string`?e[i].toString():e[i];var a=new p(function(o,c){try{t.db=openDatabase(t.name,String(t.version),t.description,t.size);}catch(f){return c(f)}t.db.transaction(function(f){nt(f,t,function(){r._dbInfo=t,o();},function(l,d){c(d);});},c);});return t.serializer=Ne,a}function J(e,r,t,i,a,o){e.executeSql(t,i,a,function(c,f){f.code===f.SYNTAX_ERR?c.executeSql(`SELECT name FROM sqlite_master WHERE type='table' AND name = ?`,[r.storeName],function(l,d){d.rows.length?o(l,f):nt(l,r,function(){l.executeSql(t,i,a,o);},o);},o):o(c,f);},o);}function jt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){var c=t._dbInfo;c.db.transaction(function(f){J(f,c,`SELECT * FROM `+c.storeName+` WHERE key = ? LIMIT 1`,[e],function(l,d){var g=d.rows.length?d.rows.item(0).value:null;g&&(g=c.serializer.deserialize(g)),a(g);},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function zt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){var c=t._dbInfo;c.db.transaction(function(f){J(f,c,`SELECT * FROM `+c.storeName,[],function(l,d){for(var g=d.rows,E=g.length,S=0;S<E;S++){var N=g.item(S),x=N.value;if(x&&(x=c.serializer.deserialize(x)),x=e(x,N.key,S+1),x!==void 0){a(x);return}}a();},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function ot(e,r,t,i){var a=this;e=O(e);var o=new p(function(c,f){a.ready().then(function(){r===void 0&&(r=null);var l=r,d=a._dbInfo;d.serializer.serialize(r,function(g,E){E?f(E):d.db.transaction(function(S){J(S,d,`INSERT OR REPLACE INTO `+d.storeName+` (key, value) VALUES (?, ?)`,[e,g],function(){c(l);},function(N,x){f(x);});},function(S){if(S.code===S.QUOTA_ERR){if(i>0){c(ot.apply(a,[e,l,t,i-1]));return}f(S);}});});}).catch(f);});return _(o,t),o}function Kt(e,r,t){return ot.apply(this,[e,r,t,1])}function qt(e,r){var t=this;e=O(e);var i=new p(function(a,o){t.ready().then(function(){var c=t._dbInfo;c.db.transaction(function(f){J(f,c,`DELETE FROM `+c.storeName+` WHERE key = ?`,[e],function(){a();},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function Xt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(c){J(c,o,`DELETE FROM `+o.storeName,[],function(){i();},function(f,l){a(l);});});}).catch(a);});return _(t,e),t}function Jt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(c){J(c,o,`SELECT COUNT(key) as c FROM `+o.storeName,[],function(f,l){var d=l.rows.item(0).c;i(d);},function(f,l){a(l);});});}).catch(a);});return _(t,e),t}function Qt(e,r){var t=this,i=new p(function(a,o){t.ready().then(function(){var c=t._dbInfo;c.db.transaction(function(f){J(f,c,`SELECT key FROM `+c.storeName+` WHERE id = ? LIMIT 1`,[e+1],function(l,d){a(d.rows.length?d.rows.item(0).key:null);},function(l,d){o(d);});});}).catch(o);});return _(i,r),i}function Zt(e){var r=this,t=new p(function(i,a){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(c){J(c,o,`SELECT key FROM `+o.storeName,[],function(f,l){for(var d=[],g=0;g<l.rows.length;g++)d.push(l.rows.item(g).key);i(d);},function(f,l){a(l);});});}).catch(a);});return _(t,e),t}function er(e){return new p(function(r,t){e.transaction(function(i){i.executeSql(`SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'`,[],function(a,o){for(var c=[],f=0;f<o.rows.length;f++)c.push(o.rows.item(f).name);r({db:e,storeNames:c});},function(a,o){t(o);});},function(i){t(i);});})}function tr(e,r){r=j.apply(this,arguments);var t=this.config();e=typeof e!=`function`&&e||{},e.name||(e.name=e.name||t.name,e.storeName=e.storeName||t.storeName);var i=this,a;return e.name?a=new p(function(o){var c;e.name===t.name?c=i._dbInfo.db:c=openDatabase(e.name,``,``,0),e.storeName?o({db:c,storeNames:[e.storeName]}):o(er(c));}).then(function(o){return new p(function(c,f){o.db.transaction(function(l){function d(N){return new p(function(x,V){l.executeSql(`DROP TABLE IF EXISTS `+N,[],function(){x();},function(P,G){V(G);});})}for(var g=[],E=0,S=o.storeNames.length;E<S;E++)g.push(d(o.storeNames[E]));p.all(g).then(function(){c();}).catch(function(N){f(N);});},function(l){f(l);});})}):a=p.reject(`Invalid arguments`),_(a,r),a}var rr={_driver:`webSQLStorage`,_initStorage:Yt,_support:Wt(),iterate:zt,getItem:jt,setItem:Kt,removeItem:qt,clear:Xt,length:Jt,key:Qt,keys:Zt,dropInstance:tr};function nr(){try{return typeof localStorage<`u`&&`setItem`in localStorage&&!!localStorage.setItem}catch{return false}}function it(e,r){var t=e.name+`/`;return e.storeName!==r.storeName&&(t+=e.storeName+`/`),t}function or(){var e=`_localforage_support_test`;try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch{return true}}function ir(){return !or()||localStorage.length>0}function ar(e){var r=this,t={};if(e)for(var i in e)t[i]=e[i];return t.keyPrefix=it(e,r._defaultConfig),ir()?(r._dbInfo=t,t.serializer=Ne,p.resolve()):p.reject()}function sr(e){var r=this,t=r.ready().then(function(){for(var i=r._dbInfo.keyPrefix,a=localStorage.length-1;a>=0;a--){var o=localStorage.key(a);o.indexOf(i)===0&&localStorage.removeItem(o);}});return _(t,e),t}function ur(e,r){var t=this;e=O(e);var i=t.ready().then(function(){var a=t._dbInfo,o=localStorage.getItem(a.keyPrefix+e);return o&&(o=a.serializer.deserialize(o)),o});return _(i,r),i}function cr(e,r){var t=this,i=t.ready().then(function(){for(var a=t._dbInfo,o=a.keyPrefix,c=o.length,f=localStorage.length,l=1,d=0;d<f;d++){var g=localStorage.key(d);if(g.indexOf(o)===0){var E=localStorage.getItem(g);if(E&&(E=a.serializer.deserialize(E)),E=e(E,g.substring(c),l++),E!==void 0)return E}}});return _(i,r),i}function fr(e,r){var t=this,i=t.ready().then(function(){var a=t._dbInfo,o;try{o=localStorage.key(e);}catch{o=null;}return o&&(o=o.substring(a.keyPrefix.length)),o});return _(i,r),i}function lr(e){var r=this,t=r.ready().then(function(){for(var i=r._dbInfo,a=localStorage.length,o=[],c=0;c<a;c++){var f=localStorage.key(c);f.indexOf(i.keyPrefix)===0&&o.push(f.substring(i.keyPrefix.length));}return o});return _(t,e),t}function dr(e){var t=this.keys().then(function(i){return i.length});return _(t,e),t}function mr(e,r){var t=this;e=O(e);var i=t.ready().then(function(){var a=t._dbInfo;localStorage.removeItem(a.keyPrefix+e);});return _(i,r),i}function gr(e,r,t){var i=this;e=O(e);var a=i.ready().then(function(){r===void 0&&(r=null);var o=r;return new p(function(c,f){var l=i._dbInfo;l.serializer.serialize(r,function(d,g){if(g)f(g);else try{localStorage.setItem(l.keyPrefix+e,d),c(o);}catch(E){(E.name===`QuotaExceededError`||E.name===`NS_ERROR_DOM_QUOTA_REACHED`)&&f(E),f(E);}});})});return _(a,t),a}function pr(e,r){if(r=j.apply(this,arguments),e=typeof e!=`function`&&e||{},!e.name){var t=this.config();e.name=e.name||t.name,e.storeName=e.storeName||t.storeName;}var i=this,a;return e.name?a=new p(function(o){e.storeName?o(it(e,i._defaultConfig)):o(e.name+`/`);}).then(function(o){for(var c=localStorage.length-1;c>=0;c--){var f=localStorage.key(c);f.indexOf(o)===0&&localStorage.removeItem(f);}}):a=p.reject(`Invalid arguments`),_(a,r),a}var hr={_driver:`localStorageWrapper`,_initStorage:ar,_support:nr(),iterate:cr,getItem:ur,setItem:gr,removeItem:mr,clear:sr,length:dr,key:fr,keys:lr,dropInstance:pr},vr=function(r,t){return r===t||typeof r==`number`&&typeof t==`number`&&isNaN(r)&&isNaN(t)},yr=function(r,t){for(var i=r.length,a=0;a<i;){if(vr(r[a],t))return true;a++;}return false},at=Array.isArray||function(e){return Object.prototype.toString.call(e)===`[object Array]`},ie={},st={},te={INDEXEDDB:Ut,WEBSQL:rr,LOCALSTORAGE:hr},Er=[te.INDEXEDDB._driver,te.WEBSQL._driver,te.LOCALSTORAGE._driver],me=[`dropInstance`],xe=[`clear`,`getItem`,`iterate`,`key`,`keys`,`length`,`removeItem`,`setItem`].concat(me),_r={description:``,driver:Er.slice(),name:`localforage`,size:4980736,storeName:`keyvaluepairs`,version:1};function br(e,r){e[r]=function(){var t=arguments;return e.ready().then(function(){return e[r].apply(e,t)})};}function Le(){for(var e=1;e<arguments.length;e++){var r=arguments[e];if(r)for(var t in r)r.hasOwnProperty(t)&&(at(r[t])?arguments[0][t]=r[t].slice():arguments[0][t]=r[t]);}return arguments[0]}v.exports=new((function(){function e(r){R(this,e);for(var t in te)if(te.hasOwnProperty(t)){var i=te[t],a=i._driver;this[t]=a,ie[a]||this.defineDriver(i);}this._defaultConfig=Le({},_r),this._config=Le({},this._defaultConfig,r),this._driverSet=null,this._initDriver=null,this._ready=false,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){});}return e.prototype.config=function(t){if((typeof t>`u`?`undefined`:w(t))===`object`){if(this._ready)return new Error(`Can't call config() after localforage has been used.`);for(var i in t){if(i===`storeName`&&(t[i]=t[i].replace(/\W/g,`_`)),i===`version`&&typeof t[i]!=`number`)return new Error(`Database version must be a number.`);this._config[i]=t[i];}return `driver`in t&&t.driver?this.setDriver(this._config.driver):true}else return typeof t==`string`?this._config[t]:this._config},e.prototype.defineDriver=function(t,i,a){var o=new p(function(c,f){try{var l=t._driver,d=new Error(`Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver`);if(!t._driver){f(d);return}for(var g=xe.concat(`_initStorage`),E=0,S=g.length;E<S;E++){var N=g[E];if((!yr(me,N)||t[N])&&typeof t[N]!=`function`){f(d);return}}var V=function(){for(var ae=function(Sr){return function(){var Dr=new Error(`Method `+Sr+` is not implemented by the current driver`),ut=p.reject(Dr);return _(ut,arguments[arguments.length-1]),ut}},Oe=0,Ir=me.length;Oe<Ir;Oe++){var Pe=me[Oe];t[Pe]||(t[Pe]=ae(Pe));}};V();var P=function(ae){ie[l]&&console.info(`Redefining LocalForage driver: `+l),ie[l]=t,st[l]=ae,c();};`_support`in t?t._support&&typeof t._support==`function`?t._support().then(P,f):P(!!t._support):P(!0);}catch(G){f(G);}});return A(o,i,a),o},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(t,i,a){var o=ie[t]?p.resolve(ie[t]):p.reject(new Error(`Driver not found.`));return A(o,i,a),o},e.prototype.getSerializer=function(t){var i=p.resolve(Ne);return A(i,t),i},e.prototype.ready=function(t){var i=this,a=i._driverSet.then(function(){return i._ready===null&&(i._ready=i._initDriver()),i._ready});return A(a,t,t),a},e.prototype.setDriver=function(t,i,a){var o=this;at(t)||(t=[t]);var c=this._getSupportedDrivers(t);function f(){o._config.driver=o.driver();}function l(E){return o._extend(E),f(),o._ready=o._initStorage(o._config),o._ready}function d(E){return function(){var S=0;function N(){for(;S<E.length;){var x=E[S];return S++,o._dbInfo=null,o._ready=null,o.getDriver(x).then(l).catch(N)}f();var V=new Error(`No available storage method found.`);return o._driverSet=p.reject(V),o._driverSet}return N()}}return this._driverSet=(this._driverSet!==null?this._driverSet.catch(function(){return p.resolve()}):p.resolve()).then(function(){var E=c[0];return o._dbInfo=null,o._ready=null,o.getDriver(E).then(function(S){o._driver=S._driver,f(),o._wrapLibraryMethodsWithReady(),o._initDriver=d(c);})}).catch(function(){f();var E=new Error(`No available storage method found.`);return o._driverSet=p.reject(E),o._driverSet}),A(this._driverSet,i,a),this._driverSet},e.prototype.supports=function(t){return !!st[t]},e.prototype._extend=function(t){Le(this,t);},e.prototype._getSupportedDrivers=function(t){for(var i=[],a=0,o=t.length;a<o;a++){var c=t[a];this.supports(c)&&i.push(c);}return i},e.prototype._wrapLibraryMethodsWithReady=function(){for(var t=0,i=xe.length;t<i;t++)br(this,xe[t]);},e.prototype.createInstance=function(t){return new e(t)},e})());},{3:3}]},{},[4])(4)});});var Dt$2=v$1((St,we)=>{(function(s){var n={};n.VERSION=`1.6.1`;var h,u={},v=function(m,T){return function(){return T.apply(m,arguments)}},I=function(){var m=arguments,T=m[0],B,p;for(p=1;p<m.length;p++)for(B in m[p])!(B in T)&&m[p].hasOwnProperty(B)&&(T[B]=m[p][B]);return T},w=function(m,T){return {value:m,name:T}};n.TRACE=w(1,`TRACE`),n.DEBUG=w(2,`DEBUG`),n.INFO=w(3,`INFO`),n.TIME=w(4,`TIME`),n.WARN=w(5,`WARN`),n.ERROR=w(8,`ERROR`),n.OFF=w(99,`OFF`);var R=function(m){this.context=m,this.setLevel(m.filterLevel),this.log=this.info;};R.prototype={setLevel:function(m){m&&`value`in m&&(this.context.filterLevel=m);},getLevel:function(){return this.context.filterLevel},enabledFor:function(m){var T=this.context.filterLevel;return m.value>=T.value},trace:function(){this.invoke(n.TRACE,arguments);},debug:function(){this.invoke(n.DEBUG,arguments);},info:function(){this.invoke(n.INFO,arguments);},warn:function(){this.invoke(n.WARN,arguments);},error:function(){this.invoke(n.ERROR,arguments);},time:function(m){typeof m==`string`&&m.length>0&&this.invoke(n.TIME,[m,`start`]);},timeEnd:function(m){typeof m==`string`&&m.length>0&&this.invoke(n.TIME,[m,`end`]);},invoke:function(m,T){h&&this.enabledFor(m)&&h(T,I({level:m},this.context));}};var b=new R({filterLevel:n.OFF});((function(){var m=n;m.enabledFor=v(b,b.enabledFor),m.trace=v(b,b.trace),m.debug=v(b,b.debug),m.time=v(b,b.time),m.timeEnd=v(b,b.timeEnd),m.info=v(b,b.info),m.warn=v(b,b.warn),m.error=v(b,b.error),m.log=m.info;}))(),n.setHandler=function(m){h=m;},n.setLevel=function(m){b.setLevel(m);for(var T in u)u.hasOwnProperty(T)&&u[T].setLevel(m);},n.getLevel=function(){return b.getLevel()},n.get=function(m){return u[m]||(u[m]=new R(I({name:m},b.context)))},n.createDefaultHandler=function(m){m=m||{},m.formatter=m.formatter||function(_,A){A.name&&_.unshift(`[`+A.name+`]`);};var T={},B=function(p,_){Function.prototype.apply.call(p,console,_);};return typeof console>`u`?function(){}:function(p,_){p=Array.prototype.slice.call(p);var A=console.log,O;_.level===n.TIME?(O=(_.name?`[`+_.name+`] `:``)+p[0],p[1]===`start`?console.time?console.time(O):T[O]=new Date().getTime():console.timeEnd?console.timeEnd(O):B(A,[O+`: `+(new Date().getTime()-T[O])+`ms`])):(_.level===n.WARN&&console.warn?A=console.warn:_.level===n.ERROR&&console.error?A=console.error:_.level===n.INFO&&console.info?A=console.info:_.level===n.DEBUG&&console.debug?A=console.debug:_.level===n.TRACE&&console.trace&&(A=console.trace),m.formatter(p,_),B(A,p));}},n.useDefaults=function(m){n.setLevel(m&&m.defaultLevel||n.DEBUG),n.setHandler(n.createDefaultHandler(m));},n.setDefaults=n.useDefaults,typeof define==`function`&&define.amd?define(n):typeof we<`u`&&we.exports?we.exports=n:(n._prevLogger=s.Logger,n.noConflict=function(){return s.Logger=n._prevLogger,n},s.Logger=n);})(St);});var Ve$3=x$3(dt$3());function ge$3(s){return Ve$3.default.createInstance({name:`lc`,storeName:s,driver:Ve$3.default.LOCALSTORAGE})}var re$5=class re{static storage;static async get(n,h){return await this.storage?.getItem(n)??h}static set(n,h){return this.storage?.setItem(n,h)}static remove(n){return this.storage?.removeItem(n)}static clear(){return this.storage?.clear()}static getForage(){return this.storage}};var ce$5=class ce extends re$5{static storeName=`usr`;static visitorOldId=null;static{this.storage=ge$3(this.storeName);}static getVisitorId(){return localStorage.getItem(`lc/${this.storeName}/vid`)}};var Me$2=`14.8.5`;var Fe$4=(function(s){return s[s.WEB=3]=`WEB`,s.WEB_SDK=`WEB_SDK`,s.SHOPIFY_APP=`SHOPIFY_APP`,s.SHOPIFY_THEME_EXTENSION=`SHOPIFY_THEME_EXTENSION`,s})(Fe$4||{});var Cr$4=Me$2.split(`-`)[0].split(`.`).slice(0,3).map(s=>s.padStart(2,`0`)).join(``),Zr$3=Fe$4.WEB_SDK,mt$4=`CooeeSDK`,Q$3=Me$2,en=parseInt(Cr$4,10);var tn=[`collection`,`product`,`cart`],rn=[{identifier:`#flo-checkout-wrapper`,gateway:`Shopflow`},{identifier:`#fastrr-main-container`,gateway:`Shiprocket`},{identifier:`#gokwik-modal-wrapper`,gateway:`Gokwik`},{identifier:`#zecpe`,gateway:`Ecom 360`}],nn=[`View Item`,`View Cart`,`View Collection`],on=[`CE Screen View`,`View Collection`,`View Item`,`View Cart`],an=`https://cdn.jsdelivr.net/npm/swiper@11`;var gt$3=`https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@${Q$3}/dist`,fe$3={apiURL:`https://api.sdk.letscooee.com`,cdnApiURL:`https://cdn.sdk1.api.letscooee.com`,debug:false,mode:`production`,baseURL:gt$3,styleURL:`${gt$3}/styles.min.css`};var pe$4=class pe{static ISO_WITHOUT_MS_REGEX=new RegExp(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/);static isObject(n){return typeof n==`object`&&!Array.isArray(n)&&n!==null}static parseToAny(n){try{return JSON.parse(n.toString())}catch{}return n.toString().match(this.ISO_WITHOUT_MS_REGEX)?new Date(n.toString()):n}static async sleep(n){return new Promise(h=>setTimeout(h,n))}static hasKeys(n){return n?Object.keys(n).length>=1:false}static convertObjectToArray(n,h){return h.reduce((u,v)=>(n.hasOwnProperty(v)&&n[v]!=null&&u.push({[v]:n[v]}),u),[])}static removeNullUndefinedKeys(n){return Object.keys(n).reduce((h,u)=>(n[u]!==null&&n[u]!==void 0&&(h[u]=n[u]),h),{})}static stringify(n){return JSON.stringify(n,function(h,u){return u===void 0?null:u})}};var he$4=class he{gaEnabled;gaMeasurementID;pixelPush;website;currencyCount;money;storefrontToken;skipItemAttribute;checkoutProvider;widgetCustomisation;currency;static get(){return window.CooeeSDK.config}update(n){return n??={},this.gaEnabled=n.gaEnabled,this.gaMeasurementID=n.gaMeasurementID,this.pixelPush=n.pixelPush,this.website=n.website??{},this.currencyCount=n.currencyCount??0,this.money=n.money,this.currency=n.currency,this.storefrontToken=n.storefrontToken,this.skipItemAttribute=n.skipItemAttribute,this.checkoutProvider=n.checkoutProvider,this.widgetCustomisation=n.widgetCustomisation,this}};var ve$4=class ve extends re$5{static storeName=`ses`;static{this.storage=ge$3(this.storeName);}};var pt$3=5,Nr$4=500,ne$4=class ne extends Error{request;response;status;requestBody;responseText;constructor(n){super(n),this.name=`FetchError`,Object.setPrototypeOf(this,new.target.prototype);}is40x(){return !!this.response&&this.response.status>=400&&this.response.status<500}};async function pn(s,n){let h=Date.now(),u;try{u=await xr$4(s,n);}catch{}let v=u?new Request(u.url,{method:n?.method||`GET`}):new Request(s,n);if(!u||!u.ok){let m=`Failed to fetch`;u?.statusText&&(m+=`: ${u.statusText}`);let T=new ne$4(m);throw T.request=v,T.response=u?.clone(),T.status=u?.status,T.requestBody=n?.body,T.responseText=await ht$4(u),T}let I,w=(u.headers.get(`content-type`)||``).toLowerCase(),R=u.headers.get(`content-length`),b=n?.method?.toUpperCase()||`GET`;if(u.status===204||u.status===205||b===`HEAD`||R===`0`)I=void 0;else if(w.includes(`application/json`)||w.includes(`application/problem+json`)||w.includes(`text/javascript`))try{I=await u.clone().json();}catch(m){let T=new ne$4(`Failed to parse JSON response: ${m?.message}`);throw T.request=v,T.response=u.clone(),T.status=u.status,T.requestBody=n?.body,T.responseText=await ht$4(u),T}else w.includes(`text/`)||w.includes(`image/svg+xml`)?I=await u.text():I=await u.arrayBuffer();return {data:I,status:u.status,statusText:u.statusText,headers:u.headers,timeTakenMs:Date.now()-h,options:n,request:v}}async function xr$4(s,n){let h=null,u;for(let v=0;v<=pt$3;v++){try{if(u=await fetch(s,n),u.ok||u.status>=400&&u.status<500)return u;h=new Error(`Server error: ${u.status} ${u.statusText}`);}catch(I){h=I instanceof Error?I:new Error(String(I));}if(v<pt$3){let I=Math.pow(2,v)*Nr$4;Y$2.info(`Request to ${s} failed. Retrying in ${I}ms...`),await new Promise(w=>setTimeout(w,I));}}if(u&&!u.ok)return u;throw h||new Error(`Request failed after retries`)}async function ht$4(s){if(s){try{return s=s.clone(),await s.json()}catch{}try{return await s.text()}catch{}}}var ye$4={},Ee$5,_e$3,yt$2,Et$3,vt$3;async function _t$3(){if(!_e$3)return vt$3??=Lr$3(),vt$3}async function Lr$3(){let{BrowserClient:s,Scope:n,defaultStackParser:h,getDefaultIntegrations:u,makeFetchTransport:v}=await import('./esm-B-weSuzB-cvHcxwma.js');Et$3=n;_e$3=new s({dsn:`https://1bc3dda4c861f60cd6be1b67584f4bc6@o559187.ingest.us.sentry.io/4507626484203520`,transport:v,stackParser:h,integrations:u({}).filter(w=>![`BrowserApiErrors`,`Breadcrumbs`,`GlobalHandlers`].includes(w.name)),environment:fe$3.mode,release:`web-sdk@${Q$3}`,debug:fe$3.debug,sampleRate:.5}),_e$3.init();}function ke$1(s,n,h){Y$2.error(`${n}:`,s),_t$3().then(()=>{let u=bt$2(h);if(u.setTag(`operation`,n),s instanceof ne$4){Or$4(u,s,n);return}u.captureException(s);});}function Tn(s,n,h){_t$3().then(()=>{bt$2(h).captureMessage(s,n??`error`);});}function Or$4(s,n,h){if(Pr$4(s,n),n.response){let u=n.response,v=n.responseText;s.setTag(`error.message`,n.message),u.status!=null&&s.setTag(`http.status_code`,u.status),u.statusText&&s.setTag(`http.status_text`,u.statusText),v&&typeof v==`object`&&`error`in v&&(s.setTag(`http.error_code`,v.error.code),s.setTag(`http.error_message`,v.error.message)),s.setExtras({responseText:n.responseText,statusText:u.statusText,responseType:u.type,redirected:u.redirected,responseUrl:u.url,originalError:n.message}),s.captureMessage(`${h} failed with ${u.status}`,`error`);return}if(n.request){s.captureMessage(`No response was received for ${h}`,`error`);return}}function Pr$4(s,n){let h=n.request;if(!h)return;s.setExtras({body:n.requestBody,headers:h.headers,method:h.method,url:h.url});let u=h.headers?.get(`Cooee-Retry-Attempt`);u!==null&&s.setTag(`retry.attempt`,u);}function wn(s){yt$2=s;}function In$1(s,n){ye$4[s]=r$2(r$2({},ye$4[s]),n);}function Sn$1(s){Ee$5=r$2(r$2({},Ee$5),s);}function bt$2(s){s??={};let{extra:n,tags:h}=s,u=new Et$3;if(u.setClient(_e$3),u.setUser(yt$2),s.triggerContext&&!s.engagementTrigger&&(s.engagementTrigger=s.triggerContext.triggerData),s.engagementTrigger){let v=s.engagementTrigger;u.setTags({"engagement.id":v.engagementID,"engagement.short_id":v.shortID,"engagement.objective":v.objective,"engagement.delivery_type":v.onsiteDeliveryType,"engagement.content_id":v.contentID,"engagement.variation":v.variation,"engagement.currency":v.currency});}return n&&u.setExtras(n),h&&u.setTags(h),Ee$5&&u.setTags(Ee$5),Object.keys(ye$4).forEach(v=>{u.setContext(v,ye$4[v]);}),u.setTag(`language`,navigator.language),u.setTag(`timezone`,Tt$1()),Br$4(u),u}function Br$4(s){window.Shopify&&(s.setTag(`shopify.shop`,window.Shopify.shop),s.setTag(`shopify.currency`,window.Shopify.currency?.active),s.setTag(`shopify.locale`,window.Shopify.locale),s.setTag(`theme.schema_name`,window.Shopify.theme?.schema_name),s.setTag(`theme.schema_version`,window.Shopify.theme?.schema_version));}var be$4=class be{static format(n,h){return h.replace(/{{\s*(\w+)\s*}}/,(v,I)=>{switch(I){case `amount`:return this.formatWithDelimiters(n,2);case `amount_no_decimals`:return this.formatWithDelimiters(n,0);case `amount_with_comma_separator`:return this.formatWithDelimiters(n,2,`.`,`,`);case `amount_no_decimals_with_comma_separator`:return this.formatWithDelimiters(n,0,`.`,`,`);case `amount_with_apostrophe_separator`:return this.formatWithDelimiters(n,2,`'`,`.`);case `amount_no_decimals_with_space_separator`:return this.formatWithDelimiters(n,0,` `);case `amount_with_space_separator`:return this.formatWithDelimiters(n,2,` `,`,`);case `amount_with_period_and_space_separator`:return this.formatWithDelimiters(n,2,` `,`.`);default:return v}})}static formatWithDelimiters(n,h=2,u=`,`,v=`.`){if(isNaN(n)||n==null)return `0`;let w=(n/100).toFixed(h).split(`.`);return w[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,`$1`+u)+(w[1]?v+w[1]:``)}};function Cn(s){return `(\u23F0 took: ${Ue$1(s)})`}function Ue$1(s){if(s<0)return `${s}ms`;let n=new Date(Date.UTC(0,0,0,0,0,0,s)),h=[];return n.getUTCMinutes()&&h.push(n.getUTCMinutes()+`m`),n.getUTCSeconds()&&h.push(n.getUTCSeconds()+`s`),n.getUTCMilliseconds()&&h.push(n.getUTCMilliseconds()+`ms`),h.length||h.push(`0ms`),h.join(` `)}function We$4(){return window.CooeeSDK.runtimeData}function Ln$1(){return Ue$1(Date.now()-We$4().sdkLoadTime.getTime())}function $n$1(s){try{return new URL(s)}catch{return}}function Gn$1(s,n){let h=s.indexOf(n);return h===-1?false:(s.splice(h,1),true)}function Yn$1(s,n,h=true){return {[s]:Vr$4(n,h),[s+`_wo_currency`]:n}}function Vr$4(s,n=false){if(s==0&&n)return `Free`;let h=We$4(),u=he$4.get(),v=h.shopCurrencyCode||u.currency,I=h.currencyCode;I||Y$2.warn(`Currency code is not set in RuntimeData`);let w=u.money?.format??h.moneyFormat,R;if(w&&v===I&&!u.money?.auto)R=be$4.format(s*100,w);else {let b={style:`currency`,currency:I||v,minimumFractionDigits:2,maximumFractionDigits:2,trailingZeroDisplay:`stripIfInteger`},m;try{m=new Intl.NumberFormat(wt$2(),b);}catch(T){return ke$1(T,`format-currency`,{extra:{currentCurrency:I,shopCurrency:v}}),``}R=m.format(s),R=R.replace(`₹`,`Rs. `),u.money?.showCurrency&&I!==`INR`&&(R=R.concat(` ${I}`));}return R}function jn$1(s){let n=wt$2();try{return new Intl.NumberFormat(n,{notation:`compact`}).format(s)}catch(h){return ke$1(h,`format-number`,{extra:{lang:n,value:s}}),s.toString()}}function wt$2(){let s=`en`;return typeof navigator<`u`&&(navigator.languages!==void 0&&navigator.languages.length>0?s=navigator.languages[0]:navigator.language&&(s=navigator.language)),s=s.split(`;`)[0],s=s.split(`-`)[0],s||`en`}var Te$2;function Tt$1(){if(Te$2)return Te$2;try{return Te$2=Intl.DateTimeFormat().resolvedOptions().timeZone,Te$2}catch{return ``}}function It$2(s){document.readyState!==`loading`?s():document.addEventListener(`DOMContentLoaded`,s);}function zn$1(s){let n=document.createElement(`span`);n.id=`snackbar`,n.innerText=s,document.body.appendChild(n),n.className=`cooee-snackbar show`,setTimeout(()=>{n.classList.remove(`show`),document.body.removeChild(n);},5e3);}async function Mr$4(s,n=7,h=document){let u=1,v=document.querySelectorAll(`nonexistent-tag`);for(;u<=n;){let I=Math.min(50*2**u,1e3);if(u>1&&await pe$4.sleep(I),v=h.querySelectorAll(s),v.length)return Y$2.verbose(`Attempt ${u}: ${v.length} elements found with ${s}`),v;Y$2.verbose(`Attempt ${u}: Elements not found with ${s}. Will retry after ${I}ms.`),u++;}return Y$2.verbose(`\u26A0\uFE0F Max attempts reached. Element not found with ${s}.`),v}async function Kn$1(s,n=10,h=document){return (await Mr$4(s,n,h)).item(0)}async function Fr$1(s){let[n,h,u]=await Promise.all([ce$5.get(`did`),ve$4.get(`id`,``),ce$5.get(`sessionNumber`,1)]),v={letscooee_did:n,letscooee_sid:h,letscooee_sn:`${u}`,__letscooee_time:new Date().toLocaleString()};return s&&(v.__letscooee_via=s),v}async function qn$1(s){let n=await Fr$1(s);return Object.entries(n).map(([h,u])=>({key:h,value:u.toString()}))}function Xn$1(s,n,h,u=false){Object.defineProperty(s,n,{enumerable:false,configurable:false,writable:u,value:h});}function Jn$1(s){if(s%100>=11&&s%100<=13)return s+`th`;switch(s%10){case 1:return s+`st`;case 2:return s+`nd`;case 3:return s+`rd`;default:return s+`th`}}var W$2=x$3(Dt$2());var Y$2=class Y{static debuggerEl;static infoLogs=[];static log(...n){W$2.default.info(...n);}static verbose(...n){W$2.default.debug(...n);}static error(...n){W$2.default.error(...n);}static warn(...n){W$2.default.warn(...n);}static info(...n){W$2.default.info(...n),this.infoLogs.push({time:new Date,message:n.join(` `)}),this.addToDebugger();}static trace(...n){W$2.default.trace(...n);}static addToDebugger(){sessionStorage.cooeeDebug&&(this.debuggerEl=this.debuggerEl??document.querySelector(`cooee-debugger`),this.debuggerEl&&this.debuggerEl&&(this.debuggerEl.logs=[...this.infoLogs]));}};function ro$1(s=mt$4){W$2.default.useDefaults({formatter:function(n){n.unshift(`${s} (v${Q$3}):`);}}),kr$5()&&(localStorage.cooeeLogLevel=`TRACE`),localStorage.cooeeLogLevel?W$2.default.setLevel(W$2.default[localStorage.cooeeLogLevel]):W$2.default.setLevel(W$2.default.OFF);}function kr$5(){let s=Rt$3();return s===`1`||s===`on`}function Rt$3(){return new URL(location.href).searchParams?.get(`cooee-debug`)}function no$1(){let s=[`display: inline-block;`,`font-size: 14px;`,`background: linear-gradient(90deg, #d52dc8 25%, #2179e2 82%);`,`color: white;`,`padding: 4px;`,`border-radius: 4px;`].join(` `),n=`
4
4
  `;n+=`\u{1F4E3} Drive higher conversions with AI-powered onsite engagement
5
5
  `,n+=`\u{1F50D} Track real-time visitor intent & optimize engagement
6
6
  `,n+=`\u{1F4CA} Improve Meta Ads ROAS with intent-driven campaigns
@@ -81,7 +81,7 @@ mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!) {
81
81
  style="background-color: ${e.pagination.color?.rgba};">
82
82
  </span>
83
83
  `},navigation:{nextEl:r.querySelector(`.swiper-button-next`),prevEl:r.querySelector(`.swiper-button-prev`)},autoplay:e.autoplay?.enabled?{delay:e.autoplay?.delay,disableOnInteraction:false,pauseOnMouseEnter:false}:false,autoHeight:true};e.marquee&&t.autoplay&&typeof t.autoplay==`object`&&(t.speed=e.speed,t.autoplay.pauseOnMouseEnter=true,r.style.setProperty(`--swiper-wrapper-transition-timing-function`,`linear`));let n=new window.CooeeSDK.Swiper(r,t);return r.style.setProperty(`--swiper-navigation-size`,`${e.navigation.size}px`),n}function sr$1(r,e,t){let n={color:r.navigation.color?.rgba};return r.pagination.enabled&&(n.transform=`translateY(-25%)`),l$2(`div`,{class:`swiper-container`,ref:e,style:`max-width: 100%`,children:[l$2(`div`,{class:`swiper-wrapper`,children:t()}),r.navigation.enabled&&l$2(`div`,{class:`swiper-button-next`,style:n,children:l$2(`span`,{})}),r.navigation.enabled&&l$2(`div`,{class:`swiper-button-prev`,style:n,children:l$2(`span`,{})}),r.pagination.enabled&&l$2(`div`,{className:`swiper-pagination`,style:{color:r.pagination.color?.rgba}})]})}var gd=()=>{let r=window.ShopifyAnalytics?.meta??{},e=r.selectedVariantId;if(e)return e;if(r.product?.variants?.length>0)return r.product.variants[0].id},Fr=r=>{if(!r)return;let e;try{e=new URL(r);}catch{return}if(e.hostname!==`cdn.shopify.com`)return r;let t=e.pathname.split(`.`);return t.length!==2?r:(e.pathname=t[0]+`_large.`+t[1],e.toString())};var ot=class extends w$1{componentDidMount(){Z$1(()=>{this.setState(()=>({checked:this.props.item.selected.value}));});}render(){return l$2(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-checkbox`),children:l$2(`input`,{type:`checkbox`,checked:this.state.checked,onChange:this.onChange.bind(this),style:{appearance:`auto`}})})}onChange(e){let{checked:t}=e.target;this.props.item.selected.value=t;}getTypoStyles(){let e={},t=this.mediaStyle.typo??new B$3;return e.textAlign=t.alignment,e.justifyContent=t.alignment,e}getComponentStyles(){return s$2(r$2({},this.getTypoStyles()),{display:`flex`})}};var oe$1=class oe extends w$1{constructor(e,t){super(e,t);}render(){let e=this.props.element[this.deviceTypeKey],t=e?.src||this.props.element.src||this.props.element.lg?.src;return l$2(`img`,{onClick:this.customOnClick.bind(this),alt:e?.name||`Image`,className:this.getClasses(`lc-image`),onMouseEnter:this.handleMouseEnter.bind(this),onMouseLeave:this.handleMouseLeave.bind(this),src:t,style:this.getCompiledStyles()})}customOnClick(e){this.props.element.clc?.at===he$3.ADD_TO_CART&&this.props.triggerContext.triggerData.items[0]&&this.onClick(e,{item:this.props.triggerContext.triggerData.items[0]}),this.props.onClick&&this.props.onClick(`image`);}getComponentStyles(){let e=this.mediaStyle.lout;if(!e||e.pos!==`absolute`)return {};let t={zIndex:e.zIndex,cursor:this.props.element.clc?.at?`pointer`:`auto`};return this.mediaStyle.size?.w&&(t.width=this.mediaStyle.size.w),this.mediaStyle.size?.h&&(t.height=this.mediaStyle.size.h),t}handleMouseEnter(e){let t=this.props.element[this.deviceTypeKey]?.secondarySrc;t&&(e.currentTarget.src=t);}handleMouseLeave(e){e.currentTarget.src=this.props.element[this.deviceTypeKey]?.src;}};var ie$1=class ie extends w$1{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return l$2(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-flexbox`),children:l$2(ue,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})})}getComponentStyles(){let e=this.mediaStyle.flex??new Et$2,t={display:`flex`,gap:e.gap+`px`,flexWrap:e.wrap,flexDirection:e.dir,justifyContent:e.jc,alignItems:e.ai};return e.wrap===`nowrap`&&e.scroll&&(e.dir===`column`?t[`overflow-y`]=`auto`:t[`overflow-x`]=`auto`),t}};var it=class extends ie$1{render(){if(!(this.props.element.hide||!this.matchWhenCondition(this.props.element.when)))return l$2(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-flexbox`),children:l$2(je$1,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext,item:this.props.item,productVariables:this.props.productVariables,noLinks:this.props.noLinks})})}};var st$1=class st extends w$1{render(){return l$2(`select`,{style:this.getCompiledStyles(),value:this.props.selectedVariant.selectedSellingPlan.value?.mID??``,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:this.getClasses(`lc-dropdown`),children:this.createSelectItems()})}componentDidMount(){Z$1(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:false}));});}getComponentStyles(){let e={};return this.props.selectedVariant.sellingPlans?.length||(e.visibility=`hidden`),r$2(r$2({},e),In(this.mediaStyle.typo))}createSelectItems(){let e=[],t=this.props.selectedVariant;if(!t.sellingPlans?.length)return [];this.props.triggerContext.triggerData.content?.subsUpgradeConfig?.skipSubscribedItems?t.selectedSellingPlan.value||(t.sellingPlans[0].isSelected=true,t.changeSellingPlan(t.sellingPlans[0])):e.push(l$2(`option`,{value:``,selected:!t.selectedSellingPlan,children:`One time purchase`}));for(let n of t.sellingPlans??[])e.push(l$2(`option`,{value:n.mID,selected:n.isSelected,children:n.name}));return e}onChange(e){let t=e.target.value;t?this.props.selectedVariant.selectedSellingPlan.value=this.props.selectedVariant.sellingPlans.find(n=>n.mID===t):this.props.selectedVariant.selectedSellingPlan.value=void 0;}};var ui$1=new RegExp(`fill="#[a-zA-Z0-9]+"`),at$1=class at extends w$1{constructor(){super();}render(){let e=this.getCompiledStyles(),t=this.getRating();return t||(e.display=`none`,t=``),l$2(`div`,{style:e,className:this.getClasses(`lc-star-rating`),dangerouslySetInnerHTML:{__html:t}})}getRating(){let e={size:this.props.element.iconSize,color:this.props.element.c.hex},t=Fe$3(this.props.element.fullStar,{svg:e},this.props.triggerContext),n=Fe$3(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=t;else {let s=5,c=`${o.rating}`.split(`.`);for(let p=0;p<+c[0];p++)i+=t,s--;c[1]&&(i+=n,s--);for(let p=0;p<s;p++)i+=t.replace(ui$1,`fill="#f1f1f1"`);}return i}getComponentStyles(){return {display:`flex`,alignItems:`center`}}};var ct$1=class ct extends w$1{render(){return l$2(`select`,{style:this.getCompiledStyles(),value:this.props.item.selectedOrFirstVariant.value.mID,onChange:this.onChange.bind(this),disabled:this.state.disabled,className:this.getClasses(`lc-dropdown`),children:this.createSelectItems()})}componentDidMount(){Z$1(()=>{this.setState(()=>({disabled:this.props.triggerContext.triggerData.isBundle()?!this.props.item.selected.value:false}));});}getComponentStyles(){let e={};return this.props.item.vars?.length===1&&this.props.item.vars[0].name===`Default Title`&&(e.visibility=`hidden`),r$2(r$2({},e),In(this.mediaStyle.typo))}createSelectItems(){let e=[];for(let t of this.props.item.vars)e.push(l$2(`option`,{value:t.mID,disabled:!t.isAvailable,children:t.name}));return e}onChange(e){let t=e.target.value,n=this.props.item.vars.find(o=>o.mID===t);this.props.item.setSelectedVariant(n);}};var je$1=class je extends w$1{constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`}));}renderElement(e){if(!(e.hide||!this.matchWhenCondition(e.when))){if(e.t===4){let t=e;return t.l===`Star Rating`&&!this.props.item.reviews?.rating?void 0:l$2(it,{element:t,triggerContext:this.props.triggerContext,elements:t.elems,item:this.props.item,productVariables:this.props.productVariables,noLinks:this.props.noLinks})}if(e.t===6){let t=this.props.triggerContext,n=t.triggerData;return n.isBundle()||n.isAddOns()?l$2(ot,{element:e,item:this.props.item,triggerContext:t}):void 0}if(e.t===8){let t=e;if(!t.templateName)return ``;try{if(!/^[a-zA-Z0-9_-]+$/.test(t.templateName))return Y$2.error(`Invalid partial template name`,t.templateName),``;let n=Fe$3(`{{ @include("${t.templateName}", it) /}}`,this.props.productVariables??{});return l$2(`div`,{className:`lc-partial-`+t.templateName,dangerouslySetInnerHTML:{__html:n}})}catch(n){return Y$2.error(`Failed to render partial element`,t.templateName,this.props.productVariables,n),``}}if(e.t===13){let t=e,n=this.props.item,o=Fr(n.variantImage??n.firstImageURL),i=Fr(n.variantSecondaryImage??n.secondaryImageURL);t.lg=t.sm={src:o,name:n.name,secondarySrc:i};let s=l$2(oe$1,{element:t,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?s:l$2(`a`,{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:`block`},children:s})}if(e.t===14)return this.renderProductTitle(e);if(e.t===15){let t=e;return this.props.triggerContext.triggerData.isCartEmbed()&&this.props.item.vars?.length===1&&this.props.item.vars[0].name===`Default Title`?void 0:t.type!==`SINGLE`?l$2(`cooee-product-options-picker`,{item:this.props.item,styles:t.style,horizontal:t.horizontal,dropdownType:t.type}):l$2(ct$1,{element:t,item:this.props.item,triggerContext:this.props.triggerContext})}return e.t===16?l$2(st$1,{element:e,selectedVariant:this.props.item.selectedOrFirstVariant.value,item:this.props.item,triggerContext:this.props.triggerContext}):e.t===19?l$2(at$1,{element:e,triggerContext:this.props.triggerContext,review:this.props.item.reviews}):e.t===18||e.t===3?l$2(Ie$1,{element:e,item:this.props.item,triggerContext:this.props.triggerContext}):l$2(ue,{elements:[e],element:this.props.element,triggerContext:this.props.triggerContext})}}render(){return this.attachListener(),this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return {}}renderProductTitle(e){let t=l$2(F,{element:e,onClick:this.customOnClick.bind(this),triggerContext:this.props.triggerContext});return this.props.noLinks?t:l$2(`a`,{href:this.props.item.selectedOrFirstVariant.value.link,style:{display:`block`,textDecoration:this.state.decoration},onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),children:t})}customOnClick(e){this.sendTriggerClicked([this.props.item.toEmbed()],{from:e});}onMouseEnter(){this.setState(()=>({decoration:`underline`}));}onMouseLeave(){this.setState(()=>({decoration:`unset`}));}attachListener(){document.addEventListener(`letscooee:variant-change`,e=>{let t=e;if(!t.detail||this.props.item.mID!==t.detail.productID)return;let n=t.detail.variantID;this.props.item.setSelectedVariantByID(n);});}};var Se$1=class Se extends w$1{productElement;constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`}));}render(){let e=this.props.item,t=this.getProductData();if(this.productElement=new pe(We$3(this.props.element,t,this.props.triggerContext)),this.productElement.hide||!this.matchWhenCondition(this.productElement.when))return;let o=this.getClasses([`lc-single-product`,...e.cardClasses??[]].join(` `));return l$2(`div`,{style:r$2({},this.getCompiledStyles()),className:o,children:l$2(je$1,{element:this.productElement,elements:this.productElement.elems,triggerContext:this.props.triggerContext,item:this.props.item,productVariables:t,noLinks:this.productElement.noLinks})})}getComponentStyles(){return {flexShrink:0}}getProductData(){if(!this.props.item)return {};let e=this.props.item,t=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===H$1.BXGY;return !t.hasEffectivePrice()&&o&&(n.product=s$2(r$2(r$2({},n.product),Yn$1(`effective_price`,t.effectivePrice.value)),{price:``})),n.variant.quantity=this.props.triggerContext.hasManipulatedProductQuantity()?this.props.triggerContext.getManipulatedQuantity(t.quantity):t.quantity,{product:n.product,variant:n.variant,svg:{color:`{{ svg.color }}`,size:`{{ svg.size }}`}}}};var lt$1=class lt extends w$1{swiperRef=null;swiperInstance=null;configuration;gap;constructor(e,t){super(e,t),this.configuration=M$3()?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&&Mi$2().then(()=>{this.swiperInstance=ir$1(this.swiperRef,this.props.element.conf[this.deviceTypeKey]);});}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy();}render(){let e=this.props.triggerContext.triggerData.items;e.splice(this.configuration.maxItems??10);let t;if(this.configuration.disp===2){let n=i=>{this.swiperRef=i;},o=()=>e?.map(i=>l$2(`div`,{class:`swiper-slide`,children:this.getProductFragment(i)}));t=l$2(`div`,{style:s$2(r$2({},this.getCompiledStyles()),{display:`block`}),className:this.getClasses(`lc-product-swiper-list`),children:sr$1(this.configuration,n,o)});}else t=l$2(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-product-list`),children:e?.map((n,o)=>this.getProductFragment(n,o!==e.length-1))});return t}getComponentStyles(){let e=[0,2].includes(this.configuration.disp),t={display:e?`flex`:`grid`,justifyContent:`safe `+(this.mediaStyle.flex?.jc??`center`),gap:this.gap,flexDirection:this.mediaStyle.flex?.dir??`row`};if(t.flexDirection===`row`){if(e)t.maxWidth=`100%`,t.overflowY=`auto`;else if(this.configuration.disp===1){let n=this.props.triggerContext.triggerData,o=n.items.length,i;n.isBundle()?i=this.props.element.prod.symbol?.hide!==true?o*2-1:o:i=this.props.element.conf[this.deviceTypeKey].maxInRow,t.gridTemplateColumns=`repeat(${i}, auto)`;}}return t}getProductFragment(e,t=false){return l$2(ut$3,{children:[l$2(Se$1,{element:this.props.element.prod,item:e,triggerContext:this.props.triggerContext}),this.props.triggerContext.triggerData.isBundle()&&t&&this.props.element.prod.symbol&&!this.props.element.prod.symbol.hide&&l$2(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`},children:l$2(F,{element:this.props.element.prod.symbol,triggerContext:this.props.triggerContext})})]},e.mID)}};var mt$1=class mt extends w$1{swiperRef=null;swiperInstance=null;constructor(e,t){super(e,t);}componentDidMount(){Mi$2().then(()=>{this.swiperInstance=ir$1(this.swiperRef,this.props.element.conf);});}componentWillUnmount(){this.swiperInstance&&this.swiperInstance.destroy();}render(){let e=this.props.element,t=o=>{this.swiperRef=o;},n=()=>{let o=e.values?.map(c=>l$2(`div`,{class:`swiper-slide`,onClick:p=>this.onClick(p,{clickAction:this.getClickAction(c)}),children:this.renderElement(c)}));if(!o?.length)return [];let i=e.conf,s=o.length;if(i.marquee&&s<=Number(i.maxInRow)){let c=Number(i.maxInRow)-s+1;for(let p=0;p<c;p++)o.push(o[p%s]);}return o};return sr$1(e.conf,t,n)}getComponentStyles(){return {}}renderElement(e){let t=this.valueAddedSlide(this.props.element.slide,e);switch(t?.t){case 1:return l$2(oe$1,{element:t,triggerContext:this.props.triggerContext});case 4:return l$2(ie$1,{elements:t.elems,element:t,triggerContext:this.props.triggerContext});default:Y$2.warn(`Unknown slide type for carousal`);}}valueAddedSlide(e,t){let n=We$3(e,{form:t},this.props.triggerContext);return B$2.getParsedElement(n)}getClickAction(e){return We$3(this.props.element.clc??{},{form:e},this.props.triggerContext)}};var ue=class extends w$1{constructor(e,t){super(e,t),this.setState(()=>({decoration:`unset`})),Z$1(()=>{this.setState(()=>({showButton:!this.props.triggerContext.triggerData.isBundle()||!!this.props.triggerContext.selectedItems.length}));});}renderElement(e){if(!e.hide){if(e.t===4){let t=e;return l$2(ie$1,{element:t,triggerContext:this.props.triggerContext,elements:t.elems})}if(e.t===61)return l$2(nt$1,{element:e,triggerContext:this.props.triggerContext});if(e.t===3)return this.state.showButton?l$2(Ie$1,{element:e,triggerContext:this.props.triggerContext}):void 0;if(e.t===2)return l$2(F,{element:e,triggerContext:this.props.triggerContext});if(e.t===1)return l$2(oe$1,{element:e,triggerContext:this.props.triggerContext});if(e.t===11)return l$2(lt$1,{element:e,triggerContext:this.props.triggerContext});if(e.t===12)return l$2(Se$1,{element:e,item:this.props.triggerContext.triggerData.items[0],triggerContext:this.props.triggerContext});if(e.t===62)return l$2(mt$1,{element:e,triggerContext:this.props.triggerContext})}}render(){return this.props.elements.map(e=>this.renderElement(e))}getComponentStyles(){return {}}};var pt$1=class pt extends w$1{clickAction;isClickable;constructor(e,t){super(e,t),this.clickAction=this.props.element.clc,this.isClickable=this.clickAction?.at===he$3.GO_TO_URL&&!!$n$1(this.clickAction.gu?.u)||this.clickAction?.at===he$3.OPEN_CART||this.clickAction?.at===he$3.INITIATE_CHECKOUT;}componentDidMount(){Z$1(()=>{let e=this.props.triggerContext.triggerData,t=this.props.triggerContext.selectedItems;e.calculateDiscountData(t,this.props.triggerContext.shouldGiveFBTDiscount);});}render(){return l$2(ut$3,{children:[l$2(`div`,{style:this.getCompiledStyles(),className:this.getClasses(`lc-container`),onClick:e=>{this.onClick(e,{clickAction:this.clickAction});},children:l$2(ue,{elements:this.props.elements,element:this.props.element,triggerContext:this.props.triggerContext})}),this.props.triggerContext.triggerData.id===`preview`&&l$2(`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 R$1=class r$9{constructor(e){this.engagementTrigger=e;this.triggerContext=new Be$1(new Date,this.engagementTrigger);}static engagementIDsWithTrackedDisplay=new Set;static DEBOUNCE_TIME=1e3;rootContainer;widgetElement;triggerContext;observers=[];renderedCount=0;scrollSubscription;isExclusionWithBVariation;isProcessing=false;lockReleased$=new U$1;renderSilently(){this.acquireProcessingLock()||this.render().finally(()=>this.releaseProcessingLock()).catch(e=>{ke$1(e,`render-widget`,{triggerContext:this.triggerContext});});}destroy(){Y$2.verbose(`${this.engagementTrigger} will be destroyed`),this.preDestroy(),this.removeFromRendered(),this.rootContainer?.remove(),r$9.engagementIDsWithTrackedDisplay.delete(this.engagementTrigger.shortID),Ui$2(this.engagementTrigger.content?.afterDeleteJS);}matches(e){return this.engagementTrigger.shortID===e.shortID}async render(){if(this.engagementTrigger.shouldGetVariationImmediately()){let e=await this.getVariation();this.handleVariationResponse(e);}if(this.rootContainer=await this.getWidgetContainer(true),!this.rootContainer){Y$2.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,Ui$2(this.engagementTrigger.content?.afterRenderJS);}async updateAndReRender(e){await this.waitForLockRelease(),this.acquireProcessingLock();try{this.updateItems(e.items,this.engagementTrigger.items),await this.update(e),await this.render();}finally{this.releaseProcessingLock();}}async update(e){this.engagementTrigger.variation=e.variation;}async rerenderIfDeleted(){if(!this.rootContainer?.isConnected&&!this.acquireProcessingLock()){Y$2.info(`${this.engagementTrigger} deleted. Will be re-rendered`);try{this.preDestroy(),await this.render();}finally{this.releaseProcessingLock();}}}updateAngularWidget(){return this.widgetElement?.isConnected?(this.widgetElement.update(),true):false}preDestroy(){this.scrollSubscription?.unsubscribe(),this.observers.forEach(e=>{e?.disconnect&&e.disconnect();});}acquireProcessingLock(){return this.isProcessing?(Y$2.verbose(`Lock could not be acquired for ${this.engagementTrigger}`),true):(Y$2.verbose(`Acquiring rendering lock for ${this.engagementTrigger}`),this.isProcessing=true,false)}releaseProcessingLock(){Y$2.verbose(`Releasing rendering lock for ${this.engagementTrigger}`),this.isProcessing=false,this.lockReleased$.next();}async waitForLockRelease(){this.isProcessing&&await le$2(this.lockReleased$);}afterRootContainerCreated(){}isAllOkToRender(){return !!this.engagementTrigger.widget}async getVariationIfRequired(){if(this.engagementTrigger.shouldSkipVariation()){Y$2.verbose(`${this.engagementTrigger} already has necessary data to render`);return}let e=await this.observeWidgetContainerInViewport();this.handleVariationResponse(e);}handleVariationResponse(e){if(!e)return;let t=this.engagementTrigger;Y$2.log(`${t} visitor has been assigned to variation ${e.variation}`),e.items?.length&&(t.items=e.items.map(n=>new mt$3(n)),t.nonMutableItems=e.items.map(n=>new mt$3(n))),e.bundleFrom&&(t.bundleFrom=new mt$3(e.bundleFrom)),e.discount&&(t.discount=e.discount),e.placement&&(t.placement=e.placement),pe$4.hasKeys(e.stickyATCConfig)&&(t.stickyATCConfig=e.stickyATCConfig),e.props&&pe$4.hasKeys(e.props)&&(t.props=r$2(r$2({},t.props),e.props)),e.content&&(t.content=new Ze(e.content)),t.widget=new He$1(e.widget),t.contentID=e.contentID,t.variation=e.variation,t.placement=e.placement,t.manipulation=e.manipulation,t.entryAnimation=e.entryAnimation??`NONE`,this.isExclusionWithBVariation=t.isExclusionTesting()&&t.variation===`b`,this.isExclusionWithBVariation&&(this.rootContainer.style.height=`0.5px`);}addToRendered(){this.renderedCount++,Y$2.info(`${this.engagementTrigger} rendered \u2705 ${Jn$1(this.renderedCount)} time`);}removeFromRendered(){this instanceof G?Te.delete(this):Ke$1.delete(this);}async getVariation(){Y$2.log(`${this.engagementTrigger} get variation`);let e={engagementID:this.engagementTrigger.engagementID,isPreview:this.engagementTrigger.id===`preview`};try{return (await so(e)).data}catch(t){if(t instanceof ne$4&&t.response?.status===400)return;ke$1(t,`get-variation`,{engagementTrigger:this.engagementTrigger});return}}async observeWidgetContainerInViewport(){if(!this.rootContainer){Y$2.warn(`${this.engagementTrigger} No root container found to watch for viewport`);return}let e=window.innerHeight*.3,t={root:null,rootMargin:`${e}px 0px ${e}px 0px`,threshold:0};return this.isInViewport()?this.getVariation():new Promise(n=>{let o=new IntersectionObserver((i,s)=>{i.forEach(async c=>{if(c.isIntersecting){Y$2.log(`${this.engagementTrigger} root container is near the viewport. Fetching variation`);n(await this.getVariation()),s.unobserve(this.rootContainer);}});},t);o.observe(this.rootContainer),this.observers.push(o);})}attachScroll(){this.scrollSubscription=Tr$2(window,`scroll`).pipe(Fe$2(r$9.DEBOUNCE_TIME)).subscribe(()=>{this.checkAndSendEvent();});}checkAndSendEvent(){let e=this.engagementTrigger.shortID;if(r$9.engagementIDsWithTrackedDisplay.has(e)||!this.isInViewport())return;let n={};this.triggerContext.triggerData.items?.length&&(n.promotedMIDs=this.engagementTrigger.items?.map(s=>s.mID));let i=new Ir$2(this.isExclusionWithBVariation?`CE Campaign Holdout`:`CE Trigger Displayed`,n,this.engagementTrigger);i.name===`CE Campaign Holdout`&&(i.trigger.holdout=true),we$1(i),r$9.engagementIDsWithTrackedDisplay.add(e),this.scrollSubscription.unsubscribe();}generateParentElementID(){return `letscooee-${this.engagementTrigger.shortID}`}createAngularWidget(e){let t=this.widgetElement=document.createElement(e);return t.cart=h.getCurrent(),t.triggerContext=this.triggerContext,t.engagementTrigger=this.engagementTrigger,t.setAttribute(`engagement`,this.engagementTrigger.shortID),this.rootContainer.appendChild(t),this.addToRendered(),this.injectOuterCSSOnly(),t}getParentElement(e,t=document){let n=t.getElementById(e);if(n)return n;let o=this.engagementTrigger.objective.toLowerCase().replaceAll(`_`,`-`),i=this.engagementTrigger.shortID;n=document.createElement(`div`),n.id=e;let s=`letscooee letscooee-engagement engagement-${i} lc-${o}`;return this.engagementTrigger.content?.classes&&(s+=` ${this.engagementTrigger.content.classes}`),n.className=s,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,t=this.triggerContext.triggerData.hasSwiperElement();t&&(e=this.rootContainer?.shadowRoot||this.rootContainer?.attachShadow({mode:`open`}),Vi$2(e)),this.injectCampaignCSS(t,e);let n=this.engagementTrigger.widget;$e$2(Yr$2(pt$1,{element:n.cont,triggerContext:this.triggerContext,elements:n.elems}),e),this.addToRendered();}injectCampaignCSS(e,t){let n=this.engagementTrigger.content?.outerCSS?.trim()??``,o=this.engagementTrigger.content?.innerCSS?.trim()??``;if(!n&&!o)return;let i=this.rootContainer.id;if(e){le$4(o,t),this.injectOuterCSSOnly();return}le$4(`#${i} { ${n+`
84
- ${o}`} }`);}injectOuterCSSOnly(){let e=this.engagementTrigger.content?.outerCSS?.trim();if(!e)return;let t=this.rootContainer.id;le$4(`#${t} { ${e} }`);}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return false;let t=window.innerHeight||document.documentElement.clientHeight,s=(Math.min(e.bottom,t)-Math.max(e.top,0))*e.width/(e.width*e.height)*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let t=await this.createParentElementWithPlacement(e);if(t)return t;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let t=this.engagementTrigger.placement;if(!t?.selector)return Y$2.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let n=t.selector,o;if(n.includes(`:shadow`)){let p=n.split(`:shadow`);o=(await Kn$1(p[0].trim()))?.shadowRoot,n=p[1].trim(),o&&Vi$2(o,false);}Y$2.verbose(`${this.engagementTrigger} attempt to render "${t.position}" "${n}"`);let i=await Kn$1(n,3,o??document);if(!i)return Y$2.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let s=this.generateParentElementID(),c=this.getParentElement(s);if(!e)return c;switch(t.position){case fe$2.BEFORE1:case fe$2.BEFORE:i.parentElement?.insertBefore(c,i);break;case fe$2.INSIDE_FIRST1:case fe$2.INSIDE_FIRST:i.insertBefore(c,i.firstChild);break;case fe$2.INSIDE_LAST1:case fe$2.INSIDE_LAST:i.appendChild(c);break;case fe$2.AFTER1:case fe$2.AFTER:default:i.parentElement?.insertBefore(c,i.nextSibling);}return c}async runChoresBeforeRender(){if(this.isExclusionWithBVariation)return;if(!this.isAllOkToRender()){Y$2.info(`\u26A0\uFE0F ${this.engagementTrigger} could not be rendered`);return}Y$2.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await rr$1(this.engagementTrigger);}catch(t){Y$2.info(`\u203C\uFE0F${this.engagementTrigger} could not render as items failed to refresh`,t);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){Y$2.info(`\u203C\uFE0F${this.engagementTrigger} could not render as no products promoted`);return}this.engagementTrigger.items=e,await this.startRendering();}updateItems(e,t){let n=this.getItemDiff(e,t),o=this.getItemDiff(t,e);t.push(...n);for(let i of o)re$1.remove(t,i);}getItemDiff(e,t){return e.filter(n=>!t.some(o=>o.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}};var G=class extends R$1{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(!D$1.get().isOpen()&&We$4().pageName!==`cart`){Y$2.log(`Do not send display event as neither the cart drawer nor the cart page is open.`);return}return super.checkAndSendEvent()}};var ar$1=class r{constructor(e,t){this.engagementTrigger=e;this.element=t;this.cartItems=h.getCurrent().items;}cartItems;static renderCartUpsell(e){let t=e.placement;if(!t?.selector){Y$2.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(t.selector));if(!n?.length){Y$2.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let o of n)new r(e,o).render();}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.content?.subsUpgradeConfig?.skipSubscribedItems&&e.selling_plan_allocation)return;let t=this.engagementTrigger.items.find(d=>d.mID===e.product_id.toString());if(!t)return;let n=t.vars.find(d=>d.mID===e.id.toString());if(!n)return;let o=new dt$2(n),i=e.selling_plan_allocation?.selling_plan;if(i)for(let d of o.sellingPlans??[])d.mID===i.id.toString()&&(d.isSelected=true,o.changeSellingPlan(d));let s=new mt$3(t);s.vars=[o],s.selectedOrFirstVariant.value=o;let c=`lc-cart-item-${this.engagementTrigger.shortID}-${t.mID}`;this.element.classList.add(c);let p=new q$1(this.engagementTrigger);p.placement.selector=`.${c}`,p.items=[s];let g=new G(p);g.renderSilently(),this.watchForCartItemDeletion(g,c);}watchForCartItemDeletion(e,t){let n=new MutationObserver(o=>{o.forEach(i=>{i.removedNodes.forEach(s=>{s===this.element&&(Y$2.verbose(`${t} has been removed`),e.destroy(),n.disconnect());});});});n.observe(this.element.parentElement,{childList:true,subtree:true});}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(t=>{if(!(e.includes(t.url)||e.includes(t.variant_id))&&(!e.includes(t.product_title)||t.variant_title&&!e.includes(t.variant_title)))return false;let n=t.selling_plan_allocation?.selling_plan?.name;return !(n&&!e.includes(n))})}};var cr$1=class cr extends R$1{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-collection-filter`);}};var lr$1=class lr extends G{constructor(e){super(e);}async update(e){await super.update(e),this.engagementTrigger.progressBarConfig.update(e.progressBarConfig),await this.checkMilestoneTryCatch(),this.updateAngularWidget();}isAllOkToRender(){return !!this.engagementTrigger.progressBarConfig}async startRendering(){if(this.updateAngularWidget()){this.addToRendered();return}this.createAngularWidget(`cooee-progressbar`),await this.checkMilestoneTryCatch();}async checkMilestoneTryCatch(){try{await this.checkMilestone();}catch(e){ke$1(e,`apply-milestones`,{engagementTrigger:this.engagementTrigger});}}async checkMilestone(){let e=await h.getCurrent().getNormalisedCart(true),t=this.engagementTrigger.progressBarConfig,n=[],o=[],i=[],s,c,p=[...t.milestones];for(let g of p){if(g.rewardType!==ve$3.FREE_AUTO_GIFT)continue;if(g.isUIOnly&&!g.allowATC){Y$2.verbose(`Skipping milestone ${g.label} as it is UI only and does not allow ATC`);continue}let d=g.items[0],y=g.reached,S=e.items.find(u=>(u.vID===d.vID||u.mID===d.mID)&&u.properties._letscooee_campaign===this.engagementTrigger.shortID);y&&(s=g,c=S),S&&n.push(S),!y&&S&&t.removeIneligibleItem?(Y$2.verbose(`Removing free gift ${S.vID} from cart`),i.push(S)):y&&!S&&(Y$2.verbose(`Adding free gift ${d.vID} to cart`),o.push(d));}t.restrictToLatestFreebie&&s&&(c?(n=n.filter(g=>g.vID!==c.vID),o=[]):o=[s.items[0]],i.push(...n)),t.treatFreebieAsSeparateLineItem?await this.handleSeparateFreebieLineItems(o,i):await this.handleCombinedCartUpdate(o,i);}async handleSeparateFreebieLineItems(e,t){if(!t.length&&!e.length)return;let n=new de$1,o=[];if(e.length){let c=this.addFreebiesOperation(e,n);o.push(c);}if(t.length){let c=this.removeFreebiesOperation(t);o.push(c);}if(!o.length)return;let i;try{i=await Promise.all(o),Y$2.log(`All freebie and coupon operations completed`);}catch(c){ke$1(c,`parallel-freebie-operations`,{engagementTrigger:this.engagementTrigger});}let s;e.length&&i?.length&&(s=i[0]),D$1.get().refreshUI(s,false);}async removeFreebiesOperation(e){let t={updates:{}};return e.forEach(n=>t.updates[n.key??n.vID]=n.quantity-1),Mr(t,this.engagementTrigger)}async addFreebiesOperation(e,t){return t.addToCart(e,this.engagementTrigger)}async handleCombinedCartUpdate(e,t){let n=this.engagementTrigger.progressBarConfig,o={},i={};t.length&&t.forEach(y=>i[y.key??y.vID]=0),e.length&&e.forEach(y=>i[y.vID]=1);let s=n.coupons,c=[];if(s?.length){c=s.map(u=>u.couponCode);let y=h.getCurrent().discount_codes?.map(u=>u.code)??[];c.every(u=>y.some(v=>v===u))||(o.discount=c.join(`,`));}if(pe$4.hasKeys(i)&&(o.updates=i),!pe$4.hasKeys(o))return;let p=await Mr(o,this.engagementTrigger),g=p?.items,d=[];for(let y of e){let S=g?.find(u=>c?.length?u.id+``===y.vID&&u.discounts?.some(v=>c.includes(v.title)):u.id+``===y.vID);S&&d.push(S);}if(!d.length){D$1.get().refreshUI(p,false);return}try{await Promise.all(d.map(y=>oo(y,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()})));}catch(y){ke$1(y,`add-private-attribute`,{engagementTrigger:this.engagementTrigger,extra:{productAddedByCooee:d}});}finally{D$1.get().refreshUI(p,false);}}};var dt$1=class dt extends G{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 mr$1=class mr extends R$1{constructor(e){super(e);}isAllOkToRender(){return !!this.engagementTrigger.content?.videoConfig}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e;this.engagementTrigger.isFloatingVideo()?e=`cooee-video-popup`:this.engagementTrigger.isVideoStory()?e=`cooee-video-stories`:e=`cooee-video-playlist`,this.createAngularWidget(e);}};var pr$1=class pr extends R$1{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-sticky-atc`);}};var dr$1=class dr extends R$1{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){let e=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(e),document.addEventListener(`letscooee:inbound:cta:add-bundle`,this.inboundCTAListener.bind(this),false);}async inboundCTAListener(e){let t=this.engagementTrigger,n=`Engagement(id: ${t.engagementID}, shortID: ${t.shortID})`,o=e.detail;if(!pe$4.hasKeys(o)){Y$2.error(`No detail received for ${n}`);return}Y$2.log(`Detail received for BYOB`,o);let i=o.campaignID??o.campaignId??o.campaign_id;if(i!==t.shortID&&i!==t.engagementID){Y$2.warn(`Current ${n} is not BYOB. Received: ${i}`);return}let s=o.items;if(!s?.length)return;let c=s.map(p=>new at$2({mID:p.product_id,vID:p.variant_id,quantity:p.quantity||1}));await new Ge$1(this.triggerContext).execute({embeddedItems:c,clickAction:{at:he$3.ADD_BUNDLE,applyDiscount:true}});}};var ur=class extends R$1{cartChangeSubscription;isProcessingAddOns=false;afterRootContainerCreated(){this.cartChangeSubscription&&!this.cartChangeSubscription.closed||this.listenCartChange();}preDestroy(){super.preDestroy(),this.cartChangeSubscription?.unsubscribe();}listenCartChange(){let e=new de$1;this.cartChangeSubscription=window.CooeeSDK.cartChange$.subscribe(async t=>{if(this.isProcessingAddOns||!this.wasCurrentItemAdded(t))return;this.isProcessingAddOns=true;let n=this.triggerContext.triggerData;Y$2.log(`${n} detected current item addition to cart`);let o=this.triggerContext.selectedItems;if(!o?.length){Y$2.log(`No add-ons selected for the current product ${n}`),this.isProcessingAddOns=false;return}Y$2.log(`Adding ${o.length} add on items in the cart`);let i=await e.addToCart(o,n);D$1.get().refreshUI(i,false),this.isProcessingAddOns=false;});}wasCurrentItemAdded(e){let t=window.CooeeSDK.runtimeData.currentItem;return t?!!e.itemsAdded?.find(n=>n.mID===t?.mID&&n.vID===t.vID):false}};var Vr=false,Wr=false,gr$1=null,fr$1=null,ao=false,Te=new Set,Ke$1=new Set;function co(){ao||(ao=true,It$2(()=>{Vn(document.body,{childList:true,subtree:true},500,Fn).subscribe(()=>{Ke$1.forEach(r=>r.rerenderIfDeleted()),Te.forEach(r=>r.rerenderIfDeleted());});}));}async function ut$1(r){if(r.length>0&&await po(),co(),Vr){Y$2.verbose(`Cart widget processing in progress, queuing latest triggers`),gr$1=r;return}Vr=true;try{gi$1(r);}finally{if(Vr=false,gr$1){let e=gr$1;gr$1=null,Y$2.verbose(`Processing queued cart triggers`),ut$1(e);}}}async function gt$1(r){if(r.length>0&&await po(),co(),Wr){Y$2.verbose(`Page widget processing in progress, queuing latest triggers`),fr$1=r;return}Wr=true;try{fi$1(r);}finally{if(Wr=false,fr$1){let e=fr$1;fr$1=null,Y$2.verbose(`Processing queued page triggers`),gt$1(e).catch(console.error);}}}function dh(){Te.forEach(r=>r.rerenderAfterCartOpened());}function gi$1(r){mo(Te,r);for(let e of r){Y$2.info(`${e} received as cart embed`);let t=lo(Te,e);if(t&&!e.isSubscriptionUpsell()){t.updateAndReRender(e).catch(o=>{ke$1(o,`update-and-re-render`,{engagementTrigger:e});});continue}Y$2.verbose(`${e} is new`);let n;if(e.isProgressBar())n=new lr$1(e);else if(e.isSubscriptionUpsell()){ar$1.renderCartUpsell(e);continue}else e.isSavingsBar()?n=new dt$1(e):n=new G(e);Te.add(n),n.renderSilently();}}function fi$1(r){mo(Ke$1,r);for(let e of r){Y$2.info(`${e} received as page embed`);let t=lo(Ke$1,e);if(t){t.updateAndReRender(e).catch(o=>{ke$1(o,`update-and-re-render`,{engagementTrigger:e});});continue}Y$2.verbose(`${e} is new`);let n;e.isVideoObjective()?n=new mr$1(e):e.isBYOB()?n=new dr$1(e):e.isStickyATC()?n=new pr$1(e):e.isSavingsBar()?n=new dt$1(e):e.isCollectionFilter()?n=new cr$1(e):e.isAddOns()?n=new ur(e):n=new R$1(e),Ke$1.add(n),n.renderSilently();}}function lo(r,e){for(let t of r)if(t.matches(e))return t}function mo(r,e){let t=new Set(e.map(n=>n.shortID));for(let n of r)t.has(n.engagementTrigger.shortID)||n.destroy();}async function po(){await(await import('./widgets-DM4_RO8i-OIujcWJE.js').then(function (n) { return n.ad; })).loadAngularWidgets();}var go=new U$1,uo=0;go.pipe(Fe$2(50)).subscribe(async r=>{hi$1(await tt()).catch(t=>{ke$1(t,`load-page-widgets`,{extra:{firstLoad:r}});});});function fo(r=false){le$2(K$1).then(()=>{go.next(r);}).catch(e=>Y$2.error(`Session not established, skipping fetchWidgets`,e));}async function so(r){let e=await tt();return Object.assign(r,e),ne$1(`/v1/engagement/get-variant`,r)}async function hi$1(r$10){uo++,uo===1?Y$2.info(`Fetch widgets (after ⏰`,Ln$1()+` of SDK load)`):Y$2.info(`Fetch widgets`);let e=r$2({},r$10);try{let t=await ne$1(`/v1/engagement/eligible`,e);Y$2.info(`Widgets fetched ${Cn(t.timeTakenMs)}`);gt$1(t.data.pageWidgets?.map(i=>new q$1(i))??[]).catch(console.error);ut$1(t.data.cartWidgets?.map(i=>new q$1(i))??[]).catch(console.error);}catch(t){Y$2.error(`Error sending widget getter`,t);}}var ho=x$3(dr$3()),hr$1=class r{static META_REQUIRED_FIELDS=[`ad_id`];static GOOGLE_REQUIRED_FIELDS=[`gad_source`,`gclid`];source;adID;campaignID;adName;campaignName;constructor(e){this.adID=e.adID,this.campaignID=e.campaignID,this.source=e.source;}static getAdParams(){let e;try{e=new ho.URLBuilder(location.href);}catch{return {}}let t={};if(this.META_REQUIRED_FIELDS.every(i=>Array.from(e.getParams().keys()).includes(i)))return t={source:`META`,adID:e.getQueryParam(`ad_id`)?.trim(),campaignID:e.getQueryParam(`campaign_id`)?.trim()},new r(t);if(this.GOOGLE_REQUIRED_FIELDS.every(i=>Array.from(e.getParams().keys()).includes(i)))return t={source:`GOOGLE`},new r(t)}};var $r={d:(r,e)=>{for(var t in e)$r.o(e,t)&&!$r.o(r,t)&&Object.defineProperty(r,t,{enumerable:true,get:e[t]});},o:(r,e)=>Object.prototype.hasOwnProperty.call(r,e)},Hr={};$r.d(Hr,{A:()=>Ci$1,k:()=>qr});var ft$1=function(r,e,t,n){return new(t||(t=Promise))(function(o,i){function s(g){try{p(n.next(g));}catch(d){i(d);}}function c(g){try{p(n.throw(g));}catch(d){i(d);}}function p(g){var d;g.done?o(g.value):(d=g.value,d instanceof t?d:new t(function(y){y(d);})).then(s,c);}p((n=n.apply(r,[])).next());})},ht$1=function(r,e){var t,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},typeof Symbol==`function`&&(i[Symbol.iterator]=function(){return this}),i;function c(p){return function(g){return (function(d){if(t)throw new TypeError(`Generator is already executing.`);for(;i&&(i=0,d[0]&&(s=0)),s;)try{if(t=1,n&&(o=2&d[0]?n.return:d[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,d[1])).done)return o;switch(n=0,o&&(d=[2&d[0],o.value]),d[0]){case 0:case 1:o=d;break;case 4:return s.label++,{value:d[1],done:!1};case 5:s.label++,n=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!((o=o.length>0&&o[o.length-1])||d[0]!==6&&d[0]!==2)){s=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]<o[3])){s.label=d[1];break}if(d[0]===6&&s.label<o[1]){s.label=o[1],o=d;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(d);break}o[2]&&s.ops.pop(),s.trys.pop();continue}d=e.call(r,s);}catch(y){d=[6,y],n=0;}finally{t=o=0;}if(5&d[0])throw d[1];return {value:d[0]?d[1]:void 0,done:true}})([p,g])}}};function qr(){return ft$1(this,void 0,Promise,function(){return ht$1(this,function(r){switch(r.label){case 0:return [4,new Promise(function(e,t){var n=`Unknown`,o=false;function i(u){o||(o=true,e({isPrivate:u,browserName:n}));}function s(){var u=0,v=parseInt(`-1`);try{v.toFixed(v);}catch(b){u=b.message.length;}return u}function c(){return navigator.msSaveBlob!==void 0&&(function(u){try{return u===eval.toString().length}catch{return false}})(39)}function p(){var u;return ft$1(this,void 0,void 0,function(){var v,b;return ht$1(this,function(f){switch(f.label){case 0:return f.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return f.sent(),i(false),[3,3];case 2:return v=f.sent(),b=v,v instanceof Error&&(b=(u=v.message)!==null&&u!==void 0?u:v),typeof b!=`string`?(i(false),[2]):(i(!!b.includes(`unknown transient reason`)),[3,3]);case 3:return [2]}})})}function g(){var u;return ft$1(this,void 0,Promise,function(){return ht$1(this,function(v){switch(v.label){case 0:return ((u=navigator.storage)===null||u===void 0?void 0:u.getDirectory)===void 0?[3,2]:[4,p()];case 1:return v.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?(function(){var b=String(Math.random());try{var f=indexedDB.open(b,1);f.onupgradeneeded=function(k){var ge=k.target.result,_=function(yr){i(yr);};try{ge.createObjectStore(`t`,{autoIncrement:!0}).put(new Blob),_(!1);}catch(yr){(yr.message||``).includes(`are not yet supported`)?_(!0):_(!1);}finally{ge.close(),indexedDB.deleteDatabase(b);}},f.onerror=function(){return i(!1)};}catch{i(false);}})():(function(){var b=window.openDatabase,f=window.localStorage;try{b(null,null,null,null);}catch{i(true);return}try{f.setItem(`test`,`1`),f.removeItem(`test`);}catch{i(true);return}i(false);})(),v.label=3;case 3:return [2]}})})}function d(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(u,v){var b;i(Math.round(v/1048576)<2*Math.round(((b=window).performance!==void 0&&b.performance.memory!==void 0&&b.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576));},function(u){t(new Error(`detectIncognito somehow failed to query storage quota: `+u.message));});}function y(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?d():(0, window.webkitRequestFileSystem)(0,1,function(){i(false);},function(){i(true);});}function S(){return ft$1(this,void 0,Promise,function(){var u,v;return ht$1(this,function(b){switch(b.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return [3,4];b.label=1;case 1:return b.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return b.sent(),i(false),[3,4];case 3:return u=b.sent(),typeof(v=u instanceof Error&&typeof u.message==`string`?u.message:String(u))!=`string`?(i(false),[2]):(i(v.includes(`Security error`)),[2]);case 4:return i(navigator.serviceWorker===void 0),[2]}})})}(function(){return ft$1(this,void 0,Promise,function(){return ht$1(this,function(u){switch(u.label){case 0:return s()!==44?[3,2]:(n=`Safari`,[4,g()]);case 1:return u.sent(),[3,6];case 2:return s()!==51?[3,3]:(v=navigator.userAgent,n=v.match(/Chrome/)?navigator.brave!==void 0?`Brave`:v.match(/Edg/)?`Edge`:v.match(/OPR/)?`Opera`:`Chrome`:`Chromium`,y(),[3,6]);case 3:return s()!==25?[3,5]:(n=`Firefox`,[4,S()]);case 4:return u.sent(),[3,6];case 5:c()?(n=`Internet Explorer`,i(window.indexedDB===void 0)):t(new Error(`detectIncognito cannot determine the browser`)),u.label=6;case 6:return [2]}var v;})})})().catch(t);})];case 1:return [2,r.sent()]}})})}typeof window<`u`&&(window.detectIncognito=qr);var Ci$1=qr,Co=Hr.A;Hr.k;var yo=x$3(Dt$2()),vo=async()=>{let r={};try{return await yi$1(r)}catch(e){return ke$1(e,`device-properties`),r}},yi$1=async r=>{let e=window.CooeeSDK.uaParser;vi$1(r),Ei$1(r),wi$1(r),r.referrer=document.referrer,r.host=location.origin,r.path=location.pathname,r.qs=location.search,r.locale=navigator.language,r.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:bi$1()},r.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(r.headless=true,Sn$1({headless:true}));let t=e.getResult();return r.browser=t.browser,r.device=t.device,r.engine=t.engine,r.cpu=t.cpu,r.os=t.os,r.navigatorUA=navigator.userAgent,await Promise.all([Ti$1(r),Ii$1(r),Pi$1(r)]),r},vi$1=r=>{let e=navigator;if(!e.deviceMemory)return;r.mem={tot:e.deviceMemory*1024};},Ei$1=r=>{let e=navigator,t=e.connection||e.mozConnection||e.webkitConnection;t?.effectiveType&&(r.net={type:t.effectiveType});},wi$1=r=>{let e=screen.orientation?.type;e&&(r.orientation=e);},bi$1=()=>{if(!document.body)return;let r=document.createElement(`div`);r.setAttribute(`style`,`height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;`),document.body.appendChild(r);let e=window.devicePixelRatio||1,t=r.offsetWidth*e;return document.body.removeChild(r),t},Ii$1=async r=>{try{await Si$1(r);}catch(e){Y$2.error(`Unable to get location`,e);}},Si$1=async r=>{if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:`geolocation`})).state!=`granted`))return new Promise(t=>{navigator.geolocation.getCurrentPosition(n=>{r.coords=[n.coords.latitude,n.coords.longitude],t();},()=>t());})},Ti$1=async r=>{if(`getBattery`in navigator)try{let t=await navigator.getBattery();r.bat={l:t.level*100,c:t.charging},Sn$1({"battery.level":r.bat.l,"battery.charging":r.bat.c});}catch{}},Pi$1=async r=>{try{(await Co())?.isPrivate&&(r.incognito=!0,Sn$1({incognito:!0}));}catch(e){yo.default.error(`Unable to detect private/incognito window`,e);}};function wo(r){if(!bo())return;let e=ge$2[r]?.toLowerCase();e&&(Y$2.verbose(`Sending ${e} intent to MS Clarity`),window.clarity(`set`,`Cooee Intent`,e));}function bo(){return window.clarity&&typeof window.clarity==`function`}var K$1=new gr$2(1),Di$1=`Store id or shop name is missing`,Cr$1;async function iC(){Y$2.info(`Begin auth after ⏰`,Ln$1(),`of JS load`);try{await xi$1(),K$1.next(!0),K$1.complete();}catch(r){r?.message?.includes(Di$1)&&ke$1(r,`initiate-session`),Y$2.error(`Unable to initiate session`,r),K$1.error(r);}}async function to(){return await So(false),Cr$1}async function sC(){let r=Date.now();await er$1.request(`gen_did`,async()=>{let e=await ce$5.get(`did`);e||(e=new $$2().toHexString(),await ce$5.set(`did`,e)),Po(e);}),Y$2.info(`Device ID set/get done ${Cn(Date.now()-r)}`);}async function Io(){if(Cr$1)return;let[r,e,t]=await Promise.all([ve$4.get(`id`,``),ce$5.get(`sessionNumber`,1),ve$4.get(`landing`,{})]);To(r,e,t);}async function xi$1(){await So(true);}async function So(r){let e=false;return await _i$1()?(await Ri$1(),e=true):await Ai$1()?(await Io(),e=true):await Io(),e?await Li$1():r&&fo(),e}async function Ri$1(){Y$2.info(`Starting new session`),await ve$4.clear();let r=new Date,e=new $$2().toHexString(),t=await ce$5.get(`sessionNumber`,0)+1,n=nr();await Promise.all([ce$5.set(`sessionNumber`,t),ve$4.set(`id`,e),ve$4.set(`lastUsedTime`,r.getTime()),ve$4.set(`landing`,n)]),To(e,t,n);}async function _i$1(){let r=await ve$4.get(`lastUsedTime`,0);return r?(new Date().getTime()-r)/1e3>1800:true}async function Ai$1(){return !await ve$4.get(`synced`,false)}async function Oi$1(){let r$11=await vo(),e=or$1();return s$2(r$2(r$2({deviceProps:r$11},Cr$1),e),{sdk:Zr$3,ad:hr$1.getAdParams(),occurred:Ni$1(We$4().jsLoadTime),properties:{}})}async function Li$1(){Y$2.info(`Ensuring session on server`),await ki$1();let r=Date.now(),e=await Oi$1();Y$2.info(`Session data generated ${Cn(Date.now()-r)}`);try{let t=await ne$1(`/v1/event/validate-session`,e);Y$2.info(`Auth finished ${Cn(t.timeTakenMs)}`),await ve$4.set(`synced`,!0),t.data.deviceID&&(await ce$5.set(`did`,t.data.deviceID),Po(t.data.deviceID));gt$1(t.data.pageWidgets?.map(i=>new q$1(i))??[]).catch(console.error);ut$1(t.data.cartWidgets?.map(i=>new q$1(i))??[]).catch(console.error);}catch(t){throw Y$2.error(t),t}}async function ki$1(){let r=await ce$5.get(`firstSeen`),e=r?new Date(r):new Date;r||await ce$5.set(`firstSeen`,e.toISOString()),Qn(e),In$1(`Visitor Info`,{first_seen:e.toISOString()});}function To(r,e,t){Sn$1({"cooee_session.number":e}),In$1(`Visitor Session`,{id:r,number:e,landing_page:t}),Y$2.info(`Session number: ${e}, id: ${r}`),Cr$1={sessionID:r,sessionNumber:e,landingPage:t};}function Po(r){Y$2.info(`Visitor ID (old):`,r),ce$5.visitorOldId=r;In$1(`Visitor Info`,{device_id:r,[`device_id_${Math.floor(Math.random()*1e4)}`]:r}),wn({id:r});}function Ni$1(r){return (new Date().getTime()-r.getTime())/1e3>1800?new Date:r}function dC(){document.onvisibilitychange=()=>{document.visibilityState===`visible`?Ui$1():document.visibilityState===`hidden`&&Mi$1();};}async function Ui$1(){}async function Mi$1(){let r=await Bi$1();if(r===0){Y$2.info(`Not sending duration as user was inactive on website`);return}xo(r);}async function Bi$1(){let r=We$4();return r.inInactive?0:(r.inInactive=true,r.lastEnterInactive=new Date,Math.max(r.lastEnterInactive.getTime()-r.lastEnterActive.getTime(),0))}function Do(){let r=We$4();return r.inInactive?(r.inInactive=false,r.lastEnterActive=new Date,Math.max((r.lastEnterActive.getTime()-r.lastEnterInactive.getTime())/1e3,0)):0}function Ro(r){if(!Fi$1()||!he$4.get().pixelPush)return;let t=ge$2[r.intent]?.toLowerCase();t&&(Y$2.verbose(`Sending ${t} intent to Facebook Pixel`),window.fbq(`trackCustom`,`CooeeIntent`,{intent_value:t}));}function Fi$1(){return window.fbq&&typeof window.fbq==`function`}var Ur=`/v1/event/track-page-unload`;function $n(r){Y$2.verbose(`Waiting for auth to send event ${r.name}`),le$2(K$1).then(()=>we$1(r)).catch(e=>Y$2.error(`Session not established, skipping trackEvent`,e));}function xo(r){le$2(K$1).then(()=>{Vi$1(r);}).catch(e=>Y$2.error(`Session not established, skipping trackPageUnload`,e));}async function Vi$1(r){let e=We$4().currentPageViewEvent;if(!e){Y$2.warn(`No page view event was stored previously`);return}let t={pageViewEventID:e.id,pageViewEventName:e.name,pageActiveTimeMS:r};Y$2.verbose(`Sending page unload`,t);try{await ne$1(Ur,t);}catch(n){throw Y$2.error(`Error sending page unload for ${e} to server`,n),n}}function we$1(r){Wi$1(r);}async function Wi$1(r){if(Y$2.verbose(`Sending event: ${r.name}`,r),Ki$1(r)){Y$2.warn(`Rejecting event ${r.name}`);return}Bn();let e=await tt();Object.assign(r,e),Do(),ve$4.set(`lastUsedTime`,new Date().getTime());let t=ji$1(r.name),n=t.toLowerCase().replace(/\s+/g,`-`);try{let o=await ne$1(`/v1/event/track/${n}`,r);Y$2.info(`Event tracked:`,t),$i$1(r)&&(We$4().currentPageViewEvent={id:r.id,name:r.name}),Hi$1(r,o.data);}catch(o){throw Y$2.error(`Error sending event ${r.name} to server`,o),o}}function $i$1(r){return on.includes(r.name)?r.name===`View Cart`?!r.properties.drawer:true:false}function Hi$1(r,e){qi$1(r,e).catch(t=>{ke$1(t,`process-popup-response`,{extra:{event:r,response:e}});}),Gi(e);}async function qi$1(r,e){if(!e.triggerData)return;let t=new q$1(e.triggerData);t.occurred=r.occurred,Y$2.log(`${t} will be shown`);let n;try{n=await rr$1(t);}catch(i){Y$2.error(`Failed to refresh the products`,i);return}t.items=n;new(await(import('./renderer-BBDW8ALE-DPka0h_m.js'))).FreeformRenderer().renderEngagement(t).catch(i=>{ke$1(i,`render-popup`,{extra:{event:r},engagementTrigger:t});});}function Gi(r){r.intent&&(wo(r.intent),Ro(r),Y$2.info(`Intent is ${ge$2[r.intent]}`));}function ji$1(r){return r.replace(`CE `,``).replace(`Trigger`,`Campaign`).replace(`Screen`,`Page`).replace(`App `,``)}function Ki$1(r){return r.trigger?.triggerID===`test`||r.trigger?.triggerID===`preview`?(Y$2.warn(`Not sending event as this is a test trigger`),true):false}
84
+ ${o}`} }`);}injectOuterCSSOnly(){let e=this.engagementTrigger.content?.outerCSS?.trim();if(!e)return;let t=this.rootContainer.id;le$4(`#${t} { ${e} }`);}isInViewport(){let e=this.rootContainer?.getBoundingClientRect();if(!e)return false;let t=window.innerHeight||document.documentElement.clientHeight,s=(Math.min(e.bottom,t)-Math.max(e.top,0))*e.width/(e.width*e.height)*100;return this.engagementTrigger.isAnySplit()?s>0:s>=30}async getWidgetContainer(e){if(this.rootContainer?.isConnected)return this.rootContainer;let t=await this.createParentElementWithPlacement(e);if(t)return t;let n=`.letscooee[data-engagement-id="${this.triggerContext.triggerData.shortID}"]`;return document.querySelector(n)}async createParentElementWithPlacement(e){let t=this.engagementTrigger.placement;if(!t?.selector)return Y$2.info(`\u26A0\uFE0F${this.engagementTrigger} does not have a selector`),null;let n=t.selector,o;if(n.includes(`:shadow`)){let p=n.split(`:shadow`);o=(await Kn$1(p[0].trim()))?.shadowRoot,n=p[1].trim(),o&&Vi$2(o,false);}Y$2.verbose(`${this.engagementTrigger} attempt to render "${t.position}" "${n}"`);let i=await Kn$1(n,3,o??document);if(!i)return Y$2.warn(`${this.engagementTrigger} no placement found with ${n}`),null;let s=this.generateParentElementID(),c=this.getParentElement(s);if(!e)return c;switch(t.position){case fe$2.BEFORE1:case fe$2.BEFORE:i.parentElement?.insertBefore(c,i);break;case fe$2.INSIDE_FIRST1:case fe$2.INSIDE_FIRST:i.insertBefore(c,i.firstChild);break;case fe$2.INSIDE_LAST1:case fe$2.INSIDE_LAST:i.appendChild(c);break;case fe$2.AFTER1:case fe$2.AFTER:default:i.parentElement?.insertBefore(c,i.nextSibling);}return c}async runChoresBeforeRender(){if(this.isExclusionWithBVariation)return;if(!this.isAllOkToRender()){Y$2.info(`\u26A0\uFE0F ${this.engagementTrigger} could not be rendered`);return}Y$2.verbose(`${this.engagementTrigger} will be rendered`);let e;try{e=await rr$1(this.engagementTrigger);}catch(t){Y$2.info(`\u203C\uFE0F${this.engagementTrigger} could not render as items failed to refresh`,t);return}if(!this.engagementTrigger.isCollectionPromoted()&&!e?.length&&this.engagementTrigger.isProductPromoted()){Y$2.info(`\u203C\uFE0F${this.engagementTrigger} could not render as no products promoted`);return}this.engagementTrigger.items=e,await this.startRendering();}updateItems(e,t){let n=this.getItemDiff(e,t),o=this.getItemDiff(t,e);t.push(...n);for(let i of o)re$1.remove(t,i);}getItemDiff(e,t){return e.filter(n=>!t.some(o=>o.selectedOrFirstVariant.value.mID===n.selectedOrFirstVariant.value.mID))}};var G=class extends R$1{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(!D$1.get().isOpen()&&We$4().pageName!==`cart`){Y$2.log(`Do not send display event as neither the cart drawer nor the cart page is open.`);return}return super.checkAndSendEvent()}};var ar$1=class r{constructor(e,t){this.engagementTrigger=e;this.element=t;this.cartItems=h.getCurrent().items;}cartItems;static renderCartUpsell(e){let t=e.placement;if(!t?.selector){Y$2.warn(`No placement available for ${e.objective}`,e.shortID);return}let n=Array.from(document.querySelectorAll(t.selector));if(!n?.length){Y$2.warn(`No placement found for ${e.objective}`,e.shortID);return}for(let o of n)new r(e,o).render();}render(){let e=this.findCartItemFromHTMLElement();if(!e||this.engagementTrigger.content?.subsUpgradeConfig?.skipSubscribedItems&&e.selling_plan_allocation)return;let t=this.engagementTrigger.items.find(d=>d.mID===e.product_id.toString());if(!t)return;let n=t.vars.find(d=>d.mID===e.id.toString());if(!n)return;let o=new dt$2(n),i=e.selling_plan_allocation?.selling_plan;if(i)for(let d of o.sellingPlans??[])d.mID===i.id.toString()&&(d.isSelected=true,o.changeSellingPlan(d));let s=new mt$3(t);s.vars=[o],s.selectedOrFirstVariant.value=o;let c=`lc-cart-item-${this.engagementTrigger.shortID}-${t.mID}`;this.element.classList.add(c);let p=new q$1(this.engagementTrigger);p.placement.selector=`.${c}`,p.items=[s];let g=new G(p);g.renderSilently(),this.watchForCartItemDeletion(g,c);}watchForCartItemDeletion(e,t){let n=new MutationObserver(o=>{o.forEach(i=>{i.removedNodes.forEach(s=>{s===this.element&&(Y$2.verbose(`${t} has been removed`),e.destroy(),n.disconnect());});});});n.observe(this.element.parentElement,{childList:true,subtree:true});}findCartItemFromHTMLElement(){let e=this.element.innerHTML;return this.cartItems.find(t=>{if(!(e.includes(t.url)||e.includes(t.variant_id))&&(!e.includes(t.product_title)||t.variant_title&&!e.includes(t.variant_title)))return false;let n=t.selling_plan_allocation?.selling_plan?.name;return !(n&&!e.includes(n))})}};var cr$1=class cr extends R$1{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-collection-filter`);}};var lr$1=class lr extends G{constructor(e){super(e);}async update(e){await super.update(e),this.engagementTrigger.progressBarConfig.update(e.progressBarConfig),await this.checkMilestoneTryCatch(),this.updateAngularWidget();}isAllOkToRender(){return !!this.engagementTrigger.progressBarConfig}async startRendering(){if(this.updateAngularWidget()){this.addToRendered();return}this.createAngularWidget(`cooee-progressbar`),await this.checkMilestoneTryCatch();}async checkMilestoneTryCatch(){try{await this.checkMilestone();}catch(e){ke$1(e,`apply-milestones`,{engagementTrigger:this.engagementTrigger});}}async checkMilestone(){let e=await h.getCurrent().getNormalisedCart(true),t=this.engagementTrigger.progressBarConfig,n=[],o=[],i=[],s,c,p=[...t.milestones];for(let g of p){if(g.rewardType!==ve$3.FREE_AUTO_GIFT)continue;if(g.isUIOnly&&!g.allowATC){Y$2.verbose(`Skipping milestone ${g.label} as it is UI only and does not allow ATC`);continue}let d=g.items[0],y=g.reached,S=e.items.find(u=>(u.vID===d.vID||u.mID===d.mID)&&u.properties._letscooee_campaign===this.engagementTrigger.shortID);y&&(s=g,c=S),S&&n.push(S),!y&&S&&t.removeIneligibleItem?(Y$2.verbose(`Removing free gift ${S.vID} from cart`),i.push(S)):y&&!S&&(Y$2.verbose(`Adding free gift ${d.vID} to cart`),o.push(d));}t.restrictToLatestFreebie&&s&&(c?(n=n.filter(g=>g.vID!==c.vID),o=[]):o=[s.items[0]],i.push(...n)),t.treatFreebieAsSeparateLineItem?await this.handleSeparateFreebieLineItems(o,i):await this.handleCombinedCartUpdate(o,i);}async handleSeparateFreebieLineItems(e,t){if(!t.length&&!e.length)return;let n=new de$1,o=[];if(e.length){let c=this.addFreebiesOperation(e,n);o.push(c);}if(t.length){let c=this.removeFreebiesOperation(t);o.push(c);}if(!o.length)return;let i;try{i=await Promise.all(o),Y$2.log(`All freebie and coupon operations completed`);}catch(c){ke$1(c,`parallel-freebie-operations`,{engagementTrigger:this.engagementTrigger});}let s;e.length&&i?.length&&(s=i[0]),D$1.get().refreshUI(s,false);}async removeFreebiesOperation(e){let t={updates:{}};return e.forEach(n=>t.updates[n.key??n.vID]=n.quantity-1),Mr(t,this.engagementTrigger)}async addFreebiesOperation(e,t){return t.addToCart(e,this.engagementTrigger)}async handleCombinedCartUpdate(e,t){let n=this.engagementTrigger.progressBarConfig,o={},i={};t.length&&t.forEach(y=>i[y.key??y.vID]=0),e.length&&e.forEach(y=>i[y.vID]=1);let s=n.coupons,c=[];if(s?.length){c=s.map(u=>u.couponCode);let y=h.getCurrent().discount_codes?.map(u=>u.code)??[];c.every(u=>y.some(v=>v===u))||(o.discount=c.join(`,`));}if(pe$4.hasKeys(i)&&(o.updates=i),!pe$4.hasKeys(o))return;let p=await Mr(o,this.engagementTrigger),g=p?.items,d=[];for(let y of e){let S=g?.find(u=>c?.length?u.id+``===y.vID&&u.discounts?.some(v=>c.includes(v.title)):u.id+``===y.vID);S&&d.push(S);}if(!d.length){D$1.get().refreshUI(p,false);return}try{await Promise.all(d.map(y=>oo(y,{properties:this.engagementTrigger.getPrivateAttributesForLineItem()})));}catch(y){ke$1(y,`add-private-attribute`,{engagementTrigger:this.engagementTrigger,extra:{productAddedByCooee:d}});}finally{D$1.get().refreshUI(p,false);}}};var dt$1=class dt extends G{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 mr$1=class mr extends R$1{constructor(e){super(e);}isAllOkToRender(){return !!this.engagementTrigger.content?.videoConfig}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}let e;this.engagementTrigger.isFloatingVideo()?e=`cooee-video-popup`:this.engagementTrigger.isVideoStory()?e=`cooee-video-stories`:e=`cooee-video-playlist`,this.createAngularWidget(e);}};var pr$1=class pr extends R$1{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){if(this.widgetElement?.isConnected){this.addToRendered();return}this.createAngularWidget(`cooee-sticky-atc`);}};var dr$1=class dr extends R$1{constructor(e){super(e);}isAllOkToRender(){return true}async startRendering(){let e=this.getParentElement(`inner-letscooee-${this.engagementTrigger.shortID}`);this.rootContainer.appendChild(e),document.addEventListener(`letscooee:inbound:cta:add-bundle`,this.inboundCTAListener.bind(this),false);}async inboundCTAListener(e){let t=this.engagementTrigger,n=`Engagement(id: ${t.engagementID}, shortID: ${t.shortID})`,o=e.detail;if(!pe$4.hasKeys(o)){Y$2.error(`No detail received for ${n}`);return}Y$2.log(`Detail received for BYOB`,o);let i=o.campaignID??o.campaignId??o.campaign_id;if(i!==t.shortID&&i!==t.engagementID){Y$2.warn(`Current ${n} is not BYOB. Received: ${i}`);return}let s=o.items;if(!s?.length)return;let c=s.map(p=>new at$2({mID:p.product_id,vID:p.variant_id,quantity:p.quantity||1}));await new Ge$1(this.triggerContext).execute({embeddedItems:c,clickAction:{at:he$3.ADD_BUNDLE,applyDiscount:true}});}};var ur=class extends R$1{cartChangeSubscription;isProcessingAddOns=false;afterRootContainerCreated(){this.cartChangeSubscription&&!this.cartChangeSubscription.closed||this.listenCartChange();}preDestroy(){super.preDestroy(),this.cartChangeSubscription?.unsubscribe();}listenCartChange(){let e=new de$1;this.cartChangeSubscription=window.CooeeSDK.cartChange$.subscribe(async t=>{if(this.isProcessingAddOns||!this.wasCurrentItemAdded(t))return;this.isProcessingAddOns=true;let n=this.triggerContext.triggerData;Y$2.log(`${n} detected current item addition to cart`);let o=this.triggerContext.selectedItems;if(!o?.length){Y$2.log(`No add-ons selected for the current product ${n}`),this.isProcessingAddOns=false;return}Y$2.log(`Adding ${o.length} add on items in the cart`);let i=await e.addToCart(o,n);D$1.get().refreshUI(i,false),this.isProcessingAddOns=false;});}wasCurrentItemAdded(e){let t=window.CooeeSDK.runtimeData.currentItem;return t?!!e.itemsAdded?.find(n=>n.mID===t?.mID&&n.vID===t.vID):false}};var Vr=false,Wr=false,gr$1=null,fr$1=null,ao=false,Te=new Set,Ke$1=new Set;function co(){ao||(ao=true,It$2(()=>{Vn(document.body,{childList:true,subtree:true},500,Fn).subscribe(()=>{Ke$1.forEach(r=>r.rerenderIfDeleted()),Te.forEach(r=>r.rerenderIfDeleted());});}));}async function ut$1(r){if(r.length>0&&await po(),co(),Vr){Y$2.verbose(`Cart widget processing in progress, queuing latest triggers`),gr$1=r;return}Vr=true;try{gi$1(r);}finally{if(Vr=false,gr$1){let e=gr$1;gr$1=null,Y$2.verbose(`Processing queued cart triggers`),ut$1(e);}}}async function gt$1(r){if(r.length>0&&await po(),co(),Wr){Y$2.verbose(`Page widget processing in progress, queuing latest triggers`),fr$1=r;return}Wr=true;try{fi$1(r);}finally{if(Wr=false,fr$1){let e=fr$1;fr$1=null,Y$2.verbose(`Processing queued page triggers`),gt$1(e).catch(console.error);}}}function dh(){Te.forEach(r=>r.rerenderAfterCartOpened());}function gi$1(r){mo(Te,r);for(let e of r){Y$2.info(`${e} received as cart embed`);let t=lo(Te,e);if(t&&!e.isSubscriptionUpsell()){t.updateAndReRender(e).catch(o=>{ke$1(o,`update-and-re-render`,{engagementTrigger:e});});continue}Y$2.verbose(`${e} is new`);let n;if(e.isProgressBar())n=new lr$1(e);else if(e.isSubscriptionUpsell()){ar$1.renderCartUpsell(e);continue}else e.isSavingsBar()?n=new dt$1(e):n=new G(e);Te.add(n),n.renderSilently();}}function fi$1(r){mo(Ke$1,r);for(let e of r){Y$2.info(`${e} received as page embed`);let t=lo(Ke$1,e);if(t){t.updateAndReRender(e).catch(o=>{ke$1(o,`update-and-re-render`,{engagementTrigger:e});});continue}Y$2.verbose(`${e} is new`);let n;e.isVideoObjective()?n=new mr$1(e):e.isBYOB()?n=new dr$1(e):e.isStickyATC()?n=new pr$1(e):e.isSavingsBar()?n=new dt$1(e):e.isCollectionFilter()?n=new cr$1(e):e.isAddOns()?n=new ur(e):n=new R$1(e),Ke$1.add(n),n.renderSilently();}}function lo(r,e){for(let t of r)if(t.matches(e))return t}function mo(r,e){let t=new Set(e.map(n=>n.shortID));for(let n of r)t.has(n.engagementTrigger.shortID)||n.destroy();}async function po(){await(await import('./widgets-CpAjP5CS-ClcfLYyf.js').then(function (n) { return n.ad; })).loadAngularWidgets();}var go=new U$1,uo=0;go.pipe(Fe$2(50)).subscribe(async r=>{hi$1(await tt()).catch(t=>{ke$1(t,`load-page-widgets`,{extra:{firstLoad:r}});});});function fo(r=false){le$2(K$1).then(()=>{go.next(r);}).catch(e=>Y$2.error(`Session not established, skipping fetchWidgets`,e));}async function so(r){let e=await tt();return Object.assign(r,e),ne$1(`/v1/engagement/get-variant`,r)}async function hi$1(r$10){uo++,uo===1?Y$2.info(`Fetch widgets (after ⏰`,Ln$1()+` of SDK load)`):Y$2.info(`Fetch widgets`);let e=r$2({},r$10);try{let t=await ne$1(`/v1/engagement/eligible`,e);Y$2.info(`Widgets fetched ${Cn(t.timeTakenMs)}`);gt$1(t.data.pageWidgets?.map(i=>new q$1(i))??[]).catch(console.error);ut$1(t.data.cartWidgets?.map(i=>new q$1(i))??[]).catch(console.error);}catch(t){Y$2.error(`Error sending widget getter`,t);}}var ho=x$3(dr$3()),hr$1=class r{static META_REQUIRED_FIELDS=[`ad_id`];static GOOGLE_REQUIRED_FIELDS=[`gad_source`,`gclid`];source;adID;campaignID;adName;campaignName;constructor(e){this.adID=e.adID,this.campaignID=e.campaignID,this.source=e.source;}static getAdParams(){let e;try{e=new ho.URLBuilder(location.href);}catch{return {}}let t={};if(this.META_REQUIRED_FIELDS.every(i=>Array.from(e.getParams().keys()).includes(i)))return t={source:`META`,adID:e.getQueryParam(`ad_id`)?.trim(),campaignID:e.getQueryParam(`campaign_id`)?.trim()},new r(t);if(this.GOOGLE_REQUIRED_FIELDS.every(i=>Array.from(e.getParams().keys()).includes(i)))return t={source:`GOOGLE`},new r(t)}};var $r={d:(r,e)=>{for(var t in e)$r.o(e,t)&&!$r.o(r,t)&&Object.defineProperty(r,t,{enumerable:true,get:e[t]});},o:(r,e)=>Object.prototype.hasOwnProperty.call(r,e)},Hr={};$r.d(Hr,{A:()=>Ci$1,k:()=>qr});var ft$1=function(r,e,t,n){return new(t||(t=Promise))(function(o,i){function s(g){try{p(n.next(g));}catch(d){i(d);}}function c(g){try{p(n.throw(g));}catch(d){i(d);}}function p(g){var d;g.done?o(g.value):(d=g.value,d instanceof t?d:new t(function(y){y(d);})).then(s,c);}p((n=n.apply(r,[])).next());})},ht$1=function(r,e){var t,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},typeof Symbol==`function`&&(i[Symbol.iterator]=function(){return this}),i;function c(p){return function(g){return (function(d){if(t)throw new TypeError(`Generator is already executing.`);for(;i&&(i=0,d[0]&&(s=0)),s;)try{if(t=1,n&&(o=2&d[0]?n.return:d[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,d[1])).done)return o;switch(n=0,o&&(d=[2&d[0],o.value]),d[0]){case 0:case 1:o=d;break;case 4:return s.label++,{value:d[1],done:!1};case 5:s.label++,n=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!((o=o.length>0&&o[o.length-1])||d[0]!==6&&d[0]!==2)){s=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]<o[3])){s.label=d[1];break}if(d[0]===6&&s.label<o[1]){s.label=o[1],o=d;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(d);break}o[2]&&s.ops.pop(),s.trys.pop();continue}d=e.call(r,s);}catch(y){d=[6,y],n=0;}finally{t=o=0;}if(5&d[0])throw d[1];return {value:d[0]?d[1]:void 0,done:true}})([p,g])}}};function qr(){return ft$1(this,void 0,Promise,function(){return ht$1(this,function(r){switch(r.label){case 0:return [4,new Promise(function(e,t){var n=`Unknown`,o=false;function i(u){o||(o=true,e({isPrivate:u,browserName:n}));}function s(){var u=0,v=parseInt(`-1`);try{v.toFixed(v);}catch(b){u=b.message.length;}return u}function c(){return navigator.msSaveBlob!==void 0&&(function(u){try{return u===eval.toString().length}catch{return false}})(39)}function p(){var u;return ft$1(this,void 0,void 0,function(){var v,b;return ht$1(this,function(f){switch(f.label){case 0:return f.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return f.sent(),i(false),[3,3];case 2:return v=f.sent(),b=v,v instanceof Error&&(b=(u=v.message)!==null&&u!==void 0?u:v),typeof b!=`string`?(i(false),[2]):(i(!!b.includes(`unknown transient reason`)),[3,3]);case 3:return [2]}})})}function g(){var u;return ft$1(this,void 0,Promise,function(){return ht$1(this,function(v){switch(v.label){case 0:return ((u=navigator.storage)===null||u===void 0?void 0:u.getDirectory)===void 0?[3,2]:[4,p()];case 1:return v.sent(),[3,3];case 2:navigator.maxTouchPoints!==void 0?(function(){var b=String(Math.random());try{var f=indexedDB.open(b,1);f.onupgradeneeded=function(k){var ge=k.target.result,_=function(yr){i(yr);};try{ge.createObjectStore(`t`,{autoIncrement:!0}).put(new Blob),_(!1);}catch(yr){(yr.message||``).includes(`are not yet supported`)?_(!0):_(!1);}finally{ge.close(),indexedDB.deleteDatabase(b);}},f.onerror=function(){return i(!1)};}catch{i(false);}})():(function(){var b=window.openDatabase,f=window.localStorage;try{b(null,null,null,null);}catch{i(true);return}try{f.setItem(`test`,`1`),f.removeItem(`test`);}catch{i(true);return}i(false);})(),v.label=3;case 3:return [2]}})})}function d(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(u,v){var b;i(Math.round(v/1048576)<2*Math.round(((b=window).performance!==void 0&&b.performance.memory!==void 0&&b.performance.memory.jsHeapSizeLimit!==void 0?performance.memory.jsHeapSizeLimit:1073741824)/1048576));},function(u){t(new Error(`detectIncognito somehow failed to query storage quota: `+u.message));});}function y(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?d():(0, window.webkitRequestFileSystem)(0,1,function(){i(false);},function(){i(true);});}function S(){return ft$1(this,void 0,Promise,function(){var u,v;return ht$1(this,function(b){switch(b.label){case 0:if(!navigator.storage||!navigator.storage.getDirectory)return [3,4];b.label=1;case 1:return b.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return b.sent(),i(false),[3,4];case 3:return u=b.sent(),typeof(v=u instanceof Error&&typeof u.message==`string`?u.message:String(u))!=`string`?(i(false),[2]):(i(v.includes(`Security error`)),[2]);case 4:return i(navigator.serviceWorker===void 0),[2]}})})}(function(){return ft$1(this,void 0,Promise,function(){return ht$1(this,function(u){switch(u.label){case 0:return s()!==44?[3,2]:(n=`Safari`,[4,g()]);case 1:return u.sent(),[3,6];case 2:return s()!==51?[3,3]:(v=navigator.userAgent,n=v.match(/Chrome/)?navigator.brave!==void 0?`Brave`:v.match(/Edg/)?`Edge`:v.match(/OPR/)?`Opera`:`Chrome`:`Chromium`,y(),[3,6]);case 3:return s()!==25?[3,5]:(n=`Firefox`,[4,S()]);case 4:return u.sent(),[3,6];case 5:c()?(n=`Internet Explorer`,i(window.indexedDB===void 0)):t(new Error(`detectIncognito cannot determine the browser`)),u.label=6;case 6:return [2]}var v;})})})().catch(t);})];case 1:return [2,r.sent()]}})})}typeof window<`u`&&(window.detectIncognito=qr);var Ci$1=qr,Co=Hr.A;Hr.k;var yo=x$3(Dt$2()),vo=async()=>{let r={};try{return await yi$1(r)}catch(e){return ke$1(e,`device-properties`),r}},yi$1=async r=>{let e=window.CooeeSDK.uaParser;vi$1(r),Ei$1(r),wi$1(r),r.referrer=document.referrer,r.host=location.origin,r.path=location.pathname,r.qs=location.search,r.locale=navigator.language,r.display={w:screen.width,h:screen.height,pd:screen.pixelDepth,dpi:bi$1()},r.win={ow:window.outerWidth,oh:window.outerHeight,iw:window.innerWidth,ih:window.innerHeight,dpr:window.devicePixelRatio},navigator.webdriver&&(r.headless=true,Sn$1({headless:true}));let t=e.getResult();return r.browser=t.browser,r.device=t.device,r.engine=t.engine,r.cpu=t.cpu,r.os=t.os,r.navigatorUA=navigator.userAgent,await Promise.all([Ti$1(r),Ii$1(r),Pi$1(r)]),r},vi$1=r=>{let e=navigator;if(!e.deviceMemory)return;r.mem={tot:e.deviceMemory*1024};},Ei$1=r=>{let e=navigator,t=e.connection||e.mozConnection||e.webkitConnection;t?.effectiveType&&(r.net={type:t.effectiveType});},wi$1=r=>{let e=screen.orientation?.type;e&&(r.orientation=e);},bi$1=()=>{if(!document.body)return;let r=document.createElement(`div`);r.setAttribute(`style`,`height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;`),document.body.appendChild(r);let e=window.devicePixelRatio||1,t=r.offsetWidth*e;return document.body.removeChild(r),t},Ii$1=async r=>{try{await Si$1(r);}catch(e){Y$2.error(`Unable to get location`,e);}},Si$1=async r=>{if(!(!navigator.geolocation||!navigator.permissions||(await navigator.permissions.query({name:`geolocation`})).state!=`granted`))return new Promise(t=>{navigator.geolocation.getCurrentPosition(n=>{r.coords=[n.coords.latitude,n.coords.longitude],t();},()=>t());})},Ti$1=async r=>{if(`getBattery`in navigator)try{let t=await navigator.getBattery();r.bat={l:t.level*100,c:t.charging},Sn$1({"battery.level":r.bat.l,"battery.charging":r.bat.c});}catch{}},Pi$1=async r=>{try{(await Co())?.isPrivate&&(r.incognito=!0,Sn$1({incognito:!0}));}catch(e){yo.default.error(`Unable to detect private/incognito window`,e);}};function wo(r){if(!bo())return;let e=ge$2[r]?.toLowerCase();e&&(Y$2.verbose(`Sending ${e} intent to MS Clarity`),window.clarity(`set`,`Cooee Intent`,e));}function bo(){return window.clarity&&typeof window.clarity==`function`}var K$1=new gr$2(1),Di$1=`Store id or shop name is missing`,Cr$1;async function iC(){Y$2.info(`Begin auth after ⏰`,Ln$1(),`of JS load`);try{await xi$1(),K$1.next(!0),K$1.complete();}catch(r){r?.message?.includes(Di$1)&&ke$1(r,`initiate-session`),Y$2.error(`Unable to initiate session`,r),K$1.error(r);}}async function to(){return await So(false),Cr$1}async function sC(){let r=Date.now();await er$1.request(`gen_did`,async()=>{let e=await ce$5.get(`did`);e||(e=new $$2().toHexString(),await ce$5.set(`did`,e)),Po(e);}),Y$2.info(`Device ID set/get done ${Cn(Date.now()-r)}`);}async function Io(){if(Cr$1)return;let[r,e,t]=await Promise.all([ve$4.get(`id`,``),ce$5.get(`sessionNumber`,1),ve$4.get(`landing`,{})]);To(r,e,t);}async function xi$1(){await So(true);}async function So(r){let e=false;return await _i$1()?(await Ri$1(),e=true):await Ai$1()?(await Io(),e=true):await Io(),e?await Li$1():r&&fo(),e}async function Ri$1(){Y$2.info(`Starting new session`),await ve$4.clear();let r=new Date,e=new $$2().toHexString(),t=await ce$5.get(`sessionNumber`,0)+1,n=nr();await Promise.all([ce$5.set(`sessionNumber`,t),ve$4.set(`id`,e),ve$4.set(`lastUsedTime`,r.getTime()),ve$4.set(`landing`,n)]),To(e,t,n);}async function _i$1(){let r=await ve$4.get(`lastUsedTime`,0);return r?(new Date().getTime()-r)/1e3>1800:true}async function Ai$1(){return !await ve$4.get(`synced`,false)}async function Oi$1(){let r$11=await vo(),e=or$1();return s$2(r$2(r$2({deviceProps:r$11},Cr$1),e),{sdk:Zr$3,ad:hr$1.getAdParams(),occurred:Ni$1(We$4().jsLoadTime),properties:{}})}async function Li$1(){Y$2.info(`Ensuring session on server`),await ki$1();let r=Date.now(),e=await Oi$1();Y$2.info(`Session data generated ${Cn(Date.now()-r)}`);try{let t=await ne$1(`/v1/event/validate-session`,e);Y$2.info(`Auth finished ${Cn(t.timeTakenMs)}`),await ve$4.set(`synced`,!0),t.data.deviceID&&(await ce$5.set(`did`,t.data.deviceID),Po(t.data.deviceID));gt$1(t.data.pageWidgets?.map(i=>new q$1(i))??[]).catch(console.error);ut$1(t.data.cartWidgets?.map(i=>new q$1(i))??[]).catch(console.error);}catch(t){throw Y$2.error(t),t}}async function ki$1(){let r=await ce$5.get(`firstSeen`),e=r?new Date(r):new Date;r||await ce$5.set(`firstSeen`,e.toISOString()),Qn(e),In$1(`Visitor Info`,{first_seen:e.toISOString()});}function To(r,e,t){Sn$1({"cooee_session.number":e}),In$1(`Visitor Session`,{id:r,number:e,landing_page:t}),Y$2.info(`Session number: ${e}, id: ${r}`),Cr$1={sessionID:r,sessionNumber:e,landingPage:t};}function Po(r){Y$2.info(`Visitor ID (old):`,r),ce$5.visitorOldId=r;In$1(`Visitor Info`,{device_id:r,[`device_id_${Math.floor(Math.random()*1e4)}`]:r}),wn({id:r});}function Ni$1(r){return (new Date().getTime()-r.getTime())/1e3>1800?new Date:r}function dC(){document.onvisibilitychange=()=>{document.visibilityState===`visible`?Ui$1():document.visibilityState===`hidden`&&Mi$1();};}async function Ui$1(){}async function Mi$1(){let r=await Bi$1();if(r===0){Y$2.info(`Not sending duration as user was inactive on website`);return}xo(r);}async function Bi$1(){let r=We$4();return r.inInactive?0:(r.inInactive=true,r.lastEnterInactive=new Date,Math.max(r.lastEnterInactive.getTime()-r.lastEnterActive.getTime(),0))}function Do(){let r=We$4();return r.inInactive?(r.inInactive=false,r.lastEnterActive=new Date,Math.max((r.lastEnterActive.getTime()-r.lastEnterInactive.getTime())/1e3,0)):0}function Ro(r){if(!Fi$1()||!he$4.get().pixelPush)return;let t=ge$2[r.intent]?.toLowerCase();t&&(Y$2.verbose(`Sending ${t} intent to Facebook Pixel`),window.fbq(`trackCustom`,`CooeeIntent`,{intent_value:t}));}function Fi$1(){return window.fbq&&typeof window.fbq==`function`}var Ur=`/v1/event/track-page-unload`;function $n(r){Y$2.verbose(`Waiting for auth to send event ${r.name}`),le$2(K$1).then(()=>we$1(r)).catch(e=>Y$2.error(`Session not established, skipping trackEvent`,e));}function xo(r){le$2(K$1).then(()=>{Vi$1(r);}).catch(e=>Y$2.error(`Session not established, skipping trackPageUnload`,e));}async function Vi$1(r){let e=We$4().currentPageViewEvent;if(!e){Y$2.warn(`No page view event was stored previously`);return}let t={pageViewEventID:e.id,pageViewEventName:e.name,pageActiveTimeMS:r};Y$2.verbose(`Sending page unload`,t);try{await ne$1(Ur,t);}catch(n){throw Y$2.error(`Error sending page unload for ${e} to server`,n),n}}function we$1(r){Wi$1(r);}async function Wi$1(r){if(Y$2.verbose(`Sending event: ${r.name}`,r),Ki$1(r)){Y$2.warn(`Rejecting event ${r.name}`);return}Bn();let e=await tt();Object.assign(r,e),Do(),ve$4.set(`lastUsedTime`,new Date().getTime());let t=ji$1(r.name),n=t.toLowerCase().replace(/\s+/g,`-`);try{let o=await ne$1(`/v1/event/track/${n}`,r);Y$2.info(`Event tracked:`,t),$i$1(r)&&(We$4().currentPageViewEvent={id:r.id,name:r.name}),Hi$1(r,o.data);}catch(o){throw Y$2.error(`Error sending event ${r.name} to server`,o),o}}function $i$1(r){return on.includes(r.name)?r.name===`View Cart`?!r.properties.drawer:true:false}function Hi$1(r,e){qi$1(r,e).catch(t=>{ke$1(t,`process-popup-response`,{extra:{event:r,response:e}});}),Gi(e);}async function qi$1(r,e){if(!e.triggerData)return;let t=new q$1(e.triggerData);t.occurred=r.occurred,Y$2.log(`${t} will be shown`);let n;try{n=await rr$1(t);}catch(i){Y$2.error(`Failed to refresh the products`,i);return}t.items=n;new(await(import('./renderer-CgBrz8zf-DPka0h_m.js'))).FreeformRenderer().renderEngagement(t).catch(i=>{ke$1(i,`render-popup`,{extra:{event:r},engagementTrigger:t});});}function Gi(r){r.intent&&(wo(r.intent),Ro(r),Y$2.info(`Intent is ${ge$2[r.intent]}`));}function ji$1(r){return r.replace(`CE `,``).replace(`Trigger`,`Campaign`).replace(`Screen`,`Page`).replace(`App `,``)}function Ki$1(r){return r.trigger?.triggerID===`test`||r.trigger?.triggerID===`preview`?(Y$2.warn(`Not sending event as this is a test trigger`),true):false}
85
85
 
86
86
  var t=class{lastWidth;lastHeight;resizeTimeout=null;debounceDelay=200;onResizeCallback;constructor(e){this.onResizeCallback=e,this.lastWidth=window.innerWidth,this.lastHeight=window.innerHeight,window.addEventListener(`resize`,this.debouncedResize),window.addEventListener(`orientationchange`,this.handleImmediateResize);}destroy(){window.removeEventListener(`resize`,this.debouncedResize),window.removeEventListener(`orientationchange`,this.handleImmediateResize);}handleImmediateResize=()=>{this.triggerResize();};debouncedResize=()=>{this.resizeTimeout!==null&&clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(()=>{this.triggerResize();},this.debounceDelay);};triggerResize(){let e=window.innerWidth,i=window.innerHeight;(i!==this.lastHeight||e!==this.lastWidth)&&(this.onResizeCallback(),this.lastWidth=e,this.lastHeight=i);}};
87
87
 
@@ -96,14 +96,14 @@ ${e.map(f=>` ${f};`).join(`
96
96
  ${Te.map(f=>` ${f};`).join(`
97
97
  `)}
98
98
  }
99
- }`),It}resolvePrimaryButtonColors(e,i){switch(this.buttons.primary.style){case `outline`:return {bg:`0 0 0 / 0`,color:e,border:e};case `ghost`:return {bg:`0 0 0 / 0`,color:e,border:`0 0 0 / 0`};default:return {bg:e,color:i,border:e}}}resolveSecondaryButtonColors(e,i,o,s){switch(this.buttons.secondaryColorScheme){case `accent`:return this.buttons.secondary.style===`filled`?{bg:s,color:e,border:s}:{bg:`0 0 0 / 0`,color:e,border:e};case `inverted`:return {bg:o,color:i,border:`0 0 0 / 0`};default:return this.buttons.secondary.style===`filled`?{bg:s,color:o,border:s}:{bg:`0 0 0 / 0`,color:o,border:o}}}};var Ye=class{apply(e){if(!e)return;le$4(new Ke(e).toCSSString());}};function Li(){let t=he$4.get();!t.gaMeasurementID||!t.gaEnabled||fr();}async function gr(){let t=await ce$5.get(`gacid`),e=await hr();if(t!==e)return await ce$5.set(`gacid`,e),e}async function fr(){let t=await gr();t&&qm({gaClientID:t});}async function hr(){let e=he$4.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(i=>{window.gtag(`get`,e,`client_id`,o=>{i(o);});})}var Mi=!!new URL(location.href).searchParams?.get(`new-brand`);async function Ni(t){(t?.enabled||Mi)&&new Ye().apply(t);}function br(t){if(!t)return t;let e=t.match(/:root\s*\{/);if(!e)return t;let i=0,o=-1;for(let s=e.index;s<t.length;s++)if(t[s]===`{`)i++;else if(t[s]===`}`&&--i===0){o=s+1;break}return o===-1?t:(t.slice(0,e.index)+t.slice(o)).trimStart()}async function St(t){Y$2.verbose(`Received store settings`,t),t.currencyCount=t.currencies?.length;let e=w.globalRef.config.update(t);Li(),D$1.initialize(),e.website&&(Mi&&(e.website.commonCSS=br(e.website.commonCSS)),wi$2(e.website.commonJS),le$4(e.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.pipe(Fe$2(10)).subscribe(async({open:i})=>{Y$2.info(`Cart drawer is now`,i?`open`:`closed`),i&&(dh(),await wr());});}function Bi(t){w.globalRef.apiURLs=t;}function Hi(t){t?.length&&t.forEach(e=>{ze$1(e.name,e.template);});}async function wr(){let t=await h.getCurrent().getNormalisedCart(),e={value:t.amount,currency:t.currency};$n(new Ir$2(`View Cart`,{items:t.items,amount:e,drawer:true}));}var Ie=class{runtimeData=We$4();meddle(){let e=w.globalRef;e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods();}exposeMethods(){let e=w.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{fo();},e.loadExperiments=()=>{Ge();},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=w.previewWidget.bind(w),e.previewPopup=w.previewPopup.bind(w),e.executeCTA=(i,o)=>{new Ge$1(i).execute(o);},e.sendEvent=i=>{$n(i);};}overwritePush(e,i){Xn$1(e,`push`,i);}meddleEvents(){this.overwritePush(w.globalRef.events,(...e)=>{this.processEvent(e[0]);}),w.globalRef.events.forEach(this.processEvent.bind(this));}meddleProfile(){this.overwritePush(w.globalRef.profile,(...e)=>{this.processProfile(e[0]);}),w.globalRef.profile.forEach(this.processProfile.bind(this));}processEvent(e){e&&(nn.includes(e[0])?w.sendEvent(e[0],e[1],r$2({occurred:this.runtimeData.jsLoadTime},e[2])):w.sendEvent(e[0],e[1],e[2]));}processProfile(e){e&&w.updateProfile(e);}meddlePage(){this.overwritePush(w.globalRef.page,(...e)=>{this.processPage(e[0]);}),w.globalRef.page.forEach(this.processPage.bind(this));}processPage(e){e.currentItem&&vr(e.currentItem),e.currency&&(We$4().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&&w.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&h.getCurrent().update(e.cart),e.configurations&&St(e.configurations),e.storeSettings&&St(e.storeSettings),e.storeBrand&&Ni(e.storeBrand),e.apiURLs&&Bi(e.apiURLs),e.widgetPartials&&Hi(e.widgetPartials),e.template&&(this.runtimeData.template=e.template),e.customContext&&(this.runtimeData.customContext=r$2(r$2({},this.runtimeData.customContext),e.customContext));}async testCartUpdate(){if(We$4().pageName!==`product`){window.alert(`This feature is only available on a product page`);return}let e=gd();if(e||(e=We$4().currentItem?.vID),!e){window.alert(`Could not find a variant to test. Please try a different product page`);return}let i=new q$1({id:`preview`,shortID:`1`,redirectBehaviour:ae$3.CART_DRAWER});await new Ge$1(new Be$1(new Date,i)).execute({clickAction:{at:he$3.ADD_TO_CART},embeddedItem:new at$2({vID:e})});}};function vr(t){let e=We$4();if(e.currentItem&&e.currentItem.vID!==t.vID){let i=new CustomEvent(`letscooee:variant-change`,{detail:{variantID:t.vID,productID:t.mID}});document.dispatchEvent(i);}e.currentItem=new at$2(t);}var le=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=`cooee`.concat(`-`);static getString(e,i){return this.getItem(e)||i}static setString(e,i){this.setItem(e,i);}static remove(e){this.removeItem(e);}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,i){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),i);}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e));}};var yr=1e3,Er=10,kt=0,Ct=new Date;function Rt(t){le.remove(`sleid`),Ct=t??new Date;}function $i(){if(window.scrollY){let t=Fi();zi(t)&&Ui(t);}It$2(()=>{xr();});}function xr(){Tr$2(window,`scroll`).pipe(Fe$2(yr),q$2(()=>{let t=Fi();if(t>100){Y$2.warn(`Received scroll percent is more than 100`,t);return}if(zi(t))return t})).subscribe(t=>{Ui(t);});}function zi(t){return Math.abs(kt-t)>=Er||kt!==t&&t===100}function Ui(t){if(t==null)return;let e={percent:t,timeMS:new Date().getTime()-Ct.getTime()};kt=t;let o=new Ir$2(`CE Scroll`,e,null,le.getString(`sleid`,``));$n(o),le.setString(`sleid`,o.id.toHexString()),Ct=new Date(o.occurred);}function Fi(){let t=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/t*100)}function Wi(){Sr();}function Sr(){let t=window.fetch;try{window.fetch=async function(e,i){try{await kr(e,i);}catch(o){ke$1(o,`modify-graphql-request`,{extra:{body:JSON.stringify(i?.body)}});}return t(e,i)};}catch(e){console.warn(`Fail to override fetch.`,`Cooee won't be able to track "Buy Now Clicked" KPI.`),Y$2.error(e);}Y$2.verbose(`Securely overwritten window.fetch method for graphql query`);}async function kr(t,e){let i=typeof t==`string`?t:t instanceof Request?t.url:``;if(!(i.includes(`graphql.json`)&&e?.method===`POST`)||!e.body)return;let o;if(typeof e.body==`string`)try{o=JSON.parse(e.body);}catch{return}else o=e.body;o?.variables?.input&&(Y$2.verbose(`Intercepted fetch request of:`,i),o?.query.includes(`cartCreate`)&&(e.body=await Cr(o),Rr()));}async function Cr(t){let e=t.variables.input.attributes??[],i=await qn$1(`Buy Now`);return t.variables.input.attributes=[...e,...i],JSON.stringify(t)}function Rr(){let t=We$4().currentItem;if(!t)return;$n(new Ir$2(`Buy Now Clicked`,{items:[t]}));}var de=class{constructor(e,i){this.selectors=e;this.eventName=i;this.selectorString=e.join(`,`);}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let i=e.currentTarget;$n(new Ir$2(this.eventName,{class:i.className||void 0,tagName:i.tagName||void 0,id:i.id||void 0})),this.removeClickListener(this.clickListenerCallback);};listenSilently(){this.listen().catch(e=>Y$2.error(e));}async listen(){this.elements=await Mr$4(this.selectorString),this.elements.forEach(e=>{e.addEventListener(`click`,this.clickListenerCallback);});}removeClickListener(e){this.elements?.forEach(i=>{i.removeEventListener(`click`,e);});}};var Xe=class t extends de{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 Je=class t extends de{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 Ir=[`.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 Vi(){It$2(()=>{Y$2.verbose(`Execution order:`,`document ready`),_r();});}function _r(){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(Ir);if(!e){Y$2.verbose(`No clickable cart checkout button found`);return}Y$2.verbose(`Clickable cart checkout button found`,e),e.click();}else t.includes(`open-cart-drawer`)&&D$1.get().open();}function ji(){window.addEventListener(`kp-modal:opened`,()=>{We$4().isGoKwikPopupOpen=true;}),window.addEventListener(`user-loggedin`,t=>{let{token:e}=t.detail;e&&Hm({goKwikToken:e});});}var w=class{static globalRef;static async initForMerchantWebsiteOnly(e){if(Y$2.info(`Initialising SDK`),ui(navigator.userAgent)){Y$2.info(`This seems to be a bot. Disabling SDK`);return}if(navigator.webdriver){Y$2.info(`This seems to be headless browser. Disabling SDK`);return}if(this.initGlobalReference(e),window.cooeeSDKPreview){new Ie().meddle();return}await sC(),iC(),new Ie().meddle(),bm(),Ge(),Tr(),dC(),Wl(),Wi(),Vi(),$i(),Je.getInstance().listenSilently(),Xe.getInstance().listenSilently(),ji(),Ar(),oo$1(),Go(),Me.remove(`conf`).catch(i=>{Y$2.error(`Fail to remove App Config from local storage`,i);});}static initGlobalReference(e){window.CooeeSDK||Xn$1(window,`CooeeSDK`,{}),this.globalRef=window.CooeeSDK,Xn$1(this.globalRef,`config`,new he$4),Xn$1(this.globalRef,`runtimeData`,{sdkLoadTime:e,jsLoadTime:new Date,lastEnterActive:new Date}),Xn$1(this.globalRef,`uaParser`,new P,true),Xn$1(this.globalRef,`cart`,h.getCurrent()),Xn$1(this.globalRef,`cartChange$`,Vl()),Xn$1(this.globalRef,`cartDrawerToggle$`,D$1.cartDrawerToggle$.asObservable()),Y$2.verbose(`Global reference initialised`),new t(()=>{this.globalRef.uaParser=new P;});}static sendEvent(e,i,o){let s=new Ir$2(e,i,o?.triggerData);o?.occurred&&(s.occurred=o.occurred),$n(s);}static updateProfile(e){for(let i in e)if(i.toLowerCase().startsWith(`ce `))throw new Error(`User property name cannot start with 'CE '`);Hm(e);}static setPageName(e){if(!e)return;let i=We$4(),o=i.pageName;if(e===o)return;if(i.pageName=e,tn.some(d=>e.includes(d))){Rt();return}let s={};o&&(s.ps=o);let p=new Ir$2(`CE Screen View`,s);p.occurred=i.jsLoadTime,$n(p),Rt(p.occurred);}static previewPopup(e,i){import('./renderer-BBDW8ALE-DPka0h_m.js').then(({FreeformRenderer:o})=>{new o(i).render(e);});}static previewWidget(e){if(!e)return;let i=new q$1(e);i.isPageWidgets()?gt$1([i]).catch(console.error):i.isCartEmbed()?ut$1([i]).catch(console.error):Y$2.error(`Unsupported widget type for preview: `+i.onsiteDeliveryType);}};function Tr(){window.CooeeSDK.cartChange$.subscribe(()=>{fo();});}function Ar(){if(window.opener){try{window.opener.postMessage({action:`COOEE_READY_FOR_PREVIEW`},`*`);}catch(t){Y$2.error(t);}window.addEventListener(`message`,t=>{if(Y$2.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`?(w.previewPopup(e.engagementTrigger),t.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},t.origin)):e.action===`WIDGET_PREVIEW`&&(w.previewWidget(e.engagementTrigger),t.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},t.origin)));});}}performance.mark(`cooee-sdk-start`);var qi=new Date;window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=true,ro$1(),no$1(),await w.initForMerchantWebsiteOnly(qi),_e$2(),performance.measure(`cooee-sdk-init`,`cooee-sdk-start`),kr$5()&&Promise.resolve().then(function () { return sdkDebugLogsFtLEObZj; }).then(({printAllDebugLogs:t})=>t(qi)));
99
+ }`),It}resolvePrimaryButtonColors(e,i){switch(this.buttons.primary.style){case `outline`:return {bg:`0 0 0 / 0`,color:e,border:e};case `ghost`:return {bg:`0 0 0 / 0`,color:e,border:`0 0 0 / 0`};default:return {bg:e,color:i,border:e}}}resolveSecondaryButtonColors(e,i,o,s){switch(this.buttons.secondaryColorScheme){case `accent`:return this.buttons.secondary.style===`filled`?{bg:s,color:e,border:s}:{bg:`0 0 0 / 0`,color:e,border:e};case `inverted`:return {bg:o,color:i,border:`0 0 0 / 0`};default:return this.buttons.secondary.style===`filled`?{bg:s,color:o,border:s}:{bg:`0 0 0 / 0`,color:o,border:o}}}};var Ye=class{apply(e){if(!e)return;le$4(new Ke(e).toCSSString());}};function Li(){let t=he$4.get();!t.gaMeasurementID||!t.gaEnabled||fr();}async function gr(){let t=await ce$5.get(`gacid`),e=await hr();if(t!==e)return await ce$5.set(`gacid`,e),e}async function fr(){let t=await gr();t&&qm({gaClientID:t});}async function hr(){let e=he$4.get().gaMeasurementID;if(!(!e||!window.gtag))return new Promise(i=>{window.gtag(`get`,e,`client_id`,o=>{i(o);});})}var Mi=!!new URL(location.href).searchParams?.get(`new-brand`);async function Ni(t){(t?.enabled||Mi)&&new Ye().apply(t);}function br(t){if(!t)return t;let e=t.match(/:root\s*\{/);if(!e)return t;let i=0,o=-1;for(let s=e.index;s<t.length;s++)if(t[s]===`{`)i++;else if(t[s]===`}`&&--i===0){o=s+1;break}return o===-1?t:(t.slice(0,e.index)+t.slice(o)).trimStart()}async function St(t){Y$2.verbose(`Received store settings`,t),t.currencyCount=t.currencies?.length;let e=w.globalRef.config.update(t);Li(),D$1.initialize(),e.website&&(Mi&&(e.website.commonCSS=br(e.website.commonCSS)),wi$2(e.website.commonJS),le$4(e.website.commonCSS)),window.CooeeSDK.cartDrawerToggle$.pipe(Fe$2(10)).subscribe(async({open:i})=>{Y$2.info(`Cart drawer is now`,i?`open`:`closed`),i&&(dh(),await wr());});}function Bi(t){w.globalRef.apiURLs=t;}function Hi(t){t?.length&&t.forEach(e=>{ze$1(e.name,e.template);});}async function wr(){let t=await h.getCurrent().getNormalisedCart(),e={value:t.amount,currency:t.currency};$n(new Ir$2(`View Cart`,{items:t.items,amount:e,drawer:true}));}var Ie=class{runtimeData=We$4();meddle(){let e=w.globalRef;e.profile=e.profile??[],e.events=e.events??[],e.page=e.page??[],this.meddlePage(),this.meddleEvents(),this.meddleProfile(),this.exposeMethods();}exposeMethods(){let e=w.globalRef;e.loadWidgets=e.loadCartWidgets=e.loadPageWidgets=()=>{fo();},e.loadExperiments=()=>{Ge();},e.testCartUpdate=this.testCartUpdate.bind(this),e.previewWidget=w.previewWidget.bind(w),e.previewPopup=w.previewPopup.bind(w),e.executeCTA=(i,o)=>{new Ge$1(i).execute(o);},e.sendEvent=i=>{$n(i);};}overwritePush(e,i){Xn$1(e,`push`,i);}meddleEvents(){this.overwritePush(w.globalRef.events,(...e)=>{this.processEvent(e[0]);}),w.globalRef.events.forEach(this.processEvent.bind(this));}meddleProfile(){this.overwritePush(w.globalRef.profile,(...e)=>{this.processProfile(e[0]);}),w.globalRef.profile.forEach(this.processProfile.bind(this));}processEvent(e){e&&(nn.includes(e[0])?w.sendEvent(e[0],e[1],r$2({occurred:this.runtimeData.jsLoadTime},e[2])):w.sendEvent(e[0],e[1],e[2]));}processProfile(e){e&&w.updateProfile(e);}meddlePage(){this.overwritePush(w.globalRef.page,(...e)=>{this.processPage(e[0]);}),w.globalRef.page.forEach(this.processPage.bind(this));}processPage(e){e.currentItem&&vr(e.currentItem),e.currency&&(We$4().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&&w.setPageName(e.pageName),e.activeExperiment&&(this.runtimeData.activeExperiments=e.activeExperiment),e.cart&&h.getCurrent().update(e.cart),e.configurations&&St(e.configurations),e.storeSettings&&St(e.storeSettings),e.storeBrand&&Ni(e.storeBrand),e.apiURLs&&Bi(e.apiURLs),e.widgetPartials&&Hi(e.widgetPartials),e.template&&(this.runtimeData.template=e.template),e.customContext&&(this.runtimeData.customContext=r$2(r$2({},this.runtimeData.customContext),e.customContext));}async testCartUpdate(){if(We$4().pageName!==`product`){window.alert(`This feature is only available on a product page`);return}let e=gd();if(e||(e=We$4().currentItem?.vID),!e){window.alert(`Could not find a variant to test. Please try a different product page`);return}let i=new q$1({id:`preview`,shortID:`1`,redirectBehaviour:ae$3.CART_DRAWER});await new Ge$1(new Be$1(new Date,i)).execute({clickAction:{at:he$3.ADD_TO_CART},embeddedItem:new at$2({vID:e})});}};function vr(t){let e=We$4();if(e.currentItem&&e.currentItem.vID!==t.vID){let i=new CustomEvent(`letscooee:variant-change`,{detail:{variantID:t.vID,productID:t.mID}});document.dispatchEvent(i);}e.currentItem=new at$2(t);}var le=class{static SESSION_STORAGE=window.sessionStorage;static SESSION_STORAGE_KEY_PREFIX=`cooee`.concat(`-`);static getString(e,i){return this.getItem(e)||i}static setString(e,i){this.setItem(e,i);}static remove(e){this.removeItem(e);}static getItem(e){return this.SESSION_STORAGE.getItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e))}static setItem(e,i){this.SESSION_STORAGE.setItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e),i);}static removeItem(e){this.SESSION_STORAGE.removeItem(this.SESSION_STORAGE_KEY_PREFIX.concat(e));}};var yr=1e3,Er=10,kt=0,Ct=new Date;function Rt(t){le.remove(`sleid`),Ct=t??new Date;}function $i(){if(window.scrollY){let t=Fi();zi(t)&&Ui(t);}It$2(()=>{xr();});}function xr(){Tr$2(window,`scroll`).pipe(Fe$2(yr),q$2(()=>{let t=Fi();if(t>100){Y$2.warn(`Received scroll percent is more than 100`,t);return}if(zi(t))return t})).subscribe(t=>{Ui(t);});}function zi(t){return Math.abs(kt-t)>=Er||kt!==t&&t===100}function Ui(t){if(t==null)return;let e={percent:t,timeMS:new Date().getTime()-Ct.getTime()};kt=t;let o=new Ir$2(`CE Scroll`,e,null,le.getString(`sleid`,``));$n(o),le.setString(`sleid`,o.id.toHexString()),Ct=new Date(o.occurred);}function Fi(){let t=window.document.body.scrollHeight,e=window.innerHeight;return Math.ceil((window.scrollY+e)/t*100)}function Wi(){Sr();}function Sr(){let t=window.fetch;try{window.fetch=async function(e,i){try{await kr(e,i);}catch(o){ke$1(o,`modify-graphql-request`,{extra:{body:JSON.stringify(i?.body)}});}return t(e,i)};}catch(e){console.warn(`Fail to override fetch.`,`Cooee won't be able to track "Buy Now Clicked" KPI.`),Y$2.error(e);}Y$2.verbose(`Securely overwritten window.fetch method for graphql query`);}async function kr(t,e){let i=typeof t==`string`?t:t instanceof Request?t.url:``;if(!(i.includes(`graphql.json`)&&e?.method===`POST`)||!e.body)return;let o;if(typeof e.body==`string`)try{o=JSON.parse(e.body);}catch{return}else o=e.body;o?.variables?.input&&(Y$2.verbose(`Intercepted fetch request of:`,i),o?.query.includes(`cartCreate`)&&(e.body=await Cr(o),Rr()));}async function Cr(t){let e=t.variables.input.attributes??[],i=await qn$1(`Buy Now`);return t.variables.input.attributes=[...e,...i],JSON.stringify(t)}function Rr(){let t=We$4().currentItem;if(!t)return;$n(new Ir$2(`Buy Now Clicked`,{items:[t]}));}var de=class{constructor(e,i){this.selectors=e;this.eventName=i;this.selectorString=e.join(`,`);}static INSTANCE;elements;selectorString;clickListenerCallback=e=>{let i=e.currentTarget;$n(new Ir$2(this.eventName,{class:i.className||void 0,tagName:i.tagName||void 0,id:i.id||void 0})),this.removeClickListener(this.clickListenerCallback);};listenSilently(){this.listen().catch(e=>Y$2.error(e));}async listen(){this.elements=await Mr$4(this.selectorString),this.elements.forEach(e=>{e.addEventListener(`click`,this.clickListenerCallback);});}removeClickListener(e){this.elements?.forEach(i=>{i.removeEventListener(`click`,e);});}};var Xe=class t extends de{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 Je=class t extends de{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 Ir=[`.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 Vi(){It$2(()=>{Y$2.verbose(`Execution order:`,`document ready`),_r();});}function _r(){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(Ir);if(!e){Y$2.verbose(`No clickable cart checkout button found`);return}Y$2.verbose(`Clickable cart checkout button found`,e),e.click();}else t.includes(`open-cart-drawer`)&&D$1.get().open();}function ji(){window.addEventListener(`kp-modal:opened`,()=>{We$4().isGoKwikPopupOpen=true;}),window.addEventListener(`user-loggedin`,t=>{let{token:e}=t.detail;e&&Hm({goKwikToken:e});});}var w=class{static globalRef;static async initForMerchantWebsiteOnly(e){if(Y$2.info(`Initialising SDK`),ui(navigator.userAgent)){Y$2.info(`This seems to be a bot. Disabling SDK`);return}if(navigator.webdriver){Y$2.info(`This seems to be headless browser. Disabling SDK`);return}if(this.initGlobalReference(e),window.cooeeSDKPreview){new Ie().meddle();return}await sC(),iC(),new Ie().meddle(),bm(),Ge(),Tr(),dC(),Wl(),Wi(),Vi(),$i(),Je.getInstance().listenSilently(),Xe.getInstance().listenSilently(),ji(),Ar(),oo$1(),Go(),Me.remove(`conf`).catch(i=>{Y$2.error(`Fail to remove App Config from local storage`,i);});}static initGlobalReference(e){window.CooeeSDK||Xn$1(window,`CooeeSDK`,{}),this.globalRef=window.CooeeSDK,Xn$1(this.globalRef,`config`,new he$4),Xn$1(this.globalRef,`runtimeData`,{sdkLoadTime:e,jsLoadTime:new Date,lastEnterActive:new Date}),Xn$1(this.globalRef,`uaParser`,new P,true),Xn$1(this.globalRef,`cart`,h.getCurrent()),Xn$1(this.globalRef,`cartChange$`,Vl()),Xn$1(this.globalRef,`cartDrawerToggle$`,D$1.cartDrawerToggle$.asObservable()),Y$2.verbose(`Global reference initialised`),new t(()=>{this.globalRef.uaParser=new P;});}static sendEvent(e,i,o){let s=new Ir$2(e,i,o?.triggerData);o?.occurred&&(s.occurred=o.occurred),$n(s);}static updateProfile(e){for(let i in e)if(i.toLowerCase().startsWith(`ce `))throw new Error(`User property name cannot start with 'CE '`);Hm(e);}static setPageName(e){if(!e)return;let i=We$4(),o=i.pageName;if(e===o)return;if(i.pageName=e,tn.some(d=>e.includes(d))){Rt();return}let s={};o&&(s.ps=o);let p=new Ir$2(`CE Screen View`,s);p.occurred=i.jsLoadTime,$n(p),Rt(p.occurred);}static previewPopup(e,i){import('./renderer-CgBrz8zf-DPka0h_m.js').then(({FreeformRenderer:o})=>{new o(i).render(e);});}static previewWidget(e){if(!e)return;let i=new q$1(e);i.isPageWidgets()?gt$1([i]).catch(console.error):i.isCartEmbed()?ut$1([i]).catch(console.error):Y$2.error(`Unsupported widget type for preview: `+i.onsiteDeliveryType);}};function Tr(){window.CooeeSDK.cartChange$.subscribe(()=>{fo();});}function Ar(){if(window.opener){try{window.opener.postMessage({action:`COOEE_READY_FOR_PREVIEW`},`*`);}catch(t){Y$2.error(t);}window.addEventListener(`message`,t=>{if(Y$2.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`?(w.previewPopup(e.engagementTrigger),t.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},t.origin)):e.action===`WIDGET_PREVIEW`&&(w.previewWidget(e.engagementTrigger),t.source?.postMessage({action:`PREVIEW_SUCCESSFUL`},t.origin)));});}}performance.mark(`cooee-sdk-start`);var qi=new Date;window.cooeeShopifyScriptLoaded||(window.cooeeShopifyScriptLoaded=true,ro$1(),no$1(),await w.initForMerchantWebsiteOnly(qi),_e$2(),performance.measure(`cooee-sdk-init`,`cooee-sdk-start`),kr$5()&&Promise.resolve().then(function () { return sdkDebugLogsDd5T8CnM; }).then(({printAllDebugLogs:t})=>t(qi)));
100
100
 
101
101
  var s=`\xA0\xA0\xA0`,l=[`/v1/engagement/cart-widgets`,`/v1/engagement/page-widgets`,`/v1/event/validate-session`];function d(e){if(e===0)return `0 B`;let i=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.floor(Math.log(e)/Math.log(i));return `${(e/Math.pow(i,r)).toFixed(2)} ${n[r]}`}function E(e){let i=performance.getEntriesByType?.(`resource`);if(i)return i.filter(n=>n.name.includes(e)).pop()}function R(){let e=performance.getEntriesByType?.(`resource`);return e?e.filter(i=>l.some(n=>i.name.includes(n))):[]}function S(e,i){if(!e){Y$2.info(`\u{1F4E6} API Resource Metrics for ${i}: Not available`);return}Y$2.info(`📦 ═══════════ API Resource Metrics ═══════════`),Y$2.info(`URL: ${i}`),Y$2.info(`Duration: ${Ue$1(e.duration)}`);let n=e.transferSize===0;if(Y$2.info(`Served from: ${n?`💾 Cache (disk/memory)`:`🌐 Network`}`),!n){Y$2.info(`Transfer size: ${d(e.transferSize)}`),Y$2.info(`Encoded size: ${d(e.encodedBodySize)}`),Y$2.info(`Decoded size: ${d(e.decodedBodySize)}`);let c=(1-e.encodedBodySize/e.decodedBodySize)*100;c>0&&Y$2.info(`Compression ratio: ${c.toFixed(1)}%`);}let r=e.redirectEnd-e.redirectStart,f=e.fetchStart-e.startTime,a=e.domainLookupEnd-e.domainLookupStart,u=e.connectEnd-e.connectStart,m=e.secureConnectionStart>0?e.connectEnd-e.secureConnectionStart:0,g=e.connectEnd===e.connectStart?e.requestStart-e.fetchStart-a:e.requestStart-e.connectEnd,T=e.responseStart-e.requestStart,P=e.responseEnd-e.responseStart;Y$2.info(`Timing breakdown (${Ue$1(e.duration)} total):`),r>0&&Y$2.info(`${s}Redirect: ${Ue$1(r)}`),f>0&&Y$2.info(`${s}Queued: ${Ue$1(f)}`),g>0&&Y$2.info(`${s}Stalled: ${Ue$1(g)}`),a>0&&Y$2.info(`${s}DNS lookup: ${Ue$1(a)}`),u>0&&Y$2.info(`${s}TCP connect: ${Ue$1(u)}`),m>0&&Y$2.info(`${s}SSL handshake: ${Ue$1(m)}`),Y$2.info(`${s}Server waiting (TTFB): ${Ue$1(T)}`),Y$2.info(`${s}Content download: ${Ue$1(P)}`);let $=e.serverTiming;if($?.length){Y$2.info(`Server-Timing:`);for(let c of $){let p=c.description||c.name;c.duration>0?Y$2.info(`${s}${p}: ${Ue$1(c.duration)}`):Y$2.info(`${s}${p}: ${c.duration}`);}}Y$2.info(`📦 ═════════════════════════════════════════════`);}function B(){let e=R();return e.length?e.map(n=>JSON.stringify(n.toJSON())).join(`
102
102
  `):``}function z(){let e=new Set;for(let n of l){let r=E(n);r?S(r,n):e.add(n);}if(!e.size||typeof PerformanceObserver>`u`)return;let i=new PerformanceObserver(n=>{for(let r of n.getEntries())for(let f of e)if(r.name.includes(f)){S(r,f),e.delete(f);break}e.size||i.disconnect();});i.observe({type:`resource`,buffered:false});}
103
103
 
104
104
  function a(i){return i?new Date(i).toLocaleString(`en-US`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,fractionalSecondDigits:3,hour12:false,timeZoneName:`short`}):`N/A`}function M(){let i=performance.getEntriesByType?.(`resource`);if(i)return i.find(o=>o.name.includes(`@letscooee/web-sdk`)&&o.name.includes(`main.min.js`))}function x(i){window.cooeeSDKPreview||(document.readyState===`complete`?setTimeout(()=>L(i),100):window.addEventListener(`load`,()=>{setTimeout(()=>L(i),100);}));}function L(i){try{N(i),z();}catch(o){console.error(`Failed to print debugging logs`,o);}}function N(i){let o=performance.getEntriesByType?.(`navigation`)?.[0],f=window.CooeeSDK?.pageLoadTime,l=M(),s=performance.timeOrigin||0,n=o?.responseEnd?s+o.responseEnd:void 0,d=s,c=o?.domContentLoadedEventEnd||0,m=o?.loadEventEnd||0,u=n&&n>0?n:f?f.getTime():0,T=n&&n>0?`HTML download complete`:`inline script execution`,S=c>0?d+c:void 0,$=m>0?d+m:void 0;Y$2.info(`⏱️ ═══════════════ Performance Timing Report ═══════════════`),Y$2.info(`📅 Absolute Timestamps (Local Time):`),Y$2.info(` Note: Inline script can execute during HTML download (incremental parsing)`),Y$2.info(``),Y$2.info(` 1. Navigation started: ${a(d)}`);let r=f?f.getTime():0;if(n&&n>0&&r?r<n?(Y$2.info(` 2. Inline script executed: ${a(r)} (during HTML parsing)`),Y$2.info(` 3. HTML download complete: ${a(n)}`)):(Y$2.info(` 2. HTML download complete: ${a(n)}`),Y$2.info(` 3. Inline script executed: ${a(r)}`)):n&&n>0?Y$2.info(` 2. HTML download complete: ${a(n)}`):r&&Y$2.info(` 2. Inline script executed: ${a(r)}`),Y$2.info(` 4. SDK module loaded: ${a(i.getTime())} (from CDN)`),S&&Y$2.info(` 5. DOMContentLoaded: ${a(S)}`),$&&Y$2.info(` 6. Page fully loaded: ${a($)}`),Y$2.info(``),Y$2.info(`⏱️ Relative Timings:`),n&&n>0&&d){let g=n-d;Y$2.info(` Shopify backend + HTML download: ${Ue$1(g)} (not Cooee SDK)`);}if(u){let g=i.getTime()-u;if(g<0){let w=r>0?r:d,b=r>0?`inline script execution`:`navigation start`,K=i.getTime()-w;Y$2.info(` SDK module load time: ${Ue$1(K)} after ${b}`),Y$2.info(` (Note: Using earlier baseline because SDK loaded before ${T})`);}else Y$2.info(` SDK module load time: ${Ue$1(g)} after ${T}`),Y$2.info(` (Baseline: ${T} at ${a(u)})`);let v=i.getTime()-d;Y$2.info(` \u{1F3AF} Total SDK load time: ${Ue$1(v)} (from navigation start to SDK ready)`);}c&&c>0&&Y$2.info(` DOMContentLoaded: ${Ue$1(c)} after navigation start`),m&&m>0&&Y$2.info(` Page fully loaded: ${Ue$1(m)} after navigation start`),C(l),Y$2.info(`⏱️ ═══════════════════════════════════════════════════════`);}function C(i){if(!i){Y$2.info(``),Y$2.info(`📦 SDK Resource Metrics: Not available`);return}Y$2.info(``),Y$2.info(`📦 SDK Resource Metrics:`),Y$2.info(` URL: ${i.name}`),Y$2.info(` Download duration: ${Ue$1(i.duration)}`);let o=i.transferSize===0;if(Y$2.info(` Served from: ${o?`💾 Cache (disk/memory)`:`🌐 Network`}`),!o){Y$2.info(` Transfer size: ${d(i.transferSize)}`),Y$2.info(` Encoded size: ${d(i.encodedBodySize)}`),Y$2.info(` Decoded size: ${d(i.decodedBodySize)}`);let f=(1-i.encodedBodySize/i.decodedBodySize)*100;f>0&&Y$2.info(` Compression ratio: ${f.toFixed(1)}%`);}if(i.domainLookupEnd>0){let f=i.domainLookupEnd-i.domainLookupStart,l=i.connectEnd-i.connectStart,s=i.responseStart-i.requestStart,n=i.responseEnd-i.responseStart;Y$2.info(` Timing breakdown:`),f>0&&Y$2.info(` DNS lookup: ${Ue$1(f)}`),l>0&&Y$2.info(` TCP connect: ${Ue$1(l)}`),s>0&&Y$2.info(` Request: ${Ue$1(s)}`),n>0&&Y$2.info(` Response: ${Ue$1(n)}`);}}
105
105
 
106
- var sdkDebugLogsFtLEObZj = /*#__PURE__*/Object.freeze({
106
+ var sdkDebugLogsDd5T8CnM = /*#__PURE__*/Object.freeze({
107
107
  __proto__: null,
108
108
  printAllDebugLogs: x
109
109
  });
@@ -1,6 +1,6 @@
1
1
  import './main.min.js';
2
- import { m as g, W, G as Ge, K as Ke, c as cf, y as ye, X as Xa, g as gv, n as ec, o as Nf, C as Cf } from './widgets-DM4_RO8i-OIujcWJE.js';
3
- import { l, f } from './video-detail-dialog.component-jmVWh0jX-DdeLnGjA.js';
2
+ import { m as g, W, G as Ge, K as Ke, c as cf, y as ye, X as Xa, g as gv, n as ec, o as Nf, C as Cf } from './widgets-CpAjP5CS-ClcfLYyf.js';
3
+ import { l, f } from './video-detail-dialog.component-BeKaHHG2-BgDFixB0.js';
4
4
 
5
5
  var _=class d{dialogRef=g(W);eventData=g(Ge);triggerData=g(Ke)().triggerData;onShareAndClose(p,o){p.stopPropagation();let{url:t,text:a}=l(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;}o&&f(this.triggerData,this.eventData.video,this.eventData.index,o),this.dialogRef.close();}static ɵfac=function(o){return new(o||d)};static ɵcmp=cf({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&&(Xa(0,`div`,0)(1,`div`,1)(2,`h3`),gv(3,`Share`),ec(),Xa(4,`button`,2),Nf(`click`,function(e){return t.onShareAndClose(e)}),Cf(5,`cooee-icon`,3),ec()(),Xa(6,`div`,4)(7,`button`,5),Nf(`click`,function(e){return t.onShareAndClose(e,`Whatsapp`)}),Cf(8,`cooee-icon`,6),Xa(9,`span`),gv(10,`Whatsapp`),ec()(),Xa(11,`button`,7),Nf(`click`,function(e){return t.onShareAndClose(e,`X(Twitter)`)}),Cf(12,`cooee-icon`,8),Xa(13,`span`),gv(14,`X`),ec()(),Xa(15,`button`,9),Nf(`click`,function(e){return t.onShareAndClose(e,`Clipboard`)}),Cf(16,`cooee-icon`,10),Xa(17,`span`),gv(18,`Copy link`),ec()()()());},dependencies:[ye],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}`]})};
6
6
 
@@ -1,14 +1,14 @@
1
1
  import { I as Ir, V as Ve, H as He, s as se, M, t, D as Dr, l as l$1, O, a as Vi, c as ce, Y, b as V } from './main.min.js';
2
- import { L as Lt, m as g, p as Ye, S as Se$1, G as Ge, W, c as cf, r as Wt, s as Gt, z as zt, x as xE, u as AE, $ as $t, U as Ut, y as ye, X as Xa, o as Nf, v as nc, N as ND, w as Yo, n as ec, B as pf, D as zD, E as Ef, f as fd, e as AD, H as oc, I as kf, J as Ff, O as oN, P as Ro, K as Ke, Q as zt$1, C as Cf, i as iN, T as ws, q as qo, t as tc, Z as Zo, V as ic, _ as vf, a0 as FD, a1 as TD, a2 as gu, a3 as mu, a4 as VD, a5 as SD, a6 as wf, a7 as Cv, a8 as Kf, a9 as Qf, aa as Dv, ab as xv, ac as rm } from './widgets-DM4_RO8i-OIujcWJE.js';
2
+ import { L as Lt, m as g, p as Ye, S as Se$1, G as Ge, W, c as cf, r as Wt, s as Gt, z as zt, x as xE, u as AE, $ as $t, U as Ut, y as ye, X as Xa, o as Nf, v as nc, N as ND, w as Yo, n as ec, B as pf, D as zD, E as Ef, f as fd, e as AD, H as oc, I as kf, J as Ff, O as oN, P as Ro, K as Ke, Q as zt$1, C as Cf, i as iN, T as ws, q as qo, t as tc, Z as Zo, V as ic, _ as vf, a0 as FD, a1 as TD, a2 as gu, a3 as mu, a4 as VD, a5 as SD, a6 as wf, a7 as Cv, a8 as Kf, a9 as Qf, aa as Dv, ab as xv, ac as rm } from './widgets-CpAjP5CS-ClcfLYyf.js';
3
3
 
4
4
  var f=(t,e,o,r)=>{if(!e)return;let i=new Ir(`CE Video Shared`,{current:{videoID:e.id,videoIndex:o},platform:r},t);window.CooeeSDK.sendEvent(i);},l=(t,e,o=true)=>{let r=o?encodeURIComponent(m(t,e)):m(t,e),n=`Hey! Check out this video for an amazing product -`;return {url:r,text:o?encodeURIComponent(n):n}},m=(t,e)=>{return Ve(He(window.location.href,t),e)};
5
5
 
6
- var S=class n{video=iN.required();progress=Lt(0);constructor(){ws(t=>{let e=this.video(),i=()=>{this.progress.set(e.currentTime/e.duration*100);};e.addEventListener(`timeupdate`,i),t(()=>{e.removeEventListener(`timeupdate`,i);});});}static ɵfac=function(e){return new(e||n)};static ɵcmp=cf({type:n,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(e,i){e&1&&(qo(0,`div`,0)(1,`div`,1),tc(2,`div`),Zo()()),e&2&&(fd(),ic(`width`,i.progress(),`%`),vf(`aria-valuenow`,i.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 P=class n{dialogState=oN();dialog=g(Ro);triggerData=g(Ke)().triggerData;eventData=g(Ge);containerRef=g(zt$1);async share(t){t.stopPropagation(),t.preventDefault(),M()&&V()?await this.shareNative():await this.shareWithDialog();}async shareNative(){let t=l(this.triggerData,this.eventData.video,false);await navigator.share(t),f(this.triggerData,this.eventData.video,this.eventData.index,`Native`);}async shareWithDialog(){let t=await import('./share-dialog.component-Bb7Z6r-0-CCgBMtaS.js');this.dialogState.emit(true),this.dialog.open(t.ShareDialogComponent,{viewContainerRef:this.containerRef}).closed.subscribe(()=>this.dialogState.emit(false));}static ɵfac=function(e){return new(e||n)};static ɵcmp=cf({type:n,selectors:[[`cooee-share-button`]],outputs:{dialogState:`dialogState`},decls:2,vars:0,consts:[[`type`,`button`,`aria-label`,`Share video`,3,`click`],[`name`,`share`]],template:function(e,i){e&1&&(Xa(0,`button`,0),Nf(`click`,function(r){return i.share(r)}),Cf(1,`cooee-icon`,1),ec());},dependencies:[ye],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 Te=[`swiperComp`],Ie=[`videoEl`],Se=(n,t)=>t.video.id,Pe=(n,t)=>t.url;function ke(n,t){n&1&&(Xa(0,`div`,11),Cf(1,`div`,15),ec());}function Me(n,t){if(n&1&&Cf(0,`source`,13),n&2){let e=t.$implicit;Ef(`type`,Cv(e.mimeType))(`src`,e.url);}}function Oe(n,t){n&1&&wf(0);}function Ne(n,t){if(n&1){let e=FD();Xa(0,`cooee-video-promoted-items`,24),Nf(`cardClick`,function(o){gu(e);let r=VD(2).$implicit;return mu(VD().productCardClicked(o,r.video))}),ec();}if(n&2){let e=VD(2).$implicit;Ef(`items`,e.video.items);}}function ze(n,t){if(n&1&&Cf(0,`cooee-video-card`,23),n&2){let e=VD(2).$implicit;Ef(`card`,e.video.card);}}function Fe(n,t){if(n&1){let e=FD();Cf(0,`cooee-video-progress-bar`,16),Xa(1,`div`,17)(2,`cooee-mute-toggle`,18),Kf(`mutedChange`,function(o){gu(e);let r=VD(2);return Dv(r.muted,o)||(r.muted=o),mu(o)}),Nf(`toggled`,function(){gu(e);return mu(VD(2).muteToggled())}),ec(),pf(3,Oe,1,0,`ng-container`,8),ec(),Xa(4,`div`,19)(5,`cooee-share-button`,20),Nf(`dialogState`,function(o){gu(e);return mu(VD(2).shareDialogOpen.set(o))}),ec()(),Xa(6,`div`,21),TD(7,Ne,1,1,`cooee-video-promoted-items`,22)(8,ze,1,1,`cooee-video-card`,23),ec();}if(n&2){let e=VD().$implicit,i=zD(5),o=VD(),r=zD(9);Ef(`video`,i),fd(2),Qf(`muted`,o.muted),Ef(`videoEl`,i),fd(),Ef(`ngTemplateOutlet`,r),fd(4),SD(e.video.items.length&&o.videoConfig.showItems()?7:e.video.card&&o.videoConfig.footerContent===o.VideoConfigFooterContent.CARD?8:-1);}}function Le(n,t){if(n&1){let e=FD();Xa(0,`cooee-item-detail`,25),Nf(`closeClick`,function(){gu(e);return mu(VD(2).productModalClosed())}),ec();}if(n&2){let e=VD(2);Ef(`item`,e.selectedItem)(`similarItems`,e.selectedVideo.items)(`template`,e.videoConfig.itemDetailConfig.template);}}function Re(n,t){if(n&1){let e=FD();Xa(0,`div`,6)(1,`div`,9)(2,`div`,10),TD(3,ke,2,0,`div`,11),Xa(4,`video`,12,2),Nf(`click`,function(){let o=gu(e).$index,r=VD();return mu(r.currentIndex===o&&r.toggleMute())})(`ended`,function(){gu(e);let o=zD(5);return mu(VD().onVideoEnded(o))})(`loadstart`,function(){let o=gu(e).$index;return mu(VD().onVideoLoadStart(o))})(`canplay`,function(){let o=gu(e).$index;return mu(VD().onVideoCanPlay(o))}),ND(6,Me,1,3,`source`,13,Pe),ec(),TD(8,Fe,9,5),ec(),TD(9,Le,1,3,`cooee-item-detail`,14),ec()();}if(n&2){let e=t.$implicit,i=t.$index,o=VD();fd(2),ic(`background-image`,e.video.thumbnail?`url(`+e.video.thumbnail+`)`:null),fd(),SD(o.shouldShowVideoSpinner(i)?3:-1),fd(),Ef(`ngClass`,o.viewTemplateClassName)(`muted`,true),vf(`preload`,o.isVideoVisible(i)?`metadata`:`none`)(`data-video-id`,e.video.id)(`autoplay`,null),fd(2),AD(e.video.sources),fd(2),SD(o.currentIndex===i?8:-1),fd(),SD(o.selectedItem&&o.currentIndex===i?9:-1);}}function Ae(n,t){n&1&&wf(0);}function Be(n,t){if(n&1){let e=FD();Xa(0,`button`,26),Nf(`click`,function(){gu(e);return mu(VD().close())}),Cf(1,`cooee-icon`,27),ec();}}var Ee=class n{swiperComponent;videoElements;VideoConfigFooterContent=se;currentIndex=0;muted=Lt(false);selectedItem=null;selectedVideo;detailPopupTemplate;viewTemplateClassName=`lc-video-only-view`;shareDialogOpen=Lt(false);data=g(Ye);elementRef=g(Se$1);eventData=g(Ge);dialogRef=g(W);swiperInitialized=Lt(false);swiperOptions=Lt(null);videoEntries=[];videoConfig;triggerContext;engagementTrigger;isMobile=M();navigationConfig;cssLoadedPromise;resizeDebouncer=new t(this.onResize.bind(this));videoLoadingStates=new Map;constructor(){this.videoEntries=this.data.videoEntries,this.currentIndex=this.data.currentIndex,this.selectedItem=this.data.selectedItem??null,this.selectedVideo=this.videoEntries[this.currentIndex]?.video,this.triggerContext=this.data.triggerContext,this.engagementTrigger=this.triggerContext.triggerData,this.videoConfig=this.engagementTrigger?.content?.videoConfig??new Dr,this.navigationConfig=new l$1({enabled:true,size:50,color:new O({h:`#000000`})}),this.cssLoadedPromise=Vi(this.elementRef.nativeElement.shadowRoot);}onKeyDown(t){t.preventDefault(),t.stopPropagation(),this.close();}async ngOnInit(){switch(this.muted.set(await ce.get(`muted`,false)),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(false);}close(){let t=this.getCurrentVideoElement();this.dialogRef.close({lastVideo:this.videoEntries[this.currentIndex].video,lastVideoIndex:this.currentIndex,lastVideoDuration:t?.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(t=>t.nativeElement.pause());}toggleMute(){this.muted.update(t=>!t);}async muteToggled(){await ce.set(`muted`,this.muted());let e=[this.muted()?`CE Video Muted`:`CE Video Unmuted`,{current:this.currentVideoProps()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(e);}playActiveVideo(t=true){t&&this.pauseAll();let e=this.getCurrentVideoElement();e&&this.playVideo(e);}playVideo(t){t.currentTime=0,t.play().catch(e=>Y.error(e));}onVideoEnded(t){if(this.currentIndex<this.videoEntries.length-1)this.selectedItem||this.shareDialogOpen()?this.playVideo(t):this.moveToNextVideo();else {let i=[`CE Last Video Ended`,{previous:this.getPreviousVideoDataForEvent()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(i),this.playVideo(t);}}onSlideChange(t){let e=this.getPreviousVideoDataForEvent();this.currentIndex=t.realIndex,this.selectedVideo=this.videoEntries[this.currentIndex].video,this.eventData.video=this.selectedVideo,this.eventData.index=this.currentIndex,this.playActiveVideo(),this.isProductDetailView()?this.selectItemForDetailView():this.selectedItem=null;let r=new Ir(`CE Video Changed`,{previous:e,current:this.currentVideoProps()},this.engagementTrigger);r.setVideos(this.videoEntries[this.currentIndex].video),window.CooeeSDK.sendEvent(r);}productCardClicked(t,e){let o=new Ir(`CE More Item Info Clicked`,{current:{videoID:e.id,videoIndex:this.currentIndex}},this.engagementTrigger);o.setVideos(e),window.CooeeSDK.sendEvent(o),this.selectedItem=t;}onVideoLoadStart(t){this.videoLoadingStates.set(t,true);}onVideoCanPlay(t){this.videoLoadingStates.set(t,false);}shouldShowVideoSpinner(t){return this.swiperInitialized()?this.videoLoadingStates.get(t)===true&&this.isVideoVisible(t):this.isVideoVisible(t)}isVideoVisible(t){let e=this.currentIndex-1,i=this.currentIndex+1;return t===this.currentIndex||t===e||t===i}async initSwiperOptions(){await this.cssLoadedPromise;let t=this.isMobile?1:`auto`,e=0;this.isProductDetailView()&&(t=`auto`,e=10),this.swiperOptions.set({direction:this.isMobile?`vertical`:`horizontal`,effect:this.isMobile?`slide`:`coverflow`,slidesPerView:t,initialSlide:this.currentIndex,centeredSlides:true,spaceBetween:e,coverflowEffect:{rotate:0,stretch:0,depth:400,modifier:1,slideShadows:false},on:{init:i=>{this.swiperInitialized.set(true),setTimeout(()=>{i.update();},100);}},mousewheel:{enabled:!this.isMobile,invert:false,thresholdDelta:20}});}isProductDetailView(){return this.videoConfig.detailPopup.template===`PRODUCT_DETAIL_VIEW`}currentVideoProps(){return {videoID:this.videoEntries[this.currentIndex].video.id,videoIndex:this.currentIndex}}getPreviousVideoDataForEvent(){let t=this.currentVideoProps(),e=this.videoElements.find(o=>o.nativeElement.dataset.videoId===this.videoEntries[this.currentIndex].video.id)?.nativeElement;t.playedTillMS=Math.ceil(e?.currentTime*1e3);let i=e?.duration*1e3;return t.playedTillPercent=+(t.playedTillMS/i).toFixed(4),t}selectItemForDetailView(){this.selectedItem=this.isMobile?null:this.selectedVideo?.items?.[0]??null;}applyOptimalVideoDimensions(){if(this.isMobile||this.isProductDetailView())return;let t=this.calculateOptimalVideoDimensions();t&&this.setVideoContainerDimensions(t.width,t.height);}calculateOptimalVideoDimensions(){let t=this.videoEntries.map(u=>u.video.sources?.[0]).filter(u=>u?.width&&u?.height).map(u=>({width:u.width,height:u.height,aspectRatio:u.width/u.height}));if(t.length===0)return null;let e=t[0],i=window.innerWidth*.9,o=window.innerHeight*.9,r=i/e.width,k=o/e.height,A=Math.min(r,k);return {width:Math.floor(e.width*A),height:Math.floor(e.height*A)}}setVideoContainerDimensions(t,e){let i=this.elementRef.nativeElement;i.style.setProperty(`--video-container-width`,`${t}px`),i.style.setProperty(`--video-container-height`,`${e}px`);}onResize(){this.applyOptimalVideoDimensions();}static ɵfac=function(e){return new(e||n)};static ɵcmp=cf({type:n,selectors:[[`cooee-video-detail-dialog`]],viewQuery:function(e,i){if(e&1&&oc(Te,7)(Ie,5),e&2){let o;kf(o=Ff())&&(i.swiperComponent=o.first),kf(o=Ff())&&(i.videoElements=o);}},hostAttrs:[1,`letscooee-widget`],hostBindings:function(e,i){e&1&&Nf(`keydown.escape`,function(r){return i.onKeyDown(r)},rm);},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(e,i){if(e&1&&(Xa(0,`div`,3)(1,`cooee-swiper`,4,0),Nf(`slideChange`,function(r){return i.onSlideChange(r)}),nc(3,5),ND(4,Re,10,10,`div`,6,Se),Yo(),ec(),Xa(6,`div`,7),pf(7,Ae,1,0,`ng-container`,8),ec()(),pf(8,Be,2,0,`ng-template`,null,1,xv)),e&2){let o=zD(9);Ef(`ngClass`,i.viewTemplateClassName),fd(),Ef(`options`,i.swiperOptions())(`navigationConfig`,i.navigationConfig),fd(3),AD(i.videoEntries),fd(3),Ef(`ngTemplateOutlet`,o);}},dependencies:[Wt,Gt,zt,P,S,xE,AE,$t,Ut,ye],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}
6
+ var S=class n{video=iN.required();progress=Lt(0);constructor(){ws(t=>{let e=this.video(),i=()=>{this.progress.set(e.currentTime/e.duration*100);};e.addEventListener(`timeupdate`,i),t(()=>{e.removeEventListener(`timeupdate`,i);});});}static ɵfac=function(e){return new(e||n)};static ɵcmp=cf({type:n,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(e,i){e&1&&(qo(0,`div`,0)(1,`div`,1),tc(2,`div`),Zo()()),e&2&&(fd(),ic(`width`,i.progress(),`%`),vf(`aria-valuenow`,i.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 P=class n{dialogState=oN();dialog=g(Ro);triggerData=g(Ke)().triggerData;eventData=g(Ge);containerRef=g(zt$1);async share(t){t.stopPropagation(),t.preventDefault(),M()&&V()?await this.shareNative():await this.shareWithDialog();}async shareNative(){let t=l(this.triggerData,this.eventData.video,false);await navigator.share(t),f(this.triggerData,this.eventData.video,this.eventData.index,`Native`);}async shareWithDialog(){let t=await import('./share-dialog.component-skvWADOf-ChxCb945.js');this.dialogState.emit(true),this.dialog.open(t.ShareDialogComponent,{viewContainerRef:this.containerRef}).closed.subscribe(()=>this.dialogState.emit(false));}static ɵfac=function(e){return new(e||n)};static ɵcmp=cf({type:n,selectors:[[`cooee-share-button`]],outputs:{dialogState:`dialogState`},decls:2,vars:0,consts:[[`type`,`button`,`aria-label`,`Share video`,3,`click`],[`name`,`share`]],template:function(e,i){e&1&&(Xa(0,`button`,0),Nf(`click`,function(r){return i.share(r)}),Cf(1,`cooee-icon`,1),ec());},dependencies:[ye],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 Te=[`swiperComp`],Ie=[`videoEl`],Se=(n,t)=>t.video.id,Pe=(n,t)=>t.url;function ke(n,t){n&1&&(Xa(0,`div`,11),Cf(1,`div`,15),ec());}function Me(n,t){if(n&1&&Cf(0,`source`,13),n&2){let e=t.$implicit;Ef(`type`,Cv(e.mimeType))(`src`,e.url);}}function Oe(n,t){n&1&&wf(0);}function Ne(n,t){if(n&1){let e=FD();Xa(0,`cooee-video-promoted-items`,24),Nf(`cardClick`,function(o){gu(e);let r=VD(2).$implicit;return mu(VD().productCardClicked(o,r.video))}),ec();}if(n&2){let e=VD(2).$implicit;Ef(`items`,e.video.items);}}function ze(n,t){if(n&1&&Cf(0,`cooee-video-card`,23),n&2){let e=VD(2).$implicit;Ef(`card`,e.video.card);}}function Fe(n,t){if(n&1){let e=FD();Cf(0,`cooee-video-progress-bar`,16),Xa(1,`div`,17)(2,`cooee-mute-toggle`,18),Kf(`mutedChange`,function(o){gu(e);let r=VD(2);return Dv(r.muted,o)||(r.muted=o),mu(o)}),Nf(`toggled`,function(){gu(e);return mu(VD(2).muteToggled())}),ec(),pf(3,Oe,1,0,`ng-container`,8),ec(),Xa(4,`div`,19)(5,`cooee-share-button`,20),Nf(`dialogState`,function(o){gu(e);return mu(VD(2).shareDialogOpen.set(o))}),ec()(),Xa(6,`div`,21),TD(7,Ne,1,1,`cooee-video-promoted-items`,22)(8,ze,1,1,`cooee-video-card`,23),ec();}if(n&2){let e=VD().$implicit,i=zD(5),o=VD(),r=zD(9);Ef(`video`,i),fd(2),Qf(`muted`,o.muted),Ef(`videoEl`,i),fd(),Ef(`ngTemplateOutlet`,r),fd(4),SD(e.video.items.length&&o.videoConfig.showItems()?7:e.video.card&&o.videoConfig.footerContent===o.VideoConfigFooterContent.CARD?8:-1);}}function Le(n,t){if(n&1){let e=FD();Xa(0,`cooee-item-detail`,25),Nf(`closeClick`,function(){gu(e);return mu(VD(2).productModalClosed())}),ec();}if(n&2){let e=VD(2);Ef(`item`,e.selectedItem)(`similarItems`,e.selectedVideo.items)(`template`,e.videoConfig.itemDetailConfig.template);}}function Re(n,t){if(n&1){let e=FD();Xa(0,`div`,6)(1,`div`,9)(2,`div`,10),TD(3,ke,2,0,`div`,11),Xa(4,`video`,12,2),Nf(`click`,function(){let o=gu(e).$index,r=VD();return mu(r.currentIndex===o&&r.toggleMute())})(`ended`,function(){gu(e);let o=zD(5);return mu(VD().onVideoEnded(o))})(`loadstart`,function(){let o=gu(e).$index;return mu(VD().onVideoLoadStart(o))})(`canplay`,function(){let o=gu(e).$index;return mu(VD().onVideoCanPlay(o))}),ND(6,Me,1,3,`source`,13,Pe),ec(),TD(8,Fe,9,5),ec(),TD(9,Le,1,3,`cooee-item-detail`,14),ec()();}if(n&2){let e=t.$implicit,i=t.$index,o=VD();fd(2),ic(`background-image`,e.video.thumbnail?`url(`+e.video.thumbnail+`)`:null),fd(),SD(o.shouldShowVideoSpinner(i)?3:-1),fd(),Ef(`ngClass`,o.viewTemplateClassName)(`muted`,true),vf(`preload`,o.isVideoVisible(i)?`metadata`:`none`)(`data-video-id`,e.video.id)(`autoplay`,null),fd(2),AD(e.video.sources),fd(2),SD(o.currentIndex===i?8:-1),fd(),SD(o.selectedItem&&o.currentIndex===i?9:-1);}}function Ae(n,t){n&1&&wf(0);}function Be(n,t){if(n&1){let e=FD();Xa(0,`button`,26),Nf(`click`,function(){gu(e);return mu(VD().close())}),Cf(1,`cooee-icon`,27),ec();}}var Ee=class n{swiperComponent;videoElements;VideoConfigFooterContent=se;currentIndex=0;muted=Lt(false);selectedItem=null;selectedVideo;detailPopupTemplate;viewTemplateClassName=`lc-video-only-view`;shareDialogOpen=Lt(false);data=g(Ye);elementRef=g(Se$1);eventData=g(Ge);dialogRef=g(W);swiperInitialized=Lt(false);swiperOptions=Lt(null);videoEntries=[];videoConfig;triggerContext;engagementTrigger;isMobile=M();navigationConfig;cssLoadedPromise;resizeDebouncer=new t(this.onResize.bind(this));videoLoadingStates=new Map;constructor(){this.videoEntries=this.data.videoEntries,this.currentIndex=this.data.currentIndex,this.selectedItem=this.data.selectedItem??null,this.selectedVideo=this.videoEntries[this.currentIndex]?.video,this.triggerContext=this.data.triggerContext,this.engagementTrigger=this.triggerContext.triggerData,this.videoConfig=this.engagementTrigger?.content?.videoConfig??new Dr,this.navigationConfig=new l$1({enabled:true,size:50,color:new O({h:`#000000`})}),this.cssLoadedPromise=Vi(this.elementRef.nativeElement.shadowRoot);}onKeyDown(t){t.preventDefault(),t.stopPropagation(),this.close();}async ngOnInit(){switch(this.muted.set(await ce.get(`muted`,false)),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(false);}close(){let t=this.getCurrentVideoElement();this.dialogRef.close({lastVideo:this.videoEntries[this.currentIndex].video,lastVideoIndex:this.currentIndex,lastVideoDuration:t?.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(t=>t.nativeElement.pause());}toggleMute(){this.muted.update(t=>!t);}async muteToggled(){await ce.set(`muted`,this.muted());let e=[this.muted()?`CE Video Muted`:`CE Video Unmuted`,{current:this.currentVideoProps()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(e);}playActiveVideo(t=true){t&&this.pauseAll();let e=this.getCurrentVideoElement();e&&this.playVideo(e);}playVideo(t){t.currentTime=0,t.play().catch(e=>Y.error(e));}onVideoEnded(t){if(this.currentIndex<this.videoEntries.length-1)this.selectedItem||this.shareDialogOpen()?this.playVideo(t):this.moveToNextVideo();else {let i=[`CE Last Video Ended`,{previous:this.getPreviousVideoDataForEvent()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(i),this.playVideo(t);}}onSlideChange(t){let e=this.getPreviousVideoDataForEvent();this.currentIndex=t.realIndex,this.selectedVideo=this.videoEntries[this.currentIndex].video,this.eventData.video=this.selectedVideo,this.eventData.index=this.currentIndex,this.playActiveVideo(),this.isProductDetailView()?this.selectItemForDetailView():this.selectedItem=null;let r=new Ir(`CE Video Changed`,{previous:e,current:this.currentVideoProps()},this.engagementTrigger);r.setVideos(this.videoEntries[this.currentIndex].video),window.CooeeSDK.sendEvent(r);}productCardClicked(t,e){let o=new Ir(`CE More Item Info Clicked`,{current:{videoID:e.id,videoIndex:this.currentIndex}},this.engagementTrigger);o.setVideos(e),window.CooeeSDK.sendEvent(o),this.selectedItem=t;}onVideoLoadStart(t){this.videoLoadingStates.set(t,true);}onVideoCanPlay(t){this.videoLoadingStates.set(t,false);}shouldShowVideoSpinner(t){return this.swiperInitialized()?this.videoLoadingStates.get(t)===true&&this.isVideoVisible(t):this.isVideoVisible(t)}isVideoVisible(t){let e=this.currentIndex-1,i=this.currentIndex+1;return t===this.currentIndex||t===e||t===i}async initSwiperOptions(){await this.cssLoadedPromise;let t=this.isMobile?1:`auto`,e=0;this.isProductDetailView()&&(t=`auto`,e=10),this.swiperOptions.set({direction:this.isMobile?`vertical`:`horizontal`,effect:this.isMobile?`slide`:`coverflow`,slidesPerView:t,initialSlide:this.currentIndex,centeredSlides:true,spaceBetween:e,coverflowEffect:{rotate:0,stretch:0,depth:400,modifier:1,slideShadows:false},on:{init:i=>{this.swiperInitialized.set(true),setTimeout(()=>{i.update();},100);}},mousewheel:{enabled:!this.isMobile,invert:false,thresholdDelta:20}});}isProductDetailView(){return this.videoConfig.detailPopup.template===`PRODUCT_DETAIL_VIEW`}currentVideoProps(){return {videoID:this.videoEntries[this.currentIndex].video.id,videoIndex:this.currentIndex}}getPreviousVideoDataForEvent(){let t=this.currentVideoProps(),e=this.videoElements.find(o=>o.nativeElement.dataset.videoId===this.videoEntries[this.currentIndex].video.id)?.nativeElement;t.playedTillMS=Math.ceil(e?.currentTime*1e3);let i=e?.duration*1e3;return t.playedTillPercent=+(t.playedTillMS/i).toFixed(4),t}selectItemForDetailView(){this.selectedItem=this.isMobile?null:this.selectedVideo?.items?.[0]??null;}applyOptimalVideoDimensions(){if(this.isMobile||this.isProductDetailView())return;let t=this.calculateOptimalVideoDimensions();t&&this.setVideoContainerDimensions(t.width,t.height);}calculateOptimalVideoDimensions(){let t=this.videoEntries.map(u=>u.video.sources?.[0]).filter(u=>u?.width&&u?.height).map(u=>({width:u.width,height:u.height,aspectRatio:u.width/u.height}));if(t.length===0)return null;let e=t[0],i=window.innerWidth*.9,o=window.innerHeight*.9,r=i/e.width,k=o/e.height,A=Math.min(r,k);return {width:Math.floor(e.width*A),height:Math.floor(e.height*A)}}setVideoContainerDimensions(t,e){let i=this.elementRef.nativeElement;i.style.setProperty(`--video-container-width`,`${t}px`),i.style.setProperty(`--video-container-height`,`${e}px`);}onResize(){this.applyOptimalVideoDimensions();}static ɵfac=function(e){return new(e||n)};static ɵcmp=cf({type:n,selectors:[[`cooee-video-detail-dialog`]],viewQuery:function(e,i){if(e&1&&oc(Te,7)(Ie,5),e&2){let o;kf(o=Ff())&&(i.swiperComponent=o.first),kf(o=Ff())&&(i.videoElements=o);}},hostAttrs:[1,`letscooee-widget`],hostBindings:function(e,i){e&1&&Nf(`keydown.escape`,function(r){return i.onKeyDown(r)},rm);},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(e,i){if(e&1&&(Xa(0,`div`,3)(1,`cooee-swiper`,4,0),Nf(`slideChange`,function(r){return i.onSlideChange(r)}),nc(3,5),ND(4,Re,10,10,`div`,6,Se),Yo(),ec(),Xa(6,`div`,7),pf(7,Ae,1,0,`ng-container`,8),ec()(),pf(8,Be,2,0,`ng-template`,null,1,xv)),e&2){let o=zD(9);Ef(`ngClass`,i.viewTemplateClassName),fd(),Ef(`options`,i.swiperOptions())(`navigationConfig`,i.navigationConfig),fd(3),AD(i.videoEntries),fd(3),Ef(`ngTemplateOutlet`,o);}},dependencies:[Wt,Gt,zt,P,S,xE,AE,$t,Ut,ye],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}
7
7
  `],encapsulation:3})};
8
8
 
9
- var videoDetailDialog_componentJmVWh0jX = /*#__PURE__*/Object.freeze({
9
+ var videoDetailDialog_componentBeKaHHG2 = /*#__PURE__*/Object.freeze({
10
10
  __proto__: null,
11
11
  VideoDetailDialogComponent: Ee
12
12
  });
13
13
 
14
- export { f, l, videoDetailDialog_componentJmVWh0jX as v };
14
+ export { f, l, videoDetailDialog_componentBeKaHHG2 as v };
@@ -32,14 +32,14 @@ var rn={schedule(n,t){let e=setTimeout(n,t);return ()=>clearTimeout(e)}};functio
32
32
  `],encapsulation:3})};var Je=class n{dialog=g(Ro);dialogRef;constructor(){}showItemQuickView(t,e){this.dialogRef=this.dialog.open(Ye,{width:`100vw`,height:`100dvh`,backdropClass:[`letscooee-backdrop`],data:{item:e,triggerContext:t}});}static ɵfac=function(e){return new(e||n)};static ɵprov=C({token:n,factory:n.ɵfac,providedIn:`root`})};var Xe=(i=>(i.SINGLE_DROPDOWN=`SINGLE_DROPDOWN`,i.MULTIPLE_DROPDOWNS=`MULTIPLE_DROPDOWNS`,i.CHIPS=`CHIPS`,i))(Xe||{});var En=n=>({row:n}),yt=(n,t)=>t.id,In=(n,t)=>t.mID;function Pn(n,t){if(n&1&&(Xa(0,`option`,7),gv(1),ec()),n&2){let e=t.$implicit,i=t.$index,o=VD().$implicit,a=VD(2);Ef(`value`,i)(`selected`,a.selectedOptions()[o.name]===e.name)(`disabled`,!!e.disabled),fd(),ac(` `,e.name,` `);}}function kn(n,t){if(n&1){let e=FD();Xa(0,`select`,6,0),Nf(`change`,function(){let o=gu(e).$implicit,a=zD(1);return mu(VD(2).onDropdownChange(o,a.value))}),ND(2,Pn,2,4,`option`,7,bD),ec();}if(n&2){let e=t.$implicit;Ef(`name`,e.name),vf(`aria-label`,e.name),fd(2),AD(e.optionValues);}}function Dn(n,t){if(n&1&&(Xa(0,`div`,2),ND(1,kn,4,2,`select`,5,yt),ec()),n&2){let e=VD();Ef(`ngClass`,Sv(1,En,e.horizontal())),fd(),AD(e.options());}}function Mn(n,t){if(n&1&&(Xa(0,`option`,7),gv(1),ec()),n&2){let e=t.$implicit,i=VD(2);Ef(`value`,e.mID)(`selected`,i.item().selectedOrFirstVariant.value.mID===e.mID)(`disabled`,!e.isAvailable),fd(),ac(` `,e.name,` `);}}function Fn(n,t){if(n&1){let e=FD();Xa(0,`div`,3)(1,`select`,8,1),Nf(`change`,function(){gu(e);let o=zD(2);return mu(VD().onVariantChange(o.value))}),ND(3,Mn,2,4,`option`,7,In),ec()();}if(n&2){let e=VD();fd(),vf(`aria-label`,`Select variant`),fd(2),AD(e.item().vars);}}function On(n,t){if(n&1&&(Xa(0,`div`,11),gv(1),Xa(2,`span`,14),gv(3),ec()()),n&2){let e=VD().$implicit,i=VD(2);fd(),ac(` `,e.name),fd(2),ac(`: `,i.selectedOptions()[e.name]);}}function An(n,t){if(n&1&&(Xa(0,`span`,16),gv(1),ec()),n&2){VD();let e=Ev(0);fd(),Yf(e);}}function Ln(n,t){if(n&1){let e=FD();Xf(0),Xa(1,`button`,15),Nf(`click`,function(){let o=gu(e).$implicit,a=VD().$implicit;return mu(VD(2).onOptionSelect(a,o))}),TD(2,An,2,1,`span`,16),ec();}if(n&2){let e=t.$implicit,i=VD().$implicit,o=Ev(0),a=VD(2),l=e.name,p=vv(e.displayName||e.name),f=e.swatch,M=o?e.hexColor??l:``,Z=a.selectedOptions()[i.name]===l;fd(),sc(`option-value--swatch`,o)(`option-value--selected`,Z)(`option-value--disabled`,e.disabled),Ef(`title`,p)(`ngStyle`,a.getSwatchStyles(f,M)),vf(`aria-checked`,Z)(`aria-label`,p)(`aria-disabled`,e.disabled||null),fd(),SD(o?-1:2);}}function Rn(n,t){if(n&1&&(Xf(0),Xa(1,`div`,10),TD(2,On,4,2,`div`,11),Xa(3,`div`,12),ND(4,Ln,3,13,`button`,13,yt),ec()()),n&2){let e=t.$implicit,i=VD(2);vv(i.isColorSwatch(e)),fd(2),SD(i.hideOptionNames()?-1:2),fd(),vf(`aria-label`,e.name),fd(),AD(e.optionValues);}}function Nn(n,t){if(n&1&&(Xa(0,`div`,9),ND(1,Rn,6,3,`div`,10,yt),ec()),n&2){let e=VD();sc(`options-list--horizontal`,e.horizontal()),fd(),AD(e.options());}}var Ae=n=>n.trim().toLowerCase(),et=class n{item=iN.required();selectorType=iN();horizontal=iN(false);hideOptionNames=iN(false);variantSelected=oN();selectedOptions=Pv(()=>{let t=this.item(),e=t.vars.find(o=>o.isAvailable)??t.vars[0],i={};return t.options?.forEach(o=>{let a=e?.selectedOptions.find(l=>l.name===o.name)?.value;a&&(i[o.name]=a);}),i});availabilityIndex=Fv(()=>{let t=this.item(),e=new Map;return t?.vars?.length&&t.vars.forEach((i,o)=>{if(i.isAvailable)for(let a of i.selectedOptions){let l=Ae(a.name),p=e.get(l);p||e.set(l,p=new Map);let f=p.get(a.value);f||p.set(a.value,f=new Set),f.add(o);}}),e});options=Fv(()=>{let t=this.item();return !t.options||t.vars.length===1?[]:(t.options.forEach(e=>{e.optionValues.forEach(i=>{i.disabled=this.isOptionValueDisabledFast(e,i);});}),t.options)});matchedVariant=Fv(()=>{let t=this.item(),e=this.selectedOptions();return t.vars.find(i=>t.options.every(o=>{let a=i.selectedOptions.find(l=>l.name===o.name)?.value;return e[o.name]===a}))});constructor(){ws(()=>{let t=this.matchedVariant();t&&(this.item().setSelectedVariant(t),this.variantSelected.emit(t));}),ws(()=>{let t=this.item();if(!t.options)return;try{window.cooeeManipulateProduct&&window.cooeeManipulateProduct(t);}catch(a){Y$1.error(a);}let e=We$3(),o=(e?.currentItem?.vID?this.item().vars.find(a=>a.mID===e.currentItem.vID):void 0)||t.vars.find(a=>a.isAvailable)||t.vars[0];o&&this.syncSelectedOptions(o);});}onPDPVariantChange(t){if(this.item()){this.item().setSelectedVariantByID(t.detail.variantID);let e=this.item().selectedOrFirstVariant.value;this.syncSelectedOptions(e);}}onOptionSelect(t,e){if(e.disabled)return;this.selectedOptions.set(s(r({},this.selectedOptions()),{[t.name]:e.name}));let i=this.matchedVariant();i&&(this.item().setSelectedVariant(i),this.notifyProductChange({product:this.item(),variant:i}));}onDropdownChange(t,e){let i=t.optionValues[Number(e)];i&&this.onOptionSelect(t,i);}isColorSwatch(t){return t.optionValues.some(e=>!!e.swatch||/#[a-f0-9]{6}\b/i.test(e.name))}getSwatchStyles(t,e){return !t&&e?{"--swatch-color":e}:t?.image?.url?{"background-image":`url("${t.image.url}")`}:t?.color?{"--swatch-color":t.color}:{}}showSingleDropdown(){return this.item().vars?.length<=1?false:!this.selectorType()||this.selectorType()===`SINGLE_DROPDOWN`}showMultipleDropdowns(){return this.item().vars?.length<=1?false:this.selectorType()===`MULTIPLE_DROPDOWNS`}showChips(){return this.item().vars?.length<=1?false:this.selectorType()===`CHIPS`}onVariantChange(t){let e=this.item().vars.find(i=>i.mID===t);e&&(this.item().setSelectedVariant(e),this.notifyProductChange({product:this.item(),variant:e}),this.variantSelected.emit(e));}notifyProductChange(t){document.dispatchEvent(new CustomEvent(`letscooee:outbound:variant-change`,{detail:t}));}syncSelectedOptions(t){let e={};t.selectedOptions.forEach(i=>{e[i.name]=i.value;}),this.selectedOptions.set(e);}getCandidateVariantsExcluding(t){let e=this.item(),i=this.availabilityIndex(),o=new Set;e.vars.forEach((l,p)=>{l.isAvailable&&o.add(p);});let a=o;for(let[l,p]of Object.entries(this.selectedOptions())){if(Ae(l)===Ae(t))continue;let f=i.get(Ae(l));if(!f)return new Set;let M=f.get(String(p));if(!M)return new Set;if(a=new Set([...a].filter(Z=>M.has(Z))),a.size===0)return a}return a}isOptionValueDisabledFast(t,e){let o=this.availabilityIndex().get(Ae(t.name));if(!o)return true;let a=e.name,l=o.get(a);if(!l||l.size===0)return true;let p=this.getCandidateVariantsExcluding(t.name);if(p.size===0)return true;for(let f of p)if(l.has(f))return false;return true}static ɵfac=function(e){return new(e||n)};static ɵcmp=cf({type:n,selectors:[[`cooee-product-variant-selector`]],hostBindings:function(e,i){e&1&&Nf(`letscooee:variant-change`,function(a){return i.onPDPVariantChange(a)},om);},inputs:{item:[1,`item`],selectorType:[1,`selectorType`],horizontal:[1,`horizontal`],hideOptionNames:[1,`hideOptionNames`]},outputs:{variantSelected:`variantSelected`},decls:3,vars:1,consts:[[`sel`,``],[`variantSelect`,``],[1,`dropdowns-wrapper`,3,`ngClass`],[1,`dropdown-wrapper`],[1,`options-list`,3,`options-list--horizontal`],[1,`option-selector`,3,`name`],[1,`option-selector`,3,`change`,`name`],[3,`value`,`selected`,`disabled`],[1,`option-selector`,3,`change`],[1,`options-list`],[1,`option-group`],[1,`option-label`],[`role`,`radiogroup`,1,`option-values`],[`type`,`button`,`role`,`radio`,1,`option-value`,3,`option-value--swatch`,`option-value--selected`,`option-value--disabled`,`title`,`ngStyle`],[1,`option-selected-name`],[`type`,`button`,`role`,`radio`,1,`option-value`,3,`click`,`title`,`ngStyle`],[1,`option-value__label`]],template:function(e,i){e&1&&TD(0,Dn,3,3,`div`,2)(1,Fn,5,1,`div`,3)(2,Nn,3,2,`div`,4),e&2&&SD(i.showMultipleDropdowns()?0:i.showSingleDropdown()?1:i.showChips()?2:-1);},dependencies:[AE,RE],styles:[`:host{display:block}.options-list{display:flex;flex-direction:column;gap:var(--lc-spacing-sm, 8px)}.options-list--horizontal{flex-direction:row;flex-wrap:wrap;align-items:flex-start}.option-group{display:flex;flex-direction:column;gap:var(--lc-spacing-xs, 4px)}.option-label{font-family:var(--lc-text-family, inherit);font-size:var(--lc-text-size, 14px);color:rgb(var(--lc-text-color, 0 0 0));line-height:1.4}.option-selected-name{font-weight:500}.option-values{display:flex;flex-wrap:wrap;gap:var(--lc-spacing-xs, 4px)}.option-value{display:inline-flex;align-items:center;justify-content:center;padding:4px var(--lc-spacing-sm, 8px);min-width:36px;min-height:32px;border:1px solid rgb(var(--lc-text-color, 0 0 0)/.2);border-radius:var(--lc-button-radius, 4px);background:transparent;color:rgb(var(--lc-text-color, 0 0 0));font-family:var(--lc-text-family, inherit);font-size:var(--lc-text-size, 14px);line-height:1;cursor:pointer;transition:background .15s,color .15s,border-color .15s}.option-value--selected{background:rgb(var(--lc-primary-color));color:rgb(var(--lc-primary-button-color, 255 255 255));border-color:rgb(var(--lc-primary-color))}.option-value--disabled{opacity:.4;cursor:not-allowed;pointer-events:none}.option-value--disabled .option-value__label{text-decoration:line-through}.option-value--swatch{width:var(--lc-swatch-size, 28px);height:var(--lc-swatch-size, 28px);min-width:unset;min-height:unset;padding:0;border-radius:var(--lc-swatch-radius, 50%);border:2px solid transparent;outline:2px solid transparent;outline-offset:0;background-color:var(--swatch-color, transparent);background-size:cover;background-position:center;transition:outline-color .15s,outline-offset .15s}.option-value--swatch.option-value--selected{border-color:rgb(var(--lc-card-bg-color, 255 255 255));outline-color:rgb(var(--lc-primary-color));outline-offset:2px}.option-value--swatch.option-value--disabled{position:relative;overflow:hidden}.option-value--swatch.option-value--disabled:after{content:"";position:absolute;inset:0;background:linear-gradient(to bottom right,transparent calc(50% - .5px),rgba(0,0,0,.4) calc(50% - .5px) calc(50% + .5px),transparent calc(50% + .5px));border-radius:inherit}.dropdowns-wrapper,.dropdown-wrapper{display:flex;gap:8px;width:100%}.option-selector{width:100%;padding:8px 24px 8px 8px;border:1px solid black;border-radius:var(--lc-button-radius);font-size:var(--lc-text-size)}@media(min-width:768px){.option-selector:hover{border-color:rgba(var(--lc-primary-color))}}.option-selector:focus{outline:none}.option-selector{flex:0 0 130px}@media(max-width:768px){.option-selector{flex:1 1 0;min-width:0}}
33
33
  `],encapsulation:2})};var Bn=(n,t)=>({enter:n,exit:t}),zn=(n,t)=>t.id;function Hn(n,t){if(n&1&&(Xa(0,`div`,3),Cf(1,`img`,10),ec()),n&2){let e,i,o=VD();fd(),Ef(`src`,((e=o.selectedVariant())==null?null:e.getOneImage())||o.currentItem.firstImageURL,nm),vf(`alt`,((i=o.selectedVariant())==null?null:i.name)||o.currentItem.name||`Product image`);}}function jn(n,t){if(n&1&&(Xa(0,`div`,13),gv(1),ec(),Xa(2,`div`,14),gv(3),ec()),n&2){let e=VD(2);fd(),ac(` `,e.getCurrency(e.selectedVariant().price.cmp),` `),fd(2),ac(` `,e.getDiscountPercentage(e.selectedVariant().price),`% off `);}}function $n(n,t){if(n&1&&(Xa(0,`div`,12),gv(1),ec()),n&2){let e=VD(2);fd(),ac(` `,e.stickyATCConfig.leftText,` `);}}function Un(n,t){if(n&1&&(Xa(0,`div`,4)(1,`div`,11),gv(2),ec(),TD(3,jn,4,2),TD(4,$n,2,1,`div`,12),ec()),n&2){let e=VD();fd(2),ac(` `,e.getCurrency(e.selectedVariant().price.d),` `),fd(),SD(e.selectedVariant().price.cmp?3:-1),fd(),SD(e.stickyATCConfig.leftText?4:-1);}}function Qn(n,t){n&1&&wf(0);}function qn(n,t){if(n&1&&(Xa(0,`div`,15),gv(1),ec()),n&2){let e=t.$implicit,i=t.$index;VD(2);let o=Ev(9);Ef(`ngClass`,Mv(2,Bn,i===o.currentIndex,i===o.previousIndex)),fd(),ac(` `,e,` `);}}function Wn(n,t){if(n&1&&(Xa(0,`div`,9),ND(1,qn,2,5,`div`,15,bD),ec()),n&2){VD();let e=Ev(9);fd(),AD(e.features);}}function Zn(n,t){if(n&1&&Cf(0,`cooee-product-variant-selector`,16),n&2){let e=VD(2);Ef(`item`,e.currentItem)(`horizontal`,true)(`hideOptionNames`,true)(`selectorType`,e.stickyATCConfig.variantSelectorConfig==null?null:e.stickyATCConfig.variantSelectorConfig.type);}}function Gn(n,t){if(n&1&&(Xa(0,`option`,21),gv(1),ec()),n&2){let e,i=t.$implicit,o=VD(3);Ef(`value`,i.id)(`selected`,((e=o.selectedVariant())==null||e.selectedSellingPlan==null||e.selectedSellingPlan.value==null?null:e.selectedSellingPlan.value.id)===i.id),fd(),ac(` `,i.name,` `);}}function Kn(n,t){if(n&1){let e=FD();Xa(0,`div`,17)(1,`select`,19,1),Nf(`change`,function(){gu(e);let o=zD(2);return mu(VD(2).onSubscriptionChange(o.value))}),Xa(3,`option`,20),gv(4,`Select Subscription`),ec(),ND(5,Gn,2,3,`option`,21,zn),ec()();}if(n&2){let e=VD(2);fd(5),AD(e.selectedVariant().sellingPlans);}}function Yn(n,t){if(n&1){let e=FD();Xa(0,`div`,18)(1,`button`,22),Nf(`click`,function(){gu(e);return mu(VD(2).onQuantityDecrement())}),gv(2,`− `),ec(),Xa(3,`span`,23),gv(4),ec(),Xa(5,`button`,24),Nf(`click`,function(){gu(e);return mu(VD(2).onQuantityIncrement())}),gv(6,`+ `),ec()();}if(n&2){let e=VD(2);fd(4),Yf(e.currentItem.selectedQty.value);}}function Jn(n,t){if(n&1&&(TD(0,Zn,1,4,`cooee-product-variant-selector`,16),TD(1,Kn,7,0,`div`,17),TD(2,Yn,7,1,`div`,18)),n&2){let e,i=VD();SD(i.currentItem.options.length&&i.stickyATCConfig.variantSelectorConfig!=null&&i.stickyATCConfig.variantSelectorConfig.show?0:-1),fd(),SD(!((e=i.selectedVariant())==null||e.sellingPlans==null)&&e.sellingPlans.length&&i.stickyATCConfig.showSubscriptionSelector?1:-1),fd(),SD(i.stickyATCConfig.showQuantitySelector?2:-1);}}var tt=class n extends Pe{currentItem;stickyATCConfig;selectedVariant=Lt$2(void 0);featureSlider=Lt$2({features:[],currentIndex:0});VariantSelectorType=Xe;constructor(){super();}onVariantChange(t){this.currentItem&&(this.currentItem.setSelectedVariantByID(t.detail.variantID),this.selectedVariant.set(this.currentItem.selectedOrFirstVariant.value));}engagementTriggerReceived(t){this.stickyATCConfig=t.stickyATCConfig??{},this.currentItem=t.items[0];let e=We$3(),i=this.currentItem.vars.find(o=>o.mID===e.currentItem.vID);i&&this.currentItem.setSelectedVariantByID(i.mID),this.selectedVariant.set(this.currentItem.selectedOrFirstVariant.value),this.stickyATCConfig.leftText=this.replaceVariables(this.stickyATCConfig.leftText),this.stickyATCConfig.rightText=this.replaceVariables(this.stickyATCConfig.rightText),this.startFeatureRotation();}update(){}getCurrency(t){return Vr$1(t)}getDiscountPercentage(t){return ((t.cmp-t.d)/t.cmp*100).toFixed(0)}onSubscriptionChange(t){if(!t)return;let e=this.selectedVariant()?.sellingPlans?.find(i=>i.id===t);e&&(this.selectedVariant()?.changeSellingPlan(e),this.notifyProductChange({product:this.currentItem,sellingPlan:e}));}shouldShowImage(){return !!(this.stickyATCConfig.showImage&&(this.selectedVariant()?.getOneImage()||this.currentItem.firstImageURL))}onQuantityIncrement(){this.updateQuantity(this.currentItem.selectedQty.value+1);}onQuantityDecrement(){this.updateQuantity(Math.max(1,this.currentItem.selectedQty.value-1));}updateQuantity(t){this.currentItem.selectedQuantity=t,this.notifyProductChange({product:this.currentItem,quantity:t});}addToCart(){this.engagementService.executeCTA(he$2.ADD_TO_CART,{item:this.currentItem});}notifyProductChange(t){document.dispatchEvent(new CustomEvent(`letscooee:outbound:variant-change`,{detail:t}));}startFeatureRotation(){if(!this.stickyATCConfig.rightText)return;let t=this.stickyATCConfig.rightText.split(`
34
34
  `),e=t.length===1?null:setInterval(()=>{this.featureSlider.update(i=>s(r({},i),{previousIndex:i.currentIndex,currentIndex:(i.currentIndex+1)%i.features.length}));},3e3);this.featureSlider.set({intervalRef:e,currentIndex:0,features:t});}replaceVariables(t){return t?Fe$2(t,this.currentItem.getTemplateVariables(),this.triggerContext):``}static ɵfac=function(e){return new(e||n)};static ɵcmp=cf({type:n,selectors:[[`cooee-sticky-atc`]],hostBindings:function(e,i){e&1&&Nf(`letscooee:variant-change`,function(a){return i.onVariantChange(a)},om);},features:[np(Lt()),Wa],decls:13,vars:6,consts:[[`selectorsTemplate`,``],[`subscriptionSelect`,``],[1,`lc-wrapper`],[1,`image-wrapper`],[1,`lc-prices`],[4,`ngTemplateOutlet`],[1,`lc-button-wrapper`],[`type`,`button`,1,`lc-button`,`lc-button-atc`,3,`click`],[1,`atc-sale-price`],[1,`lc-features`],[`loading`,`lazy`,3,`src`],[1,`lc-sale-price`],[1,`lc-additional-text`],[1,`lc-compare-price`],[1,`lc-discount-label`],[1,`lc-feature`,3,`ngClass`],[3,`item`,`horizontal`,`hideOptionNames`,`selectorType`],[1,`subscription-selector-wrapper`],[1,`quantity-selector`],[`aria-label`,`Subscription`,1,`subscription-selector`,3,`change`],[`value`,``],[3,`value`,`selected`],[`type`,`button`,`aria-label`,`Decrease quantity`,1,`qty-btn`,3,`click`],[1,`qty-value`],[`type`,`button`,`aria-label`,`Increase quantity`,1,`qty-btn`,3,`click`]],template:function(e,i){if(e&1&&(Xa(0,`div`,2),TD(1,Hn,2,2,`div`,3),TD(2,Un,5,3,`div`,4),pf(3,Qn,1,0,`ng-container`,5),Xa(4,`div`,6)(5,`button`,7),Nf(`click`,function(){return i.addToCart()}),gv(6,` Add To Cart `),Xa(7,`span`,8),gv(8),ec()(),Xf(9),TD(10,Wn,3,0,`div`,9),ec()(),pf(11,Jn,3,3,`ng-template`,null,0,xv)),e&2){let o=zD(12);fd(),SD(i.shouldShowImage()?1:-1),fd(),SD(i.selectedVariant()&&i.stickyATCConfig.showProductInfo?2:-1),fd(),Ef(`ngTemplateOutlet`,o),fd(5),ac(` `,i.getCurrency(i.selectedVariant().price.d*i.currentItem.selectedQty.value),` `),fd();let a=vv(i.featureSlider());fd(),SD(a.features.length?10:-1);}},dependencies:[AE,xE,et],styles:[`:host{display:flex;justify-content:center;padding:10px;background-color:#fff;width:100%;box-shadow:4px 0 10px #0006;line-height:normal}.lc-wrapper{display:flex;justify-content:space-between;align-items:center;gap:8px;max-width:1100px;width:100%;margin:0 auto}.lc-prices{flex:1 1 100%;display:flex;flex-wrap:wrap;align-items:center;gap:6px}@media(min-width:768px){.lc-prices{gap:8px}}.lc-sale-price{font-size:24px;font-weight:600}.lc-compare-price{font-size:18px;font-weight:600;color:red;text-decoration:line-through}.lc-discount-label{font-size:12px;font-weight:500;color:green}.lc-button-wrapper{flex:1 1 100%;display:flex;flex-direction:column;gap:4px;align-items:center}.lc-button{background-color:rgba(var(--lc-primary-button-bg-color));color:rgba(var(--lc-primary-button-color));font-weight:var(--lc-primary-button-weight);text-transform:var(--lc-primary-button-transform);border-radius:var(--lc-button-radius);font-size:var(--lc-button-size);font-family:var(--lc-button-family),serif;height:var(--lc-button-height);letter-spacing:var(--lc-button-letter-spacing);transition:filter .12s ease,background-color .2s ease,color .2s ease;border-width:1px;border-style:solid;border-color:rgba(var(--lc-primary-button-border-color));display:flex;align-items:center;justify-content:center;gap:8px}.lc-button cooee-icon,.lc-button>svg,.lc-button>img{width:var(--lc-button-icon-size);height:var(--lc-button-icon-size);color:inherit}.lc-button:hover{filter:brightness(.95)}.lc-button:active{filter:brightness(.9)}.lc-button:focus-visible{outline:2px solid rgba(var(--lc-primary-color, 0, 0, 0));outline-offset:2px}.lc-button{min-width:150px;width:100%;padding:8px}.lc-button .atc-sale-price{display:none}.lc-additional-text,.lc-feature{font-size:12px;color:#666}.lc-features{position:relative;overflow:hidden;height:16px;text-align:center;width:100%}.lc-features .lc-feature{position:absolute;width:100%;opacity:0;transform:translateY(100%);transition:transform .5s ease,opacity .5s ease}.lc-features .lc-feature.enter{opacity:1;transform:translateY(0);z-index:2}.lc-features .lc-feature.exit{opacity:0;transform:translateY(-100%);z-index:1}.image-wrapper{display:flex;align-items:center;justify-content:center;flex:0 0 auto;width:70px;height:70px;border-radius:4px}.image-wrapper img{width:100%;height:100%;object-fit:cover;border-radius:4px}.selectors-wrapper{display:flex;gap:8px;flex:1 1 100%;min-width:0}cooee-product-variant-selector{flex:0 1 auto}@media(max-width:768px){cooee-product-variant-selector{flex:1 1 0}}.subscription-selector-wrapper{flex:0 0 130px;display:flex}@media(max-width:768px){.subscription-selector-wrapper{flex:1 1 auto;min-width:0}}.subscription-selector-wrapper .subscription-selector{width:100%;padding:8px 24px 8px 8px;border:1px solid black;border-radius:var(--lc-button-radius);font-size:var(--lc-text-size)}@media(min-width:768px){.subscription-selector-wrapper .subscription-selector:hover{border-color:rgba(var(--lc-primary-color))}}.subscription-selector-wrapper .subscription-selector:focus{outline:none}.quantity-selector{flex:0 0 auto;display:flex;align-items:stretch;border:1px solid black;border-radius:var(--lc-button-radius)}.quantity-selector .qty-btn{display:flex;align-items:center;justify-content:center;flex:0 0 28px;border:none;cursor:pointer;font-size:18px;font-weight:600;padding:4px;border-radius:var(--lc-button-radius)}.quantity-selector .qty-btn:active{background-color:#f0f0f0}@media(min-width:768px){.quantity-selector .qty-btn:hover{background-color:#f5f5f5}}.quantity-selector .qty-value{display:flex;place-content:center;justify-content:center;flex:0 0 28px;padding:8px 0;text-align:center;font-size:14px;font-weight:500}@media(max-width:768px){.lc-wrapper{flex-wrap:wrap;align-items:start}.lc-prices,.lc-button-wrapper{flex-basis:auto;flex-grow:1}cooee-product-variant-selector{order:1;flex-basis:100%}.quantity-selector{order:4}.lc-button-wrapper{order:5}}
35
- `],encapsulation:3})};var Xn=[`videoEl`];async function Di(){return (await import('./video-detail-dialog.component-jmVWh0jX-DdeLnGjA.js').then(function (n) { return n.v; })).VideoDetailDialogComponent}var ye=class n extends Pe{videoElements;videoEntries;videoConfig;dialogRef=null;dialog=g(Ro);isMobile=M$3();pausedVideos=[];videoLoadingStates=new Map;intersectionObserver;visibleVideos=new Set;constructor(){super(),Di();}ngAfterViewInit(){this.checkAndOpenVideoFromUrl();}ngOnDestroy(){super.ngOnDestroy(),this.intersectionObserver?.disconnect();}engagementTriggerReceived(t){this.videoConfig=t.content?.videoConfig,this.videoEntries=this.videoConfig.videoEntries;}onMuteToggled(t,e){t||this.videoElements.forEach(i=>{i.nativeElement!==e&&(i.nativeElement.muted=true,i.nativeElement.pause());});}sendTriggerClicked(t,e){this.sendEvent(`CE Trigger Clicked`,{},t,e);}async onVideoTap(t,e,i,o,a){t?.stopPropagation(),t?.preventDefault();let l=e.items?.[0];if(this.sendTriggerClicked(e,l),this.videoConfig.footerContent===`NONE`){o&&(o.muted=false,o.play(),this.onMuteToggled(false,o));return}await this.openDialog(e,i,a);}sendEvent(t,e,i,o){let a=new Ir$1(t,e,this.engagementTrigger);a.setVideos(i),o&&(a.items=[o.toEmbed()]),window.CooeeSDK.sendEvent(a);}onDialogClosed(){this.resumePlaylistVideos();}isVideoLoading(t){return this.videoLoadingStates.get(t)??true}onVideoLoadStart(t){this.videoLoadingStates.set(t,true);}onVideoCanPlay(t){this.videoLoadingStates.set(t,false);}playVideo(t){t.play().catch(e=>{Y$1.error(`Failed to play video:`,e);});}setupIntersectionObserver(t=.5,e=`50px`){this.intersectionObserver=new IntersectionObserver(i=>{i.forEach(o=>{let a=o.target,l=a.dataset.videoId;l&&(o.isIntersecting?(this.visibleVideos.add(l),this.handleVideoVisibilityChange(a,true)):(this.visibleVideos.delete(l),this.handleVideoVisibilityChange(a,false)));});},{threshold:t,rootMargin:e}),setTimeout(()=>{this.videoElements.forEach(i=>{this.intersectionObserver?.observe(i.nativeElement);});},100);}handleVideoVisibilityChange(t,e){e?this.onVideoBecameVisible(t):t.pause();}onVideoBecameVisible(t){this.playVideo(t);}pauseAllPlaylistVideos(){this.pausedVideos=[],this.videoElements.forEach(t=>{let e=t.nativeElement;e.paused||(this.pausedVideos.push(e),e.pause());});}resumePlaylistVideos(){this.pausedVideos.forEach(t=>{t.play().catch(()=>{});}),this.pausedVideos=[];}async checkAndOpenVideoFromUrl(){let t=We$4();if(!t||!this.videoEntries)return;let e=Je$2();if(e.utm_campaign?.toLowerCase()!==`shoppable_video`||e.utm_source?.toLowerCase()!==Ae$3)return;let i=this.videoEntries.findIndex(o=>o.video.shortID===+t);if(i!==-1){let o=this.videoEntries[i].video;await ce$2.set(`muted`,true),await this.openDialog(o,i);}}async openDialog(t,e,i){await Mi$1();let o={videoEntries:this.videoEntries,currentIndex:e,triggerContext:this.triggerContext,selectedItem:i};this.dialogRef&&this.dialogRef.close(),this.pauseAllPlaylistVideos();let a=await Di();this.dialogRef=this.dialog.open(a,{width:`100vw`,height:`100vh`,data:o,providers:on(this.triggerContext,{video:t,index:e}),disableClose:true});let l={videoID:t.id,videoIndex:e};this.sendEvent(`CE Video Dialog Opened`,{current:l},t),this.dialogRef.closed.subscribe(p=>{if(this.dialogRef=null,!p)return;let f=p.lastVideoDuration*1e3,M={videoID:p.lastVideo.id,videoIndex:p.lastVideoIndex,playedTillMS:f,playedTillPercent:f/p.lastVideo.durationMS};this.sendEvent(`CE Video Dialog Closed`,{current:M},p.lastVideo),this.onDialogClosed();});}static ɵfac=function(e){return new(e||n)};static ɵcmp=cf({type:n,selectors:[[`cooee-abstract-video`]],viewQuery:function(e,i){if(e&1&&oc(Xn,5),e&2){let o;kf(o=Ff())&&(i.videoElements=o);}},features:[Wa],decls:0,vars:0,template:function(e,i){},encapsulation:2})};var _e=class n{video=iN.required({alias:`cooeeVideoSources`});prioritySource=iN(`high`);elementRef=g(Se$1);constructor(){ws(()=>{this.updateSources();});}updateSources(){let t=this.elementRef.nativeElement,e=this.video(),i=this.prioritySource();t.querySelectorAll(`source`).forEach(a=>a.remove()),i===`best`?(this.addSource(e.bestSource),this.addSource(e.highSource),this.addSource(e.lowSource)):i===`low`?(this.addSource(e.lowSource),this.addSource(e.highSource),this.addSource(e.bestSource)):(this.addSource(e.highSource),this.addSource(e.bestSource),this.addSource(e.lowSource)),this.addSource(e.m3u8Source),t.load();}addSource(t){if(!t)return;let e=document.createElement(`source`);e.src=t.url,e.type=t.mimeType,this.elementRef.nativeElement.appendChild(e);}static ɵfac=function(e){return new(e||n)};static ɵdir=En$2({type:n,selectors:[[`video`,`cooeeVideoSources`,``]],inputs:{video:[1,`cooeeVideoSources`,`video`],prioritySource:[1,`prioritySource`]}})};var eo=(n,t)=>t.video.id;function to(n,t){if(n&1&&(Cf(0,`div`,1),bv(1,`safeHtml`)),n&2)Ef(`innerHTML`,Av(1,1,VD().videoConfig.heading),tm);}function io(n,t){n&1&&(Xa(0,`div`,6),Cf(1,`div`,12),ec());}function no(n,t){if(n&1){let e=FD();Xa(0,`cooee-mute-toggle`,13),Nf(`toggled`,function(o){gu(e),VD();let a=zD(7);return mu(VD().onMuteToggled(o,a))}),ec();}if(n&2){VD();let e=zD(7);Ef(`muted`,e.muted)(`videoEl`,e);}}function oo(n,t){if(n&1){let e=FD();Xa(0,`cooee-video-promoted-items`,16),Nf(`cardClick`,function(o){gu(e);let a=VD(2).$index,l=zD(7),p=Ev(0);return mu(VD().onItemCardClick(o,p,a,l))}),ec();}if(n&2){VD(2);Ef(`items`,Ev(0).items)(`centeredSlides`,false);}}function ro(n,t){if(n&1){let e=FD();Xa(0,`cooee-item-card`,17),Nf(`buttonClick`,function(){gu(e);let o=VD(2).$index,a=zD(7),l=Ev(0);return mu(VD().addToCartClicked(null,l,o,a))})(`click`,function(){gu(e);let o=VD(2).$index,a=zD(7),l=Ev(0),p=Ev(1);return mu(VD().onItemCardClick(p,l,o,a))}),ec();}if(n&2){VD(2);Ef(`item`,Ev(1));}}function ao(n,t){if(n&1&&TD(0,oo,1,2,`cooee-video-promoted-items`,14)(1,ro,1,1,`cooee-item-card`,15),n&2){VD();let e=Ev(0),i=VD();SD(Ev(2)===i.VideoConfigFooterContent.ITEM_SWIPER&&e.items.length>1?0:e.items.length?1:-1);}}function so(n,t){if(n&1){let e=FD();Xa(0,`cooee-video-card`,18),Nf(`linkClicked`,function(){gu(e),VD();let o=Ev(0);return mu(VD().sendTriggerClicked(o))}),ec();}if(n&2){VD();Ef(`card`,Ev(2));}}function lo(n,t){if(n&1){let e=FD();Xf(0)(1)(2),Xa(3,`div`,4)(4,`div`,5),Nf(`click`,function(o){let a=gu(e).$index,l=zD(7),p=Ev(0);return mu(VD().onVideoTap(o,p,a,l))})(`keydown.enter`,function(o){let a=gu(e).$index,l=zD(7),p=Ev(0);return mu(VD().onVideoTap(o,p,a,l))})(`keydown.space`,function(o){let a=gu(e).$index,l=zD(7),p=Ev(0);return mu(VD().onVideoTap(o,p,a,l))}),TD(5,io,2,0,`div`,6),Xa(6,`video`,7,0),Nf(`mouseenter`,function(){gu(e);let o=zD(7);VD();return mu(Ev(1)&&o.play())})(`mouseleave`,function(){gu(e);let o=zD(7);VD();return mu(Ev(1)&&o.pause())})(`loadstart`,function(){gu(e);let o=Ev(0);return mu(VD().onVideoLoadStart(o.id))})(`canplay`,function(){gu(e);let o=Ev(0);return mu(VD().onVideoCanPlay(o.id))}),ec(),Xa(8,`div`,8),TD(9,no,1,2,`cooee-mute-toggle`,9),ec()(),Xa(10,`div`,10),TD(11,ao,2,1)(12,so,1,1,`cooee-video-card`,11),ec()();}if(n&2){let e=t.$implicit,i=VD(),o=Ev(0),a=Ev(2),l=vv(e.video);fd(),vv(l.items[0]),fd();let f=vv(l.card)&&a===i.VideoConfigFooterContent.CARD;fd(2),ic(`background-image`,l.thumbnail?`url(`+l.thumbnail+`)`:null),fd(),SD(i.isVideoLoading(l.id)?5:-1),fd(),Ef(`cooeeVideoSources`,l)(`muted`,true),vf(`poster`,l.thumbnail)(`preload`,o?`metadata`:`none`)(`autoplay`,null)(`data-video-id`,l.id),fd(3),SD(i.videoConfig.showMuteButton?9:-1),fd(2),SD(i.videoConfig.showItems()?11:f?12:-1);}}var it=class n extends ye{VideoConfigFooterContent=se$2;VideoConfigAutoPlay=oe$2;swiperOptions=null;constructor(){super(),this.hasSwiper=true;}ngAfterViewInit(){super.ngAfterViewInit();let t=this.videoConfig.playlistConfig.videoSwiper,e=t?(this.isMobile?t.gapSm:t.gap)+`px`:window.cooeePlaylistGap??24,i=t?this.isMobile?t.maxInRowSm:t.maxInRow:`auto`;this.swiperOptions={direction:`horizontal`,effect:`slide`,loop:t?.loop,freeMode:true,spaceBetween:e,slidesPerView:i,mousewheel:{enabled:true,forceToAxis:true},autoplay:t?.autoplay?.enabled?{delay:t?.autoplay?.delay,disableOnInteraction:false}:false},this.setupIntersectionObserver(),this.playFirstVideo();}ngOnDestroy(){super.ngOnDestroy();}addToCartClicked(t,e,i,o){let a=e.items?.[0],l=he$3.get().website?.canChangeVariantInCart;if(e.items?.length>1||a?.hasVariants()&&!l){this.onItemCardClick(a,e,i,o);return}this.engagementService.executeCTA(he$2.ADD_TO_CART,{item:a,video:e});}goToPDP(t,e){t?.stopPropagation(),t?.preventDefault();let i=e.items?.[0];this.engagementService.executeCTA(he$2.GO_TO_PRODUCT,{item:i,video:e});}onItemCardClick(t,e,i,o){this.videoConfig.playlistConfig.itemCardClickBehavior===`OPEN_ITEM_DETAIL`?this.onVideoTap(null,e,i,o,t):this.onVideoTap(null,e,i,o);}update(){}onVideoCanPlay(t){if(super.onVideoCanPlay(t),!this.shouldAutoPlay()||this.dialogRef||!this.visibleVideos.has(t))return;let e=this.videoElements.find(i=>i.nativeElement.dataset.videoId===t)?.nativeElement;e&&this.playVideo(e);}onVideoBecameVisible(t){this.shouldAutoPlay()&&(this.dialogRef?this.pausedVideos.push(t):this.playVideo(t));}shouldAutoPlay(){return this.videoConfig.autoPlay===`ON`||this.videoConfig.autoPlay===`ON_HOVER`&&this.isMobile}playFirstVideo(){}static ɵfac=function(e){return new(e||n)};static ɵcmp=cf({type:n,selectors:[[`cooee-video-playlist`]],features:[np(Lt()),Wa],decls:8,vars:7,consts:[[`videoEl`,``],[1,`heading-text`,3,`innerHTML`],[3,`options`,`navigationConfig`,`paginationConfig`],[`ngProjectAs`,`swiper-slides`,5,[`swiper-slides`]],[1,`swiper-slide`,`video-card`],[`role`,`button`,`tabindex`,`0`,`aria-label`,`Play video`,`aria-haspopup`,`dialog`,1,`video-wrapper`,3,`click`,`keydown.enter`,`keydown.space`],[1,`video-loading-overlay`],[`width`,`100%`,`playsinline`,``,`loop`,``,3,`mouseenter`,`mouseleave`,`loadstart`,`canplay`,`cooeeVideoSources`,`muted`],[1,`video-controls`],[3,`muted`,`videoEl`],[`role`,`region`,`aria-label`,`Video details`,1,`video-footer`],[3,`card`],[1,`loading-spinner`],[3,`toggled`,`muted`,`videoEl`],[3,`items`,`centeredSlides`],[`role`,`button`,`tabindex`,`0`,`aria-label`,`Product detail`,3,`item`],[3,`cardClick`,`items`,`centeredSlides`],[`role`,`button`,`tabindex`,`0`,`aria-label`,`Product detail`,3,`buttonClick`,`click`,`item`],[3,`linkClicked`,`card`]],template:function(e,i){if(e&1&&(Xf(0)(1)(2),TD(3,to,2,3,`div`,1),Xa(4,`cooee-swiper`,2),nc(5,3),ND(6,lo,13,14,`div`,4,eo),Yo(),ec()),e&2){vv(!i.videoConfig.autoPlay||i.videoConfig.autoPlay===i.VideoConfigAutoPlay.ON),fd(),vv(i.videoConfig.autoPlay===i.VideoConfigAutoPlay.ON_HOVER),fd(),vv(i.videoConfig.footerContent),fd(),SD(i.videoConfig.heading?3:-1);let o=i.videoConfig.playlistConfig.videoSwiper;fd(),Ef(`options`,i.swiperOptions)(`navigationConfig`,o==null?null:o.navigation)(`paginationConfig`,o==null?null:o.pagination),fd(2),AD(i.videoEntries);}},dependencies:[zt,$t,Ut,me,_e,Wt,a],styles:[`:host{display:block}cooee-swiper.swiper{margin:8px;padding-top:25px;padding-bottom:25px}.video-wrapper{position:relative;cursor:pointer;outline:none;border-radius:var(--lc-media-radius, 8px);background-size:cover;background-position:center;background-repeat:no-repeat}.video-wrapper video{width:100%;height:var(--lc-video-card-height);object-fit:cover;border-radius:var(--lc-media-radius, 8px);position:relative}.video-card.swiper-slide{width:var(--lc-video-card-width);transition:transform .3s ease}.video-card.swiper-slide:hover{transform:scale(1.05)}@media(max-width:768px),(prefers-reduced-motion:reduce){.video-card.swiper-slide{transition:none}.video-card.swiper-slide:hover{transform:none}}.video-controls{position:absolute;bottom:8px;z-index:10;right:8px;display:flex;gap:8px}.video-footer{overflow-x:hidden}cooee-item-card{cursor:pointer;padding-left:0!important;padding-right:0!important}cooee-item-card .item-image{width:50px;height:50px;display:none}cooee-item-card .item-detail-button{display:none!important}cooee-item-card .item-info{font-size:14px;line-height:normal;margin-right:unset!important}cooee-item-card .item-info .item-name{-webkit-line-clamp:1;overflow:hidden}.video-loading-overlay{border-radius:var(--lc-media-radius, 8px)}
36
- `],encapsulation:3})};var co=[`videoElement`],po=n=>({"cursor-grab":n}),nt=class n extends ye{videoElement;video;isDragging=false;hidden=false;cdkDrag=g(ge$1,{self:true});untilDestroyed=Ht();constructor(){super();}get popupClasses(){return this.hidden?[`hidden`]:[`visible`]}onClick(t){t.stopPropagation(),t.preventDefault(),this.onVideoClick();}ngOnInit(){super.ngOnInit();let t=this.elementRef.nativeElement.closest(`.letscooee-engagement`);t&&(t.style.zIndex=`10000`),this.cdkDrag.moved.pipe(this.untilDestroyed).subscribe(()=>this.isDragging=true);}ngAfterViewInit(){super.ngAfterViewInit(),setTimeout(()=>{this.autoPlay();},100);}onVideoClick(){if(this.isDragging){this.isDragging=false;return}this.hidden=true,this.onVideoTap(null,this.video,0);}close(){this.hidden=true;let t=(new Date().getTime()-this.triggerContext.startTime.getTime())/1e3;this.sendEvent(`CE Trigger Closed`,{duration:t});}engagementTriggerReceived(t){super.engagementTriggerReceived(t),this.video=this.videoEntries[0].video;}update(){}onDialogClosed(){this.hidden=false;}autoPlay(){let t=this.videoElement.nativeElement;this.hidden||this.playVideo(t);}static ɵfac=function(e){return new(e||n)};static ɵcmp=cf({type:n,selectors:[[`cooee-video-popup`]],viewQuery:function(e,i){if(e&1&&oc(co,5),e&2){let o;kf(o=Ff())&&(i.videoElement=o.first);}},hostAttrs:[`role`,`button`,`tabindex`,`0`,`aria-label`,`Open video popup `,`cdkDragBoundary`,`body`],hostVars:2,hostBindings:function(e,i){e&1&&Nf(`keydown.enter`,function(a){return i.onClick(a)})(`keydown.space`,function(a){return i.onClick(a)})(`click`,function(a){return i.onClick(a)}),e&2&&iv(i.popupClasses);},features:[np(Lt()),dD([{directive:ge$1,inputs:[`cdkDragBoundary`,`cdkDragBoundary`]}]),Wa],decls:9,vars:5,consts:[[`videoElement`,``],[1,`popup-inner`,3,`ngClass`],[`type`,`button`,`aria-label`,`Close video popup`,1,`close-button`,3,`click`],[`name`,`close`,`aria-hidden`,`true`],[1,`play-button`],[`name`,`unmute`,`aria-hidden`,`true`],[1,`text`],[`loop`,``,`preload`,`metadata`,`playsinline`,``,3,`muted`,`cooeeVideoSources`]],template:function(e,i){if(e&1){let o=FD();Xa(0,`div`,1)(1,`button`,2),Nf(`click`,function(l){return gu(o),l.stopPropagation(),mu(i.close())}),Cf(2,`cooee-icon`,3),ec(),Xa(3,`div`,4),Cf(4,`cooee-icon`,5),Xa(5,`div`,6),gv(6,`Tap to unmute`),ec()(),Cf(7,`video`,7,0),ec();}e&2&&(Ef(`ngClass`,Sv(3,po,i.isDragging)),fd(7),Ef(`muted`,true)(`cooeeVideoSources`,i.video));},dependencies:[AE,ye$1,_e],styles:[`:host{position:fixed;display:block;right:24px;bottom:24px;min-height:150px;max-width:150px;box-shadow:0 25px 50px -12px #00000040}:host(.hidden){display:none}.popup-inner{display:flex;justify-content:center;align-items:center;position:relative}video{width:100%;border-radius:8px;background-color:#fff}.close-button{position:absolute;top:-14px;right:-14px;background-color:#00000080;border-radius:9999px;width:32px;height:32px;border:none;z-index:10;display:flex;justify-content:center;align-items:center}.play-button{display:flex;justify-content:center;align-items:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) scale(1);transition:all .1s ease-in-out;z-index:999;flex-wrap:wrap;width:100%;max-width:130px;border-radius:5px;padding:5px 10px;background-color:#97979761;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}.play-button cooee-icon{width:14px;height:14px}.play-button .text{font-size:11px;line-height:1;color:#fff;font-weight:400;margin-left:5px;text-align:center}
35
+ `],encapsulation:3})};var Xn=[`videoEl`];async function Di(){return (await import('./video-detail-dialog.component-BeKaHHG2-BgDFixB0.js').then(function (n) { return n.v; })).VideoDetailDialogComponent}var ye=class n extends Pe{videoElements;videoEntries;videoConfig;dialogRef=null;dialog=g(Ro);isMobile=M$3();pausedVideos=[];videoLoadingStates=new Map;intersectionObserver;visibleVideos=new Set;constructor(){super(),Di();}ngAfterViewInit(){this.checkAndOpenVideoFromUrl();}ngOnDestroy(){super.ngOnDestroy(),this.intersectionObserver?.disconnect();}engagementTriggerReceived(t){this.videoConfig=t.content?.videoConfig,this.videoEntries=this.videoConfig.videoEntries;}onMuteToggled(t,e){t||this.videoElements.forEach(i=>{i.nativeElement!==e&&(i.nativeElement.muted=true,i.nativeElement.pause());});}sendTriggerClicked(t,e){this.sendEvent(`CE Trigger Clicked`,{},t,e);}async onVideoTap(t,e,i,o,a){t?.stopPropagation(),t?.preventDefault();let l=e.items?.[0];if(this.sendTriggerClicked(e,l),this.videoConfig.footerContent===`NONE`){o&&(o.muted=false,o.play(),this.onMuteToggled(false,o));return}await this.openDialog(e,i,a);}sendEvent(t,e,i,o){let a=new Ir$1(t,e,this.engagementTrigger);a.setVideos(i),o&&(a.items=[o.toEmbed()]),window.CooeeSDK.sendEvent(a);}onDialogClosed(){this.resumePlaylistVideos();}isVideoLoading(t){return this.videoLoadingStates.get(t)??true}onVideoLoadStart(t){this.videoLoadingStates.set(t,true);}onVideoCanPlay(t){this.videoLoadingStates.set(t,false);}playVideo(t){t.play().catch(e=>{Y$1.error(`Failed to play video:`,e);});}setupIntersectionObserver(t=.5,e=`50px`){this.intersectionObserver=new IntersectionObserver(i=>{i.forEach(o=>{let a=o.target,l=a.dataset.videoId;l&&(o.isIntersecting?(this.visibleVideos.add(l),this.handleVideoVisibilityChange(a,true)):(this.visibleVideos.delete(l),this.handleVideoVisibilityChange(a,false)));});},{threshold:t,rootMargin:e}),setTimeout(()=>{this.videoElements.forEach(i=>{this.intersectionObserver?.observe(i.nativeElement);});},100);}handleVideoVisibilityChange(t,e){e?this.onVideoBecameVisible(t):t.pause();}onVideoBecameVisible(t){this.playVideo(t);}pauseAllPlaylistVideos(){this.pausedVideos=[],this.videoElements.forEach(t=>{let e=t.nativeElement;e.paused||(this.pausedVideos.push(e),e.pause());});}resumePlaylistVideos(){this.pausedVideos.forEach(t=>{t.play().catch(()=>{});}),this.pausedVideos=[];}async checkAndOpenVideoFromUrl(){let t=We$4();if(!t||!this.videoEntries)return;let e=Je$2();if(e.utm_campaign?.toLowerCase()!==`shoppable_video`||e.utm_source?.toLowerCase()!==Ae$3)return;let i=this.videoEntries.findIndex(o=>o.video.shortID===+t);if(i!==-1){let o=this.videoEntries[i].video;await ce$2.set(`muted`,true),await this.openDialog(o,i);}}async openDialog(t,e,i){await Mi$1();let o={videoEntries:this.videoEntries,currentIndex:e,triggerContext:this.triggerContext,selectedItem:i};this.dialogRef&&this.dialogRef.close(),this.pauseAllPlaylistVideos();let a=await Di();this.dialogRef=this.dialog.open(a,{width:`100vw`,height:`100vh`,data:o,providers:on(this.triggerContext,{video:t,index:e}),disableClose:true});let l={videoID:t.id,videoIndex:e};this.sendEvent(`CE Video Dialog Opened`,{current:l},t),this.dialogRef.closed.subscribe(p=>{if(this.dialogRef=null,!p)return;let f=p.lastVideoDuration*1e3,M={videoID:p.lastVideo.id,videoIndex:p.lastVideoIndex,playedTillMS:f,playedTillPercent:f/p.lastVideo.durationMS};this.sendEvent(`CE Video Dialog Closed`,{current:M},p.lastVideo),this.onDialogClosed();});}static ɵfac=function(e){return new(e||n)};static ɵcmp=cf({type:n,selectors:[[`cooee-abstract-video`]],viewQuery:function(e,i){if(e&1&&oc(Xn,5),e&2){let o;kf(o=Ff())&&(i.videoElements=o);}},features:[Wa],decls:0,vars:0,template:function(e,i){},encapsulation:2})};var _e=class n{video=iN.required({alias:`cooeeVideoSources`});prioritySource=iN(`high`);elementRef=g(Se$1);constructor(){ws(()=>{this.updateSources();});}updateSources(){let t=this.elementRef.nativeElement,e=this.video(),i=this.prioritySource();t.querySelectorAll(`source`).forEach(a=>a.remove()),i===`best`?(this.addSource(e.bestSource),this.addSource(e.highSource),this.addSource(e.lowSource)):i===`low`?(this.addSource(e.lowSource),this.addSource(e.highSource),this.addSource(e.bestSource)):(this.addSource(e.highSource),this.addSource(e.bestSource),this.addSource(e.lowSource)),this.addSource(e.m3u8Source),t.load();}addSource(t){if(!t)return;let e=document.createElement(`source`);e.src=t.url,e.type=t.mimeType,this.elementRef.nativeElement.appendChild(e);}static ɵfac=function(e){return new(e||n)};static ɵdir=En$2({type:n,selectors:[[`video`,`cooeeVideoSources`,``]],inputs:{video:[1,`cooeeVideoSources`,`video`],prioritySource:[1,`prioritySource`]}})};var eo=(n,t)=>t.video.id;function to(n,t){if(n&1&&(Cf(0,`div`,1),bv(1,`safeHtml`)),n&2)Ef(`innerHTML`,Av(1,1,VD().videoConfig.heading),tm);}function io(n,t){n&1&&(Xa(0,`div`,6),Cf(1,`div`,12),ec());}function no(n,t){if(n&1){let e=FD();Xa(0,`cooee-mute-toggle`,13),Nf(`toggled`,function(o){gu(e),VD();let a=zD(7);return mu(VD().onMuteToggled(o,a))}),ec();}if(n&2){VD();let e=zD(7);Ef(`muted`,e.muted)(`videoEl`,e);}}function oo(n,t){if(n&1){let e=FD();Xa(0,`cooee-video-promoted-items`,16),Nf(`cardClick`,function(o){gu(e);let a=VD(2).$index,l=zD(7),p=Ev(0);return mu(VD().onItemCardClick(o,p,a,l))}),ec();}if(n&2){VD(2);Ef(`items`,Ev(0).items)(`centeredSlides`,false);}}function ro(n,t){if(n&1){let e=FD();Xa(0,`cooee-item-card`,17),Nf(`buttonClick`,function(){gu(e);let o=VD(2).$index,a=zD(7),l=Ev(0);return mu(VD().addToCartClicked(null,l,o,a))})(`click`,function(){gu(e);let o=VD(2).$index,a=zD(7),l=Ev(0),p=Ev(1);return mu(VD().onItemCardClick(p,l,o,a))}),ec();}if(n&2){VD(2);Ef(`item`,Ev(1));}}function ao(n,t){if(n&1&&TD(0,oo,1,2,`cooee-video-promoted-items`,14)(1,ro,1,1,`cooee-item-card`,15),n&2){VD();let e=Ev(0),i=VD();SD(Ev(2)===i.VideoConfigFooterContent.ITEM_SWIPER&&e.items.length>1?0:e.items.length?1:-1);}}function so(n,t){if(n&1){let e=FD();Xa(0,`cooee-video-card`,18),Nf(`linkClicked`,function(){gu(e),VD();let o=Ev(0);return mu(VD().sendTriggerClicked(o))}),ec();}if(n&2){VD();Ef(`card`,Ev(2));}}function lo(n,t){if(n&1){let e=FD();Xf(0)(1)(2),Xa(3,`div`,4)(4,`div`,5),Nf(`click`,function(o){let a=gu(e).$index,l=zD(7),p=Ev(0);return mu(VD().onVideoTap(o,p,a,l))})(`keydown.enter`,function(o){let a=gu(e).$index,l=zD(7),p=Ev(0);return mu(VD().onVideoTap(o,p,a,l))})(`keydown.space`,function(o){let a=gu(e).$index,l=zD(7),p=Ev(0);return mu(VD().onVideoTap(o,p,a,l))}),TD(5,io,2,0,`div`,6),Xa(6,`video`,7,0),Nf(`mouseenter`,function(){gu(e);let o=zD(7);VD();return mu(Ev(1)&&o.play())})(`mouseleave`,function(){gu(e);let o=zD(7);VD();return mu(Ev(1)&&o.pause())})(`loadstart`,function(){gu(e);let o=Ev(0);return mu(VD().onVideoLoadStart(o.id))})(`canplay`,function(){gu(e);let o=Ev(0);return mu(VD().onVideoCanPlay(o.id))}),ec(),Xa(8,`div`,8),TD(9,no,1,2,`cooee-mute-toggle`,9),ec()(),Xa(10,`div`,10),TD(11,ao,2,1)(12,so,1,1,`cooee-video-card`,11),ec()();}if(n&2){let e=t.$implicit,i=VD(),o=Ev(0),a=Ev(2),l=vv(e.video);fd(),vv(l.items[0]),fd();let f=vv(l.card)&&a===i.VideoConfigFooterContent.CARD;fd(2),ic(`background-image`,l.thumbnail?`url(`+l.thumbnail+`)`:null),fd(),SD(i.isVideoLoading(l.id)?5:-1),fd(),Ef(`cooeeVideoSources`,l)(`muted`,true),vf(`poster`,l.thumbnail)(`preload`,o?`metadata`:`none`)(`autoplay`,null)(`data-video-id`,l.id),fd(3),SD(i.videoConfig.showMuteButton?9:-1),fd(2),SD(i.videoConfig.showItems()?11:f?12:-1);}}var it=class n extends ye{VideoConfigFooterContent=se$2;VideoConfigAutoPlay=oe$2;swiperOptions=null;constructor(){super(),this.hasSwiper=true;}ngAfterViewInit(){super.ngAfterViewInit();let t=this.videoConfig.playlistConfig.videoSwiper,e=t?(this.isMobile?t.gapSm:t.gap)+`px`:window.cooeePlaylistGap??24,i=t?this.isMobile?t.maxInRowSm:t.maxInRow:`auto`;this.swiperOptions={direction:`horizontal`,effect:`slide`,loop:t?.loop,freeMode:true,spaceBetween:e,slidesPerView:i,mousewheel:{enabled:true,forceToAxis:true},autoplay:t?.autoplay?.enabled?{delay:t?.autoplay?.delay,disableOnInteraction:false}:false},this.setupIntersectionObserver(),this.playFirstVideo();}ngOnDestroy(){super.ngOnDestroy();}addToCartClicked(t,e,i,o){let a=e.items?.[0],l=he$3.get().website?.canChangeVariantInCart;if(e.items?.length>1||a?.hasVariants()&&!l){this.onItemCardClick(a,e,i,o);return}this.engagementService.executeCTA(he$2.ADD_TO_CART,{item:a,video:e});}goToPDP(t,e){t?.stopPropagation(),t?.preventDefault();let i=e.items?.[0];this.engagementService.executeCTA(he$2.GO_TO_PRODUCT,{item:i,video:e});}onItemCardClick(t,e,i,o){this.videoConfig.playlistConfig.itemCardClickBehavior===`OPEN_ITEM_DETAIL`?this.onVideoTap(null,e,i,o,t):this.onVideoTap(null,e,i,o);}update(){}onVideoCanPlay(t){if(super.onVideoCanPlay(t),!this.shouldAutoPlay()||this.dialogRef||!this.visibleVideos.has(t))return;let e=this.videoElements.find(i=>i.nativeElement.dataset.videoId===t)?.nativeElement;e&&this.playVideo(e);}onVideoBecameVisible(t){this.shouldAutoPlay()&&(this.dialogRef?this.pausedVideos.push(t):this.playVideo(t));}shouldAutoPlay(){return this.videoConfig.autoPlay===`ON`||this.videoConfig.autoPlay===`ON_HOVER`&&this.isMobile}playFirstVideo(){}static ɵfac=function(e){return new(e||n)};static ɵcmp=cf({type:n,selectors:[[`cooee-video-playlist`]],features:[np(Lt()),Wa],decls:8,vars:7,consts:[[`videoEl`,``],[1,`heading-text`,3,`innerHTML`],[3,`options`,`navigationConfig`,`paginationConfig`],[`ngProjectAs`,`swiper-slides`,5,[`swiper-slides`]],[1,`swiper-slide`,`video-card`],[`role`,`button`,`tabindex`,`0`,`aria-label`,`Play video`,`aria-haspopup`,`dialog`,1,`video-wrapper`,3,`click`,`keydown.enter`,`keydown.space`],[1,`video-loading-overlay`],[`width`,`100%`,`playsinline`,``,`loop`,``,3,`mouseenter`,`mouseleave`,`loadstart`,`canplay`,`cooeeVideoSources`,`muted`],[1,`video-controls`],[3,`muted`,`videoEl`],[`role`,`region`,`aria-label`,`Video details`,1,`video-footer`],[3,`card`],[1,`loading-spinner`],[3,`toggled`,`muted`,`videoEl`],[3,`items`,`centeredSlides`],[`role`,`button`,`tabindex`,`0`,`aria-label`,`Product detail`,3,`item`],[3,`cardClick`,`items`,`centeredSlides`],[`role`,`button`,`tabindex`,`0`,`aria-label`,`Product detail`,3,`buttonClick`,`click`,`item`],[3,`linkClicked`,`card`]],template:function(e,i){if(e&1&&(Xf(0)(1)(2),TD(3,to,2,3,`div`,1),Xa(4,`cooee-swiper`,2),nc(5,3),ND(6,lo,13,14,`div`,4,eo),Yo(),ec()),e&2){vv(!i.videoConfig.autoPlay||i.videoConfig.autoPlay===i.VideoConfigAutoPlay.ON),fd(),vv(i.videoConfig.autoPlay===i.VideoConfigAutoPlay.ON_HOVER),fd(),vv(i.videoConfig.footerContent),fd(),SD(i.videoConfig.heading?3:-1);let o=i.videoConfig.playlistConfig.videoSwiper;fd(),Ef(`options`,i.swiperOptions)(`navigationConfig`,o==null?null:o.navigation)(`paginationConfig`,o==null?null:o.pagination),fd(2),AD(i.videoEntries);}},dependencies:[zt,$t,Ut,me,_e,Wt,a],styles:[`:host{display:block}cooee-swiper.swiper{margin:8px;padding-top:25px;padding-bottom:25px}.video-wrapper{position:relative;cursor:pointer;outline:none;border-radius:var(--lc-media-radius, 8px);background-size:cover;background-position:center;background-repeat:no-repeat}.video-wrapper video{width:100%;height:var(--lc-video-card-height);object-fit:cover;border-radius:var(--lc-media-radius, 8px);position:relative}.video-card.swiper-slide{width:var(--lc-video-card-width);transition:transform .3s ease}.video-card.swiper-slide:hover{transform:scale(1.05)}@media(max-width:768px),(prefers-reduced-motion:reduce){.video-card.swiper-slide{transition:none}.video-card.swiper-slide:hover{transform:none}}.video-controls{position:absolute;bottom:8px;z-index:10;right:8px;display:flex;gap:8px}.video-footer{overflow-x:hidden}cooee-item-card{cursor:pointer;padding-left:0!important;padding-right:0!important}cooee-item-card .item-image{width:50px;height:50px;display:none}cooee-item-card .item-detail-button{display:none!important}cooee-item-card .item-info{font-size:14px;line-height:normal;margin-right:unset!important}cooee-item-card .item-info .item-name{-webkit-line-clamp:1;overflow:hidden}.video-loading-overlay{border-radius:var(--lc-media-radius, 8px)}
36
+ `],encapsulation:3})};var co=[`videoElement`],po=n=>({"cursor-grab":n}),nt=class n extends ye{videoElement;video;isDragging=false;hidden=false;cdkDrag=g(ge$1,{self:true});untilDestroyed=Ht();constructor(){super();}get popupClasses(){return this.hidden?[`hidden`]:[`visible`]}onClick(t){t.stopPropagation(),t.preventDefault(),this.onVideoClick();}ngOnInit(){super.ngOnInit();let t=this.elementRef.nativeElement.closest(`.letscooee-engagement`);t&&(t.style.zIndex=`10000`),this.cdkDrag.moved.pipe(this.untilDestroyed).subscribe(()=>this.isDragging=true);}ngAfterViewInit(){super.ngAfterViewInit(),setTimeout(()=>{this.autoPlay();},100);}onVideoClick(){if(this.isDragging){this.isDragging=false;return}this.hidden=true,this.onVideoTap(null,this.video,0);}close(){this.hidden=true;let t=(new Date().getTime()-this.triggerContext.startTime.getTime())/1e3;this.sendEvent(`CE Trigger Closed`,{duration:t});}engagementTriggerReceived(t){super.engagementTriggerReceived(t),this.video=this.videoEntries[0].video;}update(){}onDialogClosed(){this.hidden=false;}autoPlay(){let t=this.videoElement.nativeElement;this.hidden||this.playVideo(t);}static ɵfac=function(e){return new(e||n)};static ɵcmp=cf({type:n,selectors:[[`cooee-video-popup`]],viewQuery:function(e,i){if(e&1&&oc(co,5),e&2){let o;kf(o=Ff())&&(i.videoElement=o.first);}},hostAttrs:[`role`,`button`,`tabindex`,`0`,`aria-label`,`Open video popup `,`cdkDragBoundary`,`body`],hostVars:2,hostBindings:function(e,i){e&1&&Nf(`keydown.enter`,function(a){return i.onClick(a)})(`keydown.space`,function(a){return i.onClick(a)})(`click`,function(a){return i.onClick(a)}),e&2&&iv(i.popupClasses);},features:[np(Lt()),dD([{directive:ge$1,inputs:[`cdkDragBoundary`,`cdkDragBoundary`]}]),Wa],decls:9,vars:6,consts:[[`videoElement`,``],[1,`popup-inner`,3,`ngClass`],[`type`,`button`,`aria-label`,`Close video popup`,1,`close-button`,3,`click`],[`name`,`close`,`aria-hidden`,`true`],[1,`play-button`],[`name`,`unmute`,`aria-hidden`,`true`],[1,`text`],[`loop`,``,`preload`,`metadata`,`playsinline`,``,3,`muted`,`cooeeVideoSources`,`prioritySource`]],template:function(e,i){if(e&1){let o=FD();Xa(0,`div`,1)(1,`button`,2),Nf(`click`,function(l){return gu(o),l.stopPropagation(),mu(i.close())}),Cf(2,`cooee-icon`,3),ec(),Xa(3,`div`,4),Cf(4,`cooee-icon`,5),Xa(5,`div`,6),gv(6,`Tap to unmute`),ec()(),Cf(7,`video`,7,0),ec();}e&2&&(Ef(`ngClass`,Sv(4,po,i.isDragging)),fd(7),Ef(`muted`,true)(`cooeeVideoSources`,i.video)(`prioritySource`,`low`));},dependencies:[AE,ye$1,_e],styles:[`:host{position:fixed;display:block;right:24px;bottom:24px;min-height:150px;max-width:150px;box-shadow:0 25px 50px -12px #00000040}:host(.hidden){display:none}.popup-inner{display:flex;justify-content:center;align-items:center;position:relative}video{width:100%;border-radius:8px;background-color:#fff}.close-button{position:absolute;top:-14px;right:-14px;background-color:#00000080;border-radius:9999px;width:32px;height:32px;border:none;z-index:10;display:flex;justify-content:center;align-items:center}.play-button{display:flex;justify-content:center;align-items:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) scale(1);transition:all .1s ease-in-out;z-index:999;flex-wrap:wrap;width:100%;max-width:130px;border-radius:5px;padding:5px 10px;background-color:#97979761;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}.play-button cooee-icon{width:14px;height:14px}.play-button .text{font-size:11px;line-height:1;color:#fff;font-weight:400;margin-left:5px;text-align:center}
37
37
  `],encapsulation:3})};var mo=(n,t)=>t.video.id;function uo(n,t){if(n&1&&(Cf(0,`div`,1),bv(1,`safeHtml`)),n&2)Ef(`innerHTML`,Av(1,1,VD().videoConfig.heading),tm);}function fo(n,t){n&1&&(Xa(0,`div`,9),Cf(1,`div`,12),ec());}function go(n,t){if(n&1&&(Xa(0,`div`,11),gv(1),ec()),n&2){let e=VD().$implicit;fd(),Yf(e.title);}}function vo(n,t){if(n&1){let e=FD();Xa(0,`div`,4),Nf(`click`,function(o){let a=gu(e),l=a.$implicit,p=a.$index;return mu(VD().onVideoTap(o,l.video,p))})(`keydown.enter`,function(o){let a=gu(e),l=a.$implicit,p=a.$index;return mu(VD().onVideoTap(o,l.video,p))})(`keydown.space`,function(o){let a=gu(e),l=a.$implicit,p=a.$index;return mu(VD().onVideoTap(o,l.video,p))}),Mu(),Xa(1,`svg`,5),Cf(2,`circle`,6)(3,`circle`,7),ec(),bu(),Xa(4,`div`,8),TD(5,fo,2,0,`div`,9),Xa(6,`video`,10,0),Nf(`loadstart`,function(){let o=gu(e).$implicit;return mu(VD().onVideoLoadStart(o.video.id))})(`canplay`,function(){let o=gu(e).$implicit;return mu(VD().onVideoCanPlay(o.video.id))}),ec()(),TD(8,go,2,1,`div`,11),ec();}if(n&2){let e=t.$implicit,i=t.$index,o=VD();vf(`aria-label`,`Open video story `+(i+1)),fd(5),SD(o.isVideoLoading(e.video.id)?5:-1),fd(),Ef(`poster`,e.video.thumbnail)(`cooeeVideoSources`,e.video)(`prioritySource`,`low`)(`muted`,true),vf(`data-video-id`,e.video.id),fd(2),SD(e.title?8:-1);}}var ot=class n extends ye{constructor(){super();}ngAfterViewInit(){super.ngAfterViewInit(),this.setupIntersectionObserver();}ngOnDestroy(){super.ngOnDestroy();}update(){}static ɵfac=function(e){return new(e||n)};static ɵcmp=cf({type:n,selectors:[[`cooee-video-stories`]],features:[np(Lt()),Wa],decls:4,vars:1,consts:[[`videoEl`,``],[1,`heading-text`,3,`innerHTML`],[1,`video-stories`],[`role`,`button`,`tabindex`,`0`,1,`video-story`],[`role`,`button`,`tabindex`,`0`,1,`video-story`,3,`click`,`keydown.enter`,`keydown.space`],[`viewBox`,`0 0 100 100`],[`cx`,`50`,`cy`,`50`,`r`,`48`,`fill`,`none`,`stroke-width`,`4`],[`cx`,`50`,`cy`,`50`,`r`,`48`,`fill`,`none`,`stroke-width`,`4`,`stroke-linecap`,`round`,`stroke-dasharray`,`301.6`,`stroke-dashoffset`,`301.6`,1,`video-story-circle`],[1,`video-wrapper`],[1,`video-loading-overlay`],[`loop`,``,`playsinline`,``,`preload`,`metadata`,3,`loadstart`,`canplay`,`poster`,`cooeeVideoSources`,`prioritySource`,`muted`],[1,`video-story-title`],[1,`loading-spinner`]],template:function(e,i){e&1&&(TD(0,uo,2,3,`div`,1),Xa(1,`div`,2),ND(2,vo,9,8,`div`,3,mo),ec()),e&2&&(SD(i.videoConfig.heading?0:-1),fd(2),AD(i.videoEntries));},dependencies:[_e,a],styles:[`:host{display:block}.video-stories{display:flex;overflow:auto;margin:.75rem;gap:.75rem;justify-content:center;align-items:center;scrollbar-width:none}.video-stories::-webkit-scrollbar{display:none}@media(max-width:768px){.video-stories{justify-content:start!important}}.video-story{position:relative;width:5rem;cursor:pointer;flex-shrink:0}.video-story .video-story-title{margin-top:.25rem;font-size:.7rem;line-height:1.1;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.video-story svg{position:absolute;top:0;left:0;width:100%;height:100%}.video-story svg circle:first-child{stroke:#d1d5db}.video-story svg circle:last-child{stroke:#3b82f6}.video-story .video-wrapper{position:relative;width:100%;height:100%;border-radius:9999px;overflow:hidden}.video-story .video-wrapper video{width:100%;height:100%;object-fit:cover;border-radius:9999px;position:relative;z-index:1}.video-story .video-wrapper .video-loading-overlay{border-radius:9999px}
38
- `],encapsulation:3})};async function Rs(){let n=await QE(Pi),t=(e,i)=>{let o=Ii(e,{injector:n.injector});customElements.get(i)||customElements.define(i,o);};t(tt,`cooee-sticky-atc`),t(Ke,`cooee-savings-bar`),t(Ge,`cooee-progressbar`),t(it,`cooee-video-playlist`),t(nt,`cooee-video-popup`),t(ot,`cooee-video-stories`),t(Ne,`cooee-product-options-picker`),t(Qe,`cooee-collection-filter`),sessionStorage.cooeeDebug&&import('./debugger.component-Kuw65TJp-C9ZX4NMD.js').then(e=>{t(e.DebuggerComponent,`cooee-debugger`);}),window.cooeeShowQuickItem=(e,i)=>{n.injector.get(Je).showItemQuickView(e,i);};}
38
+ `],encapsulation:3})};async function Rs(){let n=await QE(Pi),t=(e,i)=>{let o=Ii(e,{injector:n.injector});customElements.get(i)||customElements.define(i,o);};t(tt,`cooee-sticky-atc`),t(Ke,`cooee-savings-bar`),t(Ge,`cooee-progressbar`),t(it,`cooee-video-playlist`),t(nt,`cooee-video-popup`),t(ot,`cooee-video-stories`),t(Ne,`cooee-product-options-picker`),t(Qe,`cooee-collection-filter`),sessionStorage.cooeeDebug&&import('./debugger.component-DmJsBk_N-D1HhF6Z7.js').then(e=>{t(e.DebuggerComponent,`cooee-debugger`);}),window.cooeeShowQuickItem=(e,i)=>{n.injector.get(Je).showItemQuickView(e,i);};}
39
39
 
40
- var widgetsDM4_RO8i = /*#__PURE__*/Object.freeze({
40
+ var widgetsCpAjP5CS = /*#__PURE__*/Object.freeze({
41
41
  __proto__: null,
42
42
  loadAngularWidgets: Rs
43
43
  });
44
44
 
45
- export { $t as $, Af as A, pf as B, Cf as C, zD as D, Ef as E, FE as F, Ge$2 as G, oc as H, kf as I, Ff as J, Ke$1 as K, Lt$2 as L, Mf as M, ND as N, oN as O, Ro as P, zt$2 as Q, Rv as R, Se$1 as S, ws as T, Ut as U, ic as V, W, Xa as X, Yf as Y, Zo as Z, vf as _, a, FD as a0, TD as a1, gu as a2, mu as a3, VD as a4, SD as a5, wf as a6, Cv as a7, Kf as a8, Qf as a9, Dv as aa, xv as ab, rm as ac, widgetsDM4_RO8i as ad, bD as b, cf as c, dD as d, AD as e, fd as f, gv as g, ge$1 as h, iN as i, bv as j, Av as k, tm as l, g as m, ec as n, Nf as o, Ye$1 as p, qo as q, Wt as r, Gt as s, tc as t, AE as u, nc as v, Yo as w, xE as x, ye$1 as y, zt as z };
45
+ export { $t as $, Af as A, pf as B, Cf as C, zD as D, Ef as E, FE as F, Ge$2 as G, oc as H, kf as I, Ff as J, Ke$1 as K, Lt$2 as L, Mf as M, ND as N, oN as O, Ro as P, zt$2 as Q, Rv as R, Se$1 as S, ws as T, Ut as U, ic as V, W, Xa as X, Yf as Y, Zo as Z, vf as _, a, FD as a0, TD as a1, gu as a2, mu as a3, VD as a4, SD as a5, wf as a6, Cv as a7, Kf as a8, Qf as a9, Dv as aa, xv as ab, rm as ac, widgetsCpAjP5CS as ad, bD as b, cf as c, dD as d, AD as e, fd as f, gv as g, ge$1 as h, iN as i, bv as j, Av as k, tm as l, g as m, ec as n, Nf as o, Ye$1 as p, qo as q, Wt as r, Gt as s, tc as t, AE as u, nc as v, Yo as w, xE as x, ye$1 as y, zt as z };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@letscooee/web-sdk",
3
3
  "description": "Engage uniquely and boost conversions with AI-powered customer journeys driven by real-time intent",
4
- "version": "14.8.4",
4
+ "version": "14.8.5",
5
5
  "scripts": {
6
6
  "postinstall": "bash .dev/setup.sh",
7
7
  "lint": "ng lint",