email-builder-online 4.1.6 → 4.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -499,7 +499,7 @@ ${l}
499
499
  <style>html,body{margin:0;padding:0;background:transparent;}body{font-family:Helvetica,Arial,sans-serif;}</style>
500
500
  </head>
501
501
  <body></body>
502
- </html>`,G6e="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900&family=Montserrat:ital,wght@0,100..900;1,100..900&family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Oswald:wght@200..700&family=Pacifico&family=Playfair:ital,opsz,wght@0,5..1200,300..900;1,5..1200,300..900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap";function V6e(t,e){const n=t.head;if(n.querySelector("link[data-eb-fonts]")===null){const r=t.createElement("link");r.setAttribute("data-eb-fonts","1"),r.rel="stylesheet",r.href=G6e,n.appendChild(r)}if(n.querySelector("style[data-eb-globals]")===null){const r=t.createElement("style");r.setAttribute("data-eb-globals","1"),r.textContent=$Q,n.appendChild(r)}t.body.style.backgroundColor=e}function q6e(){const t=sn(),{t:e}=Ie("inspector"),n=T6e(),r=T.useRef(null),i=T.useRef(null),[a,o]=T.useState(null),[s,l]=T.useState(null),[c,u]=T.useState("root"),[d,f]=T.useState(!1),[m,h]=T.useState(null),[g,_]=T.useState(null),[b,y]=T.useState(!1),[E,v]=T.useState("desktop"),x=T.useRef(null),S=T.useCallback(()=>{const I=r.current;if(I===null)return;const P=I.contentDocument;if(P===null)return;const B=(X.getState().document.root?.data??{}).backdropColor??iO;V6e(P,B),o(P.body)},[]);T.useEffect(()=>{if(n===null)return;const I=`${n.category}|${n.axis}|${n.id}`;x.current=I,h(null),y(!1),v("desktop");let P=!1;j6e(n).then(L=>{x.current===I&&(P=!0,T.startTransition(()=>{l(L.doc),u(L.rootBlockId)}),f(!1))}).catch(L=>{x.current===I&&(P=!0,h(L instanceof Error?L.message:String(L)),f(!1))}),Promise.resolve().then(()=>{!P&&x.current===I&&f(!0)})},[n]),T.useEffect(()=>{if(a===null||n===null)return;const P=(X.getState().document.root?.data??{}).backdropColor??iO;a.style.backgroundColor=P},[a,n]),T.useEffect(()=>{if(a===null)return;const I=()=>_(a.scrollHeight);I();const P=new ResizeObserver(I);return P.observe(a),()=>P.disconnect()},[a,s]);const C=E==="mobile"?$6e:B6e,k=g??zx,w=Ux/C,D=b?w:Math.min(w,zx/k),A=C*D,M=k*D;T.useEffect(()=>{i.current&&(i.current.scrollTop=0)},[b,E,n]);const R=T.useMemo(()=>s===null?null:p.jsx(qS,{document:s,rootBlockId:c,viewport:E}),[s,c,E]);return p.jsx(Kf,{open:n!==null,anchorEl:n?.anchor??null,placement:"right-start",keepMounted:!0,modifiers:[{name:"offset",options:{offset:[0,8]}},{name:"preventOverflow",options:{boundary:"viewport",padding:8}},{name:"flip",options:{fallbackPlacements:["left-start","top","bottom"]}}],sx:{zIndex:t.zIndex.tooltip+1,pointerEvents:n!==null?"auto":"none",visibility:n!==null?"visible":"hidden"},children:p.jsxs(ya,{elevation:6,onMouseEnter:x6e,onMouseLeave:$N,sx:{width:Ux+24,padding:1.5,display:"flex",flexDirection:"column",gap:1,backgroundColor:t.palette.background.paper,border:`1px solid ${t.palette.divider}`},children:[p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:.5},children:[p.jsx(xe,{variant:"caption",color:"text.secondary",sx:{fontWeight:600,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n?.name??""}),p.jsx(Pt,{title:E==="mobile"?e("componentsLibrary.preview.desktop","Desktop view"):e("componentsLibrary.preview.mobile","Mobile view"),children:p.jsx(cn,{size:"small",onClick:()=>v(I=>I==="mobile"?"desktop":"mobile"),sx:{flexShrink:0},children:E==="mobile"?p.jsx(D6e,{fontSize:"small"}):p.jsx(R6e,{fontSize:"small"})})}),p.jsx(Pt,{title:b?e("componentsLibrary.preview.fit","Fit to view"):e("componentsLibrary.preview.zoom","Zoom in"),children:p.jsx(cn,{size:"small",onClick:()=>y(I=>!I),sx:{flexShrink:0},children:b?p.jsx(P6e,{fontSize:"small"}):p.jsx(F6e,{fontSize:"small"})})})]}),p.jsxs(H,{ref:i,sx:{position:"relative",width:Ux,height:zx,mx:"auto",display:"flex",justifyContent:"center",alignItems:"flex-start",backgroundColor:t.palette.action.hover,borderRadius:1,overflowY:b?"auto":"hidden",overflowX:"hidden"},children:[p.jsx(H,{sx:{position:"relative",width:A,height:M,flexShrink:0},children:p.jsx("iframe",{ref:r,srcDoc:H6e,title:e("componentsLibrary.preview.iframeTitle","Live preview"),sandbox:"allow-same-origin",onLoad:S,style:{position:"absolute",top:0,left:0,width:C,height:k,border:0,display:"block",backgroundColor:"transparent",transform:`scale(${D})`,transformOrigin:"top left",pointerEvents:"none"}})}),a!==null&&R!==null&&m===null&&gl.createPortal(R,a),d&&p.jsx(H,{sx:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255,255,255,0.6)"},children:p.jsx(ti,{size:24})}),m!==null&&p.jsx(H,{sx:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",p:2,backgroundColor:t.palette.background.paper},children:p.jsx(xe,{variant:"body2",color:"error",sx:{textAlign:"center"},children:m})})]})]})})}const W6e=["updatedDesc","createdDesc","nameAsc","nameDesc","sizeDesc","sizeAsc","blocksDesc","blocksAsc"];function Y6e(t,e){const n=e.search.trim().toLowerCase();return t.filter(r=>{if(e.axes.length>0&&!e.axes.includes(r.axis))return!1;if(e.tags.length>0){const i=r.tags??[];if(!e.tags.every(a=>i.includes(a)))return!1}return!(n.length>0&&![r.name,r.description??"",r.axis,...r.tags??[]].join(" ").toLowerCase().includes(n))})}function K6e(t,e){const n=[...t],r=(i,a)=>i.name.localeCompare(a.name);switch(e){case"nameAsc":return n.sort(r);case"nameDesc":return n.sort((i,a)=>r(a,i));case"createdDesc":return n.sort((i,a)=>i.createdAt<a.createdAt?1:i.createdAt>a.createdAt?-1:0);case"sizeAsc":return n.sort((i,a)=>i.sizeBytes-a.sizeBytes);case"sizeDesc":return n.sort((i,a)=>a.sizeBytes-i.sizeBytes);case"blocksAsc":return n.sort((i,a)=>i.blockCount-a.blockCount);case"blocksDesc":return n.sort((i,a)=>a.blockCount-i.blockCount);case"updatedDesc":default:return n.sort((i,a)=>i.updatedAt<a.updatedAt?1:i.updatedAt>a.updatedAt?-1:0)}}function Q6e(t){const e=new Set;for(const n of t)for(const r of n.tags??[])e.add(r);return Array.from(e).sort()}var Qm={},A5;function X6e(){if(A5)return Qm;A5=1;var t=ar();Object.defineProperty(Qm,"__esModule",{value:!0}),Qm.default=void 0;var e=t(_r()),n=p;return Qm.default=(0,e.default)((0,n.jsx)("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}),"CheckOutlined"),Qm}var J6e=X6e();const Z6e=Vn(J6e);var Xm={},O5;function e5e(){if(O5)return Xm;O5=1;var t=ar();Object.defineProperty(Xm,"__esModule",{value:!0}),Xm.default=void 0;var e=t(_r()),n=p;return Xm.default=(0,e.default)((0,n.jsx)("path",{d:"M16 9v10H8V9zm-1.5-6h-5l-1 1H5v2h14V4h-3.5zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2z"}),"DeleteOutlined"),Xm}var t5e=e5e();const n5e=Vn(t5e);var Jm={},R5;function r5e(){if(R5)return Jm;R5=1;var t=ar();Object.defineProperty(Jm,"__esModule",{value:!0}),Jm.default=void 0;var e=t(_r()),n=p;return Jm.default=(0,e.default)((0,n.jsx)("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"}),"EditOutlined"),Jm}var i5e=r5e();const a5e=Vn(i5e);async function sb(t){const e=await t.json().catch(()=>null);if(!t.ok)throw t.status===403&&e?.hint?new Error(e.hint):new Error(e?.error??`HTTP ${t.status}`);return e}async function o5e(){if(Fs()==="local")return X4e();const t=await fetch(`${zr()}/dev/themes`);return(await sb(t)).themes}async function s5e(t){if(Fs()==="local")return J4e(t);const e=await fetch(`${zr()}/dev/themes/${encodeURIComponent(t)}`);return sb(e)}async function iX(t){if(Fs()==="local")return Z4e(t);const e=await fetch(`${zr()}/dev/save-theme`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return sb(e)}async function l5e(t,e){if(Fs()==="local")return e6e(t,e);const n=await fetch(`${zr()}/dev/themes/${encodeURIComponent(t)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return sb(n)}async function c5e(t){if(Fs()==="local")return t6e(t);const e=await fetch(`${zr()}/dev/themes/${encodeURIComponent(t)}`,{method:"DELETE"});return sb(e)}function u5e({themeId:t,themeName:e,onClose:n,onApplied:r}){const{t:i}=Ie("inspector"),[a,o]=T.useState(!1),[s,l]=T.useState(null),c=T.useCallback(()=>{a||(l(null),n())},[a,n]),u=T.useCallback(async()=>{if(!(!t||a)){o(!0),l(null);try{const d=await s5e(t),f=Wve.safeParse(d);if(!f.success)throw new Error(i("theme.apply.errorMalformed","Saved theme failed schema validation."));aI(f.data,t),r?.(t),n()}catch(d){l(d instanceof Error?d.message:String(d))}finally{o(!1)}}},[t,a,r,n,i]);return p.jsxs(Is,{open:t!==null,onClose:c,maxWidth:"sm",fullWidth:!0,children:[p.jsx(Ms,{children:i("theme.apply.title",'Apply theme "{{name}}"?',{name:e})}),p.jsx(Ps,{children:p.jsxs(qe,{gap:2,sx:{mt:1},children:[p.jsx(xe,{variant:"body2",color:"text.secondary",children:i("theme.apply.body","This will overwrite your current root globals and per-block-type theme overrides. You can undo this action.")}),s&&p.jsx($n,{severity:"error",children:s})]})}),p.jsxs(Ns,{children:[p.jsx(ht,{onClick:c,disabled:a,children:i("theme.apply.cancel","Cancel")}),p.jsx(ht,{onClick:u,variant:"contained",disabled:a,children:a?i("theme.apply.applying","Applying…"):i("theme.apply.submit","Apply")})]})]})}const jx=100,Hx=280;function d5e({target:t,onClose:e,onRenamed:n}){const{t:r}=Ie("inspector"),[i,a]=T.useState(""),[o,s]=T.useState(""),[l,c]=T.useState(!1),[u,d]=T.useState(null);T.useEffect(()=>{t&&(a(t.name),s(t.description??""),d(null))},[t]);const f=i.trim(),m=f.length>0&&f.length<=jx&&o.length<=Hx,h=t!==null&&(f!==t.name||o!==(t.description??"")),g=T.useCallback(()=>{l||e()},[l,e]),_=T.useCallback(async()=>{if(!(!t||!m||!h||l)){c(!0),d(null);try{await l5e(t.id,{name:f,description:o.length===0?"":o}),n?.(t.id),e()}catch(b){d(b instanceof Error?b.message:String(b))}finally{c(!1)}}},[t,m,h,l,f,o,e,n]);return p.jsxs(Is,{open:t!==null,onClose:g,maxWidth:"sm",fullWidth:!0,children:[p.jsx(Ms,{children:r("theme.rename.title","Rename theme")}),p.jsx(Ps,{children:p.jsxs(qe,{gap:2,sx:{mt:1},children:[p.jsx(Ir,{label:r("theme.save.nameLabel","Name"),value:i,onChange:b=>a(b.target.value),autoFocus:!0,fullWidth:!0,disabled:l,inputProps:{maxLength:jx},helperText:`${f.length}/${jx}`}),p.jsx(Ir,{label:r("theme.save.descriptionLabel","Description (optional)"),value:o,onChange:b=>s(b.target.value),fullWidth:!0,multiline:!0,minRows:2,disabled:l,inputProps:{maxLength:Hx},helperText:`${o.length}/${Hx}`}),u&&p.jsx($n,{severity:"error",children:u})]})}),p.jsxs(Ns,{children:[p.jsx(ht,{onClick:g,disabled:l,children:r("theme.save.cancel","Cancel")}),p.jsx(ht,{onClick:_,variant:"contained",disabled:!m||!h||l,children:l?r("theme.save.submitting","Saving…"):r("theme.rename.submit","Save changes")})]})]})}const p5e=120,xu={primary:"#5e6ad2",secondary:"#8e8fff",textColor:"#1f2328",backdrop:"#f4f4f4",canvas:"#ffffff",fontFamily:'"Inter", system-ui, sans-serif'};function f5e({globals:t,height:e=p5e,alt:n}){const r=sn(),i=t?.primaryColor??xu.primary,a=t?.secondaryColor??xu.secondary,o=t?.textColor??xu.textColor,s=t?.headingTextColor??t?.textColor??xu.textColor,l=t?.backdropColor??t?.bodyBackgroundColor??xu.backdrop,c=t?.canvasColor??t?.canvasBackgroundColor??xu.canvas,u=t?.fontFamily??xu.fontFamily;return p.jsx(H,{"aria-label":n,sx:{width:"100%",height:e,borderRadius:1,overflow:"hidden",backgroundColor:l,display:"flex",alignItems:"center",justifyContent:"center",padding:"8px",pointerEvents:"none",border:`1px solid ${r.palette.divider}`},children:p.jsxs(H,{sx:{width:"100%",height:"100%",backgroundColor:c,borderRadius:.5,padding:"6px 8px",display:"flex",flexDirection:"column",gap:"4px",fontFamily:u},children:[p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0},children:[p.jsx(H,{sx:{width:10,height:10,borderRadius:"50%",backgroundColor:i}}),p.jsx(H,{sx:{width:10,height:10,borderRadius:"50%",backgroundColor:a}}),p.jsx(H,{sx:{width:10,height:10,borderRadius:.5,backgroundColor:o}}),p.jsx(H,{sx:{flex:1}}),p.jsx(H,{sx:{fontSize:8,fontWeight:500,color:o,opacity:.6,lineHeight:1,maxWidth:60,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:"Aa Bb"})]}),p.jsx(H,{sx:{fontSize:11,fontWeight:700,color:s,lineHeight:1.2},children:"Heading Sample"}),p.jsx(H,{sx:{fontSize:8,color:o,lineHeight:1.3,opacity:.85},children:"Body sample text"}),p.jsx(H,{sx:{height:1,width:"40%",backgroundColor:r.palette.divider,my:"2px"}}),p.jsx(H,{sx:{alignSelf:"flex-start",mt:"auto",backgroundColor:i,color:"#ffffff",fontSize:8,fontWeight:600,padding:"3px 8px",borderRadius:.5,lineHeight:1},children:"Button"})]})})}function m5e({item:t,selected:e,onApply:n,onRename:r,onDelete:i,t:a,themeBorder:o,themeHoverBg:s,themeHoverBorder:l,themeSelectedBorder:c}){return p.jsxs(H,{onMouseEnter:u=>nX({anchor:u.currentTarget,category:"theme",axis:"",id:t.id,name:t.name,themeBundle:{globals:t.globals,blocks:t.blocks}}),onMouseLeave:$N,onClick:()=>n(t),sx:{p:1,borderRadius:1,border:e?"2px solid":"1px solid",borderColor:e?c:o,cursor:"pointer",display:"flex",flexDirection:"column",gap:.75,transition:"background-color 120ms ease, border-color 120ms ease","&:hover":{backgroundColor:s,borderColor:e?c:l}},children:[p.jsx(f5e,{globals:t.globals,alt:t.name}),p.jsxs(H,{sx:{display:"flex",alignItems:"flex-start",gap:.75},children:[p.jsxs(H,{sx:{minWidth:0,flex:1},children:[p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:.5,minWidth:0},children:[p.jsx(xe,{variant:"body2",sx:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:t.name,children:t.name}),e&&p.jsx(sa,{size:"small",color:"primary",icon:p.jsx(Z6e,{}),label:a("theme.applied.badge","Selected"),sx:{height:18,flexShrink:0,"& .MuiChip-label":{px:.5,fontSize:11}}})]}),t.description&&p.jsx(xe,{variant:"caption",color:"text.secondary",sx:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:t.description})]}),p.jsxs(qe,{direction:"row",gap:0,sx:{flexShrink:0},children:[p.jsx(Pt,{title:a("componentsLibrary.drawer.themes.rename","Rename theme"),children:p.jsx(cn,{size:"small",onClick:u=>{u.stopPropagation(),r(t)},children:p.jsx(a5e,{fontSize:"small"})})}),p.jsx(Pt,{title:a("componentsLibrary.drawer.themes.delete","Delete theme"),children:p.jsx(cn,{size:"small",onClick:u=>{u.stopPropagation(),i(t)},children:p.jsx(n5e,{fontSize:"small"})})})]})]})]})}function h5e({refreshKey:t,onChange:e,search:n="",onCounts:r}){const{t:i}=Ie("inspector"),a=sn(),o=LG(),[s,l]=T.useState([]),[c,u]=T.useState(!1),[d,f]=T.useState(null),[m,h]=T.useState(null),[g,_]=T.useState(null),b=T.useCallback(async()=>{u(!0),f(null);try{const v=await o5e();l(v)}catch(v){f(v instanceof Error?v.message:String(v))}finally{u(!1)}},[]);T.useEffect(()=>{b()},[b,t]);const y=T.useMemo(()=>{const v=n.trim().toLowerCase();return v?s.filter(x=>`${x.name} ${x.description??""}`.toLowerCase().includes(v)):s},[s,n]);T.useEffect(()=>{r?.(y.length,s.length)},[y.length,s.length,r]);const E=T.useCallback(async v=>{if(window.confirm(i("componentsLibrary.drawer.themes.deleteConfirm",'Delete theme "{{name}}"? This cannot be undone.',{name:v.name})))try{await c5e(v.id),e()}catch(S){f(S instanceof Error?S.message:String(S))}},[i,e]);return d?p.jsx($n,{severity:"error",sx:{mt:1},children:d}):c&&s.length===0?p.jsx(xe,{variant:"body2",color:"text.secondary",sx:{mt:1},children:i("componentsLibrary.drawer.themes.loading","Loading themes…")}):!c&&s.length===0?p.jsx(xe,{variant:"body2",color:"text.secondary",sx:{mt:1},children:i("componentsLibrary.drawer.themes.empty","No themes saved yet.")}):p.jsxs(p.Fragment,{children:[y.length===0?p.jsx(xe,{variant:"body2",color:"text.secondary",sx:{mt:1},children:i("componentsLibrary.drawer.noResults","No components match your search.")}):p.jsx(qe,{gap:1.5,sx:{mt:1},children:y.map(v=>p.jsx(m5e,{item:v,selected:o===v.id,onApply:h,onRename:_,onDelete:E,t:i,themeBorder:a.palette.divider,themeHoverBg:a.palette.action.hover,themeHoverBorder:a.palette.secondary.main,themeSelectedBorder:a.palette.primary.main},v.id))}),p.jsx(u5e,{themeId:m?.id??null,themeName:m?.name??"",onClose:()=>h(null),onApplied:()=>{h(null),e()}}),p.jsx(d5e,{target:g,onClose:()=>_(null),onRenamed:()=>{_(null),e()}})]})}const g5e=120,_5e=641,b5e=600;function y5e({id:t,block:e,height:n=g5e,alt:r}){const i=sn(),a=T.useRef(null),[o,s]=T.useState(!1),l=X(u=>u.document?.root?.data),c=T.useMemo(()=>{if(!o)return null;try{const u=l?.theme,d=Jg(e,u);return LBe({id:t,block:d},{rootData:l})}catch{return null}},[o,t,e,l]);return T.useEffect(()=>{if(o)return;const u=a.current;if(u===null)return;if(typeof IntersectionObserver>"u"){s(!0);return}const d=new IntersectionObserver(f=>{for(const m of f)if(m.isIntersecting){s(!0),d.disconnect();break}},{rootMargin:"200px"});return d.observe(u),()=>d.disconnect()},[o]),p.jsx(H,{ref:a,sx:{width:"100%",height:n,borderRadius:1,backgroundColor:i.palette.action.hover,overflow:"hidden",position:"relative",pointerEvents:"none"},"aria-label":r,children:c!==null&&p.jsx("iframe",{srcDoc:c,title:r,sandbox:"allow-same-origin",loading:"lazy",style:{width:`${_5e}px`,height:`${b5e}px`,border:0,transform:"scale(0.4)",transformOrigin:"top left",position:"absolute",top:0,left:0,backgroundColor:"#ffffff"}})})}var Zm={},I5;function v5e(){if(I5)return Zm;I5=1;var t=ar();Object.defineProperty(Zm,"__esModule",{value:!0}),Zm.default=void 0;var e=t(_r()),n=p;return Zm.default=(0,e.default)((0,n.jsx)("path",{d:"m21.9 21.9-6.1-6.1-2.69-2.69L5 5 3.59 3.59 2.1 2.1.69 3.51 3 5.83V19c0 1.1.9 2 2 2h13.17l2.31 2.31zM5 19V7.83l6.84 6.84-.84 1.05L9 13l-3 4h8.17l2 2zM7.83 5l-2-2H19c1.1 0 2 .9 2 2v13.17l-2-2V5z"}),"ImageNotSupportedOutlined"),Zm}var E5e=v5e();const S5e=Vn(E5e);function C5e({src:t,alt:e,height:n=120,placeholderText:r}){const i=sn(),a={width:"100%",height:n,borderRadius:4,backgroundColor:i.palette.background.default,display:"block"};return t===null?p.jsxs(H,{sx:{...a,border:`1px dashed ${i.palette.divider}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.5,color:"text.secondary"},"aria-label":e,children:[p.jsx(S5e,{sx:{fontSize:24,opacity:.6}}),r!==void 0&&p.jsx(xe,{variant:"caption",sx:{opacity:.7},children:r})]}):p.jsx("img",{src:t,alt:e,loading:"lazy",decoding:"async",style:{...a,objectFit:"cover",objectPosition:"top center",border:`1px solid ${i.palette.divider}`},onError:o=>{const s=o.currentTarget;s.style.display="none"}})}const x5e={section:"sections",layout:"layouts",template:"templates"};function T5e(t,e,n){const r=zr(),i=x5e[t];if(t==="template")return`${r}/dev/${i}/${encodeURIComponent(n)}/thumbnail`;if(e===null)throw new Error(`category '${t}' requires an axis but received null`);return`${r}/dev/${i}/${encodeURIComponent(e)}/${encodeURIComponent(n)}/thumbnail`}const oO=380,xg="__other__",N5=[{key:"sections",labelKey:"componentsLibrary.drawer.category.sections",enabled:!0},{key:"primitives",labelKey:"componentsLibrary.drawer.category.primitives",enabled:!0},{key:"layouts",labelKey:"componentsLibrary.drawer.category.layouts",enabled:!0},{key:"templates",labelKey:"componentsLibrary.drawer.category.templates",enabled:!0},{key:"themes",labelKey:"componentsLibrary.drawer.category.themes",enabled:!0}];function P5({item:t,category:e,onClick:n}){const{t:r}=Ie("inspector"),i=sn(),a=e!=="template",[{isDragging:o},s]=LE(()=>({type:El,item:()=>({kind:El,category:e,axis:t.axis,id:t.id}),canDrag:()=>a,collect:d=>({isDragging:d.isDragging()})}),[e,t.axis,t.id,a]);T.useEffect(()=>{o&&rX()},[o]);const l=e==="section"||e==="layout"||e==="template",c=e==="primitive"&&t.block!==void 0,u=l&&t.hasThumbnail?T5e(e,e==="template"?null:t.axis,t.id):null;return p.jsxs(H,{ref:d=>{a&&d&&s(d)},onMouseEnter:d=>nX({anchor:d.currentTarget,category:e,axis:t.axis,id:t.id,name:t.name,primitiveBlock:e==="primitive"?t.block:void 0}),onMouseLeave:$N,onClick:n?()=>n(t):void 0,sx:{p:1,borderRadius:1,border:"1px dashed",borderColor:i.palette.divider,cursor:n?"pointer":"grab",opacity:o?.5:1,display:"flex",flexDirection:"column",gap:.75,transition:"background-color 120ms ease, border-color 120ms ease","&:hover":{backgroundColor:i.palette.action.hover,borderColor:i.palette.secondary.main},"&:active":{cursor:"grabbing"}},children:[c&&p.jsx(y5e,{id:t.id,block:t.block,alt:t.name}),l&&p.jsx(C5e,{src:u,alt:t.name,placeholderText:r("componentsLibrary.thumbnail.placeholder","No preview")}),p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:.75},children:[p.jsx(ZQ,{sx:{fontSize:16,color:"text.secondary",flexShrink:0,display:a?"inline-flex":"none"}}),p.jsx(H,{sx:{minWidth:0,flex:1},children:p.jsx(xe,{variant:"body2",sx:{fontSize:"0.8rem",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:t.name,children:t.name})})]})]})}const Gx=24;function k5e({items:t,columns:e,renderItem:n}){const[r,i]=T.useState(Gx),a=T.useRef(null);return T.useEffect(()=>{i(Gx)},[t]),T.useEffect(()=>{const o=a.current;if(!o)return;const s=new IntersectionObserver(l=>{l[0]?.isIntersecting&&i(c=>c<t.length?Math.min(t.length,c+Gx):c)},{rootMargin:"300px"});return s.observe(o),()=>s.disconnect()},[t.length,r]),p.jsxs(H,{sx:{mt:1.5},children:[p.jsx(H,{sx:{display:"grid",gridTemplateColumns:`repeat(${e}, minmax(0, 1fr))`,gap:.5},children:t.slice(0,r).map(o=>n(o))}),r<t.length&&p.jsx(H,{ref:a,sx:{height:1}})]})}function o0({title:t,items:e,category:n,loading:r,error:i,groupLabelKey:a,columns:o,virtualize:s,search:l,sort:c,expanded:u,onToggle:d,onClick:f,onRename:m,onDelete:h}){const{t:g}=Ie("inspector"),[_,b]=T.useState([]),[y,E]=T.useState({}),v=T.useMemo(()=>Q6e(e),[e]),x=T.useMemo(()=>({search:l,axes:[],tags:_,sort:c}),[l,_,c]),S=T.useMemo(()=>K6e(Y6e(e,x),c),[e,x,c]),C=T.useMemo(()=>{const M=new Map;for(const I of S){const P=M.get(I.axis)??[];P.push(I),M.set(I.axis,P)}return Array.from(M.keys()).sort((I,P)=>I===xg?1:P===xg?-1:I.localeCompare(P)).map(I=>({axis:I,items:M.get(I)??[]}))},[S]),k=C.length===0||C.length===1&&C[0].axis==="",w=M=>M===xg?g("componentsLibrary.drawer.usageOther","Other"):a?g(`${a}.${M}`,M):M,D=(M,R)=>s?p.jsx(k5e,{items:M,columns:o??2,renderItem:I=>p.jsx(P5,{item:I,category:n,onClick:f,onRename:m,onDelete:h},I.id)}):p.jsx(H,{sx:{display:"grid",gridTemplateColumns:o?`repeat(${o}, minmax(0, 1fr))`:"1fr",gap:.5},children:M.map(I=>p.jsx(P5,{item:I,category:n,onClick:f,onRename:m,onDelete:h},`${R}/${I.id}`))}),A=()=>i?p.jsx($n,{severity:"error",sx:{mt:1},children:i}):r&&e.length===0?p.jsx(xe,{variant:"body2",color:"text.secondary",sx:{mt:1},children:g("componentsLibrary.drawer.loading")}):!r&&e.length===0?p.jsx(xe,{variant:"body2",color:"text.secondary",sx:{mt:1},children:g("componentsLibrary.drawer.empty")}):p.jsxs(qe,{gap:1,sx:{pt:.5},children:[v.length>0&&p.jsx(v6e,{items:v,selected:_,onChange:b,title:g("componentsLibrary.search.tagsLabel","Tags")}),S.length===0?p.jsx(xe,{variant:"body2",color:"text.secondary",sx:{mt:1},children:g("componentsLibrary.drawer.noResults","No components match your search.")}):k?D(S,"flat"):p.jsx(H,{children:C.map((M,R)=>p.jsx(y6e,{title:w(M.axis),count:M.items.length,expanded:y[M.axis]??R===0,onToggle:I=>E(P=>({...P,[M.axis]:I})),children:D(M.items,M.axis)},M.axis))})]});return p.jsx(tX,{title:t,count:S.length,total:e.length,expanded:u,onToggle:d,children:A()})}async function s0(t,e){const n=await fetch(t);if(!n.ok){const i=await n.json().catch(()=>null);throw n.status===403?new Error(i?.hint??"Endpoint disabled in this environment."):new Error(i?.error??`HTTP ${n.status}`)}return(await n.json())[e]??[]}function w5e({refreshKey:t,title:e,search:n,sort:r,expanded:i,onToggle:a,onRename:o,onChange:s}){const{t:l}=Ie("inspector"),[c,u]=T.useState([]),[d,f]=T.useState(!1),[m,h]=T.useState(null),g=T.useCallback(async()=>{f(!0),h(null);try{const b=await s0(`${zr()}/dev/sections`,"sections");u(b.map(y=>({...y,axis:y.role})))}catch(b){h(b instanceof Error?b.message:String(b))}finally{f(!1)}},[]);T.useEffect(()=>{g()},[g,t]);const _=T.useCallback(async b=>{if(window.confirm(l("componentsLibrary.drawer.deleteConfirm",'Delete component "{{name}}"? This cannot be undone.',{name:b.name})))try{const E=await fetch(`${zr()}/dev/sections/${encodeURIComponent(b.axis)}/${encodeURIComponent(b.id)}`,{method:"DELETE"});if(!E.ok){const v=await E.json().catch(()=>null);throw new Error(v?.error??`HTTP ${E.status}`)}u(v=>v.filter(x=>!(x.axis===b.axis&&x.id===b.id))),s()}catch(E){h(E instanceof Error?E.message:String(E))}},[l,s]);return p.jsx(o0,{title:e,items:c,category:"section",loading:d,error:m,columns:2,groupLabelKey:"componentsLibrary.sectionRole",search:n,sort:r,expanded:i,onToggle:a,onRename:b=>o({category:"section",axis:b.axis,id:b.id,name:b.name,description:b.description,tags:b.tags}),onDelete:_})}function D5e({refreshKey:t,title:e,search:n,sort:r,expanded:i,onToggle:a,onRename:o,onChange:s}){const[l,c]=T.useState([]),[u,d]=T.useState(!1),[f,m]=T.useState(null),{t:h}=Ie("inspector"),g=T.useCallback(async()=>{d(!0),m(null);try{const b=await s0(`${zr()}/dev/primitives`,"primitives");c(b.map(y=>({...y,axis:y.type})))}catch(b){m(b instanceof Error?b.message:String(b))}finally{d(!1)}},[]);T.useEffect(()=>{g()},[g,t]);const _=T.useCallback(async b=>{if(window.confirm(h("componentsLibrary.drawer.deleteConfirm","Delete?",{name:b.name})))try{const y=await fetch(`${zr()}/dev/primitives/${encodeURIComponent(b.axis)}/${encodeURIComponent(b.id)}`,{method:"DELETE"});if(!y.ok){const E=await y.json().catch(()=>null);throw new Error(E?.error??`HTTP ${y.status}`)}c(E=>E.filter(v=>!(v.axis===b.axis&&v.id===b.id))),s()}catch(y){m(y instanceof Error?y.message:String(y))}},[h,s]);return p.jsx(o0,{title:e,items:l,category:"primitive",loading:u,error:f,columns:2,search:n,sort:r,expanded:i,onToggle:a,onRename:b=>o({category:"primitive",axis:b.axis,id:b.id,name:b.name,description:b.description,tags:b.tags}),onDelete:_})}function A5e({refreshKey:t,title:e,search:n,sort:r,expanded:i,onToggle:a,onRename:o,onChange:s}){const[l,c]=T.useState([]),[u,d]=T.useState(!1),[f,m]=T.useState(null),{t:h}=Ie("inspector"),g=T.useCallback(async()=>{d(!0),m(null);try{const b=await s0(`${zr()}/dev/layouts`,"layouts");c(b.map(y=>({...y,axis:y.shape})))}catch(b){m(b instanceof Error?b.message:String(b))}finally{d(!1)}},[]);T.useEffect(()=>{g()},[g,t]);const _=T.useCallback(async b=>{if(window.confirm(h("componentsLibrary.drawer.deleteConfirm","Delete?",{name:b.name})))try{const y=await fetch(`${zr()}/dev/layouts/${encodeURIComponent(b.axis)}/${encodeURIComponent(b.id)}`,{method:"DELETE"});if(!y.ok){const E=await y.json().catch(()=>null);throw new Error(E?.error??`HTTP ${y.status}`)}c(E=>E.filter(v=>!(v.axis===b.axis&&v.id===b.id))),s()}catch(y){m(y instanceof Error?y.message:String(y))}},[h,s]);return p.jsx(o0,{title:e,items:l,category:"layout",loading:u,error:f,columns:2,search:n,sort:r,expanded:i,onToggle:a,onRename:b=>o({category:"layout",axis:b.axis,id:b.id,name:b.name,description:b.description,tags:b.tags}),onDelete:_})}function O5e({refreshKey:t,title:e,search:n,sort:r,expanded:i,onToggle:a,onRename:o,onChange:s}){const[l,c]=T.useState([]),[u,d]=T.useState(!1),[f,m]=T.useState(null),[h,g]=T.useState(null),{t:_}=Ie("inspector"),b=T.useCallback(async()=>{d(!0),m(null);try{if(Fs()==="local"){c(q4e().map(v=>({...v,axis:xg})));return}const E=await s0(`${zr()}/dev/templates`,"templates");c(E.map(v=>({...v,axis:v.usage||xg})))}catch(E){m(E instanceof Error?E.message:String(E))}finally{d(!1)}},[]);T.useEffect(()=>{b()},[b,t]);const y=T.useCallback(async E=>{if(window.confirm(_("componentsLibrary.drawer.deleteConfirm","Delete?",{name:E.name})))try{if(Fs()==="local")Q4e(E.id);else{const v=await fetch(`${zr()}/dev/templates/${encodeURIComponent(E.id)}`,{method:"DELETE"});if(!v.ok){const x=await v.json().catch(()=>null);throw new Error(x?.error??`HTTP ${v.status}`)}}c(v=>v.filter(x=>x.id!==E.id)),s()}catch(v){m(v instanceof Error?v.message:String(v))}},[_,s]);return p.jsxs(p.Fragment,{children:[p.jsx(o0,{title:e,items:l,category:"template",loading:u,error:f,columns:2,virtualize:!0,search:n,sort:r,expanded:i,onToggle:a,onClick:g,onRename:E=>o({category:"template",axis:"",id:E.id,name:E.name,description:E.description,tags:E.tags}),onDelete:y}),p.jsx(s6e,{templateId:h?.id??null,templateName:h?.name??"",onClose:()=>g(null),onApplied:()=>g(null)})]})}function R5e({title:t,search:e,expanded:n,onToggle:r,refreshKey:i,onChange:a}){const[o,s]=T.useState({filtered:0,total:0}),l=T.useCallback((c,u)=>s({filtered:c,total:u}),[]);return p.jsx(tX,{title:t,count:o.filtered,total:o.total,expanded:n,onToggle:r,children:p.jsx(h5e,{refreshKey:i,onChange:a,search:e,onCounts:l})})}function I5e(){const t=HG(),e=vS(),n=NG(),r=PG(),{t:i}=Ie("inspector"),a=sn(),o=T.useMemo(()=>N5.filter(R=>!(n==="local"&&R.key!=="templates"&&R.key!=="themes"||!r&&R.key==="templates")),[n,r]),[s,l]=T.useState(0),[c,u]=T.useState(0),[d,f]=T.useState(0),[m,h]=T.useState(0),[g,_]=T.useState(0),[b,y]=T.useState(null),[E,v]=T.useState(""),[x,S]=T.useState("updatedDesc"),[C,k]=T.useState(()=>({[N5[0]?.key??"sections"]:!0})),w=T.useCallback((R,I)=>{k(P=>({...P,[R]:I}))},[]),D=()=>{rX(),E1e(!1)},A=()=>{u(R=>R+1),f(R=>R+1),h(R=>R+1),_(R=>R+1),l(R=>R+1),z6e()},M=T.useCallback(R=>{switch(R){case"section":u(I=>I+1);break;case"primitive":f(I=>I+1);break;case"layout":h(I=>I+1);break;case"template":_(I=>I+1);break}},[]);return e?p.jsxs(H,{sx:{position:"absolute",top:0,left:0,bottom:0,zIndex:10,width:t?oO:0,flexShrink:0,overflow:"hidden",transition:"width 220ms cubic-bezier(0.4, 0, 0.2, 1)",backgroundColor:a.palette.background.paper,borderRight:t?`1px solid ${a.palette.divider}`:"none",display:"flex",flexDirection:"column",pointerEvents:t?"auto":"none"},children:[p.jsxs(H,{sx:{width:oO,height:"100%",display:"flex",flexDirection:"column"},children:[p.jsxs(qe,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{px:1.5,py:1,borderBottom:`1px solid ${a.palette.divider}`},children:[p.jsx(xe,{variant:"subtitle2",children:i("componentsLibrary.drawer.title")}),p.jsxs(qe,{direction:"row",gap:.5,children:[p.jsx(Pt,{title:i("componentsLibrary.drawer.refresh"),children:p.jsx(cn,{size:"small",onClick:A,children:p.jsx(f6e,{fontSize:"small"})})}),p.jsx(Pt,{title:i("componentsLibrary.drawer.close"),children:p.jsx(cn,{size:"small",onClick:D,children:p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("polyline",{points:"11 17 6 12 11 7"}),p.jsx("polyline",{points:"18 17 13 12 18 7"})]})})})]})]}),p.jsxs(H,{sx:{px:1.5,py:1,borderBottom:`1px solid ${a.palette.divider}`},children:[p.jsx(Ir,{size:"small",fullWidth:!0,value:E,onChange:R=>v(R.target.value),placeholder:i("componentsLibrary.search.placeholder","Search…"),sx:Ko,InputProps:{startAdornment:p.jsx(tG,{position:"start",children:p.jsx(g6e,{fontSize:"small"})})}}),p.jsxs(H,{sx:{mt:1},children:[p.jsx(on,{label:i("componentsLibrary.search.sortLabel","Sort")}),p.jsx(ha,{value:x,onChange:R=>S(R.target.value),size:"small",children:W6e.map(R=>p.jsx(Yr,{value:R,sx:{fontSize:"0.8rem"},children:i(`componentsLibrary.search.sort.${R}`,R)},R))})]})]}),p.jsx(H,{sx:{flex:1,minHeight:0,overflowY:"auto",px:1.5,pb:2},children:o.map(R=>{const I={title:i(R.labelKey),search:E,sort:x,expanded:C[R.key]??!1,onToggle:P=>w(R.key,P),onRename:y};switch(R.key){case"sections":return p.jsx(w5e,{...I,refreshKey:c,onChange:()=>u(P=>P+1)},R.key);case"primitives":return p.jsx(D5e,{...I,refreshKey:d,onChange:()=>f(P=>P+1)},R.key);case"layouts":return p.jsx(A5e,{...I,refreshKey:m,onChange:()=>h(P=>P+1)},R.key);case"templates":return p.jsx(O5e,{...I,refreshKey:g,onChange:()=>_(P=>P+1)},R.key);case"themes":return p.jsx(R5e,{title:i(R.labelKey),search:E,expanded:C[R.key]??!1,onToggle:P=>w(R.key,P),refreshKey:s,onChange:()=>l(P=>P+1)},R.key);default:return null}})})]}),p.jsx(a6e,{target:b,onClose:()=>y(null),onRenamed:()=>{b&&M(b.category),y(null)}}),p.jsx(q6e,{})]}):null}var eh={},M5;function N5e(){if(M5)return eh;M5=1;var t=ar();Object.defineProperty(eh,"__esModule",{value:!0}),eh.default=void 0;var e=t(_r()),n=p;return eh.default=(0,e.default)((0,n.jsx)("path",{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m0 14H8V4h12zm-7-2h2v-3h3V9h-3V6h-2v3h-3v2h3z"}),"LibraryAddOutlined"),eh}var P5e=N5e();const aX=Vn(P5e);function M5e(){const t=HG(),e=vS(),{t:n}=Ie("inspector");return e?p.jsx(H,{sx:{position:"absolute",left:t?oO:0,top:"50%",transform:"translateY(-50%)",zIndex:10,transition:"left 220ms cubic-bezier(0.4, 0, 0.2, 1)"},children:p.jsx(Pt,{title:n(t?"componentsLibrary.drawer.handleClose":"componentsLibrary.drawer.handleOpen"),placement:"right",children:p.jsxs(si,{onClick:v1e,"aria-label":n(t?"componentsLibrary.drawer.handleClose":"componentsLibrary.drawer.handleOpen"),sx:r=>({width:28,minHeight:96,borderTopRightRadius:8,borderBottomRightRadius:8,backgroundColor:t?r.palette.secondary.main:r.palette.background.paper,color:t?r.palette.secondary.contrastText:r.palette.text.primary,border:`1px solid ${r.palette.divider}`,borderLeft:"none",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.75,py:1,boxShadow:"2px 0 8px rgba(0,0,0,0.06)",transition:"background-color 120ms ease, color 120ms ease","&:hover":{backgroundColor:t?r.palette.secondary.dark:r.palette.action.hover}}),children:[p.jsx(aX,{sx:{fontSize:18}}),p.jsx(H,{sx:{writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:"0.7rem",fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:n("componentsLibrary.drawer.handle")})]})})}):null}const oX=T.createContext(!1),L5e=oX.Provider,To=()=>T.useContext(oX);function lb(t,e){SS(t,e)}function Bh(t,e){lb(t,n=>{const r=n.data&&"props"in n.data?n.data.props:void 0,i={...r!==null&&typeof r=="object"?r:{}},a=typeof e=="function"?e(i):e,o={...i,...typeof a=="object"&&a!==null?a:{}};return i===o?n:{...n,data:{...n.data,props:o}}})}var th={},L5;function F5e(){if(L5)return th;L5=1;var t=ar();Object.defineProperty(th,"__esModule",{value:!0}),th.default=void 0;var e=t(_r()),n=p;return th.default=(0,e.default)([(0,n.jsx)("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),(0,n.jsx)("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")],"ArticleOutlined"),th}var B5e=F5e();const $5e=Vn(B5e);var nh={},F5;function U5e(){if(F5)return nh;F5=1;var t=ar();Object.defineProperty(nh,"__esModule",{value:!0}),nh.default=void 0;var e=t(_r()),n=p;return nh.default=(0,e.default)((0,n.jsx)("path",{d:"M19 6H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2m0 10H5V8h14z"}),"Crop32Outlined"),nh}var z5e=U5e();const j5e=Vn(z5e);var rh={},B5;function H5e(){if(B5)return rh;B5=1;var t=ar();Object.defineProperty(rh,"__esModule",{value:!0}),rh.default=void 0;var e=t(_r()),n=p;return rh.default=(0,e.default)((0,n.jsx)("path",{d:"M10.27 12h3.46c.93 0 1.63-.83 1.48-1.75l-.3-1.79C14.67 7.04 13.44 6 12 6S9.33 7.04 9.09 8.47l-.3 1.79c-.15.91.55 1.74 1.48 1.74m-8.61-.89c-.13.26-.18.57-.1.88.16.69.76 1.03 1.53 1h1.95c.83 0 1.51-.58 1.51-1.29 0-.14-.03-.27-.07-.4-.01-.03-.01-.05.01-.08.09-.16.14-.34.14-.53 0-.31-.14-.6-.36-.82-.03-.03-.03-.06-.02-.1.07-.2.07-.43.01-.65-.16-.43-.55-.72-.99-.74-.03 0-.05-.01-.07-.03-.17-.21-.48-.35-.83-.35-.3 0-.57.1-.75.26-.03.03-.06.03-.09.02-.14-.06-.3-.09-.46-.09-.65 0-1.18.49-1.24 1.12 0 .02-.01.04-.03.06-.29.26-.46.65-.41 1.05.03.22.12.43.25.6.03.02.03.06.02.09m14.58 2.54c-1.17-.52-2.61-.9-4.24-.9-1.63 0-3.07.39-4.24.9C6.68 14.13 6 15.21 6 16.39V18h12v-1.61c0-1.18-.68-2.26-1.76-2.74m-15.02.93C.48 14.9 0 15.62 0 16.43V18h4.5v-1.61c0-.83.23-1.61.63-2.29-.37-.06-.74-.1-1.13-.1-.99 0-1.93.21-2.78.58m21.56 0c-.85-.37-1.79-.58-2.78-.58-.39 0-.76.04-1.13.1.4.68.63 1.46.63 2.29V18H24v-1.57c0-.81-.48-1.53-1.22-1.85M22 11v-.5c0-1.1-.9-2-2-2h-2c-.42 0-.65.48-.39.81l.7.63c-.19.31-.31.67-.31 1.06 0 1.1.9 2 2 2s2-.9 2-2"}),"Groups2"),rh}var G5e=H5e();const V5e=Vn(G5e);var ih={},$5;function q5e(){if($5)return ih;$5=1;var t=ar();Object.defineProperty(ih,"__esModule",{value:!0}),ih.default=void 0;var e=t(_r()),n=p;return ih.default=(0,e.default)((0,n.jsx)("path",{fillRule:"evenodd",d:"M4 11h16v2H4z"}),"HorizontalRuleOutlined"),ih}var W5e=q5e();const Y5e=Vn(W5e);var ah={},U5;function K5e(){if(U5)return ah;U5=1;var t=ar();Object.defineProperty(ah,"__esModule",{value:!0}),ah.default=void 0;var e=t(_r()),n=p;return ah.default=(0,e.default)((0,n.jsx)("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-4.86 8.86-3 3.87L9 13.14 6 17h12z"}),"ImageOutlined"),ah}var Q5e=K5e();const X5e=Vn(Q5e);var oh={},z5;function J5e(){if(z5)return oh;z5=1;var t=ar();Object.defineProperty(oh,"__esModule",{value:!0}),oh.default=void 0;var e=t(_r()),n=p;return oh.default=(0,e.default)([(0,n.jsx)("path",{d:"M12 22C6.49 22 2 17.51 2 12S6.49 2 12 2s10 4.04 10 9c0 3.31-2.69 6-6 6h-1.77c-.28 0-.5.22-.5.5 0 .12.05.23.13.33.41.47.64 1.06.64 1.67 0 1.38-1.12 2.5-2.5 2.5m0-18c-4.41 0-8 3.59-8 8s3.59 8 8 8c.28 0 .5-.22.5-.5 0-.16-.08-.28-.14-.35-.41-.46-.63-1.05-.63-1.65 0-1.38 1.12-2.5 2.5-2.5H16c2.21 0 4-1.79 4-4 0-3.86-3.59-7-8-7"},"0"),(0,n.jsx)("circle",{cx:"6.5",cy:"11.5",r:"1.5"},"1"),(0,n.jsx)("circle",{cx:"9.5",cy:"7.5",r:"1.5"},"2"),(0,n.jsx)("circle",{cx:"14.5",cy:"7.5",r:"1.5"},"3"),(0,n.jsx)("circle",{cx:"17.5",cy:"11.5",r:"1.5"},"4")],"PaletteOutlined"),oh}var Z5e=J5e();const j5=Vn(Z5e);var sh={},H5;function e9e(){if(H5)return sh;H5=1;var t=ar();Object.defineProperty(sh,"__esModule",{value:!0}),sh.default=void 0;var e=t(_r()),n=p;return sh.default=(0,e.default)((0,n.jsx)("path",{d:"M22 9v6c0 1.1-.9 2-2 2h-1v-2h1V9H4v6h6v2H4c-1.1 0-2-.9-2-2V9c0-1.1.9-2 2-2h16c1.1 0 2 .9 2 2m-7.5 10 1.09-2.41L18 15.5l-2.41-1.09L14.5 12l-1.09 2.41L11 15.5l2.41 1.09zm2.5-5 .62-1.38L19 12l-1.38-.62L17 10l-.62 1.38L15 12l1.38.62zm-2.5 5 1.09-2.41L18 15.5l-2.41-1.09L14.5 12l-1.09 2.41L11 15.5l2.41 1.09zm2.5-5 .62-1.38L19 12l-1.38-.62L17 10l-.62 1.38L15 12l1.38.62z"}),"SmartButtonOutlined"),sh}var t9e=e9e();const n9e=Vn(t9e);var lh={},G5;function r9e(){if(G5)return lh;G5=1;var t=ar();Object.defineProperty(lh,"__esModule",{value:!0}),lh.default=void 0;var e=t(_r()),n=p;return lh.default=(0,e.default)((0,n.jsx)("path",{d:"M3 5v14h18V5zm5.33 12H5V7h3.33zm5.34 0h-3.33V7h3.33zM19 17h-3.33V7H19z"}),"ViewColumnOutlined"),lh}var i9e=r9e();const a9e=Vn(i9e),sX=T.createContext(null),l0=()=>T.useContext(sX),fE=T.memo(function({id:e,isNotClient:n}){const r=X(s=>s.document[e]),i=X(s=>s.document?.root?.data?.theme),a=or(),o=T.useMemo(()=>r?Zv(r,i,a,y_[r.type]):void 0,[r,i,a]);return o?p.jsx(sX.Provider,{value:e,children:p.jsx(U9e,{isNotClient:n,...o,blockId:e})}):(console.warn(`Block ${e} not found`),null)},(t,e)=>t.id===e.id&&t.isNotClient===e.isNotClient),o9e={p:1.5,display:"flex",flexDirection:"column"},s9e={mb:.75,width:"100%",bgcolor:"cadet.200",display:"flex",justifyContent:"center",p:1,border:"1px solid",borderColor:"cadet.300"};function l9e({label:t,icon:e,onClick:n}){return p.jsxs(ht,{sx:o9e,onClick:r=>{r.stopPropagation(),n()},children:[p.jsx(H,{sx:s9e,children:e}),p.jsx(xe,{variant:"body2",children:t})]})}function $h(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}const c9e=[{label:"Text",icon:p.jsx(zW,{}),block:()=>({type:"NotionText",data:{props:{html:""}}})},{label:"Social",icon:p.jsx(iY,{}),block:()=>({type:"SocialMedia",data:{items:[{id:$h(),key:"facebook",label:"Facebook",iconName:"Facebook",theme:"positive",size:"small",sizePx:"24px",url:"https://maildrill-dev.s3.us-east-2.amazonaws.com/icons/Facebook_Positive_24px.png",href:""}],gap:1}})},{label:"Button",icon:p.jsx(dY,{}),block:()=>({type:"Button",data:{props:{text:"Button",size:"medium"},style:{shape:"rectangle"}}})},{label:"Image",icon:p.jsx(oY,{}),block:()=>({type:"Image",data:{props:{url:L1e()||bS,contentAlignment:"middle",size:"fill",touched:!1}}})},{label:"Divider",icon:p.jsx(aY,{}),block:()=>({type:"Divider",data:{}})},{label:"Spacer",icon:p.jsx(HW,{}),block:()=>({type:"Spacer",data:{}})},{label:"Columns",icon:p.jsx(nN,{}),block:()=>({type:"ColumnsContainer",data:{props:{columnsCount:3,columns:[{childrenIds:[]},{childrenIds:[]},{childrenIds:[]}],fixedWidths:[33,34,33],layout:"layout-33-34-33"}}})},{label:"Container",icon:p.jsx(sY,{}),block:()=>({type:"Container",data:{}})}];function lX({anchorEl:t,setAnchorEl:e,onSelect:n}){const r=()=>{e(null)},i=a=>{n(a),e(null)};return t===null?null:p.jsx(pS,{open:!0,anchorEl:t,onClose:r,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},elevation:4,sx:{"& .MuiPaper-root":{borderRadius:"8px"}},children:p.jsx(H,{sx:{p:1,display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr"},children:c9e.map((a,o)=>p.jsx(l9e,{label:a.label,icon:a.icon,onClick:()=>i(a.block())},o))})})}function u9e({buttonElement:t,onClick:e}){const[n,r]=T.useState(!1);return T.useEffect(()=>{function i({clientX:a,clientY:o}){if(!t)return;const s=t.getBoundingClientRect(),l=s.y,c=s.x,u=c+s.width;if(Math.abs(o-l)<20&&c<a&&a<u){r(!0);return}r(!1)}return window.addEventListener("mousemove",i),()=>{window.removeEventListener("mousemove",i)}},[t,r]),p.jsx(uS,{in:n,children:p.jsx(cn,{size:"small",sx:{p:.12,position:"absolute",top:"-12px",left:"50%",transform:"translateX(-10px)",bgcolor:"brand.blue",color:"primary.contrastText",zIndex:"20 !important","&:hover, &:active, &:focus":{bgcolor:"brand.blue",color:"primary.contrastText"}},onClick:i=>{i.stopPropagation(),e()},children:p.jsx(QI,{fontSize:"small"})})})}function d9e({onClick:t}){return p.jsx(si,{onClick:e=>{e.stopPropagation(),t()},sx:{display:"flex",alignContent:"center",justifyContent:"center",height:48,width:"fit-content",maxWidth:"fit-content",mx:"auto"},children:p.jsx(QI,{sx:{p:.12,bgcolor:"brand.blue",borderRadius:24,color:"white"},fontSize:"small"})})}function p9e({onSelect:t,placeholder:e}){const[n,r]=T.useState(null),[i,a]=T.useState(null),o=X(u=>u.selectedMainTab),s=BG(),l=()=>{r(i)},c=()=>e?p.jsx(d9e,{onClick:l}):p.jsx(u9e,{buttonElement:i,onClick:l});return s?null:p.jsxs(p.Fragment,{children:[p.jsx("div",{ref:a,style:{position:"relative",width:"100%",...e?{display:"flex",justifyContent:"center"}:{}},children:o!=="preview"&&c()}),p.jsx(lX,{anchorEl:n,setAnchorEl:r,onSelect:t})]})}function f9e(){return`block-${Date.now()}`}function Cc({childrenIds:t,onChange:e,parentId:n,position:r,isNotClient:i}){const a=T.useCallback(c=>{const u=f9e();e({blockId:u,block:c,childrenIds:[...t||[],u]})},[t,e]),[{isOver:o},s]=FE(()=>({accept:["block",El],drop:(c,u)=>{if(u.getItemType()===El){if(u.didDrop()){u.getDropResult();return}const f=c;if(f.category==="template"){console.warn("[ComponentsLibrary] templates cannot be dropped inline; click the card in the drawer to apply.");return}(async()=>{try{const m=await i0(f.category,f.axis,f.id);sEe(n,m.blocks,r)}catch(m){console.error("[ComponentsLibrary] failed to append saved subtree",m)}})();return}const d=c.blockId;if(u.didDrop()){u.getDropResult();return}return r===void 0?Z1e({parentId:n,blockId:d}):J1e({parentId:n,blockId:d,indexArray:r})},canDrop:(c,u)=>{if(u.getItemType()===El)return!0;const d=c.blockId;return!Id({targetId:n,draggedId:d})&&d!==n},collect:c=>({isOver:c.canDrop()?!!c.isOver():!1})}),[n,r]),l=t&&t.length>0?p.jsx(H,{ref:c=>{s(c)},sx:{minHeight:0,border:o?"2px solid":"",borderColor:o?"secondary.main":void 0},"aria-hidden":!0}):null;return i?t.map(c=>p.jsx(T.Fragment,{children:p.jsx(fE,{id:c,isNotClient:i})},c)):!t||t.length===0?p.jsx(H,{ref:c=>{s(c)},sx:{border:o?"2px solid":"",borderColor:o?"secondary.main":void 0},children:p.jsx(p9e,{placeholder:!0,onSelect:a})}):p.jsxs(p.Fragment,{children:[t.map(c=>p.jsx(T.Fragment,{children:p.jsx(fE,{id:c})},c)),l]})}const m9e=[{childrenIds:[]},{childrenIds:[]},{childrenIds:[]}];function h9e({style:t,props:e,blockId:n,isNotClient:r}){const i=l0(),{columns:a,...o}=e??{},s=a??m9e,l=(c,{block:u,blockId:d,childrenIds:f})=>{const h=X.getState().document[i],g=h?.data?.props?.columns??s,_=h?.data?.props?{...h.data.props}:{...o};delete _.columns;const b=g.length===2?[...g,{childrenIds:[]}]:[...g];b[c]={childrenIds:f};const y={..._,fixedWidths:_.fixedWidths?.length===2?[..._.fixedWidths,null]:_.fixedWidths},E={type:"ColumnsContainer",data:Od.parse({style:h?.data?.style??t,props:{...y,columns:b}})},v={[d]:u,[i]:E};cEe(v),ma(d)};return r?p.jsx(p.Fragment,{children:p.jsx(F2,{blockId:n,props:o,style:t,columns:[p.jsx(Cc,{isNotClient:r,parentId:n,position:0,childrenIds:a?.[0]?.childrenIds,onChange:c=>l(0,c)}),p.jsx(Cc,{isNotClient:r,parentId:n,position:1,childrenIds:a?.[1]?.childrenIds,onChange:c=>l(1,c)}),p.jsx(Cc,{isNotClient:r,parentId:n,position:2,childrenIds:a?.[2]?.childrenIds,onChange:c=>l(2,c)})]})}):p.jsx(U_,{children:p.jsx(F2,{blockId:n,props:o,style:t,columns:[p.jsx(Cc,{parentId:n,position:0,childrenIds:a?.[0]?.childrenIds,onChange:c=>l(0,c)}),p.jsx(Cc,{parentId:n,position:1,childrenIds:a?.[1]?.childrenIds,onChange:c=>l(1,c)}),p.jsx(Cc,{parentId:n,position:2,childrenIds:a?.[2]?.childrenIds,onChange:c=>l(2,c)})]})})}function g9e({childrenIds:t}){return p.jsx(p.Fragment,{children:t.map(e=>p.jsx(T.Fragment,{children:p.jsx(fE,{isNotClient:!0,id:e})},e))})}function _9e({style:t,props:e,blockId:n,isNotClient:r}){const i=e?.childrenIds??[],a=l0();return p.jsx(XY,{style:t,blockId:`${n}`,children:r?p.jsx(g9e,{parentId:n,childrenIds:i,onChange:({block:o,blockId:s,childrenIds:l})=>{e_(a,s,o,l),ma(s)}}):p.jsx(U_,{children:p.jsx(Cc,{parentId:n,childrenIds:i,onChange:({block:o,blockId:s,childrenIds:l})=>{e_(a,s,o,l),ma(s)}})})})}function b9e(t){const e=t.childrenIds??[],n=l0(),r=or();return p.jsx("div",{onClick:()=>{ma(null)},style:{backgroundColor:t.backdropColor??"#F5F5F5",color:t.textColor??"#262626",fontFamily:tm(t?.fontFamily||"OPEN_SANS"),fontSize:"16px",fontWeight:"400",letterSpacing:"0.15008px",lineHeight:"1.5",margin:"0",width:"100%"},children:p.jsx("table",{role:"presentation",align:"center",width:"100%",style:{margin:"0 auto",maxWidth:r==="desktop"?Hv:pG,backgroundColor:t.canvasColor??"#FFFFFF",borderRadius:t.borderRadius??void 0,border:(()=>{const i=t.borderColor;if(i)return`1px solid ${i}`})()},cellSpacing:"0",cellPadding:"0",border:0,children:p.jsx("tbody",{children:p.jsx("tr",{style:{width:"100%"},children:p.jsx("td",{"data-value":"__content",children:p.jsx(U_,{children:p.jsx(Cc,{listEndPolicy:"root",parentId:n,childrenIds:e,onChange:({block:i,blockId:a,childrenIds:o})=>{e_(n,a,i,o),ma(a)}})})})})})})})}var ch={},V5;function y9e(){if(V5)return ch;V5=1;var t=ar();Object.defineProperty(ch,"__esModule",{value:!0}),ch.default=void 0;var e=t(_r()),n=p;return ch.default=(0,e.default)((0,n.jsx)("path",{d:"M17 11v6.97l-5-2.14-5 2.14V5h6V3H7c-1.1 0-2 .9-2 2v16l7-3 7 3V11zm4-4h-2v2h-2V7h-2V5h2V3h2v2h2z"}),"BookmarkAddOutlined"),ch}var v9e=y9e();const E9e=Vn(v9e),S9e=t=>e=>({position:"absolute",...t?{top:"100%",right:0,marginTop:"8px",flexDirection:"row",width:"auto"}:{top:0,right:"-3rem",flexDirection:"column",width:"2.5rem"},borderRadius:"8px!important",zIndex:"90 !important;",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",border:"1px solid",borderColor:e.palette.secondary.main,padding:"1px",display:"flex",alignItems:"center",justifyContent:"center"});let bp=null;function C9e({blockId:t}){const e=MG(t),{t:n}=Ie("inspector"),{t:r}=Ie(),i=IG(),a=NG(),o=i&&a!=="local",[s,l]=T.useState(!1),c=e?.type!=="EmailLayout",u=bp&&bp.blockType===e?.type,d=T.useRef(null),[f,m]=T.useState(!1);T.useEffect(()=>{const y=()=>{if(!d.current)return;const x=d.current.parentElement;if(!x)return;const S=x.getBoundingClientRect(),C=x.closest(".preview-container");if(!C)return;C.getBoundingClientRect().right-S.right<48?m(!0):m(!1)};y(),window.addEventListener("resize",y),window.addEventListener("scroll",y,!0);const E=setTimeout(y,100);return()=>{window.removeEventListener("resize",y),window.removeEventListener("scroll",y,!0),clearTimeout(E)}},[t]);const h=T.useCallback(()=>{const y=X.getState().document,E=X.getState().notionTextInlineEditingBlockId,v=(k,w,D=new Set)=>{if(D.has(k))return;D.add(k);const A=w[k];A&&(A.type==="Container"&&(A.data?.props?.childrenIds||[]).forEach(R=>v(R,w,D)),A.type==="ColumnsContainer"&&(A.data?.props?.columns||[]).forEach(R=>{(R.childrenIds||[]).forEach(I=>v(I,w,D))}))},x=new Set;v(t,y,x),x.add(t);const S=k=>k&&k.filter(w=>!x.has(w)),C={...y};for(const[k,w]of Object.entries(C)){if(x.has(k))continue;const D=w;switch(D.type){case"EmailLayout":C[k]={...D,data:{...D.data,childrenIds:S(D.data.childrenIds)}};break;case"Container":C[k]={...D,data:{...D.data,props:{...D.data.props,childrenIds:S(D.data.props?.childrenIds)}}};break;case"ColumnsContainer":C[k]={...D,data:{...D.data,props:{...D.data.props,columns:D.data.props?.columns?.map(A=>({...A,childrenIds:S(A.childrenIds)}))}}};break;default:C[k]=D}}for(const k of x)delete C[k];E&&(E===t||x.has(E))&&ag(null),Wc(C),ma(null)},[t]),g=T.useCallback(()=>{e&&"style"in e.data&&e.data.style&&(bp={styles:JSON.parse(JSON.stringify(e.data.style)),blockType:e.type})},[e]),_=T.useCallback(()=>{const y=X.getState().document;if(!bp||bp.blockType!==e?.type)return;const E={...y},v=E[t];v&&(E[t]={...v,data:{...v.data,style:JSON.parse(JSON.stringify(bp.styles))}},Wc(E),ma(t))},[t,e]),b=T.useCallback(()=>{iEe(t)},[t]);return p.jsxs(p.Fragment,{children:[p.jsxs(ya,{ref:d,sx:S9e(f),onClick:y=>y.stopPropagation(),elevation:10,children:[p.jsx(Pt,{title:n("actions.copyFormat"),placement:"left-start",children:p.jsx("span",{children:p.jsx(cn,{onClick:g,sx:{padding:"4px",overflow:"hidden",color:"text.primary"},disabled:!(e&&"style"in e.data&&e.data.style),children:p.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p.jsx("path",{d:"M12 22.5C6.49 22.5 2 18.01 2 12.5C2 6.99 6.49 2.5 12 2.5C17.51 2.5 22 6.54 22 11.5C22 14.81 19.31 17.5 16 17.5H14.23C13.95 17.5 13.73 17.72 13.73 18C13.73 18.12 13.78 18.23 13.86 18.33C14.27 18.8 14.5 19.39 14.5 20C14.5 21.38 13.38 22.5 12 22.5ZM12 4.5C7.59 4.5 4 8.09 4 12.5C4 16.91 7.59 20.5 12 20.5C12.28 20.5 12.5 20.28 12.5 20C12.5 19.84 12.42 19.72 12.36 19.65C11.95 19.19 11.73 18.6 11.73 18C11.73 16.62 12.85 15.5 14.23 15.5H16C18.21 15.5 20 13.71 20 11.5C20 7.64 16.41 4.5 12 4.5Z",fill:"currentColor"}),p.jsx("path",{d:"M6.5 13.5C7.32843 13.5 8 12.8284 8 12C8 11.1716 7.32843 10.5 6.5 10.5C5.67157 10.5 5 11.1716 5 12C5 12.8284 5.67157 13.5 6.5 13.5Z",fill:"currentColor"}),p.jsx("path",{d:"M9.5 9.5C10.3284 9.5 11 8.82843 11 8C11 7.17157 10.3284 6.5 9.5 6.5C8.67157 6.5 8 7.17157 8 8C8 8.82843 8.67157 9.5 9.5 9.5Z",fill:"currentColor"}),p.jsx("path",{d:"M14.5 9.5C15.3284 9.5 16 8.82843 16 8C16 7.17157 15.3284 6.5 14.5 6.5C13.6716 6.5 13 7.17157 13 8C13 8.82843 13.6716 9.5 14.5 9.5Z",fill:"currentColor"}),p.jsx("path",{d:"M17.5 13.5C18.3284 13.5 19 12.8284 19 12C19 11.1716 18.3284 10.5 17.5 10.5C16.6716 10.5 16 11.1716 16 12C16 12.8284 16.6716 13.5 17.5 13.5Z",fill:"currentColor"})]})})})}),p.jsx(Pt,{title:n(u?"actions.pasteFormatting":"actions.noFormatSupported"),placement:"left-start",children:p.jsx("span",{children:p.jsx(cn,{onClick:_,sx:{padding:"4px",overflow:"hidden",color:u?"text.primary":"text.disabled"},disabled:!u,children:p.jsx("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:p.jsx("path",{d:"M10.9551 22.6497C10.5139 22.6497 10.1287 22.4888 9.79934 22.167C9.47017 21.8451 9.30559 21.4582 9.30559 21.0062V16.1317H5.54784C5.09367 16.1317 4.69725 15.9624 4.35859 15.6237C4.01992 15.2851 3.85059 14.8886 3.85059 14.4345V7.10448C3.85059 6.07631 4.21 5.19264 4.92884 4.45348C5.6475 3.71431 6.52667 3.34473 7.56634 3.34473H19.2978C19.5378 3.34473 19.7408 3.42773 19.9066 3.59373C20.0726 3.75956 20.1556 3.96248 20.1556 4.20248V14.4345C20.1556 14.8886 19.9871 15.2851 19.6501 15.6237C19.3131 15.9624 18.9138 16.1317 18.4523 16.1317H14.7006V21.0062C14.7006 21.4582 14.536 21.8451 14.2068 22.167C13.8775 22.4888 13.4923 22.6497 13.0511 22.6497H10.9551ZM5.54784 10.6145H18.4523V5.04798H17.0463V8.41773C17.0463 8.63189 16.9744 8.81139 16.8306 8.95623C16.6869 9.10106 16.5063 9.17348 16.2888 9.17348C16.0715 9.17348 15.8924 9.10106 15.7516 8.95623C15.6108 8.81139 15.5403 8.63189 15.5403 8.41773V5.04798H13.7533V6.40148C13.7533 6.61814 13.6815 6.79789 13.5378 6.94073C13.394 7.08373 13.2134 7.15523 12.9961 7.15523C12.7786 7.15523 12.5994 7.08373 12.4586 6.94073C12.3178 6.79789 12.2473 6.61814 12.2473 6.40148V5.04798H7.56634C6.97717 5.04798 6.4935 5.24764 6.11534 5.64698C5.737 6.04631 5.54784 6.53214 5.54784 7.10448V10.6145ZM5.54784 14.4345H18.4523V12.0965H5.54784V14.4345Z",fill:"currentColor"})})})})}),p.jsx(Pt,{title:r("editor.cloneBlock"),placement:"left-start",children:p.jsx(cn,{onClick:b,sx:{padding:"4px",overflow:"hidden",color:"text.primary"},children:p.jsx(Jwe,{sx:{fontSize:"1.25rem"}})})}),p.jsx(Pt,{title:n("actions.delete"),placement:"left-start",children:p.jsx(cn,{onClick:h,sx:{overflow:"hidden",color:"error.main",padding:"4px"},children:p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:p.jsx("path",{d:"M16 9.5V19.5H8V9.5H16ZM14.5 3.5H9.5L8.5 4.5H5V6.5H19V4.5H15.5L14.5 3.5ZM18 7.5H6V19.5C6 20.6 6.9 21.5 8 21.5H16C17.1 21.5 18 20.6 18 19.5V7.5Z",fill:"currentColor"})})})}),o&&p.jsx(Pt,{title:n("componentsLibrary.save.tooltip"),placement:"left-start",children:p.jsx("span",{children:p.jsx(cn,{onClick:()=>l(!0),disabled:!c,sx:{padding:"4px",overflow:"hidden",color:c?"text.primary":"text.disabled"},"aria-label":n("componentsLibrary.save.button"),children:p.jsx(E9e,{sx:{fontSize:"1.25rem"}})})})})]}),o&&s&&c&&p.jsx(H4e,{open:s,rootBlockId:t,onClose:()=>l(!1)})]})}const x9e=T.memo(C9e),q5=150,T9e=25;let Tg=null,mE=null;function UN(){Tg&&(clearTimeout(Tg),Tg=null),mE=null}function W5(t){mE===t&&UN()}function k9e(t,e,n,r){UN(),mE=t,Tg=setTimeout(()=>{Tg=null,mE=null,n()&&(nv(t),r())},e)}function w9e(t){const e=t.closest(".preview-container");if(!e)return q5;let n=0,r=t;for(;r&&e.contains(r)&&(r.hasAttribute("data-block-id")&&(n+=1),r!==e);)r=r.parentElement;return q5+Math.max(0,n-1)*T9e}function D9e(t){const e=W_();return T.useMemo(()=>e?Id({draggedId:t,targetId:e}):!1,[t,e])}function A9e(t){if(!t||typeof t.nodeType!="number")return null;const e=t,n=e.closest?.(".preview-container");if(!n)return null;const r=e.closest?.("[data-block-id]"),i=r?.getAttribute("data-block-id")??null;return!i||!r||!n.contains(r)?null:i}function O9e({children:t,canEdit:e=!0,isNotClient:n=!1}){const r=l0(),{t:i}=Ie(),a=m1e(),o=f1e(r),s=p1e(r),l=eI(),c=W_(),u=h1e();g1e();const d=D9e(r),[f,m]=T.useState(!1),[h,g]=T.useState(0),_=T.useRef(null),b=T.useRef(null),[y,E]=T.useState(null),v=sn(),x=BG(),[S,C]=T.useState(null),k=c===r||d,w=u===r,D=v.palette.primary.light||v.palette.primary.main,A=T.useRef(null),M=T.useRef(!0);if(n)return p.jsxs(p.Fragment,{children:[p.jsx("div",{style:{width:"100%"}}),p.jsx(H,{sx:{position:"relative",maxWidth:"100%"},children:p.jsx("div",{children:t})}),p.jsx("div",{style:{width:"100%"}})]});let R,I;w&&e?(R=`2px solid ${D}`,I="10"):o&&e?(R=`2px solid ${v.palette.secondary.main}`,I="1"):f&&e?R=`2px dotted ${v.palette.secondary.main}`:I="auto";const P=()=>!o||!e?null:p.jsx(x9e,{blockId:r}),L=te=>{const Q=te.getClientOffset(),V=_.current?.getBoundingClientRect(),K=b.current?.getBoundingClientRect();if(!Q||!V||!K)return null;const le=Math.abs(Q.y-V.y),he=Math.abs(Q.y-K.y);return le<he?"up":"down"},[{isOver:B},F]=FE(()=>({accept:["block",El],drop:(te,Q)=>{if(Q.getItemType()===El){if(Q.didDrop()){Q.getDropResult();return}const ve=te;if(ve.category==="template"){console.warn("[ComponentsLibrary] templates cannot be dropped inline; click the card in the drawer to apply.");return}const me=L(Q)==="up"?"before":"after";(async()=>{try{const Ee=await i0(ve.category,ve.axis,ve.id);me==="after"?aEe(r,Ee.blocks):oEe(r,Ee.blocks)}catch(Ee){console.error("[ComponentsLibrary] failed to insert saved subtree",Ee)}})();return}const K=r,le=te.blockId;if(K===le)return;if(Q.didDrop()){Q.getDropResult();return}const he=L(Q);if(he)Zg(K,le,he);else{Zg(K,le,"down");return}},canDrop:(te,Q)=>Q.getItemType()===El?!0:!Id({targetId:r,draggedId:te.blockId}),collect:te=>({isOver:te.canDrop()?te.isOver({shallow:!0}):!1}),hover:(te,Q)=>{if(Q.getItemType()===El){if(!Q.canDrop()||!Q.isOver({shallow:!0})){E(null);return}const K=L(Q);E(K??null);return}if(te.blockId===r){E(null);return}if(!Q.canDrop()||!Q.isOver({shallow:!0})){E(null);return}const V=L(Q);if(!V){E(null);return}E(V)},end:()=>{E(null)}}));T.useEffect(()=>{B||E(null)},[B]);const q=()=>p.jsxs("div",{style:{height:"3px",background:v.palette.secondary.main,position:"relative",color:v.palette.secondary.main},children:[p.jsx("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:p.jsx("path",{fill:"currentColor",d:"M28 12H10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2M10 4v6h18V4zm18 26H10a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2m-18-8v6h18v-6zm-1-6l-5.586-5.586L2 11.828L6.172 16L2 20.172l1.414 1.414z"})}),p.jsx("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:p.jsx("path",{fill:"currentColor",d:"M28 12H10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2M10 4v6h18V4zm18 26H10a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2m-18-8v6h18v-6zm-1-6l-5.586-5.586L2 11.828L6.172 16L2 20.172l1.414 1.414z"})})]}),oe=LE(()=>({type:"block",item:()=>{const te=X.getState().notionTextInlineEditingBlockId;return te&&window.dispatchEvent(new CustomEvent("notion-text-force-save",{detail:{blockId:te}})),{blockId:r}},canDrag:!k,collect:te=>({borderDrag:te.isDragging()?"2px dotted yellow":"",isDragging:te.isDragging()}),end:()=>{g(Date.now())}}),[k,r]),[{borderDrag:G="",isDragging:Y},be]=oe||[{borderDrag:"",isDragging:!1},T.useRef(null)],ee=e&&l!=="preview"&&!k&&!x&&(Y||a===r||a==null&&o);T.useEffect(()=>(M.current=!0,()=>{M.current=!1,W5(r),A.current&&(clearTimeout(A.current),A.current=null),X.getState().canvasHoveredBlockId===r&&nv(null)}),[r]);const fe=te=>{const Q=Date.now()-h;if(!(Y||h>0&&Q<200)&&(te.stopPropagation(),l!=="preview")){if(s==="NotionText"){const V=new CustomEvent("email-builder-highlight-editor",{detail:!0});window.dispatchEvent(V)}ma(r)}},re=T.useMemo(()=>T.cloneElement(t,{onClick:te=>{t.props.onClick&&t.props.onClick(te),!te.defaultPrevented&&!te.isPropagationStopped()&&(Y||fe(te))},onMouseDown:te=>{t.props.onMouseDown&&t.props.onMouseDown(te)},onMouseUp:te=>{t.props.onMouseUp&&t.props.onMouseUp(te)}}),[t,Y,r,s,l]);return p.jsxs(p.Fragment,{children:[y==="up"&&p.jsx(q,{}),p.jsx("div",{ref:_,style:{width:"100%"}}),p.jsx(H,{"data-block-id":r,sx:{position:"relative",maxWidth:"100%"},ref:F,onMouseEnter:te=>{te.stopPropagation(),UN(),A.current&&(clearTimeout(A.current),A.current=null);const Q=w9e(te.currentTarget);k9e(r,Q,()=>M.current,()=>m(!0))},onMouseLeave:te=>{W5(r),A.current&&clearTimeout(A.current);const Q=te.relatedTarget;A.current=setTimeout(()=>{if(m(!1),X.getState().canvasHoveredBlockId!==r)return;const V=A9e(Q);nv(V&&V!==r?V:null)},150)},onClick:fe,children:p.jsxs(H,{sx:{position:"relative",maxWidth:"100%",outlineOffset:"-1px",outline:R,zIndex:I,transition:"outline 0.2s ease-in-out, z-index 0.2s ease-in-out"},children:[P(),ee?p.jsx(H,{sx:{position:"absolute",left:"50%",top:-20,transform:"translateX(-50%)",zIndex:10,display:"flex",flexDirection:"row",alignItems:"center",borderRadius:"6px 6px 0 0",overflow:"hidden",backgroundColor:w&&e?D:v.palette.secondary.main},children:p.jsx(Pt,{title:i("editor.dragBlockHandle"),placement:"top",children:p.jsx(cn,{ref:be,type:"button","aria-label":i("editor.dragBlockHandle"),size:"small",onClick:te=>te.stopPropagation(),sx:{padding:"3px 6px",rotate:"90deg",borderRadius:0,color:"white",cursor:Y?"grabbing":"grab","&:hover":{backgroundColor:"rgba(255,255,255,0.15)"}},children:p.jsx(GW,{sx:{fontSize:15}})})})}):null,p.jsx(lX,{anchorEl:S,setAnchorEl:C,onSelect:te=>{const Q=lEe(r,te);Q&&ma(Q),C(null)}}),p.jsx(uS,{in:w&&e,timeout:200,children:p.jsx(sa,{label:i("editor.editing"),icon:p.jsx(VW,{}),size:"small",sx:{position:"absolute",left:-1,top:-26,backgroundColor:D,color:"white",fontWeight:600,fontSize:"0.75rem",zIndex:-1,boxShadow:"0 2px 8px rgba(0,0,0,0.15)","& .MuiChip-icon":{color:"white",fontSize:"1rem"}}})}),p.jsx("div",{style:{border:G},children:re}),ee?p.jsx(H,{sx:{position:"absolute",left:"50%",bottom:-10,transform:"translateX(-50%)",zIndex:10,width:20,height:20,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:w&&e?D:v.palette.secondary.main},children:p.jsx(Pt,{title:i("editor.addBlockAtEnd"),placement:"bottom",children:p.jsx(cn,{type:"button",onClick:te=>{te.stopPropagation(),C(te.currentTarget)},sx:{padding:0,width:20,height:20,minWidth:20,borderRadius:"50%",color:"white","&:hover":{backgroundColor:"rgba(255,255,255,0.15)"}},children:p.jsx(UW,{sx:{fontSize:18}})})})}):null]})}),y==="down"&&p.jsx(q,{}),p.jsx("div",{ref:b,style:{width:"100%"}})]})}const lc=T.memo(O9e,(t,e)=>t.children===e.children&&t.canEdit===e.canEdit&&t.isNotClient===e.isNotClient),R9e=T.memo(KY),I9e=t=>{const e=or(),n=Y_();return p.jsx(R9e,{...t,selectedScreenSize:e,disableEdition:n})},N9e=T.memo(qY),P9e=T.memo(_9e),M9e=T.memo(h9e),L9e=T.memo(YY),F9e=T.memo(jOe),B9e=T.memo(QY),$9e=T.memo(WY),cX={SocialMedia:{schema:_N,Component:t=>p.jsx(lc,{isNotClient:t.isNotClient,children:p.jsx(I9e,{...t})})},Button:{schema:z_,Component:t=>p.jsx(lc,{isNotClient:t.isNotClient,children:p.jsx(N9e,{...t})})},Container:{schema:j_,Component:t=>p.jsx(lc,{isNotClient:t.isNotClient,children:p.jsx(P9e,{...t})})},ColumnsContainer:{schema:Od,Component:t=>p.jsx(lc,{isNotClient:t.isNotClient,children:p.jsx(M9e,{...t})})},Image:{schema:Jf,Component:t=>{const e={...t,props:{...t.props,url:t.props?.url??"https://placehold.co/600x400@2x/F8F8F8/CCC?text=Your%20image"}};return p.jsx(lc,{isNotClient:t.isNotClient,children:p.jsx(L9e,{...e})})}},NotionText:{schema:_S,Component:t=>p.jsx(lc,{isNotClient:t.isNotClient,children:p.jsx(F9e,{blockId:t.blockId??"",...t})})},EmailLayout:{schema:gS,Component:t=>p.jsx(b9e,{...t})},Spacer:{schema:G_,Component:t=>p.jsx(lc,{isNotClient:t.isNotClient,children:p.jsx(B9e,{...t})})},Divider:{schema:H_,Component:t=>p.jsx(lc,{isNotClient:t.isNotClient,children:p.jsx($9e,{...t})})}},U9e=gG(cX),y_=Object.fromEntries(Object.entries(cX).map(([t,e])=>[t,rg(e.schema)??{}])),uX=({tabs:t,defaultTab:e})=>{const n=T.useMemo(()=>t.filter(o=>o.visible),[t]),[r,i]=T.useState(null);if(T.useEffect(()=>{if(r&&n.some(s=>s.key===r))return;const o=e&&n.some(s=>s.key===e)?e:n[0]?.key??null;i(o)},[n,e,r]),n.length===0)return null;if(n.length===1)return p.jsx(H,{children:n[0].render()});const a=n.find(o=>o.key===r)??n[0];return p.jsxs(H,{children:[p.jsx(fS,{value:a.key,onChange:(o,s)=>i(s),variant:"scrollable",scrollButtons:!1,sx:{minHeight:34,mb:1.5,borderBottom:1,borderColor:"divider","& .MuiTabs-flexContainer":{gap:0},"& .MuiTab-root":{minHeight:34,minWidth:0,px:1.25,py:.5,fontSize:"0.72rem",fontWeight:500,textTransform:"none",color:"text.secondary","&.Mui-selected":{color:"primary.main"}}},children:n.map(o=>p.jsx(hs,{value:o.key,label:o.label,disableRipple:!0},o.key))}),p.jsx(H,{children:a.render()})]})},z9e={EmailLayout:{label:"Email",iconName:"DashboardOutlined"},NotionText:{label:"Text",iconName:"ArticleOutlined"},SocialMedia:{label:"Social",iconName:"Groups2"},Button:{label:"Button",iconName:"SmartButtonOutlined"},Image:{label:"Image",iconName:"ImageOutlined"},Divider:{label:"Divider",iconName:"HorizontalRuleOutlined"},Spacer:{label:"Spacer",iconName:"Crop32Outlined"},ColumnsContainer:{label:"Columns",iconName:"ViewColumnOutlined"},Container:{label:"Container",iconName:"LibraryAddOutlined"},Html:{label:"HTML",iconName:"CodeOutlined"}},j9e=t=>e=>e.document[t];function H9e(t){if(!t)return[];switch(t.type){case"EmailLayout":return t.data?.childrenIds||[];case"Container":return t.data?.props?.childrenIds||[];case"ColumnsContainer":return t.data?.props?.columns?.flatMap(e=>e.childrenIds||[])||[];default:return[]}}function dX(t,e,n){const r=H9e(t[e]);for(const i of r)if(i===n||dX(t,i,n))return!0;return!1}function G9e(t,e,n,r){if(!r)return!1;const i=t[e];if(!i||i.type!=="ColumnsContainer")return!1;const a=i.data?.props?.columns?.[n]?.childrenIds||[];for(const o of a)if(o===r||dX(t,o,r))return!0;return!1}function V9e(t){const e=t.document;if(!e||!e.root)return null;function n(i,a){const o=a.document[i];if(!o)return[];switch(o.type){case"EmailLayout":return o.data?.childrenIds||[];case"Container":return o.data?.props?.childrenIds||[];case"ColumnsContainer":return o.data?.props?.columns?.flatMap(s=>s.childrenIds||[])||[];default:return[]}}function r(i,a,o){const s=o.document[i],l=s?.type??"Unknown",c=z9e[l]??{label:l,iconName:"WidgetsOutlined"};if(l==="ColumnsContainer"){const f=s.data?.props?.columns,h=s.data?.props?.columnsCount===2?2:3,g=[];for(let _=0;_<h;_++){const b=f?.[_]?.childrenIds??[],y=Zve(i,_);g.push({blockId:y,type:"ColumnSlot",label:"",iconName:"WidgetsOutlined",children:b.map(E=>r(E,a+2,o)),depth:a+1,columnSlot:{parentBlockId:i,columnIndex:_,columnsCount:h}})}return{blockId:i,type:l,label:c.label,iconName:c.iconName,children:g,depth:a}}const d=n(i,o).map(f=>r(f,a+1,o));return{blockId:i,type:l,label:c.label,iconName:c.iconName,children:d,depth:a}}return r("root",0,t)}function q9e(t){return X(t)}function pX(t){return X(j9e(t))}const zN=VR(()=>({credits:{}}));function W9e(t,e){zN.setState(n=>({credits:{...n.credits,[t]:e}}))}function jp(t){zN.setState(e=>{const{[t]:n,...r}=e.credits;return{credits:r}})}function Y9e(t){return zN(e=>t?e.credits[t]??null:null)}const K9e=350,Q9e=20,X9e=10,J9e=["any","landscape","portrait","squarish"],Ii={query:"",orientation:"any",photos:[],page:0,totalPages:0,selectedPhoto:null},fX=({backendUrl:t,blockId:e,source:n})=>{const{t:r}=Ie("inspector"),i=T.useMemo(()=>zr(t),[t]),[a,o]=T.useState(e??null),[s,l]=T.useState(null),[c,u]=T.useState(n??"image");T.useEffect(()=>{e!=null&&o(e)},[e]),T.useEffect(()=>{n!=null&&u(n)},[n]);const[d,f]=T.useState(Ii.query),[m,h]=T.useState(Ii.orientation),[g,_]=T.useState(Ii.photos),[b,y]=T.useState(Ii.page),[E,v]=T.useState(Ii.totalPages),[x,S]=T.useState(null),[,C]=T.useState(Ii.selectedPhoto),[k,w]=T.useState(!1),[D,A]=T.useState(null),M=T.useRef(null);T.useEffect(()=>{const B=F=>{const{detail:q}=F;o(q.blockId),l(q.currentImageUrl),u(q.source??"image")};return window.addEventListener("email-builder-image-panel-opened",B),()=>window.removeEventListener("email-builder-image-panel-opened",B)},[]);const R=T.useCallback(async(B,F,q,oe)=>{M.current?.abort();const G=new AbortController;M.current=G,w(!0),A(null);try{const Y=await dEe(i,{query:B,page:q,perPage:Q9e,orientation:F==="any"?void 0:F,signal:G.signal});S(Y.rateLimitRemaining),v(Y.totalPages),y(q),_(be=>{const ee=oe?[...be,...Y.results]:Y.results;return Ii.photos=ee,Ii.page=q,Ii.totalPages=Y.totalPages,ee})}catch(Y){if(Y?.name==="AbortError")return;A(Y instanceof Mu?Y.kind:"unknown"),oe||_([])}finally{M.current===G&&(w(!1),M.current=null)}},[i]);T.useEffect(()=>{Ii.query=d,Ii.orientation=m;const B=d.trim();if(B.length===0){M.current?.abort(),_([]),y(0),v(0),A(null),Ii.photos=[],Ii.page=0,Ii.totalPages=0;return}const F=window.setTimeout(()=>{R(B,m,1,!1)},K9e);return()=>window.clearTimeout(F)},[d,m,R]),T.useEffect(()=>()=>M.current?.abort(),[]);const I=b>0&&b<E&&!k,P=()=>{const B=d.trim();!B||!I||R(B,m,b+1,!0)},L=B=>{if(!a)return;const F=pEe(B);c==="image"?Bh(a,{url:F,alt:B.attribution}):window.dispatchEvent(new CustomEvent("email-builder-set-image",{detail:{url:F}})),C(B),Ii.selectedPhoto=B,W9e(a,{photoId:B.id,photographerName:B.user.name,photographerUrl:B.user.profileUrl,unsplashUrl:B.unsplashUrl}),YG(i,B.links.downloadLocation)};return p.jsxs(H,{children:[p.jsxs(qe,{direction:"row",alignItems:"center",gap:1,sx:{mb:1},children:[p.jsx(Ir,{fullWidth:!0,size:"small",placeholder:r("inputs.unsplash.searchPlaceholder"),value:d,onChange:B=>f(B.target.value),InputProps:{startAdornment:p.jsx(tG,{position:"start",children:p.jsx(kDe,{fontSize:"small",sx:{color:"text.secondary"}})})}}),x!==null&&x<=X9e&&p.jsx(sa,{label:r("inputs.unsplash.quotaLow",{remaining:x}),size:"small",color:"warning",variant:"outlined"})]}),p.jsx(fS,{value:m,onChange:(B,F)=>h(F),variant:"scrollable",scrollButtons:!1,sx:{minHeight:30,mb:1.5,"& .MuiTabs-flexContainer":{gap:0},"& .MuiTabs-scroller":{pl:0},"& .MuiTab-root":{minHeight:30,minWidth:0,px:1,py:.25,fontSize:"0.7rem",textTransform:"none",color:"text.secondary","&.Mui-selected":{color:"primary.main"}},"& .MuiTab-root:first-of-type":{pl:0}},children:J9e.map(B=>p.jsx(hs,{value:B,label:r(`inputs.unsplash.orientation.${B}`),disableRipple:!0},B))}),D&&p.jsx($n,{severity:D==="not_configured"?"warning":"error",sx:{mb:1.5,fontSize:"0.75rem"},children:r(`inputs.unsplash.error.${D}`)}),k&&g.length===0&&p.jsx(H,{sx:{display:"flex",justifyContent:"center",py:3},children:p.jsx(ti,{size:22})}),!k&&!D&&g.length===0&&d.trim().length===0&&p.jsx(H,{sx:{textAlign:"center",py:3},children:p.jsx(xe,{variant:"caption",color:"text.secondary",children:r("inputs.unsplash.emptyInitial")})}),!k&&!D&&g.length===0&&d.trim().length>0&&p.jsx(H,{sx:{textAlign:"center",py:3},children:p.jsx(xe,{variant:"caption",color:"text.secondary",children:r("inputs.unsplash.emptyNoResults",{query:d.trim()})})}),g.length>0&&p.jsx(H,{sx:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:1,maxHeight:380,overflowY:"auto"},children:g.map(B=>{const F=s?.includes(B.id)??!1;return p.jsx(Z9e,{photo:B,selected:F,onPick:()=>L(B)},B.id)})}),I&&p.jsx(H,{sx:{textAlign:"center",mt:2},children:p.jsx(ld,{component:"button",variant:"caption",onClick:P,sx:{cursor:"pointer"},children:r("inputs.unsplash.loadMore")})}),p.jsxs(xe,{variant:"caption",sx:{display:"block",mt:1.5,color:"text.secondary",textAlign:"center",fontSize:"0.65rem"},children:[r("inputs.unsplash.poweredBy")," ",p.jsx(ld,{href:"https://unsplash.com/?utm_source=email-builder-online&utm_medium=referral",target:"_blank",rel:"noreferrer noopener",underline:"hover",color:"inherit",children:"Unsplash"})]})]})},Z9e=({photo:t,selected:e,onPick:n})=>{const{t:r}=Ie("inspector"),i=t.color??void 0;return p.jsxs(H,{sx:{borderRadius:1,overflow:"hidden",border:"2px solid",borderColor:e?"primary.main":"divider",cursor:"pointer",backgroundColor:i??"action.hover",transition:"border-color 0.15s ease","&:hover":{borderColor:"primary.light"}},children:[p.jsx(H,{sx:{position:"relative",aspectRatio:"1",overflow:"hidden"},children:p.jsx("img",{src:t.urls.thumb,alt:t.alt,loading:"lazy",onClick:n,style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})}),p.jsx(H,{sx:{px:.75,py:.5,fontSize:"0.6rem",lineHeight:1.3,bgcolor:"#1a1a1a",color:"#ccc",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:p.jsx(G7,{t:r,i18nKey:"inputs.unsplash.creditLine",values:{author:t.user.name},components:{authorLink:p.jsx(ld,{href:t.user.profileUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",onClick:a=>a.stopPropagation(),sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}}),unsplashLink:p.jsx(ld,{href:t.unsplashUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",onClick:a=>a.stopPropagation(),sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}})}})})]})};function e$e({onClick:t,disabled:e,primary:n=!1}){const{t:r}=Ie("inspector");return p.jsx(cn,{"aria-label":r("inputs.common.close"),onClick:t,disabled:e,sx:{position:"absolute",right:8,top:8,color:i=>n?"brand.blue":i.palette.grey[500],"&:hover":{opacity:.8}},children:p.jsx(tb,{})})}function t$e({imageUrl:t,saving:e=!1}){return p.jsxs(LR,{sx:{position:"relative"},children:[e&&p.jsx(qe,{justifyContent:"center",alignItems:"center",sx:{position:"absolute",top:7,left:0,width:"100%",height:"314px",zIndex:20,backgroundColor:"#212121AA",mb:1},children:p.jsx(ti,{size:48,thickness:6,color:"inherit",sx:{color:"white"}})}),p.jsx(Qfe,{component:"img",sx:{objectFit:"contain",width:"100%",height:"326px"},image:t,alt:"Generated Image"})]})}function n$e({value:t,onChange:e,disabled:n}){return p.jsxs(p.Fragment,{children:[p.jsx(xe,{sx:{fontSize:"14px",fontWeight:700},children:"Image description"}),p.jsx(Ir,{disabled:n,autoFocus:!0,margin:"dense",id:"prompt",placeholder:"Enter a detailed description here...",type:"text",fullWidth:!0,multiline:!0,rows:4,variant:"outlined",value:t,onChange:r=>e(r.target.value),sx:{mt:.5,"& .MuiOutlinedInput-root":{borderRadius:"8px"}}})]})}const r$e=t=>({400:{code:400,title:t.title||"Invalid Request",message:t.message||"The request was invalid. Please check your input and try again.",action:t.action||"Modify your prompt and try again"},401:{code:401,title:t.title||"Authentication Required",message:t.message||"You need to be authenticated to perform this action.",action:t.action||"Please log in and try again"},403:{code:403,title:t.title||"Access Denied",message:t.message||"You don't have permission to perform this action.",action:t.action||"Contact support if you believe this is a mistake"},404:{code:404,title:t.title||"Not Found",message:t.message||"The requested resource was not found.",action:t.action||"Try again or use a different prompt"},422:{code:422,title:t.title||"Invalid Input",message:t.message||"The provided input cannot be processed.",action:t.action||"Modify your prompt and try again"},429:{code:429,title:t.title||"Too Many Requests",message:t.message||"You've made too many requests. Please wait a moment.",action:t.action||"Please wait a few minutes before trying again"},500:{code:500,title:t.title||"Server Error",message:t.message||"An unexpected error occurred on our servers.",action:t.action||"Please try again later"},502:{code:502,title:t.title||"Bad Gateway",message:t.message||"The server received an invalid response.",action:t.action||"Please try again later"},503:{code:503,title:t.title||"Service Unavailable",message:t.message||"The service is temporarily unavailable.",action:t.action||"Please try again later"}})[t.code]||{code:t.code,title:"Unexpected Error",message:"An unexpected error occurred.",action:"Please try again later"};function mX({src:t,style:e}){const{t:n}=Ie("inspector"),[r,i]=T.useState(!1),[a,o]=T.useState(!1),[s,l]=T.useState(""),[c,u]=T.useState(null),[d,f]=T.useState(!1),[m,h]=T.useState(null),[g,_]=T.useState(!1),[b,y]=T.useState(0),[E,v]=T.useState(0),x=T.useRef(null),S=[n("inputs.aiImageGeneration.loadingStep1"),n("inputs.aiImageGeneration.loadingStep2"),n("inputs.aiImageGeneration.loadingStep3"),n("inputs.aiImageGeneration.loadingStep4")],C=T.useCallback(()=>{y(0),v(0),x.current&&clearInterval(x.current);const I=6e4,P=100;let L=0;x.current=setInterval(()=>{L+=P,y(Math.min(L/I*95,95)),v(Math.min(Math.floor(L/I*S.length),S.length-1)),L>=I&&x.current&&clearInterval(x.current)},P)},[S.length]),k=T.useCallback(()=>{x.current&&(clearInterval(x.current),x.current=null),y(100)},[]),w=()=>{i(!0),h(null)},D=()=>{a||(i(!1),o(!1),u(null),l(""),f(!1),h(null),_(!1),k())},A=()=>{const I=c&&!d?"store-ai-image":"request-ai-image",P=c&&!d?c:s;h(null),I==="store-ai-image"?(_(!0),o(!1),setTimeout(()=>{o(!1),D()},2e3)):(o(!0),C()),window.dispatchEvent(new CustomEvent(I,{detail:P}))},M=()=>{f(!0),u(null),h(null),_(!1)};T.useEffect(()=>{const I=P=>{const{detail:L}=P;if(k(),o(!1),L.error){h(r$e(L.error));return}if(!L.success||!L.url){h({code:0,title:"Generation Failed",message:"Failed to generate the image.",action:"Please try again"});return}u(L.url),f(!1)};return window.addEventListener("generated-image",I),()=>{window.removeEventListener("generated-image",I)}},[]),T.useEffect(()=>{D()},[t]);const R=!c||d;return p.jsxs(p.Fragment,{children:[p.jsx(ht,{style:e,startIcon:p.jsx(ro,{className:"w-4 h-4"}),variant:"contained",onClick:w,children:n("inputs.aiImageGeneration.generate")}),p.jsx(Is,{open:r,onClose:D,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{bgcolor:"background.paper",color:"text.primary",borderRadius:"8px"}},children:p.jsxs("form",{onSubmit:I=>{I.preventDefault(),A()},children:[p.jsxs(Ms,{sx:{fontWeight:700,fontSize:"24px",color:m?"error.main":"inherit"},children:[n(m?"inputs.aiImageGeneration.titleError":a?"inputs.aiImageGeneration.titleLoading":c?"inputs.aiImageGeneration.titleReady":"inputs.aiImageGeneration.titleCreate"),p.jsx(e$e,{onClick:D,disabled:a,primary:!0})]}),p.jsxs(Ps,{children:[p.jsx(ihe,{sx:{pb:1,color:m?"error.dark":"inherit"},children:n(m?"inputs.aiImageGeneration.descriptionError":a?"inputs.aiImageGeneration.descriptionLoading":R?"inputs.aiImageGeneration.descriptionCreate":"inputs.aiImageGeneration.descriptionReady")}),c&&!d?p.jsxs(qe,{sx:{position:"relative"},children:[p.jsx(t$e,{imageUrl:c,saving:g}),p.jsxs($n,{variant:"outlined",severity:"warning",icon:!1,children:[n("inputs.aiImageGeneration.warningRegenerate")," ",p.jsx("b",{children:n("inputs.aiImageGeneration.warningInsertFirst")})," ",n("inputs.aiImageGeneration.warningFirst")]})]}):a&&!c?p.jsxs(qe,{justifyContent:"center",alignItems:"center",spacing:2,sx:{backgroundColor:I=>I.palette.mainColor?.[50]??I.palette.action.hover,height:"326px",width:"100%",borderRadius:"8px"},children:[p.jsx(ro,{sx:{fontSize:48,color:"primary.main",animation:"pulse 1.5s ease-in-out infinite","@keyframes pulse":{"0%, 100%":{opacity:.4,transform:"scale(1)"},"50%":{opacity:1,transform:"scale(1.15)"}}}}),p.jsx(xe,{variant:"body2",sx:{color:"text.secondary",fontWeight:500,transition:"opacity 0.3s"},children:S[E]}),p.jsx(UR,{variant:"determinate",value:b,sx:{width:"60%",borderRadius:4,height:6}})]}):p.jsx(n$e,{value:s,onChange:l,disabled:a})]}),!a&&p.jsxs(Ns,{className:"p-6",children:[c&&!d&&p.jsx(ht,{startIcon:p.jsx(uY,{className:"w-4 h-4"}),onClick:M,variant:"outlined",disabled:a,children:n("inputs.aiImageGeneration.regenerate")}),!c&&!d&&p.jsx(ht,{onClick:D,variant:"text",disabled:d,children:n("inputs.aiImageGeneration.cancel")}),p.jsxs(ht,{startIcon:c&&!d?p.jsx(Bwe,{className:"w-4 h-4"}):p.jsx(ro,{className:"w-4 h-4"}),onClick:A,variant:"contained",disabled:!s||s?.length<20,children:[n(c&&!d?"inputs.aiImageGeneration.insertImage":"inputs.aiImageGeneration.generateImage"),a&&p.jsx(ti,{size:16,className:"ml-2"})]})]})]})})]})}const Qr=({children:t})=>p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.3rem"},children:t}),hX=({imageUrl:t,alt:e="",blockId:n,onRemove:r})=>{const{t:i}=Ie("inspector"),a=Y9e(n??null);return t?p.jsxs(H,{sx:{position:"relative",mb:1.5,borderRadius:1,overflow:"hidden",border:"1px solid",borderColor:"divider"},children:[p.jsx("img",{src:t,alt:e,style:{width:"100%",display:"block",maxHeight:140,objectFit:"cover"}}),r&&p.jsx(cn,{"aria-label":i("inputs.common.close"),onClick:r,size:"small",sx:{position:"absolute",top:4,right:4,backgroundColor:"background.paper",color:"error.main",width:28,height:28,"&:hover":{backgroundColor:"error.50"}},children:p.jsx(tb,{fontSize:"small"})}),a&&p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:.5,px:1,py:.5,bgcolor:"#1a1a1a",color:"#ccc",fontSize:"0.65rem"},children:[p.jsx(Wwe,{sx:{fontSize:"0.8rem",flexShrink:0,color:"#ccc"}}),p.jsx(G7,{t:i,i18nKey:"inputs.unsplash.creditLine",values:{author:a.photographerName},components:{authorLink:p.jsx(ld,{href:a.photographerUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}}),unsplashLink:p.jsx(ld,{href:a.unsplashUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}})}})]})]}):null},i$e=["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"],cl={style:{color:"currentColor"},width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ul={stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"},Y5=p.jsx("svg",{...cl,children:p.jsx("path",{d:"M2.40039 5.20039V2.40039M2.40039 2.40039H5.20039M2.40039 2.40039L5.90039 5.90039M13.6004 5.20039V2.40039M13.6004 2.40039H10.8004M13.6004 2.40039L10.1004 5.90039M2.40039 10.8004V13.6004M2.40039 13.6004H5.20039M2.40039 13.6004L5.90039 10.1004M13.6004 13.6004L10.1004 10.1004M13.6004 13.6004V10.8004M13.6004 13.6004H10.8004",...ul})});function hE(t){switch(t){case"top left":return p.jsx("svg",{...cl,children:p.jsx("path",{d:"M5.26523 9.79159L5.17094 5.17183M5.17094 5.17183L9.79071 5.26611M5.17094 5.17183L10.8278 10.8287",...ul})});case"top center":return p.jsx("svg",{...cl,children:p.jsx("path",{d:"M4.7998 7.33333L7.9998 4M7.9998 4L11.1998 7.33333M7.9998 4V12",...ul})});case"top right":return p.jsx("svg",{...cl,children:p.jsx("path",{d:"M6.20841 5.2662L10.8282 5.17192M10.8282 5.17192L10.7339 9.79169M10.8282 5.17192L5.17132 10.8288",...ul})});case"center left":return p.jsx("svg",{...cl,children:p.jsx("path",{d:"M7.33333 11.2002L4 8.00019M4 8.00019L7.33333 4.8002M4 8.00019L12 8.0002",...ul})});case"center":case"center center":return Y5;case"center right":return p.jsx("svg",{...cl,children:p.jsx("path",{d:"M8.66667 4.7998L12 7.9998M12 7.9998L8.66667 11.1998M12 7.9998L4 7.9998",...ul})});case"bottom left":return p.jsx("svg",{...cl,children:p.jsx("path",{d:"M9.79062 10.7348L5.17085 10.8291M5.17085 10.8291L5.26513 6.20929M5.17085 10.8291L10.8277 5.1722",...ul})});case"bottom center":return p.jsx("svg",{...cl,children:p.jsx("path",{d:"M11.1998 8.66667L7.9998 12M7.9998 12L4.7998 8.66667M7.9998 12L7.99981 4",...ul})});case"bottom right":return p.jsx("svg",{...cl,children:p.jsx("path",{d:"M10.7338 6.20938L10.8281 10.8291M10.8281 10.8291L6.20831 10.7349M10.8281 10.8291L5.17122 5.17229",...ul})});default:return Y5}}function gE(t){switch(t){case"top left":return"topLeft";case"top center":return"topCenter";case"top right":return"topRight";case"center left":return"centerLeft";case"center":case"center center":return"center";case"center right":return"centerRight";case"bottom left":return"bottomLeft";case"bottom center":return"bottomCenter";case"bottom right":return"bottomRight";default:return"center"}}function gX(t){return p.jsx(Rr,{viewBox:"0 0 18 18",fontSize:"small",...t,children:p.jsx("path",{d:"M9.00015 6.75V8.25M9.00015 11.25H9.00765M3.804 14.25H14.1963C15.351 14.25 16.0727 13 15.4953 12L10.2992 3C9.72184 2 8.27846 2 7.70111 3L2.50496 12C1.92761 13 2.6493 14.25 3.804 14.25Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})}const a$e=({defaultValue:t,onChange:e,values:n})=>{const r=q_(),{t:i}=Ie("inspector");sn();const a=V=>{if(!V)return{url:"",repeat:"no-repeat",position:"center center",size:"cover"};const K=V.trim();let le="";if(K.startsWith("url(")){const Ee=K.match(/^url\(\s*['"]?([^'")]+)['"]?\s*\)/);le=Ee?Ee[1]:""}else(/^https?:\/\//i.test(K)||K.startsWith("data:"))&&(le=K);let he="no-repeat";V.includes("repeat-x")?he="repeat-x":V.includes("repeat-y")?he="repeat-y":V.includes("repeat")&&!V.includes("no-repeat")&&(he="repeat");let ve="center center";const _e=["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"];for(const Ee of _e)if(V.includes(Ee)){ve=Ee;break}let me="cover";return V.includes("contain")?me="contain":V.includes("auto")&&(me="auto"),{url:le,repeat:he,position:ve,size:me}},o=V=>V.url?`url("${V.url}") ${V.repeat} ${V.position} / ${V.size}`:"",[s,l]=T.useState(t||null),[c,u]=T.useState(a(t)),[d,f]=T.useState(!1),[m,h]=T.useState(()=>!!window.__emailBuilderEnableAI),[,g]=T.useState(null),[_,b]=T.useState(a(t).url||""),[y,E]=T.useState(!1),[v,x]=T.useState(""),[S,C]=T.useState(!1),k=T.useRef(null),[w,D]=T.useState(null),A=j1e(),M=G1e(),R=A||M,[I,P]=T.useState(()=>!!window.__emailBuilderUnsplashEnabled);T.useEffect(()=>{const V=()=>{P(!!window.__emailBuilderUnsplashEnabled)};return V(),window.addEventListener("email-builder-unsplash-updated",V),()=>window.removeEventListener("email-builder-unsplash-updated",V)},[]),T.useEffect(()=>{const V=window.__emailBuilderCustomImageProvider;V&&(D(V),setTimeout(()=>{r&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:r,currentImageUrl:c.url||null,alt:null,source:"background"}}))},100))},[]);const[L,B]=T.useState(()=>sessionStorage.getItem("hideBackgroundImageWarning")==="true"),F=(V,K)=>{const le={...c,...V};if(u(le),le.url){const he=o(le);l(he),e(he,K)}else console.error("Update params error: ",le)},q=(V,K)=>{if(!V)return!1;const le=V?.toLowerCase(),he=le.includes(".svg")||le.includes("svg"),ve=K&&(K.includes("image/svg+xml")||K.includes("svg"));return he||!!ve},oe=async V=>{try{E(!0),x(""),C(!1);try{new URL(V)}catch{return x("Invalid URL format"),!1}const K=new AbortController,le=setTimeout(()=>K.abort(),1e4);try{const he=await fetch(V,{method:"HEAD",signal:K.signal});if(clearTimeout(le),!he.ok)return x(`HTTP ${he.status}: ${he.statusText}`),!1;const ve=he.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(Ee=>ve&&ve.toLowerCase().includes(Ee.toLowerCase()))?(q(V,ve)&&C(!0),x(""),!0):(x("URL does not point to an image"),!1)}catch(he){return clearTimeout(le),he.name==="AbortError"?(x("Request timeout - URL took too long to respond"),!1):new Promise(ve=>{const _e=new Image,me=setTimeout(()=>{x("Request timeout - URL took too long to respond"),ve(!1)},1e4);_e.onload=()=>{clearTimeout(me),q(V)&&C(!0),x(""),ve(!0)},_e.onerror=()=>{clearTimeout(me),x("Cannot access image - CORS policy, network error, or invalid URL"),ve(!1)},_e.src=V})}}catch{return x("Unexpected error occurred while validating URL"),!1}finally{E(!1)}},G=async()=>{_.trim()&&await oe(_.trim())&&(F({url:_.trim()}),r&&jp(r))},Y=V=>{V.key==="Enter"&&G()},be=V=>{b(V.target.value),v&&x(""),S&&C(!1)},ee=V=>{const K=["image/png","image/jpeg","image/gif"],he=Array.isArray(V)?V:Array.from(V),ve=he.filter(me=>K.includes(me.type)&&me.size<=5242880);if(ve.length!==he.length&&alert(i("inputs.common.invalidFiles")),ve.length===0)return;const _e=ve.map(me=>new Promise(Ee=>{const Re=new FileReader;Re.onload=Te=>Ee(Te.target?.result),Re.readAsDataURL(me)}));Promise.all(_e).then(me=>{const Ee={images:me,id:r||"",styles:n};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:Ee})),Wp(!0,r||"")})},fe=V=>{V.preventDefault(),f(!0)},re=()=>{f(!1)},te=V=>{V.preventDefault(),f(!1);const K=V.dataTransfer.files;ee(K)},Q=()=>{u({url:"",repeat:"no-repeat",position:"center center",size:"cover"}),l(null),e(null),b(""),C(!1)};return T.useEffect(()=>{const V=window.__emailBuilderEnableAI;V!==void 0&&h(!!V);const K=le=>{const{detail:he}=le;h(!!he)};return window.addEventListener("email-builder-ai-generation",K),()=>{window.removeEventListener("email-builder-ai-generation",K)}},[]),T.useEffect(()=>{const V=ve=>{const{detail:_e}=ve;Wp(!1,_e.id||""),F({url:_e.url},_e.styles),r&&jp(r),GG(!1),b(_e.url)},K=ve=>{Wp(ve?.detail?.uploading??!1,ve?.detail?.id??"")},le=()=>{k?.current?.click()},he=ve=>{const _e=ve.detail;if(typeof _e=="string"){if(!_e.includes("url("))F({url:_e}),b(_e);else{const me=a(_e);u(me),l(_e),e(_e),b(me.url)}return}_e?.url!=null&&typeof _e.url=="string"&&(F({url:_e.url},_e.styles),b(_e.url))};return window.addEventListener("email-builder-set-image",he),window.addEventListener("email-builder-upload-image-receive",V),window.addEventListener("email-builder-upload-file",le),window.addEventListener("email-builder-toggle-upload-file",K),()=>{window.removeEventListener("email-builder-upload-image-receive",V),window.removeEventListener("email-builder-set-image",he),window.removeEventListener("email-builder-upload-file",le),window.removeEventListener("email-builder-toggle-upload-file",K)}},[c]),T.useEffect(()=>{t&&C(q(c.url))},[t,c.url]),T.useEffect(()=>{if(t!==s){const V=a(t);u(V),l(t||null),b(V.url||"")}},[t]),p.jsxs(Qr,{children:[p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:1},children:[p.jsx(on,{label:i("inputs.backgroundImage.label")}),!L&&p.jsx(Pt,{title:i("inputs.backgroundImage.warningTooltip"),placement:"top",children:p.jsx(cn,{size:"small",color:"warning",disableRipple:!0,sx:{p:0,cursor:"help",lineHeight:0,"&:hover":{backgroundColor:"transparent"}},children:p.jsx(gX,{"aria-hidden":!0})})})]}),p.jsx(hX,{imageUrl:c.url||null,blockId:r,onRemove:Q}),p.jsx(uX,{tabs:[{key:"gallery",label:i("inputs.tabs.gallery"),visible:I,render:()=>p.jsx(fX,{blockId:r,source:"background"})},{key:"yourGallery",label:i("inputs.tabs.yourGallery"),visible:!!w,render:()=>p.jsx(H,{sx:{mb:2},children:w})},{key:"upload",label:i("inputs.tabs.upload"),visible:R,render:()=>p.jsxs(qe,{gap:1,children:[p.jsx(H,{children:A&&p.jsxs(p.Fragment,{children:[p.jsx(on,{label:i("inputs.image.urlLabel")}),p.jsxs(qe,{direction:"row",gap:1,children:[p.jsx(Ir,{fullWidth:!0,placeholder:i("inputs.image.urlPlaceholder"),value:_,onChange:be,onKeyPress:Y,error:!!v,disabled:y,sx:Ko}),p.jsx(ht,{variant:"contained",onClick:G,disabled:!_.trim()||y,sx:{minWidth:"auto",px:2,position:"relative"},children:y?p.jsx(ti,{size:20,color:"inherit"}):i("inputs.common.add")})]}),v&&p.jsx($n,{severity:"error",sx:{mt:1,fontSize:"0.875rem",maxHeight:"70px"},children:v}),S&&p.jsx($n,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:p.jsx(cn,{"aria-label":i("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{C(!1)},children:p.jsx(tb,{fontSize:"inherit"})}),children:i("inputs.common.svgWarning")})]})}),A&&M&&p.jsxs(qe,{direction:"row",alignItems:"center",gap:1,children:[p.jsx(Br,{sx:{flexGrow:1}}),p.jsx(xe,{variant:"caption",sx:{color:"text.secondary"},children:i("inputs.backgroundImage.or")}),p.jsx(Br,{sx:{flexGrow:1}})]}),M&&p.jsxs(H,{onDragOver:fe,onDragLeave:re,onDrop:te,sx:{width:"100%",border:"2px dashed",borderColor:d?"primary.main":"divider",borderRadius:"8px",padding:"24px 8px 36px 8px",textAlign:"center",bgcolor:d?"primary.50":"background.paper",transition:"all 0.2s ease"},children:[p.jsx(H,{sx:{display:"flex",justifyContent:"center"},children:p.jsx(cY,{sx:{fontSize:32,color:"primary"}})}),p.jsxs("label",{style:{cursor:"pointer"},children:[p.jsx("input",{ref:k,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:V=>{const K=V.target.files;K&&K.length>0&&ee(Array.from(K))}}),p.jsx(xe,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:i("inputs.common.uploadFile")}),p.jsxs(xe,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",i("inputs.common.dragAndDrop")]})]}),p.jsx(xe,{variant:"body2",sx:{color:"text.secondary",mt:1},children:i("inputs.common.fileInfo")})]})]})},{key:"generate",label:i("inputs.tabs.generate"),visible:m,render:()=>p.jsx(mX,{src:c.url,style:{width:"100%",margin:0}})}],defaultTab:"upload"}),c.url&&p.jsxs(H,{sx:{mt:2},children:[p.jsxs(H,{sx:{mb:2},children:[p.jsx(on,{label:i("inputs.backgroundImage.fillType")}),p.jsxs(Ad,{value:c.size,exclusive:!0,onChange:(V,K)=>{K!=null&&typeof K=="string"&&F({size:K})},size:"small",fullWidth:!0,children:[p.jsx(Un,{value:"cover",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(JI,{fontSize:"small"}),p.jsx("span",{children:i("inputs.backgroundImage.fillOptions.cover")})]})}),p.jsx(Un,{value:"contain",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(ZI,{fontSize:"small"}),p.jsx("span",{children:i("inputs.backgroundImage.fillOptions.contain")})]})}),p.jsx(Un,{value:"auto",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(XI,{fontSize:"small"}),p.jsx("span",{children:i("inputs.backgroundImage.fillOptions.auto")})]})})]})]}),p.jsxs(qe,{direction:"row",gap:2,sx:{mb:2},children:[p.jsxs("div",{style:{flex:1},children:[p.jsx(on,{label:i("inputs.backgroundImage.repeat")}),p.jsxs(ha,{style:{width:"100%"},value:c.repeat,size:"small",onChange:V=>F({repeat:V.target.value}),children:[p.jsx(Yr,{value:"no-repeat",children:i("inputs.backgroundImage.repeatOptions.none")}),p.jsx(Yr,{value:"repeat",children:i("inputs.backgroundImage.repeatOptions.repeat")}),p.jsx(Yr,{value:"repeat-x",children:i("inputs.backgroundImage.repeatOptions.repeatX")}),p.jsx(Yr,{value:"repeat-y",children:i("inputs.backgroundImage.repeatOptions.repeatY")})]})]}),p.jsxs("div",{style:{flex:1},children:[p.jsx(on,{label:i("inputs.backgroundImage.position")}),p.jsx(ha,{style:{width:"100%"},value:c.position,size:"small",onChange:V=>F({position:V.target.value}),renderValue:V=>{const K=String(V??"");return p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[hE(K),i(`inputs.backgroundImage.positions.${gE(K)}`)]})},children:["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"].map(V=>p.jsx(Yr,{sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important "},value:V,children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:1},children:[hE(V),i(`inputs.backgroundImage.positions.${gE(V)}`)]})},V))})]})]})]}),!w&&S&&p.jsx($n,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},children:i("inputs.common.svgWarning")})]})};function jN({label:t,labelAction:e,defaultValue:n,onChange:r,nullable:i,compact:a=!1,inheritedFrom:o}){const[s,l]=T.useState(null),[c,u]=T.useState(n),{t:d}=Ie("inspector");T.useEffect(()=>{c!==n&&u(n)},[n]);const f=y=>{l(y.currentTarget)},m=a?{border:"1px solid",borderColor:"cadet.400",width:28,height:28,borderRadius:"8px",bgcolor:"#FFFFFF"}:{border:t?"1px solid":"",borderColor:"cadet.400",width:"100%",height:36,paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",borderRadius:"8px",bgcolor:"#FFFFFF"},h=y=>{u(y),r(y)},g=()=>!i||typeof c!="string"||c.trim().length===0?null:p.jsx(Pt,{title:d("inputs.background.reset"),placement:"left",children:p.jsx(H,{sx:{minWidth:24,lineHeight:1,flexShrink:0,pr:"4px",display:"grid",placeItems:"center"},onClick:()=>h(null),children:p.jsx(nY,{sx:{color:"primary.main"}})})}),_=c?p.jsx(si,{onClick:f,sx:{...m,bgcolor:c}}):p.jsx(si,{onClick:f,sx:{...m},children:p.jsx(QI,{fontSize:"small"})}),b=p.jsx(pS,{anchorEl:s,open:!!s,onClose:()=>l(null),sx:{"& .MuiPaper-root":{boxShadow:"0 4px 6px rgba(0, 0, 0, 0.4);",borderRadius:1,maxWidth:"200px",transform:"translateX(-100%) !important;"}},MenuListProps:{sx:{height:"auto",padding:0}},children:p.jsx(iN,{value:c||"",nullable:i,onChange:y=>h(y)})});return a?p.jsxs(H,{sx:{display:"inline-flex",opacity:o?.55:1,transition:"opacity 120ms ease-out"},children:[_,b]}):p.jsxs(Qr,{children:[p.jsx(on,{label:t,action:e}),p.jsxs(qe,{direction:"row",alignContent:"center",spacing:1,sx:{opacity:o?.55:1,transition:"opacity 120ms ease-out"},children:[_,g()]}),b]})}function td(t){return p.jsx(jN,{...t,nullable:!1})}function mv(t){return p.jsx(jN,{...t,nullable:!0})}const o$e=ie(H)(({theme:t})=>({display:"flex",alignItems:"center",border:`1px solid ${t.palette.divider}`,borderRadius:"8px",padding:"4px",minWidth:58,maxWidth:"fit-content",backgroundColor:t.palette.background.paper,"&:hover":{borderColor:t.palette.primary.main},"&:focus-within":{borderColor:t.palette.primary.main,boxShadow:`0 0 0 1px ${t.palette.primary.main}`}})),s$e=ie("input")(({theme:t})=>({border:"none",outline:"none",background:"transparent",textAlign:"center",width:"27px",minWidth:"27px",maxWidth:"27px",padding:"0!important",lineHeight:"normal",fontSize:"0.9rem",color:t.palette.text.primary,"&::-webkit-outer-spin-button, &::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},"&[type=number]":{MozAppearance:"textfield"}})),K5=ie(cn)(({theme:t})=>({padding:"0",color:t.palette.primary.main,"&:hover":{backgroundColor:je(t.palette.primary.main,.04)},"& .MuiSvgIcon-root":{fontSize:14}}));function Cr({iconLabel:t,label:e,value:n,setValue:r,units:i,min:a=0,max:o,step:s=void 0,marks:l=!0,...c}){const u=n??a,[d,f]=T.useState(u.toString()),m=v=>{let x=v;x<a&&(x=a),o!==void 0&&x>o&&(x=o),r(x),f(x.toString())},h=v=>{const x=v.target.value;if(f(x),x!==""){const S=Number(x);isNaN(S)||S>=a&&r(S)}},g=()=>{if(d===""||isNaN(Number(d)))f(u.toString());else{const v=Number(d);m(v)}},_=v=>{v.key==="Enter"&&g()};T.useEffect(()=>{f((n??a).toString())},[n,a]);const b=()=>{const v=u+1;m(v)},y=()=>{const v=u-1;m(v)},E=(v,x)=>{typeof x=="number"&&r(x)};return p.jsxs(Qr,{children:[p.jsx(on,{label:e}),p.jsxs(qe,{direction:"row",alignItems:"center",gap:2,justifyContent:"space-between",width:"100%",children:[p.jsx(H,{sx:{minWidth:24,lineHeight:1,flexShrink:0},children:t}),p.jsx(ng,{...c,value:u,min:a,max:o||1e3,step:s,color:"primary",marks:l,onChange:E}),p.jsxs(o$e,{children:[p.jsx(s$e,{type:"number",value:d,onChange:h,onBlur:g,onKeyDown:_,min:a,max:o,step:s}),p.jsxs(H,{sx:{display:"flex",flexDirection:"column",ml:.5},children:[p.jsx(K5,{onClick:b,disabled:o!==void 0&&u>=o,children:p.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",children:p.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})}),p.jsx(K5,{onClick:y,disabled:u<=a,children:p.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",style:{transform:"rotate(180deg)"},children:p.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})})]})]}),p.jsx(xe,{variant:"caption",color:"text.secondary",sx:{fontSize:"16px",ml:"4px!important"},children:i})]})]})}function Ip({label:t,defaultValue:e,onChange:n,...r}){const[i,a]=T.useState(e??0);return e!=i&&a(e),p.jsxs(Qr,{children:[p.jsx(on,{label:t}),p.jsx(Cr,{value:i??0,setValue:o=>{a(o),n(o)},...r})]})}const sO=({mobile:t=!1,label:e,borderColor:n,borderTop:r,borderBottom:i,borderLeft:a,borderRight:o,onChange:s,sidesLinked:l,onSidesLinkedChange:c})=>{const{t:u}=Ie("inspector"),d=()=>t?{top:"borderTopMobile",bottom:"borderBottomMobile",left:"borderLeftMobile",right:"borderRightMobile"}:{top:"borderTop",bottom:"borderBottom",left:"borderLeft",right:"borderRight"},f=w=>{const D=Object.values(w);return D.every(A=>A===D[0])},m=d(),h={[m.top]:r??0,[m.bottom]:i??0,[m.left]:a??0,[m.right]:o??0},[g,_]=T.useState(n??"#000000"),[b,y]=T.useState(h),E={[m.top]:Number(b[m.top]),[m.bottom]:Number(b[m.bottom]),[m.left]:Number(b[m.left]),[m.right]:Number(b[m.right])},v=l!==void 0?l:f(E);T.useEffect(()=>{n!==g&&_(n??"#000000");const w={[m.top]:r??0,[m.bottom]:i??0,[m.left]:a??0,[m.right]:o??0};Object.keys(w).some(A=>b[A]!==w[A])&&y(w)},[n,r,i,a,o,t]);const x=()=>{if(v)c(!1);else{const w=b[m.top]??0;C(w),c(!0)}},S=w=>{_(w),s({borderColor:w,...b})},C=w=>{const D={[m.top]:w,[m.bottom]:w,[m.left]:w,[m.right]:w};y(D),s({...D,borderColor:g})},k=(w,D)=>{y(M=>({...M,[D]:w}));const A={...b,borderColor:g,[D]:w};s(A)};return p.jsxs("div",{children:[p.jsxs(qe,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[p.jsx(on,{label:e}),p.jsxs(qe,{direction:"row",gap:1,alignItems:"center",children:[p.jsx(td,{defaultValue:g,onChange:S,compact:!0}),p.jsx(Pt,{title:u(v?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:p.jsx(cn,{size:"small",onClick:x,sx:{color:v?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:v?p.jsx(nb,{fontSize:"small"}):p.jsx(rb,{fontSize:"small"})})})]})]}),v&&p.jsx(Ip,{label:"",iconLabel:p.jsx(jwe,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[m.top],onChange:C}),!v&&p.jsxs(qe,{gap:2,children:[p.jsx(Ip,{label:"",iconLabel:p.jsx(Gwe,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[m.top],onChange:w=>k(w,m.top)}),p.jsx(Ip,{label:"",iconLabel:p.jsx(Uwe,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[m.bottom],onChange:w=>k(w,m.bottom)}),p.jsx(Ip,{label:"",iconLabel:p.jsx(zwe,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[m.left],onChange:w=>k(w,m.left)}),p.jsx(Ip,{label:"",iconLabel:p.jsx(Hwe,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[m.right],onChange:w=>k(w,m.right)})]})]})};function Nt({icon:t,label:e,children:n}){const r=To(),[i,a]=T.useState(!1),o=T.useRef(null);return r?p.jsxs(p.Fragment,{children:[p.jsx(Pt,{title:e,placement:"left",children:p.jsx(cn,{ref:o,onClick:()=>a(!i),color:i?"primary":"default",size:"small",sx:{borderRadius:1.5,width:32,height:32,alignSelf:"center"},children:p.jsx(t,{fontSize:"small"})})}),p.jsx(nu,{open:i,anchorEl:o.current,onClose:()=>a(!1),anchorOrigin:{vertical:"center",horizontal:"left"},transformOrigin:{vertical:"center",horizontal:"right"},slotProps:{paper:{sx:{width:360,p:2,borderRadius:2,boxShadow:"0 8px 32px rgba(0,0,0,0.12)",transform:"translateX(-18px) !important",overflow:"visible","&::after":{content:'""',position:"absolute",right:-4,top:"50%",transform:"translateY(-50%)",width:0,height:0,borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:"4px solid",borderLeftColor:"background.paper"}}}},children:n})]}):p.jsx(p.Fragment,{children:n})}const l$e=Z_.map(t=>p.jsx(Yr,{value:t.key,sx:{fontFamily:t.value},children:t.label},t.key));function HN({label:t,labelAction:e,onChange:n,defaultValue:r}){const i="INHERIT",[a,o]=T.useState(r??i);T.useEffect(()=>{a!==r&&o(r??i)},[r]);const s=l=>{const c=l.target.value;o(c),n(c===null?null:c)};return p.jsxs(Qr,{children:[p.jsx(on,{label:t,action:e}),p.jsx(ha,{style:{width:"100%"},value:a,size:"small",onChange:s,children:l$e})]})}function _E({label:t,labelAction:e,defaultValue:n=16,onChange:r,maxValue:i,minValue:a,step:o,inheritedFrom:s}){const[l,c]=T.useState(n);T.useEffect(()=>{l!==n&&c(n)},[n]);const u=d=>{c(d),r(d)};return p.jsxs(Qr,{children:[p.jsx(on,{label:t,action:e}),p.jsx(H,{sx:{opacity:s?.55:1,transition:"opacity 120ms ease-out"},children:p.jsx(Cr,{iconLabel:p.jsx(pY,{sx:{fontSize:16,color:"text.primary"}}),value:l,setValue:u,units:"px",step:o??2,min:a||8,max:i||48})})]})}function am({label:t,labelAction:e,children:n,defaultValue:r,onChange:i}){const[a,o]=T.useState(r);return T.useEffect(()=>{r!==a&&o(r)},[r]),p.jsxs(Qr,{children:[p.jsx(on,{label:t,action:e}),p.jsx(H,{sx:{...YA,paddingLeft:"0px",paddingRight:"0px"},children:p.jsx(Ad,{exclusive:!0,fullWidth:!0,value:a,size:"small",sx:{width:"100%"},onChange:(s,l)=>{if(typeof l!="string")throw new Error("RadioGroupInput can only receive string values");o(l),i(l)},children:n})})]})}function _X({label:t,labelAction:e,defaultValue:n,onChange:r}){const{t:i}=Ie("inspector"),[a,o]=T.useState(n);return T.useEffect(()=>{a!==n&&o(n)},[n]),p.jsxs(am,{label:t,labelAction:e,defaultValue:a,onChange:s=>{o(s),r(s)},children:[p.jsx(Un,{value:"normal",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(PDe,{fontSize:"small"}),p.jsx("span",{children:i("inputs.fontWeightToggle.regular")})]})}),p.jsx(Un,{value:"bold",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(ZW,{fontSize:"small"}),p.jsx("span",{children:i("inputs.fontWeightToggle.bold")})]})})]})}const lO=({label:t,defaultValue:e,onChange:n,min:r=1,max:i=100,step:a=1})=>{const{t:o}=Ie("inspector"),s=t??o("inputs.common.height");return p.jsx(Cr,{label:s,iconLabel:p.jsx(d_,{sx:{color:"text.secondary"}}),units:"px",step:a,min:r,max:i,marks:!1,value:e??r,setValue:n})},c$e=[{key:"1",value:"1",label:"Simple (1.0)"},{key:"1.15",value:"1.15",label:"Compact (1.15)"},{key:"1.5",value:"1.5",label:"Normal (1.5)"},{key:"2",value:"2",label:"Relaxed (2.0)"},{key:"2.5",value:"2.5",label:"Wide (2.5)"},{key:"3",value:"3",label:"Loose (3.0)"},{key:"4",value:"4",label:"Very Loose (4.0)"}],u$e=c$e.map(t=>p.jsx(Yr,{value:t.key,children:t.label},t.key));function d$e({label:t,onChange:e,defaultValue:n}){const r="INHERIT",[i,a]=T.useState(n?.toString()??r);T.useEffect(()=>{i!==n?.toString()&&a(n?.toString()??r)},[n]);const o=s=>{const l=s.target.value;a(l),e(l===r?null:parseFloat(l))};return p.jsxs(Qr,{children:[p.jsx(on,{label:t}),p.jsxs(ha,{style:{width:"100%"},value:i,size:"small",onChange:o,children:[p.jsx(Yr,{value:r,children:"Default value"}),u$e]})]})}function p$e(t){return p.jsxs(Rr,{...t,viewBox:"0 0 16 16",children:[p.jsx("path",{fill:"currentColor",d:"M0 0v16h16V0zm15 3h-1v1h1v11H1V3h1V2H1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1z"}),p.jsx("path",{fill:"currentColor",d:"M3 2h1v1H3zM2 3h1v1H2zm2 0h1v1H4zm2 0h1v1H6zM5 2h1v1H5zm2 0h1v1H7zm2 0h1v1H9zM8 3h1v1H8zm2 0h1v1h-1zm2 0h1v1h-1zm-1-1h1v1h-1zm2 0h1v1h-1z"})]})}function f$e(t){return p.jsxs(Rr,{...t,viewBox:"0 0 16 16",children:[p.jsx("path",{fill:"currentColor",d:"M16 16V0H0v16zM1 13h1v-1H1V1h14v12h-1v1h1v1h-1v-1h-1v1h-1v-1h-1v1h-1v-1H9v1H8v-1H7v1H6v-1H5v1H4v-1H3v1H2v-1H1z"}),p.jsx("path",{fill:"currentColor",d:"M12 13h1v1h-1zm1-1h1v1h-1zm-2 0h1v1h-1zm-2 0h1v1H9zm1 1h1v1h-1zm-2 0h1v1H8zm-2 0h1v1H6zm1-1h1v1H7zm-2 0h1v1H5zm-2 0h1v1H3zm1 1h1v1H4zm-2 0h1v1H2z"})]})}function m$e(t){return p.jsxs(Rr,{...t,viewBox:"0 0 16 16",children:[p.jsx("path",{fill:"currentColor",d:"M0 16h16V0H0zM3 1v1h1V1h11v14H3v-1H2v1H1v-1h1v-1H1v-1h1v-1H1v-1h1V9H1V8h1V7H1V6h1V5H1V4h1V3H1V2h1V1z"}),p.jsx("path",{fill:"currentColor",d:"M2 12h1v1H2zm1 1h1v1H3zm0-2h1v1H3zm0-2h1v1H3zm-1 1h1v1H2zm0-2h1v1H2zm0-2h1v1H2zm1 1h1v1H3zm0-2h1v1H3zm0-2h1v1H3zM2 4h1v1H2zm0-2h1v1H2z"})]})}function h$e(t){return p.jsxs(Rr,{...t,viewBox:"0 0 16 16",children:[p.jsx("path",{fill:"currentColor",d:"M16 0H0v16h16zm-3 15v-1h-1v1H1V1h12v1h1V1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1z"}),p.jsx("path",{fill:"currentColor",d:"M13 3h1v1h-1zm-1-1h1v1h-1zm0 2h1v1h-1zm0 2h1v1h-1zm1-1h1v1h-1zm0 2h1v1h-1zm0 2h1v1h-1zm-1-1h1v1h-1zm0 2h1v1h-1zm0 2h1v1h-1zm1-1h1v1h-1zm0 2h1v1h-1z"})]})}const bE=(t=>p.jsxs(Rr,{...t,viewBox:"0 0 16 16",children:[p.jsx("path",{fill:"currentColor",d:"M0 0v16h16V0zm15 3h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v-1h-1v1h-1v-1h-1v1h-1v-1H9v1H8v-1H7v1H6v-1H5v1H4v-1H3v1H2v-1H1v-1h1v-1H1v-1h1v-1H1V9h1V8H1V7h1V6H1V5h1V4H1V3h1V2H1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1z"}),p.jsx("path",{fill:"currentColor",d:"M3 2h1v1H3zm1 1h1v1H4zm2 0h1v1H6zM5 2h1v1H5zm2 0h1v1H7zm2 0h1v1H9zM8 3h1v1H8zm2 0h1v1h-1zm2 0h1v1h-1zm-1-1h1v1h-1zm2 0h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zM2 3h1v1H2zm1 1h1v1H3zM2 5h1v1H2zm1 1h1v1H3zM2 7h1v1H2zm1 1h1v1H3zM2 9h1v1H2zm1 1h1v1H3zm-1 1h1v1H2zm0 2h1v1H2zm1-1h1v1H3zm1-1h1v1H4zm0 2h1v1H4zm1-1h1v1H5zm1 1h1v1H6zm1-1h1v1H7zm2 0h1v1H9zm-1 1h1v1H8zm3-1h1v1h-1zm-1 1h1v1h-1z"})]}));bE.muiName="PaddingIcon";function cO({label:t,labelAction:e,defaultValue:n,onChange:r,sidesLinked:i,onSidesLinkedChange:a,inheritedFrom:o}){const{t:l}=Ie("inspector"),[c,u]=T.useState(()=>n||{top:0,left:0,bottom:0,right:0});T.useEffect(()=>{n&&(n.top!==c.top||n.left!==c.left||n.bottom!==c.bottom||n.right!==c.right)&&u(n)},[n]);const d=c.top===c.bottom&&c.top===c.left&&c.top===c.right,f=i===!0&&d;function m(g,_){let b;f?b={top:_,bottom:_,left:_,right:_}:b={...c,[g]:_},u(b),r(b)}const h=()=>{const g=!f;if(!f){const _={top:c.top,bottom:c.top,left:c.top,right:c.top};u(_),r(_)}a(g)};return p.jsxs(Qr,{children:[p.jsxs(qe,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[p.jsx(on,{label:t,action:e}),p.jsx(Pt,{title:l(f?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:p.jsx(cn,{size:"small",onClick:h,sx:{marginTop:"0!important",color:f?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:f?p.jsx(nb,{fontSize:"small"}):p.jsx(rb,{fontSize:"small"})})})]}),p.jsx(qe,{sx:{opacity:o?.55:1,transition:"opacity 120ms ease-out"},gap:1,children:f?p.jsx(Cr,{iconLabel:p.jsx("span",{children:l("inputs.responsiveSize.allSides")}),value:c.top,setValue:g=>m("top",g),units:"px",step:16,min:0,max:120,marks:!0}):p.jsxs(p.Fragment,{children:[p.jsx(Cr,{iconLabel:p.jsx(p$e,{sx:{fontSize:16,color:"text.primary"}}),value:c.top,setValue:g=>m("top",g),units:"px",step:16,min:0,max:120,marks:!0}),p.jsx(Cr,{iconLabel:p.jsx(f$e,{sx:{fontSize:16,color:"text.primary"}}),value:c.bottom,setValue:g=>m("bottom",g),units:"px",step:16,min:0,max:120,marks:!0}),p.jsx(Cr,{iconLabel:p.jsx(m$e,{sx:{fontSize:16,color:"text.primary"}}),value:c.left,setValue:g=>m("left",g),units:"px",step:16,min:0,max:120,marks:!0}),p.jsx(Cr,{iconLabel:p.jsx(h$e,{sx:{fontSize:16,color:"text.primary"}}),value:c.right,setValue:g=>m("right",g),units:"px",step:16,min:0,max:120,marks:!0})]})})]})}const g$e=({label:t,defaultValue:e,onChange:n,maxValue:r=600,shapeSteps:i=8,cornersLinked:a,onCornersLinkedChange:o})=>{const{t:s}=Ie("inspector"),[l,c]=T.useState(()=>typeof e=="object"&&e!==null?"rounded":e||"rectangle"),[u,d]=T.useState(()=>typeof e=="object"&&e!==null?e:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0}),f=a===!0;T.useEffect(()=>{typeof e=="object"&&e!==null?(d(e),c("rounded")):(e==="rectangle"||e==="pill")&&c(e)},[e]);const m=y=>{const E=y;c(E),n(E==="rounded"?u:E)},h=(y,E)=>{let v;f?v={topLeft:E,topRight:E,bottomLeft:E,bottomRight:E}:v={...u,[y]:E},d(v),n(v)},g=()=>{const y=!f;if(!f){const E={topLeft:u.topLeft,topRight:u.topLeft,bottomLeft:u.topLeft,bottomRight:u.topLeft};d(E),n(E)}o(y)},_=typeof r=="number"?r:Number(r)||600,b=t||s("shape.label");return p.jsxs(p.Fragment,{children:[p.jsxs(am,{label:b,defaultValue:l,onChange:m,children:[p.jsx(Un,{value:"rectangle",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(Zwe,{fontSize:"small"}),p.jsx("span",{children:s("shape.square")})]})}),p.jsx(Un,{value:"pill",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(SDe,{fontSize:"small"}),p.jsx("span",{children:s("shape.pill")})]})}),p.jsx(Un,{value:"rounded",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(sp,{fontSize:"small"}),p.jsx("span",{children:s("shape.custom")})]})})]}),l==="rounded"&&p.jsxs(qe,{gap:2,alignItems:"flexStart",pb:1,children:[p.jsxs(qe,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[p.jsx(on,{label:s("shape.borderRadius")}),p.jsx(Pt,{title:s(f?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:p.jsx(cn,{size:"small",onClick:g,sx:{marginTop:"0!important",color:f?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:f?p.jsx(nb,{fontSize:"small"}):p.jsx(rb,{fontSize:"small"})})})]}),f?p.jsx(p.Fragment,{children:p.jsx(Cr,{iconLabel:p.jsx(sp,{sx:{fontSize:16}}),value:Number(u.topRight),setValue:y=>h("topLeft",y),units:"px",min:0,step:i,marks:i>1,max:_})}):p.jsxs(p.Fragment,{children:[p.jsx(Cr,{iconLabel:p.jsx(sp,{sx:{fontSize:16,transform:"rotate(0deg)"}}),value:Number(u.topLeft),setValue:y=>h("topLeft",y),units:"px",min:0,step:i,marks:i>1,max:_}),p.jsx(Cr,{iconLabel:p.jsx(sp,{sx:{fontSize:16,transform:"rotate(270deg)"}}),value:Number(u.topRight),setValue:y=>h("topRight",y),units:"px",min:0,step:i,marks:i>1,max:_}),p.jsx(Cr,{iconLabel:p.jsx(sp,{sx:{fontSize:16,transform:"rotate(180deg)"}}),value:Number(u.bottomLeft),setValue:y=>h("bottomLeft",y),units:"px",min:0,step:i,marks:i>1,max:_}),p.jsx(Cr,{iconLabel:p.jsx(sp,{sx:{fontSize:16,transform:"rotate(90deg)"}}),value:Number(u.bottomRight),setValue:y=>h("bottomRight",y),units:"px",min:0,step:i,marks:i>1,max:_})]})]})]})};function uO({label:t,labelAction:e,defaultValue:n,onChange:r}){const[i,a]=T.useState(n??"left");return T.useEffect(()=>{n!==i&&a(n??"left")},[n]),p.jsxs(Qr,{children:[p.jsx(on,{label:t,action:e}),p.jsxs(am,{label:"",defaultValue:i,onChange:o=>{a(o),r(o)},children:[p.jsx(Un,{value:"left",children:p.jsx(pDe,{fontSize:"small"})}),p.jsx(Un,{value:"center",children:p.jsx(S1,{fontSize:"small"})}),p.jsx(Un,{value:"right",children:p.jsx(fDe,{fontSize:"small"})})]})]})}const Q5=({label:t,defaultValue:e,onChange:n,step:r,...i})=>{const{t:a}=Ie("inspector"),o=t??a("inputs.common.width");return p.jsx(Cr,{label:o,iconLabel:p.jsx(d_,{sx:{color:"text.primary",transform:"rotate(90deg)"}}),units:"%",step:r,min:1,max:100,marks:!1,value:e??1,setValue:n,...i})},c0=(t=>p.jsx(Rr,{...t,viewBox:"0 0 24 24",children:p.jsx("path",{fill:"currentColor",d:"M15 4h7v2h-7zm1 4h6v2h-6zm2 4h4v2h-4zM9.307 4l-6 16h2.137l1.875-5h6.363l1.875 5h2.137l-6-16zm-1.239 9L10.5 6.515L12.932 13z"})}));c0.muiName="FontFamilyIcon";const v_=(t=>p.jsx(Rr,{...t,viewBox:"0 0 24 24",children:p.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",children:[p.jsx("path",{d:"M13.04 4.75h3.66c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311c.327.642.327 1.482.327 3.162v5.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311c-.642.327-1.482.327-3.162.327H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 17.47 3 16.63 3 14.95v-.93"}),p.jsx("path",{d:"m6.407 2.818l5.384 5.385M6.407 2.818L3.01 6.214c-.696.696-1.044 1.044-1.174 1.446c-.057.176-.086.36-.086.543m4.657-5.385L5.589 2m6.202 6.203l-3.396 3.396c-.696.696-1.044 1.044-1.445 1.174a1.76 1.76 0 0 1-1.086 0c-.401-.13-.75-.478-1.445-1.174L3.01 10.191c-.696-.696-1.044-1.044-1.174-1.445a1.8 1.8 0 0 1-.086-.543m10.042 0H1.75m10.672 4.094l1.485-2.448l1.744 2.313a1.824 1.824 0 0 1-.668 2.491c-1.546.893-3.322-.74-2.562-2.356"})]})}));v_.muiName="BackgroundColorIcon";const u0=(t=>p.jsx(Rr,{...t,viewBox:"0 0 24 24",children:p.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",children:[p.jsx("path",{d:"m7.154 13.088l1.73-3.959m0 0h6.231m-6.23 0l2.652-6.065a.5.5 0 0 1 .926 0l2.652 6.065m0 0l1.731 3.96"}),p.jsx("rect",{width:"15.5",height:"4.353",x:"4.25",y:"16.897",rx:"1.5"})]})}));u0.muiName="TextColorIcon";function _$e({name:t,value:e,onChange:n,shapeMaxValue:r,shapeSteps:i}){const a=or(),o=ES(),s=yS(),{t:l}=Ie("inspector"),c=b=>{if(!s)return e[b]??null;const y=a==="desktop"?"desktop":"mobile",E=o?.theme,x=AG({type:s,data:{style:e}},"style",b,E,y);return x!==void 0?x:y_[s]?.style?.[b]??null},u=b=>{if(e[b]!==void 0&&e[b]!==null||!s)return;const E=o?.theme?.blocks?.[s]?.style?.[b];if(E!=null)return"theme";const v=y_[s]?.style?.[b];return v!=null?"default":void 0},d=b=>c(b),f=(b,y)=>{const E=e[b],v=e[y];return E??v},m=(b,y)=>{n(y?{...e,...y,[t]:b}:{...e,[t]:b})},h=b=>{n({...e,...b})},_=(()=>{switch(t){case"textAlignMobile":return c("textAlignMobile")??c("textAlign");case"mobilePadding":return c("mobilePadding")??c("padding");case"fontSizeMobile":return c("fontSizeMobile")??c("fontSize")??16;case"heightMobile":return c("heightMobile")??c("height");case"widthMobile":return c("widthMobile")??c("width");case"borderMobile":return{borderTop:f("borderTopMobile","borderTop"),borderBottom:f("borderBottomMobile","borderBottom"),borderLeft:f("borderLeftMobile","borderLeft"),borderRight:f("borderRightMobile","borderRight")};default:return c(t)}})();switch(t){case"backgroundColor":return p.jsx(Nt,{icon:v_,label:l("properties.backgroundColor"),children:p.jsx(mv,{label:l("properties.backgroundColor"),defaultValue:_??o?.canvasColor,onChange:m})});case"background":return p.jsx(Nt,{icon:fY,label:l("properties.background","Background"),children:p.jsx(a$e,{defaultValue:_,onChange:(b,y)=>m(b,y),values:e})});case"borderColor":return p.jsx(Nt,{icon:v_,label:l("properties.border"),children:p.jsx(mv,{label:l("properties.border"),defaultValue:_,onChange:m})});case"borderRadius":return p.jsx(Nt,{icon:WC,label:l("properties.borderRadius"),children:p.jsx(Ip,{iconLabel:p.jsx(WC,{}),units:"px",step:4,marks:!0,min:0,max:48,label:l("properties.borderRadius"),defaultValue:_,onChange:m})});case"color":return p.jsx(Nt,{icon:tN,label:l("properties.color"),children:p.jsx(mv,{label:l("properties.color"),defaultValue:_,onChange:m})});case"fontFamily":return p.jsx(Nt,{icon:c0,label:l("properties.fontFamily"),children:p.jsx(HN,{label:l("properties.fontFamily"),defaultValue:_,onChange:m})});case"fontWeight":return p.jsx(Nt,{icon:eY,label:l("properties.fontWeight"),children:p.jsx(_X,{label:l("properties.fontWeight"),defaultValue:_,onChange:m})});case"textAlign":return a==="desktop"&&p.jsx(Nt,{icon:S1,label:l("properties.alignment"),children:p.jsx(uO,{label:l("properties.alignment"),defaultValue:_,onChange:m})});case"textAlignMobile":return a!="desktop"&&p.jsx(Nt,{icon:S1,label:l("properties.alignment"),children:p.jsx(uO,{label:l("properties.alignment"),defaultValue:_,onChange:m})});case"padding":return a==="desktop"&&p.jsx(Nt,{icon:bE,label:l("properties.padding"),children:p.jsx(cO,{label:l("properties.padding"),defaultValue:c("padding"),inheritedFrom:u("padding"),onChange:m,sidesLinked:e.paddingSidesLinked,onSidesLinkedChange:b=>n({...e,paddingSidesLinked:b})})});case"mobilePadding":return a!="desktop"&&p.jsx(Nt,{icon:bE,label:l("properties.padding"),children:p.jsx(cO,{label:l("properties.padding"),defaultValue:c("mobilePadding")??c("padding"),inheritedFrom:e.mobilePadding!=null?void 0:"default",onChange:m,sidesLinked:e.mobilePaddingSidesLinked,onSidesLinkedChange:b=>n({...e,mobilePaddingSidesLinked:b})})});case"fontSize":return a==="desktop"&&p.jsx(Nt,{icon:C1,label:l("properties.fontSize"),children:p.jsx(_E,{maxValue:80,step:8,label:l("properties.fontSize"),defaultValue:_??16,onChange:m})});case"fontSizeMobile":return a!="desktop"&&p.jsx(Nt,{icon:C1,label:l("properties.fontSize"),children:p.jsx(_E,{maxValue:80,step:8,label:l("properties.fontSize"),defaultValue:_,onChange:m})});case"lineHeight":return p.jsx(Nt,{icon:_De,label:l("properties.lineHeight"),children:p.jsx(d$e,{label:l("properties.lineHeight"),defaultValue:_??1.5,onChange:m})});case"shape":return p.jsx(Nt,{icon:WC,label:l("properties.shape"),children:p.jsx(g$e,{shapeSteps:i,maxValue:r,label:l("properties.shape"),defaultValue:_,onChange:m,cornersLinked:e.shapeCornersLinked,onCornersLinkedChange:b=>n({...e,shapeCornersLinked:b})})});case"height":return a==="desktop"&&p.jsx(Nt,{icon:d_,label:l("properties.height"),children:p.jsx(lO,{label:l("properties.height"),defaultValue:_,onChange:m})});case"heightMobile":return a!="desktop"&&p.jsx(Nt,{icon:d_,label:l("properties.height"),children:p.jsx(lO,{label:l("properties.height"),defaultValue:_,onChange:m})});case"width":return a==="desktop"&&p.jsx(Nt,{icon:C2,label:l("properties.width"),children:p.jsx(Q5,{label:l("properties.width"),defaultValue:c("width")??void 0,onChange:m})});case"widthMobile":return a!="desktop"&&p.jsx(Nt,{icon:C2,label:l("properties.width"),children:p.jsx(Q5,{label:l("properties.width"),defaultValue:c("widthMobile")??c("width")??void 0,onChange:m})});case"border":return a==="desktop"&&p.jsx(Nt,{icon:E2,label:l("properties.border"),children:p.jsx(sO,{label:l("properties.border"),borderColor:e.borderColor??null,borderTop:d("borderTop"),borderBottom:d("borderBottom"),borderLeft:d("borderLeft"),borderRight:d("borderRight"),onChange:h,sidesLinked:e.borderSidesLinked,onSidesLinkedChange:b=>n({...e,borderSidesLinked:b})})});case"borderMobile":return a!="desktop"&&p.jsx(Nt,{icon:E2,label:l("properties.border"),children:p.jsx(sO,{mobile:!0,label:l("properties.border"),borderColor:e.borderColor??null,borderTop:d("borderTopMobile")??d("borderTop"),borderBottom:d("borderBottomMobile")??d("borderBottom"),borderLeft:d("borderLeftMobile")??d("borderLeft"),borderRight:d("borderRightMobile")??d("borderRight"),onChange:h,sidesLinked:e.borderMobileSidesLinked,onSidesLinkedChange:b=>n({...e,borderMobileSidesLinked:b})})});default:return null}}const Tu={section:"style",key:"padding",kind:"padding",labelKey:"theme.fields.padding"},cc={section:"style",key:"backgroundColor",kind:"color",labelKey:"theme.fields.backgroundColor"},b$e={section:"style",key:"fontWeight",kind:"fontWeight",labelKey:"theme.fields.fontWeight"},y$e={section:"style",key:"textAlign",kind:"textAlign",labelKey:"theme.fields.textAlign"},v$e=["NotionText","Button","Image","Divider","Spacer","SocialMedia","Container","ColumnsContainer"],bX={NotionText:{titleKey:"theme.blocks.notionText.title",icon:$5e,fields:[cc,{section:"style",key:"fontSize",kind:"fontSize",labelKey:"theme.fields.fontSize"},Tu]},Button:{titleKey:"theme.blocks.button.title",icon:n9e,fields:[{section:"style",key:"buttonBackgroundColor",kind:"color",labelKey:"theme.fields.buttonBackgroundColor",icon:j5},{section:"style",key:"buttonTextColor",kind:"color",labelKey:"theme.fields.buttonTextColor",icon:u0},{section:"style",key:"fontSize",kind:"fontSize",labelKey:"theme.fields.fontSize"},b$e,y$e,cc,Tu]},Image:{titleKey:"theme.blocks.image.title",icon:X5e,fields:[cc,Tu]},Divider:{titleKey:"theme.blocks.divider.title",icon:Y5e,fields:[{section:"style",key:"color",kind:"color",labelKey:"theme.fields.color",icon:j5},cc,{section:"style",key:"width",kind:"number",labelKey:"theme.fields.width"},{section:"style",key:"height",kind:"number",labelKey:"theme.fields.height"},Tu]},Spacer:{titleKey:"theme.blocks.spacer.title",icon:j5e,fields:[cc,{section:"style",key:"height",kind:"number",labelKey:"theme.fields.height"}]},SocialMedia:{titleKey:"theme.blocks.socialMedia.title",icon:V5e,fields:[cc,Tu]},Container:{titleKey:"theme.blocks.container.title",icon:aX,fields:[cc,{section:"style",key:"border",kind:"border",labelKey:"theme.fields.border"},Tu]},ColumnsContainer:{titleKey:"theme.blocks.columnsContainer.title",icon:a9e,fields:[cc,Tu]}};function uu({title:t,children:e}){const n=To(),r=yS(),a=(r?bX[r]:null)?.icon;return p.jsxs(ff,{sx:{padding:"0!important",paddingTop:"1rem!important"},children:[!n&&p.jsx(xe,{sx:{fontWeight:"bold",mb:2,pb:1,color:"text.primary",fontSize:"1.25rem",borderBottom:o=>`1px solid ${o.palette.divider}`},children:t}),n&&a&&p.jsx(Pt,{title:t,placement:"left",children:p.jsx(H,{sx:{display:"flex",justifyContent:"center",pb:1.5},children:p.jsx(a,{sx:{fontSize:22,color:"primary.main"}})})}),p.jsx(qe,{gap:n?.5:1,mb:3,pt:n?0:1,children:e})]})}function cb(){return To()?p.jsx(Br,{sx:{my:.5}}):null}function X5(t){return{top:Number(t.top??0),bottom:Number(t.bottom??0),left:Number(t.left??0),right:Number(t.right??0)}}function E$e({size:t,sizeMobile:e,sizePaddingSidesLinked:n,sizeMobilePaddingSidesLinked:r,onChange:i,label:a,maxValue:o=100,paddingSteps:s=8}){const{t:l}=Ie("inspector"),c=a??l("inputs.common.size"),u=or(),[d,f]=T.useState(()=>{const v=u==="desktop"?t:e!==void 0?e:t;return typeof v=="object"&&v!==null?X5(v):{top:8,bottom:8,left:16,right:16}}),m=u==="desktop"?n===!0:r===!0;T.useEffect(()=>{const v=u==="desktop"?t:e!==void 0?e:t;typeof v=="object"&&v!==null&&f(X5(v))},[t,e,u]);const h=()=>{const v=u==="desktop"?t:e!==void 0?e:t;return typeof v=="object"&&v!==null?"custom":typeof v=="string"?v:"medium"},g=typeof o=="number"?o:Number(o)||100,_=v=>{if(u==="desktop"){const x={size:v==="custom"?d:v};e==null&&(x.sizeMobile=v==="custom"?d:v),i(x)}else i({sizeMobile:v==="custom"?d:v})},b=(v,x)=>{let S;m?S={top:x,bottom:x,left:x,right:x}:S={...d,[v]:x},f(S),i(u==="desktop"?{size:S}:{sizeMobile:S})},y=()=>{if(u==="desktop")if(m)i({sizePaddingSidesLinked:!1});else{const v={top:d.top,bottom:d.top,left:d.top,right:d.top};f(v),i({size:v,sizePaddingSidesLinked:!0})}else if(m)i({sizeMobilePaddingSidesLinked:!1});else{const v={top:d.top,bottom:d.top,left:d.top,right:d.top};f(v),i({sizeMobile:v,sizeMobilePaddingSidesLinked:!0})}},E=h();return p.jsxs(qe,{gap:2,children:[p.jsxs(am,{label:c,defaultValue:E,onChange:_,children:[p.jsx(Un,{value:"x-small",children:p.jsx(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:p.jsx("span",{children:l("inputs.responsiveSize.options.xSmall")})})}),p.jsx(Un,{value:"small",children:p.jsx(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:p.jsx("span",{children:l("inputs.responsiveSize.options.small")})})}),p.jsx(Un,{value:"medium",children:p.jsx(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:p.jsx("span",{children:l("inputs.responsiveSize.options.medium")})})}),p.jsx(Un,{value:"custom",children:p.jsx(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:p.jsx("span",{children:l("inputs.responsiveSize.options.custom")})})})]}),E==="custom"&&p.jsxs(qe,{gap:2,alignItems:"flexStart",pb:1,children:[p.jsxs(qe,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[p.jsx(on,{label:l("inputs.responsiveSize.customPadding")}),p.jsx(Pt,{title:l(m?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:p.jsx(cn,{size:"small",onClick:y,sx:{marginTop:"0!important",color:m?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:m?p.jsx(nb,{fontSize:"small"}):p.jsx(rb,{fontSize:"small"})})})]}),m?p.jsx(Cr,{iconLabel:p.jsx(xe,{variant:"body2",component:"span",children:l("inputs.responsiveSize.allSides")}),value:d.top,setValue:v=>b("top",v),units:"px",min:0,step:s,marks:s>1,max:g}):p.jsxs(p.Fragment,{children:[p.jsx(Cr,{iconLabel:p.jsx(Mwe,{sx:{fontSize:16}}),value:d.top,setValue:v=>b("top",v),units:"px",min:0,step:s,marks:s>1,max:g}),p.jsx(Cr,{iconLabel:p.jsx(Nwe,{sx:{fontSize:16}}),value:d.bottom,setValue:v=>b("bottom",v),units:"px",min:0,step:s,marks:s>1,max:g}),p.jsx(Cr,{iconLabel:p.jsx(Rwe,{sx:{fontSize:16}}),value:d.left,setValue:v=>b("left",v),units:"px",min:0,step:s,marks:s>1,max:g}),p.jsx(Cr,{iconLabel:p.jsx(Iwe,{sx:{fontSize:16}}),value:d.right,setValue:v=>b("right",v),units:"px",min:0,step:s,marks:s>1,max:g})]})]})]})}function S$e({fullWidth:t,fullWidthMobile:e,onChange:n,label:r="Width"}){const i=or(),{t:a}=Ie("inspector"),o=()=>i==="desktop"?t:e!==void 0?e:t,s=c=>{const u=c==="FULL_WIDTH";if(i==="desktop"){const d={fullWidth:u};e==null&&(d.fullWidthMobile=u),n(d)}else n({fullWidthMobile:u})},l=o();return p.jsxs(am,{label:r,defaultValue:l?"FULL_WIDTH":"AUTO",onChange:s,children:[p.jsx(Un,{value:"FULL_WIDTH",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(GDe,{fontSize:"small"}),p.jsx("span",{children:a("inputs.width.full")})]})}),p.jsx(Un,{value:"AUTO",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(VDe,{fontSize:"small"}),p.jsx("span",{children:a("inputs.width.auto")})]})})]})}function C$e(t,e){const n=T.useRef(null),r=T.useRef(t),i=T.useRef([]);r.current=t;const a=T.useCallback((...o)=>{i.current=o,n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{r.current(...o),n.current=null},e)},[e]);return a.flush=T.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=null,r.current(...i.current))},[]),a}function yE({helperText:t,label:e,placeholder:n,rows:r,InputProps:i,defaultValue:a,onChange:o}){const[s,l]=T.useState(a);T.useEffect(()=>{s!==a&&l(a)},[a]);const c=C$e(d=>{o(d)},150),u=typeof r=="number"&&r>1;return p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[p.jsx(on,{label:e}),p.jsx(Ir,{fullWidth:!0,multiline:u,minRows:r,variant:"outlined",placeholder:n,helperText:t,InputProps:i,value:s,sx:Ko,onChange:d=>{const f=d.target.value;l(f),c(f)},onBlur:()=>{c.flush()}})]})}function na({names:t,value:e,onChange:n,disabledCSSValidation:r=!1,shapeMaxValue:i,shapeSteps:a}){const o=Rd(),s=yS();return(To()||r||o=="css"||ig.includes(s||""))&&p.jsx(p.Fragment,{children:t.map(c=>p.jsx(_$e,{shapeMaxValue:i,shapeSteps:a,name:c,value:e||{},onChange:n},c))})}function x$e({data:t,setData:e}){const[,n]=T.useState(null),r=ES(),{t:i}=Ie("inspector"),a=b=>{const y=z_.safeParse(b);y.success?(e(y.data),n(null)):n(y.error)},o=t.props?.text??wc.text,s=t.props?.url??wc.url,l=t.props?.fullWidth??wc.fullWidth,c=t.props?.size??wc.size,u=r,d=t.style?.buttonTextColor??t.props?.buttonTextColor??u?.textColor,f=t.style?.buttonBackgroundColor??t.props?.buttonBackgroundColor??wc.buttonBackgroundColor,m=t.props?.fullWidthMobile,h=t.props?.sizeMobile,g=Rd(),_=To();return p.jsxs(uu,{title:i("inputs.panels.button.title"),children:[(g=="block-configuration"||_)&&p.jsxs(p.Fragment,{children:[p.jsx(na,{disabledCSSValidation:!0,names:["fontFamily","fontSize","fontSizeMobile","fontWeight"],value:t.style,onChange:b=>a({...t,style:b})}),p.jsx(Nt,{icon:FDe,label:i("inputs.panels.button.textLabel"),children:p.jsx(yE,{label:i("inputs.panels.button.textLabel"),defaultValue:o,onChange:b=>a({...t,props:{...t.props,text:b}})})}),p.jsx(Nt,{icon:eN,label:i("inputs.panels.button.targetLabel"),children:p.jsx(yE,{label:i("inputs.panels.button.targetLabel"),placeholder:i("inputs.panels.button.targetPlaceholder"),defaultValue:s,onChange:b=>a({...t,props:{...t.props,url:b}})})}),p.jsx(Nt,{icon:C2,label:i("properties.width"),children:p.jsx(S$e,{label:i("properties.width"),fullWidth:l,fullWidthMobile:m,onChange:b=>a({...t,props:{...t.props,...b}})})}),p.jsx(Nt,{icon:Fwe,label:i("properties.size","Size"),children:p.jsx(E$e,{size:c,sizeMobile:h,sizePaddingSidesLinked:t.props?.sizePaddingSidesLinked,sizeMobilePaddingSidesLinked:t.props?.sizeMobilePaddingSidesLinked,onChange:b=>a({...t,props:{...t.props,...b}})})})]}),p.jsx(cb,{}),p.jsx(na,{names:["shape","textAlign","textAlignMobile","backgroundColor","border","borderMobile","padding","mobilePadding"],value:t.style,shapeMaxValue:80,onChange:b=>a({...t,style:b})}),(g==="css"||_)&&p.jsxs(p.Fragment,{children:[p.jsx(Nt,{icon:u0,label:i("inputs.panels.button.textColor"),children:p.jsx(td,{label:i("inputs.panels.button.textColor"),defaultValue:d,onChange:b=>a({...t,style:{...t.style,buttonTextColor:b}})})}),p.jsx(Nt,{icon:tN,label:i("inputs.panels.button.buttonColor"),children:p.jsx(td,{label:i("inputs.panels.button.buttonColor"),defaultValue:f,onChange:b=>a({...t,style:{...t.style,buttonBackgroundColor:b}})})})]})]})}const T$e=(t,e,n)=>{if(!t||!document)return;const r=Xt(t),i=document.querySelector(`.${r}`);if(!i)return;const a=i.parentElement;if(!a)return;const o=Math.ceil(a.getBoundingClientRect().width);n.props?.touched||n.props?.width!==o&&e({...n,props:{...n.props,width:o}})},k$e=t=>{if(!t||!document)return;const e=Xt(t),n=document.querySelector(`.${e}`);if(!n)return;const r=n.parentElement;if(!r)return;const i=Math.ceil(r.getBoundingClientRect().width);return i||null},w$e={desktop:"contentAlignment",mobile:"contentAlignmentMobile"};function D$e({data:t,updateData:e}){const{t:n}=Ie("inspector"),r=or(),i=w$e[r]||"contentAlignment",a=t.props?.[i]??t.props?.contentAlignment,o=s=>{e({...t,props:{...t.props,[i]:s}})};return p.jsxs(am,{label:n("inputs.alignment.label"),defaultValue:a,onChange:o,children:[p.jsx(Un,{value:"top",children:p.jsx(zDe,{fontSize:"small"})}),p.jsx(Un,{value:"middle",children:p.jsx(UDe,{fontSize:"small"})}),p.jsx(Un,{value:"bottom",children:p.jsx($De,{fontSize:"small"})})]})}function J5({value:t,onChange:e,options:n}){return p.jsx(Ad,{exclusive:!0,value:t,size:"small",onChange:(r,i)=>{typeof i=="string"&&e(i)},sx:{display:"flex",width:"100%"},children:n.map(r=>p.jsx(Un,{value:r.value,children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[r.icon,p.jsx("span",{children:r.label})]})},r.value))})}const yp="layout-custom",Vx=[{id:"layout-50-50",distribution:[50,50,null]},{id:"layout-55-45",distribution:[55,45,null]},{id:"layout-45-55",distribution:[45,55,null]},{id:"layout-60-40",distribution:[60,40,null]},{id:"layout-40-60",distribution:[40,60,null]},{id:"layout-70-30",distribution:[70,30,null]},{id:"layout-30-70",distribution:[30,70,null]},{id:"layout-75-25",distribution:[75,25,null]},{id:"layout-25-75",distribution:[25,75,null]},{id:"layout-80-20",distribution:[80,20,null]},{id:"layout-20-80",distribution:[20,80,null]}],qx=[{id:"layout-33-33-33",distribution:[33.34,33.33,33.33]},{id:"layout-30-40-30",distribution:[30,40,30]},{id:"layout-25-50-25",distribution:[25,50,25]},{id:"layout-20-60-20",distribution:[20,60,20]},{id:"layout-50-25-25",distribution:[50,25,25]},{id:"layout-25-25-50",distribution:[25,25,50]},{id:"layout-60-20-20",distribution:[60,20,20]},{id:"layout-20-20-60",distribution:[20,20,60]},{id:"layout-40-30-30",distribution:[40,30,30]},{id:"layout-40-20-40",distribution:[40,20,40]},{id:"layout-15-70-15",distribution:[15,70,15]}],_c={grid:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:"16px",width:"100%"},card:{cursor:"pointer",border:"1px solid #e5e7eb",borderRadius:"8px",backgroundColor:"primary"},cardContent:{padding:"8px"},layoutPreview:{display:"grid",gap:"4px",height:"30px",width:"100%",minHeight:"30px"}};function Z5(t){const e=t?.[0];return typeof e=="number"&&!Number.isNaN(e)?Math.min(99,Math.max(1,Math.round(e))):50}function Wx(t){let e=typeof t?.[0]=="number"?Math.round(t[0]):34,n=typeof t?.[1]=="number"?Math.round(t[1]):33;return e=Math.min(98,Math.max(1,e)),n=Math.min(98,Math.max(1,n)),e+n>=99&&(n=Math.max(1,99-e)),[e,n]}const Yx=({fractions:t,highlight:e})=>{const n=sn(),r=e?n.palette.secondary.main:"#e5e7eb";return p.jsx("div",{style:{..._c.layoutPreview,gridTemplateColumns:t.map(i=>`${i}fr`).join(" ")},children:t.map((i,a)=>p.jsx("div",{style:{minWidth:0,backgroundColor:r,borderRadius:"4px",transition:"background-color 0.2s ease"}},a))})},A$e=({defaultValue:t,fixedWidths:e,onChange:n,columns:r})=>{const{t:i}=Ie("inspector"),a=sn(),[o,s]=T.useState(null),[l,c]=T.useState(!1),[u,d]=T.useState(()=>Z5(e??void 0)),[f,m]=T.useState(()=>Wx(e??void 0)[0]),[h,g]=T.useState(()=>Wx(e??void 0)[1]),b=t??(r===2?"layout-50-50":"layout-33-33-33"),E=o??(b==="layout-33-34-33"?"layout-33-33-33":b),[v,x]=T.useState(r===2?Vx:qx),S=(I,P)=>{s(null),c(!1),n({layout:I,fixedWidths:P})},C=()=>{if(s(yp),c(!0),r===2)d(Z5(e??void 0));else{const[I,P]=Wx(e??void 0);m(I),g(P)}},k=()=>{if(r===2){const I=u;n({layout:yp,fixedWidths:[I,100-I,null]})}else{const I=f,P=h;n({layout:yp,fixedWidths:[I,P,100-I-P]})}s(null)};T.useEffect(()=>{x(r===2?Vx:qx)},[r]),T.useEffect(()=>{s(null),c(!1)},[r,t]),T.useEffect(()=>{const I=t;r===2?I!==yp&&(I==null||!Vx.some(P=>P.id===I))&&n({layout:"layout-50-50",fixedWidths:[50,50,null]}):I==="layout-33-34-33"?n({layout:"layout-33-33-33",fixedWidths:[33.34,33.33,33.33]}):I!==yp&&(I==null||!qx.some(P=>P.id===I))&&n({layout:"layout-33-33-33",fixedWidths:[33.34,33.33,33.33]})},[r,t,n]);const w=(I,P)=>{const L=P;m(L),g(B=>Math.max(1,Math.min(B,100-L-1)))},D=(I,P)=>{const L=P,B=100-f-1;g(Math.max(1,Math.min(L,B)))},A=100-u,M=100-f-h,R=E===yp;return p.jsxs(Qr,{children:[p.jsx(on,{label:i("inputs.layout.label")}),p.jsxs("div",{style:_c.grid,children:[v.map(I=>p.jsx("div",{onClick:()=>S(I.id,I.distribution),style:{..._c.card,border:E===I.id?`2px solid ${a.palette.secondary.main}`:_c.card.border},children:p.jsx("div",{style:_c.cardContent,children:p.jsx(Yx,{fractions:I.distribution.filter(P=>P!=null),highlight:E===I.id})})},I.id)),p.jsx("div",{onClick:C,style:{..._c.card,border:R?`2px solid ${a.palette.secondary.main}`:_c.card.border},role:"button",tabIndex:0,onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),C())},children:p.jsx("div",{style:_c.cardContent,children:p.jsx(H,{sx:{width:"100%",height:30,minHeight:30,border:"1px dashed",borderColor:"divider",borderRadius:1,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:R?"action.selected":"action.hover",color:"text.primary",transition:a.transitions.create(["background-color"],{duration:a.transitions.duration.shorter})},children:p.jsx(VW,{sx:{fontSize:18,color:"text.primary"}})})})})]}),p.jsx(ZE,{in:l,timeout:"auto",unmountOnExit:!0,children:p.jsxs(H,{sx:{mt:2,p:2,borderRadius:1,border:1,borderColor:"divider",bgcolor:"background.paper"},children:[r===2?p.jsxs(qe,{gap:2,sx:{mt:1},children:[p.jsxs(xe,{variant:"body2",color:"text.secondary",children:[u,"% | ",A,"%"]}),p.jsx(ng,{value:u,min:1,max:99,step:1,valueLabelDisplay:"auto","aria-label":i("inputs.layout.custom.split2"),onChange:(I,P)=>d(P)}),p.jsx(Yx,{fractions:[u,A],highlight:!0})]}):p.jsxs(qe,{gap:2,sx:{mt:1},children:[p.jsxs(xe,{variant:"body2",color:"text.secondary",children:[f,"% | ",h,"% | ",M,"%"]}),p.jsxs(H,{children:[p.jsx(xe,{variant:"caption",color:"text.secondary",component:"div",children:i("inputs.layout.custom.firstColumn")}),p.jsx(ng,{value:f,min:1,max:98,step:1,valueLabelDisplay:"auto",onChange:w})]}),p.jsxs(H,{children:[p.jsx(xe,{variant:"caption",color:"text.secondary",component:"div",children:i("inputs.layout.custom.secondColumn")}),p.jsx(ng,{value:h,min:1,max:100-f-1,step:1,valueLabelDisplay:"auto",onChange:D})]}),p.jsx(Yx,{fractions:[f,h,M],highlight:!0})]}),p.jsx(ht,{variant:"contained",size:"small",sx:{mt:2},onClick:k,children:p.jsx(xe,{variant:"button",component:"span",sx:{color:"#FFFFFF",fontWeight:"bold"},children:i("inputs.layout.custom.apply")})})]})})]})};function O$e({label:t,tooltipTitle:e,hideWarning:n}){return p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[p.jsx(on,{label:t}),!n&&p.jsx(Pt,{title:e,placement:"top",children:p.jsx(cn,{size:"small",color:"warning",disableRipple:!0,sx:{p:0,cursor:"help",lineHeight:0,"&:hover":{backgroundColor:"transparent"}},children:p.jsx(gX,{"aria-hidden":!0})})})]})}const yX=(t=>p.jsx(Rr,{...t,viewBox:"0 0 24 24",children:p.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[p.jsx("path",{d:"M10.5 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v5.5m-6.7 9.1l1-.4M15 3v7.5m.2 6.4l-.9-.3m2.3 5.1l.3-.9m-.1-5.5l-.4-1m2.7.9l.3-.9m.2 7.4l-.4-1m1.5-3.9l1-.4m0 3l-.9-.3M9 3v18"}),p.jsx("circle",{cx:"18",cy:"18",r:"3"})]})}));yX.muiName="ColumnsCountIcon";function R$e({data:t,setData:e}){const[,n]=T.useState(null),[r,i]=T.useState(t.props?.columnsCount??2),a=Rd(),o=or(),s=To(),{t:l}=Ie("inspector"),c=h=>{const g=X.getState().document,_=h.filter(b=>g[b]?.type==="Image");o==="desktop"&&_.forEach(b=>{const y=g[b];if(y?.type!=="Image")return;const E=y.data;T$e(b,v=>{lb(b,x=>x.type!=="Image"?x:{...x,data:v})},E)})},u=h=>{const g=Od.safeParse(h);g.success?(g.data.props.columns.map(_=>c(_.childrenIds)),e(g.data),r&&g.data.props?.columnsCount!==r&&i(g.data.props?.columnsCount??2),n(null)):(console.error("Error on columns: ",g.error),n(g.error))},d={layout:"layout-50-50",fixedWidths:[50,50,null],columnsCount:2},f={layout:"layout-33-34-33",fixedWidths:[33,34,33],columnsCount:3},m=h=>{const g=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:[...t.props.columns];return h==="2"?{...d,columns:g}:{...f,columns:g}};return p.jsxs(uu,{title:l("inputs.panels.columns.title"),children:[(a=="block-configuration"||s)&&p.jsxs(p.Fragment,{children:[p.jsx(Nt,{icon:yX,label:l("inputs.panels.columns.countLabel"),children:p.jsxs(Qr,{children:[p.jsx(on,{label:l("inputs.panels.columns.countLabel")}),p.jsx(H,{sx:{...YA,paddingLeft:0,paddingRight:0,height:"auto",minHeight:`${Pc}px`},children:p.jsx(J5,{value:t.props?.columnsCount===2?"2":"3",onChange:h=>{const g=m(h);u({...t,props:{...t.props,...g}})},options:[{value:"2",label:"2",icon:p.jsx(ADe,{fontSize:"small"})},{value:"3",label:"3",icon:p.jsx(jDe,{fontSize:"small"})}]})})]})}),p.jsx(Nt,{icon:IDe,label:l("inputs.panels.columns.layoutLabel","Layout"),children:p.jsx(A$e,{columns:t.props?.columnsCount??3,defaultValue:t.props?.layout,fixedWidths:t.props?.fixedWidths??void 0,onChange:({layout:h,fixedWidths:g})=>{const _=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:t.props.columns;u({...t,props:{...t.props,layout:h,fixedWidths:g,columns:_}})}})})]}),(a=="css"||s)&&p.jsxs(p.Fragment,{children:[p.jsx(cb,{}),p.jsx(Nt,{icon:x1,label:l("inputs.panels.columns.stackColumnsOnMobile"),children:p.jsxs(Qr,{children:[p.jsx(O$e,{label:l("inputs.panels.columns.stackColumnsOnMobile"),tooltipTitle:l("inputs.panels.columns.stackColumnsOnMobileWarning")}),p.jsx(H,{sx:{width:"100%",...YA,paddingLeft:0,paddingRight:0,height:"auto",minHeight:`${Pc}px`},children:p.jsx(J5,{value:t.props?.stackColumnsOnMobile?"stacked":"sideBySide",onChange:h=>{u({...t,props:{...t.props,stackColumnsOnMobile:h==="stacked"}})},options:[{value:"sideBySide",label:l("inputs.panels.columns.stackToggleSideBySide"),icon:p.jsx(nN,{fontSize:"small"})},{value:"stacked",label:l("inputs.panels.columns.stackToggleStacked"),icon:p.jsx(NDe,{fontSize:"small"})}]})})]})}),p.jsx(Nt,{icon:Pwe,label:l("inputs.alignment.label"),children:p.jsx(D$e,{data:t,updateData:e})}),p.jsx(na,{names:["backgroundColor","background","padding","mobilePadding"],value:t.style,onChange:h=>u({...t,style:h})})]})]})}function vX({data:t,setData:e}){const[,n]=T.useState(null),{t:r}=Ie("inspector"),i=a=>{const o=j_.safeParse(a);o.success?(e(o.data),n(null)):n(o.error)};return p.jsx(uu,{title:r("inputs.panels.container.title"),children:p.jsx(na,{names:["backgroundColor","background","border","borderMobile","shape","padding","mobilePadding"],value:t.style,shapeSteps:30,onChange:a=>i({...t,style:a})})})}function EX({data:t,setData:e}){const[,n]=T.useState(null),{t:r}=Ie("inspector"),i=a=>{const o=H_.safeParse(a);o.success?(e(o.data),n(null)):n(o.error)};return p.jsx(uu,{title:r("inputs.panels.divider.title"),children:p.jsx(na,{names:["width","widthMobile","height","heightMobile","color","backgroundColor","textAlign","textAlignMobile","padding","mobilePadding"],value:t.style,onChange:a=>i({...t,style:a})})})}const I$e=({label:t,linkColor:e,underline:n=!1,onChange:r})=>{const[i,a]=T.useState(e??"#FF0000"),[o,s]=T.useState(n),{t:l}=Ie("inspector"),c=t??l("inputs.links.color"),u=o?"enabled":"disabled",d={container:{width:"100%"}};T.useEffect(()=>{e!==i&&a(e??"#FF0000")},[e]),T.useEffect(()=>{n!==o&&s(n)},[n]);const f=h=>{const g=h??"#FF0000";a(g),r({linkColor:g,underline:o})},m=(h,g)=>{if(!g)return;const _=g==="enabled";s(_),r({linkColor:i,underline:_})};return p.jsxs(Qr,{children:[p.jsx(td,{label:c,defaultValue:i,onChange:f}),p.jsx(on,{label:l("inputs.links.underline")}),p.jsx(H,{sx:d.container,children:p.jsxs(Ad,{value:u,exclusive:!0,fullWidth:!0,onChange:m,sx:{width:"100%"},children:[p.jsx(Un,{value:"enabled",children:p.jsx(Pt,{title:l("inputs.links.underlineOn"),children:p.jsx(H,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:p.jsx(rY,{fontSize:"small"})})})}),p.jsx(Un,{value:"disabled",children:p.jsx(Pt,{title:l("inputs.links.underlineOff"),children:p.jsx(H,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:p.jsx(tY,{fontSize:"small"})})})})]})})]})};function SX({data:t,setData:e}){const[,n]=T.useState(null),{t:r}=Ie("inspector"),i=a=>{const o=gS.safeParse(a);o.success?(e(o.data),n(null)):n(o.error)};return p.jsxs(qe,{gap:1,children:[p.jsx(Nt,{icon:v_,label:r("inputs.panels.emailLayout.backgroundColor"),children:p.jsx(td,{label:r("inputs.panels.emailLayout.backgroundColor"),defaultValue:t.backdropColor??"#F5F5F5",onChange:a=>i({...t,backdropColor:a})})}),p.jsx(Nt,{icon:eDe,label:r("inputs.panels.emailLayout.canvasColor"),children:p.jsx(td,{label:r("inputs.panels.emailLayout.canvasColor"),defaultValue:t.canvasColor??"#FFFFFF",onChange:a=>i({...t,canvasColor:a})})}),p.jsx(Nt,{icon:c0,label:r("inputs.panels.emailLayout.fontFamily"),children:p.jsx(HN,{label:r("inputs.panels.emailLayout.fontFamily"),defaultValue:t.fontFamily||cW.FAMILY,onChange:a=>i({...t,fontFamily:a})})}),p.jsx(Nt,{icon:u0,label:r("inputs.panels.emailLayout.textColor"),children:p.jsx(td,{label:r("inputs.panels.emailLayout.textColor"),defaultValue:t.textColor??"#262626",onChange:a=>i({...t,textColor:a})})}),p.jsx(Nt,{icon:eN,label:r("inputs.panels.emailLayout.linksLabel"),children:p.jsx(I$e,{label:r("inputs.panels.emailLayout.linksLabel"),linkColor:t.linkGlobal?.linkColor||"#000000",underline:t.linkGlobal?.underline||!1,onChange:a=>i({...t,linkGlobal:a})})})]})}const N$e=(t,e,n)=>{const r=or();T.useEffect(()=>{const i=()=>{if(!t||!document||r=="mobile")return;const s=Xt(t),l=document.querySelector(`.${s}`);if(!l)return;const c=l.parentElement;if(!c)return;const u=Math.ceil(c.getBoundingClientRect().width);n.props?.size===void 0||n.props?.size==="original"||n.props?.touched&&n.props?.width<=u||n.props?.width!==u&&!n.props?.touched&&e({...n,props:{...n.props,width:u}})};i();const a=new ResizeObserver(i),o=document.querySelector(`.${Xt(t)}`);return o?.parentElement&&a.observe(o.parentElement),()=>{a.disconnect()}},[t,e,n,r])},P$e=({data:t,setData:e,blockId:n})=>{const{t:r}=Ie("inspector"),[i,a]=T.useState(!1),[o,s]=T.useState(()=>!!window.__emailBuilderEnableAI),[,l]=T.useState(null),[c,u]=T.useState(""),[d,f]=T.useState(!1),[m,h]=T.useState(""),[g,_]=T.useState(!1),b=T.useRef(null),[y,E]=T.useState(null),v=B1e(),x=U1e(),S=v||x,[C,k]=T.useState(()=>!!window.__emailBuilderUnsplashEnabled);T.useEffect(()=>{const G=()=>{k(!!window.__emailBuilderUnsplashEnabled)};return G(),window.addEventListener("email-builder-unsplash-updated",G),()=>window.removeEventListener("email-builder-unsplash-updated",G)},[]),T.useEffect(()=>{const G=window.__emailBuilderCustomImageProvider;G&&(E(G),setTimeout(()=>{n&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:n,currentImageUrl:t.props?.url||null,alt:t.props?.alt||null}}))},100))},[]);const w=G=>{const Y=Jf.safeParse(G);Y.success?(e(Y.data),l(null)):l(Y.error)},D=(G,Y)=>{const be=G.toLowerCase(),ee=be.includes(".svg")||be.includes("svg"),fe=Y&&(Y.includes("image/svg+xml")||Y.includes("svg"));return ee||!!fe},A=async G=>{try{f(!0),h(""),_(!1);try{new URL(G)}catch{return h(r("inputs.image.invalidUrl")),!1}const Y=new AbortController,be=setTimeout(()=>Y.abort(),1e4);try{const ee=await fetch(G,{method:"HEAD",signal:Y.signal});if(clearTimeout(be),!ee.ok)return h(r("inputs.image.httpError",{status:ee.status,statusText:ee.statusText})),!1;const fe=ee.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(Q=>fe&&fe.toLowerCase().includes(Q.toLowerCase()))?(D(G,fe)&&_(!0),h(""),!0):(h(r("inputs.image.notImage")),!1)}catch(ee){return clearTimeout(be),ee.name==="AbortError"?(h(r("inputs.image.timeout")),!1):new Promise(fe=>{const re=new Image,te=setTimeout(()=>{h(r("inputs.image.timeout")),fe(!1)},1e4);re.onload=()=>{clearTimeout(te),D(G)&&_(!0),h(""),fe(!0)},re.onerror=()=>{clearTimeout(te),h(r("inputs.image.loadError")),fe(!1)},re.src=G})}}catch{return h(r("inputs.image.unexpectedError")),!1}finally{f(!1)}},M=async()=>{c.trim()&&await A(c.trim())&&(w({...t,props:{...t.props,url:c.trim()}}),n&&jp(n),u(""))},R=G=>{G.key==="Enter"&&M()},I=G=>{u(G.target.value),m&&h(""),g&&_(!1)},P=G=>{const Y=["image/png","image/jpeg","image/gif"],ee=G.filter(re=>Y.includes(re.type)&&re.size<=5242880);if(ee.length!==G.length&&alert(r("inputs.common.invalidFiles")),ee.length===0)return;const fe=ee.map(re=>new Promise(te=>{const Q=new FileReader;Q.onload=V=>te(V.target?.result),Q.readAsDataURL(re)}));Promise.all(fe).then(re=>{const te={images:re,id:n||""};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:te})),Wp(!0,n||"")})},L=G=>{G.preventDefault(),a(!0)},B=G=>{const Y=G.currentTarget.getBoundingClientRect(),be=G.clientX,ee=G.clientY;(be<Y.left||be>=Y.right||ee<Y.top||ee>=Y.bottom)&&a(!1)},F=G=>{G.preventDefault(),a(!1);const Y=Array.from(G.dataTransfer.files);Y.length>0&&P(Y)},q=()=>{const G=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(G)};T.useEffect(()=>{const G=window.__emailBuilderEnableAI;G!==void 0&&s(!!G);const Y=be=>{const{detail:ee}=be;s(!!ee)};return window.addEventListener("email-builder-ai-generation",Y),()=>{window.removeEventListener("email-builder-ai-generation",Y)}},[]),T.useEffect(()=>{const G=fe=>{const{detail:re}=fe;Wp(!1,re.id||""),n&&(Bh(n,{url:re.url}),jp(n)),GG(!1)},Y=fe=>{Wp(fe?.detail?.uploading??!1,fe?.detail?.id??"")},be=()=>{b?.current?.click()},ee=fe=>{if(!n)return;const re=fe.detail;if(typeof re=="string"){Bh(n,{url:re}),jp(n);return}if(re&&typeof re=="object"&&typeof re.url=="string"){const te={url:re.url};typeof re.alt=="string"&&(te.alt=re.alt),Bh(n,te)}};return window.addEventListener("email-builder-set-image",ee),window.addEventListener("email-builder-upload-image-receive",G),window.addEventListener("email-builder-upload-file",be),window.addEventListener("email-builder-toggle-upload-file",Y),()=>{window.removeEventListener("email-builder-toggle-upload-file",Y),window.removeEventListener("email-builder-upload-image-receive",G),window.removeEventListener("email-builder-set-image",ee),window.removeEventListener("email-builder-upload-file",be)}},[n]),T.useEffect(()=>{t.props?.url&&_(D(t.props.url))},[t.props?.url]);const oe=()=>p.jsxs(qe,{gap:1,children:[p.jsx(Qr,{children:v&&p.jsxs(p.Fragment,{children:[p.jsx(on,{label:r("inputs.image.urlLabel")}),p.jsxs(qe,{direction:"row",gap:1,children:[p.jsx(Ir,{fullWidth:!0,placeholder:r("inputs.image.urlPlaceholder"),value:c,onChange:I,onKeyPress:R,error:!!m,disabled:d,sx:Ko}),p.jsx(ht,{variant:"contained",onClick:M,disabled:!c.trim()||d,sx:{minWidth:"auto",px:2},children:d?p.jsx(ti,{size:20,color:"inherit"}):r("inputs.common.add")})]}),m&&p.jsx($n,{severity:"error",sx:{mt:1,fontSize:"0.875rem"},children:m}),g&&p.jsx($n,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:p.jsx(cn,{"aria-label":r("inputs.common.close"),color:"inherit",size:"small",onClick:()=>_(!1),children:p.jsx(tb,{fontSize:"inherit"})}),children:r("inputs.common.svgWarning")})]})}),v&&x&&p.jsxs(qe,{direction:"row",alignItems:"center",gap:1,children:[p.jsx(Br,{sx:{flexGrow:1}}),p.jsx(xe,{variant:"caption",sx:{color:"text.secondary"},children:r("inputs.backgroundImage.or")}),p.jsx(Br,{sx:{flexGrow:1}})]}),x&&p.jsxs(H,{onDragOver:L,onDragLeave:B,onDrop:F,sx:{width:"100%",border:"2px dashed",borderColor:i?"primary.main":"divider",borderRadius:"8px",padding:3,textAlign:"center",bgcolor:i?"action.hover":"background.paper",transition:"all 0.2s ease"},children:[p.jsx(H,{sx:{display:"flex",justifyContent:"center",mb:1},children:p.jsx(cY,{sx:{fontSize:28,color:"primary.main"}})}),p.jsxs("label",{style:{cursor:"pointer"},children:[p.jsx("input",{ref:b,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:G=>{const Y=G.target.files;Y&&Y.length>0&&P(Array.from(Y))}}),p.jsx(xe,{component:"span",sx:{fontWeight:600,color:"primary.main"},children:r("inputs.common.uploadFile")}),p.jsxs(xe,{component:"span",sx:{fontWeight:500,color:"text.secondary"},children:[" ",r("inputs.common.dragAndDrop")]})]}),p.jsx(xe,{variant:"caption",sx:{color:"text.secondary",mt:1,display:"block"},children:r("inputs.common.fileInfo")})]}),!y&&P1e()&&p.jsxs(p.Fragment,{children:[p.jsxs(qe,{direction:"row",alignItems:"center",gap:1,children:[p.jsx(Br,{sx:{flexGrow:1}}),p.jsx(xe,{variant:"caption",sx:{color:"text.secondary"},children:r("inputs.backgroundImage.or")}),p.jsx(Br,{sx:{flexGrow:1}})]}),p.jsx(ht,{variant:"outlined",onClick:q,startIcon:p.jsx(bDe,{}),fullWidth:!0,children:r("inputs.backgroundImage.browseGallery")})]})]});return p.jsxs(qe,{gap:1,children:[p.jsx(hX,{imageUrl:t.props?.url??null,alt:t.props?.alt??"",blockId:n,onRemove:()=>{n&&(Bh(n,{url:null}),jp(n)),w({...t,props:{...t.props??{},url:null}})}}),p.jsx(uX,{tabs:[{key:"gallery",label:r("inputs.tabs.gallery"),visible:C,render:()=>p.jsx(fX,{blockId:n,source:"image"})},{key:"yourGallery",label:r("inputs.tabs.yourGallery"),visible:!!y,render:()=>p.jsx(H,{children:y})},{key:"upload",label:r("inputs.tabs.upload"),visible:S,render:oe},{key:"generate",label:r("inputs.tabs.generate"),visible:o,render:()=>p.jsx(H,{sx:{py:1},children:p.jsx(mX,{src:t.props?.url,style:{width:"100%",margin:0}})})}],defaultTab:"upload"})]})},M$e=({defaultValue:t="original",scale:e=100,onChange:n})=>{const[r,i]=T.useState(t),[a,o]=T.useState(e),s=sn(),{t:l}=Ie("inspector"),c={container:{width:"100%"},label:{color:s.palette.text.primary},sliderContainer:{marginTop:"16px",padding:"0 8px"},slider:{"& .MuiSlider-thumb":{backgroundColor:s.palette.primary.main,"&:hover":{boxShadow:`0 0 0 8px ${s.palette.primary.main}20`}},"& .MuiSlider-rail":{backgroundColor:s.palette.grey[300]},"& .MuiSlider-track":{backgroundColor:s.palette.primary.main}},scaleValue:{color:s.palette.text.secondary}};T.useEffect(()=>{(t!==r||e!==a)&&(t!==r&&i(t),t==="scale"&&o(e))},[t,e]);const u=(f,m)=>{m!==null&&(i(m),n&&n({mode:m,scale:m==="scale"?a:void 0}))},d=f=>{o(f),n&&n({mode:r,scale:f})};return p.jsxs(Qr,{children:[p.jsx(on,{label:l("inputs.sizeSelector.label")}),p.jsxs(H,{sx:c.container,children:[p.jsxs(Ad,{value:r,exclusive:!0,onChange:u,sx:{width:"100%"},children:[p.jsx(Un,{value:"original",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(ZI,{fontSize:"small"}),p.jsx("span",{children:l("inputs.sizeSelector.contain")})]})}),p.jsx(Un,{value:"fill",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(JI,{fontSize:"small"}),p.jsx("span",{children:l("inputs.sizeSelector.cover")})]})}),p.jsx(Un,{value:"scale",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(CDe,{fontSize:"small"}),p.jsx("span",{children:l("inputs.sizeSelector.scale")})]})})]}),p.jsx(ZE,{in:r==="scale",children:p.jsx(H,{sx:c.sliderContainer,children:p.jsx(Cr,{iconLabel:p.jsx(qDe,{}),value:a,setValue:d,marks:!1,units:"%",min:1,max:100})})})]})]})},e9={cover:p.jsx(JI,{fontSize:"small"}),contain:p.jsx(ZI,{fontSize:"small"}),fill:p.jsx(XI,{fontSize:"small"})},t9=t=>t==="cover"||t==="contain"||t==="fill"?e9[t]:e9.cover,n9=t=>t.length===0?t:t.charAt(0).toUpperCase()+t.slice(1);function L$e({data:t,setData:e}){const[n,r]=T.useState(null),i=q_(),a=Rd(),o=or(),s=To(),{t:l}=Ie("inspector");N$e(i||"",e,t),T.useEffect(()=>{i&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:i,currentImageUrl:t.props?.url||null,alt:t.props?.alt||null,source:"image"}}))},[i,t.props?.url,t.props?.alt]);const c=T.useCallback(v=>{const x=Jf.safeParse(v);x.success?JSON.stringify(t)!==JSON.stringify(x.data)&&(e(x.data),r(null)):r(x.error)},[t,e]),u=T.useCallback((v,x,S)=>{const C=k$e(i)||Hv,k={...v.props};if(S&&(k.touchedMobile=!0),x.mode==="original"){const w=v.props?.original_width??null;return S?{...k,sizeMobile:x.mode,widthMobile:w}:{...k,size:x.mode,width:w,sizeMobile:k.touchedMobile?k.sizeMobile:x.mode,widthMobile:k.touchedMobile?k.widthMobile:w}}if(x.mode==="fill")return S?{...k,sizeMobile:x.mode,widthMobile:null}:{...k,size:x.mode,width:null,sizeMobile:k.touchedMobile?k.sizeMobile:x.mode,widthMobile:k.touchedMobile?k.widthMobile:null};if(x.mode==="scale"){const w=Math.ceil(C/100*x.scale);return S?{...k,sizeMobile:x.mode,scaleMobile:x.scale,widthMobile:w}:{...k,size:x.mode,scale:x.scale,width:w,sizeMobile:k.touchedMobile?k.sizeMobile:x.mode,scaleMobile:k.touchedMobile?k.scaleMobile:x.scale,widthMobile:k.touchedMobile?k.widthMobile:w}}return k},[i]),d=T.useCallback((v,x)=>{const S=u(t,v,x);c({...t,props:S})},[t,c,u]),f=T.useMemo(()=>o!=="desktop"?{size:t.props?.touchedMobile?t.props?.sizeMobile:t.props?.size??"original",scale:t.props?.touchedMobile?t.props?.scaleMobile:t.props?.scale}:{size:t.props?.size??"original",scale:t.props?.scale},[o,t.props?.touchedMobile,t.props?.sizeMobile,t.props?.size,t.props?.scaleMobile,t.props?.scale]),m=T.useCallback(v=>{c({...t,props:{...t.props,alt:v}})},[t,c]),h=T.useCallback(v=>{const x=v.trim().length===0?null:v.trim();c({...t,props:{...t.props,linkHref:x}})},[t,c]),g=T.useCallback(v=>{c({...t,style:v})},[t,c]),_=T.useMemo(()=>o!=="desktop"?t.style?.heightMobile??t.style?.height??void 0:t.style?.height??void 0,[o,t.style?.height,t.style?.heightMobile]),b=T.useCallback(v=>{const x=o!=="desktop",S={...t.style??{}};x?S.heightMobile=v:S.height=v,c({...t,style:S})},[t,c,o]),y=T.useCallback(v=>{const x=o!=="desktop",S={...t.style??{}};x?S.objectFitMobile=v:S.objectFit=v,c({...t,style:S})},[t,c,o]),E=T.useCallback(v=>{const x=o!=="desktop",S={...t.style??{}};x?S.objectPositionMobile=v:S.objectPosition=v,c({...t,style:S})},[t,c,o]);return p.jsxs(uu,{title:l("inputs.panels.image.title"),children:[(a==="block-configuration"||s)&&p.jsxs(p.Fragment,{children:[p.jsx(Nt,{icon:fY,label:l("inputs.panels.image.title"),children:p.jsx(P$e,{data:t,setData:e,blockId:i})}),p.jsx(Nt,{icon:sDe,label:l("inputs.panels.image.altLabel"),children:p.jsx(yE,{label:l("inputs.panels.image.altLabel"),placeholder:l("inputs.panels.image.altPlaceholder"),defaultValue:t.props?.alt??"",onChange:m})}),p.jsx(Nt,{icon:eN,label:l("inputs.panels.image.urlLabel"),children:p.jsx(yE,{label:l("inputs.panels.image.urlLabel"),placeholder:l("inputs.panels.image.urlPlaceholder"),defaultValue:t.props?.linkHref??"",onChange:h})}),p.jsx(Nt,{icon:XI,label:l("inputs.panels.image.sizeLabel","Size"),children:p.jsx(M$e,{defaultValue:f.size,scale:f.scale??void 0,onChange:v=>d(v,o!=="desktop")})}),p.jsx(Nt,{icon:d_,label:l("inputs.panels.image.heightLabel"),children:p.jsxs(p.Fragment,{children:[p.jsx(lO,{label:l("inputs.panels.image.heightLabel"),defaultValue:_??void 0,min:0,max:800,step:4,onChange:v=>b(v>0?v:null)}),_?p.jsxs(qe,{direction:"row",gap:2,sx:{mt:1},children:[p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsx(on,{label:l("inputs.panels.image.objectFitLabel")}),p.jsx(ha,{style:{width:"100%"},size:"small",value:o==="desktop"?t.style?.objectFit??"cover":t.style?.objectFitMobile??t.style?.objectFit??"cover",onChange:v=>y(v.target.value),renderValue:v=>{const x=String(v??"cover");return p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[t9(x),l(`inputs.panels.image.objectFit${n9(x)}`)]})},children:["cover","contain","fill"].map(v=>p.jsx(Yr,{value:v,sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important"},children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:1},children:[t9(v),l(`inputs.panels.image.objectFit${n9(v)}`)]})},v))})]}),(()=>{const v=o==="desktop"?t.style?.objectFit??"cover":t.style?.objectFitMobile??t.style?.objectFit??"cover",x=o==="desktop"?t.style?.objectPosition??"center":t.style?.objectPositionMobile??t.style?.objectPosition??"center";return v==="fill"?null:p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsx(on,{label:l("inputs.panels.image.objectPositionLabel")}),p.jsx(ha,{style:{width:"100%"},size:"small",value:x,onChange:S=>E(String(S.target.value)),renderValue:S=>{const C=String(S??"center");return p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[hE(C),l(`inputs.backgroundImage.positions.${gE(C)}`)]})},children:i$e.map(S=>p.jsx(Yr,{value:S,sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important"},children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:1},children:[hE(S),l(`inputs.backgroundImage.positions.${gE(S)}`)]})},S))})]})})()]}):null]})})]}),p.jsx(cb,{}),p.jsx(na,{names:["textAlign","textAlignMobile","backgroundColor","shape","padding","mobilePadding"],value:t.style,shapeMaxValue:300,shapeSteps:20,onChange:g})]})}function F$e({data:t,setData:e}){const n=Rd(),r=To(),{t:i}=Ie("inspector"),a=t.style||{},o=s=>{const l={...a||{},...s||{}};e({...t,style:l})};return p.jsxs(uu,{title:i("inputs.panels.notionText.title","Text"),children:[(n==="block-configuration"||r)&&p.jsxs(p.Fragment,{children:[r?p.jsxs(p.Fragment,{children:[p.jsx(na,{disabledCSSValidation:!0,names:["fontFamily"],value:a,onChange:o}),p.jsx(na,{disabledCSSValidation:!0,names:["lineHeight"],value:a,onChange:o})]}):p.jsxs("div",{style:{display:"flex",gap:"8px"},children:[p.jsx("div",{style:{flex:1},children:p.jsx(na,{disabledCSSValidation:!0,names:["fontFamily"],value:a,onChange:o})}),p.jsx("div",{style:{flex:1},children:p.jsx(na,{disabledCSSValidation:!0,names:["lineHeight"],value:a,onChange:o})})]}),p.jsx(na,{disabledCSSValidation:!0,names:["fontSize","fontSizeMobile"],value:a,onChange:o})]}),(n==="css"||r)&&p.jsxs(p.Fragment,{children:[p.jsx(cb,{}),p.jsx(na,{names:["backgroundColor","border","borderMobile","padding","mobilePadding"],value:a,onChange:o})]})]})}const B$e="https://maildrill-dev.s3.us-east-2.amazonaws.com/icons/",$$e={positive:!0,original:!0,negative:!0},U$e={small:!0,medium:!0,large:!0,xlarge:!0},ae={theme:"positive",size:"medium"},On=(t,e,n="medium")=>{const r=GN.find(a=>a.key===n)?.value,i=CX.find(a=>a.key===e)?.value;return`${B$e}${t}_${i}_${r}.png`},Bn=t=>GN.find(e=>e.key===t)?.value||"36px",GN=[{value:"24px",key:"small",label:"Small"},{value:"36px",key:"medium",label:"Medium"},{value:"48px",key:"large",label:"Large"}],CX=[{value:"Positive",key:"positive",label:"Light"},{value:"Original",key:"original",label:"Color"},{value:"Negative",key:"negative",label:"Dark"}],hv=[{key:"facebook",label:"Facebook",iconName:"Facebook",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Facebook",ae.theme,ae.size),href:"https://www.facebook.com/your-profile"},{key:"web",label:"Web",iconName:"Web",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Web",ae.theme,ae.size),href:"https://www.google.com"},{key:"mail",label:"Mail",iconName:"Mail",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Mail",ae.theme,ae.size),href:"https://mail.google.com/"},{key:"apple",label:"Apple",iconName:"Apple",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Apple",ae.theme,ae.size),href:"https://www.apple.com/"},{key:"bluesky",label:"Bluesky",iconName:"Bluesky",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Bluesky",ae.theme,ae.size),href:"https://bsky.app/"},{key:"clubhouse",label:"ClubHouse",iconName:"Clubhouse",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Clubhouse",ae.theme,ae.size),href:"https://www.clubhouse.com/"},{key:"dribbble",label:"Dribbble",iconName:"Dribbble",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Dribbble",ae.theme,ae.size),href:"https://dribbble.com/"},{key:"figma",label:"Figma",iconName:"Figma",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Figma",ae.theme,ae.size),href:"https://www.figma.com/"},{key:"github",label:"Github",iconName:"Github",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Github",ae.theme,ae.size),href:"https://github.com/"},{key:"google",label:"Google",iconName:"Google",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Google",ae.theme,ae.size),href:"https://google.com/"},{key:"instagram",label:"Instagram",iconName:"Instagram",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Instagram",ae.theme,ae.size),href:"https://www.instagram.com/your-profile"},{key:"linkedin",label:"LinkedIn",iconName:"LinkedIn",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("LinkedIn",ae.theme,ae.size),href:"https://www.linkedin.com/in/your-profile"},{key:"medium-social",label:"Medium",iconName:"Medium",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Medium",ae.theme,ae.size),href:"https://medium.com/"},{key:"messenger",label:"Messenger",iconName:"Messenger",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Messenger",ae.theme,ae.size),href:"https://www.messenger.com/"},{key:"pinterest",label:"Pinterest",iconName:"Pinterest",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Pinterest",ae.theme,ae.size),href:"https://www.pinterest.com/"},{key:"reddit",label:"Reddit",iconName:"Reddit",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Reddit",ae.theme,ae.size),href:"https://www.reddit.com/"},{key:"signal",label:"Signal",iconName:"Signal",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Signal",ae.theme,ae.size),href:"https://signal.org/"},{key:"snapchat",label:"Snapchat",iconName:"Snapchat",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Snapchat",ae.theme,ae.size),href:"https://www.snapchat.com/"},{key:"spotify",label:"Spotify",iconName:"Spotify",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Spotify",ae.theme,ae.size),href:"https://www.spotify.com/"},{key:"telegram",label:"Telegram",iconName:"Telegram",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Telegram",ae.theme,ae.size),href:"https://t.me/your-profile"},{key:"threads",label:"Threads",iconName:"Threads",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Threads",ae.theme,ae.size),href:"https://www.threads.net/"},{key:"tiktok",label:"TikTok",iconName:"TikTok",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("TikTok",ae.theme,ae.size),href:"https://www.tiktok.com/@your-profile"},{key:"tumblr",label:"Tumblr",iconName:"Tumblr",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Tumblr",ae.theme,ae.size),href:"https://www.tumblr.com/"},{key:"twitch",label:"Twitch",iconName:"Twitch",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Twitch",ae.theme,ae.size),href:"https://www.twitch.tv/"},{key:"vk",label:"VK",iconName:"VK",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("VK",ae.theme,ae.size),href:"https://vk.com/"},{key:"whatsapp",label:"WhatsApp",iconName:"WhatsApp",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("WhatsApp",ae.theme,ae.size),href:"https://www.whatsapp.com/"},{key:"x",label:"X",iconName:"X",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("X",ae.theme,ae.size),href:"https://x.com/your-profile"},{key:"youtube",label:"YouTube",iconName:"YouTube",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("YouTube",ae.theme,ae.size),href:"https://www.youtube.com/channel/your-channel-id"}],z$e=({element:t,index:e,moveItem:n,onSelectChange:r,onUrlChange:i,onRemove:a,onDuplicate:o,canRemove:s,theme:l})=>{const c=T.useRef(null),[u,d]=T.useState(null),{t:f}=Ie("inspector"),m=w=>{const D=w.getClientOffset(),A=c.current?.getBoundingClientRect();if(!D||!A)return null;const M=(A.bottom-A.top)/2;return D.y-A.top<M?"up":"down"},[{handlerId:h,isOver:g},_]=FE(()=>({accept:"social-media-item",collect(w){return{handlerId:w.getHandlerId(),isOver:w.isOver({shallow:!0})}},hover(w,D){if(!c.current)return;if(w.index===e){d(null);return}if(!D.isOver({shallow:!0})){d(null);return}const R=m(D);d(R)},drop(w,D){if(d(null),!c.current)return;const A=w.index,M=e;if(A===M)return;const R=m(D);let I=M;R==="down"&&(I=M+1),A<I&&(I=I-1),setTimeout(()=>{n(A,I)},0),w.index=I},end:()=>{d(null)}}),[t.id,e,n]),[{isDragging:b},y]=LE(()=>({type:"social-media-item",item:()=>({id:t.id,index:e}),collect:w=>({isDragging:w.isDragging()}),end:()=>{d(null)}}),[t.id,e]);T.useEffect(()=>{g||d(null)},[g]);const E=b?.4:1;T.useEffect(()=>{if(c.current&&y&&_){const w=c.current;y(w),_(w)}},[y,_]);const v=()=>{setTimeout(()=>a(e),0)},x=()=>{setTimeout(()=>o(e),0)},S=w=>{const D=w.target.value;setTimeout(()=>r(e,D,t),0)},C=w=>{const D=w.target.value;setTimeout(()=>i(e,D,t),0)},k=()=>p.jsxs("div",{style:{height:"3px",background:l.palette.secondary.main,position:"relative",color:l.palette.secondary.main,margin:"4px 0"},children:[p.jsx("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:p.jsx("path",{fill:"currentColor",d:"M28 12H10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2M10 4v6h18V4zm18 26H10a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2m-18-8v6h18v-6zm-1-6l-5.586-5.586L2 11.828L6.172 16L2 20.172l1.414 1.414z"})}),p.jsx("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:p.jsx("path",{fill:"currentColor",d:"M28 12H10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2M10 4v6h18V4zm18 26H10a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2m-18-8v6h18v-6zm-1-6l-5.586-5.586L2 11.828L6.172 16L2 20.172l1.414 1.414z"})})]});return p.jsxs(p.Fragment,{children:[u==="up"&&p.jsx(k,{}),p.jsxs(qe,{ref:c,"data-handler-id":h,sx:{border:1,borderColor:"divider",padding:1,paddingTop:0,borderRadius:1,backgroundColor:"background.paper",marginBottom:1.5,opacity:E,cursor:b?"grabbing":"grab",boxShadow:b?l.shadows[3]:"none"},gap:1,children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:`1px solid ${l.palette.divider}`},children:[p.jsx("div",{style:{display:"flex",alignItems:"center"},children:p.jsx(GW,{sx:{color:b?"primary.main":"text.secondary",cursor:"grab",marginLeft:-.9,"&:hover":{color:"primary.main"}}})}),p.jsxs("div",{children:[p.jsx(Pt,{title:"Duplicate",placement:"left",children:p.jsx(cn,{color:"primary",size:"small",onClick:x,children:p.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:p.jsx("path",{d:"M18 2.5H9C7.9 2.5 7 3.4 7 4.5V16.5C7 17.6 7.9 18.5 9 18.5H18C19.1 18.5 20 17.6 20 16.5V4.5C20 3.4 19.1 2.5 18 2.5ZM18 16.5H9V4.5H18V16.5ZM3 15.5V13.5H5V15.5H3ZM3 10H5V12H3V10ZM10 20.5H12V22.5H10V20.5ZM3 19V17H5V19H3ZM5 22.5C3.9 22.5 3 21.6 3 20.5H5V22.5ZM8.5 22.5H6.5V20.5H8.5V22.5ZM13.5 22.5V20.5H15.5C15.5 21.6 14.6 22.5 13.5 22.5ZM5 6.5V8.5H3C3 7.4 3.9 6.5 5 6.5Z",fill:"currentColor"})})})}),s&&p.jsx(Pt,{title:"Remove",placement:"left",children:p.jsx(cn,{color:"error",size:"small",onClick:v,children:p.jsx(aDe,{sx:{fontSize:20}})})})]})]}),p.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"0.5rem"},children:[p.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[p.jsx(on,{label:f("inputs.social.icon")}),p.jsx(ha,{fullWidth:!0,labelId:"demo-simple-select-label",id:"demo-simple-select",value:t.key,size:"small",onChange:S,children:hv.map(w=>p.jsx(Yr,{value:w.key,children:w.label},`${t.id}_${w.key}`))})]}),p.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[p.jsx(on,{label:f("inputs.social.url")}),p.jsx(Ir,{size:"small",fullWidth:!0,value:t.href??"",onChange:C,variant:"outlined",placeholder:"https://your-website.com",sx:Ko})]})]})]}),u==="down"&&p.jsx(k,{})]})};function j$e({items:t=[],onChange:e}){const{t:n}=Ie("inspector"),r=sn(),[i,a]=T.useState(()=>t.map(_=>({..._,id:_.id||$h()}))),[o,s]=T.useState(t[0]?.theme||"positive"),[l,c]=T.useState(t[0]?.size||"medium");T.useEffect(()=>{t.length>0&&(s(t[0].theme),c(t[0].size),a(t.map(_=>({..._,id:_.id||$h()}))))},[t]);const u=(_,b)=>{a(y=>{const E=[...y],[v]=E.splice(_,1);return E.splice(b,0,v),e&&setTimeout(()=>e(E),0),E})},d=()=>{a(_=>{const b={...hv[0],theme:o,size:l,sizePx:Bn(l),url:On(hv[0].iconName,o,l),id:$h()},y=[..._,b];return e&&setTimeout(()=>e(y),0),y})},f=_=>{a(b=>{const y=b.filter((E,v)=>v!==_);return e&&setTimeout(()=>e(y),0),y})},m=(_,b,y)=>{let E=[...i];if(b in $$e?(s(b),E=E.map(v=>{const x=On(v.iconName,b,v.size);return{...v,theme:b,url:x}})):b in U$e&&(c(b),E=E.map(v=>{const x=On(v.iconName,v.theme,b),S=Bn(b);return{...v,size:b,sizePx:S,url:x}})),_!==null&&y){const v=hv.find(x=>x.key===b);v&&(E=E.map((x,S)=>{const C={key:v.key,label:v.label,iconName:v.iconName,href:v.href},k=On(C.iconName,y.theme,y.size);return S===_?{...x,...C,url:k,id:y.id}:x}))}a(E),e&&setTimeout(()=>e(E),0)},h=(_,b,y)=>{const E=i.map((v,x)=>x===_?{...y,href:b}:v);a(E),e&&setTimeout(()=>e(E),0)},g=_=>{a(b=>{const y={...JSON.parse(JSON.stringify(b[_])),id:$h()},E=[...b.slice(0,_+1),y,...b.slice(_+1)];return e&&setTimeout(()=>e(E),0),E})};return p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{marginBottom:"1rem",display:"grid",gridTemplateColumns:"repeat(2,1fr)",gap:"1rem"},children:[p.jsxs(Qr,{children:[p.jsx(on,{label:n("inputs.social.theme")}),p.jsx(ha,{fullWidth:!0,labelId:"theme-selector",id:"theme-selector",value:o,size:"small",onChange:_=>m(null,_.target.value,null),children:CX.map(_=>p.jsx(Yr,{value:_.key,children:_.label},`${_.key}`))})]}),p.jsxs(Qr,{children:[p.jsx(on,{label:n("inputs.social.size")}),p.jsx(ha,{fullWidth:!0,labelId:"size-selector",id:"size-selector",value:l,size:"small",onChange:_=>m(null,_.target.value,null),children:GN.map(_=>p.jsx(Yr,{value:_.key,children:_.label},`${_.key}`))})]})]}),i?.map((_,b)=>p.jsx(z$e,{element:_,index:b,moveItem:u,onSelectChange:m,onUrlChange:h,onRemove:f,onDuplicate:g,canRemove:i.length>1,theme:r},_.id)),p.jsx(ht,{onClick:d,sx:{borderRadius:1},variant:"contained",endIcon:p.jsx(UW,{}),children:"Add"})]})}const H$e=({data:t,setData:e})=>{const[,n]=T.useState(null),r=or(),{t:i}=Ie("inspector"),a=d=>{const f=_N.safeParse(d);f.success?(e(f.data),n(null)):n(f.error)},o=d=>{a({...t,items:d})},s=d=>{a({...t,style:d})},l=(d,f=!1)=>{if(f){a({...t,gapMobile:d});return}a({...t,gap:d})},c=Rd(),u=To();return p.jsxs(uu,{title:i("inputs.panels.social.title"),children:[(c=="block-configuration"||u)&&p.jsx(Nt,{icon:wDe,label:i("inputs.panels.social.title"),children:p.jsx(H,{sx:{minWidth:120,margin:1},children:p.jsx(j$e,{items:t?.items??[],onChange:o})})}),(c=="css"||u)&&p.jsxs(p.Fragment,{children:[p.jsx(cb,{}),p.jsx(Nt,{icon:YC,label:i("inputs.panels.social.gap"),children:p.jsxs(Qr,{children:[p.jsx(on,{label:i("inputs.panels.social.gap")}),r=="desktop"?p.jsx(Cr,{iconLabel:p.jsx(YC,{sx:{color:"text.primary"}}),value:Number(t?.gap??4),setValue:d=>l(d,!1),marks:!0,step:4,units:"px",min:0,max:40}):p.jsx(Cr,{iconLabel:p.jsx(YC,{sx:{color:"text.primary"}}),value:Number(t?.gapMobile??t?.gap??4),setValue:d=>l(d,!0),marks:!0,step:4,units:"px",min:0,max:40})]})}),p.jsx(na,{names:["textAlign","textAlignMobile","backgroundColor","padding","mobilePadding"],value:t.style,onChange:d=>s(d)})]})]})};function xX({data:t,setData:e}){const[,n]=T.useState(null),{t:r}=Ie("inspector"),i=a=>{const o=G_.safeParse(a);o.success?(e(o.data),n(null)):n(o.error)};return p.jsx(uu,{title:r("inputs.panels.spacer.title"),children:p.jsx(na,{names:["height","heightMobile","backgroundColor"],value:t.style,onChange:a=>i({...t,style:a})})})}function r9(t){return p.jsx(H,{sx:{m:3,p:1,border:"1px dashed",borderColor:"divider"},children:p.jsx(xe,{color:"text.secondary",children:t})})}function G$e(){const t=q_(),e=MG(t||""),n=T.useCallback(a=>{t&&lb(t,()=>a)},[t]);if(!t)return r9("Click on a block to inspect.");if(!e)return r9(`Block with id ${t} was not found. Click on a block to reset.`);const{data:r,type:i}=e;switch(i){case"Button":return p.jsx(x$e,{data:r,setData:a=>n({type:i,data:a})},t);case"ColumnsContainer":return p.jsx(R$e,{data:r,setData:a=>n({type:i,data:a})},t);case"Container":return p.jsx(vX,{data:r,setData:a=>n({type:i,data:a})},t);case"Divider":return p.jsx(EX,{data:r,setData:a=>n({type:i,data:a})},t);case"Image":return p.jsx(L$e,{data:r,setData:a=>n({type:i,data:a})},t);case"EmailLayout":return p.jsx(SX,{data:r,setData:a=>n({type:i,data:a})},t);case"Spacer":return p.jsx(xX,{data:r,setData:a=>n({type:i,data:a})},t);case"NotionText":return p.jsx(F$e,{data:r,setData:a=>n({type:i,data:a})},t);case"SocialMedia":return p.jsx(H$e,{data:r,setData:a=>n({type:i,data:a})},t);default:return p.jsx("pre",{children:JSON.stringify(e,null," ")})}}const V$e=T.memo(G$e),q$e="email-builder-standalone",W$e="4.1.6",Kx={name:q$e,version:W$e};function Y$e({onReset:t,visible:e}){const{t:n}=Ie("inspector");return e?p.jsx(Pt,{title:n("theme.reset"),placement:"left",children:p.jsx(cn,{size:"small",onClick:t,sx:{color:"primary.main",flexShrink:0,width:32,height:32,"&:hover":{backgroundColor:"action.hover"}},children:p.jsx(TDe,{fontSize:"small"})})}):p.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:32,height:32,flexShrink:0}})}const K$e={top:0,right:0,bottom:0,left:0},Q$e={color:v_,padding:bE,fontSize:C1,fontFamily:c0,fontWeight:eY,textAlign:S1,number:C1,border:E2};function X$e({blockType:t,field:e}){const{t:n}=Ie("inspector"),{value:r,isOverridden:i,set:a,reset:o}=Dp(t,e.section,e.key),[s,l]=T.useState(!0),c=y_[t]?.[e.section]?.[e.key],u=n(e.labelKey),d=p.jsx(Y$e,{onReset:o,visible:i}),f=e.icon??Q$e[e.kind];switch(e.kind){case"color":return p.jsx(Nt,{icon:f,label:u,children:p.jsx(mv,{label:u,labelAction:d,defaultValue:r??c??null,onChange:m=>m===null?o():a(m)})});case"padding":return p.jsx(Nt,{icon:f,label:u,children:p.jsx(cO,{label:u,labelAction:d,defaultValue:r??c??K$e,inheritedFrom:i?void 0:"default",onChange:m=>a(m),sidesLinked:s,onSidesLinkedChange:l})});case"fontSize":return p.jsx(Nt,{icon:f,label:u,children:p.jsx(_E,{label:u,labelAction:d,defaultValue:r??c??16,onChange:m=>a(m)})});case"fontFamily":return p.jsx(Nt,{icon:f,label:u,children:p.jsx(HN,{label:u,labelAction:d,defaultValue:r??c??null,onChange:m=>m===null?o():a(m)})});case"fontWeight":return p.jsx(Nt,{icon:f,label:u,children:p.jsx(_X,{label:u,labelAction:d,defaultValue:r??c??"normal",onChange:m=>a(m)})});case"textAlign":return p.jsx(Nt,{icon:f,label:u,children:p.jsx(uO,{label:u,labelAction:d,defaultValue:r??c??null,onChange:m=>m===null?o():a(m)})});case"number":return p.jsx(Nt,{icon:f,label:u,children:p.jsx(_E,{label:u,labelAction:d,defaultValue:r??c??0,onChange:m=>a(m)})});case"border":return p.jsx(Nt,{icon:f,label:u,children:p.jsx(J$e,{blockType:t,field:e})});default:return e.kind,null}}function J$e({blockType:t,field:e}){const{t:n}=Ie("inspector"),r=Dp(t,e.section,"borderColor"),i=Dp(t,e.section,"borderTop"),a=Dp(t,e.section,"borderBottom"),o=Dp(t,e.section,"borderLeft"),s=Dp(t,e.section,"borderRight"),[l,c]=T.useState(!0),u=y_[t]?.[e.section],d=f=>{f.borderColor!==void 0&&r.set(f.borderColor),f.borderTop!==void 0&&i.set(f.borderTop),f.borderBottom!==void 0&&a.set(f.borderBottom),f.borderLeft!==void 0&&o.set(f.borderLeft),f.borderRight!==void 0&&s.set(f.borderRight)};return p.jsx(sO,{label:n(e.labelKey),borderColor:r.value??u?.borderColor??null,borderTop:i.value??u?.borderTop??0,borderBottom:a.value??u?.borderBottom??0,borderLeft:o.value??u?.borderLeft??0,borderRight:s.value??u?.borderRight??0,onChange:d,sidesLinked:l,onSidesLinkedChange:c})}function Z$e({blockType:t,spec:e,defaultExpanded:n=!1}){const{t:r}=Ie("inspector"),i=C1e(t),a=To(),o=eUe(i),s=e.icon;return p.jsxs(eS,{defaultExpanded:n,disableGutters:!0,square:!0,sx:{boxShadow:"none",borderTop:l=>`1px solid ${l.palette.divider}`,"&:before":{display:"none"}},children:[p.jsx(rS,{expandIcon:a?void 0:p.jsx(WW,{}),sx:{px:0,minHeight:a?40:48,justifyContent:a?"center":void 0,"& .MuiAccordionSummary-content":{my:a?.5:1,justifyContent:a?"center":void 0}},children:a?p.jsx(Pt,{title:r(e.titleKey),placement:"left",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",p:.5,borderRadius:2,color:"primary.main"},children:[p.jsx(s,{fontSize:"small"}),o>0&&p.jsx(H,{component:"span",sx:{fontSize:10,ml:.5,px:.5,borderRadius:1,bgcolor:"primary.main",color:"primary.contrastText",fontWeight:600},children:o})]})}):p.jsxs(qe,{direction:"row",alignItems:"center",gap:1,sx:{width:"100%"},children:[p.jsx(xe,{sx:{fontWeight:600,color:"text.primary"},children:r(e.titleKey)}),o>0&&p.jsx(H,{component:"span",sx:{fontSize:11,lineHeight:1,px:.75,py:.25,borderRadius:1,bgcolor:"primary.main",color:"primary.contrastText",fontWeight:600},"aria-label":r("theme.overrideCount",{count:o}),children:o})]})}),p.jsx(tS,{sx:{p:0,pb:2},children:p.jsx(qe,{gap:2,children:e.fields.map(l=>p.jsx(X$e,{blockType:t,field:l},`${l.section}.${l.key}`))})})]})}function eUe(t){if(!t)return 0;const e=t.style?Object.keys(t.style).length:0,n=t.props?Object.keys(t.props).length:0;return e+n}function tUe({defaultExpanded:t=!0}){const{t:e}=Ie("inspector"),n=pX("root"),r=To();if(!n||n.type!=="EmailLayout")return null;const{data:i}=n;return p.jsxs(eS,{defaultExpanded:t,disableGutters:!0,square:!0,sx:{boxShadow:"none",borderTop:a=>`1px solid ${a.palette.divider}`,"&:before":{display:"none"}},children:[p.jsx(rS,{expandIcon:r?void 0:p.jsx(WW,{}),sx:{px:0,minHeight:r?40:48,justifyContent:r?"center":void 0,"& .MuiAccordionSummary-content":{my:r?.5:1,justifyContent:r?"center":void 0}},children:r?p.jsx(Pt,{title:e("theme.blocks.root.title"),placement:"left",children:p.jsx(H,{sx:{display:"flex",p:.5,borderRadius:2,color:"primary.main"},children:p.jsx(BDe,{fontSize:"small"})})}):p.jsx(xe,{sx:{fontWeight:600,color:"text.primary"},children:e("theme.blocks.root.title")})}),p.jsx(tS,{sx:{px:0,pt:0,pb:2},children:p.jsx(qe,{gap:2,children:p.jsx(SX,{data:i,setData:a=>{ZR(),lb("root",()=>({type:"EmailLayout",data:a}))}})})})]})}const Qx=100,Xx=280;function nUe({open:t,onClose:e,onSaved:n}){const{t:r}=Ie("inspector"),[i,a]=T.useState(""),[o,s]=T.useState(""),[l,c]=T.useState(!1),[u,d]=T.useState(null),f=i.trim(),m=f.length>0&&f.length<=Qx&&o.length<=Xx,h=T.useCallback(()=>{l||(a(""),s(""),d(null),e())},[l,e]),g=T.useCallback(async()=>{if(!(!m||l)){c(!0),d(null);try{const _=w1e(),b=await iX({name:f,description:o.trim()||void 0,bundle:_});n?.(b.id),a(""),s(""),e()}catch(_){d(_ instanceof Error?_.message:String(_))}finally{c(!1)}}},[m,l,f,o,e,n]);return p.jsxs(Is,{open:t,onClose:h,maxWidth:"sm",fullWidth:!0,children:[p.jsx(Ms,{children:r("theme.save.title","Save current theme")}),p.jsx(Ps,{children:p.jsxs(qe,{gap:2,sx:{mt:1},children:[p.jsx(xe,{variant:"body2",color:"text.secondary",children:r("theme.save.description","Snapshots the current root globals and per-block-type theme overrides. Saved themes can be reapplied later from the Components Library.")}),p.jsx(Ir,{label:r("theme.save.nameLabel","Name"),value:i,onChange:_=>a(_.target.value),placeholder:r("theme.save.namePlaceholder","e.g. Brand default"),autoFocus:!0,fullWidth:!0,disabled:l,inputProps:{maxLength:Qx},helperText:`${f.length}/${Qx}`}),p.jsx(Ir,{label:r("theme.save.descriptionLabel","Description (optional)"),value:o,onChange:_=>s(_.target.value),fullWidth:!0,multiline:!0,minRows:2,disabled:l,inputProps:{maxLength:Xx},helperText:`${o.length}/${Xx}`}),u&&p.jsx($n,{severity:"error",children:u})]})}),p.jsxs(Ns,{children:[p.jsx(ht,{onClick:h,disabled:l,children:r("theme.save.cancel","Cancel")}),p.jsx(ht,{onClick:g,variant:"contained",disabled:!m||l,children:l?r("theme.save.submitting","Saving…"):r("theme.save.submit","Save")})]})]})}function rUe(){const{t}=Ie("inspector"),e=X1e(),n=vS(),r=PG(),i=To(),[a,o]=T.useState(!1),[s,l]=T.useState(!1);return p.jsxs(ff,{sx:{padding:"0!important",paddingTop:"1rem!important"},children:[!i&&p.jsxs(qe,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{mb:2,flexWrap:"wrap",gap:1},children:[p.jsx(xe,{sx:{fontWeight:"bold",color:"text.primary",fontSize:"1.25rem"},children:t("styles.rootTitle")}),n&&p.jsxs(qe,{direction:"row",gap:.5,sx:{width:"100%",ml:"0!important"},children:[p.jsx(Pt,{title:t("theme.exportTooltip","Save current theme to the gallery"),children:p.jsx(ht,{size:"small",variant:"outlined",startIcon:p.jsx($we,{fontSize:"small"}),onClick:()=>o(!0),children:t("theme.exportButton","Theme")})}),r&&p.jsx(Pt,{title:t("componentsLibrary.saveTemplate.tooltip","Save the current document as a reusable template"),children:p.jsx(ht,{size:"small",variant:"outlined",startIcon:p.jsx(YW,{fontSize:"small"}),onClick:()=>l(!0),children:t("componentsLibrary.saveTemplate.button","Template")})})]})]}),p.jsxs(H,{children:[p.jsx(tUe,{defaultExpanded:!0}),v$e.map(c=>p.jsx(Z$e,{blockType:c,spec:bX[c],defaultExpanded:!1},c))]}),e&&p.jsx(H,{color:"text.secondary",sx:{display:"flex",justifyContent:"flex-end",mt:3,mb:3},children:p.jsxs(H,{sx:{textAlign:"right"},children:[p.jsxs(xe,{variant:"body2",children:[t("inputs.panels.emailLayout.version"),": ",Kx.version]}),p.jsx(ld,{href:`https://www.npmjs.com/package/${Kx.name}`,target:"_blank",rel:"noopener noreferrer",sx:{fontSize:"0.875rem",mt:.5,display:"inline-block"},children:Kx.name})]})}),p.jsx(nUe,{open:a,onClose:()=>o(!1)}),p.jsx(r6e,{open:s,onClose:()=>l(!1)})]})}function iUe(){const t=q_(),e=pX(t??"root"),n=T.useCallback(a=>{t&&lb(t,()=>a)},[t]);if(!e)return null;const{data:r,type:i}=e;switch(i){case"Container":return p.jsx(vX,{data:r,setData:a=>n({type:i,data:a})},t);case"Divider":return p.jsx(EX,{data:r,setData:a=>n({type:i,data:a})},t);case"Spacer":return p.jsx(xX,{data:r,setData:a=>n({type:i,data:a})},t);case"EmailLayout":return p.jsx(rUe,{});default:return p.jsx("pre",{children:JSON.stringify(e,null," ")})}}function aUe({sticky:t,heightContent:e}){const n=Rd(),r=yS(),i=q_(),a=or(),o=rI(),s=sn(),{t:l}=Ie("inspector");T.useEffect(()=>{const g=_=>{const b=_.target;A3(b.innerWidth)};return window&&A3(window.innerWidth),window.addEventListener("resize",g),()=>{window.removeEventListener("resize",g)}},[n]);const c=()=>{const g={position:"absolute",top:"1rem",right:"0.5rem",color:"primary.main",fontSize:"20px",cursor:"pointer",display:h?"none":void 0},_=()=>Xg(a==="desktop"?"mobile":"desktop");return n==="block-configuration"||n==="css"||h&&i&&!ig.includes(r||"")?p.jsxs("div",{style:{position:"relative"},children:[a==="desktop"?p.jsx(S2,{sx:g,onClick:_}):p.jsx(x1,{sx:g,onClick:_}),p.jsx(V$e,{})]}):p.jsxs("div",{style:{position:"relative"},children:[p.jsx(iUe,{}),a==="desktop"?p.jsx(S2,{sx:g,onClick:_}):p.jsx(x1,{sx:g,onClick:_})]})},u=()=>p.jsx("svg",{style:{marginRight:"4px",color:"inherit"},width:"21",height:"20",viewBox:"0 0 21 20",fill:"none",children:p.jsx("path",{d:"M3.83398 5H17.1673M3.83398 10H17.1673M3.83398 15H9.66732",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),d=()=>p.jsx("svg",{style:{marginRight:"4px",color:"inherit"},width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:p.jsx("path",{d:"M5.83333 17.5C3.99238 17.5 2.5 16.0076 2.5 14.1667V4.16667C2.5 3.24619 3.24619 2.5 4.16667 2.5H7.5C8.42047 2.5 9.16667 3.24619 9.16667 4.16667V14.1667C9.16667 16.0076 7.67428 17.5 5.83333 17.5ZM5.83333 17.5H15.8333C16.7538 17.5 17.5 16.7538 17.5 15.8333V12.5C17.5 11.5795 16.7538 10.8333 15.8333 10.8333H13.8807M9.16669 6.11927L10.5474 4.73858C11.1983 4.0877 12.2535 4.0877 12.9044 4.73858L15.2614 7.0956C15.9123 7.74647 15.9123 8.80175 15.2614 9.45262L8.19036 16.5237M5.83333 14.1667H5.84167",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),f=(g,_)=>{y1e(_)},m=t?e?`calc(${e} - 4px)`:void 0:e??void 0,h=o==="compact";return p.jsx(L5e,{value:h,children:p.jsxs(ff,{sx:g=>({width:h?fG:XR,padding:"0!important",margin:"0!important",height:m,maxHeight:m,display:"flex",flexDirection:"column",overflow:"hidden",position:t?"sticky":"static",top:t?Zs:0,backgroundColor:`${g.palette.background.paper} !important`}),children:[p.jsx(H,{sx:{position:"sticky",top:0,zIndex:1,backgroundColor:`${s.palette.background.paper} !important`,display:h?"none":void 0},children:p.jsxs(fS,{sx:{backgroundColor:`${s.palette.background.paper} !important`},value:n,onChange:f,children:[i!=null&&!ig.includes(r||"")&&[p.jsx(hs,{sx:{height:Zs,minHeight:Zs,fontWeight:"bold"},value:"block-configuration",label:l("header.content"),icon:p.jsx(u,{}),iconPosition:"start"},"block-configuration"),p.jsx(hs,{sx:{height:Zs,minHeight:Zs,fontWeight:"bold"},value:"css",label:l("header.styles"),icon:p.jsx(d,{}),iconPosition:"start"},"css")],i!=null&&ig.includes(r)&&[p.jsx(hs,{sx:{height:Zs,minHeight:Zs,fontWeight:"bold"},value:"styles",label:l("header.styles"),icon:p.jsx(d,{}),iconPosition:"start"},"styles")],i==null&&p.jsx(hs,{sx:{height:Zs,minHeight:Zs,fontWeight:"bold"},value:"styles",label:l("header.styles"),icon:p.jsx(d,{}),iconPosition:"start"},"styles")]})}),p.jsx(ff,{sx:g=>({flex:"1 1 auto",minHeight:0,overflowY:"auto",px:h?"0.5rem!important":"1rem!important",backgroundColor:`${g.palette.background.paper} !important`}),children:c()})]})})}const TX=({children:t,topOffset:e=0,zIndex:n=10,className:r="",style:i={},disabled:a=!1,threshold:o=null,...s})=>{const[l,c]=T.useState(!1),[u,d]=T.useState({width:0,height:0}),[f,m]=T.useState({left:0}),[h,g]=T.useState(0),[_,b]=T.useState(!1),y=T.useRef(null),E=T.useRef(null),v=T.useRef(null);T.useEffect(()=>{if(a){c(!1),b(!1),g(0);return}const C=E.current,k=y.current;if(!C||!k)return;let w=null;o&&(o.startsWith("#")?w=document.getElementById(o.slice(1)):(o.startsWith("."),w=document.querySelector(o)));const D=()=>{const P=k.getBoundingClientRect();d({width:P.width,height:P.height}),m({left:P.left})},A=()=>{if(!w||!k)return{offset:0,isPushed:!1};const P=w.getBoundingClientRect(),L=k.getBoundingClientRect(),B=e+L.height;if(P.top<B){const F=B-P.top,q=L.height+20;return{offset:-Math.min(F,q),isPushed:!0}}return{offset:0,isPushed:!1}},M=new IntersectionObserver(([P])=>{const L=!P.isIntersecting;if(L&&!l&&D(),c(L),L&&o){const{offset:B,isPushed:F}=A();g(B),b(F)}else L||(g(0),b(!1))},{threshold:0,rootMargin:`-${e}px 0px 0px 0px`}),R=new ResizeObserver(()=>{D()}),I=()=>{if(o&&l){const{offset:P,isPushed:L}=A();g(P),b(L)}};return M.observe(C),R.observe(k),o&&window.addEventListener("scroll",I,{passive:!0}),D(),()=>{M.disconnect(),R.disconnect(),o&&window.removeEventListener("scroll",I)}},[e,l,a,o]);const x=!a&&l,S=x?`${e+h}px`:"auto";return p.jsxs("div",{ref:v,className:r,...s,children:[!a&&p.jsx("div",{ref:E,style:{height:"1px",position:"absolute",top:`-${e+1}px`,left:0,right:0,pointerEvents:"none"}}),x&&p.jsx("div",{style:{height:`${u.height}px`,width:`${u.width}px`}}),p.jsx("div",{ref:y,style:{position:x?"fixed":"static",top:S,width:"auto",height:"auto",zIndex:x?n:"auto",transition:_?"none":"box-shadow 0.2s ease-in-out, top 0.3s ease-out",..._&&h<-u.height*.3&&{opacity:Math.max(0,1+(h+u.height*.3)/(u.height*.7))},...i},children:t})]})};var uh={},i9;function oUe(){if(i9)return uh;i9=1;var t=ar();Object.defineProperty(uh,"__esModule",{value:!0}),uh.default=void 0;var e=t(_r()),n=p;return uh.default=(0,e.default)((0,n.jsx)("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"}),"TuneOutlined"),uh}var sUe=oUe();const lUe=Vn(sUe);function cUe(){const t=UG(),e=rI(),{t:n}=Ie("inspector");if(!t)return null;const r=()=>jG(e==="full"?"compact":"full"),i=e==="compact";return p.jsx(H,{sx:{position:"absolute",left:0,top:"50%",transform:"translateX(-100%) translateY(-50%)",zIndex:10},children:p.jsx(Pt,{title:i?n("inspector.handle.expand","Expand panel"):n("inspector.handle.compact","Compact panel"),placement:"left",children:p.jsx(si,{onClick:r,sx:a=>({width:24,minHeight:80,borderTopLeftRadius:8,borderBottomLeftRadius:8,backgroundColor:i?a.palette.primary.main:a.palette.background.paper,color:i?a.palette.primary.contrastText:a.palette.text.secondary,border:`1px solid ${a.palette.divider}`,borderRight:"none",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.5,py:1,boxShadow:"-2px 0 6px rgba(0,0,0,0.04)",transition:"background-color 120ms ease, color 120ms ease","&:hover":{backgroundColor:i?a.palette.primary.dark:a.palette.action.hover}}),children:p.jsx(lUe,{sx:{fontSize:16}})})})})}function uUe(t){return typeof ReadableStream<"u"&&t instanceof ReadableStream?(async function*(){const e=t.getReader(),n=new TextDecoder;try{for(;;){const{value:r,done:i}=await e.read();if(i){const a=n.decode();a&&(yield a);return}r!==void 0&&(typeof r=="string"?yield r:yield n.decode(r,{stream:!0}))}}finally{e.releaseLock()}})():t}function*a9(t){const e=t.split(`
502
+ </html>`,G6e="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900&family=Montserrat:ital,wght@0,100..900;1,100..900&family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Oswald:wght@200..700&family=Pacifico&family=Playfair:ital,opsz,wght@0,5..1200,300..900;1,5..1200,300..900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap";function V6e(t,e){const n=t.head;if(n.querySelector("link[data-eb-fonts]")===null){const r=t.createElement("link");r.setAttribute("data-eb-fonts","1"),r.rel="stylesheet",r.href=G6e,n.appendChild(r)}if(n.querySelector("style[data-eb-globals]")===null){const r=t.createElement("style");r.setAttribute("data-eb-globals","1"),r.textContent=$Q,n.appendChild(r)}t.body.style.backgroundColor=e}function q6e(){const t=sn(),{t:e}=Ie("inspector"),n=T6e(),r=T.useRef(null),i=T.useRef(null),[a,o]=T.useState(null),[s,l]=T.useState(null),[c,u]=T.useState("root"),[d,f]=T.useState(!1),[m,h]=T.useState(null),[g,_]=T.useState(null),[b,y]=T.useState(!1),[E,v]=T.useState("desktop"),x=T.useRef(null),S=T.useCallback(()=>{const I=r.current;if(I===null)return;const P=I.contentDocument;if(P===null)return;const B=(X.getState().document.root?.data??{}).backdropColor??iO;V6e(P,B),o(P.body)},[]);T.useEffect(()=>{if(n===null)return;const I=`${n.category}|${n.axis}|${n.id}`;x.current=I,h(null),y(!1),v("desktop");let P=!1;j6e(n).then(L=>{x.current===I&&(P=!0,T.startTransition(()=>{l(L.doc),u(L.rootBlockId)}),f(!1))}).catch(L=>{x.current===I&&(P=!0,h(L instanceof Error?L.message:String(L)),f(!1))}),Promise.resolve().then(()=>{!P&&x.current===I&&f(!0)})},[n]),T.useEffect(()=>{if(a===null||n===null)return;const P=(X.getState().document.root?.data??{}).backdropColor??iO;a.style.backgroundColor=P},[a,n]),T.useEffect(()=>{if(a===null)return;const I=()=>_(a.scrollHeight);I();const P=new ResizeObserver(I);return P.observe(a),()=>P.disconnect()},[a,s]);const C=E==="mobile"?$6e:B6e,k=g??zx,w=Ux/C,D=b?w:Math.min(w,zx/k),A=C*D,M=k*D;T.useEffect(()=>{i.current&&(i.current.scrollTop=0)},[b,E,n]);const R=T.useMemo(()=>s===null?null:p.jsx(qS,{document:s,rootBlockId:c,viewport:E}),[s,c,E]);return p.jsx(Kf,{open:n!==null,anchorEl:n?.anchor??null,placement:"right-start",keepMounted:!0,modifiers:[{name:"offset",options:{offset:[0,8]}},{name:"preventOverflow",options:{boundary:"viewport",padding:8}},{name:"flip",options:{fallbackPlacements:["left-start","top","bottom"]}}],sx:{zIndex:t.zIndex.tooltip+1,pointerEvents:n!==null?"auto":"none",visibility:n!==null?"visible":"hidden"},children:p.jsxs(ya,{elevation:6,onMouseEnter:x6e,onMouseLeave:$N,sx:{width:Ux+24,padding:1.5,display:"flex",flexDirection:"column",gap:1,backgroundColor:t.palette.background.paper,border:`1px solid ${t.palette.divider}`},children:[p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:.5},children:[p.jsx(xe,{variant:"caption",color:"text.secondary",sx:{fontWeight:600,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n?.name??""}),p.jsx(Pt,{title:E==="mobile"?e("componentsLibrary.preview.desktop","Desktop view"):e("componentsLibrary.preview.mobile","Mobile view"),children:p.jsx(cn,{size:"small",onClick:()=>v(I=>I==="mobile"?"desktop":"mobile"),sx:{flexShrink:0},children:E==="mobile"?p.jsx(D6e,{fontSize:"small"}):p.jsx(R6e,{fontSize:"small"})})}),p.jsx(Pt,{title:b?e("componentsLibrary.preview.fit","Fit to view"):e("componentsLibrary.preview.zoom","Zoom in"),children:p.jsx(cn,{size:"small",onClick:()=>y(I=>!I),sx:{flexShrink:0},children:b?p.jsx(P6e,{fontSize:"small"}):p.jsx(F6e,{fontSize:"small"})})})]}),p.jsxs(H,{ref:i,sx:{position:"relative",width:Ux,height:zx,mx:"auto",display:"flex",justifyContent:"center",alignItems:"flex-start",backgroundColor:t.palette.action.hover,borderRadius:1,overflowY:b?"auto":"hidden",overflowX:"hidden"},children:[p.jsx(H,{sx:{position:"relative",width:A,height:M,flexShrink:0},children:p.jsx("iframe",{ref:r,srcDoc:H6e,title:e("componentsLibrary.preview.iframeTitle","Live preview"),sandbox:"allow-same-origin",onLoad:S,style:{position:"absolute",top:0,left:0,width:C,height:k,border:0,display:"block",backgroundColor:"transparent",transform:`scale(${D})`,transformOrigin:"top left",pointerEvents:"none"}})}),a!==null&&R!==null&&m===null&&gl.createPortal(R,a),d&&p.jsx(H,{sx:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255,255,255,0.6)"},children:p.jsx(ti,{size:24})}),m!==null&&p.jsx(H,{sx:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",p:2,backgroundColor:t.palette.background.paper},children:p.jsx(xe,{variant:"body2",color:"error",sx:{textAlign:"center"},children:m})})]})]})})}const W6e=["updatedDesc","createdDesc","nameAsc","nameDesc","sizeDesc","sizeAsc","blocksDesc","blocksAsc"];function Y6e(t,e){const n=e.search.trim().toLowerCase();return t.filter(r=>{if(e.axes.length>0&&!e.axes.includes(r.axis))return!1;if(e.tags.length>0){const i=r.tags??[];if(!e.tags.every(a=>i.includes(a)))return!1}return!(n.length>0&&![r.name,r.description??"",r.axis,...r.tags??[]].join(" ").toLowerCase().includes(n))})}function K6e(t,e){const n=[...t],r=(i,a)=>i.name.localeCompare(a.name);switch(e){case"nameAsc":return n.sort(r);case"nameDesc":return n.sort((i,a)=>r(a,i));case"createdDesc":return n.sort((i,a)=>i.createdAt<a.createdAt?1:i.createdAt>a.createdAt?-1:0);case"sizeAsc":return n.sort((i,a)=>i.sizeBytes-a.sizeBytes);case"sizeDesc":return n.sort((i,a)=>a.sizeBytes-i.sizeBytes);case"blocksAsc":return n.sort((i,a)=>i.blockCount-a.blockCount);case"blocksDesc":return n.sort((i,a)=>a.blockCount-i.blockCount);case"updatedDesc":default:return n.sort((i,a)=>i.updatedAt<a.updatedAt?1:i.updatedAt>a.updatedAt?-1:0)}}function Q6e(t){const e=new Set;for(const n of t)for(const r of n.tags??[])e.add(r);return Array.from(e).sort()}var Qm={},A5;function X6e(){if(A5)return Qm;A5=1;var t=ar();Object.defineProperty(Qm,"__esModule",{value:!0}),Qm.default=void 0;var e=t(_r()),n=p;return Qm.default=(0,e.default)((0,n.jsx)("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}),"CheckOutlined"),Qm}var J6e=X6e();const Z6e=Vn(J6e);var Xm={},O5;function e5e(){if(O5)return Xm;O5=1;var t=ar();Object.defineProperty(Xm,"__esModule",{value:!0}),Xm.default=void 0;var e=t(_r()),n=p;return Xm.default=(0,e.default)((0,n.jsx)("path",{d:"M16 9v10H8V9zm-1.5-6h-5l-1 1H5v2h14V4h-3.5zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2z"}),"DeleteOutlined"),Xm}var t5e=e5e();const n5e=Vn(t5e);var Jm={},R5;function r5e(){if(R5)return Jm;R5=1;var t=ar();Object.defineProperty(Jm,"__esModule",{value:!0}),Jm.default=void 0;var e=t(_r()),n=p;return Jm.default=(0,e.default)((0,n.jsx)("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"}),"EditOutlined"),Jm}var i5e=r5e();const a5e=Vn(i5e);async function sb(t){const e=await t.json().catch(()=>null);if(!t.ok)throw t.status===403&&e?.hint?new Error(e.hint):new Error(e?.error??`HTTP ${t.status}`);return e}async function o5e(){if(Fs()==="local")return X4e();const t=await fetch(`${zr()}/dev/themes`);return(await sb(t)).themes}async function s5e(t){if(Fs()==="local")return J4e(t);const e=await fetch(`${zr()}/dev/themes/${encodeURIComponent(t)}`);return sb(e)}async function iX(t){if(Fs()==="local")return Z4e(t);const e=await fetch(`${zr()}/dev/save-theme`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return sb(e)}async function l5e(t,e){if(Fs()==="local")return e6e(t,e);const n=await fetch(`${zr()}/dev/themes/${encodeURIComponent(t)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return sb(n)}async function c5e(t){if(Fs()==="local")return t6e(t);const e=await fetch(`${zr()}/dev/themes/${encodeURIComponent(t)}`,{method:"DELETE"});return sb(e)}function u5e({themeId:t,themeName:e,onClose:n,onApplied:r}){const{t:i}=Ie("inspector"),[a,o]=T.useState(!1),[s,l]=T.useState(null),c=T.useCallback(()=>{a||(l(null),n())},[a,n]),u=T.useCallback(async()=>{if(!(!t||a)){o(!0),l(null);try{const d=await s5e(t),f=Wve.safeParse(d);if(!f.success)throw new Error(i("theme.apply.errorMalformed","Saved theme failed schema validation."));aI(f.data,t),r?.(t),n()}catch(d){l(d instanceof Error?d.message:String(d))}finally{o(!1)}}},[t,a,r,n,i]);return p.jsxs(Is,{open:t!==null,onClose:c,maxWidth:"sm",fullWidth:!0,children:[p.jsx(Ms,{children:i("theme.apply.title",'Apply theme "{{name}}"?',{name:e})}),p.jsx(Ps,{children:p.jsxs(qe,{gap:2,sx:{mt:1},children:[p.jsx(xe,{variant:"body2",color:"text.secondary",children:i("theme.apply.body","This will overwrite your current root globals and per-block-type theme overrides. You can undo this action.")}),s&&p.jsx($n,{severity:"error",children:s})]})}),p.jsxs(Ns,{children:[p.jsx(ht,{onClick:c,disabled:a,children:i("theme.apply.cancel","Cancel")}),p.jsx(ht,{onClick:u,variant:"contained",disabled:a,children:a?i("theme.apply.applying","Applying…"):i("theme.apply.submit","Apply")})]})]})}const jx=100,Hx=280;function d5e({target:t,onClose:e,onRenamed:n}){const{t:r}=Ie("inspector"),[i,a]=T.useState(""),[o,s]=T.useState(""),[l,c]=T.useState(!1),[u,d]=T.useState(null);T.useEffect(()=>{t&&(a(t.name),s(t.description??""),d(null))},[t]);const f=i.trim(),m=f.length>0&&f.length<=jx&&o.length<=Hx,h=t!==null&&(f!==t.name||o!==(t.description??"")),g=T.useCallback(()=>{l||e()},[l,e]),_=T.useCallback(async()=>{if(!(!t||!m||!h||l)){c(!0),d(null);try{await l5e(t.id,{name:f,description:o.length===0?"":o}),n?.(t.id),e()}catch(b){d(b instanceof Error?b.message:String(b))}finally{c(!1)}}},[t,m,h,l,f,o,e,n]);return p.jsxs(Is,{open:t!==null,onClose:g,maxWidth:"sm",fullWidth:!0,children:[p.jsx(Ms,{children:r("theme.rename.title","Rename theme")}),p.jsx(Ps,{children:p.jsxs(qe,{gap:2,sx:{mt:1},children:[p.jsx(Ir,{label:r("theme.save.nameLabel","Name"),value:i,onChange:b=>a(b.target.value),autoFocus:!0,fullWidth:!0,disabled:l,inputProps:{maxLength:jx},helperText:`${f.length}/${jx}`}),p.jsx(Ir,{label:r("theme.save.descriptionLabel","Description (optional)"),value:o,onChange:b=>s(b.target.value),fullWidth:!0,multiline:!0,minRows:2,disabled:l,inputProps:{maxLength:Hx},helperText:`${o.length}/${Hx}`}),u&&p.jsx($n,{severity:"error",children:u})]})}),p.jsxs(Ns,{children:[p.jsx(ht,{onClick:g,disabled:l,children:r("theme.save.cancel","Cancel")}),p.jsx(ht,{onClick:_,variant:"contained",disabled:!m||!h||l,children:l?r("theme.save.submitting","Saving…"):r("theme.rename.submit","Save changes")})]})]})}const p5e=120,xu={primary:"#5e6ad2",secondary:"#8e8fff",textColor:"#1f2328",backdrop:"#f4f4f4",canvas:"#ffffff",fontFamily:'"Inter", system-ui, sans-serif'};function f5e({globals:t,height:e=p5e,alt:n}){const r=sn(),i=t?.primaryColor??xu.primary,a=t?.secondaryColor??xu.secondary,o=t?.textColor??xu.textColor,s=t?.headingTextColor??t?.textColor??xu.textColor,l=t?.backdropColor??t?.bodyBackgroundColor??xu.backdrop,c=t?.canvasColor??t?.canvasBackgroundColor??xu.canvas,u=t?.fontFamily??xu.fontFamily;return p.jsx(H,{"aria-label":n,sx:{width:"100%",height:e,borderRadius:1,overflow:"hidden",backgroundColor:l,display:"flex",alignItems:"center",justifyContent:"center",padding:"8px",pointerEvents:"none",border:`1px solid ${r.palette.divider}`},children:p.jsxs(H,{sx:{width:"100%",height:"100%",backgroundColor:c,borderRadius:.5,padding:"6px 8px",display:"flex",flexDirection:"column",gap:"4px",fontFamily:u},children:[p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0},children:[p.jsx(H,{sx:{width:10,height:10,borderRadius:"50%",backgroundColor:i}}),p.jsx(H,{sx:{width:10,height:10,borderRadius:"50%",backgroundColor:a}}),p.jsx(H,{sx:{width:10,height:10,borderRadius:.5,backgroundColor:o}}),p.jsx(H,{sx:{flex:1}}),p.jsx(H,{sx:{fontSize:8,fontWeight:500,color:o,opacity:.6,lineHeight:1,maxWidth:60,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:"Aa Bb"})]}),p.jsx(H,{sx:{fontSize:11,fontWeight:700,color:s,lineHeight:1.2},children:"Heading Sample"}),p.jsx(H,{sx:{fontSize:8,color:o,lineHeight:1.3,opacity:.85},children:"Body sample text"}),p.jsx(H,{sx:{height:1,width:"40%",backgroundColor:r.palette.divider,my:"2px"}}),p.jsx(H,{sx:{alignSelf:"flex-start",mt:"auto",backgroundColor:i,color:"#ffffff",fontSize:8,fontWeight:600,padding:"3px 8px",borderRadius:.5,lineHeight:1},children:"Button"})]})})}function m5e({item:t,selected:e,onApply:n,onRename:r,onDelete:i,t:a,themeBorder:o,themeHoverBg:s,themeHoverBorder:l,themeSelectedBorder:c}){return p.jsxs(H,{onMouseEnter:u=>nX({anchor:u.currentTarget,category:"theme",axis:"",id:t.id,name:t.name,themeBundle:{globals:t.globals,blocks:t.blocks}}),onMouseLeave:$N,onClick:()=>n(t),sx:{p:1,borderRadius:1,border:e?"2px solid":"1px solid",borderColor:e?c:o,cursor:"pointer",display:"flex",flexDirection:"column",gap:.75,transition:"background-color 120ms ease, border-color 120ms ease","&:hover":{backgroundColor:s,borderColor:e?c:l}},children:[p.jsx(f5e,{globals:t.globals,alt:t.name}),p.jsxs(H,{sx:{display:"flex",alignItems:"flex-start",gap:.75},children:[p.jsxs(H,{sx:{minWidth:0,flex:1},children:[p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:.5,minWidth:0},children:[p.jsx(xe,{variant:"body2",sx:{fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:t.name,children:t.name}),e&&p.jsx(sa,{size:"small",color:"primary",icon:p.jsx(Z6e,{}),label:a("theme.applied.badge","Selected"),sx:{height:18,flexShrink:0,"& .MuiChip-label":{px:.5,fontSize:11}}})]}),t.description&&p.jsx(xe,{variant:"caption",color:"text.secondary",sx:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:t.description})]}),p.jsxs(qe,{direction:"row",gap:0,sx:{flexShrink:0},children:[p.jsx(Pt,{title:a("componentsLibrary.drawer.themes.rename","Rename theme"),children:p.jsx(cn,{size:"small",onClick:u=>{u.stopPropagation(),r(t)},children:p.jsx(a5e,{fontSize:"small"})})}),p.jsx(Pt,{title:a("componentsLibrary.drawer.themes.delete","Delete theme"),children:p.jsx(cn,{size:"small",onClick:u=>{u.stopPropagation(),i(t)},children:p.jsx(n5e,{fontSize:"small"})})})]})]})]})}function h5e({refreshKey:t,onChange:e,search:n="",onCounts:r}){const{t:i}=Ie("inspector"),a=sn(),o=LG(),[s,l]=T.useState([]),[c,u]=T.useState(!1),[d,f]=T.useState(null),[m,h]=T.useState(null),[g,_]=T.useState(null),b=T.useCallback(async()=>{u(!0),f(null);try{const v=await o5e();l(v)}catch(v){f(v instanceof Error?v.message:String(v))}finally{u(!1)}},[]);T.useEffect(()=>{b()},[b,t]);const y=T.useMemo(()=>{const v=n.trim().toLowerCase();return v?s.filter(x=>`${x.name} ${x.description??""}`.toLowerCase().includes(v)):s},[s,n]);T.useEffect(()=>{r?.(y.length,s.length)},[y.length,s.length,r]);const E=T.useCallback(async v=>{if(window.confirm(i("componentsLibrary.drawer.themes.deleteConfirm",'Delete theme "{{name}}"? This cannot be undone.',{name:v.name})))try{await c5e(v.id),e()}catch(S){f(S instanceof Error?S.message:String(S))}},[i,e]);return d?p.jsx($n,{severity:"error",sx:{mt:1},children:d}):c&&s.length===0?p.jsx(xe,{variant:"body2",color:"text.secondary",sx:{mt:1},children:i("componentsLibrary.drawer.themes.loading","Loading themes…")}):!c&&s.length===0?p.jsx(xe,{variant:"body2",color:"text.secondary",sx:{mt:1},children:i("componentsLibrary.drawer.themes.empty","No themes saved yet.")}):p.jsxs(p.Fragment,{children:[y.length===0?p.jsx(xe,{variant:"body2",color:"text.secondary",sx:{mt:1},children:i("componentsLibrary.drawer.noResults","No components match your search.")}):p.jsx(qe,{gap:1.5,sx:{mt:1},children:y.map(v=>p.jsx(m5e,{item:v,selected:o===v.id,onApply:h,onRename:_,onDelete:E,t:i,themeBorder:a.palette.divider,themeHoverBg:a.palette.action.hover,themeHoverBorder:a.palette.secondary.main,themeSelectedBorder:a.palette.primary.main},v.id))}),p.jsx(u5e,{themeId:m?.id??null,themeName:m?.name??"",onClose:()=>h(null),onApplied:()=>{h(null),e()}}),p.jsx(d5e,{target:g,onClose:()=>_(null),onRenamed:()=>{_(null),e()}})]})}const g5e=120,_5e=641,b5e=600;function y5e({id:t,block:e,height:n=g5e,alt:r}){const i=sn(),a=T.useRef(null),[o,s]=T.useState(!1),l=X(u=>u.document?.root?.data),c=T.useMemo(()=>{if(!o)return null;try{const u=l?.theme,d=Jg(e,u);return LBe({id:t,block:d},{rootData:l})}catch{return null}},[o,t,e,l]);return T.useEffect(()=>{if(o)return;const u=a.current;if(u===null)return;if(typeof IntersectionObserver>"u"){s(!0);return}const d=new IntersectionObserver(f=>{for(const m of f)if(m.isIntersecting){s(!0),d.disconnect();break}},{rootMargin:"200px"});return d.observe(u),()=>d.disconnect()},[o]),p.jsx(H,{ref:a,sx:{width:"100%",height:n,borderRadius:1,backgroundColor:i.palette.action.hover,overflow:"hidden",position:"relative",pointerEvents:"none"},"aria-label":r,children:c!==null&&p.jsx("iframe",{srcDoc:c,title:r,sandbox:"allow-same-origin",loading:"lazy",style:{width:`${_5e}px`,height:`${b5e}px`,border:0,transform:"scale(0.4)",transformOrigin:"top left",position:"absolute",top:0,left:0,backgroundColor:"#ffffff"}})})}var Zm={},I5;function v5e(){if(I5)return Zm;I5=1;var t=ar();Object.defineProperty(Zm,"__esModule",{value:!0}),Zm.default=void 0;var e=t(_r()),n=p;return Zm.default=(0,e.default)((0,n.jsx)("path",{d:"m21.9 21.9-6.1-6.1-2.69-2.69L5 5 3.59 3.59 2.1 2.1.69 3.51 3 5.83V19c0 1.1.9 2 2 2h13.17l2.31 2.31zM5 19V7.83l6.84 6.84-.84 1.05L9 13l-3 4h8.17l2 2zM7.83 5l-2-2H19c1.1 0 2 .9 2 2v13.17l-2-2V5z"}),"ImageNotSupportedOutlined"),Zm}var E5e=v5e();const S5e=Vn(E5e);function C5e({src:t,alt:e,height:n=120,placeholderText:r}){const i=sn(),a={width:"100%",height:n,borderRadius:4,backgroundColor:i.palette.background.default,display:"block"};return t===null?p.jsxs(H,{sx:{...a,border:`1px dashed ${i.palette.divider}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.5,color:"text.secondary"},"aria-label":e,children:[p.jsx(S5e,{sx:{fontSize:24,opacity:.6}}),r!==void 0&&p.jsx(xe,{variant:"caption",sx:{opacity:.7},children:r})]}):p.jsx("img",{src:t,alt:e,loading:"lazy",decoding:"async",style:{...a,objectFit:"cover",objectPosition:"top center",border:`1px solid ${i.palette.divider}`},onError:o=>{const s=o.currentTarget;s.style.display="none"}})}const x5e={section:"sections",layout:"layouts",template:"templates"};function T5e(t,e,n){const r=zr(),i=x5e[t];if(t==="template")return`${r}/dev/${i}/${encodeURIComponent(n)}/thumbnail`;if(e===null)throw new Error(`category '${t}' requires an axis but received null`);return`${r}/dev/${i}/${encodeURIComponent(e)}/${encodeURIComponent(n)}/thumbnail`}const oO=380,xg="__other__",N5=[{key:"sections",labelKey:"componentsLibrary.drawer.category.sections",enabled:!0},{key:"primitives",labelKey:"componentsLibrary.drawer.category.primitives",enabled:!0},{key:"layouts",labelKey:"componentsLibrary.drawer.category.layouts",enabled:!0},{key:"templates",labelKey:"componentsLibrary.drawer.category.templates",enabled:!0},{key:"themes",labelKey:"componentsLibrary.drawer.category.themes",enabled:!0}];function P5({item:t,category:e,onClick:n}){const{t:r}=Ie("inspector"),i=sn(),a=e!=="template",[{isDragging:o},s]=LE(()=>({type:El,item:()=>({kind:El,category:e,axis:t.axis,id:t.id}),canDrag:()=>a,collect:d=>({isDragging:d.isDragging()})}),[e,t.axis,t.id,a]);T.useEffect(()=>{o&&rX()},[o]);const l=e==="section"||e==="layout"||e==="template",c=e==="primitive"&&t.block!==void 0,u=l&&t.hasThumbnail?T5e(e,e==="template"?null:t.axis,t.id):null;return p.jsxs(H,{ref:d=>{a&&d&&s(d)},onMouseEnter:d=>nX({anchor:d.currentTarget,category:e,axis:t.axis,id:t.id,name:t.name,primitiveBlock:e==="primitive"?t.block:void 0}),onMouseLeave:$N,onClick:n?()=>n(t):void 0,sx:{p:1,borderRadius:1,border:"1px dashed",borderColor:i.palette.divider,cursor:n?"pointer":"grab",opacity:o?.5:1,display:"flex",flexDirection:"column",gap:.75,transition:"background-color 120ms ease, border-color 120ms ease","&:hover":{backgroundColor:i.palette.action.hover,borderColor:i.palette.secondary.main},"&:active":{cursor:"grabbing"}},children:[c&&p.jsx(y5e,{id:t.id,block:t.block,alt:t.name}),l&&p.jsx(C5e,{src:u,alt:t.name,placeholderText:r("componentsLibrary.thumbnail.placeholder","No preview")}),p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:.75},children:[p.jsx(ZQ,{sx:{fontSize:16,color:"text.secondary",flexShrink:0,display:a?"inline-flex":"none"}}),p.jsx(H,{sx:{minWidth:0,flex:1},children:p.jsx(xe,{variant:"body2",sx:{fontSize:"0.8rem",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:t.name,children:t.name})})]})]})}const Gx=24;function k5e({items:t,columns:e,renderItem:n}){const[r,i]=T.useState(Gx),a=T.useRef(null);return T.useEffect(()=>{i(Gx)},[t]),T.useEffect(()=>{const o=a.current;if(!o)return;const s=new IntersectionObserver(l=>{l[0]?.isIntersecting&&i(c=>c<t.length?Math.min(t.length,c+Gx):c)},{rootMargin:"300px"});return s.observe(o),()=>s.disconnect()},[t.length,r]),p.jsxs(H,{sx:{mt:1.5},children:[p.jsx(H,{sx:{display:"grid",gridTemplateColumns:`repeat(${e}, minmax(0, 1fr))`,gap:.5},children:t.slice(0,r).map(o=>n(o))}),r<t.length&&p.jsx(H,{ref:a,sx:{height:1}})]})}function o0({title:t,items:e,category:n,loading:r,error:i,groupLabelKey:a,columns:o,virtualize:s,search:l,sort:c,expanded:u,onToggle:d,onClick:f,onRename:m,onDelete:h}){const{t:g}=Ie("inspector"),[_,b]=T.useState([]),[y,E]=T.useState({}),v=T.useMemo(()=>Q6e(e),[e]),x=T.useMemo(()=>({search:l,axes:[],tags:_,sort:c}),[l,_,c]),S=T.useMemo(()=>K6e(Y6e(e,x),c),[e,x,c]),C=T.useMemo(()=>{const M=new Map;for(const I of S){const P=M.get(I.axis)??[];P.push(I),M.set(I.axis,P)}return Array.from(M.keys()).sort((I,P)=>I===xg?1:P===xg?-1:I.localeCompare(P)).map(I=>({axis:I,items:M.get(I)??[]}))},[S]),k=C.length===0||C.length===1&&C[0].axis==="",w=M=>M===xg?g("componentsLibrary.drawer.usageOther","Other"):a?g(`${a}.${M}`,M):M,D=(M,R)=>s?p.jsx(k5e,{items:M,columns:o??2,renderItem:I=>p.jsx(P5,{item:I,category:n,onClick:f,onRename:m,onDelete:h},I.id)}):p.jsx(H,{sx:{display:"grid",gridTemplateColumns:o?`repeat(${o}, minmax(0, 1fr))`:"1fr",gap:.5},children:M.map(I=>p.jsx(P5,{item:I,category:n,onClick:f,onRename:m,onDelete:h},`${R}/${I.id}`))}),A=()=>i?p.jsx($n,{severity:"error",sx:{mt:1},children:i}):r&&e.length===0?p.jsx(xe,{variant:"body2",color:"text.secondary",sx:{mt:1},children:g("componentsLibrary.drawer.loading")}):!r&&e.length===0?p.jsx(xe,{variant:"body2",color:"text.secondary",sx:{mt:1},children:g("componentsLibrary.drawer.empty")}):p.jsxs(qe,{gap:1,sx:{pt:.5},children:[v.length>0&&p.jsx(v6e,{items:v,selected:_,onChange:b,title:g("componentsLibrary.search.tagsLabel","Tags")}),S.length===0?p.jsx(xe,{variant:"body2",color:"text.secondary",sx:{mt:1},children:g("componentsLibrary.drawer.noResults","No components match your search.")}):k?D(S,"flat"):p.jsx(H,{children:C.map((M,R)=>p.jsx(y6e,{title:w(M.axis),count:M.items.length,expanded:y[M.axis]??R===0,onToggle:I=>E(P=>({...P,[M.axis]:I})),children:D(M.items,M.axis)},M.axis))})]});return p.jsx(tX,{title:t,count:S.length,total:e.length,expanded:u,onToggle:d,children:A()})}async function s0(t,e){const n=await fetch(t);if(!n.ok){const i=await n.json().catch(()=>null);throw n.status===403?new Error(i?.hint??"Endpoint disabled in this environment."):new Error(i?.error??`HTTP ${n.status}`)}return(await n.json())[e]??[]}function w5e({refreshKey:t,title:e,search:n,sort:r,expanded:i,onToggle:a,onRename:o,onChange:s}){const{t:l}=Ie("inspector"),[c,u]=T.useState([]),[d,f]=T.useState(!1),[m,h]=T.useState(null),g=T.useCallback(async()=>{f(!0),h(null);try{const b=await s0(`${zr()}/dev/sections`,"sections");u(b.map(y=>({...y,axis:y.role})))}catch(b){h(b instanceof Error?b.message:String(b))}finally{f(!1)}},[]);T.useEffect(()=>{g()},[g,t]);const _=T.useCallback(async b=>{if(window.confirm(l("componentsLibrary.drawer.deleteConfirm",'Delete component "{{name}}"? This cannot be undone.',{name:b.name})))try{const E=await fetch(`${zr()}/dev/sections/${encodeURIComponent(b.axis)}/${encodeURIComponent(b.id)}`,{method:"DELETE"});if(!E.ok){const v=await E.json().catch(()=>null);throw new Error(v?.error??`HTTP ${E.status}`)}u(v=>v.filter(x=>!(x.axis===b.axis&&x.id===b.id))),s()}catch(E){h(E instanceof Error?E.message:String(E))}},[l,s]);return p.jsx(o0,{title:e,items:c,category:"section",loading:d,error:m,columns:2,groupLabelKey:"componentsLibrary.sectionRole",search:n,sort:r,expanded:i,onToggle:a,onRename:b=>o({category:"section",axis:b.axis,id:b.id,name:b.name,description:b.description,tags:b.tags}),onDelete:_})}function D5e({refreshKey:t,title:e,search:n,sort:r,expanded:i,onToggle:a,onRename:o,onChange:s}){const[l,c]=T.useState([]),[u,d]=T.useState(!1),[f,m]=T.useState(null),{t:h}=Ie("inspector"),g=T.useCallback(async()=>{d(!0),m(null);try{const b=await s0(`${zr()}/dev/primitives`,"primitives");c(b.map(y=>({...y,axis:y.type})))}catch(b){m(b instanceof Error?b.message:String(b))}finally{d(!1)}},[]);T.useEffect(()=>{g()},[g,t]);const _=T.useCallback(async b=>{if(window.confirm(h("componentsLibrary.drawer.deleteConfirm","Delete?",{name:b.name})))try{const y=await fetch(`${zr()}/dev/primitives/${encodeURIComponent(b.axis)}/${encodeURIComponent(b.id)}`,{method:"DELETE"});if(!y.ok){const E=await y.json().catch(()=>null);throw new Error(E?.error??`HTTP ${y.status}`)}c(E=>E.filter(v=>!(v.axis===b.axis&&v.id===b.id))),s()}catch(y){m(y instanceof Error?y.message:String(y))}},[h,s]);return p.jsx(o0,{title:e,items:l,category:"primitive",loading:u,error:f,columns:2,search:n,sort:r,expanded:i,onToggle:a,onRename:b=>o({category:"primitive",axis:b.axis,id:b.id,name:b.name,description:b.description,tags:b.tags}),onDelete:_})}function A5e({refreshKey:t,title:e,search:n,sort:r,expanded:i,onToggle:a,onRename:o,onChange:s}){const[l,c]=T.useState([]),[u,d]=T.useState(!1),[f,m]=T.useState(null),{t:h}=Ie("inspector"),g=T.useCallback(async()=>{d(!0),m(null);try{const b=await s0(`${zr()}/dev/layouts`,"layouts");c(b.map(y=>({...y,axis:y.shape})))}catch(b){m(b instanceof Error?b.message:String(b))}finally{d(!1)}},[]);T.useEffect(()=>{g()},[g,t]);const _=T.useCallback(async b=>{if(window.confirm(h("componentsLibrary.drawer.deleteConfirm","Delete?",{name:b.name})))try{const y=await fetch(`${zr()}/dev/layouts/${encodeURIComponent(b.axis)}/${encodeURIComponent(b.id)}`,{method:"DELETE"});if(!y.ok){const E=await y.json().catch(()=>null);throw new Error(E?.error??`HTTP ${y.status}`)}c(E=>E.filter(v=>!(v.axis===b.axis&&v.id===b.id))),s()}catch(y){m(y instanceof Error?y.message:String(y))}},[h,s]);return p.jsx(o0,{title:e,items:l,category:"layout",loading:u,error:f,columns:2,search:n,sort:r,expanded:i,onToggle:a,onRename:b=>o({category:"layout",axis:b.axis,id:b.id,name:b.name,description:b.description,tags:b.tags}),onDelete:_})}function O5e({refreshKey:t,title:e,search:n,sort:r,expanded:i,onToggle:a,onRename:o,onChange:s}){const[l,c]=T.useState([]),[u,d]=T.useState(!1),[f,m]=T.useState(null),[h,g]=T.useState(null),{t:_}=Ie("inspector"),b=T.useCallback(async()=>{d(!0),m(null);try{if(Fs()==="local"){c(q4e().map(v=>({...v,axis:xg})));return}const E=await s0(`${zr()}/dev/templates`,"templates");c(E.map(v=>({...v,axis:v.usage||xg})))}catch(E){m(E instanceof Error?E.message:String(E))}finally{d(!1)}},[]);T.useEffect(()=>{b()},[b,t]);const y=T.useCallback(async E=>{if(window.confirm(_("componentsLibrary.drawer.deleteConfirm","Delete?",{name:E.name})))try{if(Fs()==="local")Q4e(E.id);else{const v=await fetch(`${zr()}/dev/templates/${encodeURIComponent(E.id)}`,{method:"DELETE"});if(!v.ok){const x=await v.json().catch(()=>null);throw new Error(x?.error??`HTTP ${v.status}`)}}c(v=>v.filter(x=>x.id!==E.id)),s()}catch(v){m(v instanceof Error?v.message:String(v))}},[_,s]);return p.jsxs(p.Fragment,{children:[p.jsx(o0,{title:e,items:l,category:"template",loading:u,error:f,columns:2,virtualize:!0,search:n,sort:r,expanded:i,onToggle:a,onClick:g,onRename:E=>o({category:"template",axis:"",id:E.id,name:E.name,description:E.description,tags:E.tags}),onDelete:y}),p.jsx(s6e,{templateId:h?.id??null,templateName:h?.name??"",onClose:()=>g(null),onApplied:()=>g(null)})]})}function R5e({title:t,search:e,expanded:n,onToggle:r,refreshKey:i,onChange:a}){const[o,s]=T.useState({filtered:0,total:0}),l=T.useCallback((c,u)=>s({filtered:c,total:u}),[]);return p.jsx(tX,{title:t,count:o.filtered,total:o.total,expanded:n,onToggle:r,children:p.jsx(h5e,{refreshKey:i,onChange:a,search:e,onCounts:l})})}function I5e(){const t=HG(),e=vS(),n=NG(),r=PG(),{t:i}=Ie("inspector"),a=sn(),o=T.useMemo(()=>N5.filter(R=>!(n==="local"&&R.key!=="templates"&&R.key!=="themes"||!r&&R.key==="templates")),[n,r]),[s,l]=T.useState(0),[c,u]=T.useState(0),[d,f]=T.useState(0),[m,h]=T.useState(0),[g,_]=T.useState(0),[b,y]=T.useState(null),[E,v]=T.useState(""),[x,S]=T.useState("updatedDesc"),[C,k]=T.useState(()=>({[N5[0]?.key??"sections"]:!0})),w=T.useCallback((R,I)=>{k(P=>({...P,[R]:I}))},[]),D=()=>{rX(),E1e(!1)},A=()=>{u(R=>R+1),f(R=>R+1),h(R=>R+1),_(R=>R+1),l(R=>R+1),z6e()},M=T.useCallback(R=>{switch(R){case"section":u(I=>I+1);break;case"primitive":f(I=>I+1);break;case"layout":h(I=>I+1);break;case"template":_(I=>I+1);break}},[]);return e?p.jsxs(H,{sx:{position:"absolute",top:0,left:0,bottom:0,zIndex:10,width:t?oO:0,flexShrink:0,overflow:"hidden",transition:"width 220ms cubic-bezier(0.4, 0, 0.2, 1)",backgroundColor:a.palette.background.paper,borderRight:t?`1px solid ${a.palette.divider}`:"none",display:"flex",flexDirection:"column",pointerEvents:t?"auto":"none"},children:[p.jsxs(H,{sx:{width:oO,height:"100%",display:"flex",flexDirection:"column"},children:[p.jsxs(qe,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{px:1.5,py:1,borderBottom:`1px solid ${a.palette.divider}`},children:[p.jsx(xe,{variant:"subtitle2",children:i("componentsLibrary.drawer.title")}),p.jsxs(qe,{direction:"row",gap:.5,children:[p.jsx(Pt,{title:i("componentsLibrary.drawer.refresh"),children:p.jsx(cn,{size:"small",onClick:A,children:p.jsx(f6e,{fontSize:"small"})})}),p.jsx(Pt,{title:i("componentsLibrary.drawer.close"),children:p.jsx(cn,{size:"small",onClick:D,children:p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("polyline",{points:"11 17 6 12 11 7"}),p.jsx("polyline",{points:"18 17 13 12 18 7"})]})})})]})]}),p.jsxs(H,{sx:{px:1.5,py:1,borderBottom:`1px solid ${a.palette.divider}`},children:[p.jsx(Ir,{size:"small",fullWidth:!0,value:E,onChange:R=>v(R.target.value),placeholder:i("componentsLibrary.search.placeholder","Search…"),sx:Ko,InputProps:{startAdornment:p.jsx(tG,{position:"start",children:p.jsx(g6e,{fontSize:"small"})})}}),p.jsxs(H,{sx:{mt:1},children:[p.jsx(on,{label:i("componentsLibrary.search.sortLabel","Sort")}),p.jsx(ha,{value:x,onChange:R=>S(R.target.value),size:"small",children:W6e.map(R=>p.jsx(Yr,{value:R,sx:{fontSize:"0.8rem"},children:i(`componentsLibrary.search.sort.${R}`,R)},R))})]})]}),p.jsx(H,{sx:{flex:1,minHeight:0,overflowY:"auto",px:1.5,pb:2},children:o.map(R=>{const I={title:i(R.labelKey),search:E,sort:x,expanded:C[R.key]??!1,onToggle:P=>w(R.key,P),onRename:y};switch(R.key){case"sections":return p.jsx(w5e,{...I,refreshKey:c,onChange:()=>u(P=>P+1)},R.key);case"primitives":return p.jsx(D5e,{...I,refreshKey:d,onChange:()=>f(P=>P+1)},R.key);case"layouts":return p.jsx(A5e,{...I,refreshKey:m,onChange:()=>h(P=>P+1)},R.key);case"templates":return p.jsx(O5e,{...I,refreshKey:g,onChange:()=>_(P=>P+1)},R.key);case"themes":return p.jsx(R5e,{title:i(R.labelKey),search:E,expanded:C[R.key]??!1,onToggle:P=>w(R.key,P),refreshKey:s,onChange:()=>l(P=>P+1)},R.key);default:return null}})})]}),p.jsx(a6e,{target:b,onClose:()=>y(null),onRenamed:()=>{b&&M(b.category),y(null)}}),p.jsx(q6e,{})]}):null}var eh={},M5;function N5e(){if(M5)return eh;M5=1;var t=ar();Object.defineProperty(eh,"__esModule",{value:!0}),eh.default=void 0;var e=t(_r()),n=p;return eh.default=(0,e.default)((0,n.jsx)("path",{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m0 14H8V4h12zm-7-2h2v-3h3V9h-3V6h-2v3h-3v2h3z"}),"LibraryAddOutlined"),eh}var P5e=N5e();const aX=Vn(P5e);function M5e(){const t=HG(),e=vS(),{t:n}=Ie("inspector");return e?p.jsx(H,{sx:{position:"absolute",left:t?oO:0,top:"50%",transform:"translateY(-50%)",zIndex:10,transition:"left 220ms cubic-bezier(0.4, 0, 0.2, 1)"},children:p.jsx(Pt,{title:n(t?"componentsLibrary.drawer.handleClose":"componentsLibrary.drawer.handleOpen"),placement:"right",children:p.jsxs(si,{onClick:v1e,"aria-label":n(t?"componentsLibrary.drawer.handleClose":"componentsLibrary.drawer.handleOpen"),sx:r=>({width:28,minHeight:96,borderTopRightRadius:8,borderBottomRightRadius:8,backgroundColor:t?r.palette.secondary.main:r.palette.background.paper,color:t?r.palette.secondary.contrastText:r.palette.text.primary,border:`1px solid ${r.palette.divider}`,borderLeft:"none",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.75,py:1,boxShadow:"2px 0 8px rgba(0,0,0,0.06)",transition:"background-color 120ms ease, color 120ms ease","&:hover":{backgroundColor:t?r.palette.secondary.dark:r.palette.action.hover}}),children:[p.jsx(aX,{sx:{fontSize:18}}),p.jsx(H,{sx:{writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:"0.7rem",fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:n("componentsLibrary.drawer.handle")})]})})}):null}const oX=T.createContext(!1),L5e=oX.Provider,To=()=>T.useContext(oX);function lb(t,e){SS(t,e)}function Bh(t,e){lb(t,n=>{const r=n.data&&"props"in n.data?n.data.props:void 0,i={...r!==null&&typeof r=="object"?r:{}},a=typeof e=="function"?e(i):e,o={...i,...typeof a=="object"&&a!==null?a:{}};return i===o?n:{...n,data:{...n.data,props:o}}})}var th={},L5;function F5e(){if(L5)return th;L5=1;var t=ar();Object.defineProperty(th,"__esModule",{value:!0}),th.default=void 0;var e=t(_r()),n=p;return th.default=(0,e.default)([(0,n.jsx)("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),(0,n.jsx)("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")],"ArticleOutlined"),th}var B5e=F5e();const $5e=Vn(B5e);var nh={},F5;function U5e(){if(F5)return nh;F5=1;var t=ar();Object.defineProperty(nh,"__esModule",{value:!0}),nh.default=void 0;var e=t(_r()),n=p;return nh.default=(0,e.default)((0,n.jsx)("path",{d:"M19 6H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2m0 10H5V8h14z"}),"Crop32Outlined"),nh}var z5e=U5e();const j5e=Vn(z5e);var rh={},B5;function H5e(){if(B5)return rh;B5=1;var t=ar();Object.defineProperty(rh,"__esModule",{value:!0}),rh.default=void 0;var e=t(_r()),n=p;return rh.default=(0,e.default)((0,n.jsx)("path",{d:"M10.27 12h3.46c.93 0 1.63-.83 1.48-1.75l-.3-1.79C14.67 7.04 13.44 6 12 6S9.33 7.04 9.09 8.47l-.3 1.79c-.15.91.55 1.74 1.48 1.74m-8.61-.89c-.13.26-.18.57-.1.88.16.69.76 1.03 1.53 1h1.95c.83 0 1.51-.58 1.51-1.29 0-.14-.03-.27-.07-.4-.01-.03-.01-.05.01-.08.09-.16.14-.34.14-.53 0-.31-.14-.6-.36-.82-.03-.03-.03-.06-.02-.1.07-.2.07-.43.01-.65-.16-.43-.55-.72-.99-.74-.03 0-.05-.01-.07-.03-.17-.21-.48-.35-.83-.35-.3 0-.57.1-.75.26-.03.03-.06.03-.09.02-.14-.06-.3-.09-.46-.09-.65 0-1.18.49-1.24 1.12 0 .02-.01.04-.03.06-.29.26-.46.65-.41 1.05.03.22.12.43.25.6.03.02.03.06.02.09m14.58 2.54c-1.17-.52-2.61-.9-4.24-.9-1.63 0-3.07.39-4.24.9C6.68 14.13 6 15.21 6 16.39V18h12v-1.61c0-1.18-.68-2.26-1.76-2.74m-15.02.93C.48 14.9 0 15.62 0 16.43V18h4.5v-1.61c0-.83.23-1.61.63-2.29-.37-.06-.74-.1-1.13-.1-.99 0-1.93.21-2.78.58m21.56 0c-.85-.37-1.79-.58-2.78-.58-.39 0-.76.04-1.13.1.4.68.63 1.46.63 2.29V18H24v-1.57c0-.81-.48-1.53-1.22-1.85M22 11v-.5c0-1.1-.9-2-2-2h-2c-.42 0-.65.48-.39.81l.7.63c-.19.31-.31.67-.31 1.06 0 1.1.9 2 2 2s2-.9 2-2"}),"Groups2"),rh}var G5e=H5e();const V5e=Vn(G5e);var ih={},$5;function q5e(){if($5)return ih;$5=1;var t=ar();Object.defineProperty(ih,"__esModule",{value:!0}),ih.default=void 0;var e=t(_r()),n=p;return ih.default=(0,e.default)((0,n.jsx)("path",{fillRule:"evenodd",d:"M4 11h16v2H4z"}),"HorizontalRuleOutlined"),ih}var W5e=q5e();const Y5e=Vn(W5e);var ah={},U5;function K5e(){if(U5)return ah;U5=1;var t=ar();Object.defineProperty(ah,"__esModule",{value:!0}),ah.default=void 0;var e=t(_r()),n=p;return ah.default=(0,e.default)((0,n.jsx)("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-4.86 8.86-3 3.87L9 13.14 6 17h12z"}),"ImageOutlined"),ah}var Q5e=K5e();const X5e=Vn(Q5e);var oh={},z5;function J5e(){if(z5)return oh;z5=1;var t=ar();Object.defineProperty(oh,"__esModule",{value:!0}),oh.default=void 0;var e=t(_r()),n=p;return oh.default=(0,e.default)([(0,n.jsx)("path",{d:"M12 22C6.49 22 2 17.51 2 12S6.49 2 12 2s10 4.04 10 9c0 3.31-2.69 6-6 6h-1.77c-.28 0-.5.22-.5.5 0 .12.05.23.13.33.41.47.64 1.06.64 1.67 0 1.38-1.12 2.5-2.5 2.5m0-18c-4.41 0-8 3.59-8 8s3.59 8 8 8c.28 0 .5-.22.5-.5 0-.16-.08-.28-.14-.35-.41-.46-.63-1.05-.63-1.65 0-1.38 1.12-2.5 2.5-2.5H16c2.21 0 4-1.79 4-4 0-3.86-3.59-7-8-7"},"0"),(0,n.jsx)("circle",{cx:"6.5",cy:"11.5",r:"1.5"},"1"),(0,n.jsx)("circle",{cx:"9.5",cy:"7.5",r:"1.5"},"2"),(0,n.jsx)("circle",{cx:"14.5",cy:"7.5",r:"1.5"},"3"),(0,n.jsx)("circle",{cx:"17.5",cy:"11.5",r:"1.5"},"4")],"PaletteOutlined"),oh}var Z5e=J5e();const j5=Vn(Z5e);var sh={},H5;function e9e(){if(H5)return sh;H5=1;var t=ar();Object.defineProperty(sh,"__esModule",{value:!0}),sh.default=void 0;var e=t(_r()),n=p;return sh.default=(0,e.default)((0,n.jsx)("path",{d:"M22 9v6c0 1.1-.9 2-2 2h-1v-2h1V9H4v6h6v2H4c-1.1 0-2-.9-2-2V9c0-1.1.9-2 2-2h16c1.1 0 2 .9 2 2m-7.5 10 1.09-2.41L18 15.5l-2.41-1.09L14.5 12l-1.09 2.41L11 15.5l2.41 1.09zm2.5-5 .62-1.38L19 12l-1.38-.62L17 10l-.62 1.38L15 12l1.38.62zm-2.5 5 1.09-2.41L18 15.5l-2.41-1.09L14.5 12l-1.09 2.41L11 15.5l2.41 1.09zm2.5-5 .62-1.38L19 12l-1.38-.62L17 10l-.62 1.38L15 12l1.38.62z"}),"SmartButtonOutlined"),sh}var t9e=e9e();const n9e=Vn(t9e);var lh={},G5;function r9e(){if(G5)return lh;G5=1;var t=ar();Object.defineProperty(lh,"__esModule",{value:!0}),lh.default=void 0;var e=t(_r()),n=p;return lh.default=(0,e.default)((0,n.jsx)("path",{d:"M3 5v14h18V5zm5.33 12H5V7h3.33zm5.34 0h-3.33V7h3.33zM19 17h-3.33V7H19z"}),"ViewColumnOutlined"),lh}var i9e=r9e();const a9e=Vn(i9e),sX=T.createContext(null),l0=()=>T.useContext(sX),fE=T.memo(function({id:e,isNotClient:n}){const r=X(s=>s.document[e]),i=X(s=>s.document?.root?.data?.theme),a=or(),o=T.useMemo(()=>r?Zv(r,i,a,y_[r.type]):void 0,[r,i,a]);return o?p.jsx(sX.Provider,{value:e,children:p.jsx(U9e,{isNotClient:n,...o,blockId:e})}):(console.warn(`Block ${e} not found`),null)},(t,e)=>t.id===e.id&&t.isNotClient===e.isNotClient),o9e={p:1.5,display:"flex",flexDirection:"column"},s9e={mb:.75,width:"100%",bgcolor:"cadet.200",display:"flex",justifyContent:"center",p:1,border:"1px solid",borderColor:"cadet.300"};function l9e({label:t,icon:e,onClick:n}){return p.jsxs(ht,{sx:o9e,onClick:r=>{r.stopPropagation(),n()},children:[p.jsx(H,{sx:s9e,children:e}),p.jsx(xe,{variant:"body2",children:t})]})}function $h(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}const c9e=[{label:"Text",icon:p.jsx(zW,{}),block:()=>({type:"NotionText",data:{props:{html:""}}})},{label:"Social",icon:p.jsx(iY,{}),block:()=>({type:"SocialMedia",data:{items:[{id:$h(),key:"facebook",label:"Facebook",iconName:"Facebook",theme:"positive",size:"small",sizePx:"24px",url:"https://maildrill-dev.s3.us-east-2.amazonaws.com/icons/Facebook_Positive_24px.png",href:""}],gap:1}})},{label:"Button",icon:p.jsx(dY,{}),block:()=>({type:"Button",data:{props:{text:"Button",size:"medium"},style:{shape:"rectangle"}}})},{label:"Image",icon:p.jsx(oY,{}),block:()=>({type:"Image",data:{props:{url:L1e()||bS,contentAlignment:"middle",size:"fill",touched:!1}}})},{label:"Divider",icon:p.jsx(aY,{}),block:()=>({type:"Divider",data:{}})},{label:"Spacer",icon:p.jsx(HW,{}),block:()=>({type:"Spacer",data:{}})},{label:"Columns",icon:p.jsx(nN,{}),block:()=>({type:"ColumnsContainer",data:{props:{columnsCount:3,columns:[{childrenIds:[]},{childrenIds:[]},{childrenIds:[]}],fixedWidths:[33,34,33],layout:"layout-33-34-33"}}})},{label:"Container",icon:p.jsx(sY,{}),block:()=>({type:"Container",data:{}})}];function lX({anchorEl:t,setAnchorEl:e,onSelect:n}){const r=()=>{e(null)},i=a=>{n(a),e(null)};return t===null?null:p.jsx(pS,{open:!0,anchorEl:t,onClose:r,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},elevation:4,sx:{"& .MuiPaper-root":{borderRadius:"8px"}},children:p.jsx(H,{sx:{p:1,display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr"},children:c9e.map((a,o)=>p.jsx(l9e,{label:a.label,icon:a.icon,onClick:()=>i(a.block())},o))})})}function u9e({buttonElement:t,onClick:e}){const[n,r]=T.useState(!1);return T.useEffect(()=>{function i({clientX:a,clientY:o}){if(!t)return;const s=t.getBoundingClientRect(),l=s.y,c=s.x,u=c+s.width;if(Math.abs(o-l)<20&&c<a&&a<u){r(!0);return}r(!1)}return window.addEventListener("mousemove",i),()=>{window.removeEventListener("mousemove",i)}},[t,r]),p.jsx(uS,{in:n,children:p.jsx(cn,{size:"small",sx:{p:.12,position:"absolute",top:"-12px",left:"50%",transform:"translateX(-10px)",bgcolor:"brand.blue",color:"primary.contrastText",zIndex:"20 !important","&:hover, &:active, &:focus":{bgcolor:"brand.blue",color:"primary.contrastText"}},onClick:i=>{i.stopPropagation(),e()},children:p.jsx(QI,{fontSize:"small"})})})}function d9e({onClick:t}){return p.jsx(si,{onClick:e=>{e.stopPropagation(),t()},sx:{display:"flex",alignContent:"center",justifyContent:"center",height:48,width:"fit-content",maxWidth:"fit-content",mx:"auto"},children:p.jsx(QI,{sx:{p:.12,bgcolor:"brand.blue",borderRadius:24,color:"white"},fontSize:"small"})})}function p9e({onSelect:t,placeholder:e}){const[n,r]=T.useState(null),[i,a]=T.useState(null),o=X(u=>u.selectedMainTab),s=BG(),l=()=>{r(i)},c=()=>e?p.jsx(d9e,{onClick:l}):p.jsx(u9e,{buttonElement:i,onClick:l});return s?null:p.jsxs(p.Fragment,{children:[p.jsx("div",{ref:a,style:{position:"relative",width:"100%",...e?{display:"flex",justifyContent:"center"}:{}},children:o!=="preview"&&c()}),p.jsx(lX,{anchorEl:n,setAnchorEl:r,onSelect:t})]})}function f9e(){return`block-${Date.now()}`}function Cc({childrenIds:t,onChange:e,parentId:n,position:r,isNotClient:i}){const a=T.useCallback(c=>{const u=f9e();e({blockId:u,block:c,childrenIds:[...t||[],u]})},[t,e]),[{isOver:o},s]=FE(()=>({accept:["block",El],drop:(c,u)=>{if(u.getItemType()===El){if(u.didDrop()){u.getDropResult();return}const f=c;if(f.category==="template"){console.warn("[ComponentsLibrary] templates cannot be dropped inline; click the card in the drawer to apply.");return}(async()=>{try{const m=await i0(f.category,f.axis,f.id);sEe(n,m.blocks,r)}catch(m){console.error("[ComponentsLibrary] failed to append saved subtree",m)}})();return}const d=c.blockId;if(u.didDrop()){u.getDropResult();return}return r===void 0?Z1e({parentId:n,blockId:d}):J1e({parentId:n,blockId:d,indexArray:r})},canDrop:(c,u)=>{if(u.getItemType()===El)return!0;const d=c.blockId;return!Id({targetId:n,draggedId:d})&&d!==n},collect:c=>({isOver:c.canDrop()?!!c.isOver():!1})}),[n,r]),l=t&&t.length>0?p.jsx(H,{ref:c=>{s(c)},sx:{minHeight:0,border:o?"2px solid":"",borderColor:o?"secondary.main":void 0},"aria-hidden":!0}):null;return i?t.map(c=>p.jsx(T.Fragment,{children:p.jsx(fE,{id:c,isNotClient:i})},c)):!t||t.length===0?p.jsx(H,{ref:c=>{s(c)},sx:{border:o?"2px solid":"",borderColor:o?"secondary.main":void 0},children:p.jsx(p9e,{placeholder:!0,onSelect:a})}):p.jsxs(p.Fragment,{children:[t.map(c=>p.jsx(T.Fragment,{children:p.jsx(fE,{id:c})},c)),l]})}const m9e=[{childrenIds:[]},{childrenIds:[]},{childrenIds:[]}];function h9e({style:t,props:e,blockId:n,isNotClient:r}){const i=l0(),{columns:a,...o}=e??{},s=a??m9e,l=(c,{block:u,blockId:d,childrenIds:f})=>{const h=X.getState().document[i],g=h?.data?.props?.columns??s,_=h?.data?.props?{...h.data.props}:{...o};delete _.columns;const b=g.length===2?[...g,{childrenIds:[]}]:[...g];b[c]={childrenIds:f};const y={..._,fixedWidths:_.fixedWidths?.length===2?[..._.fixedWidths,null]:_.fixedWidths},E={type:"ColumnsContainer",data:Od.parse({style:h?.data?.style??t,props:{...y,columns:b}})},v={[d]:u,[i]:E};cEe(v),ma(d)};return r?p.jsx(p.Fragment,{children:p.jsx(F2,{blockId:n,props:o,style:t,columns:[p.jsx(Cc,{isNotClient:r,parentId:n,position:0,childrenIds:a?.[0]?.childrenIds,onChange:c=>l(0,c)}),p.jsx(Cc,{isNotClient:r,parentId:n,position:1,childrenIds:a?.[1]?.childrenIds,onChange:c=>l(1,c)}),p.jsx(Cc,{isNotClient:r,parentId:n,position:2,childrenIds:a?.[2]?.childrenIds,onChange:c=>l(2,c)})]})}):p.jsx(U_,{children:p.jsx(F2,{blockId:n,props:o,style:t,columns:[p.jsx(Cc,{parentId:n,position:0,childrenIds:a?.[0]?.childrenIds,onChange:c=>l(0,c)}),p.jsx(Cc,{parentId:n,position:1,childrenIds:a?.[1]?.childrenIds,onChange:c=>l(1,c)}),p.jsx(Cc,{parentId:n,position:2,childrenIds:a?.[2]?.childrenIds,onChange:c=>l(2,c)})]})})}function g9e({childrenIds:t}){return p.jsx(p.Fragment,{children:t.map(e=>p.jsx(T.Fragment,{children:p.jsx(fE,{isNotClient:!0,id:e})},e))})}function _9e({style:t,props:e,blockId:n,isNotClient:r}){const i=e?.childrenIds??[],a=l0();return p.jsx(XY,{style:t,blockId:`${n}`,children:r?p.jsx(g9e,{parentId:n,childrenIds:i,onChange:({block:o,blockId:s,childrenIds:l})=>{e_(a,s,o,l),ma(s)}}):p.jsx(U_,{children:p.jsx(Cc,{parentId:n,childrenIds:i,onChange:({block:o,blockId:s,childrenIds:l})=>{e_(a,s,o,l),ma(s)}})})})}function b9e(t){const e=t.childrenIds??[],n=l0(),r=or();return p.jsx("div",{onClick:()=>{ma(null)},style:{backgroundColor:t.backdropColor??"#F5F5F5",color:t.textColor??"#262626",fontFamily:tm(t?.fontFamily||"OPEN_SANS"),fontSize:"16px",fontWeight:"400",letterSpacing:"0.15008px",lineHeight:"1.5",margin:"0",width:"100%"},children:p.jsx("table",{role:"presentation",align:"center",width:"100%",style:{margin:"0 auto",maxWidth:r==="desktop"?Hv:pG,backgroundColor:t.canvasColor??"#FFFFFF",borderRadius:t.borderRadius??void 0,border:(()=>{const i=t.borderColor;if(i)return`1px solid ${i}`})()},cellSpacing:"0",cellPadding:"0",border:0,children:p.jsx("tbody",{children:p.jsx("tr",{style:{width:"100%"},children:p.jsx("td",{"data-value":"__content",children:p.jsx(U_,{children:p.jsx(Cc,{listEndPolicy:"root",parentId:n,childrenIds:e,onChange:({block:i,blockId:a,childrenIds:o})=>{e_(n,a,i,o),ma(a)}})})})})})})})}var ch={},V5;function y9e(){if(V5)return ch;V5=1;var t=ar();Object.defineProperty(ch,"__esModule",{value:!0}),ch.default=void 0;var e=t(_r()),n=p;return ch.default=(0,e.default)((0,n.jsx)("path",{d:"M17 11v6.97l-5-2.14-5 2.14V5h6V3H7c-1.1 0-2 .9-2 2v16l7-3 7 3V11zm4-4h-2v2h-2V7h-2V5h2V3h2v2h2z"}),"BookmarkAddOutlined"),ch}var v9e=y9e();const E9e=Vn(v9e),S9e=t=>e=>({position:"absolute",...t?{top:"100%",right:0,marginTop:"8px",flexDirection:"row",width:"auto"}:{top:0,right:"-3rem",flexDirection:"column",width:"2.5rem"},borderRadius:"8px!important",zIndex:"90 !important;",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",border:"1px solid",borderColor:e.palette.secondary.main,padding:"1px",display:"flex",alignItems:"center",justifyContent:"center"});let bp=null;function C9e({blockId:t}){const e=MG(t),{t:n}=Ie("inspector"),{t:r}=Ie(),i=IG(),a=NG(),o=i&&a!=="local",[s,l]=T.useState(!1),c=e?.type!=="EmailLayout",u=bp&&bp.blockType===e?.type,d=T.useRef(null),[f,m]=T.useState(!1);T.useEffect(()=>{const y=()=>{if(!d.current)return;const x=d.current.parentElement;if(!x)return;const S=x.getBoundingClientRect(),C=x.closest(".preview-container");if(!C)return;C.getBoundingClientRect().right-S.right<48?m(!0):m(!1)};y(),window.addEventListener("resize",y),window.addEventListener("scroll",y,!0);const E=setTimeout(y,100);return()=>{window.removeEventListener("resize",y),window.removeEventListener("scroll",y,!0),clearTimeout(E)}},[t]);const h=T.useCallback(()=>{const y=X.getState().document,E=X.getState().notionTextInlineEditingBlockId,v=(k,w,D=new Set)=>{if(D.has(k))return;D.add(k);const A=w[k];A&&(A.type==="Container"&&(A.data?.props?.childrenIds||[]).forEach(R=>v(R,w,D)),A.type==="ColumnsContainer"&&(A.data?.props?.columns||[]).forEach(R=>{(R.childrenIds||[]).forEach(I=>v(I,w,D))}))},x=new Set;v(t,y,x),x.add(t);const S=k=>k&&k.filter(w=>!x.has(w)),C={...y};for(const[k,w]of Object.entries(C)){if(x.has(k))continue;const D=w;switch(D.type){case"EmailLayout":C[k]={...D,data:{...D.data,childrenIds:S(D.data.childrenIds)}};break;case"Container":C[k]={...D,data:{...D.data,props:{...D.data.props,childrenIds:S(D.data.props?.childrenIds)}}};break;case"ColumnsContainer":C[k]={...D,data:{...D.data,props:{...D.data.props,columns:D.data.props?.columns?.map(A=>({...A,childrenIds:S(A.childrenIds)}))}}};break;default:C[k]=D}}for(const k of x)delete C[k];E&&(E===t||x.has(E))&&ag(null),Wc(C),ma(null)},[t]),g=T.useCallback(()=>{e&&"style"in e.data&&e.data.style&&(bp={styles:JSON.parse(JSON.stringify(e.data.style)),blockType:e.type})},[e]),_=T.useCallback(()=>{const y=X.getState().document;if(!bp||bp.blockType!==e?.type)return;const E={...y},v=E[t];v&&(E[t]={...v,data:{...v.data,style:JSON.parse(JSON.stringify(bp.styles))}},Wc(E),ma(t))},[t,e]),b=T.useCallback(()=>{iEe(t)},[t]);return p.jsxs(p.Fragment,{children:[p.jsxs(ya,{ref:d,sx:S9e(f),onClick:y=>y.stopPropagation(),elevation:10,children:[p.jsx(Pt,{title:n("actions.copyFormat"),placement:"left-start",children:p.jsx("span",{children:p.jsx(cn,{onClick:g,sx:{padding:"4px",overflow:"hidden",color:"text.primary"},disabled:!(e&&"style"in e.data&&e.data.style),children:p.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p.jsx("path",{d:"M12 22.5C6.49 22.5 2 18.01 2 12.5C2 6.99 6.49 2.5 12 2.5C17.51 2.5 22 6.54 22 11.5C22 14.81 19.31 17.5 16 17.5H14.23C13.95 17.5 13.73 17.72 13.73 18C13.73 18.12 13.78 18.23 13.86 18.33C14.27 18.8 14.5 19.39 14.5 20C14.5 21.38 13.38 22.5 12 22.5ZM12 4.5C7.59 4.5 4 8.09 4 12.5C4 16.91 7.59 20.5 12 20.5C12.28 20.5 12.5 20.28 12.5 20C12.5 19.84 12.42 19.72 12.36 19.65C11.95 19.19 11.73 18.6 11.73 18C11.73 16.62 12.85 15.5 14.23 15.5H16C18.21 15.5 20 13.71 20 11.5C20 7.64 16.41 4.5 12 4.5Z",fill:"currentColor"}),p.jsx("path",{d:"M6.5 13.5C7.32843 13.5 8 12.8284 8 12C8 11.1716 7.32843 10.5 6.5 10.5C5.67157 10.5 5 11.1716 5 12C5 12.8284 5.67157 13.5 6.5 13.5Z",fill:"currentColor"}),p.jsx("path",{d:"M9.5 9.5C10.3284 9.5 11 8.82843 11 8C11 7.17157 10.3284 6.5 9.5 6.5C8.67157 6.5 8 7.17157 8 8C8 8.82843 8.67157 9.5 9.5 9.5Z",fill:"currentColor"}),p.jsx("path",{d:"M14.5 9.5C15.3284 9.5 16 8.82843 16 8C16 7.17157 15.3284 6.5 14.5 6.5C13.6716 6.5 13 7.17157 13 8C13 8.82843 13.6716 9.5 14.5 9.5Z",fill:"currentColor"}),p.jsx("path",{d:"M17.5 13.5C18.3284 13.5 19 12.8284 19 12C19 11.1716 18.3284 10.5 17.5 10.5C16.6716 10.5 16 11.1716 16 12C16 12.8284 16.6716 13.5 17.5 13.5Z",fill:"currentColor"})]})})})}),p.jsx(Pt,{title:n(u?"actions.pasteFormatting":"actions.noFormatSupported"),placement:"left-start",children:p.jsx("span",{children:p.jsx(cn,{onClick:_,sx:{padding:"4px",overflow:"hidden",color:u?"text.primary":"text.disabled"},disabled:!u,children:p.jsx("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:p.jsx("path",{d:"M10.9551 22.6497C10.5139 22.6497 10.1287 22.4888 9.79934 22.167C9.47017 21.8451 9.30559 21.4582 9.30559 21.0062V16.1317H5.54784C5.09367 16.1317 4.69725 15.9624 4.35859 15.6237C4.01992 15.2851 3.85059 14.8886 3.85059 14.4345V7.10448C3.85059 6.07631 4.21 5.19264 4.92884 4.45348C5.6475 3.71431 6.52667 3.34473 7.56634 3.34473H19.2978C19.5378 3.34473 19.7408 3.42773 19.9066 3.59373C20.0726 3.75956 20.1556 3.96248 20.1556 4.20248V14.4345C20.1556 14.8886 19.9871 15.2851 19.6501 15.6237C19.3131 15.9624 18.9138 16.1317 18.4523 16.1317H14.7006V21.0062C14.7006 21.4582 14.536 21.8451 14.2068 22.167C13.8775 22.4888 13.4923 22.6497 13.0511 22.6497H10.9551ZM5.54784 10.6145H18.4523V5.04798H17.0463V8.41773C17.0463 8.63189 16.9744 8.81139 16.8306 8.95623C16.6869 9.10106 16.5063 9.17348 16.2888 9.17348C16.0715 9.17348 15.8924 9.10106 15.7516 8.95623C15.6108 8.81139 15.5403 8.63189 15.5403 8.41773V5.04798H13.7533V6.40148C13.7533 6.61814 13.6815 6.79789 13.5378 6.94073C13.394 7.08373 13.2134 7.15523 12.9961 7.15523C12.7786 7.15523 12.5994 7.08373 12.4586 6.94073C12.3178 6.79789 12.2473 6.61814 12.2473 6.40148V5.04798H7.56634C6.97717 5.04798 6.4935 5.24764 6.11534 5.64698C5.737 6.04631 5.54784 6.53214 5.54784 7.10448V10.6145ZM5.54784 14.4345H18.4523V12.0965H5.54784V14.4345Z",fill:"currentColor"})})})})}),p.jsx(Pt,{title:r("editor.cloneBlock"),placement:"left-start",children:p.jsx(cn,{onClick:b,sx:{padding:"4px",overflow:"hidden",color:"text.primary"},children:p.jsx(Jwe,{sx:{fontSize:"1.25rem"}})})}),p.jsx(Pt,{title:n("actions.delete"),placement:"left-start",children:p.jsx(cn,{onClick:h,sx:{overflow:"hidden",color:"error.main",padding:"4px"},children:p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:p.jsx("path",{d:"M16 9.5V19.5H8V9.5H16ZM14.5 3.5H9.5L8.5 4.5H5V6.5H19V4.5H15.5L14.5 3.5ZM18 7.5H6V19.5C6 20.6 6.9 21.5 8 21.5H16C17.1 21.5 18 20.6 18 19.5V7.5Z",fill:"currentColor"})})})}),o&&p.jsx(Pt,{title:n("componentsLibrary.save.tooltip"),placement:"left-start",children:p.jsx("span",{children:p.jsx(cn,{onClick:()=>l(!0),disabled:!c,sx:{padding:"4px",overflow:"hidden",color:c?"text.primary":"text.disabled"},"aria-label":n("componentsLibrary.save.button"),children:p.jsx(E9e,{sx:{fontSize:"1.25rem"}})})})})]}),o&&s&&c&&p.jsx(H4e,{open:s,rootBlockId:t,onClose:()=>l(!1)})]})}const x9e=T.memo(C9e),q5=150,T9e=25;let Tg=null,mE=null;function UN(){Tg&&(clearTimeout(Tg),Tg=null),mE=null}function W5(t){mE===t&&UN()}function k9e(t,e,n,r){UN(),mE=t,Tg=setTimeout(()=>{Tg=null,mE=null,n()&&(nv(t),r())},e)}function w9e(t){const e=t.closest(".preview-container");if(!e)return q5;let n=0,r=t;for(;r&&e.contains(r)&&(r.hasAttribute("data-block-id")&&(n+=1),r!==e);)r=r.parentElement;return q5+Math.max(0,n-1)*T9e}function D9e(t){const e=W_();return T.useMemo(()=>e?Id({draggedId:t,targetId:e}):!1,[t,e])}function A9e(t){if(!t||typeof t.nodeType!="number")return null;const e=t,n=e.closest?.(".preview-container");if(!n)return null;const r=e.closest?.("[data-block-id]"),i=r?.getAttribute("data-block-id")??null;return!i||!r||!n.contains(r)?null:i}function O9e({children:t,canEdit:e=!0,isNotClient:n=!1}){const r=l0(),{t:i}=Ie(),a=m1e(),o=f1e(r),s=p1e(r),l=eI(),c=W_(),u=h1e();g1e();const d=D9e(r),[f,m]=T.useState(!1),[h,g]=T.useState(0),_=T.useRef(null),b=T.useRef(null),[y,E]=T.useState(null),v=sn(),x=BG(),[S,C]=T.useState(null),k=c===r||d,w=u===r,D=v.palette.primary.light||v.palette.primary.main,A=T.useRef(null),M=T.useRef(!0);if(n)return p.jsxs(p.Fragment,{children:[p.jsx("div",{style:{width:"100%"}}),p.jsx(H,{sx:{position:"relative",maxWidth:"100%"},children:p.jsx("div",{children:t})}),p.jsx("div",{style:{width:"100%"}})]});let R,I;w&&e?(R=`2px solid ${D}`,I="10"):o&&e?(R=`2px solid ${v.palette.secondary.main}`,I="1"):f&&e?R=`2px dotted ${v.palette.secondary.main}`:I="auto";const P=()=>!o||!e?null:p.jsx(x9e,{blockId:r}),L=te=>{const Q=te.getClientOffset(),V=_.current?.getBoundingClientRect(),K=b.current?.getBoundingClientRect();if(!Q||!V||!K)return null;const le=Math.abs(Q.y-V.y),he=Math.abs(Q.y-K.y);return le<he?"up":"down"},[{isOver:B},F]=FE(()=>({accept:["block",El],drop:(te,Q)=>{if(Q.getItemType()===El){if(Q.didDrop()){Q.getDropResult();return}const ve=te;if(ve.category==="template"){console.warn("[ComponentsLibrary] templates cannot be dropped inline; click the card in the drawer to apply.");return}const me=L(Q)==="up"?"before":"after";(async()=>{try{const Ee=await i0(ve.category,ve.axis,ve.id);me==="after"?aEe(r,Ee.blocks):oEe(r,Ee.blocks)}catch(Ee){console.error("[ComponentsLibrary] failed to insert saved subtree",Ee)}})();return}const K=r,le=te.blockId;if(K===le)return;if(Q.didDrop()){Q.getDropResult();return}const he=L(Q);if(he)Zg(K,le,he);else{Zg(K,le,"down");return}},canDrop:(te,Q)=>Q.getItemType()===El?!0:!Id({targetId:r,draggedId:te.blockId}),collect:te=>({isOver:te.canDrop()?te.isOver({shallow:!0}):!1}),hover:(te,Q)=>{if(Q.getItemType()===El){if(!Q.canDrop()||!Q.isOver({shallow:!0})){E(null);return}const K=L(Q);E(K??null);return}if(te.blockId===r){E(null);return}if(!Q.canDrop()||!Q.isOver({shallow:!0})){E(null);return}const V=L(Q);if(!V){E(null);return}E(V)},end:()=>{E(null)}}));T.useEffect(()=>{B||E(null)},[B]);const q=()=>p.jsxs("div",{style:{height:"3px",background:v.palette.secondary.main,position:"relative",color:v.palette.secondary.main},children:[p.jsx("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:p.jsx("path",{fill:"currentColor",d:"M28 12H10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2M10 4v6h18V4zm18 26H10a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2m-18-8v6h18v-6zm-1-6l-5.586-5.586L2 11.828L6.172 16L2 20.172l1.414 1.414z"})}),p.jsx("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:p.jsx("path",{fill:"currentColor",d:"M28 12H10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2M10 4v6h18V4zm18 26H10a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2m-18-8v6h18v-6zm-1-6l-5.586-5.586L2 11.828L6.172 16L2 20.172l1.414 1.414z"})})]}),oe=LE(()=>({type:"block",item:()=>{const te=X.getState().notionTextInlineEditingBlockId;return te&&window.dispatchEvent(new CustomEvent("notion-text-force-save",{detail:{blockId:te}})),{blockId:r}},canDrag:!k,collect:te=>({borderDrag:te.isDragging()?"2px dotted yellow":"",isDragging:te.isDragging()}),end:()=>{g(Date.now())}}),[k,r]),[{borderDrag:G="",isDragging:Y},be]=oe||[{borderDrag:"",isDragging:!1},T.useRef(null)],ee=e&&l!=="preview"&&!k&&!x&&(Y||a===r||a==null&&o);T.useEffect(()=>(M.current=!0,()=>{M.current=!1,W5(r),A.current&&(clearTimeout(A.current),A.current=null),X.getState().canvasHoveredBlockId===r&&nv(null)}),[r]);const fe=te=>{const Q=Date.now()-h;if(!(Y||h>0&&Q<200)&&(te.stopPropagation(),l!=="preview")){if(s==="NotionText"){const V=new CustomEvent("email-builder-highlight-editor",{detail:!0});window.dispatchEvent(V)}ma(r)}},re=T.useMemo(()=>T.cloneElement(t,{onClick:te=>{t.props.onClick&&t.props.onClick(te),!te.defaultPrevented&&!te.isPropagationStopped()&&(Y||fe(te))},onMouseDown:te=>{t.props.onMouseDown&&t.props.onMouseDown(te)},onMouseUp:te=>{t.props.onMouseUp&&t.props.onMouseUp(te)}}),[t,Y,r,s,l]);return p.jsxs(p.Fragment,{children:[y==="up"&&p.jsx(q,{}),p.jsx("div",{ref:_,style:{width:"100%"}}),p.jsx(H,{"data-block-id":r,sx:{position:"relative",maxWidth:"100%"},ref:F,onMouseEnter:te=>{te.stopPropagation(),UN(),A.current&&(clearTimeout(A.current),A.current=null);const Q=w9e(te.currentTarget);k9e(r,Q,()=>M.current,()=>m(!0))},onMouseLeave:te=>{W5(r),A.current&&clearTimeout(A.current);const Q=te.relatedTarget;A.current=setTimeout(()=>{if(m(!1),X.getState().canvasHoveredBlockId!==r)return;const V=A9e(Q);nv(V&&V!==r?V:null)},150)},onClick:fe,children:p.jsxs(H,{sx:{position:"relative",maxWidth:"100%",outlineOffset:"-1px",outline:R,zIndex:I,transition:"outline 0.2s ease-in-out, z-index 0.2s ease-in-out"},children:[P(),ee?p.jsx(H,{sx:{position:"absolute",left:"50%",top:-20,transform:"translateX(-50%)",zIndex:10,display:"flex",flexDirection:"row",alignItems:"center",borderRadius:"6px 6px 0 0",overflow:"hidden",backgroundColor:w&&e?D:v.palette.secondary.main},children:p.jsx(Pt,{title:i("editor.dragBlockHandle"),placement:"top",children:p.jsx(cn,{ref:be,type:"button","aria-label":i("editor.dragBlockHandle"),size:"small",onClick:te=>te.stopPropagation(),sx:{padding:"3px 6px",rotate:"90deg",borderRadius:0,color:"white",cursor:Y?"grabbing":"grab","&:hover":{backgroundColor:"rgba(255,255,255,0.15)"}},children:p.jsx(GW,{sx:{fontSize:15}})})})}):null,p.jsx(lX,{anchorEl:S,setAnchorEl:C,onSelect:te=>{const Q=lEe(r,te);Q&&ma(Q),C(null)}}),p.jsx(uS,{in:w&&e,timeout:200,children:p.jsx(sa,{label:i("editor.editing"),icon:p.jsx(VW,{}),size:"small",sx:{position:"absolute",left:-1,top:-26,backgroundColor:D,color:"white",fontWeight:600,fontSize:"0.75rem",zIndex:-1,boxShadow:"0 2px 8px rgba(0,0,0,0.15)","& .MuiChip-icon":{color:"white",fontSize:"1rem"}}})}),p.jsx("div",{style:{border:G},children:re}),ee?p.jsx(H,{sx:{position:"absolute",left:"50%",bottom:-10,transform:"translateX(-50%)",zIndex:10,width:20,height:20,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:w&&e?D:v.palette.secondary.main},children:p.jsx(Pt,{title:i("editor.addBlockAtEnd"),placement:"bottom",children:p.jsx(cn,{type:"button",onClick:te=>{te.stopPropagation(),C(te.currentTarget)},sx:{padding:0,width:20,height:20,minWidth:20,borderRadius:"50%",color:"white","&:hover":{backgroundColor:"rgba(255,255,255,0.15)"}},children:p.jsx(UW,{sx:{fontSize:18}})})})}):null]})}),y==="down"&&p.jsx(q,{}),p.jsx("div",{ref:b,style:{width:"100%"}})]})}const lc=T.memo(O9e,(t,e)=>t.children===e.children&&t.canEdit===e.canEdit&&t.isNotClient===e.isNotClient),R9e=T.memo(KY),I9e=t=>{const e=or(),n=Y_();return p.jsx(R9e,{...t,selectedScreenSize:e,disableEdition:n})},N9e=T.memo(qY),P9e=T.memo(_9e),M9e=T.memo(h9e),L9e=T.memo(YY),F9e=T.memo(jOe),B9e=T.memo(QY),$9e=T.memo(WY),cX={SocialMedia:{schema:_N,Component:t=>p.jsx(lc,{isNotClient:t.isNotClient,children:p.jsx(I9e,{...t})})},Button:{schema:z_,Component:t=>p.jsx(lc,{isNotClient:t.isNotClient,children:p.jsx(N9e,{...t})})},Container:{schema:j_,Component:t=>p.jsx(lc,{isNotClient:t.isNotClient,children:p.jsx(P9e,{...t})})},ColumnsContainer:{schema:Od,Component:t=>p.jsx(lc,{isNotClient:t.isNotClient,children:p.jsx(M9e,{...t})})},Image:{schema:Jf,Component:t=>{const e={...t,props:{...t.props,url:t.props?.url??"https://placehold.co/600x400@2x/F8F8F8/CCC?text=Your%20image"}};return p.jsx(lc,{isNotClient:t.isNotClient,children:p.jsx(L9e,{...e})})}},NotionText:{schema:_S,Component:t=>p.jsx(lc,{isNotClient:t.isNotClient,children:p.jsx(F9e,{blockId:t.blockId??"",...t})})},EmailLayout:{schema:gS,Component:t=>p.jsx(b9e,{...t})},Spacer:{schema:G_,Component:t=>p.jsx(lc,{isNotClient:t.isNotClient,children:p.jsx(B9e,{...t})})},Divider:{schema:H_,Component:t=>p.jsx(lc,{isNotClient:t.isNotClient,children:p.jsx($9e,{...t})})}},U9e=gG(cX),y_=Object.fromEntries(Object.entries(cX).map(([t,e])=>[t,rg(e.schema)??{}])),uX=({tabs:t,defaultTab:e})=>{const n=T.useMemo(()=>t.filter(o=>o.visible),[t]),[r,i]=T.useState(null);if(T.useEffect(()=>{if(r&&n.some(s=>s.key===r))return;const o=e&&n.some(s=>s.key===e)?e:n[0]?.key??null;i(o)},[n,e,r]),n.length===0)return null;if(n.length===1)return p.jsx(H,{children:n[0].render()});const a=n.find(o=>o.key===r)??n[0];return p.jsxs(H,{children:[p.jsx(fS,{value:a.key,onChange:(o,s)=>i(s),variant:"scrollable",scrollButtons:!1,sx:{minHeight:34,mb:1.5,borderBottom:1,borderColor:"divider","& .MuiTabs-flexContainer":{gap:0},"& .MuiTab-root":{minHeight:34,minWidth:0,px:1.25,py:.5,fontSize:"0.72rem",fontWeight:500,textTransform:"none",color:"text.secondary","&.Mui-selected":{color:"primary.main"}}},children:n.map(o=>p.jsx(hs,{value:o.key,label:o.label,disableRipple:!0},o.key))}),p.jsx(H,{children:a.render()})]})},z9e={EmailLayout:{label:"Email",iconName:"DashboardOutlined"},NotionText:{label:"Text",iconName:"ArticleOutlined"},SocialMedia:{label:"Social",iconName:"Groups2"},Button:{label:"Button",iconName:"SmartButtonOutlined"},Image:{label:"Image",iconName:"ImageOutlined"},Divider:{label:"Divider",iconName:"HorizontalRuleOutlined"},Spacer:{label:"Spacer",iconName:"Crop32Outlined"},ColumnsContainer:{label:"Columns",iconName:"ViewColumnOutlined"},Container:{label:"Container",iconName:"LibraryAddOutlined"},Html:{label:"HTML",iconName:"CodeOutlined"}},j9e=t=>e=>e.document[t];function H9e(t){if(!t)return[];switch(t.type){case"EmailLayout":return t.data?.childrenIds||[];case"Container":return t.data?.props?.childrenIds||[];case"ColumnsContainer":return t.data?.props?.columns?.flatMap(e=>e.childrenIds||[])||[];default:return[]}}function dX(t,e,n){const r=H9e(t[e]);for(const i of r)if(i===n||dX(t,i,n))return!0;return!1}function G9e(t,e,n,r){if(!r)return!1;const i=t[e];if(!i||i.type!=="ColumnsContainer")return!1;const a=i.data?.props?.columns?.[n]?.childrenIds||[];for(const o of a)if(o===r||dX(t,o,r))return!0;return!1}function V9e(t){const e=t.document;if(!e||!e.root)return null;function n(i,a){const o=a.document[i];if(!o)return[];switch(o.type){case"EmailLayout":return o.data?.childrenIds||[];case"Container":return o.data?.props?.childrenIds||[];case"ColumnsContainer":return o.data?.props?.columns?.flatMap(s=>s.childrenIds||[])||[];default:return[]}}function r(i,a,o){const s=o.document[i],l=s?.type??"Unknown",c=z9e[l]??{label:l,iconName:"WidgetsOutlined"};if(l==="ColumnsContainer"){const f=s.data?.props?.columns,h=s.data?.props?.columnsCount===2?2:3,g=[];for(let _=0;_<h;_++){const b=f?.[_]?.childrenIds??[],y=Zve(i,_);g.push({blockId:y,type:"ColumnSlot",label:"",iconName:"WidgetsOutlined",children:b.map(E=>r(E,a+2,o)),depth:a+1,columnSlot:{parentBlockId:i,columnIndex:_,columnsCount:h}})}return{blockId:i,type:l,label:c.label,iconName:c.iconName,children:g,depth:a}}const d=n(i,o).map(f=>r(f,a+1,o));return{blockId:i,type:l,label:c.label,iconName:c.iconName,children:d,depth:a}}return r("root",0,t)}function q9e(t){return X(t)}function pX(t){return X(j9e(t))}const zN=VR(()=>({credits:{}}));function W9e(t,e){zN.setState(n=>({credits:{...n.credits,[t]:e}}))}function jp(t){zN.setState(e=>{const{[t]:n,...r}=e.credits;return{credits:r}})}function Y9e(t){return zN(e=>t?e.credits[t]??null:null)}const K9e=350,Q9e=20,X9e=10,J9e=["any","landscape","portrait","squarish"],Ii={query:"",orientation:"any",photos:[],page:0,totalPages:0,selectedPhoto:null},fX=({backendUrl:t,blockId:e,source:n})=>{const{t:r}=Ie("inspector"),i=T.useMemo(()=>zr(t),[t]),[a,o]=T.useState(e??null),[s,l]=T.useState(null),[c,u]=T.useState(n??"image");T.useEffect(()=>{e!=null&&o(e)},[e]),T.useEffect(()=>{n!=null&&u(n)},[n]);const[d,f]=T.useState(Ii.query),[m,h]=T.useState(Ii.orientation),[g,_]=T.useState(Ii.photos),[b,y]=T.useState(Ii.page),[E,v]=T.useState(Ii.totalPages),[x,S]=T.useState(null),[,C]=T.useState(Ii.selectedPhoto),[k,w]=T.useState(!1),[D,A]=T.useState(null),M=T.useRef(null);T.useEffect(()=>{const B=F=>{const{detail:q}=F;o(q.blockId),l(q.currentImageUrl),u(q.source??"image")};return window.addEventListener("email-builder-image-panel-opened",B),()=>window.removeEventListener("email-builder-image-panel-opened",B)},[]);const R=T.useCallback(async(B,F,q,oe)=>{M.current?.abort();const G=new AbortController;M.current=G,w(!0),A(null);try{const Y=await dEe(i,{query:B,page:q,perPage:Q9e,orientation:F==="any"?void 0:F,signal:G.signal});S(Y.rateLimitRemaining),v(Y.totalPages),y(q),_(be=>{const ee=oe?[...be,...Y.results]:Y.results;return Ii.photos=ee,Ii.page=q,Ii.totalPages=Y.totalPages,ee})}catch(Y){if(Y?.name==="AbortError")return;A(Y instanceof Mu?Y.kind:"unknown"),oe||_([])}finally{M.current===G&&(w(!1),M.current=null)}},[i]);T.useEffect(()=>{Ii.query=d,Ii.orientation=m;const B=d.trim();if(B.length===0){M.current?.abort(),_([]),y(0),v(0),A(null),Ii.photos=[],Ii.page=0,Ii.totalPages=0;return}const F=window.setTimeout(()=>{R(B,m,1,!1)},K9e);return()=>window.clearTimeout(F)},[d,m,R]),T.useEffect(()=>()=>M.current?.abort(),[]);const I=b>0&&b<E&&!k,P=()=>{const B=d.trim();!B||!I||R(B,m,b+1,!0)},L=B=>{if(!a)return;const F=pEe(B);c==="image"?Bh(a,{url:F,alt:B.attribution}):window.dispatchEvent(new CustomEvent("email-builder-set-image",{detail:{url:F}})),C(B),Ii.selectedPhoto=B,W9e(a,{photoId:B.id,photographerName:B.user.name,photographerUrl:B.user.profileUrl,unsplashUrl:B.unsplashUrl}),YG(i,B.links.downloadLocation)};return p.jsxs(H,{children:[p.jsxs(qe,{direction:"row",alignItems:"center",gap:1,sx:{mb:1},children:[p.jsx(Ir,{fullWidth:!0,size:"small",placeholder:r("inputs.unsplash.searchPlaceholder"),value:d,onChange:B=>f(B.target.value),InputProps:{startAdornment:p.jsx(tG,{position:"start",children:p.jsx(kDe,{fontSize:"small",sx:{color:"text.secondary"}})})}}),x!==null&&x<=X9e&&p.jsx(sa,{label:r("inputs.unsplash.quotaLow",{remaining:x}),size:"small",color:"warning",variant:"outlined"})]}),p.jsx(fS,{value:m,onChange:(B,F)=>h(F),variant:"scrollable",scrollButtons:!1,sx:{minHeight:30,mb:1.5,"& .MuiTabs-flexContainer":{gap:0},"& .MuiTabs-scroller":{pl:0},"& .MuiTab-root":{minHeight:30,minWidth:0,px:1,py:.25,fontSize:"0.7rem",textTransform:"none",color:"text.secondary","&.Mui-selected":{color:"primary.main"}},"& .MuiTab-root:first-of-type":{pl:0}},children:J9e.map(B=>p.jsx(hs,{value:B,label:r(`inputs.unsplash.orientation.${B}`),disableRipple:!0},B))}),D&&p.jsx($n,{severity:D==="not_configured"?"warning":"error",sx:{mb:1.5,fontSize:"0.75rem"},children:r(`inputs.unsplash.error.${D}`)}),k&&g.length===0&&p.jsx(H,{sx:{display:"flex",justifyContent:"center",py:3},children:p.jsx(ti,{size:22})}),!k&&!D&&g.length===0&&d.trim().length===0&&p.jsx(H,{sx:{textAlign:"center",py:3},children:p.jsx(xe,{variant:"caption",color:"text.secondary",children:r("inputs.unsplash.emptyInitial")})}),!k&&!D&&g.length===0&&d.trim().length>0&&p.jsx(H,{sx:{textAlign:"center",py:3},children:p.jsx(xe,{variant:"caption",color:"text.secondary",children:r("inputs.unsplash.emptyNoResults",{query:d.trim()})})}),g.length>0&&p.jsx(H,{sx:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:1,maxHeight:380,overflowY:"auto"},children:g.map(B=>{const F=s?.includes(B.id)??!1;return p.jsx(Z9e,{photo:B,selected:F,onPick:()=>L(B)},B.id)})}),I&&p.jsx(H,{sx:{textAlign:"center",mt:2},children:p.jsx(ld,{component:"button",variant:"caption",onClick:P,sx:{cursor:"pointer"},children:r("inputs.unsplash.loadMore")})}),p.jsxs(xe,{variant:"caption",sx:{display:"block",mt:1.5,color:"text.secondary",textAlign:"center",fontSize:"0.65rem"},children:[r("inputs.unsplash.poweredBy")," ",p.jsx(ld,{href:"https://unsplash.com/?utm_source=email-builder-online&utm_medium=referral",target:"_blank",rel:"noreferrer noopener",underline:"hover",color:"inherit",children:"Unsplash"})]})]})},Z9e=({photo:t,selected:e,onPick:n})=>{const{t:r}=Ie("inspector"),i=t.color??void 0;return p.jsxs(H,{sx:{borderRadius:1,overflow:"hidden",border:"2px solid",borderColor:e?"primary.main":"divider",cursor:"pointer",backgroundColor:i??"action.hover",transition:"border-color 0.15s ease","&:hover":{borderColor:"primary.light"}},children:[p.jsx(H,{sx:{position:"relative",aspectRatio:"1",overflow:"hidden"},children:p.jsx("img",{src:t.urls.thumb,alt:t.alt,loading:"lazy",onClick:n,style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})}),p.jsx(H,{sx:{px:.75,py:.5,fontSize:"0.6rem",lineHeight:1.3,bgcolor:"#1a1a1a",color:"#ccc",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:p.jsx(G7,{t:r,i18nKey:"inputs.unsplash.creditLine",values:{author:t.user.name},components:{authorLink:p.jsx(ld,{href:t.user.profileUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",onClick:a=>a.stopPropagation(),sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}}),unsplashLink:p.jsx(ld,{href:t.unsplashUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",onClick:a=>a.stopPropagation(),sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}})}})})]})};function e$e({onClick:t,disabled:e,primary:n=!1}){const{t:r}=Ie("inspector");return p.jsx(cn,{"aria-label":r("inputs.common.close"),onClick:t,disabled:e,sx:{position:"absolute",right:8,top:8,color:i=>n?"brand.blue":i.palette.grey[500],"&:hover":{opacity:.8}},children:p.jsx(tb,{})})}function t$e({imageUrl:t,saving:e=!1}){return p.jsxs(LR,{sx:{position:"relative"},children:[e&&p.jsx(qe,{justifyContent:"center",alignItems:"center",sx:{position:"absolute",top:7,left:0,width:"100%",height:"314px",zIndex:20,backgroundColor:"#212121AA",mb:1},children:p.jsx(ti,{size:48,thickness:6,color:"inherit",sx:{color:"white"}})}),p.jsx(Qfe,{component:"img",sx:{objectFit:"contain",width:"100%",height:"326px"},image:t,alt:"Generated Image"})]})}function n$e({value:t,onChange:e,disabled:n}){return p.jsxs(p.Fragment,{children:[p.jsx(xe,{sx:{fontSize:"14px",fontWeight:700},children:"Image description"}),p.jsx(Ir,{disabled:n,autoFocus:!0,margin:"dense",id:"prompt",placeholder:"Enter a detailed description here...",type:"text",fullWidth:!0,multiline:!0,rows:4,variant:"outlined",value:t,onChange:r=>e(r.target.value),sx:{mt:.5,"& .MuiOutlinedInput-root":{borderRadius:"8px"}}})]})}const r$e=t=>({400:{code:400,title:t.title||"Invalid Request",message:t.message||"The request was invalid. Please check your input and try again.",action:t.action||"Modify your prompt and try again"},401:{code:401,title:t.title||"Authentication Required",message:t.message||"You need to be authenticated to perform this action.",action:t.action||"Please log in and try again"},403:{code:403,title:t.title||"Access Denied",message:t.message||"You don't have permission to perform this action.",action:t.action||"Contact support if you believe this is a mistake"},404:{code:404,title:t.title||"Not Found",message:t.message||"The requested resource was not found.",action:t.action||"Try again or use a different prompt"},422:{code:422,title:t.title||"Invalid Input",message:t.message||"The provided input cannot be processed.",action:t.action||"Modify your prompt and try again"},429:{code:429,title:t.title||"Too Many Requests",message:t.message||"You've made too many requests. Please wait a moment.",action:t.action||"Please wait a few minutes before trying again"},500:{code:500,title:t.title||"Server Error",message:t.message||"An unexpected error occurred on our servers.",action:t.action||"Please try again later"},502:{code:502,title:t.title||"Bad Gateway",message:t.message||"The server received an invalid response.",action:t.action||"Please try again later"},503:{code:503,title:t.title||"Service Unavailable",message:t.message||"The service is temporarily unavailable.",action:t.action||"Please try again later"}})[t.code]||{code:t.code,title:"Unexpected Error",message:"An unexpected error occurred.",action:"Please try again later"};function mX({src:t,style:e}){const{t:n}=Ie("inspector"),[r,i]=T.useState(!1),[a,o]=T.useState(!1),[s,l]=T.useState(""),[c,u]=T.useState(null),[d,f]=T.useState(!1),[m,h]=T.useState(null),[g,_]=T.useState(!1),[b,y]=T.useState(0),[E,v]=T.useState(0),x=T.useRef(null),S=[n("inputs.aiImageGeneration.loadingStep1"),n("inputs.aiImageGeneration.loadingStep2"),n("inputs.aiImageGeneration.loadingStep3"),n("inputs.aiImageGeneration.loadingStep4")],C=T.useCallback(()=>{y(0),v(0),x.current&&clearInterval(x.current);const I=6e4,P=100;let L=0;x.current=setInterval(()=>{L+=P,y(Math.min(L/I*95,95)),v(Math.min(Math.floor(L/I*S.length),S.length-1)),L>=I&&x.current&&clearInterval(x.current)},P)},[S.length]),k=T.useCallback(()=>{x.current&&(clearInterval(x.current),x.current=null),y(100)},[]),w=()=>{i(!0),h(null)},D=()=>{a||(i(!1),o(!1),u(null),l(""),f(!1),h(null),_(!1),k())},A=()=>{const I=c&&!d?"store-ai-image":"request-ai-image",P=c&&!d?c:s;h(null),I==="store-ai-image"?(_(!0),o(!1),setTimeout(()=>{o(!1),D()},2e3)):(o(!0),C()),window.dispatchEvent(new CustomEvent(I,{detail:P}))},M=()=>{f(!0),u(null),h(null),_(!1)};T.useEffect(()=>{const I=P=>{const{detail:L}=P;if(k(),o(!1),L.error){h(r$e(L.error));return}if(!L.success||!L.url){h({code:0,title:"Generation Failed",message:"Failed to generate the image.",action:"Please try again"});return}u(L.url),f(!1)};return window.addEventListener("generated-image",I),()=>{window.removeEventListener("generated-image",I)}},[]),T.useEffect(()=>{D()},[t]);const R=!c||d;return p.jsxs(p.Fragment,{children:[p.jsx(ht,{style:e,startIcon:p.jsx(ro,{className:"w-4 h-4"}),variant:"contained",onClick:w,children:n("inputs.aiImageGeneration.generate")}),p.jsx(Is,{open:r,onClose:D,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{bgcolor:"background.paper",color:"text.primary",borderRadius:"8px"}},children:p.jsxs("form",{onSubmit:I=>{I.preventDefault(),A()},children:[p.jsxs(Ms,{sx:{fontWeight:700,fontSize:"24px",color:m?"error.main":"inherit"},children:[n(m?"inputs.aiImageGeneration.titleError":a?"inputs.aiImageGeneration.titleLoading":c?"inputs.aiImageGeneration.titleReady":"inputs.aiImageGeneration.titleCreate"),p.jsx(e$e,{onClick:D,disabled:a,primary:!0})]}),p.jsxs(Ps,{children:[p.jsx(ihe,{sx:{pb:1,color:m?"error.dark":"inherit"},children:n(m?"inputs.aiImageGeneration.descriptionError":a?"inputs.aiImageGeneration.descriptionLoading":R?"inputs.aiImageGeneration.descriptionCreate":"inputs.aiImageGeneration.descriptionReady")}),c&&!d?p.jsxs(qe,{sx:{position:"relative"},children:[p.jsx(t$e,{imageUrl:c,saving:g}),p.jsxs($n,{variant:"outlined",severity:"warning",icon:!1,children:[n("inputs.aiImageGeneration.warningRegenerate")," ",p.jsx("b",{children:n("inputs.aiImageGeneration.warningInsertFirst")})," ",n("inputs.aiImageGeneration.warningFirst")]})]}):a&&!c?p.jsxs(qe,{justifyContent:"center",alignItems:"center",spacing:2,sx:{backgroundColor:I=>I.palette.mainColor?.[50]??I.palette.action.hover,height:"326px",width:"100%",borderRadius:"8px"},children:[p.jsx(ro,{sx:{fontSize:48,color:"primary.main",animation:"pulse 1.5s ease-in-out infinite","@keyframes pulse":{"0%, 100%":{opacity:.4,transform:"scale(1)"},"50%":{opacity:1,transform:"scale(1.15)"}}}}),p.jsx(xe,{variant:"body2",sx:{color:"text.secondary",fontWeight:500,transition:"opacity 0.3s"},children:S[E]}),p.jsx(UR,{variant:"determinate",value:b,sx:{width:"60%",borderRadius:4,height:6}})]}):p.jsx(n$e,{value:s,onChange:l,disabled:a})]}),!a&&p.jsxs(Ns,{className:"p-6",children:[c&&!d&&p.jsx(ht,{startIcon:p.jsx(uY,{className:"w-4 h-4"}),onClick:M,variant:"outlined",disabled:a,children:n("inputs.aiImageGeneration.regenerate")}),!c&&!d&&p.jsx(ht,{onClick:D,variant:"text",disabled:d,children:n("inputs.aiImageGeneration.cancel")}),p.jsxs(ht,{startIcon:c&&!d?p.jsx(Bwe,{className:"w-4 h-4"}):p.jsx(ro,{className:"w-4 h-4"}),onClick:A,variant:"contained",disabled:!s||s?.length<20,children:[n(c&&!d?"inputs.aiImageGeneration.insertImage":"inputs.aiImageGeneration.generateImage"),a&&p.jsx(ti,{size:16,className:"ml-2"})]})]})]})})]})}const Qr=({children:t})=>p.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.3rem"},children:t}),hX=({imageUrl:t,alt:e="",blockId:n,onRemove:r})=>{const{t:i}=Ie("inspector"),a=Y9e(n??null);return t?p.jsxs(H,{sx:{position:"relative",mb:1.5,borderRadius:1,overflow:"hidden",border:"1px solid",borderColor:"divider"},children:[p.jsx("img",{src:t,alt:e,style:{width:"100%",display:"block",maxHeight:140,objectFit:"cover"}}),r&&p.jsx(cn,{"aria-label":i("inputs.common.close"),onClick:r,size:"small",sx:{position:"absolute",top:4,right:4,backgroundColor:"background.paper",color:"error.main",width:28,height:28,"&:hover":{backgroundColor:"error.50"}},children:p.jsx(tb,{fontSize:"small"})}),a&&p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:.5,px:1,py:.5,bgcolor:"#1a1a1a",color:"#ccc",fontSize:"0.65rem"},children:[p.jsx(Wwe,{sx:{fontSize:"0.8rem",flexShrink:0,color:"#ccc"}}),p.jsx(G7,{t:i,i18nKey:"inputs.unsplash.creditLine",values:{author:a.photographerName},components:{authorLink:p.jsx(ld,{href:a.photographerUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}}),unsplashLink:p.jsx(ld,{href:a.unsplashUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}})}})]})]}):null},i$e=["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"],cl={style:{color:"currentColor"},width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ul={stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"},Y5=p.jsx("svg",{...cl,children:p.jsx("path",{d:"M2.40039 5.20039V2.40039M2.40039 2.40039H5.20039M2.40039 2.40039L5.90039 5.90039M13.6004 5.20039V2.40039M13.6004 2.40039H10.8004M13.6004 2.40039L10.1004 5.90039M2.40039 10.8004V13.6004M2.40039 13.6004H5.20039M2.40039 13.6004L5.90039 10.1004M13.6004 13.6004L10.1004 10.1004M13.6004 13.6004V10.8004M13.6004 13.6004H10.8004",...ul})});function hE(t){switch(t){case"top left":return p.jsx("svg",{...cl,children:p.jsx("path",{d:"M5.26523 9.79159L5.17094 5.17183M5.17094 5.17183L9.79071 5.26611M5.17094 5.17183L10.8278 10.8287",...ul})});case"top center":return p.jsx("svg",{...cl,children:p.jsx("path",{d:"M4.7998 7.33333L7.9998 4M7.9998 4L11.1998 7.33333M7.9998 4V12",...ul})});case"top right":return p.jsx("svg",{...cl,children:p.jsx("path",{d:"M6.20841 5.2662L10.8282 5.17192M10.8282 5.17192L10.7339 9.79169M10.8282 5.17192L5.17132 10.8288",...ul})});case"center left":return p.jsx("svg",{...cl,children:p.jsx("path",{d:"M7.33333 11.2002L4 8.00019M4 8.00019L7.33333 4.8002M4 8.00019L12 8.0002",...ul})});case"center":case"center center":return Y5;case"center right":return p.jsx("svg",{...cl,children:p.jsx("path",{d:"M8.66667 4.7998L12 7.9998M12 7.9998L8.66667 11.1998M12 7.9998L4 7.9998",...ul})});case"bottom left":return p.jsx("svg",{...cl,children:p.jsx("path",{d:"M9.79062 10.7348L5.17085 10.8291M5.17085 10.8291L5.26513 6.20929M5.17085 10.8291L10.8277 5.1722",...ul})});case"bottom center":return p.jsx("svg",{...cl,children:p.jsx("path",{d:"M11.1998 8.66667L7.9998 12M7.9998 12L4.7998 8.66667M7.9998 12L7.99981 4",...ul})});case"bottom right":return p.jsx("svg",{...cl,children:p.jsx("path",{d:"M10.7338 6.20938L10.8281 10.8291M10.8281 10.8291L6.20831 10.7349M10.8281 10.8291L5.17122 5.17229",...ul})});default:return Y5}}function gE(t){switch(t){case"top left":return"topLeft";case"top center":return"topCenter";case"top right":return"topRight";case"center left":return"centerLeft";case"center":case"center center":return"center";case"center right":return"centerRight";case"bottom left":return"bottomLeft";case"bottom center":return"bottomCenter";case"bottom right":return"bottomRight";default:return"center"}}function gX(t){return p.jsx(Rr,{viewBox:"0 0 18 18",fontSize:"small",...t,children:p.jsx("path",{d:"M9.00015 6.75V8.25M9.00015 11.25H9.00765M3.804 14.25H14.1963C15.351 14.25 16.0727 13 15.4953 12L10.2992 3C9.72184 2 8.27846 2 7.70111 3L2.50496 12C1.92761 13 2.6493 14.25 3.804 14.25Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})}const a$e=({defaultValue:t,onChange:e,values:n})=>{const r=q_(),{t:i}=Ie("inspector");sn();const a=V=>{if(!V)return{url:"",repeat:"no-repeat",position:"center center",size:"cover"};const K=V.trim();let le="";if(K.startsWith("url(")){const Ee=K.match(/^url\(\s*['"]?([^'")]+)['"]?\s*\)/);le=Ee?Ee[1]:""}else(/^https?:\/\//i.test(K)||K.startsWith("data:"))&&(le=K);let he="no-repeat";V.includes("repeat-x")?he="repeat-x":V.includes("repeat-y")?he="repeat-y":V.includes("repeat")&&!V.includes("no-repeat")&&(he="repeat");let ve="center center";const _e=["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"];for(const Ee of _e)if(V.includes(Ee)){ve=Ee;break}let me="cover";return V.includes("contain")?me="contain":V.includes("auto")&&(me="auto"),{url:le,repeat:he,position:ve,size:me}},o=V=>V.url?`url("${V.url}") ${V.repeat} ${V.position} / ${V.size}`:"",[s,l]=T.useState(t||null),[c,u]=T.useState(a(t)),[d,f]=T.useState(!1),[m,h]=T.useState(()=>!!window.__emailBuilderEnableAI),[,g]=T.useState(null),[_,b]=T.useState(a(t).url||""),[y,E]=T.useState(!1),[v,x]=T.useState(""),[S,C]=T.useState(!1),k=T.useRef(null),[w,D]=T.useState(null),A=j1e(),M=G1e(),R=A||M,[I,P]=T.useState(()=>!!window.__emailBuilderUnsplashEnabled);T.useEffect(()=>{const V=()=>{P(!!window.__emailBuilderUnsplashEnabled)};return V(),window.addEventListener("email-builder-unsplash-updated",V),()=>window.removeEventListener("email-builder-unsplash-updated",V)},[]),T.useEffect(()=>{const V=window.__emailBuilderCustomImageProvider;V&&(D(V),setTimeout(()=>{r&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:r,currentImageUrl:c.url||null,alt:null,source:"background"}}))},100))},[]);const[L,B]=T.useState(()=>sessionStorage.getItem("hideBackgroundImageWarning")==="true"),F=(V,K)=>{const le={...c,...V};if(u(le),le.url){const he=o(le);l(he),e(he,K)}else console.error("Update params error: ",le)},q=(V,K)=>{if(!V)return!1;const le=V?.toLowerCase(),he=le.includes(".svg")||le.includes("svg"),ve=K&&(K.includes("image/svg+xml")||K.includes("svg"));return he||!!ve},oe=async V=>{try{E(!0),x(""),C(!1);try{new URL(V)}catch{return x("Invalid URL format"),!1}const K=new AbortController,le=setTimeout(()=>K.abort(),1e4);try{const he=await fetch(V,{method:"HEAD",signal:K.signal});if(clearTimeout(le),!he.ok)return x(`HTTP ${he.status}: ${he.statusText}`),!1;const ve=he.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(Ee=>ve&&ve.toLowerCase().includes(Ee.toLowerCase()))?(q(V,ve)&&C(!0),x(""),!0):(x("URL does not point to an image"),!1)}catch(he){return clearTimeout(le),he.name==="AbortError"?(x("Request timeout - URL took too long to respond"),!1):new Promise(ve=>{const _e=new Image,me=setTimeout(()=>{x("Request timeout - URL took too long to respond"),ve(!1)},1e4);_e.onload=()=>{clearTimeout(me),q(V)&&C(!0),x(""),ve(!0)},_e.onerror=()=>{clearTimeout(me),x("Cannot access image - CORS policy, network error, or invalid URL"),ve(!1)},_e.src=V})}}catch{return x("Unexpected error occurred while validating URL"),!1}finally{E(!1)}},G=async()=>{_.trim()&&await oe(_.trim())&&(F({url:_.trim()}),r&&jp(r))},Y=V=>{V.key==="Enter"&&G()},be=V=>{b(V.target.value),v&&x(""),S&&C(!1)},ee=V=>{const K=["image/png","image/jpeg","image/gif"],he=Array.isArray(V)?V:Array.from(V),ve=he.filter(me=>K.includes(me.type)&&me.size<=5242880);if(ve.length!==he.length&&alert(i("inputs.common.invalidFiles")),ve.length===0)return;const _e=ve.map(me=>new Promise(Ee=>{const Re=new FileReader;Re.onload=Te=>Ee(Te.target?.result),Re.readAsDataURL(me)}));Promise.all(_e).then(me=>{const Ee={images:me,id:r||"",styles:n};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:Ee})),Wp(!0,r||"")})},fe=V=>{V.preventDefault(),f(!0)},re=()=>{f(!1)},te=V=>{V.preventDefault(),f(!1);const K=V.dataTransfer.files;ee(K)},Q=()=>{u({url:"",repeat:"no-repeat",position:"center center",size:"cover"}),l(null),e(null),b(""),C(!1)};return T.useEffect(()=>{const V=window.__emailBuilderEnableAI;V!==void 0&&h(!!V);const K=le=>{const{detail:he}=le;h(!!he)};return window.addEventListener("email-builder-ai-generation",K),()=>{window.removeEventListener("email-builder-ai-generation",K)}},[]),T.useEffect(()=>{const V=ve=>{const{detail:_e}=ve;Wp(!1,_e.id||""),F({url:_e.url},_e.styles),r&&jp(r),GG(!1),b(_e.url)},K=ve=>{Wp(ve?.detail?.uploading??!1,ve?.detail?.id??"")},le=()=>{k?.current?.click()},he=ve=>{const _e=ve.detail;if(typeof _e=="string"){if(!_e.includes("url("))F({url:_e}),b(_e);else{const me=a(_e);u(me),l(_e),e(_e),b(me.url)}return}_e?.url!=null&&typeof _e.url=="string"&&(F({url:_e.url},_e.styles),b(_e.url))};return window.addEventListener("email-builder-set-image",he),window.addEventListener("email-builder-upload-image-receive",V),window.addEventListener("email-builder-upload-file",le),window.addEventListener("email-builder-toggle-upload-file",K),()=>{window.removeEventListener("email-builder-upload-image-receive",V),window.removeEventListener("email-builder-set-image",he),window.removeEventListener("email-builder-upload-file",le),window.removeEventListener("email-builder-toggle-upload-file",K)}},[c]),T.useEffect(()=>{t&&C(q(c.url))},[t,c.url]),T.useEffect(()=>{if(t!==s){const V=a(t);u(V),l(t||null),b(V.url||"")}},[t]),p.jsxs(Qr,{children:[p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:1},children:[p.jsx(on,{label:i("inputs.backgroundImage.label")}),!L&&p.jsx(Pt,{title:i("inputs.backgroundImage.warningTooltip"),placement:"top",children:p.jsx(cn,{size:"small",color:"warning",disableRipple:!0,sx:{p:0,cursor:"help",lineHeight:0,"&:hover":{backgroundColor:"transparent"}},children:p.jsx(gX,{"aria-hidden":!0})})})]}),p.jsx(hX,{imageUrl:c.url||null,blockId:r,onRemove:Q}),p.jsx(uX,{tabs:[{key:"gallery",label:i("inputs.tabs.gallery"),visible:I,render:()=>p.jsx(fX,{blockId:r,source:"background"})},{key:"yourGallery",label:i("inputs.tabs.yourGallery"),visible:!!w,render:()=>p.jsx(H,{sx:{mb:2},children:w})},{key:"upload",label:i("inputs.tabs.upload"),visible:R,render:()=>p.jsxs(qe,{gap:1,children:[p.jsx(H,{children:A&&p.jsxs(p.Fragment,{children:[p.jsx(on,{label:i("inputs.image.urlLabel")}),p.jsxs(qe,{direction:"row",gap:1,children:[p.jsx(Ir,{fullWidth:!0,placeholder:i("inputs.image.urlPlaceholder"),value:_,onChange:be,onKeyPress:Y,error:!!v,disabled:y,sx:Ko}),p.jsx(ht,{variant:"contained",onClick:G,disabled:!_.trim()||y,sx:{minWidth:"auto",px:2,position:"relative"},children:y?p.jsx(ti,{size:20,color:"inherit"}):i("inputs.common.add")})]}),v&&p.jsx($n,{severity:"error",sx:{mt:1,fontSize:"0.875rem",maxHeight:"70px"},children:v}),S&&p.jsx($n,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:p.jsx(cn,{"aria-label":i("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{C(!1)},children:p.jsx(tb,{fontSize:"inherit"})}),children:i("inputs.common.svgWarning")})]})}),A&&M&&p.jsxs(qe,{direction:"row",alignItems:"center",gap:1,children:[p.jsx(Br,{sx:{flexGrow:1}}),p.jsx(xe,{variant:"caption",sx:{color:"text.secondary"},children:i("inputs.backgroundImage.or")}),p.jsx(Br,{sx:{flexGrow:1}})]}),M&&p.jsxs(H,{onDragOver:fe,onDragLeave:re,onDrop:te,sx:{width:"100%",border:"2px dashed",borderColor:d?"primary.main":"divider",borderRadius:"8px",padding:"24px 8px 36px 8px",textAlign:"center",bgcolor:d?"primary.50":"background.paper",transition:"all 0.2s ease"},children:[p.jsx(H,{sx:{display:"flex",justifyContent:"center"},children:p.jsx(cY,{sx:{fontSize:32,color:"primary"}})}),p.jsxs("label",{style:{cursor:"pointer"},children:[p.jsx("input",{ref:k,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:V=>{const K=V.target.files;K&&K.length>0&&ee(Array.from(K))}}),p.jsx(xe,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:i("inputs.common.uploadFile")}),p.jsxs(xe,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",i("inputs.common.dragAndDrop")]})]}),p.jsx(xe,{variant:"body2",sx:{color:"text.secondary",mt:1},children:i("inputs.common.fileInfo")})]})]})},{key:"generate",label:i("inputs.tabs.generate"),visible:m,render:()=>p.jsx(mX,{src:c.url,style:{width:"100%",margin:0}})}],defaultTab:"upload"}),c.url&&p.jsxs(H,{sx:{mt:2},children:[p.jsxs(H,{sx:{mb:2},children:[p.jsx(on,{label:i("inputs.backgroundImage.fillType")}),p.jsxs(Ad,{value:c.size,exclusive:!0,onChange:(V,K)=>{K!=null&&typeof K=="string"&&F({size:K})},size:"small",fullWidth:!0,children:[p.jsx(Un,{value:"cover",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(JI,{fontSize:"small"}),p.jsx("span",{children:i("inputs.backgroundImage.fillOptions.cover")})]})}),p.jsx(Un,{value:"contain",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(ZI,{fontSize:"small"}),p.jsx("span",{children:i("inputs.backgroundImage.fillOptions.contain")})]})}),p.jsx(Un,{value:"auto",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(XI,{fontSize:"small"}),p.jsx("span",{children:i("inputs.backgroundImage.fillOptions.auto")})]})})]})]}),p.jsxs(qe,{direction:"row",gap:2,sx:{mb:2},children:[p.jsxs("div",{style:{flex:1},children:[p.jsx(on,{label:i("inputs.backgroundImage.repeat")}),p.jsxs(ha,{style:{width:"100%"},value:c.repeat,size:"small",onChange:V=>F({repeat:V.target.value}),children:[p.jsx(Yr,{value:"no-repeat",children:i("inputs.backgroundImage.repeatOptions.none")}),p.jsx(Yr,{value:"repeat",children:i("inputs.backgroundImage.repeatOptions.repeat")}),p.jsx(Yr,{value:"repeat-x",children:i("inputs.backgroundImage.repeatOptions.repeatX")}),p.jsx(Yr,{value:"repeat-y",children:i("inputs.backgroundImage.repeatOptions.repeatY")})]})]}),p.jsxs("div",{style:{flex:1},children:[p.jsx(on,{label:i("inputs.backgroundImage.position")}),p.jsx(ha,{style:{width:"100%"},value:c.position,size:"small",onChange:V=>F({position:V.target.value}),renderValue:V=>{const K=String(V??"");return p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[hE(K),i(`inputs.backgroundImage.positions.${gE(K)}`)]})},children:["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"].map(V=>p.jsx(Yr,{sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important "},value:V,children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:1},children:[hE(V),i(`inputs.backgroundImage.positions.${gE(V)}`)]})},V))})]})]})]}),!w&&S&&p.jsx($n,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},children:i("inputs.common.svgWarning")})]})};function jN({label:t,labelAction:e,defaultValue:n,onChange:r,nullable:i,compact:a=!1,inheritedFrom:o}){const[s,l]=T.useState(null),[c,u]=T.useState(n),{t:d}=Ie("inspector");T.useEffect(()=>{c!==n&&u(n)},[n]);const f=y=>{l(y.currentTarget)},m=a?{border:"1px solid",borderColor:"cadet.400",width:28,height:28,borderRadius:"8px",bgcolor:"#FFFFFF"}:{border:t?"1px solid":"",borderColor:"cadet.400",width:"100%",height:36,paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",borderRadius:"8px",bgcolor:"#FFFFFF"},h=y=>{u(y),r(y)},g=()=>!i||typeof c!="string"||c.trim().length===0?null:p.jsx(Pt,{title:d("inputs.background.reset"),placement:"left",children:p.jsx(H,{sx:{minWidth:24,lineHeight:1,flexShrink:0,pr:"4px",display:"grid",placeItems:"center"},onClick:()=>h(null),children:p.jsx(nY,{sx:{color:"primary.main"}})})}),_=c?p.jsx(si,{onClick:f,sx:{...m,bgcolor:c}}):p.jsx(si,{onClick:f,sx:{...m},children:p.jsx(QI,{fontSize:"small"})}),b=p.jsx(pS,{anchorEl:s,open:!!s,onClose:()=>l(null),sx:{"& .MuiPaper-root":{boxShadow:"0 4px 6px rgba(0, 0, 0, 0.4);",borderRadius:1,maxWidth:"200px",transform:"translateX(-100%) !important;"}},MenuListProps:{sx:{height:"auto",padding:0}},children:p.jsx(iN,{value:c||"",nullable:i,onChange:y=>h(y)})});return a?p.jsxs(H,{sx:{display:"inline-flex",opacity:o?.55:1,transition:"opacity 120ms ease-out"},children:[_,b]}):p.jsxs(Qr,{children:[p.jsx(on,{label:t,action:e}),p.jsxs(qe,{direction:"row",alignContent:"center",spacing:1,sx:{opacity:o?.55:1,transition:"opacity 120ms ease-out"},children:[_,g()]}),b]})}function td(t){return p.jsx(jN,{...t,nullable:!1})}function mv(t){return p.jsx(jN,{...t,nullable:!0})}const o$e=ie(H)(({theme:t})=>({display:"flex",alignItems:"center",border:`1px solid ${t.palette.divider}`,borderRadius:"8px",padding:"4px",minWidth:58,maxWidth:"fit-content",backgroundColor:t.palette.background.paper,"&:hover":{borderColor:t.palette.primary.main},"&:focus-within":{borderColor:t.palette.primary.main,boxShadow:`0 0 0 1px ${t.palette.primary.main}`}})),s$e=ie("input")(({theme:t})=>({border:"none",outline:"none",background:"transparent",textAlign:"center",width:"27px",minWidth:"27px",maxWidth:"27px",padding:"0!important",lineHeight:"normal",fontSize:"0.9rem",color:t.palette.text.primary,"&::-webkit-outer-spin-button, &::-webkit-inner-spin-button":{WebkitAppearance:"none",margin:0},"&[type=number]":{MozAppearance:"textfield"}})),K5=ie(cn)(({theme:t})=>({padding:"0",color:t.palette.primary.main,"&:hover":{backgroundColor:je(t.palette.primary.main,.04)},"& .MuiSvgIcon-root":{fontSize:14}}));function Cr({iconLabel:t,label:e,value:n,setValue:r,units:i,min:a=0,max:o,step:s=void 0,marks:l=!0,...c}){const u=n??a,[d,f]=T.useState(u.toString()),m=v=>{let x=v;x<a&&(x=a),o!==void 0&&x>o&&(x=o),r(x),f(x.toString())},h=v=>{const x=v.target.value;if(f(x),x!==""){const S=Number(x);isNaN(S)||S>=a&&r(S)}},g=()=>{if(d===""||isNaN(Number(d)))f(u.toString());else{const v=Number(d);m(v)}},_=v=>{v.key==="Enter"&&g()};T.useEffect(()=>{f((n??a).toString())},[n,a]);const b=()=>{const v=u+1;m(v)},y=()=>{const v=u-1;m(v)},E=(v,x)=>{typeof x=="number"&&r(x)};return p.jsxs(Qr,{children:[p.jsx(on,{label:e}),p.jsxs(qe,{direction:"row",alignItems:"center",gap:2,justifyContent:"space-between",width:"100%",children:[p.jsx(H,{sx:{minWidth:24,lineHeight:1,flexShrink:0},children:t}),p.jsx(ng,{...c,value:u,min:a,max:o||1e3,step:s,color:"primary",marks:l,onChange:E}),p.jsxs(o$e,{children:[p.jsx(s$e,{type:"number",value:d,onChange:h,onBlur:g,onKeyDown:_,min:a,max:o,step:s}),p.jsxs(H,{sx:{display:"flex",flexDirection:"column",ml:.5},children:[p.jsx(K5,{onClick:b,disabled:o!==void 0&&u>=o,children:p.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",children:p.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})}),p.jsx(K5,{onClick:y,disabled:u<=a,children:p.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",style:{transform:"rotate(180deg)"},children:p.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})})]})]}),p.jsx(xe,{variant:"caption",color:"text.secondary",sx:{fontSize:"16px",ml:"4px!important"},children:i})]})]})}function Ip({label:t,defaultValue:e,onChange:n,...r}){const[i,a]=T.useState(e??0);return e!=i&&a(e),p.jsxs(Qr,{children:[p.jsx(on,{label:t}),p.jsx(Cr,{value:i??0,setValue:o=>{a(o),n(o)},...r})]})}const sO=({mobile:t=!1,label:e,borderColor:n,borderTop:r,borderBottom:i,borderLeft:a,borderRight:o,onChange:s,sidesLinked:l,onSidesLinkedChange:c})=>{const{t:u}=Ie("inspector"),d=()=>t?{top:"borderTopMobile",bottom:"borderBottomMobile",left:"borderLeftMobile",right:"borderRightMobile"}:{top:"borderTop",bottom:"borderBottom",left:"borderLeft",right:"borderRight"},f=w=>{const D=Object.values(w);return D.every(A=>A===D[0])},m=d(),h={[m.top]:r??0,[m.bottom]:i??0,[m.left]:a??0,[m.right]:o??0},[g,_]=T.useState(n??"#000000"),[b,y]=T.useState(h),E={[m.top]:Number(b[m.top]),[m.bottom]:Number(b[m.bottom]),[m.left]:Number(b[m.left]),[m.right]:Number(b[m.right])},v=l!==void 0?l:f(E);T.useEffect(()=>{n!==g&&_(n??"#000000");const w={[m.top]:r??0,[m.bottom]:i??0,[m.left]:a??0,[m.right]:o??0};Object.keys(w).some(A=>b[A]!==w[A])&&y(w)},[n,r,i,a,o,t]);const x=()=>{if(v)c(!1);else{const w=b[m.top]??0;C(w),c(!0)}},S=w=>{_(w),s({borderColor:w,...b})},C=w=>{const D={[m.top]:w,[m.bottom]:w,[m.left]:w,[m.right]:w};y(D),s({...D,borderColor:g})},k=(w,D)=>{y(M=>({...M,[D]:w}));const A={...b,borderColor:g,[D]:w};s(A)};return p.jsxs("div",{children:[p.jsxs(qe,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[p.jsx(on,{label:e}),p.jsxs(qe,{direction:"row",gap:1,alignItems:"center",children:[p.jsx(td,{defaultValue:g,onChange:S,compact:!0}),p.jsx(Pt,{title:u(v?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:p.jsx(cn,{size:"small",onClick:x,sx:{color:v?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:v?p.jsx(nb,{fontSize:"small"}):p.jsx(rb,{fontSize:"small"})})})]})]}),v&&p.jsx(Ip,{label:"",iconLabel:p.jsx(jwe,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[m.top],onChange:C}),!v&&p.jsxs(qe,{gap:2,children:[p.jsx(Ip,{label:"",iconLabel:p.jsx(Gwe,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[m.top],onChange:w=>k(w,m.top)}),p.jsx(Ip,{label:"",iconLabel:p.jsx(Uwe,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[m.bottom],onChange:w=>k(w,m.bottom)}),p.jsx(Ip,{label:"",iconLabel:p.jsx(zwe,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[m.left],onChange:w=>k(w,m.left)}),p.jsx(Ip,{label:"",iconLabel:p.jsx(Hwe,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[m.right],onChange:w=>k(w,m.right)})]})]})};function Nt({icon:t,label:e,children:n}){const r=To(),[i,a]=T.useState(!1),o=T.useRef(null);return r?p.jsxs(p.Fragment,{children:[p.jsx(Pt,{title:e,placement:"left",children:p.jsx(cn,{ref:o,onClick:()=>a(!i),color:i?"primary":"default",size:"small",sx:{borderRadius:1.5,width:32,height:32,alignSelf:"center"},children:p.jsx(t,{fontSize:"small"})})}),p.jsx(nu,{open:i,anchorEl:o.current,onClose:()=>a(!1),anchorOrigin:{vertical:"center",horizontal:"left"},transformOrigin:{vertical:"center",horizontal:"right"},slotProps:{paper:{sx:{width:360,p:2,borderRadius:2,boxShadow:"0 8px 32px rgba(0,0,0,0.12)",transform:"translateX(-18px) !important",overflow:"visible","&::after":{content:'""',position:"absolute",right:-4,top:"50%",transform:"translateY(-50%)",width:0,height:0,borderTop:"4px solid transparent",borderBottom:"4px solid transparent",borderLeft:"4px solid",borderLeftColor:"background.paper"}}}},children:n})]}):p.jsx(p.Fragment,{children:n})}const l$e=Z_.map(t=>p.jsx(Yr,{value:t.key,sx:{fontFamily:t.value},children:t.label},t.key));function HN({label:t,labelAction:e,onChange:n,defaultValue:r}){const i="INHERIT",[a,o]=T.useState(r??i);T.useEffect(()=>{a!==r&&o(r??i)},[r]);const s=l=>{const c=l.target.value;o(c),n(c===null?null:c)};return p.jsxs(Qr,{children:[p.jsx(on,{label:t,action:e}),p.jsx(ha,{style:{width:"100%"},value:a,size:"small",onChange:s,children:l$e})]})}function _E({label:t,labelAction:e,defaultValue:n=16,onChange:r,maxValue:i,minValue:a,step:o,inheritedFrom:s}){const[l,c]=T.useState(n);T.useEffect(()=>{l!==n&&c(n)},[n]);const u=d=>{c(d),r(d)};return p.jsxs(Qr,{children:[p.jsx(on,{label:t,action:e}),p.jsx(H,{sx:{opacity:s?.55:1,transition:"opacity 120ms ease-out"},children:p.jsx(Cr,{iconLabel:p.jsx(pY,{sx:{fontSize:16,color:"text.primary"}}),value:l,setValue:u,units:"px",step:o??2,min:a||8,max:i||48})})]})}function am({label:t,labelAction:e,children:n,defaultValue:r,onChange:i}){const[a,o]=T.useState(r);return T.useEffect(()=>{r!==a&&o(r)},[r]),p.jsxs(Qr,{children:[p.jsx(on,{label:t,action:e}),p.jsx(H,{sx:{...YA,paddingLeft:"0px",paddingRight:"0px"},children:p.jsx(Ad,{exclusive:!0,fullWidth:!0,value:a,size:"small",sx:{width:"100%"},onChange:(s,l)=>{if(typeof l!="string")throw new Error("RadioGroupInput can only receive string values");o(l),i(l)},children:n})})]})}function _X({label:t,labelAction:e,defaultValue:n,onChange:r}){const{t:i}=Ie("inspector"),[a,o]=T.useState(n);return T.useEffect(()=>{a!==n&&o(n)},[n]),p.jsxs(am,{label:t,labelAction:e,defaultValue:a,onChange:s=>{o(s),r(s)},children:[p.jsx(Un,{value:"normal",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(PDe,{fontSize:"small"}),p.jsx("span",{children:i("inputs.fontWeightToggle.regular")})]})}),p.jsx(Un,{value:"bold",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(ZW,{fontSize:"small"}),p.jsx("span",{children:i("inputs.fontWeightToggle.bold")})]})})]})}const lO=({label:t,defaultValue:e,onChange:n,min:r=1,max:i=100,step:a=1})=>{const{t:o}=Ie("inspector"),s=t??o("inputs.common.height");return p.jsx(Cr,{label:s,iconLabel:p.jsx(d_,{sx:{color:"text.secondary"}}),units:"px",step:a,min:r,max:i,marks:!1,value:e??r,setValue:n})},c$e=[{key:"1",value:"1",label:"Simple (1.0)"},{key:"1.15",value:"1.15",label:"Compact (1.15)"},{key:"1.5",value:"1.5",label:"Normal (1.5)"},{key:"2",value:"2",label:"Relaxed (2.0)"},{key:"2.5",value:"2.5",label:"Wide (2.5)"},{key:"3",value:"3",label:"Loose (3.0)"},{key:"4",value:"4",label:"Very Loose (4.0)"}],u$e=c$e.map(t=>p.jsx(Yr,{value:t.key,children:t.label},t.key));function d$e({label:t,onChange:e,defaultValue:n}){const r="INHERIT",[i,a]=T.useState(n?.toString()??r);T.useEffect(()=>{i!==n?.toString()&&a(n?.toString()??r)},[n]);const o=s=>{const l=s.target.value;a(l),e(l===r?null:parseFloat(l))};return p.jsxs(Qr,{children:[p.jsx(on,{label:t}),p.jsxs(ha,{style:{width:"100%"},value:i,size:"small",onChange:o,children:[p.jsx(Yr,{value:r,children:"Default value"}),u$e]})]})}function p$e(t){return p.jsxs(Rr,{...t,viewBox:"0 0 16 16",children:[p.jsx("path",{fill:"currentColor",d:"M0 0v16h16V0zm15 3h-1v1h1v11H1V3h1V2H1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1z"}),p.jsx("path",{fill:"currentColor",d:"M3 2h1v1H3zM2 3h1v1H2zm2 0h1v1H4zm2 0h1v1H6zM5 2h1v1H5zm2 0h1v1H7zm2 0h1v1H9zM8 3h1v1H8zm2 0h1v1h-1zm2 0h1v1h-1zm-1-1h1v1h-1zm2 0h1v1h-1z"})]})}function f$e(t){return p.jsxs(Rr,{...t,viewBox:"0 0 16 16",children:[p.jsx("path",{fill:"currentColor",d:"M16 16V0H0v16zM1 13h1v-1H1V1h14v12h-1v1h1v1h-1v-1h-1v1h-1v-1h-1v1h-1v-1H9v1H8v-1H7v1H6v-1H5v1H4v-1H3v1H2v-1H1z"}),p.jsx("path",{fill:"currentColor",d:"M12 13h1v1h-1zm1-1h1v1h-1zm-2 0h1v1h-1zm-2 0h1v1H9zm1 1h1v1h-1zm-2 0h1v1H8zm-2 0h1v1H6zm1-1h1v1H7zm-2 0h1v1H5zm-2 0h1v1H3zm1 1h1v1H4zm-2 0h1v1H2z"})]})}function m$e(t){return p.jsxs(Rr,{...t,viewBox:"0 0 16 16",children:[p.jsx("path",{fill:"currentColor",d:"M0 16h16V0H0zM3 1v1h1V1h11v14H3v-1H2v1H1v-1h1v-1H1v-1h1v-1H1v-1h1V9H1V8h1V7H1V6h1V5H1V4h1V3H1V2h1V1z"}),p.jsx("path",{fill:"currentColor",d:"M2 12h1v1H2zm1 1h1v1H3zm0-2h1v1H3zm0-2h1v1H3zm-1 1h1v1H2zm0-2h1v1H2zm0-2h1v1H2zm1 1h1v1H3zm0-2h1v1H3zm0-2h1v1H3zM2 4h1v1H2zm0-2h1v1H2z"})]})}function h$e(t){return p.jsxs(Rr,{...t,viewBox:"0 0 16 16",children:[p.jsx("path",{fill:"currentColor",d:"M16 0H0v16h16zm-3 15v-1h-1v1H1V1h12v1h1V1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1z"}),p.jsx("path",{fill:"currentColor",d:"M13 3h1v1h-1zm-1-1h1v1h-1zm0 2h1v1h-1zm0 2h1v1h-1zm1-1h1v1h-1zm0 2h1v1h-1zm0 2h1v1h-1zm-1-1h1v1h-1zm0 2h1v1h-1zm0 2h1v1h-1zm1-1h1v1h-1zm0 2h1v1h-1z"})]})}const bE=(t=>p.jsxs(Rr,{...t,viewBox:"0 0 16 16",children:[p.jsx("path",{fill:"currentColor",d:"M0 0v16h16V0zm15 3h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v-1h-1v1h-1v-1h-1v1h-1v-1H9v1H8v-1H7v1H6v-1H5v1H4v-1H3v1H2v-1H1v-1h1v-1H1v-1h1v-1H1V9h1V8H1V7h1V6H1V5h1V4H1V3h1V2H1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1z"}),p.jsx("path",{fill:"currentColor",d:"M3 2h1v1H3zm1 1h1v1H4zm2 0h1v1H6zM5 2h1v1H5zm2 0h1v1H7zm2 0h1v1H9zM8 3h1v1H8zm2 0h1v1h-1zm2 0h1v1h-1zm-1-1h1v1h-1zm2 0h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zm-1 3h1v1h-1zm1-1h1v1h-1zM2 3h1v1H2zm1 1h1v1H3zM2 5h1v1H2zm1 1h1v1H3zM2 7h1v1H2zm1 1h1v1H3zM2 9h1v1H2zm1 1h1v1H3zm-1 1h1v1H2zm0 2h1v1H2zm1-1h1v1H3zm1-1h1v1H4zm0 2h1v1H4zm1-1h1v1H5zm1 1h1v1H6zm1-1h1v1H7zm2 0h1v1H9zm-1 1h1v1H8zm3-1h1v1h-1zm-1 1h1v1h-1z"})]}));bE.muiName="PaddingIcon";function cO({label:t,labelAction:e,defaultValue:n,onChange:r,sidesLinked:i,onSidesLinkedChange:a,inheritedFrom:o}){const{t:l}=Ie("inspector"),[c,u]=T.useState(()=>n||{top:0,left:0,bottom:0,right:0});T.useEffect(()=>{n&&(n.top!==c.top||n.left!==c.left||n.bottom!==c.bottom||n.right!==c.right)&&u(n)},[n]);const d=c.top===c.bottom&&c.top===c.left&&c.top===c.right,f=i===!0&&d;function m(g,_){let b;f?b={top:_,bottom:_,left:_,right:_}:b={...c,[g]:_},u(b),r(b)}const h=()=>{const g=!f;if(!f){const _={top:c.top,bottom:c.top,left:c.top,right:c.top};u(_),r(_)}a(g)};return p.jsxs(Qr,{children:[p.jsxs(qe,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[p.jsx(on,{label:t,action:e}),p.jsx(Pt,{title:l(f?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:p.jsx(cn,{size:"small",onClick:h,sx:{marginTop:"0!important",color:f?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:f?p.jsx(nb,{fontSize:"small"}):p.jsx(rb,{fontSize:"small"})})})]}),p.jsx(qe,{sx:{opacity:o?.55:1,transition:"opacity 120ms ease-out"},gap:1,children:f?p.jsx(Cr,{iconLabel:p.jsx("span",{children:l("inputs.responsiveSize.allSides")}),value:c.top,setValue:g=>m("top",g),units:"px",step:16,min:0,max:120,marks:!0}):p.jsxs(p.Fragment,{children:[p.jsx(Cr,{iconLabel:p.jsx(p$e,{sx:{fontSize:16,color:"text.primary"}}),value:c.top,setValue:g=>m("top",g),units:"px",step:16,min:0,max:120,marks:!0}),p.jsx(Cr,{iconLabel:p.jsx(f$e,{sx:{fontSize:16,color:"text.primary"}}),value:c.bottom,setValue:g=>m("bottom",g),units:"px",step:16,min:0,max:120,marks:!0}),p.jsx(Cr,{iconLabel:p.jsx(m$e,{sx:{fontSize:16,color:"text.primary"}}),value:c.left,setValue:g=>m("left",g),units:"px",step:16,min:0,max:120,marks:!0}),p.jsx(Cr,{iconLabel:p.jsx(h$e,{sx:{fontSize:16,color:"text.primary"}}),value:c.right,setValue:g=>m("right",g),units:"px",step:16,min:0,max:120,marks:!0})]})})]})}const g$e=({label:t,defaultValue:e,onChange:n,maxValue:r=600,shapeSteps:i=8,cornersLinked:a,onCornersLinkedChange:o})=>{const{t:s}=Ie("inspector"),[l,c]=T.useState(()=>typeof e=="object"&&e!==null?"rounded":e||"rectangle"),[u,d]=T.useState(()=>typeof e=="object"&&e!==null?e:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0}),f=a===!0;T.useEffect(()=>{typeof e=="object"&&e!==null?(d(e),c("rounded")):(e==="rectangle"||e==="pill")&&c(e)},[e]);const m=y=>{const E=y;c(E),n(E==="rounded"?u:E)},h=(y,E)=>{let v;f?v={topLeft:E,topRight:E,bottomLeft:E,bottomRight:E}:v={...u,[y]:E},d(v),n(v)},g=()=>{const y=!f;if(!f){const E={topLeft:u.topLeft,topRight:u.topLeft,bottomLeft:u.topLeft,bottomRight:u.topLeft};d(E),n(E)}o(y)},_=typeof r=="number"?r:Number(r)||600,b=t||s("shape.label");return p.jsxs(p.Fragment,{children:[p.jsxs(am,{label:b,defaultValue:l,onChange:m,children:[p.jsx(Un,{value:"rectangle",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(Zwe,{fontSize:"small"}),p.jsx("span",{children:s("shape.square")})]})}),p.jsx(Un,{value:"pill",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(SDe,{fontSize:"small"}),p.jsx("span",{children:s("shape.pill")})]})}),p.jsx(Un,{value:"rounded",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(sp,{fontSize:"small"}),p.jsx("span",{children:s("shape.custom")})]})})]}),l==="rounded"&&p.jsxs(qe,{gap:2,alignItems:"flexStart",pb:1,children:[p.jsxs(qe,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[p.jsx(on,{label:s("shape.borderRadius")}),p.jsx(Pt,{title:s(f?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:p.jsx(cn,{size:"small",onClick:g,sx:{marginTop:"0!important",color:f?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:f?p.jsx(nb,{fontSize:"small"}):p.jsx(rb,{fontSize:"small"})})})]}),f?p.jsx(p.Fragment,{children:p.jsx(Cr,{iconLabel:p.jsx(sp,{sx:{fontSize:16}}),value:Number(u.topRight),setValue:y=>h("topLeft",y),units:"px",min:0,step:i,marks:i>1,max:_})}):p.jsxs(p.Fragment,{children:[p.jsx(Cr,{iconLabel:p.jsx(sp,{sx:{fontSize:16,transform:"rotate(0deg)"}}),value:Number(u.topLeft),setValue:y=>h("topLeft",y),units:"px",min:0,step:i,marks:i>1,max:_}),p.jsx(Cr,{iconLabel:p.jsx(sp,{sx:{fontSize:16,transform:"rotate(270deg)"}}),value:Number(u.topRight),setValue:y=>h("topRight",y),units:"px",min:0,step:i,marks:i>1,max:_}),p.jsx(Cr,{iconLabel:p.jsx(sp,{sx:{fontSize:16,transform:"rotate(180deg)"}}),value:Number(u.bottomLeft),setValue:y=>h("bottomLeft",y),units:"px",min:0,step:i,marks:i>1,max:_}),p.jsx(Cr,{iconLabel:p.jsx(sp,{sx:{fontSize:16,transform:"rotate(90deg)"}}),value:Number(u.bottomRight),setValue:y=>h("bottomRight",y),units:"px",min:0,step:i,marks:i>1,max:_})]})]})]})};function uO({label:t,labelAction:e,defaultValue:n,onChange:r}){const[i,a]=T.useState(n??"left");return T.useEffect(()=>{n!==i&&a(n??"left")},[n]),p.jsxs(Qr,{children:[p.jsx(on,{label:t,action:e}),p.jsxs(am,{label:"",defaultValue:i,onChange:o=>{a(o),r(o)},children:[p.jsx(Un,{value:"left",children:p.jsx(pDe,{fontSize:"small"})}),p.jsx(Un,{value:"center",children:p.jsx(S1,{fontSize:"small"})}),p.jsx(Un,{value:"right",children:p.jsx(fDe,{fontSize:"small"})})]})]})}const Q5=({label:t,defaultValue:e,onChange:n,step:r,...i})=>{const{t:a}=Ie("inspector"),o=t??a("inputs.common.width");return p.jsx(Cr,{label:o,iconLabel:p.jsx(d_,{sx:{color:"text.primary",transform:"rotate(90deg)"}}),units:"%",step:r,min:1,max:100,marks:!1,value:e??1,setValue:n,...i})},c0=(t=>p.jsx(Rr,{...t,viewBox:"0 0 24 24",children:p.jsx("path",{fill:"currentColor",d:"M15 4h7v2h-7zm1 4h6v2h-6zm2 4h4v2h-4zM9.307 4l-6 16h2.137l1.875-5h6.363l1.875 5h2.137l-6-16zm-1.239 9L10.5 6.515L12.932 13z"})}));c0.muiName="FontFamilyIcon";const v_=(t=>p.jsx(Rr,{...t,viewBox:"0 0 24 24",children:p.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",children:[p.jsx("path",{d:"M13.04 4.75h3.66c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311c.327.642.327 1.482.327 3.162v5.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311c-.642.327-1.482.327-3.162.327H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 17.47 3 16.63 3 14.95v-.93"}),p.jsx("path",{d:"m6.407 2.818l5.384 5.385M6.407 2.818L3.01 6.214c-.696.696-1.044 1.044-1.174 1.446c-.057.176-.086.36-.086.543m4.657-5.385L5.589 2m6.202 6.203l-3.396 3.396c-.696.696-1.044 1.044-1.445 1.174a1.76 1.76 0 0 1-1.086 0c-.401-.13-.75-.478-1.445-1.174L3.01 10.191c-.696-.696-1.044-1.044-1.174-1.445a1.8 1.8 0 0 1-.086-.543m10.042 0H1.75m10.672 4.094l1.485-2.448l1.744 2.313a1.824 1.824 0 0 1-.668 2.491c-1.546.893-3.322-.74-2.562-2.356"})]})}));v_.muiName="BackgroundColorIcon";const u0=(t=>p.jsx(Rr,{...t,viewBox:"0 0 24 24",children:p.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",children:[p.jsx("path",{d:"m7.154 13.088l1.73-3.959m0 0h6.231m-6.23 0l2.652-6.065a.5.5 0 0 1 .926 0l2.652 6.065m0 0l1.731 3.96"}),p.jsx("rect",{width:"15.5",height:"4.353",x:"4.25",y:"16.897",rx:"1.5"})]})}));u0.muiName="TextColorIcon";function _$e({name:t,value:e,onChange:n,shapeMaxValue:r,shapeSteps:i}){const a=or(),o=ES(),s=yS(),{t:l}=Ie("inspector"),c=b=>{if(!s)return e[b]??null;const y=a==="desktop"?"desktop":"mobile",E=o?.theme,x=AG({type:s,data:{style:e}},"style",b,E,y);return x!==void 0?x:y_[s]?.style?.[b]??null},u=b=>{if(e[b]!==void 0&&e[b]!==null||!s)return;const E=o?.theme?.blocks?.[s]?.style?.[b];if(E!=null)return"theme";const v=y_[s]?.style?.[b];return v!=null?"default":void 0},d=b=>c(b),f=(b,y)=>{const E=e[b],v=e[y];return E??v},m=(b,y)=>{n(y?{...e,...y,[t]:b}:{...e,[t]:b})},h=b=>{n({...e,...b})},_=(()=>{switch(t){case"textAlignMobile":return c("textAlignMobile")??c("textAlign");case"mobilePadding":return c("mobilePadding")??c("padding");case"fontSizeMobile":return c("fontSizeMobile")??c("fontSize")??16;case"heightMobile":return c("heightMobile")??c("height");case"widthMobile":return c("widthMobile")??c("width");case"borderMobile":return{borderTop:f("borderTopMobile","borderTop"),borderBottom:f("borderBottomMobile","borderBottom"),borderLeft:f("borderLeftMobile","borderLeft"),borderRight:f("borderRightMobile","borderRight")};default:return c(t)}})();switch(t){case"backgroundColor":return p.jsx(Nt,{icon:v_,label:l("properties.backgroundColor"),children:p.jsx(mv,{label:l("properties.backgroundColor"),defaultValue:_??o?.canvasColor,onChange:m})});case"background":return p.jsx(Nt,{icon:fY,label:l("properties.background","Background"),children:p.jsx(a$e,{defaultValue:_,onChange:(b,y)=>m(b,y),values:e})});case"borderColor":return p.jsx(Nt,{icon:v_,label:l("properties.border"),children:p.jsx(mv,{label:l("properties.border"),defaultValue:_,onChange:m})});case"borderRadius":return p.jsx(Nt,{icon:WC,label:l("properties.borderRadius"),children:p.jsx(Ip,{iconLabel:p.jsx(WC,{}),units:"px",step:4,marks:!0,min:0,max:48,label:l("properties.borderRadius"),defaultValue:_,onChange:m})});case"color":return p.jsx(Nt,{icon:tN,label:l("properties.color"),children:p.jsx(mv,{label:l("properties.color"),defaultValue:_,onChange:m})});case"fontFamily":return p.jsx(Nt,{icon:c0,label:l("properties.fontFamily"),children:p.jsx(HN,{label:l("properties.fontFamily"),defaultValue:_,onChange:m})});case"fontWeight":return p.jsx(Nt,{icon:eY,label:l("properties.fontWeight"),children:p.jsx(_X,{label:l("properties.fontWeight"),defaultValue:_,onChange:m})});case"textAlign":return a==="desktop"&&p.jsx(Nt,{icon:S1,label:l("properties.alignment"),children:p.jsx(uO,{label:l("properties.alignment"),defaultValue:_,onChange:m})});case"textAlignMobile":return a!="desktop"&&p.jsx(Nt,{icon:S1,label:l("properties.alignment"),children:p.jsx(uO,{label:l("properties.alignment"),defaultValue:_,onChange:m})});case"padding":return a==="desktop"&&p.jsx(Nt,{icon:bE,label:l("properties.padding"),children:p.jsx(cO,{label:l("properties.padding"),defaultValue:c("padding"),inheritedFrom:u("padding"),onChange:m,sidesLinked:e.paddingSidesLinked,onSidesLinkedChange:b=>n({...e,paddingSidesLinked:b})})});case"mobilePadding":return a!="desktop"&&p.jsx(Nt,{icon:bE,label:l("properties.padding"),children:p.jsx(cO,{label:l("properties.padding"),defaultValue:c("mobilePadding")??c("padding"),inheritedFrom:e.mobilePadding!=null?void 0:"default",onChange:m,sidesLinked:e.mobilePaddingSidesLinked,onSidesLinkedChange:b=>n({...e,mobilePaddingSidesLinked:b})})});case"fontSize":return a==="desktop"&&p.jsx(Nt,{icon:C1,label:l("properties.fontSize"),children:p.jsx(_E,{maxValue:80,step:8,label:l("properties.fontSize"),defaultValue:_??16,onChange:m})});case"fontSizeMobile":return a!="desktop"&&p.jsx(Nt,{icon:C1,label:l("properties.fontSize"),children:p.jsx(_E,{maxValue:80,step:8,label:l("properties.fontSize"),defaultValue:_,onChange:m})});case"lineHeight":return p.jsx(Nt,{icon:_De,label:l("properties.lineHeight"),children:p.jsx(d$e,{label:l("properties.lineHeight"),defaultValue:_??1.5,onChange:m})});case"shape":return p.jsx(Nt,{icon:WC,label:l("properties.shape"),children:p.jsx(g$e,{shapeSteps:i,maxValue:r,label:l("properties.shape"),defaultValue:_,onChange:m,cornersLinked:e.shapeCornersLinked,onCornersLinkedChange:b=>n({...e,shapeCornersLinked:b})})});case"height":return a==="desktop"&&p.jsx(Nt,{icon:d_,label:l("properties.height"),children:p.jsx(lO,{label:l("properties.height"),defaultValue:_,onChange:m})});case"heightMobile":return a!="desktop"&&p.jsx(Nt,{icon:d_,label:l("properties.height"),children:p.jsx(lO,{label:l("properties.height"),defaultValue:_,onChange:m})});case"width":return a==="desktop"&&p.jsx(Nt,{icon:C2,label:l("properties.width"),children:p.jsx(Q5,{label:l("properties.width"),defaultValue:c("width")??void 0,onChange:m})});case"widthMobile":return a!="desktop"&&p.jsx(Nt,{icon:C2,label:l("properties.width"),children:p.jsx(Q5,{label:l("properties.width"),defaultValue:c("widthMobile")??c("width")??void 0,onChange:m})});case"border":return a==="desktop"&&p.jsx(Nt,{icon:E2,label:l("properties.border"),children:p.jsx(sO,{label:l("properties.border"),borderColor:e.borderColor??null,borderTop:d("borderTop"),borderBottom:d("borderBottom"),borderLeft:d("borderLeft"),borderRight:d("borderRight"),onChange:h,sidesLinked:e.borderSidesLinked,onSidesLinkedChange:b=>n({...e,borderSidesLinked:b})})});case"borderMobile":return a!="desktop"&&p.jsx(Nt,{icon:E2,label:l("properties.border"),children:p.jsx(sO,{mobile:!0,label:l("properties.border"),borderColor:e.borderColor??null,borderTop:d("borderTopMobile")??d("borderTop"),borderBottom:d("borderBottomMobile")??d("borderBottom"),borderLeft:d("borderLeftMobile")??d("borderLeft"),borderRight:d("borderRightMobile")??d("borderRight"),onChange:h,sidesLinked:e.borderMobileSidesLinked,onSidesLinkedChange:b=>n({...e,borderMobileSidesLinked:b})})});default:return null}}const Tu={section:"style",key:"padding",kind:"padding",labelKey:"theme.fields.padding"},cc={section:"style",key:"backgroundColor",kind:"color",labelKey:"theme.fields.backgroundColor"},b$e={section:"style",key:"fontWeight",kind:"fontWeight",labelKey:"theme.fields.fontWeight"},y$e={section:"style",key:"textAlign",kind:"textAlign",labelKey:"theme.fields.textAlign"},v$e=["NotionText","Button","Image","Divider","Spacer","SocialMedia","Container","ColumnsContainer"],bX={NotionText:{titleKey:"theme.blocks.notionText.title",icon:$5e,fields:[cc,{section:"style",key:"fontSize",kind:"fontSize",labelKey:"theme.fields.fontSize"},Tu]},Button:{titleKey:"theme.blocks.button.title",icon:n9e,fields:[{section:"style",key:"buttonBackgroundColor",kind:"color",labelKey:"theme.fields.buttonBackgroundColor",icon:j5},{section:"style",key:"buttonTextColor",kind:"color",labelKey:"theme.fields.buttonTextColor",icon:u0},{section:"style",key:"fontSize",kind:"fontSize",labelKey:"theme.fields.fontSize"},b$e,y$e,cc,Tu]},Image:{titleKey:"theme.blocks.image.title",icon:X5e,fields:[cc,Tu]},Divider:{titleKey:"theme.blocks.divider.title",icon:Y5e,fields:[{section:"style",key:"color",kind:"color",labelKey:"theme.fields.color",icon:j5},cc,{section:"style",key:"width",kind:"number",labelKey:"theme.fields.width"},{section:"style",key:"height",kind:"number",labelKey:"theme.fields.height"},Tu]},Spacer:{titleKey:"theme.blocks.spacer.title",icon:j5e,fields:[cc,{section:"style",key:"height",kind:"number",labelKey:"theme.fields.height"}]},SocialMedia:{titleKey:"theme.blocks.socialMedia.title",icon:V5e,fields:[cc,Tu]},Container:{titleKey:"theme.blocks.container.title",icon:aX,fields:[cc,{section:"style",key:"border",kind:"border",labelKey:"theme.fields.border"},Tu]},ColumnsContainer:{titleKey:"theme.blocks.columnsContainer.title",icon:a9e,fields:[cc,Tu]}};function uu({title:t,children:e}){const n=To(),r=yS(),a=(r?bX[r]:null)?.icon;return p.jsxs(ff,{sx:{padding:"0!important",paddingTop:"1rem!important"},children:[!n&&p.jsx(xe,{sx:{fontWeight:"bold",mb:2,pb:1,color:"text.primary",fontSize:"1.25rem",borderBottom:o=>`1px solid ${o.palette.divider}`},children:t}),n&&a&&p.jsx(Pt,{title:t,placement:"left",children:p.jsx(H,{sx:{display:"flex",justifyContent:"center",pb:1.5},children:p.jsx(a,{sx:{fontSize:22,color:"primary.main"}})})}),p.jsx(qe,{gap:n?.5:1,mb:3,pt:n?0:1,children:e})]})}function cb(){return To()?p.jsx(Br,{sx:{my:.5}}):null}function X5(t){return{top:Number(t.top??0),bottom:Number(t.bottom??0),left:Number(t.left??0),right:Number(t.right??0)}}function E$e({size:t,sizeMobile:e,sizePaddingSidesLinked:n,sizeMobilePaddingSidesLinked:r,onChange:i,label:a,maxValue:o=100,paddingSteps:s=8}){const{t:l}=Ie("inspector"),c=a??l("inputs.common.size"),u=or(),[d,f]=T.useState(()=>{const v=u==="desktop"?t:e!==void 0?e:t;return typeof v=="object"&&v!==null?X5(v):{top:8,bottom:8,left:16,right:16}}),m=u==="desktop"?n===!0:r===!0;T.useEffect(()=>{const v=u==="desktop"?t:e!==void 0?e:t;typeof v=="object"&&v!==null&&f(X5(v))},[t,e,u]);const h=()=>{const v=u==="desktop"?t:e!==void 0?e:t;return typeof v=="object"&&v!==null?"custom":typeof v=="string"?v:"medium"},g=typeof o=="number"?o:Number(o)||100,_=v=>{if(u==="desktop"){const x={size:v==="custom"?d:v};e==null&&(x.sizeMobile=v==="custom"?d:v),i(x)}else i({sizeMobile:v==="custom"?d:v})},b=(v,x)=>{let S;m?S={top:x,bottom:x,left:x,right:x}:S={...d,[v]:x},f(S),i(u==="desktop"?{size:S}:{sizeMobile:S})},y=()=>{if(u==="desktop")if(m)i({sizePaddingSidesLinked:!1});else{const v={top:d.top,bottom:d.top,left:d.top,right:d.top};f(v),i({size:v,sizePaddingSidesLinked:!0})}else if(m)i({sizeMobilePaddingSidesLinked:!1});else{const v={top:d.top,bottom:d.top,left:d.top,right:d.top};f(v),i({sizeMobile:v,sizeMobilePaddingSidesLinked:!0})}},E=h();return p.jsxs(qe,{gap:2,children:[p.jsxs(am,{label:c,defaultValue:E,onChange:_,children:[p.jsx(Un,{value:"x-small",children:p.jsx(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:p.jsx("span",{children:l("inputs.responsiveSize.options.xSmall")})})}),p.jsx(Un,{value:"small",children:p.jsx(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:p.jsx("span",{children:l("inputs.responsiveSize.options.small")})})}),p.jsx(Un,{value:"medium",children:p.jsx(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:p.jsx("span",{children:l("inputs.responsiveSize.options.medium")})})}),p.jsx(Un,{value:"custom",children:p.jsx(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:p.jsx("span",{children:l("inputs.responsiveSize.options.custom")})})})]}),E==="custom"&&p.jsxs(qe,{gap:2,alignItems:"flexStart",pb:1,children:[p.jsxs(qe,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[p.jsx(on,{label:l("inputs.responsiveSize.customPadding")}),p.jsx(Pt,{title:l(m?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:p.jsx(cn,{size:"small",onClick:y,sx:{marginTop:"0!important",color:m?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:m?p.jsx(nb,{fontSize:"small"}):p.jsx(rb,{fontSize:"small"})})})]}),m?p.jsx(Cr,{iconLabel:p.jsx(xe,{variant:"body2",component:"span",children:l("inputs.responsiveSize.allSides")}),value:d.top,setValue:v=>b("top",v),units:"px",min:0,step:s,marks:s>1,max:g}):p.jsxs(p.Fragment,{children:[p.jsx(Cr,{iconLabel:p.jsx(Mwe,{sx:{fontSize:16}}),value:d.top,setValue:v=>b("top",v),units:"px",min:0,step:s,marks:s>1,max:g}),p.jsx(Cr,{iconLabel:p.jsx(Nwe,{sx:{fontSize:16}}),value:d.bottom,setValue:v=>b("bottom",v),units:"px",min:0,step:s,marks:s>1,max:g}),p.jsx(Cr,{iconLabel:p.jsx(Rwe,{sx:{fontSize:16}}),value:d.left,setValue:v=>b("left",v),units:"px",min:0,step:s,marks:s>1,max:g}),p.jsx(Cr,{iconLabel:p.jsx(Iwe,{sx:{fontSize:16}}),value:d.right,setValue:v=>b("right",v),units:"px",min:0,step:s,marks:s>1,max:g})]})]})]})}function S$e({fullWidth:t,fullWidthMobile:e,onChange:n,label:r="Width"}){const i=or(),{t:a}=Ie("inspector"),o=()=>i==="desktop"?t:e!==void 0?e:t,s=c=>{const u=c==="FULL_WIDTH";if(i==="desktop"){const d={fullWidth:u};e==null&&(d.fullWidthMobile=u),n(d)}else n({fullWidthMobile:u})},l=o();return p.jsxs(am,{label:r,defaultValue:l?"FULL_WIDTH":"AUTO",onChange:s,children:[p.jsx(Un,{value:"FULL_WIDTH",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(GDe,{fontSize:"small"}),p.jsx("span",{children:a("inputs.width.full")})]})}),p.jsx(Un,{value:"AUTO",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(VDe,{fontSize:"small"}),p.jsx("span",{children:a("inputs.width.auto")})]})})]})}function C$e(t,e){const n=T.useRef(null),r=T.useRef(t),i=T.useRef([]);r.current=t;const a=T.useCallback((...o)=>{i.current=o,n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{r.current(...o),n.current=null},e)},[e]);return a.flush=T.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=null,r.current(...i.current))},[]),a}function yE({helperText:t,label:e,placeholder:n,rows:r,InputProps:i,defaultValue:a,onChange:o}){const[s,l]=T.useState(a);T.useEffect(()=>{s!==a&&l(a)},[a]);const c=C$e(d=>{o(d)},150),u=typeof r=="number"&&r>1;return p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[p.jsx(on,{label:e}),p.jsx(Ir,{fullWidth:!0,multiline:u,minRows:r,variant:"outlined",placeholder:n,helperText:t,InputProps:i,value:s,sx:Ko,onChange:d=>{const f=d.target.value;l(f),c(f)},onBlur:()=>{c.flush()}})]})}function na({names:t,value:e,onChange:n,disabledCSSValidation:r=!1,shapeMaxValue:i,shapeSteps:a}){const o=Rd(),s=yS();return(To()||r||o=="css"||ig.includes(s||""))&&p.jsx(p.Fragment,{children:t.map(c=>p.jsx(_$e,{shapeMaxValue:i,shapeSteps:a,name:c,value:e||{},onChange:n},c))})}function x$e({data:t,setData:e}){const[,n]=T.useState(null),r=ES(),{t:i}=Ie("inspector"),a=b=>{const y=z_.safeParse(b);y.success?(e(y.data),n(null)):n(y.error)},o=t.props?.text??wc.text,s=t.props?.url??wc.url,l=t.props?.fullWidth??wc.fullWidth,c=t.props?.size??wc.size,u=r,d=t.style?.buttonTextColor??t.props?.buttonTextColor??u?.textColor,f=t.style?.buttonBackgroundColor??t.props?.buttonBackgroundColor??wc.buttonBackgroundColor,m=t.props?.fullWidthMobile,h=t.props?.sizeMobile,g=Rd(),_=To();return p.jsxs(uu,{title:i("inputs.panels.button.title"),children:[(g=="block-configuration"||_)&&p.jsxs(p.Fragment,{children:[p.jsx(na,{disabledCSSValidation:!0,names:["fontFamily","fontSize","fontSizeMobile","fontWeight"],value:t.style,onChange:b=>a({...t,style:b})}),p.jsx(Nt,{icon:FDe,label:i("inputs.panels.button.textLabel"),children:p.jsx(yE,{label:i("inputs.panels.button.textLabel"),defaultValue:o,onChange:b=>a({...t,props:{...t.props,text:b}})})}),p.jsx(Nt,{icon:eN,label:i("inputs.panels.button.targetLabel"),children:p.jsx(yE,{label:i("inputs.panels.button.targetLabel"),placeholder:i("inputs.panels.button.targetPlaceholder"),defaultValue:s,onChange:b=>a({...t,props:{...t.props,url:b}})})}),p.jsx(Nt,{icon:C2,label:i("properties.width"),children:p.jsx(S$e,{label:i("properties.width"),fullWidth:l,fullWidthMobile:m,onChange:b=>a({...t,props:{...t.props,...b}})})}),p.jsx(Nt,{icon:Fwe,label:i("properties.size","Size"),children:p.jsx(E$e,{size:c,sizeMobile:h,sizePaddingSidesLinked:t.props?.sizePaddingSidesLinked,sizeMobilePaddingSidesLinked:t.props?.sizeMobilePaddingSidesLinked,onChange:b=>a({...t,props:{...t.props,...b}})})})]}),p.jsx(cb,{}),p.jsx(na,{names:["shape","textAlign","textAlignMobile","backgroundColor","border","borderMobile","padding","mobilePadding"],value:t.style,shapeMaxValue:80,onChange:b=>a({...t,style:b})}),(g==="css"||_)&&p.jsxs(p.Fragment,{children:[p.jsx(Nt,{icon:u0,label:i("inputs.panels.button.textColor"),children:p.jsx(td,{label:i("inputs.panels.button.textColor"),defaultValue:d,onChange:b=>a({...t,style:{...t.style,buttonTextColor:b}})})}),p.jsx(Nt,{icon:tN,label:i("inputs.panels.button.buttonColor"),children:p.jsx(td,{label:i("inputs.panels.button.buttonColor"),defaultValue:f,onChange:b=>a({...t,style:{...t.style,buttonBackgroundColor:b}})})})]})]})}const T$e=(t,e,n)=>{if(!t||!document)return;const r=Xt(t),i=document.querySelector(`.${r}`);if(!i)return;const a=i.parentElement;if(!a)return;const o=Math.ceil(a.getBoundingClientRect().width);n.props?.touched||n.props?.width!==o&&e({...n,props:{...n.props,width:o}})},k$e=t=>{if(!t||!document)return;const e=Xt(t),n=document.querySelector(`.${e}`);if(!n)return;const r=n.parentElement;if(!r)return;const i=Math.ceil(r.getBoundingClientRect().width);return i||null},w$e={desktop:"contentAlignment",mobile:"contentAlignmentMobile"};function D$e({data:t,updateData:e}){const{t:n}=Ie("inspector"),r=or(),i=w$e[r]||"contentAlignment",a=t.props?.[i]??t.props?.contentAlignment,o=s=>{e({...t,props:{...t.props,[i]:s}})};return p.jsxs(am,{label:n("inputs.alignment.label"),defaultValue:a,onChange:o,children:[p.jsx(Un,{value:"top",children:p.jsx(zDe,{fontSize:"small"})}),p.jsx(Un,{value:"middle",children:p.jsx(UDe,{fontSize:"small"})}),p.jsx(Un,{value:"bottom",children:p.jsx($De,{fontSize:"small"})})]})}function J5({value:t,onChange:e,options:n}){return p.jsx(Ad,{exclusive:!0,value:t,size:"small",onChange:(r,i)=>{typeof i=="string"&&e(i)},sx:{display:"flex",width:"100%"},children:n.map(r=>p.jsx(Un,{value:r.value,children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[r.icon,p.jsx("span",{children:r.label})]})},r.value))})}const yp="layout-custom",Vx=[{id:"layout-50-50",distribution:[50,50,null]},{id:"layout-55-45",distribution:[55,45,null]},{id:"layout-45-55",distribution:[45,55,null]},{id:"layout-60-40",distribution:[60,40,null]},{id:"layout-40-60",distribution:[40,60,null]},{id:"layout-70-30",distribution:[70,30,null]},{id:"layout-30-70",distribution:[30,70,null]},{id:"layout-75-25",distribution:[75,25,null]},{id:"layout-25-75",distribution:[25,75,null]},{id:"layout-80-20",distribution:[80,20,null]},{id:"layout-20-80",distribution:[20,80,null]}],qx=[{id:"layout-33-33-33",distribution:[33.34,33.33,33.33]},{id:"layout-30-40-30",distribution:[30,40,30]},{id:"layout-25-50-25",distribution:[25,50,25]},{id:"layout-20-60-20",distribution:[20,60,20]},{id:"layout-50-25-25",distribution:[50,25,25]},{id:"layout-25-25-50",distribution:[25,25,50]},{id:"layout-60-20-20",distribution:[60,20,20]},{id:"layout-20-20-60",distribution:[20,20,60]},{id:"layout-40-30-30",distribution:[40,30,30]},{id:"layout-40-20-40",distribution:[40,20,40]},{id:"layout-15-70-15",distribution:[15,70,15]}],_c={grid:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:"16px",width:"100%"},card:{cursor:"pointer",border:"1px solid #e5e7eb",borderRadius:"8px",backgroundColor:"primary"},cardContent:{padding:"8px"},layoutPreview:{display:"grid",gap:"4px",height:"30px",width:"100%",minHeight:"30px"}};function Z5(t){const e=t?.[0];return typeof e=="number"&&!Number.isNaN(e)?Math.min(99,Math.max(1,Math.round(e))):50}function Wx(t){let e=typeof t?.[0]=="number"?Math.round(t[0]):34,n=typeof t?.[1]=="number"?Math.round(t[1]):33;return e=Math.min(98,Math.max(1,e)),n=Math.min(98,Math.max(1,n)),e+n>=99&&(n=Math.max(1,99-e)),[e,n]}const Yx=({fractions:t,highlight:e})=>{const n=sn(),r=e?n.palette.secondary.main:"#e5e7eb";return p.jsx("div",{style:{..._c.layoutPreview,gridTemplateColumns:t.map(i=>`${i}fr`).join(" ")},children:t.map((i,a)=>p.jsx("div",{style:{minWidth:0,backgroundColor:r,borderRadius:"4px",transition:"background-color 0.2s ease"}},a))})},A$e=({defaultValue:t,fixedWidths:e,onChange:n,columns:r})=>{const{t:i}=Ie("inspector"),a=sn(),[o,s]=T.useState(null),[l,c]=T.useState(!1),[u,d]=T.useState(()=>Z5(e??void 0)),[f,m]=T.useState(()=>Wx(e??void 0)[0]),[h,g]=T.useState(()=>Wx(e??void 0)[1]),b=t??(r===2?"layout-50-50":"layout-33-33-33"),E=o??(b==="layout-33-34-33"?"layout-33-33-33":b),[v,x]=T.useState(r===2?Vx:qx),S=(I,P)=>{s(null),c(!1),n({layout:I,fixedWidths:P})},C=()=>{if(s(yp),c(!0),r===2)d(Z5(e??void 0));else{const[I,P]=Wx(e??void 0);m(I),g(P)}},k=()=>{if(r===2){const I=u;n({layout:yp,fixedWidths:[I,100-I,null]})}else{const I=f,P=h;n({layout:yp,fixedWidths:[I,P,100-I-P]})}s(null)};T.useEffect(()=>{x(r===2?Vx:qx)},[r]),T.useEffect(()=>{s(null),c(!1)},[r,t]),T.useEffect(()=>{const I=t;r===2?I!==yp&&(I==null||!Vx.some(P=>P.id===I))&&n({layout:"layout-50-50",fixedWidths:[50,50,null]}):I==="layout-33-34-33"?n({layout:"layout-33-33-33",fixedWidths:[33.34,33.33,33.33]}):I!==yp&&(I==null||!qx.some(P=>P.id===I))&&n({layout:"layout-33-33-33",fixedWidths:[33.34,33.33,33.33]})},[r,t,n]);const w=(I,P)=>{const L=P;m(L),g(B=>Math.max(1,Math.min(B,100-L-1)))},D=(I,P)=>{const L=P,B=100-f-1;g(Math.max(1,Math.min(L,B)))},A=100-u,M=100-f-h,R=E===yp;return p.jsxs(Qr,{children:[p.jsx(on,{label:i("inputs.layout.label")}),p.jsxs("div",{style:_c.grid,children:[v.map(I=>p.jsx("div",{onClick:()=>S(I.id,I.distribution),style:{..._c.card,border:E===I.id?`2px solid ${a.palette.secondary.main}`:_c.card.border},children:p.jsx("div",{style:_c.cardContent,children:p.jsx(Yx,{fractions:I.distribution.filter(P=>P!=null),highlight:E===I.id})})},I.id)),p.jsx("div",{onClick:C,style:{..._c.card,border:R?`2px solid ${a.palette.secondary.main}`:_c.card.border},role:"button",tabIndex:0,onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),C())},children:p.jsx("div",{style:_c.cardContent,children:p.jsx(H,{sx:{width:"100%",height:30,minHeight:30,border:"1px dashed",borderColor:"divider",borderRadius:1,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:R?"action.selected":"action.hover",color:"text.primary",transition:a.transitions.create(["background-color"],{duration:a.transitions.duration.shorter})},children:p.jsx(VW,{sx:{fontSize:18,color:"text.primary"}})})})})]}),p.jsx(ZE,{in:l,timeout:"auto",unmountOnExit:!0,children:p.jsxs(H,{sx:{mt:2,p:2,borderRadius:1,border:1,borderColor:"divider",bgcolor:"background.paper"},children:[r===2?p.jsxs(qe,{gap:2,sx:{mt:1},children:[p.jsxs(xe,{variant:"body2",color:"text.secondary",children:[u,"% | ",A,"%"]}),p.jsx(ng,{value:u,min:1,max:99,step:1,valueLabelDisplay:"auto","aria-label":i("inputs.layout.custom.split2"),onChange:(I,P)=>d(P)}),p.jsx(Yx,{fractions:[u,A],highlight:!0})]}):p.jsxs(qe,{gap:2,sx:{mt:1},children:[p.jsxs(xe,{variant:"body2",color:"text.secondary",children:[f,"% | ",h,"% | ",M,"%"]}),p.jsxs(H,{children:[p.jsx(xe,{variant:"caption",color:"text.secondary",component:"div",children:i("inputs.layout.custom.firstColumn")}),p.jsx(ng,{value:f,min:1,max:98,step:1,valueLabelDisplay:"auto",onChange:w})]}),p.jsxs(H,{children:[p.jsx(xe,{variant:"caption",color:"text.secondary",component:"div",children:i("inputs.layout.custom.secondColumn")}),p.jsx(ng,{value:h,min:1,max:100-f-1,step:1,valueLabelDisplay:"auto",onChange:D})]}),p.jsx(Yx,{fractions:[f,h,M],highlight:!0})]}),p.jsx(ht,{variant:"contained",size:"small",sx:{mt:2},onClick:k,children:p.jsx(xe,{variant:"button",component:"span",sx:{color:"#FFFFFF",fontWeight:"bold"},children:i("inputs.layout.custom.apply")})})]})})]})};function O$e({label:t,tooltipTitle:e,hideWarning:n}){return p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[p.jsx(on,{label:t}),!n&&p.jsx(Pt,{title:e,placement:"top",children:p.jsx(cn,{size:"small",color:"warning",disableRipple:!0,sx:{p:0,cursor:"help",lineHeight:0,"&:hover":{backgroundColor:"transparent"}},children:p.jsx(gX,{"aria-hidden":!0})})})]})}const yX=(t=>p.jsx(Rr,{...t,viewBox:"0 0 24 24",children:p.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[p.jsx("path",{d:"M10.5 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v5.5m-6.7 9.1l1-.4M15 3v7.5m.2 6.4l-.9-.3m2.3 5.1l.3-.9m-.1-5.5l-.4-1m2.7.9l.3-.9m.2 7.4l-.4-1m1.5-3.9l1-.4m0 3l-.9-.3M9 3v18"}),p.jsx("circle",{cx:"18",cy:"18",r:"3"})]})}));yX.muiName="ColumnsCountIcon";function R$e({data:t,setData:e}){const[,n]=T.useState(null),[r,i]=T.useState(t.props?.columnsCount??2),a=Rd(),o=or(),s=To(),{t:l}=Ie("inspector"),c=h=>{const g=X.getState().document,_=h.filter(b=>g[b]?.type==="Image");o==="desktop"&&_.forEach(b=>{const y=g[b];if(y?.type!=="Image")return;const E=y.data;T$e(b,v=>{lb(b,x=>x.type!=="Image"?x:{...x,data:v})},E)})},u=h=>{const g=Od.safeParse(h);g.success?(g.data.props.columns.map(_=>c(_.childrenIds)),e(g.data),r&&g.data.props?.columnsCount!==r&&i(g.data.props?.columnsCount??2),n(null)):(console.error("Error on columns: ",g.error),n(g.error))},d={layout:"layout-50-50",fixedWidths:[50,50,null],columnsCount:2},f={layout:"layout-33-34-33",fixedWidths:[33,34,33],columnsCount:3},m=h=>{const g=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:[...t.props.columns];return h==="2"?{...d,columns:g}:{...f,columns:g}};return p.jsxs(uu,{title:l("inputs.panels.columns.title"),children:[(a=="block-configuration"||s)&&p.jsxs(p.Fragment,{children:[p.jsx(Nt,{icon:yX,label:l("inputs.panels.columns.countLabel"),children:p.jsxs(Qr,{children:[p.jsx(on,{label:l("inputs.panels.columns.countLabel")}),p.jsx(H,{sx:{...YA,paddingLeft:0,paddingRight:0,height:"auto",minHeight:`${Pc}px`},children:p.jsx(J5,{value:t.props?.columnsCount===2?"2":"3",onChange:h=>{const g=m(h);u({...t,props:{...t.props,...g}})},options:[{value:"2",label:"2",icon:p.jsx(ADe,{fontSize:"small"})},{value:"3",label:"3",icon:p.jsx(jDe,{fontSize:"small"})}]})})]})}),p.jsx(Nt,{icon:IDe,label:l("inputs.panels.columns.layoutLabel","Layout"),children:p.jsx(A$e,{columns:t.props?.columnsCount??3,defaultValue:t.props?.layout,fixedWidths:t.props?.fixedWidths??void 0,onChange:({layout:h,fixedWidths:g})=>{const _=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:t.props.columns;u({...t,props:{...t.props,layout:h,fixedWidths:g,columns:_}})}})})]}),(a=="css"||s)&&p.jsxs(p.Fragment,{children:[p.jsx(cb,{}),p.jsx(Nt,{icon:x1,label:l("inputs.panels.columns.stackColumnsOnMobile"),children:p.jsxs(Qr,{children:[p.jsx(O$e,{label:l("inputs.panels.columns.stackColumnsOnMobile"),tooltipTitle:l("inputs.panels.columns.stackColumnsOnMobileWarning")}),p.jsx(H,{sx:{width:"100%",...YA,paddingLeft:0,paddingRight:0,height:"auto",minHeight:`${Pc}px`},children:p.jsx(J5,{value:t.props?.stackColumnsOnMobile?"stacked":"sideBySide",onChange:h=>{u({...t,props:{...t.props,stackColumnsOnMobile:h==="stacked"}})},options:[{value:"sideBySide",label:l("inputs.panels.columns.stackToggleSideBySide"),icon:p.jsx(nN,{fontSize:"small"})},{value:"stacked",label:l("inputs.panels.columns.stackToggleStacked"),icon:p.jsx(NDe,{fontSize:"small"})}]})})]})}),p.jsx(Nt,{icon:Pwe,label:l("inputs.alignment.label"),children:p.jsx(D$e,{data:t,updateData:e})}),p.jsx(na,{names:["backgroundColor","background","padding","mobilePadding"],value:t.style,onChange:h=>u({...t,style:h})})]})]})}function vX({data:t,setData:e}){const[,n]=T.useState(null),{t:r}=Ie("inspector"),i=a=>{const o=j_.safeParse(a);o.success?(e(o.data),n(null)):n(o.error)};return p.jsx(uu,{title:r("inputs.panels.container.title"),children:p.jsx(na,{names:["backgroundColor","background","border","borderMobile","shape","padding","mobilePadding"],value:t.style,shapeSteps:30,onChange:a=>i({...t,style:a})})})}function EX({data:t,setData:e}){const[,n]=T.useState(null),{t:r}=Ie("inspector"),i=a=>{const o=H_.safeParse(a);o.success?(e(o.data),n(null)):n(o.error)};return p.jsx(uu,{title:r("inputs.panels.divider.title"),children:p.jsx(na,{names:["width","widthMobile","height","heightMobile","color","backgroundColor","textAlign","textAlignMobile","padding","mobilePadding"],value:t.style,onChange:a=>i({...t,style:a})})})}const I$e=({label:t,linkColor:e,underline:n=!1,onChange:r})=>{const[i,a]=T.useState(e??"#FF0000"),[o,s]=T.useState(n),{t:l}=Ie("inspector"),c=t??l("inputs.links.color"),u=o?"enabled":"disabled",d={container:{width:"100%"}};T.useEffect(()=>{e!==i&&a(e??"#FF0000")},[e]),T.useEffect(()=>{n!==o&&s(n)},[n]);const f=h=>{const g=h??"#FF0000";a(g),r({linkColor:g,underline:o})},m=(h,g)=>{if(!g)return;const _=g==="enabled";s(_),r({linkColor:i,underline:_})};return p.jsxs(Qr,{children:[p.jsx(td,{label:c,defaultValue:i,onChange:f}),p.jsx(on,{label:l("inputs.links.underline")}),p.jsx(H,{sx:d.container,children:p.jsxs(Ad,{value:u,exclusive:!0,fullWidth:!0,onChange:m,sx:{width:"100%"},children:[p.jsx(Un,{value:"enabled",children:p.jsx(Pt,{title:l("inputs.links.underlineOn"),children:p.jsx(H,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:p.jsx(rY,{fontSize:"small"})})})}),p.jsx(Un,{value:"disabled",children:p.jsx(Pt,{title:l("inputs.links.underlineOff"),children:p.jsx(H,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:p.jsx(tY,{fontSize:"small"})})})})]})})]})};function SX({data:t,setData:e}){const[,n]=T.useState(null),{t:r}=Ie("inspector"),i=a=>{const o=gS.safeParse(a);o.success?(e(o.data),n(null)):n(o.error)};return p.jsxs(qe,{gap:1,children:[p.jsx(Nt,{icon:v_,label:r("inputs.panels.emailLayout.backgroundColor"),children:p.jsx(td,{label:r("inputs.panels.emailLayout.backgroundColor"),defaultValue:t.backdropColor??"#F5F5F5",onChange:a=>i({...t,backdropColor:a})})}),p.jsx(Nt,{icon:eDe,label:r("inputs.panels.emailLayout.canvasColor"),children:p.jsx(td,{label:r("inputs.panels.emailLayout.canvasColor"),defaultValue:t.canvasColor??"#FFFFFF",onChange:a=>i({...t,canvasColor:a})})}),p.jsx(Nt,{icon:c0,label:r("inputs.panels.emailLayout.fontFamily"),children:p.jsx(HN,{label:r("inputs.panels.emailLayout.fontFamily"),defaultValue:t.fontFamily||cW.FAMILY,onChange:a=>i({...t,fontFamily:a})})}),p.jsx(Nt,{icon:u0,label:r("inputs.panels.emailLayout.textColor"),children:p.jsx(td,{label:r("inputs.panels.emailLayout.textColor"),defaultValue:t.textColor??"#262626",onChange:a=>i({...t,textColor:a})})}),p.jsx(Nt,{icon:eN,label:r("inputs.panels.emailLayout.linksLabel"),children:p.jsx(I$e,{label:r("inputs.panels.emailLayout.linksLabel"),linkColor:t.linkGlobal?.linkColor||"#000000",underline:t.linkGlobal?.underline||!1,onChange:a=>i({...t,linkGlobal:a})})})]})}const N$e=(t,e,n)=>{const r=or();T.useEffect(()=>{const i=()=>{if(!t||!document||r=="mobile")return;const s=Xt(t),l=document.querySelector(`.${s}`);if(!l)return;const c=l.parentElement;if(!c)return;const u=Math.ceil(c.getBoundingClientRect().width);n.props?.size===void 0||n.props?.size==="original"||n.props?.touched&&n.props?.width<=u||n.props?.width!==u&&!n.props?.touched&&e({...n,props:{...n.props,width:u}})};i();const a=new ResizeObserver(i),o=document.querySelector(`.${Xt(t)}`);return o?.parentElement&&a.observe(o.parentElement),()=>{a.disconnect()}},[t,e,n,r])},P$e=({data:t,setData:e,blockId:n})=>{const{t:r}=Ie("inspector"),[i,a]=T.useState(!1),[o,s]=T.useState(()=>!!window.__emailBuilderEnableAI),[,l]=T.useState(null),[c,u]=T.useState(""),[d,f]=T.useState(!1),[m,h]=T.useState(""),[g,_]=T.useState(!1),b=T.useRef(null),[y,E]=T.useState(null),v=B1e(),x=U1e(),S=v||x,[C,k]=T.useState(()=>!!window.__emailBuilderUnsplashEnabled);T.useEffect(()=>{const G=()=>{k(!!window.__emailBuilderUnsplashEnabled)};return G(),window.addEventListener("email-builder-unsplash-updated",G),()=>window.removeEventListener("email-builder-unsplash-updated",G)},[]),T.useEffect(()=>{const G=window.__emailBuilderCustomImageProvider;G&&(E(G),setTimeout(()=>{n&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:n,currentImageUrl:t.props?.url||null,alt:t.props?.alt||null}}))},100))},[]);const w=G=>{const Y=Jf.safeParse(G);Y.success?(e(Y.data),l(null)):l(Y.error)},D=(G,Y)=>{const be=G.toLowerCase(),ee=be.includes(".svg")||be.includes("svg"),fe=Y&&(Y.includes("image/svg+xml")||Y.includes("svg"));return ee||!!fe},A=async G=>{try{f(!0),h(""),_(!1);try{new URL(G)}catch{return h(r("inputs.image.invalidUrl")),!1}const Y=new AbortController,be=setTimeout(()=>Y.abort(),1e4);try{const ee=await fetch(G,{method:"HEAD",signal:Y.signal});if(clearTimeout(be),!ee.ok)return h(r("inputs.image.httpError",{status:ee.status,statusText:ee.statusText})),!1;const fe=ee.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(Q=>fe&&fe.toLowerCase().includes(Q.toLowerCase()))?(D(G,fe)&&_(!0),h(""),!0):(h(r("inputs.image.notImage")),!1)}catch(ee){return clearTimeout(be),ee.name==="AbortError"?(h(r("inputs.image.timeout")),!1):new Promise(fe=>{const re=new Image,te=setTimeout(()=>{h(r("inputs.image.timeout")),fe(!1)},1e4);re.onload=()=>{clearTimeout(te),D(G)&&_(!0),h(""),fe(!0)},re.onerror=()=>{clearTimeout(te),h(r("inputs.image.loadError")),fe(!1)},re.src=G})}}catch{return h(r("inputs.image.unexpectedError")),!1}finally{f(!1)}},M=async()=>{c.trim()&&await A(c.trim())&&(w({...t,props:{...t.props,url:c.trim()}}),n&&jp(n),u(""))},R=G=>{G.key==="Enter"&&M()},I=G=>{u(G.target.value),m&&h(""),g&&_(!1)},P=G=>{const Y=["image/png","image/jpeg","image/gif"],ee=G.filter(re=>Y.includes(re.type)&&re.size<=5242880);if(ee.length!==G.length&&alert(r("inputs.common.invalidFiles")),ee.length===0)return;const fe=ee.map(re=>new Promise(te=>{const Q=new FileReader;Q.onload=V=>te(V.target?.result),Q.readAsDataURL(re)}));Promise.all(fe).then(re=>{const te={images:re,id:n||""};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:te})),Wp(!0,n||"")})},L=G=>{G.preventDefault(),a(!0)},B=G=>{const Y=G.currentTarget.getBoundingClientRect(),be=G.clientX,ee=G.clientY;(be<Y.left||be>=Y.right||ee<Y.top||ee>=Y.bottom)&&a(!1)},F=G=>{G.preventDefault(),a(!1);const Y=Array.from(G.dataTransfer.files);Y.length>0&&P(Y)},q=()=>{const G=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(G)};T.useEffect(()=>{const G=window.__emailBuilderEnableAI;G!==void 0&&s(!!G);const Y=be=>{const{detail:ee}=be;s(!!ee)};return window.addEventListener("email-builder-ai-generation",Y),()=>{window.removeEventListener("email-builder-ai-generation",Y)}},[]),T.useEffect(()=>{const G=fe=>{const{detail:re}=fe;Wp(!1,re.id||""),n&&(Bh(n,{url:re.url}),jp(n)),GG(!1)},Y=fe=>{Wp(fe?.detail?.uploading??!1,fe?.detail?.id??"")},be=()=>{b?.current?.click()},ee=fe=>{if(!n)return;const re=fe.detail;if(typeof re=="string"){Bh(n,{url:re}),jp(n);return}if(re&&typeof re=="object"&&typeof re.url=="string"){const te={url:re.url};typeof re.alt=="string"&&(te.alt=re.alt),Bh(n,te)}};return window.addEventListener("email-builder-set-image",ee),window.addEventListener("email-builder-upload-image-receive",G),window.addEventListener("email-builder-upload-file",be),window.addEventListener("email-builder-toggle-upload-file",Y),()=>{window.removeEventListener("email-builder-toggle-upload-file",Y),window.removeEventListener("email-builder-upload-image-receive",G),window.removeEventListener("email-builder-set-image",ee),window.removeEventListener("email-builder-upload-file",be)}},[n]),T.useEffect(()=>{t.props?.url&&_(D(t.props.url))},[t.props?.url]);const oe=()=>p.jsxs(qe,{gap:1,children:[p.jsx(Qr,{children:v&&p.jsxs(p.Fragment,{children:[p.jsx(on,{label:r("inputs.image.urlLabel")}),p.jsxs(qe,{direction:"row",gap:1,children:[p.jsx(Ir,{fullWidth:!0,placeholder:r("inputs.image.urlPlaceholder"),value:c,onChange:I,onKeyPress:R,error:!!m,disabled:d,sx:Ko}),p.jsx(ht,{variant:"contained",onClick:M,disabled:!c.trim()||d,sx:{minWidth:"auto",px:2},children:d?p.jsx(ti,{size:20,color:"inherit"}):r("inputs.common.add")})]}),m&&p.jsx($n,{severity:"error",sx:{mt:1,fontSize:"0.875rem"},children:m}),g&&p.jsx($n,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:p.jsx(cn,{"aria-label":r("inputs.common.close"),color:"inherit",size:"small",onClick:()=>_(!1),children:p.jsx(tb,{fontSize:"inherit"})}),children:r("inputs.common.svgWarning")})]})}),v&&x&&p.jsxs(qe,{direction:"row",alignItems:"center",gap:1,children:[p.jsx(Br,{sx:{flexGrow:1}}),p.jsx(xe,{variant:"caption",sx:{color:"text.secondary"},children:r("inputs.backgroundImage.or")}),p.jsx(Br,{sx:{flexGrow:1}})]}),x&&p.jsxs(H,{onDragOver:L,onDragLeave:B,onDrop:F,sx:{width:"100%",border:"2px dashed",borderColor:i?"primary.main":"divider",borderRadius:"8px",padding:3,textAlign:"center",bgcolor:i?"action.hover":"background.paper",transition:"all 0.2s ease"},children:[p.jsx(H,{sx:{display:"flex",justifyContent:"center",mb:1},children:p.jsx(cY,{sx:{fontSize:28,color:"primary.main"}})}),p.jsxs("label",{style:{cursor:"pointer"},children:[p.jsx("input",{ref:b,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:G=>{const Y=G.target.files;Y&&Y.length>0&&P(Array.from(Y))}}),p.jsx(xe,{component:"span",sx:{fontWeight:600,color:"primary.main"},children:r("inputs.common.uploadFile")}),p.jsxs(xe,{component:"span",sx:{fontWeight:500,color:"text.secondary"},children:[" ",r("inputs.common.dragAndDrop")]})]}),p.jsx(xe,{variant:"caption",sx:{color:"text.secondary",mt:1,display:"block"},children:r("inputs.common.fileInfo")})]}),!y&&P1e()&&p.jsxs(p.Fragment,{children:[p.jsxs(qe,{direction:"row",alignItems:"center",gap:1,children:[p.jsx(Br,{sx:{flexGrow:1}}),p.jsx(xe,{variant:"caption",sx:{color:"text.secondary"},children:r("inputs.backgroundImage.or")}),p.jsx(Br,{sx:{flexGrow:1}})]}),p.jsx(ht,{variant:"outlined",onClick:q,startIcon:p.jsx(bDe,{}),fullWidth:!0,children:r("inputs.backgroundImage.browseGallery")})]})]});return p.jsxs(qe,{gap:1,children:[p.jsx(hX,{imageUrl:t.props?.url??null,alt:t.props?.alt??"",blockId:n,onRemove:()=>{n&&(Bh(n,{url:null}),jp(n)),w({...t,props:{...t.props??{},url:null}})}}),p.jsx(uX,{tabs:[{key:"gallery",label:r("inputs.tabs.gallery"),visible:C,render:()=>p.jsx(fX,{blockId:n,source:"image"})},{key:"yourGallery",label:r("inputs.tabs.yourGallery"),visible:!!y,render:()=>p.jsx(H,{children:y})},{key:"upload",label:r("inputs.tabs.upload"),visible:S,render:oe},{key:"generate",label:r("inputs.tabs.generate"),visible:o,render:()=>p.jsx(H,{sx:{py:1},children:p.jsx(mX,{src:t.props?.url,style:{width:"100%",margin:0}})})}],defaultTab:"upload"})]})},M$e=({defaultValue:t="original",scale:e=100,onChange:n})=>{const[r,i]=T.useState(t),[a,o]=T.useState(e),s=sn(),{t:l}=Ie("inspector"),c={container:{width:"100%"},label:{color:s.palette.text.primary},sliderContainer:{marginTop:"16px",padding:"0 8px"},slider:{"& .MuiSlider-thumb":{backgroundColor:s.palette.primary.main,"&:hover":{boxShadow:`0 0 0 8px ${s.palette.primary.main}20`}},"& .MuiSlider-rail":{backgroundColor:s.palette.grey[300]},"& .MuiSlider-track":{backgroundColor:s.palette.primary.main}},scaleValue:{color:s.palette.text.secondary}};T.useEffect(()=>{(t!==r||e!==a)&&(t!==r&&i(t),t==="scale"&&o(e))},[t,e]);const u=(f,m)=>{m!==null&&(i(m),n&&n({mode:m,scale:m==="scale"?a:void 0}))},d=f=>{o(f),n&&n({mode:r,scale:f})};return p.jsxs(Qr,{children:[p.jsx(on,{label:l("inputs.sizeSelector.label")}),p.jsxs(H,{sx:c.container,children:[p.jsxs(Ad,{value:r,exclusive:!0,onChange:u,sx:{width:"100%"},children:[p.jsx(Un,{value:"original",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(ZI,{fontSize:"small"}),p.jsx("span",{children:l("inputs.sizeSelector.contain")})]})}),p.jsx(Un,{value:"fill",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(JI,{fontSize:"small"}),p.jsx("span",{children:l("inputs.sizeSelector.cover")})]})}),p.jsx(Un,{value:"scale",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[p.jsx(CDe,{fontSize:"small"}),p.jsx("span",{children:l("inputs.sizeSelector.scale")})]})})]}),p.jsx(ZE,{in:r==="scale",children:p.jsx(H,{sx:c.sliderContainer,children:p.jsx(Cr,{iconLabel:p.jsx(qDe,{}),value:a,setValue:d,marks:!1,units:"%",min:1,max:100})})})]})]})},e9={cover:p.jsx(JI,{fontSize:"small"}),contain:p.jsx(ZI,{fontSize:"small"}),fill:p.jsx(XI,{fontSize:"small"})},t9=t=>t==="cover"||t==="contain"||t==="fill"?e9[t]:e9.cover,n9=t=>t.length===0?t:t.charAt(0).toUpperCase()+t.slice(1);function L$e({data:t,setData:e}){const[n,r]=T.useState(null),i=q_(),a=Rd(),o=or(),s=To(),{t:l}=Ie("inspector");N$e(i||"",e,t),T.useEffect(()=>{i&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:i,currentImageUrl:t.props?.url||null,alt:t.props?.alt||null,source:"image"}}))},[i,t.props?.url,t.props?.alt]);const c=T.useCallback(v=>{const x=Jf.safeParse(v);x.success?JSON.stringify(t)!==JSON.stringify(x.data)&&(e(x.data),r(null)):r(x.error)},[t,e]),u=T.useCallback((v,x,S)=>{const C=k$e(i)||Hv,k={...v.props};if(S&&(k.touchedMobile=!0),x.mode==="original"){const w=v.props?.original_width??null;return S?{...k,sizeMobile:x.mode,widthMobile:w}:{...k,size:x.mode,width:w,sizeMobile:k.touchedMobile?k.sizeMobile:x.mode,widthMobile:k.touchedMobile?k.widthMobile:w}}if(x.mode==="fill")return S?{...k,sizeMobile:x.mode,widthMobile:null}:{...k,size:x.mode,width:null,sizeMobile:k.touchedMobile?k.sizeMobile:x.mode,widthMobile:k.touchedMobile?k.widthMobile:null};if(x.mode==="scale"){const w=Math.ceil(C/100*x.scale);return S?{...k,sizeMobile:x.mode,scaleMobile:x.scale,widthMobile:w}:{...k,size:x.mode,scale:x.scale,width:w,sizeMobile:k.touchedMobile?k.sizeMobile:x.mode,scaleMobile:k.touchedMobile?k.scaleMobile:x.scale,widthMobile:k.touchedMobile?k.widthMobile:w}}return k},[i]),d=T.useCallback((v,x)=>{const S=u(t,v,x);c({...t,props:S})},[t,c,u]),f=T.useMemo(()=>o!=="desktop"?{size:t.props?.touchedMobile?t.props?.sizeMobile:t.props?.size??"original",scale:t.props?.touchedMobile?t.props?.scaleMobile:t.props?.scale}:{size:t.props?.size??"original",scale:t.props?.scale},[o,t.props?.touchedMobile,t.props?.sizeMobile,t.props?.size,t.props?.scaleMobile,t.props?.scale]),m=T.useCallback(v=>{c({...t,props:{...t.props,alt:v}})},[t,c]),h=T.useCallback(v=>{const x=v.trim().length===0?null:v.trim();c({...t,props:{...t.props,linkHref:x}})},[t,c]),g=T.useCallback(v=>{c({...t,style:v})},[t,c]),_=T.useMemo(()=>o!=="desktop"?t.style?.heightMobile??t.style?.height??void 0:t.style?.height??void 0,[o,t.style?.height,t.style?.heightMobile]),b=T.useCallback(v=>{const x=o!=="desktop",S={...t.style??{}};x?S.heightMobile=v:S.height=v,c({...t,style:S})},[t,c,o]),y=T.useCallback(v=>{const x=o!=="desktop",S={...t.style??{}};x?S.objectFitMobile=v:S.objectFit=v,c({...t,style:S})},[t,c,o]),E=T.useCallback(v=>{const x=o!=="desktop",S={...t.style??{}};x?S.objectPositionMobile=v:S.objectPosition=v,c({...t,style:S})},[t,c,o]);return p.jsxs(uu,{title:l("inputs.panels.image.title"),children:[(a==="block-configuration"||s)&&p.jsxs(p.Fragment,{children:[p.jsx(Nt,{icon:fY,label:l("inputs.panels.image.title"),children:p.jsx(P$e,{data:t,setData:e,blockId:i})}),p.jsx(Nt,{icon:sDe,label:l("inputs.panels.image.altLabel"),children:p.jsx(yE,{label:l("inputs.panels.image.altLabel"),placeholder:l("inputs.panels.image.altPlaceholder"),defaultValue:t.props?.alt??"",onChange:m})}),p.jsx(Nt,{icon:eN,label:l("inputs.panels.image.urlLabel"),children:p.jsx(yE,{label:l("inputs.panels.image.urlLabel"),placeholder:l("inputs.panels.image.urlPlaceholder"),defaultValue:t.props?.linkHref??"",onChange:h})}),p.jsx(Nt,{icon:XI,label:l("inputs.panels.image.sizeLabel","Size"),children:p.jsx(M$e,{defaultValue:f.size,scale:f.scale??void 0,onChange:v=>d(v,o!=="desktop")})}),p.jsx(Nt,{icon:d_,label:l("inputs.panels.image.heightLabel"),children:p.jsxs(p.Fragment,{children:[p.jsx(lO,{label:l("inputs.panels.image.heightLabel"),defaultValue:_??void 0,min:0,max:800,step:4,onChange:v=>b(v>0?v:null)}),_?p.jsxs(qe,{direction:"row",gap:2,sx:{mt:1},children:[p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsx(on,{label:l("inputs.panels.image.objectFitLabel")}),p.jsx(ha,{style:{width:"100%"},size:"small",value:o==="desktop"?t.style?.objectFit??"cover":t.style?.objectFitMobile??t.style?.objectFit??"cover",onChange:v=>y(v.target.value),renderValue:v=>{const x=String(v??"cover");return p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[t9(x),l(`inputs.panels.image.objectFit${n9(x)}`)]})},children:["cover","contain","fill"].map(v=>p.jsx(Yr,{value:v,sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important"},children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:1},children:[t9(v),l(`inputs.panels.image.objectFit${n9(v)}`)]})},v))})]}),(()=>{const v=o==="desktop"?t.style?.objectFit??"cover":t.style?.objectFitMobile??t.style?.objectFit??"cover",x=o==="desktop"?t.style?.objectPosition??"center":t.style?.objectPositionMobile??t.style?.objectPosition??"center";return v==="fill"?null:p.jsxs("div",{style:{flex:1,minWidth:0},children:[p.jsx(on,{label:l("inputs.panels.image.objectPositionLabel")}),p.jsx(ha,{style:{width:"100%"},size:"small",value:x,onChange:S=>E(String(S.target.value)),renderValue:S=>{const C=String(S??"center");return p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[hE(C),l(`inputs.backgroundImage.positions.${gE(C)}`)]})},children:i$e.map(S=>p.jsx(Yr,{value:S,sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important"},children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",gap:1},children:[hE(S),l(`inputs.backgroundImage.positions.${gE(S)}`)]})},S))})]})})()]}):null]})})]}),p.jsx(cb,{}),p.jsx(na,{names:["textAlign","textAlignMobile","backgroundColor","shape","padding","mobilePadding"],value:t.style,shapeMaxValue:300,shapeSteps:20,onChange:g})]})}function F$e({data:t,setData:e}){const n=Rd(),r=To(),{t:i}=Ie("inspector"),a=t.style||{},o=s=>{const l={...a||{},...s||{}};e({...t,style:l})};return p.jsxs(uu,{title:i("inputs.panels.notionText.title","Text"),children:[(n==="block-configuration"||r)&&p.jsxs(p.Fragment,{children:[r?p.jsxs(p.Fragment,{children:[p.jsx(na,{disabledCSSValidation:!0,names:["fontFamily"],value:a,onChange:o}),p.jsx(na,{disabledCSSValidation:!0,names:["lineHeight"],value:a,onChange:o})]}):p.jsxs("div",{style:{display:"flex",gap:"8px"},children:[p.jsx("div",{style:{flex:1},children:p.jsx(na,{disabledCSSValidation:!0,names:["fontFamily"],value:a,onChange:o})}),p.jsx("div",{style:{flex:1},children:p.jsx(na,{disabledCSSValidation:!0,names:["lineHeight"],value:a,onChange:o})})]}),p.jsx(na,{disabledCSSValidation:!0,names:["fontSize","fontSizeMobile"],value:a,onChange:o})]}),(n==="css"||r)&&p.jsxs(p.Fragment,{children:[p.jsx(cb,{}),p.jsx(na,{names:["backgroundColor","border","borderMobile","padding","mobilePadding"],value:a,onChange:o})]})]})}const B$e="https://maildrill-dev.s3.us-east-2.amazonaws.com/icons/",$$e={positive:!0,original:!0,negative:!0},U$e={small:!0,medium:!0,large:!0,xlarge:!0},ae={theme:"positive",size:"medium"},On=(t,e,n="medium")=>{const r=GN.find(a=>a.key===n)?.value,i=CX.find(a=>a.key===e)?.value;return`${B$e}${t}_${i}_${r}.png`},Bn=t=>GN.find(e=>e.key===t)?.value||"36px",GN=[{value:"24px",key:"small",label:"Small"},{value:"36px",key:"medium",label:"Medium"},{value:"48px",key:"large",label:"Large"}],CX=[{value:"Positive",key:"positive",label:"Light"},{value:"Original",key:"original",label:"Color"},{value:"Negative",key:"negative",label:"Dark"}],hv=[{key:"facebook",label:"Facebook",iconName:"Facebook",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Facebook",ae.theme,ae.size),href:"https://www.facebook.com/your-profile"},{key:"web",label:"Web",iconName:"Web",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Web",ae.theme,ae.size),href:"https://www.google.com"},{key:"mail",label:"Mail",iconName:"Mail",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Mail",ae.theme,ae.size),href:"https://mail.google.com/"},{key:"apple",label:"Apple",iconName:"Apple",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Apple",ae.theme,ae.size),href:"https://www.apple.com/"},{key:"bluesky",label:"Bluesky",iconName:"Bluesky",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Bluesky",ae.theme,ae.size),href:"https://bsky.app/"},{key:"clubhouse",label:"ClubHouse",iconName:"Clubhouse",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Clubhouse",ae.theme,ae.size),href:"https://www.clubhouse.com/"},{key:"dribbble",label:"Dribbble",iconName:"Dribbble",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Dribbble",ae.theme,ae.size),href:"https://dribbble.com/"},{key:"figma",label:"Figma",iconName:"Figma",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Figma",ae.theme,ae.size),href:"https://www.figma.com/"},{key:"github",label:"Github",iconName:"Github",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Github",ae.theme,ae.size),href:"https://github.com/"},{key:"google",label:"Google",iconName:"Google",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Google",ae.theme,ae.size),href:"https://google.com/"},{key:"instagram",label:"Instagram",iconName:"Instagram",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Instagram",ae.theme,ae.size),href:"https://www.instagram.com/your-profile"},{key:"linkedin",label:"LinkedIn",iconName:"LinkedIn",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("LinkedIn",ae.theme,ae.size),href:"https://www.linkedin.com/in/your-profile"},{key:"medium-social",label:"Medium",iconName:"Medium",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Medium",ae.theme,ae.size),href:"https://medium.com/"},{key:"messenger",label:"Messenger",iconName:"Messenger",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Messenger",ae.theme,ae.size),href:"https://www.messenger.com/"},{key:"pinterest",label:"Pinterest",iconName:"Pinterest",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Pinterest",ae.theme,ae.size),href:"https://www.pinterest.com/"},{key:"reddit",label:"Reddit",iconName:"Reddit",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Reddit",ae.theme,ae.size),href:"https://www.reddit.com/"},{key:"signal",label:"Signal",iconName:"Signal",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Signal",ae.theme,ae.size),href:"https://signal.org/"},{key:"snapchat",label:"Snapchat",iconName:"Snapchat",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Snapchat",ae.theme,ae.size),href:"https://www.snapchat.com/"},{key:"spotify",label:"Spotify",iconName:"Spotify",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Spotify",ae.theme,ae.size),href:"https://www.spotify.com/"},{key:"telegram",label:"Telegram",iconName:"Telegram",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Telegram",ae.theme,ae.size),href:"https://t.me/your-profile"},{key:"threads",label:"Threads",iconName:"Threads",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Threads",ae.theme,ae.size),href:"https://www.threads.net/"},{key:"tiktok",label:"TikTok",iconName:"TikTok",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("TikTok",ae.theme,ae.size),href:"https://www.tiktok.com/@your-profile"},{key:"tumblr",label:"Tumblr",iconName:"Tumblr",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Tumblr",ae.theme,ae.size),href:"https://www.tumblr.com/"},{key:"twitch",label:"Twitch",iconName:"Twitch",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("Twitch",ae.theme,ae.size),href:"https://www.twitch.tv/"},{key:"vk",label:"VK",iconName:"VK",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("VK",ae.theme,ae.size),href:"https://vk.com/"},{key:"whatsapp",label:"WhatsApp",iconName:"WhatsApp",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("WhatsApp",ae.theme,ae.size),href:"https://www.whatsapp.com/"},{key:"x",label:"X",iconName:"X",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("X",ae.theme,ae.size),href:"https://x.com/your-profile"},{key:"youtube",label:"YouTube",iconName:"YouTube",theme:ae.theme,size:ae.size,sizePx:Bn(ae.size),url:On("YouTube",ae.theme,ae.size),href:"https://www.youtube.com/channel/your-channel-id"}],z$e=({element:t,index:e,moveItem:n,onSelectChange:r,onUrlChange:i,onRemove:a,onDuplicate:o,canRemove:s,theme:l})=>{const c=T.useRef(null),[u,d]=T.useState(null),{t:f}=Ie("inspector"),m=w=>{const D=w.getClientOffset(),A=c.current?.getBoundingClientRect();if(!D||!A)return null;const M=(A.bottom-A.top)/2;return D.y-A.top<M?"up":"down"},[{handlerId:h,isOver:g},_]=FE(()=>({accept:"social-media-item",collect(w){return{handlerId:w.getHandlerId(),isOver:w.isOver({shallow:!0})}},hover(w,D){if(!c.current)return;if(w.index===e){d(null);return}if(!D.isOver({shallow:!0})){d(null);return}const R=m(D);d(R)},drop(w,D){if(d(null),!c.current)return;const A=w.index,M=e;if(A===M)return;const R=m(D);let I=M;R==="down"&&(I=M+1),A<I&&(I=I-1),setTimeout(()=>{n(A,I)},0),w.index=I},end:()=>{d(null)}}),[t.id,e,n]),[{isDragging:b},y]=LE(()=>({type:"social-media-item",item:()=>({id:t.id,index:e}),collect:w=>({isDragging:w.isDragging()}),end:()=>{d(null)}}),[t.id,e]);T.useEffect(()=>{g||d(null)},[g]);const E=b?.4:1;T.useEffect(()=>{if(c.current&&y&&_){const w=c.current;y(w),_(w)}},[y,_]);const v=()=>{setTimeout(()=>a(e),0)},x=()=>{setTimeout(()=>o(e),0)},S=w=>{const D=w.target.value;setTimeout(()=>r(e,D,t),0)},C=w=>{const D=w.target.value;setTimeout(()=>i(e,D,t),0)},k=()=>p.jsxs("div",{style:{height:"3px",background:l.palette.secondary.main,position:"relative",color:l.palette.secondary.main,margin:"4px 0"},children:[p.jsx("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:p.jsx("path",{fill:"currentColor",d:"M28 12H10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2M10 4v6h18V4zm18 26H10a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2m-18-8v6h18v-6zm-1-6l-5.586-5.586L2 11.828L6.172 16L2 20.172l1.414 1.414z"})}),p.jsx("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:p.jsx("path",{fill:"currentColor",d:"M28 12H10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2M10 4v6h18V4zm18 26H10a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2h18a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2m-18-8v6h18v-6zm-1-6l-5.586-5.586L2 11.828L6.172 16L2 20.172l1.414 1.414z"})})]});return p.jsxs(p.Fragment,{children:[u==="up"&&p.jsx(k,{}),p.jsxs(qe,{ref:c,"data-handler-id":h,sx:{border:1,borderColor:"divider",padding:1,paddingTop:0,borderRadius:1,backgroundColor:"background.paper",marginBottom:1.5,opacity:E,cursor:b?"grabbing":"grab",boxShadow:b?l.shadows[3]:"none"},gap:1,children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:`1px solid ${l.palette.divider}`},children:[p.jsx("div",{style:{display:"flex",alignItems:"center"},children:p.jsx(GW,{sx:{color:b?"primary.main":"text.secondary",cursor:"grab",marginLeft:-.9,"&:hover":{color:"primary.main"}}})}),p.jsxs("div",{children:[p.jsx(Pt,{title:"Duplicate",placement:"left",children:p.jsx(cn,{color:"primary",size:"small",onClick:x,children:p.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:p.jsx("path",{d:"M18 2.5H9C7.9 2.5 7 3.4 7 4.5V16.5C7 17.6 7.9 18.5 9 18.5H18C19.1 18.5 20 17.6 20 16.5V4.5C20 3.4 19.1 2.5 18 2.5ZM18 16.5H9V4.5H18V16.5ZM3 15.5V13.5H5V15.5H3ZM3 10H5V12H3V10ZM10 20.5H12V22.5H10V20.5ZM3 19V17H5V19H3ZM5 22.5C3.9 22.5 3 21.6 3 20.5H5V22.5ZM8.5 22.5H6.5V20.5H8.5V22.5ZM13.5 22.5V20.5H15.5C15.5 21.6 14.6 22.5 13.5 22.5ZM5 6.5V8.5H3C3 7.4 3.9 6.5 5 6.5Z",fill:"currentColor"})})})}),s&&p.jsx(Pt,{title:"Remove",placement:"left",children:p.jsx(cn,{color:"error",size:"small",onClick:v,children:p.jsx(aDe,{sx:{fontSize:20}})})})]})]}),p.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"0.5rem"},children:[p.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[p.jsx(on,{label:f("inputs.social.icon")}),p.jsx(ha,{fullWidth:!0,labelId:"demo-simple-select-label",id:"demo-simple-select",value:t.key,size:"small",onChange:S,children:hv.map(w=>p.jsx(Yr,{value:w.key,children:w.label},`${t.id}_${w.key}`))})]}),p.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[p.jsx(on,{label:f("inputs.social.url")}),p.jsx(Ir,{size:"small",fullWidth:!0,value:t.href??"",onChange:C,variant:"outlined",placeholder:"https://your-website.com",sx:Ko})]})]})]}),u==="down"&&p.jsx(k,{})]})};function j$e({items:t=[],onChange:e}){const{t:n}=Ie("inspector"),r=sn(),[i,a]=T.useState(()=>t.map(_=>({..._,id:_.id||$h()}))),[o,s]=T.useState(t[0]?.theme||"positive"),[l,c]=T.useState(t[0]?.size||"medium");T.useEffect(()=>{t.length>0&&(s(t[0].theme),c(t[0].size),a(t.map(_=>({..._,id:_.id||$h()}))))},[t]);const u=(_,b)=>{a(y=>{const E=[...y],[v]=E.splice(_,1);return E.splice(b,0,v),e&&setTimeout(()=>e(E),0),E})},d=()=>{a(_=>{const b={...hv[0],theme:o,size:l,sizePx:Bn(l),url:On(hv[0].iconName,o,l),id:$h()},y=[..._,b];return e&&setTimeout(()=>e(y),0),y})},f=_=>{a(b=>{const y=b.filter((E,v)=>v!==_);return e&&setTimeout(()=>e(y),0),y})},m=(_,b,y)=>{let E=[...i];if(b in $$e?(s(b),E=E.map(v=>{const x=On(v.iconName,b,v.size);return{...v,theme:b,url:x}})):b in U$e&&(c(b),E=E.map(v=>{const x=On(v.iconName,v.theme,b),S=Bn(b);return{...v,size:b,sizePx:S,url:x}})),_!==null&&y){const v=hv.find(x=>x.key===b);v&&(E=E.map((x,S)=>{const C={key:v.key,label:v.label,iconName:v.iconName,href:v.href},k=On(C.iconName,y.theme,y.size);return S===_?{...x,...C,url:k,id:y.id}:x}))}a(E),e&&setTimeout(()=>e(E),0)},h=(_,b,y)=>{const E=i.map((v,x)=>x===_?{...y,href:b}:v);a(E),e&&setTimeout(()=>e(E),0)},g=_=>{a(b=>{const y={...JSON.parse(JSON.stringify(b[_])),id:$h()},E=[...b.slice(0,_+1),y,...b.slice(_+1)];return e&&setTimeout(()=>e(E),0),E})};return p.jsxs(p.Fragment,{children:[p.jsxs("div",{style:{marginBottom:"1rem",display:"grid",gridTemplateColumns:"repeat(2,1fr)",gap:"1rem"},children:[p.jsxs(Qr,{children:[p.jsx(on,{label:n("inputs.social.theme")}),p.jsx(ha,{fullWidth:!0,labelId:"theme-selector",id:"theme-selector",value:o,size:"small",onChange:_=>m(null,_.target.value,null),children:CX.map(_=>p.jsx(Yr,{value:_.key,children:_.label},`${_.key}`))})]}),p.jsxs(Qr,{children:[p.jsx(on,{label:n("inputs.social.size")}),p.jsx(ha,{fullWidth:!0,labelId:"size-selector",id:"size-selector",value:l,size:"small",onChange:_=>m(null,_.target.value,null),children:GN.map(_=>p.jsx(Yr,{value:_.key,children:_.label},`${_.key}`))})]})]}),i?.map((_,b)=>p.jsx(z$e,{element:_,index:b,moveItem:u,onSelectChange:m,onUrlChange:h,onRemove:f,onDuplicate:g,canRemove:i.length>1,theme:r},_.id)),p.jsx(ht,{onClick:d,sx:{borderRadius:1},variant:"contained",endIcon:p.jsx(UW,{}),children:"Add"})]})}const H$e=({data:t,setData:e})=>{const[,n]=T.useState(null),r=or(),{t:i}=Ie("inspector"),a=d=>{const f=_N.safeParse(d);f.success?(e(f.data),n(null)):n(f.error)},o=d=>{a({...t,items:d})},s=d=>{a({...t,style:d})},l=(d,f=!1)=>{if(f){a({...t,gapMobile:d});return}a({...t,gap:d})},c=Rd(),u=To();return p.jsxs(uu,{title:i("inputs.panels.social.title"),children:[(c=="block-configuration"||u)&&p.jsx(Nt,{icon:wDe,label:i("inputs.panels.social.title"),children:p.jsx(H,{sx:{minWidth:120,margin:1},children:p.jsx(j$e,{items:t?.items??[],onChange:o})})}),(c=="css"||u)&&p.jsxs(p.Fragment,{children:[p.jsx(cb,{}),p.jsx(Nt,{icon:YC,label:i("inputs.panels.social.gap"),children:p.jsxs(Qr,{children:[p.jsx(on,{label:i("inputs.panels.social.gap")}),r=="desktop"?p.jsx(Cr,{iconLabel:p.jsx(YC,{sx:{color:"text.primary"}}),value:Number(t?.gap??4),setValue:d=>l(d,!1),marks:!0,step:4,units:"px",min:0,max:40}):p.jsx(Cr,{iconLabel:p.jsx(YC,{sx:{color:"text.primary"}}),value:Number(t?.gapMobile??t?.gap??4),setValue:d=>l(d,!0),marks:!0,step:4,units:"px",min:0,max:40})]})}),p.jsx(na,{names:["textAlign","textAlignMobile","backgroundColor","padding","mobilePadding"],value:t.style,onChange:d=>s(d)})]})]})};function xX({data:t,setData:e}){const[,n]=T.useState(null),{t:r}=Ie("inspector"),i=a=>{const o=G_.safeParse(a);o.success?(e(o.data),n(null)):n(o.error)};return p.jsx(uu,{title:r("inputs.panels.spacer.title"),children:p.jsx(na,{names:["height","heightMobile","backgroundColor"],value:t.style,onChange:a=>i({...t,style:a})})})}function r9(t){return p.jsx(H,{sx:{m:3,p:1,border:"1px dashed",borderColor:"divider"},children:p.jsx(xe,{color:"text.secondary",children:t})})}function G$e(){const t=q_(),e=MG(t||""),n=T.useCallback(a=>{t&&lb(t,()=>a)},[t]);if(!t)return r9("Click on a block to inspect.");if(!e)return r9(`Block with id ${t} was not found. Click on a block to reset.`);const{data:r,type:i}=e;switch(i){case"Button":return p.jsx(x$e,{data:r,setData:a=>n({type:i,data:a})},t);case"ColumnsContainer":return p.jsx(R$e,{data:r,setData:a=>n({type:i,data:a})},t);case"Container":return p.jsx(vX,{data:r,setData:a=>n({type:i,data:a})},t);case"Divider":return p.jsx(EX,{data:r,setData:a=>n({type:i,data:a})},t);case"Image":return p.jsx(L$e,{data:r,setData:a=>n({type:i,data:a})},t);case"EmailLayout":return p.jsx(SX,{data:r,setData:a=>n({type:i,data:a})},t);case"Spacer":return p.jsx(xX,{data:r,setData:a=>n({type:i,data:a})},t);case"NotionText":return p.jsx(F$e,{data:r,setData:a=>n({type:i,data:a})},t);case"SocialMedia":return p.jsx(H$e,{data:r,setData:a=>n({type:i,data:a})},t);default:return p.jsx("pre",{children:JSON.stringify(e,null," ")})}}const V$e=T.memo(G$e),q$e="email-builder-standalone",W$e="4.1.7",Kx={name:q$e,version:W$e};function Y$e({onReset:t,visible:e}){const{t:n}=Ie("inspector");return e?p.jsx(Pt,{title:n("theme.reset"),placement:"left",children:p.jsx(cn,{size:"small",onClick:t,sx:{color:"primary.main",flexShrink:0,width:32,height:32,"&:hover":{backgroundColor:"action.hover"}},children:p.jsx(TDe,{fontSize:"small"})})}):p.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:32,height:32,flexShrink:0}})}const K$e={top:0,right:0,bottom:0,left:0},Q$e={color:v_,padding:bE,fontSize:C1,fontFamily:c0,fontWeight:eY,textAlign:S1,number:C1,border:E2};function X$e({blockType:t,field:e}){const{t:n}=Ie("inspector"),{value:r,isOverridden:i,set:a,reset:o}=Dp(t,e.section,e.key),[s,l]=T.useState(!0),c=y_[t]?.[e.section]?.[e.key],u=n(e.labelKey),d=p.jsx(Y$e,{onReset:o,visible:i}),f=e.icon??Q$e[e.kind];switch(e.kind){case"color":return p.jsx(Nt,{icon:f,label:u,children:p.jsx(mv,{label:u,labelAction:d,defaultValue:r??c??null,onChange:m=>m===null?o():a(m)})});case"padding":return p.jsx(Nt,{icon:f,label:u,children:p.jsx(cO,{label:u,labelAction:d,defaultValue:r??c??K$e,inheritedFrom:i?void 0:"default",onChange:m=>a(m),sidesLinked:s,onSidesLinkedChange:l})});case"fontSize":return p.jsx(Nt,{icon:f,label:u,children:p.jsx(_E,{label:u,labelAction:d,defaultValue:r??c??16,onChange:m=>a(m)})});case"fontFamily":return p.jsx(Nt,{icon:f,label:u,children:p.jsx(HN,{label:u,labelAction:d,defaultValue:r??c??null,onChange:m=>m===null?o():a(m)})});case"fontWeight":return p.jsx(Nt,{icon:f,label:u,children:p.jsx(_X,{label:u,labelAction:d,defaultValue:r??c??"normal",onChange:m=>a(m)})});case"textAlign":return p.jsx(Nt,{icon:f,label:u,children:p.jsx(uO,{label:u,labelAction:d,defaultValue:r??c??null,onChange:m=>m===null?o():a(m)})});case"number":return p.jsx(Nt,{icon:f,label:u,children:p.jsx(_E,{label:u,labelAction:d,defaultValue:r??c??0,onChange:m=>a(m)})});case"border":return p.jsx(Nt,{icon:f,label:u,children:p.jsx(J$e,{blockType:t,field:e})});default:return e.kind,null}}function J$e({blockType:t,field:e}){const{t:n}=Ie("inspector"),r=Dp(t,e.section,"borderColor"),i=Dp(t,e.section,"borderTop"),a=Dp(t,e.section,"borderBottom"),o=Dp(t,e.section,"borderLeft"),s=Dp(t,e.section,"borderRight"),[l,c]=T.useState(!0),u=y_[t]?.[e.section],d=f=>{f.borderColor!==void 0&&r.set(f.borderColor),f.borderTop!==void 0&&i.set(f.borderTop),f.borderBottom!==void 0&&a.set(f.borderBottom),f.borderLeft!==void 0&&o.set(f.borderLeft),f.borderRight!==void 0&&s.set(f.borderRight)};return p.jsx(sO,{label:n(e.labelKey),borderColor:r.value??u?.borderColor??null,borderTop:i.value??u?.borderTop??0,borderBottom:a.value??u?.borderBottom??0,borderLeft:o.value??u?.borderLeft??0,borderRight:s.value??u?.borderRight??0,onChange:d,sidesLinked:l,onSidesLinkedChange:c})}function Z$e({blockType:t,spec:e,defaultExpanded:n=!1}){const{t:r}=Ie("inspector"),i=C1e(t),a=To(),o=eUe(i),s=e.icon;return p.jsxs(eS,{defaultExpanded:n,disableGutters:!0,square:!0,sx:{boxShadow:"none",borderTop:l=>`1px solid ${l.palette.divider}`,"&:before":{display:"none"}},children:[p.jsx(rS,{expandIcon:a?void 0:p.jsx(WW,{}),sx:{px:0,minHeight:a?40:48,justifyContent:a?"center":void 0,"& .MuiAccordionSummary-content":{my:a?.5:1,justifyContent:a?"center":void 0}},children:a?p.jsx(Pt,{title:r(e.titleKey),placement:"left",children:p.jsxs(H,{sx:{display:"flex",alignItems:"center",p:.5,borderRadius:2,color:"primary.main"},children:[p.jsx(s,{fontSize:"small"}),o>0&&p.jsx(H,{component:"span",sx:{fontSize:10,ml:.5,px:.5,borderRadius:1,bgcolor:"primary.main",color:"primary.contrastText",fontWeight:600},children:o})]})}):p.jsxs(qe,{direction:"row",alignItems:"center",gap:1,sx:{width:"100%"},children:[p.jsx(xe,{sx:{fontWeight:600,color:"text.primary"},children:r(e.titleKey)}),o>0&&p.jsx(H,{component:"span",sx:{fontSize:11,lineHeight:1,px:.75,py:.25,borderRadius:1,bgcolor:"primary.main",color:"primary.contrastText",fontWeight:600},"aria-label":r("theme.overrideCount",{count:o}),children:o})]})}),p.jsx(tS,{sx:{p:0,pb:2},children:p.jsx(qe,{gap:2,children:e.fields.map(l=>p.jsx(X$e,{blockType:t,field:l},`${l.section}.${l.key}`))})})]})}function eUe(t){if(!t)return 0;const e=t.style?Object.keys(t.style).length:0,n=t.props?Object.keys(t.props).length:0;return e+n}function tUe({defaultExpanded:t=!0}){const{t:e}=Ie("inspector"),n=pX("root"),r=To();if(!n||n.type!=="EmailLayout")return null;const{data:i}=n;return p.jsxs(eS,{defaultExpanded:t,disableGutters:!0,square:!0,sx:{boxShadow:"none",borderTop:a=>`1px solid ${a.palette.divider}`,"&:before":{display:"none"}},children:[p.jsx(rS,{expandIcon:r?void 0:p.jsx(WW,{}),sx:{px:0,minHeight:r?40:48,justifyContent:r?"center":void 0,"& .MuiAccordionSummary-content":{my:r?.5:1,justifyContent:r?"center":void 0}},children:r?p.jsx(Pt,{title:e("theme.blocks.root.title"),placement:"left",children:p.jsx(H,{sx:{display:"flex",p:.5,borderRadius:2,color:"primary.main"},children:p.jsx(BDe,{fontSize:"small"})})}):p.jsx(xe,{sx:{fontWeight:600,color:"text.primary"},children:e("theme.blocks.root.title")})}),p.jsx(tS,{sx:{px:0,pt:0,pb:2},children:p.jsx(qe,{gap:2,children:p.jsx(SX,{data:i,setData:a=>{ZR(),lb("root",()=>({type:"EmailLayout",data:a}))}})})})]})}const Qx=100,Xx=280;function nUe({open:t,onClose:e,onSaved:n}){const{t:r}=Ie("inspector"),[i,a]=T.useState(""),[o,s]=T.useState(""),[l,c]=T.useState(!1),[u,d]=T.useState(null),f=i.trim(),m=f.length>0&&f.length<=Qx&&o.length<=Xx,h=T.useCallback(()=>{l||(a(""),s(""),d(null),e())},[l,e]),g=T.useCallback(async()=>{if(!(!m||l)){c(!0),d(null);try{const _=w1e(),b=await iX({name:f,description:o.trim()||void 0,bundle:_});n?.(b.id),a(""),s(""),e()}catch(_){d(_ instanceof Error?_.message:String(_))}finally{c(!1)}}},[m,l,f,o,e,n]);return p.jsxs(Is,{open:t,onClose:h,maxWidth:"sm",fullWidth:!0,children:[p.jsx(Ms,{children:r("theme.save.title","Save current theme")}),p.jsx(Ps,{children:p.jsxs(qe,{gap:2,sx:{mt:1},children:[p.jsx(xe,{variant:"body2",color:"text.secondary",children:r("theme.save.description","Snapshots the current root globals and per-block-type theme overrides. Saved themes can be reapplied later from the Components Library.")}),p.jsx(Ir,{label:r("theme.save.nameLabel","Name"),value:i,onChange:_=>a(_.target.value),placeholder:r("theme.save.namePlaceholder","e.g. Brand default"),autoFocus:!0,fullWidth:!0,disabled:l,inputProps:{maxLength:Qx},helperText:`${f.length}/${Qx}`}),p.jsx(Ir,{label:r("theme.save.descriptionLabel","Description (optional)"),value:o,onChange:_=>s(_.target.value),fullWidth:!0,multiline:!0,minRows:2,disabled:l,inputProps:{maxLength:Xx},helperText:`${o.length}/${Xx}`}),u&&p.jsx($n,{severity:"error",children:u})]})}),p.jsxs(Ns,{children:[p.jsx(ht,{onClick:h,disabled:l,children:r("theme.save.cancel","Cancel")}),p.jsx(ht,{onClick:g,variant:"contained",disabled:!m||l,children:l?r("theme.save.submitting","Saving…"):r("theme.save.submit","Save")})]})]})}function rUe(){const{t}=Ie("inspector"),e=X1e(),n=vS(),r=PG(),i=To(),[a,o]=T.useState(!1),[s,l]=T.useState(!1);return p.jsxs(ff,{sx:{padding:"0!important",paddingTop:"1rem!important"},children:[!i&&p.jsxs(qe,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{mb:2,flexWrap:"wrap",gap:1},children:[p.jsx(xe,{sx:{fontWeight:"bold",color:"text.primary",fontSize:"1.25rem"},children:t("styles.rootTitle")}),n&&p.jsxs(qe,{direction:"row",gap:.5,sx:{width:"100%",ml:"0!important"},children:[p.jsx(Pt,{title:t("theme.exportTooltip","Save current theme to the gallery"),children:p.jsx(ht,{size:"small",variant:"outlined",startIcon:p.jsx($we,{fontSize:"small"}),onClick:()=>o(!0),children:t("theme.exportButton","Theme")})}),r&&p.jsx(Pt,{title:t("componentsLibrary.saveTemplate.tooltip","Save the current document as a reusable template"),children:p.jsx(ht,{size:"small",variant:"outlined",startIcon:p.jsx(YW,{fontSize:"small"}),onClick:()=>l(!0),children:t("componentsLibrary.saveTemplate.button","Template")})})]})]}),p.jsxs(H,{children:[p.jsx(tUe,{defaultExpanded:!0}),v$e.map(c=>p.jsx(Z$e,{blockType:c,spec:bX[c],defaultExpanded:!1},c))]}),e&&p.jsx(H,{color:"text.secondary",sx:{display:"flex",justifyContent:"flex-end",mt:3,mb:3},children:p.jsxs(H,{sx:{textAlign:"right"},children:[p.jsxs(xe,{variant:"body2",children:[t("inputs.panels.emailLayout.version"),": ",Kx.version]}),p.jsx(ld,{href:`https://www.npmjs.com/package/${Kx.name}`,target:"_blank",rel:"noopener noreferrer",sx:{fontSize:"0.875rem",mt:.5,display:"inline-block"},children:Kx.name})]})}),p.jsx(nUe,{open:a,onClose:()=>o(!1)}),p.jsx(r6e,{open:s,onClose:()=>l(!1)})]})}function iUe(){const t=q_(),e=pX(t??"root"),n=T.useCallback(a=>{t&&lb(t,()=>a)},[t]);if(!e)return null;const{data:r,type:i}=e;switch(i){case"Container":return p.jsx(vX,{data:r,setData:a=>n({type:i,data:a})},t);case"Divider":return p.jsx(EX,{data:r,setData:a=>n({type:i,data:a})},t);case"Spacer":return p.jsx(xX,{data:r,setData:a=>n({type:i,data:a})},t);case"EmailLayout":return p.jsx(rUe,{});default:return p.jsx("pre",{children:JSON.stringify(e,null," ")})}}function aUe({sticky:t,heightContent:e}){const n=Rd(),r=yS(),i=q_(),a=or(),o=rI(),s=sn(),{t:l}=Ie("inspector");T.useEffect(()=>{const g=_=>{const b=_.target;A3(b.innerWidth)};return window&&A3(window.innerWidth),window.addEventListener("resize",g),()=>{window.removeEventListener("resize",g)}},[n]);const c=()=>{const g={position:"absolute",top:"1rem",right:"0.5rem",color:"primary.main",fontSize:"20px",cursor:"pointer",display:h?"none":void 0},_=()=>Xg(a==="desktop"?"mobile":"desktop");return n==="block-configuration"||n==="css"||h&&i&&!ig.includes(r||"")?p.jsxs("div",{style:{position:"relative"},children:[a==="desktop"?p.jsx(S2,{sx:g,onClick:_}):p.jsx(x1,{sx:g,onClick:_}),p.jsx(V$e,{})]}):p.jsxs("div",{style:{position:"relative"},children:[p.jsx(iUe,{}),a==="desktop"?p.jsx(S2,{sx:g,onClick:_}):p.jsx(x1,{sx:g,onClick:_})]})},u=()=>p.jsx("svg",{style:{marginRight:"4px",color:"inherit"},width:"21",height:"20",viewBox:"0 0 21 20",fill:"none",children:p.jsx("path",{d:"M3.83398 5H17.1673M3.83398 10H17.1673M3.83398 15H9.66732",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),d=()=>p.jsx("svg",{style:{marginRight:"4px",color:"inherit"},width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:p.jsx("path",{d:"M5.83333 17.5C3.99238 17.5 2.5 16.0076 2.5 14.1667V4.16667C2.5 3.24619 3.24619 2.5 4.16667 2.5H7.5C8.42047 2.5 9.16667 3.24619 9.16667 4.16667V14.1667C9.16667 16.0076 7.67428 17.5 5.83333 17.5ZM5.83333 17.5H15.8333C16.7538 17.5 17.5 16.7538 17.5 15.8333V12.5C17.5 11.5795 16.7538 10.8333 15.8333 10.8333H13.8807M9.16669 6.11927L10.5474 4.73858C11.1983 4.0877 12.2535 4.0877 12.9044 4.73858L15.2614 7.0956C15.9123 7.74647 15.9123 8.80175 15.2614 9.45262L8.19036 16.5237M5.83333 14.1667H5.84167",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),f=(g,_)=>{y1e(_)},m=t?e?`calc(${e} - 4px)`:void 0:e??void 0,h=o==="compact";return p.jsx(L5e,{value:h,children:p.jsxs(ff,{sx:g=>({width:h?fG:XR,padding:"0!important",margin:"0!important",height:m,maxHeight:m,display:"flex",flexDirection:"column",overflow:"hidden",position:t?"sticky":"static",top:t?Zs:0,backgroundColor:`${g.palette.background.paper} !important`}),children:[p.jsx(H,{sx:{position:"sticky",top:0,zIndex:1,backgroundColor:`${s.palette.background.paper} !important`,display:h?"none":void 0},children:p.jsxs(fS,{sx:{backgroundColor:`${s.palette.background.paper} !important`},value:n,onChange:f,children:[i!=null&&!ig.includes(r||"")&&[p.jsx(hs,{sx:{height:Zs,minHeight:Zs,fontWeight:"bold"},value:"block-configuration",label:l("header.content"),icon:p.jsx(u,{}),iconPosition:"start"},"block-configuration"),p.jsx(hs,{sx:{height:Zs,minHeight:Zs,fontWeight:"bold"},value:"css",label:l("header.styles"),icon:p.jsx(d,{}),iconPosition:"start"},"css")],i!=null&&ig.includes(r)&&[p.jsx(hs,{sx:{height:Zs,minHeight:Zs,fontWeight:"bold"},value:"styles",label:l("header.styles"),icon:p.jsx(d,{}),iconPosition:"start"},"styles")],i==null&&p.jsx(hs,{sx:{height:Zs,minHeight:Zs,fontWeight:"bold"},value:"styles",label:l("header.styles"),icon:p.jsx(d,{}),iconPosition:"start"},"styles")]})}),p.jsx(ff,{sx:g=>({flex:"1 1 auto",minHeight:0,overflowY:"auto",px:h?"0.5rem!important":"1rem!important",backgroundColor:`${g.palette.background.paper} !important`}),children:c()})]})})}const TX=({children:t,topOffset:e=0,zIndex:n=10,className:r="",style:i={},disabled:a=!1,threshold:o=null,...s})=>{const[l,c]=T.useState(!1),[u,d]=T.useState({width:0,height:0}),[f,m]=T.useState({left:0}),[h,g]=T.useState(0),[_,b]=T.useState(!1),y=T.useRef(null),E=T.useRef(null),v=T.useRef(null);T.useEffect(()=>{if(a){c(!1),b(!1),g(0);return}const C=E.current,k=y.current;if(!C||!k)return;let w=null;o&&(o.startsWith("#")?w=document.getElementById(o.slice(1)):(o.startsWith("."),w=document.querySelector(o)));const D=()=>{const P=k.getBoundingClientRect();d({width:P.width,height:P.height}),m({left:P.left})},A=()=>{if(!w||!k)return{offset:0,isPushed:!1};const P=w.getBoundingClientRect(),L=k.getBoundingClientRect(),B=e+L.height;if(P.top<B){const F=B-P.top,q=L.height+20;return{offset:-Math.min(F,q),isPushed:!0}}return{offset:0,isPushed:!1}},M=new IntersectionObserver(([P])=>{const L=!P.isIntersecting;if(L&&!l&&D(),c(L),L&&o){const{offset:B,isPushed:F}=A();g(B),b(F)}else L||(g(0),b(!1))},{threshold:0,rootMargin:`-${e}px 0px 0px 0px`}),R=new ResizeObserver(()=>{D()}),I=()=>{if(o&&l){const{offset:P,isPushed:L}=A();g(P),b(L)}};return M.observe(C),R.observe(k),o&&window.addEventListener("scroll",I,{passive:!0}),D(),()=>{M.disconnect(),R.disconnect(),o&&window.removeEventListener("scroll",I)}},[e,l,a,o]);const x=!a&&l,S=x?`${e+h}px`:"auto";return p.jsxs("div",{ref:v,className:r,...s,children:[!a&&p.jsx("div",{ref:E,style:{height:"1px",position:"absolute",top:`-${e+1}px`,left:0,right:0,pointerEvents:"none"}}),x&&p.jsx("div",{style:{height:`${u.height}px`,width:`${u.width}px`}}),p.jsx("div",{ref:y,style:{position:x?"fixed":"static",top:S,width:"auto",height:"auto",zIndex:x?n:"auto",transition:_?"none":"box-shadow 0.2s ease-in-out, top 0.3s ease-out",..._&&h<-u.height*.3&&{opacity:Math.max(0,1+(h+u.height*.3)/(u.height*.7))},...i},children:t})]})};var uh={},i9;function oUe(){if(i9)return uh;i9=1;var t=ar();Object.defineProperty(uh,"__esModule",{value:!0}),uh.default=void 0;var e=t(_r()),n=p;return uh.default=(0,e.default)((0,n.jsx)("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"}),"TuneOutlined"),uh}var sUe=oUe();const lUe=Vn(sUe);function cUe(){const t=UG(),e=rI(),{t:n}=Ie("inspector");if(!t)return null;const r=()=>jG(e==="full"?"compact":"full"),i=e==="compact";return p.jsx(H,{sx:{position:"absolute",left:0,top:"50%",transform:"translateX(-100%) translateY(-50%)",zIndex:10},children:p.jsx(Pt,{title:i?n("inspector.handle.expand","Expand panel"):n("inspector.handle.compact","Compact panel"),placement:"left",children:p.jsx(si,{onClick:r,sx:a=>({width:24,minHeight:80,borderTopLeftRadius:8,borderBottomLeftRadius:8,backgroundColor:i?a.palette.primary.main:a.palette.background.paper,color:i?a.palette.primary.contrastText:a.palette.text.secondary,border:`1px solid ${a.palette.divider}`,borderRight:"none",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.5,py:1,boxShadow:"-2px 0 6px rgba(0,0,0,0.04)",transition:"background-color 120ms ease, color 120ms ease","&:hover":{backgroundColor:i?a.palette.primary.dark:a.palette.action.hover}}),children:p.jsx(lUe,{sx:{fontSize:16}})})})})}function uUe(t){return typeof ReadableStream<"u"&&t instanceof ReadableStream?(async function*(){const e=t.getReader(),n=new TextDecoder;try{for(;;){const{value:r,done:i}=await e.read();if(i){const a=n.decode();a&&(yield a);return}r!==void 0&&(typeof r=="string"?yield r:yield n.decode(r,{stream:!0}))}}finally{e.releaseLock()}})():t}function*a9(t){const e=t.split(`
503
503
  `);let n=null;const r=[];for(const o of e)if(o.length!==0&&!o.startsWith(":")){if(o.startsWith("event:")){n=o.slice(6).trimStart();continue}if(o.startsWith("data:")){const s=o.slice(5);r.push(s.startsWith(" ")?s.slice(1):s);continue}}const i=r.join(`
504
504
  `);if(i.length===0)return;const a=t.length;if(i==="[DONE]"){yield{kind:"done",raw:t,bytes:a};return}if(n==="error"){let o=i;try{o=JSON.parse(i)}catch{}yield{kind:"error",payload:o,raw:t,bytes:a};return}if(n==="warning"){let o=i;try{o=JSON.parse(i)}catch{}yield{kind:"warning",payload:o,raw:t,bytes:a};return}if(n==="info"){let o=i;try{o=JSON.parse(i)}catch{}yield{kind:"info",payload:o,raw:t,bytes:a};return}try{const o=JSON.parse(i);if(typeof o.id!="string"||typeof o.block!="object"||o.block===null){yield{kind:"malformed",raw:t,reason:"Missing or invalid {id, block} payload",bytes:a};return}yield{kind:"block",id:o.id,block:o.block,raw:t,bytes:a}}catch(o){yield{kind:"malformed",raw:t,reason:o instanceof Error?o.message:"Invalid JSON",bytes:a}}}async function*dUe(t){const e=uUe(t);let n="";for await(const i of e){n+=i,n=n.replace(/\r\n/g,`
505
505
  `);let a;for(;(a=n.indexOf(`