efficient-storefront-blocks 0.101.0 → 0.109.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/CHANGELOG.md +146 -0
  2. package/dist/chunks/{EditorPreviewCheckout-JMBBJSI7.js → EditorPreviewCheckout-IVYEDVVN.js} +1 -1
  3. package/dist/chunks/{SiteEditorProvider-BKZW7KVN.js → SiteEditorProvider-KN5FKGBX.js} +1 -1
  4. package/dist/chunks/chunk-5VN7IA5L.js +1 -0
  5. package/dist/chunks/chunk-G5XZ736Y.js +339 -0
  6. package/dist/chunks/{chunk-YSKMBJ7V.js → chunk-UBOGEIFX.js} +1 -1
  7. package/dist/chunks/chunk-X3ERHC7Y.js +1 -0
  8. package/dist/chunks/{fitment-data-HMD5DDDB.js → fitment-data-Z3FDYFU6.js} +1 -1
  9. package/dist/editor/components/HeaderSettingsPanel.js +1 -1
  10. package/dist/editor/components/MenuPicker.js +1 -1
  11. package/dist/editor/lib/document/blocks/service/SignUp/fields.d.ts +2 -0
  12. package/dist/editor/lib/document/blocks/service/SignUp/fields.js +1 -0
  13. package/dist/editor/lib/document/blocks/service/index.d.ts +1 -1
  14. package/dist/editor/lib/document/blocks/service/index.js +1 -1
  15. package/dist/editor/lib/document/box-header.d.ts +3 -4
  16. package/dist/editor/lib/document/box-header.js +1 -1
  17. package/dist/editor/lib/document/config.js +1 -1
  18. package/dist/editor/lib/storefront-editor-words.d.ts +18 -0
  19. package/dist/editor/lib/storefront-editor-words.js +1 -1
  20. package/dist/index.js +30 -30
  21. package/dist/render/app/globals.css +428 -145
  22. package/dist/render/built-with.json +1 -1
  23. package/dist/render/components/CartContext.d.ts +1 -1
  24. package/dist/render/components/CartContext.js +1 -1
  25. package/dist/render/components/FooterGroup.js +1 -1
  26. package/dist/render/components/FooterLogo.js +1 -1
  27. package/dist/render/components/Header.js +1 -1
  28. package/dist/render/components/HeaderDropdownPanel.d.ts +21 -0
  29. package/dist/render/components/HeaderDropdownPanel.js +1 -0
  30. package/dist/render/components/HeaderNavItem.d.ts +5 -5
  31. package/dist/render/components/HeaderNavItem.js +1 -1
  32. package/dist/render/components/MenuLinkBlock.js +1 -1
  33. package/dist/render/components/ProductGridSection.js +1 -1
  34. package/dist/render/components/ProductHeroPanel.d.ts +1 -1
  35. package/dist/render/components/ProductHeroPanel.js +1 -1
  36. package/dist/render/components/SignUpFind.d.ts +25 -0
  37. package/dist/render/components/SignUpFind.js +1 -0
  38. package/dist/render/components/SignUpLink.d.ts +13 -0
  39. package/dist/render/components/SignUpLink.js +1 -0
  40. package/dist/render/components/SignUpSection.d.ts +47 -0
  41. package/dist/render/components/SignUpSection.js +1 -0
  42. package/dist/render/components/card-pieces/CardBuyButton.js +1 -1
  43. package/dist/render/components/card-pieces/CardQuantity.d.ts +1 -0
  44. package/dist/render/components/card-pieces/CardQuantity.js +1 -0
  45. package/dist/render/components/card-pieces/CardSave.d.ts +1 -0
  46. package/dist/render/components/card-pieces/CardSave.js +1 -0
  47. package/dist/render/components/card-pieces/CardStatedFacts.d.ts +1 -0
  48. package/dist/render/components/card-pieces/CardStatedFacts.js +1 -0
  49. package/dist/render/components/card-pieces/ProductCardState.d.ts +9 -0
  50. package/dist/render/components/wheels-plp/useVehicleCatalog.js +1 -1
  51. package/dist/render/lib/api/index.d.ts +31 -8
  52. package/dist/render/lib/api/index.js +1 -1
  53. package/dist/render/lib/api/types.d.ts +12 -0
  54. package/dist/render/lib/catalog/plp-vehicle-slice.d.ts +2 -2
  55. package/dist/render/lib/catalog/plp-vehicle-slice.js +1 -1
  56. package/dist/render/lib/document/blocks/service/ContactCards/meta.d.ts +1 -1
  57. package/dist/render/lib/document/blocks/service/SignUp/meta.d.ts +6 -0
  58. package/dist/render/lib/document/blocks/service/SignUp/meta.js +1 -0
  59. package/dist/render/lib/document/blocks/service/SignUp/render.d.ts +4 -0
  60. package/dist/render/lib/document/blocks/service/SignUp/render.js +1 -0
  61. package/dist/render/lib/document/blocks/service/metas.d.ts +1 -0
  62. package/dist/render/lib/document/blocks/service/metas.js +1 -1
  63. package/dist/render/lib/document/blocks/service/renders.d.ts +1 -0
  64. package/dist/render/lib/document/blocks/service/renders.js +1 -1
  65. package/dist/render/lib/document/blocks/text-part-shapes.json +34 -0
  66. package/dist/render/lib/document/lazy-draws.js +1 -1
  67. package/dist/render/lib/font-table.json +150 -0
  68. package/dist/render/lib/menu-link.d.ts +19 -2
  69. package/dist/render/lib/menu-link.js +1 -1
  70. package/dist/render/lib/next-fonts.js +1 -1
  71. package/dist/render/lib/sections/product-grid-pages.d.ts +1 -0
  72. package/dist/render/lib/sections/product-grid-pages.js +1 -1
  73. package/dist/render/lib/sections/sign-up-catalogue.d.ts +3 -0
  74. package/dist/render/lib/sections/sign-up-catalogue.js +1 -0
  75. package/dist/render/lib/sections/sign-up-look.d.ts +5 -0
  76. package/dist/render/lib/sections/sign-up-look.js +1 -0
  77. package/dist/render/lib/sections/sign-up.d.ts +205 -0
  78. package/dist/render/lib/sections/sign-up.js +1 -0
  79. package/dist/render/lib/wheels/plp-hydrate.d.ts +2 -1
  80. package/dist/render/lib/wheels/plp-hydrate.js +1 -1
  81. package/dist/render/lib/wheels/selected-ranges.d.ts +1 -0
  82. package/dist/render/lib/wheels/selected-ranges.js +1 -1
  83. package/dist/words.d.ts +20 -0
  84. package/dist/words.js +3 -3
  85. package/package.json +2 -2
  86. package/dist/chunks/chunk-AF5TRBQB.js +0 -1
  87. package/dist/chunks/chunk-GJZGQCDM.js +0 -1
  88. package/dist/chunks/chunk-KV3EHFHB.js +0 -339
  89. /package/dist/chunks/{chunk-KV3EHFHB.js.LEGAL.txt → chunk-G5XZ736Y.js.LEGAL.txt} +0 -0
  90. /package/dist/chunks/{chunk-XNUK2QNK.js → chunk-SUX7QH3R.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,151 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.109.0 - 2026-11-14
4
+
5
+ **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.
6
+
7
+ **For hosts:**
8
+ - **BREAKING (#555):** FooterLogo and ProductHeroPanel read `BLOCK_ALIGN_BOX_WORD`, which exists only from efficient-web-builder 68.2.0. On 68.0 or 68.1 FooterLogo throws on load. The storefront installs efficient-web-builder 68.2.0 in the same bump that takes this release.
9
+ - The storefront re-vendors `src/` with `node scripts/sync-storefront-blocks.mjs`, then runs `just check`. Its address stamp (`lib/wheels/shopper-address.ts`) can then import `pageReadsRangeNames` (#551).
10
+ - admin-portal: no step beyond the version (the embed entries bundle the builder).
11
+ - efficient-web-builder 69.0.0 is not inside this peer range (`^68.2.0`). A host takes 69.0.0 only after a blocks release that widens the peer.
12
+
13
+ ### Added
14
+
15
+ - **`pageReadsRangeNames(data)`** (#551, `lib/wheels/selected-ranges`): true for a page with a Filters block or a Box with a range row, at any depth. `pageReadsSelectedRanges` keeps its answer; both read one per-node rule (`readsRangeNames`).
16
+
17
+ ### Changed
18
+
19
+ - **FooterLogo and the Product Hero info column key the align table by the block word** (#555): through the builder's `BLOCK_ALIGN_BOX_WORD`, not box words typed in each block. Same classes, same bytes.
20
+
21
+ ### Internal
22
+
23
+ - Dev `efficient-web-builder ^68.2.0` (#553). The builder's `one-items-align-map` rule runs over this repository's `src/render/` and `src/editor/` (#554, `scripts/test-one-items-align-map.ts`).
24
+
25
+ ## 0.108.0 - 2026-11-14
26
+
27
+ **The first npm release since 0.101.0. A major for hosts (major version zero, so a minor number):** `HeroPriceTemplateProps.priceTemplate` is required (#529). It carries the 0.102.0 to 0.107.0 sections below (written in their own PRs, never published on their own) and the PRs in this section, which no section below names. From main at `dd7a2546`. No peer change: `efficient-web-builder ^68.0.0`, `efficient-shell ^13.0.0`, `efficient-easel ^34.3.0`.
28
+
29
+ **For hosts:**
30
+ - **BREAKING (#529):** `HeroPriceTemplateProps.priceTemplate` (`render/components/ProductHeroPanel`) is required: `SlotComponent | undefined`. A host that mounts `ProductHeroPanel`, `DynamicProductHero`, `LinkedProductHero`, `LinkedHeroLoaded` or `SampleHeroLoaded` itself passes it (the hero's price template, or `undefined` for no price line). efficient-storefront: `scripts/probe-phone-390.tsx` lines 180 and 216, `scripts/test-product-hero-heading.tsx` line 70, `scripts/test-product-page-obeys-product-types.tsx` lines 73 and 83 (`DynamicProductHero`) and `scripts/test-cart-catalog-gate.tsx` line 418 (`LinkedHeroLoaded`) pass it. The block render (ProductHero) passes it already, so no stored page and no route changes.
31
+ - Every step of the 0.102.0 to 0.107.0 sections below applies too: the header-settings panel fields and `openapi.yml` keys (0.102.0), `/api/business-sign-ups/*` forwarded to efficient-backend (0.104.0), `/sign-up/verify/<token>` served by the sign-up page (0.105.0), and the waiting-list POST with its empty 204 relayed (0.106.0).
32
+ - A host that vendors `src/` (the storefront) re-vendors with `node scripts/sync-storefront-blocks.mjs`, then runs `just check`.
33
+ - admin-portal: no step beyond the version.
34
+
35
+ ### Changed
36
+
37
+ - **The Product Hero's quantity, save and settled facts are card pieces** (#529): new modules `render/components/card-pieces/CardQuantity`, `CardSave` and `CardStatedFacts`, each drawn under the one hero state as the Buy button is; `HeroState` gains `qty`, `setQty`, `takesQty`, `save`, `facts`. The price line's no-template arm is deleted. Every hero draws the same bytes.
38
+ - **Footer and hero blocks take their item alignment from the builder's `BOX_ALIGN_CLASS`** (#533). An unknown stored align word now writes no class (before: the literal class `undefined`, which no CSS matched). Nothing on screen changes.
39
+ - **A Box's view looks turn at the phone edge, 800 px** (#545): seven host rule families in `src/render/app/globals.css` turned at 720 for a Box; a stored section between 720 and 800 keeps 720.
40
+
41
+ ### Fixed
42
+
43
+ - **The basket reads only its own wheels** (#541): the cart asked for the whole wheel catalogue (up to 50 requests) to draw basket thumbnails; it now reads each wheel in the basket by slug. `warmCatalog` takes an optional slug.
44
+ - **A capped product grid draws only its cap and spare cards** under a filter bar (#542); every count still reads the full filtered list.
45
+ - **Clearing the car on a tyre listing sends no request** (#543); it shows the catalogue the page was rendered with.
46
+
47
+ ### Internal
48
+
49
+ - Dev `efficient-web-builder ^68.1.0`; the grid guards read the builder's row-span exports (#535). Peer unchanged.
50
+ - The organisation's dependency update bot is on (#538); AGENTS.md detail moved to `doc/agents-reference.md` (#539).
51
+
52
+ ## 0.107.0 - 2026-11-14
53
+
54
+ **A minor for hosts:** no peer or path changes and nothing removed. The Sign-up Form gains its "Find my workspace" mode.
55
+
56
+ **For hosts:**
57
+ - A host that vendors `src/` (the storefront) re-vendors with `node scripts/sync-storefront-blocks.mjs`, then runs `just check`, and serves the site's `find` page at `/find/<token>` too: that is where the "Your workspaces" mail's links land, and the block reads the token from the address. The calls are under `/api/business-sign-ups/`, which the host already forwards.
58
+ - admin-portal: no step.
59
+ - No stored page moves: `mode` is a new setting whose default is the sign-up it always was.
60
+
61
+ - **"Find my workspace."** With "Shows" set to "Find my workspace", the Sign-up Form asks for a work email and the backend mails the address of every workspace it belongs to (efficient-backend `workspace-finds/`, #4812). The page then says the same thing for every address: "Check your email. If <address> belongs to a workspace, the links are on their way."
62
+ - **The mail's links.** On `/find/<token>` the block asks the backend where the link leads and sends the browser on to that workspace's own sign-in; nobody is signed in by it. A link older than 30 minutes, or altered, shows "This link is not right, or it has run out. Ask for your workspaces again." above the form. Only an `http(s)` address from the backend is followed.
63
+ - The form and its answer were approved by Victor Mau on 2026-11-13 (surface 1), the run-out screen on 2026-11-14.
64
+
65
+ ## 0.106.0 - 2026-11-14
66
+
67
+ **A minor for hosts:** no peer or path changes and nothing removed. The Sign-up Form's closed page takes an address for the waiting list.
68
+
69
+ **For hosts:**
70
+ - A host that vendors `src/` (the storefront) re-vendors with `node scripts/sync-storefront-blocks.mjs`, then runs `just check`. The call is `POST /api/business-sign-ups/waiting-list/` on the page's own site, under the path the host already forwards; a forwarder must relay its empty 204.
71
+ - admin-portal: no step.
72
+ - No stored page moves.
73
+
74
+ - **"Tell me when it opens."** Where a product's sign-up is closed, the Sign-up Form asks for a work email and leaves it on that product's waiting list (efficient-backend#4808): the address is mailed once, when the operator opens sign-up. The page then says "Thanks. We'll email <address> when sign-up opens.", the same whether or not the address was already waiting. Approved by Victor Mau on 2026-11-14 (the page as R2.1, the line after it the same day).
75
+ - If the server says the product's sign-up is open after all, the form is shown in place of the closed page.
76
+
77
+ ## 0.105.2 - 2026-11-14
78
+
79
+ **A patch for hosts:** no peer or path changes. The Workspace sign-up block is named "Sign-up Form" in the editor.
80
+
81
+ **For hosts:**
82
+ - A host that vendors `src/` (the storefront) re-vendors with `node scripts/sync-storefront-blocks.mjs`, then runs `just check`. No other step.
83
+
84
+ - **The block's name in the editor is "Sign-up Form".** The storefront's naming rule (its `doc/naming.md` N8.1) takes a node's last word from a fixed table, and "sign-up" is not in it, so 0.105.1 failed the storefront's `test-node-label-vocabulary`. Its type stays `SignUp`: no stored page moves, and nothing a visitor sees changes.
85
+
86
+ ## 0.105.1 - 2026-11-14
87
+
88
+ **A patch for hosts:** no peer or path changes. Two settings of the Workspace sign-up block show generic hints.
89
+
90
+ **For hosts:**
91
+ - A host that vendors `src/` (the storefront) re-vendors with `node scripts/sync-storefront-blocks.mjs`, then runs `just check`. No other step.
92
+
93
+ - **Workspace sign-up's "Product name" and "Workspace domain" settings hint with generic words**, not one product's name and domain. A setting's hint is copied into every platform template, and the storefront's template check refuses one that looks like a real domain, so 0.105.0 could not be vendored.
94
+
95
+ ## 0.105.0 - 2026-11-14
96
+
97
+ **A minor for hosts:** no peer or path changes and nothing removed. The Workspace sign-up block gains the page its mailed link opens.
98
+
99
+ **For hosts:**
100
+ - A host that vendors `src/` (the storefront) re-vendors with `node scripts/sync-storefront-blocks.mjs`, then runs `just check`, and serves its sign-up page at `/sign-up/verify/<token>` too: that is where efficient-backend's mailed link lands, and the block reads the token from the address.
101
+ - admin-portal: no step.
102
+ - No stored page moves.
103
+
104
+ - **The page a mailed sign-up link opens.** On `/sign-up/verify/<token>` the Workspace sign-up section uses the link (efficient-backend `POST /api/business-sign-ups/verifications/`) and shows "Setting up <company>" with its four steps, asking again until the build is done: a used link answers with what it made. Then "Your workspace is ready", with the workspace, its address and its plan, and "We've emailed you a link to set your password. It's the next step." The page hands out no link of its own (Victor Mau's choice of 2026-11-14).
105
+ - **What it shows when the link cannot be used**, each approved on 2026-11-14: a link that is not right or ran out ("Sign up again"), an address somebody else's link took first ("Choose another address"), a build that failed (nothing to do again), and the daily limit (the link still works tomorrow).
106
+ - A page left open asks at most 40 times, quickly at first and then slower, well under what the backend lets one address ask in an hour.
107
+
108
+ ## 0.104.0 - 2026-11-14
109
+
110
+ **A minor for hosts:** no peer or path changes and nothing removed. One new block, Workspace sign-up.
111
+
112
+ **For hosts:**
113
+ - A host that vendors `src/` (the storefront) re-vendors with `node scripts/sync-storefront-blocks.mjs`, then runs `just check`. The block asks its OWN site for `/api/business-sign-ups/*` (the backend's sign-up routes answer no cross-origin browser), so the host forwards that path to efficient-backend: the storefront adds a route for it, and the production edge sends the path to the backend.
114
+ - admin-portal: no step. The block is in no Add category yet: a page gets it from a build script.
115
+ - No stored page moves.
116
+
117
+ - **Workspace sign-up (`SignUp`)**: a product website's sign-up form, as Victor Mau approved it on 2026-11-13 and 2026-11-14. A stranger gives her name, work email, company name and the address she wants, and is mailed a link; nothing is made before she opens it (efficient-backend `/api/business-sign-ups/`, docs/adr/0041 and 0080). One block for every product: the product's key in the backend's registry, its name, its Free-plan line and the domain its workspaces are on are settings.
118
+ - The address follows the company name until she types her own, and is checked 400 ms after typing stops: "Checking", then "Available" or why not. "Ask for country and currency" adds the two selects a shop signs up with; choosing a country brings its usual currency.
119
+ - After sending: "Check your email", with when the link runs out in the reader's own zone, "Send it again" and "Change the details". A refusal is read by its stable code, never by the server's English: an address taken shows under the field, the daily limit and an unavailable sign-up show above the button, and a product whose sign-up is closed shows "Signing up is closed just now" in place of the form.
120
+ - Not in this release: the page the mailed link opens (setting up, ready), "Find my workspace" and the waiting list on the closed page.
121
+
122
+ ## 0.103.0 - 2026-11-14
123
+
124
+ **A minor for hosts:** no peer or path changes and nothing removed. Three families load heavier weights.
125
+
126
+ **For hosts:**
127
+ - A host that vendors `src/` (the storefront) re-vendors with `node scripts/sync-storefront-blocks.mjs`, then runs `just check`. No other step.
128
+ - admin-portal: no step.
129
+ - No stored page moves.
130
+
131
+ - **Manrope loads 600, 700 and 800, Archivo loads 800 and Fraunces loads 600**, beside the weights each already had (Manrope 200 to 500, Archivo 400 to 700, Fraunces 300 to 500). Each family's files are variable and already hold these weights, so no file is added: `render/lib/next-fonts.ts` names the weight for each subset, and for each style the family has. Wanted by the product marketing sites Victor Mau approved on 2026-11-13: hirewyn.com sets its headings in Manrope 800, hypermilestone.com in Archivo 800 and mailkampaign.com in Fraunces 600.
132
+ - **What a site already on one of these families sees:** text that asks for one of the new weights is now drawn with the family's own cut. Before, the browser took the heaviest weight loaded and thickened it itself (Manrope and Fraunces bold) or stopped at 700 (Archivo 800). Text at a weight that was already loaded does not change. A page still downloads only the files of the families its own theme names.
133
+
134
+ ## 0.102.0 - 2026-11-13
135
+
136
+ **A minor for hosts:** no peer or path changes and nothing removed. A header dropdown can open as a panel. The published types gain optional fields only.
137
+
138
+ **For hosts:**
139
+ - The panel needs the backend fields `dropdownItems[].description`, `dropdownItems[].image`, `dropdownItems[].badge` and `dropdownAside` on `GET /api/v1/header-settings` (admin side: `dropdown_items[].description/image/badge` and `dropdown_aside` on the header settings, `description`, `image`, `badge` on a menu item and `aside` on a menu). Without them (an older backend, or a menu that sets none) every dropdown is the plain list of links it was: same markup, same classes.
140
+ - A host that vendors `src/` (the storefront) re-vendors with `node scripts/sync-storefront-blocks.mjs`, then runs `just check`. In the same bump its `openapi.yml` adds the four keys to `HeaderSettings.menuItems`: `render/lib/api/types.ts` here is what `pnpm run generate-api-types` writes from that contract with them added, so its contract check fails until it has them.
141
+ - admin-portal: no step.
142
+ - No stored page moves. A Menu block's snapshot gains keys only for a dropdown that has panel fields; a plain dropdown stores a label and a link per entry, as before.
143
+
144
+ - **A header dropdown opens as a panel** when its menu has a side column, or when one of its links has a description or an image (`isMenuPanel` in `render/lib/menu-link`). On a computer the panel opens under the bar across the bar's content width: the links as a hairline grid (two across beside a side column, three without one), then the side column (eyebrow, title, text, links). In the phone menu it opens under its entry as one column, the side column after the links. A link's `image` is drawn in place of its label and carries the label as `alt`; `badge` is a small tag after it; `description` is one line under it; a link with no destination is text. New module `render/components/HeaderDropdownPanel`; new exports `isMenuPanel`, `menuDropdownItem`, `menuDropdownAside`, `MenuDropdownItem`, `MenuDropdownAside` (`render/lib/menu-link`) and `HeaderNavigationDropdownItem` (`render/components/HeaderNavItem`).
145
+ - **A panel stays open for 120 ms after the pointer leaves its menu item**, so a diagonal move to a far cell does not close it. A plain dropdown closes at once, as before.
146
+ - **A Box header and a one-row Menu draw the same panel on a computer.** `boxHeaderFromRow`, the Menu picker and the Header panel's menu pick keep `description`, `image`, `badge` and `dropdown_aside`. Not yet: the one-row Menu's phone panel lists a dropdown's links by label, without the panel fields or the side column.
147
+ - New optional fields on the API types: `AdminMenuItem.description/image/badge/dropdown_aside`, `AdminMenu.aside`, `AdminHeaderSettings.menu_items[].dropdown_aside`; new types `AdminMenuDropdownItem`, `AdminMenuAside`.
148
+
3
149
  ## 0.101.0 - 2026-11-13
4
150
 
5
151
  **A major for hosts (major version zero, so a minor number):** the peers move to `efficient-web-builder ^68.0.0` (was `^67.7.0`), `efficient-shell ^13.0.0` (was `^12.33.0`) and `efficient-easel ^34.3.0` (was `^34.1.0`) (#508). `wallSpanAt` takes the resolved wall (#508). `currentLinkIndex` takes a required third argument (#528). Four `COLLECTIONS_ROOM_*` constants (#524) and three listing-query names (#527) are deleted. From main at `40c4fcb9`: #508, #520, #523, #524, #525, #526, #527, #528, #530, #531.
@@ -1,4 +1,4 @@
1
- "use client";import{$ as Et,N as lr,O as ur,P as dr,Q as pr,R as mr,S as ye,U as dt,V as fr,W as gr,X as St,Y as yr,_ as Vt,b as ir,c as Jt,ca as hr,d as sr,da as br,e as cr,ia as vr,ja as Oe,la as xr,qa as kr,ra as Qe,ua as Xt,wa as oe,y as Nt}from"./chunk-GJZGQCDM.js";import{B as W,o as de,u as Ze}from"./chunk-AF5TRBQB.js";import{ei as rr,gi as ge,ki as ar}from"./chunk-YSKMBJ7V.js";import{n as or,o as ut,p as ue}from"./chunk-XNUK2QNK.js";import{a as Gt,b as ho}from"./chunk-Y6SLVHK3.js";var Pr=Gt((Oi,wr)=>{"use strict";var vo="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";wr.exports=vo});var Rr=Gt((Ai,Er)=>{"use strict";var xo=Pr();function Nr(){}function Sr(){}Sr.resetWarningCache=Nr;Er.exports=function(){function e(r,o,s,l,f,g){if(g!==xo){var d=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 d.name="Invariant Violation",d}}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:Sr,resetWarningCache:Nr};return n.PropTypes=n,n}});var Ar=Gt((Li,Or)=>{"use strict";Or.exports=Rr()();var Ii,Ti});import{useEffect as ja,useMemo as Fa,useRef as nt,useState as $e}from"react";import{rootIsDark as bo}from"efficient-shell/format";function Cr(){if(typeof document>"u")return;let e=getComputedStyle(document.documentElement),t=(r,o)=>e.getPropertyValue(r).trim()||o,n=bo({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 _=ho(Ar(),1);import T from"react";function Ir(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 ko(e){if(Array.isArray(e))return e}function qr(e,t,n){return(t=Eo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Co(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,s,l,f=[],g=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(g=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);g=!0);}catch(y){d=!0,o=y}finally{try{if(!g&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw o}}return f}}function wo(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ "use client";import{$ as Et,N as lr,O as ur,P as dr,Q as pr,R as mr,S as ye,U as dt,V as fr,W as gr,X as St,Y as yr,_ as Vt,b as ir,c as Jt,ca as hr,d as sr,da as br,e as cr,ia as vr,ja as Oe,la as xr,qa as kr,ra as Qe,ua as Xt,wa as oe,y as Nt}from"./chunk-5VN7IA5L.js";import{P as de,V as Ze,aa as W}from"./chunk-X3ERHC7Y.js";import{ei as rr,gi as ge,ki as ar}from"./chunk-UBOGEIFX.js";import{n as or,o as ut,p as ue}from"./chunk-SUX7QH3R.js";import{a as Gt,b as ho}from"./chunk-Y6SLVHK3.js";var Pr=Gt((Oi,wr)=>{"use strict";var vo="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";wr.exports=vo});var Rr=Gt((Ai,Er)=>{"use strict";var xo=Pr();function Nr(){}function Sr(){}Sr.resetWarningCache=Nr;Er.exports=function(){function e(r,o,s,l,f,g){if(g!==xo){var d=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 d.name="Invariant Violation",d}}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:Sr,resetWarningCache:Nr};return n.PropTypes=n,n}});var Ar=Gt((Li,Or)=>{"use strict";Or.exports=Rr()();var Ii,Ti});import{useEffect as ja,useMemo as Fa,useRef as nt,useState as $e}from"react";import{rootIsDark as bo}from"efficient-shell/format";function Cr(){if(typeof document>"u")return;let e=getComputedStyle(document.documentElement),t=(r,o)=>e.getPropertyValue(r).trim()||o,n=bo({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 _=ho(Ar(),1);import T from"react";function Ir(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 ko(e){if(Array.isArray(e))return e}function qr(e,t,n){return(t=Eo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Co(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,s,l,f=[],g=!0,d=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(g=(r=s.call(n)).done)&&(f.push(r.value),f.length!==t);g=!0);}catch(y){d=!0,o=y}finally{try{if(!g&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(d)throw o}}return f}}function wo(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Lr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Tr(Object(n),!0).forEach(function(r){qr(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tr(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Po(e,t){if(e==null)return{};var n,r,o=No(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function No(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 Mr(e,t){return ko(e)||Co(e,t)||Ro(e,t)||wo()}function So(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 Eo(e){var t=So(e,"string");return typeof t=="symbol"?t:t+""}function Zt(e){"@babel/helpers - typeof";return Zt=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},Zt(e)}function Ro(e,t){if(e){if(typeof e=="string")return Ir(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)?Ir(e,t):void 0}}var G=function(t,n,r){var o=!!r,s=T.useRef(r);T.useEffect(function(){s.current=r},[r]),T.useEffect(function(){if(!o||!t)return function(){};var l=function(){if(s.current)return s.current.apply(s,arguments)};return t.on(n,l),function(){t.off(n,l)}},[o,n,t,s])},Qt=function(t){var n=T.useRef(t);return T.useEffect(function(){n.current=t},[t]),n.current},et=function(t){return t!==null&&Zt(t)==="object"},Oo=function(t){return et(t)&&typeof t.then=="function"},Ao=function(t){return et(t)&&typeof t.elements=="function"&&typeof t.createToken=="function"&&typeof t.createPaymentMethod=="function"&&typeof t.confirmCardPayment=="function"},_r="[object Object]",Io=function e(t,n){if(t===n)return!0;if(!et(t)||!et(n))return t===n;var r=Array.isArray(t),o=Array.isArray(n);if(r!==o)return!1;var s=Object.prototype.toString.call(t)===_r,l=Object.prototype.toString.call(n)===_r;if(s!==l)return!1;if(!s&&!r)return t===n;var f=Object.keys(t),g=Object.keys(n);if(f.length!==g.length)return!1;for(var d={},y=0;y<f.length;y+=1)d[f[y]]=!0;for(var N=0;N<g.length;N+=1)d[g[N]]=!0;var b=Object.keys(d);if(b.length!==f.length)return!1;var m=t,v=n,E=function(Z){return e(m[Z],v[Z])};return b.every(E)},Dr=function(t,n,r){return et(t)?Object.keys(t).reduce(function(o,s){var l=!et(n)||!Io(t[s],n[s]);return r.includes(s)?(l&&console.warn("Unsupported prop change: options.".concat(s," is not a mutable property.")),o):l?Lr(Lr({},o||{}),{},qr({},s,t[s])):o},null):null},jr="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.",Fr=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jr;if(t===null||Ao(t))return t;throw new Error(n)},To=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jr;if(Oo(t))return{tag:"async",stripePromise:Promise.resolve(t).then(function(o){return Fr(o,n)})};var r=Fr(t,n);return r===null?{tag:"empty"}:{tag:"sync",stripe:r}},Lo=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"}))},Rt=T.createContext(null);Rt.displayName="ElementsContext";var Kr=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},tn=function(t){var n=t.stripe,r=t.options,o=t.children,s=T.useMemo(function(){return To(n)},[n]),l=T.useState(function(){return{stripe:s.tag==="sync"?s.stripe:null,elements:s.tag==="sync"?s.stripe.elements(r):null}}),f=Mr(l,2),g=f[0],d=f[1];T.useEffect(function(){var b=!0,m=function(E){d(function(A){return A.stripe?A:{stripe:E,elements:E.elements(r)}})};return s.tag==="async"&&!g.stripe?s.stripePromise.then(function(v){v&&b&&m(v)}):s.tag==="sync"&&!g.stripe&&m(s.stripe),function(){b=!1}},[s,g,r]);var y=Qt(n);T.useEffect(function(){y!==null&&y!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[y,n]);var N=Qt(r);return T.useEffect(function(){if(g.elements){var b=Dr(r,N,["clientSecret","fonts"]);b&&g.elements.update(b)}},[r,N,g.elements]),T.useEffect(function(){Lo(g.stripe)},[g.stripe]),T.createElement(Rt.Provider,{value:g},o)};tn.propTypes={stripe:_.default.any,options:_.default.object};var Ur=function(t){var n=T.useContext(Rt);return Kr(n,t)},Wr=function(){var t=Ur("calls useElements()"),n=t.elements;return n},_o=function(t){var n=t.children,r=Ur("mounts <ElementsConsumer>");return n(r)};_o.propTypes={children:_.default.func.isRequired};var Fo=T.createContext(null);Fo.displayName="CheckoutContext";var $r=T.createContext(null);$r.displayName="CheckoutSdkContext";var en=function(t){var n=T.useContext($r),r=T.useContext(Rt);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 Kr(r,t)},qo=["mode"],Mo=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},F=function(t,n,r){var o="".concat(Mo(t),"Element"),s=function(d){var y=d.id,N=d.className,b=d.options,m=b===void 0?{}:b,v=d.onBlur,E=d.onFocus,A=d.onReady,Z=d.onChange,O=d.onEscape,C=d.onClick,Y=d.onLoadError,Q=d.onLoaderStart,M=d.onNetworksChange,ie=d.onConfirm,he=d.onCancel,Le=d.onShippingAddressChange,me=d.onShippingRateChange,z=d.onSavedPaymentMethodRemove,le=d.onSavedPaymentMethodUpdate,I=d.onAvailablePaymentMethodsChange,H=en("mounts <".concat(o,">")),$="elements"in H?H.elements:null,k="checkoutSdk"in H?H.checkoutSdk:null,rt=T.useState(null),Ye=Mr(rt,2),K=Ye[0],Be=Ye[1],ee=T.useRef(null),_e=T.useRef(null);G(K,"blur",v),G(K,"focus",E),G(K,"escape",O),G(K,"click",C),G(K,"loaderror",Y),G(K,"loaderstart",Q),G(K,"networkschange",M),G(K,"confirm",ie),G(K,"cancel",he),G(K,"shippingaddresschange",Le),G(K,"shippingratechange",me),G(K,"savedpaymentmethodremove",z),G(K,"savedpaymentmethodupdate",le),G(K,"availablepaymentmethodschange",I),G(K,"change",Z);var Pe;A&&(t==="expressCheckout"?Pe=A:Pe=function(){A(K)}),G(K,"ready",Pe),T.useLayoutEffect(function(){if(ee.current===null&&_e.current!==null&&($||k)){var L=null;if(k){var V=k,ze=k;switch(t){case"paymentForm":L=ze.createForm(m);break;case"payment":L=V.createPaymentElement(m);break;case"address":if("mode"in m){var Ne=m.mode,Fe=Po(m,qo);if(Ne==="shipping")L=V.createShippingAddressElement(Fe);else if(Ne==="billing")L=V.createBillingAddressElement(Fe);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=V.createExpressCheckoutElement(m);break;case"currencySelector":L=k.createCurrencySelectorElement();break;case"taxId":L=V.createTaxIdElement(m);break;case"contactDetails":L=V.createContactDetailsElement();break;case"linkSignup":if("createLinkSignupElement"in k)L=k.createLinkSignupElement(m);else throw new Error("<LinkSignupElement> requires <CheckoutElementsProvider> and is not supported inside <CheckoutFormProvider>.");break;case"terms":L=V.createTermsElement(m);break;default:throw new Error("<".concat(o,"> is not supported inside a checkout provider. Use an <Elements> provider instead."))}}else $&&(L=$.create(t,m));ee.current=L,Be(L),L&&L.mount(_e.current)}},[$,k,m]);var be=Qt(m);return T.useEffect(function(){if(ee.current){var L=Dr(m,be,["paymentRequest"]);L&&"update"in ee.current&&ee.current.update(L)}},[m,be]),T.useLayoutEffect(function(){return function(){if(ee.current&&typeof ee.current.destroy=="function")try{ee.current.destroy(),ee.current=null}catch{}}},[]),T.createElement("div",{id:y,className:N,ref:_e})},l=function(d){en("mounts <".concat(o,">"));var y=d.id,N=d.className;return T.createElement("div",{id:y,className:N})},f=n?l:s;return f.propTypes={id:_.default.string,className:_.default.string,onChange:_.default.func,onBlur:_.default.func,onFocus:_.default.func,onReady:_.default.func,onEscape:_.default.func,onClick:_.default.func,onLoadError:_.default.func,onLoaderStart:_.default.func,onNetworksChange:_.default.func,onConfirm:_.default.func,onCancel:_.default.func,onShippingAddressChange:_.default.func,onShippingRateChange:_.default.func,onSavedPaymentMethodRemove:_.default.func,onSavedPaymentMethodUpdate:_.default.func,onAvailablePaymentMethodsChange:_.default.func,options:_.default.object},f.displayName=o,f.__elementType=t,f},q=typeof window>"u",Do=T.createContext(null);Do.displayName="EmbeddedCheckoutProviderContext";var Yr=function(){var t=en("calls useStripe()"),n=t.stripe;return n},Fi=F("auBankAccount",q),qi=F("card",q),Mi=F("cardNumber",q),Di=F("cardExpiry",q),ji=F("cardCvc",q),Ki=F("currencySelector",q),Ui=F("iban",q),Br=F("payment",q),Wi=F("expressCheckout",q),$i=F("paymentRequestButton",q),Yi=F("linkAuthentication",q),Bi=F("linkSignup",q),zi=F("contactDetails",q),Hi=F("address",q),Gi=F("shippingAddress",q),Ji=F("paymentMethodMessaging",q),Vi=F("taxId",q),Xi=F("issuingCardNumberDisplay",q),Zi=F("issuingCardCvcDisplay",q),Qi=F("issuingCardExpiryDisplay",q),es=F("issuingCardPinDisplay",q),ts=F("issuingCardCopyButton",q),ns=F("terms",q);function It(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?It=function(t){return typeof t}:It=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},It(e)}var Gr="dahlia",jo=function(t){return t===3?"v3":t},Jr="https://js.stripe.com",Ko="".concat(Jr,"/").concat(Gr,"/stripe.js"),Uo=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Wo=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,zr="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",$o=function(t){return Uo.test(t)||Wo.test(t)},Yo=function(){for(var t=document.querySelectorAll('script[src^="'.concat(Jr,'"]')),n=0;n<t.length;n++){var r=t[n];if($o(r.src))return r}return null},Hr=function(t){var n=t&&!t.advancedFraudSignals?"?advancedFraudSignals=false":"",r=document.createElement("script");r.src="".concat(Ko).concat(n);var o=document.head||document.body;if(!o)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return o.appendChild(r),r},Bo=function(t,n){!t||!t._registerWrapper||t._registerWrapper({name:"stripe-js",version:"9.17.0",startTime:n})},pt=null,Ot=null,At=null,zo=function(t){return function(n){t(new Error("Failed to load Stripe.js",{cause:n}))}},Ho=function(t,n){return function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))}},Go=function(t){return pt!==null?pt:(pt=new Promise(function(n,r){if(typeof window>"u"||typeof document>"u"){n(null);return}if(window.Stripe&&t&&console.warn(zr),window.Stripe){n(window.Stripe);return}try{var o=Yo();if(o&&t)console.warn(zr);else if(!o)o=Hr(t);else if(o&&At!==null&&Ot!==null){var s;o.removeEventListener("load",At),o.removeEventListener("error",Ot),(s=o.parentNode)===null||s===void 0||s.removeChild(o),o=Hr(t)}At=Ho(n,r),Ot=zo(r),o.addEventListener("load",At),o.addEventListener("error",Ot)}catch(l){r(l);return}}),pt.catch(function(n){return pt=null,Promise.reject(n)}))},Jo=function(t,n,r){if(t===null)return null;var o=n[0];if(typeof o!="string")throw new Error("Expected publishable key to be of type string, got type ".concat(It(o)," instead."));var s=o.match(/^pk_test/),l=jo(t.version),f=Gr;s&&l!==f&&console.warn("Stripe.js@".concat(l," was loaded on the page, but @stripe/stripe-js@").concat("9.17.0"," expected Stripe.js@").concat(f,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var g=t.apply(void 0,n);return Bo(g,r),g},mt,Vr=!1,Xr=function(){return mt||(mt=Go(null).catch(function(t){return mt=null,Promise.reject(t)}),mt)};Promise.resolve().then(function(){return Xr()}).catch(function(e){Vr||console.warn(e)});var Tt=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];Vr=!0;var o=Date.now();return Xr().then(function(s){return Jo(s,n,o)})};var nn=2;function Zr(e){return e==="card"}var Vo="checkout_unavailable",Xo="checkout_waiting",Qr="committed",Ae="We could not check your payment. Please try again.",rn="Your last change was not saved. This is your order as placed.",ea="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.",ta=1e4;async function na(e,t=ta){let n,r=new Promise(s=>{n=setTimeout(()=>s(void 0),t)}),o=(async()=>{try{return(await(await Tt(e.publishableKey))?.retrievePaymentIntent(e.clientSecret))?.paymentIntent?.status}catch{return}})();try{return await Promise.race([o,r])}finally{clearTimeout(n)}}var ra=new Set(["none","requires_payment_method","canceled"]);async function an(e,t=ta){let n,r=new Promise(o=>{n=setTimeout(()=>o(void 0),t)});try{return await Promise.race([W.releaseCheckout({idempotencyKey:e}).then(o=>o.status,()=>{}),r])}finally{clearTimeout(n)}}function aa(e,t){return e instanceof de&&typeof e.data=="object"&&e.data!==null&&e.data.code===t}function Lt(e){return aa(e,Vo)}function on(e){return aa(e,Xo)}function sn(e){return e instanceof de&&e.status>=400&&e.status<500&&e.status!==408}function oa(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 _t(e){return e.orderNumber||e.checkoutNumber}function Zo(e){return e.orderNumber?{kind:"placed",order:e}:{kind:e.status==="released"?"refunded":e.status==="expired"?"expired":"pending",checkoutNumber:e.checkoutNumber}}async function ia({checkoutNumber:e,resend:t,page:n}){n.setConfirming(!0);let r;try{r=Zo(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 ci,useContext as li,useEffect as X,useMemo as ba,useRef as J,useState as w}from"react";var Qo="sf:gclid",ei="sf:fbclid",ti=2160*60*60*1e3;function la(){return typeof window<"u"}function sa(e){let t=ut.getItem(e);if(!t)return"";try{let{v:n,t:r}=JSON.parse(t);return!n||typeof r!="number"||Date.now()-r>ti?"":n}catch{return""}}function ca(e){if(!la())return"";let t=e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1"),n=document.cookie.match(new RegExp(`(?:^|; )${t}=([^;]*)`));return n?decodeURIComponent(n[1]):""}function ua(){if(!la())return{};let e=sa(Qo),t=sa(ei),n=ca("_fbp"),r=ca("_fbc");!r&&t&&(r=`fb.1.${Date.now()}.${t}`);let o={};return e&&(o.gclid=e),t&&(o.fbclid=t),n&&(o.fbp=n),r&&(o.fbc=r),o}var da="sf:meta-purchases",ni=20;function ma(){return typeof window>"u"||window.parent!==window}function ri(...e){try{if(ma()||typeof window.fbq!="function")return;window.fbq(...e)}catch{}}var pa=new Set;function ai(e){if(pa.has(e))return!1;pa.add(e);try{let t=JSON.parse(ut.getItem(da)??"[]");if(t.includes(e))return!1;ut.setItem(da,JSON.stringify([...t,e].slice(-ni)))}catch{}return!0}function oi(e){return[...new Set(e.filter(dt).flatMap(t=>t.components.map(n=>n.partNumber)))]}function fa(e){let t=e.confirmation;ma()||!ai(t.orderNumber)||ri("track","Purchase",{value:Number(t.grandTotal),currency:t.currency,content_type:"product",content_ids:oi(e.lines)},{eventID:t.orderNumber})}var cn="checkout-afterpay-context",Ft="checkout-gocardless-context",ln="checkout-zip-context",qt="checkout-klarna-context";function ii({evidence:e,parked:t}){return e?{action:"capture",evidence:e,parked:t}:t?{action:"settle",parked:t}:{action:"ignore"}}function si(e,t){let n=e.getItem(t);if(e.removeItem(t),!n)return null;try{return JSON.parse(n)}catch{return null}}var ga={name:"Afterpay",legParam:"afterpay",legValues:["confirm","cancel"],storageKey:cn,evidenceFrom(e,t){return t==="cancel"||(e.get("status")??"").toUpperCase()==="CANCELLED"?null:e.get("orderToken")},requestFrom:e=>({token:e})},ya={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 un(e,t){let n=new URLSearchParams(t.search),r=n.get(e.legParam);if(!r||!e.legValues.includes(r))return;let o=si(t.storage,e.storageKey),s=e.evidenceFrom(n,r);t.scrubQuery();let l=ii({evidence:s,parked:o});if(l.action!=="ignore"){if(t.page.clearCart(),l.action==="settle"){t.page.note(`The ${e.name} payment was not completed \u2014 our team will follow up on payment.`),t.page.land(l.parked.confirmation);return}t.page.setConfirming(!0);try{let f=await t.capture(e.requestFrom(l.evidence));f.status==="paid"?t.page.markPaid():t.page.note(`${e.name} declined the payment \u2014 our team will follow up on payment.`),t.page.land(l.parked?.confirmation??f)}catch{l.parked?(t.page.note(`We could not confirm the ${e.name} payment \u2014 our team will follow up on payment.`),t.page.land(l.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 ha(e,t,n){let r=(t??"").trim();if(!r)return"";if(n.length===0)return r;let o=r.toUpperCase(),s=`${e.toUpperCase()}-${o}`,l=n.find(f=>f.code&&f.code.toUpperCase()===o)??n.find(f=>f.code&&f.code.toUpperCase()===s)??n.find(f=>f.name.toUpperCase()===o);return l?l.code||l.name:""}import{jsx as we}from"react/jsx-runtime";function va(e){let t=e.indexOf(`
3
3
  `);return t===-1?[e,""]:[e.slice(0,t),e.slice(t+1)]}function xa(e,{canParkContext:t}={canParkContext:!0}){let n=e.paymentMethods,r=[];return n.includes("card")&&r.push({key:"card",title:"Card",body:null,price:we("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:we("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:we("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:we("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:we("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:we("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:we("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:we("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Invoiced"})}),r}var wa="This shop does not take payment online yet. Please contact the shop to order.",tt=class extends Error{};function ka(e,t){if(!e.orderNumber&&Lt(t))return t.message;let n=t instanceof de?` (${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 Ca=new Set(["paypal","square","afterpay","gocardless","zip","klarna"]),Ue=e=>JSON.parse(e),Pa="Shipping cannot be calculated right now. Please try again.";function Na(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 ui({site:e,logo:t,preview:n=!1}){let{items:r,totals:o,coupon:s,refuseCoupon:l,deliveryOptions:f,shippingMethodId:g,setShippingMethodId:d,setQuoteDestination:y,courier:N,requote:b,identify:m,clearCapturedCart:v,replaceItems:E,removeCoupon:A}=St(),Z=f.find(a=>a.id===g)?.pickupLocation??null,{country:O,countries:C,activeCountry:Y,formatMoney:Q}=ye(),[M,ie]=w(()=>xa(e)[0]?.key??null),[he,Le]=w(!0);X(()=>{Le(or(ue))},[]);let[me,z]=w(!1),[le,I]=w(""),[H,$]=w(""),[k,rt]=w(""),[Ye,K]=w(""),[Be,ee]=w(""),[_e,Pe]=w(""),[be,L]=w(""),[V,ze]=w(""),[Ne,Fe]=w(""),[j,ft]=w(()=>O||C[0]?.code||""),[Se,gt]=w(""),[at,yn]=w([]),[Kt,Ut]=w(null),[yt,ot]=w(null),hn=ba(()=>C.find(a=>a.code===j)??Y,[C,j,Y]),Ka=hn?.postalLabel||"Postal Code",Ua=at[0]?.divisionType||"State / Province";X(()=>{if(!j){yn([]),Ut(j);return}Ut(null);let a=!1;return W.listCountrySubdivisions(j).then(u=>{a||(yn(u),Ut(j),gt(""))}),()=>{a=!0}},[j]);let bn=Be.trim()!==""&&be.trim()!==""&&V.trim()!==""&&Kt===j&&(at.length===0||Se!=="")?V.trim():"";X(()=>{y(j?{country:j,subdivision:Se,postcode:bn}:null)},[j,Se,bn,y]),X(()=>()=>y(null),[y]);let Wa=N?.status==="unavailable",$a=b,[ht,vn]=w(null),[Ya,xn]=w([]),[kn,Wt]=w("new"),[Cn,wn]=w(!1),[$t,Ba]=w("Home"),[za,Pn]=w(null),[Ha,Nn]=w(null),[it,bt]=w(()=>Qe()),Sn=J(null),[En,fe]=w(null),[Ga,se]=w(null),[Rn,vt]=w(null),[On,Ja]=w(!1),[An,Va]=w(!1),[Ee,He]=w(null),[Xa,Ge]=w(!1),[ne,ve]=w(null),Za=!!ne?.orderNumber,[Qa,xe]=w(null),[eo,to]=w(!1),[no,In]=w(!1),[ro,ao]=w(!1),[oo,Tn]=w(!1),[Ln,io]=w(!1),[so,Yt]=w(!1),[Bt,_n]=w(null),qe=J(null),st=J(r),Me=J(null),Je=J(null),Fn=!!(En||Bt&&Bt.kind!=="processing"||Ln||On||An||Rn&&Ee?.orderNumber);X(()=>{Fn&&(E([]),A())},[Fn,E,A]);let qn=J(!1);X(()=>{n||qn.current||!r.some(dt)||(qn.current=!0,lr({lines:r,currency:o.currency,value:o.subtotal-o.discount,coupon:s?.valid?s.code:void 0}))},[r,o,s,n]),X(()=>{m(le,H.trim()||void 0)},[le,H,m]);let Mn=J(null),[xt,co]=w(null);X(()=>{let a=Mn.current;if(!xt||!a)return;let u=()=>a.style.setProperty("--sf-checkout-header-h",`${xt.offsetHeight}px`);u();let p=new ResizeObserver(u);return p.observe(xt),()=>p.disconnect()},[xt]),X(()=>{let a=p=>({setConfirming:p,land:fe,markPaid:()=>Ge(!0),note:xe,fail:se,clearCart:v}),u={search:window.location.search,storage:ue,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};un(ga,{...u,capture:W.captureAfterpayPayment,page:a(to)}),un(ya,{...u,capture:W.captureZipPayment,page:a(ao)})},[]),X(()=>{let u=new URLSearchParams(window.location.search).get("gocardless");if(u!=="confirm"&&u!=="cancel")return;let p=ue.getItem(Ft);if(ue.removeItem(Ft),window.history.replaceState(null,"",window.location.pathname),!p)return;let S;try{S=JSON.parse(p)}catch{return}if(v(),u==="cancel"){xe("The direct debit was not set up \u2014 our team will follow up on payment."),fe(S.confirmation);return}In(!0),W.completeGocardlessPayment({idempotencyKey:S.idempotencyKey}).then(h=>{h.status==="paid"?Ge(!0):h.status==="declined"?xe("The direct debit was declined \u2014 our team will follow up on payment."):xe("Your direct debit is set up \u2014 the payment is collecting and will clear in a few days.")}).catch(()=>{xe("We could not confirm the direct debit \u2014 our team will follow up on payment.")}).finally(()=>{fe(S.confirmation),In(!1)})},[]),X(()=>{let a=new URLSearchParams(window.location.search),u=a.get("klarna");if(u!=="confirm"&&u!=="cancel")return;let p=ue.getItem(qt);ue.removeItem(qt);let S=a.get("authorization_token");if(window.history.replaceState(null,"",window.location.pathname),!p)return;let h;try{h=JSON.parse(p)}catch{return}if(v(),u==="cancel"||!S){xe("The Klarna payment was not completed \u2014 our team will follow up on payment."),fe(h.confirmation);return}Tn(!0),W.captureKlarnaPayment({idempotencyKey:h.idempotencyKey,authorizationToken:S}).then(D=>{D.status==="paid"?Ge(!0):D.status==="declined"?xe("Klarna declined the payment \u2014 our team will follow up on payment."):xe("Your Klarna payment is being reviewed \u2014 we'll confirm the outcome shortly.")}).catch(()=>{xe("We could not confirm the Klarna payment \u2014 our team will follow up on payment.")}).finally(()=>{fe(h.confirmation),Tn(!1)})},[]);function Dn(a){let[u,p]=va(a.address);ee(u),Pe(p),L(a.city),ze(a.zip_code),a.country&&ft(a.country),a.phone&&Fe(a.phone),ot({country:a.country||null,state:a.state??""})}X(()=>{if(yt){if((yt.country||j)!==j){ot(null);return}Kt===j&&(gt(ha(j,yt.state,at)),ot(null))}},[yt,j,Kt,at]),X(()=>{let a=!1;return(async()=>{try{let[u,p,S]=await Promise.all([Ze.me(),Ze.myProfile().catch(()=>null),Ze.myAddresses().catch(()=>[])]);if(a)return;vn(u);let h=S.filter(U=>U.is_active);xn(h),I(u.email);let D=(p?.contact_name??"").split(/\s+/);$(u.first_name||D[0]||""),rt(u.last_name||D.slice(1).join(" "));let R=u.phone||p?.phone;R&&Fe(R);let re=h.find(U=>U.id===u.default_delivery_location)??h[0];if(re)Wt(re.id),Dn(re);else if(p){let[U,ae]=va(p.address??"");ee(U),Pe(ae),L(p.city??""),ze(p.zip_code??""),p.country&&ft(p.country),ot({country:p.country||null,state:p.state??""})}}catch{}})(),()=>{a=!0}},[]);function lo(){Ze.logout(),vn(null),xn([]),Wt("new"),wn(!1),I(""),$(""),rt(""),K(""),ee(""),Pe(""),L(""),ze(""),Fe(""),ft(O||C[0]?.code||""),gt(""),ot(null)}let Ve=ba(()=>xa(e,{canParkContext:he}),[e,he]);X(()=>{Ve.some(a=>a.key===M)||ie(Ve[0]?.key??null)},[Ve,M]);let uo=Ve.length===0,kt=_e.trim()?`${Be}
4
4
  ${_e.trim()}`:Be,po=oa({email:le,firstName:H,lastName:k,company:Ye.trim(),phone:Ne,address:kt,city:be,subdivision:Se,postcode:V,country:j,lines:r.map(a=>[a.id,a.qty]),shippingMethodId:g,couponCode:Jt(s),currency:o.currency,shopperId:ht?.id??null}),te=JSON.stringify([po,M]),Re=J(null),zt=J(null),Ct=J(!1),ke=J(!1),Xe=J(null),wt=J(!1),ce=J(te);ce.current=te;let jn=J(me);jn.current=me;let Kn=()=>ke.current&&ce.current!==Re.current,De=J(null);X(()=>{jn.current||(te!==De.current&&(De.current=null),!(!ke.current||!ne||ne.orderNumber)&&(te===Re.current||te===De.current||Pt(ne)))},[te,ne]);async function Pt(a){if(wt.current)return null;wt.current=!0,z(!0);try{let u=Xe.current?await na(Xe.current):"none";if(u==="succeeded"||u==="processing")return ke.current=!1,ve(null),Ce("card"),u==="succeeded"?await je(void 0,a):Jn(a),null;if(u===void 0||!ra.has(u))return De.current=ce.current,ve(a),se(u==="requires_action"?ea:Ae),null;let p=await an(it);if(p==="committed")return ke.current=!1,ve(null),Ce("card"),await je(void 0,a),null;if(p!=="released")return De.current=ce.current,ve(a),se(Ae),null;ke.current=!1,Xe.current=null,De.current=null,se(null),ve(null);let S=Qe();return bt(S),S}finally{wt.current=!1,z(!1)}}async function mo(){if(!(n||me||wt.current)){if(ne){if((ke.current?te!==Re.current:ct())&&!ne.orderNumber){let S=await Pt(ne);S&&ce.current===te&&await Un(S);return}z(!0),se(null),Ct.current=!1,await Ht();let u=Ue(ce.current)[1],p=ne.orderNumber?u:"card";if(p&&Ca.has(p)&&ct()&&Ue(ce.current)[0]!==zt.current){Wn(ne);return}Ce(p),p!==M&&ie(p),await Vn(ne,p,!ne.orderNumber);return}await Un(it)}}async function Un(a){if(r.length===0||o.repricing||!M||!Ve.some(R=>R.key===M))return;let u=r.filter(dt).flatMap(R=>cr(R.components,R.qty));if(u.length===0){se("Pick a size on each wheel's product page before checking out.");return}z(!0),se(null);let p,S=a,h=M,D=!1;try{let R=ht?W.createOrderAuthed:W.createOrder,re=kr(),U={customer:{email:le,name:`${H} ${k}`.trim(),phone:Ne.trim()||void 0,companyName:Ye.trim()||void 0,address:kt,city:be,state:Se||void 0,zipCode:V,country:j},items:u,currency:o.currency,idempotencyKey:a,shippingMethodId:g??void 0,couponCode:Jt(s),...re==="denied"?{}:ua(),...re?{adConsent:re}:{},...Zr(M)?{checkoutFlow:nn}:{}};qe.current=()=>R(U),Nn(null),zt.current=null,Ct.current=!1,Xe.current=null,ke.current=!1,De.current=null,Re.current=te,st.current=r;let ae=Me.current,Qn=ae?.key===U.idempotencyKey&&(ae.shape!==te&&(!!U.checkoutFlow||!!ae.method||!!ae.plainMethod)||!!U.checkoutFlow&&!!ae.plainMethod);Qn&&(Je.current=U.idempotencyKey);let er=zn(U,R),tr=Qn||!U.checkoutFlow&&Je.current===U.idempotencyKey,nr=!er&&!tr&&!U.checkoutFlow&&!!ae&&!ae.method;nr&&(ae.plainMethod=M,ae.plainLines=r,ae.plainShape=te);let Ke=await(tr?Yn(U,R):R(U).then(lt=>({answer:lt,request:U})).catch(lt=>(er?$n(lt,U.idempotencyKey):nr&&sn(lt)&&(ae.plainMethod=""),fo(lt,U,R))));if(!Ke)return;p=Ke.answer,S=Ke.request.idempotencyKey,h=Ke.method??h,Ce(h),D=ct()||h!==Ue(ce.current)[1],Ke.method&&Ke.method!==M&&ie(Ke.method),p.orderNumber&&(Hn(p),v()),await Ht()}catch(R){let re=sr(R);re?(l(re),se(`${re} Your order has not been placed. Place it again to continue without the code.`)):R instanceof tt?se(Ae):se(R instanceof de?R.message:"Could not place the order. Please try again."),z(!1);return}if(h&&Ca.has(h)&&(D||ct())){Wn(p);return}await Vn(p,h,!1,S)}function Wn(a){zt.current=Ue(ce.current)[0],se(`${ka(a,null)} ${rn}`),ve(a),z(!1)}function $n(a,u){sn(a)&&!on(a)&&Me.current?.key===u&&(Me.current=null)}async function fo(a,u,p){if(Lt(a))return Bn(u,p);if(!on(a))throw a;return Je.current=u.idempotencyKey,Yn(u,p,!0)}async function Yn(a,u,p=!1){let S=await an(a.idempotencyKey);if(S==="released")return ce.current===te?Bn(a,u):(bt(Qe()),z(!1),null);if(S!=="committed")throw new tt;let h=Me.current?.key===a.idempotencyKey?Me.current:null;if(st.current=h?.lines??r,h?.method&&!p){Je.current=null,qe.current=h.send;let re=await h.send().catch(()=>{throw new tt});return Re.current=h.shape,{answer:re,request:a,method:h.method}}let D=h&&!h.method?h.send:()=>u({...a,checkoutFlow:nn});qe.current=D;let R=await D().catch(()=>null);if(!R&&h?.plainMethod)throw new tt;return R?.orderNumber&&R.status!==Qr?(Je.current=null,h?.plainMethod&&(st.current=h.plainLines),h&&(Re.current=h.plainMethod?h.plainShape:h.shape),{answer:R,request:a,method:h?.plainMethod||void 0}):(z(!1),h&&(Re.current=h.shape),Ce("card"),await Gn("",R?async()=>R:()=>Promise.reject(new Error("The order request did not answer."))),await Ht(),null)}function ct(){let a=Re.current;return a!==null&&Ue(a)[0]!==Ue(ce.current)[0]}function Ce(a){a!==Ue(ce.current)[1]&&(Ct.current=!0),Nn(Ct.current||ct()?rn:null)}async function Bn(a,u){let p={...a,idempotencyKey:Qe()};Je.current=null,bt(p.idempotencyKey),qe.current=()=>u(p),zn(p,u);try{return{answer:await u(p),request:p}}catch(S){throw $n(S,p.idempotencyKey),S}}function zn(a,u){return Me.current?.key===a.idempotencyKey?!1:(Me.current={key:a.idempotencyKey,send:()=>u(a),lines:r,shape:te,method:a.checkoutFlow?"":M??"",plainMethod:"",plainLines:r,plainShape:te},!0)}function Hn(a){ur({confirmation:a,lines:st.current,adsSendTo:e.googleAdsId&&e.googleAdsConversionLabel?`${e.googleAdsId}/${e.googleAdsConversionLabel}`:null}),fa({confirmation:a,lines:st.current})}async function je(a,u=Ee){if(!u)return;let p=a?async()=>a:qe.current;if(u.orderNumber||!p){Ge(!0),fe(u);return}await Gn(u.checkoutNumber,p)}async function Gn(a,u){v(),await ia({checkoutNumber:a,resend:u,page:{setConfirming:io,land:fe,markPaid:()=>Ge(!0),track:Hn,unplaced:_n}})}function Jn(a=Ee){if(a){if(a.orderNumber){fe(a);return}v(),_n({kind:"processing",checkoutNumber:a.checkoutNumber})}}async function Ht(){let a=JSON.stringify([$t.trim(),H,k,Ne.trim(),kt,be,Se,V,j]);if(!(!ht||!Cn||kn!=="new"||Sn.current===a))try{await Ze.createAddress({label:$t.trim()||"Home",contact_name:`${H} ${k}`.trim(),phone:Ne.trim(),address:kt,city:be,zip_code:V,state:Se,country:j}),Sn.current=a,Pn("Address saved to your account.")}catch{Pn("We couldn't save the address to your account \u2014 you can add it under Account \u2192 Addresses.")}}async function Vn(a,u=M,p=!1,S=it){ve(null);try{if(u==="card"&&e.paymentMethods.includes("card")){let h=await W.createPaymentIntent({idempotencyKey:S});if(Xe.current=h,p&&Kn()){await Pt(a);return}let D=a;if(p){let R=await qe.current?.().catch(()=>null);if(R?.orderNumber){Ce("card"),await je(R,a);return}if(D=Xn(a,R)??{...a,expiresAt:null},Kn()){await Pt(a);return}}Ce("card"),He(D),Yt(!1),vt(h)}else if(u==="paypal"&&e.paymentMethods.includes("paypal"))He(a),Ja(!0);else if(u==="afterpay"&&e.paymentMethods.includes("afterpay")){let h=window.location.origin,D=await W.createAfterpayCheckout({idempotencyKey:S,confirmUrl:`${h}/checkout?afterpay=confirm`,cancelUrl:`${h}/checkout?afterpay=cancel`}),R={idempotencyKey:S,confirmation:a};ue.setItem(cn,JSON.stringify(R)),window.location.assign(D.redirectCheckoutUrl);return}else if(u==="square"&&e.paymentMethods.includes("square"))He(a),Va(!0);else if(u==="gocardless"&&e.paymentMethods.includes("gocardless")){let h=window.location.origin,D=await W.createGocardlessBillingRequest({idempotencyKey:S,confirmUrl:`${h}/checkout?gocardless=confirm`,cancelUrl:`${h}/checkout?gocardless=cancel`}),R={idempotencyKey:S,confirmation:a};ue.setItem(Ft,JSON.stringify(R)),window.location.assign(D.authorisationUrl);return}else if(u==="zip"&&e.paymentMethods.includes("zip")){let h=window.location.origin,D=await W.createZipCheckout({idempotencyKey:S,redirectUrl:`${h}/checkout?zip=return`}),R={idempotencyKey:S,confirmation:a};ue.setItem(ln,JSON.stringify(R)),window.location.assign(D.redirectUrl);return}else if(u==="klarna"&&e.paymentMethods.includes("klarna")){let h=window.location.origin,D=await W.createKlarnaCheckout({idempotencyKey:S,confirmUrl:`${h}/checkout?klarna=confirm`,cancelUrl:`${h}/checkout?klarna=cancel`}),R={idempotencyKey:S,confirmation:a};ue.setItem(qt,JSON.stringify(R)),window.location.assign(D.redirectUrl);return}else Ce(u),fe(a)}catch(h){if((p||u==="card")&&h instanceof de&&h.status===409){Ce(u),await je(void 0,a);return}Zn(a,h),z(!1)}}function Xn(a,u){return u&&!u.orderNumber&&u.status==="open"&&u.checkoutNumber===a.checkoutNumber?u:null}function Zn(a,u){se(ka(a,u)),!a.orderNumber&&Lt(u)?(ke.current=!1,bt(Qe())):ve(a)}async function go(a){if(!Ee)return;let u=Ee;try{let p=await W.createPaymentIntent({idempotencyKey:it}),S=await qe.current?.().catch(()=>null);if(S?.orderNumber){await je(S);return}let h=Xn(u,S);He(h??{...u,expiresAt:null}),Yt(a&&h!==null),Xe.current=p,vt(p)}catch(p){if(p instanceof de&&p.status===409){await je();return}vt(null),He(null),Zn(u,p),z(!1)}}function yo(){Ee&&(ke.current=!0,ve(Ee),vt(null),He(null),Yt(!1),z(!1))}return{site:e,logo:t,items:r,totals:o,coupon:s,deliveryOptions:f,courierUnavailable:Wa,retryCourier:$a,shippingMethodId:g,setShippingMethodId:d,pickupLocation:Z,servedCountries:C,formatMoney:Q,payChoice:M,setPayChoice:ie,placing:me,email:le,setEmail:I,firstName:H,setFirstName:$,lastName:k,setLastName:rt,company:Ye,setCompany:K,address1:Be,setAddress1:ee,address2:_e,setAddress2:Pe,city:be,setCity:L,postcode:V,setPostcode:ze,phone:Ne,setPhone:Fe,country:j,setCountry:ft,subdivision:Se,setSubdivision:gt,subdivisions:at,destination:hn,postcodeLabel:Ka,subdivisionLabel:Ua,me:ht,savedAddresses:Ya,selectedAddressId:kn,setSelectedAddressId:Wt,saveAddress:Cn,setSaveAddress:wn,saveLabel:$t,setSaveLabel:Ba,addressSaveNote:za,lostChangeNote:Ha,idemKey:it,confirmation:En,setConfirmation:fe,orderError:Ga,payment:Rn,paypalStep:On,squareStep:An,pendingConf:Ee,paid:Xa,setPaid:Ge,unpaidOrder:ne,orderLocked:Za,payNote:Qa,afterpayConfirming:eo,gocardlessConfirming:no,zipConfirming:ro,klarnaConfirming:oo,cardConfirming:Ln,checkoutResult:Bt,confirmCardPayment:je,cardStillProcessing:Jn,renewCardPayment:go,holdRenewed:so,leaveCardPayment:yo,checkoutRootRef:Mn,setCheckoutHeaderEl:co,fillFromAddress:Dn,checkoutSignOut:lo,payOptions:Ve,noPaymentMethod:uo,placeOrder:mo}}var Sa=ci(null);function Ea({children:e,...t}){let n=ui(t);return we(Sa.Provider,{value:n,children:e})}function Ie(){let e=li(Sa);if(!e)throw new Error("useCheckout must be used inside CheckoutStateProvider");return e}import{useId as dn}from"react";import{Fragment as Te,jsx as i,jsxs as P}from"react/jsx-runtime";function Oa(){let{email:e,setEmail:t,firstName:n,setFirstName:r,lastName:o,setLastName:s,company:l,setCompany:f,me:g,checkoutSignOut:d,orderLocked:y,unpaidOrder:N}=Ie(),b=dn();return P(Dt,{num:"N\xB0 01",title:"Contact",children:[y&&N&&i(di,{orderNumber:N.orderNumber}),i(oe,{label:"Email",htmlFor:b,hint:g?P(Te,{children:["Signed in \xB7"," ",i("button",{type:"button",onClick:d,className:"underline transition-colors hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:i("input",{id:b,type:"email",value:e,onChange:m=>t(m.target.value),placeholder:"you@example.com",readOnly:g!==null,disabled:y,className:Et+(g||y?pn:"")})}),P(_a,{children:[i(oe,{label:"First name",children:i("input",{type:"text",value:n,onChange:m=>r(m.target.value),disabled:y,className:pe(y)})}),i(oe,{label:"Last name",children:i("input",{type:"text",value:o,onChange:m=>s(m.target.value),disabled:y,className:pe(y)})})]}),i(oe,{label:"Company (optional)",children:i("input",{type:"text",value:l,onChange:m=>f(m.target.value),autoComplete:"organization",disabled:y,className:pe(y)})})]})}function Aa(){let{pickupLocation:e,servedCountries:t,address1:n,setAddress1:r,address2:o,setAddress2:s,city:l,setCity:f,postcode:g,setPostcode:d,phone:y,setPhone:N,country:b,setCountry:m,subdivision:v,setSubdivision:E,subdivisions:A,destination:Z,postcodeLabel:O,subdivisionLabel:C,me:Y,savedAddresses:Q,selectedAddressId:M,setSelectedAddressId:ie,saveAddress:he,setSaveAddress:Le,saveLabel:me,setSaveLabel:z,fillFromAddress:le,orderLocked:I}=Ie(),H=dn(),$=dn();return P(Dt,{num:"N\xB0 02",title:e?"Collection":"Shipping address",children:[e?P("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"})]}):P(Te,{children:[Y!==null&&Q.length>0&&P("div",{className:"grid gap-3",children:[Q.map(k=>i(Mt,{active:M===k.id,disabled:I,onClick:()=>{ie(k.id),le(k)},title:k.label,body:k.formatted_address,price:null},k.id)),i(Mt,{active:M==="new",disabled:I,onClick:()=>ie("new"),title:"New address",body:null,price:null})]}),i(oe,{label:"Address line 1",children:i("input",{type:"text",value:n,onChange:k=>r(k.target.value),disabled:I,className:pe(I)})}),i(oe,{label:"Address line 2",children:i("input",{type:"text",value:o,onChange:k=>s(k.target.value),placeholder:"Apartment, unit, garage bay\u2026",disabled:I,className:pe(I)})}),P(_a,{cols:"three",children:[i(oe,{label:"City",children:i("input",{type:"text",value:l,onChange:k=>f(k.target.value),disabled:I,className:pe(I)})}),i(oe,{label:O,children:i("input",{type:"text",value:g,onChange:k=>d(k.target.value),disabled:I,className:pe(I)})}),i(oe,{label:"Country",separate:!0,htmlFor:H,children:i(Xt,{id:H,value:b,onChange:k=>m(k.target.value),disabled:I,className:pe(I)+" pr-10",style:Ra,children:t.map(k=>i("option",{value:k.code,children:k.name},k.code))})})]}),i(oe,{label:C,separate:!0,htmlFor:$,children:A.length>0?P(Xt,{id:$,value:v,onChange:k=>E(k.target.value),disabled:I,className:pe(I)+" pr-10",style:Ra,children:[i("option",{value:"",children:"Select\u2026"}),A.map(k=>i("option",{value:k.code||k.name,children:k.name},k.code||k.name))]}):i("input",{id:$,type:"text",value:v,onChange:k=>E(k.target.value),disabled:I,className:pe(I)})})]}),i(oe,{label:"Phone",children:i("input",{type:"tel",value:y,onChange:k=>N(k.target.value),disabled:I,className:pe(I)})}),!e&&Y!==null&&M==="new"&&!I&&P(Te,{children:[i(pi,{checked:he,onChange:Le,label:"Save this address to my account"}),he&&i(oe,{label:"Address label",children:i("input",{type:"text",value:me,onChange:k=>z(k.target.value),placeholder:"Home",className:Et})})]})]})}function Ia(){let{totals:e,coupon:t,deliveryOptions:n,shippingMethodId:r,setShippingMethodId:o,pickupLocation:s,formatMoney:l,city:f,destination:g,courierUnavailable:d,retryCourier:y,orderLocked:N}=Ie();return i(Dt,{num:"N\xB0 03",title:"Shipping",children:P("div",{className:"grid gap-3",children:[n.map(b=>{let m=b.pickupLocation,v=m?[m.address,m.city,m.state,m.zipCode].filter(Boolean).join(", "):null;return i(Mt,{active:r===b.id,disabled:N,onClick:()=>o(b.id),title:m?`${b.name} \u2014 ${m.name}`:b.name,body:m?[v,m.openingHours,m.instructions,b.description].filter(Boolean).join(" \xB7 "):b.description||null,price:e.freeShipping||b.amount===0?Nt:l(b.amount,e.currency),tag:b.tag||void 0},b.id)}),d?P("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:[Pa," ",i("button",{type:"button",onClick:y,className:"underline transition-colors 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 Ta(){let{payChoice:e,setPayChoice:t,placing:n,payment:r,payOptions:o,noPaymentMethod:s}=Ie();return P(Dt,{num:"N\xB0 04",title:"Payment",children:[s&&i("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:wa}),i("div",{className:"grid gap-3",children:o.map(l=>i(Mt,{active:e===l.key,onClick:()=>t(l.key),title:l.title,body:l.body,price:l.price,tag:l.tag},l.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 La(){let{site:e,items:t,totals:n,coupon:r,formatMoney:o,payChoice:s,placing:l,email:f,orderError:g,payment:d,noPaymentMethod:y,unpaidOrder:N,orderLocked:b,placeOrder:m}=Ie();return P("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:[P("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(ge,{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?P("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",i(ge,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog \u2192"})]}):t.map(v=>i(mi,{slug:v.slug,name:v.name,qty:v.qty,config:v.config,configSummary:fi(v.config),price:fr(v,n.currency)??0,currency:n.currency},v.id))}),i("div",{className:"border-t border-line px-6 pt-5",children:i(vr,{customerEmail:f,disabled:b})}),P("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[i(We,{label:"Subtotal",value:o(n.subtotal,n.currency)}),n.discount>0&&r?.valid&&i(We,{label:`Coupon \xB7 ${r.code}`,value:P("span",{className:"font-semibold text-green",children:["\u2212 ",o(n.discount,n.currency)]})}),r?.deferred&&i(We,{label:`Coupon \xB7 ${r.code}`,value:ir}),r?.valid&&r.effects?.gift&&i(We,{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:Nt})}),i(We,{label:"Shipping",value:n.shippingStatus==="free"?i("span",{className:"font-semibold text-green",children:Nt}):pr(n.shippingStatus)??o(n.shipping,n.currency)}),n.tax&&(n.tax.charged?i(We,{label:n.tax.inclusive?`${n.tax.name} included \xB7 ${n.tax.rate}%`:n.tax.name,value:o(n.tax.amount,n.currency)}):n.tax.name?i(We,{label:n.tax.name,value:dr}):null)]}),P("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?"\u2026":o(n.grand,n.currency)})]}),P("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[g&&i(Oe,{role:"alert",children:g}),n.hasUnpricedLine&&P(Oe,{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:m,disabled:l||!N&&(y||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",l||!N&&(t.length===0||y||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:l?P(Te,{children:["Building order\u2026 ",i("span",{children:"\xB7"})]}):y?P(Te,{children:["No online payment ",i("span",{children:"\xB7"})]}):N?P(Te,{children:["Try payment again \xB7 ",_t(N),i("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]}):n.repricing?P(Te,{children:["Updating total\u2026 ",i("span",{children:"\xB7"})]}):P(Te,{children:[s==="bank"?"Place order":"Continue to payment"," \xB7"," ",o(n.grand,n.currency),i("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})})]})]})}var pn=" cursor-not-allowed opacity-70";function pe(e){return Et+(e?pn:"")}function di({orderNumber:e}){return i(Oe,{tone:"quiet",role:"status",children:P("span",{className:"flex items-start gap-2",children:[P("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:Na(e)})]})})}var Ra={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 Dt({num:e,title:t,children:n}){return P("section",{className:"mb-6 border border-line bg-bg",children:[P("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 _a({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 Mt({active:e,onClick:t,title:n,body:r,price:o,tag:s,disabled:l=!1}){return P("button",{type:"button",onClick:t,"aria-pressed":e,disabled:l,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":l?"border-line":"border-line hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]",l?pn.trim():""].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"})}),P("span",{className:"flex min-w-0 flex-col gap-1",children:[P("span",{className:"flex flex-wrap items-baseline gap-3 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[n,s&&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:s})]}),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:o})]})}function pi({checked:e,onChange:t,label:n,sub:r}){return P("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"})}),P("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 mi({slug:e,name:t,qty:n,config:r,configSummary:o,price:s,currency:l}){let{catalog:f}=St(),{formatMoney:g}=ye(),d=f.find(E=>E.slug===e),y=d?.spokes??5,N=d?.mesh??!1,b=r.find(E=>E.gold)?.label,m=d?.finishes.find(E=>E.name===b&&E.src)??d?.finishes.find(E=>E.src),v=d?.finishes[0]?.color??br;return P("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-4 border-b border-line py-4 last:border-b-0",children:[P("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:m?.src?i(rr,{src:m.src,alt:`${t.lead}${t.accent} \u2014 ${m.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:v},children:i(hr,{spokes:y,mesh:N,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})]}),P("div",{className:"flex min-w-0 flex-col gap-0.5",children:[P("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:o})]}),i("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:g(s,l)})]})}function We({label:e,value:t}){return P("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 fi(e){return e.map(t=>t.label).join(" \xB7 ")}import{Fragment as B,jsx as c,jsxs as x}from"react/jsx-runtime";function gn(e){return c(Ea,{...e,children:c(hi,{})})}function gi({order:e,paid:t}){let{formatMoney:n}=ye();if(!e.grandTotal||!e.currency)return null;let r=l=>n(Number(l),e.currency),o=Number(e.freightCharge??0),s=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||o>0)&&x(B,{children:[x("dt",{className:"text-fg-dim",children:["Delivery",e.shippingMethod?` \xB7 ${e.shippingMethod}`:""]}),c("dd",{className:"text-right font-mono",children:r(e.freightCharge??"0")})]}),s>0&&x(B,{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")]})]}),c("dt",{className:"text-fg",children:t?"Total paid":"Order total"}),c("dd",{className:"text-right font-mono text-fg",children:r(e.grandTotal)})]})}function yi({result:e,lostChangeNote:t=null}){let n=c("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:[c("h1",{className:"font-display text-3xl",children:e.kind==="refunded"||e.kind==="expired"?"Order not placed":e.kind==="processing"?"Payment processing":"Payment received"}),c("p",{className:"text-fg-dim",children:e.kind==="refunded"?x(B,{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(B,{children:["The hold on checkout ",n," ran out before your payment arrived. Your payment goes back to your card."]}):e.kind==="processing"?x(B,{children:["Your payment for checkout ",n," is being processed. When it goes through, we will email your order confirmation."]}):x(B,{children:["Thank you \u2014 your payment",e.checkoutNumber?x(B,{children:[" for checkout ",n]}):null," has gone through. We will email you the order number shortly."]})}),t&&e.kind!=="refunded"&&e.kind!=="expired"&&c("p",{className:"text-sm text-fg-dim",children:t}),c(ge,{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 hi(){let{site:e,logo:t,items:n,placing:r,email:o,me:s,addressSaveNote:l,lostChangeNote:f,idemKey:g,confirmation:d,setConfirmation:y,payment:N,paypalStep:b,squareStep:m,pendingConf:v,paid:E,setPaid:A,payNote:Z,afterpayConfirming:O,gocardlessConfirming:C,zipConfirming:Y,klarnaConfirming:Q,cardConfirming:M,checkoutResult:ie,confirmCardPayment:he,cardStillProcessing:Le,renewCardPayment:me,holdRenewed:z,leaveCardPayment:le,checkoutRootRef:I,setCheckoutHeaderEl:H}=Ie();return d?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[c("h1",{className:"font-display text-3xl",children:E?"Payment received":"Order received"}),x("p",{className:"text-fg-dim",children:[E?x(B,{children:["Thank you \u2014 your payment for order"," ",c("span",{className:"font-mono text-fg",children:d.orderNumber})," has gone through."," "]}):x(B,{children:["Thank you \u2014 your order ",c("span",{className:"font-mono text-fg",children:d.orderNumber})," is being reviewed by our team."," "]}),s?x(B,{children:["Track it under"," ",c(ge,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):c(B,{children:"We\u2019ve emailed you a link to set a password and track it."})]}),c(gi,{order:d,paid:E}),f&&c("p",{className:"text-sm text-fg-dim",children:f}),Z&&c("p",{className:"text-sm text-fg-dim",children:Z}),l&&c("p",{className:"text-sm text-fg-dim",children:l}),!s&&x("p",{className:"text-sm text-fg-dim",children:["You can also"," ",c(ge,{href:`/track?order=${encodeURIComponent(d.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email \u2014 no password needed."]}),c(ge,{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?c(yi,{result:ie,lostChangeNote:f}):M?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[c("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Placing your order \u2014 one moment."})]}):O?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[c("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Afterpay \u2014 one moment."})]}):C?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[c("h1",{className:"font-display text-3xl",children:"Setting up your direct debit\u2026"}),c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Confirming with GoCardless \u2014 one moment."})]}):Y?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[c("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Zip \u2014 one moment."})]}):Q?x("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[c("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Klarna \u2014 one moment."})]}):N&&v?c(bi,{payment:N,checkout:v,holdRenewed:z,onPaid:he,onProcessing:Le,onRenew:me,onBack:le}):b&&v?c(Ci,{confirmation:v,clientId:e.paypalClientId??"",idemKey:g,onPaid:()=>{A(!0),y(v)},onSkip:()=>y(v)}):m&&v?c(Pi,{confirmation:v,applicationId:e.squareApplicationId??"",locationId:e.squareLocationId??"",environment:e.squareEnvironment??"production",idemKey:g,onPaid:()=>{A(!0),y(v)},onSkip:()=>y(v)}):x("div",{ref:I,className:"bg-bg text-fg",children:[x("header",{ref:H,className:"sticky top-0 z-30 grid grid-cols-[1fr_auto_1fr] items-center gap-8 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(ge,{href:"/",className:"inline-flex items-center gap-3 font-mono text-[13px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["\u2190",c("span",{className:"max-[640px]:hidden",children:"Back to shop"})]}),c(ge,{href:"/","aria-label":`${e.name} home`,className:"inline-flex items-center justify-center",children:c(xr,{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})}),e.cardPayments?x("span",{className:"flex items-center justify-end gap-3 font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim",children:[c("span",{className:"text-green",children:"\u25CF"}),c("span",{className:"max-[640px]:hidden",children:"Encrypted \xB7"})," Stripe"]}):c("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:[c("span",{className:"inline-flex items-center bg-accent px-3 py-1 font-bold text-bg",children:"Checkout"}),c("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($=>x("span",{className:["relative flex items-center gap-2 transition-colors",$.state==="pending"?"text-fg-dim":"text-fg",$.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[c("span",{className:$.state==="done"?"text-accent font-bold":"",children:$.n}),c("span",{children:$.label})]},$.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:[c(Oa,{}),c(Aa,{}),c(Ia,{}),c(Ta,{})]}),c(La,{})]}),c("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:c("span",{children:yr({legalName:e.legalName,foundedYear:e.foundedYear,siteName:e.name})})})]})}function bi({payment:e,checkout:t,holdRenewed:n,onPaid:r,onProcessing:o,onRenew:s,onBack:l}){let{formatMoney:f}=ye(),g=c("span",{className:"text-fg",children:f(Number(e.amount),e.currency)}),d=Fa(()=>Tt(e.publishableKey),[e.publishableKey]),y=Fa(()=>Cr(),[]);return c("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:[c("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:_t(t)}),c("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:[c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:t.orderNumber?x(B,{children:["Your order is placed. Pay ",g," by card to confirm it now."]}):n?x(B,{children:["Your hold ran out, so your items are held again",t.expiresAt?` until ${qa(t.expiresAt)}`:"",". Enter your card again, then pay ",g,"."]}):x(B,{children:["Your items are held",t.expiresAt?` until ${qa(t.expiresAt)}`:"",". Pay ",g," by card to place your order."]})}),c(tn,{stripe:d,options:{clientSecret:e.clientSecret,appearance:y},children:c(xi,{payment:e,checkout:t,onPaid:r,onProcessing:o,onRenew:s,onBack:l})},e.clientSecret)]})]})})}function qa(e){return new Date(e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}var vi=5;function xi({payment:e,checkout:t,onPaid:n,onProcessing:r,onRenew:o,onBack:s}){let{formatMoney:l}=ye(),f=Yr(),g=Wr(),[d,y]=$e(!1),[N,b]=$e(null),m=nt(!1);async function v(){try{return(await f.retrievePaymentIntent(e.clientSecret)).paymentIntent?.status}catch{return}}async function E(O){let C=O;for(let Y=0;C==="processing"&&Y<vi;Y+=1)await new Promise(Q=>setTimeout(Q,1e3)),C=await v()??C;if(C==="succeeded"){n();return}if(C==="processing"){r();return}b("Payment did not complete. Please try again."),y(!1)}async function A(){if(!f||!g||d)return;y(!0),b(null),m.current=!0;let O=await f.confirmPayment({elements:g,redirect:"if_required"}).catch(()=>null);if(!O){let C=await v();if(C==="succeeded"||C==="processing"){await E(C);return}b(C===void 0?Ae:"Payment failed. Please try again."),y(!1);return}if(O.error){if(!t.orderNumber&&O.error.code==="payment_intent_unexpected_state"){let C=await v();if(C==="succeeded"||C==="processing"){await E(C);return}if(C===void 0){b(Ae),y(!1);return}await o(C==="canceled"),y(!1);return}b(O.error.message??"Payment failed. Please try again."),y(!1);return}await E(O.paymentIntent?.status)}async function Z(){if(d)return;if(!m.current){s();return}y(!0),b(null);let O=await v();if(O==="succeeded"||O==="processing"){await E(O);return}if(y(!1),O===void 0){b(Ae);return}s()}return x("div",{className:"flex flex-col gap-4",children:[c(Br,{}),N&&c(Oe,{role:"alert",children:N}),c("button",{type:"button",onClick:A,disabled:!f||!g||d,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!f||!g||d?"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?x(B,{children:["Processing\u2026 ",c("span",{children:"\xB7"})]}):x(B,{children:["Pay ",l(Number(e.amount),e.currency),c("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})}),!t.orderNumber&&!d&&x("button",{type:"button",onClick:Z,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",c("span",{children:"Back to checkout"})]})]})}var Ma="paypal-sdk-js",mn=null;function ki(e,t){let n=`${e}|${t}`;if(mn?.key===n)return mn.promise;let r=new Promise((o,s)=>{document.getElementById(Ma)?.remove();let l=document.createElement("script");l.id=Ma;let f=new URLSearchParams({"client-id":e,currency:t,intent:"capture"});l.src=`https://www.paypal.com/sdk/js?${f}`,l.onload=()=>{let g=window.paypal;g?o(g):s(new Error("PayPal SDK loaded without its namespace"))},l.onerror=()=>s(new Error("PayPal SDK failed to load")),document.head.appendChild(l)});return mn={key:n,promise:r},r}function Ci({confirmation:e,clientId:t,idemKey:n,onPaid:r,onSkip:o}){let{formatMoney:s}=ye(),l=nt(null),[f,g]=$e(!1),[d,y]=$e(null),N=nt(r);return N.current=r,ja(()=>{let b=!1,m=null;return ki(t,e.currency).then(v=>{if(!(b||!l.current))return m=v.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await W.createPaypalOrder({idempotencyKey:n})).paypalOrderId,onApprove:async E=>{try{if((await W.capturePaypalOrder({idempotencyKey:n,paypalOrderId:E.orderID})).status==="paid"){N.current();return}y("PayPal did not complete the payment. Please try again.")}catch(A){y(A instanceof de?A.message:"PayPal payment failed. Please try again.")}},onError:()=>{y("PayPal could not process the payment. Please try again.")}}),m.render(l.current).then(()=>{b||g(!0)})}).catch(()=>{b||y("PayPal could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{b=!0,m?.close?.()}},[t,e.currency,n]),c("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:[c("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}),c("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"," ",c("span",{className:"text-fg",children:s(Number(e.grandTotal),e.currency)})," ","with PayPal to confirm it now."]}),!f&&!d&&c("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal\u2026"}),c("div",{ref:l}),d&&c(Oe,{role:"alert",children:d}),c("button",{type:"button",onClick:o,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 Da="square-web-sdk",fn=null;function wi(e){let t=e==="sandbox"?"sandbox":"production";if(fn?.key===t)return fn.promise;let n=new Promise((r,o)=>{document.getElementById(Da)?.remove();let s=document.createElement("script");s.id=Da,s.src=t==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",s.onload=()=>{let l=window.Square;l?r(l):o(new Error("Square SDK loaded without its namespace"))},s.onerror=()=>o(new Error("Square SDK failed to load")),document.head.appendChild(s)});return fn={key:t,promise:n},n}function Pi({confirmation:e,applicationId:t,locationId:n,environment:r,idemKey:o,onPaid:s,onSkip:l}){let{formatMoney:f}=ye(),g=nt(null),d=nt(null),y=nt(null),[N,b]=$e(!1),[m,v]=$e(!1),[E,A]=$e(null);ja(()=>{let O=!1,C=null;return wi(r).then(async Y=>{if(O||!g.current)return;let Q=Y.payments(t,n);y.current=Q,C=await Q.card(),await C.attach(g.current),d.current=C,O||b(!0)}).catch(()=>{O||A("Square could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{O=!0,C?.destroy?.()}},[t,n,r]);async function Z(){let O=d.current;if(!(!O||m)){v(!0),A(null);try{let C=await O.tokenize();if(C.status!=="OK"||!C.token){A(C.errors?.[0]?.message??"Please check the card details and try again."),v(!1);return}let Y;try{Y=(await y.current?.verifyBuyer?.(C.token,{amount:String(e.grandTotal),currencyCode:e.currency,intent:"CHARGE"}))?.token}catch{}if((await W.chargeSquare({idempotencyKey:o,sourceId:C.token,...Y?{verificationToken:Y}:{}})).status==="paid"){s();return}A("Square did not complete the payment. Please try again.")}catch(C){A(C instanceof de?C.message:"Square payment failed. Please try again.")}v(!1)}}return c("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:[c("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}),c("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"," ",c("span",{className:"text-fg",children:f(Number(e.grandTotal),e.currency)})," ","by card to confirm it now."]}),!N&&!E&&c("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form\u2026"}),c("div",{ref:g}),E&&c(Oe,{role:"alert",children:E}),c("button",{type:"button",onClick:Z,disabled:!N||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",!N||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(B,{children:["Processing\u2026 ",c("span",{children:"\xB7"})]}):x(B,{children:["Pay ",f(Number(e.grandTotal),e.currency),c("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})}),c("button",{type:"button",onClick:l,disabled:m,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 jt}from"react/jsx-runtime";function Ni(){let{settings:e,websiteName:t}=ar(),n=t?{...Vt,name:t}:Vt,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 jt("div",{style:{position:"fixed",inset:0,zIndex:2147482e3,overflowY:"auto",background:"var(--bg)",color:"var(--fg)"},children:jt(mr,{children:jt(gr,{preview:!0,children:jt(gn,{site:n,logo:r,preview:!0})})})})}export{Ni as default};
@@ -1 +1 @@
1
- "use client";import{wp as r}from"./chunk-KV3EHFHB.js";import"./chunk-YSKMBJ7V.js";import"./chunk-XNUK2QNK.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};
1
+ "use client";import{Bp as r}from"./chunk-G5XZ736Y.js";import"./chunk-UBOGEIFX.js";import"./chunk-SUX7QH3R.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 Et,Z as Pt,_ as wt,aa as B,g as vt}from"./chunk-X3ERHC7Y.js";import{$h as Ke,Zh as yt,ai as ze,ci as bt,pi as Ce,qi as xt,ti as Ve,ui as St,ze as ht}from"./chunk-UBOGEIFX.js";import{c as Ct,o as de}from"./chunk-SUX7QH3R.js";import{createContext as _n,useContext as It,useEffect as Rn,useMemo as Se,useState as kt}from"react";function Rt(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 Xe=4,qr=1,Gr={unit:"set",spares:0,spareSide:"left"};function Nt(e){return e.unit==="single"?1:Xe+e.spares}function Kr(e,t){return[{partNumber:e.partNumber,wheels:Nt(t),prices:e.prices}]}function zr(e,t){let n=Nt(t)-Xe;if(n<=0||e.length===0)return e;let r=En(e),o=r?r[t.spareSide]:0;return e.map((i,a)=>a===o?{...i,wheels:i.wheels+n}:i)}function En(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 Pn(e,t){return t.spares>0?`${e} + spare`:e}function Vr(e){return e.unit==="single"?"Single":Pn(`Set of ${Xe}`,e)}var Xr="data-add-to-basket",Ye=9,wn="en",_t=new Map;function Ae(e,t,n){let r=`${e}|${t??""}|${n??""}`,o=_t.get(r);return o||(o=new Intl.NumberFormat(wn,{style:"currency",currency:e,...t===void 0?{}:{minimumFractionDigits:t},...n===void 0?{}:{maximumFractionDigits:n}}),_t.set(r,o)),o}function Q(e,t,n=0){return Ae(t,0,n).format(e)}function Yr(e,t){return Ae(t).format(e)}function Qr(e,t){let n=e.savings[t];if(n===void 0)return null;let r=Q(n,t);return e.savingIsFrom?`Save from ${r}`:`Save ${r}`}import{jsx as In}from"react/jsx-runtime";var Nn="storefront-country",Lt=Nn,Qe=_n(null);function kn(e){return At(e,"catalogue")}function Ln(e){return At(e,"money")}function At(e,t){let n=new Map(e.map(r=>[r.code,r.decimalPlaces]));return(r,o)=>{if(!o)return"";let i=n.get(o)??0;return Ae(o,t==="money"?i:0,i).format(r)}}function to({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]=kt(c),[x,f]=kt(!1);Rn(()=>{let m=de.getItem(Lt);m&&a.some(A=>A.code===m)&&g(m),f(!0)},[a]);function w(m){g(m),de.setItem(Lt,m)}let N=Se(()=>{let m=a.find(b=>b.code===u)??null,A=m?.currency,k=A&&i.some(b=>b.code===A)?A:l,T=kn(i),R=Ln(i);return{country:u,currency:k,setCountry:w,currencies:i,countries:a,activeCountry:m,formatPrice:(b,F)=>T(b,F??k),formatMoney:(b,F)=>R(b,F??k),ready:x}},[u,i,a,l,x]);return In(Qe.Provider,{value:N,children:e})}function Tt(e){let t=It(Qe);if(!t&&!e?.optional)throw new Error("useCurrency must be used within a CurrencyProvider");return t}function no(){return It(Qe)?.country??""}import{createContext as Kn,useCallback as P,useContext as zn,useEffect as G,useMemo as Xt,useRef as j,useState as I}from"react";function Ot(){return"/edit"}function Dt(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var Ft="We'll confirm this discount when you place your order.",so="Confirmed at checkout";function lo(e){return e&&(e.valid||e.deferred)?e.code:void 0}var Mt="coupon_code: ";function uo(e){return!(e instanceof xe)||e.status!==400||!e.message.startsWith(Mt)?null:e.message.slice(Mt.length)}function Ut(e,t){return e.map(n=>({qty:n.qty,slug:n.slug,name:`${n.name.lead}${n.name.accent}`.trim(),finish:n.finishName,size:n.size,kind:n.kind,sku:n.sku,pack:n.pack,priceLabel:t(n)}))}var Te="Price on request",Tn="Request a quote",$t="from ",mo="From ",go="each",Ht="Free";function je(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Ze(e,t){let n=e?.[t];return je(n)?n:null}function ho(e,t,n,r){let o=Ze(e,n),i=Ze(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function yo(e,t,n,r){if(n==null&&r==null)return!0;let o=Ze(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var On={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function Mn(e,t,n){if(!je(e))return On;let r=je(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function bo(e,t,n=""){return!e.priced||e.unit==null?Te:`${n}${Q(e.unit,t)}`}function Co(e,t){return e.was==null?null:Q(e.was,t)}function Dn(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 Fn={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function xo(e,t,n,r=1){let o=Mn(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=Dn(t.components,n,r);return a.priced?{priced:!0,unit:a.unit,isFrom:a.isFrom,was:null,onSale:!1,setTotal:a.setTotal,fromSetTotal:i}:{...Fn,fromSetTotal:i}}function Un(e,t){return!e.priced||e.unit==null?Te:`${e.isFrom?$t:""}${Q(e.unit,t)}`}function So(e,t){return e.was==null?null:Q(e.was,t)}function vo(e,t){return!e.priced||e.unit==null?Tn:Un(e,t)}function Eo(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=Q(r-n,t);return{was:Q(r,t),amount:e.savingIsFrom?`${$t}${o}`:o}}var $n=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function Bt(e){return $n.test(e.trim())}var Wt="sf:ga-purchases",Hn=20;function Gt(){return typeof window>"u"||window.parent!==window}function ve(...e){try{if(Gt()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function Bn(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 Je(e,t){return e.filter(Oe).map(n=>Bn(n,t))}function ko(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 Kt(e,t){let n=Je([e],t);n.length!==0&&ve("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function Lo(e){let t=Je(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 qt=new Set;function Wn(e){if(qt.has(e))return!1;qt.add(e);try{let t=JSON.parse(de.getItem(Wt)??"[]");if(t.includes(e))return!1;de.setItem(Wt,JSON.stringify([...t,e].slice(-Hn)))}catch{}return!0}function Io(e){let t=e.confirmation;if(Gt()||!Wn(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:Je(e.lines,n)}),e.adsSendTo&&ve("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var qn="Arranged after review",zt="Calculated at checkout",Gn=zt,Oo=zt;function Vt({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function Mo(e){switch(e){case"arranged":return qn;case"pending":return Gn;case"free":return Ht;case"charged":return null}}import{jsx as Qn}from"react/jsx-runtime";var Vn=400,Xn=400,Yn=1500;function Oe(e){return(e.components?.length??0)>0}function Yt(e,t){return{code:e,valid:t.valid,deferred:Dt(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function jt(e,t){return fe(e.components,t)}function et(e,t){let n=jt(e,t);return n===null?null:n*e.qty}function Qt(e){return e!=="tyre"}var Zt=Kn(null);function Xo({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=Tt(),[i,a]=I(t),[l,c]=I([]),[u,g]=I([]),[x,f]=I([]),[w,N]=I(!1),m=j(new Set),[A,k]=I([]),[T,R]=I(!1),[b,F]=I(null),[ee,ie]=I(0),O=P(()=>ie(s=>s+1),[]),[C,_]=I(void 0),[y,ae]=I(null),[S,$]=I(null),[pe,se]=I(!1),[M,W]=I(null),te=j(void 0),K=P(()=>a(!0),[]),z=P(()=>a(!1),[]),me=P(()=>a(s=>!s),[]);G(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&K()},[K,t]);let ne=Ot(),le=j(ne);G(()=>{le.current!==ne&&(le.current=ne,t||z())},[ne,t,z]);let Re=P(s=>{ae(p=>p?.country===s?.country&&p?.subdivision===s?.subdivision&&p?.postcode===s?.postcode?p:s)},[]),V=P((s,p)=>{R(!0),!(!p||!Qt(s))&&k(d=>d.includes(p)?d:[...d,p])},[]),q=T||l.length>0,ge=j(!0);G(()=>(ge.current=!0,()=>{ge.current=!1}),[]),G(()=>{if(t)return;let s=[...A,...l.filter(d=>Qt(d.kind)).map(d=>d.slug)],p=[...new Set(s)].filter(d=>d&&!m.current.has(d));if(p.length!==0){for(let d of p)m.current.add(d);B.listWheelsBySlug(p).then(d=>{if(!ge.current||d.length===0)return;let h=new Set(d.map(v=>v.slug));g(v=>[...v.filter(re=>!h.has(re.slug)),...d])})}},[t,A,l]),G(()=>{if(t||!q||w)return;let s=!0;return B.listBundles().then(p=>{s&&(f(p),N(!0))}),()=>{s=!1}},[t,q,w]);let E=b?.deliveryOptions??[],Ne=b?.courier??null;G(()=>{b&&W(s=>s&&E.some(p=>p.id===s)?s:E[0]?.id??null)},[b]);let X=P(()=>l.filter(Oe).flatMap(s=>Rt(s.components,s.qty)),[l]),he=P(async(s,p)=>{let d=s.trim().toUpperCase();if(!d)return;let h=X();if(h.length===0){$({code:d,valid:!1,message:"Add a wheel to the cart first."});return}se(!0),te.current=p;try{let v=await B.validateCoupon({code:d,items:h,currency:n,shippingMethodId:M??void 0,customerEmail:p});$(Yt(d,v))}catch{$({code:d,valid:!1,unchecked:!0,message:"Could not check that code. Please try again."})}finally{se(!1)}},[X,n,M]),ye=P(()=>{$(null),te.current=void 0},[]),be=P(s=>{if(!S)return;let{code:p}=S;$(d=>d&&d.code===p?{code:p,valid:!1,refused:!0,message:s}:d)},[S]);G(()=>{if(!S||S.refused)return;let s=S.code,p=h=>h!==null&&h.code===s&&!h.refused,d=setTimeout(async()=>{let h=X();if(h.length===0){$(v=>p(v)?{code:s,valid:!1,message:"Add a wheel to the cart first."}:v);return}se(!0);try{let v=await B.validateCoupon({code:s,items:h,currency:n,shippingMethodId:M??void 0,customerEmail:te.current});$(re=>p(re)?Yt(s,v):re)}catch{}finally{se(!1)}},Vn);return()=>clearTimeout(d)},[l,n,M]);let ue=S&&!S.refused?S.code:void 0;G(()=>{if(t)return;let s=!0,p=setTimeout(async()=>{let d=X();if(d.length===0){F(null),_(void 0);return}try{let h=await B.quoteCart({items:d,currency:n,shippingMethodId:M??void 0,couponCode:ue,customerEmail:te.current||void 0,country:y?.country||r||void 0,subdivision:y?.country&&y.subdivision||void 0,postcode:y?.country&&y.postcode||void 0});if(!s)return;F(h)}catch{if(!s)return}_(ue)},Xn);return()=>{s=!1,clearTimeout(p)}},[l,n,M,ue,r,y,ee]);let Y=P(s=>{c(p=>{let d=p.findIndex(h=>h.id===s.id);return d===-1?[...p,s]:p.map((h,v)=>v===d?{...h,qty:Math.min(Ye,h.qty+s.qty)}:h)}),Kt(s,n)},[n]),ke=P(s=>{c(p=>p.filter(d=>d.id!==s))},[]),Le=P((s,p)=>{let d=Math.max(1,Math.min(Ye,p));c(h=>h.map(v=>v.id===s?{...v,qty:d}:v))},[]),L=P(s=>{c(s)},[]),[U,Be]=I(null),st=j(null);st.current=U;let H=j(null),We=j(""),lt=P((s,p)=>{let d=s.trim().toLowerCase();Bt(d)&&Be(h=>h&&h.email===d&&h.firstName===(p??"")?h:{email:d,firstName:p??""})},[]);G(()=>{if(t||!U)return;let s=Ut(l.filter(Oe),h=>et(h,n)===null?Te:o(et(h,n),n)),p={email:U.email,firstName:U.firstName,currency:n,items:s},d=JSON.stringify(p);if(d!==We.current)return H.current&&clearTimeout(H.current),H.current=setTimeout(()=>{H.current=null,We.current=d,B.captureCart(p).catch(h=>{})},Yn),()=>{H.current&&(clearTimeout(H.current),H.current=null)}},[l,U,n,t]);let ut=P(()=>{H.current&&(clearTimeout(H.current),H.current=null);let s=st.current;s&&(We.current="",B.captureCart({email:s.email,firstName:s.firstName,currency:n,items:[]}).catch(p=>{}))},[n]),ct=Xt(()=>{let s=l.reduce((D,ce)=>{let Ie=et(ce,n);return Ie===null?D:D+Ie},0),p=l.some(D=>jt(D,n)===null),d=l.reduce((D,ce)=>D+ce.qty,0),h=S?.valid?S.effects:void 0,v=h?Math.min(s,Number(h.discountAmount)):0,re=b?.bundleDiscount??0,bn=b?.appliedBundles??[],qe=!!h?.freeShipping,mt=E.find(D=>D.id===M),gt=qe?0:b?.shipping??mt?.amount??0,Cn=Vt({quoted:b!==null,optionCount:E.length,chosenAmount:mt?.amount,couponWaivesFreight:qe}),Ge={};for(let D of h?.freeUnits??[])Ge[D.partNumber]=(Ge[D.partNumber]??0)+D.quantity;let xn=b?.tax??null,Sn=b?b.grandTotal:s-v-re+gt;return{sets:d,units:l.reduce((D,ce)=>D+(ce.components??[]).reduce((Ie,vn)=>Ie+vn.wheels*ce.qty,0),0),subtotal:s,hasUnpricedLine:p,discount:v,bundleDiscount:re,appliedBundles:bn,shipping:gt,freeShipping:qe,shippingStatus:Cn,freeUnitsByPartNumber:Ge,tax:xn,grand:Sn,repricing:!!S?.refused&&b!==null&&C===S?.code,currency:n}},[l,n,S,E,M,b,C]),dt=j(!0),ft=P(s=>{dt.current=s},[]),pt=P(s=>{Y(s),dt.current&&K()},[Y,K]),yn=Xt(()=>({isOpen:i,preview:t,open:K,close:z,toggle:me,items:l,catalog:u,bundles:x,warmCatalog:V,add:Y,addAndOpen:pt,setAutoOpen:ft,remove:ke,setQty:Le,replaceItems:L,identify:lt,clearCapturedCart:ut,coupon:S,applyCoupon:he,removeCoupon:ye,refuseCoupon:be,couponBusy:pe,deliveryOptions:E,setQuoteDestination:Re,courier:Ne,requote:O,shippingMethodId:M,setShippingMethodId:W,totals:ct}),[i,t,K,z,me,l,u,x,V,Y,pt,ft,ke,Le,L,lt,ut,S,he,ye,be,pe,E,Re,Ne,O,M,ct]);return Qn(Zt.Provider,{value:yn,children:e})}function Jt(){let e=zn(Zt);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as ar}from"react";function en(e){return/(?:^|\|)(?:slug|xhost):/.test(e)}function tn(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 jn=6e4,Zn=5e3,Jn=500,Me=new Map;async function er(e){let{host:t,matchesRequestHost:n}=await Et();if(!t)return"";let r=await Pt();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}async function nn(e,t){if(await wt()!==null)return t();let n=await er(e);if(!n)return t();let r=Date.now(),o=Me.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),a=i.outcome.state==="failed",l=a?Zn:jn,c=Me.get(n)?.lastGood,u=i.outcome.state==="ok"?i:a?c:void 0,g=a&&u?u:i;return tn(Me,Jn,en,r),Me.set(n,{load:g,expiresAt:r+l,lastGood:u}),g}var tr=404;function nr(e){if(e instanceof xe&&e.status===tr)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 rr="[storefront:chrome-load-failed]";function or(e,t){console.error(`${rr} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function rn(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=nr(o);return i.state==="failed"&&or(e,i),{value:n,outcome:i}}}function ir(e){return e==="production"?"silent":"banner"}var ni=ir("production");function sr(e,t){return e?.trim()||t}function ci({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=sr(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var lr={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:Ve},di=ar(async()=>nn("site",()=>rn("site",async()=>{let e=await B.getSite();return{name:xt(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:St(e.socialLinks)}},lr)));var fi={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:Ve};import{jsx as ur}from"react/jsx-runtime";function mi({tone:e="bad",role:t,children:n}){return ur("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 tt}from"react/jsx-runtime";import{useEffect as De,useId as pr,useRef as an,useState as Fe}from"react";import{useRootIsDark as mr}from"efficient-shell/theme";import{efficientClientOpen as cr}from"efficient-easel/screen/lib/session";var Ee=new Map,dr=64;async function fr(e){if(!cr())return null;try{let t=await fetch(`${Ct()}/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 on(e){let t=Ee.get(e);if(t)return t;let n=fr(e);if(Ee.set(e,n),Ee.size>dr){let r=Ee.keys().next();r.done||Ee.delete(r.value)}return n}var gr=202/22,hr=.88,Ti=16,yr="invert(1)";function Oi({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:f=Ce,fitToContainer:w=!1,fitWordmarkToContainer:N=!1,fitFloorPx:m,hideClass:A,hideAttrs:k}){let T=x&&x.trim()?x.trim():f,[R,b]=Fe(null),F=an(null),ee=L=>{F.current=L};De(()=>{b(F.current?.ownerDocument??null)},[]);let ie=!mr({doc:R,whenUnset:!0}),O=n&&n.trim()?n.trim():null,C=!!O&&vt(O),_=i??(ie&&t),y=o&&o.trim()?o.trim():null,ae=r&&!y,S=`logo-color-${pr().replace(/[^A-Za-z0-9_-]/g,"")}`,$=ae&&C&&O&&a!=null?{reversed:a,inkIsDark:l??null}:null,pe=$!==null,[se,M]=Fe(null);De(()=>{if(!ae||!O||!C||pe){M(null);return}let L=!1;return M(null),on(O).then(U=>{L||M(U)}),()=>{L=!0}},[ae,O,C,pe]);let W=$??se,te=!!W&&W.inkIsDark!==null&&(_?!W.inkIsDark:W.inkIsDark),K=ae&&!!O&&!C&&!_,z=te&&W?W.reversed:O,me=z?[z]:[],[ne,le]=Fe(0);De(()=>{le(0)},[O,te]);let Re=e==="footer"?ze:Ke[c],V=u&&u>0?u:Re,q=(u&&u>0?ht(u,g,"size",bt):null)??`${V}px`,ge=Math.round(V*gr),E=ne<me.length?me[ne]:null,[Ne,X]=Fe(z),he=E!==null&&E===Ne,ye=an(null);De(()=>{let L=ye.current;if(!L||!L.complete)return;if(L.naturalWidth>0||L.naturalHeight>0){X(E);return}let U=!1;return L.decode().then(()=>!U&&X(E),()=>!U&&le(Be=>Be+1)),()=>{U=!0}},[E]);let be=w||N,ue=`calc(100cqi / ${((T.length+1)*hr).toFixed(2)})`,Y=be&&m&&m>0?q===`${V}px`?`${Math.min(m,V)}px`:`min(${m}px, ${q})`:null,ke=be?Y===null?`min(${q}, ${ue})`:`clamp(${Y}, ${ue}, ${q})`:q,Le=tt("span",{className:`font-display font-bold tracking-[0.18em] ${Y===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:ke,lineHeight:1,...y?{color:y}:{}},"aria-label":T,children:[T,Pe("span",{className:"text-accent",style:y?{color:y}:void 0,children:"."})]});return tt("span",{ref:ee,className:yt("inline-flex items-center",A??""),...k,children:[!he&&Le,y&&E&&Pe("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:tt("filter",{id:S,colorInterpolationFilters:"sRGB",children:[Pe("feFlood",{style:{floodColor:y}}),Pe("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),E&&Pe("img",{ref:ye,src:E,alt:T,width:ge,height:V,className:"shrink-0 object-contain",style:{...he?{height:q,width:"auto",...w?{maxWidth:"100cqi"}:{}}:{display:"none"},...K?{filter:yr}:{},...y?{filter:`url(#${S})`}:{}},onLoad:()=>X(E),onError:()=>le(L=>L+1)},E)]})}var Di="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",sn="w-0 min-w-0 flex-1",Fi="w-0 min-w-[7rem] flex-1";import{jsx as we,jsxs as Cr}from"react/jsx-runtime";function br({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 Cr("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 Bi="#c9a461",ln=[{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"}],Wi={name:"",color:"var(--fg)",family:"silver",src:""};function xr(e,t){let n=r=>{let o=ln.findIndex(i=>i.f===r);return o===-1?ln.length:o};return n(e)-n(t)||e.localeCompare(t)}function qi(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(xr)}import{useState as Sr}from"react";import{jsx as oe,jsxs as nt}from"react/jsx-runtime";function vr({customerEmail:e,disabled:t=!1}){let{coupon:n,applyCoupon:r,removeCoupon:o,couponBusy:i}=Jt(),[a,l]=Sr("");async function c(){t||i||!a.trim()||(await r(a,e),l(""))}return nt("div",{className:"flex flex-col gap-2",children:[n===null?nt("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:`${sn} 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"})]}):nt("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:Ft}):n&&!n.valid&&n.message&&oe("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:n.message})]})}var rt="Ads on. Shopper can opt out.",Ue="Ads and analytics off until Accept",Er={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:rt,footerLink:"Do Not Sell or Share My Personal Information",panelEyebrow:"Do not sell or share",adsRowName:"Sale or sharing for ads"},ca:{region:"ca",name:"Canada",model:"opt-in",law:"PIPEDA, Quebec Law 25",beforeChoice:Ue,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:rt,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:rt,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:Ue,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:Ue,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:Ue,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}};function Pr(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 ji(e,t,n){let r=Pr(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 Zi={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 wr={asked:!1,region:"other",model:"opt-in",analytics:!0,ads:!0,chosen:!0,gpc:!1};var _r=wr;function na(e=_r){if(e.asked)return e.ads?"granted":"denied"}function oa(){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 Nr,isValidElement as kr,useEffect as cn,useId as Lr,useLayoutEffect as pn,useRef as Z,useState as dn}from"react";var $e=(e,t)=>!!e[t]&&!e[t].disabled;function ot(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if($e(e,i))return i}return t}function it(e,t){return ot(e,t===1?-1:e.length,t)}function at(e,t){return $e(e,t)?t:Math.max(it(e,1),0)}function un(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)=>$e(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:ot(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:ot(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:it(n,1)}),handled:!0};case"End":return{state:i({focus:it(n,-1)}),handled:!0};case"Enter":case" ":return $e(n,o)?{state:i({open:!1,typed:""}),commit:o,refocus:!0,handled:!0}:{state:e,handled:!0};case"Escape":return{state:i({open:!1,typed:""}),refocus:!0,handled:!0};case"Tab":return{state:i({open:!1,typed:""}),handled:!1};default:return{state:e,handled:!1}}}import{placeMenu as Ir}from"efficient-shell/ui";import{Fragment as Ur,jsx as J,jsxs as mn}from"react/jsx-runtime";var fn={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function Ar({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[a,l]=dn(!1),c=r!==void 0,u=c?r:a,[g,x]=dn(0),f=Z({text:"",timer:0}),w=Z(null),N=Z(null),m=Z(null),A=Lr(),k=Z(null),T=e.findIndex(C=>C.value===t),R=C=>{C!==u&&(c||l(C),C?o?.():i?.())},b=C=>{let _=e[C];!_||_.disabled||(n(_.value),R(!1),N.current?.focus())},F=C=>{let _={open:u,focus:u?g:at(e,T),typed:f.current.text},y=un(_,C,e);return!y.handled&&y.state.open===u?!1:(y.state.typed!==_.typed&&(f.current.text=y.state.typed,window.clearTimeout(f.current.timer),f.current.timer=window.setTimeout(()=>{f.current.text=""},500)),x(y.state.focus),y.commit!==void 0?b(y.commit):R(y.state.open),y.refocus&&N.current?.focus(),y.handled)},ee=Z(F);ee.current=F;let ie=Z(()=>R(!1));ie.current=()=>R(!1);let O=C=>{u||(k.current=C.nativeEvent,ee.current(C.key)&&C.preventDefault())};return cn(()=>{if(!u)return;let C=y=>{w.current?.contains(y.target)||ie.current()},_=y=>{y!==k.current&&ee.current(y.key)&&y.preventDefault()};return document.addEventListener("mousedown",C),document.addEventListener("keydown",_),()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",_)}},[u]),cn(()=>{u&&(f.current.text||x(at(e,T)))},[u]),pn(()=>{if(!u||!m.current)return;m.current.children.item(g)?.scrollIntoView({block:"nearest"})},[g,u]),{open:u,toggle:()=>R(!u),close:()=>R(!1),focusIdx:g,setFocusIdx:x,pick:C=>b(e.findIndex(_=>_.value===C)),wrapRef:w,triggerRef:N,listRef:m,listId:A,onTriggerKeyDown:O,activeId:u?`${A}-${g}`:void 0}}var Tr={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 ${fn.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 ${fn.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 Or(e,t){pn(()=>{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=Ir({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 f=g.top+Math.min(c.height,g.maxHeight);i.marginBottom=`${Math.max(0,l.top-f)}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 Mr(e){return e.split(" ").map(t=>t==="left-0"?"right-0":t).join(" ")}function Dr({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:a,listRef:l,ariaLabel:c,align:u="start"}){let g=Tr[t],x=Z(null);return Or(x,n.length),J("ul",{ref:f=>{x.current=f,l&&(l.current=f)},id:e,role:"listbox","aria-label":c,...g.pickerMarker?{"data-picker-menu":""}:{},className:u==="end"?Mr(g.list):g.list,children:n.map((f,w)=>{let N=f.value===r;return J("li",{id:`${e}-${w}`,role:"option","aria-selected":N,"aria-disabled":f.disabled||void 0,onMouseEnter:()=>!f.disabled&&i(w),onMouseDown:m=>{m.preventDefault(),f.disabled||a(f.value)},className:g.item(w===o,N&&f.value!=="",!!f.disabled,w===n.length-1),style:g.itemStyle?.(N),children:f.meta===void 0?f.label:mn(Ur,{children:[f.lead,J("span",{className:"flex-1 whitespace-nowrap",children:f.label}),J("span",{className:"ml-auto text-[12px] opacity-50",children:f.meta})]})},`${f.value}_${w}`)})})}function Fr({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:a,id:l,"aria-label":c,align:u}){let g=Nr.toArray(r).flatMap(m=>{if(!kr(m))return[];if(m.type!=="option")return[];let k=m.props,T=k.value!==void 0?String(k.value):"",R=k.children,b=typeof R=="string"||typeof R=="number"?String(R):T;return[{value:T,label:b,disabled:!!k.disabled}]}),x=e??"",f=Ar({items:g,value:x,onPick:m=>t?.({target:{value:m}})}),N=g.find(m=>m.value===x)?.label??g[0]?.label??"";return mn("div",{ref:f.wrapRef,className:"relative",children:[a&&J("input",{type:"hidden",name:a,value:x}),J("button",{ref:m=>{f.triggerRef.current=m},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":f.open,"aria-controls":f.open?f.listId:void 0,"aria-activedescendant":f.activeId,"aria-label":c,id:l,onClick:()=>!n&&f.toggle(),onKeyDown:m=>!n&&f.onTriggerKeyDown(m),className:`block w-full ${o??""}`,style:i,children:J("span",{className:"block w-full truncate text-left",children:N})}),f.open&&J(Dr,{id:f.listId,tone:"select",items:g,value:x,focusIdx:f.focusIdx,onFocus:f.setFocusIdx,onPick:f.pick,listRef:f.listRef,align:u})]})}import{jsx as _e,jsxs as He}from"react/jsx-runtime";var $r="font-mono text-[length:var(--size-label,12px)]",Hr="font-semibold uppercase tracking-[0.22em] text-fg";function gn(e){return`${e??$r} ${Hr}`}function hn(){return _e("span",{className:"text-accent",children:" *"})}function Br({children:e,required:t,labelFace:n}){return He("span",{className:gn(n),children:[e,t?_e(hn,{}):null]})}function Wr({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?He("div",{className:c,children:[He("label",{htmlFor:o,className:gn(i),children:[e,t?_e(hn,{}):null]}),l,u]}):He("label",{htmlFor:o,className:c,children:[_e(Br,{required:t,labelFace:i,children:e}),l]})}export{Ot as a,so as b,lo as c,uo as d,Rt as e,Xe as f,qr as g,Gr as h,Kr as i,zr as j,En as k,Pn as l,Vr as m,Xr as n,Ye as o,Ae as p,Q as q,Yr as r,Qr as s,Te as t,Tn as u,$t as v,mo as w,go as x,Ht as y,Ze as z,ho as A,yo as B,Mn as C,bo as D,Co as E,Dn as F,xo as G,Un as H,So as I,vo as J,Eo as K,Bt as L,ko as M,Lo as N,Io as O,Oo as P,Mo as Q,to as R,Tt as S,no as T,Oe as U,et as V,Xo as W,Jt as X,ci as Y,lr as Z,fi as _,Di as $,sn as aa,Fi as ba,br as ca,Bi as da,ln as ea,Wi as fa,xr as ga,qi as ha,vr as ia,mi as ja,Ti as ka,Oi as la,Er as ma,ji as na,Zi as oa,wr as pa,na as qa,oa as ra,Ar as sa,Dr as ta,Fr as ua,Br as va,Wr as wa};