{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./cartridges/app_galderma/cartridge/client/default/js/search.js","webpack:///./cartridges/app_galderma/cartridge/client/default/js/search/search.js","webpack:///./sfra/cartridges/app_storefront_base/cartridge/client/default/js/util.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;;AAEb,qBAAqB,mBAAO,CAAC,4FAAW;;AAExC;AACA,mBAAmB,mBAAO,CAAC,mGAAqB;AAChD;AACA,CAAC;;;;;;;;;;;;;ACPY;;AAEb;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,0G;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,6BAA6B;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,uBAAuB,0BAA0B;AACjD;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6EAA6E,gBAAgB;AAC7F,yBAAyB;AACzB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;;;;;;AC1ea;;AAEb;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA","file":"default/js/search.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_galderma/cartridge/client/default/js/search.js\");\n","'use strict';\n\nvar processInclude = require('base/util');\n\n$(document).ready(function () {\n    processInclude(require('store/search/search'));\n    // processInclude(require('core/product/quickView'));\n});\n","'use strict';\n\n/**\n * Update DOM elements with Ajax results\n *\n * @param {Object} $results - jQuery DOM element\n * @param {string} selector - DOM element to look up in the $results\n * @return {undefined}\n */\nfunction updateDom($results, selector) {\n    var $updates = $results.find(selector);\n    $(selector).empty().html($updates.html());\n\n    if ($(selector).siblings('.filter-bar-line').is(':visible')) {\n        $(selector).siblings('.filter-bar-line').hide();\n    }\n}\n\n/**\n * Keep refinement panes expanded/collapsed after Ajax refresh\n *\n * @param {Object} $results - jQuery DOM element\n * @return {undefined}\n */\nfunction handleRefinements($results) {\n    $('.refinement.active').each(function () {\n        $(this).removeClass('active');\n        var activeDiv = $results.find('.' + $(this)[0].className.replace(/ /g, '.'));\n        activeDiv.addClass('active');\n        activeDiv.find('button.title').attr('aria-expanded', 'true');\n    });\n\n    updateDom($results, '.refinements');\n}\n\n/**\n * Parse Ajax results and updated select DOM elements\n *\n * @param {string} response - Ajax response HTML code\n * @return {undefined}\n */\nfunction parseResults(response) {\n    var $results = $(response);\n    var specialHandlers = {\n        '.refinements': handleRefinements\n    };\n\n    // Update DOM elements that do not require special handling\n    [\n        '.grid-header',\n        '.header-bar',\n        '.header.page-title',\n        '.product-grid',\n        '.show-more',\n        '.filter-bar'\n    ].forEach(function (selector) {\n        updateDom($results, selector);\n    });\n\n    Object.keys(specialHandlers).forEach(function (selector) {\n        specialHandlers[selector]($results);\n    });\n\n    // Update Apply Button\n    if ($('.cetaphil_redesign').length == 0) {\n        $('.apply-button').html('View ' + $('.grid-header .result-count span').text());\n    } else {\n        var svgIcon = '<svg width=\"16\" class=\"icon\" height=\"17\" viewBox=\"0 0 16 17\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M8.81311 12.9053C9.00837 13.1006 9.32496 13.1006 9.52022 12.9053L13.6869 8.73865C13.8821 8.54338 13.8821 8.2268 13.6869 8.03154L9.52022 3.86487C9.32496 3.66961 9.00837 3.66961 8.81311 3.86487C8.61785 4.06013 8.61785 4.37672 8.81311 4.57198L12.1262 7.88509L2.5 7.88509C2.22386 7.88509 2 8.10895 2 8.38509C2 8.66123 2.22386 8.88509 2.5 8.88509H12.1262L8.81311 12.1982C8.61785 12.3935 8.61785 12.71 8.81311 12.9053Z\" fill=\"currentColor\"></path></svg>'\n        if(document.documentElement.lang === 'fr'){\n            $('.apply-button').html('voir les ' + $('.grid-header .result-count span').text()  + svgIcon); \n        }else{\n        $('.apply-button').html('View ' + $('.grid-header .result-count span').text() + svgIcon);\n        }\n    }\n\n    // Update Product List Count\n    $('.result-count span').html($('.grid-header .result-count span').text());\n\n    // Hide Grid Header that shows\n    $('.grid-header .result-count').hide();\n\n    // Update Filter Button\n    if ($('.filter-active').length === 0) {\n        var filterResultsText = $('.btn.filter-results').attr('data-filter-text');\n        $('.btn.filter-results').text(filterResultsText).removeClass('open');\n    } else {\n        var hideResultsText = $('.btn.filter-results').attr('data-hide-text');\n        $('.btn.filter-results').text(hideResultsText).addClass('open');\n    }\n}\n\n/**\n * This function retrieves another page of content to display in the content search grid\n * @param {JQuery} $element - the jquery element that has the click event attached\n * @param {JQuery} $target - the jquery element that will receive the response\n * @return {undefined}\n */\nfunction getContent($element, $target) {\n    var showMoreUrl = $element.data('url');\n    $.spinner().start();\n    $.ajax({\n        url: showMoreUrl,\n        method: 'GET',\n        success: function (response) {\n            $target.append(response);\n            $.spinner().stop();\n        },\n        error: function () {\n            $.spinner().stop();\n        }\n    });\n}\n\n/**\n * Update sort option URLs from Ajax response\n *\n * @param {string} response - Ajax response HTML code\n * @return {undefined}\n */\nfunction updateSortOptions(response) {\n    var $tempDom = $('<div>').append($(response));\n    var sortOptions = $tempDom.find('.grid-footer').data('sort-options').options;\n    sortOptions.forEach(function (option) {\n        $('option.' + option.id).val(option.url);\n    });\n}\n\n/**\n * This function retrieves another page of content to display in the content search grid\n * @param {JQuery} $element - the jquery element that has the click event attached\n * @param {JQuery} $target - the jquery element that will receive the response\n * @return {undefined}\n */\nfunction getCount($element, $target) {\n    var showMoreUrl = $element.data('url');\n    $.ajax({\n        url: showMoreUrl,\n        method: 'GET',\n        success: function (response) {\n            var contentSearchResult = $(response).find('.row');\n            if ($target && $target.length && contentSearchResult.length) {\n                if (contentSearchResult.hasClass('count-no-results')) {\n                    $target.append('(0)');\n                } else {\n                    $target.append('(' + contentSearchResult.length + ')');\n                }\n            }\n        },\n        error: function () {\n        }\n    });\n}\n\n/**\n * Save the content components to the window object, so they can be added back to the\n * PLP after the sort or filter event\n */\nfunction preparePlpGridContentForAjax() {\n    if (window.plpGridContent && window.plpGridContentCount) {\n        return;\n    }\n    var plpGridContent = [];\n    var plpGridContentCount = 0;\n    $('#product-search-results .region,.grid-tile-wrapper').each(function (index) {\n        var $this = $(this);\n        if ($this.hasClass('plp-grid-content')) {\n            // banner counts for 2 spaces\n            var size = 1;\n            if ($this.hasClass('plp-grid-banner')) {\n                plpGridContentCount += 2;\n                size = 2;\n            } else {\n                plpGridContentCount += 1;\n            }\n            plpGridContent.push({\n                index: index,\n                element: $this,\n                size: size\n            });\n        }\n    });\n    window.plpGridContent = plpGridContent;\n    window.plpGridContentCount = plpGridContentCount;\n}\n\n/**\n * We're deleting some product tiles from the page, so when we request more products from the server with\n * the \"load more\" button, we need to tell the server to start at an index that is offset by the number of\n * products we removed from the page\n * @param {number} removedProductTileCount The number of product tiles we need to remove from the page to\n * make space for the content tiles\n */\nfunction modifyLoadMoreButton(removedProductTileCount) {\n    try {\n        // get data-url attribute value\n        var url = $('#product-search-results .show-more button').data('url');\n        // get start parameter from url\n        if (typeof url === 'string') {\n            if (url.includes('start=')) {\n                var regex = /start=(.*)[$|&]/;\n                var match = url.match(regex);\n                var currentStart = Number(match[1]);\n                // subtract the number of products removed from the start parameter\n                var updatedStart = currentStart - removedProductTileCount;\n                var originalUrlStartValue = match[0];\n                var newUrlStartValue = originalUrlStartValue.includes('&') ? 'start=' + updatedStart + '&' : 'start=' + updatedStart;\n                url = url.replace(originalUrlStartValue, newUrlStartValue);\n                $('#product-search-results .show-more button').data('url', url);\n            }\n        }\n    } catch (e) {\n        console.error('Error modifying load more button', e);\n    }\n}\n\n/**\n * The ShowAjax HTML adds a bunch of products to the page, we want to add some of the content back in,\n * removing some of the products but changing the \"load more\" button data so we don't miss any products when we load more\n * @param {Array} plpGridContent An array that contains JQuery html objects and their positions, to substitute onto the page\n * @param {number} plpGridContentCount The number of content tiles being repopulated on the page (header counts as 2)\n */\nfunction handleRepopulatingPlpContent() {\n    try {\n        var plpGridContentCount = window.plpGridContentCount;\n        if (typeof plpGridContentCount === 'undefined' || plpGridContentCount === 0) {\n            return;\n        }\n        var plpGridContent = window.plpGridContent;\n        var removedProductTileCount = 0;\n        for (let i = 0; i < plpGridContent.length; i += 1) {\n            const plpGridContentItem = plpGridContent[i];\n            var numberOfProductResultsOnPage = $('#product-search-results .product-grid .grid-tile-wrapper').length;\n            // if there are less products than the index of the content, then don't display\n            if (plpGridContentItem.index > numberOfProductResultsOnPage) {\n                break;\n            }\n            plpGridContentItem.element.insertBefore($('#product-search-results .product-grid .region,.grid-tile-wrapper')[plpGridContentItem.index]);\n            // Only remove content if there is a \"load more\" button on the page indicating pagination\n            if ($('#product-search-results .show-more').length) {\n                // pop a product tile from the page for each \"size\" unit of the content (so banners pop 2)\n                for (let j = 0; j < plpGridContentItem.size; j += 1) {\n                    $('#product-search-results .product-grid .grid-tile-wrapper').last().remove();\n                    removedProductTileCount += 1;\n                }\n            }\n        }\n        modifyLoadMoreButton(removedProductTileCount);\n    } catch (error) {\n        console.error('Error Repopulating PLP Content: ' + error);\n    }\n}\n/**\n    * Setting appropriate classes for the filter-bar drawer.\n    * It should be open for large screens and closed for mobile and tablets.\n*/\nfunction adjustClasses() {\n    if ($(window).width() > 1023) {\n        $('.collapsed').removeClass('collapsed');\n        $('.panel-collapse.collapse').addClass('show');\n    } else {\n        $('a[data-toggle=\"collapse\"]').addClass('collapsed');\n        $('.panel-collapse.collapse').removeClass('show');\n        if ($('.selected').length > 0) {\n            $('.selected').closest('.panel-collapse').addClass('show');\n            $('.selected').closest('.panel-collapse').prev().find('.collapsed')\n                .removeClass('collapsed');\n        }\n    }\n}\n\nadjustClasses();\n\nmodule.exports = {\n    filter: function () {\n        // Display refinements bar when Menu icon clicked\n        $('.container').on('click', 'button.filter-results', function () {\n            if ($('body').hasClass('filter-active')) {\n                if($('.cetaphil_redesign').length > 0) {\n                    $('.refinement-bar').siblings().attr('aria-hidden', false).removeClass('d-none-custom');\n                } else {\n                    $('.refinement-bar').siblings().attr('aria-hidden', false);\n                }\n                $('.refinement-bar').closest('.row').siblings().attr('aria-hidden', false);\n                $('.refinement-bar').closest('.tab-pane.active').siblings().attr('aria-hidden', false);\n                $('.refinement-bar').closest('.container.search-results').siblings().attr('aria-hidden', false);\n                var filterText = $(this).attr('data-filter-text');\n                $('.btn.filter-results').text(filterText).removeClass('open');\n                $('.panel-collapse').removeClass('collapse');\n            } else {\n                if($('.cetaphil_redesign').length > 0) {\n                    $('.refinement-bar').siblings().attr('aria-hidden', true).addClass('d-none-custom');\n                } else {\n                    $('.refinement-bar').siblings().attr('aria-hidden', true);\n                }\n                $('.refinement-bar').closest('.row').siblings().attr('aria-hidden', true);\n                $('.refinement-bar').closest('.tab-pane.active').siblings().attr('aria-hidden', true);\n                $('.refinement-bar').closest('.container.search-results').siblings().attr('aria-hidden', true);\n                var hideText = $(this).attr('data-hide-text');\n                $('.btn.filter-results').text(hideText).addClass('open');\n                $('.panel-collapse').addClass('collapse');\n            }\n        });\n    },\n\n    closeRefinements: function () {\n        // Refinements close button\n        $('.container').on('click', '.refinement-bar button.close, .modal-background, body', function () {\n            if($('.cetaphil_redesign').length > 0) {\n                $('.refinement-bar').siblings().attr('aria-hidden', false).removeClass('d-none-custom');\n            } else {\n                $('.refinement-bar').siblings().attr('aria-hidden', false);\n            }\n            $('.refinement-bar').closest('.row').siblings().attr('aria-hidden', false);\n            $('.refinement-bar').closest('.tab-pane.active').siblings().attr('aria-hidden', false);\n            $('.refinement-bar').closest('.container.search-results').siblings().attr('aria-hidden', false);\n            var closeFilterText = $('.btn.filter-results').attr('data-filter-text');\n            $('.btn.filter-results').text(closeFilterText).removeClass('open');\n            $('.btn.filter-results').focus();\n            if ($('.cetaphil_redesign .search-results').length > 0 && $(window).innerWidth() < 1024) {\n                var scrollTopPositionval = $('.btn.filter-results').offset().top - 120;\n                $('html, body').animate({\n                    scrollTop: scrollTopPositionval\n                }, 500);\n            }\n        });\n    },\n\n    resize: function () {\n        // Close refinement bar and hide modal background if user resizes browser\n        $(window).resize(function () {\n            $('.refinement-bar').siblings().attr('aria-hidden', false);\n            $('.refinement-bar').closest('.row').siblings().attr('aria-hidden', false);\n            $('.refinement-bar').closest('.tab-pane.active').siblings().attr('aria-hidden', false);\n            $('.refinement-bar').closest('.container.search-results').siblings().attr('aria-hidden', false);\n            adjustClasses();\n        });\n    },\n\n    sort: function () {\n        // Handle sort order menu selection\n        $('.container').on('change', '[name=sort-order]', function (e) {\n            e.preventDefault();\n\n            $.spinner().start();\n            $(this).trigger('search:sort', this.value);\n\n            preparePlpGridContentForAjax();\n\n            $.ajax({\n                url: this.value,\n                data: { selectedUrl: this.value },\n                method: 'GET',\n                success: function (response) {\n                    $('.product-grid').empty().html(response);\n                    handleRepopulatingPlpContent();\n                    $.spinner().stop();\n                },\n                error: function () {\n                    $.spinner().stop();\n                }\n            });\n        });\n    },\n\n    showMore: function () {\n        // Show more products\n        $('.container').on('click', '.show-more button', function (e) {\n            e.stopPropagation();\n            var showMoreUrl = $(this).data('url');\n            e.preventDefault();\n\n            $.spinner().start();\n            $(this).trigger('search:showMore', e);\n            $.ajax({\n                url: showMoreUrl,\n                data: { selectedUrl: showMoreUrl },\n                method: 'GET',\n                success: function (response) {\n                    $('.grid-footer').replaceWith(response);\n                    updateSortOptions(response);\n                    $.spinner().stop();\n                },\n                error: function () {\n                    $.spinner().stop();\n                }\n            });\n        });\n    },\n\n    applyFilter: function () {\n        // Handle refinement value selection and reset click\n        $('.container').on(\n            'click',\n            '.refinements li button, .refinement-bar button.reset, .filter-value button, .swatch-filter button, .filter-bar button.reset',\n            function (e) {\n                e.preventDefault();\n                e.stopPropagation();\n\n                var selectedButtonText = '';\n                if ($(e.currentTarget).hasClass('filter-checkbox-btn')) {\n                    selectedButtonText = $(e.currentTarget).data('name');\n                }\n\n                // checking if current element has parent element 'e'\n                $.fn.hasParent = function (el) {\n                    return !!$(this).parents(el).length;\n                };\n                window.dataLayer = window.dataLayer || [];\n\n                if ($(this).hasParent('.refinements')) {\n                    // if the filter has already been selected, then don't push to dataLayer\n                    if (!$(this).find('.selected').length) {\n                        window.dataLayer.push({\n                            event: 'product_filter_click',\n                            filter_category: $(this).closest('.panel-collapse').prev().find('h2')\n                                .text(),\n                            filter_sub_category: $(this).find('span').first().text()\n                                .trim(),\n                            page_name: $('title').html(),\n                            page_location: window.location.href,\n                            hit_timetamp: new Date().toLocaleTimeString([], { hour12: false })\n                        });\n                    }\n                }\n\n                // store the elements that also have the class \"plp-grid-content\" and their index relative to other regions\n                preparePlpGridContentForAjax();\n\n                $.spinner().start();\n                $(this).trigger('search:filter', e);\n                $.ajax({\n                    url: $(this).data('href'),\n                    data: {\n                        page: $('.grid-footer').data('page-number'),\n                        selectedUrl: $(this).data('href')\n                    },\n                    method: 'GET',\n                    success: function (response) {\n                        parseResults(response);\n                        handleRepopulatingPlpContent();\n                        $.spinner().stop();\n                        adjustClasses();\n                        if (selectedButtonText != '' && $(window).width() < 1024) {\n                            var $elementCheckboxbtn =  $('.filter-checkbox-btn[data-name='+selectedButtonText+']');\n                            if ($elementCheckboxbtn.length > 0 && $elementCheckboxbtn.length < 2) {\n                                $elementCheckboxbtn.focus();\n                            }\n                        }\n                    },\n                    error: function () {\n                        $.spinner().stop();\n                    }\n                });\n            }\n        );\n    },\n\n    showContentTab: function () {\n        // Display content results from the search\n        $('.container').on('click', '.content-search', function () {\n            if ($('#content-search-results').html() === '') {\n                getContent($(this), $('#content-search-results'));\n            }\n        });\n\n        // Display the next page of content results from the search\n        $('.container').on('click', '.show-more-content button', function () {\n            getContent($(this), $('#content-search-results'));\n            $('.show-more-content').remove();\n        });\n    },\n\n    showCount: function () {\n        $(document).ready(function () {\n            $('.search-nav .nav-link').each(function () {\n                getCount($(this), $(this).find('.tab-count'));\n            });\n        });\n    },\n\n    clearFilter: function () {\n        // Handle refinement value selection and reset click\n        $('.container').on(\n            'click',\n            '.filter-value button', function () {\n                $('.filter-bar').siblings('button.reset').remove();\n            }\n        );\n    }\n\n};\n","'use strict';\n\nmodule.exports = function (include) {\n    if (typeof include === 'function') {\n        include();\n    } else if (typeof include === 'object') {\n        Object.keys(include).forEach(function (key) {\n            if (typeof include[key] === 'function') {\n                include[key]();\n            }\n        });\n    }\n};\n"],"sourceRoot":""}