efficient-storefront-blocks 0.70.0 → 0.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/chunks/EditorPreviewCheckout-YQ3F5MSG.js +4 -0
  3. package/dist/chunks/{SiteEditorProvider-3GKJZDL5.js → SiteEditorProvider-Z33JB5BA.js} +1 -1
  4. package/dist/chunks/chunk-5OFEWRWI.js +1 -0
  5. package/dist/chunks/{chunk-TXTTPEQA.js → chunk-BZDVZUF4.js} +1 -1
  6. package/dist/chunks/{chunk-QWHNN7GF.js → chunk-QJDTP7K6.js} +1 -1
  7. package/dist/chunks/chunk-UGXNUQRA.js +246 -0
  8. package/dist/chunks/chunk-UJW4B64R.js +1 -0
  9. package/dist/chunks/{fitment-data-6GK7QQQI.js → fitment-data-DHKRLKNI.js} +1 -1
  10. package/dist/contract.js +2 -2
  11. package/dist/editor/components/CategorySource.js +1 -1
  12. package/dist/editor/components/HeaderSettingsPanel.js +1 -1
  13. package/dist/editor/components/PreviewHeader.d.ts +0 -1
  14. package/dist/editor/components/PreviewHeader.js +1 -11
  15. package/dist/editor/lib/document/blocks/service/ContactCards/fields.d.ts +2 -0
  16. package/dist/editor/lib/document/blocks/service/ContactCards/fields.js +1 -0
  17. package/dist/editor/lib/document/blocks/service/ContactRouting/fields.js +1 -1
  18. package/dist/editor/lib/document/blocks/service/FooterMessaging/fields.d.ts +2 -0
  19. package/dist/editor/lib/document/blocks/service/FooterMessaging/fields.js +1 -0
  20. package/dist/editor/lib/document/blocks/service/FooterPayment/fields.d.ts +2 -0
  21. package/dist/editor/lib/document/blocks/service/FooterPayment/fields.js +1 -0
  22. package/dist/editor/lib/document/blocks/service/MessagingCards/fields.d.ts +2 -0
  23. package/dist/editor/lib/document/blocks/service/MessagingCards/fields.js +1 -0
  24. package/dist/editor/lib/document/blocks/service/Reviews/fields.js +1 -1
  25. package/dist/editor/lib/document/blocks/service/index.d.ts +1 -1
  26. package/dist/editor/lib/document/blocks/service/index.js +1 -1
  27. package/dist/editor/lib/document/config.d.ts +2 -0
  28. package/dist/editor/lib/document/config.js +1 -1
  29. package/dist/editor/lib/efficient-block-sources.js +1 -1
  30. package/dist/editor/lib/header-settings-source.d.ts +2 -1
  31. package/dist/editor/lib/header-settings-source.js +1 -1
  32. package/dist/editor/lib/storefront-editor-words.d.ts +17 -2
  33. package/dist/editor/lib/storefront-editor-words.js +1 -1
  34. package/dist/editor.css +1 -1
  35. package/dist/index.d.ts +0 -2
  36. package/dist/index.js +97 -200
  37. package/dist/links.d.ts +0 -2
  38. package/dist/links.js +1 -1
  39. package/dist/render/built-with.json +1 -1
  40. package/dist/render/components/ChatLauncher.js +1 -1
  41. package/dist/render/components/ContactCards.d.ts +13 -0
  42. package/dist/render/components/ContactCards.js +1 -0
  43. package/dist/render/components/CopyText.d.ts +4 -0
  44. package/dist/render/components/CopyText.js +1 -0
  45. package/dist/render/components/Events.d.ts +3 -0
  46. package/dist/render/components/Events.js +1 -1
  47. package/dist/render/components/FooterMessaging.d.ts +5 -0
  48. package/dist/render/components/FooterMessaging.js +1 -0
  49. package/dist/render/components/FooterPayment.d.ts +11 -0
  50. package/dist/render/components/FooterPayment.js +1 -0
  51. package/dist/render/components/GalleryItem.js +1 -1
  52. package/dist/render/components/GalleryShowcase.js +1 -1
  53. package/dist/render/components/Header.d.ts +2 -1
  54. package/dist/render/components/Header.js +1 -1
  55. package/dist/render/components/HeaderCallButton.d.ts +9 -0
  56. package/dist/render/components/HeaderCallButton.js +1 -0
  57. package/dist/render/components/MessagingCards.d.ts +9 -0
  58. package/dist/render/components/MessagingCards.js +1 -0
  59. package/dist/render/components/QrCode.d.ts +5 -0
  60. package/dist/render/components/QrCode.js +1 -0
  61. package/dist/render/components/Reviews.d.ts +14 -4
  62. package/dist/render/components/Reviews.js +1 -1
  63. package/dist/render/components/checkout/CheckoutPageClient.d.ts +2 -25
  64. package/dist/render/components/checkout/CheckoutPageClient.js +1 -3
  65. package/dist/render/components/checkout/checkout-parts.d.ts +5 -0
  66. package/dist/render/components/checkout/checkout-parts.js +1 -0
  67. package/dist/render/components/checkout/checkout-state.d.ts +169 -0
  68. package/dist/render/components/checkout/checkout-state.js +3 -0
  69. package/dist/render/lib/api/index.d.ts +1 -0
  70. package/dist/render/lib/api/types.d.ts +3 -0
  71. package/dist/render/lib/document/blocks/service/ContactCards/meta.d.ts +7 -0
  72. package/dist/render/lib/document/blocks/service/ContactCards/meta.js +1 -0
  73. package/dist/render/lib/document/blocks/service/ContactCards/render.d.ts +4 -0
  74. package/dist/render/lib/document/blocks/service/ContactCards/render.js +1 -0
  75. package/dist/render/lib/document/blocks/service/Events/render.js +1 -1
  76. package/dist/render/lib/document/blocks/service/Footer/meta.js +1 -1
  77. package/dist/render/lib/document/blocks/service/FooterGroup/meta.js +1 -1
  78. package/dist/render/lib/document/blocks/service/FooterMessaging/meta.d.ts +2 -0
  79. package/dist/render/lib/document/blocks/service/FooterMessaging/meta.js +1 -0
  80. package/dist/render/lib/document/blocks/service/FooterMessaging/render.d.ts +2 -0
  81. package/dist/render/lib/document/blocks/service/FooterMessaging/render.js +1 -0
  82. package/dist/render/lib/document/blocks/service/FooterPayment/meta.d.ts +3 -0
  83. package/dist/render/lib/document/blocks/service/FooterPayment/meta.js +1 -0
  84. package/dist/render/lib/document/blocks/service/FooterPayment/render.d.ts +2 -0
  85. package/dist/render/lib/document/blocks/service/FooterPayment/render.js +1 -0
  86. package/dist/render/lib/document/blocks/service/MessagingCards/meta.d.ts +2 -0
  87. package/dist/render/lib/document/blocks/service/MessagingCards/meta.js +1 -0
  88. package/dist/render/lib/document/blocks/service/MessagingCards/render.d.ts +4 -0
  89. package/dist/render/lib/document/blocks/service/MessagingCards/render.js +1 -0
  90. package/dist/render/lib/document/blocks/service/Reviews/meta.d.ts +6 -0
  91. package/dist/render/lib/document/blocks/service/Reviews/meta.js +1 -1
  92. package/dist/render/lib/document/blocks/service/Reviews/render.js +1 -1
  93. package/dist/render/lib/document/blocks/service/metas.d.ts +4 -0
  94. package/dist/render/lib/document/blocks/service/metas.js +1 -1
  95. package/dist/render/lib/document/blocks/service/renders.d.ts +4 -0
  96. package/dist/render/lib/document/blocks/service/renders.js +1 -1
  97. package/dist/render/lib/document/blocks/text-part-shapes.json +137 -6
  98. package/dist/render/lib/document/card-templates.d.ts +2 -0
  99. package/dist/render/lib/document/card-templates.js +1 -0
  100. package/dist/render/lib/document/footer-page-blocks.d.ts +1 -0
  101. package/dist/render/lib/document/footer-page-blocks.js +1 -1
  102. package/dist/render/lib/document/lazy-draws.js +1 -1
  103. package/dist/render/lib/document/render-config.d.ts +2 -0
  104. package/dist/render/lib/document/render-config.js +1 -1
  105. package/dist/render/lib/document/section-to-box-rows-reviews.d.ts +1 -0
  106. package/dist/render/lib/document/section-to-box-rows-reviews.js +1 -0
  107. package/dist/render/lib/links/link-rules.d.ts +1 -1
  108. package/dist/render/lib/links/link-rules.js +1 -1
  109. package/dist/render/lib/qr.d.ts +5 -0
  110. package/dist/render/lib/qr.js +1 -0
  111. package/dist/render/lib/sections/messaging.d.ts +45 -0
  112. package/dist/render/lib/sections/messaging.js +1 -0
  113. package/dist/render/lib/sections/reviews.d.ts +1 -0
  114. package/dist/render/lib/sections/reviews.js +1 -0
  115. package/dist/render/lib/wheels/catalog-default-layout.js +1 -1
  116. package/dist/render/lib/wheels/collections.js +1 -1
  117. package/dist/words.d.ts +40 -7
  118. package/dist/words.js +4 -4
  119. package/package.json +4 -4
  120. package/dist/chunks/EditorPreviewCheckout-XI4VULPL.js +0 -4
  121. package/dist/chunks/chunk-RPLNV3WM.js +0 -1
  122. package/dist/chunks/chunk-SQH6XBRG.js +0 -1
  123. package/dist/chunks/chunk-XF2ZAVNU.js +0 -262
  124. package/dist/render/components/useStorefrontReviews.d.ts +0 -2
  125. package/dist/render/components/useStorefrontReviews.js +0 -1
  126. /package/dist/chunks/{chunk-XF2ZAVNU.js.LEGAL.txt → chunk-UGXNUQRA.js.LEGAL.txt} +0 -0
@@ -1 +1 @@
1
- import{a as V,c as C,g as z,i as $,j,l as O}from"./chunk-SQH6XBRG.js";var U="".replace(/\/+$/,"");var B="x-forwarded-for";function Z(e){let t=(e??"").split(",").map(n=>n.trim()).filter(Boolean);return t.length>0?t[t.length-1]:null}var Ie="x-forwarded-host";function Q(e,t,n){let r={};return e&&(r[Ie]=e),t&&n==="uncached"&&(r[B]=t),r}function X(e){if(e?.cache==="no-store"||e?.cache==="no-cache")return"uncached";if(e?.cache==="force-cache")return"data-cached";let t=e?.next?.revalidate;return typeof t=="number"&&t>0?"data-cached":"uncached"}var Y="x-storefront-site",ee="x-storefront-host",te="x-storefront-preview";var Fe="shop_access_token",ne="shop_refresh_token",N=null;function L(){O.removeItem(Fe),O.removeItem(ne)}var w={getAccess(){return N},takeLegacyRefresh(){let e=O.getItem(ne);return L(),e},setTokens(e){N=e,L()},clear(){N=null,L()}};import{efficientClientOpen as Qe}from"efficient-easel/screen/lib/session";function qe(e){return!!e.src}function A(e){let t=e.finishes.filter(qe);if(t.length===e.finishes.length)return e;let n=e.defaultFinish&&t.some(r=>r.name===e.defaultFinish)?e.defaultFinish:null;return{...e,finishes:t,defaultFinish:n}}function $e(e){return e.listable!==!1}function M(e){return e.map(A).filter($e)}var oe=["fill","stroke","stop-color","color","flood-color","lighting-color","solid-color"],ae=new Set(["none","transparent","currentcolor","inherit","initial","unset","context-fill","context-stroke"]),v={black:[0,0,0],white:[255,255,255],gray:[128,128,128],grey:[128,128,128],darkgray:[169,169,169],darkgrey:[169,169,169],dimgray:[105,105,105],dimgrey:[105,105,105],lightgray:[211,211,211],lightgrey:[211,211,211],gainsboro:[220,220,220],silver:[192,192,192],whitesmoke:[245,245,245]},ce=12,le=/\burl\(/i,ue=new RegExp(`(?<![-\\w])(${oe.join("|")})(\\s*=\\s*)(["'])([^"']*)\\3`,"gi"),me=new RegExp(`((?:^|[;{\\s"'])(?:${oe.join("|")})\\s*:\\s*)([^;}"'<>]+)`,"gi"),Ue=/<svg\b([^>]*)>/i,Be=/\bfill\s*[=:]/i;function Ne(e){let t=e.replace(ue,(n,r,a,l,d)=>{let s=re(d);return s===null?n:`${r}${a}${l}${s}${l}`}).replace(me,(n,r,a)=>{let l=re(a);return l===null?n:`${r}${l}`});return t=t.replace(Ue,(n,r)=>Be.test(r)?n:`<svg fill="#ffffff"${r}>`),t}function re(e){let t=/!important/i.test(e),n=e.replace(/!important/gi,"").trim().toLowerCase();if(!n||le.test(n)||ae.has(n))return null;let r=n in v?[...v[n],1]:pe(n);if(!r)return null;let[a,l,d,s]=r;if(Math.max(a,l,d)-Math.min(a,l,d)>ce)return null;let i=Le(255-a,255-l,255-d,s);return t?`${i} !important`:i}function Le(e,t,n,r){if(r<1)return`rgba(${e}, ${t}, ${n}, ${r})`;let a=l=>l.toString(16).padStart(2,"0");return`#${a(e)}${a(t)}${a(n)}`}function pe(e){return e.startsWith("#")?Me(e):e.startsWith("rgb")?De(e):e.startsWith("hsl")?Je(e):null}function Me(e){let t=e.slice(1),n=1;if(t.length===3||t.length===4)t.length===4&&(n=parseInt(t[3]+t[3],16)/255),t=t.slice(0,3).split("").map(r=>r+r).join("");else if(t.length===6||t.length===8)t.length===8&&(n=parseInt(t.slice(6,8),16)/255),t=t.slice(0,6);else return null;return/^[0-9a-f]{6}$/.test(t)?[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),n]:null}function De(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,r]=t.split("/"),a=n.split(/[\s,]+/).filter(Boolean).slice(0,3);if(a.length<3)return null;let l=a.map(s=>s.endsWith("%")?Math.round(parseFloat(s)/100*255):Math.round(parseFloat(s)));if(l.some(s=>Number.isNaN(s)))return null;let d=r?E(r):He(n);return[l[0],l[1],l[2],d]}function He(e){let t=e.split(/[\s,]+/).filter(Boolean);return t.length>=4?E(t[3]):1}function E(e){let t=e.trim().endsWith("%")?parseFloat(e)/100:parseFloat(e);return Number.isNaN(t)?1:t}function Je(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,r]=t.split("/"),a=n.split(/[\s,]+/).filter(Boolean);if(a.length<3)return null;let l=parseFloat(a[0]),d=parseFloat(a[1])/100,s=parseFloat(a[2])/100;if([l,d,s].some(P=>Number.isNaN(P)))return null;let i=r?E(r):a.length>=4?E(a[3]):1,[o,u,g]=We(l,d,s);return[o,u,g,i]}function We(e,t,n){let r=(1-Math.abs(2*n-1))*t,a=(e%360+360)%360/60,l=r*(1-Math.abs(a%2-1)),d=0,s=0,i=0;a<1?[d,s,i]=[r,l,0]:a<2?[d,s,i]=[l,r,0]:a<3?[d,s,i]=[0,r,l]:a<4?[d,s,i]=[0,l,r]:a<5?[d,s,i]=[l,0,r]:[d,s,i]=[r,0,l];let o=n-r/2;return[Math.round((d+o)*255),Math.round((s+o)*255),Math.round((i+o)*255)]}var se=512*1024;function D(e){return/\.svg(\?|$)/i.test(e)}function Ge(e){return`data:image/svg+xml,${encodeURIComponent(Ne(e))}`}function Ke(e){let t=e.replace(/!important/gi,"").trim().toLowerCase();if(!t||le.test(t)||ae.has(t))return null;let n=t in v?[...v[t],1]:pe(t);if(!n)return null;let[r,a,l]=n;return Math.max(r,a,l)-Math.min(r,a,l)>ce?null:(.2126*r+.7152*a+.0722*l)/255}function Ve(e){let t=[],n=r=>{let a=Ke(r);a!==null&&t.push(a)};for(let r of e.matchAll(ue))n(r[4]);for(let r of e.matchAll(me))n(r[2]);return t.length?t.reduce((r,a)=>r+a,0)/t.length<.5:null}var ie=/^(?:\uFEFF|\s+|<\?xml[^>]*\?>|<!--[\s\S]*?-->|<!DOCTYPE\s+svg[^>[]*>)/i;function ze(e){let t=e;for(let n=ie.exec(t);n&&n[0].length>0;n=ie.exec(t))t=t.slice(n[0].length);return/^<svg[\s>/]/i.test(t)}async function je(e,t){if(!D(e))return null;try{let n=await fetch(e,{signal:t,redirect:"manual"});if(!n.ok)return null;let r=Number(n.headers.get("content-length"));if(Number.isFinite(r)&&r>se)return null;let a=await n.text();return a.length>se?null:ze(a)?a:null}catch{return null}}async function de(e,t){let n=await je(e,t);return n===null?null:{reversed:Ge(n),inkIsDark:Ve(n)}}import{currentEaselSession as Ze,setSessionBridgedSite as Ht,setSessionDocumentSite as Jt}from"efficient-easel/screen/lib/session";function ge(){return Ze().siteId()}var Xe="",f=class extends Error{constructor(t,n,r){super(n),this.status=t,this.data=r}},W="Unable to reach the server. This could be a problem with your internet connection, or the server may be undergoing maintenance or an upgrade. Please try again shortly.",Ye=new Set([502,503,504]),H=0,et="This editor runs on its host's own backend, which does not serve this request.",tt=5e3,nt=15e3,rt=()=>typeof window>"u"?tt:nt;function Re(e){let t=(e.method??"GET").toUpperCase();if(!(e.body!=null||t!=="GET"&&t!=="HEAD")&&!(e.audience!=null&&e.audience!=="shop")&&typeof AbortSignal?.timeout=="function")return AbortSignal.timeout(rt())}var he=e=>e instanceof Error&&e.name==="TimeoutError",ye=(e,t)=>Ye.has(e)?W:t,st=["admin","venue"],_e="admin";function Yt(e){_e=st.includes(e)?e:"admin"}function it(){return _e}var ot=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/,ke=null;function en(e){ke=e&&ot.test(e)?e:null}function at(){return ke}function ct(e){if(typeof window>"u"||!e.startsWith("/api/v1/"))return e;let t=$();return!t||/[?&]site=/.test(e)?e:q(e,`site=${encodeURIComponent(t)}`)}async function c(e,t={}){let{token:n,baseUrl:r,headers:a,audience:l,...d}=t;if(typeof window<"u"&&!Qe())throw new f(H,et,null);if(typeof window>"u"&&r===void 0)throw new Error(`apiFetch(${JSON.stringify(e)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);let s=typeof FormData<"u"&&d.body instanceof FormData,i;try{i=await fetch(`${r??Xe}${ct(e)}`,{...d,headers:{...s?{}:{"Content-Type":"application/json"},...n?{Authorization:`Bearer ${n}`}:{},...l===null?{}:{"X-Portal-Audience":l??"shop"},...a},signal:d.signal??Re({...d,audience:l})})}catch(g){throw g instanceof TypeError||he(g)?new f(H,W,null):g}let o;try{o=await i.text()}catch(g){throw he(g)?new f(H,W,null):g}let u=null;if(o)try{u=JSON.parse(o)}catch{throw new f(i.status,i.ok?"Expected JSON but received a non-JSON response":ye(i.status,i.statusText),o)}if(!i.ok){let g=(u&&typeof u=="object"&&"detail"in u&&typeof u.detail=="string"?u.detail:null)??ye(i.status,i.statusText);throw new f(i.status,g,u)}return u}var R=null;async function xe(){return R||(R=lt().finally(()=>{R=null}),R)}async function lt(){let e=w.takeLegacyRefresh(),t=await ut.refresh(e??void 0);return w.setTokens(t.access),t.access}async function Te(){return w.getAccess()??xe()}async function h(e,t={}){let n;try{n=await Te()}catch{throw w.clear(),new f(401,"Not signed in",null)}try{return await c(e,{...t,token:n})}catch(r){if(!(r instanceof f)||r.status!==401)throw r;try{let a=await xe();return await c(e,{...t,token:a})}catch{throw w.clear(),r}}}async function fe(e,t={}){if(w.getAccess())try{return{data:await h(e,t),asShopper:!0}}catch(n){if(!(n instanceof f)||n.status!==401)throw n}return{data:await c(e,t),asShopper:!1}}async function Se(){let e=await h("/api/auth/me/");if(e.portal!=="shop")throw w.clear(),new f(403,"This session is not valid for this shop.",null);return e}var ut={login:(e,t)=>c("/api/auth/login/",{method:"POST",body:JSON.stringify({email:e,password:t,portal:"shop"}),credentials:"include"}),refresh:e=>c("/api/auth/refresh/",{method:"POST",body:JSON.stringify(e?{refresh:e,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{w.clear();try{await c("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{let e=await Te();return await Se(),e},me:Se,updateMe:e=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify(e)}),changePassword:(e,t)=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:t,old_password:e})}),changeEmail:(e,t)=>h("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:e,current_password:t})}),myProfile:()=>h("/api/shop-portal/profile/"),updateMyProfile:e=>h("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(e)}),myAddresses:()=>h("/api/shop-portal/delivery-locations/"),createAddress:e=>h("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(e)}),updateAddress:(e,t)=>h(`/api/shop-portal/delivery-locations/${e}/`,{method:"PATCH",body:JSON.stringify(t)}),deleteAddress:e=>h(`/api/shop-portal/delivery-locations/${e}/`,{method:"DELETE"}),passwordResetRequest:e=>c("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:e})}),passwordResetConfirm:(e,t,n)=>c("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:e,token:t,new_password:n})}),brands:()=>h("/api/products/brands/"),myOrders:()=>h("/api/shop-portal/orders/").then(e=>e.results),myOrder:e=>h(`/api/shop-portal/orders/${e}/`),cancelOrder:e=>h(`/api/shop-portal/orders/${e}/cancel/`,{method:"POST"}),myReturns:e=>h(`/api/shop-portal/returns/${e?`?order=${encodeURIComponent(e)}`:""}`).then(t=>t.results),createReturn:e=>h("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(e)}),withdrawReturn:e=>h(`/api/shop-portal/returns/${e}/cancel/`,{method:"POST"}),uploadReturnPhoto:(e,t)=>{let n=new FormData;return n.append("claim_item",e),n.append("file",t),n.append("media_type",t.type.startsWith("video/")?"video":"image"),h("/api/shop-portal/return-media/",{method:"POST",body:n})}};function S(e){if(typeof e=="string")return e.startsWith("/media/")?V(e):e;if(Array.isArray(e))return e.map(S);if(e&&typeof e=="object"){let t={};for(let[n,r]of Object.entries(e))t[n]=n==="captions"&&r&&typeof r=="object"&&!Array.isArray(r)?Object.fromEntries(Object.entries(r).map(([a,l])=>[S(a),l])):S(r);return t}return e}var Ce=typeof window>"u"&&U!=="",mt=Ce?U:"",pt=j,b=()=>({baseUrl:pt(),audience:null});function m(e,t){let n=t?`?process=${encodeURIComponent(t)}`:"";return`/api/v1${e}${n}`}var dt=100,Pe=50;function Oe(e,t,n){let r=new URLSearchParams;for(let[a,l]of Object.entries(t))l!=null&&l!==""&&r.set(a,String(l));return r.set("pageSize",String(dt)),n&&r.set("cursor",n),`/api/v1${e}?${r.toString()}`}function gt(e,t){return Oe("/wheels",{process:e},t)}function ht(e,t,n){return Oe("/products",{kind:e.join(","),make:t?.make,model:t?.model,year:t?.year,modification:t?.modification},n)}function yt(e){if(!e)return null;try{return new URL(e,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function we(e,t,n=()=>!1){let r=[],a=null;try{for(let l=0;l<Pe;l++){let d=await c(await t(a),await p());if(r.push(...d.results),a=yt(d.next),!a)break}a&&console.warn(`[${e}] stopped at ${Pe} pages (${r.length} rows); catalog may be truncated`)}catch(l){if(n(l))throw l;console.warn(`[${e}] product API unavailable, returning []`,l)}return r}var ft=e=>e instanceof f&&e.status===400;function St(e){return e.flatMap(t=>t.kind==="alloy-wheel"?M([t]):[t])}async function ve(){return(await Pt()).host}async function Pt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js"),t=await e(),n=l=>l?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,r=n(t.get(ee)??t.get("x-forwarded-host")??t.get("host")),a=n(t.get("host"));return{host:r,matchesRequestHost:r!==null&&r===a}}catch{return{host:null,matchesRequestHost:!1}}}async function wt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return Z((await e()).get(B))}catch{return null}}async function bt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(Y)||null}catch{return null}}async function At(){let e=await bt();if(e)return`site=${encodeURIComponent(e)}`;let t=await ve();return t?`host=${encodeURIComponent(t)}`:""}async function y(e){if(typeof window<"u"){let t=$();return t?q(e,`site=${encodeURIComponent(t)}`):e}return q(e,await At())}function q(e,t){return t?`${e}${e.includes("?")?"&":"?"}${t}`:e}var Rt="preview";async function _t(){if(typeof window<"u")return null;try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(te)}catch{return null}}async function kt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get("user-agent")}catch{return null}}async function J(e,t){let n=await _t();if(n===null)return[await y(e),await p(t)];let r=q(await y(e),`${Rt}=${encodeURIComponent(n)}`),{next:a,cache:l,...d}=t??{},s=await p({...d,cache:"no-store"}),i=await kt();return i&&(s.headers={...s.headers,"user-agent":i}),[r,s]}async function xt(e){if(!Ce)return;let[t,n]=await Promise.all([ve(),wt()]),r=Q(t,n,e);return Object.keys(r).length>0?r:void 0}async function p(e){let t=await xt(X(e)),n={baseUrl:mt,...e};return t&&(n.headers={...t,...e?.headers}),n}var _=typeof window>"u";function k(e,t){let n=new URLSearchParams;for(let[a,l]of Object.entries(t))l!==void 0&&l!==""&&n.set(a,String(l));let r=n.toString();return`/api/v1/fitment${e}${r?`?${r}`:""}`}var on={listMakes:async e=>{if(_){let{fitmentData:n}=await import("./fitment-data-6GK7QQQI.js");return n.makes(e)}return(await c(k("/makes",{region:e}),b())).results},listModels:async(e,t)=>{if(_){let{fitmentData:r}=await import("./fitment-data-6GK7QQQI.js");return r.models(e,t)}return(await c(k("/models",{make:e,region:t}),b())).results},listYears:async(e,t,n)=>{if(_){let{fitmentData:a}=await import("./fitment-data-6GK7QQQI.js");return a.years(e,t,n)}return(await c(k("/years",{make:e,model:t,region:n}),b())).results},listModifications:async(e,t,n,r)=>{if(_){let{fitmentData:l}=await import("./fitment-data-6GK7QQQI.js");return l.modifications(e,t,n,r)}return(await c(k("/modifications",{make:e,model:t,year:n,region:r}),b())).results},getStockFitment:async(e,t,n,r,a)=>{if(_){let{fitmentData:l}=await import("./fitment-data-6GK7QQQI.js");return l.stockFitment(e,t,n,r,a)}return c(k("/stock-fitment",{make:e,model:t,year:n,modification:r,region:a}),b())}},an={listWheels:async e=>{let t=await we("products.listWheels",async n=>await y(gt(e,n)));return M(S(t))},listCatalog:async(e,t)=>{if(e.length===0)throw new Error("products.listCatalog() needs at least one kind. An empty list would omit `kind`, which the contract reads as `alloy-wheel` \u2014 so the call would silently return the wheel catalog instead of nothing.");let n=await we("products.listCatalog",async r=>await y(ht(e,t,r)),ft);return St(S(n))},getWheel:async e=>A(S(await c(await y(m(`/wheels/${e}`)),await p()))),getTyre:async e=>S(await c(await y(m(`/tyres/${e}`)),await p())),listBundles:async()=>{try{return await c(await y(m("/bundles")),await p())}catch{return[]}},getBundle:async e=>c(await y(m(`/bundles/${e}`)),await p()),listGalleryBuilds:async(e={})=>{let{process:t=null,wheelSlug:n=null}=e;if(typeof window>"u"){let{listGalleryBuilds:r}=await import("./gallery-builds-data-TD3QJK7L.js");return S(r(t,n))}try{let r=new URLSearchParams;t&&r.set("process",t),n&&r.set("wheelSlug",n);let a=r.toString(),l=await c(`/api/v1/gallery-builds${a?`?${a}`:""}`,b());return S(l.results)}catch(r){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",r),[]}},getSite:async()=>c(await y(m("/site")),await p()),getSiteBySlug:async e=>c(`${m("/site")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await p():void 0),listPages:async()=>S(await c(await y(m("/pages")),await p())),listPopups:async()=>c(await y(m("/popups")),await p()),listProductTemplates:async()=>{try{return await c(await y(m("/product-templates")),await p())}catch(e){return console.warn("[products.listProductTemplates] unavailable, returning []",e),[]}},listDynamicPages:async e=>{let t=e?`?recordType=${encodeURIComponent(e)}`:"";try{return await c(await y(`${m("/dynamic-pages")}${t}`),await p())}catch(n){if(n instanceof f&&n.status===404)return[];throw n}},getRecord:async(e,t)=>{try{return await c(await y(m(`/records/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)),await p())}catch(n){if(n instanceof f&&n.status===404)return null;throw n}},listRecordKeys:async e=>{try{let t=await c(await y(m(`/records/${encodeURIComponent(e)}`)),await p({cache:"no-store"}));return Array.isArray(t?.keys)?t.keys.filter(n=>typeof n=="string"&&n!==""):[]}catch(t){if(t instanceof f&&t.status===404)return[];throw t}},listProductTypeChoices:async()=>{try{return await c(await y(m("/product-type-choices")),await p())}catch(e){return console.warn("[products.listProductTypeChoices] unavailable, returning []",e),[]}},listFieldUsage:async()=>{try{return await c(await y(m("/field-usage")),await p())}catch(e){return console.warn("[products.listFieldUsage] unavailable, returning []",e),[]}},getPage:async(e,t={})=>{let n=t.record?`?record=${encodeURIComponent(t.record)}`:"",[r,a]=await J(m(`/pages/${e}`)+n,t.revalidate!==void 0?{next:{revalidate:t.revalidate}}:void 0);return S(await c(r,a))},listBlogPosts:async(e={})=>{let t=e.category?`?category=${encodeURIComponent(e.category)}`:"";try{return(await c(m("/blog-posts")+t,await p())).map(r=>({...r,coverImage:C(r.coverImage)??""}))}catch(n){return console.warn("[products.listBlogPosts] blog API unavailable, returning []",n),[]}},getBlogPost:async e=>{let t=await c(m(`/blog-posts/${e}`),await p());return{...t,coverImage:C(t.coverImage)??""}},createOrder:async e=>c(m("/orders"),await p({method:"POST",body:JSON.stringify(e)})),createOrderAuthed:async e=>h(m("/orders"),await p({method:"POST",body:JSON.stringify(e)})),lookupOrder:async e=>c(m("/orders/lookup"),await p({method:"POST",body:JSON.stringify(e)})),createPaymentIntent:async e=>c(m("/payments/intent"),await p({method:"POST",body:JSON.stringify(e)})),createPaypalOrder:async e=>c(m("/payments/paypal/order"),await p({method:"POST",body:JSON.stringify(e)})),capturePaypalOrder:async e=>c(m("/payments/paypal/capture"),await p({method:"POST",body:JSON.stringify(e)})),createAfterpayCheckout:async e=>c(m("/payments/afterpay/checkout"),await p({method:"POST",body:JSON.stringify(e)})),captureAfterpayPayment:async e=>c(m("/payments/afterpay/capture"),await p({method:"POST",body:JSON.stringify(e)})),chargeSquare:async e=>c(m("/payments/square/charge"),await p({method:"POST",body:JSON.stringify(e)})),createGocardlessBillingRequest:async e=>c(m("/payments/gocardless/billing-request"),await p({method:"POST",body:JSON.stringify(e)})),completeGocardlessPayment:async e=>c(m("/payments/gocardless/complete"),await p({method:"POST",body:JSON.stringify(e)})),createZipCheckout:async e=>c(m("/payments/zip/checkout"),await p({method:"POST",body:JSON.stringify(e)})),captureZipPayment:async e=>c(m("/payments/zip/capture"),await p({method:"POST",body:JSON.stringify(e)})),createKlarnaCheckout:async e=>c(m("/payments/klarna/checkout"),await p({method:"POST",body:JSON.stringify(e)})),captureKlarnaPayment:async e=>c(m("/payments/klarna/capture"),await p({method:"POST",body:JSON.stringify(e)})),createStockAlert:async e=>c(m("/stock-alerts"),await p({method:"POST",body:JSON.stringify(e)})),createPreOrderIntent:async e=>c(m("/pre-order-intents"),await p({method:"POST",body:JSON.stringify(e)})),createNewsletterSubscription:async e=>c(m("/newsletter-subscriptions"),await p({method:"POST",body:JSON.stringify(e)})),unsubscribeNewsletter:async e=>c(m("/newsletter-unsubscribe"),await p({method:"POST",body:JSON.stringify(e)})),captureCart:async e=>c(m("/carts"),await p({method:"POST",body:JSON.stringify(e)})),restoreCart:async e=>c(m("/carts/restore"),await p({method:"POST",body:JSON.stringify(e)})),unsubscribeCartReminders:async e=>c(m("/carts/unsubscribe"),await p({method:"POST",body:JSON.stringify(e)})),listReviews:async(e={})=>{let t=new URLSearchParams;e.limit&&t.set("limit",String(e.limit)),e.designCode&&t.set("designCode",e.designCode);let n=m("/reviews"),r=t.toString();try{return await c(await y(r?`${n}?${r}`:n),await p())}catch(a){return console.warn("[products.listReviews] product API unavailable, returning []",a),[]}},submitReview:async e=>c(m("/reviews"),await p({method:"POST",body:JSON.stringify(e)})),getForm:async e=>c(m(`/forms/${encodeURIComponent(e)}`),await p()),submitForm:async(e,t)=>c(m(`/forms/${encodeURIComponent(e)}/submissions`),await p({method:"POST",body:JSON.stringify(t)})),listShippingMethods:async()=>{try{return await c(m("/shipping-methods"),await p())}catch(e){return console.warn("[products.listShippingMethods] product API unavailable, returning []",e),[]}},listCountrySubdivisions:async e=>{try{return await c(m(`/countries/${encodeURIComponent(e)}/subdivisions`),await p())}catch(t){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",t),[]}},quoteCart:async e=>{let t=m("/cart/quote"),n=await p({method:"POST",body:JSON.stringify(e)});return e.couponCode?(await fe(t,n)).data:c(t,n)},validateCoupon:async e=>{let{data:t,asShopper:n}=await fe(m("/coupons/validate"),await p({method:"POST",body:JSON.stringify(e)}));return{...t,askedAsShopper:n}},getHeaderSettings:async()=>{let e=Re({method:"GET"}),t=await c(...await J(m("/header-settings"),{signal:e})),n=C(t.logoUrl),r=null,a=null;if(n&&D(n)){let l=await de(n,e);l&&(r=l.reversed,a=l.inkIsDark)}return{...t,logoUrl:n,logoReversed:r,logoInkIsDark:a}},getThemeSettings:async()=>c(...await J(m("/theme-settings"))),getChatSettings:async()=>c(await y(m("/chat-settings")),await p())},cn={listServices:async()=>{try{return await c(m("/bookings/services"),await p())}catch(e){return console.warn("[bookings.listServices] API unavailable, returning []",e),{results:[],currency:"USD"}}},getAvailability:async(e,t)=>c(m(`/bookings/availability?service=${encodeURIComponent(e)}&date=${t}`),await p()),create:async e=>c(m("/bookings"),await p({method:"POST",body:JSON.stringify(e)})),get:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}`),await p()),cancel:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}/cancel`),await p({method:"POST"})),createPaymentIntent:async e=>c(m("/bookings/payments/intent"),await p({method:"POST",body:JSON.stringify({manageToken:e})}))},G=class extends Error{constructor(n,r){super(`Slug "${n}" exists on ${r} websites; a site is required to pick one.`);this.slug=n;this.count=r;this.name="AmbiguousPageSlugError"}},I=(e,t,n)=>{let r=new URLSearchParams({...t?{site:t}:{},...n?{draft:"1"}:{}}).toString();return`/api/storefront/${e}/${r?`?${r}`:""}`},x=e=>`/api/storefront/sites/${encodeURIComponent(e)}/`,Tt=e=>`${x(e)}currencies/`,Ct="/api/storefront/media/ingest/",K=class extends Error{constructor(){super("This editor is not connected to a website, so an upload has nowhere to go. Open the page from the website the file should belong to, then try again."),this.name="MediaUploadDestinationError"}};function Ot(){let e=ge();if(!e)throw new K;return`${Ct}?${new URLSearchParams({site:e})}`}var vt="X-Puck-Media-Manifest",be=z.contentHash,F={"X-Media-Manifest":be,[vt]:be},ln=Ee({});function Ee(e){return(t,n={})=>{let r=at(),a=e.headers||r?{...r?{"Accept-Language":r}:{},...e.headers,...n.headers}:void 0;return c(t,{...n,...e.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...a?{headers:a}:{},audience:e.audience??it()})}}function Et(e={}){let t=Ee(e),n=e.siteDrafts===!0,r=s=>I("header-settings",s,n),a=s=>I("theme-settings",s,n),l=s=>I("chat-settings",s,n),d=s=>I("social-settings",s,n);return{findPageBySlug:async(s,i,o)=>{let u=new URLSearchParams({slug:s});o&&u.set("site",o);let g=await t(`/api/storefront/pages/?${u.toString()}`,{token:i}),P=Array.isArray(g)?g:g.results??[];if(!o&&P.length>1)throw new G(s,P.length);return P[0]??null},getPageById:(s,i)=>t(`/api/storefront/pages/${s}/`,{token:i}),saveLayout:(s,i,o,u,g)=>t(`/api/storefront/pages/${s}/`,{method:"PATCH",body:JSON.stringify({layout:i,expected_updated_at:u,...g?{client_id:g}:{}}),token:o}),duplicatePage:(s,i,o)=>t(`/api/storefront/pages/${s}/duplicate/`,{method:"POST",body:JSON.stringify({title:i.title,slug:i.slug}),token:o}),geocode:(s,i,o)=>t(`/api/storefront/geocode/?${new URLSearchParams(o?{q:s,country:o}:{q:s})}`,{token:i}),listBlockSources:s=>t("/api/storefront/block-sources/",{token:s}),listRecordTypes:s=>t("/api/storefront/record-types/",{token:s}),createPagePreviewLink:(s,i)=>t(`/api/storefront/pages/${s}/preview-link/`,{method:"POST",token:i}),claimPageEditLock:(s,i,o,u=!1)=>t(`/api/storefront/pages/${s}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:o,takeover:u}),token:i}),releasePageEditLock:(s,i)=>t(`/api/storefront/pages/${s}/edit-lock/`,{method:"DELETE",token:i}),createTemplate:(s,i,o)=>t("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:s,layout:i}),headers:F,token:o}),getTemplate:(s,i)=>t(`/api/storefront/page-templates/${s}/`,{token:i}),saveTemplateLayout:(s,i,o)=>t(`/api/storefront/page-templates/${s}/`,{method:"PATCH",body:JSON.stringify({layout:i}),headers:F,token:o}),listTemplatePages:async(s,i)=>{let o=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(s)}`,{token:i});return Array.isArray(o)?o:o.results??[]},findTemplatePageBySlug:async(s,i,o)=>{let u=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(s)}&slug=${encodeURIComponent(i)}`,{token:o});return(Array.isArray(u)?u:u.results??[])[0]??null},createTemplatePage:(s,i,o)=>t("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:s,...i}),headers:F,token:o}),saveTemplatePageLayout:(s,i,o)=>t(`/api/storefront/template-pages/${s}/`,{method:"PATCH",body:JSON.stringify({layout:i}),headers:F,token:o}),deleteTemplatePage:(s,i,o)=>t(`/api/storefront/template-pages/${s}/`,{method:"DELETE",token:i,...o?.keepalive?{keepalive:!0}:{}}),listPages:async(s,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("site",i);let u=await t(`/api/storefront/pages/?${o.toString()}`,{token:s});return Array.isArray(u)?u:u.results??[]},createPage:(s,i,o,u)=>t("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:s,slug:i,layout:o}),token:u}),deletePage:(s,i)=>t(`/api/storefront/pages/${s}/`,{method:"DELETE",token:i}),getHeaderSettings:(s,i)=>t(r(i),{token:s}),listMenus:async(s,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("site",i);let u=await t(`/api/storefront/menus/?${o}`,{token:s});return Array.isArray(u)?u:u.results??[]},listBlogPosts:async(s,i={})=>{let o=new URLSearchParams({no_page:"true"});i.visibleOnly&&o.set("is_visible","true"),i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/blog-posts/?${o.toString()}`,{token:s});return Array.isArray(u)?u:u.results??[]},listFieldUsage:async(s,i)=>{let o=await t(`/api/storefront/field-usage/?site=${encodeURIComponent(i)}`,{token:s});return Array.isArray(o?.entries)?o.entries:[]},listCategories:async(s,i={})=>{let o=new URLSearchParams({no_page:"true"});i.visibleOnly&&o.set("is_visible","true"),i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/categories/?${o.toString()}`,{token:s});return[...Array.isArray(u)?u:u.results??[]].sort((P,T)=>P.sort_order-T.sort_order||P.name.localeCompare(T.name))},listForms:async(s,i={})=>{let o=new URLSearchParams({no_page:"true"});i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/forms/?${o.toString()}`,{token:s});return[...Array.isArray(u)?u:u.results??[]].sort((P,T)=>P.title.localeCompare(T.title))},listWheelSummaries:async(s,i={})=>{let o=new URLSearchParams;i.siteId&&o.set("site",i.siteId);let u=o.toString(),g=await t(`/api/storefront/wheel-curations/summaries/${u?`?${u}`:""}`,{token:s});return S(g)},listProducts:async(s,i={})=>{let o=new URLSearchParams;i.kinds?.length&&o.set("kind",i.kinds.join(",")),i.siteId&&o.set("site",i.siteId);let u=o.toString(),g=await t(`/api/storefront/products/${u?`?${u}`:""}`,{token:s});return S(g)},getWheelDetail:async(s,i,o={})=>{let u=new URLSearchParams({slug:i});return o.siteId&&u.set("site",o.siteId),A(S(await t(`/api/storefront/wheel-curations/detail/?${u.toString()}`,{token:s})))},updateHeaderSettings:(s,i,o)=>t(r(o),{method:"PATCH",body:JSON.stringify(s),token:i}),getSite:(s,i)=>t(x(s),{token:i}),listSites:async s=>{let i=await t("/api/storefront/sites/?no_page=true",{token:s});return Array.isArray(i)?i:i.results??[]},listSiteCurrencies:async(s,i)=>{let o=await t(Tt(s),{token:i});return Array.isArray(o)?o:[]},publishSite:(s,i)=>t(`${x(s)}publish/`,{method:"POST",token:i}),getSiteLiveState:(s,i)=>t(`${x(s)}live-state/`,{token:i}),updateSite:(s,i,o)=>t(x(s),{method:"PATCH",body:JSON.stringify(i),token:o}),getThemeSettings:(s,i)=>t(a(i),{token:s}),updateThemeSettings:(s,i,o)=>t(a(o),{method:"PATCH",body:JSON.stringify(s),token:i}),getChatSettings:(s,i)=>t(l(i),{token:s}),updateChatSettings:(s,i,o)=>t(l(o),{method:"PATCH",body:JSON.stringify(s),token:i}),getSocialSettings:(s,i)=>t(d(i),{token:s}),updateSocialSettings:(s,i,o)=>t(d(o),{method:"PATCH",body:JSON.stringify(s),token:i}),uploadHeaderLogo:(s,i,o)=>{let u=new FormData;return u.append("logo",s),t(r(o),{method:"PATCH",body:u,token:i})},clearHeaderLogo:(s,i)=>t(r(i),{method:"PATCH",body:JSON.stringify({logo:null}),token:s}),setHeaderLogoFromAsset:(s,i,o)=>t(r(o),{method:"PATCH",body:JSON.stringify({logo_asset_id:s}),token:i}),uploadMedia:async(s,i)=>{let o=new FormData;return o.append("file",s),t(Ot(),{method:"POST",body:o,token:i})},listMedia:async(s,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("kind",i);let u=await t(`/api/storefront/media-assets/?${o.toString()}`,{token:s});return Array.isArray(u)?u:u.results??[]}}}var un=Et({siteDrafts:!0});export{U as a,Q as b,X as c,w as d,qe as e,D as f,ge as g,Xe as h,f as i,W as j,H as k,Yt as l,en as m,c as n,ut as o,ve as p,Pt as q,wt as r,bt as s,_t as t,on as u,an as v,cn as w,G as x,ln as y,un as z};
1
+ import{a as V,c as C,g as z,i as $,j,l as O}from"./chunk-5OFEWRWI.js";var U="".replace(/\/+$/,"");var B="x-forwarded-for";function Z(e){let t=(e??"").split(",").map(n=>n.trim()).filter(Boolean);return t.length>0?t[t.length-1]:null}var Ie="x-forwarded-host";function Q(e,t,n){let r={};return e&&(r[Ie]=e),t&&n==="uncached"&&(r[B]=t),r}function X(e){if(e?.cache==="no-store"||e?.cache==="no-cache")return"uncached";if(e?.cache==="force-cache")return"data-cached";let t=e?.next?.revalidate;return typeof t=="number"&&t>0?"data-cached":"uncached"}var Y="x-storefront-site",ee="x-storefront-host",te="x-storefront-preview";var Fe="shop_access_token",ne="shop_refresh_token",N=null;function L(){O.removeItem(Fe),O.removeItem(ne)}var w={getAccess(){return N},takeLegacyRefresh(){let e=O.getItem(ne);return L(),e},setTokens(e){N=e,L()},clear(){N=null,L()}};import{efficientClientOpen as Qe}from"efficient-easel/screen/lib/session";function qe(e){return!!e.src}function A(e){let t=e.finishes.filter(qe);if(t.length===e.finishes.length)return e;let n=e.defaultFinish&&t.some(r=>r.name===e.defaultFinish)?e.defaultFinish:null;return{...e,finishes:t,defaultFinish:n}}function $e(e){return e.listable!==!1}function M(e){return e.map(A).filter($e)}var oe=["fill","stroke","stop-color","color","flood-color","lighting-color","solid-color"],ae=new Set(["none","transparent","currentcolor","inherit","initial","unset","context-fill","context-stroke"]),v={black:[0,0,0],white:[255,255,255],gray:[128,128,128],grey:[128,128,128],darkgray:[169,169,169],darkgrey:[169,169,169],dimgray:[105,105,105],dimgrey:[105,105,105],lightgray:[211,211,211],lightgrey:[211,211,211],gainsboro:[220,220,220],silver:[192,192,192],whitesmoke:[245,245,245]},ce=12,le=/\burl\(/i,ue=new RegExp(`(?<![-\\w])(${oe.join("|")})(\\s*=\\s*)(["'])([^"']*)\\3`,"gi"),me=new RegExp(`((?:^|[;{\\s"'])(?:${oe.join("|")})\\s*:\\s*)([^;}"'<>]+)`,"gi"),Ue=/<svg\b([^>]*)>/i,Be=/\bfill\s*[=:]/i;function Ne(e){let t=e.replace(ue,(n,r,a,l,d)=>{let s=re(d);return s===null?n:`${r}${a}${l}${s}${l}`}).replace(me,(n,r,a)=>{let l=re(a);return l===null?n:`${r}${l}`});return t=t.replace(Ue,(n,r)=>Be.test(r)?n:`<svg fill="#ffffff"${r}>`),t}function re(e){let t=/!important/i.test(e),n=e.replace(/!important/gi,"").trim().toLowerCase();if(!n||le.test(n)||ae.has(n))return null;let r=n in v?[...v[n],1]:pe(n);if(!r)return null;let[a,l,d,s]=r;if(Math.max(a,l,d)-Math.min(a,l,d)>ce)return null;let i=Le(255-a,255-l,255-d,s);return t?`${i} !important`:i}function Le(e,t,n,r){if(r<1)return`rgba(${e}, ${t}, ${n}, ${r})`;let a=l=>l.toString(16).padStart(2,"0");return`#${a(e)}${a(t)}${a(n)}`}function pe(e){return e.startsWith("#")?Me(e):e.startsWith("rgb")?De(e):e.startsWith("hsl")?Je(e):null}function Me(e){let t=e.slice(1),n=1;if(t.length===3||t.length===4)t.length===4&&(n=parseInt(t[3]+t[3],16)/255),t=t.slice(0,3).split("").map(r=>r+r).join("");else if(t.length===6||t.length===8)t.length===8&&(n=parseInt(t.slice(6,8),16)/255),t=t.slice(0,6);else return null;return/^[0-9a-f]{6}$/.test(t)?[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16),n]:null}function De(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,r]=t.split("/"),a=n.split(/[\s,]+/).filter(Boolean).slice(0,3);if(a.length<3)return null;let l=a.map(s=>s.endsWith("%")?Math.round(parseFloat(s)/100*255):Math.round(parseFloat(s)));if(l.some(s=>Number.isNaN(s)))return null;let d=r?E(r):He(n);return[l[0],l[1],l[2],d]}function He(e){let t=e.split(/[\s,]+/).filter(Boolean);return t.length>=4?E(t[3]):1}function E(e){let t=e.trim().endsWith("%")?parseFloat(e)/100:parseFloat(e);return Number.isNaN(t)?1:t}function Je(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,r]=t.split("/"),a=n.split(/[\s,]+/).filter(Boolean);if(a.length<3)return null;let l=parseFloat(a[0]),d=parseFloat(a[1])/100,s=parseFloat(a[2])/100;if([l,d,s].some(P=>Number.isNaN(P)))return null;let i=r?E(r):a.length>=4?E(a[3]):1,[o,u,g]=We(l,d,s);return[o,u,g,i]}function We(e,t,n){let r=(1-Math.abs(2*n-1))*t,a=(e%360+360)%360/60,l=r*(1-Math.abs(a%2-1)),d=0,s=0,i=0;a<1?[d,s,i]=[r,l,0]:a<2?[d,s,i]=[l,r,0]:a<3?[d,s,i]=[0,r,l]:a<4?[d,s,i]=[0,l,r]:a<5?[d,s,i]=[l,0,r]:[d,s,i]=[r,0,l];let o=n-r/2;return[Math.round((d+o)*255),Math.round((s+o)*255),Math.round((i+o)*255)]}var se=512*1024;function D(e){return/\.svg(\?|$)/i.test(e)}function Ge(e){return`data:image/svg+xml,${encodeURIComponent(Ne(e))}`}function Ke(e){let t=e.replace(/!important/gi,"").trim().toLowerCase();if(!t||le.test(t)||ae.has(t))return null;let n=t in v?[...v[t],1]:pe(t);if(!n)return null;let[r,a,l]=n;return Math.max(r,a,l)-Math.min(r,a,l)>ce?null:(.2126*r+.7152*a+.0722*l)/255}function Ve(e){let t=[],n=r=>{let a=Ke(r);a!==null&&t.push(a)};for(let r of e.matchAll(ue))n(r[4]);for(let r of e.matchAll(me))n(r[2]);return t.length?t.reduce((r,a)=>r+a,0)/t.length<.5:null}var ie=/^(?:\uFEFF|\s+|<\?xml[^>]*\?>|<!--[\s\S]*?-->|<!DOCTYPE\s+svg[^>[]*>)/i;function ze(e){let t=e;for(let n=ie.exec(t);n&&n[0].length>0;n=ie.exec(t))t=t.slice(n[0].length);return/^<svg[\s>/]/i.test(t)}async function je(e,t){if(!D(e))return null;try{let n=await fetch(e,{signal:t,redirect:"manual"});if(!n.ok)return null;let r=Number(n.headers.get("content-length"));if(Number.isFinite(r)&&r>se)return null;let a=await n.text();return a.length>se?null:ze(a)?a:null}catch{return null}}async function de(e,t){let n=await je(e,t);return n===null?null:{reversed:Ge(n),inkIsDark:Ve(n)}}import{currentEaselSession as Ze,setSessionBridgedSite as Ht,setSessionDocumentSite as Jt}from"efficient-easel/screen/lib/session";function ge(){return Ze().siteId()}var Xe="",f=class extends Error{constructor(t,n,r){super(n),this.status=t,this.data=r}},W="Unable to reach the server. This could be a problem with your internet connection, or the server may be undergoing maintenance or an upgrade. Please try again shortly.",Ye=new Set([502,503,504]),H=0,et="This editor runs on its host's own backend, which does not serve this request.",tt=5e3,nt=15e3,rt=()=>typeof window>"u"?tt:nt;function Re(e){let t=(e.method??"GET").toUpperCase();if(!(e.body!=null||t!=="GET"&&t!=="HEAD")&&!(e.audience!=null&&e.audience!=="shop")&&typeof AbortSignal?.timeout=="function")return AbortSignal.timeout(rt())}var he=e=>e instanceof Error&&e.name==="TimeoutError",ye=(e,t)=>Ye.has(e)?W:t,st=["admin","venue"],_e="admin";function Yt(e){_e=st.includes(e)?e:"admin"}function it(){return _e}var ot=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/,ke=null;function en(e){ke=e&&ot.test(e)?e:null}function at(){return ke}function ct(e){if(typeof window>"u"||!e.startsWith("/api/v1/"))return e;let t=$();return!t||/[?&]site=/.test(e)?e:q(e,`site=${encodeURIComponent(t)}`)}async function c(e,t={}){let{token:n,baseUrl:r,headers:a,audience:l,...d}=t;if(typeof window<"u"&&!Qe())throw new f(H,et,null);if(typeof window>"u"&&r===void 0)throw new Error(`apiFetch(${JSON.stringify(e)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);let s=typeof FormData<"u"&&d.body instanceof FormData,i;try{i=await fetch(`${r??Xe}${ct(e)}`,{...d,headers:{...s?{}:{"Content-Type":"application/json"},...n?{Authorization:`Bearer ${n}`}:{},...l===null?{}:{"X-Portal-Audience":l??"shop"},...a},signal:d.signal??Re({...d,audience:l})})}catch(g){throw g instanceof TypeError||he(g)?new f(H,W,null):g}let o;try{o=await i.text()}catch(g){throw he(g)?new f(H,W,null):g}let u=null;if(o)try{u=JSON.parse(o)}catch{throw new f(i.status,i.ok?"Expected JSON but received a non-JSON response":ye(i.status,i.statusText),o)}if(!i.ok){let g=(u&&typeof u=="object"&&"detail"in u&&typeof u.detail=="string"?u.detail:null)??ye(i.status,i.statusText);throw new f(i.status,g,u)}return u}var R=null;async function xe(){return R||(R=lt().finally(()=>{R=null}),R)}async function lt(){let e=w.takeLegacyRefresh(),t=await ut.refresh(e??void 0);return w.setTokens(t.access),t.access}async function Te(){return w.getAccess()??xe()}async function h(e,t={}){let n;try{n=await Te()}catch{throw w.clear(),new f(401,"Not signed in",null)}try{return await c(e,{...t,token:n})}catch(r){if(!(r instanceof f)||r.status!==401)throw r;try{let a=await xe();return await c(e,{...t,token:a})}catch{throw w.clear(),r}}}async function fe(e,t={}){if(w.getAccess())try{return{data:await h(e,t),asShopper:!0}}catch(n){if(!(n instanceof f)||n.status!==401)throw n}return{data:await c(e,t),asShopper:!1}}async function Se(){let e=await h("/api/auth/me/");if(e.portal!=="shop")throw w.clear(),new f(403,"This session is not valid for this shop.",null);return e}var ut={login:(e,t)=>c("/api/auth/login/",{method:"POST",body:JSON.stringify({email:e,password:t,portal:"shop"}),credentials:"include"}),refresh:e=>c("/api/auth/refresh/",{method:"POST",body:JSON.stringify(e?{refresh:e,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{w.clear();try{await c("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{let e=await Te();return await Se(),e},me:Se,updateMe:e=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify(e)}),changePassword:(e,t)=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:t,old_password:e})}),changeEmail:(e,t)=>h("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:e,current_password:t})}),myProfile:()=>h("/api/shop-portal/profile/"),updateMyProfile:e=>h("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(e)}),myAddresses:()=>h("/api/shop-portal/delivery-locations/"),createAddress:e=>h("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(e)}),updateAddress:(e,t)=>h(`/api/shop-portal/delivery-locations/${e}/`,{method:"PATCH",body:JSON.stringify(t)}),deleteAddress:e=>h(`/api/shop-portal/delivery-locations/${e}/`,{method:"DELETE"}),passwordResetRequest:e=>c("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:e})}),passwordResetConfirm:(e,t,n)=>c("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:e,token:t,new_password:n})}),brands:()=>h("/api/products/brands/"),myOrders:()=>h("/api/shop-portal/orders/").then(e=>e.results),myOrder:e=>h(`/api/shop-portal/orders/${e}/`),cancelOrder:e=>h(`/api/shop-portal/orders/${e}/cancel/`,{method:"POST"}),myReturns:e=>h(`/api/shop-portal/returns/${e?`?order=${encodeURIComponent(e)}`:""}`).then(t=>t.results),createReturn:e=>h("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(e)}),withdrawReturn:e=>h(`/api/shop-portal/returns/${e}/cancel/`,{method:"POST"}),uploadReturnPhoto:(e,t)=>{let n=new FormData;return n.append("claim_item",e),n.append("file",t),n.append("media_type",t.type.startsWith("video/")?"video":"image"),h("/api/shop-portal/return-media/",{method:"POST",body:n})}};function S(e){if(typeof e=="string")return e.startsWith("/media/")?V(e):e;if(Array.isArray(e))return e.map(S);if(e&&typeof e=="object"){let t={};for(let[n,r]of Object.entries(e))t[n]=n==="captions"&&r&&typeof r=="object"&&!Array.isArray(r)?Object.fromEntries(Object.entries(r).map(([a,l])=>[S(a),l])):S(r);return t}return e}var Ce=typeof window>"u"&&U!=="",mt=Ce?U:"",pt=j,b=()=>({baseUrl:pt(),audience:null});function m(e,t){let n=t?`?process=${encodeURIComponent(t)}`:"";return`/api/v1${e}${n}`}var dt=100,Pe=50;function Oe(e,t,n){let r=new URLSearchParams;for(let[a,l]of Object.entries(t))l!=null&&l!==""&&r.set(a,String(l));return r.set("pageSize",String(dt)),n&&r.set("cursor",n),`/api/v1${e}?${r.toString()}`}function gt(e,t){return Oe("/wheels",{process:e},t)}function ht(e,t,n){return Oe("/products",{kind:e.join(","),make:t?.make,model:t?.model,year:t?.year,modification:t?.modification},n)}function yt(e){if(!e)return null;try{return new URL(e,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function we(e,t,n=()=>!1){let r=[],a=null;try{for(let l=0;l<Pe;l++){let d=await c(await t(a),await p());if(r.push(...d.results),a=yt(d.next),!a)break}a&&console.warn(`[${e}] stopped at ${Pe} pages (${r.length} rows); catalog may be truncated`)}catch(l){if(n(l))throw l;console.warn(`[${e}] product API unavailable, returning []`,l)}return r}var ft=e=>e instanceof f&&e.status===400;function St(e){return e.flatMap(t=>t.kind==="alloy-wheel"?M([t]):[t])}async function ve(){return(await Pt()).host}async function Pt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js"),t=await e(),n=l=>l?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,r=n(t.get(ee)??t.get("x-forwarded-host")??t.get("host")),a=n(t.get("host"));return{host:r,matchesRequestHost:r!==null&&r===a}}catch{return{host:null,matchesRequestHost:!1}}}async function wt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return Z((await e()).get(B))}catch{return null}}async function bt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(Y)||null}catch{return null}}async function At(){let e=await bt();if(e)return`site=${encodeURIComponent(e)}`;let t=await ve();return t?`host=${encodeURIComponent(t)}`:""}async function y(e){if(typeof window<"u"){let t=$();return t?q(e,`site=${encodeURIComponent(t)}`):e}return q(e,await At())}function q(e,t){return t?`${e}${e.includes("?")?"&":"?"}${t}`:e}var Rt="preview";async function _t(){if(typeof window<"u")return null;try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get(te)}catch{return null}}async function kt(){try{let{headers:e}=await import("./headers-UYHEZDAT.js");return(await e()).get("user-agent")}catch{return null}}async function J(e,t){let n=await _t();if(n===null)return[await y(e),await p(t)];let r=q(await y(e),`${Rt}=${encodeURIComponent(n)}`),{next:a,cache:l,...d}=t??{},s=await p({...d,cache:"no-store"}),i=await kt();return i&&(s.headers={...s.headers,"user-agent":i}),[r,s]}async function xt(e){if(!Ce)return;let[t,n]=await Promise.all([ve(),wt()]),r=Q(t,n,e);return Object.keys(r).length>0?r:void 0}async function p(e){let t=await xt(X(e)),n={baseUrl:mt,...e};return t&&(n.headers={...t,...e?.headers}),n}var _=typeof window>"u";function k(e,t){let n=new URLSearchParams;for(let[a,l]of Object.entries(t))l!==void 0&&l!==""&&n.set(a,String(l));let r=n.toString();return`/api/v1/fitment${e}${r?`?${r}`:""}`}var on={listMakes:async e=>{if(_){let{fitmentData:n}=await import("./fitment-data-DHKRLKNI.js");return n.makes(e)}return(await c(k("/makes",{region:e}),b())).results},listModels:async(e,t)=>{if(_){let{fitmentData:r}=await import("./fitment-data-DHKRLKNI.js");return r.models(e,t)}return(await c(k("/models",{make:e,region:t}),b())).results},listYears:async(e,t,n)=>{if(_){let{fitmentData:a}=await import("./fitment-data-DHKRLKNI.js");return a.years(e,t,n)}return(await c(k("/years",{make:e,model:t,region:n}),b())).results},listModifications:async(e,t,n,r)=>{if(_){let{fitmentData:l}=await import("./fitment-data-DHKRLKNI.js");return l.modifications(e,t,n,r)}return(await c(k("/modifications",{make:e,model:t,year:n,region:r}),b())).results},getStockFitment:async(e,t,n,r,a)=>{if(_){let{fitmentData:l}=await import("./fitment-data-DHKRLKNI.js");return l.stockFitment(e,t,n,r,a)}return c(k("/stock-fitment",{make:e,model:t,year:n,modification:r,region:a}),b())}},an={listWheels:async e=>{let t=await we("products.listWheels",async n=>await y(gt(e,n)));return M(S(t))},listCatalog:async(e,t)=>{if(e.length===0)throw new Error("products.listCatalog() needs at least one kind. An empty list would omit `kind`, which the contract reads as `alloy-wheel` \u2014 so the call would silently return the wheel catalog instead of nothing.");let n=await we("products.listCatalog",async r=>await y(ht(e,t,r)),ft);return St(S(n))},getWheel:async e=>A(S(await c(await y(m(`/wheels/${e}`)),await p()))),getTyre:async e=>S(await c(await y(m(`/tyres/${e}`)),await p())),listBundles:async()=>{try{return await c(await y(m("/bundles")),await p())}catch{return[]}},getBundle:async e=>c(await y(m(`/bundles/${e}`)),await p()),listGalleryBuilds:async(e={})=>{let{process:t=null,wheelSlug:n=null}=e;if(typeof window>"u"){let{listGalleryBuilds:r}=await import("./gallery-builds-data-TD3QJK7L.js");return S(r(t,n))}try{let r=new URLSearchParams;t&&r.set("process",t),n&&r.set("wheelSlug",n);let a=r.toString(),l=await c(`/api/v1/gallery-builds${a?`?${a}`:""}`,b());return S(l.results)}catch(r){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",r),[]}},getSite:async()=>c(await y(m("/site")),await p()),getSiteBySlug:async e=>c(`${m("/site")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await p():void 0),listPages:async()=>S(await c(await y(m("/pages")),await p())),listPopups:async()=>c(await y(m("/popups")),await p()),listProductTemplates:async()=>{try{return await c(await y(m("/product-templates")),await p())}catch(e){return console.warn("[products.listProductTemplates] unavailable, returning []",e),[]}},listDynamicPages:async e=>{let t=e?`?recordType=${encodeURIComponent(e)}`:"";try{return await c(await y(`${m("/dynamic-pages")}${t}`),await p())}catch(n){if(n instanceof f&&n.status===404)return[];throw n}},getRecord:async(e,t)=>{try{return await c(await y(m(`/records/${encodeURIComponent(e)}/${encodeURIComponent(t)}`)),await p())}catch(n){if(n instanceof f&&n.status===404)return null;throw n}},listRecordKeys:async e=>{try{let t=await c(await y(m(`/records/${encodeURIComponent(e)}`)),await p({cache:"no-store"}));return Array.isArray(t?.keys)?t.keys.filter(n=>typeof n=="string"&&n!==""):[]}catch(t){if(t instanceof f&&t.status===404)return[];throw t}},listProductTypeChoices:async()=>{try{return await c(await y(m("/product-type-choices")),await p())}catch(e){return console.warn("[products.listProductTypeChoices] unavailable, returning []",e),[]}},listFieldUsage:async()=>{try{return await c(await y(m("/field-usage")),await p())}catch(e){return console.warn("[products.listFieldUsage] unavailable, returning []",e),[]}},getPage:async(e,t={})=>{let n=t.record?`?record=${encodeURIComponent(t.record)}`:"",[r,a]=await J(m(`/pages/${e}`)+n,t.revalidate!==void 0?{next:{revalidate:t.revalidate}}:void 0);return S(await c(r,a))},listBlogPosts:async(e={})=>{let t=e.category?`?category=${encodeURIComponent(e.category)}`:"";try{return(await c(m("/blog-posts")+t,await p())).map(r=>({...r,coverImage:C(r.coverImage)??""}))}catch(n){return console.warn("[products.listBlogPosts] blog API unavailable, returning []",n),[]}},getBlogPost:async e=>{let t=await c(m(`/blog-posts/${e}`),await p());return{...t,coverImage:C(t.coverImage)??""}},createOrder:async e=>c(m("/orders"),await p({method:"POST",body:JSON.stringify(e)})),createOrderAuthed:async e=>h(m("/orders"),await p({method:"POST",body:JSON.stringify(e)})),lookupOrder:async e=>c(m("/orders/lookup"),await p({method:"POST",body:JSON.stringify(e)})),createPaymentIntent:async e=>c(m("/payments/intent"),await p({method:"POST",body:JSON.stringify(e)})),createPaypalOrder:async e=>c(m("/payments/paypal/order"),await p({method:"POST",body:JSON.stringify(e)})),capturePaypalOrder:async e=>c(m("/payments/paypal/capture"),await p({method:"POST",body:JSON.stringify(e)})),createAfterpayCheckout:async e=>c(m("/payments/afterpay/checkout"),await p({method:"POST",body:JSON.stringify(e)})),captureAfterpayPayment:async e=>c(m("/payments/afterpay/capture"),await p({method:"POST",body:JSON.stringify(e)})),chargeSquare:async e=>c(m("/payments/square/charge"),await p({method:"POST",body:JSON.stringify(e)})),createGocardlessBillingRequest:async e=>c(m("/payments/gocardless/billing-request"),await p({method:"POST",body:JSON.stringify(e)})),completeGocardlessPayment:async e=>c(m("/payments/gocardless/complete"),await p({method:"POST",body:JSON.stringify(e)})),createZipCheckout:async e=>c(m("/payments/zip/checkout"),await p({method:"POST",body:JSON.stringify(e)})),captureZipPayment:async e=>c(m("/payments/zip/capture"),await p({method:"POST",body:JSON.stringify(e)})),createKlarnaCheckout:async e=>c(m("/payments/klarna/checkout"),await p({method:"POST",body:JSON.stringify(e)})),captureKlarnaPayment:async e=>c(m("/payments/klarna/capture"),await p({method:"POST",body:JSON.stringify(e)})),createStockAlert:async e=>c(m("/stock-alerts"),await p({method:"POST",body:JSON.stringify(e)})),createPreOrderIntent:async e=>c(m("/pre-order-intents"),await p({method:"POST",body:JSON.stringify(e)})),createNewsletterSubscription:async e=>c(m("/newsletter-subscriptions"),await p({method:"POST",body:JSON.stringify(e)})),unsubscribeNewsletter:async e=>c(m("/newsletter-unsubscribe"),await p({method:"POST",body:JSON.stringify(e)})),captureCart:async e=>c(m("/carts"),await p({method:"POST",body:JSON.stringify(e)})),restoreCart:async e=>c(m("/carts/restore"),await p({method:"POST",body:JSON.stringify(e)})),unsubscribeCartReminders:async e=>c(m("/carts/unsubscribe"),await p({method:"POST",body:JSON.stringify(e)})),listReviews:async(e={})=>{let t=new URLSearchParams;e.limit&&t.set("limit",String(e.limit)),e.designCode&&t.set("designCode",e.designCode);let n=m("/reviews"),r=t.toString();try{return await c(await y(r?`${n}?${r}`:n),await p())}catch(a){return console.warn("[products.listReviews] product API unavailable, returning []",a),[]}},submitReview:async e=>c(m("/reviews"),await p({method:"POST",body:JSON.stringify(e)})),getForm:async e=>c(m(`/forms/${encodeURIComponent(e)}`),await p()),submitForm:async(e,t)=>c(m(`/forms/${encodeURIComponent(e)}/submissions`),await p({method:"POST",body:JSON.stringify(t)})),listShippingMethods:async()=>{try{return await c(m("/shipping-methods"),await p())}catch(e){return console.warn("[products.listShippingMethods] product API unavailable, returning []",e),[]}},listCountrySubdivisions:async e=>{try{return await c(m(`/countries/${encodeURIComponent(e)}/subdivisions`),await p())}catch(t){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",t),[]}},quoteCart:async e=>{let t=m("/cart/quote"),n=await p({method:"POST",body:JSON.stringify(e)});return e.couponCode?(await fe(t,n)).data:c(t,n)},validateCoupon:async e=>{let{data:t,asShopper:n}=await fe(m("/coupons/validate"),await p({method:"POST",body:JSON.stringify(e)}));return{...t,askedAsShopper:n}},getHeaderSettings:async()=>{let e=Re({method:"GET"}),t=await c(...await J(m("/header-settings"),{signal:e})),n=C(t.logoUrl),r=null,a=null;if(n&&D(n)){let l=await de(n,e);l&&(r=l.reversed,a=l.inkIsDark)}return{...t,logoUrl:n,logoReversed:r,logoInkIsDark:a}},getThemeSettings:async()=>c(...await J(m("/theme-settings"))),getChatSettings:async()=>c(await y(m("/chat-settings")),await p())},cn={listServices:async()=>{try{return await c(m("/bookings/services"),await p())}catch(e){return console.warn("[bookings.listServices] API unavailable, returning []",e),{results:[],currency:"USD"}}},getAvailability:async(e,t)=>c(m(`/bookings/availability?service=${encodeURIComponent(e)}&date=${t}`),await p()),create:async e=>c(m("/bookings"),await p({method:"POST",body:JSON.stringify(e)})),get:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}`),await p()),cancel:async e=>c(m(`/bookings/manage/${encodeURIComponent(e)}/cancel`),await p({method:"POST"})),createPaymentIntent:async e=>c(m("/bookings/payments/intent"),await p({method:"POST",body:JSON.stringify({manageToken:e})}))},G=class extends Error{constructor(n,r){super(`Slug "${n}" exists on ${r} websites; a site is required to pick one.`);this.slug=n;this.count=r;this.name="AmbiguousPageSlugError"}},I=(e,t,n)=>{let r=new URLSearchParams({...t?{site:t}:{},...n?{draft:"1"}:{}}).toString();return`/api/storefront/${e}/${r?`?${r}`:""}`},x=e=>`/api/storefront/sites/${encodeURIComponent(e)}/`,Tt=e=>`${x(e)}currencies/`,Ct="/api/storefront/media/ingest/",K=class extends Error{constructor(){super("This editor is not connected to a website, so an upload has nowhere to go. Open the page from the website the file should belong to, then try again."),this.name="MediaUploadDestinationError"}};function Ot(){let e=ge();if(!e)throw new K;return`${Ct}?${new URLSearchParams({site:e})}`}var vt="X-Puck-Media-Manifest",be=z.contentHash,F={"X-Media-Manifest":be,[vt]:be},ln=Ee({});function Ee(e){return(t,n={})=>{let r=at(),a=e.headers||r?{...r?{"Accept-Language":r}:{},...e.headers,...n.headers}:void 0;return c(t,{...n,...e.baseUrl!==void 0?{baseUrl:e.baseUrl}:{},...a?{headers:a}:{},audience:e.audience??it()})}}function Et(e={}){let t=Ee(e),n=e.siteDrafts===!0,r=s=>I("header-settings",s,n),a=s=>I("theme-settings",s,n),l=s=>I("chat-settings",s,n),d=s=>I("social-settings",s,n);return{findPageBySlug:async(s,i,o)=>{let u=new URLSearchParams({slug:s});o&&u.set("site",o);let g=await t(`/api/storefront/pages/?${u.toString()}`,{token:i}),P=Array.isArray(g)?g:g.results??[];if(!o&&P.length>1)throw new G(s,P.length);return P[0]??null},getPageById:(s,i)=>t(`/api/storefront/pages/${s}/`,{token:i}),saveLayout:(s,i,o,u,g)=>t(`/api/storefront/pages/${s}/`,{method:"PATCH",body:JSON.stringify({layout:i,expected_updated_at:u,...g?{client_id:g}:{}}),token:o}),duplicatePage:(s,i,o)=>t(`/api/storefront/pages/${s}/duplicate/`,{method:"POST",body:JSON.stringify({title:i.title,slug:i.slug}),token:o}),geocode:(s,i,o)=>t(`/api/storefront/geocode/?${new URLSearchParams(o?{q:s,country:o}:{q:s})}`,{token:i}),listBlockSources:s=>t("/api/storefront/block-sources/",{token:s}),listRecordTypes:s=>t("/api/storefront/record-types/",{token:s}),createPagePreviewLink:(s,i)=>t(`/api/storefront/pages/${s}/preview-link/`,{method:"POST",token:i}),claimPageEditLock:(s,i,o,u=!1)=>t(`/api/storefront/pages/${s}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:o,takeover:u}),token:i}),releasePageEditLock:(s,i)=>t(`/api/storefront/pages/${s}/edit-lock/`,{method:"DELETE",token:i}),createTemplate:(s,i,o)=>t("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:s,layout:i}),headers:F,token:o}),getTemplate:(s,i)=>t(`/api/storefront/page-templates/${s}/`,{token:i}),saveTemplateLayout:(s,i,o)=>t(`/api/storefront/page-templates/${s}/`,{method:"PATCH",body:JSON.stringify({layout:i}),headers:F,token:o}),listTemplatePages:async(s,i)=>{let o=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(s)}`,{token:i});return Array.isArray(o)?o:o.results??[]},findTemplatePageBySlug:async(s,i,o)=>{let u=await t(`/api/storefront/template-pages/?template=${encodeURIComponent(s)}&slug=${encodeURIComponent(i)}`,{token:o});return(Array.isArray(u)?u:u.results??[])[0]??null},createTemplatePage:(s,i,o)=>t("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:s,...i}),headers:F,token:o}),saveTemplatePageLayout:(s,i,o)=>t(`/api/storefront/template-pages/${s}/`,{method:"PATCH",body:JSON.stringify({layout:i}),headers:F,token:o}),deleteTemplatePage:(s,i,o)=>t(`/api/storefront/template-pages/${s}/`,{method:"DELETE",token:i,...o?.keepalive?{keepalive:!0}:{}}),listPages:async(s,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("site",i);let u=await t(`/api/storefront/pages/?${o.toString()}`,{token:s});return Array.isArray(u)?u:u.results??[]},createPage:(s,i,o,u)=>t("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:s,slug:i,layout:o}),token:u}),deletePage:(s,i)=>t(`/api/storefront/pages/${s}/`,{method:"DELETE",token:i}),getHeaderSettings:(s,i)=>t(r(i),{token:s}),listMenus:async(s,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("site",i);let u=await t(`/api/storefront/menus/?${o}`,{token:s});return Array.isArray(u)?u:u.results??[]},listBlogPosts:async(s,i={})=>{let o=new URLSearchParams({no_page:"true"});i.visibleOnly&&o.set("is_visible","true"),i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/blog-posts/?${o.toString()}`,{token:s});return Array.isArray(u)?u:u.results??[]},listFieldUsage:async(s,i)=>{let o=await t(`/api/storefront/field-usage/?site=${encodeURIComponent(i)}`,{token:s});return Array.isArray(o?.entries)?o.entries:[]},listCategories:async(s,i={})=>{let o=new URLSearchParams({no_page:"true"});i.visibleOnly&&o.set("is_visible","true"),i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/categories/?${o.toString()}`,{token:s});return[...Array.isArray(u)?u:u.results??[]].sort((P,T)=>P.sort_order-T.sort_order||P.name.localeCompare(T.name))},listForms:async(s,i={})=>{let o=new URLSearchParams({no_page:"true"});i.siteId&&o.set("site",i.siteId);let u=await t(`/api/storefront/forms/?${o.toString()}`,{token:s});return[...Array.isArray(u)?u:u.results??[]].sort((P,T)=>P.title.localeCompare(T.title))},listWheelSummaries:async(s,i={})=>{let o=new URLSearchParams;i.siteId&&o.set("site",i.siteId);let u=o.toString(),g=await t(`/api/storefront/wheel-curations/summaries/${u?`?${u}`:""}`,{token:s});return S(g)},listProducts:async(s,i={})=>{let o=new URLSearchParams;i.kinds?.length&&o.set("kind",i.kinds.join(",")),i.siteId&&o.set("site",i.siteId);let u=o.toString(),g=await t(`/api/storefront/products/${u?`?${u}`:""}`,{token:s});return S(g)},getWheelDetail:async(s,i,o={})=>{let u=new URLSearchParams({slug:i});return o.siteId&&u.set("site",o.siteId),A(S(await t(`/api/storefront/wheel-curations/detail/?${u.toString()}`,{token:s})))},updateHeaderSettings:(s,i,o)=>t(r(o),{method:"PATCH",body:JSON.stringify(s),token:i}),getSite:(s,i)=>t(x(s),{token:i}),listSites:async s=>{let i=await t("/api/storefront/sites/?no_page=true",{token:s});return Array.isArray(i)?i:i.results??[]},listSiteCurrencies:async(s,i)=>{let o=await t(Tt(s),{token:i});return Array.isArray(o)?o:[]},publishSite:(s,i)=>t(`${x(s)}publish/`,{method:"POST",token:i}),getSiteLiveState:(s,i)=>t(`${x(s)}live-state/`,{token:i}),updateSite:(s,i,o)=>t(x(s),{method:"PATCH",body:JSON.stringify(i),token:o}),getThemeSettings:(s,i)=>t(a(i),{token:s}),updateThemeSettings:(s,i,o)=>t(a(o),{method:"PATCH",body:JSON.stringify(s),token:i}),getChatSettings:(s,i)=>t(l(i),{token:s}),updateChatSettings:(s,i,o)=>t(l(o),{method:"PATCH",body:JSON.stringify(s),token:i}),getSocialSettings:(s,i)=>t(d(i),{token:s}),updateSocialSettings:(s,i,o)=>t(d(o),{method:"PATCH",body:JSON.stringify(s),token:i}),uploadHeaderLogo:(s,i,o)=>{let u=new FormData;return u.append("logo",s),t(r(o),{method:"PATCH",body:u,token:i})},clearHeaderLogo:(s,i)=>t(r(i),{method:"PATCH",body:JSON.stringify({logo:null}),token:s}),setHeaderLogoFromAsset:(s,i,o)=>t(r(o),{method:"PATCH",body:JSON.stringify({logo_asset_id:s}),token:i}),uploadMedia:async(s,i)=>{let o=new FormData;return o.append("file",s),t(Ot(),{method:"POST",body:o,token:i})},listMedia:async(s,i)=>{let o=new URLSearchParams({no_page:"true"});i&&o.set("kind",i);let u=await t(`/api/storefront/media-assets/?${o.toString()}`,{token:s});return Array.isArray(u)?u:u.results??[]}}}var un=Et({siteDrafts:!0});export{U as a,Q as b,X as c,w as d,qe as e,D as f,ge as g,Xe as h,f as i,W as j,H as k,Yt as l,en as m,c as n,ut as o,ve as p,Pt as q,wt as r,bt as s,_t as t,on as u,an as v,cn as w,G as x,ln as y,un as z};