efficient-storefront-blocks 0.0.0 → 0.12.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/README.md CHANGED
@@ -1,4 +1,281 @@
1
1
  # efficient-storefront-blocks
2
2
 
3
- Reserved by Efficient Pty Ltd for the EFFICIENT storefront's sections, registered into
4
- `efficient-web-builder`. Real releases are published by CI.
3
+ The EFFICIENT storefront's **website editor** — the website builder (the page,
4
+ template and section editors) assembled with every section the storefront
5
+ renders — for an app that edits a storefront website **inside its own page**.
6
+ The admin portal's Storefront editor windows mount it.
7
+
8
+ Published as `efficient-web` up to 0.3.0 and as `efficient-web-builder` from
9
+ 0.7.0 to 0.10.0; 0.11.0 is the first release under this name (`CHANGELOG.md`
10
+ says how to migrate). The name `efficient-web-builder` now belongs to the
11
+ builder alone, published from its own repository
12
+ ([`Efficient-Pty-Ltd/efficient-web-builder`](https://github.com/Efficient-Pty-Ltd/efficient-web-builder)):
13
+ the editor, the general sections and the renderer, with no storefront in it.
14
+
15
+ It is not a second copy of anything: `build.mjs` compiles the shop's own
16
+ `components/` and `lib/` from this repository, starting at `src/index.tsx`.
17
+ The shop itself never installs it; its pages import the same source directly.
18
+
19
+ ## Use
20
+
21
+ ```tsx
22
+ import "efficient-storefront-blocks/editor.css";
23
+ import { WebsiteEditor, createEditorHost } from "efficient-storefront-blocks";
24
+
25
+ const { host, deliver } = createEditorHost({
26
+ onMessage: (m) => { /* toasts, open the media picker, the form builder … */ },
27
+ address: { search: () => "", show: () => {}, load: retargetWindow, reload: remount },
28
+ });
29
+ // Grant a token when the editor says it is ready, and again on auth-expired:
30
+ // deliver({ type: "storefront-editor:auth", token, siteId, can })
31
+
32
+ <WebsiteEditor host={host} target={{ kind: "page", slug: "homepage", siteId }} site={{ slug, origin }} />;
33
+ ```
34
+
35
+ - **Messages** are the `storefront-editor:*` protocol the editor once spoke
36
+ over postMessage from the shop's `/edit` routes, as function calls — no
37
+ origin, no iframe.
38
+ `EditorToHostMessage` / `HostToEditorMessage` type every one.
39
+ - **`site`** — the website's `slug` (public catalog reads name it with
40
+ `?site=`, because the embedder's own host names no website) and its public
41
+ `origin` (the routes only the storefront serves, and the Preview link).
42
+ Re-mount the editor with a `key` to move to another website.
43
+ - **One editor mounted at a time.** Parts of the editor keep the open website
44
+ and page in module state; route every target into one window.
45
+ - **Styles.** `efficient-storefront-blocks/editor.css` is the chrome, scoped under
46
+ `.sf-editor`; the engine's sheets are imported from the embedder's own
47
+ `efficient-easel`. The canvas is styled from inside its own frame (the
48
+ storefront's compiled `app/globals.css`), so neither page's styles reach the
49
+ other.
50
+ - **Peers:** `react`/`react-dom` 19, `efficient-easel`, `efficient-shell`.
51
+
52
+ ## A backend of your own (0.4.0)
53
+
54
+ The editor reaches its server only through a `WebsiteBackend`
55
+ (`doc/adr/0002`). Leave `backend` out and it is EFFICIENT's — `/api/storefront/*`,
56
+ authorised by the token you deliver with `storefront-editor:auth`, exactly as
57
+ above. A product with its own backend passes its own:
58
+
59
+ ```tsx
60
+ import { WebsiteEditor, WebsiteBackendError, type WebsiteBackend } from "efficient-storefront-blocks";
61
+
62
+ const backend: WebsiteBackend = {
63
+ pages: {
64
+ list: () => api.pages(), // EditorPageRow[]
65
+ load: (ref) => api.page(ref), // { id, layout, version } | null
66
+ save: async (id, doc, expect) => {
67
+ const res = await api.savePage(id, doc.layout, expect.version);
68
+ if (res.conflict) {
69
+ throw new WebsiteBackendError("changed-elsewhere", undefined, {
70
+ conflict: { savedBy: res.by, savedByYou: res.mine, secondsAgo: res.ago },
71
+ });
72
+ }
73
+ return { version: res.version };
74
+ },
75
+ },
76
+ site: { get: () => api.site() }, // { name }
77
+ media: { resolve: (ref) => (ref.startsWith("file:") ? cdn(ref) : null) },
78
+ };
79
+
80
+ <WebsiteEditor host={host} target={{ kind: "page", slug: "home" }} site={null} backend={backend} />;
81
+ ```
82
+
83
+ - **Required:** `pages` (`list`, `load`, `save`), `site.get`, `media.resolve`.
84
+ **Optional**, each switching its own control on: `pages.version`,
85
+ `pages.publish` (the main button reads Publish, not Save), `pages.create` /
86
+ `pages.remove` (inline in the page list), `lock` (the "somebody else is
87
+ editing" notices and take-over), `site.update` (the Maps key), `preview`
88
+ (the Preview link), `sectionTemplates`, `templates`. A missing group is never
89
+ a dead button: the editor does not draw what it cannot do.
90
+ - **Failures are kinds.** Reject with `WebsiteBackendError`: `unauthorized`,
91
+ `changed-elsewhere` (+ `conflict`), `lock-taken` (+ `holder`), `not-found`,
92
+ `invalid`, `unavailable`. The editor never reads a status code or a body.
93
+ - **No token.** How a call is authorised is the backend's business. The editor
94
+ waits for no `auth` message and needs none; it announces `ready` once, and
95
+ when a save, a publish or a lock claim is refused `unauthorized` it tells the
96
+ host `auth-expired` and lets the autosave try again.
97
+ - **No request of its own.** Under your backend the package's own HTTP client is
98
+ closed and the canvas loads no font sheet from Google.
99
+ - **`PageBundle`** is `{ layout, translations?, seo? }`. 0.4.0 reads and writes
100
+ `layout` only; store the bundle anyway — `translations` and `seo` are where
101
+ per-language content will live, and an absent member means "leave it".
102
+ - **Not behind the interface yet** (they work under EFFICIENT's backend, and are
103
+ absent under yours): site styles, the pinned header and footer, menus,
104
+ forms, the catalog, "duplicate to page". Block
105
+ settings that list such data (product link targets, product sources) list
106
+ nothing, and a Form section's picker is inert: it offers no list, no "New
107
+ form" and sends no `open-form`.
108
+ - **`backend.pages.linkTargets`** (optional): your pages with their layouts, for
109
+ the link picker. Without it the picker lists `pages.list` and no anchors.
110
+ - **`backend.media.maxUploadBytes`** (optional): the largest file a media field
111
+ takes before it reaches your panel or picker; leave it out to refuse none.
112
+ - **`backend.theme`** (optional): `get` / `update` the website's appearance —
113
+ the `SiteThemeRow` behind Site styles (colour themes, fonts and sizes,
114
+ corners, cards, widths). `update` is handed only the keys that changed and
115
+ answers the whole row. Without it the editor shows no Site styles and the
116
+ website is drawn in the built-in look.
117
+ - **`backend.social`** (optional): `get` / `update` the website's social links,
118
+ one address per platform name. Reject a bad address with
119
+ `new WebsiteBackendError("invalid", message, { fields: { instagram: "…" } })`
120
+ and the reason is shown beside that platform's box.
121
+ - **`backend.chat`** (optional): `get` / `update` the live-chat bubble's
122
+ settings. (The Live chat panel itself is still drawn only where the site's
123
+ settings are — EFFICIENT's backend — until those settings cross too.)
124
+ - **`backend.blog`** (optional): `posts(scope?)` answers your published posts.
125
+ With it a section's "Blog post source" and the link picker's "Blog post"
126
+ list your blog; without it neither offers a list.
127
+ - `backend` is read once, when the editor mounts — re-mount (a `key`) to change it.
128
+
129
+ ## Which blocks the editor offers (0.7.0)
130
+
131
+ Every block is in one of three **sets**:
132
+
133
+ | Set | What it is |
134
+ |---|---|
135
+ | `general` | Draws from its own props and what the host hands it (media, the site's logo, its Maps key). Any host may offer it. |
136
+ | `commerce` | The shop: products, the catalogue, the cart, the checkout, the pinned Header. |
137
+ | `service` | Needs one of the EFFICIENT backend's site services: forms, bookings, reviews, the newsletter, the blog, menus, the pinned Footer. |
138
+
139
+ Which block is in which set is `GENERAL_BLOCKS`, `COMMERCE_BLOCKS` and
140
+ `SERVICE_BLOCKS` in `efficient-storefront-blocks/contract`.
141
+
142
+ Leave `blocks` out and the editor offers all of them, exactly as before 0.7.0.
143
+ Pass it to choose:
144
+
145
+ ```tsx
146
+ import { WebsiteEditor, type WebsiteEditorBlocks } from "efficient-storefront-blocks";
147
+ import type { ComponentConfig } from "efficient-easel/blocks";
148
+
149
+ const Roster: ComponentConfig = {
150
+ label: "Roster",
151
+ fields: { heading: { type: "text", label: "Heading" } },
152
+ defaultProps: { heading: "On tonight" },
153
+ // `puck.metadata` is whatever you hand the editor as `blocks.metadata`.
154
+ render: ({ heading, puck }) => <RosterSection heading={heading} people={puck.metadata.roster} />,
155
+ };
156
+
157
+ const blocks: WebsiteEditorBlocks = {
158
+ sets: ["general"], // default: all three
159
+ deny: ["CustomHTML"], // never these
160
+ // allow: [...], // or: only these (after `sets`)
161
+ host: { "acme-roster": Roster }, // your own blocks, by type
162
+ categories: [{ key: "acme", title: "Venue", components: ["acme-roster"], before: "openers" }],
163
+ metadata: { roster }, // live: change it and the canvas redraws
164
+ };
165
+
166
+ <WebsiteEditor host={host} target={target} site={null} backend={backend} blocks={blocks} />;
167
+ ```
168
+
169
+ - **Offered, not registered.** A block you leave out is in no group of the Add
170
+ panel, no slot's "Add block" menu and no drop target, and no section is
171
+ seeded with it. It is still registered: a page that already holds one draws
172
+ it, and it can be selected and deleted.
173
+ - **A section is offered only with what it is built from.** Adding a Hero
174
+ writes Hero Slides, and "Brand Text" lays down Boxes, a Heading and a Text —
175
+ so a Hero is not offered where `HeroSlide` is not, and Brand Text is not
176
+ where the Box is not. `allow: ["Hero"]` therefore offers nothing; `allow:
177
+ ["Hero", "HeroSlide"]` offers the Hero. To see what a section writes, add it
178
+ and run `blockTypesIn` on the saved layout. A section that is only *wrapped*
179
+ in a Box when it is added (most sections with a heading) is added whole
180
+ instead where the Box or the Section Header is not offered.
181
+ - **With a set left out, what needs it is not drawn.** Without `service`: no
182
+ "Blog post" link target, no "Blog post source" on Feature Banner, Article
183
+ Text and Post Card, an inert Form picker. Without `commerce`: no "Product"
184
+ link target, no catalog seed. The pinned Header and Footer need both.
185
+ - **Your own blocks.** Written as the engine's `ComponentConfig`, with its
186
+ field types (`text`, `textarea`, `number`, `select`, `radio`, `array`,
187
+ `object`, `custom`, `slot`). A type the editor already registers is refused —
188
+ the editor throws when it mounts — so give yours a prefix. A block is added
189
+ from the Add panel, in the group `categories` names; one named in no group is
190
+ registered and offered nowhere, and none is offered inside a Box. A
191
+ `categories` entry whose `key` is an existing group (`content`, `structure`,
192
+ …) adds to the end of that group.
193
+ - **Your blocks get none of the editor's own section rows.** The Padding,
194
+ Width, Height, Anchor, Theme, Corners and Animation rows, the four settings
195
+ tabs and click-to-edit text are added to the editor's own blocks by ~25
196
+ passes that run once, when the package loads, over lists fixed in its source.
197
+ A block that arrives when the editor mounts is not on those lists, so it is
198
+ drawn exactly as its `render` draws it and edited with exactly the fields it
199
+ declares. The one exception is the Layers tree's eye, which hides your block
200
+ as it hides any other (it stores `_hidden: true` on the node's props). Giving
201
+ host blocks the rest needs an `applyBlockPasses(type, block)` the package
202
+ does not have yet: each pass rewritten from a loop over a fixed list into a
203
+ function of one block, run in the same order.
204
+ - **`metadata` is live; the rest is read once.** `sets`, `allow`, `deny`,
205
+ `host` and `categories` are read when the editor mounts, with `backend` —
206
+ re-mount (a `key`) to change them. `metadata` is followed: hand the editor a
207
+ new object and every block in the canvas redraws in place. It is never
208
+ written to the page or to the undo history. Keep the object the same between
209
+ renders while the data is the same (a `useMemo`, a state value): a new object
210
+ each render redraws the canvas each render.
211
+
212
+ ### Checking a saved page on your server
213
+
214
+ **Hiding a block in the editor is not a security boundary.** `blocks` decides
215
+ what the editor offers; a page is a JSON document, and whoever can call your
216
+ save endpoint can send one holding any block type. Check it where you store it:
217
+
218
+ ```ts
219
+ import { GENERAL_BLOCKS, blockTypesIn } from "efficient-storefront-blocks/contract";
220
+
221
+ const ALLOWED = new Set([...GENERAL_BLOCKS, "acme-roster"]);
222
+
223
+ function assertAllowed(layout: unknown) {
224
+ const refused = blockTypesIn(layout).filter((type) => !ALLOWED.has(type));
225
+ if (refused.length) throw new Error(`This page holds blocks this site does not allow: ${refused.join(", ")}`);
226
+ }
227
+ ```
228
+
229
+ `efficient-storefront-blocks/contract` is one small file that imports nothing — no React, no
230
+ engine, no editor — so a server can load it. It exports `BLOCK_SETS`,
231
+ `GENERAL_BLOCKS`, `COMMERCE_BLOCKS`, `SERVICE_BLOCKS`, `blockSetOf(type)` and
232
+ `blockTypesIn(layout)`.
233
+
234
+ `blockTypesIn` reads a layout by shape: any `{ type, props }` in the page's
235
+ `content`, in a `zones` entry, or in an array under a node's props is a block,
236
+ to any depth. It errs wide — something that merely looks like a block is
237
+ counted — so a check built on it can refuse a page it might have accepted, and
238
+ never the reverse. If `ALLOWED` is narrower than what your editor offers, list
239
+ the blocks your sections are built from as well (see above), or the editor will
240
+ build pages your server refuses.
241
+
242
+ ### Drawing a link the way the editor does
243
+
244
+ `efficient-storefront-blocks/links` is the editor's link rules, for a host that draws the
245
+ shared link picker (efficient-easel `LinkPicker`) somewhere else — the admin's
246
+ menu items. It is built from the same file the editor's own Link field reads,
247
+ so a link written in one place reads back the same in the other.
248
+
249
+ ```ts
250
+ import {
251
+ LINK_KINDS, inferLinkKind, isSafeLink, listingFilterFields,
252
+ listingTarget, productListingPaths, readListingFilter, withListingFilter,
253
+ } from "efficient-storefront-blocks/links";
254
+
255
+ const listing = productListingPaths(pages, { fallback: sellsProducts });
256
+ inferLinkKind("/shop?type=tyre", pagePaths, listing); // "page"
257
+ withListingFilter("/wheels", { param: "collection", value: "Precision Forged" });
258
+ // "/wheels?collection=Precision%20Forged"
259
+ isSafeLink("javascript:alert(1)"); // false
260
+ ```
261
+
262
+ `listingFilterFields(catalogue, { listing, fieldUsage })` lists the filters a
263
+ link onto the product listing may offer — the listing's own rail for the kinds
264
+ the section shows, after the site's Product Types answers and the one-value
265
+ rule — each with the values the site's catalogue has. Light like `/contract`:
266
+ one file, no import of any kind.
267
+
268
+ ## Release
269
+
270
+ The version here is bumped **by hand** in the pull request that wants the admin
271
+ to see a change (and a `CHANGELOG.md` section added). After it merges:
272
+
273
+ ```
274
+ gh release create web-vX.Y.Z --target <merge sha> --notes-file <the CHANGELOG section>
275
+ ```
276
+
277
+ `.github/workflows/release-web.yml` builds and publishes it (npm trusted
278
+ publishing). Then bump the admin portal's pin.
279
+
280
+ Closed source: © Efficient Pty Ltd, all rights reserved (`LICENSE`); the
281
+ published files are minified and ship no source maps.
@@ -0,0 +1,4 @@
1
+ "use client";import{F as qt,G as _t,H as Ft,I as se,J as we,K as Dt,L as Ut,M as Xe,N as Mt,P as Ze,V as Wt,Y as Qe,Z as Kt,a as Ot,b as Lt,c as Tt,d as jt,da as W,ea as $t,fa as Yt,ga as Bt}from"./chunk-R2JQPRJX.js";import{i as _e,m as fe,t as T}from"./chunk-QL3UVEEM.js";import{La as It,a as Rt,c as ee}from"./chunk-BAXOL3AI.js";import{s as At,t as Se,u as z}from"./chunk-NQIIJI3Z.js";import{a as Je,b as ar}from"./chunk-Y6SLVHK3.js";var Ht=Je((ea,zt)=>{"use strict";var or="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";zt.exports=or});var Xt=Je((ta,Jt)=>{"use strict";var ir=Ht();function Vt(){}function Gt(){}Gt.resetWarningCache=Vt;Jt.exports=function(){function t(a,o,s,l,d,p){if(p!==ir){var u=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 u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:Gt,resetWarningCache:Vt};return n.PropTypes=n,n}});var Qt=Je((aa,Zt)=>{"use strict";Zt.exports=Xt()();var na,ra});import{useEffect as $,useMemo as Be,useRef as le,useState as g}from"react";var w=ar(Qt(),1);import x from"react";function en(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,a=Array(e);n<e;n++)a[n]=t[n];return a}function sr(t){if(Array.isArray(t))return t}function on(t,e,n){return(e=mr(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function cr(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var a,o,s,l,d=[],p=!0,u=!1;try{if(s=(n=n.call(t)).next,e!==0)for(;!(p=(a=s.call(n)).done)&&(d.push(a.value),d.length!==e);p=!0);}catch(v){u=!0,o=v}finally{try{if(!p&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(u)throw o}}return d}}function lr(){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 tn(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,a)}return n}function nn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?tn(Object(n),!0).forEach(function(a){on(t,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tn(Object(n)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(n,a))})}return t}function ur(t,e){if(t==null)return{};var n,a,o=pr(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(a=0;a<s.length;a++)n=s[a],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}function pr(t,e){if(t==null)return{};var n={};for(var a in t)if({}.hasOwnProperty.call(t,a)){if(e.indexOf(a)!==-1)continue;n[a]=t[a]}return n}function sn(t,e){return sr(t)||cr(t,e)||fr(t,e)||lr()}function dr(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var a=n.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function mr(t){var e=dr(t,"string");return typeof e=="symbol"?e:e+""}function et(t){"@babel/helpers - typeof";return et=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},et(t)}function fr(t,e){if(t){if(typeof t=="string")return en(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?en(t,e):void 0}}var j=function(e,n,a){var o=!!a,s=x.useRef(a);x.useEffect(function(){s.current=a},[a]),x.useEffect(function(){if(!o||!e)return function(){};var l=function(){if(s.current)return s.current.apply(s,arguments)};return e.on(n,l),function(){e.off(n,l)}},[o,n,e,s])},tt=function(e){var n=x.useRef(e);return x.useEffect(function(){n.current=e},[e]),n.current},ge=function(e){return e!==null&&et(e)==="object"},gr=function(e){return ge(e)&&typeof e.then=="function"},yr=function(e){return ge(e)&&typeof e.elements=="function"&&typeof e.createToken=="function"&&typeof e.createPaymentMethod=="function"&&typeof e.confirmCardPayment=="function"},rn="[object Object]",hr=function t(e,n){if(!ge(e)||!ge(n))return e===n;var a=Array.isArray(e),o=Array.isArray(n);if(a!==o)return!1;var s=Object.prototype.toString.call(e)===rn,l=Object.prototype.toString.call(n)===rn;if(s!==l)return!1;if(!s&&!a)return e===n;var d=Object.keys(e),p=Object.keys(n);if(d.length!==p.length)return!1;for(var u={},v=0;v<d.length;v+=1)u[d[v]]=!0;for(var b=0;b<p.length;b+=1)u[p[b]]=!0;var m=Object.keys(u);if(m.length!==d.length)return!1;var h=e,A=n,k=function(S){return t(h[S],A[S])};return m.every(k)},cn=function(e,n,a){return ge(e)?Object.keys(e).reduce(function(o,s){var l=!ge(n)||!hr(e[s],n[s]);return a.includes(s)?(l&&console.warn("Unsupported prop change: options.".concat(s," is not a mutable property.")),o):l?nn(nn({},o||{}),{},on({},s,e[s])):o},null):null},ln="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.",an=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ln;if(e===null||yr(e))return e;throw new Error(n)},vr=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ln;if(gr(e))return{tag:"async",stripePromise:Promise.resolve(e).then(function(o){return an(o,n)})};var a=an(e,n);return a===null?{tag:"empty"}:{tag:"sync",stripe:a}},br=function(e){!e||!e._registerWrapper||!e.registerAppInfo||(e._registerWrapper({name:"react-stripe-js",version:"6.7.0"}),e.registerAppInfo({name:"react-stripe-js",version:"6.7.0",url:"https://stripe.com/docs/stripe-js/react"}))},Fe=x.createContext(null);Fe.displayName="ElementsContext";var un=function(e,n){if(!e)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 e},rt=function(e){var n=e.stripe,a=e.options,o=e.children,s=x.useMemo(function(){return vr(n)},[n]),l=x.useState(function(){return{stripe:s.tag==="sync"?s.stripe:null,elements:s.tag==="sync"?s.stripe.elements(a):null}}),d=sn(l,2),p=d[0],u=d[1];x.useEffect(function(){var m=!0,h=function(k){u(function(C){return C.stripe?C:{stripe:k,elements:k.elements(a)}})};return s.tag==="async"&&!p.stripe?s.stripePromise.then(function(A){A&&m&&h(A)}):s.tag==="sync"&&!p.stripe&&h(s.stripe),function(){m=!1}},[s,p,a]);var v=tt(n);x.useEffect(function(){v!==null&&v!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[v,n]);var b=tt(a);return x.useEffect(function(){if(p.elements){var m=cn(a,b,["clientSecret","fonts"]);m&&p.elements.update(m)}},[a,b,p.elements]),x.useEffect(function(){br(p.stripe)},[p.stripe]),x.createElement(Fe.Provider,{value:p},o)};rt.propTypes={stripe:w.default.any,options:w.default.object};var pn=function(e){var n=x.useContext(Fe);return un(n,e)},dn=function(){var e=pn("calls useElements()"),n=e.elements;return n},xr=function(e){var n=e.children,a=pn("mounts <ElementsConsumer>");return n(a)};xr.propTypes={children:w.default.func.isRequired};var mn=x.createContext(null);mn.displayName="CheckoutContext";var nt=function(e){var n=x.useContext(mn),a=x.useContext(Fe);if(n){if(a)throw new Error("You cannot wrap the part of your app that ".concat(e," in both a checkout provider and <Elements> provider."));return n}else return un(a,e)},kr=["mode"],Cr=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},R=function(e,n,a){var o="".concat(Cr(e),"Element"),s=function(u){var v=u.id,b=u.className,m=u.options,h=m===void 0?{}:m,A=u.onBlur,k=u.onFocus,C=u.onReady,S=u.onChange,D=u.onEscape,L=u.onClick,J=u.onLoadError,te=u.onLoaderStart,Ee=u.onNetworksChange,ue=u.onConfirm,Re=u.onCancel,ne=u.onShippingAddressChange,Ie=u.onShippingRateChange,re=u.onSavedPaymentMethodRemove,Ae=u.onSavedPaymentMethodUpdate,ye=u.onAvailablePaymentMethodsChange,ae=nt("mounts <".concat(o,">")),Q="elements"in ae?ae.elements:null,Y="checkoutState"in ae?ae.checkoutState:null,H=Y?.type==="success"||Y?.type==="loading"?Y.sdk:null,he=x.useState(null),pe=sn(he,2),E=pe[0],ve=pe[1],_=x.useRef(null),oe=x.useRef(null);j(E,"blur",A),j(E,"focus",k),j(E,"escape",D),j(E,"click",L),j(E,"loaderror",J),j(E,"loaderstart",te),j(E,"networkschange",Ee),j(E,"confirm",ue),j(E,"cancel",Re),j(E,"shippingaddresschange",ne),j(E,"shippingratechange",Ie),j(E,"savedpaymentmethodremove",re),j(E,"savedpaymentmethodupdate",Ae),j(E,"availablepaymentmethodschange",ye),j(E,"change",S);var ie;C&&(e==="expressCheckout"?ie=C:ie=function(){C(E)}),j(E,"ready",ie),x.useLayoutEffect(function(){if(_.current===null&&oe.current!==null&&(Q||H)){var P=null;if(H){var V=H,be=H;switch(e){case"paymentForm":P=be.createForm(h);break;case"payment":P=V.createPaymentElement(h);break;case"address":if("mode"in h){var de=h.mode,xe=ur(h,kr);if(de==="shipping")P=V.createShippingAddressElement(xe);else if(de==="billing")P=V.createBillingAddressElement(xe);else throw new Error("Invalid options.mode. mode must be 'billing' or 'shipping'.")}else throw new Error("You must supply options.mode. mode must be 'billing' or 'shipping'.");break;case"expressCheckout":P=V.createExpressCheckoutElement(h);break;case"currencySelector":P=H.createCurrencySelectorElement();break;case"taxId":P=V.createTaxIdElement(h);break;case"contactDetails":P=V.createContactDetailsElement();break;default:throw new Error("<".concat(o,"> is not supported inside a checkout provider. Use an <Elements> provider instead."))}}else Q&&(P=Q.create(e,h));_.current=P,ve(P),P&&P.mount(oe.current)}},[Q,H,h]);var B=tt(h);return x.useEffect(function(){if(_.current){var P=cn(h,B,["paymentRequest"]);P&&"update"in _.current&&_.current.update(P)}},[h,B]),x.useLayoutEffect(function(){return function(){if(_.current&&typeof _.current.destroy=="function")try{_.current.destroy(),_.current=null}catch{}}},[]),x.createElement("div",{id:v,className:b,ref:oe})},l=function(u){nt("mounts <".concat(o,">"));var v=u.id,b=u.className;return x.createElement("div",{id:v,className:b})},d=n?l:s;return d.propTypes={id:w.default.string,className:w.default.string,onChange:w.default.func,onBlur:w.default.func,onFocus:w.default.func,onReady:w.default.func,onEscape:w.default.func,onClick:w.default.func,onLoadError:w.default.func,onLoaderStart:w.default.func,onNetworksChange:w.default.func,onConfirm:w.default.func,onCancel:w.default.func,onShippingAddressChange:w.default.func,onShippingRateChange:w.default.func,onSavedPaymentMethodRemove:w.default.func,onSavedPaymentMethodUpdate:w.default.func,onAvailablePaymentMethodsChange:w.default.func,options:w.default.object},d.displayName=o,d.__elementType=e,d},I=typeof window>"u",Sr=x.createContext(null);Sr.displayName="EmbeddedCheckoutProviderContext";var fn=function(){var e=nt("calls useStripe()"),n=e.stripe;return n},ia=R("auBankAccount",I),sa=R("card",I),ca=R("cardNumber",I),la=R("cardExpiry",I),ua=R("cardCvc",I),pa=R("currencySelector",I),da=R("iban",I),gn=R("payment",I),ma=R("expressCheckout",I),fa=R("paymentRequestButton",I),ga=R("linkAuthentication",I),ya=R("contactDetails",I),ha=R("address",I),va=R("shippingAddress",I),ba=R("paymentMethodMessaging",I),xa=R("taxId",I),ka=R("issuingCardNumberDisplay",I),Ca=R("issuingCardCvcDisplay",I),Sa=R("issuingCardExpiryDisplay",I),wa=R("issuingCardPinDisplay",I),Pa=R("issuingCardCopyButton",I);function Me(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Me=function(e){return typeof e}:Me=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Me(t)}var vn="dahlia",wr=function(e){return e===3?"v3":e},bn="https://js.stripe.com",Pr="".concat(bn,"/").concat(vn,"/stripe.js"),Nr=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Er=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,yn="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",Rr=function(e){return Nr.test(e)||Er.test(e)},Ir=function(){for(var e=document.querySelectorAll('script[src^="'.concat(bn,'"]')),n=0;n<e.length;n++){var a=e[n];if(Rr(a.src))return a}return null},hn=function(e){var n=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",a=document.createElement("script");a.src="".concat(Pr).concat(n);var o=document.head||document.body;if(!o)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return o.appendChild(a),a},Ar=function(e,n){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"9.9.0",startTime:n})},Pe=null,De=null,Ue=null,Or=function(e){return function(n){e(new Error("Failed to load Stripe.js",{cause:n}))}},Lr=function(e,n){return function(){window.Stripe?e(window.Stripe):n(new Error("Stripe.js not available"))}},Tr=function(e){return Pe!==null?Pe:(Pe=new Promise(function(n,a){if(typeof window>"u"||typeof document>"u"){n(null);return}if(window.Stripe&&e&&console.warn(yn),window.Stripe){n(window.Stripe);return}try{var o=Ir();if(o&&e)console.warn(yn);else if(!o)o=hn(e);else if(o&&Ue!==null&&De!==null){var s;o.removeEventListener("load",Ue),o.removeEventListener("error",De),(s=o.parentNode)===null||s===void 0||s.removeChild(o),o=hn(e)}Ue=Lr(n,a),De=Or(a),o.addEventListener("load",Ue),o.addEventListener("error",De)}catch(l){a(l);return}}),Pe.catch(function(n){return Pe=null,Promise.reject(n)}))},jr=function(e,n,a){if(e===null)return null;var o=n[0];if(typeof o!="string")throw new Error("Expected publishable key to be of type string, got type ".concat(Me(o)," instead."));var s=o.match(/^pk_test/),l=wr(e.version),d=vn;s&&l!==d&&console.warn("Stripe.js@".concat(l," was loaded on the page, but @stripe/stripe-js@").concat("9.9.0"," expected Stripe.js@").concat(d,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var p=e.apply(void 0,n);return Ar(p,a),p},Ne,xn=!1,kn=function(){return Ne||(Ne=Tr(null).catch(function(e){return Ne=null,Promise.reject(e)}),Ne)};Promise.resolve().then(function(){return kn()}).catch(function(t){xn||console.warn(t)});var Cn=function(){for(var e=arguments.length,n=new Array(e),a=0;a<e;a++)n[a]=arguments[a];xn=!0;var o=Date.now();return kn().then(function(s){return jr(s,n,o)})};var qr="sf:gclid",_r="sf:fbclid",Fr=2160*60*60*1e3;function Pn(){return typeof window<"u"}function Sn(t){let e=Se.getItem(t);if(!e)return"";try{let{v:n,t:a}=JSON.parse(e);return!n||typeof a!="number"||Date.now()-a>Fr?"":n}catch{return""}}function wn(t){if(!Pn())return"";let e=t.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1"),n=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return n?decodeURIComponent(n[1]):""}function Nn(){if(!Pn())return{};let t=Sn(qr),e=Sn(_r),n=wn("_fbp"),a=wn("_fbc");!a&&e&&(a=`fb.1.${Date.now()}.${e}`);let o={};return t&&(o.gclid=t),e&&(o.fbclid=e),n&&(o.fbp=n),a&&(o.fbc=a),o}var En="sf:meta-purchases",Dr=20;function In(){return typeof window>"u"||window.parent!==window}function Ur(...t){try{if(In()||typeof window.fbq!="function")return;window.fbq(...t)}catch{}}var Rn=new Set;function Mr(t){if(Rn.has(t))return!1;Rn.add(t);try{let e=JSON.parse(Se.getItem(En)??"[]");if(e.includes(t))return!1;Se.setItem(En,JSON.stringify([...e,t].slice(-Dr)))}catch{}return!0}function Wr(t){return[...new Set(t.filter(we).flatMap(e=>e.components.map(n=>n.partNumber)))]}function An(t){let e=t.confirmation;In()||!Mr(e.orderNumber)||Ur("track","Purchase",{value:Number(e.grandTotal),currency:e.currency,content_type:"product",content_ids:Wr(t.lines)},{eventID:e.orderNumber})}var at="checkout-afterpay-context",We="checkout-gocardless-context",ot="checkout-zip-context",Ke="checkout-klarna-context";function Kr({evidence:t,parked:e}){return t?{action:"capture",evidence:t,parked:e}:e?{action:"settle",parked:e}:{action:"ignore"}}function $r(t,e){let n=t.getItem(e);if(t.removeItem(e),!n)return null;try{return JSON.parse(n)}catch{return null}}var On={name:"Afterpay",legParam:"afterpay",legValues:["confirm","cancel"],storageKey:at,evidenceFrom(t,e){return e==="cancel"||(t.get("status")??"").toUpperCase()==="CANCELLED"?null:t.get("orderToken")},requestFrom:t=>({token:t})},Ln={name:"Zip",legParam:"zip",legValues:["return"],storageKey:ot,evidenceFrom(t){let e=(t.get("result")??"").toLowerCase();return e==="cancelled"||e==="declined"?null:t.get("checkoutId")},requestFrom:t=>({checkoutId:t})};async function it(t,e){let n=new URLSearchParams(e.search),a=n.get(t.legParam);if(!a||!t.legValues.includes(a))return;let o=$r(e.storage,t.storageKey),s=t.evidenceFrom(n,a);e.scrubQuery();let l=Kr({evidence:s,parked:o});if(l.action!=="ignore"){if(e.page.clearCart(),l.action==="settle"){e.page.note(`The ${t.name} payment was not completed \u2014 our team will follow up on payment.`),e.page.land(l.parked.confirmation);return}e.page.setConfirming(!0);try{let d=await e.capture(t.requestFrom(l.evidence));d.status==="paid"?e.page.markPaid():e.page.note(`${t.name} declined the payment \u2014 our team will follow up on payment.`),e.page.land(l.parked?.confirmation??d)}catch{l.parked?(e.page.note(`We could not confirm the ${t.name} payment \u2014 our team will follow up on payment.`),e.page.land(l.parked.confirmation)):e.page.fail(`We could not confirm your ${t.name} payment. Please contact us before trying again \u2014 your payment may already have been taken.`)}finally{e.page.setConfirming(!1)}}}import{Fragment as q,jsx as r,jsxs as c}from"react/jsx-runtime";function Tn(t){let e=t.indexOf(`
3
+ `);return e===-1?[t,""]:[t.slice(0,e),t.slice(e+1)]}function jn(t,{canParkContext:e}={canParkContext:!0}){let n=t.paymentMethods,a=[];return n.includes("card")&&a.push({key:"card",title:"Card",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA \xB7 MC \xB7 AMEX"})}),n.includes("paypal")&&t.paypalClientId&&a.push({key:"paypal",title:"PayPal",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAYPAL \xB7 CARDS"})}),n.includes("afterpay")&&a.push({key:"afterpay",title:"Afterpay",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"4 \xD7 INTEREST-FREE"})}),n.includes("square")&&t.squareApplicationId&&t.squareLocationId&&a.push({key:"square",title:"Card (Square)",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA \xB7 MC \xB7 AMEX"})}),n.includes("gocardless")&&e&&a.push({key:"gocardless",title:"Bank Direct Debit",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY BY BANK"})}),n.includes("zip")&&a.push({key:"zip",title:"Zip",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY IN 4"})}),n.includes("klarna")&&e&&a.push({key:"klarna",title:"Klarna",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY LATER"})}),a.push({key:"bank",title:"Bank transfer",body:null,price:r("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Invoiced"})}),a}function lt({site:t,logo:e,preview:n=!1}){let{items:a,totals:o,coupon:s,refuseCoupon:l,deliveryOptions:d,shippingMethodId:p,setShippingMethodId:u,identify:v,clearCapturedCart:b}=Xe(),m=d.find(i=>i.id===p)?.pickupLocation??null,{country:h,countries:A,activeCountry:k,formatMoney:C}=se(),[S,D]=g(()=>jn(t)[0].key),[L,J]=g(!0);$(()=>{J(At(z))},[]);let[te,Ee]=g(!0),[ue,Re]=g(!1),[ne,Ie]=g(""),[re,Ae]=g(""),[ye,ae]=g(""),[Q,Y]=g(""),[H,he]=g(""),[pe,E]=g(""),[ve,_]=g(""),[oe,ie]=g(""),[B,P]=g(()=>h||A[0]?.code||""),[V,be]=g(""),[de,xe]=g([]),Mn=Be(()=>A.find(i=>i.code===B)??k,[A,B,k])?.postalLabel||"Postal Code",Wn=de[0]?.divisionType||"State / Province";$(()=>{if(!B){xe([]);return}let i=!1;return T.listCountrySubdivisions(B).then(f=>{i||(xe(f),be(""))}),()=>{i=!0}},[B]);let[X,ut]=g(null),[pt,dt]=g([]),[Oe,Le]=g("new"),[He,mt]=g(!1),[ft,Kn]=g("Home"),[gt,yt]=g(null),[U]=g(()=>Bt()),[Te,M]=g(null),[ht,ke]=g(null),[vt,$n]=g(null),[Yn,Bn]=g(!1),[zn,Hn]=g(!1),[G,Ve]=g(null),[bt,me]=g(!1),[xt,Z]=g(null),[Vn,Gn]=g(!1),[Jn,kt]=g(!1),[Xn,Zn]=g(!1),[Qn,Ct]=g(!1),St=le(!1);$(()=>{n||St.current||!a.some(we)||(St.current=!0,qt({lines:a,currency:o.currency,value:o.subtotal-o.discount,coupon:s?.valid?s.code:void 0}))},[a,o,s,n]),$(()=>{v(ne,re.trim()||void 0)},[ne,re,v]);let wt=le(null),[je,er]=g(null);$(()=>{let i=wt.current;if(!je||!i)return;let f=()=>i.style.setProperty("--sf-checkout-header-h",`${je.offsetHeight}px`);f();let y=new ResizeObserver(f);return y.observe(je),()=>y.disconnect()},[je]),$(()=>{let i=y=>({setConfirming:y,land:M,markPaid:()=>me(!0),note:Z,fail:ke,clearCart:b}),f={search:window.location.search,storage:z,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};it(On,{...f,capture:T.captureAfterpayPayment,page:i(Gn)}),it(Ln,{...f,capture:T.captureZipPayment,page:i(Zn)})},[]),$(()=>{let f=new URLSearchParams(window.location.search).get("gocardless");if(f!=="confirm"&&f!=="cancel")return;let y=z.getItem(We);if(z.removeItem(We),window.history.replaceState(null,"",window.location.pathname),!y)return;let N;try{N=JSON.parse(y)}catch{return}if(b(),f==="cancel"){Z("The direct debit was not set up \u2014 our team will follow up on payment."),M(N.confirmation);return}kt(!0),T.completeGocardlessPayment({idempotencyKey:N.idempotencyKey}).then(O=>{O.status==="paid"?me(!0):O.status==="declined"?Z("The direct debit was declined \u2014 our team will follow up on payment."):Z("Your direct debit is set up \u2014 the payment is collecting and will clear in a few days.")}).catch(()=>{Z("We could not confirm the direct debit \u2014 our team will follow up on payment.")}).finally(()=>{M(N.confirmation),kt(!1)})},[]),$(()=>{let i=new URLSearchParams(window.location.search),f=i.get("klarna");if(f!=="confirm"&&f!=="cancel")return;let y=z.getItem(Ke);z.removeItem(Ke);let N=i.get("authorization_token");if(window.history.replaceState(null,"",window.location.pathname),!y)return;let O;try{O=JSON.parse(y)}catch{return}if(b(),f==="cancel"||!N){Z("The Klarna payment was not completed \u2014 our team will follow up on payment."),M(O.confirmation);return}Ct(!0),T.captureKlarnaPayment({idempotencyKey:O.idempotencyKey,authorizationToken:N}).then(F=>{F.status==="paid"?me(!0):F.status==="declined"?Z("Klarna declined the payment \u2014 our team will follow up on payment."):Z("Your Klarna payment is being reviewed \u2014 we'll confirm the outcome shortly.")}).catch(()=>{Z("We could not confirm the Klarna payment \u2014 our team will follow up on payment.")}).finally(()=>{M(O.confirmation),Ct(!1)})},[]);function Pt(i){let[f,y]=Tn(i.address);Y(f),he(y),E(i.city),_(i.zip_code),i.country&&P(i.country),i.phone&&ie(i.phone)}$(()=>{let i=!1;return(async()=>{try{let[f,y,N]=await Promise.all([fe.me(),fe.myProfile().catch(()=>null),fe.myAddresses().catch(()=>[])]);if(i)return;ut(f);let O=N.filter(Ce=>Ce.is_active);dt(O),Ie(f.email);let F=(y?.contact_name??"").split(/\s+/);Ae(f.first_name||F[0]||""),ae(f.last_name||F.slice(1).join(" "));let Et=f.phone||y?.phone;Et&&ie(Et);let Ge=O.find(Ce=>Ce.id===f.default_delivery_location)??O[0];if(Ge)Le(Ge.id),Pt(Ge);else if(y){let[Ce,rr]=Tn(y.address??"");Y(Ce),he(rr),E(y.city??""),_(y.zip_code??""),y.country&&P(y.country)}}catch{}})(),()=>{i=!0}},[]);function tr(){fe.logout(),ut(null),dt([]),Le("new"),mt(!1)}let qe=Be(()=>jn(t,{canParkContext:L}),[t,L]);$(()=>{qe.some(i=>i.key===S)||D(qe[0].key)},[qe,S]);let Nt=H.trim()?`${Q}
4
+ ${H.trim()}`:Q;async function nr(){if(n||ue||a.length===0||o.repricing)return;let i=a.filter(we).flatMap(f=>jt(f.components,f.qty));if(i.length===0){ke("Pick a size on each wheel's product page before checking out.");return}Re(!0),ke(null);try{let y=await(X?T.createOrderAuthed:T.createOrder)({customer:{email:ne,name:`${re} ${ye}`.trim(),phone:oe.trim()||void 0,address:Nt,city:pe,state:V||void 0,zipCode:ve,country:B},items:i,currency:o.currency,idempotencyKey:U,shippingMethodId:p??void 0,couponCode:Lt(s),...Nn()});if(_t({confirmation:y,lines:a,adsSendTo:t.googleAdsId&&t.googleAdsConversionLabel?`${t.googleAdsId}/${t.googleAdsConversionLabel}`:null}),An({confirmation:y,lines:a}),b(),X&&He&&Oe==="new")try{await fe.createAddress({label:ft.trim()||"Home",contact_name:`${re} ${ye}`.trim(),phone:oe.trim(),address:Nt,city:pe,zip_code:ve,country:B}),yt("Address saved to your account.")}catch{yt("We couldn't save the address to your account \u2014 you can add it under Account \u2192 Addresses.")}if(S==="card"&&t.paymentMethods.includes("card")){let N=await T.createPaymentIntent({idempotencyKey:U});Ve(y),$n(N)}else if(S==="paypal"&&t.paymentMethods.includes("paypal"))Ve(y),Bn(!0);else if(S==="afterpay"&&t.paymentMethods.includes("afterpay")){let N=window.location.origin,O=await T.createAfterpayCheckout({idempotencyKey:U,confirmUrl:`${N}/checkout?afterpay=confirm`,cancelUrl:`${N}/checkout?afterpay=cancel`}),F={idempotencyKey:U,confirmation:y};z.setItem(at,JSON.stringify(F)),window.location.assign(O.redirectCheckoutUrl);return}else if(S==="square"&&t.paymentMethods.includes("square"))Ve(y),Hn(!0);else if(S==="gocardless"&&t.paymentMethods.includes("gocardless")){let N=window.location.origin,O=await T.createGocardlessBillingRequest({idempotencyKey:U,confirmUrl:`${N}/checkout?gocardless=confirm`,cancelUrl:`${N}/checkout?gocardless=cancel`}),F={idempotencyKey:U,confirmation:y};z.setItem(We,JSON.stringify(F)),window.location.assign(O.authorisationUrl);return}else if(S==="zip"&&t.paymentMethods.includes("zip")){let N=window.location.origin,O=await T.createZipCheckout({idempotencyKey:U,redirectUrl:`${N}/checkout?zip=return`}),F={idempotencyKey:U,confirmation:y};z.setItem(ot,JSON.stringify(F)),window.location.assign(O.redirectUrl);return}else if(S==="klarna"&&t.paymentMethods.includes("klarna")){let N=window.location.origin,O=await T.createKlarnaCheckout({idempotencyKey:U,confirmUrl:`${N}/checkout?klarna=confirm`,cancelUrl:`${N}/checkout?klarna=cancel`}),F={idempotencyKey:U,confirmation:y};z.setItem(Ke,JSON.stringify(F)),window.location.assign(O.redirectUrl);return}else M(y)}catch(f){let y=Tt(f);y?(l(y),ke(`${y} Your order has not been placed. Place it again to continue without the code.`)):ke(f instanceof _e?f.message:"Could not place the order. Please try again."),Re(!1)}}return Te?c("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[r("h1",{className:"font-display text-3xl",children:bt?"Payment received":"Order received"}),c("p",{className:"text-fg-dim",children:[bt?c(q,{children:["Thank you \u2014 your payment for order"," ",r("span",{className:"font-mono text-fg",children:Te.orderNumber})," has gone through."," "]}):c(q,{children:["Thank you \u2014 your order ",r("span",{className:"font-mono text-fg",children:Te.orderNumber})," is being reviewed by our team."," "]}),X?c(q,{children:["Track it under"," ",r(ee,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):r(q,{children:"We\u2019ve emailed you a link to set a password and track it."})]}),xt&&r("p",{className:"text-sm text-fg-dim",children:xt}),gt&&r("p",{className:"text-sm text-fg-dim",children:gt}),!X&&c("p",{className:"text-sm text-fg-dim",children:["You can also"," ",r(ee,{href:`/track?order=${encodeURIComponent(Te.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email \u2014 no password needed."]}),r(ee,{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"})]}):Vn?c("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[r("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Afterpay \u2014 one moment."})]}):Jn?c("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[r("h1",{className:"font-display text-3xl",children:"Setting up your direct debit\u2026"}),r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Confirming with GoCardless \u2014 one moment."})]}):Xn?c("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[r("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Zip \u2014 one moment."})]}):Qn?c("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[r("h1",{className:"font-display text-3xl",children:"Confirming your payment\u2026"}),r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Klarna \u2014 one moment."})]}):vt?r(Yr,{payment:vt,onPaid:()=>{me(!0),M(G)},onSkip:()=>M(G)}):Yn&&G?r(Hr,{confirmation:G,clientId:t.paypalClientId??"",idemKey:U,onPaid:()=>{me(!0),M(G)},onSkip:()=>M(G)}):zn&&G?r(Gr,{confirmation:G,applicationId:t.squareApplicationId??"",locationId:t.squareLocationId??"",environment:t.squareEnvironment??"production",idemKey:U,onPaid:()=>{me(!0),M(G)},onSkip:()=>M(G)}):c("div",{ref:wt,className:"bg-bg text-fg",children:[c("header",{ref:er,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-[22px] 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:[c(ee,{href:"/",className:"inline-flex items-center gap-2.5 font-mono text-[13px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["\u2190",r("span",{className:"max-[640px]:hidden",children:"Back to shop"})]}),r(ee,{href:"/","aria-label":`${t.name} home`,className:"inline-flex items-center justify-center",children:r(Wt,{variant:"header",scrolled:!0,src:e?.url??null,reverse:e?.reverse??!1,reversedSrc:e?.reversed??null,inkIsDark:e?.inkIsDark??null,size:e?.size??"medium",sizePx:e?.sizePx??null,siteName:t.name})}),t.cardPayments?c("span",{className:"flex items-center justify-end gap-2.5 font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim",children:[r("span",{className:"text-green",children:"\u25CF"}),r("span",{className:"max-[640px]:hidden",children:"Encrypted \xB7"})," Stripe"]}):r("span",{})]}),c("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:[r("span",{className:"inline-flex items-center bg-accent px-2.5 py-1 font-bold text-bg",children:"Checkout"}),r("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:"Review",state:"pending"},{n:"04",label:"Confirmed",state:"pending"}].map(i=>c("span",{className:["relative flex items-center gap-2 transition-colors",i.state==="pending"?"text-fg-dim":"text-fg",i.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[r("span",{className:i.state==="done"?"text-accent font-bold":"",children:i.n}),r("span",{children:i.label})]},i.n))})]}),c("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-9 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:[c("div",{children:[c($e,{num:"N\xB0 01",title:"Contact",children:[r(W,{label:"Email",hint:X?c(q,{children:["Signed in \xB7"," ",r("button",{type:"button",onClick:tr,className:"underline transition-colors hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:r("input",{type:"email",value:ne,onChange:i=>Ie(i.target.value),placeholder:"you@example.com",readOnly:X!==null,className:K+(X?" opacity-70":"")})}),c(_n,{children:[r(W,{label:"First name",children:r("input",{type:"text",value:re,onChange:i=>Ae(i.target.value),className:K})}),r(W,{label:"Last name",children:r("input",{type:"text",value:ye,onChange:i=>ae(i.target.value),className:K})})]})]}),c($e,{num:"N\xB0 02",title:m?"Collection":"Shipping address",children:[m?c("div",{className:"grid gap-1.5 text-[14px] leading-[1.6]",children:[r("span",{className:"font-medium",children:m.name}),[m.address,m.city,m.state,m.zipCode,m.country].filter(Boolean).length>0&&r("span",{className:"opacity-80",children:[m.address,m.city,m.state,m.zipCode,m.country].filter(Boolean).join(", ")}),m.openingHours&&r("span",{className:"opacity-80",children:m.openingHours}),m.instructions&&r("span",{className:"opacity-80",children:m.instructions}),r("span",{className:"mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"No delivery address needed"})]}):c(q,{children:[X!==null&&pt.length>0&&c("div",{className:"grid gap-2.5",children:[pt.map(i=>r(Ye,{active:Oe===i.id,onClick:()=>{Le(i.id),Pt(i)},title:i.label,body:i.formatted_address,price:null},i.id)),r(Ye,{active:Oe==="new",onClick:()=>Le("new"),title:"New address",body:null,price:null})]}),r(W,{label:"Address line 1",children:r("input",{type:"text",value:Q,onChange:i=>Y(i.target.value),className:K})}),r(W,{label:"Address line 2",children:r("input",{type:"text",value:H,onChange:i=>he(i.target.value),placeholder:"Apartment, unit, garage bay\u2026",className:K})}),c(_n,{cols:"three",children:[r(W,{label:"City",children:r("input",{type:"text",value:pe,onChange:i=>E(i.target.value),className:K})}),r(W,{label:Mn,children:r("input",{type:"text",value:ve,onChange:i=>_(i.target.value),className:K})}),r(W,{label:"Country",separate:!0,children:r(Qe,{value:B,onChange:i=>P(i.target.value),className:K+" pr-10",style:qn,children:A.map(i=>r("option",{value:i.code,children:i.name},i.code))})})]}),r(W,{label:Wn,separate:!0,children:de.length>0?c(Qe,{value:V,onChange:i=>be(i.target.value),className:K+" pr-10",style:qn,children:[r("option",{value:"",children:"Select\u2026"}),de.map(i=>r("option",{value:i.code||i.name,children:i.name},i.code||i.name))]}):r("input",{type:"text",value:V,onChange:i=>be(i.target.value),className:K})})]}),r(W,{label:"Phone",children:r("input",{type:"tel",value:oe,onChange:i=>ie(i.target.value),placeholder:"+44 7700 900000",className:K})}),!m&&X!==null&&Oe==="new"&&c(q,{children:[r(Un,{checked:He,onChange:mt,label:"Save this address to my account"}),He&&r(W,{label:"Address label",children:r("input",{type:"text",value:ft,onChange:i=>Kn(i.target.value),placeholder:"Home",className:K})})]}),!m&&r(Un,{checked:te,onChange:Ee,label:"Billing address is the same as shipping"})]}),r($e,{num:"N\xB0 03",title:"Shipping",children:c("div",{className:"grid gap-2.5",children:[d.map(i=>{let f=i.pickupLocation,y=f?[f.address,f.city,f.state,f.zipCode].filter(Boolean).join(", "):null;return r(Ye,{active:p===i.id,onClick:()=>u(i.id),title:f?`${i.name} \u2014 ${f.name}`:i.name,body:f?[y,f.openingHours,f.instructions,i.description].filter(Boolean).join(" \xB7 "):i.description||null,price:o.freeShipping||i.amount===0?"Free":C(i.amount,o.currency),tag:i.tag||void 0},i.id)}),d.length===0&&r("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Shipping is arranged after your order is reviewed."})]})}),c($e,{num:"N\xB0 04",title:"Payment",children:[r("div",{className:"grid gap-2.5",children:qe.map(i=>r(Ye,{active:S===i.key,onClick:()=>D(i.key),title:i.title,body:i.body,price:i.price,tag:i.tag},i.key))}),S==="card"?r("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."}):S==="paypal"?r("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."}):S==="afterpay"?r("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."}):S==="square"?r("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."}):S==="gocardless"?r("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."}):S==="zip"?r("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."}):S==="klarna"?r("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."}):r("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."})]})]}),c("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(--surface) 70%, var(--bg)) 0%, var(--bg) 100%)"},children:[c("header",{className:"flex items-center justify-between border-b border-accent bg-accent px-6 py-3.5 font-mono text-[13px] font-bold uppercase tracking-[0.28em] text-bg",children:[r("span",{children:"Your order"}),r(ee,{href:"/wheels",className:"text-bg/80 transition-colors hover:text-bg",children:"Edit \u2197"})]}),r("div",{className:"flex flex-col px-6 py-2",children:a.length===0?c("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",r(ee,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog \u2192"})]}):a.map(i=>r(Jr,{slug:i.slug,name:i.name,qty:i.qty,config:i.config,configSummary:Xr(i.config),price:Dt(i,o.currency)??0,currency:o.currency},i.id))}),r("div",{className:"border-t border-line px-6 pt-5",children:r(Yt,{customerEmail:ne})}),c("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[r(ce,{label:"Subtotal",value:C(o.subtotal,o.currency)}),o.discount>0&&s?.valid&&r(ce,{label:`Coupon \xB7 ${s.code}`,value:c("span",{className:"font-semibold text-green",children:["\u2212 ",C(o.discount,o.currency)]})}),s?.deferred&&r(ce,{label:`Coupon \xB7 ${s.code}`,value:Ot}),s?.valid&&s.effects?.gift&&r(ce,{label:`Free gift \xB7 ${s.effects.gift.partNumber}${s.effects.gift.quantity>1?` \xD7${s.effects.gift.quantity}`:""}`,value:r("span",{className:"font-semibold text-green",children:"Free"})}),r(ce,{label:"Shipping",value:o.freeShipping||o.shipping===0?r("span",{className:"font-semibold text-green",children:"Free"}):C(o.shipping,o.currency)}),o.tax&&(o.tax.charged?r(ce,{label:o.tax.inclusive?`${o.tax.name} included \xB7 ${o.tax.rate}%`:o.tax.name,value:C(o.tax.amount,o.currency)}):o.tax.name?r(ce,{label:o.tax.name,value:"Calculated at checkout"}):null)]}),c("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:[r("span",{className:"font-display text-[20px] font-bold uppercase tracking-[0.04em] text-fg",children:"Total"}),r("span",{className:"text-right font-display text-[34px] font-bold leading-none tracking-[-0.025em] text-fg",children:o.repricing?"\u2026":C(o.grand,o.currency)})]}),c("div",{className:"flex flex-col gap-2.5 px-6 pt-[18px] pb-6",children:[ht&&r("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:ht}),o.hasUnpricedLine&&c("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 ",o.currency,". Remove them, or switch region, to continue."]}),r("button",{type:"button",onClick:nr,disabled:ue||a.length===0||o.hasUnpricedLine||o.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",a.length===0||ue||o.hasUnpricedLine||o.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:ue?c(q,{children:["Building order\u2026 ",r("span",{children:"\xB7"})]}):o.repricing?c(q,{children:["Updating total\u2026 ",r("span",{children:"\xB7"})]}):c(q,{children:[S==="bank"?"Place order":"Continue to payment"," \xB7"," ",C(o.grand,o.currency),r("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})})]})]})]}),r("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:r("span",{children:Mt({legalName:t.legalName,foundedYear:t.foundedYear,siteName:t.name})})})]})}var K="w-full border-2 border-line bg-bg px-4 py-3.5 font-display text-[17px] tracking-[-0.005em] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent",qn={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 $e({num:t,title:e,children:n}){return c("section",{className:"mb-6 border border-line bg-bg",children:[c("header",{className:"flex items-center gap-4 border-b border-line bg-surface px-6 py-3.5",children:[r("span",{className:"inline-flex items-center justify-center bg-accent px-2.5 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t}),r("h2",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:e})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:n})]})}function _n({cols:t="two",children:e}){return r("div",{className:["grid gap-3 max-[640px]:grid-cols-1",t==="two"?"grid-cols-2":"grid-cols-[1.2fr_1fr_1fr]"].join(" "),children:e})}function Ye({active:t,onClick:e,title:n,body:a,price:o,tag:s}){return c("button",{type:"button",onClick:e,"aria-pressed":t,className:["relative grid grid-cols-[auto_1fr_auto] items-center gap-[18px] border bg-bg px-[22px] py-[18px] text-left transition-colors",t?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-line hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--line))]"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 14%, var(--bg))"}:void 0,children:[t&&r("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),r("span",{className:["flex h-[18px] w-[18px] items-center justify-center rounded-full border-2",t?"border-accent":"border-fg-dim"].join(" "),children:t&&r("span",{className:"block h-2.5 w-2.5 rounded-full bg-accent"})}),c("span",{className:"flex min-w-0 flex-col gap-1",children:[c("span",{className:"flex flex-wrap items-baseline gap-2.5 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[n,s&&r("span",{className:"border px-1.5 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(--line))"},children:s})]}),a&&r("span",{className:"font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim",children:a})]}),r("span",{className:"whitespace-nowrap font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:o})]})}function Yr({payment:t,onPaid:e,onSkip:n}){let{formatMoney:a}=se(),o=Be(()=>Cn(t.publishableKey),[t.publishableKey]),s=Be(()=>{if(typeof document>"u")return;let l=getComputedStyle(document.documentElement),d=(u,v)=>l.getPropertyValue(u).trim()||v,p=document.documentElement.getAttribute("data-theme")!=="light";return{theme:p?"night":"stripe",variables:{colorPrimary:d("--accent",p?"#c9a461":"#8a6a2a"),colorBackground:d("--surface",p?"#131313":"#ffffff"),colorText:d("--fg",p?"#f5f1e8":"#0a0a0a"),borderRadius:"0px"}}},[]);return r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:c("div",{className:"w-full max-w-xl border border-line bg-bg",children:[c("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-3.5",children:[r("span",{className:"inline-flex items-center justify-center bg-accent px-2.5 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),r("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Payment"})]}),c("div",{className:"flex flex-col gap-4 px-6 py-6",children:[c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",r("span",{className:"text-fg",children:a(Number(t.amount),t.currency)})," ","by card to confirm it now."]}),r(rt,{stripe:o,options:{clientSecret:t.clientSecret,appearance:s},children:r(Br,{payment:t,onPaid:e,onSkip:n})})]})]})})}function Br({payment:t,onPaid:e,onSkip:n}){let{formatMoney:a}=se(),o=fn(),s=dn(),[l,d]=g(!1),[p,u]=g(null);async function v(){if(!o||!s||l)return;d(!0),u(null);let b=await o.confirmPayment({elements:s,redirect:"if_required"});if(b.error){u(b.error.message??"Payment failed. Please try again."),d(!1);return}let m=b.paymentIntent?.status;if(m==="succeeded"||m==="processing"){e();return}u("Payment did not complete. Please try again."),d(!1)}return c("div",{className:"flex flex-col gap-4",children:[r(gn,{}),p&&r("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:p}),r("button",{type:"button",onClick:v,disabled:!o||!s||l,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!o||!s||l?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:l?c(q,{children:["Processing\u2026 ",r("span",{children:"\xB7"})]}):c(q,{children:["Pay ",a(Number(t.amount),t.currency),r("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})}),r("button",{type:"button",onClick:n,disabled:l,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 Fn="paypal-sdk-js",st=null;function zr(t,e){let n=`${t}|${e}`;if(st?.key===n)return st.promise;let a=new Promise((o,s)=>{document.getElementById(Fn)?.remove();let l=document.createElement("script");l.id=Fn;let d=new URLSearchParams({"client-id":t,currency:e,intent:"capture"});l.src=`https://www.paypal.com/sdk/js?${d}`,l.onload=()=>{let p=window.paypal;p?o(p):s(new Error("PayPal SDK loaded without its namespace"))},l.onerror=()=>s(new Error("PayPal SDK failed to load")),document.head.appendChild(l)});return st={key:n,promise:a},a}function Hr({confirmation:t,clientId:e,idemKey:n,onPaid:a,onSkip:o}){let{formatMoney:s}=se(),l=le(null),[d,p]=g(!1),[u,v]=g(null),b=le(a);return b.current=a,$(()=>{let m=!1,h=null;return zr(e,t.currency).then(A=>{if(!(m||!l.current))return h=A.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await T.createPaypalOrder({idempotencyKey:n})).paypalOrderId,onApprove:async k=>{try{if((await T.capturePaypalOrder({idempotencyKey:n,paypalOrderId:k.orderID})).status==="paid"){b.current();return}v("PayPal did not complete the payment. Please try again.")}catch(C){v(C instanceof _e?C.message:"PayPal payment failed. Please try again.")}},onError:()=>{v("PayPal could not process the payment. Please try again.")}}),h.render(l.current).then(()=>{m||p(!0)})}).catch(()=>{m||v("PayPal could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{m=!0,h?.close?.()}},[e,t.currency,n]),r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:c("div",{className:"w-full max-w-xl border border-line bg-bg",children:[c("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-3.5",children:[r("span",{className:"inline-flex items-center justify-center bg-accent px-2.5 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),r("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"PayPal"})]}),c("div",{className:"flex flex-col gap-4 px-6 py-6",children:[c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",r("span",{className:"text-fg",children:s(Number(t.grandTotal),t.currency)})," ","with PayPal to confirm it now."]}),!d&&!u&&r("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal\u2026"}),r("div",{ref:l}),u&&r("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:u}),r("button",{type:"button",onClick:o,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later \u2014 our team will be in touch"})]})]})})}var Dn="square-web-sdk",ct=null;function Vr(t){let e=t==="sandbox"?"sandbox":"production";if(ct?.key===e)return ct.promise;let n=new Promise((a,o)=>{document.getElementById(Dn)?.remove();let s=document.createElement("script");s.id=Dn,s.src=e==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",s.onload=()=>{let l=window.Square;l?a(l):o(new Error("Square SDK loaded without its namespace"))},s.onerror=()=>o(new Error("Square SDK failed to load")),document.head.appendChild(s)});return ct={key:e,promise:n},n}function Gr({confirmation:t,applicationId:e,locationId:n,environment:a,idemKey:o,onPaid:s,onSkip:l}){let{formatMoney:d}=se(),p=le(null),u=le(null),v=le(null),[b,m]=g(!1),[h,A]=g(!1),[k,C]=g(null);$(()=>{let D=!1,L=null;return Vr(a).then(async J=>{if(D||!p.current)return;let te=J.payments(e,n);v.current=te,L=await te.card(),await L.attach(p.current),u.current=L,D||m(!0)}).catch(()=>{D||C("Square could not be loaded. You can pay later \u2014 your order stands either way.")}),()=>{D=!0,L?.destroy?.()}},[e,n,a]);async function S(){let D=u.current;if(!(!D||h)){A(!0),C(null);try{let L=await D.tokenize();if(L.status!=="OK"||!L.token){C(L.errors?.[0]?.message??"Please check the card details and try again."),A(!1);return}let J;try{J=(await v.current?.verifyBuyer?.(L.token,{amount:String(t.grandTotal),currencyCode:t.currency,intent:"CHARGE"}))?.token}catch{}if((await T.chargeSquare({idempotencyKey:o,sourceId:L.token,...J?{verificationToken:J}:{}})).status==="paid"){s();return}C("Square did not complete the payment. Please try again.")}catch(L){C(L instanceof _e?L.message:"Square payment failed. Please try again.")}A(!1)}}return r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:c("div",{className:"w-full max-w-xl border border-line bg-bg",children:[c("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-3.5",children:[r("span",{className:"inline-flex items-center justify-center bg-accent px-2.5 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),r("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Card"})]}),c("div",{className:"flex flex-col gap-4 px-6 py-6",children:[c("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",r("span",{className:"text-fg",children:d(Number(t.grandTotal),t.currency)})," ","by card to confirm it now."]}),!b&&!k&&r("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form\u2026"}),r("div",{ref:p}),k&&r("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:k}),r("button",{type:"button",onClick:S,disabled:!b||h,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!b||h?"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:h?c(q,{children:["Processing\u2026 ",r("span",{children:"\xB7"})]}):c(q,{children:["Pay ",d(Number(t.grandTotal),t.currency),r("span",{className:"transition-transform group-hover:translate-x-1",children:"\u2192"})]})}),r("button",{type:"button",onClick:l,disabled:h,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"})]})]})})}function Un({checked:t,onChange:e,label:n,sub:a}){return c("div",{className:"flex items-start gap-3 border-t border-line py-3.5 first:border-t-0 first:pt-0",children:[r("button",{type:"button",onClick:()=>e(!t),"aria-pressed":t,"aria-label":n,className:["mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center border transition-colors",t?"border-accent":"border-line"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 18%, transparent)"}:void 0,children:t&&r("span",{className:"text-[13px] text-accent",children:"\u2713"})}),c("span",{className:"flex-1 font-display text-[16px] leading-[1.5] text-fg",children:[n,a&&r("small",{className:"mt-1 block font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim",children:a})]})]})}function Jr({slug:t,name:e,qty:n,config:a,configSummary:o,price:s,currency:l}){let{catalog:d}=Xe(),{formatMoney:p}=se(),u=d.find(k=>k.slug===t),v=u?.spokes??5,b=u?.mesh??!1,m=a.find(k=>k.gold)?.label,h=u?.finishes.find(k=>k.name===m&&k.src)??u?.finishes.find(k=>k.src),A=u?.finishes[0]?.color??Kt;return c("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-3.5 border-b border-line py-4 last:border-b-0",children:[c("div",{className:"relative flex aspect-square items-center justify-center overflow-hidden border border-line bg-surface",children:[r("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}),h?.src?r(Rt,{src:h.src,alt:`${e.lead}${e.accent} \u2014 ${h.name}`,width:120,height:120,sizes:"60px",className:"relative block h-full w-full object-contain p-1.5"}):r("div",{className:"block w-[78%]",style:{color:A},children:r($t,{spokes:v,mesh:b,className:"block w-full"})})]}),c("div",{className:"flex min-w-0 flex-col gap-0.5",children:[c("span",{className:"font-display text-[17px] font-bold uppercase leading-none tracking-[-0.005em] text-fg",children:[e.lead,r("em",{className:"font-serif font-normal italic text-accent tracking-[-0.005em] normal-case",children:e.accent})]}),r("span",{className:"font-mono text-[12px] uppercase leading-[1.5] tracking-[0.18em] text-fg-dim",children:o})]}),r("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:p(s,l)})]})}function ce({label:t,value:e}){return c("div",{className:"flex items-center justify-between font-mono text-[13px] font-medium uppercase tracking-[0.18em] text-fg",children:[r("span",{children:t}),r("strong",{className:"font-display text-[16px] font-medium tracking-[-0.005em] normal-case text-fg",children:e})]})}function Xr(t){return t.map(e=>e.label).join(" \xB7 ")}import{jsx as ze}from"react/jsx-runtime";function Zr(){let{settings:t,websiteName:e}=It(),n=e?{...Ze,name:e}:Ze,a=t?{url:t.logoUrl,reversed:t.logoReversed??null,inkIsDark:t.logoInkIsDark??null,reverse:t.reverseLogo,size:t.logoSize,sizePx:t.logoSizePx}:null;return ze("div",{style:{position:"fixed",inset:0,zIndex:2147482e3,overflowY:"auto",background:"var(--bg)",color:"var(--fg)"},children:ze(Ft,{children:ze(Ut,{preview:!0,children:ze(lt,{site:n,logo:a,preview:!0})})})})}export{Zr as default};
@@ -0,0 +1 @@
1
+ "use client";import{Y as m,l as g}from"./chunk-XNYKOAQ3.js";import{$f as f,Id as u}from"./chunk-I5J42GI3.js";import"./chunk-R2JQPRJX.js";import"./chunk-QL3UVEEM.js";import{Ga as s,La as a,Ma as d,Qa as c}from"./chunk-BAXOL3AI.js";import"./chunk-NQIIJI3Z.js";import"./chunk-Y6SLVHK3.js";import{Render as I}from"efficient-easel/render";import{jsx as p}from"react/jsx-runtime";function i({footerBlock:r,rootProps:e,headerSettings:o,siteName:t,legalName:l,foundedYear:n,socialLinks:h}){let v=g({root:{props:{...e??{},kind:u}},content:[r],zones:{}});return p(s.Provider,{value:{logoUrl:o?.logoUrl??null,logoReversed:o?.logoReversed??null,logoInkIsDark:o?.logoInkIsDark??null,siteName:t,legalName:l??null,foundedYear:n??null,socialLinks:h??c},children:p(I,{config:m,data:v})})}import{jsx as k}from"react/jsx-runtime";function P(){let{footerBlock:r,editFooter:e}=f(),{settings:o,websiteName:t}=a();if(!r)return null;let l=o?{logoUrl:o.logoUrl,logoReversed:o.logoReversed??null,logoInkIsDark:o.logoInkIsDark??null}:null;return k("div",{className:"sf-preview-footer-pick",onClick:e?n=>{n.stopPropagation(),e()}:void 0,style:e?{cursor:"pointer"}:void 0,title:e?"Edit the site footer \u2192":void 0,children:k(i,{footerBlock:r,headerSettings:l,siteName:t?.trim()||d})})}export{P as default};
@@ -0,0 +1 @@
1
+ "use client";import"./chunk-Y6SLVHK3.js";import{default as f}from"efficient-easel/screen/components/SectionScreenShell";export{f as default};
@@ -0,0 +1 @@
1
+ "use client";import{l as o}from"./chunk-YARJ4IUJ.js";import"./chunk-I5J42GI3.js";import"./chunk-BAXOL3AI.js";import"./chunk-NQIIJI3Z.js";import"./chunk-Y6SLVHK3.js";import{default as r}from"efficient-easel/screen/components/ScreenStoreProvider";import{jsx as i}from"react/jsx-runtime";function e(t){return i(r,{...t,parts:o})}export{e as default};
@@ -0,0 +1 @@
1
+ import{createContext as Zt,useCallback as s,useContext as jt,useMemo as Jt,useState as Te}from"react";import{createContext as ie,useContext as v}from"react";import{createContext as ut}from"react";var le=ut(null);var ct=ie(null),I=ie({logo:null,placeholder:!1,wordmark:null});function fn(){let e=v(le),t=v(ct),n=v(I),o=!e&&n.placeholder,r=e?e.logoUrl:n.logo?.logoUrl??t?.logoUrl??null;return{src:o?null:r,reversedSrc:e?e.logoReversed:n.logo?.logoReversed??t?.logoReversed??null,inkIsDark:e?e.logoInkIsDark:n.logo?.logoInkIsDark??t?.logoInkIsDark??null,wordmark:e?null:n.wordmark,siteName:e?.siteName??t?.siteName}}import{createPreviewSelectionContext as yn,useSelectHandler as se}from"efficient-easel/screen/lib/puck/preview-selection-context";var xn="storefront-theme",_n="sf:theme-mode",Tn="sf:theme-switch",En="hide",V="light";function dt(e){return e>=7&&e<18}function Cn(e){let{mode:t,override:n,switchShown:o,hour:r}=e;return o&&(n==="light"||n==="dark")?n:t==="auto"?dt(r)?"light":"dark":t==="light"?"light":"dark"}var h={background:"#0a0a0a",surface:"#131313",line:"#2a2a2a",muted:"#9a9388"},gt=[{text:"#2e2e2e",accent:"#2e2e2e",background:"#ffffff",surface:"#f7f7f7",line:"#e0e0e0",muted:"#5c5c5c"},{text:"#f7f7f7",accent:"#f7f7f7",background:"#0a0a0a",surface:"#1b1b1b",line:"#363636",muted:"#a3a3a3"},{text:"#ffffff",accent:"#ffffff",background:"#2e2e2e",surface:"#3d3d3d",line:"#545454",muted:"#b0b0b0"},{text:"#0a0a0a",accent:"#0a0a0a",background:"#f7f7f7",surface:"#ffffff",line:"#d9d9d9",muted:"#5c5c5c"}],H={selected:0,themes:gt};function ue(e){return!e||!Array.isArray(e.themes)||e.themes.length===0?{...H}:{selected:Math.min(Math.max(0,e.selected??0),e.themes.length-1),themes:e.themes}}function F(e,t,n){let o=R(e),r=R(t);if(o===null||r===null)return e;let l=i=>Math.max(0,Math.min(255,Math.round(i))).toString(16).padStart(2,"0");return`#${o.map((i,c)=>l(i+(r[c]-i)*n)).join("")}`}var ht={light:"#ffffff",dark:"#0a0a0a"},Rn=["light","dark"];function Hn(e,t){let n=ht[t],o=t==="light"?"#ffffff":"#000000";return{text:n,accent:n,background:e,surface:F(e,o,.1),line:F(e,o,.22),muted:F(n,e,.35),brandInk:t}}function w(e){let t=ue(e);return t.themes[t.selected]}function ce(e){return{text:e.text,accent:e.accent,background:e.background||h.background,surface:e.surface||h.surface,line:e.line||h.line,muted:e.muted||h.muted}}function R(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let n=t[1].length===3?[...t[1]].map(i=>i+i).join(""):t[1],[o,r,l]=[0,2,4].map(i=>parseInt(n.slice(i,i+2),16));return[o,r,l]}function D(e){let t=R(e);if(t===null)return null;let[n,o,r]=t.map(l=>{let i=l/255;return i<=.04045?i/12.92:((i+.055)/1.055)**2.4});return .2126*n+.7152*o+.0722*r}var pt=.4,ft=4.5,mt=3;function St(e,t){let n=D(e),o=D(t);if(n===null||o===null)return null;let[r,l]=n>=o?[n,o]:[o,n];return(r+.05)/(l+.05)}var wn={good:"Good","large-only":"Large text only",hard:"Hard to read"};function kn(e){return e>=ft?"good":e>=mt?"large-only":"hard"}var O=["#000000","#ffffff"];function k(e){let t=O[0],n=-1;for(let o of O){let r=St(e,o);if(r===null)return O[0];r>n&&(n=r,t=o)}return t}var bt=[.25,.4,.55];function An(e){let t=R(e);return t===null?[]:bt.map(n=>"#"+t.map(o=>Math.round(o*(1-n)).toString(16).padStart(2,"0")).join(""))}function Ln(e){let t=w(e),n={"--theme-fg":t.text},o=D(t.text);return(o===null||o>=pt)&&(n["--overlay-fg"]=t.text),n}var yt=82;function N(e){return`color-mix(in srgb, ${e} ${yt}%, #000)`}function vn(e){let t=w(e);return{"--theme-accent":t.accent,"--theme-accent-2":N(t.accent),"--theme-accent-ink":k(t.accent)}}function de(e){let t=e?.button;return/^#[0-9a-fA-F]{6}$/.test(t??"")?t.toLowerCase():null}function In(e){let t=w(e),n=de(t),o=ge(t);if(n===null&&o===null)return{};let r={};return n!==null&&(r["--theme-btn"]=n,r["--theme-btn-2"]=N(n)),r["--theme-btn-ink"]=o??k(n),r}function ge(e){let t=e?.buttonInk;return/^#[0-9a-fA-F]{6}$/.test(t??"")?t.toLowerCase():null}function Fn(e,t){return ge(e)??k(de(e)??t)}function On(e){let t={};return ue(e).themes.forEach((n,o)=>{let r=ce(n);t[`--theme-preset-${o}-accent`]=r.accent,t[`--theme-preset-${o}-accent-2`]=N(r.accent),t[`--theme-preset-${o}-accent-ink`]=k(r.accent),t[`--theme-preset-${o}-bg`]=r.background,t[`--theme-preset-${o}-fg`]=r.text,t[`--theme-preset-${o}-surface`]=r.surface,t[`--theme-preset-${o}-surface-2`]=`color-mix(in srgb, ${r.surface} 60%, ${r.line})`,t[`--theme-preset-${o}-line`]=r.line,t[`--theme-preset-${o}-muted`]=r.muted}),t}var Pn=["--theme-bg","--theme-surface","--theme-surface-2","--theme-line","--theme-muted"];function Mn(e){let t=ce(w(e)),n=`color-mix(in srgb, ${t.surface} 60%, ${t.line})`,o={"--theme-bg":t.background,"--theme-surface":t.surface,"--theme-line":t.line,"--theme-muted":t.muted};return(t.surface!==h.surface||t.line!==h.line)&&(o["--theme-surface-2"]=n),o}var xt=["heading","body","label"];function Dn(e){if(!e)return null;for(let t of xt)if(e.includes(`--size-${t}`))return t;return/--size-heading(Large|Medium|Small)/.test(e)?"heading":null}var he=["headingLarge","headingMedium","headingSmall","accent","body","label"];var G={headingLarge:null,headingMedium:null,headingSmall:null,accent:null,body:null,label:null},_t=8,Tt=200,Vn=1;function Et(e){if(typeof e!="number"||!Number.isFinite(e))return null;let t=Math.round(e);return t>=_t&&t<=Tt?t:null}function Ct(e){let t={};for(let n of he)t[n]=Et(e?.[n]);return t}function Nn(e){let t=Ct(e),n={};for(let o of he){let r=t[o];r!==null&&(n[`--size-${o}`]=`${r}px`)}return n}var Rt=["square","small","large"],Ht="small";function Gn(e){return Rt.includes(e??"")?e:Ht}var pe=0,wt=40,Un={square:0,small:null,large:16},kt={"--sf-card-radius":1,"--sf-button-radius":.5,"--radius":.5,"--radius-xs":.25,"--radius-sm":.5,"--radius-md":.75,"--radius-lg":1,"--radius-xl":1.25,"--radius-2xl":1.5,"--radius-3xl":2,"--radius-4xl":2.5};function fe(e){if(e==null||typeof e=="string"&&e.trim()==="")return null;let t=typeof e=="string"?Number(e):e;return Number.isFinite(t)?Math.min(wt,Math.max(pe,Math.round(t))):null}function At(e){let t=fe(e);return t===null?{}:Object.fromEntries(Object.entries(kt).map(([n,o])=>{let r=t*o/16;return[n,r===0?"0":`${r}rem`]}))}function zn(e){return At(fe(e)??pe)}var Lt=["none","soft","lifted"],vt="soft",me="none",It=["tight","normal","roomy"],Ft="normal",A="normal",Ot=["none","lift","highlight"],Pt="lift",Mt="highlight",Se="#141416";function be(e){return Lt.includes(e??"")?e:vt}function Dt(e){return It.includes(e??"")?e:Ft}function ye(e){return Ot.includes(e??"")?e:Pt}function Vt(e){return/^#[0-9a-fA-F]{6}$/.test(e??"")?e.toLowerCase():Se}function $n(e){let t=be(e);return t===me?void 0:t}function Bn(e){let t=Dt(e);return t===A?void 0:t}function Yn(e){let t=ye(e);return t===Mt?void 0:t}function Wn(e,t,n){let o=Vt(t);return o===Se?{}:be(e)!==me||ye(n)==="lift"?{"--sf-shadow-color":o}:{}}var Nt=["normal","tight","compressed"],x="normal";function xe(e){return Nt.includes(e??"")?e:x}function Xn(e){let t=xe(e);return t===x?void 0:t}function Kn(e){switch(xe(e)){case"tight":return{lineHeight:.95,letterSpacing:-.01};case"compressed":return{lineHeight:.86,letterSpacing:-.01};default:return{}}}var U={case:"authored",weight:null,weightStrong:null,maxPx:null,weight2:null,weight3:null,case2:"authored",case3:"authored"},P=100,M=900,Gt=24,Ut=200;function C(e,t,n){return typeof e!="number"||!Number.isFinite(e)?null:Math.round(Math.min(Math.max(e,t),n))}function z(e){let t=C(e?.weight,P,M),n=e?.case==="sentence"?"sentence":"authored",o=l=>l==null?t:C(l,P,M),r=l=>l==="sentence"?"sentence":l==="authored"?"authored":n;return{case:n,weight:t,weightStrong:C(e?.weightStrong,P,M),maxPx:C(e?.maxPx,Gt,Ut),weight2:o(e?.weight2),weight3:o(e?.weight3),case2:r(e?.case2),case3:r(e?.case3)}}function qn(e){let t=z(e),n={};return t.case==="sentence"&&(n["--sf-heading-case"]="none"),t.weight!==null&&(n["--sf-heading-weight"]=String(t.weight)),t.weightStrong!==null&&(n["--sf-heading-weight-strong"]=String(t.weightStrong)),t.maxPx!==null&&(n["--sf-heading-max"]=`${t.maxPx}px`),t.weight2!==null&&t.weight2!==t.weight&&(n["--sf-heading-2-weight"]=String(t.weight2)),t.weight3!==null&&t.weight3!==t.weight&&(n["--sf-heading-3-weight"]=String(t.weight3)),t.case2!==t.case&&(n["--sf-heading-2-case"]=t.case2==="sentence"?"none":"uppercase"),t.case3!==t.case&&(n["--sf-heading-3-case"]=t.case3==="sentence"?"none":"uppercase"),n}function Zn(e){return z({case:e?.heading_case??void 0,weight:e?.heading_weight,weightStrong:e?.heading_weight_strong,maxPx:e?.heading_max_px,weight2:e?.heading_2_weight??void 0,weight3:e?.heading_3_weight??void 0,case2:e?.heading_2_case??void 0,case3:e?.heading_3_case??void 0})}function jn(e){let t=z(e);return{heading_case:t.case,heading_weight:t.weight,heading_weight_strong:t.weightStrong,heading_max_px:t.maxPx,heading_2_weight:t.weight2,heading_3_weight:t.weight3,heading_2_case:t.case2,heading_3_case:t.case3}}var $=[{key:"space-grotesk",label:"Space Grotesk",cssVar:"--font-display",category:"sans",italic:!1,italicLoaded:!1},{key:"inter",label:"Inter",cssVar:"--font-body",category:"sans",italic:!0,italicLoaded:!0},{key:"poppins",label:"Poppins",cssVar:"--font-poppins",category:"sans",italic:!0,italicLoaded:!0},{key:"dm-sans",label:"DM Sans",cssVar:"--font-dm-sans",category:"sans",italic:!0,italicLoaded:!0},{key:"sora",label:"Sora",cssVar:"--font-sora",category:"sans",italic:!1,italicLoaded:!1},{key:"oswald",label:"Oswald",cssVar:"--font-oswald",category:"sans",italic:!1,italicLoaded:!1},{key:"archivo",label:"Archivo",cssVar:"--font-archivo",category:"sans",italic:!0,italicLoaded:!0},{key:"outfit",label:"Outfit",cssVar:"--font-outfit",category:"sans",italic:!1,italicLoaded:!1},{key:"manrope",label:"Manrope",cssVar:"--font-manrope",category:"sans",italic:!1,italicLoaded:!1},{key:"big-shoulders",label:"Big Shoulders",cssVar:"--font-big-shoulders",category:"sans",italic:!1,italicLoaded:!1},{key:"michroma",label:"Michroma",cssVar:"--font-michroma",category:"sans",italic:!1,italicLoaded:!1},{key:"fraunces",label:"Fraunces",cssVar:"--font-serif",category:"serif",italic:!0,italicLoaded:!0},{key:"playfair-display",label:"Playfair Display",cssVar:"--font-playfair",category:"serif",italic:!0,italicLoaded:!0},{key:"cormorant",label:"Cormorant",cssVar:"--font-cormorant",category:"serif",italic:!0,italicLoaded:!0},{key:"jetbrains-mono",label:"JetBrains Mono",cssVar:"--font-mono-loaded",category:"mono",italic:!0,italicLoaded:!0}],d=new Map($.map(e=>[e.key,e])),zt={sans:"Sans",serif:"Serif",mono:"Mono"};function Qn(){return Object.keys(zt).map(e=>[e,$.filter(t=>t.category===e)]).filter(([,e])=>e.length>0)}function eo(e){return d.get(e)?.italicLoaded??!1}function to(e){return d.get(e)}var _e=["heading","heading2","heading3","body","accent","label"],no={heading:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",body:"Body",accent:"Accent",label:"Labels"},$t=[["font-heading2","heading2"],["font-heading3","heading3"],["font-display","heading"],["font-serif","accent"],["font-mono","label"],["font-body","body"]],Bt=/var\(--size-(headingLarge|headingMedium|headingSmall|accent|body|label)\s*,/,oo={heading:"headingLarge",heading2:"headingMedium",heading3:"headingSmall",accent:"accent",body:"body",label:"label"},Yt={headingLarge:"heading",headingMedium:"heading2",headingSmall:"heading3",accent:"accent",body:"body",label:"label"};function ro(e){let t=e?Bt.exec(e):null;return t?Yt[t[1]]??null:Wt(e)}function Wt(e){if(!e)return null;let t=e.split(/\s+/).filter(n=>!n.slice(0,n.lastIndexOf(":")+1).includes("&")).map(n=>n.slice(n.lastIndexOf(":")+1));for(let[n,o]of $t)if(t.includes(n))return o;return null}var Xt=["heading","heading2","heading3"];function ao(e){return Xt.includes(e)}var g={heading:"space-grotesk",heading2:"space-grotesk",heading3:"space-grotesk",body:"inter",accent:"fraunces",label:"jetbrains-mono"};function Kt(e){let t=n=>{let o=e?.[n];if(o&&d.has(o))return o;if(n==="heading2"||n==="heading3"){let r=e?.heading;return r&&d.has(r)?r:g.heading}return g[n]};return Object.fromEntries(_e.map(n=>[n,t(n)]))}function qt(e,t){return d.get(e[t])??d.get(g[t])}function p(e,t){return`var(${qt(e,t).cssVar})`}var lo=[...new Set(_e.map(e=>d.get(g[e]).cssVar))],io=[...new Set($.map(e=>e.cssVar))];function so(e){let t=Kt(e);return{"--font-role-heading":p(t,"heading"),"--font-role-heading2":p(t,"heading2"),"--font-role-heading3":p(t,"heading3"),"--font-role-body":p(t,"body"),"--font-role-accent":p(t,"accent"),"--font-role-label":p(t,"label"),fontFamily:"var(--font-role-body)"}}import{jsx as Ee}from"react/jsx-runtime";var Re=Zt({settings:null,setSettings:()=>{},primeSettings:()=>{},websiteName:null,templateChrome:!1,templateName:null,chromePlaceholder:!1,themeMode:V,setThemeMode:()=>{},themeSwitchShown:!1,setThemeSwitchShown:()=>{},theme:H,setTheme:()=>{},fonts:g,setFonts:()=>{},sizes:G,setSizes:()=>{},cornerRadiusPx:null,setCornerRadiusPx:()=>{},cardShadow:null,setCardShadow:()=>{},shadowColor:null,setShadowColor:()=>{},cardGap:A,setCardGap:()=>{},hoverEffect:null,setHoverEffect:()=>{},headingCompression:x,setHeadingCompression:()=>{},siteWidth:null,setSiteWidth:()=>{},siteGutter:null,blockGap:null,setSiteGutter:()=>{},setBlockGap:()=>{},headingTypography:U,setHeadingTypography:()=>{},heroBackgroundFollowsWidth:null,setHeroBackgroundFollowsWidth:()=>{},photographyGrayscale:null,setPhotographyGrayscale:()=>{},themeFromDocument:!1,selected:!1,setSelected:()=>{},select:()=>{},setSelectHandler:()=>{}});function mo({children:e,websiteName:t=null,templateChrome:n=!1,templateName:o=null,chromePlaceholder:r=!1,themeMode:l=V,onThemeModeChange:i,themeSwitchShown:c=!1,onThemeSwitchShownChange:_,theme:T=H,onThemeChange:f,fonts:m=g,onFontsChange:S,sizes:b=G,onSizesChange:u,cornerRadiusPx:L=null,onCornerRadiusPxChange:E,cardShadow:we=null,onCardShadowChange:B,shadowColor:ke=null,onShadowColorChange:Y,cardGap:Ae=A,onCardGapChange:W,hoverEffect:Le=null,onHoverEffectChange:X,headingCompression:ve=x,onHeadingCompressionChange:K,siteWidth:Ie=null,onSiteWidthChange:q,siteGutter:Fe=null,blockGap:Oe=null,onSiteGutterChange:Z,onBlockGapChange:j,headingTypography:Pe=U,onHeadingTypographyChange:J,heroBackgroundFollowsWidth:Me=null,onHeroBackgroundFollowsWidthChange:Q,photographyGrayscale:De=null,onPhotographyGrayscaleChange:ee,themeFromDocument:Ve=!1}){let[y,te]=Te(null),Ne=s(a=>te(st=>st??a),[]),[Ge,Ue]=Te(!1),ze=s(a=>i?.(a),[i]),$e=s(a=>_?.(a),[_]),Be=s(a=>f?.(a),[f]),Ye=s(a=>S?.(a),[S]),We=s(a=>u?.(a),[u]),Xe=s(a=>q?.(a),[q]),Ke=s(a=>Z?.(a),[Z]),qe=s(a=>j?.(a),[j]),Ze=s(a=>Q?.(a),[Q]),je=s(a=>ee?.(a),[ee]),Je=s(a=>E?.(a),[E]),Qe=s(a=>B?.(a),[B]),et=s(a=>Y?.(a),[Y]),tt=s(a=>W?.(a),[W]),nt=s(a=>X?.(a),[X]),ot=s(a=>K?.(a),[K]),rt=s(a=>J?.(a),[J]),{select:at,setSelectHandler:lt}=se(),ne=y?.logoUrl,oe=y?.logoReversed,re=y?.logoInkIsDark,ae=y!==null,it=Jt(()=>({logo:ae?{logoUrl:ne,logoReversed:oe,logoInkIsDark:re}:null,placeholder:n||r,wordmark:n?o:t}),[ae,ne,oe,re,n,r,o,t]);return Ee(I.Provider,{value:it,children:Ee(Re.Provider,{value:{settings:y,setSettings:te,primeSettings:Ne,websiteName:t,templateChrome:n,templateName:o,chromePlaceholder:r,themeMode:l,setThemeMode:ze,themeSwitchShown:c,setThemeSwitchShown:$e,theme:T,setTheme:Be,fonts:m,setFonts:Ye,sizes:b,setSizes:We,cornerRadiusPx:L,setCornerRadiusPx:Je,cardShadow:we,setCardShadow:Qe,shadowColor:ke,setShadowColor:et,cardGap:Ae,setCardGap:tt,hoverEffect:Le,setHoverEffect:nt,headingCompression:ve,setHeadingCompression:ot,siteWidth:Ie,setSiteWidth:Xe,siteGutter:Fe,blockGap:Oe,setSiteGutter:Ke,setBlockGap:qe,headingTypography:Pe,setHeadingTypography:rt,heroBackgroundFollowsWidth:Me,setHeroBackgroundFollowsWidth:Ze,photographyGrayscale:De,setPhotographyGrayscale:je,themeFromDocument:Ve,selected:Ge,setSelected:Ue,select:at,setSelectHandler:lt},children:e})})}var So=()=>jt(Re);var Qt="Storefront";function xo(e){return e?.trim()||Qt}import{forwardRef as en}from"react";import{jsx as on}from"react/jsx-runtime";var tn={position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,color:"transparent"},nn=en(function({src:t,width:n,height:o,fill:r,priority:l,loading:i,style:c,quality:_,placeholder:T,blurDataURL:f,unoptimized:m,loader:S,overrideSrc:b,...u},L){let E=b??(typeof t=="string"?t:t.src);return on("img",{ref:L,src:E,width:r?void 0:n,height:r?void 0:o,loading:l?"eager":i??"lazy",fetchPriority:l?"high":void 0,decoding:"async",style:r?{...tn,...c}:{color:"transparent",...c},...u})}),Eo=nn;function Co(e){return{props:{src:e.overrideSrc??(typeof e.src=="string"?e.src:e.src.src),sizes:e.sizes}}}import{forwardRef as rn}from"react";import{jsx as sn}from"react/jsx-runtime";function an(e){if(typeof e=="string")return e;let t=e.query?`?${new URLSearchParams(e.query).toString()}`:"",n=e.hash?e.hash.startsWith("#")?e.hash:`#${e.hash}`:"";return`${e.pathname??""}${t}${n}`}var ln=rn(function({href:t,prefetch:n,replace:o,scroll:r,shallow:l,legacyBehavior:i,passHref:c,locale:_,onClick:T,children:f,...m},S){let b=u=>{T?.(u),!(u.defaultPrevented||m.target==="_blank")&&u.preventDefault()};return sn("a",{ref:S,href:an(t),onClick:b,...m,children:f})}),ko=ln;var He=["instagram","facebook","tiktok","youtube","x","linkedin","pinterest","whatsapp"],un={instagram:"Instagram",facebook:"Facebook",tiktok:"TikTok",youtube:"YouTube",x:"X",linkedin:"LinkedIn",pinterest:"Pinterest",whatsapp:"WhatsApp"},cn={};function vo(e){if(!e||typeof e!="object")return cn;let t={};for(let n of He){let o=e[n];if(typeof o!="string")continue;let r=o.trim();!r||!/^https?:\/\//i.test(r)||(t[n]=r)}return t}function Io(e){return He.flatMap(t=>{let n=e[t];return n?[{platform:t,href:n,label:un[t]}]:[]})}var Fo=e=>`${e}_url`;export{Eo as a,Co as b,ko as c,$ as d,zt as e,Qn as f,eo as g,to as h,_e as i,no as j,oo as k,ro as l,Wt as m,ao as n,g as o,Kt as p,so as q,xn as r,_n as s,Tn as t,En as u,V as v,Cn as w,gt as x,ue as y,Rn as z,Hn as A,w as B,ce as C,St as D,wn as E,kn as F,k as G,An as H,Ln as I,vn as J,de as K,In as L,ge as M,Fn as N,On as O,Pn as P,Mn as Q,Dn as R,G as S,_t as T,Tt as U,Vn as V,Ct as W,Nn as X,Gn as Y,pe as Z,wt as _,Un as $,fe as aa,At as ba,zn as ca,Lt as da,vt as ea,me as fa,A as ga,Ot as ha,Pt as ia,Mt as ja,Se as ka,be as la,Dt as ma,ye as na,Vt as oa,$n as pa,Bn as qa,Yn as ra,Wn as sa,x as ta,xe as ua,Xn as va,Kn as wa,U as xa,P as ya,M as za,Gt as Aa,Ut as Ba,z as Ca,qn as Da,Zn as Ea,jn as Fa,le as Ga,fn as Ha,yn as Ia,se as Ja,mo as Ka,So as La,Qt as Ma,xo as Na,He as Oa,un as Pa,cn as Qa,vo as Ra,Io as Sa,Fo as Ta};