efficient-storefront-blocks 0.90.0 → 0.92.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.
- package/CHANGELOG.md +36 -0
- package/dist/chunks/{EditorPreviewCheckout-M4LID5YF.js → EditorPreviewCheckout-VHPWPS3N.js} +1 -1
- package/dist/chunks/{SiteEditorProvider-2JWQZN2Q.js → SiteEditorProvider-C4HT4BT4.js} +1 -1
- package/dist/chunks/chunk-7L5DVQZ4.js +1 -0
- package/dist/chunks/chunk-PW7BA4ZJ.js +1 -0
- package/dist/chunks/{chunk-3XIZADE6.js → chunk-RAOSZKA3.js} +1 -1
- package/dist/chunks/chunk-S2WLJ6H2.js +388 -0
- package/dist/chunks/{fitment-data-3VLLTJW6.js → fitment-data-URJZ24LU.js} +1 -1
- package/dist/contract.js +11 -19
- package/dist/editor/components/GalleryShowcaseSource.js +1 -1
- package/dist/editor/lib/document/block-align-row.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/AlloyWheelsListing/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/GalleryItem/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/index.d.ts +1 -1
- package/dist/editor/lib/document/blocks/service/AppointmentBooking/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/ContactRouting/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/Events/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/index.d.ts +1 -1
- package/dist/editor/lib/document/config.d.ts +2 -0
- package/dist/editor/lib/document/config.js +1 -1
- package/dist/editor/lib/efficient-block-sources.js +1 -1
- package/dist/editor/lib/storefront-editor-words-kept.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +8 -7
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/editor.css +1 -1
- package/dist/index.js +53 -39
- package/dist/links.js +1 -1
- package/dist/render/app/globals.css +10 -1
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/AppointmentBooking.d.ts +2 -1
- package/dist/render/components/AppointmentBooking.js +1 -1
- package/dist/render/components/ContactRouting.d.ts +2 -1
- package/dist/render/components/ContactRouting.js +1 -1
- package/dist/render/components/Events.d.ts +3 -1
- package/dist/render/components/Events.js +1 -1
- package/dist/render/components/FooterMenu.d.ts +3 -1
- package/dist/render/components/FooterMenu.js +1 -1
- package/dist/render/components/FooterPayment.js +1 -1
- package/dist/render/components/FooterSocial.js +1 -1
- package/dist/render/components/GridCardTemplate.d.ts +30 -1
- package/dist/render/components/GridCardTemplate.js +1 -1
- package/dist/render/components/ProductGridSection.d.ts +2 -1
- package/dist/render/components/ProductGridSection.js +1 -1
- package/dist/render/components/PublishedFooter.js +1 -1
- package/dist/render/components/PublishedHeader.js +1 -1
- package/dist/render/components/RatingBlockView.d.ts +5 -0
- package/dist/render/components/RatingBlockView.js +1 -0
- package/dist/render/components/ReviewForm.js +1 -1
- package/dist/render/components/TyrePlpCard.d.ts +2 -1
- package/dist/render/components/TyrePlpCard.js +1 -1
- package/dist/render/components/TyreSummaryCard.d.ts +2 -1
- package/dist/render/components/TyreSummaryCard.js +1 -1
- package/dist/render/components/WheelCardFrame.d.ts +1 -2
- package/dist/render/components/WheelCardFrame.js +1 -1
- package/dist/render/components/card-pieces/CardPicture.d.ts +1 -1
- package/dist/render/components/card-pieces/CardProductPicture.js +1 -1
- package/dist/render/components/pdp-dynamic/DynamicGalleryGrid.js +1 -1
- package/dist/render/components/pdp-dynamic/RecordPhotoGallery.d.ts +2 -1
- package/dist/render/components/pdp-dynamic/RecordPhotoGallery.js +1 -1
- package/dist/render/components/wheels-plp/AlloyWheelsListing.d.ts +5 -14
- package/dist/render/components/wheels-plp/AlloyWheelsListing.js +1 -1
- package/dist/render/lib/api/index.d.ts +3 -1
- package/dist/render/lib/api/index.js +1 -1
- package/dist/render/lib/chrome-cache.d.ts +1 -0
- package/dist/render/lib/chrome-cache.js +1 -1
- package/dist/render/lib/content/events-featured-look.d.ts +3 -0
- package/dist/render/lib/content/events-featured-look.js +1 -0
- package/dist/render/lib/content/menu-card-seed.d.ts +4 -0
- package/dist/render/lib/content/menu-card-seed.js +1 -1
- package/dist/render/lib/content/menu-entry-type.d.ts +2 -0
- package/dist/render/lib/content/menu-entry-type.js +1 -0
- package/dist/render/lib/content/product-card-seed.d.ts +7 -0
- package/dist/render/lib/content/product-card-seed.js +1 -1
- package/dist/render/lib/content/rating.d.ts +1 -0
- package/dist/render/lib/content/rating.js +1 -0
- package/dist/render/lib/document/blocks/commerce/AlloyWheelsListing/meta.d.ts +6 -0
- package/dist/render/lib/document/blocks/commerce/AlloyWheelsListing/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/AlloyWheelsListing/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductColour/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductEyebrow/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductGrid/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductPrice/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductSpecs/render.js +1 -1
- package/dist/render/lib/document/blocks/service/AppointmentBooking/render.js +1 -1
- package/dist/render/lib/document/blocks/service/ContactRouting/render.js +1 -1
- package/dist/render/lib/document/blocks/service/Events/meta.d.ts +6 -0
- package/dist/render/lib/document/blocks/service/Events/meta.js +1 -1
- package/dist/render/lib/document/blocks/service/Events/render.js +1 -1
- package/dist/render/lib/document/blocks/service/RatingBlock/meta.d.ts +2 -1
- package/dist/render/lib/document/blocks/service/RatingBlock/meta.js +1 -1
- package/dist/render/lib/document/blocks/service/RatingBlock/render.js +1 -1
- package/dist/render/lib/document/card-templates.d.ts +3 -1
- package/dist/render/lib/document/card-templates.js +1 -1
- package/dist/render/lib/document/footer-page-blocks.js +1 -1
- package/dist/render/lib/document/published-chrome-data.d.ts +2 -0
- package/dist/render/lib/document/published-chrome-data.js +1 -0
- package/dist/render/lib/document/render-config.d.ts +2 -0
- package/dist/render/lib/document/render-config.js +1 -1
- package/dist/render/lib/document/section-to-box-rows-detail.js +1 -1
- package/dist/render/lib/document/section-to-box-rows-events.d.ts +1 -0
- package/dist/render/lib/document/section-to-box-rows-events.js +1 -0
- package/dist/render/lib/document/section-to-box-rows-reviews.d.ts +2 -1
- package/dist/render/lib/document/section-to-box-rows-reviews.js +1 -1
- package/dist/render/lib/document/section-to-box-rows-service.d.ts +1 -0
- package/dist/render/lib/document/section-to-box-rows-service.js +1 -0
- package/dist/render/lib/document/section-to-box-rows-spec.js +1 -1
- package/dist/render/lib/sections/grid-no-hole.d.ts +1 -1
- package/dist/render/lib/sections/product-pictures.d.ts +2 -1
- package/dist/render/lib/sections/product-pictures.js +1 -1
- package/dist/render/lib/wheels/plp-hydrate.d.ts +3 -0
- package/dist/render/lib/wheels/plp-hydrate.js +1 -1
- package/dist/words.d.ts +19 -7
- package/dist/words.js +5 -5
- package/package.json +4 -2
- package/dist/chunks/chunk-6TDIG6W3.js +0 -395
- package/dist/chunks/chunk-JMUP4FBL.js +0 -1
- package/dist/chunks/chunk-U6UPMVSX.js +0 -1
- package/dist/render/components/wheels-plp/PlpCard.d.ts +0 -29
- package/dist/render/components/wheels-plp/PlpCard.js +0 -1
- package/dist/render/lib/content/legacy-block-align.d.ts +0 -2
- package/dist/render/lib/content/legacy-block-align.js +0 -1
- /package/dist/chunks/{chunk-N445XY3W.js → chunk-JB6ISWYA.js} +0 -0
- /package/dist/chunks/{chunk-6TDIG6W3.js.LEGAL.txt → chunk-S2WLJ6H2.js.LEGAL.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as xt,i as be,q as St,s as vt,t as Et,v as q}from"./chunk-U6UPMVSX.js";import{$a as Ke,Ga as ht,Ta as ye,Ua as bt,Xa as Ge,Ya as Ct,ab as ze}from"./chunk-JMUP4FBL.js";import{j as yt,l as le}from"./chunk-N445XY3W.js";import{createContext as vn,useContext as Lt,useEffect as En,useMemo as Ce,useState as Rt}from"react";function wt(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function ue(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 Xe=4,Br=1,qr={unit:"set",spares:0,spareSide:"left"};function _t(e){return e.unit==="single"?1:Xe+e.spares}function Wr(e,t){return[{partNumber:e.partNumber,wheels:_t(t),prices:e.prices}]}function Gr(e,t){let n=_t(t)-Xe;if(n<=0||e.length===0)return e;let r=Cn(e),o=r?r[t.spareSide]:0;return e.map((i,s)=>s===o?{...i,wheels:i.wheels+n}:i)}function Cn(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 xn(e,t){return t.spares>0?`${e} + spare`:e}function Kr(e){return e.unit==="single"?"Single":xn(`Set of ${Xe}`,e)}var zr="data-add-to-basket",Ve=9,Sn="en",Pt=new Map;function Ae(e,t,n){let r=`${e}|${t??""}|${n??""}`,o=Pt.get(r);return o||(o=new Intl.NumberFormat(Sn,{style:"currency",currency:e,...t===void 0?{}:{minimumFractionDigits:t},...n===void 0?{}:{maximumFractionDigits:n}}),Pt.set(r,o)),o}function ce(e,t,n=0){return Ae(t,0,n).format(e)}function Xr(e,t){return Ae(t).format(e)}function Vr(e,t){let n=e.savings[t];if(n===void 0)return null;let r=ce(n,t);return e.savingIsFrom?`Save from ${r}`:`Save ${r}`}import{jsx as Rn}from"react/jsx-runtime";var Pn="storefront-country",Nt=Pn,Ye=vn(null);function wn(e){return kt(e,"catalogue")}function _n(e){return kt(e,"money")}function kt(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 Ae(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(m=>m.isDefault)?.code||i[0]?.code||"",[r,i]),u=Ce(()=>o||s.find(m=>m.isDefault)?.code||s[0]?.code||"",[o,s]),[c,f]=Rt(u),[x,d]=Rt(!1);En(()=>{let m=le.getItem(Nt);m&&s.some(O=>O.code===m)&&f(m),d(!0)},[s]);function N(m){f(m),le.setItem(Nt,m)}let w=Ce(()=>{let m=s.find(_=>_.code===c)??null,O=m?.currency,E=O&&i.some(_=>_.code===O)?O:l,F=wn(i),L=_n(i);return{country:c,currency:E,setCountry:N,currencies:i,countries:s,activeCountry:m,formatPrice:(_,S)=>F(_,S??E),formatMoney:(_,S)=>L(_,S??E),ready:x}},[c,i,s,l,x]);return Rn(Ye.Provider,{value:w,children:e})}function It(){let e=Lt(Ye);if(!e)throw new Error("useCurrency must be used within a CurrencyProvider");return e}function eo(){return Lt(Ye)?.country??""}import{createContext as qn,useCallback as P,useContext as Wn,useEffect as Q,useMemo as Kt,useRef as de,useState as k}from"react";function At(){return"/edit"}function Ot(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var Mt="We'll confirm this discount when you place your order.",io="Confirmed at checkout";function ao(e){return e&&(e.valid||e.deferred)?e.code:void 0}var Tt="coupon_code: ";function so(e){return!(e instanceof be)||e.status!==400||!e.message.startsWith(Tt)?null:e.message.slice(Tt.length)}function Dt(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 Te="Price on request",Ln="Request a quote",kn="from ",fo="From ",po="each",Ft="Free";function Qe(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function je(e,t){let n=e?.[t];return Qe(n)?n:null}function mo(e,t,n,r){let o=je(e,n),i=je(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function go(e,t,n,r){if(n==null&&r==null)return!0;let o=je(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var In={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function An(e,t,n){if(!Qe(e))return In;let r=Qe(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function ho(e,t,n=""){return!e.priced||e.unit==null?Te:`${n}${ce(e.unit,t)}`}function yo(e,t){return e.was==null?null:ce(e.was,t)}function Tn(e,t,n=1){let r=ue(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 On={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function bo(e,t,n,r=1){let o=An(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=Tn(t.components,n,r);return s.priced?{priced:!0,unit:s.unit,isFrom:s.isFrom,was:null,onSale:!1,setTotal:s.setTotal,fromSetTotal:i}:{...On,fromSetTotal:i}}function Mn(e,t){return!e.priced||e.unit==null?Te:`${e.isFrom?kn:""}${ce(e.unit,t)}`}function Co(e,t){return e.was==null?null:ce(e.was,t)}function xo(e,t){return!e.priced||e.unit==null?Ln:Mn(e,t)}var Dn=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function Ut(e){return Dn.test(e.trim())}var $t="sf:ga-purchases",Fn=20;function Bt(){return typeof window>"u"||window.parent!==window}function xe(...e){try{if(Bt()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function Un(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:ue(e.components,t)??0,quantity:e.qty}}function Ze(e,t){return e.filter(Oe).map(n=>Un(n,t))}function _o(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 qt(e,t){let n=Ze([e],t);n.length!==0&&xe("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function Ro(e){let t=Ze(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 Ht=new Set;function $n(e){if(Ht.has(e))return!1;Ht.add(e);try{let t=JSON.parse(le.getItem($t)??"[]");if(t.includes(e))return!1;le.setItem($t,JSON.stringify([...t,e].slice(-Fn)))}catch{}return!0}function No(e){let t=e.confirmation;if(Bt()||!$n(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:Ze(e.lines,n)}),e.adsSendTo&&xe("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var Hn="Arranged after review",Wt="Calculated at checkout",Bn=Wt,Io=Wt;function Gt({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function Ao(e){switch(e){case"arranged":return Hn;case"pending":return Bn;case"free":return Ft;case"charged":return null}}import{jsx as Xn}from"react/jsx-runtime";var Gn=400,Kn=400,zn=1500;function Oe(e){return(e.components?.length??0)>0}function zt(e,t){return{code:e,valid:t.valid,deferred:Ot(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function Vt(e,t){return ue(e.components,t)}function Je(e,t){let n=Vt(e,t);return n===null?null:n*e.qty}function Xt(e){return e!=="tyre"}var Yt=qn(null);function Ko({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=It(),[i,s]=k(t),[l,u]=k([]),[c,f]=k([]),[x,d]=k([]),[N,w]=k(!1),[m,O]=k(!1),[E,F]=k(!1),[L,_]=k(!1),[S,z]=k(null),[A,X]=k(0),y=P(()=>X(a=>a+1),[]),[C,b]=k(void 0),[W,we]=k(null),[v,G]=k(null),[ne,U]=k(!1),[M,_e]=k(null),V=de(void 0),K=P(()=>s(!0),[]),J=P(()=>s(!1),[]),re=P(()=>s(a=>!a),[]);Q(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&K()},[K,t]);let oe=At(),$=de(oe);Q(()=>{$.current!==oe&&($.current=oe,t||J())},[oe,t,J]);let Re=P(a=>{we(p=>p?.country===a?.country&&p?.subdivision===a?.subdivision&&p?.postcode===a?.postcode?p:a)},[]),D=P(a=>{_(!0),Xt(a)&&F(!0)},[]),Ne=E||l.some(a=>Xt(a.kind)),ie=L||l.length>0;Q(()=>{if(t||!Ne||N)return;let a=!0;return q.listWheels().then(p=>{a&&(f(p),w(!0))}),()=>{a=!1}},[t,Ne,N]),Q(()=>{if(t||!ie||m)return;let a=!0;return q.listBundles().then(p=>{a&&(d(p),O(!0))}),()=>{a=!1}},[t,ie,m]);let H=S?.deliveryOptions??[],fe=S?.courier??null;Q(()=>{S&&_e(a=>a&&H.some(p=>p.id===a)?a:H[0]?.id??null)},[S]);let ee=P(()=>l.filter(Oe).flatMap(a=>wt(a.components,a.qty)),[l]),pe=P(async(a,p)=>{let h=a.trim().toUpperCase();if(!h)return;let g=ee();if(g.length===0){G({code:h,valid:!1,message:"Add a wheel to the cart first."});return}U(!0),V.current=p;try{let I=await q.validateCoupon({code:h,items:g,currency:n,shippingMethodId:M??void 0,customerEmail:p});G(zt(h,I))}catch{G({code:h,valid:!1,unchecked:!0,message:"Could not check that code. Please try again."})}finally{U(!1)}},[ee,n,M]),ae=P(()=>{G(null),V.current=void 0},[]),Le=P(a=>{if(!v)return;let{code:p}=v;G(h=>h&&h.code===p?{code:p,valid:!1,refused:!0,message:a}:h)},[v]);Q(()=>{if(!v||v.refused)return;let a=v.code,p=g=>g!==null&&g.code===a&&!g.refused,h=setTimeout(async()=>{let g=ee();if(g.length===0){G(I=>p(I)?{code:a,valid:!1,message:"Add a wheel to the cart first."}:I);return}U(!0);try{let I=await q.validateCoupon({code:a,items:g,currency:n,shippingMethodId:M??void 0,customerEmail:V.current});G(he=>p(he)?zt(a,I):he)}catch{}finally{U(!1)}},Gn);return()=>clearTimeout(h)},[l,n,M]);let me=v&&!v.refused?v.code:void 0;Q(()=>{if(t)return;let a=!0,p=setTimeout(async()=>{let h=ee();if(h.length===0){z(null),b(void 0);return}try{let g=await q.quoteCart({items:h,currency:n,shippingMethodId:M??void 0,couponCode:me,customerEmail:V.current||void 0,country:W?.country||r||void 0,subdivision:W?.country&&W.subdivision||void 0,postcode:W?.country&&W.postcode||void 0});if(!a)return;z(g)}catch{if(!a)return}b(me)},Kn);return()=>{a=!1,clearTimeout(p)}},[l,n,M,me,r,W,A]);let R=P(a=>{u(p=>{let h=p.findIndex(g=>g.id===a.id);return h===-1?[...p,a]:p.map((g,I)=>I===h?{...g,qty:Math.min(Ve,g.qty+a.qty)}:g)}),qt(a,n)},[n]),Y=P(a=>{u(p=>p.filter(h=>h.id!==a))},[]),ke=P((a,p)=>{let h=Math.max(1,Math.min(Ve,p));u(g=>g.map(I=>I.id===a?{...I,qty:h}:I))},[]),at=P(a=>{u(a)},[]),[ge,fn]=k(null),st=de(null);st.current=ge;let B=de(null),Be=de(""),lt=P((a,p)=>{let h=a.trim().toLowerCase();Ut(h)&&fn(g=>g&&g.email===h&&g.firstName===(p??"")?g:{email:h,firstName:p??""})},[]);Q(()=>{if(t||!ge)return;let a=Dt(l.filter(Oe),g=>Je(g,n)===null?Te:o(Je(g,n),n)),p={email:ge.email,firstName:ge.firstName,currency:n,items:a},h=JSON.stringify(p);if(h!==Be.current)return B.current&&clearTimeout(B.current),B.current=setTimeout(()=>{B.current=null,Be.current=h,q.captureCart(p).catch(g=>{})},zn),()=>{B.current&&(clearTimeout(B.current),B.current=null)}},[l,ge,n,t]);let ut=P(()=>{B.current&&(clearTimeout(B.current),B.current=null);let a=st.current;a&&(Be.current="",q.captureCart({email:a.email,firstName:a.firstName,currency:n,items:[]}).catch(p=>{}))},[n]),ct=Kt(()=>{let a=l.reduce((T,se)=>{let Ie=Je(se,n);return Ie===null?T:T+Ie},0),p=l.some(T=>Vt(T,n)===null),h=l.reduce((T,se)=>T+se.qty,0),g=v?.valid?v.effects:void 0,I=g?Math.min(a,Number(g.discountAmount)):0,he=S?.bundleDiscount??0,mn=S?.appliedBundles??[],qe=!!g?.freeShipping,mt=H.find(T=>T.id===M),gt=qe?0:S?.shipping??mt?.amount??0,gn=Gt({quoted:S!==null,optionCount:H.length,chosenAmount:mt?.amount,couponWaivesFreight:qe}),We={};for(let T of g?.freeUnits??[])We[T.partNumber]=(We[T.partNumber]??0)+T.quantity;let hn=S?.tax??null,yn=S?S.grandTotal:a-I-he+gt;return{sets:h,units:l.reduce((T,se)=>T+(se.components??[]).reduce((Ie,bn)=>Ie+bn.wheels*se.qty,0),0),subtotal:a,hasUnpricedLine:p,discount:I,bundleDiscount:he,appliedBundles:mn,shipping:gt,freeShipping:qe,shippingStatus:gn,freeUnitsByPartNumber:We,tax:hn,grand:yn,repricing:!!v?.refused&&S!==null&&C===v?.code,currency:n}},[l,n,v,H,M,S,C]),dt=de(!0),ft=P(a=>{dt.current=a},[]),pt=P(a=>{R(a),dt.current&&K()},[R,K]),pn=Kt(()=>({isOpen:i,preview:t,open:K,close:J,toggle:re,items:l,catalog:c,bundles:x,warmCatalog:D,add:R,addAndOpen:pt,setAutoOpen:ft,remove:Y,setQty:ke,replaceItems:at,identify:lt,clearCapturedCart:ut,coupon:v,applyCoupon:pe,removeCoupon:ae,refuseCoupon:Le,couponBusy:ne,deliveryOptions:H,setQuoteDestination:Re,courier:fe,requote:y,shippingMethodId:M,setShippingMethodId:_e,totals:ct}),[i,t,K,J,re,l,c,x,D,R,pt,ft,Y,ke,at,lt,ut,v,pe,ae,Le,ne,H,Re,fe,y,M,ct]);return Xn(Yt.Provider,{value:pn,children:e})}function Qt(){let e=Wn(Yt);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as or}from"react";function jt(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 Vn=6e4,Yn=5e3,Qn=500,Me=new Map;async function jn(e){let{host:t,matchesRequestHost:n}=await St();if(!t)return"";let r=await vt();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}var Zn=e=>e.includes("|slug:")||e.includes("|xhost:");async function Zt(e,t){if(await Et()!==null)return t();let n=await jn(e);if(!n)return t();let r=Date.now(),o=Me.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),s=i.outcome.state==="failed",l=s?Yn:Vn,u=Me.get(n)?.lastGood,c=i.outcome.state==="ok"?i:s?u:void 0,f=s&&c?c:i;return jt(Me,Qn,Zn,r),Me.set(n,{load:f,expiresAt:r+l,lastGood:c}),f}var Jn=404;function er(e){if(e instanceof be&&e.status===Jn)return{state:"absent"};let t=e instanceof be?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var tr="[storefront:chrome-load-failed]";function nr(e,t){console.error(`${tr} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function Jt(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=er(o);return i.state==="failed"&&nr(e,i),{value:n,outcome:i}}}function rr(e){return e==="production"?"silent":"banner"}var Jo=rr("production");function ir(e,t){return e?.trim()||t}function si({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=ir(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var ar={name:ye,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:Ge},li=or(async()=>Zt("site",()=>Jt("site",async()=>{let e=await q.getSite();return{name:bt(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:Ct(e.socialLinks)}},ar)));var ui={name:ye,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:Ge};import{jsx as ve,jsxs as et}from"react/jsx-runtime";import{useEffect as De,useId as cr,useRef as tn,useState as Fe}from"react";import{useRootIsDark as dr}from"efficient-shell/theme";import{efficientClientOpen as sr}from"efficient-easel/screen/lib/session";var Se=new Map,lr=64;async function ur(e){if(!sr())return null;try{let t=await fetch(`${yt()}/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 en(e){let t=Se.get(e);if(t)return t;let n=ur(e);if(Se.set(e,n),Se.size>lr){let r=Se.keys().next();r.done||Se.delete(r.value)}return n}var fr=202/22,pr=.88,_i=16,mr="invert(1)";function Ri({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:x=ye,fitToContainer:d=!1,fitWordmarkToContainer:N=!1,fitFloorPx:w,hideClass:m,hideAttrs:O}){let E=f&&f.trim()?f.trim():x,[F,L]=Fe(null),_=tn(null),S=R=>{_.current=R};De(()=>{L(_.current?.ownerDocument??null)},[]);let z=!dr({doc:F,whenUnset:!0}),A=n&&n.trim()?n.trim():null,X=!!A&&xt(A),y=i??(z&&t),C=o&&o.trim()?o.trim():null,b=r&&!C,W=`logo-color-${cr().replace(/[^A-Za-z0-9_-]/g,"")}`,we=b&&X&&A&&s!=null?{reversed:s,inkIsDark:l??null}:null,v=we!==null,[G,ne]=Fe(null);De(()=>{if(!b||!A||!X||v){ne(null);return}let R=!1;return ne(null),en(A).then(Y=>{R||ne(Y)}),()=>{R=!0}},[b,A,X,v]);let U=we??G,M=!!U&&U.inkIsDark!==null&&(y?!U.inkIsDark:U.inkIsDark),_e=b&&!!A&&!X&&!y,V=M&&U?U.reversed:A,K=V?[V]:[],[J,re]=Fe(0);De(()=>{re(0)},[A,M]);let oe=e==="footer"?ze:Ke[u],$=c&&c>0?c:oe,Re=Math.round($*fr),D=J<K.length?K[J]:null,[Ne,ie]=Fe(V),H=D!==null&&D===Ne,fe=tn(null);De(()=>{let R=fe.current;if(!R||!R.complete)return;if(R.naturalWidth>0||R.naturalHeight>0){ie(D);return}let Y=!1;return R.decode().then(()=>!Y&&ie(D),()=>!Y&&re(ke=>ke+1)),()=>{Y=!0}},[D]);let ee=d||N,pe=`calc(100cqi / ${((E.length+1)*pr).toFixed(2)})`,ae=ee&&w&&w>0?Math.min(w,$):null,Le=ee?ae===null?`min(${$}px, ${pe})`:`clamp(${ae}px, ${pe}, ${$}px)`:`${$}px`,me=et("span",{className:`font-display font-bold tracking-[0.18em] ${ae===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:Le,lineHeight:1,...C?{color:C}:{}},"aria-label":E,children:[E,ve("span",{className:"text-accent",style:C?{color:C}:void 0,children:"."})]});return et("span",{ref:S,className:ht("inline-flex items-center",m??""),...O,children:[!H&&me,C&&D&&ve("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:et("filter",{id:W,colorInterpolationFilters:"sRGB",children:[ve("feFlood",{style:{floodColor:C}}),ve("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),D&&ve("img",{ref:fe,src:D,alt:E,width:Re,height:$,className:"shrink-0 object-contain",style:{...H?{height:`${$}px`,width:"auto",...d?{maxWidth:"100cqi"}:{}}:{display:"none"},..._e?{filter:mr}:{},...C?{filter:`url(#${W})`}:{}},onLoad:()=>ie(D),onError:()=>re(R=>R+1)},D)]})}import{jsx as gr}from"react/jsx-runtime";function Li({tone:e="bad",role:t,children:n}){return gr("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 yr}from"react/jsx-runtime";function hr({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 yr("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 Oi="#c9a461",nn=[{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"}],Mi={name:"",color:"var(--fg)",family:"silver",src:""};function br(e,t){let n=r=>{let o=nn.findIndex(i=>i.f===r);return o===-1?nn.length:o};return n(e)-n(t)||e.localeCompare(t)}function Di(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(br)}import{useState as Cr}from"react";import{jsx as te,jsxs as tt}from"react/jsx-runtime";function xr({customerEmail:e}){let{coupon:t,applyCoupon:n,removeCoupon:r,couponBusy:o}=Qt(),[i,s]=Cr("");async function l(){o||!i.trim()||(await n(i,e),s(""))}return tt("div",{className:"flex flex-col gap-2",children:[t===null?tt("div",{className:"flex border border-line",children:[te("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"}),te("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"})]}):tt("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:[te("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&&te("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"}),te("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?te("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:Mt}):t&&!t.valid&&t.message&&te("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:t.message})]})}var nt="Ads on. Shopper can opt out.",Ue="Ads and analytics off until Accept",Sr={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:nt,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:Ue,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:nt,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:nt,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:Ue,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:Ue,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:Ue,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}};function vr(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 Wi(e,t,n){let r=vr(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 Gi={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on"};var Er={asked:!1,region:"other",model:"opt-in",analytics:!0,ads:!0,chosen:!0,gpc:!1};var Pr=Er;function Vi(e=Pr){if(e.asked)return e.ads?"granted":"denied"}function Qi(){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 _r,isValidElement as Rr,useEffect as on,useId as Nr,useLayoutEffect as ln,useRef as j,useState as an}from"react";var $e=(e,t)=>!!e[t]&&!e[t].disabled;function rt(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if($e(e,i))return i}return t}function ot(e,t){return rt(e,t===1?-1:e.length,t)}function it(e,t){return $e(e,t)?t:Math.max(ot(e,1),0)}function rn(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)=>$e(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:rt(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:rt(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:ot(n,1)}),handled:!0};case"End":return{state:i({focus:ot(n,-1)}),handled:!0};case"Enter":case" ":return $e(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 Lr}from"efficient-shell/ui";import{Fragment as Dr,jsx as Z,jsxs as un}from"react/jsx-runtime";var sn={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function kr({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[s,l]=an(!1),u=r!==void 0,c=u?r:s,[f,x]=an(0),d=j({text:"",timer:0}),N=j(null),w=j(null),m=j(null),O=Nr(),E=j(null),F=e.findIndex(y=>y.value===t),L=y=>{y!==c&&(u||l(y),y?o?.():i?.())},_=y=>{let C=e[y];!C||C.disabled||(n(C.value),L(!1),w.current?.focus())},S=y=>{let C={open:c,focus:c?f:it(e,F),typed:d.current.text},b=rn(C,y,e);return!b.handled&&b.state.open===c?!1:(b.state.typed!==C.typed&&(d.current.text=b.state.typed,window.clearTimeout(d.current.timer),d.current.timer=window.setTimeout(()=>{d.current.text=""},500)),x(b.state.focus),b.commit!==void 0?_(b.commit):L(b.state.open),b.refocus&&w.current?.focus(),b.handled)},z=j(S);z.current=S;let A=j(()=>L(!1));A.current=()=>L(!1);let X=y=>{c||(E.current=y.nativeEvent,z.current(y.key)&&y.preventDefault())};return on(()=>{if(!c)return;let y=b=>{N.current?.contains(b.target)||A.current()},C=b=>{b!==E.current&&z.current(b.key)&&b.preventDefault()};return document.addEventListener("mousedown",y),document.addEventListener("keydown",C),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",C)}},[c]),on(()=>{c&&(d.current.text||x(it(e,F)))},[c]),ln(()=>{if(!c||!m.current)return;m.current.children.item(f)?.scrollIntoView({block:"nearest"})},[f,c]),{open:c,toggle:()=>L(!c),close:()=>L(!1),focusIdx:f,setFocusIdx:x,pick:y=>_(e.findIndex(C=>C.value===y)),wrapRef:N,triggerRef:w,listRef:m,listId:O,onTriggerKeyDown:X,activeId:c?`${O}-${f}`:void 0}}var Ir={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 ${sn.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 ${sn.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 Ar(e,t){ln(()=>{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=Lr({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 x=f.left-u.left;x&&(i.translate=`${x}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function Tr(e){return e.split(" ").map(t=>t==="left-0"?"right-0":t).join(" ")}function Or({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:s,listRef:l,ariaLabel:u,align:c="start"}){let f=Ir[t],x=j(null);return Ar(x,n.length),Z("ul",{ref:d=>{x.current=d,l&&(l.current=d)},id:e,role:"listbox","aria-label":u,...f.pickerMarker?{"data-picker-menu":""}:{},className:c==="end"?Tr(f.list):f.list,children:n.map((d,N)=>{let w=d.value===r;return Z("li",{id:`${e}-${N}`,role:"option","aria-selected":w,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(N),onMouseDown:m=>{m.preventDefault(),d.disabled||s(d.value)},className:f.item(N===o,w&&d.value!=="",!!d.disabled,N===n.length-1),style:f.itemStyle?.(w),children:d.meta===void 0?d.label:un(Dr,{children:[d.lead,Z("span",{className:"flex-1 whitespace-nowrap",children:d.label}),Z("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${N}`)})})}function Mr({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:s,id:l,"aria-label":u,align:c}){let f=_r.toArray(r).flatMap(m=>{if(!Rr(m))return[];if(m.type!=="option")return[];let E=m.props,F=E.value!==void 0?String(E.value):"",L=E.children,_=typeof L=="string"||typeof L=="number"?String(L):F;return[{value:F,label:_,disabled:!!E.disabled}]}),x=e??"",d=kr({items:f,value:x,onPick:m=>t?.({target:{value:m}})}),w=f.find(m=>m.value===x)?.label??f[0]?.label??"";return un("div",{ref:d.wrapRef,className:"relative",children:[s&&Z("input",{type:"hidden",name:s,value:x}),Z("button",{ref:m=>{d.triggerRef.current=m},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:m=>!n&&d.onTriggerKeyDown(m),className:`block w-full ${o??""}`,style:i,children:Z("span",{className:"block w-full truncate text-left",children:w})}),d.open&&Z(Or,{id:d.listId,tone:"select",items:f,value:x,focusIdx:d.focusIdx,onFocus:d.setFocusIdx,onPick:d.pick,listRef:d.listRef,align:c})]})}import{jsx as Pe,jsxs as He}from"react/jsx-runtime";var Fr="font-mono text-[length:var(--size-label,12px)]",Ur="font-semibold uppercase tracking-[0.22em] text-fg";function cn(e){return`${e??Fr} ${Ur}`}function dn(){return Pe("span",{className:"text-accent",children:" *"})}function $r({children:e,required:t,labelFace:n}){return He("span",{className:cn(n),children:[e,t?Pe(dn,{}):null]})}function Hr({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?He("div",{className:u,children:[He("label",{htmlFor:o,className:cn(i),children:[e,t?Pe(dn,{}):null]}),l,c]}):He("label",{htmlFor:o,className:u,children:[Pe($r,{required:t,labelFace:i,children:e}),l]})}var la="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{At as a,io as b,ao as c,so as d,wt as e,Xe as f,Br as g,qr as h,Wr as i,Gr as j,Cn as k,xn as l,Kr as m,zr as n,Ve as o,Ae as p,ce as q,Xr as r,Vr as s,Te as t,Ln as u,kn as v,fo as w,po as x,Ft as y,je as z,mo as A,go as B,An as C,ho as D,yo as E,Tn as F,bo as G,Mn as H,Co as I,xo as J,Ut as K,_o as L,Ro as M,No as N,Io as O,Ao as P,Jr as Q,It as R,eo as S,Oe as T,Je as U,Ko as V,Qt as W,si as X,ar as Y,ui as Z,_i as _,Ri as $,hr as aa,Oi as ba,nn as ca,Mi as da,br as ea,Di as fa,xr as ga,Li as ha,Sr as ia,Wi as ja,Gi as ka,Er as la,Vi as ma,Qi as na,kr as oa,Or as pa,Mr as qa,$r as ra,Hr as sa,la as ta};
|
|
1
|
+
import{f as xt,i as be,q as St,s as vt,t as Et,v as q}from"./chunk-7L5DVQZ4.js";import{Ab as ze,Bb as Ct,eb as ht,gb as Ge,hb as Ke,wb as ye,xb as bt}from"./chunk-PW7BA4ZJ.js";import{j as yt,l as le}from"./chunk-JB6ISWYA.js";import{createContext as vn,useContext as Lt,useEffect as En,useMemo as Ce,useState as Rt}from"react";function wt(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function ue(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 Xe=4,Br=1,qr={unit:"set",spares:0,spareSide:"left"};function _t(e){return e.unit==="single"?1:Xe+e.spares}function Wr(e,t){return[{partNumber:e.partNumber,wheels:_t(t),prices:e.prices}]}function Gr(e,t){let n=_t(t)-Xe;if(n<=0||e.length===0)return e;let r=Cn(e),o=r?r[t.spareSide]:0;return e.map((i,s)=>s===o?{...i,wheels:i.wheels+n}:i)}function Cn(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 xn(e,t){return t.spares>0?`${e} + spare`:e}function Kr(e){return e.unit==="single"?"Single":xn(`Set of ${Xe}`,e)}var zr="data-add-to-basket",Ve=9,Sn="en",Pt=new Map;function Ae(e,t,n){let r=`${e}|${t??""}|${n??""}`,o=Pt.get(r);return o||(o=new Intl.NumberFormat(Sn,{style:"currency",currency:e,...t===void 0?{}:{minimumFractionDigits:t},...n===void 0?{}:{maximumFractionDigits:n}}),Pt.set(r,o)),o}function ce(e,t,n=0){return Ae(t,0,n).format(e)}function Xr(e,t){return Ae(t).format(e)}function Vr(e,t){let n=e.savings[t];if(n===void 0)return null;let r=ce(n,t);return e.savingIsFrom?`Save from ${r}`:`Save ${r}`}import{jsx as Rn}from"react/jsx-runtime";var Pn="storefront-country",Nt=Pn,Ye=vn(null);function wn(e){return kt(e,"catalogue")}function _n(e){return kt(e,"money")}function kt(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 Ae(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(m=>m.isDefault)?.code||i[0]?.code||"",[r,i]),u=Ce(()=>o||s.find(m=>m.isDefault)?.code||s[0]?.code||"",[o,s]),[c,f]=Rt(u),[x,d]=Rt(!1);En(()=>{let m=le.getItem(Nt);m&&s.some(O=>O.code===m)&&f(m),d(!0)},[s]);function N(m){f(m),le.setItem(Nt,m)}let w=Ce(()=>{let m=s.find(_=>_.code===c)??null,O=m?.currency,E=O&&i.some(_=>_.code===O)?O:l,F=wn(i),L=_n(i);return{country:c,currency:E,setCountry:N,currencies:i,countries:s,activeCountry:m,formatPrice:(_,S)=>F(_,S??E),formatMoney:(_,S)=>L(_,S??E),ready:x}},[c,i,s,l,x]);return Rn(Ye.Provider,{value:w,children:e})}function It(){let e=Lt(Ye);if(!e)throw new Error("useCurrency must be used within a CurrencyProvider");return e}function eo(){return Lt(Ye)?.country??""}import{createContext as qn,useCallback as P,useContext as Wn,useEffect as Q,useMemo as Kt,useRef as de,useState as k}from"react";function At(){return"/edit"}function Ot(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var Mt="We'll confirm this discount when you place your order.",io="Confirmed at checkout";function ao(e){return e&&(e.valid||e.deferred)?e.code:void 0}var Tt="coupon_code: ";function so(e){return!(e instanceof be)||e.status!==400||!e.message.startsWith(Tt)?null:e.message.slice(Tt.length)}function Dt(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 Te="Price on request",Ln="Request a quote",kn="from ",fo="From ",po="each",Ft="Free";function Qe(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function je(e,t){let n=e?.[t];return Qe(n)?n:null}function mo(e,t,n,r){let o=je(e,n),i=je(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function go(e,t,n,r){if(n==null&&r==null)return!0;let o=je(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var In={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function An(e,t,n){if(!Qe(e))return In;let r=Qe(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function ho(e,t,n=""){return!e.priced||e.unit==null?Te:`${n}${ce(e.unit,t)}`}function yo(e,t){return e.was==null?null:ce(e.was,t)}function Tn(e,t,n=1){let r=ue(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 On={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function bo(e,t,n,r=1){let o=An(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=Tn(t.components,n,r);return s.priced?{priced:!0,unit:s.unit,isFrom:s.isFrom,was:null,onSale:!1,setTotal:s.setTotal,fromSetTotal:i}:{...On,fromSetTotal:i}}function Mn(e,t){return!e.priced||e.unit==null?Te:`${e.isFrom?kn:""}${ce(e.unit,t)}`}function Co(e,t){return e.was==null?null:ce(e.was,t)}function xo(e,t){return!e.priced||e.unit==null?Ln:Mn(e,t)}var Dn=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function Ut(e){return Dn.test(e.trim())}var $t="sf:ga-purchases",Fn=20;function Bt(){return typeof window>"u"||window.parent!==window}function xe(...e){try{if(Bt()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function Un(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:ue(e.components,t)??0,quantity:e.qty}}function Ze(e,t){return e.filter(Oe).map(n=>Un(n,t))}function _o(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 qt(e,t){let n=Ze([e],t);n.length!==0&&xe("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function Ro(e){let t=Ze(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 Ht=new Set;function $n(e){if(Ht.has(e))return!1;Ht.add(e);try{let t=JSON.parse(le.getItem($t)??"[]");if(t.includes(e))return!1;le.setItem($t,JSON.stringify([...t,e].slice(-Fn)))}catch{}return!0}function No(e){let t=e.confirmation;if(Bt()||!$n(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:Ze(e.lines,n)}),e.adsSendTo&&xe("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var Hn="Arranged after review",Wt="Calculated at checkout",Bn=Wt,Io=Wt;function Gt({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function Ao(e){switch(e){case"arranged":return Hn;case"pending":return Bn;case"free":return Ft;case"charged":return null}}import{jsx as Xn}from"react/jsx-runtime";var Gn=400,Kn=400,zn=1500;function Oe(e){return(e.components?.length??0)>0}function zt(e,t){return{code:e,valid:t.valid,deferred:Ot(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function Vt(e,t){return ue(e.components,t)}function Je(e,t){let n=Vt(e,t);return n===null?null:n*e.qty}function Xt(e){return e!=="tyre"}var Yt=qn(null);function Ko({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=It(),[i,s]=k(t),[l,u]=k([]),[c,f]=k([]),[x,d]=k([]),[N,w]=k(!1),[m,O]=k(!1),[E,F]=k(!1),[L,_]=k(!1),[S,z]=k(null),[A,X]=k(0),y=P(()=>X(a=>a+1),[]),[C,b]=k(void 0),[W,we]=k(null),[v,G]=k(null),[ne,U]=k(!1),[M,_e]=k(null),V=de(void 0),K=P(()=>s(!0),[]),J=P(()=>s(!1),[]),re=P(()=>s(a=>!a),[]);Q(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&K()},[K,t]);let oe=At(),$=de(oe);Q(()=>{$.current!==oe&&($.current=oe,t||J())},[oe,t,J]);let Re=P(a=>{we(p=>p?.country===a?.country&&p?.subdivision===a?.subdivision&&p?.postcode===a?.postcode?p:a)},[]),D=P(a=>{_(!0),Xt(a)&&F(!0)},[]),Ne=E||l.some(a=>Xt(a.kind)),ie=L||l.length>0;Q(()=>{if(t||!Ne||N)return;let a=!0;return q.listWheels().then(p=>{a&&(f(p),w(!0))}),()=>{a=!1}},[t,Ne,N]),Q(()=>{if(t||!ie||m)return;let a=!0;return q.listBundles().then(p=>{a&&(d(p),O(!0))}),()=>{a=!1}},[t,ie,m]);let H=S?.deliveryOptions??[],fe=S?.courier??null;Q(()=>{S&&_e(a=>a&&H.some(p=>p.id===a)?a:H[0]?.id??null)},[S]);let ee=P(()=>l.filter(Oe).flatMap(a=>wt(a.components,a.qty)),[l]),pe=P(async(a,p)=>{let h=a.trim().toUpperCase();if(!h)return;let g=ee();if(g.length===0){G({code:h,valid:!1,message:"Add a wheel to the cart first."});return}U(!0),V.current=p;try{let I=await q.validateCoupon({code:h,items:g,currency:n,shippingMethodId:M??void 0,customerEmail:p});G(zt(h,I))}catch{G({code:h,valid:!1,unchecked:!0,message:"Could not check that code. Please try again."})}finally{U(!1)}},[ee,n,M]),ae=P(()=>{G(null),V.current=void 0},[]),Le=P(a=>{if(!v)return;let{code:p}=v;G(h=>h&&h.code===p?{code:p,valid:!1,refused:!0,message:a}:h)},[v]);Q(()=>{if(!v||v.refused)return;let a=v.code,p=g=>g!==null&&g.code===a&&!g.refused,h=setTimeout(async()=>{let g=ee();if(g.length===0){G(I=>p(I)?{code:a,valid:!1,message:"Add a wheel to the cart first."}:I);return}U(!0);try{let I=await q.validateCoupon({code:a,items:g,currency:n,shippingMethodId:M??void 0,customerEmail:V.current});G(he=>p(he)?zt(a,I):he)}catch{}finally{U(!1)}},Gn);return()=>clearTimeout(h)},[l,n,M]);let me=v&&!v.refused?v.code:void 0;Q(()=>{if(t)return;let a=!0,p=setTimeout(async()=>{let h=ee();if(h.length===0){z(null),b(void 0);return}try{let g=await q.quoteCart({items:h,currency:n,shippingMethodId:M??void 0,couponCode:me,customerEmail:V.current||void 0,country:W?.country||r||void 0,subdivision:W?.country&&W.subdivision||void 0,postcode:W?.country&&W.postcode||void 0});if(!a)return;z(g)}catch{if(!a)return}b(me)},Kn);return()=>{a=!1,clearTimeout(p)}},[l,n,M,me,r,W,A]);let R=P(a=>{u(p=>{let h=p.findIndex(g=>g.id===a.id);return h===-1?[...p,a]:p.map((g,I)=>I===h?{...g,qty:Math.min(Ve,g.qty+a.qty)}:g)}),qt(a,n)},[n]),Y=P(a=>{u(p=>p.filter(h=>h.id!==a))},[]),ke=P((a,p)=>{let h=Math.max(1,Math.min(Ve,p));u(g=>g.map(I=>I.id===a?{...I,qty:h}:I))},[]),at=P(a=>{u(a)},[]),[ge,fn]=k(null),st=de(null);st.current=ge;let B=de(null),Be=de(""),lt=P((a,p)=>{let h=a.trim().toLowerCase();Ut(h)&&fn(g=>g&&g.email===h&&g.firstName===(p??"")?g:{email:h,firstName:p??""})},[]);Q(()=>{if(t||!ge)return;let a=Dt(l.filter(Oe),g=>Je(g,n)===null?Te:o(Je(g,n),n)),p={email:ge.email,firstName:ge.firstName,currency:n,items:a},h=JSON.stringify(p);if(h!==Be.current)return B.current&&clearTimeout(B.current),B.current=setTimeout(()=>{B.current=null,Be.current=h,q.captureCart(p).catch(g=>{})},zn),()=>{B.current&&(clearTimeout(B.current),B.current=null)}},[l,ge,n,t]);let ut=P(()=>{B.current&&(clearTimeout(B.current),B.current=null);let a=st.current;a&&(Be.current="",q.captureCart({email:a.email,firstName:a.firstName,currency:n,items:[]}).catch(p=>{}))},[n]),ct=Kt(()=>{let a=l.reduce((T,se)=>{let Ie=Je(se,n);return Ie===null?T:T+Ie},0),p=l.some(T=>Vt(T,n)===null),h=l.reduce((T,se)=>T+se.qty,0),g=v?.valid?v.effects:void 0,I=g?Math.min(a,Number(g.discountAmount)):0,he=S?.bundleDiscount??0,mn=S?.appliedBundles??[],qe=!!g?.freeShipping,mt=H.find(T=>T.id===M),gt=qe?0:S?.shipping??mt?.amount??0,gn=Gt({quoted:S!==null,optionCount:H.length,chosenAmount:mt?.amount,couponWaivesFreight:qe}),We={};for(let T of g?.freeUnits??[])We[T.partNumber]=(We[T.partNumber]??0)+T.quantity;let hn=S?.tax??null,yn=S?S.grandTotal:a-I-he+gt;return{sets:h,units:l.reduce((T,se)=>T+(se.components??[]).reduce((Ie,bn)=>Ie+bn.wheels*se.qty,0),0),subtotal:a,hasUnpricedLine:p,discount:I,bundleDiscount:he,appliedBundles:mn,shipping:gt,freeShipping:qe,shippingStatus:gn,freeUnitsByPartNumber:We,tax:hn,grand:yn,repricing:!!v?.refused&&S!==null&&C===v?.code,currency:n}},[l,n,v,H,M,S,C]),dt=de(!0),ft=P(a=>{dt.current=a},[]),pt=P(a=>{R(a),dt.current&&K()},[R,K]),pn=Kt(()=>({isOpen:i,preview:t,open:K,close:J,toggle:re,items:l,catalog:c,bundles:x,warmCatalog:D,add:R,addAndOpen:pt,setAutoOpen:ft,remove:Y,setQty:ke,replaceItems:at,identify:lt,clearCapturedCart:ut,coupon:v,applyCoupon:pe,removeCoupon:ae,refuseCoupon:Le,couponBusy:ne,deliveryOptions:H,setQuoteDestination:Re,courier:fe,requote:y,shippingMethodId:M,setShippingMethodId:_e,totals:ct}),[i,t,K,J,re,l,c,x,D,R,pt,ft,Y,ke,at,lt,ut,v,pe,ae,Le,ne,H,Re,fe,y,M,ct]);return Xn(Yt.Provider,{value:pn,children:e})}function Qt(){let e=Wn(Yt);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as or}from"react";function jt(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 Vn=6e4,Yn=5e3,Qn=500,Me=new Map;async function jn(e){let{host:t,matchesRequestHost:n}=await St();if(!t)return"";let r=await vt();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}var Zn=e=>e.includes("|slug:")||e.includes("|xhost:");async function Zt(e,t){if(await Et()!==null)return t();let n=await jn(e);if(!n)return t();let r=Date.now(),o=Me.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),s=i.outcome.state==="failed",l=s?Yn:Vn,u=Me.get(n)?.lastGood,c=i.outcome.state==="ok"?i:s?u:void 0,f=s&&c?c:i;return jt(Me,Qn,Zn,r),Me.set(n,{load:f,expiresAt:r+l,lastGood:c}),f}var Jn=404;function er(e){if(e instanceof be&&e.status===Jn)return{state:"absent"};let t=e instanceof be?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var tr="[storefront:chrome-load-failed]";function nr(e,t){console.error(`${tr} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function Jt(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=er(o);return i.state==="failed"&&nr(e,i),{value:n,outcome:i}}}function rr(e){return e==="production"?"silent":"banner"}var Jo=rr("production");function ir(e,t){return e?.trim()||t}function si({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=ir(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var ar={name:ye,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:ze},li=or(async()=>Zt("site",()=>Jt("site",async()=>{let e=await q.getSite();return{name:bt(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:Ct(e.socialLinks)}},ar)));var ui={name:ye,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:ze};import{jsx as ve,jsxs as et}from"react/jsx-runtime";import{useEffect as De,useId as cr,useRef as tn,useState as Fe}from"react";import{useRootIsDark as dr}from"efficient-shell/theme";import{efficientClientOpen as sr}from"efficient-easel/screen/lib/session";var Se=new Map,lr=64;async function ur(e){if(!sr())return null;try{let t=await fetch(`${yt()}/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 en(e){let t=Se.get(e);if(t)return t;let n=ur(e);if(Se.set(e,n),Se.size>lr){let r=Se.keys().next();r.done||Se.delete(r.value)}return n}var fr=202/22,pr=.88,_i=16,mr="invert(1)";function Ri({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:x=ye,fitToContainer:d=!1,fitWordmarkToContainer:N=!1,fitFloorPx:w,hideClass:m,hideAttrs:O}){let E=f&&f.trim()?f.trim():x,[F,L]=Fe(null),_=tn(null),S=R=>{_.current=R};De(()=>{L(_.current?.ownerDocument??null)},[]);let z=!dr({doc:F,whenUnset:!0}),A=n&&n.trim()?n.trim():null,X=!!A&&xt(A),y=i??(z&&t),C=o&&o.trim()?o.trim():null,b=r&&!C,W=`logo-color-${cr().replace(/[^A-Za-z0-9_-]/g,"")}`,we=b&&X&&A&&s!=null?{reversed:s,inkIsDark:l??null}:null,v=we!==null,[G,ne]=Fe(null);De(()=>{if(!b||!A||!X||v){ne(null);return}let R=!1;return ne(null),en(A).then(Y=>{R||ne(Y)}),()=>{R=!0}},[b,A,X,v]);let U=we??G,M=!!U&&U.inkIsDark!==null&&(y?!U.inkIsDark:U.inkIsDark),_e=b&&!!A&&!X&&!y,V=M&&U?U.reversed:A,K=V?[V]:[],[J,re]=Fe(0);De(()=>{re(0)},[A,M]);let oe=e==="footer"?Ke:Ge[u],$=c&&c>0?c:oe,Re=Math.round($*fr),D=J<K.length?K[J]:null,[Ne,ie]=Fe(V),H=D!==null&&D===Ne,fe=tn(null);De(()=>{let R=fe.current;if(!R||!R.complete)return;if(R.naturalWidth>0||R.naturalHeight>0){ie(D);return}let Y=!1;return R.decode().then(()=>!Y&&ie(D),()=>!Y&&re(ke=>ke+1)),()=>{Y=!0}},[D]);let ee=d||N,pe=`calc(100cqi / ${((E.length+1)*pr).toFixed(2)})`,ae=ee&&w&&w>0?Math.min(w,$):null,Le=ee?ae===null?`min(${$}px, ${pe})`:`clamp(${ae}px, ${pe}, ${$}px)`:`${$}px`,me=et("span",{className:`font-display font-bold tracking-[0.18em] ${ae===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:Le,lineHeight:1,...C?{color:C}:{}},"aria-label":E,children:[E,ve("span",{className:"text-accent",style:C?{color:C}:void 0,children:"."})]});return et("span",{ref:S,className:ht("inline-flex items-center",m??""),...O,children:[!H&&me,C&&D&&ve("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:et("filter",{id:W,colorInterpolationFilters:"sRGB",children:[ve("feFlood",{style:{floodColor:C}}),ve("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),D&&ve("img",{ref:fe,src:D,alt:E,width:Re,height:$,className:"shrink-0 object-contain",style:{...H?{height:`${$}px`,width:"auto",...d?{maxWidth:"100cqi"}:{}}:{display:"none"},..._e?{filter:mr}:{},...C?{filter:`url(#${W})`}:{}},onLoad:()=>ie(D),onError:()=>re(R=>R+1)},D)]})}import{jsx as gr}from"react/jsx-runtime";function Li({tone:e="bad",role:t,children:n}){return gr("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 yr}from"react/jsx-runtime";function hr({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 yr("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 Oi="#c9a461",nn=[{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"}],Mi={name:"",color:"var(--fg)",family:"silver",src:""};function br(e,t){let n=r=>{let o=nn.findIndex(i=>i.f===r);return o===-1?nn.length:o};return n(e)-n(t)||e.localeCompare(t)}function Di(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(br)}import{useState as Cr}from"react";import{jsx as te,jsxs as tt}from"react/jsx-runtime";function xr({customerEmail:e}){let{coupon:t,applyCoupon:n,removeCoupon:r,couponBusy:o}=Qt(),[i,s]=Cr("");async function l(){o||!i.trim()||(await n(i,e),s(""))}return tt("div",{className:"flex flex-col gap-2",children:[t===null?tt("div",{className:"flex border border-line",children:[te("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"}),te("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"})]}):tt("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:[te("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&&te("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"}),te("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?te("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:Mt}):t&&!t.valid&&t.message&&te("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:t.message})]})}var nt="Ads on. Shopper can opt out.",Ue="Ads and analytics off until Accept",Sr={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:nt,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:Ue,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:nt,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:nt,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:Ue,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:Ue,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:Ue,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}};function vr(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 Wi(e,t,n){let r=vr(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 Gi={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on"};var Er={asked:!1,region:"other",model:"opt-in",analytics:!0,ads:!0,chosen:!0,gpc:!1};var Pr=Er;function Vi(e=Pr){if(e.asked)return e.ads?"granted":"denied"}function Qi(){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 _r,isValidElement as Rr,useEffect as on,useId as Nr,useLayoutEffect as ln,useRef as j,useState as an}from"react";var $e=(e,t)=>!!e[t]&&!e[t].disabled;function rt(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if($e(e,i))return i}return t}function ot(e,t){return rt(e,t===1?-1:e.length,t)}function it(e,t){return $e(e,t)?t:Math.max(ot(e,1),0)}function rn(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)=>$e(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:rt(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:rt(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:ot(n,1)}),handled:!0};case"End":return{state:i({focus:ot(n,-1)}),handled:!0};case"Enter":case" ":return $e(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 Lr}from"efficient-shell/ui";import{Fragment as Dr,jsx as Z,jsxs as un}from"react/jsx-runtime";var sn={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function kr({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[s,l]=an(!1),u=r!==void 0,c=u?r:s,[f,x]=an(0),d=j({text:"",timer:0}),N=j(null),w=j(null),m=j(null),O=Nr(),E=j(null),F=e.findIndex(y=>y.value===t),L=y=>{y!==c&&(u||l(y),y?o?.():i?.())},_=y=>{let C=e[y];!C||C.disabled||(n(C.value),L(!1),w.current?.focus())},S=y=>{let C={open:c,focus:c?f:it(e,F),typed:d.current.text},b=rn(C,y,e);return!b.handled&&b.state.open===c?!1:(b.state.typed!==C.typed&&(d.current.text=b.state.typed,window.clearTimeout(d.current.timer),d.current.timer=window.setTimeout(()=>{d.current.text=""},500)),x(b.state.focus),b.commit!==void 0?_(b.commit):L(b.state.open),b.refocus&&w.current?.focus(),b.handled)},z=j(S);z.current=S;let A=j(()=>L(!1));A.current=()=>L(!1);let X=y=>{c||(E.current=y.nativeEvent,z.current(y.key)&&y.preventDefault())};return on(()=>{if(!c)return;let y=b=>{N.current?.contains(b.target)||A.current()},C=b=>{b!==E.current&&z.current(b.key)&&b.preventDefault()};return document.addEventListener("mousedown",y),document.addEventListener("keydown",C),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",C)}},[c]),on(()=>{c&&(d.current.text||x(it(e,F)))},[c]),ln(()=>{if(!c||!m.current)return;m.current.children.item(f)?.scrollIntoView({block:"nearest"})},[f,c]),{open:c,toggle:()=>L(!c),close:()=>L(!1),focusIdx:f,setFocusIdx:x,pick:y=>_(e.findIndex(C=>C.value===y)),wrapRef:N,triggerRef:w,listRef:m,listId:O,onTriggerKeyDown:X,activeId:c?`${O}-${f}`:void 0}}var Ir={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 ${sn.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 ${sn.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 Ar(e,t){ln(()=>{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=Lr({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 x=f.left-u.left;x&&(i.translate=`${x}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function Tr(e){return e.split(" ").map(t=>t==="left-0"?"right-0":t).join(" ")}function Or({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:s,listRef:l,ariaLabel:u,align:c="start"}){let f=Ir[t],x=j(null);return Ar(x,n.length),Z("ul",{ref:d=>{x.current=d,l&&(l.current=d)},id:e,role:"listbox","aria-label":u,...f.pickerMarker?{"data-picker-menu":""}:{},className:c==="end"?Tr(f.list):f.list,children:n.map((d,N)=>{let w=d.value===r;return Z("li",{id:`${e}-${N}`,role:"option","aria-selected":w,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(N),onMouseDown:m=>{m.preventDefault(),d.disabled||s(d.value)},className:f.item(N===o,w&&d.value!=="",!!d.disabled,N===n.length-1),style:f.itemStyle?.(w),children:d.meta===void 0?d.label:un(Dr,{children:[d.lead,Z("span",{className:"flex-1 whitespace-nowrap",children:d.label}),Z("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${N}`)})})}function Mr({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:s,id:l,"aria-label":u,align:c}){let f=_r.toArray(r).flatMap(m=>{if(!Rr(m))return[];if(m.type!=="option")return[];let E=m.props,F=E.value!==void 0?String(E.value):"",L=E.children,_=typeof L=="string"||typeof L=="number"?String(L):F;return[{value:F,label:_,disabled:!!E.disabled}]}),x=e??"",d=kr({items:f,value:x,onPick:m=>t?.({target:{value:m}})}),w=f.find(m=>m.value===x)?.label??f[0]?.label??"";return un("div",{ref:d.wrapRef,className:"relative",children:[s&&Z("input",{type:"hidden",name:s,value:x}),Z("button",{ref:m=>{d.triggerRef.current=m},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:m=>!n&&d.onTriggerKeyDown(m),className:`block w-full ${o??""}`,style:i,children:Z("span",{className:"block w-full truncate text-left",children:w})}),d.open&&Z(Or,{id:d.listId,tone:"select",items:f,value:x,focusIdx:d.focusIdx,onFocus:d.setFocusIdx,onPick:d.pick,listRef:d.listRef,align:c})]})}import{jsx as Pe,jsxs as He}from"react/jsx-runtime";var Fr="font-mono text-[length:var(--size-label,12px)]",Ur="font-semibold uppercase tracking-[0.22em] text-fg";function cn(e){return`${e??Fr} ${Ur}`}function dn(){return Pe("span",{className:"text-accent",children:" *"})}function $r({children:e,required:t,labelFace:n}){return He("span",{className:cn(n),children:[e,t?Pe(dn,{}):null]})}function Hr({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?He("div",{className:u,children:[He("label",{htmlFor:o,className:cn(i),children:[e,t?Pe(dn,{}):null]}),l,c]}):He("label",{htmlFor:o,className:u,children:[Pe($r,{required:t,labelFace:i,children:e}),l]})}var la="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{At as a,io as b,ao as c,so as d,wt as e,Xe as f,Br as g,qr as h,Wr as i,Gr as j,Cn as k,xn as l,Kr as m,zr as n,Ve as o,Ae as p,ce as q,Xr as r,Vr as s,Te as t,Ln as u,kn as v,fo as w,po as x,Ft as y,je as z,mo as A,go as B,An as C,ho as D,yo as E,Tn as F,bo as G,Mn as H,Co as I,xo as J,Ut as K,_o as L,Ro as M,No as N,Io as O,Ao as P,Jr as Q,It as R,eo as S,Oe as T,Je as U,Ko as V,Qt as W,si as X,ar as Y,ui as Z,_i as _,Ri as $,hr as aa,Oi as ba,nn as ca,Mi as da,br as ea,Di as fa,xr as ga,Li as ha,Sr as ia,Wi as ja,Gi as ka,Er as la,Vi as ma,Qi as na,kr as oa,Or as pa,Mr as qa,$r as ra,Hr as sa,la as ta};
|