{ "version": 3, "sources": [ "ConfiguratorDynamicImage/main.js" ], "names": [], "mappings": "AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA", "file": "ConfiguratorDynamicImage.js", "sourcesContent": [ "require([\r\n],\r\nfunction () {\r\n \r\n var layeredImagesUrls;\r\n var layeredImagesToBePreloaded;\r\n var layeredImagesPreLoaded;\r\n const COMPOSITE_IMAGE_THUMBNAIL_SELECTOR = \".composite-image-thumb\";\r\n const CONFIGURATOR_DYNAMIC_IMAGE_SELECTOR = \".configurator-dynamic-image\";\r\n const PRODUCT_OPTION_IMAGE_SELECTOR = \".product-option-thumb-img\";\r\n var initLoad = true;\r\n\r\n document.addEventListener(\"productOptionChanged\", (event) => { \r\n displayLayeredImages(event.detail.selected);\r\n });\r\n\r\n function hoverInProductOptionThumbnail(event) {\r\n var element = $(event.target); \r\n if (element.attr(\"class\").indexOf(\"composite-image-thumb\") == -1) {\r\n var image = $(element).first(\"img\");\r\n var imageUrl = 'url(\"' + $(image).data('fullSizeImageUrl'); + '\")';\r\n $(CONFIGURATOR_DYNAMIC_IMAGE_SELECTOR).css({ \"background-image\": imageUrl });\r\n $(\"#product-option-title\").text($(image).data(\"productOptionTitle\"));\r\n }\r\n else {\r\n $(CONFIGURATOR_DYNAMIC_IMAGE_SELECTOR).css({ \"background-image\": layeredImagesUrls });\r\n $(\"#product-option-title\").text(\"\");\r\n }\r\n }\r\n\r\n function displayLayeredImages(selectedOptions) { \r\n // select images \r\n let images = configuratorDynamicImagesData\r\n .filter((d) => d.Options.every((o) => selectedOptions.some(x => x.ProductCode == o)))\r\n .sort((a, b) => b.Layer - a.Layer) // image with higher layer number has to go first\r\n ;\r\n\r\n // find difference between selectedOptions and images to get not used options so we can display their thumbnails\r\n var notUsedOptions = selectedOptions.filter(x => !Array.from(new Set(images.map(x => x.Options).flat())).includes(x.ProductCode));\r\n if (notUsedOptions.length) {\r\n //$(\"#product-options-thumbs\").empty();\r\n $(\"#product-options-thumbs\").empty();\r\n var thumbsHtml = \"\";\r\n notUsedOptions.forEach((item) => {\r\n thumbsHtml += '