efficient-storefront-blocks 0.85.0 → 0.86.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 (110) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/chunks/{EditorPreviewCheckout-4XHYYAT2.js → EditorPreviewCheckout-4LNXFNN7.js} +1 -1
  3. package/dist/chunks/{SiteEditorProvider-X4YKBAJ4.js → SiteEditorProvider-A2HMVDKS.js} +1 -1
  4. package/dist/chunks/{chunk-Y5LB56KB.js → chunk-EUKK2IN6.js} +1 -1
  5. package/dist/chunks/chunk-FJRKNPNN.js +340 -0
  6. package/dist/chunks/{chunk-VG4SUIRK.js → chunk-SLRULFYY.js} +1 -1
  7. package/dist/chunks/{chunk-NFXV7HDB.js → chunk-TGBNREUJ.js} +1 -1
  8. package/dist/chunks/{fitment-data-2I2FDPXW.js → fitment-data-TSYW6AFA.js} +1 -1
  9. package/dist/contract.js +1 -1
  10. package/dist/editor/lib/document/blocks/commerce/FitmentPicker/fields.d.ts +2 -0
  11. package/dist/editor/lib/document/blocks/commerce/FitmentPicker/fields.js +1 -0
  12. package/dist/editor/lib/document/blocks/commerce/FitmentTable/fields.js +1 -1
  13. package/dist/editor/lib/document/blocks/commerce/ProductGrid/fields.js +1 -1
  14. package/dist/editor/lib/document/blocks/commerce/SpecTable/fields.js +1 -1
  15. package/dist/editor/lib/document/blocks/commerce/StockFitment/fields.d.ts +2 -0
  16. package/dist/editor/lib/document/blocks/commerce/StockFitment/fields.js +1 -0
  17. package/dist/editor/lib/document/blocks/commerce/index.d.ts +1 -1
  18. package/dist/editor/lib/document/blocks/commerce/index.js +1 -1
  19. package/dist/editor/lib/document/blocks/commerce/page-rules.d.ts +5 -0
  20. package/dist/editor/lib/document/blocks/commerce/page-rules.js +1 -1
  21. package/dist/editor/lib/document/blocks/service/ArticleBody/fields.d.ts +2 -0
  22. package/dist/editor/lib/document/blocks/service/ArticleBody/fields.js +1 -0
  23. package/dist/editor/lib/document/blocks/service/SiteFooter/fields.js +1 -1
  24. package/dist/editor/lib/document/blocks/service/SiteHeader/fields.js +1 -1
  25. package/dist/editor/lib/document/blocks/service/index.d.ts +1 -1
  26. package/dist/editor/lib/document/blocks/service/index.js +1 -1
  27. package/dist/editor/lib/document/box-header.d.ts +1 -1
  28. package/dist/editor/lib/document/box-header.js +1 -1
  29. package/dist/editor/lib/document/config.js +1 -1
  30. package/dist/editor/lib/efficient-block-sources.js +1 -1
  31. package/dist/editor/lib/storefront-editor-words.d.ts +13 -0
  32. package/dist/editor/lib/storefront-editor-words.js +1 -1
  33. package/dist/index.js +41 -37
  34. package/dist/render/built-with.json +1 -1
  35. package/dist/render/components/ArticleBody.d.ts +7 -0
  36. package/dist/render/components/ArticleBody.js +1 -0
  37. package/dist/render/components/BoxHeaderBar.d.ts +2 -1
  38. package/dist/render/components/BoxHeaderBar.js +1 -1
  39. package/dist/render/components/ProductGridSection.d.ts +2 -1
  40. package/dist/render/components/ProductGridSection.js +1 -1
  41. package/dist/render/components/PublishedHeader.js +1 -1
  42. package/dist/render/components/SectionBand.d.ts +2 -1
  43. package/dist/render/components/SectionBand.js +1 -1
  44. package/dist/render/components/SectionBandChoice.d.ts +2 -1
  45. package/dist/render/components/SectionBandChoice.js +1 -1
  46. package/dist/render/components/SectionGroupBody.d.ts +2 -2
  47. package/dist/render/components/SectionGroupBody.js +1 -1
  48. package/dist/render/components/SpecTable.d.ts +3 -1
  49. package/dist/render/components/SpecTable.js +1 -1
  50. package/dist/render/components/TyreSizeGrid.d.ts +17 -0
  51. package/dist/render/components/TyreSizeGrid.js +1 -0
  52. package/dist/render/components/fitment/FitmentPickerGrid.d.ts +5 -1
  53. package/dist/render/components/fitment/FitmentPickerGrid.js +1 -1
  54. package/dist/render/components/fitment/FitmentPickerPart.d.ts +8 -0
  55. package/dist/render/components/fitment/FitmentPickerPart.js +1 -0
  56. package/dist/render/components/fitment/StockFitmentPart.d.ts +4 -0
  57. package/dist/render/components/fitment/StockFitmentPart.js +1 -0
  58. package/dist/render/components/fitment/useVehicleFit.d.ts +2 -1
  59. package/dist/render/components/fitment/useVehicleFit.js +1 -1
  60. package/dist/render/components/pdp-dynamic/DynamicFitmentTable.d.ts +5 -0
  61. package/dist/render/components/pdp-dynamic/DynamicFitmentTable.js +1 -1
  62. package/dist/render/components/pdp-dynamic/DynamicSpecTable.d.ts +1 -0
  63. package/dist/render/components/pdp-dynamic/DynamicSpecTable.js +1 -1
  64. package/dist/render/components/pdp-dynamic/DynamicTyreSizes.js +1 -1
  65. package/dist/render/components/pdp-dynamic/FitmentTableBlock.d.ts +3 -1
  66. package/dist/render/components/pdp-dynamic/FitmentTableBlock.js +1 -1
  67. package/dist/render/lib/content/article-body-seed.d.ts +9 -0
  68. package/dist/render/lib/content/article-body-seed.js +1 -0
  69. package/dist/render/lib/content/article-body.d.ts +8 -0
  70. package/dist/render/lib/content/article-body.js +5 -0
  71. package/dist/render/lib/content/article-page-seed.d.ts +12 -0
  72. package/dist/render/lib/content/article-page-seed.js +1 -0
  73. package/dist/render/lib/document/blocks/commerce/FitmentPicker/meta.d.ts +2 -0
  74. package/dist/render/lib/document/blocks/commerce/FitmentPicker/meta.js +1 -0
  75. package/dist/render/lib/document/blocks/commerce/FitmentPicker/render.d.ts +2 -0
  76. package/dist/render/lib/document/blocks/commerce/FitmentPicker/render.js +1 -0
  77. package/dist/render/lib/document/blocks/commerce/FitmentTable/meta.js +1 -1
  78. package/dist/render/lib/document/blocks/commerce/FitmentTable/render.js +1 -1
  79. package/dist/render/lib/document/blocks/commerce/ProductGrid/render.js +1 -1
  80. package/dist/render/lib/document/blocks/commerce/SpecTable/render.js +1 -1
  81. package/dist/render/lib/document/blocks/commerce/StockFitment/meta.d.ts +2 -0
  82. package/dist/render/lib/document/blocks/commerce/StockFitment/meta.js +1 -0
  83. package/dist/render/lib/document/blocks/commerce/StockFitment/render.d.ts +2 -0
  84. package/dist/render/lib/document/blocks/commerce/StockFitment/render.js +1 -0
  85. package/dist/render/lib/document/blocks/commerce/metas.d.ts +2 -0
  86. package/dist/render/lib/document/blocks/commerce/metas.js +1 -1
  87. package/dist/render/lib/document/blocks/commerce/renders.d.ts +2 -0
  88. package/dist/render/lib/document/blocks/commerce/renders.js +1 -1
  89. package/dist/render/lib/document/blocks/service/ArticleBody/meta.d.ts +8 -0
  90. package/dist/render/lib/document/blocks/service/ArticleBody/meta.js +1 -0
  91. package/dist/render/lib/document/blocks/service/ArticleBody/render.d.ts +2 -0
  92. package/dist/render/lib/document/blocks/service/ArticleBody/render.js +1 -0
  93. package/dist/render/lib/document/blocks/service/SiteFooter/render.js +1 -1
  94. package/dist/render/lib/document/blocks/service/SiteHeader/render.js +1 -1
  95. package/dist/render/lib/document/blocks/service/metas.d.ts +1 -0
  96. package/dist/render/lib/document/blocks/service/metas.js +1 -1
  97. package/dist/render/lib/document/blocks/service/renders.d.ts +1 -0
  98. package/dist/render/lib/document/blocks/service/renders.js +1 -1
  99. package/dist/render/lib/document/card-templates.js +1 -1
  100. package/dist/render/lib/document/lazy-draws.js +1 -1
  101. package/dist/render/lib/sections/product-grid-columns.d.ts +5 -0
  102. package/dist/render/lib/sections/product-grid-columns.js +1 -0
  103. package/dist/render/lib/wheels/vehicle-memory.d.ts +13 -0
  104. package/dist/render/lib/wheels/vehicle-memory.js +1 -1
  105. package/dist/words.d.ts +24 -0
  106. package/dist/words.js +5 -5
  107. package/package.json +4 -4
  108. package/dist/chunks/chunk-NNBMZAW4.js +0 -340
  109. /package/dist/chunks/{chunk-KKKMX6LH.js → chunk-ALMIS7CK.js} +0 -0
  110. /package/dist/chunks/{chunk-NNBMZAW4.js.LEGAL.txt → chunk-FJRKNPNN.js.LEGAL.txt} +0 -0
@@ -1 +1 @@
1
- import{f as Ct,i as ye,q as xt,s as St,t as vt,v as G}from"./chunk-NFXV7HDB.js";import{Ka as he,La as yt,Oa as qe,Pa as bt,Sa as We,Ta as Ge}from"./chunk-Y5LB56KB.js";import{j as ht,l as ae}from"./chunk-KKKMX6LH.js";import{createContext as Sn,useContext as Nt,useEffect as vn,useMemo as Ce,useState as _t}from"react";function Pt(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function se(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 Ke=4,Hr=1,Br={unit:"set",spares:0,spareSide:"left"};function wt(e){return e.unit==="single"?1:Ke+e.spares}function qr(e,t){return[{partNumber:e.partNumber,wheels:wt(t),prices:e.prices}]}function Wr(e,t){let n=wt(t)-Ke;if(n<=0||e.length===0)return e;let r=bn(e),o=r?r[t.spareSide]:0;return e.map((i,s)=>s===o?{...i,wheels:i.wheels+n}:i)}function bn(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 Cn(e,t){return t.spares>0?`${e} + spare`:e}function Gr(e){return e.unit==="single"?"Single":Cn(`Set of ${Ke}`,e)}var Kr="data-add-to-basket",ze=9,xn="en",Et=new Map;function Le(e,t,n){let r=`${e}|${t??""}|${n??""}`,o=Et.get(r);return o||(o=new Intl.NumberFormat(xn,{style:"currency",currency:e,...t===void 0?{}:{minimumFractionDigits:t},...n===void 0?{}:{maximumFractionDigits:n}}),Et.set(r,o)),o}function be(e,t,n=0){return Le(t,0,n).format(e)}function zr(e,t){return Le(t).format(e)}import{jsx as _n}from"react/jsx-runtime";var En="storefront-country",Rt=En,Xe=Sn(null);function Pn(e){return Lt(e,"catalogue")}function wn(e){return Lt(e,"money")}function Lt(e,t){let n=new Map(e.map(r=>[r.code,r.decimalPlaces]));return(r,o)=>{if(!o)return"";let i=n.get(o)??0;return Le(o,t==="money"?i:0,i).format(r)}}function jr({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=Ce(()=>t??[],[t]),s=Ce(()=>n??[],[n]),l=Ce(()=>r||i.find(p=>p.isDefault)?.code||i[0]?.code||"",[r,i]),u=Ce(()=>o||s.find(p=>p.isDefault)?.code||s[0]?.code||"",[o,s]),[c,f]=_t(u),[C,d]=_t(!1);vn(()=>{let p=ae.getItem(Rt);p&&s.some(M=>M.code===p)&&f(p),d(!0)},[s]);function w(p){f(p),ae.setItem(Rt,p)}let E=Ce(()=>{let p=s.find(R=>R.code===c)??null,M=p?.currency,L=M&&i.some(R=>R.code===M)?M:l,F=Pn(i),_=wn(i);return{country:c,currency:L,setCountry:w,currencies:i,countries:s,activeCountry:p,formatPrice:(R,h)=>F(R,h??L),formatMoney:(R,h)=>_(R,h??L),ready:C}},[c,i,s,l,C]);return _n(Xe.Provider,{value:E,children:e})}function kt(){let e=Nt(Xe);if(!e)throw new Error("useCurrency must be used within a CurrencyProvider");return e}function Zr(){return Nt(Xe)?.country??""}import{createContext as Bn,useCallback as v,useContext as qn,useEffect as V,useMemo as Gt,useRef as le,useState as N}from"react";function It(){return"/edit"}function Tt(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var Ot="We'll confirm this discount when you place your order.",ro="Confirmed at checkout";function oo(e){return e&&(e.valid||e.deferred)?e.code:void 0}var At="coupon_code: ";function io(e){return!(e instanceof ye)||e.status!==400||!e.message.startsWith(At)?null:e.message.slice(At.length)}function Mt(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 ke="Price on request",Nn="Request a quote",Ln="from ",uo="From ",co="each",Dt="Free";function Ve(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Ye(e,t){let n=e?.[t];return Ve(n)?n:null}function fo(e,t,n,r){let o=Ye(e,n),i=Ye(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function po(e,t,n,r){if(n==null&&r==null)return!0;let o=Ye(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var kn={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function In(e,t,n){if(!Ve(e))return kn;let r=Ve(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function mo(e,t,n=""){return!e.priced||e.unit==null?ke:`${n}${be(e.unit,t)}`}function go(e,t){return e.was==null?null:be(e.was,t)}function An(e,t,n=1){let r=se(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((s,l)=>s+l.wheels,0),i=Math.min(...e.map(s=>s.prices[t]));return{priced:!0,unit:i,isFrom:i*o!==r,setTotal:r*n}}var Tn={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function ho(e,t,n,r=1){let o=In(e.prices[n],e.msrpPrices?.[n],4),i=o.setTotal==null?null:o.setTotal*r;if(!t)return{priced:o.priced,unit:o.unit,isFrom:!0,was:o.was,onSale:o.onSale,setTotal:null,fromSetTotal:i};let s=An(t.components,n,r);return s.priced?{priced:!0,unit:s.unit,isFrom:s.isFrom,was:null,onSale:!1,setTotal:s.setTotal,fromSetTotal:i}:{...Tn,fromSetTotal:i}}function On(e,t){return!e.priced||e.unit==null?ke:`${e.isFrom?Ln:""}${be(e.unit,t)}`}function yo(e,t){return e.was==null?null:be(e.was,t)}function bo(e,t){return!e.priced||e.unit==null?Nn:On(e,t)}var Mn=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function Ft(e){return Mn.test(e.trim())}var Ut="sf:ga-purchases",Dn=20;function Ht(){return typeof window>"u"||window.parent!==window}function xe(...e){try{if(Ht()||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:se(e.components,t)??0,quantity:e.qty}}function Qe(e,t){return e.filter(Ie).map(n=>Fn(n,t))}function Po(e){xe("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 Bt(e,t){let n=Qe([e],t);n.length!==0&&xe("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function wo(e){let t=Qe(e.lines,e.currency);t.length!==0&&xe("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var $t=new Set;function Un(e){if($t.has(e))return!1;$t.add(e);try{let t=JSON.parse(ae.getItem(Ut)??"[]");if(t.includes(e))return!1;ae.setItem(Ut,JSON.stringify([...t,e].slice(-Dn)))}catch{}return!0}function _o(e){let t=e.confirmation;if(Ht()||!Un(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);xe("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:Qe(e.lines,n)}),e.adsSendTo&&xe("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var $n="Arranged after review",qt="Calculated at checkout",Hn=qt,Lo=qt;function Wt({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function ko(e){switch(e){case"arranged":return $n;case"pending":return Hn;case"free":return Dt;case"charged":return null}}import{jsx as zn}from"react/jsx-runtime";var Wn=400,Gn=400,Kn=1500;function Ie(e){return(e.components?.length??0)>0}function Kt(e,t){return{code:e,valid:t.valid,deferred:Tt(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function Xt(e,t){return se(e.components,t)}function je(e,t){let n=Xt(e,t);return n===null?null:n*e.qty}function zt(e){return e!=="tyre"}var Vt=Bn(null);function Wo({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=kt(),[i,s]=N(t),[l,u]=N([]),[c,f]=N([]),[C,d]=N([]),[w,E]=N(!1),[p,M]=N(!1),[L,F]=N(!1),[_,R]=N(!1),[h,$]=N(null),[j,U]=N(0),b=v(()=>U(a=>a+1),[]),[P,x]=N(void 0),[K,Ue]=N(null),[S,A]=N(null),[ue,ee]=N(!1),[T,ce]=N(null),Z=le(void 0),H=v(()=>s(!0),[]),te=v(()=>s(!1),[]),B=v(()=>s(a=>!a),[]);V(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&H()},[H,t]);let ne=It(),D=le(ne);V(()=>{D.current!==ne&&(D.current=ne,t||te())},[ne,t,te]);let we=v(a=>{Ue(m=>m?.country===a?.country&&m?.subdivision===a?.subdivision&&m?.postcode===a?.postcode?m:a)},[]),re=v(a=>{R(!0),zt(a)&&F(!0)},[]),de=L||l.some(a=>zt(a.kind)),fe=_||l.length>0;V(()=>{if(t||!de||w)return;let a=!0;return G.listWheels().then(m=>{a&&(f(m),E(!0))}),()=>{a=!1}},[t,de,w]),V(()=>{if(t||!fe||p)return;let a=!0;return G.listBundles().then(m=>{a&&(d(m),M(!0))}),()=>{a=!1}},[t,fe,p]);let q=h?.deliveryOptions??[],pe=h?.courier??null;V(()=>{h&&ce(a=>a&&q.some(m=>m.id===a)?a:q[0]?.id??null)},[h]);let X=v(()=>l.filter(Ie).flatMap(a=>Pt(a.components,a.qty)),[l]),_e=v(async(a,m)=>{let y=a.trim().toUpperCase();if(!y)return;let g=X();if(g.length===0){A({code:y,valid:!1,message:"Add a wheel to the cart first."});return}ee(!0),Z.current=m;try{let I=await G.validateCoupon({code:y,items:g,currency:n,shippingMethodId:T??void 0,customerEmail:m});A(Kt(y,I))}catch{A({code:y,valid:!1,unchecked:!0,message:"Could not check that code. Please try again."})}finally{ee(!1)}},[X,n,T]),Re=v(()=>{A(null),Z.current=void 0},[]),k=v(a=>{if(!S)return;let{code:m}=S;A(y=>y&&y.code===m?{code:m,valid:!1,refused:!0,message:a}:y)},[S]);V(()=>{if(!S||S.refused)return;let a=S.code,m=g=>g!==null&&g.code===a&&!g.refused,y=setTimeout(async()=>{let g=X();if(g.length===0){A(I=>m(I)?{code:a,valid:!1,message:"Add a wheel to the cart first."}:I);return}ee(!0);try{let I=await G.validateCoupon({code:a,items:g,currency:n,shippingMethodId:T??void 0,customerEmail:Z.current});A(ge=>m(ge)?Kt(a,I):ge)}catch{}finally{ee(!1)}},Wn);return()=>clearTimeout(y)},[l,n,T]);let z=S&&!S.refused?S.code:void 0;V(()=>{if(t)return;let a=!0,m=setTimeout(async()=>{let y=X();if(y.length===0){$(null),x(void 0);return}try{let g=await G.quoteCart({items:y,currency:n,shippingMethodId:T??void 0,couponCode:z,customerEmail:Z.current||void 0,country:K?.country||r||void 0,subdivision:K?.country&&K.subdivision||void 0,postcode:K?.country&&K.postcode||void 0});if(!a)return;$(g)}catch{if(!a)return}x(z)},Gn);return()=>{a=!1,clearTimeout(m)}},[l,n,T,z,r,K,j]);let oe=v(a=>{u(m=>{let y=m.findIndex(g=>g.id===a.id);return y===-1?[...m,a]:m.map((g,I)=>I===y?{...g,qty:Math.min(ze,g.qty+a.qty)}:g)}),Bt(a,n)},[n]),ot=v(a=>{u(m=>m.filter(y=>y.id!==a))},[]),it=v((a,m)=>{let y=Math.max(1,Math.min(ze,m));u(g=>g.map(I=>I.id===a?{...I,qty:y}:I))},[]),at=v(a=>{u(a)},[]),[me,dn]=N(null),st=le(null);st.current=me;let W=le(null),$e=le(""),lt=v((a,m)=>{let y=a.trim().toLowerCase();Ft(y)&&dn(g=>g&&g.email===y&&g.firstName===(m??"")?g:{email:y,firstName:m??""})},[]);V(()=>{if(t||!me)return;let a=Mt(l.filter(Ie),g=>je(g,n)===null?ke:o(je(g,n),n)),m={email:me.email,firstName:me.firstName,currency:n,items:a},y=JSON.stringify(m);if(y!==$e.current)return W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{W.current=null,$e.current=y,G.captureCart(m).catch(g=>{})},Kn),()=>{W.current&&(clearTimeout(W.current),W.current=null)}},[l,me,n,t]);let ut=v(()=>{W.current&&(clearTimeout(W.current),W.current=null);let a=st.current;a&&($e.current="",G.captureCart({email:a.email,firstName:a.firstName,currency:n,items:[]}).catch(m=>{}))},[n]),ct=Gt(()=>{let a=l.reduce((O,ie)=>{let Ne=je(ie,n);return Ne===null?O:O+Ne},0),m=l.some(O=>Xt(O,n)===null),y=l.reduce((O,ie)=>O+ie.qty,0),g=S?.valid?S.effects:void 0,I=g?Math.min(a,Number(g.discountAmount)):0,ge=h?.bundleDiscount??0,pn=h?.appliedBundles??[],He=!!g?.freeShipping,mt=q.find(O=>O.id===T),gt=He?0:h?.shipping??mt?.amount??0,mn=Wt({quoted:h!==null,optionCount:q.length,chosenAmount:mt?.amount,couponWaivesFreight:He}),Be={};for(let O of g?.freeUnits??[])Be[O.partNumber]=(Be[O.partNumber]??0)+O.quantity;let gn=h?.tax??null,hn=h?h.grandTotal:a-I-ge+gt;return{sets:y,units:l.reduce((O,ie)=>O+(ie.components??[]).reduce((Ne,yn)=>Ne+yn.wheels*ie.qty,0),0),subtotal:a,hasUnpricedLine:m,discount:I,bundleDiscount:ge,appliedBundles:pn,shipping:gt,freeShipping:He,shippingStatus:mn,freeUnitsByPartNumber:Be,tax:gn,grand:hn,repricing:!!S?.refused&&h!==null&&P===S?.code,currency:n}},[l,n,S,q,T,h,P]),dt=le(!0),ft=v(a=>{dt.current=a},[]),pt=v(a=>{oe(a),dt.current&&H()},[oe,H]),fn=Gt(()=>({isOpen:i,preview:t,open:H,close:te,toggle:B,items:l,catalog:c,bundles:C,warmCatalog:re,add:oe,addAndOpen:pt,setAutoOpen:ft,remove:ot,setQty:it,replaceItems:at,identify:lt,clearCapturedCart:ut,coupon:S,applyCoupon:_e,removeCoupon:Re,refuseCoupon:k,couponBusy:ue,deliveryOptions:q,setQuoteDestination:we,courier:pe,requote:b,shippingMethodId:T,setShippingMethodId:ce,totals:ct}),[i,t,H,te,B,l,c,C,re,oe,pt,ft,ot,it,at,lt,ut,S,_e,Re,k,ue,q,we,pe,b,T,ct]);return zn(Vt.Provider,{value:fn,children:e})}function Yt(){let e=qn(Vt);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as rr}from"react";function Qt(e,t,n,r){for(;e.size>=t;){let o,i;for(let[l,u]of e){if(u.expiresAt<=r){o=l;break}i===void 0&&n(l)&&(i=l)}let s=o??i??e.keys().next().value;if(s===void 0)return;e.delete(s)}}var Xn=6e4,Vn=5e3,Yn=500,Ae=new Map;async function Qn(e){let{host:t,matchesRequestHost:n}=await xt();if(!t)return"";let r=await St();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}var jn=e=>e.includes("|slug:")||e.includes("|xhost:");async function jt(e,t){if(await vt()!==null)return t();let n=await Qn(e);if(!n)return t();let r=Date.now(),o=Ae.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),s=i.outcome.state==="failed",l=s?Vn:Xn,u=Ae.get(n)?.lastGood,c=i.outcome.state==="ok"?i:s?u:void 0,f=s&&c?c:i;return Qt(Ae,Yn,jn,r),Ae.set(n,{load:f,expiresAt:r+l,lastGood:c}),f}var Zn=404;function Jn(e){if(e instanceof ye&&e.status===Zn)return{state:"absent"};let t=e instanceof ye?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var er="[storefront:chrome-load-failed]";function tr(e,t){console.error(`${er} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function Zt(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=Jn(o);return i.state==="failed"&&tr(e,i),{value:n,outcome:i}}}function nr(e){return e==="production"?"silent":"banner"}var jo=nr("production");function or(e,t){return e?.trim()||t}function ii({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=or(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var ir={name:he,legalName:null,foundedYear:null,faviconUrl:null,currencies:[],defaultCurrency:null,countries:[],defaultCountry:null,commerceEnabled:!0,cardPayments:!1,paymentMethods:[],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,socialLinks:qe},ai=rr(async()=>jt("site",()=>Zt("site",async()=>{let e=await G.getSite();return{name:yt(e.name),legalName:e.legalName?.trim()||null,foundedYear:e.foundedYear??null,faviconUrl:e.faviconUrl??null,currencies:e.currencies??[],defaultCurrency:e.defaultCurrency??null,countries:e.countries??[],defaultCountry:e.defaultCountry??null,commerceEnabled:e.commerceEnabled??!0,cardPayments:e.cardPayments??!1,paymentMethods:e.paymentMethods??(e.cardPayments?["card"]:[]),paypalClientId:e.paypalClientId??null,paypalEnvironment:e.paypalEnvironment??null,squareApplicationId:e.squareApplicationId??null,squareLocationId:e.squareLocationId??null,squareEnvironment:e.squareEnvironment??null,ga4MeasurementId:e.ga4MeasurementId??null,googleAdsId:e.googleAdsId??null,googleAdsConversionLabel:(e.googleAdsId?e.googleAdsConversionLabel:null)??null,metaPixelId:e.metaPixelId??null,consentEnabled:e.consentEnabled??!1,consentPrivacyPage:e.consentPrivacyPage??null,consentNoticeOptOut:e.consentNoticeOptOut??!1,socialLinks:bt(e.socialLinks)}},ir)));var si={name:he,legalName:null,foundedYear:null,faviconUrl:null,currencies:[{code:"USD",symbol:"$",decimalPlaces:2,isDefault:!0}],defaultCurrency:"USD",countries:[{code:"US",name:"United States",currency:"USD",url:"",isDefault:!0,chargeTax:!1,taxDisplay:"none",taxName:"",taxRate:null,postalLabel:"Zip Code"}],defaultCountry:"US",commerceEnabled:!0,cardPayments:!0,paymentMethods:["card"],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,socialLinks:qe};import{jsx as ve,jsxs as Ze}from"react/jsx-runtime";import{useEffect as Te,useId as ur,useRef as en,useState as Oe}from"react";import{useRootIsDark as cr}from"efficient-shell/theme";import{efficientClientOpen as ar}from"efficient-easel/screen/lib/session";var Se=new Map,sr=64;async function lr(e){if(!ar())return null;try{let t=await fetch(`${ht()}/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 Jt(e){let t=Se.get(e);if(t)return t;let n=lr(e);if(Se.set(e,n),Se.size>sr){let r=Se.keys().next();r.done||Se.delete(r.value)}return n}var dr=202/22,fr=.88,Ei=16,pr="invert(1)";function Pi({variant:e="header",scrolled:t=!0,src:n,reverse:r=!1,color:o=null,onLightSurface:i,reversedSrc:s,inkIsDark:l,size:u="medium",sizePx:c,wordmark:f,siteName:C=he,fitToContainer:d=!1,fitWordmarkToContainer:w=!1,fitFloorPx:E}){let p=f&&f.trim()?f.trim():C,[M,L]=Oe(null),F=en(null),_=k=>{F.current=k};Te(()=>{L(F.current?.ownerDocument??null)},[]);let R=!cr({doc:M,whenUnset:!0}),h=n&&n.trim()?n.trim():null,$=!!h&&Ct(h),j=i??(R&&t),U=o&&o.trim()?o.trim():null,b=r&&!U,P=`logo-color-${ur().replace(/[^A-Za-z0-9_-]/g,"")}`,x=b&&$&&h&&s!=null?{reversed:s,inkIsDark:l??null}:null,K=x!==null,[Ue,S]=Oe(null);Te(()=>{if(!b||!h||!$||K){S(null);return}let k=!1;return S(null),Jt(h).then(z=>{k||S(z)}),()=>{k=!0}},[b,h,$,K]);let A=x??Ue,ue=!!A&&A.inkIsDark!==null&&(j?!A.inkIsDark:A.inkIsDark),ee=b&&!!h&&!$&&!j,T=ue&&A?A.reversed:h,ce=T?[T]:[],[Z,H]=Oe(0);Te(()=>{H(0)},[h,ue]);let te=e==="footer"?Ge:We[u],B=c&&c>0?c:te,ne=Math.round(B*dr),D=Z<ce.length?ce[Z]:null,[we,re]=Oe(T),de=D!==null&&D===we,fe=en(null);Te(()=>{let k=fe.current;if(!k||!k.complete)return;if(k.naturalWidth>0||k.naturalHeight>0){re(D);return}let z=!1;return k.decode().then(()=>!z&&re(D),()=>!z&&H(oe=>oe+1)),()=>{z=!0}},[D]);let q=d||w,pe=`calc(100cqi / ${((p.length+1)*fr).toFixed(2)})`,X=q&&E&&E>0?Math.min(E,B):null,_e=q?X===null?`min(${B}px, ${pe})`:`clamp(${X}px, ${pe}, ${B}px)`:`${B}px`,Re=Ze("span",{className:`font-display font-bold tracking-[0.18em] ${X===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:_e,lineHeight:1,...U?{color:U}:{}},"aria-label":p,children:[p,ve("span",{className:"text-accent",style:U?{color:U}:void 0,children:"."})]});return Ze("span",{ref:_,className:"inline-flex items-center",children:[!de&&Re,U&&D&&ve("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:Ze("filter",{id:P,colorInterpolationFilters:"sRGB",children:[ve("feFlood",{style:{floodColor:U}}),ve("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),D&&ve("img",{ref:fe,src:D,alt:p,width:ne,height:B,className:"shrink-0 object-contain",style:{...de?{height:`${B}px`,width:"auto",...d?{maxWidth:"100cqi"}:{}}:{display:"none"},...ee?{filter:pr}:{},...U?{filter:`url(#${P})`}:{}},onLoad:()=>re(D),onError:()=>H(k=>k+1)},D)]})}import{jsx as mr}from"react/jsx-runtime";function _i({tone:e="bad",role:t,children:n}){return mr("div",{role:t,className:["border bg-surface px-4 py-3 text-[14px] leading-relaxed text-fg",e==="good"?"border-accent":e==="bad"?"border-alert":"border-line"].join(" "),children:n})}import{jsx as Ee,jsxs as hr}from"react/jsx-runtime";function gr({spokes:e,mesh:t=!1,className:n}){let s=u=>Math.round(u*1e3)/1e3,l=[];for(let u=0;u<e;u++){let c=u/e*Math.PI*2-Math.PI/2;if(l.push({x1:s(100+Math.cos(c)*22),y1:s(100+Math.sin(c)*22),x2:s(100+Math.cos(c)*86),y2:s(100+Math.sin(c)*86),main:!0}),t){let f=c+Math.PI/e;l.push({x1:s(100+Math.cos(f)*22*1.4),y1:s(100+Math.sin(f)*22*1.4),x2:s(100+Math.cos(f)*78),y2:s(100+Math.sin(f)*78),main:!1})}}return hr("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:[Ee("circle",{cx:100,cy:100,r:92,strokeWidth:2}),Ee("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),Ee("circle",{cx:100,cy:100,r:22,strokeWidth:2}),Ee("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),l.map((u,c)=>Ee("line",{x1:u.x1,y1:u.y1,x2:u.x2,y2:u.y2,stroke:"currentColor",strokeWidth:u.main?6:3,strokeLinecap:"round",opacity:u.main?1:.5},c))]})}var Ii="#c9a461",tn=[{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"}],Ai={name:"",color:"var(--fg)",family:"silver",src:""};function yr(e,t){let n=r=>{let o=tn.findIndex(i=>i.f===r);return o===-1?tn.length:o};return n(e)-n(t)||e.localeCompare(t)}function Ti(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(yr)}import{useState as br}from"react";import{jsx as J,jsxs as Je}from"react/jsx-runtime";function Cr({customerEmail:e}){let{coupon:t,applyCoupon:n,removeCoupon:r,couponBusy:o}=Yt(),[i,s]=br("");async function l(){o||!i.trim()||(await n(i,e),s(""))}return Je("div",{className:"flex flex-col gap-2",children:[t===null?Je("div",{className:"flex border border-line",children:[J("input",{type:"text",value:i,onChange:u=>s(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),l())},placeholder:"Coupon code","aria-label":"Coupon code",className:"flex-1 bg-transparent px-4 py-4 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim"}),J("button",{type:"button",onClick:()=>{l()},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"})]}):Je("div",{className:["flex items-center justify-between gap-3 border px-4 py-3",t.valid?"border-accent":"border-line"].join(" "),style:t.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[J("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",t.valid?"text-accent":t.deferred||t.unchecked?"text-fg":"text-fg-dim line-through"].join(" "),children:t.code}),t.unchecked&&J("button",{type:"button",onClick:()=>{n(t.code,e)},disabled:o,className:"ml-auto font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:text-fg disabled:cursor-wait disabled:opacity-60",children:o?"\u2026":"Try again"}),J("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?J("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:Ot}):t&&!t.valid&&t.message&&J("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:t.message})]})}var et="Ads on. Shopper can opt out.",Me="Ads and analytics off until Accept",xr={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:et,footerLink:"Do Not Sell or Share My Personal Information",panelEyebrow:"Do not sell or share",adsRowName:"Sale or sharing for ads"},ca:{region:"ca",name:"Canada",model:"opt-in",law:"PIPEDA, Quebec Law 25",beforeChoice:Me,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:et,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:et,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:Me,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:Me,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:Me,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}};function Sr(e){let t=[...e.googleAds?["Google"]:[],...e.meta?["Facebook","Instagram"]:[]];return t.length<=1?t.join(""):`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function Hi(e,t,n){let r=Sr(n),o=r?`We use cookies to count visits and to show you ${t} ads on ${r}.`:"We use cookies to count visits.";return e.model==="opt-in"?{heading:r?"Cookies and ads":"Cookies",before:`${o} Nothing loads until you choose. You can change this at any time with `,link:e.footerLink,after:" at the bottom of every page."}:{heading:r?"Cookies and ads":"Cookies",before:`${o} You can say no at any time: choose Privacy choices, or use `,link:e.footerLink,after:" at the bottom of every page."}}var Bi={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on"};var vr={asked:!1,region:"other",model:"opt-in",analytics:!0,ads:!0,chosen:!0,gpc:!1};var Er=vr;function Ki(e=Er){if(e.asked)return e.ads?"granted":"denied"}function Xi(){let e=typeof crypto<"u"?crypto:void 0;if(typeof e?.randomUUID=="function")return e.randomUUID();let t=new Uint8Array(16);if(typeof e?.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}import{Children as wr,isValidElement as _r,useEffect as rn,useId as Rr,useLayoutEffect as sn,useRef as Y,useState as on}from"react";var De=(e,t)=>!!e[t]&&!e[t].disabled;function tt(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(De(e,i))return i}return t}function nt(e,t){return tt(e,t===1?-1:e.length,t)}function rt(e,t){return De(e,t)?t:Math.max(nt(e,1),0)}function nn(e,t,n){let{open:r,focus:o}=e,i=s=>({...e,...s});if(t.length===1&&/\S/.test(t)){let s=e.typed+t.toLowerCase(),l=n.findIndex((u,c)=>De(n,c)&&u.label.toLowerCase().startsWith(s));return{state:i({open:!0,typed:s,focus:l>=0?l: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:tt(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:tt(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:nt(n,1)}),handled:!0};case"End":return{state:i({focus:nt(n,-1)}),handled:!0};case"Enter":case" ":return De(n,o)?{state:i({open:!1,typed:""}),commit:o,refocus:!0,handled:!0}:{state:e,handled:!0};case"Escape":return{state:i({open:!1,typed:""}),refocus:!0,handled:!0};case"Tab":return{state:i({open:!1,typed:""}),handled:!1};default:return{state:e,handled:!1}}}import{placeMenu as Nr}from"efficient-shell/ui";import{Fragment as Mr,jsx as Q,jsxs as ln}from"react/jsx-runtime";var an={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function Lr({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[s,l]=on(!1),u=r!==void 0,c=u?r:s,[f,C]=on(0),d=Y({text:"",timer:0}),w=Y(null),E=Y(null),p=Y(null),M=Rr(),L=Y(null),F=e.findIndex(b=>b.value===t),_=b=>{b!==c&&(u||l(b),b?o?.():i?.())},R=b=>{let P=e[b];!P||P.disabled||(n(P.value),_(!1),E.current?.focus())},h=b=>{let P={open:c,focus:c?f:rt(e,F),typed:d.current.text},x=nn(P,b,e);return!x.handled&&x.state.open===c?!1:(x.state.typed!==P.typed&&(d.current.text=x.state.typed,window.clearTimeout(d.current.timer),d.current.timer=window.setTimeout(()=>{d.current.text=""},500)),C(x.state.focus),x.commit!==void 0?R(x.commit):_(x.state.open),x.refocus&&E.current?.focus(),x.handled)},$=Y(h);$.current=h;let j=Y(()=>_(!1));j.current=()=>_(!1);let U=b=>{c||(L.current=b.nativeEvent,$.current(b.key)&&b.preventDefault())};return rn(()=>{if(!c)return;let b=x=>{w.current?.contains(x.target)||j.current()},P=x=>{x!==L.current&&$.current(x.key)&&x.preventDefault()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",P)}},[c]),rn(()=>{c&&(d.current.text||C(rt(e,F)))},[c]),sn(()=>{if(!c||!p.current)return;p.current.children.item(f)?.scrollIntoView({block:"nearest"})},[f,c]),{open:c,toggle:()=>_(!c),close:()=>_(!1),focusIdx:f,setFocusIdx:C,pick:b=>R(e.findIndex(P=>P.value===b)),wrapRef:w,triggerRef:E,listRef:p,listId:M,onTriggerKeyDown:U,activeId:c?`${M}-${f}`:void 0}}var kr={select:{list:"absolute left-0 top-full z-50 mt-1 max-h-[280px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:(e,t,n)=>["px-3 py-3 font-mono text-[13px] font-semibold uppercase tracking-[0.1em] transition-colors whitespace-nowrap",n?"cursor-not-allowed opacity-40":"cursor-pointer",e&&!n?"bg-accent text-bg":"bg-bg text-fg"].join(" ")},cell:{list:"absolute left-0 top-full z-50 mt-1 max-h-[320px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:e=>[`cursor-pointer whitespace-nowrap px-6 py-3 font-mono ${an.label} font-semibold uppercase tracking-[0.1em] transition-colors`,e?"bg-accent text-bg":"bg-bg text-fg"].join(" "),pickerMarker:!0},hairline:{list:"absolute left-0 top-full z-50 max-h-[320px] w-full overflow-y-auto border border-line bg-bg shadow-[0_6px_20px_rgba(0,0,0,0.10)]",item:(e,t)=>[`flex cursor-pointer items-center justify-between gap-4 border-b border-line px-4 py-3 text-left ${an.body} transition-colors last:border-b-0`,t?"border-fg font-medium text-fg":e?"border-fg text-fg":"text-fg-dim"].join(" "),pickerMarker:!0},region:{list:"absolute right-0 top-full z-[200] mt-2 flex min-w-[240px] flex-col border border-line bg-surface text-fg",item:(e,t,n,r)=>["flex w-full cursor-pointer items-center gap-3 px-4 py-3 text-left transition-colors","font-mono text-[13px] uppercase tracking-[0.18em]",e?"bg-surface-2 text-fg":"",r?"":"border-b border-line",t?"text-accent":""].join(" "),itemStyle:e=>e?void 0:{color:"color-mix(in oklab, currentColor 80%, transparent)"}}};function Ir(e,t){sn(()=>{let n=e.current,r=n?.ownerDocument.defaultView;if(!n||!r)return;let o=()=>{let i=n.style;i.top=i.bottom=i.marginTop=i.marginBottom=i.maxHeight=i.overflowY=i.translate="";let s=n.offsetParent??n.parentElement;if(!s)return;let l=s.getBoundingClientRect(),u=n.getBoundingClientRect(),c=Math.abs(u.right-l.right)<Math.abs(u.left-l.left)?"end":"start",f=Nr({trigger:{left:l.left,right:l.right,top:l.top,bottom:l.bottom},menu:{width:u.width,height:u.height},bounds:{left:0,top:0,right:r.innerWidth,bottom:r.innerHeight},align:c,side:"bottom"});if(f.side==="top"){i.top="auto",i.bottom="100%",i.marginTop="0px";let d=f.top+Math.min(u.height,f.maxHeight);i.marginBottom=`${Math.max(0,l.top-d)}px`}f.maxHeight<u.height&&(i.maxHeight=`${f.maxHeight}px`,i.overflowY="auto");let C=f.left-u.left;C&&(i.translate=`${C}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function Ar(e){return e.split(" ").map(t=>t==="left-0"?"right-0":t).join(" ")}function Tr({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:s,listRef:l,ariaLabel:u,align:c="start"}){let f=kr[t],C=Y(null);return Ir(C,n.length),Q("ul",{ref:d=>{C.current=d,l&&(l.current=d)},id:e,role:"listbox","aria-label":u,...f.pickerMarker?{"data-picker-menu":""}:{},className:c==="end"?Ar(f.list):f.list,children:n.map((d,w)=>{let E=d.value===r;return Q("li",{id:`${e}-${w}`,role:"option","aria-selected":E,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(w),onMouseDown:p=>{p.preventDefault(),d.disabled||s(d.value)},className:f.item(w===o,E&&d.value!=="",!!d.disabled,w===n.length-1),style:f.itemStyle?.(E),children:d.meta===void 0?d.label:ln(Mr,{children:[d.lead,Q("span",{className:"flex-1 whitespace-nowrap",children:d.label}),Q("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${w}`)})})}function Or({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:s,id:l,"aria-label":u,align:c}){let f=wr.toArray(r).flatMap(p=>{if(!_r(p))return[];if(p.type!=="option")return[];let L=p.props,F=L.value!==void 0?String(L.value):"",_=L.children,R=typeof _=="string"||typeof _=="number"?String(_):F;return[{value:F,label:R,disabled:!!L.disabled}]}),C=e??"",d=Lr({items:f,value:C,onPick:p=>t?.({target:{value:p}})}),E=f.find(p=>p.value===C)?.label??f[0]?.label??"";return ln("div",{ref:d.wrapRef,className:"relative",children:[s&&Q("input",{type:"hidden",name:s,value:C}),Q("button",{ref:p=>{d.triggerRef.current=p},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":d.open,"aria-controls":d.open?d.listId:void 0,"aria-activedescendant":d.activeId,"aria-label":u,id:l,onClick:()=>!n&&d.toggle(),onKeyDown:p=>!n&&d.onTriggerKeyDown(p),className:`block w-full ${o??""}`,style:i,children:Q("span",{className:"block w-full truncate text-left",children:E})}),d.open&&Q(Tr,{id:d.listId,tone:"select",items:f,value:C,focusIdx:d.focusIdx,onFocus:d.setFocusIdx,onPick:d.pick,listRef:d.listRef,align:c})]})}import{jsx as Pe,jsxs as Fe}from"react/jsx-runtime";var Dr="font-mono text-[length:var(--size-label,12px)]",Fr="font-semibold uppercase tracking-[0.22em] text-fg";function un(e){return`${e??Dr} ${Fr}`}function cn(){return Pe("span",{className:"text-accent",children:" *"})}function Ur({children:e,required:t,labelFace:n}){return Fe("span",{className:un(n),children:[e,t?Pe(cn,{}):null]})}function $r({label:e,required:t,hint:n,separate:r,htmlFor:o,labelFace:i,className:s,children:l}){let u=s?`flex flex-col gap-2 ${s}`:"flex flex-col gap-2",c=n?Pe("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?Fe("div",{className:u,children:[Fe("label",{htmlFor:o,className:un(i),children:[e,t?Pe(cn,{}):null]}),l,c]}):Fe("label",{htmlFor:o,className:u,children:[Pe(Ur,{required:t,labelFace:i,children:e}),l]})}var ia="w-full border-2 border-line bg-bg px-4 py-4 font-display text-[17px] tracking-[-0.005em] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent";export{It as a,ro as b,oo as c,io as d,Pt as e,Ke as f,Hr as g,Br as h,qr as i,Wr as j,bn as k,Cn as l,Gr as m,Kr as n,ze as o,Le as p,be as q,zr as r,ke as s,Nn as t,Ln as u,uo as v,co as w,Dt as x,Ye as y,fo as z,po as A,In as B,mo as C,go as D,An as E,ho as F,On as G,yo as H,bo as I,Ft as J,Po as K,wo as L,_o as M,Lo as N,ko as O,jr as P,kt as Q,Zr as R,Ie as S,je as T,Wo as U,Yt as V,ii as W,ir as X,si as Y,Ei as Z,Pi as _,gr as $,Ii as aa,tn as ba,Ai as ca,yr as da,Ti as ea,Cr as fa,_i as ga,xr as ha,Hi as ia,Bi as ja,vr as ka,Ki as la,Xi as ma,Lr as na,Tr as oa,Or as pa,Ur as qa,$r as ra,ia as sa};
1
+ import{f as Ct,i as ye,q as xt,s as St,t as vt,v as G}from"./chunk-TGBNREUJ.js";import{Ka as he,La as yt,Oa as qe,Pa as bt,Sa as We,Ta as Ge}from"./chunk-EUKK2IN6.js";import{j as ht,l as ae}from"./chunk-ALMIS7CK.js";import{createContext as Sn,useContext as Nt,useEffect as vn,useMemo as Ce,useState as _t}from"react";function Pt(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function se(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 Ke=4,Hr=1,Br={unit:"set",spares:0,spareSide:"left"};function wt(e){return e.unit==="single"?1:Ke+e.spares}function qr(e,t){return[{partNumber:e.partNumber,wheels:wt(t),prices:e.prices}]}function Wr(e,t){let n=wt(t)-Ke;if(n<=0||e.length===0)return e;let r=bn(e),o=r?r[t.spareSide]:0;return e.map((i,s)=>s===o?{...i,wheels:i.wheels+n}:i)}function bn(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 Cn(e,t){return t.spares>0?`${e} + spare`:e}function Gr(e){return e.unit==="single"?"Single":Cn(`Set of ${Ke}`,e)}var Kr="data-add-to-basket",ze=9,xn="en",Et=new Map;function Le(e,t,n){let r=`${e}|${t??""}|${n??""}`,o=Et.get(r);return o||(o=new Intl.NumberFormat(xn,{style:"currency",currency:e,...t===void 0?{}:{minimumFractionDigits:t},...n===void 0?{}:{maximumFractionDigits:n}}),Et.set(r,o)),o}function be(e,t,n=0){return Le(t,0,n).format(e)}function zr(e,t){return Le(t).format(e)}import{jsx as _n}from"react/jsx-runtime";var En="storefront-country",Rt=En,Xe=Sn(null);function Pn(e){return Lt(e,"catalogue")}function wn(e){return Lt(e,"money")}function Lt(e,t){let n=new Map(e.map(r=>[r.code,r.decimalPlaces]));return(r,o)=>{if(!o)return"";let i=n.get(o)??0;return Le(o,t==="money"?i:0,i).format(r)}}function jr({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=Ce(()=>t??[],[t]),s=Ce(()=>n??[],[n]),l=Ce(()=>r||i.find(p=>p.isDefault)?.code||i[0]?.code||"",[r,i]),u=Ce(()=>o||s.find(p=>p.isDefault)?.code||s[0]?.code||"",[o,s]),[c,f]=_t(u),[C,d]=_t(!1);vn(()=>{let p=ae.getItem(Rt);p&&s.some(M=>M.code===p)&&f(p),d(!0)},[s]);function w(p){f(p),ae.setItem(Rt,p)}let E=Ce(()=>{let p=s.find(R=>R.code===c)??null,M=p?.currency,L=M&&i.some(R=>R.code===M)?M:l,F=Pn(i),_=wn(i);return{country:c,currency:L,setCountry:w,currencies:i,countries:s,activeCountry:p,formatPrice:(R,h)=>F(R,h??L),formatMoney:(R,h)=>_(R,h??L),ready:C}},[c,i,s,l,C]);return _n(Xe.Provider,{value:E,children:e})}function kt(){let e=Nt(Xe);if(!e)throw new Error("useCurrency must be used within a CurrencyProvider");return e}function Zr(){return Nt(Xe)?.country??""}import{createContext as Bn,useCallback as v,useContext as qn,useEffect as V,useMemo as Gt,useRef as le,useState as N}from"react";function It(){return"/edit"}function Tt(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var Ot="We'll confirm this discount when you place your order.",ro="Confirmed at checkout";function oo(e){return e&&(e.valid||e.deferred)?e.code:void 0}var At="coupon_code: ";function io(e){return!(e instanceof ye)||e.status!==400||!e.message.startsWith(At)?null:e.message.slice(At.length)}function Mt(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 ke="Price on request",Nn="Request a quote",Ln="from ",uo="From ",co="each",Dt="Free";function Ve(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Ye(e,t){let n=e?.[t];return Ve(n)?n:null}function fo(e,t,n,r){let o=Ye(e,n),i=Ye(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function po(e,t,n,r){if(n==null&&r==null)return!0;let o=Ye(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var kn={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function In(e,t,n){if(!Ve(e))return kn;let r=Ve(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function mo(e,t,n=""){return!e.priced||e.unit==null?ke:`${n}${be(e.unit,t)}`}function go(e,t){return e.was==null?null:be(e.was,t)}function An(e,t,n=1){let r=se(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((s,l)=>s+l.wheels,0),i=Math.min(...e.map(s=>s.prices[t]));return{priced:!0,unit:i,isFrom:i*o!==r,setTotal:r*n}}var Tn={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function ho(e,t,n,r=1){let o=In(e.prices[n],e.msrpPrices?.[n],4),i=o.setTotal==null?null:o.setTotal*r;if(!t)return{priced:o.priced,unit:o.unit,isFrom:!0,was:o.was,onSale:o.onSale,setTotal:null,fromSetTotal:i};let s=An(t.components,n,r);return s.priced?{priced:!0,unit:s.unit,isFrom:s.isFrom,was:null,onSale:!1,setTotal:s.setTotal,fromSetTotal:i}:{...Tn,fromSetTotal:i}}function On(e,t){return!e.priced||e.unit==null?ke:`${e.isFrom?Ln:""}${be(e.unit,t)}`}function yo(e,t){return e.was==null?null:be(e.was,t)}function bo(e,t){return!e.priced||e.unit==null?Nn:On(e,t)}var Mn=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function Ft(e){return Mn.test(e.trim())}var Ut="sf:ga-purchases",Dn=20;function Ht(){return typeof window>"u"||window.parent!==window}function xe(...e){try{if(Ht()||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:se(e.components,t)??0,quantity:e.qty}}function Qe(e,t){return e.filter(Ie).map(n=>Fn(n,t))}function Po(e){xe("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 Bt(e,t){let n=Qe([e],t);n.length!==0&&xe("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function wo(e){let t=Qe(e.lines,e.currency);t.length!==0&&xe("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var $t=new Set;function Un(e){if($t.has(e))return!1;$t.add(e);try{let t=JSON.parse(ae.getItem(Ut)??"[]");if(t.includes(e))return!1;ae.setItem(Ut,JSON.stringify([...t,e].slice(-Dn)))}catch{}return!0}function _o(e){let t=e.confirmation;if(Ht()||!Un(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);xe("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:Qe(e.lines,n)}),e.adsSendTo&&xe("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var $n="Arranged after review",qt="Calculated at checkout",Hn=qt,Lo=qt;function Wt({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function ko(e){switch(e){case"arranged":return $n;case"pending":return Hn;case"free":return Dt;case"charged":return null}}import{jsx as zn}from"react/jsx-runtime";var Wn=400,Gn=400,Kn=1500;function Ie(e){return(e.components?.length??0)>0}function Kt(e,t){return{code:e,valid:t.valid,deferred:Tt(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function Xt(e,t){return se(e.components,t)}function je(e,t){let n=Xt(e,t);return n===null?null:n*e.qty}function zt(e){return e!=="tyre"}var Vt=Bn(null);function Wo({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=kt(),[i,s]=N(t),[l,u]=N([]),[c,f]=N([]),[C,d]=N([]),[w,E]=N(!1),[p,M]=N(!1),[L,F]=N(!1),[_,R]=N(!1),[h,$]=N(null),[j,U]=N(0),b=v(()=>U(a=>a+1),[]),[P,x]=N(void 0),[K,Ue]=N(null),[S,A]=N(null),[ue,ee]=N(!1),[T,ce]=N(null),Z=le(void 0),H=v(()=>s(!0),[]),te=v(()=>s(!1),[]),B=v(()=>s(a=>!a),[]);V(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&H()},[H,t]);let ne=It(),D=le(ne);V(()=>{D.current!==ne&&(D.current=ne,t||te())},[ne,t,te]);let we=v(a=>{Ue(m=>m?.country===a?.country&&m?.subdivision===a?.subdivision&&m?.postcode===a?.postcode?m:a)},[]),re=v(a=>{R(!0),zt(a)&&F(!0)},[]),de=L||l.some(a=>zt(a.kind)),fe=_||l.length>0;V(()=>{if(t||!de||w)return;let a=!0;return G.listWheels().then(m=>{a&&(f(m),E(!0))}),()=>{a=!1}},[t,de,w]),V(()=>{if(t||!fe||p)return;let a=!0;return G.listBundles().then(m=>{a&&(d(m),M(!0))}),()=>{a=!1}},[t,fe,p]);let q=h?.deliveryOptions??[],pe=h?.courier??null;V(()=>{h&&ce(a=>a&&q.some(m=>m.id===a)?a:q[0]?.id??null)},[h]);let X=v(()=>l.filter(Ie).flatMap(a=>Pt(a.components,a.qty)),[l]),_e=v(async(a,m)=>{let y=a.trim().toUpperCase();if(!y)return;let g=X();if(g.length===0){A({code:y,valid:!1,message:"Add a wheel to the cart first."});return}ee(!0),Z.current=m;try{let I=await G.validateCoupon({code:y,items:g,currency:n,shippingMethodId:T??void 0,customerEmail:m});A(Kt(y,I))}catch{A({code:y,valid:!1,unchecked:!0,message:"Could not check that code. Please try again."})}finally{ee(!1)}},[X,n,T]),Re=v(()=>{A(null),Z.current=void 0},[]),k=v(a=>{if(!S)return;let{code:m}=S;A(y=>y&&y.code===m?{code:m,valid:!1,refused:!0,message:a}:y)},[S]);V(()=>{if(!S||S.refused)return;let a=S.code,m=g=>g!==null&&g.code===a&&!g.refused,y=setTimeout(async()=>{let g=X();if(g.length===0){A(I=>m(I)?{code:a,valid:!1,message:"Add a wheel to the cart first."}:I);return}ee(!0);try{let I=await G.validateCoupon({code:a,items:g,currency:n,shippingMethodId:T??void 0,customerEmail:Z.current});A(ge=>m(ge)?Kt(a,I):ge)}catch{}finally{ee(!1)}},Wn);return()=>clearTimeout(y)},[l,n,T]);let z=S&&!S.refused?S.code:void 0;V(()=>{if(t)return;let a=!0,m=setTimeout(async()=>{let y=X();if(y.length===0){$(null),x(void 0);return}try{let g=await G.quoteCart({items:y,currency:n,shippingMethodId:T??void 0,couponCode:z,customerEmail:Z.current||void 0,country:K?.country||r||void 0,subdivision:K?.country&&K.subdivision||void 0,postcode:K?.country&&K.postcode||void 0});if(!a)return;$(g)}catch{if(!a)return}x(z)},Gn);return()=>{a=!1,clearTimeout(m)}},[l,n,T,z,r,K,j]);let oe=v(a=>{u(m=>{let y=m.findIndex(g=>g.id===a.id);return y===-1?[...m,a]:m.map((g,I)=>I===y?{...g,qty:Math.min(ze,g.qty+a.qty)}:g)}),Bt(a,n)},[n]),ot=v(a=>{u(m=>m.filter(y=>y.id!==a))},[]),it=v((a,m)=>{let y=Math.max(1,Math.min(ze,m));u(g=>g.map(I=>I.id===a?{...I,qty:y}:I))},[]),at=v(a=>{u(a)},[]),[me,dn]=N(null),st=le(null);st.current=me;let W=le(null),$e=le(""),lt=v((a,m)=>{let y=a.trim().toLowerCase();Ft(y)&&dn(g=>g&&g.email===y&&g.firstName===(m??"")?g:{email:y,firstName:m??""})},[]);V(()=>{if(t||!me)return;let a=Mt(l.filter(Ie),g=>je(g,n)===null?ke:o(je(g,n),n)),m={email:me.email,firstName:me.firstName,currency:n,items:a},y=JSON.stringify(m);if(y!==$e.current)return W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{W.current=null,$e.current=y,G.captureCart(m).catch(g=>{})},Kn),()=>{W.current&&(clearTimeout(W.current),W.current=null)}},[l,me,n,t]);let ut=v(()=>{W.current&&(clearTimeout(W.current),W.current=null);let a=st.current;a&&($e.current="",G.captureCart({email:a.email,firstName:a.firstName,currency:n,items:[]}).catch(m=>{}))},[n]),ct=Gt(()=>{let a=l.reduce((O,ie)=>{let Ne=je(ie,n);return Ne===null?O:O+Ne},0),m=l.some(O=>Xt(O,n)===null),y=l.reduce((O,ie)=>O+ie.qty,0),g=S?.valid?S.effects:void 0,I=g?Math.min(a,Number(g.discountAmount)):0,ge=h?.bundleDiscount??0,pn=h?.appliedBundles??[],He=!!g?.freeShipping,mt=q.find(O=>O.id===T),gt=He?0:h?.shipping??mt?.amount??0,mn=Wt({quoted:h!==null,optionCount:q.length,chosenAmount:mt?.amount,couponWaivesFreight:He}),Be={};for(let O of g?.freeUnits??[])Be[O.partNumber]=(Be[O.partNumber]??0)+O.quantity;let gn=h?.tax??null,hn=h?h.grandTotal:a-I-ge+gt;return{sets:y,units:l.reduce((O,ie)=>O+(ie.components??[]).reduce((Ne,yn)=>Ne+yn.wheels*ie.qty,0),0),subtotal:a,hasUnpricedLine:m,discount:I,bundleDiscount:ge,appliedBundles:pn,shipping:gt,freeShipping:He,shippingStatus:mn,freeUnitsByPartNumber:Be,tax:gn,grand:hn,repricing:!!S?.refused&&h!==null&&P===S?.code,currency:n}},[l,n,S,q,T,h,P]),dt=le(!0),ft=v(a=>{dt.current=a},[]),pt=v(a=>{oe(a),dt.current&&H()},[oe,H]),fn=Gt(()=>({isOpen:i,preview:t,open:H,close:te,toggle:B,items:l,catalog:c,bundles:C,warmCatalog:re,add:oe,addAndOpen:pt,setAutoOpen:ft,remove:ot,setQty:it,replaceItems:at,identify:lt,clearCapturedCart:ut,coupon:S,applyCoupon:_e,removeCoupon:Re,refuseCoupon:k,couponBusy:ue,deliveryOptions:q,setQuoteDestination:we,courier:pe,requote:b,shippingMethodId:T,setShippingMethodId:ce,totals:ct}),[i,t,H,te,B,l,c,C,re,oe,pt,ft,ot,it,at,lt,ut,S,_e,Re,k,ue,q,we,pe,b,T,ct]);return zn(Vt.Provider,{value:fn,children:e})}function Yt(){let e=qn(Vt);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as rr}from"react";function Qt(e,t,n,r){for(;e.size>=t;){let o,i;for(let[l,u]of e){if(u.expiresAt<=r){o=l;break}i===void 0&&n(l)&&(i=l)}let s=o??i??e.keys().next().value;if(s===void 0)return;e.delete(s)}}var Xn=6e4,Vn=5e3,Yn=500,Ae=new Map;async function Qn(e){let{host:t,matchesRequestHost:n}=await xt();if(!t)return"";let r=await St();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}var jn=e=>e.includes("|slug:")||e.includes("|xhost:");async function jt(e,t){if(await vt()!==null)return t();let n=await Qn(e);if(!n)return t();let r=Date.now(),o=Ae.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),s=i.outcome.state==="failed",l=s?Vn:Xn,u=Ae.get(n)?.lastGood,c=i.outcome.state==="ok"?i:s?u:void 0,f=s&&c?c:i;return Qt(Ae,Yn,jn,r),Ae.set(n,{load:f,expiresAt:r+l,lastGood:c}),f}var Zn=404;function Jn(e){if(e instanceof ye&&e.status===Zn)return{state:"absent"};let t=e instanceof ye?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var er="[storefront:chrome-load-failed]";function tr(e,t){console.error(`${er} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function Zt(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=Jn(o);return i.state==="failed"&&tr(e,i),{value:n,outcome:i}}}function nr(e){return e==="production"?"silent":"banner"}var jo=nr("production");function or(e,t){return e?.trim()||t}function ii({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=or(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var ir={name:he,legalName:null,foundedYear:null,faviconUrl:null,currencies:[],defaultCurrency:null,countries:[],defaultCountry:null,commerceEnabled:!0,cardPayments:!1,paymentMethods:[],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,socialLinks:qe},ai=rr(async()=>jt("site",()=>Zt("site",async()=>{let e=await G.getSite();return{name:yt(e.name),legalName:e.legalName?.trim()||null,foundedYear:e.foundedYear??null,faviconUrl:e.faviconUrl??null,currencies:e.currencies??[],defaultCurrency:e.defaultCurrency??null,countries:e.countries??[],defaultCountry:e.defaultCountry??null,commerceEnabled:e.commerceEnabled??!0,cardPayments:e.cardPayments??!1,paymentMethods:e.paymentMethods??(e.cardPayments?["card"]:[]),paypalClientId:e.paypalClientId??null,paypalEnvironment:e.paypalEnvironment??null,squareApplicationId:e.squareApplicationId??null,squareLocationId:e.squareLocationId??null,squareEnvironment:e.squareEnvironment??null,ga4MeasurementId:e.ga4MeasurementId??null,googleAdsId:e.googleAdsId??null,googleAdsConversionLabel:(e.googleAdsId?e.googleAdsConversionLabel:null)??null,metaPixelId:e.metaPixelId??null,consentEnabled:e.consentEnabled??!1,consentPrivacyPage:e.consentPrivacyPage??null,consentNoticeOptOut:e.consentNoticeOptOut??!1,socialLinks:bt(e.socialLinks)}},ir)));var si={name:he,legalName:null,foundedYear:null,faviconUrl:null,currencies:[{code:"USD",symbol:"$",decimalPlaces:2,isDefault:!0}],defaultCurrency:"USD",countries:[{code:"US",name:"United States",currency:"USD",url:"",isDefault:!0,chargeTax:!1,taxDisplay:"none",taxName:"",taxRate:null,postalLabel:"Zip Code"}],defaultCountry:"US",commerceEnabled:!0,cardPayments:!0,paymentMethods:["card"],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,socialLinks:qe};import{jsx as ve,jsxs as Ze}from"react/jsx-runtime";import{useEffect as Te,useId as ur,useRef as en,useState as Oe}from"react";import{useRootIsDark as cr}from"efficient-shell/theme";import{efficientClientOpen as ar}from"efficient-easel/screen/lib/session";var Se=new Map,sr=64;async function lr(e){if(!ar())return null;try{let t=await fetch(`${ht()}/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 Jt(e){let t=Se.get(e);if(t)return t;let n=lr(e);if(Se.set(e,n),Se.size>sr){let r=Se.keys().next();r.done||Se.delete(r.value)}return n}var dr=202/22,fr=.88,Ei=16,pr="invert(1)";function Pi({variant:e="header",scrolled:t=!0,src:n,reverse:r=!1,color:o=null,onLightSurface:i,reversedSrc:s,inkIsDark:l,size:u="medium",sizePx:c,wordmark:f,siteName:C=he,fitToContainer:d=!1,fitWordmarkToContainer:w=!1,fitFloorPx:E}){let p=f&&f.trim()?f.trim():C,[M,L]=Oe(null),F=en(null),_=k=>{F.current=k};Te(()=>{L(F.current?.ownerDocument??null)},[]);let R=!cr({doc:M,whenUnset:!0}),h=n&&n.trim()?n.trim():null,$=!!h&&Ct(h),j=i??(R&&t),U=o&&o.trim()?o.trim():null,b=r&&!U,P=`logo-color-${ur().replace(/[^A-Za-z0-9_-]/g,"")}`,x=b&&$&&h&&s!=null?{reversed:s,inkIsDark:l??null}:null,K=x!==null,[Ue,S]=Oe(null);Te(()=>{if(!b||!h||!$||K){S(null);return}let k=!1;return S(null),Jt(h).then(z=>{k||S(z)}),()=>{k=!0}},[b,h,$,K]);let A=x??Ue,ue=!!A&&A.inkIsDark!==null&&(j?!A.inkIsDark:A.inkIsDark),ee=b&&!!h&&!$&&!j,T=ue&&A?A.reversed:h,ce=T?[T]:[],[Z,H]=Oe(0);Te(()=>{H(0)},[h,ue]);let te=e==="footer"?Ge:We[u],B=c&&c>0?c:te,ne=Math.round(B*dr),D=Z<ce.length?ce[Z]:null,[we,re]=Oe(T),de=D!==null&&D===we,fe=en(null);Te(()=>{let k=fe.current;if(!k||!k.complete)return;if(k.naturalWidth>0||k.naturalHeight>0){re(D);return}let z=!1;return k.decode().then(()=>!z&&re(D),()=>!z&&H(oe=>oe+1)),()=>{z=!0}},[D]);let q=d||w,pe=`calc(100cqi / ${((p.length+1)*fr).toFixed(2)})`,X=q&&E&&E>0?Math.min(E,B):null,_e=q?X===null?`min(${B}px, ${pe})`:`clamp(${X}px, ${pe}, ${B}px)`:`${B}px`,Re=Ze("span",{className:`font-display font-bold tracking-[0.18em] ${X===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:_e,lineHeight:1,...U?{color:U}:{}},"aria-label":p,children:[p,ve("span",{className:"text-accent",style:U?{color:U}:void 0,children:"."})]});return Ze("span",{ref:_,className:"inline-flex items-center",children:[!de&&Re,U&&D&&ve("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:Ze("filter",{id:P,colorInterpolationFilters:"sRGB",children:[ve("feFlood",{style:{floodColor:U}}),ve("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),D&&ve("img",{ref:fe,src:D,alt:p,width:ne,height:B,className:"shrink-0 object-contain",style:{...de?{height:`${B}px`,width:"auto",...d?{maxWidth:"100cqi"}:{}}:{display:"none"},...ee?{filter:pr}:{},...U?{filter:`url(#${P})`}:{}},onLoad:()=>re(D),onError:()=>H(k=>k+1)},D)]})}import{jsx as mr}from"react/jsx-runtime";function _i({tone:e="bad",role:t,children:n}){return mr("div",{role:t,className:["border bg-surface px-4 py-3 text-[14px] leading-relaxed text-fg",e==="good"?"border-accent":e==="bad"?"border-alert":"border-line"].join(" "),children:n})}import{jsx as Ee,jsxs as hr}from"react/jsx-runtime";function gr({spokes:e,mesh:t=!1,className:n}){let s=u=>Math.round(u*1e3)/1e3,l=[];for(let u=0;u<e;u++){let c=u/e*Math.PI*2-Math.PI/2;if(l.push({x1:s(100+Math.cos(c)*22),y1:s(100+Math.sin(c)*22),x2:s(100+Math.cos(c)*86),y2:s(100+Math.sin(c)*86),main:!0}),t){let f=c+Math.PI/e;l.push({x1:s(100+Math.cos(f)*22*1.4),y1:s(100+Math.sin(f)*22*1.4),x2:s(100+Math.cos(f)*78),y2:s(100+Math.sin(f)*78),main:!1})}}return hr("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:[Ee("circle",{cx:100,cy:100,r:92,strokeWidth:2}),Ee("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),Ee("circle",{cx:100,cy:100,r:22,strokeWidth:2}),Ee("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),l.map((u,c)=>Ee("line",{x1:u.x1,y1:u.y1,x2:u.x2,y2:u.y2,stroke:"currentColor",strokeWidth:u.main?6:3,strokeLinecap:"round",opacity:u.main?1:.5},c))]})}var Ii="#c9a461",tn=[{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"}],Ai={name:"",color:"var(--fg)",family:"silver",src:""};function yr(e,t){let n=r=>{let o=tn.findIndex(i=>i.f===r);return o===-1?tn.length:o};return n(e)-n(t)||e.localeCompare(t)}function Ti(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(yr)}import{useState as br}from"react";import{jsx as J,jsxs as Je}from"react/jsx-runtime";function Cr({customerEmail:e}){let{coupon:t,applyCoupon:n,removeCoupon:r,couponBusy:o}=Yt(),[i,s]=br("");async function l(){o||!i.trim()||(await n(i,e),s(""))}return Je("div",{className:"flex flex-col gap-2",children:[t===null?Je("div",{className:"flex border border-line",children:[J("input",{type:"text",value:i,onChange:u=>s(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),l())},placeholder:"Coupon code","aria-label":"Coupon code",className:"flex-1 bg-transparent px-4 py-4 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim"}),J("button",{type:"button",onClick:()=>{l()},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"})]}):Je("div",{className:["flex items-center justify-between gap-3 border px-4 py-3",t.valid?"border-accent":"border-line"].join(" "),style:t.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[J("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",t.valid?"text-accent":t.deferred||t.unchecked?"text-fg":"text-fg-dim line-through"].join(" "),children:t.code}),t.unchecked&&J("button",{type:"button",onClick:()=>{n(t.code,e)},disabled:o,className:"ml-auto font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:text-fg disabled:cursor-wait disabled:opacity-60",children:o?"\u2026":"Try again"}),J("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?J("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:Ot}):t&&!t.valid&&t.message&&J("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:t.message})]})}var et="Ads on. Shopper can opt out.",Me="Ads and analytics off until Accept",xr={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:et,footerLink:"Do Not Sell or Share My Personal Information",panelEyebrow:"Do not sell or share",adsRowName:"Sale or sharing for ads"},ca:{region:"ca",name:"Canada",model:"opt-in",law:"PIPEDA, Quebec Law 25",beforeChoice:Me,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:et,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:et,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:Me,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:Me,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:Me,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}};function Sr(e){let t=[...e.googleAds?["Google"]:[],...e.meta?["Facebook","Instagram"]:[]];return t.length<=1?t.join(""):`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function Hi(e,t,n){let r=Sr(n),o=r?`We use cookies to count visits and to show you ${t} ads on ${r}.`:"We use cookies to count visits.";return e.model==="opt-in"?{heading:r?"Cookies and ads":"Cookies",before:`${o} Nothing loads until you choose. You can change this at any time with `,link:e.footerLink,after:" at the bottom of every page."}:{heading:r?"Cookies and ads":"Cookies",before:`${o} You can say no at any time: choose Privacy choices, or use `,link:e.footerLink,after:" at the bottom of every page."}}var Bi={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on"};var vr={asked:!1,region:"other",model:"opt-in",analytics:!0,ads:!0,chosen:!0,gpc:!1};var Er=vr;function Ki(e=Er){if(e.asked)return e.ads?"granted":"denied"}function Xi(){let e=typeof crypto<"u"?crypto:void 0;if(typeof e?.randomUUID=="function")return e.randomUUID();let t=new Uint8Array(16);if(typeof e?.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}import{Children as wr,isValidElement as _r,useEffect as rn,useId as Rr,useLayoutEffect as sn,useRef as Y,useState as on}from"react";var De=(e,t)=>!!e[t]&&!e[t].disabled;function tt(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(De(e,i))return i}return t}function nt(e,t){return tt(e,t===1?-1:e.length,t)}function rt(e,t){return De(e,t)?t:Math.max(nt(e,1),0)}function nn(e,t,n){let{open:r,focus:o}=e,i=s=>({...e,...s});if(t.length===1&&/\S/.test(t)){let s=e.typed+t.toLowerCase(),l=n.findIndex((u,c)=>De(n,c)&&u.label.toLowerCase().startsWith(s));return{state:i({open:!0,typed:s,focus:l>=0?l: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:tt(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:tt(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:nt(n,1)}),handled:!0};case"End":return{state:i({focus:nt(n,-1)}),handled:!0};case"Enter":case" ":return De(n,o)?{state:i({open:!1,typed:""}),commit:o,refocus:!0,handled:!0}:{state:e,handled:!0};case"Escape":return{state:i({open:!1,typed:""}),refocus:!0,handled:!0};case"Tab":return{state:i({open:!1,typed:""}),handled:!1};default:return{state:e,handled:!1}}}import{placeMenu as Nr}from"efficient-shell/ui";import{Fragment as Mr,jsx as Q,jsxs as ln}from"react/jsx-runtime";var an={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function Lr({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[s,l]=on(!1),u=r!==void 0,c=u?r:s,[f,C]=on(0),d=Y({text:"",timer:0}),w=Y(null),E=Y(null),p=Y(null),M=Rr(),L=Y(null),F=e.findIndex(b=>b.value===t),_=b=>{b!==c&&(u||l(b),b?o?.():i?.())},R=b=>{let P=e[b];!P||P.disabled||(n(P.value),_(!1),E.current?.focus())},h=b=>{let P={open:c,focus:c?f:rt(e,F),typed:d.current.text},x=nn(P,b,e);return!x.handled&&x.state.open===c?!1:(x.state.typed!==P.typed&&(d.current.text=x.state.typed,window.clearTimeout(d.current.timer),d.current.timer=window.setTimeout(()=>{d.current.text=""},500)),C(x.state.focus),x.commit!==void 0?R(x.commit):_(x.state.open),x.refocus&&E.current?.focus(),x.handled)},$=Y(h);$.current=h;let j=Y(()=>_(!1));j.current=()=>_(!1);let U=b=>{c||(L.current=b.nativeEvent,$.current(b.key)&&b.preventDefault())};return rn(()=>{if(!c)return;let b=x=>{w.current?.contains(x.target)||j.current()},P=x=>{x!==L.current&&$.current(x.key)&&x.preventDefault()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",P)}},[c]),rn(()=>{c&&(d.current.text||C(rt(e,F)))},[c]),sn(()=>{if(!c||!p.current)return;p.current.children.item(f)?.scrollIntoView({block:"nearest"})},[f,c]),{open:c,toggle:()=>_(!c),close:()=>_(!1),focusIdx:f,setFocusIdx:C,pick:b=>R(e.findIndex(P=>P.value===b)),wrapRef:w,triggerRef:E,listRef:p,listId:M,onTriggerKeyDown:U,activeId:c?`${M}-${f}`:void 0}}var kr={select:{list:"absolute left-0 top-full z-50 mt-1 max-h-[280px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:(e,t,n)=>["px-3 py-3 font-mono text-[13px] font-semibold uppercase tracking-[0.1em] transition-colors whitespace-nowrap",n?"cursor-not-allowed opacity-40":"cursor-pointer",e&&!n?"bg-accent text-bg":"bg-bg text-fg"].join(" ")},cell:{list:"absolute left-0 top-full z-50 mt-1 max-h-[320px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:e=>[`cursor-pointer whitespace-nowrap px-6 py-3 font-mono ${an.label} font-semibold uppercase tracking-[0.1em] transition-colors`,e?"bg-accent text-bg":"bg-bg text-fg"].join(" "),pickerMarker:!0},hairline:{list:"absolute left-0 top-full z-50 max-h-[320px] w-full overflow-y-auto border border-line bg-bg shadow-[0_6px_20px_rgba(0,0,0,0.10)]",item:(e,t)=>[`flex cursor-pointer items-center justify-between gap-4 border-b border-line px-4 py-3 text-left ${an.body} transition-colors last:border-b-0`,t?"border-fg font-medium text-fg":e?"border-fg text-fg":"text-fg-dim"].join(" "),pickerMarker:!0},region:{list:"absolute right-0 top-full z-[200] mt-2 flex min-w-[240px] flex-col border border-line bg-surface text-fg",item:(e,t,n,r)=>["flex w-full cursor-pointer items-center gap-3 px-4 py-3 text-left transition-colors","font-mono text-[13px] uppercase tracking-[0.18em]",e?"bg-surface-2 text-fg":"",r?"":"border-b border-line",t?"text-accent":""].join(" "),itemStyle:e=>e?void 0:{color:"color-mix(in oklab, currentColor 80%, transparent)"}}};function Ir(e,t){sn(()=>{let n=e.current,r=n?.ownerDocument.defaultView;if(!n||!r)return;let o=()=>{let i=n.style;i.top=i.bottom=i.marginTop=i.marginBottom=i.maxHeight=i.overflowY=i.translate="";let s=n.offsetParent??n.parentElement;if(!s)return;let l=s.getBoundingClientRect(),u=n.getBoundingClientRect(),c=Math.abs(u.right-l.right)<Math.abs(u.left-l.left)?"end":"start",f=Nr({trigger:{left:l.left,right:l.right,top:l.top,bottom:l.bottom},menu:{width:u.width,height:u.height},bounds:{left:0,top:0,right:r.innerWidth,bottom:r.innerHeight},align:c,side:"bottom"});if(f.side==="top"){i.top="auto",i.bottom="100%",i.marginTop="0px";let d=f.top+Math.min(u.height,f.maxHeight);i.marginBottom=`${Math.max(0,l.top-d)}px`}f.maxHeight<u.height&&(i.maxHeight=`${f.maxHeight}px`,i.overflowY="auto");let C=f.left-u.left;C&&(i.translate=`${C}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function Ar(e){return e.split(" ").map(t=>t==="left-0"?"right-0":t).join(" ")}function Tr({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:s,listRef:l,ariaLabel:u,align:c="start"}){let f=kr[t],C=Y(null);return Ir(C,n.length),Q("ul",{ref:d=>{C.current=d,l&&(l.current=d)},id:e,role:"listbox","aria-label":u,...f.pickerMarker?{"data-picker-menu":""}:{},className:c==="end"?Ar(f.list):f.list,children:n.map((d,w)=>{let E=d.value===r;return Q("li",{id:`${e}-${w}`,role:"option","aria-selected":E,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(w),onMouseDown:p=>{p.preventDefault(),d.disabled||s(d.value)},className:f.item(w===o,E&&d.value!=="",!!d.disabled,w===n.length-1),style:f.itemStyle?.(E),children:d.meta===void 0?d.label:ln(Mr,{children:[d.lead,Q("span",{className:"flex-1 whitespace-nowrap",children:d.label}),Q("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${w}`)})})}function Or({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:s,id:l,"aria-label":u,align:c}){let f=wr.toArray(r).flatMap(p=>{if(!_r(p))return[];if(p.type!=="option")return[];let L=p.props,F=L.value!==void 0?String(L.value):"",_=L.children,R=typeof _=="string"||typeof _=="number"?String(_):F;return[{value:F,label:R,disabled:!!L.disabled}]}),C=e??"",d=Lr({items:f,value:C,onPick:p=>t?.({target:{value:p}})}),E=f.find(p=>p.value===C)?.label??f[0]?.label??"";return ln("div",{ref:d.wrapRef,className:"relative",children:[s&&Q("input",{type:"hidden",name:s,value:C}),Q("button",{ref:p=>{d.triggerRef.current=p},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":d.open,"aria-controls":d.open?d.listId:void 0,"aria-activedescendant":d.activeId,"aria-label":u,id:l,onClick:()=>!n&&d.toggle(),onKeyDown:p=>!n&&d.onTriggerKeyDown(p),className:`block w-full ${o??""}`,style:i,children:Q("span",{className:"block w-full truncate text-left",children:E})}),d.open&&Q(Tr,{id:d.listId,tone:"select",items:f,value:C,focusIdx:d.focusIdx,onFocus:d.setFocusIdx,onPick:d.pick,listRef:d.listRef,align:c})]})}import{jsx as Pe,jsxs as Fe}from"react/jsx-runtime";var Dr="font-mono text-[length:var(--size-label,12px)]",Fr="font-semibold uppercase tracking-[0.22em] text-fg";function un(e){return`${e??Dr} ${Fr}`}function cn(){return Pe("span",{className:"text-accent",children:" *"})}function Ur({children:e,required:t,labelFace:n}){return Fe("span",{className:un(n),children:[e,t?Pe(cn,{}):null]})}function $r({label:e,required:t,hint:n,separate:r,htmlFor:o,labelFace:i,className:s,children:l}){let u=s?`flex flex-col gap-2 ${s}`:"flex flex-col gap-2",c=n?Pe("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?Fe("div",{className:u,children:[Fe("label",{htmlFor:o,className:un(i),children:[e,t?Pe(cn,{}):null]}),l,c]}):Fe("label",{htmlFor:o,className:u,children:[Pe(Ur,{required:t,labelFace:i,children:e}),l]})}var ia="w-full border-2 border-line bg-bg px-4 py-4 font-display text-[17px] tracking-[-0.005em] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent";export{It as a,ro as b,oo as c,io as d,Pt as e,Ke as f,Hr as g,Br as h,qr as i,Wr as j,bn as k,Cn as l,Gr as m,Kr as n,ze as o,Le as p,be as q,zr as r,ke as s,Nn as t,Ln as u,uo as v,co as w,Dt as x,Ye as y,fo as z,po as A,In as B,mo as C,go as D,An as E,ho as F,On as G,yo as H,bo as I,Ft as J,Po as K,wo as L,_o as M,Lo as N,ko as O,jr as P,kt as Q,Zr as R,Ie as S,je as T,Wo as U,Yt as V,ii as W,ir as X,si as Y,Ei as Z,Pi as _,gr as $,Ii as aa,tn as ba,Ai as ca,yr as da,Ti as ea,Cr as fa,_i as ga,xr as ha,Hi as ia,Bi as ja,vr as ka,Ki as la,Xi as ma,Lr as na,Tr as oa,Or as pa,Ur as qa,$r as ra,ia as sa};
@@ -1 +1 @@
1
- import{a as j,c as C,g as Z,i as U,j as Q,l as T}from"./chunk-KKKMX6LH.js";var B="".replace(/\/+$/,"");var L="x-forwarded-for";function X(e){let t=(e??"").split(",").map(n=>n.trim()).filter(Boolean);return t.length>0?t[t.length-1]:null}var $e="x-forwarded-host";function Y(e,t,n){let s={};return e&&(s[$e]=e),t&&n==="uncached"&&(s[L]=t),s}function ee(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 te="x-storefront-site",ne="x-storefront-host",re="x-storefront-preview";var Ue="shop_access_token",se="shop_refresh_token",N=null;function M(){T.removeItem(Ue),T.removeItem(se)}var w={getAccess(){return N},takeLegacyRefresh(){let e=T.getItem(se);return M(),e},setTokens(e){N=e,M()},clear(){N=null,M()}};import{efficientClientOpen as et}from"efficient-easel/screen/lib/session";function Be(e){return!!e.src}function A(e){let t=e.finishes.filter(Be);if(t.length===e.finishes.length)return e;let n=e.defaultFinish&&t.some(s=>s.name===e.defaultFinish)?e.defaultFinish:null;return{...e,finishes:t,defaultFinish:n}}function Le(e){return e.listable!==!1}function O(e){return e.map(A).filter(Le)}var ce=["fill","stroke","stop-color","color","flood-color","lighting-color","solid-color"],le=new Set(["none","transparent","currentcolor","inherit","initial","unset","context-fill","context-stroke"]),v={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]},ue=12,me=/\burl\(/i,pe=new RegExp(`(?<![-\\w])(${ce.join("|")})(\\s*=\\s*)(["'])([^"']*)\\3`,"gi"),de=new RegExp(`((?:^|[;{\\s"'])(?:${ce.join("|")})\\s*:\\s*)([^;}"'<>]+)`,"gi"),Ne=/<svg\b([^>]*)>/i,Me=/\bfill\s*[=:]/i;function De(e){let t=e.replace(pe,(n,s,a,l,d)=>{let r=ie(d);return r===null?n:`${s}${a}${l}${r}${l}`}).replace(de,(n,s,a)=>{let l=ie(a);return l===null?n:`${s}${l}`});return t=t.replace(Ne,(n,s)=>Me.test(s)?n:`<svg fill="#ffffff"${s}>`),t}function ie(e){let t=/!important/i.test(e),n=e.replace(/!important/gi,"").trim().toLowerCase();if(!n||me.test(n)||le.has(n))return null;let s=n in v?[...v[n],1]:ge(n);if(!s)return null;let[a,l,d,r]=s;if(Math.max(a,l,d)-Math.min(a,l,d)>ue)return null;let i=He(255-a,255-l,255-d,r);return t?`${i} !important`:i}function He(e,t,n,s){if(s<1)return`rgba(${e}, ${t}, ${n}, ${s})`;let a=l=>l.toString(16).padStart(2,"0");return`#${a(e)}${a(t)}${a(n)}`}function ge(e){return e.startsWith("#")?We(e):e.startsWith("rgb")?Je(e):e.startsWith("hsl")?Ke(e):null}function We(e){let t=e.slice(1),n=1;if(t.length===3||t.length===4)t.length===4&&(n=parseInt(t[3]+t[3],16)/255),t=t.slice(0,3).split("").map(s=>s+s).join("");else if(t.length===6||t.length===8)t.length===8&&(n=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),n]:null}function Je(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,s]=t.split("/"),a=n.split(/[\s,]+/).filter(Boolean).slice(0,3);if(a.length<3)return null;let l=a.map(r=>r.endsWith("%")?Math.round(parseFloat(r)/100*255):Math.round(parseFloat(r)));if(l.some(r=>Number.isNaN(r)))return null;let d=s?E(s):Ge(n);return[l[0],l[1],l[2],d]}function Ge(e){let t=e.split(/[\s,]+/).filter(Boolean);return t.length>=4?E(t[3]):1}function E(e){let t=e.trim().endsWith("%")?parseFloat(e)/100:parseFloat(e);return Number.isNaN(t)?1:t}function Ke(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,s]=t.split("/"),a=n.split(/[\s,]+/).filter(Boolean);if(a.length<3)return null;let l=parseFloat(a[0]),d=parseFloat(a[1])/100,r=parseFloat(a[2])/100;if([l,d,r].some(P=>Number.isNaN(P)))return null;let i=s?E(s):a.length>=4?E(a[3]):1,[o,u,g]=Ve(l,d,r);return[o,u,g,i]}function Ve(e,t,n){let s=(1-Math.abs(2*n-1))*t,a=(e%360+360)%360/60,l=s*(1-Math.abs(a%2-1)),d=0,r=0,i=0;a<1?[d,r,i]=[s,l,0]:a<2?[d,r,i]=[l,s,0]:a<3?[d,r,i]=[0,s,l]:a<4?[d,r,i]=[0,l,s]:a<5?[d,r,i]=[l,0,s]:[d,r,i]=[s,0,l];let o=n-s/2;return[Math.round((d+o)*255),Math.round((r+o)*255),Math.round((i+o)*255)]}var oe=512*1024;function D(e){return/\.svg(\?|$)/i.test(e)}function ze(e){return`data:image/svg+xml,${encodeURIComponent(De(e))}`}function je(e){let t=e.replace(/!important/gi,"").trim().toLowerCase();if(!t||me.test(t)||le.has(t))return null;let n=t in v?[...v[t],1]:ge(t);if(!n)return null;let[s,a,l]=n;return Math.max(s,a,l)-Math.min(s,a,l)>ue?null:(.2126*s+.7152*a+.0722*l)/255}function Ze(e){let t=[],n=s=>{let a=je(s);a!==null&&t.push(a)};for(let s of e.matchAll(pe))n(s[4]);for(let s of e.matchAll(de))n(s[2]);return t.length?t.reduce((s,a)=>s+a,0)/t.length<.5:null}var ae=/^(?:\uFEFF|\s+|<\?xml[^>]*\?>|<!--[\s\S]*?-->|<!DOCTYPE\s+svg[^>[]*>)/i;function Qe(e){let t=e;for(let n=ae.exec(t);n&&n[0].length>0;n=ae.exec(t))t=t.slice(n[0].length);return/^<svg[\s>/]/i.test(t)}async function Xe(e,t){if(!D(e))return null;try{let n=await fetch(e,{signal:t,redirect:"manual"});if(!n.ok)return null;let s=Number(n.headers.get("content-length"));if(Number.isFinite(s)&&s>oe)return null;let a=await n.text();return a.length>oe?null:Qe(a)?a:null}catch{return null}}async function he(e,t){let n=await Xe(e,t);return n===null?null:{reversed:ze(n),inkIsDark:Ze(n)}}import{currentEaselSession as Ye,setSessionBridgedSite as Jt,setSessionDocumentSite as Gt}from"efficient-easel/screen/lib/session";function ye(){return Ye().siteId()}var tt="",S=class extends Error{constructor(t,n,s){super(n),this.status=t,this.data=s}},G="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.",nt=new Set([502,503,504]),H=0,rt="This editor runs on its host's own backend, which does not serve this request.",st=5e3,it=15e3,ot=()=>typeof window>"u"?st:it;function xe(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(ot())}var fe=e=>e instanceof Error&&e.name==="TimeoutError",Se=(e,t)=>nt.has(e)?G:t,at=["admin","venue"],Ce="admin";function tn(e){Ce=at.includes(e)?e:"admin"}function ct(){return Ce}var lt=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/,Te=null;function nn(e){Te=e&&lt.test(e)?e:null}function ut(){return Te}function mt(e){if(typeof window>"u"||!e.startsWith("/api/v1/"))return e;let t=U();return!t||/[?&]site=/.test(e)?e:$(e,`site=${encodeURIComponent(t)}`)}async function c(e,t={}){let{token:n,baseUrl:s,headers:a,audience:l,...d}=t;if(typeof window<"u"&&!et())throw new S(H,rt,null);if(typeof window>"u"&&s===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 r=typeof FormData<"u"&&d.body instanceof FormData,i;try{i=await fetch(`${s??tt}${mt(e)}`,{...d,headers:{...r?{}:{"Content-Type":"application/json"},...n?{Authorization:`Bearer ${n}`}:{},...l===null?{}:{"X-Portal-Audience":l??"shop"},...a},signal:d.signal??xe({...d,audience:l})})}catch(g){throw g instanceof TypeError||fe(g)?new S(H,G,null):g}let o;try{o=await i.text()}catch(g){throw fe(g)?new S(H,G,null):g}let u=null;if(o)try{u=JSON.parse(o)}catch{throw new S(i.status,i.ok?"Expected JSON but received a non-JSON response":Se(i.status,i.statusText),o)}if(!i.ok){let g=(u&&typeof u=="object"&&"detail"in u&&typeof u.detail=="string"?u.detail:null)??Se(i.status,i.statusText);throw new S(i.status,g,u)}return u}var R=null;async function Oe(){return R||(R=pt().finally(()=>{R=null}),R)}async function pt(){let e=w.takeLegacyRefresh(),t=await dt.refresh(e??void 0);return w.setTokens(t.access),t.access}async function ve(){return w.getAccess()??Oe()}async function y(e,t={}){let n;try{n=await ve()}catch{throw w.clear(),new S(401,"Not signed in",null)}try{return await c(e,{...t,token:n})}catch(s){if(!(s instanceof S)||s.status!==401)throw s;try{let a=await Oe();return await c(e,{...t,token:a})}catch{throw w.clear(),s}}}async function Pe(e,t={}){if(w.getAccess())try{return{data:await y(e,t),asShopper:!0}}catch(n){if(!(n instanceof S)||n.status!==401)throw n}return{data:await c(e,t),asShopper:!1}}async function we(){let e=await y("/api/auth/me/");if(e.portal!=="shop")throw w.clear(),new S(403,"This session is not valid for this shop.",null);return e}var dt={login:(e,t)=>c("/api/auth/login/",{method:"POST",body:JSON.stringify({email:e,password:t,portal:"shop"}),credentials:"include"}),refresh:e=>c("/api/auth/refresh/",{method:"POST",body:JSON.stringify(e?{refresh:e,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{w.clear();try{await c("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{let e=await ve();return await we(),e},me:we,updateMe:e=>y("/api/auth/me/",{method:"PATCH",body:JSON.stringify(e)}),changePassword:(e,t)=>y("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:t,old_password:e})}),changeEmail:(e,t)=>y("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:e,current_password:t})}),myProfile:()=>y("/api/shop-portal/profile/"),updateMyProfile:e=>y("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(e)}),myAddresses:()=>y("/api/shop-portal/delivery-locations/"),createAddress:e=>y("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(e)}),updateAddress:(e,t)=>y(`/api/shop-portal/delivery-locations/${e}/`,{method:"PATCH",body:JSON.stringify(t)}),deleteAddress:e=>y(`/api/shop-portal/delivery-locations/${e}/`,{method:"DELETE"}),passwordResetRequest:e=>c("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:e})}),passwordResetConfirm:(e,t,n)=>c("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:e,token:t,new_password:n})}),brands:()=>y("/api/products/brands/"),myOrders:()=>y("/api/shop-portal/orders/").then(e=>e.results),myOrder:e=>y(`/api/shop-portal/orders/${e}/`),cancelOrder:e=>y(`/api/shop-portal/orders/${e}/cancel/`,{method:"POST"}),myReturns:e=>y(`/api/shop-portal/returns/${e?`?order=${encodeURIComponent(e)}`:""}`).then(t=>t.results),createReturn:e=>y("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(e)}),withdrawReturn:e=>y(`/api/shop-portal/returns/${e}/cancel/`,{method:"POST"}),uploadReturnPhoto:(e,t)=>{let n=new FormData;return n.append("claim_item",e),n.append("file",t),n.append("media_type",t.type.startsWith("video/")?"video":"image"),y("/api/shop-portal/return-media/",{method:"POST",body:n})}};function f(e){if(typeof e=="string")return e.startsWith("/media/")?j(e):e;if(Array.isArray(e))return e.map(f);if(e&&typeof e=="object"){let t={};for(let[n,s]of Object.entries(e))t[n]=n==="captions"&&s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).map(([a,l])=>[f(a),l])):f(s);return t}return e}var Ee=typeof window>"u"&&B!=="",gt=Ee?B:"",ht=Q,b=()=>({baseUrl:ht(),audience:null});function m(e,t){let n=t?`?process=${encodeURIComponent(t)}`:"";return`/api/v1${e}${n}`}var Fe=100,be=50;function z(e,t,n){let s=new URLSearchParams;for(let[a,l]of Object.entries(t))l!=null&&l!==""&&s.set(a,String(l));return s.set("pageSize",String(Fe)),n&&s.set("cursor",n),`/api/v1${e}?${s.toString()}`}function yt(e,t){return z("/wheels",{process:e},t)}var Ae=Fe;function ft(e,t){return z("/wheels",{slug:e.join(",")},t)}function St(e,t,n){return z("/products",{kind:e.join(","),make:t?.make,model:t?.model,year:t?.year,modification:t?.modification},n)}function Pt(e){if(!e)return null;try{return new URL(e,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function W(e,t,n=()=>!1){let s=[],a=null;try{for(let l=0;l<be;l++){let d=await c(await t(a),await p());if(s.push(...d.results),a=Pt(d.next),!a)break}a&&console.warn(`[${e}] stopped at ${be} pages (${s.length} rows); catalog may be truncated`)}catch(l){if(n(l))throw l;console.warn(`[${e}] product API unavailable, returning []`,l)}return s}var Re=e=>e instanceof S&&e.status===400;function wt(e){return e.flatMap(t=>t.kind==="alloy-wheel"?O([t]):[t])}async function Ie(){return(await bt()).host}async function bt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js"),t=await e(),n=l=>l?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,s=n(t.get(ne)??t.get("x-forwarded-host")??t.get("host")),a=n(t.get("host"));return{host:s,matchesRequestHost:s!==null&&s===a}}catch{return{host:null,matchesRequestHost:!1}}}async function At(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return X((await e()).get(L))}catch{return null}}async function Rt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(te)||null}catch{return null}}async function _t(){let e=await Rt();if(e)return`site=${encodeURIComponent(e)}`;let t=await Ie();return t?`host=${encodeURIComponent(t)}`:""}async function h(e){if(typeof window<"u"){let t=U();return t?$(e,`site=${encodeURIComponent(t)}`):e}return $(e,await _t())}function $(e,t){return t?`${e}${e.includes("?")?"&":"?"}${t}`:e}var kt="preview";async function xt(){if(typeof window<"u")return null;try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(re)}catch{return null}}async function Ct(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get("user-agent")}catch{return null}}async function J(e,t){let n=await xt();if(n===null)return[await h(e),await p(t)];let s=$(await h(e),`${kt}=${encodeURIComponent(n)}`),{next:a,cache:l,...d}=t??{},r=await p({...d,cache:"no-store"}),i=await Ct();return i&&(r.headers={...r.headers,"user-agent":i}),[s,r]}async function Tt(e){if(!Ee)return;let[t,n]=await Promise.all([Ie(),At()]),s=Y(t,n,e);return Object.keys(s).length>0?s:void 0}async function p(e){let t=await Tt(ee(e)),n={baseUrl:gt,...e};return t&&(n.headers={...t,...e?.headers}),n}var _=typeof window>"u";function k(e,t){let n=new URLSearchParams;for(let[a,l]of Object.entries(t))l!==void 0&&l!==""&&n.set(a,String(l));let s=n.toString();return`/api/v1/fitment${e}${s?`?${s}`:""}`}var cn={listMakes:async e=>{if(_){let{fitmentData:n}=await import("./fitment-data-2I2FDPXW.js");return n.makes(e)}return(await c(k("/makes",{region:e}),b())).results},listModels:async(e,t)=>{if(_){let{fitmentData:s}=await import("./fitment-data-2I2FDPXW.js");return s.models(e,t)}return(await c(k("/models",{make:e,region:t}),b())).results},listYears:async(e,t,n)=>{if(_){let{fitmentData:a}=await import("./fitment-data-2I2FDPXW.js");return a.years(e,t,n)}return(await c(k("/years",{make:e,model:t,region:n}),b())).results},listModifications:async(e,t,n,s)=>{if(_){let{fitmentData:l}=await import("./fitment-data-2I2FDPXW.js");return l.modifications(e,t,n,s)}return(await c(k("/modifications",{make:e,model:t,year:n,region:s}),b())).results},getStockFitment:async(e,t,n,s,a)=>{if(_){let{fitmentData:l}=await import("./fitment-data-2I2FDPXW.js");return l.stockFitment(e,t,n,s,a)}return c(k("/stock-fitment",{make:e,model:t,year:n,modification:s,region:a}),b())}},ln={listWheels:async(e,t={})=>{let n=await W("products.listWheels",async s=>await h(yt(e,s)),t.throwOnFailure?()=>!0:void 0);return O(f(n))},listWheelsBySlug:async(e,t={})=>{let n=[...new Set(e.map(r=>r.trim()).filter(Boolean))];if(n.length===0)return[];let s=[];for(let r=0;r<n.length;r+=Ae)s.push(n.slice(r,r+Ae));let a=await Promise.all(s.map(r=>W("products.listWheelsBySlug",async i=>await h(ft(r,i)),t.throwOnFailure?()=>!0:Re))),l=new Set(n),d=a.flat().filter(r=>l.has(r.slug));return O(f(d))},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 n=await W("products.listCatalog",async s=>await h(St(e,t,s)),Re);return wt(f(n))},getWheel:async e=>A(f(await c(await h(m(`/wheels/${e}`)),await p()))),getTyre:async e=>f(await c(await h(m(`/tyres/${e}`)),await p())),listBundles:async(e={})=>{try{return await c(await h(m("/bundles")),await p())}catch(t){if(e.throwOnFailure)throw t;return[]}},getBundle:async e=>c(await h(m(`/bundles/${e}`)),await p()),listGalleryBuilds:async(e={})=>{let{process:t=null,wheelSlug:n=null}=e;if(typeof window>"u"){let{listGalleryBuilds:s}=await import("./gallery-builds-data-TD3QJK7L.js");return f(s(t,n))}try{let s=new URLSearchParams;t&&s.set("process",t),n&&s.set("wheelSlug",n);let a=s.toString(),l=await c(`/api/v1/gallery-builds${a?`?${a}`:""}`,b());return f(l.results)}catch(s){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",s),[]}},getSite:async()=>c(await h(m("/site")),await p()),getSiteBySlug:async e=>c(`${m("/site")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await p():void 0),listPages:async()=>f(await c(await h(m("/pages")),await p())),listPopups:async()=>c(await h(m("/popups")),await p()),listProductTemplates:async()=>{try{return await c(await h(m("/product-templates")),await p())}catch(e){return console.warn("[products.listProductTemplates] unavailable, returning []",e),[]}},listDynamicPages:async e=>{let t=e?`?recordType=${encodeURIComponent(e)}`:"";try{return await c(await h(`${m("/dynamic-pages")}${t}`),await p())}catch(n){if(n instanceof S&&n.status===404)return[];throw n}},getRecord:async(e,t)=>{try{return await c(await h(m(`/records/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)),await p())}catch(n){if(n instanceof S&&n.status===404)return null;throw n}},listRecordKeys:async e=>{try{let t=await c(await h(m(`/records/${encodeURIComponent(e)}`)),await p({cache:"no-store"}));return Array.isArray(t?.keys)?t.keys.filter(n=>typeof n=="string"&&n!==""):[]}catch(t){if(t instanceof S&&t.status===404)return[];throw t}},listProductTypeChoices:async()=>{try{return await c(await h(m("/product-type-choices")),await p())}catch(e){return console.warn("[products.listProductTypeChoices] unavailable, returning []",e),[]}},listFieldUsage:async()=>{try{return await c(await h(m("/field-usage")),await p())}catch(e){return console.warn("[products.listFieldUsage] unavailable, returning []",e),[]}},getPage:async(e,t={})=>{let n=t.record?`?record=${encodeURIComponent(t.record)}`:"",[s,a]=await J(m(`/pages/${e}`)+n,t.revalidate!==void 0?{next:{revalidate:t.revalidate}}:void 0);return f(await c(s,a))},listBlogPosts:async(e={},{throwOnFailure:t=!1}={})=>{let n=e.category?`?category=${encodeURIComponent(e.category)}`:"";try{return(await c(m("/blog-posts")+n,await p())).map(a=>({...a,coverImage:C(a.coverImage)??""}))}catch(s){if(t)throw s;return console.warn("[products.listBlogPosts] blog API unavailable, returning []",s),[]}},getBlogPost:async e=>{let t=await c(m(`/blog-posts/${e}`),await p());return{...t,coverImage:C(t.coverImage)??""}},createOrder:async e=>c(m("/orders"),await p({method:"POST",body:JSON.stringify(e)})),createOrderAuthed:async e=>y(m("/orders"),await p({method:"POST",body:JSON.stringify(e)})),lookupOrder:async e=>c(m("/orders/lookup"),await p({method:"POST",body:JSON.stringify(e)})),createPaymentIntent:async e=>c(m("/payments/intent"),await p({method:"POST",body:JSON.stringify(e)})),releaseCheckout:async e=>c(m("/checkouts/release"),await p({method:"POST",body:JSON.stringify(e)})),createPaypalOrder:async e=>c(m("/payments/paypal/order"),await p({method:"POST",body:JSON.stringify(e)})),capturePaypalOrder:async e=>c(m("/payments/paypal/capture"),await p({method:"POST",body:JSON.stringify(e)})),createAfterpayCheckout:async e=>c(m("/payments/afterpay/checkout"),await p({method:"POST",body:JSON.stringify(e)})),captureAfterpayPayment:async e=>c(m("/payments/afterpay/capture"),await p({method:"POST",body:JSON.stringify(e)})),chargeSquare:async e=>c(m("/payments/square/charge"),await p({method:"POST",body:JSON.stringify(e)})),createGocardlessBillingRequest:async e=>c(m("/payments/gocardless/billing-request"),await p({method:"POST",body:JSON.stringify(e)})),completeGocardlessPayment:async e=>c(m("/payments/gocardless/complete"),await p({method:"POST",body:JSON.stringify(e)})),createZipCheckout:async e=>c(m("/payments/zip/checkout"),await p({method:"POST",body:JSON.stringify(e)})),captureZipPayment:async e=>c(m("/payments/zip/capture"),await p({method:"POST",body:JSON.stringify(e)})),createKlarnaCheckout:async e=>c(m("/payments/klarna/checkout"),await p({method:"POST",body:JSON.stringify(e)})),captureKlarnaPayment:async e=>c(m("/payments/klarna/capture"),await p({method:"POST",body:JSON.stringify(e)})),createStockAlert:async e=>c(m("/stock-alerts"),await p({method:"POST",body:JSON.stringify(e)})),createPreOrderIntent:async e=>c(m("/pre-order-intents"),await p({method:"POST",body:JSON.stringify(e)})),createNewsletterSubscription:async e=>c(m("/newsletter-subscriptions"),await p({method:"POST",body:JSON.stringify(e)})),unsubscribeNewsletter:async e=>c(m("/newsletter-unsubscribe"),await p({method:"POST",body:JSON.stringify(e)})),captureCart:async e=>c(m("/carts"),await p({method:"POST",body:JSON.stringify(e)})),restoreCart:async e=>c(m("/carts/restore"),await p({method:"POST",body:JSON.stringify(e)})),unsubscribeCartReminders:async e=>c(m("/carts/unsubscribe"),await p({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 n=m("/reviews"),s=t.toString();try{return await c(await h(s?`${n}?${s}`:n),await p())}catch(a){return console.warn("[products.listReviews] product API unavailable, returning []",a),[]}},submitReview:async e=>c(m("/reviews"),await p({method:"POST",body:JSON.stringify(e)})),getForm:async e=>c(m(`/forms/${encodeURIComponent(e)}`),await p()),submitForm:async(e,t)=>c(m(`/forms/${encodeURIComponent(e)}/submissions`),await p({method:"POST",body:JSON.stringify(t)})),listShippingMethods:async()=>{try{return await c(m("/shipping-methods"),await p())}catch(e){return console.warn("[products.listShippingMethods] product API unavailable, returning []",e),[]}},listCountrySubdivisions:async e=>{try{return await c(m(`/countries/${encodeURIComponent(e)}/subdivisions`),await p())}catch(t){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",t),[]}},quoteCart:async e=>{let t=m("/cart/quote"),n=await p({method:"POST",body:JSON.stringify(e)});return e.couponCode?(await Pe(t,n)).data:c(t,n)},validateCoupon:async e=>{let{data:t,asShopper:n}=await Pe(m("/coupons/validate"),await p({method:"POST",body:JSON.stringify(e)}));return{...t,askedAsShopper:n}},getHeaderSettings:async()=>{let e=xe({method:"GET"}),t=await c(...await J(m("/header-settings"),{signal:e})),n=C(t.logoUrl),s=null,a=null;if(n&&D(n)){let l=await he(n,e);l&&(s=l.reversed,a=l.inkIsDark)}return{...t,logoUrl:n,logoReversed:s,logoInkIsDark:a}},getThemeSettings:async()=>c(...await J(m("/theme-settings"))),getChatSettings:async()=>c(await h(m("/chat-settings")),await p())},un={listServices:async()=>{try{return await c(m("/bookings/services"),await p())}catch(e){return console.warn("[bookings.listServices] API unavailable, returning []",e),{results:[],currency:"USD"}}},getAvailability:async(e,t)=>c(m(`/bookings/availability?service=${encodeURIComponent(e)}&date=${t}`),await p()),create:async e=>c(m("/bookings"),await p({method:"POST",body:JSON.stringify(e)})),get:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}`),await p()),cancel:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}/cancel`),await p({method:"POST"})),createPaymentIntent:async e=>c(m("/bookings/payments/intent"),await p({method:"POST",body:JSON.stringify({manageToken:e})}))},K=class extends Error{constructor(n,s){super(`Slug "${n}" exists on ${s} websites; a site is required to pick one.`);this.slug=n;this.count=s;this.name="AmbiguousPageSlugError"}},F=(e,t,n)=>{let s=new URLSearchParams({...t?{site:t}:{},...n?{draft:"1"}:{}}).toString();return`/api/storefront/${e}/${s?`?${s}`:""}`},q=e=>`/api/storefront/sites/${encodeURIComponent(e)}/`,Ot=e=>`${q(e)}currencies/`,vt="/api/storefront/media/ingest/",V=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 Et(){let e=ye();if(!e)throw new V;return`${vt}?${new URLSearchParams({site:e})}`}var Ft="X-Puck-Media-Manifest",_e=Z.contentHash,I={"X-Media-Manifest":_e,[Ft]:_e},mn=qe({});function qe(e){return(t,n={})=>{let s=ut(),a=e.headers||s?{...s?{"Accept-Language":s}:{},...e.headers,...n.headers}:void 0;return c(t,{...n,...e.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...a?{headers:a}:{},audience:e.audience??ct()})}}function It(e={}){let t=qe(e),n=e.siteDrafts===!0,s=r=>F("header-settings",r,n),a=r=>F("theme-settings",r,n),l=r=>F("chat-settings",r,n),d=r=>F("social-settings",r,n);return{findPageBySlug:async(r,i,o)=>{let u=new URLSearchParams({slug:r});o&&u.set("site",o);let g=await t(`/api/storefront/pages/?${u.toString()}`,{token:i}),P=Array.isArray(g)?g:g.results??[];if(!o&&P.length>1)throw new K(r,P.length);return P[0]??null},getPageById:(r,i)=>t(`/api/storefront/pages/${r}/`,{token:i}),saveLayout:(r,i,o,u,g)=>t(`/api/storefront/pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:i,expected_updated_at:u,...g?{client_id:g}:{}}),token:o}),duplicatePage:(r,i,o)=>t(`/api/storefront/pages/${r}/duplicate/`,{method:"POST",body:JSON.stringify({title:i.title,slug:i.slug}),token:o}),geocode:(r,i,o)=>t(`/api/storefront/geocode/?${new URLSearchParams(o?{q:r,country:o}:{q:r})}`,{token:i}),listBlockSources:r=>t("/api/storefront/block-sources/",{token:r}),listRecordTypes:r=>t("/api/storefront/record-types/",{token:r}),createPagePreviewLink:(r,i)=>t(`/api/storefront/pages/${r}/preview-link/`,{method:"POST",token:i}),claimPageEditLock:(r,i,o,u=!1)=>t(`/api/storefront/pages/${r}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:o,takeover:u}),token:i}),releasePageEditLock:(r,i)=>t(`/api/storefront/pages/${r}/edit-lock/`,{method:"DELETE",token:i}),createTemplate:(r,i,o)=>t("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:r,layout:i}),headers:I,token:o}),getTemplate:(r,i)=>t(`/api/storefront/page-templates/${r}/`,{token:i}),saveTemplateLayout:(r,i,o)=>t(`/api/storefront/page-templates/${r}/`,{method:"PATCH",body:JSON.stringify({layout:i}),headers:I,token:o}),listTemplatePages:async(r,i)=>{let o=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}`,{token:i});return Array.isArray(o)?o:o.results??[]},findTemplatePageBySlug:async(r,i,o)=>{let u=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}&slug=${encodeURIComponent(i)}`,{token:o});return(Array.isArray(u)?u:u.results??[])[0]??null},createTemplatePage:(r,i,o)=>t("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:r,...i}),headers:I,token:o}),saveTemplatePageLayout:(r,i,o)=>t(`/api/storefront/template-pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:i}),headers:I,token:o}),deleteTemplatePage:(r,i,o)=>t(`/api/storefront/template-pages/${r}/`,{method:"DELETE",token:i,...o?.keepalive?{keepalive:!0}:{}}),listPages:async(r,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("site",i);let u=await t(`/api/storefront/pages/?${o.toString()}`,{token:r});return Array.isArray(u)?u:u.results??[]},createPage:(r,i,o,u)=>t("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:r,slug:i,layout:o}),token:u}),deletePage:(r,i)=>t(`/api/storefront/pages/${r}/`,{method:"DELETE",token:i}),getHeaderSettings:(r,i)=>t(s(i),{token:r}),listMenus:async(r,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("site",i);let u=await t(`/api/storefront/menus/?${o}`,{token:r});return Array.isArray(u)?u:u.results??[]},listBlogPosts:async(r,i={})=>{let o=new URLSearchParams({no_page:"true"});i.visibleOnly&&o.set("is_visible","true"),i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/blog-posts/?${o.toString()}`,{token:r});return Array.isArray(u)?u:u.results??[]},listFieldUsage:async(r,i)=>{let o=await t(`/api/storefront/field-usage/?site=${encodeURIComponent(i)}`,{token:r});return Array.isArray(o?.entries)?o.entries:[]},listCategories:async(r,i={})=>{let o=new URLSearchParams({no_page:"true"});i.visibleOnly&&o.set("is_visible","true"),i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/categories/?${o.toString()}`,{token:r});return[...Array.isArray(u)?u:u.results??[]].sort((P,x)=>P.sort_order-x.sort_order||P.name.localeCompare(x.name))},listForms:async(r,i={})=>{let o=new URLSearchParams({no_page:"true"});i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/forms/?${o.toString()}`,{token:r});return[...Array.isArray(u)?u:u.results??[]].sort((P,x)=>P.title.localeCompare(x.title))},listWheelSummaries:async(r,i={})=>{let o=new URLSearchParams;i.siteId&&o.set("site",i.siteId);let u=o.toString(),g=await t(`/api/storefront/wheel-curations/summaries/${u?`?${u}`:""}`,{token:r});return f(g)},listProducts:async(r,i={})=>{let o=new URLSearchParams;i.kinds?.length&&o.set("kind",i.kinds.join(",")),i.siteId&&o.set("site",i.siteId);let u=o.toString(),g=await t(`/api/storefront/products/${u?`?${u}`:""}`,{token:r});return f(g)},getWheelDetail:async(r,i,o={})=>{let u=new URLSearchParams({slug:i});return o.siteId&&u.set("site",o.siteId),A(f(await t(`/api/storefront/wheel-curations/detail/?${u.toString()}`,{token:r})))},updateHeaderSettings:(r,i,o)=>t(s(o),{method:"PATCH",body:JSON.stringify(r),token:i}),getSite:(r,i)=>t(q(r),{token:i}),listSites:async r=>{let i=await t("/api/storefront/sites/?no_page=true",{token:r});return Array.isArray(i)?i:i.results??[]},listSiteCurrencies:async(r,i)=>{let o=await t(Ot(r),{token:i});return Array.isArray(o)?o:[]},publishSite:(r,i)=>t(`${q(r)}publish/`,{method:"POST",token:i}),getSiteLiveState:(r,i)=>t(`${q(r)}live-state/`,{token:i}),getThemeSettings:(r,i)=>t(a(i),{token:r}),updateThemeSettings:(r,i,o)=>t(a(o),{method:"PATCH",body:JSON.stringify(r),token:i}),getChatSettings:(r,i)=>t(l(i),{token:r}),updateChatSettings:(r,i,o)=>t(l(o),{method:"PATCH",body:JSON.stringify(r),token:i}),getSocialSettings:(r,i)=>t(d(i),{token:r}),updateSocialSettings:(r,i,o)=>t(d(o),{method:"PATCH",body:JSON.stringify(r),token:i}),uploadHeaderLogo:(r,i,o)=>{let u=new FormData;return u.append("logo",r),t(s(o),{method:"PATCH",body:u,token:i})},clearHeaderLogo:(r,i)=>t(s(i),{method:"PATCH",body:JSON.stringify({logo:null}),token:r}),setHeaderLogoFromAsset:(r,i,o)=>t(s(o),{method:"PATCH",body:JSON.stringify({logo_asset_id:r}),token:i}),uploadMedia:async(r,i)=>{let o=new FormData;return o.append("file",r),t(Et(),{method:"POST",body:o,token:i})},listMedia:async(r,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("kind",i);let u=await t(`/api/storefront/media-assets/?${o.toString()}`,{token:r});return Array.isArray(u)?u:u.results??[]}}}var pn=It({siteDrafts:!0});export{B as a,Y as b,ee as c,w as d,Be as e,D as f,ye as g,tt as h,S as i,G as j,H as k,tn as l,nn as m,c as n,dt as o,Ie as p,bt as q,At as r,Rt as s,xt as t,cn as u,ln as v,un as w,K as x,mn as y,pn as z};
1
+ import{a as j,c as C,g as Z,i as U,j as Q,l as T}from"./chunk-ALMIS7CK.js";var B="".replace(/\/+$/,"");var L="x-forwarded-for";function X(e){let t=(e??"").split(",").map(n=>n.trim()).filter(Boolean);return t.length>0?t[t.length-1]:null}var $e="x-forwarded-host";function Y(e,t,n){let s={};return e&&(s[$e]=e),t&&n==="uncached"&&(s[L]=t),s}function ee(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 te="x-storefront-site",ne="x-storefront-host",re="x-storefront-preview";var Ue="shop_access_token",se="shop_refresh_token",N=null;function M(){T.removeItem(Ue),T.removeItem(se)}var w={getAccess(){return N},takeLegacyRefresh(){let e=T.getItem(se);return M(),e},setTokens(e){N=e,M()},clear(){N=null,M()}};import{efficientClientOpen as et}from"efficient-easel/screen/lib/session";function Be(e){return!!e.src}function A(e){let t=e.finishes.filter(Be);if(t.length===e.finishes.length)return e;let n=e.defaultFinish&&t.some(s=>s.name===e.defaultFinish)?e.defaultFinish:null;return{...e,finishes:t,defaultFinish:n}}function Le(e){return e.listable!==!1}function O(e){return e.map(A).filter(Le)}var ce=["fill","stroke","stop-color","color","flood-color","lighting-color","solid-color"],le=new Set(["none","transparent","currentcolor","inherit","initial","unset","context-fill","context-stroke"]),v={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]},ue=12,me=/\burl\(/i,pe=new RegExp(`(?<![-\\w])(${ce.join("|")})(\\s*=\\s*)(["'])([^"']*)\\3`,"gi"),de=new RegExp(`((?:^|[;{\\s"'])(?:${ce.join("|")})\\s*:\\s*)([^;}"'<>]+)`,"gi"),Ne=/<svg\b([^>]*)>/i,Me=/\bfill\s*[=:]/i;function De(e){let t=e.replace(pe,(n,s,a,l,d)=>{let r=ie(d);return r===null?n:`${s}${a}${l}${r}${l}`}).replace(de,(n,s,a)=>{let l=ie(a);return l===null?n:`${s}${l}`});return t=t.replace(Ne,(n,s)=>Me.test(s)?n:`<svg fill="#ffffff"${s}>`),t}function ie(e){let t=/!important/i.test(e),n=e.replace(/!important/gi,"").trim().toLowerCase();if(!n||me.test(n)||le.has(n))return null;let s=n in v?[...v[n],1]:ge(n);if(!s)return null;let[a,l,d,r]=s;if(Math.max(a,l,d)-Math.min(a,l,d)>ue)return null;let i=He(255-a,255-l,255-d,r);return t?`${i} !important`:i}function He(e,t,n,s){if(s<1)return`rgba(${e}, ${t}, ${n}, ${s})`;let a=l=>l.toString(16).padStart(2,"0");return`#${a(e)}${a(t)}${a(n)}`}function ge(e){return e.startsWith("#")?We(e):e.startsWith("rgb")?Je(e):e.startsWith("hsl")?Ke(e):null}function We(e){let t=e.slice(1),n=1;if(t.length===3||t.length===4)t.length===4&&(n=parseInt(t[3]+t[3],16)/255),t=t.slice(0,3).split("").map(s=>s+s).join("");else if(t.length===6||t.length===8)t.length===8&&(n=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),n]:null}function Je(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,s]=t.split("/"),a=n.split(/[\s,]+/).filter(Boolean).slice(0,3);if(a.length<3)return null;let l=a.map(r=>r.endsWith("%")?Math.round(parseFloat(r)/100*255):Math.round(parseFloat(r)));if(l.some(r=>Number.isNaN(r)))return null;let d=s?E(s):Ge(n);return[l[0],l[1],l[2],d]}function Ge(e){let t=e.split(/[\s,]+/).filter(Boolean);return t.length>=4?E(t[3]):1}function E(e){let t=e.trim().endsWith("%")?parseFloat(e)/100:parseFloat(e);return Number.isNaN(t)?1:t}function Ke(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,s]=t.split("/"),a=n.split(/[\s,]+/).filter(Boolean);if(a.length<3)return null;let l=parseFloat(a[0]),d=parseFloat(a[1])/100,r=parseFloat(a[2])/100;if([l,d,r].some(P=>Number.isNaN(P)))return null;let i=s?E(s):a.length>=4?E(a[3]):1,[o,u,g]=Ve(l,d,r);return[o,u,g,i]}function Ve(e,t,n){let s=(1-Math.abs(2*n-1))*t,a=(e%360+360)%360/60,l=s*(1-Math.abs(a%2-1)),d=0,r=0,i=0;a<1?[d,r,i]=[s,l,0]:a<2?[d,r,i]=[l,s,0]:a<3?[d,r,i]=[0,s,l]:a<4?[d,r,i]=[0,l,s]:a<5?[d,r,i]=[l,0,s]:[d,r,i]=[s,0,l];let o=n-s/2;return[Math.round((d+o)*255),Math.round((r+o)*255),Math.round((i+o)*255)]}var oe=512*1024;function D(e){return/\.svg(\?|$)/i.test(e)}function ze(e){return`data:image/svg+xml,${encodeURIComponent(De(e))}`}function je(e){let t=e.replace(/!important/gi,"").trim().toLowerCase();if(!t||me.test(t)||le.has(t))return null;let n=t in v?[...v[t],1]:ge(t);if(!n)return null;let[s,a,l]=n;return Math.max(s,a,l)-Math.min(s,a,l)>ue?null:(.2126*s+.7152*a+.0722*l)/255}function Ze(e){let t=[],n=s=>{let a=je(s);a!==null&&t.push(a)};for(let s of e.matchAll(pe))n(s[4]);for(let s of e.matchAll(de))n(s[2]);return t.length?t.reduce((s,a)=>s+a,0)/t.length<.5:null}var ae=/^(?:\uFEFF|\s+|<\?xml[^>]*\?>|<!--[\s\S]*?-->|<!DOCTYPE\s+svg[^>[]*>)/i;function Qe(e){let t=e;for(let n=ae.exec(t);n&&n[0].length>0;n=ae.exec(t))t=t.slice(n[0].length);return/^<svg[\s>/]/i.test(t)}async function Xe(e,t){if(!D(e))return null;try{let n=await fetch(e,{signal:t,redirect:"manual"});if(!n.ok)return null;let s=Number(n.headers.get("content-length"));if(Number.isFinite(s)&&s>oe)return null;let a=await n.text();return a.length>oe?null:Qe(a)?a:null}catch{return null}}async function he(e,t){let n=await Xe(e,t);return n===null?null:{reversed:ze(n),inkIsDark:Ze(n)}}import{currentEaselSession as Ye,setSessionBridgedSite as Jt,setSessionDocumentSite as Gt}from"efficient-easel/screen/lib/session";function ye(){return Ye().siteId()}var tt="",S=class extends Error{constructor(t,n,s){super(n),this.status=t,this.data=s}},G="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.",nt=new Set([502,503,504]),H=0,rt="This editor runs on its host's own backend, which does not serve this request.",st=5e3,it=15e3,ot=()=>typeof window>"u"?st:it;function xe(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(ot())}var fe=e=>e instanceof Error&&e.name==="TimeoutError",Se=(e,t)=>nt.has(e)?G:t,at=["admin","venue"],Ce="admin";function tn(e){Ce=at.includes(e)?e:"admin"}function ct(){return Ce}var lt=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/,Te=null;function nn(e){Te=e&&lt.test(e)?e:null}function ut(){return Te}function mt(e){if(typeof window>"u"||!e.startsWith("/api/v1/"))return e;let t=U();return!t||/[?&]site=/.test(e)?e:$(e,`site=${encodeURIComponent(t)}`)}async function c(e,t={}){let{token:n,baseUrl:s,headers:a,audience:l,...d}=t;if(typeof window<"u"&&!et())throw new S(H,rt,null);if(typeof window>"u"&&s===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 r=typeof FormData<"u"&&d.body instanceof FormData,i;try{i=await fetch(`${s??tt}${mt(e)}`,{...d,headers:{...r?{}:{"Content-Type":"application/json"},...n?{Authorization:`Bearer ${n}`}:{},...l===null?{}:{"X-Portal-Audience":l??"shop"},...a},signal:d.signal??xe({...d,audience:l})})}catch(g){throw g instanceof TypeError||fe(g)?new S(H,G,null):g}let o;try{o=await i.text()}catch(g){throw fe(g)?new S(H,G,null):g}let u=null;if(o)try{u=JSON.parse(o)}catch{throw new S(i.status,i.ok?"Expected JSON but received a non-JSON response":Se(i.status,i.statusText),o)}if(!i.ok){let g=(u&&typeof u=="object"&&"detail"in u&&typeof u.detail=="string"?u.detail:null)??Se(i.status,i.statusText);throw new S(i.status,g,u)}return u}var R=null;async function Oe(){return R||(R=pt().finally(()=>{R=null}),R)}async function pt(){let e=w.takeLegacyRefresh(),t=await dt.refresh(e??void 0);return w.setTokens(t.access),t.access}async function ve(){return w.getAccess()??Oe()}async function y(e,t={}){let n;try{n=await ve()}catch{throw w.clear(),new S(401,"Not signed in",null)}try{return await c(e,{...t,token:n})}catch(s){if(!(s instanceof S)||s.status!==401)throw s;try{let a=await Oe();return await c(e,{...t,token:a})}catch{throw w.clear(),s}}}async function Pe(e,t={}){if(w.getAccess())try{return{data:await y(e,t),asShopper:!0}}catch(n){if(!(n instanceof S)||n.status!==401)throw n}return{data:await c(e,t),asShopper:!1}}async function we(){let e=await y("/api/auth/me/");if(e.portal!=="shop")throw w.clear(),new S(403,"This session is not valid for this shop.",null);return e}var dt={login:(e,t)=>c("/api/auth/login/",{method:"POST",body:JSON.stringify({email:e,password:t,portal:"shop"}),credentials:"include"}),refresh:e=>c("/api/auth/refresh/",{method:"POST",body:JSON.stringify(e?{refresh:e,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{w.clear();try{await c("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{let e=await ve();return await we(),e},me:we,updateMe:e=>y("/api/auth/me/",{method:"PATCH",body:JSON.stringify(e)}),changePassword:(e,t)=>y("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:t,old_password:e})}),changeEmail:(e,t)=>y("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:e,current_password:t})}),myProfile:()=>y("/api/shop-portal/profile/"),updateMyProfile:e=>y("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(e)}),myAddresses:()=>y("/api/shop-portal/delivery-locations/"),createAddress:e=>y("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(e)}),updateAddress:(e,t)=>y(`/api/shop-portal/delivery-locations/${e}/`,{method:"PATCH",body:JSON.stringify(t)}),deleteAddress:e=>y(`/api/shop-portal/delivery-locations/${e}/`,{method:"DELETE"}),passwordResetRequest:e=>c("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:e})}),passwordResetConfirm:(e,t,n)=>c("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:e,token:t,new_password:n})}),brands:()=>y("/api/products/brands/"),myOrders:()=>y("/api/shop-portal/orders/").then(e=>e.results),myOrder:e=>y(`/api/shop-portal/orders/${e}/`),cancelOrder:e=>y(`/api/shop-portal/orders/${e}/cancel/`,{method:"POST"}),myReturns:e=>y(`/api/shop-portal/returns/${e?`?order=${encodeURIComponent(e)}`:""}`).then(t=>t.results),createReturn:e=>y("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(e)}),withdrawReturn:e=>y(`/api/shop-portal/returns/${e}/cancel/`,{method:"POST"}),uploadReturnPhoto:(e,t)=>{let n=new FormData;return n.append("claim_item",e),n.append("file",t),n.append("media_type",t.type.startsWith("video/")?"video":"image"),y("/api/shop-portal/return-media/",{method:"POST",body:n})}};function f(e){if(typeof e=="string")return e.startsWith("/media/")?j(e):e;if(Array.isArray(e))return e.map(f);if(e&&typeof e=="object"){let t={};for(let[n,s]of Object.entries(e))t[n]=n==="captions"&&s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).map(([a,l])=>[f(a),l])):f(s);return t}return e}var Ee=typeof window>"u"&&B!=="",gt=Ee?B:"",ht=Q,b=()=>({baseUrl:ht(),audience:null});function m(e,t){let n=t?`?process=${encodeURIComponent(t)}`:"";return`/api/v1${e}${n}`}var Fe=100,be=50;function z(e,t,n){let s=new URLSearchParams;for(let[a,l]of Object.entries(t))l!=null&&l!==""&&s.set(a,String(l));return s.set("pageSize",String(Fe)),n&&s.set("cursor",n),`/api/v1${e}?${s.toString()}`}function yt(e,t){return z("/wheels",{process:e},t)}var Ae=Fe;function ft(e,t){return z("/wheels",{slug:e.join(",")},t)}function St(e,t,n){return z("/products",{kind:e.join(","),make:t?.make,model:t?.model,year:t?.year,modification:t?.modification},n)}function Pt(e){if(!e)return null;try{return new URL(e,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function W(e,t,n=()=>!1){let s=[],a=null;try{for(let l=0;l<be;l++){let d=await c(await t(a),await p());if(s.push(...d.results),a=Pt(d.next),!a)break}a&&console.warn(`[${e}] stopped at ${be} pages (${s.length} rows); catalog may be truncated`)}catch(l){if(n(l))throw l;console.warn(`[${e}] product API unavailable, returning []`,l)}return s}var Re=e=>e instanceof S&&e.status===400;function wt(e){return e.flatMap(t=>t.kind==="alloy-wheel"?O([t]):[t])}async function Ie(){return(await bt()).host}async function bt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js"),t=await e(),n=l=>l?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,s=n(t.get(ne)??t.get("x-forwarded-host")??t.get("host")),a=n(t.get("host"));return{host:s,matchesRequestHost:s!==null&&s===a}}catch{return{host:null,matchesRequestHost:!1}}}async function At(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return X((await e()).get(L))}catch{return null}}async function Rt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(te)||null}catch{return null}}async function _t(){let e=await Rt();if(e)return`site=${encodeURIComponent(e)}`;let t=await Ie();return t?`host=${encodeURIComponent(t)}`:""}async function h(e){if(typeof window<"u"){let t=U();return t?$(e,`site=${encodeURIComponent(t)}`):e}return $(e,await _t())}function $(e,t){return t?`${e}${e.includes("?")?"&":"?"}${t}`:e}var kt="preview";async function xt(){if(typeof window<"u")return null;try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(re)}catch{return null}}async function Ct(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get("user-agent")}catch{return null}}async function J(e,t){let n=await xt();if(n===null)return[await h(e),await p(t)];let s=$(await h(e),`${kt}=${encodeURIComponent(n)}`),{next:a,cache:l,...d}=t??{},r=await p({...d,cache:"no-store"}),i=await Ct();return i&&(r.headers={...r.headers,"user-agent":i}),[s,r]}async function Tt(e){if(!Ee)return;let[t,n]=await Promise.all([Ie(),At()]),s=Y(t,n,e);return Object.keys(s).length>0?s:void 0}async function p(e){let t=await Tt(ee(e)),n={baseUrl:gt,...e};return t&&(n.headers={...t,...e?.headers}),n}var _=typeof window>"u";function k(e,t){let n=new URLSearchParams;for(let[a,l]of Object.entries(t))l!==void 0&&l!==""&&n.set(a,String(l));let s=n.toString();return`/api/v1/fitment${e}${s?`?${s}`:""}`}var cn={listMakes:async e=>{if(_){let{fitmentData:n}=await import("./fitment-data-TSYW6AFA.js");return n.makes(e)}return(await c(k("/makes",{region:e}),b())).results},listModels:async(e,t)=>{if(_){let{fitmentData:s}=await import("./fitment-data-TSYW6AFA.js");return s.models(e,t)}return(await c(k("/models",{make:e,region:t}),b())).results},listYears:async(e,t,n)=>{if(_){let{fitmentData:a}=await import("./fitment-data-TSYW6AFA.js");return a.years(e,t,n)}return(await c(k("/years",{make:e,model:t,region:n}),b())).results},listModifications:async(e,t,n,s)=>{if(_){let{fitmentData:l}=await import("./fitment-data-TSYW6AFA.js");return l.modifications(e,t,n,s)}return(await c(k("/modifications",{make:e,model:t,year:n,region:s}),b())).results},getStockFitment:async(e,t,n,s,a)=>{if(_){let{fitmentData:l}=await import("./fitment-data-TSYW6AFA.js");return l.stockFitment(e,t,n,s,a)}return c(k("/stock-fitment",{make:e,model:t,year:n,modification:s,region:a}),b())}},ln={listWheels:async(e,t={})=>{let n=await W("products.listWheels",async s=>await h(yt(e,s)),t.throwOnFailure?()=>!0:void 0);return O(f(n))},listWheelsBySlug:async(e,t={})=>{let n=[...new Set(e.map(r=>r.trim()).filter(Boolean))];if(n.length===0)return[];let s=[];for(let r=0;r<n.length;r+=Ae)s.push(n.slice(r,r+Ae));let a=await Promise.all(s.map(r=>W("products.listWheelsBySlug",async i=>await h(ft(r,i)),t.throwOnFailure?()=>!0:Re))),l=new Set(n),d=a.flat().filter(r=>l.has(r.slug));return O(f(d))},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 n=await W("products.listCatalog",async s=>await h(St(e,t,s)),Re);return wt(f(n))},getWheel:async e=>A(f(await c(await h(m(`/wheels/${e}`)),await p()))),getTyre:async e=>f(await c(await h(m(`/tyres/${e}`)),await p())),listBundles:async(e={})=>{try{return await c(await h(m("/bundles")),await p())}catch(t){if(e.throwOnFailure)throw t;return[]}},getBundle:async e=>c(await h(m(`/bundles/${e}`)),await p()),listGalleryBuilds:async(e={})=>{let{process:t=null,wheelSlug:n=null}=e;if(typeof window>"u"){let{listGalleryBuilds:s}=await import("./gallery-builds-data-TD3QJK7L.js");return f(s(t,n))}try{let s=new URLSearchParams;t&&s.set("process",t),n&&s.set("wheelSlug",n);let a=s.toString(),l=await c(`/api/v1/gallery-builds${a?`?${a}`:""}`,b());return f(l.results)}catch(s){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",s),[]}},getSite:async()=>c(await h(m("/site")),await p()),getSiteBySlug:async e=>c(`${m("/site")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await p():void 0),listPages:async()=>f(await c(await h(m("/pages")),await p())),listPopups:async()=>c(await h(m("/popups")),await p()),listProductTemplates:async()=>{try{return await c(await h(m("/product-templates")),await p())}catch(e){return console.warn("[products.listProductTemplates] unavailable, returning []",e),[]}},listDynamicPages:async e=>{let t=e?`?recordType=${encodeURIComponent(e)}`:"";try{return await c(await h(`${m("/dynamic-pages")}${t}`),await p())}catch(n){if(n instanceof S&&n.status===404)return[];throw n}},getRecord:async(e,t)=>{try{return await c(await h(m(`/records/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)),await p())}catch(n){if(n instanceof S&&n.status===404)return null;throw n}},listRecordKeys:async e=>{try{let t=await c(await h(m(`/records/${encodeURIComponent(e)}`)),await p({cache:"no-store"}));return Array.isArray(t?.keys)?t.keys.filter(n=>typeof n=="string"&&n!==""):[]}catch(t){if(t instanceof S&&t.status===404)return[];throw t}},listProductTypeChoices:async()=>{try{return await c(await h(m("/product-type-choices")),await p())}catch(e){return console.warn("[products.listProductTypeChoices] unavailable, returning []",e),[]}},listFieldUsage:async()=>{try{return await c(await h(m("/field-usage")),await p())}catch(e){return console.warn("[products.listFieldUsage] unavailable, returning []",e),[]}},getPage:async(e,t={})=>{let n=t.record?`?record=${encodeURIComponent(t.record)}`:"",[s,a]=await J(m(`/pages/${e}`)+n,t.revalidate!==void 0?{next:{revalidate:t.revalidate}}:void 0);return f(await c(s,a))},listBlogPosts:async(e={},{throwOnFailure:t=!1}={})=>{let n=e.category?`?category=${encodeURIComponent(e.category)}`:"";try{return(await c(m("/blog-posts")+n,await p())).map(a=>({...a,coverImage:C(a.coverImage)??""}))}catch(s){if(t)throw s;return console.warn("[products.listBlogPosts] blog API unavailable, returning []",s),[]}},getBlogPost:async e=>{let t=await c(m(`/blog-posts/${e}`),await p());return{...t,coverImage:C(t.coverImage)??""}},createOrder:async e=>c(m("/orders"),await p({method:"POST",body:JSON.stringify(e)})),createOrderAuthed:async e=>y(m("/orders"),await p({method:"POST",body:JSON.stringify(e)})),lookupOrder:async e=>c(m("/orders/lookup"),await p({method:"POST",body:JSON.stringify(e)})),createPaymentIntent:async e=>c(m("/payments/intent"),await p({method:"POST",body:JSON.stringify(e)})),releaseCheckout:async e=>c(m("/checkouts/release"),await p({method:"POST",body:JSON.stringify(e)})),createPaypalOrder:async e=>c(m("/payments/paypal/order"),await p({method:"POST",body:JSON.stringify(e)})),capturePaypalOrder:async e=>c(m("/payments/paypal/capture"),await p({method:"POST",body:JSON.stringify(e)})),createAfterpayCheckout:async e=>c(m("/payments/afterpay/checkout"),await p({method:"POST",body:JSON.stringify(e)})),captureAfterpayPayment:async e=>c(m("/payments/afterpay/capture"),await p({method:"POST",body:JSON.stringify(e)})),chargeSquare:async e=>c(m("/payments/square/charge"),await p({method:"POST",body:JSON.stringify(e)})),createGocardlessBillingRequest:async e=>c(m("/payments/gocardless/billing-request"),await p({method:"POST",body:JSON.stringify(e)})),completeGocardlessPayment:async e=>c(m("/payments/gocardless/complete"),await p({method:"POST",body:JSON.stringify(e)})),createZipCheckout:async e=>c(m("/payments/zip/checkout"),await p({method:"POST",body:JSON.stringify(e)})),captureZipPayment:async e=>c(m("/payments/zip/capture"),await p({method:"POST",body:JSON.stringify(e)})),createKlarnaCheckout:async e=>c(m("/payments/klarna/checkout"),await p({method:"POST",body:JSON.stringify(e)})),captureKlarnaPayment:async e=>c(m("/payments/klarna/capture"),await p({method:"POST",body:JSON.stringify(e)})),createStockAlert:async e=>c(m("/stock-alerts"),await p({method:"POST",body:JSON.stringify(e)})),createPreOrderIntent:async e=>c(m("/pre-order-intents"),await p({method:"POST",body:JSON.stringify(e)})),createNewsletterSubscription:async e=>c(m("/newsletter-subscriptions"),await p({method:"POST",body:JSON.stringify(e)})),unsubscribeNewsletter:async e=>c(m("/newsletter-unsubscribe"),await p({method:"POST",body:JSON.stringify(e)})),captureCart:async e=>c(m("/carts"),await p({method:"POST",body:JSON.stringify(e)})),restoreCart:async e=>c(m("/carts/restore"),await p({method:"POST",body:JSON.stringify(e)})),unsubscribeCartReminders:async e=>c(m("/carts/unsubscribe"),await p({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 n=m("/reviews"),s=t.toString();try{return await c(await h(s?`${n}?${s}`:n),await p())}catch(a){return console.warn("[products.listReviews] product API unavailable, returning []",a),[]}},submitReview:async e=>c(m("/reviews"),await p({method:"POST",body:JSON.stringify(e)})),getForm:async e=>c(m(`/forms/${encodeURIComponent(e)}`),await p()),submitForm:async(e,t)=>c(m(`/forms/${encodeURIComponent(e)}/submissions`),await p({method:"POST",body:JSON.stringify(t)})),listShippingMethods:async()=>{try{return await c(m("/shipping-methods"),await p())}catch(e){return console.warn("[products.listShippingMethods] product API unavailable, returning []",e),[]}},listCountrySubdivisions:async e=>{try{return await c(m(`/countries/${encodeURIComponent(e)}/subdivisions`),await p())}catch(t){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",t),[]}},quoteCart:async e=>{let t=m("/cart/quote"),n=await p({method:"POST",body:JSON.stringify(e)});return e.couponCode?(await Pe(t,n)).data:c(t,n)},validateCoupon:async e=>{let{data:t,asShopper:n}=await Pe(m("/coupons/validate"),await p({method:"POST",body:JSON.stringify(e)}));return{...t,askedAsShopper:n}},getHeaderSettings:async()=>{let e=xe({method:"GET"}),t=await c(...await J(m("/header-settings"),{signal:e})),n=C(t.logoUrl),s=null,a=null;if(n&&D(n)){let l=await he(n,e);l&&(s=l.reversed,a=l.inkIsDark)}return{...t,logoUrl:n,logoReversed:s,logoInkIsDark:a}},getThemeSettings:async()=>c(...await J(m("/theme-settings"))),getChatSettings:async()=>c(await h(m("/chat-settings")),await p())},un={listServices:async()=>{try{return await c(m("/bookings/services"),await p())}catch(e){return console.warn("[bookings.listServices] API unavailable, returning []",e),{results:[],currency:"USD"}}},getAvailability:async(e,t)=>c(m(`/bookings/availability?service=${encodeURIComponent(e)}&date=${t}`),await p()),create:async e=>c(m("/bookings"),await p({method:"POST",body:JSON.stringify(e)})),get:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}`),await p()),cancel:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}/cancel`),await p({method:"POST"})),createPaymentIntent:async e=>c(m("/bookings/payments/intent"),await p({method:"POST",body:JSON.stringify({manageToken:e})}))},K=class extends Error{constructor(n,s){super(`Slug "${n}" exists on ${s} websites; a site is required to pick one.`);this.slug=n;this.count=s;this.name="AmbiguousPageSlugError"}},F=(e,t,n)=>{let s=new URLSearchParams({...t?{site:t}:{},...n?{draft:"1"}:{}}).toString();return`/api/storefront/${e}/${s?`?${s}`:""}`},q=e=>`/api/storefront/sites/${encodeURIComponent(e)}/`,Ot=e=>`${q(e)}currencies/`,vt="/api/storefront/media/ingest/",V=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 Et(){let e=ye();if(!e)throw new V;return`${vt}?${new URLSearchParams({site:e})}`}var Ft="X-Puck-Media-Manifest",_e=Z.contentHash,I={"X-Media-Manifest":_e,[Ft]:_e},mn=qe({});function qe(e){return(t,n={})=>{let s=ut(),a=e.headers||s?{...s?{"Accept-Language":s}:{},...e.headers,...n.headers}:void 0;return c(t,{...n,...e.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...a?{headers:a}:{},audience:e.audience??ct()})}}function It(e={}){let t=qe(e),n=e.siteDrafts===!0,s=r=>F("header-settings",r,n),a=r=>F("theme-settings",r,n),l=r=>F("chat-settings",r,n),d=r=>F("social-settings",r,n);return{findPageBySlug:async(r,i,o)=>{let u=new URLSearchParams({slug:r});o&&u.set("site",o);let g=await t(`/api/storefront/pages/?${u.toString()}`,{token:i}),P=Array.isArray(g)?g:g.results??[];if(!o&&P.length>1)throw new K(r,P.length);return P[0]??null},getPageById:(r,i)=>t(`/api/storefront/pages/${r}/`,{token:i}),saveLayout:(r,i,o,u,g)=>t(`/api/storefront/pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:i,expected_updated_at:u,...g?{client_id:g}:{}}),token:o}),duplicatePage:(r,i,o)=>t(`/api/storefront/pages/${r}/duplicate/`,{method:"POST",body:JSON.stringify({title:i.title,slug:i.slug}),token:o}),geocode:(r,i,o)=>t(`/api/storefront/geocode/?${new URLSearchParams(o?{q:r,country:o}:{q:r})}`,{token:i}),listBlockSources:r=>t("/api/storefront/block-sources/",{token:r}),listRecordTypes:r=>t("/api/storefront/record-types/",{token:r}),createPagePreviewLink:(r,i)=>t(`/api/storefront/pages/${r}/preview-link/`,{method:"POST",token:i}),claimPageEditLock:(r,i,o,u=!1)=>t(`/api/storefront/pages/${r}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:o,takeover:u}),token:i}),releasePageEditLock:(r,i)=>t(`/api/storefront/pages/${r}/edit-lock/`,{method:"DELETE",token:i}),createTemplate:(r,i,o)=>t("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:r,layout:i}),headers:I,token:o}),getTemplate:(r,i)=>t(`/api/storefront/page-templates/${r}/`,{token:i}),saveTemplateLayout:(r,i,o)=>t(`/api/storefront/page-templates/${r}/`,{method:"PATCH",body:JSON.stringify({layout:i}),headers:I,token:o}),listTemplatePages:async(r,i)=>{let o=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}`,{token:i});return Array.isArray(o)?o:o.results??[]},findTemplatePageBySlug:async(r,i,o)=>{let u=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}&slug=${encodeURIComponent(i)}`,{token:o});return(Array.isArray(u)?u:u.results??[])[0]??null},createTemplatePage:(r,i,o)=>t("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:r,...i}),headers:I,token:o}),saveTemplatePageLayout:(r,i,o)=>t(`/api/storefront/template-pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:i}),headers:I,token:o}),deleteTemplatePage:(r,i,o)=>t(`/api/storefront/template-pages/${r}/`,{method:"DELETE",token:i,...o?.keepalive?{keepalive:!0}:{}}),listPages:async(r,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("site",i);let u=await t(`/api/storefront/pages/?${o.toString()}`,{token:r});return Array.isArray(u)?u:u.results??[]},createPage:(r,i,o,u)=>t("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:r,slug:i,layout:o}),token:u}),deletePage:(r,i)=>t(`/api/storefront/pages/${r}/`,{method:"DELETE",token:i}),getHeaderSettings:(r,i)=>t(s(i),{token:r}),listMenus:async(r,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("site",i);let u=await t(`/api/storefront/menus/?${o}`,{token:r});return Array.isArray(u)?u:u.results??[]},listBlogPosts:async(r,i={})=>{let o=new URLSearchParams({no_page:"true"});i.visibleOnly&&o.set("is_visible","true"),i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/blog-posts/?${o.toString()}`,{token:r});return Array.isArray(u)?u:u.results??[]},listFieldUsage:async(r,i)=>{let o=await t(`/api/storefront/field-usage/?site=${encodeURIComponent(i)}`,{token:r});return Array.isArray(o?.entries)?o.entries:[]},listCategories:async(r,i={})=>{let o=new URLSearchParams({no_page:"true"});i.visibleOnly&&o.set("is_visible","true"),i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/categories/?${o.toString()}`,{token:r});return[...Array.isArray(u)?u:u.results??[]].sort((P,x)=>P.sort_order-x.sort_order||P.name.localeCompare(x.name))},listForms:async(r,i={})=>{let o=new URLSearchParams({no_page:"true"});i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/forms/?${o.toString()}`,{token:r});return[...Array.isArray(u)?u:u.results??[]].sort((P,x)=>P.title.localeCompare(x.title))},listWheelSummaries:async(r,i={})=>{let o=new URLSearchParams;i.siteId&&o.set("site",i.siteId);let u=o.toString(),g=await t(`/api/storefront/wheel-curations/summaries/${u?`?${u}`:""}`,{token:r});return f(g)},listProducts:async(r,i={})=>{let o=new URLSearchParams;i.kinds?.length&&o.set("kind",i.kinds.join(",")),i.siteId&&o.set("site",i.siteId);let u=o.toString(),g=await t(`/api/storefront/products/${u?`?${u}`:""}`,{token:r});return f(g)},getWheelDetail:async(r,i,o={})=>{let u=new URLSearchParams({slug:i});return o.siteId&&u.set("site",o.siteId),A(f(await t(`/api/storefront/wheel-curations/detail/?${u.toString()}`,{token:r})))},updateHeaderSettings:(r,i,o)=>t(s(o),{method:"PATCH",body:JSON.stringify(r),token:i}),getSite:(r,i)=>t(q(r),{token:i}),listSites:async r=>{let i=await t("/api/storefront/sites/?no_page=true",{token:r});return Array.isArray(i)?i:i.results??[]},listSiteCurrencies:async(r,i)=>{let o=await t(Ot(r),{token:i});return Array.isArray(o)?o:[]},publishSite:(r,i)=>t(`${q(r)}publish/`,{method:"POST",token:i}),getSiteLiveState:(r,i)=>t(`${q(r)}live-state/`,{token:i}),getThemeSettings:(r,i)=>t(a(i),{token:r}),updateThemeSettings:(r,i,o)=>t(a(o),{method:"PATCH",body:JSON.stringify(r),token:i}),getChatSettings:(r,i)=>t(l(i),{token:r}),updateChatSettings:(r,i,o)=>t(l(o),{method:"PATCH",body:JSON.stringify(r),token:i}),getSocialSettings:(r,i)=>t(d(i),{token:r}),updateSocialSettings:(r,i,o)=>t(d(o),{method:"PATCH",body:JSON.stringify(r),token:i}),uploadHeaderLogo:(r,i,o)=>{let u=new FormData;return u.append("logo",r),t(s(o),{method:"PATCH",body:u,token:i})},clearHeaderLogo:(r,i)=>t(s(i),{method:"PATCH",body:JSON.stringify({logo:null}),token:r}),setHeaderLogoFromAsset:(r,i,o)=>t(s(o),{method:"PATCH",body:JSON.stringify({logo_asset_id:r}),token:i}),uploadMedia:async(r,i)=>{let o=new FormData;return o.append("file",r),t(Et(),{method:"POST",body:o,token:i})},listMedia:async(r,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("kind",i);let u=await t(`/api/storefront/media-assets/?${o.toString()}`,{token:r});return Array.isArray(u)?u:u.results??[]}}}var pn=It({siteDrafts:!0});export{B as a,Y as b,ee as c,w as d,Be as e,D as f,ye as g,tt as h,S as i,G as j,H as k,tn as l,nn as m,c as n,dt as o,Ie as p,bt as q,At as r,Rt as s,xt as t,cn as u,ln as v,un as w,K as x,mn as y,pn as z};