efficient-storefront-blocks 0.109.0 → 0.111.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 +40 -0
- package/dist/chunks/EditorPreviewCheckout-C42GCC3T.js +4 -0
- package/dist/chunks/{SiteEditorProvider-KN5FKGBX.js → SiteEditorProvider-P4HVFXUX.js} +1 -1
- package/dist/chunks/chunk-CPAF23MT.js +1 -0
- package/dist/chunks/chunk-FRCI3FAV.js +80 -0
- package/dist/chunks/{chunk-SUX7QH3R.js → chunk-GB6OHYUY.js} +1 -1
- package/dist/chunks/{chunk-X3ERHC7Y.js → chunk-MVJVIU2F.js} +1 -1
- package/dist/chunks/chunk-RFFTWKCU.js +340 -0
- package/dist/chunks/{fitment-data-Z3FDYFU6.js → fitment-data-EGBXHTFW.js} +1 -1
- package/dist/contract.js +8 -2
- package/dist/editor/components/BlogSource.d.ts +1 -1
- package/dist/editor/components/BlogSource.js +1 -1
- package/dist/editor/lib/efficient-backend.js +1 -1
- package/dist/index.js +32 -32
- package/dist/links.js +1 -1
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/CartContext.d.ts +3 -0
- package/dist/render/components/CartContext.js +1 -1
- package/dist/render/components/Events.d.ts +2 -1
- package/dist/render/components/Events.js +1 -1
- package/dist/render/components/cart/drawer-parts.js +1 -1
- package/dist/render/components/checkout/CheckoutPageClient.js +1 -1
- package/dist/render/components/checkout/checkout-parts.d.ts +11 -0
- package/dist/render/components/checkout/checkout-parts.js +1 -1
- package/dist/render/components/checkout/checkout-state.d.ts +5 -0
- package/dist/render/components/checkout/checkout-state.js +3 -3
- package/dist/render/lib/checkout/checkout-memory.d.ts +62 -0
- package/dist/render/lib/checkout/checkout-memory.js +1 -0
- package/dist/render/lib/checkout/wallet-return.d.ts +3 -0
- package/dist/render/lib/checkout/wallet-return.js +1 -1
- package/dist/render/lib/content/event-post.d.ts +5 -0
- package/dist/render/lib/content/event-post.js +1 -0
- package/dist/render/lib/document/blocks/service/Events/render.js +1 -1
- package/dist/render/lib/wheels/price-display.d.ts +2 -0
- package/dist/render/lib/wheels/price-display.js +1 -1
- package/dist/words.d.ts +1 -0
- package/dist/words.js +1 -1
- package/package.json +3 -3
- package/dist/chunks/EditorPreviewCheckout-IVYEDVVN.js +0 -4
- package/dist/chunks/chunk-5VN7IA5L.js +0 -1
- package/dist/chunks/chunk-G5XZ736Y.js +0 -339
- package/dist/chunks/chunk-UBOGEIFX.js +0 -74
- /package/dist/chunks/{chunk-G5XZ736Y.js.LEGAL.txt → chunk-RFFTWKCU.js.LEGAL.txt} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.111.0 - 2026-11-15
|
|
4
|
+
|
|
5
|
+
From main at `b086f606`: #568. No peer change: `efficient-web-builder ^68.2.0 || ^69.0.0`, `efficient-shell ^13.3.0`, `efficient-easel ^34.3.0`. No export removed (1 added). No stored page moves.
|
|
6
|
+
|
|
7
|
+
**For hosts:**
|
|
8
|
+
- `WalletReturnPage` (`render/lib/checkout/wallet-return`) now requires `lostChange: () => void` (#568). Only the blocks' own checkout page builds one; no host does (storefront and admin-portal: 0 uses outside the vendored blocks source). A host that builds its own `WalletReturnPage` adds the sink.
|
|
9
|
+
- The storefront re-vendors `src/` with `node scripts/sync-storefront-blocks.mjs`, then runs `just check`.
|
|
10
|
+
- admin-portal: no step beyond the version.
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **A wallet return keeps the lost-change line** (#568, checkout PR C): when the last change was not saved and the shopper leaves for a redirect wallet (Afterpay, Zip, Klarna, GoCardless), the parked wallet context holds `lostChange`, and every return leg says "Your last change was not saved. This is your order as placed." again. New `parkedLostChange(context)` reads it (only `true` counts). A context parked before this field reads as nothing lost. No new text and no new part.
|
|
15
|
+
|
|
16
|
+
## 0.110.0 - 2026-11-15
|
|
17
|
+
|
|
18
|
+
**A major for hosts (major version zero, so a minor number):** the `efficient-shell` peer is `^13.3.0` (was `^13.0.0`, #559). The `efficient-web-builder` peer widens to `^68.2.0 || ^69.0.0`. From main at `524defe9`: #556, #557, #559, #561, #562, #563, #564, #565, #566. `efficient-easel ^34.3.0` unchanged. No export removed (21 added). No stored page moves.
|
|
19
|
+
|
|
20
|
+
**For hosts:**
|
|
21
|
+
- **BREAKING (#559):** the embed entries bundle efficient-web-builder and leave efficient-shell to the host. Builder 69 imports `efficient-shell/icons/brands`, which exists only from efficient-shell 13.3.0. admin-portal (on `^13.2.0`) takes efficient-shell 13.3.0 or later in the same bump that takes this release. The storefront takes efficient-shell 13.3.0 with it; it may also take efficient-web-builder 69 (68.2 stays inside the peer).
|
|
22
|
+
- The storefront re-vendors `src/` with `node scripts/sync-storefront-blocks.mjs`, then runs `just check`. The checkout changes (#557, #564) and the journal pieces (#556) reach it only through that copy.
|
|
23
|
+
- No new backend endpoint. The checkout memory (#564) uses the tab's session storage only.
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- **The checkout keeps its order key and memory across a reload** (#564): new `render/lib/checkout/checkout-memory` (`parkCheckoutMemory`, `readCheckoutMemory`, `clearCheckoutMemory`, `parkRequest`, `sendableRequest`, `parkForm`, `parkLine`, `parkOrder`, `holdsPress`). An allow-list of fields is parked in session storage from the first press until a landing; no payment data is parked. After a restore the totals wait for the server's quote (`FIGURE_UPDATING`, `PRICES_REQUOTED`). A press after a reload uses the same idempotency key, so it cannot place a second order.
|
|
28
|
+
- **One post-to-card rule and a served journal category** (#556): new `render/lib/content/event-post` (`blogPostRowOfAdmin`, `eventPostOf`), used by the editor's Blog control and the backend binding. `Events` takes an optional `servedCategory`: a published section with no card then says "No posts in this category yet." with an "All posts" link. The editor's post date is now the post's UTC day (`postDateLabel`), as on every other post surface.
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- **The checkout form is locked while a press waits** (#557). Every contact, address, delivery, coupon and payment-method control, "Not you? Sign out" and the courier's "Try again" are disabled from the press until its answer (order request, address save, card start, wallet start, release). The card step and a hosted wallet now always get the checkout as it is on the page. A redirect to a wallet keeps the form locked; a return by the browser's Back button offers "Try payment again" for that order. The form parts sit in one lock, `FormLock` (a disabled `<fieldset>`), so a control added later is locked too. "Edit ↗", "Browse the catalog" and the header's links to the shop lead nowhere during the wait (`LeaveLink`). A wallet redirect that the browser refuses (a navigation that throws) gives the form back with "Try payment again". New exports: `formLocked` on `CheckoutState`, `FormLock`, `LeaveLink` (minor). The branches that served a change made during the wait are deleted.
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- **Dependencies (#559):** efficient-shell peer `^13.3.0`, efficient-web-builder peer `^68.2.0 || ^69.0.0`; dev install efficient-web-builder 69 and efficient-shell 13.3.0. The editor words gain `"Chips"`.
|
|
37
|
+
|
|
38
|
+
### Internal
|
|
39
|
+
|
|
40
|
+
- Browser checks run by discovery, not a list (#561); the README names the one-time Chromium install (#562).
|
|
41
|
+
- Guards: one JS/TS extension list and one whole-tree floor in `scripts/blocks-source.ts` (#563, #565: `BLOCKS_SOURCE_FLOOR`, `BLOCKS_TSX_FLOOR`); the align checks come from efficient-web-builder 69.1.0 (`one-block-box-word-map`, `ALIGN_TABLE_WORDS`), dev builder `^69.1.0` (#566).
|
|
42
|
+
|
|
3
43
|
## 0.109.0 - 2026-11-14
|
|
4
44
|
|
|
5
45
|
**A major for hosts (major version zero, so a minor number):** the `efficient-web-builder` peer is `^68.2.0` (was `^68.0.0`, #555). From main at `4278711f`: #551, #553, #554, #555. Other peers unchanged: `efficient-shell ^13.0.0`, `efficient-easel ^34.3.0`. No export removed. No stored page moves; the drawn bytes are the same.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use client";import{A as Wr,P as $r,Q as Yr,R as Br,S as zr,T as Hr,U as ye,W as xt,X as Gr,Y as Jr,Z as Yt,_ as Vr,aa as kn,b as Dr,ba as te,c as xn,d as jr,e as Wt,ea as Xr,fa as Zr,ka as Qr,la as Ne,ma as eo,na as to,sa as no,ta as kt,wa as Cn,y as $t,ya as ae,z as Ur}from"./chunk-CPAF23MT.js";import{P as ue,V as nt,aa as $}from"./chunk-MVJVIU2F.js";import{ni as Mr,pi as He,ti as _r}from"./chunk-FRCI3FAV.js";import{n as Kr,o as vt,p as ce}from"./chunk-GB6OHYUY.js";import{a as vn,b as pi}from"./chunk-Y6SLVHK3.js";var ao=vn((As,oo)=>{"use strict";var fi="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";oo.exports=fi});var lo=vn((Ls,co)=>{"use strict";var gi=ao();function io(){}function so(){}so.resetWarningCache=io;co.exports=function(){function e(r,a,c,d,g,f){if(f!==gi){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:so,resetWarningCache:io};return n.PropTypes=n,n}});var po=vn((Fs,uo)=>{"use strict";uo.exports=lo()();var Is,Ts});import{useEffect as Oa,useMemo as Na,useRef as st,useState as Je}from"react";import{rootIsDark as mi}from"efficient-shell/format";function ro(){if(typeof document>"u")return;let e=getComputedStyle(document.documentElement),t=(r,a)=>e.getPropertyValue(r).trim()||a,n=mi({whenUnset:!0});return{theme:n?"night":"stripe",variables:{colorPrimary:t("--accent",n?"#c9a461":"#8a6a2a"),colorBackground:t("--site-surface",n?"#131313":"#ffffff"),colorText:t("--fg",n?"#f5f1e8":"#0a0a0a"),borderRadius:"0px"}}}var M=pi(po(),1);import I from"react";function mo(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function yi(e){if(Array.isArray(e))return e}function bo(e,t,n){return(t=Ci(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hi(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,c,d,g=[],f=!0,m=!1;try{if(c=(n=n.call(e)).next,t!==0)for(;!(f=(r=c.call(n)).done)&&(g.push(r.value),g.length!==t);f=!0);}catch(h){m=!0,a=h}finally{try{if(!f&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(m)throw a}}return g}}function bi(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function go(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fo(Object(n),!0).forEach(function(r){bo(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function vi(e,t){if(e==null)return{};var n,r,a=xi(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function xi(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function vo(e,t){return yi(e)||hi(e,t)||Pi(e,t)||bi()}function ki(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ci(e){var t=ki(e,"string");return typeof t=="symbol"?t:t+""}function Pn(e){"@babel/helpers - typeof";return Pn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pn(e)}function Pi(e,t){if(e){if(typeof e=="string")return mo(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mo(e,t):void 0}}var V=function(t,n,r){var a=!!r,c=I.useRef(r);I.useEffect(function(){c.current=r},[r]),I.useEffect(function(){if(!a||!t)return function(){};var d=function(){if(c.current)return c.current.apply(c,arguments)};return t.on(n,d),function(){t.off(n,d)}},[a,n,t,c])},wn=function(t){var n=I.useRef(t);return I.useEffect(function(){n.current=t},[t]),n.current},rt=function(t){return t!==null&&Pn(t)==="object"},wi=function(t){return rt(t)&&typeof t.then=="function"},Ni=function(t){return rt(t)&&typeof t.elements=="function"&&typeof t.createToken=="function"&&typeof t.createPaymentMethod=="function"&&typeof t.confirmCardPayment=="function"},yo="[object Object]",Si=function e(t,n){if(t===n)return!0;if(!rt(t)||!rt(n))return t===n;var r=Array.isArray(t),a=Array.isArray(n);if(r!==a)return!1;var c=Object.prototype.toString.call(t)===yo,d=Object.prototype.toString.call(n)===yo;if(c!==d)return!1;if(!c&&!r)return t===n;var g=Object.keys(t),f=Object.keys(n);if(g.length!==f.length)return!1;for(var m={},h=0;h<g.length;h+=1)m[g[h]]=!0;for(var k=0;k<f.length;k+=1)m[f[k]]=!0;var v=Object.keys(m);if(v.length!==g.length)return!1;var y=t,E=n,C=function(D){return e(y[D],E[D])};return v.every(C)},xo=function(t,n,r){return rt(t)?Object.keys(t).reduce(function(a,c){var d=!rt(n)||!Si(t[c],n[c]);return r.includes(c)?(d&&console.warn("Unsupported prop change: options.".concat(c," is not a mutable property.")),a):d?go(go({},a||{}),{},bo({},c,t[c])):a},null):null},ko="Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.",ho=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ko;if(t===null||Ni(t))return t;throw new Error(n)},Ei=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ko;if(wi(t))return{tag:"async",stripePromise:Promise.resolve(t).then(function(a){return ho(a,n)})};var r=ho(t,n);return r===null?{tag:"empty"}:{tag:"sync",stripe:r}},Ri=function(t){!t||!t._registerWrapper||!t.registerAppInfo||(t._registerWrapper({name:"react-stripe-js",version:"6.12.0"}),t.registerAppInfo({name:"react-stripe-js",version:"6.12.0",url:"https://stripe.com/docs/stripe-js/react"}))},Bt=I.createContext(null);Bt.displayName="ElementsContext";var Co=function(t,n){if(!t)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(n," in an <Elements> provider."));return t},Sn=function(t){var n=t.stripe,r=t.options,a=t.children,c=I.useMemo(function(){return Ei(n)},[n]),d=I.useState(function(){return{stripe:c.tag==="sync"?c.stripe:null,elements:c.tag==="sync"?c.stripe.elements(r):null}}),g=vo(d,2),f=g[0],m=g[1];I.useEffect(function(){var v=!0,y=function(C){m(function(R){return R.stripe?R:{stripe:C,elements:C.elements(r)}})};return c.tag==="async"&&!f.stripe?c.stripePromise.then(function(E){E&&v&&y(E)}):c.tag==="sync"&&!f.stripe&&y(c.stripe),function(){v=!1}},[c,f,r]);var h=wn(n);I.useEffect(function(){h!==null&&h!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[h,n]);var k=wn(r);return I.useEffect(function(){if(f.elements){var v=xo(r,k,["clientSecret","fonts"]);v&&f.elements.update(v)}},[r,k,f.elements]),I.useEffect(function(){Ri(f.stripe)},[f.stripe]),I.createElement(Bt.Provider,{value:f},a)};Sn.propTypes={stripe:M.default.any,options:M.default.object};var Po=function(t){var n=I.useContext(Bt);return Co(n,t)},wo=function(){var t=Po("calls useElements()"),n=t.elements;return n},Oi=function(t){var n=t.children,r=Po("mounts <ElementsConsumer>");return n(r)};Oi.propTypes={children:M.default.func.isRequired};var Ai=I.createContext(null);Ai.displayName="CheckoutContext";var No=I.createContext(null);No.displayName="CheckoutSdkContext";var Nn=function(t){var n=I.useContext(No),r=I.useContext(Bt);if(n){if(r)throw new Error("You cannot wrap the part of your app that ".concat(t," in both a checkout provider and <Elements> provider."));return n}else return Co(r,t)},Li=["mode"],Ii=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},_=function(t,n,r){var a="".concat(Ii(t),"Element"),c=function(m){var h=m.id,k=m.className,v=m.options,y=v===void 0?{}:v,E=m.onBlur,C=m.onFocus,R=m.onReady,D=m.onChange,O=m.onEscape,S=m.onClick,B=m.onLoadError,X=m.onLoaderStart,de=m.onNetworksChange,j=m.onConfirm,ie=m.onCancel,Re=m.onShippingAddressChange,De=m.onShippingRateChange,Q=m.onSavedPaymentMethodRemove,be=m.onSavedPaymentMethodUpdate,ne=m.onAvailablePaymentMethodsChange,ee=Nn("mounts <".concat(a,">")),z="elements"in ee?ee.elements:null,b="checkoutSdk"in ee?ee.checkoutSdk:null,Oe=I.useState(null),je=vo(Oe,2),U=je[0],ct=je[1],Z=I.useRef(null),ve=I.useRef(null);V(U,"blur",E),V(U,"focus",C),V(U,"escape",O),V(U,"click",S),V(U,"loaderror",B),V(U,"loaderstart",X),V(U,"networkschange",de),V(U,"confirm",j),V(U,"cancel",ie),V(U,"shippingaddresschange",Re),V(U,"shippingratechange",De),V(U,"savedpaymentmethodremove",Q),V(U,"savedpaymentmethodupdate",be),V(U,"availablepaymentmethodschange",ne),V(U,"change",D);var Ae;R&&(t==="expressCheckout"?Ae=R:Ae=function(){R(U)}),V(U,"ready",Ae),I.useLayoutEffect(function(){if(Z.current===null&&ve.current!==null&&(z||b)){var L=null;if(b){var re=b,pe=b;switch(t){case"paymentForm":L=pe.createForm(y);break;case"payment":L=re.createPaymentElement(y);break;case"address":if("mode"in y){var Ie=y.mode,xe=vi(y,Li);if(Ie==="shipping")L=re.createShippingAddressElement(xe);else if(Ie==="billing")L=re.createBillingAddressElement(xe);else throw new Error("Invalid options.mode. mode must be 'billing' or 'shipping'.")}else throw new Error("You must supply options.mode. mode must be 'billing' or 'shipping'.");break;case"expressCheckout":L=re.createExpressCheckoutElement(y);break;case"currencySelector":L=b.createCurrencySelectorElement();break;case"taxId":L=re.createTaxIdElement(y);break;case"contactDetails":L=re.createContactDetailsElement();break;case"linkSignup":if("createLinkSignupElement"in b)L=b.createLinkSignupElement(y);else throw new Error("<LinkSignupElement> requires <CheckoutElementsProvider> and is not supported inside <CheckoutFormProvider>.");break;case"terms":L=re.createTermsElement(y);break;default:throw new Error("<".concat(a,"> is not supported inside a checkout provider. Use an <Elements> provider instead."))}}else z&&(L=z.create(t,y));Z.current=L,ct(L),L&&L.mount(ve.current)}},[z,b,y]);var Le=wn(y);return I.useEffect(function(){if(Z.current){var L=xo(y,Le,["paymentRequest"]);L&&"update"in Z.current&&Z.current.update(L)}},[y,Le]),I.useLayoutEffect(function(){return function(){if(Z.current&&typeof Z.current.destroy=="function")try{Z.current.destroy(),Z.current=null}catch{}}},[]),I.createElement("div",{id:h,className:k,ref:ve})},d=function(m){Nn("mounts <".concat(a,">"));var h=m.id,k=m.className;return I.createElement("div",{id:h,className:k})},g=n?d:c;return g.propTypes={id:M.default.string,className:M.default.string,onChange:M.default.func,onBlur:M.default.func,onFocus:M.default.func,onReady:M.default.func,onEscape:M.default.func,onClick:M.default.func,onLoadError:M.default.func,onLoaderStart:M.default.func,onNetworksChange:M.default.func,onConfirm:M.default.func,onCancel:M.default.func,onShippingAddressChange:M.default.func,onShippingRateChange:M.default.func,onSavedPaymentMethodRemove:M.default.func,onSavedPaymentMethodUpdate:M.default.func,onAvailablePaymentMethodsChange:M.default.func,options:M.default.object},g.displayName=a,g.__elementType=t,g},K=typeof window>"u",Ti=I.createContext(null);Ti.displayName="EmbeddedCheckoutProviderContext";var So=function(){var t=Nn("calls useStripe()"),n=t.stripe;return n},Ms=_("auBankAccount",K),_s=_("card",K),Ks=_("cardNumber",K),Ds=_("cardExpiry",K),js=_("cardCvc",K),Us=_("currencySelector",K),Ws=_("iban",K),Eo=_("payment",K),$s=_("expressCheckout",K),Ys=_("paymentRequestButton",K),Bs=_("linkAuthentication",K),zs=_("linkSignup",K),Hs=_("contactDetails",K),Gs=_("address",K),Js=_("shippingAddress",K),Vs=_("paymentMethodMessaging",K),Xs=_("taxId",K),Zs=_("issuingCardNumberDisplay",K),Qs=_("issuingCardCvcDisplay",K),ec=_("issuingCardExpiryDisplay",K),tc=_("issuingCardPinDisplay",K),nc=_("issuingCardCopyButton",K),rc=_("terms",K);function Gt(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Gt=function(t){return typeof t}:Gt=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gt(e)}var Ao="dahlia",Fi=function(t){return t===3?"v3":t},Lo="https://js.stripe.com",qi="".concat(Lo,"/").concat(Ao,"/stripe.js"),Mi=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,_i=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,Ro="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",Ki=function(t){return Mi.test(t)||_i.test(t)},Di=function(){for(var t=document.querySelectorAll('script[src^="'.concat(Lo,'"]')),n=0;n<t.length;n++){var r=t[n];if(Ki(r.src))return r}return null},Oo=function(t){var n=t&&!t.advancedFraudSignals?"?advancedFraudSignals=false":"",r=document.createElement("script");r.src="".concat(qi).concat(n);var a=document.head||document.body;if(!a)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return a.appendChild(r),r},ji=function(t,n){!t||!t._registerWrapper||t._registerWrapper({name:"stripe-js",version:"9.17.0",startTime:n})},Ct=null,zt=null,Ht=null,Ui=function(t){return function(n){t(new Error("Failed to load Stripe.js",{cause:n}))}},Wi=function(t,n){return function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))}},$i=function(t){return Ct!==null?Ct:(Ct=new Promise(function(n,r){if(typeof window>"u"||typeof document>"u"){n(null);return}if(window.Stripe&&t&&console.warn(Ro),window.Stripe){n(window.Stripe);return}try{var a=Di();if(a&&t)console.warn(Ro);else if(!a)a=Oo(t);else if(a&&Ht!==null&&zt!==null){var c;a.removeEventListener("load",Ht),a.removeEventListener("error",zt),(c=a.parentNode)===null||c===void 0||c.removeChild(a),a=Oo(t)}Ht=Wi(n,r),zt=Ui(r),a.addEventListener("load",Ht),a.addEventListener("error",zt)}catch(d){r(d);return}}),Ct.catch(function(n){return Ct=null,Promise.reject(n)}))},Yi=function(t,n,r){if(t===null)return null;var a=n[0];if(typeof a!="string")throw new Error("Expected publishable key to be of type string, got type ".concat(Gt(a)," instead."));var c=a.match(/^pk_test/),d=Fi(t.version),g=Ao;c&&d!==g&&console.warn("Stripe.js@".concat(d," was loaded on the page, but @stripe/stripe-js@").concat("9.17.0"," expected Stripe.js@").concat(g,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var f=t.apply(void 0,n);return ji(f,r),f},Pt,Io=!1,To=function(){return Pt||(Pt=$i(null).catch(function(t){return Pt=null,Promise.reject(t)}),Pt)};Promise.resolve().then(function(){return To()}).catch(function(e){Io||console.warn(e)});var Jt=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];Io=!0;var a=Date.now();return To().then(function(c){return Yi(c,n,a)})};var wt=2;function Fo(e){return e==="card"}var Bi="checkout_unavailable",zi="checkout_waiting",qo="committed",_e="We could not check your payment. Please try again.",ot="Your last change was not saved. This is your order as placed.",Mo="Your bank is still waiting for you to approve this payment, so your order stays as it was. Finish the approval, or try again in a few minutes.",_o=1e4;async function Ko(e,t=_o){let n,r=new Promise(c=>{n=setTimeout(()=>c(void 0),t)}),a=(async()=>{try{return(await(await Jt(e.publishableKey))?.retrievePaymentIntent(e.clientSecret))?.paymentIntent?.status}catch{return}})();try{return await Promise.race([a,r])}finally{clearTimeout(n)}}var Do=new Set(["none","requires_payment_method","canceled"]);async function En(e,t=_o){let n,r=new Promise(a=>{n=setTimeout(()=>a(void 0),t)});try{return await Promise.race([$.releaseCheckout({idempotencyKey:e}).then(a=>a.status,()=>{}),r])}finally{clearTimeout(n)}}function jo(e,t){return e instanceof ue&&typeof e.data=="object"&&e.data!==null&&e.data.code===t}function Vt(e){return jo(e,Bi)}function Rn(e){return jo(e,zi)}function On(e){return e instanceof ue&&e.status>=400&&e.status<500&&e.status!==408}function Uo(e){return JSON.stringify([e.email,e.firstName,e.lastName,e.phone,e.address,e.city,e.subdivision,e.postcode,e.country,e.lines,e.shippingMethodId,e.couponCode,e.currency,e.shopperId,e.company])}function Xt(e){return e.orderNumber||e.checkoutNumber}function Hi(e){return e.orderNumber?{kind:"placed",order:e}:{kind:e.status==="released"?"refunded":e.status==="expired"?"expired":"pending",checkoutNumber:e.checkoutNumber}}async function Wo({checkoutNumber:e,resend:t,page:n}){n.setConfirming(!0);let r;try{r=Hi(await t())}catch{r={kind:"pending",checkoutNumber:e}}r.kind==="placed"?(n.markPaid(),n.track(r.order),n.land(r.order)):n.unplaced({...r,checkoutNumber:r.checkoutNumber||e}),n.setConfirming(!1)}import{createContext as is,useContext as ss,useEffect as Y,useMemo as sa,useRef as q,useState as w}from"react";var Gi="sf:gclid",Ji="sf:fbclid",Vi=2160*60*60*1e3;function Bo(){return typeof window<"u"}function $o(e){let t=vt.getItem(e);if(!t)return"";try{let{v:n,t:r}=JSON.parse(t);return!n||typeof r!="number"||Date.now()-r>Vi?"":n}catch{return""}}function Yo(e){if(!Bo())return"";let t=e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1"),n=document.cookie.match(new RegExp(`(?:^|; )${t}=([^;]*)`));return n?decodeURIComponent(n[1]):""}function zo(){if(!Bo())return{};let e=$o(Gi),t=$o(Ji),n=Yo("_fbp"),r=Yo("_fbc");!r&&t&&(r=`fb.1.${Date.now()}.${t}`);let a={};return e&&(a.gclid=e),t&&(a.fbclid=t),n&&(a.fbp=n),r&&(a.fbc=r),a}var Ho="sf:meta-purchases",Xi=20;function Jo(){return typeof window>"u"||window.parent!==window}function Zi(...e){try{if(Jo()||typeof window.fbq!="function")return;window.fbq(...e)}catch{}}var Go=new Set;function Qi(e){if(Go.has(e))return!1;Go.add(e);try{let t=JSON.parse(vt.getItem(Ho)??"[]");if(t.includes(e))return!1;vt.setItem(Ho,JSON.stringify([...t,e].slice(-Xi)))}catch{}return!0}function es(e){return[...new Set(e.filter(xt).flatMap(t=>t.components.map(n=>n.partNumber)))]}function Vo(e){let t=e.confirmation;Jo()||!Qi(t.orderNumber)||Zi("track","Purchase",{value:Number(t.grandTotal),currency:t.currency,content_type:"product",content_ids:es(e.lines)},{eventID:t.orderNumber})}var An="checkout-afterpay-context",Zt="checkout-gocardless-context",Ln="checkout-zip-context",Qt="checkout-klarna-context";function en(e){return e?.lostChange===!0}function ts({evidence:e,parked:t}){return e?{action:"capture",evidence:e,parked:t}:t?{action:"settle",parked:t}:{action:"ignore"}}function ns(e,t){let n=e.getItem(t);if(e.removeItem(t),!n)return null;try{return JSON.parse(n)}catch{return null}}var Xo={name:"Afterpay",legParam:"afterpay",legValues:["confirm","cancel"],storageKey:An,evidenceFrom(e,t){return t==="cancel"||(e.get("status")??"").toUpperCase()==="CANCELLED"?null:e.get("orderToken")},requestFrom:e=>({token:e})},Zo={name:"Zip",legParam:"zip",legValues:["return"],storageKey:Ln,evidenceFrom(e){let t=(e.get("result")??"").toLowerCase();return t==="cancelled"||t==="declined"?null:e.get("checkoutId")},requestFrom:e=>({checkoutId:e})};async function In(e,t){let n=new URLSearchParams(t.search),r=n.get(e.legParam);if(!r||!e.legValues.includes(r))return;let a=ns(t.storage,e.storageKey),c=e.evidenceFrom(n,r);t.scrubQuery();let d=ts({evidence:c,parked:a});if(d.action!=="ignore"){if(t.page.clearCart(),en(d.parked)&&t.page.lostChange(),d.action==="settle"){t.page.note(`The ${e.name} payment was not completed \u2014 our team will follow up on payment.`),t.page.land(d.parked.confirmation);return}t.page.setConfirming(!0);try{let g=await t.capture(e.requestFrom(d.evidence));g.status==="paid"?t.page.markPaid():t.page.note(`${e.name} declined the payment \u2014 our team will follow up on payment.`),t.page.land(d.parked?.confirmation??g)}catch{d.parked?(t.page.note(`We could not confirm the ${e.name} payment \u2014 our team will follow up on payment.`),t.page.land(d.parked.confirmation)):t.page.fail(`We could not confirm your ${e.name} payment. Please contact us before trying again \u2014 your payment may already have been taken.`)}finally{t.page.setConfirming(!1)}}}function Qo(e,t,n){let r=(t??"").trim();if(!r)return"";if(n.length===0)return r;let a=r.toUpperCase(),c=`${e.toUpperCase()}-${a}`,d=n.find(g=>g.code&&g.code.toUpperCase()===a)??n.find(g=>g.code&&g.code.toUpperCase()===c)??n.find(g=>g.name.toUpperCase()===a);return d?d.code||d.name:""}var Fn="checkout-memory-context",ta="Prices have changed since this checkout started. The total shows today's prices.",na=2,rs=3600*1e3;function os(e){return{id:e.id,slug:e.slug,name:{lead:e.name?.lead,accent:e.name?.accent},process:e.process,positionNo:e.positionNo,config:(e.config??[]).map(t=>({label:t.label,gold:t.gold})),finishName:e.finishName,size:e.size,qty:e.qty,href:e.href,kind:e.kind,sku:e.sku,components:e.components.map(t=>({partNumber:t.partNumber,wheels:t.wheels,prices:{...t.prices},hand:t.hand}))}}var at=e=>e.map(os);function ra(e){let t=e.customer;return{customer:{email:t.email,name:t.name,phone:t.phone,companyName:t.companyName,address:t.address,city:t.city,state:t.state,zipCode:t.zipCode,country:t.country},items:e.items.flatMap(n=>Wt([{partNumber:n.partNumber,wheels:n.quantity,prices:{}}],1)),currency:e.currency,idempotencyKey:e.idempotencyKey,shippingMethodId:e.shippingMethodId,couponCode:e.couponCode}}function qn(e){return{...ra(e),payFirst:!!e.checkoutFlow}}function oa(e){return ra(e)}function Mn(e){let t=n=>typeof n=="string"?n:"";return{email:t(e.email),firstName:t(e.firstName),lastName:t(e.lastName),company:t(e.company),address1:t(e.address1),address2:t(e.address2),city:t(e.city),postcode:t(e.postcode),phone:t(e.phone),country:t(e.country),subdivision:t(e.subdivision),selectedAddressId:t(e.selectedAddressId),shippingMethodId:typeof e.shippingMethodId=="string"?e.shippingMethodId:null,couponCode:typeof e.couponCode=="string"?e.couponCode:null}}function _n(e){return{orderNumber:e.orderNumber,checkoutNumber:e.checkoutNumber,expiresAt:e.expiresAt,status:e.status,total:e.total,currency:e.currency,freightCharge:e.freightCharge,discountAmount:e.discountAmount,grandTotal:e.grandTotal,shippingMethod:e.shippingMethod,couponCode:e.couponCode}}function Kn(e){return e.lastPress!==null||e.unpaidOrder!==null||e.keptCardKey!==null}function as(e){let t=e.parkedAt+rs,n=e.unpaidOrder&&!e.unpaidOrder.orderNumber?e.unpaidOrder.expiresAt:null,r=n?Date.parse(n):NaN;return Number.isNaN(r)?t:Math.min(t,r)}function aa(e){try{let t=e.lastPress,n={...e,lines:at(e.lines),lastPress:t&&{...t,lines:at(t.lines),plainLines:at(t.plainLines)}};ce.setItem(Fn,JSON.stringify({v:na,...n}))}catch{}}var Nt=e=>!!e&&typeof e=="object"&&!Array.isArray(e),ea=e=>Nt(e)&&typeof e.idempotencyKey=="string"&&Array.isArray(e.items)&&e.items.every(t=>Nt(t)&&typeof t.partNumber=="string"&&typeof t.quantity=="number")&&Nt(e.customer)&&typeof e.payFirst=="boolean",Tn=e=>Nt(e)&&typeof e.id=="string"&&typeof e.qty=="number"&&Array.isArray(e.components);function ia(){let e;try{e=ce.getItem(Fn)}catch{return null}if(!e)return null;try{let t=JSON.parse(e);if(t.v!==na||typeof t.key!="string"||!t.key||!Array.isArray(t.lines)||!t.lines.every(Tn)||typeof t.parkedAt!="number")return null;let n=t.lastPress,r={key:t.key,authed:t.authed===!0,parkedAt:t.parkedAt,lastPress:Nt(n)&&typeof n.key=="string"&&ea(n.request)&&Array.isArray(n.lines)&&n.lines.every(Tn)&&Array.isArray(n.plainLines)&&n.plainLines.every(Tn)?{...n,lines:at(n.lines),plainLines:at(n.plainLines)}:null,keptCardKey:typeof t.keptCardKey=="string"?t.keptCardKey:null,placedGoods:typeof t.placedGoods=="string"?t.placedGoods:null,unpaidOrder:t.unpaidOrder&&typeof t.unpaidOrder=="object"?_n(t.unpaidOrder):null,placedRequest:ea(t.placedRequest)?t.placedRequest:null,lines:at(t.lines),form:t.form&&typeof t.form=="object"?Mn(t.form):null};return Date.now()>=as(r)?(Dn(),null):Kn(r)?r:null}catch{return null}}function Dn(){try{ce.removeItem(Fn)}catch{}}import{jsx as Se}from"react/jsx-runtime";function ca(e){let t=e.indexOf(`
|
|
3
|
+
`);return t===-1?[e,""]:[e.slice(0,t),e.slice(t+1)]}function la(e,{canParkContext:t}={canParkContext:!0}){let n=e.paymentMethods,r=[];return n.includes("card")&&r.push({key:"card",title:"Card",body:null,price:Se("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA \xB7 MC \xB7 AMEX"})}),n.includes("paypal")&&e.paypalClientId&&r.push({key:"paypal",title:"PayPal",body:null,price:Se("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAYPAL \xB7 CARDS"})}),n.includes("afterpay")&&r.push({key:"afterpay",title:"Afterpay",body:null,price:Se("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"4 \xD7 INTEREST-FREE"})}),n.includes("square")&&e.squareApplicationId&&e.squareLocationId&&r.push({key:"square",title:"Card (Square)",body:null,price:Se("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA \xB7 MC \xB7 AMEX"})}),n.includes("gocardless")&&t&&r.push({key:"gocardless",title:"Bank Direct Debit",body:null,price:Se("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY BY BANK"})}),n.includes("zip")&&r.push({key:"zip",title:"Zip",body:null,price:Se("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY IN 4"})}),n.includes("klarna")&&t&&r.push({key:"klarna",title:"Klarna",body:null,price:Se("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY LATER"})}),n.includes("bank")&&r.push({key:"bank",title:"Bank transfer",body:null,price:Se("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Invoiced"})}),r}var ma="This shop does not take payment online yet. Please contact the shop to order.",it=class extends Error{};function ua(e,t){if(!e.orderNumber&&Vt(t))return t.message;let n=t instanceof ue?` (${t.message})`:"";return e.orderNumber?`Your order ${e.orderNumber} is saved, but the payment did not start${n}. Try the payment again \u2014 your order will not be placed twice.`:`Your items are held under ${e.checkoutNumber}, but the payment did not start${n}. Try the payment again \u2014 you will not be charged twice.`}var cs=3e3,ls=.005,da=new Set(["paypal","square","afterpay","gocardless","zip","klarna"]);function pa(){let e=no();return{...e==="denied"?{}:zo(),...e?{adConsent:e}:{}}}var he=e=>JSON.parse(e),fa="Shipping cannot be calculated right now. Please try again.";function ga(e){return`Your order is saved, so its contact, address, delivery and discount can't change here. To change any of them, contact the shop and quote ${e}.`}function us({site:e,logo:t,preview:n=!1}){let{items:r,totals:a,coupon:c,refuseCoupon:d,deliveryOptions:g,shippingMethodId:f,setShippingMethodId:m,setQuoteDestination:h,courier:k,requote:v,identify:y,clearCapturedCart:E,replaceItems:C,removeCoupon:R,applyCoupon:D}=Yt(),O=g.find(o=>o.id===f)?.pickupLocation??null,{country:S,countries:B,activeCountry:X,formatMoney:de}=ye(),[j,ie]=w(()=>la(e)[0]?.key??null),[Re,De]=w(!0);Y(()=>{De(Kr(ce))},[]);let[Q,be]=w(!1),[ne,ee]=w(""),[z,b]=w(""),[Oe,je]=w(""),[U,ct]=w(""),[Z,ve]=w(""),[Ae,Le]=w(""),[L,re]=w(""),[pe,Ie]=w(""),[xe,lt]=w(""),[W,ut]=w(()=>S||B[0]?.code||""),[ke,Et]=w(""),[dt,Yn]=w([]),[an,sn]=w(null),[Rt,Ve]=w(null),Bn=sa(()=>B.find(o=>o.code===W)??X,[B,W,X]),Aa=Bn?.postalLabel||"Postal Code",La=dt[0]?.divisionType||"State / Province";Y(()=>{if(!W){Yn([]),sn(W);return}sn(null);let o=!1;return $.listCountrySubdivisions(W).then(s=>{o||(Yn(s),sn(W),Et(""))}),()=>{o=!0}},[W]);let zn=Z.trim()!==""&&L.trim()!==""&&pe.trim()!==""&&an===W&&(dt.length===0||ke!=="")?pe.trim():"";Y(()=>{h(W?{country:W,subdivision:ke,postcode:zn}:null)},[W,ke,zn,h]),Y(()=>()=>h(null),[h]);let Ia=k?.status==="unavailable",Ta=v,[pt,Hn]=w(null),[Fa,Gn]=w([]),[cn,Ot]=w("new"),[Jn,Vn]=w(!1),[ln,qa]=w("Home"),[Ma,Xn]=w(null),[_a,mt]=w(null),[Ue,At]=w(()=>kt()),Zn=q(null),[un,me]=w(null),[Ka,se]=w(null),[Qn,Lt]=w(null),[er,Da]=w(!1),[tr,ja]=w(!1),[Te,Xe]=w(null),[Ua,Ze]=w(!1),[G,le]=w(null),nr=!!G?.orderNumber,Wa=nr||Q,[$a,Ce]=w(null),[Ya,Ba]=w(!1),[za,rr]=w(!1),[Ha,Ga]=w(!1),[Ja,or]=w(!1),[ar,Va]=w(!1),[Xa,dn]=w(!1),[ft,ir]=w(null),Fe=q(null),We=q(null),pn=q(!1),$e=q(r),Pe=q(null),qe=q(null),sr=!!(un||ft&&ft.kind!=="processing"||ar||er||tr||Qn&&Te?.orderNumber);Y(()=>{sr&&(C([]),R())},[sr,C,R]);let cr=q(!1);Y(()=>{n||cr.current||!r.some(xt)||(cr.current=!0,$r({lines:r,currency:a.currency,value:a.subtotal-a.discount,coupon:c?.valid?c.code:void 0}))},[r,a,c,n]),Y(()=>{y(ne,z.trim()||void 0)},[ne,z,y]);let lr=q(null),[It,Za]=w(null);Y(()=>{let o=lr.current;if(!It||!o)return;let s=()=>o.style.setProperty("--sf-checkout-header-h",`${It.offsetHeight}px`);s();let u=new ResizeObserver(s);return u.observe(It),()=>u.disconnect()},[It]),Y(()=>{let o=u=>({setConfirming:u,land:me,markPaid:()=>Ze(!0),note:Ce,fail:se,clearCart:E,lostChange:()=>mt(ot)}),s={search:window.location.search,storage:ce,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};In(Xo,{...s,capture:$.captureAfterpayPayment,page:o(Ba)}),In(Zo,{...s,capture:$.captureZipPayment,page:o(Ga)})},[]),Y(()=>{let s=new URLSearchParams(window.location.search).get("gocardless");if(s!=="confirm"&&s!=="cancel")return;let u=ce.getItem(Zt);if(ce.removeItem(Zt),window.history.replaceState(null,"",window.location.pathname),!u)return;let P;try{P=JSON.parse(u)}catch{return}if(E(),en(P)&&mt(ot),s==="cancel"){Ce("The direct debit was not set up \u2014 our team will follow up on payment."),me(P.confirmation);return}rr(!0),$.completeGocardlessPayment({idempotencyKey:P.idempotencyKey}).then(p=>{p.status==="paid"?Ze(!0):p.status==="declined"?Ce("The direct debit was declined \u2014 our team will follow up on payment."):Ce("Your direct debit is set up \u2014 the payment is collecting and will clear in a few days.")}).catch(()=>{Ce("We could not confirm the direct debit \u2014 our team will follow up on payment.")}).finally(()=>{me(P.confirmation),rr(!1)})},[]),Y(()=>{let o=new URLSearchParams(window.location.search),s=o.get("klarna");if(s!=="confirm"&&s!=="cancel")return;let u=ce.getItem(Qt);ce.removeItem(Qt);let P=o.get("authorization_token");if(window.history.replaceState(null,"",window.location.pathname),!u)return;let p;try{p=JSON.parse(u)}catch{return}if(E(),en(p)&&mt(ot),s==="cancel"||!P){Ce("The Klarna payment was not completed \u2014 our team will follow up on payment."),me(p.confirmation);return}or(!0),$.captureKlarnaPayment({idempotencyKey:p.idempotencyKey,authorizationToken:P}).then(T=>{T.status==="paid"?Ze(!0):T.status==="declined"?Ce("Klarna declined the payment \u2014 our team will follow up on payment."):Ce("Your Klarna payment is being reviewed \u2014 we'll confirm the outcome shortly.")}).catch(()=>{Ce("We could not confirm the Klarna payment \u2014 our team will follow up on payment.")}).finally(()=>{me(p.confirmation),or(!1)})},[]);function ur(o){let[s,u]=ca(o.address);ve(s),Le(u),re(o.city),Ie(o.zip_code),o.country&&ut(o.country),o.phone&<(o.phone),Ve({country:o.country||null,state:o.state??""})}Y(()=>{if(Rt){if((Rt.country||W)!==W){Ve(null);return}an===W&&(Et(Qo(W,Rt.state,dt)),Ve(null))}},[Rt,W,an,dt]),Y(()=>{let o=!1;return(async()=>{try{let[s,u,P]=await Promise.all([nt.me(),nt.myProfile().catch(()=>null),nt.myAddresses().catch(()=>[])]);if(o)return;Hn(s);let p=P.filter(J=>J.is_active);Gn(p),ee(s.email);let T=(u?.contact_name??"").split(/\s+/);b(s.first_name||T[0]||""),je(s.last_name||T.slice(1).join(" "));let A=s.phone||u?.phone;A&<(A);let F=p.find(J=>J.id===s.default_delivery_location)??p[0];if(F)Ot(F.id),ur(F);else if(u){let[J,Ut]=ca(u.address??"");ve(J),Le(Ut),re(u.city??""),Ie(u.zip_code??""),u.country&&ut(u.country),Ve({country:u.country||null,state:u.state??""})}Dt.current&&br(Dt.current,!1)}catch{}})(),()=>{o=!0}},[]);function Qa(){nt.logout(),gt.current=!0,Dt.current=null,Kt.current=null,yt(),Hn(null),Gn([]),Ot("new"),Vn(!1),ee(""),b(""),je(""),ct(""),ve(""),Le(""),re(""),Ie(""),lt(""),ut(S||B[0]?.code||""),Et(""),Ve(null)}let Qe=sa(()=>la(e,{canParkContext:Re}),[e,Re]);Y(()=>{Qe.some(o=>o.key===j)||ie(Qe[0]?.key??null)},[Qe,j]);let ei=Qe.length===0,Tt=Ae.trim()?`${Z}
|
|
4
|
+
${Ae.trim()}`:Z,ti=Uo({email:ne,firstName:z,lastName:Oe,company:U.trim(),phone:xe,address:Tt,city:L,subdivision:ke,postcode:pe,country:W,lines:r.map(o=>[o.id,o.qty]),shippingMethodId:f,couponCode:xn(c),currency:a.currency,shopperId:pt?.id??null}),oe=JSON.stringify([ti,j]),fe=q(null),mn=q(null),Ft=q(!1),Me=q(!1),et=q(null),qt=q(!1),ge=q(oe);ge.current=oe;let dr=q(Q);dr.current=Q;let Mt=q(null);Y(()=>{let o=()=>{let s=Mt.current;s&&(Mt.current=null,le(s),be(!1))};return window.addEventListener("pageshow",o),()=>window.removeEventListener("pageshow",o)},[]);function _t(o,s,u,P){let p={idempotencyKey:s,confirmation:u};wr()&&(p.lostChange=!0),ce.setItem(o,JSON.stringify(p)),window.location.assign(P),Mt.current=u}async function pr(o){be(!0);try{await o()}finally{Mt.current||be(!1)}}let mr=q(!1),fr=!!(un||ft&&ft.kind!=="processing");Y(()=>{fr&&(mr.current=!0,yt())},[fr]);let Kt=q(null),gt=q(!1),fn=q(null);function yt(){fn.current=null,Dn()}let Dt=q(null),[tt,ni]=w(!1);function gn(o){if(mr.current||n||gt.current)return;let s=Pe.current,u={key:o,authed:pn.current,parkedAt:fn.current??=Date.now(),lastPress:s&&{key:s.key,request:qn(s.request),lines:s.lines,goods:he(s.shape)[0],plainPressed:!!s.plainMethod,plainLines:s.plainLines,plainGoods:he(s.plainShape)[0]},keptCardKey:qe.current,placedGoods:fe.current===null?null:he(fe.current)[0],unpaidOrder:jt.current&&_n(jt.current),placedRequest:We.current&&qn(We.current),lines:r.length>0?r:$e.current,form:Mn({email:ne,firstName:z,lastName:Oe,company:U,address1:Z,address2:Ae,city:L,postcode:pe,phone:xe,country:W,subdivision:ke,selectedAddressId:cn,shippingMethodId:f,couponCode:c?.valid?c.code:null})};Kn(u)?aa(u):yt()}let jt=q(G);jt.current=G;let gr=q(j);gr.current=j;function yn(o){return{...oa(o),...pa(),...o.payFirst?{checkoutFlow:wt}:{}}}function ri(o,s){let u=o.request.payFirst?"":null,P=o.plainPressed?null:"",p=()=>gr.current??"";return{key:o.key,send:()=>s(yn(o.request)),request:yn(o.request),lines:o.lines,shape:JSON.stringify([o.goods,null]),get method(){return u??p()},set method(T){u=T},get plainMethod(){return P??p()},set plainMethod(T){P=T},plainLines:o.plainLines,plainShape:JSON.stringify([o.plainGoods,null])}}let[oi,ai]=w(!1),yr=oi?!a.quoted||a.serverSubtotal===null?"waiting":Math.abs(a.serverSubtotal-a.subtotal)<ls?"same":"changed":null,hn=!G&&yr==="waiting",ii=hn?{...a,repricing:!0}:a,hr=hn&&a.quoteFailed;Y(()=>{if(!hr)return;let o=setInterval(v,cs);return()=>clearInterval(o)},[hr,v]);function br(o,s=!0){ee(o.email),b(o.firstName),je(o.lastName),ct(o.company),ve(o.address1),Le(o.address2),re(o.city),Ie(o.postcode),lt(o.phone),o.country&&ut(o.country),Ve({country:o.country||null,state:o.subdivision}),Ot(o.selectedAddressId),o.shippingMethodId&&m(o.shippingMethodId),s&&(Kt.current=o.couponCode)}Y(()=>{let o=n?null:ia();if(o&&r.length>0&&(yt(),o=null),o){let s=o.authed?$.createOrderAuthed:$.createOrder;At(o.key),fn.current=o.parkedAt,Pe.current=o.lastPress&&ri(o.lastPress,s),qe.current=o.keptCardKey,fe.current=o.placedGoods===null?null:JSON.stringify([o.placedGoods,null]),pn.current=o.authed;let u=o.placedRequest&&yn(o.placedRequest);We.current=u,Fe.current=u?()=>s(u):null,o.unpaidOrder&&le(o.unpaidOrder),o.lines.length>0&&(C(o.lines),$e.current=o.lines,ai(!0)),o.form&&(Dt.current=o.form,br(o.form))}ni(!0)},[]),Y(()=>{!tt||r.length>0||jt.current||Q||(gt.current=!0,yt())},[tt,r.length]),Y(()=>{let o=Kt.current;!tt||!o||r.length===0||(Kt.current=null,D(o,ne||void 0))},[tt,r.length]),Y(()=>{!tt||Q||gn(Ue)},[tt,Q,Ue,G]);let Ye=q(null);Y(()=>{dr.current||(oe!==Ye.current&&(Ye.current=null),!(!Me.current||!G||G.orderNumber)&&(oe===fe.current||oe===Ye.current||pr(()=>vr(G))))},[oe,G]);async function vr(o){if(qt.current)return null;qt.current=!0;try{let s=et.current?await Ko(et.current):"none";if(s==="succeeded"||s==="processing")return Me.current=!1,le(null),we("card"),s==="succeeded"?await Be(void 0,o):Or(o),null;if(s===void 0||!Do.has(s))return Ye.current=ge.current,le(o),se(s==="requires_action"?Mo:_e),null;let u=await En(Ue);if(u==="committed")return Me.current=!1,le(null),we("card"),await Be(void 0,o),null;if(u!=="released")return Ye.current=ge.current,le(o),se(_e),null;Me.current=!1,et.current=null,Ye.current=null,se(null),le(null);let P=kt();return At(P),P}finally{qt.current=!1}}async function si(){n||Q||qt.current||await pr(ci)}async function ci(){if(G){if((Me.current?oe!==fe.current:ht())&&!G.orderNumber){let P=await vr(G);P&&ge.current===oe&&await xr(P);return}se(null),Ft.current=!1,await bn();let s=he(ge.current)[1],u=G.orderNumber?s:"card";if(u&&da.has(u)&&ht()&&he(ge.current)[0]!==mn.current){kr(G);return}we(u),u!==j&&ie(u),await Ar(G,u,!G.orderNumber);return}await xr(Ue)}async function xr(o){if(r.length===0||a.repricing||hn||!j||!Qe.some(A=>A.key===j))return;let s=r.filter(xt).flatMap(A=>Wt(A.components,A.qty));if(s.length===0){se("Pick a size on each wheel's product page before checking out.");return}se(null);let u,P=o,p=j,T=!1;try{let A=pt?$.createOrderAuthed:$.createOrder,F={customer:{email:ne,name:`${z} ${Oe}`.trim(),phone:xe.trim()||void 0,companyName:U.trim()||void 0,address:Tt,city:L,state:ke||void 0,zipCode:pe,country:W},items:s,currency:a.currency,idempotencyKey:o,shippingMethodId:f??void 0,couponCode:xn(c),...pa(),...Fo(j)?{checkoutFlow:wt}:{}};Fe.current=()=>A(F),We.current=F,pn.current=!!pt,gt.current=!1,mt(null),mn.current=null,Ft.current=!1,et.current=null,Me.current=!1,Ye.current=null,fe.current=oe,$e.current=r;let J=Pe.current,Ut=J?.key===F.idempotencyKey&&(J.shape!==oe&&(!!F.checkoutFlow||!!J.method||!!J.plainMethod)||!!F.checkoutFlow&&!!J.plainMethod);Ut&&(qe.current=F.idempotencyKey);let Tr=Sr(F,A),Fr=Ut||!F.checkoutFlow&&qe.current===F.idempotencyKey,qr=!Tr&&!Fr&&!F.checkoutFlow&&!!J&&!J.method;qr&&(J.plainMethod=j,J.plainLines=r,J.plainShape=oe,gn(F.idempotencyKey));let ze=await(Fr?Pr(F,A):A(F).then(bt=>({answer:bt,request:F})).catch(bt=>(Tr?Cr(bt,F.idempotencyKey):qr&&On(bt)&&(J.plainMethod=""),li(bt,F,A))));if(!ze)return;u=ze.answer,P=ze.request.idempotencyKey,p=ze.method??p,we(p),T=ht()||p!==he(ge.current)[1],ze.method&&ze.method!==j&&ie(ze.method),u.orderNumber&&(Er(u),E()),await bn()}catch(A){let F=jr(A);F?(d(F),se(`${F} Your order has not been placed. Place it again to continue without the code.`)):A instanceof it?se(_e):se(A instanceof ue?A.message:"Could not place the order. Please try again.");return}if(p&&da.has(p)&&(T||ht())){kr(u);return}await Ar(u,p,!1,P)}function kr(o){mn.current=he(ge.current)[0],se(`${ua(o,null)} ${ot}`),le(o)}function Cr(o,s){On(o)&&!Rn(o)&&Pe.current?.key===s&&(Pe.current=null)}async function li(o,s,u){if(Vt(o))return Nr(s,u);if(!Rn(o))throw o;return qe.current=s.idempotencyKey,Pr(s,u,!0)}async function Pr(o,s,u=!1){let P=await En(o.idempotencyKey);if(P==="released")return Nr(o,s);if(P!=="committed")throw new it;let p=Pe.current?.key===o.idempotencyKey?Pe.current:null;if($e.current=p?.lines??r,p?.method&&!u){qe.current=null,Fe.current=p.send,We.current=p.request;let F=await p.send().catch(()=>{throw new it});return fe.current=p.shape,{answer:F,request:o,method:p.method}}let T=p&&!p.method?p.send:()=>s({...o,checkoutFlow:wt});Fe.current=T,We.current=p&&!p.method?p.request:{...o,checkoutFlow:wt};let A=await T().catch(()=>null);if(!A&&p?.plainMethod)throw new it;return A?.orderNumber&&A.status!==qo?(qe.current=null,p?.plainMethod&&($e.current=p.plainLines),p&&(fe.current=p.plainMethod?p.plainShape:p.shape),{answer:A,request:o,method:p?.plainMethod||void 0}):(p&&(fe.current=p.shape),we("card"),await Rr("",A?async()=>A:()=>Promise.reject(new Error("The order request did not answer."))),await bn(),null)}function ht(){let o=fe.current;return o!==null&&he(o)[0]!==he(ge.current)[0]}function we(o){o!==he(ge.current)[1]&&(Ft.current=!0),mt(wr()?ot:null)}function wr(){return Ft.current||ht()}async function Nr(o,s){let u={...o,idempotencyKey:kt()};qe.current=null,At(u.idempotencyKey),Fe.current=()=>s(u),We.current=u,Sr(u,s);try{return{answer:await s(u),request:u}}catch(P){throw Cr(P,u.idempotencyKey),P}}function Sr(o,s){return Pe.current?.key===o.idempotencyKey?!1:(Pe.current={key:o.idempotencyKey,send:()=>s(o),request:o,lines:r,shape:oe,method:o.checkoutFlow?"":j??"",plainMethod:"",plainLines:r,plainShape:oe},gt.current=!1,gn(o.idempotencyKey),!0)}function Er(o){Yr({confirmation:o,lines:$e.current,adsSendTo:e.googleAdsId&&e.googleAdsConversionLabel?`${e.googleAdsId}/${e.googleAdsConversionLabel}`:null}),Vo({confirmation:o,lines:$e.current})}async function Be(o,s=Te){if(!s)return;let u=o?async()=>o:Fe.current;if(s.orderNumber||!u){Ze(!0),me(s);return}await Rr(s.checkoutNumber,u)}async function Rr(o,s){E(),await Wo({checkoutNumber:o,resend:s,page:{setConfirming:Va,land:me,markPaid:()=>Ze(!0),track:Er,unplaced:ir}})}function Or(o=Te){if(o){if(o.orderNumber){me(o);return}E(),ir({kind:"processing",checkoutNumber:o.checkoutNumber})}}async function bn(){let o=JSON.stringify([ln.trim(),z,Oe,xe.trim(),Tt,L,ke,pe,W]);if(!(!pt||!Jn||cn!=="new"||Zn.current===o))try{await nt.createAddress({label:ln.trim()||"Home",contact_name:`${z} ${Oe}`.trim(),phone:xe.trim(),address:Tt,city:L,zip_code:pe,state:ke,country:W}),Zn.current=o,Xn("Address saved to your account.")}catch{Xn("We couldn't save the address to your account \u2014 you can add it under Account \u2192 Addresses.")}}async function Ar(o,s=j,u=!1,P=Ue){le(null);try{if(s==="card"&&e.paymentMethods.includes("card")){let p=await $.createPaymentIntent({idempotencyKey:P});et.current=p;let T=o;if(u){let A=await Fe.current?.().catch(()=>null);if(A?.orderNumber){we("card"),await Be(A,o);return}T=Lr(o,A)??{...o,expiresAt:null}}we("card"),Xe(T),dn(!1),Lt(p)}else if(s==="paypal"&&e.paymentMethods.includes("paypal"))Xe(o),Da(!0);else if(s==="afterpay"&&e.paymentMethods.includes("afterpay")){let p=window.location.origin,T=await $.createAfterpayCheckout({idempotencyKey:P,confirmUrl:`${p}/checkout?afterpay=confirm`,cancelUrl:`${p}/checkout?afterpay=cancel`});_t(An,P,o,T.redirectCheckoutUrl);return}else if(s==="square"&&e.paymentMethods.includes("square"))Xe(o),ja(!0);else if(s==="gocardless"&&e.paymentMethods.includes("gocardless")){let p=window.location.origin,T=await $.createGocardlessBillingRequest({idempotencyKey:P,confirmUrl:`${p}/checkout?gocardless=confirm`,cancelUrl:`${p}/checkout?gocardless=cancel`});_t(Zt,P,o,T.authorisationUrl);return}else if(s==="zip"&&e.paymentMethods.includes("zip")){let p=window.location.origin,T=await $.createZipCheckout({idempotencyKey:P,redirectUrl:`${p}/checkout?zip=return`});_t(Ln,P,o,T.redirectUrl);return}else if(s==="klarna"&&e.paymentMethods.includes("klarna")){let p=window.location.origin,T=await $.createKlarnaCheckout({idempotencyKey:P,confirmUrl:`${p}/checkout?klarna=confirm`,cancelUrl:`${p}/checkout?klarna=cancel`});_t(Qt,P,o,T.redirectUrl);return}else we(s),me(o)}catch(p){if((u||s==="card")&&p instanceof ue&&p.status===409){we(s),await Be(void 0,o);return}Ir(o,p)}}function Lr(o,s){return s&&!s.orderNumber&&s.status==="open"&&s.checkoutNumber===o.checkoutNumber?s:null}function Ir(o,s){se(ua(o,s)),!o.orderNumber&&Vt(s)?(Me.current=!1,At(kt())):le(o)}async function ui(o){if(!Te)return;let s=Te;try{let u=await $.createPaymentIntent({idempotencyKey:Ue}),P=await Fe.current?.().catch(()=>null);if(P?.orderNumber){await Be(P);return}let p=Lr(s,P);Xe(p??{...s,expiresAt:null}),dn(o&&p!==null),et.current=u,Lt(u)}catch(u){if(u instanceof ue&&u.status===409){await Be();return}Lt(null),Xe(null),Ir(s,u)}}function di(){Te&&(Me.current=!0,le(Te),Lt(null),Xe(null),dn(!1))}return{site:e,logo:t,items:r,totals:ii,coupon:c,deliveryOptions:g,courierUnavailable:Ia,retryCourier:Ta,shippingMethodId:f,setShippingMethodId:m,pickupLocation:O,servedCountries:B,formatMoney:de,payChoice:j,setPayChoice:ie,placing:Q,email:ne,setEmail:ee,firstName:z,setFirstName:b,lastName:Oe,setLastName:je,company:U,setCompany:ct,address1:Z,setAddress1:ve,address2:Ae,setAddress2:Le,city:L,setCity:re,postcode:pe,setPostcode:Ie,phone:xe,setPhone:lt,country:W,setCountry:ut,subdivision:ke,setSubdivision:Et,subdivisions:dt,destination:Bn,postcodeLabel:Aa,subdivisionLabel:La,me:pt,savedAddresses:Fa,selectedAddressId:cn,setSelectedAddressId:Ot,saveAddress:Jn,setSaveAddress:Vn,saveLabel:ln,setSaveLabel:qa,addressSaveNote:Ma,lostChangeNote:_a,idemKey:Ue,confirmation:un,setConfirmation:me,orderError:Ka,payment:Qn,paypalStep:er,squareStep:tr,pendingConf:Te,paid:Ua,setPaid:Ze,unpaidOrder:G,orderLocked:nr,formLocked:Wa,restoredPrices:yr,payNote:$a,afterpayConfirming:Ya,gocardlessConfirming:za,zipConfirming:Ha,klarnaConfirming:Ja,cardConfirming:ar,checkoutResult:ft,confirmCardPayment:Be,cardStillProcessing:Or,renewCardPayment:ui,holdRenewed:Xa,leaveCardPayment:di,checkoutRootRef:lr,setCheckoutHeaderEl:Za,fillFromAddress:ur,checkoutSignOut:Qa,payOptions:Qe,noPaymentMethod:ei,placeOrder:si}}var ya=is(null);function ha({children:e,...t}){let n=us(t);return Se(ya.Provider,{value:n,children:e})}function Ee(){let e=ss(ya);if(!e)throw new Error("useCheckout must be used inside CheckoutStateProvider");return e}import{useId as jn}from"react";import{Fragment as Ke,jsx as i,jsxs as N}from"react/jsx-runtime";function va(){let{email:e,setEmail:t,firstName:n,setFirstName:r,lastName:a,setLastName:c,company:d,setCompany:g,me:f,checkoutSignOut:m,orderLocked:h,unpaidOrder:k}=Ee(),v=jn();return N(rn,{num:"N\xB0 01",title:"Contact",children:[h&&k&&i(ps,{orderNumber:k.orderNumber}),i(ae,{label:"Email",htmlFor:v,hint:f?N(Ke,{children:["Signed in \xB7"," ",i("button",{type:"button",onClick:m,className:"underline transition-colors enabled:hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:i("input",{id:v,type:"email",value:e,onChange:y=>t(y.target.value),placeholder:"you@example.com",readOnly:f!==null,className:te})}),N(wa,{children:[i(ae,{label:"First name",children:i("input",{type:"text",value:n,onChange:y=>r(y.target.value),className:te})}),i(ae,{label:"Last name",children:i("input",{type:"text",value:a,onChange:y=>c(y.target.value),className:te})})]}),i(ae,{label:"Company (optional)",children:i("input",{type:"text",value:d,onChange:y=>g(y.target.value),autoComplete:"organization",className:te})})]})}function xa(){let{pickupLocation:e,servedCountries:t,address1:n,setAddress1:r,address2:a,setAddress2:c,city:d,setCity:g,postcode:f,setPostcode:m,phone:h,setPhone:k,country:v,setCountry:y,subdivision:E,setSubdivision:C,subdivisions:R,destination:D,postcodeLabel:O,subdivisionLabel:S,me:B,savedAddresses:X,selectedAddressId:de,setSelectedAddressId:j,saveAddress:ie,setSaveAddress:Re,saveLabel:De,setSaveLabel:Q,fillFromAddress:be,orderLocked:ne}=Ee(),ee=jn(),z=jn();return N(rn,{num:"N\xB0 02",title:e?"Collection":"Shipping address",children:[e?N("div",{className:"grid gap-2 text-[14px] leading-[1.6]",children:[i("span",{className:"font-medium",children:e.name}),[e.address,e.city,e.state,e.zipCode,e.country].filter(Boolean).length>0&&i("span",{className:"opacity-80",children:[e.address,e.city,e.state,e.zipCode,e.country].filter(Boolean).join(", ")}),e.openingHours&&i("span",{className:"opacity-80",children:e.openingHours}),e.instructions&&i("span",{className:"opacity-80",children:e.instructions}),i("span",{className:"mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"No delivery address needed"})]}):N(Ke,{children:[B!==null&&X.length>0&&N("div",{className:"grid gap-3",children:[X.map(b=>i(tn,{active:de===b.id,onClick:()=>{j(b.id),be(b)},title:b.label,body:b.formatted_address,price:null},b.id)),i(tn,{active:de==="new",onClick:()=>j("new"),title:"New address",body:null,price:null})]}),i(ae,{label:"Address line 1",children:i("input",{type:"text",value:n,onChange:b=>r(b.target.value),className:te})}),i(ae,{label:"Address line 2",children:i("input",{type:"text",value:a,onChange:b=>c(b.target.value),placeholder:"Apartment, unit, garage bay\u2026",className:te})}),N(wa,{cols:"three",children:[i(ae,{label:"City",children:i("input",{type:"text",value:d,onChange:b=>g(b.target.value),className:te})}),i(ae,{label:O,children:i("input",{type:"text",value:f,onChange:b=>m(b.target.value),className:te})}),i(ae,{label:"Country",separate:!0,htmlFor:ee,children:i(Cn,{id:ee,value:v,onChange:b=>y(b.target.value),className:te+" pr-10",style:ba,children:t.map(b=>i("option",{value:b.code,children:b.name},b.code))})})]}),i(ae,{label:S,separate:!0,htmlFor:z,children:R.length>0?N(Cn,{id:z,value:E,onChange:b=>C(b.target.value),className:te+" pr-10",style:ba,children:[i("option",{value:"",children:"Select\u2026"}),R.map(b=>i("option",{value:b.code||b.name,children:b.name},b.code||b.name))]}):i("input",{id:z,type:"text",value:E,onChange:b=>C(b.target.value),className:te})})]}),i(ae,{label:"Phone",children:i("input",{type:"tel",value:h,onChange:b=>k(b.target.value),className:te})}),!e&&B!==null&&de==="new"&&!ne&&N(Ke,{children:[i(ms,{checked:ie,onChange:Re,label:"Save this address to my account"}),ie&&i(ae,{label:"Address label",children:i("input",{type:"text",value:De,onChange:b=>Q(b.target.value),placeholder:"Home",className:te})})]})]})}function ka(){let{totals:e,coupon:t,deliveryOptions:n,shippingMethodId:r,setShippingMethodId:a,pickupLocation:c,formatMoney:d,city:g,destination:f,courierUnavailable:m,retryCourier:h}=Ee();return i(rn,{num:"N\xB0 03",title:"Shipping",children:N("div",{className:"grid gap-3",children:[n.map(k=>{let v=k.pickupLocation,y=v?[v.address,v.city,v.state,v.zipCode].filter(Boolean).join(", "):null;return i(tn,{active:r===k.id,onClick:()=>a(k.id),title:v?`${k.name} \u2014 ${v.name}`:k.name,body:v?[y,v.openingHours,v.instructions,k.description].filter(Boolean).join(" \xB7 "):k.description||null,price:e.freeShipping||k.amount===0?$t:d(k.amount,e.currency),tag:k.tag||void 0},k.id)}),m?N("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:[fa," ",i("button",{type:"button",onClick:h,className:"underline transition-colors enabled:hover:text-accent",children:"Try again"})]}):n.length===0&&i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Shipping is arranged after your order is reviewed."})]})})}function Ca(){let{payChoice:e,setPayChoice:t,payment:n,payOptions:r,noPaymentMethod:a}=Ee();return N(rn,{num:"N\xB0 04",title:"Payment",children:[a&&i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:ma}),i("div",{className:"grid gap-3",children:r.map(c=>i(tn,{active:e===c.key,onClick:()=>t(c.key),title:c.title,body:c.body,price:c.price,tag:c.tag},c.key))}),e==="card"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll enter card details on the secure payment step after placing the order."}):e==="paypal"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll approve the payment with PayPal on the payment step after placing the order."}):e==="afterpay"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll be taken to Afterpay to approve four interest-free payments, then brought straight back."}):e==="square"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll enter card details on the secure payment step after placing the order."}):e==="gocardless"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll set up a bank direct debit with GoCardless, then be brought straight back. Direct debits clear in a few days."}):e==="zip"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll be taken to Zip to approve four instalments, then brought straight back."}):e==="klarna"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You\u2019ll be taken to Klarna to choose how to pay, then brought straight back."}):e==="bank"?i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Our team emails you the invoice and bank details after review."}):null]})}function Pa(){let{site:e,items:t,totals:n,coupon:r,formatMoney:a,payChoice:c,placing:d,email:g,orderError:f,payment:m,noPaymentMethod:h,unpaidOrder:k,formLocked:v,restoredPrices:y,placeOrder:E}=Ee(),C=y==="waiting",R=y==="changed";return N("aside",{className:"sticky top-[var(--sf-checkout-header-h,88px)] border border-line max-view-desktop:static",style:{background:"linear-gradient(180deg, color-mix(in oklab, var(--site-surface) 70%, var(--bg)) 0%, var(--bg) 100%)"},children:[N("header",{className:"flex items-center justify-between border-b border-accent bg-accent px-6 py-4 font-mono text-[13px] font-bold uppercase tracking-[0.28em] text-bg",children:[i("span",{children:"Your order"}),i(St,{href:"/wheels",className:"text-bg/80 transition-colors hover:text-bg",children:"Edit \u2197"})]}),i("div",{className:"flex flex-col px-6 py-2",children:t.length===0?N("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",i(St,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog \u2192"})]}):t.map(D=>i(fs,{slug:D.slug,name:D.name,qty:D.qty,config:D.config,configSummary:gs(D.config),price:R||C?null:Gr(D,n.currency)??0,currency:n.currency},D.id))}),i(nn,{locked:v,className:"border-t border-line px-6 pt-5",children:i(Qr,{customerEmail:g,disabled:v})}),N("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[i(Ge,{label:"Subtotal",value:C?Wr:a(R?n.serverSubtotal??0:n.subtotal,n.currency)}),n.discount>0&&r?.valid&&i(Ge,{label:`Coupon \xB7 ${r.code}`,value:N("span",{className:"font-semibold text-green",children:["\u2212 ",a(n.discount,n.currency)]})}),r?.deferred&&i(Ge,{label:`Coupon \xB7 ${r.code}`,value:Dr}),r?.valid&&r.effects?.gift&&i(Ge,{label:`Free gift \xB7 ${r.effects.gift.partNumber}${r.effects.gift.quantity>1?` \xD7${r.effects.gift.quantity}`:""}`,value:i("span",{className:"font-semibold text-green",children:$t})}),i(Ge,{label:"Shipping",value:n.shippingStatus==="free"?i("span",{className:"font-semibold text-green",children:$t}):zr(n.shippingStatus)??a(n.shipping,n.currency)}),n.tax&&(n.tax.charged?i(Ge,{label:n.tax.inclusive?`${n.tax.name} included \xB7 ${n.tax.rate}%`:n.tax.name,value:a(n.tax.amount,n.currency)}):n.tax.name?i(Ge,{label:n.tax.name,value:Br}):null)]}),N("div",{className:"mt-4 flex items-end justify-between border-y-2 border-accent px-6 py-4",style:{background:"color-mix(in oklab, var(--accent) 10%, var(--bg))"},children:[i("span",{className:"font-display text-[20px] font-bold uppercase tracking-[0.04em] text-fg",children:"Total"}),i("span",{className:"text-right font-display text-[34px] font-bold leading-none tracking-[-0.025em] text-fg",children:n.repricing?Ur:a(n.grand,n.currency)})]}),N("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[R&&i(Ne,{tone:"quiet",children:ta}),f&&i(Ne,{role:"alert",children:f}),n.hasUnpricedLine&&N(Ne,{role:"status",children:["One or more items have no price in ",n.currency,". Remove them, or switch region, to continue."]}),i("button",{type:"button",onClick:E,disabled:d||!k&&(h||t.length===0||n.hasUnpricedLine||n.repricing),className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",d||!k&&(t.length===0||h||n.hasUnpricedLine||n.repricing)?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:d?N(Ke,{children:["Building order\u2026 ",i("span",{children:"\xB7"})]}):h?N(Ke,{children:["No online payment ",i("span",{children:"\xB7"})]}):k?N(Ke,{children:["Try payment again \xB7 ",Xt(k),i("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]}):n.repricing?N(Ke,{children:["Updating total\u2026 ",i("span",{children:"\xB7"})]}):N(Ke,{children:[c==="bank"?"Place order":"Continue to payment"," \xB7"," ",a(n.grand,n.currency),i("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})})]})]})}var ds=" [&:disabled_:disabled]:cursor-not-allowed! [&:disabled_:disabled]:opacity-70! [&_input[readonly]]:cursor-not-allowed [&_input[readonly]]:opacity-70";function nn({locked:e,className:t="",children:n}){return i("fieldset",{disabled:e,className:"m-0 min-w-0 border-0 p-0 "+t+ds,children:n})}function St({href:e,className:t="",children:n,...r}){let{placing:a}=Ee();return a?i("span",{"aria-disabled":"true","aria-label":r["aria-label"],className:t+" pointer-events-none",children:n}):i(He,{href:e,"aria-label":r["aria-label"],className:t,children:n})}function ps({orderNumber:e}){return i(Ne,{tone:"quiet",role:"status",children:N("span",{className:"flex items-start gap-2",children:[N("svg",{"aria-hidden":!0,viewBox:"0 0 16 16",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"mt-[3px] shrink-0",children:[i("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),i("path",{d:"M5 7V5a3 3 0 0 1 6 0v2"})]}),i("span",{children:ga(e)})]})})}var ba={backgroundImage:"linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%)",backgroundPosition:"calc(100% - 18px) 50%, calc(100% - 12px) 50%",backgroundSize:"6px 6px",backgroundRepeat:"no-repeat"};function rn({num:e,title:t,children:n}){return N("section",{className:"mb-6 border border-line bg-bg",children:[N("header",{className:"flex items-center gap-4 border-b border-line bg-surface px-6 py-4",children:[i("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:e}),i("h2",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:t})]}),i("div",{className:"flex flex-col gap-4 px-6 py-6",children:n})]})}function wa({cols:e="two",children:t}){return i("div",{className:["grid gap-3 max-[640px]:grid-cols-1",e==="two"?"grid-cols-2":"grid-cols-[1.2fr_1fr_1fr]"].join(" "),children:t})}function tn({active:e,onClick:t,title:n,body:r,price:a,tag:c}){return N("button",{type:"button",onClick:t,"aria-pressed":e,className:["relative grid grid-cols-[auto_1fr_auto] items-center gap-5 border bg-bg px-6 py-5 text-left transition-colors",e?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-line enabled:hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]"].join(" "),style:e?{background:"color-mix(in oklab, var(--accent) 14%, var(--bg))"}:void 0,children:[e&&i("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),i("span",{className:["flex h-[18px] w-[18px] items-center justify-center rounded-full border-2",e?"border-accent":"border-fg-dim"].join(" "),children:e&&i("span",{className:"block h-2.5 w-2.5 rounded-full bg-accent"})}),N("span",{className:"flex min-w-0 flex-col gap-1",children:[N("span",{className:"flex flex-wrap items-baseline gap-3 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[n,c&&i("span",{className:"border px-2 py-0.5 font-mono text-[11px] font-normal uppercase tracking-[0.24em] text-accent",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))"},children:c})]}),r&&i("span",{className:"font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim",children:r})]}),i("span",{className:"whitespace-nowrap font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:a})]})}function ms({checked:e,onChange:t,label:n,sub:r}){return N("div",{className:"flex items-start gap-3 border-t border-line py-4 first:border-t-0 first:pt-0",children:[i("button",{type:"button",onClick:()=>t(!e),"aria-pressed":e,"aria-label":n,className:["mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center border transition-colors",e?"border-accent":"border-line"].join(" "),style:e?{background:"color-mix(in oklab, var(--accent) 18%, transparent)"}:void 0,children:e&&i("span",{className:"text-[13px] text-accent",children:"\u2713"})}),N("span",{className:"flex-1 font-display text-[16px] leading-[1.5] text-fg",children:[n,r&&i("small",{className:"mt-1 block font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim",children:r})]})]})}function fs({slug:e,name:t,qty:n,config:r,configSummary:a,price:c,currency:d}){let{catalog:g}=Yt(),{formatMoney:f}=ye(),m=g.find(C=>C.slug===e),h=m?.spokes??5,k=m?.mesh??!1,v=r.find(C=>C.gold)?.label,y=m?.finishes.find(C=>C.name===v&&C.src)??m?.finishes.find(C=>C.src),E=m?.finishes[0]?.color??Zr;return N("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-4 border-b border-line py-4 last:border-b-0",children:[N("div",{className:"relative aspect-square",children:[i("div",{className:"flex h-full w-full items-center justify-center overflow-hidden border border-line bg-surface",children:y?.src?i(Mr,{src:y.src,alt:`${t.lead}${t.accent} \u2014 ${y.name}`,width:120,height:120,sizes:"60px",className:"block h-full w-full object-contain p-2"}):i("div",{className:"block w-[78%]",style:{color:E},children:i(Xr,{spokes:h,mesh:k,className:"block w-full"})})}),i("span",{className:"absolute -right-1.5 -top-1.5 z-[2] flex h-[18px] w-[18px] items-center justify-center rounded-full bg-accent font-mono text-[11px] font-bold text-bg",children:n})]}),N("div",{className:"flex min-w-0 flex-col gap-0.5",children:[N("span",{className:"font-display text-[17px] font-bold uppercase leading-none tracking-[-0.005em] text-fg",children:[t.lead,i("em",{className:"font-serif font-normal italic text-accent tracking-[-0.005em] normal-case",children:t.accent})]}),i("span",{className:"font-mono text-[12px] uppercase leading-[1.5] tracking-[0.18em] text-fg-dim",children:a})]}),i("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:c===null?null:f(c,d)})]})}function Ge({label:e,value:t}){return N("div",{className:"flex items-center justify-between font-mono text-[13px] font-medium uppercase tracking-[0.18em] text-fg",children:[i("span",{children:e}),i("strong",{className:"font-display text-[16px] font-medium tracking-[-0.005em] normal-case text-fg",children:t})]})}function gs(e){return e.map(t=>t.label).join(" \xB7 ")}import{Fragment as H,jsx as l,jsxs as x}from"react/jsx-runtime";function $n(e){return l(ha,{...e,children:l(bs,{})})}function ys({order:e,paid:t}){let{formatMoney:n}=ye();if(!e.grandTotal||!e.currency)return null;let r=d=>n(Number(d),e.currency),a=Number(e.freightCharge??0),c=Number(e.discountAmount??0);return x("dl",{className:"grid w-full max-w-sm grid-cols-[1fr_auto] gap-x-6 gap-y-1 border-y border-line py-3 text-left text-sm",children:[(e.shippingMethod||a>0)&&x(H,{children:[x("dt",{className:"text-fg-dim",children:["Delivery",e.shippingMethod?` \xB7 ${e.shippingMethod}`:""]}),l("dd",{className:"text-right font-mono",children:r(e.freightCharge??"0")})]}),c>0&&x(H,{children:[x("dt",{className:"text-fg-dim",children:["Discount",e.couponCode?` \xB7 ${e.couponCode}`:""]}),x("dd",{className:"text-right font-mono",children:["\u2212",r(e.discountAmount??"0")]})]}),l("dt",{className:"text-fg",children:t?"Total paid":"Order total"}),l("dd",{className:"text-right font-mono text-fg",children:r(e.grandTotal)})]})}function hs({result:e,lostChangeNote:t=null}){let n=l("span",{className:"font-mono text-fg",children:e.checkoutNumber});return x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:e.kind==="refunded"||e.kind==="expired"?"Order not placed":e.kind==="processing"?"Payment processing":"Payment received"}),l("p",{className:"text-fg-dim",children:e.kind==="refunded"?x(H,{children:["An item sold out or an offer ended while you paid for checkout ",n,". Your payment goes back to your card."]}):e.kind==="expired"?x(H,{children:["The hold on checkout ",n," ran out before your payment arrived. Your payment goes back to your card."]}):e.kind==="processing"?x(H,{children:["Your payment for checkout ",n," is being processed. When it goes through, we will email your order confirmation."]}):x(H,{children:["Thank you \u2014 your payment",e.checkoutNumber?x(H,{children:[" for checkout ",n]}):null," has gone through. We will email you the order number shortly."]})}),t&&e.kind!=="refunded"&&e.kind!=="expired"&&l("p",{className:"text-sm text-fg-dim",children:t}),l(He,{href:"/wheels",className:"mt-2 border-2 border-line px-6 py-3 font-mono text-[12px] uppercase tracking-[0.24em] hover:border-accent",children:"Continue browsing"})]})}function bs(){let{site:e,logo:t,items:n,placing:r,formLocked:a,email:c,me:d,addressSaveNote:g,lostChangeNote:f,idemKey:m,confirmation:h,setConfirmation:k,payment:v,paypalStep:y,squareStep:E,pendingConf:C,paid:R,setPaid:D,payNote:O,afterpayConfirming:S,gocardlessConfirming:B,zipConfirming:X,klarnaConfirming:de,cardConfirming:j,checkoutResult:ie,confirmCardPayment:Re,cardStillProcessing:De,renewCardPayment:Q,holdRenewed:be,leaveCardPayment:ne,checkoutRootRef:ee,setCheckoutHeaderEl:z}=Ee();return h?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:R?"Payment received":"Order received"}),x("p",{className:"text-fg-dim",children:[R?x(H,{children:["Thank you \u2014 your payment for order"," ",l("span",{className:"font-mono text-fg",children:h.orderNumber})," has gone through."," "]}):x(H,{children:["Thank you \u2014 your order ",l("span",{className:"font-mono text-fg",children:h.orderNumber})," is being reviewed by our team."," "]}),d?x(H,{children:["Track it under"," ",l(He,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):l(H,{children:"We\u2019ve emailed you a link to set a password and track it."})]}),l(ys,{order:h,paid:R}),f&&l("p",{className:"text-sm text-fg-dim",children:f}),O&&l("p",{className:"text-sm text-fg-dim",children:O}),g&&l("p",{className:"text-sm text-fg-dim",children:g}),!d&&x("p",{className:"text-sm text-fg-dim",children:["You can also"," ",l(He,{href:`/track?order=${encodeURIComponent(h.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email \u2014 no password needed."]}),l(He,{href:"/wheels",className:"mt-2 border-2 border-line px-6 py-3 font-mono text-[12px] uppercase tracking-[0.24em] hover:border-accent",children:"Continue browsing"})]}):ie?l(hs,{result:ie,lostChangeNote:f}):j?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Placing your order \u2014 one moment."})]}):S?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Afterpay \u2014 one moment."})]}):B?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:"Setting up your direct debit\u2026"}),l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Confirming with GoCardless \u2014 one moment."})]}):X?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Zip \u2014 one moment."})]}):de?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Klarna \u2014 one moment."})]}):v&&C?l(vs,{payment:v,checkout:C,holdRenewed:be,onPaid:Re,onProcessing:De,onRenew:Q,onBack:ne}):y&&C?l(Ps,{confirmation:C,clientId:e.paypalClientId??"",idemKey:m,onPaid:()=>{D(!0),k(C)},onSkip:()=>k(C)}):E&&C?l(Ns,{confirmation:C,applicationId:e.squareApplicationId??"",locationId:e.squareLocationId??"",environment:e.squareEnvironment??"production",idemKey:m,onPaid:()=>{D(!0),k(C)},onSkip:()=>k(C)}):x("div",{ref:ee,className:"bg-bg text-fg",children:[x("header",{ref:z,className:"sticky top-0 z-30 grid grid-cols-[1fr_auto_1fr] items-center gap-8 max-[640px]:grid-cols-[auto_minmax(0,1fr)_auto] max-[640px]:gap-3 border-b border-line px-[var(--sf-site-gutter,40px)] py-6 backdrop-blur-md max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))] max-[640px]:py-4",style:{background:"color-mix(in oklab, var(--bg) 92%, transparent)"},children:[x(St,{href:"/",className:"inline-flex items-center gap-3 font-mono text-[14px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["\u2190",l("span",{className:"max-[640px]:hidden",children:"Back to shop"})]}),l("div",{className:"flex min-w-0 justify-center max-[640px]:[container-type:inline-size]",children:l(St,{href:"/","aria-label":`${e.name} home`,className:"inline-flex max-w-full items-center justify-center overflow-x-clip",children:l(to,{variant:"header",scrolled:!0,src:t?.url??null,reverse:t?.reverse??!1,reversedSrc:t?.reversed??null,inkIsDark:t?.inkIsDark??null,size:t?.size??"medium",sizePx:t?.sizePx??null,sizeUnit:t?.sizeUnit??null,siteName:e.name,fitWordmarkToContainer:!0,fitFloorPx:eo})})}),e.cardPayments?x("span",{className:"flex items-center justify-end gap-3 font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim",children:[l("span",{className:"text-green",children:"\u25CF"}),l("span",{className:"max-[640px]:hidden",children:"Encrypted \xB7"})," Stripe"]}):l("span",{})]}),x("section",{className:"mx-auto flex max-w-[var(--sf-site-width,1600px)] flex-wrap items-center justify-between gap-x-8 gap-y-3 border-b border-line bg-surface px-[var(--sf-site-gutter,40px)] py-4 font-mono text-[13px] font-medium uppercase tracking-[0.24em] text-fg max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))]",children:[l("span",{className:"inline-flex items-center bg-accent px-3 py-1 font-bold text-bg",children:"Checkout"}),l("nav",{"aria-label":"Checkout steps",className:"flex flex-wrap items-center gap-5",children:[{n:"01",label:"Cart",state:"done"},{n:"02",label:"Ship & pay",state:"active"},{n:"03",label:"Confirmed",state:"pending"}].map(b=>x("span",{className:["relative flex items-center gap-2 transition-colors",b.state==="pending"?"text-fg-dim":"text-fg",b.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[l("span",{className:b.state==="done"?"text-accent font-bold":"",children:b.n}),l("span",{children:b.label})]},b.n))})]}),x("main",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-[1fr_420px] items-start gap-16 px-[var(--sf-site-gutter,40px)] pt-10 pb-[100px] max-view-desktop:grid-cols-1 max-view-desktop:gap-10 max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))] max-view-desktop:pt-8 max-view-desktop:pb-20",children:[x("div",{children:[x(nn,{locked:a,children:[l(va,{}),l(xa,{}),l(ka,{})]}),l(nn,{locked:r,children:l(Ca,{})})]}),l(Pa,{})]}),l("footer",{className:"flex flex-wrap items-center justify-between gap-4 border-t border-line px-[var(--sf-site-gutter,40px)] py-6 font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))]",children:l("span",{children:Vr({legalName:e.legalName,foundedYear:e.foundedYear,siteName:e.name})})})]})}function vs({payment:e,checkout:t,holdRenewed:n,onPaid:r,onProcessing:a,onRenew:c,onBack:d}){let{formatMoney:g}=ye(),f=l("span",{className:"text-fg",children:g(Number(e.amount),e.currency)}),m=Na(()=>Jt(e.publishableKey),[e.publishableKey]),h=Na(()=>ro(),[]);return l("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:x("div",{className:"w-full max-w-xl border border-line bg-bg",children:[x("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[l("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:Xt(t)}),l("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Payment"})]}),x("div",{className:"flex flex-col gap-4 px-6 py-6",children:[l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:t.orderNumber?x(H,{children:["Your order is placed. Pay ",f," by card to confirm it now."]}):n?x(H,{children:["Your hold ran out, so your items are held again",t.expiresAt?` until ${Sa(t.expiresAt)}`:"",". Enter your card again, then pay ",f,"."]}):x(H,{children:["Your items are held",t.expiresAt?` until ${Sa(t.expiresAt)}`:"",". Pay ",f," by card to place your order."]})}),l(Sn,{stripe:m,options:{clientSecret:e.clientSecret,appearance:h},children:l(ks,{payment:e,checkout:t,onPaid:r,onProcessing:a,onRenew:c,onBack:d})},e.clientSecret)]})]})})}function Sa(e){return new Date(e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}var xs=5;function ks({payment:e,checkout:t,onPaid:n,onProcessing:r,onRenew:a,onBack:c}){let{formatMoney:d}=ye(),g=So(),f=wo(),[m,h]=Je(!1),[k,v]=Je(null),y=st(!1);async function E(){try{return(await g.retrievePaymentIntent(e.clientSecret)).paymentIntent?.status}catch{return}}async function C(O){let S=O;for(let B=0;S==="processing"&&B<xs;B+=1)await new Promise(X=>setTimeout(X,1e3)),S=await E()??S;if(S==="succeeded"){n();return}if(S==="processing"){r();return}v("Payment did not complete. Please try again."),h(!1)}async function R(){if(!g||!f||m)return;h(!0),v(null),y.current=!0;let O=await g.confirmPayment({elements:f,redirect:"if_required"}).catch(()=>null);if(!O){let S=await E();if(S==="succeeded"||S==="processing"){await C(S);return}v(S===void 0?_e:"Payment failed. Please try again."),h(!1);return}if(O.error){if(!t.orderNumber&&O.error.code==="payment_intent_unexpected_state"){let S=await E();if(S==="succeeded"||S==="processing"){await C(S);return}if(S===void 0){v(_e),h(!1);return}await a(S==="canceled"),h(!1);return}v(O.error.message??"Payment failed. Please try again."),h(!1);return}await C(O.paymentIntent?.status)}async function D(){if(m)return;if(!y.current){c();return}h(!0),v(null);let O=await E();if(O==="succeeded"||O==="processing"){await C(O);return}if(h(!1),O===void 0){v(_e);return}c()}return x("div",{className:"flex flex-col gap-4",children:[l(Eo,{}),k&&l(Ne,{role:"alert",children:k}),l("button",{type:"button",onClick:R,disabled:!g||!f||m,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!g||!f||m?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:m?x(H,{children:["Processing\u2026 ",l("span",{children:"\xB7"})]}):x(H,{children:["Pay ",d(Number(e.amount),e.currency),l("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})}),!t.orderNumber&&!m&&x("button",{type:"button",onClick:D,className:"inline-flex items-center gap-3 self-start font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["\u2190",l("span",{children:"Back to checkout"})]})]})}var Ea="paypal-sdk-js",Un=null;function Cs(e,t){let n=`${e}|${t}`;if(Un?.key===n)return Un.promise;let r=new Promise((a,c)=>{document.getElementById(Ea)?.remove();let d=document.createElement("script");d.id=Ea;let g=new URLSearchParams({"client-id":e,currency:t,intent:"capture"});d.src=`https://www.paypal.com/sdk/js?${g}`,d.onload=()=>{let f=window.paypal;f?a(f):c(new Error("PayPal SDK loaded without its namespace"))},d.onerror=()=>c(new Error("PayPal SDK failed to load")),document.head.appendChild(d)});return Un={key:n,promise:r},r}function Ps({confirmation:e,clientId:t,idemKey:n,onPaid:r,onSkip:a}){let{formatMoney:c}=ye(),d=st(null),[g,f]=Je(!1),[m,h]=Je(null),k=st(r);return k.current=r,Oa(()=>{let v=!1,y=null;return Cs(t,e.currency).then(E=>{if(!(v||!d.current))return y=E.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await $.createPaypalOrder({idempotencyKey:n})).paypalOrderId,onApprove:async C=>{try{if((await $.capturePaypalOrder({idempotencyKey:n,paypalOrderId:C.orderID})).status==="paid"){k.current();return}h("PayPal did not complete the payment. Please try again.")}catch(R){h(R instanceof ue?R.message:"PayPal payment failed. Please try again.")}},onError:()=>{h("PayPal could not process the payment. Please try again.")}}),y.render(d.current).then(()=>{v||f(!0)})}).catch(()=>{v||h("PayPal could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{v=!0,y?.close?.()}},[t,e.currency,n]),l("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:x("div",{className:"w-full max-w-xl border border-line bg-bg",children:[x("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[l("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:e.orderNumber}),l("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"PayPal"})]}),x("div",{className:"flex flex-col gap-4 px-6 py-6",children:[x("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",l("span",{className:"text-fg",children:c(Number(e.grandTotal),e.currency)})," ","with PayPal to confirm it now."]}),!g&&!m&&l("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal\u2026"}),l("div",{ref:d}),m&&l(Ne,{role:"alert",children:m}),l("button",{type:"button",onClick:a,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later \u2014 our team will be in touch"})]})]})})}var Ra="square-web-sdk",Wn=null;function ws(e){let t=e==="sandbox"?"sandbox":"production";if(Wn?.key===t)return Wn.promise;let n=new Promise((r,a)=>{document.getElementById(Ra)?.remove();let c=document.createElement("script");c.id=Ra,c.src=t==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",c.onload=()=>{let d=window.Square;d?r(d):a(new Error("Square SDK loaded without its namespace"))},c.onerror=()=>a(new Error("Square SDK failed to load")),document.head.appendChild(c)});return Wn={key:t,promise:n},n}function Ns({confirmation:e,applicationId:t,locationId:n,environment:r,idemKey:a,onPaid:c,onSkip:d}){let{formatMoney:g}=ye(),f=st(null),m=st(null),h=st(null),[k,v]=Je(!1),[y,E]=Je(!1),[C,R]=Je(null);Oa(()=>{let O=!1,S=null;return ws(r).then(async B=>{if(O||!f.current)return;let X=B.payments(t,n);h.current=X,S=await X.card(),await S.attach(f.current),m.current=S,O||v(!0)}).catch(()=>{O||R("Square could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{O=!0,S?.destroy?.()}},[t,n,r]);async function D(){let O=m.current;if(!(!O||y)){E(!0),R(null);try{let S=await O.tokenize();if(S.status!=="OK"||!S.token){R(S.errors?.[0]?.message??"Please check the card details and try again."),E(!1);return}let B;try{B=(await h.current?.verifyBuyer?.(S.token,{amount:String(e.grandTotal),currencyCode:e.currency,intent:"CHARGE"}))?.token}catch{}if((await $.chargeSquare({idempotencyKey:a,sourceId:S.token,...B?{verificationToken:B}:{}})).status==="paid"){c();return}R("Square did not complete the payment. Please try again.")}catch(S){R(S instanceof ue?S.message:"Square payment failed. Please try again.")}E(!1)}}return l("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:x("div",{className:"w-full max-w-xl border border-line bg-bg",children:[x("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[l("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:e.orderNumber}),l("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Card"})]}),x("div",{className:"flex flex-col gap-4 px-6 py-6",children:[x("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",l("span",{className:"text-fg",children:g(Number(e.grandTotal),e.currency)})," ","by card to confirm it now."]}),!k&&!C&&l("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form\u2026"}),l("div",{ref:f}),C&&l(Ne,{role:"alert",children:C}),l("button",{type:"button",onClick:D,disabled:!k||y,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!k||y?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:y?x(H,{children:["Processing\u2026 ",l("span",{children:"\xB7"})]}):x(H,{children:["Pay ",g(Number(e.grandTotal),e.currency),l("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})}),l("button",{type:"button",onClick:d,disabled:y,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later \u2014 our team will be in touch"})]})]})})}import{jsx as on}from"react/jsx-runtime";function Ss(){let{settings:e,websiteName:t}=_r(),n=t?{...kn,name:t}:kn,r=e?{url:e.logoUrl,reversed:e.logoReversed??null,inkIsDark:e.logoInkIsDark??null,reverse:e.reverseLogo,size:e.logoSize,sizePx:e.logoSizePx,sizeUnit:e.logoSizeUnit??null}:null;return on("div",{style:{position:"fixed",inset:0,zIndex:2147482e3,overflowY:"auto",background:"var(--bg)",color:"var(--fg)"},children:on(Hr,{children:on(Jr,{preview:!0,children:on($n,{site:n,logo:r,preview:!0})})})})}export{Ss as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{vp as r}from"./chunk-RFFTWKCU.js";import"./chunk-FRCI3FAV.js";import"./chunk-GB6OHYUY.js";import"./chunk-Y6SLVHK3.js";import{jsx as o}from"react/jsx-runtime";import e from"efficient-easel/screen/components/ScreenStoreProvider";function a(t){return o(e,{...t,parts:r})}export{a as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{P as xe,X as _t,Z as Rt,_ as Nt,aa as G,g as wt}from"./chunk-MVJVIU2F.js";import{Ci as Xe,Di as Pt,Ie as Ct,gi as xt,ii as ze,ji as Ve,li as St,yi as Ce,zi as Et}from"./chunk-FRCI3FAV.js";import{c as vt,o as de}from"./chunk-GB6OHYUY.js";import{createContext as In,useContext as Ot,useEffect as Ln,useMemo as Se,useState as At}from"react";function It(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function fe(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 Ye=4,Vr=1,Xr={unit:"set",spares:0,spareSide:"left"};function Lt(e){return e.unit==="single"?1:Ye+e.spares}function Yr(e,t){return[{partNumber:e.partNumber,wheels:Lt(t),prices:e.prices}]}function Qr(e,t){let n=Lt(t)-Ye;if(n<=0||e.length===0)return e;let r=Rn(e),o=r?r[t.spareSide]:0;return e.map((i,a)=>a===o?{...i,wheels:i.wheels+n}:i)}function Rn(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 jr(e){return e.unit==="single"?"Single":Nn(`Set of ${Ye}`,e)}var Zr="data-add-to-basket",Qe=9,kn="en",kt=new Map;function Te(e,t,n){let r=`${e}|${t??""}|${n??""}`,o=kt.get(r);return o||(o=new Intl.NumberFormat(kn,{style:"currency",currency:e,...t===void 0?{}:{minimumFractionDigits:t},...n===void 0?{}:{maximumFractionDigits:n}}),kt.set(r,o)),o}function Y(e,t,n=0){return Te(t,0,n).format(e)}function Jr(e,t){return Te(t).format(e)}function eo(e,t){let n=e.savings[t];if(n===void 0)return null;let r=Y(n,t);return e.savingIsFrom?`Save from ${r}`:`Save ${r}`}import{jsx as Mn}from"react/jsx-runtime";var An="storefront-country",Tt=An,je=In(null);function Tn(e){return Mt(e,"catalogue")}function On(e){return Mt(e,"money")}function Mt(e,t){let n=new Map(e.map(r=>[r.code,r.decimalPlaces]));return(r,o)=>{if(!o)return"";let i=n.get(o)??0;return Te(o,t==="money"?i:0,i).format(r)}}function io({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=Se(()=>t??[],[t]),a=Se(()=>n??[],[n]),l=Se(()=>r||i.find(m=>m.isDefault)?.code||i[0]?.code||"",[r,i]),c=Se(()=>o||a.find(m=>m.isDefault)?.code||a[0]?.code||"",[o,a]),[u,g]=At(c),[x,d]=At(!1);Ln(()=>{let m=de.getItem(Tt);m&&a.some(L=>L.code===m)&&g(m),d(!0)},[a]);function P(m){g(m),de.setItem(Tt,m)}let k=Se(()=>{let m=a.find(y=>y.code===u)??null,L=m?.currency,I=L&&i.some(y=>y.code===L)?L:l,A=Tn(i),_=On(i);return{country:u,currency:I,setCountry:P,currencies:i,countries:a,activeCountry:m,formatPrice:(y,U)=>A(y,U??I),formatMoney:(y,U)=>_(y,U??I),ready:x}},[u,i,a,l,x]);return Mn(je.Provider,{value:k,children:e})}function Dt(e){let t=Ot(je);if(!t&&!e?.optional)throw new Error("useCurrency must be used within a CurrencyProvider");return t}function ao(){return Ot(je)?.country??""}import{createContext as Yn,useCallback as E,useContext as Qn,useEffect as z,useMemo as jt,useRef as Q,useState as w}from"react";function Ft(){return"/edit"}function $t(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var Ht="We'll confirm this discount when you place your order.",fo="Confirmed at checkout";function po(e){return e&&(e.valid||e.deferred)?e.code:void 0}var Ut="coupon_code: ";function mo(e){return!(e instanceof xe)||e.status!==400||!e.message.startsWith(Ut)?null:e.message.slice(Ut.length)}function Bt(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 Oe="Price on request",Fn="Request a quote",qt="from ",bo="From ",Co="each",Wt="Free",xo="\u2026",So="Updating";function Ze(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Je(e,t){let n=e?.[t];return Ze(n)?n:null}function vo(e,t,n,r){let o=Je(e,n),i=Je(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function Eo(e,t,n,r){if(n==null&&r==null)return!0;let o=Je(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var Un={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function $n(e,t,n){if(!Ze(e))return Un;let r=Ze(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function Po(e,t,n=""){return!e.priced||e.unit==null?Oe:`${n}${Y(e.unit,t)}`}function wo(e,t){return e.was==null?null:Y(e.was,t)}function Hn(e,t,n=1){let r=fe(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((a,l)=>a+l.wheels,0),i=Math.min(...e.map(a=>a.prices[t]));return{priced:!0,unit:i,isFrom:i*o!==r,setTotal:r*n}}var Bn={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function _o(e,t,n,r=1){let o=$n(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=Hn(t.components,n,r);return a.priced?{priced:!0,unit:a.unit,isFrom:a.isFrom,was:null,onSale:!1,setTotal:a.setTotal,fromSetTotal:i}:{...Bn,fromSetTotal:i}}function qn(e,t){return!e.priced||e.unit==null?Oe:`${e.isFrom?qt:""}${Y(e.unit,t)}`}function Ro(e,t){return e.was==null?null:Y(e.was,t)}function No(e,t){return!e.priced||e.unit==null?Fn:qn(e,t)}function ko(e,t){let n=e.savings[t];if(n===void 0||e.components.length===0)return null;let r=0;for(let i of e.components){let a=i.prices?.[t];if(typeof a!="number")return null;r+=a*i.quantity}let o=Y(r-n,t);return{was:Y(r,t),amount:e.savingIsFrom?`${qt}${o}`:o}}var Wn=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function Gt(e){return Wn.test(e.trim())}var Kt="sf:ga-purchases",Gn=20;function Vt(){return typeof window>"u"||window.parent!==window}function ve(...e){try{if(Vt()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function Kn(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:fe(e.components,t)??0,quantity:e.qty}}function et(e,t){return e.filter(Me).map(n=>Kn(n,t))}function Mo(e){ve("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 Xt(e,t){let n=et([e],t);n.length!==0&&ve("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function Do(e){let t=et(e.lines,e.currency);t.length!==0&&ve("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var zt=new Set;function zn(e){if(zt.has(e))return!1;zt.add(e);try{let t=JSON.parse(de.getItem(Kt)??"[]");if(t.includes(e))return!1;de.setItem(Kt,JSON.stringify([...t,e].slice(-Gn)))}catch{}return!0}function Fo(e){let t=e.confirmation;if(Vt()||!zn(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);ve("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:et(e.lines,n)}),e.adsSendTo&&ve("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var Vn="Arranged after review",Yt="Calculated at checkout",Xn=Yt,Ho=Yt;function Qt({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function Bo(e){switch(e){case"arranged":return Vn;case"pending":return Xn;case"free":return Wt;case"charged":return null}}import{jsx as er}from"react/jsx-runtime";var jn=400,Zn=400,Jn=1500;function Me(e){return(e.components?.length??0)>0}function Zt(e,t){return{code:e,valid:t.valid,deferred:$t(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function en(e,t){return fe(e.components,t)}function tt(e,t){let n=en(e,t);return n===null?null:n*e.qty}function Jt(e){return e!=="tyre"}var tn=Yn(null);function ei({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=Dt(),[i,a]=w(t),[l,c]=w([]),[u,g]=w([]),[x,d]=w([]),[P,k]=w(!1),m=Q(new Set),[L,I]=w([]),[A,_]=w(!1),[y,U]=w(null),[V,J]=w(null),[T,b]=w(null),[R,C]=w(0),ee=E(()=>C(s=>s+1),[]),[pe,me]=w(void 0),[K,qe]=w(null),[v,O]=w(null),[ge,ie]=w(!1),[M,he]=w(null),te=Q(void 0),H=E(()=>a(!0),[]),ae=E(()=>a(!1),[]),X=E(()=>a(s=>!s),[]);z(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&H()},[H,t]);let $=Ft(),Re=Q($);z(()=>{Re.current!==$&&(Re.current=$,t||ae())},[$,t,ae]);let F=E(s=>{qe(p=>p?.country===s?.country&&p?.subdivision===s?.subdivision&&p?.postcode===s?.postcode?p:s)},[]),Ne=E((s,p)=>{_(!0),!(!p||!Jt(s))&&I(f=>f.includes(p)?f:[...f,p])},[]),se=A||l.length>0,le=Q(!0);z(()=>(le.current=!0,()=>{le.current=!1}),[]),z(()=>{if(t)return;let s=[...L,...l.filter(f=>Jt(f.kind)).map(f=>f.slug)],p=[...new Set(s)].filter(f=>f&&!m.current.has(f));if(p.length!==0){for(let f of p)m.current.add(f);G.listWheelsBySlug(p).then(f=>{if(!le.current||f.length===0)return;let h=new Set(f.map(S=>S.slug));g(S=>[...S.filter(re=>!h.has(re.slug)),...f])})}},[t,L,l]),z(()=>{if(t||!se||P)return;let s=!0;return G.listBundles().then(p=>{s&&(d(p),k(!0))}),()=>{s=!1}},[t,se,P]);let B=y?.deliveryOptions??[],ye=y?.courier??null;z(()=>{y&&he(s=>s&&B.some(p=>p.id===s)?s:B[0]?.id??null)},[y]);let ne=E(()=>l.filter(Me).flatMap(s=>It(s.components,s.qty)),[l]),ue=E(async(s,p)=>{let f=s.trim().toUpperCase();if(!f)return;let h=ne();if(h.length===0){O({code:f,valid:!1,message:"Add a wheel to the cart first."});return}ie(!0),te.current=p;try{let S=await G.validateCoupon({code:f,items:h,currency:n,shippingMethodId:M??void 0,customerEmail:p});O(Zt(f,S))}catch{O({code:f,valid:!1,unchecked:!0,message:"Could not check that code. Please try again."})}finally{ie(!1)}},[ne,n,M]),ke=E(()=>{O(null),te.current=void 0},[]),Ie=E(s=>{if(!v)return;let{code:p}=v;O(f=>f&&f.code===p?{code:p,valid:!1,refused:!0,message:s}:f)},[v]);z(()=>{if(!v||v.refused)return;let s=v.code,p=h=>h!==null&&h.code===s&&!h.refused,f=setTimeout(async()=>{let h=ne();if(h.length===0){O(S=>p(S)?{code:s,valid:!1,message:"Add a wheel to the cart first."}:S);return}ie(!0);try{let S=await G.validateCoupon({code:s,items:h,currency:n,shippingMethodId:M??void 0,customerEmail:te.current});O(re=>p(re)?Zt(s,S):re)}catch{}finally{ie(!1)}},jn);return()=>clearTimeout(f)},[l,n,M]);let N=v&&!v.refused?v.code:void 0;z(()=>{if(t)return;let s=!0,p=l,f=setTimeout(async()=>{let h=ne();if(h.length===0){U(null),J(null),me(void 0);return}try{let S=await G.quoteCart({items:h,currency:n,shippingMethodId:M??void 0,couponCode:N,customerEmail:te.current||void 0,country:K?.country||r||void 0,subdivision:K?.country&&K.subdivision||void 0,postcode:K?.country&&K.postcode||void 0});if(!s)return;U(S),J(p),b(null)}catch{if(!s)return;b(p)}me(N)},Zn);return()=>{s=!1,clearTimeout(f)}},[l,n,M,N,r,K,R]);let q=E(s=>{c(p=>{let f=p.findIndex(h=>h.id===s.id);return f===-1?[...p,s]:p.map((h,S)=>S===f?{...h,qty:Math.min(Qe,h.qty+s.qty)}:h)}),Xt(s,n)},[n]),Le=E(s=>{c(p=>p.filter(f=>f.id!==s))},[]),lt=E((s,p)=>{let f=Math.max(1,Math.min(Qe,p));c(h=>h.map(S=>S.id===s?{...S,qty:f}:S))},[]),ut=E(s=>{c(s)},[]),[be,xn]=w(null),ct=Q(null);ct.current=be;let W=Q(null),We=Q(""),dt=E((s,p)=>{let f=s.trim().toLowerCase();Gt(f)&&xn(h=>h&&h.email===f&&h.firstName===(p??"")?h:{email:f,firstName:p??""})},[]);z(()=>{if(t||!be)return;let s=Bt(l.filter(Me),h=>tt(h,n)===null?Oe:o(tt(h,n),n)),p={email:be.email,firstName:be.firstName,currency:n,items:s},f=JSON.stringify(p);if(f!==We.current)return W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{W.current=null,We.current=f,G.captureCart(p).catch(h=>{})},Jn),()=>{W.current&&(clearTimeout(W.current),W.current=null)}},[l,be,n,t]);let ft=E(()=>{W.current&&(clearTimeout(W.current),W.current=null);let s=ct.current;s&&(We.current="",G.captureCart({email:s.email,firstName:s.firstName,currency:n,items:[]}).catch(p=>{}))},[n]),pt=jt(()=>{let s=l.reduce((D,ce)=>{let Ae=tt(ce,n);return Ae===null?D:D+Ae},0),p=l.some(D=>en(D,n)===null),f=l.reduce((D,ce)=>D+ce.qty,0),h=v?.valid?v.effects:void 0,S=h?Math.min(s,Number(h.discountAmount)):0,re=y?.bundleDiscount??0,vn=y?.appliedBundles??[],Ge=!!h?.freeShipping,yt=B.find(D=>D.id===M),bt=Ge?0:y?.shipping??yt?.amount??0,En=Qt({quoted:y!==null,optionCount:B.length,chosenAmount:yt?.amount,couponWaivesFreight:Ge}),Ke={};for(let D of h?.freeUnits??[])Ke[D.partNumber]=(Ke[D.partNumber]??0)+D.quantity;let Pn=y?.tax??null,wn=y?y.grandTotal:s-S-re+bt;return{sets:f,units:l.reduce((D,ce)=>D+(ce.components??[]).reduce((Ae,_n)=>Ae+_n.wheels*ce.qty,0),0),subtotal:s,hasUnpricedLine:p,discount:S,bundleDiscount:re,appliedBundles:vn,shipping:bt,freeShipping:Ge,shippingStatus:En,freeUnitsByPartNumber:Ke,tax:Pn,grand:wn,repricing:!!v?.refused&&y!==null&&pe===v?.code,quoted:y!==null&&V===l,serverSubtotal:y?.subtotal??null,quoteFailed:T===l,currency:n}},[l,n,v,B,M,y,pe,V,T]),mt=Q(!0),gt=E(s=>{mt.current=s},[]),ht=E(s=>{q(s),mt.current&&H()},[q,H]),Sn=jt(()=>({isOpen:i,preview:t,open:H,close:ae,toggle:X,items:l,catalog:u,bundles:x,warmCatalog:Ne,add:q,addAndOpen:ht,setAutoOpen:gt,remove:Le,setQty:lt,replaceItems:ut,identify:dt,clearCapturedCart:ft,coupon:v,applyCoupon:ue,removeCoupon:ke,refuseCoupon:Ie,couponBusy:ge,deliveryOptions:B,setQuoteDestination:F,courier:ye,requote:ee,shippingMethodId:M,setShippingMethodId:he,totals:pt}),[i,t,H,ae,X,l,u,x,Ne,q,ht,gt,Le,lt,ut,dt,ft,v,ue,ke,Ie,ge,B,F,ye,ee,M,pt]);return er(tn.Provider,{value:Sn,children:e})}function nn(){let e=Qn(tn);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as cr}from"react";function rn(e){return/(?:^|\|)(?:slug|xhost):/.test(e)}function on(e,t,n,r){for(;e.size>=t;){let o,i;for(let[l,c]of e){if(c.expiresAt<=r){o=l;break}i===void 0&&n(l)&&(i=l)}let a=o??i??e.keys().next().value;if(a===void 0)return;e.delete(a)}}var tr=6e4,nr=5e3,rr=500,De=new Map;async function or(e){let{host:t,matchesRequestHost:n}=await _t();if(!t)return"";let r=await Rt();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}async function an(e,t){if(await Nt()!==null)return t();let n=await or(e);if(!n)return t();let r=Date.now(),o=De.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),a=i.outcome.state==="failed",l=a?nr:tr,c=De.get(n)?.lastGood,u=i.outcome.state==="ok"?i:a?c:void 0,g=a&&u?u:i;return on(De,rr,rn,r),De.set(n,{load:g,expiresAt:r+l,lastGood:u}),g}var ir=404;function ar(e){if(e instanceof xe&&e.status===ir)return{state:"absent"};let t=e instanceof xe?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var sr="[storefront:chrome-load-failed]";function lr(e,t){console.error(`${sr} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function sn(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=ar(o);return i.state==="failed"&&lr(e,i),{value:n,outcome:i}}}function ur(e){return e==="production"?"silent":"banner"}var li=ur("production");function dr(e,t){return e?.trim()||t}function hi({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=dr(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var fr={name:Ce,legalName:null,foundedYear:null,faviconUrl:null,currencies:[],defaultCurrency:null,countries:[],defaultCountry:null,commerceEnabled:!0,cardPayments:!1,paymentMethods:[],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,privacyPage:null,termsPage:null,footerCookieSettings:!0,footerSitemap:!0,socialLinks:Xe},yi=cr(async()=>an("site",()=>sn("site",async()=>{let e=await G.getSite();return{name:Et(e.name),legalName:e.legalName?.trim()||null,foundedYear:e.foundedYear??null,faviconUrl:e.faviconUrl??null,currencies:e.currencies??[],defaultCurrency:e.defaultCurrency??null,countries:e.countries??[],defaultCountry:e.defaultCountry??null,commerceEnabled:e.commerceEnabled??!0,cardPayments:e.cardPayments??!1,paymentMethods:e.paymentMethods??(e.cardPayments?["card"]:[]),paypalClientId:e.paypalClientId??null,paypalEnvironment:e.paypalEnvironment??null,squareApplicationId:e.squareApplicationId??null,squareLocationId:e.squareLocationId??null,squareEnvironment:e.squareEnvironment??null,ga4MeasurementId:e.ga4MeasurementId??null,googleAdsId:e.googleAdsId??null,googleAdsConversionLabel:(e.googleAdsId?e.googleAdsConversionLabel:null)??null,metaPixelId:e.metaPixelId??null,consentEnabled:e.consentEnabled??!1,consentPrivacyPage:e.consentPrivacyPage??null,consentNoticeOptOut:e.consentNoticeOptOut??!1,privacyPage:e.privacyPage??null,termsPage:e.termsPage??null,footerCookieSettings:e.footerCookieSettings??!0,footerSitemap:e.footerSitemap??!0,socialLinks:Pt(e.socialLinks)}},fr)));var bi={name:Ce,legalName:null,foundedYear:null,faviconUrl:null,currencies:[{code:"USD",symbol:"$",decimalPlaces:2,isDefault:!0}],defaultCurrency:"USD",countries:[{code:"US",name:"United States",currency:"USD",url:"",isDefault:!0,chargeTax:!1,taxDisplay:"none",taxName:"",taxRate:null,postalLabel:"Zip Code"}],defaultCountry:"US",commerceEnabled:!0,cardPayments:!0,paymentMethods:["card"],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,privacyPage:null,termsPage:null,footerCookieSettings:!0,footerSitemap:!0,socialLinks:Xe};import{jsx as pr}from"react/jsx-runtime";function xi({tone:e="bad",role:t,children:n}){return pr("div",{role:t,className:["border bg-surface px-4 py-3 text-[14px] leading-relaxed text-fg",e==="good"?"border-accent":e==="bad"?"border-alert":"border-line"].join(" "),children:n})}import{jsx as Pe,jsxs as nt}from"react/jsx-runtime";import{useEffect as Fe,useId as yr,useRef as un,useState as Ue}from"react";import{useRootIsDark as br}from"efficient-shell/theme";import{efficientClientOpen as mr}from"efficient-easel/screen/lib/session";var Ee=new Map,gr=64;async function hr(e){if(!mr())return null;try{let t=await fetch(`${vt()}/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 ln(e){let t=Ee.get(e);if(t)return t;let n=hr(e);if(Ee.set(e,n),Ee.size>gr){let r=Ee.keys().next();r.done||Ee.delete(r.value)}return n}var Cr=202/22,xr=.88,$i=16,Sr="invert(1)";function Hi({variant:e="header",scrolled:t=!0,src:n,reverse:r=!1,color:o=null,onLightSurface:i,reversedSrc:a,inkIsDark:l,size:c="medium",sizePx:u,sizeUnit:g,wordmark:x,siteName:d=Ce,fitToContainer:P=!1,fitWordmarkToContainer:k=!1,fitFloorPx:m,hideClass:L,hideAttrs:I}){let A=x&&x.trim()?x.trim():d,[_,y]=Ue(null),U=un(null),V=N=>{U.current=N};Fe(()=>{y(U.current?.ownerDocument??null)},[]);let J=!br({doc:_,whenUnset:!0}),T=n&&n.trim()?n.trim():null,b=!!T&&wt(T),R=i??(J&&t),C=o&&o.trim()?o.trim():null,ee=r&&!C,pe=`logo-color-${yr().replace(/[^A-Za-z0-9_-]/g,"")}`,me=ee&&b&&T&&a!=null?{reversed:a,inkIsDark:l??null}:null,K=me!==null,[qe,v]=Ue(null);Fe(()=>{if(!ee||!T||!b||K){v(null);return}let N=!1;return v(null),ln(T).then(q=>{N||v(q)}),()=>{N=!0}},[ee,T,b,K]);let O=me??qe,ge=!!O&&O.inkIsDark!==null&&(R?!O.inkIsDark:O.inkIsDark),ie=ee&&!!T&&!b&&!R,M=ge&&O?O.reversed:T,he=M?[M]:[],[te,H]=Ue(0);Fe(()=>{H(0)},[T,ge]);let ae=e==="footer"?Ve:ze[c],X=u&&u>0?u:ae,$=(u&&u>0?Ct(u,g,"size",St):null)??`${X}px`,Re=Math.round(X*Cr),F=te<he.length?he[te]:null,[Ne,se]=Ue(M),le=F!==null&&F===Ne,B=un(null);Fe(()=>{let N=B.current;if(!N||!N.complete)return;if(N.naturalWidth>0||N.naturalHeight>0){se(F);return}let q=!1;return N.decode().then(()=>!q&&se(F),()=>!q&&H(Le=>Le+1)),()=>{q=!0}},[F]);let ye=P||k,ne=`calc(100cqi / ${((A.length+1)*xr).toFixed(2)})`,ue=ye&&m&&m>0?$===`${X}px`?`${Math.min(m,X)}px`:`min(${m}px, ${$})`:null,ke=ye?ue===null?`min(${$}, ${ne})`:`clamp(${ue}, ${ne}, ${$})`:$,Ie=nt("span",{className:`font-display font-bold tracking-[0.18em] ${ue===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:ke,lineHeight:1,...C?{color:C}:{}},"aria-label":A,children:[A,Pe("span",{className:"text-accent",style:C?{color:C}:void 0,children:"."})]});return nt("span",{ref:V,className:xt("inline-flex items-center",L??""),...I,children:[!le&&Ie,C&&F&&Pe("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:nt("filter",{id:pe,colorInterpolationFilters:"sRGB",children:[Pe("feFlood",{style:{floodColor:C}}),Pe("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),F&&Pe("img",{ref:B,src:F,alt:A,width:Re,height:X,className:"shrink-0 object-contain",style:{...le?{height:$,width:"auto",...P?{maxWidth:"100cqi"}:{}}:{display:"none"},...ie?{filter:Sr}:{},...C?{filter:`url(#${pe})`}:{}},onLoad:()=>se(F),onError:()=>H(N=>N+1)},F)]})}var qi="w-full border-2 border-line bg-bg px-4 py-4 font-display text-[17px] tracking-[-0.005em] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent",cn="w-0 min-w-0 flex-1",Wi="w-0 min-w-[7rem] flex-1";import{jsx as we,jsxs as Er}from"react/jsx-runtime";function vr({spokes:e,mesh:t=!1,className:n}){let a=c=>Math.round(c*1e3)/1e3,l=[];for(let c=0;c<e;c++){let u=c/e*Math.PI*2-Math.PI/2;if(l.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 g=u+Math.PI/e;l.push({x1:a(100+Math.cos(g)*22*1.4),y1:a(100+Math.sin(g)*22*1.4),x2:a(100+Math.cos(g)*78),y2:a(100+Math.sin(g)*78),main:!1})}}return Er("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:[we("circle",{cx:100,cy:100,r:92,strokeWidth:2}),we("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),we("circle",{cx:100,cy:100,r:22,strokeWidth:2}),we("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),l.map((c,u)=>we("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 Vi="#c9a461",dn=[{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"}],Xi={name:"",color:"var(--fg)",family:"silver",src:""};function Pr(e,t){let n=r=>{let o=dn.findIndex(i=>i.f===r);return o===-1?dn.length:o};return n(e)-n(t)||e.localeCompare(t)}function Yi(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(Pr)}import{useState as wr}from"react";import{jsx as oe,jsxs as rt}from"react/jsx-runtime";function _r({customerEmail:e,disabled:t=!1}){let{coupon:n,applyCoupon:r,removeCoupon:o,couponBusy:i}=nn(),[a,l]=wr("");async function c(){t||i||!a.trim()||(await r(a,e),l(""))}return rt("div",{className:"flex flex-col gap-2",children:[n===null?rt("div",{className:"flex border border-line",children:[oe("input",{type:"text",value:a,onChange:u=>l(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),c())},placeholder:"Coupon code","aria-label":"Coupon code",disabled:t,className:`${cn} bg-transparent px-4 py-4 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim`}),oe("button",{type:"button",onClick:()=>{c()},disabled:i||t,className:"border-l border-line px-4 font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-wait disabled:opacity-60",children:i?"\u2026":"Apply"})]}):rt("div",{className:["flex items-center justify-between gap-3 border px-4 py-3",n.valid?"border-accent":"border-line"].join(" "),style:n.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[oe("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",n.valid?"text-accent":n.deferred||n.unchecked?"text-fg":"text-fg-dim line-through"].join(" "),children:n.code}),n.unchecked&&oe("button",{type:"button",onClick:()=>{r(n.code,e)},disabled:i||t,className:"ml-auto font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:text-fg disabled:cursor-wait disabled:opacity-60",children:i?"\u2026":"Try again"}),!t&&oe("button",{type:"button",onClick:o,"aria-label":`Remove coupon ${n.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"\u2715"})]}),n?.deferred?oe("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:Ht}):n&&!n.valid&&n.message&&oe("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:n.message})]})}var ot="Ads on. Shopper can opt out.",$e="Ads and analytics off until Accept",Rr={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:ot,footerLink:"Do Not Sell or Share My Personal Information",panelEyebrow:"Do not sell or share",adsRowName:"Sale or sharing for ads"},ca:{region:"ca",name:"Canada",model:"opt-in",law:"PIPEDA, Quebec Law 25",beforeChoice:$e,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:ot,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:ot,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:$e,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:$e,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:$e,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}};function Nr(e){let t=[...e.googleAds?["Google"]:[],...e.meta?["Facebook","Instagram"]:[]];return t.length<=1?t.join(""):`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function ra(e,t,n){let r=Nr(n),o=r?`We use cookies to count visits and to show you ${t} ads on ${r}.`:"We use cookies to count visits.";return e.model==="opt-in"?{heading:r?"Cookies and ads":"Cookies",before:`${o} Nothing loads until you choose. You can change this at any time with `,link:e.footerLink,after:" at the bottom of every page."}:{heading:r?"Cookies and ads":"Cookies",before:`${o} You can say no at any time: choose Privacy choices, or use `,link:e.footerLink,after:" at the bottom of every page."}}var oa={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on",close:"Close",cookieSettings:"Cookie settings"};var kr={asked:!1,region:"other",model:"opt-in",analytics:!0,ads:!0,chosen:!0,gpc:!1};var Ir=kr;function la(e=Ir){if(e.asked)return e.ads?"granted":"denied"}function ca(){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 Ar,isValidElement as Tr,useEffect as pn,useId as Or,useLayoutEffect as hn,useRef as j,useState as mn}from"react";var He=(e,t)=>!!e[t]&&!e[t].disabled;function it(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(He(e,i))return i}return t}function at(e,t){return it(e,t===1?-1:e.length,t)}function st(e,t){return He(e,t)?t:Math.max(at(e,1),0)}function fn(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(),l=n.findIndex((c,u)=>He(n,u)&&c.label.toLowerCase().startsWith(a));return{state:i({open:!0,typed:a,focus:l>=0?l:o}),handled:!0}}if(!r)return t==="ArrowDown"||t==="ArrowUp"||t==="Enter"||t===" "?{state:i({open:!0,typed:""}),handled:!0}:{state:e,handled:!1};switch(t){case"ArrowDown":return{state:i({focus:it(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:it(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:at(n,1)}),handled:!0};case"End":return{state:i({focus:at(n,-1)}),handled:!0};case"Enter":case" ":return He(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 Mr}from"efficient-shell/ui";import{Fragment as qr,jsx as Z,jsxs as yn}from"react/jsx-runtime";var gn={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function Dr({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[a,l]=mn(!1),c=r!==void 0,u=c?r:a,[g,x]=mn(0),d=j({text:"",timer:0}),P=j(null),k=j(null),m=j(null),L=Or(),I=j(null),A=e.findIndex(b=>b.value===t),_=b=>{b!==u&&(c||l(b),b?o?.():i?.())},y=b=>{let R=e[b];!R||R.disabled||(n(R.value),_(!1),k.current?.focus())},U=b=>{let R={open:u,focus:u?g:st(e,A),typed:d.current.text},C=fn(R,b,e);return!C.handled&&C.state.open===u?!1:(C.state.typed!==R.typed&&(d.current.text=C.state.typed,window.clearTimeout(d.current.timer),d.current.timer=window.setTimeout(()=>{d.current.text=""},500)),x(C.state.focus),C.commit!==void 0?y(C.commit):_(C.state.open),C.refocus&&k.current?.focus(),C.handled)},V=j(U);V.current=U;let J=j(()=>_(!1));J.current=()=>_(!1);let T=b=>{u||(I.current=b.nativeEvent,V.current(b.key)&&b.preventDefault())};return pn(()=>{if(!u)return;let b=C=>{P.current?.contains(C.target)||J.current()},R=C=>{C!==I.current&&V.current(C.key)&&C.preventDefault()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",R),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",R)}},[u]),pn(()=>{u&&(d.current.text||x(st(e,A)))},[u]),hn(()=>{if(!u||!m.current)return;m.current.children.item(g)?.scrollIntoView({block:"nearest"})},[g,u]),{open:u,toggle:()=>_(!u),close:()=>_(!1),focusIdx:g,setFocusIdx:x,pick:b=>y(e.findIndex(R=>R.value===b)),wrapRef:P,triggerRef:k,listRef:m,listId:L,onTriggerKeyDown:T,activeId:u?`${L}-${g}`:void 0}}var Fr={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 ${gn.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 ${gn.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){hn(()=>{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 l=a.getBoundingClientRect(),c=n.getBoundingClientRect(),u=Math.abs(c.right-l.right)<Math.abs(c.left-l.left)?"end":"start",g=Mr({trigger:{left:l.left,right:l.right,top:l.top,bottom:l.bottom},menu:{width:c.width,height:c.height},bounds:{left:0,top:0,right:r.innerWidth,bottom:r.innerHeight},align:u,side:"bottom"});if(g.side==="top"){i.top="auto",i.bottom="100%",i.marginTop="0px";let d=g.top+Math.min(c.height,g.maxHeight);i.marginBottom=`${Math.max(0,l.top-d)}px`}g.maxHeight<c.height&&(i.maxHeight=`${g.maxHeight}px`,i.overflowY="auto");let x=g.left-c.left;x&&(i.translate=`${x}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function $r(e){return e.split(" ").map(t=>t==="left-0"?"right-0":t).join(" ")}function Hr({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:a,listRef:l,ariaLabel:c,align:u="start"}){let g=Fr[t],x=j(null);return Ur(x,n.length),Z("ul",{ref:d=>{x.current=d,l&&(l.current=d)},id:e,role:"listbox","aria-label":c,...g.pickerMarker?{"data-picker-menu":""}:{},className:u==="end"?$r(g.list):g.list,children:n.map((d,P)=>{let k=d.value===r;return Z("li",{id:`${e}-${P}`,role:"option","aria-selected":k,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(P),onMouseDown:m=>{m.preventDefault(),d.disabled||a(d.value)},className:g.item(P===o,k&&d.value!=="",!!d.disabled,P===n.length-1),style:g.itemStyle?.(k),children:d.meta===void 0?d.label:yn(qr,{children:[d.lead,Z("span",{className:"flex-1 whitespace-nowrap",children:d.label}),Z("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${P}`)})})}function Br({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:a,id:l,"aria-label":c,align:u}){let g=Ar.toArray(r).flatMap(m=>{if(!Tr(m))return[];if(m.type!=="option")return[];let I=m.props,A=I.value!==void 0?String(I.value):"",_=I.children,y=typeof _=="string"||typeof _=="number"?String(_):A;return[{value:A,label:y,disabled:!!I.disabled}]}),x=e??"",d=Dr({items:g,value:x,onPick:m=>t?.({target:{value:m}})}),k=g.find(m=>m.value===x)?.label??g[0]?.label??"";return yn("div",{ref:d.wrapRef,className:"relative",children:[a&&Z("input",{type:"hidden",name:a,value:x}),Z("button",{ref:m=>{d.triggerRef.current=m},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":d.open,"aria-controls":d.open?d.listId:void 0,"aria-activedescendant":d.activeId,"aria-label":c,id:l,onClick:()=>!n&&d.toggle(),onKeyDown:m=>!n&&d.onTriggerKeyDown(m),className:`block w-full ${o??""}`,style:i,children:Z("span",{className:"block w-full truncate text-left",children:k})}),d.open&&Z(Hr,{id:d.listId,tone:"select",items:g,value:x,focusIdx:d.focusIdx,onFocus:d.setFocusIdx,onPick:d.pick,listRef:d.listRef,align:u})]})}import{jsx as _e,jsxs as Be}from"react/jsx-runtime";var Wr="font-mono text-[length:var(--size-label,12px)]",Gr="font-semibold uppercase tracking-[0.22em] text-fg";function bn(e){return`${e??Wr} ${Gr}`}function Cn(){return _e("span",{className:"text-accent",children:" *"})}function Kr({children:e,required:t,labelFace:n}){return Be("span",{className:bn(n),children:[e,t?_e(Cn,{}):null]})}function zr({label:e,required:t,hint:n,separate:r,htmlFor:o,labelFace:i,className:a,children:l}){let c=a?`flex flex-col gap-2 ${a}`:"flex flex-col gap-2",u=n?_e("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?Be("div",{className:c,children:[Be("label",{htmlFor:o,className:bn(i),children:[e,t?_e(Cn,{}):null]}),l,u]}):Be("label",{htmlFor:o,className:c,children:[_e(Kr,{required:t,labelFace:i,children:e}),l]})}export{Ft as a,fo as b,po as c,mo as d,It as e,Ye as f,Vr as g,Xr as h,Yr as i,Qr as j,Rn as k,Nn as l,jr as m,Zr as n,Qe as o,Te as p,Y as q,Jr as r,eo as s,Oe as t,Fn as u,qt as v,bo as w,Co as x,Wt as y,xo as z,So as A,Je as B,vo as C,Eo as D,$n as E,Po as F,wo as G,Hn as H,_o as I,qn as J,Ro as K,No as L,ko as M,Gt as N,Mo as O,Do as P,Fo as Q,Ho as R,Bo as S,io as T,Dt as U,ao as V,Me as W,tt as X,ei as Y,nn as Z,hi as _,fr as $,bi as aa,qi as ba,cn as ca,Wi as da,vr as ea,Vi as fa,dn as ga,Xi as ha,Pr as ia,Yi as ja,_r as ka,xi as la,$i as ma,Hi as na,Rr as oa,ra as pa,oa as qa,kr as ra,la as sa,ca as ta,Dr as ua,Hr as va,Br as wa,Kr as xa,zr as ya};
|