@letscooee/web-sdk 13.0.16 → 13.0.18

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 +1 @@
1
- import{a as C,b}from"./chunk-RHEH7YTM.js";import{e as g,f as h,i as u,l as f}from"./chunk-BVPZU4J3.js";import{Ba as l,Qa as c,X as m,pa as n,qa as i,ra as r,v as s}from"./chunk-K77Q3IPF.js";import"./chunk-V7UGKYBN.js";var _=class d{dialogRef=s(u);eventData=s(h);triggerData=s(g)().triggerData;onShareAndClose(p,o){p.stopPropagation();let{url:t,text:a}=b(this.triggerData,this.eventData.video,o!=="Clipboard");switch(o){case"Whatsapp":window.open(`https://wa.me/?text=${a}%20${t}`,"_blank","noopener,noreferrer");break;case"X(Twitter)":window.open(`https://x.com/intent/post?text=${a}&url=${t}`,"_blank","noopener,noreferrer");break;case"Clipboard":navigator.clipboard.writeText(t).catch(()=>{let e=document.createElement("textarea");e.value=t,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)});break;default:}o&&C(this.triggerData,this.eventData.video,this.eventData.index,o),this.dialogRef.close()}static \u0275fac=function(o){return new(o||d)};static \u0275cmp=m({type:d,selectors:[["cooee-share-dialog"]],decls:19,vars:0,consts:[[1,"share-dialog"],[1,"share-dialog-header"],["type","button","aria-label","Close",1,"close-button",3,"click"],["name","close","aria-hidden","true"],[1,"share-options"],["type","button","aria-label","Share on WhatsApp",1,"share-option",3,"click"],["name","whatsapp","aria-hidden","true"],["type","button","aria-label","Share on X",1,"share-option",3,"click"],["name","x-twitter","aria-hidden","true"],["type","button","aria-label","Copy link",1,"share-option",3,"click"],["name","copy","aria-hidden","true"]],template:function(o,t){o&1&&(n(0,"div",0)(1,"div",1)(2,"h3"),c(3,"Share"),i(),n(4,"button",2),l("click",function(e){return t.onShareAndClose(e)}),r(5,"cooee-icon",3),i()(),n(6,"div",4)(7,"button",5),l("click",function(e){return t.onShareAndClose(e,"Whatsapp")}),r(8,"cooee-icon",6),n(9,"span"),c(10,"Whatsapp"),i()(),n(11,"button",7),l("click",function(e){return t.onShareAndClose(e,"X(Twitter)")}),r(12,"cooee-icon",8),n(13,"span"),c(14,"X"),i()(),n(15,"button",9),l("click",function(e){return t.onShareAndClose(e,"Clipboard")}),r(16,"cooee-icon",10),n(17,"span"),c(18,"Copy link"),i()()()())},dependencies:[f],styles:["@keyframes _ngcontent-%COMP%_slideInScale{0%{opacity:0;transform:scale(.9) translateY(8px)}to{opacity:1;transform:scale(1) translateY(0)}}.share-dialog[_ngcontent-%COMP%]{background:#fff;border-radius:12px;padding:20px;min-width:280px;box-shadow:0 8px 32px #00000026;color:#333;animation:_ngcontent-%COMP%_slideInScale .25s ease-out}.share-dialog-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}.share-dialog-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-family:var(--lc-heading-family),serif;margin:0;font-size:18px;font-weight:600}.share-options[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;font-family:var(--lc-text-family),serif}.share-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;padding:12px 16px;background:#0002;border:1px solid #e9ecef;border-radius:8px;color:#333;font-size:16px;font-weight:500;cursor:pointer;transition:all .2s ease}.share-option[_ngcontent-%COMP%]:hover{background:#0004;border-color:#dee2e6;transform:translateY(-1px)}.share-option[_ngcontent-%COMP%]:active{transform:translateY(0)}.share-option[_ngcontent-%COMP%] cooee-icon[_ngcontent-%COMP%]{width:24px;height:24px}.share-option[_ngcontent-%COMP%] cooee-icon[name=whatsapp][_ngcontent-%COMP%]{color:#25d366}.share-option[_ngcontent-%COMP%] cooee-icon[name=x-twitter][_ngcontent-%COMP%], .share-option[_ngcontent-%COMP%] cooee-icon[name=copy][_ngcontent-%COMP%]{color:#000}.share-option[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1;text-align:left}button.close-button[_ngcontent-%COMP%]{background-color:transparent;border:none}button.close-button[_ngcontent-%COMP%] cooee-icon[name=close][_ngcontent-%COMP%]{border-radius:100%;color:#000}"]})};export{_ as ShareDialogComponent};
1
+ import{a as C,b}from"./chunk-NUQA2TNP.js";import{e as g,f as h,i as u,l as f}from"./chunk-QA6GKNSU.js";import{Ba as l,Qa as c,X as m,pa as n,qa as i,ra as r,v as s}from"./chunk-K77Q3IPF.js";import"./chunk-V7UGKYBN.js";var _=class d{dialogRef=s(u);eventData=s(h);triggerData=s(g)().triggerData;onShareAndClose(p,o){p.stopPropagation();let{url:t,text:a}=b(this.triggerData,this.eventData.video,o!=="Clipboard");switch(o){case"Whatsapp":window.open(`https://wa.me/?text=${a}%20${t}`,"_blank","noopener,noreferrer");break;case"X(Twitter)":window.open(`https://x.com/intent/post?text=${a}&url=${t}`,"_blank","noopener,noreferrer");break;case"Clipboard":navigator.clipboard.writeText(t).catch(()=>{let e=document.createElement("textarea");e.value=t,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)});break;default:}o&&C(this.triggerData,this.eventData.video,this.eventData.index,o),this.dialogRef.close()}static \u0275fac=function(o){return new(o||d)};static \u0275cmp=m({type:d,selectors:[["cooee-share-dialog"]],decls:19,vars:0,consts:[[1,"share-dialog"],[1,"share-dialog-header"],["type","button","aria-label","Close",1,"close-button",3,"click"],["name","close","aria-hidden","true"],[1,"share-options"],["type","button","aria-label","Share on WhatsApp",1,"share-option",3,"click"],["name","whatsapp","aria-hidden","true"],["type","button","aria-label","Share on X",1,"share-option",3,"click"],["name","x-twitter","aria-hidden","true"],["type","button","aria-label","Copy link",1,"share-option",3,"click"],["name","copy","aria-hidden","true"]],template:function(o,t){o&1&&(n(0,"div",0)(1,"div",1)(2,"h3"),c(3,"Share"),i(),n(4,"button",2),l("click",function(e){return t.onShareAndClose(e)}),r(5,"cooee-icon",3),i()(),n(6,"div",4)(7,"button",5),l("click",function(e){return t.onShareAndClose(e,"Whatsapp")}),r(8,"cooee-icon",6),n(9,"span"),c(10,"Whatsapp"),i()(),n(11,"button",7),l("click",function(e){return t.onShareAndClose(e,"X(Twitter)")}),r(12,"cooee-icon",8),n(13,"span"),c(14,"X"),i()(),n(15,"button",9),l("click",function(e){return t.onShareAndClose(e,"Clipboard")}),r(16,"cooee-icon",10),n(17,"span"),c(18,"Copy link"),i()()()())},dependencies:[f],styles:["@keyframes _ngcontent-%COMP%_slideInScale{0%{opacity:0;transform:scale(.9) translateY(8px)}to{opacity:1;transform:scale(1) translateY(0)}}.share-dialog[_ngcontent-%COMP%]{background:#fff;border-radius:12px;padding:20px;min-width:280px;box-shadow:0 8px 32px #00000026;color:#333;animation:_ngcontent-%COMP%_slideInScale .25s ease-out}.share-dialog-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}.share-dialog-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-family:var(--lc-heading-family),serif;margin:0;font-size:18px;font-weight:600}.share-options[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;font-family:var(--lc-text-family),serif}.share-option[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;padding:12px 16px;background:#0002;border:1px solid #e9ecef;border-radius:8px;color:#333;font-size:16px;font-weight:500;cursor:pointer;transition:all .2s ease}.share-option[_ngcontent-%COMP%]:hover{background:#0004;border-color:#dee2e6;transform:translateY(-1px)}.share-option[_ngcontent-%COMP%]:active{transform:translateY(0)}.share-option[_ngcontent-%COMP%] cooee-icon[_ngcontent-%COMP%]{width:24px;height:24px}.share-option[_ngcontent-%COMP%] cooee-icon[name=whatsapp][_ngcontent-%COMP%]{color:#25d366}.share-option[_ngcontent-%COMP%] cooee-icon[name=x-twitter][_ngcontent-%COMP%], .share-option[_ngcontent-%COMP%] cooee-icon[name=copy][_ngcontent-%COMP%]{color:#000}.share-option[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1;text-align:left}button.close-button[_ngcontent-%COMP%]{background-color:transparent;border:none}button.close-button[_ngcontent-%COMP%] cooee-icon[name=close][_ngcontent-%COMP%]{border-radius:100%;color:#000}"]})};export{_ as ShareDialogComponent};
@@ -1,2 +1,2 @@
1
- import{A as Ve,B as Ie,c as ue,j as U,q as k,r as we,s as be,v as _e,w as Ce,x as ye,y as xe,z as De}from"./chunk-O2WHN7F2.js";import{a as Ee,b as Te}from"./chunk-RHEH7YTM.js";import{c as me,e as ge,f as P,g as j,i as he,j as ve,k as fe,l as M}from"./chunk-BVPZU4J3.js";import"./chunk-T6RU7RSX.js";import{Ba as h,Da as s,E as _,Ga as F,Ha as B,I as K,Ia as H,L as G,La as V,M as Q,Ma as S,O as d,Ta as ie,Ua as oe,V as q,Va as ne,X as y,Za as re,ba as E,fb as se,ha as T,ia as x,ib as ae,ja as D,jb as de,kb as le,la as Y,ma as $,na as L,oa as u,pa as l,qa as a,ra as w,sa as J,sb as ce,ta as X,ua as Z,ub as pe,v,va as ee,wa as te,x as p,xa as A,y as m,za as C}from"./chunk-K77Q3IPF.js";import"./chunk-V7UGKYBN.js";var I="a-f\\d",Me=`#?[${I}]{3}[${I}]?`,Oe=`#?[${I}]{6}([${I}]{2})?`,Ne=new RegExp(`[^#${I}]`,"gi"),Re=new RegExp(`^${Me}$|^${Oe}$`,"i");function W(i,e={}){if(typeof i!="string"||Ne.test(i)||!Re.test(i))throw new TypeError("Expected a valid hex string");i=i.replace(/^#/,"");let t=1;i.length===8&&(t=Number.parseInt(i.slice(6,8),16)/255,i=i.slice(0,6)),i.length===4&&(t=Number.parseInt(i.slice(3,4).repeat(2),16)/255,i=i.slice(0,3)),i.length===3&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]);let o=Number.parseInt(i,16),n=o>>16,r=o>>8&255,f=o&255,b=typeof e.alpha=="number"?e.alpha:t;if(e.format==="array")return[n,r,f,b];if(e.format==="css"){let g=b===1?"":` / ${Number((b*100).toFixed(2))}%`;return`rgb(${n} ${r} ${f}${g})`}return{red:n,green:r,blue:f,alpha:b}}var c=class{h;a=100;g;constructor(e){e??={},this.h=e.h,this.a=e.a,this.g=e.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return W(this.hex,{format:"css",alpha:this.getAlpha()})}catch(e){return console.error("Invalid hex",e),"#000000"}}getAlpha(){return(this.a??100)/100}};var O=class i{static DEFAULT_FALLBACK=new c({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new c(e.c)),e.fb&&(this.fb=new c(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??i.DEFAULT_FALLBACK}};var N=class{size;enabled;color;constructor(e){e??={},this.enabled=e.enabled,this.size=e.size,this.color=new c(e.color)}};var R=class i{video=le.required();progress=_(0);constructor(){ae(e=>{let t=this.video(),o=()=>{this.progress.set(t.currentTime/t.duration*100)};t.addEventListener("timeupdate",o),e(()=>{t.removeEventListener("timeupdate",o)})})}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=y({type:i,selectors:[["cooee-video-progress-bar"]],inputs:{video:[1,"video"]},decls:3,vars:3,consts:[[1,"video-untracked-path"],["role","progressbar",1,"video-tracked-path"]],template:function(t,o){t&1&&(J(0,"div",0)(1,"div",1),Z(2,"div"),X()()),t&2&&(d(),S("width",o.progress(),"%"),T("aria-valuenow",o.progress()))},styles:["[_nghost-%COMP%]{display:block;width:100%;position:absolute;z-index:10;top:4px;padding-inline:8px;box-sizing:border-box}.video-untracked-path[_ngcontent-%COMP%], .video-tracked-path[_ngcontent-%COMP%]{height:4px;border-radius:var(--lc-video-progress-bar-radius)}.video-untracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-bg-color));width:100%;margin-bottom:2px}.video-tracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-color));transition:width .5s ease-in-out}@media (prefers-reduced-motion: reduce){.video-tracked-path[_ngcontent-%COMP%]{transition:none}}"]})};var z=class i{dialogState=de();dialog=v(fe);triggerData=v(ge)().triggerData;eventData=v(P);containerRef=v(q);async share(e){e.stopPropagation(),e.preventDefault(),k()&&we()?await this.shareNative():await this.shareWithDialog()}async shareNative(){let e=Te(this.triggerData,this.eventData.video,!1);await navigator.share(e),Ee(this.triggerData,this.eventData.video,this.eventData.index,"Native")}async shareWithDialog(){let e=await import("./share-dialog.component-2RPUVXSN.js");this.dialogState.emit(!0),this.dialog.open(e.ShareDialogComponent,{viewContainerRef:this.containerRef}).closed.subscribe(()=>this.dialogState.emit(!1))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=y({type:i,selectors:[["cooee-share-button"]],outputs:{dialogState:"dialogState"},decls:2,vars:0,consts:[["type","button","aria-label","Share video",3,"click"],["name","share"]],template:function(t,o){t&1&&(l(0,"button",0),h("click",function(r){return o.share(r)}),w(1,"cooee-icon",1),a())},dependencies:[M],styles:["button[_ngcontent-%COMP%]{width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent)}button[_ngcontent-%COMP%] cooee-icon[name=share][_ngcontent-%COMP%]{color:#fff}"]})};var ze=["swiperComp"],$e=["videoEl"],Le=(i,e)=>e.url;function Ae(i,e){i&1&&(l(0,"div",11),w(1,"div",15),a())}function Fe(i,e){if(i&1&&w(0,"source",13),i&2){let t=e.$implicit;u("type",re(t.mimeType))("src",t.url,G)}}function Be(i,e){i&1&&A(0)}function He(i,e){if(i&1){let t=C();l(0,"cooee-video-promoted-items",24),h("cardClick",function(n){p(t);let r=s(2).$implicit,f=s();return m(f.productCardClicked(n,r))}),a()}if(i&2){let t=s(2).$implicit;u("items",t.items)}}function je(i,e){if(i&1&&w(0,"cooee-video-card",23),i&2){let t=s(2).$implicit;u("card",t.card)}}function Ue(i,e){if(i&1){let t=C();w(0,"cooee-video-progress-bar",16),l(1,"div",17)(2,"cooee-mute-toggle",18),ne("mutedChange",function(n){p(t);let r=s(2);return oe(r.muted,n)||(r.muted=n),m(n)}),h("toggled",function(){p(t);let n=s(2);return m(n.muteToggled())}),a(),E(3,Be,1,0,"ng-container",8),a(),l(4,"div",19)(5,"cooee-share-button",20),h("dialogState",function(n){p(t);let r=s(2);return m(r.shareDialogOpen.set(n))}),a()(),l(6,"div",21),x(7,He,1,1,"cooee-video-promoted-items",22)(8,je,1,1,"cooee-video-card",23),a()}if(i&2){let t=s().$implicit,o=V(5),n=s(),r=V(9);u("video",o),d(2),ie("muted",n.muted),u("videoEl",o),d(),u("ngTemplateOutlet",r),d(4),D(t.items.length&&n.videoConfig.showItems()?7:t.card&&n.videoConfig.footerContent===n.VideoConfigFooterContent.CARD?8:-1)}}function We(i,e){if(i&1){let t=C();l(0,"cooee-item-detail",25),h("closeClick",function(){p(t);let n=s(2);return m(n.productModalClosed())}),a()}if(i&2){let t=s(2);u("item",t.selectedItem)("similarItems",t.selectedVideo.items)("template",t.videoConfig.itemDetailConfig.template)}}function Ke(i,e){if(i&1){let t=C();l(0,"div",6)(1,"div",9)(2,"div",10),x(3,Ae,2,0,"div",11),l(4,"video",12,2),h("click",function(){let n=p(t).$index,r=s();return m(r.currentIndex===n&&r.toggleMute())})("ended",function(){p(t);let n=V(5),r=s();return m(r.onVideoEnded(n))})("loadstart",function(){let n=p(t).$index,r=s();return m(r.onVideoLoadStart(n))})("canplay",function(){let n=p(t).$index,r=s();return m(r.onVideoCanPlay(n))}),$(6,Fe,1,3,"source",13,Le),a(),x(8,Ue,9,5),a(),x(9,We,1,3,"cooee-item-detail",14),a()()}if(i&2){let t=e.$implicit,o=e.$index,n=s();d(2),S("background-image",t.thumbnail?"url("+t.thumbnail+")":null),d(),D(n.shouldShowVideoSpinner(o)?3:-1),d(),u("ngClass",n.viewTemplateClassName)("muted",!0),T("preload",n.isVideoVisible(o)?"metadata":"none")("data-video-id",t.id)("autoplay",null),d(2),L(t.sources),d(2),D(n.currentIndex===o?8:-1),d(),D(n.selectedItem&&n.currentIndex===o?9:-1)}}function Ge(i,e){i&1&&A(0)}function Qe(i,e){if(i&1){let t=C();l(0,"button",26),h("click",function(){p(t);let n=s();return m(n.close())}),w(1,"cooee-icon",27),a()}}var ke=class i{swiperComponent;videoElements;VideoConfigFooterContent=_e;currentIndex=0;muted=_(!1);selectedItem=null;selectedVideo;detailPopupTemplate;viewTemplateClassName="lc-video-only-view";shareDialogOpen=_(!1);data=v(ve);elementRef=v(K);eventData=v(P);dialogRef=v(he);swiperInitialized=_(!1);swiperOptions=_(null);videos=[];videoConfig;triggerContext;engagementTrigger;isMobile=k();navigationConfig;cssLoadedPromise;resizeDebouncer=new be(this.onResize.bind(this));videoLoadingStates=new Map;constructor(){this.videos=this.data.videos,this.currentIndex=this.data.currentIndex,this.selectedItem=this.data.selectedItem??null,this.selectedVideo=this.videos[this.currentIndex],this.triggerContext=this.data.triggerContext,this.engagementTrigger=this.triggerContext.triggerData,this.videoConfig=this.engagementTrigger?.content?.videoConfig??new Ce,this.navigationConfig=new N({enabled:!0,size:50,color:new c({h:"#000000"})}),this.cssLoadedPromise=ue(this.elementRef.nativeElement.shadowRoot)}onKeyDown(e){e.preventDefault(),e.stopPropagation(),this.close()}async ngOnInit(){switch(this.muted.set(await U.get("muted",!1)),this.videoConfig.detailPopup.template){case"PRODUCT_DETAIL_VIEW":this.selectItemForDetailView(),this.viewTemplateClassName="lc-product-detail-view";break;case"VIDEO_ONLY_VIEW":this.viewTemplateClassName="lc-video-only-view";break}}ngAfterViewInit(){this.initializeSwiperWithVideoDimensions()}ngOnDestroy(){this.resizeDebouncer?.destroy()}initializeSwiperWithVideoDimensions(){this.applyOptimalVideoDimensions(),this.initSwiperOptions(),this.playActiveVideo(!1)}close(){let e=this.getCurrentVideoElement();this.dialogRef.close({lastVideo:this.videos[this.currentIndex],lastVideoIndex:this.currentIndex,lastVideoDuration:e?.currentTime})}getCurrentVideoElement(){return this.videoElements.get(this.currentIndex)?.nativeElement}moveToNextVideo(){this.swiperComponent.swiper.slideTo(this.currentIndex+1)}productModalClosed(){this.selectedItem=null}pauseAll(){this.videoElements.forEach(e=>e.nativeElement.pause())}toggleMute(){this.muted.update(e=>!e)}async muteToggled(){await U.set("muted",this.muted());let t=[this.muted()?"CE Video Muted":"CE Video Unmuted",{current:this.currentVideoProps()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(t)}playActiveVideo(e=!0){e&&this.pauseAll();let t=this.getCurrentVideoElement();t&&this.playVideo(t)}playVideo(e){e.currentTime=0,e.play().catch(t=>me.error(t))}onVideoEnded(e){if(this.currentIndex<this.videos.length-1)this.selectedItem||this.shareDialogOpen()?this.playVideo(e):this.moveToNextVideo();else{let t=this.getPreviousVideoDataForEvent(),o=["CE Last Video Ended",{previous:t},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(o),this.playVideo(e)}}onSlideChange(e){let t=this.getPreviousVideoDataForEvent();this.currentIndex=e.realIndex,this.selectedVideo=this.videos[this.currentIndex],this.eventData.video=this.selectedVideo,this.eventData.index=this.currentIndex,this.playActiveVideo(),this.isProductDetailView()?this.selectItemForDetailView():this.selectedItem=null;let o=this.currentVideoProps(),n={previous:t,current:o},r=new j("CE Video Changed",n,this.engagementTrigger);r.setVideos(this.videos[this.currentIndex]),window.CooeeSDK.sendEvent(r)}productCardClicked(e,t){let o={videoID:t.id,videoIndex:this.currentIndex},n=new j("CE More Item Info Clicked",{current:o},this.engagementTrigger);n.setVideos(t),window.CooeeSDK.sendEvent(n),this.selectedItem=e}onVideoLoadStart(e){this.videoLoadingStates.set(e,!0)}onVideoCanPlay(e){this.videoLoadingStates.set(e,!1)}shouldShowVideoSpinner(e){return this.swiperInitialized()?this.videoLoadingStates.get(e)===!0&&this.isVideoVisible(e):this.isVideoVisible(e)}isVideoVisible(e){let t=this.currentIndex-1,o=this.currentIndex+1;return e===this.currentIndex||e===t||e===o}async initSwiperOptions(){await this.cssLoadedPromise;let e=this.isMobile?1:"auto",t=0;this.isProductDetailView()&&(e="auto",t=10),this.swiperOptions.set({direction:this.isMobile?"vertical":"horizontal",effect:this.isMobile?"slide":"coverflow",slidesPerView:e,initialSlide:this.currentIndex,centeredSlides:!0,spaceBetween:t,coverflowEffect:{rotate:0,stretch:0,depth:400,modifier:1,slideShadows:!1},on:{init:o=>{this.swiperInitialized.set(!0),setTimeout(()=>{o.update()},100)}},mousewheel:{enabled:!this.isMobile,invert:!1,thresholdDelta:20}})}isProductDetailView(){return this.videoConfig.detailPopup.template==="PRODUCT_DETAIL_VIEW"}currentVideoProps(){return{videoID:this.videos[this.currentIndex].id,videoIndex:this.currentIndex}}getPreviousVideoDataForEvent(){let e=this.currentVideoProps(),t=this.videoElements.find(n=>n.nativeElement.dataset.videoId===this.videos[this.currentIndex].id)?.nativeElement;e.playedTillMS=Math.ceil(t?.currentTime*1e3);let o=t?.duration*1e3;return e.playedTillPercent=+(e.playedTillMS/o).toFixed(4),e}selectItemForDetailView(){this.selectedItem=this.isMobile?null:this.selectedVideo?.items?.[0]??null}applyOptimalVideoDimensions(){if(this.isMobile||this.isProductDetailView())return;let e=this.calculateOptimalVideoDimensions();e&&this.setVideoContainerDimensions(e.width,e.height)}calculateOptimalVideoDimensions(){let e=this.videos.map(g=>g.sources?.[0]).filter(g=>g?.width&&g?.height).map(g=>({width:g.width,height:g.height,aspectRatio:g.width/g.height}));if(e.length===0)return null;let t=e[0],o=window.innerWidth*.9,n=window.innerHeight*.9,r=o/t.width,f=n/t.height,b=Math.min(r,f);return{width:Math.floor(t.width*b),height:Math.floor(t.height*b)}}setVideoContainerDimensions(e,t){let o=this.elementRef.nativeElement;o.style.setProperty("--video-container-width",`${e}px`),o.style.setProperty("--video-container-height",`${t}px`)}onResize(){this.applyOptimalVideoDimensions()}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=y({type:i,selectors:[["cooee-video-detail-dialog"]],viewQuery:function(t,o){if(t&1&&(F(ze,7),F($e,5)),t&2){let n;B(n=H())&&(o.swiperComponent=n.first),B(n=H())&&(o.videoElements=n)}},hostAttrs:[1,"letscooee-widget"],hostBindings:function(t,o){t&1&&h("keydown.escape",function(r){return o.onKeyDown(r)},Q)},decls:10,vars:4,consts:[["swiperComp",""],["closeButtonTemplate",""],["videoEl",""],[1,"lc-shadow-inner",3,"ngClass"],[1,"video-swiper",3,"slideChange","options","navigationConfig"],["ngProjectAs","swiper-slides",5,["swiper-slides"]],[1,"swiper-slide","video-slide"],[1,"lc-desktop-controls"],[4,"ngTemplateOutlet"],[1,"lc-video-modal-row"],[1,"lc-video-container"],[1,"video-loading-overlay"],["playsinline","",1,"lc-video-el",3,"click","ended","loadstart","canplay","ngClass","muted"],[3,"src","type"],[1,"swiper-no-swiping","swiper-no-mousewheel",3,"item","similarItems","template"],[1,"loading-spinner"],[3,"video"],[1,"lc-video-controls"],[3,"mutedChange","toggled","muted","videoEl"],[1,"share-controls"],[3,"dialogState"],[1,"lc-card-container"],[3,"items"],[3,"card"],[3,"cardClick","items"],[1,"swiper-no-swiping","swiper-no-mousewheel",3,"closeClick","item","similarItems","template"],["type","button","aria-label","Close",1,"lc-close-button",3,"click"],["name","close","aria-hidden","true"]],template:function(t,o){if(t&1){let n=C();l(0,"div",3)(1,"cooee-swiper",4,0),h("slideChange",function(f){return p(n),m(o.onSlideChange(f))}),ee(3,5),$(4,Ke,10,10,"div",6,Y),te(),a(),l(6,"div",7),E(7,Ge,1,0,"ng-container",8),a()(),E(8,Qe,2,0,"ng-template",null,1,se)}if(t&2){let n=V(9);u("ngClass",o.viewTemplateClassName),d(),u("options",o.swiperOptions())("navigationConfig",o.navigationConfig),d(3),L(o.videos),d(3),u("ngTemplateOutlet",n)}},dependencies:[Ie,ye,Ve,z,R,pe,ce,De,xe,M],styles:[`:host{display:flex}.lc-shadow-inner{position:relative;width:100vw;height:100vh;display:flex}@media (min-width: 768px){.lc-shadow-inner{background-color:color-mix(in oklab,#000 70%,transparent);justify-content:center;align-items:center}}.video-swiper{--swiper-navigation-size: 50px;--swiper-navigation-color: white;width:100dvw;height:100dvh}.lc-product-detail-view .video-swiper{align-items:center}@media (min-width: 768px){.video-swiper{width:100%;height:100%;max-width:90vw;max-height:90vh}}.video-swiper>.swiper-wrapper{max-height:100%}.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}.lc-product-detail-view .video-slide{width:40vw!important;height:70vh!important}@media (min-width: 768px){.lc-product-detail-view .video-slide{min-width:650px!important}}@media (max-width: 768px){.lc-product-detail-view .video-slide{width:100%!important;height:100%!important}}@media (min-width: 768px){.lc-video-only-view .video-slide{width:fit-content!important}}@media (min-width: 768px){.video-slide{border-radius:var(--lc-media-radius);overflow:hidden}}.video-slide.swiper-slide-active,.video-slide.swiper-slide-prev,.video-slide.swiper-slide-next{visibility:visible}video{width:100%;height:100%;object-fit:cover;position:relative;z-index:3}.lc-desktop-controls{position:absolute;top:2rem;right:4rem;z-index:10;display:flex;gap:.5rem}@media (max-width: 768px){.lc-desktop-controls{display:none}}.lc-video-controls{position:absolute;top:1rem;z-index:10;right:.5rem;display:flex;gap:.25rem}@media (min-width: 768px){.lc-video-controls .lc-close-button{display:none}}.share-controls{position:absolute;bottom:30%;right:.5rem;z-index:10;display:flex;gap:.25rem;flex-direction:column;justify-content:center;align-items:center}.lc-close-button{width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent)}.lc-video-container{position:relative;height:100%;width:100%;background:#000000b3 no-repeat center;background-size:cover}@media (min-width: 768px){.lc-product-detail-view .lc-video-container{width:50%}}@media (min-width: 768px){.lc-video-only-view .lc-video-container{width:var(--video-container-width, 100%);height:var(--video-container-height, 100%)}}.lc-card-container{position:absolute;bottom:12px;z-index:10;width:100%;padding-inline:12px;box-sizing:border-box}.lc-product-detail-view .lc-card-container{display:none}@media (max-width: 768px){.lc-product-detail-view .lc-card-container{display:block}}.lc-product-detail-view .lc-video-modal-row{display:flex;justify-content:center;height:100%;width:100%}.lc-video-only-view .lc-video-modal-row{display:block;height:100%}.lc-product-detail-view cooee-item-detail{--header-display: none;width:50%;flex:1}@media (max-width: 768px){.lc-product-detail-view cooee-item-detail{--header-display: flex;width:100%;height:70dvh;position:absolute;bottom:0;z-index:2147483646}}.lc-video-only-view cooee-item-detail{width:100%;height:70dvh;z-index:2147483646;bottom:0;position:absolute;border-radius:var(--lc-card-radius) var(--lc-card-radius) 0 0}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.video-loading-overlay{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;background-color:#0000004d;z-index:2}.video-loading-overlay .loading-spinner{width:30px;height:30px;border:3px solid rgba(255,255,255,.3);border-top:3px solid #fff;border-radius:50%;animation:spin 1s linear infinite}
1
+ import{A as Ve,B as Ie,c as ue,j as U,q as k,r as we,s as be,v as _e,w as Ce,x as ye,y as xe,z as De}from"./chunk-DZFO4O3B.js";import{a as Ee,b as Te}from"./chunk-NUQA2TNP.js";import{c as me,e as ge,f as P,g as j,i as he,j as ve,k as fe,l as M}from"./chunk-QA6GKNSU.js";import"./chunk-T6RU7RSX.js";import{Ba as h,Da as s,E as _,Ga as F,Ha as B,I as K,Ia as H,L as G,La as V,M as Q,Ma as S,O as d,Ta as ie,Ua as oe,V as q,Va as ne,X as y,Za as re,ba as E,fb as se,ha as T,ia as x,ib as ae,ja as D,jb as de,kb as le,la as Y,ma as $,na as L,oa as u,pa as l,qa as a,ra as w,sa as J,sb as ce,ta as X,ua as Z,ub as pe,v,va as ee,wa as te,x as p,xa as A,y as m,za as C}from"./chunk-K77Q3IPF.js";import"./chunk-V7UGKYBN.js";var I="a-f\\d",Me=`#?[${I}]{3}[${I}]?`,Oe=`#?[${I}]{6}([${I}]{2})?`,Ne=new RegExp(`[^#${I}]`,"gi"),Re=new RegExp(`^${Me}$|^${Oe}$`,"i");function W(i,e={}){if(typeof i!="string"||Ne.test(i)||!Re.test(i))throw new TypeError("Expected a valid hex string");i=i.replace(/^#/,"");let t=1;i.length===8&&(t=Number.parseInt(i.slice(6,8),16)/255,i=i.slice(0,6)),i.length===4&&(t=Number.parseInt(i.slice(3,4).repeat(2),16)/255,i=i.slice(0,3)),i.length===3&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]);let o=Number.parseInt(i,16),n=o>>16,r=o>>8&255,f=o&255,b=typeof e.alpha=="number"?e.alpha:t;if(e.format==="array")return[n,r,f,b];if(e.format==="css"){let g=b===1?"":` / ${Number((b*100).toFixed(2))}%`;return`rgb(${n} ${r} ${f}${g})`}return{red:n,green:r,blue:f,alpha:b}}var c=class{h;a=100;g;constructor(e){e??={},this.h=e.h,this.a=e.a,this.g=e.g}get hex(){return this.h}get grad(){return this.g}get rgba(){if(!this.hex)return"";try{return W(this.hex,{format:"css",alpha:this.getAlpha()})}catch(e){return console.error("Invalid hex",e),"#000000"}}getAlpha(){return(this.a??100)/100}};var O=class i{static DEFAULT_FALLBACK=new c({h:"#000000",a:50});r;c;fb;constructor(e){this.r=e.r,e.c&&(this.c=new c(e.c)),e.fb&&(this.fb=new c(e.fb))}get radius(){return this.r}get color(){return this.c}get fallback(){return this.fb??i.DEFAULT_FALLBACK}};var N=class{size;enabled;color;constructor(e){e??={},this.enabled=e.enabled,this.size=e.size,this.color=new c(e.color)}};var R=class i{video=le.required();progress=_(0);constructor(){ae(e=>{let t=this.video(),o=()=>{this.progress.set(t.currentTime/t.duration*100)};t.addEventListener("timeupdate",o),e(()=>{t.removeEventListener("timeupdate",o)})})}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=y({type:i,selectors:[["cooee-video-progress-bar"]],inputs:{video:[1,"video"]},decls:3,vars:3,consts:[[1,"video-untracked-path"],["role","progressbar",1,"video-tracked-path"]],template:function(t,o){t&1&&(J(0,"div",0)(1,"div",1),Z(2,"div"),X()()),t&2&&(d(),S("width",o.progress(),"%"),T("aria-valuenow",o.progress()))},styles:["[_nghost-%COMP%]{display:block;width:100%;position:absolute;z-index:10;top:4px;padding-inline:8px;box-sizing:border-box}.video-untracked-path[_ngcontent-%COMP%], .video-tracked-path[_ngcontent-%COMP%]{height:4px;border-radius:var(--lc-video-progress-bar-radius)}.video-untracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-bg-color));width:100%;margin-bottom:2px}.video-tracked-path[_ngcontent-%COMP%]{background-color:rgba(var(--lc-video-progress-bar-color));transition:width .5s ease-in-out}@media (prefers-reduced-motion: reduce){.video-tracked-path[_ngcontent-%COMP%]{transition:none}}"]})};var z=class i{dialogState=de();dialog=v(fe);triggerData=v(ge)().triggerData;eventData=v(P);containerRef=v(q);async share(e){e.stopPropagation(),e.preventDefault(),k()&&we()?await this.shareNative():await this.shareWithDialog()}async shareNative(){let e=Te(this.triggerData,this.eventData.video,!1);await navigator.share(e),Ee(this.triggerData,this.eventData.video,this.eventData.index,"Native")}async shareWithDialog(){let e=await import("./share-dialog.component-YYXL7PVF.js");this.dialogState.emit(!0),this.dialog.open(e.ShareDialogComponent,{viewContainerRef:this.containerRef}).closed.subscribe(()=>this.dialogState.emit(!1))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=y({type:i,selectors:[["cooee-share-button"]],outputs:{dialogState:"dialogState"},decls:2,vars:0,consts:[["type","button","aria-label","Share video",3,"click"],["name","share"]],template:function(t,o){t&1&&(l(0,"button",0),h("click",function(r){return o.share(r)}),w(1,"cooee-icon",1),a())},dependencies:[M],styles:["button[_ngcontent-%COMP%]{width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent)}button[_ngcontent-%COMP%] cooee-icon[name=share][_ngcontent-%COMP%]{color:#fff}"]})};var ze=["swiperComp"],$e=["videoEl"],Le=(i,e)=>e.url;function Ae(i,e){i&1&&(l(0,"div",11),w(1,"div",15),a())}function Fe(i,e){if(i&1&&w(0,"source",13),i&2){let t=e.$implicit;u("type",re(t.mimeType))("src",t.url,G)}}function Be(i,e){i&1&&A(0)}function He(i,e){if(i&1){let t=C();l(0,"cooee-video-promoted-items",24),h("cardClick",function(n){p(t);let r=s(2).$implicit,f=s();return m(f.productCardClicked(n,r))}),a()}if(i&2){let t=s(2).$implicit;u("items",t.items)}}function je(i,e){if(i&1&&w(0,"cooee-video-card",23),i&2){let t=s(2).$implicit;u("card",t.card)}}function Ue(i,e){if(i&1){let t=C();w(0,"cooee-video-progress-bar",16),l(1,"div",17)(2,"cooee-mute-toggle",18),ne("mutedChange",function(n){p(t);let r=s(2);return oe(r.muted,n)||(r.muted=n),m(n)}),h("toggled",function(){p(t);let n=s(2);return m(n.muteToggled())}),a(),E(3,Be,1,0,"ng-container",8),a(),l(4,"div",19)(5,"cooee-share-button",20),h("dialogState",function(n){p(t);let r=s(2);return m(r.shareDialogOpen.set(n))}),a()(),l(6,"div",21),x(7,He,1,1,"cooee-video-promoted-items",22)(8,je,1,1,"cooee-video-card",23),a()}if(i&2){let t=s().$implicit,o=V(5),n=s(),r=V(9);u("video",o),d(2),ie("muted",n.muted),u("videoEl",o),d(),u("ngTemplateOutlet",r),d(4),D(t.items.length&&n.videoConfig.showItems()?7:t.card&&n.videoConfig.footerContent===n.VideoConfigFooterContent.CARD?8:-1)}}function We(i,e){if(i&1){let t=C();l(0,"cooee-item-detail",25),h("closeClick",function(){p(t);let n=s(2);return m(n.productModalClosed())}),a()}if(i&2){let t=s(2);u("item",t.selectedItem)("similarItems",t.selectedVideo.items)("template",t.videoConfig.itemDetailConfig.template)}}function Ke(i,e){if(i&1){let t=C();l(0,"div",6)(1,"div",9)(2,"div",10),x(3,Ae,2,0,"div",11),l(4,"video",12,2),h("click",function(){let n=p(t).$index,r=s();return m(r.currentIndex===n&&r.toggleMute())})("ended",function(){p(t);let n=V(5),r=s();return m(r.onVideoEnded(n))})("loadstart",function(){let n=p(t).$index,r=s();return m(r.onVideoLoadStart(n))})("canplay",function(){let n=p(t).$index,r=s();return m(r.onVideoCanPlay(n))}),$(6,Fe,1,3,"source",13,Le),a(),x(8,Ue,9,5),a(),x(9,We,1,3,"cooee-item-detail",14),a()()}if(i&2){let t=e.$implicit,o=e.$index,n=s();d(2),S("background-image",t.thumbnail?"url("+t.thumbnail+")":null),d(),D(n.shouldShowVideoSpinner(o)?3:-1),d(),u("ngClass",n.viewTemplateClassName)("muted",!0),T("preload",n.isVideoVisible(o)?"metadata":"none")("data-video-id",t.id)("autoplay",null),d(2),L(t.sources),d(2),D(n.currentIndex===o?8:-1),d(),D(n.selectedItem&&n.currentIndex===o?9:-1)}}function Ge(i,e){i&1&&A(0)}function Qe(i,e){if(i&1){let t=C();l(0,"button",26),h("click",function(){p(t);let n=s();return m(n.close())}),w(1,"cooee-icon",27),a()}}var ke=class i{swiperComponent;videoElements;VideoConfigFooterContent=_e;currentIndex=0;muted=_(!1);selectedItem=null;selectedVideo;detailPopupTemplate;viewTemplateClassName="lc-video-only-view";shareDialogOpen=_(!1);data=v(ve);elementRef=v(K);eventData=v(P);dialogRef=v(he);swiperInitialized=_(!1);swiperOptions=_(null);videos=[];videoConfig;triggerContext;engagementTrigger;isMobile=k();navigationConfig;cssLoadedPromise;resizeDebouncer=new be(this.onResize.bind(this));videoLoadingStates=new Map;constructor(){this.videos=this.data.videos,this.currentIndex=this.data.currentIndex,this.selectedItem=this.data.selectedItem??null,this.selectedVideo=this.videos[this.currentIndex],this.triggerContext=this.data.triggerContext,this.engagementTrigger=this.triggerContext.triggerData,this.videoConfig=this.engagementTrigger?.content?.videoConfig??new Ce,this.navigationConfig=new N({enabled:!0,size:50,color:new c({h:"#000000"})}),this.cssLoadedPromise=ue(this.elementRef.nativeElement.shadowRoot)}onKeyDown(e){e.preventDefault(),e.stopPropagation(),this.close()}async ngOnInit(){switch(this.muted.set(await U.get("muted",!1)),this.videoConfig.detailPopup.template){case"PRODUCT_DETAIL_VIEW":this.selectItemForDetailView(),this.viewTemplateClassName="lc-product-detail-view";break;case"VIDEO_ONLY_VIEW":this.viewTemplateClassName="lc-video-only-view";break}}ngAfterViewInit(){this.initializeSwiperWithVideoDimensions()}ngOnDestroy(){this.resizeDebouncer?.destroy()}initializeSwiperWithVideoDimensions(){this.applyOptimalVideoDimensions(),this.initSwiperOptions(),this.playActiveVideo(!1)}close(){let e=this.getCurrentVideoElement();this.dialogRef.close({lastVideo:this.videos[this.currentIndex],lastVideoIndex:this.currentIndex,lastVideoDuration:e?.currentTime})}getCurrentVideoElement(){return this.videoElements.get(this.currentIndex)?.nativeElement}moveToNextVideo(){this.swiperComponent.swiper.slideTo(this.currentIndex+1)}productModalClosed(){this.selectedItem=null}pauseAll(){this.videoElements.forEach(e=>e.nativeElement.pause())}toggleMute(){this.muted.update(e=>!e)}async muteToggled(){await U.set("muted",this.muted());let t=[this.muted()?"CE Video Muted":"CE Video Unmuted",{current:this.currentVideoProps()},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(t)}playActiveVideo(e=!0){e&&this.pauseAll();let t=this.getCurrentVideoElement();t&&this.playVideo(t)}playVideo(e){e.currentTime=0,e.play().catch(t=>me.error(t))}onVideoEnded(e){if(this.currentIndex<this.videos.length-1)this.selectedItem||this.shareDialogOpen()?this.playVideo(e):this.moveToNextVideo();else{let t=this.getPreviousVideoDataForEvent(),o=["CE Last Video Ended",{previous:t},{triggerData:this.engagementTrigger}];window.CooeeSDK.events.push(o),this.playVideo(e)}}onSlideChange(e){let t=this.getPreviousVideoDataForEvent();this.currentIndex=e.realIndex,this.selectedVideo=this.videos[this.currentIndex],this.eventData.video=this.selectedVideo,this.eventData.index=this.currentIndex,this.playActiveVideo(),this.isProductDetailView()?this.selectItemForDetailView():this.selectedItem=null;let o=this.currentVideoProps(),n={previous:t,current:o},r=new j("CE Video Changed",n,this.engagementTrigger);r.setVideos(this.videos[this.currentIndex]),window.CooeeSDK.sendEvent(r)}productCardClicked(e,t){let o={videoID:t.id,videoIndex:this.currentIndex},n=new j("CE More Item Info Clicked",{current:o},this.engagementTrigger);n.setVideos(t),window.CooeeSDK.sendEvent(n),this.selectedItem=e}onVideoLoadStart(e){this.videoLoadingStates.set(e,!0)}onVideoCanPlay(e){this.videoLoadingStates.set(e,!1)}shouldShowVideoSpinner(e){return this.swiperInitialized()?this.videoLoadingStates.get(e)===!0&&this.isVideoVisible(e):this.isVideoVisible(e)}isVideoVisible(e){let t=this.currentIndex-1,o=this.currentIndex+1;return e===this.currentIndex||e===t||e===o}async initSwiperOptions(){await this.cssLoadedPromise;let e=this.isMobile?1:"auto",t=0;this.isProductDetailView()&&(e="auto",t=10),this.swiperOptions.set({direction:this.isMobile?"vertical":"horizontal",effect:this.isMobile?"slide":"coverflow",slidesPerView:e,initialSlide:this.currentIndex,centeredSlides:!0,spaceBetween:t,coverflowEffect:{rotate:0,stretch:0,depth:400,modifier:1,slideShadows:!1},on:{init:o=>{this.swiperInitialized.set(!0),setTimeout(()=>{o.update()},100)}},mousewheel:{enabled:!this.isMobile,invert:!1,thresholdDelta:20}})}isProductDetailView(){return this.videoConfig.detailPopup.template==="PRODUCT_DETAIL_VIEW"}currentVideoProps(){return{videoID:this.videos[this.currentIndex].id,videoIndex:this.currentIndex}}getPreviousVideoDataForEvent(){let e=this.currentVideoProps(),t=this.videoElements.find(n=>n.nativeElement.dataset.videoId===this.videos[this.currentIndex].id)?.nativeElement;e.playedTillMS=Math.ceil(t?.currentTime*1e3);let o=t?.duration*1e3;return e.playedTillPercent=+(e.playedTillMS/o).toFixed(4),e}selectItemForDetailView(){this.selectedItem=this.isMobile?null:this.selectedVideo?.items?.[0]??null}applyOptimalVideoDimensions(){if(this.isMobile||this.isProductDetailView())return;let e=this.calculateOptimalVideoDimensions();e&&this.setVideoContainerDimensions(e.width,e.height)}calculateOptimalVideoDimensions(){let e=this.videos.map(g=>g.sources?.[0]).filter(g=>g?.width&&g?.height).map(g=>({width:g.width,height:g.height,aspectRatio:g.width/g.height}));if(e.length===0)return null;let t=e[0],o=window.innerWidth*.9,n=window.innerHeight*.9,r=o/t.width,f=n/t.height,b=Math.min(r,f);return{width:Math.floor(t.width*b),height:Math.floor(t.height*b)}}setVideoContainerDimensions(e,t){let o=this.elementRef.nativeElement;o.style.setProperty("--video-container-width",`${e}px`),o.style.setProperty("--video-container-height",`${t}px`)}onResize(){this.applyOptimalVideoDimensions()}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=y({type:i,selectors:[["cooee-video-detail-dialog"]],viewQuery:function(t,o){if(t&1&&(F(ze,7),F($e,5)),t&2){let n;B(n=H())&&(o.swiperComponent=n.first),B(n=H())&&(o.videoElements=n)}},hostAttrs:[1,"letscooee-widget"],hostBindings:function(t,o){t&1&&h("keydown.escape",function(r){return o.onKeyDown(r)},Q)},decls:10,vars:4,consts:[["swiperComp",""],["closeButtonTemplate",""],["videoEl",""],[1,"lc-shadow-inner",3,"ngClass"],[1,"video-swiper",3,"slideChange","options","navigationConfig"],["ngProjectAs","swiper-slides",5,["swiper-slides"]],[1,"swiper-slide","video-slide"],[1,"lc-desktop-controls"],[4,"ngTemplateOutlet"],[1,"lc-video-modal-row"],[1,"lc-video-container"],[1,"video-loading-overlay"],["playsinline","",1,"lc-video-el",3,"click","ended","loadstart","canplay","ngClass","muted"],[3,"src","type"],[1,"swiper-no-swiping","swiper-no-mousewheel",3,"item","similarItems","template"],[1,"loading-spinner"],[3,"video"],[1,"lc-video-controls"],[3,"mutedChange","toggled","muted","videoEl"],[1,"share-controls"],[3,"dialogState"],[1,"lc-card-container"],[3,"items"],[3,"card"],[3,"cardClick","items"],[1,"swiper-no-swiping","swiper-no-mousewheel",3,"closeClick","item","similarItems","template"],["type","button","aria-label","Close",1,"lc-close-button",3,"click"],["name","close","aria-hidden","true"]],template:function(t,o){if(t&1){let n=C();l(0,"div",3)(1,"cooee-swiper",4,0),h("slideChange",function(f){return p(n),m(o.onSlideChange(f))}),ee(3,5),$(4,Ke,10,10,"div",6,Y),te(),a(),l(6,"div",7),E(7,Ge,1,0,"ng-container",8),a()(),E(8,Qe,2,0,"ng-template",null,1,se)}if(t&2){let n=V(9);u("ngClass",o.viewTemplateClassName),d(),u("options",o.swiperOptions())("navigationConfig",o.navigationConfig),d(3),L(o.videos),d(3),u("ngTemplateOutlet",n)}},dependencies:[Ie,ye,Ve,z,R,pe,ce,De,xe,M],styles:[`:host{display:flex}.lc-shadow-inner{position:relative;width:100vw;height:100vh;display:flex}@media (min-width: 768px){.lc-shadow-inner{background-color:color-mix(in oklab,#000 70%,transparent);justify-content:center;align-items:center}}.video-swiper{--swiper-navigation-size: 50px;--swiper-navigation-color: white;width:100dvw;height:100dvh}.lc-product-detail-view .video-swiper{align-items:center}@media (min-width: 768px){.video-swiper{width:100%;height:100%;max-width:90vw;max-height:90vh}}.video-swiper>.swiper-wrapper{max-height:100%}.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}.lc-product-detail-view .video-slide{width:40vw!important;height:70vh!important}@media (min-width: 768px){.lc-product-detail-view .video-slide{min-width:650px!important}}@media (max-width: 768px){.lc-product-detail-view .video-slide{width:100%!important;height:100%!important}}@media (min-width: 768px){.lc-video-only-view .video-slide{width:fit-content!important}}@media (min-width: 768px){.video-slide{border-radius:var(--lc-media-radius);overflow:hidden}}.video-slide.swiper-slide-active,.video-slide.swiper-slide-prev,.video-slide.swiper-slide-next{visibility:visible}video{width:100%;height:100%;object-fit:cover;position:relative;z-index:3}.lc-desktop-controls{position:absolute;top:2rem;right:4rem;z-index:10;display:flex;gap:.5rem}@media (max-width: 768px){.lc-desktop-controls{display:none}}.lc-video-controls{position:absolute;top:1rem;z-index:10;right:.5rem;display:flex;gap:.25rem}@media (min-width: 768px){.lc-video-controls .lc-close-button{display:none}}.share-controls{position:absolute;bottom:30%;right:.5rem;z-index:10;display:flex;gap:.25rem;flex-direction:column;justify-content:center;align-items:center}.lc-close-button{width:var(--lc-icon-button-size, 44px);height:var(--lc-icon-button-size, 44px);display:flex;justify-content:center;align-items:center;border:none;border-radius:100%;background:#00000080;background:color-mix(in oklab,#000 50%,transparent)}.lc-video-container{position:relative;height:100%;width:100%;background:#000000b3 no-repeat center;background-size:cover}@media (min-width: 768px){.lc-product-detail-view .lc-video-container{width:50%}}@media (min-width: 768px){.lc-video-only-view .lc-video-container{width:var(--video-container-width, 100%);height:var(--video-container-height, 100%)}}.lc-card-container{position:absolute;bottom:12px;z-index:10;width:100%;padding-inline:12px;box-sizing:border-box}.lc-product-detail-view .lc-card-container{display:none}@media (max-width: 768px){.lc-product-detail-view .lc-card-container{display:block}}.lc-product-detail-view .lc-video-modal-row{display:flex;justify-content:center;height:100%;width:100%}.lc-video-only-view .lc-video-modal-row{display:block;height:100%}.lc-product-detail-view cooee-item-detail{--header-display: none;width:50%;flex:1}@media (max-width: 768px){.lc-product-detail-view cooee-item-detail{--header-display: flex;width:100%;height:70dvh;position:absolute;bottom:0;z-index:2147483646}}.lc-video-only-view cooee-item-detail{width:100%;height:70dvh;z-index:2147483646;bottom:0;position:absolute;border-radius:var(--lc-card-radius) var(--lc-card-radius) 0 0}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.video-loading-overlay{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;background-color:#0000004d;z-index:2}.video-loading-overlay .loading-spinner{width:30px;height:30px;border:3px solid rgba(255,255,255,.3);border-top:3px solid #fff;border-radius:50%;animation:spin 1s linear infinite}
2
2
  `],encapsulation:3})};export{ke as VideoDetailDialogComponent};
@@ -1,19 +1,19 @@
1
- import{A as Oi,B as Li,a as mi,b as fi,d as tt,e as dt,f as oe,g as hi,h as fe,i as vi,j as yi,k as Ci,l as xi,m as Ue,n as bi,o as Vi,p as Ti,q as Ei,t as Si,u as Mi,v as Mt,x as Pi,y as Fi,z as Ri}from"./chunk-O2WHN7F2.js";import{c as Y,d as ui,g as gi,i as _i,j as wi,k as pt,l as Ii,m as ki,n as Di,q as Ai}from"./chunk-BVPZU4J3.js";import{a as ut}from"./chunk-HJ2OFJSU.js";import{a as qe}from"./chunk-T6RU7RSX.js";import{$ as U,$a as ne,A as zt,Aa as ue,B as Ut,Ba as H,Da as V,E as _e,F as qt,Ga as He,Ha as je,I as Wt,Ia as $e,K as ae,L as lt,La as le,Ma as Xe,N as Zt,O as S,P as Qt,Pa as oi,Q as Gt,Qa as ce,Ra as ri,S as It,Sa as ze,Wa as et,X as z,Xa as Ee,Ya as ie,Z as Jt,_ as Yt,aa as Kt,ab as ai,b as Lt,bb as si,cb as me,da as Xt,db as Ce,e as Nt,eb as li,fa as ei,gb as ci,ha as Ke,ia as j,ib as di,ja as $,k as Bt,kb as St,la as ti,ma as we,na as Ve,oa as B,p as Ht,pa as k,qa as D,ra as se,s as jt,sa as Ne,sb as ct,ta as Be,ua as Te,v as re,va as ii,wa as ni,x as O,xb as pi,y as L,z as $t,za as te}from"./chunk-K77Q3IPF.js";import{a as ye,b as Ot,e as qi,f as Wi}from"./chunk-V7UGKYBN.js";var ji=qi((mt,Hi)=>{"use strict";(function(o,e){typeof mt=="object"&&typeof Hi<"u"?e(mt):typeof define=="function"&&define.amd?define(["exports"],e):e((o=typeof globalThis<"u"?globalThis:o||self).Sqrl={})})(mt,function(o){"use strict";function e(s){var l,d,u=new Error(s);return l=u,d=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(l,d):l.__proto__=d,u}function t(s,l,d){var u=l.slice(0,d).split(/\n/),n=u.length,i=u[n-1].length+1;throw e(s+=" at line "+n+" col "+i+`:
1
+ import{A as Oi,B as Ni,a as mi,b as fi,d as tt,e as dt,f as oe,g as hi,h as fe,i as vi,j as yi,k as Ci,l as bi,m as Ue,n as xi,o as Vi,p as Ti,q as Ei,t as Si,u as Mi,v as Mt,x as Pi,y as Fi,z as Ri}from"./chunk-DZFO4O3B.js";import{c as z,d as ui,g as gi,i as _i,j as wi,k as pt,l as Ii,m as ki,n as Di,q as Ai}from"./chunk-QA6GKNSU.js";import{a as ut}from"./chunk-HJ2OFJSU.js";import{a as qe}from"./chunk-T6RU7RSX.js";import{$ as q,$a as ne,A as zt,Aa as ue,B as Ut,Ba as H,Da as V,E as _e,F as qt,Ga as He,Ha as je,I as Wt,Ia as $e,K as ae,L as lt,La as le,Ma as Xe,N as Zt,O as S,P as Qt,Pa as oi,Q as Gt,Qa as ce,Ra as ri,S as It,Sa as ze,Wa as et,X as U,Xa as Ee,Ya as ie,Z as Jt,_ as Yt,aa as Kt,ab as ai,b as Nt,bb as si,cb as me,da as Xt,db as Ce,e as Lt,eb as li,fa as ei,gb as ci,ha as Ke,ia as j,ib as di,ja as $,k as Bt,kb as St,la as ti,ma as we,na as Ve,oa as B,p as Ht,pa as k,qa as D,ra as se,s as jt,sa as Le,sb as ct,ta as Be,ua as Te,v as re,va as ii,wa as ni,x as O,xb as pi,y as N,z as $t,za as te}from"./chunk-K77Q3IPF.js";import{a as ye,b as Ot,e as qi,f as Wi}from"./chunk-V7UGKYBN.js";var ji=qi((mt,Hi)=>{"use strict";(function(o,e){typeof mt=="object"&&typeof Hi<"u"?e(mt):typeof define=="function"&&define.amd?define(["exports"],e):e((o=typeof globalThis<"u"?globalThis:o||self).Sqrl={})})(mt,function(o){"use strict";function e(s){var l,d,u=new Error(s);return l=u,d=e.prototype,Object.setPrototypeOf?Object.setPrototypeOf(l,d):l.__proto__=d,u}function t(s,l,d){var u=l.slice(0,d).split(/\n/),n=u.length,i=u[n-1].length+1;throw e(s+=" at line "+n+" col "+i+`:
2
2
 
3
3
  `+l.split(/\n/)[n-1]+`
4
- `+Array(i).join(" ")+"^")}e.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var r=new Function("return this")().Promise,a=!1;try{a=new Function("return (async function(){}).constructor")()}catch(s){if(!(s instanceof SyntaxError))throw s}function c(s,l){return Object.prototype.hasOwnProperty.call(s,l)}function f(s,l,d){for(var u in l)c(l,u)&&(l[u]==null||typeof l[u]!="object"||u!=="storage"&&u!=="prefixes"||d?s[u]=l[u]:s[u]=f({},l[u]));return s}var m=/^async +/,b=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,A=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,Q=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,xe=/[.*+\-?^${}()|[\]\\]/g;function be(s){return xe.test(s)?s.replace(xe,"\\$&"):s}function it(s,l){l.rmWhitespace&&(s=s.replace(/[\r\n]+/g,`
5
- `).replace(/^\s+|\s+$/gm,"")),b.lastIndex=0,A.lastIndex=0,Q.lastIndex=0;var d=l.prefixes,u=[d.h,d.b,d.i,d.r,d.c,d.e].reduce(function(x,v){return x&&v?x+"|"+be(v):v?be(v):x},""),n=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+be(l.tags[1])+")","g"),i=new RegExp("([^]*?)"+be(l.tags[0])+"(-|_)?\\s*("+u+")?\\s*","g"),p=0,g=!1;function y(x,v){var T,w={f:[]},P=0,I="c";function E(Pe){var ke=s.slice(p,Pe),W=ke.trim();if(I==="f")W==="safe"?w.raw=!0:l.async&&m.test(W)?(W=W.replace(m,""),w.f.push([W,"",!0])):w.f.push([W,""]);else if(I==="fp")w.f[w.f.length-1][1]+=W;else if(I==="err"){if(W){var de=ke.search(/\S/);t("invalid syntax",s,p+de)}}else w[I]=W;p=Pe+1}for(v==="h"||v==="b"||v==="c"?I="n":v==="r"&&(w.raw=!0,v="i"),n.lastIndex=p;(T=n.exec(s))!==null;){var F=T[1],N=T[2],q=T[3],G=T[4],X=T[5],M=T.index;if(F)F==="("?(P===0&&(I==="n"?(E(M),I="p"):I==="f"&&(E(M),I="fp")),P++):F===")"?--P===0&&I!=="c"&&(E(M),I="err"):P===0&&F==="|"?(E(M),I="f"):F==="=>"&&(E(M),p+=1,I="res");else if(N)if(N==="/*"){var ve=s.indexOf("*/",n.lastIndex);ve===-1&&t("unclosed comment",s,T.index),n.lastIndex=ve+2}else N==="'"?(A.lastIndex=T.index,A.exec(s)?n.lastIndex=A.lastIndex:t("unclosed string",s,T.index)):N==='"'?(Q.lastIndex=T.index,Q.exec(s)?n.lastIndex=Q.lastIndex:t("unclosed string",s,T.index)):N==="`"&&(b.lastIndex=T.index,b.exec(s)?n.lastIndex=b.lastIndex:t("unclosed string",s,T.index));else if(q)return E(M),p=M+T[0].length,i.lastIndex=p,g=X,G&&v==="h"&&(v="s"),w.t=v,w}return t("unclosed tag",s,x),w}var C=(function x(v,T){v.b=[],v.d=[];var w,P=!1,I=[];function E(de,st){de&&(de=(function(J,De,Oe,Le){var ee,pe;return typeof De.autoTrim=="string"?ee=pe=De.autoTrim:Array.isArray(De.autoTrim)&&(ee=De.autoTrim[1],pe=De.autoTrim[0]),(Oe||Oe===!1)&&(ee=Oe),(Le||Le===!1)&&(pe=Le),ee==="slurp"&&pe==="slurp"?J.trim():(ee==="_"||ee==="slurp"?J=String.prototype.trimLeft?J.trimLeft():J.replace(/^[\s\uFEFF\xA0]+/,""):ee!=="-"&&ee!=="nl"||(J=J.replace(/^(?:\n|\r|\r\n)/,"")),pe==="_"||pe==="slurp"?J=String.prototype.trimRight?J.trimRight():J.replace(/[\s\uFEFF\xA0]+$/,""):pe!=="-"&&pe!=="nl"||(J=J.replace(/(?:\n|\r|\r\n)$/,"")),J)})(de,l,g,st))&&(de=de.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),I.push(de))}for(;(w=i.exec(s))!==null;){var F,N=w[1],q=w[2],G=w[3]||"";for(var X in d)if(d[X]===G){F=X;break}E(N,q),p=w.index+w[0].length,F||t("unrecognized tag type: "+G,s,p);var M=y(w.index,F),ve=M.t;if(ve==="h"){var Pe=M.n||"";l.async&&m.test(Pe)&&(M.a=!0,M.n=Pe.replace(m,"")),M=x(M),I.push(M)}else if(ve==="c"){if(v.n===M.n)return P?(P.d=I,v.b.push(P)):v.d=I,v;t("Helper start and end don't match",s,w.index+w[0].length)}else if(ve==="b"){P?(P.d=I,v.b.push(P)):v.d=I;var ke=M.n||"";l.async&&m.test(ke)&&(M.a=!0,M.n=ke.replace(m,"")),P=M,I=[]}else if(ve==="s"){var W=M.n||"";l.async&&m.test(W)&&(M.a=!0,M.n=W.replace(m,"")),I.push(M)}else I.push(M)}if(!T)throw e('unclosed helper "'+v.n+'"');return E(s.slice(p,s.length),!1),v.d=I,v})({f:[]},!0);if(l.plugins)for(var _=0;_<l.plugins.length;_++){var h=l.plugins[_];h.processAST&&(C.d=h.processAST(C.d,l))}return C.d}function Ze(s,l){var d=it(s,l),u="var tR='';"+(l.useWith?"with("+l.varName+"||{}){":"")+K(d,l)+"if(cb){cb(null,tR)} return tR"+(l.useWith?"}":"");if(l.plugins)for(var n=0;n<l.plugins.length;n++){var i=l.plugins[n];i.processFnString&&(u=i.processFnString(u,l))}return u}function Qe(s,l){for(var d=0;d<l.length;d++){var u=l[d][0],n=l[d][1];s=(l[d][2]?"await ":"")+"c.l('F','"+u+"')("+s,n&&(s+=","+n),s+=")"}return s}function R(s,l,d,u,n,i){var p="{exec:"+(n?"async ":"")+Ge(d,l,s)+",params:["+u+"]";return i&&(p+=",name:'"+i+"'"),n&&(p+=",async:true"),p+="}"}function Vt(s,l){for(var d="[",u=0;u<s.length;u++){var n=s[u];d+=R(l,n.res||"",n.d,n.p||"",n.a,n.n),u<s.length&&(d+=",")}return d+="]"}function Ge(s,l,d){return"function("+l+"){var tR='';"+K(s,d)+"return tR}"}function K(s,l){for(var d=0,u=s.length,n="";d<u;d++){var i=s[d];if(typeof i=="string")n+="tR+='"+i+"';";else{var p=i.t,g=i.c||"",y=i.f,C=i.n||"",_=i.p||"",h=i.res||"",x=i.b,v=!!i.a;if(p==="i"){l.defaultFilter&&(g="c.l('F','"+l.defaultFilter+"')("+g+")");var T=Qe(g,y);!i.raw&&l.autoEscape&&(T="c.l('F','e')("+T+")"),n+="tR+="+T+";"}else if(p==="h")if(l.storage.nativeHelpers.get(C))n+=l.storage.nativeHelpers.get(C)(i,l);else{var w=(v?"await ":"")+"c.l('H','"+C+"')("+R(l,h,i.d,_,v);w+=x?","+Vt(x,l):",[]",n+="tR+="+Qe(w+=",c)",y)+";"}else p==="s"?n+="tR+="+Qe((v?"await ":"")+"c.l('H','"+C+"')({params:["+_+"]},[],c)",y)+";":p==="e"&&(n+=g+`
6
- `)}}return n}var Fe=(function(){function s(l){this.cache=l}return s.prototype.define=function(l,d){this.cache[l]=d},s.prototype.get=function(l){return this.cache[l]},s.prototype.remove=function(l){delete this.cache[l]},s.prototype.reset=function(){this.cache={}},s.prototype.load=function(l){f(this.cache,l,!0)},s})();function he(s,l,d,u){if(l&&l.length>0)throw e((u?"Native":"")+"Helper '"+s+"' doesn't accept blocks");if(d&&d.length>0)throw e((u?"Native":"")+"Helper '"+s+"' doesn't accept filters")}var Tt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Et(s){return Tt[s]}var nt=new Fe({}),ot=new Fe({each:function(s,l){var d="",u=s.params[0];if(he("each",l,!1),s.async)return new Promise(function(i){(function p(g,y,C,_,h){C(g[y],y).then(function(x){_+=x,y===g.length-1?h(_):p(g,y+1,C,_,h)})})(u,0,s.exec,d,i)});for(var n=0;n<u.length;n++)d+=s.exec(u[n],n);return d},foreach:function(s,l){var d=s.params[0];if(he("foreach",l,!1),s.async)return new Promise(function(i){(function p(g,y,C,_,h,x){_(y[C],g[y[C]]).then(function(v){h+=v,C===y.length-1?x(h):p(g,y,C+1,_,h,x)})})(d,Object.keys(d),0,s.exec,"",i)});var u="";for(var n in d)c(d,n)&&(u+=s.exec(n,d[n]));return u},include:function(s,l,d){he("include",l,!1);var u=d.storage.templates.get(s.params[0]);if(!u)throw e('Could not fetch template "'+s.params[0]+'"');return u(s.params[1],d)},extends:function(s,l,d){var u=s.params[1]||{};u.content=s.exec();for(var n=0;n<l.length;n++){var i=l[n];u[i.name]=i.exec()}var p=d.storage.templates.get(s.params[0]);if(!p)throw e('Could not fetch template "'+s.params[0]+'"');return p(u,d)},useScope:function(s,l){return he("useScope",l,!1),s.exec(s.params[0])}}),rt=new Fe({if:function(s,l){he("if",!1,s.f,!0);var d="if("+s.p+"){"+K(s.d,l)+"}";if(s.b)for(var u=0;u<s.b.length;u++){var n=s.b[u];n.n==="else"?d+="else{"+K(n.d,l)+"}":n.n==="elif"&&(d+="else if("+n.p+"){"+K(n.d,l)+"}")}return d},try:function(s,l){if(he("try",!1,s.f,!0),!s.b||s.b.length!==1||s.b[0].n!=="catch")throw e("native helper 'try' only accepts 1 block, 'catch'");var d="try{"+K(s.d,l)+"}",u=s.b[0];return d+="catch"+(u.res?"("+u.res+")":"")+"{"+K(u.d,l)+"}"},block:function(s,l){return he("block",s.b,s.f,!0),"if(!"+l.varName+"["+s.p+"]){tR+=("+Ge(s.d,"",l)+")()}else{tR+="+l.varName+"["+s.p+"]}"}}),at=new Fe({e:function(s){var l=String(s);return/[&<>"']/.test(l)?l.replace(/[&<>"']/g,Et):l}}),Re={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(s,l){if(s==="H"){var d=this.storage.helpers.get(l);if(d)return d;throw e("Can't find helper '"+l+"'")}if(s==="F"){var u=this.storage.filters.get(l);if(u)return u;throw e("Can't find filter '"+l+"'")}},async:!1,storage:{helpers:ot,nativeHelpers:rt,filters:at,templates:nt},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function Je(s,l){var d={};return f(d,Re),l&&f(d,l),s&&f(d,s),d.l.bind(d),d}function Ye(s,l){var d,u=Je(l||{}),n=Function;if(u.async){if(!a)throw e("This environment doesn't support async/await");n=a}if(u.varName&&(d=u.varName,/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(d)===!1))throw e("options.varName must be a valid JS identifier");try{return new n(u.varName,"c","cb",Ze(s,u))}catch(i){throw i instanceof SyntaxError?e(`Bad template syntax
4
+ `+Array(i).join(" ")+"^")}e.prototype=Object.create(Error.prototype,{name:{value:"Squirrelly Error",enumerable:!1}});var r=new Function("return this")().Promise,a=!1;try{a=new Function("return (async function(){}).constructor")()}catch(s){if(!(s instanceof SyntaxError))throw s}function c(s,l){return Object.prototype.hasOwnProperty.call(s,l)}function f(s,l,d){for(var u in l)c(l,u)&&(l[u]==null||typeof l[u]!="object"||u!=="storage"&&u!=="prefixes"||d?s[u]=l[u]:s[u]=f({},l[u]));return s}var m=/^async +/,x=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,A=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,G=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g,be=/[.*+\-?^${}()|[\]\\]/g;function xe(s){return be.test(s)?s.replace(be,"\\$&"):s}function it(s,l){l.rmWhitespace&&(s=s.replace(/[\r\n]+/g,`
5
+ `).replace(/^\s+|\s+$/gm,"")),x.lastIndex=0,A.lastIndex=0,G.lastIndex=0;var d=l.prefixes,u=[d.h,d.b,d.i,d.r,d.c,d.e].reduce(function(b,v){return b&&v?b+"|"+xe(v):v?xe(v):b},""),n=new RegExp("([|()]|=>)|('|\"|`|\\/\\*)|\\s*((\\/)?(-|_)?"+xe(l.tags[1])+")","g"),i=new RegExp("([^]*?)"+xe(l.tags[0])+"(-|_)?\\s*("+u+")?\\s*","g"),p=0,g=!1;function y(b,v){var T,w={f:[]},P=0,I="c";function E(Pe){var ke=s.slice(p,Pe),Q=ke.trim();if(I==="f")Q==="safe"?w.raw=!0:l.async&&m.test(Q)?(Q=Q.replace(m,""),w.f.push([Q,"",!0])):w.f.push([Q,""]);else if(I==="fp")w.f[w.f.length-1][1]+=Q;else if(I==="err"){if(Q){var de=ke.search(/\S/);t("invalid syntax",s,p+de)}}else w[I]=Q;p=Pe+1}for(v==="h"||v==="b"||v==="c"?I="n":v==="r"&&(w.raw=!0,v="i"),n.lastIndex=p;(T=n.exec(s))!==null;){var F=T[1],L=T[2],Z=T[3],J=T[4],X=T[5],M=T.index;if(F)F==="("?(P===0&&(I==="n"?(E(M),I="p"):I==="f"&&(E(M),I="fp")),P++):F===")"?--P===0&&I!=="c"&&(E(M),I="err"):P===0&&F==="|"?(E(M),I="f"):F==="=>"&&(E(M),p+=1,I="res");else if(L)if(L==="/*"){var ve=s.indexOf("*/",n.lastIndex);ve===-1&&t("unclosed comment",s,T.index),n.lastIndex=ve+2}else L==="'"?(A.lastIndex=T.index,A.exec(s)?n.lastIndex=A.lastIndex:t("unclosed string",s,T.index)):L==='"'?(G.lastIndex=T.index,G.exec(s)?n.lastIndex=G.lastIndex:t("unclosed string",s,T.index)):L==="`"&&(x.lastIndex=T.index,x.exec(s)?n.lastIndex=x.lastIndex:t("unclosed string",s,T.index));else if(Z)return E(M),p=M+T[0].length,i.lastIndex=p,g=X,J&&v==="h"&&(v="s"),w.t=v,w}return t("unclosed tag",s,b),w}var C=(function b(v,T){v.b=[],v.d=[];var w,P=!1,I=[];function E(de,st){de&&(de=(function(Y,De,Oe,Ne){var ee,pe;return typeof De.autoTrim=="string"?ee=pe=De.autoTrim:Array.isArray(De.autoTrim)&&(ee=De.autoTrim[1],pe=De.autoTrim[0]),(Oe||Oe===!1)&&(ee=Oe),(Ne||Ne===!1)&&(pe=Ne),ee==="slurp"&&pe==="slurp"?Y.trim():(ee==="_"||ee==="slurp"?Y=String.prototype.trimLeft?Y.trimLeft():Y.replace(/^[\s\uFEFF\xA0]+/,""):ee!=="-"&&ee!=="nl"||(Y=Y.replace(/^(?:\n|\r|\r\n)/,"")),pe==="_"||pe==="slurp"?Y=String.prototype.trimRight?Y.trimRight():Y.replace(/[\s\uFEFF\xA0]+$/,""):pe!=="-"&&pe!=="nl"||(Y=Y.replace(/(?:\n|\r|\r\n)$/,"")),Y)})(de,l,g,st))&&(de=de.replace(/\\|'/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n"),I.push(de))}for(;(w=i.exec(s))!==null;){var F,L=w[1],Z=w[2],J=w[3]||"";for(var X in d)if(d[X]===J){F=X;break}E(L,Z),p=w.index+w[0].length,F||t("unrecognized tag type: "+J,s,p);var M=y(w.index,F),ve=M.t;if(ve==="h"){var Pe=M.n||"";l.async&&m.test(Pe)&&(M.a=!0,M.n=Pe.replace(m,"")),M=b(M),I.push(M)}else if(ve==="c"){if(v.n===M.n)return P?(P.d=I,v.b.push(P)):v.d=I,v;t("Helper start and end don't match",s,w.index+w[0].length)}else if(ve==="b"){P?(P.d=I,v.b.push(P)):v.d=I;var ke=M.n||"";l.async&&m.test(ke)&&(M.a=!0,M.n=ke.replace(m,"")),P=M,I=[]}else if(ve==="s"){var Q=M.n||"";l.async&&m.test(Q)&&(M.a=!0,M.n=Q.replace(m,"")),I.push(M)}else I.push(M)}if(!T)throw e('unclosed helper "'+v.n+'"');return E(s.slice(p,s.length),!1),v.d=I,v})({f:[]},!0);if(l.plugins)for(var _=0;_<l.plugins.length;_++){var h=l.plugins[_];h.processAST&&(C.d=h.processAST(C.d,l))}return C.d}function Ze(s,l){var d=it(s,l),u="var tR='';"+(l.useWith?"with("+l.varName+"||{}){":"")+K(d,l)+"if(cb){cb(null,tR)} return tR"+(l.useWith?"}":"");if(l.plugins)for(var n=0;n<l.plugins.length;n++){var i=l.plugins[n];i.processFnString&&(u=i.processFnString(u,l))}return u}function Qe(s,l){for(var d=0;d<l.length;d++){var u=l[d][0],n=l[d][1];s=(l[d][2]?"await ":"")+"c.l('F','"+u+"')("+s,n&&(s+=","+n),s+=")"}return s}function R(s,l,d,u,n,i){var p="{exec:"+(n?"async ":"")+Ge(d,l,s)+",params:["+u+"]";return i&&(p+=",name:'"+i+"'"),n&&(p+=",async:true"),p+="}"}function Vt(s,l){for(var d="[",u=0;u<s.length;u++){var n=s[u];d+=R(l,n.res||"",n.d,n.p||"",n.a,n.n),u<s.length&&(d+=",")}return d+="]"}function Ge(s,l,d){return"function("+l+"){var tR='';"+K(s,d)+"return tR}"}function K(s,l){for(var d=0,u=s.length,n="";d<u;d++){var i=s[d];if(typeof i=="string")n+="tR+='"+i+"';";else{var p=i.t,g=i.c||"",y=i.f,C=i.n||"",_=i.p||"",h=i.res||"",b=i.b,v=!!i.a;if(p==="i"){l.defaultFilter&&(g="c.l('F','"+l.defaultFilter+"')("+g+")");var T=Qe(g,y);!i.raw&&l.autoEscape&&(T="c.l('F','e')("+T+")"),n+="tR+="+T+";"}else if(p==="h")if(l.storage.nativeHelpers.get(C))n+=l.storage.nativeHelpers.get(C)(i,l);else{var w=(v?"await ":"")+"c.l('H','"+C+"')("+R(l,h,i.d,_,v);w+=b?","+Vt(b,l):",[]",n+="tR+="+Qe(w+=",c)",y)+";"}else p==="s"?n+="tR+="+Qe((v?"await ":"")+"c.l('H','"+C+"')({params:["+_+"]},[],c)",y)+";":p==="e"&&(n+=g+`
6
+ `)}}return n}var Fe=(function(){function s(l){this.cache=l}return s.prototype.define=function(l,d){this.cache[l]=d},s.prototype.get=function(l){return this.cache[l]},s.prototype.remove=function(l){delete this.cache[l]},s.prototype.reset=function(){this.cache={}},s.prototype.load=function(l){f(this.cache,l,!0)},s})();function he(s,l,d,u){if(l&&l.length>0)throw e((u?"Native":"")+"Helper '"+s+"' doesn't accept blocks");if(d&&d.length>0)throw e((u?"Native":"")+"Helper '"+s+"' doesn't accept filters")}var Tt={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Et(s){return Tt[s]}var nt=new Fe({}),ot=new Fe({each:function(s,l){var d="",u=s.params[0];if(he("each",l,!1),s.async)return new Promise(function(i){(function p(g,y,C,_,h){C(g[y],y).then(function(b){_+=b,y===g.length-1?h(_):p(g,y+1,C,_,h)})})(u,0,s.exec,d,i)});for(var n=0;n<u.length;n++)d+=s.exec(u[n],n);return d},foreach:function(s,l){var d=s.params[0];if(he("foreach",l,!1),s.async)return new Promise(function(i){(function p(g,y,C,_,h,b){_(y[C],g[y[C]]).then(function(v){h+=v,C===y.length-1?b(h):p(g,y,C+1,_,h,b)})})(d,Object.keys(d),0,s.exec,"",i)});var u="";for(var n in d)c(d,n)&&(u+=s.exec(n,d[n]));return u},include:function(s,l,d){he("include",l,!1);var u=d.storage.templates.get(s.params[0]);if(!u)throw e('Could not fetch template "'+s.params[0]+'"');return u(s.params[1],d)},extends:function(s,l,d){var u=s.params[1]||{};u.content=s.exec();for(var n=0;n<l.length;n++){var i=l[n];u[i.name]=i.exec()}var p=d.storage.templates.get(s.params[0]);if(!p)throw e('Could not fetch template "'+s.params[0]+'"');return p(u,d)},useScope:function(s,l){return he("useScope",l,!1),s.exec(s.params[0])}}),rt=new Fe({if:function(s,l){he("if",!1,s.f,!0);var d="if("+s.p+"){"+K(s.d,l)+"}";if(s.b)for(var u=0;u<s.b.length;u++){var n=s.b[u];n.n==="else"?d+="else{"+K(n.d,l)+"}":n.n==="elif"&&(d+="else if("+n.p+"){"+K(n.d,l)+"}")}return d},try:function(s,l){if(he("try",!1,s.f,!0),!s.b||s.b.length!==1||s.b[0].n!=="catch")throw e("native helper 'try' only accepts 1 block, 'catch'");var d="try{"+K(s.d,l)+"}",u=s.b[0];return d+="catch"+(u.res?"("+u.res+")":"")+"{"+K(u.d,l)+"}"},block:function(s,l){return he("block",s.b,s.f,!0),"if(!"+l.varName+"["+s.p+"]){tR+=("+Ge(s.d,"",l)+")()}else{tR+="+l.varName+"["+s.p+"]}"}}),at=new Fe({e:function(s){var l=String(s);return/[&<>"']/.test(l)?l.replace(/[&<>"']/g,Et):l}}),Re={varName:"it",autoTrim:[!1,"nl"],autoEscape:!0,defaultFilter:!1,tags:["{{","}}"],l:function(s,l){if(s==="H"){var d=this.storage.helpers.get(l);if(d)return d;throw e("Can't find helper '"+l+"'")}if(s==="F"){var u=this.storage.filters.get(l);if(u)return u;throw e("Can't find filter '"+l+"'")}},async:!1,storage:{helpers:ot,nativeHelpers:rt,filters:at,templates:nt},prefixes:{h:"@",b:"#",i:"",r:"*",c:"/",e:"!"},cache:!1,plugins:[],useWith:!1};function Je(s,l){var d={};return f(d,Re),l&&f(d,l),s&&f(d,s),d.l.bind(d),d}function Ye(s,l){var d,u=Je(l||{}),n=Function;if(u.async){if(!a)throw e("This environment doesn't support async/await");n=a}if(u.varName&&(d=u.varName,/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(d)===!1))throw e("options.varName must be a valid JS identifier");try{return new n(u.varName,"c","cb",Ze(s,u))}catch(i){throw i instanceof SyntaxError?e(`Bad template syntax
7
7
 
8
8
  `+i.message+`
9
9
  `+Array(i.message.length+1).join("=")+`
10
- `+Ze(s,u)):i}}function Me(s,l){var d;return l.cache&&l.name&&l.storage.templates.get(l.name)?l.storage.templates.get(l.name):(d=typeof s=="function"?s:Ye(s,l),l.cache&&l.name&&l.storage.templates.define(l.name,d),d)}Re.l.bind(Re),o.compile=Ye,o.compileScope=K,o.compileScopeIntoFunction=Ge,o.compileToString=Ze,o.defaultConfig=Re,o.filters=at,o.getConfig=Je,o.helpers=ot,o.nativeHelpers=rt,o.parse=it,o.render=function(s,l,d,u){var n=Je(d||{});if(!n.async)return Me(s,n)(l,n);if(!u){if(typeof r=="function")return new r(function(i,p){try{i(Me(s,n)(l,n))}catch(g){p(g)}});throw e("Please provide a callback function, this env doesn't support Promises")}try{Me(s,n)(l,n,u)}catch(i){return u(i)}},o.templates=nt,Object.defineProperty(o,"__esModule",{value:!0})})});var Zi={schedule(o,e){let t=setTimeout(o,e);return()=>clearTimeout(t)}};function Qi(o){return o.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function Gi(o){return!!o&&o.nodeType===Node.ELEMENT_NODE}var Pt;function Ji(o,e){if(!Pt){let t=Element.prototype;Pt=t.matches||t.matchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector}return o.nodeType===Node.ELEMENT_NODE?Pt.call(o,e):!1}function Yi(o){let e={};return o.forEach(({propName:t,templateName:r,transform:a})=>{e[Qi(r)]=[t,a]}),e}function Ki(o,e){return e.get(It).resolveComponentFactory(o).inputs}function Xi(o,e){let t=o.childNodes,r=e.map(()=>[]),a=-1;e.some((c,f)=>c==="*"?(a=f,!0):!1);for(let c=0,f=t.length;c<f;++c){let m=t[c],b=en(m,e,a);b!==-1&&r[b].push(m)}return r}function en(o,e,t){let r=t;return Gi(o)&&e.some((a,c)=>a!=="*"&&Ji(o,a)?(r=c,!0):!1),r}var tn=10,kt=class{componentFactory;inputMap=new Map;constructor(e,t){this.componentFactory=t.get(It).resolveComponentFactory(e);for(let r of this.componentFactory.inputs)this.inputMap.set(r.propName,r.templateName)}create(e){return new Dt(this.componentFactory,e,this.inputMap)}},Dt=class{componentFactory;injector;inputMap;eventEmitters=new Nt(1);events=this.eventEmitters.pipe(Ht(e=>Bt(...e)));componentRef=null;scheduledDestroyFn=null;initialInputValues=new Map;ngZone;elementZone;appRef;cdScheduler;constructor(e,t,r){this.componentFactory=e,this.injector=t,this.inputMap=r,this.ngZone=this.injector.get(Xt),this.appRef=this.injector.get(ei),this.cdScheduler=t.get(qt),this.elementZone=typeof Zone>"u"?null:this.ngZone.run(()=>Zone.current)}connect(e){this.runInZone(()=>{if(this.scheduledDestroyFn!==null){this.scheduledDestroyFn(),this.scheduledDestroyFn=null;return}this.componentRef===null&&this.initializeComponent(e)})}disconnect(){this.runInZone(()=>{this.componentRef===null||this.scheduledDestroyFn!==null||(this.scheduledDestroyFn=Zi.schedule(()=>{this.componentRef!==null&&(this.componentRef.destroy(),this.componentRef=null)},tn))})}getInputValue(e){return this.runInZone(()=>this.componentRef===null?this.initialInputValues.get(e):this.componentRef.instance[e])}setInputValue(e,t){if(this.componentRef===null){this.initialInputValues.set(e,t);return}this.runInZone(()=>{this.componentRef.setInput(this.inputMap.get(e)??e,t),Qt(this.componentRef.hostView)&&(Gt(this.componentRef.changeDetectorRef),this.cdScheduler.notify(6))})}initializeComponent(e){let t=Ut.create({providers:[],parent:this.injector}),r=Xi(e,this.componentFactory.ngContentSelectors);this.componentRef=this.componentFactory.create(t,r,e),this.initializeInputs(),this.initializeOutputs(this.componentRef),this.appRef.attachView(this.componentRef.hostView),this.componentRef.hostView.detectChanges()}initializeInputs(){for(let[e,t]of this.initialInputValues)this.setInputValue(e,t);this.initialInputValues.clear()}initializeOutputs(e){let t=this.componentFactory.outputs.map(({propName:r,templateName:a})=>{let c=e.instance[r];return new Lt(f=>{let m=c.subscribe(b=>f.next({name:a,value:b}));return()=>m.unsubscribe()})});this.eventEmitters.next(t)}runInZone(e){return this.elementZone&&Zone.current!==this.elementZone?this.ngZone.run(e):e()}},At=class extends HTMLElement{ngElementEventsSubscription=null};function Ni(o,e){let t=Ki(o,e.injector),r=e.strategyFactory||new kt(o,e.injector),a=Yi(t);class c extends At{injector;static observedAttributes=Object.keys(a);get ngElementStrategy(){if(!this._ngElementStrategy){let m=this._ngElementStrategy=r.create(this.injector||e.injector);t.forEach(({propName:b,transform:A})=>{if(!this.hasOwnProperty(b))return;let Q=this[b];delete this[b],m.setInputValue(b,Q,A)})}return this._ngElementStrategy}_ngElementStrategy;constructor(m){super(),this.injector=m}attributeChangedCallback(m,b,A,Q){let[xe,be]=a[m];this.ngElementStrategy.setInputValue(xe,A,be)}connectedCallback(){let m=!1;this.ngElementStrategy.events&&(this.subscribeToEvents(),m=!0),this.ngElementStrategy.connect(this),m||this.subscribeToEvents()}disconnectedCallback(){this._ngElementStrategy&&this._ngElementStrategy.disconnect(),this.ngElementEventsSubscription&&(this.ngElementEventsSubscription.unsubscribe(),this.ngElementEventsSubscription=null)}subscribeToEvents(){this.ngElementEventsSubscription=this.ngElementStrategy.events.subscribe(m=>{let b=new CustomEvent(m.name,{detail:m.value});this.dispatchEvent(b)})}}return t.forEach(({propName:f,transform:m})=>{Object.defineProperty(c.prototype,f,{get(){return this.ngElementStrategy.getInputValue(f)},set(b){this.ngElementStrategy.setInputValue(f,b,m)},configurable:!0,enumerable:!0})}),c}var Bi={providers:[ci()]};var Ft=(t=>(t.CART_AMOUNT="CART_AMOUNT",t.ITEM_COUNT="ITEM_COUNT",t))(Ft||{});var Z=Wi(ji());Z.filters.define("default",function(o){return typeof o>"u"||o==null?"":on(o)});+Z.filters.define("max",(o,e)=>{let t=Number(o),r=Number(e);return isNaN(t)||isNaN(r)?o:t>r?e:o});Z.filters.define("min",(o,e)=>{let t=Number(o),r=Number(e);return isNaN(t)||isNaN(r)?o:t<r?e:o});Z.filters.define("fallback",(o,e)=>o==null||o===""?e:o);Z.filters.define("manipulate_quantity",(o,e,t)=>{if(e??=1,t??=100,e>t)return Y.error("Invalid range: min should be less than or equal to max."),o;if(o>=e&&o<=t)return o;let r=o%t;return r<e?e:r});Z.filters.define("apply_discount_perc",(o,e,t=1/0)=>{if(o=+o,isNaN(o))return Y.error("Need value as a number for `apply_discount_perc` filter"),NaN;if(e<0||e>100)return Y.error("Invalid percent value for `apply_discount_perc` filter. Must be between 0 and 100."),NaN;let r=o*e/100;return o-Math.min(t,r)});Z.filters.define("apply_discount_fixed",(o,e)=>(o=+o,isNaN(o)?(Y.error("Need value as a number for `apply_discount_fixed` filter"),NaN):Math.max(0,o-e)));Z.filters.define("currency",o=>(o=+o,isNaN(o)?(Y.error("Need value as a number for `currency` filter"),NaN):Ue(o)));Z.defaultConfig.defaultFilter="default";Z.defaultConfig.useWith=!0;Z.defaultConfig.autoEscape=!1;var nn={'"':"&quot;","\\":"&bsol;","\n":"\\n"};function on(o){return String(o).replace(/["\\\n]/g,e=>nn[e])}function rn(o){if(!o)return"";let e=/({{{\s*([^}]+?)\s*}}}|{{\s*&\s*([^}]+?)\s*}})/g;return o.replace(e,(t,r,a,c)=>`{{ ${(a||c||"").trim()} }}`)}var We=(o,e,t)=>{e=ye({discount:{},cart:{},product:{},bundle:{},variant:{},customer:{},svg:{},form:{},amount_left:null},e);try{return Z.render(rn(o),e)}catch(r){throw Ci(r,"squirrelly-render",{extra:{template:o,values:e},triggerContext:t}),r}};var ft=class o{transform(e,t){return e?We(e,ye({},t)):null}static \u0275fac=function(t){return new(t||o)};static \u0275pipe=Yt({name:"cooeeDynamicVariables",type:o,pure:!0})};var Rt={};(function o(e,t,r,a){var c=!!(e.Worker&&e.Blob&&e.Promise&&e.OffscreenCanvas&&e.OffscreenCanvasRenderingContext2D&&e.HTMLCanvasElement&&e.HTMLCanvasElement.prototype.transferControlToOffscreen&&e.URL&&e.URL.createObjectURL),f=typeof Path2D=="function"&&typeof DOMMatrix=="function",m=(function(){if(!e.OffscreenCanvas)return!1;var n=new OffscreenCanvas(1,1),i=n.getContext("2d");i.fillRect(0,0,1,1);var p=n.transferToImageBitmap();try{i.createPattern(p,"no-repeat")}catch{return!1}return!0})();function b(){}function A(n){var i=t.exports.Promise,p=i!==void 0?i:e.Promise;return typeof p=="function"?new p(n):(n(b,b),null)}var Q=(function(n,i){return{transform:function(p){if(n)return p;if(i.has(p))return i.get(p);var g=new OffscreenCanvas(p.width,p.height),y=g.getContext("2d");return y.drawImage(p,0,0),i.set(p,g),g},clear:function(){i.clear()}}})(m,new Map),xe=(function(){var n=Math.floor(16.666666666666668),i,p,g={},y=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(i=function(C){var _=Math.random();return g[_]=requestAnimationFrame(function h(x){y===x||y+n-1<x?(y=x,delete g[_],C()):g[_]=requestAnimationFrame(h)}),_},p=function(C){g[C]&&cancelAnimationFrame(g[C])}):(i=function(C){return setTimeout(C,n)},p=function(C){return clearTimeout(C)}),{frame:i,cancel:p}})(),be=(function(){var n,i,p={};function g(y){function C(_,h){y.postMessage({options:_||{},callback:h})}y.init=function(h){var x=h.transferControlToOffscreen();y.postMessage({canvas:x},[x])},y.fire=function(h,x,v){if(i)return C(h,null),i;var T=Math.random().toString(36).slice(2);return i=A(function(w){function P(I){I.data.callback===T&&(delete p[T],y.removeEventListener("message",P),i=null,Q.clear(),v(),w())}y.addEventListener("message",P),C(h,T),p[T]=P.bind(null,{data:{callback:T}})}),i},y.reset=function(){y.postMessage({reset:!0});for(var h in p)p[h](),delete p[h]}}return function(){if(n)return n;if(!r&&c){var y=["var CONFETTI, SIZE = {}, module = {};","("+o.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {"," if (msg.data.options) {"," CONFETTI(msg.data.options).then(function () {"," if (msg.data.callback) {"," postMessage({ callback: msg.data.callback });"," }"," });"," } else if (msg.data.reset) {"," CONFETTI && CONFETTI.reset();"," } else if (msg.data.resize) {"," SIZE.width = msg.data.resize.width;"," SIZE.height = msg.data.resize.height;"," } else if (msg.data.canvas) {"," SIZE.width = msg.data.canvas.width;"," SIZE.height = msg.data.canvas.height;"," CONFETTI = module.exports.create(msg.data.canvas);"," }","}"].join(`
11
- `);try{n=new Worker(URL.createObjectURL(new Blob([y])))}catch(C){return typeof console!==void 0&&typeof console.warn=="function"&&console.warn("\u{1F38A} Could not load worker",C),null}g(n)}return n}})(),it={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function Ze(n,i){return i?i(n):n}function Qe(n){return n!=null}function R(n,i,p){return Ze(n&&Qe(n[i])?n[i]:it[i],p)}function Vt(n){return n<0?0:Math.floor(n)}function Ge(n,i){return Math.floor(Math.random()*(i-n))+n}function K(n){return parseInt(n,16)}function Fe(n){return n.map(he)}function he(n){var i=String(n).replace(/[^0-9a-f]/gi,"");return i.length<6&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),{r:K(i.substring(0,2)),g:K(i.substring(2,4)),b:K(i.substring(4,6))}}function Tt(n){var i=R(n,"origin",Object);return i.x=R(i,"x",Number),i.y=R(i,"y",Number),i}function Et(n){n.width=document.documentElement.clientWidth,n.height=document.documentElement.clientHeight}function nt(n){var i=n.getBoundingClientRect();n.width=i.width,n.height=i.height}function ot(n){var i=document.createElement("canvas");return i.style.position="fixed",i.style.top="0px",i.style.left="0px",i.style.pointerEvents="none",i.style.zIndex=n,i}function rt(n,i,p,g,y,C,_,h,x){n.save(),n.translate(i,p),n.rotate(C),n.scale(g,y),n.arc(0,0,1,_,h,x),n.restore()}function at(n){var i=n.angle*(Math.PI/180),p=n.spread*(Math.PI/180);return{x:n.x,y:n.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:n.startVelocity*.5+Math.random()*n.startVelocity,angle2D:-i+(.5*p-Math.random()*p),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:n.color,shape:n.shape,tick:0,totalTicks:n.ticks,decay:n.decay,drift:n.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:n.gravity*3,ovalScalar:.6,scalar:n.scalar,flat:n.flat}}function Re(n,i){i.x+=Math.cos(i.angle2D)*i.velocity+i.drift,i.y+=Math.sin(i.angle2D)*i.velocity+i.gravity,i.velocity*=i.decay,i.flat?(i.wobble=0,i.wobbleX=i.x+10*i.scalar,i.wobbleY=i.y+10*i.scalar,i.tiltSin=0,i.tiltCos=0,i.random=1):(i.wobble+=i.wobbleSpeed,i.wobbleX=i.x+10*i.scalar*Math.cos(i.wobble),i.wobbleY=i.y+10*i.scalar*Math.sin(i.wobble),i.tiltAngle+=.1,i.tiltSin=Math.sin(i.tiltAngle),i.tiltCos=Math.cos(i.tiltAngle),i.random=Math.random()+2);var p=i.tick++/i.totalTicks,g=i.x+i.random*i.tiltCos,y=i.y+i.random*i.tiltSin,C=i.wobbleX+i.random*i.tiltCos,_=i.wobbleY+i.random*i.tiltSin;if(n.fillStyle="rgba("+i.color.r+", "+i.color.g+", "+i.color.b+", "+(1-p)+")",n.beginPath(),f&&i.shape.type==="path"&&typeof i.shape.path=="string"&&Array.isArray(i.shape.matrix))n.fill(l(i.shape.path,i.shape.matrix,i.x,i.y,Math.abs(C-g)*.1,Math.abs(_-y)*.1,Math.PI/10*i.wobble));else if(i.shape.type==="bitmap"){var h=Math.PI/10*i.wobble,x=Math.abs(C-g)*.1,v=Math.abs(_-y)*.1,T=i.shape.bitmap.width*i.scalar,w=i.shape.bitmap.height*i.scalar,P=new DOMMatrix([Math.cos(h)*x,Math.sin(h)*x,-Math.sin(h)*v,Math.cos(h)*v,i.x,i.y]);P.multiplySelf(new DOMMatrix(i.shape.matrix));var I=n.createPattern(Q.transform(i.shape.bitmap),"no-repeat");I.setTransform(P),n.globalAlpha=1-p,n.fillStyle=I,n.fillRect(i.x-T/2,i.y-w/2,T,w),n.globalAlpha=1}else if(i.shape==="circle")n.ellipse?n.ellipse(i.x,i.y,Math.abs(C-g)*i.ovalScalar,Math.abs(_-y)*i.ovalScalar,Math.PI/10*i.wobble,0,2*Math.PI):rt(n,i.x,i.y,Math.abs(C-g)*i.ovalScalar,Math.abs(_-y)*i.ovalScalar,Math.PI/10*i.wobble,0,2*Math.PI);else if(i.shape==="star")for(var E=Math.PI/2*3,F=4*i.scalar,N=8*i.scalar,q=i.x,G=i.y,X=5,M=Math.PI/X;X--;)q=i.x+Math.cos(E)*N,G=i.y+Math.sin(E)*N,n.lineTo(q,G),E+=M,q=i.x+Math.cos(E)*F,G=i.y+Math.sin(E)*F,n.lineTo(q,G),E+=M;else n.moveTo(Math.floor(i.x),Math.floor(i.y)),n.lineTo(Math.floor(i.wobbleX),Math.floor(y)),n.lineTo(Math.floor(C),Math.floor(_)),n.lineTo(Math.floor(g),Math.floor(i.wobbleY));return n.closePath(),n.fill(),i.tick<i.totalTicks}function Je(n,i,p,g,y){var C=i.slice(),_=n.getContext("2d"),h,x,v=A(function(T){function w(){h=x=null,_.clearRect(0,0,g.width,g.height),Q.clear(),y(),T()}function P(){r&&!(g.width===a.width&&g.height===a.height)&&(g.width=n.width=a.width,g.height=n.height=a.height),!g.width&&!g.height&&(p(n),g.width=n.width,g.height=n.height),_.clearRect(0,0,g.width,g.height),C=C.filter(function(I){return Re(_,I)}),C.length?h=xe.frame(P):w()}h=xe.frame(P),x=w});return{addFettis:function(T){return C=C.concat(T),v},canvas:n,promise:v,reset:function(){h&&xe.cancel(h),x&&x()}}}function Ye(n,i){var p=!n,g=!!R(i||{},"resize"),y=!1,C=R(i,"disableForReducedMotion",Boolean),_=c&&!!R(i||{},"useWorker"),h=_?be():null,x=p?Et:nt,v=n&&h?!!n.__confetti_initialized:!1,T=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,w;function P(E,F,N){for(var q=R(E,"particleCount",Vt),G=R(E,"angle",Number),X=R(E,"spread",Number),M=R(E,"startVelocity",Number),ve=R(E,"decay",Number),Pe=R(E,"gravity",Number),ke=R(E,"drift",Number),W=R(E,"colors",Fe),de=R(E,"ticks",Number),st=R(E,"shapes"),J=R(E,"scalar"),De=!!R(E,"flat"),Oe=Tt(E),Le=q,ee=[],pe=n.width*Oe.x,Ui=n.height*Oe.y;Le--;)ee.push(at({x:pe,y:Ui,angle:G,spread:X,startVelocity:M,color:W[Le%W.length],shape:st[Ge(0,st.length)],ticks:de,decay:ve,gravity:Pe,drift:ke,scalar:J,flat:De}));return w?w.addFettis(ee):(w=Je(n,ee,x,F,N),w.promise)}function I(E){var F=C||R(E,"disableForReducedMotion",Boolean),N=R(E,"zIndex",Number);if(F&&T)return A(function(M){M()});p&&w?n=w.canvas:p&&!n&&(n=ot(N),document.body.appendChild(n)),g&&!v&&x(n);var q={width:n.width,height:n.height};h&&!v&&h.init(n),v=!0,h&&(n.__confetti_initialized=!0);function G(){if(h){var M={getBoundingClientRect:function(){if(!p)return n.getBoundingClientRect()}};x(M),h.postMessage({resize:{width:M.width,height:M.height}});return}q.width=q.height=null}function X(){w=null,g&&(y=!1,e.removeEventListener("resize",G)),p&&n&&(document.body.contains(n)&&document.body.removeChild(n),n=null,v=!1)}return g&&!y&&(y=!0,e.addEventListener("resize",G,!1)),h?h.fire(E,q,X):P(E,q,X)}return I.reset=function(){h&&h.reset(),w&&w.reset()},I}var Me;function s(){return Me||(Me=Ye(null,{useWorker:!0,resize:!0})),Me}function l(n,i,p,g,y,C,_){var h=new Path2D(n),x=new Path2D;x.addPath(h,new DOMMatrix(i));var v=new Path2D;return v.addPath(x,new DOMMatrix([Math.cos(_)*y,Math.sin(_)*y,-Math.sin(_)*C,Math.cos(_)*C,p,g])),v}function d(n){if(!f)throw new Error("path confetti are not supported in this browser");var i,p;typeof n=="string"?i=n:(i=n.path,p=n.matrix);var g=new Path2D(i),y=document.createElement("canvas"),C=y.getContext("2d");if(!p){for(var _=1e3,h=_,x=_,v=0,T=0,w,P,I=0;I<_;I+=2)for(var E=0;E<_;E+=2)C.isPointInPath(g,I,E,"nonzero")&&(h=Math.min(h,I),x=Math.min(x,E),v=Math.max(v,I),T=Math.max(T,E));w=v-h,P=T-x;var F=10,N=Math.min(F/w,F/P);p=[N,0,0,N,-Math.round(w/2+h)*N,-Math.round(P/2+x)*N]}return{type:"path",path:i,matrix:p}}function u(n){var i,p=1,g="#000000",y='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof n=="string"?i=n:(i=n.text,p="scalar"in n?n.scalar:p,y="fontFamily"in n?n.fontFamily:y,g="color"in n?n.color:g);var C=10*p,_=""+C+"px "+y,h=new OffscreenCanvas(C,C),x=h.getContext("2d");x.font=_;var v=x.measureText(i),T=Math.ceil(v.actualBoundingBoxRight+v.actualBoundingBoxLeft),w=Math.ceil(v.actualBoundingBoxAscent+v.actualBoundingBoxDescent),P=2,I=v.actualBoundingBoxLeft+P,E=v.actualBoundingBoxAscent+P;T+=P+P,w+=P+P,h=new OffscreenCanvas(T,w),x=h.getContext("2d"),x.font=_,x.fillStyle=g,x.fillText(i,I,E);var F=1/p;return{type:"bitmap",bitmap:h.transferToImageBitmap(),matrix:[F,0,0,F,-T*F/2,-w*F/2]}}t.exports=function(){return s().apply(this,arguments)},t.exports.reset=function(){s().reset()},t.exports.create=Ye,t.exports.shapeFromPath=d,t.exports.shapeFromText=u})((function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}})(),Rt,!1);var $i=Rt.exports,eo=Rt.exports.create;var gt=class{static DEFAULTS={scalar:1.4,zIndex:1e4,shapes:["circle","circle","square"],colors:["#f51c8f","#2179e2","#d52dc8","#01a9d9","#78ff44","#fdff6a"]};static async basic(){await this.fire({particleCount:100,spread:70,origin:{y:.6}})}static async leftRight(e=100){let t=[],r=Date.now()+2e3,a=()=>{t.push(this.fire({angle:60,spread:55,origin:{x:0}}),this.fire({angle:120,spread:55,origin:{x:1}})),Date.now()<r&&e>0&&(requestAnimationFrame(a),e--)};a(),await Promise.all(t)}static async realistic(){await Promise.all([this.realisticFire(.25,{spread:26,startVelocity:55}),this.realisticFire(.2,{spread:60}),this.realisticFire(.35,{spread:100,decay:.91,scalar:.8}),this.realisticFire(.1,{spread:120,startVelocity:25,decay:.92,scalar:1.2}),this.realisticFire(.1,{spread:120,startVelocity:45})])}static async fire(e){Object.assign(e,this.DEFAULTS,e),e.particleCount=e.particleCount??this.DEFAULTS.colors.length,await $i(e)}static async realisticFire(e,t){let a={origin:{y:.7}};await this.fire(Object.assign({},a,t,{particleCount:Math.floor(200*e)}))}};var an=(o,e)=>e.minValue;function sn(o,e){if(o&1&&(Te(0,"div",7),me(1,"safeHtml")),o&2){let t=V().$implicit;ue("innerHTML",Ce(1,1,t.minValue+" Products"),ae)}}function ln(o,e){if(o&1&&(Te(0,"div",7),me(1,"cooeeCurrency"),me(2,"safeHtml")),o&2){let t=V().$implicit;ue("innerHTML",Ce(2,3,Ce(1,1,t.minValue)),ae)}}function cn(o,e){if(o&1&&(Ne(0,"li",6)(1,"div"),j(2,sn,2,3,"div",7)(3,ln,3,5,"div",7),Te(4,"img",8),Ne(5,"div",9),ce(6),Be()()()),o&2){let t=e.$implicit,r=V(2);Xe("left",t.calculatedAlignment+"%"),S(2),$((r.progressBarConfig==null?null:r.progressBarConfig.rewardBasis)===r.RewardBasis.ITEM_COUNT?2:3),S(2),ue("src",r.getIconURL(t),lt),S(2),ri(t.label)}}function dn(o,e){if(o&1&&(Te(0,"div",0),me(1,"cooeeDynamicVariables"),me(2,"safeHtml"),Ne(3,"div",1)(4,"ul",2)(5,"div",3),Te(6,"div",4),Be(),we(7,cn,7,5,"li",5,an),Be()()),o&2){let t=V(),r=t.calculatedState(),a=r.nextMilestone?r.nextMilestone.reachingText:r.lastMilestone.reachedText;ue("innerHTML",Ce(2,6,li(1,3,a,t.localDynamicVariables())),ae),S(6),Xe("width",r.cartValuePercentage+"%"),S(),Ve(r.milestones)}}var ht=class o extends fe{cart;localDynamicVariables=_e({});calculatedState=_e({});progressBarConfig;RewardBasis=Ft;constructor(){super()}engagementTriggerReceived(e){this.progressBarConfig=e.progressBarConfig}ngOnInit(){super.ngOnInit(),this.calculateMilestonesSilently()}update(){this.calculateMilestonesSilently()}getIconURL(e){return e.rewardType===dt.FREE_SHIPPING?"https://img.icons8.com/ios-filled/50/FFFFFF/free-shipping.png":e.rewardType===dt.DISCOUNT?"https://img.icons8.com/ios-glyphs/30/FFFFFF/sale-price-tag.png":e.rewardType===dt.FREE_AUTO_GIFT?"https://img.icons8.com/ios-filled/50/FFFFFF/gift--v1.png":""}calculateMilestonesSilently(){this.calculateMilestones().catch(e=>Y.error(e))}async calculateMilestones(){let e=this.engagementTrigger,t=this.progressBarConfig;if(!t?.milestones?.length){Y.warn("Milestones not available in progress bar config",e);return}let r=await this.cart.getNormalisedCart(),a=t.milestones.at(-1),c=t?.reachedAmountOrCount??r.originalAmount,f=t.totalProgress??0;Y.verbose("Cart value:",c,`, percentage: ${f}%`),this.celebrate(e,c);let m={milestonesReady:!0,cartValuePercentage:f,milestones:t.milestones},b=t.milestones.find(A=>!A.reached);if(b){let A=Ue(b.minValue-c);if(t.rewardBasis==="ITEM_COUNT"){let Q=b.minValue-c;A=`${Q} ${Q===1?"product":"products"}`}this.localDynamicVariables.set({amount_left:A}),m.nextMilestone=b,this.calculatedState.set(m);return}m.lastMilestone=a,this.calculatedState.set(m)}celebrate(e,t){let c=[...e.progressBarConfig.milestones].reverse().find(b=>b.minValue<t);if(!c)return;let f=`lc/en/${e.shortID}/${c.minValue}`;sessionStorage.getItem(f)||(sessionStorage.setItem(f,"1"),this.progressBarConfig?.noConfetti||gt.realistic())}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=z({type:o,selectors:[["cooee-progressbar"]],inputs:{cart:"cart"},features:[ne(oe()),U],decls:1,vars:1,consts:[[1,"heading",3,"innerHTML"],[1,"milestone-container"],[1,"milestone-list"],[1,"untracked-path"],[1,"tracked-path"],[1,"milestone-list-item",3,"left"],[1,"milestone-list-item"],[1,"milestone-value",3,"innerHTML"],["width","20","height","20","alt","milestone icon",1,"milestone-icon",3,"src"],[1,"milestone-label"]],template:function(t,r){t&1&&j(0,dn,9,8),t&2&&$(r.calculatedState().milestonesReady?0:-1)},dependencies:[ft,qe,bi],styles:[`:host{display:block;padding:10px;background:linear-gradient(0deg,rgba(var(--lc-primary-color),.1) 0%,transparent 100%)}.milestone-container{width:95%;margin:8px 0}.heading{font-weight:500;text-align:center;font-size:12px}.milestone-list{display:flex;align-items:center;position:relative;font-size:10px;font-weight:500}.untracked-path{width:100%;background-color:#e5e7eb;height:4px;position:absolute}.tracked-path{background-color:rgba(var(--lc-primary-color));height:100%;display:block;transition:width .5s ease-in-out}.milestone-list{padding:0;margin:0}.milestone-list-item{position:relative;display:flex;flex-direction:column;align-items:center;height:75px}.milestone-list-item>div{display:flex;flex-direction:column;align-items:center;justify-content:space-between;position:absolute;height:100%;width:100px}.milestone-icon{padding:5px;border-radius:1000px;background-color:rgba(var(--lc-primary-color))}
12
- `],encapsulation:3})};var pn=["numberVariable"],vt=class o extends fe{numberSlot;savingsBarConfig;textParts=_e({start:"",end:""});globalIntervals=[];constructor(){super()}ngAfterViewInit(){this.updateUIVars()}engagementTriggerReceived(e){this.savingsBarConfig=e.content.savingsBarConfig,this.elementRef.nativeElement.classList.add("lc_"+e.entryAnimation?.toLowerCase()),this.savingsBarConfig.iconURL&&this.elementRef.nativeElement.style.setProperty("--lc-discount-icon",this.savingsBarConfig.iconURL)}update(){this.updateUIVars()}updateUIVars(){let e=ye(ye({},this.engagementTrigger.getCartMagicVariables()),xi("total_savings",this.savingsBarConfig.totalSavings)),t=We(this.savingsBarConfig.text,{cart:e},this.triggerContext),r=t.match(/[\d.,]+/)?.[0];if(!r){Y.error("No amount found in text",t);return}let[a,c]=t.split(r);this.textParts.set({start:a,end:c}),this.savingsBarConfig.animateNumber?this.runAnimation(r):this.numberSlot.nativeElement.innerHTML=r}runSlotMachineAnimation(e="0"){let t=this.numberSlot.nativeElement;t.innerHTML="";let r=this.savingsBarConfig.animationDuration/e.length;this.clearPreviousIntervals();for(let a=0;a<e.length;a++){let c=document.createElement("div");c.className="digit",c.style.display="inline-block",t.appendChild(c);let f=setInterval(()=>{let m=Math.floor(Math.random()*10);c.innerHTML=`<div>${m}</div>`},50);this.globalIntervals.push(f),setTimeout(()=>{clearInterval(f);let m=e?.[a]??Math.floor(Math.random()*10);c.innerHTML=`${m}`},(a+1)*r)}}clearPreviousIntervals(){this.globalIntervals.forEach(clearInterval),this.globalIntervals=[]}runIncrementalAnimation(e){let t=performance.now(),r=a=>{let c=Math.min((a-t)/this.savingsBarConfig.animationDuration,1);this.numberSlot.nativeElement.innerHTML=Math.floor(e*c).toString(),c<1&&requestAnimationFrame(r)};requestAnimationFrame(r)}runAnimation(e){this.savingsBarConfig.animation==="SLOT_MACHINE"?this.runSlotMachineAnimation(e):this.savingsBarConfig.animation==="INCREMENTAL"&&this.runIncrementalAnimation(Number(e))}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=z({type:o,selectors:[["cooee-savings-bar"]],viewQuery:function(t,r){if(t&1&&He(pn,5),t&2){let a;je(a=$e())&&(r.numberSlot=a.first)}},features:[U],decls:6,vars:2,consts:[["numberVariable",""],[1,"container"],[1,"icon"],[1,"primary-text",3,"innerHTML"],[1,"counter-text"],[1,"final-text",3,"innerHTML"]],template:function(t,r){t&1&&(Ne(0,"div",1),Te(1,"div",2)(2,"div",3)(3,"div",4,0)(5,"div",5),Be()),t&2&&(S(2),ue("innerHTML",r.textParts().start,ae),S(3),ue("innerHTML",r.textParts().end,ae))},styles:[`:host{display:block}.container{white-space:pre;display:flex;justify-content:center;align-items:center;background-color:rgba(var(--lc-primary-button-bg-color, 0 162 81));color:rgba(var(--lc-primary-button-color, 255 255 255));padding:8px;border-radius:4px 4px 0 0;overflow:hidden}.container .icon{background-image:var(--lc-discount-icon, url(https://img.icons8.com/ios-glyphs/30/FFFFFF/discount--v1.png));background-position:center;background-size:cover;height:20px;width:20px;margin-right:2px}
13
- `],encapsulation:3})};var yt=class o extends fe{item;data=re(wi);dialogRef=re(_i);ItemDetailLayout=Vi;constructor(){super(),this.triggerContext=this.data.triggerContext,this.item=this.data.item}close(){this.dialogRef.close()}engagementTriggerReceived(e){}update(){}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=z({type:o,selectors:[["cooee-item-quick-view"]],features:[ne(oe()),U],decls:1,vars:2,consts:[[3,"closeClick","item","layout"]],template:function(t,r){t&1&&(k(0,"cooee-item-detail",0),H("closeClick",function(){return r.close()}),D()),t&2&&B("item",r.item)("layout",r.ItemDetailLayout.TWO_PANE)},dependencies:[Pi],styles:[`:host{display:flex;align-items:center;justify-content:center;height:100%}@media (min-width: 768px){cooee-item-detail{max-width:900px;max-height:80vh;border-radius:var(--lc-card-radius)}}
14
- `],encapsulation:3})};var Ct=class o{dialog=re(pt);dialogRef;constructor(){}showItemQuickView(e,t){this.dialogRef=this.dialog.open(yt,{width:"100vw",height:"100dvh",backdropClass:["letscooee-backdrop"],data:{item:t,triggerContext:e}})}static \u0275fac=function(t){return new(t||o)};static \u0275prov=jt({token:o,factory:o.\u0275fac,providedIn:"root"})};var un=(o,e)=>({enter:o,exit:e});function mn(o,e){if(o&1&&(k(0,"div",7),ce(1),D(),k(2,"div",8),ce(3),D()),o&2){let t=V(2);S(),ze(" ",t.getCurrency(t.selectedVariant().price.cmp)," "),S(2),ze(" ",t.getDiscountPercentage(t.selectedVariant().price),"% off ")}}function fn(o,e){if(o&1&&(k(0,"div",6),ce(1),D()),o&2){let t=V(2);S(),ze(" ",t.stickyATCConfig.leftText," ")}}function gn(o,e){if(o&1&&(k(0,"div",1)(1,"div",5),ce(2),D(),j(3,mn,4,2),j(4,fn,2,1,"div",6),D()),o&2){let t=V();S(2),ze(" ",t.getCurrency(t.selectedVariant().price.d)," "),S(),$(t.selectedVariant().price.cmp?3:-1),S(),$(t.stickyATCConfig.leftText?4:-1)}}function hn(o,e){if(o&1&&(k(0,"div",9),ce(1),D()),o&2){let t=e.$implicit,r=e.$index;V(2);let a=ie(5);B("ngClass",si(2,un,r===a.currentIndex,r===a.previousIndex)),S(),ze(" ",t," ")}}function vn(o,e){if(o&1&&(k(0,"div",4),we(1,hn,2,5,"div",9,ti),D()),o&2){V();let t=ie(5);S(),Ve(t.features)}}var xt=class o extends fe{currentItem;stickyATCConfig;selectedVariant=_e(void 0);featureSlider=_e({features:[],currentIndex:0});constructor(){super()}onVariantChange(e){this.currentItem&&(this.currentItem.setSelectedVariantByID(e.detail.variantID),this.selectedVariant.set(this.currentItem.selectedOrFirstVariant.value))}engagementTriggerReceived(e){this.stickyATCConfig=e.stickyATCConfig??{},this.currentItem=e.items[0],this.selectedVariant.set(this.currentItem.vars[0]),this.stickyATCConfig.leftText=this.replaceVariables(this.stickyATCConfig.leftText),this.stickyATCConfig.rightText=this.replaceVariables(this.stickyATCConfig.rightText),this.startFeatureRotation()}update(){}getCurrency(e){return Ue(e)}getDiscountPercentage(e){return((e.cmp-e.d)/e.cmp*100).toFixed(0)}addToCart(){this.engagementService.executeCTA(tt.ADD_TO_CART,{item:this.currentItem})}startFeatureRotation(){if(!this.stickyATCConfig.rightText)return;let e=this.stickyATCConfig.rightText.split(`
15
- `),t=e.length===1?null:setInterval(()=>{this.featureSlider.update(r=>Ot(ye({},r),{previousIndex:r.currentIndex,currentIndex:(r.currentIndex+1)%r.features.length}))},3e3);this.featureSlider.set({intervalRef:t,currentIndex:0,features:e})}replaceVariables(e){return e?We(e,this.currentItem.getTemplateVariables(),this.triggerContext):""}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=z({type:o,selectors:[["cooee-sticky-atc"]],hostBindings:function(t,r){t&1&&H("letscooee:variant-change",function(c){return r.onVariantChange(c)},Zt)},features:[ne(oe()),U],decls:7,vars:3,consts:[[1,"lc-wrapper"],[1,"lc-prices"],[1,"lc-button-wrapper"],["type","button",1,"lc-button","lc-button-atc",3,"click"],[1,"lc-features"],[1,"lc-sale-price"],[1,"lc-additional-text"],[1,"lc-compare-price"],[1,"lc-discount-label"],[1,"lc-feature",3,"ngClass"]],template:function(t,r){if(t&1){let a=te();k(0,"div",0),j(1,gn,5,3,"div",1),k(2,"div",2)(3,"button",3),H("click",function(){return O(a),L(r.addToCart())}),ce(4,"Add To Cart"),D(),et(5),j(6,vn,3,0,"div",4),D()()}if(t&2){S(),$(r.selectedVariant()&&r.stickyATCConfig.showProductInfo?1:-1),S(4);let a=Ee(r.featureSlider());S(),$(a.features.length?6:-1)}},dependencies:[ct],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%}.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:#000;color:#fff;opacity:1;pointer-events:auto;border-radius:4px;min-width:150px;width:100%;padding:8px}.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}
16
- `],encapsulation:3})};var Cn=["videoEl"];async function zi(){return(await import("./video-detail-dialog.component-CVYCZT7U.js")).VideoDetailDialogComponent}var Ie=class o extends fe{videoElements;videos;videoConfig;dialogRef=null;dialog=re(pt);isMobile=Ei();pausedVideos=[];videoLoadingStates=new Map;intersectionObserver;visibleVideos=new Set;constructor(){super(),zi()}ngAfterViewInit(){this.checkAndOpenVideoFromUrl()}ngOnDestroy(){super.ngOnDestroy(),this.intersectionObserver?.disconnect()}engagementTriggerReceived(e){this.videoConfig=e.content?.videoConfig,this.videos=this.videoConfig.videos}onMuteToggled(e,t){e||this.videoElements.forEach(r=>{r.nativeElement!==t&&(r.nativeElement.muted=!0,r.nativeElement.pause())})}sendTriggerClicked(e,t){this.sendEvent("CE Trigger Clicked",{},e,t)}async onVideoTap(e,t,r,a,c){e?.stopPropagation(),e?.preventDefault();let f=t.items?.[0];if(this.sendTriggerClicked(t,f),this.videoConfig.footerContent==="NONE"){a&&(a.muted=!1,a.play(),this.onMuteToggled(!1,a));return}await this.openDialog(t,r,c)}sendEvent(e,t,r,a){let c=new gi(e,t,this.engagementTrigger);c.setVideos(r),a&&(c.items=[a.toEmbed()]),window.CooeeSDK.sendEvent(c)}onDialogClosed(){this.resumePlaylistVideos()}isVideoLoading(e){return this.videoLoadingStates.get(e)??!0}onVideoLoadStart(e){this.videoLoadingStates.set(e,!0)}onVideoCanPlay(e){this.videoLoadingStates.set(e,!1)}playVideo(e){e.play().catch(t=>{Y.error("Failed to play video:",t)})}setupIntersectionObserver(e=.5,t="50px"){this.intersectionObserver=new IntersectionObserver(r=>{r.forEach(a=>{let c=a.target,f=c.dataset.videoId;f&&(a.isIntersecting?(this.visibleVideos.add(f),this.handleVideoVisibilityChange(c,!0)):(this.visibleVideos.delete(f),this.handleVideoVisibilityChange(c,!1)))})},{threshold:e,rootMargin:t}),setTimeout(()=>{this.videoElements.forEach(r=>{this.intersectionObserver?.observe(r.nativeElement)})},100)}handleVideoVisibilityChange(e,t){t?this.onVideoBecameVisible(e):e.pause()}onVideoBecameVisible(e){this.playVideo(e)}pauseAllPlaylistVideos(){this.pausedVideos=[],this.videoElements.forEach(e=>{let t=e.nativeElement;t.paused||(this.pausedVideos.push(t),t.pause())})}resumePlaylistVideos(){this.pausedVideos.forEach(e=>{e.play().catch(()=>{})}),this.pausedVideos=[]}async checkAndOpenVideoFromUrl(){let e=Ai();if(!e||!this.videos)return;let t=Di();if(t.utm_campaign?.toLowerCase()!=="shoppable_video"||t.utm_source?.toLowerCase()!==ki)return;let r=this.videos.findIndex(a=>a.shortID===+e);if(r!==-1){let a=this.videos[r];await yi.set("muted",!0),await this.openDialog(a,r)}}async openDialog(e,t,r){await fi();let a={videos:this.videos,currentIndex:t,triggerContext:this.triggerContext,selectedItem:r};this.dialogRef&&this.dialogRef.close(),this.pauseAllPlaylistVideos();let c=await zi();this.dialogRef=this.dialog.open(c,{width:"100vw",height:"100vh",data:a,providers:hi(this.triggerContext,{video:e,index:t}),disableClose:!0});let f={videoID:e.id,videoIndex:t};this.sendEvent("CE Video Dialog Opened",{current:f},e),this.dialogRef.closed.subscribe(m=>{if(this.dialogRef=null,!m)return;let b=m.lastVideoDuration*1e3,A={videoID:m.lastVideo.id,videoIndex:m.lastVideoIndex,playedTillMS:b,playedTillPercent:b/m.lastVideo.durationMS};this.sendEvent("CE Video Dialog Closed",{current:A},m.lastVideo),this.onDialogClosed()})}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=z({type:o,selectors:[["cooee-abstract-video"]],viewQuery:function(t,r){if(t&1&&He(Cn,5),t&2){let a;je(a=$e())&&(r.videoElements=a)}},features:[U],decls:0,vars:0,template:function(t,r){},encapsulation:2})};var Se=class o{video=St.required({alias:"cooeeVideoSources"});prioritySource=St("high");elementRef=re(Wt);constructor(){di(()=>{this.updateSources()})}updateSources(){let e=this.elementRef.nativeElement,t=this.video(),r=this.prioritySource();e.querySelectorAll("source").forEach(c=>c.remove()),r==="best"?(this.addSource(t.bestSource),this.addSource(t.highSource),this.addSource(t.lowSource)):r==="low"?(this.addSource(t.lowSource),this.addSource(t.highSource),this.addSource(t.bestSource)):(this.addSource(t.highSource),this.addSource(t.bestSource),this.addSource(t.lowSource)),this.addSource(t.m3u8Source),e.load()}addSource(e){if(!e)return;let t=document.createElement("source");t.src=e.url,t.type=e.mimeType,this.elementRef.nativeElement.appendChild(t)}static \u0275fac=function(t){return new(t||o)};static \u0275dir=Jt({type:o,selectors:[["video","cooeeVideoSources",""]],inputs:{video:[1,"cooeeVideoSources","video"],prioritySource:[1,"prioritySource"]}})};var xn=(o,e)=>e.id;function bn(o,e){if(o&1&&(se(0,"div",1),me(1,"safeHtml")),o&2){let t=V();B("innerHTML",Ce(1,1,t.videoConfig.heading),ae)}}function _n(o,e){o&1&&(k(0,"div",6),se(1,"div",12),D())}function wn(o,e){if(o&1){let t=te();k(0,"cooee-mute-toggle",13),H("toggled",function(a){O(t),V();let c=le(6),f=V();return L(f.onMuteToggled(a,c))}),D()}if(o&2){V();let t=le(6);B("muted",t.muted)("videoEl",t)}}function Vn(o,e){if(o&1){let t=te();k(0,"cooee-video-promoted-items",16),H("cardClick",function(a){O(t);let c=V(2),f=c.$implicit,m=c.$index,b=le(6),A=V();return L(A.onItemCardClick(a,f,m,b))}),D()}if(o&2){let t=V(2).$implicit;B("items",t.items)("centeredSlides",!1)}}function Tn(o,e){if(o&1){let t=te();k(0,"cooee-item-card",17),H("buttonClick",function(){O(t);let a=V(2),c=a.$implicit,f=a.$index,m=le(6),b=V();return L(b.addToCartClicked(null,c,f,m))})("click",function(){O(t);let a=V(2),c=a.$implicit,f=a.$index,m=le(6),b=ie(0),A=V();return L(A.onItemCardClick(b,c,f,m))}),D()}if(o&2){V(2);let t=ie(0);B("item",t)}}function En(o,e){if(o&1&&j(0,Vn,1,2,"cooee-video-promoted-items",14)(1,Tn,1,1,"cooee-item-card",15),o&2){let t=V().$implicit,r=V(),c=ie(2)===r.VideoConfigFooterContent.ITEM_SWIPER;$(c&&t.items.length>1?0:t.items.length?1:-1)}}function In(o,e){if(o&1){let t=te();k(0,"cooee-video-card",18),H("linkClicked",function(){O(t);let a=V().$implicit,c=V();return L(c.sendTriggerClicked(a))}),D()}if(o&2){V();let t=ie(1);B("card",t)}}function Sn(o,e){if(o&1){let t=te();et(0)(1),k(2,"div",4)(3,"div",5),H("click",function(a){let c=O(t),f=c.$implicit,m=c.$index,b=le(6),A=V();return L(A.onVideoTap(a,f,m,b))})("keydown.enter",function(a){let c=O(t),f=c.$implicit,m=c.$index,b=le(6),A=V();return L(A.onVideoTap(a,f,m,b))})("keydown.space",function(a){let c=O(t),f=c.$implicit,m=c.$index,b=le(6),A=V();return L(A.onVideoTap(a,f,m,b))}),j(4,_n,2,0,"div",6),k(5,"video",7,0),H("mouseenter",function(){O(t);let a=le(6);V();let c=ie(1);return L(c&&a.play())})("mouseleave",function(){O(t);let a=le(6);V();let c=ie(1);return L(c&&a.pause())})("loadstart",function(){let a=O(t).$implicit,c=V();return L(c.onVideoLoadStart(a.id))})("canplay",function(){let a=O(t).$implicit,c=V();return L(c.onVideoCanPlay(a.id))}),D(),k(7,"div",8),j(8,wn,1,2,"cooee-mute-toggle",9),D()(),k(9,"div",10),j(10,En,2,1)(11,In,1,1,"cooee-video-card",11),D()()}if(o&2){let t=e.$implicit,r=V(),a=ie(0),c=ie(2);Ee(t.items[0]),S();let m=Ee(t.card)&&c===r.VideoConfigFooterContent.CARD;S(2),Xe("background-image",t.thumbnail?"url("+t.thumbnail+")":null),S(),$(r.isVideoLoading(t.id)?4:-1),S(),B("cooeeVideoSources",t)("muted",!0),Ke("preload",a?"metadata":"none")("autoplay",null)("data-video-id",t.id),S(3),$(r.videoConfig.showMuteButton?8:-1),S(2),$(r.videoConfig.showItems()?10:m?11:-1)}}var bt=class o extends Ie{VideoConfigFooterContent=Mt;VideoConfigAutoPlay=Mi;swiperOptions=null;constructor(){super(),this.hasSwiper=!0}ngAfterViewInit(){super.ngAfterViewInit();let e=this.videoConfig.playlistConfig.videoSwiper,t=e?(this.isMobile?e.gapSm:e.gap)+"px":window.cooeePlaylistGap??24,r=e?this.isMobile?e.maxInRowSm:e.maxInRow:"auto";this.swiperOptions={direction:"horizontal",effect:"slide",loop:e?.loop,freeMode:!0,spaceBetween:t,slidesPerView:r,mousewheel:{enabled:!0,forceToAxis:!0},autoplay:e?.autoplay?.enabled?{delay:e?.autoplay?.delay,disableOnInteraction:!1}:!1},this.setupIntersectionObserver(),this.playFirstVideo()}ngOnDestroy(){super.ngOnDestroy()}addToCartClicked(e,t,r,a){let c=t.items?.[0],f=mi.get().website?.canChangeVariantInCart;if(t.items?.length>1||c?.hasVariants()&&!f){this.onItemCardClick(c,t,r,a);return}this.engagementService.executeCTA(tt.ADD_TO_CART,{item:c,video:t})}goToPDP(e,t){e?.stopPropagation(),e?.preventDefault();let r=t.items?.[0];this.engagementService.executeCTA(tt.GO_TO_PRODUCT,{item:r,video:t})}onItemCardClick(e,t,r,a){this.videoConfig.playlistConfig.itemCardClickBehavior==="OPEN_ITEM_DETAIL"?this.onVideoTap(null,t,r,a,e):this.onVideoTap(null,t,r,a)}update(){}onVideoBecameVisible(e){this.shouldAutoPlay()&&(this.dialogRef?this.pausedVideos.push(e):this.playVideo(e))}shouldAutoPlay(){return this.videoConfig.autoPlay==="ON"||this.videoConfig.autoPlay==="ON_HOVER"&&this.isMobile}playFirstVideo(){}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=z({type:o,selectors:[["cooee-video-playlist"]],features:[ne(oe()),U],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(t,r){if(t&1&&(et(0)(1)(2),j(3,bn,2,3,"div",1),k(4,"cooee-swiper",2),ii(5,3),we(6,Sn,12,12,"div",4,xn),ni(),D()),t&2){Ee(!r.videoConfig.autoPlay||r.videoConfig.autoPlay===r.VideoConfigAutoPlay.ON),S(),Ee(r.videoConfig.autoPlay===r.VideoConfigAutoPlay.ON_HOVER),S(),Ee(r.videoConfig.footerContent),S(),$(r.videoConfig.heading?3:-1);let a=r.videoConfig.playlistConfig.videoSwiper;S(),B("options",r.swiperOptions)("navigationConfig",a==null?null:a.navigation)("paginationConfig",a==null?null:a.pagination),S(2),Ve(r.videos)}},dependencies:[Oi,Ri,Fi,Si,Se,Li,qe],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)}
17
- `],encapsulation:3})};var Mn=["videoElement"],Pn=o=>({"cursor-grab":o}),_t=class o extends Ie{videoElement;video;isDragging=!1;hidden=!1;cdkDrag=re(ut,{self:!0});untilDestroyed=Ti();constructor(){super()}get popupClasses(){return this.hidden?["hidden"]:["visible"]}onClick(e){e.stopPropagation(),e.preventDefault(),this.onVideoClick()}ngOnInit(){super.ngOnInit();let e=this.elementRef.nativeElement.closest(".letscooee-engagement");e&&(e.style.zIndex="10000"),this.cdkDrag.moved.pipe(this.untilDestroyed).subscribe(()=>this.isDragging=!0)}ngAfterViewInit(){super.ngAfterViewInit(),setTimeout(()=>{this.autoPlay()},100)}onVideoClick(){if(this.isDragging){this.isDragging=!1;return}this.hidden=!0,this.onVideoTap(null,this.video,0)}close(){this.hidden=!0;let e=(new Date().getTime()-this.triggerContext.startTime.getTime())/1e3;this.sendEvent("CE Trigger Closed",{duration:e})}engagementTriggerReceived(e){super.engagementTriggerReceived(e),this.video=this.videos[0]}update(){}onDialogClosed(){this.hidden=!1}autoPlay(){let e=this.videoElement.nativeElement;this.hidden||this.playVideo(e)}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=z({type:o,selectors:[["cooee-video-popup"]],viewQuery:function(t,r){if(t&1&&He(Mn,5),t&2){let a;je(a=$e())&&(r.videoElement=a.first)}},hostAttrs:["role","button","tabindex","0","aria-label","Open video popup "],hostVars:3,hostBindings:function(t,r){t&1&&H("keydown.enter",function(c){return r.onClick(c)})("keydown.space",function(c){return r.onClick(c)})("click",function(c){return r.onClick(c)}),t&2&&(ue("cdkDragBoundary","body"),oi(r.popupClasses))},features:[ne(oe()),Kt([{directive:ut,inputs:["cdkDragBoundary","cdkDragBoundary"]}]),U],decls:9,vars:5,consts:[["videoElement",""],[1,"popup-inner",3,"ngClass"],["type","button","aria-label","Close video popup",1,"close-button",3,"click"],["name","close","aria-hidden","true"],[1,"play-button"],["name","unmute","aria-hidden","true"],[1,"text"],["loop","","preload","metadata","playsinline","",3,"muted","cooeeVideoSources"]],template:function(t,r){if(t&1){let a=te();k(0,"div",1)(1,"button",2),H("click",function(f){return O(a),f.stopPropagation(),L(r.close())}),se(2,"cooee-icon",3),D(),k(3,"div",4),se(4,"cooee-icon",5),k(5,"div",6),ce(6,"Tap to unmute"),D()(),se(7,"video",7,0),D()}t&2&&(B("ngClass",ai(3,Pn,r.isDragging)),S(7),B("muted",!0)("cooeeVideoSources",r.video))},dependencies:[ct,Ii,Se],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}
18
- `],encapsulation:3})};var kn=(o,e)=>e.id;function Dn(o,e){if(o&1&&(se(0,"div",1),me(1,"safeHtml")),o&2){let t=V();B("innerHTML",Ce(1,1,t.videoConfig.heading),ae)}}function An(o,e){o&1&&(k(0,"div",9),se(1,"div",11),D())}function Fn(o,e){if(o&1){let t=te();k(0,"div",4),H("click",function(a){let c=O(t),f=c.$implicit,m=c.$index,b=V();return L(b.onVideoTap(a,f,m))})("keydown.enter",function(a){let c=O(t),f=c.$implicit,m=c.$index,b=V();return L(b.onVideoTap(a,f,m))})("keydown.space",function(a){let c=O(t),f=c.$implicit,m=c.$index,b=V();return L(b.onVideoTap(a,f,m))}),$t(),k(1,"svg",5),se(2,"circle",6)(3,"circle",7),D(),zt(),k(4,"div",8),j(5,An,2,0,"div",9),k(6,"video",10,0),H("loadstart",function(){let a=O(t).$implicit,c=V();return L(c.onVideoLoadStart(a.id))})("canplay",function(){let a=O(t).$implicit,c=V();return L(c.onVideoCanPlay(a.id))}),D()()()}if(o&2){let t=e.$implicit,r=e.$index,a=V();Ke("aria-label","Open video story "+(r+1)),S(5),$(a.isVideoLoading(t.id)?5:-1),S(),B("poster",t.thumbnail,lt)("cooeeVideoSources",t)("prioritySource","low")("muted",!0),Ke("data-video-id",t.id)}}var wt=class o extends Ie{constructor(){super()}ngAfterViewInit(){super.ngAfterViewInit(),this.setupIntersectionObserver()}ngOnDestroy(){super.ngOnDestroy()}update(){}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=z({type:o,selectors:[["cooee-video-stories"]],features:[ne(oe()),U],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,"loading-spinner"]],template:function(t,r){t&1&&(j(0,Dn,2,3,"div",1),k(1,"div",2),we(2,Fn,8,7,"div",3,kn),D()),t&2&&($(r.videoConfig.heading?0:-1),S(2),Ve(r.videos))},dependencies:[Se,qe],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;height:5rem;cursor:pointer;flex-shrink:0}.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}
19
- `],encapsulation:3})};ui("CooeeWidgetSDK");(async()=>{let o=await pi(Bi),e=(t,r)=>{let a=Ni(t,{injector:o.injector});customElements.define(r,a)};e(xt,"cooee-sticky-atc"),e(vt,"cooee-savings-bar"),e(ht,"cooee-progressbar"),e(bt,"cooee-video-playlist"),e(_t,"cooee-video-popup"),e(wt,"cooee-video-stories"),e(vi,"cooee-product-options-picker"),sessionStorage.cooeeDebug&&import("./debugger.component-YTNEZCLF.js").then(t=>{e(t.DebuggerComponent,"cooee-debugger")}),window.cooeeShowQuickItem=(t,r)=>{o.injector.get(Ct).showItemQuickView(t,r)}})();
10
+ `+Ze(s,u)):i}}function Me(s,l){var d;return l.cache&&l.name&&l.storage.templates.get(l.name)?l.storage.templates.get(l.name):(d=typeof s=="function"?s:Ye(s,l),l.cache&&l.name&&l.storage.templates.define(l.name,d),d)}Re.l.bind(Re),o.compile=Ye,o.compileScope=K,o.compileScopeIntoFunction=Ge,o.compileToString=Ze,o.defaultConfig=Re,o.filters=at,o.getConfig=Je,o.helpers=ot,o.nativeHelpers=rt,o.parse=it,o.render=function(s,l,d,u){var n=Je(d||{});if(!n.async)return Me(s,n)(l,n);if(!u){if(typeof r=="function")return new r(function(i,p){try{i(Me(s,n)(l,n))}catch(g){p(g)}});throw e("Please provide a callback function, this env doesn't support Promises")}try{Me(s,n)(l,n,u)}catch(i){return u(i)}},o.templates=nt,Object.defineProperty(o,"__esModule",{value:!0})})});var Zi={schedule(o,e){let t=setTimeout(o,e);return()=>clearTimeout(t)}};function Qi(o){return o.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function Gi(o){return!!o&&o.nodeType===Node.ELEMENT_NODE}var Pt;function Ji(o,e){if(!Pt){let t=Element.prototype;Pt=t.matches||t.matchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector}return o.nodeType===Node.ELEMENT_NODE?Pt.call(o,e):!1}function Yi(o){let e={};return o.forEach(({propName:t,templateName:r,transform:a})=>{e[Qi(r)]=[t,a]}),e}function Ki(o,e){return e.get(It).resolveComponentFactory(o).inputs}function Xi(o,e){let t=o.childNodes,r=e.map(()=>[]),a=-1;e.some((c,f)=>c==="*"?(a=f,!0):!1);for(let c=0,f=t.length;c<f;++c){let m=t[c],x=en(m,e,a);x!==-1&&r[x].push(m)}return r}function en(o,e,t){let r=t;return Gi(o)&&e.some((a,c)=>a!=="*"&&Ji(o,a)?(r=c,!0):!1),r}var tn=10,kt=class{componentFactory;inputMap=new Map;constructor(e,t){this.componentFactory=t.get(It).resolveComponentFactory(e);for(let r of this.componentFactory.inputs)this.inputMap.set(r.propName,r.templateName)}create(e){return new Dt(this.componentFactory,e,this.inputMap)}},Dt=class{componentFactory;injector;inputMap;eventEmitters=new Lt(1);events=this.eventEmitters.pipe(Ht(e=>Bt(...e)));componentRef=null;scheduledDestroyFn=null;initialInputValues=new Map;ngZone;elementZone;appRef;cdScheduler;constructor(e,t,r){this.componentFactory=e,this.injector=t,this.inputMap=r,this.ngZone=this.injector.get(Xt),this.appRef=this.injector.get(ei),this.cdScheduler=t.get(qt),this.elementZone=typeof Zone>"u"?null:this.ngZone.run(()=>Zone.current)}connect(e){this.runInZone(()=>{if(this.scheduledDestroyFn!==null){this.scheduledDestroyFn(),this.scheduledDestroyFn=null;return}this.componentRef===null&&this.initializeComponent(e)})}disconnect(){this.runInZone(()=>{this.componentRef===null||this.scheduledDestroyFn!==null||(this.scheduledDestroyFn=Zi.schedule(()=>{this.componentRef!==null&&(this.componentRef.destroy(),this.componentRef=null)},tn))})}getInputValue(e){return this.runInZone(()=>this.componentRef===null?this.initialInputValues.get(e):this.componentRef.instance[e])}setInputValue(e,t){if(this.componentRef===null){this.initialInputValues.set(e,t);return}this.runInZone(()=>{this.componentRef.setInput(this.inputMap.get(e)??e,t),Qt(this.componentRef.hostView)&&(Gt(this.componentRef.changeDetectorRef),this.cdScheduler.notify(6))})}initializeComponent(e){let t=Ut.create({providers:[],parent:this.injector}),r=Xi(e,this.componentFactory.ngContentSelectors);this.componentRef=this.componentFactory.create(t,r,e),this.initializeInputs(),this.initializeOutputs(this.componentRef),this.appRef.attachView(this.componentRef.hostView),this.componentRef.hostView.detectChanges()}initializeInputs(){for(let[e,t]of this.initialInputValues)this.setInputValue(e,t);this.initialInputValues.clear()}initializeOutputs(e){let t=this.componentFactory.outputs.map(({propName:r,templateName:a})=>{let c=e.instance[r];return new Nt(f=>{let m=c.subscribe(x=>f.next({name:a,value:x}));return()=>m.unsubscribe()})});this.eventEmitters.next(t)}runInZone(e){return this.elementZone&&Zone.current!==this.elementZone?this.ngZone.run(e):e()}},At=class extends HTMLElement{ngElementEventsSubscription=null};function Li(o,e){let t=Ki(o,e.injector),r=e.strategyFactory||new kt(o,e.injector),a=Yi(t);class c extends At{injector;static observedAttributes=Object.keys(a);get ngElementStrategy(){if(!this._ngElementStrategy){let m=this._ngElementStrategy=r.create(this.injector||e.injector);t.forEach(({propName:x,transform:A})=>{if(!this.hasOwnProperty(x))return;let G=this[x];delete this[x],m.setInputValue(x,G,A)})}return this._ngElementStrategy}_ngElementStrategy;constructor(m){super(),this.injector=m}attributeChangedCallback(m,x,A,G){let[be,xe]=a[m];this.ngElementStrategy.setInputValue(be,A,xe)}connectedCallback(){let m=!1;this.ngElementStrategy.events&&(this.subscribeToEvents(),m=!0),this.ngElementStrategy.connect(this),m||this.subscribeToEvents()}disconnectedCallback(){this._ngElementStrategy&&this._ngElementStrategy.disconnect(),this.ngElementEventsSubscription&&(this.ngElementEventsSubscription.unsubscribe(),this.ngElementEventsSubscription=null)}subscribeToEvents(){this.ngElementEventsSubscription=this.ngElementStrategy.events.subscribe(m=>{let x=new CustomEvent(m.name,{detail:m.value});this.dispatchEvent(x)})}}return t.forEach(({propName:f,transform:m})=>{Object.defineProperty(c.prototype,f,{get(){return this.ngElementStrategy.getInputValue(f)},set(x){this.ngElementStrategy.setInputValue(f,x,m)},configurable:!0,enumerable:!0})}),c}var Bi={providers:[ci()]};var Ft=(t=>(t.CART_AMOUNT="CART_AMOUNT",t.ITEM_COUNT="ITEM_COUNT",t))(Ft||{});var W=Wi(ji());W.filters.define("default",function(o){return typeof o>"u"||o==null?"":on(o)});+W.filters.define("max",(o,e)=>{let t=Number(o),r=Number(e);return isNaN(t)||isNaN(r)?o:t>r?e:o});W.filters.define("min",(o,e)=>{let t=Number(o),r=Number(e);return isNaN(t)||isNaN(r)?o:t<r?e:o});W.filters.define("fallback",(o,e)=>o==null||o===""?e:o);W.filters.define("manipulate_quantity",(o,e,t)=>{if(e??=1,t??=100,e>t)return z.error("Invalid range: min should be less than or equal to max."),o;if(o>=e&&o<=t)return o;let r=o%t;return r<e?e:r});W.filters.define("apply_discount_perc",(o,e,t=1/0)=>{if(o=+o,isNaN(o))return z.error("Need value as a number for `apply_discount_perc` filter"),NaN;if(e<0||e>100)return z.error("Invalid percent value for `apply_discount_perc` filter. Must be between 0 and 100."),NaN;let r=o*e/100;return o-Math.min(t,r)});W.filters.define("apply_discount_fixed",(o,e)=>(o=+o,isNaN(o)?(z.error("Need value as a number for `apply_discount_fixed` filter"),NaN):Math.max(0,o-e)));W.filters.define("currency",o=>(o=+o,isNaN(o)?(z.error("Need value as a number for `currency` filter"),NaN):Ue(o)));W.filters.define("split",(o,e,t)=>{if(typeof o!="string")return z.error("Need value as a string for `split` filter"),"";if(e==null)return z.error("Need delimiter for `split` filter"),"";if(t==null||isNaN(Number(t)))return z.error("Need a valid index for `split` filter"),"";let r=o.split(String(e)),a=Number(t),c=a<0?r.length+a:a;return r[c].trim()??""});W.defaultConfig.defaultFilter="default";W.defaultConfig.useWith=!0;W.defaultConfig.autoEscape=!1;var nn={'"':"&quot;","\\":"&bsol;","\n":"\\n"};function on(o){return String(o).replace(/["\\\n]/g,e=>nn[e])}function rn(o){if(!o)return"";let e=/({{{\s*([^}]+?)\s*}}}|{{\s*&\s*([^}]+?)\s*}})/g;return o.replace(e,(t,r,a,c)=>`{{ ${(a||c||"").trim()} }}`)}var We=(o,e,t)=>{e=ye({discount:{},cart:{},product:{},bundle:{},variant:{},customer:{},svg:{},form:{},amount_left:null},e);try{return W.render(rn(o),e)}catch(r){throw Ci(r,"squirrelly-render",{extra:{template:o,values:e},triggerContext:t}),r}};var ft=class o{transform(e,t){return e?We(e,ye({},t)):null}static \u0275fac=function(t){return new(t||o)};static \u0275pipe=Yt({name:"cooeeDynamicVariables",type:o,pure:!0})};var Rt={};(function o(e,t,r,a){var c=!!(e.Worker&&e.Blob&&e.Promise&&e.OffscreenCanvas&&e.OffscreenCanvasRenderingContext2D&&e.HTMLCanvasElement&&e.HTMLCanvasElement.prototype.transferControlToOffscreen&&e.URL&&e.URL.createObjectURL),f=typeof Path2D=="function"&&typeof DOMMatrix=="function",m=(function(){if(!e.OffscreenCanvas)return!1;var n=new OffscreenCanvas(1,1),i=n.getContext("2d");i.fillRect(0,0,1,1);var p=n.transferToImageBitmap();try{i.createPattern(p,"no-repeat")}catch{return!1}return!0})();function x(){}function A(n){var i=t.exports.Promise,p=i!==void 0?i:e.Promise;return typeof p=="function"?new p(n):(n(x,x),null)}var G=(function(n,i){return{transform:function(p){if(n)return p;if(i.has(p))return i.get(p);var g=new OffscreenCanvas(p.width,p.height),y=g.getContext("2d");return y.drawImage(p,0,0),i.set(p,g),g},clear:function(){i.clear()}}})(m,new Map),be=(function(){var n=Math.floor(16.666666666666668),i,p,g={},y=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(i=function(C){var _=Math.random();return g[_]=requestAnimationFrame(function h(b){y===b||y+n-1<b?(y=b,delete g[_],C()):g[_]=requestAnimationFrame(h)}),_},p=function(C){g[C]&&cancelAnimationFrame(g[C])}):(i=function(C){return setTimeout(C,n)},p=function(C){return clearTimeout(C)}),{frame:i,cancel:p}})(),xe=(function(){var n,i,p={};function g(y){function C(_,h){y.postMessage({options:_||{},callback:h})}y.init=function(h){var b=h.transferControlToOffscreen();y.postMessage({canvas:b},[b])},y.fire=function(h,b,v){if(i)return C(h,null),i;var T=Math.random().toString(36).slice(2);return i=A(function(w){function P(I){I.data.callback===T&&(delete p[T],y.removeEventListener("message",P),i=null,G.clear(),v(),w())}y.addEventListener("message",P),C(h,T),p[T]=P.bind(null,{data:{callback:T}})}),i},y.reset=function(){y.postMessage({reset:!0});for(var h in p)p[h](),delete p[h]}}return function(){if(n)return n;if(!r&&c){var y=["var CONFETTI, SIZE = {}, module = {};","("+o.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {"," if (msg.data.options) {"," CONFETTI(msg.data.options).then(function () {"," if (msg.data.callback) {"," postMessage({ callback: msg.data.callback });"," }"," });"," } else if (msg.data.reset) {"," CONFETTI && CONFETTI.reset();"," } else if (msg.data.resize) {"," SIZE.width = msg.data.resize.width;"," SIZE.height = msg.data.resize.height;"," } else if (msg.data.canvas) {"," SIZE.width = msg.data.canvas.width;"," SIZE.height = msg.data.canvas.height;"," CONFETTI = module.exports.create(msg.data.canvas);"," }","}"].join(`
11
+ `);try{n=new Worker(URL.createObjectURL(new Blob([y])))}catch(C){return typeof console!==void 0&&typeof console.warn=="function"&&console.warn("\u{1F38A} Could not load worker",C),null}g(n)}return n}})(),it={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function Ze(n,i){return i?i(n):n}function Qe(n){return n!=null}function R(n,i,p){return Ze(n&&Qe(n[i])?n[i]:it[i],p)}function Vt(n){return n<0?0:Math.floor(n)}function Ge(n,i){return Math.floor(Math.random()*(i-n))+n}function K(n){return parseInt(n,16)}function Fe(n){return n.map(he)}function he(n){var i=String(n).replace(/[^0-9a-f]/gi,"");return i.length<6&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),{r:K(i.substring(0,2)),g:K(i.substring(2,4)),b:K(i.substring(4,6))}}function Tt(n){var i=R(n,"origin",Object);return i.x=R(i,"x",Number),i.y=R(i,"y",Number),i}function Et(n){n.width=document.documentElement.clientWidth,n.height=document.documentElement.clientHeight}function nt(n){var i=n.getBoundingClientRect();n.width=i.width,n.height=i.height}function ot(n){var i=document.createElement("canvas");return i.style.position="fixed",i.style.top="0px",i.style.left="0px",i.style.pointerEvents="none",i.style.zIndex=n,i}function rt(n,i,p,g,y,C,_,h,b){n.save(),n.translate(i,p),n.rotate(C),n.scale(g,y),n.arc(0,0,1,_,h,b),n.restore()}function at(n){var i=n.angle*(Math.PI/180),p=n.spread*(Math.PI/180);return{x:n.x,y:n.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:n.startVelocity*.5+Math.random()*n.startVelocity,angle2D:-i+(.5*p-Math.random()*p),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:n.color,shape:n.shape,tick:0,totalTicks:n.ticks,decay:n.decay,drift:n.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:n.gravity*3,ovalScalar:.6,scalar:n.scalar,flat:n.flat}}function Re(n,i){i.x+=Math.cos(i.angle2D)*i.velocity+i.drift,i.y+=Math.sin(i.angle2D)*i.velocity+i.gravity,i.velocity*=i.decay,i.flat?(i.wobble=0,i.wobbleX=i.x+10*i.scalar,i.wobbleY=i.y+10*i.scalar,i.tiltSin=0,i.tiltCos=0,i.random=1):(i.wobble+=i.wobbleSpeed,i.wobbleX=i.x+10*i.scalar*Math.cos(i.wobble),i.wobbleY=i.y+10*i.scalar*Math.sin(i.wobble),i.tiltAngle+=.1,i.tiltSin=Math.sin(i.tiltAngle),i.tiltCos=Math.cos(i.tiltAngle),i.random=Math.random()+2);var p=i.tick++/i.totalTicks,g=i.x+i.random*i.tiltCos,y=i.y+i.random*i.tiltSin,C=i.wobbleX+i.random*i.tiltCos,_=i.wobbleY+i.random*i.tiltSin;if(n.fillStyle="rgba("+i.color.r+", "+i.color.g+", "+i.color.b+", "+(1-p)+")",n.beginPath(),f&&i.shape.type==="path"&&typeof i.shape.path=="string"&&Array.isArray(i.shape.matrix))n.fill(l(i.shape.path,i.shape.matrix,i.x,i.y,Math.abs(C-g)*.1,Math.abs(_-y)*.1,Math.PI/10*i.wobble));else if(i.shape.type==="bitmap"){var h=Math.PI/10*i.wobble,b=Math.abs(C-g)*.1,v=Math.abs(_-y)*.1,T=i.shape.bitmap.width*i.scalar,w=i.shape.bitmap.height*i.scalar,P=new DOMMatrix([Math.cos(h)*b,Math.sin(h)*b,-Math.sin(h)*v,Math.cos(h)*v,i.x,i.y]);P.multiplySelf(new DOMMatrix(i.shape.matrix));var I=n.createPattern(G.transform(i.shape.bitmap),"no-repeat");I.setTransform(P),n.globalAlpha=1-p,n.fillStyle=I,n.fillRect(i.x-T/2,i.y-w/2,T,w),n.globalAlpha=1}else if(i.shape==="circle")n.ellipse?n.ellipse(i.x,i.y,Math.abs(C-g)*i.ovalScalar,Math.abs(_-y)*i.ovalScalar,Math.PI/10*i.wobble,0,2*Math.PI):rt(n,i.x,i.y,Math.abs(C-g)*i.ovalScalar,Math.abs(_-y)*i.ovalScalar,Math.PI/10*i.wobble,0,2*Math.PI);else if(i.shape==="star")for(var E=Math.PI/2*3,F=4*i.scalar,L=8*i.scalar,Z=i.x,J=i.y,X=5,M=Math.PI/X;X--;)Z=i.x+Math.cos(E)*L,J=i.y+Math.sin(E)*L,n.lineTo(Z,J),E+=M,Z=i.x+Math.cos(E)*F,J=i.y+Math.sin(E)*F,n.lineTo(Z,J),E+=M;else n.moveTo(Math.floor(i.x),Math.floor(i.y)),n.lineTo(Math.floor(i.wobbleX),Math.floor(y)),n.lineTo(Math.floor(C),Math.floor(_)),n.lineTo(Math.floor(g),Math.floor(i.wobbleY));return n.closePath(),n.fill(),i.tick<i.totalTicks}function Je(n,i,p,g,y){var C=i.slice(),_=n.getContext("2d"),h,b,v=A(function(T){function w(){h=b=null,_.clearRect(0,0,g.width,g.height),G.clear(),y(),T()}function P(){r&&!(g.width===a.width&&g.height===a.height)&&(g.width=n.width=a.width,g.height=n.height=a.height),!g.width&&!g.height&&(p(n),g.width=n.width,g.height=n.height),_.clearRect(0,0,g.width,g.height),C=C.filter(function(I){return Re(_,I)}),C.length?h=be.frame(P):w()}h=be.frame(P),b=w});return{addFettis:function(T){return C=C.concat(T),v},canvas:n,promise:v,reset:function(){h&&be.cancel(h),b&&b()}}}function Ye(n,i){var p=!n,g=!!R(i||{},"resize"),y=!1,C=R(i,"disableForReducedMotion",Boolean),_=c&&!!R(i||{},"useWorker"),h=_?xe():null,b=p?Et:nt,v=n&&h?!!n.__confetti_initialized:!1,T=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,w;function P(E,F,L){for(var Z=R(E,"particleCount",Vt),J=R(E,"angle",Number),X=R(E,"spread",Number),M=R(E,"startVelocity",Number),ve=R(E,"decay",Number),Pe=R(E,"gravity",Number),ke=R(E,"drift",Number),Q=R(E,"colors",Fe),de=R(E,"ticks",Number),st=R(E,"shapes"),Y=R(E,"scalar"),De=!!R(E,"flat"),Oe=Tt(E),Ne=Z,ee=[],pe=n.width*Oe.x,Ui=n.height*Oe.y;Ne--;)ee.push(at({x:pe,y:Ui,angle:J,spread:X,startVelocity:M,color:Q[Ne%Q.length],shape:st[Ge(0,st.length)],ticks:de,decay:ve,gravity:Pe,drift:ke,scalar:Y,flat:De}));return w?w.addFettis(ee):(w=Je(n,ee,b,F,L),w.promise)}function I(E){var F=C||R(E,"disableForReducedMotion",Boolean),L=R(E,"zIndex",Number);if(F&&T)return A(function(M){M()});p&&w?n=w.canvas:p&&!n&&(n=ot(L),document.body.appendChild(n)),g&&!v&&b(n);var Z={width:n.width,height:n.height};h&&!v&&h.init(n),v=!0,h&&(n.__confetti_initialized=!0);function J(){if(h){var M={getBoundingClientRect:function(){if(!p)return n.getBoundingClientRect()}};b(M),h.postMessage({resize:{width:M.width,height:M.height}});return}Z.width=Z.height=null}function X(){w=null,g&&(y=!1,e.removeEventListener("resize",J)),p&&n&&(document.body.contains(n)&&document.body.removeChild(n),n=null,v=!1)}return g&&!y&&(y=!0,e.addEventListener("resize",J,!1)),h?h.fire(E,Z,X):P(E,Z,X)}return I.reset=function(){h&&h.reset(),w&&w.reset()},I}var Me;function s(){return Me||(Me=Ye(null,{useWorker:!0,resize:!0})),Me}function l(n,i,p,g,y,C,_){var h=new Path2D(n),b=new Path2D;b.addPath(h,new DOMMatrix(i));var v=new Path2D;return v.addPath(b,new DOMMatrix([Math.cos(_)*y,Math.sin(_)*y,-Math.sin(_)*C,Math.cos(_)*C,p,g])),v}function d(n){if(!f)throw new Error("path confetti are not supported in this browser");var i,p;typeof n=="string"?i=n:(i=n.path,p=n.matrix);var g=new Path2D(i),y=document.createElement("canvas"),C=y.getContext("2d");if(!p){for(var _=1e3,h=_,b=_,v=0,T=0,w,P,I=0;I<_;I+=2)for(var E=0;E<_;E+=2)C.isPointInPath(g,I,E,"nonzero")&&(h=Math.min(h,I),b=Math.min(b,E),v=Math.max(v,I),T=Math.max(T,E));w=v-h,P=T-b;var F=10,L=Math.min(F/w,F/P);p=[L,0,0,L,-Math.round(w/2+h)*L,-Math.round(P/2+b)*L]}return{type:"path",path:i,matrix:p}}function u(n){var i,p=1,g="#000000",y='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof n=="string"?i=n:(i=n.text,p="scalar"in n?n.scalar:p,y="fontFamily"in n?n.fontFamily:y,g="color"in n?n.color:g);var C=10*p,_=""+C+"px "+y,h=new OffscreenCanvas(C,C),b=h.getContext("2d");b.font=_;var v=b.measureText(i),T=Math.ceil(v.actualBoundingBoxRight+v.actualBoundingBoxLeft),w=Math.ceil(v.actualBoundingBoxAscent+v.actualBoundingBoxDescent),P=2,I=v.actualBoundingBoxLeft+P,E=v.actualBoundingBoxAscent+P;T+=P+P,w+=P+P,h=new OffscreenCanvas(T,w),b=h.getContext("2d"),b.font=_,b.fillStyle=g,b.fillText(i,I,E);var F=1/p;return{type:"bitmap",bitmap:h.transferToImageBitmap(),matrix:[F,0,0,F,-T*F/2,-w*F/2]}}t.exports=function(){return s().apply(this,arguments)},t.exports.reset=function(){s().reset()},t.exports.create=Ye,t.exports.shapeFromPath=d,t.exports.shapeFromText=u})((function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}})(),Rt,!1);var $i=Rt.exports,eo=Rt.exports.create;var gt=class{static DEFAULTS={scalar:1.4,zIndex:1e4,shapes:["circle","circle","square"],colors:["#f51c8f","#2179e2","#d52dc8","#01a9d9","#78ff44","#fdff6a"]};static async basic(){await this.fire({particleCount:100,spread:70,origin:{y:.6}})}static async leftRight(e=100){let t=[],r=Date.now()+2e3,a=()=>{t.push(this.fire({angle:60,spread:55,origin:{x:0}}),this.fire({angle:120,spread:55,origin:{x:1}})),Date.now()<r&&e>0&&(requestAnimationFrame(a),e--)};a(),await Promise.all(t)}static async realistic(){await Promise.all([this.realisticFire(.25,{spread:26,startVelocity:55}),this.realisticFire(.2,{spread:60}),this.realisticFire(.35,{spread:100,decay:.91,scalar:.8}),this.realisticFire(.1,{spread:120,startVelocity:25,decay:.92,scalar:1.2}),this.realisticFire(.1,{spread:120,startVelocity:45})])}static async fire(e){Object.assign(e,this.DEFAULTS,e),e.particleCount=e.particleCount??this.DEFAULTS.colors.length,await $i(e)}static async realisticFire(e,t){let a={origin:{y:.7}};await this.fire(Object.assign({},a,t,{particleCount:Math.floor(200*e)}))}};var an=(o,e)=>e.minValue;function sn(o,e){if(o&1&&(Te(0,"div",7),me(1,"safeHtml")),o&2){let t=V().$implicit;ue("innerHTML",Ce(1,1,t.minValue+" Products"),ae)}}function ln(o,e){if(o&1&&(Te(0,"div",7),me(1,"cooeeCurrency"),me(2,"safeHtml")),o&2){let t=V().$implicit;ue("innerHTML",Ce(2,3,Ce(1,1,t.minValue)),ae)}}function cn(o,e){if(o&1&&(Le(0,"li",6)(1,"div"),j(2,sn,2,3,"div",7)(3,ln,3,5,"div",7),Te(4,"img",8),Le(5,"div",9),ce(6),Be()()()),o&2){let t=e.$implicit,r=V(2);Xe("left",t.calculatedAlignment+"%"),S(2),$((r.progressBarConfig==null?null:r.progressBarConfig.rewardBasis)===r.RewardBasis.ITEM_COUNT?2:3),S(2),ue("src",r.getIconURL(t),lt),S(2),ri(t.label)}}function dn(o,e){if(o&1&&(Te(0,"div",0),me(1,"cooeeDynamicVariables"),me(2,"safeHtml"),Le(3,"div",1)(4,"ul",2)(5,"div",3),Te(6,"div",4),Be(),we(7,cn,7,5,"li",5,an),Be()()),o&2){let t=V(),r=t.calculatedState(),a=r.nextMilestone?r.nextMilestone.reachingText:r.lastMilestone.reachedText;ue("innerHTML",Ce(2,6,li(1,3,a,t.localDynamicVariables())),ae),S(6),Xe("width",r.cartValuePercentage+"%"),S(),Ve(r.milestones)}}var ht=class o extends fe{cart;localDynamicVariables=_e({});calculatedState=_e({});progressBarConfig;RewardBasis=Ft;constructor(){super()}engagementTriggerReceived(e){this.progressBarConfig=e.progressBarConfig}ngOnInit(){super.ngOnInit(),this.calculateMilestonesSilently()}update(){this.calculateMilestonesSilently()}getIconURL(e){return e.rewardType===dt.FREE_SHIPPING?"https://img.icons8.com/ios-filled/50/FFFFFF/free-shipping.png":e.rewardType===dt.DISCOUNT?"https://img.icons8.com/ios-glyphs/30/FFFFFF/sale-price-tag.png":e.rewardType===dt.FREE_AUTO_GIFT?"https://img.icons8.com/ios-filled/50/FFFFFF/gift--v1.png":""}calculateMilestonesSilently(){this.calculateMilestones().catch(e=>z.error(e))}async calculateMilestones(){let e=this.engagementTrigger,t=this.progressBarConfig;if(!t?.milestones?.length){z.warn("Milestones not available in progress bar config",e);return}let r=await this.cart.getNormalisedCart(),a=t.milestones.at(-1),c=t?.reachedAmountOrCount??r.originalAmount,f=t.totalProgress??0;z.verbose("Cart value:",c,`, percentage: ${f}%`),this.celebrate(e,c);let m={milestonesReady:!0,cartValuePercentage:f,milestones:t.milestones},x=t.milestones.find(A=>!A.reached);if(x){let A=Ue(x.minValue-c);if(t.rewardBasis==="ITEM_COUNT"){let G=x.minValue-c;A=`${G} ${G===1?"product":"products"}`}this.localDynamicVariables.set({amount_left:A}),m.nextMilestone=x,this.calculatedState.set(m);return}m.lastMilestone=a,this.calculatedState.set(m)}celebrate(e,t){let c=[...e.progressBarConfig.milestones].reverse().find(x=>x.minValue<t);if(!c)return;let f=`lc/en/${e.shortID}/${c.minValue}`;sessionStorage.getItem(f)||(sessionStorage.setItem(f,"1"),this.progressBarConfig?.noConfetti||gt.realistic())}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=U({type:o,selectors:[["cooee-progressbar"]],inputs:{cart:"cart"},features:[ne(oe()),q],decls:1,vars:1,consts:[[1,"heading",3,"innerHTML"],[1,"milestone-container"],[1,"milestone-list"],[1,"untracked-path"],[1,"tracked-path"],[1,"milestone-list-item",3,"left"],[1,"milestone-list-item"],[1,"milestone-value",3,"innerHTML"],["width","20","height","20","alt","milestone icon",1,"milestone-icon",3,"src"],[1,"milestone-label"]],template:function(t,r){t&1&&j(0,dn,9,8),t&2&&$(r.calculatedState().milestonesReady?0:-1)},dependencies:[ft,qe,xi],styles:[`:host{display:block;padding:10px;background:linear-gradient(0deg,rgba(var(--lc-primary-color),.1) 0%,transparent 100%)}.milestone-container{width:95%;margin:8px 0}.heading{font-weight:500;text-align:center;font-size:12px}.milestone-list{display:flex;align-items:center;position:relative;font-size:10px;font-weight:500}.untracked-path{width:100%;background-color:#e5e7eb;height:4px;position:absolute}.tracked-path{background-color:rgba(var(--lc-primary-color));height:100%;display:block;transition:width .5s ease-in-out}.milestone-list{padding:0;margin:0}.milestone-list-item{position:relative;display:flex;flex-direction:column;align-items:center;height:75px}.milestone-list-item>div{display:flex;flex-direction:column;align-items:center;justify-content:space-between;position:absolute;height:100%;width:100px}.milestone-icon{padding:5px;border-radius:1000px;background-color:rgba(var(--lc-primary-color))}
12
+ `],encapsulation:3})};var pn=["numberVariable"],vt=class o extends fe{numberSlot;savingsBarConfig;textParts=_e({start:"",end:""});globalIntervals=[];constructor(){super()}ngAfterViewInit(){this.updateUIVars()}engagementTriggerReceived(e){this.savingsBarConfig=e.content.savingsBarConfig,this.elementRef.nativeElement.classList.add("lc_"+e.entryAnimation?.toLowerCase()),this.savingsBarConfig.iconURL&&this.elementRef.nativeElement.style.setProperty("--lc-discount-icon",this.savingsBarConfig.iconURL)}update(){this.updateUIVars()}updateUIVars(){let e=ye(ye({},this.engagementTrigger.getCartMagicVariables()),bi("total_savings",this.savingsBarConfig.totalSavings)),t=We(this.savingsBarConfig.text,{cart:e},this.triggerContext),r=t.match(/[\d.,]+/)?.[0];if(!r){z.error("No amount found in text",t);return}let[a,c]=t.split(r);this.textParts.set({start:a,end:c}),this.savingsBarConfig.animateNumber?this.runAnimation(r):this.numberSlot.nativeElement.innerHTML=r}runSlotMachineAnimation(e="0"){let t=this.numberSlot.nativeElement;t.innerHTML="";let r=this.savingsBarConfig.animationDuration/e.length;this.clearPreviousIntervals();for(let a=0;a<e.length;a++){let c=document.createElement("div");c.className="digit",c.style.display="inline-block",t.appendChild(c);let f=setInterval(()=>{let m=Math.floor(Math.random()*10);c.innerHTML=`<div>${m}</div>`},50);this.globalIntervals.push(f),setTimeout(()=>{clearInterval(f);let m=e?.[a]??Math.floor(Math.random()*10);c.innerHTML=`${m}`},(a+1)*r)}}clearPreviousIntervals(){this.globalIntervals.forEach(clearInterval),this.globalIntervals=[]}runIncrementalAnimation(e){let t=performance.now(),r=a=>{let c=Math.min((a-t)/this.savingsBarConfig.animationDuration,1);this.numberSlot.nativeElement.innerHTML=Math.floor(e*c).toString(),c<1&&requestAnimationFrame(r)};requestAnimationFrame(r)}runAnimation(e){this.savingsBarConfig.animation==="SLOT_MACHINE"?this.runSlotMachineAnimation(e):this.savingsBarConfig.animation==="INCREMENTAL"&&this.runIncrementalAnimation(Number(e))}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=U({type:o,selectors:[["cooee-savings-bar"]],viewQuery:function(t,r){if(t&1&&He(pn,5),t&2){let a;je(a=$e())&&(r.numberSlot=a.first)}},features:[q],decls:6,vars:2,consts:[["numberVariable",""],[1,"container"],[1,"icon"],[1,"primary-text",3,"innerHTML"],[1,"counter-text"],[1,"final-text",3,"innerHTML"]],template:function(t,r){t&1&&(Le(0,"div",1),Te(1,"div",2)(2,"div",3)(3,"div",4,0)(5,"div",5),Be()),t&2&&(S(2),ue("innerHTML",r.textParts().start,ae),S(3),ue("innerHTML",r.textParts().end,ae))},styles:[`:host{display:block}.container{white-space:pre;display:flex;justify-content:center;align-items:center;background-color:rgba(var(--lc-primary-button-bg-color, 0 162 81));color:rgba(var(--lc-primary-button-color, 255 255 255));padding:8px;border-radius:4px 4px 0 0;overflow:hidden}.container .icon{background-image:var(--lc-discount-icon, url(https://img.icons8.com/ios-glyphs/30/FFFFFF/discount--v1.png));background-position:center;background-size:cover;height:20px;width:20px;margin-right:2px}
13
+ `],encapsulation:3})};var yt=class o extends fe{item;data=re(wi);dialogRef=re(_i);ItemDetailLayout=Vi;constructor(){super(),this.triggerContext=this.data.triggerContext,this.item=this.data.item}close(){this.dialogRef.close()}engagementTriggerReceived(e){}update(){}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=U({type:o,selectors:[["cooee-item-quick-view"]],features:[ne(oe()),q],decls:1,vars:2,consts:[[3,"closeClick","item","layout"]],template:function(t,r){t&1&&(k(0,"cooee-item-detail",0),H("closeClick",function(){return r.close()}),D()),t&2&&B("item",r.item)("layout",r.ItemDetailLayout.TWO_PANE)},dependencies:[Pi],styles:[`:host{display:flex;align-items:center;justify-content:center;height:100%}@media (min-width: 768px){cooee-item-detail{max-width:900px;max-height:80vh;border-radius:var(--lc-card-radius)}}
14
+ `],encapsulation:3})};var Ct=class o{dialog=re(pt);dialogRef;constructor(){}showItemQuickView(e,t){this.dialogRef=this.dialog.open(yt,{width:"100vw",height:"100dvh",backdropClass:["letscooee-backdrop"],data:{item:t,triggerContext:e}})}static \u0275fac=function(t){return new(t||o)};static \u0275prov=jt({token:o,factory:o.\u0275fac,providedIn:"root"})};var un=(o,e)=>({enter:o,exit:e});function mn(o,e){if(o&1&&(k(0,"div",7),ce(1),D(),k(2,"div",8),ce(3),D()),o&2){let t=V(2);S(),ze(" ",t.getCurrency(t.selectedVariant().price.cmp)," "),S(2),ze(" ",t.getDiscountPercentage(t.selectedVariant().price),"% off ")}}function fn(o,e){if(o&1&&(k(0,"div",6),ce(1),D()),o&2){let t=V(2);S(),ze(" ",t.stickyATCConfig.leftText," ")}}function gn(o,e){if(o&1&&(k(0,"div",1)(1,"div",5),ce(2),D(),j(3,mn,4,2),j(4,fn,2,1,"div",6),D()),o&2){let t=V();S(2),ze(" ",t.getCurrency(t.selectedVariant().price.d)," "),S(),$(t.selectedVariant().price.cmp?3:-1),S(),$(t.stickyATCConfig.leftText?4:-1)}}function hn(o,e){if(o&1&&(k(0,"div",9),ce(1),D()),o&2){let t=e.$implicit,r=e.$index;V(2);let a=ie(5);B("ngClass",si(2,un,r===a.currentIndex,r===a.previousIndex)),S(),ze(" ",t," ")}}function vn(o,e){if(o&1&&(k(0,"div",4),we(1,hn,2,5,"div",9,ti),D()),o&2){V();let t=ie(5);S(),Ve(t.features)}}var bt=class o extends fe{currentItem;stickyATCConfig;selectedVariant=_e(void 0);featureSlider=_e({features:[],currentIndex:0});constructor(){super()}onVariantChange(e){this.currentItem&&(this.currentItem.setSelectedVariantByID(e.detail.variantID),this.selectedVariant.set(this.currentItem.selectedOrFirstVariant.value))}engagementTriggerReceived(e){this.stickyATCConfig=e.stickyATCConfig??{},this.currentItem=e.items[0],this.selectedVariant.set(this.currentItem.vars[0]),this.stickyATCConfig.leftText=this.replaceVariables(this.stickyATCConfig.leftText),this.stickyATCConfig.rightText=this.replaceVariables(this.stickyATCConfig.rightText),this.startFeatureRotation()}update(){}getCurrency(e){return Ue(e)}getDiscountPercentage(e){return((e.cmp-e.d)/e.cmp*100).toFixed(0)}addToCart(){this.engagementService.executeCTA(tt.ADD_TO_CART,{item:this.currentItem})}startFeatureRotation(){if(!this.stickyATCConfig.rightText)return;let e=this.stickyATCConfig.rightText.split(`
15
+ `),t=e.length===1?null:setInterval(()=>{this.featureSlider.update(r=>Ot(ye({},r),{previousIndex:r.currentIndex,currentIndex:(r.currentIndex+1)%r.features.length}))},3e3);this.featureSlider.set({intervalRef:t,currentIndex:0,features:e})}replaceVariables(e){return e?We(e,this.currentItem.getTemplateVariables(),this.triggerContext):""}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=U({type:o,selectors:[["cooee-sticky-atc"]],hostBindings:function(t,r){t&1&&H("letscooee:variant-change",function(c){return r.onVariantChange(c)},Zt)},features:[ne(oe()),q],decls:7,vars:3,consts:[[1,"lc-wrapper"],[1,"lc-prices"],[1,"lc-button-wrapper"],["type","button",1,"lc-button","lc-button-atc",3,"click"],[1,"lc-features"],[1,"lc-sale-price"],[1,"lc-additional-text"],[1,"lc-compare-price"],[1,"lc-discount-label"],[1,"lc-feature",3,"ngClass"]],template:function(t,r){if(t&1){let a=te();k(0,"div",0),j(1,gn,5,3,"div",1),k(2,"div",2)(3,"button",3),H("click",function(){return O(a),N(r.addToCart())}),ce(4,"Add To Cart"),D(),et(5),j(6,vn,3,0,"div",4),D()()}if(t&2){S(),$(r.selectedVariant()&&r.stickyATCConfig.showProductInfo?1:-1),S(4);let a=Ee(r.featureSlider());S(),$(a.features.length?6:-1)}},dependencies:[ct],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%}.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:#000;color:#fff;opacity:1;pointer-events:auto;border-radius:4px;min-width:150px;width:100%;padding:8px}.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}
16
+ `],encapsulation:3})};var Cn=["videoEl"];async function zi(){return(await import("./video-detail-dialog.component-RWCPJW4J.js")).VideoDetailDialogComponent}var Ie=class o extends fe{videoElements;videos;videoConfig;dialogRef=null;dialog=re(pt);isMobile=Ei();pausedVideos=[];videoLoadingStates=new Map;intersectionObserver;visibleVideos=new Set;constructor(){super(),zi()}ngAfterViewInit(){this.checkAndOpenVideoFromUrl()}ngOnDestroy(){super.ngOnDestroy(),this.intersectionObserver?.disconnect()}engagementTriggerReceived(e){this.videoConfig=e.content?.videoConfig,this.videos=this.videoConfig.videos}onMuteToggled(e,t){e||this.videoElements.forEach(r=>{r.nativeElement!==t&&(r.nativeElement.muted=!0,r.nativeElement.pause())})}sendTriggerClicked(e,t){this.sendEvent("CE Trigger Clicked",{},e,t)}async onVideoTap(e,t,r,a,c){e?.stopPropagation(),e?.preventDefault();let f=t.items?.[0];if(this.sendTriggerClicked(t,f),this.videoConfig.footerContent==="NONE"){a&&(a.muted=!1,a.play(),this.onMuteToggled(!1,a));return}await this.openDialog(t,r,c)}sendEvent(e,t,r,a){let c=new gi(e,t,this.engagementTrigger);c.setVideos(r),a&&(c.items=[a.toEmbed()]),window.CooeeSDK.sendEvent(c)}onDialogClosed(){this.resumePlaylistVideos()}isVideoLoading(e){return this.videoLoadingStates.get(e)??!0}onVideoLoadStart(e){this.videoLoadingStates.set(e,!0)}onVideoCanPlay(e){this.videoLoadingStates.set(e,!1)}playVideo(e){e.play().catch(t=>{z.error("Failed to play video:",t)})}setupIntersectionObserver(e=.5,t="50px"){this.intersectionObserver=new IntersectionObserver(r=>{r.forEach(a=>{let c=a.target,f=c.dataset.videoId;f&&(a.isIntersecting?(this.visibleVideos.add(f),this.handleVideoVisibilityChange(c,!0)):(this.visibleVideos.delete(f),this.handleVideoVisibilityChange(c,!1)))})},{threshold:e,rootMargin:t}),setTimeout(()=>{this.videoElements.forEach(r=>{this.intersectionObserver?.observe(r.nativeElement)})},100)}handleVideoVisibilityChange(e,t){t?this.onVideoBecameVisible(e):e.pause()}onVideoBecameVisible(e){this.playVideo(e)}pauseAllPlaylistVideos(){this.pausedVideos=[],this.videoElements.forEach(e=>{let t=e.nativeElement;t.paused||(this.pausedVideos.push(t),t.pause())})}resumePlaylistVideos(){this.pausedVideos.forEach(e=>{e.play().catch(()=>{})}),this.pausedVideos=[]}async checkAndOpenVideoFromUrl(){let e=Ai();if(!e||!this.videos)return;let t=Di();if(t.utm_campaign?.toLowerCase()!=="shoppable_video"||t.utm_source?.toLowerCase()!==ki)return;let r=this.videos.findIndex(a=>a.shortID===+e);if(r!==-1){let a=this.videos[r];await yi.set("muted",!0),await this.openDialog(a,r)}}async openDialog(e,t,r){await fi();let a={videos:this.videos,currentIndex:t,triggerContext:this.triggerContext,selectedItem:r};this.dialogRef&&this.dialogRef.close(),this.pauseAllPlaylistVideos();let c=await zi();this.dialogRef=this.dialog.open(c,{width:"100vw",height:"100vh",data:a,providers:hi(this.triggerContext,{video:e,index:t}),disableClose:!0});let f={videoID:e.id,videoIndex:t};this.sendEvent("CE Video Dialog Opened",{current:f},e),this.dialogRef.closed.subscribe(m=>{if(this.dialogRef=null,!m)return;let x=m.lastVideoDuration*1e3,A={videoID:m.lastVideo.id,videoIndex:m.lastVideoIndex,playedTillMS:x,playedTillPercent:x/m.lastVideo.durationMS};this.sendEvent("CE Video Dialog Closed",{current:A},m.lastVideo),this.onDialogClosed()})}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=U({type:o,selectors:[["cooee-abstract-video"]],viewQuery:function(t,r){if(t&1&&He(Cn,5),t&2){let a;je(a=$e())&&(r.videoElements=a)}},features:[q],decls:0,vars:0,template:function(t,r){},encapsulation:2})};var Se=class o{video=St.required({alias:"cooeeVideoSources"});prioritySource=St("high");elementRef=re(Wt);constructor(){di(()=>{this.updateSources()})}updateSources(){let e=this.elementRef.nativeElement,t=this.video(),r=this.prioritySource();e.querySelectorAll("source").forEach(c=>c.remove()),r==="best"?(this.addSource(t.bestSource),this.addSource(t.highSource),this.addSource(t.lowSource)):r==="low"?(this.addSource(t.lowSource),this.addSource(t.highSource),this.addSource(t.bestSource)):(this.addSource(t.highSource),this.addSource(t.bestSource),this.addSource(t.lowSource)),this.addSource(t.m3u8Source),e.load()}addSource(e){if(!e)return;let t=document.createElement("source");t.src=e.url,t.type=e.mimeType,this.elementRef.nativeElement.appendChild(t)}static \u0275fac=function(t){return new(t||o)};static \u0275dir=Jt({type:o,selectors:[["video","cooeeVideoSources",""]],inputs:{video:[1,"cooeeVideoSources","video"],prioritySource:[1,"prioritySource"]}})};var bn=(o,e)=>e.id;function xn(o,e){if(o&1&&(se(0,"div",1),me(1,"safeHtml")),o&2){let t=V();B("innerHTML",Ce(1,1,t.videoConfig.heading),ae)}}function _n(o,e){o&1&&(k(0,"div",6),se(1,"div",12),D())}function wn(o,e){if(o&1){let t=te();k(0,"cooee-mute-toggle",13),H("toggled",function(a){O(t),V();let c=le(6),f=V();return N(f.onMuteToggled(a,c))}),D()}if(o&2){V();let t=le(6);B("muted",t.muted)("videoEl",t)}}function Vn(o,e){if(o&1){let t=te();k(0,"cooee-video-promoted-items",16),H("cardClick",function(a){O(t);let c=V(2),f=c.$implicit,m=c.$index,x=le(6),A=V();return N(A.onItemCardClick(a,f,m,x))}),D()}if(o&2){let t=V(2).$implicit;B("items",t.items)("centeredSlides",!1)}}function Tn(o,e){if(o&1){let t=te();k(0,"cooee-item-card",17),H("buttonClick",function(){O(t);let a=V(2),c=a.$implicit,f=a.$index,m=le(6),x=V();return N(x.addToCartClicked(null,c,f,m))})("click",function(){O(t);let a=V(2),c=a.$implicit,f=a.$index,m=le(6),x=ie(0),A=V();return N(A.onItemCardClick(x,c,f,m))}),D()}if(o&2){V(2);let t=ie(0);B("item",t)}}function En(o,e){if(o&1&&j(0,Vn,1,2,"cooee-video-promoted-items",14)(1,Tn,1,1,"cooee-item-card",15),o&2){let t=V().$implicit,r=V(),c=ie(2)===r.VideoConfigFooterContent.ITEM_SWIPER;$(c&&t.items.length>1?0:t.items.length?1:-1)}}function In(o,e){if(o&1){let t=te();k(0,"cooee-video-card",18),H("linkClicked",function(){O(t);let a=V().$implicit,c=V();return N(c.sendTriggerClicked(a))}),D()}if(o&2){V();let t=ie(1);B("card",t)}}function Sn(o,e){if(o&1){let t=te();et(0)(1),k(2,"div",4)(3,"div",5),H("click",function(a){let c=O(t),f=c.$implicit,m=c.$index,x=le(6),A=V();return N(A.onVideoTap(a,f,m,x))})("keydown.enter",function(a){let c=O(t),f=c.$implicit,m=c.$index,x=le(6),A=V();return N(A.onVideoTap(a,f,m,x))})("keydown.space",function(a){let c=O(t),f=c.$implicit,m=c.$index,x=le(6),A=V();return N(A.onVideoTap(a,f,m,x))}),j(4,_n,2,0,"div",6),k(5,"video",7,0),H("mouseenter",function(){O(t);let a=le(6);V();let c=ie(1);return N(c&&a.play())})("mouseleave",function(){O(t);let a=le(6);V();let c=ie(1);return N(c&&a.pause())})("loadstart",function(){let a=O(t).$implicit,c=V();return N(c.onVideoLoadStart(a.id))})("canplay",function(){let a=O(t).$implicit,c=V();return N(c.onVideoCanPlay(a.id))}),D(),k(7,"div",8),j(8,wn,1,2,"cooee-mute-toggle",9),D()(),k(9,"div",10),j(10,En,2,1)(11,In,1,1,"cooee-video-card",11),D()()}if(o&2){let t=e.$implicit,r=V(),a=ie(0),c=ie(2);Ee(t.items[0]),S();let m=Ee(t.card)&&c===r.VideoConfigFooterContent.CARD;S(2),Xe("background-image",t.thumbnail?"url("+t.thumbnail+")":null),S(),$(r.isVideoLoading(t.id)?4:-1),S(),B("cooeeVideoSources",t)("muted",!0),Ke("preload",a?"metadata":"none")("autoplay",null)("data-video-id",t.id),S(3),$(r.videoConfig.showMuteButton?8:-1),S(2),$(r.videoConfig.showItems()?10:m?11:-1)}}var xt=class o extends Ie{VideoConfigFooterContent=Mt;VideoConfigAutoPlay=Mi;swiperOptions=null;constructor(){super(),this.hasSwiper=!0}ngAfterViewInit(){super.ngAfterViewInit();let e=this.videoConfig.playlistConfig.videoSwiper,t=e?(this.isMobile?e.gapSm:e.gap)+"px":window.cooeePlaylistGap??24,r=e?this.isMobile?e.maxInRowSm:e.maxInRow:"auto";this.swiperOptions={direction:"horizontal",effect:"slide",loop:e?.loop,freeMode:!0,spaceBetween:t,slidesPerView:r,mousewheel:{enabled:!0,forceToAxis:!0},autoplay:e?.autoplay?.enabled?{delay:e?.autoplay?.delay,disableOnInteraction:!1}:!1},this.setupIntersectionObserver(),this.playFirstVideo()}ngOnDestroy(){super.ngOnDestroy()}addToCartClicked(e,t,r,a){let c=t.items?.[0],f=mi.get().website?.canChangeVariantInCart;if(t.items?.length>1||c?.hasVariants()&&!f){this.onItemCardClick(c,t,r,a);return}this.engagementService.executeCTA(tt.ADD_TO_CART,{item:c,video:t})}goToPDP(e,t){e?.stopPropagation(),e?.preventDefault();let r=t.items?.[0];this.engagementService.executeCTA(tt.GO_TO_PRODUCT,{item:r,video:t})}onItemCardClick(e,t,r,a){this.videoConfig.playlistConfig.itemCardClickBehavior==="OPEN_ITEM_DETAIL"?this.onVideoTap(null,t,r,a,e):this.onVideoTap(null,t,r,a)}update(){}onVideoBecameVisible(e){this.shouldAutoPlay()&&(this.dialogRef?this.pausedVideos.push(e):this.playVideo(e))}shouldAutoPlay(){return this.videoConfig.autoPlay==="ON"||this.videoConfig.autoPlay==="ON_HOVER"&&this.isMobile}playFirstVideo(){}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=U({type:o,selectors:[["cooee-video-playlist"]],features:[ne(oe()),q],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(t,r){if(t&1&&(et(0)(1)(2),j(3,xn,2,3,"div",1),k(4,"cooee-swiper",2),ii(5,3),we(6,Sn,12,12,"div",4,bn),ni(),D()),t&2){Ee(!r.videoConfig.autoPlay||r.videoConfig.autoPlay===r.VideoConfigAutoPlay.ON),S(),Ee(r.videoConfig.autoPlay===r.VideoConfigAutoPlay.ON_HOVER),S(),Ee(r.videoConfig.footerContent),S(),$(r.videoConfig.heading?3:-1);let a=r.videoConfig.playlistConfig.videoSwiper;S(),B("options",r.swiperOptions)("navigationConfig",a==null?null:a.navigation)("paginationConfig",a==null?null:a.pagination),S(2),Ve(r.videos)}},dependencies:[Oi,Ri,Fi,Si,Se,Ni,qe],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)}
17
+ `],encapsulation:3})};var Mn=["videoElement"],Pn=o=>({"cursor-grab":o}),_t=class o extends Ie{videoElement;video;isDragging=!1;hidden=!1;cdkDrag=re(ut,{self:!0});untilDestroyed=Ti();constructor(){super()}get popupClasses(){return this.hidden?["hidden"]:["visible"]}onClick(e){e.stopPropagation(),e.preventDefault(),this.onVideoClick()}ngOnInit(){super.ngOnInit();let e=this.elementRef.nativeElement.closest(".letscooee-engagement");e&&(e.style.zIndex="10000"),this.cdkDrag.moved.pipe(this.untilDestroyed).subscribe(()=>this.isDragging=!0)}ngAfterViewInit(){super.ngAfterViewInit(),setTimeout(()=>{this.autoPlay()},100)}onVideoClick(){if(this.isDragging){this.isDragging=!1;return}this.hidden=!0,this.onVideoTap(null,this.video,0)}close(){this.hidden=!0;let e=(new Date().getTime()-this.triggerContext.startTime.getTime())/1e3;this.sendEvent("CE Trigger Closed",{duration:e})}engagementTriggerReceived(e){super.engagementTriggerReceived(e),this.video=this.videos[0]}update(){}onDialogClosed(){this.hidden=!1}autoPlay(){let e=this.videoElement.nativeElement;this.hidden||this.playVideo(e)}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=U({type:o,selectors:[["cooee-video-popup"]],viewQuery:function(t,r){if(t&1&&He(Mn,5),t&2){let a;je(a=$e())&&(r.videoElement=a.first)}},hostAttrs:["role","button","tabindex","0","aria-label","Open video popup "],hostVars:3,hostBindings:function(t,r){t&1&&H("keydown.enter",function(c){return r.onClick(c)})("keydown.space",function(c){return r.onClick(c)})("click",function(c){return r.onClick(c)}),t&2&&(ue("cdkDragBoundary","body"),oi(r.popupClasses))},features:[ne(oe()),Kt([{directive:ut,inputs:["cdkDragBoundary","cdkDragBoundary"]}]),q],decls:9,vars:5,consts:[["videoElement",""],[1,"popup-inner",3,"ngClass"],["type","button","aria-label","Close video popup",1,"close-button",3,"click"],["name","close","aria-hidden","true"],[1,"play-button"],["name","unmute","aria-hidden","true"],[1,"text"],["loop","","preload","metadata","playsinline","",3,"muted","cooeeVideoSources"]],template:function(t,r){if(t&1){let a=te();k(0,"div",1)(1,"button",2),H("click",function(f){return O(a),f.stopPropagation(),N(r.close())}),se(2,"cooee-icon",3),D(),k(3,"div",4),se(4,"cooee-icon",5),k(5,"div",6),ce(6,"Tap to unmute"),D()(),se(7,"video",7,0),D()}t&2&&(B("ngClass",ai(3,Pn,r.isDragging)),S(7),B("muted",!0)("cooeeVideoSources",r.video))},dependencies:[ct,Ii,Se],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}
18
+ `],encapsulation:3})};var kn=(o,e)=>e.id;function Dn(o,e){if(o&1&&(se(0,"div",1),me(1,"safeHtml")),o&2){let t=V();B("innerHTML",Ce(1,1,t.videoConfig.heading),ae)}}function An(o,e){o&1&&(k(0,"div",9),se(1,"div",11),D())}function Fn(o,e){if(o&1){let t=te();k(0,"div",4),H("click",function(a){let c=O(t),f=c.$implicit,m=c.$index,x=V();return N(x.onVideoTap(a,f,m))})("keydown.enter",function(a){let c=O(t),f=c.$implicit,m=c.$index,x=V();return N(x.onVideoTap(a,f,m))})("keydown.space",function(a){let c=O(t),f=c.$implicit,m=c.$index,x=V();return N(x.onVideoTap(a,f,m))}),$t(),k(1,"svg",5),se(2,"circle",6)(3,"circle",7),D(),zt(),k(4,"div",8),j(5,An,2,0,"div",9),k(6,"video",10,0),H("loadstart",function(){let a=O(t).$implicit,c=V();return N(c.onVideoLoadStart(a.id))})("canplay",function(){let a=O(t).$implicit,c=V();return N(c.onVideoCanPlay(a.id))}),D()()()}if(o&2){let t=e.$implicit,r=e.$index,a=V();Ke("aria-label","Open video story "+(r+1)),S(5),$(a.isVideoLoading(t.id)?5:-1),S(),B("poster",t.thumbnail,lt)("cooeeVideoSources",t)("prioritySource","low")("muted",!0),Ke("data-video-id",t.id)}}var wt=class o extends Ie{constructor(){super()}ngAfterViewInit(){super.ngAfterViewInit(),this.setupIntersectionObserver()}ngOnDestroy(){super.ngOnDestroy()}update(){}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=U({type:o,selectors:[["cooee-video-stories"]],features:[ne(oe()),q],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,"loading-spinner"]],template:function(t,r){t&1&&(j(0,Dn,2,3,"div",1),k(1,"div",2),we(2,Fn,8,7,"div",3,kn),D()),t&2&&($(r.videoConfig.heading?0:-1),S(2),Ve(r.videos))},dependencies:[Se,qe],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;height:5rem;cursor:pointer;flex-shrink:0}.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}
19
+ `],encapsulation:3})};ui("CooeeWidgetSDK");(async()=>{let o=await pi(Bi),e=(t,r)=>{let a=Li(t,{injector:o.injector});customElements.define(r,a)};e(bt,"cooee-sticky-atc"),e(vt,"cooee-savings-bar"),e(ht,"cooee-progressbar"),e(xt,"cooee-video-playlist"),e(_t,"cooee-video-popup"),e(wt,"cooee-video-stories"),e(vi,"cooee-product-options-picker"),sessionStorage.cooeeDebug&&import("./debugger.component-YTNEZCLF.js").then(t=>{e(t.DebuggerComponent,"cooee-debugger")}),window.cooeeShowQuickItem=(t,r)=>{o.injector.get(Ct).showItemQuickView(t,r)}})();
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": "13.0.16",
4
+ "version": "13.0.18",
5
5
  "scripts": {
6
6
  "lint": "ng lint",
7
7
  "integrity": "./scripts/validate-integrity.sh",