1function addPageLoadedClass(){document.body.classList.add("page-loaded"),document.dispatchEvent(new CustomEvent("initSlickSlider")),window.removeEventListener("scroll",onFirstInteraction),window.removeEventListener("keydown",onFirstInteraction),window.removeEventListener("mousemove",onFirstInteraction),window.removeEventListener("touchstart",onFirstInteraction),window.removeEventListener("click",onFirstInteraction)}function onFirstInteraction(){addPageLoadedClass()}window.addEventListener("scroll",onFirstInteraction,{once:!0}),window.addEventListener("keydown",onFirstInteraction,{once:!0}),window.addEventListener("mousemove",onFirstInteraction,{once:!0}),window.addEventListener("touchstart",onFirstInteraction,{once:!0}),window.addEventListener("click",onFirstInteraction,{once:!0});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"))}class SectionId{static#separator="__";static parseId(qualifiedSectionId){return qualifiedSectionId.split(SectionId.#separator)[0]}static parseSectionName(qualifiedSectionId){return qualifiedSectionId.split(SectionId.#separator)[1]}static getIdForSection(sectionId,sectionName){return`${sectionId}${SectionId.#separator}${sectionName}`}}class HTMLUpdateUtility{static viewTransition(oldNode,newContent,preProcessCallbacks=[],postProcessCallbacks=[]){preProcessCallbacks?.forEach(callback=>callback(newContent));const newNodeWrapper=document.createElement("div");HTMLUpdateUtility.setInnerHTML(newNodeWrapper,newContent.outerHTML);const newNode=newNodeWrapper.firstChild,uniqueKey=Date.now();oldNode.querySelectorAll("[id], [form]").forEach(element=>{element.id&&(element.id=`${element.id}-${uniqueKey}`),element.form&&element.setAttribute("form",`${element.form.getAttribute("id")}-${uniqueKey}`)}),oldNode.parentNode.insertBefore(newNode,oldNode),oldNode.style.display="none",postProcessCallbacks?.forEach(callback=>callback(newNode)),setTimeout(()=>oldNode.remove(),500)}static setInnerHTML(element,html){element.innerHTML=html,element.querySelectorAll("script").forEach(oldScriptTag=>{const newScriptTag=document.createElement("script");Array.from(oldScriptTag.attributes).forEach(attribute=>{newScriptTag.setAttribute(attribute.name,attribute.value)}),newScriptTag.appendChild(document.createTextNode(oldScriptTag.innerHTML)),oldScriptTag.parentNode.replaceChild(newScriptTag,oldScriptTag)})}}document.querySelectorAll('[id^="Details-"] summary').forEach(summary=>{summary.setAttribute("role","button"),summary.setAttribute("aria-expanded",summary.parentNode.hasAttribute("open")),summary.nextElementSibling.getAttribute("id")&&summary.setAttribute("aria-controls",summary.nextElementSibling.id),summary.addEventListener("click",event=>{event.currentTarget.setAttribute("aria-expanded",!event.currentTarget.closest("details").hasAttribute("open"))}),!summary.closest("header-drawer, menu-drawer")&&summary.parentElement.addEventListener("keyup",onKeyUpEscape)});const trapFocusHandlers={};function trapFocus(container,elementToFocus=container){var elements=getFocusableElements(container),first=elements[0],last=elements[elements.length-1];removeTrapFocus(),trapFocusHandlers.focusin=event=>{event.target!==container&&event.target!==last&&event.target!==first||document.addEventListener("keydown",trapFocusHandlers.keydown)},trapFocusHandlers.focusout=function(){document.removeEventListener("keydown",trapFocusHandlers.keydown)},trapFocusHandlers.keydown=function(event){event.code.toUpperCase()==="TAB"&&(event.target===last&&!event.shiftKey&&(event.preventDefault(),first.focus()),(event.target===container||event.target===first)&&event.shiftKey&&(event.preventDefault(),last.focus()))},document.addEventListener("focusout",trapFocusHandlers.focusout),document.addEventListener("focusin",trapFocusHandlers.focusin),elementToFocus.focus(),elementToFocus.tagName==="INPUT"&&["search","text","email","url"].includes(elementToFocus.type)&&elementToFocus.value&&elementToFocus.setSelectionRange(0,elementToFocus.value.length)}try{document.querySelector(":focus-visible")}catch{focusVisiblePolyfill()}function focusVisiblePolyfill(){const navKeys=["ARROWUP","ARROWDOWN","ARROWLEFT","ARROWRIGHT","TAB","ENTER","SPACE","ESCAPE","HOME","END","PAGEUP","PAGEDOWN"];let currentFocusedElement=null,mouseClick=null;window.addEventListener("keydown",event=>{navKeys.includes(event.code.toUpperCase())&&(mouseClick=!1)}),window.addEventListener("mousedown",()=>{mouseClick=!0}),window.addEventListener("focus",()=>{currentFocusedElement&¤tFocusedElement.classList.remove("focused"),!mouseClick&&(currentFocusedElement=document.activeElement,currentFocusedElement.classList.add("focused"))},!0)}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&&model.modelViewerUI.pause()})}function removeTrapFocus(elementToFocus=null){document.removeEventListener("focusin",trapFocusHandlers.focusin),document.removeEventListener("focusout",trapFocusHandlers.focusout),document.removeEventListener("keydown",trapFocusHandlers.keydown),elementToFocus&&elementToFocus.focus()}function onKeyUpEscape(event){if(event.code.toUpperCase()!=="ESCAPE")return;const openDetailsElement=event.target.closest("details[open]");if(!openDetailsElement)return;const summaryElement=openDetailsElement.querySelector("summary");openDetailsElement.removeAttribute("open"),summaryElement.setAttribute("aria-expanded",!1),summaryElement.focus()}class QuantityInput extends HTMLElement{constructor(){super(),this.input=this.querySelector("input"),this.changeEvent=ne
1w Event("change",{bubbles:!0}),this.input.addEventListener("change",this.onInputChange.bind(this)),this.querySelectorAll("button").forEach(button=>button.addEventListener("click",this.onButtonClick.bind(this)))}quantityUpdateUnsubscriber=void 0;connectedCallback(){this.validateQtyRules(),this.quantityUpdateUnsubscriber=subscribe(PUB_SUB_EVENTS.quantityUpdate,this.validateQtyRules.bind(this))}disconnectedCallback(){this.quantityUpdateUnsubscriber&&this.quantityUpdateUnsubscriber()}onInputChange(){this.validateQtyRules()}onButtonClick(event){event.preventDefault();const previousValue=this.input.value;event.target.name==="plus"?parseInt(this.input.dataset.min)>parseInt(this.input.step)&&this.input.value==0?this.input.value=this.input.dataset.min:this.input.stepUp():this.input.stepDown(),previousValue!==this.input.value&&this.input.dispatchEvent(this.changeEvent),this.input.dataset.min===previousValue&&event.target.name==="minus"&&(this.input.value=parseInt(this.input.min))}validateQtyRules(){const value=parseInt(this.input.value);if(this.input.min&&this.querySelector(".quantity__button[name='minus']").classList.toggle("disabled",parseInt(value)<=parseInt(this.input.min)),this.input.max){const max=parseInt(this.input.max);this.querySelector(".quantity__button[name='plus']").classList.toggle("disabled",value>=max)}}}customElements.define("quantity-input",QuantityInput);function debounce(fn,wait){let t;return(...args)=>{clearTimeout(t),t=setTimeout(()=>fn.apply(this,args),wait)}}function throttle(fn,delay){let lastCall=0;return function(...args){const now=new Date().getTime();if(!(now-lastCall<delay))return lastCall=now,fn(...args)}}function fetchConfig(type="json"){return{method:"POST",headers:{"Content-Type":"application/json",Accept:`application/${type}`}}}typeof window.Shopify>"u"&&(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)return selector.selectedIndex=i,i}},Shopify.addListener=function(target,eventName,callback){target.addEventListener?target.addEventListener(eventName,callback,!1):target.attachEvent("on"+eventName,callback)},Shopify.postLink=function(path,options){options=options||{};var method=options.method||"post",params=options.parameters||{},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");value&&this.provinceEl.options.length>0&&Shopify.setSelectorByValue(this.provinceEl,value)},countryHandler:function(){var opt=this.countryEl.options[this.countryEl.selectedIndex],raw=opt.getAttribute("data-provinces"),provinces=JSON.parse(raw);if(this.clearOptions(this.provinceEl),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){for(;selector.firstChild;)selector.removeChild(selector.firstChild)},setOptions:function(selector,values){for(var i=0;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"),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:not(.localization-selector):not(.country-selector__close-button):not(.country-filter__reset-button)").forEach(button=>button.addEventListener("click",this.onCloseButtonClick.bind(this)))}onKeyUp(event){if(event.code.toUpperCase()!=="ESCAPE")return;const openDetailsElement=event.target.closest("details[open]");openDetailsElement&&(openDetailsElement===this.mainDetailsToggle?this.closeMenuDrawer(event,this.mainDetailsToggle.querySelector("summary")):this.closeSubmenu(openDetailsElement))}onSummaryClick(event){const summaryElement=event.currentTarget,detailsElement=summaryElement.parentNode,parentMenuElement=detailsElement.closest(".has-submenu"),isOpen=detailsElement.hasAttribute("open"),reducedMotion=window.matchMedia("(prefers-reduced-motion: reduce)");function addTrapFocus(){trapFocus(summaryElement.nextElementSibling,detailsElement.querySelector("button")),summaryElement.nextElementSibling.removeEventListener("transitionend",addTrapFocus)}detailsElement===this.mainDetailsToggle?(isOpen&&event.preventDefault(),isOpen?this.closeMenuDrawer(event,summaryElement):this.openMenuDrawer(summaryElement),window.matchMedia("(max-width: 990px)")&&document.documentElement.style.setProperty("--viewport-height",`${window.innerHeight}px`)):setTimeout(()=>{detailsElement.classList.add("menu-opening"),summaryElement.setAttribute("aria-expanded",!0),parentMenuElement&&parentMenuElement.classList.add("submenu-open"),!reducedMotion||reducedMotion.matches?addTrapFocus():summaryElement.nextElementSibling.addEventListener("transitionend",addTrapFocus)},100)}openMenuDrawer(summaryElement){setTimeout(()=>{this.mainDetailsToggle.classList.add("menu-opening")}),summaryElement.setAttribute("aria-expanded",!0),trapFocus(this.mainDetailsToggle,summaryElement),document.body.classList.add(`overflow-hidden-${this.dataset.breakpoint}`)}closeMenuDrawer(event,elementToFocus=!1){event!==void 0&&(this.mainDetailsToggle.classList.remove("menu-opening"),this.mainDetailsToggle.querySelectorAll("details").forEach(detail
1s=>{details.removeAttribute("open"),details.classList.remove("menu-opening")}),this.mainDetailsToggle.querySelectorAll(".submenu-open").forEach(submenu=>{submenu.classList.remove("submenu-open")}),document.body.classList.remove(`overflow-hidden-${this.dataset.breakpoint}`),removeTrapFocus(elementToFocus),this.closeAnimation(this.mainDetailsToggle),event instanceof KeyboardEvent&&elementToFocus?.setAttribute("aria-expanded",!1))}onFocusOut(){setTimeout(()=>{this.mainDetailsToggle.hasAttribute("open")&&!this.mainDetailsToggle.contains(document.activeElement)&&this.closeMenuDrawer()})}onCloseButtonClick(event){const detailsElement=event.currentTarget.closest("details");this.closeSubmenu(detailsElement)}closeSubmenu(detailsElement){const parentMenuElement=detailsElement.closest(".submenu-open");parentMenuElement&&parentMenuElement.classList.remove("submenu-open"),detailsElement.classList.remove("menu-opening"),detailsElement.querySelector("summary").setAttribute("aria-expanded",!1),removeTrapFocus(detailsElement.querySelector("summary")),this.closeAnimation(detailsElement)}closeAnimation(detailsElement){let animationStart;const handleAnimation=time=>{animationStart===void 0&&(animationStart=time),time-animationStart<400?window.requestAnimationFrame(handleAnimation):(detailsElement.removeAttribute("open"),detailsElement.closest("details[open]")&&trapFocus(detail
1sElement.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.querySelector(".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`),this.header.classList.add("menu-open"),setTimeout(()=>{this.mainDetailsToggle.classList.add("menu-opening")}),summaryElement.setAttribute("aria-expanded",!0),window.addEventListener("resize",this.onResize),trapFocus(this.mainDetailsToggle,summaryElement),document.body.classList.add(`overflow-hidden-${this.dataset.breakpoint}`)}closeMenuDrawer(event,elementToFocus){elementToFocus&&(super.closeMenuDrawer(event,elementToFocus),this.header.classList.remove("menu-open"),window.removeEventListener("resize",this.onResize))}onResize=()=>{this.header&&document.documentElement.style.setProperty("--header-bottom-position",`${parseInt(this.header.getBoundingClientRect().bottom-this.borderOffset)}px`),document.documentElement.style.setProperty("--viewport-height",`${window.innerHeight}px`)}}customElements.define("header-drawer",HeaderDrawer);class ModalDialog extends HTMLElement{constructor(){super(),this.querySelector('[id^="ModalClose-"]').addEventListener("click",this.hide.bind(this,!1)),this.addEventListener("keyup",event=>{event.code.toUpperCase()==="ESCAPE"&&this.hide()}),this.classList.contains("media-modal")?this.addEventListener("pointerup",event=>{event.pointerType==="mouse"&&!event.target.closest("deferred-media, product-model")&&this.hide()}):this.addEventListener("click",event=>{event.target===this&&this.hide()})}connectedCallback(){this.moved||(this.moved=!0,this.dataset.section=this.closest(".shopify-section").id.replace("shopify-section-",""),document.body.appendChild(this))}show(opener){this.openedBy=opener;const popup=this.querySelector(".template-popup");document.body.classList.add("overflow-hidden"),this.setAttribute("open",""),popup&&popup.loadContent(),trapFocus(this,this.querySelector('[role="dialog"]')),window.pauseAllMedia()}hide(){document.body.classList.remove("overflow-hidden"),document.body.dispatchEvent(new CustomEvent("modalClosed")),this.removeAttribute("open"),removeTrapFocus(this.openedBy),window.pauseAllMedia()}}customElements.define("modal-dialog",ModalDialog);class BulkModal extends HTMLElement{constructor(){super()}connectedCallback(){const handleIntersection=(entries,observer)=>{if(entries[0].isIntersecting&&(observer.unobserve(this),this.innerHTML.trim()==="")){const productUrl=this.dataset.url.split("?")[0];fetch(`${productUrl}?section_id=bulk-quick-order-list`).then(response=>response.text()).then(responseText=>{const sourceQty=new DOMParser().parseFromString(responseText,"text/html").querySelector(".quick-order-list-container").parentNode;this.innerHTML=sourceQty.innerHTML}).catch(e=>{console.error(e)})}};new IntersectionObserver(handleIntersection.bind(this)).observe(document.querySelector(`#QuickBulk-${this.dataset.productId}-${this.dataset.sectionId}`))}}customElements.define("bulk-modal",BulkModal);class ModalOpener extends HTMLElement{constructor(){super();const button=this.querySelector("button");button&&button.addEventListener("click",()=>{const modal=document.querySelector(this.getAttribute("data-modal"));modal&&modal.show(button)})}}customElements.define("modal-opener",ModalOpener);class DeferredMedia extends HTMLElement{constructor(){super();const poster=this.querySelector('[id^="Deferred-Poster-"]');poster&&poster.addEventListener("click",this.loadContent.bind(this))}loadContent(focus=!0){if(window.pauseAllMedia(),!this.getAttribute("loaded")){const content=document.createElement("div");content.appendChild(this.querySelector("template").content.firstElementChild.cloneNode(!0)),this.setAttribute("loaded",!0);const deferredElement=this.appendChild(content.querySelector("video, model-viewer, iframe"));focus&&deferredElement.focus(),deferredElement.nodeName=="VIDEO"&&deferredElement.getAttribute("autoplay")&&deferredElement.play();const formerStyle=deferredElement.getAttribute("style");deferredElement.setAttribute("style","display: block;"),window.setTimeout(()=>{deferredElement.setAttribute("style",formerStyle)}
1,0)}}}customElements.define("deferred-media",DeferredMedia);class SliderComponent extends HTMLElement{constructor(){if(super(),this.slider=this.querySelector('[id^="Slider-"]'),this.sliderItems=this.querySelectorAll('[id^="Slide-"]'),this.enableSliderLooping=!1,this.currentPageElement=this.querySelector(".slider-counter--current"),this.pageTotalElement=this.querySelector(".slider-counter--total"),this.prevButton=this.querySelector('button[name="previous"]'),this.nextButton=this.querySelector('button[name="next"]'),!this.slider||!this.nextButton)return;this.initPages(),new ResizeObserver(()=>this.initPages()).observe(this.slider),this.slider.addEventListener("scroll",this.update.bind(this)),this.prevButton.addEventListener("click",this.onButtonClick.bind(this)),this.nextButton.addEventListener("click",this.onButtonClick.bind(this))}initPages(){this.sliderItemsToShow=Array.from(this.sliderItems).filter(element=>element.clientWidth>0),!(this.sliderItemsToShow.length<2)&&(this.sliderItemOffset=this.sliderItemsToShow[1].offsetLeft-this.sliderItemsToShow[0].offsetLeft,this.slidesPerPage=Math.floor((this.slider.clientWidth-this.sliderItemsToShow[0].offsetLeft)/this.sliderItemOffset),this.totalPages=this.sliderItemsToShow.length-this.slidesPerPage+1,this.update())}resetPages(){this.sliderItems=this.querySelectorAll('[id^="Slide-"]'),this.initPages()}update(){if(!this.slider||!this.nextButton)return;const previousPage=this.currentPage;this.currentPage=Math.round(this.slider.scrollLeft/this.sliderItemOffset)+1,this.currentPageElement&&this.pageTotalElement&&(this.currentPageElement.textContent=this.currentPage,this.pageTotalElement.textContent=this.totalPages),this.currentPage!=previousPage&&this.dispatchEvent(new CustomEvent("slideChanged",{detail:{currentPage:this.currentPage,currentElement:this.sliderItemsToShow[this.currentPage-1]}})),!this.enableSliderLooping&&(this.isSlideVisible(this.sliderItemsToShow[0])&&this.slider.scrollLeft===0?this.prevButton.setAttribute("disabled","disabled"):this.prevButton.removeAttribute("disabled"),this.isSlideVisible(this.sliderItemsToShow[this.sliderItemsToShow.length-1])?this.nextButton.setAttribute("disabled","disabled"):this.nextButton.removeAttribute("disabled"))}isSlideVisible(element,offset=0){const lastVisibleSlide=this.slider.clientWidth+this.slider.scrollLeft-offset;return element.offsetLeft+element.clientWidth<=lastVisibleSlide&&element.offsetLeft>=this.slider.scrollLeft}onButtonClick(event){event.preventDefault();const step=event.currentTarget.dataset.step||1;this.slideScrollPosition=event.currentTarget.name==="next"?this.slider.scrollLeft+step*this.sliderItemOffset:this.slider.scrollLeft-step*this.sliderItemOffset,this.setSlidePosition(this.slideScrollPosition)}setSlidePosition(position){this.slider.scrollTo({left:position})}}customElements.define("slider-component",SliderComponent);class SlideshowComponent extends SliderComponent{constructor(){super(),this.sliderControlWrapper=this.querySelector(".slider-buttons"),this.enableSliderLooping=!0,this.sliderControlWrapper&&(this.sliderFirstItemNode=this.slider.querySelector(".slideshow__slide"),this.sliderItemsToShow.length>0&&(this.currentPage=1),this.announcementBarSlider=this.querySelector(".announcement-bar-slider"),this.announcerBarAnimationDelay=this.announcementBarSlider?250:0,this.sliderControlLinksArray=Array.from(this.sliderControlWrapper.querySelectorAll(".slider-counter__link")),this.sliderControlLinksArray.forEach(link=>link.addEventListener("click",this.linkToSlide.bind(this))),this.slider.addEventListener("scroll",this.setSlideVisibility.bind(this)),this.setSlideVisibility(),this.announcementBarSlider&&(this.announcementBarArrowButtonWasClicked=!1,this.reducedMotion=window.matchMedia("(prefers-reduced-motion: reduce)"),this.reducedMotion.addEventListener("change",()=>{this.slider.getAttribute("data-autoplay")==="true"&&this.setAutoPlay()}),[this.prevButton,this.nextButton].forEach(button=>{button.addEventListener("click",()=>{this.announcementBarArrowButtonWasClicked=!0},{once:!0})})),this.slider.getAttribute("data-autoplay")==="true"&&this.setAutoPlay())}setAutoPlay(){this.autoplaySpeed=this.slider.dataset.speed*1e3,this.addEventListener("mouseover",this.focusInHandling.bind(this)),this.addEventListener("mouseleave",this.focusOutHandling.bind(this)),this.addEventListener("focusin",this.focusInHandling.bind(this)),this.addEventListener("focusout",this.focusOutHandling.bind(this)),this.querySelector(".slideshow__autoplay")?(this.sliderAutoplayButton=this.querySelector(".slideshow__autoplay"),this.sliderAutoplayButton.addEventListener("click",this.autoPlayToggle.bind(this)),this.autoplayButtonIsSetToPlay=!0,this.play()):this.reducedMotion.matches||this.announcementBarArrowButtonWasClicked?this.pause():this.play()}onButtonClick(event){super.onButtonClick(event),this.wasClicked=!0;const isFirstSlide=this.currentPage===1,isLastSlide=this.currentPage===this.sliderItemsToShow.length;if(!isFirstSlide&&!isLastSlide){this.applyAnimationToAnnouncementBar(event.currentTarget.name);return}isFirstSlide&&event.currentTarget.name==="previous"?this.slideScrollPosition=this.slider.scrollLeft+this.sliderFirstItemNode.clientWidth*this.sliderItemsToShow.length:isLastSlide&&event.currentTarget.name==="next"&&(this.slideScrollPosition=0),this.setSlidePosition(this.slideScrollPosition),this.applyAnimationToAnnouncementBar(event.currentTarget.name)}
1setSlidePosition(position){this.setPositionTimeout&&clearTimeout(this.setPositionTimeout),this.setPositionTimeout=setTimeout(()=>{this.slider.scrollTo({left:position})},this.announcerBarAnimationDelay)}update(){super.update(),this.sliderControlButtons=this.querySelectorAll(".slider-counter__link"),this.prevButton.removeAttribute("disabled"),this.sliderControlButtons.length&&(this.sliderControlButtons.forEach(link=>{link.classList.remove("slider-counter__link--active"),link.removeAttribute("aria-current")}),this.sliderControlButtons[this.currentPage-1].classList.add("slider-counter__link--active"),this.sliderControlButtons[this.currentPage-1].setAttribute("aria-current",!0))}autoPlayToggle(){this.togglePlayButtonState(this.autoplayButtonIsSetToPlay),this.autoplayButtonIsSetToPlay?this.pause():this.play(),this.autoplayButtonIsSetToPlay=!this.autoplayButtonIsSetToPlay}focusOutHandling(event){if(this.sliderAutoplayButton){const focusedOnAutoplayButton=event.target===this.sliderAutoplayButton||this.sliderAutoplayButton.contains(event.target);if(!this.autoplayButtonIsSetToPlay||focusedOnAutoplayButton)return;this.play()}else!this.reducedMotion.matches&&!this.announcementBarArrowButtonWasClicked&&this.play()}focusInHandling(event){this.sliderAutoplayButton?(event.target===this.sliderAutoplayButton||this.sliderAutoplayButton.contains(event.target))&&this.autoplayButtonIsSetToPlay?this.play():this.autoplayButtonIsSetToPlay&&this.pause():this.announcementBarSlider.contains(event.target)&&this.pause()}play(){this.slider.setAttribute("aria-live","off"),clearInterval(this.autoplay),this.autoplay=setInterval(this.autoRotateSlides.bind(this),this.autoplaySpeed)}pause(){this.slider.setAttribute("aria-live","polite"),clearInterval(this.autoplay)}togglePlayButtonState(pauseAutoplay){pauseAutoplay?(this.sliderAutoplayButton.classList.add("slideshow__autoplay--paused"),this.sliderAutoplayButton.setAttribute("aria-label",window.accessibilityStrings.playSlideshow)):(this.sliderAutoplayButton.classList.remove("slideshow__autoplay--paused"),this.sliderAutoplayButton.setAttribute("aria-label",window.accessibilityStrings.pauseSlideshow))}autoRotateSlides(){const slideScrollPosition=this.currentPage===this.sliderItems.length?0:this.slider.scrollLeft+this.sliderItemOffset;this.setSlidePosition(slideScrollPosition),this.applyAnimationToAnnouncementBar()}setSlideVisibility(){this.sliderItemsToShow.forEach((item,index)=>{const linkElements=item.querySelectorAll("a");index===this.currentPage-1?(linkElements.length&&linkElements.forEach(button=>{button.removeAttribute("tabindex")}),item.setAttribute("aria-hidden","false"),item.removeAttribute("tabindex")):(linkElements.length&&linkElements.forEach(button=>{button.setAttribute("tabindex","-1")}),item.setAttribute("aria-hidden","true"),item.setAttribute("tabindex","-1"))}),this.wasClicked=!1}applyAnimationToAnnouncementBar(button="next"){if(!this.announcementBarSlider)return;const itemsCount=this.sliderItems.length,increment=button==="next"?1:-1,currentIndex=this.currentPage-1;let nextIndex=(currentIndex+increment)%itemsCount;nextIndex=nextIndex===-1?itemsCount-1:nextIndex;const nextSlide=this.sliderItems[nextIndex],currentSlide=this.sliderItems[currentIndex],animationClassIn="announcement-bar-slider--fade-in",animationClassOut="announcement-bar-slider--fade-out",isFirstSlide=currentIndex===0,isLastSlide=currentIndex===itemsCount-1,direction=button==="next"&&!isLastSlide||button==="previous"&&isFirstSlide?"next":"previous";currentSlide.classList.add(`${animationClassOut}-${direction}`),nextSlide.classList.add(`${animationClassIn}-${direction}`),setTimeout(()=>{currentSlide.classList.remove(`${animationClassOut}-${direction}`),nextSlide.classList.remove(`${animationClassIn}-${direction}`)},this.announcerBarAnimationDelay*2)}linkToSlide(event){event.preventDefault();const slideScrollPosition=this.slider.scrollLeft+this.sliderFirstItemNode.clientWidth*(this.sliderControlLinksArray.indexOf(event.currentTarget)+1-this.currentPage);this.slider.scrollTo({left:slideScrollPosition})}}customElements.define("slideshow-component",SlideshowComponent);class VariantSelects extends HTMLElement{constructor(){super()}connectedCallback(){this.addEventListener("change",event=>{const target=this.getInputForEventTarget(event.target);this.updateSelectionMetadata(event),publish(PUB_SUB_EVENTS.optionValueSelectionChange,{data:{event,target,selectedOptionValues:this.selectedOptionValues}})})}updateSelectionMetadata({target}){const{value,tagName}=target;console.log("ready");var dataProduct=document.querySelector("product-info");if(dataProduct&&!dataProduct.classList.contains("variant-selected")&&dataProduct.classList.add("variant-selected"),tagName==="SELECT"&&target.selectedOptions.length){Array.from(target.options).find(option=>option.getAttribute("selected")).removeAttribute("selected"),target.selectedOptions[0].setAttribute("selected","selected");const swatchValue=target.selectedOptions[0].dataset.optionSwatchValue,selectedDropdownSwatchValue=target.closest(".product-form__input").querySelector("[data-selected-value] > .swatch");if(!selectedDropdownSwatchValue)return;swatchValue?(selectedDropdownSwatchValue.style.setProperty("--swatch--background",swatchValue),selectedDropdownSwatchValue.classList.remove("swatch--unavailable")):(selectedDropdownSwatchValue.style.setProperty("--swatch--background","unset"),selectedDropdownSwatchValue.classList.add("swatch--unavailable")),selectedDropdownSwatchValue.style.setProperty("--swatch-focal-point",target.selectedOptions[0].dataset.optionSwatchFocalPoint||"unset")}else if(tagName==="INPUT"&&target.type==="radio"){const selectedSwatchValue=target.closest(".product-form__input").querySelector("[data-selected-value]");selectedSwatchValue&&(selectedSwatchValue.innerHTML=value)}}getInputForEventTarget(target){return target.tagName==="SELECT"?target.selectedOptions[0]:target}get selectedOptionValues(){return Array.from(this.querySelectorAll("select option[selected], fieldset input:checked")).map(({dataset})=>dataset.optionValueId)}}customElements.define("variant-selects",VariantSelects);class ProductRecommendations extends HTMLElement{observer=void 0;constructor(){super()}connectedCallback(){this.initializeRecommendations(this.dataset.productId)}initializeRecommendations(productId){this.observer?.unobserve(this),this.observer=new IntersectionObserver((entries,observer)=>{entries[0].isIntersecting&&(observer.unobserve(this),this.loadRecommendations(productId))},{rootMargin:"0px 0px 400px 0px"}),this.observer.observe(this)}loadRecommendations(productId){fetch(`${this.dataset.url}&product_id=${productId}§ion_id=${this.dataset.sectionId}`).then(response=>response.text()).then(text=>{const html=document.createElement("div");
1html.innerHTML=text;const recommendations=html.querySelector("product-recommendations");recommendations?.innerHTML.trim().length&&(this.innerHTML=recommendations.innerHTML),!this.querySelector("slideshow-component")&&this.classList.contains("complementary-products")&&this.remove(),html.querySelector(".grid__item")&&this.classList.add("product-recommendations--loaded")}).catch(e=>{console.error(e)})}}customElements.define("product-recommendations",ProductRecommendations);class AccountIcon extends HTMLElement{constructor(){super(),this.icon=this.querySelector(".icon")}connectedCallback(){document.addEventListener("storefront:signincompleted",this.handleStorefrontSignInCompleted.bind(this))}handleStorefrontSignInCompleted(event){event?.detail?.avatar&&this.icon?.replaceWith(event.detail.avatar.cloneNode())}}customElements.define("account-icon",AccountIcon);class BulkAdd extends HTMLElement{static ASYNC_REQUEST_DELAY=250;constructor(){super(),this.queue=[],this.setRequestStarted(!1),this.ids=[]}startQueue(id,quantity){this.queue.push({id,quantity});const interval=setInterval(()=>{this.queue.length>0?this.requestStarted||this.sendRequest(this.queue):clearInterval(interval)},BulkAdd.ASYNC_REQUEST_DELAY)}sendRequest(queue){this.setRequestStarted(!0);const items={};queue.forEach(queueItem=>{items[parseInt(queueItem.id)]=queueItem.quantity}),this.queue=this.queue.filter(queueElement=>!queue.includes(queueElement)),this.updateMultipleQty(items)}setRequestStarted(requestStarted){this._requestStarted=requestStarted}get requestStarted(){return this._requestStarted}resetQuantityInput(id){const input=this.querySelector(`#Quantity-${id}`);input.value=input.getAttribute("value"),this.isEnterPressed=!1}setValidity(event,index,message){event.target.setCustomValidity(message),event.target.reportValidity(),this.resetQuantityInput(index),event.target.select()}validateQuantity(event){const inputValue=parseInt(event.target.value),index=event.target.dataset.index;inputValue<event.target.dataset.min?this.setValidity(event,index,window.quickOrderListStrings.min_error.replace("[min]",event.target.dataset.min)):inputValue>parseInt(event.target.max)?this.setValidity(event,index,window.quickOrderListStrings.max_error.replace("[max]",event.target.max)):inputValue%parseInt(event.target.step)!=0?this.setValidity(event,index,window.quickOrderListStrings.step_error.replace("[step]",event.target.step)):(event.target.setCustomValidity(""),event.target.reportValidity(),event.target.setAttribute("value",inputValue),this.startQueue(index,inputValue))}getSectionInnerHTML(html,selector){return new DOMParser().parseFromString(html,"text/html").querySelector(selector).innerHTML}}customElements.get("bulk-add")||customElements.define("bulk-add",BulkAdd);class CartPerformance{static#metric_prefix="cart-performance";static createStartingMarker(benchmarkName){const metricName=`${CartPerformance.#metric_prefix}:${benchmarkName}`;return performance.mark(`${metricName}:start`)}static measureFromEvent(benchmarkName,event){const metricName=`${CartPerformance.#metric_prefix}:${benchmarkName}`;performance.mark(`${metricName}:start`,{startTime:event.timeStamp}),performance.mark(`${metricName}:end`),performance.measure(metricName,`${metricName}:start`,`${metricName}:end`)}static measureFromMarker(benchmarkName,startMarker){const metricName=`${CartPerformance.#metric_prefix}:${benchmarkName}`;performance.mark(`${metricName}:end`),performance.measure(metricName,startMarker.name,`${metricName}:end`)}static measure(benchmarkName,callback){const metricName=`${CartPerformance.#metric_prefix}:${benchmarkName}`;performance.mark(`${metricName}:start`),callback(),performance.mark(`${metricName}:end`),performance.measure(metricName,`${metricName}:start`,`${metricName}:end`)}}(function(){var select=document.getElementById("headboard-siblings-select");select&&select.addEventListener("change",function(e){var targetUrl=e.target.value;targetUrl&&typeof targetUrl=="string"&&window.location.assign(targetUrl)})})(),(function(){var select=document.getElementById("size-siblings-select");select&&select.addEventListener("change",function(e){var targetUrl=e.target.value;targetUrl&&typeof targetUrl=="string"&&window.location.assign(targetUrl)})})(),document.addEventListener("DOMContentLoaded",function(){const select_leg_height=document.getElementById("leg-height-select"),targets_leg_height=document.querySelectorAll(".leg-property-height");if(!select_leg_height||targets_leg_height.length===0)return;function updateLegHeightProperty(){const value=select_leg_height.value;targets_leg_height.forEach(el=>{el.tagName==="INPUT"||el.tagName==="TEXTAREA"?el.value=value:el.textContent=value})}updateLegHeightProperty(),select_leg_height.addEventListener("change",updateLegHeightProperty)}),document.addEventListener("DOMContentLoaded",function(){const toggle=d
1ocument.querySelector(".underbed-toggle"),content=document.querySelector(".accordion__content");toggle&&content&&toggle.addEventListener("click",function(){content.style.display=content.style.display==="none"?"block":"none"})});function selectUBS(index,liElement){document.querySelectorAll(".ubs li").forEach(li=>li.classList.remove("selected")),liElement.classList.add("selected"),console.log("Selected variant index:",index);const variantId=liElement.querySelector("a").dataset.variantId;console.log("Variant ID:",variantId)}class Accordion{constructor(el){this.el=el,this.summary=el.querySelector(".summary"),this.content=el.querySelector(".content"),this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.summary.addEventListener("click",e=>this.onClick(e))}onClick(e){e.preventDefault(),this.el.style.overflow="hidden",this.isClosing||!this.el.open?this.open():(this.isExpanding||this.el.open)&&this.shrink()}shrink(){this.isClosing=!0;const startHeight=`${this.el.offsetHeight}px`,endHeight=`${this.summary.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[startHeight,endHeight]},{duration:400,easing:"ease-out"}),this.animation.onfinish=()=>this.onAnimationFinish(!1),this.animation.oncancel=()=>this.isClosing=!1}open(){this.el.style.height=`${this.el.offsetHeight}px`,this.el.open=!0,requestAnimationFrame(()=>this.expand())}expand(){this.isExpanding=!0;const startHeight=`${this.el.offsetHeight}px`,endHeight=`${this.summary.offsetHeight+this.content.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[startHeight,endHeight]},{duration:400,easing:"ease-out"}),this.animation.onfinish=()=>this.onAnimationFinish(!0),this.animation.oncancel=()=>this.isExpanding=!1}onAnimationFinish(open){this.el.open=open,this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.el.style.height=this.el.style.overflow=""}}const accordionEls=document.querySelectorAll(".details");accordionEls.forEach(el=>el._accordion=new Accordion(el)),accordionEls.forEach(detail=>{detail.addEventListener("click",function(){accordionEls.forEach(other=>{other!==detail&&other.open&&(other._accordion.shrink(),other.style.overflow="hidden")})})}),document.querySelectorAll(".header__inline-menu .list-menu li").forEach(function(li){li.addEventListener("mouseenter",function(){const details=li.querySelector("details");details&&(details.open=!0)}),li.addEventListener("mouseleave",function(){const details=li.querySelector("details");details&&(details.open=!1)})}),Shopify.formatMoney=function(cents,format){typeof cents=="string"&&(cents=cents.replace(".",""));var value="",placeholderRegex=/{{\s*(\w+)\s*}}/,formatString=format||this.money_format;function defaultOption(opt,def){return typeof opt>"u"?def:opt}function formatWithDelimiters(number,precision,thousands,decimal){if(precision=defaultOption(precision,2),thousands=defaultOption(thousands,","),decimal=defaultOption(decimal,"."),isNaN(number)||number==null)return 0;number=(number/100).toFixed(precision);var parts=number.split("."),dollars=parts[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+thousands),cents2=parts[1]?decimal+parts[1]:"";return dollars+cents2}switch(formatString.match(placeholderRegex)[1]){case"amount":value=formatWithDelimiters(cents,2);break;case"amount_no_decimals":value=formatWithDelimiters(cents,0);break;case"amount_with_comma_separator":value=formatWithDelimiters(cents,2,".",",");break;case"amount_no_decimals_with_comma_separator":value=formatWithDelimiters(cents,0,".",",");break}return formatString.replace(placeholderRegex,value)},document.addEventListener("click",function(e){const opener=e.target.closest(".product__modal-opener");if(opener){const parent=opener.closest("product-info");parent&&parent.classList.add("active")}}),document.addEventListener("click",function(e){const closer=e.target.closest(".modal-close-custom");if(closer){const parent=closer.closest("product-info");parent&&parent.classList.remove("active")}}),document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll("img.image-load").forEach(function(img){const dataSrc=img.getAttribute("data-src"),dataSrcset=img.getAttribute("data-srcset");dataSrc&&!img.getAttribute("src")&&img.setAttribute("src",dataSrc),dataSrcset&&!img.getAttribute("srcset")&&img.setAttribute("srcset",dataSrcset)})}),(function(){const COOKIE_NAME="selected_variants_global",LEG_COOKIE="selected_leg_global";function removeLoader(){const configurator=document.querySelector(".product-configurator");configurator&&configurator.classList.remove("variant-loading")}function getCookie(name){const match=document.cookie.match(new RegExp("(?:^|; )"+name+"=([^;]*)"));try{return match?JSON.parse(decodeURIComponent(match[1])):{}}catch{return{}}}function setCookie(name,value,days){days=days||30;const expires=new Date(Date.now()+days*864e5).toUTCString();document.cookie=name+"="+encodeURIComponent(JSON.stringify(value))+"; expires="+expires+"; path=/"}function isVariantInURL(){return new URLSearchParams(window.location.search).has("variant")}function normalizeOptionName(name){return name.trim().toLowerCase().replace(/-\d+\s*$/,"").trim()}function normalizeOptionValue(value){return value.trim().toLowerCase()}function saveVariantToCookie(){const all=getCookie(COOKIE_NAME);document.querySelectorAll('.product-configurator variant-selects input[type="radio"]:checked').forEach(function(input){all[normalizeOptionName(input.name)]=normalizeOptionValue(input.value)}),document.querySelectorAll(".product-configurator variant-selects select").forEach(function(select){all[normalizeOptionName(select.name)]=normalizeOptionValue(select.value)}),setCookie(COOKIE_NAME,all)}function bindVariantChangeListeners(){window.variantCookieListenerAdded||(window.variantCookieListenerAdded=!0,document.addEventListener("change",function(event){var target=event.target;(target.matches('.product-configurator variant-selects input[type="radio"]')||target.matches(".product-configurator variant-selects select"))&&saveVariantToCookie()}))}function restoreRadioGroup(inputs,savedValue,triggerClick){inputs.forEac
1h(function(input2){input2.checked=!1});for(var i=0;i<inputs.length;i++){var input=inputs[i];if(normalizeOptionValue(input.value)===savedValue){if(triggerClick){if(input.click(),!(name=>{const match=document.cookie.match(new RegExp("(^| )"+name+"=([^;]+)"));return match?decodeURIComponent(match[2]):""})("selected_variants_global")){const configurator=document.querySelector(".product-configurator");configurator&&configurator.classList.contains("variant-loading")&&configurator.classList.remove("variant-loading")}console.log("ready")}else input.checked=!0,console.log("ready");return!0}}return!1}function get_cookie(cname){let name=cname+"=",ca=decodeURIComponent(document.cookie).split(";");for(let i=0;i<ca.length;i++){let c=ca[i];for(;c.charAt(0)==" ";)c=c.substring(1);if(c.indexOf(name)==0)return c.substring(name.length,c.length)}return""}function restoreVariantFromCookie(){console.log("restoreVariantFromCookie");var saved=getCookie(COOKIE_NAME),saved_leg=get_cookie("selected_leg_global");if(!Object.keys(saved).length){removeLoader();return}var leg_element=document.querySelector('.product-configurator .legheightDropdown .legheight .legheight-main[value="'+saved_leg+'"]');console.log(leg_element,"leg_element",saved_leg),leg_element&&leg_element.click();var elements=Array.from(document.querySelectorAll('.product-configurator variant-selects input[type="radio"], .product-configurator variant-selects select'));if(!elements.length){removeLoader();return}var groups={},orderedKeys=[];elements.forEach(function(el){var key=normalizeOptionName(el.name);groups[key]||(groups[key]=[],orderedKeys.push(key)),groups[key].push(el)});var keysToRestore=orderedKeys.filter(function(key){return saved[key]!==void 0});if(!keysToRestore.length){removeLoader();return}keysToRestore.forEach(function(key,index){var isLast=index===keysToRestore.length-1,savedValue=saved[key],group=groups[key];if(group[0].type==="radio"){restoreRadioGroup(group,savedValue,isLast);return}var select=group[0],option=Array.from(select.options).find(function(opt){return normalizeOptionValue(opt.value)===savedValue});console.log("option",option),option?(select.value=option.value,isLast&&(select.dispatchEvent(new Event("change",{bubbles:!0})),setTimeout(function(){removeLoader()},1500))):setTimeout(function(){removeLoader()},1500)})}bindVariantChangeListeners(),setTimeout(function(){if(isVariantInURL()){removeLoader();return}restoreVariantFromCookie()},100)})();function bed_set_cookie(){const COOKIE_NAME="selected_variants_global",COOKIE_LEG_NAME="selected_leg_global";function saveCardVariantCookie(data){const expires=new Date(Date.now()+2592e6).toUTCString();document.cookie=COOKIE_NAME+"="+encodeURIComponent(JSON.stringify(data))+"; expires="+expires+"; path=/"}function saveCardLegCookie(data){const expires=new Date(Date.now()+2592e6).toUTCString();document.cookie=COOKIE_LEG_NAME+"="+encodeURIComponent(data)+"; expires="+expires+"; path=/"}document.querySelectorAll(".card-grid-section .card-link").forEach(function(link){link.addEventListener("click",function(event){event.preventDefault();var href=this.href;console.log(href,"href");var options=this.getAttribute("data-options"),values=this.getAttribute("data-value"),legHeight=this.getAttribute("data-legheight");if(options&&values){for(var cookieData={},optionArray=options.split(","),valueArray=values.split(","),i=0;i<optionArray.length;i++)cookieData[optionArray[i].trim().toLowerCase()]=(valueArray[i]||"").trim().toLowerCase();console.log("Saving variant cookie:",cookieData),saveCardVariantCookie(cookieData)}legHeight&&(console.log("Saving leg cookie:",legHeight),saveCardLegCookie(legHeight)),setTimeout(function(){window.location.href=href},50)})})}(function(){const COOKIE_LEG_NAME="selected_leg_global";function getLegCookie(){const name=COOKIE_LEG_NAME+"=",cookies=document.cookie.split(";");for(let i=0;i<cookies.length;i++){let cookie=cookies[i].trim();if(cookie.indexOf(name)===0)return decodeURIComponent(cookie.substring(name.length))}return""}function saveLegCookie(value){const expires=new Date(Date.now()+2592e6).toUTCString();document.cookie=COOKIE_LEG_NAME+"="+encodeURIComponent(value)+"; expires="+expires+"; path=/"}document.querySelectorAll(".product-configurator").forEach(function(configurator){const radios=configurator.querySelectorAll(".leghe
1ight-main");if(!radios.length)return;const savedValue=getLegCookie(),previewImgss=document.querySelector(".product-option.image-label img");savedValue&&radios.forEach(function(radio){if(radio.value===savedValue){radio.checked=!0;const label=radio.closest("label"),img=label?label.querySelector("img"):null;img&&previewImgss&&(previewImgss.src=img.src,previewImgss.alt=img.alt||""),radio.dispatchEvent(new Event("change",{bubbles:!0})),document.querySelector("product-info")&&(document.querySelector("product-info").classList.contains("variant-selected")||document.querySelector("product-info").classList.add("variant-selected"))}}),radios.forEach(function(radio){radio.addEventListener("change",function(){this.checked&&saveLegCookie(this.value)})})})})();function runFilters(){var fetchRecords=!0;const result=[];let spanActive=!1;function hideFilter(){document.querySelectorAll(".card-grid-section.active-card").forEach(card=>{card.querySelectorAll(".multicolumn-list__item").forEach(multiColumn=>{const sectionInfo=multiColumn.getAttribute("data-info");if(sectionInfo){const sectionArray=sectionInfo.split(",").map(item=>item.trim().toLowerCase());result.push(...sectionArray)}})});const uniqueResult=[...new Set(result)];console.log(uniqueResult,"uniqueResult");const spans=document.querySelectorAll(".collection-richtext .rich-text__buttons span[data-main]");let firstActiveSpan=document.querySelector(".collection-richtext .rich-text__buttons.tab-active span.active[data-main]");spans.forEach(span=>{const dataMain=span.getAttribute("data-main")?.trim().toLowerCase(),parentDiv=span.parentElement;parentDiv.classList.remove("no-active"),parentDiv.classList.remove("tab-active"),parentDiv&&(uniqueResult.includes(dataMain)?(parentDiv.style.display="",parentDiv.classList.add("tab-active"),firstActiveSpan||(firstActiveSpan=span)):(parentDiv.style.display="none",parentDiv.classList.add("no-active")))}),firstActiveSpan||(firstActiveSpan=document.querySelector(".collection-richtext .rich-text__buttons.tab-active span[data-main]")),firstActiveSpan&&(fetchRecords=!1,firstActiveSpan.click())}document.addEventListener("click",function(e){if(!e.target.classList.contains("btn-filter"))return;console.log("click",spanActive);var btn=e.target,filterValue=btn.getAttribute("data-main"),rawLabel=btn.textContent.trim(),items=document.querySelectorAll(".filters-list");function normalize(s){return String(s).toLowerCase().replace(/[\u2018\u2019\u201A\u201B\u2032]/g,"'").replace(/[\u201C\u201D\u201E\u201F\u2033]/g,'"').replace(/[\u2013\u2014\u2212]/g,"-").replace(/-/g," ").replace(/\s+/g," ").trim()}function getCollectionHandle(){var path=window.location.pathname.toLowerCase(),m=path.match(/\/collections\/([^\/\?#]+)/);return m?normalize(m[1].replace(/-beds$/,"")):""}function extractSize(title){var n=normalize(title),idx=n.lastIndexOf(" in ");if(idx===-1)return n;var tail=n.slice(idx+4);return tail=tail.split(",")[0].split("(")[0].trim(),normalize(tail)}function findSibling(data,size){if(!data||!data.siblings||!data.siblings.length)return null;for(var target=normalize(size),i=0;i<data.siblings.length;i++)if(extractSize(data.siblings[i].title)===target)return data.siblings[i];for(var i=0;i<data.siblings.length;i++){var sz=extractSize(data.siblings[i].title),re=new RegExp("(^|\\s)"+target.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"($|\\s)");if(re.test(sz))return data.siblings[i]}return null}function parseData(card){var s=card.querySelector("script.js-product-bad-variants");if(!s)return null;try{return JSON.parse(s.textContent)}catch{return null}}function moneyToNumber(str){if(str==null)return null;var cleaned=String(str).replace(/[^0-9.\-]/g,"");if(cleaned===""||cleaned==="-"||cleaned===".")return null;var n=parseFloat(cleaned);return isNaN(n)?null:n}function snapshot(card){if(card.dataset.sibSnap!=="1"){var priceEl=card.querySelector(".save_price"),crossWrap=card.querySelector(".cross_price"),crossEl=card.querySelector(".cross_price s"),saveWrap=card.querySelector(".save_per"),saveSpan=card.querySelector(".save_per-title span"),linkEl=card.querySelector(".card-link");priceEl&&(card.dataset.snapPrice=priceEl.innerHTML),crossEl&&(card.dataset.snapCross=crossEl.innerHTML),crossWrap&&(card.dataset.snapCrossDisplay=crossWrap.style.display||""),saveSpan&&(card.dataset.snapSave=saveSpan.innerHTML),saveWrap&&(card.dataset.snapSaveDisplay=saveWrap.style.display||""),linkEl&&(card.dataset.snapHref=linkEl.getAttribute("href")||""),card.dataset.sibSnap="1"}}function restore(card){if(card.dataset.sibSnap==="1"){var priceEl=card.querySelector(".save_price"),crossWrap=card.querySelector(".cross_price"),crossEl=card.querySelector(".cross_price s"),saveWrap=card.querySelector(".save_per"),saveSpan=card.querySelector(".save_per-title span"),linkEl=card.querySelector(".card-link");priceEl&&card.dataset.snapPrice!==void 0&&(priceEl.innerHTML=card.dataset.snapPrice),crossEl&&card.dataset.snapCross!==void 0&&(crossEl.innerHTML=card.dataset.snapCross),crossWrap&&card.dataset.snapCrossDisplay!==void 0&&(crossWrap.style.display=card.dataset.snapCrossDisplay),saveSpan&&card.dataset.snapSave!==void 0&&(saveSpan.innerHTML=card.dataset.snapSave),saveWrap&&card.dataset.snapSaveDisplay!==void 0&&(saveWrap.style.display=card.dataset.snapSaveDisplay),linkEl&&card.dataset.snapHref!==void 0&&linkEl.setAttribute("href",card.dataset.snapHref)}}function applySibling(card,sibling){snapshot(card);var priceEl=card.querySelector(".save_price"),crossWrap=card.querySelector(".cross_price"),crossEl=card.querySelector(".cross_price s"),saveWrap=card.querySelector(".save_per"),saveSpan=card.querySelector(".save_per-title span"),linkEl=card.querySelector(".card-link"),priceNum=moneyToNumber(sibling.price),compareNum=moneyToNumber(sibling.comparePrice),hasDiscount=priceNum!==null&&compareNum!==null&&compareNum>priceNum;if(priceEl&&sibling.price&&(hasDiscount?priceEl.innerHTML='<span class="save-label">Save</span> '+sibling.price:priceEl.innerHTML=sibling.price),crossEl&&(crossEl.innerHTML=hasDiscount?sibling.comparePrice:""),crossWrap&&(crossWrap.style.display=hasDiscount?"":"none"),saveWrap&&saveSpan)if(hasDiscount){var savePct=Math.round((compareNum-priceNum)/compareNum*100);console.log(savePct,"savePct"),saveSpan.innerHTML=savePct+"%",saveWrap.style.display=""}else saveWrap.style.display="none";linkEl&&sibling.url&&linkEl.setAttribute("href",sibling.url)}function updateSections(filterValue2){var collectionHandle=getCollectionHandle(),activeFilter=normalize(filterValue2);document.querySelectorAll("[data-section-info]").forEach(function(sec){var sinfo=sec.getAttribute("data-section-info")||"",values=sinfo.split(",").map(function(s){return normalize(s)}),matchesFilter=values.indexOf(activeFilter)!==-1,matchesCollection=values.indexOf(collectionHandle)!==-1,wrap=sec.closest(".shopify-section")||sec;wrap.style.display=matchesFilter&&matchesCollection?"":"none",wrap.classList.toggle("active-card",matchesFilter&&matchesCollection)}),!spanActive&&hideFilter()}document.querySelectorAll(".btn-filter").forEach(function(b){b.classList.remove("active")}
1),btn.classList.add("active"),items.forEach(function(item){const link=item.querySelector(".multicolumn-card a.card-link");if(link&&(link.href=link.href.replace(/-in-.*/,`-in-${filterValue}`),fetchRecords==!0)){let handle2=link.getAttribute("href").split("/").pop(),data_options=encodeURIComponent(link.getAttribute("data-options")),data_values=encodeURIComponent(link.getAttribute("data-value")),url2=`https://api.glazedigital.com/warren-evans-api/get-variant.php?handle=${handle2}&data-options=${data_options}&data-value=${data_values}`;fetch(`${url2}`).then(res=>res.json()).then(data=>{let price=data.price?.amount??0,compare=data.compareAtPrice?.amount??0,parent_ele=link.closest(".multicolumn-card"),price_ele=parent_ele.querySelector(".cross_price-wrap .save_price");price&&price_ele!=null&&(price_ele.innerHTML=Shopify.formatMoney(data.price.amount*100));let compare_ele=parent_ele.querySelector(".cross_price-wrap .cross_price s");compare&&compare_ele!=null&&(compare_ele.innerHTML=Shopify.formatMoney(data.compareAtPrice.amount*100));let newSave=calculateSavingsPercent(price,compare),currentSave=parent_ele.querySelector(".save_per span");newSave&¤tSave!=null&&compare>0&¤tSave&&(currentSave.innerHTML=`${newSave}%`)})}}),fetchRecords==!1&&(fetchRecords=!0),updateSections(filterValue),localStorage.setItem("activeBedFilter",filterValue)});function calculateSavingsPercent(price,compareAtPrice){const currentPrice=parseFloat(price),originalPrice=parseFloat(compareAtPrice);if(!originalPrice||originalPrice<=currentPrice)return 0;const savings=(originalPrice-currentPrice)/originalPrice*100;return Math.round(savings)}function getHandle(){var path=window.location.pathname.toLowerCase(),m=path.match(/\/collections\/([^\/\?#]+)/);return m?m[1].replace(/-beds$/,"").trim():""}function init(){if(!document.querySelector(".btn-filter")){document.dispatchEvent(new CustomEvent("runFiltersComplete"));return}var savedFilter=localStorage.getItem("activeBedFilter"),key=savedFilter||getHandle(),btn=Array.prototype.slice.call(document.querySelectorAll(".btn-filter")).filter(function(b){return(b.getAttribute("data-main")||"").toLowerCase()===key.toLowerCase()})[0],activeBtn=document.querySelector(".btn-filter.active");if(activeBtn){var link=window.location.href.split("/").pop();link==="beds-sale"||link==="off-sale-beds"?spanActive=!0:spanActive=!1,activeBtn.classList.remove("active"),setTimeout(function(){fetchRecords=!1,activeBtn.click(),document.dispatchEvent(new CustomEvent("runFiltersComplete"))},1e3)}}var url=window.location.href,handle=url.split("/").pop();handle=handle.replace(/-beds$/,"");let spanEle=document.querySelector(`.collection-richtext .rich-text__buttons span[data-main="${handle}"]`);spanEle&&(spanActive=!0,spanEle.click(),console.log(spanEle,"spanEle")),console.log(spanActive,"spanActive",handle),spanActive||setTimeout(function(){init()},100)}document.addEventListener("DOMContentLoaded",async()=>{const wrappers=document.querySelectorAll(".get-collection-wrapper");wrappers.length&&(await Promise.all(Array.from(wrappers).map(async wrapper=>{const pageUrl=wrapper.dataset.collectionUrl,html=await fetch(pageUrl).then(res=>res.text()),main=new DOMParser().parseFromString(html,"text/html").querySelector("main");main&&(wrapper.innerHTML=main.innerHTML),window.location.pathname.includes("/collections/platform-beds")&&wrapper.querySelectorAll(".card_grid_weekly-li").forEach(item=>{item.classList.contains("platform-beds")||item.remove()})})),bed_set_cookie(),document.addEventListener("runFiltersComplete",()=>{const activeFilterBtn=document.querySelector(".btn-filter.active");activeFilterBtn&&activeFilterBtn.click()},{once:!0}),runFilters())});function saveUnderbedStorageCookie(){const selected=[];document.querySelectorAll(".underbed_storage_input:checked").forEach(input=>{selected.push(input.dataset.variantid)}),selected.length!==0&&(document.cookie=`underbed_storage=${encodeURIComponent(JSON.stringify(selected))}; path=/; max-age=${3600*24*30}`)}function restoreUnderbedStorageCookie(){const cookie=document.cookie.split("; ").find(row=>row.startsWith("underbed_storage="));if(!cookie)return;const value=decodeURIComponent(cookie.split("=")[1]);if(!value)return;JSON.parse(value).forEach(variantId=>{const input=document.querySelector(`.underbed_storage_input[data-variantid="${variantId}"]`);input&&(input.checked=!0,input.dispatchEvent(new Event("change",{bubbles:!0})))})}document.addEventListener("change",function(e){e.target.classList.contains("underbed_storage_input")&&saveUnderbedStorageCookie()}),document.addEventListener("DOMContentLoaded",function(){document.cookie="underbed_storage=; path=/; max-age=0"}),document.addEventListener("retoreUnderBed",function(event){restoreUnderbedStorageCookie()}),document.addEventListener("DOMContentLoaded",function(){function updatePostalError(){var tab3=document.querySelector('[rel="cs-tab3"]'),errors=document.querySelectorAll("#postal-code-error"),error=errors[errors.length-1];!tab3||!error||tab3.classList.contains("active")&&setTimeout(function(){error.textContent="Please select date and time. Note the delivery address on the next page will be pre populated with our N11 2UD workshop collection address above."},50)}document.addEventListener("click",function(e){var tab=e.target.closest('[rel="cs-tab2"], [rel="cs-tab3"]');tab&&tab.getAttribute("rel")==="cs-tab3"&&setTimeout(function(){updatePostalError()},50)})}); 2//# sourceMappingURL=/cdn/shop/t/4/assets/global.js.map?v=127629052534015707281790761055
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.