PageSourceSearch

https://www.lubiezwierzaki.pl/application/assets/storefront/chunk-analytics_initializer.BXM-rb7.js

js lubiezwierzaki.pl collected 2026-10-08 08:01:05 UTC 43,581 bytes, 1 lines download raw bytes

1import{L as _e,a6 as me,J as B,bJ as u,bK as ge,b as y,bL as Y,P as pe,Z as ye,bM as P,Q as g,A as p,bN as k,bO as Ee,aP as v,bP as ve,bQ as Ae,K as Ce,a4 as T,bR as Se,bq as O,bS as fe,bT as Ie,bU as Pe,N as Te,q as we,o as Ne,M as ke,r as be,C as Be,bV as Me}from"./storefrontApp.DHj_rTVq.min.js";import{e as f,J as Ge}from"./chunk-vendor-lit.NvY0u02.js";import{S as Oe}from"./chunk-storefront_base_lit_element.BDgKmPq.js";import{S as Ve}from"./chunk-storefront_settings_constants.DIF02Gz.js";import{M,A as x,d as G}from"./chunk-consents_saved_handler.BI2HwVq.js";import{U as K}from"./chunk-user_events.DVe_9j8.js";import"./chunk-vendor-di.Bh23gdA.js";import"./chunk-vendor-rxjs.Dp7kflo.js";import"./chunk-vendor-lodash.CWHFt7Z.js";import"./chunk-vendor-phoenix.cdKS79L.js";var J;J=_e;const Re=class z{constructor({id:e,name:n,price:t,producer:s,category:i,currency:o,list:r,variant:a,quantity:c=1,position:h}){this[J]=!0,this.id=e,this.name=n,this.price=t,this.producer=s,this.category=i,this.currency=o,this.list=r,this.variant=a,this.quantity=c,this.position=h}static create(e){return new z(e)}};let Le=Re;class Q{toModel(e){return Le.create(e)}}var xe=Object.defineProperty,I=(d,e,n,t)=>{for(var s=void 0,i=d.length-1,o;i>=0;i--)(o=d[i])&&(s=o(e,n,s)||s);return s&&xe(e,n,s),s};class C extends Oe{constructor(){super(),this.id="",this.name="",this.price=0,this.producer="",this.category="",this.currency="",this.list="",this.ANALYTICS_DELAY_MS=2e3,this._handleProductClick=()=>{me(()=>this._sendAnalyticsEvent(),this.ANALYTICS_DELAY_MS)},this._analyticsProductMapper=new Q}static{this.moduleName="product-link"}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._handleProductClick)}_sendAnalyticsEvent(){const e=this._createProductAnalyticsData();this.eventBus.emit(new B(u.selectedItem,this._analyticsProductMapper.toModel(e)))}_createProductAnalyticsData(){return{id:this.id,name:this.name,price:this.price,producer:this.producer,category:this.category,currency:this.currency,list:this.list}}}I([f({type:String})],C.prototype,"id");I([f({type:String})],C.prototype,"name");I([f({type:Number})],C.prototype,"price");I([f({type:String})],C.prototype,"producer");I([f({type:String})],C.prototype,"category");I([f({type:String})],C.prototype,"currency");I([f({type:String})],C.prototype,"list");const De="1",X="2",Z="3",ee="4",Fe="5",qe="6",Ue="7",$e="8",je="9",He="10",We="11",Ye="12",te="13",se="17",ne="18",ie="19",V="20",Ke="21",ae="23",oe="24",R="25",Je="26",ze="27",Qe="28",Xe="29",re="30",m={[De]:"mainPage",[X]:"productPage",[Z]:"productBundlePage",[ee]:"loyaltyProgramProductPage",[Fe]:"informationPage",[qe]:"blogArticlePage",[Ue]:"blogMainPage",[$e]:"blogCategoryPage",[je]:"blogTagPage",[He]:"offPage",[We]:"notFoundPage",[Ye]:"customerDashboardPage",[te]:"loyaltyProgramProductBundlePage",[se]:"producerPage",[ne]:"categoryPage",[ie]:"collectionPage",[V]:"searchResultsPage",[Ke]:"customerLoyaltyProgramProductsPage",[ae]:"promotionsPage",[oe]:"newProductsPage",[R]:"basketPage",[Je]:"orderConfirmationPage",[ze]:"paymentSuccessPage",[Qe]:"paymentFailedPage",[Xe]:"errorPage",[re]:"basketDeliveryAndPaymentPage"};class N{#e;constructor(e){this.#e=e.isFeatureEnabled("dev_enable_analytics_events_with_prefix")}getChannelName(e){return this.#e?e:this.getLegacyAnalyticsEventName(e)}getLegacyAnalyticsEventName(e){return e.replace(`${ge}.`,"")}}class Ze extends y{constructor({settingsApi:e,messageStorageApi:n}){super(),this.moduleName=Y.service,this._toObjectFromJsonScriptTag=t=>{const s=t.textContent;return Ge.fromJson(s)},this.#e=e,this.#t=n,this.#n=new N(e),this.#s=new Q,this.#i=e.isFeatureEnabled("dev_enable_analytics_events_with_prefix"),this.#a=e.isFeatureEnabled("dev_disable_analytics_events_without_prefix"),this._sendAndSetupEvents(),this.eventBus.on(pe.beforeVisited,()=>this._clearAnalyticChannelMessages())}#e;#t;#n;#s;#i;#a;_emitAnalyticsEvent(e,n){const t=this.#n.getLegacyAnalyticsEventName(e);this.#i?(this.eventBus.emit(new B(e,n)),this.#a||this.eventBus.emit(new B(t,n))):this.eventBus.emit(new B(t,n))}_sendAndSetupEvents(){this._sendAnalyticEvents(),this._setupEventListeners(),new ye(()=>{this._sendAnalyticEvents()})}_sendAnalyticEvents(){this._sendViewedItemEvent(),this._sendViewedItemListEvent(),this._sendViewedSearchResultsEvent()}_setupEventListeners(){this._setupAddToBasketEvent(),this._setupRemoveFromBasketEvent(),this._setupSetPaymentEvent(),this._setupSetShippingEvent(),this._setupPurchasedEvent(),this._setupViewedBasketEvent(),this._setupBeganCheckoutEvent()}_clearAnalyticChannelMessages(){this.#i&&(this.#t.removeChannelMessages(u.viewedItem),this.#t.removeChannelMessages(u.viewedItemList),this.#t.removeChannelMessages(u.viewedSearchResults),this.#t.removeChannelMessages(u.viewedBasket),this.#t.removeChannelMessages(u.beganCheckout)),(!this.#a||!this.#i)&&(this.#t.removeChannelMessages(P.viewedItem),this.#t.removeChannelMessages(P.viewedItemList),this.#t.removeChannelMessages(P.viewedSearchResults),this.#t.removeChannelMessages(P.viewedBasket),this.#t.removeChannelMessages(P.beganCheckout))}_sendViewedItemEvent(){if(this._isProductPage()){const e=document.getElementById("product-info"),n=this.#e.getSkinSettings().contextId;if(e){const t=this._toObjectFromJsonScriptTag(e),s=this.#s.toModel({id:t.id,name:t.name,price:t.price,producer:t.producer,category:t.category,currency:t.currency,list:m[
1n]||""});this._emitAnalyticsEvent(u.viewedItem,s)}}}_isProductPage(){const e=this.#e.getSkinSettings().contextId;return[X,Z,ee,te].indexOf(e)!==-1}_sendViewedItemListEvent(){if(this._isProductListPage()){const e=this.#e.getSkinSettings().contextId,t=[...document.querySelectorAll("product-list product-tile")].map((s,i)=>this.#s.toModel({id:s.getAttribute("product-id")||"",name:s.getAttribute("name")||"",price:parseFloat(s.getAttribute("price")||""),producer:s.getAttribute("producer")||"",category:s.getAttribute("category")||"",currency:s.getAttribute("currency")||"",list:m[e]||"",position:(i+1).toString()}));this._emitAnalyticsEvent(u.viewedItemList,t)}}_sendViewedSearchResultsEvent(){if(this._isSearchResults()){const e=this.#e.getSkinSettings().contextId,t=[...document.querySelectorAll("product-list product-tile")].map((i,o)=>this.#s.toModel({id:i.getAttribute("product-id")||"",name:i.getAttribute("name")||"",price:parseFloat(i.getAttribute("price")||""),producer:i.getAttribute("producer")||"",category:i.getAttribute("category")||"",currency:i.getAttribute("currency")||"",list:m[e]||"",position:(o+1).toString()})),s=new URL(location.href).searchParams.get("url");this._emitAnalyticsEvent(u.viewedSearchResults,{items:t,searchTerm:s})}}_isProductListPage(){const e=this.#e.getSkinSettings().contextId;return[se,ne,ie,V,ae,oe].indexOf(e)!==-1}_isSearchResults(){const e=this.#e.getSkinSettings().contextId;return[V].indexOf(e)!==-1}_sendBeganCheckoutEvent(){const e=this.queryBus.execute(new g(p.getApi,"basketProductsApi")),n=this.queryBus.execute(new g(p.getApi,k.api));Promise.all([e,n]).then(([t,s])=>{t&&this._emitAnalyticsEvent(u.beganCheckout,{items:t?.get().map(i=>this.#s.toModel({id:String(i.productId),name:i.name,price:i.price.grossValue,producer:i.producer?.name||"",category:i.category?.name||"",currency:i.price.currency,list:"basket step 2",quantity:i.quantity,variant:i.options.map(o=>`${o.name}: ${o.value}`).join(", ")})),basket:{sum:s?.getSum(),sumWithoutPaymentAndShipping:s?.getSumWithoutPaymentAndShipping(),productsSum:t?.getSum()}})})}_sendViewedBasketEvent(){const e=this.queryBus.execute(new g(p.getApi,"basketProductsApi")),n=this.queryBus.execute(new g(p.getApi,k.api)),t=this.queryBus.execute(new g(p.getApi,Ee.api));Promise.all([e,n,t]).then(([s,i,o])=>{s&&this._emitAnalyticsEvent(u.viewedBasket,{items:s?.get().map(r=>this.#s.toModel({id:String(r.productId),name:r.name,price:r.price.grossValue,producer:r.producer?.name||"",category:r.category?.name||"",currency:r.price.currency,list:"basket step 1",quantity:r.quantity,variant:r.options.map(a=>`${a.name}: ${a.value}`).join(", ")})),basket:{sum:i?.getSum(),sumWithoutPaymentAndShipping:i?.getSumWithoutPaymentAndShipping(),productsSum:s?.getSum(),promotionCode:o?.getPromotionCode()||null}})})}_setupAddToBasketEvent(){this.eventBus.on(v.itemAddedToBasket,({body:e})=>{const{addedItem:n,product:t}=e,s=this.#e.getSkinSettings().contextId,i=this.#s.toModel({id:t.productId,name:t.name,price:t.price.grossValue,producer:t.producer?.name||"",category:t.category?.name||"",currency:t.price.currency,list:m[s],quantity:n.addedQuantity,variant:t.options.map(o=>`${o.name}: ${o.value}`).join(", ")});this._emitAnalyticsEvent(u.addedToBasket,i)})}_setupRemoveFromBasketEvent(){this.eventBus.on(v.itemRemovedFromBasket,({body:e})=>{if(!e)return;const n=this.#e.getSkinSettings().contextId,t=this.#s.toModel({id:String(e.productId),name:e.name,price:e.price.grossValue,producer:e.producer?.name||"",category:e.category?.name||"",currency:e.price.currency,list:m[n],quantity:e.quantity,variant:e.options.map(s=>`${s.name}: ${s.value}`).join(", ")});this._emitAnalyticsEvent(u.removedFromBasket,t)})}_setupSetPaymentEvent(){this.eventBus.on(v.setPayment,()=>{const e=this.queryBus.execute(new g(p.getApi,ve.api)),n=this.queryBus.execute(new g(p.getApi,"basketProductsApi")),t=this.queryBus.execute(new g(p.getApi,k.api)),s=this.#e.getSkinSettings().contextId;Promise.all([n,t,e]).then(([i,o,r])=>{i&&this._emitAnalyticsEvent(u.addedPaymentInfo,{items:i?.get().map(a=>this.#s.toModel({id:String(a.productId),name:a.name,price:a.price.grossValue,producer:a.producer?.name||"",category:a.category?.name||"",currency:a.price.currency,list:m[s],quantity:a.quantity,variant:a.options.map(c=>`${c.name}: ${c.value}`).join(", ")})),basket:{sum:o?.getSum(),sumWithoutPaymentAndShipping:o?.getSumWithoutPaymentAndShipping(),productsSum:i?.getSum(),payment:r?.getSelectedPayment()}})})})}_setupSetShippingEvent(){this.eventBus.on(v.setShipping,()=>{const e=this.queryBus.execute(new g(p.getApi,Ae.api)),n=this.queryBus.execute(new g(p.getApi,"basketProductsApi")),t=this.queryBus.execute(new g(p.getApi,k.api)),s=this.#e.getSkinSettings().contextId;Promise.all([n,t,e]).then(([i,o,r])=>{i&&this._emitAnalyticsEvent(u.addedShippingInfo,{items:i?.get().map(a=>this.#s.toModel({id:String(a.productId),name:a.name,price:a.price.grossValue,producer:a.producer?.name||"",category:a.category?.name||"",currency:a.price.currency,list:m[s],quantity:a.quantity,variant:a.options.map(c=>`${c.name}: ${c.value}`).join(", ")})),basket:{sum:o?.getSum(),productsSum:i?.getSum(),shipping:r?.getSelectedShipping()}})})})}_setupPurchasedEvent(){this.eventBus.on(v.purchased,({body:e})=>
1{if(!e)return;const n=this.#e.getSkinSettings().contextId;this._emitAnalyticsEvent(u.purchased,{orderId:e.orderId,items:e.basket.products.list.map(t=>this.#s.toModel({id:String(t.productId),name:t.name,price:t.price.grossValue,producer:t.producer?.name||"",category:t.category?.name||"",currency:t.price.currency,list:m[n],quantity:t.quantity,variant:t.options.map(s=>`${s.name}: ${s.value}`).join(", ")})),basket:e.basket})})}_setupBeganCheckoutEvent(){this.eventBus.on(v.beganCheckout,()=>{[R,re].includes(this.#e.getSkinSettings().contextId)&&this._sendBeganCheckoutEvent()})}_setupViewedBasketEvent(){this.eventBus.on(v.viewedBasket,()=>{this.#e.getSkinSettings().contextId===R&&this._sendViewedBasketEvent()})}}const et="select_item",tt="add_to_cart",st="remove_from_cart",nt="view_item",it="view_item_list",at="search",ot="begin_checkout",rt="view_cart",ct="add_payment_info",ht="add_shipping_info",ut="purchase",_={SELECT_ITEM:et,ADD_TO_CART:tt,REMOVE_FROM_CART:st,VIEW_ITEM:nt,VIEW_ITEM_LIST:it,VIEW_SEARCH_RESULTS:at,BEGIN_CHECKOUT:ot,VIEW_CART:rt,ADD_PAYMENT_INFO:ct,ADD_SHIPPING_INFO:ht,PURCHASE:ut},dt="begin_checkout";class w{static toConsentMode(e){const n=e.indexOf(M)>-1?"granted":"denied",t=e.indexOf(x)>-1?"granted":"denied";return{ad_storage:n,ad_user_data:n,ad_personalization:n,analytics_storage:t}}}const D={ad_storage:"denied",ad_user_data:"denied",ad_personalization:"denied",analytics_storage:"denied"};class j extends y{constructor({customerPrivacyApi:e,messageStorageApi:n,layerName:t,mapper:s,settingsApi:i}){super(),this._layer=[],this._setupSelectItemEvent=()=>{const o=this.#a.getChannelName(u.selectedItem);this.eventBus.on(o,({body:r})=>{if(!r)return;const a=this.#s.toProduct(r);this._layer.push({ecommerce:null}),this._layer.push(this._decorateEvent({event:_.SELECT_ITEM,ecommerce:{items:[a],item_list_name:a.item_list_name,item_list_id:a.item_list_name}}))})},this._setupAddToBasketEvent=()=>{const o=this.#a.getChannelName(u.addedToBasket);this.eventBus.on(o,({body:r})=>{if(!r)return;const a=this.#s.toProduct(r);this._layer.push({ecommerce:null}),this._layer.push(this._decorateEvent({event:_.ADD_TO_CART,ecommerce:{items:[a],currency:a.currency,value:a.price&&a.quantity?a.price*a.quantity:a.price}}))})},this._setupRemoveFromBasketEvent=()=>{const o=this.#a.getChannelName(u.removedFromBasket);this.eventBus.on(o,({body:r})=>{if(!r)return;const a=this.#s.toProduct(r);this._layer.push({ecommerce:null}),this._layer.push(this._decorateEvent({event:_.REMOVE_FROM_CART,ecommerce:{items:[a],currency:a.currency,value:a.price&&a.quantity?a.price*a.quantity:a.price}}))})},this._setupViewItemEvent=()=>{const o=this.#a.getChannelName(u.viewedItem);this.eventBus.on(o,({body:r})=>{this._sendViewItemEvent(r)}),this._handlePastAnalyticEvents(o,this._sendViewItemEvent)},this._sendViewItemEvent=o=>{if(!o)return;const r=this.#s.toProduct(o),a={...r,price:isNaN(Number(r.price))?r.price:Number(r.price)};this._layer.push({ecommerce:null}),this._layer.push(this._decorateEvent({event:_.VIEW_ITEM,ecommerce:{items:[a],currency:a.currency,value:a.price}}))},this._setupViewItemListEvent=()=>{const o=this.#a.getChannelName(u.viewedItemList);this.eventBus.on(o,({body:r})=>{this._sendViewItemListEvent(r)}),this._handlePastAnalyticEvents(o,this._sendViewItemListEvent)},this._sendViewItemListEvent=o=>{if(!o)return;const r=o.map(a=>this.#s.toProduct(a));this._layer.push({ecommerce:null}),this._layer.push(this._decorateEvent({event:_.VIEW_ITEM_LIST,ecommerce:{items:r,item_list_name:r[0]&&r[0].item_list_name,item_list_id:r[0]&&r[0].item_list_name}}))},this._setupViewSearchResultsEvent=()=>{const o=this.#a.getChannelName(u.viewedSearchResults);this.eventBus.on(o,({body:r})=>{this._sendViewSearchResultsEvent(r)}),this._handlePastAnalyticEvents(o,this._sendViewSearchResultsEvent)},this._sendViewSearchResultsEvent=o=>{o&&(this._layer.push({ecommerce:null}),this._layer.push(this._decorateEvent({event:_.VIEW_SEARCH_RESULTS,ecommerce:{search_term:o.searchTerm}})))},this._setupViewBasketEvent=()=>{const o=this.#a.getChannelName(u.viewedBasket);this.eventBus.on(o,({body:r})=>{this._sendViewBasketEvent(r)}),this._handlePastAnalyticEvents(o,this._sendViewBasketEvent)},this._sendViewBasketEvent=o=>{if(!o)return;const{items:r,basket:a}=o,c=r.map(h=>this.#s.toProduct(h));this._layer.push({ecommerce:null}),this._layer.push(this._decorateEvent({event:_.VIEW_CART,ecommerce:{items:c,currency:a.productsSum?.currency,value:a.productsSum?.grossValue}}))},this._setupBeginCheckoutEvent=()=>{const o=this.#a.getChannelName(u.beganCheckout);this.eventBus.on(o,({body:r})=>{this._sendBeginCheckoutEvent(r)}),this._handlePastAnalyticEvents(o,this._sendBeginCheckoutEvent)},this._sendBeginCheckoutEvent=o=>{if(!o)return;const{items:r,basket:a}=o,c=r.map(h=>this.#s.toProduct(h));this._layer.push(this._decorateEvent({event:dt,ecommerce:{currency:a.productsSum?.currency,items:c,coupon:a.promotionCode?.code,value:a.productsSum?.grossValue}}))},this._setupAddShippingInfoEvent=()=>{const o=this.#a.getChannelName(u.addedShippingInfo);this.eventBus.on(o,({body:r})=>{if(!r)return;const{basket:a,items:c}=r,h=c.map(l=>this.#s.toProduct(l));this._layer.push({ecommerce:null}),this._layer.push(this._decorateEvent({event:_.ADD_SHIPPING_INFO,ecommerce:{currency:a.productsSum?.currency,shipping_tier:a.shipping?.name,items:h,value:a.productsSum?.grossValue}}))})},this._setupAddPaymentInfoEvent=()=>{const o=this.#a.getChannelName(u.addedPaymentInfo);this.eventBus.on(o,({body:r})=>{if(!r)return;const{basket:a,items:c}=r,h=c.map(l=>this.#s.toProduct(l));this._layer.push({ecommerce:null}),this._layer.push(this._decorateEvent({event:_.ADD_PAYMENT_INFO,ecommerce:{currency:a.productsSum?.currency,payment_type:a.payment?.name,items:h,value:a.productsSum?.grossValue}}))})},this._setupPurchaseEvent=()=>{const o=this.#a.getChannelName(u.purchased);this.eventBus.on(o,({body:r})=>{if(!r)return;const{items:a,basket:c,orderId:h}=r,l=this.#s.toOrder({orderId:h,items:a,basket:c});this._layer.push({ecommerce:null}),c.billingAddress&&this._setUserData(c.billingAddress),this._layer.push(this._decorateEvent({event:_.PURCHASE,ecommerce:l}))})},this.#e=e,this.#t=n,this.#n=t,this.#i=i,this.#s=s,this.#a=new N(i),window[this.#n]=window[this.#n]||[],this._layer=window[this.#n],this.#i.isFeatureEnabled("dev_consent_mode_init_fix")?(this.#e.isCookieInformationEnabled()&&(this.#i.isFeatureEnabled("dev_google_analytics_refactor")||this._setDefaultConsents(),this._updateConsents()),window[this.#n].push({"gtm.start":new Date().getTime(),event:"gtm.js"})):(window[this.#n].push({"gtm.start":new Date().getTime(),event:"gtm.js"}),this.#e.isCookieInformationEnabled()&&(this._setDefaultConsents(),this._updateConsents()))}#e;#t;#n;#s;#i;#a;getLayer(){return this._layer}async setup(){this._setupSelectItemEvent(),this._setupAddToBasketEvent(),this._setupRemoveFromBasketEvent(),this._setupViewItemEvent(),this._setupViewItemListEvent(),this._setupViewSearchResultsEvent(),this._setupViewBasketEvent(),this._setupBeginCheckoutEvent(),this._setupAddShippingInfoEvent(),this._setupAddPaymentInfoEvent(),this._setupPurchaseEvent(),this.eventBus.on(v.basketUpdated,({body:e})=>{e&&e.billingAddress&&this._setUserData(e.billingAddress)}),this.eventBus.on(K.updated,({body:e})=>
1{if(!e){this.getLayer().push({user_id:null});return}this.getLayer().push({user_id:e.userId})})}_setUserData(e){const n=this.#i.getCountryById(e.countryId),t=n?n.isocode:e.country||e.countryId;this.getLayer().push({user_data:{email:e.email,phone_number:e.phone,first_name:e.firstName,last_name:e.lastName,street:e.street,city:e.city,postal_code:e.zipCode,country:t}})}_gtag(...e){this._layer.push(arguments)}_setDefaultConsents(){this._layer.push("consent","default",D)}_decorateEvent(e){return{...e,isStorefront:!0}}_updateConsents(){this.#e.getGrantedNames().length>0&&(this.#i.isFeatureEnabled("dev_google_analytics_refactor")?this._gtag("consent","update",w.toConsentMode(this.#e.getGrantedNames())):this._layer.push("consent","update",this._getUpdatedConsents())),new G(()=>{this.#i.isFeatureEnabled("dev_google_analytics_refactor")?this._gtag("consent","update",w.toConsentMode(this.#e.getGrantedNames())):this._layer.push("consent","update",this._getUpdatedConsents())})}_getUpdatedConsents(){const e=this._getMarketingConsent(),n=this._getAnalyticsConsent();return{ad_storage:e,ad_user_data:e,ad_personalization:e,analytics_storage:n}}_getMarketingConsent(){return this.#e.getGrantedNames().indexOf(M)>-1?"granted":"denied"}_getAnalyticsConsent(){return this.#e.getGrantedNames().indexOf(x)>-1?"granted":"denied"}_handlePastAnalyticEvents(e,n){const t=this.#t.getChannelMessages(e);t.length>0&&t.forEach(({body:s})=>{n(s)})}}class F{static async create(e,n){const t=n?`gtag-jssdk-${n}`:"gtag-jssdk";document.getElementById(t)||await F._injectScript(t,e,n)}static _injectScript(e,n,t){return new Promise(s=>{const i=document.getElementsByTagName("script")[0],o=document.createElement("script"),r=t?`&l=${t}`:"";o.id=e,o.src=`https://www.googletagmanager.com/gtag/js?id=${n}${r}`,o.async=!0,o.onload=()=>{s()},i.parentNode?.insertBefore(o,i)})}}class L{static _gatherGoogleAnalyticsTrackers(){return[...document.querySelectorAll(Ce)].map(n=>{const t=T.toObjectFromJsonScriptTag(n);return{trackingId:t.trackingId,isGTM:t.isGTM==="1",layerName:t.layerName??"dataLayer",containerId:t.containerId}})}static _gatherGoogleAdsConfigs(){return[...document.querySelectorAll(Se)].map(n=>{const{conversionId:t,conversionLabel:s,awMerchantId:i,awFeedCountry:o,awFeedLanguage:r}=T.toObjectFromJsonScriptTag(n);return{conversionId:t,conversionLabel:s,awMerchantId:i,awFeedCountry:o,awFeedLanguage:r}})}}class lt extends y{constructor({customerPrivacyApi:e,messageStorageApi:n,trackingIds:t,mapper:s,settingsApi:i}){super(),this.layerName="dataLayer",this._gtag=()=>{},this._setupSelectItemEvent=()=>{const a=this.#i.getChannelName(u.selectedItem);this.eventBus.on(a,({body:c})=>{this._sendSelectItemEvent(c)})},this._sendSelectItemEvent=a=>{if(!a)return;const c=this.#t.toProduct(a);this._gtag("event",_.SELECT_ITEM,this._decorateEvent({items:[c],item_list_name:c.item_list_name,item_list_id:c.item_list_name}))},this._setupAddToBasketEvent=()=>{const a=this.#i.getChannelName(u.addedToBasket);this.eventBus.on(a,({body:c})=>{this._sendAddToBasketEvent(c)})},this._sendAddToBasketEvent=a=>{if(!a)return;const c=this.#t.toProduct(a);this._gtag("event",_.ADD_TO_CART,this._decorateEvent({items:[c],currency:c.currency,value:c.price&&c.quantity?c.price*c.quantity:c.price}))},this._setupRemoveFromBasketEvent=()=>{const a=this.#i.getChannelName(u.removedFromBasket);this.eventBus.on(a,({body:c})=>{if(!c)return;const h=this.#t.toProduct(c);this._gtag("event",_.REMOVE_FROM_CART,this._decorateEvent({items:[h],currency:h.currency,value:h.price&&h.quantity?h.price*h.quantity:h.price}))})},this._setupViewItemEvent=()=>{const a=this.#i.getChannelName(u.viewedItem);this.eventBus.on(a,({body:c})=>{this._sendViewItemEvent(c)}),this._handlePastAnalyticEvents(a,this._sendViewItemEvent)},this._sendViewItemEvent=a=>{if(!a)return;const c=this.#t.toProduct(a),h={...c,price:isNaN(Number(c.price))?c.price:Number(c.price)};this._gtag("event",_.VIEW_ITEM,this._decorateEvent({items:[h],currency:h.currency,value:h.price}))},this._setupViewItemListEvent=()=>{const a=this.#i.getChannelName(u.viewedItemList);this.eventBus.on(a,({body:c})=>{this._sendViewItemListEvent(c)}),this._handlePastAnalyticEvents(a,this._sendViewItemListEvent)},this._sendViewItemListEvent=a=>{if(!a)return;const c=a.map(h=>this.#t.toProduct(h));this._gtag("event",_.VIEW_ITEM_LIST,this._decorateEvent({items:c,item_list_name:c[0]&&c[0].item_list_name,item_list_id:c[0]&&c[0].item_list_name}))},this._setupViewSearchResultsEvent=()=>{const a=this.#i.getChannelName(u.viewedSearchResults);this.eventBus.on(a,({body:c})=>{this._sendViewSearchResultsEvent(c)}),this._handlePastAnalyticEvents(a,this._sendViewSearchResultsEvent)},this._sendViewSearchResultsEvent=a=>{a&&this._gtag("event",_.VIEW_SEARCH_RESULTS,this._decorateEvent({search_term:a.searchTerm}))},this._setupViewBasketEvent=()=>{const a=this.#i.getChannelName(u.viewedBasket);this.eventBus.on(a,({body:c})=>{this._sendViewBasketEvent(c)}),this._handlePastAnalyticEvents(a,this._sendViewBasketEvent)},this._sendViewBasketEvent=a=>{if(!a)return;const{items:c,basket:h}=a,l=c.map(E=>this.#t.toProduct(E));this._gtag("event",_.VIEW_CART,this._decorateEvent({value:h.productsSum?.grossValue,currency:h.productsSum?.currency,items:l}))},this._setupBeginCheckoutEvent=()=>{const a=this.#i.getChannelName(u.beganCheckout);this.eventBus.on(a,({body:c})=>{this._sendBeginCheckoutEvent(c)}),this._handlePastAnalyticEvents(a,this._sendBeginCheckoutEvent)},this._sendBeginCheckoutEvent=a=>{if(!a)return;const{items:c,basket:h}=a,l=c.map(E=>this.#t.toProduct(E));this._gtag("event",_.BEGIN_CHECKOUT,this._decorateEvent({currency:h.productsSum?.currency,items:l,coupon:h.promotionCode?.code,value:h.productsSum?.grossValue}))},this._setupAddShippingInfoEvent=()=>{const a=this.#i.getChannelName(u.addedShippingInfo);this.eventBus.on(a,({body:c})=>{if(!c)return;const{basket:h,items:l}=c,E=l.map(A=>this.#t.toProduct(A));this._gtag("event",_.ADD_SHIPPING_INFO,this._decorateEvent({currency:h.productsSum?.currency,shipping_tier:h.shipping?.name,items:E,value:h.productsSum?.grossValue}))})},this._setupAddPaymentInfoEvent=()=>{const a=this.#i.getChannelName(u.addedPaymentInfo);this.eventBus.on(a,({body:c})=>{if(!c)return;const{basket:h,items:l}=c,E=l.map(A=>this.#t.toProduct(A));this._gtag("event",_.ADD_PAYMENT_INFO,this._decorateEvent({currency:h.productsSum?.currency,payment_type:h.payment?.name,items:E,value:h.productsSum?.grossValue}))})},this._setupPurchaseEvent=()=>{const a=this.#i.getChannelName(u.purchased);this.eventBus.on(a,({body:c})=>{if(!c)return;const{items:h,basket:l,orderId:E}=c,A=this.#t.toOrder({orderId:E,items:h,basket:l}),$=L._gatherGoogleAdsConfigs();$.length>0&&$.forEach(({conversionId:ce,conversionLabel:he,awMerchantId:ue,awFeedCountry:de,awFeedLanguage:le})=>{this._gtag("event","conversion",{send_to:`AW-${ce}/${he}`,value:A.value,currency:A.currency,transaction_id:A.transaction_id,aw_merchant_id:ue,aw_feed_country:de,aw_feed_language:le})}),l.billingAddress&&this._setUserData(l.billingAddress),this._gtag("event",_.PURCHASE,this._decorateEvent(A))})},this.#e=e,this.#n=n,this.#s=i,this.#a=t,this.#t=s,this.#i=new N(i);const o=L._gatherGoogleAdsConfigs();o.length>0&&o.forEach(({conversionId:a})=>this.#a.push(`AW-${a}`))}#e;#t;#n;#s;#i;#a;async setup(){const e=this.layerName;window[e]=window[e]||[];function n(...t){window[e].push(arguments)}this._gtag=n,this.#s.isFeatureEnabled("dev_consent_mode_init_fix")?(this.#e.isCookieInformationEnabled()&&(this.#s.isFeatureEnabled("dev_google_analytics_refactor")||this._setDefaultConsents(),this._updateConsents()),n("js",new Date)):(n("js",
1new Date),this.#e.isCookieInformationEnabled()&&(this._setDefaultConsents(),this._updateConsents())),n("set",{isStorefront:!0}),this.#a.forEach(t=>{n("config",t)}),this._setupSelectItemEvent(),this._setupAddToBasketEvent(),this._setupRemoveFromBasketEvent(),this._setupViewItemEvent(),this._setupViewItemListEvent(),this._setupViewSearchResultsEvent(),this._setupViewBasketEvent(),this._setupBeginCheckoutEvent(),this._setupAddShippingInfoEvent(),this._setupAddPaymentInfoEvent(),this._setupPurchaseEvent(),this.eventBus.on(v.basketUpdated,({body:t})=>{t&&t.billingAddress&&this._setUserData(t.billingAddress)}),this.eventBus.on(K.updated,({body:t})=>{if(!t){this._gtag("set",{user_id:null});return}this._gtag("set",{user_id:t.userId})}),await F.create(this.#a[0],this.layerName)}_setUserData(e){const n=this.#s.getCountryById(e.countryId),t=n?n.isocode:e.country||e.countryId;this._gtag("set","user_data",{email:e.email,phone_number:e.phone,first_name:e.firstName,last_name:e.lastName,street:e.street,city:e.city,postal_code:e.zipCode,country:t})}_setDefaultConsents(){this._gtag("consent","default",D)}_updateConsents(){this.#e.getGrantedNames().length>0&&(this.#s.isFeatureEnabled("dev_google_analytics_refactor")?this._gtag("consent","update",w.toConsentMode(this.#e.getGrantedNames())):this._gtag("consent","update",this._getUpdatedConsents())),new G(()=>{this.#s.isFeatureEnabled("dev_google_analytics_refactor")?this._gtag("consent","update",w.toConsentMode(this.#e.getGrantedNames())):this._gtag("consent","update",this._getUpdatedConsents())})}_getUpdatedConsents(){const e=this._getMarketingConsent(),n=this._getAnalyticsConsent();return{ad_storage:e,ad_user_data:e,ad_personalization:e,analytics_storage:n}}_getMarketingConsent(){return this.#e.getGrantedNames().indexOf(M)>-1?"granted":"denied"}_getAnalyticsConsent(){return this.#e.getGrantedNames().indexOf(x)>-1?"granted":"denied"}_decorateEvent(e){return{...e,send_to:this.#a}}_handlePastAnalyticEvents(e,n){const t=this.#n.getChannelMessages(e);t.length>0&&t.forEach(({body:s})=>{n(s)})}}class H{toProduct(e){return{item_name:e.name,item_id:e.id,item_brand:e.producer,item_category:e.category,item_variant:e.variant,item_list_name:e.list||"",index:e.position,price:e.price,currency:e.currency||"",quantity:e.quantity}}toOrder({orderId:e,items:n,basket:t}){const s=t?.shippings.find(o=>o.isSelected),i=n.map(o=>this.toProduct(o));return{transaction_id:e,value:t.products.sum?.grossValue||0,shipping:s?.price.grossValue||0,currency:t.sum.currency,tax:t.sum.taxValue,items:i,coupon:t.promotionCode?.code||""}}}const b="shopLayer",_t="GTM-T68LWS";class mt{#e;constructor(e){this.#e=e}toProduct(e){return{item_name:`${this.#e}_${e.name}`,item_id:e.id,item_brand:e.producer,item_category:e.category,item_variant:e.variant,item_list_name:e.list||"",index:e.position,price:e.price,currency:e.currency||"",quantity:e.quantity}}toOrder({orderId:e,items:n,basket:t}){const s=t?.shippings.find(o=>o.isSelected),i=n.map(o=>this.toProduct(o));return{transaction_id:`${this.#e}_${e}`,value:t.sum.grossValue,shipping:s?.price.grossValue||0,currency:t.sum.currency,tax:t.sum.taxValue,items:i,coupon:t.promotionCode?.code||""}}}class gt extends y{constructor({gaTrackerConfigs:e,customerPrivacyApi:n,settingsApi:t,messageStorageApi:s}){super(),this._GATrackers=[],this._GTMTrackers=[],this._GTMScripts=[],this.#e=n,this.#t=t,this.#n=s,this._GATrackers=e.filter(r=>!r.isGTM),this._GTMTrackers=e.filter(r=>r.isGTM),this._GTMScripts=e.filter(r=>r.containerId&&r.layerName).map(r=>({containerId:r.containerId,layerName:r.layerName}));const i=this.#t.isFeatureEnabled("dev_consent_mode_init_fix"),o=this.#t.isFeatureEnabled("dev_google_analytics_refactor");(async()=>{try{i&&(o?this._pushConsentDefaultsToAllLayers():this._pushConsentDefaultsToGTMLayers()),await this._injectGTMScripts()}catch(r){console.error(r),console.error("Failed to inject GTM scripts")}try{await this._initGtagClients()}catch(r){console.error(r),console.error("Failed to init Gtag clients")}try{await this._initGTMClients()}catch(r){console.error(r),console.error("Failed to init GTM clients")}try{await this._initShoperGTMClient()}
1catch(r){console.error(r),console.error("Failed to init Shoper GTM client")}})()}#e;#t;#n;async _injectGTMScripts(){for(const{containerId:e,layerName:n}of this._GTMScripts)await O.create(`${n}-script`,`//www.googletagmanager.com/gtm.js?id=${e}&l=${n}`)}async _initGtagClients(){if(this._GATrackers.length>0){const e=new H;await new lt({customerPrivacyApi:this.#e,messageStorageApi:this.#n,trackingIds:this._GATrackers.map(t=>t.trackingId),settingsApi:this.#t,mapper:e}).setup()}}async _initGTMClients(){const e=new H;return new Promise(n=>{(async()=>{for(const t of this._GTMTrackers)await new j({customerPrivacyApi:this.#e,messageStorageApi:this.#n,layerName:t.layerName,settingsApi:this.#t,mapper:e}).setup();n()})()})}async _initShoperGTMClient(){return new Promise(e=>{this.#e.onPlatformConsentGranted(async()=>{const n=this.#t.isFeatureEnabled("dev_consent_mode_init_fix"),t=this.#t.isFeatureEnabled("dev_google_analytics_refactor");n&&t&&this.#e.isCookieInformationEnabled()&&this._setDefaultConsentForLayer(b),await O.create(`${b}-script`,`//www.googletagmanager.com/gtm.js?id=${_t}&l=${b}`);const{shopId:s}=this._getLicenseData(),i=new mt(s),o=new j({customerPrivacyApi:this.#e,messageStorageApi:this.#n,layerName:b,settingsApi:this.#t,mapper:i});await o.setup(),this._sendBasicDataToShoperGTM(o.getLayer()),e()})})}_getLicenseData(){const{licenseData:e}=this.#t.getSkinSettings(),n=document.body.parentElement?.dataset.fmc,t=e.substring(10),s=t.substring(0,1),i=t.substring(1,2),o=t.substring(3);let r="saas";return s==="3"&&(r="trial"),{shopId:o,shopType:r,planId:i,fmc:n}}_sendBasicDataToShoperGTM(e){const{shopId:n,shopType:t,planId:s,fmc:i}=this._getLicenseData();e.push({shop_id:n,license_type:t,theme_type:"storefront",fmc:i,basket_type:"storefront",plan_id:s})}_pushConsentDefaultsToGTMLayers(){if(this.#e.isCookieInformationEnabled())for(const{layerName:e}of this._GTMScripts)this._setDefaultConsentForLayer(e)}_pushConsentDefaultsToAllLayers(){if(this.#e.isCookieInformationEnabled()){for(const{layerName:e}of this._GTMScripts)this._setDefaultConsentForLayer(e);this._GATrackers.length>0&&this._setDefaultConsentForLayer("dataLayer")}}_setDefaultConsentForLayer(e){window[e]=window[e]||[],function(){window[e].push(arguments)}("consent","default",D)}}class pt{static _gatherFBEPixels(){return[...document.querySelectorAll(fe)].map(n=>({pixelId:T.toObjectFromJsonScriptTag(n).pixelId}))}}const yt="2.0";class q{static async create(e){await q._injectScript(e)}static _injectScript(e){return new Promise(n=>{const t=document.getElementsByTagName("script")[0],s=document.createElement("script");let i={};if(window.fbq){n();return}i=window.fbq=function(){i.callMethod?i.callMethod.apply(i,arguments):i.queue.push(arguments)},window._fbq||(window._fbq=i),i.push=i,i.loaded=!0,i.version=yt,i.agent="plshoper",i.queue=[],s.async=!0,s.src=`https://connect.facebook.net/${e}/fbevents.js`,s.onload=()=>{n()},t.parentNode?.insertBefore(s,t)})}}const Et="AddToCart",vt="ViewContent",At="ViewContent",Ct="InitiateCheckout",St="AddPaymentInfo",ft="Purchase",It="Search",S={ADD_TO_CART:Et,VIEW_ITEM:vt,VIEW_ITEM_LIST:At,BEGIN_CHECKOUT:Ct,ADD_PAYMENT_INFO:St,PURCHASE:ft,SEARCH:It};class Pt extends y{constructor({pixelId:e,settingsApi:n,messageStorageApi:t}){super(),this._setupAddToBasketEvent=()=>{const s=this.#n.getChannelName(u.addedToBasket);this.eventBus.on(s,({body:i})=>{i&&this.fbq(S.ADD_TO_CART,{content_ids:[i.id],content_type:"product",value:i.price,currency:i.currency})})},this._setupViewItemEvent=()=>{const s=this.#n.getChannelName(u.viewedItem);this.eventBus.on(s,({body:i})=>{this._sendViewItemEvent(i)}),this._handlePastAnalyticEvents(s,this._sendViewItemEvent)},this._sendViewItemEvent=s=>{s&&this.fbq(S.VIEW_ITEM,{content_ids:[s.id],content_category:s.category,content_type:"product",currency:s.currency,value:s.price})},this._setupViewItemListEvent=()=>{const s=this.#n.getChannelName(u.viewedItemList);this.eventBus.on(s,({body:i})=>{this._sendViewItemListEvent(i)}),this._handlePastAnalyticEvents(s,this._sendViewItemListEvent)},this._sendViewItemListEvent=s=>{if(!s)return;const i=s.reduce((c,h)=>c+(h.price||0),0),o=s.map(c=>c.id),r=m[this.#e.getSkinSettings().contextId],a=s[0]&&s[0].currency;this.fbq(S.VIEW_ITEM_LIST,{value:i,currency:a,content_ids:o,content_category:r,content_type:"product"})},this._setupViewSearchResultsEvent=()=>{const s=this.#n.getChannelName(u.viewedSearchResults);this.eventBus.on(s,({body:i})=>{this._sendViewSearchResultsEvent(i)}),this._handlePastAnalyticEvents(s,this._sendViewSearchResultsEvent)},this._sendViewSearchResultsEvent=s=>{if(!s)return;const i=s.items,o=i.reduce((h,l)=>h+(l.price||0),0),r=i.map(h=>h.id),a=m[this.#e.getSkinSettings().contextId],c=i[0]&&i[0].currency;this.fbq(S.SEARCH,{value:o,currency:c,content_ids:r,content_category:a,content_type:"product",search_string:s.searchTerm})},this._setupBeganCheckoutEvent=()=>{const s=this.#n.getChannelName(u.beganCheckout);this.eventBus.on(s,({body:i})=>{this._sendBeganCheckoutEvent(i)}),this._handlePastAnalyticEvents(s,this._sendBeganCheckoutEvent)},this._sendBeganCheckoutEvent=s=>{if(!s)return;const{items:i,basket:o}=s,r=i.map(c=>c.id),a=m[this.#e.getSkinSettings().contextId];this.fbq(S.BEGIN_CHECKOUT,{value:o.sumWithoutPaymentAndShipping?.grossValue,currency:o.sumWithoutPaymentAndShipping?.currency,content_ids:r,content_category:a,content_type:"product",num_items:i.length})},this._setupAddPaymentInfoEvent=()=>{const s=this.#n.getChannelName(u.addedPaymentInfo);this.eventBus.on(s,({body:i})=>{if(!i)return;const{basket:o}=i;this.fbq(S.ADD_PAYMENT_INFO,{value:o.sumWithoutPaymentAndShipping?.grossValue,currency:o.sumWithoutPaymentAndShipping?.currency,contents:o.payment?.name})})},this._setupPurchaseEvent=()=>{const s=this.#n.getChannelName(u.purchased);this.eventBus.on(s,({body:i})=>{if(!i)return;const{items:o,basket:r,orderId:a}
1=i,c=o.map(l=>l.id),h=m[this.#e.getSkinSettings().contextId];this.fbq(S.PURCHASE,{value:r.sumWithoutPaymentAndShipping?.grossValue,currency:r.sumWithoutPaymentAndShipping?.currency,content_ids:c,content_category:h,content_type:"product",num_items:o.length},{eventID:a})})},this.#s=e,this.#e=n,this.#t=t,this.#n=new N(n)}#e;#t;#n;#s;#i;async setup(){const e=this.#e.getSkinSettings().locale;await q.create(e),this.#i=window.fbq,this.#i("init",this.#s),this.#i("trackSingle",this.#s,"PageView"),this._setupAddToBasketEvent(),this._setupViewItemEvent(),this._setupViewItemListEvent(),this._setupViewSearchResultsEvent(),this._setupBeganCheckoutEvent(),this._setupAddPaymentInfoEvent(),this._setupPurchaseEvent()}fbq(e,n,t=void 0){this.#i("trackSingle",this.#s,e,n,t)}_handlePastAnalyticEvents(e,n){const t=this.#t.getChannelMessages(e);t.length>0&&t.forEach(({body:s})=>{n(s)})}}const Tt="fbe_conversion_allow",wt=365;class Nt extends y{constructor({fbeConfigs:e,settingsApi:n,cookies:t,messageStorageApi:s}){super(),this._fbeConfigs=[],this._fbeConfigs=e,this.#e=n,this.#t=s,this.#n=t,this._initFBEClients(),this._allowFBEConversions()}#e;#t;#n;async _initFBEClients(){for(const e of this._fbeConfigs)await new Pt({pixelId:e.pixelId,settingsApi:this.#e,messageStorageApi:this.#t}).setup()}_allowFBEConversions(){this.#n.set(Tt,"1",{expires:wt})}}class kt{static _gatherMicrosoftAdsTrackers(){return[...document.querySelectorAll(Ie)].map(n=>({uetq:T.toObjectFromJsonScriptTag(n).uetq}))}}const bt="add_to_cart",Bt="purchase",W={ADD_TO_CART:bt,PURCHASE:Bt};class Mt extends y{constructor({uetq:e,customerPrivacyApi:n}){super(),this._setupAddToBasketEvent=()=>{this.eventBus.on(u.addedToBasket,({body:t})=>{t&&this.uetq.push("event",W.ADD_TO_CART,{ecomm_prodid:[t.id],ecomm_pagetype:"product",ecomm_totalvalue:t.price,revenue_value:t.price,currency:t.currency,items:[{id:t.id,quantity:t.quantity,price:t.price}]})})},this._setupPurchaseEvent=()=>{this.eventBus.on(u.purchased,({body:t})=>{if(!t)return;const{items:s,basket:i,orderId:o}=t;this.uetq.push("event",W.PURCHASE,{transaction_id:o,ecomm_prodid:s.map(r=>r.id),ecomm_pagetype:"purchase",revenue_value:i.sum?.grossValue,currency:i.sum?.currency,items:s.map(r=>({id:r.id,quantity:r.quantity,price:r.price}))})})},window.uetq=window.uetq||[],this.uetq=window.uetq,this.#e=n,this.uetqId=e,this.#e.isCookieInformationEnabled()&&(this._setDefaultConsents(),this._updateConsents())}#e;_setDefaultConsents(){const e={ad_storage:"denied"};this.uetq.push("consent","default",e)}_updateConsents(){this.#e.getGrantedNames().length>0&&this.uetq.push("consent","update",this._getUpdatedConsents()),new G(()=>{this.uetq.push("consent","update",this._getUpdatedConsents())})}_getUpdatedConsents(){return{ad_storage:this._getMarketingConsent()}}_getMarketingConsent(){return this.#e.getGrantedNames().indexOf(M)>-1?"granted":"denied"}async setup(){await O.create("microsoft-jssdk","https://bat.bing.com/bat.js");const e={ti:this.uetqId,q:window.uetq,enableAutoSpaTracking:!0};window.uetq=new UET(e),this.uetq=window.uetq,window.uetq.push("pageLoad"),this._setupAddToBasketEvent(),this._setupPurchaseEvent()}}class Gt extends y{constructor({microsoftAdsConfigs:e,customerPrivacyApi:n}){super(),this._microsoftAdsConfigs=e,this._microsoftAdsConfigs.forEach(t=>{new Mt({uetq:t.uetq,customerPrivacyApi:n}).setup()})}}class Ot{static _gatherTiktokTrackers(){return[...document.querySelectorAll(Pe)].map(n=>({pixelId:T.toObjectFromJsonScriptTag(n).pixelId}))}}class U{static async create(e){await U._injectScript(e)}static _injectScript(e){return new Promise(n=>{window.TiktokAnalyticsObject="ttq";const t=window.ttq=window.ttq||[];t.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie","holdConsent","revokeConsent","grantConsent"],t.setAndDefer=function(s,i){s[i]=function(){s.push([i].concat(Array.prototype.slice.call(arguments,0)))}};for(let s=0;s<t.methods.length;
1s++)t.setAndDefer(t,t.methods[s]);t.instance=function(s){for(var i=t._i[s]||[],o=0;o<t.methods.length;o++)t.setAndDefer(i,t.methods[o]);return i},t.load=function(s,i){const o="https://analytics.tiktok.com/i18n/pixel/events.js";t._i=t._i||{},t._i[s]=[],t._i[s]._u=o,t._t=t._t||{},t._t[s]=+new Date,t._o=t._o||{},t._o[s]=i||{},i=document.createElement("script"),i.type="text/javascript",i.async=!0,i.src=o+"?sdkid="+s+"&lib=ttq",i.onload=()=>{n()},s=document.getElementsByTagName("script")[0],s.parentNode.insertBefore(i,s)},t.load(e)})}}class Vt extends y{constructor({pixelId:e,messageStorageApi:n,settingsApi:t}){super(),this._setupAddToBasketEvent=()=>{const s=this.#n.getChannelName(u.addedToBasket);this.eventBus.on(s,({body:i})=>{i&&this.#i.track("AddToCart",{contents:[{content_id:i.id,content_type:"product",content_name:i.name}],value:i.quantity&&i.price?i.price*i.quantity:i.price,currency:i.currency})})},this._setupViewItemEvent=()=>{const s=this.#n.getChannelName(u.viewedItem);this.eventBus.on(s,({body:i})=>{this._sendViewItemEvent(i)}),this._handlePastAnalyticEvents(s,this._sendViewItemEvent)},this._sendViewItemEvent=s=>{s&&this.#i.track("ViewContent",{contents:[{content_id:s.id,content_type:"product",content_name:s.name}],value:s.price,currency:s.currency})},this._setupPurchaseEvent=()=>{const s=this.#n.getChannelName(u.purchased);this.eventBus.on(s,({body:i})=>{if(!i)return;const{items:o,basket:r}=i,a=o.map(c=>({content_id:c.id,content_type:"product",content_name:c.name}));this.#i.track("PlaceAnOrder",{contents:a,value:r.sum?.grossValue,currency:r.sum?.currency})})},this.#s=e,this.#e=n,this.#t=t,this.#n=new N(t)}#e;#t;#n;#s;#i;async setup(){await U.create(this.#s),this.#i=window.ttq,this.#i.page(),this._setupAddToBasketEvent(),this._setupViewItemEvent(),this._setupPurchaseEvent()}_handlePastAnalyticEvents(e,n){const t=this.#e.getChannelMessages(e);t.length>0&&t.forEach(({body:s})=>{n(s)})}}class Rt extends y{#e=[];#t;#n;constructor({tikTokPixelConfigs:e,messageStorageApi:n,settingsApi:t}){super(),this.#e=e,this.#t=n,this.#n=t,this._initTikTokPixelClients()}async _initTikTokPixelClients(){for(const e of this.#e)await new Vt({pixelId:e.pixelId,messageStorageApi:this.#t,settingsApi:this.#n}).setup()}}class Lt extends y{#e;constructor(e){super(),this.#e=e,this._registerConsentUpdateHandler()}_registerConsentUpdateHandler(){this.#e.getGrantedNames().length>0&&this._sendConsentUpdate(),new G(()=>{this._sendConsentUpdate()})}_sendConsentUpdate(){const e=w.toConsentMode(this.#e.getGrantedNames());window.dataLayer=window.dataLayer||[];function n(){window.dataLayer.push(arguments)}try{n("consent","update",e)}catch(t){console.error("Failed to update consent for dataLayer",t)}}}class Jt extends Te{static{this.dependencies=[we]}static{this.featureName=Y.feature}async init(){const e=await this.getApi(Ve.api),n=await this.getApi(Ne),t=await this.getApi(ke),s=L._gatherGoogleAnalyticsTrackers();this._initGoogleConsentModeService(e,n,s),this._initGoogleAnalyticsService(e,n,t,s),this._initMicrosoftAnalyticsService(n),n.onAnalyticsConsentGranted(()=>{this._initFacebookAnalyticsService(e,t),this._initTiktokAnalyticsService(t,e)});const i=new Ze({settingsApi:e,messageStorageApi:t});return{cores:[{type:be.service,instance:[i]},{type:Be,instance:[C]}]}}_initGoogleAnalyticsService(e,n,t,s){new gt({customerPrivacyApi:n,gaTrackerConfigs:s,settingsApi:e,messageStorageApi:t})}_initGoogleConsentModeService(e,n,t){if(!n.isCookieInformationEnabled()||!e.isFeatureEnabled("dev_consent_mode_init_fix")||!e.isFeatureEnabled("dev_google_analytics_refactor"))return;t.length>0||new Lt(n)}_initFacebookAnalyticsService(e,n){const t=pt._gatherFBEPixels();new Nt({fbeConfigs:t,settingsApi:e,messageStorageApi:n,cookies:Me})}_initMicrosoftAnalyticsService(e){const n=kt._gatherMicrosoftAdsTrackers();new Gt({microsoftAdsConfigs:n,customerPrivacyApi:e})}_initTiktokAnalyticsService(e,n){const t=Ot._gatherTiktokTrackers();new Rt({tikTokPixelConfigs:t,messageStorageApi:e,settingsApi:n})}}export{Jt as AnalyticsInitializer};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.