var rt=Object.defineProperty;var dt=(e,t,a)=>t in e?rt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var c=(e,t,a)=>(dt(e,typeof t!="symbol"?t+"":t,a),a);/*! js-cookie v3.0.5 | MIT */function S(e){for(var t=1;t"u")){o=S({},t,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),s=encodeURIComponent(s).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var d="";for(var r in o)o[r]&&(d+="; "+r,o[r]!==!0&&(d+="="+o[r].split(";")[0]));return document.cookie=s+"="+e.write(i,s)+d}}function n(s){if(!(typeof document>"u"||arguments.length&&!s)){for(var i=document.cookie?document.cookie.split("; "):[],o={},d=0;d{if(!window||!window.document)return;t||(t={}),console.debug(`Dispatching event ${e} with args:`),console.debug(t);const a=new CustomEvent(e,{detail:t});return document.dispatchEvent(a),a},ut=(e,t)=>{window.addEventListener("CookiebotOnConsentReady",function(){t(Cookiebot.consent[e])})},k=()=>{var e;return!!((e=window.analytics)!=null&&e.list)},f=e=>!!(e!=null&&e.items&&Object.keys(e==null?void 0:e.items).length),C=()=>{var e,t;return!!((t=(e=window.analytics)==null?void 0:e.custom)!=null&&t.event)},E=({action:e,currentQuantity:t,newQuantity:a})=>e||(t>=a?"remove":"add"),O=({context:e,currentQuantity:t,newQuantity:a})=>e.startsWith("catalog")?a:t>=a?t-a:a-t,q=({list_id:e,product_id:t,updatedQuantity:a})=>{var n;return{...window.analytics.list[e],items:{[t]:{...(n=window.analytics.list[e])==null?void 0:n.items[t],quantity:a}}}},P=()=>{var e,t;return!!((t=(e=window.analytics)==null?void 0:e.providers)!=null&&t.tagmanager)},wt=()=>{var e,t,a,n;return!!((n=(a=(t=(e=window.analytics)==null?void 0:e.providers)==null?void 0:t.tagmanager)==null?void 0:a.blocks)!=null&&n.length)},M=e=>{const t=structuredClone(e),n=t.items.map(s=>(delete s.index,delete s.item_category5,delete s.item_category4,delete s.item_category3,delete s.item_category2,s)).pop();return{...t,items:[n]}},A=(e,t)=>{if(e)if(window.AnalyticsWebInterface)window.AnalyticsWebInterface.logEvent(e,JSON.stringify(t));else if(window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.firebase){const a={command:"logEvent",name:e,parameters:t};window.webkit.messageHandlers.firebase.postMessage(a)}else console.log("No native APIs found.")};class pt{constructor(t){c(this,"item");this.item=t}getData(){return this.item.categories.reduce((t,a,n)=>{const s=n+1,i=n==0?"item_category":`item_category${s}`;return t={...t,[i]:a},t},[])}}class _{constructor(t,{hasListData:a=!1,hasStock:n=!1}){c(this,"list");c(this,"hasListData");c(this,"hasStock");this.list=t,this.hasListData=a,this.hasStock=n}getItems(){return Object.values(this.list.items).reduce((t,a)=>{const s=new pt(a).getData();return t[a.index]={index:a.index,item_id:a.sku,item_name:a.name,item_brand:a.brand,currency:a.currency,discount:a.discount,quantity:a.quantity,price:a.price,...s},this.hasListData&&(t[a.index].item_list_id=this.list.id,t[a.index].item_list_name=this.list.name),this.hasStock&&(t[a.index].item_in_stock=a.in_stock?"In Stock":"Out of Stock"),t},[])}}let yt=class{constructor(t){c(this,"list");this.list=t}getData(){const a=new _(this.list,{}).getItems(),n=a.reduce((i,o)=>(i+=(o.price-o.discount)*o.quantity,i),0),s={items:a,currency:this.list.currency,value:n};return A("add_to_cart",M(s)),{event:"ecevent",action:"add_to_cart",ecommerce:s}}},gt=class{constructor(t){c(this,"list");this.list=t}getData(){const a=new _(this.list,{}).getItems(),n=a.reduce((i,o)=>(i+=(o.price-o.discount)*o.quantity,i),0),s={items:a,currency:this.list.currency,value:n};return A("remove_from_cart",M(s)),{event:"ecevent",action:"remove_from_cart",ecommerce:s}}},mt=class{constructor(t){c(this,"list");this.list=t}getData(){const a=new _(this.list,{}).getItems(),n=a.reduce((i,o)=>(i+=(o.price-o.discount)*o.quantity,i),0),s={items:a,currency:this.list.currency,value:n};return A("add_to_wishlist",M(s)),{event:"ecevent",action:"add_to_wishlist",ecommerce:s}}},ht=class{constructor(t){c(this,"list");this.list=t}getData(){const n={items:new _(this.list,{}).getItems()};return A("select_item",M(n)),{event:"ecevent",action:"select_item",ecommerce:n}}},ft=class{constructor(t,{type:a}){c(this,"list");c(this,"type");this.list=t,this.type=a}getData(){const a=new _(this.list,{}).getItems(),n={payment_type:this.type,items:a};return A("add_payment_info",n),{event:"ecevent",action:"add_payment_info",ecommerce:n}}},vt=class{constructor(t,{rate:a}){c(this,"list");c(this,"rate");this.list=t,this.rate=a}getData(){const a=new _(this.list,{}).getItems(),n={shipping_tier:this.rate,items:a};return A("add_shipping_info",n),{event:"ecevent",action:"add_shipping_info",ecommerce:n}}},Y=class{constructor(t){c(this,"list");this.list=t}getData(){var i,o,d;const a=new _(this.list,{}).getItems(),n=a.reduce((r,l)=>(r+=(l.price-l.discount)*l.quantity,r),0),s={items:a,currency:this.list.currency,value:n};return A((d=(o=(i=window.analytics)==null?void 0:i.providers)==null?void 0:o.tagmanager)==null?void 0:d.action,s),{event:"ecevent",action:"begin_checkout",ecommerce:s,ads:{custom:{ecomm_pagetype:"other"}}}}};const kt=()=>{document.addEventListener("analyticsOnItemsUpdate",function(e){var h;const{context:t,action:a,list:n,product:s,target:i,type:o}=e.detail,d=(h=window.analytics)==null?void 0:h.list[n.id];if(!f(d))return;let l=d.items[s.id].quantity;i==="redirect"&&(l-=1);const p=s.quantity,m=O({context:t,currentQuantity:l,newQuantity:p}),g=E({action:a,currentQuantity:l,newQuantity:p}),u=q({list_id:n.id,product_id:s.id,updatedQuantity:m});let w,y;switch(`${t}_${g}`){case"catalog_cart_add":case"cart_add":w=new yt(u),y=w.getData(),D("internalAnalytics",{name:"add_to_cart_custom",params:{type:o,parent_id:u.id,target:u.items[s.id].sku,position:u.items[s.id].index,current_quantity:p,updated_quantity:m}});break;case"cart_remove":w=new gt(u),y=w.getData(),D("internalAnalytics",{name:"remove_from_cart_custom",params:{type:o,parent_id:u.id,target:u.items[s.id].sku,position:u.items[s.id].index,current_quantity:p,updated_quantity:m}});break;case"catalog_wishlist_add":w=new mt(u),y=w.getData();break;default:return}window.dataLayer.push({ecommerce:null}),window.dataLayer.push(y)})},At=()=>{document.addEventListener("analyticsSelectProductItem",function(e){var l;const{productItemProps:t}=e.detail,{list_id:a,product_id:n,type:s}=t,i=window.analytics.list[a];if(!f(i))return;const o={...window.analytics.list[a],items:{[n]:{...(l=window.analytics.list[a])==null?void 0:l.items[n]}}},r=new ht(o).getData();window.dataLayer.push({ecommerce:null}),window.dataLayer.push(r),D("internalAnalytics",{name:"select_item_custom",params:{type:s,parent_id:o.id,target:o.items[n].sku,position:o.items[n].index}})})},_t=()=>{document.addEventListener("analyticsSetCookieTagManager",function(e){const{measurementId:t}=e.detail;bt(t),Dt(t),Tt(t)})},bt=e=>{ut("marketing",function(t){let a=b.get("ga4");a||(a=JSON.stringify({}));let n=JSON.parse(a);t?window.gtag("get",e,"client_id",function(s){n={...n,client_id:s},b.set("ga4",JSON.stringify(n))}):(n&&delete n.client_id,b.set("ga4",JSON.stringify(n)))})},Dt=e=>{window.gtag("get",e,"session_id",function(t){let a=b.get("ga4");a||(a=JSON.stringify({}));let n=JSON.parse(a);n={...n,session_id:t},b.set("ga4",JSON.stringify(n))})},Tt=e=>{window.gtag("get",e,"session_number",function(t){let a=b.get("ga4");a||(a=JSON.stringify({}));let n=JSON.parse(a);n={...n,session_number:t},b.set("ga4",JSON.stringify(n))})},Lt=()=>{document.addEventListener("internalAnalytics",function(e){A(e.detail.name,e.detail.params||{}),It(e.detail.name,e.detail.params||{})})},It=(e,t)=>{window.dataLayer.push({extra:null}),window.dataLayer.push({event:"gaevent",action:e,extra:t})},$t=()=>{window.addEventListener("CookiebotOnAccept",function(){const e=b.get("_ga");e&&e.length>0&&window.dataLayer.push({userId:e})}),window.addEventListener("CookiebotOnDecline",function(){b.get("_ga")||b.set("ga4",JSON.stringify({}))})},Ct=()=>{document.addEventListener("analyticsShippingMethodChanged",function(e){const{rate:t}=e.detail,n=new vt(window.analytics.list.checkout,{rate:t.title}).getData();window.dataLayer.push({ecommerce:null}),window.dataLayer.push(n)})},Et=()=>{document.addEventListener("analyticsPaymentMethodChanged",function(e){const{type:t}=e.detail,n=new ft(window.analytics.list.checkout,{type:t}).getData();window.dataLayer.push({ecommerce:null}),window.dataLayer.push(n)})},Ot=()=>{document.addEventListener("analyticsFastCheckout",function(e){const{list:t}=e.detail,n=new Y(t).getData();window.dataLayer.push({ecommerce:null}),window.dataLayer.push(n)})},qt=()=>{document.addEventListener("analyticsUserSubscribes",function(){const e={event:"gaevent",action:"subscribe_complete",userSubscribed:"true"};window.dataLayer=window.dataLayer||[],window.dataLayer.push(e)})};P()&&(k()&&(kt(),At(),Ct(),Et(),Ot()),_t(),Lt(),$t(),qt());let St=class{constructor(t,{block:a}){c(this,"list");c(this,"block");this.list=t,this.block=a}getData(){const n={items:new _(this.list,{hasListData:!0}).getItems(),item_list_id:this.block.list.id,item_list_name:this.block.list.name};return A(this.block.action,n),{event:this.block.event,action:this.block.action,ecommerce:n}}};const Mt=e=>{const t=window.analytics.list[e.list.id];if(!f(t))return;const n=new St(t,{block:e}).getData();window.dataLayer.push({ecommerce:null}),window.dataLayer.push(n)},jt=()=>{Object.values(window.analytics.providers.tagmanager.blocks).forEach(e=>{Mt(e)})};!k()||!wt()||jt();const Pt=()=>{var t,a,n,s,i,o,d,r;let e;switch((a=(t=window.analytics)==null?void 0:t.custom)==null?void 0:a.event){case"register":e={event:"gaevent",action:"sign_up",userSubscribed:(i=(s=(n=window.analytics)==null?void 0:n.customer)==null?void 0:s.is_subscribed)==null?void 0:i.toString()};break;case"login":e={event:"gaevent",action:"login",userSubscribed:(r=(d=(o=window.analytics)==null?void 0:o.customer)==null?void 0:d.is_subscribed)==null?void 0:r.toString()};break;default:return}window.dataLayer=window.dataLayer||[],window.dataLayer.push(e)};!P()||!C()||Pt();let Rt=class{constructor(){}getData(){return{ads:{custom:{ecomm_pagetype:"home"}}}}},Ft=class{constructor(t){c(this,"list");this.list=t}getData(){var i,o,d,r,l,p,m,g,u;const a=new _(this.list,{}).getItems(),n=a.reduce((w,y)=>(w+=(y.price-y.discount)*y.quantity,w),0),s={items:a,currency:this.list.currency,value:n};return A((d=(o=(i=window.analytics)==null?void 0:i.providers)==null?void 0:o.tagmanager)==null?void 0:d.action,s),{event:(p=(l=(r=window.analytics)==null?void 0:r.providers)==null?void 0:l.tagmanager)==null?void 0:p.event,action:(u=(g=(m=window.analytics)==null?void 0:m.providers)==null?void 0:g.tagmanager)==null?void 0:u.action,ecommerce:s,ads:{custom:{ecomm_pagetype:"cart",ecomm_prodid:Object.values(this.list.items).map(w=>w.sku),ecomm_quantity:Object.values(this.list.items).map(w=>w.quantity),ecomm_totalvalue:this.list.value}}}}},Bt=class{constructor(t){c(this,"list");this.list=t}getData(){var s,i,o,d,r,l,p,m,g;const n={items:new _(this.list,{hasListData:!0}).getItems(),item_list_id:this.list.id,item_list_name:this.list.name};return A((o=(i=(s=window.analytics)==null?void 0:s.providers)==null?void 0:i.tagmanager)==null?void 0:o.action,n),{event:(l=(r=(d=window.analytics)==null?void 0:d.providers)==null?void 0:r.tagmanager)==null?void 0:l.event,action:(g=(m=(p=window.analytics)==null?void 0:p.providers)==null?void 0:m.tagmanager)==null?void 0:g.action,ecommerce:n,ads:{custom:{ecomm_pagetype:"other"}}}}},xt=class{constructor(t){c(this,"list");this.list=t}getData(){var d,r,l,p,m,g,u,w,y;const a=new _(this.list,{hasStock:!0}).getItems(),n=a.reduce((h,v)=>(h+=(v.price-v.discount)*v.quantity,h),0),s={items:a,currency:this.list.currency,value:n},[i]=Object.keys(this.list.items),o=this.list.items[i];return A((l=(r=(d=window.analytics)==null?void 0:d.providers)==null?void 0:r.tagmanager)==null?void 0:l.action,s),{event:(g=(m=(p=window.analytics)==null?void 0:p.providers)==null?void 0:m.tagmanager)==null?void 0:g.event,action:(y=(w=(u=window.analytics)==null?void 0:u.providers)==null?void 0:w.tagmanager)==null?void 0:y.action,ecommerce:s,ads:{custom:{ecomm_pagetype:"product",ecomm_prodid:o.sku,ecomm_totalvalue:o.price,ecomm_pvalue:o.price,ecomm_category:o.categories.join(" > "),ecomm_quantity:o.quantity}}}}},Ht=class{constructor(t){c(this,"list");this.list=t}getData(){var s,i,o,d,r,l,p,m,g;const n={items:new _(this.list,{hasListData:!0}).getItems(),item_list_id:this.list.id,item_list_name:this.list.name};return A((o=(i=(s=window.analytics)==null?void 0:s.providers)==null?void 0:i.tagmanager)==null?void 0:o.action,n),{event:(l=(r=(d=window.analytics)==null?void 0:d.providers)==null?void 0:r.tagmanager)==null?void 0:l.event,action:(g=(m=(p=window.analytics)==null?void 0:p.providers)==null?void 0:m.tagmanager)==null?void 0:g.action,ecommerce:n,ads:{custom:{ecomm_pagetype:"searchresults"}}}}};class Ut{constructor(){c(this,"customer");var t,a;this.customer=(a=(t=window.analytics)==null?void 0:t.info)==null?void 0:a.customer}getData(){return{email:this.customer.email,phone:this.customer.phone}}}class Nt{constructor(){c(this,"customer");c(this,"shipping");var t,a,n,s;this.customer=(a=(t=window.analytics)==null?void 0:t.info)==null?void 0:a.customer,this.shipping=(s=(n=window.analytics)==null?void 0:n.info)==null?void 0:s.shipping}getData(){return{firstname:this.customer.firstname,lastname:this.customer.lastname,street:this.shipping.street,city:this.shipping.city,country:this.shipping.country,postalcode:this.shipping.postalcode}}}let Jt=class{constructor(t){c(this,"customer");c(this,"list");var a,n;this.customer=(n=(a=window.analytics)==null?void 0:a.info)==null?void 0:n.customer,this.list=t}getData(){var r,l,p,m,g,u,w,y,h;const a=new _(this.list,{}).getItems(),s=new Ut().getData(),o=new Nt().getData(),d={items:a,transaction_id:this.list.transaction_id,currency:this.list.currency,shipping:this.list.shipping,value:this.list.value,operational_margin:this.list.operational_margin};return A((p=(l=(r=window.analytics)==null?void 0:r.providers)==null?void 0:l.tagmanager)==null?void 0:p.action,d),{event:(u=(g=(m=window.analytics)==null?void 0:m.providers)==null?void 0:g.tagmanager)==null?void 0:u.event,action:(h=(y=(w=window.analytics)==null?void 0:w.providers)==null?void 0:y.tagmanager)==null?void 0:h.action,ecommerce:d,ads:{custom:{ecomm_pagetype:"purchase",ecomm_prodid:Object.values(this.list.items).map(v=>v.sku),ecomm_quantity:Object.values(this.list.items).map(v=>v.quantity),ecomm_pvalue:Object.values(this.list.items).map(v=>v.price),ecomm_totalvalue:this.list.value,hasaccount:this.customer.is_guest?"N":"Y"}},customer:s,shipping_info:o}}};class Qt{constructor(){}getData(){return{ads:{custom:{ecomm_pagetype:"other"}}}}}const X=e=>{if(!f(e))return;let t,a;switch(window.analytics.page){case"homepage":t=new Rt,a=t.getData();break;case"cart":if(e.id=="cart")t=new Ft(e),a=t.getData();else return;break;case"category":t=new Bt(e),a=t.getData();break;case"checkout":if(e.id=="checkout")t=new Y(e),a=t.getData();else return;break;case"product":if(e.id=="product-detail")t=new xt(e),a=t.getData();else return;break;case"search":if(e.id=="search")t=new Ht(e),a=t.getData();else return;break;case"success":if(e.id=="purchase"&&localStorage.getItem("transaction_id")!==window.analytics.list.purchase.transaction_id)t=new Jt(e),a=t.getData(),D("internalAnalytics",{name:"purchase_custom",params:{transaction_id:window.analytics.list.purchase.transaction_id,item_ids:Object.values(window.analytics.list.purchase.items).map(n=>n.id).join(",")}});else return;break;default:return}window.dataLayer.push({ecommerce:null}),window.dataLayer.push({ads:null}),window.dataLayer.push(a)},Gt=()=>{Object.values(window.analytics.list).forEach(e=>{X(e)})},Wt=()=>{document.addEventListener("analyticsLoadMoreItems",function(e){const{list:t}=e.detail;X(t)})},Kt=()=>{var e,t,a;D("analyticsSetCookieTagManager",{measurementId:(a=(t=(e=window.analytics)==null?void 0:e.providers)==null?void 0:t.tagmanager)==null?void 0:a.measurement_id})},zt=()=>{const t=new Qt().getData();window.dataLayer.push({ecommerce:null}),window.dataLayer.push({ads:null}),window.dataLayer.push(t)};window.analytics.page==="other"&&zt(),!(!k()||!P())&&(Kt(),Gt(),Wt());const R=()=>{var e,t;return!!((t=(e=window.analytics)==null?void 0:e.providers)!=null&&t.facebook)},Vt=()=>{var e,t,a,n;return!!((n=(a=(t=(e=window.analytics)==null?void 0:e.providers)==null?void 0:t.facebook)==null?void 0:a.blocks)!=null&&n.length)};class L{constructor(t){c(this,"list");this.list=t}getItems(){return Object.values(this.list.items).reduce((t,a,n)=>(t[n]={id:a.sku,content_category:a.categories.join(" > "),content_name:a.name,content_type:"product",currency:a.currency,quantity:a.quantity,value:a.final_price},t),[])}}let Yt=class{constructor(t){c(this,"list");this.list=t}getData(){const a=new L(this.list).getItems(),n=a.reduce((s,i)=>s+i.quantity*i.value,0);return{contents:a,content_type:"product",content_name:"Cart",currency:this.list.currency,value:n}}},Xt=class{constructor(t){c(this,"list");this.list=t}getData(){const a=new L(this.list).getItems(),n=a.reduce((s,i)=>s+i.quantity*i.value,0);return{contents:a,content_type:"product",content_name:"Wishlist",currency:this.list.currency,value:n}}},Z=class{constructor(t){c(this,"list");this.list=t}getData(){return{contents:new L(this.list).getItems(),content_type:"product",content_name:this.list.name,currency:this.list.currency,value:this.list.value}}};const Zt=()=>{document.addEventListener("analyticsOnItemsUpdate",function(e){var h;const{context:t,action:a,list:n,product:s,target:i}=e.detail,o=(h=window.analytics)==null?void 0:h.list[n.id];if(!f(o))return;let r=o.items[s.id].quantity;i==="redirect"&&(r-=1);const l=s.quantity,p=O({context:t,currentQuantity:r,newQuantity:l}),m=E({action:a,currentQuantity:r,newQuantity:l}),g=q({list_id:n.id,product_id:s.id,updatedQuantity:p});let u,w,y;switch(`${t}_${m}`){case"catalog_cart_add":case"cart_add":u=new Yt(g),w=u.getData(),y="AddToCart";break;case"catalog_wishlist_add":u=new Xt(g),w=u.getData(),y="AddToWishlist";break;default:return}fbq("track",y,w)})},te=()=>{document.addEventListener("analyticsPaymentMethodChanged",function(){fbq("track","AddPaymentInfo")})},ee=()=>{document.addEventListener("analyticsFastCheckout",function(e){const{list:t}=e.detail,n=new Z(t).getData();fbq("track","InitiateCheckout",n)})},ae=()=>{document.addEventListener("analyticsUserSubscribes",function(){fbq("track","CompleteRegistration")})};R()&&(k()&&(Zt(),ee()),te(),ae());const ne=()=>{var t,a;let e;switch((a=(t=window.analytics)==null?void 0:t.custom)==null?void 0:a.event){case"register":e="CompleteRegistration";break;default:return}window.addEventListener("CookiebotOnAccept",function(){fbq("track",e)},!1)};!R()||!C()||ne();let se=class{constructor(t,{block:a}){c(this,"list");c(this,"block");this.list=t,this.block=a}getData(){return{contents:new L(this.list).getItems(),content_type:"product_group",content_name:this.list.name}}};const ie=e=>{const t=window.analytics.list[e.list.id];if(!f(t))return;const n=new se(t,{block:e}).getData();window.addEventListener("CookiebotOnAccept",function(){fbq("track",e.event,n)},!1)},oe=()=>{Object.values(window.analytics.providers.facebook.blocks).forEach(e=>{ie(e)})};!k()||!Vt()||oe();let ce=class{constructor(t){c(this,"list");this.list=t}getData(){var n,s,i;return{contents:new L(this.list).getItems(),content_type:(i=(s=(n=window.analytics)==null?void 0:n.providers)==null?void 0:s.facebook)==null?void 0:i.content_type,content_name:this.list.name,currency:this.list.currency,value:this.list.value}}},re=class{constructor(t){c(this,"list");this.list=t}getData(){var n,s,i;return{contents:new L(this.list).getItems(),content_type:(i=(s=(n=window.analytics)==null?void 0:n.providers)==null?void 0:s.facebook)==null?void 0:i.content_type,content_name:this.list.name}}},de=class{constructor(t){c(this,"list");this.list=t}getData(){var o,d,r;const a=new L(this.list).getItems(),[n]=Object.keys(this.list.items),s=this.list.items[n],[i]=a;return s.children?i.content_ids=s.children:i.content_ids=[i.id],{...i,content_type:(r=(d=(o=window.analytics)==null?void 0:o.providers)==null?void 0:d.facebook)==null?void 0:r.content_type}}},le=class{constructor(t){c(this,"list");this.list=t}getData(){var s,i,o,d;const a=new L(this.list).getItems(),n=(s=window.analytics)==null?void 0:s.info;return{contents:a,content_type:(d=(o=(i=window.analytics)==null?void 0:i.providers)==null?void 0:o.facebook)==null?void 0:d.content_type,search_string:n==null?void 0:n.search_text}}};class V{constructor(t,a){c(this,"list");c(this,"sendDefaultEvent");this.list=t,this.sendDefaultEvent=a}getData(){var n,s,i;return{contents:new L(this.list).getItems(),content_type:(i=(s=(n=window.analytics)==null?void 0:n.providers)==null?void 0:s.facebook)==null?void 0:i.content_type,content_name:this.list.name,currency:this.list.currency,value:this.sendDefaultEvent?this.list.value:this.list.operational_margin}}}const tt=(e,t)=>{if(!f(e))return;let a,n;switch(window.analytics.page){case"cart":if(e.id=="cart")a=new ce(e),n=a.getData();else return;break;case"category":a=new re(e),n=a.getData();break;case"checkout":if(e.id=="checkout")a=new Z(e),n=a.getData();else return;break;case"product":if(e.id=="product-detail")a=new de(e),n=a.getData();else return;break;case"search":if(e.id=="search")a=new le(e),n=a.getData();else return;break;case"success":if(e.id=="purchase"&&localStorage.getItem("transaction_id")!==window.analytics.list.purchase.transaction_id)a=new V(e,!0),n=a.getData();else return;break;default:return}t?fbq("track",window.analytics.providers.facebook.event,n):window.addEventListener("CookiebotOnAccept",function(){if(window.analytics.page=="success"){fbq("track",window.analytics.providers.facebook.event,n,{eventID:e.transaction_id});const i=new V(e,!1).getData();fbq("trackCustom","PurchaseMargin",i,{eventID:e.transaction_id})}else fbq("track",window.analytics.providers.facebook.event,n)},!1)},ue=()=>{Object.values(window.analytics.list).forEach(e=>{tt(e,!1)})},we=()=>{document.addEventListener("analyticsLoadMoreItems",function(e){const{list:t}=e.detail;tt(t,!0)})};!k()||!R()||(ue(),we());const F=()=>{var e,t;return!!((t=(e=window.analytics)==null?void 0:e.providers)!=null&&t.reddit)},pe=()=>{var e,t,a;return!!((a=(t=(e=window.analytics)==null?void 0:e.providers)==null?void 0:t.reddit)!=null&&a.event)};let ye=class{constructor(t){c(this,"list");this.list=t}getData(){const t=Object.values(this.list.items).reduce((n,s)=>n+s.quantity*s.price,0),a=Object.values(this.list.items).reduce((n,s)=>n+s.quantity,0);return{currency:this.list.currency,itemCount:a,value:t}}},ge=class{constructor(t){c(this,"list");this.list=t}getData(){const t=Object.values(this.list.items).reduce((n,s)=>n+s.quantity*s.price,0),a=Object.values(this.list.items).reduce((n,s)=>n+s.quantity,0);return{currency:this.list.currency,itemCount:a,value:t}}};const me=()=>{document.addEventListener("analyticsOnItemsUpdate",function(e){var h,v,I;const{context:t,action:a,list:n,product:s,target:i}=e.detail,o=(h=window.analytics)==null?void 0:h.list[n.id];if(!f(o))return;let r=o.items[s.id].quantity;i==="redirect"&&(r-=1);const l=s.quantity,p=O({context:t,currentQuantity:r,newQuantity:l}),m=E({action:a,currentQuantity:r,newQuantity:l}),g=q({list_id:n.id,product_id:s.id,updatedQuantity:p});let u,w,y;switch(`${t}_${m}`){case"catalog_cart_add":case"cart_add":u=new ye(g),w=u.getData(),y="AddToCart";break;case"catalog_wishlist_add":u=new ge(g),w=u.getData(),y="AddToWishlist";break;default:return}(I=(v=window.Cookiebot)==null?void 0:v.consent)!=null&&I.marketing&&rdt("track",y,w)})},he=()=>{document.addEventListener("analyticsFastCheckout",function(){var e,t;(t=(e=window.Cookiebot)==null?void 0:e.consent)!=null&&t.marketing&&rdt("track","ViewContent")})};F()&&k()&&(me(),he());const fe=()=>{var t,a;let e;switch((a=(t=window.analytics)==null?void 0:t.custom)==null?void 0:a.event){case"register":e="SignUp";break;default:return}window.addEventListener("CookiebotOnAccept",function(){var n,s;(s=(n=window.Cookiebot)==null?void 0:n.consent)!=null&&s.marketing&&rdt("track",e)},!1)};!F()||!C()||fe();class ve{constructor(t){c(this,"list");this.list=t}getData(){return{transactionId:this.list.transaction_id,currency:this.list.currency,itemCount:this.list.quantity,value:this.list.value}}}const ke=e=>{if(!f(e))return;let t,a,n;switch(window.analytics.page){case"homepage":case"cart":case"category":case"checkout":case"product":case"search":n=!1;break;case"success":if(e.id=="purchase"&&localStorage.getItem("transaction_id")!==window.analytics.list.purchase.transaction_id)t=new ve(e),a=t.getData(),n=!0;else return;break;default:return}window.addEventListener("CookiebotOnAccept",function(){var s,i;(i=(s=window.Cookiebot)==null?void 0:s.consent)!=null&&i.marketing&&(n?rdt("track",window.analytics.providers.reddit.event,a):rdt("track",window.analytics.providers.reddit.event))},!1)},Ae=()=>{Object.values(window.analytics.list).forEach(e=>{ke(e)})};!k()||!F()||!pe()||Ae();const B=()=>{var e,t;return!!((t=(e=window.analytics)==null?void 0:e.providers)!=null&&t.tiktok)},_e=()=>{var e,t,a,n;return!!((n=(a=(t=(e=window.analytics)==null?void 0:e.providers)==null?void 0:t.tiktok)==null?void 0:a.blocks)!=null&&n.length)};class T{constructor(t){c(this,"list");this.list=t}getItems(){return Object.values(this.list.items).reduce((t,a,n)=>(t[n]={content_id:a.sku,content_type:"product",content_name:a.name,quantity:a.quantity,price:a.final_price,content_category:a.categories.join(" > ")},t),[])}}let be=class{constructor(t){c(this,"list");this.list=t}getData(){return{contents:new T(this.list).getItems()}}},De=class{constructor(t){c(this,"list");this.list=t}getData(){return{contents:new T(this.list).getItems()}}},Te=class{constructor(t){c(this,"list");this.list=t}getData(){const a=new T(this.list).getItems(),[n]=a;return{...n}}},et=class{constructor(t){c(this,"list");this.list=t}getData(){return{contents:new T(this.list).getItems(),content_name:this.list.name,currency:this.list.currency,value:this.list.value}}};const Le=()=>{document.addEventListener("analyticsOnItemsUpdate",function(e){var h,v,I;const{context:t,action:a,list:n,product:s,target:i}=e.detail,o=(h=window.analytics)==null?void 0:h.list[n.id];if(!f(o))return;let r=o.items[s.id].quantity;i==="redirect"&&(r-=1);const l=s.quantity,p=O({context:t,currentQuantity:r,newQuantity:l}),m=E({action:a,currentQuantity:r,newQuantity:l}),g=q({list_id:n.id,product_id:s.id,updatedQuantity:p});let u,w,y;switch(`${t}_${m}`){case"catalog_cart_add":case"cart_add":u=new be(g),w=u.getData(),y="AddToCart";break;case"catalog_wishlist_add":u=new De(g),w=u.getData(),y="AddToWishlist";break;default:return}(I=(v=window.Cookiebot)==null?void 0:v.consent)!=null&&I.marketing&&ttq.track(y,w)})},Ie=()=>{document.addEventListener("analyticsSelectProductItem",function(e){var r;const{productItemProps:t}=e.detail,{list_id:a,product_id:n}=t,s=window.analytics.list[a];if(!f(s))return;const i={...window.analytics.list[a],items:{[n]:{...(r=window.analytics.list[a])==null?void 0:r.items[n]}}},d=new Te(i).getData();ttq.track("ClickButton",d)})},$e=()=>{document.addEventListener("analyticsPaymentMethodChanged",function(){var e,t;(t=(e=window.Cookiebot)==null?void 0:e.consent)!=null&&t.marketing&&ttq.track("AddPaymentInfo")})},Ce=()=>{document.addEventListener("analyticsFastCheckout",function(e){var s,i;if(!((i=(s=window.Cookiebot)==null?void 0:s.consent)!=null&&i.marketing))return;const{list:t}=e.detail,n=new et(t).getData();ttq.track("InitiateCheckout",n)})},Ee=()=>{document.addEventListener("analyticsUserSubscribes",function(){var e,t;(t=(e=window.Cookiebot)==null?void 0:e.consent)!=null&&t.marketing&&ttq.track("Subscribe")})};B()&&(k()&&(Le(),Ie(),Ce()),$e(),Ee());const Oe=()=>{var t,a;let e;switch((a=(t=window.analytics)==null?void 0:t.custom)==null?void 0:a.event){case"register":e="CompleteRegistration";break;default:return}window.addEventListener("CookiebotOnAccept",function(){var n,s;(s=(n=window.Cookiebot)==null?void 0:n.consent)!=null&&s.marketing&&ttq.track(e)},!1)};!B()||!C()||Oe();let qe=class{constructor(t,{block:a}){c(this,"list");c(this,"block");this.list=t,this.block=a}getData(){return{contents:new T(this.list).getItems(),content_name:this.list.name}}};const Se=e=>{const t=window.analytics.list[e.list.id];if(!f(t))return;const n=new qe(t,{block:e}).getData();window.addEventListener("CookiebotOnAccept",function(){ttq.track(e.event,n)},!1)},Me=()=>{Object.values(window.analytics.providers.tiktok.blocks).forEach(e=>{Se(e)})};!k()||!_e()||Me();let je=class{constructor(t){c(this,"list");this.list=t}getData(){return{contents:new T(this.list).getItems(),content_name:this.list.name,currency:this.list.currency,value:this.list.value}}},Pe=class{constructor(t){c(this,"list");this.list=t}getData(){return{contents:new T(this.list).getItems(),content_name:this.list.name}}},Re=class{constructor(t){c(this,"list");this.list=t}getData(){const a=new T(this.list).getItems(),[n]=a;return{...n}}},Fe=class{constructor(t){c(this,"list");this.list=t}getData(){var s;const a=new T(this.list).getItems(),n=(s=window.analytics)==null?void 0:s.info;return{contents:a,content_name:this.list.name,query:n==null?void 0:n.search_text}}};class Be{constructor(t){c(this,"list");this.list=t}getData(){return{contents:new T(this.list).getItems(),content_name:this.list.name,currency:this.list.currency,value:this.list.value}}}const at=(e,t)=>{var s,i;if(!f(e))return;let a,n;switch(window.analytics.page){case"cart":if(e.id=="cart")a=new je(e),n=a.getData();else return;break;case"category":a=new Pe(e),n=a.getData();break;case"checkout":if(e.id=="checkout")a=new et(e),n=a.getData();else return;break;case"product":if(e.id=="product-detail")a=new Re(e),n=a.getData();else return;break;case"search":if(e.id=="search")a=new Fe(e),n=a.getData();else return;break;case"success":if(e.id=="purchase"&&localStorage.getItem("transaction_id")!==window.analytics.list.purchase.transaction_id)a=new Be(e),n=a.getData();else return;break;default:return}if(t){if(!((i=(s=window.Cookiebot)==null?void 0:s.consent)!=null&&i.marketing))return;ttq.track(window.analytics.providers.tiktok.event,n)}else window.addEventListener("CookiebotOnAccept",function(){var o,d;(d=(o=window.Cookiebot)==null?void 0:o.consent)!=null&&d.marketing&&(window.analytics.page=="success"?ttq.track(window.analytics.providers.tiktok.event,n,{event_id:e.transaction_id}):ttq.track(window.analytics.providers.tiktok.event,n))},!1)},xe=()=>{Object.values(window.analytics.list).forEach(e=>{at(e,!1)})},He=()=>{document.addEventListener("analyticsLoadMoreItems",function(e){const{list:t}=e.detail;at(t,!0)})};!k()||!B()||(xe(),He());const x=()=>{var e,t;return!!((t=(e=window.analytics)==null?void 0:e.providers)!=null&&t.twitter)},Ue=()=>{var e,t,a;return!!((a=(t=(e=window.analytics)==null?void 0:e.providers)==null?void 0:t.twitter)!=null&&a.current_page_event_id)},Ne=()=>{var e,t,a,n;return!!((n=(a=(t=(e=window.analytics)==null?void 0:e.providers)==null?void 0:t.twitter)==null?void 0:a.blocks)!=null&&n.length)};class ${constructor(t,{hasContentGroupId:a=!1}){c(this,"list");c(this,"hasContentGroupId");this.list=t,this.hasContentGroupId=a}getItems(){return Object.values(this.list.items).reduce((t,a,n)=>(t[n]={content_id:a.sku,content_type:a.categories.join(" > "),content_name:a.name,num_items:a.quantity,content_price:a.final_price},this.hasContentGroupId&&(t[n].content_group_id=this.list.name?this.list.name.split(" ").join("-").toLowerCase():""),t),[])}}let Je=class{constructor(t){c(this,"list");this.list=t}getData(){return{contents:new $(this.list,{}).getItems()}}},Qe=class{constructor(t){c(this,"list");this.list=t}getData(){return{contents:new $(this.list,{}).getItems()}}},nt=class{constructor(t){c(this,"list");this.list=t}getData(){return{contents:new $(this.list,{}).getItems(),currency:this.list.currency,value:this.list.value}}};const Ge=()=>{document.addEventListener("analyticsOnItemsUpdate",function(e){var h,v,I,U,N,J,Q,G,W,K,z;const{context:t,action:a,list:n,product:s,target:i}=e.detail,o=(h=window.analytics)==null?void 0:h.list[n.id];if(!f(o))return;let r=o.items[s.id].quantity;i==="redirect"&&(r-=1);const l=s.quantity,p=O({context:t,currentQuantity:r,newQuantity:l}),m=E({action:a,currentQuantity:r,newQuantity:l}),g=q({list_id:n.id,product_id:s.id,updatedQuantity:p});let u,w,y;switch(`${t}_${m}`){case"catalog_cart_add":case"cart_add":u=new Je(g),w=u.getData(),y=(N=(U=(I=(v=window.analytics)==null?void 0:v.providers)==null?void 0:I.twitter)==null?void 0:U.configuration)==null?void 0:N.add_to_cart_event_id;break;case"catalog_wishlist_add":u=new Qe(g),w=u.getData(),y=(W=(G=(Q=(J=window.analytics)==null?void 0:J.providers)==null?void 0:Q.twitter)==null?void 0:G.configuration)==null?void 0:W.add_to_wishlist_event_id;break;default:return}!((z=(K=window.Cookiebot)==null?void 0:K.consent)!=null&&z.marketing)||!y||twq("event",y,w)})},We=()=>{document.addEventListener("analyticsPaymentMethodChanged",function(){var t,a,n,s,i,o;const e=(s=(n=(a=(t=window.analytics)==null?void 0:t.providers)==null?void 0:a.twitter)==null?void 0:n.configuration)==null?void 0:s.add_payment_info_id;!((o=(i=window.Cookiebot)==null?void 0:i.consent)!=null&&o.marketing)||!e||twq("event",e)})},Ke=()=>{document.addEventListener("analyticsFastCheckout",function(e){var i,o,d,r,l,p;const t=(r=(d=(o=(i=window.analytics)==null?void 0:i.providers)==null?void 0:o.twitter)==null?void 0:d.configuration)==null?void 0:r.checkout_init_id;if(!((p=(l=window.Cookiebot)==null?void 0:l.consent)!=null&&p.marketing)||!t)return;const{list:a}=e.detail,s=new nt(a).getData();twq("event",t,s)})},ze=()=>{document.addEventListener("analyticsUserSubscribes",function(){var t,a,n,s,i,o;if(!((a=(t=window.Cookiebot)==null?void 0:t.consent)!=null&&a.marketing))return;const e=(o=(i=(s=(n=window.analytics)==null?void 0:n.providers)==null?void 0:s.twitter)==null?void 0:i.configuration)==null?void 0:o.subscribe_id;twq("event",e)})};x()&&(k()&&(Ge(),Ke()),We(),ze());let Ve=class{constructor(t,{block:a}){c(this,"list");c(this,"block");this.list=t,this.block=a}getData(){return{contents:new $(this.list,{hasContentGroupId:!0}).getItems()}}};const Ye=e=>{const t=window.analytics.list[e.list.id];if(!f(t))return;const n=new Ve(t,{block:e}).getData();window.addEventListener("CookiebotOnAccept",function(){twq("event",e.event_id,n)},!1)},Xe=()=>{Object.values(window.analytics.providers.twitter.blocks).forEach(e=>{Ye(e)})};!k()||!Ne()||Xe();const Ze=()=>{var t,a,n,s,i,o;let e;switch((a=(t=window.analytics)==null?void 0:t.custom)==null?void 0:a.event){case"register":e=(o=(i=(s=(n=window.analytics)==null?void 0:n.providers)==null?void 0:s.twitter)==null?void 0:i.configuration)==null?void 0:o.sign_up_id;break;default:return}window.addEventListener("CookiebotOnAccept",function(){var d,r;!((r=(d=window.Cookiebot)==null?void 0:d.consent)!=null&&r.marketing)||!e||twq("event",e)},!1)};!x()||!C()||Ze();let ta=class{constructor(t){c(this,"list");this.list=t}getData(){return{contents:new $(this.list,{}).getItems()}}},ea=class{constructor(t){c(this,"list");this.list=t}getData(){return{contents:new $(this.list,{}).getItems()}}},aa=class{constructor(t){c(this,"list");this.list=t}getData(){var s;const a=new $(this.list,{}).getItems(),n=(s=window.analytics)==null?void 0:s.info;return{contents:a,search_string:n==null?void 0:n.search_text}}};class na{constructor(t){c(this,"list");this.list=t}getData(){return{contents:new $(this.list,{}).getItems(),conversion_id:this.list.transaction_id,currency:this.list.currency,value:this.list.value}}}const st=(e,t)=>{var s,i;if(!f(e))return;let a,n;switch(window.analytics.page){case"category":a=new ta(e),n=a.getData();break;case"checkout":if(e.id=="checkout")a=new nt(e),n=a.getData();else return;break;case"product":if(e.id=="product-detail")a=new ea(e),n=a.getData();else return;break;case"search":if(e.id=="search")a=new aa(e),n=a.getData();else return;break;case"success":if(e.id=="purchase"&&localStorage.getItem("transaction_id")!==window.analytics.list.purchase.transaction_id)a=new na(e),n=a.getData();else return;break;default:return}if(t){if(!((i=(s=window.Cookiebot)==null?void 0:s.consent)!=null&&i.marketing))return;twq("event",window.analytics.providers.twitter.current_page_event_id,n)}else window.addEventListener("CookiebotOnAccept",function(){var o,d;(d=(o=window.Cookiebot)==null?void 0:o.consent)!=null&&d.marketing&&twq("event",window.analytics.providers.twitter.current_page_event_id,n)},!1)},sa=()=>{Object.values(window.analytics.list).forEach(e=>{st(e,!1)})},ia=()=>{document.addEventListener("analyticsLoadMoreItems",function(e){const{list:t}=e.detail;st(t,!0)})};!k()||!x()||!Ue()||(sa(),ia());const it=()=>{var e,t;return!!((t=(e=window.analytics)==null?void 0:e.providers)!=null&&t.rtbhouse)},ot=()=>window.analytics.customer.email_hash?`C2B_${window.analytics.customer.email_hash}`:"unknown";let oa=class{constructor(t){c(this,"list");this.list=t}getData(){const[t]=Object.keys(this.list.items),a=this.list.items[t];return{eventType:"basketadd",offerId:`${window.analytics.country}-${a.sku}`}}},ca=class{constructor(t){c(this,"list");this.list=t}getData(){const[t]=Object.keys(this.list.items),a=this.list.items[t];return{eventType:"wishlist",offerId:`${window.analytics.country}-${a.sku}`}}},ct=class{constructor(){}getData(){return{eventType:"startorder"}}};const ra=()=>{document.addEventListener("analyticsOnItemsUpdate",function(e){var y,h,v;const{context:t,action:a,list:n,product:s,target:i}=e.detail,o=(y=window.analytics)==null?void 0:y.list[n.id];if(!f(o))return;let r=o.items[s.id].quantity;i==="redirect"&&(r-=1);const l=s.quantity,p=O({context:t,currentQuantity:r,newQuantity:l}),m=E({action:a,currentQuantity:r,newQuantity:l}),g=q({list_id:n.id,product_id:s.id,updatedQuantity:p});let u,w;switch(`${t}_${m}`){case"catalog_cart_add":case"cart_add":u=new oa(g),w=u.getData();break;case"catalog_wishlist_add":u=new ca(g),w=u.getData();break;default:return}(v=(h=window.Cookiebot)==null?void 0:h.consent)!=null&&v.marketing&&(window.rtbhEvents=window.rtbhEvents||[]).push(w,{eventType:"uid",id:window.analytics.customer.email_hash||"unknown"})})},da=()=>{document.addEventListener("analyticsFastCheckout",function(){var a,n;if(!((n=(a=window.Cookiebot)==null?void 0:a.consent)!=null&&n.marketing))return;const t=new ct().getData();(window.rtbhEvents=window.rtbhEvents||[]).push(t,{eventType:"uid",id:ot()})})};it()&&k()&&(ra(),da());let la=class{constructor(){}getData(){return{eventType:window.analytics.providers.rtbhouse.event_type}}};class H{constructor(t){c(this,"list");this.list=t}getItems(){return Object.values(this.list.items).reduce((t,a)=>(t[a.index]=`${window.analytics.country}-${a.sku}`,t),[])}}let ua=class{constructor(t){c(this,"list");this.list=t}getData(){const a=new H(this.list).getItems();return{eventType:window.analytics.providers.rtbhouse.event_type,offerIds:a}}},wa=class{constructor(){}getData(){return window.analytics.providers.rtbhouse.event_type=="category"?{eventType:window.analytics.providers.rtbhouse.event_type,categoryId:`${window.analytics.country}-${window.analytics.providers.rtbhouse.page_id}`}:{eventType:window.analytics.providers.rtbhouse.event_type}}},pa=class{constructor(){}getData(){return{eventType:window.analytics.providers.rtbhouse.event_type,offerId:`${window.analytics.country}-${window.analytics.providers.rtbhouse.page_id}`}}},ya=class{constructor(t){c(this,"list");this.list=t}getData(){const a=new H(this.list).getItems();return{eventType:window.analytics.providers.rtbhouse.event_type,offerIds:a}}},ga=class{constructor(t){c(this,"list");this.list=t}getData(){const a=new H(this.list).getItems();return{eventType:window.analytics.providers.rtbhouse.event_type,offerIds:a,conversionClass:"order",conversionSubClass:"purchase",conversionId:this.list.transaction_id,conversionValue:this.list.value.toString(),conversionCurrency:this.list.currency}}};class ma{constructor(){}getData(){return{eventType:window.analytics.providers.rtbhouse.event_type}}}const ha=e=>{if(!f(e))return;let t,a;switch(window.analytics.page){case"homepage":t=new la,a=t.getData();break;case"cart":if(e.id=="cart")t=new ua(e),a=t.getData();else return;break;case"category":t=new wa,a=t.getData();break;case"checkout":if(e.id=="checkout")t=new ct,a=t.getData();else return;break;case"product":if(e.id=="product-detail")t=new pa,a=t.getData();else return;break;case"search":if(e.id=="search")t=new ya(e),a=t.getData();else return;break;case"success":if(e.id=="purchase"&&localStorage.getItem("transaction_id")!==window.analytics.list.purchase.transaction_id)t=new ga(e),a=t.getData();else return;break;default:return}window.addEventListener("CookiebotOnAccept",function(){var n,s;(s=(n=window.Cookiebot)==null?void 0:n.consent)!=null&&s.marketing&&(window.rtbhEvents=window.rtbhEvents||[]).push(a,{eventType:"uid",id:ot()})},!1)},fa=()=>{Object.values(window.analytics.list).forEach(e=>{ha(e)})},va=()=>{if(window.analytics.page!="other")return;const t=new ma().getData();window.addEventListener("CookiebotOnAccept",function(){var a,n;(n=(a=window.Cookiebot)==null?void 0:a.consent)!=null&&n.marketing&&(window.rtbhEvents=window.rtbhEvents||[]).push(t,{eventType:"uid",id:window.analytics.customer.email_hash||"unknown"})},!1)};(()=>{if(it()){if(!k()){va();return}fa()}})();const ka=()=>{var e,t;return!!((t=(e=window.analytics)==null?void 0:e.providers)!=null&&t.bing)};class Aa{constructor(t){c(this,"list");this.list=t}getData(){return{currency:this.list.currency,revenue_value:this.list.value}}}const _a=e=>{if(!f(e))return;let t,a;switch(window.analytics.page){case"success":if(e.id=="purchase"&&localStorage.getItem("transaction_id")!==window.analytics.list.purchase.transaction_id)t=new Aa(e),a=t.getData();else return;break;default:return}window.addEventListener("CookiebotOnAccept",function(){var n,s;(s=(n=window.Cookiebot)==null?void 0:n.consent)!=null&&s.marketing&&(window.uetq=window.uetq||[],window.uetq.push("set",{pid:{em:window.analytics.info.customer.email,ph:window.analytics.info.customer.phone}}),window.uetq.push("event","",a))},!1)},ba=()=>{Object.values(window.analytics.list).forEach(e=>{_a(e)})};!k()||!ka()||ba();const Da=()=>{var e,t;return!!((t=(e=window.analytics)==null?void 0:e.providers)!=null&&t.hotjar)};class Ta{constructor(t){c(this,"list");this.list=t}getData(){var t,a,n;return{user_id:(n=(a=(t=window.analytics)==null?void 0:t.info)==null?void 0:a.customer)==null?void 0:n.email,attributes:{transaction_id:this.list.transaction_id}}}}const La=e=>{if(!f(e))return;let t,a,n=[];switch(window.analytics.page){case"product":if(e.id=="product-detail")e.is_description_by_ai&&n.push("product_description_by_ai");else return;break;case"success":if(e.id=="purchase"&&localStorage.getItem("transaction_id")!==window.analytics.list.purchase.transaction_id)t=new Ta(e),a=t.getData();else return;break;default:return}window.addEventListener("CookiebotOnAccept",function(){var s,i;(i=(s=window.Cookiebot)==null?void 0:s.consent)!=null&&i.marketing&&(window.hj=window.hj||function(){(hj.q=hj.q||[]).push(arguments)},n.length&&n.forEach(o=>window.hj("event",o)),a&&window.hj("identify",a.user_id,a.attributes))},!1)},Ia=()=>{Object.values(window.analytics.list).forEach(e=>{La(e)})};!Da()||!k()||Ia();const $a=()=>{document.addEventListener("click",e=>{const t=e.target.closest('[data-analytics-event="select"]');if(!t||e.target.closest('[data-analytics-event="none"]'))return;const n=t.getAttribute("data-analytics-props");if(!n)return;const s=JSON.parse(n);D("analyticsSelectProductItem",{productItemProps:s});const i=t.getAttribute("data-internal-analytics-props");i&&D("internalAnalytics",JSON.parse(i))},!1)},Ca=()=>{document.addEventListener("click",t=>{const a=t.target.closest('[data-internal-analytics-event="click"]');if(!a)return;const n=a.getAttribute("data-internal-analytics-props");n&&D("internalAnalytics",JSON.parse(n))},!1);const e=document.querySelectorAll('[data-internal-analytics-event="view"]');for(const t of e){const a=t.getAttribute("data-internal-analytics-props");if(!a)return;D("internalAnalytics",JSON.parse(a))}},Ea=()=>{window.addEventListener("CookiebotOnAccept",function(){var e,t,a,n,s;switch((t=(e=window.analytics)==null?void 0:e.custom)==null?void 0:t.event){case"add_to_cart_redirect":const i="cart",o=(n=(a=window.analytics)==null?void 0:a.custom)==null?void 0:n.info,d=(s=window.analytics)==null?void 0:s.list[i];if(!f(d)&&!o)return;const l=d.items[o].quantity;D("analyticsOnItemsUpdate",{context:"cart",action:"add",target:"redirect",type:"product_redirect",list:{id:i},product:{id:o,quantity:l}});break;default:return}},!1)};$a(),Ca(),C()&&Ea();const Oa=()=>{document.addEventListener("analyticsLoadMoreItems",function(e){const{list:t,reset:a}=e.detail;f(t)&&(a?window.analytics.list[t.id].items={...t.items}:window.analytics.list[t.id].items={...window.analytics.list[t.id].items,...t.items})})},qa=()=>{document.addEventListener("analyticsOnItemsUpdate",function(e){var i,o;const{list:t,product:a}=e.detail,n=(i=window.analytics)==null?void 0:i.list[t.id],s=window.analytics.page;console.log("list.id",t.id),console.log("analyticsList",n),a.quantity===0?delete n.items[a.id]:(s==="cart"||s==="checkout")&&((o=window.analytics)!=null&&o.list[s].items[a.id]?t.id==="cart"||t.id==="checkout"?n.items[a.id].quantity=a.quantity:window.analytics.list[s].items[a.id].quantity+=a.quantity:window.analytics.list[s].items[a.id]=n.items[a.id])})};Oa(),qa();const Sa=()=>{if(window.analytics.page==="success")if(localStorage.getItem("transaction_id")!==window.analytics.list.purchase.transaction_id)localStorage.setItem("transaction_id",window.analytics.list.purchase.transaction_id);else{window.location.reload();return}};Sa(); //# sourceMappingURL=production-analytics.js.map