efficient-storefront-blocks 0.25.1 → 0.27.0

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 (31) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/README.md +53 -5
  3. package/dist/chunks/{EditorPreviewCheckout-URFSPLP6.js → EditorPreviewCheckout-SRCARSQ3.js} +1 -1
  4. package/dist/chunks/PreviewFooter-FSNNVHPC.js +1 -0
  5. package/dist/chunks/SiteEditorProvider-EM7PM3YX.js +1 -0
  6. package/dist/chunks/chunk-HDRNAE62.js +16 -0
  7. package/dist/chunks/{chunk-5FWFXNTA.js → chunk-IM2BNZNF.js} +1 -1
  8. package/dist/chunks/chunk-KHIAJRGY.js +1 -0
  9. package/dist/chunks/chunk-TWNYQY4T.js +154 -0
  10. package/dist/chunks/chunk-XMVMMYNE.js +230 -0
  11. package/dist/chunks/{fitment-data-QCRJYMQI.js → fitment-data-HO7IRCLU.js} +1 -1
  12. package/dist/chunks/{render-client-IM6ELUPU.js → render-client-POVEFYOC.js} +1 -1
  13. package/dist/editor.css +1 -1
  14. package/dist/index.d.ts +27 -0
  15. package/dist/index.js +316 -783
  16. package/dist/links.d.ts +5 -3
  17. package/dist/links.js +1 -1
  18. package/dist/words.d.ts +1908 -0
  19. package/dist/words.js +11 -0
  20. package/package.json +10 -3
  21. package/dist/chunks/PreviewFooter-FMWOXIAI.js +0 -1
  22. package/dist/chunks/SiteEditorProvider-ZSJ42NW3.js +0 -1
  23. package/dist/chunks/chunk-D42IBF3T.js +0 -230
  24. package/dist/chunks/chunk-E27PWVTV.js +0 -16
  25. package/dist/chunks/chunk-ITVNHQAU.js +0 -154
  26. package/dist/chunks/chunk-RVAMC6AG.js +0 -1
  27. /package/dist/chunks/{SectionEditorShell-KPJJGNME.js → SectionEditorShell-THRVEFYH.js} +0 -0
  28. /package/dist/chunks/{chunk-XMRDC5JK.js → chunk-4NZU2IB7.js} +0 -0
  29. /package/dist/chunks/{chunk-BXKNNBHR.js → chunk-GONJOVIE.js} +0 -0
  30. /package/dist/chunks/{chunk-E27PWVTV.js.LEGAL.txt → chunk-HDRNAE62.js.LEGAL.txt} +0 -0
  31. /package/dist/chunks/{chunk-ITVNHQAU.js.LEGAL.txt → chunk-TWNYQY4T.js.LEGAL.txt} +0 -0
@@ -1 +1 @@
1
- import{f as nt,i as fe,q as rt,s as ot,t as it,v as q}from"./chunk-RVAMC6AG.js";import{Ma as me,Na as Ze,Qa as Ae,Ra as et}from"./chunk-XMRDC5JK.js";import{e as Je,q as tt,s as re}from"./chunk-BXKNNBHR.js";import{createContext as Xt,useContext as Jt,useEffect as Zt,useMemo as ge,useState as lt}from"react";function at(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function oe(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 Me=4,ar=1,sr={unit:"set",spares:0,spareSide:"left"};function st(e){return e.unit==="single"?1:Me+e.spares}function lr(e,t){return[{partNumber:e.partNumber,wheels:st(t),prices:e.prices}]}function ur(e,t){let n=st(t)-Me;if(n<=0||e.length===0)return e;let r=jt(e),o=r?r[t.spareSide]:0;return e.map((i,a)=>a===o?{...i,wheels:i.wheels+n}:i)}function jt(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 Qt(e,t){return t.spares>0?`${e} + spare`:e}function cr(e){return e.unit==="single"?"Single":Qt(`Set of ${Me}`,e)}var dr="data-add-to-basket",De=9,Oe="en";function pe(e,t,n=0){return new Intl.NumberFormat(Oe,{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:n}).format(e)}import{jsx as nn}from"react/jsx-runtime";var ut="storefront-country",ct=Xt(null);function en(e){return dt(e,"catalogue")}function tn(e){return dt(e,"money")}function dt(e,t){let n=new Map(e.map(o=>[o.code,o.decimalPlaces])),r=new Map;return(o,i)=>{if(!i)return"";let a=r.get(i);if(!a){let u=n.get(i)??0;a=new Intl.NumberFormat(Oe,{style:"currency",currency:i,minimumFractionDigits:t==="money"?u:0,maximumFractionDigits:u}),r.set(i,a)}return a.format(o)}}function yr({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=ge(()=>t??[],[t]),a=ge(()=>n??[],[n]),u=ge(()=>r||i.find(C=>C.isDefault)?.code||i[0]?.code||"",[r,i]),c=ge(()=>o||a.find(C=>C.isDefault)?.code||a[0]?.code||"",[o,a]),[l,d]=lt(c),[f,P]=lt(!1);Zt(()=>{let C=re.getItem(ut);C&&a.some(w=>w.code===C)&&d(C),P(!0)},[a]);function L(C){d(C),re.setItem(ut,C)}let h=ge(()=>{let C=a.find(I=>I.code===l)??null,w=C?.currency,T=w&&i.some(I=>I.code===w)?w:u,M=en(i),x=tn(i);return{country:l,currency:T,setCountry:L,currencies:i,countries:a,activeCountry:C,formatPrice:(I,S)=>M(I,S??T),formatMoney:(I,S)=>x(I,S??T),ready:f}},[l,i,a,u,f]);return nn(ct.Provider,{value:h,children:e})}function mt(){let e=Jt(ct);if(!e)throw new Error("useCurrency must be used within a CurrencyProvider");return e}import{createContext as gn,useCallback as _,useContext as yn,useEffect as Y,useMemo as vt,useRef as ie,useState as R}from"react";function pt(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var gt="We'll confirm this discount when you place your order.",xr="Confirmed at checkout";function Sr(e){return e&&(e.valid||e.deferred)?e.code:void 0}var ft="coupon_code: ";function vr(e){return!(e instanceof fe)||e.status!==400||!e.message.startsWith(ft)?null:e.message.slice(ft.length)}function yt(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 Pe="Price on request",on="Request a quote";function Fe(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Ue(e,t){let n=e?.[t];return Fe(n)?n:null}function Ir(e,t,n,r){let o=Ue(e,n),i=Ue(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function Lr(e,t,n,r){if(n==null&&r==null)return!0;let o=Ue(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var an={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function sn(e,t,n){if(!Fe(e))return an;let r=Fe(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function Nr(e,t,n=""){return!e.priced||e.unit==null?Pe:`${n}${pe(e.unit,t)}`}function Tr(e,t){return e.was==null?null:pe(e.was,t)}function ln(e,t,n=1){let r=oe(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((a,u)=>a+u.wheels,0),i=Math.min(...e.map(a=>a.prices[t]));return{priced:!0,unit:i,isFrom:i*o!==r,setTotal:r*n}}var un={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function kr(e,t,n,r=1){let o=sn(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 a=ln(t.components,n,r);return a.priced?{priced:!0,unit:a.unit,isFrom:a.isFrom,was:null,onSale:!1,setTotal:a.setTotal,fromSetTotal:i}:{...un,fromSetTotal:i}}function cn(e,t){return!e.priced||e.unit==null?Pe:`${e.isFrom?"from ":""}${pe(e.unit,t)}`}function _r(e,t){return e.was==null?null:pe(e.was,t)}function Rr(e,t){return!e.priced||e.unit==null?on:cn(e,t)}var dn=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function bt(e){return dn.test(e.trim())}var ht="sf:ga-purchases",mn=20;function xt(){return typeof window>"u"||window.parent!==window}function ye(...e){try{if(xt()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function fn(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:oe(e.components,t)??0,quantity:e.qty}}function $e(e,t){return e.filter(we).map(n=>fn(n,t))}function Ur(e){ye("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 St(e,t){let n=$e([e],t);n.length!==0&&ye("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function $r(e){let t=$e(e.lines,e.currency);t.length!==0&&ye("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var Ct=new Set;function pn(e){if(Ct.has(e))return!1;Ct.add(e);try{let t=JSON.parse(re.getItem(ht)??"[]");if(t.includes(e))return!1;re.setItem(ht,JSON.stringify([...t,e].slice(-mn)))}catch{}return!0}function qr(e){let t=e.confirmation;if(xt()||!pn(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);ye("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:$e(e.lines,n)}),e.adsSendTo&&ye("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}import{jsx as xn}from"react/jsx-runtime";var bn=400,hn=400,Cn=1500;function we(e){return(e.components?.length??0)>0}function Et(e,t){return{code:e,valid:t.valid,deferred:pt(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function wt(e,t){return oe(e.components,t)}function qe(e,t){let n=wt(e,t);return n===null?null:n*e.qty}function Pt(e){return e!=="tyre"}var It=gn(null);function Xr({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=mt(),[i,a]=R(t),[u,c]=R([]),[l,d]=R([]),[f,P]=R([]),[L,h]=R(!1),[C,w]=R(!1),[T,M]=R(!1),[x,I]=R(!1),[S,K]=R(null),[W,Q]=R(void 0),b=ie(r),v=ie("");b.current=b.current||r;let[m,H]=R(null),[X,z]=R(!1),[A,J]=R(null),Z=ie(void 0),D=_(()=>a(!0),[]),xe=_(()=>a(!1),[]),O=_(()=>a(s=>!s),[]);Y(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&D()},[D,t]);let Se=_(s=>{I(!0),Pt(s)&&M(!0)},[]),ee=T||u.some(s=>Pt(s.kind)),se=x||u.length>0;Y(()=>{if(t||!ee||L)return;let s=!0;return q.listWheels().then(p=>{s&&(d(p),h(!0))}),()=>{s=!1}},[t,ee,L]),Y(()=>{if(t||!se||C)return;let s=!0;return q.listBundles().then(p=>{s&&(P(p),w(!0))}),()=>{s=!1}},[t,se,C]);let U=S?.deliveryOptions??[];Y(()=>{U.length!==0&&J(s=>s&&U.some(p=>p.id===s)?s:U[0]?.id??null)},[S]);let V=_(()=>u.filter(we).flatMap(s=>at(s.components,s.qty)),[u]),le=_(async(s,p)=>{let y=s.trim().toUpperCase();if(!y)return;let g=V();if(g.length===0){H({code:y,valid:!1,message:"Add a wheel to the cart first."});return}z(!0),Z.current=p;try{let N=await q.validateCoupon({code:y,items:g,currency:n,shippingMethodId:A??void 0,customerEmail:p});H(Et(y,N))}catch{H({code:y,valid:!1,message:"Could not check that code. Please try again."})}finally{z(!1)}},[V,n,A]),te=_(()=>{H(null),Z.current=void 0},[]),ve=_(s=>{if(!m)return;let{code:p}=m;H(y=>y&&y.code===p?{code:p,valid:!1,refused:!0,message:s}:y)},[m]);Y(()=>{if(!m||m.refused)return;let s=m.code,p=g=>g!==null&&g.code===s&&!g.refused,y=setTimeout(async()=>{let g=V();if(g.length===0){H(N=>p(N)?{code:s,valid:!1,message:"Add a wheel to the cart first."}:N);return}z(!0);try{let N=await q.validateCoupon({code:s,items:g,currency:n,shippingMethodId:A??void 0,customerEmail:Z.current});H(de=>p(de)?Et(s,N):de)}catch{}finally{z(!1)}},bn);return()=>clearTimeout(y)},[u,n,A]);let ue=m&&!m.refused?m.code:void 0;Y(()=>{if(t)return;let s=!0,p=setTimeout(async()=>{let y=V();if(y.length===0){K(null),Q(void 0);return}try{let g=await q.quoteCart({items:y,currency:n,shippingMethodId:A??void 0,couponCode:ue,customerEmail:Z.current||void 0,country:b.current||void 0,subdivision:v.current||void 0});if(!s)return;K(g)}catch{if(!s)return}Q(ue)},hn);return()=>{s=!1,clearTimeout(p)}},[u,n,A,ue,r]);let E=_(s=>{c(p=>{let y=p.findIndex(g=>g.id===s.id);return y===-1?[...p,s]:p.map((g,N)=>N===y?{...g,qty:Math.min(De,g.qty+s.qty)}:g)}),St(s,n)},[n]),F=_(s=>{c(p=>p.filter(y=>y.id!==s))},[]),G=_((s,p)=>{let y=Math.max(1,Math.min(De,p));c(g=>g.map(N=>N.id===s?{...N,qty:y}:N))},[]),ze=_(s=>{c(s)},[]),[ce,Ht]=R(null),Ve=ie(null);Ve.current=ce;let $=ie(null),_e=ie(""),Ge=_((s,p)=>{let y=s.trim().toLowerCase();bt(y)&&Ht(g=>g&&g.email===y&&g.firstName===(p??"")?g:{email:y,firstName:p??""})},[]);Y(()=>{if(t||!ce)return;let s=yt(u.filter(we),g=>qe(g,n)===null?Pe:o(qe(g,n),n)),p={email:ce.email,firstName:ce.firstName,currency:n,items:s},y=JSON.stringify(p);if(y!==_e.current)return $.current&&clearTimeout($.current),$.current=setTimeout(()=>{$.current=null,_e.current=y,q.captureCart(p).catch(g=>{})},Cn),()=>{$.current&&(clearTimeout($.current),$.current=null)}},[u,ce,n,t]);let Ye=_(()=>{$.current&&(clearTimeout($.current),$.current=null);let s=Ve.current;s&&(_e.current="",q.captureCart({email:s.email,firstName:s.firstName,currency:n,items:[]}).catch(p=>{}))},[n]),je=vt(()=>{let s=u.reduce((k,ne)=>{let Ee=qe(ne,n);return Ee===null?k:k+Ee},0),p=u.some(k=>wt(k,n)===null),y=u.reduce((k,ne)=>k+ne.qty,0),g=m?.valid?m.effects:void 0,N=g?Math.min(s,Number(g.discountAmount)):0,de=S?.bundleDiscount??0,Bt=S?.appliedBundles??[],Qe=!!g?.freeShipping,zt=U.find(k=>k.id===A),Xe=Qe?0:S?.shipping??zt?.amount??0,Re={};for(let k of g?.freeUnits??[])Re[k.partNumber]=(Re[k.partNumber]??0)+k.quantity;let Vt=S?.tax??null,Gt=S?S.grandTotal:s-N-de+Xe;return{sets:y,units:u.reduce((k,ne)=>k+(ne.components??[]).reduce((Ee,Yt)=>Ee+Yt.wheels*ne.qty,0),0),subtotal:s,hasUnpricedLine:p,discount:N,bundleDiscount:de,appliedBundles:Bt,shipping:Xe,freeShipping:Qe,freeUnitsByPartNumber:Re,tax:Vt,grand:Gt,repricing:!!m?.refused&&S!==null&&W===m?.code,currency:n}},[u,n,m,U,A,S,W]),Wt=vt(()=>({isOpen:i,preview:t,open:D,close:xe,toggle:O,items:u,catalog:l,bundles:f,warmCatalog:Se,add:E,remove:F,setQty:G,replaceItems:ze,identify:Ge,clearCapturedCart:Ye,coupon:m,applyCoupon:le,removeCoupon:te,refuseCoupon:ve,couponBusy:X,deliveryOptions:U,shippingMethodId:A,setShippingMethodId:J,totals:je}),[i,t,D,xe,O,u,l,f,Se,E,F,G,ze,Ge,Ye,m,le,te,ve,X,U,A,je]);return xn(It.Provider,{value:Wt,children:e})}function Lt(){let e=yn(It);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as _n}from"react";function Nt(e,t,n,r){for(;e.size>=t;){let o,i;for(let[u,c]of e){if(c.expiresAt<=r){o=u;break}i===void 0&&n(u)&&(i=u)}let a=o??i??e.keys().next().value;if(a===void 0)return;e.delete(a)}}var Sn=6e4,vn=5e3,En=500,Ie=new Map;async function Pn(e){let{host:t,matchesRequestHost:n}=await rt();if(!t)return"";let r=await ot();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}var wn=e=>e.includes("|slug:")||e.includes("|xhost:");async function Tt(e,t){if(await it()!==null)return t();let n=await Pn(e);if(!n)return t();let r=Date.now(),o=Ie.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),a=i.outcome.state==="failed",u=a?vn:Sn,c=Ie.get(n)?.lastGood,l=i.outcome.state==="ok"?i:a?c:void 0,d=a&&l?l:i;return Nt(Ie,En,wn,r),Ie.set(n,{load:d,expiresAt:r+u,lastGood:l}),d}var In=404;function Ln(e){if(e instanceof fe&&e.status===In)return{state:"absent"};let t=e instanceof fe?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var Nn="[storefront:chrome-load-failed]";function Tn(e,t){console.error(`${Nn} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function kt(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=Ln(o);return i.state==="failed"&&Tn(e,i),{value:n,outcome:i}}}function kn(e){return e==="production"?"silent":"banner"}var io=kn("production");function Rn(e,t){return e?.trim()||t}function po({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=Rn(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var An={name:me,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,mapsApiKey:null,mapsMapId:null,socialLinks:Ae},go=_n(async()=>Tt("site",()=>kt("site",async()=>{let e=await q.getSite();return{name:Ze(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,mapsApiKey:e.mapsApiKey??null,mapsMapId:e.mapsMapId??null,socialLinks:et(e.socialLinks)}},An)));var yo={name:me,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,mapsApiKey:null,mapsMapId:null,socialLinks:Ae};import{jsx as Rt,jsxs as At}from"react/jsx-runtime";import{useEffect as Le,useRef as Mt,useState as Ne}from"react";var be=new Map,Mn=64;async function Dn(e){if(!Je())return null;try{let t=await fetch(`${tt()}/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 _t(e){let t=be.get(e);if(t)return t;let n=Dn(e);if(be.set(e,n),be.size>Mn){let r=be.keys().next();r.done||be.delete(r.value)}return n}var On={small:54,medium:66,large:84},Fn=44,Un=202/22,Io=16,Lo=140,$n=.88,No=16,qn="invert(1)";function To({variant:e="header",scrolled:t=!0,src:n,reverse:r=!1,onLightSurface:o,reversedSrc:i,inkIsDark:a,size:u="medium",sizePx:c,wordmark:l,siteName:d=me,fitToContainer:f=!1,fitWordmarkToContainer:P=!1,fitFloorPx:L}){let h=l&&l.trim()?l.trim():d,[C,w]=Ne(!1),T=Mt(null),M=E=>{T.current=E};Le(()=>{let E=T.current?.ownerDocument??document,F=()=>{w(E.documentElement.getAttribute("data-theme")==="light")};F();let G=new MutationObserver(F);return G.observe(E.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>G.disconnect()},[]);let x=n&&n.trim()?n.trim():null,I=!!x&&nt(x),S=o??(C&&t),K=r&&I&&x&&i!=null?{reversed:i,inkIsDark:a??null}:null,W=K!==null,[Q,b]=Ne(null);Le(()=>{if(!r||!x||!I||W){b(null);return}let E=!1;return b(null),_t(x).then(F=>{E||b(F)}),()=>{E=!0}},[r,x,I,W]);let v=K??Q,m=!!v&&v.inkIsDark!==null&&(S?!v.inkIsDark:v.inkIsDark),H=r&&!!x&&!I&&!S,X=m&&v?v.reversed:x,z=X?[X]:[],[A,J]=Ne(0);Le(()=>{J(0)},[x,m]);let Z=e==="footer"?Fn:On[u],D=c&&c>0?c:Z,xe=Math.round(D*Un),O=A<z.length?z[A]:null,[Se,ee]=Ne(X),se=O!==null&&O===Se,U=Mt(null);Le(()=>{let E=U.current;if(!E||!E.complete)return;if(E.naturalWidth>0||E.naturalHeight>0){ee(O);return}let F=!1;return E.decode().then(()=>!F&&ee(O),()=>!F&&J(G=>G+1)),()=>{F=!0}},[O]);let V=f||P,le=`calc(100cqi / ${((h.length+1)*$n).toFixed(2)})`,te=V&&L&&L>0?Math.min(L,D):null,ve=V?te===null?`min(${D}px, ${le})`:`clamp(${te}px, ${le}, ${D}px)`:`${D}px`,ue=At("span",{className:`font-display font-bold tracking-[0.18em] ${te===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:ve,lineHeight:1},"aria-label":h,children:[h,Rt("span",{className:"text-accent",children:"."})]});return At("span",{ref:M,className:"inline-flex items-center",children:[!se&&ue,O&&Rt("img",{ref:U,src:O,alt:h,width:xe,height:D,className:"shrink-0 object-contain",style:{...se?{height:`${D}px`,width:"auto",...f?{maxWidth:"100cqi"}:{}}:{display:"none"},...H?{filter:qn}:{}},onLoad:()=>ee(O),onError:()=>J(E=>E+1)},O)]})}import{Children as Hn,isValidElement as Wn,useEffect as Ot,useId as Bn,useLayoutEffect as zn,useRef as j,useState as Ft}from"react";var Te=(e,t)=>!!e[t]&&!e[t].disabled;function Ke(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(Te(e,i))return i}return t}function He(e,t){return Ke(e,t===1?-1:e.length,t)}function We(e,t){return Te(e,t)?t:Math.max(He(e,1),0)}function Dt(e,t,n){let{open:r,focus:o}=e,i=a=>({...e,...a});if(t.length===1&&/\S/.test(t)){let a=e.typed+t.toLowerCase(),u=n.findIndex((c,l)=>Te(n,l)&&c.label.toLowerCase().startsWith(a));return{state:i({open:!0,typed:a,focus:u>=0?u: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:Ke(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:Ke(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:He(n,1)}),handled:!0};case"End":return{state:i({focus:He(n,-1)}),handled:!0};case"Enter":case" ":return Te(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{Fragment as Qn,jsx as B,jsxs as Ut}from"react/jsx-runtime";function Vn({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[a,u]=Ft(!1),c=r!==void 0,l=c?r:a,[d,f]=Ft(0),P=j({text:"",timer:0}),L=j(null),h=j(null),C=j(null),w=Bn(),T=j(null),M=e.findIndex(b=>b.value===t),x=b=>{b!==l&&(c||u(b),b?o?.():i?.())},I=b=>{let v=e[b];!v||v.disabled||(n(v.value),x(!1),h.current?.focus())},S=b=>{let v={open:l,focus:l?d:We(e,M),typed:P.current.text},m=Dt(v,b,e);return!m.handled&&m.state.open===l?!1:(m.state.typed!==v.typed&&(P.current.text=m.state.typed,window.clearTimeout(P.current.timer),P.current.timer=window.setTimeout(()=>{P.current.text=""},500)),f(m.state.focus),m.commit!==void 0?I(m.commit):x(m.state.open),m.refocus&&h.current?.focus(),m.handled)},K=j(S);K.current=S;let W=j(()=>x(!1));W.current=()=>x(!1);let Q=b=>{l||(T.current=b.nativeEvent,K.current(b.key)&&b.preventDefault())};return Ot(()=>{if(!l)return;let b=m=>{L.current?.contains(m.target)||W.current()},v=m=>{m!==T.current&&K.current(m.key)&&m.preventDefault()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",v)}},[l]),Ot(()=>{l&&(P.current.text||f(We(e,M)))},[l]),zn(()=>{if(!l||!C.current)return;C.current.children.item(d)?.scrollIntoView({block:"nearest"})},[d,l]),{open:l,toggle:()=>x(!l),close:()=>x(!1),focusIdx:d,setFocusIdx:f,pick:b=>I(e.findIndex(v=>v.value===b)),wrapRef:L,triggerRef:h,listRef:C,listId:w,onTriggerKeyDown:Q,activeId:l?`${w}-${d}`:void 0}}var Gn={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-2.5 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 text-[length:var(--size-label,13px)] 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 text-[length:var(--size-body,14px)] 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-3.5 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 Yn({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:a,listRef:u,ariaLabel:c}){let l=Gn[t];return B("ul",{ref:u,id:e,role:"listbox","aria-label":c,...l.pickerMarker?{"data-picker-menu":""}:{},className:l.list,children:n.map((d,f)=>{let P=d.value===r;return B("li",{id:`${e}-${f}`,role:"option","aria-selected":P,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(f),onMouseDown:L=>{L.preventDefault(),d.disabled||a(d.value)},className:l.item(f===o,P&&d.value!=="",!!d.disabled,f===n.length-1),style:l.itemStyle?.(P),children:d.meta===void 0?d.label:Ut(Qn,{children:[B("span",{className:"flex-1 whitespace-nowrap",children:d.label}),B("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${f}`)})})}function jn({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:a,id:u,"aria-label":c}){let l=Hn.toArray(r).flatMap(h=>{if(!Wn(h))return[];if(h.type!=="option")return[];let w=h.props,T=w.value!==void 0?String(w.value):"",M=w.children,x=typeof M=="string"||typeof M=="number"?String(M):T;return[{value:T,label:x,disabled:!!w.disabled}]}),d=e??"",f=Vn({items:l,value:d,onPick:h=>t?.({target:{value:h}})}),L=l.find(h=>h.value===d)?.label??l[0]?.label??"";return Ut("div",{ref:f.wrapRef,className:"relative",children:[a&&B("input",{type:"hidden",name:a,value:d}),B("button",{ref:h=>{f.triggerRef.current=h},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":f.open,"aria-controls":f.open?f.listId:void 0,"aria-activedescendant":f.activeId,"aria-label":c,id:u,onClick:()=>!n&&f.toggle(),onKeyDown:h=>!n&&f.onTriggerKeyDown(h),className:`block w-full ${o??""}`,style:i,children:B("span",{className:"block w-full truncate text-left",children:L})}),f.open&&B(Yn,{id:f.listId,tone:"select",items:l,value:d,focusIdx:f.focusIdx,onFocus:f.setFocusIdx,onPick:f.pick,listRef:f.listRef})]})}var Uo="#c9a461",$t=[{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"}],$o={name:"",color:"var(--fg)",family:"silver",src:""};function Xn(e,t){let n=r=>{let o=$t.findIndex(i=>i.f===r);return o===-1?$t.length:o};return n(e)-n(t)||e.localeCompare(t)}function qo(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(Xn)}import{jsx as he,jsxs as ke}from"react/jsx-runtime";var Jn="font-mono text-[length:var(--size-label,12px)]",Zn="font-semibold uppercase tracking-[0.22em] text-fg";function qt(e){return`${e??Jn} ${Zn}`}function Kt(){return he("span",{className:"text-accent",children:" *"})}function er({children:e,required:t,labelFace:n}){return ke("span",{className:qt(n),children:[e,t?he(Kt,{}):null]})}function tr({label:e,required:t,hint:n,separate:r,htmlFor:o,labelFace:i,className:a,children:u}){let c=a?`flex flex-col gap-2 ${a}`:"flex flex-col gap-2",l=n?he("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?ke("div",{className:c,children:[ke("label",{htmlFor:o,className:qt(i),children:[e,t?he(Kt,{}):null]}),u,l]}):ke("label",{htmlFor:o,className:c,children:[he(er,{required:t,labelFace:i,children:e}),u]})}import{jsx as Ce,jsxs as rr}from"react/jsx-runtime";function nr({spokes:e,mesh:t=!1,className:n}){let a=c=>Math.round(c*1e3)/1e3,u=[];for(let c=0;c<e;c++){let l=c/e*Math.PI*2-Math.PI/2;if(u.push({x1:a(100+Math.cos(l)*22),y1:a(100+Math.sin(l)*22),x2:a(100+Math.cos(l)*86),y2:a(100+Math.sin(l)*86),main:!0}),t){let d=l+Math.PI/e;u.push({x1:a(100+Math.cos(d)*22*1.4),y1:a(100+Math.sin(d)*22*1.4),x2:a(100+Math.cos(d)*78),y2:a(100+Math.sin(d)*78),main:!1})}}return rr("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:[Ce("circle",{cx:100,cy:100,r:92,strokeWidth:2}),Ce("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),Ce("circle",{cx:100,cy:100,r:22,strokeWidth:2}),Ce("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),u.map((c,l)=>Ce("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},l))]})}import{useState as or}from"react";import{jsx as ae,jsxs as Be}from"react/jsx-runtime";function ir({customerEmail:e}){let{coupon:t,applyCoupon:n,removeCoupon:r,couponBusy:o}=Lt(),[i,a]=or("");async function u(){o||!i.trim()||(await n(i,e),a(""))}return Be("div",{className:"flex flex-col gap-2",children:[t===null?Be("div",{className:"flex border border-line",children:[ae("input",{type:"text",value:i,onChange:c=>a(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),u())},placeholder:"Coupon code","aria-label":"Coupon code",className:"flex-1 bg-transparent px-3.5 py-3.5 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim"}),ae("button",{type:"button",onClick:()=>{u()},disabled:o,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:o?"\u2026":"Apply"})]}):Be("div",{className:["flex items-center justify-between gap-3 border px-3.5 py-3",t.valid?"border-accent":"border-line"].join(" "),style:t.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[ae("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",t.valid?"text-accent":t.deferred?"text-fg":"text-fg-dim line-through"].join(" "),children:t.code}),ae("button",{type:"button",onClick:r,"aria-label":`Remove coupon ${t.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"\u2715"})]}),t?.deferred?ae("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:gt}):t&&!t.valid&&t.message&&ae("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:t.message})]})}function Xo(){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)}`}export{xr as a,Sr as b,vr as c,at as d,Me as e,ar as f,sr as g,lr as h,ur as i,jt as j,Qt as k,cr as l,dr as m,De as n,Oe as o,pe as p,Pe as q,on as r,Ue as s,Ir as t,Lr as u,sn as v,Nr as w,Tr as x,ln as y,kr as z,cn as A,_r as B,Rr as C,bt as D,Ur as E,$r as F,qr as G,yr as H,mt as I,we as J,qe as K,Xr as L,Lt as M,po as N,An as O,yo as P,On as Q,Fn as R,Io as S,Lo as T,No as U,To as V,Vn as W,Yn as X,jn as Y,Uo as Z,$t as _,$o as $,Xn as aa,qo as ba,er as ca,tr as da,nr as ea,ir as fa,Xo as ga};
1
+ import{f as nt,i as fe,r as rt,t as ot,u as it,w as q}from"./chunk-KHIAJRGY.js";import{Ma as me,Na as Ze,Qa as Ae,Ra as et}from"./chunk-4NZU2IB7.js";import{e as Je,q as tt,s as re}from"./chunk-GONJOVIE.js";import{createContext as Xt,useContext as Jt,useEffect as Zt,useMemo as ge,useState as lt}from"react";function at(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function oe(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 Me=4,ar=1,sr={unit:"set",spares:0,spareSide:"left"};function st(e){return e.unit==="single"?1:Me+e.spares}function lr(e,t){return[{partNumber:e.partNumber,wheels:st(t),prices:e.prices}]}function ur(e,t){let n=st(t)-Me;if(n<=0||e.length===0)return e;let r=jt(e),o=r?r[t.spareSide]:0;return e.map((i,a)=>a===o?{...i,wheels:i.wheels+n}:i)}function jt(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 Qt(e,t){return t.spares>0?`${e} + spare`:e}function cr(e){return e.unit==="single"?"Single":Qt(`Set of ${Me}`,e)}var dr="data-add-to-basket",De=9,Oe="en";function pe(e,t,n=0){return new Intl.NumberFormat(Oe,{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:n}).format(e)}import{jsx as nn}from"react/jsx-runtime";var ut="storefront-country",ct=Xt(null);function en(e){return dt(e,"catalogue")}function tn(e){return dt(e,"money")}function dt(e,t){let n=new Map(e.map(o=>[o.code,o.decimalPlaces])),r=new Map;return(o,i)=>{if(!i)return"";let a=r.get(i);if(!a){let u=n.get(i)??0;a=new Intl.NumberFormat(Oe,{style:"currency",currency:i,minimumFractionDigits:t==="money"?u:0,maximumFractionDigits:u}),r.set(i,a)}return a.format(o)}}function yr({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=ge(()=>t??[],[t]),a=ge(()=>n??[],[n]),u=ge(()=>r||i.find(C=>C.isDefault)?.code||i[0]?.code||"",[r,i]),c=ge(()=>o||a.find(C=>C.isDefault)?.code||a[0]?.code||"",[o,a]),[l,d]=lt(c),[f,P]=lt(!1);Zt(()=>{let C=re.getItem(ut);C&&a.some(w=>w.code===C)&&d(C),P(!0)},[a]);function L(C){d(C),re.setItem(ut,C)}let h=ge(()=>{let C=a.find(I=>I.code===l)??null,w=C?.currency,T=w&&i.some(I=>I.code===w)?w:u,M=en(i),x=tn(i);return{country:l,currency:T,setCountry:L,currencies:i,countries:a,activeCountry:C,formatPrice:(I,S)=>M(I,S??T),formatMoney:(I,S)=>x(I,S??T),ready:f}},[l,i,a,u,f]);return nn(ct.Provider,{value:h,children:e})}function mt(){let e=Jt(ct);if(!e)throw new Error("useCurrency must be used within a CurrencyProvider");return e}import{createContext as gn,useCallback as _,useContext as yn,useEffect as Y,useMemo as vt,useRef as ie,useState as R}from"react";function pt(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var gt="We'll confirm this discount when you place your order.",xr="Confirmed at checkout";function Sr(e){return e&&(e.valid||e.deferred)?e.code:void 0}var ft="coupon_code: ";function vr(e){return!(e instanceof fe)||e.status!==400||!e.message.startsWith(ft)?null:e.message.slice(ft.length)}function yt(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 Pe="Price on request",on="Request a quote";function Fe(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Ue(e,t){let n=e?.[t];return Fe(n)?n:null}function Ir(e,t,n,r){let o=Ue(e,n),i=Ue(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function Lr(e,t,n,r){if(n==null&&r==null)return!0;let o=Ue(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var an={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function sn(e,t,n){if(!Fe(e))return an;let r=Fe(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function Nr(e,t,n=""){return!e.priced||e.unit==null?Pe:`${n}${pe(e.unit,t)}`}function Tr(e,t){return e.was==null?null:pe(e.was,t)}function ln(e,t,n=1){let r=oe(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((a,u)=>a+u.wheels,0),i=Math.min(...e.map(a=>a.prices[t]));return{priced:!0,unit:i,isFrom:i*o!==r,setTotal:r*n}}var un={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function kr(e,t,n,r=1){let o=sn(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 a=ln(t.components,n,r);return a.priced?{priced:!0,unit:a.unit,isFrom:a.isFrom,was:null,onSale:!1,setTotal:a.setTotal,fromSetTotal:i}:{...un,fromSetTotal:i}}function cn(e,t){return!e.priced||e.unit==null?Pe:`${e.isFrom?"from ":""}${pe(e.unit,t)}`}function _r(e,t){return e.was==null?null:pe(e.was,t)}function Rr(e,t){return!e.priced||e.unit==null?on:cn(e,t)}var dn=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function bt(e){return dn.test(e.trim())}var ht="sf:ga-purchases",mn=20;function xt(){return typeof window>"u"||window.parent!==window}function ye(...e){try{if(xt()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function fn(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:oe(e.components,t)??0,quantity:e.qty}}function $e(e,t){return e.filter(we).map(n=>fn(n,t))}function Ur(e){ye("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 St(e,t){let n=$e([e],t);n.length!==0&&ye("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function $r(e){let t=$e(e.lines,e.currency);t.length!==0&&ye("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var Ct=new Set;function pn(e){if(Ct.has(e))return!1;Ct.add(e);try{let t=JSON.parse(re.getItem(ht)??"[]");if(t.includes(e))return!1;re.setItem(ht,JSON.stringify([...t,e].slice(-mn)))}catch{}return!0}function qr(e){let t=e.confirmation;if(xt()||!pn(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);ye("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:$e(e.lines,n)}),e.adsSendTo&&ye("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}import{jsx as xn}from"react/jsx-runtime";var bn=400,hn=400,Cn=1500;function we(e){return(e.components?.length??0)>0}function Et(e,t){return{code:e,valid:t.valid,deferred:pt(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function wt(e,t){return oe(e.components,t)}function qe(e,t){let n=wt(e,t);return n===null?null:n*e.qty}function Pt(e){return e!=="tyre"}var It=gn(null);function Xr({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=mt(),[i,a]=R(t),[u,c]=R([]),[l,d]=R([]),[f,P]=R([]),[L,h]=R(!1),[C,w]=R(!1),[T,M]=R(!1),[x,I]=R(!1),[S,K]=R(null),[W,Q]=R(void 0),b=ie(r),v=ie("");b.current=b.current||r;let[m,H]=R(null),[X,z]=R(!1),[A,J]=R(null),Z=ie(void 0),D=_(()=>a(!0),[]),xe=_(()=>a(!1),[]),O=_(()=>a(s=>!s),[]);Y(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&D()},[D,t]);let Se=_(s=>{I(!0),Pt(s)&&M(!0)},[]),ee=T||u.some(s=>Pt(s.kind)),se=x||u.length>0;Y(()=>{if(t||!ee||L)return;let s=!0;return q.listWheels().then(p=>{s&&(d(p),h(!0))}),()=>{s=!1}},[t,ee,L]),Y(()=>{if(t||!se||C)return;let s=!0;return q.listBundles().then(p=>{s&&(P(p),w(!0))}),()=>{s=!1}},[t,se,C]);let U=S?.deliveryOptions??[];Y(()=>{U.length!==0&&J(s=>s&&U.some(p=>p.id===s)?s:U[0]?.id??null)},[S]);let V=_(()=>u.filter(we).flatMap(s=>at(s.components,s.qty)),[u]),le=_(async(s,p)=>{let y=s.trim().toUpperCase();if(!y)return;let g=V();if(g.length===0){H({code:y,valid:!1,message:"Add a wheel to the cart first."});return}z(!0),Z.current=p;try{let N=await q.validateCoupon({code:y,items:g,currency:n,shippingMethodId:A??void 0,customerEmail:p});H(Et(y,N))}catch{H({code:y,valid:!1,message:"Could not check that code. Please try again."})}finally{z(!1)}},[V,n,A]),te=_(()=>{H(null),Z.current=void 0},[]),ve=_(s=>{if(!m)return;let{code:p}=m;H(y=>y&&y.code===p?{code:p,valid:!1,refused:!0,message:s}:y)},[m]);Y(()=>{if(!m||m.refused)return;let s=m.code,p=g=>g!==null&&g.code===s&&!g.refused,y=setTimeout(async()=>{let g=V();if(g.length===0){H(N=>p(N)?{code:s,valid:!1,message:"Add a wheel to the cart first."}:N);return}z(!0);try{let N=await q.validateCoupon({code:s,items:g,currency:n,shippingMethodId:A??void 0,customerEmail:Z.current});H(de=>p(de)?Et(s,N):de)}catch{}finally{z(!1)}},bn);return()=>clearTimeout(y)},[u,n,A]);let ue=m&&!m.refused?m.code:void 0;Y(()=>{if(t)return;let s=!0,p=setTimeout(async()=>{let y=V();if(y.length===0){K(null),Q(void 0);return}try{let g=await q.quoteCart({items:y,currency:n,shippingMethodId:A??void 0,couponCode:ue,customerEmail:Z.current||void 0,country:b.current||void 0,subdivision:v.current||void 0});if(!s)return;K(g)}catch{if(!s)return}Q(ue)},hn);return()=>{s=!1,clearTimeout(p)}},[u,n,A,ue,r]);let E=_(s=>{c(p=>{let y=p.findIndex(g=>g.id===s.id);return y===-1?[...p,s]:p.map((g,N)=>N===y?{...g,qty:Math.min(De,g.qty+s.qty)}:g)}),St(s,n)},[n]),F=_(s=>{c(p=>p.filter(y=>y.id!==s))},[]),G=_((s,p)=>{let y=Math.max(1,Math.min(De,p));c(g=>g.map(N=>N.id===s?{...N,qty:y}:N))},[]),ze=_(s=>{c(s)},[]),[ce,Ht]=R(null),Ve=ie(null);Ve.current=ce;let $=ie(null),_e=ie(""),Ge=_((s,p)=>{let y=s.trim().toLowerCase();bt(y)&&Ht(g=>g&&g.email===y&&g.firstName===(p??"")?g:{email:y,firstName:p??""})},[]);Y(()=>{if(t||!ce)return;let s=yt(u.filter(we),g=>qe(g,n)===null?Pe:o(qe(g,n),n)),p={email:ce.email,firstName:ce.firstName,currency:n,items:s},y=JSON.stringify(p);if(y!==_e.current)return $.current&&clearTimeout($.current),$.current=setTimeout(()=>{$.current=null,_e.current=y,q.captureCart(p).catch(g=>{})},Cn),()=>{$.current&&(clearTimeout($.current),$.current=null)}},[u,ce,n,t]);let Ye=_(()=>{$.current&&(clearTimeout($.current),$.current=null);let s=Ve.current;s&&(_e.current="",q.captureCart({email:s.email,firstName:s.firstName,currency:n,items:[]}).catch(p=>{}))},[n]),je=vt(()=>{let s=u.reduce((k,ne)=>{let Ee=qe(ne,n);return Ee===null?k:k+Ee},0),p=u.some(k=>wt(k,n)===null),y=u.reduce((k,ne)=>k+ne.qty,0),g=m?.valid?m.effects:void 0,N=g?Math.min(s,Number(g.discountAmount)):0,de=S?.bundleDiscount??0,Bt=S?.appliedBundles??[],Qe=!!g?.freeShipping,zt=U.find(k=>k.id===A),Xe=Qe?0:S?.shipping??zt?.amount??0,Re={};for(let k of g?.freeUnits??[])Re[k.partNumber]=(Re[k.partNumber]??0)+k.quantity;let Vt=S?.tax??null,Gt=S?S.grandTotal:s-N-de+Xe;return{sets:y,units:u.reduce((k,ne)=>k+(ne.components??[]).reduce((Ee,Yt)=>Ee+Yt.wheels*ne.qty,0),0),subtotal:s,hasUnpricedLine:p,discount:N,bundleDiscount:de,appliedBundles:Bt,shipping:Xe,freeShipping:Qe,freeUnitsByPartNumber:Re,tax:Vt,grand:Gt,repricing:!!m?.refused&&S!==null&&W===m?.code,currency:n}},[u,n,m,U,A,S,W]),Wt=vt(()=>({isOpen:i,preview:t,open:D,close:xe,toggle:O,items:u,catalog:l,bundles:f,warmCatalog:Se,add:E,remove:F,setQty:G,replaceItems:ze,identify:Ge,clearCapturedCart:Ye,coupon:m,applyCoupon:le,removeCoupon:te,refuseCoupon:ve,couponBusy:X,deliveryOptions:U,shippingMethodId:A,setShippingMethodId:J,totals:je}),[i,t,D,xe,O,u,l,f,Se,E,F,G,ze,Ge,Ye,m,le,te,ve,X,U,A,je]);return xn(It.Provider,{value:Wt,children:e})}function Lt(){let e=yn(It);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as _n}from"react";function Nt(e,t,n,r){for(;e.size>=t;){let o,i;for(let[u,c]of e){if(c.expiresAt<=r){o=u;break}i===void 0&&n(u)&&(i=u)}let a=o??i??e.keys().next().value;if(a===void 0)return;e.delete(a)}}var Sn=6e4,vn=5e3,En=500,Ie=new Map;async function Pn(e){let{host:t,matchesRequestHost:n}=await rt();if(!t)return"";let r=await ot();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}var wn=e=>e.includes("|slug:")||e.includes("|xhost:");async function Tt(e,t){if(await it()!==null)return t();let n=await Pn(e);if(!n)return t();let r=Date.now(),o=Ie.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),a=i.outcome.state==="failed",u=a?vn:Sn,c=Ie.get(n)?.lastGood,l=i.outcome.state==="ok"?i:a?c:void 0,d=a&&l?l:i;return Nt(Ie,En,wn,r),Ie.set(n,{load:d,expiresAt:r+u,lastGood:l}),d}var In=404;function Ln(e){if(e instanceof fe&&e.status===In)return{state:"absent"};let t=e instanceof fe?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var Nn="[storefront:chrome-load-failed]";function Tn(e,t){console.error(`${Nn} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function kt(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=Ln(o);return i.state==="failed"&&Tn(e,i),{value:n,outcome:i}}}function kn(e){return e==="production"?"silent":"banner"}var io=kn("production");function Rn(e,t){return e?.trim()||t}function po({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=Rn(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var An={name:me,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,mapsApiKey:null,mapsMapId:null,socialLinks:Ae},go=_n(async()=>Tt("site",()=>kt("site",async()=>{let e=await q.getSite();return{name:Ze(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,mapsApiKey:e.mapsApiKey??null,mapsMapId:e.mapsMapId??null,socialLinks:et(e.socialLinks)}},An)));var yo={name:me,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,mapsApiKey:null,mapsMapId:null,socialLinks:Ae};import{jsx as Rt,jsxs as At}from"react/jsx-runtime";import{useEffect as Le,useRef as Mt,useState as Ne}from"react";var be=new Map,Mn=64;async function Dn(e){if(!Je())return null;try{let t=await fetch(`${tt()}/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 _t(e){let t=be.get(e);if(t)return t;let n=Dn(e);if(be.set(e,n),be.size>Mn){let r=be.keys().next();r.done||be.delete(r.value)}return n}var On={small:54,medium:66,large:84},Fn=44,Un=202/22,Io=16,Lo=140,$n=.88,No=16,qn="invert(1)";function To({variant:e="header",scrolled:t=!0,src:n,reverse:r=!1,onLightSurface:o,reversedSrc:i,inkIsDark:a,size:u="medium",sizePx:c,wordmark:l,siteName:d=me,fitToContainer:f=!1,fitWordmarkToContainer:P=!1,fitFloorPx:L}){let h=l&&l.trim()?l.trim():d,[C,w]=Ne(!1),T=Mt(null),M=E=>{T.current=E};Le(()=>{let E=T.current?.ownerDocument??document,F=()=>{w(E.documentElement.getAttribute("data-theme")==="light")};F();let G=new MutationObserver(F);return G.observe(E.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>G.disconnect()},[]);let x=n&&n.trim()?n.trim():null,I=!!x&&nt(x),S=o??(C&&t),K=r&&I&&x&&i!=null?{reversed:i,inkIsDark:a??null}:null,W=K!==null,[Q,b]=Ne(null);Le(()=>{if(!r||!x||!I||W){b(null);return}let E=!1;return b(null),_t(x).then(F=>{E||b(F)}),()=>{E=!0}},[r,x,I,W]);let v=K??Q,m=!!v&&v.inkIsDark!==null&&(S?!v.inkIsDark:v.inkIsDark),H=r&&!!x&&!I&&!S,X=m&&v?v.reversed:x,z=X?[X]:[],[A,J]=Ne(0);Le(()=>{J(0)},[x,m]);let Z=e==="footer"?Fn:On[u],D=c&&c>0?c:Z,xe=Math.round(D*Un),O=A<z.length?z[A]:null,[Se,ee]=Ne(X),se=O!==null&&O===Se,U=Mt(null);Le(()=>{let E=U.current;if(!E||!E.complete)return;if(E.naturalWidth>0||E.naturalHeight>0){ee(O);return}let F=!1;return E.decode().then(()=>!F&&ee(O),()=>!F&&J(G=>G+1)),()=>{F=!0}},[O]);let V=f||P,le=`calc(100cqi / ${((h.length+1)*$n).toFixed(2)})`,te=V&&L&&L>0?Math.min(L,D):null,ve=V?te===null?`min(${D}px, ${le})`:`clamp(${te}px, ${le}, ${D}px)`:`${D}px`,ue=At("span",{className:`font-display font-bold tracking-[0.18em] ${te===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:ve,lineHeight:1},"aria-label":h,children:[h,Rt("span",{className:"text-accent",children:"."})]});return At("span",{ref:M,className:"inline-flex items-center",children:[!se&&ue,O&&Rt("img",{ref:U,src:O,alt:h,width:xe,height:D,className:"shrink-0 object-contain",style:{...se?{height:`${D}px`,width:"auto",...f?{maxWidth:"100cqi"}:{}}:{display:"none"},...H?{filter:qn}:{}},onLoad:()=>ee(O),onError:()=>J(E=>E+1)},O)]})}import{Children as Hn,isValidElement as Wn,useEffect as Ot,useId as Bn,useLayoutEffect as zn,useRef as j,useState as Ft}from"react";var Te=(e,t)=>!!e[t]&&!e[t].disabled;function Ke(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(Te(e,i))return i}return t}function He(e,t){return Ke(e,t===1?-1:e.length,t)}function We(e,t){return Te(e,t)?t:Math.max(He(e,1),0)}function Dt(e,t,n){let{open:r,focus:o}=e,i=a=>({...e,...a});if(t.length===1&&/\S/.test(t)){let a=e.typed+t.toLowerCase(),u=n.findIndex((c,l)=>Te(n,l)&&c.label.toLowerCase().startsWith(a));return{state:i({open:!0,typed:a,focus:u>=0?u: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:Ke(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:Ke(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:He(n,1)}),handled:!0};case"End":return{state:i({focus:He(n,-1)}),handled:!0};case"Enter":case" ":return Te(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{Fragment as Qn,jsx as B,jsxs as Ut}from"react/jsx-runtime";function Vn({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[a,u]=Ft(!1),c=r!==void 0,l=c?r:a,[d,f]=Ft(0),P=j({text:"",timer:0}),L=j(null),h=j(null),C=j(null),w=Bn(),T=j(null),M=e.findIndex(b=>b.value===t),x=b=>{b!==l&&(c||u(b),b?o?.():i?.())},I=b=>{let v=e[b];!v||v.disabled||(n(v.value),x(!1),h.current?.focus())},S=b=>{let v={open:l,focus:l?d:We(e,M),typed:P.current.text},m=Dt(v,b,e);return!m.handled&&m.state.open===l?!1:(m.state.typed!==v.typed&&(P.current.text=m.state.typed,window.clearTimeout(P.current.timer),P.current.timer=window.setTimeout(()=>{P.current.text=""},500)),f(m.state.focus),m.commit!==void 0?I(m.commit):x(m.state.open),m.refocus&&h.current?.focus(),m.handled)},K=j(S);K.current=S;let W=j(()=>x(!1));W.current=()=>x(!1);let Q=b=>{l||(T.current=b.nativeEvent,K.current(b.key)&&b.preventDefault())};return Ot(()=>{if(!l)return;let b=m=>{L.current?.contains(m.target)||W.current()},v=m=>{m!==T.current&&K.current(m.key)&&m.preventDefault()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",v)}},[l]),Ot(()=>{l&&(P.current.text||f(We(e,M)))},[l]),zn(()=>{if(!l||!C.current)return;C.current.children.item(d)?.scrollIntoView({block:"nearest"})},[d,l]),{open:l,toggle:()=>x(!l),close:()=>x(!1),focusIdx:d,setFocusIdx:f,pick:b=>I(e.findIndex(v=>v.value===b)),wrapRef:L,triggerRef:h,listRef:C,listId:w,onTriggerKeyDown:Q,activeId:l?`${w}-${d}`:void 0}}var Gn={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-2.5 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 text-[length:var(--size-label,13px)] 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 text-[length:var(--size-body,14px)] 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-3.5 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 Yn({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:a,listRef:u,ariaLabel:c}){let l=Gn[t];return B("ul",{ref:u,id:e,role:"listbox","aria-label":c,...l.pickerMarker?{"data-picker-menu":""}:{},className:l.list,children:n.map((d,f)=>{let P=d.value===r;return B("li",{id:`${e}-${f}`,role:"option","aria-selected":P,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(f),onMouseDown:L=>{L.preventDefault(),d.disabled||a(d.value)},className:l.item(f===o,P&&d.value!=="",!!d.disabled,f===n.length-1),style:l.itemStyle?.(P),children:d.meta===void 0?d.label:Ut(Qn,{children:[B("span",{className:"flex-1 whitespace-nowrap",children:d.label}),B("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${f}`)})})}function jn({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:a,id:u,"aria-label":c}){let l=Hn.toArray(r).flatMap(h=>{if(!Wn(h))return[];if(h.type!=="option")return[];let w=h.props,T=w.value!==void 0?String(w.value):"",M=w.children,x=typeof M=="string"||typeof M=="number"?String(M):T;return[{value:T,label:x,disabled:!!w.disabled}]}),d=e??"",f=Vn({items:l,value:d,onPick:h=>t?.({target:{value:h}})}),L=l.find(h=>h.value===d)?.label??l[0]?.label??"";return Ut("div",{ref:f.wrapRef,className:"relative",children:[a&&B("input",{type:"hidden",name:a,value:d}),B("button",{ref:h=>{f.triggerRef.current=h},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":f.open,"aria-controls":f.open?f.listId:void 0,"aria-activedescendant":f.activeId,"aria-label":c,id:u,onClick:()=>!n&&f.toggle(),onKeyDown:h=>!n&&f.onTriggerKeyDown(h),className:`block w-full ${o??""}`,style:i,children:B("span",{className:"block w-full truncate text-left",children:L})}),f.open&&B(Yn,{id:f.listId,tone:"select",items:l,value:d,focusIdx:f.focusIdx,onFocus:f.setFocusIdx,onPick:f.pick,listRef:f.listRef})]})}var Uo="#c9a461",$t=[{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"}],$o={name:"",color:"var(--fg)",family:"silver",src:""};function Xn(e,t){let n=r=>{let o=$t.findIndex(i=>i.f===r);return o===-1?$t.length:o};return n(e)-n(t)||e.localeCompare(t)}function qo(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(Xn)}import{jsx as he,jsxs as ke}from"react/jsx-runtime";var Jn="font-mono text-[length:var(--size-label,12px)]",Zn="font-semibold uppercase tracking-[0.22em] text-fg";function qt(e){return`${e??Jn} ${Zn}`}function Kt(){return he("span",{className:"text-accent",children:" *"})}function er({children:e,required:t,labelFace:n}){return ke("span",{className:qt(n),children:[e,t?he(Kt,{}):null]})}function tr({label:e,required:t,hint:n,separate:r,htmlFor:o,labelFace:i,className:a,children:u}){let c=a?`flex flex-col gap-2 ${a}`:"flex flex-col gap-2",l=n?he("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?ke("div",{className:c,children:[ke("label",{htmlFor:o,className:qt(i),children:[e,t?he(Kt,{}):null]}),u,l]}):ke("label",{htmlFor:o,className:c,children:[he(er,{required:t,labelFace:i,children:e}),u]})}import{jsx as Ce,jsxs as rr}from"react/jsx-runtime";function nr({spokes:e,mesh:t=!1,className:n}){let a=c=>Math.round(c*1e3)/1e3,u=[];for(let c=0;c<e;c++){let l=c/e*Math.PI*2-Math.PI/2;if(u.push({x1:a(100+Math.cos(l)*22),y1:a(100+Math.sin(l)*22),x2:a(100+Math.cos(l)*86),y2:a(100+Math.sin(l)*86),main:!0}),t){let d=l+Math.PI/e;u.push({x1:a(100+Math.cos(d)*22*1.4),y1:a(100+Math.sin(d)*22*1.4),x2:a(100+Math.cos(d)*78),y2:a(100+Math.sin(d)*78),main:!1})}}return rr("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:[Ce("circle",{cx:100,cy:100,r:92,strokeWidth:2}),Ce("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),Ce("circle",{cx:100,cy:100,r:22,strokeWidth:2}),Ce("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),u.map((c,l)=>Ce("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},l))]})}import{useState as or}from"react";import{jsx as ae,jsxs as Be}from"react/jsx-runtime";function ir({customerEmail:e}){let{coupon:t,applyCoupon:n,removeCoupon:r,couponBusy:o}=Lt(),[i,a]=or("");async function u(){o||!i.trim()||(await n(i,e),a(""))}return Be("div",{className:"flex flex-col gap-2",children:[t===null?Be("div",{className:"flex border border-line",children:[ae("input",{type:"text",value:i,onChange:c=>a(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),u())},placeholder:"Coupon code","aria-label":"Coupon code",className:"flex-1 bg-transparent px-3.5 py-3.5 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim"}),ae("button",{type:"button",onClick:()=>{u()},disabled:o,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:o?"\u2026":"Apply"})]}):Be("div",{className:["flex items-center justify-between gap-3 border px-3.5 py-3",t.valid?"border-accent":"border-line"].join(" "),style:t.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[ae("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",t.valid?"text-accent":t.deferred?"text-fg":"text-fg-dim line-through"].join(" "),children:t.code}),ae("button",{type:"button",onClick:r,"aria-label":`Remove coupon ${t.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"\u2715"})]}),t?.deferred?ae("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:gt}):t&&!t.valid&&t.message&&ae("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:t.message})]})}function Xo(){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)}`}export{xr as a,Sr as b,vr as c,at as d,Me as e,ar as f,sr as g,lr as h,ur as i,jt as j,Qt as k,cr as l,dr as m,De as n,Oe as o,pe as p,Pe as q,on as r,Ue as s,Ir as t,Lr as u,sn as v,Nr as w,Tr as x,ln as y,kr as z,cn as A,_r as B,Rr as C,bt as D,Ur as E,$r as F,qr as G,yr as H,mt as I,we as J,qe as K,Xr as L,Lt as M,po as N,An as O,yo as P,On as Q,Fn as R,Io as S,Lo as T,No as U,To as V,Vn as W,Yn as X,jn as Y,Uo as Z,$t as _,$o as $,Xn as aa,qo as ba,er as ca,tr as da,nr as ea,ir as fa,Xo as ga};
@@ -0,0 +1 @@
1
+ import{c as J,e as G,i as V,k as C,p as E,q as K,s as T}from"./chunk-GONJOVIE.js";var I="x-forwarded-for";function z(e){let t=(e??"").split(",").map(r=>r.trim()).filter(Boolean);return t.length>0?t[t.length-1]:null}var qe="x-forwarded-host";function j(e,t,r){let n={};return e&&(n[qe]=e),t&&r==="uncached"&&(n[I]=t),n}function Z(e){if(e?.cache==="no-store"||e?.cache==="no-cache")return"uncached";if(e?.cache==="force-cache")return"data-cached";let t=e?.next?.revalidate;return typeof t=="number"&&t>0?"data-cached":"uncached"}var Q="x-storefront-site",X="x-storefront-host",Y="x-storefront-preview";var ee={contentHash:"db2b679aad5380c6",schema:1,mediaFields:{ImageBlock:["src"],LogoBlock:["src"],Flex:["bgImage"],FeaturedCover:["image"],LongRead:["image"],Banner:["imageSrc"],Timeline:["imageSrc"],Logos:["items[].src"],ContactLocations:["locations[].photo"],HeroSingle:["imageFocal","mediaImage","mediaVideo","poster"],HeroSlide:["mediaImage","mediaVideo","poster"],PostCard:["image"],Gallery:["othersCards[].image","othersCards[].photos[].src","vehicleCards[].image","vehicleCards[].photos[].src","wheelCards[].image","wheelCards[].photos[].src"],GalleryItem:["image","photos[].src"],Manifesto:["imageSrc"],SectionHeader:["logoSrc"],IntroBleed:["imageSrc","imageSrcMobile"],Split:["imageSrc","textBgSrc"],ProcessSteps:["steps[].image"],DetailRows:["rows[].image"],PaymentBadges:["badges[].src"]},mediaKeyNames:["bgImage","image","imageFocal","imageSrc","imageSrcMobile","logoSrc","mediaImage","mediaVideo","photo","poster","src","textBgSrc"],snapshotObjects:{ProductGrid:{source:{keep:["slug"]}},GalleryItem:{product:{keep:["code","finish"]}},FeaturedCover:{source:{keep:["slug"]}},LongRead:{source:{keep:["slug"]}}},hydratedLists:{Events:["posts"],SubscribeBlogs:["posts"]},technicalStateKeys:["imageFocal"]};var Be="shop_access_token",te="shop_refresh_token",q=null;function $(){T.removeItem(Be),T.removeItem(te)}var P={getAccess(){return q},takeLegacyRefresh(){let e=T.getItem(te);return $(),e},setTokens(e){q=e,$()},clear(){q=null,$()}};function Ue(e){return!!e.src}function b(e){let t=e.finishes.filter(Ue);if(t.length===e.finishes.length)return e;let r=e.defaultFinish&&t.some(n=>n.name===e.defaultFinish)?e.defaultFinish:null;return{...e,finishes:t,defaultFinish:r}}function Ne(e){return e.listable!==!1}function B(e){return e.map(b).filter(Ne)}var oe=["fill","stroke","stop-color","color","flood-color","lighting-color","solid-color"],ie=new Set(["none","transparent","currentcolor","inherit","initial","unset","context-fill","context-stroke"]),k={black:[0,0,0],white:[255,255,255],gray:[128,128,128],grey:[128,128,128],darkgray:[169,169,169],darkgrey:[169,169,169],dimgray:[105,105,105],dimgrey:[105,105,105],lightgray:[211,211,211],lightgrey:[211,211,211],gainsboro:[220,220,220],silver:[192,192,192],whitesmoke:[245,245,245]},ae=12,ce=/\burl\(/i,le=new RegExp(`(?<![-\\w])(${oe.join("|")})(\\s*=\\s*)(["'])([^"']*)\\3`,"gi"),ue=new RegExp(`((?:^|[;{\\s"'])(?:${oe.join("|")})\\s*:\\s*)([^;}"'<>]+)`,"gi"),Le=/<svg\b([^>]*)>/i,Me=/\bfill\s*[=:]/i;function He(e){let t=e.replace(le,(r,n,s,o,l)=>{let u=re(l);return u===null?r:`${n}${s}${o}${u}${o}`}).replace(ue,(r,n,s)=>{let o=re(s);return o===null?r:`${n}${o}`});return t=t.replace(Le,(r,n)=>Me.test(n)?r:`<svg fill="#ffffff"${n}>`),t}function re(e){let t=/!important/i.test(e),r=e.replace(/!important/gi,"").trim().toLowerCase();if(!r||ce.test(r)||ie.has(r))return null;let n=r in k?[...k[r],1]:me(r);if(!n)return null;let[s,o,l,u]=n;if(Math.max(s,o,l)-Math.min(s,o,l)>ae)return null;let m=De(255-s,255-o,255-l,u);return t?`${m} !important`:m}function De(e,t,r,n){if(n<1)return`rgba(${e}, ${t}, ${r}, ${n})`;let s=o=>o.toString(16).padStart(2,"0");return`#${s(e)}${s(t)}${s(r)}`}function me(e){return e.startsWith("#")?We(e):e.startsWith("rgb")?Je(e):e.startsWith("hsl")?Ve(e):null}function We(e){let t=e.slice(1),r=1;if(t.length===3||t.length===4)t.length===4&&(r=parseInt(t[3]+t[3],16)/255),t=t.slice(0,3).split("").map(n=>n+n).join("");else if(t.length===6||t.length===8)t.length===8&&(r=parseInt(t.slice(6,8),16)/255),t=t.slice(0,6);else return null;return/^[0-9a-f]{6}$/.test(t)?[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),r]:null}function Je(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[r,n]=t.split("/"),s=r.split(/[\s,]+/).filter(Boolean).slice(0,3);if(s.length<3)return null;let o=s.map(u=>u.endsWith("%")?Math.round(parseFloat(u)/100*255):Math.round(parseFloat(u)));if(o.some(u=>Number.isNaN(u)))return null;let l=n?O(n):Ge(r);return[o[0],o[1],o[2],l]}function Ge(e){let t=e.split(/[\s,]+/).filter(Boolean);return t.length>=4?O(t[3]):1}function O(e){let t=e.trim().endsWith("%")?parseFloat(e)/100:parseFloat(e);return Number.isNaN(t)?1:t}function Ve(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[r,n]=t.split("/"),s=r.split(/[\s,]+/).filter(Boolean);if(s.length<3)return null;let o=parseFloat(s[0]),l=parseFloat(s[1])/100,u=parseFloat(s[2])/100;if([o,l,u].some(Ie=>Number.isNaN(Ie)))return null;let m=n?O(n):s.length>=4?O(s[3]):1,[y,f,S]=Ke(o,l,u);return[y,f,S,m]}function Ke(e,t,r){let n=(1-Math.abs(2*r-1))*t,s=(e%360+360)%360/60,o=n*(1-Math.abs(s%2-1)),l=0,u=0,m=0;s<1?[l,u,m]=[n,o,0]:s<2?[l,u,m]=[o,n,0]:s<3?[l,u,m]=[0,n,o]:s<4?[l,u,m]=[0,o,n]:s<5?[l,u,m]=[o,0,n]:[l,u,m]=[n,0,o];let y=r-n/2;return[Math.round((l+y)*255),Math.round((u+y)*255),Math.round((m+y)*255)]}var ne=512*1024;function U(e){return/\.svg(\?|$)/i.test(e)}function ze(e){return`data:image/svg+xml,${encodeURIComponent(He(e))}`}function je(e){let t=e.replace(/!important/gi,"").trim().toLowerCase();if(!t||ce.test(t)||ie.has(t))return null;let r=t in k?[...k[t],1]:me(t);if(!r)return null;let[n,s,o]=r;return Math.max(n,s,o)-Math.min(n,s,o)>ae?null:(.2126*n+.7152*s+.0722*o)/255}function Ze(e){let t=[],r=n=>{let s=je(n);s!==null&&t.push(s)};for(let n of e.matchAll(le))r(n[4]);for(let n of e.matchAll(ue))r(n[2]);return t.length?t.reduce((n,s)=>n+s,0)/t.length<.5:null}var se=/^(?:\uFEFF|\s+|<\?xml[^>]*\?>|<!--[\s\S]*?-->|<!DOCTYPE\s+svg[^>[]*>)/i;function Qe(e){let t=e;for(let r=se.exec(t);r&&r[0].length>0;r=se.exec(t))t=t.slice(r[0].length);return/^<svg[\s>/]/i.test(t)}async function Xe(e,t){if(!U(e))return null;try{let r=await fetch(e,{signal:t,redirect:"manual"});if(!r.ok)return null;let n=Number(r.headers.get("content-length"));if(Number.isFinite(n)&&n>ne)return null;let s=await r.text();return s.length>ne?null:Qe(s)?s:null}catch{return null}}async function de(e,t){let r=await Xe(e,t);return r===null?null:{reversed:ze(r),inkIsDark:Ze(r)}}function pe(){return J().siteId()}var Ye="",h=class extends Error{constructor(t,r,n){super(r),this.status=t,this.data=n}},M="Unable to reach the server. This could be a problem with your internet connection, or the server may be undergoing maintenance or an upgrade. Please try again shortly.",et=new Set([502,503,504]),N=0,tt="This editor runs on its host's own backend, which does not serve this request.",rt=5e3,nt=15e3,st=()=>typeof window>"u"?rt:nt;function Re(e){let t=(e.method??"GET").toUpperCase();if(!(e.body!=null||t!=="GET"&&t!=="HEAD")&&!(e.audience!=null&&e.audience!=="shop")&&typeof AbortSignal?.timeout=="function")return AbortSignal.timeout(st())}var ge=e=>e instanceof Error&&e.name==="TimeoutError",he=(e,t)=>et.has(e)?M:t,ot=["admin","venue"],_e="admin";function Yt(e){_e=ot.includes(e)?e:"admin"}function it(){return _e}var at=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/,xe=null;function er(e){xe=e&&at.test(e)?e:null}function ct(){return xe}function lt(e){if(typeof window>"u"||!e.startsWith("/api/v1/"))return e;let t=E();return!t||/[?&]site=/.test(e)?e:F(e,`site=${encodeURIComponent(t)}`)}async function i(e,t={}){let{token:r,baseUrl:n,headers:s,audience:o,...l}=t;if(typeof window<"u"&&!G())throw new h(N,tt,null);if(typeof window>"u"&&n===void 0)throw new Error(`apiFetch(${JSON.stringify(e)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);let u=typeof FormData<"u"&&l.body instanceof FormData,m;try{m=await fetch(`${n??Ye}${lt(e)}`,{...l,headers:{...u?{}:{"Content-Type":"application/json"},...r?{Authorization:`Bearer ${r}`}:{},...o===null?{}:{"X-Portal-Audience":o??"shop"},...s},signal:l.signal??Re({...l,audience:o})})}catch(S){throw S instanceof TypeError||ge(S)?new h(N,M,null):S}let y;try{y=await m.text()}catch(S){throw ge(S)?new h(N,M,null):S}let f=null;if(y)try{f=JSON.parse(y)}catch{throw new h(m.status,m.ok?"Expected JSON but received a non-JSON response":he(m.status,m.statusText),y)}if(!m.ok){let S=(f&&typeof f=="object"&&"detail"in f&&typeof f.detail=="string"?f.detail:null)??he(m.status,m.statusText);throw new h(m.status,S,f)}return f}var A=null;async function Ce(){return A||(A=ut().finally(()=>{A=null}),A)}async function ut(){let e=P.takeLegacyRefresh(),t=await mt.refresh(e??void 0);return P.setTokens(t.access),t.access}async function Te(){return P.getAccess()??Ce()}async function d(e,t={}){let r;try{r=await Te()}catch{throw P.clear(),new h(401,"Not signed in",null)}try{return await i(e,{...t,token:r})}catch(n){if(!(n instanceof h)||n.status!==401)throw n;try{let s=await Ce();return await i(e,{...t,token:s})}catch{throw P.clear(),n}}}async function ye(e,t={}){if(P.getAccess())try{return{data:await d(e,t),asShopper:!0}}catch(r){if(!(r instanceof h)||r.status!==401)throw r}return{data:await i(e,t),asShopper:!1}}async function fe(){let e=await d("/api/auth/me/");if(e.portal!=="shop")throw P.clear(),new h(403,"This session is not valid for this shop.",null);return e}var mt={login:(e,t)=>i("/api/auth/login/",{method:"POST",body:JSON.stringify({email:e,password:t,portal:"shop"}),credentials:"include"}),refresh:e=>i("/api/auth/refresh/",{method:"POST",body:JSON.stringify(e?{refresh:e,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{P.clear();try{await i("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{let e=await Te();return await fe(),e},me:fe,updateMe:e=>d("/api/auth/me/",{method:"PATCH",body:JSON.stringify(e)}),changePassword:(e,t)=>d("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:t,old_password:e})}),changeEmail:(e,t)=>d("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:e,current_password:t})}),myProfile:()=>d("/api/shop-portal/profile/"),updateMyProfile:e=>d("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(e)}),myAddresses:()=>d("/api/shop-portal/delivery-locations/"),createAddress:e=>d("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(e)}),updateAddress:(e,t)=>d(`/api/shop-portal/delivery-locations/${e}/`,{method:"PATCH",body:JSON.stringify(t)}),deleteAddress:e=>d(`/api/shop-portal/delivery-locations/${e}/`,{method:"DELETE"}),passwordResetRequest:e=>i("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:e})}),passwordResetConfirm:(e,t,r)=>i("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:e,token:t,new_password:r})}),brands:()=>d("/api/products/brands/"),myOrders:()=>d("/api/shop-portal/orders/").then(e=>e.results),myOrder:e=>d(`/api/shop-portal/orders/${e}/`),cancelOrder:e=>d(`/api/shop-portal/orders/${e}/cancel/`,{method:"POST"}),myReturns:e=>d(`/api/shop-portal/returns/${e?`?order=${encodeURIComponent(e)}`:""}`).then(t=>t.results),createReturn:e=>d("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(e)}),withdrawReturn:e=>d(`/api/shop-portal/returns/${e}/cancel/`,{method:"POST"}),uploadReturnPhoto:(e,t)=>{let r=new FormData;return r.append("claim_item",e),r.append("file",t),r.append("media_type",t.type.startsWith("video/")?"video":"image"),d("/api/shop-portal/return-media/",{method:"POST",body:r})}};function g(e){if(typeof e=="string")return e.startsWith("/media/")?V(e):e;if(Array.isArray(e))return e.map(g);if(e&&typeof e=="object"){let t={};for(let[r,n]of Object.entries(e))t[r]=r==="captions"&&n&&typeof n=="object"&&!Array.isArray(n)?Object.fromEntries(Object.entries(n).map(([s,o])=>[g(s),o])):g(n);return t}return e}var dt="",ke="".replace(/\/+$/,""),Oe=typeof window>"u"&&ke!=="",pt=Oe?ke:dt,gt=K,w=()=>({baseUrl:gt(),audience:null});function a(e,t){let r=t?`?process=${encodeURIComponent(t)}`:"";return`/api/v1${e}${r}`}var ht=100,Se=50;function ve(e,t,r){let n=new URLSearchParams;for(let[s,o]of Object.entries(t))o!=null&&o!==""&&n.set(s,String(o));return n.set("pageSize",String(ht)),r&&n.set("cursor",r),`/api/v1${e}?${n.toString()}`}function yt(e,t){return ve("/wheels",{process:e},t)}function ft(e,t,r){return ve("/products",{kind:e.join(","),make:t?.make,model:t?.model,year:t?.year,modification:t?.modification},r)}function St(e){if(!e)return null;try{return new URL(e,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function Pe(e,t,r=()=>!1){let n=[],s=null;try{for(let o=0;o<Se;o++){let l=await i(await t(s),await c());if(n.push(...l.results),s=St(l.next),!s)break}s&&console.warn(`[${e}] stopped at ${Se} pages (${n.length} rows); catalog may be truncated`)}catch(o){if(r(o))throw o;console.warn(`[${e}] product API unavailable, returning []`,o)}return n}var Pt=e=>e instanceof h&&e.status===400;function wt(e){return e.flatMap(t=>t.kind==="alloy-wheel"?B([t]):[t])}async function Fe(){return(await bt()).host}async function bt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js"),t=await e(),r=o=>o?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,n=r(t.get(X)??t.get("x-forwarded-host")??t.get("host")),s=r(t.get("host"));return{host:n,matchesRequestHost:n!==null&&n===s}}catch{return{host:null,matchesRequestHost:!1}}}async function At(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return z((await e()).get(I))}catch{return null}}async function Rt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(Q)||null}catch{return null}}async function _t(){let e=await Rt();if(e)return`site=${encodeURIComponent(e)}`;let t=await Fe();return t?`host=${encodeURIComponent(t)}`:""}async function p(e){if(typeof window<"u"){let t=E();return t?F(e,`site=${encodeURIComponent(t)}`):e}return F(e,await _t())}function F(e,t){return t?`${e}${e.includes("?")?"&":"?"}${t}`:e}var xt="preview";async function Ct(){if(typeof window<"u")return null;try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(Y)}catch{return null}}async function Tt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get("user-agent")}catch{return null}}async function L(e,t){let r=await Ct();if(r===null)return[await p(e),await c(t)];let n=F(await p(e),`${xt}=${encodeURIComponent(r)}`),{next:s,cache:o,...l}=t??{},u=await c({...l,cache:"no-store"}),m=await Tt();return m&&(u.headers={...u.headers,"user-agent":m}),[n,u]}async function kt(e){if(!Oe)return;let[t,r]=await Promise.all([Fe(),At()]),n=j(t,r,e);return Object.keys(n).length>0?n:void 0}async function c(e){let t=await kt(Z(e)),r={baseUrl:pt,...e};return t&&(r.headers={...t,...e?.headers}),r}var R=typeof window>"u";function _(e,t){let r=new URLSearchParams;for(let[s,o]of Object.entries(t))o!==void 0&&o!==""&&r.set(s,String(o));let n=r.toString();return`/api/v1/fitment${e}${n?`?${n}`:""}`}var or={listMakes:async e=>{if(R){let{fitmentData:r}=await import("./fitment-data-HO7IRCLU.js");return r.makes(e)}return(await i(_("/makes",{region:e}),w())).results},listModels:async(e,t)=>{if(R){let{fitmentData:n}=await import("./fitment-data-HO7IRCLU.js");return n.models(e,t)}return(await i(_("/models",{make:e,region:t}),w())).results},listYears:async(e,t,r)=>{if(R){let{fitmentData:s}=await import("./fitment-data-HO7IRCLU.js");return s.years(e,t,r)}return(await i(_("/years",{make:e,model:t,region:r}),w())).results},listModifications:async(e,t,r,n)=>{if(R){let{fitmentData:o}=await import("./fitment-data-HO7IRCLU.js");return o.modifications(e,t,r,n)}return(await i(_("/modifications",{make:e,model:t,year:r,region:n}),w())).results},getStockFitment:async(e,t,r,n,s)=>{if(R){let{fitmentData:o}=await import("./fitment-data-HO7IRCLU.js");return o.stockFitment(e,t,r,n,s)}return i(_("/stock-fitment",{make:e,model:t,year:r,modification:n,region:s}),w())}},ir={listWheels:async e=>{let t=await Pe("products.listWheels",async r=>await p(yt(e,r)));return B(g(t))},listCatalog:async(e,t)=>{if(e.length===0)throw new Error("products.listCatalog() needs at least one kind. An empty list would omit `kind`, which the contract reads as `alloy-wheel` \u2014 so the call would silently return the wheel catalog instead of nothing.");let r=await Pe("products.listCatalog",async n=>await p(ft(e,t,n)),Pt);return wt(g(r))},getWheel:async e=>b(g(await i(await p(a(`/wheels/${e}`)),await c()))),getTyre:async e=>g(await i(await p(a(`/tyres/${e}`)),await c())),listBundles:async()=>{try{return await i(await p(a("/bundles")),await c())}catch{return[]}},getBundle:async e=>i(await p(a(`/bundles/${e}`)),await c()),listGalleryBuilds:async(e={})=>{let{process:t=null,wheelSlug:r=null}=e;if(typeof window>"u"){let{listGalleryBuilds:n}=await import("./gallery-builds-data-VVHHVNYW.js");return g(n(t,r))}try{let n=new URLSearchParams;t&&n.set("process",t),r&&n.set("wheelSlug",r);let s=n.toString(),o=await i(`/api/v1/gallery-builds${s?`?${s}`:""}`,w());return g(o.results)}catch(n){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",n),[]}},getSite:async()=>i(await p(a("/site")),await c()),getSiteBySlug:async e=>i(`${a("/site")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await c():void 0),listBrands:async()=>{try{return(await i(await p(a("/brands")),await c())).results??[]}catch(e){return console.warn("[products.listBrands] product API unavailable, returning []",e),[]}},listBrandsForSite:async e=>(await i(`${a("/brands")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await c():void 0)).results??[],listPages:async()=>g(await i(await p(a("/pages")),await c())),listProductTemplates:async()=>{try{return await i(await p(a("/product-templates")),await c())}catch(e){return console.warn("[products.listProductTemplates] unavailable, returning []",e),[]}},listDynamicPages:async e=>{let t=e?`?recordType=${encodeURIComponent(e)}`:"";try{return await i(await p(`${a("/dynamic-pages")}${t}`),await c())}catch(r){if(r instanceof h&&r.status===404)return[];throw r}},getRecord:async(e,t)=>{try{return await i(await p(a(`/records/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)),await c())}catch(r){if(r instanceof h&&r.status===404)return null;throw r}},listProductTypeChoices:async()=>{try{return await i(await p(a("/product-type-choices")),await c())}catch(e){return console.warn("[products.listProductTypeChoices] unavailable, returning []",e),[]}},listFieldUsage:async()=>{try{return await i(await p(a("/field-usage")),await c())}catch(e){return console.warn("[products.listFieldUsage] unavailable, returning []",e),[]}},getPage:async(e,t={})=>{let r=t.record?`?record=${encodeURIComponent(t.record)}`:"",[n,s]=await L(a(`/pages/${e}`)+r,t.revalidate!==void 0?{next:{revalidate:t.revalidate}}:void 0);return g(await i(n,s))},listBlogPosts:async()=>{try{return(await i(a("/blog-posts"),await c())).map(t=>({...t,coverImage:C(t.coverImage)??""}))}catch(e){return console.warn("[products.listBlogPosts] blog API unavailable, returning []",e),[]}},getBlogPost:async e=>{let t=await i(a(`/blog-posts/${e}`),await c());return{...t,coverImage:C(t.coverImage)??""}},createOrder:async e=>i(a("/orders"),await c({method:"POST",body:JSON.stringify(e)})),createOrderAuthed:async e=>d(a("/orders"),await c({method:"POST",body:JSON.stringify(e)})),lookupOrder:async e=>i(a("/orders/lookup"),await c({method:"POST",body:JSON.stringify(e)})),createPaymentIntent:async e=>i(a("/payments/intent"),await c({method:"POST",body:JSON.stringify(e)})),createPaypalOrder:async e=>i(a("/payments/paypal/order"),await c({method:"POST",body:JSON.stringify(e)})),capturePaypalOrder:async e=>i(a("/payments/paypal/capture"),await c({method:"POST",body:JSON.stringify(e)})),createAfterpayCheckout:async e=>i(a("/payments/afterpay/checkout"),await c({method:"POST",body:JSON.stringify(e)})),captureAfterpayPayment:async e=>i(a("/payments/afterpay/capture"),await c({method:"POST",body:JSON.stringify(e)})),chargeSquare:async e=>i(a("/payments/square/charge"),await c({method:"POST",body:JSON.stringify(e)})),createGocardlessBillingRequest:async e=>i(a("/payments/gocardless/billing-request"),await c({method:"POST",body:JSON.stringify(e)})),completeGocardlessPayment:async e=>i(a("/payments/gocardless/complete"),await c({method:"POST",body:JSON.stringify(e)})),createZipCheckout:async e=>i(a("/payments/zip/checkout"),await c({method:"POST",body:JSON.stringify(e)})),captureZipPayment:async e=>i(a("/payments/zip/capture"),await c({method:"POST",body:JSON.stringify(e)})),createKlarnaCheckout:async e=>i(a("/payments/klarna/checkout"),await c({method:"POST",body:JSON.stringify(e)})),captureKlarnaPayment:async e=>i(a("/payments/klarna/capture"),await c({method:"POST",body:JSON.stringify(e)})),createStockAlert:async e=>i(a("/stock-alerts"),await c({method:"POST",body:JSON.stringify(e)})),createPreOrderIntent:async e=>i(a("/pre-order-intents"),await c({method:"POST",body:JSON.stringify(e)})),createNewsletterSubscription:async e=>i(a("/newsletter-subscriptions"),await c({method:"POST",body:JSON.stringify(e)})),unsubscribeNewsletter:async e=>i(a("/newsletter-unsubscribe"),await c({method:"POST",body:JSON.stringify(e)})),captureCart:async e=>i(a("/carts"),await c({method:"POST",body:JSON.stringify(e)})),restoreCart:async e=>i(a("/carts/restore"),await c({method:"POST",body:JSON.stringify(e)})),unsubscribeCartReminders:async e=>i(a("/carts/unsubscribe"),await c({method:"POST",body:JSON.stringify(e)})),listReviews:async(e={})=>{let t=new URLSearchParams;e.limit&&t.set("limit",String(e.limit)),e.designCode&&t.set("designCode",e.designCode);let r=a("/reviews"),n=t.toString();try{return await i(await p(n?`${r}?${n}`:r),await c())}catch(s){return console.warn("[products.listReviews] product API unavailable, returning []",s),[]}},submitReview:async e=>i(a("/reviews"),await c({method:"POST",body:JSON.stringify(e)})),getForm:async e=>i(a(`/forms/${encodeURIComponent(e)}`),await c()),submitForm:async(e,t)=>i(a(`/forms/${encodeURIComponent(e)}/submissions`),await c({method:"POST",body:JSON.stringify(t)})),listShippingMethods:async()=>{try{return await i(a("/shipping-methods"),await c())}catch(e){return console.warn("[products.listShippingMethods] product API unavailable, returning []",e),[]}},listCountrySubdivisions:async e=>{try{return await i(a(`/countries/${encodeURIComponent(e)}/subdivisions`),await c())}catch(t){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",t),[]}},quoteCart:async e=>{let t=a("/cart/quote"),r=await c({method:"POST",body:JSON.stringify(e)});return e.couponCode?(await ye(t,r)).data:i(t,r)},validateCoupon:async e=>{let{data:t,asShopper:r}=await ye(a("/coupons/validate"),await c({method:"POST",body:JSON.stringify(e)}));return{...t,askedAsShopper:r}},getHeaderSettings:async()=>{let e=Re({method:"GET"}),t=await i(...await L(a("/header-settings"),{signal:e})),r=C(t.logoUrl),n=null,s=null;if(r&&U(r)){let o=await de(r,e);o&&(n=o.reversed,s=o.inkIsDark)}return{...t,logoUrl:r,logoReversed:n,logoInkIsDark:s}},getThemeSettings:async()=>i(...await L(a("/theme-settings"))),getChatSettings:async()=>i(await p(a("/chat-settings")),await c())},ar={listServices:async()=>{try{return await i(a("/bookings/services"),await c())}catch(e){return console.warn("[bookings.listServices] API unavailable, returning []",e),{results:[],currency:"USD"}}},getAvailability:async(e,t)=>i(a(`/bookings/availability?service=${encodeURIComponent(e)}&date=${t}`),await c()),create:async e=>i(a("/bookings"),await c({method:"POST",body:JSON.stringify(e)})),get:async e=>i(a(`/bookings/manage/${encodeURIComponent(e)}`),await c()),cancel:async e=>i(a(`/bookings/manage/${encodeURIComponent(e)}/cancel`),await c({method:"POST"})),createPaymentIntent:async e=>i(a("/bookings/payments/intent"),await c({method:"POST",body:JSON.stringify({manageToken:e})}))},H=class extends Error{constructor(r,n){super(`Slug "${r}" exists on ${n} websites; a site is required to pick one.`);this.slug=r;this.count=n;this.name="AmbiguousPageSlugError"}},x=e=>e?`/api/storefront/header-settings/?${new URLSearchParams({site:e})}`:"/api/storefront/header-settings/",we=e=>e?`/api/storefront/theme-settings/?${new URLSearchParams({site:e})}`:"/api/storefront/theme-settings/",be=e=>e?`/api/storefront/chat-settings/?${new URLSearchParams({site:e})}`:"/api/storefront/chat-settings/",Ae=e=>`/api/storefront/social-settings/?${new URLSearchParams({site:e})}`,D=e=>`/api/storefront/sites/${encodeURIComponent(e)}/`,Ot=e=>`${D(e)}currencies/`,vt="/api/storefront/media/ingest/",W=class extends Error{constructor(){super("This editor is not connected to a website, so an upload has nowhere to go. Open the page from the website the file should belong to, then try again."),this.name="MediaUploadDestinationError"}};function Ft(){let e=pe();if(!e)throw new W;return`${vt}?${new URLSearchParams({site:e})}`}var v={"X-Puck-Media-Manifest":ee.contentHash},cr=Ee({});function Ee(e){return(t,r={})=>{let n=ct(),s=e.headers||n?{...n?{"Accept-Language":n}:{},...e.headers,...r.headers}:void 0;return i(t,{...r,...e.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...s?{headers:s}:{},audience:e.audience??it()})}}function Et(e={}){let t=Ee(e);return{findPageBySlug:async(r,n,s)=>{let o=new URLSearchParams({slug:r});s&&o.set("site",s);let l=await t(`/api/storefront/pages/?${o.toString()}`,{token:n}),u=Array.isArray(l)?l:l.results??[];if(!s&&u.length>1)throw new H(r,u.length);return u[0]??null},getPageById:(r,n)=>t(`/api/storefront/pages/${r}/`,{token:n}),saveLayout:(r,n,s,o,l)=>t(`/api/storefront/pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:n,expected_updated_at:o,...l?{client_id:l}:{}}),token:s}),publishPage:(r,n,s)=>t(`/api/storefront/pages/${r}/publish/`,{method:"POST",body:s?JSON.stringify({expected_updated_at:s}):void 0,token:n}),claimPageEditLock:(r,n,s,o=!1)=>t(`/api/storefront/pages/${r}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:s,takeover:o}),token:n}),releasePageEditLock:(r,n)=>t(`/api/storefront/pages/${r}/edit-lock/`,{method:"DELETE",token:n}),createTemplate:(r,n,s)=>t("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:r,layout:n}),headers:v,token:s}),getTemplate:(r,n)=>t(`/api/storefront/page-templates/${r}/`,{token:n}),saveTemplateLayout:(r,n,s)=>t(`/api/storefront/page-templates/${r}/`,{method:"PATCH",body:JSON.stringify({layout:n}),headers:v,token:s}),listTemplatePages:async(r,n)=>{let s=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}`,{token:n});return Array.isArray(s)?s:s.results??[]},findTemplatePageBySlug:async(r,n,s)=>{let o=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}&slug=${encodeURIComponent(n)}`,{token:s});return(Array.isArray(o)?o:o.results??[])[0]??null},createTemplatePage:(r,n,s)=>t("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:r,...n}),headers:v,token:s}),saveTemplatePageLayout:(r,n,s)=>t(`/api/storefront/template-pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:n}),headers:v,token:s}),deleteTemplatePage:(r,n)=>t(`/api/storefront/template-pages/${r}/`,{method:"DELETE",token:n}),listPages:async(r,n)=>{let s=new URLSearchParams({no_page:"true"});n&&s.set("site",n);let o=await t(`/api/storefront/pages/?${s.toString()}`,{token:r});return Array.isArray(o)?o:o.results??[]},createPage:(r,n,s,o)=>t("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:r,slug:n,layout:s}),token:o}),deletePage:(r,n)=>t(`/api/storefront/pages/${r}/`,{method:"DELETE",token:n}),getHeaderSettings:(r,n)=>t(x(n),{token:r}),listMenus:async(r,n)=>{let s=new URLSearchParams({no_page:"true"});n&&s.set("site",n);let o=await t(`/api/storefront/menus/?${s}`,{token:r});return Array.isArray(o)?o:o.results??[]},listBlogPosts:async(r,n={})=>{let s=new URLSearchParams({no_page:"true"});n.visibleOnly&&s.set("is_visible","true"),n.siteId&&s.set("site",n.siteId);let o=await t(`/api/storefront/blog-posts/?${s.toString()}`,{token:r});return Array.isArray(o)?o:o.results??[]},listFieldUsage:async(r,n)=>{let s=await t(`/api/storefront/field-usage/?site=${encodeURIComponent(n)}`,{token:r});return Array.isArray(s?.entries)?s.entries:[]},listCategories:async(r,n={})=>{let s=new URLSearchParams({no_page:"true"});n.visibleOnly&&s.set("is_visible","true"),n.siteId&&s.set("site",n.siteId);let o=await t(`/api/storefront/categories/?${s.toString()}`,{token:r});return[...Array.isArray(o)?o:o.results??[]].sort((u,m)=>u.sort_order-m.sort_order||u.name.localeCompare(m.name))},listForms:async(r,n={})=>{let s=new URLSearchParams({no_page:"true"});n.siteId&&s.set("site",n.siteId);let o=await t(`/api/storefront/forms/?${s.toString()}`,{token:r});return[...Array.isArray(o)?o:o.results??[]].sort((u,m)=>u.title.localeCompare(m.title))},listWheelSummaries:async(r,n={})=>{let s=new URLSearchParams;n.siteId&&s.set("site",n.siteId);let o=s.toString(),l=await t(`/api/storefront/wheel-curations/summaries/${o?`?${o}`:""}`,{token:r});return g(l)},listProducts:async(r,n={})=>{let s=new URLSearchParams;n.kinds?.length&&s.set("kind",n.kinds.join(",")),n.siteId&&s.set("site",n.siteId);let o=s.toString(),l=await t(`/api/storefront/products/${o?`?${o}`:""}`,{token:r});return g(l)},getWheelDetail:async(r,n,s={})=>{let o=new URLSearchParams({slug:n});return s.siteId&&o.set("site",s.siteId),b(g(await t(`/api/storefront/wheel-curations/detail/?${o.toString()}`,{token:r})))},updateHeaderSettings:(r,n,s)=>t(x(s),{method:"PATCH",body:JSON.stringify(r),token:n}),getSite:(r,n)=>t(D(r),{token:n}),listSites:async r=>{let n=await t("/api/storefront/sites/?no_page=true",{token:r});return Array.isArray(n)?n:n.results??[]},listSiteCurrencies:async(r,n)=>{let s=await t(Ot(r),{token:n});return Array.isArray(s)?s:[]},updateSite:(r,n,s)=>t(D(r),{method:"PATCH",body:JSON.stringify(n),token:s}),getThemeSettings:(r,n)=>t(we(n),{token:r}),updateThemeSettings:(r,n,s)=>t(we(s),{method:"PATCH",body:JSON.stringify(r),token:n}),getChatSettings:(r,n)=>t(be(n),{token:r}),updateChatSettings:(r,n,s)=>t(be(s),{method:"PATCH",body:JSON.stringify(r),token:n}),getSocialSettings:(r,n)=>t(Ae(n),{token:r}),updateSocialSettings:(r,n,s)=>t(Ae(s),{method:"PATCH",body:JSON.stringify(r),token:n}),uploadHeaderLogo:(r,n,s)=>{let o=new FormData;return o.append("logo",r),t(x(s),{method:"PATCH",body:o,token:n})},clearHeaderLogo:(r,n)=>t(x(n),{method:"PATCH",body:JSON.stringify({logo:null}),token:r}),setHeaderLogoFromAsset:(r,n,s)=>t(x(s),{method:"PATCH",body:JSON.stringify({logo_asset_id:r}),token:n}),uploadMedia:async(r,n)=>{let s=new FormData;return s.append("file",r),t(Ft(),{method:"POST",body:s,token:n})},listMedia:async(r,n)=>{let s=new URLSearchParams({no_page:"true"});n&&s.set("kind",n);let o=await t(`/api/storefront/media-assets/?${s.toString()}`,{token:r});return Array.isArray(o)?o:o.results??[]}}}var lr=Et();export{ee as a,j as b,Z as c,P as d,Ue as e,U as f,pe as g,Ye as h,h as i,M as j,N as k,Yt as l,er as m,i as n,mt as o,dt as p,Fe as q,bt as r,At as s,Rt as t,Ct as u,or as v,ir as w,ar as x,H as y,cr as z,lr as A};