PageSourceSearch

https://mantasleep.com/cdn/shop/t/341/assets/section-product-features.js?v=56075402615643049411780406389

js mantasleep.com collected 2026-09-24 19:22:31 UTC 8,832 bytes, 2 lines download raw bytes

1(function(){"use strict";class ProductFeaturesSection extends HTMLElement{constructor(){super(),this.sliderElement=this.querySelector(".js-product-features-slider"),this.sliderElement&&(this.sectionId=this.sliderElement.id,this.extractedSectionId=this.id.replace("ProductFeatures-",""),this.blockCount=parseInt(this.dataset.blockCount||"0"),this.stickyPdpForm=document.querySelector("[data-sticky-pdp-form]"),this.mainSplide=null,this.modalTextSlider=null,this.modalImageSlider=null,this.modal=document.getElementById("ProductFeaturesModal-"+this.extractedSectionId),this.lastFocusedElement=null,this.focusableElements='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',this.handleResize=this.debounce(this.updateSlider.bind(this),250),this.handleKeydown=this.handleEscapeKey.bind(this),this.trapFocusHandler=this.trapFocus.bind(this),this.prefersReducedMotion=window.matchMedia("(prefers-reduced-motion: reduce)"),this.handleMotionChange=this.handleReducedMotionChange.bind(this),this.init())}init(){if(typeof Splide>"u"){setTimeout(()=>this.init(),50);return}this.initSlider(),this.initVideoControls(),this.modal&&this.setupModal(),window.addEventListener("resize",this.handleResize),this.prefersReducedMotion.addEventListener("change",this.handleMotionChange)}shouldEnableSlider(){const isMobile=window.innerWidth<1024,hasEnoughBlocks=this.blockCount>=5;return isMobile||hasEnoughBlocks}initSlider(){this.mainSplide=window.SplideUtils.initSplideWithControls(this.sliderElement,this,{type:"carousel",rewind:!0,perPage:4,perMove:1,gap:"1.5rem",padding:{left:0,right:0},arrows:!1,pagination:!1,trimSpace:"move",drag:this.shouldEnableSlider(),breakpoints:{1024:{perPage:3,trimSpace:"move"},767:{perPage:2,gap:"1rem",trimSpace:"move",padding:{right:"22%"},drag:!0},576:{perPage:1,gap:"1rem",padding:{right:"22%"}
1,trimSpace:"move",drag:!0}},i18n:{prev:"Previous slide",next:"Next slide",first:"Go to first slide",last:"Go to last slide",slideX:"Go to slide %s",pageX:"Go to page %s",play:"Start autoplay",pause:"Pause autoplay"}},{customArrows:!0,scrollbar:!0,tabindex:!0}),this.updateSlider()}updateSlider(){if(!this.mainSplide)return;this.shouldEnableSlider()?(this.classList.add("slider-active"),this.mainSplide.options.drag=!0,this.mainSplide.refresh()):(this.classList.remove("slider-active"),this.mainSplide.options.drag=!1,this.mainSplide.go(0),this.mainSplide.refresh())}initVideoControls(){this.querySelectorAll("[data-decorative-video]").forEach(video=>{this.prefersReducedMotion.matches&&video.pause(),video.addEventListener("click",()=>{this.prefersReducedMotion.matches&&(video.paused?video.play():video.pause())})})}handleReducedMotionChange(e){this.querySelectorAll("[data-decorative-video]").forEach(video=>{e.matches?video.pause():video.play().catch(()=>{})})}setupModal(){if(!this.modal)return;const modalTextSliderEl=document.getElementById("product-features-modal-slider-"+this.extractedSectionId),modalImageSliderEl=document.getElementById("product-features-modal-image-slider-"+this.extractedSectionId);if(!modalTextSliderEl||!modalImageSliderEl)return;this.modalTextSliderEl=modalTextSliderEl,this.modalImageSliderEl=modalImageSliderEl,this.querySelectorAll(".js-open-feature-modal").forEach(button=>{button.addEventListener("click",e=>{e.preventDefault();const index=parseInt(button.getAttribute("data-feature-index"));this.openModal(index)})}),this.modal.querySelectorAll("[data-modal-close]").forEach(button=>{button.addEventListener("click",()=>this.closeModal())}),document.addEventListener("keydown",this.handleKeydown)}
1initModalSliders(startIndex){if(!(!this.modalTextSliderEl||!this.modalImageSliderEl)){if(this.modalTextSlider){try{this.modalTextSlider.destroy()}catch(e){console.warn("Error destroying text slider:",e)}this.modalTextSlider=null}if(this.modalImageSlider){try{this.modalImageSlider.destroy()}catch(e){console.warn("Error destroying image slider:",e)}this.modalImageSlider=null}this.modalTextSlider=new Splide(this.modalTextSliderEl,{type:"fade",rewind:!0,arrows:!1,pagination:!1,drag:!1,start:startIndex,speed:0}),this.modalImageSlider=new Splide(this.modalImageSliderEl,{type:"loop",rewind:!0,loop:!0,arrows:!1,pagination:!1,perPage:1,perMove:1,gap:"1rem",padding:{right:"20%",left:0},focus:"left",trimSpace:!1,drag:!0,start:startIndex,speed:0,breakpoints:{1099:{padding:{right:"8%",left:0}},767:{padding:{right:"25%",left:"25%"},focus:"center"},576:{padding:{right:"15%",left:"15%"},focus:"center"},479:{padding:{right:"10%",left:"10%"},focus:"center"}}}),this.modalTextSlider.on("moved",newIndex=>{this.modal.setAttribute("aria-labelledby",`product-features-modal-title-${this.extractedSectionId}-${newIndex}`)}),this.modalTextSlider.on("mounted",()=>{requestAnimationFrame(()=>{this.modalTextSlider.refresh(),this.modalImageSlider.refresh(),requestAnimationFrame(()=>{this.modalTextSlider.go(startIndex),this.modalImageSlider.go(startIndex),requestAnimationFrame(()=>{this.modalTextSlider.options.speed=600,this.modalImageSlider.options.speed=600})})})}),this.modalImageSlider.sync(this.modalTextSlider),this.modalTextSlider.mount(),this.modalImageSlider.mount(),window.SplideUtils.setupSliderControls(this.modalImageSlider,this.modal,{customArrows:!0,arrowSelectors:{prev:".js-modal-arrow-prev",next:".js-modal-arrow-next"},scrollbar:!0}),this.initModalVideoControls()}}initModalVideoControls(){this.modal.querySelectorAll("[data-decorative-video]").forEach(video=>{this.prefersReducedMotion.matches&&video.pause(),video._hasClickHandler||(video._hasClickHandler=!0,video.addEventListener("click",()=>{this.prefersReducedMotion.matches&&(video.paused?video.play():video.pause())}))})}trapFocus(e){if(e.key!=="Tab")return;const focusableElements=Array.from(this.modal.querySelectorAll(this.focusableElements)).filter(el=>el.offsetParent!==null&&!el.disabled);if(focusableElements.length===0)return;const firstFocusable=focusableElements[0],lastFocusable=focusableElements[focusableElements.length-1];e.shiftKey&&document.activeElement===firstFocusable?(e.preventDefault(),lastFocusable.focus()):!e.shiftKey&&document.activeElement===lastFocusable&&(e.preventDefault(),firstFocusable.focus())}setPageInert(isInert){let current=this.modal;for(;current&&current.parentElement;){const parent=current.parentElement,siblings=parent.children;for(let i=0;i<siblings.length;i++){const sibling=siblings[i];sibling===current||sibling.tagName==="SCRIPT"||sibling.tagName==="STYLE"||(isInert?sibling.setAttribute("inert",""):sibling.removeAttribute("inert"))}if(parent===document.body)break;current=parent}}openModal(index){if(typeof Splide>"u"){console.warn("Splide not loaded yet, cannot open modal");return}this.stickyPdpForm&&this.stickyPdpForm.classList.remove("is-visible"),this.lastFocusedElement=document.activeElement,this.modal.classList.add("is-active"),document.body.classList.add("modal-open"),this.modal.setAttribute("aria-hidden","false"),this.modal.setAttribute("aria-labelledby",`product-features-modal-title-${this.extractedSectionId}-${index}`),this.setPageInert(!0),requestAnimationFrame(()=>{this.initModalSliders(index)}),document.addEventListener("keydown",this.trapFocusHandler);const closeButton=this.modal.querySelector(".product-features-modal__close");closeButton&&setTimeout(()=>{closeButton.focus()},100)}closeModal(){this.stickyPdpForm&&this.stickyPdpForm.classList.add("is-visible"),this.modal.classList.remove("is-active"),document.body.classList.remove("modal-open"),this.modal.setAttribute("aria-hidden","true"),this.setPageInert(!1),document.removeEventListener("keydown",this.trapFocusHandler),this.lastFocusedElement&&(this.lastFocusedElement.focus(),this.lastFocusedElement=null)}handleEscapeKey(e){e.key==="Escape"&&this.modal&&this.modal.classList.contains("is-active")&&this.closeModal()}debounce(func,wait){let timeout;return function(...args){const later=()=>{clearTimeout(timeout),func(...args)};clearTimeout(timeout),timeout=setTimeout(later,wait)}}disconnectedCallback(){if(window.removeEventListener("resize",this.handleResize),document.removeEventListener("keydown",this.handleKeydown),document.removeEventListener("keydown",this.trapFocusHandler),this.prefersReducedMotion.removeEventListener("change",this.handleMotionChange),this.mainSplide)try{this.mainSplide.destroy()}catch(e){console.warn("Error destroying main slider:",e)}if(this.modalTextSlider)try{this.modalTextSlider.destroy()}catch(e){console.warn("Error destroying modal text slider:",e)}if(this.modalImageSlider)try{this.modalImageSlider.destroy()}catch(e){console.warn("Error destroying modal image slider:",e)}}}customElements.get("product-features-section")===void 0&&customElements.define("product-features-section",ProductFeaturesSection)})();
2//# sourceMappingURL=/cdn/shop/t/341/assets/section-product-features.js.map?v=56075402615643049411780406389

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.