{"version":3,"sources":["webpack:///./cartridges/app_storefront_widgets/cartridge/client/default/js/widgets/product/AddToCartMixin.js","webpack:///./cartridges/app_storefront_widgets/cartridge/client/default/js/widgets/product/ColorSwatch.js","webpack:///./cartridges/app_storefront_widgets/cartridge/client/default/js/widgets/product/ProductDetail.js","webpack:///./cartridges/app_storefront_widgets/cartridge/client/default/js/widgets/product/ProductImages.js"],"names":["ProductDetail","AddToCartMixin","prefs","pid","textNetworkError","addToCartBtn","classesBusy","showMinicartOnProductAdd","showMessageOnProductAdd","showAlertOnProductAdd","zeroWidthSpaceSymbol","init","readyToOrder","has","element","stock","data","selectedQuantity","spacesLength","showCartMessage","msg","error","getById","addToCartMsg","concat","Array","join","render","ref","then","show","postAddProduct","response","cart","emit","cartModel","showMinicart","eventBus","accessibilityAlert","accessibilityAlerts","addedtocart","message","addToCart","button","addToCartBtnPrefs","textSelectOptions","textStockLimit","startProcess","showProgressBar","submitFormJson","addToCartUrl","currentProductID","quantity","finally","stopProcess","hideProgressBar","catch","addClass","removeClass","updateProductView","product","renderAddToCart","available","availability","isOutOfStock","setText","outOfStockLabel","disable","isReachedLimit","messages","update","enable","Widget","ColorSwatch","selectColor","option","selectedOption","getSelectedOptions","RefElement","disableHistory","descriptions","updateLabel","updateProduct","updateBtn","attr","uuid","afterUpdateProduct","bind","id","currentGtmInfo","gtmInfo","setGtmInfo","hide","renderVariationAttributes","renderQuantities","renderPrice","renderAvailability","renderImages","renderName","renderPromotions","renderProductDescriptions","updateSocialLinks","updateViewFullProductURL","selectedProductUrl","el","variationAttributes","length","forEach","variationAttribute","values","map","value","selected","disabled","selectable","attributeId","attribute","onProductLinkClick","link","quantities","qty","url","productName","promotions","price","html","priceBlock","undefined","availabilityClass","productAvailabilityMsg","class","inStockMsg","availabilityLabel","productImages","socialLinks","Object","keys","socialKey","changeAttribute","selectWidget","changeAttributeID","afterChangeAttribute","e","showErrorLayout","updateHistoryState","triggerChangeAttributeEvent","indexOf","quantitychanged","variationselected","window","history","replaceState","keyCode","freeze","SPACE","ENTER","IMAGE_MODE_CAROUSEL","IMAGE_MODE_ZOOM","AccessibilityFocusTrapMixin","ProductImages","thumbnailsPerFrame","thumbnailsZoomClass","zoomLoop","zoomClickToCloseNonZoomable","zoomCloseElClasses","classesGlobalDialog","closeOnScroll","predefinedHeight","predefinedWidth","showHideOpacity","onDestroy","gallery","destroy","images","large","zoomImage","zoomImages","zoom","index","zoomUrl","onImageCarouselPageChanged","page","carousel","imageMode","markCurrentPage","scrollIntoView","onThumbnailCarouselPageClicked","scrollToPage","goTo","getOriginalImageSize","Promise","resolve","imgCarousel","predefinedSize","originalHeight","originalWidth","carouselImages","getImages","firstImage","dataset","originalSrc","img","Image","addEventListener","height","width","src","addFocusTrap","backFocusElement","document","activeElement","addFocusTraps","afterShowModal","initAndShowZoom","PhotoSwipe","PhotoSwipeUI","pswpElement","querySelectorAll","thumbnailsCarousel","thumbnails","HTMLElement","setAttribute","items","from","w","naturalWidth","h","naturalHeight","options","getCurrentPageIndex","loop","clickToCloseNonZoomable","closeElClasses","split","listen","onZoomClosed","currentPage","getCurrentIndex","toggleZoomState","addGlobalDialogClass","loadPhotoswipeDependencies","all","onImageCarouselPageClicked","openZoom","originalImageSize","default","closeZoom","close","removeAttribute","closeZoomKeydown","_","event","stopPropagation","preventDefault","removeGlobalDialogClass","focus","hasClass","handleKeydown","_el","target"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;AAEA;AACA;;;;AAIA;;;;;;;AAMe,yEAAUA,aAAV,EAAyB;AACpC;;;;;;;;;;AAUA,QAAMC,cAAN,SAA6BD,aAA7B,CAA2C;AACvCE,SAAK,GAAG;AACJ,aAAO;AACHC,WAAG,EAAE,EADF;AAEHC,wBAAgB,EAAE,eAFf;AAGHC,oBAAY,EAAE,WAHX;AAIHC,mBAAW,EAAE,QAJV;AAKHC,gCAAwB,EAAE,KALvB;AAMHC,+BAAuB,EAAE,IANtB;AAOHC,6BAAqB,EAAE,IAPpB;AAQHC,4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P;AACH,C","file":"product.widgets.bundle.js","sourcesContent":["// TODO: freeze loaded sections during update with aria-busy\n// TODO: investigate proper implementation of aria-live region for updated sections\n// TODO: keep track that focus stays on the same place during PLP update\n\nimport { submitFormJson } from 'widgets/toolbox/ajax';\n/**\n * @typedef {ReturnType<typeof import('widgets/product/ProductDetail').default>} ProductDetail\n */\n\n/**\n * @description Base AddToCartMixin implementation\n * <br>This class is not intended to have a separate DOM representation.\n * @param {ProductDetail} ProductDetail Base widget for extending\n * @returns {typeof AddToCartMixin} Add to Cart mixin class\n */\nexport default function (ProductDetail) {\n    /**\n     * @class AddToCartMixin\n     * @augments ProductDetail\n     * @property {string} data-text-network-error - network error text\n     * @property {string} data-add-to-cart-label - add to cart label\n     * @property {string} data-pid - product id\n     * @property {boolean} data-show-minicart-on-product-add - Show minicart on product added to cart\n     * @property {boolean} data-show-message-on-product-add - Show message on poroduct added to cart\n     * @property {boolean} data-show-alert-on-product-add - Show Global Alert on product added to cart\n     */\n    class AddToCartMixin extends ProductDetail {\n        prefs() {\n            return {\n                pid: '',\n                textNetworkError: 'Network Error',\n                addToCartBtn: 'addToCart',\n                classesBusy: 'm-busy',\n                showMinicartOnProductAdd: false,\n                showMessageOnProductAdd: true,\n                showAlertOnProductAdd: true,\n                zeroWidthSpaceSymbol: '\\u200B',\n                ...super.prefs()\n            };\n        }\n\n        init() {\n            super.init();\n            this.readyToOrder = this.prefs().readyToOrder;\n            this.has(this.prefs().addToCartBtn, (element) => {\n                const stock = element.data('stock');\n                if (stock) {\n                    this.stock = stock;\n                }\n            });\n            this.selectedQuantity = this.prefs().selectedQuantity;\n            this.spacesLength = 0;\n        }\n\n        /**\n         * @description Show message\n         * @param {string} msg Message\n         * @param {boolean} error Error flag\n         */\n        showCartMessage(msg, error = false) {\n            this.getById(this.prefs().addToCartMsg, (addToCartMsg) => {\n                if (typeof this.spacesLength === 'undefined') {\n                    this.spacesLength = 0;\n                }\n                // It's needed to force render previously added success message. If we try to add the same product\n                // several times, success message alert will not be announced by a screen reader.\n                msg = msg.concat(Array(++this.spacesLength).join(this.prefs().zeroWidthSpaceSymbol));\n\n                addToCartMsg.render('template', { msg, error }, addToCartMsg.ref('container')).then(() => addToCartMsg.show());\n            });\n        }\n\n        /**\n         * @description Handles response from server once product added to cart\n         * @emits \"product.added.to.cart\"\n         * @param {any} response Add Product response\n         */\n        postAddProduct(response) {\n            if (!response.error && response.cart) {\n                this.emit('productadded');\n                const cartModel = response.cart;\n                cartModel.showMinicart = this.prefs().showMinicartOnProductAdd;\n                this.eventBus().emit('product.added.to.cart', cartModel, this);\n\n                if (this.prefs().showAlertOnProductAdd) {\n                    const accessibilityAlert = this.prefs().accessibilityAlerts.addedtocart;\n                    this.eventBus().emit('alert.show', {\n                        accessibilityAlert\n                    });\n                }\n            }\n\n            if (response.error || this.prefs().showMessageOnProductAdd) {\n                this.eventBus().emit('product.addedTocart.with.error', response);\n                this.showCartMessage(response.message, response.error);\n            }\n        }\n\n        addToCart(button) {\n            const addToCartBtnPrefs = button.prefs();\n\n            if (addToCartBtnPrefs.readyToOrder) {\n                this.readyToOrder = addToCartBtnPrefs.readyToOrder;\n            }\n\n            if (!this.readyToOrder) {\n                this.showCartMessage(this.prefs().textSelectOptions, true);\n\n                return;\n            }\n\n            if (this.stock && this.stock < this.selectedQuantity) {\n                this.showCartMessage(this.prefs().textStockLimit, true);\n\n                return;\n            }\n\n            button.startProcess();\n\n            this.showProgressBar();\n\n            submitFormJson(addToCartBtnPrefs.addToCartUrl, {\n                pid: this.currentProductID || addToCartBtnPrefs.pid,\n                quantity: this.selectedQuantity || addToCartBtnPrefs.selectedQuantity\n            }).then(response => this.postAddProduct(response))\n                .finally(() => {\n                    button.stopProcess();\n\n                    this.hideProgressBar();\n                }).catch(() => {\n                    this.showCartMessage(this.prefs().textNetworkError, true);\n                });\n        }\n\n        showProgressBar() {\n            this.ref('self').addClass(this.prefs().classesBusy);\n        }\n\n        hideProgressBar() {\n            this.ref('self').removeClass(this.prefs().classesBusy);\n        }\n\n        /**\n         * @description Update Product View\n         * @param {any} product productModel\n         */\n        updateProductView(product) {\n            super.updateProductView(product);\n            this.renderAddToCart(product);\n        }\n\n        renderAddToCart(product) {\n            this.getById('addToCart', (addToCartBtn) => {\n                if (!product.available && product.availability.isOutOfStock) {\n                    addToCartBtn.setText(this.prefs().outOfStockLabel);\n                    addToCartBtn.disable();\n                } else if (product.availability.isReachedLimit) {\n                    this.getById(this.prefs().addToCartMsg, (addToCartMsg) => {\n                        const msg = product.availability.messages[0];\n                        const error = true;\n                        addToCartMsg.render(\n                            'template',\n                            { msg, error },\n                            addToCartMsg.ref('container')\n                        ).then(() => addToCartMsg.show());\n                    });\n                    addToCartBtn.setText(this.prefs()[this.prefs().update ? 'updateLabel' : 'addToCartLabel']);\n                    addToCartBtn.disable();\n                } else {\n                    addToCartBtn.setText(this.prefs()[this.prefs().update ? 'updateLabel' : 'addToCartLabel']);\n                    addToCartBtn.enable();\n                }\n            });\n        }\n    }\n\n    return AddToCartMixin;\n}\n","// TODO: JSDoc for all methods\n// TODO: should be implemented as https://www.w3.org/TR/wai-aria-practices/#Listbox\n// single select controls group (single tab stop element) with activation on click/space/enter\nimport { RefElement } from 'widgets/toolbox/RefElement';\n/**\n * @typedef {typeof import('widgets/Widget').default} Widget\n */\n\n/**\n * @description Base ColorSwatch implementation\n * @param {Widget} Widget Base widget for extending\n * @returns {typeof ColorSwatch} Color Swatch class\n */\nexport default function (Widget) {\n    /**\n     * @class ColorSwatch\n     * @augments Widget\n     */\n    class ColorSwatch extends Widget {\n        selectColor(option) {\n            this.selectedOption = option;\n            this.emit('change', this);\n        }\n\n        getSelectedOptions() {\n            if (this.selectedOption) {\n                return this.selectedOption;\n            }\n            return new RefElement([]);\n        }\n    }\n\n    return ColorSwatch;\n}\n","// TODO: JSDoc for all methods\n// TODO: freeze loaded sections during update with aria-busy\n// TODO: investigate proper implementation of aria-live region for updated sections\n// TODO: keep track that focus stays on the same place during PLP update\n\nimport { submitFormJson } from 'widgets/toolbox/ajax';\nimport { showErrorLayout } from 'widgets/toolbox/util';\n\n/**\n * @typedef {InstanceType<typeof import('widgets/toolbox/RefElement').RefElement>} refElement\n * @typedef {InstanceType<ReturnType<typeof import('widgets/forms/InputSelect').default>>} inputSelect\n */\n\n/**\n * @description Base ProductDetail implementation\n * @param {typeof import('widgets/Widget').default} Widget Base widget for extending\n * @returns {typeof ProductDetail} Product Detail class\n */\nexport default function (Widget) {\n    /**\n     * @class ProductDetail\n     * @augments Widget\n     * @classdesc Represents ProductDetail component with next features:\n     * 1. Support keyboard navigation for accessibility\n     * 2. Rerender PDP and Quick View\n     * 3. Handle product attributes change\n     * 4. Handle add to cart event\n     * @property {boolean} [data-ready-to-order=false] - ready to order flag\n     * @property {string} data-text-select-options - select option text\n     * @property {string} data-text-stock-limit - stock limit text\n     * @property {string} data-out-of-stock-label - out of stock label\n     * @property {number} data-selected-quantity - selected quantity\n     * @category widgets\n     * @subcategory product\n     * @example\n     * cartridges/app_storefront_widgets/cartridge/templates/default/product/productDetails.isml\n     *\n     * <main\n     *     role=\"main\"\n     *     class=\"l-pdp-main\"\n     *     data-widget=\"productDetail\"\n     *     data-ready-to-order=\"${product.readyToOrder}\"\n     *     data-text-network-error=\"${Resource.msg('error.alert.network', 'product', null)}\"\n     *     data-text-select-options=\"${Resource.msg('error.alert.select.options', 'product', null)}\"\n     *     data-text-stock-limit=\"${Resource.msg('error.alert.stock.limit', 'product', null)}\"\n     *     data-out-of-stock-label=\"${Resource.msg('label.outofstock', 'common', null)}\"\n     *     data-add-to-cart-label=\"${Resource.msg('button.addtocart', 'common', null)}\"\n     *     data-selected-quantity=\"${product.selectedQuantity}\"\n     *     data-analytics=\"${JSON.stringify(product.gtmInfo)}\"\n     *     data-pid=\"${product.id}\"\n     *     data-tau-product-id=\"${product.id}\"\n     *     data-add-to-wishlist-hide-texts=\"false\"\n     *     data-show-minicart-on-product-add.md.lg.xl=\"true\"\n     *     data-show-message-on-product-add=\"true\"\n     *     data-text-added-to-wishlist=\"${Resource.msg('button.added.to.wishlist', 'wishlist', null)}\"\n     *     data-accessibility-alerts='{\n     *         \"quantitychanged\": \"${Resource.msg('alert.quantitychanged', 'product', null)}\",\n     *         \"variationselected\": \"${Resource.msg('alert.variationselected', 'product', null)}\",\n     *         \"addedtocart\": \"${Resource.msg('alert.addedtocart', 'product', null)}\",\n     *         \"addedtowishlist\": \"${Resource.msg('alert.addedtowishlist', 'product', null)}\"\n     *     }'\n     * >\n     *     PDP content\n     * </main>\n     */\n    class ProductDetail extends Widget {\n        prefs() {\n            return {\n                addToCartMsg: 'addToCartMsg',\n                disableHistory: false,\n                descriptions: 'descriptions',\n                readyToOrder: false,\n                selectedQuantity: 0,\n                textSelectOptions: '',\n                textStockLimit: '',\n                outOfStockLabel: '',\n                updateLabel: '',\n                update: false,\n                accessibilityAlerts: {},\n                ...super.prefs()\n            };\n        }\n\n        /**\n         * @description updateProduct handler\n         * @param {object} updateBtn Response object\n         * @returns {void}\n         */\n        updateProduct(updateBtn) {\n            submitFormJson(\n                updateBtn.ref('self').attr('data-update-url'),\n                {\n                    pid: this.currentProductID || updateBtn.prefs().pid,\n                    quantity: this.selectedQuantity || updateBtn.ref('self').attr('data-selected-quantity') || 1,\n                    uuid: updateBtn.ref('self').attr('data-uuid')\n                }\n            ).then(this.afterUpdateProduct.bind(this))\n                .finally(() => {\n                    this.emit('updated');\n                });\n        }\n\n        /**\n         * @description afterUpdateProduct handler\n         * @param {object} response Response object\n         * @emits \"product.updated\"\n         * @returns {void}\n         */\n        afterUpdateProduct(response) {\n            /**\n             * @description Event to notify concerned widgets, that product was updated\n             * @event \"product.updated\"\n             */\n            this.eventBus().emit('product.updated', response);\n        }\n\n        /**\n         * @description Update Product View\n         * @param {any} product productModel\n         * @returns {void}\n         */\n        updateProductView(product) {\n            this.currentProductID = product.id;\n            this.currentGtmInfo = product.gtmInfo;\n            this.selectedQuantity = product.selectedQuantity;\n            this.uuid = product.uuid;\n            this.readyToOrder = product.readyToOrder;\n            this.stock = product.availability && product.availability.stock ? product.availability.stock : null;\n\n            this.setGtmInfo(product);\n\n            this.getById(this.prefs().addToCartMsg, (addToCartMsg) => {\n                addToCartMsg.hide();\n            });\n            this.renderVariationAttributes(product);\n            this.renderQuantities(product);\n            this.renderPrice(product);\n            this.renderAvailability(product);\n            this.renderImages(product);\n            this.renderName(product);\n            this.renderPromotions(product);\n            this.renderProductDescriptions(product);\n            this.updateSocialLinks(product);\n            this.updateViewFullProductURL(product);\n        }\n\n        /**\n         * @description Render product view full product url\n         * @param {object} product Product object\n         * @returns {void}\n         */\n        updateViewFullProductURL(product) {\n            if (product.selectedProductUrl) {\n                this.has('viewFullProductURL', (el) => {\n                    el.attr('href', product.selectedProductUrl);\n                });\n            }\n        }\n\n        /**\n         * @description Set GTM info\n         * @param {object} product Product object\n         * @returns {void}\n         */\n        setGtmInfo(product) {\n            this.currentGtmInfo = product.gtmInfo;\n\n            if (this.currentGtmInfo && product.selectedQuantity) {\n                this.currentGtmInfo.quantity = product.selectedQuantity;\n            }\n        }\n\n        /**\n         * @description Render product attributes\n         * @param {object} product Product object\n         * @returns {void}\n         */\n        renderVariationAttributes(product) {\n            if (product.variationAttributes && product.variationAttributes.length) {\n                product.variationAttributes.forEach(variationAttribute => {\n                    variationAttribute.values = variationAttribute.values.map(value => {\n                        return {\n                            ...value,\n                            selected: value.selected,\n                            disabled: !value.selectable,\n                            selectable: value.selectable ? 'selectable' : ''\n                        };\n                    });\n                    this.getById('attr-' + variationAttribute.attributeId, (attribute) => {\n                        attribute.render('template', {\n                            attr: variationAttribute\n                        });\n                    });\n                });\n            }\n        }\n\n        /**\n         * @description Executes when user clicks on product details link.\n         * Usually used by analytics etc.\n         * @emits \"detail.product.link.click\"\n         * @param {refElement} link - clicked product tile link\n         * @returns {void}\n         */\n        onProductLinkClick(link) {\n            this.eventBus().emit('detail.product.link.click', link);\n        }\n\n        /**\n         * @description Render product quantity\n         * @param {object} product Product object\n         * @returns {void}\n         */\n        renderQuantities(product) {\n            if (product.quantities) {\n                this.getById('quantity-1', (quantity) => {\n                    quantity.render('template', {\n                        attr: {\n                            values: product.quantities.map(qty => {\n                                return {\n                                    selected: qty.selected ? 'selected' : '',\n                                    url: qty.url,\n                                    value: qty.value\n                                };\n                            })\n                        },\n                        isOutOfStock: product.availability && product.availability.isOutOfStock\n                    });\n                });\n            }\n        }\n\n        /**\n         * @description Render product name\n         * @param {object} product Product object\n         * @returns {void}\n         */\n        renderName(product) {\n            if (product.productName) {\n                this.ref('name').setText(product.productName);\n            }\n        }\n\n        /**\n         * @description Render product promotion\n         * @param {object} product Product object\n         * @returns {void}\n         */\n        renderPromotions(product) {\n            this.getById('promotions', (promotions) => {\n                promotions.render('template', {\n                    promotions: product.promotions || []\n                }, promotions.ref('container'));\n            });\n        }\n\n        /**\n         * @description Render product price\n         * @param {object} product Product object\n         * @returns {void}\n         */\n        renderPrice(product) {\n            if (product.price && product.price.html) {\n                this.getById('priceBlock', (priceBlock) => {\n                    priceBlock.render('template', [], undefined, product.price.html);\n                });\n            }\n        }\n\n        /**\n         * @description Render product availability\n         * @param {object} product Product object\n         * @returns {void}\n         */\n        renderAvailability(product) {\n            let message = '';\n            let availabilityClass = '';\n            const productAvailabilityMsg = this.ref('productAvailabilityMsg');\n\n            if (product.availability && product.availability.messages && product.readyToOrder) {\n                message = product.availability.messages.join('');\n                availabilityClass = product.availability.class;\n            }\n\n            if (product.availability.isReachedLimit) {\n                message = product.availability.inStockMsg.join('');\n            }\n\n            if (productAvailabilityMsg) {\n                productAvailabilityMsg.hide();\n            }\n\n            this.getById('availability', (availabilityLabel) => {\n                availabilityLabel.render('template', {\n                    message: message,\n                    class: availabilityClass\n                }, availabilityLabel.ref('container'));\n            });\n        }\n\n        /**\n         * @description Render product images\n         * @param {object} product Product object\n         * @returns {void}\n         */\n        renderImages(product) {\n            this.getById('productImages', (productImages) => {\n                productImages.renderImages(product);\n            });\n        }\n\n        /**\n         * @description Render product description\n         * @param {object} product Product object\n         * @returns {void}\n         */\n        renderProductDescriptions(product) {\n            this.getById(this.prefs().descriptions, element => {\n                element.render('template', product, element.ref('container')).then(() => element.init());\n            });\n        }\n\n        /**\n         * @description Update social links\n         * @param {object} product Product object\n         * @returns {void}\n         */\n        updateSocialLinks(product) {\n            if (product.socialLinks !== undefined) {\n                Object.keys(product.socialLinks).forEach((socialKey) => {\n                    this.has('social-link-' + socialKey, link => {\n                        link.attr('href', product.socialLinks[socialKey]);\n                    });\n                });\n            }\n        }\n\n        /**\n         * @description widget triggered event\n         * Saves `selectWidget.id` into a property for further global notifications etc.\n         * Later, when triggering event, `selectWidget.id` will be analised in order to send with event correct data.\n         * @param {inputSelect} selectWidget widget\n         * @returns {void}\n         */\n        changeAttribute(selectWidget) {\n            this.changeAttributeID = selectWidget.id;\n            const selected = selectWidget.getSelectedOptions();\n\n            if (!selected || selected.data('attrIsSelected')) {\n                return;\n            }\n\n            if (selected) {\n                submitFormJson(selected.data('attrUrl'), undefined, 'GET', true)\n                    .then(this.afterChangeAttribute.bind(this))\n                    .catch(e => {\n                        showErrorLayout(e);\n                    });\n            }\n        }\n\n        /**\n         * @description After change attrigute handler\n         * @param {object} response response object\n         * @returns {void}\n         */\n        afterChangeAttribute(response) {\n            if (response && response.product) {\n                if (!this.prefs().disableHistory) {\n                    this.updateHistoryState(response.product);\n                }\n\n                this.updateProductView(response.product);\n                this.triggerChangeAttributeEvent();\n            }\n        }\n\n        /**\n         * @description Triggers global event after `afterChangeAttribute` method executed.\n         * Puts localised global alert event description\n         * @returns {void}\n         */\n        triggerChangeAttributeEvent() {\n            if (!this.changeAttributeID) {\n                return;\n            }\n\n            let accessibilityAlert = '';\n            if (this.changeAttributeID.indexOf('quantity-') === 0) {\n                accessibilityAlert = this.prefs().accessibilityAlerts.quantitychanged;\n            } else if (this.changeAttributeID.indexOf('attr-') === 0) {\n                accessibilityAlert = this.prefs().accessibilityAlerts.variationselected;\n            }\n            this.eventBus().emit('alert.show', {\n                accessibilityAlert\n            });\n            this.changeAttributeID = undefined;\n        }\n\n        /**\n         * @description Update History State\n         * @param {object} product product object\n         * @returns {void}\n         */\n        updateHistoryState(product) {\n            window.history.replaceState(undefined, '', product.selectedProductUrl);\n        }\n    }\n\n    return ProductDetail;\n}\n","// TODO: JSDoc for all methods\nconst keyCode = Object.freeze({\n    SPACE: 32,\n    ENTER: 13\n});\n\nconst IMAGE_MODE_CAROUSEL = 'carousel';\nconst IMAGE_MODE_ZOOM = 'zoom';\n\n/**\n * @typedef {typeof import('widgets/Widget').default} Widget\n * @typedef {InstanceType<typeof import('widgets/toolbox/RefElement').RefElement>} RefElement\n * @typedef {InstanceType<ReturnType<typeof import('widgets/global/Carousel').default>>} carousel\n * @typedef {{alt: string, url: string, absURL: string, title: string, index: number, zoomUrl: string}} ProductImage\n */\n\n/**\n * @description Base ProductImages implementation\n * @param {ReturnType<typeof import('widgets/global/AccessibilityFocusTrapMixin').default>} AccessibilityFocusTrapMixin mixin\n * @returns {typeof ProductImages} ProductImages class\n */\nexport default function (AccessibilityFocusTrapMixin) {\n    /**\n     * @class ProductImages\n     * @augments AccessibilityFocusTrapMixin\n     * @classdesc Basic ProductImages Widget, manages two images carousels: thumbnails and images.\n     * <br>Renders images from server response and update carousels states accordingly.\n     * <br>Listens to carousel scroll/click events to coordinate consistent work of two carousels.\n     * <br>Serves image `zoom` popup functionality using `photoswipe` as a library\n     * @property {string} data-widget - Widget name `productImages`\n     * @property {string} data-thumbnails-per-frame - Number of thumbnails fully visible per frame\n     * @property {string} data-thumbnails-zoom-class - Class of the thumbnails carousel, when zoom is opened\n     * @property {string} data-zoom-loop - Zoom carousel needs to be looped or not\n     * @property {string} data-zoom-click-to-close-non-zoomable - Close or not zoom popup for not zoomable elements\n     * @property {string} data-zoom-close-el-classes - Closable zoom popup classes. For ex. `item,caption,zoom-wrap,ui,top-bar`\n     * @property {boolean} closeOnScroll - Close gallery on page scroll\n     * @property {boolean} showHideOpacity - Animate background opacity and image scale\n     * @example\n     * // use this code to display widget\n     * <div\n     *     data-widget=\"productImages\"\n     *     data-thumbnails-per-frame=\"4\"\n     * >\n     *     <div\n     *         class=\"b-product_gallery\"\n     *         data-ref=\"carouselInner\"\n     *     >\n     *         <div\n     *             class=\"b-product_gallery-thumbs\"\n     *             data-widget=\"carousel\"\n     *             id=\"imagesThumbnails\"\n     *             ....\n     *             data-widget-event-pageclicked=\"onThumbnailCarouselPageClicked\"\n     *         >...</div>\n     *         <div\n     *             class=\"b-product_gallery-main b-product_slider\"\n     *             data-widget=\"carousel\"\n     *             id=\"imagesCarousel\"\n     *             ....\n     *             data-widget-event-pagechanged=\"onImageCarouselPageChanged\"\n     *         >...</div>\n     *     </div>\n     *     <script type=\"template/mustache\" data-ref=\"galleryTemplate\">\n     *         <div\n     *             class=\"b-product_gallery\"\n     *             data-ref=\"carouselInner\"\n     *         >\n     *             ... mustache carousels templates\n     *         </div>\n     *     </script>\n     * </div>\n     */\n    class ProductImages extends AccessibilityFocusTrapMixin {\n        prefs() {\n            return {\n                thumbnailsPerFrame: 4,\n                thumbnailsZoomClass: 'm-zoomed-in',\n                zoomLoop: false,\n                zoomClickToCloseNonZoomable: false,\n                zoomCloseElClasses: '',\n                classesGlobalDialog: 'm-has_dialog',\n                closeOnScroll: false,\n                predefinedHeight: 1773,\n                predefinedWidth: 1333,\n                showHideOpacity: true,\n                ...super.prefs()\n            };\n        }\n\n        init() {\n            super.init();\n            this.onDestroy(() => {\n                if (this.gallery) {\n                    this.gallery.destroy();\n                    this.gallery = undefined;\n                }\n            });\n        }\n\n        /**\n         * @param {{images: {large: Array<ProductImage>}, zoomImages: {zoom: Array<ProductImage>}}} product - product object\n         */\n        renderImages(product) {\n            if (product.images && product.images.large) {\n                product.images.large.forEach(element => {\n                    const zoomImage = product.zoomImages.zoom && product.zoomImages.zoom[element.index];\n                    element.zoomUrl = zoomImage && zoomImage.url;\n                });\n\n                this.render('galleryTemplate', { images: product.images }, this.ref('carouselInner')).then(() => {\n                    this.update();\n                });\n            }\n        }\n\n        /**\n         * @param {RefElement} el - event source element\n         * @param {number} page - current page number\n         */\n        onImageCarouselPageChanged(el, page) {\n            this.getById('imagesThumbnails', (/** @type {carousel} */ carousel) => {\n                if (this.imageMode !== IMAGE_MODE_ZOOM) {\n                    carousel.markCurrentPage(page).scrollIntoView();\n                }\n            });\n        }\n\n        /**\n         * @param {RefElement} el - event source element\n         * @param {number} page - current page number\n         */\n        onThumbnailCarouselPageClicked(el, page) {\n            this.getById('imagesCarousel', (/** @type {carousel} */ carousel) => carousel.scrollToPage(page));\n\n            if (this.imageMode === IMAGE_MODE_ZOOM && this.gallery) {\n                this.gallery.goTo(page);\n            }\n\n            this.getById('imagesThumbnails', (/** @type {carousel} */ carousel) => {\n                carousel.markCurrentPage(page).scrollIntoView();\n            });\n        }\n\n        update() {\n            this.getById('imagesThumbnails', (/** @type {carousel} */ carousel) => carousel\n                .update()\n                .scrollToPage(0)\n                .markCurrentPage(0));\n\n            this.getById('imagesCarousel', (/** @type {carousel} */ carousel) => carousel\n                .update()\n                .scrollToPage(0));\n        }\n\n        /**\n         * @description Get URL from data-original-src attribute.\n         *  Load original image by URL. Get original size.\n         *  The image element should have data-original-src attribute with original image URL.\n         * @returns {InstanceType <typeof Promise>} - return new Promise\n         */\n        getOriginalImageSize() {\n            return new Promise((resolve) => {\n                const imgCarousel = this.getById('imagesCarousel', (/** @type {carousel} */ carousel) => carousel);\n                const predefinedSize = {\n                    originalHeight: this.prefs().predefinedHeight,\n                    originalWidth: this.prefs().predefinedWidth\n                };\n                if (!imgCarousel) {\n                    resolve(predefinedSize);\n                } else {\n                    const carouselImages = imgCarousel.getImages();\n                    const firstImage = carouselImages && carouselImages[0];\n                    if (firstImage.dataset.originalSrc) {\n                        const img = new Image();\n                        img.addEventListener('load', () => resolve({ originalHeight: img.height, originalWidth: img.width }));\n                        img.addEventListener('error', () => resolve(predefinedSize));\n                        img.src = firstImage.dataset.originalSrc;\n                    } else {\n                        resolve(predefinedSize);\n                    }\n                }\n            });\n        }\n\n        /**\n         * @description Add focus trap functionality in the opened zoom dialog to prevent background elements focusing\n         */\n        addFocusTrap() {\n            this.backFocusElement = /** @type {HTMLElement} */(document.activeElement);\n            this.addFocusTraps();\n            this.afterShowModal();\n        }\n\n        /**\n         * @description Does all the work to init photoswipe and show it\n         * @param {typeof import('photoswipe')} PhotoSwipe - PhotoSwipe library class\n         * @param {typeof import('photoswipe/dist/photoswipe-ui-default')} PhotoSwipeUI - PhotoSwipeUI_Default library class\n         * @param {{originalWidth: string, originalHeight:string}} originalImageSize Object with original image width and height\n         */\n        initAndShowZoom(PhotoSwipe, PhotoSwipeUI, { originalWidth, originalHeight }) {\n            const pswpElement = document.querySelectorAll('.pswp')[0];\n            const imgCarousel = this.getById('imagesCarousel', (/** @type {carousel} */ carousel) => carousel);\n            const thumbnailsCarousel = this.getById('imagesThumbnails', (/** @type {carousel} */ thumbnails) => thumbnails);\n\n            if (!imgCarousel || !(pswpElement instanceof HTMLElement)) {\n                return;\n            }\n\n            const carouselImages = imgCarousel.getImages();\n\n            if (!carouselImages) {\n                return;\n            }\n\n            pswpElement.setAttribute('data-tau', 'zoom_dialog');\n\n            const items = Array.from(carouselImages).map(element => {\n                return {\n                    src: element.dataset.originalSrc,\n                    w: originalWidth || element.naturalWidth,\n                    h: originalHeight || element.naturalHeight\n                };\n            });\n\n            const prefs = this.prefs();\n\n            const options = {\n                index: imgCarousel.getCurrentPageIndex(),\n                loop: prefs.zoomLoop,\n                history: false,\n                clickToCloseNonZoomable: prefs.zoomClickToCloseNonZoomable,\n                closeElClasses: prefs.zoomCloseElClasses.split(','),\n                closeOnScroll: prefs.closeOnScroll,\n                showHideOpacity: prefs.showHideOpacity\n            };\n\n            const gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI, items, options);\n\n            gallery.listen('close', () => this.onZoomClosed());\n\n            gallery.listen('beforeChange', () => {\n                const currentPage = gallery.getCurrentIndex();\n\n                imgCarousel.scrollToPage(currentPage);\n\n                if (thumbnailsCarousel) {\n                    thumbnailsCarousel.markCurrentPage(currentPage).scrollIntoView();\n                }\n            });\n\n            gallery.init();\n\n            this.gallery = gallery;\n            this.imageMode = IMAGE_MODE_ZOOM;\n\n            if (thumbnailsCarousel) {\n                thumbnailsCarousel.toggleZoomState(true);\n            }\n\n            this.addGlobalDialogClass();\n            this.addFocusTrap();\n        }\n\n        /**\n         * @description Click handler on image from large images carousel\n         * @returns {Promise} - Promise that fulfills when all of the promises passed as an iterable have been fulfilled\n         */\n        loadPhotoswipeDependencies() {\n            return Promise.all([\n                import(/* webpackChunkName: 'photoswipe' */'photoswipe'),\n                import(/* webpackChunkName: 'photoswipe' */'photoswipe/dist/photoswipe-ui-default.js'),\n                this.getOriginalImageSize()\n            ]);\n        }\n\n        /**\n         * @description Click handler on image from large images carousel\n         */\n        onImageCarouselPageClicked() {\n            this.zoom();\n        }\n\n        /**\n         * @description Click handler for \"zoom\" icon\n         */\n        openZoom() {\n            this.zoom();\n        }\n\n        /**\n         * @description Generic method to open zoom popup\n         */\n        zoom() {\n            this.loadPhotoswipeDependencies().then(([PhotoSwipe, PhotoSwipeUI, originalImageSize]) => {\n                this.initAndShowZoom(PhotoSwipe.default, PhotoSwipeUI.default, originalImageSize);\n            });\n        }\n\n        /**\n         * @description \"Close\" photoswipe popup icon click handler\n         */\n        closeZoom() {\n            if (this.gallery) {\n                this.gallery.close();\n            }\n\n            const pswpElement = document.querySelectorAll('.pswp')[0];\n\n            if (!(pswpElement instanceof HTMLElement)) {\n                return;\n            }\n\n            pswpElement.removeAttribute('data-tau');\n        }\n\n        /**\n         * @description Zoom Keydown Event handler\n         * @param {HTMLElement} _ Source of keydown event\n         * @param {KeyboardEvent} event  Event object\n         * @returns {void}\n         */\n        closeZoomKeydown(_, event) {\n            if (event.keyCode === keyCode.ENTER || event.keyCode === keyCode.SPACE) {\n                event.stopPropagation();\n                event.preventDefault();\n                this.closeZoom();\n            }\n        }\n\n        /**\n         * @description Sets image mode / do some DOM modifications after zoom closed\n         */\n        onZoomClosed() {\n            this.getById('imagesThumbnails', (/** @type {carousel} */thumbnails) => thumbnails.toggleZoomState(false));\n            this.imageMode = IMAGE_MODE_CAROUSEL;\n            this.removeGlobalDialogClass();\n\n            if (this.backFocusElement) {\n                this.backFocusElement.focus();\n                this.backFocusElement = null;\n            }\n        }\n\n        /**\n         * @description Add Global Dialog Class\n         * @returns {void}\n         */\n        addGlobalDialogClass() {\n            const html = this.ref('html');\n\n            if (!html.hasClass(this.prefs().classesGlobalDialog)) {\n                html.addClass(this.prefs().classesGlobalDialog);\n            }\n        }\n\n        /**\n         * @description Remove Global Dialog Class\n         * @returns {void}\n         */\n        removeGlobalDialogClass() {\n            this.ref('html').removeClass(this.prefs().classesGlobalDialog);\n        }\n\n        /**\n         * @param {RefElement} _el event source element\n         * @param {KeyboardEvent} event event instance if DOM event\n         */\n        handleKeydown(_el, event) {\n            if (!event) {\n                return;\n            }\n\n            switch (event.keyCode) {\n                case keyCode.SPACE:\n                case keyCode.ENTER:\n                    event.preventDefault();\n                    event.stopPropagation();\n                    if (event.target && 'thumbnailsArrow' in event.target.dataset) {\n                        break;\n                    }\n                    this.zoom();\n                    break;\n                default:\n                    break;\n            }\n        }\n    }\n\n    return ProductImages;\n}\n"],"sourceRoot":""}