{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./assets/src/js/product-filters.js","webpack:///./assets/src/js/modules/toggle-content-to-modal.js","webpack:///./assets/src/js/modules/site-modal.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","onFilterChange","queryMap","document","querySelectorAll","forEach","f","checked","queryParam","getAttribute","queryValue","push","keys","params","URLSearchParams","window","location","search","v","k","filter","includes","delete","q","set","join","url","protocol","hostname","pathname","toString","length","assign","setupFilterChangeHandler","filters","onchange","handleRefineOnClick","split","queryParamsToMap","filterParam","filterValue","setupCheckedFilters","getElementById","onclick","grid","nav","querySelector","setTimeout","scrollTo","top","offsetTop","offsetHeight","behavior","h2","focus","handleProductGridLock","ToggleContentToModal","modalId","toggleSelector","toggleContent","content","modalSelector","defaultSelector","callbacks","onOpen","refineBtn","removeFilterChangeHandler","onClose","options","this","prevWinWidth","mobileBrkpt","toggleBtn","modal","SiteModal","id","addEventListener","onResize","updateContentOnResize","item","append","innerWidth","detatchFromModal","close","appendToModal","modalDiv","isOpen","previousElementInFocus","closeSelectors","disableOverlayClick","map","btn","onDocumentModalKeyUp","open","event","keyCode","element","contentHeight","style","height","updateHeight","classList","remove","resetFocus","preventDefault","add","setPreviousElementInFocus","activeElement"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI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O6D,iBAAiB,SAAUP,KAAKQ,SAASpF,KAAK4E,OACrD,IAAMmB,qDAAmEpB,EAAQqB,oBAAsB,GAAK,oBAC5G,GAAGC,IAAItH,KAAKiG,KAAKgB,SAASjF,iBAAiBoF,IAAiB,mBAAOG,EAAIf,iBAAiB,QAAS,EAAKO,MAAM1F,KAAK,OACjHU,SAASyE,iBAAiB,QAASP,KAAKuB,qBAAqBnG,KAAK4E,OAE9DD,EAAQI,WACVJ,EAAQI,UAAUI,iBAAiB,QAASP,KAAKwB,KAAKpG,KAAK4E,O,uDAI1CyB,GACG,KAAlB,EAAMC,SAAkB1B,KAAKiB,QAC/BjB,KAAKc,U,gDAIiBa,GACxB3B,KAAKkB,uBAAyBS,I,mCAI1B3B,KAAKkB,wBACPlB,KAAKkB,uBAAuBjC,U,qCAK9B,GAAKe,KAAKiB,OAAV,CAGA,IAAMW,EAAgB5B,KAAKgB,SAASvC,cAAc,kBAAkBK,aACpEkB,KAAKgB,SAASvC,cAAc,gBAAgBoD,MAAMC,OAAYF,EAAgB,GAA9E,Q,iCAIK5B,KAAKiB,QAGVjB,KAAK+B,iB,8BAIL/B,KAAKiB,QAAL,EACIjB,KAAKF,SACPE,KAAKF,UAEPE,KAAKgB,SAASgB,UAAUC,OAAO,iBAC/BjC,KAAKkC,e,2BAGFT,GACCA,GACFA,EAAMU,iBAERnC,KAAKiB,QAAL,EACAjB,KAAKgB,SAASgB,UAAUI,IAAI,iBACxBpC,KAAKL,QACPK,KAAKL,SAEPK,KAAKqC,0BAA0BvG,SAASwG,eACxCtC,KAAKgB,SAAS/B,QACde,KAAK+B,mB,eAxEY1B","file":"product-filters.min.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 = 0);\n","import ToggleContentToModal from './modules/toggle-content-to-modal';\n\nconst onFilterChange = () => {\n const queryMap = {};\n const filters = document.querySelectorAll('.filter-checkbox');\n filters.forEach((f) => {\n if (!f.checked) {\n return;\n }\n\n const queryParam = f.getAttribute('data-query-param');\n const queryValue = f.getAttribute('data-query-value');\n if (!queryMap[queryParam]) {\n queryMap[queryParam] = [];\n }\n\n queryMap[queryParam].push(queryValue);\n });\n\n const keys = [];\n const params = new URLSearchParams(window.location.search);\n params.forEach((v, k) => { keys.push(k); });\n const filterParams = keys.filter(k => k.includes('filter'));\n filterParams.forEach((f) => { params.delete(f); });\n\n Object.keys(queryMap).forEach((q) => { params.set(q, queryMap[q].join(',')); });\n\n const url = `${window.location.protocol}//${window.location.hostname}${window.location.pathname}`;\n if (params.toString().length === 0) {\n window.location.assign(url);\n } else {\n window.location.assign(`${url}?${params.toString()}`);\n }\n};\n\nconst setupFilterChangeHandler = () => {\n const filters = document.querySelectorAll('.filter-checkbox');\n if (!filters) {\n return;\n }\n\n filters.forEach((f) => { f.onchange = onFilterChange; });\n};\n\nconst removeFilterChangeHandler = () => {\n const filters = document.querySelectorAll('.filter-checkbox');\n if (!filters) {\n return;\n }\n\n filters.forEach((f) => { f.onchange = null; });\n};\n\nconst queryParamsToMap = () => {\n const queryMap = {};\n const params = new URLSearchParams(window.location.search);\n params.forEach((v, k) => {\n if (k.includes('filter')) {\n queryMap[k] = v.split(',');\n }\n });\n\n return queryMap;\n};\n\nconst setupCheckedFilters = () => {\n const filters = document.querySelectorAll('.filter-checkbox');\n if (!filters) {\n return;\n }\n\n const queryMap = queryParamsToMap();\n Object.keys(queryMap).forEach((k) => {\n filters.forEach((f) => {\n const filterParam = f.getAttribute('data-query-param');\n const filterValue = f.getAttribute('data-query-value');\n if (filterParam === k) {\n f.checked = queryMap[k].includes(filterValue);\n }\n });\n });\n};\n\nconst setupClearFiltersHandler = () => {\n const btn = document.getElementById('clear-filters');\n btn.onclick = () => {\n const keys = [];\n const params = new URLSearchParams(window.location.search);\n params.forEach((v, k) => { keys.push(k); });\n keys.filter(k => k.includes('filter')).forEach((k) => { params.delete(k); });\n\n const url = `${window.location.protocol}//${window.location.hostname}${window.location.pathname}`;\n if (params.toString().length === 0) {\n window.location.assign(url);\n } else {\n window.location.assign(`${url}?${params.toString()}`);\n }\n };\n};\n\nconst handleRefineOnClick = () => {\n onFilterChange();\n};\n\nconst handleModalOpen = () => {\n const refineBtn = document.getElementById('modal-refine-btn');\n if (!refineBtn) {\n return;\n }\n\n refineBtn.onclick = handleRefineOnClick;\n removeFilterChangeHandler();\n};\n\nconst handleModalClose = () => {\n setupFilterChangeHandler();\n};\n\nconst handleProductGridLock = () => {\n const grid = document.getElementById('grid-lock');\n const nav = document.querySelector('.header-main-section');\n if (!grid || !nav) {\n return;\n }\n\n const params = new URLSearchParams(window.location.search);\n if (params.toString().length > 0) {\n window.setTimeout(() => {\n window.scrollTo({\n top: grid.offsetTop - nav.offsetHeight,\n behavior: 'smooth',\n });\n }, 100);\n\n const h2 = document.getElementById('results-focus');\n if (h2) {\n h2.focus();\n }\n }\n};\n\nsetupCheckedFilters();\nsetupFilterChangeHandler();\nsetupClearFiltersHandler();\nhandleProductGridLock();\n\nnew ToggleContentToModal({ /* eslint-disable-line no-new */\n modalId: 'filter-and-sort-modal',\n toggleSelector: '.btn-filter-sort',\n toggleContent: [\n {\n content: '.product-filter-group',\n modalSelector: '#filter-and-sort-modal .product-filter-wrapper',\n defaultSelector: '.filtered-content-grid .product-filter-wrapper',\n },\n ],\n callbacks: {\n onOpen: handleModalOpen,\n onClose: handleModalClose,\n },\n});\n","/* eslint-disable no-console */\nimport SiteModal from './site-modal';\n\nexport default class ToggleContentToModal {\n constructor(options) {\n this.modalId = options.modalId;\n this.toggleSelector = options.toggleSelector;\n this.toggleContent = options.toggleContent;\n this.prevWinWidth = 999999;\n this.mobileBrkpt = 768;\n this.toggleBtn = document.querySelector(this.toggleSelector);\n this.callbacks = options.callbacks;\n if (!this.toggleBtn) {\n return;\n }\n\n if (!this.callbacks) {\n this.callbacks = {};\n }\n\n // Modal\n this.modal = new SiteModal({\n id: this.modalId,\n callbacks: {\n onOpen: () => {\n if (this.callbacks.onOpen) {\n this.callbacks.onOpen();\n }\n },\n onClose: () => {\n if (this.callbacks.onClose) {\n this.callbacks.onClose();\n }\n },\n },\n toggleBtn: this.toggleBtn,\n });\n window.addEventListener('resize', this.onResize.bind(this));\n this.updateContentOnResize();\n }\n\n appendToModal() {\n // console.log(`${window.innerWidth}, ${this.modalId}, appendToModal`);\n this.toggleContent.forEach((item) => {\n const filters = document.querySelector(item.content);\n const wrapper = document.querySelector(item.modalSelector);\n wrapper.append(filters);\n });\n }\n\n detatchFromModal() {\n // console.log(`${window.innerWidth}, ${this.modalId}, detatchFromModal`);\n this.toggleContent.forEach((item) => {\n const filters = document.querySelector(item.content);\n const wrapper = document.querySelector(item.defaultSelector);\n wrapper.append(filters);\n });\n }\n\n updateContentOnResize() {\n if (window.innerWidth >= this.mobileBrkpt && this.prevWinWidth < this.mobileBrkpt) {\n this.detatchFromModal();\n this.prevWinWidth = window.innerWidth;\n // Hide modal when reizing from mobile to desktop\n this.modal.close();\n }\n if (window.innerWidth < this.mobileBrkpt && this.prevWinWidth >= this.mobileBrkpt) {\n this.appendToModal();\n this.prevWinWidth = window.innerWidth;\n }\n }\n\n onResize() {\n this.updateContentOnResize();\n }\n}\n/* eslint-enable no-console */\n","/* eslint-disable no-console */\nexport default class SiteModal {\n constructor(options) {\n if (!options.callbacks) {\n options.callbacks = {};\n }\n this.onOpen = options.callbacks.onOpen;\n this.onClose = options.callbacks.onClose;\n this.modalDiv = document.querySelector(`#${options.id}`);\n this.isOpen = false;\n this.previousElementInFocus = null;\n // Modal events\n window.addEventListener('resize', this.onResize.bind(this));\n const closeSelectors = `.close-btn, #modal-refine-btn, .close-modal-btn${options.disableOverlayClick ? '' : ', .modal-overlay'}`;\n [].map.call(this.modalDiv.querySelectorAll(closeSelectors), btn => btn.addEventListener('click', this.close.bind(this)));\n document.addEventListener('keyup', this.onDocumentModalKeyUp.bind(this));\n // Add open to toggleBtn\n if (options.toggleBtn) {\n options.toggleBtn.addEventListener('click', this.open.bind(this));\n }\n }\n\n onDocumentModalKeyUp(event) {\n if (event.keyCode === 27 && this.isOpen) {\n this.close(); /* eslint-disable-line no-use-before-define */\n }\n }\n\n setPreviousElementInFocus(element) {\n this.previousElementInFocus = element;\n }\n\n resetFocus() {\n if (this.previousElementInFocus) {\n this.previousElementInFocus.focus();\n }\n }\n\n updateHeight() {\n if (!this.isOpen) {\n return;\n }\n const contentHeight = this.modalDiv.querySelector('.modal-content').offsetHeight;\n this.modalDiv.querySelector('.modal-panel').style.height = `${contentHeight + 30}px`;\n }\n\n onResize() {\n if (!this.isOpen) {\n return;\n }\n this.updateHeight();\n }\n\n close() {\n this.isOpen = false;\n if (this.onClose) {\n this.onClose();\n }\n this.modalDiv.classList.remove('modal-visible');\n this.resetFocus();\n }\n\n open(event) {\n if (event) {\n event.preventDefault();\n }\n this.isOpen = true;\n this.modalDiv.classList.add('modal-visible');\n if (this.onOpen) {\n this.onOpen();\n }\n this.setPreviousElementInFocus(document.activeElement);\n this.modalDiv.focus();\n this.updateHeight();\n }\n}\n/* eslint-enable no-console */\n"],"sourceRoot":""}