{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./cartridges/app_custom_neuhaus_webshop/cartridge/client/default/js/customCarousel.js","webpack:///./cartridges/app_custom_neuhaus_webshop/cartridge/client/default/js/einsteinCarousel.js","webpack:///./cartridges/app_custom_neuhaus_webshop/cartridge/client/default/js/product/wishlist.js","webpack:///./cartridges/app_custom_neuhaus_webshop/cartridge/client/default/js/util/thirdParty/glider.js"],"names":[],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFa;AACb,eAAe,mBAAO,CAAC,+HAA0B;;AAEjD;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;;;;;;;;;;;;ACvGa;;AAEb,uBAAuB,mBAAO,CAAC,+GAAkB;AACjD,iBAAiB,mBAAO,CAAC,mHAAoB;;AAE7C;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL,4DAA4D;AAC5D;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA,aAAa,wCAAwC;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA,CAAC;;;;;;;;;;;;;ACjJY;;AAEb;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,WAAW;AAC9D;AACA,aAAa;AACb;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;;;;;;;;;;;ACtGA;AACA;;AAEA;AACA,IAAI,KAA0C;AAC9C,MAAM,oCAAO,OAAO;AAAA;AAAA;AAAA;AAAA,oGAAC;AACrB,MAAM,SAEW;AACjB,CAAC;AACD,mBAAmB;;AAEnB;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,SAAS;;AAET;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;;AAEA;AACA;;AAEA,uBAAuB,qDAAqD;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,4CAA4C,uBAAuB;AACnE,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,aAAa;;AAEb,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,iDAAiD;AACjD;AACA,aAAa;AACb,SAAS;AACT,qCAAqC;AACrC;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA,CAAC","file":"default/js/einsteinCarousel.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./cartridges/app_custom_neuhaus_webshop/cartridge/client/default/js/einsteinCarousel.js\");\n","'use strict';\nconst Glider = require('./util/thirdParty/glider');\n\nmodule.exports.init = () => {\n this.createAll('.glider');\n};\n\nmodule.exports.createAll = (selector) => {\n $(selector).each((i, element) => {\n this.create(element);\n });\n};\n\nmodule.exports.create = (element) => {\n // Parent that holds the config attributes\n const parent = $(element).closest('.carousel');\n\n // get amount of slides for each breakpoint\n const amountSlidesXs = parent.data('xs') || parent.data('slides');\n const amountSlidesSm = parent.data('sm');\n const amountSlidesMd = parent.data('md');\n\n // other options\n let draggable = parent.data('draggable');\n let dots = parent.data('dots');\n let scrollLock = parent.data('scroll-lock');\n let scrollDelay = parent.data('scroll-delay');\n let rewind = parent.data('rewind');\n\n if (draggable === undefined) {\n draggable = true;\n }\n\n // get the arrow buttons form the slider\n const $arrowPrev = parent.find('.carousel-control-prev');\n const $arrowNext = parent.find('.carousel-control-next');\n\n var object = {\n slidesToShow: amountSlidesXs,\n slidesToScroll: amountSlidesXs,\n draggable: draggable,\n arrows: {\n prev: $arrowPrev[0],\n next: $arrowNext[0]\n },\n responsive: []\n };\n\n if (amountSlidesSm) {\n object.responsive.push({\n breakpoint: 575,\n settings: {\n slidesToShow: amountSlidesSm,\n slidesToScroll: amountSlidesSm\n }\n });\n }\n\n if (amountSlidesMd) {\n object.responsive.push({\n breakpoint: 768,\n settings: {\n slidesToShow: amountSlidesMd,\n slidesToScroll: amountSlidesMd\n }\n });\n }\n\n if (dots !== undefined) {\n object.dots = dots;\n }\n\n if (scrollLock) {\n object.scrollLock = true;\n }\n\n if (rewind) {\n object.rewind = true;\n }\n\n $(element).on('glider-loaded glider-refresh scroll', () => {\n // Hide arrows if they are not needed\n const arrowsNotNeeded = element.scrollWidth <= element.offsetWidth;\n $arrowPrev.toggleClass('d-none', arrowsNotNeeded || element.scrollLeft === 0);\n $arrowNext.toggleClass('d-none', arrowsNotNeeded || element.scrollLeft >= (element.scrollWidth - element.offsetWidth));\n });\n\n var carousel = new Glider(element, object);\n\n if (scrollDelay) {\n let autoplayDelay = parseInt(scrollDelay, 10) * 1000;\n\n setInterval(() => {\n carousel.scrollItem('next');\n }, autoplayDelay);\n }\n\n return carousel;\n};\n\nmodule.exports.scrollItem = (gliderElement, item) => {\n // This won't try to re-build the entire slider, if it's already a Glider slider, \"new Glider()\" will just return the exposed Glider object on the DOM element\n new Glider(gliderElement).scrollItem(item);\n};\n","'use strict';\n\nconst customCarousel = require('./customCarousel');\nconst Wishlist = require('./product/wishlist');\n\n/**\n * Validates and Return the cquotient namespace provided by the commerce cloud platform\n * @returns {Object} - einsteinUtils or null\n */\nfunction getEinsteinUtils() {\n var einsteinUtils = window.CQuotient;\n if (einsteinUtils && (typeof einsteinUtils.getCQUserId === 'function') && (typeof einsteinUtils.getCQCookieId === 'function')) {\n return einsteinUtils;\n }\n return null;\n}\n\n/**\n * fills in the carousel with product tile html objects\n * @param {string} einsteinResponse string html for product tiles\n * @param {jQuery} $parentElement parent element where recommendations will show.\n */\nfunction fillDomElement(einsteinResponse, $parentElement) {\n var recommendedProducts = einsteinResponse[$parentElement.data('recommender')].recs;\n if (recommendedProducts && recommendedProducts.length > 0) {\n var template = $parentElement.data('template');\n var components = [];\n components = recommendedProducts.map(function (recommendedProduct) {\n var tiledefinition = {};\n tiledefinition.template = template;\n tiledefinition.model = {\n type: 'product',\n id: recommendedProduct.id\n };\n return tiledefinition;\n });\n\n var url = new URL($parentElement.data('product-load-url'));\n url.searchParams.append('components', JSON.stringify(components));\n url.searchParams.append('limit', $parentElement.data('limit'));\n $.ajax({\n url: url.href,\n type: 'get',\n dataType: 'html',\n success: function (html) {\n var innerCarousel = $parentElement.find('.carousel-inner');\n innerCarousel.html(html);\n // trigger custom carousels build..\n customCarousel.create(innerCarousel[0]);\n // initiate product wishlist icons\n Wishlist.initProducts();\n },\n error: function () {\n $parentElement.spinner().stop();\n }\n });\n }\n}\n\n /**\n * Processes a recommendation tile, with an already initialized category specific anchors array\n * @param {jQuery} $parentElement parent element where recommendations will show.\n * @param {Object} einsteinUtils cquotient object\n * @param {Array} anchorsArray array of objects representing anchors\n */\nfunction processRecommendationsTile($parentElement, einsteinUtils, anchorsArray) {\n var recommender = $parentElement.data('recommender');\n\n var params = {\n userId: einsteinUtils.getCQUserId(),\n cookieId: einsteinUtils.getCQCookieId(),\n ccver: '1.01'\n };\n\n if (anchorsArray) {\n params.anchors = anchorsArray;\n }\n\n /**\n * Processes a recommendation responses\n * @param {Object} einsteinResponse cquotient object\n */\n function recommendationsReceived(einsteinResponse) {\n fillDomElement(einsteinResponse, $parentElement);\n $parentElement.spinner().stop();\n }\n\n if (einsteinUtils.getRecs) {\n einsteinUtils.getRecs(einsteinUtils.clientId, recommender, params, recommendationsReceived);\n } else {\n einsteinUtils.widgets = einsteinUtils.widgets || []; // eslint-disable-line no-param-reassign\n einsteinUtils.widgets.push({\n recommenderName: recommender,\n parameters: params,\n callback: recommendationsReceived\n });\n }\n}\n\n/**\n * Processes a recommendation tile, with an already initialized product specific anchors array\n * @param {jQuery} $parentElement parent element where recommendations will show.\n * @returns {Array} - containing an anchor object\n */\nfunction createProductAnchor($parentElement) {\n return [{\n id: $parentElement.data('primaryProductId'),\n sku: $parentElement.data('secondaryProductId'),\n type: $parentElement.data('alternativeGroupType'),\n alt_id: $parentElement.data('alternativeGroupId')\n }];\n}\n\n/**\n * Rerieves data attributes from parent element and converts to gretel compatible recommenders array\n * @param {jQuery} $parentElement parent element where recommendations will show.\n * @returns {Array} - containing an anchor object\n */\nfunction createCategoryAnchor($parentElement) {\n return [{ id: $parentElement.data('categoryId') }];\n}\n\n/**\n * Gets all placeholder elements, which hold einstein recommendations queries the details from the\n * einstein engine and feeds them back to the dom element\n */\nfunction loadRecommendations() {\n var einsteinUtils = getEinsteinUtils();\n if (einsteinUtils) {\n var $recommendationTiles = $('.einstein-carousel');\n $recommendationTiles.each(function () {\n var $parentElement = $(this);\n $parentElement.spinner().start();\n if ($(this).closest('.experience-einstein-einsteinCarouselProduct').length) {\n return processRecommendationsTile($parentElement, einsteinUtils, createProductAnchor($parentElement));\n } else if ($(this).closest('.experience-einstein-einsteinCarouselCategory').length) {\n return processRecommendationsTile($parentElement, einsteinUtils, createCategoryAnchor($parentElement));\n }\n return processRecommendationsTile($parentElement, einsteinUtils);\n });\n }\n}\n\n$(document).ready(function () {\n loadRecommendations();\n});\n","'use strict';\n\n/**\n * Updates product icon depending on if product was added to the wishlist or removed.\n * @param {boolean} adding - True if we were adding a product to the wishlist. False if we were removing one.\n * @param {Object} $button - button that was clicked to add/remove a product to the wishlist\n */\nfunction updateProductIcon(adding, $button) {\n if (adding) {\n $button.find('.icon')\n .removeClass('icon-wishlist-add')\n .addClass('icon-wishlist-added')\n .parent()\n .attr('title', function () {\n return $(this).data('remove-title');\n })\n .attr('data-added', 'true');\n } else {\n $button.find('.icon')\n .removeClass('icon-wishlist-added')\n .addClass('icon-wishlist-add')\n .parent()\n .attr('title', function () {\n return $(this).data('add-title');\n })\n .removeAttr('data-added');\n }\n}\n\n/**\n * Updates header's icon count and changes its icon depending on whether if it has any product or not\n * @param {Object} data - Response\n */\nfunction updateHeaderIcon(data) {\n if (data && data.products) {\n const $wishlist = $('.wishlist-count');\n $wishlist.attr('data-products', data.products);\n $wishlist.text(data.count);\n if (data.count > 0) {\n $wishlist.prev()\n .removeClass('icon-wishlist')\n .addClass('icon-wishlist-active');\n } else {\n $wishlist.prev()\n .removeClass('icon-wishlist-active')\n .addClass('icon-wishlist');\n }\n }\n}\n\nmodule.exports = {\n addToWishlist: function () {\n $('body').on('click', '.add-to-wish-list', function (e) {\n e.preventDefault();\n const adding = !$(this).attr('data-added');\n const url = adding ? $(this).attr('data-add-url') : $(this).attr('data-remove-url');\n const pid = $(this).closest('[data-pid]').data('pid');\n let optionId = $(this).closest('.product-detail').find('.product-option').attr('data-option-id');\n let optionVal = $(this).closest('.product-detail').find('.options-select option:selected').attr('data-value-id');\n optionId = optionId || null;\n optionVal = optionVal || null;\n if (!url || !pid) {\n return;\n }\n\n $.spinner().start();\n $.ajax({\n url: url,\n type: adding ? 'post' : 'get',\n dataType: 'json',\n data: {\n pid: pid,\n optionId: optionId,\n optionVal: optionVal\n }\n })\n .done(data => {\n updateProductIcon(adding, $(this));\n updateHeaderIcon(data);\n })\n .always(() => $.spinner().stop());\n });\n },\n initProducts: function () {\n /**\n * Sets wishlist icon active for products already added to the wishlist\n */\n function updateProductsWishlistIcons() {\n const products = JSON.parse($('.wishlist-count').attr('data-products'));\n products.forEach(productSku => {\n var productIcons = $(`[data-pid=\"${productSku}\"]`).find('.add-to-wish-list:first');\n updateProductIcon(true, productIcons);\n });\n $('.add-to-wish-list').removeClass('d-none');\n }\n\n updateProductsWishlistIcons();\n\n $(document).on('search:showMore', updateProductsWishlistIcons);\n $(document).on('search:filter', updateProductsWishlistIcons);\n },\n updateHeaderIcon: updateHeaderIcon\n};\n","//! Keep the custom functionality in mind when upgrading this thirdparty file.\n/* eslint-disable */\n\n(function (factory) {\n typeof define === 'function' && define.amd\n ? define(factory)\n : typeof exports === 'object'\n ? (module.exports = factory())\n : factory();\n}(function () {\n ('use strict'); // eslint-disable-line no-unused-expressions\n\n /* globals window:true */\n var _window = typeof window !== 'undefined' ? window : this;\n\n var Glider = (_window.Glider = function (element, settings) {\n var _ = this;\n\n if (element._glider) return element._glider;\n\n _.ele = element;\n _.ele.classList.add('glider');\n\n // expose glider object to its DOM element\n _.ele._glider = _;\n\n // merge user setting with defaults\n _.opt = Object.assign(\n {},\n {\n slidesToScroll: 1,\n slidesToShow: 1,\n resizeLock: true,\n duration: 1,\n // easeInQuad\n easing: function (x, t, b, c, d) {\n return c * (t /= d) * t + b;\n }\n },\n settings\n );\n\n // set defaults\n _.animate_id = _.page = _.slide = 0;\n _.arrows = {};\n\n // preserve original options to\n // extend breakpoint settings\n _._opt = _.opt;\n\n if (_.opt.skipTrack) {\n // first and only child is the track\n _.track = _.ele.children[0];\n } else {\n // create track and wrap slides\n _.track = document.createElement('div');\n _.ele.appendChild(_.track);\n while (_.ele.children.length !== 1) {\n _.track.appendChild(_.ele.children[0]);\n }\n }\n\n _.track.classList.add('glider-track');\n\n // start glider\n _.init();\n\n // set events\n _.resize = _.init.bind(_, true);\n _.event(_.ele, 'add', {\n scroll: _.updateControls.bind(_)\n });\n _.event(_window, 'add', {\n resize: _.resize\n });\n });\n\n var gliderPrototype = Glider.prototype;\n gliderPrototype.init = function (refresh, paging) {\n var _ = this;\n\n var width = 0;\n\n var height = 0;\n\n _.slides = _.track.children;\n\n [].forEach.call(_.slides, function (_) {\n _.classList.add('glider-slide');\n });\n\n _.containerWidth = _.ele.clientWidth;\n\n var breakpointChanged = _.settingsBreakpoint();\n if (!paging) paging = breakpointChanged;\n\n if (\n _.opt.slidesToShow === 'auto' ||\n typeof _.opt._autoSlide !== 'undefined'\n ) {\n var slideCount = _.containerWidth / _.opt.itemWidth;\n\n _.opt._autoSlide = _.opt.slidesToShow = _.opt.exactWidth\n ? slideCount\n : Math.floor(slideCount);\n }\n if (_.opt.slidesToScroll === 'auto') {\n _.opt.slidesToScroll = Math.floor(_.opt.slidesToShow);\n }\n\n _.itemWidth = _.opt.exactWidth\n ? _.opt.itemWidth\n : _.containerWidth / _.opt.slidesToShow;\n\n // set slide dimensions\n [].forEach.call(_.slides, function (__) {\n __.style.height = 'auto';\n __.style.width = _.itemWidth + 'px';\n width += _.itemWidth;\n height = Math.max(__.offsetHeight, height);\n });\n\n _.track.style.width = width + 'px';\n _.trackWidth = width;\n _.isDrag = false;\n _.preventClick = false;\n\n _.opt.resizeLock && _.scrollTo(_.slide * _.itemWidth, 0);\n\n if (breakpointChanged || paging) {\n _.bindArrows();\n _.buildDots();\n _.bindDrag();\n }\n\n _.updateControls();\n\n _.emit(refresh ? 'refresh' : 'loaded');\n };\n\n gliderPrototype.bindDrag = function () {\n var _ = this;\n _.mouse = _.mouse || _.handleMouse.bind(_);\n\n var mouseup = function () {\n _.mouseDown = undefined;\n _.ele.classList.remove('drag');\n if (_.isDrag) {\n _.preventClick = true;\n }\n _.isDrag = false;\n };\n\n var events = {\n mouseup: mouseup,\n mouseleave: mouseup,\n mousedown: function (e) {\n e.preventDefault();\n e.stopPropagation();\n _.mouseDown = e.clientX;\n _.ele.classList.add('drag');\n },\n mousemove: _.mouse,\n click: function (e) {\n if (_.preventClick) {\n e.preventDefault();\n e.stopPropagation();\n }\n _.preventClick = false;\n }\n };\n\n _.ele.classList.toggle('draggable', _.opt.draggable === true);\n _.event(_.ele, 'remove', events);\n if (_.opt.draggable) _.event(_.ele, 'add', events);\n };\n\n gliderPrototype.buildDots = function () {\n var _ = this;\n\n if (!_.opt.dots) {\n if (_.dots) _.dots.innerHTML = '';\n return;\n }\n\n if (typeof _.opt.dots === 'string') {\n _.dots = document.querySelector(_.opt.dots);\n } else _.dots = _.opt.dots;\n if (!_.dots) return;\n\n _.dots.innerHTML = '';\n _.dots.classList.add('glider-dots');\n\n for (var i = 0; i < Math.ceil(_.slides.length / _.opt.slidesToShow); ++i) {\n var dot = document.createElement('button');\n dot.dataset.index = i;\n dot.setAttribute('aria-label', 'Page ' + (i + 1));\n dot.className = 'glider-dot ' + (i ? '' : 'active');\n _.event(dot, 'add', {\n click: _.scrollItem.bind(_, i, true)\n });\n _.dots.appendChild(dot);\n }\n };\n\n gliderPrototype.bindArrows = function () {\n var _ = this;\n if (!_.opt.arrows) {\n Object.keys(_.arrows).forEach(function (direction) {\n var element = _.arrows[direction];\n _.event(element, 'remove', { click: element._func });\n });\n return;\n }\n ['prev', 'next'].forEach(function (direction) {\n var arrow = _.opt.arrows[direction];\n if (arrow) {\n if (typeof arrow === 'string') arrow = document.querySelector(arrow);\n arrow._func = arrow._func || _.scrollItem.bind(_, direction);\n _.event(arrow, 'remove', {\n click: arrow._func\n });\n _.event(arrow, 'add', {\n click: arrow._func\n });\n _.arrows[direction] = arrow;\n }\n });\n };\n function isInViewport(el) {\n const rect = el.getBoundingClientRect();\n return (\n rect.left >= 0 &&\n rect.right <= (window.innerWidth + 5 || document.documentElement.clientWidth)\n );\n }\n gliderPrototype.updateControls = function (event) {\n var _ = this;\n\n if (event && !_.opt.scrollPropagate) {\n event.stopPropagation();\n }\n\n var disableArrows = _.containerWidth >= _.trackWidth;\n\n if (!_.opt.rewind) {\n if (_.arrows.prev) {\n _.arrows.prev.classList.toggle(\n 'disabled',\n _.ele.scrollLeft <= 0 || disableArrows\n );\n }\n if (_.arrows.next) {\n _.arrows.next.classList.toggle(\n 'disabled',\n Math.ceil(_.ele.scrollLeft + _.containerWidth) >=\n Math.floor(_.trackWidth) || disableArrows\n );\n }\n }\n\n _.slide = Math.round(_.ele.scrollLeft / _.itemWidth);\n _.page = Math.round(_.ele.scrollLeft / _.containerWidth);\n\n var middle = _.slide + Math.floor(Math.floor(_.opt.slidesToShow) / 2);\n\n var extraMiddle = Math.floor(_.opt.slidesToShow) % 2 ? 0 : middle + 1;\n if (Math.floor(_.opt.slidesToShow) === 1) {\n extraMiddle = 0;\n }\n\n // the last page may be less than one half of a normal page width so\n // the page is rounded down. when at the end, force the page to turn\n if (_.ele.scrollLeft + _.containerWidth >= Math.floor(_.trackWidth)) {\n _.page = _.dots ? _.dots.children.length - 1 : 0;\n }\n\n [].forEach.call(_.slides, function (slide, index) {\n var slideClasses = slide.classList;\n\n var wasVisible = slideClasses.contains('visibleItem');\n\n var start = _.ele.scrollLeft;\n\n var end = _.ele.scrollLeft + _.containerWidth;\n\n var itemStart = _.itemWidth * index;\n\n var itemEnd = itemStart + _.itemWidth;\n\n [].forEach.call(slideClasses, function (className) {\n /^left|right/.test(className) && slideClasses.remove(className);\n });\n slideClasses.toggle('active', _.slide === index);\n if (middle === index || (extraMiddle && extraMiddle === index)) {\n slideClasses.add('center');\n } else {\n slideClasses.remove('center');\n slideClasses.add(\n [\n index < middle ? 'left' : 'right',\n Math.abs(index - (index < middle ? middle : extraMiddle || middle))\n ].join('-')\n );\n }\n\n var isVisible = isInViewport(slide);\n slideClasses.toggle('visibleItem', isVisible);\n if (isVisible !== wasVisible) {\n _.emit('slide-' + (isVisible ? 'visibleItem' : 'hidden'), {\n slide: index\n });\n }\n });\n if (_.dots) {\n [].forEach.call(_.dots.children, function (dot, index) {\n dot.classList.toggle('active', _.page === index);\n });\n }\n\n if (event && _.opt.scrollLock) {\n clearTimeout(_.scrollLock);\n _.scrollLock = setTimeout(function () {\n clearTimeout(_.scrollLock);\n // dont attempt to scroll less than a pixel fraction - causes looping\n if (Math.abs(_.ele.scrollLeft / _.itemWidth - _.slide) > 0.02) {\n if (!_.mouseDown) {\n _.scrollItem(_.round(_.ele.scrollLeft / _.itemWidth));\n }\n }\n }, _.opt.scrollLockDelay || 250);\n }\n };\n\n gliderPrototype.scrollItem = function (slide, dot, e) {\n if (e) e.preventDefault();\n\n var _ = this;\n\n var originalSlide = slide;\n ++_.animate_id;\n\n if (dot === true) {\n slide *= _.containerWidth;\n slide = Math.round(slide / _.itemWidth) * _.itemWidth;\n } else {\n if (typeof slide === 'string') {\n var backwards = slide === 'prev';\n\n // use precise location if fractional slides are on\n if (_.opt.slidesToScroll % 1 || _.opt.slidesToShow % 1) {\n slide = _.round(_.ele.scrollLeft / _.itemWidth);\n } else {\n slide = _.slide;\n }\n\n if (backwards) slide -= _.opt.slidesToScroll;\n else slide += _.opt.slidesToScroll;\n\n if (_.opt.rewind) {\n var scrollLeft = _.ele.scrollLeft;\n slide =\n backwards && !scrollLeft\n ? _.slides.length\n : !backwards &&\n scrollLeft + _.containerWidth >= Math.floor(_.trackWidth)\n ? 0\n : slide;\n }\n }\n\n slide = Math.max(Math.min(slide, _.slides.length), 0);\n\n _.slide = slide;\n slide = _.itemWidth * slide;\n }\n\n _.scrollTo(\n slide,\n _.opt.duration * Math.abs(_.ele.scrollLeft - slide),\n function () {\n _.updateControls();\n _.emit('animated', {\n value: originalSlide,\n type:\n typeof originalSlide === 'string' ? 'arrow' : dot ? 'dot' : 'slide'\n });\n }\n );\n\n return false;\n };\n\n gliderPrototype.settingsBreakpoint = function () {\n var _ = this;\n\n var resp = _._opt.responsive;\n\n if (resp) {\n // Sort the breakpoints in mobile first order\n resp.sort(function (a, b) {\n return b.breakpoint - a.breakpoint;\n });\n\n for (var i = 0; i < resp.length; ++i) {\n var size = resp[i];\n if (_window.innerWidth >= size.breakpoint) {\n if (_.breakpoint !== size.breakpoint) {\n _.opt = Object.assign({}, _._opt, size.settings);\n _.breakpoint = size.breakpoint;\n return true;\n }\n return false;\n }\n }\n }\n // set back to defaults in case they were overriden\n var breakpointChanged = _.breakpoint !== 0;\n _.opt = Object.assign({}, _._opt);\n _.breakpoint = 0;\n return breakpointChanged;\n };\n\n gliderPrototype.scrollTo = function (scrollTarget, scrollDuration, callback) {\n var _ = this;\n\n var start = new Date().getTime();\n\n var animateIndex = _.animate_id;\n\n var animate = function () {\n var now = new Date().getTime() - start;\n _.ele.scrollLeft =\n _.ele.scrollLeft +\n (scrollTarget - _.ele.scrollLeft) *\n _.opt.easing(0, now, 0, 1, scrollDuration);\n if (now < scrollDuration && animateIndex === _.animate_id) {\n _window.requestAnimationFrame(animate);\n } else {\n _.ele.scrollLeft = scrollTarget;\n callback && callback.call(_);\n }\n };\n\n _window.requestAnimationFrame(animate);\n };\n\n gliderPrototype.removeItem = function (index) {\n var _ = this;\n\n if (_.slides.length) {\n _.track.removeChild(_.slides[index]);\n _.refresh(true);\n _.emit('remove');\n }\n };\n\n gliderPrototype.addItem = function (ele) {\n var _ = this;\n\n _.track.appendChild(ele);\n _.refresh(true);\n _.emit('add');\n };\n\n gliderPrototype.handleMouse = function (e) {\n var _ = this;\n if (_.mouseDown) {\n _.isDrag = true;\n _.ele.scrollLeft +=\n (_.mouseDown - e.clientX) * (_.opt.dragVelocity || 3.3);\n _.mouseDown = e.clientX;\n }\n };\n\n // used to round to the nearest 0.XX fraction\n gliderPrototype.round = function (double) {\n var _ = this;\n var step = _.opt.slidesToScroll % 1 || 1;\n var inv = 1.0 / step;\n return Math.round(double * inv) / inv;\n };\n\n gliderPrototype.refresh = function (paging) {\n var _ = this;\n _.init(true, paging);\n };\n\n gliderPrototype.setOption = function (opt, global) {\n var _ = this;\n\n if (_.breakpoint && !global) {\n _._opt.responsive.forEach(function (v) {\n if (v.breakpoint === _.breakpoint) {\n v.settings = Object.assign({}, v.settings, opt);\n }\n });\n } else {\n _._opt = Object.assign({}, _._opt, opt);\n }\n\n _.breakpoint = 0;\n _.settingsBreakpoint();\n };\n\n gliderPrototype.destroy = function () {\n var _ = this;\n\n var replace = _.ele.cloneNode(true);\n\n var clear = function (ele) {\n ele.removeAttribute('style');\n [].forEach.call(ele.classList, function (className) {\n /^glider/.test(className) && ele.classList.remove(className);\n });\n };\n // remove track\n replace.children[0].outerHTML = replace.children[0].innerHTML;\n clear(replace);\n [].forEach.call(replace.getElementsByTagName('*'), clear);\n _.ele.parentNode.replaceChild(replace, _.ele);\n _.event(_window, 'remove', {\n resize: _.resize\n });\n _.emit('destroy');\n };\n\n gliderPrototype.emit = function (name, arg) {\n var _ = this;\n\n var e = new _window.CustomEvent('glider-' + name, {\n bubbles: !_.opt.eventPropagate,\n detail: arg\n });\n _.ele.dispatchEvent(e);\n };\n\n gliderPrototype.event = function (ele, type, args) {\n var eventHandler = ele[type + 'EventListener'].bind(ele);\n Object.keys(args).forEach(function (k) {\n eventHandler(k, args[k]);\n });\n };\n\n return Glider;\n}));\n"],"sourceRoot":""}