efficient-storefront-blocks 0.130.15 → 0.131.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/chunks/{CustomHtmlCodeWindow-DHCKPXRN.js → CustomHtmlCodeWindow-JINOMDUB.js} +1 -1
  3. package/dist/chunks/{EditorPreviewCheckout-WPWX5CLZ.js → EditorPreviewCheckout-B5B4BHEG.js} +1 -1
  4. package/dist/chunks/SiteEditorProvider-CJRYE2LF.js +1 -0
  5. package/dist/chunks/{chunk-66NNRDRA.js → chunk-3QCDDPXL.js} +1 -1
  6. package/dist/chunks/{chunk-HEKC2QYZ.js → chunk-43XANC6T.js} +1 -1
  7. package/dist/chunks/{chunk-AL6K3KD7.js → chunk-7W33H2GG.js} +1 -1
  8. package/dist/chunks/{chunk-LSEWOQRA.js → chunk-GVSVEV2H.js} +8 -8
  9. package/dist/chunks/{chunk-43DAA6QE.js → chunk-PJVO662Y.js} +1 -1
  10. package/dist/chunks/chunk-QYTBEMMG.js +337 -0
  11. package/dist/chunks/{chunk-4J3EMW4L.js → chunk-R5FDAR72.js} +1 -1
  12. package/dist/chunks/{chunk-NOV6LTTJ.js → chunk-SV3VVDBH.js} +1 -1
  13. package/dist/chunks/{fitment-data-JY77OFQP.js → fitment-data-FRSLYOCL.js} +1 -1
  14. package/dist/chunks/{section-css-style-TB33NIO4.js → section-css-style-3IQWMPDP.js} +1 -1
  15. package/dist/editor/lib/document/blocks/service/Form/fields.js +1 -1
  16. package/dist/editor/lib/document/config.js +1 -1
  17. package/dist/index.js +26 -26
  18. package/dist/links.js +1 -1
  19. package/dist/render/app/globals.css +17 -0
  20. package/dist/render/built-with.json +1 -1
  21. package/dist/render/components/FormBlock.d.ts +19 -2
  22. package/dist/render/components/FormBlock.js +1 -1
  23. package/dist/render/lib/document/blocks/service/Form/render.js +1 -1
  24. package/dist/render/lib/document/blocks/text-part-shapes.json +1 -1
  25. package/dist/render/lib/document/footer-page-blocks.d.ts +1 -0
  26. package/dist/render/lib/document/footer-page-blocks.js +1 -1
  27. package/dist/routine-index.json +1 -1
  28. package/dist/value-index.json +1 -1
  29. package/dist/words.d.ts +8 -0
  30. package/dist/words.js +4 -4
  31. package/package.json +4 -4
  32. package/dist/chunks/SiteEditorProvider-CKIUIYEI.js +0 -1
  33. package/dist/chunks/chunk-KZNWKZDS.js +0 -337
  34. /package/dist/chunks/{chunk-HEKC2QYZ.js.LEGAL.txt → chunk-43XANC6T.js.LEGAL.txt} +0 -0
  35. /package/dist/chunks/{chunk-5OXXOEE7.js → chunk-FVHAKC6L.js} +0 -0
  36. /package/dist/chunks/{chunk-KZNWKZDS.js.LEGAL.txt → chunk-QYTBEMMG.js.LEGAL.txt} +0 -0
  37. /package/dist/chunks/{chunk-RCXMXKPT.js → chunk-T5PQ7BY4.js} +0 -0
  38. /package/dist/chunks/{chunk-3DKV2YJ6.js → chunk-TICXZI44.js} +0 -0
@@ -1 +1 @@
1
- import{S as X,X as Bt,_ as Ht,aa as zt,ba as qt,da as U,g as Wt}from"./chunk-4J3EMW4L.js";import{O as Ft,aa as Je,ba as et,da as Dt,ka as tt,la as Ut}from"./chunk-AL6K3KD7.js";import{j as q}from"./chunk-RCXMXKPT.js";import{ri as ve,si as $t,vf as Ot}from"./chunk-66NNRDRA.js";import{c as Mt}from"./chunk-3DKV2YJ6.js";import{createContext as rr,useContext as Jt,useEffect as or,useMemo as Ee,useState as jt}from"react";function Kt(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function ge(e,t){if(e.length===0)return null;let n=0;for(let r of e){let o=r.prices?.[t];if(typeof o!="number"||!Number.isFinite(o)||o<=0)return null;n+=o*r.wheels}return n}var nt=4,Do=1;function Jn(e){return e.spareAxle??"front"}var Mo={unit:"set",spares:0,spareSide:"left"};function Vt(e){return e.unit==="single"?1:nt+e.spares}function Yt(e,t){return[{partNumber:e.partNumber,wheels:Vt(t),prices:e.prices}]}function Qt(e,t){let n=Vt(t)-nt;if(n<=0||e.length===0)return e;let r=er(e),o=r?null:tr(e),i=r?r[t.spareSide]:o?o[t.spareSide][Jn(t)]:0;return e.map((s,a)=>a===i?{...s,wheels:s.wheels+n}:s)}function er(e){let t,n;for(let r=0;r<e.length;r+=1){let o=e[r].hand;if(o!=="left"&&o!=="right")continue;if((o==="left"?t:n)!==void 0)return null;o==="left"?t=r:n=r}return t!==void 0&&n!==void 0?{left:t,right:n}:null}function tr(e){let t={};for(let s=0;s<e.length;s+=1){let{hand:a,axle:c}=e[s];if(a!=="left"&&a!=="right"||c!=="front"&&c!=="rear")return null;let u=`${a}-${c}`;if(t[u]!==void 0)return null;t[u]=s}let{"left-front":n,"left-rear":r,"right-front":o,"right-rear":i}=t;return n!==void 0&&r!==void 0&&o!==void 0&&i!==void 0?{left:{front:n,rear:r},right:{front:o,rear:i}}:null}function rt(e){let t=typeof e.spares=="number"?e.spares:e.spare?1:0;return{unit:e.unit,spares:t,spareSide:e.spareSide??"left",...e.spareAxle?{spareAxle:e.spareAxle}:{}}}function ot(e,t){return t.spares>0?`${e} + spare`:e}function Xt(e){return e.unit==="single"?"Single":ot(`Set of ${nt}`,e)}var $o="data-add-to-basket",it=9,nr="en",Gt=new Map;function Ue(e,t,n){let r=`${e}|${t??""}|${n??""}`,o=Gt.get(r);return o||(o=new Intl.NumberFormat(nr,{style:"currency",currency:e,...t===void 0?{}:{minimumFractionDigits:t},...n===void 0?{}:{maximumFractionDigits:n}}),Gt.set(r,o)),o}function ee(e,t,n=0){return Ue(t,0,n).format(e)}function Uo(e,t){return Ue(t).format(e)}function Wo(e,t){let n=e.savings[t];if(n===void 0)return null;let r=ee(n,t);return e.savingIsFrom?`Save from ${r}`:`Save ${r}`}import{jsx as lr}from"react/jsx-runtime";var ir="storefront-country",Zt=ir,st=rr(null);function sr(e){return en(e,"catalogue")}function ar(e){return en(e,"money")}function en(e,t){let n=new Map(e.map(r=>[r.code,r.decimalPlaces]));return(r,o)=>{if(!o)return"";let i=n.get(o)??0;return Ue(o,t==="money"?i:0,i).format(r)}}function Go({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=Ee(()=>t??[],[t]),s=Ee(()=>n??[],[n]),a=Ee(()=>r||i.find(g=>g.isDefault)?.code||i[0]?.code||"",[r,i]),c=Ee(()=>o||s.find(g=>g.isDefault)?.code||s[0]?.code||"",[o,s]),[u,m]=jt(c),[C,p]=jt(!1);or(()=>{let g=q.getItem(Zt);g&&s.some(_=>_.code===g)&&m(g),p(!0)},[s]);function R(g){m(g),q.setItem(Zt,g)}let L=Ee(()=>{let g=s.find(b=>b.code===u)??null,_=g?.currency,A=_&&i.some(b=>b.code===_)?_:a,F=sr(i),v=ar(i);return{country:u,currency:A,setCountry:R,currencies:i,countries:s,activeCountry:g,formatPrice:(b,D)=>F(b,D??A),formatMoney:(b,D)=>v(b,D??A),ready:C}},[u,i,s,a,C]);return lr(st.Provider,{value:L,children:e})}function tn(e){let t=Jt(st);if(!t&&!e?.optional)throw new Error("useCurrency must be used within a CurrencyProvider");return t}function Ko(){return Jt(st)?.country??""}import{createContext as Dr,useCallback as w,useContext as Mr,useEffect as W,useMemo as vn,useRef as j,useState as E}from"react";function nn(){return"/edit"}function on(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var sn="We'll confirm this discount when you place your order.",jo="Confirmed at checkout";function Zo(e){return e&&(e.valid||e.deferred)?e.code:void 0}var rn="coupon_code: ";function Jo(e){return!(e instanceof X)||e.status!==400||!e.message.startsWith(rn)?null:e.message.slice(rn.length)}function at(e,t){return e.map(n=>({qty:n.qty,slug:n.slug,name:`${n.name.lead}${n.name.accent}`.trim(),finish:n.finishName,size:n.size,kind:n.kind,sku:n.sku,pack:n.pack,priceLabel:t(n)}))}var ur=["width","profile","rim"],ni={width:"Width",profile:"Profile",rim:"Rim"},cr=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,dr={width:[100,500],profile:[20,100],rim:[10,30]};function lt(e){let t=cr.exec(e??"");if(!t)return null;let n={width:Number(t[1]),profile:Number(t[2]),rim:Number(t[3])};return ur.every(o=>{let[i,s]=dr[o];return n[o]>=i&&n[o]<=s})?n:null}function ye(e){if(e.width==null)return"";if(e.profile==null)return String(e.width);let t=`${e.width}/${e.profile}`;return e.rim==null?t:`${t} R${e.rim}`}function ri(e){return[ye({width:e.width}),ye({width:e.width,profile:e.profile}),ye(e)]}function ai(e){if(!e||e.year===null)return null;let{make:t,model:n,year:r,modification:o}=e;return!t||!n||!o?null:{make:t,model:n,year:r,modification:o}}function pr(e,t){let n=new URLSearchParams({make:t.make,model:t.model,year:String(t.year),modification:t.modification});return`/api/v1/tyres/${encodeURIComponent(e)}/fitment?${n.toString()}`}function Pe(e,t=""){return{vehicle:{...e,region:t},status:"unknown",oemSizes:[],variants:[]}}function mr(e,t){if(typeof t!="object"||t===null)return Pe(e);let n=t,r=typeof n.vehicle=="object"&&n.vehicle!==null?n.vehicle:{},o=typeof r.region=="string"?r.region:"",i=n.status;if(i!=="fits"&&i!=="doesNotFit")return Pe(e,o);let s=Array.isArray(n.variants)?n.variants.filter(a=>typeof a=="object"&&a!==null&&typeof a.sku=="string"&&typeof a.fits=="boolean"):[];return s.length===0?Pe(e,o):{vehicle:{make:typeof r.make=="string"?r.make:e.make,model:typeof r.model=="string"?r.model:e.model,year:typeof r.year=="number"?r.year:e.year,modification:typeof r.modification=="string"?r.modification:e.modification,region:o},status:i,oemSizes:Array.isArray(n.oemSizes)?n.oemSizes.filter(a=>typeof a=="string"):[],variants:s.map(a=>({sku:a.sku,size:typeof a.size=="string"?a.size:"",fits:a.fits}))}}async function li(e,t){try{let n=await Bt(pr(e,t),{baseUrl:""});return mr(t,n)}catch(n){return n instanceof X&&n.status>=400&&n.status<500?Pe(t):{...Pe(t),failed:!0}}}function ui(e){if(!e)return[];let t=[];for(let n of[...e.frontTyres,...e.rearTyres]){let r=lt(n);if(!r)continue;let o=ye(r);t.includes(o)||t.push(o)}return t}function ci(e,t){if(t.length===0)return null;for(let n of e){let r=lt(n);if(!r)continue;let o=ye(r);if(t.includes(o))return o}return null}function gr(e,t){if(!e||e.status==="unknown")return"unknown";let n=e.variants.find(r=>r.sku===t);return n?n.fits?"fits":"doesNotFit":"unknown"}var yr="/tyres";function an(e){return e?`${yr}/${e}`:null}function We(e){let t=e.lastIndexOf(" ");return t===-1?{lead:"",accent:e}:{lead:e.slice(0,t+1),accent:e.slice(t+1)}}function hr(e,t){return Yt({partNumber:e.sku,prices:e.prices},t)}var br="Tyre";function ln(e,t,n,r){return{id:`${e.slug}|${t.sku}|${n.unit}|${n.spares>0?"spare":"no-spare"}`,slug:e.slug,name:We(e.name),process:e.brand||br,positionNo:"01",config:[{label:t.size},{label:Xt(n)}],finishName:"",size:t.size,components:hr(t,n),qty:r,href:an(e.slug)??void 0,kind:"tyre",sku:t.sku,pack:n}}function bi(e){return e.kind==="tyre"}function Ci(e,t){let n=e.prices?.[t];return typeof n!="number"||!Number.isFinite(n)||n<=0?!1:e.inStock}var Cr="dually";function ct(e){let t=e.components.reduce((o,i)=>o+i.wheels,0)||4,n=e.kind,r=[n==="staggered"?"Staggered":n===Cr?"Dually":""].filter(Boolean);return r.length?`${r.join(" ")} set of ${t}`:`Set of ${t}`}function xr(e,t){return[...new Set(e.filter(n=>!t||n.finishName===t).map(n=>n.size))]}function un(e,t,n){if(!(!t||!n))return e.find(r=>r.finishName===t&&r.size===n)}function Sr(e){return e!=null&&e.inStock===!1}function vi(e,t){return t?e.filter(n=>n.finishName===t&&Sr(n)):[]}function Ei(e,t,n){return t.findIndex((r,o)=>n[o]!==!1&&xr(e,r).length>0)}function Pi(e){let t=new Set((e.sizePairs??[]).map(o=>`${o.diameter}x${o.width}`)),n=e.spec?.pcds??[],r=e.spec?.etRange??[];return t.size===1&&n.length<=1&&(r.length===0||r[0]===r[r.length-1])}var dn="alloy-wheel",vr="tyre";function Be(e){return e.name||e.slug||"An item from your cart"}async function fn(e,t){let n=[],r=new Map;for(let s of e){if(!s.slug){n.push(Be(s));continue}let a=s.kind??dn,c=`${a}\0${s.slug}`,u=r.get(c);u?u.snaps.push(s):r.set(c,{kind:a,slug:s.slug,snaps:[s]})}let o=await Promise.all([...r.values()].map(s=>Er(s,t))),i=[];for(let s of o)for(let a of s)a.ok?i.push(a.line):n.push(a.name);return{lines:i,dropped:n}}function cn(e){if(e instanceof X&&e.status===404)return null;throw e}async function Er(e,t){let n=e.snaps.map(r=>({ok:!1,name:Be(r)}));if(e.kind===dn){let r=await t.getWheel(e.slug).catch(cn);return r?e.snaps.map(o=>Pr(e.slug,r,o)):n}if(e.kind===vr){let r=await t.getTyre(e.slug).catch(cn);return r?e.snaps.map(o=>kr(r,o)):n}return n}function Pr(e,t,n){let r=un(t.variants,n.finish,n.size);if(!r)return{ok:!1,name:Be(n)};let o=n.pack?rt(n.pack):void 0,i=(o?.spares??0)>0;return{ok:!0,line:{id:`${e}|${r.finishName}|${r.size}${i?"|spare":""}|restored`,slug:e,name:We(t.name),process:t.process,positionNo:"01",config:[{label:r.size},{label:r.finishName,gold:!0},{label:o?ot(ct(r),o):ct(r)}],finishName:r.finishName,size:r.size,components:o&&i?Qt(r.components,o):r.components,qty:n.qty,...i?{pack:o}:{}}}}function kr(e,t){let n={ok:!1,name:Be(t)};if(!t.pack||!t.sku)return n;let r=rt(t.pack),o=e.variants.find(i=>i.sku===t.sku);return o?{ok:!0,line:ln(e,o,r,t.qty)}:n}var He="Price on request",Ii="Request a quote",pn="from ",Oi="From ",Fi="each",mn="Free",Di="Updating";function dt(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function ft(e,t){let n=e?.[t];return dt(n)?n:null}function Mi(e,t,n,r){let o=ft(e,n),i=ft(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function $i(e,t,n,r){if(n==null&&r==null)return!0;let o=ft(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var wr={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function Rr(e,t,n){if(!dt(e))return wr;let r=dt(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function Ui(e,t,n=""){return!e.priced||e.unit==null?He:`${n}${ee(e.unit,t)}`}function Wi(e,t){return e.was==null?null:ee(e.was,t)}function Tr(e,t,n=1){let r=ge(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((s,a)=>s+a.wheels,0),i=Math.min(...e.map(s=>s.prices[t]));return{priced:!0,unit:i,isFrom:i*o!==r,setTotal:r*n}}var Lr={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function Bi(e,t,n,r=1){let o=Rr(e.prices[n],e.msrpPrices?.[n],4),i=o.setTotal==null?null:o.setTotal*r;if(!t)return{priced:o.priced,unit:o.unit,isFrom:!0,was:o.was,onSale:o.onSale,setTotal:null,fromSetTotal:i};let s=Tr(t.components,n,r);return s.priced?{priced:!0,unit:s.unit,isFrom:s.isFrom,was:null,onSale:!1,setTotal:s.setTotal,fromSetTotal:i}:{...Lr,fromSetTotal:i}}function Hi(e,t){return!e.priced||e.unit==null?He:`${e.isFrom?pn:""}${ee(e.unit,t)}`}function zi(e,t){return e.was==null?null:ee(e.was,t)}function qi(e,t){let n=e.savings[t];if(n===void 0||e.components.length===0)return null;let r=0;for(let i of e.components){let s=i.prices?.[t];if(typeof s!="number")return null;r+=s*i.quantity}let o=ee(r-n,t);return{was:ee(r,t),amount:e.savingIsFrom?`${pn}${o}`:o}}var Ar=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function gn(e){return Ar.test(e.trim())}var yn="sf:ga-purchases",_r=20;function bn(){return typeof window>"u"||window.parent!==window}function ke(...e){try{if(bn()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function Nr(e,t){let n=e.config.find(r=>r.gold)?.label;return{item_id:`${e.slug}|${e.finishName}|${e.size}`,item_name:`${e.name.lead}${e.name.accent}`.trim(),...n?{item_variant:n}:{},price:ge(e.components,t)??0,quantity:e.qty}}function pt(e,t){return e.filter(we).map(n=>Nr(n,t))}function Xi(e){ke("event","view_item",{currency:e.currency,value:e.pricePerSet,items:[{item_id:e.itemId,item_name:e.itemName,...e.variant?{item_variant:e.variant}:{},price:e.pricePerSet,quantity:1}]})}function Cn(e,t){let n=pt([e],t);n.length!==0&&ke("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function ji(e){let t=pt(e.lines,e.currency);t.length!==0&&ke("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var hn=new Set;function Ir(e){if(hn.has(e))return!1;hn.add(e);try{let t=JSON.parse(q.getItem(yn)??"[]");if(t.includes(e))return!1;q.setItem(yn,JSON.stringify([...t,e].slice(-_r)))}catch{}return!0}function Zi(e){let t=e.confirmation;if(bn()||!Ir(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);ke("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:pt(e.lines,n)}),e.adsSendTo&&ke("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var Or="Arranged after review",xn="Calculated at checkout",Fr=xn,ts=xn;function Sn({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function ns(e){switch(e){case"arranged":return Or;case"pending":return Fr;case"free":return mn;case"charged":return null}}import{jsx as Br}from"react/jsx-runtime";var $r=400,Ur=400,Wr=1500,mt="storefront-cart";function we(e){return(e.components?.length??0)>0}function En(e,t){return{code:e,valid:t.valid,deferred:on(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function kn(e,t){return ge(e.components,t)}function gt(e,t){let n=kn(e,t);return n===null?null:n*e.qty}function Pn(e){return e!=="tyre"}var wn=Dr(null);function hs({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=tn(),[i,s]=E(t),[a,c]=E([]),[u,m]=E([]),[C,p]=E([]),[R,L]=E(!1),g=j(new Set),[_,A]=E([]),[F,v]=E(!1),[b,D]=E(null),[G,re]=E(null),[de,h]=E(null),[P,x]=E(0),M=w(()=>x(l=>l+1),[]),[oe,he]=E(void 0),[K,_e]=E(null),[k,$]=E(null),[V,ie]=E(!1),[O,fe]=E(null),se=j(void 0),Y=w(()=>s(!0),[]),Z=w(()=>s(!1),[]),Ne=w(()=>s(l=>!l),[]);W(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&Y()},[Y,t]);let B=nn(),Q=j(B);W(()=>{Q.current!==B&&(Q.current=B,t||Z())},[B,t,Z]);let Ie=w(l=>{_e(f=>f?.country===l?.country&&f?.subdivision===l?.subdivision&&f?.postcode===l?.postcode?f:l)},[]),I=w((l,f)=>{v(!0),!(!f||!Pn(l))&&A(d=>d.includes(f)?d:[...d,f])},[]),Oe=F||a.length>0,ae=j(!0);W(()=>(ae.current=!0,()=>{ae.current=!1}),[]),W(()=>{if(t)return;let l=[..._,...a.filter(d=>Pn(d.kind)).map(d=>d.slug)],f=[...new Set(l)].filter(d=>d&&!g.current.has(d));if(f.length!==0){for(let d of f)g.current.add(d);U.listWheelsBySlug(f).then(d=>{if(!ae.current||d.length===0)return;let y=new Set(d.map(S=>S.slug));m(S=>[...S.filter(ue=>!y.has(ue.slug)),...d])})}},[t,_,a]),W(()=>{if(t||!Oe||R)return;let l=!0;return U.listBundles().then(f=>{l&&(p(f),L(!0))}),()=>{l=!1}},[t,Oe,R]);let H=b?.deliveryOptions??[],be=b?.courier??null;W(()=>{b&&fe(l=>l&&H.some(f=>f.id===l)?l:H[0]?.id??null)},[b]);let le=w(()=>a.filter(we).flatMap(l=>Kt(l.components,l.qty)),[a]),Ce=w(async(l,f)=>{let d=l.trim().toUpperCase();if(!d)return;let y=le();if(y.length===0){$({code:d,valid:!1,message:"Add a wheel to the cart first."});return}ie(!0),se.current=f;try{let S=await U.validateCoupon({code:d,items:y,currency:n,shippingMethodId:O??void 0,customerEmail:f});$(En(d,S))}catch{$({code:d,valid:!1,unchecked:!0,message:"Could not check that code. Please try again."})}finally{ie(!1)}},[le,n,O]),pe=w(()=>{$(null),se.current=void 0},[]),Fe=w(l=>{if(!k)return;let{code:f}=k;$(d=>d&&d.code===f?{code:f,valid:!1,refused:!0,message:l}:d)},[k]);W(()=>{if(!k||k.refused)return;let l=k.code,f=y=>y!==null&&y.code===l&&!y.refused,d=setTimeout(async()=>{let y=le();if(y.length===0){$(S=>f(S)?{code:l,valid:!1,message:"Add a wheel to the cart first."}:S);return}ie(!0);try{let S=await U.validateCoupon({code:l,items:y,currency:n,shippingMethodId:O??void 0,customerEmail:se.current});$(ue=>f(ue)?En(l,S):ue)}catch{}finally{ie(!1)}},$r);return()=>clearTimeout(d)},[a,n,O]);let xe=k&&!k.refused?k.code:void 0;W(()=>{if(t)return;let l=!0,f=a,d=setTimeout(async()=>{let y=le();if(y.length===0){D(null),re(null),he(void 0);return}try{let S=await U.quoteCart({items:y,currency:n,shippingMethodId:O??void 0,couponCode:xe,customerEmail:se.current||void 0,country:K?.country||r||void 0,subdivision:K?.country&&K.subdivision||void 0,postcode:K?.country&&K.postcode||void 0});if(!l)return;D(S),re(f),h(null)}catch{if(!l)return;h(f)}he(xe)},Ur);return()=>{l=!1,clearTimeout(d)}},[a,n,O,xe,r,K,P]);let T=w(l=>{c(f=>{let d=f.findIndex(y=>y.id===l.id);return d===-1?[...f,l]:f.map((y,S)=>S===d?{...y,qty:Math.min(it,y.qty+l.qty)}:y)}),Cn(l,n)},[n]),J=w(l=>{c(f=>f.filter(d=>d.id!==l))},[]),De=w((l,f)=>{let d=Math.max(1,Math.min(it,f));c(y=>y.map(S=>S.id===l?{...S,qty:d}:S))},[]),Me=w(l=>{c(l)},[]),[vt,Qe]=E(!1),[Et,Gn]=E([]),Pt=j(a);Pt.current=a,W(()=>{if(t)return;let l=[];try{let d=JSON.parse(q.getItem(mt)??"[]");Array.isArray(d)&&(l=d)}catch{}if(l.length===0){Qe(!0);return}let f=!0;return fn(l,U).then(({lines:d,dropped:y})=>{f&&(Pt.current.length===0&&(Me(d),Gn(y)),Qe(!0))},d=>{f&&Qe(!0)}),()=>{f=!1}},[t,Me]),W(()=>{if(t||!vt)return;let l=a.filter(we);if(l.length===0){q.removeItem(mt);return}q.setItem(mt,JSON.stringify(at(l,()=>"")))},[a,t,vt]);let[Se,Kn]=E(null),kt=j(null);kt.current=Se;let z=j(null),Xe=j(""),wt=w((l,f)=>{let d=l.trim().toLowerCase();gn(d)&&Kn(y=>y&&y.email===d&&y.firstName===(f??"")?y:{email:d,firstName:f??""})},[]);W(()=>{if(t||!Se)return;let l=at(a.filter(we),y=>gt(y,n)===null?He:o(gt(y,n),n)),f={email:Se.email,firstName:Se.firstName,currency:n,items:l},d=JSON.stringify(f);if(d!==Xe.current)return z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{z.current=null,Xe.current=d,U.captureCart(f).catch(y=>{})},Wr),()=>{z.current&&(clearTimeout(z.current),z.current=null)}},[a,Se,n,t]);let Rt=w(()=>{z.current&&(clearTimeout(z.current),z.current=null);let l=kt.current;l&&(Xe.current="",U.captureCart({email:l.email,firstName:l.firstName,currency:n,items:[]}).catch(f=>{}))},[n]),Tt=vn(()=>{let l=a.reduce((N,me)=>{let $e=gt(me,n);return $e===null?N:N+$e},0),f=a.some(N=>kn(N,n)===null),d=a.reduce((N,me)=>N+me.qty,0),y=k?.valid?k.effects:void 0,S=y?Math.min(l,Number(y.discountAmount)):0,ue=b?.bundleDiscount??0,Yn=b?.appliedBundles??[],je=!!y?.freeShipping,Nt=H.find(N=>N.id===O),It=je?0:b?.shipping??Nt?.amount??0,Qn=Sn({quoted:b!==null,optionCount:H.length,chosenAmount:Nt?.amount,couponWaivesFreight:je}),Ze={};for(let N of y?.freeUnits??[])Ze[N.partNumber]=(Ze[N.partNumber]??0)+N.quantity;let Xn=b?.tax??null,jn=b?b.grandTotal:l-S-ue+It;return{sets:d,units:a.reduce((N,me)=>N+(me.components??[]).reduce(($e,Zn)=>$e+Zn.wheels*me.qty,0),0),subtotal:l,hasUnpricedLine:f,discount:S,bundleDiscount:ue,appliedBundles:Yn,shipping:It,freeShipping:je,shippingStatus:Qn,freeUnitsByPartNumber:Ze,tax:Xn,grand:jn,repricing:!!k?.refused&&b!==null&&oe===k?.code,quoted:b!==null&&G===a,serverSubtotal:b?.subtotal??null,quoteFailed:de===a,currency:n}},[a,n,k,H,O,b,oe,G,de]),Lt=j(!0),At=w(l=>{Lt.current=l},[]),_t=w(l=>{T(l),Lt.current&&Y()},[T,Y]),Vn=vn(()=>({isOpen:i,preview:t,open:Y,close:Z,toggle:Ne,items:a,catalog:u,bundles:C,warmCatalog:I,add:T,addAndOpen:_t,setAutoOpen:At,remove:J,setQty:De,replaceItems:Me,restoreDropped:Et,identify:wt,clearCapturedCart:Rt,coupon:k,applyCoupon:Ce,removeCoupon:pe,refuseCoupon:Fe,couponBusy:V,deliveryOptions:H,setQuoteDestination:Ie,courier:be,requote:M,shippingMethodId:O,setShippingMethodId:fe,totals:Tt}),[i,t,Y,Z,Ne,a,u,C,I,T,_t,At,J,De,Me,Et,wt,Rt,k,Ce,pe,Fe,V,H,Ie,be,M,O,Tt]);return Br(wn.Provider,{value:Vn,children:e})}function Rn(){let e=Mr(wn);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as jr}from"react";function Tn(e){return/(?:^|\|)(?:slug|xhost):/.test(e)}function Ln(e,t,n,r){for(;e.size>=t;){let o,i;for(let[a,c]of e){if(c.expiresAt<=r){o=a;break}i===void 0&&n(a)&&(i=a)}let s=o??i??e.keys().next().value;if(s===void 0)return;e.delete(s)}}var Hr=6e4,zr=5e3,qr=500,ze=new Map;async function Gr(e){let{host:t,matchesRequestHost:n}=await Ht();if(!t)return"";let r=await zt();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}async function An(e,t){if(await qt()!==null)return t();let n=await Gr(e);if(!n)return t();let r=Date.now(),o=ze.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),s=i.outcome.state==="failed",a=s?zr:Hr,c=ze.get(n)?.lastGood,u=i.outcome.state==="ok"?i:s?c:void 0,m=s&&u?u:i;return Ln(ze,qr,Tn,r),ze.set(n,{load:m,expiresAt:r+a,lastGood:u}),m}var Kr=404;function Vr(e){if(e instanceof X&&e.status===Kr)return{state:"absent"};let t=e instanceof X?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var Yr="[storefront:chrome-load-failed]";function Qr(e,t){console.error(`${Yr} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function _n(e,t,n,r){try{let o=await t();return r?.(o)?{value:o,outcome:{state:"absent"}}:{value:o,outcome:{state:"ok"}}}catch(o){let i=Vr(o);return i.state==="failed"&&Qr(e,i),{value:n,outcome:i}}}function Xr(e){return e==="production"?"silent":"banner"}var ks=Xr("production");function Zr(e,t){return e?.trim()||t}function Is({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=Zr(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var Jr={name:ve,legalName:null,foundedYear:null,faviconUrl:null,currencies:[],defaultCurrency:null,countries:[],defaultCountry:null,commerceEnabled:!0,cardPayments:!1,paymentMethods:[],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,privacyPage:null,termsPage:null,footerCookieSettings:!0,footerSitemap:!0,socialLinks:tt},Os=jr(async()=>An("site",()=>_n("site",async()=>{let e=await U.getSite();return{name:$t(e.name),legalName:e.legalName?.trim()||null,foundedYear:e.foundedYear??null,faviconUrl:e.faviconUrl??null,currencies:e.currencies??[],defaultCurrency:e.defaultCurrency??null,countries:e.countries??[],defaultCountry:e.defaultCountry??null,commerceEnabled:e.commerceEnabled??!0,cardPayments:e.cardPayments??!1,paymentMethods:e.paymentMethods??(e.cardPayments?["card"]:[]),paypalClientId:e.paypalClientId??null,paypalEnvironment:e.paypalEnvironment??null,squareApplicationId:e.squareApplicationId??null,squareLocationId:e.squareLocationId??null,squareEnvironment:e.squareEnvironment??null,ga4MeasurementId:e.ga4MeasurementId??null,googleAdsId:e.googleAdsId??null,googleAdsConversionLabel:(e.googleAdsId?e.googleAdsConversionLabel:null)??null,metaPixelId:e.metaPixelId??null,consentEnabled:e.consentEnabled??!1,consentPrivacyPage:e.consentPrivacyPage??null,consentNoticeOptOut:e.consentNoticeOptOut??!1,privacyPage:e.privacyPage??null,termsPage:e.termsPage??null,footerCookieSettings:e.footerCookieSettings??!0,footerSitemap:e.footerSitemap??!0,socialLinks:Ut(e.socialLinks)}},Jr)));var Fs={name:ve,legalName:null,foundedYear:null,faviconUrl:null,currencies:[{code:"USD",symbol:"$",decimalPlaces:2,isDefault:!0}],defaultCurrency:"USD",countries:[{code:"US",name:"United States",currency:"USD",url:"",isDefault:!0,chargeTax:!1,taxDisplay:"none",taxName:"",taxRate:null,postalLabel:"Zip Code"}],defaultCountry:"US",commerceEnabled:!0,cardPayments:!0,paymentMethods:["card"],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,privacyPage:null,termsPage:null,footerCookieSettings:!0,footerSitemap:!0,socialLinks:tt};import{jsx as eo}from"react/jsx-runtime";function Ms({tone:e="bad",role:t,children:n}){return eo("div",{role:t,className:["border bg-surface px-4 py-3 text-[14px] leading-relaxed text-fg",e==="good"?"border-accent":e==="bad"?"border-alert":"border-line"].join(" "),children:n})}import{jsx as Te,jsxs as yt}from"react/jsx-runtime";import{useEffect as qe,useId as oo,useRef as In,useState as Ge}from"react";import{useRootIsDark as io}from"efficient-shell/theme";import{efficientClientOpen as to}from"efficient-easel/screen/lib/session";var Re=new Map,no=64;async function ro(e){if(!to())return null;try{let t=await fetch(`${Mt()}/logo-analysis.json?url=${encodeURIComponent(e)}`);if(!t.ok)return null;let n=await t.json();if(!n||typeof n!="object")return null;let{reversed:r,inkIsDark:o}=n;return typeof r!="string"?null:{reversed:r,inkIsDark:typeof o=="boolean"?o:null}}catch{return null}}function Nn(e){let t=Re.get(e);if(t)return t;let n=ro(e);if(Re.set(e,n),Re.size>no){let r=Re.keys().next();r.done||Re.delete(r.value)}return n}var so=202/22,ao=.88,na=16,lo="invert(1)";function ra({variant:e="header",scrolled:t=!0,src:n,reverse:r=!1,color:o=null,onLightSurface:i,reversedSrc:s,inkIsDark:a,size:c="medium",sizePx:u,sizeUnit:m,wordmark:C,siteName:p=ve,fitToContainer:R=!1,fitWordmarkToContainer:L=!1,fitFloorPx:g,hideClass:_,hideAttrs:A,part:F}){let v=C&&C.trim()?C.trim():p,[b,D]=Ge(null),G=In(null),re=T=>{G.current=T};qe(()=>{D(G.current?.ownerDocument??null)},[]);let de=!io({doc:b,whenUnset:!0}),h=n&&n.trim()?n.trim():null,P=!!h&&Wt(h),x=i??(de&&t),M=o&&o.trim()?o.trim():null,oe=r&&!M,he=`logo-color-${oo().replace(/[^A-Za-z0-9_-]/g,"")}`,K=oe&&P&&h&&s!=null?{reversed:s,inkIsDark:a??null}:null,_e=K!==null,[k,$]=Ge(null);qe(()=>{if(!oe||!h||!P||_e){$(null);return}let T=!1;return $(null),Nn(h).then(J=>{T||$(J)}),()=>{T=!0}},[oe,h,P,_e]);let V=K??k,ie=!!V&&V.inkIsDark!==null&&(x?!V.inkIsDark:V.inkIsDark),O=oe&&!!h&&!P&&!x,fe=ie&&V?V.reversed:h,se=fe?[fe]:[],[Y,Z]=Ge(0);qe(()=>{Z(0)},[h,ie]);let Ne=e==="footer"?et:Je[c],B=u&&u>0?u:Ne,Q=(u&&u>0?Ot(u,m,"size",Dt):null)??`${B}px`,Ie=Math.round(B*so),I=Y<se.length?se[Y]:null,[Oe,ae]=Ge(fe),H=I!==null&&I===Oe,be=In(null);qe(()=>{let T=be.current;if(!T||!T.complete)return;if(T.naturalWidth>0||T.naturalHeight>0){ae(I);return}let J=!1;return T.decode().then(()=>!J&&ae(I),()=>!J&&Z(De=>De+1)),()=>{J=!0}},[I]);let le=R||L,Ce=`calc(100cqi / ${((v.length+1)*ao).toFixed(2)})`,pe=le&&g&&g>0?Q===`${B}px`?`${Math.min(g,B)}px`:`min(${g}px, ${Q})`:null,Fe=le?pe===null?`min(${Q}, ${Ce})`:`clamp(${pe}, ${Ce}, ${Q})`:Q,xe=yt("span",{className:`font-display font-bold tracking-[0.18em] ${pe===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:Fe,lineHeight:1,...M?{color:M}:{}},"aria-label":v,children:[v,Te("span",{className:"text-accent",style:M?{color:M}:void 0,children:"."})]});return yt("span",{ref:re,className:Ft("inline-flex items-center",_??""),...A,...F,children:[!H&&xe,M&&I&&Te("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:yt("filter",{id:he,colorInterpolationFilters:"sRGB",children:[Te("feFlood",{style:{floodColor:M}}),Te("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),I&&Te("img",{ref:be,src:I,alt:v,width:Ie,height:B,className:"shrink-0 object-contain",style:{...H?{height:Q,width:"auto",...R?{maxWidth:"100cqi"}:{}}:{display:"none"},...O?{filter:lo}:{},...M?{filter:`url(#${he})`}:{}},onLoad:()=>ae(I),onError:()=>Z(T=>T+1)},I)]})}var ia="w-full border-2 border-line bg-bg px-4 py-4 font-display text-[17px] tracking-[-0.005em] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent",On="w-0 min-w-0 flex-1",sa="w-0 min-w-[7rem] flex-1";import{jsx as Le,jsxs as co}from"react/jsx-runtime";function uo({spokes:e,mesh:t=!1,className:n}){let s=c=>Math.round(c*1e3)/1e3,a=[];for(let c=0;c<e;c++){let u=c/e*Math.PI*2-Math.PI/2;if(a.push({x1:s(100+Math.cos(u)*22),y1:s(100+Math.sin(u)*22),x2:s(100+Math.cos(u)*86),y2:s(100+Math.sin(u)*86),main:!0}),t){let m=u+Math.PI/e;a.push({x1:s(100+Math.cos(m)*22*1.4),y1:s(100+Math.sin(m)*22*1.4),x2:s(100+Math.cos(m)*78),y2:s(100+Math.sin(m)*78),main:!1})}}return co("svg",{viewBox:"0 0 200 200",fill:"none",stroke:"currentColor",className:n??"block h-[70%] w-[70%] transition-transform duration-700 [transition-timing-function:cubic-bezier(.2,.6,.2,1)]",children:[Le("circle",{cx:100,cy:100,r:92,strokeWidth:2}),Le("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),Le("circle",{cx:100,cy:100,r:22,strokeWidth:2}),Le("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),a.map((c,u)=>Le("line",{x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,stroke:"currentColor",strokeWidth:c.main?6:3,strokeLinecap:"round",opacity:c.main?1:.5},u))]})}var ca="#c9a461",Fn=[{f:"black",label:"Black",hex:"#171717"},{f:"silver",label:"Silver",hex:"#cccccc"},{f:"bronze",label:"Bronze",hex:"#8a6438"},{f:"graphite",label:"Graphite",hex:"#3a3c3f"},{f:"red",label:"Candy Red",hex:"#7a0f14"}],da={name:"",color:"var(--fg)",family:"silver",src:""};function fo(e,t){let n=r=>{let o=Fn.findIndex(i=>i.f===r);return o===-1?Fn.length:o};return n(e)-n(t)||e.localeCompare(t)}function fa(e){let t=new Set;for(let n of e)for(let r of n.finishes??[])r?.family&&t.add(r.family);return[...t].sort(fo)}import{useEffect as po,useRef as Dn,useState as mo}from"react";import{jsx as ce,jsxs as ht}from"react/jsx-runtime";function go({customerEmail:e,disabled:t=!1}){let{coupon:n,applyCoupon:r,removeCoupon:o,couponBusy:i}=Rn(),[s,a]=mo(""),c=Dn(!1),u=Dn(null);po(()=>{!c.current||n===null||(c.current=!1,u.current?.focus())},[n]);async function m(){t||i||!s.trim()||(c.current=!0,await r(s,e),a(""))}return ht("div",{className:"flex flex-col gap-2",children:[n===null?ht("div",{className:"flex border border-line",children:[ce("input",{type:"text",value:s,onChange:C=>a(C.target.value),onKeyDown:C=>{C.key==="Enter"&&(C.preventDefault(),m())},placeholder:"Coupon code","aria-label":"Coupon code",disabled:t,className:`${On} bg-transparent px-4 py-4 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim`}),ce("button",{type:"button",onClick:()=>{m()},disabled:i||t,className:"border-l border-line px-4 font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-wait disabled:opacity-60",children:i?"\u2026":"Apply"})]}):ht("div",{className:["flex items-center justify-between gap-3 border px-4 py-3",n.valid?"border-accent":"border-line"].join(" "),style:n.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[ce("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",n.valid?"text-accent":n.deferred||n.unchecked?"text-fg":"text-fg-dim line-through"].join(" "),children:n.code}),n.unchecked&&ce("button",{type:"button",onClick:()=>{r(n.code,e)},disabled:i||t,className:"ml-auto font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:text-fg disabled:cursor-wait disabled:opacity-60",children:i?"\u2026":"Try again"}),!t&&ce("button",{ref:u,type:"button",onClick:o,"aria-label":`Remove coupon ${n.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"\u2715"})]}),n?.deferred?ce("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:sn}):n&&!n.valid&&n.message&&ce("p",{role:"alert",className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:n.message})]})}var bt="Ads on. Shopper can opt out.",Ke="Ads and analytics off until Accept",yo={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:bt,footerLink:"Do Not Sell or Share My Personal Information",panelEyebrow:"Do not sell or share",adsRowName:"Sale or sharing for ads"},ca:{region:"ca",name:"Canada",model:"opt-in",law:"PIPEDA, Quebec Law 25",beforeChoice:Ke,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:bt,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:bt,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:Ke,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:Ke,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:Ke,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}};function ho(e){let t=[...e.googleAds?["Google"]:[],...e.meta?["Facebook","Instagram"]:[]];return t.length<=1?t.join(""):`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function xa(e,t,n){let r=ho(n),o=r?`We use cookies to count visits and to show you ${t} ads on ${r}.`:"We use cookies to count visits.";return e.model==="opt-in"?{heading:r?"Cookies and ads":"Cookies",before:`${o} Nothing loads until you choose. You can change this at any time with `,link:e.footerLink,after:" at the bottom of every page."}:{heading:r?"Cookies and ads":"Cookies",before:`${o} You can say no at any time: choose Privacy choices, or use `,link:e.footerLink,after:" at the bottom of every page."}}var Sa={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on",close:"Close",cookieSettings:"Cookie settings"};var bo={asked:!1,region:"other",model:"opt-in",analytics:!0,ads:!0,chosen:!0,gpc:!1};var Co=bo;function ka(e=Co){if(e.asked)return e.ads?"granted":"denied"}function Ra(){let e=typeof crypto<"u"?crypto:void 0;if(typeof e?.randomUUID=="function")return e.randomUUID();let t=new Uint8Array(16);if(typeof e?.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}import{Children as So,isValidElement as vo,useEffect as $n,useId as Eo,useLayoutEffect as Bn,useRef as te,useState as Un}from"react";var Ve=(e,t)=>!!e[t]&&!e[t].disabled;function Ct(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(Ve(e,i))return i}return t}function xt(e,t){return Ct(e,t===1?-1:e.length,t)}function St(e,t){return Ve(e,t)?t:Math.max(xt(e,1),0)}function Mn(e,t,n){let{open:r,focus:o}=e,i=s=>({...e,...s});if(t.length===1&&/\S/.test(t)){let s=e.typed+t.toLowerCase(),a=n.findIndex((c,u)=>Ve(n,u)&&c.label.toLowerCase().startsWith(s));return{state:i({open:!0,typed:s,focus:a>=0?a:o}),handled:!0}}if(!r)return t==="ArrowDown"||t==="ArrowUp"||t==="Enter"||t===" "?{state:i({open:!0,typed:""}),handled:!0}:{state:e,handled:!1};switch(t){case"ArrowDown":return{state:i({focus:Ct(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:Ct(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:xt(n,1)}),handled:!0};case"End":return{state:i({focus:xt(n,-1)}),handled:!0};case"Enter":case" ":return Ve(n,o)?{state:i({open:!1,typed:""}),commit:o,refocus:!0,handled:!0}:{state:e,handled:!0};case"Escape":return{state:i({open:!1,typed:""}),refocus:!0,handled:!0};case"Tab":return{state:i({open:!1,typed:""}),handled:!1};default:return{state:e,handled:!1}}}import{placeMenu as Po}from"efficient-shell/ui";import{Fragment as _o,jsx as ne,jsxs as Hn}from"react/jsx-runtime";var Wn={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function ko({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[s,a]=Un(!1),c=r!==void 0,u=c?r:s,[m,C]=Un(0),p=te({text:"",timer:0}),R=te(null),L=te(null),g=te(null),_=Eo(),A=te(null),F=e.findIndex(h=>h.value===t),v=h=>{h!==u&&(c||a(h),h?o?.():i?.())},b=h=>{let P=e[h];!P||P.disabled||(n(P.value),v(!1),L.current?.focus())},D=h=>{let P={open:u,focus:u?m:St(e,F),typed:p.current.text},x=Mn(P,h,e);return!x.handled&&x.state.open===u?!1:(x.state.typed!==P.typed&&(p.current.text=x.state.typed,window.clearTimeout(p.current.timer),p.current.timer=window.setTimeout(()=>{p.current.text=""},500)),C(x.state.focus),x.commit!==void 0?b(x.commit):v(x.state.open),x.refocus&&L.current?.focus(),x.handled)},G=te(D);G.current=D;let re=te(()=>v(!1));re.current=()=>v(!1);let de=h=>{u||(A.current=h.nativeEvent,G.current(h.key)&&h.preventDefault())};return $n(()=>{if(!u)return;let h=x=>{R.current?.contains(x.target)||re.current()},P=x=>{x!==A.current&&G.current(x.key)&&x.preventDefault()};return document.addEventListener("mousedown",h),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",P)}},[u]),$n(()=>{u&&(p.current.text||C(St(e,F)))},[u]),Bn(()=>{if(!u||!g.current)return;g.current.children.item(m)?.scrollIntoView({block:"nearest"})},[m,u]),{open:u,toggle:()=>v(!u),close:()=>v(!1),focusIdx:m,setFocusIdx:C,pick:h=>b(e.findIndex(P=>P.value===h)),wrapRef:R,triggerRef:L,listRef:g,listId:_,onTriggerKeyDown:de,activeId:u?`${_}-${m}`:void 0}}var wo={select:{list:"absolute left-0 top-full z-50 mt-1 max-h-[280px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:(e,t,n)=>["px-3 py-3 font-mono text-[13px] font-semibold uppercase tracking-[0.1em] transition-colors whitespace-nowrap",n?"cursor-not-allowed opacity-40":"cursor-pointer",e&&!n?"bg-accent text-bg":"bg-bg text-fg"].join(" ")},cell:{list:"absolute left-0 top-full z-50 mt-1 max-h-[320px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:e=>[`cursor-pointer whitespace-nowrap px-6 py-3 font-mono ${Wn.label} font-semibold uppercase tracking-[0.1em] transition-colors`,e?"bg-accent text-bg":"bg-bg text-fg"].join(" "),pickerMarker:!0},hairline:{list:"absolute left-0 top-full z-50 max-h-[320px] w-full overflow-y-auto border border-line bg-bg shadow-[0_6px_20px_rgba(0,0,0,0.10)]",item:(e,t)=>[`flex cursor-pointer items-center justify-between gap-4 border-b border-line px-4 py-3 text-left ${Wn.body} transition-colors last:border-b-0`,t?"border-fg font-medium text-fg":e?"border-fg text-fg":"text-fg-dim"].join(" "),pickerMarker:!0},region:{list:"absolute right-0 top-full z-[200] mt-2 flex min-w-[240px] flex-col border border-line bg-surface text-fg",item:(e,t,n,r)=>["flex w-full cursor-pointer items-center gap-3 px-4 py-3 text-left transition-colors","font-mono text-[13px] uppercase tracking-[0.18em]",e?"bg-surface-2 text-fg":"",r?"":"border-b border-line",t?"text-accent":""].join(" "),itemStyle:e=>e?void 0:{color:"color-mix(in oklab, currentColor 80%, transparent)"}}};function Ro(e,t){Bn(()=>{let n=e.current,r=n?.ownerDocument.defaultView;if(!n||!r)return;let o=()=>{let i=n.style;i.top=i.bottom=i.marginTop=i.marginBottom=i.maxHeight=i.overflowY=i.translate="";let s=n.offsetParent??n.parentElement;if(!s)return;let a=s.getBoundingClientRect(),c=n.getBoundingClientRect(),u=Math.abs(c.right-a.right)<Math.abs(c.left-a.left)?"end":"start",m=Po({trigger:{left:a.left,right:a.right,top:a.top,bottom:a.bottom},menu:{width:c.width,height:c.height},bounds:{left:0,top:0,right:r.innerWidth,bottom:r.innerHeight},align:u,side:"bottom"});if(m.side==="top"){i.top="auto",i.bottom="100%",i.marginTop="0px";let p=m.top+Math.min(c.height,m.maxHeight);i.marginBottom=`${Math.max(0,a.top-p)}px`}m.maxHeight<c.height&&(i.maxHeight=`${m.maxHeight}px`,i.overflowY="auto");let C=m.left-c.left;C&&(i.translate=`${C}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function To(e){return e.split(" ").map(t=>t==="left-0"?"right-0":t).join(" ")}function Lo({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:s,listRef:a,ariaLabel:c,align:u="start"}){let m=wo[t],C=te(null);return Ro(C,n.length),ne("ul",{ref:p=>{C.current=p,a&&(a.current=p)},id:e,role:"listbox","aria-label":c,...m.pickerMarker?{"data-picker-menu":""}:{},className:u==="end"?To(m.list):m.list,children:n.map((p,R)=>{let L=p.value===r;return ne("li",{id:`${e}-${R}`,role:"option","aria-selected":L,"aria-disabled":p.disabled||void 0,onMouseEnter:()=>!p.disabled&&i(R),onMouseDown:g=>{g.preventDefault(),p.disabled||s(p.value)},className:m.item(R===o,L&&p.value!=="",!!p.disabled,R===n.length-1),style:m.itemStyle?.(L),children:p.meta===void 0?p.label:Hn(_o,{children:[p.lead,ne("span",{className:"flex-1 whitespace-nowrap",children:p.label}),ne("span",{className:"ml-auto text-[12px] opacity-50",children:p.meta})]})},`${p.value}_${R}`)})})}function Ao({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:s,id:a,"aria-label":c,align:u}){let m=So.toArray(r).flatMap(g=>{if(!vo(g))return[];if(g.type!=="option")return[];let A=g.props,F=A.value!==void 0?String(A.value):"",v=A.children,b=typeof v=="string"||typeof v=="number"?String(v):F;return[{value:F,label:b,disabled:!!A.disabled}]}),C=e??"",p=ko({items:m,value:C,onPick:g=>t?.({target:{value:g}})}),L=m.find(g=>g.value===C)?.label??m[0]?.label??"";return Hn("div",{ref:p.wrapRef,className:"relative",children:[s&&ne("input",{type:"hidden",name:s,value:C}),ne("button",{ref:g=>{p.triggerRef.current=g},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":p.open,"aria-controls":p.open?p.listId:void 0,"aria-activedescendant":p.activeId,"aria-label":c,id:a,onClick:()=>!n&&p.toggle(),onKeyDown:g=>!n&&p.onTriggerKeyDown(g),className:`block w-full ${o??""}`,style:i,children:ne("span",{className:"block w-full truncate text-left",children:L})}),p.open&&ne(Lo,{id:p.listId,tone:"select",items:m,value:C,focusIdx:p.focusIdx,onFocus:p.setFocusIdx,onPick:p.pick,listRef:p.listRef,align:u})]})}import{jsx as Ae,jsxs as Ye}from"react/jsx-runtime";var No="font-mono text-[length:var(--size-label,12px)]",Io="font-semibold uppercase tracking-[0.22em] text-fg";function zn(e){return`${e??No} ${Io}`}function qn(){return Ae("span",{className:"text-accent",children:" *"})}function Oo({children:e,required:t,labelFace:n}){return Ye("span",{className:zn(n),children:[e,t?Ae(qn,{}):null]})}function Fo({label:e,required:t,hint:n,separate:r,htmlFor:o,labelFace:i,className:s,children:a}){let c=s?`flex flex-col gap-2 ${s}`:"flex flex-col gap-2",u=n?Ae("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?Ye("div",{className:c,children:[Ye("label",{htmlFor:o,className:zn(i),children:[e,t?Ae(qn,{}):null]}),a,u]}):Ye("label",{htmlFor:o,className:c,children:[Ae(Oo,{required:t,labelFace:i,children:e}),a]})}export{nn as a,jo as b,Zo as c,Jo as d,Kt as e,nt as f,Do as g,Jn as h,Mo as i,Qt as j,er as k,tr as l,ot as m,Xt as n,$o as o,it as p,Ue as q,ee as r,Uo as s,Wo as t,ur as u,ni as v,lt as w,ye as x,ri as y,ai as z,Pe as A,li as B,ui as C,ci as D,gr as E,an as F,We as G,hr as H,ln as I,bi as J,Ci as K,ct as L,un as M,Sr as N,vi as O,Ei as P,Pi as Q,He as R,Ii as S,pn as T,Oi as U,Fi as V,mn as W,Di as X,ft as Y,Mi as Z,$i as _,Rr as $,Ui as aa,Wi as ba,Tr as ca,Bi as da,Hi as ea,zi as fa,qi as ga,gn as ha,Xi as ia,ji as ja,Zi as ka,ts as la,ns as ma,Go as na,tn as oa,Ko as pa,we as qa,gt as ra,hs as sa,Rn as ta,Is as ua,Jr as va,Fs as wa,ia as xa,On as ya,sa as za,uo as Aa,ca as Ba,Fn as Ca,da as Da,fo as Ea,fa as Fa,go as Ga,Ms as Ha,na as Ia,ra as Ja,yo as Ka,xa as La,Sa as Ma,bo as Na,ka as Oa,Ra as Pa,ko as Qa,Lo as Ra,Ao as Sa,Oo as Ta,Fo as Ua};
1
+ import{S as X,X as Bt,_ as Ht,aa as zt,ba as qt,da as U,g as Wt}from"./chunk-R5FDAR72.js";import{O as Ft,aa as Je,ba as et,da as Dt,ka as tt,la as Ut}from"./chunk-7W33H2GG.js";import{j as q}from"./chunk-T5PQ7BY4.js";import{ri as ve,si as $t,vf as Ot}from"./chunk-3QCDDPXL.js";import{c as Mt}from"./chunk-TICXZI44.js";import{createContext as rr,useContext as Jt,useEffect as or,useMemo as Ee,useState as jt}from"react";function Kt(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function ge(e,t){if(e.length===0)return null;let n=0;for(let r of e){let o=r.prices?.[t];if(typeof o!="number"||!Number.isFinite(o)||o<=0)return null;n+=o*r.wheels}return n}var nt=4,Do=1;function Jn(e){return e.spareAxle??"front"}var Mo={unit:"set",spares:0,spareSide:"left"};function Vt(e){return e.unit==="single"?1:nt+e.spares}function Yt(e,t){return[{partNumber:e.partNumber,wheels:Vt(t),prices:e.prices}]}function Qt(e,t){let n=Vt(t)-nt;if(n<=0||e.length===0)return e;let r=er(e),o=r?null:tr(e),i=r?r[t.spareSide]:o?o[t.spareSide][Jn(t)]:0;return e.map((s,a)=>a===i?{...s,wheels:s.wheels+n}:s)}function er(e){let t,n;for(let r=0;r<e.length;r+=1){let o=e[r].hand;if(o!=="left"&&o!=="right")continue;if((o==="left"?t:n)!==void 0)return null;o==="left"?t=r:n=r}return t!==void 0&&n!==void 0?{left:t,right:n}:null}function tr(e){let t={};for(let s=0;s<e.length;s+=1){let{hand:a,axle:c}=e[s];if(a!=="left"&&a!=="right"||c!=="front"&&c!=="rear")return null;let u=`${a}-${c}`;if(t[u]!==void 0)return null;t[u]=s}let{"left-front":n,"left-rear":r,"right-front":o,"right-rear":i}=t;return n!==void 0&&r!==void 0&&o!==void 0&&i!==void 0?{left:{front:n,rear:r},right:{front:o,rear:i}}:null}function rt(e){let t=typeof e.spares=="number"?e.spares:e.spare?1:0;return{unit:e.unit,spares:t,spareSide:e.spareSide??"left",...e.spareAxle?{spareAxle:e.spareAxle}:{}}}function ot(e,t){return t.spares>0?`${e} + spare`:e}function Xt(e){return e.unit==="single"?"Single":ot(`Set of ${nt}`,e)}var $o="data-add-to-basket",it=9,nr="en",Gt=new Map;function Ue(e,t,n){let r=`${e}|${t??""}|${n??""}`,o=Gt.get(r);return o||(o=new Intl.NumberFormat(nr,{style:"currency",currency:e,...t===void 0?{}:{minimumFractionDigits:t},...n===void 0?{}:{maximumFractionDigits:n}}),Gt.set(r,o)),o}function ee(e,t,n=0){return Ue(t,0,n).format(e)}function Uo(e,t){return Ue(t).format(e)}function Wo(e,t){let n=e.savings[t];if(n===void 0)return null;let r=ee(n,t);return e.savingIsFrom?`Save from ${r}`:`Save ${r}`}import{jsx as lr}from"react/jsx-runtime";var ir="storefront-country",Zt=ir,st=rr(null);function sr(e){return en(e,"catalogue")}function ar(e){return en(e,"money")}function en(e,t){let n=new Map(e.map(r=>[r.code,r.decimalPlaces]));return(r,o)=>{if(!o)return"";let i=n.get(o)??0;return Ue(o,t==="money"?i:0,i).format(r)}}function Go({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=Ee(()=>t??[],[t]),s=Ee(()=>n??[],[n]),a=Ee(()=>r||i.find(g=>g.isDefault)?.code||i[0]?.code||"",[r,i]),c=Ee(()=>o||s.find(g=>g.isDefault)?.code||s[0]?.code||"",[o,s]),[u,m]=jt(c),[C,p]=jt(!1);or(()=>{let g=q.getItem(Zt);g&&s.some(_=>_.code===g)&&m(g),p(!0)},[s]);function R(g){m(g),q.setItem(Zt,g)}let L=Ee(()=>{let g=s.find(b=>b.code===u)??null,_=g?.currency,A=_&&i.some(b=>b.code===_)?_:a,F=sr(i),v=ar(i);return{country:u,currency:A,setCountry:R,currencies:i,countries:s,activeCountry:g,formatPrice:(b,D)=>F(b,D??A),formatMoney:(b,D)=>v(b,D??A),ready:C}},[u,i,s,a,C]);return lr(st.Provider,{value:L,children:e})}function tn(e){let t=Jt(st);if(!t&&!e?.optional)throw new Error("useCurrency must be used within a CurrencyProvider");return t}function Ko(){return Jt(st)?.country??""}import{createContext as Dr,useCallback as w,useContext as Mr,useEffect as W,useMemo as vn,useRef as j,useState as E}from"react";function nn(){return"/edit"}function on(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var sn="We'll confirm this discount when you place your order.",jo="Confirmed at checkout";function Zo(e){return e&&(e.valid||e.deferred)?e.code:void 0}var rn="coupon_code: ";function Jo(e){return!(e instanceof X)||e.status!==400||!e.message.startsWith(rn)?null:e.message.slice(rn.length)}function at(e,t){return e.map(n=>({qty:n.qty,slug:n.slug,name:`${n.name.lead}${n.name.accent}`.trim(),finish:n.finishName,size:n.size,kind:n.kind,sku:n.sku,pack:n.pack,priceLabel:t(n)}))}var ur=["width","profile","rim"],ni={width:"Width",profile:"Profile",rim:"Rim"},cr=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,dr={width:[100,500],profile:[20,100],rim:[10,30]};function lt(e){let t=cr.exec(e??"");if(!t)return null;let n={width:Number(t[1]),profile:Number(t[2]),rim:Number(t[3])};return ur.every(o=>{let[i,s]=dr[o];return n[o]>=i&&n[o]<=s})?n:null}function ye(e){if(e.width==null)return"";if(e.profile==null)return String(e.width);let t=`${e.width}/${e.profile}`;return e.rim==null?t:`${t} R${e.rim}`}function ri(e){return[ye({width:e.width}),ye({width:e.width,profile:e.profile}),ye(e)]}function ai(e){if(!e||e.year===null)return null;let{make:t,model:n,year:r,modification:o}=e;return!t||!n||!o?null:{make:t,model:n,year:r,modification:o}}function pr(e,t){let n=new URLSearchParams({make:t.make,model:t.model,year:String(t.year),modification:t.modification});return`/api/v1/tyres/${encodeURIComponent(e)}/fitment?${n.toString()}`}function Pe(e,t=""){return{vehicle:{...e,region:t},status:"unknown",oemSizes:[],variants:[]}}function mr(e,t){if(typeof t!="object"||t===null)return Pe(e);let n=t,r=typeof n.vehicle=="object"&&n.vehicle!==null?n.vehicle:{},o=typeof r.region=="string"?r.region:"",i=n.status;if(i!=="fits"&&i!=="doesNotFit")return Pe(e,o);let s=Array.isArray(n.variants)?n.variants.filter(a=>typeof a=="object"&&a!==null&&typeof a.sku=="string"&&typeof a.fits=="boolean"):[];return s.length===0?Pe(e,o):{vehicle:{make:typeof r.make=="string"?r.make:e.make,model:typeof r.model=="string"?r.model:e.model,year:typeof r.year=="number"?r.year:e.year,modification:typeof r.modification=="string"?r.modification:e.modification,region:o},status:i,oemSizes:Array.isArray(n.oemSizes)?n.oemSizes.filter(a=>typeof a=="string"):[],variants:s.map(a=>({sku:a.sku,size:typeof a.size=="string"?a.size:"",fits:a.fits}))}}async function li(e,t){try{let n=await Bt(pr(e,t),{baseUrl:""});return mr(t,n)}catch(n){return n instanceof X&&n.status>=400&&n.status<500?Pe(t):{...Pe(t),failed:!0}}}function ui(e){if(!e)return[];let t=[];for(let n of[...e.frontTyres,...e.rearTyres]){let r=lt(n);if(!r)continue;let o=ye(r);t.includes(o)||t.push(o)}return t}function ci(e,t){if(t.length===0)return null;for(let n of e){let r=lt(n);if(!r)continue;let o=ye(r);if(t.includes(o))return o}return null}function gr(e,t){if(!e||e.status==="unknown")return"unknown";let n=e.variants.find(r=>r.sku===t);return n?n.fits?"fits":"doesNotFit":"unknown"}var yr="/tyres";function an(e){return e?`${yr}/${e}`:null}function We(e){let t=e.lastIndexOf(" ");return t===-1?{lead:"",accent:e}:{lead:e.slice(0,t+1),accent:e.slice(t+1)}}function hr(e,t){return Yt({partNumber:e.sku,prices:e.prices},t)}var br="Tyre";function ln(e,t,n,r){return{id:`${e.slug}|${t.sku}|${n.unit}|${n.spares>0?"spare":"no-spare"}`,slug:e.slug,name:We(e.name),process:e.brand||br,positionNo:"01",config:[{label:t.size},{label:Xt(n)}],finishName:"",size:t.size,components:hr(t,n),qty:r,href:an(e.slug)??void 0,kind:"tyre",sku:t.sku,pack:n}}function bi(e){return e.kind==="tyre"}function Ci(e,t){let n=e.prices?.[t];return typeof n!="number"||!Number.isFinite(n)||n<=0?!1:e.inStock}var Cr="dually";function ct(e){let t=e.components.reduce((o,i)=>o+i.wheels,0)||4,n=e.kind,r=[n==="staggered"?"Staggered":n===Cr?"Dually":""].filter(Boolean);return r.length?`${r.join(" ")} set of ${t}`:`Set of ${t}`}function xr(e,t){return[...new Set(e.filter(n=>!t||n.finishName===t).map(n=>n.size))]}function un(e,t,n){if(!(!t||!n))return e.find(r=>r.finishName===t&&r.size===n)}function Sr(e){return e!=null&&e.inStock===!1}function vi(e,t){return t?e.filter(n=>n.finishName===t&&Sr(n)):[]}function Ei(e,t,n){return t.findIndex((r,o)=>n[o]!==!1&&xr(e,r).length>0)}function Pi(e){let t=new Set((e.sizePairs??[]).map(o=>`${o.diameter}x${o.width}`)),n=e.spec?.pcds??[],r=e.spec?.etRange??[];return t.size===1&&n.length<=1&&(r.length===0||r[0]===r[r.length-1])}var dn="alloy-wheel",vr="tyre";function Be(e){return e.name||e.slug||"An item from your cart"}async function fn(e,t){let n=[],r=new Map;for(let s of e){if(!s.slug){n.push(Be(s));continue}let a=s.kind??dn,c=`${a}\0${s.slug}`,u=r.get(c);u?u.snaps.push(s):r.set(c,{kind:a,slug:s.slug,snaps:[s]})}let o=await Promise.all([...r.values()].map(s=>Er(s,t))),i=[];for(let s of o)for(let a of s)a.ok?i.push(a.line):n.push(a.name);return{lines:i,dropped:n}}function cn(e){if(e instanceof X&&e.status===404)return null;throw e}async function Er(e,t){let n=e.snaps.map(r=>({ok:!1,name:Be(r)}));if(e.kind===dn){let r=await t.getWheel(e.slug).catch(cn);return r?e.snaps.map(o=>Pr(e.slug,r,o)):n}if(e.kind===vr){let r=await t.getTyre(e.slug).catch(cn);return r?e.snaps.map(o=>kr(r,o)):n}return n}function Pr(e,t,n){let r=un(t.variants,n.finish,n.size);if(!r)return{ok:!1,name:Be(n)};let o=n.pack?rt(n.pack):void 0,i=(o?.spares??0)>0;return{ok:!0,line:{id:`${e}|${r.finishName}|${r.size}${i?"|spare":""}|restored`,slug:e,name:We(t.name),process:t.process,positionNo:"01",config:[{label:r.size},{label:r.finishName,gold:!0},{label:o?ot(ct(r),o):ct(r)}],finishName:r.finishName,size:r.size,components:o&&i?Qt(r.components,o):r.components,qty:n.qty,...i?{pack:o}:{}}}}function kr(e,t){let n={ok:!1,name:Be(t)};if(!t.pack||!t.sku)return n;let r=rt(t.pack),o=e.variants.find(i=>i.sku===t.sku);return o?{ok:!0,line:ln(e,o,r,t.qty)}:n}var He="Price on request",Ii="Request a quote",pn="from ",Oi="From ",Fi="each",mn="Free",Di="Updating";function dt(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function ft(e,t){let n=e?.[t];return dt(n)?n:null}function Mi(e,t,n,r){let o=ft(e,n),i=ft(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function $i(e,t,n,r){if(n==null&&r==null)return!0;let o=ft(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var wr={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function Rr(e,t,n){if(!dt(e))return wr;let r=dt(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function Ui(e,t,n=""){return!e.priced||e.unit==null?He:`${n}${ee(e.unit,t)}`}function Wi(e,t){return e.was==null?null:ee(e.was,t)}function Tr(e,t,n=1){let r=ge(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((s,a)=>s+a.wheels,0),i=Math.min(...e.map(s=>s.prices[t]));return{priced:!0,unit:i,isFrom:i*o!==r,setTotal:r*n}}var Lr={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function Bi(e,t,n,r=1){let o=Rr(e.prices[n],e.msrpPrices?.[n],4),i=o.setTotal==null?null:o.setTotal*r;if(!t)return{priced:o.priced,unit:o.unit,isFrom:!0,was:o.was,onSale:o.onSale,setTotal:null,fromSetTotal:i};let s=Tr(t.components,n,r);return s.priced?{priced:!0,unit:s.unit,isFrom:s.isFrom,was:null,onSale:!1,setTotal:s.setTotal,fromSetTotal:i}:{...Lr,fromSetTotal:i}}function Hi(e,t){return!e.priced||e.unit==null?He:`${e.isFrom?pn:""}${ee(e.unit,t)}`}function zi(e,t){return e.was==null?null:ee(e.was,t)}function qi(e,t){let n=e.savings[t];if(n===void 0||e.components.length===0)return null;let r=0;for(let i of e.components){let s=i.prices?.[t];if(typeof s!="number")return null;r+=s*i.quantity}let o=ee(r-n,t);return{was:ee(r,t),amount:e.savingIsFrom?`${pn}${o}`:o}}var Ar=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function gn(e){return Ar.test(e.trim())}var yn="sf:ga-purchases",_r=20;function bn(){return typeof window>"u"||window.parent!==window}function ke(...e){try{if(bn()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function Nr(e,t){let n=e.config.find(r=>r.gold)?.label;return{item_id:`${e.slug}|${e.finishName}|${e.size}`,item_name:`${e.name.lead}${e.name.accent}`.trim(),...n?{item_variant:n}:{},price:ge(e.components,t)??0,quantity:e.qty}}function pt(e,t){return e.filter(we).map(n=>Nr(n,t))}function Xi(e){ke("event","view_item",{currency:e.currency,value:e.pricePerSet,items:[{item_id:e.itemId,item_name:e.itemName,...e.variant?{item_variant:e.variant}:{},price:e.pricePerSet,quantity:1}]})}function Cn(e,t){let n=pt([e],t);n.length!==0&&ke("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function ji(e){let t=pt(e.lines,e.currency);t.length!==0&&ke("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var hn=new Set;function Ir(e){if(hn.has(e))return!1;hn.add(e);try{let t=JSON.parse(q.getItem(yn)??"[]");if(t.includes(e))return!1;q.setItem(yn,JSON.stringify([...t,e].slice(-_r)))}catch{}return!0}function Zi(e){let t=e.confirmation;if(bn()||!Ir(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);ke("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:pt(e.lines,n)}),e.adsSendTo&&ke("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var Or="Arranged after review",xn="Calculated at checkout",Fr=xn,ts=xn;function Sn({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function ns(e){switch(e){case"arranged":return Or;case"pending":return Fr;case"free":return mn;case"charged":return null}}import{jsx as Br}from"react/jsx-runtime";var $r=400,Ur=400,Wr=1500,mt="storefront-cart";function we(e){return(e.components?.length??0)>0}function En(e,t){return{code:e,valid:t.valid,deferred:on(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function kn(e,t){return ge(e.components,t)}function gt(e,t){let n=kn(e,t);return n===null?null:n*e.qty}function Pn(e){return e!=="tyre"}var wn=Dr(null);function hs({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=tn(),[i,s]=E(t),[a,c]=E([]),[u,m]=E([]),[C,p]=E([]),[R,L]=E(!1),g=j(new Set),[_,A]=E([]),[F,v]=E(!1),[b,D]=E(null),[G,re]=E(null),[de,h]=E(null),[P,x]=E(0),M=w(()=>x(l=>l+1),[]),[oe,he]=E(void 0),[K,_e]=E(null),[k,$]=E(null),[V,ie]=E(!1),[O,fe]=E(null),se=j(void 0),Y=w(()=>s(!0),[]),Z=w(()=>s(!1),[]),Ne=w(()=>s(l=>!l),[]);W(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&Y()},[Y,t]);let B=nn(),Q=j(B);W(()=>{Q.current!==B&&(Q.current=B,t||Z())},[B,t,Z]);let Ie=w(l=>{_e(f=>f?.country===l?.country&&f?.subdivision===l?.subdivision&&f?.postcode===l?.postcode?f:l)},[]),I=w((l,f)=>{v(!0),!(!f||!Pn(l))&&A(d=>d.includes(f)?d:[...d,f])},[]),Oe=F||a.length>0,ae=j(!0);W(()=>(ae.current=!0,()=>{ae.current=!1}),[]),W(()=>{if(t)return;let l=[..._,...a.filter(d=>Pn(d.kind)).map(d=>d.slug)],f=[...new Set(l)].filter(d=>d&&!g.current.has(d));if(f.length!==0){for(let d of f)g.current.add(d);U.listWheelsBySlug(f).then(d=>{if(!ae.current||d.length===0)return;let y=new Set(d.map(S=>S.slug));m(S=>[...S.filter(ue=>!y.has(ue.slug)),...d])})}},[t,_,a]),W(()=>{if(t||!Oe||R)return;let l=!0;return U.listBundles().then(f=>{l&&(p(f),L(!0))}),()=>{l=!1}},[t,Oe,R]);let H=b?.deliveryOptions??[],be=b?.courier??null;W(()=>{b&&fe(l=>l&&H.some(f=>f.id===l)?l:H[0]?.id??null)},[b]);let le=w(()=>a.filter(we).flatMap(l=>Kt(l.components,l.qty)),[a]),Ce=w(async(l,f)=>{let d=l.trim().toUpperCase();if(!d)return;let y=le();if(y.length===0){$({code:d,valid:!1,message:"Add a wheel to the cart first."});return}ie(!0),se.current=f;try{let S=await U.validateCoupon({code:d,items:y,currency:n,shippingMethodId:O??void 0,customerEmail:f});$(En(d,S))}catch{$({code:d,valid:!1,unchecked:!0,message:"Could not check that code. Please try again."})}finally{ie(!1)}},[le,n,O]),pe=w(()=>{$(null),se.current=void 0},[]),Fe=w(l=>{if(!k)return;let{code:f}=k;$(d=>d&&d.code===f?{code:f,valid:!1,refused:!0,message:l}:d)},[k]);W(()=>{if(!k||k.refused)return;let l=k.code,f=y=>y!==null&&y.code===l&&!y.refused,d=setTimeout(async()=>{let y=le();if(y.length===0){$(S=>f(S)?{code:l,valid:!1,message:"Add a wheel to the cart first."}:S);return}ie(!0);try{let S=await U.validateCoupon({code:l,items:y,currency:n,shippingMethodId:O??void 0,customerEmail:se.current});$(ue=>f(ue)?En(l,S):ue)}catch{}finally{ie(!1)}},$r);return()=>clearTimeout(d)},[a,n,O]);let xe=k&&!k.refused?k.code:void 0;W(()=>{if(t)return;let l=!0,f=a,d=setTimeout(async()=>{let y=le();if(y.length===0){D(null),re(null),he(void 0);return}try{let S=await U.quoteCart({items:y,currency:n,shippingMethodId:O??void 0,couponCode:xe,customerEmail:se.current||void 0,country:K?.country||r||void 0,subdivision:K?.country&&K.subdivision||void 0,postcode:K?.country&&K.postcode||void 0});if(!l)return;D(S),re(f),h(null)}catch{if(!l)return;h(f)}he(xe)},Ur);return()=>{l=!1,clearTimeout(d)}},[a,n,O,xe,r,K,P]);let T=w(l=>{c(f=>{let d=f.findIndex(y=>y.id===l.id);return d===-1?[...f,l]:f.map((y,S)=>S===d?{...y,qty:Math.min(it,y.qty+l.qty)}:y)}),Cn(l,n)},[n]),J=w(l=>{c(f=>f.filter(d=>d.id!==l))},[]),De=w((l,f)=>{let d=Math.max(1,Math.min(it,f));c(y=>y.map(S=>S.id===l?{...S,qty:d}:S))},[]),Me=w(l=>{c(l)},[]),[vt,Qe]=E(!1),[Et,Gn]=E([]),Pt=j(a);Pt.current=a,W(()=>{if(t)return;let l=[];try{let d=JSON.parse(q.getItem(mt)??"[]");Array.isArray(d)&&(l=d)}catch{}if(l.length===0){Qe(!0);return}let f=!0;return fn(l,U).then(({lines:d,dropped:y})=>{f&&(Pt.current.length===0&&(Me(d),Gn(y)),Qe(!0))},d=>{f&&Qe(!0)}),()=>{f=!1}},[t,Me]),W(()=>{if(t||!vt)return;let l=a.filter(we);if(l.length===0){q.removeItem(mt);return}q.setItem(mt,JSON.stringify(at(l,()=>"")))},[a,t,vt]);let[Se,Kn]=E(null),kt=j(null);kt.current=Se;let z=j(null),Xe=j(""),wt=w((l,f)=>{let d=l.trim().toLowerCase();gn(d)&&Kn(y=>y&&y.email===d&&y.firstName===(f??"")?y:{email:d,firstName:f??""})},[]);W(()=>{if(t||!Se)return;let l=at(a.filter(we),y=>gt(y,n)===null?He:o(gt(y,n),n)),f={email:Se.email,firstName:Se.firstName,currency:n,items:l},d=JSON.stringify(f);if(d!==Xe.current)return z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{z.current=null,Xe.current=d,U.captureCart(f).catch(y=>{})},Wr),()=>{z.current&&(clearTimeout(z.current),z.current=null)}},[a,Se,n,t]);let Rt=w(()=>{z.current&&(clearTimeout(z.current),z.current=null);let l=kt.current;l&&(Xe.current="",U.captureCart({email:l.email,firstName:l.firstName,currency:n,items:[]}).catch(f=>{}))},[n]),Tt=vn(()=>{let l=a.reduce((N,me)=>{let $e=gt(me,n);return $e===null?N:N+$e},0),f=a.some(N=>kn(N,n)===null),d=a.reduce((N,me)=>N+me.qty,0),y=k?.valid?k.effects:void 0,S=y?Math.min(l,Number(y.discountAmount)):0,ue=b?.bundleDiscount??0,Yn=b?.appliedBundles??[],je=!!y?.freeShipping,Nt=H.find(N=>N.id===O),It=je?0:b?.shipping??Nt?.amount??0,Qn=Sn({quoted:b!==null,optionCount:H.length,chosenAmount:Nt?.amount,couponWaivesFreight:je}),Ze={};for(let N of y?.freeUnits??[])Ze[N.partNumber]=(Ze[N.partNumber]??0)+N.quantity;let Xn=b?.tax??null,jn=b?b.grandTotal:l-S-ue+It;return{sets:d,units:a.reduce((N,me)=>N+(me.components??[]).reduce(($e,Zn)=>$e+Zn.wheels*me.qty,0),0),subtotal:l,hasUnpricedLine:f,discount:S,bundleDiscount:ue,appliedBundles:Yn,shipping:It,freeShipping:je,shippingStatus:Qn,freeUnitsByPartNumber:Ze,tax:Xn,grand:jn,repricing:!!k?.refused&&b!==null&&oe===k?.code,quoted:b!==null&&G===a,serverSubtotal:b?.subtotal??null,quoteFailed:de===a,currency:n}},[a,n,k,H,O,b,oe,G,de]),Lt=j(!0),At=w(l=>{Lt.current=l},[]),_t=w(l=>{T(l),Lt.current&&Y()},[T,Y]),Vn=vn(()=>({isOpen:i,preview:t,open:Y,close:Z,toggle:Ne,items:a,catalog:u,bundles:C,warmCatalog:I,add:T,addAndOpen:_t,setAutoOpen:At,remove:J,setQty:De,replaceItems:Me,restoreDropped:Et,identify:wt,clearCapturedCart:Rt,coupon:k,applyCoupon:Ce,removeCoupon:pe,refuseCoupon:Fe,couponBusy:V,deliveryOptions:H,setQuoteDestination:Ie,courier:be,requote:M,shippingMethodId:O,setShippingMethodId:fe,totals:Tt}),[i,t,Y,Z,Ne,a,u,C,I,T,_t,At,J,De,Me,Et,wt,Rt,k,Ce,pe,Fe,V,H,Ie,be,M,O,Tt]);return Br(wn.Provider,{value:Vn,children:e})}function Rn(){let e=Mr(wn);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as jr}from"react";function Tn(e){return/(?:^|\|)(?:slug|xhost):/.test(e)}function Ln(e,t,n,r){for(;e.size>=t;){let o,i;for(let[a,c]of e){if(c.expiresAt<=r){o=a;break}i===void 0&&n(a)&&(i=a)}let s=o??i??e.keys().next().value;if(s===void 0)return;e.delete(s)}}var Hr=6e4,zr=5e3,qr=500,ze=new Map;async function Gr(e){let{host:t,matchesRequestHost:n}=await Ht();if(!t)return"";let r=await zt();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}async function An(e,t){if(await qt()!==null)return t();let n=await Gr(e);if(!n)return t();let r=Date.now(),o=ze.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),s=i.outcome.state==="failed",a=s?zr:Hr,c=ze.get(n)?.lastGood,u=i.outcome.state==="ok"?i:s?c:void 0,m=s&&u?u:i;return Ln(ze,qr,Tn,r),ze.set(n,{load:m,expiresAt:r+a,lastGood:u}),m}var Kr=404;function Vr(e){if(e instanceof X&&e.status===Kr)return{state:"absent"};let t=e instanceof X?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var Yr="[storefront:chrome-load-failed]";function Qr(e,t){console.error(`${Yr} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function _n(e,t,n,r){try{let o=await t();return r?.(o)?{value:o,outcome:{state:"absent"}}:{value:o,outcome:{state:"ok"}}}catch(o){let i=Vr(o);return i.state==="failed"&&Qr(e,i),{value:n,outcome:i}}}function Xr(e){return e==="production"?"silent":"banner"}var ks=Xr("production");function Zr(e,t){return e?.trim()||t}function Is({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=Zr(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var Jr={name:ve,legalName:null,foundedYear:null,faviconUrl:null,currencies:[],defaultCurrency:null,countries:[],defaultCountry:null,commerceEnabled:!0,cardPayments:!1,paymentMethods:[],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,privacyPage:null,termsPage:null,footerCookieSettings:!0,footerSitemap:!0,socialLinks:tt},Os=jr(async()=>An("site",()=>_n("site",async()=>{let e=await U.getSite();return{name:$t(e.name),legalName:e.legalName?.trim()||null,foundedYear:e.foundedYear??null,faviconUrl:e.faviconUrl??null,currencies:e.currencies??[],defaultCurrency:e.defaultCurrency??null,countries:e.countries??[],defaultCountry:e.defaultCountry??null,commerceEnabled:e.commerceEnabled??!0,cardPayments:e.cardPayments??!1,paymentMethods:e.paymentMethods??(e.cardPayments?["card"]:[]),paypalClientId:e.paypalClientId??null,paypalEnvironment:e.paypalEnvironment??null,squareApplicationId:e.squareApplicationId??null,squareLocationId:e.squareLocationId??null,squareEnvironment:e.squareEnvironment??null,ga4MeasurementId:e.ga4MeasurementId??null,googleAdsId:e.googleAdsId??null,googleAdsConversionLabel:(e.googleAdsId?e.googleAdsConversionLabel:null)??null,metaPixelId:e.metaPixelId??null,consentEnabled:e.consentEnabled??!1,consentPrivacyPage:e.consentPrivacyPage??null,consentNoticeOptOut:e.consentNoticeOptOut??!1,privacyPage:e.privacyPage??null,termsPage:e.termsPage??null,footerCookieSettings:e.footerCookieSettings??!0,footerSitemap:e.footerSitemap??!0,socialLinks:Ut(e.socialLinks)}},Jr)));var Fs={name:ve,legalName:null,foundedYear:null,faviconUrl:null,currencies:[{code:"USD",symbol:"$",decimalPlaces:2,isDefault:!0}],defaultCurrency:"USD",countries:[{code:"US",name:"United States",currency:"USD",url:"",isDefault:!0,chargeTax:!1,taxDisplay:"none",taxName:"",taxRate:null,postalLabel:"Zip Code"}],defaultCountry:"US",commerceEnabled:!0,cardPayments:!0,paymentMethods:["card"],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,privacyPage:null,termsPage:null,footerCookieSettings:!0,footerSitemap:!0,socialLinks:tt};import{jsx as eo}from"react/jsx-runtime";function Ms({tone:e="bad",role:t,children:n}){return eo("div",{role:t,className:["border bg-surface px-4 py-3 text-[14px] leading-relaxed text-fg",e==="good"?"border-accent":e==="bad"?"border-alert":"border-line"].join(" "),children:n})}import{jsx as Te,jsxs as yt}from"react/jsx-runtime";import{useEffect as qe,useId as oo,useRef as In,useState as Ge}from"react";import{useRootIsDark as io}from"efficient-shell/theme";import{efficientClientOpen as to}from"efficient-easel/screen/lib/session";var Re=new Map,no=64;async function ro(e){if(!to())return null;try{let t=await fetch(`${Mt()}/logo-analysis.json?url=${encodeURIComponent(e)}`);if(!t.ok)return null;let n=await t.json();if(!n||typeof n!="object")return null;let{reversed:r,inkIsDark:o}=n;return typeof r!="string"?null:{reversed:r,inkIsDark:typeof o=="boolean"?o:null}}catch{return null}}function Nn(e){let t=Re.get(e);if(t)return t;let n=ro(e);if(Re.set(e,n),Re.size>no){let r=Re.keys().next();r.done||Re.delete(r.value)}return n}var so=202/22,ao=.88,na=16,lo="invert(1)";function ra({variant:e="header",scrolled:t=!0,src:n,reverse:r=!1,color:o=null,onLightSurface:i,reversedSrc:s,inkIsDark:a,size:c="medium",sizePx:u,sizeUnit:m,wordmark:C,siteName:p=ve,fitToContainer:R=!1,fitWordmarkToContainer:L=!1,fitFloorPx:g,hideClass:_,hideAttrs:A,part:F}){let v=C&&C.trim()?C.trim():p,[b,D]=Ge(null),G=In(null),re=T=>{G.current=T};qe(()=>{D(G.current?.ownerDocument??null)},[]);let de=!io({doc:b,whenUnset:!0}),h=n&&n.trim()?n.trim():null,P=!!h&&Wt(h),x=i??(de&&t),M=o&&o.trim()?o.trim():null,oe=r&&!M,he=`logo-color-${oo().replace(/[^A-Za-z0-9_-]/g,"")}`,K=oe&&P&&h&&s!=null?{reversed:s,inkIsDark:a??null}:null,_e=K!==null,[k,$]=Ge(null);qe(()=>{if(!oe||!h||!P||_e){$(null);return}let T=!1;return $(null),Nn(h).then(J=>{T||$(J)}),()=>{T=!0}},[oe,h,P,_e]);let V=K??k,ie=!!V&&V.inkIsDark!==null&&(x?!V.inkIsDark:V.inkIsDark),O=oe&&!!h&&!P&&!x,fe=ie&&V?V.reversed:h,se=fe?[fe]:[],[Y,Z]=Ge(0);qe(()=>{Z(0)},[h,ie]);let Ne=e==="footer"?et:Je[c],B=u&&u>0?u:Ne,Q=(u&&u>0?Ot(u,m,"size",Dt):null)??`${B}px`,Ie=Math.round(B*so),I=Y<se.length?se[Y]:null,[Oe,ae]=Ge(fe),H=I!==null&&I===Oe,be=In(null);qe(()=>{let T=be.current;if(!T||!T.complete)return;if(T.naturalWidth>0||T.naturalHeight>0){ae(I);return}let J=!1;return T.decode().then(()=>!J&&ae(I),()=>!J&&Z(De=>De+1)),()=>{J=!0}},[I]);let le=R||L,Ce=`calc(100cqi / ${((v.length+1)*ao).toFixed(2)})`,pe=le&&g&&g>0?Q===`${B}px`?`${Math.min(g,B)}px`:`min(${g}px, ${Q})`:null,Fe=le?pe===null?`min(${Q}, ${Ce})`:`clamp(${pe}, ${Ce}, ${Q})`:Q,xe=yt("span",{className:`font-display font-bold tracking-[0.18em] ${pe===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:Fe,lineHeight:1,...M?{color:M}:{}},"aria-label":v,children:[v,Te("span",{className:"text-accent",style:M?{color:M}:void 0,children:"."})]});return yt("span",{ref:re,className:Ft("inline-flex items-center",_??""),...A,...F,children:[!H&&xe,M&&I&&Te("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:yt("filter",{id:he,colorInterpolationFilters:"sRGB",children:[Te("feFlood",{style:{floodColor:M}}),Te("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),I&&Te("img",{ref:be,src:I,alt:v,width:Ie,height:B,className:"shrink-0 object-contain",style:{...H?{height:Q,width:"auto",...R?{maxWidth:"100cqi"}:{}}:{display:"none"},...O?{filter:lo}:{},...M?{filter:`url(#${he})`}:{}},onLoad:()=>ae(I),onError:()=>Z(T=>T+1)},I)]})}var ia="w-full border-2 border-line bg-bg px-4 py-4 font-display text-[17px] tracking-[-0.005em] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent",On="w-0 min-w-0 flex-1",sa="w-0 min-w-[7rem] flex-1";import{jsx as Le,jsxs as co}from"react/jsx-runtime";function uo({spokes:e,mesh:t=!1,className:n}){let s=c=>Math.round(c*1e3)/1e3,a=[];for(let c=0;c<e;c++){let u=c/e*Math.PI*2-Math.PI/2;if(a.push({x1:s(100+Math.cos(u)*22),y1:s(100+Math.sin(u)*22),x2:s(100+Math.cos(u)*86),y2:s(100+Math.sin(u)*86),main:!0}),t){let m=u+Math.PI/e;a.push({x1:s(100+Math.cos(m)*22*1.4),y1:s(100+Math.sin(m)*22*1.4),x2:s(100+Math.cos(m)*78),y2:s(100+Math.sin(m)*78),main:!1})}}return co("svg",{viewBox:"0 0 200 200",fill:"none",stroke:"currentColor",className:n??"block h-[70%] w-[70%] transition-transform duration-700 [transition-timing-function:cubic-bezier(.2,.6,.2,1)]",children:[Le("circle",{cx:100,cy:100,r:92,strokeWidth:2}),Le("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),Le("circle",{cx:100,cy:100,r:22,strokeWidth:2}),Le("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),a.map((c,u)=>Le("line",{x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,stroke:"currentColor",strokeWidth:c.main?6:3,strokeLinecap:"round",opacity:c.main?1:.5},u))]})}var ca="#c9a461",Fn=[{f:"black",label:"Black",hex:"#171717"},{f:"silver",label:"Silver",hex:"#cccccc"},{f:"bronze",label:"Bronze",hex:"#8a6438"},{f:"graphite",label:"Graphite",hex:"#3a3c3f"},{f:"red",label:"Candy Red",hex:"#7a0f14"}],da={name:"",color:"var(--fg)",family:"silver",src:""};function fo(e,t){let n=r=>{let o=Fn.findIndex(i=>i.f===r);return o===-1?Fn.length:o};return n(e)-n(t)||e.localeCompare(t)}function fa(e){let t=new Set;for(let n of e)for(let r of n.finishes??[])r?.family&&t.add(r.family);return[...t].sort(fo)}import{useEffect as po,useRef as Dn,useState as mo}from"react";import{jsx as ce,jsxs as ht}from"react/jsx-runtime";function go({customerEmail:e,disabled:t=!1}){let{coupon:n,applyCoupon:r,removeCoupon:o,couponBusy:i}=Rn(),[s,a]=mo(""),c=Dn(!1),u=Dn(null);po(()=>{!c.current||n===null||(c.current=!1,u.current?.focus())},[n]);async function m(){t||i||!s.trim()||(c.current=!0,await r(s,e),a(""))}return ht("div",{className:"flex flex-col gap-2",children:[n===null?ht("div",{className:"flex border border-line",children:[ce("input",{type:"text",value:s,onChange:C=>a(C.target.value),onKeyDown:C=>{C.key==="Enter"&&(C.preventDefault(),m())},placeholder:"Coupon code","aria-label":"Coupon code",disabled:t,className:`${On} bg-transparent px-4 py-4 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim`}),ce("button",{type:"button",onClick:()=>{m()},disabled:i||t,className:"border-l border-line px-4 font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-wait disabled:opacity-60",children:i?"\u2026":"Apply"})]}):ht("div",{className:["flex items-center justify-between gap-3 border px-4 py-3",n.valid?"border-accent":"border-line"].join(" "),style:n.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[ce("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",n.valid?"text-accent":n.deferred||n.unchecked?"text-fg":"text-fg-dim line-through"].join(" "),children:n.code}),n.unchecked&&ce("button",{type:"button",onClick:()=>{r(n.code,e)},disabled:i||t,className:"ml-auto font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:text-fg disabled:cursor-wait disabled:opacity-60",children:i?"\u2026":"Try again"}),!t&&ce("button",{ref:u,type:"button",onClick:o,"aria-label":`Remove coupon ${n.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"\u2715"})]}),n?.deferred?ce("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:sn}):n&&!n.valid&&n.message&&ce("p",{role:"alert",className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:n.message})]})}var bt="Ads on. Shopper can opt out.",Ke="Ads and analytics off until Accept",yo={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:bt,footerLink:"Do Not Sell or Share My Personal Information",panelEyebrow:"Do not sell or share",adsRowName:"Sale or sharing for ads"},ca:{region:"ca",name:"Canada",model:"opt-in",law:"PIPEDA, Quebec Law 25",beforeChoice:Ke,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:bt,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:bt,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:Ke,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:Ke,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:Ke,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}};function ho(e){let t=[...e.googleAds?["Google"]:[],...e.meta?["Facebook","Instagram"]:[]];return t.length<=1?t.join(""):`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function xa(e,t,n){let r=ho(n),o=r?`We use cookies to count visits and to show you ${t} ads on ${r}.`:"We use cookies to count visits.";return e.model==="opt-in"?{heading:r?"Cookies and ads":"Cookies",before:`${o} Nothing loads until you choose. You can change this at any time with `,link:e.footerLink,after:" at the bottom of every page."}:{heading:r?"Cookies and ads":"Cookies",before:`${o} You can say no at any time: choose Privacy choices, or use `,link:e.footerLink,after:" at the bottom of every page."}}var Sa={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on",close:"Close",cookieSettings:"Cookie settings"};var bo={asked:!1,region:"other",model:"opt-in",analytics:!0,ads:!0,chosen:!0,gpc:!1};var Co=bo;function ka(e=Co){if(e.asked)return e.ads?"granted":"denied"}function Ra(){let e=typeof crypto<"u"?crypto:void 0;if(typeof e?.randomUUID=="function")return e.randomUUID();let t=new Uint8Array(16);if(typeof e?.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}import{Children as So,isValidElement as vo,useEffect as $n,useId as Eo,useLayoutEffect as Bn,useRef as te,useState as Un}from"react";var Ve=(e,t)=>!!e[t]&&!e[t].disabled;function Ct(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(Ve(e,i))return i}return t}function xt(e,t){return Ct(e,t===1?-1:e.length,t)}function St(e,t){return Ve(e,t)?t:Math.max(xt(e,1),0)}function Mn(e,t,n){let{open:r,focus:o}=e,i=s=>({...e,...s});if(t.length===1&&/\S/.test(t)){let s=e.typed+t.toLowerCase(),a=n.findIndex((c,u)=>Ve(n,u)&&c.label.toLowerCase().startsWith(s));return{state:i({open:!0,typed:s,focus:a>=0?a:o}),handled:!0}}if(!r)return t==="ArrowDown"||t==="ArrowUp"||t==="Enter"||t===" "?{state:i({open:!0,typed:""}),handled:!0}:{state:e,handled:!1};switch(t){case"ArrowDown":return{state:i({focus:Ct(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:Ct(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:xt(n,1)}),handled:!0};case"End":return{state:i({focus:xt(n,-1)}),handled:!0};case"Enter":case" ":return Ve(n,o)?{state:i({open:!1,typed:""}),commit:o,refocus:!0,handled:!0}:{state:e,handled:!0};case"Escape":return{state:i({open:!1,typed:""}),refocus:!0,handled:!0};case"Tab":return{state:i({open:!1,typed:""}),handled:!1};default:return{state:e,handled:!1}}}import{placeMenu as Po}from"efficient-shell/ui";import{Fragment as _o,jsx as ne,jsxs as Hn}from"react/jsx-runtime";var Wn={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function ko({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[s,a]=Un(!1),c=r!==void 0,u=c?r:s,[m,C]=Un(0),p=te({text:"",timer:0}),R=te(null),L=te(null),g=te(null),_=Eo(),A=te(null),F=e.findIndex(h=>h.value===t),v=h=>{h!==u&&(c||a(h),h?o?.():i?.())},b=h=>{let P=e[h];!P||P.disabled||(n(P.value),v(!1),L.current?.focus())},D=h=>{let P={open:u,focus:u?m:St(e,F),typed:p.current.text},x=Mn(P,h,e);return!x.handled&&x.state.open===u?!1:(x.state.typed!==P.typed&&(p.current.text=x.state.typed,window.clearTimeout(p.current.timer),p.current.timer=window.setTimeout(()=>{p.current.text=""},500)),C(x.state.focus),x.commit!==void 0?b(x.commit):v(x.state.open),x.refocus&&L.current?.focus(),x.handled)},G=te(D);G.current=D;let re=te(()=>v(!1));re.current=()=>v(!1);let de=h=>{u||(A.current=h.nativeEvent,G.current(h.key)&&h.preventDefault())};return $n(()=>{if(!u)return;let h=x=>{R.current?.contains(x.target)||re.current()},P=x=>{x!==A.current&&G.current(x.key)&&x.preventDefault()};return document.addEventListener("mousedown",h),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",P)}},[u]),$n(()=>{u&&(p.current.text||C(St(e,F)))},[u]),Bn(()=>{if(!u||!g.current)return;g.current.children.item(m)?.scrollIntoView({block:"nearest"})},[m,u]),{open:u,toggle:()=>v(!u),close:()=>v(!1),focusIdx:m,setFocusIdx:C,pick:h=>b(e.findIndex(P=>P.value===h)),wrapRef:R,triggerRef:L,listRef:g,listId:_,onTriggerKeyDown:de,activeId:u?`${_}-${m}`:void 0}}var wo={select:{list:"absolute left-0 top-full z-50 mt-1 max-h-[280px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:(e,t,n)=>["px-3 py-3 font-mono text-[13px] font-semibold uppercase tracking-[0.1em] transition-colors whitespace-nowrap",n?"cursor-not-allowed opacity-40":"cursor-pointer",e&&!n?"bg-accent text-bg":"bg-bg text-fg"].join(" ")},cell:{list:"absolute left-0 top-full z-50 mt-1 max-h-[320px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:e=>[`cursor-pointer whitespace-nowrap px-6 py-3 font-mono ${Wn.label} font-semibold uppercase tracking-[0.1em] transition-colors`,e?"bg-accent text-bg":"bg-bg text-fg"].join(" "),pickerMarker:!0},hairline:{list:"absolute left-0 top-full z-50 max-h-[320px] w-full overflow-y-auto border border-line bg-bg shadow-[0_6px_20px_rgba(0,0,0,0.10)]",item:(e,t)=>[`flex cursor-pointer items-center justify-between gap-4 border-b border-line px-4 py-3 text-left ${Wn.body} transition-colors last:border-b-0`,t?"border-fg font-medium text-fg":e?"border-fg text-fg":"text-fg-dim"].join(" "),pickerMarker:!0},region:{list:"absolute right-0 top-full z-[200] mt-2 flex min-w-[240px] flex-col border border-line bg-surface text-fg",item:(e,t,n,r)=>["flex w-full cursor-pointer items-center gap-3 px-4 py-3 text-left transition-colors","font-mono text-[13px] uppercase tracking-[0.18em]",e?"bg-surface-2 text-fg":"",r?"":"border-b border-line",t?"text-accent":""].join(" "),itemStyle:e=>e?void 0:{color:"color-mix(in oklab, currentColor 80%, transparent)"}}};function Ro(e,t){Bn(()=>{let n=e.current,r=n?.ownerDocument.defaultView;if(!n||!r)return;let o=()=>{let i=n.style;i.top=i.bottom=i.marginTop=i.marginBottom=i.maxHeight=i.overflowY=i.translate="";let s=n.offsetParent??n.parentElement;if(!s)return;let a=s.getBoundingClientRect(),c=n.getBoundingClientRect(),u=Math.abs(c.right-a.right)<Math.abs(c.left-a.left)?"end":"start",m=Po({trigger:{left:a.left,right:a.right,top:a.top,bottom:a.bottom},menu:{width:c.width,height:c.height},bounds:{left:0,top:0,right:r.innerWidth,bottom:r.innerHeight},align:u,side:"bottom"});if(m.side==="top"){i.top="auto",i.bottom="100%",i.marginTop="0px";let p=m.top+Math.min(c.height,m.maxHeight);i.marginBottom=`${Math.max(0,a.top-p)}px`}m.maxHeight<c.height&&(i.maxHeight=`${m.maxHeight}px`,i.overflowY="auto");let C=m.left-c.left;C&&(i.translate=`${C}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function To(e){return e.split(" ").map(t=>t==="left-0"?"right-0":t).join(" ")}function Lo({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:s,listRef:a,ariaLabel:c,align:u="start"}){let m=wo[t],C=te(null);return Ro(C,n.length),ne("ul",{ref:p=>{C.current=p,a&&(a.current=p)},id:e,role:"listbox","aria-label":c,...m.pickerMarker?{"data-picker-menu":""}:{},className:u==="end"?To(m.list):m.list,children:n.map((p,R)=>{let L=p.value===r;return ne("li",{id:`${e}-${R}`,role:"option","aria-selected":L,"aria-disabled":p.disabled||void 0,onMouseEnter:()=>!p.disabled&&i(R),onMouseDown:g=>{g.preventDefault(),p.disabled||s(p.value)},className:m.item(R===o,L&&p.value!=="",!!p.disabled,R===n.length-1),style:m.itemStyle?.(L),children:p.meta===void 0?p.label:Hn(_o,{children:[p.lead,ne("span",{className:"flex-1 whitespace-nowrap",children:p.label}),ne("span",{className:"ml-auto text-[12px] opacity-50",children:p.meta})]})},`${p.value}_${R}`)})})}function Ao({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:s,id:a,"aria-label":c,align:u}){let m=So.toArray(r).flatMap(g=>{if(!vo(g))return[];if(g.type!=="option")return[];let A=g.props,F=A.value!==void 0?String(A.value):"",v=A.children,b=typeof v=="string"||typeof v=="number"?String(v):F;return[{value:F,label:b,disabled:!!A.disabled}]}),C=e??"",p=ko({items:m,value:C,onPick:g=>t?.({target:{value:g}})}),L=m.find(g=>g.value===C)?.label??m[0]?.label??"";return Hn("div",{ref:p.wrapRef,className:"relative",children:[s&&ne("input",{type:"hidden",name:s,value:C}),ne("button",{ref:g=>{p.triggerRef.current=g},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":p.open,"aria-controls":p.open?p.listId:void 0,"aria-activedescendant":p.activeId,"aria-label":c,id:a,onClick:()=>!n&&p.toggle(),onKeyDown:g=>!n&&p.onTriggerKeyDown(g),className:`block w-full ${o??""}`,style:i,children:ne("span",{className:"block w-full truncate text-left",children:L})}),p.open&&ne(Lo,{id:p.listId,tone:"select",items:m,value:C,focusIdx:p.focusIdx,onFocus:p.setFocusIdx,onPick:p.pick,listRef:p.listRef,align:u})]})}import{jsx as Ae,jsxs as Ye}from"react/jsx-runtime";var No="font-mono text-[length:var(--size-label,12px)]",Io="font-semibold uppercase tracking-[0.22em] text-fg";function zn(e){return`${e??No} ${Io}`}function qn(){return Ae("span",{className:"text-accent",children:" *"})}function Oo({children:e,required:t,labelFace:n}){return Ye("span",{className:zn(n),children:[e,t?Ae(qn,{}):null]})}function Fo({label:e,required:t,hint:n,separate:r,htmlFor:o,labelFace:i,className:s,children:a}){let c=s?`flex flex-col gap-2 ${s}`:"flex flex-col gap-2",u=n?Ae("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?Ye("div",{className:c,children:[Ye("label",{htmlFor:o,className:zn(i),children:[e,t?Ae(qn,{}):null]}),a,u]}):Ye("label",{htmlFor:o,className:c,children:[Ae(Oo,{required:t,labelFace:i,children:e}),a]})}export{nn as a,jo as b,Zo as c,Jo as d,Kt as e,nt as f,Do as g,Jn as h,Mo as i,Qt as j,er as k,tr as l,ot as m,Xt as n,$o as o,it as p,Ue as q,ee as r,Uo as s,Wo as t,ur as u,ni as v,lt as w,ye as x,ri as y,ai as z,Pe as A,li as B,ui as C,ci as D,gr as E,an as F,We as G,hr as H,ln as I,bi as J,Ci as K,ct as L,un as M,Sr as N,vi as O,Ei as P,Pi as Q,He as R,Ii as S,pn as T,Oi as U,Fi as V,mn as W,Di as X,ft as Y,Mi as Z,$i as _,Rr as $,Ui as aa,Wi as ba,Tr as ca,Bi as da,Hi as ea,zi as fa,qi as ga,gn as ha,Xi as ia,ji as ja,Zi as ka,ts as la,ns as ma,Go as na,tn as oa,Ko as pa,we as qa,gt as ra,hs as sa,Rn as ta,Is as ua,Jr as va,Fs as wa,ia as xa,On as ya,sa as za,uo as Aa,ca as Ba,Fn as Ca,da as Da,fo as Ea,fa as Fa,go as Ga,Ms as Ha,na as Ia,ra as Ja,yo as Ka,xa as La,Sa as Ma,bo as Na,ka as Oa,Ra as Pa,ko as Qa,Lo as Ra,Ao as Sa,Oo as Ta,Fo as Ua};