/** Shopify CDN: Minification failed Line 24:0 Transforming const to the configured target environment ("es5") is not supported yet Line 26:45 Transforming default arguments to the configured target environment ("es5") is not supported yet Line 83:40 Transforming default arguments to the configured target environment ("es5") is not supported yet Line 91:0 Transforming class syntax to the configured target environment ("es5") is not supported yet Line 92:13 Transforming object literal extensions to the configured target environment ("es5") is not supported yet Line 102:15 Transforming object literal extensions to the configured target environment ("es5") is not supported yet Line 104:4 Transforming const to the configured target environment ("es5") is not supported yet Line 114:2 Transforming let to the configured target environment ("es5") is not supported yet Line 115:10 Transforming rest arguments to the configured target environment ("es5") is not supported yet Line 121:0 Transforming const to the configured target environment ("es5") is not supported yet ... and 41 more hidden warnings **/ function getFocusableElements(container) { return Array.from( container.querySelectorAll( "summary, a[href], button:enabled, [tabindex]:not([tabindex^='-']), [draggable], area, input:not([type=hidden]):enabled, select:enabled, textarea:enabled, object, iframe" ) ); } const trapFocusHandlers = {}; function trapFocus(container, elementToFocus = container) { var elements = getFocusableElements(container); var first = elements[0]; var last = elements[elements.length - 1]; removeTrapFocus(); trapFocusHandlers.focusin = (event) => { if ( event.target !== container && event.target !== last && event.target !== first ) return; document.addEventListener('keydown', trapFocusHandlers.keydown); }; trapFocusHandlers.focusout = function() { document.removeEventListener('keydown', trapFocusHandlers.keydown); }; trapFocusHandlers.keydown = function(event) { if (event.code.toUpperCase() !== 'TAB') return; // If not TAB key // On the last focusable element and tab forward, focus the first element. if (event.target === last && !event.shiftKey) { event.preventDefault(); first.focus(); } // On the first focusable element and tab backward, focus the last element. if ( (event.target === container || event.target === first) && event.shiftKey ) { event.preventDefault(); last.focus(); } }; document.addEventListener('focusout', trapFocusHandlers.focusout); document.addEventListener('focusin', trapFocusHandlers.focusin); elementToFocus.focus(); } function pauseAllMedia() { document.querySelectorAll('.js-youtube').forEach((video) => { video.contentWindow.postMessage('{"event":"command","func":"' + 'pauseVideo' + '","args":""}', '*'); }); document.querySelectorAll('.js-vimeo').forEach((video) => { video.contentWindow.postMessage('{"method":"pause"}', '*'); }); document.querySelectorAll('video').forEach((video) => video.pause()); document.querySelectorAll('product-model').forEach((model) => model.modelViewerUI?.pause()); } function removeTrapFocus(elementToFocus = null) { document.removeEventListener('focusin', trapFocusHandlers.focusin); document.removeEventListener('focusout', trapFocusHandlers.focusout); document.removeEventListener('keydown', trapFocusHandlers.keydown); if (elementToFocus) elementToFocus.focus(); } class QuantityInput extends HTMLElement { constructor() { super(); this.input = this.querySelector('input'); this.changeEvent = new Event('change', { bubbles: true }) this.querySelectorAll('button').forEach( (button) => button.addEventListener('click', this.onButtonClick.bind(this)) ); } onButtonClick(event) { event.preventDefault(); const previousValue = this.input.value; event.target.name === 'plus' ? this.input.stepUp() : this.input.stepDown(); if (previousValue !== this.input.value) this.input.dispatchEvent(this.changeEvent); } } customElements.define('quantity-input', QuantityInput); function debounce(fn, wait) { let t; return (...args) => { clearTimeout(t); t = setTimeout(() => fn.apply(this, args), wait); }; } const serializeForm = form => { const obj = {}; const formData = new FormData(form); for (const key of formData.keys()) { obj[key] = formData.get(key); } return JSON.stringify(obj); }; function fetchConfig(type = 'json') { return { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': `application/${type}` } }; } /* * Shopify Common JS * */ if ((typeof window.Shopify) == 'undefined') { window.Shopify = {}; } Shopify.bind = function(fn, scope) { return function() { return fn.apply(scope, arguments); } }; Shopify.setSelectorByValue = function(selector, value) { for (var i = 0, count = selector.options.length; i < count; i++) { var option = selector.options[i]; if (value == option.value || value == option.innerHTML) { selector.selectedIndex = i; return i; } } }; Shopify.addListener = function(target, eventName, callback) { target.addEventListener ? target.addEventListener(eventName, callback, false) : target.attachEvent('on'+eventName, callback); }; Shopify.postLink = function(path, options) { options = options || {}; var method = options['method'] || 'post'; var params = options['parameters'] || {}; var form = document.createElement("form"); form.setAttribute("method", method); form.setAttribute("action", path); for(var key in params) { var hiddenField = document.createElement("input"); hiddenField.setAttribute("type", "hidden"); hiddenField.setAttribute("name", key); hiddenField.setAttribute("value", params[key]); form.appendChild(hiddenField); } document.body.appendChild(form); form.submit(); document.body.removeChild(form); }; Shopify.CountryProvinceSelector = function(country_domid, province_domid, options) { this.countryEl = document.getElementById(country_domid); this.provinceEl = document.getElementById(province_domid); this.provinceContainer = document.getElementById(options['hideElement'] || province_domid); Shopify.addListener(this.countryEl, 'change', Shopify.bind(this.countryHandler,this)); this.initCountry(); this.initProvince(); }; Shopify.CountryProvinceSelector.prototype = { initCountry: function() { var value = this.countryEl.getAttribute('data-default'); Shopify.setSelectorByValue(this.countryEl, value); this.countryHandler(); }, initProvince: function() { var value = this.provinceEl.getAttribute('data-default'); if (value && this.provinceEl.options.length > 0) { Shopify.setSelectorByValue(this.provinceEl, value); } }, countryHandler: function(e) { var opt = this.countryEl.options[this.countryEl.selectedIndex]; var raw = opt.getAttribute('data-provinces'); var provinces = JSON.parse(raw); this.clearOptions(this.provinceEl); if (provinces && provinces.length == 0) { this.provinceContainer.style.display = 'none'; } else { for (var i = 0; i < provinces.length; i++) { var opt = document.createElement('option'); opt.value = provinces[i][0]; opt.innerHTML = provinces[i][1]; this.provinceEl.appendChild(opt); } this.provinceContainer.style.display = ""; } }, clearOptions: function(selector) { while (selector.firstChild) { selector.removeChild(selector.firstChild); } }, setOptions: function(selector, values) { for (var i = 0, count = values.length; i < values.length; i++) { var opt = document.createElement('option'); opt.value = values[i]; opt.innerHTML = values[i]; selector.appendChild(opt); } } }; class MenuDrawer extends HTMLElement { constructor() { super(); this.mainDetailsToggle = this.querySelector('details'); const summaryElements = this.querySelectorAll('summary'); this.addAccessibilityAttributes(summaryElements); if (navigator.platform === 'iPhone') document.documentElement.style.setProperty('--viewport-height', `${window.innerHeight}px`); this.addEventListener('keyup', this.onKeyUp.bind(this)); this.addEventListener('focusout', this.onFocusOut.bind(this)); this.bindEvents(); } bindEvents() { this.querySelectorAll('summary').forEach(summary => summary.addEventListener('click', this.onSummaryClick.bind(this))); this.querySelectorAll('button').forEach(button => button.addEventListener('click', this.onCloseButtonClick.bind(this))); } addAccessibilityAttributes(summaryElements) { summaryElements.forEach(element => { element.setAttribute('role', 'button'); element.setAttribute('aria-expanded', false); element.setAttribute('aria-controls', element.nextElementSibling.id); }); } onKeyUp(event) { if(event.code.toUpperCase() !== 'ESCAPE') return; const openDetailsElement = event.target.closest('details[open]'); if(!openDetailsElement) return; openDetailsElement === this.mainDetailsToggle ? this.closeMenuDrawer(this.mainDetailsToggle.querySelector('summary')) : this.closeSubmenu(openDetailsElement); } onSummaryClick(event) { const summaryElement = event.currentTarget; const detailsElement = summaryElement.parentNode; const isOpen = detailsElement.hasAttribute('open'); if (detailsElement === this.mainDetailsToggle) { if(isOpen) event.preventDefault(); isOpen ? this.closeMenuDrawer(summaryElement) : this.openMenuDrawer(summaryElement); } else { trapFocus(summaryElement.nextElementSibling, detailsElement.querySelector('button')); setTimeout(() => { detailsElement.classList.add('menu-opening'); }); } } openMenuDrawer(summaryElement) { setTimeout(() => { this.mainDetailsToggle.classList.add('menu-opening'); }); summaryElement.setAttribute('aria-expanded', true); trapFocus(this.mainDetailsToggle, summaryElement); document.body.classList.add('overflow-hidden-mobile'); } closeMenuDrawer(event, elementToFocus = false) { if (event !== undefined) { this.mainDetailsToggle.classList.remove('menu-opening'); this.mainDetailsToggle.querySelectorAll('details').forEach(details => { details.removeAttribute('open'); details.classList.remove('menu-opening'); }); this.mainDetailsToggle.querySelector('summary').setAttribute('aria-expanded', false); document.body.classList.remove('overflow-hidden-mobile'); removeTrapFocus(elementToFocus); this.closeAnimation(this.mainDetailsToggle); } } onFocusOut(event) { setTimeout(() => { if (this.mainDetailsToggle.hasAttribute('open') && !this.mainDetailsToggle.contains(document.activeElement)) this.closeMenuDrawer(); }); } onCloseButtonClick(event) { const detailsElement = event.currentTarget.closest('details'); this.closeSubmenu(detailsElement); } closeSubmenu(detailsElement) { detailsElement.classList.remove('menu-opening'); removeTrapFocus(); this.closeAnimation(detailsElement); } closeAnimation(detailsElement) { let animationStart; const handleAnimation = (time) => { if (animationStart === undefined) { animationStart = time; } const elapsedTime = time - animationStart; if (elapsedTime < 400) { window.requestAnimationFrame(handleAnimation); } else { detailsElement.removeAttribute('open'); if (detailsElement.closest('details[open]')) { trapFocus(detailsElement.closest('details[open]'), detailsElement.querySelector('summary')); } } } window.requestAnimationFrame(handleAnimation); } } customElements.define('menu-drawer', MenuDrawer); class HeaderDrawer extends MenuDrawer { constructor() { super(); } openMenuDrawer(summaryElement) { this.header = this.header || document.getElementById('shopify-section-header'); this.borderOffset = this.borderOffset || this.closest('.header-wrapper').classList.contains('header-wrapper--border-bottom') ? 1 : 0; document.documentElement.style.setProperty('--header-bottom-position', `${parseInt(this.header.getBoundingClientRect().bottom - this.borderOffset)}px`); setTimeout(() => { this.mainDetailsToggle.classList.add('menu-opening'); }); summaryElement.setAttribute('aria-expanded', true); trapFocus(this.mainDetailsToggle, summaryElement); document.body.classList.add('overflow-hidden-mobile'); } } customElements.define('header-drawer', HeaderDrawer); class ModalDialog extends HTMLElement { constructor() { super(); this.querySelector('[id^="ModalClose-"]').addEventListener( 'click', this.hide.bind(this) ); this.addEventListener('click', (event) => { if (event.target.nodeName === 'MODAL-DIALOG') this.hide(); }); this.addEventListener('keyup', () => { if (event.code.toUpperCase() === 'ESCAPE') this.hide(); }); } show(opener) { this.openedBy = opener; document.body.classList.add('overflow-hidden'); this.setAttribute('open', ''); this.querySelector('.template-popup')?.loadContent(); trapFocus(this, this.querySelector('[role="dialog"]')); } hide() { document.body.classList.remove('overflow-hidden'); this.removeAttribute('open'); removeTrapFocus(this.openedBy); window.pauseAllMedia(); } } customElements.define('modal-dialog', ModalDialog); class ModalOpener extends HTMLElement { constructor() { super(); const button = this.querySelector('button'); button?.addEventListener('click', () => { document.querySelector(this.getAttribute('data-modal'))?.show(button); }); } } customElements.define('modal-opener', ModalOpener); class DeferredMedia extends HTMLElement { constructor() { super(); this.querySelector('[id^="Deferred-Poster-"]')?.addEventListener('click', this.loadContent.bind(this)); } loadContent() { if (!this.getAttribute('loaded')) { const content = document.createElement('div'); content.appendChild(this.querySelector('template').content.firstElementChild.cloneNode(true)); this.setAttribute('loaded', true); window.pauseAllMedia(); this.appendChild(content.querySelector('video, model-viewer, iframe')).focus(); } } } customElements.define('deferred-media', DeferredMedia);