{"version":3,"file":"index.es.min.js","sources":["../../../packages/helpers/src/props.helpers.js","../../../packages/helpers/src/refs.helpers.js","../../../packages/helpers/src/events.helpers.ts","../../../packages/components/src/constants.mjs","../../../packages/helpers/src/viewport.helpers.ts","../../../packages/helpers/src/catalog.js","../../../packages/helpers/src/getCurrency.js","../../../packages/helpers/src/utils.ts","../../../packages/helpers/src/gtmEvents.js","../../../packages/helpers/src/assets/js/eventDispatch.js","../../../packages/helpers/src/visual.helpers.ts","../../../packages/page-builder-sections/src/recipes/subcomponents/modal-recipe/subcomponents/subcomponent.class.js","../../../packages/page-builder-sections/src/recipes/subcomponents/modal-recipe/subcomponents/index.js","../../../packages/page-builder-sections/src/recipes/subcomponents/modal-recipe/subcomponents/notification/notification.js","../../../packages/page-builder-sections/src/recipes/classes/BaseModalRecipe.js","../../../packages/page-builder-sections/src/recipes/subcomponents/modal-recipe/modal-recipe.js","../../../packages/page-builder-sections/src/recipes-variant/subcomponents/modal-recipe-variant/modal-recipe.js","../../../packages/page-builder-sections/src/recipes/recipes.js"],"sourcesContent":["const getData = attributes => attributes.find(attribute => attribute.nodeName === 'data')\n\nconst createProps = attributes => {\n    const data = getData([...attributes])\n    const props = [...attributes]\n        .filter(attribute => attribute.nodeName !== 'data')\n        .reduce((all, attr) => {\n            return { ...all, [attr.nodeName]: attr.nodeValue }\n        }, {})\n\n    if (isNil(data)) {\n        return props\n    }\n\n    try {\n        return { ...props, ...JSON.parse(data.nodeValue) }\n    } catch (error) {\n        console.log('ERROR: No data', error, data?.nodeValue)\n    }\n}\n\nconst isNil = obj => obj === undefined || obj === null\n\nexport const parseBool = value => (!value || value === 'false' ? false : true)\n\nexport default createProps\n","const createRefs = component => [...component.querySelectorAll('[data-ref]')].reduce(extract, {})\n\nconst extract = (refs, $ref) => {\n    const { ref } = $ref.dataset\n\n    // Check if ref is of type array\n    const refArray = ref.match(/(\\w+)\\[(.+)\\]/)\n\n    if (refArray !== null) {\n        return getRefArray(refs, $ref, refArray)\n    } else {\n        return { ...refs, [$ref.dataset.ref]: $ref }\n    }\n}\n\nconst getRefArray = (refs, $ref, [, name, index]) => {\n    if (refs[name] === undefined) {\n        refs[name] = []\n    }\n    refs[name][index] = $ref\n    return refs\n}\n\nexport default createRefs\n","export type EventListener = {\n    element: HTMLElement\n    type: string\n    listener: (e: Event) => void\n    options?: boolean | AddEventListenerOptions\n}\n\nconst add = (eventListeners: EventListener[] = []) => {\n    eventListeners.forEach(eventListener => {\n        if (!eventListener || !eventListener.element) {\n            return\n        }\n        return eventListener.element.addEventListener(\n            eventListener.type,\n            eventListener.listener,\n            eventListener.options\n        )\n    })\n}\n\nconst remove = (eventListeners: EventListener[] = []) => {\n    eventListeners.forEach(eventListener => {\n        if (!eventListener || !eventListener.element) {\n            return\n        }\n        eventListener.element.removeEventListener(eventListener.type, eventListener.listener)\n    })\n}\n\nconst busNamespace = 'pageBuilder'\n\nexport const emitCustomEvent = (eventName: string, data: unknown) => {\n    const customEvent = new CustomEvent(`${busNamespace}.${eventName}`, {\n        detail: data,\n        bubbles: true,\n        cancelable: true,\n        composed: false\n    })\n\n    window.dispatchEvent(customEvent)\n}\n\nexport default { add, emitCustomEvent, remove }\n","export const MAX_WIDTH_CONTAINER = 1160\n\nexport const BREAKPOINT_XL = 1920\nexport const BREAKPOINT_TABLET = 1024\nexport const BREAKPOINT_L = 996\nexport const BREAKPOINT_M = 768\nexport const BREAKPOINT_S = 750\nexport const BREAKPOINT_XS = 375\n\nexport const CTA_PRIMARY = 'primary'\nexport const CTA_PRIMARY_TRANSPARENT = 'primary_transparent'\nexport const CTA_SUBTLE = 'subtle'\nexport const CTA_LINK = 'link'\nexport const CTA_LINK_UNDERLINE = 'link-underline'\nexport const CTA_LINK_GOLD = 'link-gold'\nexport const CTA_LINK_ADD_TO_CART_SMALL = 'AddToCart_small'\nexport const CTA_LINK_ADD_TO_CART_LARGE = 'AddToCart_large'\n\nexport const EVENT_TAB_CHANGE = 'EVENT_TAB_CHANGE'\n\nexport const EVENT_VIDEO = 'WEB_COMPONENT_VIDEO'\nexport const EVENT_POPIN_OPEN = 'WEB_COMPONENT_POPIN_OPEN'\nexport const EVENT_POPIN_OPENED = 'WEB_COMPONENT_POPIN_OPENED'\nexport const EVENT_POPIN_CLOSE = 'WEB_COMPONENT_POPIN_CLOSE'\nexport const EVENT_POPIN_CLOSED = 'WEB_COMPONENT_POPIN_CLOSED'\nexport const EVENT_POPIN_CLOSE_CLICK = 'WEB_COMPONENT_POPIN_CLOSE_CLICK'\nexport const EVENT_POPIN_KEY_DOWN = 'keydown'\nexport const EVENT_POPIN_FORM_TOGGLE_TITLE = 'WEB_COMPONENT_POPIN_FORM_TOGGLE_TITLE'\nexport const EVENT_CTA_CLICK = 'WEB_COMPONENT_CTA_CLICK'\nexport const EVENT_HERO_REORDER_OPEN = 'WEB_COMPONENT_HERO_REORDER_OPEN'\nexport const EVENT_HERO_REORDER_CLOSE = 'WEB_COMPONENT_HERO_REORDER_CLOSE'\nexport const EVENT_QUICKVIEW_OPEN = 'WEB_COMPONENT_QUICKVIEW_OPEN'\nexport const EVENT_QS_OPEN = 'WEB_COMPONENT_QS_OPEN'\nexport const EVENT_QS_OPENED = 'WEB_COMPONENT_QS_OPENED'\nexport const EVENT_QS_CLOSE = 'WEB_COMPONENT_QS_CLOSE'\nexport const EVENT_QS_CLOSED = 'WEB_COMPONENT_QS_CLOSED'\nexport const EVENT_QS_CLOSE_CLICK = 'WEB_COMPONENT_QS_CLOSE_CLICK'\nexport const EVENT_QS_KEY_DOWN = 'keydown'\nexport const EVENT_ADD_TO_CART = 'WEB_COMPONENT_ADD_TO_CART'\nexport const EVENT_CART_UPDATED = 'WEB_COMPONENT_CART_UPDATED'\nexport const EVENT_VIDEO_TOGGLE = 'WEB_COMPONENT_VIDEO_TOGGLE'\nexport const VIDEO_ON_HOVER = 'VIDEO_ON_HOVER'\nexport const VIDEO_ON_OUT = 'VIDEO_ON_OUT'\nexport const EVENT_DETAIL_OPEN = 'WEB_COMPONENT_DETAIL_OPEN'\nexport const EVENT_SLIDER_READY = 'WEB_COMPONENT_SLIDER_READY'\nexport const EVENT_SLIDE_CHANGE = 'WEB_COMPONENT_SLIDE_CHANGE'\nexport const EVENT_OVERLAY_OPEN = 'WEB_COMPONENT_OVERLAY_OPEN'\nexport const EVENT_OVERLAY_CLOSE = 'WEB_COMPONENT_OVERLAY_CLOSE'\nexport const EVENT_OVERLAY_CLICKED = 'WEB_COMPONENT_OVERLAY_CLICKED'\nexport const EVENT_OPEN_PRODUCT_AR_CLICKED = 'OPEN_PRODUCT_AR_CLICKED'\nexport const EVENT_SORT_BY_CHANGE = 'WEB_COMPONENT_SORT_BY_CHANGE'\n\nexport const EVENT_BUBBLE_SELECTED = 'EVENT_BUBBLE_SELECTED'\nexport const EVENT_RECO_TOOL_OPTION_CLICKED = 'EVENT_RECO_TOOL_OPTION_CLICKED'\nexport const WEB_COMPONENT_PROJECTS_LOADED = 'WEB_COMPONENT_PROJECTS_LOADED'\nexport const WEB_COMPONENT_ANCHOR_LOADED = 'WEB_COMPONENT_ANCHOR_LOADED'\n\nexport const EVENT_SWIPED_UP = 'swiped-up'\nexport const EVENT_SWIPED_DOWN = 'swiped-down'\nexport const EVENT_SWIPED_LEFT = 'swiped-left'\nexport const EVENT_SWIPED_RIGHT = 'swiped-right'\n\nexport const EVENT_HEADER_POSITION_CHANGED = 'EVENT_HEADER_POSITION_CHANGED'\n\nexport const keys = { ESC: 'Escape' }\n\nexport const ADD_TO_CART_MODIFIER_MINI = 'mini'\nexport const ADD_TO_CART_MODIFIER_DEFAULT = ADD_TO_CART_MODIFIER_MINI\n\nexport const COFFEE_ORIGINAL = 'original'\nexport const COFFEE_VERTUO = 'vertuo'\nexport const COFFEE_PRO = 'pro'\nexport const COFFEE_OL = 'OL'\nexport const COFFEE_VL = 'VL'\nexport const INTENSITY_MAX_OL = 14\nexport const INTENSITY_MAX_VL = 12\nexport const DEFAULT_BUBBLE_ICON = ''\n\nexport const NUMBER_PRODUCTS_SLIDER = 8\nexport const NUMBER_FEATURES_PDP = 8\n\nexport const ALIGNMENT = ['center', 'left', 'right']\nexport const POSITION = ['top', 'right', 'bottom', 'left']\nexport const TRANSLATION_ADD_TO_CART = 'Add to cart'\nexport const TRANSLATION_UPDATE_BASKET = 'Update basket'\n\nexport const TIME_INSTANT = 1\nexport const TIME_FAST = 300\nexport const TIME_MEDIUM = 600\nexport const TIME_SLOW = 1200\n\nexport const APP_APPLE_LINK = {\n    default: 'https://apps.apple.com/us/app/nespresso/id342879434',\n    us: 'https://apps.apple.com/us/app/nespresso-new/id1609639566',\n    uk: 'https://apps.apple.com/gb/app/nespresso-new/id1609639566',\n    kr: 'https://apps.apple.com/kr/app/%EB%84%A4%EC%8A%A4%ED%94%84%EB%A0%88%EC%86%8C-%EB%B6%80%ED%8B%B0%ED%81%AC/id1609639566'\n}\nexport const APP_ANDROID_LINK =\n    'https://play.google.com/store/apps/details?id=com.nespresso.activities'\nexport const APP_HUAWEI_LINK = 'https://appgallery.huawei.com/app/C102571517'\n\nexport const SRC_PAGE_PLP = 'plp'\nexport const SRC_PAGE_PDP = 'pdp'\n\nexport const PLP_TYPE_COFFEE = 'coffee'\nexport const PLP_TYPE_MACHINE = 'machine'\nexport const PLP_TYPE_ACCESSORY = 'accessory'\nexport const CALLEO_API_DOMAIN = 'https://www.contact.nespresso.com/'\n\n// SCSS RELATED\n// Todo : should be shared by JS and SCSS\nexport const BROWSER_CONTEXT = 16 // 1rem = 16px\nexport const COLOR_WHITE_1000 = '#FFFFFF' // Do not change for #FFF shortcut, it will break slider-natural gradients !\n\nexport const CONTRAST_DARK = 'dark'\nexport const CONTRAST_LIGHT = 'light'\n\nexport const B2B_CONTACT_FORM_POPIN_ID = 'b2b-contact-form-popin-id'\nexport const B2B_CONTACT_FORM_POPIN_SRC_SEARCH = 'coveo-search'\n\nexport const B2B_CONTACT_FORM_POPIN_SRC_SKU_MAIN_INFO = 'sku-main-info'\n\nexport const B2B_CONTACT_FORM_POPIN_SRC_SKU_MAIN_INFO_AUTO = 'sku-main-info-auto'\n\nexport const ASPECT_RATIO_16_9 = '16/9'\nexport const ASPECT_RATIO_1_1 = '1/1'\n\nexport const NESPRESSO_PRODUCTION_DOMAIN = 'https://www.nespresso.com'\nexport const NESPRESSO_ROLLOUT_DOMAIN = 'https://nc2-env-rollout.nespresso.com'\n\nexport const EVENT_QUIZ_ON_GO_BACK = 'WEB_COMPONENT_EVENT_QUIZ_ON_GO_BACK'\nexport const EVENT_QUIZ_SUBMIT = 'WEB_COMPONENT_EVENT_QUIZ_SUBMIT'\n","import { BREAKPOINT_M, BREAKPOINT_TABLET } from '@kissui/components'\n\nconst viewport = () => {\n    const lt = (ref: number) => {\n        return window.innerWidth < ref\n    }\n\n    return {\n        get is() {\n            const { innerWidth: vw, devicePixelRatio } = window\n            return {\n                mobile: vw < BREAKPOINT_M,\n                mobile_tablet: vw < BREAKPOINT_TABLET,\n                tablet: vw >= BREAKPOINT_M && vw < BREAKPOINT_TABLET,\n                desktop: vw >= BREAKPOINT_TABLET && devicePixelRatio <= 1,\n                retina: vw >= BREAKPOINT_TABLET && devicePixelRatio > 1\n            }\n        },\n        lt\n    }\n}\n\nconst helper = viewport()\n\nexport default helper\n","import { COFFEE_VERTUO } from '@kissui/components/src/constants.mjs'\nimport { getCurrency } from './getCurrency'\nexport { getCurrency } from './getCurrency'\n\nexport const ECAPI_TYPE_CAPSULE = 'capsule'\nexport const ECAPI_TYPE_MACHINE = 'machine'\nexport const ECAPI_TYPE_ACCESSORY = 'accessory'\nexport const ECAPI_TYPE_GIFT_CARD = 'giftcard'\n\nconst TECHNOLOGY_CATEGORY_IDENTIFIER = '/machineTechno/'\nconst SLEEVE_OF_10 = 10\nconst SLEEVE_OF_7 = 7\n\nconst trimSku = sku => sku.replace(/[^a-z0-9- +./]/gi, '')\n\nexport const getLegacySKU = productId => productId.split('prod/').pop()\n\nexport const getPriceFormatter = async () => await window.napi.priceFormat()\n\nexport const getProduct = sku => window.napi.catalog().getProduct(trimSku(sku))\n\nexport function getTechnologyName(productData) {\n    const techno = productData.technologies[0]\n    return techno.substring(\n        techno.indexOf(TECHNOLOGY_CATEGORY_IDENTIFIER) + TECHNOLOGY_CATEGORY_IDENTIFIER.length\n    )\n}\n\nfunction isMultipleOf(quantity, multiple) {\n    return quantity % multiple === 0\n}\n\nexport function getSleeveNumber(product, getTechnologyNameFn = getTechnologyName) {\n    if (product.sales_multiple !== 1 && isMultipleOf(product.sales_multiple, SLEEVE_OF_10)) {\n        // Sleeve of original or vertuo\n        return product.sales_multiple / SLEEVE_OF_10\n    }\n\n    if (\n        product.sales_multiple !== 1 &&\n        getTechnologyNameFn(product) === COFFEE_VERTUO &&\n        isMultipleOf(product.sales_multiple, SLEEVE_OF_7)\n    ) {\n        // Sleeve of vertuo\n        return product.sales_multiple / SLEEVE_OF_7\n    }\n\n    if (product.sales_multiple === 1 && isMultipleOf(product.unitQuantity, SLEEVE_OF_10)) {\n        // Bundle of original or vertuo\n        return product.unitQuantity / SLEEVE_OF_10\n    }\n\n    if (\n        product.sales_multiple === 1 &&\n        getTechnologyNameFn(product) === COFFEE_VERTUO &&\n        isMultipleOf(product.unitQuantity, SLEEVE_OF_7)\n    ) {\n        // Bundle of vertuo\n        return product.unitQuantity / SLEEVE_OF_7\n    }\n\n    return NaN\n}\n\n/**\n * Guess if the product is part of a bundle.\n * This is determined by checking the 'sales_multiple' and 'unitQuantity' properties.\n */\nexport function isBundled(productData) {\n    // TODO: this function should not change the productData, but some components still need it\n    productData.sales_multiple = productData.sales_multiple || productData.salesMultiple\n\n    const isSalesMultipleGreaterThanOne = productData.sales_multiple > 1\n    const isUnitQuantityEqualToOne = productData.unitQuantity === 1\n    const isSalesMultipleEqualToOne = productData.sales_multiple === 1\n    const isUnitQuantityGreaterThanOne = productData.unitQuantity > 1\n\n    // The product is not bundled if sales_multiple > 1 and unitQuantity = 1\n    if (isSalesMultipleGreaterThanOne && isUnitQuantityEqualToOne) {\n        return false\n    }\n\n    // The product is bundled if sales_multiple = 1 and unitQuantity > 1\n    return isSalesMultipleEqualToOne && isUnitQuantityGreaterThanOne\n}\n\n/**\n * Replace an array of SKU with product data\n * Remove the element inside the list if sku fail. It prevents to get an empty item.\n * @param {Array.<String>} skus\n * @param getProductFn\n * @returns {Promise<Awaited<unknown>[]>}\n */\nexport function getProductAndClean(skus, getProductFn = getProduct, napi = window.napi) {\n    const promises = []\n\n    if (!napi) {\n        return Promise.reject()\n    }\n\n    if (!Array.isArray(skus)) {\n        skus = [skus]\n    }\n\n    // Load manually the product to delete SKU fail\n    for (const sku of skus) {\n        promises.push(\n            getProductFn(sku)\n                .then(data => skus.splice(skus.indexOf(sku), 1, data))\n                .catch(() => {\n                    skus.splice(skus.indexOf(sku), 1)\n                    console.error(`getProduct fail on sku ${sku}`)\n                })\n        )\n    }\n\n    return Promise.all(promises)\n}\n\nexport const getFormattedPrice = async price => {\n    const priceFormatter = await getPriceFormatter()\n    const currency = getCurrency()\n\n    return priceFormatter.html\n        ? priceFormatter.html(currency, price)\n        : priceFormatter.short(currency, price) || ''\n}\n\nexport const getProductCategories = async sku => {\n    const productDetails = await getProduct(sku)\n    const productCategories = productDetails ? productDetails.supercategories : []\n    const productCategoriesNew = await Promise.all(\n        productCategories.map(async categoryEncoded => {\n            const productCategoryData = await window.napi.catalog().getCategory(categoryEncoded)\n            return productCategoryData\n        })\n    )\n    return productCategoriesNew\n}\n","export const getCurrency = () => window[window.config.padl.namespace].dataLayer.app.app.currency\n","export { waitForSelector } from './waitForSelector'\n\nexport const constants = {\n    LEFT: 37,\n    UP: 38,\n    RIGHT: 39,\n    DOWN: 40,\n    ESC: 27,\n    SPACE: 32,\n    ENTER: 13,\n    TAB: 9\n}\n\nexport function capitalize(s = '') {\n    return s[0].toUpperCase() + s.slice(1)\n}\n\nexport const convertToCamelCase = (str: string): string => {\n    const arr = str.match(/[a-z]+|\\d+/gi)\n    if (!arr) { return str }\n    return arr.map((m, i) => {\n        let low = m.toLowerCase()\n        if (i !== 0) {\n            low = low.split('').map((s, k) => (k === 0 ? s.toUpperCase() : s)).join(\"\")\n        }\n        return low\n    }).join(\"\")\n}\n\nexport function slug(s = '') {\n    return s\n        .toLowerCase()\n        .trim()\n        .replace(/\\s+/g, '-') // Replace spaces with -\n        .replace(/[^\\w-]+/g, '') // Remove all non-word chars\n        .replace(/--+/g, '-') // Replace multiple - with single -\n}\n\nexport function pxToEm(target: number, stripedInnerFontSize = 1) {\n    return target / 14 / stripedInnerFontSize + 'em'\n}\n\nexport function percent(target: number) {\n    return target + '%'\n}\n\nexport function parseHTML(str: string) {\n    const tmp = document.implementation.createHTMLDocument('')\n    tmp.body.innerHTML = str\n    return tmp.body.childNodes\n}\n\nexport function stripHTML(str: string) {\n    const tmp = document.implementation.createHTMLDocument('')\n    tmp.body.innerHTML = str\n    return (tmp.body.textContent ?? \"\").replace(RegExp('[\\\\s|\\'|\"]', 'g'), '')\n}\n\nexport function makeId(length: number) {\n    var result = ''\n    var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'\n    var charactersLength = characters.length\n    for (var i = 0; i < length; i++) {\n        result += characters.charAt(Math.floor(Math.random() * charactersLength))\n    }\n    return result\n}\n\nexport function removeEmptyValues(obj: { [key: string]: any }): { [key: string]: any } {\n    const findText = [\n        'Default campaign ID (tracking missing in Page Builder export)',\n        'Default campaign name (tracking missing in Page Builder export)',\n        'promoname', \n        'promoid', \n        'promocreative', \n        'undefined'\n    ];\n    \n    for (let key in obj) {\n        const value = obj[key];\n        \n        if (value === null || value === undefined || value === '') {\n            delete obj[key];\n            continue;\n        }\n        \n        if (typeof value === 'string') {\n            for (const text of findText) {\n                if (value.includes(text)) {\n                    delete obj[key];\n                    break;\n                }\n            }\n        }\n    }\n    \n    return obj;\n}\n\nexport function makeHash(str: string) {\n    var hash = 0,\n        i,\n        chr\n    if (!str) {\n        return hash\n    }\n    for (i = 0; i < str.length; i++) {\n        chr = str.charCodeAt(i)\n        hash = (hash << 5) - hash + chr\n        hash |= 0 // Convert to 32bit integer\n    }\n    return 'id-' + hash\n}\n\nexport function getHashLink(link: string) {\n    let linkHash = link\n    let linkNoHash = link\n    if (link.indexOf('#') !== -1) {\n        linkNoHash = link.replace('#', '')\n    } else {\n        linkHash = '#' + link\n    }\n\n    return { linkNoHash, linkHash }\n}\n\nexport function lazyLoad(node: Element, attribute: string, value: any, url: string) {\n    const CLASSNAME_OUT_OF_SCREEN = 'lazy-load'\n    const CLASSNAME_IN_SCREEN = 'lazy-loaded'\n    const CLASSNAME_ON_ERROR = 'lazy-loaded-error'\n\n    const isOldIOS = () => {\n        var agent = window.navigator.userAgent,\n            start = agent.indexOf('OS ')\n        if ((agent.indexOf('iPhone') > -1 || agent.indexOf('iPad') > -1) && start > -1) {\n            return window.Number(agent.substr(start + 3, 3).replace('_', '.')) < 14\n        }\n        return false\n    }\n\n    const inViewPort = (attribute: string, value: any) => {\n        node.setAttribute(attribute, value)\n\n        const cb = () => node.classList.add(CLASSNAME_IN_SCREEN)\n\n        if (url) {\n            const img = new Image()\n            img.src = url\n            img.onload = cb\n            img.onerror = () => {\n                cb()\n                node.classList.add(CLASSNAME_ON_ERROR)\n                throw new Error(`Image ${url} cannot be loaded`)\n            }\n\n            return\n        }\n\n        cb()\n    }\n\n    if (/Trident\\/|MSIE/.test(window.navigator.userAgent) || isOldIOS()) {\n        inViewPort(attribute, value)\n    } else {\n        if ('IntersectionObserver' in window) {\n            node.classList.add(CLASSNAME_OUT_OF_SCREEN)\n            let lazyBackgroundObserver = new IntersectionObserver(function (entries) {\n                entries.forEach(function (entry) {\n                    if (entry.isIntersecting) {\n                        inViewPort(attribute, value)\n                        lazyBackgroundObserver.unobserve(entry.target)\n                    }\n                })\n            })\n            lazyBackgroundObserver.observe(node)\n        } else {\n            inViewPort(attribute, value)\n        }\n    }\n}\n\nexport function lazyLoadCallback(node: Element, cb: () => void) {\n    const isOldIOS = () => {\n        var agent = window.navigator.userAgent,\n            start = agent.indexOf('OS ')\n        if ((agent.indexOf('iPhone') > -1 || agent.indexOf('iPad') > -1) && start > -1) {\n            return window.Number(agent.substr(start + 3, 3).replace('_', '.')) < 14\n        }\n        return false\n    }\n\n    if (/Trident\\/|MSIE/.test(window.navigator.userAgent) || isOldIOS()) {\n        cb()\n    } else {\n        if ('IntersectionObserver' in window) {\n            let lazyBackgroundObserver = new IntersectionObserver(\n                function (entries) {\n                    entries.forEach(function (entry) {\n                        if (entry.isIntersecting) {\n                            cb()\n                            lazyBackgroundObserver.unobserve(entry.target)\n                        }\n                    })\n                },\n                { rootMargin: '150% 0px' }\n            )\n            lazyBackgroundObserver.observe(node)\n        }\n    }\n}\n\n// Debounce\nexport function debounce<T>(func: (v: T) => void, time = 100) {\n    let timer: number\n    return function (event: T) {\n        if (timer) {\n            window.clearTimeout(timer)\n        }\n        timer = window.setTimeout(func, time, event)\n    }\n}\n\n// isIE - to check for internet explorer\nexport function isIE() {\n    let ua = window.navigator.userAgent,\n        isIE = /MSIE|Trident/.test(ua)\n\n    return isIE\n}\n\n// Load external script\nexport const loadExternalScript = ({\n    src,\n    callback = null,\n    async = false,\n    defer = false,\n    module = false,\n    id = ''\n}: {\n    src: string;\n    callback: null | GlobalEventHandlers[\"onload\"]\n    module: boolean,\n    defer: boolean,\n    async: boolean,\n    id: string\n}) => {\n    const script = document.createElement('script')\n    script.type = module ? 'module' : 'text/javascript'\n    script.src = src\n    id ? (script.id = id) : false // add id attribute only if passed\n    if (typeof callback === 'function') {\n        script.onload = callback\n    }\n    script.async = async\n    script.defer = defer\n    document.body.appendChild(script)\n}\n\n// Load external css\nexport const loadExternalCss = ({ src }: { src: string }) => {\n    const script = document.createElement('link')\n    script.rel = 'stylesheet'\n    script.href = src\n    document.body.appendChild(script)\n}\n// Lazy load vendor script\nexport const lazyLoadVendorScript = (handler, el) => {\n    const observer = new IntersectionObserver(handler)\n    observer.observe(el)\n}\n\n/**\n * Replaces variable inside a given string\n * Each variable have to be enclosed between stChr and enChr\n * The values have to be contained in the vars object, they key must match\n * example :\n * txt : 'See {resultsLength} Results'\n * vars : {resultsLength:'30'}\n * stChr : '{'\n * enChr : '}'\n *\n * will return : 'See 30 Results'\n *\n * @param {string} txt\n * @param {object} vars\n * @param {string} stChr\n * @param {string} enChr\n */\nexport function interpolate(txt: string, vars: Record<string, null | undefined | string>, stChr: string, enChr: string) {\n    let curIdx = 0\n\n    while (txt) {\n        const stIdx = txt.indexOf(stChr, curIdx)\n        if (stIdx === -1) {\n            break\n        }\n        const enIdx = txt.indexOf(enChr, stIdx + 1)\n        if (enIdx === -1) {\n            break\n        }\n        const hashId = txt.substring(stIdx + stChr.length, enIdx)\n        if (vars[hashId] != null) {\n            txt = txt.substr(0, stIdx) + vars[hashId] + txt.substr(enIdx + enChr.length)\n            curIdx = stIdx\n        } else {\n            curIdx = enIdx\n        }\n    }\n    return txt\n}\n\n/**\n * Find in container element, add height to equal size of element\n * @param container css path where my element is contain e.g. `.c-container`\n * @param el css path of elements to equalized\n */\nexport const equalHeight = (containerSelector: string, el: string, elementScope: HTMLElement) => {\n    const container = elementScope.querySelector<HTMLElement>(containerSelector)\n    if (!container) {\n        return\n    }\n\n    const items = container.querySelectorAll<HTMLElement>(el)\n    let max = -1\n\n    for (let i = 0; i < [...items].length; i++) {\n        const item = [...items][i]\n        let h = item.offsetHeight\n        max = h > max ? h : max\n    }\n\n    if (max <= 0) {\n        return\n    }\n\n    for (let i = 0; i < [...items].length; i++) {\n        const item = [...items][i]\n        item.style.height = `${max}px`\n    }\n}\n\nexport const stringifyCurlyQuote = (data: {}) => JSON.stringify(data).replace(\"'\", '’')\n\nexport const stringifyForAttribute = (data = {}) => {\n    return escapeHtml(JSON.stringify(data))\n}\n\n/**\n * This function is included instead of sanitizeString because for\n * inserting HTML into innerHTML we need to make sure all HTML\n * entities are escaped.\n */\nexport const escapeHtml = (text: string) => {\n    const map = {\n        '&': '&amp;',\n        '<': '&lt;',\n        '>': '&gt;',\n        '\"': '&quot;',\n        \"'\": '&#039;'\n    } as { [s: string]: string }\n\n    return text.replace(/[&<>\"']/g, (m) => map[m])\n}\n\n/**\n * Because setting attributes escapes more than the characters above and then preact also\n * escapes text we need a more complete way of unescaping all html entities (not just the ones\n * above)\n */\nconst domParser = new DOMParser()\nexport const unescapeHtml = (text: string) => {\n    return domParser.parseFromString(text, \"text/html\").body.textContent\n}\n\nexport const sanitizeString = (data: {}) => {\n    if (!data) {\n        return ''\n    }\n\n    return data.toString().replace(/\"/g, '&quot;').replace(/'/g, '&apos;')\n}\n\nexport const stripTags = (s: string) => {\n    return (s || '').replace(/(<([^>]+)>)/gi, '')\n}\n\nexport const setAttributes = (element: Element, attrs: Record<string, any>) => {\n    for (let key in attrs) {\n        element.setAttribute(key, attrs[key])\n    }\n    return element\n}\n\nexport const getMetaContent = (metaName: string) => {\n    const metaTag = document.querySelector(`meta[name=${metaName}]`)\n    if (!metaTag) {\n        return ''\n    }\n    return metaTag.getAttribute('content')\n}\n\nexport const isObjectEmpty = (obj: {}) => {\n    return Object.keys(obj).length === 0\n}\n","import { getProduct } from '@kissui/helpers/src/catalog'\nimport { emitCustomEvent } from './events.helpers'\nimport { removeEmptyValues } from '@kissui/helpers/src/utils'\n\nconst raisedByPB = 'page builder'\nconst raisedByWC = 'Web component'\n\n/**\n * helper method for 'itemDisplay' GTM event\n * @param {*} event : 'itemDisplay' - Mandatory as is\n * @param {*} eventRaisedBy : 'Web component' - Mandatory as is\n * @param {*} eventAction : 'Click' - Action that led to the item display. For example, click\n * @param {*} itemTypes : ['products'] - Mandatory as is\n * @param {*} rootElement : ['nb-slider'] - Root DOM element for item detection. Closest common ancestor element of the inserted/displayed promotions and products. It will help the detection to reduce its performance consumption. Set to 0 (zero) in order to request detection through the entire document.\n */\nexport const itemDisplay = args => {\n    window.gtmDataObject = window.gtmDataObject || []\n    const eventData = {\n        event: 'itemDisplay',\n        eventRaisedBy: raisedByWC,\n        eventAction: 'Click',\n        itemTypes: ['products'],\n        ...args\n    }\n    window.gtmDataObject.push(eventData)\n    emitCustomEvent('itemDisplay', eventData)\n}\n\n/**\n *\n * helper method for 'customEvent' GTM event\n * @param {*} args (event, eventRaisedBy, eventCategory, eventAction, eventLabel, nonInteraction)\n */\n\nexport const customEvent = args => {\n    window.gtmDataObject = window.gtmDataObject || []\n    var eventData\n    if (args.event_GA4 === undefined || args.event_GA4 === false) {\n        eventData = {\n            event: 'customEvent',\n            eventRaisedBy: raisedByWC,\n            ...args\n        }\n    } else {\n        eventData = {\n            event_raised_by: raisedByPB,\n            ...args\n        }\n    }\n    window.gtmDataObject.push(eventData)\n    emitCustomEvent('customEvent', eventData)\n}\n\n/**\n * Helper method for tracking component interactions, compatible with GA4.\n *\n * @param {String} creative : component raising the event, e.g. 'before_coffees_list', 'before_machines_list', 'before_accessories_list'\n * @param {String} actionType : description of the interaction, e.g 'pdp quick view'\n * @param {String} internationalId : long SKU, e.g. 'erp.pt.b2c/prod/7243.30'\n * @param {String} internationalName : international name of the product, e.g. 'Vertuo Carafe Pour-Over Style Mild'\n * @param {String} productType : type of product, i.e. 'capsule', 'machine', 'accessory'\n * @param {String} range : product range, e.g. 'ispirazione italiana'\n * @param {String} technology : technology, i.e. 'original', 'vertuo'\n * @param {Number} price : price, e.g. .51\n * @param {String} eventAction : description of the action, e.g. 'PDP Quick View'\n *\n * Initally created for PDP Quick View tracking:\n * https://dsu-confluence.nestle.biz/display/DIANA/BEFORE+-+PDP+Quick+View\n * Will probably be rolled out across all components, update this comment accordingly.\n */\nexport const trackComponentInteraction = ({\n    creative = '',\n    actionType = '',\n    internationalId = '',\n    internationalName = '',\n    productType = '',\n    technology = '',\n    category = '',\n    rawPrice = '',\n    eventAction = ''\n}) => {\n    window.gtmDataObject = window.gtmDataObject || []\n    const eventData = {\n        event: 'page_builder_component_interaction',\n        event_raised_by: raisedByPB,\n        component_name: creative,\n        action_type: actionType,\n        item_id_event: internationalId,\n        item_name_event: internationalName,\n        item_category_event: productType,\n        item_technology_event: technology,\n        item_range_event: category,\n        item_price_event: rawPrice,\n        eventCategory: 'User Engagement',\n        eventAction: eventAction,\n        eventLabel: `${productType} - ${technology} - ${internationalName}`\n    }\n    window.gtmDataObject.push(eventData)\n    emitCustomEvent('page_builder_component_interaction', eventData)\n}\n\n/**\n *\n * Push 'view_promotion' event for GA 4\n * @param {*} args (event, event_raised_by, ecommerce: {promotion_id, promotion_name, creative_slot, creative_name})\n */\nexport const viewPromotion = args => {\n    const event = 'view_promotion'\n    const eventData = {\n        event,\n        event_raised_by: raisedByPB,\n        ecommerce: {}\n    }\n    if (Object.keys(args).length) {\n        const { id = '', creative = '', name = '', position = '' } = args\n        let ecommerceData = {\n            promotion_id: id,\n            promotion_name: name,\n            creative_slot: position,\n            creative_name: creative\n        }\n        ecommerceData = removeEmptyValues(ecommerceData)\n        eventData.ecommerce = ecommerceData\n    }\n    window.gtmDataObject ??= []\n    window.gtmDataObject.push(eventData)\n    emitCustomEvent(event, eventData)\n}\n\nexport const handlePromoClick = args => {\n    const { campaign, cta_name } = args\n\n    const cleanedData = removeEmptyValues(campaign)\n    selectPromotion({ cta_name, ...cleanedData })\n}\n\n/**\n *\n * Push 'select_promotion' event for GA 4\n * @param {*} args (event, event_raised_by, cta_name, ecommerce: {promotion_id, promotion_name, creative_slot, creative_name})\n */\nexport const selectPromotion = args => {\n    const event = 'select_promotion'\n    const eventData = {\n        event: 'select_promotion',\n        cta_name: args?.cta_name ?? '(not set)',\n        event_raised_by: raisedByPB,\n        ecommerce: {}\n    }\n    if (Object.keys(args).length) {\n        const { id = '', creative = '', name = '', position = '' } = args\n        let ecommerceData = {\n            promotion_id: id,\n            promotion_name: name,\n            creative_slot: position,\n            creative_name: creative\n        }\n        ecommerceData = removeEmptyValues(ecommerceData)\n        eventData.ecommerce = ecommerceData\n    }\n\n    window.gtmDataObject ??= []\n    window.gtmDataObject.push(eventData)\n    emitCustomEvent(event, eventData)\n}\n\nexport const interactionClick = (nameComponent, ctaName) => {\n    window.gtmDataObject = window.gtmDataObject || []\n    const eventData = {\n        event: 'page_builder_component_interaction',\n        event_raised_by: raisedByPB,\n        eventCategory: 'User Engagement',\n        eventAction: 'Click CTA',\n        eventLabel: `Page Builder - ${nameComponent} - ${ctaName}`,\n        component_name: nameComponent,\n        action_type: 'web component click',\n        cta_name: ctaName\n    }\n    window.gtmDataObject.push(eventData)\n    emitCustomEvent('page_builder_component_interaction', eventData)\n}\n\nexport const getProductInfo = async (sku, data) => {\n    let product = data\n    if (!product) {\n        product = await getProduct(sku)\n    }\n    return product\n}\n\nexport const getProductPayload = (data, actionField = {}) => {\n    const {\n        internationalName,\n        internationalId,\n        category,\n        unitPrice,\n        legacyId,\n        name,\n        technologies,\n        bundled,\n        inStock,\n        type\n    } = data\n\n    const technology = technologies.map(item => item.split('/').pop()).join('|')\n    const isDiscovery = category.toLowerCase().includes('discovery')\n\n    return [\n        // Array consists of one product details for PDP Product Detail View\n        {\n            ...actionField,\n            name: internationalName, // '[[International Product Name]]' NIE, Contract\n            id: internationalId, // '[[International Product ID]]'\n            price: unitPrice, // '[[Product Price]'\n            // dimension43: '[[true/false]]', // '[[true/false]]' // Signifies if this product is part of a standing order or not\n            dimension44: isDiscovery.toString(), // '[[true/false]]', // Signifies if this product is part of a discovery offer\n            dimension53: legacyId, // '[[Product Local market ID]]', // Local market id for product\n            dimension54: name, // '[[Product Local market Name]]', // Local market name for product\n            dimension55: category, // '[[Product Range]]', // Range of the product, eg: Barista Creations for Ice (Nessoft Category)\n            dimension56: technology, // '[[Product Technology]]', //Product technology according to Nespresso categorization (original, vertuo, pro)\n            dimension57: bundled ? 'bundle' : 'single', // '[[Product Type]]', //If the product is single or bundle\n            dimension192: inStock ? 'in stock' : 'out of stock', // '[in stock]', // \"in stock\" or \"out of stock\"\n            category: type, // '[[Product Category]]', //Product category according to Nespresso categorization (Nessoft type): capsule, accessory, machine\n            brand: 'Nespresso' // Static value set to Nespresso\n        }\n    ]\n}\n\nexport const trackDetailView = async (sku, data) => {\n    // https://dsu-confluence.nestle.biz/display/DIANA/HQ+PB+Tracking+-+Product+Detail+View\n    if (window.pbTrackDetailViewPDP || !sku || !window.napi) {\n        return\n    }\n\n    const productInfo = await getProductInfo(sku, data)\n    const productPayload = getProductPayload(productInfo)\n    const currency = productInfo.currency\n\n    window.gtmDataObject = window.gtmDataObject || []\n    const eventData = {\n        event: 'detailView',\n        currencyCode: currency,\n        eventRaisedBy: raisedByPB,\n        ecommerce: {\n            detail: {\n                actionField: {},\n                products: productPayload\n            }\n        }\n    }\n    window.gtmDataObject.push(eventData)\n    // Track only once per page\n    window.pbTrackDetailViewPDP = true\n    emitCustomEvent('detailView', eventData)\n}\n\nexport const trackAddToCartImpression = (product, isStickyBar) => {\n    // https://dsu-confluence.nestle.biz/pages/viewpage.action?spaceKey=DIANA&title=PDP+-+Sticky+Add+To+Cart+Custom+Event\n\n    window.gtmDataObject = window.gtmDataObject || []\n    const eventData = {\n        event: 'page_builder_component_interaction',\n        event_raised_by: raisedByPB,\n        component_name: 'before_sku_main_info',\n        action_type: isStickyBar\n            ? 'sticky add to cart impression'\n            : 'standard add to cart impression',\n        //product info\n        item_id_event: product.internationalId,\n        item_name_event: product.internationalName,\n        item_category_event: product.type,\n        item_price_event: product.price_per_capsule?.split(' ')[0],\n        item_market_id_event: product.legacyId,\n        item_market_name_event: product.name,\n        item_range_event: product.category_name,\n        item_technology_event: product.technology?.[0]?.split('/').slice(-1) ?? '',\n        item_type_event: product.bundled ? 'bundle' : 'single'\n    }\n    window.gtmDataObject.push(eventData)\n    emitCustomEvent('page_builder_component_interaction', eventData)\n}\n\nexport const productImpression = async (position, list, sku, data) => {\n    // https://dsu-confluence.nestle.biz/pages/viewpage.action?pageId=225612781\n    // don't track already tracked products\n    window.gtmDataObject = window.gtmDataObject || []\n    const hasDetailView = window.gtmDataObject.find(item => item.event === 'detailView')\n    const alreadyTracked = !!hasDetailView?.ecommerce?.detail?.products.find(p =>\n        sku.includes(p.id)\n    )\n    if (alreadyTracked) {\n        return\n    }\n\n    const productInfo = await getProductInfo(sku, data)\n    const productPayload = getProductPayload(productInfo, { list: list, position: position })\n    const currency = productInfo.currency\n    const eventData = {\n        event: 'impression',\n        eventAction: 'Product Impression',\n        currencyCode: currency,\n        eventRaisedBy: raisedByPB,\n        ecommerce: {\n            impressions: productPayload\n        }\n    }\n    window.gtmDataObject.push(eventData)\n    emitCustomEvent('impression', eventData)\n}\n\nexport const productClick = async (position, list, sku, data) => {\n    // https://dsu-confluence.nestle.biz/pages/viewpage.action?pageId=225612781\n\n    if (typeof list !== 'string') return\n\n    const productInfo = await getProductInfo(sku, data)\n    const productPayload = getProductPayload(productInfo, { position: position })\n    const currency = productInfo.currency\n\n    window.gtmDataObject = window.gtmDataObject || []\n    const eventData = {\n        event: 'productClick',\n        eventAction: 'Product Click',\n        currencyCode: currency,\n        eventRaisedBy: raisedByPB,\n        ecommerce: {\n            click: {\n                actionField: {\n                    list: list\n                },\n                products: productPayload\n            }\n        }\n    }\n    window.gtmDataObject.push(eventData)\n    emitCustomEvent('productClick', eventData)\n}\n\nexport function filterTrackingFromPlpFilters(filtersSelected) {\n    const grouped = groupSelectedFilters(filtersSelected)\n    const groupKeys = Object.keys(grouped)\n    const typesFiltersSelected = groupKeys.join('|').substring(0, 99)\n    const valuesFiltersSelected = groupKeys\n        .map(key => grouped[key].values.map(value => value.split('/').at(-1)).join(','))\n        .join('|')\n        .substring(0, 99)\n\n    return [typesFiltersSelected, valuesFiltersSelected]\n}\n\nexport const filterActionEvent = (\n    actionType,\n    filterType,\n    filterValues,\n    clickLocation,\n    dataType\n) => {\n    // https://dsu-confluence.nestle.biz/display/DIANA/PLP+-+Filter+Revamp\n    window.gtmDataObject = window.gtmDataObject || []\n    const eventData = getExplicitFilterEventData(\n        actionType,\n        filterType,\n        filterValues,\n        clickLocation\n    )\n\n    window.gtmDataObject.push(eventData)\n    if (window.NEXT_V1_PLP_EXPLICIT_FILTER_TRACKING && dataType) {\n        window.gtmDataObject.push({\n            ...window.NEXT_V1_PLP_EXPLICIT_FILTER_TRACKING,\n            experiment_action: `${actionType} - ${dataType}`,\n            cta_name: 'All filters'\n        })\n    }\n\n    emitCustomEvent('plp_filter', eventData)\n}\n\nconst getExplicitFilterEventData = (actionType, filterType, filterValues, clickLocation) => {\n    return {\n        event: 'plp_filter',\n        event_raised_by: raisedByPB,\n        action_type: actionType,\n        filter_type: filterType,\n        ...(filterValues ? { filter_values: filterValues } : {}),\n        ...(clickLocation ? { click_location: clickLocation } : {})\n    }\n}\n\nfunction groupSelectedFilters(filtersSelected = []) {\n    return filtersSelected.reduce((grouped, { key, value }) => {\n        if (!grouped[key]) grouped[key] = { key, values: [] }\n        grouped[key].values.push(value.replaceAll(',', '-'))\n        return grouped\n    }, {})\n}\n\nfunction arrTolastURLElementMapper(arr) {\n    if (typeof arr === 'undefined' || arr.length === 0) return undefined\n\n    return arr.map(item => item.split('/').pop()?.trim() || '')\n}\n\nfunction arrToJoinedString(arr, joiner = '|') {\n    if (typeof arr === 'undefined' || arr.length === 0) return undefined\n\n    return arr.map(item => item.trim()).join(joiner)\n}\n\nfunction findTechnogiesText(arr) {\n    if (typeof arr === 'undefined' || arr.length === 0) return undefined\n\n    if (arr.length === 1) return cleanText(arrTolastURLElementMapper(arr)?.[0])\n    else return 'multiple'\n}\n\nfunction cleanText(str) {\n    if (typeof str === 'undefined') return undefined\n\n    return str.toString().trim()\n}\n\nconst generateEcommerceObject = async (productIds, options) => {\n    const productRequests = productIds.map(SKU => getProduct(SKU))\n    const productData = await Promise.all(productRequests)\n\n    return {\n        ecommerce: {\n            currency: window[window.config.padl.namespace].dataLayer.app.app.currency,\n            value: productData.reduce((ac, product) => {\n                return ac + product.price\n            }, 0),\n            items: productData.map((product, index) => {\n                if (product.type === 'bundle' || product.type === 'giftcard') {\n                    return {\n                        item_id: cleanText(product.internationalId),\n                        item_name: cleanText(product.internationalName),\n                        item_brand: 'nespresso',\n                        item_category: cleanText(product.type),\n                        index: index + 1\n                    }\n                }\n\n                let output = {\n                    item_id: cleanText(product.internationalId),\n                    item_name: cleanText(product.internationalName),\n                    item_brand: 'nespresso',\n                    item_category: cleanText(product.type),\n                    item_category2: arrToJoinedString(\n                        arrTolastURLElementMapper(product.technologies)\n                    ),\n                    item_category3: cleanText(product.category),\n                    price: product.price,\n                    quantity: product.salesMultiple,\n                    affiliation: 'nespresso online store',\n                    coupon: undefined,\n                    discount: undefined,\n                    location_id: undefined,\n                    item_list_name: cleanText(options?.listName),\n                    item_list_id: cleanText(options?.listId),\n                    index: index + 1,\n                    item_market_id: cleanText(product.legacyId),\n                    item_market_name: cleanText(product.name),\n                    item_technology: findTechnogiesText(product.technologies),\n                    item_range: cleanText(product.category),\n                    item_discovery_offer: product.category.includes('discovery').toString(),\n                    item_added_by_user: undefined,\n                    item_ecotax_applicable: product?.displayEcoTax\n                        ? cleanText(product?.displayEcoTax.toString())\n                        : undefined,\n                    item_selection_list: cleanText(arrToJoinedString(product.productSelections)),\n                    item_in_stock: product?.inStock\n                        ? cleanText(product?.inStock.toString())\n                        : undefined,\n                    item_subscription_name: undefined,\n                    item_subscription_category: undefined,\n                    item_subscription_price: undefined,\n                    item_subscription_duration: undefined,\n                    item_subscription_fee: undefined\n                }\n\n                switch (product.type) {\n                    case 'capsule': {\n                        const capsuleProduct = product\n\n                        output.item_category4 = capsuleProduct.bundled ? 'bundle' : 'single'\n\n                        output.item_type = capsuleProduct.bundled ? 'bundle' : 'single'\n\n                        output.item_coffee_aromatic_profile = cleanText(\n                            arrToJoinedString(capsuleProduct.capsuleProductAromatics)?.toLowerCase()\n                        )\n\n                        output.item_coffee_intensity =\n                            cleanText(capsuleProduct.capsuleProperties.intensity) ?? undefined\n\n                        output.item_coffee_cup_size = cleanText(\n                            arrToJoinedString(capsuleProduct.capsuleCupSizes)\n                        )?.toLowerCase()\n\n                        break\n                    }\n                    case 'machine': {\n                        const machineProduct = product\n\n                        output.item_machine_shade = cleanText(machineProduct.colorShade?.name)\n\n                        break\n                    }\n                }\n\n                if (product.type === 'machine' || product.type === 'accessory') {\n                    output.item_avg_rating = product.ratingCode\n                    output.item_number_of_reviews = product.ratingCode\n                }\n\n                return output\n            })\n        }\n    }\n}\n\nexport const selectItems = async (productIds, options) => {\n    const ecommerceObject = await generateEcommerceObject(productIds, options)\n\n    const output = {\n        event: 'select_item',\n        event_raised_by: options?.eventRaisedBy ?? 'before_cross_sell_v3',\n        click_location: options?.clickLocation ?? 'page builder cross sell quick view',\n        item_list_id: options?.listId ?? 'before_cross_sell_v3',\n        subscription_product_included: 'false',\n        discovery_offer_included: 'false',\n        ...ecommerceObject\n    }\n\n    window.gtmDataObject.push({ ecommerce: null })\n    window.gtmDataObject.push(output)\n}\n\nexport const viewItemList = async (productIds, options) => {\n    const ecommerceObject = await generateEcommerceObject(productIds, options)\n\n    const output = {\n        event: 'view_item_list',\n        event_raised_by: options?.eventRaisedBy,\n        subscription_product_included: 'false',\n        discovery_offer_included: 'false',\n        ...ecommerceObject\n    }\n\n    if (options?.eventRaisedBy === undefined) delete output.event_raised_by\n\n    window.gtmDataObject.push({ ecommerce: null })\n    window.gtmDataObject.push(output)\n}\n\nexport const isGtmTrackingExists = trackingData => {\n    window.gtmDataObject = window.gtmDataObject || []\n\n    return window.gtmDataObject.some(\n        event =>\n            event.event === trackingData.event &&\n            event.ecommerce?.creative_slot === trackingData.campaign.position &&\n            event.ecommerce?.promotion_id === trackingData.campaign.id &&\n            event.ecommerce?.promotion_name === trackingData.campaign.name &&\n            event.ecommerce?.creative_name === trackingData.campaign.creative\n    )\n}\n","export const dispatchEvent = ({ eventName, args, element }) => {\n    // Use the provided element or fallback to window if available\n    if (!element) {\n        if (typeof window !== 'undefined') {\n            element = window\n        } else {\n            throw new Error(\n                '`element` is not provided and `window` is unavailable. Provide a valid element to dispatch the event.'\n            )\n        }\n    }\n\n    let event\n    if (args) {\n        event = new CustomEvent(eventName, { detail: args, bubbles: true })\n    } else {\n        if (typeof Event === 'function') {\n            event = new Event(eventName)\n        } else {\n            event = document.createEvent('Event')\n            event.initEvent(eventName, true, true)\n        }\n    }\n    element.dispatchEvent(event)\n}\n\nexport const readEvent = e => {\n    if (!e.detail) {\n        return\n    }\n    return e.detail\n}\n","import viewportHelper from './viewport.helpers'\n\nconst devices = ['mobile', 'tablet', 'desktop', 'retina'] as const\ntype Device = typeof devices[number]\ntype Sources =  { [P in Device]?: string; }\n\nconst getDevice = (sources: Sources) => {\n    if (!Array.isArray(sources) && typeof sources !== 'object') {\n        return null\n    }\n\n    return devices.find(\n        device => viewportHelper.is[device] === true && device in sources && sources[device] !== ''\n    )\n}\n\nconst visual = () => {\n    const getResponsiveSrc = (src: Sources) => {\n        const device = getDevice(src)\n        return device ? src[device] : src['desktop']\n    }\n\n    return { getResponsiveSrc }\n}\n\nconst helper = visual()\n\nexport default helper\n","export default class {\n    constructor(_props) {\n        this.props = _props\n        this.elementId = null\n    }\n    render() {\n        throw new Error('You must implement the render method')\n    }\n    bindEvents() {\n        return []\n    }\n}\n","import Notification from './notification/notification'\nexport default {\n    notification: Notification\n}\n","import Subcomponent from '../subcomponent.class'\nimport './notification.scss'\nexport default class extends Subcomponent {\n    render() {\n        const { label } = this.props\n\n        if (!label) {\n            return ''\n        }\n\n        return `\n            <div class=\"notification\">\n                ${this.renderIcon()}\n                ${this.renderLabel()}\n            </div>\n        `\n    }\n\n    renderIcon() {\n        const { icon } = this.props\n        return `<span><nb-icon icon=\"${icon}\"></nb-icon></span>`\n    }\n\n    renderLabel() {\n        const { label } = this.props\n        return `<p class=\"t-sm-400-sl\">${label}</p>`\n    }\n}\n","import viewportHelper from '@kissui/helpers/src/viewport.helpers'\nimport visualHelper from '@kissui/helpers/src/visual.helpers'\nimport eventsHelpers from '@kissui/helpers/src/events.helpers'\nimport createProps from '@kissui/helpers/src/props.helpers'\nimport createRefs from '@kissui/helpers/src/refs.helpers'\nimport subcomponents from '../subcomponents/modal-recipe/subcomponents'\nimport { EVENT_POPIN_OPEN, EVENT_VIDEO_TOGGLE } from '@kissui/components'\nimport { dispatchEvent } from '@kissui/helpers/src/assets/js/eventDispatch'\n\nclass BaseModalRecipe extends HTMLElement {\n    async connectedCallback() {\n        this.props = createProps(this.attributes)\n        const { popin_id } = this.props\n        this.popinId = popin_id\n        this.videoPopinId = 'video-' + popin_id\n        this.videoPlayerId = 'player-' + popin_id\n        this.isPlaying = false\n\n        await this.render()\n        this.refs = createRefs(this)\n\n        if (this.hasMedia() && this.refs.cover) {\n            this.eventListeners = this.createEventListeners()\n            eventsHelpers.add(this.eventListeners)\n        }\n    }\n\n    createEventListeners() {\n        return [\n            {\n                element: this.refs.cover,\n                type: 'click',\n                listener: this.openPlayer.bind(this)\n            }\n        ]\n    }\n\n    hasMedia() {\n        const { video } = this.props\n        return (\n            (video !== undefined &&\n                Object.keys(video).length &&\n                video.video_id &&\n                video.video_service) ||\n            ''\n        )\n    }\n\n    renderHeader() {\n        const { header: { heading = '', subheading = '' } = {} } = this.props\n\n        return `<header>\n                ${heading && `<h2 class=\"h-2xl-700\">${heading}</h2>`}\n                ${subheading && `<p class=\"t-md-400\">${subheading}</p>`}\n                ${this.renderNotifications()}\n                ${this.renderMetas()}\n             </header>`\n    }\n\n    renderMetas() {\n        const { header: { metas = {} } = {} } = this.props\n        return `<div class=\"metas\">${Object.entries(metas).reduce(\n            this.renderMeta.bind(this),\n            ''\n        )}</div>`\n    }\n\n    renderMeta(metas, [key, label]) {\n        const icon = { time: '24/symbol/clock', difficulty: '24/symbol/difficulty' }[key]\n        const { a11y_time = '', a11y_difficulty = '' } = this.props.options\n\n        let a11y_label = `<span class=\"sr-only\">${a11y_time}</span>`\n        if (key === 'difficulty') {\n            a11y_label = `<span class=\"sr-only\">${a11y_difficulty}</span>`\n        }\n\n        return `${metas ?? ''}\n            <div class=\"meta\">\n                <nb-icon icon='${icon}'></nb-icon>\n                ${a11y_label}\n                <span>${label}</span>\n            </div>`\n    }\n\n    renderNotifications() {\n        const { disclaimer = {} } = this.props.header\n\n        const SubcomponentNotification = subcomponents['notification']\n        const notification = new SubcomponentNotification(disclaimer)\n        return notification.render()\n    }\n\n    renderLink() {\n        const { link: { label = '', target = '' } = {} } = this.props\n\n        return label && target\n            ? `<nb-link link=\"${target}\" label=\"${label}\" color=\"gold\" size=\"large\">${label}</nb-link>`\n            : ''\n    }\n\n    renderVisual(visual) {\n        const { src, alt = '' } = visual\n        if (!src) {\n            return ''\n        }\n\n        const responsiveSrc = visualHelper.getResponsiveSrc(src)\n        return responsiveSrc && `<img src=\"${responsiveSrc}\" alt=\"${alt}\" />`\n    }\n\n    renderCover() {\n        const { visual, video = null } = this.props\n\n        if (!visual?.src) {\n            return\n        }\n\n        if (!this.hasMedia()) {\n            return `<div class=\"cover\" data-ref=\"cover\">\n                        <div class=\"visual\">\n                            ${this.renderVisual(visual)}\n                        </div>\n                   </div>`\n        } else if (viewportHelper.is.mobile) {\n            return `<div class=\"cover\" data-ref=\"cover\">\n                        <button class=\"visual\">\n                            ${this.renderVisual(visual)}\n                            <nb-icon icon=\"24/symbol/play-solid\"></nb-icon>\n                        </button>\n                   </div>`\n        } else {\n            if (!video) {\n                return ''\n            }\n\n            const { video_id = '', video_mobile = '', video_service = '' } = video\n\n            return `<div class=\"cover\" data-ref=\"cover\">\n                        <button class=\"visual\">\n                            ${this.renderVisual(visual)}\n                            <nb-icon icon=\"24/symbol/play-solid\"></nb-icon>\n                        </button>\n                        <nb-video\n                            container_id=\"${this.videoPlayerId}\"\n                            video_service=\"${video_service}\"\n                            video_id=\"${video_id}\"\n                            video_mobile=\"${video_mobile}\"\n                            popin_id=\"${this.popinId}\"\n                            display_controls=\"1\"\n                        />\n                   </div>`\n        }\n    }\n\n    renderPlayer() {\n        const { video: { video_id = '', video_mobile = '', video_service = '' } = {} } = this.props\n\n        if (!video_id || !video_service) {\n            return ''\n        }\n\n        return `<nb-popin id=\"${this.videoPopinId}\" variation=\"before\" bgcolor=\"white\">\n                    <nb-video\n                        container_id=\"${this.videoPlayerId}\"\n                        video_service=\"${video_service}\"\n                        video_id=\"${video_id}\"\n                        video_mobile=\"${video_mobile}\"\n                        popin_id=\"${this.videoPopinId}\"\n                        display_controls=\"1\"\n                        allow_popin_autoplay=\"true\"\n                    />\n                </nb-popin>`\n    }\n\n    togglePlayPause() {\n        this.isPlaying ? this.classList.remove('play') : this.classList.add('play')\n        this.isPlaying = !this.isPlaying\n    }\n\n    openPlayer() {\n        if (viewportHelper.is.mobile) {\n            dispatchEvent({\n                eventName: EVENT_POPIN_OPEN,\n                args: { id: this.videoPopinId },\n                element: this\n            })\n            this.closest('nb-popin').classList.add('has-open-video')\n        } else {\n            this.togglePlayPause()\n            dispatchEvent({\n                eventName: EVENT_VIDEO_TOGGLE,\n                args: { id: this.popinId },\n                element: this\n            })\n        }\n    }\n\n    disconnectedCallback() {\n        eventsHelpers.remove(this.eventListeners)\n    }\n}\n\nexport default BaseModalRecipe\n","import viewportHelper from '@kissui/helpers/src/viewport.helpers'\nimport BaseModalRecipe from '../../classes/BaseModalRecipe'\n\nclass ModalRecipe extends BaseModalRecipe {\n    render() {\n        this.innerHTML = `\n            <div class=\"cb-row\">\n                <div class=\"cb-col1\">\n                    ${this.renderHeader()}\n                    ${viewportHelper.is.mobile_tablet ? this.renderCover() : ''}\n                    ${this.renderRequirements()}\n                </div>\n                <div class=\"cb-col2\">\n                    ${!viewportHelper.is.mobile_tablet ? this.renderCover() : ''}\n                    ${this.renderInstructions()}\n                </div>\n            </div>\n            <footer>\n                ${this.renderLink()}\n            </footer>\n            ${viewportHelper.is.mobile && this.hasMedia() ? this.renderPlayer() : ''}`\n    }\n\n    renderRequirements() {\n        const { requirements: { heading = '', ingredients = {}, materials = {} } = {} } = this.props\n\n        return `<section class=\"ingredients\" aria-label=\"${heading}\">\n                <h3 class=\"h-lg-700\">${heading}</h3>\n                ${this.renderList(ingredients)}\n                ${this.renderList(materials)}\n            </section>`\n    }\n\n    renderList(list) {\n        const { heading = '', items = [] } = list\n        return `<h4 class=\"t-md-700\">${heading}</h4>\n                <table cellspacing=\"0\" cellpadding=\"0\">\n                    <tbody>\n                        ${this.renderListItems(items)}\n                    </tbody>\n                </table>`\n    }\n\n    renderListItems(items = []) {\n        return items.reduce(\n            (output, item) =>\n                `\n                ${output}\n                ${this.renderListItem(item)}\n            `,\n            ''\n        )\n    }\n\n    renderListItem(item) {\n        const { visual = {}, proportion = '', label = '' } = item\n\n        if (Object.keys(visual).length === 0 && proportion === '') {\n            return `<tr><td class=\"t-sm-500-sl\" colspan=\"2\">${label}</td></tr>`\n        } else {\n            return `<tr>\n                        <td class=\"t-sm-400-sl\">\n                            ${this.renderVisual(visual)}\n                            ${proportion && `<em>${proportion}</em>`}\n                        </td>\n                        <td class=\"t-sm-500-sl\">${label}</td>\n                    </tr>`\n        }\n    }\n\n    renderInstructions() {\n        const { instructions: { heading = '', steps = [] } = {} } = this.props\n\n        return `<section class=\"instructions\" aria-label=\"${heading}\">\n                    <h3 class=\"instructions__heading h-lg-700\">${heading}</h3>\n                    <ol class=\"steps\">\n                        ${this.renderSteps(steps, this.renderStep.bind(this))}\n                    </ol>\n                </section>`\n    }\n\n    renderSteps(steps, renderCallback) {\n        return steps.reduce((output, step) => `${output}${renderCallback(step)}`, '')\n    }\n\n    renderStep(step) {\n        const { heading = '', substeps = [] } = step\n        return `<li>\n                    <h4 class=\"${\n                        viewportHelper.is.mobile ? 't-sm-700' : 't-md-700'\n                    }\">${heading}</h4>\n                    <ol class=\"substeps\">\n                        ${this.renderSteps(substeps, this.renderSubStep.bind(this))}\n                    </ol>\n                </li>`\n    }\n\n    renderSubStep(subStep) {\n        const { visual = {} } = subStep\n        return `<li class=\"t-sm-400\">\n                    ${subStep.text}<br/>\n                    ${this.renderVisual(visual)}\n                </li>`\n    }\n}\n\ncustomElements.get('nb-modal-recipe') || customElements.define('nb-modal-recipe', ModalRecipe)\n\nexport default ModalRecipe\n","import viewportHelper from '@kissui/helpers/src/viewport.helpers'\nimport { getProduct, getFormattedPrice } from '@kissui/helpers/src/catalog'\nimport BaseModalRecipe from '@kissui/page-builder-sections/src/recipes/classes/BaseModalRecipe'\n\nclass ModalRecipeVariant extends BaseModalRecipe {\n    async render() {\n        const renderedRequirements = await this.renderRequirements()\n        const renderedInstructions = this.renderInstructions()\n        const renderedLink = this.renderLink()\n        const renderedPlayer =\n            viewportHelper.is.mobile && this.hasMedia() ? this.renderPlayer() : ''\n\n        this.updateInnerHTML(\n            renderedRequirements,\n            renderedInstructions,\n            renderedLink,\n            renderedPlayer\n        )\n    }\n\n    updateInnerHTML(renderedRequirements, renderedInstructions, renderedLink, renderedPlayer) {\n        this.innerHTML = `\n        ${this.renderCover()}\n        <div class=\"recipe-content\">\n            ${this.renderHeader()}\n            <div class=\"cb-row recipe-content__details\">\n                <div class=\"cb-col1\">\n                    ${renderedRequirements}\n                </div>\n                <div class=\"cb-col2\">\n                    ${renderedInstructions}\n                </div>\n            </div>\n            <footer>\n                ${renderedLink}\n            </footer>\n        </div>\n        ${renderedPlayer}`\n    }\n\n    async renderRequirements() {\n        const { requirements: { ingredients = {}, materials = {} } = {} } = this.props\n        const renderedIngredients = await this.renderList(ingredients)\n        const renderedMaterials = await this.renderList(materials)\n        return `${renderedIngredients}${renderedMaterials}`\n    }\n\n    /* I copied this from the hero product showcase component. Most if not all variables need to be defined */\n    renderAddToCart(sku, longSku, range, stock) {\n        const className = 'ingredients__buy'\n        const buttonSize = stock ? 'small' : 'large'\n        return `\n            <nb-add-to-cart\n                class=\"${className}\"\n                buttonSize=\"${buttonSize}\"\n                sku=\"${sku}\"\n                longSku=\"${longSku}\"\n                range=\"details-${range}\"\n            ></nb-add-to-cart>\n        `\n    }\n\n    async renderList(list) {\n        const { heading = '', items = [] } = list\n\n        if (items.length === 0) {\n            return ''\n        }\n\n        const renderedItems = await this.renderListItems(items)\n\n        return `<section class=\"recipe-ingredients\" aria-label=\"${heading}\">\n                <h4 class=\"t-md-700-sl\">${heading}</h4>\n                <table cellspacing=\"0\" cellpadding=\"0\" class=\"recipe-ingredients__table\">\n                    <tbody>\n                        ${renderedItems}\n                    </tbody>\n                </table>\n            </section>`\n    }\n\n    async renderListItems(items = []) {\n        const promises = items.map(item => this.renderListItem(item))\n        const renderedItems = await Promise.all(promises)\n        return renderedItems.join('')\n    }\n\n    async renderListItem(item) {\n        const { visual = {}, proportion = '', label = '', product = '' } = item\n\n        if (Object.keys(visual).length === 0 && proportion === '' && product === '') {\n            return `<tr class=\"recipe-ingredients__table-row\">\n                        <td class=\"t-xs-500 recipe-ingredients__table-column\" colspan=\"2\">\n                            ${label}\n                        </td>\n                    </tr>`\n        } else if (product !== '') {\n            try {\n                // Grab data from product via API\n                const productData = await getProduct(product)\n                const { name, price, internationalId, id, inStock } = productData\n                const productSku = internationalId\n                const productLongSku = id\n                const productRange = name\n                const productStock = inStock\n\n                // Format the price including currency\n                const formattedPrice = await getFormattedPrice(price)\n\n                // Display price only if inStock = true\n                const priceHtml = productStock\n                    ? `<span class=\"t-xs-700-caps-sl recipe-ingredients__product-price\">${formattedPrice}</span>`\n                    : ''\n\n                return `<tr class=\"recipe-ingredients__table-row\">\n          <td class=\"t-xs-500 recipe-ingredients__table-column\">\n            <img src=\"${\n                productData.images.icon\n            }\" alt=\"${name}\" width=\"40\" class=\"recipe-ingredients__product-img\">\n          </td>\n          <td class=\"t-xs-500 recipe-ingredients__table-column\">${name}</td>\n          <td class=\"t-xs-500 recipe-ingredients__table-column\">${priceHtml} ${this.renderAddToCart(\n                    productSku,\n                    productLongSku,\n                    productRange,\n                    productStock\n                )}</td>\n        </tr>`\n            } catch (error) {\n                console.error(`Error retrieving product data for SKU ${product}:`, error)\n\n                return `<tr class=\"recipe-ingredients__table-row\">\n                            <td class=\"t-xs-500 recipe-ingredients__table-column\" colspan=\"3\">\n                                Error retrieving product data for SKU ${product}\n                            </td>\n                        </tr>`\n            }\n        } else {\n            return `<tr class=\"recipe-ingredients__table-row\">\n          <td class=\"t-xs-500-sl recipe-ingredients__table-column\">\n            ${this.renderVisual(visual)}\n            ${proportion && `<em class=\"recipe-ingredients__proportion\">${proportion}</em>`}\n          </td>\n          <td class=\"t-xs-500 recipe-ingredients__table-column\">${label}</td>\n        </tr>`\n        }\n    }\n\n    renderInstructions() {\n        const { instructions: { heading = '', steps = [] } = {} } = this.props\n\n        return `<section class=\"recipe-instructions\" aria-label=\"${heading}\">\n                    <h3 class=\"h-xl-700\">${heading}</h3>\n                    <ol class=\"recipe-steps\">\n                        ${this.renderSteps(steps, this.renderStep.bind(this))}\n                    </ol>\n                </section>`\n    }\n\n    renderSteps(steps, renderCallback) {\n        return steps.reduce((output, step, index) => `${output}${renderCallback(step, index)}`, '')\n    }\n\n    renderStep(step, index) {\n        const { heading = '' } = step\n        const headingHtml = heading\n            ? `<h4 class=\"t-sm-700 recipe-steps__heading\">${heading}</h4>`\n            : ''\n\n        return `<li class=\"recipe-steps__item\">\n            <div class=\"recipe-steps__counter t-sm-700\">${\n                index < 10 ? '0' + (index + 1) : index\n            }</div>\n            <span class=\"recipe-steps__content t-sm-400\">\n                ${headingHtml}\n                ${step.text}\n            </span>\n          </li>`\n    }\n}\n\ncustomElements.get('nb-modal-recipe-variant') ||\n    customElements.define('nb-modal-recipe-variant', ModalRecipeVariant)\n\nexport default ModalRecipeVariant\n","import createProps from '@kissui/helpers/src/props.helpers'\nimport createRefs from '@kissui/helpers/src/refs.helpers'\nimport eventsHelper from '@kissui/helpers/src/events.helpers'\nimport viewportHelper from '@kissui/helpers/src/viewport.helpers'\nimport { handlePromoClick } from '@kissui/helpers/src/gtmEvents'\n\nimport { dispatchEvent } from '@kissui/helpers/src/assets/js/eventDispatch'\nimport { EVENT_POPIN_OPEN, EVENT_POPIN_CLOSE } from '@kissui/components'\nimport { debounce, stringifyForAttribute, stripHTML } from '@kissui/helpers/src/utils'\n\nimport './subcomponents/modal-recipe'\nimport '../recipes-variant/subcomponents/modal-recipe-variant'\n\nclass Recipes extends HTMLElement {\n    connectedCallback() {\n        this.props = createProps(this.attributes)\n        this.isSingle = this.props.copywriting.recipes.length === 1\n        this.popinId = ''\n\n        this.render()\n        this.refs = createRefs(this)\n\n        this.eventListeners = this.createEventListeners()\n        eventsHelper.add(this.eventListeners)\n\n        this.watchAndClosePopin()\n    }\n\n    render() {\n        const { campaign, layout } = this.props\n        const { background_color, padding_top, padding_bottom } = layout\n        if (this.isSingle) {\n            this.classList.add('isSingle')\n        }\n\n        this.innerHTML = `<nb-container\n                            background_color='${background_color}'\n                            contrast=\"light\"\n                            campaign_id=\"${campaign.id}\"\n                            campaign_name=\"${campaign.name}\"\n                            campaign_creative=\"${campaign.creative}\"\n                            campaign_position=\"${campaign.position}\"\n                            classname=\"${padding_top} ${padding_bottom}\">\n                            <div class=\"cb-col1\">\n                                ${this.renderHeading()}\n                                ${this.renderDescription()}\n                            </div>\n                            <div class=\"cb-col2\">\n                                ${this.renderPattern()}\n                                ${this.renderRecipes()}\n                            </div>\n                            ${this.renderModals()}\n                        </nb-container>`\n    }\n\n    watchAndClosePopin() {\n        if (!this.popinId) {\n            return\n        }\n\n        window.addEventListener(\n            'resize',\n            debounce(() => {\n                dispatchEvent({\n                    element: this,\n                    eventName: EVENT_POPIN_CLOSE,\n                    args: { id: this.popinId }\n                })\n            })\n        )\n    }\n\n    renderHeading() {\n        const { heading = '' } = this.props.copywriting\n        return heading && `<h2 class=\"h-2xl-300\">${heading}</h2>`\n    }\n\n    renderDescription() {\n        const { description = '' } = this.props.copywriting\n        return description && `<div class=\"wysiwyg t-sm-400\">${description}</div>`\n    }\n\n    renderPattern() {\n        const { background: { desktop } = {} } = this.props.layout\n        return (\n            desktop &&\n            `<img class=\"pattern\" src=\"${desktop}\" alt=\"\" aria-hidden=\"true\" loading=\"lazy\" />`\n        )\n    }\n\n    renderRecipes() {\n        const { recipes = [] } = this.props.copywriting\n        const slider = recipes.length > (viewportHelper.is.mobile ? 1 : 2)\n        const wrapper = slider ? 'Slider' : 'List'\n        const list = recipes.reduce(\n            (output, recipe, index) => `${output}${this.renderCard(recipe, index)}`,\n            ''\n        )\n        return this[`render${wrapper}`](list)\n    }\n\n    renderCard({ card }, index) {\n        const {\n            a11y_recipe = '',\n            a11y_time = '',\n            a11y_difficulty = '',\n            a11y_open_modal = ''\n        } = this.props.options\n        const single = this.isSingle ? 'true' : 'false'\n        const data = JSON.stringify({\n            ...card,\n            single,\n            a11y_recipe,\n            a11y_time,\n            a11y_difficulty,\n            a11y_open_modal\n        })\n        return `<nb-card-recipe data='${data}' data-ref=\"cards[${index}]\" data-trackRecipeName=\"${card.heading}\"></nb-card-recipe>`\n    }\n\n    renderSlider(cards) {\n        const { recipes = [] } = this.props.copywriting\n        return `<nb-slider\n                navigation=\"${!viewportHelper.is.mobile}\"\n                pagination=\"${recipes.length > 3}\"\n                slides_loop=\"false\"\n                slides_visible=\"${viewportHelper.is.mobile ? 1 : 2}\"\n                space_between=\"${viewportHelper.is.mobile || viewportHelper.is.tablet ? 16 : 40}\">\n                  ${cards}\n                </nb-slider>`\n    }\n\n    renderList(card) {\n        return `<div class=\"list\">${card}</div>`\n    }\n\n    renderModals() {\n        const { recipes = [] } = this.props.copywriting\n        return recipes.reduce(\n            (output, recipe, index) => `${output}${this.renderModal(recipe, index)}`,\n            ''\n        )\n    }\n\n    renderModal({ modal }, index) {\n        const { a11y_time = '', a11y_difficulty = '' } = this.props.options\n        const data = stringifyForAttribute({\n            ...modal,\n            options: { a11y_time, a11y_difficulty }\n        })\n        const popinId = this.createPopinID(index)\n        return `<nb-popin variation=\"before\" bgcolor=\"highlight\" size=\"XL\" id=\"${popinId}\">\n                    <nb-modal-recipe data='${data}' popin_id=\"${popinId}\"></nb-modal-recipe>\n                </nb-popin>`\n    }\n\n    createPopinID(index) {\n        const { recipes = [], heading = '' } = this.props.copywriting\n        const stripedHeading = stripHTML(recipes[index]?.card?.heading ?? heading).substring(0, 10)\n        return `modal-recipe-${stripedHeading}-${index}`\n    }\n\n    createEventListeners() {\n        return this.refs.cards.map((card, index) => ({\n            element: card,\n            type: 'click',\n            listener: this.openPopin.bind(this, index)\n        }))\n    }\n\n    openPopin(index) {\n        this.popinId = this.createPopinID(index)\n\n        dispatchEvent({\n            element: this,\n            eventName: EVENT_POPIN_OPEN,\n            args: { id: this.popinId }\n        })\n\n        this.trackRecipeEvents(\n            EVENT_POPIN_OPEN,\n            this.querySelectorAll('[data-trackRecipeName]')[index].getAttribute(\n                'data-trackRecipeName'\n            ),\n            index\n        )\n    }\n\n    trackRecipeEvents(trackEvent, trackLabel, cardIndex) {\n        if (trackEvent === EVENT_POPIN_OPEN) {\n            const { campaign } = this.props\n            handlePromoClick({ campaign, cta_name: `POPIN - ${cardIndex} - ${trackLabel}` })\n        }\n    }\n\n    disconnectedCallback() {\n        eventsHelper.remove(this.events)\n    }\n}\n\ncustomElements.get('nb-recipes') || customElements.define('nb-recipes', Recipes)\n\nexport default Recipes\n"],"names":["createProps","attributes","data","find","attribute","nodeName","getData","props","filter","reduce","all","attr","nodeValue","isNil","JSON","parse","error","console","log","obj","createRefs","component","querySelectorAll","extract","refs","$ref","ref","dataset","refArray","match","getRefArray","name","index","undefined","emitCustomEvent","eventName","customEvent","CustomEvent","detail","bubbles","cancelable","composed","window","dispatchEvent","eventsHelper","add","eventListeners","forEach","eventListener","element","addEventListener","type","listener","options","remove","removeEventListener","BREAKPOINT_TABLET","EVENT_POPIN_OPEN","helper","is","innerWidth","vw","devicePixelRatio","mobile","mobile_tablet","tablet","desktop","retina","lt","getFormattedPrice","async","price","priceFormatter","napi","priceFormat","getPriceFormatter","currency","config","padl","namespace","dataLayer","app","html","short","removeEmptyValues","findText","key","value","text","includes","escapeHtml","map","replace","m","DOMParser","selectPromotion","args","event","eventData","cta_name","event_raised_by","ecommerce","Object","keys","length","id","creative","position","ecommerceData","promotion_id","promotion_name","creative_slot","creative_name","gtmDataObject","push","Error","Event","document","createEvent","initEvent","devices","getResponsiveSrc","src","device","sources","Array","isArray","viewportHelper","getDevice","Subcomponent","constructor","_props","this","elementId","render","bindEvents","subcomponents","notification","label","renderIcon","renderLabel","icon","BaseModalRecipe","HTMLElement","connectedCallback","popin_id","popinId","videoPopinId","videoPlayerId","isPlaying","hasMedia","cover","createEventListeners","eventsHelpers","openPlayer","bind","video","video_id","video_service","renderHeader","header","heading","subheading","renderNotifications","renderMetas","metas","entries","renderMeta","time","difficulty","a11y_time","a11y_difficulty","a11y_label","disclaimer","SubcomponentNotification","renderLink","link","target","renderVisual","visual","alt","responsiveSrc","visualHelper","renderCover","video_mobile","renderPlayer","togglePlayPause","classList","closest","disconnectedCallback","customElements","get","define","innerHTML","renderRequirements","renderInstructions","requirements","ingredients","materials","renderList","list","items","renderListItems","output","item","renderListItem","proportion","instructions","steps","renderSteps","renderStep","renderCallback","step","substeps","renderSubStep","subStep","renderedRequirements","renderedInstructions","renderedLink","renderedPlayer","updateInnerHTML","renderAddToCart","sku","longSku","range","stock","promises","Promise","join","product","productData","catalog","getProduct","trimSku","internationalId","inStock","productSku","productLongSku","productRange","productStock","formattedPrice","priceHtml","images","Recipes","isSingle","copywriting","recipes","watchAndClosePopin","campaign","layout","background_color","padding_top","padding_bottom","renderHeading","renderDescription","renderPattern","renderRecipes","renderModals","debounce","func","timer","clearTimeout","setTimeout","description","background","wrapper","recipe","renderCard","card","a11y_recipe","a11y_open_modal","single","stringify","renderSlider","cards","renderModal","modal","stringifyForAttribute","createPopinID","str","tmp","implementation","createHTMLDocument","body","textContent","RegExp","stripHTML","substring","openPopin","trackRecipeEvents","getAttribute","trackEvent","trackLabel","cardIndex","cleanedData","handlePromoClick","events"],"mappings":"AAAA,MAEMA,EAAcC,IACVC,MAAAA,EAHMD,CAAAA,GAAcA,EAAWE,MAAKC,GAAoC,SAAvBA,EAAUC,WAGpDC,CAAQ,IAAIL,IACnBM,EAAQ,IAAIN,GACbO,QAAOJ,GAAoC,SAAvBA,EAAUC,WAC9BI,QAAO,CAACC,EAAKC,KACH,IAAKD,EAAK,CAACC,EAAKN,UAAWM,EAAKC,aACxC,CAAE,GAET,GAAIC,EAAMX,GACCK,OAAAA,EAGP,IACO,MAAA,IAAKA,KAAUO,KAAKC,MAAMb,EAAKU,WACzC,OAAQI,GACLC,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