PageSourceSearch

https://www.roadid.com/cdn/shop/t/469/assets/rid-theme.js?v=123999348802021276981789143143

js roadid.com collected 2026-09-24 10:07:09 UTC 35,852 bytes, 9 lines download raw bytes

1const getExistingBundleItems=builderId=>window.cartItems.filter(item=>item.properties["_builder-id"]===builderId),sortBundleItems=items=>{const membershipProduct=items.find(item=>item.product_type==="Membership"),onlineProfileFreeYears=membershipProduct?membershipProduct.sku.split("-").pop():null,onlineProfileFreeMonths=onlineProfileFreeYears?parseInt(onlineProfileFreeYears)*12:null,idItem=items.find(item=>item.product_type==="ID");idItem&&onlineProfileFreeMonths?idItem.properties["_online-profile-free-months"]=onlineProfileFreeMonths.toString():idItem&&!onlineProfileFreeMonths&&idItem.properties["_online-profile-free-months"]&&delete idItem.properties["_online-profile-free-months"];const priority={Badge:1,Band:2,Membership:3,Insurance:4,ID:5};return items.sort((a,b)=>{const aPriority=priority[a.product_type]||5,bPriority=priority[b.product_type]||5;return aPriority-bPriority})},clearPreviousContents=async function(lineItems){const updates={};lineItems.forEach(item=>{updates[item.key]=0});try{const response=await fetch(`${window.Shopify.routes.root}cart/update.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates})}),responseJson=await response.json();response.ok||console.error("Error clearing previous contents:",responseJson)}catch(error){console.error("Error clearing previous contents:",error)}},onRemoveMembership=async function(event,key,builderId){event.preventDefault(),event.stopPropagation(),toggleButtonState(event.target,!0),event.target.textContent="Removing...";const cart=await(await fetch(window.Shopify.routes.root+"cart.js")).json();try{let existingBundleItems=getExistingBundleItems(builderId);if(await clearPreviousContents(existingBundleItems),cart.items.find(item=>item.key===key)){existingBundleItems=existingBundleItems.filter(item=>item.key!==key);const idItem=existingBundleItems.find(item=>item.product_type==="ID");idItem&&idItem.properties["_online-profile-free-months"]&&delete idItem.properties["_online-profile-free-months"];const sortedItems=sortBundleItems(existingBundleItems),updateResponse=await fetch(`${window.Shopify.routes.root}cart/add.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:sortedItems})}),updateResponseJson=await updateResponse.json();updateResponse.ok||console.error("Error updating cart:",updateResponseJson)}}catch(error){console.error("Error removing membership:",error)}finally{window.location.reload()}},customAddToCart=async function(event,preorderDate){const addToCartButton=document.getElementById("AddToCart");addToCartButton.setAttribute("disabled","true"),addToCartButton.setAttribute("aria-busy","true");try{const variantIdElement=document.querySelector("input[name='id']"),variantId=variantIdElement?variantIdElement.value:null,quantityElement=document.querySelector("input[name='quantity']");let body={quantity:quantityElement&&quantityElement.value||1,id:variantId};preorderDate&&(body.properties={"_preorder-date":preorderDate});const response=await fetch(`${window.Shopify.routes.root}cart/add.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(body)}),responseJson=await response.json();if(response.ok){if(window.themeVariables.settings.cartType==="page"||window.themeVariables.settings.pageType==="cart"){window.location.href=`${Shopify.routes.root}cart`;return}document.documentElement.dispatchEvent(new CustomEvent("variant:added",{bubbles:!0,detail:{variant:responseJson.hasOwnProperty("items")?responseJson.items[0]:responseJson}}));const cartContent=await(await fetch(`${window.themeVariables.routes.cartUrl}.js`)).json();document.documentElement.dispatchEvent(new CustomEvent("cart:updated",{bubbles:!0,detail:{cart:cartContent}})),cartContent.sections=responseJson.sections,document.documentElement.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0,detail:{cart:cartContent,openMiniCart:window.themeVariables.settings.cartType==="drawer"}}))}document.documentElement.dispatchEvent(new CustomEvent("cart-notification:show",{bubbles:!0,cancelable:!0,detail:{status:response.ok?"success":"error",error:responseJson.description||""}}))}finally{addToCartButton.removeAttribute("disabled"),addToCartButton.setAttribute("aria-busy","false")}};function toggleButtonState(target,isDisabled){isDisabled?(target.setAttribute("disabled","true"),target.setAttribute("aria-disabled","true"),target.setAttribute("aria-busy","true"),target.classList.add("is-disabled")):(target.removeAttribute("disabled"),target.setAttribute("aria-disabled","false"),target.setAttribute("aria-busy","false"),target.classList.remove("is-disabled"))}function smoothScrollTo(event,targetId){event.preventDefault();const targetElement=document.getElementById(targetId);targetElement&&targetElement.scrollIntoView({behavior:"smooth"})}var RidNativeVideo=class extends HTMLElement{constructor(){super(),this.hasLoaded=!1,this.autoPlay?this.querySelector("[data-rid-preview-toggle]")&&window.MediaFeatures&&window.MediaFeatures.prefersReducedMotion()?this._revealPoster():this.play():this.addEventListener("click",this._playFromUser.bind(this),{once:!0})}get autoPlay(){return this.hasAttribute("autoplay")}_playFromUser(){this._userActivated=!0,this.play()}play(){this.hasLoaded||this._replaceContent(),this.querySelector("video").play().then(()=>{var poster=this.querySelector(".video-wrapper__poster");poster&&(poster.style.display="none"),this._showPauseControl(!0),this._userActivated&&this._announceState("Video is now playing")}).catch(error=>{console.warn("Autoplay blocked, falling back",error),this._handleAutoplayFailure()})}pause(){this.hasLoaded&&this.querySelector("video").pause()}_handleAutoplayFailure(){this._showHideEnabledDisabledAutoplaySections()||(this.querySelector("video")?.removeAttribute("autoplay"),this._revealPoster(),this.dispatchEvent(new CustomEvent("video:autoplay-failed",{bubbles:!0})))}_revealPoster(){var poster=this.querySelector(".video-wrapper__poster");if(poster){poster.style.display="",this._showPauseControl(!1);var playButton=poster.querySelector(".video-wrapper__play-button");(playButton||poster).addEventListener("click",this._playFromUser.bind(this),{once:!0})}}
1_showPauseControl(isVisible){var toggle=this.querySelector("[data-rid-preview-toggle]");toggle&&(toggle.style.display=isVisible?"":"none",isVisible&&ridSetToggleState(toggle,!1))}_announceState(message){if(!this.closest('[aria-hidden="true"]')){var el=this.querySelector(".video-wrapper__sr-status");el||(el=document.createElement("span"),el.className="video-wrapper__sr-status visually-hidden",el.setAttribute("role","status"),el.setAttribute("aria-live","polite"),this.appendChild(el)),el.textContent=message}}_showHideEnabledDisabledAutoplaySections(){var isMobile=window.innerWidth<=740,sectionId=this.getAttribute("data-section-id");if(!sectionId)return!1;var findSections=function(pattern){var suffix=(pattern?pattern+"-":"")+sectionId;return{enabled:document.getElementById("video-banner-autoplay-enabled-section-"+suffix),disabled:document.getElementById("video-banner-autoplay-disabled-section-"+suffix)}},sections=findSections(isMobile?"mobile":"desktop");return(!sections.enabled||!sections.disabled)&&(sections=findSections("")),!sections.enabled||!sections.disabled?!1:(sections.enabled.style.display="none",sections.disabled.style.display="block",!0)}_replaceContent(){var node=this.querySelector("template");if(node){node=node.content.firstElementChild.cloneNode(!0);var didWipe=!this.hasAttribute("autoplay");didWipe&&(this.innerHTML=""),this.appendChild(node),node.addEventListener("play",()=>{this.dispatchEvent(new CustomEvent("video:played",{bubbles:!0}))}),node.addEventListener("pause",()=>{this.dispatchEvent(new CustomEvent("video:paused",{bubbles:!0}))}),this.hasLoaded=!0,didWipe&&this._userActivated&&!this.closest('[aria-hidden="true"]')&&(this._announceState(""),node.hasAttribute("controls")||node.setAttribute("tabindex","-1"),node.focus())}}};window.customElements.define("rid-native-video",RidNativeVideo);var RidOrderNow=class extends HTMLElement{static get observedAttributes(){return["data-pre-order-date"]}connectedCallback(){this.orderNowTextData=document.getElementById("order-now-text-data"),this.presetText=this.orderNowTextData?.getAttribute("data-order-now-text"),this.hasConnected=!0,this.init()}attributeChangedCallback(name,oldValue,newValue){this.hasConnected&&oldValue!==newValue&&this.init()}
1async init(){if(this.textElements=[this.querySelector("#order-now-snippet-text"),this.querySelector("#order-now-mini-cart-snippet-text")].filter(Boolean),this.textElements.length===0){console.error("No order now text elements found");return}this.preorderDate=this.getAttribute("data-pre-order-date"),this.generation=(this.generation||0)+1,this.preorderDate?this.handlePreorderDate():this.presetText?this.handlePresetText():await this.handleDynamicShipping(this.generation)}handlePreorderDate(){const[year,month,day]=this.preorderDate.split("-"),dateObj=new Date(year,month-1,day);if(Number.isNaN(dateObj.getTime())){console.error("Unparseable preorder date:",this.preorderDate);return}const options={year:"numeric",month:"long",day:"numeric"},text=`Order <b>NOW</b> and items will ship on or before <b>${dateObj.toLocaleDateString("en-US",options)}</b>.`;this.updateAllTextElements(text);const fastMessage=this.querySelector("#get-it-fast-message");fastMessage&&(fastMessage.style.display="none");const additionalText=this.querySelector("#additional-order-now-text");additionalText&&(additionalText.style.display="none"),this.reveal()}handlePresetText(){this.updateAllTextElements(this.presetText),this.reveal()}async handleDynamicShipping(generation){try{const responseJson=await(await fetch("https://roadid.com/pages/shipping_date_v2.json")).json(),data=JSON.parse(responseJson.page.body_html.replace(/'/g,'"'));if(generation!==this.generation)return;const now=new Date,cutoffDateTime=new Date(data.cutoffDateTime);let shipsWhen,expectedShipDate;now<cutoffDateTime?expectedShipDate=new Date(data.preCutoffShipDate):expectedShipDate=new Date(data.postCutoffShipDate);const normalizeDate=date=>new Date(date.getFullYear(),date.getMonth(),date.getDate()),normalizedExpectedShipDate=normalizeDate(expectedShipDate),normalizedNow=normalizeDate(now),dayDifference=Math.ceil((normalizedExpectedShipDate-normalizedNow)/(1e3*60*60*24));dayDifference===0?shipsWhen="today":dayDifference===1?shipsWhen="tomorrow":dayDifference>6?shipsWhen=`in ${dayDifference} days`:shipsWhen=expectedShipDate.toLocaleString("en-US",{weekday:"long"});const timeDifferenceMs=cutoffDateTime-now,remainingHours=Math.floor(timeDifferenceMs/(1e3*60*60)),remainingMinutes=Math.floor(timeDifferenceMs%(1e3*60*60)/(1e3*60));let text=remainingHours<6===!1?`Order <b>now</b> and it ships <b>${shipsWhen}!</b>`:remainingHours>0||remainingMinutes>0?`Order within <b>${remainingHours>0?`${remainingHours} ${remainingHours===1?"hour":"hours"}`:""} ${remainingMinutes>0?`${remainingMinutes} ${remainingMinutes===1?"minute":"minutes"}`:""}</b> and it ships <b>${shipsWhen}!</b>`:`Order now and it ships <b>${shipsWhen}!</b>`;this.orderNowTextData&&this.orderNowTextData.setAttribute("data-order-now-text",text),this.updateAllTextElements(text),this.reveal()}catch(e){console.error("Error fetching shipping information:",e)}}reveal(){this.style.visibility="visible",this.style.opacity="1"}updateAllTextElements(text){this.textElements.forEach(element=>{element.innerHTML=text})}};window.customElements.define("rid-order-now",RidOrderNow);var RidProductMedia=class extends CustomHTMLElement{async connectedCallback(){if(this.mainCarousel=this.querySelector("flickity-carousel"),this.hasAttribute("reveal-on-scroll")&&this._setupVisibility(),this.mainCarousel.childElementCount===1)return;this.selectedVariantMediaId=null,this.viewInSpaceElement=this.querySelector("[data-shopify-model3d-id]"),this.zoomButton=this.querySelector(".product__zoom-button"),this.product=await ProductLoader.load(this.getAttribute("product-handle")),document.getElementById(this.getAttribute("form-id"))?.addEventListener("variant:change",this._onVariantChanged.bind(this)),this.mainCarousel.addEventListener("model:played",()=>this.mainCarousel.setDraggable(!1)),this.mainCarousel.addEventListener("model:paused",()=>this.mainCarousel.setDraggable(!0)),this.mainCarousel.addEventListener("video:played",()=>this.mainCarousel.setDraggable(!1)),this.mainCarousel.addEventListener("video:paused",()=>this.mainCarousel.setDraggable(!0)),this.mainCarousel.addEventListener("flickity:ready",this._onFlickityReady.bind(this)),this.mainCarousel.addEventListener("flickity:slide-changed",this._onFlickityChanged.bind(this)),this.mainCarousel.addEventListener("flickity:slide-settled",this._onFlickitySettled.bind(this)),this._onFlickityReady()}get thumbnailsPosition(){return window.matchMedia(window.themeVariables.breakpoints.pocket).matches?"bottom":this.getAttribute("thumbnails-position")}async _setupVisibility(){await this.untilVisible();const flickityInstance=await this.mainCarousel.flickityInstance,image=flickityInstance?flickityInstance.selectedElement.querySelector("img"):this.querySelector(".product__media-image-wrapper img"),prefersReducedMotion=MediaFeatures.prefersReducedMotion();await imageLoaded(image);const animation=new CustomAnimation(new ParallelEffect([new CustomKeyframeEffect(image,{opacity:[0,1],transform:[`scale(${prefersReducedMotion?1:1.1})`,"scale(1)"]},{duration:500,easing:"cubic-bezier(0.65, 0, 0.35, 1)"}),new ParallelEffect(Array.from(this.querySelectorAll(".product__thumbnail-item:not(.is-filtered)")).map((item,index)=>new CustomKeyframeEffect(item,{opacity:[0,1],transform:this.thumbnailsPosition==="left"?[`translateY(${prefersReducedMotion?0:"40px"})`,"translateY(0)"]:[`translateX(${prefersReducedMotion?0:"50px"})`,"translateX(0)"]},{duration:250,delay:prefersReducedMotion?0:100*index,easing:"cubic-bezier(0.75, 0, 0.175, 1)"})))]));this._hasSectionReloaded?animation.finish():animation.play()}async _onVariantChanged(event){const variant=event.detail.variant,featuredMediaId=event.detail.variant.featured_media?event.detail.variant.featured_media.id:null;let allowedIds=[];featuredMediaId&&allowedIds.push(featuredMediaId);const filteredMediaIds=[];let shouldReload=!1;
1this.product.media.forEach(media=>{let matchMedia2=variant.featured_media&&media.id===variant.featured_media.id;if(media.alt?.includes("#")&&(shouldReload=!0,!matchMedia2)){const altParts=media.alt.split("#"),mediaGroupParts=altParts.pop().split("_");this.product.options.forEach(option=>{option.name.toLowerCase()===mediaGroupParts[0].toLowerCase()&&variant.options[option.position-1].toLowerCase()!==mediaGroupParts[1].trim().toLowerCase()&&filteredMediaIds.push(media.id)})}});let currentlyFilteredIds=[...new Set(Array.from(this.querySelectorAll(".is-filtered[data-media-id]")).map(item=>parseInt(item.getAttribute("data-media-id"))))];if(allowedIds.length>0){const selectedMediaId=variant.featured_media?variant.featured_media.id:this.product.media.map(item=>item.id).filter(item=>!filteredMediaIds.includes(item))[0];(await this.mainCarousel.flickityInstance).destroy(),Array.from(this.querySelectorAll("[data-media-id]")).forEach(item=>{item.hasAttribute("is-featured-media")&&(allowedIds.includes(parseInt(item.getAttribute("data-media-id")))||allowedIds.push(parseInt(item.getAttribute("data-media-id")))),item.classList.toggle("is-filtered",!allowedIds.includes(parseInt(item.getAttribute("data-media-id")))),item.classList.toggle("is-selected",selectedMediaId===parseInt(item.getAttribute("data-media-id"))),item.classList.toggle("is-initial-selected",selectedMediaId===parseInt(item.getAttribute("data-media-id")))}),this.mainCarousel.reload()}else{if(!event.detail.variant.featured_media||this.selectedVariantMediaId===event.detail.variant.featured_media.id)return;this.mainCarousel.select(`[data-media-id="${event.detail.variant.featured_media.id}"]`)}this.selectedVariantMediaId=event.detail.variant.featured_media?event.detail.variant.featured_media.id:null}async _onFlickityReady(){const flickityInstance=await this.mainCarousel.flickityInstance;["video","external_video"].includes(flickityInstance.selectedElement.getAttribute("data-media-type"))&&this.hasAttribute("autoplay-video")&&flickityInstance.selectedElement.firstElementChild.play()}async _onFlickityChanged(){(await this.mainCarousel.flickityInstance).cells.forEach(item=>{["external_video","video","model"].includes(item.element.getAttribute("data-media-type"))&&item.element.firstElementChild.pause()})}async _onFlickitySettled(){const flickityInstance=await this.mainCarousel.flickityInstance,selectedSlide=flickityInstance.selectedElement;switch(this.zoomButton&&(this.zoomButton.hidden=selectedSlide.getAttribute("data-media-type")!=="image"),this.viewInSpaceElement&&this.viewInSpaceElement.setAttribute("data-shopify-model3d-id",this.viewInSpaceElement.getAttribute("data-shopify-model3d-default-id")),selectedSlide.getAttribute("data-media-type")){case"model":this.viewInSpaceElement.setAttribute("data-shopify-model3d-id",selectedSlide.getAttribute("data-media-id")),selectedSlide.firstElementChild.play();break;case"external_video":case"video":this.hasAttribute("autoplay-video")&&selectedSlide.firstElementChild.play();break}}};window.customElements.define("rid-product-media",RidProductMedia);var RidProductList=class extends CustomHTMLElement{constructor(){super(),this.productListInner=this.querySelector(".product-list__inner"),this.productItems=Array.from(this.querySelectorAll("rid-product-item"))}connectedCallback(){this.addEventListener("prev-next:prev",this.previous.bind(this)),this.addEventListener("prev-next:next",this.next.bind(this)),!this.hidden&&this.staggerApparition&&this._staggerProductsApparition()}attributeChangedCallback(name){name==="hidden"&&this.staggerApparition&&!this.hidden&&this._staggerProductsApparition()}get staggerApparition(){return this.hasAttribute("stagger-apparition")}get apparitionAnimation(){return this._animation=this._animation||new CustomAnimation(new ParallelEffect(this.productItems.map((item,index)=>new CustomKeyframeEffect(item,{opacity:[0,1],transform:[`translateY(${MediaFeatures.prefersReducedMotion()?0:window.innerWidth<1e3?35:60}px)`,"translateY(0)"]},{duration:600,delay:MediaFeatures.prefersReducedMotion()?0:100*index-Math.min(3*index*index,100*index),easing:"ease"}))))}previous(event){const directionFlip=window.themeVariables.settings.direction==="ltr"?1:-1,columnGap=p
1arseInt(getComputedStyle(this).getPropertyValue("--product-list-column-gap"));event.target.nextElementSibling.removeAttribute("disabled"),event.target.toggleAttribute("disabled",this.productListInner.scrollLeft*directionFlip-(this.productListInner.clientWidth+columnGap)<=0),this.productListInner.scrollBy({left:-(this.productListInner.clientWidth+columnGap)*directionFlip,behavior:"smooth"})}next(event){const directionFlip=window.themeVariables.settings.direction==="ltr"?1:-1,columnGap=parseInt(getComputedStyle(this).getPropertyValue("--product-list-column-gap"));event.target.previousElementSibling.removeAttribute("disabled"),event.target.toggleAttribute("disabled",this.productListInner.scrollLeft*directionFlip+(this.productListInner.clientWidth+columnGap)*2>=this.productListInner.scrollWidth),this.productListInner.scrollBy({left:(this.productListInner.clientWidth+columnGap)*directionFlip,behavior:"smooth"})}async _staggerProductsApparition(){this.productItems.forEach(item=>item.style.opacity=0),await this.untilVisible({threshold:this.clientHeight>0?Math.min(50/this.clientHeight,1):0}),this.apparitionAnimation.play()}};__publicField(RidProductList,"observedAttributes",["hidden"]),window.customElements.define("rid-product-list",RidProductList);var RidProductItem=class extends CustomHTMLElement{connectedCallback(){this.primaryImageList=Array.from(this.querySelectorAll(".product-item__primary-image")),this.currentAnimation=null,this.delegate.on("click",'[data-role="atc-button"]',(event,target)=>{event.preventDefault(),event.stopPropagation(),this.addSelectedVariantToCart()}),this.delegate.on("click",".product-item-meta__swatch-list .color-swatch__radio",this._onColorSwatchChanged.bind(this)),this.delegate.on("click",".product-item-meta__swatch-list .block-swatch__radio",this._onColorSwatchChanged.bind(this)),this._initializeSwatchState()}_updateSwatchAvailability=function(bandVariants,selectedValues,matchingVariant,width=null){if(!bandVariants)return;let bandVariantsArr;try{bandVariantsArr=JSON.parse(bandVariants)}catch(e){console.error("Failed to parse bandVariants",e);return}if(width&&(bandVariantsArr=bandVariantsArr.filter(variant=>variant.option1===width||variant.option2===width||variant.option3===width),bandVariantsArr.length===0)){console.warn("No band variants found for width:",width);return}const colorSwatchGroup=this.querySelector('.swatch-group-wrapper[data-option-title="Color"]');colorSwatchGroup&&colorSwatchGroup.querySelectorAll(".color-swatch__item").forEach(swatch=>{const swatchValue=swatch.getAttribute("value"),swatchContainer=swatch.parentElement,match=bandVariantsArr.find(variant=>variant.option1===swatchValue||variant.option2===swatchValue||variant.option3===swatchValue);match&&!match.available?swatchContainer.classList.add("rid-product-item-swatch__unavailable"):swatchContainer.classList.remove("rid-product-item-swatch__unavailable")})};async _onColorSwatchChanged(event,target){let product=this,variants=product.getAttribute("data-product-variants"),bandVariants=product.getAttribute("data-band-product-variants"),triggersAvailabilityCheck=target.getAttribute("triggers_availability_check")==="true"&&!!bandVariants;try{variants=JSON.parse(variants)}catch(e){console.error(e);return}let selectedValues={};const swatchGroup=target.closest(".swatch-group-wrapper");if(swatchGroup){swatchGroup.setAttribute("data-selected-value",target.getAttribute("value")),swatchGroup.querySelectorAll(".color-swatch__item, .block-swatch__item").forEach(swatch=>{swatch.classList.remove("is-selected")}),target.classList.add("is-selected");const input=target.closest(".color-swatch, .block-swatch")?.querySelector("input");input&&(input.checked=!0,input.focus())}Array.from(this.querySelectorAll(".swatch-group-wrapper")).forEach(swatchGroup2=>{let count=1;swatchGroup2.getAttribute("data-option-name")===target.getAttribute("data-option-name")&&swatchGroup2.setAttribute("data-selected-value",target.getAttribute("value")),selectedValues[swatchGroup2.getAttribute("data-option-name")]=swatchGroup2.getAttribute("data-selected-value")||"",count++}),await this._findMatchingVariantAndSetRelated(target,selectedValues,variants,bandVariants,triggersAvailabilityCheck)}_initializeSwatchState(){setTimeout(async()=>
1{if(!this.querySelector('input[type="radio"]:checked'))return;const selectedValues={};this.querySelectorAll(".swatch-group-wrapper").forEach(group=>{const optionName=group.getAttribute("data-option-name");if(!optionName)return;let value="";const checked=group.querySelector('input[type="radio"]:checked');if(checked&&(value=checked.value||checked.getAttribute("value")||""),value||(value=group.getAttribute("data-selected-value")||""),!value){const firstSwatchItem=group.querySelector(".color-swatch__item, .block-swatch__item");firstSwatchItem&&(value=firstSwatchItem.getAttribute("value")||"")}selectedValues[optionName]=value||""});let variants;try{variants=JSON.parse(this.getAttribute("data-product-variants"))}catch(e){console.error("Failed to parse variants",e);return}let bandVariants=this.getAttribute("data-band-product-variants");try{bandVariants=bandVariants?JSON.parse(bandVariants):null}catch(e){console.error("Failed to parse band variants",e),bandVariants=null}await this._findMatchingVariantAndSetRelated(null,selectedValues,variants,bandVariants,!1)},100)}async _findMatchingVariantAndSetRelated(target,selectedValues,variants,bandVariants=null,triggersAvailabilityCheck=!1){let matchingVariant=variants.find(variant=>variant.option1===selectedValues.option1&&variant.option2===selectedValues.option2&&variant.option3===selectedValues.option3)||variants.find(variant=>variant.option1===selectedValues.option1&&variant.option2===selectedValues.option2)||variants.find(variant=>variant.option1===selectedValues.option1)||variants[0];if(!matchingVariant)return;let matchingVariantId=matchingVariant?matchingVariant.id:target.getAttribute("data-variant-id");this.setAttribute("data-selected-variant-id",matchingVariantId);const soldOutBadge=this.querySelector("#rid-product-item-sold-out-badge"),productQuickForm=this.querySelector(".product-item__quick-form");matchingVariant.available?(soldOutBadge?.style.setProperty("display","none","important"),productQuickForm?.style.setProperty("visibility","visible","important")):(productQuickForm?.style.setProperty("visibility","hidden","important"),soldOutBadge?.style.setProperty("display","inline-block","important")),Array.from(this.querySelectorAll('[href*="/products"]')).forEach(link=>{let url;link.tagName==="A"?url=new URL(link.href):url=new URL(link.getAttribute("href"),`https://${window.themeVariables.routes.host}`),url.searchParams.set("variant",matchingVariantId),link.setAttribute("href",url.toString())}),this.currentAnimation&&(this.currentAnimation.cancel(),this.currentAnimation=null);const newImage=this.primaryImageList.find(image=>image.getAttribute("data-variant-id")===matchingVariantId.toString());if(!newImage){console.warn("No matching image found for variant ID:",matchingVariantId);return}newImage.setAttribute("loading","eager"),await(newImage.complete?Promise.resolve():new Promise(resolve=>newImage.onload=resolve)),newImage.removeAttribute("hidden");let properties={};Array.from(newImage.parentElement.classList).some(item=>["aspect-ratio--short","aspect-ratio--tall","aspect-ratio--square"].includes(item))?properties=[{clipPath:"polygon(0 0, 0 0, 0 100%, 0% 100%)",transform:"translate(calc(-50% - 20px), -50%)",zIndex:1,offset:0},{clipPath:"polygon(0 0, 20% 0, 5% 100%, 0 100%)",transform:"translate(calc(-50% - 20px), -50%)",zIndex:1,offset:.3},{clipPath:"polygon(0 0, 100% 0, 100% 100%, 0 100%)",transform:"translate(-50%, -50%)",zIndex:1,offset:1}]:properties=[{clipPath:"polygon(0 0, 0 0, 0 100%, 0% 100%)",transform:"translateX(-20px)",zIndex:1,offset:0},{clipPath:"polygon(0 0, 20% 0, 5% 100%, 0 100%)",transform:"translateX(-20px)",zIndex:1,offset:.3},{clipPath:"polygon(0 0, 100% 0, 100% 100%, 0 100%)",transform:"translateX(0px)",zIndex:1,offset:1}],this.currentAnimation=newImage.animate(properties,{duration:500,easing:"ease-in-out"});try{await this.currentAnimation.finished}catch{}this.primaryImageList.filter(image=>image.classList.contains("product-item__primary-image")&&image!==newImage).forEach(image=>image.setAttribute("hidden","")),triggersAvailabilityCheck&&this._updateSwatchAvailability(bandVariants,selectedValues,matchingVariant,target.getAttribute("value"))}async addSelectedVariantToCart(){try{const ridProductItemId=this.getAttribute("id")||"unknown";let variantId=this.getAttribute("data-selected-variant-id")||null;if(!variantId){const visibleImage=this.primaryImageList.find(img=>!img.hasAttribute("hidden"))||this.primaryImageList[0];variantId=visibleImage?visibleImage.getAttribute("data-variant-id"):null}if(!variantId){console.error("RidProductItem: No selected variant id found for ATC CTA");return}const body={quantity:1,id:Number(variantId)};if(ridProductItemId.includes("bandana")){let guid=crypto.randomUUID();body.properties={"_bandana-bundle-id":String(guid)}}const response=await fetch(`${window.Shopify.routes.root}cart/add.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(body)});if(!response.ok){const responseJson=await response.json();document.documentElement.dispatchEvent(new CustomEvent("cart-notification:show",{bubbles:!0,cancelable:!0,detail:{status:"error",error:responseJson.description||"Failed to add item to cart."}}));return}window.location.href="/cart"}catch(e){console.error("RidProductItem: Error adding selected variant to cart",e)}}};window.customElements.define("rid-product-item",RidProductItem);var DiscountNotification=class extends CustomHTMLElement{connectedCallback(){document.addEventListener("discount-notification:show",this._onShow.bind(this)),this.delegate.on("click",'[data-action="close"]',event=>{event.stopPropagation(),this.hidden=!0}),this.addEventListener("mouseenter",this.stopTimer.bind(this)),this.addEventListener("mouseleave",this.startTimer.bind(this)),window.addEventListener("pagehide",()=>this.hidden=!0)}set hidden(value){value?this.stopTimer():this.startTimer(),this.toggleAttribute("hidden",value)}get isInsideDrawer(){return this.classList.contains("discount-notification--drawer")}stopTimer(){clearTimeout(this._timeout)}startTimer(){this._timeout=setTimeout(()=>this.hidden=!0,3e3)}_onShow(event){if(this.isInsideDrawer&&!this.closest(".drawer")?.open){console.warn("Drawer is closed. Notification not displayed.");return}event.stopPropagation();let closeButtonHtml="";this.isInsideDrawer||(closeButtonHtml=`
2        <button class="discount-notification__close tap-area" data-action="close" style="right: 24px !important;">
3          <span class="visually-hidden">${window.themeVariables.strings.accessibilityClose}</span>
4          <svg focusable="false" width="14" height="14" class="icon icon--close icon--inline" viewBox="0 0 14 14">
5            <path d="M13 13L1 1M13 1L1 13" stroke="currentColor" stroke-width="2" fill="none"></path>
6          </svg>
7        </button>
8      `),this.innerHTML=event.detail.status==="success"?`<div class="discount-notification__wrapper heading heading--small">Success! Discount applied. ${closeButtonHtml}</div>`:`<div class="discount-notification__wrapper discount-notification--error heading heading--small">Error: ${event.detail.error} ${closeButtonHtml}</div>`,this.hidden=!1}showNotification(status="success",error=""){this._onShow({detail:{status,error}})}};window.customElements.define("discount-notification",DiscountNotification);function toggleCollapsibleContent(element){var collapsibleContent=element.nextElementSibling;collapsibleContent&&collapsibleContent.tagName==="COLLAPSIBLE-CONTENT"&&(collapsibleContent.hasAttribute("open")?collapsibleContent.removeAttribute("open"):collapsibleContent.setAttribute("open",""))}function ridSetToggleState(toggle,isPaused){toggle.setAttribute("aria-pressed",isPaused?"true":"false")}var FocalSlideshow=window.customElements.get("slide-show"),RidSlideshow=FocalSlideshow&&class extends FocalSlideshow{connectedCallback(){super.connectedCallback(),this.userPaused=!1,this.breakpointQuery=window.matchMedia("(min-width: 1000px)"),this.boundBreakpointChange=this.handleBreakpointChange.bind(this),this.breakpointQuery.addEventListener("change",this.boundBreakpointChange),this.addEventListener("video:played",this.handleVideoPlayed.bind(this)),this.addEventListener("video:autoplay-failed",this.handleAutoplayFailed.bind(this)),this.delegate.on("click","[data-rid-slideshow-toggle]",this.handleToggleClick.bind(this)),this.delegate.on("click","[data-rid-slide-play]",this.handleSlidePlayClick.bind(this)),this._activateWhenVisible()}disconnectedCallback(){super.disconnectedCallback(),this.videoObserver&&this.videoObserver.disconnect(),this.breakpointQuery&&this.boundBreakpointChange&&this.breakpointQuery.removeEventListener("change",this.boundBreakpointChange),this._pauseAllVideos()}handleBreakpointChange(){this._playVideos(this.items[this.selectedIndex])}handleVideoPlayed(event){event.target&&event.target.classList&&event.target.classList.add("is-playing")}handleAutoplayFailed(event){const item=event.target.closest("slide-show-item");if(!item)return;const poster=event.target.parentElement?.querySelector(".rid-slideshow__poster");poster&&(poster.hidden=!1),this._restorePlayButton(item,!1)}handleToggleClick(event,target){event.preventDefault(),this.userPaused=!this.userPaused,ridSetToggleState(target,this.userPaused),this.userPaused?(this.pausePlayer(),this._pauseAllVideos()):(this.startPlayer(),this._playVideos(this.items[this.selectedIndex]))}handleSlidePlayClick(event,target){event.preventDefault();const item=target.closest("slide-show-item");item&&(this._videosIn(item).filter(this._isVisible.bind(this)).forEach(function(video){video.dataset.ridManualPlay="true",video.play()}),target.hidden=!0)}_activateWhenVisible(){if(!window.IntersectionObserver){this._playVideos(this.items[this.selectedIndex]);return}this.videoObserver=new IntersectionObserver(function(entries){entries[0].isIntersecting&&(this.videoObserver.disconnect(),this._playVideos(this.items[this.selectedIndex]))}.bind(this),{rootMargin:"200px"}),this.videoObserver.observe(this)}async select(index,shouldTransition=!0,reverseDirection=!1){if(this.transitionType==="reveal"&&this.isTransitioning)return super.select(index,shouldTransition,reverseDirection);const generation=(this.selectGeneration||0)+1;this.selectGeneration=generation,this._pauseVideos(this.items[this.selectedIndex]),await super.select(index,shouldTransition,reverseDirection),generation===this.selectGeneration&&this._playVideos(this.items[this.selectedIndex])}_videosIn(item){return item?Array.from(item.querySelectorAll("rid-native-video")):[]}_isVisible(video){return!!video.parentElement&&getComputedStyle(video.parentElement).display!=="none"}_playableVideos(item){if(this.userPaused)return[];const autoStartAllowed=!window.MediaFeatures.prefersReducedMotion();return this._videosIn(item).filter(function(video){return this._isVisible(video)?video.dataset.ridManualPlay==="true"?!0:autoStartAllowed&&video.getAttribute("data-video-autoplay")!=="false":!1}.bind(this))}_playVideos(item){const playable=this._playableVideos(item);this._videosIn(item).forEach(function(video){playable.indexOf(video)===-1?video.pause():video.play()}),playable.length===0&&this._videosIn(item).forEach(function(video){const poster=video.parentElement?.querySelector(".rid-slideshow__poster");poster&&(poster.hidden=!1)}),this._restorePlayButton(item,playable.length>0)}_restorePlayButton(item,isPlaying){if(!item)return;const button=item.querySelector("[data-rid-slide-play]");button&&(button.hidden=isPlaying)}_pauseVideos(item){const videos=this._videosIn(item);videos.forEach(function(video){video.pause(),delete video.dataset.ridManualPlay});
8const needsControl=videos.some(function(video){return video.getAttribute("data-video-autoplay")==="false"});this._restorePlayButton(item,needsControl===!1)}_pauseAllVideos(){Array.from(this.querySelectorAll("rid-native-video")).forEach(function(video){video.pause()})}};RidSlideshow?window.customElements.define("rid-slideshow",RidSlideshow):console.error("rid-slideshow: slide-show base class missing, video slides disabled"),(function(){const setToggleState=ridSetToggleState,previewFor=function(toggle){const host=toggle.closest("rid-native-video");return host?host.querySelector("video"):null};if(document.addEventListener("click",function(event){const toggle=event.target.closest("[data-rid-preview-toggle]");if(!toggle)return;event.preventDefault(),event.stopPropagation();const preview=previewFor(toggle);preview&&(preview.paused?(preview.play().catch(function(){}),setToggleState(toggle,!1)):(preview.pause(),setToggleState(toggle,!0)))},!0),!window.MediaFeatures||!window.MediaFeatures.prefersReducedMotion())return;const pausePreviews=function(){Array.from(document.querySelectorAll("video.rid-video-preview")).forEach(function(video){video.autoplay=!1,video.pause()}),Array.from(document.querySelectorAll("[data-rid-preview-toggle]")).forEach(function(toggle){setToggleState(toggle,!0)})};pausePreviews(),document.addEventListener("DOMContentLoaded",pausePreviews)})();
9//# sourceMappingURL=/cdn/shop/t/469/assets/rid-theme.js.map?v=123999348802021276981789143143

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.