1(()=>{const UUID_PATTERN=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,createGroupCode=()=>{if(typeof crypto?.randomUUID=="function")return crypto.randomUUID();const bytes=new Uint8Array(16);crypto.getRandomValues(bytes),bytes[6]=bytes[6]&15|64,bytes[8]=bytes[8]&63|128;const hex=[...bytes].map(value=>value.toString(16).padStart(2,"0")).join("");return`${hex.slice(0,8)}-${hex.slice(8,12)}-${hex.slice(12,16)}-${hex.slice(16,20)}-${hex.slice(20)}`},groupCodeForProduct=async root=>{try{const response=await fetch(root.dataset.cartJsonUrl,{headers:{Accept:"application/json"}});if(response.ok){const cart=await response.json(),productId=Number(root.dataset.productId),existing=(Array.isArray(cart.items)?cart.items:[]).find(item=>Number(item.product_id)===productId&&String(item.properties?._delia_tasting_booking||"")==="1"&&UUID_PATTERN.test(String(item.properties?._delia_tasting_order_code||"")));if(existing)return String(existing.properties._delia_tasting_order_code).toLowerCase()}}catch(error){console.warn("[delia-category-picker] cart lookup failed, creating a new group code",error)}return createGroupCode()},initialize=root=>{if(!root||root.dataset.categoryPickerReady==="true")return;root.dataset.categoryPickerReady="true";const isGerman=String(root.dataset.locale||"").toLowerCase().startsWith("de"),copyNode=root.querySelector("[data-category-copy]"),copy=copyNode?JSON.parse(copyNode.textContent):{},options=[...root.querySelectorAll("[data-category-option]")],quantity=root.querySelector("[data-category-quantity]"),minus=root.querySelector("[data-category-minus]"),plus=root.querySelector("[data-category-plus]"),add=root.querySelector("[data-category-add]"),summary=root.querySelector("[data-category-summary]"),total=root.querySelector("[data-category-total]"),status=root.querySelector("[data-category-status]"),formatter=new Intl.NumberFormat(isGerman?"de-DE":"en-US",{style:"currency",currency:root.dataset.currency||"EUR"});let selected=null;const normalizedQuantity=()=>{if(!selected)return 1;const maximum=Number(selected.dataset.available||0),value=Number.parseInt(quantity.value,10);return Math.min(maximum,Math.max(1,Number.isFinite(value)?value:1))},update=()=>{if(!selected){summary.textContent=isGerman?copy.none:copy.noneEn,total.textContent="",quantity.disabled=!0,minus.disabled=!0,plus.disabled=!0,add.disabled=!0;return}const count=normalizedQuantity(),maximum=Number(selected.dataset.available||0);quantity.value=String(count),quantity.max=String(maximum),quantity.disabled=!1,minus.disabled=count<=1,plus.disabled=count>=maximum,add.disabled=maximum<1;const ticketLabel=count===1?copy.ticket:copy.tickets;summary.textContent=`${selected.dataset.categoryLabel} \xB7 ${count} ${ticketLabel}`,total.textContent=formatter.format(Number(selected.dataset.priceCents||0)*count/100)};options.filter(option=>!option.disabled).forEach(option=>{option.addEventListener("click",()=>{options.forEach(candidate=>candidate.setAttribute("aria-pressed","false")),selected=option,selected.setAttribute("aria-pressed","true"),quantity.value="1",status.textContent="",update()})}),minus.addEventListener("click",()=>{quantity.value=String(normalizedQuantity()-1),update()}),plus.addEventListener("click",()=>{quantity.value=String(normalizedQuantity()+1),update()}),quantity.addEventListener("input",update),quantity.addEventListener("change",update),add.addEventListener("click",async()=>{if(!selected||selected.disabled)return;const count=normalizedQuantity();add.disabled=!0,status.textContent=isGerman?copy.adding:copy.addingEn;try{const groupCode=await groupCodeForProduct(root),response=await fetch(root.dataset.cartAddUrl,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items:[{id:Number(selected.dataset.variantId),quantity:count,properties:{_delia_tasting_booking:"1",_delia_tasting_order_code:groupCode,_delia_tasting_category:selected.dataset.categoryCode||"",_delia_tasting_category_label:selected.dataset.categoryLabel||""}}]})});if(!response.ok)throw new Error(`cart_add_${response.status}`);window.location.assign(root.dataset.cartUrl)}catch(error){console.error("[delia-category-picker] add failed",error),status.textContent=isGerman?copy.error:copy.errorEn,update()}}),update()},initializeAll=(scope=document)=>scope.querySelectorAll("[data-delia-category-picker]").forEach(initialize);document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>initializeAll(),{once:!0}):initializeAll(),document.addEventListener("shopify:section:load",event=>initializeAll(event.target))})(); 2//# sourceMappingURL=/cdn/shop/t/129/assets/delia-tasting-category-picker.js.map?v=162406072003582718821788269307
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.