PageSourceSearch

https://www.asolo.com/modules/rcpgtagmanager/views/js/hook/trackingClient.bundle.js

js asolo.com collected 2026-10-02 10:47:08 UTC 75,088 bytes, 14 lines download raw bytes

1/**
2 * NOTICE OF LICENSE
3 *
4 * This source file is subject to a trade license awarded by
5 * Garamo Online S.L.
6 *
7 * Any use, public communication, reproduction, modification or
8 * distribution of this source file without the written consent of
9 * Garamo Online S.L. It Is prohibited.
10 *
11 * @author    ReactionCode <[email protected]>
12 * @copyright Garamo Online S.L. 2015-2023.
13 * @license   Commercial license
14 */(()=>{"use strict";class t{constructor(){this.hasSessionStorage="Storage"===Object.prototype.toString.call(sessionStorage).slice(8,-1)}getItem(t){let e=null;return this.hasSessionStorage&&(e=sessionStorage.getItem(t)),e}setItem(t,e){this.hasSessionStorage&&sessionStorage.setItem(t,e)}removeItem(t){this.hasSessionStorage&&sessionStorage.removeItem(t)}clearAll(){this.hasSessionStorage&&sessionStorage.clear()}}class e{constructor(t,e){this.sessionStorage=t,this.idLang=e,this.storageKey="RcProductList",this.storageValue={},this.initStorage()}initStorage(){const t=this.sessionStorage.getItem(this.storageKey);t&&(this.storageValue=JSON.parse(t))}addProduct(t){this.storageValue[t.id_index]=t,this.updateSessionStorageValue()}updateSessionStorageValue(){const t=JSON.stringify(this.storageValue);this.sessionStorage.setItem(this.storageKey,t)}getProduct(t){let e=null;const i=this.buildIndex(t);return Object.prototype.hasOwnProperty.call(this.storageValue,i)&&(e=this.storageValue[i]),e}buildIndex(t){return[t.idProduct,t.idProductAttribute,this.idLang].join("-")}}class i{constructor(t){this.storageKey="RcAttributionList",this.storageValue={},this.sessionStorage=t,this.initStorage()}initStorage(){const t=this.sessionStorage.getItem(this.storageKey);t&&(this.storageValue=JSON.parse(t))}addAttribution(t,e){this.storageValue[t]=e,this.updateSessionStorageValue()}updateSessionStorageValue(){const t=JSON.stringify(this.storageValue);this.sessionStorage.setItem(this.storageKey,t)}getAttributionList(){return this.storageValue}getAttribution(t){let e=null;return Object.prototype.hasOwnProperty.call(this.storageValue,t)&&(e=this.storageValue[t]),e}removeSessionStorageKey(){this.sessionStorage.removeItem(this.storageKey)}}class s{constructor(s){this.config=s;const n=this.config.context.localization.id_lang,r=new t;this.attributionStorage=new i(r),this.productStorage=new e(r,n)}initTrackingData(t){Object.prototype.hasOwnProperty.call(t,"detail_products_list")&&t.detail_products_list.length&&this.addProductsList(t.detail_products_list)}getProductModel(t){return this.productStorage.getProduct(t)}addProductsList(t){t.forEach((t=>this.productStorage.addProduct(t)))}addAttributionData(t,e){const i={productList:this.config.context.page.controller_name,productPosition:e};this.attributionStorage.addAttribution(t,i)}getAttributionDataList(){return this.attributionStorage.getAttributionList()}}class n{constructor(){this.errorLog=[],this.config=n.getTemplateData(this.getConfigNode()),this.sessionStorage=new s(this.config)}static getTemplateData(t){const e=n.getRawTrackingData(t);return n.parseModuleData(e)}static getRawTrackingData(t){let e="";const i=document.querySelector(t);return i instanceof HTMLElement&&i.dataset.trackingData&&i.dataset.trackingData.length&&(e=i.dataset.trackingData),e}static parseModuleData(t){return JSON.parse(decodeURIComponent(t)||"{}")}}class r{constructor(t){this.config=t}initScripts(){this.isAvailable()&&(this.config.optimize.hiding_timeout&&this.config.optimize.hiding_class_name&&(this.addHidingStyle(),this.addHiddingScript()),this.addOptimizeScript())}isAvailable(){return Boolean(this.config.optimize.tracking_id&&this.config.gua.tracking_id)}getTrackingId(){return this.config.optimize.tracking_id}getHidingClassName(){return this.config.optimize.hiding_class_name}getHidingTimeout(){return this.config.optimize.hiding_timeout}addHidingStyle(){const t=document.createElement("style");t.setAttribute("type","text/css"),t.innerHTML=`.${this.getHidingClassName()} { opacity: 0 !important };`,document.head.appendChild(t)}addHiddingScript(){const t=document.createElement("script");t.innerText=`\n            (function(a,s,y,n,c,h,i,d,e){s.className+=' '+y;h.start=1*new Date;\n            h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')};\n            (a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c);h.timeout=c;\n            })(window, document.documentElement, '${this.getHidingClassName()}', 'dataLayer', ${this.getHidingTimeout()}, {'${this.getTrackingId()}': true});\n        `,document.head.appendChild(t)}addOptimizeScript(){const t=document.createElement("script");t.src=`https://www.googleoptimize.com/optimize.js?id=${this.getTrackingId()}`,t.async=this.config.optimize.is_async,document.head.appendChild(t)}}class a{constructor(t,e,i){this.trackingPlatform=t,this.config=e,this.sessionStorage=i,this.actionTrackingEvents=[],this.dataTrackingEvents=[],this.createPageEvents()}createPageEvents(){this.createAddToCartEvent(),this.createCartViewEvent(),this.createCategoryEvent(),this.createCheckoutEvent(),this.createCustomerLogin(),this.createCustomerSignUp(),this.createHomeEvent(),this.createOrderCompleteEvent(),this.createProductClickEvent(),this.createProductShareEvent(),this.createProductViewEvent(),this.createPromotionClickEvent(),this.createSearchEvent(),this.createViewItemsListEvent()}
14initPageEvents(){this.actionTrackingEvents.forEach((t=>t.initEvent()))}initDataEvents(t){t&&this.dataTrackingEvents.forEach((e=>e.initDataEvent(t)))}}class o{constructor(t,e,i){this.trackingPlatform=t,this.config=e,this.sessionStorage=i,this.quantity=0}}class c{constructor(t){this.requestConfig=t,this.errorMessage="Something went wrong on request",this.requestConfig=t,this.formData=this.buildFormData()}buildFormData(){const t=new FormData;return t.append("fc",this.requestConfig.fc),t.append("module",this.requestConfig.module),t.append("controller",this.requestConfig.controller),t.append("action",this.requestConfig.action),t.append("data",encodeURIComponent(JSON.stringify(this.requestConfig.data))),t.append("token",this.requestConfig.token),t}fetchRequest(){return t=this,e=void 0,s=function*(){const t={method:"POST",mode:"same-origin",body:this.formData},e=new Request(this.requestConfig.url,t),i=yield fetch(e);if(i.ok){const t=yield i.json();return Promise.resolve(t)}return Promise.reject(new Error(this.errorMessage))},new((i=void 0)||(i=Promise))((function(n,r){function a(t){try{c(s.next(t))}catch(t){r(t)}}function o(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((s=s.apply(t,e||[])).next())}));var t,e,i,s}xhrRequest(){return new Promise(((t,e)=>{const i=new XMLHttpRequest;i.open("POST",this.requestConfig.url,!0),i.responseType="json",i.onload=()=>{200===i.status?t(i.response):e(new Error(this.errorMessage))},i.send(this.formData)}))}}var d=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{c(s.next(t))}catch(t){r(t)}}function o(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((s=s.apply(t,e||[])).next())}))};class h{static getProductsDetailList(t,e,i){return d(this,void 0,void 0,(function*(){let s=[];const n=[];if(t.forEach((t=>{const e=i.getProductModel(t);e?s.push(e):n.push(t)})),n.length){const n=yield h.fetchProductsLists(t,e);n.length&&i.addProductsList(n),s=[...s,...n]}return s}))}static fetchProductsLists(t,e){return d(this,void 0,void 0,(function*(){const i={url:e.context.shop.base_dir+"index.php",fc:"module",module:e.context.tracking_module.module_name,controller:"datarequest",action:"getProductsDetail",data:t,token:e.context.tracking_module.token};return new c(i).fetchRequest()}))}}class u extends o{initEvent(){document.addEventListener("click",this.triggerCartQuantity.bind(this),!0),prestashop.on("updateCart",this.triggerEvent.bind(this))}triggerCartQuantity(t){if(0===t.button&&t.target instanceof Element){const e=u.getAddToCartQuantity(t.target);e&&(this.quantity=e)}}static getAddToCartQuantity(t){let e=0;const i=t.closest("[data-button-action=add-to-cart]");if(i instanceof HTMLElement){let t=null,s="";if(e=1,i.matches("form *")?t=i.closest("form"):i.hasAttribute("form")&&(t=document.querySelector("#"+i.getAttribute("form"))),t instanceof HTMLFormElement){s=t.id;const i=t.querySelector("[name=qty]")||document.querySelector("[name=qty][form="+s+"]");(i instanceof HTMLInputElement||i instanceof HTMLSelectElement)&&(e=parseInt(i.value))}}return e}triggerEvent(t){return e=this,i=void 0,n=function*(){const e=u.getProductsDataList(t);if(e.length){const t=yield h.getProductsDetailList(e,this.config,this.sessionStorage);t.length&&this.quantity&&this.trackingPlatform.addToCart(t[0],this.quantity)}this.quantity=0},new((s=void 0)||(s=Promise))((function(t,r){function a(t){try{c(n.next(t))}catch(t){r(t)}}function o(t){try{c(n.throw(t))}catch(t){r(t)}}function c(e){var i;e.done?t(e.value):(i=e.value,i instanceof s?i:new s((function(t){t(i)}))).then(a,o)}c((n=n.apply(e,i||[])).next())}));var e,i,s,n}static getProductsDataList(t){const e=[];return u.isValidResponse(t)&&e.push({idProduct:t.resp.id_product,idProductAttribute:t.resp.id_product_attribute}),e}static isValidResponse(t){return Object.prototype.hasOwnProperty.call(t,"resp")&&t.resp.success}}class l{constructor(t,e,i){this.trackingPlatform=t,this.config=e,this.sessionStorage=i}initDataEvent(t){Object.prototype.hasOwnProperty.call(t,"detail_products_list")&&Object.prototype.hasOwnProperty.call(t,"order_products_list")&&t.detail_products_list.length&&t.order_products_list.length&&this.trackingPlatform.cartView(t.detail_products_list,t.order_products_list)}}
14var g=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{c(s.next(t))}catch(t){r(t)}}function o(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((s=s.apply(t,e||[])).next())}))};class p extends l{constructor(){super(...arguments),this.cartProductsQuantities={},this.lastInputFocus=""}initEvent(){document.addEventListener("click",this.handleEvent.bind(this),!0),prestashop.on("updateCart",this.updateQuantity.bind(this))}handleEvent(t){0===t.button&&t.target instanceof HTMLElement&&(t.target.closest(".js-increase-product-quantity")&&!p.isFocused(t.target)?this.increaseQuantity(t.target):t.target.closest(".js-decrease-product-quantity")&&!p.isFocused(t.target)?this.decreaseQuantity(t.target):t.target.closest(".js-cart-line-product-quantity")?this.setInputCurrentQuantity(t.target):t.target.closest(".remove-from-cart")&&this.removeFromCart(t.target))}static isFocused(t){const e=t.closest(".cart-item");if(e instanceof HTMLElement){const t=e.querySelector(".js-cart-line-product-quantity");return document.activeElement===t}return!1}increaseQuantity(t){return g(this,void 0,void 0,(function*(){const e=p.getProductsDataList(t);this.triggerEvent(e,1,this.trackingPlatform.addToCart.bind(this.trackingPlatform))}))}decreaseQuantity(t){return g(this,void 0,void 0,(function*(){const e=p.getProductsDataList(t);this.triggerEvent(e,1,this.trackingPlatform.removeFromCart.bind(this.trackingPlatform))}))}removeFromCart(t){const e=p.getProductsDataList(t),i=t.closest(".cart-item");if(i instanceof HTMLElement){const t=i.querySelector(".js-cart-line-product-quantity");if(t instanceof HTMLInputElement){const i=parseInt(t.value);this.triggerEvent(e,i,this.trackingPlatform.removeFromCart.bind(this.trackingPlatform))}}}static getProductsDataList(t){const e=t.closest(".cart-item"),i=[];let s,n;if(e instanceof HTMLElement){const t=e.querySelector(".remove-from-cart");t instanceof HTMLElement&&(s=parseInt(t.dataset.idProduct||"0"),n=parseInt(t.dataset.idProductAttribute||"0"),s&&i.push({idProduct:s,idProductAttribute:n}))}return i}setInputCurrentQuantity(t){return g(this,void 0,void 0,(function*(){const e=p.getProductsDataList(t),i=e[0],s=t.closest(".js-cart-line-product-quantity");if(e.length&&s instanceof HTMLInputElement){const t=JSON.stringify(i);t!==this.lastInputFocus&&(this.cartProductsQuantities[t]=parseInt(s.value),this.lastInputFocus=t)}}))}updateQuantity(t){return g(this,void 0,void 0,(function*(){if(t.reason.success){const e={idProduct:t.reason.id_product,idProductAttribute:t.reason.id_product_attribute},i=[e];if(i.length){const s=JSON.stringify(e),n=t.reason.quantity;if(this.lastInputFocus="",n>this.cartProductsQuantities[s]){const t=n-this.cartProductsQuantities[s];this.triggerEvent(i,t,this.trackingPlatform.addToCart.bind(this.trackingPlatform))}else{const t=this.cartProductsQuantities[s]-n;this.triggerEvent(i,t,this.trackingPlatform.removeFromCart.bind(this.trackingPlatform))}}}}))}triggerEvent(t,e,i){return g(this,void 0,void 0,(function*(){if(t.length){const s=yield h.getProductsDetailList(t,this.config,this.sessionStorage);s.length&&e&&i(s[0],e)}}))}initDataEvent(t){Object.prototype.hasOwnProperty.call(t,"detail_products_list")&&Object.prototype.hasOwnProperty.call(t,"order_products_list")&&t.detail_products_list.length&&t.order_products_list.length&&this.trackingPlatform.cartView(t.detail_products_list,t.order_products_list)}}class m{constructor(t,e){this.trackingPlatform=t,this.config=e}initEvent(){this.triggerEvent()}triggerEvent(){this.hasCategoryData()&&this.trackingPlatform.categoryPageView()}hasCategoryData(){return Object.prototype.hasOwnProperty.call(this.config.context.page,"category")&&Object.prototype.hasOwnProperty.call(this.config.context.page.category,"id_category")&&Object.prototype.hasOwnProperty.call(this.config.context.page.category,"name")&&Object.prototype.hasOwnProperty.call(this.config.context.page.category,"path")}}class f extends m{}class v{constructor(t,e,i){this.trackingPlatform=t,this.config=e,this.sessionStorage=i,this.checkoutController=this.getCheckoutModule()}initEvent(){this.isValidCheckoutController()&&this.checkoutController.initEvent()}isValidCheckoutController(){return this.config.context.page.controller_name===this.config.context.tracking_module.checkout_module.controller}initDataEvent(t){this.isValidCheckoutController()&&v.isValidTrackingData(t)&&this.checkoutController.initDataEvent(t)}static isValidTrackingData(t){return Object.prototype.hasOwnProperty.call(t,"detail_products_list")&&Object.prototype.hasOwnProperty.call(t,"order_products_list")&&Boolean(t.detail_products_list.length)&&Boolean(t.order_products_list.length)}}
14var y=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{c(s.next(t))}catch(t){r(t)}}function o(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((s=s.apply(t,e||[])).next())}))};class P{constructor(t,e){this.config=t,this.sessionStorage=e,this.productsThemeData=[],this.detailProductsList=[],this.orderProductsList=[]}getCartProductsData(){return y(this,void 0,void 0,(function*(){return this.updateCartProducts(),this.getProductsThemeData(),yield this.getProductsListData(),this.detailProductsList&&this.getOrderProductsList(),[this.detailProductsList,this.orderProductsList]}))}updateCartProducts(){this.cartProducts=prestashop.cart.products}getProductsThemeData(){this.cartProducts&&this.cartProducts.forEach((t=>{this.productsThemeData.push({idProduct:parseInt(t.id_product),idProductAttribute:parseInt(t.id_product_attribute)})}))}getProductsListData(){return y(this,void 0,void 0,(function*(){this.productsThemeData.length&&(this.detailProductsList=yield h.getProductsDetailList(this.productsThemeData,this.config,this.sessionStorage))}))}getOrderProductsList(){this.detailProductsList&&this.cartProducts&&(this.orderProductsList=JSON.parse(JSON.stringify(this.detailProductsList)),this.cartProducts.forEach(((t,e)=>{this.orderProductsList[e].quantity=t.quantity})))}}class E{constructor(t,e,i){this.trackingPlatform=t,this.config=e,this.sessionStorage=i,this.step=1,this.carrierSelected="",this.paymentSelected="",this.checkoutTrait=new P(this.config,this.sessionStorage)}initCheckoutEvent(){this.setDefaultCheckoutValues(),document.addEventListener("click",this.delegateCheckoutEvent.bind(this),!0)}static isValidMouseEvent(t){return 0===t.button&&t.isTrusted}static isValidAgreement(){const t=document.querySelector("input[name=cgv]");return!(t instanceof HTMLInputElement)||t.checked}static isCheckoutWithCarrier(t){return Boolean(document.querySelector(t))}sendTrackingCarrierOption(){this.checkoutTrait.getCartProductsData().then((t=>{t&&(this.detailProductsList=t[0],this.orderProductsList=t[1]),this.trackingPlatform.checkoutOption("shipping",this.carrierSelected,this.step,this.detailProductsList,this.orderProductsList)}))}sendTrackingPaymentOption(){this.checkoutTrait.getCartProductsData().then((t=>{t&&(this.detailProductsList=t[0],this.orderProductsList=t[1]),this.trackingPlatform.checkoutOption("payment",this.paymentSelected,this.step,this.detailProductsList,this.orderProductsList)}))}initDataEvent(t){this.detailProductsList=t.detail_products_list,this.orderProductsList=t.order_products_list,this.trackingPlatform.checkoutProgress(t.detail_products_list,t.order_products_list,this.step)}}class k extends E{initEvent(){this.setCurrentStep(),this.initCheckoutEvent()}setCurrentStep(){const t=document.querySelectorAll(".checkout-step"),e=Array.prototype.findIndex.call(t,(t=>t.classList.contains("js-current-step")));this.step=-1!==e?e:1}setDefaultCheckoutValues(){this.getCarrierSelected()}delegateCheckoutEvent(t){if(k.isValidMouseEvent(t)){const e=t.target;k.isValidCarrierSelectionEvent(e)?this.getCarrierSelected():k.isValidCarrierEvent(e)?this.sendTrackingCarrierOption():k.isValidPaymentSelectionEvent(e)?this.getPaymentSelected():k.isValidPurchaseEvent(e)&&this.sendTrackingPaymentOption()}}static isValidCarrierSelectionEvent(t){return t.matches("#checkout-delivery-step .delivery-options *")}getCarrierSelected(){let t="",e=document.querySelector("[id^=delivery_option_]:checked");e=e?e.closest(".delivery-option"):null,e=e?e.querySelector(".carrier-name"):null,e&&(t=e.textContent||""),this.carrierSelected=t.trim()}static isValidCarrierEvent(t){return Boolean(t.closest("#checkout-delivery-step button[type=submit]"))}static isValidPaymentSelectionEvent(t){return t.matches("#checkout-payment-step .payment-options *")}getPaymentSelected(){let t="";const e=document.querySelector("[id^=payment-option-]:checked");e&&Object.hasOwnProperty.call(e.dataset,"moduleName")&&(t=e.dataset.moduleName||""),this.paymentSelected=t.trim()}static isValidPurchaseEvent(t){return Boolean(t.closest("#payment-confirmation button[type=submit]"))&&k.isValidAgreement()}static isValidAgreement(){const t=document.querySelector("input[name^=conditions_to_approve]");return!(t instanceof HTMLInputElement)||t.checked}initDataEvent(t){0!==this.step&&super.initDataEvent(t)}}
14class S extends E{setDefaultCheckoutValues(){this.getCarrierSelected(),this.getPaymentSelected()}static isValidCarrierSelectionEvent(t){return t.matches("#pwc-delivery-options *")}getPaymentSelected(){this.paymentSelected="sveacheckout"}static isValidPurchaseEvent(t){return t.matches("a *")}triggerPurchaseEvent(){this.sendTrackingCarrierOption(),this.sendTrackingPaymentOption()}}class _ extends S{constructor(t,e,i){super(t,e,i),this.trackingPlatform=t,this.config=e,this.sessionStorage=i,this.cartViewEvent=new p(this.trackingPlatform,this.config,this.sessionStorage)}initEvent(){this.cartViewEvent.initEvent(),this.initCheckoutEvent()}delegateCheckoutEvent(t){if(_.isValidMouseEvent(t)){const e=t.target;_.isValidCarrierSelectionEvent(e)?this.getCarrierSelected():_.isValidPurchaseEvent(e)&&this.triggerPurchaseEvent()}}getCarrierSelected(){let t="";const e=document.querySelector(".selected[id^=delivery_option] .flex-grow-1.flex-shrink-1");return e instanceof HTMLElement&&e.firstElementChild instanceof HTMLElement&&(t=e.firstElementChild.innerText.trim().toLowerCase()),this.carrierSelected=t}}class w extends E{setDefaultCheckoutValues(){this.getCarrierSelected(),this.getPaymentSelected()}static isValidCarrierSelectionEvent(t){return t.matches("#klarnacarrier *")}getPaymentSelected(){this.paymentSelected="klarna"}triggerPurchaseEvent(){this.sendTrackingCarrierOption(),this.sendTrackingPaymentOption()}static isValidPurchaseEvent(t){return t.matches("a *")}}class L extends w{constructor(t,e,i){super(t,e,i),this.trackingPlatform=t,this.config=e,this.sessionStorage=i,this.cartViewEvent=new p(this.trackingPlatform,this.config,this.sessionStorage)}initEvent(){this.cartViewEvent.initEvent(),this.initCheckoutEvent()}delegateCheckoutEvent(t){if(L.isValidMouseEvent(t)){const e=t.target;L.isValidCarrierSelectionEvent(e)?this.getCarrierSelected():L.isValidPurchaseEvent(e)&&this.triggerPurchaseEvent()}}getCarrierSelected(){let t="";const e=document.querySelector("#klarnacarrier .selected .kco-sel-list__item__title");e instanceof HTMLElement&&e.firstElementChild instanceof HTMLElement&&(t=e.firstElementChild.innerText.trim().toLowerCase()),this.carrierSelected=t}}class C extends E{delegateCheckoutEvent(t){}setDefaultCheckoutValues(){this.getCarrierSelected(),this.getPaymentSelected()}getCarrierSelected(){this.carrierSelected="not detected"}getPaymentSelected(){this.paymentSelected="qliro"}}class b extends C{constructor(t,e,i){super(t,e,i),this.trackingPlatform=t,this.config=e,this.sessionStorage=i,this.cartViewEvent=new p(this.trackingPlatform,this.config,this.sessionStorage)}initEvent(){this.cartViewEvent.initEvent()}}class T extends E{setDefaultCheckoutValues(){setTimeout(this.getCheckoutLazyOptions.bind(this),1e3)}getCheckoutLazyOptions(){document.querySelector("#thecheckout-payment")?(this.getCarrierSelected(),this.getPaymentSelected()):setTimeout(this.getCheckoutLazyOptions.bind(this),1e3)}}class V extends T{constructor(t,e,i){super(t,e,i),this.trackingPlatform=t,this.config=e,this.sessionStorage=i,this.cartViewEvent=new p(this.trackingPlatform,this.config,this.sessionStorage)}initEvent(){this.cartViewEvent.initEvent(),this.initCheckoutEvent()}delegateCheckoutEvent(t){if(V.isValidMouseEvent(t)){const e=t.target;e.matches("#tc-container *")&&(V.isValidCarrierSelectionEvent(e)?this.getCarrierSelected():V.isValidPaymentSelectionEvent(e)?this.getPaymentSelected():V.isValidPurchaseEvent(e)&&this.triggerPurchaseEvent())}}static isValidCarrierSelectionEvent(t){return t.matches("#thecheckout-shipping *")}getCarrierSelected(){let t="";const e=document.querySelector(".delivery-options input:checked");if(e instanceof HTMLInputElement){const i=e.closest(".delivery-option-row");if(i instanceof HTMLElement){const e=i.querySelector(".carrier-name");t=e instanceof HTMLElement?e.innerText:""}}this.carrierSelected=t.trim().toLowerCase()}static isValidPaymentSelectionEvent(t){return t.matches("#thecheckout-payment *")}getPaymentSelected(){let t="";const e=document.querySelector(".payment-options input:checked");e instanceof HTMLInputElement&&(t=e.dataset.moduleName||""),this.paymentSelected=t.trim().toLowerCase()}static isValidPurchaseEvent(t){return Boolean(t.closest("#confirm_order"))&&V.isValidAgreement()}static isValidAgreement(){const t=document.querySelector("input[name^=conditions_to_approve]");return!(t instanceof HTMLInputElement)||t.checked}triggerPurchaseEvent(){V.isCheckoutWithCarrier("body:not(.is-virtual-cart) #thecheckout-shipping")&&this.sendTrackingCarrierOption(),this.sendTrackingPaymentOption()}}
14class O extends E{constructor(){super(...arguments),this.checkoutCarrierNodeSelector="#onepagecheckoutps_contenedor #js-delivery, #opc_main #form-shipping_container"}static isCartViewEvent(){return Boolean(document.querySelector("#cart_summary"))}setDefaultCheckoutValues(){setTimeout(this.getCheckoutLazyOptions.bind(this),1e3)}getCheckoutLazyOptions(){document.querySelector("#payment_method_container")?(this.getCarrierSelected(),this.getPaymentSelected()):setTimeout(this.getCheckoutLazyOptions.bind(this),1e3)}static isValidCarrierSelectionEvent(t){return t.matches("#js-delivery *, #form-shipping_container .delivery-options *")}static isValidPaymentSelectionEvent(t){return t.matches("#payment_method_container *")}static isValidPurchaseEvent(t){return Boolean(t.closest("#btn_place_order, #btn-placer_order"))&&E.isValidAgreement()}}class x extends O{constructor(t,e,i){super(t,e,i),this.trackingPlatform=t,this.config=e,this.sessionStorage=i,this.cartViewEvent=new p(this.trackingPlatform,this.config,this.sessionStorage)}initEvent(){x.isCartViewEvent()?this.cartViewEvent.initEvent():this.initCheckoutEvent()}delegateCheckoutEvent(t){if(x.isValidMouseEvent(t)){const e=t.target;e.matches("#onepagecheckoutps_contenedor *, #opc_main *")&&(x.isValidCarrierSelectionEvent(e)?this.getCarrierSelected():x.isValidPaymentSelectionEvent(e)?this.getPaymentSelected():x.isValidPurchaseEvent(e)&&this.triggerPurchaseEvent())}}getCarrierSelected(){let t="";const e=document.querySelector("[name^=delivery_option]:checked");if(e instanceof HTMLInputElement){const i=e.closest(".delivery-option");if(i instanceof HTMLElement){const e=i.querySelector(".delivery_option_title");t=e instanceof HTMLElement&&e.textContent?e.textContent:""}}this.carrierSelected=t.trim().toLowerCase()}getPaymentSelected(){let t="";const e=document.querySelector("[name=payment-option]:checked");e instanceof HTMLInputElement&&(t=e.value.trim().toLowerCase()),this.paymentSelected=t}static isValidAgreement(){const t=document.querySelector("input[name^=conditions_to_approve]");return!(t instanceof HTMLInputElement)||t.checked}triggerPurchaseEvent(){x.isCheckoutWithCarrier(this.checkoutCarrierNodeSelector)&&this.sendTrackingCarrierOption(),this.sendTrackingPaymentOption()}initDataEvent(t){x.isCartViewEvent()?this.cartViewEvent.initDataEvent(t):super.initDataEvent(t)}}class D extends E{setDefaultCheckoutValues(){setTimeout(this.getCheckoutLazyOptions.bind(this),1e3)}getCheckoutLazyOptions(){document.querySelector("#st-checkout-payment-step")?(this.getCarrierSelected(),this.getPaymentSelected()):setTimeout(this.getCheckoutLazyOptions.bind(this),1e3)}}class M extends D{constructor(t,e,i){super(t,e,i),this.trackingPlatform=t,this.config=e,this.sessionStorage=i,this.cartViewEvent=new p(this.trackingPlatform,this.config,this.sessionStorage)}initEvent(){this.cartViewEvent.initEvent(),this.initCheckoutEvent()}delegateCheckoutEvent(t){if(M.isValidMouseEvent(t)){const e=t.target;e.matches("#content.steco_container *")&&(M.isValidCarrierSelectionEvent(e)?this.getCarrierSelected():M.isValidPaymentSelectionEvent(e)?this.getPaymentSelected():M.isValidPurchaseEvent(e)&&this.triggerPurchaseEvent())}}static isValidCarrierSelectionEvent(t){return t.matches("#st-checkout-delivery-step *")}getCarrierSelected(){let t="";const e=document.querySelector(".delivery-options input:checked");if(e instanceof HTMLInputElement){const i=e.closest(".delivery-option");if(i instanceof HTMLElement){const e=i.querySelector(".carrier-name");t=e instanceof HTMLElement?e.innerText:""}}this.carrierSelected=t.trim().toLowerCase()}static isValidPaymentSelectionEvent(t){return t.matches("#st-checkout-payment-step *")}getPaymentSelected(){let t="";const e=document.querySelector(".payment-options input:checked");e instanceof HTMLInputElement&&(t=e.dataset.moduleName||""),this.paymentSelected=t.trim().toLowerCase()}static isValidPurchaseEvent(t){return Boolean(t.closest("#payment-confirmation"))&&M.isValidAgreement()}static isValidAgreement(){const t=document.querySelector("input[name^=conditions_to_approve]");return!(t instanceof HTMLInputElement)||t.checked}triggerPurchaseEvent(){M.isCheckoutWithCarrier("#st-checkout-delivery-step")&&this.sendTrackingCarrierOption(),this.sendTrackingPaymentOption()}}
14class I extends E{setDefaultCheckoutValues(){setTimeout(this.getCheckoutLazyOptions.bind(this),1e3)}getCheckoutLazyOptions(){document.querySelector("#supercheckout-fieldset")?(this.getCarrierSelected(),this.getPaymentSelected()):setTimeout(this.getCheckoutLazyOptions.bind(this),1e3)}}class q extends I{constructor(t,e,i){super(t,e,i),this.trackingPlatform=t,this.config=e,this.sessionStorage=i,this.cartViewEvent=new p(this.trackingPlatform,this.config,this.sessionStorage)}initEvent(){this.cartViewEvent.initEvent(),this.initCheckoutEvent()}delegateCheckoutEvent(t){if(q.isValidMouseEvent(t)){const e=t.target;e.matches("#supercheckout-fieldset *")&&(q.isValidCarrierSelectionEvent(e)?this.getCarrierSelected():q.isValidPaymentSelectionEvent(e)?this.getPaymentSelected():q.isValidPurchaseEvent(e)&&this.triggerPurchaseEvent())}}static isValidCarrierSelectionEvent(t){return t.matches("#shipping-method *")}getCarrierSelected(){let t="";const e=document.querySelector("input.supercheckout_shipping_option:checked");if(e instanceof HTMLInputElement){const i=e.closest("li");if(i instanceof HTMLElement){const e=i.querySelector("img")||i.querySelector("label");e instanceof HTMLImageElement?t=e.alt:e instanceof HTMLLabelElement&&e.firstChild instanceof Text&&e.firstChild.textContent&&(t=e.firstChild.textContent)}}this.carrierSelected=t.trim().toLowerCase()}static isValidPaymentSelectionEvent(t){return t.matches("#payment-method *")}getPaymentSelected(){let t="";const e=document.querySelector(".payment-options input:checked");e instanceof HTMLInputElement&&(t=e.dataset.moduleName||""),this.paymentSelected=t.trim().toLowerCase()}static isValidPurchaseEvent(t){return Boolean(t.closest("#supercheckout_confirm_order"))&&q.isValidAgreement()}static isValidAgreement(){const t=document.querySelector("input[name^=conditions_to_approve]");return!(t instanceof HTMLInputElement)||t.checked}triggerPurchaseEvent(){q.isCheckoutWithCarrier("input.supercheckout_shipping_option")&&this.sendTrackingCarrierOption(),this.sendTrackingPaymentOption()}}class j extends v{getCheckoutModule(){return class{static getCheckoutController(t,e,i){let s;switch(e.context.tracking_module.checkout_module.module){case"klarnaofficial":s=new L(t,e,i);break;case"onepagecheckoutps":s=new x(t,e,i);break;case"pw_qlirocheckout":s=new b(t,e,i);break;case"steasycheckout":s=new M(t,e,i);break;case"supercheckout":s=new q(t,e,i);break;case"sveacheckout":s=new _(t,e,i);break;case"thecheckout":s=new V(t,e,i);break;default:s=new k(t,e,i)}return s}}.getCheckoutController(this.trackingPlatform,this.config,this.sessionStorage)}}class A{constructor(t,e){this.trackingPlatform=t,this.config=e}initEvent(){this.triggerEvent()}triggerEvent(){this.config.context.user&&this.config.context.user.is_new_login&&this.trackingPlatform.customerLogin()}}class H extends A{}class N{constructor(t,e){this.trackingPlatform=t,this.config=e}initEvent(){this.triggerEvent()}triggerEvent(){this.config.context.user&&this.config.context.user.is_new_account&&this.trackingPlatform.customerSignUp()}}class Q extends N{}class B{constructor(t,e){this.trackingPlatform=t,this.config=e}initEvent(){"index"===this.config.context.page.controller_name&&this.triggerEvent()}triggerEvent(){this.trackingPlatform.homePageView()}}class F extends B{}class R{constructor(t,e,i){this.trackingPlatform=t,this.config=e,this.sessionStorage=i}initDataEvent(t){R.isValidTrackingData(t)&&(this.trackingPlatform.isAvailable()?this.trackingPlatform.orderComplete(t.order_complete_data,t.detail_products_list,t.order_products_list,t.order_context_user_data,this.setOrderTrackingStatus.bind(this)):this.handleAdBlockOrderAborted(t.order_complete_data))}static isValidTrackingData(t){return Object.prototype.hasOwnProperty.call(t,"order_complete_data")&&Object.prototype.hasOwnProperty.call(t,"detail_products_list")&&Object.prototype.hasOwnProperty.call(t,"order_products_list")&&Object.prototype.hasOwnProperty.call(t,"order_context_user_data")&&Boolean(Object.keys(t.order_complete_data).length)&&Boolean(Object.keys(t.detail_products_list).length)&&Boolean(Object.keys(t.order_products_list).length)&&Boolean(Object.keys(t.order_context_user_data).length)}
14setOrderTrackingStatus(t){this.serverRequest("setOrderTrackingStatus",t)}handleAdBlockOrderAborted(t){this.serverRequest("handleAdBlockOrderAborted",t)}serverRequest(t,e){const i={url:this.config.context.shop.base_dir+"index.php",fc:"module",module:this.config.context.tracking_module.module_name,controller:"datarequest",action:t,data:e,token:this.config.context.tracking_module.token};new c(i).fetchRequest()}}class z extends R{}class U{constructor(t,e,i){this.trackingPlatform=t,this.config=e,this.sessionStorage=i}initEvent(){document.addEventListener("click",this.handleEvent.bind(this),!0)}triggerEvent(t){return e=this,i=void 0,n=function*(){if(t.length){const e=yield h.getProductsDetailList(t,this.config,this.sessionStorage);if(e.length){const t=this.sessionStorage.getAttributionDataList();this.trackingPlatform.productClick(e[0],t)}}},new((s=void 0)||(s=Promise))((function(t,r){function a(t){try{c(n.next(t))}catch(t){r(t)}}function o(t){try{c(n.throw(t))}catch(t){r(t)}}function c(e){var i;e.done?t(e.value):(i=e.value,i instanceof s?i:new s((function(t){t(i)}))).then(a,o)}c((n=n.apply(e,i||[])).next())}));var e,i,s,n}}class J extends U{handleEvent(t){if(0===t.button&&t.target instanceof Element){const e=J.getProductThemeDataList(t.target);this.triggerEvent(e)}}static getProductThemeDataList(t){const e=[],i=t.closest(".js-product-miniature a");if(i instanceof HTMLElement){const s=".js-product-miniature",n=t.closest(s);if(n instanceof HTMLElement){const t=parseInt(n.dataset.idProduct||"0"),s=parseInt(i.dataset.idProductAttribute||n.dataset.idProductAttribute||"0");t&&e.push({idProduct:t,idProductAttribute:s})}}return e}}class K{constructor(t,e,i){this.trackingPlatform=t,this.config=e,this.sessionStorage=i}initEvent(){document.addEventListener("click",this.handleEvent.bind(this),!1)}triggerEvent(t,e){return i=this,s=void 0,r=function*(){if(t.length&&e){const i=yield h.getProductsDetailList(t,this.config,this.sessionStorage);i.length&&this.trackingPlatform.productShare(i[0],e)}},new((n=void 0)||(n=Promise))((function(t,e){function a(t){try{c(r.next(t))}catch(t){e(t)}}function o(t){try{c(r.throw(t))}catch(t){e(t)}}function c(e){var i;e.done?t(e.value):(i=e.value,i instanceof n?i:new n((function(t){t(i)}))).then(a,o)}c((r=r.apply(i,s||[])).next())}));var i,s,n,r}static getSocialNetwork(t){return t.dataset.network||t.dataset.type||t.title||""}}class $ extends K{constructor(){super(...arguments),this.productView={idProduct:0,idProductAttribute:0},this.productQuickView={idProduct:0,idProductAttribute:0}}initEvent(){super.initEvent(),prestashop.on("clickQuickView",this.handlePSEvent.bind(this)),prestashop.on("updatedProduct",this.handlePSEvent.bind(this))}handlePSEvent(t){$.isEventQuickView(t)?(this.productQuickView.idProduct=t.dataset.idProduct,this.productQuickView.idProductAttribute=t.dataset.idProductAttribute):this.productView.idProductAttribute=parseInt(t.id_product_attribute)}static isEventQuickView(t){return Object.prototype.hasOwnProperty.call(t,"dataset")}handleEvent(t){if(0===t.button&&t.target instanceof Element){const e=".js-social-sharing",i=t.target.closest(e);if(i instanceof HTMLElement){const t=this.getProductsDataList(i),e=$.getSocialNetwork(i);this.triggerEvent(t,e)}}}getProductsDataList(t){const e=[],i=t.closest("[id^=quickview-modal-]")instanceof HTMLElement?this.productQuickView:this.productView;return i.idProduct&&e.push(i),e}initDataEvent(t){"product"===this.config.context.page.controller_name&&Object.prototype.hasOwnProperty.call(t,"detail_product_view")&&t.detail_product_view.length&&(this.productView.idProduct=t.detail_product_view[0].id_product,this.productView.idProductAttribute=t.detail_product_view[0].id_attribute)}}class W{constructor(t,e,i){this.trackingPlatform=t,this.config=e,this.sessionStorage=i}}class G extends W{constructor(){super(...arguments),this.latestProductView="",this.productView={idProduct:0,idProductAttribute:0},this.productQuickView={idProduct:0,idProductAttribute:0}}initEvent(){prestashop.on("clickQuickView",this.triggerEvent.bind(this)),prestashop.on("updatedProduct",this.triggerEvent.bind(this))}triggerEvent(t){return e=this,i=void 0,n=function*(){const e=this.getProductsDataList(t);
14if(e.length){const t=yield h.getProductsDetailList(e,this.config,this.sessionStorage);t.length&&this.trackingPlatform.productView(t[0])}},new((s=void 0)||(s=Promise))((function(t,r){function a(t){try{c(n.next(t))}catch(t){r(t)}}function o(t){try{c(n.throw(t))}catch(t){r(t)}}function c(e){var i;e.done?t(e.value):(i=e.value,i instanceof s?i:new s((function(t){t(i)}))).then(a,o)}c((n=n.apply(e,i||[])).next())}));var e,i,s,n}getProductsDataList(t){const e=[];if(G.isEventQuickView(t))this.productQuickView.idProduct=t.dataset.idProduct,this.productQuickView.idProductAttribute=t.dataset.idProductAttribute,e.push(this.productQuickView);else{const i=G.isQuickViewModal()?this.productQuickView:this.productView;i.idProductAttribute=parseInt(t.id_product_attribute),this.isLatestProductView(i)&&(e.push(i),this.setLatestProductView(i))}return e}static isEventQuickView(t){return Object.prototype.hasOwnProperty.call(t,"dataset")}static isQuickViewModal(){return Boolean(document.querySelector("[id^=quickview]"))}isLatestProductView(t){return this.latestProductView!==JSON.stringify(t)}setLatestProductView(t){this.latestProductView=JSON.stringify(t)}initDataEvent(t){if(Object.prototype.hasOwnProperty.call(t,"detail_product_view")&&t.detail_product_view.length){this.sessionStorage.addProductsList(t.detail_product_view);const e=t.detail_product_view[0];this.productView.idProduct=e.id_product,this.productView.idProductAttribute=e.id_attribute,this.trackingPlatform.productView(e),this.setLatestProductView(this.productView)}}}var Y=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{c(s.next(t))}catch(t){r(t)}}function o(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((s=s.apply(t,e||[])).next())}))};class X{static getThemeParameters(t){const e={pid:"",pnm:"",cnm:"",csl:"",ppid:"",ppaid:""};if(t.search){const i=new URLSearchParams(t.search);if(X.hasRequiredPromotionParams(i))return Object.keys(e).forEach((t=>{const s=i.get(t);s&&(e[t]=s)})),e}}static hasRequiredPromotionParams(t){return Boolean(t.get("pid"))}static getDetailPromotionModel(t,e,i){return Y(this,void 0,void 0,(function*(){const s={promotion_url:"",promotion_params:{promotion_id:"",promotion_name:"",creative_slot:"",creative_name:""}};if(t&&t.parameters&&(s.promotion_url=t.url,Object.entries({pid:"promotion_id",pnm:"promotion_name",cnm:"creative_name",csl:"creative_slot"}).forEach((([e,i])=>{var n;s.promotion_params[i]=(null===(n=t.parameters)||void 0===n?void 0:n[e])||""})),X.hasPromotionItem(t.parameters))){const n=yield X.getPromotionItem(t,e,i);n&&(s.promotion_item=n[0])}return s}))}static hasPromotionItem(t){return Boolean(t.ppid)}static getPromotionItem(t,e,i){var s,n;return Y(this,void 0,void 0,(function*(){const r={idProduct:parseInt(null===(s=t.parameters)||void 0===s?void 0:s.ppid),idProductAttribute:parseInt((null===(n=t.parameters)||void 0===n?void 0:n.ppaid)||"0")};return h.getProductsDetailList([r],e,i)}))}}var Z=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{c(s.next(t))}catch(t){r(t)}}function o(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((s=s.apply(t,e||[])).next())}))};class tt{constructor(t,e,i){this.trackingPlatform=t,this.config=e,this.sessionStorage=i}initEvent(){document.addEventListener("click",this.triggerEvent.bind(this),!0)}triggerEvent(t){return Z(this,void 0,void 0,(function*(){const e=yield this.getPromotionData(t);e&&this.trackingPlatform.promotionClick(e)}))}getPromotionData(t){return Z(this,void 0,void 0,(function*(){let e;if(0===t.button&&t.target instanceof Element){const i=t.target.closest(".js-track-promo a");if(i){const t={url:i.href,parameters:X.getThemeParameters(i)};e=yield X.getDetailPromotionModel(t,this.config,this.sessionStorage)}}return e}))}}class et extends tt{}class it{constructor(t,e){this.trackingPlatform=t,this.config=e}initEvent(){var t;(null===(t=this.config.context.page.search_term)||void 0===t?void 0:t.length)&&this.trackingPlatform.searchPageView()}}class st extends it{}class nt{constructor(t,e,i){this.trackingPlatform=t,this.config=e,this.sessionStorage=i,this.scrollTimeout=0,this.allItemsList=this.getAllItemsList()}initEvent(){window.addEventListener("scroll",this.triggerEvent.bind(this),!0),this.parseItemsList(),this.sendItems()}triggerEvent(){window.clearTimeout(this.scrollTimeout),this.parseItemsList(),this.scrollTimeout=window.setTimeout((()=>this.sendItems()),800)}parseItemsList(){this.allItemsList.length&&this.allItemsList.forEach((t=>{const e=t.getItemsListDetected();e.length&&e.forEach((e=>{nt.isElementInViewport(e)&&t.addItem(e)}))}))}static isElementInViewport(t){let e=!1;const i=window.innerHeight,s=window.pageYOffset,n=s,r=s+i;let a,o,c,d,h;const u=t.clientHeight;return u&&(c=getComputedStyle(t),d=parseInt(c.paddingTop)+parseInt(c.paddingBottom),h=t.getBoundingClientRect(),a=h.top+s,o=a+(u-d),e=a>=n&&a<r||o>=n&&o<r),e}sendItems(){this.allItemsList.forEach((t=>{t.sendItems()})),window.clearTimeout(this.scrollTimeout)}}class rt{constructor(t,e,i,s){this.itemSelector=t,this.trackingPlatform=e,this.config=i,this.sessionStorage=s,this.sendProducts=new Set,this.sentProducts=new Set,this.productsPosition={}}getItemsListDetected(){return document.querySelectorAll(this.itemSelector)}addItem(t){const e=parseInt(t.getAttribute("data-id-product")||"0"),i=parseInt(t.getAttribute("data-id-product-attribute")||"0");if(e){const t={idProduct:e,idProductAttribute:i},s=JSON.stringify(t);this.sentProducts.has(s)||this.sendProducts.has(s)||this.sendProducts.add(s)}}sendItems(){return t=this,e=void 0,s=function*(){if(this.sendProducts.size){this.buildProductPositions();const t=this.getProductsDataListFromSendProducts(),e=yield h.getProductsDetail
14List(t,this.config,this.sessionStorage);e.length&&(this.trackingPlatform.productsList(e,this.productsPosition),this.sentProducts=new Set([...Array.from(this.sentProducts),...Array.from(this.sendProducts)]),this.sendProducts.clear())}},new((i=void 0)||(i=Promise))((function(n,r){function a(t){try{c(s.next(t))}catch(t){r(t)}}function o(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((s=s.apply(t,e||[])).next())}));var t,e,i,s}getProductsDataListFromSendProducts(){const t=[];return this.sendProducts.forEach((e=>{t.push(JSON.parse(e))})),t}buildProductPositions(){const t=this.getItemsListDetected();let e,i,s=this.getPageFirstPosition();t.forEach((t=>{if(e=parseInt(t.getAttribute("data-id-product")||"0"),i=parseInt(t.getAttribute("data-id-product-attribute")||"0"),e){const t={idProduct:e,idProductAttribute:i},n=JSON.stringify(t);Object.prototype.hasOwnProperty.call(this.productsPosition,n)||(this.productsPosition[n]=s,s+=1),this.sessionStorage.addAttributionData(n,this.productsPosition[n])}}))}}class at extends rt{constructor(t,e,i){super(".js-product-miniature",t,e,i)}getPageFirstPosition(){let t=1;const e=this.config.context.page.products_per_page,i=new URLSearchParams(window.location.search).get("page");return i&&(t=parseInt(i)),e*t-e+1}}class ot{constructor(t,e,i){this.trackingPlatform=t,this.config=e,this.sessionStorage=i,this.itemSelector=".js-track-promo",this.sendPromotions=new Set,this.sentPromotions=new Set}getItemsListDetected(){return document.querySelectorAll(this.itemSelector)}addItem(t){const e=t.querySelector("a");if(e){const t={url:e.href,parameters:X.getThemeParameters(e)};if(t.parameters){const e=JSON.stringify(t);this.sendPromotions.has(e)||this.sentPromotions.has(e)||this.sendPromotions.add(e)}}}sendItems(){return t=this,e=void 0,s=function*(){if(this.sendPromotions.size){const t=[];for(const e of this.sendPromotions){const i=JSON.parse(e),s=yield X.getDetailPromotionModel(i,this.config,this.sessionStorage);
14s&&t.push(s)}this.trackingPlatform.promotionsList(t),this.sentPromotions=new Set([...Array.from(this.sentPromotions),...Array.from(this.sendPromotions)]),this.sendPromotions.clear()}},new((i=void 0)||(i=Promise))((function(n,r){function a(t){try{c(s.next(t))}catch(t){r(t)}}function o(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}c((s=s.apply(t,e||[])).next())}));var t,e,i,s}}class ct extends ot{}class dt extends nt{getAllItemsList(){return[new at(this.trackingPlatform,this.config,this.sessionStorage),new ct(this.trackingPlatform,this.config,this.sessionStorage)]}}class ht extends a{createAddToCartEvent(){this.actionTrackingEvents.push(new u(this.trackingPlatform,this.config,this.sessionStorage))}createCartViewEvent(){if("cart"===this.config.context.page.controller_name){const t=new p(this.trackingPlatform,this.config,this.sessionStorage);this.actionTrackingEvents.push(t),this.dataTrackingEvents.push(t)}}createCategoryEvent(){"category"===this.config.context.page.controller_name&&this.actionTrackingEvents.push(new f(this.trackingPlatform,this.config))}createCheckoutEvent(){if(this.config.context.page.controller_name===this.config.context.tracking_module.checkout_module.controller){const t=new j(this.trackingPlatform,this.config,this.sessionStorage);this.actionTrackingEvents.push(t),this.dataTrackingEvents.push(t)}}createCustomerLogin(){this.config.context.user.is_new_login&&this.actionTrackingEvents.push(new H(this.trackingPlatform,this.config))}createCustomerSignUp(){this.config.context.user.is_new_account&&this.actionTrackingEvents.push(new Q(this.trackingPlatform,this.config))}createHomeEvent(){this.actionTrackingEvents.push(new F(this.trackingPlatform,this.config))}createOrderCompleteEvent(){this.dataTrackingEvents.push(new z(this.trackingPlatform,this.config,this.sessionStorage))}createProductClickEvent(){this.actionTrackingEvents.push(new J(this.trackingPlatform,this.config,this.sessionStorage))}createProductShareEvent(){const t=new $(this.trackingPlatform,this.config,this.sessionStorage);this.actionTrackingEvents.push(t),"product"===this.config.context.page.controller_name&&this.dataTrackingEvents.push(t)}createProductViewEvent(){const t=new G(this.trackingPlatform,this.config,this.sessionStorage);this.actionTrackingEvents.push(t),"product"===this.config.context.page.controller_name&&this.dataTrackingEvents.push(t)}createPromotionClickEvent(){this.actionTrackingEvents.push(new et(this.trackingPlatform,this.config,this.sessionStorage))}createSearchEvent(){new RegExp("search").test(this.config.context.page.controller_name)&&this.actionTrackingEvents.push(new st(this.trackingPlatform,this.config))}createViewItemsListEvent(){this.actionTrackingEvents.push(new dt(this.trackingPlatform,this.config,this.sessionStorage))}}class ut extends o{initEvent(){document.addEventListener("click",this.removeFromCart.bind(this),!0),document.addEventListener("click",this.addToCartProductList.bind(this),!0),"product"===this.config.context.page.controller_name&&document.addEventListener("click",this.addToCartProductView.bind(this),!0)}removeFromCart(t){if(0===t.button&&t.target instanceof Element){const e=".ajax_cart_block_remove_link",i=t.target.closest(e);if(i instanceof HTMLAnchorElement){const t="cart_block_product_",e=i.closest(`[data-id^=${t}]`);if(e instanceof HTMLElement){const i=ut.getProductDataCartBlock(e,t),s=ut.getQuantityCartBlock(e);this.triggerEvent(i,s,this.trackingPlatform.removeFromCart.bind(this.trackingPlatform))}}}}static getProductDataCartBlock(t,e){const i=[];if(t.dataset.id&&t.dataset.id.length){const s=t.dataset.id.replace(e,"").split("_");s.length&&i.push({idProduct:parseInt(s[0]),idProductAttribute:parseInt(s[1]||"0")})}return i}static getQuantityCartBlock(t){let e=0;const i=t.querySelector(".quantity");return i instanceof HTMLElement&&(e=parseInt(i.innerText.trim())),e}addToCartProductList(t){if(0===t.button&&t.target instanceof Element){const e=".ajax_add_to_cart_button",i=t.target.closest(e);if(i instanceof HTMLElement){const t=ut.getProductDataProductList(i),e=ut.getQuantityProductList(i);this.triggerEvent(t,e,this.trackingPlatform.addToCart.bind(this.trackingPlatform))}}}static getProductDataProductList(t){const e=[];
14if(t.dataset.idProduct&&t.dataset.idProductAttribute){const i=parseInt(t.dataset.idProduct.trim()),s=parseInt(t.dataset.idProductAttribute.trim()||"0");i&&e.push({idProduct:i,idProductAttribute:s})}return e}static getQuantityProductList(t){let e=0;const i=t.closest(".ajax_block_product");if(i instanceof HTMLElement){const t=i.querySelector("[name=qty]");(t instanceof HTMLInputElement||t instanceof HTMLSelectElement)&&(e=parseInt(t.value))}return!e&&t.dataset.minimal_quantity&&(e=parseInt(t.dataset.minimal_quantity.trim())),e}addToCartProductView(t){if(0===t.button&&t.target instanceof Element){const e="#add_to_cart",i=t.target.closest(e);if(i instanceof HTMLElement){const t=i.closest("form");if(t instanceof HTMLFormElement){const e=ut.getProductDataProductView(t),i=ut.getQuantityProductView(t);this.triggerEvent(e,i,this.trackingPlatform.addToCart.bind(this.trackingPlatform))}}}}static getProductDataProductView(t){const e=[],i=t.querySelector("[name=id_product]"),s=t.querySelector("[name=id_product_attribute]");return i&&s&&e.push({idProduct:parseInt(i.value),idProductAttribute:parseInt(s.value||"0")}),e}static getQuantityProductView(t){let e=0;const i=t.querySelector("[name=qty]");return i instanceof HTMLInputElement&&(e=parseInt(i.value)),e}triggerEvent(t,e,i){return s=this,n=void 0,a=function*(){if(t.length){const s=yield h.getProductsDetailList(t,this.config,this.sessionStorage);s.length&&e&&i(s[0],e)}},new((r=void 0)||(r=Promise))((function(t,e){function i(t){try{c(a.next(t))}catch(t){e(t)}}function o(t){try{c(a.throw(t))}catch(t){e(t)}}function c(e){var s;e.done?t(e.value):(s=e.value,s instanceof r?s:new r((function(t){t(s)}))).then(i,o)}c((a=a.apply(s,n||[])).next())}));var s,n,r,a}}class lt extends m{initEvent(){"category"===this.config.context.page.controller_name&&super.initEvent()}}class gt extends l{initEvent(){document.addEventListener("click",this.handleEvent.bind(this),!0)}handleEvent(t){0===t.button&&t.target instanceof HTMLElement&&(t.target.closest(".cart_quantity_up")?this.increaseQuantity(t.target):t.target.closest(".cart_quantity_down")?this.decreaseQuantity(t.target):t.target.closest(".cart_quantity_delete")&&this.removeFromCart(t.target))}increaseQuantity(t){const e=gt.getProductData(t);this.triggerEvent(e,1,this.trackingPlatform.addToCart.bind(this.trackingPlatform))}decreaseQuantity(t){const e=gt.getProductData(t);this.triggerEvent(e,1,this.trackingPlatform.removeFromCart.bind(this.trackingPlatform))}removeFromCart(t){const e=gt.getProductData(t),i=gt.getProductQuantity(t);this.triggerEvent(e,i,this.trackingPlatform.removeFromCart.bind(this.trackingPlatform))}static getProductData(t){const e=[],i=t.closest("[id^=product_]");if(i instanceof HTMLElement){const t=i.id.replace("product_","").split("_");if(t.length){const i=parseInt(t[0]||"0"),s=parseInt(t[1]||"0");i&&e.push({idProduct:i,idProductAttribute:s})}}return e}static getProductQuantity(t){let e=0;const i=t.closest("[id^=product_]");if(i instanceof HTMLElement){const t=i.id.replace("product","quantity"),s=i.querySelector(`[name^=${t}]`);s instanceof HTMLInputElement&&(e=parseInt(s.value||"0"))}return e}triggerEvent(t,e,i){return s=this,n=void 0,a=function*(){if(t.length){const s=yield h.getProductsDetailList(t,this.config,this.sessionStorage);s.length&&e&&i(s[0],e)}},new((r=void 0)||(r=Promise))((function(t,e){function i(t){try{c(a.next(t))}catch(t){e(t)}}function o(t){try{c(a.throw(t))}catch(t){e(t)}}function c(e){var s;e.done?t(e.value):(s=e.value,s instanceof r?s:new r((function(t){t(s)}))).then(i,o)}c((a=a.apply(s,n||[])).next())}));var s,n,r,a}}class pt extends O{constructor(t,e,i){super(t,e,i),this.trackingPlatform=t,this.config=e,this.sessionStorage=i,this.cartViewEvent=new gt(this.trackingPlatform,this.config,this.sessionStorage)}initEvent(){pt.isCartViewEvent()?this.cartViewEvent.initEvent():this.initCheckoutEvent()}delegateCheckoutEvent(t){if(pt.isValidMouseEvent(t)){const e=t.target;e.matches("#onepagecheckoutps_contenedor *")&&(pt.isValidCarrierSelectionEvent(e)?this.getCarrierSelected():pt.isValidPaymentSelectionEvent(e)?this.getPaymentSelected():pt.isValidPurchaseEvent(e)&&this.triggerPurchaseEvent())}}getCarrierSelected(){let t="";const e=document.querySelector("[name^=delivery_option]:checked");if(e instanceof HTMLInputElement){const i=e.closest(".delivery_option");if(i instanceof HTMLElement){const e=i.querySelector(".delivery_option_title");t=e instanceof HTMLElement&&e.textContent?e.textContent:""}}this.carrierSelected=t.trim().toLowerCase()}getPaymentSelected(){let t="";const e=document.querySelector("[name^=method_payment]:checked");e instanceof HTMLInputElement&&(t=e.value||""),this.paymentSelected=t.trim().toLowerCase()}triggerPurchaseEvent(){pt.isCheckoutWithCarrier(this.checkoutCarrierNodeSelector)&&this.sendTrackingCarrierOption(),this.sendTrackingPaymentOption()}initDataEvent(t){pt.isCartViewEvent()?this.cartViewEvent.initDataEvent(t):super.initDataEvent(t)}}
14class mt extends E{constructor(t,e,i){super(t,e,i),this.trackingPlatform=t,this.config=e,this.sessionStorage=i,this.paymentTarget=null,this.lastSelectedOptions={carrierSelected:"",paymentSelected:""},this.cartViewEvent=new gt(this.trackingPlatform,this.config,this.sessionStorage)}getCarrierSelected(){let t="";const e=document.querySelector(".delivery_options_address input:checked");if(e instanceof HTMLInputElement)if(e.dataset.carrier)t=e.dataset.carrier;else{const i=e.closest(".delivery_option");if(i instanceof HTMLElement){const e=i.querySelector("td > strong");t=e instanceof HTMLElement?e.innerText.trim():""}}this.carrierSelected=t}getPaymentSelected(){if(this.paymentTarget instanceof Element){const t=this.paymentTarget;let e="not detected";const i=t.closest("[data-module-name]")||t.closest("a[class]")||t.closest("a[href]")||t.closest("[title]");if(i instanceof Element){let t;t=i.hasAttribute("data-module-name")&&i.getAttribute("data-module-name")?i.getAttribute("data-module-name"):i.hasAttribute("href")&&mt.isValidURL(i.getAttribute("href")||"")?mt.getModuleFromURL(new URL(i.getAttribute("href"))):i.getAttribute("class")||i.getAttribute("title")||"",t&&(e=t)}this.paymentSelected=e}}static isValidURL(t){let e;try{e="null"!==new URL(t).origin}catch(t){e=!1}return e}static getModuleFromURL(t){const e=t.pathname.split("/"),i=e.indexOf("module")+1;return e[i]||""}static isValidCarrierSelectionEvent(t){return t.matches("#carrier_area .delivery_options *")}static isValidPurchaseEvent(t){return t.matches("#HOOK_PAYMENT *")&&!mt.isInvalidTarget(t)&&mt.isValidAgreement()}static isInvalidTarget(t){return Boolean(["#ps_checkout-displayPayment .payment_module.open:not([data-module-name]) *","#ps_checkout-displayPayment .ps_checkout-payment-option.row"].find((e=>t.matches(e))))}}class ft extends mt{initEvent(){this.setCurrentStep(),this.initStepEvent()}setCurrentStep(){document.querySelectorAll("#order_step li").forEach(((t,e)=>{t.classList.contains("step_current")&&(this.step=e>1?e-1:0)}))}initStepEvent(){0===this.step?this.cartViewEvent.initEvent():this.step>=2&&this.initCheckoutEvent()}setDefaultCheckoutValues(){2===this.step&&this.getCarrierSelected()}delegateCheckoutEvent(t){if(ft.isValidMouseEvent(t)&&t.target instanceof Element){const e=t.target;ft.isValidCarrierSelectionEvent(e)?this.getCarrierSelected():ft.isValidCarrierEvent(e)?this.sendTrackingCarrierOption():ft.isValidPurchaseEvent(e)&&(this.paymentTarget=e,this.triggerPurchaseEvent())}}static isValidCarrierEvent(t){return Boolean(t.closest("button[name^=processCarrier]"))&&ft.isValidAgreement()&&!document.querySelector("#input_virtual_carrier")}triggerPurchaseEvent(){this.getPaymentSelected(),this.lastSelectedOptions.paymentSelected!==this.paymentSelected&&(this.sendTrackingPaymentOption(),this.lastSelectedOptions.paymentSelected=this.paymentSelected)}initDataEvent(t){0===this.step?this.cartViewEvent.initDataEvent(t):super.initDataEvent(t)}}class vt extends mt{initEvent(){this.cartViewEvent.initEvent(),this.initCheckoutEvent()}setDefaultCheckoutValues(){this.getCarrierSelected()}delegateCheckoutEvent(t){if(vt.isValidMouseEvent(t)&&t.target instanceof Element){const e=t.target;vt.isValidCarrierSelectionEvent(e)?this.getCarrierSelected():vt.isValidPurchaseEvent(e)&&(this.paymentTarget=e,this.triggerPurchaseEvent())}}triggerPurchaseEvent(){vt.isValidCheckoutWithCarrier()&&this.lastSelectedOptions.carrierSelected!==this.carrierSelected&&(this.sendTrackingCarrierOption(),this.lastSelectedOptions.carrierSelected=this.carrierSelected),this.getPaymentSelected(),this.lastSelectedOptions.paymentSelected!==this.paymentSelected&&(this.sendTrackingPaymentOption(),this.lastSelectedOptions.paymentSelected=this.paymentSelected)}static isValidCheckoutWithCarrier(){return Boolean(document.querySelector("#carrier_area .delivery_options"))}}class yt extends v{getCheckoutModule(){return class{static getCheckoutController(t,e,i){let s;return s="onepagecheckoutps"===e.context.tracking_module.checkout_module.module?new pt(t,e,i):"order"===e.context.page.controller_name?new ft(t,e,i):new vt(t,e,i),s}}.getCheckoutController(this.trackingPlatform,this.config,this.sessionStorage)}}class Pt extends A{}class Et extends N{}class kt extends B{}class St extends R{}class _t extends U{handleEvent(t){if(0===t.button&&t.target instanceof Element){const e=_t.getProductThemeDataList(t.target);this.triggerEvent(e)}}static getProductThemeDataList(t){const e=".ajax_block_product",i=["a.product_img_link","a.quick-view-mobile","a.quick-view","a.product-name","a.button.lnk_view"].join(","),s=[];if(t.closest(e)&&t.closest(i)){const i=t.closest(e);
14if(i instanceof HTMLElement){const t=".ajax_add_to_cart_button",e=i.querySelector(t);if(i.dataset.idProduct&&i.dataset.idProductAttribute){const t=parseInt(i.dataset.idProduct||"0"),e=parseInt(i.dataset.idProductAttribute||"0");t&&s.push({idProduct:t,idProductAttribute:e})}else if(e instanceof HTMLElement&&e.dataset.idProduct&&e.dataset.idProductAttribute){const t=parseInt(e.dataset.idProduct||"0"),i=parseInt(e.dataset.idProductAttribute||"0");t&&s.push({idProduct:t,idProductAttribute:i})}}}return s}}class wt extends K{handleEvent(t){if(0===t.button&&t.target instanceof Element){const e=".js-social-sharing, .social-sharing",i=t.target.closest(e);if(i instanceof HTMLElement){const t=wt.getProductsDataList(i),e=wt.getSocialNetwork(i);this.triggerEvent(t,e)}}}static getProductsDataList(t){const e=[],i=t.closest("body");if(i instanceof HTMLElement){const t=i.querySelector("[name^=id_product]"),s=i.querySelector("[name^=id_product_attribute]");if(t instanceof HTMLInputElement&&s instanceof HTMLInputElement){const i=parseInt(t.value),n=parseInt(s.value||"0");Number.isInteger(i)&&Number.isInteger(n)&&e.push({idProduct:i,idProductAttribute:n})}}return e}initDataEvent(t){}}class Lt extends W{constructor(){super(...arguments),this.productBuyBlockSelector="#buy_block"}initEvent(){const t=document.querySelector("[name=id_product_attribute]");if(t instanceof HTMLInputElement){const e={attributes:!0,attributeOldValue:!0};new MutationObserver(this.handleMutation.bind(this)).observe(t,e)}}handleMutation(t){t.forEach((t=>{if("attributes"===t.type&&t.target instanceof HTMLInputElement&&t.target.value!==t.oldValue){const e=t.target.closest(this.productBuyBlockSelector);e instanceof HTMLFormElement&&this.handleEventFromBuyBlockNode(e)}}))}handleEventFromBuyBlockNode(t){const e=Lt.getProductsDataList(t);this.triggerEvent(e)}static getProductsDataList(t){const e=[],i=t.querySelector("[name^=id_product]"),s=t.querySelector("[name^=id_product_attribute]");if(i instanceof HTMLInputElement&&s instanceof HTMLInputElement){const t=parseInt(i.value||"0"),n=parseInt(s.value||"0");t>0&&e.push({idProduct:t,idProductAttribute:n})}return e}triggerEvent(t){return e=this,i=void 0,n=function*(){if(t.length){const e=yield h.getProductsDetailList(t,this.config,this.sessionStorage);e.length&&this.trackingPlatform.productView(e[0])}},new((s=void 0)||(s=Promise))((function(t,r){function a(t){try{c(n.next(t))}catch(t){r(t)}}function o(t){try{c(n.throw(t))}catch(t){r(t)}}function c(e){var i;e.done?t(e.value):(i=e.value,i instanceof s?i:new s((function(t){t(i)}))).then(a,o)}c((n=n.apply(e,i||[])).next())}));var e,i,s,n}initDataEvent(t){if(Object.prototype.hasOwnProperty.call(t,"detail_product_view")&&t.detail_product_view.length){this.sessionStorage.addProductsList(t.detail_product_view);const e=document.querySelector(this.productBuyBlockSelector);e instanceof HTMLFormElement&&this.handleEventFromBuyBlockNode(e)}}}class Ct extends tt{}class bt extends it{}class Tt extends rt{constructor(t,e,i){super(".ajax_block_product",t,e,i)}getPageFirstPosition(){let t=1;const e=this.config.context.page.products_per_page,i=new URLSearchParams(window.location.search).get("p");return i&&(t=parseInt(i)),e*t-e+1}}class Vt extends ot{}class Ot extends nt{getAllItemsList(){return[new Tt(this.trackingPlatform,this.config,this.sessionStorage),new Vt(this.trackingPlatform,this.config,this.sessionStorage)]}}class xt extends a{createAddToCartEvent(){this.actionTrackingEvents.push(new ut(this.trackingPlatform,this.config,this.sessionStorage))}createCartViewEvent(){}createCategoryEvent(){this.actionTrackingEvents.push(new lt(this.trackingPlatform,this.config))}createCheckoutEvent(){const t=new yt(this.trackingPlatform,this.config,this.sessionStorage);this.actionTrackingEvents.push(t),this.dataTrackingEvents.push(t)}createCustomerLogin(){this.config.context.user.is_new_login&&this.actionTrackingEvents.push(new Pt(this.trackingPlatform,this.config))}createCustomerSignUp(){this.config.context.user.is_new_account&&this.actionTrackingEvents.push(new Et(this.trackingPlatform,this.config))}createHomeEvent(){this.actionTrackingEvents.push(new kt(this.trackingPlatform,this.config))}createOrderCompleteEvent(){this.dataTrackingEvents.push(new St(this.trackingPlatform,this.config,this.sessionStorage))}createProductClickEvent(){this.actionTrackingEvents.push(new _t(this.trackingPlatform,this.config,this.sessionStorage))}createProductShareEvent(){this.actionTrackingEvents.push(new wt(this.trackingPlatform,this.config,this.sessionStorage))}createProductViewEvent(){const t=new Lt(this.trackingPlatform,this.config,this.sessionStorage);this.actionTrackingEvents.push(t),this.dataTrackingEvents.push(t)}createPromotionClickEvent(){this.actionTrackingEvents.push(new Ct(this.trackingPlatform,this.config,this.sessionStorage))}createSearchEvent(){new RegExp("search").test(this.config.context.page.controller_name)&&this.actionTrackingEvents.push(new bt(this.trackingPlatform,this.config))}createViewItemsListEvent(){this.actionTrackingEvents.push(new Ot(this.trackingPlatform,this.config,this.sessionStorage))}}class Dt{static getProductPosition(t,e){let i=0;const s=Dt.getProductThemeData(t),n=JSON.stringify(s);return Object.prototype.hasOwnProperty.call(e,n)&&(i=e[n]),i}static getProductAttribution(t,e){let i=null;const s=Dt.getProductThemeData(t),n=JSON.stringify(s);return Object.prototype.hasOwnProperty.call(e,n)&&(i=e[n]),i}static getProductThemeData(t){return{idProduct:t.id_product,idProductAttribute:t.id_attribute}}}class Mt{static getCartProducts(t,e){const i=[];return t.forEach((t=>{const s=e.find((e=>e.id_index===t.id_index));s&&i.push(Mt.getProductData(t,s.quantity))})),i}
14static getProductData(t,e,i,s){const n={attributes:t.attributes,category_path:t.category_path,condition:t.condition,ean:t.ean,id_attribute:t.id_attribute,id_category:t.id_category,id_index:t.id_index,id_manufacturer:t.id_manufacturer,id_product:t.id_product,is_available:t.is_available,isbn:t.isbn,manufacturer_name:t.manufacturer_name,name:t.name,mpn:t.mpn,price_sale:t.price_sale,price_main:t.price_main,price_main_tax_excl:t.price_main_tax_excl,price_sale_tax_excl:t.price_sale_tax_excl,price_discount:Mt.getItemDiscount(t,!0),price_discount_tax_excl:Mt.getItemDiscount(t),reference:t.reference,upc:t.upc};return e&&(n.quantity=e),i&&(n.list_name=i),s&&(n.list_index=s),n}static getItemDiscount(t,e=!1){let i=0;const s=e?t.price_main:t.price_main_tax_excl,n=e?t.price_sale:t.price_sale_tax_excl;return s>n&&(i=(Math.trunc(100*s)-Math.trunc(100*n))/100),i}}class It{constructor(t){this.config=t,this.layer={}}decorate(){return{common_model:this.layer}}initConfig(){return this.layer={},this.decorate()}homePageView(){return this.layer={},this.decorate()}categoryPageView(){return this.layer={},this.decorate()}productsList(t,e){const i=[],s=this.config.context.page.controller_name;return t.forEach((t=>{const n=Dt.getProductPosition(t,e);i.push(Mt.getProductData(t,0,s,n))})),this.layer={items:i},this.decorate()}productClick(t,e){let i=0,s=this.config.context.page.controller_name;const n=Dt.getProductAttribution(t,e),r=[];return n&&(i=n.productPosition,s=n.productList),r.push(Mt.getProductData(t,0,s,i)),this.layer={items:r},this.decorate()}productView(t){const e=[];return e.push(Mt.getProductData(t)),this.layer={items:e},this.decorate()}productShare(t,e){const i=[];return i.push(Mt.getProductData(t)),this.layer={items:i,parameters:{method:e}},this.decorate()}addToCart(t,e){const i=[];return i.push(Mt.getProductData(t,e)),this.layer={items:i},this.decorate()}removeFromCart(t,e){const i=[];return i.push(Mt.getProductData(t,e)),this.layer={items:i},this.decorate()}cartView(t,e){const i=Mt.getCartProducts(t,e);return this.layer={items:i},this.decorate()}checkoutProgress(t,e,i){const s=Mt.getCartProducts(t,e);return this.layer={items:s,checkout:{step:i}},this.decorate()}checkoutOption(t,e,i,s,n){return this.layer={checkout:{step:i,option_type:t,option_value:e}},s&&n&&(this.layer.items=Mt.getCartProducts(s,n)),this.decorate()}orderComplete(t,e,i){const s=Mt.getCartProducts(e,i),n=Object.assign({},t);return this.layer={items:s,order:n},this.decorate()}promotionsList(t){const e=[];return t.forEach((t=>{const i=Object.assign(Object.assign({},t.promotion_params),t.promotion_item);e.push(i)})),this.layer={items:e},this.decorate()}promotionClick(t){return this.layer={items:[Object.assign(Object.assign({},t.promotion_params),t.promotion_item)]},this.decorate()}searchPageView(){return this.layer={},this.decorate()}customerLogin(){return this.layer={},this.decorate()}customerSignUp(){return this.layer={},this.decorate()}resetLayer(){return this.layer={items:void 0,parameters:void 0},this.decorate()}}class qt{constructor(t,e){this.eventLayer=t,this.config=e,this.layer={},this.eventTimeout=300}resetLayer(){return this.layer.event="reset_common_model",Object.assign(Object.assign({},this.layer),this.eventLayer.resetLayer())}initConfig(){return this.layer={config:this.getConfigData(),context:this.getContextData()},Object.assign(Object.assign({},this.layer),this.eventLayer.initConfig())}getConfigData(){return{bing:this.config.bing,criteo:this.config.criteo,facebook:this.config.facebook,ga4:this.config.ga4,gads:this.config.gads,gua:this.config.gua,gfeeds:this.config.gfeeds,pinterest:this.config.pinterest,twitter:this.config.twitter,tiktok:this.config.tiktok}}getContextData(){return{browser:Object.assign(Object.assign({},this.config.context.browser),{user_agent:navigator.userAgent,navigator_lang:navigator.language}),page:{controller_name:this.config.context.page.controller_name,category:this.config.context.page.category,search_term:this.config.context.page.search_term},localization:this.config.context.localization,shop:this.config.context.shop,user:this.config.context.user}}homePageView(){return this.setEventModel("view_home"),Object.assign(Object.assign({},this.layer),this.eventLayer.homePageView())}categoryPageView(){return this.setEventModel("view_category"),Object.assign(Object.assign({},this.layer),this.eventLayer.categoryPageView())}searchPageView(){return this.setEventModel("view_search"),Object.assign(Object.assign({},this.layer),this.eventLayer.searchPageView())}productsList(t,e){return this.setEventModel("view_product_list"),Object.assign(Object.assign({},this.layer),this.eventLayer.productsList(t,e))}productClick(t,e){return this.setEventModel("product_click"),Object.assign(Object.assign({},this.layer),this.eventLayer.productClick(t,e))}productView(t){return this.setEventModel("view_product"),Object.assign(Object.assign({},this.layer),this.eventLayer.productView(t))}productShare(t,e){return this.setEventModel("share_product"),Object.assign(Object.assign({},this.layer),this.eventLayer.productShare(t,e))}addToCart(t,e){return this.setEventModel("add_to_cart"),Object.assign(Object.assign({},this.layer),this.eventLayer.addToCart(t,e))}removeFromCart(t,e){return this.setEventModel("remove_from_cart"),Object.assign(Object.assign({},this.layer),this.eventLayer.removeFromCart(t,e))}cartView(t,e){return this.setEventModel("view_cart"),Object.assign(Object.assign({},this.layer),this.eventLayer.cartView(t,e))}checkoutProgress(t,e,i){return this.setEventModel("checkout_progress"),Object.assign(Object.assign({},this.layer),this.eventLayer.checkoutProgress(t,e,i))}
14checkoutOption(t,e,i,s,n){return this.setEventModel("checkout_option"),Object.assign(Object.assign({},this.layer),this.eventLayer.checkoutOption(t,e,i,s,n))}orderComplete(t,e,i,s,n){return this.setEventModel("purchase"),this.layer.context=this.getContextData(),this.layer.context.user=s,Object.assign(Object.assign(Object.assign({},this.layer),this.eventLayer.orderComplete(t,e,i,s)),{eventCallback:function(...e){window.RCPGTMClient.config&&e[0]===window.RCPGTMClient.config.gtm.tracking_id&&n(t)},eventTimeout:this.eventTimeout})}promotionsList(t){return this.setEventModel("view_promotion_list"),Object.assign(Object.assign({},this.layer),this.eventLayer.promotionsList(t))}promotionClick(t){return this.setEventModel("promotion_click"),Object.assign(Object.assign({},this.layer),this.eventLayer.promotionClick(t))}customerSignUp(){return this.setEventModel("customer_sign_up"),Object.assign(Object.assign({},this.layer),this.eventLayer.customerSignUp())}customerLogin(){return this.setEventModel("customer_login"),Object.assign(Object.assign({},this.layer),this.eventLayer.customerLogin())}setEventModel(t){this.layer={event:t}}}class jt{constructor(t){this.config=t;const e=new It(this.config);this.dataLayerComponent=new qt(e,this.config)}}class At{constructor(t){this.config=t,this.dataLayer={},this.dataLayerComponent=new jt(this.config).dataLayerComponent}isAvailable(){return Boolean(this.getTrackingId()&&Object.prototype.hasOwnProperty.call(window,"google_tag_manager"))}getScriptURL(){return this.config.gtm.server_url||"https://www.googletagmanager.com/gtm.js"}getTrackingId(){return this.config.gtm.tracking_id}initConfig(){this.dataLayer=this.dataLayerComponent.initConfig(),this.pushDataLayer()}pushDataLayer(){window.dataLayer=window.dataLayer||[],window.dataLayer.push(this.dataLayer),this.resetDataLayer()}resetDataLayer(){this.dataLayer={}}initScripts(){this.addGTMScript()}addGTMScript(){const t=document.createElement("script");t.innerText=`\n            (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n                new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n                j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;
14j.src=\n                '${this.getScriptURL()}?id='+i+dl;f.parentNode.insertBefore(j,f);\n            })(window, document, 'script', 'dataLayer', '${this.getTrackingId()}');\n        `,document.head.appendChild(t)}homePageView(){this.dataLayer=this.dataLayerComponent.homePageView(),this.pushDataLayer()}categoryPageView(){this.dataLayer=this.dataLayerComponent.categoryPageView(),this.pushDataLayer()}searchPageView(){this.dataLayer=this.dataLayerComponent.searchPageView(),this.pushDataLayer()}productShare(t,e){this.resetLayer(),this.dataLayer=this.dataLayerComponent.productShare(t,e),this.pushDataLayer()}customerSignUp(){this.dataLayer=this.dataLayerComponent.customerSignUp(),this.pushDataLayer()}customerLogin(){this.dataLayer=this.dataLayerComponent.customerLogin(),this.pushDataLayer()}productsList(t,e){this.resetLayer(),this.dataLayer=this.dataLayerComponent.productsList(t,e),this.pushDataLayer()}productClick(t,e){this.resetLayer(),this.dataLayer=this.dataLayerComponent.productClick(t,e),this.pushDataLayer()}productView(t){this.resetLayer(),this.dataLayer=this.dataLayerComponent.productView(t),this.pushDataLayer()}addToCart(t,e){this.resetLayer(),this.dataLayer=this.dataLayerComponent.addToCart(t,e),this.pushDataLayer()}removeFromCart(t,e){this.resetLayer(),this.dataLayer=this.dataLayerComponent.removeFromCart(t,e),this.pushDataLayer()}cartView(t,e){this.resetLayer(),this.dataLayer=this.dataLayerComponent.cartView(t,e),this.pushDataLayer()}checkoutProgress(t,e,i){this.resetLayer(),this.dataLayer=this.dataLayerComponent.checkoutProgress(t,e,i),this.pushDataLayer()}checkoutOption(t,e,i,s,n){this.resetLayer(),this.dataLayer=this.dataLayerComponent.checkoutOption(t,e,i,s,n),this.pushDataLayer()}orderComplete(t,e,i,s,n){this.resetLayer(),this.dataLayer=this.dataLayerComponent.orderComplete(t,e,i,s,n),this.pushDataLayer()}promotionsList(t){this.resetLayer(),this.dataLayer=this.dataLayerComponent.promotionsList(t),this.pushDataLayer()}promotionClick(t){this.resetLayer(),this.dataLayer=this.dataLayerComponent.promotionClick(t),this.pushDataLayer()}resetLayer(){this.dataLayer=this.dataLayerComponent.resetLayer(),this.pushDataLayer()}}Object.hasOwnProperty.call(window,"RCPGTMClient")||(window.RCPGTMClient=new class extends n{constructor(){super(),this.config&&this.sessionStorage&&(this.gtm=new At(this.config),this.optimize=new r(this.config),this.eventManager=class{static getEventFactory(t,e,i){switch(e.context.tracking_module.service_version){case"16":return new xt(t,e,i);case"17":return new ht(t,e,i);default:throw Error("Unable to load event manager")}}}.getEventFactory(this.gtm,this.config,this.sessionStorage),this.init())}getConfigNode(){return"#js-rcpgtm-tracking-config"}getTrackingDataNode(){return"#js-rcpgtm-tracking-data"}init(){this.initTracking(),this.initEvents()}initTracking(){var t,e,i;null===(t=this.gtm)||void 0===t||t.initConfig(),null===(e=this.optimize)||void 0===e||e.initScripts(),null===(i=this.gtm)||void 0===i||i.initScripts()}initEvents(){this.eventManager&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",this.eventManager.initPageEvents.bind(this.eventManager),!1):this.eventManager.initPageEvents(),"complete"!==document.readyState?window.addEventListener("load",this.initTrackingDataEvents.bind(this),!1):this.initTrackingDataEvents())}initTrackingDataEvents(){this.trackingData=n.getTemplateData(this.getTrackingDataNode()),Object.keys(this.trackingData).length&&this.sessionStorage&&this.eventManager&&(this.sessionStorage.initTrackingData(this.trackingData),this.eventManager.initDataEvents(this.trackingData))}})})();

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.