efficient-storefront-blocks 0.66.0 → 0.66.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/dist/chunks/EditorPreviewCheckout-HAUEGHGC.js +4 -0
  3. package/dist/chunks/chunk-VEI75RPM.js +1 -0
  4. package/dist/index.js +43 -43
  5. package/dist/render/components/CartContext.d.ts +5 -0
  6. package/dist/render/components/CartContext.js +1 -1
  7. package/dist/render/components/DetailRows.d.ts +2 -0
  8. package/dist/render/components/DetailRows.js +1 -1
  9. package/dist/render/components/Events.d.ts +11 -1
  10. package/dist/render/components/Events.js +1 -1
  11. package/dist/render/components/GalleryGrid.d.ts +4 -1
  12. package/dist/render/components/GalleryGrid.js +1 -1
  13. package/dist/render/components/checkout/CheckoutPageClient.js +3 -3
  14. package/dist/render/components/pdp-dynamic/DynamicDetailRows.js +1 -1
  15. package/dist/render/components/pdp-dynamic/DynamicGalleryGrid.d.ts +2 -0
  16. package/dist/render/components/pdp-dynamic/DynamicGalleryGrid.js +1 -1
  17. package/dist/render/components/pdp-dynamic/RecordPhotoGallery.d.ts +12 -0
  18. package/dist/render/components/pdp-dynamic/RecordPhotoGallery.js +1 -0
  19. package/dist/render/lib/checkout/match-subdivision.d.ts +2 -0
  20. package/dist/render/lib/checkout/match-subdivision.js +1 -0
  21. package/dist/render/lib/puck/blocks/commerce/GalleryB/render.js +1 -1
  22. package/dist/render/lib/puck/blocks/service/Events/render.js +1 -1
  23. package/dist/render/lib/puck/current-record.d.ts +1 -0
  24. package/dist/render/lib/puck/current-record.js +1 -1
  25. package/dist/render/lib/sections/own-padding.d.ts +3 -0
  26. package/dist/render/lib/sections/own-padding.js +1 -0
  27. package/package.json +1 -1
  28. package/dist/chunks/EditorPreviewCheckout-EXU5CRJ2.js +0 -4
  29. package/dist/chunks/chunk-VWO54PMT.js +0 -1
@@ -36,6 +36,10 @@ export interface AppliedCoupon {
36
36
  message?: string;
37
37
  effects?: CouponEffects;
38
38
  }
39
+ export interface QuoteDestination {
40
+ country: string;
41
+ subdivision: string;
42
+ }
39
43
  interface CartCtx {
40
44
  isOpen: boolean;
41
45
  preview: boolean;
@@ -59,6 +63,7 @@ interface CartCtx {
59
63
  refuseCoupon: (message: string) => void;
60
64
  couponBusy: boolean;
61
65
  deliveryOptions: DeliveryOption[];
66
+ setQuoteDestination: (dest: QuoteDestination | null) => void;
62
67
  shippingMethodId: string | null;
63
68
  setShippingMethodId: (id: string) => void;
64
69
  totals: {
@@ -1 +1 @@
1
- "use client";import{jsx as Le}from"react/jsx-runtime";import{createContext as We,useCallback as l,useContext as ke,useEffect as g,useMemo as me,useRef as b,useState as f}from"react";import{products as E}from"../lib/api/index.js";import{couponDeferredToCheckout as Qe}from"../lib/cart/coupon-preview.js";import{snapshotCartLines as ve}from"../lib/cart/snapshot-lines.js";import{MAX_QTY_PER_LINE as pe,orderLinesForSets as He,setPrice as Ve}from"../lib/commerce.js";import{UNPRICED_LABEL as je}from"../lib/wheels/price-display.js";import{isValidEmail as Fe}from"../lib/email-shape.js";import{trackAddToCart as ze}from"../lib/google-tag.js";import{shippingStatus as Je}from"../lib/cart/shipping-status.js";import{useCurrency as Xe}from"./CurrencyContext.js";const Ye=400,Ge=400,Ke=1500;function he(c){return(c.components?.length??0)>0}function Ce(c,r){return{code:c,valid:r.valid,deferred:Qe(r,r.askedAsShopper),message:r.message||void 0,effects:r.effects??void 0}}function ye(c,r){return Ve(c.components,r)}function W(c,r){const s=ye(c,r);return s===null?null:s*c.qty}function ge(c){return c!=="tyre"}const Ee=We(null);function at({children:c,preview:r=!1}){const{currency:s,country:A,formatMoney:Ne}=Xe(),[k,P]=f(r),[i,I]=f([]),[Q,Te]=f([]),[v,be]=f([]),[H,Be]=f(!1),[V,Me]=f(!1),[Ie,Se]=f(!1),[qe,xe]=f(!1),[m,j]=f(null),[F,z]=f(void 0),R=b(A),Oe=b("");R.current=R.current||A;const[u,y]=f(null),[J,S]=f(!1),[p,X]=f(null),q=b(void 0),N=l(()=>P(!0),[]),Y=l(()=>P(!1),[]),G=l(()=>P(e=>!e),[]);g(()=>{r||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&N()},[N,r]);const K=l(e=>{xe(!0),ge(e)&&Se(!0)},[]),Z=Ie||i.some(e=>ge(e.kind)),$=qe||i.length>0;g(()=>{if(r||!Z||H)return;let e=!0;return E.listWheels().then(t=>{e&&(Te(t),Be(!0))}),()=>{e=!1}},[r,Z,H]),g(()=>{if(r||!$||V)return;let e=!0;return E.listBundles().then(t=>{e&&(be(t),Me(!0))}),()=>{e=!1}},[r,$,V]);const C=m?.deliveryOptions??[];g(()=>{C.length!==0&&X(e=>e&&C.some(t=>t.id===e)?e:C[0]?.id??null)},[m]);const x=l(()=>i.filter(he).flatMap(e=>He(e.components,e.qty)),[i]),ee=l(async(e,t)=>{const o=e.trim().toUpperCase();if(!o)return;const n=x();if(n.length===0){y({code:o,valid:!1,message:"Add a wheel to the cart first."});return}S(!0),q.current=t;try{const a=await E.validateCoupon({code:o,items:n,currency:s,shippingMethodId:p??void 0,customerEmail:t});y(Ce(o,a))}catch{y({code:o,valid:!1,message:"Could not check that code. Please try again."})}finally{S(!1)}},[x,s,p]),te=l(()=>{y(null),q.current=void 0},[]),ne=l(e=>{if(!u)return;const{code:t}=u;y(o=>o&&o.code===t?{code:t,valid:!1,refused:!0,message:e}:o)},[u]);g(()=>{if(!u||u.refused)return;const e=u.code,t=n=>n!==null&&n.code===e&&!n.refused,o=setTimeout(async()=>{const n=x();if(n.length===0){y(a=>t(a)?{code:e,valid:!1,message:"Add a wheel to the cart first."}:a);return}S(!0);try{const a=await E.validateCoupon({code:e,items:n,currency:s,shippingMethodId:p??void 0,customerEmail:q.current});y(M=>t(M)?Ce(e,a):M)}catch{}finally{S(!1)}},Ye);return()=>clearTimeout(o)},[i,s,p]);const U=u&&!u.refused?u.code:void 0;g(()=>{if(r)return;let e=!0;const t=setTimeout(async()=>{const o=x();if(o.length===0){j(null),z(void 0);return}try{const n=await E.quoteCart({items:o,currency:s,shippingMethodId:p??void 0,couponCode:U,customerEmail:q.current||void 0,country:R.current||void 0,subdivision:Oe.current||void 0});if(!e)return;j(n)}catch{if(!e)return}z(U)},Ge);return()=>{e=!1,clearTimeout(t)}},[i,s,p,U,A]);const O=l(e=>{I(t=>{const o=t.findIndex(n=>n.id===e.id);return o===-1?[...t,e]:t.map((n,a)=>a===o?{...n,qty:Math.min(pe,n.qty+e.qty)}:n)}),ze(e,s)},[s]),oe=l(e=>{I(t=>t.filter(o=>o.id!==e))},[]),re=l((e,t)=>{const o=Math.max(1,Math.min(pe,t));I(n=>n.map(a=>a.id===e?{...a,qty:o}:a))},[]),se=l(e=>{I(e)},[]),[B,_e]=f(null),ue=b(null);ue.current=B;const h=b(null),w=b(""),ce=l((e,t)=>{const o=e.trim().toLowerCase();Fe(o)&&_e(n=>n&&n.email===o&&n.firstName===(t??"")?n:{email:o,firstName:t??""})},[]);g(()=>{if(r||!B)return;const e=ve(i.filter(he),n=>W(n,s)===null?je:Ne(W(n,s),s)),t={email:B.email,firstName:B.firstName,currency:s,items:e},o=JSON.stringify(t);if(o!==w.current)return h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,w.current=o,E.captureCart(t).catch(n=>{process.env.NODE_ENV!=="production"&&console.warn("abandoned-cart capture failed",n)})},Ke),()=>{h.current&&(clearTimeout(h.current),h.current=null)}},[i,B,s,r]);const ie=l(()=>{h.current&&(clearTimeout(h.current),h.current=null);const e=ue.current;e&&(w.current="",E.captureCart({email:e.email,firstName:e.firstName,currency:s,items:[]}).catch(t=>{process.env.NODE_ENV!=="production"&&console.warn("abandoned-cart clear failed",t)}))},[s]),ae=me(()=>{const e=i.reduce((d,T)=>{const _=W(T,s);return _===null?d:d+_},0),t=i.some(d=>ye(d,s)===null),o=i.reduce((d,T)=>d+T.qty,0),n=u?.valid?u.effects:void 0,a=n?Math.min(e,Number(n.discountAmount)):0,M=m?.bundleDiscount??0,Pe=m?.appliedBundles??[],D=!!n?.freeShipping,de=C.find(d=>d.id===p),fe=D?0:m?.shipping??de?.amount??0,Re=Je({quoted:m!==null,optionCount:C.length,chosenAmount:de?.amount,couponWaivesFreight:D}),L={};for(const d of n?.freeUnits??[])L[d.partNumber]=(L[d.partNumber]??0)+d.quantity;const Ue=m?.tax??null,we=m?m.grandTotal:e-a-M+fe;return{sets:o,units:i.reduce((d,T)=>d+(T.components??[]).reduce((_,De)=>_+De.wheels*T.qty,0),0),subtotal:e,hasUnpricedLine:t,discount:a,bundleDiscount:M,appliedBundles:Pe,shipping:fe,freeShipping:D,shippingStatus:Re,freeUnitsByPartNumber:L,tax:Ue,grand:we,repricing:!!u?.refused&&m!==null&&F===u?.code,currency:s}},[i,s,u,C,p,m,F]),le=l(e=>{O(e),N()},[O,N]),Ae=me(()=>({isOpen:k,preview:r,open:N,close:Y,toggle:G,items:i,catalog:Q,bundles:v,warmCatalog:K,add:O,addAndOpen:le,remove:oe,setQty:re,replaceItems:se,identify:ce,clearCapturedCart:ie,coupon:u,applyCoupon:ee,removeCoupon:te,refuseCoupon:ne,couponBusy:J,deliveryOptions:C,shippingMethodId:p,setShippingMethodId:X,totals:ae}),[k,r,N,Y,G,i,Q,v,K,O,le,oe,re,se,ce,ie,u,ee,te,ne,J,C,p,ae]);return Le(Ee.Provider,{value:Ae,children:c})}function lt(){const c=ke(Ee);if(!c)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return c}export{at as CartProvider,he as isOrderable,W as lineTotal,lt as useCart};
1
+ "use client";import{jsx as We}from"react/jsx-runtime";import{createContext as ke,useCallback as i,useContext as Qe,useEffect as g,useMemo as pe,useRef as A,useState as d}from"react";import{products as E}from"../lib/api/index.js";import{couponDeferredToCheckout as ve}from"../lib/cart/coupon-preview.js";import{snapshotCartLines as He}from"../lib/cart/snapshot-lines.js";import{MAX_QTY_PER_LINE as he,orderLinesForSets as Ve,setPrice as je}from"../lib/commerce.js";import{UNPRICED_LABEL as Fe}from"../lib/wheels/price-display.js";import{isValidEmail as ze}from"../lib/email-shape.js";import{trackAddToCart as Je}from"../lib/google-tag.js";import{shippingStatus as Xe}from"../lib/cart/shipping-status.js";import{useCurrency as Ye}from"./CurrencyContext.js";const Ge=400,Ke=400,Ze=1500;function ye(c){return(c.components?.length??0)>0}function Ce(c,s){return{code:c,valid:s.valid,deferred:ve(s,s.askedAsShopper),message:s.message||void 0,effects:s.effects??void 0}}function ge(c,s){return je(c.components,s)}function L(c,s){const r=ge(c,s);return r===null?null:r*c.qty}function Ee(c){return c!=="tyre"}const Ne=ke(null);function lt({children:c,preview:s=!1}){const{currency:r,country:W,formatMoney:be}=Ye(),[k,D]=d(s),[a,M]=d([]),[Q,Te]=d([]),[v,Be]=d([]),[H,Me]=d(!1),[V,Ie]=d(!1),[xe,Oe]=d(!1),[Se,_e]=d(!1),[m,j]=d(null),[F,z]=d(void 0),[I,qe]=d(null),[u,y]=d(null),[J,x]=d(!1),[p,X]=d(null),O=A(void 0),N=i(()=>D(!0),[]),Y=i(()=>D(!1),[]),G=i(()=>D(e=>!e),[]);g(()=>{s||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&N()},[N,s]);const K=i(e=>{qe(t=>t?.country===e?.country&&t?.subdivision===e?.subdivision?t:e)},[]),Z=i(e=>{_e(!0),Ee(e)&&Oe(!0)},[]),$=xe||a.some(e=>Ee(e.kind)),ee=Se||a.length>0;g(()=>{if(s||!$||H)return;let e=!0;return E.listWheels().then(t=>{e&&(Te(t),Me(!0))}),()=>{e=!1}},[s,$,H]),g(()=>{if(s||!ee||V)return;let e=!0;return E.listBundles().then(t=>{e&&(Be(t),Ie(!0))}),()=>{e=!1}},[s,ee,V]);const C=m?.deliveryOptions??[];g(()=>{m&&X(e=>e&&C.some(t=>t.id===e)?e:C[0]?.id??null)},[m]);const S=i(()=>a.filter(ye).flatMap(e=>Ve(e.components,e.qty)),[a]),te=i(async(e,t)=>{const o=e.trim().toUpperCase();if(!o)return;const n=S();if(n.length===0){y({code:o,valid:!1,message:"Add a wheel to the cart first."});return}x(!0),O.current=t;try{const l=await E.validateCoupon({code:o,items:n,currency:r,shippingMethodId:p??void 0,customerEmail:t});y(Ce(o,l))}catch{y({code:o,valid:!1,message:"Could not check that code. Please try again."})}finally{x(!1)}},[S,r,p]),ne=i(()=>{y(null),O.current=void 0},[]),oe=i(e=>{if(!u)return;const{code:t}=u;y(o=>o&&o.code===t?{code:t,valid:!1,refused:!0,message:e}:o)},[u]);g(()=>{if(!u||u.refused)return;const e=u.code,t=n=>n!==null&&n.code===e&&!n.refused,o=setTimeout(async()=>{const n=S();if(n.length===0){y(l=>t(l)?{code:e,valid:!1,message:"Add a wheel to the cart first."}:l);return}x(!0);try{const l=await E.validateCoupon({code:e,items:n,currency:r,shippingMethodId:p??void 0,customerEmail:O.current});y(B=>t(B)?Ce(e,l):B)}catch{}finally{x(!1)}},Ge);return()=>clearTimeout(o)},[a,r,p]);const P=u&&!u.refused?u.code:void 0;g(()=>{if(s)return;let e=!0;const t=setTimeout(async()=>{const o=S();if(o.length===0){j(null),z(void 0);return}try{const n=await E.quoteCart({items:o,currency:r,shippingMethodId:p??void 0,couponCode:P,customerEmail:O.current||void 0,country:I?.country||W||void 0,subdivision:I?.country&&I.subdivision||void 0});if(!e)return;j(n)}catch{if(!e)return}z(P)},Ke);return()=>{e=!1,clearTimeout(t)}},[a,r,p,P,W,I]);const _=i(e=>{M(t=>{const o=t.findIndex(n=>n.id===e.id);return o===-1?[...t,e]:t.map((n,l)=>l===o?{...n,qty:Math.min(he,n.qty+e.qty)}:n)}),Je(e,r)},[r]),se=i(e=>{M(t=>t.filter(o=>o.id!==e))},[]),re=i((e,t)=>{const o=Math.max(1,Math.min(he,t));M(n=>n.map(l=>l.id===e?{...l,qty:o}:l))},[]),ue=i(e=>{M(e)},[]),[T,Ae]=d(null),ie=A(null);ie.current=T;const h=A(null),U=A(""),ce=i((e,t)=>{const o=e.trim().toLowerCase();ze(o)&&Ae(n=>n&&n.email===o&&n.firstName===(t??"")?n:{email:o,firstName:t??""})},[]);g(()=>{if(s||!T)return;const e=He(a.filter(ye),n=>L(n,r)===null?Fe:be(L(n,r),r)),t={email:T.email,firstName:T.firstName,currency:r,items:e},o=JSON.stringify(t);if(o!==U.current)return h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,U.current=o,E.captureCart(t).catch(n=>{process.env.NODE_ENV!=="production"&&console.warn("abandoned-cart capture failed",n)})},Ze),()=>{h.current&&(clearTimeout(h.current),h.current=null)}},[a,T,r,s]);const ae=i(()=>{h.current&&(clearTimeout(h.current),h.current=null);const e=ie.current;e&&(U.current="",E.captureCart({email:e.email,firstName:e.firstName,currency:r,items:[]}).catch(t=>{process.env.NODE_ENV!=="production"&&console.warn("abandoned-cart clear failed",t)}))},[r]),le=pe(()=>{const e=a.reduce((f,b)=>{const q=L(b,r);return q===null?f:f+q},0),t=a.some(f=>ge(f,r)===null),o=a.reduce((f,b)=>f+b.qty,0),n=u?.valid?u.effects:void 0,l=n?Math.min(e,Number(n.discountAmount)):0,B=m?.bundleDiscount??0,Pe=m?.appliedBundles??[],w=!!n?.freeShipping,fe=C.find(f=>f.id===p),me=w?0:m?.shipping??fe?.amount??0,Ue=Xe({quoted:m!==null,optionCount:C.length,chosenAmount:fe?.amount,couponWaivesFreight:w}),R={};for(const f of n?.freeUnits??[])R[f.partNumber]=(R[f.partNumber]??0)+f.quantity;const we=m?.tax??null,Re=m?m.grandTotal:e-l-B+me;return{sets:o,units:a.reduce((f,b)=>f+(b.components??[]).reduce((q,Le)=>q+Le.wheels*b.qty,0),0),subtotal:e,hasUnpricedLine:t,discount:l,bundleDiscount:B,appliedBundles:Pe,shipping:me,freeShipping:w,shippingStatus:Ue,freeUnitsByPartNumber:R,tax:we,grand:Re,repricing:!!u?.refused&&m!==null&&F===u?.code,currency:r}},[a,r,u,C,p,m,F]),de=i(e=>{_(e),N()},[_,N]),De=pe(()=>({isOpen:k,preview:s,open:N,close:Y,toggle:G,items:a,catalog:Q,bundles:v,warmCatalog:Z,add:_,addAndOpen:de,remove:se,setQty:re,replaceItems:ue,identify:ce,clearCapturedCart:ae,coupon:u,applyCoupon:te,removeCoupon:ne,refuseCoupon:oe,couponBusy:J,deliveryOptions:C,setQuoteDestination:K,shippingMethodId:p,setShippingMethodId:X,totals:le}),[k,s,N,Y,G,a,Q,v,Z,_,de,se,re,ue,ce,ae,u,te,ne,oe,J,C,K,p,le]);return We(Ne.Provider,{value:De,children:c})}function dt(){const c=Qe(Ne);if(!c)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return c}export{lt as CartProvider,ye as isOrderable,L as lineTotal,dt as useCart};
@@ -1,9 +1,11 @@
1
+ import type { ReactNode } from "react";
1
2
  export interface DetailSpec {
2
3
  label?: string;
3
4
  value?: string;
4
5
  }
5
6
  export interface DetailRow {
6
7
  image?: string;
8
+ media?: ReactNode;
7
9
  eyebrow?: string;
8
10
  title?: string;
9
11
  copy?: string;
@@ -1 +1 @@
1
- import{jsx as t,jsxs as n}from"react/jsx-runtime";import j from"./SectionBand.js";import k from"efficient-web-builder/render/components/Placeholder";import{withRMark as s}from"efficient-web-builder/render/components/RMark";import{renderGold as f}from"efficient-web-builder/render/components/goldPhrases";import{say as o}from"efficient-web-builder/format/lib/editor-words";import{stripMarkup as z}from"efficient-web-builder/format/lib/markup";const m={body:"text-[length:var(--size-body,15px)]",labelSmall:"text-[length:var(--size-label,11px)]",label:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]"};function $({rows:h,startLeft:b=!1,layout:u="even",padTop:c,padBottom:d,editing:v=!1}){const a=u==="narrow",w=typeof c=="number"?c:100,y=typeof d=="number"?d:100,p=(h??[]).filter(e=>(e?.eyebrow??"").trim()||(e?.title??"").trim()||(e?.copy??"").trim()||(e?.tag??"").trim()||(e?.image??"").trim()),g=p.length>0?p:v?[{tag:o("Row {n}",{n:1})},{tag:o("Row {n}",{n:2})},{tag:o("Row {n}",{n:3})}]:[];return g.length===0?null:t(j,{className:"relative z-[2] border-b border-line bg-bg",style:{paddingTop:w,paddingBottom:y},children:g.map((e,l)=>{const r=l%2===1!==b;return n("div",{className:["grid items-center py-[60px]",a?"grid-cols-[1fr_460px] gap-[72px]":"grid-cols-2 gap-12","max-[1100px]:grid-cols-1",r?"[direction:rtl] max-[1100px]:[direction:ltr]":"",l>0?"border-t border-line":""].join(" "),children:[n("div",{className:["[direction:ltr] flex flex-col gap-4",a?"max-w-[560px]":"",a&&!r?"ml-auto max-[1100px]:ml-0":""].join(" "),children:[e.eyebrow?.trim()&&t("div",{className:`font-mono ${m.labelLarge} uppercase tracking-[0.2em] text-accent`,children:s(e.eyebrow)}),e.title?.trim()&&t("h2",{className:"font-heading2 text-[length:min(var(--size-headingMedium,clamp(28px,3vw,42px)),var(--sf-heading-max,9999px))] [font-weight:var(--sf-heading-weight,500)] [&_em]:[font-weight:var(--sf-heading-weight-strong,inherit)] leading-[1.1] tracking-[-0.02em]",children:f(e.title,!0)}),e.copy?.trim()&&t("p",{className:`${m.body} leading-[1.6] text-fg-dim`,children:f(e.copy,!1)}),(()=>{const x=(e.specs??[]).filter(i=>(i?.label??"").trim()||(i?.value??"").trim());return x.length===0?null:t("dl",{className:`mt-2 border-t border-line pt-3 font-mono ${m.label} uppercase tracking-[0.1em] leading-[2.1]`,children:x.map((i,N)=>n("div",{className:"flex items-baseline justify-between gap-6",children:[t("dt",{className:"text-fg-dim",children:s(i.label??"")}),t("dd",{className:"text-fg",children:s(i.value??"")})]},N))})})()]}),n("div",{className:["[direction:ltr] flex flex-col gap-3",a?r?"items-end":"items-start":"",a?"max-[1100px]:items-start":""].join(" "),children:[t("div",{className:["relative overflow-hidden max-w-full",a?e.imageShape==="wide"?"w-[460px] aspect-[16/9]":"w-[360px] aspect-square":"aspect-square"].join(" "),children:t(k,{label:e.tag?.trim()||e.title?.trim()||`row-${l+1}`,src:e.image||void 0,alt:z(e.title?.trim()||e.tag?.trim()||""),showBackground:!e.image,objectFit:"contain",sizes:a?"(max-width: 1100px) 100vw, 460px":"(max-width: 1100px) 100vw, 50vw"})}),e.tag?.trim()&&t("span",{className:`font-mono ${m.labelSmall} uppercase tracking-[0.2em] text-fg-dim ${r?"text-left":"text-right"}`,children:s(e.tag)})]})]},l)})})}export{$ as default};
1
+ import{jsx as t,jsxs as n}from"react/jsx-runtime";import j from"./SectionBand.js";import k from"efficient-web-builder/render/components/Placeholder";import{withRMark as s}from"efficient-web-builder/render/components/RMark";import{renderGold as f}from"efficient-web-builder/render/components/goldPhrases";import{say as d}from"efficient-web-builder/format/lib/editor-words";import{stripMarkup as z}from"efficient-web-builder/format/lib/markup";const m={body:"text-[length:var(--size-body,15px)]",labelSmall:"text-[length:var(--size-label,11px)]",label:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]"};function $({rows:h,startLeft:b=!1,layout:u="even",padTop:c,padBottom:o,editing:v=!1}){const a=u==="narrow",y=typeof c=="number"?c:100,w=typeof o=="number"?o:100,p=(h??[]).filter(e=>(e?.eyebrow??"").trim()||(e?.title??"").trim()||(e?.copy??"").trim()||(e?.tag??"").trim()||(e?.image??"").trim()),g=p.length>0?p:v?[{tag:d("Row {n}",{n:1})},{tag:d("Row {n}",{n:2})},{tag:d("Row {n}",{n:3})}]:[];return g.length===0?null:t(j,{className:"relative z-[2] border-b border-line bg-bg",style:{paddingTop:y,paddingBottom:w},children:g.map((e,l)=>{const r=l%2===1!==b;return n("div",{className:["grid items-center py-[60px]",a?"grid-cols-[1fr_460px] gap-[72px]":"grid-cols-2 gap-12","max-[1100px]:grid-cols-1",r?"[direction:rtl] max-[1100px]:[direction:ltr]":"",l>0?"border-t border-line":""].join(" "),children:[n("div",{className:["[direction:ltr] flex flex-col gap-4",a?"max-w-[560px]":"",a&&!r?"ml-auto max-[1100px]:ml-0":""].join(" "),children:[e.eyebrow?.trim()&&t("div",{className:`font-mono ${m.labelLarge} uppercase tracking-[0.2em] text-accent`,children:s(e.eyebrow)}),e.title?.trim()&&t("h2",{className:"font-heading2 text-[length:min(var(--size-headingMedium,clamp(28px,3vw,42px)),var(--sf-heading-max,9999px))] [font-weight:var(--sf-heading-weight,500)] [&_em]:[font-weight:var(--sf-heading-weight-strong,inherit)] leading-[1.1] tracking-[-0.02em]",children:f(e.title,!0)}),e.copy?.trim()&&t("p",{className:`${m.body} leading-[1.6] text-fg-dim`,children:f(e.copy,!1)}),(()=>{const x=(e.specs??[]).filter(i=>(i?.label??"").trim()||(i?.value??"").trim());return x.length===0?null:t("dl",{className:`mt-2 border-t border-line pt-3 font-mono ${m.label} uppercase tracking-[0.1em] leading-[2.1]`,children:x.map((i,N)=>n("div",{className:"flex items-baseline justify-between gap-6",children:[t("dt",{className:"text-fg-dim",children:s(i.label??"")}),t("dd",{className:"text-fg",children:s(i.value??"")})]},N))})})()]}),n("div",{className:["[direction:ltr] flex flex-col gap-3",a?r?"items-end":"items-start":"",a?"max-[1100px]:items-start":""].join(" "),children:[e.media?t("div",{className:"w-full",children:e.media}):t("div",{className:["relative overflow-hidden max-w-full",a?e.imageShape==="wide"?"w-[460px] aspect-[16/9]":"w-[360px] aspect-square":"aspect-square"].join(" "),children:t(k,{label:e.tag?.trim()||e.title?.trim()||`row-${l+1}`,src:e.image||void 0,alt:z(e.title?.trim()||e.tag?.trim()||""),showBackground:!e.image,objectFit:"contain",sizes:a?"(max-width: 1100px) 100vw, 460px":"(max-width: 1100px) 100vw, 50vw"})}),e.tag?.trim()&&t("span",{className:`font-mono ${m.labelSmall} uppercase tracking-[0.2em] text-fg-dim ${r?"text-left":"text-right"}`,children:s(e.tag)})]})]},l)})})}export{$ as default};
@@ -2,7 +2,15 @@ import { type EventPost } from "efficient-web-builder/render/components/PostCard
2
2
  export type { EventPost };
3
3
  export type EventCard = EventPost & {
4
4
  href?: string;
5
+ facets?: CardFacets;
5
6
  };
7
+ export type CardFacets = Readonly<Record<string, string | readonly string[]>>;
8
+ export declare function readFacets(value: unknown): CardFacets | undefined;
9
+ export declare function facetChoices(cards: readonly EventCard[]): {
10
+ label: string;
11
+ values: string[];
12
+ }[];
13
+ export declare function matchesFacets(card: EventCard, chosen: Readonly<Record<string, string>>): boolean;
6
14
  export declare const EVENTS_LAYOUT_FEATURED = "featured";
7
15
  export declare const EVENTS_LAYOUT_TABS = "tabs";
8
16
  export declare const EVENTS_LAYOUT_PORTRAIT = "portrait";
@@ -57,6 +65,8 @@ export interface EventsProps {
57
65
  cardImage?: number | null;
58
66
  omitHead?: boolean;
59
67
  nameFilter?: boolean;
68
+ padTop?: number;
69
+ padBottom?: number;
60
70
  }
61
71
  export declare function matchesName(title: string, typed: string): boolean;
62
- export default function Events({ num, title, link, posts, columns, limit, showAll, editing, cardImage, gap: gapProp, layout, featuredWidth, listCover, featuredDarken, omitHead, sample, nameFilter, }: EventsProps): import("react").JSX.Element | null;
72
+ export default function Events({ num, title, link, posts, columns, limit, showAll, editing, cardImage, gap: gapProp, layout, featuredWidth, listCover, featuredDarken, omitHead, sample, nameFilter, padTop, padBottom, }: EventsProps): import("react").JSX.Element | null;
@@ -1 +1 @@
1
- import{jsx as e,jsxs as d}from"react/jsx-runtime";import{useId as ae,useState as ne}from"react";import{containerGapProps as se}from"efficient-web-builder/format/lib/content/container-gap";import re from"efficient-web-builder/render/components/SectionHeader";import A from"efficient-web-builder/render/components/PostCard";import le from"efficient-web-builder/render/components/Placeholder";import{SiteLink as S}from"efficient-web-builder/render/lib/site-runtime";import{renderGold as m,renderHeadline as h}from"efficient-web-builder/render/components/goldPhrases";import{say as b}from"efficient-web-builder/format/lib/editor-words";import{cardImageShapeTokens as oe}from"efficient-web-builder/format/lib/content/card-image-shape";import{SITE_COLUMN as P}from"efficient-web-builder/format/lib/content/page-width";import{fillRowCss as ce}from"../lib/sections/fill-row.js";const V=3,Y="featured",B="tabs",j="portrait",x="spread",K="count",Me=[{label:"Even grid",value:"even"},{label:"Featured first",value:Y},{label:"Tabs",value:B},{label:"Photo cards",value:j},{label:"Staggered spread",value:x},{label:"Count",value:K}],ie=[j,x],Ie="even",$={min:2,max:11,step:1,fallback:7,unit:"of 12"},de="bottom-left",pe=55,fe="bottom";function me(t){const n=typeof t=="number"?t:Number.parseFloat(String(t??"")),a=Number.isFinite(n)?Math.min($.max,Math.max($.min,Math.round(n))):$.fallback;return`${a}fr ${12-a}fr`}const G={1:"grid-cols-1",2:"grid-cols-2 max-[800px]:grid-cols-1",3:"grid-cols-3 max-[800px]:grid-cols-1",4:"grid-cols-4 max-[1100px]:grid-cols-2 max-[800px]:grid-cols-1"},H={2:"grid-cols-2",3:"grid-cols-3 max-[800px]:grid-cols-2",4:"grid-cols-4 max-[1100px]:grid-cols-3 max-[800px]:grid-cols-2"},xe="Find by name",ge="Nobody by that name.";function ue(t,n){const a=o=>o.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLocaleLowerCase().trim(),r=a(n);return r===""||a(t).includes(r)}function he({card:t,scaffold:n,lower:a=!1}){return d(S,{href:t.href||"#",className:`sf-card group relative isolate flex aspect-[3/4] overflow-hidden bg-surface${a?" min-[801px]:mt-16":""}`,"aria-disabled":n||void 0,tabIndex:n?-1:void 0,children:[e("div",{className:"absolute inset-0 transition-transform duration-700 group-hover:scale-[1.03] motion-reduce:transition-none motion-reduce:group-hover:scale-100",children:e(le,{label:`card-${t.slug}`,src:t.cover||void 0,sizes:"(max-width: 800px) 50vw, 25vw"})}),e("div",{"aria-hidden":!0,className:"absolute inset-0 z-0",style:{background:"linear-gradient(180deg, transparent 45%, color-mix(in srgb, var(--bg) 88%, transparent) 100%)"}}),t.meta&&e("span",{className:"absolute left-3 top-3 z-[1] rounded-[var(--sf-button-radius,999px)] bg-bg/85 px-2.5 py-1 font-mono text-[length:var(--size-label,11px)] uppercase tracking-[0.16em] text-accent",children:m(t.meta)}),d("div",{className:"relative z-[1] mt-auto flex w-full flex-col gap-1 p-4 max-[800px]:p-3",children:[e("h3",{className:"font-heading3 text-[length:var(--size-headingSmall,24px)] leading-[1.1] tracking-[-0.01em] text-fg",children:h(t.title,!1)}),t.dateLabel&&e("p",{className:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.16em] text-accent",children:m(t.dateLabel)}),t.excerpt&&e("p",{className:"line-clamp-2 text-[length:var(--size-body,14px)] leading-[1.45] text-fg-dim",children:m(t.excerpt)})]})]})}function be({cards:t,scaffold:n}){return e("nav",{"aria-label":"Days",className:"-mx-1 overflow-x-auto",children:e("ul",{className:"flex min-w-max gap-2 px-1 pb-1",children:t.map((a,r)=>{const o=!!a.meta;return e("li",{children:d(S,{href:a.href||"#","aria-current":o?"page":void 0,"aria-disabled":n||void 0,tabIndex:n?-1:void 0,className:`flex flex-col gap-0.5 rounded-[var(--sf-button-radius,999px)] border px-5 py-2.5 transition-colors ${o?"border-accent bg-accent text-accent-ink":"border-line text-fg hover:border-accent hover:text-accent"}`,children:[e("span",{className:"font-heading3 text-[length:var(--size-body,15px)] leading-[1.2]",children:h(a.title,!1)}),a.excerpt&&e("span",{className:`font-mono text-[length:var(--size-label,11px)] uppercase tracking-[0.14em] ${o?"opacity-80":"text-fg-dim"}`,children:m(a.excerpt)})]})},`${a.slug}-${r}`)})})})}function ve({count:t,words:n,href:a}){const r=d("span",{className:"inline-flex items-baseline gap-3",children:[e("span",{className:"font-heading text-[length:var(--size-headingLarge,64px)] leading-none text-accent",children:t}),n!==void 0&&e("span",{className:"font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.2em] text-fg",children:n})]});return a?e(S,{href:a,className:"inline-flex hover:opacity-85",children:r}):r}const Ne="relative z-[2] bg-bg py-[120px] max-[800px]:py-[70px]",Ee="relative z-[2] bg-bg pt-0 pb-[120px] max-[800px]:pt-0 max-[800px]:pb-[70px]",Te="relative z-[2] bg-bg py-[32px] max-[800px]:py-[24px]";function _e({num:t,title:n,link:a,posts:r,columns:o,limit:v,showAll:N=!1,editing:C=!1,cardImage:W,gap:J,layout:p,featuredWidth:X,listCover:q=!0,featuredDarken:Q,omitHead:g=!1,sample:E,nameFilter:Z=!1}){const[O,ee]=ne(""),T=`ev-${ae().replace(/:/g,"")}`,z=r??[],F=N?z.length:typeof v=="number"&&v>0?v:V,_=z.slice(0,F),f=C&&_.length===0;if(_.length===0&&!C)return null;const U=N?V:F,l=f?E?.length?E.slice(0,N?E.length:U):Array.from({length:U},(s,i)=>({slug:`placeholder-${i}`,title:b("Blog post title"),excerpt:b("A short summary of the post appears here."),cover:"",meta:b("Journal"),dateLabel:b("Date")})):_,c=se("Events",J,"both"),y=p===Y&&l.length>1,te=me(X),L=p===B,k=p===K,R=ie.includes(p??""),M=Z&&!L&&!k&&!y,u=M?l.filter(s=>ue(s.title,O)):l,I=p===x?"grid-cols-3 max-[800px]:grid-cols-2":H[Math.min(4,Math.max(2,o??3))]??H[3],D=G[Math.min(4,Math.max(1,o??3))]??G[3],w=L||y||p===x?"":ce(T,R?I:D,{cards:u.length});return k?e("section",{className:Te,children:e("div",{className:P,children:e(ve,{count:l.length,words:g||n===void 0?void 0:h(n,!1),href:g?void 0:a?.href})})}):e("section",{className:g?Ee:Ne,style:oe(W),children:d("div",{className:P,children:[g?null:e(re,{num:t!==void 0?m(t):void 0,title:n!==void 0?h(n,!1):void 0,link:a?{text:m(a.text),href:a.href}:void 0}),M&&d("div",{className:"mb-6 flex flex-col gap-2",children:[d("label",{className:"flex max-w-[360px] flex-col gap-1.5",children:[e("span",{className:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-fg-dim",children:xe}),e("input",{type:"search",value:O,onChange:s=>ee(s.target.value),autoComplete:"off",className:"rounded-[var(--sf-button-radius,6px)] border border-line bg-bg px-4 py-2.5 text-[length:var(--size-body,15px)] text-fg outline-none focus:border-accent"})]}),u.length===0&&e("p",{role:"status",className:"text-[length:var(--size-body,14px)] text-fg-dim",children:ge})]}),w&&e("style",{children:w}),L?e(be,{cards:l,scaffold:f}):R?e("div",{className:`${T} sf-card-grid grid${c.className} ${I}`,style:c.style,children:u.map((s,i)=>e(he,{card:s,scaffold:f,lower:p===x&&i%3===1},`${s.slug}-${i}`))}):y?d("div",{className:`sf-card-grid grid grid-cols-[var(--sf-events-split)] max-[800px]:grid-cols-1${c.className}`,style:{...c.style,"--sf-events-split":te},children:[e(A,{post:l[0],href:l[0].href,scaffold:f,layout:"cover",darken:Q??pe,darkenStyle:fe,placement:de},`${l[0].slug}-0`),e("div",{className:`grid auto-rows-min${c.className}`,style:c.style,children:l.slice(1).map((s,i)=>e(A,{post:s,href:s.href,scaffold:f,showCover:q},`${s.slug}-${i+1}`))})]}):e("div",{className:`${T} sf-card-grid grid${c.className} ${D}`,style:c.style,children:u.map((s,i)=>e(A,{post:s,href:s.href,scaffold:f},`${s.slug}-${i}`))})]})})}export{$ as EVENTS_FEATURED_WIDTH,Me as EVENTS_LAYOUTS,K as EVENTS_LAYOUT_COUNT,Ie as EVENTS_LAYOUT_FALLBACK,Y as EVENTS_LAYOUT_FEATURED,j as EVENTS_LAYOUT_PORTRAIT,x as EVENTS_LAYOUT_SPREAD,B as EVENTS_LAYOUT_TABS,ie as EVENTS_PHOTO_LAYOUTS,_e as default,ue as matchesName};
1
+ import{jsx as n,jsxs as l}from"react/jsx-runtime";import{useId as xe,useState as K}from"react";import{containerGapProps as ge}from"efficient-web-builder/format/lib/content/container-gap";import ue from"efficient-web-builder/render/components/SectionHeader";import F from"efficient-web-builder/render/components/PostCard";import he from"efficient-web-builder/render/components/Placeholder";import{SiteLink as z}from"efficient-web-builder/render/lib/site-runtime";import{renderGold as x,renderHeadline as v}from"efficient-web-builder/render/components/goldPhrases";import{say as N}from"efficient-web-builder/format/lib/editor-words";import{cardImageShapeTokens as be}from"efficient-web-builder/format/lib/content/card-image-shape";import{SITE_COLUMN as G}from"efficient-web-builder/format/lib/content/page-width";import{fillRowCss as ve}from"../lib/sections/fill-row.js";import{headIsEmpty as Ne,ownPadding as Ee}from"../lib/sections/own-padding.js";function tt(t){if(!t||typeof t!="object"||Array.isArray(t))return;const a={};for(const[e,s]of Object.entries(t))if(e.trim()){if(typeof s=="string")s.trim()&&(a[e]=s.trim());else if(Array.isArray(s)){const o=s.filter(c=>typeof c=="string"&&!!c.trim()).map(c=>c.trim());o.length&&(a[e]=o)}}return Object.keys(a).length?a:void 0}function H(t,a){const e=t.facets?.[a];return e===void 0?[]:typeof e=="string"?[e]:e}const ye=new Intl.Collator("en",{numeric:!0,sensitivity:"base"});function Te(t){const a=[],e=new Map;for(const s of t)for(const o of Object.keys(s.facets??{})){e.has(o)||(a.push(o),e.set(o,new Set));for(const c of H(s,o))e.get(o).add(c)}return a.map(s=>({label:s,values:[...e.get(s)].sort(ye.compare)}))}function _e(t,a){return Object.entries(a).every(([e,s])=>s===""||H(t,e).includes(s))}const W=3,J="featured",X="tabs",q="portrait",u="spread",Q="count",nt=[{label:"Even grid",value:"even"},{label:"Featured first",value:J},{label:"Tabs",value:X},{label:"Photo cards",value:q},{label:"Staggered spread",value:u},{label:"Count",value:Q}],Ae=[q,u],at="even",k={min:2,max:11,step:1,fallback:7,unit:"of 12"},Le="bottom-left",Ce=55,Oe="bottom";function Se(t){const a=typeof t=="number"?t:Number.parseFloat(String(t??"")),e=Number.isFinite(a)?Math.min(k.max,Math.max(k.min,Math.round(a))):k.fallback;return`${e}fr ${12-e}fr`}const Z={1:"grid-cols-1",2:"grid-cols-2 max-[800px]:grid-cols-1",3:"grid-cols-3 max-[800px]:grid-cols-1",4:"grid-cols-4 max-[1100px]:grid-cols-2 max-[800px]:grid-cols-1"},ee={2:"grid-cols-2",3:"grid-cols-3 max-[800px]:grid-cols-2",4:"grid-cols-4 max-[1100px]:grid-cols-3 max-[800px]:grid-cols-2"},$e="Find by name",we="Nobody by that name.",Fe="Nobody matches.",ze="Any";function ke(t,a){const e=o=>o.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLocaleLowerCase().trim(),s=e(a);return s===""||e(t).includes(s)}function te({typed:t,onType:a,wide:e=!1}){return l("label",{className:`flex max-w-[360px] flex-col gap-1.5${e?" w-full":""}`,children:[n("span",{className:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-fg-dim",children:$e}),n("input",{type:"search",value:t,onChange:s=>a(s.target.value),autoComplete:"off",className:"rounded-[var(--sf-button-radius,6px)] border border-line bg-bg px-4 py-2.5 text-[length:var(--size-body,15px)] text-fg outline-none focus:border-accent"})]})}function Re({card:t,scaffold:a,lower:e=!1}){return l(z,{href:t.href||"#",className:`sf-card group relative isolate flex aspect-[3/4] overflow-hidden bg-surface${e?" min-[801px]:mt-16":""}`,"aria-disabled":a||void 0,tabIndex:a?-1:void 0,children:[n("div",{className:"absolute inset-0 transition-transform duration-700 group-hover:scale-[1.03] motion-reduce:transition-none motion-reduce:group-hover:scale-100",children:n(he,{label:`card-${t.slug}`,src:t.cover||void 0,sizes:"(max-width: 800px) 50vw, 25vw"})}),n("div",{"aria-hidden":!0,className:"absolute inset-0 z-0",style:{background:"linear-gradient(180deg, transparent 45%, color-mix(in srgb, var(--bg) 88%, transparent) 100%)"}}),t.meta&&n("span",{className:"absolute left-3 top-3 z-[1] rounded-[var(--sf-button-radius,999px)] bg-bg/85 px-2.5 py-1 font-mono text-[length:var(--size-label,11px)] uppercase tracking-[0.16em] text-accent",children:x(t.meta)}),l("div",{className:"relative z-[1] mt-auto flex w-full flex-col gap-1 p-4 max-[800px]:p-3",children:[n("h3",{className:"font-heading3 text-[length:var(--size-headingSmall,24px)] leading-[1.1] tracking-[-0.01em] text-fg",children:v(t.title,!1)}),t.dateLabel&&n("p",{className:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.16em] text-accent",children:x(t.dateLabel)}),t.excerpt&&n("p",{className:"line-clamp-2 text-[length:var(--size-body,14px)] leading-[1.45] text-fg-dim",children:x(t.excerpt)})]})]})}function Ie({cards:t,scaffold:a}){return n("nav",{"aria-label":"Days",className:"-mx-1 [scrollbar-width:none] max-[800px]:overflow-x-auto [&::-webkit-scrollbar]:hidden",children:n("ul",{className:"flex flex-wrap gap-2 px-1 pb-1 max-[800px]:min-w-max max-[800px]:flex-nowrap",children:t.map((e,s)=>{const o=!!e.meta;return n("li",{children:l(z,{href:e.href||"#","aria-current":o?"page":void 0,"aria-disabled":a||void 0,tabIndex:a?-1:void 0,className:`flex flex-col gap-0.5 rounded-[var(--sf-button-radius,999px)] border px-5 py-2.5 transition-colors ${o?"border-accent bg-accent text-accent-ink":"border-line text-fg hover:border-accent hover:text-accent"}`,children:[n("span",{className:"font-heading3 text-[length:var(--size-body,15px)] leading-[1.2]",children:v(e.title,!1)}),e.excerpt&&n("span",{className:`font-mono text-[length:var(--size-label,11px)] uppercase tracking-[0.14em] ${o?"opacity-80":"text-fg-dim"}`,children:x(e.excerpt)})]})},`${e.slug}-${s}`)})})})}function Ue({count:t,words:a,href:e}){const s=l("span",{className:"inline-flex items-baseline gap-3",children:[n("span",{className:"font-heading text-[length:var(--size-headingLarge,64px)] leading-none text-accent",children:t}),a!==void 0&&n("span",{className:"font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.2em] text-fg",children:a})]});return e?n(z,{href:e,className:"inline-flex hover:opacity-85",children:s}):s}const Me="relative z-[2] bg-bg py-[120px] max-[800px]:py-[70px]",De="relative z-[2] bg-bg pt-0 pb-[120px] max-[800px]:pt-0 max-[800px]:pb-[70px]",Pe="relative z-[2] bg-bg py-[32px] max-[800px]:py-[24px]";function je({num:t,title:a,link:e,posts:s,columns:o,limit:c,showAll:E=!1,editing:y=!1,cardImage:ne,gap:ae,layout:f,featuredWidth:se,listCover:re=!0,featuredDarken:oe,omitHead:h=!1,sample:T,nameFilter:le=!1,padTop:ce,padBottom:ie}){const[_,R]=K(""),[I,de]=K({}),A=`ev-${xe().replace(/:/g,"")}`,U=s??[],M=E?U.length:typeof c=="number"&&c>0?c:W,L=U.slice(0,M),m=y&&L.length===0;if(L.length===0&&!y)return null;const D=E?W:M,i=m?T?.length?T.slice(0,E?T.length:D):Array.from({length:D},(r,d)=>({slug:`placeholder-${d}`,title:N("Blog post title"),excerpt:N("A short summary of the post appears here."),cover:"",meta:N("Journal"),dateLabel:N("Date")})):L,p=ge("Events",ae,"both"),C=f===J&&i.length>1,pe=Se(se),O=f===X,P=f===Q,j=Ae.includes(f??""),S=le&&!O&&!P&&!C,$=S?Te(i):[],b=S?i.filter(r=>ke(r.title,_)&&_e(r,I)):i,w=Ee(ce,ie),fe=!y&&Ne(t,a,e?.text),V=f===u?"grid-cols-3 max-[800px]:grid-cols-2":ee[Math.min(4,Math.max(2,o??3))]??ee[3],Y=Z[Math.min(4,Math.max(1,o??3))]??Z[3],B=O||C||f===u?"":ve(A,j?V:Y,{cards:b.length});return P?n("section",{className:Pe,style:Object.keys(w).length?w:void 0,children:n("div",{className:G,children:n(Ue,{count:i.length,words:h||a===void 0?void 0:v(a,!1),href:h?void 0:e?.href})})}):n("section",{className:h?De:Me,style:{...be(ne),...w},children:l("div",{className:G,children:[h||fe?null:n(ue,{num:t!==void 0?x(t):void 0,title:a!==void 0?v(a,!1):void 0,link:e?{text:x(e.text),href:e.href}:void 0}),S&&l("div",{className:"mb-6 flex flex-col gap-2",children:[$.length===0?n(te,{typed:_,onType:R}):l("div",{className:"flex flex-wrap items-end gap-3",children:[n(te,{typed:_,onType:R,wide:!0}),$.map(({label:r,values:d})=>l("label",{className:"flex min-w-[140px] flex-col gap-1.5 max-[800px]:flex-1",children:[n("span",{className:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-fg-dim",children:r}),l("select",{value:I[r]??"",onChange:g=>de(me=>({...me,[r]:g.target.value})),className:"rounded-[var(--sf-button-radius,6px)] border border-line bg-bg px-4 py-2.5 text-[length:var(--size-body,15px)] text-fg outline-none focus:border-accent",children:[n("option",{value:"",children:ze}),d.map(g=>n("option",{value:g,children:g},g))]})]},r))]}),b.length===0&&n("p",{role:"status",className:"text-[length:var(--size-body,14px)] text-fg-dim",children:$.length===0?we:Fe})]}),B&&n("style",{children:B}),O?n(Ie,{cards:i,scaffold:m}):j?n("div",{className:`${A} sf-card-grid grid${p.className} ${V}`,style:p.style,children:b.map((r,d)=>n(Re,{card:r,scaffold:m,lower:f===u&&d%3===1},`${r.slug}-${d}`))}):C?l("div",{className:`sf-card-grid grid grid-cols-[var(--sf-events-split)] max-[800px]:grid-cols-1${p.className}`,style:{...p.style,"--sf-events-split":pe},children:[n(F,{post:i[0],href:i[0].href,scaffold:m,layout:"cover",darken:oe??Ce,darkenStyle:Oe,placement:Le},`${i[0].slug}-0`),n("div",{className:`grid auto-rows-min${p.className}`,style:p.style,children:i.slice(1).map((r,d)=>n(F,{post:r,href:r.href,scaffold:m,showCover:re},`${r.slug}-${d+1}`))})]}):n("div",{className:`${A} sf-card-grid grid${p.className} ${Y}`,style:p.style,children:b.map((r,d)=>n(F,{post:r,href:r.href,scaffold:m},`${r.slug}-${d}`))})]})})}export{k as EVENTS_FEATURED_WIDTH,nt as EVENTS_LAYOUTS,Q as EVENTS_LAYOUT_COUNT,at as EVENTS_LAYOUT_FALLBACK,J as EVENTS_LAYOUT_FEATURED,q as EVENTS_LAYOUT_PORTRAIT,u as EVENTS_LAYOUT_SPREAD,X as EVENTS_LAYOUT_TABS,Ae as EVENTS_PHOTO_LAYOUTS,je as default,Te as facetChoices,_e as matchesFacets,ke as matchesName,tt as readFacets};
@@ -1,6 +1,9 @@
1
1
  import type { SlotComponent } from "efficient-easel/blocks";
2
2
  export interface GalleryGridProps {
3
3
  omitHead?: boolean;
4
+ padTop?: number;
5
+ padBottom?: number;
6
+ editing?: boolean;
4
7
  items?: SlotComponent;
5
8
  num?: string;
6
9
  title?: string;
@@ -17,4 +20,4 @@ export interface GalleryGridProps {
17
20
  layout?: string;
18
21
  gap?: number | string;
19
22
  }
20
- export default function GalleryGrid({ items: Items, num, title, linkText, linkHref, galleryHref, submitHref, previewHover, display, displayPhone, styleOwner, layout, columns, columnsMobile, gap: gapProp, omitHead, }: GalleryGridProps): import("react").JSX.Element;
23
+ export default function GalleryGrid({ items: Items, num, title, linkText, linkHref, galleryHref, submitHref, previewHover, display, displayPhone, styleOwner, layout, columns, columnsMobile, gap: gapProp, omitHead, padTop, padBottom, editing, }: GalleryGridProps): import("react").JSX.Element;
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as E}from"react/jsx-runtime";import{usePathname as w}from"next/navigation";import{containerGapProps as M}from"efficient-web-builder/format/lib/content/container-gap";import P from"efficient-web-builder/render/components/Btn";import{GALLERY_GRID_ATTR as R,GalleryLinksContext as j}from"./GalleryItem.js";import{useSiteSells as z}from"./SiteRecordContext.js";import{SharedPartKinds as A}from"efficient-web-builder/render/components/PublishedPartStylesContext";import{renderHeadline as I}from"efficient-web-builder/render/components/goldPhrases";import $ from"efficient-web-builder/render/components/SectionHeader";import{resolveGridColumns as k,resolveGridMobileColumns as B}from"efficient-web-builder/format/lib/content/grid-span";import{galleryLayoutClass as O,galleryLayoutCss as T,resolveGalleryLayout as F}from"efficient-web-builder/format/lib/content/gallery-layout";const K="relative z-[2] bg-bg py-[120px] max-[800px]:py-[70px]",D="relative z-[2] bg-bg pt-0 pb-[120px] max-[800px]:pt-0 max-[800px]:pb-[70px]",U="mx-auto max-w-[var(--sf-site-width,1600px)] px-[var(--sf-site-gutter,40px)] max-[800px]:px-[min(20px,var(--sf-site-gutter,40px))]";function W({items:i,num:d,title:a,linkText:o,linkHref:p,galleryHref:r="/gallery",submitHref:x="/contact",previewHover:g,display:f,displayPhone:y,styleOwner:h,layout:n,columns:t,columnsMobile:u,gap:v,omitHead:m=!1}){const N=w(),G=z(),L=r!==N&&(G||r!=="/gallery"),c=F(n),l=c?n:null,S=!c&&t!=null&&t!=="",s=M("GalleryB",v,"both"),_=l?{className:`sf-card-grid sf-gallery-zone ${O(l)} grid${s.className}`,style:s.style}:S?{className:`sf-card-grid sf-grid-zone grid${s.className}`,style:{...s.style,"--sf-grid-cols":String(k(t)),"--sf-grid-cols-phone":String(B(u,t))}}:{className:`sf-card-grid grid grid-cols-4${s.className} max-[1500px]:grid-cols-3 max-[800px]:grid-cols-1`,style:s.style},b=o?{text:o,href:p||"#"}:void 0,C=a?I(a,!1):void 0;return e("section",{className:m?D:K,children:E("div",{className:U,children:[m?null:e($,{num:d,title:C,link:b}),l&&e("style",{dangerouslySetInnerHTML:{__html:T(l)}}),i&&e(j.Provider,{value:{galleryHref:r,submitHref:x,previewHover:g,display:f,displayPhone:y,styleOwner:h},children:e(A,{children:e("div",{[R]:"",style:{display:"contents"},children:e(i,{..._,minEmptyHeight:320})})})}),L&&e("div",{className:"mt-12 flex flex-col items-center gap-3",children:e(P,{href:r,variant:"ghost",children:"See Gallery"})})]})})}export{W as default};
1
+ "use client";import{jsx as e,jsxs as I}from"react/jsx-runtime";import{usePathname as M}from"next/navigation";import{containerGapProps as R}from"efficient-web-builder/format/lib/content/container-gap";import j from"efficient-web-builder/render/components/Btn";import{GALLERY_GRID_ATTR as z,GalleryLinksContext as A}from"./GalleryItem.js";import{useSiteSells as $}from"./SiteRecordContext.js";import{SharedPartKinds as k}from"efficient-web-builder/render/components/PublishedPartStylesContext";import{renderHeadline as B}from"efficient-web-builder/render/components/goldPhrases";import O from"efficient-web-builder/render/components/SectionHeader";import{headIsEmpty as T,ownPadding as F}from"../lib/sections/own-padding.js";import{resolveGridColumns as K,resolveGridMobileColumns as D}from"efficient-web-builder/format/lib/content/grid-span";import{galleryLayoutClass as U,galleryLayoutCss as W,resolveGalleryLayout as X}from"efficient-web-builder/format/lib/content/gallery-layout";const Y="relative z-[2] bg-bg py-[120px] max-[800px]:py-[70px]",q="relative z-[2] bg-bg pt-0 pb-[120px] max-[800px]:pt-0 max-[800px]:pb-[70px]",H="mx-auto max-w-[var(--sf-site-width,1600px)] px-[var(--sf-site-gutter,40px)] max-[800px]:px-[min(20px,var(--sf-site-gutter,40px))]";function J({items:i,num:o,title:a,linkText:n,linkHref:x,galleryHref:r="/gallery",submitHref:g="/contact",previewHover:f,display:y,displayPhone:h,styleOwner:u,layout:d,columns:t,columnsMobile:v,gap:N,omitHead:m=!1,padTop:G,padBottom:L,editing:S=!1}){const _=M(),b=$(),E=r!==_&&(b||r!=="/gallery"),p=X(d),l=p?d:null,w=!p&&t!=null&&t!=="",s=R("GalleryB",N,"both"),C=l?{className:`sf-card-grid sf-gallery-zone ${U(l)} grid${s.className}`,style:s.style}:w?{className:`sf-card-grid sf-grid-zone grid${s.className}`,style:{...s.style,"--sf-grid-cols":String(K(t)),"--sf-grid-cols-phone":String(D(v,t))}}:{className:`sf-card-grid grid grid-cols-4${s.className} max-[1500px]:grid-cols-3 max-[800px]:grid-cols-1`,style:s.style},c=n?{text:n,href:x||"#"}:void 0,P=a?B(a,!1):void 0;return e("section",{className:m?q:Y,style:F(G,L),children:I("div",{className:H,children:[m||!S&&T(o,a,c?.text)?null:e(O,{num:o,title:P,link:c}),l&&e("style",{dangerouslySetInnerHTML:{__html:W(l)}}),i&&e(A.Provider,{value:{galleryHref:r,submitHref:g,previewHover:f,display:y,displayPhone:h,styleOwner:u},children:e(k,{children:e("div",{[z]:"",style:{display:"contents"},children:e(i,{...C,minEmptyHeight:320})})})}),E&&e("div",{className:"mt-12 flex flex-col items-center gap-3",children:e(j,{href:r,variant:"ghost",children:"See Gallery"})})]})})}export{J as default};
@@ -1,3 +1,3 @@
1
- "use client";import{jsx as e,Fragment as A,jsxs as r}from"react/jsx-runtime";import Et from"next/image";import U from"next/link";import{useEffect as R,useMemo as oe,useRef as D,useState as s}from"react";import{Elements as It,PaymentElement as _t,useElements as jt,useStripe as Rt}from"@stripe/react-stripe-js";import{loadStripe as Kt}from"@stripe/stripe-js";import{isOrderable as et,lineTotal as Tt,useCart as tt}from"../CartContext.js";import{useCurrency as W}from"../CurrencyContext.js";import{FREE_PRICE as Ae}from"../../lib/wheels/price-display.js";import{resolveCopyright as Ot}from"../../lib/content/site.js";import{getClickIds as qt}from"../../lib/click-ids.js";import{adConsentForOrder as Bt}from"../../lib/consent/choice.js";import{trackBeginCheckout as Lt,trackPurchase as $t}from"../../lib/google-tag.js";import{trackMetaPurchase as Yt}from"../../lib/meta-pixel.js";import{ApiError as Ee,api as Q,products as S}from"../../lib/api/index.js";import{uuid as zt}from"../../lib/uuid.js";import{orderLinesForSets as Ft}from"../../lib/commerce.js";import{canPersist as Mt,safeSessionStorage as L}from"efficient-web-builder/format/lib/safe-storage";import{AFTERPAY_CONTEXT_KEY as Ut,AFTERPAY_RETURN as Dt,GOCARDLESS_CONTEXT_KEY as Ie,KLARNA_CONTEXT_KEY as _e,ZIP_CONTEXT_KEY as Ht,ZIP_RETURN as Gt,runWalletReturn as nt}from"../../lib/checkout/wallet-return.js";import Wt from"../CouponField.js";import{COUPON_DEFERRED_TOTAL as Zt,couponCodeForOrder as Xt,couponRefusedByOrder as Jt}from"../../lib/cart/coupon-preview.js";import{shippingWords as Vt,TAX_PENDING as Qt}from"../../lib/cart/shipping-status.js";import{DEFAULT_FINISH_COLOR as en}from"../../lib/wheels/finish-defaults.js";import tn from"efficient-web-builder/render/components/Logo";import rt from"../ThemedSelect.js";import T from"../WebFormField.js";import nn from"../WheelSvg.js";function at(n){const o=n.indexOf(`
2
- `);return o===-1?[n,""]:[n.slice(0,o),n.slice(o+1)]}function ot(n,{canParkContext:o}={canParkContext:!0}){const d=n.paymentMethods,i=[];return d.includes("card")&&i.push({key:"card",title:"Card",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),d.includes("paypal")&&n.paypalClientId&&i.push({key:"paypal",title:"PayPal",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAYPAL · CARDS"})}),d.includes("afterpay")&&i.push({key:"afterpay",title:"Afterpay",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"4 × INTEREST-FREE"})}),d.includes("square")&&n.squareApplicationId&&n.squareLocationId&&i.push({key:"square",title:"Card (Square)",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),d.includes("gocardless")&&o&&i.push({key:"gocardless",title:"Bank Direct Debit",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY BY BANK"})}),d.includes("zip")&&i.push({key:"zip",title:"Zip",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY IN 4"})}),d.includes("klarna")&&o&&i.push({key:"klarna",title:"Klarna",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY LATER"})}),i.push({key:"bank",title:"Bank transfer",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Invoiced"})}),i}function rn({site:n,logo:o,preview:d=!1}){const{items:i,totals:a,coupon:l,refuseCoupon:u,deliveryOptions:h,shippingMethodId:g,setShippingMethodId:x,identify:w,clearCapturedCart:N}=tt(),m=h.find(t=>t.id===g)?.pickupLocation??null,{country:P,countries:I,activeCountry:k,formatMoney:v}=W(),[y,O]=s(()=>ot(n)[0].key),[C,M]=s(!0);R(()=>{M(Mt(L))},[]);const[z,se]=s(!1),[Z,Ke]=s(""),[X,Te]=s(""),[le,Oe]=s(""),[de,pe]=s(""),[me,ue]=s(""),[fe,ge]=s(""),[he,xe]=s(""),[ye,be]=s(""),[F,ke]=s(()=>P||I[0]?.code||""),[Ne,ve]=s(""),[we,qe]=s([]),dt=oe(()=>I.find(t=>t.code===F)??k,[I,F,k])?.postalLabel||"Postal Code",pt=we[0]?.divisionType||"State / Province";R(()=>{if(!F){qe([]);return}let t=!1;return S.listCountrySubdivisions(F).then(c=>{t||(qe(c),ve(""))}),()=>{t=!0}},[F]);const[$,Be]=s(null),[Le,$e]=s([]),[ee,te]=s("new"),[Ce,Ye]=s(!1),[ze,mt]=s("Home"),[Fe,Me]=s(null),[_]=s(()=>zt()),[ne,j]=s(null),[Ue,J]=s(null),[De,ut]=s(null),[ft,gt]=s(!1),[ht,xt]=s(!1),[q,Pe]=s(null),[He,G]=s(!1),[Ge,Y]=s(null),[yt,bt]=s(!1),[kt,We]=s(!1),[Nt,vt]=s(!1),[wt,Ze]=s(!1),Xe=D(!1);R(()=>{d||Xe.current||!i.some(et)||(Xe.current=!0,Lt({lines:i,currency:a.currency,value:a.subtotal-a.discount,coupon:l?.valid?l.code:void 0}))},[i,a,l,d]),R(()=>{w(Z,X.trim()||void 0)},[Z,X,w]);const Je=D(null),[re,Ct]=s(null);R(()=>{const t=Je.current;if(!re||!t)return;const c=()=>t.style.setProperty("--sf-checkout-header-h",`${re.offsetHeight}px`);c();const p=new ResizeObserver(c);return p.observe(re),()=>p.disconnect()},[re]),R(()=>{const t=p=>({setConfirming:p,land:j,markPaid:()=>G(!0),note:Y,fail:J,clearCart:N}),c={search:window.location.search,storage:L,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};nt(Dt,{...c,capture:S.captureAfterpayPayment,page:t(bt)}),nt(Gt,{...c,capture:S.captureZipPayment,page:t(vt)})},[]),R(()=>{const c=new URLSearchParams(window.location.search).get("gocardless");if(c!=="confirm"&&c!=="cancel")return;const p=L.getItem(Ie);if(L.removeItem(Ie),window.history.replaceState(null,"",window.location.pathname),!p)return;let b;try{b=JSON.parse(p)}catch{return}if(N(),c==="cancel"){Y("The direct debit was not set up — our team will follow up on payment."),j(b.confirmation);return}We(!0),S.completeGocardlessPayment({idempotencyKey:b.idempotencyKey}).then(f=>{f.status==="paid"?G(!0):f.status==="declined"?Y("The direct debit was declined — our team will follow up on payment."):Y("Your direct debit is set up — the payment is collecting and will clear in a few days.")}).catch(()=>{Y("We could not confirm the direct debit — our team will follow up on payment.")}).finally(()=>{j(b.confirmation),We(!1)})},[]),R(()=>{const t=new URLSearchParams(window.location.search),c=t.get("klarna");if(c!=="confirm"&&c!=="cancel")return;const p=L.getItem(_e);L.removeItem(_e);const b=t.get("authorization_token");if(window.history.replaceState(null,"",window.location.pathname),!p)return;let f;try{f=JSON.parse(p)}catch{return}if(N(),c==="cancel"||!b){Y("The Klarna payment was not completed — our team will follow up on payment."),j(f.confirmation);return}Ze(!0),S.captureKlarnaPayment({idempotencyKey:f.idempotencyKey,authorizationToken:b}).then(E=>{E.status==="paid"?G(!0):E.status==="declined"?Y("Klarna declined the payment — our team will follow up on payment."):Y("Your Klarna payment is being reviewed — we'll confirm the outcome shortly.")}).catch(()=>{Y("We could not confirm the Klarna payment — our team will follow up on payment.")}).finally(()=>{j(f.confirmation),Ze(!1)})},[]);function Ve(t){const[c,p]=at(t.address);pe(c),ue(p),ge(t.city),xe(t.zip_code),t.country&&ke(t.country),t.phone&&be(t.phone)}R(()=>{let t=!1;return(async()=>{try{const[c,p,b]=await Promise.all([Q.me(),Q.myProfile().catch(()=>null),Q.myAddresses().catch(()=>[])]);if(t)return;Be(c);const f=b.filter(V=>V.is_active);$e(f),Ke(c.email);const E=(p?.contact_name??"").split(/\s+/);Te(c.first_name||E[0]||""),Oe(c.last_name||E.slice(1).join(" "));const B=c.phone||p?.phone;B&&be(B);const Se=f.find(V=>V.id===c.default_delivery_location)??f[0];if(Se)te(Se.id),Ve(Se);else if(p){const[V,At]=at(p.address??"");pe(V),ue(At),ge(p.city??""),xe(p.zip_code??""),p.country&&ke(p.country)}}catch{}})(),()=>{t=!0}},[]);function Pt(){Q.logout(),Be(null),$e([]),te("new"),Ye(!1)}const ae=oe(()=>ot(n,{canParkContext:C}),[n,C]);R(()=>{ae.some(t=>t.key===y)||O(ae[0].key)},[ae,y]);const Qe=me.trim()?`${de}
3
- ${me.trim()}`:de;async function St(){if(d||z||i.length===0||a.repricing)return;const t=i.filter(et).flatMap(c=>Ft(c.components,c.qty));if(t.length===0){J("Pick a size on each wheel's product page before checking out.");return}se(!0),J(null);try{const c=$?S.createOrderAuthed:S.createOrder,p=Bt(),b=await c({customer:{email:Z,name:`${X} ${le}`.trim(),phone:ye.trim()||void 0,address:Qe,city:fe,state:Ne||void 0,zipCode:he,country:F},items:t,currency:a.currency,idempotencyKey:_,shippingMethodId:g??void 0,couponCode:Xt(l),...p==="denied"?{}:qt(),...p?{adConsent:p}:{}});if($t({confirmation:b,lines:i,adsSendTo:n.googleAdsId&&n.googleAdsConversionLabel?`${n.googleAdsId}/${n.googleAdsConversionLabel}`:null}),Yt({confirmation:b,lines:i}),N(),$&&Ce&&ee==="new")try{await Q.createAddress({label:ze.trim()||"Home",contact_name:`${X} ${le}`.trim(),phone:ye.trim(),address:Qe,city:fe,zip_code:he,country:F}),Me("Address saved to your account.")}catch{Me("We couldn't save the address to your account — you can add it under Account → Addresses.")}if(y==="card"&&n.paymentMethods.includes("card")){const f=await S.createPaymentIntent({idempotencyKey:_});Pe(b),ut(f)}else if(y==="paypal"&&n.paymentMethods.includes("paypal"))Pe(b),gt(!0);else if(y==="afterpay"&&n.paymentMethods.includes("afterpay")){const f=window.location.origin,E=await S.createAfterpayCheckout({idempotencyKey:_,confirmUrl:`${f}/checkout?afterpay=confirm`,cancelUrl:`${f}/checkout?afterpay=cancel`}),B={idempotencyKey:_,confirmation:b};L.setItem(Ut,JSON.stringify(B)),window.location.assign(E.redirectCheckoutUrl);return}else if(y==="square"&&n.paymentMethods.includes("square"))Pe(b),xt(!0);else if(y==="gocardless"&&n.paymentMethods.includes("gocardless")){const f=window.location.origin,E=await S.createGocardlessBillingRequest({idempotencyKey:_,confirmUrl:`${f}/checkout?gocardless=confirm`,cancelUrl:`${f}/checkout?gocardless=cancel`}),B={idempotencyKey:_,confirmation:b};L.setItem(Ie,JSON.stringify(B)),window.location.assign(E.authorisationUrl);return}else if(y==="zip"&&n.paymentMethods.includes("zip")){const f=window.location.origin,E=await S.createZipCheckout({idempotencyKey:_,redirectUrl:`${f}/checkout?zip=return`}),B={idempotencyKey:_,confirmation:b};L.setItem(Ht,JSON.stringify(B)),window.location.assign(E.redirectUrl);return}else if(y==="klarna"&&n.paymentMethods.includes("klarna")){const f=window.location.origin,E=await S.createKlarnaCheckout({idempotencyKey:_,confirmUrl:`${f}/checkout?klarna=confirm`,cancelUrl:`${f}/checkout?klarna=cancel`}),B={idempotencyKey:_,confirmation:b};L.setItem(_e,JSON.stringify(B)),window.location.assign(E.redirectUrl);return}else j(b)}catch(c){const p=Jt(c);p?(u(p),J(`${p} Your order has not been placed. Place it again to continue without the code.`)):J(c instanceof Ee?c.message:"Could not place the order. Please try again."),se(!1)}}return ne?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:He?"Payment received":"Order received"}),r("p",{className:"text-fg-dim",children:[He?r(A,{children:["Thank you — your payment for order"," ",e("span",{className:"font-mono text-fg",children:ne.orderNumber})," has gone through."," "]}):r(A,{children:["Thank you — your order ",e("span",{className:"font-mono text-fg",children:ne.orderNumber})," is being reviewed by our team."," "]}),$?r(A,{children:["Track it under"," ",e(U,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):e(A,{children:"We’ve emailed you a link to set a password and track it."})]}),Ge&&e("p",{className:"text-sm text-fg-dim",children:Ge}),Fe&&e("p",{className:"text-sm text-fg-dim",children:Fe}),!$&&r("p",{className:"text-sm text-fg-dim",children:["You can also"," ",e(U,{href:`/track?order=${encodeURIComponent(ne.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email — no password needed."]}),e(U,{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"})]}):yt?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Afterpay — one moment."})]}):kt?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Setting up your direct debit…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Confirming with GoCardless — one moment."})]}):Nt?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Zip — one moment."})]}):wt?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Klarna — one moment."})]}):De?e(an,{payment:De,onPaid:()=>{G(!0),j(q)},onSkip:()=>j(q)}):ft&&q?e(sn,{confirmation:q,clientId:n.paypalClientId??"",idemKey:_,onPaid:()=>{G(!0),j(q)},onSkip:()=>j(q)}):ht&&q?e(dn,{confirmation:q,applicationId:n.squareApplicationId??"",locationId:n.squareLocationId??"",environment:n.squareEnvironment??"production",idemKey:_,onPaid:()=>{G(!0),j(q)},onSkip:()=>j(q)}):r("div",{ref:Je,className:"bg-bg text-fg",children:[r("header",{ref:Ct,className:"sticky top-0 z-30 grid grid-cols-[1fr_auto_1fr] items-center gap-8 border-b border-line px-[var(--sf-site-gutter,40px)] py-6 backdrop-blur-md max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))] max-[640px]:py-4",style:{background:"color-mix(in oklab, var(--bg) 92%, transparent)"},children:[r(U,{href:"/",className:"inline-flex items-center gap-3 font-mono text-[13px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["←",e("span",{className:"max-[640px]:hidden",children:"Back to shop"})]}),e(U,{href:"/","aria-label":`${n.name} home`,className:"inline-flex items-center justify-center",children:e(tn,{variant:"header",scrolled:!0,src:o?.url??null,reverse:o?.reverse??!1,reversedSrc:o?.reversed??null,inkIsDark:o?.inkIsDark??null,size:o?.size??"medium",sizePx:o?.sizePx??null,siteName:n.name})}),n.cardPayments?r("span",{className:"flex items-center justify-end gap-3 font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim",children:[e("span",{className:"text-green",children:"●"}),e("span",{className:"max-[640px]:hidden",children:"Encrypted ·"})," Stripe"]}):e("span",{})]}),r("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:[e("span",{className:"inline-flex items-center bg-accent px-3 py-1 font-bold text-bg",children:"Checkout"}),e("nav",{"aria-label":"Checkout steps",className:"flex flex-wrap items-center gap-5",children:[{n:"01",label:"Cart",state:"done"},{n:"02",label:"Ship & pay",state:"active"},{n:"03",label:"Confirmed",state:"pending"}].map(t=>r("span",{className:["relative flex items-center gap-2 transition-colors",t.state==="pending"?"text-fg-dim":"text-fg",t.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[e("span",{className:t.state==="done"?"text-accent font-bold":"",children:t.n}),e("span",{children:t.label})]},t.n))})]}),r("main",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-[1fr_420px] items-start gap-16 px-[var(--sf-site-gutter,40px)] pt-10 pb-[100px] max-[1100px]:grid-cols-1 max-[1100px]:gap-10 max-[1100px]:px-[min(24px,var(--sf-site-gutter,40px))] max-[1100px]:pt-8 max-[1100px]:pb-20",children:[r("div",{children:[r(ie,{num:"N° 01",title:"Contact",children:[e(T,{label:"Email",hint:$?r(A,{children:["Signed in ·"," ",e("button",{type:"button",onClick:Pt,className:"underline transition-colors hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:e("input",{type:"email",value:Z,onChange:t=>Ke(t.target.value),placeholder:"you@example.com",readOnly:$!==null,className:K+($?" opacity-70":"")})}),r(ct,{children:[e(T,{label:"First name",children:e("input",{type:"text",value:X,onChange:t=>Te(t.target.value),className:K})}),e(T,{label:"Last name",children:e("input",{type:"text",value:le,onChange:t=>Oe(t.target.value),className:K})})]})]}),r(ie,{num:"N° 02",title:m?"Collection":"Shipping address",children:[m?r("div",{className:"grid gap-2 text-[14px] leading-[1.6]",children:[e("span",{className:"font-medium",children:m.name}),[m.address,m.city,m.state,m.zipCode,m.country].filter(Boolean).length>0&&e("span",{className:"opacity-80",children:[m.address,m.city,m.state,m.zipCode,m.country].filter(Boolean).join(", ")}),m.openingHours&&e("span",{className:"opacity-80",children:m.openingHours}),m.instructions&&e("span",{className:"opacity-80",children:m.instructions}),e("span",{className:"mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"No delivery address needed"})]}):r(A,{children:[$!==null&&Le.length>0&&r("div",{className:"grid gap-3",children:[Le.map(t=>e(ce,{active:ee===t.id,onClick:()=>{te(t.id),Ve(t)},title:t.label,body:t.formatted_address,price:null},t.id)),e(ce,{active:ee==="new",onClick:()=>te("new"),title:"New address",body:null,price:null})]}),e(T,{label:"Address line 1",children:e("input",{type:"text",value:de,onChange:t=>pe(t.target.value),className:K})}),e(T,{label:"Address line 2",children:e("input",{type:"text",value:me,onChange:t=>ue(t.target.value),placeholder:"Apartment, unit, garage bay…",className:K})}),r(ct,{cols:"three",children:[e(T,{label:"City",children:e("input",{type:"text",value:fe,onChange:t=>ge(t.target.value),className:K})}),e(T,{label:dt,children:e("input",{type:"text",value:he,onChange:t=>xe(t.target.value),className:K})}),e(T,{label:"Country",separate:!0,children:e(rt,{value:F,onChange:t=>ke(t.target.value),className:K+" pr-10",style:it,children:I.map(t=>e("option",{value:t.code,children:t.name},t.code))})})]}),e(T,{label:pt,separate:!0,children:we.length>0?r(rt,{value:Ne,onChange:t=>ve(t.target.value),className:K+" pr-10",style:it,children:[e("option",{value:"",children:"Select…"}),we.map(t=>e("option",{value:t.code||t.name,children:t.name},t.code||t.name))]}):e("input",{type:"text",value:Ne,onChange:t=>ve(t.target.value),className:K})})]}),e(T,{label:"Phone",children:e("input",{type:"tel",value:ye,onChange:t=>be(t.target.value),placeholder:"+44 7700 900000",className:K})}),!m&&$!==null&&ee==="new"&&r(A,{children:[e(pn,{checked:Ce,onChange:Ye,label:"Save this address to my account"}),Ce&&e(T,{label:"Address label",children:e("input",{type:"text",value:ze,onChange:t=>mt(t.target.value),placeholder:"Home",className:K})})]})]}),e(ie,{num:"N° 03",title:"Shipping",children:r("div",{className:"grid gap-3",children:[h.map(t=>{const c=t.pickupLocation,p=c?[c.address,c.city,c.state,c.zipCode].filter(Boolean).join(", "):null;return e(ce,{active:g===t.id,onClick:()=>x(t.id),title:c?`${t.name} — ${c.name}`:t.name,body:c?[p,c.openingHours,c.instructions,t.description].filter(Boolean).join(" · "):t.description||null,price:a.freeShipping||t.amount===0?Ae:v(t.amount,a.currency),tag:t.tag||void 0},t.id)}),h.length===0&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Shipping is arranged after your order is reviewed."})]})}),r(ie,{num:"N° 04",title:"Payment",children:[e("div",{className:"grid gap-3",children:ae.map(t=>e(ce,{active:y===t.key,onClick:()=>O(t.key),title:t.title,body:t.body,price:t.price,tag:t.tag},t.key))}),y==="card"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):y==="paypal"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll approve the payment with PayPal on the payment step after placing the order."}):y==="afterpay"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Afterpay to approve four interest-free payments, then brought straight back."}):y==="square"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):y==="gocardless"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll set up a bank direct debit with GoCardless, then be brought straight back. Direct debits clear in a few days."}):y==="zip"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Zip to approve four instalments, then brought straight back."}):y==="klarna"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Klarna to choose how to pay, then brought straight back."}):e("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."})]})]}),r("aside",{className:"sticky top-[var(--sf-checkout-header-h,88px)] border border-line max-[1100px]:static",style:{background:"linear-gradient(180deg, color-mix(in oklab, var(--site-surface) 70%, var(--bg)) 0%, var(--bg) 100%)"},children:[r("header",{className:"flex items-center justify-between border-b border-accent bg-accent px-6 py-4 font-mono text-[13px] font-bold uppercase tracking-[0.28em] text-bg",children:[e("span",{children:"Your order"}),e(U,{href:"/wheels",className:"text-bg/80 transition-colors hover:text-bg",children:"Edit ↗"})]}),e("div",{className:"flex flex-col px-6 py-2",children:i.length===0?r("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",e(U,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog →"})]}):i.map(t=>e(mn,{slug:t.slug,name:t.name,qty:t.qty,config:t.config,configSummary:un(t.config),price:Tt(t,a.currency)??0,currency:a.currency},t.id))}),e("div",{className:"border-t border-line px-6 pt-5",children:e(Wt,{customerEmail:Z})}),r("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[e(H,{label:"Subtotal",value:v(a.subtotal,a.currency)}),a.discount>0&&l?.valid&&e(H,{label:`Coupon · ${l.code}`,value:r("span",{className:"font-semibold text-green",children:["− ",v(a.discount,a.currency)]})}),l?.deferred&&e(H,{label:`Coupon · ${l.code}`,value:Zt}),l?.valid&&l.effects?.gift&&e(H,{label:`Free gift · ${l.effects.gift.partNumber}${l.effects.gift.quantity>1?` ×${l.effects.gift.quantity}`:""}`,value:e("span",{className:"font-semibold text-green",children:Ae})}),e(H,{label:"Shipping",value:a.shippingStatus==="free"?e("span",{className:"font-semibold text-green",children:Ae}):Vt(a.shippingStatus)??v(a.shipping,a.currency)}),a.tax&&(a.tax.charged?e(H,{label:a.tax.inclusive?`${a.tax.name} included · ${a.tax.rate}%`:a.tax.name,value:v(a.tax.amount,a.currency)}):a.tax.name?e(H,{label:a.tax.name,value:Qt}):null)]}),r("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:[e("span",{className:"font-display text-[20px] font-bold uppercase tracking-[0.04em] text-fg",children:"Total"}),e("span",{className:"text-right font-display text-[34px] font-bold leading-none tracking-[-0.025em] text-fg",children:a.repricing?"…":v(a.grand,a.currency)})]}),r("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[Ue&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:Ue}),a.hasUnpricedLine&&r("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 ",a.currency,". Remove them, or switch region, to continue."]}),e("button",{type:"button",onClick:St,disabled:z||i.length===0||a.hasUnpricedLine||a.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",i.length===0||z||a.hasUnpricedLine||a.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:z?r(A,{children:["Building order… ",e("span",{children:"·"})]}):a.repricing?r(A,{children:["Updating total… ",e("span",{children:"·"})]}):r(A,{children:[y==="bank"?"Place order":"Continue to payment"," ·"," ",v(a.grand,a.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})})]})]})]}),e("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:e("span",{children:Ot({legalName:n.legalName,foundedYear:n.foundedYear,siteName:n.name})})})]})}const K="w-full border-2 border-line bg-bg px-4 py-4 font-display text-[17px] tracking-[-0.005em] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent",it={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 ie({num:n,title:o,children:d}){return r("section",{className:"mb-6 border border-line bg-bg",children:[r("header",{className:"flex items-center gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:n}),e("h2",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:o})]}),e("div",{className:"flex flex-col gap-4 px-6 py-6",children:d})]})}function ct({cols:n="two",children:o}){return e("div",{className:["grid gap-3 max-[640px]:grid-cols-1",n==="two"?"grid-cols-2":"grid-cols-[1.2fr_1fr_1fr]"].join(" "),children:o})}function ce({active:n,onClick:o,title:d,body:i,price:a,tag:l}){return r("button",{type:"button",onClick:o,"aria-pressed":n,className:["relative grid grid-cols-[auto_1fr_auto] items-center gap-5 border bg-bg px-6 py-5 text-left transition-colors",n?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-line hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]"].join(" "),style:n?{background:"color-mix(in oklab, var(--accent) 14%, var(--bg))"}:void 0,children:[n&&e("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),e("span",{className:["flex h-[18px] w-[18px] items-center justify-center rounded-full border-2",n?"border-accent":"border-fg-dim"].join(" "),children:n&&e("span",{className:"block h-2.5 w-2.5 rounded-full bg-accent"})}),r("span",{className:"flex min-w-0 flex-col gap-1",children:[r("span",{className:"flex flex-wrap items-baseline gap-3 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[d,l&&e("span",{className:"border px-2 py-0.5 font-mono text-[11px] font-normal uppercase tracking-[0.24em] text-accent",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))"},children:l})]}),i&&e("span",{className:"font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim",children:i})]}),e("span",{className:"whitespace-nowrap font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:a})]})}function an({payment:n,onPaid:o,onSkip:d}){const{formatMoney:i}=W(),a=oe(()=>Kt(n.publishableKey),[n.publishableKey]),l=oe(()=>{if(typeof document>"u")return;const u=getComputedStyle(document.documentElement),h=(x,w)=>u.getPropertyValue(x).trim()||w,g=document.documentElement.getAttribute("data-theme")!=="light";return{theme:g?"night":"stripe",variables:{colorPrimary:h("--accent",g?"#c9a461":"#8a6a2a"),colorBackground:h("--site-surface",g?"#131313":"#ffffff"),colorText:h("--fg",g?"#f5f1e8":"#0a0a0a"),borderRadius:"0px"}}},[]);return e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:n.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Payment"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:i(Number(n.amount),n.currency)})," ","by card to confirm it now."]}),e(It,{stripe:a,options:{clientSecret:n.clientSecret,appearance:l},children:e(on,{payment:n,onPaid:o,onSkip:d})})]})]})})}function on({payment:n,onPaid:o,onSkip:d}){const{formatMoney:i}=W(),a=Rt(),l=jt(),[u,h]=s(!1),[g,x]=s(null);async function w(){if(!a||!l||u)return;h(!0),x(null);const N=await a.confirmPayment({elements:l,redirect:"if_required"});if(N.error){x(N.error.message??"Payment failed. Please try again."),h(!1);return}const m=N.paymentIntent?.status;if(m==="succeeded"||m==="processing"){o();return}x("Payment did not complete. Please try again."),h(!1)}return r("div",{className:"flex flex-col gap-4",children:[e(_t,{}),g&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:g}),e("button",{type:"button",onClick:w,disabled:!a||!l||u,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||!l||u?"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:u?r(A,{children:["Processing… ",e("span",{children:"·"})]}):r(A,{children:["Pay ",i(Number(n.amount),n.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),e("button",{type:"button",onClick:d,disabled:u,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 — our team will be in touch"})]})}const st="paypal-sdk-js";let je=null;function cn(n,o){const d=`${n}|${o}`;if(je?.key===d)return je.promise;const i=new Promise((a,l)=>{document.getElementById(st)?.remove();const u=document.createElement("script");u.id=st;const h=new URLSearchParams({"client-id":n,currency:o,intent:"capture"});u.src=`https://www.paypal.com/sdk/js?${h}`,u.onload=()=>{const g=window.paypal;g?a(g):l(new Error("PayPal SDK loaded without its namespace"))},u.onerror=()=>l(new Error("PayPal SDK failed to load")),document.head.appendChild(u)});return je={key:d,promise:i},i}function sn({confirmation:n,clientId:o,idemKey:d,onPaid:i,onSkip:a}){const{formatMoney:l}=W(),u=D(null),[h,g]=s(!1),[x,w]=s(null),N=D(i);return N.current=i,R(()=>{let m=!1,P=null;return cn(o,n.currency).then(I=>{if(!(m||!u.current))return P=I.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await S.createPaypalOrder({idempotencyKey:d})).paypalOrderId,onApprove:async k=>{try{if((await S.capturePaypalOrder({idempotencyKey:d,paypalOrderId:k.orderID})).status==="paid"){N.current();return}w("PayPal did not complete the payment. Please try again.")}catch(v){w(v instanceof Ee?v.message:"PayPal payment failed. Please try again.")}},onError:()=>{w("PayPal could not process the payment. Please try again.")}}),P.render(u.current).then(()=>{m||g(!0)})}).catch(()=>{m||w("PayPal could not be loaded. You can pay later — your order stands either way.")}),()=>{m=!0,P?.close?.()}},[o,n.currency,d]),e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:n.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"PayPal"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:l(Number(n.grandTotal),n.currency)})," ","with PayPal to confirm it now."]}),!h&&!x&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal…"}),e("div",{ref:u}),x&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:x}),e("button",{type:"button",onClick:a,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})]})})}const lt="square-web-sdk";let Re=null;function ln(n){const o=n==="sandbox"?"sandbox":"production";if(Re?.key===o)return Re.promise;const d=new Promise((i,a)=>{document.getElementById(lt)?.remove();const l=document.createElement("script");l.id=lt,l.src=o==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",l.onload=()=>{const u=window.Square;u?i(u):a(new Error("Square SDK loaded without its namespace"))},l.onerror=()=>a(new Error("Square SDK failed to load")),document.head.appendChild(l)});return Re={key:o,promise:d},d}function dn({confirmation:n,applicationId:o,locationId:d,environment:i,idemKey:a,onPaid:l,onSkip:u}){const{formatMoney:h}=W(),g=D(null),x=D(null),w=D(null),[N,m]=s(!1),[P,I]=s(!1),[k,v]=s(null);R(()=>{let O=!1,C=null;return ln(i).then(async M=>{if(O||!g.current)return;const z=M.payments(o,d);w.current=z,C=await z.card(),await C.attach(g.current),x.current=C,O||m(!0)}).catch(()=>{O||v("Square could not be loaded. You can pay later — your order stands either way.")}),()=>{O=!0,C?.destroy?.()}},[o,d,i]);async function y(){const O=x.current;if(!(!O||P)){I(!0),v(null);try{const C=await O.tokenize();if(C.status!=="OK"||!C.token){v(C.errors?.[0]?.message??"Please check the card details and try again."),I(!1);return}let M;try{M=(await w.current?.verifyBuyer?.(C.token,{amount:String(n.grandTotal),currencyCode:n.currency,intent:"CHARGE"}))?.token}catch{}if((await S.chargeSquare({idempotencyKey:a,sourceId:C.token,...M?{verificationToken:M}:{}})).status==="paid"){l();return}v("Square did not complete the payment. Please try again.")}catch(C){v(C instanceof Ee?C.message:"Square payment failed. Please try again.")}I(!1)}}return e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:n.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Card"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:h(Number(n.grandTotal),n.currency)})," ","by card to confirm it now."]}),!N&&!k&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form…"}),e("div",{ref:g}),k&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:k}),e("button",{type:"button",onClick:y,disabled:!N||P,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!N||P?"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:P?r(A,{children:["Processing… ",e("span",{children:"·"})]}):r(A,{children:["Pay ",h(Number(n.grandTotal),n.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),e("button",{type:"button",onClick:u,disabled:P,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 — our team will be in touch"})]})]})})}function pn({checked:n,onChange:o,label:d,sub:i}){return r("div",{className:"flex items-start gap-3 border-t border-line py-4 first:border-t-0 first:pt-0",children:[e("button",{type:"button",onClick:()=>o(!n),"aria-pressed":n,"aria-label":d,className:["mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center border transition-colors",n?"border-accent":"border-line"].join(" "),style:n?{background:"color-mix(in oklab, var(--accent) 18%, transparent)"}:void 0,children:n&&e("span",{className:"text-[13px] text-accent",children:"✓"})}),r("span",{className:"flex-1 font-display text-[16px] leading-[1.5] text-fg",children:[d,i&&e("small",{className:"mt-1 block font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim",children:i})]})]})}function mn({slug:n,name:o,qty:d,config:i,configSummary:a,price:l,currency:u}){const{catalog:h}=tt(),{formatMoney:g}=W(),x=h.find(k=>k.slug===n),w=x?.spokes??5,N=x?.mesh??!1,m=i.find(k=>k.gold)?.label,P=x?.finishes.find(k=>k.name===m&&k.src)??x?.finishes.find(k=>k.src),I=x?.finishes[0]?.color??en;return r("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-4 border-b border-line py-4 last:border-b-0",children:[r("div",{className:"relative flex aspect-square items-center justify-center overflow-hidden border border-line bg-surface",children:[e("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:d}),P?.src?e(Et,{src:P.src,alt:`${o.lead}${o.accent} — ${P.name}`,width:120,height:120,sizes:"60px",className:"relative block h-full w-full object-contain p-2"}):e("div",{className:"block w-[78%]",style:{color:I},children:e(nn,{spokes:w,mesh:N,className:"block w-full"})})]}),r("div",{className:"flex min-w-0 flex-col gap-0.5",children:[r("span",{className:"font-display text-[17px] font-bold uppercase leading-none tracking-[-0.005em] text-fg",children:[o.lead,e("em",{className:"font-serif font-normal italic text-accent tracking-[-0.005em] normal-case",children:o.accent})]}),e("span",{className:"font-mono text-[12px] uppercase leading-[1.5] tracking-[0.18em] text-fg-dim",children:a})]}),e("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:g(l,u)})]})}function H({label:n,value:o}){return r("div",{className:"flex items-center justify-between font-mono text-[13px] font-medium uppercase tracking-[0.18em] text-fg",children:[e("span",{children:n}),e("strong",{className:"font-display text-[16px] font-medium tracking-[-0.005em] normal-case text-fg",children:o})]})}function un(n){return n.map(o=>o.label).join(" · ")}export{ot as buildPayOptions,rn as default};
1
+ "use client";import{jsx as e,Fragment as E,jsxs as r}from"react/jsx-runtime";import Kt from"next/image";import M from"next/link";import{useEffect as S,useMemo as pe,useRef as U,useState as s}from"react";import{Elements as Tt,PaymentElement as Ot,useElements as qt,useStripe as Bt}from"@stripe/react-stripe-js";import{loadStripe as Lt}from"@stripe/stripe-js";import{isOrderable as ot,lineTotal as $t,useCart as it}from"../CartContext.js";import{useCurrency as W}from"../CurrencyContext.js";import{FREE_PRICE as _e}from"../../lib/wheels/price-display.js";import{resolveCopyright as Yt}from"../../lib/content/site.js";import{getClickIds as zt}from"../../lib/click-ids.js";import{adConsentForOrder as Ft}from"../../lib/consent/choice.js";import{trackBeginCheckout as Mt,trackPurchase as Ut}from"../../lib/google-tag.js";import{trackMetaPurchase as Dt}from"../../lib/meta-pixel.js";import{ApiError as je,api as ne,products as A}from"../../lib/api/index.js";import{uuid as Ht}from"../../lib/uuid.js";import{orderLinesForSets as Gt}from"../../lib/commerce.js";import{canPersist as Wt,safeSessionStorage as B}from"efficient-web-builder/format/lib/safe-storage";import{AFTERPAY_CONTEXT_KEY as Zt,AFTERPAY_RETURN as Xt,GOCARDLESS_CONTEXT_KEY as Re,KLARNA_CONTEXT_KEY as Ke,ZIP_CONTEXT_KEY as Jt,ZIP_RETURN as Qt,runWalletReturn as ct}from"../../lib/checkout/wallet-return.js";import{matchSubdivision as Vt}from"../../lib/checkout/match-subdivision.js";import en from"../CouponField.js";import{COUPON_DEFERRED_TOTAL as tn,couponCodeForOrder as nn,couponRefusedByOrder as rn}from"../../lib/cart/coupon-preview.js";import{shippingWords as an,TAX_PENDING as on}from"../../lib/cart/shipping-status.js";import{DEFAULT_FINISH_COLOR as cn}from"../../lib/wheels/finish-defaults.js";import sn from"efficient-web-builder/render/components/Logo";import st from"../ThemedSelect.js";import T from"../WebFormField.js";import ln from"../WheelSvg.js";function lt(n){const o=n.indexOf(`
2
+ `);return o===-1?[n,""]:[n.slice(0,o),n.slice(o+1)]}function dt(n,{canParkContext:o}={canParkContext:!0}){const d=n.paymentMethods,i=[];return d.includes("card")&&i.push({key:"card",title:"Card",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),d.includes("paypal")&&n.paypalClientId&&i.push({key:"paypal",title:"PayPal",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAYPAL · CARDS"})}),d.includes("afterpay")&&i.push({key:"afterpay",title:"Afterpay",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"4 × INTEREST-FREE"})}),d.includes("square")&&n.squareApplicationId&&n.squareLocationId&&i.push({key:"square",title:"Card (Square)",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),d.includes("gocardless")&&o&&i.push({key:"gocardless",title:"Bank Direct Debit",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY BY BANK"})}),d.includes("zip")&&i.push({key:"zip",title:"Zip",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY IN 4"})}),d.includes("klarna")&&o&&i.push({key:"klarna",title:"Klarna",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY LATER"})}),i.push({key:"bank",title:"Bank transfer",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Invoiced"})}),i}function dn({site:n,logo:o,preview:d=!1}){const{items:i,totals:a,coupon:l,refuseCoupon:m,deliveryOptions:x,shippingMethodId:h,setShippingMethodId:y,setQuoteDestination:N,identify:P,clearCapturedCart:w}=it(),u=x.find(t=>t.id===h)?.pickupLocation??null,{country:L,countries:b,activeCountry:_,formatMoney:$}=W(),[f,C]=s(()=>dt(n)[0].key),[F,Z]=s(!0);S(()=>{Z(Wt(B))},[]);const[X,qe]=s(!1),[J,Be]=s(""),[Q,Le]=s(""),[fe,$e]=s(""),[ge,he]=s(""),[xe,ye]=s(""),[be,ke]=s(""),[Ne,ve]=s(""),[we,Ce]=s(""),[v,Pe]=s(()=>L||b[0]?.code||""),[H,re]=s(""),[V,Ye]=s([]),[ze,Se]=s(null),[ae,oe]=s(null),gt=pe(()=>b.find(t=>t.code===v)??_,[b,v,_])?.postalLabel||"Postal Code",ht=V[0]?.divisionType||"State / Province";S(()=>{if(!v){Ye([]),Se(v);return}Se(null);let t=!1;return A.listCountrySubdivisions(v).then(c=>{t||(Ye(c),Se(v),re(""))}),()=>{t=!0}},[v]),S(()=>{N(v?{country:v,subdivision:H}:null)},[v,H,N]),S(()=>()=>N(null),[N]);const[Y,Fe]=s(null),[Me,Ue]=s([]),[ie,ce]=s("new"),[Ae,De]=s(!1),[He,xt]=s("Home"),[Ge,We]=s(null),[j]=s(()=>Ht()),[se,R]=s(null),[Ze,ee]=s(null),[Xe,yt]=s(null),[bt,kt]=s(!1),[Nt,vt]=s(!1),[O,Ee]=s(null),[Je,G]=s(!1),[Qe,z]=s(null),[wt,Ct]=s(!1),[Pt,Ve]=s(!1),[St,At]=s(!1),[Et,et]=s(!1),tt=U(!1);S(()=>{d||tt.current||!i.some(ot)||(tt.current=!0,Mt({lines:i,currency:a.currency,value:a.subtotal-a.discount,coupon:l?.valid?l.code:void 0}))},[i,a,l,d]),S(()=>{P(J,Q.trim()||void 0)},[J,Q,P]);const nt=U(null),[le,It]=s(null);S(()=>{const t=nt.current;if(!le||!t)return;const c=()=>t.style.setProperty("--sf-checkout-header-h",`${le.offsetHeight}px`);c();const p=new ResizeObserver(c);return p.observe(le),()=>p.disconnect()},[le]),S(()=>{const t=p=>({setConfirming:p,land:R,markPaid:()=>G(!0),note:z,fail:ee,clearCart:w}),c={search:window.location.search,storage:B,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};ct(Xt,{...c,capture:A.captureAfterpayPayment,page:t(Ct)}),ct(Qt,{...c,capture:A.captureZipPayment,page:t(At)})},[]),S(()=>{const c=new URLSearchParams(window.location.search).get("gocardless");if(c!=="confirm"&&c!=="cancel")return;const p=B.getItem(Re);if(B.removeItem(Re),window.history.replaceState(null,"",window.location.pathname),!p)return;let k;try{k=JSON.parse(p)}catch{return}if(w(),c==="cancel"){z("The direct debit was not set up — our team will follow up on payment."),R(k.confirmation);return}Ve(!0),A.completeGocardlessPayment({idempotencyKey:k.idempotencyKey}).then(g=>{g.status==="paid"?G(!0):g.status==="declined"?z("The direct debit was declined — our team will follow up on payment."):z("Your direct debit is set up — the payment is collecting and will clear in a few days.")}).catch(()=>{z("We could not confirm the direct debit — our team will follow up on payment.")}).finally(()=>{R(k.confirmation),Ve(!1)})},[]),S(()=>{const t=new URLSearchParams(window.location.search),c=t.get("klarna");if(c!=="confirm"&&c!=="cancel")return;const p=B.getItem(Ke);B.removeItem(Ke);const k=t.get("authorization_token");if(window.history.replaceState(null,"",window.location.pathname),!p)return;let g;try{g=JSON.parse(p)}catch{return}if(w(),c==="cancel"||!k){z("The Klarna payment was not completed — our team will follow up on payment."),R(g.confirmation);return}et(!0),A.captureKlarnaPayment({idempotencyKey:g.idempotencyKey,authorizationToken:k}).then(I=>{I.status==="paid"?G(!0):I.status==="declined"?z("Klarna declined the payment — our team will follow up on payment."):z("Your Klarna payment is being reviewed — we'll confirm the outcome shortly.")}).catch(()=>{z("We could not confirm the Klarna payment — our team will follow up on payment.")}).finally(()=>{R(g.confirmation),et(!1)})},[]);function rt(t){const[c,p]=lt(t.address);he(c),ye(p),ke(t.city),ve(t.zip_code),t.country&&Pe(t.country),t.phone&&Ce(t.phone),oe({country:t.country||null,state:t.state??""})}S(()=>{if(ae){if((ae.country||v)!==v){oe(null);return}ze===v&&(re(Vt(v,ae.state,V)),oe(null))}},[ae,v,ze,V]),S(()=>{let t=!1;return(async()=>{try{const[c,p,k]=await Promise.all([ne.me(),ne.myProfile().catch(()=>null),ne.myAddresses().catch(()=>[])]);if(t)return;Fe(c);const g=k.filter(te=>te.is_active);Ue(g),Be(c.email);const I=(p?.contact_name??"").split(/\s+/);Le(c.first_name||I[0]||""),$e(c.last_name||I.slice(1).join(" "));const q=c.phone||p?.phone;q&&Ce(q);const Ie=g.find(te=>te.id===c.default_delivery_location)??g[0];if(Ie)ce(Ie.id),rt(Ie);else if(p){const[te,Rt]=lt(p.address??"");he(te),ye(Rt),ke(p.city??""),ve(p.zip_code??""),p.country&&Pe(p.country),oe({country:p.country||null,state:p.state??""})}}catch{}})(),()=>{t=!0}},[]);function _t(){ne.logout(),Fe(null),Ue([]),ce("new"),De(!1)}const de=pe(()=>dt(n,{canParkContext:F}),[n,F]);S(()=>{de.some(t=>t.key===f)||C(de[0].key)},[de,f]);const at=xe.trim()?`${ge}
3
+ ${xe.trim()}`:ge;async function jt(){if(d||X||i.length===0||a.repricing)return;const t=i.filter(ot).flatMap(c=>Gt(c.components,c.qty));if(t.length===0){ee("Pick a size on each wheel's product page before checking out.");return}qe(!0),ee(null);try{const c=Y?A.createOrderAuthed:A.createOrder,p=Ft(),k=await c({customer:{email:J,name:`${Q} ${fe}`.trim(),phone:we.trim()||void 0,address:at,city:be,state:H||void 0,zipCode:Ne,country:v},items:t,currency:a.currency,idempotencyKey:j,shippingMethodId:h??void 0,couponCode:nn(l),...p==="denied"?{}:zt(),...p?{adConsent:p}:{}});if(Ut({confirmation:k,lines:i,adsSendTo:n.googleAdsId&&n.googleAdsConversionLabel?`${n.googleAdsId}/${n.googleAdsConversionLabel}`:null}),Dt({confirmation:k,lines:i}),w(),Y&&Ae&&ie==="new")try{await ne.createAddress({label:He.trim()||"Home",contact_name:`${Q} ${fe}`.trim(),phone:we.trim(),address:at,city:be,zip_code:Ne,state:H,country:v}),We("Address saved to your account.")}catch{We("We couldn't save the address to your account — you can add it under Account → Addresses.")}if(f==="card"&&n.paymentMethods.includes("card")){const g=await A.createPaymentIntent({idempotencyKey:j});Ee(k),yt(g)}else if(f==="paypal"&&n.paymentMethods.includes("paypal"))Ee(k),kt(!0);else if(f==="afterpay"&&n.paymentMethods.includes("afterpay")){const g=window.location.origin,I=await A.createAfterpayCheckout({idempotencyKey:j,confirmUrl:`${g}/checkout?afterpay=confirm`,cancelUrl:`${g}/checkout?afterpay=cancel`}),q={idempotencyKey:j,confirmation:k};B.setItem(Zt,JSON.stringify(q)),window.location.assign(I.redirectCheckoutUrl);return}else if(f==="square"&&n.paymentMethods.includes("square"))Ee(k),vt(!0);else if(f==="gocardless"&&n.paymentMethods.includes("gocardless")){const g=window.location.origin,I=await A.createGocardlessBillingRequest({idempotencyKey:j,confirmUrl:`${g}/checkout?gocardless=confirm`,cancelUrl:`${g}/checkout?gocardless=cancel`}),q={idempotencyKey:j,confirmation:k};B.setItem(Re,JSON.stringify(q)),window.location.assign(I.authorisationUrl);return}else if(f==="zip"&&n.paymentMethods.includes("zip")){const g=window.location.origin,I=await A.createZipCheckout({idempotencyKey:j,redirectUrl:`${g}/checkout?zip=return`}),q={idempotencyKey:j,confirmation:k};B.setItem(Jt,JSON.stringify(q)),window.location.assign(I.redirectUrl);return}else if(f==="klarna"&&n.paymentMethods.includes("klarna")){const g=window.location.origin,I=await A.createKlarnaCheckout({idempotencyKey:j,confirmUrl:`${g}/checkout?klarna=confirm`,cancelUrl:`${g}/checkout?klarna=cancel`}),q={idempotencyKey:j,confirmation:k};B.setItem(Ke,JSON.stringify(q)),window.location.assign(I.redirectUrl);return}else R(k)}catch(c){const p=rn(c);p?(m(p),ee(`${p} Your order has not been placed. Place it again to continue without the code.`)):ee(c instanceof je?c.message:"Could not place the order. Please try again."),qe(!1)}}return se?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:Je?"Payment received":"Order received"}),r("p",{className:"text-fg-dim",children:[Je?r(E,{children:["Thank you — your payment for order"," ",e("span",{className:"font-mono text-fg",children:se.orderNumber})," has gone through."," "]}):r(E,{children:["Thank you — your order ",e("span",{className:"font-mono text-fg",children:se.orderNumber})," is being reviewed by our team."," "]}),Y?r(E,{children:["Track it under"," ",e(M,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):e(E,{children:"We’ve emailed you a link to set a password and track it."})]}),Qe&&e("p",{className:"text-sm text-fg-dim",children:Qe}),Ge&&e("p",{className:"text-sm text-fg-dim",children:Ge}),!Y&&r("p",{className:"text-sm text-fg-dim",children:["You can also"," ",e(M,{href:`/track?order=${encodeURIComponent(se.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email — no password needed."]}),e(M,{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"})]}):wt?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Afterpay — one moment."})]}):Pt?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Setting up your direct debit…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Confirming with GoCardless — one moment."})]}):St?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Zip — one moment."})]}):Et?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Klarna — one moment."})]}):Xe?e(pn,{payment:Xe,onPaid:()=>{G(!0),R(O)},onSkip:()=>R(O)}):bt&&O?e(fn,{confirmation:O,clientId:n.paypalClientId??"",idemKey:j,onPaid:()=>{G(!0),R(O)},onSkip:()=>R(O)}):Nt&&O?e(hn,{confirmation:O,applicationId:n.squareApplicationId??"",locationId:n.squareLocationId??"",environment:n.squareEnvironment??"production",idemKey:j,onPaid:()=>{G(!0),R(O)},onSkip:()=>R(O)}):r("div",{ref:nt,className:"bg-bg text-fg",children:[r("header",{ref:It,className:"sticky top-0 z-30 grid grid-cols-[1fr_auto_1fr] items-center gap-8 border-b border-line px-[var(--sf-site-gutter,40px)] py-6 backdrop-blur-md max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))] max-[640px]:py-4",style:{background:"color-mix(in oklab, var(--bg) 92%, transparent)"},children:[r(M,{href:"/",className:"inline-flex items-center gap-3 font-mono text-[13px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["←",e("span",{className:"max-[640px]:hidden",children:"Back to shop"})]}),e(M,{href:"/","aria-label":`${n.name} home`,className:"inline-flex items-center justify-center",children:e(sn,{variant:"header",scrolled:!0,src:o?.url??null,reverse:o?.reverse??!1,reversedSrc:o?.reversed??null,inkIsDark:o?.inkIsDark??null,size:o?.size??"medium",sizePx:o?.sizePx??null,siteName:n.name})}),n.cardPayments?r("span",{className:"flex items-center justify-end gap-3 font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim",children:[e("span",{className:"text-green",children:"●"}),e("span",{className:"max-[640px]:hidden",children:"Encrypted ·"})," Stripe"]}):e("span",{})]}),r("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:[e("span",{className:"inline-flex items-center bg-accent px-3 py-1 font-bold text-bg",children:"Checkout"}),e("nav",{"aria-label":"Checkout steps",className:"flex flex-wrap items-center gap-5",children:[{n:"01",label:"Cart",state:"done"},{n:"02",label:"Ship & pay",state:"active"},{n:"03",label:"Confirmed",state:"pending"}].map(t=>r("span",{className:["relative flex items-center gap-2 transition-colors",t.state==="pending"?"text-fg-dim":"text-fg",t.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[e("span",{className:t.state==="done"?"text-accent font-bold":"",children:t.n}),e("span",{children:t.label})]},t.n))})]}),r("main",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-[1fr_420px] items-start gap-16 px-[var(--sf-site-gutter,40px)] pt-10 pb-[100px] max-[1100px]:grid-cols-1 max-[1100px]:gap-10 max-[1100px]:px-[min(24px,var(--sf-site-gutter,40px))] max-[1100px]:pt-8 max-[1100px]:pb-20",children:[r("div",{children:[r(ue,{num:"N° 01",title:"Contact",children:[e(T,{label:"Email",hint:Y?r(E,{children:["Signed in ·"," ",e("button",{type:"button",onClick:_t,className:"underline transition-colors hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:e("input",{type:"email",value:J,onChange:t=>Be(t.target.value),placeholder:"you@example.com",readOnly:Y!==null,className:K+(Y?" opacity-70":"")})}),r(ut,{children:[e(T,{label:"First name",children:e("input",{type:"text",value:Q,onChange:t=>Le(t.target.value),className:K})}),e(T,{label:"Last name",children:e("input",{type:"text",value:fe,onChange:t=>$e(t.target.value),className:K})})]})]}),r(ue,{num:"N° 02",title:u?"Collection":"Shipping address",children:[u?r("div",{className:"grid gap-2 text-[14px] leading-[1.6]",children:[e("span",{className:"font-medium",children:u.name}),[u.address,u.city,u.state,u.zipCode,u.country].filter(Boolean).length>0&&e("span",{className:"opacity-80",children:[u.address,u.city,u.state,u.zipCode,u.country].filter(Boolean).join(", ")}),u.openingHours&&e("span",{className:"opacity-80",children:u.openingHours}),u.instructions&&e("span",{className:"opacity-80",children:u.instructions}),e("span",{className:"mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"No delivery address needed"})]}):r(E,{children:[Y!==null&&Me.length>0&&r("div",{className:"grid gap-3",children:[Me.map(t=>e(me,{active:ie===t.id,onClick:()=>{ce(t.id),rt(t)},title:t.label,body:t.formatted_address,price:null},t.id)),e(me,{active:ie==="new",onClick:()=>ce("new"),title:"New address",body:null,price:null})]}),e(T,{label:"Address line 1",children:e("input",{type:"text",value:ge,onChange:t=>he(t.target.value),className:K})}),e(T,{label:"Address line 2",children:e("input",{type:"text",value:xe,onChange:t=>ye(t.target.value),placeholder:"Apartment, unit, garage bay…",className:K})}),r(ut,{cols:"three",children:[e(T,{label:"City",children:e("input",{type:"text",value:be,onChange:t=>ke(t.target.value),className:K})}),e(T,{label:gt,children:e("input",{type:"text",value:Ne,onChange:t=>ve(t.target.value),className:K})}),e(T,{label:"Country",separate:!0,children:e(st,{value:v,onChange:t=>Pe(t.target.value),className:K+" pr-10",style:pt,children:b.map(t=>e("option",{value:t.code,children:t.name},t.code))})})]}),e(T,{label:ht,separate:!0,children:V.length>0?r(st,{value:H,onChange:t=>re(t.target.value),className:K+" pr-10",style:pt,children:[e("option",{value:"",children:"Select…"}),V.map(t=>e("option",{value:t.code||t.name,children:t.name},t.code||t.name))]}):e("input",{type:"text",value:H,onChange:t=>re(t.target.value),className:K})})]}),e(T,{label:"Phone",children:e("input",{type:"tel",value:we,onChange:t=>Ce(t.target.value),placeholder:"+44 7700 900000",className:K})}),!u&&Y!==null&&ie==="new"&&r(E,{children:[e(xn,{checked:Ae,onChange:De,label:"Save this address to my account"}),Ae&&e(T,{label:"Address label",children:e("input",{type:"text",value:He,onChange:t=>xt(t.target.value),placeholder:"Home",className:K})})]})]}),e(ue,{num:"N° 03",title:"Shipping",children:r("div",{className:"grid gap-3",children:[x.map(t=>{const c=t.pickupLocation,p=c?[c.address,c.city,c.state,c.zipCode].filter(Boolean).join(", "):null;return e(me,{active:h===t.id,onClick:()=>y(t.id),title:c?`${t.name} — ${c.name}`:t.name,body:c?[p,c.openingHours,c.instructions,t.description].filter(Boolean).join(" · "):t.description||null,price:a.freeShipping||t.amount===0?_e:$(t.amount,a.currency),tag:t.tag||void 0},t.id)}),x.length===0&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Shipping is arranged after your order is reviewed."})]})}),r(ue,{num:"N° 04",title:"Payment",children:[e("div",{className:"grid gap-3",children:de.map(t=>e(me,{active:f===t.key,onClick:()=>C(t.key),title:t.title,body:t.body,price:t.price,tag:t.tag},t.key))}),f==="card"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):f==="paypal"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll approve the payment with PayPal on the payment step after placing the order."}):f==="afterpay"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Afterpay to approve four interest-free payments, then brought straight back."}):f==="square"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):f==="gocardless"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll set up a bank direct debit with GoCardless, then be brought straight back. Direct debits clear in a few days."}):f==="zip"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Zip to approve four instalments, then brought straight back."}):f==="klarna"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Klarna to choose how to pay, then brought straight back."}):e("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."})]})]}),r("aside",{className:"sticky top-[var(--sf-checkout-header-h,88px)] border border-line max-[1100px]:static",style:{background:"linear-gradient(180deg, color-mix(in oklab, var(--site-surface) 70%, var(--bg)) 0%, var(--bg) 100%)"},children:[r("header",{className:"flex items-center justify-between border-b border-accent bg-accent px-6 py-4 font-mono text-[13px] font-bold uppercase tracking-[0.28em] text-bg",children:[e("span",{children:"Your order"}),e(M,{href:"/wheels",className:"text-bg/80 transition-colors hover:text-bg",children:"Edit ↗"})]}),e("div",{className:"flex flex-col px-6 py-2",children:i.length===0?r("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",e(M,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog →"})]}):i.map(t=>e(yn,{slug:t.slug,name:t.name,qty:t.qty,config:t.config,configSummary:bn(t.config),price:$t(t,a.currency)??0,currency:a.currency},t.id))}),e("div",{className:"border-t border-line px-6 pt-5",children:e(en,{customerEmail:J})}),r("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[e(D,{label:"Subtotal",value:$(a.subtotal,a.currency)}),a.discount>0&&l?.valid&&e(D,{label:`Coupon · ${l.code}`,value:r("span",{className:"font-semibold text-green",children:["− ",$(a.discount,a.currency)]})}),l?.deferred&&e(D,{label:`Coupon · ${l.code}`,value:tn}),l?.valid&&l.effects?.gift&&e(D,{label:`Free gift · ${l.effects.gift.partNumber}${l.effects.gift.quantity>1?` ×${l.effects.gift.quantity}`:""}`,value:e("span",{className:"font-semibold text-green",children:_e})}),e(D,{label:"Shipping",value:a.shippingStatus==="free"?e("span",{className:"font-semibold text-green",children:_e}):an(a.shippingStatus)??$(a.shipping,a.currency)}),a.tax&&(a.tax.charged?e(D,{label:a.tax.inclusive?`${a.tax.name} included · ${a.tax.rate}%`:a.tax.name,value:$(a.tax.amount,a.currency)}):a.tax.name?e(D,{label:a.tax.name,value:on}):null)]}),r("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:[e("span",{className:"font-display text-[20px] font-bold uppercase tracking-[0.04em] text-fg",children:"Total"}),e("span",{className:"text-right font-display text-[34px] font-bold leading-none tracking-[-0.025em] text-fg",children:a.repricing?"…":$(a.grand,a.currency)})]}),r("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[Ze&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:Ze}),a.hasUnpricedLine&&r("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 ",a.currency,". Remove them, or switch region, to continue."]}),e("button",{type:"button",onClick:jt,disabled:X||i.length===0||a.hasUnpricedLine||a.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",i.length===0||X||a.hasUnpricedLine||a.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:X?r(E,{children:["Building order… ",e("span",{children:"·"})]}):a.repricing?r(E,{children:["Updating total… ",e("span",{children:"·"})]}):r(E,{children:[f==="bank"?"Place order":"Continue to payment"," ·"," ",$(a.grand,a.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})})]})]})]}),e("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:e("span",{children:Yt({legalName:n.legalName,foundedYear:n.foundedYear,siteName:n.name})})})]})}const K="w-full border-2 border-line bg-bg px-4 py-4 font-display text-[17px] tracking-[-0.005em] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent",pt={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 ue({num:n,title:o,children:d}){return r("section",{className:"mb-6 border border-line bg-bg",children:[r("header",{className:"flex items-center gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:n}),e("h2",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:o})]}),e("div",{className:"flex flex-col gap-4 px-6 py-6",children:d})]})}function ut({cols:n="two",children:o}){return e("div",{className:["grid gap-3 max-[640px]:grid-cols-1",n==="two"?"grid-cols-2":"grid-cols-[1.2fr_1fr_1fr]"].join(" "),children:o})}function me({active:n,onClick:o,title:d,body:i,price:a,tag:l}){return r("button",{type:"button",onClick:o,"aria-pressed":n,className:["relative grid grid-cols-[auto_1fr_auto] items-center gap-5 border bg-bg px-6 py-5 text-left transition-colors",n?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-line hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]"].join(" "),style:n?{background:"color-mix(in oklab, var(--accent) 14%, var(--bg))"}:void 0,children:[n&&e("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),e("span",{className:["flex h-[18px] w-[18px] items-center justify-center rounded-full border-2",n?"border-accent":"border-fg-dim"].join(" "),children:n&&e("span",{className:"block h-2.5 w-2.5 rounded-full bg-accent"})}),r("span",{className:"flex min-w-0 flex-col gap-1",children:[r("span",{className:"flex flex-wrap items-baseline gap-3 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[d,l&&e("span",{className:"border px-2 py-0.5 font-mono text-[11px] font-normal uppercase tracking-[0.24em] text-accent",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))"},children:l})]}),i&&e("span",{className:"font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim",children:i})]}),e("span",{className:"whitespace-nowrap font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:a})]})}function pn({payment:n,onPaid:o,onSkip:d}){const{formatMoney:i}=W(),a=pe(()=>Lt(n.publishableKey),[n.publishableKey]),l=pe(()=>{if(typeof document>"u")return;const m=getComputedStyle(document.documentElement),x=(y,N)=>m.getPropertyValue(y).trim()||N,h=document.documentElement.getAttribute("data-theme")!=="light";return{theme:h?"night":"stripe",variables:{colorPrimary:x("--accent",h?"#c9a461":"#8a6a2a"),colorBackground:x("--site-surface",h?"#131313":"#ffffff"),colorText:x("--fg",h?"#f5f1e8":"#0a0a0a"),borderRadius:"0px"}}},[]);return e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:n.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Payment"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:i(Number(n.amount),n.currency)})," ","by card to confirm it now."]}),e(Tt,{stripe:a,options:{clientSecret:n.clientSecret,appearance:l},children:e(un,{payment:n,onPaid:o,onSkip:d})})]})]})})}function un({payment:n,onPaid:o,onSkip:d}){const{formatMoney:i}=W(),a=Bt(),l=qt(),[m,x]=s(!1),[h,y]=s(null);async function N(){if(!a||!l||m)return;x(!0),y(null);const P=await a.confirmPayment({elements:l,redirect:"if_required"});if(P.error){y(P.error.message??"Payment failed. Please try again."),x(!1);return}const w=P.paymentIntent?.status;if(w==="succeeded"||w==="processing"){o();return}y("Payment did not complete. Please try again."),x(!1)}return r("div",{className:"flex flex-col gap-4",children:[e(Ot,{}),h&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:h}),e("button",{type:"button",onClick:N,disabled:!a||!l||m,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!a||!l||m?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:m?r(E,{children:["Processing… ",e("span",{children:"·"})]}):r(E,{children:["Pay ",i(Number(n.amount),n.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),e("button",{type:"button",onClick:d,disabled:m,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})}const mt="paypal-sdk-js";let Te=null;function mn(n,o){const d=`${n}|${o}`;if(Te?.key===d)return Te.promise;const i=new Promise((a,l)=>{document.getElementById(mt)?.remove();const m=document.createElement("script");m.id=mt;const x=new URLSearchParams({"client-id":n,currency:o,intent:"capture"});m.src=`https://www.paypal.com/sdk/js?${x}`,m.onload=()=>{const h=window.paypal;h?a(h):l(new Error("PayPal SDK loaded without its namespace"))},m.onerror=()=>l(new Error("PayPal SDK failed to load")),document.head.appendChild(m)});return Te={key:d,promise:i},i}function fn({confirmation:n,clientId:o,idemKey:d,onPaid:i,onSkip:a}){const{formatMoney:l}=W(),m=U(null),[x,h]=s(!1),[y,N]=s(null),P=U(i);return P.current=i,S(()=>{let w=!1,u=null;return mn(o,n.currency).then(L=>{if(!(w||!m.current))return u=L.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await A.createPaypalOrder({idempotencyKey:d})).paypalOrderId,onApprove:async b=>{try{if((await A.capturePaypalOrder({idempotencyKey:d,paypalOrderId:b.orderID})).status==="paid"){P.current();return}N("PayPal did not complete the payment. Please try again.")}catch(_){N(_ instanceof je?_.message:"PayPal payment failed. Please try again.")}},onError:()=>{N("PayPal could not process the payment. Please try again.")}}),u.render(m.current).then(()=>{w||h(!0)})}).catch(()=>{w||N("PayPal could not be loaded. You can pay later — your order stands either way.")}),()=>{w=!0,u?.close?.()}},[o,n.currency,d]),e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:n.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"PayPal"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:l(Number(n.grandTotal),n.currency)})," ","with PayPal to confirm it now."]}),!x&&!y&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal…"}),e("div",{ref:m}),y&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:y}),e("button",{type:"button",onClick:a,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})]})})}const ft="square-web-sdk";let Oe=null;function gn(n){const o=n==="sandbox"?"sandbox":"production";if(Oe?.key===o)return Oe.promise;const d=new Promise((i,a)=>{document.getElementById(ft)?.remove();const l=document.createElement("script");l.id=ft,l.src=o==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",l.onload=()=>{const m=window.Square;m?i(m):a(new Error("Square SDK loaded without its namespace"))},l.onerror=()=>a(new Error("Square SDK failed to load")),document.head.appendChild(l)});return Oe={key:o,promise:d},d}function hn({confirmation:n,applicationId:o,locationId:d,environment:i,idemKey:a,onPaid:l,onSkip:m}){const{formatMoney:x}=W(),h=U(null),y=U(null),N=U(null),[P,w]=s(!1),[u,L]=s(!1),[b,_]=s(null);S(()=>{let f=!1,C=null;return gn(i).then(async F=>{if(f||!h.current)return;const Z=F.payments(o,d);N.current=Z,C=await Z.card(),await C.attach(h.current),y.current=C,f||w(!0)}).catch(()=>{f||_("Square could not be loaded. You can pay later — your order stands either way.")}),()=>{f=!0,C?.destroy?.()}},[o,d,i]);async function $(){const f=y.current;if(!(!f||u)){L(!0),_(null);try{const C=await f.tokenize();if(C.status!=="OK"||!C.token){_(C.errors?.[0]?.message??"Please check the card details and try again."),L(!1);return}let F;try{F=(await N.current?.verifyBuyer?.(C.token,{amount:String(n.grandTotal),currencyCode:n.currency,intent:"CHARGE"}))?.token}catch{}if((await A.chargeSquare({idempotencyKey:a,sourceId:C.token,...F?{verificationToken:F}:{}})).status==="paid"){l();return}_("Square did not complete the payment. Please try again.")}catch(C){_(C instanceof je?C.message:"Square payment failed. Please try again.")}L(!1)}}return e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:n.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Card"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:x(Number(n.grandTotal),n.currency)})," ","by card to confirm it now."]}),!P&&!b&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form…"}),e("div",{ref:h}),b&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:b}),e("button",{type:"button",onClick:$,disabled:!P||u,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!P||u?"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:u?r(E,{children:["Processing… ",e("span",{children:"·"})]}):r(E,{children:["Pay ",x(Number(n.grandTotal),n.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),e("button",{type:"button",onClick:m,disabled:u,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 — our team will be in touch"})]})]})})}function xn({checked:n,onChange:o,label:d,sub:i}){return r("div",{className:"flex items-start gap-3 border-t border-line py-4 first:border-t-0 first:pt-0",children:[e("button",{type:"button",onClick:()=>o(!n),"aria-pressed":n,"aria-label":d,className:["mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center border transition-colors",n?"border-accent":"border-line"].join(" "),style:n?{background:"color-mix(in oklab, var(--accent) 18%, transparent)"}:void 0,children:n&&e("span",{className:"text-[13px] text-accent",children:"✓"})}),r("span",{className:"flex-1 font-display text-[16px] leading-[1.5] text-fg",children:[d,i&&e("small",{className:"mt-1 block font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim",children:i})]})]})}function yn({slug:n,name:o,qty:d,config:i,configSummary:a,price:l,currency:m}){const{catalog:x}=it(),{formatMoney:h}=W(),y=x.find(b=>b.slug===n),N=y?.spokes??5,P=y?.mesh??!1,w=i.find(b=>b.gold)?.label,u=y?.finishes.find(b=>b.name===w&&b.src)??y?.finishes.find(b=>b.src),L=y?.finishes[0]?.color??cn;return r("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-4 border-b border-line py-4 last:border-b-0",children:[r("div",{className:"relative flex aspect-square items-center justify-center overflow-hidden border border-line bg-surface",children:[e("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:d}),u?.src?e(Kt,{src:u.src,alt:`${o.lead}${o.accent} — ${u.name}`,width:120,height:120,sizes:"60px",className:"relative block h-full w-full object-contain p-2"}):e("div",{className:"block w-[78%]",style:{color:L},children:e(ln,{spokes:N,mesh:P,className:"block w-full"})})]}),r("div",{className:"flex min-w-0 flex-col gap-0.5",children:[r("span",{className:"font-display text-[17px] font-bold uppercase leading-none tracking-[-0.005em] text-fg",children:[o.lead,e("em",{className:"font-serif font-normal italic text-accent tracking-[-0.005em] normal-case",children:o.accent})]}),e("span",{className:"font-mono text-[12px] uppercase leading-[1.5] tracking-[0.18em] text-fg-dim",children:a})]}),e("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:h(l,m)})]})}function D({label:n,value:o}){return r("div",{className:"flex items-center justify-between font-mono text-[13px] font-medium uppercase tracking-[0.18em] text-fg",children:[e("span",{children:n}),e("strong",{className:"font-display text-[16px] font-medium tracking-[-0.005em] normal-case text-fg",children:o})]})}function bn(n){return n.map(o=>o.label).join(" · ")}export{dt as buildPayOptions,dn as default};
@@ -1 +1 @@
1
- "use client";import{jsx as s}from"react/jsx-runtime";import g from"../SectionBand.js";import m from"../DetailRows.js";import y from"./KindGate.js";import{useCurrentProduct as R}from"../../lib/puck/current-product.js";import{SAMPLE_RECORD as x,recordFacts as D,recordPictures as b,useCurrentRecord as k,useDrawsOtherRecord as S}from"../../lib/puck/current-record.js";import{detailShotTag as B,pickDetailShots as T}from"../../lib/wheels/detail-shots.js";import{selectedStuds as N}from"../../lib/wheels/selected-studs.js";import{useSampleProduct as P}from"./useSampleProduct.js";import{say as v}from"efficient-web-builder/format/lib/editor-words";const C=["alloy-wheel"];function p(e,i){return e.finishes.find(t=>t.name===i)??e.finishes[0]}function L(e,i){return(p(e,i)?.features??[]).map(t=>({eyebrow:t.eyebrow,title:t.heading,copy:t.description,tag:t.mark,image:t.image||void 0}))}function j(e,i,t){const r=T(p(e,i),t);return r.rows.map(n=>({eyebrow:n.eyebrow?.trim()||void 0,title:n.title,copy:n.line||void 0,image:n.url,tag:B(n,r,t),imageShape:"square"}))}function E(e){return S(!!e.editing)?s(F,{...e}):s(y,{kinds:C,type:"DetailRows",editing:e.editing,children:s(K,{...e})})}function f(e){const i=D(e),t=b(e)[0];return!i.length&&!t&&!e.title.trim()?[]:[{title:e.title,specs:i,image:t?.url||void 0}]}function F({startLeft:e,padTop:i,padBottom:t,editing:r=!1}){const n=k(),o=n?f(n):r?f(x):[];return o.length===0?null:s(m,{rows:o,startLeft:e,padTop:i,padBottom:t,editing:r})}function K({rowsFrom:e,startLeft:i,padTop:t,padBottom:r,editing:n=!1}){const o=R(),h=P(n&&!o),l=o?.product??h,a=l?.kind==="alloy-wheel"?l.source:null,c=o?o.selection.shown.finish:void 0,w=o?N(o.selection):null,d=e==="details",u=a?d?j(a,c,w):L(a,c):[];return d&&u.length===0?n?s(g,{className:"border-b border-line py-14 max-[1100px]:py-10",children:s("p",{className:"font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.18em] text-fg-dim",children:v("No detail shots on this finish yet. Tick a close-up on the design's renderings and give it a title. This section is hidden on the live page until then.")})}):null:s(m,{rows:u,startLeft:i,padTop:t,padBottom:r,editing:n})}export{E as default,f as recordDetailRows,C as supportedKinds};
1
+ "use client";import{jsx as s}from"react/jsx-runtime";import y from"../SectionBand.js";import f from"../DetailRows.js";import R from"./KindGate.js";import x from"./RecordPhotoGallery.js";import{useCurrentProduct as D}from"../../lib/puck/current-product.js";import{SAMPLE_RECORD as b,recordFacts as k,recordPictures as p,useCurrentRecord as S,useDrawsOtherRecord as B}from"../../lib/puck/current-record.js";import{detailShotTag as P,pickDetailShots as T}from"../../lib/wheels/detail-shots.js";import{selectedStuds as N}from"../../lib/wheels/selected-studs.js";import{useSampleProduct as v}from"./useSampleProduct.js";import{say as C}from"efficient-web-builder/format/lib/editor-words";const F=["alloy-wheel"];function h(e,n){return e.finishes.find(t=>t.name===n)??e.finishes[0]}function L(e,n){return(h(e,n)?.features??[]).map(t=>({eyebrow:t.eyebrow,title:t.heading,copy:t.description,tag:t.mark,image:t.image||void 0}))}function j(e,n,t){const r=T(h(e,n),t);return r.rows.map(i=>({eyebrow:i.eyebrow?.trim()||void 0,title:i.title,copy:i.line||void 0,image:i.url,tag:P(i,r,t),imageShape:"square"}))}function E(e){return B(!!e.editing)?s(G,{...e}):s(R,{kinds:F,type:"DetailRows",editing:e.editing,children:s(K,{...e})})}function w(e){const n=k(e),t=p(e)[0];return!n.length&&!t&&!e.title.trim()?[]:[{title:e.title,specs:n,image:t?.url||void 0}]}function G({startLeft:e,padTop:n,padBottom:t,editing:r=!1}){const i=S(),o=i?w(i):r?w(b):[];if(o.length===0)return null;const a=i?p(i,{firstField:!0}):[];return a.length&&(o[0]={...o[0],media:s(x,{pictures:a,name:i?.title??"",editing:r,fit:"column"})}),s(f,{rows:o,startLeft:e,padTop:n,padBottom:t,editing:r})}function K({rowsFrom:e,startLeft:n,padTop:t,padBottom:r,editing:i=!1}){const o=D(),a=v(i&&!o),c=o?.product??a,l=c?.kind==="alloy-wheel"?c.source:null,u=o?o.selection.shown.finish:void 0,g=o?N(o.selection):null,d=e==="details",m=l?d?j(l,u,g):L(l,u):[];return d&&m.length===0?i?s(y,{className:"border-b border-line py-14 max-[1100px]:py-10",children:s("p",{className:"font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.18em] text-fg-dim",children:C("No detail shots on this finish yet. Tick a close-up on the design's renderings and give it a title. This section is hidden on the live page until then.")})}):null:s(f,{rows:m,startLeft:n,padTop:t,padBottom:r,editing:i})}export{E as default,w as recordDetailRows,F as supportedKinds};
@@ -14,5 +14,7 @@ export interface DynamicGalleryGridProps {
14
14
  styleOwner?: string;
15
15
  editing?: boolean;
16
16
  omitHead?: boolean;
17
+ padTop?: number;
18
+ padBottom?: number;
17
19
  }
18
20
  export default function DynamicGalleryGrid(props: DynamicGalleryGridProps): import("react").JSX.Element;
@@ -1 +1 @@
1
- "use client";import{jsx as t,jsxs as G}from"react/jsx-runtime";import A from"efficient-web-builder/render/components/Btn";import k,{GALLERY_GRID_ATTR as L,GalleryLinksContext as M}from"../GalleryItem.js";import{SharedPartKinds as T}from"efficient-web-builder/render/components/PublishedPartStylesContext";import{renderHeadline as C}from"efficient-web-builder/render/components/goldPhrases";import H from"efficient-web-builder/render/components/SectionHeader";import I from"./KindGate.js";import{PLP_KINDS as B}from"../../lib/catalog/plp-item.js";import{useCurrentProduct as j}from"../../lib/puck/current-product.js";import{SAMPLE_PICTURE_COUNT as D,SAMPLE_RECORD as F,recordPictures as K,useCurrentRecord as U,useDrawsOtherRecord as Z}from"../../lib/puck/current-record.js";import{mediaGroupVehicle as $}from"../../lib/content/source-values.js";import{useSampleProduct as z}from"./useSampleProduct.js";import{say as _}from"efficient-web-builder/format/lib/editor-words";const V=B,P=["photos","lifestyle","accessories","others"];function W(e,a){if(!e)return[];if(a==="all")return P.flatMap(s=>e[s]??[]);const i=P.includes(a)?a:null;return i?e[i]??[]:[]}const R="relative z-[2] bg-bg py-[120px] max-[800px]:py-[70px]",E="relative z-[2] bg-bg pt-0 pb-[120px] max-[800px]:pt-0 max-[800px]:pb-[70px]",O="mx-auto max-w-[var(--sf-site-width,1600px)] px-[var(--sf-site-gutter,40px)] max-[800px]:px-[min(20px,var(--sf-site-gutter,40px))]";function X(e){return Z(!!e.editing)?t(Y,{...e}):t(I,{kinds:V,type:"GalleryB",editing:e.editing,children:t(q,{...e})})}function Y(e){const{editing:a=!1}=e,i=U(),s=i?K(i,{firstField:!0}).map(n=>({images:[n.url],eyebrow:n.alt&&n.alt!==i.title?n.alt:void 0})):a?Array.from({length:D},()=>({images:[""]})):[];return t(S,{...e,tiles:s,owner:{name:(i??F).title},photosOnly:!0,emptyHint:_("This record’s pictures appear here on its page. A record with no pictures draws nothing.")})}function q({omitHead:e=!1,num:a,title:i,linkText:s,linkHref:n,galleryHref:p="/gallery",submitHref:y="/contact",zone:v="all",photoDisplay:f="covers",previewHover:b,display:N,displayPhone:u,styleOwner:h,editing:c=!1}){const g=j(),x=z(c&&!g),o=g?.product??x,d=W(o?.mediaGroups,v).map(r=>({images:(r.items??[]).filter(m=>m.kind==="image").map(m=>m.url),vehicle:$(r),finish:r.finish})).filter(r=>r.images.length>0),l=(f==="auto"?d.length>=4?"covers":"all":f)==="all"?d.flatMap(r=>r.images.map(m=>({images:[m],vehicle:r.vehicle,finish:r.finish}))):d;return t(S,{omitHead:e,num:a,title:i,linkText:s,linkHref:n,galleryHref:p,submitHref:y,previewHover:b,display:N,displayPhone:u,styleOwner:h,editing:c,tiles:o?l.map(r=>({images:r.images,eyebrow:r.vehicle||void 0,meta:r.finish})):[],owner:{name:o?.name??"",href:o?.href,process:o?.eyebrow},emptyHint:_("This product’s photos appear here on a product page. Add media groups in the product’s Media tab.")})}function S({omitHead:e=!1,num:a,title:i,linkText:s,linkHref:n,galleryHref:p="/gallery",submitHref:y="/contact",previewHover:v,display:f,displayPhone:b,styleOwner:N,editing:u=!1,tiles:h,owner:c,emptyHint:g,photosOnly:x=!1}){const o=s?{text:s,href:n||"#"}:void 0,d=i?C(i,!1):void 0,w=e?null:t(H,{num:a,title:d,link:o});return h.length===0?u?t("section",{className:e?E:R,children:G("div",{className:O,children:[w,t("p",{className:"mt-8 border-t border-line py-6 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.18em] text-fg-dim",children:g})]})}):null:t("section",{className:e?E:R,children:G("div",{className:O,children:[w,t(M.Provider,{value:{galleryHref:p,submitHref:y,previewHover:v,display:f,displayPhone:b,styleOwner:N,photosOnly:x},children:t(T,{children:t("div",{[L]:"",className:"grid grid-cols-4 gap-2 max-[1500px]:grid-cols-3 max-[800px]:grid-cols-1 max-[800px]:gap-1",children:h.map((l,r)=>t(k,{image:l.images[0],photos:l.images.slice(1).map(m=>({src:m})),href:c.href,process:c.process,eyebrow:l.eyebrow,name:c.name,meta:l.meta,editing:u},`${l.eyebrow}-${r}`))})})}),!x&&t("div",{className:"mt-12 flex flex-col items-center gap-3",children:t(A,{href:p,variant:"ghost",children:"See Gallery"})})]})})}export{X as default,V as supportedKinds};
1
+ "use client";import{jsx as t,jsxs as _}from"react/jsx-runtime";import L from"efficient-web-builder/render/components/Btn";import M,{GALLERY_GRID_ATTR as B,GalleryLinksContext as C}from"../GalleryItem.js";import{SharedPartKinds as H}from"efficient-web-builder/render/components/PublishedPartStylesContext";import{renderHeadline as j}from"efficient-web-builder/render/components/goldPhrases";import D from"efficient-web-builder/render/components/SectionHeader";import F from"./KindGate.js";import K from"./RecordPhotoGallery.js";import{headIsEmpty as U,ownPadding as Z}from"../../lib/sections/own-padding.js";import{PLP_KINDS as $}from"../../lib/catalog/plp-item.js";import{useCurrentProduct as z}from"../../lib/puck/current-product.js";import{SAMPLE_PICTURE_COUNT as V,SAMPLE_RECORD as W,recordPictures as X,useCurrentRecord as Y,useDrawsOtherRecord as q}from"../../lib/puck/current-record.js";import{mediaGroupVehicle as J}from"../../lib/content/source-values.js";import{useSampleProduct as Q}from"./useSampleProduct.js";import{say as R}from"efficient-web-builder/format/lib/editor-words";const ee=$,E=["photos","lifestyle","accessories","others"];function re(e,o){if(!e)return[];if(o==="all")return E.flatMap(n=>e[n]??[]);const a=E.includes(o)?o:null;return a?e[a]??[]:[]}const S="relative z-[2] bg-bg py-[120px] max-[800px]:py-[70px]",A="relative z-[2] bg-bg pt-0 pb-[120px] max-[800px]:pt-0 max-[800px]:pb-[70px]",O="mx-auto max-w-[var(--sf-site-width,1600px)] px-[var(--sf-site-gutter,40px)] max-[800px]:px-[min(20px,var(--sf-site-gutter,40px))]";function te(e){return q(!!e.editing)?t(ie,{...e}):t(F,{kinds:ee,type:"GalleryB",editing:e.editing,children:t(ae,{...e})})}function ie(e){const{editing:o=!1}=e,a=Y(),n=a?X(a,{firstField:!0}).map(s=>({images:[s.url],eyebrow:s.alt&&s.alt!==a.title?s.alt:void 0,...s.video?{video:s.video}:{}})):o?Array.from({length:V},()=>({images:[""]})):[];return t(T,{...e,tiles:n,owner:{name:(a??W).title},photosOnly:!0,emptyHint:R("This record’s pictures appear here on its page. A record with no pictures draws nothing.")})}function ae({omitHead:e=!1,num:o,title:a,linkText:n,linkHref:s,galleryHref:u="/gallery",submitHref:y="/contact",zone:v="all",photoDisplay:h="covers",previewHover:b,display:N,displayPhone:d,styleOwner:c,editing:m=!1,padTop:w,padBottom:p}){const g=z(),G=Q(m&&!g),l=g?.product??G,f=re(l?.mediaGroups,v).map(r=>({images:(r.items??[]).filter(i=>i.kind==="image").map(i=>i.url),vehicle:J(r),finish:r.finish})).filter(r=>r.images.length>0),x=(h==="auto"?f.length>=4?"covers":"all":h)==="all"?f.flatMap(r=>r.images.map(i=>({images:[i],vehicle:r.vehicle,finish:r.finish}))):f;return t(T,{omitHead:e,num:o,title:a,linkText:n,linkHref:s,galleryHref:u,submitHref:y,previewHover:b,display:N,displayPhone:d,styleOwner:c,editing:m,padTop:w,padBottom:p,tiles:l?x.map(r=>({images:r.images,eyebrow:r.vehicle||void 0,meta:r.finish})):[],owner:{name:l?.name??"",href:l?.href,process:l?.eyebrow},emptyHint:R("This product’s photos appear here on a product page. Add media groups in the product’s Media tab.")})}function T({omitHead:e=!1,num:o,title:a,linkText:n,linkHref:s,galleryHref:u="/gallery",submitHref:y="/contact",previewHover:v,display:h,displayPhone:b,styleOwner:N,editing:d=!1,tiles:c,owner:m,emptyHint:w,photosOnly:p=!1,padTop:g,padBottom:G}){const l=n?{text:n,href:s||"#"}:void 0,f=a?j(a,!1):void 0,P=e?null:t(D,{num:o,title:f,link:l}),x=!d&&U(o,a,l?.text)?null:P,r=Z(g,G);return c.length===0?d?t("section",{className:e?A:S,style:r,children:_("div",{className:O,children:[x,t("p",{className:"mt-8 border-t border-line py-6 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.18em] text-fg-dim",children:w})]})}):null:t("section",{className:e?A:S,style:r,children:_("div",{className:O,children:[x,p?t(K,{pictures:c.map(i=>({url:i.images[0]??"",alt:i.eyebrow,video:i.video})),name:m.name,editing:d}):t(C.Provider,{value:{galleryHref:u,submitHref:y,previewHover:v,display:h,displayPhone:b,styleOwner:N,photosOnly:p},children:t(H,{children:t("div",{[B]:"",className:"grid grid-cols-4 gap-2 max-[1500px]:grid-cols-3 max-[800px]:grid-cols-1 max-[800px]:gap-1",children:c.map((i,k)=>t(M,{image:i.images[0],photos:i.images.slice(1).map(I=>({src:I})),href:m.href,process:m.process,eyebrow:i.eyebrow,name:m.name,meta:i.meta,editing:d},`${i.eyebrow}-${k}`))})})}),!p&&t("div",{className:"mt-12 flex flex-col items-center gap-3",children:t(L,{href:u,variant:"ghost",children:"See Gallery"})})]})})}export{te as default,ee as supportedKinds};
@@ -0,0 +1,12 @@
1
+ export interface GalleryPicture {
2
+ url: string;
3
+ alt?: string;
4
+ video?: string;
5
+ }
6
+ export declare function pictureLabel(picture: GalleryPicture, name: string): string;
7
+ export default function RecordPhotoGallery({ pictures, name, editing, fit, }: {
8
+ pictures: readonly GalleryPicture[];
9
+ fit?: "section" | "column";
10
+ name: string;
11
+ editing?: boolean;
12
+ }): import("react").JSX.Element | null;
@@ -0,0 +1 @@
1
+ "use client";import{jsx as t,Fragment as b,jsxs as c}from"react/jsx-runtime";import{useCallback as C,useRef as I,useState as N}from"react";import{sizedImage as M}from"efficient-web-builder/format/lib/sized-image";import P from"efficient-web-builder/render/components/Placeholder";import S,{LightboxClose as A}from"../Lightbox.js";import{GALLERY_GRID_ATTR as B}from"../GalleryItem.js";const O="(max-width: 1600px) 100vw, 1600px",U="(max-width: 1100px) 100vw, 50vw",z="(max-width: 800px) 30vw, 200px",R="100vw";function h(r,o){return r.video?o?`Play video of ${o}`:"Play video":o?`Open photo of ${o}`:"Open photo"}function T({small:r=!1}){return t("span",{"aria-hidden":!0,"data-play-badge":"",className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:t("span",{className:`flex items-center justify-center rounded-full bg-bg/75 text-fg ${r?"h-8 w-8 text-[length:12px]":"h-16 w-16 text-[length:22px]"}`,children:"▶"})})}const D="relative block w-full overflow-hidden bg-surface-2",G="block h-[min(78vh,820px)] w-full object-cover max-[800px]:h-[min(70vh,560px)]",H="block aspect-[4/5] max-h-[80vh] w-full object-cover",F="grid grid-cols-4 gap-2",Z="relative block aspect-square w-full overflow-hidden bg-surface-2",W="block h-full w-full object-cover",X="grid grid-cols-6 gap-2 max-[800px]:grid-cols-4",q="cursor-pointer text-left focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",_="absolute top-1/2 z-[2] flex h-14 w-14 -translate-y-1/2 cursor-pointer items-center justify-center border border-fg-dim/40 bg-overlay-scrim/40 font-mono text-[length:var(--size-label,22px)] text-fg-dim transition-colors hover:border-accent hover:text-accent max-[700px]:h-11 max-[700px]:w-11";function Y({pictures:r,name:o,editing:p=!1,fit:$="section"}){const[j,m]=N(!1),[i,u]=N(0),d=I(null),E=C(e=>{e?d.current=e:(d.current?.pause(),d.current=null)},[]),l=r.length,v=$==="column";if(l===0)return null;const g=()=>u(e=>(e-1+l)%l),w=()=>u(e=>(e+1)%l),L=e=>{u(e),m(!0)},n=r[Math.min(i,l-1)],f=(e,a,s,x)=>e.url?t("span",{className:`${s} relative`,children:t(P,{label:e.alt||o||"photo",src:e.url,alt:e.alt||o,sizes:a,objectFit:"cover",showBackground:!1})}):t("span",{"aria-hidden":!0,className:`${s} bg-surface-2`}),y=(e,a,s)=>{const x=c(b,{children:[s?v?f(e,U,H,1200):f(e,O,G,1600):f(e,z,W,400),e.video&&t(T,{small:!s})]}),k=s?D:Z;return p?t("div",{className:k,children:x}):t("button",{type:"button","aria-label":h(e,o),onClick:()=>L(a),className:`${k} ${q}`,children:x})};return c(b,{children:[c("div",{[B]:"","data-record-gallery":"",className:"flex flex-col gap-2",children:[y(r[0],0,!0),l>1&&t("ul",{className:v?F:X,children:r.slice(1).map((e,a)=>t("li",{children:y(e,a+1,!1)},`${e.url}-${a+1}`))})]}),!p&&t(S,{open:j,onClose:()=>m(!1),label:h(n,o),onPrev:l>1?g:void 0,onNext:l>1?w:void 0,className:"flex items-center justify-center p-6 backdrop-blur-[8px] max-[700px]:p-3",style:{background:"color-mix(in oklab, var(--bg) 86%, transparent)"},children:c("div",{onClick:e=>e.stopPropagation(),className:"relative flex h-full w-full items-center justify-center",children:[t(A,{className:"absolute right-0 top-0 z-[3] flex h-12 w-12 cursor-pointer items-center justify-center border border-line font-mono text-[length:var(--size-label,18px)] text-fg-dim transition-colors hover:border-accent hover:text-fg",style:{background:"color-mix(in oklab, var(--bg) 70%, transparent)"},children:"✕"}),n.video?t("video",{ref:E,controls:!0,playsInline:!0,preload:"metadata",poster:n.url,src:n.video,"aria-label":h(n,o),className:"block max-h-[calc(100vh-120px)] max-w-full bg-bg"},`video-${i}`):t("img",{...M(n.url,{fallbackWidth:1600}),sizes:R,alt:`${n.alt||o||"Photo"} — ${i+1} of ${l}`,className:"block max-h-[calc(100vh-120px)] max-w-full object-contain"},`photo-${i}`),l>1&&c(b,{children:[t("button",{type:"button","aria-label":"Previous photo",onClick:g,className:`${_} left-0`,children:"◁"}),t("button",{type:"button","aria-label":"Next photo",onClick:w,className:`${_} right-0`,children:"▷"}),c("span",{"data-gallery-counter":"",className:"absolute bottom-0 left-1/2 -translate-x-1/2 border border-fg-dim/30 bg-overlay-scrim/50 px-4 py-1.5 font-mono text-[length:var(--size-label,14px)] uppercase tracking-[0.22em] text-fg-dim backdrop-blur-[4px]",children:[i+1," / ",l]})]})]})})]})}export{Y as default,h as pictureLabel};
@@ -0,0 +1,2 @@
1
+ import type { CountrySubdivision } from "../api/index.js";
2
+ export declare function matchSubdivision(country: string, raw: string | null | undefined, rows: readonly CountrySubdivision[]): string;
@@ -0,0 +1 @@
1
+ function d(c,i,t){const n=(i??"").trim();if(!n)return"";if(t.length===0)return n;const o=n.toUpperCase(),r=`${c.toUpperCase()}-${o}`,p=t.find(e=>e.code&&e.code.toUpperCase()===o)??t.find(e=>e.code&&e.code.toUpperCase()===r)??t.find(e=>e.name.toUpperCase()===o);return p?p.code||p.name:""}export{d as matchSubdivision};