@letscooee/web-sdk 14.8.8 → 14.8.9

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 { q, d as H, e as Be, M, f as D$1, k as ke, m as mt, W as We, r as rn, Y, w as we, I as Ir, A as At, g as Ot, F as Fe, L as Lt, C as Ce, h as Ye, x as xt, _ as _t, i as A$1, S as Se, j as r, n as s, P as P$1, o as Sn, p as In, N as Nn, J as Jt, u as S, v as mt$1, y as ce, E as j, Q as Qt, G as he, K as ti, $ as $n, z as zn, R as de$1 } from './main.min.js';
2
2
 
3
- var A=class{loadedFonts=[];async loadAllFonts(e){e.elems?.forEach(t=>{t instanceof ce&&this.loadFamily(t.typography?.fam);});}async loadFamily(e){if(!e?.fonts||this.loadedFonts.indexOf(e.name)>-1)return;let t=[];e.fonts.forEach(n=>{if(n.url){let c=new FontFace(`cooee`+e.name,n.getURL(),n.getFontDescriptor());t.push(c.load());}}),this.loadedFonts.push(e.name),(await Promise.all(t)).forEach(n=>{document.fonts.add(n);});}};var R=class{static updateIdentity(e){if(!this.isInstalled())return;let t={};e.email&&(t.email=e.email),e.mobile&&(t.phone_number=e.mobile),Y.verbose(`Sending email/mobile to Klaviyo`),window.klaviyo.push([`identify`,t]);}static isInstalled(){return window.klaviyo&&typeof window.klaviyo==`object`}};var D=class{action;triggerContext;constructor(e,t){this.action=e,this.triggerContext=t;}async execute(){let e=this.containsCTA()?`CE Trigger Clicked`:`CE Trigger Closed`;switch(this.action.at!==he.SUBMIT_FORM&&await this.closeTriggerAndSendEvent(e),this.action.at){case he.ACCEPT_POPUP:break;case he.GO_TO_URL:this.gotoURLAction();break;case he.SHARE:this.shareAction();break;case he.SUBMIT_FORM:await this.collectFormData();break;case he.OPEN_CART:D$1.get().open();break;case he.INITIATE_CHECKOUT:ti();break;default:Y.error(`Received an invalid ClickActionType: `,this.action.at);return}}gotoURLAction(){if(this.action.gu?.u){let e=this.action.gu.u;$n(e)||(e=`//${e}`),window.open(e,`_self`);}}async closeTriggerAndSendEvent(e,t){this.triggerContext.closeInApp(e,t),await this.dispatchEvent();}shareAction(){if(!this.action.share)return;if(!navigator.share){Y.warn(`Navigator.share is not compatible with this browser`);return}navigator.share({text:this.action.share.text,title:`Share`}).then(t=>console.log(t)).catch(t=>console.error(t));}containsCTA(){return !!(this.action.at&&this.action.at!==he.REJECT_POPUP)}isEmpty(e){return e?Object.keys(e).length===0:true}async collectFormData(){let e={};for(let t of this.triggerContext.inputs){if(!t.isValid)return;let n=document.getElementById(t.id).value;t.type===51?e.email=n:t.type===52&&(e.mobile=n);}await this.closeTriggerAndSendEvent(`CE Form Submitted`,{form:e}),this.action.applyDiscount&&zn(`Coupon applied on cart`),R.updateIdentity(e);}async dispatchEvent(){let e=this.triggerContext.triggerData,t={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??e.embeddedItems??e.items,collections:e.collections,triggerData:e};await new de$1().process(t);let r={action:this.containsCTA()?`CLICKED`:`CLOSED`};document.dispatchEvent(new CustomEvent(`letscooee:outbound:popup-activities`,{detail:r}));}};var a=class{renderer=P.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;scalingFactor;constructor(e,t,r){this.parentHTMLEl=e,this.inappElement=t,this.triggerContext=r,this.scalingFactor=this.renderer.getScalingFactor();}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.parentHTMLEl.appendChild(this.inappHTMLEl);}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let e=s(r(r(r(r({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:`border-box`,outline:`none`});S(this.inappHTMLEl,e);}getDisplayStyles(){return {display:`block`}}processWidthAndHeight(){this.inappElement.w&&H(this.inappHTMLEl,`width`,P$1(this.inappElement.w,this.scalingFactor)),this.inappElement.h&&H(this.inappHTMLEl,`height`,P$1(this.inappElement.h,this.scalingFactor));}processPositionBlock(){let e={position:`absolute`,left:P$1(this.inappElement.x,this.scalingFactor),top:P$1(this.inappElement.y,this.scalingFactor)};S(this.inappHTMLEl,e);}getBorderStyles(){return Nn(this.inappElement.br,this.scalingFactor)}getSpaceStyles(){return Sn(this.inappElement.spc,this.scalingFactor)}processTransparency(){let e=this.inappElement.alpha;if(!isNaN(e)){let t=(e/100).toFixed(2);H(this.inappHTMLEl,`opacity`,t);}}processShadow(){let e=this.inappElement.shd;e?H(this.inappHTMLEl,`box-shadow`,e.getStyle(this.scalingFactor)):H(this.inappHTMLEl,`box-shadow`,`unset`);}processTransformBlock(){let e=new j(this.inappElement.trf);e&&e.rotate&&H(this.inappHTMLEl,`transform`,`rotate(${e.rotate}deg)`);}registerAction(){let e=this.inappElement.clc;!e||Object.keys(e).length===0||(this.inappHTMLEl.addEventListener(`click`,t=>{t.stopPropagation(),new D(e,this.triggerContext).execute();}),H(this.inappHTMLEl,`cursor`,`pointer`));}getBackgroundStyles(){return In(this.inappElement.bg)}};var l=class extends a{constructor(e,t,r){super(e,t,r);}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment();}processFontBlock(){let e={},t=this.inappElement.typography;return t&&(e.fontSize=P$1(t.fs,this.scalingFactor),e.fontFamily=`cooee`+t.fam?.name,e.lineHeight=`${t.lh}`,e.letterSpacing=t.letterSpacing),Jt(this.inappElement.color,`color`,e),S(this.inappHTMLEl,e),e}processPart(e,t){let r=[];t.u&&r.push(`underline`),t.st&&r.push(`line-through`),r.length||r.push(`normal`),H(e,`font-weight`,t.b?`bold`:`normal`),H(e,`font-style`,t.i?`italic`:`normal`),H(e,`text-decoration`,r.join(` `)),H(e,`color`,t.c??`inherit`),H(e,`font-family`,`inherit`);}processAlignment(){let e=this.inappElement.typography.ta,t=e?Qt[e]?.toLowerCase():this.inappElement.typography.alignment;t||(t=`start`),H(this.inappHTMLEl,`text-align`,t);}};var f=class extends l{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`div`),this.insertElement();}render(){this.inappElement.parts?.forEach(e=>{let t=document.createElement(`span`);t.innerHTML=e.txt?.toString()?.replace(/\n/g,`<br />`),this.processPart(t,e),this.inappHTMLEl.appendChild(t);}),this.processCommonBlocks();}};var v=class extends a{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`div`),this.insertElement();}render(){this.processCommonBlocks();}};var T=class extends a{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`img`),this.insertElement();}render(){this.inappHTMLEl.setAttribute(`src`,this.inappElement.src),H(this.inappHTMLEl,`max-width`,`none`),H(this.inappHTMLEl,`max-height`,`none`),H(this.inappHTMLEl,`margin`,`0 auto`),this.processCommonBlocks();}};var C=class o extends a{constructor(t,r,n){super(t,r,n);this.parent=t;this.inappHTMLEl=document.createElement(`div`);}static MAX_Z_INDEX=`2147483647`;render(){return this.parent||this.renderer.removeInApp(),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add(`cooee-wrapper`),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),H(this.inappHTMLEl,`z-index`,o.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let t=this.inappElement.cont;if(this.inappElement.cover)this.renderer.isParentNotBody()?(H(this.inappHTMLEl,`width`,`100%`),H(this.inappHTMLEl,`height`,`100%`)):(H(this.inappHTMLEl,`width`,`100vw`),H(this.inappHTMLEl,`height`,`100vh`)),H(this.inappHTMLEl,`top`,`0`),H(this.inappHTMLEl,`left`,`0`);else {let r=this.inappElement.spc,n=Se(t.w,this.scalingFactor)+r.getHorizontal(),c=Se(t.h,this.scalingFactor)+r.getVertical();H(this.inappHTMLEl,`width`,n+`px`),H(this.inappHTMLEl,`height`,c+`px`);}}getSpaceStyles(){return {padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return r(r({display:`flex`},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){this.renderer.isParentNotBody()?H(this.inappHTMLEl,`position`,`absolute`):H(this.inappHTMLEl,`position`,`fixed`);}getBorderStyles(){return {}}processTransparency(){}processTransformBlock(){}processShadow(){}};var de=`cooee-container`,k=class extends a{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`div`),this.insertElement();}render(){return this.processCommonBlocks(),H(this.inappHTMLEl,`position`,`relative`),H(this.inappHTMLEl,`overflow`,`hidden`),this.inappHTMLEl.classList.add(de),this}};var B=class o extends l{static DAYS=`Days`;static HOURS=`Hours`;static MINUTES=`Minutes`;static SECONDS=`Seconds`;elements;spans=[];constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`div`),this.insertElement();}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=s(r(r(r({flex:`1 1 0`},In(this.inappElement.bg)),Nn(this.inappElement.br,this.scalingFactor)),Sn(this.inappElement.spc,this.scalingFactor)),{marginLeft:P$1(this.inappElement.gap,this.scalingFactor),marginRight:P$1(this.inappElement.gap,this.scalingFactor)});this.addStylesToTimer(e);}getBackgroundStyles(){return {}}processFontBlock(){let e=super.processFontBlock();return Jt(this.inappElement.color,`color`,e),this.addStylesToTimer(e),e}getSpaceStyles(){return {}}getBorderStyles(){return {}}getDisplayStyles(){return {display:`flex`,flexWrap:`nowrap`,justifyContent:`center`}}addStylesToTimer(e){this.elements.forEach(t=>S(t,e));}addTimerChildren(){let e=this.inappElement.show;this.elements=[],e.day&&this.elements.push(this.getChild(o.DAYS)),e.hour&&this.elements.push(this.getChild(o.HOURS)),e.minute&&this.elements.push(this.getChild(o.MINUTES)),e.second&&this.elements.push(this.getChild(o.SECONDS)),this.elements.forEach(t=>this.inappHTMLEl.appendChild(t));}getChild(e){let t=document.createElement(`div`),r=document.createElement(`span`),n=document.createElement(`span`);return n.innerText=e,r.innerText=`00`,r.id=`lc-${e}`,H(n,`font-size`,`0.5em`),H(n,`text-align`,`center`),H(n,`font-family`,`inherit`),H(r,`text-align`,`center`),H(r,`font-family`,`inherit`),this.inappElement.lblPos===`start`?(t.appendChild(n),t.appendChild(r)):(t.appendChild(r),t.appendChild(n)),H(t,`display`,`flex`),H(t,`flex-direction`,this.inappElement.horizontal?``:`column`),H(t,`justify-content`,`center`),H(t,`align-items`,`center`),H(t,`gap`,`5px`),this.spans.push(r),t}processAndStartTimer(){let e=this.inappElement.timer.start(this.inappElement.timerType,t=>{this.spans.forEach(r=>{r.id===`lc-${o.DAYS}`?r.innerText=String(t.days).padStart(2,`0`):r.id===`lc-${o.HOURS}`?r.innerText=String(t.hours).padStart(2,`0`):r.id===`lc-${o.MINUTES}`?r.innerText=String(t.minutes).padStart(2,`0`):r.id===`lc-${o.SECONDS}`&&(r.innerText=String(t.seconds).padStart(2,`0`));});});this.triggerContext.intervals.push(e);}};var F=class extends l{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`select`),this.insertElement();}render(){H(this.inappHTMLEl,`background`,`#ffffff00`),H(this.inappHTMLEl,`outline`,`none`),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions();}addListener(e){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),e.addEventListener(`click`,t=>{t.stopPropagation();}),e.addEventListener(`change`,()=>{let t=new mt$1(JSON.parse(e.value));this.updateItems(t);});}updateItems(e){let t=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[t.toEmbed(e)];let r=this.parentHTMLEl.querySelector(`#coo-13`);if(!r)return;let n=e.imgs[0]??t.imgs?.at(0);n?.url&&r.setAttribute(`src`,n.url);}addOptions(){let e=this.triggerContext.triggerData.items,t=this.inappHTMLEl;if(!e?.length){t.add(this.createOption(this.inappElement.placeholderText));return}let r=this.triggerContext.selectedEmbeddedItems?.at(0);e[0].vars.forEach(n=>{t.add(this.createOption(n.name??`Default`,n,n.mID===r?.vID));});}createOption(e,t,r){let n=document.createElement(`option`);return n.text=e,n.value=JSON.stringify(t),r&&(n.selected=true),t||(n.disabled=true),n}};var u=class extends l{borderColor=``;constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`input`),this.insertElement();}render(){let e=this.setInputType();this.inappHTMLEl.setAttribute(`placeholder`,this.inappElement.placeholderText),H(this.inappHTMLEl,`background`,`#ffffff00`),H(this.inappHTMLEl,`outline`,`none`),this.inappHTMLEl.addEventListener(`click`,t=>{t.stopPropagation();}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,e),this.triggerContext.addInputField(e,this.inappElement.t);}};var O=class o extends u{static EMAIL_REGEX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;constructor(e,t,r){super(e,t,r);}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute(`type`,`email`),this.inappHTMLEl.setAttribute(`id`,e),e}addListener(e,t){e.addEventListener(`keydown`,r=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(o.EMAIL_REGEX)?(H(this.inappHTMLEl,`border-color`,this.borderColor),this.triggerContext.updateValidation(t,true)):(H(this.inappHTMLEl,`border-color`,`red`),this.triggerContext.updateValidation(t,false)),r.stopPropagation();});}};var N=class o extends u{static MOBILE_REGEX=/^\d+$/;constructor(e,t,r){super(e,t,r);}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute(`type`,`tel`),this.inappHTMLEl.setAttribute(`id`,e),e}addListener(e,t){e.addEventListener(`keydown`,r=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(o.MOBILE_REGEX)?(H(this.inappHTMLEl,`border-color`,this.borderColor),this.triggerContext.updateValidation(t,true)):(H(this.inappHTMLEl,`border-color`,`red`),this.triggerContext.updateValidation(t,false)),r.stopPropagation();});}};var _=class extends T{constructor(e,t,r){super(e,t,r);}render(){super.render(),this.inappHTMLEl.setAttribute(`id`,`coo-${this.inappElement.type}`);}};var P=class o{static DOCUMENT_STANDARD_MODE=`CSS1Compat`;static ACTIVE_TRIGGER_DATA;static _instance;parent;rootContainer;containerHTMLElement;ian;scalingFactor=1;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.resizeListener=()=>this.screenResized(),this.setParentContainer(e);}static get(){return o._instance}render(e){this.renderEngagement(new q(e));}getScalingFactor(){return this.scalingFactor}calculateScalingFactor(e){let t=e.max,r=e.cont.w,n=e.cont.h,c=e.spc,m=this.getWidth(),h=this.getHeight();t&&(m=m?Math.min(m,t):t,h=h?Math.min(h,t):t),h&&(m-=c.getHorizontal(),h-=c.getVertical(),m/h<r/n?this.scalingFactor=m/r:this.scalingFactor=h/n,this.scalingFactor=Math.min(this.scalingFactor,1));}setParentContainer(e){this.parent=e||document.body,this.isParentNotBody()&&H(this.parent,`position`,`relative`);}isParentNotBody(){return this.parent&&this.parent!==document.body}getWidth(){return this.isParentNotBody()?this.parent.clientWidth:document.compatMode===o.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parent.clientHeight:document.compatMode===o.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}async renderEngagement(e){this.triggerContext=new Be(new Date,e),this.triggerContext.onClose(t=>{this.closeInApp(t);}),this.ian=e.ian,(M()||e.previewType===`mobile`)&&this.ian.overrideForMobileView(),await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed();},e.getDelaySeconds()):this.withCartDrawerClosed();}withCartDrawerClosed(){if(!D$1.get().isOpen()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=window.CooeeSDK.cartDrawerToggle$.subscribe(({open:t})=>{!t&&this.startRenderingOnce();});}startRenderingOnce(){if(!this.shouldSkipCampaign()){o.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData,o._instance=this;try{this.startRendering();}catch(e){ke(e,`render-popup`,{triggerContext:this.triggerContext});return}this.sendTriggerDisplayed(),M()||window.addEventListener(`resize`,this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe();}}shouldSkipCampaign(){let e=this.triggerContext.triggerData;if(!e.previewType&&o.ACTIVE_TRIGGER_DATA){let r={triggerShown:new mt(o.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,r),true}if(We().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:`GoKwik popup is open`}),true;let t=rn.find(r=>!!document.querySelector(r.identifier));return t?(this.skipTrigger(e,{reason:`${t.gateway} modal is open`}),true):false}startRendering(){this.calculateScalingFactor(this.ian),this.rootContainer=new C(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext);}catch(e){throw Y.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(n=>n.mID));we(new Ir(`CE Trigger Displayed`,e,this.triggerContext.triggerData));document.dispatchEvent(new CustomEvent(`letscooee:outbound:popup-activities`,{detail:{action:`DISPLAYED`}}));}sendTriggerClosed(e){let t=e.eventName;delete e.eventName;let r=new Ir(t,e,this.triggerContext.triggerData);r.name===`CE Trigger Clicked`&&(r.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(n=>n.toEmbed())),we(r);}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500});}renderElement(e,t,r){t instanceof At?new O(e,t,r).render():t instanceof Ot?new N(e,t,r).render():t instanceof Fe?new f(e,t,r).render():t instanceof Lt?new _(e,t,r).render():t instanceof Ce?new T(e,t,r).render():t instanceof Ye?new v(e,t,r).render():t instanceof xt?new B(e,t,r).render():t instanceof _t?new F(e,t,r).render():Y.error(`Unsupported element type- `+t.type);}renderContainer(e){let t=this.ian?.cont;t&&(this.containerHTMLElement=new k(this.rootContainer,t,e).render().getHTMLElement(),new A().loadAllFonts(this.ian),this.ian.elems?.forEach(async r=>{await this.renderElement(this.containerHTMLElement,r,e);}),this.addEnterAnimation(this.ian.anim));}closeInApp(e){let t=this.ian.anim.getExitAnimation();this.sendTriggerClosed(e),o.ACTIVE_TRIGGER_DATA=void 0;let r=this.containerHTMLElement.animate(t,{duration:500,easing:`ease-in-out`});r.onfinish=()=>{this.removeInApp(),window.removeEventListener(`resize`,this.resizeListener);};}screenResized(){this.removeInApp(),this.startRendering();}removeInApp(){let e=document.querySelector(`.${this.triggerContext.rootClassName}`);e&&e.parentElement.removeChild(e);}skipTrigger(e,t){we(new Ir(`CE Campaign Rejected`,t,e));}async preloadImages(e){let t=e.ian;if(!t)return;let r=[];t.elems.forEach(n=>{let c=n.bg?.img?.src;if(c&&r.push(c),n.t===1){let m=n.src;if(!m)return;r.push(m);}}),t.bg?.img?.src&&r.push(t.bg.img.src),t.cont.bg?.img?.src&&r.push(t.cont.bg.img.src),await Promise.all(r.map(n=>A$1(n)));}};
3
+ var A=class{loadedFonts=[];async loadAllFonts(e){e.elems?.forEach(t=>{t instanceof ce&&this.loadFamily(t.typography?.fam);});}async loadFamily(e){if(!e?.fonts||this.loadedFonts.indexOf(e.name)>-1)return;let t=[];e.fonts.forEach(n=>{if(n.url){let c=new FontFace(`cooee`+e.name,n.getURL(),n.getFontDescriptor());t.push(c.load());}}),this.loadedFonts.push(e.name),(await Promise.all(t)).forEach(n=>{document.fonts.add(n);});}};var R=class{static updateIdentity(e){if(!this.isInstalled())return;let t={};e.email&&(t.email=e.email),e.mobile&&(t.phone_number=e.mobile),Y.verbose(`Sending email/mobile to Klaviyo`),window.klaviyo.push([`identify`,t]);}static isInstalled(){return window.klaviyo&&typeof window.klaviyo==`object`}};var D=class{action;triggerContext;constructor(e,t){this.action=e,this.triggerContext=t;}async execute(){let e=this.containsCTA()?`CE Trigger Clicked`:`CE Trigger Closed`;switch(this.action.at!==he.SUBMIT_FORM&&await this.closeTriggerAndSendEvent(e),this.action.at){case he.ACCEPT_POPUP:break;case he.GO_TO_URL:this.gotoURLAction();break;case he.SHARE:this.shareAction();break;case he.SUBMIT_FORM:await this.collectFormData();break;case he.OPEN_CART:D$1.get().open();break;case he.INITIATE_CHECKOUT:ti();break;default:Y.error(`Received an invalid ClickActionType: `,this.action.at);return}}gotoURLAction(){if(this.action.gu?.u){let e=this.action.gu.u;$n(e)||(e=`//${e}`),window.open(e,`_self`);}}async closeTriggerAndSendEvent(e,t){this.triggerContext.closeInApp(e,t),await this.dispatchEvent();}shareAction(){if(!this.action.share)return;if(!navigator.share){Y.warn(`Navigator.share is not compatible with this browser`);return}navigator.share({text:this.action.share.text,title:`Share`}).then(t=>console.log(t)).catch(t=>console.error(t));}containsCTA(){return !!(this.action.at&&this.action.at!==he.REJECT_POPUP)}isEmpty(e){return e?Object.keys(e).length===0:true}async collectFormData(){let e={};for(let t of this.triggerContext.inputs){if(!t.isValid)return;let n=document.getElementById(t.id).value;t.type===51?e.email=n:t.type===52&&(e.mobile=n);}await this.closeTriggerAndSendEvent(`CE Form Submitted`,{form:e}),this.action.applyDiscount&&zn(`Coupon applied on cart`),R.updateIdentity(e);}async dispatchEvent(){let e=this.triggerContext.triggerData,t={clickAction:this.action,items:this.triggerContext.selectedEmbeddedItems??e.embeddedItems??e.items,collections:e.collections,triggerData:e};await new de$1().process(t);let r={action:this.containsCTA()?`CLICKED`:`CLOSED`};document.dispatchEvent(new CustomEvent(`letscooee:outbound:popup-activities`,{detail:r}));}};var a=class{renderer=P.get();parentHTMLEl;inappElement;inappHTMLEl;triggerContext;scalingFactor;constructor(e,t,r){this.parentHTMLEl=e,this.inappElement=t,this.triggerContext=r,this.scalingFactor=this.renderer.getScalingFactor();}getHTMLElement(){return this.inappHTMLEl}insertElement(){this.parentHTMLEl.appendChild(this.inappHTMLEl);}processCommonBlocks(){this.processWidthAndHeight(),this.processPositionBlock(),this.processTransformBlock(),this.processTransparency(),this.processShadow(),this.registerAction();let e=s(r(r(r(r({},this.getDisplayStyles()),this.getSpaceStyles()),this.getBorderStyles()),this.getBackgroundStyles()),{boxSizing:`border-box`,outline:`none`});S(this.inappHTMLEl,e);}getDisplayStyles(){return {display:`block`}}processWidthAndHeight(){this.inappElement.w&&H(this.inappHTMLEl,`width`,P$1(this.inappElement.w,this.scalingFactor)),this.inappElement.h&&H(this.inappHTMLEl,`height`,P$1(this.inappElement.h,this.scalingFactor));}processPositionBlock(){let e={position:`absolute`,left:P$1(this.inappElement.x,this.scalingFactor),top:P$1(this.inappElement.y,this.scalingFactor)};S(this.inappHTMLEl,e);}getBorderStyles(){return Nn(this.inappElement.br,this.scalingFactor)}getSpaceStyles(){return Sn(this.inappElement.spc,this.scalingFactor)}processTransparency(){let e=this.inappElement.alpha;if(!isNaN(e)){let t=(e/100).toFixed(2);H(this.inappHTMLEl,`opacity`,t);}}processShadow(){let e=this.inappElement.shd;e?H(this.inappHTMLEl,`box-shadow`,e.getStyle(this.scalingFactor)):H(this.inappHTMLEl,`box-shadow`,`unset`);}processTransformBlock(){let e=new j(this.inappElement.trf);e&&e.rotate&&H(this.inappHTMLEl,`transform`,`rotate(${e.rotate}deg)`);}registerAction(){let e=this.inappElement.clc;!e||Object.keys(e).length===0||(this.inappHTMLEl.addEventListener(`click`,t=>{t.stopPropagation(),new D(e,this.triggerContext).execute();}),H(this.inappHTMLEl,`cursor`,`pointer`));}getBackgroundStyles(){return In(this.inappElement.bg)}};var l=class extends a{constructor(e,t,r){super(e,t,r);}processCommonBlocks(){super.processCommonBlocks(),this.processFontBlock(),this.processAlignment();}processFontBlock(){let e={},t=this.inappElement.typography;return t&&(e.fontSize=P$1(t.fs,this.scalingFactor),e.fontFamily=`cooee`+t.fam?.name,e.lineHeight=`${t.lh}`,e.letterSpacing=t.letterSpacing),Jt(this.inappElement.color,`color`,e),S(this.inappHTMLEl,e),e}processPart(e,t){let r=[];t.u&&r.push(`underline`),t.st&&r.push(`line-through`),r.length||r.push(`normal`),H(e,`font-weight`,t.b?`bold`:`normal`),H(e,`font-style`,t.i?`italic`:`normal`),H(e,`text-decoration`,r.join(` `)),H(e,`color`,t.c??`inherit`),H(e,`font-family`,`inherit`);}processAlignment(){let e=this.inappElement.typography.ta,t=e?Qt[e]?.toLowerCase():this.inappElement.typography.alignment;t||(t=`start`),H(this.inappHTMLEl,`text-align`,t);}};var f=class extends l{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`div`),this.insertElement();}render(){this.inappElement.parts?.forEach(e=>{let t=document.createElement(`span`);t.innerHTML=e.txt?.toString()?.replace(/\n/g,`<br />`),this.processPart(t,e),this.inappHTMLEl.appendChild(t);}),this.processCommonBlocks();}};var v=class extends a{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`div`),this.insertElement();}render(){this.processCommonBlocks();}};var T=class extends a{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`img`),this.insertElement();}render(){this.inappHTMLEl.setAttribute(`src`,this.inappElement.src),H(this.inappHTMLEl,`max-width`,`none`),H(this.inappHTMLEl,`max-height`,`none`),H(this.inappHTMLEl,`margin`,`0 auto`),this.processCommonBlocks();}};var C=class o extends a{constructor(t,r,n){super(t,r,n);this.parent=t;this.inappHTMLEl=document.createElement(`div`);}static MAX_Z_INDEX=`2147483647`;render(){return this.parent||this.renderer.removeInApp(),this.insertElement(),this.processCommonBlocks(),this.inappHTMLEl.classList.add(`cooee-wrapper`),this.inappHTMLEl.classList.add(this.triggerContext.rootClassName),H(this.inappHTMLEl,`z-index`,o.MAX_Z_INDEX),this.inappHTMLEl}getBackgroundStyles(){return this.inappElement.cover?super.getBackgroundStyles():{}}processWidthAndHeight(){let t=this.inappElement.cont;if(this.inappElement.cover)this.renderer.isParentNotBody()?(H(this.inappHTMLEl,`width`,`100%`),H(this.inappHTMLEl,`height`,`100%`)):(H(this.inappHTMLEl,`width`,`100vw`),H(this.inappHTMLEl,`height`,`100vh`)),H(this.inappHTMLEl,`top`,`0`),H(this.inappHTMLEl,`left`,`0`);else {let r=this.inappElement.spc,n=Se(t.w,this.scalingFactor)+r.getHorizontal(),c=Se(t.h,this.scalingFactor)+r.getVertical();H(this.inappHTMLEl,`width`,n+`px`),H(this.inappHTMLEl,`height`,c+`px`);}}getSpaceStyles(){return {padding:this.inappElement.spc.getPaddingCSS()}}getDisplayStyles(){return r(r({display:`flex`},this.inappElement.getStylesForWrapper()),this.inappElement.getFlexStylesForContainer())}processPositionBlock(){this.renderer.isParentNotBody()?H(this.inappHTMLEl,`position`,`absolute`):H(this.inappHTMLEl,`position`,`fixed`);}getBorderStyles(){return {}}processTransparency(){}processTransformBlock(){}processShadow(){}};var de=`cooee-container`,k=class extends a{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`div`),this.insertElement();}render(){return this.processCommonBlocks(),H(this.inappHTMLEl,`position`,`relative`),H(this.inappHTMLEl,`overflow`,`hidden`),this.inappHTMLEl.classList.add(de),this}};var B=class o extends l{static DAYS=`Days`;static HOURS=`Hours`;static MINUTES=`Minutes`;static SECONDS=`Seconds`;elements;spans=[];constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`div`),this.insertElement();}render(){this.addTimerChildren(),this.processAndStartTimer(),this.processCommonBlocks();let e=s(r(r(r({flex:`1 1 0`},In(this.inappElement.bg)),Nn(this.inappElement.br,this.scalingFactor)),Sn(this.inappElement.spc,this.scalingFactor)),{marginLeft:P$1(this.inappElement.gap,this.scalingFactor),marginRight:P$1(this.inappElement.gap,this.scalingFactor)});this.addStylesToTimer(e);}getBackgroundStyles(){return {}}processFontBlock(){let e=super.processFontBlock();return Jt(this.inappElement.color,`color`,e),this.addStylesToTimer(e),e}getSpaceStyles(){return {}}getBorderStyles(){return {}}getDisplayStyles(){return {display:`flex`,flexWrap:`nowrap`,justifyContent:`center`}}addStylesToTimer(e){this.elements.forEach(t=>S(t,e));}addTimerChildren(){let e=this.inappElement.show;this.elements=[],e.day&&this.elements.push(this.getChild(o.DAYS)),e.hour&&this.elements.push(this.getChild(o.HOURS)),e.minute&&this.elements.push(this.getChild(o.MINUTES)),e.second&&this.elements.push(this.getChild(o.SECONDS)),this.elements.forEach(t=>this.inappHTMLEl.appendChild(t));}getChild(e){let t=document.createElement(`div`),r=document.createElement(`span`),n=document.createElement(`span`);return n.innerText=e,r.innerText=`00`,r.id=`lc-${e}`,H(n,`font-size`,`0.5em`),H(n,`text-align`,`center`),H(n,`font-family`,`inherit`),H(r,`text-align`,`center`),H(r,`font-family`,`inherit`),this.inappElement.lblPos===`start`?(t.appendChild(n),t.appendChild(r)):(t.appendChild(r),t.appendChild(n)),H(t,`display`,`flex`),H(t,`flex-direction`,this.inappElement.horizontal?``:`column`),H(t,`justify-content`,`center`),H(t,`align-items`,`center`),H(t,`gap`,`5px`),this.spans.push(r),t}processAndStartTimer(){let e=this.inappElement.timer.start(this.inappElement.timerType,t=>{this.spans.forEach(r=>{r.id===`lc-${o.DAYS}`?r.innerText=String(t.days).padStart(2,`0`):r.id===`lc-${o.HOURS}`?r.innerText=String(t.hours).padStart(2,`0`):r.id===`lc-${o.MINUTES}`?r.innerText=String(t.minutes).padStart(2,`0`):r.id===`lc-${o.SECONDS}`&&(r.innerText=String(t.seconds).padStart(2,`0`));});});this.triggerContext.intervals.push(e);}};var F=class extends l{constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`select`),this.insertElement();}render(){H(this.inappHTMLEl,`background`,`#ffffff00`),H(this.inappHTMLEl,`outline`,`none`),this.processCommonBlocks(),this.addListener(this.inappHTMLEl),this.addOptions();}addListener(e){this.triggerContext.selectedEmbeddedItems?.length||this.updateItems(this.triggerContext.triggerData.items[0].vars[0]),e.addEventListener(`click`,t=>{t.stopPropagation();}),e.addEventListener(`change`,()=>{let t=new mt$1(JSON.parse(e.value));this.updateItems(t);});}updateItems(e){let t=this.triggerContext.triggerData.items[0];this.triggerContext.selectedEmbeddedItems=[t.toEmbed(e)];let r=this.parentHTMLEl.querySelector(`#coo-13`);if(!r)return;let n=e.imgs[0]??t.imgs?.at(0);n?.url&&r.setAttribute(`src`,n.url);}addOptions(){let e=this.triggerContext.triggerData.items,t=this.inappHTMLEl;if(!e?.length){t.add(this.createOption(this.inappElement.placeholderText));return}let r=this.triggerContext.selectedEmbeddedItems?.at(0);e[0].vars.forEach(n=>{t.add(this.createOption(n.name??`Default`,n,n.mID===r?.vID));});}createOption(e,t,r){let n=document.createElement(`option`);return n.text=e,n.value=JSON.stringify(t),r&&(n.selected=true),t||(n.disabled=true),n}};var u=class extends l{borderColor=``;constructor(e,t,r){super(e,t,r),this.inappHTMLEl=document.createElement(`input`),this.insertElement();}render(){let e=this.setInputType();this.inappHTMLEl.setAttribute(`placeholder`,this.inappElement.placeholderText),H(this.inappHTMLEl,`background`,`#ffffff00`),H(this.inappHTMLEl,`outline`,`none`),this.inappHTMLEl.addEventListener(`click`,t=>{t.stopPropagation();}),this.processCommonBlocks(),this.addListener(this.inappHTMLEl,e),this.triggerContext.addInputField(e,this.inappElement.t);}};var O=class o extends u{static EMAIL_REGEX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;constructor(e,t,r){super(e,t,r);}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute(`type`,`email`),this.inappHTMLEl.setAttribute(`id`,e),e}addListener(e,t){e.addEventListener(`keydown`,r=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(o.EMAIL_REGEX)?(H(this.inappHTMLEl,`border-color`,this.borderColor),this.triggerContext.updateValidation(t,true)):(H(this.inappHTMLEl,`border-color`,`red`),this.triggerContext.updateValidation(t,false)),r.stopPropagation();});}};var N=class o extends u{static MOBILE_REGEX=/^\d+$/;constructor(e,t,r){super(e,t,r);}setInputType(){let e=`coo-${this.inappElement.t}`;return this.inappHTMLEl.setAttribute(`type`,`tel`),this.inappHTMLEl.setAttribute(`id`,e),e}addListener(e,t){e.addEventListener(`keydown`,r=>{this.borderColor||(this.borderColor=this.inappHTMLEl.style.borderColor),e.value.match(o.MOBILE_REGEX)?(H(this.inappHTMLEl,`border-color`,this.borderColor),this.triggerContext.updateValidation(t,true)):(H(this.inappHTMLEl,`border-color`,`red`),this.triggerContext.updateValidation(t,false)),r.stopPropagation();});}};var _=class extends T{constructor(e,t,r){super(e,t,r);}render(){super.render(),this.inappHTMLEl.setAttribute(`id`,`coo-${this.inappElement.type}`);}};var P=class o{static DOCUMENT_STANDARD_MODE=`CSS1Compat`;static ACTIVE_TRIGGER_DATA;static _instance;parent;rootContainer;containerHTMLElement;ian;scalingFactor=1;triggerContext;resizeListener;cartDrawerToggleSubscription;constructor(e){this.resizeListener=()=>this.screenResized(),this.setParentContainer(e);}static get(){return o._instance}render(e){this.renderEngagement(new q(e));}getScalingFactor(){return this.scalingFactor}calculateScalingFactor(e){let t=e.max,r=e.cont.w,n=e.cont.h,c=e.spc,m=this.getWidth(),h=this.getHeight();t&&(m=m?Math.min(m,t):t,h=h?Math.min(h,t):t),h&&(m-=c.getHorizontal(),h-=c.getVertical(),m/h<r/n?this.scalingFactor=m/r:this.scalingFactor=h/n,this.scalingFactor=Math.min(this.scalingFactor,1));}setParentContainer(e){this.parent=e||document.body,this.isParentNotBody()&&H(this.parent,`position`,`relative`);}isParentNotBody(){return this.parent&&this.parent!==document.body}getWidth(){return this.isParentNotBody()?this.parent.clientWidth:document.compatMode===o.DOCUMENT_STANDARD_MODE?document.documentElement.clientWidth:window.innerWidth}getHeight(){return this.isParentNotBody()?this.parent.clientHeight:document.compatMode===o.DOCUMENT_STANDARD_MODE?document.documentElement.clientHeight:window.innerHeight}async renderEngagement(e){this.triggerContext=new Be(new Date,e),this.triggerContext.onClose(t=>{this.closeInApp(t);}),this.ian=e.ian,(M()||e.previewType===`mobile`)&&this.ian.overrideForMobileView(),await this.preloadImages(e),e.shouldDelay()?window.setTimeout(()=>{this.withCartDrawerClosed();},e.getDelaySeconds()):this.withCartDrawerClosed();}withCartDrawerClosed(){if(!D$1.get().isOpen()){this.startRenderingOnce();return}this.cartDrawerToggleSubscription=window.CooeeSDK.cartDrawerToggle$.subscribe(({open:t})=>{!t&&this.startRenderingOnce();});}startRenderingOnce(){if(!this.shouldSkipCampaign()){o.ACTIVE_TRIGGER_DATA=this.triggerContext.triggerData,o._instance=this;try{this.startRendering();}catch(e){ke(e,`popup_render_start`,{triggerContext:this.triggerContext});return}this.sendTriggerDisplayed(),M()||window.addEventListener(`resize`,this.resizeListener),this.cartDrawerToggleSubscription?.unsubscribe();}}shouldSkipCampaign(){let e=this.triggerContext.triggerData;if(!e.previewType&&o.ACTIVE_TRIGGER_DATA){let r={triggerShown:new mt(o.ACTIVE_TRIGGER_DATA??{})};return this.skipTrigger(e,r),true}if(We().isGoKwikPopupOpen)return this.skipTrigger(e,{reason:`GoKwik popup is open`}),true;let t=rn.find(r=>!!document.querySelector(r.identifier));return t?(this.skipTrigger(e,{reason:`${t.gateway} modal is open`}),true):false}startRendering(){this.calculateScalingFactor(this.ian),this.rootContainer=new C(this.parent,this.ian,this.triggerContext).render();try{this.renderContainer(this.triggerContext);}catch(e){throw Y.error(e),e}}sendTriggerDisplayed(){let e={};this.triggerContext.triggerData.items?.length&&(e.promotedMIDs=this.triggerContext.triggerData.items?.map(n=>n.mID));we(new Ir(`CE Trigger Displayed`,e,this.triggerContext.triggerData));document.dispatchEvent(new CustomEvent(`letscooee:outbound:popup-activities`,{detail:{action:`DISPLAYED`}}));}sendTriggerClosed(e){let t=e.eventName;delete e.eventName;let r=new Ir(t,e,this.triggerContext.triggerData);r.name===`CE Trigger Clicked`&&(r.items=this.triggerContext.selectedEmbeddedItems??this.triggerContext.triggerData.items?.map(n=>n.toEmbed())),we(r);}addEnterAnimation(e){this.containerHTMLElement.animate(e.getEnterAnimation(),{duration:500});}renderElement(e,t,r){t instanceof At?new O(e,t,r).render():t instanceof Ot?new N(e,t,r).render():t instanceof Fe?new f(e,t,r).render():t instanceof Lt?new _(e,t,r).render():t instanceof Ce?new T(e,t,r).render():t instanceof Ye?new v(e,t,r).render():t instanceof xt?new B(e,t,r).render():t instanceof _t?new F(e,t,r).render():Y.error(`Unsupported element type- `+t.type);}renderContainer(e){let t=this.ian?.cont;t&&(this.containerHTMLElement=new k(this.rootContainer,t,e).render().getHTMLElement(),new A().loadAllFonts(this.ian),this.ian.elems?.forEach(async r=>{await this.renderElement(this.containerHTMLElement,r,e);}),this.addEnterAnimation(this.ian.anim));}closeInApp(e){let t=this.ian.anim.getExitAnimation();this.sendTriggerClosed(e),o.ACTIVE_TRIGGER_DATA=void 0;let r=this.containerHTMLElement.animate(t,{duration:500,easing:`ease-in-out`});r.onfinish=()=>{this.removeInApp(),window.removeEventListener(`resize`,this.resizeListener);};}screenResized(){this.removeInApp(),this.startRendering();}removeInApp(){let e=document.querySelector(`.${this.triggerContext.rootClassName}`);e&&e.parentElement.removeChild(e);}skipTrigger(e,t){we(new Ir(`CE Campaign Rejected`,t,e));}async preloadImages(e){let t=e.ian;if(!t)return;let r=[];t.elems.forEach(n=>{let c=n.bg?.img?.src;if(c&&r.push(c),n.t===1){let m=n.src;if(!m)return;r.push(m);}}),t.bg?.img?.src&&r.push(t.bg.img.src),t.cont.bg?.img?.src&&r.push(t.cont.bg.img.src),await Promise.all(r.map(n=>A$1(n)));}};
4
4
 
5
5
  export { P as FreeformRenderer };
@@ -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-BWtmfMEz-TevHiqz5.js';
3
- import { l, f } from './video-detail-dialog.component-Be1TGq0U-DmeTyU9p.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-D0-bQHXb-BIignp4Z.js';
3
+ import { l, f } from './video-detail-dialog.component-D3mxqAg1-BwuGJBF5.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 Hi, 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-BWtmfMEz-TevHiqz5.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-D0-bQHXb-BIignp4Z.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(),o=()=>{this.progress.set(e.currentTime/e.duration*100);};e.addEventListener(`timeupdate`,o),t(()=>{e.removeEventListener(`timeupdate`,o);});});}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,o){e&1&&(qo(0,`div`,0)(1,`div`,1),tc(2,`div`),Zo()()),e&2&&(fd(),ic(`width`,o.progress(),`%`),vf(`aria-valuenow`,o.progress()));},styles:[`[_nghost-%COMP%]{display:block;width:100%;position:absolute;z-index:10;top:4px;padding-inline:8px;box-sizing:border-box}.video-untracked-path[_ngcontent-%COMP%], .video-tracked-path[_ngcontent-%COMP%]{height:4px;border-radius:var(--lc-video-progress-bar-radius)}.video-untracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-bg-color));width:100%;margin-bottom:2px}.video-tracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-color));transition:width .5s ease-in-out}@media(prefers-reduced-motion:reduce){.video-tracked-path[_ngcontent-%COMP%]{transition:none}}`]})};var 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-foe7d65x-BNSjT4D1.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,o){e&1&&(Xa(0,`button`,0),Nf(`click`,function(r){return o.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(i){gu(e);let r=VD(2).$implicit;return mu(VD().productCardClicked(i,r.video))})(`atcSuccess`,function(){gu(e);return mu(VD(3).onAtcSuccess())}),ec();}if(n&2){let e=VD(2).$implicit;Ef(`items`,e.video.items);}}function Fe(n,t){if(n&1&&Cf(0,`cooee-video-card`,23),n&2){let e=VD(2).$implicit;Ef(`card`,e.video.card);}}function ze(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(i){gu(e);let r=VD(2);return Dv(r.muted,i)||(r.muted=i),mu(i)}),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(i){gu(e);return mu(VD(2).shareDialogOpen.set(i))}),ec()(),Xa(6,`div`,21),TD(7,Ne,1,1,`cooee-video-promoted-items`,22)(8,Fe,1,1,`cooee-video-card`,23),ec();}if(n&2){let e=VD().$implicit,o=zD(5),i=VD(),r=zD(9);Ef(`video`,o),fd(2),Qf(`muted`,i.muted),Ef(`videoEl`,o),fd(),Ef(`ngTemplateOutlet`,r),fd(4),SD(e.video.items.length&&i.videoConfig.showItems()?7:e.video.card&&i.videoConfig.footerContent===i.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())})(`atcSuccess`,function(){gu(e);return mu(VD(2).onAtcSuccess())}),ec();}if(n&2){let e=VD(2);Ef(`item`,e.selectedItem)(`similarItems`,e.selectedVideo.items)(`template`,e.videoConfig.itemDetailConfig.template);}}function Ae(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 i=gu(e).$index,r=VD();return mu(r.currentIndex===i&&r.toggleMute())})(`ended`,function(){gu(e);let i=zD(5);return mu(VD().onVideoEnded(i))})(`loadstart`,function(){let i=gu(e).$index;return mu(VD().onVideoLoadStart(i))})(`canplay`,function(){let i=gu(e).$index;return mu(VD().onVideoCanPlay(i))}),ND(6,Me,1,3,`source`,13,Pe),ec(),TD(8,ze,9,5),ec(),TD(9,Le,1,3,`cooee-item-detail`,14),ec()();}if(n&2){let e=t.$implicit,o=t.$index,i=VD();fd(2),ic(`background-image`,e.video.thumbnail?`url(`+e.video.thumbnail+`)`:null),fd(),SD(i.shouldShowVideoSpinner(o)?3:-1),fd(),Ef(`ngClass`,i.viewTemplateClassName)(`muted`,true),vf(`preload`,i.isVideoVisible(o)?`metadata`:`none`)(`data-video-id`,e.video.id)(`autoplay`,null),fd(2),AD(e.video.sources),fd(2),SD(i.currentIndex===o?8:-1),fd(),SD(i.selectedItem&&i.currentIndex===o?9:-1);}}function Re(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=Hi(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;}onAtcSuccess(){this.videoConfig.detailPopup.closeDialogOnAtc&&this.close();}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 o=[`CE Last Video Ended`,{previous:this.getPreviousVideoDataForEvent()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(o),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 i=new Ir(`CE More Item Info Clicked`,{current:{videoID:e.id,videoIndex:this.currentIndex}},this.engagementTrigger);i.setVideos(e),window.CooeeSDK.sendEvent(i),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,o=this.currentIndex+1;return t===this.currentIndex||t===e||t===o}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:o=>{this.swiperInitialized.set(true),setTimeout(()=>{o.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(i=>i.nativeElement.dataset.videoId===this.videoEntries[this.currentIndex].video.id)?.nativeElement;t.playedTillMS=Math.ceil(e?.currentTime*1e3);let o=e?.duration*1e3;return t.playedTillPercent=+(t.playedTillMS/o).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(v=>v.video.sources?.[0]).filter(v=>v?.width&&v?.height).map(v=>({width:v.width,height:v.height,aspectRatio:v.width/v.height}));if(t.length===0)return null;let e=t[0],o=window.innerWidth*.9,i=window.innerHeight*.9,r=o/e.width,k=i/e.height,R=Math.min(r,k);return {width:Math.floor(e.width*R),height:Math.floor(e.height*R)}}setVideoContainerDimensions(t,e){let o=this.elementRef.nativeElement;o.style.setProperty(`--video-container-width`,`${t}px`),o.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,o){if(e&1&&oc(Te,7)(Ie,5),e&2){let i;kf(i=Ff())&&(o.swiperComponent=i.first),kf(i=Ff())&&(o.videoElements=i);}},hostAttrs:[1,`letscooee-widget`],hostBindings:function(e,o){e&1&&Nf(`keydown.escape`,function(r){return o.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`,`atcSuccess`,`items`],[1,`swiper-no-swiping`,`swiper-no-mousewheel`,3,`closeClick`,`atcSuccess`,`item`,`similarItems`,`template`],[`type`,`button`,`aria-label`,`Close`,1,`lc-close-button`,3,`click`],[`name`,`close`,`aria-hidden`,`true`]],template:function(e,o){if(e&1&&(Xa(0,`div`,3)(1,`cooee-swiper`,4,0),Nf(`slideChange`,function(r){return o.onSlideChange(r)}),nc(3,5),ND(4,Ae,10,10,`div`,6,Se),Yo(),ec(),Xa(6,`div`,7),pf(7,Re,1,0,`ng-container`,8),ec()(),pf(8,Be,2,0,`ng-template`,null,1,xv)),e&2){let i=zD(9);Ef(`ngClass`,o.viewTemplateClassName),fd(),Ef(`options`,o.swiperOptions())(`navigationConfig`,o.navigationConfig),fd(3),AD(o.videoEntries),fd(3),Ef(`ngTemplateOutlet`,i);}},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(),o=()=>{this.progress.set(e.currentTime/e.duration*100);};e.addEventListener(`timeupdate`,o),t(()=>{e.removeEventListener(`timeupdate`,o);});});}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,o){e&1&&(qo(0,`div`,0)(1,`div`,1),tc(2,`div`),Zo()()),e&2&&(fd(),ic(`width`,o.progress(),`%`),vf(`aria-valuenow`,o.progress()));},styles:[`[_nghost-%COMP%]{display:block;width:100%;position:absolute;z-index:10;top:4px;padding-inline:8px;box-sizing:border-box}.video-untracked-path[_ngcontent-%COMP%], .video-tracked-path[_ngcontent-%COMP%]{height:4px;border-radius:var(--lc-video-progress-bar-radius)}.video-untracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-bg-color));width:100%;margin-bottom:2px}.video-tracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-color));transition:width .5s ease-in-out}@media(prefers-reduced-motion:reduce){.video-tracked-path[_ngcontent-%COMP%]{transition:none}}`]})};var 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-BGI1WbUR-CPwVCOca.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,o){e&1&&(Xa(0,`button`,0),Nf(`click`,function(r){return o.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(i){gu(e);let r=VD(2).$implicit;return mu(VD().productCardClicked(i,r.video))})(`atcSuccess`,function(){gu(e);return mu(VD(3).onAtcSuccess())}),ec();}if(n&2){let e=VD(2).$implicit;Ef(`items`,e.video.items);}}function Fe(n,t){if(n&1&&Cf(0,`cooee-video-card`,23),n&2){let e=VD(2).$implicit;Ef(`card`,e.video.card);}}function ze(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(i){gu(e);let r=VD(2);return Dv(r.muted,i)||(r.muted=i),mu(i)}),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(i){gu(e);return mu(VD(2).shareDialogOpen.set(i))}),ec()(),Xa(6,`div`,21),TD(7,Ne,1,1,`cooee-video-promoted-items`,22)(8,Fe,1,1,`cooee-video-card`,23),ec();}if(n&2){let e=VD().$implicit,o=zD(5),i=VD(),r=zD(9);Ef(`video`,o),fd(2),Qf(`muted`,i.muted),Ef(`videoEl`,o),fd(),Ef(`ngTemplateOutlet`,r),fd(4),SD(e.video.items.length&&i.videoConfig.showItems()?7:e.video.card&&i.videoConfig.footerContent===i.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())})(`atcSuccess`,function(){gu(e);return mu(VD(2).onAtcSuccess())}),ec();}if(n&2){let e=VD(2);Ef(`item`,e.selectedItem)(`similarItems`,e.selectedVideo.items)(`template`,e.videoConfig.itemDetailConfig.template);}}function Ae(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 i=gu(e).$index,r=VD();return mu(r.currentIndex===i&&r.toggleMute())})(`ended`,function(){gu(e);let i=zD(5);return mu(VD().onVideoEnded(i))})(`loadstart`,function(){let i=gu(e).$index;return mu(VD().onVideoLoadStart(i))})(`canplay`,function(){let i=gu(e).$index;return mu(VD().onVideoCanPlay(i))}),ND(6,Me,1,3,`source`,13,Pe),ec(),TD(8,ze,9,5),ec(),TD(9,Le,1,3,`cooee-item-detail`,14),ec()();}if(n&2){let e=t.$implicit,o=t.$index,i=VD();fd(2),ic(`background-image`,e.video.thumbnail?`url(`+e.video.thumbnail+`)`:null),fd(),SD(i.shouldShowVideoSpinner(o)?3:-1),fd(),Ef(`ngClass`,i.viewTemplateClassName)(`muted`,true),vf(`preload`,i.isVideoVisible(o)?`metadata`:`none`)(`data-video-id`,e.video.id)(`autoplay`,null),fd(2),AD(e.video.sources),fd(2),SD(i.currentIndex===o?8:-1),fd(),SD(i.selectedItem&&i.currentIndex===o?9:-1);}}function Re(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=Hi(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;}onAtcSuccess(){this.videoConfig.detailPopup.closeDialogOnAtc&&this.close();}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 o=[`CE Last Video Ended`,{previous:this.getPreviousVideoDataForEvent()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(o),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 i=new Ir(`CE More Item Info Clicked`,{current:{videoID:e.id,videoIndex:this.currentIndex}},this.engagementTrigger);i.setVideos(e),window.CooeeSDK.sendEvent(i),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,o=this.currentIndex+1;return t===this.currentIndex||t===e||t===o}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:o=>{this.swiperInitialized.set(true),setTimeout(()=>{o.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(i=>i.nativeElement.dataset.videoId===this.videoEntries[this.currentIndex].video.id)?.nativeElement;t.playedTillMS=Math.ceil(e?.currentTime*1e3);let o=e?.duration*1e3;return t.playedTillPercent=+(t.playedTillMS/o).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(v=>v.video.sources?.[0]).filter(v=>v?.width&&v?.height).map(v=>({width:v.width,height:v.height,aspectRatio:v.width/v.height}));if(t.length===0)return null;let e=t[0],o=window.innerWidth*.9,i=window.innerHeight*.9,r=o/e.width,k=i/e.height,R=Math.min(r,k);return {width:Math.floor(e.width*R),height:Math.floor(e.height*R)}}setVideoContainerDimensions(t,e){let o=this.elementRef.nativeElement;o.style.setProperty(`--video-container-width`,`${t}px`),o.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,o){if(e&1&&oc(Te,7)(Ie,5),e&2){let i;kf(i=Ff())&&(o.swiperComponent=i.first),kf(i=Ff())&&(o.videoElements=i);}},hostAttrs:[1,`letscooee-widget`],hostBindings:function(e,o){e&1&&Nf(`keydown.escape`,function(r){return o.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`,`atcSuccess`,`items`],[1,`swiper-no-swiping`,`swiper-no-mousewheel`,3,`closeClick`,`atcSuccess`,`item`,`similarItems`,`template`],[`type`,`button`,`aria-label`,`Close`,1,`lc-close-button`,3,`click`],[`name`,`close`,`aria-hidden`,`true`]],template:function(e,o){if(e&1&&(Xa(0,`div`,3)(1,`cooee-swiper`,4,0),Nf(`slideChange`,function(r){return o.onSlideChange(r)}),nc(3,5),ND(4,Ae,10,10,`div`,6,Se),Yo(),ec(),Xa(6,`div`,7),pf(7,Re,1,0,`ng-container`,8),ec()(),pf(8,Be,2,0,`ng-template`,null,1,xv)),e&2){let i=zD(9);Ef(`ngClass`,o.viewTemplateClassName),fd(),Ef(`options`,o.swiperOptions())(`navigationConfig`,o.navigationConfig),fd(3),AD(o.videoEntries),fd(3),Ef(`ngTemplateOutlet`,i);}},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_componentBe1TGq0U = /*#__PURE__*/Object.freeze({
9
+ var videoDetailDialog_componentD3mxqAg1 = /*#__PURE__*/Object.freeze({
10
10
  __proto__: null,
11
11
  VideoDetailDialogComponent: Ee
12
12
  });
13
13
 
14
- export { f, l, videoDetailDialog_componentBe1TGq0U as v };
14
+ export { f, l, videoDetailDialog_componentD3mxqAg1 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-Be1TGq0U-DmeTyU9p.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 Vi$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,fe,_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)}
35
+ `],encapsulation:3})};var Xn=[`videoEl`];async function Di(){return (await import('./video-detail-dialog.component-D3mxqAg1-BwuGJBF5.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 Vi$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,fe,_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
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-AlUZHNlX-BrK8t2S3.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-UePCL21W-D3wLkkt-.js').then(e=>{t(e.DebuggerComponent,`cooee-debugger`);}),window.cooeeShowQuickItem=(e,i)=>{n.injector.get(Je).showItemQuickView(e,i);};}
39
39
 
40
- var widgetsBWtmfMEz = /*#__PURE__*/Object.freeze({
40
+ var widgetsD0BQHXb = /*#__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, widgetsBWtmfMEz 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, widgetsD0BQHXb 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.8",
4
+ "version": "14.8.9",
5
5
  "scripts": {
6
6
  "postinstall": "bash .dev/setup.sh",
7
7
  "lint": "ng lint",