efficient-storefront-blocks 0.47.0 → 0.48.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 +20 -0
- package/dist/chunks/{EditorPreviewCheckout-33A6G6NG.js → EditorPreviewCheckout-KOPGAH7L.js} +1 -1
- package/dist/chunks/{SiteEditorProvider-F3CFXIIO.js → SiteEditorProvider-QS2PKQJ6.js} +1 -1
- package/dist/chunks/chunk-HOORZY5J.js +1 -0
- package/dist/chunks/chunk-MTNZH7OX.js +255 -0
- package/dist/chunks/{chunk-IAV6LRGK.js → chunk-S3SSECGB.js} +1 -1
- package/dist/chunks/{chunk-PNTJHDOO.js → chunk-VIRWFFWD.js} +1 -1
- package/dist/chunks/{fitment-data-2FUV22CG.js → fitment-data-ZOKPAVMT.js} +1 -1
- package/dist/contract.js +1 -1
- package/dist/editor.css +1 -1
- package/dist/index.d.ts +21 -91
- package/dist/index.js +83 -60
- package/dist/words.d.ts +2 -1
- package/dist/words.js +3 -3
- package/package.json +2 -2
- package/dist/chunks/chunk-C6CQWBF7.js +0 -255
- package/dist/chunks/chunk-OUTUANSR.js +0 -1
- /package/dist/chunks/{SectionEditorShell-3ZKNO54T.js → SectionEditorShell-KMWXI5OZ.js} +0 -0
- /package/dist/chunks/{chunk-64T5EISP.js → chunk-5P3HGIOR.js} +0 -0
- /package/dist/chunks/{chunk-C6CQWBF7.js.LEGAL.txt → chunk-MTNZH7OX.js.LEGAL.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as V,e as z,i as j,k as T,p as $,q as Z,s as O}from"./chunk-64T5EISP.js";var B="".replace(/\/+$/,"");var U="x-forwarded-for";function Q(e){let t=(e??"").split(",").map(r=>r.trim()).filter(Boolean);return t.length>0?t[t.length-1]:null}var Ee="x-forwarded-host";function X(e,t,r){let n={};return e&&(n[Ee]=e),t&&r==="uncached"&&(n[U]=t),n}function Y(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 ee="x-storefront-site",te="x-storefront-host",re="x-storefront-preview";var ne={contentHash:"81f2e3c31abcbfd9",schema:1,mediaFields:{ImageBlock:["src"],LogoBlock:["src"],Flex:["bgImage","bgImagePhone"],FeaturedCover:["image"],LongRead:["image"],Banner:["imageSrc"],Timeline:["imageSrc"],Logos:["items[].src"],ContactLocations:["locations[].photo"],HeroSingle:["imageFocal","mediaImage","mediaImage2","mediaVideo","poster"],HeroSlide:["mediaImage","mediaVideo","poster"],PostCard:["image"],Gallery:["othersCards[].image","othersCards[].photos[].src","vehicleCards[].image","vehicleCards[].photos[].src","wheelCards[].image","wheelCards[].photos[].src"],GalleryItem:["image","photos[].src"],Manifesto:["imageSrc"],SectionHeader:["logoSrc"],IntroBleed:["imageSrc","imageSrcMobile"],Split:["imageSrc","textBgSrc"],ProcessSteps:["steps[].image"],DetailRows:["rows[].image"],PaymentBadges:["badges[].src"]},mediaKeyNames:["bgImage","bgImagePhone","image","imageFocal","imageSrc","imageSrcMobile","logoSrc","mediaImage","mediaImage2","mediaVideo","photo","poster","src","textBgSrc"],snapshotObjects:{ProductGrid:{source:{keep:["slug"]}},GalleryItem:{product:{keep:["code","finish"]}},FeaturedCover:{source:{keep:["slug"]}},LongRead:{source:{keep:["slug"]}}},hydratedLists:{Events:["posts"],SubscribeBlogs:["posts"]},technicalStateKeys:["focal","focalPhone","imageFocal","imageFocal2","imageFocal2Phone","imageFocalPhone"]};var $e="shop_access_token",se="shop_refresh_token",L=null;function N(){O.removeItem($e),O.removeItem(se)}var w={getAccess(){return L},takeLegacyRefresh(){let e=O.getItem(se);return N(),e},setTokens(e){L=e,N()},clear(){L=null,N()}};function Be(e){return!!e.src}function A(e){let t=e.finishes.filter(Be);if(t.length===e.finishes.length)return e;let r=e.defaultFinish&&t.some(n=>n.name===e.defaultFinish)?e.defaultFinish:null;return{...e,finishes:t,defaultFinish:r}}function Ue(e){return e.listable!==!1}function M(e){return e.map(A).filter(Ue)}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,de=new RegExp(`(?<![-\\w])(${ce.join("|")})(\\s*=\\s*)(["'])([^"']*)\\3`,"gi"),pe=new RegExp(`((?:^|[;{\\s"'])(?:${ce.join("|")})\\s*:\\s*)([^;}"'<>]+)`,"gi"),Le=/<svg\b([^>]*)>/i,Ne=/\bfill\s*[=:]/i;function Me(e){let t=e.replace(de,(r,n,a,l,p)=>{let i=ie(p);return i===null?r:`${n}${a}${l}${i}${l}`}).replace(pe,(r,n,a)=>{let l=ie(a);return l===null?r:`${n}${l}`});return t=t.replace(Le,(r,n)=>Ne.test(n)?r:`<svg fill="#ffffff"${n}>`),t}function ie(e){let t=/!important/i.test(e),r=e.replace(/!important/gi,"").trim().toLowerCase();if(!r||me.test(r)||le.has(r))return null;let n=r in v?[...v[r],1]:ge(r);if(!n)return null;let[a,l,p,i]=n;if(Math.max(a,l,p)-Math.min(a,l,p)>ue)return null;let s=He(255-a,255-l,255-p,i);return t?`${s} !important`:s}function He(e,t,r,n){if(n<1)return`rgba(${e}, ${t}, ${r}, ${n})`;let a=l=>l.toString(16).padStart(2,"0");return`#${a(e)}${a(t)}${a(r)}`}function ge(e){return e.startsWith("#")?De(e):e.startsWith("rgb")?We(e):e.startsWith("hsl")?Ge(e):null}function De(e){let t=e.slice(1),r=1;if(t.length===3||t.length===4)t.length===4&&(r=parseInt(t[3]+t[3],16)/255),t=t.slice(0,3).split("").map(n=>n+n).join("");else if(t.length===6||t.length===8)t.length===8&&(r=parseInt(t.slice(6,8),16)/255),t=t.slice(0,6);else return null;return/^[0-9a-f]{6}$/.test(t)?[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),r]:null}function We(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[r,n]=t.split("/"),a=r.split(/[\s,]+/).filter(Boolean).slice(0,3);if(a.length<3)return null;let l=a.map(i=>i.endsWith("%")?Math.round(parseFloat(i)/100*255):Math.round(parseFloat(i)));if(l.some(i=>Number.isNaN(i)))return null;let p=n?I(n):Je(r);return[l[0],l[1],l[2],p]}function Je(e){let t=e.split(/[\s,]+/).filter(Boolean);return t.length>=4?I(t[3]):1}function I(e){let t=e.trim().endsWith("%")?parseFloat(e)/100:parseFloat(e);return Number.isNaN(t)?1:t}function Ge(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[r,n]=t.split("/"),a=r.split(/[\s,]+/).filter(Boolean);if(a.length<3)return null;let l=parseFloat(a[0]),p=parseFloat(a[1])/100,i=parseFloat(a[2])/100;if([l,p,i].some(P=>Number.isNaN(P)))return null;let s=n?I(n):a.length>=4?I(a[3]):1,[o,u,g]=Ke(l,p,i);return[o,u,g,s]}function Ke(e,t,r){let n=(1-Math.abs(2*r-1))*t,a=(e%360+360)%360/60,l=n*(1-Math.abs(a%2-1)),p=0,i=0,s=0;a<1?[p,i,s]=[n,l,0]:a<2?[p,i,s]=[l,n,0]:a<3?[p,i,s]=[0,n,l]:a<4?[p,i,s]=[0,l,n]:a<5?[p,i,s]=[l,0,n]:[p,i,s]=[n,0,l];let o=r-n/2;return[Math.round((p+o)*255),Math.round((i+o)*255),Math.round((s+o)*255)]}var oe=512*1024;function H(e){return/\.svg(\?|$)/i.test(e)}function Ve(e){return`data:image/svg+xml,${encodeURIComponent(Me(e))}`}function ze(e){let t=e.replace(/!important/gi,"").trim().toLowerCase();if(!t||me.test(t)||le.has(t))return null;let r=t in v?[...v[t],1]:ge(t);if(!r)return null;let[n,a,l]=r;return Math.max(n,a,l)-Math.min(n,a,l)>ue?null:(.2126*n+.7152*a+.0722*l)/255}function je(e){let t=[],r=n=>{let a=ze(n);a!==null&&t.push(a)};for(let n of e.matchAll(de))r(n[4]);for(let n of e.matchAll(pe))r(n[2]);return t.length?t.reduce((n,a)=>n+a,0)/t.length<.5:null}var ae=/^(?:\uFEFF|\s+|<\?xml[^>]*\?>|<!--[\s\S]*?-->|<!DOCTYPE\s+svg[^>[]*>)/i;function Ze(e){let t=e;for(let r=ae.exec(t);r&&r[0].length>0;r=ae.exec(t))t=t.slice(r[0].length);return/^<svg[\s>/]/i.test(t)}async function Qe(e,t){if(!H(e))return null;try{let r=await fetch(e,{signal:t,redirect:"manual"});if(!r.ok)return null;let n=Number(r.headers.get("content-length"));if(Number.isFinite(n)&&n>oe)return null;let a=await r.text();return a.length>oe?null:Ze(a)?a:null}catch{return null}}async function he(e,t){let r=await Qe(e,t);return r===null?null:{reversed:Ve(r),inkIsDark:je(r)}}function ye(){return V().siteId()}var Xe="",f=class extends Error{constructor(t,r,n){super(r),this.status=t,this.data=n}},J="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.",Ye=new Set([502,503,504]),D=0,et="This editor runs on its host's own backend, which does not serve this request.",tt=5e3,rt=15e3,nt=()=>typeof window>"u"?tt:rt;function _e(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(nt())}var fe=e=>e instanceof Error&&e.name==="TimeoutError",Se=(e,t)=>Ye.has(e)?J:t,st=["admin","venue"],Ce="admin";function Yt(e){Ce=st.includes(e)?e:"admin"}function it(){return Ce}var ot=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/,xe=null;function er(e){xe=e&&ot.test(e)?e:null}function at(){return xe}function ct(e){if(typeof window>"u"||!e.startsWith("/api/v1/"))return e;let t=$();return!t||/[?&]site=/.test(e)?e:q(e,`site=${encodeURIComponent(t)}`)}async function c(e,t={}){let{token:r,baseUrl:n,headers:a,audience:l,...p}=t;if(typeof window<"u"&&!z())throw new f(D,et,null);if(typeof window>"u"&&n===void 0)throw new Error(`apiFetch(${JSON.stringify(e)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);let i=typeof FormData<"u"&&p.body instanceof FormData,s;try{s=await fetch(`${n??Xe}${ct(e)}`,{...p,headers:{...i?{}:{"Content-Type":"application/json"},...r?{Authorization:`Bearer ${r}`}:{},...l===null?{}:{"X-Portal-Audience":l??"shop"},...a},signal:p.signal??_e({...p,audience:l})})}catch(g){throw g instanceof TypeError||fe(g)?new f(D,J,null):g}let o;try{o=await s.text()}catch(g){throw fe(g)?new f(D,J,null):g}let u=null;if(o)try{u=JSON.parse(o)}catch{throw new f(s.status,s.ok?"Expected JSON but received a non-JSON response":Se(s.status,s.statusText),o)}if(!s.ok){let g=(u&&typeof u=="object"&&"detail"in u&&typeof u.detail=="string"?u.detail:null)??Se(s.status,s.statusText);throw new f(s.status,g,u)}return u}var R=null;async function ke(){return R||(R=lt().finally(()=>{R=null}),R)}async function lt(){let e=w.takeLegacyRefresh(),t=await ut.refresh(e??void 0);return w.setTokens(t.access),t.access}async function Te(){return w.getAccess()??ke()}async function h(e,t={}){let r;try{r=await Te()}catch{throw w.clear(),new f(401,"Not signed in",null)}try{return await c(e,{...t,token:r})}catch(n){if(!(n instanceof f)||n.status!==401)throw n;try{let a=await ke();return await c(e,{...t,token:a})}catch{throw w.clear(),n}}}async function Pe(e,t={}){if(w.getAccess())try{return{data:await h(e,t),asShopper:!0}}catch(r){if(!(r instanceof f)||r.status!==401)throw r}return{data:await c(e,t),asShopper:!1}}async function we(){let e=await h("/api/auth/me/");if(e.portal!=="shop")throw w.clear(),new f(403,"This session is not valid for this shop.",null);return e}var ut={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 Te();return await we(),e},me:we,updateMe:e=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify(e)}),changePassword:(e,t)=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:t,old_password:e})}),changeEmail:(e,t)=>h("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:e,current_password:t})}),myProfile:()=>h("/api/shop-portal/profile/"),updateMyProfile:e=>h("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(e)}),myAddresses:()=>h("/api/shop-portal/delivery-locations/"),createAddress:e=>h("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(e)}),updateAddress:(e,t)=>h(`/api/shop-portal/delivery-locations/${e}/`,{method:"PATCH",body:JSON.stringify(t)}),deleteAddress:e=>h(`/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,r)=>c("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:e,token:t,new_password:r})}),brands:()=>h("/api/products/brands/"),myOrders:()=>h("/api/shop-portal/orders/").then(e=>e.results),myOrder:e=>h(`/api/shop-portal/orders/${e}/`),cancelOrder:e=>h(`/api/shop-portal/orders/${e}/cancel/`,{method:"POST"}),myReturns:e=>h(`/api/shop-portal/returns/${e?`?order=${encodeURIComponent(e)}`:""}`).then(t=>t.results),createReturn:e=>h("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(e)}),withdrawReturn:e=>h(`/api/shop-portal/returns/${e}/cancel/`,{method:"POST"}),uploadReturnPhoto:(e,t)=>{let r=new FormData;return r.append("claim_item",e),r.append("file",t),r.append("media_type",t.type.startsWith("video/")?"video":"image"),h("/api/shop-portal/return-media/",{method:"POST",body:r})}};function S(e){if(typeof e=="string")return e.startsWith("/media/")?j(e):e;if(Array.isArray(e))return e.map(S);if(e&&typeof e=="object"){let t={};for(let[r,n]of Object.entries(e))t[r]=r==="captions"&&n&&typeof n=="object"&&!Array.isArray(n)?Object.fromEntries(Object.entries(n).map(([a,l])=>[S(a),l])):S(n);return t}return e}var Oe=typeof window>"u"&&B!=="",mt=Oe?B:"",dt=Z,b=()=>({baseUrl:dt(),audience:null});function m(e,t){let r=t?`?process=${encodeURIComponent(t)}`:"";return`/api/v1${e}${r}`}var pt=100,be=50;function ve(e,t,r){let n=new URLSearchParams;for(let[a,l]of Object.entries(t))l!=null&&l!==""&&n.set(a,String(l));return n.set("pageSize",String(pt)),r&&n.set("cursor",r),`/api/v1${e}?${n.toString()}`}function gt(e,t){return ve("/wheels",{process:e},t)}function ht(e,t,r){return ve("/products",{kind:e.join(","),make:t?.make,model:t?.model,year:t?.year,modification:t?.modification},r)}function yt(e){if(!e)return null;try{return new URL(e,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function Ae(e,t,r=()=>!1){let n=[],a=null;try{for(let l=0;l<be;l++){let p=await c(await t(a),await d());if(n.push(...p.results),a=yt(p.next),!a)break}a&&console.warn(`[${e}] stopped at ${be} pages (${n.length} rows); catalog may be truncated`)}catch(l){if(r(l))throw l;console.warn(`[${e}] product API unavailable, returning []`,l)}return n}var ft=e=>e instanceof f&&e.status===400;function St(e){return e.flatMap(t=>t.kind==="alloy-wheel"?M([t]):[t])}async function Ie(){return(await Pt()).host}async function Pt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js"),t=await e(),r=l=>l?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,n=r(t.get(te)??t.get("x-forwarded-host")??t.get("host")),a=r(t.get("host"));return{host:n,matchesRequestHost:n!==null&&n===a}}catch{return{host:null,matchesRequestHost:!1}}}async function wt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return Q((await e()).get(U))}catch{return null}}async function bt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(ee)||null}catch{return null}}async function At(){let e=await bt();if(e)return`site=${encodeURIComponent(e)}`;let t=await Ie();return t?`host=${encodeURIComponent(t)}`:""}async function y(e){if(typeof window<"u"){let t=$();return t?q(e,`site=${encodeURIComponent(t)}`):e}return q(e,await At())}function q(e,t){return t?`${e}${e.includes("?")?"&":"?"}${t}`:e}var Rt="preview";async function _t(){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 W(e,t){let r=await _t();if(r===null)return[await y(e),await d(t)];let n=q(await y(e),`${Rt}=${encodeURIComponent(r)}`),{next:a,cache:l,...p}=t??{},i=await d({...p,cache:"no-store"}),s=await Ct();return s&&(i.headers={...i.headers,"user-agent":s}),[n,i]}async function xt(e){if(!Oe)return;let[t,r]=await Promise.all([Ie(),wt()]),n=X(t,r,e);return Object.keys(n).length>0?n:void 0}async function d(e){let t=await xt(Y(e)),r={baseUrl:mt,...e};return t&&(r.headers={...t,...e?.headers}),r}var _=typeof window>"u";function C(e,t){let r=new URLSearchParams;for(let[a,l]of Object.entries(t))l!==void 0&&l!==""&&r.set(a,String(l));let n=r.toString();return`/api/v1/fitment${e}${n?`?${n}`:""}`}var ir={listMakes:async e=>{if(_){let{fitmentData:r}=await import("./fitment-data-2FUV22CG.js");return r.makes(e)}return(await c(C("/makes",{region:e}),b())).results},listModels:async(e,t)=>{if(_){let{fitmentData:n}=await import("./fitment-data-2FUV22CG.js");return n.models(e,t)}return(await c(C("/models",{make:e,region:t}),b())).results},listYears:async(e,t,r)=>{if(_){let{fitmentData:a}=await import("./fitment-data-2FUV22CG.js");return a.years(e,t,r)}return(await c(C("/years",{make:e,model:t,region:r}),b())).results},listModifications:async(e,t,r,n)=>{if(_){let{fitmentData:l}=await import("./fitment-data-2FUV22CG.js");return l.modifications(e,t,r,n)}return(await c(C("/modifications",{make:e,model:t,year:r,region:n}),b())).results},getStockFitment:async(e,t,r,n,a)=>{if(_){let{fitmentData:l}=await import("./fitment-data-2FUV22CG.js");return l.stockFitment(e,t,r,n,a)}return c(C("/stock-fitment",{make:e,model:t,year:r,modification:n,region:a}),b())}},or={listWheels:async e=>{let t=await Ae("products.listWheels",async r=>await y(gt(e,r)));return M(S(t))},listCatalog:async(e,t)=>{if(e.length===0)throw new Error("products.listCatalog() needs at least one kind. An empty list would omit `kind`, which the contract reads as `alloy-wheel` \u2014 so the call would silently return the wheel catalog instead of nothing.");let r=await Ae("products.listCatalog",async n=>await y(ht(e,t,n)),ft);return St(S(r))},getWheel:async e=>A(S(await c(await y(m(`/wheels/${e}`)),await d()))),getTyre:async e=>S(await c(await y(m(`/tyres/${e}`)),await d())),listBundles:async()=>{try{return await c(await y(m("/bundles")),await d())}catch{return[]}},getBundle:async e=>c(await y(m(`/bundles/${e}`)),await d()),listGalleryBuilds:async(e={})=>{let{process:t=null,wheelSlug:r=null}=e;if(typeof window>"u"){let{listGalleryBuilds:n}=await import("./gallery-builds-data-TD3QJK7L.js");return S(n(t,r))}try{let n=new URLSearchParams;t&&n.set("process",t),r&&n.set("wheelSlug",r);let a=n.toString(),l=await c(`/api/v1/gallery-builds${a?`?${a}`:""}`,b());return S(l.results)}catch(n){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",n),[]}},getSite:async()=>c(await y(m("/site")),await d()),getSiteBySlug:async e=>c(`${m("/site")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await d():void 0),listBrands:async()=>{try{return(await c(await y(m("/brands")),await d())).results??[]}catch(e){return console.warn("[products.listBrands] product API unavailable, returning []",e),[]}},listBrandsForSite:async e=>(await c(`${m("/brands")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await d():void 0)).results??[],listPages:async()=>S(await c(await y(m("/pages")),await d())),listProductTemplates:async()=>{try{return await c(await y(m("/product-templates")),await d())}catch(e){return console.warn("[products.listProductTemplates] unavailable, returning []",e),[]}},listDynamicPages:async e=>{let t=e?`?recordType=${encodeURIComponent(e)}`:"";try{return await c(await y(`${m("/dynamic-pages")}${t}`),await d())}catch(r){if(r instanceof f&&r.status===404)return[];throw r}},getRecord:async(e,t)=>{try{return await c(await y(m(`/records/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)),await d())}catch(r){if(r instanceof f&&r.status===404)return null;throw r}},listRecordKeys:async e=>{try{let t=await c(await y(m(`/records/${encodeURIComponent(e)}`)),await d({cache:"no-store"}));return Array.isArray(t?.keys)?t.keys.filter(r=>typeof r=="string"&&r!==""):[]}catch(t){if(t instanceof f&&t.status===404)return[];throw t}},listProductTypeChoices:async()=>{try{return await c(await y(m("/product-type-choices")),await d())}catch(e){return console.warn("[products.listProductTypeChoices] unavailable, returning []",e),[]}},listFieldUsage:async()=>{try{return await c(await y(m("/field-usage")),await d())}catch(e){return console.warn("[products.listFieldUsage] unavailable, returning []",e),[]}},getPage:async(e,t={})=>{let r=t.record?`?record=${encodeURIComponent(t.record)}`:"",[n,a]=await W(m(`/pages/${e}`)+r,t.revalidate!==void 0?{next:{revalidate:t.revalidate}}:void 0);return S(await c(n,a))},listBlogPosts:async()=>{try{return(await c(m("/blog-posts"),await d())).map(t=>({...t,coverImage:T(t.coverImage)??""}))}catch(e){return console.warn("[products.listBlogPosts] blog API unavailable, returning []",e),[]}},getBlogPost:async e=>{let t=await c(m(`/blog-posts/${e}`),await d());return{...t,coverImage:T(t.coverImage)??""}},createOrder:async e=>c(m("/orders"),await d({method:"POST",body:JSON.stringify(e)})),createOrderAuthed:async e=>h(m("/orders"),await d({method:"POST",body:JSON.stringify(e)})),lookupOrder:async e=>c(m("/orders/lookup"),await d({method:"POST",body:JSON.stringify(e)})),createPaymentIntent:async e=>c(m("/payments/intent"),await d({method:"POST",body:JSON.stringify(e)})),createPaypalOrder:async e=>c(m("/payments/paypal/order"),await d({method:"POST",body:JSON.stringify(e)})),capturePaypalOrder:async e=>c(m("/payments/paypal/capture"),await d({method:"POST",body:JSON.stringify(e)})),createAfterpayCheckout:async e=>c(m("/payments/afterpay/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureAfterpayPayment:async e=>c(m("/payments/afterpay/capture"),await d({method:"POST",body:JSON.stringify(e)})),chargeSquare:async e=>c(m("/payments/square/charge"),await d({method:"POST",body:JSON.stringify(e)})),createGocardlessBillingRequest:async e=>c(m("/payments/gocardless/billing-request"),await d({method:"POST",body:JSON.stringify(e)})),completeGocardlessPayment:async e=>c(m("/payments/gocardless/complete"),await d({method:"POST",body:JSON.stringify(e)})),createZipCheckout:async e=>c(m("/payments/zip/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureZipPayment:async e=>c(m("/payments/zip/capture"),await d({method:"POST",body:JSON.stringify(e)})),createKlarnaCheckout:async e=>c(m("/payments/klarna/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureKlarnaPayment:async e=>c(m("/payments/klarna/capture"),await d({method:"POST",body:JSON.stringify(e)})),createStockAlert:async e=>c(m("/stock-alerts"),await d({method:"POST",body:JSON.stringify(e)})),createPreOrderIntent:async e=>c(m("/pre-order-intents"),await d({method:"POST",body:JSON.stringify(e)})),createNewsletterSubscription:async e=>c(m("/newsletter-subscriptions"),await d({method:"POST",body:JSON.stringify(e)})),unsubscribeNewsletter:async e=>c(m("/newsletter-unsubscribe"),await d({method:"POST",body:JSON.stringify(e)})),captureCart:async e=>c(m("/carts"),await d({method:"POST",body:JSON.stringify(e)})),restoreCart:async e=>c(m("/carts/restore"),await d({method:"POST",body:JSON.stringify(e)})),unsubscribeCartReminders:async e=>c(m("/carts/unsubscribe"),await d({method:"POST",body:JSON.stringify(e)})),listReviews:async(e={})=>{let t=new URLSearchParams;e.limit&&t.set("limit",String(e.limit)),e.designCode&&t.set("designCode",e.designCode);let r=m("/reviews"),n=t.toString();try{return await c(await y(n?`${r}?${n}`:r),await d())}catch(a){return console.warn("[products.listReviews] product API unavailable, returning []",a),[]}},submitReview:async e=>c(m("/reviews"),await d({method:"POST",body:JSON.stringify(e)})),getForm:async e=>c(m(`/forms/${encodeURIComponent(e)}`),await d()),submitForm:async(e,t)=>c(m(`/forms/${encodeURIComponent(e)}/submissions`),await d({method:"POST",body:JSON.stringify(t)})),listShippingMethods:async()=>{try{return await c(m("/shipping-methods"),await d())}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 d())}catch(t){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",t),[]}},quoteCart:async e=>{let t=m("/cart/quote"),r=await d({method:"POST",body:JSON.stringify(e)});return e.couponCode?(await Pe(t,r)).data:c(t,r)},validateCoupon:async e=>{let{data:t,asShopper:r}=await Pe(m("/coupons/validate"),await d({method:"POST",body:JSON.stringify(e)}));return{...t,askedAsShopper:r}},getHeaderSettings:async()=>{let e=_e({method:"GET"}),t=await c(...await W(m("/header-settings"),{signal:e})),r=T(t.logoUrl),n=null,a=null;if(r&&H(r)){let l=await he(r,e);l&&(n=l.reversed,a=l.inkIsDark)}return{...t,logoUrl:r,logoReversed:n,logoInkIsDark:a}},getThemeSettings:async()=>c(...await W(m("/theme-settings"))),getChatSettings:async()=>c(await y(m("/chat-settings")),await d())},ar={listServices:async()=>{try{return await c(m("/bookings/services"),await d())}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 d()),create:async e=>c(m("/bookings"),await d({method:"POST",body:JSON.stringify(e)})),get:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}`),await d()),cancel:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}/cancel`),await d({method:"POST"})),createPaymentIntent:async e=>c(m("/bookings/payments/intent"),await d({method:"POST",body:JSON.stringify({manageToken:e})}))},G=class extends Error{constructor(r,n){super(`Slug "${r}" exists on ${n} websites; a site is required to pick one.`);this.slug=r;this.count=n;this.name="AmbiguousPageSlugError"}},F=(e,t,r)=>{let n=new URLSearchParams({...t?{site:t}:{},...r?{draft:"1"}:{}}).toString();return`/api/storefront/${e}/${n?`?${n}`:""}`},x=e=>`/api/storefront/sites/${encodeURIComponent(e)}/`,kt=e=>`${x(e)}currencies/`,Tt="/api/storefront/media/ingest/",K=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 Ot(){let e=ye();if(!e)throw new K;return`${Tt}?${new URLSearchParams({site:e})}`}var E={"X-Puck-Media-Manifest":ne.contentHash},cr=Fe({});function Fe(e){return(t,r={})=>{let n=at(),a=e.headers||n?{...n?{"Accept-Language":n}:{},...e.headers,...r.headers}:void 0;return c(t,{...r,...e.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...a?{headers:a}:{},audience:e.audience??it()})}}function vt(e={}){let t=Fe(e),r=e.siteDrafts===!0,n=i=>F("header-settings",i,r),a=i=>F("theme-settings",i,r),l=i=>F("chat-settings",i,r),p=i=>F("social-settings",i,r);return{findPageBySlug:async(i,s,o)=>{let u=new URLSearchParams({slug:i});o&&u.set("site",o);let g=await t(`/api/storefront/pages/?${u.toString()}`,{token:s}),P=Array.isArray(g)?g:g.results??[];if(!o&&P.length>1)throw new G(i,P.length);return P[0]??null},getPageById:(i,s)=>t(`/api/storefront/pages/${i}/`,{token:s}),saveLayout:(i,s,o,u,g)=>t(`/api/storefront/pages/${i}/`,{method:"PATCH",body:JSON.stringify({layout:s,expected_updated_at:u,...g?{client_id:g}:{}}),token:o}),createPagePreviewLink:(i,s)=>t(`/api/storefront/pages/${i}/preview-link/`,{method:"POST",token:s}),claimPageEditLock:(i,s,o,u=!1)=>t(`/api/storefront/pages/${i}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:o,takeover:u}),token:s}),releasePageEditLock:(i,s)=>t(`/api/storefront/pages/${i}/edit-lock/`,{method:"DELETE",token:s}),createTemplate:(i,s,o)=>t("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:i,layout:s}),headers:E,token:o}),getTemplate:(i,s)=>t(`/api/storefront/page-templates/${i}/`,{token:s}),saveTemplateLayout:(i,s,o)=>t(`/api/storefront/page-templates/${i}/`,{method:"PATCH",body:JSON.stringify({layout:s}),headers:E,token:o}),listTemplatePages:async(i,s)=>{let o=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(i)}`,{token:s});return Array.isArray(o)?o:o.results??[]},findTemplatePageBySlug:async(i,s,o)=>{let u=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(i)}&slug=${encodeURIComponent(s)}`,{token:o});return(Array.isArray(u)?u:u.results??[])[0]??null},createTemplatePage:(i,s,o)=>t("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:i,...s}),headers:E,token:o}),saveTemplatePageLayout:(i,s,o)=>t(`/api/storefront/template-pages/${i}/`,{method:"PATCH",body:JSON.stringify({layout:s}),headers:E,token:o}),deleteTemplatePage:(i,s,o)=>t(`/api/storefront/template-pages/${i}/`,{method:"DELETE",token:s,...o?.keepalive?{keepalive:!0}:{}}),listPages:async(i,s)=>{let o=new URLSearchParams({no_page:"true"});s&&o.set("site",s);let u=await t(`/api/storefront/pages/?${o.toString()}`,{token:i});return Array.isArray(u)?u:u.results??[]},createPage:(i,s,o,u)=>t("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:i,slug:s,layout:o}),token:u}),deletePage:(i,s)=>t(`/api/storefront/pages/${i}/`,{method:"DELETE",token:s}),getHeaderSettings:(i,s)=>t(n(s),{token:i}),listMenus:async(i,s)=>{let o=new URLSearchParams({no_page:"true"});s&&o.set("site",s);let u=await t(`/api/storefront/menus/?${o}`,{token:i});return Array.isArray(u)?u:u.results??[]},listBlogPosts:async(i,s={})=>{let o=new URLSearchParams({no_page:"true"});s.visibleOnly&&o.set("is_visible","true"),s.siteId&&o.set("site",s.siteId);let u=await t(`/api/storefront/blog-posts/?${o.toString()}`,{token:i});return Array.isArray(u)?u:u.results??[]},listFieldUsage:async(i,s)=>{let o=await t(`/api/storefront/field-usage/?site=${encodeURIComponent(s)}`,{token:i});return Array.isArray(o?.entries)?o.entries:[]},listCategories:async(i,s={})=>{let o=new URLSearchParams({no_page:"true"});s.visibleOnly&&o.set("is_visible","true"),s.siteId&&o.set("site",s.siteId);let u=await t(`/api/storefront/categories/?${o.toString()}`,{token:i});return[...Array.isArray(u)?u:u.results??[]].sort((P,k)=>P.sort_order-k.sort_order||P.name.localeCompare(k.name))},listForms:async(i,s={})=>{let o=new URLSearchParams({no_page:"true"});s.siteId&&o.set("site",s.siteId);let u=await t(`/api/storefront/forms/?${o.toString()}`,{token:i});return[...Array.isArray(u)?u:u.results??[]].sort((P,k)=>P.title.localeCompare(k.title))},listWheelSummaries:async(i,s={})=>{let o=new URLSearchParams;s.siteId&&o.set("site",s.siteId);let u=o.toString(),g=await t(`/api/storefront/wheel-curations/summaries/${u?`?${u}`:""}`,{token:i});return S(g)},listProducts:async(i,s={})=>{let o=new URLSearchParams;s.kinds?.length&&o.set("kind",s.kinds.join(",")),s.siteId&&o.set("site",s.siteId);let u=o.toString(),g=await t(`/api/storefront/products/${u?`?${u}`:""}`,{token:i});return S(g)},getWheelDetail:async(i,s,o={})=>{let u=new URLSearchParams({slug:s});return o.siteId&&u.set("site",o.siteId),A(S(await t(`/api/storefront/wheel-curations/detail/?${u.toString()}`,{token:i})))},updateHeaderSettings:(i,s,o)=>t(n(o),{method:"PATCH",body:JSON.stringify(i),token:s}),getSite:(i,s)=>t(x(i),{token:s}),listSites:async i=>{let s=await t("/api/storefront/sites/?no_page=true",{token:i});return Array.isArray(s)?s:s.results??[]},listSiteCurrencies:async(i,s)=>{let o=await t(kt(i),{token:s});return Array.isArray(o)?o:[]},publishSite:(i,s)=>t(`${x(i)}publish/`,{method:"POST",token:s}),getSiteLiveState:(i,s)=>t(`${x(i)}live-state/`,{token:s}),updateSite:(i,s,o)=>t(x(i),{method:"PATCH",body:JSON.stringify(s),token:o}),getThemeSettings:(i,s)=>t(a(s),{token:i}),updateThemeSettings:(i,s,o)=>t(a(o),{method:"PATCH",body:JSON.stringify(i),token:s}),getChatSettings:(i,s)=>t(l(s),{token:i}),updateChatSettings:(i,s,o)=>t(l(o),{method:"PATCH",body:JSON.stringify(i),token:s}),getSocialSettings:(i,s)=>t(p(s),{token:i}),updateSocialSettings:(i,s,o)=>t(p(o),{method:"PATCH",body:JSON.stringify(i),token:s}),uploadHeaderLogo:(i,s,o)=>{let u=new FormData;return u.append("logo",i),t(n(o),{method:"PATCH",body:u,token:s})},clearHeaderLogo:(i,s)=>t(n(s),{method:"PATCH",body:JSON.stringify({logo:null}),token:i}),setHeaderLogoFromAsset:(i,s,o)=>t(n(o),{method:"PATCH",body:JSON.stringify({logo_asset_id:i}),token:s}),uploadMedia:async(i,s)=>{let o=new FormData;return o.append("file",i),t(Ot(),{method:"POST",body:o,token:s})},listMedia:async(i,s)=>{let o=new URLSearchParams({no_page:"true"});s&&o.set("kind",s);let u=await t(`/api/storefront/media-assets/?${o.toString()}`,{token:i});return Array.isArray(u)?u:u.results??[]}}}var lr=vt({siteDrafts:!0});export{ne as a,B as b,X as c,Y as d,w as e,Be as f,H as g,ye as h,Xe as i,f as j,J as k,D as l,Yt as m,er as n,c as o,ut as p,Ie as q,Pt as r,wt as s,bt as t,_t as u,ir as v,or as w,ar as x,G as y,cr as z,lr as A};
|
|
1
|
+
import{c as V,e as z,i as j,k as T,p as $,q as Z,s as O}from"./chunk-5P3HGIOR.js";var B="".replace(/\/+$/,"");var U="x-forwarded-for";function Q(e){let t=(e??"").split(",").map(r=>r.trim()).filter(Boolean);return t.length>0?t[t.length-1]:null}var Ee="x-forwarded-host";function X(e,t,r){let n={};return e&&(n[Ee]=e),t&&r==="uncached"&&(n[U]=t),n}function Y(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 ee="x-storefront-site",te="x-storefront-host",re="x-storefront-preview";var ne={contentHash:"81f2e3c31abcbfd9",schema:1,mediaFields:{ImageBlock:["src"],LogoBlock:["src"],Flex:["bgImage","bgImagePhone"],FeaturedCover:["image"],LongRead:["image"],Banner:["imageSrc"],Timeline:["imageSrc"],Logos:["items[].src"],ContactLocations:["locations[].photo"],HeroSingle:["imageFocal","mediaImage","mediaImage2","mediaVideo","poster"],HeroSlide:["mediaImage","mediaVideo","poster"],PostCard:["image"],Gallery:["othersCards[].image","othersCards[].photos[].src","vehicleCards[].image","vehicleCards[].photos[].src","wheelCards[].image","wheelCards[].photos[].src"],GalleryItem:["image","photos[].src"],Manifesto:["imageSrc"],SectionHeader:["logoSrc"],IntroBleed:["imageSrc","imageSrcMobile"],Split:["imageSrc","textBgSrc"],ProcessSteps:["steps[].image"],DetailRows:["rows[].image"],PaymentBadges:["badges[].src"]},mediaKeyNames:["bgImage","bgImagePhone","image","imageFocal","imageSrc","imageSrcMobile","logoSrc","mediaImage","mediaImage2","mediaVideo","photo","poster","src","textBgSrc"],snapshotObjects:{ProductGrid:{source:{keep:["slug"]}},GalleryItem:{product:{keep:["code","finish"]}},FeaturedCover:{source:{keep:["slug"]}},LongRead:{source:{keep:["slug"]}}},hydratedLists:{Events:["posts"],SubscribeBlogs:["posts"]},technicalStateKeys:["focal","focalPhone","imageFocal","imageFocal2","imageFocal2Phone","imageFocalPhone"]};var $e="shop_access_token",se="shop_refresh_token",L=null;function N(){O.removeItem($e),O.removeItem(se)}var w={getAccess(){return L},takeLegacyRefresh(){let e=O.getItem(se);return N(),e},setTokens(e){L=e,N()},clear(){L=null,N()}};function Be(e){return!!e.src}function A(e){let t=e.finishes.filter(Be);if(t.length===e.finishes.length)return e;let r=e.defaultFinish&&t.some(n=>n.name===e.defaultFinish)?e.defaultFinish:null;return{...e,finishes:t,defaultFinish:r}}function Ue(e){return e.listable!==!1}function M(e){return e.map(A).filter(Ue)}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,de=new RegExp(`(?<![-\\w])(${ce.join("|")})(\\s*=\\s*)(["'])([^"']*)\\3`,"gi"),pe=new RegExp(`((?:^|[;{\\s"'])(?:${ce.join("|")})\\s*:\\s*)([^;}"'<>]+)`,"gi"),Le=/<svg\b([^>]*)>/i,Ne=/\bfill\s*[=:]/i;function Me(e){let t=e.replace(de,(r,n,a,l,p)=>{let i=ie(p);return i===null?r:`${n}${a}${l}${i}${l}`}).replace(pe,(r,n,a)=>{let l=ie(a);return l===null?r:`${n}${l}`});return t=t.replace(Le,(r,n)=>Ne.test(n)?r:`<svg fill="#ffffff"${n}>`),t}function ie(e){let t=/!important/i.test(e),r=e.replace(/!important/gi,"").trim().toLowerCase();if(!r||me.test(r)||le.has(r))return null;let n=r in v?[...v[r],1]:ge(r);if(!n)return null;let[a,l,p,i]=n;if(Math.max(a,l,p)-Math.min(a,l,p)>ue)return null;let s=He(255-a,255-l,255-p,i);return t?`${s} !important`:s}function He(e,t,r,n){if(n<1)return`rgba(${e}, ${t}, ${r}, ${n})`;let a=l=>l.toString(16).padStart(2,"0");return`#${a(e)}${a(t)}${a(r)}`}function ge(e){return e.startsWith("#")?De(e):e.startsWith("rgb")?Je(e):e.startsWith("hsl")?Ge(e):null}function De(e){let t=e.slice(1),r=1;if(t.length===3||t.length===4)t.length===4&&(r=parseInt(t[3]+t[3],16)/255),t=t.slice(0,3).split("").map(n=>n+n).join("");else if(t.length===6||t.length===8)t.length===8&&(r=parseInt(t.slice(6,8),16)/255),t=t.slice(0,6);else return null;return/^[0-9a-f]{6}$/.test(t)?[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),r]:null}function Je(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[r,n]=t.split("/"),a=r.split(/[\s,]+/).filter(Boolean).slice(0,3);if(a.length<3)return null;let l=a.map(i=>i.endsWith("%")?Math.round(parseFloat(i)/100*255):Math.round(parseFloat(i)));if(l.some(i=>Number.isNaN(i)))return null;let p=n?I(n):We(r);return[l[0],l[1],l[2],p]}function We(e){let t=e.split(/[\s,]+/).filter(Boolean);return t.length>=4?I(t[3]):1}function I(e){let t=e.trim().endsWith("%")?parseFloat(e)/100:parseFloat(e);return Number.isNaN(t)?1:t}function Ge(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[r,n]=t.split("/"),a=r.split(/[\s,]+/).filter(Boolean);if(a.length<3)return null;let l=parseFloat(a[0]),p=parseFloat(a[1])/100,i=parseFloat(a[2])/100;if([l,p,i].some(P=>Number.isNaN(P)))return null;let s=n?I(n):a.length>=4?I(a[3]):1,[o,u,g]=Ke(l,p,i);return[o,u,g,s]}function Ke(e,t,r){let n=(1-Math.abs(2*r-1))*t,a=(e%360+360)%360/60,l=n*(1-Math.abs(a%2-1)),p=0,i=0,s=0;a<1?[p,i,s]=[n,l,0]:a<2?[p,i,s]=[l,n,0]:a<3?[p,i,s]=[0,n,l]:a<4?[p,i,s]=[0,l,n]:a<5?[p,i,s]=[l,0,n]:[p,i,s]=[n,0,l];let o=r-n/2;return[Math.round((p+o)*255),Math.round((i+o)*255),Math.round((s+o)*255)]}var oe=512*1024;function H(e){return/\.svg(\?|$)/i.test(e)}function Ve(e){return`data:image/svg+xml,${encodeURIComponent(Me(e))}`}function ze(e){let t=e.replace(/!important/gi,"").trim().toLowerCase();if(!t||me.test(t)||le.has(t))return null;let r=t in v?[...v[t],1]:ge(t);if(!r)return null;let[n,a,l]=r;return Math.max(n,a,l)-Math.min(n,a,l)>ue?null:(.2126*n+.7152*a+.0722*l)/255}function je(e){let t=[],r=n=>{let a=ze(n);a!==null&&t.push(a)};for(let n of e.matchAll(de))r(n[4]);for(let n of e.matchAll(pe))r(n[2]);return t.length?t.reduce((n,a)=>n+a,0)/t.length<.5:null}var ae=/^(?:\uFEFF|\s+|<\?xml[^>]*\?>|<!--[\s\S]*?-->|<!DOCTYPE\s+svg[^>[]*>)/i;function Ze(e){let t=e;for(let r=ae.exec(t);r&&r[0].length>0;r=ae.exec(t))t=t.slice(r[0].length);return/^<svg[\s>/]/i.test(t)}async function Qe(e,t){if(!H(e))return null;try{let r=await fetch(e,{signal:t,redirect:"manual"});if(!r.ok)return null;let n=Number(r.headers.get("content-length"));if(Number.isFinite(n)&&n>oe)return null;let a=await r.text();return a.length>oe?null:Ze(a)?a:null}catch{return null}}async function he(e,t){let r=await Qe(e,t);return r===null?null:{reversed:Ve(r),inkIsDark:je(r)}}function ye(){return V().siteId()}var Xe="",f=class extends Error{constructor(t,r,n){super(r),this.status=t,this.data=n}},W="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.",Ye=new Set([502,503,504]),D=0,et="This editor runs on its host's own backend, which does not serve this request.",tt=5e3,rt=15e3,nt=()=>typeof window>"u"?tt:rt;function _e(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(nt())}var fe=e=>e instanceof Error&&e.name==="TimeoutError",Se=(e,t)=>Ye.has(e)?W:t,st=["admin","venue"],Ce="admin";function Yt(e){Ce=st.includes(e)?e:"admin"}function it(){return Ce}var ot=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/,xe=null;function er(e){xe=e&&ot.test(e)?e:null}function at(){return xe}function ct(e){if(typeof window>"u"||!e.startsWith("/api/v1/"))return e;let t=$();return!t||/[?&]site=/.test(e)?e:q(e,`site=${encodeURIComponent(t)}`)}async function c(e,t={}){let{token:r,baseUrl:n,headers:a,audience:l,...p}=t;if(typeof window<"u"&&!z())throw new f(D,et,null);if(typeof window>"u"&&n===void 0)throw new Error(`apiFetch(${JSON.stringify(e)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);let i=typeof FormData<"u"&&p.body instanceof FormData,s;try{s=await fetch(`${n??Xe}${ct(e)}`,{...p,headers:{...i?{}:{"Content-Type":"application/json"},...r?{Authorization:`Bearer ${r}`}:{},...l===null?{}:{"X-Portal-Audience":l??"shop"},...a},signal:p.signal??_e({...p,audience:l})})}catch(g){throw g instanceof TypeError||fe(g)?new f(D,W,null):g}let o;try{o=await s.text()}catch(g){throw fe(g)?new f(D,W,null):g}let u=null;if(o)try{u=JSON.parse(o)}catch{throw new f(s.status,s.ok?"Expected JSON but received a non-JSON response":Se(s.status,s.statusText),o)}if(!s.ok){let g=(u&&typeof u=="object"&&"detail"in u&&typeof u.detail=="string"?u.detail:null)??Se(s.status,s.statusText);throw new f(s.status,g,u)}return u}var R=null;async function ke(){return R||(R=lt().finally(()=>{R=null}),R)}async function lt(){let e=w.takeLegacyRefresh(),t=await ut.refresh(e??void 0);return w.setTokens(t.access),t.access}async function Te(){return w.getAccess()??ke()}async function h(e,t={}){let r;try{r=await Te()}catch{throw w.clear(),new f(401,"Not signed in",null)}try{return await c(e,{...t,token:r})}catch(n){if(!(n instanceof f)||n.status!==401)throw n;try{let a=await ke();return await c(e,{...t,token:a})}catch{throw w.clear(),n}}}async function Pe(e,t={}){if(w.getAccess())try{return{data:await h(e,t),asShopper:!0}}catch(r){if(!(r instanceof f)||r.status!==401)throw r}return{data:await c(e,t),asShopper:!1}}async function we(){let e=await h("/api/auth/me/");if(e.portal!=="shop")throw w.clear(),new f(403,"This session is not valid for this shop.",null);return e}var ut={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 Te();return await we(),e},me:we,updateMe:e=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify(e)}),changePassword:(e,t)=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:t,old_password:e})}),changeEmail:(e,t)=>h("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:e,current_password:t})}),myProfile:()=>h("/api/shop-portal/profile/"),updateMyProfile:e=>h("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(e)}),myAddresses:()=>h("/api/shop-portal/delivery-locations/"),createAddress:e=>h("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(e)}),updateAddress:(e,t)=>h(`/api/shop-portal/delivery-locations/${e}/`,{method:"PATCH",body:JSON.stringify(t)}),deleteAddress:e=>h(`/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,r)=>c("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:e,token:t,new_password:r})}),brands:()=>h("/api/products/brands/"),myOrders:()=>h("/api/shop-portal/orders/").then(e=>e.results),myOrder:e=>h(`/api/shop-portal/orders/${e}/`),cancelOrder:e=>h(`/api/shop-portal/orders/${e}/cancel/`,{method:"POST"}),myReturns:e=>h(`/api/shop-portal/returns/${e?`?order=${encodeURIComponent(e)}`:""}`).then(t=>t.results),createReturn:e=>h("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(e)}),withdrawReturn:e=>h(`/api/shop-portal/returns/${e}/cancel/`,{method:"POST"}),uploadReturnPhoto:(e,t)=>{let r=new FormData;return r.append("claim_item",e),r.append("file",t),r.append("media_type",t.type.startsWith("video/")?"video":"image"),h("/api/shop-portal/return-media/",{method:"POST",body:r})}};function S(e){if(typeof e=="string")return e.startsWith("/media/")?j(e):e;if(Array.isArray(e))return e.map(S);if(e&&typeof e=="object"){let t={};for(let[r,n]of Object.entries(e))t[r]=r==="captions"&&n&&typeof n=="object"&&!Array.isArray(n)?Object.fromEntries(Object.entries(n).map(([a,l])=>[S(a),l])):S(n);return t}return e}var Oe=typeof window>"u"&&B!=="",mt=Oe?B:"",dt=Z,b=()=>({baseUrl:dt(),audience:null});function m(e,t){let r=t?`?process=${encodeURIComponent(t)}`:"";return`/api/v1${e}${r}`}var pt=100,be=50;function ve(e,t,r){let n=new URLSearchParams;for(let[a,l]of Object.entries(t))l!=null&&l!==""&&n.set(a,String(l));return n.set("pageSize",String(pt)),r&&n.set("cursor",r),`/api/v1${e}?${n.toString()}`}function gt(e,t){return ve("/wheels",{process:e},t)}function ht(e,t,r){return ve("/products",{kind:e.join(","),make:t?.make,model:t?.model,year:t?.year,modification:t?.modification},r)}function yt(e){if(!e)return null;try{return new URL(e,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function Ae(e,t,r=()=>!1){let n=[],a=null;try{for(let l=0;l<be;l++){let p=await c(await t(a),await d());if(n.push(...p.results),a=yt(p.next),!a)break}a&&console.warn(`[${e}] stopped at ${be} pages (${n.length} rows); catalog may be truncated`)}catch(l){if(r(l))throw l;console.warn(`[${e}] product API unavailable, returning []`,l)}return n}var ft=e=>e instanceof f&&e.status===400;function St(e){return e.flatMap(t=>t.kind==="alloy-wheel"?M([t]):[t])}async function Ie(){return(await Pt()).host}async function Pt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js"),t=await e(),r=l=>l?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,n=r(t.get(te)??t.get("x-forwarded-host")??t.get("host")),a=r(t.get("host"));return{host:n,matchesRequestHost:n!==null&&n===a}}catch{return{host:null,matchesRequestHost:!1}}}async function wt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return Q((await e()).get(U))}catch{return null}}async function bt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(ee)||null}catch{return null}}async function At(){let e=await bt();if(e)return`site=${encodeURIComponent(e)}`;let t=await Ie();return t?`host=${encodeURIComponent(t)}`:""}async function y(e){if(typeof window<"u"){let t=$();return t?q(e,`site=${encodeURIComponent(t)}`):e}return q(e,await At())}function q(e,t){return t?`${e}${e.includes("?")?"&":"?"}${t}`:e}var Rt="preview";async function _t(){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 r=await _t();if(r===null)return[await y(e),await d(t)];let n=q(await y(e),`${Rt}=${encodeURIComponent(r)}`),{next:a,cache:l,...p}=t??{},i=await d({...p,cache:"no-store"}),s=await Ct();return s&&(i.headers={...i.headers,"user-agent":s}),[n,i]}async function xt(e){if(!Oe)return;let[t,r]=await Promise.all([Ie(),wt()]),n=X(t,r,e);return Object.keys(n).length>0?n:void 0}async function d(e){let t=await xt(Y(e)),r={baseUrl:mt,...e};return t&&(r.headers={...t,...e?.headers}),r}var _=typeof window>"u";function C(e,t){let r=new URLSearchParams;for(let[a,l]of Object.entries(t))l!==void 0&&l!==""&&r.set(a,String(l));let n=r.toString();return`/api/v1/fitment${e}${n?`?${n}`:""}`}var ir={listMakes:async e=>{if(_){let{fitmentData:r}=await import("./fitment-data-ZOKPAVMT.js");return r.makes(e)}return(await c(C("/makes",{region:e}),b())).results},listModels:async(e,t)=>{if(_){let{fitmentData:n}=await import("./fitment-data-ZOKPAVMT.js");return n.models(e,t)}return(await c(C("/models",{make:e,region:t}),b())).results},listYears:async(e,t,r)=>{if(_){let{fitmentData:a}=await import("./fitment-data-ZOKPAVMT.js");return a.years(e,t,r)}return(await c(C("/years",{make:e,model:t,region:r}),b())).results},listModifications:async(e,t,r,n)=>{if(_){let{fitmentData:l}=await import("./fitment-data-ZOKPAVMT.js");return l.modifications(e,t,r,n)}return(await c(C("/modifications",{make:e,model:t,year:r,region:n}),b())).results},getStockFitment:async(e,t,r,n,a)=>{if(_){let{fitmentData:l}=await import("./fitment-data-ZOKPAVMT.js");return l.stockFitment(e,t,r,n,a)}return c(C("/stock-fitment",{make:e,model:t,year:r,modification:n,region:a}),b())}},or={listWheels:async e=>{let t=await Ae("products.listWheels",async r=>await y(gt(e,r)));return M(S(t))},listCatalog:async(e,t)=>{if(e.length===0)throw new Error("products.listCatalog() needs at least one kind. An empty list would omit `kind`, which the contract reads as `alloy-wheel` \u2014 so the call would silently return the wheel catalog instead of nothing.");let r=await Ae("products.listCatalog",async n=>await y(ht(e,t,n)),ft);return St(S(r))},getWheel:async e=>A(S(await c(await y(m(`/wheels/${e}`)),await d()))),getTyre:async e=>S(await c(await y(m(`/tyres/${e}`)),await d())),listBundles:async()=>{try{return await c(await y(m("/bundles")),await d())}catch{return[]}},getBundle:async e=>c(await y(m(`/bundles/${e}`)),await d()),listGalleryBuilds:async(e={})=>{let{process:t=null,wheelSlug:r=null}=e;if(typeof window>"u"){let{listGalleryBuilds:n}=await import("./gallery-builds-data-TD3QJK7L.js");return S(n(t,r))}try{let n=new URLSearchParams;t&&n.set("process",t),r&&n.set("wheelSlug",r);let a=n.toString(),l=await c(`/api/v1/gallery-builds${a?`?${a}`:""}`,b());return S(l.results)}catch(n){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",n),[]}},getSite:async()=>c(await y(m("/site")),await d()),getSiteBySlug:async e=>c(`${m("/site")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await d():void 0),listBrands:async()=>{try{return(await c(await y(m("/brands")),await d())).results??[]}catch(e){return console.warn("[products.listBrands] product API unavailable, returning []",e),[]}},listBrandsForSite:async e=>(await c(`${m("/brands")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await d():void 0)).results??[],listPages:async()=>S(await c(await y(m("/pages")),await d())),listProductTemplates:async()=>{try{return await c(await y(m("/product-templates")),await d())}catch(e){return console.warn("[products.listProductTemplates] unavailable, returning []",e),[]}},listDynamicPages:async e=>{let t=e?`?recordType=${encodeURIComponent(e)}`:"";try{return await c(await y(`${m("/dynamic-pages")}${t}`),await d())}catch(r){if(r instanceof f&&r.status===404)return[];throw r}},getRecord:async(e,t)=>{try{return await c(await y(m(`/records/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)),await d())}catch(r){if(r instanceof f&&r.status===404)return null;throw r}},listRecordKeys:async e=>{try{let t=await c(await y(m(`/records/${encodeURIComponent(e)}`)),await d({cache:"no-store"}));return Array.isArray(t?.keys)?t.keys.filter(r=>typeof r=="string"&&r!==""):[]}catch(t){if(t instanceof f&&t.status===404)return[];throw t}},listProductTypeChoices:async()=>{try{return await c(await y(m("/product-type-choices")),await d())}catch(e){return console.warn("[products.listProductTypeChoices] unavailable, returning []",e),[]}},listFieldUsage:async()=>{try{return await c(await y(m("/field-usage")),await d())}catch(e){return console.warn("[products.listFieldUsage] unavailable, returning []",e),[]}},getPage:async(e,t={})=>{let r=t.record?`?record=${encodeURIComponent(t.record)}`:"",[n,a]=await J(m(`/pages/${e}`)+r,t.revalidate!==void 0?{next:{revalidate:t.revalidate}}:void 0);return S(await c(n,a))},listBlogPosts:async()=>{try{return(await c(m("/blog-posts"),await d())).map(t=>({...t,coverImage:T(t.coverImage)??""}))}catch(e){return console.warn("[products.listBlogPosts] blog API unavailable, returning []",e),[]}},getBlogPost:async e=>{let t=await c(m(`/blog-posts/${e}`),await d());return{...t,coverImage:T(t.coverImage)??""}},createOrder:async e=>c(m("/orders"),await d({method:"POST",body:JSON.stringify(e)})),createOrderAuthed:async e=>h(m("/orders"),await d({method:"POST",body:JSON.stringify(e)})),lookupOrder:async e=>c(m("/orders/lookup"),await d({method:"POST",body:JSON.stringify(e)})),createPaymentIntent:async e=>c(m("/payments/intent"),await d({method:"POST",body:JSON.stringify(e)})),createPaypalOrder:async e=>c(m("/payments/paypal/order"),await d({method:"POST",body:JSON.stringify(e)})),capturePaypalOrder:async e=>c(m("/payments/paypal/capture"),await d({method:"POST",body:JSON.stringify(e)})),createAfterpayCheckout:async e=>c(m("/payments/afterpay/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureAfterpayPayment:async e=>c(m("/payments/afterpay/capture"),await d({method:"POST",body:JSON.stringify(e)})),chargeSquare:async e=>c(m("/payments/square/charge"),await d({method:"POST",body:JSON.stringify(e)})),createGocardlessBillingRequest:async e=>c(m("/payments/gocardless/billing-request"),await d({method:"POST",body:JSON.stringify(e)})),completeGocardlessPayment:async e=>c(m("/payments/gocardless/complete"),await d({method:"POST",body:JSON.stringify(e)})),createZipCheckout:async e=>c(m("/payments/zip/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureZipPayment:async e=>c(m("/payments/zip/capture"),await d({method:"POST",body:JSON.stringify(e)})),createKlarnaCheckout:async e=>c(m("/payments/klarna/checkout"),await d({method:"POST",body:JSON.stringify(e)})),captureKlarnaPayment:async e=>c(m("/payments/klarna/capture"),await d({method:"POST",body:JSON.stringify(e)})),createStockAlert:async e=>c(m("/stock-alerts"),await d({method:"POST",body:JSON.stringify(e)})),createPreOrderIntent:async e=>c(m("/pre-order-intents"),await d({method:"POST",body:JSON.stringify(e)})),createNewsletterSubscription:async e=>c(m("/newsletter-subscriptions"),await d({method:"POST",body:JSON.stringify(e)})),unsubscribeNewsletter:async e=>c(m("/newsletter-unsubscribe"),await d({method:"POST",body:JSON.stringify(e)})),captureCart:async e=>c(m("/carts"),await d({method:"POST",body:JSON.stringify(e)})),restoreCart:async e=>c(m("/carts/restore"),await d({method:"POST",body:JSON.stringify(e)})),unsubscribeCartReminders:async e=>c(m("/carts/unsubscribe"),await d({method:"POST",body:JSON.stringify(e)})),listReviews:async(e={})=>{let t=new URLSearchParams;e.limit&&t.set("limit",String(e.limit)),e.designCode&&t.set("designCode",e.designCode);let r=m("/reviews"),n=t.toString();try{return await c(await y(n?`${r}?${n}`:r),await d())}catch(a){return console.warn("[products.listReviews] product API unavailable, returning []",a),[]}},submitReview:async e=>c(m("/reviews"),await d({method:"POST",body:JSON.stringify(e)})),getForm:async e=>c(m(`/forms/${encodeURIComponent(e)}`),await d()),submitForm:async(e,t)=>c(m(`/forms/${encodeURIComponent(e)}/submissions`),await d({method:"POST",body:JSON.stringify(t)})),listShippingMethods:async()=>{try{return await c(m("/shipping-methods"),await d())}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 d())}catch(t){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",t),[]}},quoteCart:async e=>{let t=m("/cart/quote"),r=await d({method:"POST",body:JSON.stringify(e)});return e.couponCode?(await Pe(t,r)).data:c(t,r)},validateCoupon:async e=>{let{data:t,asShopper:r}=await Pe(m("/coupons/validate"),await d({method:"POST",body:JSON.stringify(e)}));return{...t,askedAsShopper:r}},getHeaderSettings:async()=>{let e=_e({method:"GET"}),t=await c(...await J(m("/header-settings"),{signal:e})),r=T(t.logoUrl),n=null,a=null;if(r&&H(r)){let l=await he(r,e);l&&(n=l.reversed,a=l.inkIsDark)}return{...t,logoUrl:r,logoReversed:n,logoInkIsDark:a}},getThemeSettings:async()=>c(...await J(m("/theme-settings"))),getChatSettings:async()=>c(await y(m("/chat-settings")),await d())},ar={listServices:async()=>{try{return await c(m("/bookings/services"),await d())}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 d()),create:async e=>c(m("/bookings"),await d({method:"POST",body:JSON.stringify(e)})),get:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}`),await d()),cancel:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}/cancel`),await d({method:"POST"})),createPaymentIntent:async e=>c(m("/bookings/payments/intent"),await d({method:"POST",body:JSON.stringify({manageToken:e})}))},G=class extends Error{constructor(r,n){super(`Slug "${r}" exists on ${n} websites; a site is required to pick one.`);this.slug=r;this.count=n;this.name="AmbiguousPageSlugError"}},F=(e,t,r)=>{let n=new URLSearchParams({...t?{site:t}:{},...r?{draft:"1"}:{}}).toString();return`/api/storefront/${e}/${n?`?${n}`:""}`},x=e=>`/api/storefront/sites/${encodeURIComponent(e)}/`,kt=e=>`${x(e)}currencies/`,Tt="/api/storefront/media/ingest/",K=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 Ot(){let e=ye();if(!e)throw new K;return`${Tt}?${new URLSearchParams({site:e})}`}var E={"X-Puck-Media-Manifest":ne.contentHash},cr=Fe({});function Fe(e){return(t,r={})=>{let n=at(),a=e.headers||n?{...n?{"Accept-Language":n}:{},...e.headers,...r.headers}:void 0;return c(t,{...r,...e.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...a?{headers:a}:{},audience:e.audience??it()})}}function vt(e={}){let t=Fe(e),r=e.siteDrafts===!0,n=i=>F("header-settings",i,r),a=i=>F("theme-settings",i,r),l=i=>F("chat-settings",i,r),p=i=>F("social-settings",i,r);return{findPageBySlug:async(i,s,o)=>{let u=new URLSearchParams({slug:i});o&&u.set("site",o);let g=await t(`/api/storefront/pages/?${u.toString()}`,{token:s}),P=Array.isArray(g)?g:g.results??[];if(!o&&P.length>1)throw new G(i,P.length);return P[0]??null},getPageById:(i,s)=>t(`/api/storefront/pages/${i}/`,{token:s}),saveLayout:(i,s,o,u,g)=>t(`/api/storefront/pages/${i}/`,{method:"PATCH",body:JSON.stringify({layout:s,expected_updated_at:u,...g?{client_id:g}:{}}),token:o}),createPagePreviewLink:(i,s)=>t(`/api/storefront/pages/${i}/preview-link/`,{method:"POST",token:s}),claimPageEditLock:(i,s,o,u=!1)=>t(`/api/storefront/pages/${i}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:o,takeover:u}),token:s}),releasePageEditLock:(i,s)=>t(`/api/storefront/pages/${i}/edit-lock/`,{method:"DELETE",token:s}),createTemplate:(i,s,o)=>t("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:i,layout:s}),headers:E,token:o}),getTemplate:(i,s)=>t(`/api/storefront/page-templates/${i}/`,{token:s}),saveTemplateLayout:(i,s,o)=>t(`/api/storefront/page-templates/${i}/`,{method:"PATCH",body:JSON.stringify({layout:s}),headers:E,token:o}),listTemplatePages:async(i,s)=>{let o=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(i)}`,{token:s});return Array.isArray(o)?o:o.results??[]},findTemplatePageBySlug:async(i,s,o)=>{let u=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(i)}&slug=${encodeURIComponent(s)}`,{token:o});return(Array.isArray(u)?u:u.results??[])[0]??null},createTemplatePage:(i,s,o)=>t("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:i,...s}),headers:E,token:o}),saveTemplatePageLayout:(i,s,o)=>t(`/api/storefront/template-pages/${i}/`,{method:"PATCH",body:JSON.stringify({layout:s}),headers:E,token:o}),deleteTemplatePage:(i,s,o)=>t(`/api/storefront/template-pages/${i}/`,{method:"DELETE",token:s,...o?.keepalive?{keepalive:!0}:{}}),listPages:async(i,s)=>{let o=new URLSearchParams({no_page:"true"});s&&o.set("site",s);let u=await t(`/api/storefront/pages/?${o.toString()}`,{token:i});return Array.isArray(u)?u:u.results??[]},createPage:(i,s,o,u)=>t("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:i,slug:s,layout:o}),token:u}),deletePage:(i,s)=>t(`/api/storefront/pages/${i}/`,{method:"DELETE",token:s}),getHeaderSettings:(i,s)=>t(n(s),{token:i}),listMenus:async(i,s)=>{let o=new URLSearchParams({no_page:"true"});s&&o.set("site",s);let u=await t(`/api/storefront/menus/?${o}`,{token:i});return Array.isArray(u)?u:u.results??[]},listBlogPosts:async(i,s={})=>{let o=new URLSearchParams({no_page:"true"});s.visibleOnly&&o.set("is_visible","true"),s.siteId&&o.set("site",s.siteId);let u=await t(`/api/storefront/blog-posts/?${o.toString()}`,{token:i});return Array.isArray(u)?u:u.results??[]},listFieldUsage:async(i,s)=>{let o=await t(`/api/storefront/field-usage/?site=${encodeURIComponent(s)}`,{token:i});return Array.isArray(o?.entries)?o.entries:[]},listCategories:async(i,s={})=>{let o=new URLSearchParams({no_page:"true"});s.visibleOnly&&o.set("is_visible","true"),s.siteId&&o.set("site",s.siteId);let u=await t(`/api/storefront/categories/?${o.toString()}`,{token:i});return[...Array.isArray(u)?u:u.results??[]].sort((P,k)=>P.sort_order-k.sort_order||P.name.localeCompare(k.name))},listForms:async(i,s={})=>{let o=new URLSearchParams({no_page:"true"});s.siteId&&o.set("site",s.siteId);let u=await t(`/api/storefront/forms/?${o.toString()}`,{token:i});return[...Array.isArray(u)?u:u.results??[]].sort((P,k)=>P.title.localeCompare(k.title))},listWheelSummaries:async(i,s={})=>{let o=new URLSearchParams;s.siteId&&o.set("site",s.siteId);let u=o.toString(),g=await t(`/api/storefront/wheel-curations/summaries/${u?`?${u}`:""}`,{token:i});return S(g)},listProducts:async(i,s={})=>{let o=new URLSearchParams;s.kinds?.length&&o.set("kind",s.kinds.join(",")),s.siteId&&o.set("site",s.siteId);let u=o.toString(),g=await t(`/api/storefront/products/${u?`?${u}`:""}`,{token:i});return S(g)},getWheelDetail:async(i,s,o={})=>{let u=new URLSearchParams({slug:s});return o.siteId&&u.set("site",o.siteId),A(S(await t(`/api/storefront/wheel-curations/detail/?${u.toString()}`,{token:i})))},updateHeaderSettings:(i,s,o)=>t(n(o),{method:"PATCH",body:JSON.stringify(i),token:s}),getSite:(i,s)=>t(x(i),{token:s}),listSites:async i=>{let s=await t("/api/storefront/sites/?no_page=true",{token:i});return Array.isArray(s)?s:s.results??[]},listSiteCurrencies:async(i,s)=>{let o=await t(kt(i),{token:s});return Array.isArray(o)?o:[]},publishSite:(i,s)=>t(`${x(i)}publish/`,{method:"POST",token:s}),getSiteLiveState:(i,s)=>t(`${x(i)}live-state/`,{token:s}),updateSite:(i,s,o)=>t(x(i),{method:"PATCH",body:JSON.stringify(s),token:o}),getThemeSettings:(i,s)=>t(a(s),{token:i}),updateThemeSettings:(i,s,o)=>t(a(o),{method:"PATCH",body:JSON.stringify(i),token:s}),getChatSettings:(i,s)=>t(l(s),{token:i}),updateChatSettings:(i,s,o)=>t(l(o),{method:"PATCH",body:JSON.stringify(i),token:s}),getSocialSettings:(i,s)=>t(p(s),{token:i}),updateSocialSettings:(i,s,o)=>t(p(o),{method:"PATCH",body:JSON.stringify(i),token:s}),uploadHeaderLogo:(i,s,o)=>{let u=new FormData;return u.append("logo",i),t(n(o),{method:"PATCH",body:u,token:s})},clearHeaderLogo:(i,s)=>t(n(s),{method:"PATCH",body:JSON.stringify({logo:null}),token:i}),setHeaderLogoFromAsset:(i,s,o)=>t(n(o),{method:"PATCH",body:JSON.stringify({logo_asset_id:i}),token:s}),uploadMedia:async(i,s)=>{let o=new FormData;return o.append("file",i),t(Ot(),{method:"POST",body:o,token:s})},listMedia:async(i,s)=>{let o=new URLSearchParams({no_page:"true"});s&&o.set("kind",s);let u=await t(`/api/storefront/media-assets/?${o.toString()}`,{token:i});return Array.isArray(u)?u:u.results??[]}}}var lr=vt({siteDrafts:!0});export{ne as a,B as b,X as c,Y as d,w as e,Be as f,H as g,ye as h,Xe as i,f as j,W as k,D as l,Yt as m,er as n,c as o,ut as p,Ie as q,Pt as r,wt as s,bt as t,_t as u,ir as v,or as w,ar as x,G as y,cr as z,lr as A};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as at,j as fe,r as st,t as lt,u as ut,w as q}from"./chunk-IAV6LRGK.js";import{Aa as rt,Da as $e,Ea as ot,za as pe}from"./chunk-OUTUANSR.js";import{e as nt,q as it,s as oe}from"./chunk-64T5EISP.js";import{createContext as rn,useContext as on,useEffect as an,useMemo as he,useState as mt}from"react";function ct(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function ie(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 He=4,yr=1,br={unit:"set",spares:0,spareSide:"left"};function dt(e){return e.unit==="single"?1:He+e.spares}function Cr(e,t){return[{partNumber:e.partNumber,wheels:dt(t),prices:e.prices}]}function xr(e,t){let n=dt(t)-He;if(n<=0||e.length===0)return e;let r=tn(e),o=r?r[t.spareSide]:0;return e.map((i,a)=>a===o?{...i,wheels:i.wheels+n}:i)}function tn(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 nn(e,t){return t.spares>0?`${e} + spare`:e}function Sr(e){return e.unit==="single"?"Single":nn(`Set of ${He}`,e)}var vr="data-add-to-basket",qe=9,Te="en";function ge(e,t,n=0){return new Intl.NumberFormat(Te,{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:n}).format(e)}function Er(e,t){return new Intl.NumberFormat(Te,{style:"currency",currency:t}).format(e)}import{jsx as un}from"react/jsx-runtime";var pt="storefront-country",ft=rn(null);function sn(e){return gt(e,"catalogue")}function ln(e){return gt(e,"money")}function gt(e,t){let n=new Map(e.map(o=>[o.code,o.decimalPlaces])),r=new Map;return(o,i)=>{if(!i)return"";let a=r.get(i);if(!a){let s=n.get(i)??0;a=new Intl.NumberFormat(Te,{style:"currency",currency:i,minimumFractionDigits:t==="money"?s:0,maximumFractionDigits:s}),r.set(i,a)}return a.format(o)}}function Tr({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=he(()=>t??[],[t]),a=he(()=>n??[],[n]),s=he(()=>r||i.find(y=>y.isDefault)?.code||i[0]?.code||"",[r,i]),c=he(()=>o||a.find(y=>y.isDefault)?.code||a[0]?.code||"",[o,a]),[u,m]=mt(c),[d,S]=mt(!1);an(()=>{let y=oe.getItem(pt);y&&a.some(I=>I.code===y)&&m(y),S(!0)},[a]);function L(y){m(y),oe.setItem(pt,y)}let C=he(()=>{let y=a.find(v=>v.code===u)??null,I=y?.currency,M=I&&i.some(v=>v.code===I)?I:s,D=sn(i),N=ln(i);return{country:u,currency:M,setCountry:L,currencies:i,countries:a,activeCountry:y,formatPrice:(v,x)=>D(v,x??M),formatMoney:(v,x)=>N(v,x??M),ready:d}},[u,i,a,s,d]);return un(ft.Provider,{value:C,children:e})}function ht(){let e=on(ft);if(!e)throw new Error("useCurrency must be used within a CurrencyProvider");return e}import{createContext as Pn,useCallback as k,useContext as In,useEffect as j,useMemo as Nt,useRef as ae,useState as A}from"react";function bt(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var Ct="We'll confirm this discount when you place your order.",kr="Confirmed at checkout";function Ar(e){return e&&(e.valid||e.deferred)?e.code:void 0}var yt="coupon_code: ";function Mr(e){return!(e instanceof fe)||e.status!==400||!e.message.startsWith(yt)?null:e.message.slice(yt.length)}function xt(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 Ne="Price on request",dn="Request a quote",mn="from ",Ur="From ",$r="each",St="Free";function Ke(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function We(e,t){let n=e?.[t];return Ke(n)?n:null}function Hr(e,t,n,r){let o=We(e,n),i=We(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function qr(e,t,n,r){if(n==null&&r==null)return!0;let o=We(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var pn={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function fn(e,t,n){if(!Ke(e))return pn;let r=Ke(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function Kr(e,t,n=""){return!e.priced||e.unit==null?Ne:`${n}${ge(e.unit,t)}`}function Wr(e,t){return e.was==null?null:ge(e.was,t)}function gn(e,t,n=1){let r=ie(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((a,s)=>a+s.wheels,0),i=Math.min(...e.map(a=>a.prices[t]));return{priced:!0,unit:i,isFrom:i*o!==r,setTotal:r*n}}var hn={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function Br(e,t,n,r=1){let o=fn(e.prices[n],e.msrpPrices?.[n],4),i=o.setTotal==null?null:o.setTotal*r;if(!t)return{priced:o.priced,unit:o.unit,isFrom:!0,was:o.was,onSale:o.onSale,setTotal:null,fromSetTotal:i};let a=gn(t.components,n,r);return a.priced?{priced:!0,unit:a.unit,isFrom:a.isFrom,was:null,onSale:!1,setTotal:a.setTotal,fromSetTotal:i}:{...hn,fromSetTotal:i}}function yn(e,t){return!e.priced||e.unit==null?Ne:`${e.isFrom?mn:""}${ge(e.unit,t)}`}function zr(e,t){return e.was==null?null:ge(e.was,t)}function Gr(e,t){return!e.priced||e.unit==null?dn:yn(e,t)}var bn=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function vt(e){return bn.test(e.trim())}var Et="sf:ga-purchases",Cn=20;function It(){return typeof window>"u"||window.parent!==window}function ye(...e){try{if(It()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function xn(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:ie(e.components,t)??0,quantity:e.qty}}function Be(e,t){return e.filter(Re).map(n=>xn(n,t))}function Jr(e){ye("event","view_item",{currency:e.currency,value:e.pricePerSet,items:[{item_id:e.itemId,item_name:e.itemName,...e.variant?{item_variant:e.variant}:{},price:e.pricePerSet,quantity:1}]})}function wt(e,t){let n=Be([e],t);n.length!==0&&ye("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function Zr(e){let t=Be(e.lines,e.currency);t.length!==0&&ye("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var Pt=new Set;function Sn(e){if(Pt.has(e))return!1;Pt.add(e);try{let t=JSON.parse(oe.getItem(Et)??"[]");if(t.includes(e))return!1;oe.setItem(Et,JSON.stringify([...t,e].slice(-Cn)))}catch{}return!0}function eo(e){let t=e.confirmation;if(It()||!Sn(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);ye("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:Be(e.lines,n)}),e.adsSendTo&&ye("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var vn="Arranged after review",Lt="Calculated at checkout",En=Lt,ro=Lt;function Tt({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function oo(e){switch(e){case"arranged":return vn;case"pending":return En;case"free":return St;case"charged":return null}}import{jsx as Nn}from"react/jsx-runtime";var wn=400,Ln=400,Tn=1500;function Re(e){return(e.components?.length??0)>0}function Rt(e,t){return{code:e,valid:t.valid,deferred:bt(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function kt(e,t){return ie(e.components,t)}function ze(e,t){let n=kt(e,t);return n===null?null:n*e.qty}function _t(e){return e!=="tyre"}var At=Pn(null);function yo({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=ht(),[i,a]=A(t),[s,c]=A([]),[u,m]=A([]),[d,S]=A([]),[L,C]=A(!1),[y,I]=A(!1),[M,D]=A(!1),[N,v]=A(!1),[x,K]=A(null),[R,W]=A(void 0),b=ae(r),w=ae("");b.current=b.current||r;let[p,B]=A(null),[Q,F]=A(!1),[O,ve]=A(null),z=ae(void 0),X=k(()=>a(!0),[]),le=k(()=>a(!1),[]),J=k(()=>a(l=>!l),[]);j(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&X()},[X,t]);let Ee=k(l=>{v(!0),_t(l)&&D(!0)},[]),U=M||s.some(l=>_t(l.kind)),Pe=N||s.length>0;j(()=>{if(t||!U||L)return;let l=!0;return q.listWheels().then(f=>{l&&(m(f),C(!0))}),()=>{l=!1}},[t,U,L]),j(()=>{if(t||!Pe||y)return;let l=!0;return q.listBundles().then(f=>{l&&(S(f),I(!0))}),()=>{l=!1}},[t,Pe,y]);let P=x?.deliveryOptions??[];j(()=>{P.length!==0&&ve(l=>l&&P.some(f=>f.id===l)?l:P[0]?.id??null)},[x]);let Z=k(()=>s.filter(Re).flatMap(l=>ct(l.components,l.qty)),[s]),ee=k(async(l,f)=>{let h=l.trim().toUpperCase();if(!h)return;let g=Z();if(g.length===0){B({code:h,valid:!1,message:"Add a wheel to the cart first."});return}F(!0),z.current=f;try{let T=await q.validateCoupon({code:h,items:g,currency:n,shippingMethodId:O??void 0,customerEmail:f});B(Rt(h,T))}catch{B({code:h,valid:!1,message:"Could not check that code. Please try again."})}finally{F(!1)}},[Z,n,O]),ue=k(()=>{B(null),z.current=void 0},[]),ce=k(l=>{if(!p)return;let{code:f}=p;B(h=>h&&h.code===f?{code:f,valid:!1,refused:!0,message:l}:h)},[p]);j(()=>{if(!p||p.refused)return;let l=p.code,f=g=>g!==null&&g.code===l&&!g.refused,h=setTimeout(async()=>{let g=Z();if(g.length===0){B(T=>f(T)?{code:l,valid:!1,message:"Add a wheel to the cart first."}:T);return}F(!0);try{let T=await q.validateCoupon({code:l,items:g,currency:n,shippingMethodId:O??void 0,customerEmail:z.current});B(me=>f(me)?Rt(l,T):me)}catch{}finally{F(!1)}},wn);return()=>clearTimeout(h)},[s,n,O]);let te=p&&!p.refused?p.code:void 0;j(()=>{if(t)return;let l=!0,f=setTimeout(async()=>{let h=Z();if(h.length===0){K(null),W(void 0);return}try{let g=await q.quoteCart({items:h,currency:n,shippingMethodId:O??void 0,couponCode:te,customerEmail:z.current||void 0,country:b.current||void 0,subdivision:w.current||void 0});if(!l)return;K(g)}catch{if(!l)return}W(te)},Ln);return()=>{l=!1,clearTimeout(f)}},[s,n,O,te,r]);let de=k(l=>{c(f=>{let h=f.findIndex(g=>g.id===l.id);return h===-1?[...f,l]:f.map((g,T)=>T===h?{...g,qty:Math.min(qe,g.qty+l.qty)}:g)}),wt(l,n)},[n]),ne=k(l=>{c(f=>f.filter(h=>h.id!==l))},[]),Ie=k((l,f)=>{let h=Math.max(1,Math.min(qe,f));c(g=>g.map(T=>T.id===l?{...T,qty:h}:T))},[]),we=k(l=>{c(l)},[]),[E,$]=A(null),Y=ae(null);Y.current=E;let H=ae(null),Oe=ae(""),Qe=k((l,f)=>{let h=l.trim().toLowerCase();vt(h)&&$(g=>g&&g.email===h&&g.firstName===(f??"")?g:{email:h,firstName:f??""})},[]);j(()=>{if(t||!E)return;let l=xt(s.filter(Re),g=>ze(g,n)===null?Ne:o(ze(g,n),n)),f={email:E.email,firstName:E.firstName,currency:n,items:l},h=JSON.stringify(f);if(h!==Oe.current)return H.current&&clearTimeout(H.current),H.current=setTimeout(()=>{H.current=null,Oe.current=h,q.captureCart(f).catch(g=>{})},Tn),()=>{H.current&&(clearTimeout(H.current),H.current=null)}},[s,E,n,t]);let Je=k(()=>{H.current&&(clearTimeout(H.current),H.current=null);let l=Y.current;l&&(Oe.current="",q.captureCart({email:l.email,firstName:l.firstName,currency:n,items:[]}).catch(f=>{}))},[n]),Ze=Nt(()=>{let l=s.reduce((_,re)=>{let Le=ze(re,n);return Le===null?_:_+Le},0),f=s.some(_=>kt(_,n)===null),h=s.reduce((_,re)=>_+re.qty,0),g=p?.valid?p.effects:void 0,T=g?Math.min(l,Number(g.discountAmount)):0,me=x?.bundleDiscount??0,jt=x?.appliedBundles??[],Fe=!!g?.freeShipping,et=P.find(_=>_.id===O),tt=Fe?0:x?.shipping??et?.amount??0,Qt=Tt({quoted:x!==null,optionCount:P.length,chosenAmount:et?.amount,couponWaivesFreight:Fe}),Ue={};for(let _ of g?.freeUnits??[])Ue[_.partNumber]=(Ue[_.partNumber]??0)+_.quantity;let Jt=x?.tax??null,Zt=x?x.grandTotal:l-T-me+tt;return{sets:h,units:s.reduce((_,re)=>_+(re.components??[]).reduce((Le,en)=>Le+en.wheels*re.qty,0),0),subtotal:l,hasUnpricedLine:f,discount:T,bundleDiscount:me,appliedBundles:jt,shipping:tt,freeShipping:Fe,shippingStatus:Qt,freeUnitsByPartNumber:Ue,tax:Jt,grand:Zt,repricing:!!p?.refused&&x!==null&&R===p?.code,currency:n}},[s,n,p,P,O,x,R]),Yt=Nt(()=>({isOpen:i,preview:t,open:X,close:le,toggle:J,items:s,catalog:u,bundles:d,warmCatalog:Ee,add:de,remove:ne,setQty:Ie,replaceItems:we,identify:Qe,clearCapturedCart:Je,coupon:p,applyCoupon:ee,removeCoupon:ue,refuseCoupon:ce,couponBusy:Q,deliveryOptions:P,shippingMethodId:O,setShippingMethodId:ve,totals:Ze}),[i,t,X,le,J,s,u,d,Ee,de,ne,Ie,we,Qe,Je,p,ee,ue,ce,Q,P,O,Ze]);return Nn(At.Provider,{value:Yt,children:e})}function Mt(){let e=In(At);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as Hn}from"react";function Dt(e,t,n,r){for(;e.size>=t;){let o,i;for(let[s,c]of e){if(c.expiresAt<=r){o=s;break}i===void 0&&n(s)&&(i=s)}let a=o??i??e.keys().next().value;if(a===void 0)return;e.delete(a)}}var Rn=6e4,_n=5e3,kn=500,_e=new Map;async function An(e){let{host:t,matchesRequestHost:n}=await st();if(!t)return"";let r=await lt();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}var Mn=e=>e.includes("|slug:")||e.includes("|xhost:");async function Ot(e,t){if(await ut()!==null)return t();let n=await An(e);if(!n)return t();let r=Date.now(),o=_e.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),a=i.outcome.state==="failed",s=a?_n:Rn,c=_e.get(n)?.lastGood,u=i.outcome.state==="ok"?i:a?c:void 0,m=a&&u?u:i;return Dt(_e,kn,Mn,r),_e.set(n,{load:m,expiresAt:r+s,lastGood:u}),m}var Dn=404;function On(e){if(e instanceof fe&&e.status===Dn)return{state:"absent"};let t=e instanceof fe?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var Fn="[storefront:chrome-load-failed]";function Un(e,t){console.error(`${Fn} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function Ft(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=On(o);return i.state==="failed"&&Un(e,i),{value:n,outcome:i}}}function $n(e){return e==="production"?"silent":"banner"}var Io=$n("production");function qn(e,t){return e?.trim()||t}function Ao({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=qn(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var Kn={name:pe,legalName:null,foundedYear:null,faviconUrl:null,currencies:[],defaultCurrency:null,countries:[],defaultCountry:null,commerceEnabled:!0,cardPayments:!1,paymentMethods:[],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,mapsApiKey:null,mapsMapId:null,socialLinks:$e},Mo=Hn(async()=>Ot("site",()=>Ft("site",async()=>{let e=await q.getSite();return{name:rt(e.name),legalName:e.legalName?.trim()||null,foundedYear:e.foundedYear??null,faviconUrl:e.faviconUrl??null,currencies:e.currencies??[],defaultCurrency:e.defaultCurrency??null,countries:e.countries??[],defaultCountry:e.defaultCountry??null,commerceEnabled:e.commerceEnabled??!0,cardPayments:e.cardPayments??!1,paymentMethods:e.paymentMethods??(e.cardPayments?["card"]:[]),paypalClientId:e.paypalClientId??null,paypalEnvironment:e.paypalEnvironment??null,squareApplicationId:e.squareApplicationId??null,squareLocationId:e.squareLocationId??null,squareEnvironment:e.squareEnvironment??null,ga4MeasurementId:e.ga4MeasurementId??null,googleAdsId:e.googleAdsId??null,googleAdsConversionLabel:(e.googleAdsId?e.googleAdsConversionLabel:null)??null,metaPixelId:e.metaPixelId??null,mapsApiKey:e.mapsApiKey??null,mapsMapId:e.mapsMapId??null,socialLinks:ot(e.socialLinks)}},Kn)));var Do={name:pe,legalName:null,foundedYear:null,faviconUrl:null,currencies:[{code:"USD",symbol:"$",decimalPlaces:2,isDefault:!0}],defaultCurrency:"USD",countries:[{code:"US",name:"United States",currency:"USD",url:"",isDefault:!0,chargeTax:!1,taxDisplay:"none",taxName:"",taxRate:null,postalLabel:"Zip Code"}],defaultCountry:"US",commerceEnabled:!0,cardPayments:!0,paymentMethods:["card"],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,mapsApiKey:null,mapsMapId:null,socialLinks:$e};import{jsx as Ce,jsxs as Ge}from"react/jsx-runtime";import{useEffect as ke,useId as zn,useRef as $t,useState as Ae}from"react";var be=new Map,Wn=64;async function Bn(e){if(!nt())return null;try{let t=await fetch(`${it()}/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 Ut(e){let t=be.get(e);if(t)return t;let n=Bn(e);if(be.set(e,n),be.size>Wn){let r=be.keys().next();r.done||be.delete(r.value)}return n}var Gn={small:54,medium:66,large:84},Vn=44,Xn=202/22,zo=16,Go=140,Yn=.88,Vo=16,jn="invert(1)";function Xo({variant:e="header",scrolled:t=!0,src:n,reverse:r=!1,color:o=null,onLightSurface:i,reversedSrc:a,inkIsDark:s,size:c="medium",sizePx:u,wordmark:m,siteName:d=pe,fitToContainer:S=!1,fitWordmarkToContainer:L=!1,fitFloorPx:C}){let y=m&&m.trim()?m.trim():d,[I,M]=Ae(!1),D=$t(null),N=E=>{D.current=E};ke(()=>{let E=D.current?.ownerDocument??document,$=()=>{M(E.documentElement.getAttribute("data-theme")==="light")};$();let Y=new MutationObserver($);return Y.observe(E.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>Y.disconnect()},[]);let v=n&&n.trim()?n.trim():null,x=!!v&&at(v),K=i??(I&&t),R=o&&o.trim()?o.trim():null,W=r&&!R,b=`logo-color-${zn().replace(/[^A-Za-z0-9_-]/g,"")}`,w=W&&x&&v&&a!=null?{reversed:a,inkIsDark:s??null}:null,p=w!==null,[B,Q]=Ae(null);ke(()=>{if(!W||!v||!x||p){Q(null);return}let E=!1;return Q(null),Ut(v).then($=>{E||Q($)}),()=>{E=!0}},[W,v,x,p]);let F=w??B,O=!!F&&F.inkIsDark!==null&&(K?!F.inkIsDark:F.inkIsDark),ve=W&&!!v&&!x&&!K,z=O&&F?F.reversed:v,X=z?[z]:[],[le,J]=Ae(0);ke(()=>{J(0)},[v,O]);let Ee=e==="footer"?Vn:Gn[c],U=u&&u>0?u:Ee,Pe=Math.round(U*Xn),P=le<X.length?X[le]:null,[Z,ee]=Ae(z),ue=P!==null&&P===Z,ce=$t(null);ke(()=>{let E=ce.current;if(!E||!E.complete)return;if(E.naturalWidth>0||E.naturalHeight>0){ee(P);return}let $=!1;return E.decode().then(()=>!$&&ee(P),()=>!$&&J(Y=>Y+1)),()=>{$=!0}},[P]);let te=S||L,de=`calc(100cqi / ${((y.length+1)*Yn).toFixed(2)})`,ne=te&&C&&C>0?Math.min(C,U):null,Ie=te?ne===null?`min(${U}px, ${de})`:`clamp(${ne}px, ${de}, ${U}px)`:`${U}px`,we=Ge("span",{className:`font-display font-bold tracking-[0.18em] ${ne===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:Ie,lineHeight:1,...R?{color:R}:{}},"aria-label":y,children:[y,Ce("span",{className:"text-accent",style:R?{color:R}:void 0,children:"."})]});return Ge("span",{ref:N,className:"inline-flex items-center",children:[!ue&&we,R&&P&&Ce("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:Ge("filter",{id:b,colorInterpolationFilters:"sRGB",children:[Ce("feFlood",{style:{floodColor:R}}),Ce("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),P&&Ce("img",{ref:ce,src:P,alt:y,width:Pe,height:U,className:"shrink-0 object-contain",style:{...ue?{height:`${U}px`,width:"auto",...S?{maxWidth:"100cqi"}:{}}:{display:"none"},...ve?{filter:jn}:{},...R?{filter:`url(#${b})`}:{}},onLoad:()=>ee(P),onError:()=>J(E=>E+1)},P)]})}import{jsx as xe,jsxs as Jn}from"react/jsx-runtime";function Qn({spokes:e,mesh:t=!1,className:n}){let a=c=>Math.round(c*1e3)/1e3,s=[];for(let c=0;c<e;c++){let u=c/e*Math.PI*2-Math.PI/2;if(s.push({x1:a(100+Math.cos(u)*22),y1:a(100+Math.sin(u)*22),x2:a(100+Math.cos(u)*86),y2:a(100+Math.sin(u)*86),main:!0}),t){let m=u+Math.PI/e;s.push({x1:a(100+Math.cos(m)*22*1.4),y1:a(100+Math.sin(m)*22*1.4),x2:a(100+Math.cos(m)*78),y2:a(100+Math.sin(m)*78),main:!1})}}return Jn("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:[xe("circle",{cx:100,cy:100,r:92,strokeWidth:2}),xe("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),xe("circle",{cx:100,cy:100,r:22,strokeWidth:2}),xe("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),s.map((c,u)=>xe("line",{x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,stroke:"currentColor",strokeWidth:c.main?6:3,strokeLinecap:"round",opacity:c.main?1:.5},u))]})}var Jo="#c9a461",Ht=[{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"}],Zo={name:"",color:"var(--fg)",family:"silver",src:""};function Zn(e,t){let n=r=>{let o=Ht.findIndex(i=>i.f===r);return o===-1?Ht.length:o};return n(e)-n(t)||e.localeCompare(t)}function ei(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(Zn)}import{useState as er}from"react";import{jsx as se,jsxs as Ve}from"react/jsx-runtime";function tr({customerEmail:e}){let{coupon:t,applyCoupon:n,removeCoupon:r,couponBusy:o}=Mt(),[i,a]=er("");async function s(){o||!i.trim()||(await n(i,e),a(""))}return Ve("div",{className:"flex flex-col gap-2",children:[t===null?Ve("div",{className:"flex border border-line",children:[se("input",{type:"text",value:i,onChange:c=>a(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),s())},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"}),se("button",{type:"button",onClick:()=>{s()},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"})]}):Ve("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:[se("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",t.valid?"text-accent":t.deferred?"text-fg":"text-fg-dim line-through"].join(" "),children:t.code}),se("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?se("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:Ct}):t&&!t.valid&&t.message&&se("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:t.message})]})}function si(){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 rr,isValidElement as or,useEffect as Kt,useId as ir,useLayoutEffect as zt,useRef as G,useState as Wt}from"react";var Me=(e,t)=>!!e[t]&&!e[t].disabled;function Xe(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(Me(e,i))return i}return t}function Ye(e,t){return Xe(e,t===1?-1:e.length,t)}function je(e,t){return Me(e,t)?t:Math.max(Ye(e,1),0)}function qt(e,t,n){let{open:r,focus:o}=e,i=a=>({...e,...a});if(t.length===1&&/\S/.test(t)){let a=e.typed+t.toLowerCase(),s=n.findIndex((c,u)=>Me(n,u)&&c.label.toLowerCase().startsWith(a));return{state:i({open:!0,typed:a,focus:s>=0?s: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:Xe(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:Xe(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:Ye(n,1)}),handled:!0};case"End":return{state:i({focus:Ye(n,-1)}),handled:!0};case"Enter":case" ":return Me(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 ar}from"efficient-shell/ui";import{Fragment as mr,jsx as V,jsxs as Gt}from"react/jsx-runtime";var Bt={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function sr({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[a,s]=Wt(!1),c=r!==void 0,u=c?r:a,[m,d]=Wt(0),S=G({text:"",timer:0}),L=G(null),C=G(null),y=G(null),I=ir(),M=G(null),D=e.findIndex(b=>b.value===t),N=b=>{b!==u&&(c||s(b),b?o?.():i?.())},v=b=>{let w=e[b];!w||w.disabled||(n(w.value),N(!1),C.current?.focus())},x=b=>{let w={open:u,focus:u?m:je(e,D),typed:S.current.text},p=qt(w,b,e);return!p.handled&&p.state.open===u?!1:(p.state.typed!==w.typed&&(S.current.text=p.state.typed,window.clearTimeout(S.current.timer),S.current.timer=window.setTimeout(()=>{S.current.text=""},500)),d(p.state.focus),p.commit!==void 0?v(p.commit):N(p.state.open),p.refocus&&C.current?.focus(),p.handled)},K=G(x);K.current=x;let R=G(()=>N(!1));R.current=()=>N(!1);let W=b=>{u||(M.current=b.nativeEvent,K.current(b.key)&&b.preventDefault())};return Kt(()=>{if(!u)return;let b=p=>{L.current?.contains(p.target)||R.current()},w=p=>{p!==M.current&&K.current(p.key)&&p.preventDefault()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",w)}},[u]),Kt(()=>{u&&(S.current.text||d(je(e,D)))},[u]),zt(()=>{if(!u||!y.current)return;y.current.children.item(m)?.scrollIntoView({block:"nearest"})},[m,u]),{open:u,toggle:()=>N(!u),close:()=>N(!1),focusIdx:m,setFocusIdx:d,pick:b=>v(e.findIndex(w=>w.value===b)),wrapRef:L,triggerRef:C,listRef:y,listId:I,onTriggerKeyDown:W,activeId:u?`${I}-${m}`:void 0}}var lr={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 ${Bt.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 ${Bt.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 ur(e,t){zt(()=>{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 a=n.offsetParent??n.parentElement;if(!a)return;let s=a.getBoundingClientRect(),c=n.getBoundingClientRect(),u=Math.abs(c.right-s.right)<Math.abs(c.left-s.left)?"end":"start",m=ar({trigger:{left:s.left,right:s.right,top:s.top,bottom:s.bottom},menu:{width:c.width,height:c.height},bounds:{left:0,top:0,right:r.innerWidth,bottom:r.innerHeight},align:u,side:"bottom"});if(m.side==="top"){i.top="auto",i.bottom="100%",i.marginTop="0px";let S=m.top+Math.min(c.height,m.maxHeight);i.marginBottom=`${Math.max(0,s.top-S)}px`}m.maxHeight<c.height&&(i.maxHeight=`${m.maxHeight}px`,i.overflowY="auto");let d=m.left-c.left;d&&(i.translate=`${d}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function cr({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:a,listRef:s,ariaLabel:c}){let u=lr[t],m=G(null);return ur(m,n.length),V("ul",{ref:d=>{m.current=d,s&&(s.current=d)},id:e,role:"listbox","aria-label":c,...u.pickerMarker?{"data-picker-menu":""}:{},className:u.list,children:n.map((d,S)=>{let L=d.value===r;return V("li",{id:`${e}-${S}`,role:"option","aria-selected":L,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(S),onMouseDown:C=>{C.preventDefault(),d.disabled||a(d.value)},className:u.item(S===o,L&&d.value!=="",!!d.disabled,S===n.length-1),style:u.itemStyle?.(L),children:d.meta===void 0?d.label:Gt(mr,{children:[d.lead,V("span",{className:"flex-1 whitespace-nowrap",children:d.label}),V("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${S}`)})})}function dr({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:a,id:s,"aria-label":c}){let u=rr.toArray(r).flatMap(C=>{if(!or(C))return[];if(C.type!=="option")return[];let I=C.props,M=I.value!==void 0?String(I.value):"",D=I.children,N=typeof D=="string"||typeof D=="number"?String(D):M;return[{value:M,label:N,disabled:!!I.disabled}]}),m=e??"",d=sr({items:u,value:m,onPick:C=>t?.({target:{value:C}})}),L=u.find(C=>C.value===m)?.label??u[0]?.label??"";return Gt("div",{ref:d.wrapRef,className:"relative",children:[a&&V("input",{type:"hidden",name:a,value:m}),V("button",{ref:C=>{d.triggerRef.current=C},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":c,id:s,onClick:()=>!n&&d.toggle(),onKeyDown:C=>!n&&d.onTriggerKeyDown(C),className:`block w-full ${o??""}`,style:i,children:V("span",{className:"block w-full truncate text-left",children:L})}),d.open&&V(cr,{id:d.listId,tone:"select",items:u,value:m,focusIdx:d.focusIdx,onFocus:d.setFocusIdx,onPick:d.pick,listRef:d.listRef})]})}import{jsx as Se,jsxs as De}from"react/jsx-runtime";var pr="font-mono text-[length:var(--size-label,12px)]",fr="font-semibold uppercase tracking-[0.22em] text-fg";function Vt(e){return`${e??pr} ${fr}`}function Xt(){return Se("span",{className:"text-accent",children:" *"})}function gr({children:e,required:t,labelFace:n}){return De("span",{className:Vt(n),children:[e,t?Se(Xt,{}):null]})}function hr({label:e,required:t,hint:n,separate:r,htmlFor:o,labelFace:i,className:a,children:s}){let c=a?`flex flex-col gap-2 ${a}`:"flex flex-col gap-2",u=n?Se("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?De("div",{className:c,children:[De("label",{htmlFor:o,className:Vt(i),children:[e,t?Se(Xt,{}):null]}),s,u]}):De("label",{htmlFor:o,className:c,children:[Se(gr,{required:t,labelFace:i,children:e}),s]})}export{kr as a,Ar as b,Mr as c,ct as d,He as e,yr as f,br as g,Cr as h,xr as i,tn as j,nn as k,Sr as l,vr as m,qe as n,Te as o,ge as p,Er as q,Ne as r,dn as s,mn as t,Ur as u,$r as v,St as w,We as x,Hr as y,qr as z,fn as A,Kr as B,Wr as C,gn as D,Br as E,yn as F,zr as G,Gr as H,vt as I,Jr as J,Zr as K,eo as L,ro as M,oo as N,Tr as O,ht as P,Re as Q,ze as R,yo as S,Mt as T,Ao as U,Kn as V,Do as W,Gn as X,Vn as Y,zo as Z,Go as _,Vo as $,Xo as aa,Qn as ba,Jo as ca,Ht as da,Zo as ea,Zn as fa,ei as ga,tr as ha,si as ia,sr as ja,cr as ka,dr as la,gr as ma,hr as na};
|
|
1
|
+
import{g as at,j as fe,r as st,t as lt,u as ut,w as q}from"./chunk-S3SSECGB.js";import{Aa as pe,Ba as rt,Ea as $e,Fa as ot}from"./chunk-HOORZY5J.js";import{e as nt,q as it,s as oe}from"./chunk-5P3HGIOR.js";import{createContext as rn,useContext as on,useEffect as an,useMemo as he,useState as mt}from"react";function ct(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function ie(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 He=4,yr=1,br={unit:"set",spares:0,spareSide:"left"};function dt(e){return e.unit==="single"?1:He+e.spares}function Cr(e,t){return[{partNumber:e.partNumber,wheels:dt(t),prices:e.prices}]}function xr(e,t){let n=dt(t)-He;if(n<=0||e.length===0)return e;let r=tn(e),o=r?r[t.spareSide]:0;return e.map((i,a)=>a===o?{...i,wheels:i.wheels+n}:i)}function tn(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 nn(e,t){return t.spares>0?`${e} + spare`:e}function Sr(e){return e.unit==="single"?"Single":nn(`Set of ${He}`,e)}var vr="data-add-to-basket",qe=9,Te="en";function ge(e,t,n=0){return new Intl.NumberFormat(Te,{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:n}).format(e)}function Er(e,t){return new Intl.NumberFormat(Te,{style:"currency",currency:t}).format(e)}import{jsx as un}from"react/jsx-runtime";var pt="storefront-country",ft=rn(null);function sn(e){return gt(e,"catalogue")}function ln(e){return gt(e,"money")}function gt(e,t){let n=new Map(e.map(o=>[o.code,o.decimalPlaces])),r=new Map;return(o,i)=>{if(!i)return"";let a=r.get(i);if(!a){let s=n.get(i)??0;a=new Intl.NumberFormat(Te,{style:"currency",currency:i,minimumFractionDigits:t==="money"?s:0,maximumFractionDigits:s}),r.set(i,a)}return a.format(o)}}function Tr({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=he(()=>t??[],[t]),a=he(()=>n??[],[n]),s=he(()=>r||i.find(y=>y.isDefault)?.code||i[0]?.code||"",[r,i]),c=he(()=>o||a.find(y=>y.isDefault)?.code||a[0]?.code||"",[o,a]),[u,m]=mt(c),[d,S]=mt(!1);an(()=>{let y=oe.getItem(pt);y&&a.some(I=>I.code===y)&&m(y),S(!0)},[a]);function L(y){m(y),oe.setItem(pt,y)}let C=he(()=>{let y=a.find(v=>v.code===u)??null,I=y?.currency,M=I&&i.some(v=>v.code===I)?I:s,D=sn(i),N=ln(i);return{country:u,currency:M,setCountry:L,currencies:i,countries:a,activeCountry:y,formatPrice:(v,x)=>D(v,x??M),formatMoney:(v,x)=>N(v,x??M),ready:d}},[u,i,a,s,d]);return un(ft.Provider,{value:C,children:e})}function ht(){let e=on(ft);if(!e)throw new Error("useCurrency must be used within a CurrencyProvider");return e}import{createContext as Pn,useCallback as k,useContext as In,useEffect as j,useMemo as Nt,useRef as ae,useState as A}from"react";function bt(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var Ct="We'll confirm this discount when you place your order.",kr="Confirmed at checkout";function Ar(e){return e&&(e.valid||e.deferred)?e.code:void 0}var yt="coupon_code: ";function Mr(e){return!(e instanceof fe)||e.status!==400||!e.message.startsWith(yt)?null:e.message.slice(yt.length)}function xt(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 Ne="Price on request",dn="Request a quote",mn="from ",Ur="From ",$r="each",St="Free";function Ke(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function We(e,t){let n=e?.[t];return Ke(n)?n:null}function Hr(e,t,n,r){let o=We(e,n),i=We(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function qr(e,t,n,r){if(n==null&&r==null)return!0;let o=We(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var pn={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function fn(e,t,n){if(!Ke(e))return pn;let r=Ke(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function Kr(e,t,n=""){return!e.priced||e.unit==null?Ne:`${n}${ge(e.unit,t)}`}function Wr(e,t){return e.was==null?null:ge(e.was,t)}function gn(e,t,n=1){let r=ie(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((a,s)=>a+s.wheels,0),i=Math.min(...e.map(a=>a.prices[t]));return{priced:!0,unit:i,isFrom:i*o!==r,setTotal:r*n}}var hn={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function Br(e,t,n,r=1){let o=fn(e.prices[n],e.msrpPrices?.[n],4),i=o.setTotal==null?null:o.setTotal*r;if(!t)return{priced:o.priced,unit:o.unit,isFrom:!0,was:o.was,onSale:o.onSale,setTotal:null,fromSetTotal:i};let a=gn(t.components,n,r);return a.priced?{priced:!0,unit:a.unit,isFrom:a.isFrom,was:null,onSale:!1,setTotal:a.setTotal,fromSetTotal:i}:{...hn,fromSetTotal:i}}function yn(e,t){return!e.priced||e.unit==null?Ne:`${e.isFrom?mn:""}${ge(e.unit,t)}`}function zr(e,t){return e.was==null?null:ge(e.was,t)}function Gr(e,t){return!e.priced||e.unit==null?dn:yn(e,t)}var bn=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function vt(e){return bn.test(e.trim())}var Et="sf:ga-purchases",Cn=20;function It(){return typeof window>"u"||window.parent!==window}function ye(...e){try{if(It()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function xn(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:ie(e.components,t)??0,quantity:e.qty}}function Be(e,t){return e.filter(Re).map(n=>xn(n,t))}function Jr(e){ye("event","view_item",{currency:e.currency,value:e.pricePerSet,items:[{item_id:e.itemId,item_name:e.itemName,...e.variant?{item_variant:e.variant}:{},price:e.pricePerSet,quantity:1}]})}function wt(e,t){let n=Be([e],t);n.length!==0&&ye("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function Zr(e){let t=Be(e.lines,e.currency);t.length!==0&&ye("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var Pt=new Set;function Sn(e){if(Pt.has(e))return!1;Pt.add(e);try{let t=JSON.parse(oe.getItem(Et)??"[]");if(t.includes(e))return!1;oe.setItem(Et,JSON.stringify([...t,e].slice(-Cn)))}catch{}return!0}function eo(e){let t=e.confirmation;if(It()||!Sn(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);ye("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:Be(e.lines,n)}),e.adsSendTo&&ye("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var vn="Arranged after review",Lt="Calculated at checkout",En=Lt,ro=Lt;function Tt({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function oo(e){switch(e){case"arranged":return vn;case"pending":return En;case"free":return St;case"charged":return null}}import{jsx as Nn}from"react/jsx-runtime";var wn=400,Ln=400,Tn=1500;function Re(e){return(e.components?.length??0)>0}function Rt(e,t){return{code:e,valid:t.valid,deferred:bt(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function kt(e,t){return ie(e.components,t)}function ze(e,t){let n=kt(e,t);return n===null?null:n*e.qty}function _t(e){return e!=="tyre"}var At=Pn(null);function yo({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=ht(),[i,a]=A(t),[s,c]=A([]),[u,m]=A([]),[d,S]=A([]),[L,C]=A(!1),[y,I]=A(!1),[M,D]=A(!1),[N,v]=A(!1),[x,K]=A(null),[R,W]=A(void 0),b=ae(r),w=ae("");b.current=b.current||r;let[p,B]=A(null),[Q,F]=A(!1),[O,ve]=A(null),z=ae(void 0),X=k(()=>a(!0),[]),le=k(()=>a(!1),[]),J=k(()=>a(l=>!l),[]);j(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&X()},[X,t]);let Ee=k(l=>{v(!0),_t(l)&&D(!0)},[]),U=M||s.some(l=>_t(l.kind)),Pe=N||s.length>0;j(()=>{if(t||!U||L)return;let l=!0;return q.listWheels().then(f=>{l&&(m(f),C(!0))}),()=>{l=!1}},[t,U,L]),j(()=>{if(t||!Pe||y)return;let l=!0;return q.listBundles().then(f=>{l&&(S(f),I(!0))}),()=>{l=!1}},[t,Pe,y]);let P=x?.deliveryOptions??[];j(()=>{P.length!==0&&ve(l=>l&&P.some(f=>f.id===l)?l:P[0]?.id??null)},[x]);let Z=k(()=>s.filter(Re).flatMap(l=>ct(l.components,l.qty)),[s]),ee=k(async(l,f)=>{let h=l.trim().toUpperCase();if(!h)return;let g=Z();if(g.length===0){B({code:h,valid:!1,message:"Add a wheel to the cart first."});return}F(!0),z.current=f;try{let T=await q.validateCoupon({code:h,items:g,currency:n,shippingMethodId:O??void 0,customerEmail:f});B(Rt(h,T))}catch{B({code:h,valid:!1,message:"Could not check that code. Please try again."})}finally{F(!1)}},[Z,n,O]),ue=k(()=>{B(null),z.current=void 0},[]),ce=k(l=>{if(!p)return;let{code:f}=p;B(h=>h&&h.code===f?{code:f,valid:!1,refused:!0,message:l}:h)},[p]);j(()=>{if(!p||p.refused)return;let l=p.code,f=g=>g!==null&&g.code===l&&!g.refused,h=setTimeout(async()=>{let g=Z();if(g.length===0){B(T=>f(T)?{code:l,valid:!1,message:"Add a wheel to the cart first."}:T);return}F(!0);try{let T=await q.validateCoupon({code:l,items:g,currency:n,shippingMethodId:O??void 0,customerEmail:z.current});B(me=>f(me)?Rt(l,T):me)}catch{}finally{F(!1)}},wn);return()=>clearTimeout(h)},[s,n,O]);let te=p&&!p.refused?p.code:void 0;j(()=>{if(t)return;let l=!0,f=setTimeout(async()=>{let h=Z();if(h.length===0){K(null),W(void 0);return}try{let g=await q.quoteCart({items:h,currency:n,shippingMethodId:O??void 0,couponCode:te,customerEmail:z.current||void 0,country:b.current||void 0,subdivision:w.current||void 0});if(!l)return;K(g)}catch{if(!l)return}W(te)},Ln);return()=>{l=!1,clearTimeout(f)}},[s,n,O,te,r]);let de=k(l=>{c(f=>{let h=f.findIndex(g=>g.id===l.id);return h===-1?[...f,l]:f.map((g,T)=>T===h?{...g,qty:Math.min(qe,g.qty+l.qty)}:g)}),wt(l,n)},[n]),ne=k(l=>{c(f=>f.filter(h=>h.id!==l))},[]),Ie=k((l,f)=>{let h=Math.max(1,Math.min(qe,f));c(g=>g.map(T=>T.id===l?{...T,qty:h}:T))},[]),we=k(l=>{c(l)},[]),[E,$]=A(null),Y=ae(null);Y.current=E;let H=ae(null),Oe=ae(""),Qe=k((l,f)=>{let h=l.trim().toLowerCase();vt(h)&&$(g=>g&&g.email===h&&g.firstName===(f??"")?g:{email:h,firstName:f??""})},[]);j(()=>{if(t||!E)return;let l=xt(s.filter(Re),g=>ze(g,n)===null?Ne:o(ze(g,n),n)),f={email:E.email,firstName:E.firstName,currency:n,items:l},h=JSON.stringify(f);if(h!==Oe.current)return H.current&&clearTimeout(H.current),H.current=setTimeout(()=>{H.current=null,Oe.current=h,q.captureCart(f).catch(g=>{})},Tn),()=>{H.current&&(clearTimeout(H.current),H.current=null)}},[s,E,n,t]);let Je=k(()=>{H.current&&(clearTimeout(H.current),H.current=null);let l=Y.current;l&&(Oe.current="",q.captureCart({email:l.email,firstName:l.firstName,currency:n,items:[]}).catch(f=>{}))},[n]),Ze=Nt(()=>{let l=s.reduce((_,re)=>{let Le=ze(re,n);return Le===null?_:_+Le},0),f=s.some(_=>kt(_,n)===null),h=s.reduce((_,re)=>_+re.qty,0),g=p?.valid?p.effects:void 0,T=g?Math.min(l,Number(g.discountAmount)):0,me=x?.bundleDiscount??0,jt=x?.appliedBundles??[],Fe=!!g?.freeShipping,et=P.find(_=>_.id===O),tt=Fe?0:x?.shipping??et?.amount??0,Qt=Tt({quoted:x!==null,optionCount:P.length,chosenAmount:et?.amount,couponWaivesFreight:Fe}),Ue={};for(let _ of g?.freeUnits??[])Ue[_.partNumber]=(Ue[_.partNumber]??0)+_.quantity;let Jt=x?.tax??null,Zt=x?x.grandTotal:l-T-me+tt;return{sets:h,units:s.reduce((_,re)=>_+(re.components??[]).reduce((Le,en)=>Le+en.wheels*re.qty,0),0),subtotal:l,hasUnpricedLine:f,discount:T,bundleDiscount:me,appliedBundles:jt,shipping:tt,freeShipping:Fe,shippingStatus:Qt,freeUnitsByPartNumber:Ue,tax:Jt,grand:Zt,repricing:!!p?.refused&&x!==null&&R===p?.code,currency:n}},[s,n,p,P,O,x,R]),Yt=Nt(()=>({isOpen:i,preview:t,open:X,close:le,toggle:J,items:s,catalog:u,bundles:d,warmCatalog:Ee,add:de,remove:ne,setQty:Ie,replaceItems:we,identify:Qe,clearCapturedCart:Je,coupon:p,applyCoupon:ee,removeCoupon:ue,refuseCoupon:ce,couponBusy:Q,deliveryOptions:P,shippingMethodId:O,setShippingMethodId:ve,totals:Ze}),[i,t,X,le,J,s,u,d,Ee,de,ne,Ie,we,Qe,Je,p,ee,ue,ce,Q,P,O,Ze]);return Nn(At.Provider,{value:Yt,children:e})}function Mt(){let e=In(At);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as Hn}from"react";function Dt(e,t,n,r){for(;e.size>=t;){let o,i;for(let[s,c]of e){if(c.expiresAt<=r){o=s;break}i===void 0&&n(s)&&(i=s)}let a=o??i??e.keys().next().value;if(a===void 0)return;e.delete(a)}}var Rn=6e4,_n=5e3,kn=500,_e=new Map;async function An(e){let{host:t,matchesRequestHost:n}=await st();if(!t)return"";let r=await lt();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}var Mn=e=>e.includes("|slug:")||e.includes("|xhost:");async function Ot(e,t){if(await ut()!==null)return t();let n=await An(e);if(!n)return t();let r=Date.now(),o=_e.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),a=i.outcome.state==="failed",s=a?_n:Rn,c=_e.get(n)?.lastGood,u=i.outcome.state==="ok"?i:a?c:void 0,m=a&&u?u:i;return Dt(_e,kn,Mn,r),_e.set(n,{load:m,expiresAt:r+s,lastGood:u}),m}var Dn=404;function On(e){if(e instanceof fe&&e.status===Dn)return{state:"absent"};let t=e instanceof fe?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var Fn="[storefront:chrome-load-failed]";function Un(e,t){console.error(`${Fn} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function Ft(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=On(o);return i.state==="failed"&&Un(e,i),{value:n,outcome:i}}}function $n(e){return e==="production"?"silent":"banner"}var Io=$n("production");function qn(e,t){return e?.trim()||t}function Ao({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=qn(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var Kn={name:pe,legalName:null,foundedYear:null,faviconUrl:null,currencies:[],defaultCurrency:null,countries:[],defaultCountry:null,commerceEnabled:!0,cardPayments:!1,paymentMethods:[],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,mapsApiKey:null,mapsMapId:null,socialLinks:$e},Mo=Hn(async()=>Ot("site",()=>Ft("site",async()=>{let e=await q.getSite();return{name:rt(e.name),legalName:e.legalName?.trim()||null,foundedYear:e.foundedYear??null,faviconUrl:e.faviconUrl??null,currencies:e.currencies??[],defaultCurrency:e.defaultCurrency??null,countries:e.countries??[],defaultCountry:e.defaultCountry??null,commerceEnabled:e.commerceEnabled??!0,cardPayments:e.cardPayments??!1,paymentMethods:e.paymentMethods??(e.cardPayments?["card"]:[]),paypalClientId:e.paypalClientId??null,paypalEnvironment:e.paypalEnvironment??null,squareApplicationId:e.squareApplicationId??null,squareLocationId:e.squareLocationId??null,squareEnvironment:e.squareEnvironment??null,ga4MeasurementId:e.ga4MeasurementId??null,googleAdsId:e.googleAdsId??null,googleAdsConversionLabel:(e.googleAdsId?e.googleAdsConversionLabel:null)??null,metaPixelId:e.metaPixelId??null,mapsApiKey:e.mapsApiKey??null,mapsMapId:e.mapsMapId??null,socialLinks:ot(e.socialLinks)}},Kn)));var Do={name:pe,legalName:null,foundedYear:null,faviconUrl:null,currencies:[{code:"USD",symbol:"$",decimalPlaces:2,isDefault:!0}],defaultCurrency:"USD",countries:[{code:"US",name:"United States",currency:"USD",url:"",isDefault:!0,chargeTax:!1,taxDisplay:"none",taxName:"",taxRate:null,postalLabel:"Zip Code"}],defaultCountry:"US",commerceEnabled:!0,cardPayments:!0,paymentMethods:["card"],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,mapsApiKey:null,mapsMapId:null,socialLinks:$e};import{jsx as Ce,jsxs as Ge}from"react/jsx-runtime";import{useEffect as ke,useId as zn,useRef as $t,useState as Ae}from"react";var be=new Map,Wn=64;async function Bn(e){if(!nt())return null;try{let t=await fetch(`${it()}/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 Ut(e){let t=be.get(e);if(t)return t;let n=Bn(e);if(be.set(e,n),be.size>Wn){let r=be.keys().next();r.done||be.delete(r.value)}return n}var Gn={small:54,medium:66,large:84},Vn=44,Xn=202/22,zo=16,Go=140,Yn=.88,Vo=16,jn="invert(1)";function Xo({variant:e="header",scrolled:t=!0,src:n,reverse:r=!1,color:o=null,onLightSurface:i,reversedSrc:a,inkIsDark:s,size:c="medium",sizePx:u,wordmark:m,siteName:d=pe,fitToContainer:S=!1,fitWordmarkToContainer:L=!1,fitFloorPx:C}){let y=m&&m.trim()?m.trim():d,[I,M]=Ae(!1),D=$t(null),N=E=>{D.current=E};ke(()=>{let E=D.current?.ownerDocument??document,$=()=>{M(E.documentElement.getAttribute("data-theme")==="light")};$();let Y=new MutationObserver($);return Y.observe(E.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>Y.disconnect()},[]);let v=n&&n.trim()?n.trim():null,x=!!v&&at(v),K=i??(I&&t),R=o&&o.trim()?o.trim():null,W=r&&!R,b=`logo-color-${zn().replace(/[^A-Za-z0-9_-]/g,"")}`,w=W&&x&&v&&a!=null?{reversed:a,inkIsDark:s??null}:null,p=w!==null,[B,Q]=Ae(null);ke(()=>{if(!W||!v||!x||p){Q(null);return}let E=!1;return Q(null),Ut(v).then($=>{E||Q($)}),()=>{E=!0}},[W,v,x,p]);let F=w??B,O=!!F&&F.inkIsDark!==null&&(K?!F.inkIsDark:F.inkIsDark),ve=W&&!!v&&!x&&!K,z=O&&F?F.reversed:v,X=z?[z]:[],[le,J]=Ae(0);ke(()=>{J(0)},[v,O]);let Ee=e==="footer"?Vn:Gn[c],U=u&&u>0?u:Ee,Pe=Math.round(U*Xn),P=le<X.length?X[le]:null,[Z,ee]=Ae(z),ue=P!==null&&P===Z,ce=$t(null);ke(()=>{let E=ce.current;if(!E||!E.complete)return;if(E.naturalWidth>0||E.naturalHeight>0){ee(P);return}let $=!1;return E.decode().then(()=>!$&&ee(P),()=>!$&&J(Y=>Y+1)),()=>{$=!0}},[P]);let te=S||L,de=`calc(100cqi / ${((y.length+1)*Yn).toFixed(2)})`,ne=te&&C&&C>0?Math.min(C,U):null,Ie=te?ne===null?`min(${U}px, ${de})`:`clamp(${ne}px, ${de}, ${U}px)`:`${U}px`,we=Ge("span",{className:`font-display font-bold tracking-[0.18em] ${ne===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:Ie,lineHeight:1,...R?{color:R}:{}},"aria-label":y,children:[y,Ce("span",{className:"text-accent",style:R?{color:R}:void 0,children:"."})]});return Ge("span",{ref:N,className:"inline-flex items-center",children:[!ue&&we,R&&P&&Ce("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:Ge("filter",{id:b,colorInterpolationFilters:"sRGB",children:[Ce("feFlood",{style:{floodColor:R}}),Ce("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),P&&Ce("img",{ref:ce,src:P,alt:y,width:Pe,height:U,className:"shrink-0 object-contain",style:{...ue?{height:`${U}px`,width:"auto",...S?{maxWidth:"100cqi"}:{}}:{display:"none"},...ve?{filter:jn}:{},...R?{filter:`url(#${b})`}:{}},onLoad:()=>ee(P),onError:()=>J(E=>E+1)},P)]})}import{jsx as xe,jsxs as Jn}from"react/jsx-runtime";function Qn({spokes:e,mesh:t=!1,className:n}){let a=c=>Math.round(c*1e3)/1e3,s=[];for(let c=0;c<e;c++){let u=c/e*Math.PI*2-Math.PI/2;if(s.push({x1:a(100+Math.cos(u)*22),y1:a(100+Math.sin(u)*22),x2:a(100+Math.cos(u)*86),y2:a(100+Math.sin(u)*86),main:!0}),t){let m=u+Math.PI/e;s.push({x1:a(100+Math.cos(m)*22*1.4),y1:a(100+Math.sin(m)*22*1.4),x2:a(100+Math.cos(m)*78),y2:a(100+Math.sin(m)*78),main:!1})}}return Jn("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:[xe("circle",{cx:100,cy:100,r:92,strokeWidth:2}),xe("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),xe("circle",{cx:100,cy:100,r:22,strokeWidth:2}),xe("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),s.map((c,u)=>xe("line",{x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,stroke:"currentColor",strokeWidth:c.main?6:3,strokeLinecap:"round",opacity:c.main?1:.5},u))]})}var Jo="#c9a461",Ht=[{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"}],Zo={name:"",color:"var(--fg)",family:"silver",src:""};function Zn(e,t){let n=r=>{let o=Ht.findIndex(i=>i.f===r);return o===-1?Ht.length:o};return n(e)-n(t)||e.localeCompare(t)}function ei(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(Zn)}import{useState as er}from"react";import{jsx as se,jsxs as Ve}from"react/jsx-runtime";function tr({customerEmail:e}){let{coupon:t,applyCoupon:n,removeCoupon:r,couponBusy:o}=Mt(),[i,a]=er("");async function s(){o||!i.trim()||(await n(i,e),a(""))}return Ve("div",{className:"flex flex-col gap-2",children:[t===null?Ve("div",{className:"flex border border-line",children:[se("input",{type:"text",value:i,onChange:c=>a(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),s())},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"}),se("button",{type:"button",onClick:()=>{s()},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"})]}):Ve("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:[se("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",t.valid?"text-accent":t.deferred?"text-fg":"text-fg-dim line-through"].join(" "),children:t.code}),se("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?se("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:Ct}):t&&!t.valid&&t.message&&se("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:t.message})]})}function si(){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 rr,isValidElement as or,useEffect as Kt,useId as ir,useLayoutEffect as zt,useRef as G,useState as Wt}from"react";var Me=(e,t)=>!!e[t]&&!e[t].disabled;function Xe(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(Me(e,i))return i}return t}function Ye(e,t){return Xe(e,t===1?-1:e.length,t)}function je(e,t){return Me(e,t)?t:Math.max(Ye(e,1),0)}function qt(e,t,n){let{open:r,focus:o}=e,i=a=>({...e,...a});if(t.length===1&&/\S/.test(t)){let a=e.typed+t.toLowerCase(),s=n.findIndex((c,u)=>Me(n,u)&&c.label.toLowerCase().startsWith(a));return{state:i({open:!0,typed:a,focus:s>=0?s: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:Xe(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:Xe(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:Ye(n,1)}),handled:!0};case"End":return{state:i({focus:Ye(n,-1)}),handled:!0};case"Enter":case" ":return Me(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 ar}from"efficient-shell/ui";import{Fragment as mr,jsx as V,jsxs as Gt}from"react/jsx-runtime";var Bt={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function sr({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[a,s]=Wt(!1),c=r!==void 0,u=c?r:a,[m,d]=Wt(0),S=G({text:"",timer:0}),L=G(null),C=G(null),y=G(null),I=ir(),M=G(null),D=e.findIndex(b=>b.value===t),N=b=>{b!==u&&(c||s(b),b?o?.():i?.())},v=b=>{let w=e[b];!w||w.disabled||(n(w.value),N(!1),C.current?.focus())},x=b=>{let w={open:u,focus:u?m:je(e,D),typed:S.current.text},p=qt(w,b,e);return!p.handled&&p.state.open===u?!1:(p.state.typed!==w.typed&&(S.current.text=p.state.typed,window.clearTimeout(S.current.timer),S.current.timer=window.setTimeout(()=>{S.current.text=""},500)),d(p.state.focus),p.commit!==void 0?v(p.commit):N(p.state.open),p.refocus&&C.current?.focus(),p.handled)},K=G(x);K.current=x;let R=G(()=>N(!1));R.current=()=>N(!1);let W=b=>{u||(M.current=b.nativeEvent,K.current(b.key)&&b.preventDefault())};return Kt(()=>{if(!u)return;let b=p=>{L.current?.contains(p.target)||R.current()},w=p=>{p!==M.current&&K.current(p.key)&&p.preventDefault()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",w)}},[u]),Kt(()=>{u&&(S.current.text||d(je(e,D)))},[u]),zt(()=>{if(!u||!y.current)return;y.current.children.item(m)?.scrollIntoView({block:"nearest"})},[m,u]),{open:u,toggle:()=>N(!u),close:()=>N(!1),focusIdx:m,setFocusIdx:d,pick:b=>v(e.findIndex(w=>w.value===b)),wrapRef:L,triggerRef:C,listRef:y,listId:I,onTriggerKeyDown:W,activeId:u?`${I}-${m}`:void 0}}var lr={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 ${Bt.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 ${Bt.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 ur(e,t){zt(()=>{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 a=n.offsetParent??n.parentElement;if(!a)return;let s=a.getBoundingClientRect(),c=n.getBoundingClientRect(),u=Math.abs(c.right-s.right)<Math.abs(c.left-s.left)?"end":"start",m=ar({trigger:{left:s.left,right:s.right,top:s.top,bottom:s.bottom},menu:{width:c.width,height:c.height},bounds:{left:0,top:0,right:r.innerWidth,bottom:r.innerHeight},align:u,side:"bottom"});if(m.side==="top"){i.top="auto",i.bottom="100%",i.marginTop="0px";let S=m.top+Math.min(c.height,m.maxHeight);i.marginBottom=`${Math.max(0,s.top-S)}px`}m.maxHeight<c.height&&(i.maxHeight=`${m.maxHeight}px`,i.overflowY="auto");let d=m.left-c.left;d&&(i.translate=`${d}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function cr({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:a,listRef:s,ariaLabel:c}){let u=lr[t],m=G(null);return ur(m,n.length),V("ul",{ref:d=>{m.current=d,s&&(s.current=d)},id:e,role:"listbox","aria-label":c,...u.pickerMarker?{"data-picker-menu":""}:{},className:u.list,children:n.map((d,S)=>{let L=d.value===r;return V("li",{id:`${e}-${S}`,role:"option","aria-selected":L,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(S),onMouseDown:C=>{C.preventDefault(),d.disabled||a(d.value)},className:u.item(S===o,L&&d.value!=="",!!d.disabled,S===n.length-1),style:u.itemStyle?.(L),children:d.meta===void 0?d.label:Gt(mr,{children:[d.lead,V("span",{className:"flex-1 whitespace-nowrap",children:d.label}),V("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${S}`)})})}function dr({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:a,id:s,"aria-label":c}){let u=rr.toArray(r).flatMap(C=>{if(!or(C))return[];if(C.type!=="option")return[];let I=C.props,M=I.value!==void 0?String(I.value):"",D=I.children,N=typeof D=="string"||typeof D=="number"?String(D):M;return[{value:M,label:N,disabled:!!I.disabled}]}),m=e??"",d=sr({items:u,value:m,onPick:C=>t?.({target:{value:C}})}),L=u.find(C=>C.value===m)?.label??u[0]?.label??"";return Gt("div",{ref:d.wrapRef,className:"relative",children:[a&&V("input",{type:"hidden",name:a,value:m}),V("button",{ref:C=>{d.triggerRef.current=C},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":c,id:s,onClick:()=>!n&&d.toggle(),onKeyDown:C=>!n&&d.onTriggerKeyDown(C),className:`block w-full ${o??""}`,style:i,children:V("span",{className:"block w-full truncate text-left",children:L})}),d.open&&V(cr,{id:d.listId,tone:"select",items:u,value:m,focusIdx:d.focusIdx,onFocus:d.setFocusIdx,onPick:d.pick,listRef:d.listRef})]})}import{jsx as Se,jsxs as De}from"react/jsx-runtime";var pr="font-mono text-[length:var(--size-label,12px)]",fr="font-semibold uppercase tracking-[0.22em] text-fg";function Vt(e){return`${e??pr} ${fr}`}function Xt(){return Se("span",{className:"text-accent",children:" *"})}function gr({children:e,required:t,labelFace:n}){return De("span",{className:Vt(n),children:[e,t?Se(Xt,{}):null]})}function hr({label:e,required:t,hint:n,separate:r,htmlFor:o,labelFace:i,className:a,children:s}){let c=a?`flex flex-col gap-2 ${a}`:"flex flex-col gap-2",u=n?Se("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?De("div",{className:c,children:[De("label",{htmlFor:o,className:Vt(i),children:[e,t?Se(Xt,{}):null]}),s,u]}):De("label",{htmlFor:o,className:c,children:[Se(gr,{required:t,labelFace:i,children:e}),s]})}export{kr as a,Ar as b,Mr as c,ct as d,He as e,yr as f,br as g,Cr as h,xr as i,tn as j,nn as k,Sr as l,vr as m,qe as n,Te as o,ge as p,Er as q,Ne as r,dn as s,mn as t,Ur as u,$r as v,St as w,We as x,Hr as y,qr as z,fn as A,Kr as B,Wr as C,gn as D,Br as E,yn as F,zr as G,Gr as H,vt as I,Jr as J,Zr as K,eo as L,ro as M,oo as N,Tr as O,ht as P,Re as Q,ze as R,yo as S,Mt as T,Ao as U,Kn as V,Do as W,Gn as X,Vn as Y,zo as Z,Go as _,Vo as $,Xo as aa,Qn as ba,Jo as ca,Ht as da,Zo as ea,Zn as fa,ei as ga,tr as ha,si as ia,sr as ja,cr as ka,dr as la,gr as ma,hr as na};
|