1const genericCache=new Map;export async function fetchCache(url,prefix="",options={}){const cacheKey=url+prefix;if(genericCache.has(cacheKey)){const{body,headers}=genericCache.get(cacheKey);return Promise.resolve(new Response(body,{headers}))}const res=await fetch(url,options);if(res.status===200){const clone=res.clone(),body=await clone.text(),headersObj={};for(const[key,value]of clone.headers.entries())headersObj[key]=value;url.includes("quick_order_list")||genericCache.set(cacheKey,{body,headers:headersObj})}return res}export function hasInFetchCache(urlPrefix){return genericCache.has(urlPrefix)}export function fetchConfig(type="json",config={}){const headers={"Content-Type":"application/json",Accept:`application/${type}`,...config.headers};return type==="javascript"&&(headers["X-Requested-With"]="XMLHttpRequest",delete headers["Content-Type"]),{method:"POST",headers,body:config.body}}export function debounce(fn,wait){let timeout;function debounced(...args){clearTimeout(timeout),timeout=setTimeout(()=>fn.apply(this,args),wait)}return debounced.cancel=()=>{clearTimeout(timeout)},debounced}export function throttle(callback){let requestId=null,lastArgs=null;const throttled=function(...args){lastArgs=args,requestId===null&&(requestId=requestAnimationFrame(()=>{callback.apply(this,lastArgs),requestId=null,lastArgs=null}))};return throttled.cancel=()=>{requestId!==null&&(cancelAnimationFrame(requestId),requestId=null)},throttled}const placeholderRegex=/\{\{\s*(\w+)\s*\}\}/;function defaultTo(value2,defaultValue){return value2==null||value2!==value2?defaultValue:value2}function formatWithDelimiters(number,precision,thousands,decimal){if(precision=defaultTo(precision,2),thousands=defaultTo(thousands,","),decimal=defaultTo(decimal,"."),isNaN(number)||number==null)return 0;number=(number/100).toFixed(precision);let parts=number.split("."),dollarsAmount=parts[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+thousands),centsAmount=parts[1]?decimal+parts[1]:"";return dollarsAmount+centsAmount}export function formatMoney(cents,format=""){typeof cents=="string"&&(cents=cents.replace(".",""));const formatString=format||window.themeHDN.settings.moneyFormat;let value="";switch(formatString.match(placeholderRegex)[1]){case"amount":value=formatWithDelimiters(cents,2);break;case"amount_no_decimals":value=formatWithDelimiters(cents,0);break;case"amount_with_space_separator":value=formatWithDelimiters(cents,2," ",".");break;case"amount_with_comma_separator":value=formatWithDelimiters(cents,2,".",",");break;case"amount_with_apostrophe_separator":value=formatWithDelimiters(cents,2,"'",".");break;case"amount_no_decimals_with_comma_separator":value=formatWithDelimiters(cents,0,".",",");break;case"amount_no_decimals_with_space_separator":value=formatWithDelimiters(cents,0," ");break;case"amount_no_decimals_with_apostrophe_separator":value=formatWithDelimiters(cents,0,"'");break}return formatString.indexOf("with_comma_separator")!==-1,formatString.replace(placeholderRegex,value)}export function $4(selector,container=document){return container.querySelector(selector)}export function $id4(selector){return document.getElementById(selector)}export function $$4(selector,container=document){return[...container.querySelectorAll(selector)]}const predefinedMediaQueries={mobile:"screen and (max-width: 767px)",tablet:"screen and (min-width: 768px) and (max-width: 1149px)",hover:"screen and (hover: hover) and (pointer: fine)",motion:"(prefers-reduced-motion: no-preference)"};export function matchMediaQuery(type){return window.matchMedia(predefinedMediaQueries[type]||type).matches}export function createImg(imgObj={}){const img=new Image,attrs=imgObj.attrs||{},{alt,src}=imgObj;for(const key in attrs)img.setAttribute(key,attrs[key]);return img.alt=alt||"",img.src=src,img.srcset=renderSrcset(src,JSON.parse(attrs["data-widths"])),imgObj.onload&&img.addEventListener("load",function(){const parentImage=img.parentElement||img;parentImage.removeAttribute("loading"),parentImage.setAttribute("loaded","")},{once:!0}),img}function normalizeImageSrc(src){return/^https?:\/\//.test(src)?src:`https://${src.replace(/^\/+/,"")}`}
1export function renderSrcset(baseSrc,widths){const url=new URL(normalizeImageSrc(baseSrc)),maxWidth=parseInt(url.searchParams.get("width")||widths[widths.length-1]);return widths.filter(w=>w<=maxWidth).map(w=>(url.searchParams.set("width",w),`${url.toString()} ${w}w`)).join(", ")}export function requestIdleCallback(callback,options={}){const timeout=options?.timeout||2e3;let timeoutId,isExecuted=!1;const wrappedCallback=deadline=>{isExecuted||(isExecuted=!0,clearTimeout(timeoutId),callback.length===0?callback():callback(deadline))};return timeoutId=setTimeout(()=>{if(!isExecuted){isExecuted=!0;const mockDeadline={timeRemaining:()=>0,didTimeout:!0};callback.length===0?callback():callback(mockDeadline)}},timeout),window.requestIdleCallback(wrappedCallback,{timeout})}export function cancelIdleCallback(id){window.cancelIdleCallback(id)} 2//# sourceMappingURL=/cdn/shop/t/128/assets/utilities.js.map?v=27569922199415201261787582124
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.