{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///../sfcc_common/cartridges/app_storefront_base/cartridge/client/default/js/search/search.js","webpack:///../sfcc_common/cartridges/app_storefront_base/cartridge/client/default/js/util.js","webpack:///./cartridges/app_project/cartridge/client/default/js/search.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;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;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;AACL;;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uBAAuB,0BAA0B;AACjD;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;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;;;;;;;;;;;;AC9Na;;AAEb;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;;;;;;;;;;;;ACZa;;AAEb,qBAAqB,mBAAO,CAAC,oGAAW;;AAExC;AACA;AACA;AACA;AACA;AACA,GAAG;AACH,iBAAiB,mBAAO,CAAC,sHAAoB;AAC7C;AACA,CAAC;;AAED,0D;AACA,qE;AACA,iBAAiB,oBAAoB;AACrC;AACA;;AAEA,2B;AACA;AACA,WAAW,O;AACX;AACA;AACA,OAAO;AACP;AACA,CAAC,E","file":"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_project/cartridge/client/default/js/search.js\");\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\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\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\nmodule.exports = {\n    filter: function () {\n        // Display refinements bar when Menu icon clicked\n        $('.container').on('click', 'button.filter-results', function () {\n            $('.refinement-bar, .modal-background').show();\n            $('.refinement-bar').siblings().attr('aria-hidden', true);\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            $('.refinement-bar .close').focus();\n        });\n    },\n\n    closeRefinements: function () {\n        // Refinements close button\n        $('.container').on('click', '.refinement-bar button.close, .modal-background', function () {\n            $('.refinement-bar, .modal-background').hide();\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            $('.btn.filter-results').focus();\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, .modal-background').hide();\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        });\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            $.ajax({\n                url: this.value,\n                data: { selectedUrl: this.value },\n                method: 'GET',\n                success: function (response) {\n                    $('.product-grid').empty().html(response);\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',\n            function (e) {\n                e.preventDefault();\n                e.stopPropagation();\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                        $.spinner().stop();\n                    },\n                    error: function () {\n                        $.spinner().stop();\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","'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","'use strict';\n\nvar processInclude = require('BASE/util');\n\n$(document).ready(function() {\n  $('body').on('click', 'button.filter-results', function() {\n    if ($('.refinement-bar, .modal-background').hasClass('d-md-none')) {\n      $('.refinement-bar, .modal-background').removeClass('d-md-none');\n    }\n  });\n  processInclude(require('BASE/search/search'));\n  // processInclude(require('BASE/product/quickView'));\n});\n\ndocument.addEventListener('DOMContentLoaded', function() {  \n  var buttons = document.getElementsByClassName('btn-download-gift');  \n  for (var i = 0; i < buttons.length; i++) {\n      buttons[i].addEventListener('click', function() {\n          var voucherUrl = this.getAttribute('data-voucher-url');\n\n          if (voucherUrl) {              \n              window.open(voucherUrl, '_blank');\n          } else {              \n              alert('Il voucher non è disponibile per il download.');\n          }\n      });\n  }\n});"],"sourceRoot":""}