efficient-storefront-blocks 0.68.0 → 0.74.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -0
- package/README.md +5 -5
- package/dist/chunks/EditorPreviewCheckout-YQ3F5MSG.js +4 -0
- package/dist/chunks/{SiteEditorProvider-A7YYACG3.js → SiteEditorProvider-Z33JB5BA.js} +1 -1
- package/dist/chunks/chunk-5OFEWRWI.js +1 -0
- package/dist/chunks/{chunk-FL3KMJAT.js → chunk-BZDVZUF4.js} +1 -1
- package/dist/chunks/{chunk-EPJ5SM3A.js → chunk-QJDTP7K6.js} +1 -1
- package/dist/chunks/chunk-UGXNUQRA.js +246 -0
- package/dist/chunks/chunk-UJW4B64R.js +1 -0
- package/dist/chunks/{fitment-data-RXCNCZLU.js → fitment-data-DHKRLKNI.js} +1 -1
- package/dist/contract.js +10 -2
- package/dist/editor/components/CategorySource.js +1 -1
- package/dist/editor/components/HeaderSettingsPanel.d.ts +4 -7
- package/dist/editor/components/HeaderSettingsPanel.js +1 -1
- package/dist/editor/components/PreviewHeader.d.ts +0 -1
- package/dist/editor/components/PreviewHeader.js +1 -11
- package/dist/editor/lib/document/blocks/commerce/AlloyWheelsListing/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/GalleryB/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/ProductGrid/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/ContactCards/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/service/ContactCards/fields.js +1 -0
- package/dist/editor/lib/document/blocks/service/ContactRouting/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/FooterDivider/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/FooterMenu/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/FooterMessaging/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/service/FooterMessaging/fields.js +1 -0
- package/dist/editor/lib/document/blocks/service/FooterPayment/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/service/FooterPayment/fields.js +1 -0
- package/dist/editor/lib/document/blocks/service/MessagingCards/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/service/MessagingCards/fields.js +1 -0
- package/dist/editor/lib/document/blocks/service/OpeningHours/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/service/OpeningHours/fields.js +1 -0
- package/dist/editor/lib/document/blocks/service/Reviews/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/index.d.ts +1 -1
- package/dist/editor/lib/document/blocks/service/index.js +1 -1
- package/dist/editor/lib/document/config.d.ts +2 -0
- package/dist/editor/lib/document/config.js +1 -1
- package/dist/editor/lib/efficient-block-sources.js +1 -1
- package/dist/editor/lib/header-settings-source.d.ts +2 -1
- package/dist/editor/lib/header-settings-source.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +25 -7
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/editor.css +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +193 -318
- package/dist/links.d.ts +0 -2
- package/dist/links.js +1 -1
- package/dist/render/app/globals.css +41 -13
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/ChatLauncher.js +1 -1
- package/dist/render/components/ContactCards.d.ts +13 -0
- package/dist/render/components/ContactCards.js +1 -0
- package/dist/render/components/CopyText.d.ts +4 -0
- package/dist/render/components/CopyText.js +1 -0
- package/dist/render/components/Events.d.ts +3 -0
- package/dist/render/components/Events.js +1 -1
- package/dist/render/components/FooterMessaging.d.ts +5 -0
- package/dist/render/components/FooterMessaging.js +1 -0
- package/dist/render/components/FooterPayment.d.ts +11 -0
- package/dist/render/components/FooterPayment.js +1 -0
- package/dist/render/components/GalleryItem.js +1 -1
- package/dist/render/components/GalleryShowcase.js +1 -1
- package/dist/render/components/Header.d.ts +2 -1
- package/dist/render/components/Header.js +1 -1
- package/dist/render/components/HeaderCallButton.d.ts +9 -0
- package/dist/render/components/HeaderCallButton.js +1 -0
- package/dist/render/components/MessagingCards.d.ts +9 -0
- package/dist/render/components/MessagingCards.js +1 -0
- package/dist/render/components/OpeningHours.d.ts +12 -0
- package/dist/render/components/OpeningHours.js +1 -0
- package/dist/render/components/QrCode.d.ts +5 -0
- package/dist/render/components/QrCode.js +1 -0
- package/dist/render/components/Reviews.d.ts +14 -4
- package/dist/render/components/Reviews.js +1 -1
- package/dist/render/components/checkout/CheckoutPageClient.d.ts +2 -25
- package/dist/render/components/checkout/CheckoutPageClient.js +1 -3
- package/dist/render/components/checkout/checkout-parts.d.ts +5 -0
- package/dist/render/components/checkout/checkout-parts.js +1 -0
- package/dist/render/components/checkout/checkout-state.d.ts +169 -0
- package/dist/render/components/checkout/checkout-state.js +3 -0
- package/dist/render/components/pdp-dynamic/DynamicGalleryGrid.d.ts +6 -0
- package/dist/render/components/pdp-dynamic/DynamicGalleryGrid.js +1 -1
- package/dist/render/components/pdp-dynamic/RecordPhotoGallery.d.ts +3 -2
- package/dist/render/components/pdp-dynamic/RecordPhotoGallery.js +1 -1
- package/dist/render/lib/api/index.d.ts +1 -0
- package/dist/render/lib/api/types.d.ts +3 -0
- package/dist/render/lib/document/blocks/commerce/GalleryB/render.js +1 -1
- package/dist/render/lib/document/blocks/service/ContactCards/meta.d.ts +7 -0
- package/dist/render/lib/document/blocks/service/ContactCards/meta.js +1 -0
- package/dist/render/lib/document/blocks/service/ContactCards/render.d.ts +4 -0
- package/dist/render/lib/document/blocks/service/ContactCards/render.js +1 -0
- package/dist/render/lib/document/blocks/service/Events/render.js +1 -1
- package/dist/render/lib/document/blocks/service/Footer/meta.js +1 -1
- package/dist/render/lib/document/blocks/service/FooterGroup/meta.js +1 -1
- package/dist/render/lib/document/blocks/service/FooterMessaging/meta.d.ts +2 -0
- package/dist/render/lib/document/blocks/service/FooterMessaging/meta.js +1 -0
- package/dist/render/lib/document/blocks/service/FooterMessaging/render.d.ts +2 -0
- package/dist/render/lib/document/blocks/service/FooterMessaging/render.js +1 -0
- package/dist/render/lib/document/blocks/service/FooterPayment/meta.d.ts +3 -0
- package/dist/render/lib/document/blocks/service/FooterPayment/meta.js +1 -0
- package/dist/render/lib/document/blocks/service/FooterPayment/render.d.ts +2 -0
- package/dist/render/lib/document/blocks/service/FooterPayment/render.js +1 -0
- package/dist/render/lib/document/blocks/service/MessagingCards/meta.d.ts +2 -0
- package/dist/render/lib/document/blocks/service/MessagingCards/meta.js +1 -0
- package/dist/render/lib/document/blocks/service/MessagingCards/render.d.ts +4 -0
- package/dist/render/lib/document/blocks/service/MessagingCards/render.js +1 -0
- package/dist/render/lib/document/blocks/service/OpeningHours/meta.d.ts +11 -0
- package/dist/render/lib/document/blocks/service/OpeningHours/meta.js +1 -0
- package/dist/render/lib/document/blocks/service/OpeningHours/render.d.ts +4 -0
- package/dist/render/lib/document/blocks/service/OpeningHours/render.js +1 -0
- package/dist/render/lib/document/blocks/service/Reviews/meta.d.ts +6 -0
- package/dist/render/lib/document/blocks/service/Reviews/meta.js +1 -1
- package/dist/render/lib/document/blocks/service/Reviews/render.js +1 -1
- package/dist/render/lib/document/blocks/service/metas.d.ts +5 -0
- package/dist/render/lib/document/blocks/service/metas.js +1 -1
- package/dist/render/lib/document/blocks/service/renders.d.ts +5 -0
- package/dist/render/lib/document/blocks/service/renders.js +1 -1
- package/dist/render/lib/document/blocks/text-part-shapes.json +147 -6
- package/dist/render/lib/document/card-templates.d.ts +2 -0
- package/dist/render/lib/document/card-templates.js +1 -0
- package/dist/render/lib/document/footer-page-blocks.d.ts +1 -0
- package/dist/render/lib/document/footer-page-blocks.js +1 -1
- package/dist/render/lib/document/lazy-draws.js +1 -1
- package/dist/render/lib/document/render-config.d.ts +2 -0
- package/dist/render/lib/document/render-config.js +1 -1
- package/dist/render/lib/document/section-to-box-rows-reviews.d.ts +1 -0
- package/dist/render/lib/document/section-to-box-rows-reviews.js +1 -0
- package/dist/render/lib/links/link-rules.d.ts +1 -1
- package/dist/render/lib/links/link-rules.js +1 -1
- package/dist/render/lib/qr.d.ts +5 -0
- package/dist/render/lib/qr.js +1 -0
- package/dist/render/lib/sections/messaging.d.ts +45 -0
- package/dist/render/lib/sections/messaging.js +1 -0
- package/dist/render/lib/sections/opening-hours.d.ts +53 -0
- package/dist/render/lib/sections/opening-hours.js +1 -0
- package/dist/render/lib/sections/reviews.d.ts +1 -0
- package/dist/render/lib/sections/reviews.js +1 -0
- package/dist/render/lib/wheels/catalog-default-layout.js +1 -1
- package/dist/render/lib/wheels/collections.js +1 -1
- package/dist/words.d.ts +51 -12
- package/dist/words.js +4 -4
- package/package.json +4 -4
- package/dist/chunks/EditorPreviewCheckout-HFP2TRRR.js +0 -4
- package/dist/chunks/chunk-CFYEYTU6.js +0 -254
- package/dist/chunks/chunk-YACB7UXA.js +0 -1
- package/dist/chunks/chunk-YTQS5GY6.js +0 -1
- package/dist/render/components/useStorefrontReviews.d.ts +0 -2
- package/dist/render/components/useStorefrontReviews.js +0 -1
- /package/dist/chunks/{chunk-CFYEYTU6.js.LEGAL.txt → chunk-UGXNUQRA.js.LEGAL.txt} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,70 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.74.0 - 2026-10-28
|
|
4
|
+
|
|
5
|
+
**A major for hosts (major version zero, so a minor number):** the peers move to `efficient-web-builder` `^44.0.0` (was `^42.0.0`), `efficient-easel` `^23.1.0` (was `^22.0.0`) and `efficient-shell` `^10.13.0` (was `^10.0.0`), three published names and one published row key go, and the Reviews props narrow. **0.71.0, 0.72.0 and 0.73.0 were written but never published:** npm goes from 0.70.0 to this release, which carries their sections below.
|
|
6
|
+
|
|
7
|
+
- **BREAKING: builder 43, easel 23, shell 10.13** (#263, Victor Mau). Peer and dev, here and in `package/`: builder 43 asks easel `^23.0.0` and shell `^10.13.0`. The `links` and `words` entries may read efficient-shell's pure `format` entry (the slug is the shell's `slugify`) and the builder's `lib/non-empty-string`; the light-entry check now refuses only a cycle, not a shell chunk reached by two allowed paths. Byte changes, each traced to its builder PR: a section that stores no width follows the site (#322); a Box draws its stored padding plus the frame's 24px on its root (#344); a button with no padding of its own is 24px each side (was 22; #351); new settings declared (Text/Button `consentWords`, Button fill opacity, border, padding; Box shadow and tab shape; Logos; a Hero slide's `loadingShows` and `videoFrame`). **Visible on screens wider than the site:** Product Hero follows the site's Content width, and EU Tyre Label's band the site's Background width. The dev builder is 43.0.1 (#264: its media manifest names the Hero slide's `videoFrame`); the peer stays `^43.0.0`.
|
|
8
|
+
- **BREAKING: web-builder 44** (#266; peer and dev `^44.0.0`, was `^43.0.0` from #263 above; easel and shell do not move). 44 removed names these blocks used, so they do not run on a 43 builder. `components/ChatLauncher` hides on phones under the builder's one phone query, `PHONE_MEDIA` (`render/lib/content/view-values`), in place of the removed `PART_PHONE_MAX_CSS`. Guards read `section-padding` from the render side and pass `sectionPadAttrs` one `PadValues`, and follow 44's behaviour: the Hero picture is an engine part (the first press picks the Hero, the next the Image), Clear formatting is the shell toolbar's (shown only when a mark can be taken off), a `PartNeedle` has a `label`, and `LABEL_GROUP`'s `Schedule` and `Placement` are filed ahead for the popup panel.
|
|
9
|
+
- **BREAKING: Reviews takes every feature of Testimonials** (#242; merge group 6, plan 2026-10-23 §4.1). One "Review content" row: Manual (typed reviews `items[]`: quote, title, name, role, rating; the list is "Typed reviews", shown for Manual only) or Product reviews (the backend's `product-reviews` block source, rows served with the page; the key is `PRODUCT_REVIEWS_SOURCE`, `lib/sections/reviews`). A fresh drop reads the store's reviews, as before. Reviews has a card template (the builder's `template` slot); an empty template draws the built-in card, and the row fields every storefront data block offers are declared once, in `lib/document/card-templates`. An empty Reviews draws its head in the editor and nothing on a published page. **Removed:** `render/components/useStorefrontReviews` (the browser fetch; a host reads the `product-reviews` source); `ReviewsProps` loses `limit`, `designCode` and its `= {}` default; the product filter is `dataSourceOptions.designCode` only, and a top-level `designCode` is no longer read. **efficient-storefront:** `lib/tyres/reviews-hydrate.ts` must write `dataSource: "product-reviews"` and `dataSourceOptions.designCode` in the bump that takes this release.
|
|
10
|
+
- **The Testimonials Box row** (`lib/document/section-to-box-rows-reviews`, both registries, `on: false`): a Testimonials node becomes a Box with a Heading Box of Text and a Reviews block holding its quotes as Manual reviews, its card template seeded with the old quote card. Dry run over the read-only export of 2026-10-26: 5 nodes, 0 keys dropped. Look gaps are listed in the module.
|
|
11
|
+
- **BREAKING: the `links` entry no longer exports `slugifyAnchor`** (#247; the builder's deprecated alias of the shell's `slugify`; no host calls it). Call `slugify` from `efficient-shell/format`.
|
|
12
|
+
- **A slug is the shell's** (#247; `slugify` from `efficient-shell/format`, shell #603; duplicate re-check 2026-10-26, row R04). The Gallery's placeholder label (`GalleryShowcase`) and `GalleryItem` drop their own copies of the rule, the wheel collections (`lib/wheels/collections`) import the shell's `slugify` instead of the builder's forwarder, and the Contact routing fields call `slugify` in place of the builder's deprecated `slugifyGroupId`. Same slug for every name (old against new, 30,006 names). **`slugifyProcess` is deprecated**: it only hands its argument to `slugify`; the blocks' five calls call `slugify`, and the name stays for efficient-storefront's route `app/wheels/collections/[process]/page.tsx` until that route moves.
|
|
13
|
+
- **BREAKING: `SiteThemeRow` loses `card_theme_index`** (`package/src/public.d.ts`), as builder 43 removed it (#350).
|
|
14
|
+
- **BREAKING: easel `^23.1.0`, and `PREVIEW_HEADER_PICK_CSS` is no longer exported** (`editor/components/PreviewHeader`; #251). **The editor's header draws no selection box of its own** (GG 2026-10-26, issue list C8: the editor draws every selection box once). `PreviewHeader` drew a 2px outline on hover and when selected and caught the click itself, so efficient-easel never saw it. The outline, the marker and the click are gone: the Header is a document node, so the canvas selects it, draws its box with the label "Header", and opens the Header panel. Needs efficient-easel 23.1.0 (its nested-wrapper `drawnBox` and the #380 host tokens). No host imports the removed name (search 2026-10-28; efficient-storefront's only copy is its vendored copy of this package).
|
|
15
|
+
- **Payment Logos, the ways to pay as their marks** (`FooterPayment`, #262, Victor Mau, look B). "We accept", then the ways to pay as small marks on one line that wraps between marks, in the footer's own ink, drawn with efficient-shell's `paymentMarks` and `PaymentMark`. Typed methods, or read as the page is served from a source the host declares (`location-payment-methods`, `shop-payment-methods`; efficient-backend#3940); a picked source hides the typed list; served none, nothing on a published page. Its page twin `PaymentLogosBlock` lets a Box footer carry it. Registered in the `Footer` and `FooterGroup` slots.
|
|
16
|
+
- **The checkout is drawn from one state and five named parts. No look change** (#248). `components/checkout/checkout-state` holds the state in one provider (`CheckoutStateProvider`, `useCheckout`; `buildPayOptions` moved with it); `components/checkout/checkout-parts` holds `CheckoutContact`, `CheckoutShippingAddress`, `CheckoutShippingMethod`, `CheckoutPayment` and `CheckoutOrderSummary` (moved, not copied). The static markup is byte for byte the same.
|
|
17
|
+
- New editor words to translate: "We accept", "Payment Logos", "Add the ways you take payment", "Bank transfer", "Shadow", "Tab shape", "Large tabs", "Two, then threes", "Logo style", "Icon at the far end", "Video frame", "This video has no frame yet. The slide shows its background colour until one is made.", "Page width", "This page", "This page has no look of its own to set.", "Page settings for “{name}”", "Select a section or block to edit it.", "Set by country", "Choose an image", "Words", "direction", "tabs", "Review content", "Typed reviews". Gone: "Edit “{name}” in {place}", "Page settings", "Payment method", "the admin", "Clear formatting" (web-builder 44 draws the shell's).
|
|
18
|
+
- Guards: new `scripts/test-header-draws-no-box.tsx` (#251), `scripts/test-footer-payment.tsx` (#262), `scripts/test-checkout-parts.tsx` (#248), `scripts/test-reviews-section-to-box.tsx` (#242), `scripts/test-slug-is-the-shells.ts` (#247: no copy of the slug rule, no alias, no builder slug alias); `scripts/test-reviews-takes-testimonials.tsx` follows #242; `scripts/test-shell-peer-range.ts` pins the new ranges (builder `^44.0.0`, #266).
|
|
19
|
+
|
|
20
|
+
## 0.73.0 - 2026-10-27
|
|
21
|
+
|
|
22
|
+
**A minor for hosts:** a new row key on "Latest Posts" (`tags`), no peer range change. No editor words.
|
|
23
|
+
|
|
24
|
+
- **A card can carry chips** (`tags` on a served row of "Latest Posts"; Victor Mau approved the look 2026-10-27). A list of words drawn as small outlined chips on one line that clips rather than wraps, at most four: on a portrait or spread card under her hours, and under the card of the even grid. The venue roster's and Everyone's cards say her background, her age and her first languages there, served by efficient-backend (`workshop.public_sources`, efficient-backend#3942). Read off the raw rows as `facets` is (the builder's row reader keeps words only). A card with no chips draws exactly what it drew before; a section stored before is unchanged.
|
|
25
|
+
- Guard: new `scripts/test-events-card-tags.tsx`.
|
|
26
|
+
|
|
27
|
+
## 0.72.0 - 2026-10-27
|
|
28
|
+
|
|
29
|
+
**A minor for hosts:** three new blocks and a new runtime dependency, `qrcode` (MIT, 1.5.4; a host that compiles `src/` adds it too). No peer range change. New editor words to translate: the blocks' labels ("Messaging cards", "Messaging Strip", "Contact cards"), their rows ("Apps from", "Contacts", "Reach by", "Number or ID") and their placeholders ("Message us", "Who to ask").
|
|
30
|
+
|
|
31
|
+
- **A venue's messaging apps and contacts, each with a QR code drawn as the page is drawn** (Victor Mau approved the look 2026-10-27; the old Foyerboard site's Contact and Employment pages). `MessagingCards` (service set): one card per app the venue offers (WeChat, Telegram, WhatsApp, LINE), its QR code, its handle and "Open <app>"; WeChat, which no link opens, offers "Copy ID". `FooterMessaging` (footer): the same apps' codes small, with their names; a look's footer carries it (efficient-backend touch-up), and it joins the Footer and Footer group slots' Add lists once the builder's catalogue rules it. Both read the source `site-messaging` (efficient-backend: the website's social settings, a separate pull request); rows `app`, `name`, `handle`, `href`, `qr`, and only an http(s) link is ever drawn. `ContactCards` (service set): the Employment page's people to ask, typed in the editor as page content (at most eight; phone, email, WhatsApp, LINE, Telegram, WeChat, KakaoTalk), read the way the old site read them, a contact that does not read left off. QR codes are one SVG path, black on white in every look (`lib/qr`, `components/QrCode`); nothing is fetched. A published page with nothing to show draws nothing; the editor draws a sample. Not yet in the builder's catalogue (`scripts/registered-not-catalogued.ts`).
|
|
32
|
+
- Guard: new `scripts/test-messaging-blocks.tsx`.
|
|
33
|
+
|
|
34
|
+
## 0.71.0 - 2026-10-27
|
|
35
|
+
|
|
36
|
+
**A minor for hosts:** a new header setting, no peer range change. New editor words to translate: `Call`, `Call button` and its hint.
|
|
37
|
+
|
|
38
|
+
- **The header can call the venue** (Victor Mau approved the mockup 2026-10-27, from the old Foyerboard venue site's header). With the Header's new **Call button** switch on (`call_button`, efficient-backend, a separate pull request), the bar draws a button in the site's button colours: "Call" on a phone (beside the menu button), the number on a wider screen (after the tools). The number and its `tel:` link are the backend's (`GET /header-settings` `callPhone` / `callHref`), read from the location the website shows as the header is served; without a number there is no button. The editor has no number, so its preview draws "Call" on the switch alone. New `components/HeaderCallButton`; `HeaderSettings` gains the three optional keys (an older backend sends none, which is no button).
|
|
39
|
+
- Guard: new `scripts/test-header-call-button.tsx`; `test-header-panel-tabs.tsx` and `test-every-button-follows-the-button-colour.ts` count the new row and the new button.
|
|
40
|
+
|
|
41
|
+
## 0.70.0 - 2026-10-27
|
|
42
|
+
|
|
43
|
+
**A major for hosts (major version zero, so a minor number):** the peers move to `efficient-web-builder` `^42.0.0` and `efficient-easel` `^22.0.0` (`efficient-shell` stays `^10.0.0`). Builder 42 and easel 22 removed every name of the retired editor library, so a host moves to those with this release.
|
|
44
|
+
|
|
45
|
+
- **The blocks say nothing of the retired editor library.** Comments, guard names and docs now speak of "the editor"; the one name kept is the legacy `X-Puck-Media-Manifest` header, still sent beside `X-Media-Manifest` because the backend accepts it and production has not yet been checked. A later release drops it.
|
|
46
|
+
- **`SiteThemeRow` has `card_theme_index`** (builder 42's theme row): the published declarations say so. The editor words are regenerated against builder 42's catalogue.
|
|
47
|
+
- Guard: `scripts/test-document-names.ts` now fails on the word anywhere in a tracked file but the changelog, the guard's own patterns, the legacy header and history notes.
|
|
48
|
+
|
|
49
|
+
- **The site sheet draws a padding's tablet value** (three-views plan 2026-10-23, PR 3a; GG 2026-10-26). `app/globals.css` gets the Tablet view's block, `@media (min-width: 720px) and (max-width: 1099.98px)`: `.sf-pad-top-tablet`, `-bottom-`, `-left-`, `-right-` read `--sf-pad-t-tablet` and its three siblings, `!important` over the inline desktop padding, as the phone block does. efficient-web-builder emits these classes only for a side whose tablet value is drawn, so no stored page changes. Guard: new `scripts/test-tablet-padding-css.ts` (red first: 12 of 28 checks).
|
|
50
|
+
- **The Customer Photo Grid can show the website's own pictures** (a venue's gallery; Victor Mau approved the look 2026-10-27). `GalleryB` takes a block source (`dataSource`, the "Image source" row; efficient-backend `site-pictures`, a separate pull request: the website's pictures and videos in their owner's order, up to 24, each row `key`, `cover` and, for a video, `video`). On a source the typed tiles are not drawn (they stay stored and come back with "Images typed here"): every served picture is a tile of one size, three across for a three-across layout and four otherwise (two on a phone), at most `limit` of them (new "Images to show" row, 1-24, shown on a source only), and one lightbox walks them all, looping, where a video plays with its controls and still, never by itself. Served none, a published page draws nothing; the editor draws empty boxes. `RecordPhotoGallery` gains `fit="tiles"` and `across` for it. **Editor words to translate:** "Image source", "Images typed here", "Images to show" and the empty grid's hint.
|
|
51
|
+
- Guard: new `scripts/test-gallery-site-pictures.tsx`.
|
|
52
|
+
|
|
53
|
+
## 0.69.1 - 2026-10-27
|
|
54
|
+
|
|
55
|
+
- **The Header's Width row is `Full width | Content width`**, the one order every width row has (GG for Lewis, 2026-10-26): it drew `Content width | Full width` while every section's two Width rows and the Footer draw Full width first. It reads the order from efficient-web-builder's `SECTION_WIDTH_CHOICES` now, so it cannot drift again. The stored values do not change (`full`, and `page` for Content width). Guard: new `scripts/test-header-width-order.ts` (red first: the labels came in the other order).
|
|
56
|
+
- **Phone-only rows are rows of the phone view only, with no "mobile" in their words** (Lewis, 2026-10-27: he still saw "Show as accordion on mobile" in the desktop view; his ruling of 2026-10-08: no "(phone)" rows, a phone value is set in the phone view, on the same row). Three rows are now gated with easel's `deviceField("mobile", …)`: the footer Menu's accordion row (now `Show as accordion`), the footer Divider's hide row (now `Hide`, the builder's own word, with the builder's icon) and the popup's `On a phone` heading and its `Left panel` row. Stored values and keys are unchanged (`accordionMobile`, `hideOnMobile`, `valuePanelOnPhone`; `deviceField` only gates the paint of the same field), so no saved page changes and no stored content moves. **Editor words to translate:** `Show as accordion` is new; `Show as accordion on mobile` and `Hide on mobile` are gone.
|
|
57
|
+
- Guard: new `scripts/test-phone-rows-in-phone-view.tsx` (red first: 16 of 29 checks failed on main; also scans this package's editor files for a row label with a device word).
|
|
58
|
+
- **The page Menu's `Show links` row sits under the Menu it picks from** (Lewis, 2026-10-26: the row was the last one in the Design group, under Link alignment). Which links the block draws is what is in it, so the row is in the Content run at the top of the panel, right under `Menu`, and no longer in the Design group (Wix structure, Lewis 2026-10-08). Stored value and page unchanged. The `From` and `To` words drawn on top of the numbers ("Fro1m") are the shell number box's fixed prefix room, fixed in efficient-shell (a word prefix gets its own room). The host's installed `efficient-shell` draws that box, so no release of this package is needed for it: the host takes the shell release.
|
|
59
|
+
- Guard: `scripts/test-box-header-arrangement.tsx` §5 (red first: 2 checks failed on main, `linkRange` was the last field after `_dDesign`).
|
|
60
|
+
|
|
61
|
+
## 0.69.0 - 2026-10-27
|
|
62
|
+
|
|
63
|
+
**A minor for hosts:** a new block, no peer range change. New editor words to translate: the block's rows ("Hours from") and its two shows ("Open now badge", "The week").
|
|
64
|
+
|
|
65
|
+
- **Opening hours: an "Open now" badge, or the week with today marked** (`OpeningHours`, service set; Victor Mau approved the look 2026-10-27). Its row is read as the page is served from the source `location-opening` (efficient-backend, a separate pull request) and never stored in the page; a new block names that source. At most one row, all text: `week`, `day:opens-closes` periods joined by `;` (day 0-6 from Monday, minutes from that day's local midnight, `closes` up to 2879 past midnight); `zone`, the place's IANA zone; `hours`, plain text lines. A missing key reads as "". `show` picks the draw (default `week`). The week: the title, then Monday to Sunday with each day's periods as 12-hour times, "Closed" muted, today accent-tinted and marked "· today". With no week, the `hours` lines under the title; with neither, nothing. The badge: "Open now · until 3 am", "Closed · opens today 10 am", "Closed · opens Tue 10 am" or "Closed"; no week, nothing. The time is the visitor's clock in the place's zone (an unknown zone: the browser's own), read after mount and every 30 seconds, so the server's markup has no today and an invisible badge; open now is the backend's rule (`system/opening_week.status`). A period the backend would refuse is left out. The editor draws the host's sample for `location-opening` (declared in `lib/efficient-block-sources`) or the block's own, at a fixed Monday 8 pm. The shopper's words are in one place (`OPENING_WORDS`). New `components/OpeningHours`, `lib/sections/opening-hours`. Not yet in the builder's catalogue (`scripts/registered-not-catalogued.ts`); `contained` defaults on.
|
|
66
|
+
- Guard: new `scripts/test-opening-hours-source.tsx`.
|
|
67
|
+
|
|
3
68
|
## 0.68.0 - 2026-10-27
|
|
4
69
|
|
|
5
70
|
**A major for hosts (major version zero, so a minor number):** the peers move to `efficient-web-builder` `^41.0.0`, `efficient-easel` `^21.1.0` and `efficient-shell` `^10.0.0` (all three narrowed; builder 41 needs easel 21, which needs shell 10). A host moves to those with this release. The package is built against efficient-web-builder 41.0.0. Phase 3 of retiring the editor library's old name; nothing saved changes, and a page published before still draws.
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Published as `efficient-web` up to 0.3.0 and as `efficient-web-builder` from
|
|
|
10
10
|
says how to migrate). The name `efficient-web-builder` now belongs to the
|
|
11
11
|
builder alone, published from its own repository
|
|
12
12
|
([`Efficient-Pty-Ltd/efficient-web-builder`](https://github.com/Efficient-Pty-Ltd/efficient-web-builder)):
|
|
13
|
-
|
|
13
|
+
The editor, the general sections and the renderer, with no storefront in it.
|
|
14
14
|
|
|
15
15
|
It is not a second copy of anything: `build.mjs` compiles this repository's
|
|
16
16
|
`src/` (the storefront's blocks, editor session and API client), starting at
|
|
@@ -92,7 +92,7 @@ const backend: WebsiteBackend = {
|
|
|
92
92
|
`pages.remove` (inline in the page list), `lock` (the "somebody else is
|
|
93
93
|
editing" notices and take-over), `site.update` (the Maps key), `preview`
|
|
94
94
|
(the Preview link; with `draftLink`, Preview opens the saved draft), `sectionTemplates`, `templates`. A missing group is never
|
|
95
|
-
a dead button:
|
|
95
|
+
a dead button: The editor does not draw what it cannot do.
|
|
96
96
|
- **Failures are kinds.** Reject with `WebsiteBackendError`: `unauthorized`,
|
|
97
97
|
`changed-elsewhere` (+ `conflict`), `lock-taken` (+ `holder`), `not-found`,
|
|
98
98
|
`invalid`, `unavailable`. The editor never reads a status code or a body.
|
|
@@ -301,8 +301,8 @@ const Roster: ComponentConfig = {
|
|
|
301
301
|
label: "Roster",
|
|
302
302
|
fields: { heading: { type: "text", label: "Heading" } },
|
|
303
303
|
defaultProps: { heading: "On tonight" },
|
|
304
|
-
// `
|
|
305
|
-
render: ({ heading,
|
|
304
|
+
// `editor.metadata` is whatever you hand the editor as `blocks.metadata`.
|
|
305
|
+
render: ({ heading, editor }) => <RosterSection heading={heading} people={editor.metadata.roster} />,
|
|
306
306
|
};
|
|
307
307
|
|
|
308
308
|
const blocks: WebsiteEditorBlocks = {
|
|
@@ -336,7 +336,7 @@ const blocks: WebsiteEditorBlocks = {
|
|
|
336
336
|
- **Your own blocks.** Written as the engine's `ComponentConfig`, with its
|
|
337
337
|
field types (`text`, `textarea`, `number`, `select`, `radio`, `array`,
|
|
338
338
|
`object`, `custom`, `slot`). A type the editor already registers is refused —
|
|
339
|
-
|
|
339
|
+
The editor throws when it mounts — so give yours a prefix. A block is added
|
|
340
340
|
from the Add panel, in the group `categories` names; one named in no group is
|
|
341
341
|
registered and offered nowhere, and none is offered inside a Box. A
|
|
342
342
|
`categories` entry whose `key` is an existing group (`content`, `structure`,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use client";import{$ as Ht,K as _t,L as Dt,M as Mt,N as Ut,O as Wt,P as ae,R as Le,S as $t,T as Kt,U as We,V as Yt,X as rt,Z as zt,_ as Bt,a as Tt,b as qt,c as jt,d as Ft,ea as Gt,ja as Vt,ka as Jt,na as at,pa as H,w as Ue}from"./chunk-BZDVZUF4.js";import{i as Ae,o as xe,v as _}from"./chunk-QJDTP7K6.js";import{Aa as Lt,a as At,c as re}from"./chunk-UJW4B64R.js";import{k as Ot,l as Ie,m as Z}from"./chunk-5OFEWRWI.js";import{a as nt,b as Rr}from"./chunk-Y6SLVHK3.js";var Zt=nt((Ia,Xt)=>{"use strict";var Ir="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";Xt.exports=Ir});var nn=nt((Aa,tn)=>{"use strict";var Ar=Zt();function Qt(){}function en(){}en.resetWarningCache=Qt;tn.exports=function(){function e(r,a,o,c,p,u){if(u!==Ar){var s=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 s.name="Invariant Violation",s}}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:en,resetWarningCache:Qt};return n.PropTypes=n,n}});var an=nt((Ta,rn)=>{"use strict";rn.exports=nn()();var La,Oa});import{useEffect as tr,useMemo as Zn,useRef as qe,useState as ye}from"react";var A=Rr(an(),1);import P from"react";function on(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 Lr(e){if(Array.isArray(e))return e}function pn(e,t,n){return(t=_r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Or(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,o,c,p=[],u=!0,s=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(u=(r=o.call(n)).done)&&(p.push(r.value),p.length!==t);u=!0);}catch(d){s=!0,a=d}finally{try{if(!u&&n.return!=null&&(c=n.return(),Object(c)!==c))return}finally{if(s)throw a}}return p}}function Tr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function cn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sn(Object(n),!0).forEach(function(r){pn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sn(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function qr(e,t){if(e==null)return{};var n,r,a=jr(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function jr(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 dn(e,t){return Lr(e)||Or(e,t)||Dr(e,t)||Tr()}function Fr(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 _r(e){var t=Fr(e,"string");return typeof t=="symbol"?t:t+""}function ot(e){"@babel/helpers - typeof";return ot=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},ot(e)}function Dr(e,t){if(e){if(typeof e=="string")return on(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)?on(e,t):void 0}}var D=function(t,n,r){var a=!!r,o=P.useRef(r);P.useEffect(function(){o.current=r},[r]),P.useEffect(function(){if(!a||!t)return function(){};var c=function(){if(o.current)return o.current.apply(o,arguments)};return t.on(n,c),function(){t.off(n,c)}},[a,n,t,o])},it=function(t){var n=P.useRef(t);return P.useEffect(function(){n.current=t},[t]),n.current},Ce=function(t){return t!==null&&ot(t)==="object"},Mr=function(t){return Ce(t)&&typeof t.then=="function"},Ur=function(t){return Ce(t)&&typeof t.elements=="function"&&typeof t.createToken=="function"&&typeof t.createPaymentMethod=="function"&&typeof t.confirmCardPayment=="function"},ln="[object Object]",Wr=function e(t,n){if(t===n)return!0;if(!Ce(t)||!Ce(n))return t===n;var r=Array.isArray(t),a=Array.isArray(n);if(r!==a)return!1;var o=Object.prototype.toString.call(t)===ln,c=Object.prototype.toString.call(n)===ln;if(o!==c)return!1;if(!o&&!r)return t===n;var p=Object.keys(t),u=Object.keys(n);if(p.length!==u.length)return!1;for(var s={},d=0;d<p.length;d+=1)s[p[d]]=!0;for(var f=0;f<u.length;f+=1)s[u[f]]=!0;var k=Object.keys(s);if(k.length!==p.length)return!1;var m=t,I=n,b=function(V){return e(m[V],I[V])};return k.every(b)},mn=function(t,n,r){return Ce(t)?Object.keys(t).reduce(function(a,o){var c=!Ce(n)||!Wr(t[o],n[o]);return r.includes(o)?(c&&console.warn("Unsupported prop change: options.".concat(o," is not a mutable property.")),a):c?cn(cn({},a||{}),{},pn({},o,t[o])):a},null):null},fn="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.",un=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:fn;if(t===null||Ur(t))return t;throw new Error(n)},$r=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:fn;if(Mr(t))return{tag:"async",stripePromise:Promise.resolve(t).then(function(a){return un(a,n)})};var r=un(t,n);return r===null?{tag:"empty"}:{tag:"sync",stripe:r}},Kr=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"}))},$e=P.createContext(null);$e.displayName="ElementsContext";var gn=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},ct=function(t){var n=t.stripe,r=t.options,a=t.children,o=P.useMemo(function(){return $r(n)},[n]),c=P.useState(function(){return{stripe:o.tag==="sync"?o.stripe:null,elements:o.tag==="sync"?o.stripe.elements(r):null}}),p=dn(c,2),u=p[0],s=p[1];P.useEffect(function(){var k=!0,m=function(b){s(function(w){return w.stripe?w:{stripe:b,elements:b.elements(r)}})};return o.tag==="async"&&!u.stripe?o.stripePromise.then(function(I){I&&k&&m(I)}):o.tag==="sync"&&!u.stripe&&m(o.stripe),function(){k=!1}},[o,u,r]);var d=it(n);P.useEffect(function(){d!==null&&d!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[d,n]);var f=it(r);return P.useEffect(function(){if(u.elements){var k=mn(r,f,["clientSecret","fonts"]);k&&u.elements.update(k)}},[r,f,u.elements]),P.useEffect(function(){Kr(u.stripe)},[u.stripe]),P.createElement($e.Provider,{value:u},a)};ct.propTypes={stripe:A.default.any,options:A.default.object};var yn=function(t){var n=P.useContext($e);return gn(n,t)},hn=function(){var t=yn("calls useElements()"),n=t.elements;return n},Yr=function(t){var n=t.children,r=yn("mounts <ElementsConsumer>");return n(r)};Yr.propTypes={children:A.default.func.isRequired};var zr=P.createContext(null);zr.displayName="CheckoutContext";var vn=P.createContext(null);vn.displayName="CheckoutSdkContext";var st=function(t){var n=P.useContext(vn),r=P.useContext($e);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 gn(r,t)},Br=["mode"],Hr=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},L=function(t,n,r){var a="".concat(Hr(t),"Element"),o=function(s){var d=s.id,f=s.className,k=s.options,m=k===void 0?{}:k,I=s.onBlur,b=s.onFocus,w=s.onReady,V=s.onChange,N=s.onEscape,T=s.onClick,M=s.onLoadError,z=s.onLoaderStart,J=s.onNetworksChange,U=s.onConfirm,ee=s.onCancel,he=s.onShippingAddressChange,te=s.onShippingRateChange,ve=s.onSavedPaymentMethodRemove,ue=s.onSavedPaymentMethodUpdate,g=s.onAvailablePaymentMethodsChange,ie=st("mounts <".concat(a,">")),se="elements"in ie?ie.elements:null,B="checkoutSdk"in ie?ie.checkoutSdk:null,Se=P.useState(null),be=dn(Se,2),q=be[0],Pe=be[1],W=P.useRef(null),pe=P.useRef(null);D(q,"blur",I),D(q,"focus",b),D(q,"escape",N),D(q,"click",T),D(q,"loaderror",M),D(q,"loaderstart",z),D(q,"networkschange",J),D(q,"confirm",U),D(q,"cancel",ee),D(q,"shippingaddresschange",he),D(q,"shippingratechange",te),D(q,"savedpaymentmethodremove",ve),D(q,"savedpaymentmethodupdate",ue),D(q,"availablepaymentmethodschange",g),D(q,"change",V);var de;w&&(t==="expressCheckout"?de=w:de=function(){w(q)}),D(q,"ready",de),P.useLayoutEffect(function(){if(W.current===null&&pe.current!==null&&(se||B)){var E=null;if(B){var $=B,we=B;switch(t){case"paymentForm":E=we.createForm(m);break;case"payment":E=$.createPaymentElement(m);break;case"address":if("mode"in m){var me=m.mode,Ne=qr(m,Br);if(me==="shipping")E=$.createShippingAddressElement(Ne);else if(me==="billing")E=$.createBillingAddressElement(Ne);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":E=$.createExpressCheckoutElement(m);break;case"currencySelector":E=B.createCurrencySelectorElement();break;case"taxId":E=$.createTaxIdElement(m);break;case"contactDetails":E=$.createContactDetailsElement();break;case"linkSignup":if("createLinkSignupElement"in B)E=B.createLinkSignupElement(m);else throw new Error("<LinkSignupElement> requires <CheckoutElementsProvider> and is not supported inside <CheckoutFormProvider>.");break;case"terms":E=$.createTermsElement(m);break;default:throw new Error("<".concat(a,"> is not supported inside a checkout provider. Use an <Elements> provider instead."))}}else se&&(E=se.create(t,m));W.current=E,Pe(E),E&&E.mount(pe.current)}},[se,B,m]);var j=it(m);return P.useEffect(function(){if(W.current){var E=mn(m,j,["paymentRequest"]);E&&"update"in W.current&&W.current.update(E)}},[m,j]),P.useLayoutEffect(function(){return function(){if(W.current&&typeof W.current.destroy=="function")try{W.current.destroy(),W.current=null}catch{}}},[]),P.createElement("div",{id:d,className:f,ref:pe})},c=function(s){st("mounts <".concat(a,">"));var d=s.id,f=s.className;return P.createElement("div",{id:d,className:f})},p=n?c:o;return p.propTypes={id:A.default.string,className:A.default.string,onChange:A.default.func,onBlur:A.default.func,onFocus:A.default.func,onReady:A.default.func,onEscape:A.default.func,onClick:A.default.func,onLoadError:A.default.func,onLoaderStart:A.default.func,onNetworksChange:A.default.func,onConfirm:A.default.func,onCancel:A.default.func,onShippingAddressChange:A.default.func,onShippingRateChange:A.default.func,onSavedPaymentMethodRemove:A.default.func,onSavedPaymentMethodUpdate:A.default.func,onAvailablePaymentMethodsChange:A.default.func,options:A.default.object},p.displayName=a,p.__elementType=t,p},O=typeof window>"u",Gr=P.createContext(null);Gr.displayName="EmbeddedCheckoutProviderContext";var bn=function(){var t=st("calls useStripe()"),n=t.stripe;return n},ja=L("auBankAccount",O),Fa=L("card",O),_a=L("cardNumber",O),Da=L("cardExpiry",O),Ma=L("cardCvc",O),Ua=L("currencySelector",O),Wa=L("iban",O),xn=L("payment",O),$a=L("expressCheckout",O),Ka=L("paymentRequestButton",O),Ya=L("linkAuthentication",O),za=L("linkSignup",O),Ba=L("contactDetails",O),Ha=L("address",O),Ga=L("shippingAddress",O),Va=L("paymentMethodMessaging",O),Ja=L("taxId",O),Xa=L("issuingCardNumberDisplay",O),Za=L("issuingCardCvcDisplay",O),Qa=L("issuingCardExpiryDisplay",O),eo=L("issuingCardPinDisplay",O),to=L("issuingCardCopyButton",O),no=L("terms",O);function ze(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ze=function(t){return typeof t}:ze=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ze(e)}var Sn="dahlia",Vr=function(t){return t===3?"v3":t},Pn="https://js.stripe.com",Jr="".concat(Pn,"/").concat(Sn,"/stripe.js"),Xr=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Zr=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,Cn="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",Qr=function(t){return Xr.test(t)||Zr.test(t)},ea=function(){for(var t=document.querySelectorAll('script[src^="'.concat(Pn,'"]')),n=0;n<t.length;n++){var r=t[n];if(Qr(r.src))return r}return null},kn=function(t){var n=t&&!t.advancedFraudSignals?"?advancedFraudSignals=false":"",r=document.createElement("script");r.src="".concat(Jr).concat(n);var a=document.head||document.body;if(!a)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return a.appendChild(r),r},ta=function(t,n){!t||!t._registerWrapper||t._registerWrapper({name:"stripe-js",version:"9.17.0",startTime:n})},Oe=null,Ke=null,Ye=null,na=function(t){return function(n){t(new Error("Failed to load Stripe.js",{cause:n}))}},ra=function(t,n){return function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))}},aa=function(t){return Oe!==null?Oe:(Oe=new Promise(function(n,r){if(typeof window>"u"||typeof document>"u"){n(null);return}if(window.Stripe&&t&&console.warn(Cn),window.Stripe){n(window.Stripe);return}try{var a=ea();if(a&&t)console.warn(Cn);else if(!a)a=kn(t);else if(a&&Ye!==null&&Ke!==null){var o;a.removeEventListener("load",Ye),a.removeEventListener("error",Ke),(o=a.parentNode)===null||o===void 0||o.removeChild(a),a=kn(t)}Ye=ra(n,r),Ke=na(r),a.addEventListener("load",Ye),a.addEventListener("error",Ke)}catch(c){r(c);return}}),Oe.catch(function(n){return Oe=null,Promise.reject(n)}))},oa=function(t,n,r){if(t===null)return null;var a=n[0];if(typeof a!="string")throw new Error("Expected publishable key to be of type string, got type ".concat(ze(a)," instead."));var o=a.match(/^pk_test/),c=Vr(t.version),p=Sn;o&&c!==p&&console.warn("Stripe.js@".concat(c," was loaded on the page, but @stripe/stripe-js@").concat("9.17.0"," expected Stripe.js@").concat(p,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var u=t.apply(void 0,n);return ta(u,r),u},Te,wn=!1,Nn=function(){return Te||(Te=aa(null).catch(function(t){return Te=null,Promise.reject(t)}),Te)};Promise.resolve().then(function(){return Nn()}).catch(function(e){wn||console.warn(e)});var En=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];wn=!0;var a=Date.now();return Nn().then(function(o){return oa(o,n,a)})};import{createContext as ga,useContext as ya,useEffect as Y,useMemo as Mn,useRef as Un,useState as y}from"react";var ia="sf:gclid",sa="sf:fbclid",ca=2160*60*60*1e3;function An(){return typeof window<"u"}function Rn(e){let t=Ie.getItem(e);if(!t)return"";try{let{v:n,t:r}=JSON.parse(t);return!n||typeof r!="number"||Date.now()-r>ca?"":n}catch{return""}}function In(e){if(!An())return"";let t=e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1"),n=document.cookie.match(new RegExp(`(?:^|; )${t}=([^;]*)`));return n?decodeURIComponent(n[1]):""}function Ln(){if(!An())return{};let e=Rn(ia),t=Rn(sa),n=In("_fbp"),r=In("_fbc");!r&&t&&(r=`fb.1.${Date.now()}.${t}`);let a={};return e&&(a.gclid=e),t&&(a.fbclid=t),n&&(a.fbp=n),r&&(a.fbc=r),a}var On="sf:meta-purchases",la=20;function qn(){return typeof window>"u"||window.parent!==window}function ua(...e){try{if(qn()||typeof window.fbq!="function")return;window.fbq(...e)}catch{}}var Tn=new Set;function pa(e){if(Tn.has(e))return!1;Tn.add(e);try{let t=JSON.parse(Ie.getItem(On)??"[]");if(t.includes(e))return!1;Ie.setItem(On,JSON.stringify([...t,e].slice(-la)))}catch{}return!0}function da(e){return[...new Set(e.filter(Le).flatMap(t=>t.components.map(n=>n.partNumber)))]}function jn(e){let t=e.confirmation;qn()||!pa(t.orderNumber)||ua("track","Purchase",{value:Number(t.grandTotal),currency:t.currency,content_type:"product",content_ids:da(e.lines)},{eventID:t.orderNumber})}var lt="checkout-afterpay-context",Be="checkout-gocardless-context",ut="checkout-zip-context",He="checkout-klarna-context";function ma({evidence:e,parked:t}){return e?{action:"capture",evidence:e,parked:t}:t?{action:"settle",parked:t}:{action:"ignore"}}function fa(e,t){let n=e.getItem(t);if(e.removeItem(t),!n)return null;try{return JSON.parse(n)}catch{return null}}var Fn={name:"Afterpay",legParam:"afterpay",legValues:["confirm","cancel"],storageKey:lt,evidenceFrom(e,t){return t==="cancel"||(e.get("status")??"").toUpperCase()==="CANCELLED"?null:e.get("orderToken")},requestFrom:e=>({token:e})},_n={name:"Zip",legParam:"zip",legValues:["return"],storageKey:ut,evidenceFrom(e){let t=(e.get("result")??"").toLowerCase();return t==="cancelled"||t==="declined"?null:e.get("checkoutId")},requestFrom:e=>({checkoutId:e})};async function pt(e,t){let n=new URLSearchParams(t.search),r=n.get(e.legParam);if(!r||!e.legValues.includes(r))return;let a=fa(t.storage,e.storageKey),o=e.evidenceFrom(n,r);t.scrubQuery();let c=ma({evidence:o,parked:a});if(c.action!=="ignore"){if(t.page.clearCart(),c.action==="settle"){t.page.note(`The ${e.name} payment was not completed \u2014 our team will follow up on payment.`),t.page.land(c.parked.confirmation);return}t.page.setConfirming(!0);try{let p=await t.capture(e.requestFrom(c.evidence));p.status==="paid"?t.page.markPaid():t.page.note(`${e.name} declined the payment \u2014 our team will follow up on payment.`),t.page.land(c.parked?.confirmation??p)}catch{c.parked?(t.page.note(`We could not confirm the ${e.name} payment \u2014 our team will follow up on payment.`),t.page.land(c.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 Dn(e,t,n){let r=(t??"").trim();if(!r)return"";if(n.length===0)return r;let a=r.toUpperCase(),o=`${e.toUpperCase()}-${a}`,c=n.find(p=>p.code&&p.code.toUpperCase()===a)??n.find(p=>p.code&&p.code.toUpperCase()===o)??n.find(p=>p.name.toUpperCase()===a);return c?c.code||c.name:""}import{jsx as oe}from"react/jsx-runtime";function Wn(e){let t=e.indexOf(`
|
|
3
|
+
`);return t===-1?[e,""]:[e.slice(0,t),e.slice(t+1)]}function $n(e,{canParkContext:t}={canParkContext:!0}){let n=e.paymentMethods,r=[];return n.includes("card")&&r.push({key:"card",title:"Card",body:null,price:oe("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:oe("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:oe("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:oe("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:oe("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:oe("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:oe("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY LATER"})}),r.push({key:"bank",title:"Bank transfer",body:null,price:oe("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Invoiced"})}),r}function ha({site:e,logo:t,preview:n=!1}){let{items:r,totals:a,coupon:o,refuseCoupon:c,deliveryOptions:p,shippingMethodId:u,setShippingMethodId:s,setQuoteDestination:d,identify:f,clearCapturedCart:k}=We(),m=p.find(x=>x.id===u)?.pickupLocation??null,{country:I,countries:b,activeCountry:w,formatMoney:V}=ae(),[N,T]=y(()=>$n(e)[0].key),[M,z]=y(!0);Y(()=>{z(Ot(Z))},[]);let[J,U]=y(!1),[ee,he]=y(""),[te,ve]=y(""),[ue,g]=y(""),[ie,se]=y(""),[B,Se]=y(""),[be,q]=y(""),[Pe,W]=y(""),[pe,de]=y(""),[j,E]=y(()=>I||b[0]?.code||""),[$,we]=y(""),[me,Ne]=y([]),[gt,Xe]=y(null),[je,Fe]=y(null),yt=Mn(()=>b.find(x=>x.code===j)??w,[b,j,w]),nr=yt?.postalLabel||"Postal Code",rr=me[0]?.divisionType||"State / Province";Y(()=>{if(!j){Ne([]),Xe(j);return}Xe(null);let x=!1;return _.listCountrySubdivisions(j).then(C=>{x||(Ne(C),Xe(j),we(""))}),()=>{x=!0}},[j]),Y(()=>{d(j?{country:j,subdivision:$}:null)},[j,$,d]),Y(()=>()=>d(null),[d]);let[Ze,ht]=y(null),[ar,vt]=y([]),[bt,Qe]=y("new"),[xt,Ct]=y(!1),[kt,or]=y("Home"),[ir,St]=y(null),[X]=y(()=>Jt()),[sr,fe]=y(null),[cr,Ee]=y(null),[lr,ur]=y(null),[pr,dr]=y(!1),[mr,fr]=y(!1),[gr,et]=y(null),[yr,_e]=y(!1),[hr,ne]=y(null),[vr,br]=y(!1),[xr,Pt]=y(!1),[Cr,kr]=y(!1),[Sr,wt]=y(!1),Nt=Un(!1);Y(()=>{n||Nt.current||!r.some(Le)||(Nt.current=!0,_t({lines:r,currency:a.currency,value:a.subtotal-a.discount,coupon:o?.valid?o.code:void 0}))},[r,a,o,n]),Y(()=>{f(ee,te.trim()||void 0)},[ee,te,f]);let Et=Un(null),[De,Pr]=y(null);Y(()=>{let x=Et.current;if(!De||!x)return;let C=()=>x.style.setProperty("--sf-checkout-header-h",`${De.offsetHeight}px`);C();let S=new ResizeObserver(C);return S.observe(De),()=>S.disconnect()},[De]),Y(()=>{let x=S=>({setConfirming:S,land:fe,markPaid:()=>_e(!0),note:ne,fail:Ee,clearCart:k}),C={search:window.location.search,storage:Z,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};pt(Fn,{...C,capture:_.captureAfterpayPayment,page:x(br)}),pt(_n,{...C,capture:_.captureZipPayment,page:x(kr)})},[]),Y(()=>{let C=new URLSearchParams(window.location.search).get("gocardless");if(C!=="confirm"&&C!=="cancel")return;let S=Z.getItem(Be);if(Z.removeItem(Be),window.history.replaceState(null,"",window.location.pathname),!S)return;let F;try{F=JSON.parse(S)}catch{return}if(k(),C==="cancel"){ne("The direct debit was not set up \u2014 our team will follow up on payment."),fe(F.confirmation);return}Pt(!0),_.completeGocardlessPayment({idempotencyKey:F.idempotencyKey}).then(R=>{R.status==="paid"?_e(!0):R.status==="declined"?ne("The direct debit was declined \u2014 our team will follow up on payment."):ne("Your direct debit is set up \u2014 the payment is collecting and will clear in a few days.")}).catch(()=>{ne("We could not confirm the direct debit \u2014 our team will follow up on payment.")}).finally(()=>{fe(F.confirmation),Pt(!1)})},[]),Y(()=>{let x=new URLSearchParams(window.location.search),C=x.get("klarna");if(C!=="confirm"&&C!=="cancel")return;let S=Z.getItem(He);Z.removeItem(He);let F=x.get("authorization_token");if(window.history.replaceState(null,"",window.location.pathname),!S)return;let R;try{R=JSON.parse(S)}catch{return}if(k(),C==="cancel"||!F){ne("The Klarna payment was not completed \u2014 our team will follow up on payment."),fe(R.confirmation);return}wt(!0),_.captureKlarnaPayment({idempotencyKey:R.idempotencyKey,authorizationToken:F}).then(K=>{K.status==="paid"?_e(!0):K.status==="declined"?ne("Klarna declined the payment \u2014 our team will follow up on payment."):ne("Your Klarna payment is being reviewed \u2014 we'll confirm the outcome shortly.")}).catch(()=>{ne("We could not confirm the Klarna payment \u2014 our team will follow up on payment.")}).finally(()=>{fe(R.confirmation),wt(!1)})},[]);function Rt(x){let[C,S]=Wn(x.address);se(C),Se(S),q(x.city),W(x.zip_code),x.country&&E(x.country),x.phone&&de(x.phone),Fe({country:x.country||null,state:x.state??""})}Y(()=>{if(je){if((je.country||j)!==j){Fe(null);return}gt===j&&(we(Dn(j,je.state,me)),Fe(null))}},[je,j,gt,me]),Y(()=>{let x=!1;return(async()=>{try{let[C,S,F]=await Promise.all([xe.me(),xe.myProfile().catch(()=>null),xe.myAddresses().catch(()=>[])]);if(x)return;ht(C);let R=F.filter(Re=>Re.is_active);vt(R),he(C.email);let K=(S?.contact_name??"").split(/\s+/);ve(C.first_name||K[0]||""),g(C.last_name||K.slice(1).join(" "));let Q=C.phone||S?.phone;Q&&de(Q);let tt=R.find(Re=>Re.id===C.default_delivery_location)??R[0];if(tt)Qe(tt.id),Rt(tt);else if(S){let[Re,Er]=Wn(S.address??"");se(Re),Se(Er),q(S.city??""),W(S.zip_code??""),S.country&&E(S.country),Fe({country:S.country||null,state:S.state??""})}}catch{}})(),()=>{x=!0}},[]);function wr(){xe.logout(),ht(null),vt([]),Qe("new"),Ct(!1)}let Me=Mn(()=>$n(e,{canParkContext:M}),[e,M]);Y(()=>{Me.some(x=>x.key===N)||T(Me[0].key)},[Me,N]);let It=B.trim()?`${ie}
|
|
4
|
+
${B.trim()}`:ie;async function Nr(){if(n||J||r.length===0||a.repricing)return;let x=r.filter(Le).flatMap(C=>Ft(C.components,C.qty));if(x.length===0){Ee("Pick a size on each wheel's product page before checking out.");return}U(!0),Ee(null);try{let C=Ze?_.createOrderAuthed:_.createOrder,S=Vt(),F=await C({customer:{email:ee,name:`${te} ${ue}`.trim(),phone:pe.trim()||void 0,address:It,city:be,state:$||void 0,zipCode:Pe,country:j},items:x,currency:a.currency,idempotencyKey:X,shippingMethodId:u??void 0,couponCode:qt(o),...S==="denied"?{}:Ln(),...S?{adConsent:S}:{}});if(Dt({confirmation:F,lines:r,adsSendTo:e.googleAdsId&&e.googleAdsConversionLabel?`${e.googleAdsId}/${e.googleAdsConversionLabel}`:null}),jn({confirmation:F,lines:r}),k(),Ze&&xt&&bt==="new")try{await xe.createAddress({label:kt.trim()||"Home",contact_name:`${te} ${ue}`.trim(),phone:pe.trim(),address:It,city:be,zip_code:Pe,state:$,country:j}),St("Address saved to your account.")}catch{St("We couldn't save the address to your account \u2014 you can add it under Account \u2192 Addresses.")}if(N==="card"&&e.paymentMethods.includes("card")){let R=await _.createPaymentIntent({idempotencyKey:X});et(F),ur(R)}else if(N==="paypal"&&e.paymentMethods.includes("paypal"))et(F),dr(!0);else if(N==="afterpay"&&e.paymentMethods.includes("afterpay")){let R=window.location.origin,K=await _.createAfterpayCheckout({idempotencyKey:X,confirmUrl:`${R}/checkout?afterpay=confirm`,cancelUrl:`${R}/checkout?afterpay=cancel`}),Q={idempotencyKey:X,confirmation:F};Z.setItem(lt,JSON.stringify(Q)),window.location.assign(K.redirectCheckoutUrl);return}else if(N==="square"&&e.paymentMethods.includes("square"))et(F),fr(!0);else if(N==="gocardless"&&e.paymentMethods.includes("gocardless")){let R=window.location.origin,K=await _.createGocardlessBillingRequest({idempotencyKey:X,confirmUrl:`${R}/checkout?gocardless=confirm`,cancelUrl:`${R}/checkout?gocardless=cancel`}),Q={idempotencyKey:X,confirmation:F};Z.setItem(Be,JSON.stringify(Q)),window.location.assign(K.authorisationUrl);return}else if(N==="zip"&&e.paymentMethods.includes("zip")){let R=window.location.origin,K=await _.createZipCheckout({idempotencyKey:X,redirectUrl:`${R}/checkout?zip=return`}),Q={idempotencyKey:X,confirmation:F};Z.setItem(ut,JSON.stringify(Q)),window.location.assign(K.redirectUrl);return}else if(N==="klarna"&&e.paymentMethods.includes("klarna")){let R=window.location.origin,K=await _.createKlarnaCheckout({idempotencyKey:X,confirmUrl:`${R}/checkout?klarna=confirm`,cancelUrl:`${R}/checkout?klarna=cancel`}),Q={idempotencyKey:X,confirmation:F};Z.setItem(He,JSON.stringify(Q)),window.location.assign(K.redirectUrl);return}else fe(F)}catch(C){let S=jt(C);S?(c(S),Ee(`${S} Your order has not been placed. Place it again to continue without the code.`)):Ee(C instanceof Ae?C.message:"Could not place the order. Please try again."),U(!1)}}return{site:e,logo:t,items:r,totals:a,coupon:o,deliveryOptions:p,shippingMethodId:u,setShippingMethodId:s,pickupLocation:m,servedCountries:b,formatMoney:V,payChoice:N,setPayChoice:T,placing:J,email:ee,setEmail:he,firstName:te,setFirstName:ve,lastName:ue,setLastName:g,address1:ie,setAddress1:se,address2:B,setAddress2:Se,city:be,setCity:q,postcode:Pe,setPostcode:W,phone:pe,setPhone:de,country:j,setCountry:E,subdivision:$,setSubdivision:we,subdivisions:me,destination:yt,postcodeLabel:nr,subdivisionLabel:rr,me:Ze,savedAddresses:ar,selectedAddressId:bt,setSelectedAddressId:Qe,saveAddress:xt,setSaveAddress:Ct,saveLabel:kt,setSaveLabel:or,addressSaveNote:ir,idemKey:X,confirmation:sr,setConfirmation:fe,orderError:cr,payment:lr,paypalStep:pr,squareStep:mr,pendingConf:gr,paid:yr,setPaid:_e,payNote:hr,afterpayConfirming:vr,gocardlessConfirming:xr,zipConfirming:Cr,klarnaConfirming:Sr,checkoutRootRef:Et,setCheckoutHeaderEl:Pr,fillFromAddress:Rt,checkoutSignOut:wr,payOptions:Me,placeOrder:Nr}}var Kn=ga(null);function Yn({children:e,...t}){let n=ha(t);return oe(Kn.Provider,{value:n,children:e})}function ce(){let e=ya(Kn);if(!e)throw new Error("useCheckout must be used inside CheckoutStateProvider");return e}import{Fragment as ke,jsx as i,jsxs as h}from"react/jsx-runtime";function Bn(){let{email:e,setEmail:t,firstName:n,setFirstName:r,lastName:a,setLastName:o,me:c,checkoutSignOut:p}=ce();return h(Ve,{num:"N\xB0 01",title:"Contact",children:[i(H,{label:"Email",hint:c?h(ke,{children:["Signed in \xB7"," ",i("button",{type:"button",onClick:p,className:"underline transition-colors hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:i("input",{type:"email",value:e,onChange:u=>t(u.target.value),placeholder:"you@example.com",readOnly:c!==null,className:G+(c?" opacity-70":"")})}),h(Xn,{children:[i(H,{label:"First name",children:i("input",{type:"text",value:n,onChange:u=>r(u.target.value),className:G})}),i(H,{label:"Last name",children:i("input",{type:"text",value:a,onChange:u=>o(u.target.value),className:G})})]})]})}function Hn(){let{pickupLocation:e,servedCountries:t,address1:n,setAddress1:r,address2:a,setAddress2:o,city:c,setCity:p,postcode:u,setPostcode:s,phone:d,setPhone:f,country:k,setCountry:m,subdivision:I,setSubdivision:b,subdivisions:w,destination:V,postcodeLabel:N,subdivisionLabel:T,me:M,savedAddresses:z,selectedAddressId:J,setSelectedAddressId:U,saveAddress:ee,setSaveAddress:he,saveLabel:te,setSaveLabel:ve,fillFromAddress:ue}=ce();return h(Ve,{num:"N\xB0 02",title:e?"Collection":"Shipping address",children:[e?h("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"})]}):h(ke,{children:[M!==null&&z.length>0&&h("div",{className:"grid gap-3",children:[z.map(g=>i(Ge,{active:J===g.id,onClick:()=>{U(g.id),ue(g)},title:g.label,body:g.formatted_address,price:null},g.id)),i(Ge,{active:J==="new",onClick:()=>U("new"),title:"New address",body:null,price:null})]}),i(H,{label:"Address line 1",children:i("input",{type:"text",value:n,onChange:g=>r(g.target.value),className:G})}),i(H,{label:"Address line 2",children:i("input",{type:"text",value:a,onChange:g=>o(g.target.value),placeholder:"Apartment, unit, garage bay\u2026",className:G})}),h(Xn,{cols:"three",children:[i(H,{label:"City",children:i("input",{type:"text",value:c,onChange:g=>p(g.target.value),className:G})}),i(H,{label:N,children:i("input",{type:"text",value:u,onChange:g=>s(g.target.value),className:G})}),i(H,{label:"Country",separate:!0,children:i(at,{value:k,onChange:g=>m(g.target.value),className:G+" pr-10",style:zn,children:t.map(g=>i("option",{value:g.code,children:g.name},g.code))})})]}),i(H,{label:T,separate:!0,children:w.length>0?h(at,{value:I,onChange:g=>b(g.target.value),className:G+" pr-10",style:zn,children:[i("option",{value:"",children:"Select\u2026"}),w.map(g=>i("option",{value:g.code||g.name,children:g.name},g.code||g.name))]}):i("input",{type:"text",value:I,onChange:g=>b(g.target.value),className:G})})]}),i(H,{label:"Phone",children:i("input",{type:"tel",value:d,onChange:g=>f(g.target.value),placeholder:"+44 7700 900000",className:G})}),!e&&M!==null&&J==="new"&&h(ke,{children:[i(va,{checked:ee,onChange:he,label:"Save this address to my account"}),ee&&i(H,{label:"Address label",children:i("input",{type:"text",value:te,onChange:g=>ve(g.target.value),placeholder:"Home",className:G})})]})]})}function Gn(){let{totals:e,coupon:t,deliveryOptions:n,shippingMethodId:r,setShippingMethodId:a,pickupLocation:o,formatMoney:c,city:p,destination:u}=ce();return i(Ve,{num:"N\xB0 03",title:"Shipping",children:h("div",{className:"grid gap-3",children:[n.map(s=>{let d=s.pickupLocation,f=d?[d.address,d.city,d.state,d.zipCode].filter(Boolean).join(", "):null;return i(Ge,{active:r===s.id,onClick:()=>a(s.id),title:d?`${s.name} \u2014 ${d.name}`:s.name,body:d?[f,d.openingHours,d.instructions,s.description].filter(Boolean).join(" \xB7 "):s.description||null,price:e.freeShipping||s.amount===0?Ue:c(s.amount,e.currency),tag:s.tag||void 0},s.id)}),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 Vn(){let{payChoice:e,setPayChoice:t,placing:n,payment:r,payOptions:a}=ce();return h(Ve,{num:"N\xB0 04",title:"Payment",children:[i("div",{className:"grid gap-3",children:a.map(o=>i(Ge,{active:e===o.key,onClick:()=>t(o.key),title:o.title,body:o.body,price:o.price,tag:o.tag},o.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."}):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."})]})}function Jn(){let{site:e,items:t,totals:n,coupon:r,formatMoney:a,payChoice:o,placing:c,email:p,orderError:u,payment:s,placeOrder:d}=ce();return h("aside",{className:"sticky top-[var(--sf-checkout-header-h,88px)] border border-line max-[1100px]:static",style:{background:"linear-gradient(180deg, color-mix(in oklab, var(--site-surface) 70%, var(--bg)) 0%, var(--bg) 100%)"},children:[h("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(re,{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?h("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",i(re,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog \u2192"})]}):t.map(f=>i(ba,{slug:f.slug,name:f.name,qty:f.qty,config:f.config,configSummary:xa(f.config),price:$t(f,n.currency)??0,currency:n.currency},f.id))}),i("div",{className:"border-t border-line px-6 pt-5",children:i(Gt,{customerEmail:p})}),h("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[i(ge,{label:"Subtotal",value:a(n.subtotal,n.currency)}),n.discount>0&&r?.valid&&i(ge,{label:`Coupon \xB7 ${r.code}`,value:h("span",{className:"font-semibold text-green",children:["\u2212 ",a(n.discount,n.currency)]})}),r?.deferred&&i(ge,{label:`Coupon \xB7 ${r.code}`,value:Tt}),r?.valid&&r.effects?.gift&&i(ge,{label:`Free gift \xB7 ${r.effects.gift.partNumber}${r.effects.gift.quantity>1?` \xD7${r.effects.gift.quantity}`:""}`,value:i("span",{className:"font-semibold text-green",children:Ue})}),i(ge,{label:"Shipping",value:n.shippingStatus==="free"?i("span",{className:"font-semibold text-green",children:Ue}):Ut(n.shippingStatus)??a(n.shipping,n.currency)}),n.tax&&(n.tax.charged?i(ge,{label:n.tax.inclusive?`${n.tax.name} included \xB7 ${n.tax.rate}%`:n.tax.name,value:a(n.tax.amount,n.currency)}):n.tax.name?i(ge,{label:n.tax.name,value:Mt}):null)]}),h("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":a(n.grand,n.currency)})]}),h("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[u&&i("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:u}),n.hasUnpricedLine&&h("p",{className:"border border-amber-300 bg-amber-50 px-3 py-2 text-[13px] text-amber-800",children:["One or more items have no price in ",n.currency,". Remove them, or switch region, to continue."]}),i("button",{type:"button",onClick:d,disabled:c||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",t.length===0||c||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:c?h(ke,{children:["Building order\u2026 ",i("span",{children:"\xB7"})]}):n.repricing?h(ke,{children:["Updating total\u2026 ",i("span",{children:"\xB7"})]}):h(ke,{children:[o==="bank"?"Place order":"Continue to payment"," \xB7"," ",a(n.grand,n.currency),i("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})})]})]})}var G="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",zn={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 Ve({num:e,title:t,children:n}){return h("section",{className:"mb-6 border border-line bg-bg",children:[h("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 Xn({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 Ge({active:e,onClick:t,title:n,body:r,price:a,tag:o}){return h("button",{type:"button",onClick:t,"aria-pressed":e,className:["relative grid grid-cols-[auto_1fr_auto] items-center gap-5 border bg-bg px-6 py-5 text-left transition-colors",e?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-line hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]"].join(" "),style:e?{background:"color-mix(in oklab, var(--accent) 14%, var(--bg))"}:void 0,children:[e&&i("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),i("span",{className:["flex h-[18px] w-[18px] items-center justify-center rounded-full border-2",e?"border-accent":"border-fg-dim"].join(" "),children:e&&i("span",{className:"block h-2.5 w-2.5 rounded-full bg-accent"})}),h("span",{className:"flex min-w-0 flex-col gap-1",children:[h("span",{className:"flex flex-wrap items-baseline gap-3 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[n,o&&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:o})]}),r&&i("span",{className:"font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim",children:r})]}),i("span",{className:"whitespace-nowrap font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:a})]})}function va({checked:e,onChange:t,label:n,sub:r}){return h("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"})}),h("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 ba({slug:e,name:t,qty:n,config:r,configSummary:a,price:o,currency:c}){let{catalog:p}=We(),{formatMoney:u}=ae(),s=p.find(b=>b.slug===e),d=s?.spokes??5,f=s?.mesh??!1,k=r.find(b=>b.gold)?.label,m=s?.finishes.find(b=>b.name===k&&b.src)??s?.finishes.find(b=>b.src),I=s?.finishes[0]?.color??Ht;return h("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-4 border-b border-line py-4 last:border-b-0",children:[h("div",{className:"relative flex aspect-square items-center justify-center overflow-hidden border border-line bg-surface",children:[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}),m?.src?i(At,{src:m.src,alt:`${t.lead}${t.accent} \u2014 ${m.name}`,width:120,height:120,sizes:"60px",className:"relative block h-full w-full object-contain p-2"}):i("div",{className:"block w-[78%]",style:{color:I},children:i(Bt,{spokes:d,mesh:f,className:"block w-full"})})]}),h("div",{className:"flex min-w-0 flex-col gap-0.5",children:[h("span",{className:"font-display text-[17px] font-bold uppercase leading-none tracking-[-0.005em] text-fg",children:[t.lead,i("em",{className:"font-serif font-normal italic text-accent tracking-[-0.005em] normal-case",children:t.accent})]}),i("span",{className:"font-mono text-[12px] uppercase leading-[1.5] tracking-[0.18em] text-fg-dim",children:a})]}),i("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:u(o,c)})]})}function ge({label:e,value:t}){return h("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 xa(e){return e.map(t=>t.label).join(" \xB7 ")}import{Fragment as le,jsx as l,jsxs as v}from"react/jsx-runtime";function ft(e){return l(Yn,{...e,children:l(Ca,{})})}function Ca(){let{site:e,logo:t,items:n,placing:r,email:a,me:o,addressSaveNote:c,idemKey:p,confirmation:u,setConfirmation:s,payment:d,paypalStep:f,squareStep:k,pendingConf:m,paid:I,setPaid:b,payNote:w,afterpayConfirming:V,gocardlessConfirming:N,zipConfirming:T,klarnaConfirming:M,checkoutRootRef:z,setCheckoutHeaderEl:J}=ce();return u?v("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:I?"Payment received":"Order received"}),v("p",{className:"text-fg-dim",children:[I?v(le,{children:["Thank you \u2014 your payment for order"," ",l("span",{className:"font-mono text-fg",children:u.orderNumber})," has gone through."," "]}):v(le,{children:["Thank you \u2014 your order ",l("span",{className:"font-mono text-fg",children:u.orderNumber})," is being reviewed by our team."," "]}),o?v(le,{children:["Track it under"," ",l(re,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):l(le,{children:"We\u2019ve emailed you a link to set a password and track it."})]}),w&&l("p",{className:"text-sm text-fg-dim",children:w}),c&&l("p",{className:"text-sm text-fg-dim",children:c}),!o&&v("p",{className:"text-sm text-fg-dim",children:["You can also"," ",l(re,{href:`/track?order=${encodeURIComponent(u.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email \u2014 no password needed."]}),l(re,{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"})]}):V?v("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Afterpay \u2014 one moment."})]}):N?v("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:"Setting up your direct debit\u2026"}),l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Confirming with GoCardless \u2014 one moment."})]}):T?v("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Zip \u2014 one moment."})]}):M?v("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[l("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),l("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Klarna \u2014 one moment."})]}):d?l(ka,{payment:d,onPaid:()=>{b(!0),s(m)},onSkip:()=>s(m)}):f&&m?l(wa,{confirmation:m,clientId:e.paypalClientId??"",idemKey:p,onPaid:()=>{b(!0),s(m)},onSkip:()=>s(m)}):k&&m?l(Ea,{confirmation:m,applicationId:e.squareApplicationId??"",locationId:e.squareLocationId??"",environment:e.squareEnvironment??"production",idemKey:p,onPaid:()=>{b(!0),s(m)},onSkip:()=>s(m)}):v("div",{ref:z,className:"bg-bg text-fg",children:[v("header",{ref:J,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:[v(re,{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",l("span",{className:"max-[640px]:hidden",children:"Back to shop"})]}),l(re,{href:"/","aria-label":`${e.name} home`,className:"inline-flex items-center justify-center",children:l(zt,{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,siteName:e.name})}),e.cardPayments?v("span",{className:"flex items-center justify-end gap-3 font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim",children:[l("span",{className:"text-green",children:"\u25CF"}),l("span",{className:"max-[640px]:hidden",children:"Encrypted \xB7"})," Stripe"]}):l("span",{})]}),v("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-[1100px]:px-[min(24px,var(--sf-site-gutter,40px))]",children:[l("span",{className:"inline-flex items-center bg-accent px-3 py-1 font-bold text-bg",children:"Checkout"}),l("nav",{"aria-label":"Checkout steps",className:"flex flex-wrap items-center gap-5",children:[{n:"01",label:"Cart",state:"done"},{n:"02",label:"Ship & pay",state:"active"},{n:"03",label:"Confirmed",state:"pending"}].map(U=>v("span",{className:["relative flex items-center gap-2 transition-colors",U.state==="pending"?"text-fg-dim":"text-fg",U.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[l("span",{className:U.state==="done"?"text-accent font-bold":"",children:U.n}),l("span",{children:U.label})]},U.n))})]}),v("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-[1100px]:grid-cols-1 max-[1100px]:gap-10 max-[1100px]:px-[min(24px,var(--sf-site-gutter,40px))] max-[1100px]:pt-8 max-[1100px]:pb-20",children:[v("div",{children:[l(Bn,{}),l(Hn,{}),l(Gn,{}),l(Vn,{})]}),l(Jn,{})]}),l("footer",{className:"flex flex-wrap items-center justify-between gap-4 border-t border-line px-[var(--sf-site-gutter,40px)] py-6 font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))]",children:l("span",{children:Yt({legalName:e.legalName,foundedYear:e.foundedYear,siteName:e.name})})})]})}function ka({payment:e,onPaid:t,onSkip:n}){let{formatMoney:r}=ae(),a=Zn(()=>En(e.publishableKey),[e.publishableKey]),o=Zn(()=>{if(typeof document>"u")return;let c=getComputedStyle(document.documentElement),p=(s,d)=>c.getPropertyValue(s).trim()||d,u=document.documentElement.getAttribute("data-theme")!=="light";return{theme:u?"night":"stripe",variables:{colorPrimary:p("--accent",u?"#c9a461":"#8a6a2a"),colorBackground:p("--site-surface",u?"#131313":"#ffffff"),colorText:p("--fg",u?"#f5f1e8":"#0a0a0a"),borderRadius:"0px"}}},[]);return l("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:v("div",{className:"w-full max-w-xl border border-line bg-bg",children:[v("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[l("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:e.orderNumber}),l("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Payment"})]}),v("div",{className:"flex flex-col gap-4 px-6 py-6",children:[v("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",l("span",{className:"text-fg",children:r(Number(e.amount),e.currency)})," ","by card to confirm it now."]}),l(ct,{stripe:a,options:{clientSecret:e.clientSecret,appearance:o},children:l(Sa,{payment:e,onPaid:t,onSkip:n})})]})]})})}function Sa({payment:e,onPaid:t,onSkip:n}){let{formatMoney:r}=ae(),a=bn(),o=hn(),[c,p]=ye(!1),[u,s]=ye(null);async function d(){if(!a||!o||c)return;p(!0),s(null);let f=await a.confirmPayment({elements:o,redirect:"if_required"});if(f.error){s(f.error.message??"Payment failed. Please try again."),p(!1);return}let k=f.paymentIntent?.status;if(k==="succeeded"||k==="processing"){t();return}s("Payment did not complete. Please try again."),p(!1)}return v("div",{className:"flex flex-col gap-4",children:[l(xn,{}),u&&l("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:u}),l("button",{type:"button",onClick:d,disabled:!a||!o||c,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!a||!o||c?"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:c?v(le,{children:["Processing\u2026 ",l("span",{children:"\xB7"})]}):v(le,{children:["Pay ",r(Number(e.amount),e.currency),l("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})}),l("button",{type:"button",onClick:n,disabled:c,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 Qn="paypal-sdk-js",dt=null;function Pa(e,t){let n=`${e}|${t}`;if(dt?.key===n)return dt.promise;let r=new Promise((a,o)=>{document.getElementById(Qn)?.remove();let c=document.createElement("script");c.id=Qn;let p=new URLSearchParams({"client-id":e,currency:t,intent:"capture"});c.src=`https://www.paypal.com/sdk/js?${p}`,c.onload=()=>{let u=window.paypal;u?a(u):o(new Error("PayPal SDK loaded without its namespace"))},c.onerror=()=>o(new Error("PayPal SDK failed to load")),document.head.appendChild(c)});return dt={key:n,promise:r},r}function wa({confirmation:e,clientId:t,idemKey:n,onPaid:r,onSkip:a}){let{formatMoney:o}=ae(),c=qe(null),[p,u]=ye(!1),[s,d]=ye(null),f=qe(r);return f.current=r,tr(()=>{let k=!1,m=null;return Pa(t,e.currency).then(I=>{if(!(k||!c.current))return m=I.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await _.createPaypalOrder({idempotencyKey:n})).paypalOrderId,onApprove:async b=>{try{if((await _.capturePaypalOrder({idempotencyKey:n,paypalOrderId:b.orderID})).status==="paid"){f.current();return}d("PayPal did not complete the payment. Please try again.")}catch(w){d(w instanceof Ae?w.message:"PayPal payment failed. Please try again.")}},onError:()=>{d("PayPal could not process the payment. Please try again.")}}),m.render(c.current).then(()=>{k||u(!0)})}).catch(()=>{k||d("PayPal could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{k=!0,m?.close?.()}},[t,e.currency,n]),l("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:v("div",{className:"w-full max-w-xl border border-line bg-bg",children:[v("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[l("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:e.orderNumber}),l("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"PayPal"})]}),v("div",{className:"flex flex-col gap-4 px-6 py-6",children:[v("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",l("span",{className:"text-fg",children:o(Number(e.grandTotal),e.currency)})," ","with PayPal to confirm it now."]}),!p&&!s&&l("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal\u2026"}),l("div",{ref:c}),s&&l("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:s}),l("button",{type:"button",onClick:a,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later \u2014 our team will be in touch"})]})]})})}var er="square-web-sdk",mt=null;function Na(e){let t=e==="sandbox"?"sandbox":"production";if(mt?.key===t)return mt.promise;let n=new Promise((r,a)=>{document.getElementById(er)?.remove();let o=document.createElement("script");o.id=er,o.src=t==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",o.onload=()=>{let c=window.Square;c?r(c):a(new Error("Square SDK loaded without its namespace"))},o.onerror=()=>a(new Error("Square SDK failed to load")),document.head.appendChild(o)});return mt={key:t,promise:n},n}function Ea({confirmation:e,applicationId:t,locationId:n,environment:r,idemKey:a,onPaid:o,onSkip:c}){let{formatMoney:p}=ae(),u=qe(null),s=qe(null),d=qe(null),[f,k]=ye(!1),[m,I]=ye(!1),[b,w]=ye(null);tr(()=>{let N=!1,T=null;return Na(r).then(async M=>{if(N||!u.current)return;let z=M.payments(t,n);d.current=z,T=await z.card(),await T.attach(u.current),s.current=T,N||k(!0)}).catch(()=>{N||w("Square could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{N=!0,T?.destroy?.()}},[t,n,r]);async function V(){let N=s.current;if(!(!N||m)){I(!0),w(null);try{let T=await N.tokenize();if(T.status!=="OK"||!T.token){w(T.errors?.[0]?.message??"Please check the card details and try again."),I(!1);return}let M;try{M=(await d.current?.verifyBuyer?.(T.token,{amount:String(e.grandTotal),currencyCode:e.currency,intent:"CHARGE"}))?.token}catch{}if((await _.chargeSquare({idempotencyKey:a,sourceId:T.token,...M?{verificationToken:M}:{}})).status==="paid"){o();return}w("Square did not complete the payment. Please try again.")}catch(T){w(T instanceof Ae?T.message:"Square payment failed. Please try again.")}I(!1)}}return l("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:v("div",{className:"w-full max-w-xl border border-line bg-bg",children:[v("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[l("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:e.orderNumber}),l("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Card"})]}),v("div",{className:"flex flex-col gap-4 px-6 py-6",children:[v("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",l("span",{className:"text-fg",children:p(Number(e.grandTotal),e.currency)})," ","by card to confirm it now."]}),!f&&!b&&l("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form\u2026"}),l("div",{ref:u}),b&&l("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:b}),l("button",{type:"button",onClick:V,disabled:!f||m,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!f||m?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:m?v(le,{children:["Processing\u2026 ",l("span",{children:"\xB7"})]}):v(le,{children:["Pay ",p(Number(e.grandTotal),e.currency),l("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})}),l("button",{type:"button",onClick:c,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 Je}from"react/jsx-runtime";function Ra(){let{settings:e,websiteName:t}=Lt(),n=t?{...rt,name:t}:rt,r=e?{url:e.logoUrl,reversed:e.logoReversed??null,inkIsDark:e.logoInkIsDark??null,reverse:e.reverseLogo,size:e.logoSize,sizePx:e.logoSizePx}:null;return Je("div",{style:{position:"fixed",inset:0,zIndex:2147482e3,overflowY:"auto",background:"var(--bg)",color:"var(--fg)"},children:Je(Wt,{children:Je(Kt,{preview:!0,children:Je(ft,{site:n,logo:r,preview:!0})})})})}export{Ra as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{fj as r}from"./chunk-UGXNUQRA.js";import"./chunk-UJW4B64R.js";import"./chunk-5OFEWRWI.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
|
+
var l={siteSlug:null,shopOrigin:""},r=l;function S(e){r={siteSlug:e.siteSlug?.trim()||null,shopOrigin:(e.shopOrigin??"").trim().replace(/\/+$/,"")}}function I(){return r.siteSlug}function b(){return r.shopOrigin}import{currentEaselSession as m}from"efficient-easel/screen/lib/session";var s="https://cdn.inovit.com"?.replace(/\/+$/,"");function i(e,t){let o=m().hostBackend?.media.resolve;if(!(!o||o===d))return o(e,t)??e}function u(e){return/^(?:https?:)?\/\//i.test(e)||/^(?:data|blob):/i.test(e)}function g(e){return i(e)??c(e)}function c(e){return!s||u(e)?e:s+e.replace(/^\/media/,"")}var d=e=>c(e),p="";function y(e){if(!e)return null;let t=i(e);return t!==void 0?t:e.startsWith("/")?`${p}${e}`:e}function C(e){return/^https?:\/\//i.test(e)&&!(s&&e.startsWith(s+"/"))}function P(e){if(!e)return;let t=i(e);return t!==void 0?t:e.startsWith("/media/")?g(e):e}var h="/videos/products/";function _(e){return!!e&&e.includes(h)}var L={contentHash:"f94be8c390bc1b18",schema:1,mediaFields:{ImageBlock:["src"],LogoBlock:["src"],Flex:["bgImage","bgImagePhone"],FeaturedCover:["image"],LongRead:["image"],Banner:["imageSrc"],Timeline:["imageSrc"],Logos:["items[].src"],ContactLocations:["locations[].photo"],HeroSingle:["imageFocal","mediaImage","mediaImage2","mediaVideo","poster"],HeroSlide:["mediaImage","mediaVideo","poster","videoFrame"],PostCard:["image"],Gallery:["othersCards[].image","othersCards[].photos[].src","vehicleCards[].image","vehicleCards[].photos[].src","wheelCards[].image","wheelCards[].photos[].src"],GalleryItem:["image","photos[].src"],Manifesto:["imageSrc"],SectionHeader:["logoSrc"],IntroBleed:["imageSrc","imageSrcMobile"],Split:["imageSrc","textBgSrc"],ProcessSteps:["steps[].image"],DetailRows:["rows[].image"],PaymentBadges:["badges[].src"]},mediaKeyNames:["bgImage","bgImagePhone","image","imageFocal","imageSrc","imageSrcMobile","logoSrc","mediaImage","mediaImage2","mediaVideo","photo","poster","src","textBgSrc"],snapshotObjects:{ProductGrid:{source:{keep:["slug"]}},GalleryItem:{product:{keep:["code","finish"]}},FeaturedCover:{source:{keep:["slug"]}},LongRead:{source:{keep:["slug"]}}},hydratedLists:{Events:["posts"],SubscribeBlogs:["posts"]},technicalStateKeys:["focal","focalPhone","imageFocal","imageFocal2","imageFocal2Phone","imageFocalPhone"]};function n(e){return{getItem(t){try{return e()?.getItem(t)??null}catch{return null}},setItem(t,o){try{e()?.setItem(t,o)}catch{}},removeItem(t){try{e()?.removeItem(t)}catch{}}}}var a="__storefront_probe__";function R(e){try{e.setItem(a,a);let t=e.getItem(a)===a;return e.removeItem(a),t}catch{return!1}}var x=n(()=>typeof window>"u"?null:window.localStorage),M=n(()=>typeof window>"u"?null:window.sessionStorage);function U(e){return n(()=>e.defaultView?.localStorage??null)}export{g as a,d as b,y as c,C as d,P as e,_ as f,L as g,S as h,I as i,b as j,R as k,x as l,M as m,U as n};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as ft,i as pe,q as pt,s as mt,t as gt,v as B}from"./chunk-EPJ5SM3A.js";import{Aa as fe,Ba as ct,Ea as $e,Fa as dt,Ia as Be,Ja as We}from"./chunk-YACB7UXA.js";import{j as ut,l as oe}from"./chunk-YTQS5GY6.js";import{createContext as cn,useContext as xt,useEffect as dn,useMemo as ge,useState as bt}from"react";function ht(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function ie(e,t){if(e.length===0)return null;let n=0;for(let r of e){let o=r.prices?.[t];if(typeof o!="number"||!Number.isFinite(o)||o<=0)return null;n+=o*r.wheels}return n}var Ge=4,_r=1,Nr={unit:"set",spares:0,spareSide:"left"};function yt(e){return e.unit==="single"?1:Ge+e.spares}function Rr(e,t){return[{partNumber:e.partNumber,wheels:yt(t),prices:e.prices}]}function Lr(e,t){let n=yt(t)-Ge;if(n<=0||e.length===0)return e;let r=ln(e),o=r?r[t.spareSide]:0;return e.map((i,a)=>a===o?{...i,wheels:i.wheels+n}:i)}function ln(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 un(e,t){return t.spares>0?`${e} + spare`:e}function Ir(e){return e.unit==="single"?"Single":un(`Set of ${Ge}`,e)}var Ar="data-add-to-basket",qe=9,Ne="en";function me(e,t,n=0){return new Intl.NumberFormat(Ne,{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:n}).format(e)}function kr(e,t){return new Intl.NumberFormat(Ne,{style:"currency",currency:t}).format(e)}import{jsx as gn}from"react/jsx-runtime";var fn="storefront-country",Ct=fn,Ke=cn(null);function pn(e){return St(e,"catalogue")}function mn(e){return St(e,"money")}function St(e,t){let n=new Map(e.map(o=>[o.code,o.decimalPlaces])),r=new Map;return(o,i)=>{if(!i)return"";let a=r.get(i);if(!a){let l=n.get(i)??0;a=new Intl.NumberFormat(Ne,{style:"currency",currency:i,minimumFractionDigits:t==="money"?l:0,maximumFractionDigits:l}),r.set(i,a)}return a.format(o)}}function Fr({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=ge(()=>t??[],[t]),a=ge(()=>n??[],[n]),l=ge(()=>r||i.find(b=>b.isDefault)?.code||i[0]?.code||"",[r,i]),c=ge(()=>o||a.find(b=>b.isDefault)?.code||a[0]?.code||"",[o,a]),[u,f]=bt(c),[d,S]=bt(!1);dn(()=>{let b=oe.getItem(Ct);b&&a.some(P=>P.code===b)&&f(b),S(!0)},[a]);function N(b){f(b),oe.setItem(Ct,b)}let C=ge(()=>{let b=a.find(v=>v.code===u)??null,P=b?.currency,O=P&&i.some(v=>v.code===P)?P:l,M=pn(i),I=mn(i);return{country:u,currency:O,setCountry:N,currencies:i,countries:a,activeCountry:b,formatPrice:(v,x)=>M(v,x??O),formatMoney:(v,x)=>I(v,x??O),ready:d}},[u,i,a,l,d]);return gn(Ke.Provider,{value:C,children:e})}function vt(){let e=xt(Ke);if(!e)throw new Error("useCurrency must be used within a CurrencyProvider");return e}function Ur(){return xt(Ke)?.country??""}import{createContext as In,useCallback as _,useContext as An,useEffect as Z,useMemo as Mt,useRef as Ie,useState as L}from"react";function Pt(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var wt="We'll confirm this discount when you place your order.",Wr="Confirmed at checkout";function Gr(e){return e&&(e.valid||e.deferred)?e.code:void 0}var Et="coupon_code: ";function qr(e){return!(e instanceof pe)||e.status!==400||!e.message.startsWith(Et)?null:e.message.slice(Et.length)}function _t(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 Re="Price on request",yn="Request a quote",bn="from ",Vr="From ",Yr="each",Nt="Free";function ze(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Xe(e,t){let n=e?.[t];return ze(n)?n:null}function Qr(e,t,n,r){let o=Xe(e,n),i=Xe(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function jr(e,t,n,r){if(n==null&&r==null)return!0;let o=Xe(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var Cn={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function xn(e,t,n){if(!ze(e))return Cn;let r=ze(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function Zr(e,t,n=""){return!e.priced||e.unit==null?Re:`${n}${me(e.unit,t)}`}function Jr(e,t){return e.was==null?null:me(e.was,t)}function Sn(e,t,n=1){let r=ie(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((a,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 vn={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function eo(e,t,n,r=1){let o=xn(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=Sn(t.components,n,r);return a.priced?{priced:!0,unit:a.unit,isFrom:a.isFrom,was:null,onSale:!1,setTotal:a.setTotal,fromSetTotal:i}:{...vn,fromSetTotal:i}}function En(e,t){return!e.priced||e.unit==null?Re:`${e.isFrom?bn:""}${me(e.unit,t)}`}function to(e,t){return e.was==null?null:me(e.was,t)}function no(e,t){return!e.priced||e.unit==null?yn:En(e,t)}var Pn=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function Rt(e){return Pn.test(e.trim())}var Lt="sf:ga-purchases",wn=20;function At(){return typeof window>"u"||window.parent!==window}function he(...e){try{if(At()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function _n(e,t){let n=e.config.find(r=>r.gold)?.label;return{item_id:`${e.slug}|${e.finishName}|${e.size}`,item_name:`${e.name.lead}${e.name.accent}`.trim(),...n?{item_variant:n}:{},price:ie(e.components,t)??0,quantity:e.qty}}function Ve(e,t){return e.filter(Le).map(n=>_n(n,t))}function lo(e){he("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=Ve([e],t);n.length!==0&&he("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function uo(e){let t=Ve(e.lines,e.currency);t.length!==0&&he("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var It=new Set;function Nn(e){if(It.has(e))return!1;It.add(e);try{let t=JSON.parse(oe.getItem(Lt)??"[]");if(t.includes(e))return!1;oe.setItem(Lt,JSON.stringify([...t,e].slice(-wn)))}catch{}return!0}function co(e){let t=e.confirmation;if(At()||!Nn(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);he("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:Ve(e.lines,n)}),e.adsSendTo&&he("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var Rn="Arranged after review",Tt="Calculated at checkout",Ln=Tt,mo=Tt;function Ot({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function go(e){switch(e){case"arranged":return Rn;case"pending":return Ln;case"free":return Nt;case"charged":return null}}import{jsx as Mn}from"react/jsx-runtime";var kn=400,Tn=400,On=1500;function Le(e){return(e.components?.length??0)>0}function Dt(e,t){return{code:e,valid:t.valid,deferred:Pt(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function Ut(e,t){return ie(e.components,t)}function Ye(e,t){let n=Ut(e,t);return n===null?null:n*e.qty}function Ft(e){return e!=="tyre"}var Ht=In(null);function No({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=vt(),[i,a]=L(t),[l,c]=L([]),[u,f]=L([]),[d,S]=L([]),[N,C]=L(!1),[b,P]=L(!1),[O,M]=L(!1),[I,v]=L(!1),[x,W]=L(null),[A,G]=L(void 0),[y,w]=L(null),[m,q]=L(null),[J,U]=L(!1),[D,Se]=L(null),X=Ie(void 0),K=_(()=>a(!0),[]),se=_(()=>a(!1),[]),ee=_(()=>a(s=>!s),[]);Z(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&K()},[K,t]);let ve=_(s=>{w(p=>p?.country===s?.country&&p?.subdivision===s?.subdivision?p:s)},[]),H=_(s=>{v(!0),Ft(s)&&M(!0)},[]),Ee=O||l.some(s=>Ft(s.kind)),F=I||l.length>0;Z(()=>{if(t||!Ee||N)return;let s=!0;return B.listWheels().then(p=>{s&&(f(p),C(!0))}),()=>{s=!1}},[t,Ee,N]),Z(()=>{if(t||!F||b)return;let s=!0;return B.listBundles().then(p=>{s&&(S(p),P(!0))}),()=>{s=!1}},[t,F,b]);let z=x?.deliveryOptions??[];Z(()=>{x&&Se(s=>s&&z.some(p=>p.id===s)?s:z[0]?.id??null)},[x]);let V=_(()=>l.filter(Le).flatMap(s=>ht(s.components,s.qty)),[l]),le=_(async(s,p)=>{let h=s.trim().toUpperCase();if(!h)return;let g=V();if(g.length===0){q({code:h,valid:!1,message:"Add a wheel to the cart first."});return}U(!0),X.current=p;try{let R=await B.validateCoupon({code:h,items:g,currency:n,shippingMethodId:D??void 0,customerEmail:p});q(Dt(h,R))}catch{q({code:h,valid:!1,message:"Could not check that code. Please try again."})}finally{U(!1)}},[V,n,D]),ue=_(()=>{q(null),X.current=void 0},[]),ce=_(s=>{if(!m)return;let{code:p}=m;q(h=>h&&h.code===p?{code:p,valid:!1,refused:!0,message:s}:h)},[m]);Z(()=>{if(!m||m.refused)return;let s=m.code,p=g=>g!==null&&g.code===s&&!g.refused,h=setTimeout(async()=>{let g=V();if(g.length===0){q(R=>p(R)?{code:s,valid:!1,message:"Add a wheel to the cart first."}:R);return}U(!0);try{let R=await B.validateCoupon({code:s,items:g,currency:n,shippingMethodId:D??void 0,customerEmail:X.current});q(de=>p(de)?Dt(s,R):de)}catch{}finally{U(!1)}},kn);return()=>clearTimeout(h)},[l,n,D]);let te=m&&!m.refused?m.code:void 0;Z(()=>{if(t)return;let s=!0,p=setTimeout(async()=>{let h=V();if(h.length===0){W(null),G(void 0);return}try{let g=await B.quoteCart({items:h,currency:n,shippingMethodId:D??void 0,couponCode:te,customerEmail:X.current||void 0,country:y?.country||r||void 0,subdivision:y?.country&&y.subdivision||void 0});if(!s)return;W(g)}catch{if(!s)return}G(te)},Tn);return()=>{s=!1,clearTimeout(p)}},[l,n,D,te,r,y]);let Y=_(s=>{c(p=>{let h=p.findIndex(g=>g.id===s.id);return h===-1?[...p,s]:p.map((g,R)=>R===h?{...g,qty:Math.min(qe,g.qty+s.qty)}:g)}),kt(s,n)},[n]),Pe=_(s=>{c(p=>p.filter(h=>h.id!==s))},[]),we=_((s,p)=>{let h=Math.max(1,Math.min(qe,p));c(g=>g.map(R=>R.id===s?{...R,qty:h}:R))},[]),E=_(s=>{c(s)},[]),[k,ne]=L(null),nt=Ie(null);nt.current=k;let $=Ie(null),Fe=Ie(""),rt=_((s,p)=>{let h=s.trim().toLowerCase();Rt(h)&&ne(g=>g&&g.email===h&&g.firstName===(p??"")?g:{email:h,firstName:p??""})},[]);Z(()=>{if(t||!k)return;let s=_t(l.filter(Le),g=>Ye(g,n)===null?Re:o(Ye(g,n),n)),p={email:k.email,firstName:k.firstName,currency:n,items:s},h=JSON.stringify(p);if(h!==Fe.current)return $.current&&clearTimeout($.current),$.current=setTimeout(()=>{$.current=null,Fe.current=h,B.captureCart(p).catch(g=>{})},On),()=>{$.current&&(clearTimeout($.current),$.current=null)}},[l,k,n,t]);let ot=_(()=>{$.current&&(clearTimeout($.current),$.current=null);let s=nt.current;s&&(Fe.current="",B.captureCart({email:s.email,firstName:s.firstName,currency:n,items:[]}).catch(p=>{}))},[n]),it=Mt(()=>{let s=l.reduce((T,re)=>{let _e=Ye(re,n);return _e===null?T:T+_e},0),p=l.some(T=>Ut(T,n)===null),h=l.reduce((T,re)=>T+re.qty,0),g=m?.valid?m.effects:void 0,R=g?Math.min(s,Number(g.discountAmount)):0,de=x?.bundleDiscount??0,nn=x?.appliedBundles??[],Ue=!!g?.freeShipping,st=z.find(T=>T.id===D),lt=Ue?0:x?.shipping??st?.amount??0,rn=Ot({quoted:x!==null,optionCount:z.length,chosenAmount:st?.amount,couponWaivesFreight:Ue}),He={};for(let T of g?.freeUnits??[])He[T.partNumber]=(He[T.partNumber]??0)+T.quantity;let on=x?.tax??null,an=x?x.grandTotal:s-R-de+lt;return{sets:h,units:l.reduce((T,re)=>T+(re.components??[]).reduce((_e,sn)=>_e+sn.wheels*re.qty,0),0),subtotal:s,hasUnpricedLine:p,discount:R,bundleDiscount:de,appliedBundles:nn,shipping:lt,freeShipping:Ue,shippingStatus:rn,freeUnitsByPartNumber:He,tax:on,grand:an,repricing:!!m?.refused&&x!==null&&A===m?.code,currency:n}},[l,n,m,z,D,x,A]),at=_(s=>{Y(s),K()},[Y,K]),tn=Mt(()=>({isOpen:i,preview:t,open:K,close:se,toggle:ee,items:l,catalog:u,bundles:d,warmCatalog:H,add:Y,addAndOpen:at,remove:Pe,setQty:we,replaceItems:E,identify:rt,clearCapturedCart:ot,coupon:m,applyCoupon:le,removeCoupon:ue,refuseCoupon:ce,couponBusy:J,deliveryOptions:z,setQuoteDestination:ve,shippingMethodId:D,setShippingMethodId:Se,totals:it}),[i,t,K,se,ee,l,u,d,H,Y,at,Pe,we,E,rt,ot,m,le,ue,ce,J,z,ve,D,it]);return Mn(Ht.Provider,{value:tn,children:e})}function $t(){let e=An(Ht);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as zn}from"react";function Bt(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 Dn=6e4,Fn=5e3,Un=500,Ae=new Map;async function Hn(e){let{host:t,matchesRequestHost:n}=await pt();if(!t)return"";let r=await mt();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}var $n=e=>e.includes("|slug:")||e.includes("|xhost:");async function Wt(e,t){if(await gt()!==null)return t();let n=await Hn(e);if(!n)return t();let r=Date.now(),o=Ae.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),a=i.outcome.state==="failed",l=a?Fn:Dn,c=Ae.get(n)?.lastGood,u=i.outcome.state==="ok"?i:a?c:void 0,f=a&&u?u:i;return Bt(Ae,Un,$n,r),Ae.set(n,{load:f,expiresAt:r+l,lastGood:u}),f}var Bn=404;function Wn(e){if(e instanceof pe&&e.status===Bn)return{state:"absent"};let t=e instanceof pe?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var Gn="[storefront:chrome-load-failed]";function qn(e,t){console.error(`${Gn} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function Gt(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=Wn(o);return i.state==="failed"&&qn(e,i),{value:n,outcome:i}}}function Kn(e){return e==="production"?"silent":"banner"}var Mo=Kn("production");function Xn(e,t){return e?.trim()||t}function Go({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=Xn(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var Vn={name:fe,legalName:null,foundedYear:null,faviconUrl:null,currencies:[],defaultCurrency:null,countries:[],defaultCountry:null,commerceEnabled:!0,cardPayments:!1,paymentMethods:[],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,socialLinks:$e},qo=zn(async()=>Wt("site",()=>Gt("site",async()=>{let e=await B.getSite();return{name:ct(e.name),legalName:e.legalName?.trim()||null,foundedYear:e.foundedYear??null,faviconUrl:e.faviconUrl??null,currencies:e.currencies??[],defaultCurrency:e.defaultCurrency??null,countries:e.countries??[],defaultCountry:e.defaultCountry??null,commerceEnabled:e.commerceEnabled??!0,cardPayments:e.cardPayments??!1,paymentMethods:e.paymentMethods??(e.cardPayments?["card"]:[]),paypalClientId:e.paypalClientId??null,paypalEnvironment:e.paypalEnvironment??null,squareApplicationId:e.squareApplicationId??null,squareLocationId:e.squareLocationId??null,squareEnvironment:e.squareEnvironment??null,ga4MeasurementId:e.ga4MeasurementId??null,googleAdsId:e.googleAdsId??null,googleAdsConversionLabel:(e.googleAdsId?e.googleAdsConversionLabel:null)??null,metaPixelId:e.metaPixelId??null,consentEnabled:e.consentEnabled??!1,consentPrivacyPage:e.consentPrivacyPage??null,consentNoticeOptOut:e.consentNoticeOptOut??!1,socialLinks:dt(e.socialLinks)}},Vn)));var Ko={name:fe,legalName:null,foundedYear:null,faviconUrl:null,currencies:[{code:"USD",symbol:"$",decimalPlaces:2,isDefault:!0}],defaultCurrency:"USD",countries:[{code:"US",name:"United States",currency:"USD",url:"",isDefault:!0,chargeTax:!1,taxDisplay:"none",taxName:"",taxRate:null,postalLabel:"Zip Code"}],defaultCountry:"US",commerceEnabled:!0,cardPayments:!0,paymentMethods:["card"],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,socialLinks:$e};import{jsx as be,jsxs as Qe}from"react/jsx-runtime";import{useEffect as ke,useId as Zn,useRef as Kt,useState as Te}from"react";import{efficientClientOpen as Yn}from"efficient-easel/screen/lib/session";var ye=new Map,Qn=64;async function jn(e){if(!Yn())return null;try{let t=await fetch(`${ut()}/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 qt(e){let t=ye.get(e);if(t)return t;let n=jn(e);if(ye.set(e,n),ye.size>Qn){let r=ye.keys().next();r.done||ye.delete(r.value)}return n}var Jn=202/22,er=.88,ai=16,tr="invert(1)";function si({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,wordmark:f,siteName:d=fe,fitToContainer:S=!1,fitWordmarkToContainer:N=!1,fitFloorPx:C}){let b=f&&f.trim()?f.trim():d,[P,O]=Te(!1),M=Kt(null),I=E=>{M.current=E};ke(()=>{let E=M.current?.ownerDocument??document,k=()=>{O(E.documentElement.getAttribute("data-theme")==="light")};k();let ne=new MutationObserver(k);return ne.observe(E.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>ne.disconnect()},[]);let v=n&&n.trim()?n.trim():null,x=!!v&&ft(v),W=i??(P&&t),A=o&&o.trim()?o.trim():null,G=r&&!A,y=`logo-color-${Zn().replace(/[^A-Za-z0-9_-]/g,"")}`,w=G&&x&&v&&a!=null?{reversed:a,inkIsDark:l??null}:null,m=w!==null,[q,J]=Te(null);ke(()=>{if(!G||!v||!x||m){J(null);return}let E=!1;return J(null),qt(v).then(k=>{E||J(k)}),()=>{E=!0}},[G,v,x,m]);let U=w??q,D=!!U&&U.inkIsDark!==null&&(W?!U.inkIsDark:U.inkIsDark),Se=G&&!!v&&!x&&!W,X=D&&U?U.reversed:v,K=X?[X]:[],[se,ee]=Te(0);ke(()=>{ee(0)},[v,D]);let ve=e==="footer"?We:Be[c],H=u&&u>0?u:ve,Ee=Math.round(H*Jn),F=se<K.length?K[se]:null,[z,V]=Te(X),le=F!==null&&F===z,ue=Kt(null);ke(()=>{let E=ue.current;if(!E||!E.complete)return;if(E.naturalWidth>0||E.naturalHeight>0){V(F);return}let k=!1;return E.decode().then(()=>!k&&V(F),()=>!k&&ee(ne=>ne+1)),()=>{k=!0}},[F]);let ce=S||N,te=`calc(100cqi / ${((b.length+1)*er).toFixed(2)})`,Y=ce&&C&&C>0?Math.min(C,H):null,Pe=ce?Y===null?`min(${H}px, ${te})`:`clamp(${Y}px, ${te}, ${H}px)`:`${H}px`,we=Qe("span",{className:`font-display font-bold tracking-[0.18em] ${Y===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:Pe,lineHeight:1,...A?{color:A}:{}},"aria-label":b,children:[b,be("span",{className:"text-accent",style:A?{color:A}:void 0,children:"."})]});return Qe("span",{ref:I,className:"inline-flex items-center",children:[!le&&we,A&&F&&be("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:Qe("filter",{id:y,colorInterpolationFilters:"sRGB",children:[be("feFlood",{style:{floodColor:A}}),be("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),F&&be("img",{ref:ue,src:F,alt:b,width:Ee,height:H,className:"shrink-0 object-contain",style:{...le?{height:`${H}px`,width:"auto",...S?{maxWidth:"100cqi"}:{}}:{display:"none"},...Se?{filter:tr}:{},...A?{filter:`url(#${y})`}:{}},onLoad:()=>V(F),onError:()=>ee(E=>E+1)},F)]})}import{jsx as Ce,jsxs as rr}from"react/jsx-runtime";function nr({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 f=u+Math.PI/e;l.push({x1:a(100+Math.cos(f)*22*1.4),y1:a(100+Math.sin(f)*22*1.4),x2:a(100+Math.cos(f)*78),y2:a(100+Math.sin(f)*78),main:!1})}}return rr("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:[Ce("circle",{cx:100,cy:100,r:92,strokeWidth:2}),Ce("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),Ce("circle",{cx:100,cy:100,r:22,strokeWidth:2}),Ce("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),l.map((c,u)=>Ce("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 di="#c9a461",zt=[{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"}],fi={name:"",color:"var(--fg)",family:"silver",src:""};function or(e,t){let n=r=>{let o=zt.findIndex(i=>i.f===r);return o===-1?zt.length:o};return n(e)-n(t)||e.localeCompare(t)}function pi(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(or)}import{useState as ir}from"react";import{jsx as ae,jsxs as je}from"react/jsx-runtime";function ar({customerEmail:e}){let{coupon:t,applyCoupon:n,removeCoupon:r,couponBusy:o}=$t(),[i,a]=ir("");async function l(){o||!i.trim()||(await n(i,e),a(""))}return je("div",{className:"flex flex-col gap-2",children:[t===null?je("div",{className:"flex border border-line",children:[ae("input",{type:"text",value:i,onChange:c=>a(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),l())},placeholder:"Coupon code","aria-label":"Coupon code",className:"flex-1 bg-transparent px-4 py-4 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim"}),ae("button",{type:"button",onClick:()=>{l()},disabled:o,className:"border-l border-line px-4 font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-wait disabled:opacity-60",children:o?"\u2026":"Apply"})]}):je("div",{className:["flex items-center justify-between gap-3 border px-4 py-3",t.valid?"border-accent":"border-line"].join(" "),style:t.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[ae("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",t.valid?"text-accent":t.deferred?"text-fg":"text-fg-dim line-through"].join(" "),children:t.code}),ae("button",{type:"button",onClick:r,"aria-label":`Remove coupon ${t.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"\u2715"})]}),t?.deferred?ae("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:wt}):t&&!t.valid&&t.message&&ae("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:t.message})]})}var Ze="Ads on. Shopper can opt out.",Oe="Ads and analytics off until Accept",sr={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:Ze,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:Oe,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:Ze,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:Ze,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:Oe,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:Oe,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:Oe,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}};function lr(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 xi(e,t,n){let r=lr(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 Si={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on"};var ur={asked:!1,region:"other",model:"opt-in",analytics:!0,ads:!0,chosen:!0,gpc:!1};var cr=ur;function wi(e=cr){if(e.asked)return e.ads?"granted":"denied"}function Ni(){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 fr,isValidElement as pr,useEffect as Vt,useId as mr,useLayoutEffect as jt,useRef as Q,useState as Yt}from"react";var Me=(e,t)=>!!e[t]&&!e[t].disabled;function Je(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(Me(e,i))return i}return t}function et(e,t){return Je(e,t===1?-1:e.length,t)}function tt(e,t){return Me(e,t)?t:Math.max(et(e,1),0)}function Xt(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)=>Me(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:Je(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:Je(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:et(n,1)}),handled:!0};case"End":return{state:i({focus:et(n,-1)}),handled:!0};case"Enter":case" ":return Me(n,o)?{state:i({open:!1,typed:""}),commit:o,refocus:!0,handled:!0}:{state:e,handled:!0};case"Escape":return{state:i({open:!1,typed:""}),refocus:!0,handled:!0};case"Tab":return{state:i({open:!1,typed:""}),handled:!1};default:return{state:e,handled:!1}}}import{placeMenu as gr}from"efficient-shell/ui";import{Fragment as Sr,jsx as j,jsxs as Zt}from"react/jsx-runtime";var Qt={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function hr({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[a,l]=Yt(!1),c=r!==void 0,u=c?r:a,[f,d]=Yt(0),S=Q({text:"",timer:0}),N=Q(null),C=Q(null),b=Q(null),P=mr(),O=Q(null),M=e.findIndex(y=>y.value===t),I=y=>{y!==u&&(c||l(y),y?o?.():i?.())},v=y=>{let w=e[y];!w||w.disabled||(n(w.value),I(!1),C.current?.focus())},x=y=>{let w={open:u,focus:u?f:tt(e,M),typed:S.current.text},m=Xt(w,y,e);return!m.handled&&m.state.open===u?!1:(m.state.typed!==w.typed&&(S.current.text=m.state.typed,window.clearTimeout(S.current.timer),S.current.timer=window.setTimeout(()=>{S.current.text=""},500)),d(m.state.focus),m.commit!==void 0?v(m.commit):I(m.state.open),m.refocus&&C.current?.focus(),m.handled)},W=Q(x);W.current=x;let A=Q(()=>I(!1));A.current=()=>I(!1);let G=y=>{u||(O.current=y.nativeEvent,W.current(y.key)&&y.preventDefault())};return Vt(()=>{if(!u)return;let y=m=>{N.current?.contains(m.target)||A.current()},w=m=>{m!==O.current&&W.current(m.key)&&m.preventDefault()};return document.addEventListener("mousedown",y),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",w)}},[u]),Vt(()=>{u&&(S.current.text||d(tt(e,M)))},[u]),jt(()=>{if(!u||!b.current)return;b.current.children.item(f)?.scrollIntoView({block:"nearest"})},[f,u]),{open:u,toggle:()=>I(!u),close:()=>I(!1),focusIdx:f,setFocusIdx:d,pick:y=>v(e.findIndex(w=>w.value===y)),wrapRef:N,triggerRef:C,listRef:b,listId:P,onTriggerKeyDown:G,activeId:u?`${P}-${f}`:void 0}}var yr={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 ${Qt.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 ${Qt.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 br(e,t){jt(()=>{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",f=gr({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(f.side==="top"){i.top="auto",i.bottom="100%",i.marginTop="0px";let S=f.top+Math.min(c.height,f.maxHeight);i.marginBottom=`${Math.max(0,l.top-S)}px`}f.maxHeight<c.height&&(i.maxHeight=`${f.maxHeight}px`,i.overflowY="auto");let d=f.left-c.left;d&&(i.translate=`${d}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function Cr({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:a,listRef:l,ariaLabel:c}){let u=yr[t],f=Q(null);return br(f,n.length),j("ul",{ref:d=>{f.current=d,l&&(l.current=d)},id:e,role:"listbox","aria-label":c,...u.pickerMarker?{"data-picker-menu":""}:{},className:u.list,children:n.map((d,S)=>{let N=d.value===r;return j("li",{id:`${e}-${S}`,role:"option","aria-selected":N,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(S),onMouseDown:C=>{C.preventDefault(),d.disabled||a(d.value)},className:u.item(S===o,N&&d.value!=="",!!d.disabled,S===n.length-1),style:u.itemStyle?.(N),children:d.meta===void 0?d.label:Zt(Sr,{children:[d.lead,j("span",{className:"flex-1 whitespace-nowrap",children:d.label}),j("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${S}`)})})}function xr({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:a,id:l,"aria-label":c}){let u=fr.toArray(r).flatMap(C=>{if(!pr(C))return[];if(C.type!=="option")return[];let P=C.props,O=P.value!==void 0?String(P.value):"",M=P.children,I=typeof M=="string"||typeof M=="number"?String(M):O;return[{value:O,label:I,disabled:!!P.disabled}]}),f=e??"",d=hr({items:u,value:f,onPick:C=>t?.({target:{value:C}})}),N=u.find(C=>C.value===f)?.label??u[0]?.label??"";return Zt("div",{ref:d.wrapRef,className:"relative",children:[a&&j("input",{type:"hidden",name:a,value:f}),j("button",{ref:C=>{d.triggerRef.current=C},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":d.open,"aria-controls":d.open?d.listId:void 0,"aria-activedescendant":d.activeId,"aria-label":c,id:l,onClick:()=>!n&&d.toggle(),onKeyDown:C=>!n&&d.onTriggerKeyDown(C),className:`block w-full ${o??""}`,style:i,children:j("span",{className:"block w-full truncate text-left",children:N})}),d.open&&j(Cr,{id:d.listId,tone:"select",items:u,value:f,focusIdx:d.focusIdx,onFocus:d.setFocusIdx,onPick:d.pick,listRef:d.listRef})]})}import{jsx as xe,jsxs as De}from"react/jsx-runtime";var vr="font-mono text-[length:var(--size-label,12px)]",Er="font-semibold uppercase tracking-[0.22em] text-fg";function Jt(e){return`${e??vr} ${Er}`}function en(){return xe("span",{className:"text-accent",children:" *"})}function Pr({children:e,required:t,labelFace:n}){return De("span",{className:Jt(n),children:[e,t?xe(en,{}):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?xe("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?De("div",{className:c,children:[De("label",{htmlFor:o,className:Jt(i),children:[e,t?xe(en,{}):null]}),l,u]}):De("label",{htmlFor:o,className:c,children:[xe(Pr,{required:t,labelFace:i,children:e}),l]})}export{Wr as a,Gr as b,qr as c,ht as d,Ge as e,_r as f,Nr as g,Rr as h,Lr as i,ln as j,un as k,Ir as l,Ar as m,qe as n,Ne as o,me as p,kr as q,Re as r,yn as s,bn as t,Vr as u,Yr as v,Nt as w,Xe as x,Qr as y,jr as z,xn as A,Zr as B,Jr as C,Sn as D,eo as E,En as F,to as G,no as H,Rt as I,lo as J,uo as K,co as L,mo as M,go as N,Fr as O,vt as P,Ur as Q,Le as R,Ye as S,No as T,$t as U,Go as V,Vn as W,Ko as X,ai as Y,si as Z,nr as _,di as $,zt as aa,fi as ba,or as ca,pi as da,ar as ea,sr as fa,xi as ga,Si as ha,ur as ia,wi as ja,Ni as ka,hr as la,Cr as ma,xr as na,Pr as oa,wr as pa};
|
|
1
|
+
import{f as ft,i as pe,q as pt,s as mt,t as gt,v as B}from"./chunk-QJDTP7K6.js";import{Ba as fe,Ca as ct,Fa as $e,Ga as dt,Ja as Be,Ka as We}from"./chunk-UJW4B64R.js";import{j as ut,l as oe}from"./chunk-5OFEWRWI.js";import{createContext as cn,useContext as xt,useEffect as dn,useMemo as ge,useState as bt}from"react";function ht(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function ie(e,t){if(e.length===0)return null;let n=0;for(let r of e){let o=r.prices?.[t];if(typeof o!="number"||!Number.isFinite(o)||o<=0)return null;n+=o*r.wheels}return n}var Ge=4,_r=1,Nr={unit:"set",spares:0,spareSide:"left"};function yt(e){return e.unit==="single"?1:Ge+e.spares}function Rr(e,t){return[{partNumber:e.partNumber,wheels:yt(t),prices:e.prices}]}function Lr(e,t){let n=yt(t)-Ge;if(n<=0||e.length===0)return e;let r=ln(e),o=r?r[t.spareSide]:0;return e.map((i,a)=>a===o?{...i,wheels:i.wheels+n}:i)}function ln(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 un(e,t){return t.spares>0?`${e} + spare`:e}function Ir(e){return e.unit==="single"?"Single":un(`Set of ${Ge}`,e)}var Ar="data-add-to-basket",qe=9,Ne="en";function me(e,t,n=0){return new Intl.NumberFormat(Ne,{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:n}).format(e)}function kr(e,t){return new Intl.NumberFormat(Ne,{style:"currency",currency:t}).format(e)}import{jsx as gn}from"react/jsx-runtime";var fn="storefront-country",Ct=fn,Ke=cn(null);function pn(e){return St(e,"catalogue")}function mn(e){return St(e,"money")}function St(e,t){let n=new Map(e.map(o=>[o.code,o.decimalPlaces])),r=new Map;return(o,i)=>{if(!i)return"";let a=r.get(i);if(!a){let l=n.get(i)??0;a=new Intl.NumberFormat(Ne,{style:"currency",currency:i,minimumFractionDigits:t==="money"?l:0,maximumFractionDigits:l}),r.set(i,a)}return a.format(o)}}function Fr({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=ge(()=>t??[],[t]),a=ge(()=>n??[],[n]),l=ge(()=>r||i.find(b=>b.isDefault)?.code||i[0]?.code||"",[r,i]),c=ge(()=>o||a.find(b=>b.isDefault)?.code||a[0]?.code||"",[o,a]),[u,f]=bt(c),[d,S]=bt(!1);dn(()=>{let b=oe.getItem(Ct);b&&a.some(P=>P.code===b)&&f(b),S(!0)},[a]);function N(b){f(b),oe.setItem(Ct,b)}let C=ge(()=>{let b=a.find(v=>v.code===u)??null,P=b?.currency,O=P&&i.some(v=>v.code===P)?P:l,M=pn(i),I=mn(i);return{country:u,currency:O,setCountry:N,currencies:i,countries:a,activeCountry:b,formatPrice:(v,x)=>M(v,x??O),formatMoney:(v,x)=>I(v,x??O),ready:d}},[u,i,a,l,d]);return gn(Ke.Provider,{value:C,children:e})}function vt(){let e=xt(Ke);if(!e)throw new Error("useCurrency must be used within a CurrencyProvider");return e}function Ur(){return xt(Ke)?.country??""}import{createContext as In,useCallback as _,useContext as An,useEffect as Z,useMemo as Mt,useRef as Ie,useState as L}from"react";function Pt(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var wt="We'll confirm this discount when you place your order.",Wr="Confirmed at checkout";function Gr(e){return e&&(e.valid||e.deferred)?e.code:void 0}var Et="coupon_code: ";function qr(e){return!(e instanceof pe)||e.status!==400||!e.message.startsWith(Et)?null:e.message.slice(Et.length)}function _t(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 Re="Price on request",yn="Request a quote",bn="from ",Vr="From ",Yr="each",Nt="Free";function ze(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Xe(e,t){let n=e?.[t];return ze(n)?n:null}function Qr(e,t,n,r){let o=Xe(e,n),i=Xe(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function jr(e,t,n,r){if(n==null&&r==null)return!0;let o=Xe(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var Cn={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function xn(e,t,n){if(!ze(e))return Cn;let r=ze(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function Zr(e,t,n=""){return!e.priced||e.unit==null?Re:`${n}${me(e.unit,t)}`}function Jr(e,t){return e.was==null?null:me(e.was,t)}function Sn(e,t,n=1){let r=ie(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((a,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 vn={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function eo(e,t,n,r=1){let o=xn(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=Sn(t.components,n,r);return a.priced?{priced:!0,unit:a.unit,isFrom:a.isFrom,was:null,onSale:!1,setTotal:a.setTotal,fromSetTotal:i}:{...vn,fromSetTotal:i}}function En(e,t){return!e.priced||e.unit==null?Re:`${e.isFrom?bn:""}${me(e.unit,t)}`}function to(e,t){return e.was==null?null:me(e.was,t)}function no(e,t){return!e.priced||e.unit==null?yn:En(e,t)}var Pn=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function Rt(e){return Pn.test(e.trim())}var Lt="sf:ga-purchases",wn=20;function At(){return typeof window>"u"||window.parent!==window}function he(...e){try{if(At()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function _n(e,t){let n=e.config.find(r=>r.gold)?.label;return{item_id:`${e.slug}|${e.finishName}|${e.size}`,item_name:`${e.name.lead}${e.name.accent}`.trim(),...n?{item_variant:n}:{},price:ie(e.components,t)??0,quantity:e.qty}}function Ve(e,t){return e.filter(Le).map(n=>_n(n,t))}function lo(e){he("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=Ve([e],t);n.length!==0&&he("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function uo(e){let t=Ve(e.lines,e.currency);t.length!==0&&he("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var It=new Set;function Nn(e){if(It.has(e))return!1;It.add(e);try{let t=JSON.parse(oe.getItem(Lt)??"[]");if(t.includes(e))return!1;oe.setItem(Lt,JSON.stringify([...t,e].slice(-wn)))}catch{}return!0}function co(e){let t=e.confirmation;if(At()||!Nn(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);he("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:Ve(e.lines,n)}),e.adsSendTo&&he("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var Rn="Arranged after review",Tt="Calculated at checkout",Ln=Tt,mo=Tt;function Ot({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function go(e){switch(e){case"arranged":return Rn;case"pending":return Ln;case"free":return Nt;case"charged":return null}}import{jsx as Mn}from"react/jsx-runtime";var kn=400,Tn=400,On=1500;function Le(e){return(e.components?.length??0)>0}function Dt(e,t){return{code:e,valid:t.valid,deferred:Pt(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function Ut(e,t){return ie(e.components,t)}function Ye(e,t){let n=Ut(e,t);return n===null?null:n*e.qty}function Ft(e){return e!=="tyre"}var Ht=In(null);function No({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=vt(),[i,a]=L(t),[l,c]=L([]),[u,f]=L([]),[d,S]=L([]),[N,C]=L(!1),[b,P]=L(!1),[O,M]=L(!1),[I,v]=L(!1),[x,W]=L(null),[A,G]=L(void 0),[y,w]=L(null),[m,q]=L(null),[J,U]=L(!1),[D,Se]=L(null),X=Ie(void 0),K=_(()=>a(!0),[]),se=_(()=>a(!1),[]),ee=_(()=>a(s=>!s),[]);Z(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&K()},[K,t]);let ve=_(s=>{w(p=>p?.country===s?.country&&p?.subdivision===s?.subdivision?p:s)},[]),H=_(s=>{v(!0),Ft(s)&&M(!0)},[]),Ee=O||l.some(s=>Ft(s.kind)),F=I||l.length>0;Z(()=>{if(t||!Ee||N)return;let s=!0;return B.listWheels().then(p=>{s&&(f(p),C(!0))}),()=>{s=!1}},[t,Ee,N]),Z(()=>{if(t||!F||b)return;let s=!0;return B.listBundles().then(p=>{s&&(S(p),P(!0))}),()=>{s=!1}},[t,F,b]);let z=x?.deliveryOptions??[];Z(()=>{x&&Se(s=>s&&z.some(p=>p.id===s)?s:z[0]?.id??null)},[x]);let V=_(()=>l.filter(Le).flatMap(s=>ht(s.components,s.qty)),[l]),le=_(async(s,p)=>{let h=s.trim().toUpperCase();if(!h)return;let g=V();if(g.length===0){q({code:h,valid:!1,message:"Add a wheel to the cart first."});return}U(!0),X.current=p;try{let R=await B.validateCoupon({code:h,items:g,currency:n,shippingMethodId:D??void 0,customerEmail:p});q(Dt(h,R))}catch{q({code:h,valid:!1,message:"Could not check that code. Please try again."})}finally{U(!1)}},[V,n,D]),ue=_(()=>{q(null),X.current=void 0},[]),ce=_(s=>{if(!m)return;let{code:p}=m;q(h=>h&&h.code===p?{code:p,valid:!1,refused:!0,message:s}:h)},[m]);Z(()=>{if(!m||m.refused)return;let s=m.code,p=g=>g!==null&&g.code===s&&!g.refused,h=setTimeout(async()=>{let g=V();if(g.length===0){q(R=>p(R)?{code:s,valid:!1,message:"Add a wheel to the cart first."}:R);return}U(!0);try{let R=await B.validateCoupon({code:s,items:g,currency:n,shippingMethodId:D??void 0,customerEmail:X.current});q(de=>p(de)?Dt(s,R):de)}catch{}finally{U(!1)}},kn);return()=>clearTimeout(h)},[l,n,D]);let te=m&&!m.refused?m.code:void 0;Z(()=>{if(t)return;let s=!0,p=setTimeout(async()=>{let h=V();if(h.length===0){W(null),G(void 0);return}try{let g=await B.quoteCart({items:h,currency:n,shippingMethodId:D??void 0,couponCode:te,customerEmail:X.current||void 0,country:y?.country||r||void 0,subdivision:y?.country&&y.subdivision||void 0});if(!s)return;W(g)}catch{if(!s)return}G(te)},Tn);return()=>{s=!1,clearTimeout(p)}},[l,n,D,te,r,y]);let Y=_(s=>{c(p=>{let h=p.findIndex(g=>g.id===s.id);return h===-1?[...p,s]:p.map((g,R)=>R===h?{...g,qty:Math.min(qe,g.qty+s.qty)}:g)}),kt(s,n)},[n]),Pe=_(s=>{c(p=>p.filter(h=>h.id!==s))},[]),we=_((s,p)=>{let h=Math.max(1,Math.min(qe,p));c(g=>g.map(R=>R.id===s?{...R,qty:h}:R))},[]),E=_(s=>{c(s)},[]),[k,ne]=L(null),nt=Ie(null);nt.current=k;let $=Ie(null),Fe=Ie(""),rt=_((s,p)=>{let h=s.trim().toLowerCase();Rt(h)&&ne(g=>g&&g.email===h&&g.firstName===(p??"")?g:{email:h,firstName:p??""})},[]);Z(()=>{if(t||!k)return;let s=_t(l.filter(Le),g=>Ye(g,n)===null?Re:o(Ye(g,n),n)),p={email:k.email,firstName:k.firstName,currency:n,items:s},h=JSON.stringify(p);if(h!==Fe.current)return $.current&&clearTimeout($.current),$.current=setTimeout(()=>{$.current=null,Fe.current=h,B.captureCart(p).catch(g=>{})},On),()=>{$.current&&(clearTimeout($.current),$.current=null)}},[l,k,n,t]);let ot=_(()=>{$.current&&(clearTimeout($.current),$.current=null);let s=nt.current;s&&(Fe.current="",B.captureCart({email:s.email,firstName:s.firstName,currency:n,items:[]}).catch(p=>{}))},[n]),it=Mt(()=>{let s=l.reduce((T,re)=>{let _e=Ye(re,n);return _e===null?T:T+_e},0),p=l.some(T=>Ut(T,n)===null),h=l.reduce((T,re)=>T+re.qty,0),g=m?.valid?m.effects:void 0,R=g?Math.min(s,Number(g.discountAmount)):0,de=x?.bundleDiscount??0,nn=x?.appliedBundles??[],Ue=!!g?.freeShipping,st=z.find(T=>T.id===D),lt=Ue?0:x?.shipping??st?.amount??0,rn=Ot({quoted:x!==null,optionCount:z.length,chosenAmount:st?.amount,couponWaivesFreight:Ue}),He={};for(let T of g?.freeUnits??[])He[T.partNumber]=(He[T.partNumber]??0)+T.quantity;let on=x?.tax??null,an=x?x.grandTotal:s-R-de+lt;return{sets:h,units:l.reduce((T,re)=>T+(re.components??[]).reduce((_e,sn)=>_e+sn.wheels*re.qty,0),0),subtotal:s,hasUnpricedLine:p,discount:R,bundleDiscount:de,appliedBundles:nn,shipping:lt,freeShipping:Ue,shippingStatus:rn,freeUnitsByPartNumber:He,tax:on,grand:an,repricing:!!m?.refused&&x!==null&&A===m?.code,currency:n}},[l,n,m,z,D,x,A]),at=_(s=>{Y(s),K()},[Y,K]),tn=Mt(()=>({isOpen:i,preview:t,open:K,close:se,toggle:ee,items:l,catalog:u,bundles:d,warmCatalog:H,add:Y,addAndOpen:at,remove:Pe,setQty:we,replaceItems:E,identify:rt,clearCapturedCart:ot,coupon:m,applyCoupon:le,removeCoupon:ue,refuseCoupon:ce,couponBusy:J,deliveryOptions:z,setQuoteDestination:ve,shippingMethodId:D,setShippingMethodId:Se,totals:it}),[i,t,K,se,ee,l,u,d,H,Y,at,Pe,we,E,rt,ot,m,le,ue,ce,J,z,ve,D,it]);return Mn(Ht.Provider,{value:tn,children:e})}function $t(){let e=An(Ht);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as zn}from"react";function Bt(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 Dn=6e4,Fn=5e3,Un=500,Ae=new Map;async function Hn(e){let{host:t,matchesRequestHost:n}=await pt();if(!t)return"";let r=await mt();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}var $n=e=>e.includes("|slug:")||e.includes("|xhost:");async function Wt(e,t){if(await gt()!==null)return t();let n=await Hn(e);if(!n)return t();let r=Date.now(),o=Ae.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),a=i.outcome.state==="failed",l=a?Fn:Dn,c=Ae.get(n)?.lastGood,u=i.outcome.state==="ok"?i:a?c:void 0,f=a&&u?u:i;return Bt(Ae,Un,$n,r),Ae.set(n,{load:f,expiresAt:r+l,lastGood:u}),f}var Bn=404;function Wn(e){if(e instanceof pe&&e.status===Bn)return{state:"absent"};let t=e instanceof pe?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var Gn="[storefront:chrome-load-failed]";function qn(e,t){console.error(`${Gn} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function Gt(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=Wn(o);return i.state==="failed"&&qn(e,i),{value:n,outcome:i}}}function Kn(e){return e==="production"?"silent":"banner"}var Mo=Kn("production");function Xn(e,t){return e?.trim()||t}function Go({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=Xn(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var Vn={name:fe,legalName:null,foundedYear:null,faviconUrl:null,currencies:[],defaultCurrency:null,countries:[],defaultCountry:null,commerceEnabled:!0,cardPayments:!1,paymentMethods:[],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,socialLinks:$e},qo=zn(async()=>Wt("site",()=>Gt("site",async()=>{let e=await B.getSite();return{name:ct(e.name),legalName:e.legalName?.trim()||null,foundedYear:e.foundedYear??null,faviconUrl:e.faviconUrl??null,currencies:e.currencies??[],defaultCurrency:e.defaultCurrency??null,countries:e.countries??[],defaultCountry:e.defaultCountry??null,commerceEnabled:e.commerceEnabled??!0,cardPayments:e.cardPayments??!1,paymentMethods:e.paymentMethods??(e.cardPayments?["card"]:[]),paypalClientId:e.paypalClientId??null,paypalEnvironment:e.paypalEnvironment??null,squareApplicationId:e.squareApplicationId??null,squareLocationId:e.squareLocationId??null,squareEnvironment:e.squareEnvironment??null,ga4MeasurementId:e.ga4MeasurementId??null,googleAdsId:e.googleAdsId??null,googleAdsConversionLabel:(e.googleAdsId?e.googleAdsConversionLabel:null)??null,metaPixelId:e.metaPixelId??null,consentEnabled:e.consentEnabled??!1,consentPrivacyPage:e.consentPrivacyPage??null,consentNoticeOptOut:e.consentNoticeOptOut??!1,socialLinks:dt(e.socialLinks)}},Vn)));var Ko={name:fe,legalName:null,foundedYear:null,faviconUrl:null,currencies:[{code:"USD",symbol:"$",decimalPlaces:2,isDefault:!0}],defaultCurrency:"USD",countries:[{code:"US",name:"United States",currency:"USD",url:"",isDefault:!0,chargeTax:!1,taxDisplay:"none",taxName:"",taxRate:null,postalLabel:"Zip Code"}],defaultCountry:"US",commerceEnabled:!0,cardPayments:!0,paymentMethods:["card"],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,socialLinks:$e};import{jsx as be,jsxs as Qe}from"react/jsx-runtime";import{useEffect as ke,useId as Zn,useRef as Kt,useState as Te}from"react";import{efficientClientOpen as Yn}from"efficient-easel/screen/lib/session";var ye=new Map,Qn=64;async function jn(e){if(!Yn())return null;try{let t=await fetch(`${ut()}/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 qt(e){let t=ye.get(e);if(t)return t;let n=jn(e);if(ye.set(e,n),ye.size>Qn){let r=ye.keys().next();r.done||ye.delete(r.value)}return n}var Jn=202/22,er=.88,ai=16,tr="invert(1)";function si({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,wordmark:f,siteName:d=fe,fitToContainer:S=!1,fitWordmarkToContainer:N=!1,fitFloorPx:C}){let b=f&&f.trim()?f.trim():d,[P,O]=Te(!1),M=Kt(null),I=E=>{M.current=E};ke(()=>{let E=M.current?.ownerDocument??document,k=()=>{O(E.documentElement.getAttribute("data-theme")==="light")};k();let ne=new MutationObserver(k);return ne.observe(E.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>ne.disconnect()},[]);let v=n&&n.trim()?n.trim():null,x=!!v&&ft(v),W=i??(P&&t),A=o&&o.trim()?o.trim():null,G=r&&!A,y=`logo-color-${Zn().replace(/[^A-Za-z0-9_-]/g,"")}`,w=G&&x&&v&&a!=null?{reversed:a,inkIsDark:l??null}:null,m=w!==null,[q,J]=Te(null);ke(()=>{if(!G||!v||!x||m){J(null);return}let E=!1;return J(null),qt(v).then(k=>{E||J(k)}),()=>{E=!0}},[G,v,x,m]);let U=w??q,D=!!U&&U.inkIsDark!==null&&(W?!U.inkIsDark:U.inkIsDark),Se=G&&!!v&&!x&&!W,X=D&&U?U.reversed:v,K=X?[X]:[],[se,ee]=Te(0);ke(()=>{ee(0)},[v,D]);let ve=e==="footer"?We:Be[c],H=u&&u>0?u:ve,Ee=Math.round(H*Jn),F=se<K.length?K[se]:null,[z,V]=Te(X),le=F!==null&&F===z,ue=Kt(null);ke(()=>{let E=ue.current;if(!E||!E.complete)return;if(E.naturalWidth>0||E.naturalHeight>0){V(F);return}let k=!1;return E.decode().then(()=>!k&&V(F),()=>!k&&ee(ne=>ne+1)),()=>{k=!0}},[F]);let ce=S||N,te=`calc(100cqi / ${((b.length+1)*er).toFixed(2)})`,Y=ce&&C&&C>0?Math.min(C,H):null,Pe=ce?Y===null?`min(${H}px, ${te})`:`clamp(${Y}px, ${te}, ${H}px)`:`${H}px`,we=Qe("span",{className:`font-display font-bold tracking-[0.18em] ${Y===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:Pe,lineHeight:1,...A?{color:A}:{}},"aria-label":b,children:[b,be("span",{className:"text-accent",style:A?{color:A}:void 0,children:"."})]});return Qe("span",{ref:I,className:"inline-flex items-center",children:[!le&&we,A&&F&&be("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:Qe("filter",{id:y,colorInterpolationFilters:"sRGB",children:[be("feFlood",{style:{floodColor:A}}),be("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),F&&be("img",{ref:ue,src:F,alt:b,width:Ee,height:H,className:"shrink-0 object-contain",style:{...le?{height:`${H}px`,width:"auto",...S?{maxWidth:"100cqi"}:{}}:{display:"none"},...Se?{filter:tr}:{},...A?{filter:`url(#${y})`}:{}},onLoad:()=>V(F),onError:()=>ee(E=>E+1)},F)]})}import{jsx as Ce,jsxs as rr}from"react/jsx-runtime";function nr({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 f=u+Math.PI/e;l.push({x1:a(100+Math.cos(f)*22*1.4),y1:a(100+Math.sin(f)*22*1.4),x2:a(100+Math.cos(f)*78),y2:a(100+Math.sin(f)*78),main:!1})}}return rr("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:[Ce("circle",{cx:100,cy:100,r:92,strokeWidth:2}),Ce("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),Ce("circle",{cx:100,cy:100,r:22,strokeWidth:2}),Ce("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),l.map((c,u)=>Ce("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 di="#c9a461",zt=[{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"}],fi={name:"",color:"var(--fg)",family:"silver",src:""};function or(e,t){let n=r=>{let o=zt.findIndex(i=>i.f===r);return o===-1?zt.length:o};return n(e)-n(t)||e.localeCompare(t)}function pi(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(or)}import{useState as ir}from"react";import{jsx as ae,jsxs as je}from"react/jsx-runtime";function ar({customerEmail:e}){let{coupon:t,applyCoupon:n,removeCoupon:r,couponBusy:o}=$t(),[i,a]=ir("");async function l(){o||!i.trim()||(await n(i,e),a(""))}return je("div",{className:"flex flex-col gap-2",children:[t===null?je("div",{className:"flex border border-line",children:[ae("input",{type:"text",value:i,onChange:c=>a(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),l())},placeholder:"Coupon code","aria-label":"Coupon code",className:"flex-1 bg-transparent px-4 py-4 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim"}),ae("button",{type:"button",onClick:()=>{l()},disabled:o,className:"border-l border-line px-4 font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-wait disabled:opacity-60",children:o?"\u2026":"Apply"})]}):je("div",{className:["flex items-center justify-between gap-3 border px-4 py-3",t.valid?"border-accent":"border-line"].join(" "),style:t.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[ae("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",t.valid?"text-accent":t.deferred?"text-fg":"text-fg-dim line-through"].join(" "),children:t.code}),ae("button",{type:"button",onClick:r,"aria-label":`Remove coupon ${t.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"\u2715"})]}),t?.deferred?ae("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:wt}):t&&!t.valid&&t.message&&ae("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:t.message})]})}var Ze="Ads on. Shopper can opt out.",Oe="Ads and analytics off until Accept",sr={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:Ze,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:Oe,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:Ze,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:Ze,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:Oe,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:Oe,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:Oe,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}};function lr(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 xi(e,t,n){let r=lr(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 Si={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on"};var ur={asked:!1,region:"other",model:"opt-in",analytics:!0,ads:!0,chosen:!0,gpc:!1};var cr=ur;function wi(e=cr){if(e.asked)return e.ads?"granted":"denied"}function Ni(){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 fr,isValidElement as pr,useEffect as Vt,useId as mr,useLayoutEffect as jt,useRef as Q,useState as Yt}from"react";var Me=(e,t)=>!!e[t]&&!e[t].disabled;function Je(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(Me(e,i))return i}return t}function et(e,t){return Je(e,t===1?-1:e.length,t)}function tt(e,t){return Me(e,t)?t:Math.max(et(e,1),0)}function Xt(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)=>Me(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:Je(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:Je(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:et(n,1)}),handled:!0};case"End":return{state:i({focus:et(n,-1)}),handled:!0};case"Enter":case" ":return Me(n,o)?{state:i({open:!1,typed:""}),commit:o,refocus:!0,handled:!0}:{state:e,handled:!0};case"Escape":return{state:i({open:!1,typed:""}),refocus:!0,handled:!0};case"Tab":return{state:i({open:!1,typed:""}),handled:!1};default:return{state:e,handled:!1}}}import{placeMenu as gr}from"efficient-shell/ui";import{Fragment as Sr,jsx as j,jsxs as Zt}from"react/jsx-runtime";var Qt={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function hr({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[a,l]=Yt(!1),c=r!==void 0,u=c?r:a,[f,d]=Yt(0),S=Q({text:"",timer:0}),N=Q(null),C=Q(null),b=Q(null),P=mr(),O=Q(null),M=e.findIndex(y=>y.value===t),I=y=>{y!==u&&(c||l(y),y?o?.():i?.())},v=y=>{let w=e[y];!w||w.disabled||(n(w.value),I(!1),C.current?.focus())},x=y=>{let w={open:u,focus:u?f:tt(e,M),typed:S.current.text},m=Xt(w,y,e);return!m.handled&&m.state.open===u?!1:(m.state.typed!==w.typed&&(S.current.text=m.state.typed,window.clearTimeout(S.current.timer),S.current.timer=window.setTimeout(()=>{S.current.text=""},500)),d(m.state.focus),m.commit!==void 0?v(m.commit):I(m.state.open),m.refocus&&C.current?.focus(),m.handled)},W=Q(x);W.current=x;let A=Q(()=>I(!1));A.current=()=>I(!1);let G=y=>{u||(O.current=y.nativeEvent,W.current(y.key)&&y.preventDefault())};return Vt(()=>{if(!u)return;let y=m=>{N.current?.contains(m.target)||A.current()},w=m=>{m!==O.current&&W.current(m.key)&&m.preventDefault()};return document.addEventListener("mousedown",y),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",w)}},[u]),Vt(()=>{u&&(S.current.text||d(tt(e,M)))},[u]),jt(()=>{if(!u||!b.current)return;b.current.children.item(f)?.scrollIntoView({block:"nearest"})},[f,u]),{open:u,toggle:()=>I(!u),close:()=>I(!1),focusIdx:f,setFocusIdx:d,pick:y=>v(e.findIndex(w=>w.value===y)),wrapRef:N,triggerRef:C,listRef:b,listId:P,onTriggerKeyDown:G,activeId:u?`${P}-${f}`:void 0}}var yr={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 ${Qt.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 ${Qt.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 br(e,t){jt(()=>{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",f=gr({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(f.side==="top"){i.top="auto",i.bottom="100%",i.marginTop="0px";let S=f.top+Math.min(c.height,f.maxHeight);i.marginBottom=`${Math.max(0,l.top-S)}px`}f.maxHeight<c.height&&(i.maxHeight=`${f.maxHeight}px`,i.overflowY="auto");let d=f.left-c.left;d&&(i.translate=`${d}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function Cr({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:a,listRef:l,ariaLabel:c}){let u=yr[t],f=Q(null);return br(f,n.length),j("ul",{ref:d=>{f.current=d,l&&(l.current=d)},id:e,role:"listbox","aria-label":c,...u.pickerMarker?{"data-picker-menu":""}:{},className:u.list,children:n.map((d,S)=>{let N=d.value===r;return j("li",{id:`${e}-${S}`,role:"option","aria-selected":N,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(S),onMouseDown:C=>{C.preventDefault(),d.disabled||a(d.value)},className:u.item(S===o,N&&d.value!=="",!!d.disabled,S===n.length-1),style:u.itemStyle?.(N),children:d.meta===void 0?d.label:Zt(Sr,{children:[d.lead,j("span",{className:"flex-1 whitespace-nowrap",children:d.label}),j("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${S}`)})})}function xr({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:a,id:l,"aria-label":c}){let u=fr.toArray(r).flatMap(C=>{if(!pr(C))return[];if(C.type!=="option")return[];let P=C.props,O=P.value!==void 0?String(P.value):"",M=P.children,I=typeof M=="string"||typeof M=="number"?String(M):O;return[{value:O,label:I,disabled:!!P.disabled}]}),f=e??"",d=hr({items:u,value:f,onPick:C=>t?.({target:{value:C}})}),N=u.find(C=>C.value===f)?.label??u[0]?.label??"";return Zt("div",{ref:d.wrapRef,className:"relative",children:[a&&j("input",{type:"hidden",name:a,value:f}),j("button",{ref:C=>{d.triggerRef.current=C},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":d.open,"aria-controls":d.open?d.listId:void 0,"aria-activedescendant":d.activeId,"aria-label":c,id:l,onClick:()=>!n&&d.toggle(),onKeyDown:C=>!n&&d.onTriggerKeyDown(C),className:`block w-full ${o??""}`,style:i,children:j("span",{className:"block w-full truncate text-left",children:N})}),d.open&&j(Cr,{id:d.listId,tone:"select",items:u,value:f,focusIdx:d.focusIdx,onFocus:d.setFocusIdx,onPick:d.pick,listRef:d.listRef})]})}import{jsx as xe,jsxs as De}from"react/jsx-runtime";var vr="font-mono text-[length:var(--size-label,12px)]",Er="font-semibold uppercase tracking-[0.22em] text-fg";function Jt(e){return`${e??vr} ${Er}`}function en(){return xe("span",{className:"text-accent",children:" *"})}function Pr({children:e,required:t,labelFace:n}){return De("span",{className:Jt(n),children:[e,t?xe(en,{}):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?xe("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?De("div",{className:c,children:[De("label",{htmlFor:o,className:Jt(i),children:[e,t?xe(en,{}):null]}),l,u]}):De("label",{htmlFor:o,className:c,children:[xe(Pr,{required:t,labelFace:i,children:e}),l]})}export{Wr as a,Gr as b,qr as c,ht as d,Ge as e,_r as f,Nr as g,Rr as h,Lr as i,ln as j,un as k,Ir as l,Ar as m,qe as n,Ne as o,me as p,kr as q,Re as r,yn as s,bn as t,Vr as u,Yr as v,Nt as w,Xe as x,Qr as y,jr as z,xn as A,Zr as B,Jr as C,Sn as D,eo as E,En as F,to as G,no as H,Rt as I,lo as J,uo as K,co as L,mo as M,go as N,Fr as O,vt as P,Ur as Q,Le as R,Ye as S,No as T,$t as U,Go as V,Vn as W,Ko as X,ai as Y,si as Z,nr as _,di as $,zt as aa,fi as ba,or as ca,pi as da,ar as ea,sr as fa,xi as ga,Si as ha,ur as ia,wi as ja,Ni as ka,hr as la,Cr as ma,xr as na,Pr as oa,wr as pa};
|