PageSourceSearch

https://www.solbari.com.au/cdn/shop/t/306/compiled_assets/snippet-scripts.js?v=136604865519725706911783373077

js solbari.com.au collected 2026-10-07 04:26:33 UTC 34,162 bytes, 25 lines download raw bytes

1(function(){var __snippets__={};(function(){for(var element=document.getElementById("snippets-script"),attribute=element?element.getAttribute("data-snippets"):"",snippets=attribute.split(",").filter(Boolean),i=0;i<snippets.length;i++)__snippets__[snippets[i]]=!0})(),(function(){if(!(!__snippets__["cart-drawer-recommendations"]&&!Shopify.designMode))try{customElements.get("cart-drawer-recommendations")||customElements.define("cart-drawer-recommendations",class extends HTMLElement{constructor(){super(),this.intent=this.dataset.intent||"related",this.strategy=this.dataset.strategy||"last_added",this.limit=parseInt(this.dataset.limit)||4,this.abortController=null,this.currentProductId=null}async connectedCallback(){typeof subscribe=="function"&&typeof PUB_SUB_EVENTS<"u"&&(this.cartUpdateUnsubscriber=subscribe(PUB_SUB_EVENTS.cartUpdate,event=>{this.loadRecommendationsAndCheckTracking()})),await this.loadRecommendationsAndCheckTracking()}async loadRecommendationsAndCheckTracking(){const cart=await this.getCart();await this.loadRecommendationsFromCart(cart),JSON.parse(sessionStorage.getItem("cart_recommendation_clicks")||"[]").length>0&&cart&&await this.checkAndTrackAddToCart(cart)}disconnectedCallback(){this.cartUpdateUnsubscriber&&this.cartUpdateUnsubscriber(),this.abortController&&this.abortController.abort(),this.swiper&&(this.swiper.destroy(!0,!0),this.swiper=null)}async loadRecommendationsFromCart(cart){if(!cart||!cart.items||cart.items.length===0){this.innerHTML="",this.currentProductId=null;return}const selectedProduct=this.selectProductFromCart(cart.items);if(!selectedProduct){this.innerHTML="",this.currentProductId=null;return}selectedProduct.product_id!==this.currentProductId&&(this.currentProductId=selectedProduct.product_id,await this.fetchRecommendationsSection(selectedProduct.product_id))}async getCart(){try{return await(await fetch("/cart.js")).json()}catch{return null}}selectProductFromCart(items){return!items||items.length===0?null:this.strategy=="last_added"?items[items.length-1]:items.reduce((selected,item)=>{const currentValue=item.price*item.quantity,selectedValue=selected?selected.price*selected.quantity:0;return currentValue>selectedValue?item:selected},null)}async fetchRecommendationsSection(productId){this.abortController&&this.abortController.abort(),this.abortController=new AbortController;try{const url=`/recommendations/products?product_id=${productId}&section_id=cart-drawer-recommendations&limit=${this.limit}&intent=${this.intent}`,response=await fetch(url,{signal:this.abortController.signal});if(!response.ok)throw new Error("Failed to fetch recommendations");const responseText=await response.text(),tempDiv=document.createElement("div");tempDiv.innerHTML=responseText;const sectionWrapper=tempDiv.querySelector("cart-drawer-recommendations-section .cart-drawer-recommendations");sectionWrapper?.innerHTML.trim().length?(this.innerHTML=sectionWrapper.innerHTML,window.yotpoWidgetsContainer&&typeof window.yotpoWidgetsContainer.initWidgets=="function"&&window.yotpoWidgetsContainer.initWidgets(!1),this.initializeInteractiveElements()):this.innerHTML=""}catch(error){error.name!=="AbortError"&&(this.innerHTML="")}}initializeInteractiveElements(){this.setupQuickAddTracking(),this.trackRecommendationImpressions(),this.initializeSwiper(),this.classList.add("initialized"),this.querySelectorAll(".card__swatches, .o-swatches__swatch-options").forEach(group=>{const buttons=group.querySelectorAll("[data-colour-swatch-button]");buttons.length>0&&(buttons[0].classList.add("active"),buttons.forEach(button=>{button.dataset.listenerAdded||(button.addEventListener("click",this.handleSwatchClick.bind(this)),button.addEventListener("mouseenter",this.handleSwatchClick.bind(this)),button.dataset.listenerAdded="true")}))})}initializeSwiper(){this.swiper&&this.swiper.destroy(!0,!0);const swiperContainer=this.querySelector(".cart-drawer-recommendations__swiper");swiperContainer&&typeof Swiper<"u"&&(this.swiper=new Swiper(swiperContainer,{slidesPerView:1,spaceBetween:10,mousewheel:{forceToAxis:!0},breakpoints:{430:{slidesPerView:1.1},452:{slidesPerView:1.2}}
1,navigation:{nextEl:".cart-drawer-recommendations__nav-next",prevEl:".cart-drawer-recommendations__nav-prev"}}))}setupQuickAddTracking(){this.querySelectorAll("modal-opener button, quick-add-modal button").forEach(button=>{button.dataset.trackingAdded||(button.addEventListener("click",e=>{const productData=this.getProductDataFromCard(button.closest(".product-card-wrapper, .card, .swiper-slide"));productData&&(this.trackRecommendationClick(button),this.saveClickedProduct(productData))}),button.dataset.trackingAdded="true")}),this.querySelectorAll(".quick-add__mobile-link").forEach(link=>{link.dataset.trackingAdded||(link.addEventListener("click",e=>{const productData=this.getProductDataFromCard(link.closest(".product-card-wrapper, .card, .swiper-slide"));productData&&(this.trackRecommendationClick(link),this.saveClickedProduct(productData))}),link.dataset.trackingAdded="true")})}saveClickedProduct(productData){try{const storageKey="cart_recommendation_clicks";let clicks=JSON.parse(sessionStorage.getItem(storageKey)||"[]");const clickData={...productData,clickedAt:Date.now(),intent:this.intent};clicks=clicks.filter(item=>item.id!==productData.id),clicks.push(clickData),clicks.length>10&&(clicks=clicks.slice(-10)),sessionStorage.setItem(storageKey,JSON.stringify(clicks))}catch{}}async checkAndTrackAddToCart(cartData=null){try{const storageKey="cart_recommendation_clicks";let clicks=JSON.parse(sessionStorage.getItem(storageKey)||"[]");if(clicks.length===0)return;const cart=cartData||await this.getCart();if(!cart||!cart.items)return;const lastTrackedKey="cart_recommendation_last_tracked",lastTrackedTime=parseInt(sessionStorage.getItem(lastTrackedKey)||"0"),currentTime=Date.now(),trackedProducts=[];clicks.forEach(clickData=>{const matchingItems=cart.items.filter(item=>{const itemProductId=item.product_id?.toString(),clickProductId=clickData.productId?.toString();return itemProductId&&clickProductId&&itemProductId===clickProductId});if(matchingItems.length>0){const mostRecentItem=matchingItems[matchingItems.length-1];if(clickData.clickedAt>lastTrackedTime){const actualCartData={name:mostRecentItem.product_title,productId:mostRecentItem.product_id?.toString(),handle:mostRecentItem.handle,variantId:mostRecentItem.variant_id?.toString(),price:mostRecentItem.price/100,currency:cart.currency||clickData.currency,brand:mostRecentItem.vendor||"Solbari",variant:mostRecentItem.variant_title||"",category:mostRecentItem.product_type||"",quantity:mostRecentItem.quantity||1,position:clickData.position,intent:clickData.intent};this.trackRecommendationAddToCart(null,actualCartData),trackedProducts.push(clickData.productId)}}}),trackedProducts.length>0&&sessionStorage.setItem(lastTrackedKey,currentTime.toString()),trackedProducts.length>0&&(clicks=clicks.filter(item=>!trackedProducts.includes(item.productId)),sessionStorage.setItem(storageKey,JSON.stringify(clicks)));const thirtyMinutesAgo=Date.now()-1800*1e3;clicks=clicks.filter(item=>item.clickedAt>thirtyMinutesAgo),sessionStorage.setItem(storageKey,JSON.stringify(clicks))}catch{}}trackRecommendationClick(element){const card=element.closest(".product-card-wrapper, .card, .swiper-slide");if(!card)return;const productData=this.getProductDataFromCard(card);if(!productData)return;const eventData={event:"cart_recommendation_click",product_name:productData.name,product_id:productData.productId,product_handle:productData.handle,product_price:productData.price,product_brand:productData.brand,product_variant:productData.variant,product_variant_id:productData.variantId,product_category:productData.category,product_position:productData.position,currency:productData.currency,list_name:"Cart Drawer Recommendations",recommendation_source:"cart_drawer",recommendation_intent:this.intent};typeof window.dataLayer<"u"&&window.dataLayer.push(eventData),typeof window.gtag=="function"&&window.gtag("event","select_item",{item_list_name:"Cart Drawer Recommendations",item_list_id:"cart_drawer_recommendations",items:[{item_id:productData.productId,item_name:productData.name,item_brand:productData.brand,item_category:productData.category,item_variant:productData.variant,price:productData.price,currency:productData.currency,index:productData.position}]})}trackRecommendationAddToCart(modal,cartData=null){let productData=cartData;if(!productData&&modal){const card=modal.closest(".product-card-wrapper, .card, .swiper-slide");card&&(productData=this.getProductDataFromCard(card))}if(!productData)return;const quantity=productData.quantity||1,eventData={event:"cart_recommendation_add_to_cart",product_name:productData.name,product_id:productData.productId,product_handle:productData.handle,product_price:productData.price,product_brand:productData.brand,product_variant:productData.variant,product_variant_id:productData.variantId,product_category:productData.category,product_quantity:quantity,product_position:productData.position,currency:productData.currency,list_name:"Cart Drawer Recommendations",recommendation_source:"cart_drawer",recommendation_intent:productData.intent||this.intent};typeof window.dataLayer<"u"&&window.dataLayer.push(eventData),typeof window.gtag=="function"&&window.gtag("event","add_to_cart",{currency:productData.currency,value:productData.price*quantity,items:[{item_id:productData.productId,item_name:productData.name,item_brand:productData.brand,item_category:productData.category,item_variant:productData.variant,price:productData.price,quantity,index:productData.position,item_list_name:"Cart Drawer Recommendations",item_list_id:"cart_drawer_recommendations"}]})}trackRecommendationImpressions(){const slides=this.querySelectorAll(".swiper-slide");if(slides.length===0)return;const items=[];
1if(slides.forEach((slide,index)=>{const productData=this.getProductDataFromCard(slide);productData&&items.push({item_id:productData.productId,item_name:productData.name,item_brand:productData.brand,item_category:productData.category,item_variant:productData.variant,price:productData.price,currency:productData.currency,index:index+1,item_list_name:"Cart Drawer Recommendations",item_list_id:"cart_drawer_recommendations"})}),items.length===0)return;const eventData={event:"cart_recommendation_view",list_name:"Cart Drawer Recommendations",recommendation_source:"cart_drawer",recommendation_intent:this.intent,items_count:items.length};typeof window.dataLayer<"u"&&window.dataLayer.push({...eventData,ecommerce:{item_list_name:"Cart Drawer Recommendations",item_list_id:"cart_drawer_recommendations",items}}),typeof window.gtag=="function"&&window.gtag("event","view_item_list",{item_list_name:"Cart Drawer Recommendations",item_list_id:"cart_drawer_recommendations",items})}getProductDataFromCard(card){const slide=card.closest(".swiper-slide");if(slide){const productId=slide.dataset.productId,productHandle2=slide.dataset.productHandle,productTitle=slide.dataset.productTitle,productPrice=parseFloat(slide.dataset.productPrice)||0,productPriceCents=slide.dataset.productPriceCents,productVariantId=slide.dataset.productVariantId,productVariantTitle=slide.dataset.productVariantTitle,productType=slide.dataset.productType,productVendor=slide.dataset.productVendor,currency=slide.dataset.currency;if(productHandle2&&productTitle)return{name:productTitle,productId,handle:productHandle2,variantId:productVariantId,price:productPrice,priceCents:productPriceCents,currency,brand:productVendor||"Solbari",variant:productVariantTitle||"",category:productType||card.querySelector(".product-collection-info")?.textContent.trim()||"",position:Array.from(slide.parentElement.children).indexOf(slide)+1}}const titleElement=card.querySelector(".card__heading a, .card__heading"),priceElement=card.querySelector(".price-item--regular, .price__regular .price-item"),linkElement=card.querySelector(".card__heading a, .quick-add__mobile-link");if(!titleElement)return null;let productHandle="";return linkElement&&linkElement.href&&(productHandle=new URL(linkElement.href,window.location.origin).pathname.split("/products/")[1]?.split("?")[0]||""),{name:titleElement.textContent?.trim()||"",id:productHandle,price:priceElement?priceElement.textContent.trim():"",brand:"Solbari",variant:card.querySelector(".o-swatches__swatch-options .active")?.getAttribute("aria-label")||"",category:card.querySelector(".product-collection-info")?.textContent.trim()||"",position:slide?Array.from(slide.parentElement.children).indexOf(slide)+1:0}}handleSwatchClick(event){const button=event.currentTarget,group=button.closest(".card__swatches, .o-swatches__swatch-options");if(!group)return;group.querySelectorAll("[data-colour-swatch-button]").forEach(b=>b.classList.remove("active")),button.classList.add("active");const card=button.closest(".product-card-wrapper, .card");if(!card)return;const img=card.querySelector("img");img&&(button.dataset.varsrcset&&(img.srcset=button.dataset.varsrcset),button.dataset.varimage&&(img.src=button.dataset.varimage));const quickAddButton=card.querySelector("[data-product-url]");quickAddButton&&button.dataset.variantUrl&&quickAddButton.setAttribute("data-product-url",button.dataset.variantUrl);const swiperSlide=card.closest(".swiper-slide"),mobileLink=swiperSlide?swiperSlide.querySelector(".quick-add__mobile-link"):null;mobileLink&&button.dataset.variantUrl&&(mobileLink.href=button.dataset.variantUrl)}})}catch(e){console.error(e)}})(),(function(){if(!(!__snippets__["klaviyo-signup-form"]&&!Shopify.designMode))try{if(!customElements.get("custom-klaviyo-signup-form")){class CustomKlaviyoSignUpForm extends HTMLElement{already_registered="User already registered";successfully_registered="Successfully registered";constructor(){super(),this.form=this.querySelector("form"),this.button=this.querySelector("[data-button]");const messagingDiv=this.querySelector("[data-messaging]");if(messagingDiv){const messageDivData=JSON.parse(messagingDiv.innerHTML);this.already_registered=messageDivData?.already_registered||this.already_registered,this.successfully_registered=messageDivData?.successfully_registered||this.successfully_registered,messagingDiv.remove()}this.messageDiv=this.querySelector("[data-signup-message]"),this.onSubmit=this.onSubmit.bind(this),this.form.addEventListener("submit",this.onSubmit)}onSubmit(e){this.button.innerHTML="Submitting...",e.preventDefault();const formData=new FormData(this.form);formData.append("$source","$embed"),formData.append("$method_id","embed"),fetch(this.form.dataset.ajaxSubmit,{method:this.form.method,body:formData,headers:{}}).then(async response=>{if(response.ok)(await response.json()).data.is_subscribed?this.messageDiv.textContent=this.already_registered:this.messageDiv.textContent=this.successfully_registered,document.cookie="newsletter_subscribed=1; path=/; max-age="+3600*24*365+"; SameSite=Lax",document.querySelectorAll("[data-hide-when-subscribed]").forEach(function(el){el.style.display="none"}),this.form.remove(),this.form.reset();else return response.text().then(text=>{this.messageDiv.textContent=response&&response.message||"Something went wrong, please try again.",console.error("Error response from Klaviyo:",text)});this.button.innerHTML="Sign Up"}).catch(error=>{this.messageDiv.textContent="Network error, please try again.",console.error("Network error:",error),this.button.innerHTML="Sign Up"})}}customElements.define("custom-klaviyo-signup-form",CustomKlaviyoSignUpForm)}}catch(e){console.error(e)}}
1)(),(function(){if(!(!__snippets__["product-sizeguide-modal"]&&!Shopify.designMode))try{if(!customElements.get("product-size-guide")){let modalIdCounter=0;customElements.define("product-size-guide",class extends HTMLElement{constructor(){super(),this.modalId=`size-guide-modal-${++modalIdCounter}`,this.initialized=!1}connectedCallback(){if(this.initialized)return;this.initialized=!0;const trigger=this.querySelector(".size-guide-trigger");if(!trigger)return;const productTitle=this.dataset.productTitle||"",sizeGuideContent=this.dataset.sizeGuideContent||"",defaultCm=this.dataset.defaultUnit==="cm",dialogLabel=productTitle?`${productTitle} {{ 'products.product.size_fit_guide' | t: default: 'Size & Fit Guide' }}`:"{{ 'products.product.size_fit_guide' | t: default: 'Size & Fit Guide' }}",modalHtml=`
2        <div id="${this.modalId}" class="size-guide-modal" role="dialog" aria-modal="true" aria-label="${dialogLabel.replace(/"/g,"&quot;")}" tabindex="-1">
3          <div class="modal-content">
4            <button type="button" class="close" aria-label="{{ 'accessibility.close' | t: default: 'Close' }}">&times;</button>
5            <div class="page-content">
6              ${sizeGuideContent}
7            </div>
8          </div>
9        </div>
10      `,toggleContent=`
11        <div class='toggler-parent-wrapper'>
12          <div>${productTitle}</div>
13          <div class='toggler-btn-wrapper'>
14            <div>IN</div>
15            <form class="toggle-container">
16              <label class="toggle-switch">
17                <input type="checkbox" class="toggle-checkbox">
18                <span class="slider"></span>
19              </label>
20            </form>
21            <div>CM</div>
22          </div>
23        </div>
24      `;document.body.insertAdjacentHTML("beforeend",modalHtml);const modal=document.getElementById(this.modalId),closeBtn=modal.querySelector(".close"),pageContent=modal.querySelector(".page-content"),table=pageContent?.querySelector("table");if(table){const inchElems=pageContent.querySelectorAll("table td imperial"),dividerElems=pageContent.querySelectorAll("table td divider"),cmElems=pageContent.querySelectorAll("table td metric");this.toggleVisibility(dividerElems,!1),this.toggleVisibility(inchElems,!defaultCm),this.toggleVisibility(cmElems,defaultCm);const wrapperDivTable=document.createElement("div");wrapperDivTable.className="toggler-and-table-wrapper",table.parentNode.insertBefore(wrapperDivTable,table),wrapperDivTable.appendChild(table),table.insertAdjacentHTML("beforebegin",toggleContent);const toggleCheckbox=modal.querySelector(".toggle-checkbox");toggleCheckbox&&(toggleCheckbox.checked=defaultCm,toggleCheckbox.addEventListener("change",()=>{toggleCheckbox.checked?(this.toggleVisibility(inchElems,!1),this.toggleVisibility(cmElems,!0)):(this.toggleVisibility(inchElems,!0),this.toggleVisibility(cmElems,!1))}))}this.lastFocusedElement=null;const openModal=()=>{this.lastFocusedElement=document.activeElement,modal.style.display="block",closeBtn.focus()},closeModal=()=>{modal.style.display="none",this.lastFocusedElement&&typeof this.lastFocusedElement.focus=="function"?this.lastFocusedElement.focus():trigger.focus()};trigger.addEventListener("click",e=>{e.preventDefault(),openModal()}),closeBtn.addEventListener("click",()=>{closeModal()}),window.addEventListener("click",e=>{e.target===modal&&closeModal()}),modal.addEventListener("keydown",e=>{(e.key==="Escape"||e.key==="Esc")&&(e.preventDefault(),closeModal())})}disconnectedCallback(){const modal=document.getElementById(this.modalId);modal&&modal.remove()}toggleVisibility(elements,show){elements.forEach(element=>{element&&(element.style.display=show?"":"none")})}})}}catch(e){console.error(e)}})(),(function(){if(!(!__snippets__["scroll-to-button"]&&!Shopify.designMode))try{if(!customElements.get("scroll-to-button")){class ScrollToButton extends HTMLElement{constructor(){super(),this.onClick=this.onClick.bind(this),this.addEventListener("click",this.onClick)}onClick(e){if(e.preventDefault(),this.scrollTo=this.dataset.scrollTo,this.scrollTo!==""){const header=document.querySelector(".section-header"),target=document.querySelector(this.scrollTo);if(!header||!target)return;const headerHeight=(header?.offsetHeight||0)+(header?.getBoundingClientRect().top||0),offsetPosition=target.getBoundingClientRect().top+window.scrollY-headerHeight;window.scrollTo({behavior:"smooth",top:offsetPosition})}}}customElements.define("scroll-to-button",ScrollToButton)}}catch(e){console.error(e)}})(),(function(){if(!(!__snippets__["video-responsive"]&&!Shopify.designMode))try{class LazyVideoResponsive{constructor(container){this.container=container,this.mobileVideo=container.querySelector('.lazy-video-r[data-device="mobile"]'),this.desktopVideo=container.querySelector('.lazy-video-r[data-device="desktop"]'),this.mobilePoster=container.querySelector(".lazy-video-r-poster.mobile-only"),this.desktopPoster=container.querySelector(".lazy-video-r-poster.desktop-only"),this.mobilePlayBtn=container.querySelector('.lazy-video-r-play-btn[data-device="mobile"]'),this.desktopPlayBtn=container.querySelector('.lazy-video-r-play-btn[data-device="desktop"]'),this.hasMobileVideo=this.container.dataset.hasMobileVideo==="true",this.hasDesktopVideo=this.container.dataset.hasDesktopVideo==="true",this.currentDevice=this.getDeviceType(),this.isLoaded={mobile:!1,desktop:!1},this.isPlaying=!1,this.isBuffering=!1,this.init()}init(){if(!(this.currentDevice==="mobile"?this.hasMobileVideo:this.hasDesktopVideo)){this.currentDevice==="mobile"&&!this.hasMobileVideo?this.container.style.display="none":this.currentDevice==="desktop"&&!this.hasDesktopVideo&&(this.container.style.display="none"),window.addEventListener("resize",()=>this.handleResize());return}"IntersectionObserver"in window?this.setupIntersectionObserver():this.loadCurrentVideo(),this.mobilePlayBtn&&(this.mobilePlayBtn.addEventListener("click",()=>this.handlePlayClick("mobile")),this.mobilePlayBtn.addEventListener("keydown",e=>this.handleKeyDown(e,"mobile"))),this.desktopPlayBtn&&(this.desktopPlayBtn.addEventListener("click",()=>this.handlePlayClick("desktop")),this.desktopPlayBtn.addEventListener("keydown",e=>this.handleKeyDown(e,"desktop"))),window.addEventListener("resize",()=>this.handleResize()),this.loadResponsiveImages()}getDeviceType(){return window.innerWidth<=767?"mobile":"desktop"}getCurrentVideo(){return this.currentDevice==="mobile"&&this.hasMobileVideo?this.mobileVideo:this.currentDevice==="desktop"&&this.hasDesktopVideo?this.desktopVideo:null}getCurrentPlayBtn(){return this.currentDevice==="mobile"&&this.hasMobileVideo?this.mobilePlayBtn:this.currentDevice==="desktop"&&this.hasDesktopVideo?this.desktopPlayBtn:null}setupIntersectionObserver(){const observer=new IntersectionObserver(entries=>
24{entries.forEach(entry=>{entry.isIntersecting&&!this.isLoaded[this.currentDevice]&&(this.currentDevice==="mobile"?this.hasMobileVideo:this.hasDesktopVideo)&&(this.loadCurrentVideo(),observer.unobserve(this.container))})},{rootMargin:"50px 0px",threshold:.1});observer.observe(this.container)}loadResponsiveImages(){const postersToLoad=[];this.hasMobileVideo&&this.mobilePoster&&postersToLoad.push(this.mobilePoster),this.hasDesktopVideo&&this.desktopPoster&&postersToLoad.push(this.desktopPoster),postersToLoad.forEach(poster=>{poster&&poster.dataset.srcset&&(poster.srcset=poster.dataset.srcset,poster.sizes=poster.dataset.sizes,poster.src=poster.dataset.srcset.split(" ")[0])})}async loadCurrentVideo(){const device=this.currentDevice;if(this.isLoaded[device])return;if(!(device==="mobile"?this.hasMobileVideo:this.hasDesktopVideo)){(device==="mobile"&&!this.hasMobileVideo||device==="desktop"&&!this.hasDesktopVideo)&&(this.container.style.display="none");return}this.container.classList.add("loading");try{const video=this.getCurrentVideo();if(!video){this.container.classList.remove("loading");return}const sourcesData=device==="mobile"?this.container.dataset.mobileSources:this.container.dataset.desktopSources;if(!sourcesData||sourcesData==="[]"){this.container.classList.remove("loading");return}const videoSources=JSON.parse(sourcesData),autoplay=this.container.dataset.autoplay==="true",loop=this.container.dataset.loop==="true",muted=this.container.dataset.muted==="true",controls=this.container.dataset.controls==="true";this.prefersReducedMotion()?video.autoplay=!1:video.autoplay=autoplay,video.loop=loop,video.muted=muted,video.controls=controls,video.innerHTML="";const sortedSources=videoSources.sort((a,b)=>{const formatPriority={mp4:0,webm:1,mov:2},aPriority=formatPriority[a.format]||99,bPriority=formatPriority[b.format]||99;return aPriority!==bPriority?aPriority-bPriority:b.width*b.height-a.width*a.height});sortedSources.forEach(source=>{if(source.url&&source.mime_type){const sourceElement=document.createElement("source");sourceElement.src=source.url,sourceElement.type=source.mime_type,video.appendChild(sourceElement)}});const mp4Source=sortedSources.find(s=>s.format==="mp4");mp4Source&&(video.src=mp4Source.url),await new Promise((resolve,reject)=>{video.addEventListener("loadedmetadata",resolve,{once:!0}),video.addEventListener("error",reject,{once:!0}),video.load()}),this.isLoaded[device]=!0,this.container.classList.remove("loading"),autoplay&&!this.prefersReducedMotion()&&this.play()}catch(error){console.warn(`Failed to load ${device} video:`,error),this.container.classList.remove("loading")}}async handleResize(){const newDevice=this.getDeviceType();newDevice!==this.currentDevice&&(this.stopAndHideVideo(this.currentDevice),this.currentDevice=newDevice,(newDevice==="mobile"?this.hasMobileVideo:this.hasDesktopVideo)?(this.container.style.display="",this.isLoaded[this.currentDevice]?this.container.dataset.autoplay==="true"&&!this.prefersReducedMotion()&&this.play():await this.loadCurrentVideo()):newDevice==="mobile"&&!this.hasMobileVideo?this.container.style.display="none":newDevice==="desktop"&&!this.hasDesktopVideo&&(this.container.style.display="none"))}stopAndHideVideo(device){const video=device==="mobile"?this.mobileVideo:this.desktopVideo;video&&(video.paused||video.pause(),video.currentTime=0,video.innerHTML="",video.removeAttribute("src"),video.load(),this.isLoaded[device]=!1),this.isPlaying=!1,this.isBuffering=!1,this.container.classList.remove("playing"),this.updateButtonIcon()}prefersReducedMotion(){return window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}handleKeyDown(e,device){device===this.currentDevice&&(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.handlePlayClick(device))}async handlePlayClick(device){device===this.currentDevice&&(this.isLoaded[this.currentDevice]||await this.loadCurrentVideo(),this.isPlaying?this.pause():this.play())}async play(){const video=this.getCurrentVideo();if(!(!video||!this.isLoaded[this.currentDevice])){this.hasEnoughBuffer()||(this.isBuffering=!0,this.updateButtonIcon(),await this.waitForBuffer(),this.isBuffering=!1);try{await video.play(),this.isPlaying=!0,this.container.classList.add("playing"),this.updateButtonIcon()}catch(error){console.warn("Failed to play video:",error),this.isBuffering=!1,this.updateButtonIcon()}}}hasEnoughBuffer(){const video=this.getCurrentVideo();if(!video||video.readyState<3||video.buffered.length===0)return!1;const currentTime=video.currentTime;return video.buffered.end(video.buffered.length-1)-currentTime>=3}async waitForBuffer(){const video=this.getCurrentVideo();if(video)return new Promise(resolve=>{const checkBuffer=()=>{this.hasEnoughBuffer()?resolve():setTimeout(checkBuffer,100)},onProgress=()=>{this.hasEnoughBuffer()&&(video.removeEventListener("progress",onProgress),video.removeEventListener("canplaythrough",onCanPlayThrough),resolve())},onCanPlayThrough=()=>{video.removeEventListener("progress",onProgress),video.removeEventListener("canplaythrough",onCanPlayThrough),resolve()};video.addEventListener("progress",onProgress),video.addEventListener("canplaythrough",onCanPlayThrough),checkBuffer(),setTimeout(()=>{video.removeEventListener("progress",onProgress),video.removeEventListener("canplaythrough",onCanPlayThrough),resolve()},1e4)})}pause(){const video=this.getCurrentVideo();!video||!this.isLoaded[this.currentDevice]||(video.pause(),this.isPlaying=!1,this.isBuffering=!1,this.container.classList.remove("playing"),this.updateButtonIcon())}updateButtonIcon(){const playBtn=this.getCurrentPlayBtn();if(!playBtn)return;const playIcon=playBtn.querySelector(".play-icon"),pauseIcon=playBtn.querySelector(".pause-icon"),loadingIcon=playBtn.querySelector(".loading-icon");playIcon&&(playIcon.style.display="none"),pauseIcon&&(pauseIcon.style.display="none"),loadingIcon&&(loadingIcon.style.display="none"),this.isBuffering?(loadingIcon&&(loadingIcon.style.display="block"),playBtn.setAttribute("aria-label","Loading video"),playBtn.setAttribute("title","Loading video"),playBtn.setAttribute("aria-pressed","fal
24se"),playBtn.disabled=!0):this.isPlaying?(pauseIcon&&(pauseIcon.style.display="block"),playBtn.setAttribute("aria-label","Pause video"),playBtn.setAttribute("title","Pause video"),playBtn.setAttribute("aria-pressed","true"),playBtn.disabled=!1):(playIcon&&(playIcon.style.display="block"),playBtn.setAttribute("aria-label","Play video"),playBtn.setAttribute("title","Play video"),playBtn.setAttribute("aria-pressed","false"),playBtn.disabled=!1)}}document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll(".lazy-video-r-responsive-container").forEach(container=>{new LazyVideoResponsive(container)})})}catch(e){console.error(e)}})(),(function(){if(!(!__snippets__.video&&!Shopify.designMode))try{if(!customElements.get("lazy-video-container")){class LazyVideo extends HTMLElement{constructor(){super(),this.container=this,this.video=this.querySelector(".lazy-video"),this.poster=this.querySelector(".lazy-video-poster"),this.playBtn=this.querySelector(".lazy-video-play-btn"),this.isLoaded=!1,this.isPlaying=!1,this.handlePlayClick=this.handlePlayClick.bind(this),this.init()}init(){"IntersectionObserver"in window?this.setupIntersectionObserver():this.loadVideo(),this.playBtn&&(this.playBtn.addEventListener("click",this.handlePlayClick),this.playBtn.addEventListener("keydown",e=>this.handleKeyDown(e))),this.loadResponsiveImage()}setupIntersectionObserver(){const observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{entry.isIntersecting&&!this.isLoaded&&(this.loadVideo(),observer.unobserve(this.container))})},{rootMargin:"50px 0px",threshold:.1});observer.observe(this.container)}loadResponsiveImage(){const poster=this.poster;poster&&poster.dataset.srcset&&(poster.srcset=poster.dataset.srcset,poster.sizes=poster.dataset.sizes,poster.src=poster.dataset.srcset.split(" ")[0])}async loadVideo(){if(!this.isLoaded){this.container.classList.add("loading");try{const videoSources=JSON.parse(this.container.dataset.videoSources),autoplay=this.container.dataset.autoplay==="true",loop=this.container.dataset.loop==="true",muted=this.container.dataset.muted==="true",controls=this.container.dataset.controls==="true";this.prefersReducedMotion()?this.video.autoplay=!1:this.video.autoplay=autoplay,this.video.loop=loop,this.video.muted=muted,this.video.controls=controls,this.video.innerHTML="";const sortedSources=videoSources.sort((a,b)=>{const formatPriority={mp4:0,webm:1,mov:2},aPriority=formatPriority[a.format]||99,bPriority=formatPriority[b.format]||99;return aPriority!==bPriority?aPriority-bPriority:b.width*b.height-a.width*a.height});sortedSources.forEach(source=>{if(source.url&&source.mime_type){const sourceElement=document.createElement("source");sourceElement.src=source.url,sourceElement.type=source.mime_type,this.video.appendChild(sourceElement)}});const mp4Source=sortedSources.find(s=>s.format==="mp4");mp4Source&&(this.video.src=mp4Source.url),await new Promise((resolve,reject)=>{this.video.addEventListener("loadedmetadata",resolve,{once:!0}),this.video.addEventListener("error",reject,{once:!0}),this.video.load()}),this.isLoaded=!0,this.container.classList.remove("loading"),autoplay&&!this.prefersReducedMotion()&&this.play()}catch(error){console.warn("Failed to load video:",error),this.container.classList.remove("loading")}}}prefersReducedMotion(){return window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}handleKeyDown(e){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.handlePlayClick(e))}async handlePlayClick(e){e.preventDefault(),e.stopPropagation(),this.isLoaded||await this.loadVideo(),this.isPlaying?this.pause():this.play()}async play(){if(this.isLoaded){this.hasEnoughBuffer()||await this.waitForBuffer();try{await this.video.play(),this.isPlaying=!0,this.container.classList.add("playing"),this.updateButtonIcon()}catch(error){console.warn("Failed to play video:",error)}}}hasEnoughBuffer(){const video=this.video;if(video.readyState<3||video.buffered.length===0)return!1;const currentTime=video.currentTime;return video.buffered.end(video.buffered.length-1)-currentTime>=3}async waitForBuffer(){return new Promise(resolve=>{const checkBuffer=()=>{this.hasEnoughBuffer()?resolve():setTimeout(checkBuffer,100)},onProgress=()=>{this.hasEnoughBuffer()&&(this.video.removeEventListener("progress",onProgress),this.video.removeEventListener("canplaythrough",onCanPlayThrough),resolve())},onCanPlayThrough=()=>{this.video.removeEventListener("progress",onProgress),this.video.removeEventListener("canplaythrough",onCanPlayThrough),resolve()};this.video.addEventListener("progress",onProgress),this.video.addEventListener("canplaythrough",onCanPlayThrough),checkBuffer(),setTimeout(()=>{this.video.removeEventListener("progress",onProgress),this.video.removeEventListener("canplaythrough",onCanPlayThrough),resolve()},1e4)})}pause(){this.isLoaded&&(this.video.pause(),this.isPlaying=!1,this.container.classList.remove("playing"),this.updateButtonIcon())}updateButtonIcon(){this.playBtn&&(this.isPlaying?(this.playIcon&&(this.playIcon.style.display="none"),this.pauseIcon&&(this.pauseIcon.style.display="block"),this.playBtn.setAttribute("aria-label","Pause video"),this.playBtn.setAttribute("title","Pause video"),this.playBtn.setAttribute("aria-pressed","true")):(this.playIcon&&(this.playIcon.style.display="block"),this.pauseIcon&&(this.pauseIcon.style.display="none"),this.playBtn.setAttribute("aria-label","Play video"),this.playBtn.setAttribute("title","Play video"),this.playBtn.setAttribute("aria-pressed","fal
24se")))}}customElements.define("lazy-video-container",LazyVideo)}}catch(e){console.error(e)}})()})();
25//# sourceMappingURL=/cdn/shop/t/306/compiled_assets/snippet-scripts.js.map?v=136604865519725706911783373077

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.