1(function(){if(window.__shippingRatesInit)return;window.__shippingRatesInit=!0;const config=window.shippingRatesConfig||{},cartBase=window.routes&&window.routes.cart_url||"/cart",POLL_INTERVAL=500,POLL_MAX_ATTEMPTS=20;let requestToken=0;function formatEuro(cents){return(cents/100).toLocaleString("de-DE",{style:"currency",currency:"EUR"})}function buildQuery(){const params=new URLSearchParams;return params.set("shipping_address[zip]",config.zip||""),params.set("shipping_address[country]",config.country||""),config.province&¶ms.set("shipping_address[province]",config.province),params.toString()}function getCartState(totals){const node=totals.querySelector("[data-cart-total]");return node?{totalCents:parseInt(node.dataset.cartTotal,10)||0,itemCount:parseInt(node.dataset.cartItemCount,10)||0}:null}function getTotalsBlocks(){return Array.from(document.querySelectorAll(".totals")).filter(totals=>{const state=getCartState(totals);return state&&state.itemCount>0})}function setLoading(isLoading){getTotalsBlocks().forEach(totals=>{totals.querySelectorAll(".loading__spinner").forEach(spinner=>{spinner.classList.toggle("hidden",!isLoading)})})}function applyRate(rate){document.querySelector('[data-pickup-only="true"]')||getTotalsBlocks().forEach(totals=>{const subtotalCents=(getCartState(totals)||{}).totalCents||0,shippingNode=totals.querySelector("[data-shipping-price]"),estimatedNode=totals.querySelector("[data-estimated-price]"),correctedShipping=(parseInt(totals.dataset.fullCartValue,10)||subtotalCents)>=29800?2995:495;shippingNode&&(shippingNode.textContent=formatEuro(correctedShipping)),estimatedNode&&(estimatedNode.textContent=formatEuro(subtotalCents+correctedShipping))})}function delay(ms){return new Promise(resolve=>setTimeout(resolve,ms))}async function pollRates(query,token){const url=`${cartBase}/async_shipping_rates.json?${query}`;for(let attempt=0;attempt<POLL_MAX_ATTEMPTS;attempt++){if(token!==requestToken)return null;const data=await(await fetch(url)).json();if(data!==null)return Array.isArray(data)?data:data.shipping_rates||[];await delay(POLL_INTERVAL)}return null}function cartIsEmpty(event){const count=event&&event.cartData&&event.cartData.item_count;return typeof count=="number"?count===0:event?!1:getTotalsBlocks().length===0}async function refresh(event){if(cartIsEmpty(event))return;const token=++requestToken,query=buildQuery();setLoading(!0);try{if(await fetch(`${cartBase}/prepare_shipping_rates.json?${query}`,{method:"POST"}),token!==requestToken)return;const rates=await pollRates(query,token);if(token!==requestToken)return;rates&&rates.length&&applyRate(rates[0])}catch(error){console.error("[shipping-rates]",error)}finally{token===requestToken&&setLoading(!1)}}function init(){refresh(),typeof subscribe=="function"&&typeof PUB_SUB_EVENTS<"u"&&subscribe(PUB_SUB_EVENTS.cartUpdate,event=>refresh(event))}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",init):init()})(); 2//# sourceMappingURL=/cdn/shop/t/48/assets/shipping-rates.js.map?v=25603592613368499151788851052
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.