efficient-web-builder 0.0.0 → 0.7.1

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.
@@ -0,0 +1,230 @@
1
+ import{a as Ct,b as ns,c as os,d as is,g as ss,i as rs,j as as,l as ls}from"./chunk-NTGUUW2T.js";import{$b as hn,$h as Xi,A as No,Ac as yi,B as _o,Bc as vt,C as Ro,Cf as Ai,D as on,Df as Hi,Dh as $i,E as Te,Ea as Wo,Eh as gn,Ff as Fi,G as Ne,Gf as Li,Gg as Wi,Gh as Vi,Gi as Yi,H as Io,Hg as Gi,I as Ao,Jf as Oi,K as Ho,L as Fo,La as Oe,M as Lo,Ma as M,Ng as De,P as Oo,Qg as ue,R as sn,Rg as Ui,Rh as Ki,S as rn,T as an,U as yt,W as ln,X as cn,Y as Bo,Yb as bi,cj as bn,ef as wi,fa as zo,fj as qi,ga as Mo,gj as ji,h as So,hi as et,ii as tt,jb as fi,jf as mn,jh as ne,k as nn,l as To,mf as vi,mi as xt,mj as Zi,mk as yn,og as Me,oi as Et,p as Le,pj as Ji,pk as es,qf as ze,qk as ts,rg as Bi,ri as We,s as bt,sf as Tt,sg as zi,tg as Mi,ti as kt,v as xo,vb as gi,w as Eo,wg as Di,wj as Qi,x as ko,xh as be,y as Co,z as Po}from"./chunk-QVG6K5WY.js";import{$ as Qo,$c as Pi,A as Go,Aa as pi,Ac as Si,B as Uo,Bc as Ti,C as $o,D as Vo,Da as hi,Ic as xi,Ka as mi,La as Ee,Lc as Ei,Ma as pn,Qc as ki,R as Ko,Rc as Ci,S as Xo,Sc as fn,T as Yo,U as qo,Wa as je,X as jo,Y as dn,Z as Zo,_ as Jo,ab as Ze,ba as ei,ca as ti,cd as Ni,d as go,dd as _i,e as bo,ed as Ri,f as yo,fa as ni,fc as Je,g as wo,ga as oi,gc as Be,h as de,i as Qt,ia as ii,j as en,ma as si,n as Fe,nd as Ii,o as tn,p as vo,ra as un,rd as V,sa as ri,ua as ai,wa as li,xa as ci,xc as St,ya as di,yc as Qe,z as wt,za as ui}from"./chunk-A2QNXDQ6.js";import{E as Do,T as J,l as fo,o as Jt}from"./chunk-PAXN7G3Y.js";import{b as xe}from"./chunk-UBYBQ3KR.js";import{InspectorHead as yr,InspectorIconButton as ds}from"efficient-easel/chrome";import{jsx as cs,jsxs as br}from"react/jsx-runtime";function Pt({side:e}){return br("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.7,children:[cs("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),cs("path",{d:e==="left"?"M9 4v16":"M15 4v16"})]})}import{Fragment as ps,jsx as ye,jsxs as hs}from"react/jsx-runtime";function Nt({icon:e,title:t,context:n,actions:o,side:s="left",onHide:i}){return ye(yr,{icon:e,name:t,kind:n,actions:o||i?hs(ps,{children:[o,i?ye(_t,{side:s,onHide:i,divider:!!o}):null]}):void 0})}function _t({side:e,onHide:t,divider:n=!1}){return hs(ps,{children:[n?ye("span",{className:"sf-head-divider","aria-hidden":"true"}):null,ye(ds,{label:`Hide the ${e} panel`,title:"Hide panel",onClick:t,children:ye(Pt,{side:e})})]})}function Pd({side:e,onShow:t}){return ye("div",{className:`es-sidepanel es-sidepanel--${e} sf-panel-strip`,children:ye(ds,{label:`Show the ${e} panel`,title:"Show panel",onClick:t,children:ye(Pt,{side:e})})})}function us({label:e,onClick:t,description:n}){return ye("button",{type:"button",className:"es-btn-ghost sf-head-textbtn",onClick:t,title:n,children:e})}var Rt="Flex",wr={FooterMenu:"MenuBlock",FooterEmailSignup:"EmailFormBlock",FooterSocial:"SocialLogosBlock"},vr=e=>{let{id:t,...n}=e;return n},ms=e=>typeof e=="string"?e:"";function fs(e,t){let n=e.props??{},o=wr[e.type];if(o)return[t(o,vr(n))];switch(e.type){case"FooterLogo":{let s=t("LogoBlock",n.reverse?{reverse:n.reverse}:{}),i=ms(n.tagline).trim();return i?[s,t("Text",{text:i,tone:"dim",align:n.align==="center"?"center":"left"})]:[s]}case"FooterText":return[t("Text",{text:ms(n.text),tone:typeof n.tone=="string"?n.tone:"default"})];case"FooterDivider":return[t("Divider")];case"FooterGroup":{let s=Array.isArray(n.blocks)?n.blocks:[];return[t(Rt,{direction:n.direction==="horizontal"?"row":"column",content:s.flatMap(i=>fs(i,t))})]}default:return[]}}function gs(e,t,n){let s=(e&&Array.isArray(e.props?.blocks)?e.props.blocks:[]).flatMap(h=>{let u=fs(h,t);return u.length<=1?u:[t(Rt,{direction:"column",content:u})]}),i=t(Rt,{direction:"row",wrap:!0,share:"equal",content:s}),c=t(Rt,{direction:"column",content:[t("LegalLineBlock")]});return xt(tt,n,[i,c])}var Sr=".sf-editor #preview-frame",Ge=()=>document.querySelector(Sr);function Fd(e){Ii()||requestAnimationFrame(()=>{Ge()?.contentDocument?.querySelector(`[data-puck-component="${CSS.escape(e)}"]`)?.scrollIntoView({behavior:"smooth",block:"start"})})}function Ld(e,t){let n=Ge()?.contentWindow;if(!n)return;let o={id:e,index:t};n.dispatchEvent(new CustomEvent(ts,{detail:o}))}function Od(){requestAnimationFrame(()=>{Ge()?.contentWindow?.scrollTo({top:0,behavior:"smooth"})})}function bs(e,{passes:t=[150,400],onPinned:n}={}){let o=0,s=!1,i=[],c=()=>{let u=Ge(),r=u?.contentWindow,p=u?.contentDocument;if(!r||!p)return!1;let w=e(r,p);if(w==null)return!1;if(r.scrollTo({left:r.scrollX,top:w,behavior:"instant"}),!s){s=!0,n?.();for(let v of t)i.push(setTimeout(c,v))}return!0},h=()=>{!c()&&o++<150&&i.push(setTimeout(h,32))};return h(),()=>i.forEach(clearTimeout)}function Bd(e){return bs((t,n)=>{let o=n.querySelector(`[data-puck-component="${CSS.escape(e)}"]`);return o?t.scrollY+o.getBoundingClientRect().top:null})}function zd(e){return bs((t,n)=>{if(!n.querySelector("[data-puck-component]"))return null;let o=Math.max(n.documentElement.scrollHeight,n.body?.scrollHeight??0);return o<=n.documentElement.clientHeight?null:o},{passes:[150,400,800,1300,2e3],onPinned:e})}import{useEasel as Xn}from"efficient-easel/easel";import{useEffect as yl,useRef as Vs,useState as Yt}from"react";import{useState as ws}from"react";import{SettingsField as xr}from"efficient-easel/panel";import{jsx as nt,jsxs as wn}from"react/jsx-runtime";function Tr(e){return e===1?"1 color theme":`${e} color themes`}function ys({count:e,onCancel:t,onConfirm:n}){return nt("div",{className:"sf-cleardlg-veil",role:"dialog","aria-modal":"true","aria-labelledby":"sf-clear-colours-title",children:wn("div",{className:"sf-cleardlg",children:[nt("h2",{id:"sf-clear-colours-title",className:"sf-cleardlg-title",children:"Clear this site\u2019s colors?"}),wn("p",{className:"sf-cleardlg-body",children:["This site has ",Tr(e)," of its own. Clearing takes them away and puts back the four the shop supplies."]}),nt("p",{className:"sf-cleardlg-final",children:"This cannot be undone."}),wn("div",{className:"sf-cleardlg-btns",children:[nt("button",{type:"button",onClick:t,className:"sf-cleardlg-btn",children:"Cancel"}),nt("button",{type:"button",onClick:n,className:"sf-cleardlg-btn sf-cleardlg-btn--danger",children:"Clear colors"})]})]})})}import{Fragment as Nr,jsx as ke,jsxs as Ss}from"react/jsx-runtime";var Er=zi("the row's whole content is an action; the gutter names a subject and this row has none \u2014 the button's label is the name GG, 2026-09-23");function kr(){return ke("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:ke("path",{d:"M12 5v14M5 12h14"})})}var vs="Reset color",Cr={selected:0,themes:[]};function Pr(e){e(Cr)}function vn({value:e,onChange:t}){let n=e?.themes??[],o=n.length===0,s=wt(e),[i,c]=ws(!1),[h,u]=ws(null),r=(a,y)=>{t({...s,themes:s.themes.map((g,O)=>O===a?y:g)})},p=$o(s).accent,w=new Set(s.themes.map(a=>a.brandInk).filter(Boolean)),v=Go.filter(a=>!w.has(a)).map(a=>Uo(p,a)),b=[...s.themes,...v],S=a=>{if(a<s.themes.length)return t({...s,selected:a});let y=[...s.themes,b[a]];t({...s,themes:y,selected:y.length-1})},E=()=>{let a=[...s.themes,{...Vo(s.themes[s.selected])}];t({...s,themes:a,selected:a.length-1}),u(a.length-1)};return Ss(Nr,{children:[o?null:ke(xr,{label:vs,icon:Mi(Er),labelId:"sf-theme-reset",action:ke(M,{label:vs,what:"change",onClear:()=>c(!0)})}),i&&ke(ys,{count:n.length,onCancel:()=>c(!1),onConfirm:()=>{c(!1),Pr(t)}}),ke("div",{className:"sf-theme-list",role:"radiogroup","aria-label":"Theme",children:b.map((a,y)=>ke(Fi,{index:y,colors:a,selected:y===s.selected,open:h===y&&y<s.themes.length,editable:y<s.themes.length,onPick:()=>S(y),onEdit:()=>u(g=>g===y?null:y),onChangeColors:g=>r(y,g)},y))}),Ss("button",{type:"button",onClick:E,className:"sf-theme-add",children:[ke(kr,{}),"Add new theme"]})]})}import{SettingsField as ma}from"efficient-easel/panel";import{SquareIcon as fa}from"efficient-easel/icons";import{useEffect as Lt,useId as Ir,useRef as kn,useState as Cn}from"react";import{InspectorField as Ar}from"efficient-easel/fields";import{SettingsField as Rs,SettingsGroup as Hr,SettingsSegmented as xn}from"efficient-easel/panel";import{AlignCenterIcon as Fr,AlignLeftIcon as Is,AlignRightIcon as Lr,CaseIcon as Or,LetterSpacingIcon as Br,PaddingYIcon as zr,StylesIcon as Mr,TextColorIcon as Dr,TextLinesIcon as Wr,TextSizeIcon as Gr,TypeIcon as Ur,WeightIcon as $r,WidthIcon as Vr}from"efficient-easel/icons";import{useEasel as Kr}from"efficient-easel/easel";import{jsx as Sn}from"react/jsx-runtime";function Ts({children:e,weight:t}){return Sn("span",{"aria-hidden":"true",style:{fontSize:13,lineHeight:1,fontWeight:t,letterSpacing:"-0.01em",userSelect:"none"},children:e})}function ot({weight:e=400}){return Sn(Ts,{weight:e,children:"A"})}function It({letterCase:e="none"}){return Sn(Ts,{weight:600,children:e==="upper"?"AA":e==="lower"?"aa":"Aa"})}import{useState as _r}from"react";var Q="Not set";import{jsx as At,jsxs as xs}from"react/jsx-runtime";var Tn="__custom";function Es({value:e,label:t,id:n,onChange:o}){let s=e===null,i=!s&&nn.includes(e)?e:null,c=!s&&e!==""&&i===null?e:null,[h,u]=_r(!1),r=c!==null||h;return xs("div",{className:"sf-part-ink",children:[xs("select",{id:n,className:"sf-part-select",value:s?"":r?Tn:i??"",onChange:p=>{let w=p.target.value;if(w===Tn){u(!0),c===null&&o(null);return}u(!1),o(w===""?null:w)},children:[s&&At("option",{value:"",children:"Mixed"}),!s&&At("option",{value:"",children:Q}),nn.map(p=>At("option",{value:p,children:To[p]},p)),At("option",{value:Tn,children:"Custom\u2026"})]}),r&&Tt({value:c??"",onChange:p=>{u(!1),o(p)},label:t,caption:c===null?Q:void 0,ariaLabel:`${t} \u2014 custom`})]})}function Ht(e,t){let n=ko(e);return n?.control==="textList"?t.rowKey===(n.itemKey??"text")?Vi(n,t.index):null:Co(e)?.[t.rowKey]??null}function ks(e,t,n){let o=e.node.props,{key:s,row:i}=Le(e.propKey),c=i?_o(o,s,i,e.kind,t):Eo(o,s,e.kind,t);return c?(n(e.zone,e.index,{...e.node,props:c}),!0):!1}var Rr={CollectionCard:"product",FooterMenu:"menu",Gallery:"product",GalleryItem:"product",ProductGrid:"product",ProductHero:"product",SpecTable:"product",Events:"blog",FeaturedCover:"blog",LongRead:"blog",SubscribeBlogs:"blog"},Cs={product:"Synced from the product.",blog:"Synced from the blog post.",menu:"Synced from the site menu."},Ps="Open",Ns={product:{type:"storefront-editor:open-product",needsSlug:!0},blog:{type:"storefront-editor:open-post",needsSlug:!0},menu:{type:"storefront-editor:open-menus",needsSlug:!1}};function it(e){let n=e?.source?.slug;return typeof n=="string"&&n.length>0?n:void 0}function Ft(e){return Rr[e]??null}import{Fragment as Bt,jsx as m,jsxs as H}from"react/jsx-runtime";var Xr=[{id:"none",label:"Normal",icon:m(It,{letterCase:"none"})},{id:"upper",label:"Upper",icon:m(It,{letterCase:"upper"})},{id:"lower",label:"Lower",icon:m(It,{letterCase:"lower"})}],As=[{id:"400",label:"Regular",icon:m(ot,{weight:400})},{id:"500",label:"Medium",icon:m(ot,{weight:500})},{id:"600",label:"Semibold",icon:m(ot,{weight:600})},{id:"700",label:"Bold",icon:m(ot,{weight:700})}],Yr=Object.fromEntries(As.map(e=>[e.id,e.label])),qr=[{id:"left",label:"Left",icon:m(Is,{})},{id:"center",label:"Center",icon:m(Fr,{})},{id:"right",label:"Right",icon:m(Lr,{})}],jr={labelsPx:114.63,widestLabelPx:42.75},Zr={labelsPx:174.25,widestLabelPx:55.3},Jr={labelsPx:94.5,widestLabelPx:39.94},Hs=[{key:"font",label:"Font",group:"Typeface"},{key:"weight",label:"Weight",group:"Typeface"},{key:"size",label:"Size",group:"Size & spacing"},{key:"line",label:"Line spacing",group:"Size & spacing"},{key:"letter",label:"Letter spacing",group:"Size & spacing"},{key:"padding",label:"Padding",group:"Size & spacing"},{key:"width",label:"Width",group:"Size & spacing"},{key:"case",label:"Case",group:"Appearance"},{key:"align",label:"Alignment",group:"Appearance"},{key:"color",label:"Color",group:"Appearance"}],st={size:{...yt.size,suffix:" px"},line:{min:sn,max:rn,step:1,suffix:""},letter:{min:sn,max:rn,step:1,suffix:""},padding:{...yt.padding,suffix:" px"},width:{...yt.width,suffix:" px"}},En=e=>Object.hasOwn(st,e),Qr=[...new Set(Hs.map(e=>e.group))],ea={font:m(Ur,{}),weight:m($r,{}),size:m(Gr,{}),line:m(Wr,{}),letter:m(Br,{}),padding:m(zr,{}),width:m(Vr,{}),case:m(Or,{}),align:m(Is,{}),color:m(Dr,{})};function Ot(e){return e.kind==="role"?en[e.role]:e.kind==="custom"?"Custom":null}var ta=e=>e.kind==="role"?`role:${e.role}`:e.kind;function na(e){let t=e.role;return t&&Qt.includes(t)?{kind:"role",role:t}:null}function oa(e,t){if(!e)return{kind:"unread"};let{faceRole:n,base:o}=e;if(t[n]===o.fontKey)return{kind:"role",role:n};let s=Object.keys(t).filter(i=>t[i]===o.fontKey);return s.length===1?{kind:"role",role:s[0]}:{kind:"custom"}}function Pn(e,t,n,o){return na(ln(e,t))??oa(n,o)}function Fs(e,t,n,o){return Ot(Pn(e,t,n,o))}function Nn(e,t){if(!e.length)return null;let n=t(e[0]);return e.every(o=>t(o)===n)?n:null}function ia(e){return Object.values(e).filter(t=>t!==void 0).length}function sa(e,t){let n=e.style[t];return t==="line"||t==="letter"?n??0:t==="color"?n??"":n!==void 0?n:t==="size"?Math.round(e.base.sizePx):t==="padding"?e.base.paddingPx:t==="width"?e.base.widthPx:t==="font"?e.base.fontKey:e.base[t]}function ra(e){return e===0?"style":e>0?`+${e}`:String(e)}function Ls({face:e,base:t,onPick:n}){let[o,s]=Cn(!1),i=kn(null),c=kn(null),h=Ir();Lt(()=>{if(!o)return;let p=w=>{i.current&&!i.current.contains(w.target)&&s(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]);let u=e.kind==="role"?e.role:null,r=p=>{n(p),s(!1),c.current?.focus()};return H("div",{className:"sf-part-style-pick",ref:i,children:[H("button",{ref:c,type:"button",className:"sf-part-style-trigger","aria-expanded":o,"aria-controls":h,"aria-label":`Follows ${Ot(e)??"no style"} \u2014 change`,onClick:()=>s(p=>!p),onKeyDown:p=>{p.key==="Escape"&&o&&(p.preventDefault(),s(!1))},children:[m("span",{className:"sf-part-style-name",style:{fontFamily:t?.fontKey?`var(${de(t.fontKey)?.cssVar})`:void 0,fontWeight:t?.weight},children:Ot(e)}),m("span",{className:"sf-part-style-sign","aria-hidden":"true"})]}),o&&H("div",{className:"sf-multi-menu sf-part-style-menu",id:h,role:"listbox",onKeyDown:p=>{p.key==="Escape"&&(p.preventDefault(),s(!1),c.current?.focus())},children:[H("button",{type:"button",role:"option","aria-selected":u===null,className:`sf-part-style-option${u===null?" is-on":""}`,onClick:()=>r(null),children:[m("span",{className:"sf-part-style-option-name",children:"No style"}),m("span",{className:"sf-note",children:"Section\u2019s own"})]}),Qt.map(p=>m("button",{type:"button",role:"option","aria-selected":u===p,className:`sf-part-style-option${u===p?" is-on":""}`,onClick:()=>r(p),children:m("span",{className:"sf-part-style-option-name",style:{fontFamily:`var(--font-role-${p})`},children:en[p]})},p))]})]})}function aa({parts:e,onEditStyle:t,onClearAll:n,onFollowStyle:o,kindLabel:s}){let c=Nn(e,w=>ta(w.face))?e[0].face:null,h=c?Ot(c):null,u=c&&c.kind!=="unread"?e[0].base:null,r=e.reduce((w,v)=>w+ia(v.style),0),p=u?de(u.fontKey)?.label:void 0;return H("div",{className:`sf-part-style${r?" has-overrides":""}`,children:[m("div",{className:"sf-part-style-caption",children:"Style"}),e.length>1&&H("div",{className:"sf-part-style-count",children:[e.length," selected"]}),e.length===1&&s&&H("div",{className:"sf-part-style-count",children:[s," \xB7 every row"]}),h&&u?H(Bt,{children:[o&&c?m(Ls,{face:c,base:u,onPick:o}):m("div",{className:"sf-part-style-name",style:{fontFamily:p?`var(${de(u.fontKey)?.cssVar})`:void 0,fontWeight:u.weight},children:h}),m("div",{className:"sf-part-style-meta",children:[p,`${Math.round(u.sizePx)} px`,Yr[u.weight]].filter(Boolean).join(" \xB7 ")})]}):m("div",{className:"sf-part-style-name",children:"Mixed styles"}),H("div",{className:"sf-part-style-top",children:[h?r?H(Bt,{children:[H("span",{className:"sf-part-chip",children:[r," changed"]}),m("button",{type:"button",className:"sf-part-link",onClick:n,children:"Clear"})]}):m("span",{className:"sf-part-style-state",children:"This text follows the site style."}):m("span",{className:"sf-part-style-state",children:"Changes apply to all selected."}),m("span",{className:"sf-part-style-gap"}),h&&t&&m("button",{type:"button",className:"sf-part-link",onClick:t,children:"Edit"})]})]})}function la({sectionName:e,onBack:t,textEditor:n,styleRow:o,children:s}){return H("div",{className:"sf-part-panel",children:[H("button",{type:"button",className:"sf-part-back",onClick:t,children:[m(zt,{}),H("span",{children:["All of ",e]})]}),n,o,s]})}function zt(){return m("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:m("path",{d:"M15 5 8 12l7 7"})})}function Mt({source:e,slug:t}){let n=xe(),o=Ns[e],s=!o.needsSlug||!!t;return m("div",{className:"sf-note sf-note--source",children:H("p",{className:"sf-field-hint",children:[Cs[e],s?H(Bt,{children:[" ",m("button",{type:"button",className:"sf-source-open",onClick:()=>{o.type==="storefront-editor:open-menus"?n.send(o.type):t&&n.send(o.type,{slug:t})},children:Ps})]}):null]})})}var _s=4,ca=120;function da({region:e,sizePx:t,face:n,base:o,onFollowStyle:s,source:i,slug:c,onBack:h}){let u=e.follows;return H("div",{className:"sf-note",children:[m("p",{children:m("strong",{children:e.label})}),H("p",{children:["Its size follows Site styles \u25B8 ",u,t?` \u2014 ${Math.round(t)}px right now`:"","."]}),s?H(Bt,{children:[m(Rs,{label:"Style",icon:m(Mr,{}),children:m(Ls,{face:n,base:o,onPick:s})}),H("p",{className:"sf-field-hint",children:["Every ",e.label.toLowerCase()," in this section follows it. The face and the size change; the letter case is the section\u2019s own and stays as it is."]})]}):m("p",{className:"sf-field-hint",children:"Only the size follows a site style. This section sets its own font, weight and letter case."}),i?m(Mt,{source:i,slug:c}):null,H("button",{type:"button",className:"sf-part-back",onClick:h,children:[m(zt,{}),m("span",{children:"Back to the page"})]})]})}function ua({onBack:e}){return H("div",{className:"sf-note",children:[m("p",{children:m("strong",{children:"This part is no longer here."})}),m("p",{children:"The section it belonged to has been changed or removed."}),H("button",{type:"button",className:"sf-part-back",onClick:e,children:[m(zt,{}),m("span",{children:"Back to the page"})]})]})}function pa({onBack:e,partId:t,why:n}){return H("div",{className:"sf-note",children:[m("p",{children:m("strong",{children:"This part's settings did not open."})}),m("p",{children:"The words are still on your page and nothing has been lost. The editor could not work out which control belongs to them, which is a fault on our side. Go back and click the section to open its settings instead."}),m("p",{className:"sf-note-detail",children:H("code",{children:[t," \u2014 ",n]})}),H("button",{type:"button",className:"sf-part-back",onClick:e,children:[m(zt,{}),m("span",{children:"Back to the page"})]})]})}function _n({nodeId:e,propKey:t,onBack:n,onEditStyle:o}){let{getItemById:s,getSelectorForId:i,config:c}=Kr(f=>f),h=Oe(),{partStyle:u}=kt(),{fonts:r}=V(),[p,w]=Cn({}),v=kn(null),b=s(e),S=i(e),E=b?c.components[b.type]:void 0,{key:a,row:y}=Le(t),g=E?.fields?.[a],O=y?Ht(g,y):g,W=Ne(e,t),L=b?.props??{},fe=xo(O),R=Di(O),q=Ho(O),B=b?Ft(b.type):null,k=y?Po(L[a],y):L[a],z=!!y&&!(Array.isArray(L[a])&&y.index<L[a].length);Lt(()=>{v.current?.querySelector(".sf-copybox textarea, .sf-copybox input")?.focus()},[W]);let[T,ee]=Cn(0);Lt(()=>ee(0),[W]);let ae=!!b&&!z&&(!S||!O);Lt(()=>{if(!ae||T>=_s)return;let f=setTimeout(()=>ee(I=>I+1),ca);return()=>clearTimeout(f)},[ae,T]);let le=ae&&T<_s;if(!b||z)return m(ua,{onBack:n});let te=Yi(b.type),ge=te?So(te,t):null;if(te&&ge){let f=u?.partId===W?u:null,I=te[ge],U=I.writable===!0&&!!S,$=X=>{S&&h.replaceComponent(S.zone,S.index,{...b,props:cn(L,t,"role",X)})};return m(da,{region:I,sizePx:f?.base.sizePx??null,face:Pn(L,t,f,r),base:f?.base??null,onFollowStyle:U?$:void 0,source:B,slug:it(L),onBack:n})}if(!S||!O)return le?m("div",{className:"sf-note","aria-busy":"true"}):m(pa,{onBack:n,partId:W,why:S?"no field":"no selector"});let ve=f=>{h.replaceComponent(S.zone,S.index,{...b,props:f})},Ye=f=>{if(bt(f).hidden!==bt(k).hidden||!fe){let U=y?No(L,a,y,f):{...L,[a]:f};U&&ve(U);return}ks({node:b,propKey:t,kind:fe,zone:S.zone,index:S.index},bt(f).text,h.replaceComponent)},Se=k,l=Mo(b?.type,t),P=ln(L,l),D=u?.partId===W?u:null,_=[{partKey:l,face:Pn(L,l,D,r),sizeGroup:D?.sizeGroup??null,base:D?.base??ha,style:P}],j=Nn(_,f=>f.sizeGroup),Z=(f,I)=>{let U=L;for(let $ of _)U=cn(U,$.partKey,f,I);ve(U)},ie=f=>Z("role",f),se=()=>{let f=L;for(let I of _)f=Bo(f,I.partKey);ve(f)},K=f=>{let I=_[0].base;return f==="size"?Math.round(I.sizePx):f==="padding"?I.paddingPx:f==="width"?I.widthPx:0},ce=(f,I)=>{if(f==="line"||f==="letter")return Z(f,I);Z(f,I===K(f)?null:I)},Pe=(f,I)=>{let U=_.some(qe=>qe.style[f]!==void 0),$=Nn(_,qe=>sa(qe,f)),X=$===null,G=`sf-part-${e}-${t}-${f}`,He=En(f)?st[f]:null,mo=!He||!En(f)?void 0:X?"Mixed":f==="line"||f==="letter"?ra($):f==="width"&&$===an?"Full":void 0,gr=He&&En(f)?m(Ui,{value:X?K(f):$,min:He.min,max:He.max,step:He.step,suffix:He.suffix,ariaLabel:I,onChange:qe=>ce(f,qe),children:mo}):void 0;return m(Rs,{label:I,icon:ea[f],value:gr,hint:f==="size"&&j===null?"Fixed size \u2014 the site\u2019s Text setting doesn\u2019t resize this.":void 0,className:mo==="style"?"sf-part-field is-style-value":"sf-part-field",changed:U,htmlFor:f==="font"||f==="color"?G:void 0,action:U?m(M,{label:I,onClear:()=>Z(f,null)}):void 0,children:Zt(f,I,$,X,G)},f)},Zt=(f,I,U,$,X)=>{switch(f){case"font":return H("select",{id:X,className:"sf-part-select",value:$?"":String(U),onChange:G=>Z("font",G.target.value||null),children:[$&&m("option",{value:"",children:"Mixed"}),!$&&!de(String(U))&&m("option",{value:"",children:"Site style"}),go.map(G=>m("option",{value:G.key,children:G.label},G.key))]});case"weight":return m(xn,{options:As,value:$?"":String(U),onChange:G=>G&&Z("weight",Number(G)),ariaLabel:I,fit:Zr});case"size":case"line":case"letter":case"padding":case"width":return m(ue,{min:st[f].min,max:st[f].max,step:st[f].step,value:$?K(f):U,readout:!1,ariaLabel:I,notch:K(f),onChange:G=>ce(f,G)});case"case":return m(xn,{options:Xr,value:$?"":String(U),onChange:G=>G&&Z("case",G),ariaLabel:I,fit:jr});case"align":return m(xn,{options:qr,value:$?"":String(U),onChange:G=>G&&Z("align",G),ariaLabel:I,fit:Jr});case"color":return m(Es,{value:$?null:String(U),label:I,id:X,onChange:G=>Z("color",G)})}};return H(la,{sectionName:E?.label??b.type,onBack:n,textEditor:m("div",{ref:v,className:"sf-part-text",children:m(Ar,{field:O,name:t,value:Se,onChange:Ye,id:`sf-part-${e}-${t}`})}),styleRow:R||!q?void 0:m(aa,{parts:_,onEditStyle:o,onClearAll:se,onFollowStyle:ie,kindLabel:zo[l]}),children:[B&&m(Mt,{source:B,slug:it(L)}),!R&&q&&Qr.map(f=>{let I=Hs.filter(X=>X.group===f),U=I.filter(X=>_.some(G=>G.style[X.key]!==void 0)).length,$=`sf-part-g-${e}-${t}-${f.replace(/\W+/g,"-")}`;return H(Hr,{id:$,title:f,open:p[f]!==!0,onToggle:X=>w(G=>({...G,[f]:!X})),count:U,children:[f==="Size & spacing"&&H("p",{className:"sf-note",children:["Line and letter spacing are relative to the style. ",m("strong",{children:"0"})," matches it, and holds when the size changes."]}),I.map(X=>Pe(X.key,X.label))]},f)})]})}var ha={fontKey:"",sizePx:16,weight:400,lineRatio:1.4,letterEm:0,align:"left",case:"none",paddingPx:0,widthPx:an};import{jsx as Dt}from"react/jsx-runtime";var ga="Applies to panels, cards, inputs and buttons. Round things \u2014 color swatches, switches, status dots \u2014 stay round.",Rn="Corners",ba="Not set";function In({value:e,onChange:t,showHint:n=!0}){let o=e===null;return Dt(ma,{label:Rn,icon:Dt(fa,{}),value:o?ba:`${e}px`,changed:!o,action:o?null:Dt(M,{label:Rn,what:"change",onClear:()=>t(null)}),hint:n?ga:void 0,children:Dt(ue,{min:dn,max:Zo,step:1,value:e??dn,readout:!1,ariaLabel:Rn,onChange:t})})}import{SettingsField as ya}from"efficient-easel/panel";import{ShadowIcon as wa}from"efficient-easel/icons";import{jsx as rt,jsxs as Ta}from"react/jsx-runtime";var Os={none:"None",soft:"Soft",lifted:"Lifted"},va="Applies to cards \u2014 products, brands, journal entries and filter cells. Round things like swatches and status dots are never shadowed.",Sa={none:"none",soft:"0 1px 1px rgba(20, 20, 22, 0.10), 0 2px 4px -1px rgba(20, 20, 22, 0.14)",lifted:"0 1px 2px rgba(20, 20, 22, 0.10), 0 4px 7px -2px rgba(20, 20, 22, 0.30)"};function An({value:e,onChange:t,showHint:n=!0}){let o=e===null,s=e??ti;return rt(ya,{label:"Card shadow",icon:rt(wa,{}),value:o?Q:Os[e],changed:!o,action:o?void 0:rt(M,{label:"Card shadow",what:"change",onClear:()=>t(null)}),hint:n?va:void 0,children:rt("div",{className:"sf-rungs",children:ei.map(i=>Ta("button",{type:"button","aria-pressed":i===s,onClick:()=>t(i),className:`sf-rung sf-rung--inline${i===s?" is-active":""}`,children:[rt("span",{"aria-hidden":!0,className:"sf-rung-chip",style:{boxShadow:Sa[i]}}),Os[i]]},i))})})}import{SettingsField as xa}from"efficient-easel/panel";import{ShadowIcon as Ea}from"efficient-easel/icons";import{Fragment as Ca,jsx as Hn,jsxs as Pa}from"react/jsx-runtime";var ka="Most useful on a dark theme, where a black shadow cannot be seen. Also used by the Lift hover, even with the card shadow off.";function Fn({value:e,onChange:t,showHint:n=!0}){let o=e===null;return Hn(xa,{label:"Shadow color",icon:Hn(Ea,{}),changed:!o,action:Pa(Ca,{children:[Tt({value:e??ii,onChange:t,label:"Shadow color",caption:o?Q:void 0}),o?null:Hn(M,{label:"Shadow color",what:"change",onClear:()=>t(null)})]}),hint:n?ka:void 0})}import{SettingsField as Na}from"efficient-easel/panel";import{AlignSeparateIcon as _a}from"efficient-easel/icons";import{jsx as Wt}from"react/jsx-runtime";var Ra="The space between the blocks inside a row, a grid or a box. Not set means each one keeps the spacing it already has.",Ln="Block gap",Ia=yi.Grid;function On({value:e,onChange:t,showHint:n=!0}){let o=e===null;return Wt(Na,{label:Ln,labelId:"sf-block-gap",icon:Wt(_a,{}),value:o?"Not set":`${e}px`,changed:!o,action:o?void 0:Wt(M,{label:Ln,what:"change",onClear:()=>t(null)}),hint:n?Ra:void 0,children:Wt(ue,{min:vt.min,max:vt.max,step:vt.step,value:o?Ia:e,readout:!1,ariaLabel:Ln,onChange:t})})}import{SettingsField as Aa}from"efficient-easel/panel";import{HoverIcon as Ha}from"efficient-easel/icons";import{jsx as at}from"react/jsx-runtime";var Bs={none:"None",lift:"Lift",highlight:"Highlight"},Fa="What a card does when a shopper points at it \u2014 or taps it, on a phone. Highlight is the effect your cards already use.";function Bn({value:e,onChange:t,showHint:n=!0}){let o=e===null,s=e??oi;return at(Aa,{label:"Hover effect",icon:at(Ha,{}),value:o?Q:Bs[e],changed:!o,action:o?void 0:at(M,{label:"Hover effect",what:"change",onClear:()=>t(null)}),hint:n?Fa:void 0,children:at("div",{className:"sf-rungs",children:ni.map(i=>at("button",{type:"button","aria-pressed":i===s,onClick:()=>t(i),className:`sf-rung${i===s?" is-active":""}`,children:Bs[i]},i))})})}import{SettingsField as La}from"efficient-easel/panel";import{ImageIcon as Oa}from"efficient-easel/icons";import{jsx as lt}from"react/jsx-runtime";var zs="Hero image",Ms=[{followsWidth:!1,label:Me.full},{followsWidth:!0,label:Me.page}],Ba="Whether the big picture at the top of a page runs edge to edge, or sits inside the page width. The words follow the page width either way.";function zn({value:e,onChange:t,showHint:n=!0}){let o=e===null,s=e??!1;return lt(La,{label:zs,icon:lt(Oa,{}),value:o?Q:Ms.find(i=>i.followsWidth===e).label,changed:!o,action:o?void 0:lt(M,{label:zs,what:"change",onClear:()=>t(null)}),hint:n?Ba:void 0,children:lt("div",{className:"sf-rungs",children:Ms.map(i=>lt("button",{type:"button","aria-pressed":i.followsWidth===s,onClick:()=>t(i.followsWidth),className:`sf-rung${i.followsWidth===s?" is-active":""}`,children:i.label},i.label))})})}import{SettingsField as za}from"efficient-easel/panel";import{DropIcon as Ma}from"efficient-easel/icons";import{jsx as ct}from"react/jsx-runtime";var Ds="Photography",Ws=[{grayscale:!1,label:"As shot"},{grayscale:!0,label:"Black and white"}],Da="Black and white photographs return to color on hover. Wheels and tyres keep their real finish either way.";function Mn({value:e,onChange:t,showHint:n=!0}){let o=e===null,s=e??!1;return ct(za,{label:Ds,icon:ct(Ma,{}),value:o?Q:Ws.find(i=>i.grayscale===e).label,changed:!o,action:o?void 0:ct(M,{label:Ds,what:"change",onClear:()=>t(null)}),hint:n?Da:void 0,children:ct("div",{className:"sf-rungs",children:Ws.map(i=>ct("button",{type:"button","aria-pressed":i.grayscale===s,onClick:()=>t(i.grayscale),className:`sf-rung${i.grayscale===s?" is-active":""}`,children:i.label},i.label))})})}import{SettingsField as Wa}from"efficient-easel/panel";import{PaddingXIcon as Ga}from"efficient-easel/icons";import{jsx as Gt}from"react/jsx-runtime";var Dn="Side space",Ua="Not set",$a=Ze.default,Va="The room left at the left and right edge of every page.";function Wn({value:e,onChange:t,showHint:n=!0}){let o=e===null;return Gt(Wa,{label:Dn,labelId:"sf-side-space",icon:Gt(Ga,{}),value:o?Ua:`${e}px`,changed:!o,action:o?void 0:Gt(M,{label:Dn,what:"change",onClear:()=>t(null)}),hint:n?Va:void 0,children:Gt(ue,{min:Ze.min,max:Ze.max,step:Ze.step,value:e??$a,readout:!1,ariaLabel:Dn,onChange:t})})}import{SettingsField as Ka}from"efficient-easel/panel";import{WidthIcon as Xa}from"efficient-easel/icons";import{jsx as Ut}from"react/jsx-runtime";var Gn="Content width",Ya="Not set",qa=je.default,ja="The standard width every page on this site renders at.";function Un({value:e,onChange:t,showHint:n=!0}){let o=e===null;return Ut(Ka,{label:Gn,labelId:"sf-site-width",icon:Ut(Xa,{}),value:o?Ya:`${e}px`,changed:!o,action:o?void 0:Ut(M,{label:Gn,what:"change",onClear:()=>t(null)}),hint:n?ja:void 0,children:Ut(ue,{min:je.min,max:je.max,step:je.step,value:e??qa,readout:!1,ariaLabel:Gn,onChange:t})})}import{SettingsField as Vt}from"efficient-easel/panel";import{AccentIcon as Za,CaseIcon as Ja,StylesIcon as Qa,TextLinesIcon as Us,TextSizeIcon as dt,TextSmallIcon as el,TypeIcon as tl,WeightIcon as nl}from"efficient-easel/icons";import{Fragment as Vn,jsx as x,jsxs as $t}from"react/jsx-runtime";var ol=[{role:"heading",title:"Heading 1",group:"heading",step:"headingLarge",base:17,icon:x(dt,{})},{role:"heading2",title:"Heading 2",group:"heading",step:"headingMedium",base:15,icon:x(dt,{})},{role:"heading3",title:"Heading 3",group:"heading",step:"headingSmall",base:13,icon:x(dt,{})},{role:"accent",title:"Accent",step:"accent",base:15,icon:x(Za,{})},{role:"body",title:"Body",group:"body",step:"body",base:14,icon:x(Us,{})},{role:"label",title:"Labels",group:"label",step:"label",base:11,icon:x(el,{})}];var il=9,Ue=500,sl=100,rl=80,al=4,ll=600,cl=700,dl=400,ul="0.18em";function pl({id:e,value:t,onChange:n}){return x("select",{id:e,className:"sf-select w-full min-w-0",value:t,onChange:o=>n(o.target.value),style:{fontFamily:`var(${de(t)?.cssVar??"--font-body"})`},children:yo().map(([o,s])=>x("optgroup",{label:bo[o],children:s.map(i=>x("option",{value:i.key,children:i.label},i.key))},o))})}function hl({label:e,icon:t,readout:n,min:o,max:s,step:i,value:c,onChange:h,action:u,hint:r}){return x(Vt,{label:e,icon:t,value:n,action:u,hint:r,children:x("input",{type:"range",min:o,max:s,step:i,value:c,onChange:p=>h(Number(p.target.value)),className:"h-1 w-full cursor-pointer","aria-label":e})})}function $n({label:e,icon:t,value:n,fallback:o,min:s,max:i,step:c,suffix:h="",hint:u,onChange:r}){let p=n===null;return x(hl,{label:e,icon:t,readout:p?"Auto":`${n}${h}`,min:s,max:i,step:c,value:p?o:n,onChange:r,action:p?null:x(M,{label:e,what:"change",onClear:()=>r(null)}),hint:u})}function Gs({label:e,icon:t,options:n,value:o,onChange:s,hint:i,action:c}){return x(Vt,{label:e,icon:t,value:n.find(h=>h.value===o)?.label,hint:i,action:c,children:x("div",{className:"sf-rungs",children:n.map(h=>x("button",{type:"button","aria-pressed":h.value===o,onClick:()=>s(h.value),className:`sf-rung${h.value===o?" is-active":""}`,children:h.label},h.value))})})}var ml=[{value:"authored",label:"As designed"},{value:"sentence",label:"As typed"}],fl=[{value:"normal",label:"Normal"},{value:"tight",label:"Tight"},{value:"compressed",label:"Compressed"}];function gl({fontKey:e,weight:t,fallbackWeight:n,onWeight:o}){let i=(t??n)>=ll,c=wo(e),h=de(e)?.label??"This face";return x(Vt,{label:"Style",icon:x(Qa,{}),value:i?"Bold":"Normal",hint:"Bold is the weight above \u2014 one value, two ways to set it.",children:$t("div",{className:"sf-rungs",children:[x("button",{type:"button","aria-pressed":i,"aria-label":"Bold",title:"Bold",onClick:()=>o(i?dl:cl),className:`sf-rung sf-rung--glyph${i?" is-active":""}`,style:{fontWeight:700},children:"B"}),x("button",{type:"button","aria-pressed":!1,"aria-label":"Italic",disabled:!0,title:c?"Italic is not saved yet \u2014 the theme row has no column for it (card 66162.b).":`${h} is loaded without an italic, so it cannot be set in italic. Slanting it would deform the letters rather than style them.`,className:"sf-rung sf-rung--glyph",style:{fontStyle:"italic"},children:"I"})]})})}function Kn({fonts:e,compression:t,headingTypography:n,openRole:o,onOpenRole:s,onFontChange:i,sizes:c,onSizeChange:h,onCompressionChange:u,onHeadingTypographyChange:r,livePx:p,savedRole:w=null}){let v=a=>r({...n,...a}),b=a=>a==="accent"?"weightStrong":a==="heading2"?"weight2":a==="heading3"?"weight3":"weight",S=a=>a==="heading2"?"case2":a==="heading3"?"case3":"case",E=ai(t);return x("div",{className:"sf-style-list",children:ol.map(a=>{let y=o===a.role;return x(Hi,{styleKey:a.role,label:a.title,icon:a.icon,value:de(e[a.role])?.label??e[a.role],sampleStyle:bl(a,e,n,E),open:y,onToggle:()=>s(y?null:a.role),saved:w===a.role,children:y&&$t(Vn,{children:[x(Vt,{label:"Font",icon:x(tl,{}),htmlFor:`sf-font-${a.role}`,action:e[a.role]===tn[a.role]?null:x(M,{label:"Font",what:"change",onClear:()=>i(a.role,tn[a.role])}),children:x(pl,{id:`sf-font-${a.role}`,value:e[a.role],onChange:g=>i(a.role,g)})}),a.step&&h&&x($n,{label:"Size",icon:x(dt,{}),value:c[a.step],fallback:a.base*2,min:Xo,max:Yo,step:qo,suffix:"px",hint:c[a.step]===null?"Auto = this style states no size, and text following it keeps the size its section drew.":"The size a text takes when you set it to follow this style. Sections keep their own sizes.",onChange:g=>h(a.step,g)}),(Fe(a.role)||a.role==="accent")&&$t(Vn,{children:[x($n,{label:"Weight",icon:x(nl,{}),value:n[b(a.role)],fallback:Fe(a.role)?Ue:n.weight??Ue,min:li,max:ci,step:sl,hint:a.role==="accent"?"Auto = the accent phrase takes the heading's own weight.":void 0,onChange:g=>v({[b(a.role)]:g})}),x(gl,{fontKey:e[a.role],weight:n[b(a.role)],fallbackWeight:Fe(a.role)?Ue:n.weight??Ue,onWeight:g=>v({[b(a.role)]:g})})]}),Fe(a.role)&&$t(Vn,{children:[x(Gs,{label:"Line & text gap",icon:x(Us,{}),options:fl,value:t,onChange:u,hint:E.lineHeight===void 0?"The built-in spacing.":`Line gap ${E.lineHeight} \xB7 text gap ${E.letterSpacing}em.`,action:t===un?null:x(M,{label:"Line & text gap",what:"change",onClear:()=>u(un)})}),x(Gs,{label:"Capitals",icon:x(Ja,{}),options:ml,value:n[S(a.role)],onChange:g=>v({[S(a.role)]:g}),hint:"The only setting that changes a heading's capitals.",action:n[S(a.role)]==="authored"?null:x(M,{label:"Capitals",what:"change",onClear:()=>v({[S(a.role)]:"authored"})})}),x($n,{label:"Largest size",icon:x(dt,{}),value:n.maxPx,fallback:rl,min:di,max:ui,step:al,suffix:"px",hint:"Caps the biggest heading on the site. Auto = each section's own.",onChange:g=>v({maxPx:g})})]})]})},a.role)})})}function bl(e,t,n,o){let s=Math.max(il,e.base),i={fontFamily:`var(${de(t[e.role])?.cssVar??"--font-body"})`,fontSize:`${s.toFixed(1)}px`,lineHeight:1.15};return Fe(e.role)?(i.fontWeight=n.weight??Ue,i.textTransform=n.case==="sentence"?"none":"uppercase",o.letterSpacing!==void 0&&(i.letterSpacing=`${o.letterSpacing}em`)):e.role==="accent"?(i.fontWeight=n.weightStrong??n.weight??Ue,o.letterSpacing!==void 0&&(i.letterSpacing=`${o.letterSpacing}em`)):e.role==="label"&&(i.textTransform="uppercase",i.letterSpacing=ul),i}import{SettingsTabs as wl}from"efficient-easel/panel";import{ContrastIcon as vl,NoteIcon as Sl,SettingsIcon as Tl,TypeIcon as xl}from"efficient-easel/icons";function $s(e){switch(e.status){case"saved":return null;case"failed":return{msg:"Not saved. Try again.",tone:"error"};case"skipped":switch(e.reason){case"empty":return null;case"no-token":return{msg:"Not saved. Reload the page.",tone:"error"};case"template":return{msg:"Templates keep their look. Press Save.",tone:"success"}}}}import{Fragment as ut,jsx as F,jsxs as $e}from"react/jsx-runtime";var Xt="sf-site-styles-tabpanel",pt=!1,El="Show hints";function _e({shown:e,onChange:t}){return F("div",{className:"sf-hints",children:$e("button",{type:"button","aria-pressed":e,onClick:()=>t(!e),className:`sf-rung sf-hints-toggle${e?" is-active":""}`,children:[F(Sl,{size:13}),El]})})}var Lh="text",Kt=[{id:"basics",label:"Basics",icon:F(Tl,{}),htmlId:"sf-site-styles-tab-basics",panelId:Xt},{id:"theme",label:"Theme",icon:F(vl,{}),htmlId:"sf-site-styles-tab-theme",panelId:Xt},{id:"text",label:"Text",icon:F(xl,{}),htmlId:"sf-site-styles-tab-text",panelId:Xt}];function kl({themeFromDocument:e,persist:t}){let{appState:n,dispatch:o}=Xn(r=>r),{theme:s,setTheme:i}=V(),c=n.data,h=c.root?.props??{},u=r=>{if(e){let p={...h,theme:r};o({type:"replaceRoot",root:{...c.root,props:p},recordHistory:!0})}else i(r);t({selected_preset:r.selected,theme_presets:r.themes})};return F(vn,{value:e?h.theme:s,onChange:u})}function Cl(e,t){let[n,o]=Yt(null),s=Vs(null),i=JSON.stringify(e),c=Vs(t);return c.current=t,yl(()=>{if(s.current===null){s.current=i;return}if(s.current===i)return;s.current=i;let h=window.setTimeout(()=>o(c.current),700),u=window.setTimeout(()=>o(null),2200);return()=>{window.clearTimeout(h),window.clearTimeout(u)}},[i]),n}function Pl({themeFromDocument:e,persist:t}){let{appState:n,dispatch:o}=Xn(k=>k),[s,i]=Yt(null),{fonts:c,setFonts:h,sizes:u,setSizes:r,headingCompression:p,setHeadingCompression:w,headingTypography:v,setHeadingTypography:b}=V(),S=n.data,E=S.root?.props??{},a=e?vo(E.fonts):c,y=e?Ko:u,g=e?ri(E.headingCompression):p,O=e?pi(E.headingTypography):v,W=k=>o({type:"replaceRoot",root:{...S.root,props:{...E,...k}},recordHistory:!0}),L=Cl({curFonts:a,curCompression:g,curTypography:O},s);return F(Kn,{fonts:a,sizes:y,compression:g,headingTypography:O,openRole:s,onOpenRole:i,onFontChange:(k,z)=>{let T={...a,[k]:z};e?W({fonts:T}):h(T),t({heading_font:T.heading,body_font:T.body,accent_font:T.accent,label_font:T.label})},onSizeChange:e?void 0:(k,z)=>{let T={...y,[k]:z};r(T),t({heading_size_large_px:T.headingLarge,heading_size_medium_px:T.headingMedium,heading_size_small_px:T.headingSmall,accent_size_px:T.accent,body_size_px:T.body,label_size_px:T.label})},onCompressionChange:k=>{e?W({headingCompression:k}):w(k),t({heading_compression:k})},onHeadingTypographyChange:k=>{e?W({headingTypography:k}):b(k),t(hi(k))},livePx:_l,savedRole:L})}var Nl={heading:"main h1, main h2",heading2:"main h1, main h2",heading3:"main h1, main h2",accent:"main h1 em, main h2 em",body:"main p",label:"main .mono-eyebrow"};function _l(e){if(typeof document>"u")return null;let n=(Ge()?.contentDocument??document).querySelector(Nl[e]);if(!n)return null;let o=parseFloat(getComputedStyle(n).fontSize);return Number.isFinite(o)?o:null}function Rl({themeFromDocument:e,persist:t,showHint:n}){let{appState:o,dispatch:s}=Xn(b=>b),{cornerRadiusPx:i,setCornerRadiusPx:c}=V(),h=o.data,u=h.root?.props??{},r=u.cornerRadiusPx===void 0?Jo[jo(u.cornerStyle)]:Qo(u.cornerRadiusPx),p=e?r:i,w=b=>s({type:"replaceRoot",root:{...h.root,props:{...u,...b}},recordHistory:!0});return F(In,{value:p,onChange:b=>{e?w({cornerRadiusPx:b}):c(b),t({corner_radius_px:b})},showHint:n})}function Il(e){return{site_width:e}}function Al({persist:e,showHint:t}){let{siteWidth:n,setSiteWidth:o}=V();return F(Un,{value:n,onChange:i=>{o(i),e(Il(i),i===null)},showHint:t})}function Hl(e){return{block_gap:e}}function Fl(e){return{site_gutter:e}}function Ll({persist:e,showHint:t}){let{siteGutter:n,setSiteGutter:o}=V();return F(Wn,{value:n,onChange:i=>{o(i),e(Fl(i),i===null)},showHint:t})}function Ol({persist:e,showHint:t}){let{blockGap:n,setBlockGap:o}=V();return F(On,{value:n,onChange:i=>{o(i),e(Hl(i),i===null)},showHint:t})}function Bl({persist:e,showHint:t}){let{heroBackgroundFollowsWidth:n,setHeroBackgroundFollowsWidth:o}=V();return F(zn,{value:n,onChange:i=>{o(i),e({hero_background_follows_width:i},!0)},showHint:t})}function zl({persist:e,showHint:t=!0}){return $e(ut,{children:[F(Al,{persist:e,showHint:t}),F(Ll,{persist:e,showHint:t}),F(Ol,{persist:e,showHint:t}),F(Bl,{persist:e,showHint:t})]})}function Ml(e){return{card_shadow:e}}function Dl(e){return e===null?{shadow_color:null}:{shadow_color:si(e)}}function Wl(e){return{hover_effect:e}}function Gl({persist:e,showHint:t=!0}){let{cardShadow:n,setCardShadow:o,shadowColor:s,setShadowColor:i,hoverEffect:c,setHoverEffect:h}=V();return $e(ut,{children:[F(An,{value:n,onChange:u=>{o(u),e(Ml(u),!0)},showHint:t}),F(Fn,{value:s,onChange:u=>{i(u),e(Dl(u),u===null)},showHint:t}),F(Bn,{value:c,onChange:u=>{h(u),e(Wl(u),!0)},showHint:t})]})}function Ul(e){return{photography_grayscale:e}}function $l({persist:e,showHint:t}){let{photographyGrayscale:n,setPhotographyGrayscale:o}=V();return F(Mn,{value:n,onChange:i=>{o(i),e(Ul(i),!0)},showHint:t})}function Vl({persist:e,showHint:t=!0}){return F(ut,{children:F($l,{persist:e,showHint:t})})}function Ks(){let{websiteName:e}=V();return e?.trim()||St}function Yn({themeFromDocument:e=!1,tokenRef:t,siteId:n,onNotify:o,tab:s,onTabChange:i}){let{persist:c}=Li({themeFromDocument:e,tokenRef:t,siteId:n,onResult:E=>{let a=$s(E);a&&o?.(a.msg,a.tone)}}),[h,u]=Yt(Kt[0].id),r=s!==void 0,p=r?s:h,w=r?i??(()=>{}):u,v=Kt.find(E=>E.id===p)??Kt[0],[b,S]=Yt(pt);return $e(ut,{children:[F(wl,{items:Kt,activeId:v.id,onSelect:w,ariaLabel:"Site styles"}),$e("div",{id:Xt,role:"tabpanel","aria-labelledby":v.htmlId,children:[p==="basics"&&$e(ut,{children:[F(Rl,{themeFromDocument:e,persist:c,showHint:b}),!e&&F(Gl,{persist:c,showHint:b}),!e&&F(zl,{persist:c,showHint:b}),!e&&F(Vl,{persist:c,showHint:b}),F(_e,{shown:b,onChange:S})]}),p==="theme"&&F(kl,{themeFromDocument:e,persist:c}),p==="text"&&F(Pl,{themeFromDocument:e,persist:c})]})]})}import{ImageIcon as Kl}from"efficient-easel/icons";import{MediaIcon as Xl}from"efficient-easel/rail";import{Fragment as jl,jsx as Re,jsxs as Zl}from"react/jsx-runtime";function Yl({panel:e,pick:t,onHide:n}){let o=Ks(),s=t?ql(t.accept):null;return Zl(jl,{children:[t?Re(Nt,{icon:Re(Kl,{size:15}),title:`Choose ${s}`,context:t.title?`For ${t.title}`:o,actions:Re(us,{label:"Cancel",description:`Keep the current ${s}`,onClick:()=>mn(t.requestId,null)}),onHide:n}):Re(Nt,{icon:Re(Xl,{}),title:"Media library",context:o,onHide:n}),Re("div",{className:"sf-media-panel",children:Re(e,{pick:t,onPick:i=>t&&mn(t.requestId,i)})})]})}function ql(e){return/svg/i.test(e)?"SVG logo":e.startsWith("video")?"video":"image"}import{DEFAULT_PANEL_W as Jl,clampPanelWidth as Ql}from"efficient-easel/chrome";import{MAX_PANEL_W as Zh,MIN_PANEL_W as Jh,panelWidthVars as Qh}from"efficient-easel/chrome";var Kh="sf-editor-panel-widths",Xh={...Jl},Yh=e=>Ql(e);import{useState as ed}from"react";import{useEasel as td}from"efficient-easel/easel";import{InspectorHead as nd,InspectorIconButton as ar}from"efficient-easel/chrome";import{DuplicateIcon as od,TrashIcon as id}from"efficient-easel/icons";function Xs(e,t){if(!t)return null;let n=e.components?.[t.type],o=n?.fields??null;if(!o||typeof n?.resolveFields!="function")return o;try{let s=n.resolveFields({type:t.type,props:t.props},{fields:o,lastFields:o,lastData:null,changed:{},parent:null,appState:{}});return!s||typeof s.then=="function"?o:s}catch{return o}}import{useCallback as pe,useEffect as mt,useRef as qn,useState as Ce}from"react";import{SettingsTabs as ec}from"efficient-easel/panel";import{ListIcon as tc,LogoIcon as nc,SettingsIcon as oc,StylesIcon as ic}from"efficient-easel/icons";import{Fragment as Ie,jsx as d,jsxs as C}from"react/jsx-runtime";var ht="sf-header-tabpanel",jn=[{id:"logo",label:"Logo",icon:d(nc,{}),htmlId:"sf-header-tab-logo",panelId:ht},{id:"menu",label:"Menu",icon:d(tc,{}),htmlId:"sf-header-tab-menu",panelId:ht},{id:"tools",label:"Tools",icon:d(oc,{}),htmlId:"sf-header-tab-tools",panelId:ht},{id:"look",label:"Look",icon:d(ic,{}),htmlId:"sf-header-tab-look",panelId:ht}];function Zn({tokenRef:e,siteId:t,onClose:n,onAuthExpired:o,inline:s,placeholderMode:i,websiteName:c,onOpenWebsiteSettings:h}){let u=xe(),[r,p]=Ce(null),[w,v]=Ce(null),[b,S]=Ce(!1),[E,a]=Ce(jn[0].id),[y,g]=Ce(pt),O=i?jn.filter(l=>l.id!=="menu"):jn,W=O.find(l=>l.id===E)??O[0],[L,fe]=Ce(0),{setSettings:R}=V(),q=qn(null),B=qn(null),k=qn(null);mt(()=>{let l=!1,P=null,D=null,_=3,j=(ie,se=0)=>{l||v(null),Ct(ie,t,se>0).then(K=>!l&&p(K)).catch(()=>{l||(se+1<_?D=setTimeout(()=>j(ie,se+1),600*(se+1)):v("Could not load header settings."))})},Z=e.current;if(Z)j(Z);else{let ie=0;P=setInterval(()=>{let se=e.current;if(se){P&&clearInterval(P),P=null,l||v(null),j(se);return}ie+=250,ie===5e3&&!l&&v("Waiting for editor authorization\u2026"),ie>=3e4&&(P&&clearInterval(P),P=null,l||v("Not authorized yet \u2014 reopen once the editor has loaded."))},250)}return()=>{l=!0,P&&clearInterval(P),D&&clearTimeout(D)}},[e,L,t]),mt(()=>{r&&R(is(r))},[r,R]),mt(()=>()=>{q.current&&clearTimeout(q.current),B.current&&clearTimeout(B.current),k.current&&clearTimeout(k.current)},[]);let z=pe(async(l,P)=>{let D=e.current;if(!D||!r)return;let _=r;P&&p({...r,...P}),S(!0),v(null);try{let j=await l(D);p(j),ns(j,t)}catch(j){p(_),j instanceof Do&&j.status===401?(os(t),o?.(),v("Authorization expired \u2014 try again in a moment.")):v("Could not save. Please retry.")}finally{S(!1)}},[r,e,o,t]),T=pe(l=>z(P=>J.updateHeaderSettings(l,P,t??void 0),l),[z,t]),ee=pe(l=>{z(P=>J.setHeaderLogoFromAsset(l,P,t??void 0))},[z,t]),ae=pe(()=>{vi(u,{accept:"image/svg+xml",title:"Logo (SVG)"}).then(l=>{l&&ee(l.id)})},[ee]),le=pe((l,P=!0)=>{p(_=>_&&{..._,logo_size_px:l}),q.current&&clearTimeout(q.current);let D=()=>{z(_=>J.updateHeaderSettings({logo_size_px:l},_,t??void 0))};P?D():q.current=setTimeout(D,400)},[z,t]),te=pe((l,P=!0)=>{p(_=>_&&{..._,height_px:l}),B.current&&clearTimeout(B.current);let D=()=>{z(_=>J.updateHeaderSettings({height_px:l},_,t??void 0))};P?D():B.current=setTimeout(D,400)},[z,t]),ge=pe((l,P=!0)=>{p(_=>_&&{..._,menu_gap_px:l}),k.current&&clearTimeout(k.current);let D=()=>{z(_=>J.updateHeaderSettings({menu_gap_px:l},_,t??void 0))};P?D():k.current=setTimeout(D,400)},[z,t]),ve=pe(()=>{z(async l=>{let P=await J.clearHeaderLogo(l,t??void 0);return P.reverse_logo?J.updateHeaderSettings({reverse_logo:!1},l,t??void 0):P})},[z,t]),Ye=pe(l=>{p(P=>P&&{...P,menu:l?.id??null,menu_handle:l?.handle??null,menu_name:l?.name??null,menu_items:l?l.items.map(D=>({label:D.label,url:D.url,dropdown_menu:D.dropdown_menu??null,dropdown_items:D.dropdown_items??[]})):[]}),z(P=>J.updateHeaderSettings({menu:l?.id??null},P,t??void 0))},[z,t]),Se=C(Ie,{children:[w&&C("div",{className:"mx-4 mt-3 flex items-center justify-between gap-3 rounded bg-red-50 px-3 py-2 text-[12px] text-red-700",children:[d("span",{children:w}),!r&&d("button",{type:"button",onClick:()=>fe(l=>l+1),className:"shrink-0 rounded border border-red-300 px-2 py-0.5 font-medium text-red-700 transition-colors hover:bg-red-100",children:"Retry"})]}),r?C(Ie,{children:[d(ec,{items:O,activeId:W.id,onSelect:a,ariaLabel:"Header settings"}),C("div",{id:ht,role:"tabpanel","aria-labelledby":W.htmlId,className:"flex flex-col p-4 [&>*+*]:mt-3",children:[W.id==="logo"&&C(Ie,{children:[d(re,{label:"Image"}),!i&&d(sc,{settings:r,websiteName:c,onPick:ae,onClear:ve,showHint:y}),d(Y,{label:"Reverse the Logo",children:d(ne,{value:r.reverse_logo,onChange:l=>T({reverse_logo:l})})}),d(he,{shown:y,children:"Keeps the logo readable on any header \u2014 flips just its black & white parts to contrast the bar behind it (in both light and dark themes). Any other colors are kept as-is."}),d(re,{label:"Placement"}),d(ac,{label:N.logoPosition.label,value:N.logoPosition.options.find(l=>l.value===N.logoPosition.choose(r.logo_position))?.label,children:d(be,{value:N.logoPosition.choose(r.logo_position),options:N.logoPosition.options,onChange:l=>T({logo_position:l}),ariaLabel:N.logoPosition.label})}),C("div",{className:"flex flex-col gap-1.5",children:[C("div",{className:"flex items-center justify-between",children:[d("span",{className:"text-[13px] text-zinc-600",children:"Size"}),C("span",{className:"text-[12px] tabular-nums text-zinc-500",children:[r.logo_size_px??Qe[r.logo_size],"px"]})]}),d("div",{className:"sf-slider",children:d("input",{type:"range",min:Si,max:Ti,step:2,value:r.logo_size_px??Qe[r.logo_size],onChange:l=>le(Number(l.target.value),!1),onPointerUp:l=>le(Number(l.currentTarget.value),!0),onKeyUp:l=>{/^(Arrow|Home|End|Page)/.test(l.key)&&le(Number(l.currentTarget.value),!0)},"aria-label":"Logo size in pixels"})}),d(he,{shown:y,children:"Sets the logo\u2019s height; the width follows the logo\u2019s own proportions."}),r.logo_size_px!=null&&d("button",{type:"button",onClick:()=>le(null),className:"self-start text-[12px] font-medium text-zinc-500 underline underline-offset-2 transition-colors hover:text-zinc-700",children:"Reset to default size"})]}),d(_e,{shown:y,onChange:g})]}),W.id==="menu"&&C(Ie,{children:[d(re,{label:"Links"}),d(rc,{token:e.current,menuId:r.menu,menuName:r.menu_name,itemCount:r.menu_items?.length??0,onPick:Ye}),d(Y,{label:N.menuAlign.label,children:d(be,{value:N.menuAlign.choose(r.menu_position),options:N.menuAlign.options.filter(l=>l.value!=="beside"||r.logo_position!=="center"),onChange:l=>T({menu_position:l}),ariaLabel:N.menuAlign.label})}),N.menuAlign.choose(r.menu_position)==="beside"&&C("div",{className:"flex flex-col gap-1.5",children:[C("div",{className:"flex items-center justify-between",children:[d("span",{className:"text-[13px] text-zinc-600",children:"Space from the logo"}),C("span",{className:"text-[12px] tabular-nums text-zinc-500",children:[r.menu_gap_px??Be.default,"px"]})]}),d("div",{className:"sf-slider",children:d("input",{type:"range",min:Be.min,max:Be.max,step:Be.step,value:r.menu_gap_px??Be.default,onChange:l=>ge(Number(l.target.value),!1),onPointerUp:l=>ge(Number(l.currentTarget.value),!0),onKeyUp:l=>{/^(Arrow|Home|End|Page)/.test(l.key)&&ge(Number(l.currentTarget.value),!0)},"aria-label":"Space from the logo in pixels"})}),d(he,{shown:y,children:"How much room the menu leaves the logo. Only the logo moves away; the space between the menu words stays as it is."}),r.menu_gap_px!=null&&d("button",{type:"button",onClick:()=>ge(null),className:"self-start text-[12px] font-medium text-zinc-500 underline underline-offset-2 transition-colors hover:text-zinc-700",children:"Reset to default space"})]}),d(Y,{label:N.menuRow.label,children:d(be,{value:N.menuRow.choose(r.menu_row),options:N.menuRow.options,onChange:l=>T({menu_row:l}),ariaLabel:N.menuRow.label})}),r.logo_position==="center"&&r.menu_position!=="center"&&d(Y,{label:"Left items",children:d("select",{value:r.menu_split??3,onChange:l=>T({menu_split:Number(l.target.value)}),className:"rounded border border-zinc-300 bg-white px-2 py-1.5 text-[13px]",children:[1,2,3,4].map(l=>d("option",{value:l,children:l},l))})}),d(Y,{label:N.navTextCase.label,children:d(be,{value:N.navTextCase.choose(r.nav_text_case),options:N.navTextCase.options,onChange:l=>T({nav_text_case:l}),ariaLabel:N.navTextCase.label})}),C(he,{shown:y,children:[d("strong",{children:"Uppercase"})," draws SEARCH and BAG;"," ",d("strong",{children:"Capitalised"})," draws Search and Bag. It covers the menu links and the Tools words together, and it leaves a name like FusionForge exactly as you typed it."]})]}),W.id==="tools"&&C(Ie,{children:[d(re,{label:"Style"}),d(Y,{label:N.utilStyle.label,children:d(be,{value:N.utilStyle.choose(r.util_style),options:N.utilStyle.options,onChange:l=>T({util_style:l}),ariaLabel:N.utilStyle.label})}),C(he,{shown:y,children:[d("strong",{children:"Text"})," draws the words \u2014 Search, Account, Bag \u2014 instead of the little pictures. It changes how they look, not whether they are shown: that stays with the switches below."]}),d(re,{label:"Search"}),d(Y,{label:"Search",children:d(ne,{value:r.search_enabled,onChange:l=>T({search_enabled:l})})}),d(Y,{label:N.searchPosition.label,children:d(be,{value:N.searchPosition.choose(r.search_position),options:N.searchPosition.options,onChange:l=>T({search_position:l}),ariaLabel:N.searchPosition.label})}),d(re,{label:"Country selector"}),d(Y,{label:"Show selector",children:d(ne,{value:r.country_selector_enabled,onChange:l=>T({country_selector_enabled:l})})}),!i&&r.country_selector_enabled&&C(he,{shown:y,children:["Which countries this website serves \u2014 and each region's own URL \u2014 is set in the admin console under"," ",d("strong",{children:"Storefront \u203A Settings \u203A Regions & currencies"}),". Whether the picker is SHOWN stays here: that is header chrome, but the served-country list has tax consequences and belongs with commerce configuration."]}),d(re,{label:"Account and cart"}),d(Y,{label:"Account",children:d(ne,{value:r.account_enabled??!0,onChange:l=>T({account_enabled:l})})}),d(Y,{label:"Cart",children:d(ne,{value:r.cart_enabled??!0,onChange:l=>T({cart_enabled:l})})}),d(_e,{shown:y,onChange:g})]}),W.id==="look"&&C(Ie,{children:[d(re,{label:"Dimensions"}),d(Y,{label:N.width.label,children:d(be,{value:N.width.choose(r.width),options:N.width.options,onChange:l=>T({width:l}),ariaLabel:N.width.label})}),C("div",{className:"flex flex-col gap-1.5",children:[C("div",{className:"flex items-center justify-between",children:[d("span",{className:"text-[13px] text-zinc-600",children:"Height"}),C("span",{className:"text-[12px] tabular-nums text-zinc-500",children:[r.height_px??Je.default,"px"]})]}),d("div",{className:"sf-slider",children:d("input",{type:"range",min:Je.min,max:Je.max,step:2,value:r.height_px??Je.default,onChange:l=>te(Number(l.target.value),!1),onPointerUp:l=>te(Number(l.currentTarget.value),!0),onKeyUp:l=>{/^(Arrow|Home|End|Page)/.test(l.key)&&te(Number(l.currentTarget.value),!0)},"aria-label":"Header height in pixels"})}),d(he,{shown:y,children:"Sets how tall the header bar is; the content below it shifts down to match."}),r.height_px!=null&&d("button",{type:"button",onClick:()=>te(null),className:"self-start text-[12px] font-medium text-zinc-500 underline underline-offset-2 transition-colors hover:text-zinc-700",children:"Reset to default height"})]}),d(Y,{label:"Border thickness",children:C("div",{className:"flex items-center gap-2",children:[d("input",{type:"number",min:0,max:20,value:r.border_thickness,onChange:l=>T({border_thickness:Math.max(0,Number(l.target.value)||0)}),className:"w-20 rounded border border-zinc-300 px-2 py-1.5 text-[13px]"}),d("span",{className:"text-[12px] text-zinc-500",children:"px"})]})}),d(re,{label:"Color"}),d(Y,{label:"Theme",children:d(Oi,{value:r.theme??fn,onChange:l=>T({theme:l===fn?null:l}),followLabel:"Follow the site theme"})}),d(he,{shown:y,children:"The color the bar paints once it is solid \u2014 after any scroll, and on every product page from the first paint. Follow the site theme keeps it on whatever palette the site is on."}),d(Y,{label:N.topTextColor.label,children:d(be,{value:N.topTextColor.choose(r.top_text_color),options:N.topTextColor.options,onChange:l=>T({top_text_color:l}),ariaLabel:N.topTextColor.label})}),d(he,{shown:y,children:"Auto reads what the first section on each page says it is \u2014 dark, light or accent \u2014 and picks the text that can be read on it. Set Light or Dark to decide it yourself when Auto reads a page wrong."}),d(re,{label:"Behavior"}),d(Y,{label:"Sticky header",children:C("select",{value:r.sticky,onChange:l=>T({sticky:l.target.value}),className:"w-full rounded border border-zinc-300 bg-white px-2 py-1.5 text-[13px]",children:[d("option",{value:"none",children:"None"}),d("option",{value:"always",children:"Always"}),d("option",{value:"on_scroll_up",children:"On scroll up"})]})}),h&&C(Ie,{children:[d(re,{label:"Display mode"}),d("p",{className:"text-[12px] text-zinc-500",children:"Set the default Light / Dark / Auto mode and show or hide the light\u2194dark switch in Appearance."}),d("button",{type:"button",onClick:h,className:"self-start text-[13px] font-medium text-zinc-700 underline underline-offset-2 transition-colors hover:text-zinc-900",children:"Set up display mode \u2192"})]}),d(_e,{shown:y,onChange:g})]})]})]}):w?null:d("p",{className:"p-4 text-[13px] text-zinc-500",children:"Loading\u2026"})]});return s?C("div",{className:"flex flex-col",children:[b&&d("div",{className:"px-4 pt-2 text-[11px] text-zinc-400",children:"Saving\u2026"}),Se]}):C("div",{className:"fixed inset-0 z-[1000] flex justify-end",children:[d("button",{type:"button","aria-label":"Close header settings",onClick:n,className:"absolute inset-0 bg-black/20"}),C("aside",{className:"relative flex h-full w-[320px] flex-col overflow-y-auto border-l border-zinc-200 bg-white text-zinc-800 shadow-xl",children:[C("header",{className:"sticky top-0 z-10 flex items-center justify-between bg-white px-4 py-3",children:[d("h2",{className:"text-[15px] font-semibold",children:"Header"}),C("div",{className:"flex items-center gap-2",children:[b&&d("span",{className:"text-[11px] text-zinc-400",children:"Saving\u2026"}),d("button",{type:"button",onClick:n,className:"rounded p-1 text-zinc-500 hover:bg-zinc-100","aria-label":"Close",children:"\u2715"})]})]}),Se]})]})}function sc({settings:e,websiteName:t,onPick:n,onClear:o,showHint:s}){let i=!!e.logo_url,c=!i&&!!e.default_logo_url,h=fo(e.effective_logo_url),u=t&&t.trim()?t.trim():St;return C("div",{className:"flex flex-col gap-2",children:[d("button",{type:"button",onClick:n,title:"Choose an SVG logo from your media library, or upload one",className:"flex h-20 items-center justify-center rounded border border-dashed border-zinc-300 bg-zinc-50 px-3 transition-colors hover:border-zinc-400 hover:bg-zinc-100",children:h?d("img",{src:h,alt:"Header logo",className:"max-h-12 max-w-full object-contain"}):C("span",{className:"text-[12px] text-zinc-400",children:["No logo \u2014 \u201C",u,"\u201D wordmark shown"]})}),h&&d("span",{className:"truncate text-[11px] text-zinc-500",title:Jt(h),children:Jt(h)}),d(he,{shown:s,children:i?"Custom SVG logo uploaded for this store.":c?"Using your company logo from the database.":"No company logo on file \u2014 upload an SVG or the wordmark is used."}),C("div",{className:"flex gap-2",children:[d("button",{type:"button",onClick:n,className:"rounded border border-zinc-300 px-3 py-1.5 text-[13px] font-medium text-zinc-700 transition-colors hover:bg-zinc-100",children:i?"Replace SVG logo":"Upload SVG logo"}),i&&d("button",{type:"button",onClick:o,className:"rounded px-3 py-1.5 text-[13px] font-medium text-zinc-500 transition-colors hover:bg-zinc-100",children:"Use company default"})]})]})}function rc({token:e,menuId:t,menuName:n,itemCount:o,onPick:s}){let i=xe(),[c,h]=Ce(null),[u,r]=Ce(!1),p=pe(a=>{h(a),r(!0)},[]);mt(()=>{let a=!1;return qi(e).then(y=>!a&&p(y)).catch(()=>!a&&h([])),()=>{a=!0}},[e,p]),mt(()=>{let a=!1,y=Wo(()=>{ji(e).then(g=>!a&&p(g)).catch(()=>{})});return()=>{a=!0,y()}},[e,p]);let w=c===null,v=!w&&(c?.length??0)===0,b=!w&&(c??[]).some(a=>a.id===t),S=b?t:"",E=u&&!!t&&!b;return C("div",{className:"flex flex-col gap-2",children:[d(Y,{label:"Menu",children:C("select",{value:S,disabled:w||v,onChange:a=>{let y=a.target.value,g=y?(c??[]).find(O=>O.id===y):null;s(g?{...g,items:g.items.map(O=>({...O,dropdown_items:(c??[]).find(W=>W.id===O.dropdown_menu)?.items.map(W=>({label:W.label,url:W.url}))??[]}))}:null)},className:"max-w-[170px] rounded border border-zinc-300 bg-white px-2 py-1.5 text-[13px] disabled:opacity-60",children:[d("option",{value:"",children:w?"Loading\u2026":v?"No menus":"Default links"}),(c??[]).map(a=>C("option",{value:a.id,children:[a.name," (",a.item_count??a.items.length,")"]},a.id))]})}),E?d("p",{className:"text-[12px] text-[var(--sf-warning,#b45309)]",children:xi}):d("p",{className:"text-[12px] text-zinc-500",children:S?`Header shows \u201C${n??"the linked menu"}\u201D \u2014 ${o} link${o===1?"":"s"}.`:v?"No menus yet. Create one in Storefront \u2192 Menus, then pick it here.":"Pick a menu to drive the header links, or keep the built-in default links."}),d("button",{type:"button",onClick:()=>i.send("storefront-editor:open-menus",{menuId:S||null}),className:"self-start text-[13px] font-medium text-zinc-700 underline underline-offset-2 transition-colors hover:text-zinc-900",children:S?"Edit menu \u2192":"Manage menus \u2192"})]})}function he({shown:e,children:t}){return e?d("p",{className:"text-[11px] text-[var(--sf-muted)]",children:t}):null}function ac({label:e,value:t,children:n}){return C("div",{className:"flex flex-col gap-1.5",children:[C("div",{className:"flex items-center justify-between",children:[d("span",{className:"text-[13px] text-zinc-600",children:e}),t&&d("span",{className:"text-[12px] text-zinc-500",children:t})]}),n]})}function re({label:e}){return d(De,{label:e})}function Y({label:e,children:t}){return C("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-[7px]",children:[d("span",{className:"text-[13px] text-[var(--sf-text-secondary)]",children:e}),d("div",{className:"flex-shrink-0",children:t})]})}var lc=[{label:"Left",value:"left"},{label:"Center",value:"center"}],cc=[{label:"Left",value:"left"},{label:"Right",value:"right"}],dc=[{label:"Right",value:"left"},{label:"Centered",value:"center"},{label:"Beside logo",value:"beside"}],uc=[{label:"Own row",value:"top"},{label:"Same row",value:"inline"}],pc=[{label:Me.page,value:"page"},{label:Me.full,value:"full"}],hc=[{label:"Icon",value:"icon"},{label:"Text",value:"text"}],mc=[{label:"Uppercase",value:"uppercase"},{label:"Capitalised",value:"capitalised"}],fc=[{label:"Auto",value:"auto"},{label:"Light",value:"light"},{label:"Dark",value:"dark"}],N={logoPosition:{label:"Position",options:lc,choose:e=>e==="right"?"center":e},menuAlign:{label:"Alignment",options:dc,choose:e=>e==="center"?"center":e==="beside"?"beside":"left"},menuRow:{label:"Row",options:uc,choose:e=>e==="inline"?"inline":"top"},searchPosition:{label:"Position",options:cc,choose:e=>e},width:{label:"Width",options:pc,choose:e=>e},navTextCase:{label:"Letters",options:mc,choose:e=>e==="capitalised"?"capitalised":"uppercase"},utilStyle:{label:"Show as",options:hc,choose:e=>e==="text"?"text":"icon"},topTextColor:{label:"Text color at the top",options:fc,choose:e=>Pi(e)}};import{useEffect as gc,useState as bc}from"react";import{SettingsField as yc}from"efficient-easel/panel";import{TypeIcon as wc}from"efficient-easel/icons";import{Fragment as xc,jsx as oe,jsxs as Ys}from"react/jsx-runtime";var vc="Chat with us",Sc="We usually reply within a few minutes",Tc="Hi! Ask us anything \u2014 about a wheel, an order, or fitment. Leave your details and we\u2019ll reply.";function Jn({label:e,value:t,placeholder:n,onCommit:o,multiline:s=!1}){let[i,c]=bc(t);gc(()=>c(t),[t]);let h=()=>{i!==t&&o(i)};return oe(yc,{label:e,icon:oe(wc,{}),children:s?oe("textarea",{value:i,placeholder:n,rows:3,onChange:u=>c(u.target.value),onBlur:h,"aria-label":e}):oe("input",{type:"text",value:i,placeholder:n,onChange:u=>c(u.target.value),onBlur:h,onKeyDown:u=>{u.key==="Enter"&&u.currentTarget.blur()},"aria-label":e,autoComplete:"off"})})}function Qn(){let{chat:e,setChat:t}=Ji();return Ys(xc,{children:[Ys("div",{className:"sf-field sf-field--row",children:[oe("span",{className:"sf-field-label sf-field-label--inline",children:"Show the chat bubble"}),oe(ne,{value:e.enabled,onChange:n=>t({enabled:n})})]}),oe("p",{className:"sf-field-hint",children:e.enabled?"The floating chat bubble shows in the corner of every page.":"The chat bubble is hidden across the whole site."}),oe(De,{label:"Wording"}),oe(Jn,{label:"Title",value:e.title,placeholder:vc,onCommit:n=>t({title:n})}),oe(Jn,{label:"Subtitle",value:e.subtitle,placeholder:Sc,onCommit:n=>t({subtitle:n})}),oe(Jn,{label:"Greeting message",value:e.greeting,placeholder:Tc,onCommit:n=>t({greeting:n}),multiline:!0}),oe("p",{className:"sf-field-hint",children:"Leave a field blank to use the built-in wording."})]})}import{useEffect as Ec,useId as qs,useState as js}from"react";import{SettingsField as kc}from"efficient-easel/panel";import{Fragment as eo,jsx as Ae,jsxs as Zs}from"react/jsx-runtime";var Cc={instagram:"instagram.com/yourshop",facebook:"facebook.com/yourshop",tiktok:"tiktok.com/@yourshop",youtube:"youtube.com/@yourshop",x:"x.com/yourshop",linkedin:"linkedin.com/company/yourshop",pinterest:"pinterest.com/yourshop",whatsapp:"wa.me/61400000000"};function Pc({platform:e}){let{rows:t,saveLink:n}=bn(),{value:o,error:s}=t[e],[i,c]=js(o),[h,u]=js(!1),r=qs(),p=qs();Ec(()=>c(o),[o]);let w=async()=>{if(i.trim()===o){i!==o&&c(o);return}u(!0),await n(e,i),u(!1)},v=Ri[e];return Zs(eo,{children:[Ae(kc,{label:v,htmlFor:r,icon:Ae(Zi,{platform:e,iconStyle:"outline",size:18}),children:Ae("input",{id:r,type:"text",inputMode:"url",value:i,placeholder:Cc[e],onChange:b=>c(b.target.value),onBlur:()=>{w()},onKeyDown:b=>{b.key==="Enter"&&b.currentTarget.blur(),b.key==="Escape"&&(c(o),b.currentTarget.blur())},"aria-invalid":s?!0:void 0,"aria-describedby":s?p:void 0,"aria-busy":h||void 0,autoComplete:"off",spellCheck:!1})}),s&&Ae("p",{id:p,className:"sf-note sf-note--error",role:"alert",children:s})]})}function to({unavailable:e}){let{canSave:t}=bn();return!t&&e?Ae(eo,{children:e}):Zs(eo,{children:[Ae("p",{className:"sf-field-hint",children:"Paste a link to each profile. A platform left empty shows nothing on the site."}),_i.map(n=>Ae(Pc,{platform:n},n))]})}import{useMemo as Nc}from"react";import{useEasel as _c}from"efficient-easel/easel";import{SettingsField as Rc}from"efficient-easel/panel";import{jsx as Ve,jsxs as Js}from"react/jsx-runtime";var Ic="root:default-zone";function no({heroId:e}){let{appState:t,dispatch:n}=_c(r=>r),o=t.data.content??[],s=o.findIndex(r=>r.props.id===e),i=s>=0?o[s]:null,c=i?i.props.showTicker??!0:!0,h=Nc(()=>{let r=i?.props.tickerItems;return Array.isArray(r)?r:es.map(p=>({text:p}))},[i]);if(!i)return Ve("div",{className:"sf-field",style:{color:"var(--sf-muted)",fontSize:12},children:"This ticker\u2019s hero is no longer on the page."});let u=r=>n({type:"replace",destinationZone:Ic,destinationIndex:s,data:{...i,props:{...i.props,...r}}});return Js("div",{children:[Ve(De,{label:"Ticker"}),Js("div",{className:"sf-field sf-field--row",children:[Ve("span",{className:"sf-field-label sf-field-label--inline",children:"Show ticker"}),Ve(ne,{value:c,onChange:r=>u({showTicker:r})})]}),Ve(Rc,{label:gn.label,icon:gn.icon,children:Ve($i,{items:h,placeholder:"item",onChange:r=>u({tickerItems:r}),markup:!0})})]})}import{useCallback as Ac,useEffect as Hc,useRef as Fc,useState as Ke}from"react";import{createPortal as Lc}from"react-dom";import{InspectorIconButton as Oc}from"efficient-easel/chrome";import{CopyToPageIcon as Bc}from"efficient-easel/icons";import{Fragment as Qs,jsx as me,jsxs as qt}from"react/jsx-runtime";function oo({node:e,currentSlug:t,siteId:n,tokenRef:o,runAuthed:s,onNotify:i}){let[c,h]=Ke(!1),[u,r]=Ke(null),[p,w]=Ke(!1),[v,b]=Ke(null),S=Fc(null),[E,a]=Ke(null),[y,g]=Ke(null),O=Ac(async()=>{let R=o.current;if(!R){w(!0);return}try{r(await J.listPages(R,n))}catch{w(!0)}},[o,n]),W=()=>{if(c){h(!1);return}let R=S.current?.getBoundingClientRect();R&&a({top:R.bottom+6,right:Math.max(8,window.innerWidth-R.right)}),g(S.current?.closest(".sf-editor")??document.body),r(null),w(!1),O(),h(!0)};Hc(()=>{if(!c)return;let R=q=>{q.key==="Escape"&&h(!1)};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[c]);let L=bi(u??[]).filter(R=>R.slug!==t),fe=async R=>{if(v)return;b(R.slug);let q=wi(ss(e)),B=await s(async k=>{let z=await J.getPageById(R.id,k);if(!z)throw new Error(`Page "${R.slug}" no longer exists.`);let T=z.layout??{},ee=Array.isArray(T.content)?[...T.content]:[],ae=ee.findIndex(le=>le?.type===Ee);ee.splice(ae===-1?ee.length:ae,0,q),await J.saveLayout(R.id,{root:{},zones:{},...T,content:ee},k,z.updated_at??"")});b(null),h(!1),i?.(B?`Duplicated to \u201C${hn(R)}\u201D`:"Couldn\u2019t duplicate the section \u2014 please retry",B?"success":"error")};return qt(Qs,{children:[me(Oc,{buttonRef:S,label:"Duplicate to another page",hasPopup:"menu",expanded:c,onClick:W,children:me(Bc,{size:15})}),c&&E&&y&&Lc(qt(Qs,{children:[me("div",{className:"sf-dupmenu-backdrop",onClick:()=>h(!1)}),qt("div",{className:"sf-dupmenu",role:"menu",style:{top:E.top,right:E.right},children:[me("div",{className:"sf-dupmenu-head",children:"Duplicate to page\u2026"}),p?me("div",{className:"sf-dupmenu-empty",children:"Couldn\u2019t load pages"}):u===null?me("div",{className:"sf-dupmenu-empty",children:"Loading\u2026"}):L.length===0?me("div",{className:"sf-dupmenu-empty",children:"No other pages"}):L.map(R=>qt("button",{type:"button",role:"menuitem",className:"sf-dupmenu-item",disabled:v!==null,onClick:()=>fe(R),children:[me("span",{className:"sf-dupmenu-name",children:hn(R)}),v===R.slug?me("span",{className:"sf-note",children:"Copying\u2026"}):!R.is_published&&me("span",{className:"sf-note",children:"draft"})]},R.id))]})]}),y)]})}import{SettingsDrill as zc}from"efficient-easel/panel";import{jsx as ft,jsxs as Wc}from"react/jsx-runtime";var Mc="Not shown on the page";function Dc({part:e,onOpen:t}){return ft(zc,{name:e.label,preview:e.offPage?Mc:e.preview||"Empty",offPage:e.offPage,status:e.hidden?ft("span",{className:"sf-entry-eye",role:"img","aria-label":"Hidden on the page",children:ft(Ei,{name:"eye-off",size:14})}):void 0,onOpen:()=>t(e.key)})}function er({parts:e,onOpen:t}){let n=e.filter(o=>!o.identifier);return n.length?Wc("div",{className:"sf-entries",children:[ft("h3",{className:"sf-entries-head",children:"Text"}),n.map(o=>ft(Dc,{part:o,onOpen:t},o.key))]}):null}import{useState as Gc}from"react";import{createNode as Uc,newId as $c}from"efficient-easel/data";import{useEasel as Vc}from"efficient-easel/easel";import{jsx as jt,jsxs as tr}from"react/jsx-runtime";function io(){let{appState:e,dispatch:t,config:n}=Vc(p=>p),{readOnly:o}=ze(),[s,i]=Gc(!1),c=e.data.content;if(o||c.some(p=>p.type===tt))return null;let h=c.find(p=>p.type===Ee)??null,u=(p,w)=>Uc(n,p,w);return tr("div",{className:"sf-box-footer-switch",children:[jt("p",{className:"sf-box-footer-switch-text",children:"Build this footer out of Boxes and blocks, like a page: the same menus, signup, social links and logo, with the copyright as a Legal Line. Your current footer is kept."}),s?tr("div",{className:"sf-box-footer-switch-row",children:[jt("button",{type:"button",className:"es-btn-primary",onClick:()=>{let p=gs(h,u,$c(tt));t({type:"setData",data:w=>({...w,content:[...Et(w.content,p)]}),recordHistory:!0}),i(!1)},children:"Switch now"}),jt("button",{type:"button",className:"es-btn-ghost",onClick:()=>i(!1),children:"Cancel"})]}):jt("button",{type:"button",className:"es-btn-ghost",onClick:()=>i(!0),children:"Switch to Box footer"})]})}import{useState as so}from"react";import{createNode as Kc,newId as Xc}from"efficient-easel/data";import{useEasel as Yc}from"efficient-easel/easel";var nr="Flex",or=10;function ir(e,t,n,{logoHeightPx:o}={}){let s=e.util_style==="text"?"text":"icon",i={...e.menu?{id:e.menu}:{},...e.menu_handle?{handle:e.menu_handle}:{},...e.menu_name?{name:e.menu_name}:{},items:(e.menu_items??[]).map(({label:r,url:p})=>({label:r,url:p}))},c=[e.search_enabled?t("SearchBlock",{style:s}):null,e.country_selector_enabled?t("CountrySwitchBlock"):null,e.cart_enabled!==!1?t("CartBlock",{style:s}):null].filter(r=>r!==null),h=t(nr,{direction:"row",justify:"between",align:"center",share:"content",wrap:"nowrap",phoneRow:3,sectionPaddingTop:or,sectionPaddingBottom:or,content:[t("LogoBlock",o?{heightPx:o}:{}),t("MenuBlock",{menu:i,direction:"row"}),...c.length?[t(nr,{direction:"row",justify:"end",align:"center",share:"content",wrap:"nowrap",phoneRow:3,content:c})]:[]]}),u=xt(et,n,[h]);return{...u,props:{...u.props,sticky:e.sticky??"always",topTextColor:e.top_text_color??"auto"}}}import{jsx as gt,jsxs as sr}from"react/jsx-runtime";function ro(){let{appState:e,dispatch:t,config:n}=Yc(E=>E),{readOnly:o,tokenRef:s,siteId:i}=ze(),[c,h]=so(!1),[u,r]=so(!1),[p,w]=so(!1),v=e.data.content;if(o||v.some(E=>E.type===et))return null;let b=(E,a)=>Kc(n,E,a);return sr("div",{className:"sf-box-footer-switch",children:[gt("p",{className:"sf-box-footer-switch-text",children:"Build the site header out of Boxes and blocks, like a page: the same logo, menu, search, region and cart. Your current header is kept."}),c?sr("div",{className:"sf-box-footer-switch-row",children:[gt("button",{type:"button",className:"es-btn-primary",onClick:async()=>{let E=s.current;if(!(!E||u)){r(!0),w(!1);try{let a=await Ct(E,i),y=a.logo_size_px??Qe[a.logo_size],g=ir(a,b,Xc(et),{logoHeightPx:y});t({type:"setData",data:O=>({...O,content:[...Et(O.content,g)]}),recordHistory:!0}),h(!1)}catch{w(!0)}finally{r(!1)}}},disabled:u,children:u?"Switching\u2026":"Switch now"}),gt("button",{type:"button",className:"es-btn-ghost",onClick:()=>h(!1),disabled:u,children:"Cancel"})]}):gt("button",{type:"button",className:"es-btn-ghost",onClick:()=>h(!0),children:"Switch to Box header"}),p?gt("p",{className:"sf-box-footer-switch-text",role:"alert",children:"The header settings could not be read. Try again."}):null]})}import{useState as qc}from"react";import{useSelectedFields as jc}from"efficient-easel/easel";import{Inspector as Zc,planFields as Jc}from"efficient-easel/fields";import{jsx as rr}from"react/jsx-runtime";var ao=new Map,Qc=Object.fromEntries(Ki.map(e=>{let t=Wi[e];return[e,rr(t,{},e)]}));function lo({entries:e}){let{id:t,fields:n,values:o,readOnly:s,onChange:i}=jc(),[c,h]=qc(()=>ao.get(t)),u=ao.get(t),r=Jc(n).buckets,p=u&&r.includes(u)?u:c&&r.includes(c)?c:r[0],w=p===void 0||Gi(r,p)!==!0;return rr(Zc,{fields:n,values:o,onChange:i,readOnly:s,tab:p,onTab:v=>{ao.set(t,v),h(v)},tabIcons:Qc,idPrefix:t,ariaLabel:"Section settings",children:w?e:null})}import{Fragment as co,jsx as A,jsxs as we}from"react/jsx-runtime";var uo={kind:"puck"},yg={kind:"header"},wg={kind:"website"},vg={kind:"chat"},Sg={kind:"social"},Xe="Part";function sd(e,t,n){let o=e.describeNode(t);return{name:n,kindLabel:o?`${Xe} of ${o.label}`:Xe}}function lr({what:e}){return we("div",{className:"sf-note",children:[A("p",{children:we("strong",{children:[e," settings belong to a website."]})}),we("p",{children:["A template is a blueprint \u2014 it has no website of its own, so there is nothing here to change. Each website created from this template sets its own ",e.toLowerCase()," afterwards."]})]})}var rd={header:{name:"Header",kindLabel:"Site settings",icon:"header",render:(e,t)=>A(Zn,{inline:!0,placeholderMode:t.capabilities.placeholderFrames,tokenRef:t.tokenRef,siteId:t.siteId,websiteName:t.websiteName??void 0,onOpenWebsiteSettings:t.onOpenWebsiteSettings,onAuthExpired:()=>t.notifyParent("storefront-editor:auth-expired")})},website:{name:"Appearance",kindLabel:"Site settings",icon:"website",render:(e,t)=>A(Yn,{themeFromDocument:!t.capabilities.hasSiteTheme,tokenRef:t.tokenRef,siteId:t.siteId,onNotify:t.onNotify})},chat:{name:"Live chat",kindLabel:"Site settings",icon:"chat",render:()=>A(Qn,{})},social:{name:"Social links",kindLabel:"Site settings",icon:"social",render:()=>A(to,{unavailable:A(lr,{what:"Social link"})})},ticker:{name:yn,kindLabel:Xe,icon:"ticker",head:(e,t)=>e.kind==="ticker"?sd(t,e.heroId,yn):null,render:e=>A(no,{heroId:e.kind==="ticker"?e.heroId:""})},part:{name:Xe,kindLabel:Xe,icon:"Text",head:(e,t)=>{if(e.kind!=="part")return null;let n=t.describeNode(e.nodeId);if(!n)return null;let{key:o,row:s}=Le(e.propKey),i=s?Ht(n.fields[o],s):n.fields[o],c=Ro(Lo(Fo(i??{},o)),s);return{name:t.styleNameOfPart(e.nodeId,e.propKey)??c,kindLabel:`${Xe} of ${n.label}`}},render:(e,t)=>e.kind==="part"?A(_n,{nodeId:e.nodeId,propKey:e.propKey,onBack:()=>t.onSelectNode(e.nodeId),onEditStyle:t.onOpenSiteStyles}):null}},ad=new Set(["header","website","chat"]);function ld(e,t){if(e==="puck")return null;let n=rd[e];return ad.has(e)&&!t.hasSiteSettings?{...n,kindLabel:"Not part of a template",render:()=>A(lr,{what:n.name})}:n}function cd({mode:e,onOpenWebsiteSettings:t,onOpenSiteStyles:n,onSelectNode:o,hideNodeActions:s=!1,onNotify:i,onHidePanel:c}){let{capabilities:h,tokenRef:u,notifyParent:r,currentSlug:p,siteId:w,runAuthed:v}=ze(),{websiteName:b,fonts:S}=V(),{partStyle:E}=kt(),a=Oe(),{select:y}=We(),{selectedItem:g,getItemById:O,getSelectorForId:W,config:L,appState:fe}=td(K=>K),R=Xs(L,g?{type:g.type,props:g.props}:null),q=K=>L.components[K]?.label??K,B=g?W(g.props.id):void 0,k=ld(e.kind,h),z={capabilities:h,tokenRef:u,describeNode:K=>{let ce=O(K);if(!ce)return null;let Pe=L.components[ce.type];return{type:ce.type,label:Pe?.label??ce.type,fields:Pe?.fields??{}}},styleNameOfPart:(K,ce)=>{let Pe=O(K);if(!Pe)return null;let Zt=Ne(K,ce),f=E?.partId===Zt?E:null;return Fs(Pe.props,ce,f,S)},siteId:w,websiteName:b??null,notifyParent:r,onNotify:i,onOpenWebsiteSettings:t,onOpenSiteStyles:n,onSelectNode:o},T=k?.head?.(e,z)??null,ee=T?.name??(k?k.name:g?q(g.type):"Page settings"),ae=T?.kindLabel??(k?k.kindLabel:g?B&&B.zone!==pn?"Block":"Section":"Page"),le=k?k.icon:g?g.type:"page",te=k?null:g?L.components[g.type]?.fields??null:L.root?.fields??null,ge=te?Xi(te):2,ve=e.kind==="puck"&&g?Ft(g.type):null,Ye=!!g&&!!B&&B.zone===pn&&g.type!==Ee&&g.type!==mi,Se=fi(fe?.data,g),l=()=>{Se||B&&a.duplicateComponent(B.zone,B.index)},P=()=>{B&&(a.removeComponent(B.zone,B.index),a.select(null))},D=g?L.components[g.type]?.defaultProps?.previewHover:void 0,_=e.kind==="puck"&&!!g&&!!B&&D!==void 0,j=_&&g.props.previewHover===!0,Z=()=>{!g||!B||a.replaceComponent(B.zone,B.index,{...g,props:{...g.props,previewHover:!j}})},[ie,se]=ed(pt);return we("div",{className:`es-sidepanel es-sidepanel--right sf-panel sf-panel--right${ie?"":" sf-hints-folded"}`,children:[A(nd,{icon:A(Qi,{type:le,size:15}),name:ee,kind:ae,actions:!s&&e.kind==="puck"&&g&&g.type!==Ee?we(co,{children:[A(ar,{label:"Duplicate section",title:Se??void 0,disabled:Se!==null,onClick:l,children:A(od,{size:15})}),Ye&&h.hasSiteSettings&&A(oo,{node:g,currentSlug:p,siteId:w??void 0,tokenRef:u,runAuthed:v,onNotify:i}),A(ar,{label:"Remove section",danger:!0,onClick:P,children:A(id,{size:15})}),c?A(_t,{side:"right",onHide:c,divider:!0}):null]}):c?A(_t,{side:"right",onHide:c}):void 0}),_&&we("div",{className:"sf-preview-pin",children:[we("div",{className:"sf-preview-pin-text",children:[A("span",{className:"sf-preview-pin-label",children:"Preview hover state"}),A("span",{className:"sf-preview-pin-hint",children:"not shown live"})]}),A(ne,{value:j,onChange:Z,label:"Preview hover state"})]}),A(Bi,{tier:ge,children:A("div",{className:"sf-insp-body sf-scroll",children:k?k.render(e,z):g?we(co,{children:[A(Ai,{children:A(lo,{entries:A(er,{parts:Oo(R??L.components[g.type]?.fields,g.props),onOpen:K=>y(Ne(g.props.id,K))})})}),g.type===Ee&&h.hasSiteSettings&&A(io,{}),ve&&A(Mt,{source:ve,slug:it(g?.props)}),A(_e,{shown:ie,onChange:se})]}):we(co,{children:[A(lo,{}),p===gi&&h.hasSiteSettings&&A(ro,{})]})})})]})}import{useCallback as cr,useEffect as dr}from"react";import{useEasel as dd}from"efficient-easel/easel";function Rg({mode:e,setMode:t,onOpenPart:n}){let{getSelectorForId:o}=dd(p=>p),s=Oe(),{setSelectedPartId:i,setSelectHandler:c}=We(),h=cr(p=>{let w=Io(p);if(!w)return;let{nodeId:v,propKey:b}=w;if(!b){t(S=>S.kind==="part"?uo:S);return}t(S=>S.kind==="part"&&S.nodeId===v&&S.propKey===b?S:{kind:"part",nodeId:v,propKey:b}),n?.(v)},[t,n]);dr(()=>{c(h)},[c,h]);let u=e.kind==="part"?Ne(e.nodeId,e.propKey):null;return dr(()=>{i(u)},[u,i]),{selectNode:cr(p=>{t(()=>uo);let w=o(p);w&&s.select(w)},[t,o,s]),openPartId:u}}import{useEffect as ur,useState as ud}from"react";import{bindUndoKeys as pd,useEaselApi as hd}from"efficient-easel/easel";function md(e){let t=xe(),[n,o]=ud(null);return ur(()=>o(e.current),[e]),t.ownsDocument?typeof document>"u"?null:document:n}function Lg(e){let t=xe(),n=hd(),o=md(e);ur(()=>{if(!(t.ownsDocument||!o))return pd(o,n)},[t,n,o])}import{EaselCanvas as Sd}from"efficient-easel/easel";import{useEffect as hr,useLayoutEffect as bd}from"react";var fd=String.raw`(function (doc) {
2
+ if (doc.__sfFitWords) return;
3
+ var win = doc.defaultView;
4
+ var SELECTOR = "h1,h2,h3,h4,h5,h6,[class*='font-heading'],[class*='font-display']";
5
+ var MIN_SCALE = 0.3, MIN_PX = 16, SLACK = 1;
6
+
7
+ function measure(el) {
8
+ var widest = 0, current = 0, last = null, split = false, lastBlock = null;
9
+ function blockOf(n) {
10
+ for (var p = n.parentElement; p && p !== el; p = p.parentElement) {
11
+ var d = win.getComputedStyle(p).display;
12
+ if (d.indexOf("inline") !== 0 && d !== "contents") return p;
13
+ }
14
+ return el;
15
+ }
16
+ function close() { if (current > widest) widest = current; current = 0; last = null; }
17
+ var walker = doc.createTreeWalker(el, 5), range = doc.createRange(), node;
18
+ while ((node = walker.nextNode())) {
19
+ if (node.nodeType === 1) {
20
+ if (node.tagName === "BR" || node.tagName === "WBR") close();
21
+ continue;
22
+ }
23
+ var block = blockOf(node);
24
+ if (block !== lastBlock) close();
25
+ lastBlock = block;
26
+ var re = /(\S+)|(\s+)/g, m;
27
+ while ((m = re.exec(node.data))) {
28
+ if (m[2]) { close(); continue; }
29
+ range.setStart(node, m.index);
30
+ range.setEnd(node, m.index + m[0].length);
31
+ var rects = range.getClientRects();
32
+ for (var i = 0; i < rects.length; i++) {
33
+ var r = rects[i];
34
+ if (r.width <= 0) continue;
35
+ current += r.width;
36
+ if (last && r.top > last.top + last.height / 2) split = true;
37
+ last = r;
38
+ }
39
+ }
40
+ }
41
+ close();
42
+ return { widest: widest, split: split };
43
+ }
44
+
45
+ function lineWidth(el) {
46
+ var cs = win.getComputedStyle(el);
47
+ return el.getBoundingClientRect().width - parseFloat(cs.paddingLeft) - parseFloat(cs.paddingRight)
48
+ - parseFloat(cs.borderLeftWidth) - parseFloat(cs.borderRightWidth);
49
+ }
50
+
51
+ // ⚠️ THE HEADING ELEMENT IS NEVER TOUCHED — no style="", no data-*. This
52
+ // runs before React hydrates, and React 19 in development reports ANY
53
+ // attribute that differs from what it rendered ("a tree hydrated but some
54
+ // attributes didn't match"): first our inline font-size on the hero (which
55
+ // React owns via --heading-size), then, when that moved to a data-sf-fit
56
+ // attribute, the attribute itself. So the fitted size lives only in this
57
+ // script's own stylesheet, in <head>, addressed to each heading by its
58
+ // POSITION (":root>*:nth-child(2)>…"). A position goes stale when the page's
59
+ // structure changes, so the rules are rewritten in the MutationObserver
60
+ // callback, which runs before the next paint. !important so the size also
61
+ // beats a part's own inline size.
62
+ var head = doc.head || doc.documentElement;
63
+ var fitEl = doc.createElement("style");
64
+ fitEl.id = "storefront-fit-words-sizes";
65
+ head.appendChild(fitEl);
66
+ var fitted = new Map(); // heading -> fitted size, e.g. "43.8px"
67
+
68
+ function pathOf(el) {
69
+ var parts = [];
70
+ for (var e = el; e && e.parentElement; e = e.parentElement) {
71
+ var i = 1, s = e;
72
+ while ((s = s.previousElementSibling)) i++;
73
+ parts.unshift("*:nth-child(" + i + ")");
74
+ }
75
+ return ":root>" + parts.join(">");
76
+ }
77
+ function writeRules() {
78
+ var css = "";
79
+ fitted.forEach(function (size, el) {
80
+ if (!el.isConnected) { fitted.delete(el); return; }
81
+ css += pathOf(el) + "{font-size:" + size + " !important}";
82
+ });
83
+ if (fitEl.textContent !== css) fitEl.textContent = css;
84
+ }
85
+
86
+ function unfit(el) {
87
+ if (fitted.delete(el)) writeRules();
88
+ }
89
+
90
+ function fits(el) {
91
+ var m = measure(el);
92
+ return !m.split && m.widest <= lineWidth(el) + SLACK;
93
+ }
94
+
95
+ function fit(el) {
96
+ unfit(el);
97
+ if (lineWidth(el) <= 0) return; // hidden, or not laid out yet
98
+ if (fits(el)) return;
99
+ var set = parseFloat(win.getComputedStyle(el).fontSize);
100
+ if (!set) return;
101
+ var floor = Math.max(set * MIN_SCALE, MIN_PX);
102
+ if (floor >= set) return;
103
+ function size(px) { return Math.floor(px * 10) / 10 + "px"; }
104
+ // The SEARCH tries sizes on the element's own style and then puts that
105
+ // attribute back byte for byte (or removes it, if it had none), so nothing
106
+ // is left for React to see. A trial in a stylesheet instead restyles the
107
+ // whole page per step: a full pass on the Hartes home took 75–160ms at 4x
108
+ // CPU that way.
109
+ var hadStyle = el.hasAttribute("style"), origStyle = el.getAttribute("style");
110
+ function attempt(px) { el.style.setProperty("font-size", size(px), "important"); }
111
+ function done() { if (hadStyle) el.setAttribute("style", origStyle); else el.removeAttribute("style"); }
112
+ attempt(floor);
113
+ if (!fits(el)) { done(); return; } // even the floor does not fit: leave it as set
114
+ var lo = floor, hi = set;
115
+ for (var i = 0; i < 8; i++) {
116
+ var mid = (lo + hi) / 2;
117
+ attempt(mid);
118
+ if (fits(el)) lo = mid; else hi = mid;
119
+ }
120
+ done();
121
+ fitted.set(el, size(lo));
122
+ writeRules();
123
+ }
124
+
125
+ // What each heading measured right after we last fitted it, so the
126
+ // ResizeObserver below can tell a real change (a font swap, a rotate, a
127
+ // container that moved) from the size change our own write just caused.
128
+ var seen = new WeakMap();
129
+ function remember(el) {
130
+ var b = el.getBoundingClientRect();
131
+ seen.set(el, b.width + "x" + b.height);
132
+ }
133
+ function fitAndRemember(el) { fit(el); remember(el); }
134
+
135
+ // ⚠️ A ResizeObserver, NOT fonts.ready or a resize event, and the reason is
136
+ // WHEN it runs: after layout, BEFORE paint. The web font arriving re-wraps a
137
+ // fitted heading, and fonts.ready resolves only after that frame is painted —
138
+ // measured on the Hartes hero: a 42px jump in 2 of 3 loads. A size change
139
+ // reported here is fitted in the same frame, so the broken state is never
140
+ // drawn. It also covers a container that resizes.
141
+ var ro = new win.ResizeObserver(function (entries) {
142
+ for (var i = 0; i < entries.length; i++) {
143
+ var el = entries[i].target;
144
+ var b = el.getBoundingClientRect();
145
+ if (seen.get(el) === b.width + "x" + b.height) continue; // our own write
146
+ fitAndRemember(el);
147
+ }
148
+ });
149
+ function watch(el) { if (!seen.has(el)) { remember(el); ro.observe(el); } }
150
+
151
+ function fitAll() {
152
+ var els = doc.querySelectorAll(SELECTOR);
153
+ for (var i = 0; i < els.length; i++) { fitAndRemember(els[i]); watch(els[i]); }
154
+ }
155
+
156
+ var queued = 0, all = false, touched = new Set();
157
+ function run() {
158
+ queued = 0;
159
+ if (all) { all = false; touched.clear(); fitAll(); return; }
160
+ var els = Array.from(touched);
161
+ touched.clear();
162
+ for (var i = 0; i < els.length; i++) if (els[i].isConnected) { fitAndRemember(els[i]); watch(els[i]); }
163
+ }
164
+ function schedule() { if (!queued) queued = win.requestAnimationFrame(run); }
165
+ function scheduleAll() { all = true; schedule(); }
166
+
167
+ fitAll();
168
+ // A backstop only: a font that changes widths without changing any
169
+ // heading's box is not seen by the ResizeObserver.
170
+ if (doc.fonts && doc.fonts.ready) doc.fonts.ready.then(scheduleAll, function () {});
171
+
172
+ // …and the viewport WIDTH, which the ResizeObserver cannot stand in for: a
173
+ // heading sized to its own text (fit-content, a flex item) keeps the SAME box
174
+ // when the phone turns to 844, so nothing reports a change and it would stay
175
+ // shrunk. The probe's rotate check caught exactly that.
176
+ var lastWidth = win.innerWidth;
177
+ function onResize() {
178
+ if (win.innerWidth === lastWidth) return; // a phone's toolbar changing HEIGHT is not our business
179
+ lastWidth = win.innerWidth;
180
+ scheduleAll();
181
+ }
182
+ win.addEventListener("resize", onResize);
183
+
184
+ var mo = new win.MutationObserver(function (records) {
185
+ // Positions first: a node added or removed anywhere can shift the
186
+ // nth-child path of a fitted heading, and this callback runs before paint.
187
+ if (fitted.size) {
188
+ for (var q = 0; q < records.length; q++) if (records[q].type === "childList") { writeRules(); break; }
189
+ }
190
+ for (var i = 0; i < records.length; i++) {
191
+ var r = records[i];
192
+ var target = r.target.nodeType === 1 ? r.target : r.target.parentElement;
193
+ var own = target && target.closest(SELECTOR);
194
+ if (own) touched.add(own);
195
+ for (var j = 0; j < r.addedNodes.length; j++) {
196
+ var n = r.addedNodes[j];
197
+ if (n.nodeType !== 1) continue;
198
+ if (n.matches(SELECTOR)) touched.add(n);
199
+ var inner = n.querySelectorAll(SELECTOR);
200
+ for (var k = 0; k < inner.length; k++) touched.add(inner[k]);
201
+ }
202
+ }
203
+ if (touched.size) schedule();
204
+ });
205
+ mo.observe(doc.body, { childList: true, subtree: true, characterData: true });
206
+
207
+ doc.__sfFitWords = function stop() {
208
+ win.removeEventListener("resize", onResize);
209
+ ro.disconnect();
210
+ mo.disconnect();
211
+ if (queued) win.cancelAnimationFrame(queued);
212
+ fitted.clear();
213
+ fitEl.remove();
214
+ delete doc.__sfFitWords;
215
+ };
216
+ // For the probe and for debugging: which headings are fitted, at what size,
217
+ // and the sheet that holds it (disable it to read a heading's set size).
218
+ doc.__sfFitWords.fitted = fitted;
219
+ doc.__sfFitWords.sheet = fitEl;
220
+ })(document);`,gd="storefront-fit-words";function pr(e){let t=e.createElement("script");return t.id=gd,t.textContent=fd,(e.head??e.documentElement).appendChild(t),()=>{e.__sfFitWords?.(),t.remove()}}import{Fragment as wd,jsx as mr,jsxs as vd}from"react/jsx-runtime";var yd=`
221
+ [${on}][${on}] { cursor: text; }
222
+ [${Te}][${Te}][${Te}] {
223
+ outline: 1px solid ${Ni.accent};
224
+ outline-offset: 2px;
225
+ }
226
+ [${Te}][${Te}]:has([${Te}]),
227
+ [data-puck-overlay-portal][data-puck-overlay-portal]:has([${Te}]) {
228
+ outline: none;
229
+ }
230
+ `;function po({children:e,document:t}){let{theme:n,themeMode:o,themeSwitchShown:s}=V(),i=wt(n);return hr(()=>{if(t)return ki(t,{mode:o,switchShown:s})},[t,o,s]),hr(()=>{if(t)return Ci(t,i)},[t,i]),bd(()=>{if(t)return pr(t)},[t]),vd(wd,{children:[mr(as,{}),mr("style",{children:yd}),e]})}import{Fragment as fr,jsx as ho}from"react/jsx-runtime";function Td({children:e,componentId:t}){let{selectedPartId:n}=We();return Ao(n,t)?ho(fr,{}):ho(fr,{children:e})}function eb(e){let{mirrorHostStyles:t}=rs(),n=ls();return ho(Sd,{...e,metadata:e.metadata??n,height:"fill",mirrorStyles:t,frameWrapper:po,overlay:Td})}export{Nt as a,Pd as b,us as c,gs as d,Fd as e,Ld as f,Od as g,Bd as h,zd as i,Lh as j,Kt as k,Ks as l,Yn as m,Yl as n,Kh as o,Xh as p,Yh as q,Zh as r,Jh as s,Qh as t,Xs as u,uo as v,yg as w,wg as x,vg as y,Sg as z,cd as A,Rg as B,md as C,Lg as D,eb as E};
@@ -0,0 +1 @@
1
+ import{$b as R,Qb as S}from"./chunk-A2QNXDQ6.js";import{jsx as g,jsxs as H}from"react/jsx-runtime";function I({spokes:l,mesh:i=!1,className:d}){let s=o=>Math.round(o*1e3)/1e3,u=[];for(let o=0;o<l;o++){let t=o/l*Math.PI*2-Math.PI/2;if(u.push({x1:s(100+Math.cos(t)*22),y1:s(100+Math.sin(t)*22),x2:s(100+Math.cos(t)*86),y2:s(100+Math.sin(t)*86),main:!0}),i){let r=t+Math.PI/l;u.push({x1:s(100+Math.cos(r)*22*1.4),y1:s(100+Math.sin(r)*22*1.4),x2:s(100+Math.cos(r)*78),y2:s(100+Math.sin(r)*78),main:!1})}}return H("svg",{viewBox:"0 0 200 200",fill:"none",stroke:"currentColor",className:d??"block h-[70%] w-[70%] transition-transform duration-700 [transition-timing-function:cubic-bezier(.2,.6,.2,1)]",children:[g("circle",{cx:100,cy:100,r:92,strokeWidth:2}),g("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),g("circle",{cx:100,cy:100,r:22,strokeWidth:2}),g("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),u.map((o,t)=>g("line",{x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2,stroke:"currentColor",strokeWidth:o.main?6:3,strokeLinecap:"round",opacity:o.main?1:.5},t))]})}import{Children as W,isValidElement as O,useEffect as T,useLayoutEffect as _,useRef as M,useState as P}from"react";import{jsx as v,jsxs as $}from"react/jsx-runtime";var B=500;function F({value:l,onChange:i,disabled:d,children:h,className:p,style:f,name:s,id:u,"aria-label":o}){let t=W.toArray(h).flatMap(e=>{if(!O(e))return[];if(e.type!=="option")return[];let a=e.props,E=a.value!==void 0?String(a.value):"",N=a.children,A=typeof N=="string"||typeof N=="number"?String(N):E;return[{value:E,label:A,disabled:!!a.disabled}]}),[r,c]=P(!1),[x,m]=P(0),k=M(null),w=M(null),y=M({text:"",timer:0});T(()=>{if(!r)return;let e=a=>{!k.current?.contains(a.target)&&!w.current?.contains(a.target)&&c(!1)},n=a=>{a.key==="Escape"&&(c(!1),k.current?.focus())};return document.addEventListener("mousedown",e),document.addEventListener("keydown",n),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",n)}},[r]),T(()=>{if(!r)return;let e=t.findIndex(n=>n.value===(l??""));m(e>=0?e:0)},[r]),_(()=>{if(!r||!w.current)return;w.current.children.item(x)?.scrollIntoView({block:"nearest"})},[x,r]);let K=t.find(e=>e.value===(l??""))?.label??t[0]?.label??"",D=e=>{i?.({target:{value:e}}),c(!1),k.current?.focus()},L=e=>{if(t.length===0)return;let n=x;for(let a=0;a<t.length&&(n=(n+e+t.length)%t.length,!!t[n].disabled);a++);m(n)};return $("div",{className:"relative",children:[s&&v("input",{type:"hidden",name:s,value:l??""}),v("button",{ref:k,type:"button",disabled:d,"aria-haspopup":"listbox","aria-expanded":r,"aria-label":o,id:u,onClick:()=>!d&&c(e=>!e),onKeyDown:e=>{if(!d){if(e.key==="ArrowDown")e.preventDefault(),r?L(1):c(!0);else if(e.key==="ArrowUp")e.preventDefault(),r?L(-1):c(!0);else if(e.key==="Home")e.preventDefault(),m(0);else if(e.key==="End")e.preventDefault(),m(t.length-1);else if(e.key==="Enter"||e.key===" "){if(e.preventDefault(),!r){c(!0);return}let n=t[x];n&&!n.disabled&&D(n.value)}else if(e.key==="Tab")c(!1);else if(e.key.length===1&&/\S/.test(e.key)){window.clearTimeout(y.current.timer),y.current.text+=e.key.toLowerCase();let n=y.current.text,a=t.findIndex(E=>E.label.toLowerCase().startsWith(n));a>=0&&m(a),r||c(!0),y.current.timer=window.setTimeout(()=>{y.current.text=""},B)}}},className:`block w-full ${p??""}`,style:f,children:v("span",{className:"block w-full truncate text-left",children:K})}),r&&v("ul",{ref:w,role:"listbox",className:"absolute left-0 top-full z-50 mt-1 max-h-[280px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",children:t.map((e,n)=>v("li",{role:"option","aria-selected":e.value===(l??""),"aria-disabled":e.disabled||void 0,onMouseEnter:()=>!e.disabled&&m(n),onMouseDown:a=>{a.preventDefault(),e.disabled||D(e.value)},className:["px-3 py-2.5 font-mono text-[13px] font-semibold uppercase tracking-[0.1em] transition-colors whitespace-nowrap",e.disabled?"cursor-not-allowed opacity-40":"cursor-pointer",n===x&&!e.disabled?"bg-accent text-bg":"bg-bg text-fg"].join(" "),children:e.label},`${e.value}_${n}`))})]})}import{useState as U}from"react";import{jsx as b,jsxs as C}from"react/jsx-runtime";function z({customerEmail:l}){let{coupon:i,applyCoupon:d,removeCoupon:h,couponBusy:p}=R(),[f,s]=U("");async function u(){p||!f.trim()||(await d(f,l),s(""))}return C("div",{className:"flex flex-col gap-2",children:[i===null?C("div",{className:"flex border border-line",children:[b("input",{type:"text",value:f,onChange:o=>s(o.target.value),onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),u())},placeholder:"Coupon code","aria-label":"Coupon code",className:"flex-1 bg-transparent px-3.5 py-3.5 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim"}),b("button",{type:"button",onClick:()=>{u()},disabled:p,className:"border-l border-line px-4 font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-wait disabled:opacity-60",children:p?"\u2026":"Apply"})]}):C("div",{className:["flex items-center justify-between gap-3 border px-3.5 py-3",i.valid?"border-accent":"border-line"].join(" "),style:i.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[b("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",i.valid?"text-accent":i.deferred?"text-fg":"text-fg-dim line-through"].join(" "),children:i.code}),b("button",{type:"button",onClick:h,"aria-label":`Remove coupon ${i.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"\u2715"})]}),i?.deferred?b("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:S}):i&&!i.valid&&i.message&&b("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:i.message})]})}export{I as a,F as b,z as c};
@@ -0,0 +1 @@
1
+ import{Ja as c}from"./chunk-A2QNXDQ6.js";import{T as u,l as s}from"./chunk-PAXN7G3Y.js";function w(e){return{root:{props:{}},content:[e],zones:{}}}function T(e){return(e.content??[])[0]??null}function g(e){return Array.isArray(e)&&e.length>0&&e.every(t=>!!t&&typeof t=="object"&&typeof t.type=="string"&&typeof t.props=="object")}function m(e){let t={...e.props,id:c(e.type)};for(let[r,o]of Object.entries(t))g(o)&&(t[r]=o.map(m));return{type:e.type,props:t}}import{createContext as f,useContext as y}from"react";import{Fragment as v,jsx as l,jsxs as h}from"react/jsx-runtime";var x={mirrorHostStyles:!0,css:null,fontHrefs:[]},d=f(x);function H({value:e,children:t}){return l(d.Provider,{value:e,children:t})}function S(){return y(d)}function I(){let{css:e,fontHrefs:t}=S();return h(v,{children:[t.map(r=>l("link",{rel:"stylesheet",href:r},r)),e?l("style",{"data-sf-canvas-css":"",children:e}):null]})}import{createContext as b,useContext as _}from"react";import{jsx as P}from"react/jsx-runtime";var p=b(void 0);function z({metadata:e,children:t}){return P(p.Provider,{value:e,children:t})}var D=()=>_(p);var n=new Map,a=e=>e??"";function O(e,t,r=!1){let o=a(t);r&&n.delete(o);let i=n.get(o);return i||(i=u.getHeaderSettings(e,t??void 0),n.set(o,i),i.catch(()=>{n.get(o)===i&&n.delete(o)})),i}function G(e,t){n.set(a(t),Promise.resolve(e))}function j(e){n.delete(a(e))}function F(e){return{logoUrl:s(e.effective_logo_url),reverseLogo:e.reverse_logo,logoPosition:e.logo_position,logoSize:e.logo_size,logoSizePx:e.logo_size_px,menuItems:e.menu_items??[],menuSplit:e.menu_split??3,menuPosition:e.menu_position,menuRow:e.menu_row,menuGapPx:e.menu_gap_px??null,searchEnabled:e.search_enabled,searchPosition:e.search_position,searchRow:e.search_row,countrySelectorEnabled:e.country_selector_enabled,countryUrls:e.country_urls??{},accountEnabled:e.account_enabled??!0,cartEnabled:e.cart_enabled??!0,utilStyle:e.util_style,navTextCase:e.nav_text_case,lightReverseText:e.light_reverse_text,topTextColor:e.top_text_color,transparentTop:e.transparent_top,surface:e.surface,theme:e.theme,width:e.width,heightPx:e.height_px,sticky:e.sticky}}export{O as a,G as b,j as c,F as d,w as e,T as f,m as g,H as h,S as i,I as j,z as k,D as l};
@@ -0,0 +1 @@
1
+ var Ue=Symbol.for("efficient-web.efficient-backend");function Me(e){return!!e&&e[Ue]===!0}function X(e){return e?.trim()||null}function He(e={}){let t=e.backend??null,n=new Map,r={token:null,brandId:null},s={documentId:null,bridgedId:null};return{hostBackend:t,usesBridgedToken:t===null||Me(t),blocks:e.blocks??null,auth:r,site:s,siteId:()=>s.documentId??s.bridgedId,cache(i,u){return n.has(i)||n.set(i,u()),n.get(i)},forget(i){i===void 0?n.clear():n.delete(i)}}}function De(e,t){e.site.documentId=X(t)}function We(e,t){e.site.bridgedId=X(t)}var Je=He(),O=null,L=new Set;function _(){return O??Je}function Ht(e){L.delete(e),O=e}function Dt(e){L.add(e),queueMicrotask(()=>{L.delete(e)&&O===e&&(O=null)})}function ee(){return _().usesBridgedToken}var N="x-forwarded-for";function te(e){let t=(e??"").split(",").map(n=>n.trim()).filter(Boolean);return t.length>0?t[t.length-1]:null}var Ge="x-forwarded-host";function ne(e,t,n){let r={};return e&&(r[Ge]=e),t&&n==="uncached"&&(r[N]=t),r}function re(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 Ve={siteSlug:null,shopOrigin:""},$=Ve;function Gt(e){$={siteSlug:e.siteSlug?.trim()||null,shopOrigin:(e.shopOrigin??"").trim().replace(/\/+$/,"")}}function U(){return $.siteSlug}function se(){return $.shopOrigin}var ie="x-storefront-site",oe="x-storefront-host";var ae={contentHash:"db2b679aad5380c6",schema:1,mediaFields:{ImageBlock:["src"],LogoBlock:["src"],Flex:["bgImage"],FeaturedCover:["image"],LongRead:["image"],Banner:["imageSrc"],Timeline:["imageSrc"],Logos:["items[].src"],ContactLocations:["locations[].photo"],HeroSingle:["imageFocal","mediaImage","mediaVideo","poster"],HeroSlide:["mediaImage","mediaVideo","poster"],PostCard:["image"],Gallery:["othersCards[].image","othersCards[].photos[].src","vehicleCards[].image","vehicleCards[].photos[].src","wheelCards[].image","wheelCards[].photos[].src"],GalleryItem:["image","photos[].src"],Manifesto:["imageSrc"],SectionHeader:["logoSrc"],IntroBleed:["imageSrc","imageSrcMobile"],Split:["imageSrc","textBgSrc"],ProcessSteps:["steps[].image"],DetailRows:["rows[].image"],PaymentBadges:["badges[].src"]},mediaKeyNames:["bgImage","image","imageFocal","imageSrc","imageSrcMobile","logoSrc","mediaImage","mediaVideo","photo","poster","src","textBgSrc"],snapshotObjects:{ProductGrid:{source:{keep:["slug"]}},GalleryItem:{product:{keep:["code","finish"]}},FeaturedCover:{source:{keep:["slug"]}},LongRead:{source:{keep:["slug"]}}},hydratedLists:{Events:["posts"],SubscribeBlogs:["posts"]},technicalStateKeys:["imageFocal"]};function M(e){return{getItem(t){try{return e()?.getItem(t)??null}catch{return null}},setItem(t,n){try{e()?.setItem(t,n)}catch{}},removeItem(t){try{e()?.removeItem(t)}catch{}}}}var A="__storefront_probe__";function jt(e){try{e.setItem(A,A);let t=e.getItem(A)===A;return e.removeItem(A),t}catch{return!1}}var v=M(()=>typeof window>"u"?null:window.localStorage),Zt=M(()=>typeof window>"u"?null:window.sessionStorage);function Qt(e){return M(()=>e.defaultView?.localStorage??null)}var ze="shop_access_token",le="shop_refresh_token",H=null;function D(){v.removeItem(ze),v.removeItem(le)}var b={getAccess(){return H},takeLegacyRefresh(){let e=v.getItem(le);return D(),e},setTokens(e){H=e,D()},clear(){H=null,D()}};function je(e){return!!e.src}function R(e){let t=e.finishes.filter(je);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 Ze(e){return e.listable!==!1}function W(e){return e.map(R).filter(Ze)}var I="https://cdn.inovit.com"?.replace(/\/+$/,"");function J(e,t){let n=_().hostBackend?.media.resolve;if(!(!n||n===Ye))return n(e,t)??e}function Qe(e){return/^(?:https?:)?\/\//i.test(e)||/^(?:data|blob):/i.test(e)}function G(e){return J(e)??ce(e)}function ce(e){return!I||Qe(e)?e:I+e.replace(/^\/media/,"")}var Ye=e=>ce(e),Xe="";function E(e){if(!e)return null;let t=J(e);return t!==void 0?t:e.startsWith("/")?`${Xe}${e}`:e}function on(e){return/^https?:\/\//i.test(e)&&!(I&&e.startsWith(I+"/"))}function an(e){if(!e)return;let t=J(e);return t!==void 0?t:e.startsWith("/media/")?G(e):e}function ln(e){let t=e.split("?")[0],n=t.substring(t.lastIndexOf("/")+1);try{return decodeURIComponent(n.replace(/^[0-9a-f]{32}_/i,""))||n}catch{return n}}var et="/videos/products/";function cn(e){return!!e&&e.includes(et)}var pe=["fill","stroke","stop-color","color","flood-color","lighting-color","solid-color"],ge=new Set(["none","transparent","currentcolor","inherit","initial","unset","context-fill","context-stroke"]),F={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]},he=12,ye=/\burl\(/i,fe=new RegExp(`(?<![-\\w])(${pe.join("|")})(\\s*=\\s*)(["'])([^"']*)\\3`,"gi"),Se=new RegExp(`((?:^|[;{\\s"'])(?:${pe.join("|")})\\s*:\\s*)([^;}"'<>]+)`,"gi"),tt=/<svg\b([^>]*)>/i,nt=/\bfill\s*[=:]/i;function rt(e){let t=e.replace(fe,(n,r,s,i,u)=>{let m=ue(u);return m===null?n:`${r}${s}${i}${m}${i}`}).replace(Se,(n,r,s)=>{let i=ue(s);return i===null?n:`${r}${i}`});return t=t.replace(tt,(n,r)=>nt.test(r)?n:`<svg fill="#ffffff"${r}>`),t}function ue(e){let t=/!important/i.test(e),r=e.replace(/!important/gi,"").trim().toLowerCase();if(!r||ye.test(r)||ge.has(r))return null;let s=r in F?[...F[r],1]:Pe(r);if(!s)return null;let[i,u,m,d]=s;if(Math.max(i,u,m)-Math.min(i,u,m)>he)return null;let y=st(255-i,255-u,255-m,d);return t?`${y} !important`:y}function st(e,t,n,r){if(r<1)return`rgba(${e}, ${t}, ${n}, ${r})`;let s=i=>i.toString(16).padStart(2,"0");return`#${s(e)}${s(t)}${s(n)}`}function Pe(e){return e.startsWith("#")?it(e):e.startsWith("rgb")?ot(e):e.startsWith("hsl")?lt(e):null}function it(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 ot(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,r]=t.split("/"),s=n.split(/[\s,]+/).filter(Boolean).slice(0,3);if(s.length<3)return null;let i=s.map(m=>m.endsWith("%")?Math.round(parseFloat(m)/100*255):Math.round(parseFloat(m)));if(i.some(m=>Number.isNaN(m)))return null;let u=r?B(r):at(n);return[i[0],i[1],i[2],u]}function at(e){let t=e.split(/[\s,]+/).filter(Boolean);return t.length>=4?B(t[3]):1}function B(e){let t=e.trim().endsWith("%")?parseFloat(e)/100:parseFloat(e);return Number.isNaN(t)?1:t}function lt(e){let t=e.slice(e.indexOf("(")+1,e.lastIndexOf(")")),[n,r]=t.split("/"),s=n.split(/[\s,]+/).filter(Boolean);if(s.length<3)return null;let i=parseFloat(s[0]),u=parseFloat(s[1])/100,m=parseFloat(s[2])/100;if([i,u,m].some($e=>Number.isNaN($e)))return null;let d=r?B(r):s.length>=4?B(s[3]):1,[y,S,P]=ct(i,u,m);return[y,S,P,d]}function ct(e,t,n){let r=(1-Math.abs(2*n-1))*t,s=(e%360+360)%360/60,i=r*(1-Math.abs(s%2-1)),u=0,m=0,d=0;s<1?[u,m,d]=[r,i,0]:s<2?[u,m,d]=[i,r,0]:s<3?[u,m,d]=[0,r,i]:s<4?[u,m,d]=[0,i,r]:s<5?[u,m,d]=[i,0,r]:[u,m,d]=[r,0,i];let y=n-r/2;return[Math.round((u+y)*255),Math.round((m+y)*255),Math.round((d+y)*255)]}var me=512*1024;function V(e){return/\.svg(\?|$)/i.test(e)}function ut(e){return`data:image/svg+xml,${encodeURIComponent(rt(e))}`}function mt(e){let t=e.replace(/!important/gi,"").trim().toLowerCase();if(!t||ye.test(t)||ge.has(t))return null;let n=t in F?[...F[t],1]:Pe(t);if(!n)return null;let[r,s,i]=n;return Math.max(r,s,i)-Math.min(r,s,i)>he?null:(.2126*r+.7152*s+.0722*i)/255}function dt(e){let t=[],n=r=>{let s=mt(r);s!==null&&t.push(s)};for(let r of e.matchAll(fe))n(r[4]);for(let r of e.matchAll(Se))n(r[2]);return t.length?t.reduce((r,s)=>r+s,0)/t.length<.5:null}var de=/^(?:\uFEFF|\s+|<\?xml[^>]*\?>|<!--[\s\S]*?-->|<!DOCTYPE\s+svg[^>[]*>)/i;function pt(e){let t=e;for(let n=de.exec(t);n&&n[0].length>0;n=de.exec(t))t=t.slice(n[0].length);return/^<svg[\s>/]/i.test(t)}async function gt(e,t){if(!V(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>me)return null;let s=await n.text();return s.length>me?null:pt(s)?s:null}catch{return null}}async function be(e,t){let n=await gt(e,t);return n===null?null:{reversed:ut(n),inkIsDark:dt(n)}}function we(){return _().siteId()}var ht="",f=class extends Error{constructor(t,n,r){super(n),this.status=t,this.data=r}},z="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.",yt=new Set([502,503,504]),K=0,ft="This editor runs on its host's own backend, which does not serve this request.",St=5e3,Pt=15e3,bt=()=>typeof window>"u"?St:Pt;function Ie(e){let t=(e.method??"GET").toUpperCase();if(!(e.body!=null||t!=="GET"&&t!=="HEAD")&&e.audience!=="admin"&&typeof AbortSignal?.timeout=="function")return AbortSignal.timeout(bt())}var _e=e=>e instanceof Error&&e.name==="TimeoutError",Ae=(e,t)=>yt.has(e)?z:t;function wt(e){if(typeof window>"u"||!e.startsWith("/api/v1/"))return e;let t=U();return!t||/[?&]site=/.test(e)?e:j(e,`site=${encodeURIComponent(t)}`)}async function o(e,t={}){let{token:n,baseUrl:r,headers:s,audience:i,...u}=t;if(typeof window<"u"&&!ee())throw new f(K,ft,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 m=typeof FormData<"u"&&u.body instanceof FormData,d;try{d=await fetch(`${r??ht}${wt(e)}`,{...u,headers:{...m?{}:{"Content-Type":"application/json"},...n?{Authorization:`Bearer ${n}`}:{},...i===null?{}:{"X-Portal-Audience":i??"shop"},...s},signal:u.signal??Ie({...u,audience:i})})}catch(P){throw P instanceof TypeError||_e(P)?new f(K,z,null):P}let y;try{y=await d.text()}catch(P){throw _e(P)?new f(K,z,null):P}let S=null;if(y)try{S=JSON.parse(y)}catch{throw new f(d.status,d.ok?"Expected JSON but received a non-JSON response":Ae(d.status,d.statusText),y)}if(!d.ok){let P=(S&&typeof S=="object"&&"detail"in S&&typeof S.detail=="string"?S.detail:null)??Ae(d.status,d.statusText);throw new f(d.status,P,S)}return S}var x=null;async function Ee(){return x||(x=_t().finally(()=>{x=null}),x)}async function _t(){let e=b.takeLegacyRefresh(),t=await At.refresh(e??void 0);return b.setTokens(t.access),t.access}async function Fe(){return b.getAccess()??Ee()}async function p(e,t={}){let n;try{n=await Fe()}catch{throw b.clear(),new f(401,"Not signed in",null)}try{return await o(e,{...t,token:n})}catch(r){if(!(r instanceof f)||r.status!==401)throw r;try{let s=await Ee();return await o(e,{...t,token:s})}catch{throw b.clear(),r}}}async function Re(e,t={}){if(b.getAccess())try{return{data:await p(e,t),asShopper:!0}}catch(n){if(!(n instanceof f)||n.status!==401)throw n}return{data:await o(e,t),asShopper:!1}}async function xe(){let e=await p("/api/auth/me/");if(e.portal!=="shop")throw b.clear(),new f(403,"This session is not valid for this shop.",null);return e}var At={login:(e,t)=>o("/api/auth/login/",{method:"POST",body:JSON.stringify({email:e,password:t,portal:"shop"}),credentials:"include"}),refresh:e=>o("/api/auth/refresh/",{method:"POST",body:JSON.stringify(e?{refresh:e,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{b.clear();try{await o("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{let e=await Fe();return await xe(),e},me:xe,updateMe:e=>p("/api/auth/me/",{method:"PATCH",body:JSON.stringify(e)}),changePassword:(e,t)=>p("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:t,old_password:e})}),changeEmail:(e,t)=>p("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:e,current_password:t})}),myProfile:()=>p("/api/shop-portal/profile/"),updateMyProfile:e=>p("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(e)}),myAddresses:()=>p("/api/shop-portal/delivery-locations/"),createAddress:e=>p("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(e)}),updateAddress:(e,t)=>p(`/api/shop-portal/delivery-locations/${e}/`,{method:"PATCH",body:JSON.stringify(t)}),deleteAddress:e=>p(`/api/shop-portal/delivery-locations/${e}/`,{method:"DELETE"}),passwordResetRequest:e=>o("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:e})}),passwordResetConfirm:(e,t,n)=>o("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:e,token:t,new_password:n})}),brands:()=>p("/api/products/brands/"),myOrders:()=>p("/api/shop-portal/orders/").then(e=>e.results),myOrder:e=>p(`/api/shop-portal/orders/${e}/`),cancelOrder:e=>p(`/api/shop-portal/orders/${e}/cancel/`,{method:"POST"}),myReturns:e=>p(`/api/shop-portal/returns/${e?`?order=${encodeURIComponent(e)}`:""}`).then(t=>t.results),createReturn:e=>p("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(e)}),withdrawReturn:e=>p(`/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"),p("/api/shop-portal/return-media/",{method:"POST",body:n})}};function h(e){if(typeof e=="string")return e.startsWith("/media/")?G(e):e;if(Array.isArray(e))return e.map(h);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(([s,i])=>[h(s),i])):h(r);return t}return e}var Rt="",Be="".replace(/\/+$/,""),qe=typeof window>"u"&&Be!=="",xt=qe?Be:Rt,kt=se,w=()=>({baseUrl:kt(),audience:null});function l(e,t){let n=t?`?process=${encodeURIComponent(t)}`:"";return`/api/v1${e}${n}`}var Tt=100,ke=50;function Le(e,t,n){let r=new URLSearchParams;for(let[s,i]of Object.entries(t))i!=null&&i!==""&&r.set(s,String(i));return r.set("pageSize",String(Tt)),n&&r.set("cursor",n),`/api/v1${e}?${r.toString()}`}function Ct(e,t){return Le("/wheels",{process:e},t)}function Ot(e,t,n){return Le("/products",{kind:e.join(","),make:t?.make,model:t?.model,year:t?.year,modification:t?.modification},n)}function vt(e){if(!e)return null;try{return new URL(e,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function Te(e,t,n=()=>!1){let r=[],s=null;try{for(let i=0;i<ke;i++){let u=await o(await t(s),await a());if(r.push(...u.results),s=vt(u.next),!s)break}s&&console.warn(`[${e}] stopped at ${ke} pages (${r.length} rows); catalog may be truncated`)}catch(i){if(n(i))throw i;console.warn(`[${e}] product API unavailable, returning []`,i)}return r}var It=e=>e instanceof f&&e.status===400;function Et(e){return e.flatMap(t=>t.kind==="alloy-wheel"?W([t]):[t])}async function Ne(){return(await Ft()).host}async function Ft(){try{let{headers:e}=await import("./headers-3CAQXQEY.js"),t=await e(),n=i=>i?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,r=n(t.get(oe)??t.get("x-forwarded-host")??t.get("host")),s=n(t.get("host"));return{host:r,matchesRequestHost:r!==null&&r===s}}catch{return{host:null,matchesRequestHost:!1}}}async function Bt(){try{let{headers:e}=await import("./headers-3CAQXQEY.js");return te((await e()).get(N))}catch{return null}}async function qt(){try{let{headers:e}=await import("./headers-3CAQXQEY.js");return(await e()).get(ie)||null}catch{return null}}async function Lt(){let e=await qt();if(e)return`site=${encodeURIComponent(e)}`;let t=await Ne();return t?`host=${encodeURIComponent(t)}`:""}async function g(e){if(typeof window<"u"){let t=U();return t?j(e,`site=${encodeURIComponent(t)}`):e}return j(e,await Lt())}function j(e,t){return t?`${e}${e.includes("?")?"&":"?"}${t}`:e}async function Nt(e){if(!qe)return;let[t,n]=await Promise.all([Ne(),Bt()]),r=ne(t,n,e);return Object.keys(r).length>0?r:void 0}async function a(e){let t=await Nt(re(e)),n={baseUrl:xt,...e};return t&&(n.headers={...t,...e?.headers}),n}var k=typeof window>"u";function T(e,t){let n=new URLSearchParams;for(let[s,i]of Object.entries(t))i!==void 0&&i!==""&&n.set(s,String(i));let r=n.toString();return`/api/v1/fitment${e}${r?`?${r}`:""}`}var xn={listMakes:async e=>{if(k){let{fitmentData:n}=await import("./fitment-data-6OYGRNMJ.js");return n.makes(e)}return(await o(T("/makes",{region:e}),w())).results},listModels:async(e,t)=>{if(k){let{fitmentData:r}=await import("./fitment-data-6OYGRNMJ.js");return r.models(e,t)}return(await o(T("/models",{make:e,region:t}),w())).results},listYears:async(e,t,n)=>{if(k){let{fitmentData:s}=await import("./fitment-data-6OYGRNMJ.js");return s.years(e,t,n)}return(await o(T("/years",{make:e,model:t,region:n}),w())).results},listModifications:async(e,t,n,r)=>{if(k){let{fitmentData:i}=await import("./fitment-data-6OYGRNMJ.js");return i.modifications(e,t,n,r)}return(await o(T("/modifications",{make:e,model:t,year:n,region:r}),w())).results},getStockFitment:async(e,t,n,r,s)=>{if(k){let{fitmentData:i}=await import("./fitment-data-6OYGRNMJ.js");return i.stockFitment(e,t,n,r,s)}return o(T("/stock-fitment",{make:e,model:t,year:n,modification:r,region:s}),w())}},kn={listWheels:async e=>{let t=await Te("products.listWheels",async n=>await g(Ct(e,n)));return W(h(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 Te("products.listCatalog",async r=>await g(Ot(e,t,r)),It);return Et(h(n))},getWheel:async e=>R(h(await o(await g(l(`/wheels/${e}`)),await a()))),getTyre:async e=>h(await o(await g(l(`/tyres/${e}`)),await a())),listBundles:async()=>{try{return await o(await g(l("/bundles")),await a())}catch{return[]}},getBundle:async e=>o(await g(l(`/bundles/${e}`)),await a()),listGalleryBuilds:async(e={})=>{let{process:t=null,wheelSlug:n=null}=e;if(typeof window>"u"){let{listGalleryBuilds:r}=await import("./gallery-builds-data-SWA6XKFF.js");return h(r(t,n))}try{let r=new URLSearchParams;t&&r.set("process",t),n&&r.set("wheelSlug",n);let s=r.toString(),i=await o(`/api/v1/gallery-builds${s?`?${s}`:""}`,w());return h(i.results)}catch(r){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",r),[]}},getSite:async()=>o(await g(l("/site")),await a()),getSiteBySlug:async e=>o(`${l("/site")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await a():void 0),listBrands:async()=>{try{return(await o(await g(l("/brands")),await a())).results??[]}catch(e){return console.warn("[products.listBrands] product API unavailable, returning []",e),[]}},listBrandsForSite:async e=>(await o(`${l("/brands")}?${new URLSearchParams({site:e})}`,typeof window>"u"?await a():void 0)).results??[],listPages:async()=>h(await o(await g(l("/pages")),await a())),listProductTemplates:async()=>{try{return await o(await g(l("/product-templates")),await a())}catch(e){return console.warn("[products.listProductTemplates] unavailable, returning []",e),[]}},listProductTypeChoices:async()=>{try{return await o(await g(l("/product-type-choices")),await a())}catch(e){return console.warn("[products.listProductTypeChoices] unavailable, returning []",e),[]}},listFieldUsage:async()=>{try{return await o(await g(l("/field-usage")),await a())}catch(e){return console.warn("[products.listFieldUsage] unavailable, returning []",e),[]}},getPage:async(e,t={})=>h(await o(await g(l(`/pages/${e}`)),await a(t.revalidate!==void 0?{next:{revalidate:t.revalidate}}:void 0))),listBlogPosts:async()=>{try{return(await o(l("/blog-posts"),await a())).map(t=>({...t,coverImage:E(t.coverImage)??""}))}catch(e){return console.warn("[products.listBlogPosts] blog API unavailable, returning []",e),[]}},getBlogPost:async e=>{let t=await o(l(`/blog-posts/${e}`),await a());return{...t,coverImage:E(t.coverImage)??""}},createOrder:async e=>o(l("/orders"),await a({method:"POST",body:JSON.stringify(e)})),createOrderAuthed:async e=>p(l("/orders"),await a({method:"POST",body:JSON.stringify(e)})),lookupOrder:async e=>o(l("/orders/lookup"),await a({method:"POST",body:JSON.stringify(e)})),createPaymentIntent:async e=>o(l("/payments/intent"),await a({method:"POST",body:JSON.stringify(e)})),createPaypalOrder:async e=>o(l("/payments/paypal/order"),await a({method:"POST",body:JSON.stringify(e)})),capturePaypalOrder:async e=>o(l("/payments/paypal/capture"),await a({method:"POST",body:JSON.stringify(e)})),createAfterpayCheckout:async e=>o(l("/payments/afterpay/checkout"),await a({method:"POST",body:JSON.stringify(e)})),captureAfterpayPayment:async e=>o(l("/payments/afterpay/capture"),await a({method:"POST",body:JSON.stringify(e)})),chargeSquare:async e=>o(l("/payments/square/charge"),await a({method:"POST",body:JSON.stringify(e)})),createGocardlessBillingRequest:async e=>o(l("/payments/gocardless/billing-request"),await a({method:"POST",body:JSON.stringify(e)})),completeGocardlessPayment:async e=>o(l("/payments/gocardless/complete"),await a({method:"POST",body:JSON.stringify(e)})),createZipCheckout:async e=>o(l("/payments/zip/checkout"),await a({method:"POST",body:JSON.stringify(e)})),captureZipPayment:async e=>o(l("/payments/zip/capture"),await a({method:"POST",body:JSON.stringify(e)})),createKlarnaCheckout:async e=>o(l("/payments/klarna/checkout"),await a({method:"POST",body:JSON.stringify(e)})),captureKlarnaPayment:async e=>o(l("/payments/klarna/capture"),await a({method:"POST",body:JSON.stringify(e)})),createStockAlert:async e=>o(l("/stock-alerts"),await a({method:"POST",body:JSON.stringify(e)})),createPreOrderIntent:async e=>o(l("/pre-order-intents"),await a({method:"POST",body:JSON.stringify(e)})),createNewsletterSubscription:async e=>o(l("/newsletter-subscriptions"),await a({method:"POST",body:JSON.stringify(e)})),unsubscribeNewsletter:async e=>o(l("/newsletter-unsubscribe"),await a({method:"POST",body:JSON.stringify(e)})),captureCart:async e=>o(l("/carts"),await a({method:"POST",body:JSON.stringify(e)})),restoreCart:async e=>o(l("/carts/restore"),await a({method:"POST",body:JSON.stringify(e)})),unsubscribeCartReminders:async e=>o(l("/carts/unsubscribe"),await a({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=l("/reviews"),r=t.toString();try{return await o(await g(r?`${n}?${r}`:n),await a())}catch(s){return console.warn("[products.listReviews] product API unavailable, returning []",s),[]}},submitReview:async e=>o(l("/reviews"),await a({method:"POST",body:JSON.stringify(e)})),getForm:async e=>o(l(`/forms/${encodeURIComponent(e)}`),await a()),submitForm:async(e,t)=>o(l(`/forms/${encodeURIComponent(e)}/submissions`),await a({method:"POST",body:JSON.stringify(t)})),listShippingMethods:async()=>{try{return await o(l("/shipping-methods"),await a())}catch(e){return console.warn("[products.listShippingMethods] product API unavailable, returning []",e),[]}},listCountrySubdivisions:async e=>{try{return await o(l(`/countries/${encodeURIComponent(e)}/subdivisions`),await a())}catch(t){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",t),[]}},quoteCart:async e=>{let t=l("/cart/quote"),n=await a({method:"POST",body:JSON.stringify(e)});return e.couponCode?(await Re(t,n)).data:o(t,n)},validateCoupon:async e=>{let{data:t,asShopper:n}=await Re(l("/coupons/validate"),await a({method:"POST",body:JSON.stringify(e)}));return{...t,askedAsShopper:n}},getHeaderSettings:async()=>{let e=Ie({method:"GET"}),t=await o(await g(l("/header-settings")),await a({signal:e})),n=E(t.logoUrl),r=null,s=null;if(n&&V(n)){let i=await be(n,e);i&&(r=i.reversed,s=i.inkIsDark)}return{...t,logoUrl:n,logoReversed:r,logoInkIsDark:s}},getThemeSettings:async()=>o(await g(l("/theme-settings")),await a()),getChatSettings:async()=>o(await g(l("/chat-settings")),await a())},Tn={listServices:async()=>{try{return await o(l("/bookings/services"),await a())}catch(e){return console.warn("[bookings.listServices] API unavailable, returning []",e),{results:[],currency:"USD"}}},getAvailability:async(e,t)=>o(l(`/bookings/availability?service=${encodeURIComponent(e)}&date=${t}`),await a()),create:async e=>o(l("/bookings"),await a({method:"POST",body:JSON.stringify(e)})),get:async e=>o(l(`/bookings/manage/${encodeURIComponent(e)}`),await a()),cancel:async e=>o(l(`/bookings/manage/${encodeURIComponent(e)}/cancel`),await a({method:"POST"})),createPaymentIntent:async e=>o(l("/bookings/payments/intent"),await a({method:"POST",body:JSON.stringify({manageToken:e})}))},Z=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"}},C=e=>e?`/api/storefront/header-settings/?${new URLSearchParams({site:e})}`:"/api/storefront/header-settings/",Ce=e=>e?`/api/storefront/theme-settings/?${new URLSearchParams({site:e})}`:"/api/storefront/theme-settings/",Oe=e=>e?`/api/storefront/chat-settings/?${new URLSearchParams({site:e})}`:"/api/storefront/chat-settings/",ve=e=>`/api/storefront/social-settings/?${new URLSearchParams({site:e})}`,Q=e=>`/api/storefront/sites/${encodeURIComponent(e)}/`,$t=e=>`${Q(e)}currencies/`,Ut="/api/storefront/media/ingest/",Y=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 Mt(){let e=we();if(!e)throw new Y;return`${Ut}?${new URLSearchParams({site:e})}`}var q={"X-Puck-Media-Manifest":ae.contentHash},c=(e,t={})=>o(e,{...t,audience:"admin"}),Cn={findPageBySlug:async(e,t,n)=>{let r=new URLSearchParams({slug:e});n&&r.set("site",n);let s=await c(`/api/storefront/pages/?${r.toString()}`,{token:t}),i=Array.isArray(s)?s:s.results??[];if(!n&&i.length>1)throw new Z(e,i.length);return i[0]??null},getPageById:(e,t)=>c(`/api/storefront/pages/${e}/`,{token:t}),saveLayout:(e,t,n,r,s)=>c(`/api/storefront/pages/${e}/`,{method:"PATCH",body:JSON.stringify({layout:t,expected_updated_at:r,...s?{client_id:s}:{}}),token:n}),publishPage:(e,t,n)=>c(`/api/storefront/pages/${e}/publish/`,{method:"POST",body:n?JSON.stringify({expected_updated_at:n}):void 0,token:t}),claimPageEditLock:(e,t,n,r=!1)=>c(`/api/storefront/pages/${e}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:n,takeover:r}),token:t}),releasePageEditLock:(e,t)=>c(`/api/storefront/pages/${e}/edit-lock/`,{method:"DELETE",token:t}),createTemplate:(e,t,n)=>c("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:e,layout:t}),headers:q,token:n}),getTemplate:(e,t)=>c(`/api/storefront/page-templates/${e}/`,{token:t}),saveTemplateLayout:(e,t,n)=>c(`/api/storefront/page-templates/${e}/`,{method:"PATCH",body:JSON.stringify({layout:t}),headers:q,token:n}),listTemplatePages:async(e,t)=>{let n=await c(`/api/storefront/template-pages/?template=${encodeURIComponent(e)}`,{token:t});return Array.isArray(n)?n:n.results??[]},findTemplatePageBySlug:async(e,t,n)=>{let r=await c(`/api/storefront/template-pages/?template=${encodeURIComponent(e)}&slug=${encodeURIComponent(t)}`,{token:n});return(Array.isArray(r)?r:r.results??[])[0]??null},createTemplatePage:(e,t,n)=>c("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:e,...t}),headers:q,token:n}),saveTemplatePageLayout:(e,t,n)=>c(`/api/storefront/template-pages/${e}/`,{method:"PATCH",body:JSON.stringify({layout:t}),headers:q,token:n}),deleteTemplatePage:(e,t)=>c(`/api/storefront/template-pages/${e}/`,{method:"DELETE",token:t}),listPages:async(e,t)=>{let n=new URLSearchParams({no_page:"true"});t&&n.set("site",t);let r=await c(`/api/storefront/pages/?${n.toString()}`,{token:e});return Array.isArray(r)?r:r.results??[]},createPage:(e,t,n,r)=>c("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:e,slug:t,layout:n}),token:r}),deletePage:(e,t)=>c(`/api/storefront/pages/${e}/`,{method:"DELETE",token:t}),getHeaderSettings:(e,t)=>c(C(t),{token:e}),listMenus:async(e,t)=>{let n=new URLSearchParams({no_page:"true"});t&&n.set("site",t);let r=await c(`/api/storefront/menus/?${n}`,{token:e});return Array.isArray(r)?r:r.results??[]},listBlogPosts:async(e,t={})=>{let n=new URLSearchParams({no_page:"true"});t.visibleOnly&&n.set("is_visible","true"),t.siteId&&n.set("site",t.siteId);let r=await c(`/api/storefront/blog-posts/?${n.toString()}`,{token:e});return Array.isArray(r)?r:r.results??[]},listCategories:async(e,t={})=>{let n=new URLSearchParams({no_page:"true"});t.visibleOnly&&n.set("is_visible","true"),t.siteId&&n.set("site",t.siteId);let r=await c(`/api/storefront/categories/?${n.toString()}`,{token:e});return[...Array.isArray(r)?r:r.results??[]].sort((i,u)=>i.sort_order-u.sort_order||i.name.localeCompare(u.name))},listForms:async(e,t={})=>{let n=new URLSearchParams({no_page:"true"});t.siteId&&n.set("site",t.siteId);let r=await c(`/api/storefront/forms/?${n.toString()}`,{token:e});return[...Array.isArray(r)?r:r.results??[]].sort((i,u)=>i.title.localeCompare(u.title))},listWheelSummaries:async(e,t={})=>{let n=new URLSearchParams;t.siteId&&n.set("site",t.siteId);let r=n.toString(),s=await c(`/api/storefront/wheel-curations/summaries/${r?`?${r}`:""}`,{token:e});return h(s)},listProducts:async(e,t={})=>{let n=new URLSearchParams;t.kinds?.length&&n.set("kind",t.kinds.join(",")),t.siteId&&n.set("site",t.siteId);let r=n.toString(),s=await c(`/api/storefront/products/${r?`?${r}`:""}`,{token:e});return h(s)},getWheelDetail:async(e,t,n={})=>{let r=new URLSearchParams({slug:t});return n.siteId&&r.set("site",n.siteId),R(h(await c(`/api/storefront/wheel-curations/detail/?${r.toString()}`,{token:e})))},updateHeaderSettings:(e,t,n)=>c(C(n),{method:"PATCH",body:JSON.stringify(e),token:t}),getSite:(e,t)=>c(Q(e),{token:t}),listSiteCurrencies:async(e,t)=>{let n=await c($t(e),{token:t});return Array.isArray(n)?n:[]},updateSite:(e,t,n)=>c(Q(e),{method:"PATCH",body:JSON.stringify(t),token:n}),getThemeSettings:(e,t)=>c(Ce(t),{token:e}),updateThemeSettings:(e,t,n)=>c(Ce(n),{method:"PATCH",body:JSON.stringify(e),token:t}),getChatSettings:(e,t)=>c(Oe(t),{token:e}),updateChatSettings:(e,t,n)=>c(Oe(n),{method:"PATCH",body:JSON.stringify(e),token:t}),getSocialSettings:(e,t)=>c(ve(t),{token:e}),updateSocialSettings:(e,t,n)=>c(ve(n),{method:"PATCH",body:JSON.stringify(e),token:t}),uploadHeaderLogo:(e,t,n)=>{let r=new FormData;return r.append("logo",e),c(C(n),{method:"PATCH",body:r,token:t})},clearHeaderLogo:(e,t)=>c(C(t),{method:"PATCH",body:JSON.stringify({logo:null}),token:e}),setHeaderLogoFromAsset:(e,t,n)=>c(C(n),{method:"PATCH",body:JSON.stringify({logo_asset_id:e}),token:t}),uploadMedia:async(e,t)=>{let n=new FormData;return n.append("file",e),c(Mt(),{method:"POST",body:n,token:t})},listMedia:async(e,t)=>{let n=new URLSearchParams({no_page:"true"});t&&n.set("kind",t);let r=await c(`/api/storefront/media-assets/?${n.toString()}`,{token:e});return Array.isArray(r)?r:r.results??[]}};export{Ue as a,Me as b,He as c,De as d,We as e,_ as f,Ht as g,Dt as h,ee as i,G as j,Ye as k,E as l,on as m,an as n,ln as o,cn as p,ne as q,re as r,ae as s,jt as t,v as u,Zt as v,Qt as w,b as x,je as y,V as z,we as A,Gt as B,se as C,ht as D,f as E,z as F,K as G,o as H,At as I,Rt as J,Ne as K,Ft as L,Bt as M,qt as N,xn as O,kn as P,Tn as Q,Z as R,c as S,Cn as T};