email-builder-online 4.3.0 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -418,7 +418,7 @@ ${a}
418
418
  <style>html,body{margin:0;padding:0;background:transparent;overflow:hidden;}body{font-family:Helvetica,Arial,sans-serif;}</style>
419
419
  </head>
420
420
  <body></body>
421
- </html>`,v2d=Ae.ALL_GOOGLE_FONTS_HREF;function S2d(t,r){const a=t.head;if(a.querySelector("link[data-eb-fonts]")===null){const o=t.createElement("link");o.setAttribute("data-eb-fonts","1"),o.rel="stylesheet",o.href=v2d,a.appendChild(o)}if(a.querySelector("style[data-eb-globals]")===null){const o=t.createElement("style");o.setAttribute("data-eb-globals","1"),o.textContent=Ae.globalsStyles,a.appendChild(o)}t.documentElement.style.overflow="hidden",t.body.style.overflow="hidden",t.body.style.backgroundColor=r}function g2d(){const t=(0,A.useTheme)(),{t:r}=Ze("inspector"),a=i2d(),o=(0,y.useRef)(null),s=(0,y.useRef)(null),[u,d]=(0,y.useState)(null),[c,_]=(0,y.useState)(null),[h,p]=(0,y.useState)("root"),[m,f]=(0,y.useState)(!1),[v,S]=(0,y.useState)(null),[g,b]=(0,y.useState)(null),[T,M]=(0,y.useState)(!1),[O,x]=(0,y.useState)("desktop"),[w,R]=(0,y.useState)(()=>typeof window<"u"?window.innerHeight:800),j=(0,y.useRef)(null),P=(0,y.useCallback)(()=>{const te=o.current;if(te===null)return;const $=te.contentDocument;$!==null&&(S2d($,(F.editorStateStore.getState().document.root?.data??{}).backdropColor??Ly),d($.body))},[]);(0,y.useEffect)(()=>{const te=()=>R(window.innerHeight);return window.addEventListener("resize",te),()=>window.removeEventListener("resize",te)},[]),(0,y.useEffect)(()=>{if(a===null)return;const te=`${a.category}|${a.axis}|${a.id}`;j.current=te,S(null),M(!1),x("desktop");let $=!1;m2d(a).then(W=>{j.current===te&&($=!0,(0,y.startTransition)(()=>{_(W.doc),p(W.rootBlockId)}),f(!1))}).catch(W=>{j.current===te&&($=!0,S(W instanceof Error?W.message:String(W)),f(!1))}),Promise.resolve().then(()=>{!$&&j.current===te&&f(!0)})},[a]),(0,y.useEffect)(()=>{if(u===null||a===null)return;const te=(F.editorStateStore.getState().document.root?.data??{}).backdropColor??Ly;u.style.backgroundColor=te},[u,a]),(0,y.useEffect)(()=>{if(u===null)return;const te=()=>{const W=u.firstElementChild,_e=W!==null&&W.offsetHeight>0?W.offsetHeight:u.scrollHeight;b(_e)};te();const $=new ResizeObserver(te);return $.observe(u),()=>$.disconnect()},[u,c]);const H=a?.category==="template",L=H?d2d:u2d,E=H?Math.round(w*h2d):c2d,z=O==="mobile"?s2d:l2d,V=g??E,k=L/z,D=T?k:Math.min(k,E/V),N=z*D,I=V*D,B=Math.max(_2d,Math.min(I,E));(0,y.useEffect)(()=>{s.current&&(s.current.scrollTop=0)},[T,O,a]);const q=(0,y.useMemo)(()=>c===null?null:(0,n.jsx)(Ae.Reader,{document:c,rootBlockId:h,viewport:O}),[c,h,O]);return(0,n.jsx)(A.Popper,{open:a!==null,anchorEl:a?.anchor??null,placement:"right-start",keepMounted:!0,modifiers:[{name:"offset",options:{offset:[0,8]}},{name:"flip",enabled:!1},{name:"preventOverflow",options:{boundary:"viewport",padding:8,altAxis:!0}}],sx:{zIndex:t.zIndex.tooltip+1,pointerEvents:a!==null?"auto":"none",visibility:a!==null?"visible":"hidden"},children:(0,n.jsxs)(A.Paper,{elevation:6,onMouseEnter:o2d,onMouseLeave:E4r,sx:{width:L+24,padding:1.5,display:"flex",flexDirection:"column",gap:1,backgroundColor:t.palette.background.paper,border:`1px solid ${t.palette.divider}`},children:[(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,n.jsx)(A.Typography,{variant:"caption",color:"text.secondary",sx:{fontWeight:600,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a?.name??""}),(0,n.jsx)(A.Tooltip,{title:O==="mobile"?r("componentsLibrary.preview.desktop","Desktop view"):r("componentsLibrary.preview.mobile","Mobile view"),children:(0,n.jsx)(A.IconButton,{size:"small",onClick:()=>x(te=>te==="mobile"?"desktop":"mobile"),sx:{flexShrink:0},children:O==="mobile"?(0,n.jsx)(kO,{fontSize:"small"}):(0,n.jsx)(zv,{fontSize:"small"})})}),(0,n.jsx)(A.Tooltip,{title:T?r("componentsLibrary.preview.fit","Fit to view"):r("componentsLibrary.preview.zoom","Zoom in"),children:(0,n.jsx)(A.IconButton,{size:"small",onClick:()=>M(te=>!te),sx:{flexShrink:0},children:T?(0,n.jsx)(XO,{fontSize:"small"}):(0,n.jsx)(ZO,{fontSize:"small"})})})]}),(0,n.jsxs)(A.Box,{ref:s,sx:{position:"relative",width:L,height:B,mx:"auto",display:"flex",justifyContent:"center",alignItems:"flex-start",backgroundColor:t.palette.action.hover,borderRadius:1,overflowY:T?"auto":"hidden",overflowX:"hidden"},children:[(0,n.jsx)(A.Box,{sx:{position:"relative",width:N,height:I,flexShrink:0},children:(0,n.jsx)("iframe",{ref:o,srcDoc:f2d,title:r("componentsLibrary.preview.iframeTitle","Live preview"),sandbox:"allow-same-origin",onLoad:P,style:{position:"absolute",top:0,left:0,width:z,height:V,border:0,display:"block",backgroundColor:"transparent",transform:`scale(${D})`,transformOrigin:"top left",pointerEvents:"none"}})}),u!==null&&q!==null&&v===null&&(0,E2.createPortal)(q,u),m&&(0,n.jsx)(A.Box,{sx:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255,255,255,0.6)"},children:(0,n.jsx)(A.CircularProgress,{size:24})}),v!==null&&(0,n.jsx)(A.Box,{sx:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",p:2,backgroundColor:t.palette.background.paper},children:(0,n.jsx)(A.Typography,{variant:"body2",color:"error",sx:{textAlign:"center"},children:v})})]})]})})}var b2d=["updatedDesc","createdDesc","nameAsc","nameDesc","sizeDesc","sizeAsc","blocksDesc","blocksAsc"];function T2d(t,r){const a=r.search.trim().toLowerCase();return t.filter(o=>{if(r.axes.length>0&&!r.axes.includes(o.axis))return!1;if(r.tags.length>0){const s=o.tags??[];if(!r.tags.every(u=>s.includes(u)))return!1}return!(a.length>0&&![o.name,o.description??"",o.axis,...o.tags??[]].join(" ").toLowerCase().includes(a))})}function y2d(t,r){const a=[...t],o=(s,u)=>s.name.localeCompare(u.name);switch(r){case"nameAsc":return a.sort(o);case"nameDesc":return a.sort((s,u)=>o(u,s));case"createdDesc":return a.sort((s,u)=>s.createdAt<u.createdAt?1:s.createdAt>u.createdAt?-1:0);case"sizeAsc":return a.sort((s,u)=>s.sizeBytes-u.sizeBytes);case"sizeDesc":return a.sort((s,u)=>u.sizeBytes-s.sizeBytes);case"blocksAsc":return a.sort((s,u)=>s.blockCount-u.blockCount);case"blocksDesc":return a.sort((s,u)=>u.blockCount-s.blockCount);default:return a.sort((s,u)=>s.updatedAt<u.updatedAt?1:s.updatedAt>u.updatedAt?-1:0)}}function C2d({columns:t=2,count:r=4,thumbnailHeight:a=120}){return(0,n.jsx)(A.Box,{sx:{display:"grid",gridTemplateColumns:`repeat(${t}, minmax(0, 1fr))`,gap:.5,pt:.5},"aria-busy":"true","aria-live":"polite",children:Array.from({length:r}).map((o,s)=>(0,n.jsxs)(A.Stack,{spacing:.75,sx:{p:.5},children:[(0,n.jsx)(A.Skeleton,{variant:"rounded",animation:"wave",height:a,sx:{borderRadius:1}}),(0,n.jsx)(A.Skeleton,{variant:"text",animation:"wave",width:"70%"}),(0,n.jsx)(A.Skeleton,{variant:"text",animation:"wave",width:"45%"})]},s))})}X7t();function M2d({src:t,alt:r,height:a=120,placeholderText:o}){const s=(0,A.useTheme)(),u={width:"100%",height:a,borderRadius:4,backgroundColor:s.palette.background.default,display:"block"};return t===null?(0,n.jsxs)(A.Box,{sx:{...u,border:`1px dashed ${s.palette.divider}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.5,color:"text.secondary"},"aria-label":r,children:[(0,n.jsx)(BO,{sx:{fontSize:24,opacity:.6}}),o!==void 0&&(0,n.jsx)(A.Typography,{variant:"caption",sx:{opacity:.7},children:o})]}):(0,n.jsx)("img",{src:t,alt:r,loading:"lazy",decoding:"async",style:{...u,objectFit:"cover",objectPosition:"top center",border:`1px solid ${s.palette.divider}`},onError:d=>{const c=d.currentTarget;c.style.display="none"}})}var x2d={section:"sections",layout:"layouts",template:"templates"};function O2d(t,r,a){const o=to(),s=x2d[t];if(t==="template")return`${o}/dev/${s}/${encodeURIComponent(a)}/thumbnail`;if(r===null)throw new Error(`category '${t}' requires an axis but received null`);return`${o}/dev/${s}/${encodeURIComponent(r)}/${encodeURIComponent(a)}/thumbnail`}var V0="__other__",w2d=[{key:"blocks",labelKey:"componentsLibrary.drawer.category.blocks",enabled:!0},{key:"sections",labelKey:"componentsLibrary.drawer.category.sections",enabled:!0},{key:"templates",labelKey:"componentsLibrary.drawer.category.templates",enabled:!0}];function nJ({item:t,category:r,onClick:a}){const{t:o}=Ze("inspector"),s=(0,A.useTheme)(),u=r!=="template",[{isDragging:d},c]=a5(()=>({type:ji,item:()=>({kind:ji,category:r,axis:t.axis,id:t.id}),canDrag:()=>u,collect:m=>({isDragging:m.isDragging()})}),[r,t.axis,t.id,u]);(0,y.useEffect)(()=>{d&&V4r()},[d]);const _=r==="section"||r==="layout"||r==="template",h=r==="primitive"&&t.block!==void 0,p=_&&t.hasThumbnail?F.getComponentsStorageMode()==="local"?Ae.getLocalThumbnail(t.id):O2d(r,r==="template"?null:t.axis,t.id):null;return(0,n.jsxs)(A.Box,{ref:m=>{u&&m&&c(m)},onMouseEnter:m=>a2d({anchor:m.currentTarget,category:r,axis:t.axis,id:t.id,name:t.name,primitiveBlock:r==="primitive"?t.block:void 0}),onMouseLeave:E4r,onClick:a?()=>a(t):void 0,sx:{p:1,borderRadius:1,border:"1px dashed",borderColor:s.palette.divider,cursor:a?"pointer":"grab",opacity:d?.5:1,display:"flex",flexDirection:"column",gap:.75,transition:"background-color 120ms ease, border-color 120ms ease","&:hover":{backgroundColor:s.palette.action.hover,borderColor:s.palette.secondary.main},"&:active":{cursor:"grabbing"}},children:[h&&(0,n.jsx)(L4r,{id:t.id,block:t.block,alt:t.name}),_&&(0,n.jsx)(M2d,{src:p,alt:t.name,placeholderText:o("componentsLibrary.thumbnail.placeholder","No preview")}),(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[(0,n.jsx)(Pv,{sx:{fontSize:16,color:"text.secondary",flexShrink:0,display:u?"inline-flex":"none"}}),(0,n.jsx)(A.Box,{sx:{minWidth:0,flex:1},children:(0,n.jsx)(A.Typography,{variant:"body2",sx:{fontSize:"0.8rem",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:t.name,children:t.name})})]})]})}var L8=24;function A2d({items:t,columns:r,renderItem:a}){const[o,s]=(0,y.useState)(L8),u=(0,y.useRef)(null);return(0,y.useEffect)(()=>{s(L8)},[t]),(0,y.useEffect)(()=>{const d=u.current;if(!d)return;const c=new IntersectionObserver(_=>{_[0]?.isIntersecting&&s(h=>h<t.length?Math.min(t.length,h+L8):h)},{rootMargin:"300px"});return c.observe(d),()=>c.disconnect()},[t.length,o]),(0,n.jsxs)(A.Box,{sx:{mt:1.5},children:[(0,n.jsx)(A.Box,{sx:{display:"grid",gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`,gap:.5},children:t.slice(0,o).map(d=>a(d))}),o<t.length&&(0,n.jsx)(A.Box,{ref:u,sx:{height:1}})]})}function k4r({items:t,category:r,loading:a,error:o,groupLabelKey:s,columns:u,virtualize:d,search:c,sort:_,onClick:h,onRename:p,onDelete:m}){const{t:f}=Ze("inspector"),[v]=(0,y.useState)([]),[S,g]=(0,y.useState)({}),b=(0,y.useMemo)(()=>({search:c,axes:[],tags:v,sort:_}),[c,v,_]),T=(0,y.useMemo)(()=>y2d(T2d(t,b),_),[t,b,_]),M=(0,y.useMemo)(()=>{const j=new Map;for(const P of T){const H=j.get(P.axis)??[];H.push(P),j.set(P.axis,H)}return Array.from(j.keys()).sort((P,H)=>P===V0?1:H===V0?-1:P.localeCompare(H)).map(P=>({axis:P,items:j.get(P)??[]}))},[T]),O=M.length===0||M.length===1&&M[0].axis==="",x=j=>j===V0?f("componentsLibrary.drawer.usageOther","Other"):s?f(`${s}.${j}`,j):j,w=(j,P)=>d?(0,n.jsx)(A2d,{items:j,columns:u??2,renderItem:H=>(0,n.jsx)(nJ,{item:H,category:r,onClick:h,onRename:p,onDelete:m},H.id)}):(0,n.jsx)(A.Box,{sx:{display:"grid",gridTemplateColumns:u?`repeat(${u}, minmax(0, 1fr))`:"1fr",gap:.5},children:j.map(H=>(0,n.jsx)(nJ,{item:H,category:r,onClick:h,onRename:p,onDelete:m},`${P}/${H.id}`))}),R=()=>o?(0,n.jsx)(A.Alert,{severity:"error",sx:{mt:1},children:o}):a&&t.length===0?(0,n.jsx)(C2d,{columns:u??2,count:4}):!a&&t.length===0?(0,n.jsx)(kid,{icon:(0,n.jsx)(UO,{}),title:f("componentsLibrary.drawer.emptyTitle","Your library is empty"),description:f("componentsLibrary.drawer.empty")}):(0,n.jsx)(A.Stack,{spacing:1,sx:{pt:.5},children:T.length===0?(0,n.jsx)(A.Typography,{variant:"body2",color:"text.secondary",sx:{mt:1},children:f("componentsLibrary.drawer.noResults","No components match your search.")}):O?w(T,"flat"):(0,n.jsx)(A.Box,{children:M.map((j,P)=>(0,n.jsx)(Xid,{title:x(j.axis),count:j.items.length,expanded:S[j.axis]??P===0,onToggle:H=>g(L=>({...L,[j.axis]:H})),children:w(j.items,j.axis)},j.axis))})});return(0,n.jsx)(n.Fragment,{children:R()})}async function D4r(t,r){const a=await fetch(t);if(!a.ok){const o=await a.json().catch(()=>null);throw a.status===403?new Error(o?.hint??"Endpoint disabled in this environment."):new Error(o?.error??`HTTP ${a.status}`)}return(await a.json())[r]??[]}function R2d({refreshKey:t,search:r,sort:a,onRename:o,onChange:s}){const{t:u}=Ze("inspector"),[d,c]=(0,y.useState)([]),[_,h]=(0,y.useState)(!1),[p,m]=(0,y.useState)(null),f=(0,y.useCallback)(async()=>{h(!0),m(null);try{if(F.getComponentsStorageMode()==="local"){c(Ae.localListSavedComponents("section"));return}const v=await D4r(`${to()}/dev/sections`,"sections");c(v.map(S=>({...S,axis:S.role})))}catch(v){m(v instanceof Error?v.message:String(v))}finally{h(!1)}},[]);return(0,y.useEffect)(()=>{f()},[f,t]),(0,n.jsx)(k4r,{items:d,category:"section",loading:_,error:p,columns:2,groupLabelKey:"componentsLibrary.sectionRole",search:r,sort:a,onRename:v=>o({category:"section",axis:v.axis,id:v.id,name:v.name,description:v.description,tags:v.tags}),onDelete:(0,y.useCallback)(async v=>{if(window.confirm(u("componentsLibrary.drawer.deleteConfirm",'Delete component "{{name}}"? This cannot be undone.',{name:v.name})))try{if(F.getComponentsStorageMode()==="local")Ae.localDeleteSavedComponent("section",v.id);else{const S=await fetch(`${to()}/dev/sections/${encodeURIComponent(v.axis)}/${encodeURIComponent(v.id)}`,{method:"DELETE"});if(!S.ok){const g=await S.json().catch(()=>null);throw new Error(g?.error??`HTTP ${S.status}`)}}c(S=>S.filter(g=>!(g.axis===v.axis&&g.id===v.id))),s()}catch(S){m(S instanceof Error?S.message:String(S))}},[u,s])})}function z2d({refreshKey:t,search:r,sort:a,onRename:o,onChange:s}){const[u,d]=(0,y.useState)([]),[c,_]=(0,y.useState)(!1),[h,p]=(0,y.useState)(null),[m,f]=(0,y.useState)(null),{t:v}=Ze("inspector"),S=(0,y.useCallback)(async()=>{_(!0),p(null);try{if(F.getComponentsStorageMode()==="local"){d(Ae.localListTemplates().map(b=>({...b,axis:V0})));return}const g=await D4r(`${to()}/dev/templates`,"templates");d(g.map(b=>({...b,axis:b.usage||V0})))}catch(g){p(g instanceof Error?g.message:String(g))}finally{_(!1)}},[]);return(0,y.useEffect)(()=>{S()},[S,t]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(k4r,{items:u,category:"template",loading:c,error:h,columns:2,virtualize:!0,search:r,sort:a,onClick:f,onRename:g=>o({category:"template",axis:"",id:g.id,name:g.name,description:g.description,tags:g.tags}),onDelete:(0,y.useCallback)(async g=>{if(window.confirm(v("componentsLibrary.drawer.deleteConfirm","Delete?",{name:g.name})))try{if(F.getComponentsStorageMode()==="local")Ae.localDeleteTemplate(g.id);else{const b=await fetch(`${to()}/dev/templates/${encodeURIComponent(g.id)}`,{method:"DELETE"});if(!b.ok){const T=await b.json().catch(()=>null);throw new Error(T?.error??`HTTP ${b.status}`)}}d(b=>b.filter(T=>T.id!==g.id)),s()}catch(b){p(b instanceof Error?b.message:String(b))}},[v,s])}),(0,n.jsx)(Vid,{templateId:m?.id??null,templateName:m?.name??"",onClose:()=>f(null),onApplied:()=>f(null)})]})}function j2d(){const t=F.useComponentsLibraryDrawerOpen(),r=t?380:64,a=F.useComponentsLibraryEnabled(),o=F.useSelectedMainTab(),s=F.useTemplateSaving(),u=F.useComponentsLibraryRefreshNonce(),{t:d}=Ze("inspector"),c=(0,A.useTheme)(),_=(0,y.useMemo)(()=>w2d.filter(L=>!(!s&&L.key==="templates")),[s]),[h,p]=(0,y.useState)(0),[m,f]=(0,y.useState)(0),[v,S]=(0,y.useState)(null),[g,b]=(0,y.useState)(""),[T,M]=(0,y.useState)("updatedDesc"),[O,x]=(0,y.useState)(null),[w,R]=(0,y.useState)(()=>_[0]?.key??"blocks");(0,y.useEffect)(()=>{_.some(L=>L.key===w)||R(_[0]?.key??"blocks")},[_,w]),(0,y.useEffect)(()=>{u!==0&&(p(L=>L+1),f(L=>L+1),rJ())},[u]);const j=()=>{V4r(),F.setComponentsLibraryDrawerOpen(!1)},P=()=>{p(L=>L+1),f(L=>L+1),rJ()},H=(0,y.useCallback)(L=>{switch(L){case"section":p(E=>E+1);break;case"template":f(E=>E+1);break}},[]);return!a||o!=="editor"?null:(0,n.jsxs)(A.Box,{sx:{position:"absolute",top:0,left:0,bottom:0,zIndex:10,width:r,flexShrink:0,overflow:"hidden",transition:"width 220ms cubic-bezier(0.4, 0, 0.2, 1)",backgroundColor:c.palette.background.paper,borderRight:`1px solid ${c.palette.divider}`,display:"flex",flexDirection:"column",pointerEvents:"auto"},children:[(0,n.jsx)(A.Box,{sx:{width:r,height:"100%",display:"flex",flexDirection:"column"},children:t?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(A.Stack,{direction:"row",sx:{px:1.5,py:1,borderBottom:`1px solid ${c.palette.divider}`,alignItems:"center",justifyContent:"space-between"},children:[(0,n.jsx)(A.Typography,{variant:"subtitle2",children:d("componentsLibrary.drawer.title")}),(0,n.jsxs)(A.Stack,{direction:"row",spacing:.5,children:[(0,n.jsx)(A.Tooltip,{title:d("componentsLibrary.drawer.refresh"),children:(0,n.jsx)(A.IconButton,{size:"small",onClick:P,children:(0,n.jsx)(WO,{fontSize:"small"})})}),(0,n.jsx)(A.Tooltip,{title:d("componentsLibrary.drawer.close"),children:(0,n.jsx)(A.IconButton,{size:"small",onClick:j,children:(0,n.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:[(0,n.jsx)("polyline",{points:"11 17 6 12 11 7"}),(0,n.jsx)("polyline",{points:"18 17 13 12 18 7"})]})})})]})]}),(0,n.jsx)(A.Box,{sx:{px:1.5,borderBottom:`1px solid ${c.palette.divider}`},children:(0,n.jsx)(A.Tabs,{value:w,onChange:(L,E)=>R(E),variant:"fullWidth",slotProps:{indicator:{sx:{height:"3px",borderRadius:"4px"}}},sx:{minHeight:40},children:_.map(L=>(0,n.jsx)(A.Tab,{value:L.key,label:d(L.labelKey),sx:{minHeight:40,minWidth:0,px:1,fontSize:"0.72rem",textTransform:"none"}},L.key))})}),(0,n.jsxs)(A.Box,{sx:{flex:1,minHeight:0,overflowY:"auto",px:1.5,pb:2,pt:1},children:[w==="blocks"&&(0,n.jsx)(Qid,{}),w==="sections"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A.Box,{sx:{pb:1.5},children:(0,n.jsxs)(A.Stack,{direction:"row",spacing:.5,sx:{alignItems:"center"},children:[(0,n.jsx)(A.TextField,{size:"small",fullWidth:!0,value:g,onChange:L=>b(L.target.value),placeholder:d("componentsLibrary.search.placeholder","Search…"),sx:$o,slotProps:{input:{startAdornment:(0,n.jsx)(A.InputAdornment,{position:"start",children:(0,n.jsx)($O,{fontSize:"small"})})}}}),(0,n.jsx)(A.Tooltip,{title:d("componentsLibrary.search.sortLabel","Sort"),children:(0,n.jsx)(A.IconButton,{size:"small",onClick:L=>x(L.currentTarget),sx:{flexShrink:0,color:O?"primary.main":"text.secondary"},children:(0,n.jsx)(qO,{fontSize:"small"})})}),(0,n.jsx)(A.Menu,{anchorEl:O,open:!!O,onClose:()=>x(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:b2d.map(L=>(0,n.jsx)(A.MenuItem,{selected:T===L,onClick:()=>{M(L),x(null)},sx:{fontSize:"0.8rem"},children:d(`componentsLibrary.search.sort.${L}`,L)},L))})]})}),(0,n.jsx)(R2d,{search:g,sort:T,onRename:S,refreshKey:h,onChange:()=>p(L=>L+1)})]}),w==="templates"&&(0,n.jsx)(z2d,{search:g,sort:T,onRename:S,refreshKey:m,onChange:()=>f(L=>L+1)})]})]}):(0,n.jsx)(e2d,{})}),(0,n.jsx)(Lid,{target:v,onClose:()=>S(null),onRenamed:()=>{v&&H(v.category),S(null)}}),(0,n.jsx)(g2d,{})]})}Rv();function P2d(){const t=F.useComponentsLibraryDrawerOpen(),r=F.useComponentsLibraryEnabled(),a=F.useSelectedMainTab(),{t:o}=Ze("inspector");return!r||a!=="editor"?null:(0,n.jsx)(A.Box,{sx:{position:"absolute",left:t?380:64,top:"50%",transform:"translateY(-50%)",zIndex:10,transition:"left 220ms cubic-bezier(0.4, 0, 0.2, 1)"},children:(0,n.jsx)(A.Tooltip,{title:o(t?"componentsLibrary.drawer.handleClose":"componentsLibrary.drawer.handleOpen"),placement:"right",children:(0,n.jsxs)(A.ButtonBase,{onClick:F.toggleComponentsLibraryDrawerOpen,"aria-label":o(t?"componentsLibrary.drawer.handleClose":"componentsLibrary.drawer.handleOpen"),sx:s=>({width:28,minHeight:96,borderTopRightRadius:8,borderBottomRightRadius:8,backgroundColor:t?s.palette.secondary.main:s.palette.background.paper,color:t?s.palette.secondary.contrastText:s.palette.text.primary,border:`1px solid ${s.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?s.palette.secondary.dark:s.palette.mode==="dark"?s.palette.grey[800]:s.palette.grey[200]}}),children:[(0,n.jsx)(E_,{sx:{fontSize:18}}),(0,n.jsx)(A.Box,{sx:{writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:"0.7rem",fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:o("componentsLibrary.drawer.handle")})]})})})}var N4r=(0,y.createContext)(!1),H2d=N4r.Provider,mo=()=>(0,y.useContext)(N4r);function W_(t,r){F.updateBlock(t,r)}function B4(t,r){W_(t,a=>{const o=a.data&&"props"in a.data?a.data.props:void 0,s={...o!==null&&typeof o=="object"?o:{}},u=typeof r=="function"?r(s):r,d={...s,...typeof u=="object"&&u!==null?u:{}};return s===d?a:{...a,data:{...a.data,props:d}}})}var F4r=(0,y.createContext)(null),o6=()=>(0,y.useContext)(F4r),s9=(0,y.memo)(function({id:r,isNotClient:a}){const o=F.editorStateStore(c=>c.document[r]),s=F.editorStateStore(c=>c.document?.root?.data?.theme),u=F.useSelectedScreenSize(),d=(0,y.useMemo)(()=>o?Ae.resolveBlockData(o,s,u,I3[o.type]):void 0,[o,s,u]);return d?(0,n.jsx)(F4r.Provider,{value:r,children:(0,n.jsx)(nld,{isNotClient:a,...d,blockId:r})}):(console.warn(`Block ${r} not found`),null)},(t,r)=>t.id===r.id&&t.isNotClient===r.isNotClient);function Il({childrenIds:t,onChange:r,parentId:a,position:o,isNotClient:s}){const{t:u}=Ze(),[{isOver:d},c]=z9(()=>({accept:["block",ji],drop:(h,p)=>{if(p.getItemType()==="library-component"){if(p.didDrop()){p.getDropResult();return}if(h.category==="block"&&typeof h.buttonIndex=="number"){const v=Q2[h.buttonIndex];if(!v)return;F.appendBuiltInBlockToParent(a,v.block(),o);return}if(h.category==="block-preset"&&typeof h.presetIndex=="number"){const v=n6[h.presetIndex];if(!v)return;F.appendBuiltInBlockToParent(a,v.block,o);return}const f=h;if(f.category==="template"){console.warn("[ComponentsLibrary] templates cannot be dropped inline; click the card in the drawer to apply.");return}(async()=>{try{F.appendSavedComponentToParent(a,(await r6(f.category,f.axis,f.id)).blocks,o)}catch(v){console.error("[ComponentsLibrary] failed to append saved subtree",v)}})();return}const m=h.blockId;if(p.didDrop()){p.getDropResult();return}return o===void 0?F.insertNewChildInContainer({parentId:a,blockId:m}):F.insertNewChildInColumn({parentId:a,blockId:m,indexArray:o})},canDrop:(h,p)=>{if(p.getItemType()==="library-component")return!0;const m=h.blockId;return!F.isChildOf({targetId:a,draggedId:m})&&m!==a},collect:h=>({isOver:h.canDrop()?!!h.isOver():!1})}),[a,o]),_=t&&t.length>0?(0,n.jsx)(A.Box,{ref:h=>{c(h)},sx:{minHeight:0,border:d?"2px solid":"",borderColor:d?"secondary.main":void 0},"aria-hidden":!0}):null;return s?t.map(h=>(0,n.jsx)(y.Fragment,{children:(0,n.jsx)(s9,{id:h,isNotClient:s})},h)):!t||t.length===0?(0,n.jsx)(A.Box,{ref:h=>{c(h)},sx:{minHeight:96,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:1,border:d?"2px solid":"1px dashed",borderColor:d?"secondary.main":"divider",backgroundImage:h=>`repeating-linear-gradient(45deg, ${h.palette.action.hover} 0, ${h.palette.action.hover} 1px, transparent 1px, transparent 12px)`,backgroundColor:d?"action.hover":"transparent",transition:"background-color 120ms ease, border-color 120ms ease"},children:(0,n.jsxs)(A.Stack,{spacing:.75,sx:{px:2,color:"text.secondary",alignItems:"center"},children:[(0,n.jsx)(YO,{sx:{fontSize:22,opacity:.7}}),(0,n.jsx)(A.Typography,{variant:"body2",color:"text.secondary",sx:{textAlign:"center"},children:u("editor.emptyCanvasDropHint","Drag a block here from the library")})]})}):(0,n.jsxs)(n.Fragment,{children:[t.map(h=>(0,n.jsx)(y.Fragment,{children:(0,n.jsx)(s9,{id:h})},h)),_]})}var aA=Ae.ColumnsContainerPropsSchema,L2d=[{childrenIds:[]},{childrenIds:[]},{childrenIds:[]}];function E2d({style:t,props:r,blockId:a,isNotClient:o}){const s=o6(),{columns:u,...d}=r??{},c=u??L2d,_=(h,{block:p,blockId:m,childrenIds:f})=>{const v=F.editorStateStore.getState().document[s],S=v?.data?.props?.columns??c,g=v?.data?.props?{...v.data.props}:{...d};delete g.columns;const b=S.length===2?[...S,{childrenIds:[]}]:[...S];b[h]={childrenIds:f};const T={...g,fixedWidths:g.fixedWidths?.length===2?[...g.fixedWidths,null]:g.fixedWidths},M={type:"ColumnsContainer",data:aA.parse({style:v?.data?.style??t,props:{...T,columns:b}})};F.applyBlockUpdates({[m]:p,[s]:M}),F.setSelectedBlockId(m)};return o?(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(Ae.ColumnsContainer,{blockId:a,props:d,style:t,columns:[(0,n.jsx)(Il,{isNotClient:o,parentId:a,position:0,childrenIds:u?.[0]?.childrenIds,onChange:h=>_(0,h)}),(0,n.jsx)(Il,{isNotClient:o,parentId:a,position:1,childrenIds:u?.[1]?.childrenIds,onChange:h=>_(1,h)}),(0,n.jsx)(Il,{isNotClient:o,parentId:a,position:2,childrenIds:u?.[2]?.childrenIds,onChange:h=>_(2,h)})]})}):(0,n.jsx)(Ae.ClientOnly,{children:(0,n.jsx)(Ae.ColumnsContainer,{blockId:a,props:d,style:t,columns:[(0,n.jsx)(Il,{parentId:a,position:0,childrenIds:u?.[0]?.childrenIds,onChange:h=>_(0,h)}),(0,n.jsx)(Il,{parentId:a,position:1,childrenIds:u?.[1]?.childrenIds,onChange:h=>_(1,h)}),(0,n.jsx)(Il,{parentId:a,position:2,childrenIds:u?.[2]?.childrenIds,onChange:h=>_(2,h)})]})})}function V2d({childrenIds:t}){return(0,n.jsx)(n.Fragment,{children:t.map(r=>(0,n.jsx)(y.Fragment,{children:(0,n.jsx)(s9,{isNotClient:!0,id:r})},r))})}function k2d({style:t,props:r,blockId:a,isNotClient:o}){const s=r?.childrenIds??[],u=o6();return(0,n.jsx)(Ae.Container,{style:t,blockId:`${a}`,children:o?(0,n.jsx)(V2d,{parentId:a,childrenIds:s,onChange:({block:d,blockId:c,childrenIds:_})=>{F.insertChildAndUpdateParent(u,c,d,_),F.setSelectedBlockId(c)}}):(0,n.jsx)(Ae.ClientOnly,{children:(0,n.jsx)(Il,{parentId:a,childrenIds:s,onChange:({block:d,blockId:c,childrenIds:_})=>{F.insertChildAndUpdateParent(u,c,d,_),F.setSelectedBlockId(c)}})})})}var I4r=Ae.ContainerPropsSchema;function D2d(t){const r=t.childrenIds??[],a=o6(),o=F.useSelectedScreenSize();return(0,n.jsx)("div",{onClick:()=>{F.setSelectedBlockId(null)},style:{backgroundColor:t.backdropColor??"#F5F5F5",color:t.textColor??"#262626",fontFamily:pcr(t?.fontFamily||"OPEN_SANS"),fontSize:"16px",fontWeight:"400",letterSpacing:"0.15008px",lineHeight:"1.5",margin:"0",width:"100%"},children:(0,n.jsx)("table",{role:"presentation",align:"center",width:"100%",style:{margin:"0 auto",maxWidth:o==="desktop"?600:370,backgroundColor:t.canvasColor??"#FFFFFF",borderRadius:t.borderRadius??void 0,border:(()=>{const s=t.borderColor;if(s)return`1px solid ${s}`})()},cellSpacing:"0",cellPadding:"0",border:0,children:(0,n.jsx)("tbody",{children:(0,n.jsx)("tr",{style:{width:"100%"},children:(0,n.jsx)("td",{"data-value":"__content",children:(0,n.jsx)(Ae.ClientOnly,{children:(0,n.jsx)(Il,{listEndPolicy:"root",parentId:a,childrenIds:r,onChange:({block:s,blockId:u,childrenIds:d})=>{F.insertChildAndUpdateParent(a,u,s,d),F.setSelectedBlockId(u)}})})})})})})})}var B4r=VC,N2d=t=>r=>({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:r.palette.secondary.main,padding:"1px",display:"flex",alignItems:"center",justifyContent:"center"}),N5=null;function F2d({blockId:t}){const r=F.useBlock(t),{t:a}=Ze("inspector"),{t:o}=Ze(),s=F.useDevMode(),u=F.useComponentsStorageMode(),d=s&&u!=="local",[c,_]=(0,y.useState)(!1),h=(0,y.useMemo)(()=>{if(!r||r.type==="EmailLayout")return!1;try{const M=F.editorStateStore.getState().document;return wur(t,M)==="section"}catch{return!1}},[r,t]),p=N5&&N5.blockType===r?.type,m=(0,y.useRef)(null),[f,v]=(0,y.useState)(!1);(0,y.useEffect)(()=>{const M=()=>{if(!m.current)return;const x=m.current.parentElement;if(!x)return;const w=x.getBoundingClientRect(),R=x.closest(".preview-container");R&&(R.getBoundingClientRect().right-w.right<48?v(!0):v(!1))};M(),window.addEventListener("resize",M),window.addEventListener("scroll",M,!0);const O=setTimeout(M,100);return()=>{window.removeEventListener("resize",M),window.removeEventListener("scroll",M,!0),clearTimeout(O)}},[t]);const S=(0,y.useCallback)(()=>{const M=F.editorStateStore.getState().document,O=F.editorStateStore.getState().notionTextInlineEditingBlockId,x=(P,H,L=new Set)=>{if(L.has(P))return;L.add(P);const E=H[P];E&&(E.type==="Container"&&(E.data?.props?.childrenIds||[]).forEach(z=>x(z,H,L)),E.type==="ColumnsContainer"&&(E.data?.props?.columns||[]).forEach(z=>{(z.childrenIds||[]).forEach(V=>x(V,H,L))}))},w=new Set;x(t,M,w),w.add(t);const R=P=>P&&P.filter(H=>!w.has(H)),j={...M};for(const[P,H]of Object.entries(j)){if(w.has(P))continue;const L=H;switch(L.type){case"EmailLayout":j[P]={...L,data:{...L.data,childrenIds:R(L.data.childrenIds)}};break;case"Container":j[P]={...L,data:{...L.data,props:{...L.data.props,childrenIds:R(L.data.props?.childrenIds)}}};break;case"ColumnsContainer":j[P]={...L,data:{...L.data,props:{...L.data.props,columns:L.data.props?.columns?.map(E=>({...E,childrenIds:R(E.childrenIds)}))}}};break;default:j[P]=L}}for(const P of w)delete j[P];O&&(O===t||w.has(O))&&F.setNotionTextInlineEditingBlockId(null),F.setDocument(j),F.setSelectedBlockId(null)},[t]),g=(0,y.useCallback)(()=>{r&&"style"in r.data&&r.data.style&&(N5={styles:JSON.parse(JSON.stringify(r.data.style)),blockType:r.type})},[r]),b=(0,y.useCallback)(()=>{const M=F.editorStateStore.getState().document;if(!N5||N5.blockType!==r?.type)return;const O={...M},x=O[t];x&&(O[t]={...x,data:{...x.data,style:JSON.parse(JSON.stringify(N5.styles))}},F.setDocument(O),F.setSelectedBlockId(t))},[t,r]),T=(0,y.useCallback)(()=>{F.duplicateBlock(t)},[t]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(A.Paper,{ref:m,sx:N2d(f),onClick:M=>M.stopPropagation(),elevation:10,children:[(0,n.jsx)(A.Tooltip,{title:a("actions.copyFormat"),placement:"left-start",children:(0,n.jsx)("span",{children:(0,n.jsx)(A.IconButton,{onClick:g,sx:{padding:"4px",overflow:"hidden",color:"text.primary"},disabled:!(r&&"style"in r.data&&r.data.style),children:(0,n.jsxs)("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,n.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"}),(0,n.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"}),(0,n.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"}),(0,n.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"}),(0,n.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"})]})})})}),(0,n.jsx)(A.Tooltip,{title:a(p?"actions.pasteFormatting":"actions.noFormatSupported"),placement:"left-start",children:(0,n.jsx)("span",{children:(0,n.jsx)(A.IconButton,{onClick:b,sx:{padding:"4px",overflow:"hidden",color:p?"text.primary":"text.disabled"},disabled:!p,children:(0,n.jsx)("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,n.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"})})})})}),(0,n.jsx)(A.Tooltip,{title:o("editor.cloneBlock"),placement:"left-start",children:(0,n.jsx)(A.IconButton,{onClick:T,sx:{padding:"4px",overflow:"hidden",color:"text.primary"},children:(0,n.jsx)(ee.ContentCopy,{sx:{fontSize:"1.25rem"}})})}),(0,n.jsx)(A.Tooltip,{title:a("actions.delete"),placement:"left-start",children:(0,n.jsx)(A.IconButton,{onClick:S,sx:{overflow:"hidden",color:"error.main",padding:"4px"},children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:(0,n.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"})})})}),d&&(0,n.jsx)(A.Tooltip,{title:a("componentsLibrary.save.tooltip"),placement:"left-start",children:(0,n.jsx)("span",{children:(0,n.jsx)(A.IconButton,{onClick:()=>_(!0),disabled:!h,sx:{padding:"4px",overflow:"hidden",color:h?"text.primary":"text.disabled"},"aria-label":a("componentsLibrary.save.button"),children:(0,n.jsx)(EO,{sx:{fontSize:"1.25rem"}})})})})]}),d&&c&&h&&(0,n.jsx)(zid,{open:c,rootBlockId:t,onClose:()=>_(!1)})]})}var I2d=(0,y.memo)(F2d);yn();var aJ=150,B2d=25,k0=null,u9=null;function oA(){k0&&(clearTimeout(k0),k0=null),u9=null}function oJ(t){u9===t&&oA()}function J2d(t,r,a,o){oA(),u9=t,k0=setTimeout(()=>{k0=null,u9=null,a()&&(F.setCanvasHoveredBlockId(t),o())},r)}function U2d(t){const r=t.closest(".preview-container");if(!r)return aJ;let a=0,o=t;for(;o&&r.contains(o)&&(o.hasAttribute("data-block-id")&&(a+=1),o!==r);)o=o.parentElement;return aJ+Math.max(0,a-1)*B2d}function W2d(t){const r=F.useNotionTextInlineEditingBlockId();return(0,y.useMemo)(()=>r?F.isChildOf({draggedId:t,targetId:r}):!1,[t,r])}function $2d(t){if(!t||typeof t.nodeType!="number")return null;const r=t,a=r.closest?.(".preview-container");if(!a)return null;const o=r.closest?.("[data-block-id]"),s=o?.getAttribute("data-block-id")??null;return!s||!o||!a.contains(o)?null:s}function G2d({children:t,canEdit:r=!0,isNotClient:a=!1}){const o=o6(),{t:s}=Ze(),u=F.useCanvasHoveredBlockId(),d=F.useIsBlockSelected(o),c=F.useBlockType(o),_=F.useSelectedMainTab(),h=F.useNotionTextInlineEditingBlockId(),p=F.useEditingBlockId();F.useHighlightColor();const m=W2d(o),[f,v]=(0,y.useState)(!1),[S,g]=(0,y.useState)(0),b=(0,y.useRef)(null),T=(0,y.useRef)(null),[M,O]=(0,y.useState)(null),x=$1(),w=F.useIsInFocusedEditingMode(),R=h===o||m,j=p===o,P=x.palette.primary.light||x.palette.primary.main,H=(0,y.useRef)(null),L=(0,y.useRef)(!0);if(a)return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{style:{width:"100%"}}),(0,n.jsx)(A.Box,{sx:{position:"relative",maxWidth:"100%"},children:(0,n.jsx)("div",{children:t})}),(0,n.jsx)("div",{style:{width:"100%"}})]});let E,z;j&&r?(E=`2px solid ${P}`,z="10"):d&&r?(E=`2px solid ${x.palette.secondary.main}`,z="1"):f&&r?E=`2px dotted ${x.palette.secondary.main}`:z="auto";const V=()=>!d||!r?null:(0,n.jsx)(I2d,{blockId:o}),k=Y=>{const re=Y.getClientOffset(),Q=b.current?.getBoundingClientRect(),le=T.current?.getBoundingClientRect();return!re||!Q||!le?null:Math.abs(re.y-Q.y)<Math.abs(re.y-le.y)?"up":"down"},[{isOver:D},N]=z9(()=>({accept:["block",ji],drop:(Y,re)=>{if(re.getItemType()==="library-component"){if(re.didDrop()){re.getDropResult();return}if(Y.category==="block"&&typeof Y.buttonIndex=="number"){const J=Q2[Y.buttonIndex];if(!J)return;k(re)==="up"?F.insertBuiltInBlockBeforeSibling(o,J.block()):F.insertBuiltInBlockAfterSibling(o,J.block());return}if(Y.category==="block-preset"&&typeof Y.presetIndex=="number"){const J=n6[Y.presetIndex];if(!J)return;k(re)==="up"?F.insertBuiltInBlockBeforeSibling(o,J.block):F.insertBuiltInBlockAfterSibling(o,J.block);return}const Z=Y;if(Z.category==="template"){console.warn("[ComponentsLibrary] templates cannot be dropped inline; click the card in the drawer to apply.");return}const se=k(re)==="up"?"before":"after";(async()=>{try{const J=await r6(Z.category,Z.axis,Z.id);se==="after"?F.insertSavedComponentAfterSibling(o,J.blocks):F.insertSavedComponentBeforeSibling(o,J.blocks)}catch(J){console.error("[ComponentsLibrary] failed to insert saved subtree",J)}})();return}const Q=o,le=Y.blockId;if(Q===le)return;if(re.didDrop()){re.getDropResult();return}const ce=k(re);if(ce)F.changeBlockPosition(Q,le,ce);else{F.changeBlockPosition(Q,le,"down");return}},canDrop:(Y,re)=>re.getItemType()==="library-component"?!0:!F.isChildOf({targetId:o,draggedId:Y.blockId}),collect:Y=>({isOver:Y.canDrop()?Y.isOver({shallow:!0}):!1}),hover:(Y,re)=>{if(re.getItemType()==="library-component"){if(!re.canDrop()||!re.isOver({shallow:!0})){O(null);return}const le=k(re);O(le??null);return}if(Y.blockId===o){O(null);return}if(!re.canDrop()||!re.isOver({shallow:!0})){O(null);return}const Q=k(re);if(!Q){O(null);return}O(Q)},end:()=>{O(null)}}));(0,y.useEffect)(()=>{D||O(null)},[D]);const I=()=>(0,n.jsxs)("div",{style:{height:"3px",background:x.palette.secondary.main,position:"relative",color:x.palette.secondary.main},children:[(0,n.jsx)("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:(0,n.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"})}),(0,n.jsx)("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:(0,n.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"})})]}),[{borderDrag:B="",isDragging:q},te]=a5(()=>({type:"block",item:()=>{const Y=F.editorStateStore.getState().notionTextInlineEditingBlockId;return Y&&window.dispatchEvent(new CustomEvent("notion-text-force-save",{detail:{blockId:Y}})),{blockId:o}},canDrag:!R,collect:Y=>({borderDrag:Y.isDragging()?"2px dotted yellow":"",isDragging:Y.isDragging()}),end:()=>{g(Date.now())}}),[R,o])||[{borderDrag:"",isDragging:!1},y.default.useRef(null)],$=r&&_!=="preview"&&!R&&!w&&(q||u===o||u==null&&d);(0,y.useEffect)(()=>(L.current=!0,()=>{L.current=!1,oJ(o),H.current&&(clearTimeout(H.current),H.current=null),F.editorStateStore.getState().canvasHoveredBlockId===o&&F.setCanvasHoveredBlockId(null)}),[o]);const W=Y=>{const re=Date.now()-S;if(!(q||S>0&&re<200)&&(Y.stopPropagation(),_!=="preview")){if(c==="NotionText"){const Q=new CustomEvent("email-builder-highlight-editor",{detail:!0});window.dispatchEvent(Q)}F.setSelectedBlockId(o)}},_e=y.default.useMemo(()=>y.default.cloneElement(t,{onClick:Y=>{t.props.onClick&&t.props.onClick(Y),!Y.defaultPrevented&&!Y.isPropagationStopped()&&(q||W(Y))},onMouseDown:Y=>{t.props.onMouseDown&&t.props.onMouseDown(Y)},onMouseUp:Y=>{t.props.onMouseUp&&t.props.onMouseUp(Y)}}),[t,q,o,c,_]);return(0,n.jsxs)(n.Fragment,{children:[M==="up"&&(0,n.jsx)(I,{}),(0,n.jsx)("div",{ref:b,style:{width:"100%"}}),(0,n.jsx)(A.Box,{"data-block-id":o,sx:{position:"relative",maxWidth:"100%"},ref:N,onMouseEnter:Y=>{Y.stopPropagation(),oA(),H.current&&(clearTimeout(H.current),H.current=null);const re=U2d(Y.currentTarget);J2d(o,re,()=>L.current,()=>v(!0))},onMouseLeave:Y=>{oJ(o),H.current&&clearTimeout(H.current);const re=Y.relatedTarget;H.current=setTimeout(()=>{if(v(!1),F.editorStateStore.getState().canvasHoveredBlockId!==o)return;const Q=$2d(re);Q&&Q!==o?F.setCanvasHoveredBlockId(Q):F.setCanvasHoveredBlockId(null)},150)},onClick:W,children:(0,n.jsxs)(A.Box,{sx:{position:"relative",maxWidth:"100%",outlineOffset:"-1px",outline:E,zIndex:z,transition:"outline 0.2s ease-in-out, z-index 0.2s ease-in-out"},children:[V(),$?(0,n.jsx)(A.Box,{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:j&&r?P:x.palette.secondary.main},children:(0,n.jsx)(A.Tooltip,{title:s("editor.dragBlockHandle"),placement:"top",children:(0,n.jsx)(A.IconButton,{ref:te,type:"button","aria-label":s("editor.dragBlockHandle"),size:"small",onClick:Y=>Y.stopPropagation(),sx:{padding:"3px 6px",rotate:"90deg",borderRadius:0,color:"white",cursor:q?"grabbing":"grab",touchAction:"none","&:hover":{backgroundColor:"rgba(255,255,255,0.15)"}},children:(0,n.jsx)(ee.DragIndicator,{sx:{fontSize:15}})})})}):null,(0,n.jsx)(A.Fade,{in:j&&r,timeout:200,children:(0,n.jsx)(A.Chip,{label:s("editor.editing"),icon:(0,n.jsx)(ee.EditOutlined,{}),size:"small",sx:{position:"absolute",left:-1,top:-26,backgroundColor:P,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"}}})}),(0,n.jsx)("div",{style:{border:B},children:_e})]})}),M==="down"&&(0,n.jsx)(I,{}),(0,n.jsx)("div",{ref:T,style:{width:"100%"}})]})}var gl=(0,y.memo)(G2d,(t,r)=>t.children===r.children&&t.canEdit===r.canEdit&&t.isNotClient===r.isNotClient),q2d=(0,y.memo)(Ae.BlockSocialMedia),K2d=t=>{const r=F.useSelectedScreenSize(),a=F.useDisableEdition();return(0,n.jsx)(q2d,{...t,selectedScreenSize:r,disableEdition:a})},Y2d=(0,y.memo)(Ae.Button),Q2d=(0,y.memo)(k2d),X2d=(0,y.memo)(E2d),Z2d=(0,y.memo)(Ae.Image),eld=(0,y.memo)(Oid),tld=(0,y.memo)(Ae.Spacer),rld=(0,y.memo)(Ae.Divider),J4r=Ae.buildBlockConfigurationDictionary({SocialMedia:{schema:Ae.BlockSocialMediaPropsScheme,Component:t=>(0,n.jsx)(gl,{isNotClient:t.isNotClient,children:(0,n.jsx)(K2d,{...t})})},Button:{schema:Ae.ButtonPropsSchema,Component:t=>(0,n.jsx)(gl,{isNotClient:t.isNotClient,children:(0,n.jsx)(Y2d,{...t})})},Container:{schema:I4r,Component:t=>(0,n.jsx)(gl,{isNotClient:t.isNotClient,children:(0,n.jsx)(Q2d,{...t})})},ColumnsContainer:{schema:aA,Component:t=>(0,n.jsx)(gl,{isNotClient:t.isNotClient,children:(0,n.jsx)(X2d,{...t})})},Image:{schema:Ae.ImagePropsSchema,Component:t=>{const r={...t,props:{...t.props,url:t.props?.url??"https://placehold.co/600x400@2x/F8F8F8/CCC?text=Your%20image"}};return(0,n.jsx)(gl,{isNotClient:t.isNotClient,children:(0,n.jsx)(Z2d,{...r})})}},NotionText:{schema:Ae.NotionTextPropsSchema,Component:t=>(0,n.jsx)(gl,{isNotClient:t.isNotClient,children:(0,n.jsx)(eld,{blockId:t.blockId??"",...t})})},EmailLayout:{schema:B4r,Component:t=>(0,n.jsx)(D2d,{...t})},Spacer:{schema:Ae.SpacerPropsSchema,Component:t=>(0,n.jsx)(gl,{isNotClient:t.isNotClient,children:(0,n.jsx)(tld,{...t})})},Divider:{schema:Ae.DividerPropsSchema,Component:t=>(0,n.jsx)(gl,{isNotClient:t.isNotClient,children:(0,n.jsx)(rld,{...t})})}}),nld=Ae.buildBlockComponent(J4r),I3=Object.fromEntries(Object.entries(J4r).map(([t,r])=>[t,Ae.getSchemaDefaults(r.schema)??{}])),U4r=({tabs:t,defaultTab:r})=>{const a=(0,y.useMemo)(()=>t.filter(d=>d.visible),[t]),[o,s]=(0,y.useState)(null);if((0,y.useEffect)(()=>{if(o&&a.some(c=>c.key===o))return;const d=r&&a.some(c=>c.key===r)?r:a[0]?.key??null;s(d)},[a,r,o]),a.length===0)return null;if(a.length===1)return(0,n.jsx)(A.Box,{children:a[0].render()});const u=a.find(d=>d.key===o)??a[0];return(0,n.jsxs)(A.Box,{children:[(0,n.jsx)(A.Tabs,{value:u.key,onChange:(d,c)=>s(c),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:a.map(d=>(0,n.jsx)(A.Tab,{value:d.key,label:d.label,disableRipple:!0},d.key))}),(0,n.jsx)(A.Box,{children:u.render()})]})},ald={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"}},old=t=>r=>r.document[t],ild=t=>r=>{const a=r.document[t];if(!a)return[];switch(a.type){case"EmailLayout":return a.data?.childrenIds||[];case"Container":return a.data?.props?.childrenIds||[];case"ColumnsContainer":return a.data?.props?.columns?.flatMap(o=>o.childrenIds||[])||[];default:return[]}};function lld(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(r=>r.childrenIds||[])||[];default:return[]}}function W4r(t,r,a){const o=lld(t[r]);for(const s of o)if(s===a||W4r(t,s,a))return!0;return!1}function sld(t,r,a,o){if(!o)return!1;const s=t[r];if(!s||s.type!=="ColumnsContainer")return!1;const u=s.data?.props?.columns?.[a]?.childrenIds||[];for(const d of u)if(d===o||W4r(t,d,o))return!0;return!1}function uld(t){const r=t.document;if(!r||!r.root)return null;function a(s,u){const d=u.document[s];if(!d)return[];switch(d.type){case"EmailLayout":return d.data?.childrenIds||[];case"Container":return d.data?.props?.childrenIds||[];case"ColumnsContainer":return d.data?.props?.columns?.flatMap(c=>c.childrenIds||[])||[];default:return[]}}function o(s,u,d){const c=d.document[s],_=c?.type??"Unknown",h=ald[_]??{label:_,iconName:"WidgetsOutlined"};if(_==="ColumnsContainer"){const m=c.data?.props?.columns,f=c.data?.props?.columnsCount===2?2:3,v=[];for(let S=0;S<f;S++){const g=m?.[S]?.childrenIds??[],b=F.makeComponentTreeColumnSlotId(s,S);v.push({blockId:b,type:"ColumnSlot",label:"",iconName:"WidgetsOutlined",children:g.map(T=>o(T,u+2,d)),depth:u+1,columnSlot:{parentBlockId:s,columnIndex:S,columnsCount:f}})}return{blockId:s,type:_,label:h.label,iconName:h.iconName,children:v,depth:u}}const p=a(s,d).map(m=>o(m,u+1,d));return{blockId:s,type:_,label:h.label,iconName:h.iconName,children:p,depth:u}}return o("root",0,t)}function dld(){const t=F.editorStateStore(r=>r.document);return(0,y.useMemo)(()=>uld({document:t}),[t])}function $4r(t){return F.editorStateStore(old(t))}function cld(t){return F.editorStateStore(ild(t))}var iA=F.create(()=>({credits:{}}));function _ld(t,r){iA.setState(a=>({credits:{...a.credits,[t]:r}}))}function cd(t){iA.setState(r=>{const{[t]:a,...o}=r.credits;return{credits:o}})}function hld(t){return iA(r=>t?r.credits[t]??null:null)}var pld=350,mld=20,fld=10,vld=["any","landscape","portrait","squarish"],xn={query:"",orientation:"any",photos:[],page:0,totalPages:0,selectedPhoto:null},G4r=({backendUrl:t,blockId:r,source:a})=>{const{t:o}=Ze("inspector"),s=(0,y.useMemo)(()=>to(t),[t]),[u,d]=(0,y.useState)(r??null),[c,_]=(0,y.useState)(null),[h,p]=(0,y.useState)(a??"image");(0,y.useEffect)(()=>{r!=null&&d(r)},[r]),(0,y.useEffect)(()=>{a!=null&&p(a)},[a]);const[m,f]=(0,y.useState)(xn.query),[v,S]=(0,y.useState)(xn.orientation),[g,b]=(0,y.useState)(xn.photos),[T,M]=(0,y.useState)(xn.page),[O,x]=(0,y.useState)(xn.totalPages),[w,R]=(0,y.useState)(null),[,j]=(0,y.useState)(xn.selectedPhoto),[P,H]=(0,y.useState)(!1),[L,E]=(0,y.useState)(null),z=(0,y.useRef)(null);(0,y.useEffect)(()=>{const I=B=>{const{detail:q}=B;d(q.blockId),_(q.currentImageUrl),p(q.source??"image")};return window.addEventListener("email-builder-image-panel-opened",I),()=>window.removeEventListener("email-builder-image-panel-opened",I)},[]);const V=(0,y.useCallback)(async(I,B,q,te)=>{z.current?.abort();const $=new AbortController;z.current=$,H(!0),E(null);try{const W=await pY5(s,{query:I,page:q,perPage:mld,orientation:B==="any"?void 0:B,signal:$.signal});R(W.rateLimitRemaining),x(W.totalPages),M(q),b(_e=>{const Y=te?[..._e,...W.results]:W.results;return xn.photos=Y,xn.page=q,xn.totalPages=W.totalPages,Y})}catch(W){if(W?.name==="AbortError")return;E(W instanceof iu?W.kind:"unknown"),te||b([])}finally{z.current===$&&(H(!1),z.current=null)}},[s]);(0,y.useEffect)(()=>{xn.query=m,xn.orientation=v;const I=m.trim();if(I.length===0){z.current?.abort(),b([]),M(0),x(0),E(null),xn.photos=[],xn.page=0,xn.totalPages=0;return}const B=window.setTimeout(()=>{V(I,v,1,!1)},pld);return()=>window.clearTimeout(B)},[m,v,V]),(0,y.useEffect)(()=>()=>z.current?.abort(),[]);const k=T>0&&T<O&&!P,D=()=>{const I=m.trim();!I||!k||V(I,v,T+1,!0)},N=I=>{if(!u)return;const B=mY5(I);h==="image"?B4(u,{url:B,alt:I.attribution}):window.dispatchEvent(new CustomEvent("email-builder-set-image",{detail:{url:B}})),j(I),xn.selectedPhoto=I,_ld(u,{photoId:I.id,photographerName:I.user.name,photographerUrl:I.user.profileUrl,unsplashUrl:I.unsplashUrl}),Our(s,I.links.downloadLocation)};return(0,n.jsxs)(A.Box,{children:[(0,n.jsxs)(A.Stack,{direction:"row",spacing:1,sx:{mb:1,alignItems:"center"},children:[(0,n.jsx)(A.TextField,{fullWidth:!0,size:"small",placeholder:o("inputs.unsplash.searchPlaceholder"),value:m,onChange:I=>f(I.target.value),slotProps:{input:{startAdornment:(0,n.jsx)(A.InputAdornment,{position:"start",children:(0,n.jsx)(ee.Search,{fontSize:"small",sx:{color:"text.secondary"}})})}}}),w!==null&&w<=fld&&(0,n.jsx)(A.Chip,{label:o("inputs.unsplash.quotaLow",{remaining:w}),size:"small",color:"warning",variant:"outlined"})]}),(0,n.jsx)(A.Tabs,{value:v,onChange:(I,B)=>S(B),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:vld.map(I=>(0,n.jsx)(A.Tab,{value:I,label:o(`inputs.unsplash.orientation.${I}`),disableRipple:!0},I))}),L&&(0,n.jsx)(A.Alert,{severity:L==="not_configured"?"warning":"error",sx:{mb:1.5,fontSize:"0.75rem"},children:o(`inputs.unsplash.error.${L}`)}),P&&g.length===0&&(0,n.jsx)(A.Box,{sx:{display:"flex",justifyContent:"center",py:3},children:(0,n.jsx)(A.CircularProgress,{size:22})}),!P&&!L&&g.length===0&&m.trim().length===0&&(0,n.jsx)(A.Box,{sx:{textAlign:"center",py:3},children:(0,n.jsx)(A.Typography,{variant:"caption",color:"text.secondary",children:o("inputs.unsplash.emptyInitial")})}),!P&&!L&&g.length===0&&m.trim().length>0&&(0,n.jsx)(A.Box,{sx:{textAlign:"center",py:3},children:(0,n.jsx)(A.Typography,{variant:"caption",color:"text.secondary",children:o("inputs.unsplash.emptyNoResults",{query:m.trim()})})}),g.length>0&&(0,n.jsx)(A.Box,{sx:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:1,maxHeight:380,overflowY:"auto"},children:g.map(I=>{const B=c?.includes(I.id)??!1;return(0,n.jsx)(Sld,{photo:I,selected:B,onPick:()=>N(I)},I.id)})}),k&&(0,n.jsx)(A.Box,{sx:{textAlign:"center",mt:2},children:(0,n.jsx)(A.Link,{component:"button",variant:"caption",onClick:D,sx:{cursor:"pointer"},children:o("inputs.unsplash.loadMore")})}),(0,n.jsxs)(A.Typography,{variant:"caption",sx:{display:"block",mt:1.5,color:"text.secondary",textAlign:"center",fontSize:"0.65rem"},children:[o("inputs.unsplash.poweredBy")," ",(0,n.jsx)(A.Link,{href:"https://unsplash.com/?utm_source=email-builder-online&utm_medium=referral",target:"_blank",rel:"noreferrer noopener",underline:"hover",color:"inherit",children:"Unsplash"})]})]})},Sld=({photo:t,selected:r,onPick:a})=>{const{t:o}=Ze("inspector"),s=t.color??void 0;return(0,n.jsxs)(A.Box,{sx:{borderRadius:1,overflow:"hidden",border:"2px solid",borderColor:r?"primary.main":"divider",cursor:"pointer",backgroundColor:s??"action.hover",transition:"border-color 0.15s ease","&:hover":{borderColor:"primary.light"}},children:[(0,n.jsx)(A.Box,{sx:{position:"relative",aspectRatio:"1",overflow:"hidden"},children:(0,n.jsx)("img",{src:t.urls.thumb,alt:t.alt,loading:"lazy",onClick:a,style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})}),(0,n.jsx)(A.Box,{sx:{px:.75,py:.5,fontSize:"0.6rem",lineHeight:1.3,bgcolor:"#1a1a1a",color:"#ccc",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:(0,n.jsx)(L$,{t:o,i18nKey:"inputs.unsplash.creditLine",values:{author:t.user.name},components:{authorLink:(0,n.jsx)(A.Link,{href:t.user.profileUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",onClick:u=>u.stopPropagation(),sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}}),unsplashLink:(0,n.jsx)(A.Link,{href:t.unsplashUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",onClick:u=>u.stopPropagation(),sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}})}})})]})};function gld({onClick:t,disabled:r,primary:a=!1}){const{t:o}=Ze("inspector");return(0,n.jsx)(A.IconButton,{"aria-label":o("inputs.common.close"),onClick:t,disabled:r,sx:{position:"absolute",right:8,top:8,color:s=>a?"brand.blue":s.palette.grey[500],"&:hover":{opacity:.8}},children:(0,n.jsx)(ee.Close,{})})}function bld({imageUrl:t,saving:r=!1}){return(0,n.jsxs)(A.Card,{sx:{position:"relative"},children:[r&&(0,n.jsx)(A.Stack,{sx:{justifyContent:"center",alignItems:"center",position:"absolute",top:7,left:0,width:"100%",height:"314px",zIndex:20,backgroundColor:"#212121AA",mb:1},children:(0,n.jsx)(A.CircularProgress,{size:48,thickness:6,color:"inherit",sx:{color:"white"}})}),(0,n.jsx)(A.CardMedia,{component:"img",sx:{objectFit:"contain",width:"100%",height:"326px"},image:t,alt:"Generated Image"})]})}function Tld({value:t,onChange:r,disabled:a}){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A.Typography,{sx:{fontSize:"14px",fontWeight:700},children:"Image description"}),(0,n.jsx)(A.TextField,{disabled:a,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:o=>r(o.target.value),sx:{mt:.5,"& .MuiOutlinedInput-root":{borderRadius:"6px"}}})]})}var yld=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 q4r({src:t,style:r}){const{t:a}=Ze("inspector"),[o,s]=(0,y.useState)(!1),[u,d]=(0,y.useState)(!1),[c,_]=(0,y.useState)(""),[h,p]=(0,y.useState)(null),[m,f]=(0,y.useState)(!1),[v,S]=(0,y.useState)(null),[g,b]=(0,y.useState)(!1),[T,M]=(0,y.useState)(0),[O,x]=(0,y.useState)(0),w=(0,y.useRef)(null),R=[a("inputs.aiImageGeneration.loadingStep1"),a("inputs.aiImageGeneration.loadingStep2"),a("inputs.aiImageGeneration.loadingStep3"),a("inputs.aiImageGeneration.loadingStep4")],j=(0,y.useCallback)(()=>{M(0),x(0),w.current&&clearInterval(w.current);const k=6e4,D=100;let N=0;w.current=setInterval(()=>{N+=D,M(Math.min(N/k*95,95)),x(Math.min(Math.floor(N/k*R.length),R.length-1)),N>=k&&w.current&&clearInterval(w.current)},D)},[R.length]),P=(0,y.useCallback)(()=>{w.current&&(clearInterval(w.current),w.current=null),M(100)},[]),H=()=>{s(!0),S(null)},L=()=>{u||(s(!1),d(!1),p(null),_(""),f(!1),S(null),b(!1),P())},E=()=>{const k=h&&!m?"store-ai-image":"request-ai-image",D=h&&!m?h:c;S(null),k==="store-ai-image"?(b(!0),d(!1),setTimeout(()=>{d(!1),L()},2e3)):(d(!0),j()),window.dispatchEvent(new CustomEvent(k,{detail:D}))},z=()=>{f(!0),p(null),S(null),b(!1)};(0,y.useEffect)(()=>{const k=D=>{const{detail:N}=D;if(P(),d(!1),N.error){S(yld(N.error));return}if(!N.success||!N.url){S({code:0,title:"Generation Failed",message:"Failed to generate the image.",action:"Please try again"});return}p(N.url),f(!1)};return window.addEventListener("generated-image",k),()=>{window.removeEventListener("generated-image",k)}},[]),(0,y.useEffect)(()=>{L()},[t]);const V=!h||m;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A.Button,{style:r,startIcon:(0,n.jsx)(ee.AutoAwesome,{className:"w-4 h-4"}),variant:"contained",onClick:H,children:a("inputs.aiImageGeneration.generate")}),(0,n.jsx)(A.Dialog,{open:o,onClose:L,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:{bgcolor:"background.paper",color:"text.primary",borderRadius:"10px"}}},children:(0,n.jsxs)("form",{onSubmit:k=>{k.preventDefault(),E()},children:[(0,n.jsxs)(A.DialogTitle,{sx:{fontWeight:700,fontSize:"24px",color:v?"error.main":"inherit"},children:[a(v?"inputs.aiImageGeneration.titleError":u?"inputs.aiImageGeneration.titleLoading":h?"inputs.aiImageGeneration.titleReady":"inputs.aiImageGeneration.titleCreate"),(0,n.jsx)(gld,{onClick:L,disabled:u,primary:!0})]}),(0,n.jsxs)(A.DialogContent,{children:[(0,n.jsx)(A.DialogContentText,{sx:{pb:1,color:v?"error.dark":"inherit"},children:a(v?"inputs.aiImageGeneration.descriptionError":u?"inputs.aiImageGeneration.descriptionLoading":V?"inputs.aiImageGeneration.descriptionCreate":"inputs.aiImageGeneration.descriptionReady")}),h&&!m?(0,n.jsxs)(A.Stack,{sx:{position:"relative"},children:[(0,n.jsx)(bld,{imageUrl:h,saving:g}),(0,n.jsxs)(A.Alert,{variant:"outlined",severity:"warning",icon:!1,children:[a("inputs.aiImageGeneration.warningRegenerate")," ",(0,n.jsx)("b",{children:a("inputs.aiImageGeneration.warningInsertFirst")})," ",a("inputs.aiImageGeneration.warningFirst")]})]}):u&&!h?(0,n.jsxs)(A.Stack,{spacing:2,sx:{justifyContent:"center",alignItems:"center",backgroundColor:k=>k.palette.mainColor?.[50]??k.palette.action.hover,height:"326px",width:"100%",borderRadius:"8px"},children:[(0,n.jsx)(ee.AutoAwesome,{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)"}}}}),(0,n.jsx)(A.Typography,{variant:"body2",sx:{color:"text.secondary",fontWeight:500,transition:"opacity 0.3s"},children:R[O]}),(0,n.jsx)(A.LinearProgress,{variant:"determinate",value:T,sx:{width:"60%",borderRadius:4,height:6}})]}):(0,n.jsx)(Tld,{value:c,onChange:_,disabled:u})]}),!u&&(0,n.jsxs)(A.DialogActions,{className:"p-6",children:[h&&!m&&(0,n.jsx)(A.Button,{startIcon:(0,n.jsx)(ee.Refresh,{className:"w-4 h-4"}),onClick:z,variant:"outlined",disabled:u,children:a("inputs.aiImageGeneration.regenerate")}),!h&&!m&&(0,n.jsx)(A.Button,{onClick:L,variant:"text",disabled:m,children:a("inputs.aiImageGeneration.cancel")}),(0,n.jsxs)(A.Button,{startIcon:h&&!m?(0,n.jsx)(ee.Attachment,{className:"w-4 h-4"}):(0,n.jsx)(ee.AutoAwesome,{className:"w-4 h-4"}),onClick:E,variant:"contained",disabled:!c||c?.length<20,children:[a(h&&!m?"inputs.aiImageGeneration.insertImage":"inputs.aiImageGeneration.generateImage"),u&&(0,n.jsx)(A.CircularProgress,{size:16,className:"ml-2"})]})]})]})})]})}var Er=({children:t})=>(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.3rem"},children:t}),K4r=({imageUrl:t,alt:r="",blockId:a,onRemove:o})=>{const{t:s}=Ze("inspector"),u=hld(a??null);return t?(0,n.jsxs)(A.Box,{sx:{position:"relative",mb:1.5,borderRadius:1,overflow:"hidden",border:"1px solid",borderColor:"divider"},children:[(0,n.jsx)("img",{src:t,alt:r,style:{width:"100%",display:"block",maxHeight:140,objectFit:"cover"}}),o&&(0,n.jsx)(A.IconButton,{"aria-label":s("inputs.common.close"),onClick:o,size:"small",sx:{position:"absolute",top:4,right:4,backgroundColor:"background.paper",color:"error.main",width:28,height:28,"&:hover":{backgroundColor:"error.50"}},children:(0,n.jsx)(ee.Close,{fontSize:"small"})}),u&&(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:.5,px:1,py:.5,bgcolor:"#1a1a1a",color:"#ccc",fontSize:"0.65rem"},children:[(0,n.jsx)(ee.CameraAltOutlined,{sx:{fontSize:"0.8rem",flexShrink:0,color:"#ccc"}}),(0,n.jsx)(L$,{t:s,i18nKey:"inputs.unsplash.creditLine",values:{author:u.photographerName},components:{authorLink:(0,n.jsx)(A.Link,{href:u.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:(0,n.jsx)(A.Link,{href:u.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},Cld=["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"],i2={style:{color:"currentColor"},width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l2={stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"},iJ=(0,n.jsx)("svg",{...i2,children:(0,n.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",...l2})});function d9(t){switch(t){case"top left":return(0,n.jsx)("svg",{...i2,children:(0,n.jsx)("path",{d:"M5.26523 9.79159L5.17094 5.17183M5.17094 5.17183L9.79071 5.26611M5.17094 5.17183L10.8278 10.8287",...l2})});case"top center":return(0,n.jsx)("svg",{...i2,children:(0,n.jsx)("path",{d:"M4.7998 7.33333L7.9998 4M7.9998 4L11.1998 7.33333M7.9998 4V12",...l2})});case"top right":return(0,n.jsx)("svg",{...i2,children:(0,n.jsx)("path",{d:"M6.20841 5.2662L10.8282 5.17192M10.8282 5.17192L10.7339 9.79169M10.8282 5.17192L5.17132 10.8288",...l2})});case"center left":return(0,n.jsx)("svg",{...i2,children:(0,n.jsx)("path",{d:"M7.33333 11.2002L4 8.00019M4 8.00019L7.33333 4.8002M4 8.00019L12 8.0002",...l2})});case"center":case"center center":return iJ;case"center right":return(0,n.jsx)("svg",{...i2,children:(0,n.jsx)("path",{d:"M8.66667 4.7998L12 7.9998M12 7.9998L8.66667 11.1998M12 7.9998L4 7.9998",...l2})});case"bottom left":return(0,n.jsx)("svg",{...i2,children:(0,n.jsx)("path",{d:"M9.79062 10.7348L5.17085 10.8291M5.17085 10.8291L5.26513 6.20929M5.17085 10.8291L10.8277 5.1722",...l2})});case"bottom center":return(0,n.jsx)("svg",{...i2,children:(0,n.jsx)("path",{d:"M11.1998 8.66667L7.9998 12M7.9998 12L4.7998 8.66667M7.9998 12L7.99981 4",...l2})});case"bottom right":return(0,n.jsx)("svg",{...i2,children:(0,n.jsx)("path",{d:"M10.7338 6.20938L10.8281 10.8291M10.8281 10.8291L6.20831 10.7349M10.8281 10.8291L5.17122 5.17229",...l2})});default:return iJ}}function c9(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"}}j_();function Y4r(t){return(0,n.jsx)(ea,{viewBox:"0 0 18 18",fontSize:"small",...t,children:(0,n.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"})})}yn();var Mld=({defaultValue:t,onChange:r,values:a})=>{const o=F.useSelectedBlockId(),{t:s}=Ze("inspector");$1();const u=Z=>{if(!Z)return{url:"",repeat:"no-repeat",position:"center center",size:"cover"};const se=Z.trim();let J="";if(se.startsWith("url(")){const ge=se.match(/^url\(\s*['"]?([^'")]+)['"]?\s*\)/);J=ge?ge[1]:""}else(/^https?:\/\//i.test(se)||se.startsWith("data:"))&&(J=se);let X="no-repeat";Z.includes("repeat-x")?X="repeat-x":Z.includes("repeat-y")?X="repeat-y":Z.includes("repeat")&&!Z.includes("no-repeat")&&(X="repeat");let oe="center center";for(const ge of["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"])if(Z.includes(ge)){oe=ge;break}let ie="cover";return Z.includes("contain")?ie="contain":Z.includes("auto")&&(ie="auto"),{url:J,repeat:X,position:oe,size:ie}},d=Z=>Z.url?`url("${Z.url}") ${Z.repeat} ${Z.position} / ${Z.size}`:"",[c,_]=(0,y.useState)(t||null),[h,p]=(0,y.useState)(u(t)),[m,f]=(0,y.useState)(!1),[v,S]=(0,y.useState)(()=>!!window.__emailBuilderEnableAI),[,g]=(0,y.useState)(null),[b,T]=(0,y.useState)(u(t).url||""),[M,O]=(0,y.useState)(!1),[x,w]=(0,y.useState)(""),[R,j]=(0,y.useState)(!1),P=(0,y.useRef)(null),[H,L]=(0,y.useState)(null),E=F.useBackgroundUrlInput(),z=F.useBackgroundUploadInput(),V=E||z,[k,D]=(0,y.useState)(()=>!!window.__emailBuilderUnsplashEnabled);(0,y.useEffect)(()=>{const Z=()=>{D(!!window.__emailBuilderUnsplashEnabled)};return Z(),window.addEventListener("email-builder-unsplash-updated",Z),()=>window.removeEventListener("email-builder-unsplash-updated",Z)},[]),(0,y.useEffect)(()=>{const Z=window.__emailBuilderCustomImageProvider;Z&&(L(Z),setTimeout(()=>{o&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:o,currentImageUrl:h.url||null,alt:null,source:"background"}}))},100))},[]);const[N,I]=(0,y.useState)(()=>sessionStorage.getItem("hideBackgroundImageWarning")==="true"),B=(Z,se)=>{const J={...h,...Z};if(p(J),J.url){const X=d(J);_(X),r(X,se)}else console.error("Update params error: ",J)},q=(Z,se)=>{if(!Z)return!1;const J=Z?.toLowerCase(),X=J.includes(".svg")||J.includes("svg"),oe=se&&(se.includes("image/svg+xml")||se.includes("svg"));return X||!!oe},te=async Z=>{try{O(!0),w(""),j(!1);try{new URL(Z)}catch{return w("Invalid URL format"),!1}const se=new AbortController,J=setTimeout(()=>se.abort(),1e4);try{const X=await fetch(Z,{method:"HEAD",signal:se.signal});if(clearTimeout(J),!X.ok)return w(`HTTP ${X.status}: ${X.statusText}`),!1;const oe=X.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(ie=>oe&&oe.toLowerCase().includes(ie.toLowerCase()))?(q(Z,oe)&&j(!0),w(""),!0):(w("URL does not point to an image"),!1)}catch(X){return clearTimeout(J),X.name==="AbortError"?(w("Request timeout - URL took too long to respond"),!1):new Promise(oe=>{const ie=new Image,ge=setTimeout(()=>{w("Request timeout - URL took too long to respond"),oe(!1)},1e4);ie.onload=()=>{clearTimeout(ge),q(Z)&&j(!0),w(""),oe(!0)},ie.onerror=()=>{clearTimeout(ge),w("Cannot access image - CORS policy, network error, or invalid URL"),oe(!1)},ie.src=Z})}}catch{return w("Unexpected error occurred while validating URL"),!1}finally{O(!1)}},$=async()=>{b.trim()&&await te(b.trim())&&(B({url:b.trim()}),o&&cd(o))},W=Z=>{Z.key==="Enter"&&$()},_e=Z=>{T(Z.target.value),x&&w(""),R&&j(!1)},Y=Z=>{const se=["image/png","image/jpeg","image/gif"],X=Array.isArray(Z)?Z:Array.from(Z),oe=X.filter(ge=>se.includes(ge.type)&&ge.size<=5242880);if(oe.length!==X.length&&alert(s("inputs.common.invalidFiles")),oe.length===0)return;const ie=oe.map(ge=>new Promise(be=>{const Ge=new FileReader;Ge.onload=Qe=>be(Qe.target?.result),Ge.readAsDataURL(ge)}));Promise.all(ie).then(ge=>{const be={images:ge,id:o||"",styles:a};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:be})),F.setImageUploading(!0,o||"")})},re=Z=>{Z.preventDefault(),f(!0)},Q=()=>{f(!1)},le=Z=>{Z.preventDefault(),f(!1);const se=Z.dataTransfer.files;Y(se)},ce=()=>{p({url:"",repeat:"no-repeat",position:"center center",size:"cover"}),_(null),r(null),T(""),j(!1)};return(0,y.useEffect)(()=>{const Z=window.__emailBuilderEnableAI;Z!==void 0&&S(!!Z);const se=J=>{const{detail:X}=J;S(!!X)};return window.addEventListener("email-builder-ai-generation",se),()=>{window.removeEventListener("email-builder-ai-generation",se)}},[]),(0,y.useEffect)(()=>{const Z=oe=>{const{detail:ie}=oe;F.setImageUploading(!1,ie.id||""),B({url:ie.url},ie.styles),o&&cd(o),F.setDisableEdition(!1),T(ie.url)},se=oe=>{F.setImageUploading(oe?.detail?.uploading??!1,oe?.detail?.id??"")},J=()=>{P?.current?.click()},X=oe=>{const ie=oe.detail;if(typeof ie=="string"){if(!ie.includes("url("))B({url:ie}),T(ie);else{const ge=u(ie);p(ge),_(ie),r(ie),T(ge.url)}return}ie?.url!=null&&typeof ie.url=="string"&&(B({url:ie.url},ie.styles),T(ie.url))};return window.addEventListener("email-builder-set-image",X),window.addEventListener("email-builder-upload-image-receive",Z),window.addEventListener("email-builder-upload-file",J),window.addEventListener("email-builder-toggle-upload-file",se),()=>{window.removeEventListener("email-builder-upload-image-receive",Z),window.removeEventListener("email-builder-set-image",X),window.removeEventListener("email-builder-upload-file",J),window.removeEventListener("email-builder-toggle-upload-file",se)}},[h]),(0,y.useEffect)(()=>{t&&j(q(h.url))},[t,h.url]),(0,y.useEffect)(()=>{if(t!==c){const Z=u(t);p(Z),_(t||null),T(Z.url||"")}},[t]),(0,n.jsxs)(Er,{children:[(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,n.jsx)(_1,{label:s("inputs.backgroundImage.label")}),!N&&(0,n.jsx)(A.Tooltip,{title:s("inputs.backgroundImage.warningTooltip"),placement:"top",children:(0,n.jsx)(A.IconButton,{size:"small",color:"warning",disableRipple:!0,sx:{p:0,cursor:"help",lineHeight:0,"&:hover":{backgroundColor:"transparent"}},children:(0,n.jsx)(Y4r,{"aria-hidden":!0})})})]}),(0,n.jsx)(K4r,{imageUrl:h.url||null,blockId:o,onRemove:ce}),(0,n.jsx)(U4r,{tabs:[{key:"gallery",label:s("inputs.tabs.gallery"),visible:k,render:()=>(0,n.jsx)(G4r,{blockId:o,source:"background"})},{key:"yourGallery",label:s("inputs.tabs.yourGallery"),visible:!!H,render:()=>(0,n.jsx)(A.Box,{sx:{mb:2},children:H})},{key:"upload",label:s("inputs.tabs.upload"),visible:V,render:()=>(0,n.jsxs)(A.Stack,{spacing:1,children:[(0,n.jsx)(A.Box,{children:E&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_1,{label:s("inputs.image.urlLabel")}),(0,n.jsxs)(A.Stack,{direction:"row",spacing:1,children:[(0,n.jsx)(A.TextField,{fullWidth:!0,placeholder:s("inputs.image.urlPlaceholder"),value:b,onChange:_e,onKeyPress:W,disabled:M,sx:$o}),(0,n.jsx)(A.Button,{variant:"contained",onClick:$,disabled:!b.trim()||M,sx:{minWidth:"auto",px:2,position:"relative"},children:M?(0,n.jsx)(A.CircularProgress,{size:20,color:"inherit"}):s("inputs.common.add")})]}),x&&(0,n.jsx)(A.Alert,{severity:"error",sx:{mt:1,fontSize:"0.875rem",maxHeight:"70px"},children:x}),R&&(0,n.jsx)(A.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:(0,n.jsx)(A.IconButton,{"aria-label":s("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{j(!1)},children:(0,n.jsx)(ee.Close,{fontSize:"inherit"})}),children:s("inputs.common.svgWarning")})]})}),E&&z&&(0,n.jsxs)(A.Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,n.jsx)(A.Divider,{sx:{flexGrow:1}}),(0,n.jsx)(A.Typography,{variant:"caption",sx:{color:"text.secondary"},children:s("inputs.backgroundImage.or")}),(0,n.jsx)(A.Divider,{sx:{flexGrow:1}})]}),z&&(0,n.jsxs)(A.Box,{onDragOver:re,onDragLeave:Q,onDrop:le,sx:{width:"100%",border:"2px dashed",borderColor:m?"primary.main":"divider",borderRadius:"8px",padding:"24px 8px 36px 8px",textAlign:"center",bgcolor:m?"primary.50":"background.paper",transition:"all 0.2s ease"},children:[(0,n.jsx)(A.Box,{sx:{display:"flex",justifyContent:"center"},children:(0,n.jsx)(ee.PhotoOutlined,{sx:{fontSize:32,color:"primary"}})}),(0,n.jsxs)("label",{style:{cursor:"pointer"},children:[(0,n.jsx)("input",{ref:P,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:Z=>{const se=Z.target.files;se&&se.length>0&&Y(Array.from(se))}}),(0,n.jsx)(A.Typography,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:s("inputs.common.uploadFile")}),(0,n.jsxs)(A.Typography,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",s("inputs.common.dragAndDrop")]})]}),(0,n.jsx)(A.Typography,{variant:"body2",sx:{color:"text.secondary",mt:1},children:s("inputs.common.fileInfo")})]})]})},{key:"generate",label:s("inputs.tabs.generate"),visible:v,render:()=>(0,n.jsx)(q4r,{src:h.url,style:{width:"100%",margin:0}})}],defaultTab:"upload"}),h.url&&(0,n.jsxs)(A.Box,{sx:{mt:2},children:[(0,n.jsxs)(A.Box,{sx:{mb:2},children:[(0,n.jsx)(_1,{label:s("inputs.backgroundImage.fillType")}),(0,n.jsxs)(A.ToggleButtonGroup,{value:h.size,exclusive:!0,onChange:(Z,se)=>{se!=null&&typeof se=="string"&&B({size:se})},size:"small",fullWidth:!0,children:[(0,n.jsx)(A.ToggleButton,{value:"cover",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.Crop,{fontSize:"small"}),(0,n.jsx)("span",{children:s("inputs.backgroundImage.fillOptions.cover")})]})}),(0,n.jsx)(A.ToggleButton,{value:"contain",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.FitScreen,{fontSize:"small"}),(0,n.jsx)("span",{children:s("inputs.backgroundImage.fillOptions.contain")})]})}),(0,n.jsx)(A.ToggleButton,{value:"auto",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.AspectRatio,{fontSize:"small"}),(0,n.jsx)("span",{children:s("inputs.backgroundImage.fillOptions.auto")})]})})]})]}),(0,n.jsxs)(A.Stack,{direction:"row",spacing:2,sx:{mb:2},children:[(0,n.jsxs)("div",{style:{flex:1},children:[(0,n.jsx)(_1,{label:s("inputs.backgroundImage.repeat")}),(0,n.jsxs)(Oa,{style:{width:"100%"},value:h.repeat,size:"small",onChange:Z=>B({repeat:Z.target.value}),children:[(0,n.jsx)(A.MenuItem,{value:"no-repeat",children:s("inputs.backgroundImage.repeatOptions.none")}),(0,n.jsx)(A.MenuItem,{value:"repeat",children:s("inputs.backgroundImage.repeatOptions.repeat")}),(0,n.jsx)(A.MenuItem,{value:"repeat-x",children:s("inputs.backgroundImage.repeatOptions.repeatX")}),(0,n.jsx)(A.MenuItem,{value:"repeat-y",children:s("inputs.backgroundImage.repeatOptions.repeatY")})]})]}),(0,n.jsxs)("div",{style:{flex:1},children:[(0,n.jsx)(_1,{label:s("inputs.backgroundImage.position")}),(0,n.jsx)(Oa,{style:{width:"100%"},value:h.position,size:"small",onChange:Z=>B({position:Z.target.value}),renderValue:Z=>{const se=String(Z??"");return(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[d9(se),s(`inputs.backgroundImage.positions.${c9(se)}`)]})},children:["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"].map(Z=>(0,n.jsx)(A.MenuItem,{sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important "},value:Z,children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[d9(Z),s(`inputs.backgroundImage.positions.${c9(Z)}`)]})},Z))})]})]})]}),!H&&R&&(0,n.jsx)(A.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},children:s("inputs.common.svgWarning")})]})};function lA({label:t,labelAction:r,defaultValue:a,onChange:o,nullable:s,compact:u=!1,inheritedFrom:d}){const[c,_]=(0,y.useState)(null),[h,p]=(0,y.useState)(a),{t:m}=Ze("inspector");(0,y.useEffect)(()=>{h!==a&&p(a)},[a]);const f=M=>{_(M.currentTarget)},v=u?{border:"1px solid",borderColor:"cadet.400",width:28,height:28,borderRadius:"6px",bgcolor:"#FFFFFF"}:{border:t?"1px solid":"",borderColor:"cadet.400",width:"100%",height:36,paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",borderRadius:"6px",bgcolor:"#FFFFFF"},S=M=>{p(M),o(M)},g=()=>!s||typeof h!="string"||h.trim().length===0?null:(0,n.jsx)(A.Tooltip,{title:m("inputs.background.reset"),placement:"left",children:(0,n.jsx)(A.Box,{sx:{minWidth:24,lineHeight:1,flexShrink:0,pr:"4px",display:"grid",placeItems:"center"},onClick:()=>S(null),children:(0,n.jsx)(ee.FormatColorReset,{sx:{color:"primary.main"}})})}),b=h?(0,n.jsx)(A.ButtonBase,{onClick:f,sx:{...v,bgcolor:h}}):(0,n.jsx)(A.ButtonBase,{onClick:f,sx:{...v},children:(0,n.jsx)(ee.AddOutlined,{fontSize:"small"})}),T=(0,n.jsx)(A.Menu,{anchorEl:c,open:!!c,onClose:()=>_(null),sx:{"& .MuiPaper-root":{boxShadow:"0 4px 6px rgba(0, 0, 0, 0.4);",borderRadius:1,maxWidth:"200px",transform:"translateX(-100%) !important;"}},slotProps:{list:{sx:{height:"auto",padding:0}}},children:(0,n.jsx)(Bw,{value:h||"",nullable:s,onChange:M=>S(M)})});return u?(0,n.jsxs)(A.Box,{sx:{display:"inline-flex",opacity:d?.55:1,transition:"opacity 120ms ease-out"},children:[b,T]}):(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:t,action:r}),(0,n.jsxs)(A.Stack,{direction:"row",spacing:1,sx:{alignContent:"center",opacity:d?.55:1,transition:"opacity 120ms ease-out"},children:[b,g()]}),T]})}function Au(t){return(0,n.jsx)(lA,{...t,nullable:!1})}function dm(t){return(0,n.jsx)(lA,{...t,nullable:!0})}yn();var xld=G(A.Box)(({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}`}})),Old=G("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"}})),lJ=G(A.IconButton)(({theme:t})=>({padding:"0",color:t.palette.primary.main,"&:hover":{backgroundColor:ut(t.palette.primary.main,.04)},"& .MuiSvgIcon-root":{fontSize:14}}));function _r({iconLabel:t,label:r,value:a,setValue:o,units:s,min:u=0,max:d,step:c=void 0,marks:_=!0,...h}){const p=a??u,[m,f]=(0,y.useState)(p.toString()),v=x=>{let w=x;w<u&&(w=u),d!==void 0&&w>d&&(w=d),o(w),f(w.toString())},S=x=>{const w=x.target.value;if(f(w),w!==""){const R=Number(w);isNaN(R)||R>=u&&o(R)}},g=()=>{if(m===""||isNaN(Number(m)))f(p.toString());else{const x=Number(m);v(x)}},b=x=>{x.key==="Enter"&&g()};(0,y.useEffect)(()=>{f((a??u).toString())},[a,u]);const T=()=>{const x=p+1;v(x)},M=()=>{const x=p-1;v(x)},O=(x,w)=>{typeof w=="number"&&o(w)};return(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:r}),(0,n.jsxs)(A.Stack,{direction:"row",spacing:2,sx:{alignItems:"center",justifyContent:"space-between",width:"100%",gap:"1rem"},children:[(0,n.jsx)(A.Box,{sx:{minWidth:24,lineHeight:1,flexShrink:0},children:t}),(0,n.jsx)(A.Slider,{...h,value:p,min:u,max:d||1e3,step:c,color:"primary",marks:_,onChange:O}),(0,n.jsxs)(xld,{children:[(0,n.jsx)(Old,{type:"number",value:m,onChange:S,onBlur:g,onKeyDown:b,min:u,max:d,step:c}),(0,n.jsxs)(A.Box,{sx:{display:"flex",flexDirection:"column",ml:.5},children:[(0,n.jsx)(lJ,{onClick:T,disabled:d!==void 0&&p>=d,children:(0,n.jsx)("svg",{width:"15",height:"10",viewBox:"0 0 24 12",children:(0,n.jsx)("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})}),(0,n.jsx)(lJ,{onClick:M,disabled:p<=u,children:(0,n.jsx)("svg",{width:"15",height:"10",viewBox:"0 0 24 12",style:{transform:"rotate(180deg)"},children:(0,n.jsx)("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})})]})]}),(0,n.jsx)(A.Typography,{variant:"caption",color:"text.secondary",sx:{fontSize:"16px",ml:"4px!important"},children:s})]})]})}function Z5({label:t,defaultValue:r,onChange:a,...o}){const[s,u]=(0,y.useState)(r??0);return r!=s&&u(r),(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:t}),(0,n.jsx)(_r,{value:s??0,setValue:d=>{u(d),a(d)},...o})]})}var Vy=({mobile:t=!1,label:r,borderColor:a,borderTop:o,borderBottom:s,borderLeft:u,borderRight:d,onChange:c,sidesLinked:_,onSidesLinkedChange:h})=>{const{t:p}=Ze("inspector"),m=()=>t?{top:"borderTopMobile",bottom:"borderBottomMobile",left:"borderLeftMobile",right:"borderRightMobile"}:{top:"borderTop",bottom:"borderBottom",left:"borderLeft",right:"borderRight"},f=H=>{const L=Object.values(H);return L.every(E=>E===L[0])},v=m(),S={[v.top]:o??0,[v.bottom]:s??0,[v.left]:u??0,[v.right]:d??0},[g,b]=(0,y.useState)(a??"#000000"),[T,M]=(0,y.useState)(S),O={[v.top]:Number(T[v.top]),[v.bottom]:Number(T[v.bottom]),[v.left]:Number(T[v.left]),[v.right]:Number(T[v.right])},x=_!==void 0?_:f(O);(0,y.useEffect)(()=>{a!==g&&b(a??"#000000");const H={[v.top]:o??0,[v.bottom]:s??0,[v.left]:u??0,[v.right]:d??0};Object.keys(H).some(L=>T[L]!==H[L])&&M(H)},[a,o,s,u,d,t]);const w=()=>{if(x)h(!1);else{const H=T[v.top]??0;j(H),h(!0)}},R=H=>{b(H),c({borderColor:H,...T})},j=H=>{const L={[v.top]:H,[v.bottom]:H,[v.left]:H,[v.right]:H};M(L),c({...L,borderColor:g})},P=(H,L)=>{M(E=>({...E,[L]:H})),c({...T,borderColor:g,[L]:H})};return(0,n.jsxs)("div",{children:[(0,n.jsxs)(A.Stack,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center",width:"100%"},children:[(0,n.jsx)(_1,{label:r}),(0,n.jsxs)(A.Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,n.jsx)(Au,{defaultValue:g,onChange:R,compact:!0}),(0,n.jsx)(A.Tooltip,{title:p(x?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:(0,n.jsx)(A.IconButton,{size:"small",onClick:w,sx:{color:x?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:x?(0,n.jsx)(ee.Lock,{fontSize:"small"}):(0,n.jsx)(ee.LockOpen,{fontSize:"small"})})})]})]}),x&&(0,n.jsx)(Z5,{label:"",iconLabel:(0,n.jsx)(ee.BorderOuterOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:T[v.top],onChange:j}),!x&&(0,n.jsxs)(A.Stack,{spacing:2,children:[(0,n.jsx)(Z5,{label:"",iconLabel:(0,n.jsx)(ee.BorderTopOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:T[v.top],onChange:H=>P(H,v.top)}),(0,n.jsx)(Z5,{label:"",iconLabel:(0,n.jsx)(ee.BorderBottomOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:T[v.bottom],onChange:H=>P(H,v.bottom)}),(0,n.jsx)(Z5,{label:"",iconLabel:(0,n.jsx)(ee.BorderLeftOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:T[v.left],onChange:H=>P(H,v.left)}),(0,n.jsx)(Z5,{label:"",iconLabel:(0,n.jsx)(ee.BorderRightOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:T[v.right],onChange:H=>P(H,v.right)})]})]})};function Ft({icon:t,label:r,children:a,modified:o=!1}){const s=mo(),[u,d]=(0,y.useState)(!1),c=(0,y.useRef)(null);return s?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A.Tooltip,{title:r,placement:"left",children:(0,n.jsxs)(A.Box,{sx:{position:"relative",display:"inline-flex",alignSelf:"center"},children:[(0,n.jsx)(A.IconButton,{ref:c,onClick:()=>d(!u),color:u?"primary":"default",size:"small",sx:{borderRadius:1.5,width:32,height:32},children:(0,n.jsx)(t,{fontSize:"small"})}),o&&(0,n.jsx)(A.Box,{component:"span","aria-hidden":!0,sx:_=>({position:"absolute",top:2,right:2,width:5,height:5,borderRadius:"50%",bgcolor:(0,A.alpha)(_.palette.primary.main,.55),pointerEvents:"none"})})]})}),(0,n.jsx)(A.Popover,{open:u,anchorEl:c.current,onClose:()=>d(!1),anchorOrigin:{vertical:"center",horizontal:"left"},transformOrigin:{vertical:"center",horizontal:"right"},slotProps:{paper:{sx:_=>({width:360,p:2,borderRadius:2,backgroundColor:_.palette.background.paper,border:`1px solid ${_.palette.divider}`,boxShadow:"0 8px 32px rgba(0,0,0,0.12)",transform:"translateX(-18px) !important",overflow:"visible","&::after":{content:'""',position:"absolute",right:-5,top:"50%",transform:"translateY(-50%)",width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderLeft:`5px solid ${_.palette.divider}`},"&::before":{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 ${_.palette.background.paper}`,zIndex:1}})}},children:a})]}):o?(0,n.jsxs)(A.Box,{sx:{position:"relative"},children:[a,(0,n.jsx)(A.Box,{component:"span","aria-hidden":!0,sx:_=>({position:"absolute",top:4,left:-10,width:5,height:5,borderRadius:"50%",bgcolor:(0,A.alpha)(_.palette.primary.main,.55),pointerEvents:"none"})})]}):(0,n.jsx)(n.Fragment,{children:a})}var wld=Ae.FONT_FAMILIES.map(t=>(0,n.jsx)(A.MenuItem,{value:t.key,sx:{fontFamily:t.value},children:t.label},t.key));function sA({label:t,labelAction:r,onChange:a,defaultValue:o}){const s="INHERIT",[u,d]=(0,y.useState)(o??s);(0,y.useEffect)(()=>{u!==o&&d(o??s)},[o]);const c=h=>{const p=h.target.value;d(p),a(p===null?null:p)},_=Ae.FONT_FAMILIES.find(h=>h.key===u)?.value;return(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:t,action:r}),(0,n.jsx)(Oa,{style:{width:"100%",fontFamily:_},value:u,size:"small",onChange:c,children:wld})]})}function _9({label:t,labelAction:r,defaultValue:a=16,onChange:o,maxValue:s,minValue:u,step:d,inheritedFrom:c}){const[_,h]=(0,y.useState)(a);(0,y.useEffect)(()=>{_!==a&&h(a)},[a]);const p=m=>{h(m),o(m)};return(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:t,action:r}),(0,n.jsx)(A.Box,{sx:{opacity:c?.55:1,transition:"opacity 120ms ease-out"},children:(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.TextFieldsOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:_,setValue:p,units:"px",step:d??2,min:u||8,max:s||48})})]})}function bc({label:t,labelAction:r,children:a,defaultValue:o,onChange:s}){const[u,d]=(0,y.useState)(o);return(0,y.useEffect)(()=>{o!==u&&d(o)},[o]),(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:t,action:r}),(0,n.jsx)(A.Box,{sx:{...kT,paddingLeft:"0px",paddingRight:"0px"},children:(0,n.jsx)(A.ToggleButtonGroup,{exclusive:!0,fullWidth:!0,value:u,size:"small",sx:{width:"100%"},onChange:(c,_)=>{if(typeof _!="string")throw new Error("RadioGroupInput can only receive string values");d(_),s(_)},children:a})})]})}function Q4r({label:t,labelAction:r,defaultValue:a,onChange:o}){const{t:s}=Ze("inspector"),[u,d]=(0,y.useState)(a);return(0,y.useEffect)(()=>{u!==a&&d(a)},[a]),(0,n.jsxs)(bc,{label:t,labelAction:r,defaultValue:u,onChange:c=>{d(c),o(c)},children:[(0,n.jsx)(A.ToggleButton,{value:"normal",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.TextFields,{fontSize:"small"}),(0,n.jsx)("span",{children:s("inputs.fontWeightToggle.regular")})]})}),(0,n.jsx)(A.ToggleButton,{value:"bold",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.FormatBold,{fontSize:"small"}),(0,n.jsx)("span",{children:s("inputs.fontWeightToggle.bold")})]})})]})}var ky=({label:t,defaultValue:r,onChange:a,min:o=1,max:s=100,step:u=1})=>{const{t:d}=Ze("inspector");return(0,n.jsx)(_r,{label:t??d("inputs.common.height"),iconLabel:(0,n.jsx)(ee.HeightOutlined,{sx:{color:"text.secondary"}}),units:"px",step:u,min:o,max:s,marks:!1,value:r??o,setValue:a})},Ald=[{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)"}].map(t=>(0,n.jsx)(A.MenuItem,{value:t.key,children:t.label},t.key));function Rld({label:t,onChange:r,defaultValue:a}){const o="INHERIT",[s,u]=(0,y.useState)(a?.toString()??o);(0,y.useEffect)(()=>{s!==a?.toString()&&u(a?.toString()??o)},[a]);const d=c=>{const _=c.target.value;u(_),r(_===o?null:parseFloat(_))};return(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:t}),(0,n.jsxs)(Oa,{style:{width:"100%"},value:s,size:"small",onChange:d,children:[(0,n.jsx)(A.MenuItem,{value:o,children:"Default value"}),Ald]})]})}function zld(t){return(0,n.jsxs)(A.SvgIcon,{...t,viewBox:"0 0 16 16",children:[(0,n.jsx)("path",{fill:"currentColor",d:"M0 0v16h16V0zm15 3h-1v1h1v11H1V3h1V2H1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1z"}),(0,n.jsx)("path",{fill:"currentColor",d:"M3 2h1v1H3zM2 3h1v1H2zm2 0h1v1H4zm2 0h1v1H6zM5 2h1v1H5zm2 0h1v1H7zm2 0h1v1H9zM8 3h1v1H8zm2 0h1v1h-1zm2 0h1v1h-1zm-1-1h1v1h-1zm2 0h1v1h-1z"})]})}function jld(t){return(0,n.jsxs)(A.SvgIcon,{...t,viewBox:"0 0 16 16",children:[(0,n.jsx)("path",{fill:"currentColor",d:"M16 16V0H0v16zM1 13h1v-1H1V1h14v12h-1v1h1v1h-1v-1h-1v1h-1v-1h-1v1h-1v-1H9v1H8v-1H7v1H6v-1H5v1H4v-1H3v1H2v-1H1z"}),(0,n.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 Pld(t){return(0,n.jsxs)(A.SvgIcon,{...t,viewBox:"0 0 16 16",children:[(0,n.jsx)("path",{fill:"currentColor",d:"M0 16h16V0H0zM3 1v1h1V1h11v14H3v-1H2v1H1v-1h1v-1H1v-1h1v-1H1v-1h1V9H1V8h1V7H1V6h1V5H1V4h1V3H1V2h1V1z"}),(0,n.jsx)("path",{fill:"currentColor",d:"M2 12h1v1H2zm1 1h1v1H3zm0-2h1v1H3zm0-2h1v1H3zm-1 1h1v1H2zm0-2h1v1H2zm0-2h1v1H2zm1 1h1v1H3zm0-2h1v1H3zm0-2h1v1H3zM2 4h1v1H2zm0-2h1v1H2z"})]})}function Hld(t){return(0,n.jsxs)(A.SvgIcon,{...t,viewBox:"0 0 16 16",children:[(0,n.jsx)("path",{fill:"currentColor",d:"M16 0H0v16h16zm-3 15v-1h-1v1H1V1h12v1h1V1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1z"}),(0,n.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"})]})}var h9=(t=>(0,n.jsxs)(A.SvgIcon,{...t,viewBox:"0 0 16 16",children:[(0,n.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"}),(0,n.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"})]}));h9.muiName="PaddingIcon";function Dy({label:t,labelAction:r,defaultValue:a,onChange:o,sidesLinked:s,onSidesLinkedChange:u,inheritedFrom:d}){const{t:_}=Ze("inspector"),[h,p]=(0,y.useState)(()=>a||{top:0,left:0,bottom:0,right:0});(0,y.useEffect)(()=>{a&&(a.top!==h.top||a.left!==h.left||a.bottom!==h.bottom||a.right!==h.right)&&p(a)},[a]);const m=h.top===h.bottom&&h.top===h.left&&h.top===h.right,f=s===!0&&m;function v(g,b){let T;f?T={top:b,bottom:b,left:b,right:b}:T={...h,[g]:b},p(T),o(T)}const S=()=>{const g=!f;if(!f){const b={top:h.top,bottom:h.top,left:h.top,right:h.top};p(b),o(b)}u(g)};return(0,n.jsxs)(Er,{children:[(0,n.jsxs)(A.Stack,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center",width:"100%"},children:[(0,n.jsx)(_1,{label:t,action:r}),(0,n.jsx)(A.Tooltip,{title:_(f?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:(0,n.jsx)(A.IconButton,{size:"small",onClick:S,sx:{marginTop:"0!important",color:f?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:f?(0,n.jsx)(ee.Lock,{fontSize:"small"}):(0,n.jsx)(ee.LockOpen,{fontSize:"small"})})})]}),(0,n.jsx)(A.Stack,{spacing:1,sx:{opacity:d?.55:1,transition:"opacity 120ms ease-out"},children:f?(0,n.jsx)(_r,{iconLabel:(0,n.jsx)("span",{children:_("inputs.responsiveSize.allSides")}),value:h.top,setValue:g=>v("top",g),units:"px",step:16,min:0,max:120,marks:!0}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(zld,{sx:{fontSize:16,color:"text.primary"}}),value:h.top,setValue:g=>v("top",g),units:"px",step:16,min:0,max:120,marks:!0}),(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(jld,{sx:{fontSize:16,color:"text.primary"}}),value:h.bottom,setValue:g=>v("bottom",g),units:"px",step:16,min:0,max:120,marks:!0}),(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(Pld,{sx:{fontSize:16,color:"text.primary"}}),value:h.left,setValue:g=>v("left",g),units:"px",step:16,min:0,max:120,marks:!0}),(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(Hld,{sx:{fontSize:16,color:"text.primary"}}),value:h.right,setValue:g=>v("right",g),units:"px",step:16,min:0,max:120,marks:!0})]})})]})}var Lld=({label:t,defaultValue:r,onChange:a,maxValue:o=600,shapeSteps:s=8,cornersLinked:u,onCornersLinkedChange:d})=>{const{t:c}=Ze("inspector"),[_,h]=(0,y.useState)(()=>typeof r=="object"&&r!==null?"rounded":r||"rectangle"),[p,m]=(0,y.useState)(()=>typeof r=="object"&&r!==null?r:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0}),f=u===!0;(0,y.useEffect)(()=>{typeof r=="object"&&r!==null?(m(r),h("rounded")):(r==="rectangle"||r==="pill")&&h(r)},[r]);const v=T=>{const M=T;h(M),a(M==="rounded"?p:M)},S=(T,M)=>{let O;f?O={topLeft:M,topRight:M,bottomLeft:M,bottomRight:M}:O={...p,[T]:M},m(O),a(O)},g=()=>{const T=!f;if(!f){const M={topLeft:p.topLeft,topRight:p.topLeft,bottomLeft:p.topLeft,bottomRight:p.topLeft};m(M),a(M)}d(T)},b=typeof o=="number"?o:Number(o)||600;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(bc,{label:t||c("shape.label"),defaultValue:_,onChange:v,children:[(0,n.jsx)(A.ToggleButton,{value:"rectangle",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.CropSquare,{fontSize:"small"}),(0,n.jsx)("span",{children:c("shape.square")})]})}),(0,n.jsx)(A.ToggleButton,{value:"pill",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.PanoramaFishEye,{fontSize:"small"}),(0,n.jsx)("span",{children:c("shape.pill")})]})}),(0,n.jsx)(A.ToggleButton,{value:"rounded",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.RoundedCorner,{fontSize:"small"}),(0,n.jsx)("span",{children:c("shape.custom")})]})})]}),_==="rounded"&&(0,n.jsxs)(A.Stack,{spacing:2,sx:{alignItems:"flex-start",pb:1},children:[(0,n.jsxs)(A.Stack,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center",width:"100%"},children:[(0,n.jsx)(_1,{label:c("shape.borderRadius")}),(0,n.jsx)(A.Tooltip,{title:c(f?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:(0,n.jsx)(A.IconButton,{size:"small",onClick:g,sx:{marginTop:"0!important",color:f?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:f?(0,n.jsx)(ee.Lock,{fontSize:"small"}):(0,n.jsx)(ee.LockOpen,{fontSize:"small"})})})]}),f?(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.RoundedCorner,{sx:{fontSize:16}}),value:Number(p.topRight),setValue:T=>S("topLeft",T),units:"px",min:0,step:s,marks:s>1,max:b})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.RoundedCorner,{sx:{fontSize:16,transform:"rotate(0deg)"}}),value:Number(p.topLeft),setValue:T=>S("topLeft",T),units:"px",min:0,step:s,marks:s>1,max:b}),(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.RoundedCorner,{sx:{fontSize:16,transform:"rotate(270deg)"}}),value:Number(p.topRight),setValue:T=>S("topRight",T),units:"px",min:0,step:s,marks:s>1,max:b}),(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.RoundedCorner,{sx:{fontSize:16,transform:"rotate(180deg)"}}),value:Number(p.bottomLeft),setValue:T=>S("bottomLeft",T),units:"px",min:0,step:s,marks:s>1,max:b}),(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.RoundedCorner,{sx:{fontSize:16,transform:"rotate(90deg)"}}),value:Number(p.bottomRight),setValue:T=>S("bottomRight",T),units:"px",min:0,step:s,marks:s>1,max:b})]})]})]})};function Ny({label:t,labelAction:r,defaultValue:a,onChange:o}){const[s,u]=(0,y.useState)(a??"left");return(0,y.useEffect)(()=>{a!==s&&u(a??"left")},[a]),(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:t,action:r}),(0,n.jsxs)(bc,{label:"",defaultValue:s,onChange:d=>{u(d),o(d)},children:[(0,n.jsx)(A.ToggleButton,{value:"left",children:(0,n.jsx)(ee.FormatAlignLeftOutlined,{fontSize:"small"})}),(0,n.jsx)(A.ToggleButton,{value:"center",children:(0,n.jsx)(ee.FormatAlignCenterOutlined,{fontSize:"small"})}),(0,n.jsx)(A.ToggleButton,{value:"right",children:(0,n.jsx)(ee.FormatAlignRightOutlined,{fontSize:"small"})})]})]})}var sJ=({label:t,defaultValue:r,onChange:a,step:o,...s})=>{const{t:u}=Ze("inspector");return(0,n.jsx)(_r,{label:t??u("inputs.common.width"),iconLabel:(0,n.jsx)(ee.HeightOutlined,{sx:{color:"text.primary",transform:"rotate(90deg)"}}),units:"%",step:o,min:1,max:100,marks:!1,value:r??1,setValue:a,...s})},i6=(t=>(0,n.jsx)(A.SvgIcon,{...t,viewBox:"0 0 24 24",children:(0,n.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"})}));i6.muiName="FontFamilyIcon";var B3=(t=>(0,n.jsx)(A.SvgIcon,{...t,viewBox:"0 0 24 24",children:(0,n.jsxs)("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",children:[(0,n.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"}),(0,n.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"})]})}));B3.muiName="BackgroundColorIcon";var l6=(t=>(0,n.jsx)(A.SvgIcon,{...t,viewBox:"0 0 24 24",children:(0,n.jsxs)("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",children:[(0,n.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"}),(0,n.jsx)("rect",{width:"15.5",height:"4.353",x:"4.25",y:"16.897",rx:"1.5"})]})}));l6.muiName="TextColorIcon";function Eld({name:t,value:r,onChange:a,shapeMaxValue:o,shapeSteps:s}){const u=F.useSelectedScreenSize(),d=F.useRoot(),c=F.useBlockTypeSelected(),{t:_}=Ze("inspector"),h=T=>{if(!c)return r[T]??null;const M=u==="desktop"?"desktop":"mobile",O=d?.theme,x=F.resolveBlockProp({type:c,data:{style:r}},"style",T,O,M);return x!==void 0?x:I3[c]?.style?.[T]??null},p=T=>{if(r[T]!==void 0&&r[T]!==null||!c)return;const M=d?.theme?.blocks?.[c]?.style?.[T];if(M!=null)return"theme";const O=I3[c]?.style?.[T];return O!=null?"default":void 0},m=T=>h(T),f=(T,M)=>{const O=r[T],x=r[M];return O??x},v=(T,M)=>{a(M?{...r,...M,[t]:T}:{...r,[t]:T})},S=T=>{a({...r,...T})},b=(()=>{switch(t){case"textAlignMobile":return h("textAlignMobile")??h("textAlign");case"mobilePadding":return h("mobilePadding")??h("padding");case"fontSizeMobile":return h("fontSizeMobile")??h("fontSize")??16;case"heightMobile":return h("heightMobile")??h("height");case"widthMobile":return h("widthMobile")??h("width");case"borderMobile":return{borderTop:f("borderTopMobile","borderTop"),borderBottom:f("borderBottomMobile","borderBottom"),borderLeft:f("borderLeftMobile","borderLeft"),borderRight:f("borderRightMobile","borderRight")};default:return h(t)}})();switch(t){case"backgroundColor":return(0,n.jsx)(Ft,{icon:B3,label:_("properties.backgroundColor"),children:(0,n.jsx)(dm,{label:_("properties.backgroundColor"),defaultValue:b??d?.canvasColor,onChange:v})});case"background":return(0,n.jsx)(Ft,{icon:ee.WallpaperOutlined,label:_("properties.background","Background"),children:(0,n.jsx)(Mld,{defaultValue:b,onChange:(T,M)=>v(T,M),values:r})});case"borderColor":return(0,n.jsx)(Ft,{icon:B3,label:_("properties.border"),children:(0,n.jsx)(dm,{label:_("properties.border"),defaultValue:b,onChange:v})});case"borderRadius":return(0,n.jsx)(Ft,{icon:ee.RoundedCornerOutlined,label:_("properties.borderRadius"),children:(0,n.jsx)(Z5,{iconLabel:(0,n.jsx)(ee.RoundedCornerOutlined,{}),units:"px",step:4,marks:!0,min:0,max:48,label:_("properties.borderRadius"),defaultValue:b,onChange:v})});case"color":return(0,n.jsx)(Ft,{icon:ee.PaletteOutlined,label:_("properties.color"),children:(0,n.jsx)(dm,{label:_("properties.color"),defaultValue:b,onChange:v})});case"fontFamily":return(0,n.jsx)(Ft,{icon:i6,label:_("properties.fontFamily"),children:(0,n.jsx)(sA,{label:_("properties.fontFamily"),defaultValue:b,onChange:v})});case"fontWeight":return(0,n.jsx)(Ft,{icon:ee.FormatBoldOutlined,label:_("properties.fontWeight"),children:(0,n.jsx)(Q4r,{label:_("properties.fontWeight"),defaultValue:b,onChange:v})});case"textAlign":return u==="desktop"&&(0,n.jsx)(Ft,{icon:ee.FormatAlignCenterOutlined,label:_("properties.alignment"),children:(0,n.jsx)(Ny,{label:_("properties.alignment"),defaultValue:b,onChange:v})});case"textAlignMobile":return u!="desktop"&&(0,n.jsx)(Ft,{icon:ee.FormatAlignCenterOutlined,label:_("properties.alignment"),children:(0,n.jsx)(Ny,{label:_("properties.alignment"),defaultValue:b,onChange:v})});case"padding":return u==="desktop"&&(0,n.jsx)(Ft,{icon:h9,label:_("properties.padding"),children:(0,n.jsx)(Dy,{label:_("properties.padding"),defaultValue:h("padding"),inheritedFrom:p("padding"),onChange:v,sidesLinked:r.paddingSidesLinked,onSidesLinkedChange:T=>a({...r,paddingSidesLinked:T})})});case"mobilePadding":return u!="desktop"&&(0,n.jsx)(Ft,{icon:h9,label:_("properties.padding"),children:(0,n.jsx)(Dy,{label:_("properties.padding"),defaultValue:h("mobilePadding")??h("padding"),inheritedFrom:r.mobilePadding!=null?void 0:"default",onChange:v,sidesLinked:r.mobilePaddingSidesLinked,onSidesLinkedChange:T=>a({...r,mobilePaddingSidesLinked:T})})});case"fontSize":return u==="desktop"&&(0,n.jsx)(Ft,{icon:ee.FormatSizeOutlined,label:_("properties.fontSize"),children:(0,n.jsx)(_9,{maxValue:80,step:8,label:_("properties.fontSize"),defaultValue:b??16,onChange:v})});case"fontSizeMobile":return u!="desktop"&&(0,n.jsx)(Ft,{icon:ee.FormatSizeOutlined,label:_("properties.fontSize"),children:(0,n.jsx)(_9,{maxValue:80,step:8,label:_("properties.fontSize"),defaultValue:b,onChange:v})});case"lineHeight":return(0,n.jsx)(Ft,{icon:ee.FormatLineSpacingOutlined,label:_("properties.lineHeight"),children:(0,n.jsx)(Rld,{label:_("properties.lineHeight"),defaultValue:b??1.5,onChange:v})});case"shape":return(0,n.jsx)(Ft,{icon:ee.RoundedCornerOutlined,label:_("properties.shape"),children:(0,n.jsx)(Lld,{shapeSteps:s,maxValue:o,label:_("properties.shape"),defaultValue:b,onChange:v,cornersLinked:r.shapeCornersLinked,onCornersLinkedChange:T=>a({...r,shapeCornersLinked:T})})});case"height":return u==="desktop"&&(0,n.jsx)(Ft,{icon:ee.HeightOutlined,label:_("properties.height"),children:(0,n.jsx)(ky,{label:_("properties.height"),defaultValue:b,onChange:v})});case"heightMobile":return u!="desktop"&&(0,n.jsx)(Ft,{icon:ee.HeightOutlined,label:_("properties.height"),children:(0,n.jsx)(ky,{label:_("properties.height"),defaultValue:b,onChange:v})});case"width":return u==="desktop"&&(0,n.jsx)(Ft,{icon:ee.WidthFullOutlined,label:_("properties.width"),children:(0,n.jsx)(sJ,{label:_("properties.width"),defaultValue:h("width")??void 0,onChange:v})});case"widthMobile":return u!="desktop"&&(0,n.jsx)(Ft,{icon:ee.WidthFullOutlined,label:_("properties.width"),children:(0,n.jsx)(sJ,{label:_("properties.width"),defaultValue:h("widthMobile")??h("width")??void 0,onChange:v})});case"border":return u==="desktop"&&(0,n.jsx)(Ft,{icon:ee.BorderStyleOutlined,label:_("properties.border"),children:(0,n.jsx)(Vy,{label:_("properties.border"),borderColor:r.borderColor??null,borderTop:m("borderTop"),borderBottom:m("borderBottom"),borderLeft:m("borderLeft"),borderRight:m("borderRight"),onChange:S,sidesLinked:r.borderSidesLinked,onSidesLinkedChange:T=>a({...r,borderSidesLinked:T})})});case"borderMobile":return u!="desktop"&&(0,n.jsx)(Ft,{icon:ee.BorderStyleOutlined,label:_("properties.border"),children:(0,n.jsx)(Vy,{mobile:!0,label:_("properties.border"),borderColor:r.borderColor??null,borderTop:m("borderTopMobile")??m("borderTop"),borderBottom:m("borderBottomMobile")??m("borderBottom"),borderLeft:m("borderLeftMobile")??m("borderLeft"),borderRight:m("borderRightMobile")??m("borderRight"),onChange:S,sidesLinked:r.borderMobileSidesLinked,onSidesLinkedChange:T=>a({...r,borderMobileSidesLinked:T})})});default:return null}}Rv();var qs={section:"style",key:"padding",kind:"padding",labelKey:"theme.fields.padding"},bl={section:"style",key:"backgroundColor",kind:"color",labelKey:"theme.fields.backgroundColor"},Vld={section:"style",key:"fontWeight",kind:"fontWeight",labelKey:"theme.fields.fontWeight"},kld={section:"style",key:"textAlign",kind:"textAlign",labelKey:"theme.fields.textAlign"},Dld=["NotionText","Button","Image","Divider","Spacer","SocialMedia","Container","ColumnsContainer"],X4r={NotionText:{titleKey:"theme.blocks.notionText.title",icon:LO,fields:[bl,{section:"style",key:"fontSize",kind:"fontSize",labelKey:"theme.fields.fontSize"},qs]},Button:{titleKey:"theme.blocks.button.title",icon:GO,fields:[{section:"style",key:"buttonBackgroundColor",kind:"color",labelKey:"theme.fields.buttonBackgroundColor",icon:_f},{section:"style",key:"buttonTextColor",kind:"color",labelKey:"theme.fields.buttonTextColor",icon:l6},{section:"style",key:"fontSize",kind:"fontSize",labelKey:"theme.fields.fontSize"},Vld,kld,bl,qs]},Image:{titleKey:"theme.blocks.image.title",icon:JO,fields:[bl,qs]},Divider:{titleKey:"theme.blocks.divider.title",icon:IO,fields:[{section:"style",key:"color",kind:"color",labelKey:"theme.fields.color",icon:_f},bl,{section:"style",key:"width",kind:"number",labelKey:"theme.fields.width"},{section:"style",key:"height",kind:"number",labelKey:"theme.fields.height"},qs]},Spacer:{titleKey:"theme.blocks.spacer.title",icon:VO,fields:[bl,{section:"style",key:"height",kind:"number",labelKey:"theme.fields.height"}]},SocialMedia:{titleKey:"theme.blocks.socialMedia.title",icon:FO,fields:[bl,qs]},Container:{titleKey:"theme.blocks.container.title",icon:E_,fields:[bl,{section:"style",key:"border",kind:"border",labelKey:"theme.fields.border"},qs]},ColumnsContainer:{titleKey:"theme.blocks.columnsContainer.title",icon:KO,fields:[bl,qs]}};function Rs({title:t,children:r}){const a=mo(),o=F.useBlockTypeSelected(),s=(o?X4r[o]:null)?.icon;return(0,n.jsxs)(A.Container,{sx:{padding:"0!important",paddingTop:"1rem!important"},children:[!a&&(0,n.jsx)(A.Typography,{sx:{fontWeight:"bold",mb:2,color:"text.primary",fontSize:"1.25rem"},children:t}),a&&s&&(0,n.jsx)(A.Tooltip,{title:t,placement:"left",children:(0,n.jsx)(A.Box,{sx:{display:"flex",justifyContent:"center",pb:1.5},children:(0,n.jsx)(s,{sx:{fontSize:22,color:"text.secondary"}})})}),(0,n.jsx)(A.Stack,{spacing:a?.5:1.5,sx:{mb:3,pt:a?0:1},children:r})]})}function $_(){return mo()?(0,n.jsx)(A.Divider,{sx:{my:.5}}):null}function uJ(t){return{top:Number(t.top??0),bottom:Number(t.bottom??0),left:Number(t.left??0),right:Number(t.right??0)}}function Nld({size:t,sizeMobile:r,sizePaddingSidesLinked:a,sizeMobilePaddingSidesLinked:o,onChange:s,label:u,maxValue:d=100,paddingSteps:c=8}){const{t:_}=Ze("inspector"),h=u??_("inputs.common.size"),p=F.useSelectedScreenSize(),[m,f]=(0,y.useState)(()=>{const x=p==="desktop"?t:r!==void 0?r:t;return typeof x=="object"&&x!==null?uJ(x):{top:8,bottom:8,left:16,right:16}}),v=p==="desktop"?a===!0:o===!0;(0,y.useEffect)(()=>{const x=p==="desktop"?t:r!==void 0?r:t;typeof x=="object"&&x!==null&&f(uJ(x))},[t,r,p]);const S=()=>{const x=p==="desktop"?t:r!==void 0?r:t;return typeof x=="object"&&x!==null?"custom":typeof x=="string"?x:"medium"},g=typeof d=="number"?d:Number(d)||100,b=x=>{if(p==="desktop"){const w={size:x==="custom"?m:x};r==null&&(w.sizeMobile=x==="custom"?m:x),s(w)}else s({sizeMobile:x==="custom"?m:x})},T=(x,w)=>{let R;v?R={top:w,bottom:w,left:w,right:w}:R={...m,[x]:w},f(R),s(p==="desktop"?{size:R}:{sizeMobile:R})},M=()=>{if(p==="desktop")if(v)s({sizePaddingSidesLinked:!1});else{const x={top:m.top,bottom:m.top,left:m.top,right:m.top};f(x),s({size:x,sizePaddingSidesLinked:!0})}else if(v)s({sizeMobilePaddingSidesLinked:!1});else{const x={top:m.top,bottom:m.top,left:m.top,right:m.top};f(x),s({sizeMobile:x,sizeMobilePaddingSidesLinked:!0})}},O=S();return(0,n.jsxs)(A.Stack,{spacing:2,children:[(0,n.jsxs)(bc,{label:h,defaultValue:O,onChange:b,children:[(0,n.jsx)(A.ToggleButton,{value:"x-small",children:(0,n.jsx)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:(0,n.jsx)("span",{children:_("inputs.responsiveSize.options.xSmall")})})}),(0,n.jsx)(A.ToggleButton,{value:"small",children:(0,n.jsx)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:(0,n.jsx)("span",{children:_("inputs.responsiveSize.options.small")})})}),(0,n.jsx)(A.ToggleButton,{value:"medium",children:(0,n.jsx)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:(0,n.jsx)("span",{children:_("inputs.responsiveSize.options.medium")})})}),(0,n.jsx)(A.ToggleButton,{value:"custom",children:(0,n.jsx)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:(0,n.jsx)("span",{children:_("inputs.responsiveSize.options.custom")})})})]}),O==="custom"&&(0,n.jsxs)(A.Stack,{spacing:2,sx:{alignItems:"flex-start",pb:1},children:[(0,n.jsxs)(A.Stack,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center",width:"100%"},children:[(0,n.jsx)(_1,{label:_("inputs.responsiveSize.customPadding")}),(0,n.jsx)(A.Tooltip,{title:_(v?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:(0,n.jsx)(A.IconButton,{size:"small",onClick:M,sx:{marginTop:"0!important",color:v?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:v?(0,n.jsx)(ee.Lock,{fontSize:"small"}):(0,n.jsx)(ee.LockOpen,{fontSize:"small"})})})]}),v?(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(A.Typography,{variant:"body2",component:"span",children:_("inputs.responsiveSize.allSides")}),value:m.top,setValue:x=>T("top",x),units:"px",min:0,step:c,marks:c>1,max:g}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.AlignVerticalTopOutlined,{sx:{fontSize:16}}),value:m.top,setValue:x=>T("top",x),units:"px",min:0,step:c,marks:c>1,max:g}),(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.AlignVerticalBottomOutlined,{sx:{fontSize:16}}),value:m.bottom,setValue:x=>T("bottom",x),units:"px",min:0,step:c,marks:c>1,max:g}),(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.AlignHorizontalLeftOutlined,{sx:{fontSize:16}}),value:m.left,setValue:x=>T("left",x),units:"px",min:0,step:c,marks:c>1,max:g}),(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.AlignHorizontalRightOutlined,{sx:{fontSize:16}}),value:m.right,setValue:x=>T("right",x),units:"px",min:0,step:c,marks:c>1,max:g})]})]})]})}function Fld({fullWidth:t,fullWidthMobile:r,onChange:a,label:o="Width"}){const s=F.useSelectedScreenSize(),{t:u}=Ze("inspector"),d=()=>s==="desktop"?t:r!==void 0?r:t,c=_=>{const h=_==="FULL_WIDTH";if(s==="desktop"){const p={fullWidth:h};r==null&&(p.fullWidthMobile=h),a(p)}else a({fullWidthMobile:h})};return(0,n.jsxs)(bc,{label:o,defaultValue:d()?"FULL_WIDTH":"AUTO",onChange:c,children:[(0,n.jsx)(A.ToggleButton,{value:"FULL_WIDTH",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.WidthFull,{fontSize:"small"}),(0,n.jsx)("span",{children:u("inputs.width.full")})]})}),(0,n.jsx)(A.ToggleButton,{value:"AUTO",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.WidthNormal,{fontSize:"small"}),(0,n.jsx)("span",{children:u("inputs.width.auto")})]})})]})}function Ild(t,r){const a=(0,y.useRef)(null),o=(0,y.useRef)(t),s=(0,y.useRef)([]);o.current=t;const u=(0,y.useCallback)((...d)=>{s.current=d,a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{o.current(...d),a.current=null},r)},[r]);return u.flush=(0,y.useCallback)(()=>{a.current&&(clearTimeout(a.current),a.current=null,o.current(...s.current))},[]),u}function p9({helperText:t,label:r,placeholder:a,rows:o,InputProps:s,defaultValue:u,onChange:d}){const[c,_]=(0,y.useState)(u);(0,y.useEffect)(()=>{c!==u&&_(u)},[u]);const h=Ild(p=>{d(p)},150);return(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[(0,n.jsx)(_1,{label:r}),(0,n.jsx)(A.TextField,{fullWidth:!0,multiline:typeof o=="number"&&o>1,minRows:o,variant:"outlined",placeholder:a,helperText:t,slotProps:{input:s},value:c,sx:$o,onChange:p=>{const m=p.target.value;_(m),h(m)},onBlur:()=>{h.flush()}})]})}function $n({names:t,value:r,onChange:a,disabledCSSValidation:o=!1,shapeMaxValue:s,shapeSteps:u}){const d=F.useSelectedSidebarTab(),c=F.useBlockTypeSelected();return(mo()||o||d=="css"||F.BLOCKS_DEFAULT_CSS.includes(c||""))&&(0,n.jsx)(n.Fragment,{children:t.map(_=>(0,n.jsx)(Eld,{shapeMaxValue:s,shapeSteps:u,name:_,value:r||{},onChange:a},_))})}function Bld({data:t,setData:r}){const[,a]=(0,y.useState)(null),o=F.useRoot(),{t:s}=Ze("inspector"),u=T=>{const M=Ae.ButtonPropsSchema.safeParse(T);M.success?(r(M.data),a(null)):a(M.error)},d=t.props?.text??Ae.ButtonPropsDefaults.text,c=t.props?.url??Ae.ButtonPropsDefaults.url,_=t.props?.fullWidth??Ae.ButtonPropsDefaults.fullWidth,h=t.props?.size??Ae.ButtonPropsDefaults.size,p=o,m=t.style?.buttonTextColor??t.props?.buttonTextColor??p?.textColor,f=t.style?.buttonBackgroundColor??t.props?.buttonBackgroundColor??Ae.ButtonPropsDefaults.buttonBackgroundColor,v=t.props?.fullWidthMobile,S=t.props?.sizeMobile,g=F.useSelectedSidebarTab(),b=mo();return(0,n.jsxs)(Rs,{title:s("inputs.panels.button.title"),children:[(g=="block-configuration"||b)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)($n,{disabledCSSValidation:!0,names:["fontFamily","fontSize","fontSizeMobile","fontWeight"],value:t.style,onChange:T=>u({...t,style:T})}),(0,n.jsx)(Ft,{icon:ee.TitleOutlined,label:s("inputs.panels.button.textLabel"),children:(0,n.jsx)(p9,{label:s("inputs.panels.button.textLabel"),defaultValue:d,onChange:T=>u({...t,props:{...t.props,text:T}})})}),(0,n.jsx)(Ft,{icon:ee.LinkOutlined,label:s("inputs.panels.button.targetLabel"),children:(0,n.jsx)(p9,{label:s("inputs.panels.button.targetLabel"),placeholder:s("inputs.panels.button.targetPlaceholder"),defaultValue:c,onChange:T=>u({...t,props:{...t.props,url:T}})})}),(0,n.jsx)(Ft,{icon:ee.WidthFullOutlined,label:s("properties.width"),children:(0,n.jsx)(Fld,{label:s("properties.width"),fullWidth:_,fullWidthMobile:v,onChange:T=>u({...t,props:{...t.props,...T}})})}),(0,n.jsx)(Ft,{icon:ee.AspectRatioOutlined,label:s("properties.size","Size"),children:(0,n.jsx)(Nld,{size:h,sizeMobile:S,sizePaddingSidesLinked:t.props?.sizePaddingSidesLinked,sizeMobilePaddingSidesLinked:t.props?.sizeMobilePaddingSidesLinked,onChange:T=>u({...t,props:{...t.props,...T}})})})]}),(0,n.jsx)($_,{}),(0,n.jsx)($n,{names:["shape","textAlign","textAlignMobile","backgroundColor","border","borderMobile","padding","mobilePadding"],value:t.style,shapeMaxValue:80,onChange:T=>u({...t,style:T})}),(g==="css"||b)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Ft,{icon:l6,label:s("inputs.panels.button.textColor"),children:(0,n.jsx)(Au,{label:s("inputs.panels.button.textColor"),defaultValue:m,onChange:T=>u({...t,style:{...t.style,buttonTextColor:T}})})}),(0,n.jsx)(Ft,{icon:ee.PaletteOutlined,label:s("inputs.panels.button.buttonColor"),children:(0,n.jsx)(Au,{label:s("inputs.panels.button.buttonColor"),defaultValue:f,onChange:T=>u({...t,style:{...t.style,buttonBackgroundColor:T}})})})]})]})}var Jld=(t,r,a)=>{if(!t||!document)return;const o=Ae.shortCssId(t),s=document.querySelector(`.${o}`);if(!s)return;const u=s.parentElement;if(!u)return;const d=Math.ceil(u.getBoundingClientRect().width);a.props?.touched||a.props?.width!==d&&r({...a,props:{...a.props,width:d}})},Uld=t=>{if(!t||!document)return;const r=Ae.shortCssId(t),a=document.querySelector(`.${r}`);if(!a)return;const o=a.parentElement;if(!o)return;const s=Math.ceil(o.getBoundingClientRect().width);return s||null},Wld={desktop:"contentAlignment",mobile:"contentAlignmentMobile"};function $ld({data:t,updateData:r}){const{t:a}=Ze("inspector"),o=F.useSelectedScreenSize(),s=Wld[o]||"contentAlignment",u=t.props?.[s]??t.props?.contentAlignment,d=c=>{r({...t,props:{...t.props,[s]:c}})};return(0,n.jsxs)(bc,{label:a("inputs.alignment.label"),defaultValue:u,onChange:d,children:[(0,n.jsx)(A.ToggleButton,{value:"top",children:(0,n.jsx)(ee.VerticalAlignTopOutlined,{fontSize:"small"})}),(0,n.jsx)(A.ToggleButton,{value:"middle",children:(0,n.jsx)(ee.VerticalAlignCenterOutlined,{fontSize:"small"})}),(0,n.jsx)(A.ToggleButton,{value:"bottom",children:(0,n.jsx)(ee.VerticalAlignBottomOutlined,{fontSize:"small"})})]})}function dJ({value:t,onChange:r,options:a}){return(0,n.jsx)(A.ToggleButtonGroup,{exclusive:!0,value:t,size:"small",onChange:(o,s)=>{typeof s=="string"&&r(s)},sx:{display:"flex",width:"100%"},children:a.map(o=>(0,n.jsx)(A.ToggleButton,{value:o.value,children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[o.icon,(0,n.jsx)("span",{children:o.label})]})},o.value))})}var pp="layout-custom",E8=[{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]}],V8=[{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]}],zl={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 cJ(t){const r=t?.[0];return typeof r=="number"&&!Number.isNaN(r)?Math.min(99,Math.max(1,Math.round(r))):50}function k8(t){let r=typeof t?.[0]=="number"?Math.round(t[0]):34,a=typeof t?.[1]=="number"?Math.round(t[1]):33;return r=Math.min(98,Math.max(1,r)),a=Math.min(98,Math.max(1,a)),r+a>=99&&(a=Math.max(1,99-r)),[r,a]}var D8=({fractions:t,highlight:r})=>{const a=(0,A.useTheme)(),o=r?a.palette.secondary.main:"#e5e7eb";return(0,n.jsx)("div",{style:{...zl.layoutPreview,gridTemplateColumns:t.map(s=>`${s}fr`).join(" ")},children:t.map((s,u)=>(0,n.jsx)("div",{style:{minWidth:0,backgroundColor:o,borderRadius:"4px",transition:"background-color 0.2s ease"}},u))})},Gld=({defaultValue:t,fixedWidths:r,onChange:a,columns:o})=>{const{t:s}=Ze("inspector"),u=(0,A.useTheme)(),[d,c]=(0,y.useState)(null),[_,h]=(0,y.useState)(!1),[p,m]=(0,y.useState)(()=>cJ(r??void 0)),[f,v]=(0,y.useState)(()=>k8(r??void 0)[0]),[S,g]=(0,y.useState)(()=>k8(r??void 0)[1]),b=t??(o===2?"layout-50-50":"layout-33-33-33"),T=d??(b==="layout-33-34-33"?"layout-33-33-33":b),[M,O]=(0,y.useState)(o===2?E8:V8),x=(z,V)=>{c(null),h(!1),a({layout:z,fixedWidths:V})},w=()=>{if(c(pp),h(!0),o===2)m(cJ(r??void 0));else{const[z,V]=k8(r??void 0);v(z),g(V)}},R=()=>{if(o===2){const z=p;a({layout:pp,fixedWidths:[z,100-z,null]})}else{const z=f,V=S;a({layout:pp,fixedWidths:[z,V,100-z-V]})}c(null)};(0,y.useEffect)(()=>{O(o===2?E8:V8)},[o]),(0,y.useEffect)(()=>{c(null),h(!1)},[o,t]),(0,y.useEffect)(()=>{const z=t;o===2?z!=="layout-custom"&&(z==null||!E8.some(V=>V.id===z))&&a({layout:"layout-50-50",fixedWidths:[50,50,null]}):z==="layout-33-34-33"?a({layout:"layout-33-33-33",fixedWidths:[33.34,33.33,33.33]}):z!=="layout-custom"&&(z==null||!V8.some(V=>V.id===z))&&a({layout:"layout-33-33-33",fixedWidths:[33.34,33.33,33.33]})},[o,t,a]);const j=(z,V)=>{const k=V;v(k),g(D=>Math.max(1,Math.min(D,100-k-1)))},P=(z,V)=>{const k=V,D=100-f-1;g(Math.max(1,Math.min(k,D)))},H=100-p,L=100-f-S,E=T===pp;return(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:s("inputs.layout.label")}),(0,n.jsxs)("div",{style:zl.grid,children:[M.map(z=>(0,n.jsx)("div",{onClick:()=>x(z.id,z.distribution),style:{...zl.card,border:T===z.id?`2px solid ${u.palette.secondary.main}`:zl.card.border},children:(0,n.jsx)("div",{style:zl.cardContent,children:(0,n.jsx)(D8,{fractions:z.distribution.filter(V=>V!=null),highlight:T===z.id})})},z.id)),(0,n.jsx)("div",{onClick:w,style:{...zl.card,border:E?`2px solid ${u.palette.secondary.main}`:zl.card.border},role:"button",tabIndex:0,onKeyDown:z=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),w())},children:(0,n.jsx)("div",{style:zl.cardContent,children:(0,n.jsx)(A.Box,{sx:{width:"100%",height:30,minHeight:30,border:"1px dashed",borderColor:"divider",borderRadius:1,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:E?"action.selected":"action.hover",color:"text.primary",transition:u.transitions.create(["background-color"],{duration:u.transitions.duration.shorter})},children:(0,n.jsx)(ee.EditOutlined,{sx:{fontSize:18,color:"text.primary"}})})})})]}),(0,n.jsx)(A.Collapse,{in:_,timeout:"auto",unmountOnExit:!0,children:(0,n.jsxs)(A.Box,{sx:{mt:2,p:2,borderRadius:1,border:1,borderColor:"divider",bgcolor:"background.paper"},children:[o===2?(0,n.jsxs)(A.Stack,{spacing:2,sx:{mt:1},children:[(0,n.jsxs)(A.Typography,{variant:"body2",color:"text.secondary",children:[p,"% | ",H,"%"]}),(0,n.jsx)(A.Slider,{value:p,min:1,max:99,step:1,valueLabelDisplay:"auto","aria-label":s("inputs.layout.custom.split2"),onChange:(z,V)=>m(V)}),(0,n.jsx)(D8,{fractions:[p,H],highlight:!0})]}):(0,n.jsxs)(A.Stack,{spacing:2,sx:{mt:1},children:[(0,n.jsxs)(A.Typography,{variant:"body2",color:"text.secondary",children:[f,"% | ",S,"% | ",L,"%"]}),(0,n.jsxs)(A.Box,{children:[(0,n.jsx)(A.Typography,{variant:"caption",color:"text.secondary",component:"div",children:s("inputs.layout.custom.firstColumn")}),(0,n.jsx)(A.Slider,{value:f,min:1,max:98,step:1,valueLabelDisplay:"auto",onChange:j})]}),(0,n.jsxs)(A.Box,{children:[(0,n.jsx)(A.Typography,{variant:"caption",color:"text.secondary",component:"div",children:s("inputs.layout.custom.secondColumn")}),(0,n.jsx)(A.Slider,{value:S,min:1,max:100-f-1,step:1,valueLabelDisplay:"auto",onChange:P})]}),(0,n.jsx)(D8,{fractions:[f,S,L],highlight:!0})]}),(0,n.jsx)(A.Button,{variant:"contained",size:"small",sx:{mt:2},onClick:R,children:(0,n.jsx)(A.Typography,{variant:"button",component:"span",sx:{color:"#FFFFFF",fontWeight:"bold"},children:s("inputs.layout.custom.apply")})})]})})]})};function qld({label:t,tooltipTitle:r,hideWarning:a}){return(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[(0,n.jsx)(_1,{label:t}),!a&&(0,n.jsx)(A.Tooltip,{title:r,placement:"top",children:(0,n.jsx)(A.IconButton,{size:"small",color:"warning",disableRipple:!0,sx:{p:0,cursor:"help",lineHeight:0,"&:hover":{backgroundColor:"transparent"}},children:(0,n.jsx)(Y4r,{"aria-hidden":!0})})})]})}var Z4r=(t=>(0,n.jsx)(A.SvgIcon,{...t,viewBox:"0 0 24 24",children:(0,n.jsxs)("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[(0,n.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"}),(0,n.jsx)("circle",{cx:"18",cy:"18",r:"3"})]})}));Z4r.muiName="ColumnsCountIcon";function Kld({data:t,setData:r}){const[,a]=(0,y.useState)(null),[o,s]=(0,y.useState)(t.props?.columnsCount??2),u=F.useSelectedSidebarTab(),d=F.useSelectedScreenSize(),c=mo(),{t:_}=Ze("inspector"),h=S=>{const g=F.editorStateStore.getState().document,b=S.filter(T=>g[T]?.type==="Image");d==="desktop"&&b.forEach(T=>{const M=g[T];if(M?.type!=="Image")return;const O=M.data;Jld(T,x=>{W_(T,w=>w.type!=="Image"?w:{...w,data:x})},O)})},p=S=>{const g=aA.safeParse(S);g.success?(g.data.props.columns.map(b=>h(b.childrenIds)),r(g.data),o&&g.data.props?.columnsCount!==o&&s(g.data.props?.columnsCount??2),a(null)):(console.error("Error on columns: ",g.error),a(g.error))},m={layout:"layout-50-50",fixedWidths:[50,50,null],columnsCount:2},f={layout:"layout-33-34-33",fixedWidths:[33,34,33],columnsCount:3},v=S=>{const g=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:[...t.props.columns];return S==="2"?{...m,columns:g}:{...f,columns:g}};return(0,n.jsxs)(Rs,{title:_("inputs.panels.columns.title"),children:[(u=="block-configuration"||c)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Ft,{icon:Z4r,label:_("inputs.panels.columns.countLabel"),children:(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:_("inputs.panels.columns.countLabel")}),(0,n.jsx)(A.Box,{sx:{...kT,paddingLeft:0,paddingRight:0,height:"auto",minHeight:"36px"},children:(0,n.jsx)(dJ,{value:t.props?.columnsCount===2?"2":"3",onChange:S=>{const g=v(S);p({...t,props:{...t.props,...g}})},options:[{value:"2",label:"2",icon:(0,n.jsx)(ee.SplitscreenOutlined,{fontSize:"small"})},{value:"3",label:"3",icon:(0,n.jsx)(ee.ViewWeekOutlined,{fontSize:"small"})}]})})]})}),(0,n.jsx)(Ft,{icon:ee.TableChartOutlined,label:_("inputs.panels.columns.layoutLabel","Layout"),children:(0,n.jsx)(Gld,{columns:t.props?.columnsCount??3,defaultValue:t.props?.layout,fixedWidths:t.props?.fixedWidths??void 0,onChange:({layout:S,fixedWidths:g})=>{const b=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:t.props.columns;p({...t,props:{...t.props,layout:S,fixedWidths:g,columns:b}})}})})]}),(u=="css"||c)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)($_,{}),(0,n.jsx)(Ft,{icon:ee.PhoneIphoneOutlined,label:_("inputs.panels.columns.stackColumnsOnMobile"),children:(0,n.jsxs)(Er,{children:[(0,n.jsx)(qld,{label:_("inputs.panels.columns.stackColumnsOnMobile"),tooltipTitle:_("inputs.panels.columns.stackColumnsOnMobileWarning")}),(0,n.jsx)(A.Box,{sx:{width:"100%",...kT,paddingLeft:0,paddingRight:0,height:"auto",minHeight:"36px"},children:(0,n.jsx)(dJ,{value:t.props?.stackColumnsOnMobile?"stacked":"sideBySide",onChange:S=>{p({...t,props:{...t.props,stackColumnsOnMobile:S==="stacked"}})},options:[{value:"sideBySide",label:_("inputs.panels.columns.stackToggleSideBySide"),icon:(0,n.jsx)(ee.ViewColumnOutlined,{fontSize:"small"})},{value:"stacked",label:_("inputs.panels.columns.stackToggleStacked"),icon:(0,n.jsx)(ee.TableRowsOutlined,{fontSize:"small"})}]})})]})}),(0,n.jsx)(Ft,{icon:ee.AlignVerticalCenterOutlined,label:_("inputs.alignment.label"),children:(0,n.jsx)($ld,{data:t,updateData:r})}),(0,n.jsx)($n,{names:["backgroundColor","background","padding","mobilePadding"],value:t.style,onChange:S=>p({...t,style:S})})]})]})}function e0r({data:t,setData:r}){const[,a]=(0,y.useState)(null),{t:o}=Ze("inspector"),s=u=>{const d=I4r.safeParse(u);d.success?(r(d.data),a(null)):a(d.error)};return(0,n.jsx)(Rs,{title:o("inputs.panels.container.title"),children:(0,n.jsx)($n,{names:["backgroundColor","background","border","borderMobile","shape","padding","mobilePadding"],value:t.style,shapeSteps:30,onChange:u=>s({...t,style:u})})})}function t0r({data:t,setData:r}){const[,a]=(0,y.useState)(null),{t:o}=Ze("inspector"),s=u=>{const d=Ae.DividerPropsSchema.safeParse(u);d.success?(r(d.data),a(null)):a(d.error)};return(0,n.jsx)(Rs,{title:o("inputs.panels.divider.title"),children:(0,n.jsx)($n,{names:["width","widthMobile","height","heightMobile","color","backgroundColor","textAlign","textAlignMobile","padding","mobilePadding"],value:t.style,onChange:u=>s({...t,style:u})})})}var Yld=({label:t,linkColor:r,underline:a=!1,onChange:o})=>{const[s,u]=(0,y.useState)(r??"#FF0000"),[d,c]=(0,y.useState)(a),{t:_}=Ze("inspector"),h=t??_("inputs.links.color"),p=d?"enabled":"disabled",m={container:{width:"100%"}};(0,y.useEffect)(()=>{r!==s&&u(r??"#FF0000")},[r]),(0,y.useEffect)(()=>{a!==d&&c(a)},[a]);const f=S=>{const g=S??"#FF0000";u(g),o({linkColor:g,underline:d})},v=(S,g)=>{if(!g)return;const b=g==="enabled";c(b),o({linkColor:s,underline:b})};return(0,n.jsxs)(Er,{children:[(0,n.jsx)(Au,{label:h,defaultValue:s,onChange:f}),(0,n.jsx)(_1,{label:_("inputs.links.underline")}),(0,n.jsx)(A.Box,{sx:m.container,children:(0,n.jsxs)(A.ToggleButtonGroup,{value:p,exclusive:!0,fullWidth:!0,onChange:v,sx:{width:"100%"},children:[(0,n.jsx)(A.ToggleButton,{value:"enabled",children:(0,n.jsx)(A.Tooltip,{title:_("inputs.links.underlineOn"),children:(0,n.jsx)(A.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(ee.FormatUnderlined,{fontSize:"small"})})})}),(0,n.jsx)(A.ToggleButton,{value:"disabled",children:(0,n.jsx)(A.Tooltip,{title:_("inputs.links.underlineOff"),children:(0,n.jsx)(A.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(ee.FormatClear,{fontSize:"small"})})})})]})})]})};function r0r({data:t,setData:r}){const[,a]=(0,y.useState)(null),{t:o}=Ze("inspector"),s=u=>{const d=B4r.safeParse(u);d.success?(r(d.data),a(null)):a(d.error)};return(0,n.jsxs)(A.Stack,{spacing:1,children:[(0,n.jsx)(Ft,{icon:B3,label:o("inputs.panels.emailLayout.backgroundColor"),children:(0,n.jsx)(Au,{label:o("inputs.panels.emailLayout.backgroundColor"),defaultValue:t.backdropColor??"#F5F5F5",onChange:u=>s({...t,backdropColor:u})})}),(0,n.jsx)(Ft,{icon:ee.CropSquareOutlined,label:o("inputs.panels.emailLayout.canvasColor"),children:(0,n.jsx)(Au,{label:o("inputs.panels.emailLayout.canvasColor"),defaultValue:t.canvasColor??"#FFFFFF",onChange:u=>s({...t,canvasColor:u})})}),(0,n.jsx)(Ft,{icon:i6,label:o("inputs.panels.emailLayout.fontFamily"),children:(0,n.jsx)(sA,{label:o("inputs.panels.emailLayout.fontFamily"),defaultValue:t.fontFamily||Ae.DEFAULT_FONT.FAMILY,onChange:u=>s({...t,fontFamily:u})})}),(0,n.jsx)(Ft,{icon:l6,label:o("inputs.panels.emailLayout.textColor"),children:(0,n.jsx)(Au,{label:o("inputs.panels.emailLayout.textColor"),defaultValue:t.textColor??"#262626",onChange:u=>s({...t,textColor:u})})}),(0,n.jsx)(Ft,{icon:ee.LinkOutlined,label:o("inputs.panels.emailLayout.linksLabel"),children:(0,n.jsx)(Yld,{label:o("inputs.panels.emailLayout.linksLabel"),linkColor:t.linkGlobal?.linkColor||"#000000",underline:t.linkGlobal?.underline||!1,onChange:u=>s({...t,linkGlobal:u})})})]})}var Qld=(t,r,a)=>{const o=F.useSelectedScreenSize();(0,y.useEffect)(()=>{const s=()=>{if(!t||!document||o=="mobile")return;const c=Ae.shortCssId(t),_=document.querySelector(`.${c}`);if(!_)return;const h=_.parentElement;if(!h)return;const p=Math.ceil(h.getBoundingClientRect().width);a.props?.size===void 0||a.props?.size==="original"||a.props?.touched&&a.props?.width<=p||a.props?.width!==p&&!a.props?.touched&&r({...a,props:{...a.props,width:p}})};s();const u=new ResizeObserver(s),d=document.querySelector(`.${Ae.shortCssId(t)}`);return d?.parentElement&&u.observe(d.parentElement),()=>{u.disconnect()}},[t,r,a,o])},Xld=({data:t,setData:r,blockId:a})=>{const{t:o}=Ze("inspector"),[s,u]=(0,y.useState)(!1),[d,c]=(0,y.useState)(()=>!!window.__emailBuilderEnableAI),[,_]=(0,y.useState)(null),[h,p]=(0,y.useState)(""),[m,f]=(0,y.useState)(!1),[v,S]=(0,y.useState)(""),[g,b]=(0,y.useState)(!1),T=(0,y.useRef)(null),[M,O]=(0,y.useState)(null),x=F.useImageUrlInput(),w=F.useImageUploadInput(),R=x||w,[j,P]=(0,y.useState)(()=>!!window.__emailBuilderUnsplashEnabled);(0,y.useEffect)(()=>{const $=()=>{P(!!window.__emailBuilderUnsplashEnabled)};return $(),window.addEventListener("email-builder-unsplash-updated",$),()=>window.removeEventListener("email-builder-unsplash-updated",$)},[]),(0,y.useEffect)(()=>{const $=window.__emailBuilderCustomImageProvider;$&&(O($),setTimeout(()=>{a&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:a,currentImageUrl:t.props?.url||null,alt:t.props?.alt||null}}))},100))},[]);const H=$=>{const W=Ae.ImagePropsSchema.safeParse($);W.success?(r(W.data),_(null)):_(W.error)},L=($,W)=>{const _e=$.toLowerCase(),Y=_e.includes(".svg")||_e.includes("svg"),re=W&&(W.includes("image/svg+xml")||W.includes("svg"));return Y||!!re},E=async $=>{try{f(!0),S(""),b(!1);try{new URL($)}catch{return S(o("inputs.image.invalidUrl")),!1}const W=new AbortController,_e=setTimeout(()=>W.abort(),1e4);try{const Y=await fetch($,{method:"HEAD",signal:W.signal});if(clearTimeout(_e),!Y.ok)return S(o("inputs.image.httpError",{status:Y.status,statusText:Y.statusText})),!1;const re=Y.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(Q=>re&&re.toLowerCase().includes(Q.toLowerCase()))?(L($,re)&&b(!0),S(""),!0):(S(o("inputs.image.notImage")),!1)}catch(Y){return clearTimeout(_e),Y.name==="AbortError"?(S(o("inputs.image.timeout")),!1):new Promise(re=>{const Q=new Image,le=setTimeout(()=>{S(o("inputs.image.timeout")),re(!1)},1e4);Q.onload=()=>{clearTimeout(le),L($)&&b(!0),S(""),re(!0)},Q.onerror=()=>{clearTimeout(le),S(o("inputs.image.loadError")),re(!1)},Q.src=$})}}catch{return S(o("inputs.image.unexpectedError")),!1}finally{f(!1)}},z=async()=>{h.trim()&&await E(h.trim())&&(H({...t,props:{...t.props,url:h.trim()}}),a&&cd(a),p(""))},V=$=>{$.key==="Enter"&&z()},k=$=>{p($.target.value),v&&S(""),g&&b(!1)},D=$=>{const W=["image/png","image/jpeg","image/gif"],Y=$.filter(Q=>W.includes(Q.type)&&Q.size<=5242880);if(Y.length!==$.length&&alert(o("inputs.common.invalidFiles")),Y.length===0)return;const re=Y.map(Q=>new Promise(le=>{const ce=new FileReader;ce.onload=Z=>le(Z.target?.result),ce.readAsDataURL(Q)}));Promise.all(re).then(Q=>{const le={images:Q,id:a||""};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:le})),F.setImageUploading(!0,a||"")})},N=$=>{$.preventDefault(),u(!0)},I=$=>{const W=$.currentTarget.getBoundingClientRect(),_e=$.clientX,Y=$.clientY;(_e<W.left||_e>=W.right||Y<W.top||Y>=W.bottom)&&u(!1)},B=$=>{$.preventDefault(),u(!1);const W=Array.from($.dataTransfer.files);W.length>0&&D(W)},q=()=>{const $=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent($)};(0,y.useEffect)(()=>{const $=window.__emailBuilderEnableAI;$!==void 0&&c(!!$);const W=_e=>{const{detail:Y}=_e;c(!!Y)};return window.addEventListener("email-builder-ai-generation",W),()=>{window.removeEventListener("email-builder-ai-generation",W)}},[]),(0,y.useEffect)(()=>{const $=re=>{const{detail:Q}=re;F.setImageUploading(!1,Q.id||""),a&&(B4(a,{url:Q.url}),cd(a)),F.setDisableEdition(!1)},W=re=>{F.setImageUploading(re?.detail?.uploading??!1,re?.detail?.id??"")},_e=()=>{T?.current?.click()},Y=re=>{if(!a)return;const Q=re.detail;if(typeof Q=="string"){B4(a,{url:Q}),cd(a);return}if(Q&&typeof Q=="object"&&typeof Q.url=="string"){const le={url:Q.url};typeof Q.alt=="string"&&(le.alt=Q.alt),B4(a,le)}};return window.addEventListener("email-builder-set-image",Y),window.addEventListener("email-builder-upload-image-receive",$),window.addEventListener("email-builder-upload-file",_e),window.addEventListener("email-builder-toggle-upload-file",W),()=>{window.removeEventListener("email-builder-toggle-upload-file",W),window.removeEventListener("email-builder-upload-image-receive",$),window.removeEventListener("email-builder-set-image",Y),window.removeEventListener("email-builder-upload-file",_e)}},[a]),(0,y.useEffect)(()=>{t.props?.url&&b(L(t.props.url))},[t.props?.url]);const te=()=>(0,n.jsxs)(A.Stack,{spacing:1,children:[(0,n.jsx)(Er,{children:x&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_1,{label:o("inputs.image.urlLabel")}),(0,n.jsxs)(A.Stack,{direction:"row",spacing:1,children:[(0,n.jsx)(A.TextField,{fullWidth:!0,placeholder:o("inputs.image.urlPlaceholder"),value:h,onChange:k,onKeyPress:V,error:!!v,disabled:m,sx:$o}),(0,n.jsx)(A.Button,{variant:"contained",onClick:z,disabled:!h.trim()||m,sx:{minWidth:"auto",px:2},children:m?(0,n.jsx)(A.CircularProgress,{size:20,color:"inherit"}):o("inputs.common.add")})]}),v&&(0,n.jsx)(A.Alert,{severity:"error",sx:{mt:1,fontSize:"0.875rem"},children:v}),g&&(0,n.jsx)(A.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:(0,n.jsx)(A.IconButton,{"aria-label":o("inputs.common.close"),color:"inherit",size:"small",onClick:()=>b(!1),children:(0,n.jsx)(ee.Close,{fontSize:"inherit"})}),children:o("inputs.common.svgWarning")})]})}),x&&w&&(0,n.jsxs)(A.Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,n.jsx)(A.Divider,{sx:{flexGrow:1}}),(0,n.jsx)(A.Typography,{variant:"caption",sx:{color:"text.secondary"},children:o("inputs.backgroundImage.or")}),(0,n.jsx)(A.Divider,{sx:{flexGrow:1}})]}),w&&(0,n.jsxs)(A.Box,{onDragOver:N,onDragLeave:I,onDrop:B,sx:{width:"100%",border:"2px dashed",borderColor:s?"primary.main":"divider",borderRadius:"8px",padding:3,textAlign:"center",bgcolor:s?"action.hover":"background.paper",transition:"all 0.2s ease"},children:[(0,n.jsx)(A.Box,{sx:{display:"flex",justifyContent:"center",mb:1},children:(0,n.jsx)(ee.PhotoOutlined,{sx:{fontSize:28,color:"primary.main"}})}),(0,n.jsxs)("label",{style:{cursor:"pointer"},children:[(0,n.jsx)("input",{ref:T,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:$=>{const W=$.target.files;W&&W.length>0&&D(Array.from(W))}}),(0,n.jsx)(A.Typography,{component:"span",sx:{fontWeight:600,color:"primary.main"},children:o("inputs.common.uploadFile")}),(0,n.jsxs)(A.Typography,{component:"span",sx:{fontWeight:500,color:"text.secondary"},children:[" ",o("inputs.common.dragAndDrop")]})]}),(0,n.jsx)(A.Typography,{variant:"caption",sx:{color:"text.secondary",mt:1,display:"block"},children:o("inputs.common.fileInfo")})]}),!M&&F.getGalleryImages()&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(A.Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,n.jsx)(A.Divider,{sx:{flexGrow:1}}),(0,n.jsx)(A.Typography,{variant:"caption",sx:{color:"text.secondary"},children:o("inputs.backgroundImage.or")}),(0,n.jsx)(A.Divider,{sx:{flexGrow:1}})]}),(0,n.jsx)(A.Button,{variant:"outlined",onClick:q,startIcon:(0,n.jsx)(ee.ImageSearchOutlined,{}),fullWidth:!0,children:o("inputs.backgroundImage.browseGallery")})]})]});return(0,n.jsxs)(A.Stack,{spacing:1,children:[(0,n.jsx)(K4r,{imageUrl:t.props?.url??null,alt:t.props?.alt??"",blockId:a,onRemove:()=>{a&&(B4(a,{url:null}),cd(a)),H({...t,props:{...t.props??{},url:null}})}}),(0,n.jsx)(U4r,{tabs:[{key:"gallery",label:o("inputs.tabs.gallery"),visible:j,render:()=>(0,n.jsx)(G4r,{blockId:a,source:"image"})},{key:"yourGallery",label:o("inputs.tabs.yourGallery"),visible:!!M,render:()=>(0,n.jsx)(A.Box,{children:M})},{key:"upload",label:o("inputs.tabs.upload"),visible:R,render:te},{key:"generate",label:o("inputs.tabs.generate"),visible:d,render:()=>(0,n.jsx)(A.Box,{sx:{py:1},children:(0,n.jsx)(q4r,{src:t.props?.url,style:{width:"100%",margin:0}})})}],defaultTab:"upload"})]})},Zld=({defaultValue:t="original",scale:r=100,onChange:a})=>{const[o,s]=(0,y.useState)(t),[u,d]=(0,y.useState)(r),c=(0,A.useTheme)(),{t:_}=Ze("inspector"),h={container:{width:"100%"},label:{marginBottom:"8px",fontSize:"14px",fontWeight:500,color:c.palette.text.primary},sliderContainer:{marginTop:"16px",padding:"0 8px"},slider:{"& .MuiSlider-thumb":{width:12,height:12,backgroundColor:c.palette.primary.main,"&:hover":{boxShadow:`0 0 0 8px ${c.palette.primary.main}20`}},"& .MuiSlider-rail":{height:4,backgroundColor:c.palette.grey[300]},"& .MuiSlider-track":{height:4,backgroundColor:c.palette.primary.main}},scaleValue:{marginTop:"4px",textAlign:"right",fontSize:"14px",color:c.palette.text.secondary}};(0,y.useEffect)(()=>{(t!==o||r!==u)&&(t!==o&&s(t),t==="scale"&&d(r))},[t,r]);const p=(f,v)=>{v!==null&&(s(v),a&&a({mode:v,scale:v==="scale"?u:void 0}))},m=f=>{d(f),a&&a({mode:o,scale:f})};return(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:_("inputs.sizeSelector.label")}),(0,n.jsxs)(A.Box,{sx:h.container,children:[(0,n.jsxs)(A.ToggleButtonGroup,{value:o,exclusive:!0,onChange:p,sx:{width:"100%"},children:[(0,n.jsx)(A.ToggleButton,{value:"original",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.FitScreen,{fontSize:"small"}),(0,n.jsx)("span",{children:_("inputs.sizeSelector.contain")})]})}),(0,n.jsx)(A.ToggleButton,{value:"fill",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.Crop,{fontSize:"small"}),(0,n.jsx)("span",{children:_("inputs.sizeSelector.cover")})]})}),(0,n.jsx)(A.ToggleButton,{value:"scale",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.Percent,{fontSize:"small"}),(0,n.jsx)("span",{children:_("inputs.sizeSelector.scale")})]})})]}),(0,n.jsx)(A.Collapse,{in:o==="scale",children:(0,n.jsx)(A.Box,{sx:h.sliderContainer,children:(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.WidthWideOutlined,{}),value:u,setValue:m,marks:!1,units:"%",min:1,max:100})})})]})]})},_J={cover:(0,n.jsx)(ee.Crop,{fontSize:"small"}),contain:(0,n.jsx)(ee.FitScreen,{fontSize:"small"}),fill:(0,n.jsx)(ee.AspectRatio,{fontSize:"small"})},hJ=t=>t==="cover"||t==="contain"||t==="fill"?_J[t]:_J.cover,pJ=t=>t.length===0?t:t.charAt(0).toUpperCase()+t.slice(1);function esd({data:t,setData:r}){const[a,o]=(0,y.useState)(null),s=F.useSelectedBlockId(),u=F.useSelectedSidebarTab(),d=F.useSelectedScreenSize(),c=mo(),{t:_}=Ze("inspector");Qld(s||"",r,t),y.default.useEffect(()=>{s&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:s,currentImageUrl:t.props?.url||null,alt:t.props?.alt||null,source:"image"}}))},[s,t.props?.url,t.props?.alt]);const h=(0,y.useCallback)(x=>{const w=Ae.ImagePropsSchema.safeParse(x);w.success?JSON.stringify(t)!==JSON.stringify(w.data)&&(r(w.data),o(null)):o(w.error)},[t,r]),p=(0,y.useCallback)((x,w,R)=>{const j=Uld(s)||600,P={...x.props};if(R&&(P.touchedMobile=!0),w.mode==="original"){const H=x.props?.original_width??null;return R?{...P,sizeMobile:w.mode,widthMobile:H}:{...P,size:w.mode,width:H,sizeMobile:P.touchedMobile?P.sizeMobile:w.mode,widthMobile:P.touchedMobile?P.widthMobile:H}}if(w.mode==="fill")return R?{...P,sizeMobile:w.mode,widthMobile:null}:{...P,size:w.mode,width:null,sizeMobile:P.touchedMobile?P.sizeMobile:w.mode,widthMobile:P.touchedMobile?P.widthMobile:null};if(w.mode==="scale"){const H=Math.ceil(j/100*w.scale);return R?{...P,sizeMobile:w.mode,scaleMobile:w.scale,widthMobile:H}:{...P,size:w.mode,scale:w.scale,width:H,sizeMobile:P.touchedMobile?P.sizeMobile:w.mode,scaleMobile:P.touchedMobile?P.scaleMobile:w.scale,widthMobile:P.touchedMobile?P.widthMobile:H}}return P},[s]),m=(0,y.useCallback)((x,w)=>{const R=p(t,x,w);h({...t,props:R})},[t,h,p]),f=(0,y.useMemo)(()=>d!=="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},[d,t.props?.touchedMobile,t.props?.sizeMobile,t.props?.size,t.props?.scaleMobile,t.props?.scale]),v=(0,y.useCallback)(x=>{h({...t,props:{...t.props,alt:x}})},[t,h]),S=(0,y.useCallback)(x=>{const w=x.trim().length===0?null:x.trim();h({...t,props:{...t.props,linkHref:w}})},[t,h]),g=(0,y.useCallback)(x=>{h({...t,style:x})},[t,h]),b=(0,y.useMemo)(()=>d!=="desktop"?t.style?.heightMobile??t.style?.height??void 0:t.style?.height??void 0,[d,t.style?.height,t.style?.heightMobile]),T=(0,y.useCallback)(x=>{const w=d!=="desktop",R={...t.style??{}};w?R.heightMobile=x:R.height=x,h({...t,style:R})},[t,h,d]),M=(0,y.useCallback)(x=>{const w=d!=="desktop",R={...t.style??{}};w?R.objectFitMobile=x:R.objectFit=x,h({...t,style:R})},[t,h,d]),O=(0,y.useCallback)(x=>{const w=d!=="desktop",R={...t.style??{}};w?R.objectPositionMobile=x:R.objectPosition=x,h({...t,style:R})},[t,h,d]);return(0,n.jsxs)(Rs,{title:_("inputs.panels.image.title"),children:[(u==="block-configuration"||c)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Ft,{icon:ee.WallpaperOutlined,label:_("inputs.panels.image.title"),children:(0,n.jsx)(Xld,{data:t,setData:r,blockId:s})}),(0,n.jsx)(Ft,{icon:ee.DescriptionOutlined,label:_("inputs.panels.image.altLabel"),children:(0,n.jsx)(p9,{label:_("inputs.panels.image.altLabel"),placeholder:_("inputs.panels.image.altPlaceholder"),defaultValue:t.props?.alt??"",onChange:v})}),(0,n.jsx)(Ft,{icon:ee.LinkOutlined,label:_("inputs.panels.image.urlLabel"),children:(0,n.jsx)(p9,{label:_("inputs.panels.image.urlLabel"),placeholder:_("inputs.panels.image.urlPlaceholder"),defaultValue:t.props?.linkHref??"",onChange:S})}),(0,n.jsx)(Ft,{icon:ee.AspectRatio,label:_("inputs.panels.image.sizeLabel","Size"),children:(0,n.jsx)(Zld,{defaultValue:f.size,scale:f.scale??void 0,onChange:x=>m(x,d!=="desktop")})}),(0,n.jsx)(Ft,{icon:ee.HeightOutlined,label:_("inputs.panels.image.heightLabel"),children:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ky,{label:_("inputs.panels.image.heightLabel"),defaultValue:b??void 0,min:0,max:800,step:4,onChange:x=>T(x>0?x:null)}),b?(0,n.jsxs)(A.Stack,{direction:"row",spacing:2,sx:{mt:1},children:[(0,n.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,n.jsx)(_1,{label:_("inputs.panels.image.objectFitLabel")}),(0,n.jsx)(Oa,{style:{width:"100%"},size:"small",value:d==="desktop"?t.style?.objectFit??"cover":t.style?.objectFitMobile??t.style?.objectFit??"cover",onChange:x=>M(x.target.value),renderValue:x=>{const w=String(x??"cover");return(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[hJ(w),_(`inputs.panels.image.objectFit${pJ(w)}`)]})},children:["cover","contain","fill"].map(x=>(0,n.jsx)(A.MenuItem,{value:x,sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important"},children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[hJ(x),_(`inputs.panels.image.objectFit${pJ(x)}`)]})},x))})]}),(()=>{const x=d==="desktop"?t.style?.objectFit??"cover":t.style?.objectFitMobile??t.style?.objectFit??"cover",w=d==="desktop"?t.style?.objectPosition??"center":t.style?.objectPositionMobile??t.style?.objectPosition??"center";return x==="fill"?null:(0,n.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,n.jsx)(_1,{label:_("inputs.panels.image.objectPositionLabel")}),(0,n.jsx)(Oa,{style:{width:"100%"},size:"small",value:w,onChange:R=>O(String(R.target.value)),renderValue:R=>{const j=String(R??"center");return(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[d9(j),_(`inputs.backgroundImage.positions.${c9(j)}`)]})},children:Cld.map(R=>(0,n.jsx)(A.MenuItem,{value:R,sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important"},children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[d9(R),_(`inputs.backgroundImage.positions.${c9(R)}`)]})},R))})]})})()]}):null]})})]}),(0,n.jsx)($_,{}),(0,n.jsx)($n,{names:["textAlign","textAlignMobile","backgroundColor","shape","padding","mobilePadding"],value:t.style,shapeMaxValue:300,shapeSteps:20,onChange:g})]})}function tsd({data:t,setData:r}){const a=F.useSelectedSidebarTab(),o=mo(),{t:s}=Ze("inspector"),u=t.style||{},d=c=>{const _={...u||{},...c||{}};r({...t,style:_})};return(0,n.jsxs)(Rs,{title:s("inputs.panels.notionText.title","Text"),children:[(a==="block-configuration"||o)&&(0,n.jsxs)(n.Fragment,{children:[o?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)($n,{disabledCSSValidation:!0,names:["fontFamily"],value:u,onChange:d}),(0,n.jsx)($n,{disabledCSSValidation:!0,names:["lineHeight"],value:u,onChange:d})]}):(0,n.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[(0,n.jsx)("div",{style:{flex:1},children:(0,n.jsx)($n,{disabledCSSValidation:!0,names:["fontFamily"],value:u,onChange:d})}),(0,n.jsx)("div",{style:{flex:1},children:(0,n.jsx)($n,{disabledCSSValidation:!0,names:["lineHeight"],value:u,onChange:d})})]}),(0,n.jsx)($n,{disabledCSSValidation:!0,names:["fontSize","fontSizeMobile"],value:u,onChange:d})]}),(a==="css"||o)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)($_,{}),(0,n.jsx)($n,{names:["backgroundColor","border","borderMobile","padding","mobilePadding"],value:u,onChange:d})]})]})}var rsd=({element:t,index:r,moveItem:a,onSelectChange:o,onUrlChange:s,onRemove:u,onDuplicate:d,canRemove:c,theme:_})=>{const h=(0,y.useRef)(null),[p,m]=(0,y.useState)(null),{t:f}=Ze("inspector"),v=H=>{const L=H.getClientOffset(),E=h.current?.getBoundingClientRect();if(!L||!E)return null;const z=(E.bottom-E.top)/2;return L.y-E.top<z?"up":"down"},[{handlerId:S,isOver:g},b]=z9(()=>({accept:"social-media-item",collect(H){return{handlerId:H.getHandlerId(),isOver:H.isOver({shallow:!0})}},hover(H,L){if(!h.current)return;if(H.index===r){m(null);return}if(!L.isOver({shallow:!0})){m(null);return}const E=v(L);m(E)},drop(H,L){if(m(null),!h.current)return;const E=H.index,z=r;if(E===z)return;const V=v(L);let k=z;V==="down"&&(k=z+1),E<k&&(k=k-1),setTimeout(()=>{a(E,k)},0),H.index=k},end:()=>{m(null)}}),[t.id,r,a]),[{isDragging:T},M]=a5(()=>({type:"social-media-item",item:()=>({id:t.id,index:r}),collect:H=>({isDragging:H.isDragging()}),end:()=>{m(null)}}),[t.id,r]);(0,y.useEffect)(()=>{g||m(null)},[g]);const O=T?.4:1;(0,y.useEffect)(()=>{if(h.current&&M&&b){const H=h.current;M(H),b(H)}},[M,b]);const x=()=>{setTimeout(()=>u(r),0)},w=()=>{setTimeout(()=>d(r),0)},R=H=>{const L=H.target.value;setTimeout(()=>o(r,L,t),0)},j=H=>{const L=H.target.value;setTimeout(()=>s(r,L,t),0)},P=()=>(0,n.jsxs)("div",{style:{height:"3px",background:_.palette.secondary.main,position:"relative",color:_.palette.secondary.main,margin:"4px 0"},children:[(0,n.jsx)("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:(0,n.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"})}),(0,n.jsx)("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:(0,n.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(0,n.jsxs)(n.Fragment,{children:[p==="up"&&(0,n.jsx)(P,{}),(0,n.jsxs)(A.Stack,{ref:h,"data-handler-id":S,sx:{border:1,borderColor:"divider",padding:1,paddingTop:0,borderRadius:1,backgroundColor:"background.paper",marginBottom:1.5,opacity:O,cursor:T?"grabbing":"grab",boxShadow:T?_.shadows[3]:"none"},spacing:1,children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:`1px solid ${_.palette.divider}`},children:[(0,n.jsx)("div",{style:{display:"flex",alignItems:"center"},children:(0,n.jsx)(ee.DragIndicator,{sx:{color:T?"primary.main":"text.secondary",cursor:"grab",marginLeft:-.9,"&:hover":{color:"primary.main"}}})}),(0,n.jsxs)("div",{children:[(0,n.jsx)(A.Tooltip,{title:"Duplicate",placement:"left",children:(0,n.jsx)(A.IconButton,{color:"primary",size:"small",onClick:w,children:(0,n.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,n.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"})})})}),c&&(0,n.jsx)(A.Tooltip,{title:"Remove",placement:"left",children:(0,n.jsx)(A.IconButton,{color:"error",size:"small",onClick:x,children:(0,n.jsx)(ee.DeleteOutlined,{sx:{fontSize:20}})})})]})]}),(0,n.jsxs)("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"0.5rem"},children:[(0,n.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[(0,n.jsx)(_1,{label:f("inputs.social.icon")}),(0,n.jsx)(Oa,{fullWidth:!0,labelId:"demo-simple-select-label",id:"demo-simple-select",value:t.key,size:"small",onChange:R,children:H0.map(H=>(0,n.jsx)(A.MenuItem,{value:H.key,children:H.label},`${t.id}_${H.key}`))})]}),(0,n.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[(0,n.jsx)(_1,{label:f("inputs.social.url")}),(0,n.jsx)(A.TextField,{size:"small",fullWidth:!0,value:t.href??"",onChange:j,variant:"outlined",placeholder:"https://your-website.com",sx:$o})]})]})]}),p==="down"&&(0,n.jsx)(P,{})]})};function nsd({items:t=[],onChange:r}){const{t:a}=Ze("inspector"),o=(0,A.useTheme)(),[s,u]=(0,y.useState)(()=>t.map(b=>({...b,id:b.id||O4()}))),[d,c]=(0,y.useState)(t[0]?.theme||"positive"),[_,h]=(0,y.useState)(t[0]?.size||"medium");(0,y.useEffect)(()=>{t.length>0&&(c(t[0].theme),h(t[0].size),u(t.map(b=>({...b,id:b.id||O4()}))))},[t]);const p=(b,T)=>{u(M=>{const O=[...M],[x]=O.splice(b,1);return O.splice(T,0,x),r&&setTimeout(()=>r(O),0),O})},m=()=>{u(b=>{const T={...H0[0],theme:d,size:_,sizePx:z1(_),url:C1(H0[0].iconName,d,_),id:O4()},M=[...b,T];return r&&setTimeout(()=>r(M),0),M})},f=b=>{u(T=>{const M=T.filter((O,x)=>x!==b);return r&&setTimeout(()=>r(M),0),M})},v=(b,T,M)=>{let O=[...s];if(T in Nid?(c(T),O=O.map(x=>{const w=C1(x.iconName,T,x.size);return{...x,theme:T,url:w}})):T in Fid&&(h(T),O=O.map(x=>{const w=C1(x.iconName,x.theme,T),R=z1(T);return{...x,size:T,sizePx:R,url:w}})),b!==null&&M){const x=H0.find(w=>w.key===T);x&&(O=O.map((w,R)=>{const j={key:x.key,label:x.label,iconName:x.iconName,href:x.href},P=C1(j.iconName,M.theme,M.size);return R===b?{...w,...j,url:P,id:M.id}:w}))}u(O),r&&setTimeout(()=>r(O),0)},S=(b,T,M)=>{const O=s.map((x,w)=>w===b?{...M,href:T}:x);u(O),r&&setTimeout(()=>r(O),0)},g=b=>{u(T=>{const M={...JSON.parse(JSON.stringify(T[b])),id:O4()},O=[...T.slice(0,b+1),M,...T.slice(b+1)];return r&&setTimeout(()=>r(O),0),O})};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:{marginBottom:"1rem",display:"grid",gridTemplateColumns:"repeat(2,1fr)",gap:"1rem"},children:[(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:a("inputs.social.theme")}),(0,n.jsx)(Oa,{fullWidth:!0,labelId:"theme-selector",id:"theme-selector",value:d,size:"small",onChange:b=>v(null,b.target.value,null),children:H4r.map(b=>(0,n.jsx)(A.MenuItem,{value:b.key,children:b.label},`${b.key}`))})]}),(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:a("inputs.social.size")}),(0,n.jsx)(Oa,{fullWidth:!0,labelId:"size-selector",id:"size-selector",value:_,size:"small",onChange:b=>v(null,b.target.value,null),children:rA.map(b=>(0,n.jsx)(A.MenuItem,{value:b.key,children:b.label},`${b.key}`))})]})]}),s?.map((b,T)=>(0,n.jsx)(rsd,{element:b,index:T,moveItem:p,onSelectChange:v,onUrlChange:S,onRemove:f,onDuplicate:g,canRemove:s.length>1,theme:o},b.id)),(0,n.jsx)(A.Button,{onClick:m,sx:{borderRadius:1},variant:"contained",endIcon:(0,n.jsx)(ee.Add,{}),children:"Add"})]})}var asd=({data:t,setData:r})=>{const[,a]=(0,y.useState)(null),o=F.useSelectedScreenSize(),{t:s}=Ze("inspector"),u=m=>{const f=Ae.BlockSocialMediaPropsScheme.safeParse(m);f.success?(r(f.data),a(null)):a(f.error)},d=m=>{u({...t,items:m})},c=m=>{u({...t,style:m})},_=(m,f=!1)=>{if(f){u({...t,gapMobile:m});return}u({...t,gap:m})},h=F.useSelectedSidebarTab(),p=mo();return(0,n.jsxs)(Rs,{title:s("inputs.panels.social.title"),children:[(h=="block-configuration"||p)&&(0,n.jsx)(Ft,{icon:ee.ShareOutlined,label:s("inputs.panels.social.title"),children:(0,n.jsx)(A.Box,{sx:{minWidth:120,margin:1},children:(0,n.jsx)(nsd,{items:t?.items??[],onChange:d})})}),(h=="css"||p)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)($_,{}),(0,n.jsx)(Ft,{icon:ee.SpaceBar,label:s("inputs.panels.social.gap"),children:(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:s("inputs.panels.social.gap")}),o=="desktop"?(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.SpaceBar,{sx:{color:"text.primary"}}),value:Number(t?.gap??4),setValue:m=>_(m,!1),marks:!0,step:4,units:"px",min:0,max:40}):(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.SpaceBar,{sx:{color:"text.primary"}}),value:Number(t?.gapMobile??t?.gap??4),setValue:m=>_(m,!0),marks:!0,step:4,units:"px",min:0,max:40})]})}),(0,n.jsx)($n,{names:["textAlign","textAlignMobile","backgroundColor","padding","mobilePadding"],value:t.style,onChange:m=>c(m)})]})]})};function n0r({data:t,setData:r}){const[,a]=(0,y.useState)(null),{t:o}=Ze("inspector"),s=u=>{const d=Ae.SpacerPropsSchema.safeParse(u);d.success?(r(d.data),a(null)):a(d.error)};return(0,n.jsx)(Rs,{title:o("inputs.panels.spacer.title"),children:(0,n.jsx)($n,{names:["height","heightMobile","backgroundColor"],value:t.style,onChange:u=>s({...t,style:u})})})}function mJ(t){return(0,n.jsx)(A.Box,{sx:{m:3,p:1,border:"1px dashed",borderColor:"divider"},children:(0,n.jsx)(A.Typography,{color:"text.secondary",children:t})})}function osd(){const t=F.useSelectedBlockId(),r=F.useBlock(t||""),a=(0,y.useCallback)(u=>{t&&W_(t,()=>u)},[t]);if(!t)return mJ("Click on a block to inspect.");if(!r)return mJ(`Block with id ${t} was not found. Click on a block to reset.`);const{data:o,type:s}=r;switch(s){case"Button":return(0,n.jsx)(Bld,{data:o,setData:u=>a({type:s,data:u})},t);case"ColumnsContainer":return(0,n.jsx)(Kld,{data:o,setData:u=>a({type:s,data:u})},t);case"Container":return(0,n.jsx)(e0r,{data:o,setData:u=>a({type:s,data:u})},t);case"Divider":return(0,n.jsx)(t0r,{data:o,setData:u=>a({type:s,data:u})},t);case"Image":return(0,n.jsx)(esd,{data:o,setData:u=>a({type:s,data:u})},t);case"EmailLayout":return(0,n.jsx)(r0r,{data:o,setData:u=>a({type:s,data:u})},t);case"Spacer":return(0,n.jsx)(n0r,{data:o,setData:u=>a({type:s,data:u})},t);case"NotionText":return(0,n.jsx)(tsd,{data:o,setData:u=>a({type:s,data:u})},t);case"SocialMedia":return(0,n.jsx)(asd,{data:o,setData:u=>a({type:s,data:u})},t);default:return(0,n.jsx)("pre",{children:JSON.stringify(r,null," ")})}}var isd=(0,y.memo)(osd),lsd="email-builder-standalone",ssd="4.3.0",usd="module",dsd="./dist/index.cjs",csd="./dist/index.mjs",_sd="./dist/index.d.ts",hsd={".":{types:"./dist/index.d.ts",import:"./dist/index.mjs",require:"./dist/index.cjs"},"./standalone":{import:"./dist/standalone.mjs"},"./style.css":"./dist/style.css"},psd=["*.css"],msd={node:">=24"},fsd="A React email builder component with drag and drop functionality",vsd="AGPL-3.0",Ssd={name:"Laravel42",email:"hello@laravel42.com",url:"https://github.com/laravel42/"},gsd=["dist","vite.config.standalone.ts"],bsd={prepack:"pnpm build:all && node prepare-publish.cjs clean",postpack:"node prepare-publish.cjs restore","dev:publish":"pnpm version patch && pnpm publish --no-git-checks",build:"vite build","build:standalone":"vite build --config vite.config.standalone.ts","build:all":"pnpm build && pnpm build:standalone"},Tsd={"@codexteam/icons":"^0.3.3","@eb/document-core":"workspace:*","@emoji-mart/data":"^1.2.1","@emoji-mart/react":"^1.1.1","@emotion/cache":"^11.14.0","@emotion/react":"^11.14.0","@emotion/styled":"^11.14.1","@floating-ui/react":"^0.27.20","@josecortez1/c42-core":"0.1.0","@josecortez1/c42-react":"0.1.0","@mui/icons-material":"^9.2.0","@mui/material":"^9.2.0","@r2wc/react-to-web-component":"^2.1.1","@tiptap/core":"^3.28.0","@tiptap/extension-color":"^3.28.0","@tiptap/extension-link":"^3.28.0","@tiptap/extension-placeholder":"^3.28.0","@tiptap/extension-text-align":"^3.28.0","@tiptap/extension-text-style":"^3.28.0","@tiptap/extension-underline":"^3.28.0","@tiptap/pm":"^3.28.0","@tiptap/react":"^3.28.0","@tiptap/starter-kit":"^3.28.0","@tiptap/suggestion":"^3.28.0","approve-builds":"^1.0.0",csso:"^5.0.5","driver.js":"^1.8.0","emoji-mart":"^5.6.0","fast-json-patch":"^3.1.1","highlight.js":"^11.11.1","html-to-image":"1.11.13",i18next:"^26.3.6","i18next-browser-languagedetector":"^8.2.1","lucide-react":"^1.25.0",prettier:"^3.9.5",r:"^0.0.5",react:"^19.2.7","react-colorful":"^5.8.0","react-dnd":"^16.0.1","react-dnd-html5-backend":"^16.0.1","react-dnd-preview":"^9.0.0","react-dnd-touch-backend":"^16.0.1","react-dom":"^19.2.7","react-i18next":"^17.0.10","react-sticky-el":"^2.1.1",use:"^3.1.1","vite-plugin-dts":"^5.0.3",zod:"^4.4.3",zustand:"^5.0.14"},ysd={react:">=18.0.0 || ^19.0.0","react-dom":">=18.0.0 || ^19.0.0"},Csd={react:{optional:!0},"react-dom":{optional:!0}},Msd={"@codexteam/icons":"^0.3.3","@eb/block-button":"workspace:*","@eb/block-columns-container":"workspace:*","@eb/block-container":"workspace:*","@eb/block-divider":"workspace:*","@eb/block-image":"workspace:*","@eb/block-notion-text":"workspace:*","@eb/block-social-media":"workspace:*","@eb/block-spacer":"workspace:*","@eb/email-builder":"workspace:*","@types/react":"^18.3.18","@types/react-dom":"^18.3.5","@typescript-eslint/eslint-plugin":"^8.64.0","@typescript-eslint/parser":"^8.64.0","@vitejs/plugin-react-swc":"^4.3.1","editorjs-undo":"^2.0.28",esbuild:"^0.28.1",eslint:"^10.7.0","eslint-plugin-react-hooks":"^7.1.1","eslint-plugin-react-refresh":"^0.5.3","eslint-plugin-simple-import-sort":"^14.0.0",react:"^19.2.1","react-dom":"^19.2.1",typescript:"^6.0.3",vite:"^8.1.5"},xsd=["email-builder","email-template","react","typescript","wysiwyg"],t4={name:lsd,version:ssd,type:usd,main:dsd,module:csd,types:_sd,exports:hsd,sideEffects:psd,engines:msd,description:fsd,license:vsd,author:Ssd,files:gsd,scripts:bsd,dependencies:Tsd,peerDependencies:ysd,peerDependenciesMeta:Csd,devDependencies:Msd,keywords:xsd};function Osd({onReset:t,visible:r}){const{t:a}=Ze("inspector");return r?(0,n.jsx)(A.Tooltip,{title:a("theme.reset"),placement:"left",children:(0,n.jsx)(A.IconButton,{size:"small",onClick:t,sx:{color:"primary.main",flexShrink:0,width:32,height:32,"&:hover":{backgroundColor:"action.hover"}},children:(0,n.jsx)(ee.RestartAltOutlined,{fontSize:"small"})})}):(0,n.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:32,height:32,flexShrink:0}})}var wsd={top:0,right:0,bottom:0,left:0},Asd={color:B3,padding:h9,fontSize:ee.FormatSizeOutlined,fontFamily:i6,fontWeight:ee.FormatBoldOutlined,textAlign:ee.FormatAlignCenterOutlined,number:ee.FormatSizeOutlined,border:ee.BorderStyleOutlined};function Rsd({blockType:t,field:r}){const{t:a}=Ze("inspector"),{value:o,isOverridden:s,set:u,reset:d}=F.useThemeField(t,r.section,r.key),[c,_]=(0,y.useState)(!0),h=I3[t]?.[r.section]?.[r.key],p=a(r.labelKey),m=(0,n.jsx)(Osd,{onReset:d,visible:s}),f=r.icon??Asd[r.kind];switch(r.kind){case"color":return(0,n.jsx)(Ft,{icon:f,label:p,modified:s,children:(0,n.jsx)(dm,{label:p,labelAction:m,defaultValue:o??h??null,onChange:v=>v===null?d():u(v)})});case"padding":return(0,n.jsx)(Ft,{icon:f,label:p,modified:s,children:(0,n.jsx)(Dy,{label:p,labelAction:m,defaultValue:o??h??wsd,inheritedFrom:s?void 0:"default",onChange:v=>u(v),sidesLinked:c,onSidesLinkedChange:_})});case"fontSize":return(0,n.jsx)(Ft,{icon:f,label:p,modified:s,children:(0,n.jsx)(_9,{label:p,labelAction:m,defaultValue:o??h??16,onChange:v=>u(v)})});case"fontFamily":return(0,n.jsx)(Ft,{icon:f,label:p,modified:s,children:(0,n.jsx)(sA,{label:p,labelAction:m,defaultValue:o??h??null,onChange:v=>v===null?d():u(v)})});case"fontWeight":return(0,n.jsx)(Ft,{icon:f,label:p,modified:s,children:(0,n.jsx)(Q4r,{label:p,labelAction:m,defaultValue:o??h??"normal",onChange:v=>u(v)})});case"textAlign":return(0,n.jsx)(Ft,{icon:f,label:p,modified:s,children:(0,n.jsx)(Ny,{label:p,labelAction:m,defaultValue:o??h??null,onChange:v=>v===null?d():u(v)})});case"number":return(0,n.jsx)(Ft,{icon:f,label:p,modified:s,children:(0,n.jsx)(_9,{label:p,labelAction:m,defaultValue:o??h??0,onChange:v=>u(v)})});case"border":return(0,n.jsx)(Ft,{icon:f,label:p,modified:s,children:(0,n.jsx)(zsd,{blockType:t,field:r})});default:return r.kind,null}}function zsd({blockType:t,field:r}){const{t:a}=Ze("inspector"),o=F.useThemeField(t,r.section,"borderColor"),s=F.useThemeField(t,r.section,"borderTop"),u=F.useThemeField(t,r.section,"borderBottom"),d=F.useThemeField(t,r.section,"borderLeft"),c=F.useThemeField(t,r.section,"borderRight"),[_,h]=(0,y.useState)(!0),p=I3[t]?.[r.section],m=f=>{f.borderColor!==void 0&&o.set(f.borderColor),f.borderTop!==void 0&&s.set(f.borderTop),f.borderBottom!==void 0&&u.set(f.borderBottom),f.borderLeft!==void 0&&d.set(f.borderLeft),f.borderRight!==void 0&&c.set(f.borderRight)};return(0,n.jsx)(Vy,{label:a(r.labelKey),borderColor:o.value??p?.borderColor??null,borderTop:s.value??p?.borderTop??0,borderBottom:u.value??p?.borderBottom??0,borderLeft:d.value??p?.borderLeft??0,borderRight:c.value??p?.borderRight??0,onChange:m,sidesLinked:_,onSidesLinkedChange:h})}function jsd({blockType:t,spec:r,defaultExpanded:a=!1}){const{t:o}=Ze("inspector"),s=F.useThemeBlockOverride(t),u=mo(),d=Psd(s)>0,c=r.icon;return(0,n.jsxs)(A.Accordion,{defaultExpanded:a,disableGutters:!0,square:!0,sx:{boxShadow:"none",borderTop:_=>`1px solid ${_.palette.divider}`,"&:before":{display:"none"}},children:[(0,n.jsx)(A.AccordionSummary,{expandIcon:u?void 0:(0,n.jsx)(ee.ExpandMoreOutlined,{}),sx:{px:0,minHeight:u?40:48,justifyContent:u?"center":void 0,"& .MuiAccordionSummary-content":{my:u?.5:1,justifyContent:u?"center":void 0}},children:u?(0,n.jsx)(A.Tooltip,{title:o(r.titleKey),placement:"left",children:(0,n.jsxs)(A.Box,{sx:{position:"relative",display:"flex",alignItems:"center",p:.5,borderRadius:2,color:"text.secondary"},children:[(0,n.jsx)(c,{fontSize:"small"}),d&&(0,n.jsx)(A.Box,{component:"span","aria-label":o("theme.modified","Modified"),sx:{position:"absolute",top:2,right:2,width:6,height:6,borderRadius:"50%",bgcolor:"primary.main"}})]})}):(0,n.jsx)(A.Stack,{direction:"row",spacing:1,sx:{width:"100%",alignItems:"center"},children:(0,n.jsxs)(A.Box,{sx:{position:"relative",display:"inline-flex"},children:[(0,n.jsx)(A.Typography,{sx:{fontWeight:600,color:"text.primary"},children:o(r.titleKey)}),d&&(0,n.jsx)(A.Box,{component:"span","aria-label":o("theme.modified","Modified"),sx:{position:"absolute",top:-1,right:-8,width:6,height:6,borderRadius:"50%",bgcolor:"primary.main"}})]})})}),(0,n.jsx)(A.AccordionDetails,{sx:{p:0,pb:3},children:(0,n.jsx)(A.Stack,{spacing:2,children:r.fields.map(_=>(0,n.jsx)(Rsd,{blockType:t,field:_},`${_.section}.${_.key}`))})})]})}function Psd(t){return t?(t.style?Object.keys(t.style).length:0)+(t.props?Object.keys(t.props).length:0):0}function Hsd({defaultExpanded:t=!0}){const{t:r}=Ze("inspector"),a=$4r("root"),o=mo();if(!a||a.type!=="EmailLayout")return null;const{data:s}=a;return(0,n.jsxs)(A.Accordion,{defaultExpanded:t,disableGutters:!0,square:!0,sx:{boxShadow:"none",borderTop:u=>`1px solid ${u.palette.divider}`,"&:before":{display:"none"}},children:[(0,n.jsx)(A.AccordionSummary,{expandIcon:o?void 0:(0,n.jsx)(ee.ExpandMoreOutlined,{}),sx:{px:0,minHeight:o?40:48,justifyContent:o?"center":void 0,"& .MuiAccordionSummary-content":{my:o?.5:1,justifyContent:o?"center":void 0}},children:o?(0,n.jsx)(A.Tooltip,{title:r("theme.blocks.root.title"),placement:"left",children:(0,n.jsx)(A.Box,{sx:{display:"flex",p:.5,borderRadius:2,color:"text.secondary"},children:(0,n.jsx)(ee.TuneOutlined,{fontSize:"small"})})}):(0,n.jsx)(A.Typography,{sx:{fontWeight:600,color:"text.primary"},children:r("theme.blocks.root.title")})}),(0,n.jsx)(A.AccordionDetails,{sx:{px:0,pt:0,pb:3},children:(0,n.jsx)(A.Stack,{spacing:2,children:(0,n.jsx)(r0r,{data:s,setData:u=>{F.clearAppliedTheme(),W_("root",()=>({type:"EmailLayout",data:u}))}})})})]})}async function Lsd(t){const r=await t.json().catch(()=>null);if(!t.ok)throw t.status===403&&r?.hint?new Error(r.hint):new Error(r?.error??`HTTP ${t.status}`);return r}async function a0r(t){return F.getComponentsStorageMode()==="local"?Ae.localSaveTheme(t):Lsd(await fetch(`${to()}/dev/save-theme`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}))}var N8=100,F8=280;function Esd({open:t,onClose:r,onSaved:a}){const{t:o}=Ze("inspector"),[s,u]=(0,y.useState)(""),[d,c]=(0,y.useState)(""),[_,h]=(0,y.useState)(!1),[p,m]=(0,y.useState)(null),f=s.trim(),v=f.length>0&&f.length<=N8&&d.length<=F8,S=(0,y.useCallback)(()=>{_||(u(""),c(""),m(null),r())},[_,r]),g=(0,y.useCallback)(async()=>{if(!(!v||_)){h(!0),m(null);try{const b=F.buildCurrentThemeBundlePayload(),T=await a0r({name:f,description:d.trim()||void 0,bundle:b});a?.(T.id),u(""),c(""),r()}catch(b){m(b instanceof Error?b.message:String(b))}finally{h(!1)}}},[v,_,f,d,r,a]);return(0,n.jsxs)(A.Dialog,{open:t,onClose:S,maxWidth:"sm",fullWidth:!0,children:[(0,n.jsx)(A.DialogTitle,{children:o("theme.save.title","Save current theme")}),(0,n.jsx)(A.DialogContent,{children:(0,n.jsxs)(A.Stack,{spacing:2,sx:{mt:1},children:[(0,n.jsx)(A.Typography,{variant:"body2",color:"text.secondary",children:o("theme.save.description","Snapshots the current root globals and per-block-type theme overrides. Saved themes can be reapplied later from the Components Library.")}),(0,n.jsx)(A.TextField,{label:o("theme.save.nameLabel","Name"),value:s,onChange:b=>u(b.target.value),placeholder:o("theme.save.namePlaceholder","e.g. Brand default"),autoFocus:!0,fullWidth:!0,disabled:_,slotProps:{htmlInput:{maxLength:N8}},helperText:`${f.length}/${N8}`}),(0,n.jsx)(A.TextField,{label:o("theme.save.descriptionLabel","Description (optional)"),value:d,onChange:b=>c(b.target.value),fullWidth:!0,multiline:!0,minRows:2,disabled:_,slotProps:{htmlInput:{maxLength:F8}},helperText:`${d.length}/${F8}`}),p&&(0,n.jsx)(A.Alert,{severity:"error",children:p})]})}),(0,n.jsxs)(A.DialogActions,{children:[(0,n.jsx)(A.Button,{onClick:S,disabled:_,children:o("theme.save.cancel","Cancel")}),(0,n.jsx)(A.Button,{onClick:g,variant:"contained",disabled:!v||_,children:_?o("theme.save.submitting","Saving…"):o("theme.save.submit","Save")})]})]})}function Vsd(){const{t}=Ze("inspector"),r=F.useShowVersion(),a=F.useComponentsLibraryEnabled(),o=F.useTemplateSaving(),s=F.useThemeSaving(),u=mo(),[d,c]=(0,y.useState)(!1),[_,h]=(0,y.useState)(!1);return(0,n.jsxs)(A.Container,{sx:{padding:"0!important",paddingTop:"1rem!important",display:"flex",flexDirection:"column",flex:"1 0 auto",minHeight:"100%"},children:[!u&&(0,n.jsxs)(A.Stack,{direction:"row",sx:{mb:2,flexWrap:"wrap",gap:1,alignItems:"center",justifyContent:"space-between"},children:[(0,n.jsx)(A.Typography,{sx:{fontWeight:"bold",color:"text.primary",fontSize:"1.25rem"},children:t("styles.rootTitle")}),a&&(0,n.jsxs)(A.Stack,{direction:"row",spacing:.5,sx:{width:"100%",ml:"0!important"},children:[s&&(0,n.jsx)(A.Tooltip,{title:t("theme.exportTooltip","Save current theme to the gallery"),children:(0,n.jsx)(A.Button,{size:"small",variant:"outlined",startIcon:(0,n.jsx)(ee.BookmarkAddOutlined,{fontSize:"small"}),onClick:()=>c(!0),children:t("theme.exportButton","Theme")})}),o&&(0,n.jsx)(A.Tooltip,{title:t("componentsLibrary.saveTemplate.tooltip","Save the current document as a reusable template"),children:(0,n.jsx)(A.Button,{size:"small",variant:"outlined",startIcon:(0,n.jsx)(ee.FileDownloadOutlined,{fontSize:"small"}),onClick:()=>h(!0),children:t("componentsLibrary.saveTemplate.button","Template")})})]})]}),(0,n.jsxs)(A.Box,{children:[(0,n.jsx)(Hsd,{defaultExpanded:!0}),Dld.map(p=>(0,n.jsx)(jsd,{blockType:p,spec:X4r[p],defaultExpanded:!1},p))]}),r&&(0,n.jsx)(A.Box,{color:"text.secondary",sx:{display:"flex",justifyContent:"flex-end",mt:"auto",pt:3,pb:3},children:u?(0,n.jsxs)(A.Link,{href:`https://www.npmjs.com/package/${t4.name}`,target:"_blank",rel:"noopener noreferrer",sx:{fontSize:"0.75rem"},children:["v",t4.version]}):(0,n.jsxs)(A.Box,{sx:{textAlign:"right"},children:[(0,n.jsxs)(A.Typography,{variant:"body2",children:[t("inputs.panels.emailLayout.version"),": ",t4.version]}),(0,n.jsx)(A.Link,{href:`https://www.npmjs.com/package/${t4.name}`,target:"_blank",rel:"noopener noreferrer",sx:{fontSize:"0.875rem",mt:.5,display:"inline-block"},children:t4.name})]})}),(0,n.jsx)(Esd,{open:d,onClose:()=>c(!1)}),(0,n.jsx)(Pid,{open:_,onClose:()=>h(!1)})]})}function ksd(){const t=F.useSelectedBlockId(),r=$4r(t??"root"),a=(0,y.useCallback)(u=>{t&&W_(t,()=>u)},[t]);if(!r)return null;const{data:o,type:s}=r;switch(s){case"Container":return(0,n.jsx)(e0r,{data:o,setData:u=>a({type:s,data:u})},t);case"Divider":return(0,n.jsx)(t0r,{data:o,setData:u=>a({type:s,data:u})},t);case"Spacer":return(0,n.jsx)(n0r,{data:o,setData:u=>a({type:s,data:u})},t);case"EmailLayout":return(0,n.jsx)(Vsd,{});default:return(0,n.jsx)("pre",{children:JSON.stringify(r,null," ")})}}function Dsd({sticky:t,heightContent:r}){const a=F.useSelectedSidebarTab(),o=F.useBlockTypeSelected(),s=F.useSelectedBlockId(),u=F.useSelectedScreenSize(),d=F.useInspectorDrawerMode(),c=(0,A.useTheme)(),{t:_}=Ze("inspector");(0,y.useEffect)(()=>{const g=b=>{const T=b.target;F.setWindowWidth(T.innerWidth)};return window&&F.setWindowWidth(window.innerWidth),window.addEventListener("resize",g),()=>{window.removeEventListener("resize",g)}},[a]);const h=()=>{const g={position:"absolute",top:"1rem",right:"0.5rem",color:"primary.main",fontSize:"20px",cursor:"pointer",display:S?"none":void 0},b=()=>F.setSelectedScreenSize(u==="desktop"?"mobile":"desktop");return a==="block-configuration"||a==="css"||S&&s&&!F.BLOCKS_DEFAULT_CSS.includes(o||"")?(0,n.jsxs)("div",{style:{position:"relative",display:"flex",flexDirection:"column",flex:"1 0 auto"},children:[u==="desktop"?(0,n.jsx)(ee.MonitorOutlined,{sx:g,onClick:b}):(0,n.jsx)(ee.PhoneIphoneOutlined,{sx:g,onClick:b}),(0,n.jsx)(isd,{})]}):(0,n.jsxs)("div",{style:{position:"relative",display:"flex",flexDirection:"column",flex:"1 0 auto"},children:[(0,n.jsx)(ksd,{}),u==="desktop"?(0,n.jsx)(ee.MonitorOutlined,{sx:g,onClick:b}):(0,n.jsx)(ee.PhoneIphoneOutlined,{sx:g,onClick:b})]})},p=()=>(0,n.jsx)("svg",{style:{marginRight:"4px",color:"inherit"},width:"21",height:"20",viewBox:"0 0 21 20",fill:"none",children:(0,n.jsx)("path",{d:"M3.83398 5H17.1673M3.83398 10H17.1673M3.83398 15H9.66732",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),m=()=>(0,n.jsx)("svg",{style:{marginRight:"4px",color:"inherit"},width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:(0,n.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,b)=>{F.setSidebarTab(b)},v=t?r?`calc(${r} - 4px)`:void 0:r??void 0,S=d==="compact";return(0,n.jsx)(H2d,{value:S,children:(0,n.jsxs)(A.Container,{sx:g=>({width:S?56:385,padding:"0!important",margin:"0!important",height:v,maxHeight:v,display:"flex",flexDirection:"column",overflow:"hidden",position:t?"sticky":"static",top:t?F.HEADER_HEIGHT:0,backgroundColor:`${g.palette.background.paper} !important`}),children:[(0,n.jsx)(A.Box,{sx:{position:"sticky",top:0,zIndex:1,backgroundColor:`${c.palette.background.paper} !important`,display:S?"none":void 0},children:(0,n.jsxs)(A.Tabs,{sx:{backgroundColor:`${c.palette.background.paper} !important`},value:a,onChange:f,children:[s!=null&&!F.BLOCKS_DEFAULT_CSS.includes(o||"")&&[(0,n.jsx)(A.Tab,{sx:{height:"50px",minHeight:"50px",fontWeight:"bold"},value:"block-configuration",label:_("header.content"),icon:(0,n.jsx)(p,{}),iconPosition:"start"},"block-configuration"),(0,n.jsx)(A.Tab,{sx:{height:"50px",minHeight:"50px",fontWeight:"bold"},value:"css",label:_("header.styles"),icon:(0,n.jsx)(m,{}),iconPosition:"start"},"css")],s!=null&&F.BLOCKS_DEFAULT_CSS.includes(o)&&[(0,n.jsx)(A.Tab,{sx:{height:"50px",minHeight:"50px",fontWeight:"bold"},value:"styles",label:_("header.styles"),icon:(0,n.jsx)(m,{}),iconPosition:"start"},"styles")],s==null&&(0,n.jsx)(A.Tab,{sx:{height:"50px",minHeight:"50px",fontWeight:"bold"},value:"styles",label:_("header.styles"),icon:(0,n.jsx)(m,{}),iconPosition:"start"},"styles")]})}),(0,n.jsx)(A.Container,{sx:g=>({flex:"1 1 auto",minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column",px:S?"0.5rem!important":"1rem!important",backgroundColor:`${g.palette.background.paper} !important`}),children:h()})]})})}var o0r=({children:t,topOffset:r=0,zIndex:a=10,className:o="",style:s={},disabled:u=!1,threshold:d=null,...c})=>{const[_,h]=(0,y.useState)(!1),[p,m]=(0,y.useState)({width:0,height:0}),[f,v]=(0,y.useState)({left:0}),[S,g]=(0,y.useState)(0),[b,T]=(0,y.useState)(!1),M=(0,y.useRef)(null),O=(0,y.useRef)(null),x=(0,y.useRef)(null);(0,y.useEffect)(()=>{if(u){h(!1),T(!1),g(0);return}const j=O.current,P=M.current;if(!j||!P)return;let H=null;d&&(d.startsWith("#")?H=document.getElementById(d.slice(1)):(d.startsWith("."),H=document.querySelector(d)));const L=()=>{const D=P.getBoundingClientRect();m({width:D.width,height:D.height}),v({left:D.left})},E=()=>{if(!H||!P)return{offset:0,isPushed:!1};const D=H.getBoundingClientRect(),N=P.getBoundingClientRect(),I=r+N.height;if(D.top<I){const B=I-D.top,q=N.height+20;return{offset:-Math.min(B,q),isPushed:!0}}return{offset:0,isPushed:!1}},z=new IntersectionObserver(([D])=>{const N=!D.isIntersecting;if(N&&!_&&L(),h(N),N&&d){const{offset:I,isPushed:B}=E();g(I),T(B)}else N||(g(0),T(!1))},{threshold:0,rootMargin:`-${r}px 0px 0px 0px`}),V=new ResizeObserver(()=>{L()}),k=()=>{if(d&&_){const{offset:D,isPushed:N}=E();g(D),T(N)}};return z.observe(j),V.observe(P),d&&window.addEventListener("scroll",k,{passive:!0}),L(),()=>{z.disconnect(),V.disconnect(),d&&window.removeEventListener("scroll",k)}},[r,_,u,d]);const w=!u&&_,R=w?`${r+S}px`:"auto";return(0,n.jsxs)("div",{ref:x,className:o,...c,children:[!u&&(0,n.jsx)("div",{ref:O,style:{height:"1px",position:"absolute",top:`-${r+1}px`,left:0,right:0,pointerEvents:"none"}}),w&&(0,n.jsx)("div",{style:{height:`${p.height}px`,width:`${p.width}px`}}),(0,n.jsx)("div",{ref:M,style:{position:w?"fixed":"static",top:R,width:"auto",height:"auto",zIndex:w?a:"auto",transition:b?"none":"box-shadow 0.2s ease-in-out, top 0.3s ease-out",...b&&S<-p.height*.3&&{opacity:Math.max(0,1+(S+p.height*.3)/(p.height*.7))},...s},children:t})]})};jO();function Nsd(){const t=F.useInspectorDrawerOpen(),r=F.useInspectorDrawerMode(),{t:a}=Ze("inspector");if(!t)return null;const o=()=>F.setInspectorDrawerMode(r==="full"?"compact":"full"),s=r==="compact";return(0,n.jsx)(A.Box,{sx:{position:"absolute",left:0,top:"50%",transform:"translateX(-100%) translateY(-50%)",zIndex:10},children:(0,n.jsx)(A.Tooltip,{title:s?a("inspector.handle.expand","Expand panel"):a("inspector.handle.compact","Compact panel"),placement:"left",children:(0,n.jsx)(A.ButtonBase,{onClick:o,sx:u=>({width:24,minHeight:80,borderTopLeftRadius:8,borderBottomLeftRadius:8,backgroundColor:s?u.palette.primary.main:u.palette.background.paper,color:s?u.palette.primary.contrastText:u.palette.text.secondary,border:`1px solid ${u.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:s?u.palette.primary.dark:u.palette.mode==="dark"?u.palette.grey[800]:u.palette.grey[200]}}),children:(0,n.jsx)(jv,{sx:{fontSize:16}})})})})}var fJ=t=>Symbol.iterator in t,vJ=t=>"entries"in t,SJ=(t,r)=>{const a=t instanceof Map?t:new Map(t.entries()),o=r instanceof Map?r:new Map(r.entries());if(a.size!==o.size)return!1;for(const[s,u]of a)if(!o.has(s)||!Object.is(u,o.get(s)))return!1;return!0},Fsd=(t,r)=>{const a=t[Symbol.iterator](),o=r[Symbol.iterator]();let s=a.next(),u=o.next();for(;!s.done&&!u.done;){if(!Object.is(s.value,u.value))return!1;s=a.next(),u=o.next()}return!!s.done&&!!u.done};function Isd(t,r){return Object.is(t,r)?!0:typeof t!="object"||t===null||typeof r!="object"||r===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(r)?!1:fJ(t)&&fJ(r)?vJ(t)&&vJ(r)?SJ(t,r):Fsd(t,r):SJ({entries:()=>Object.entries(t)},{entries:()=>Object.entries(r)})}function Bsd(t){const r=y.default.useRef(void 0);return a=>{const o=t(a);return Isd(r.current,o)?r.current:r.current=o}}function uA({children:t}){const r=F.useSelectedScreenSize(),a=F.useDisableEdition(),o=F.useImageUploading();return(0,n.jsx)(Ae.ViewportProvider,{value:r,children:(0,n.jsx)(Ae.RootDataProvider,{value:F.useRoot()??null,children:(0,n.jsx)(Ae.DisableEditionProvider,{value:a,children:(0,n.jsx)(Ae.ImageUploadingProvider,{value:o,children:(0,n.jsx)(Ae.ImageAutoWidthProvider,{value:Jsd,children:t})})})})})}function Jsd(t,r){F.updateBlockProps(t,{...F.editorStateStore.getState().document[t]?.data?.props??{},width:r})}function Usd(t){return typeof ReadableStream<"u"&&t instanceof ReadableStream?(async function*(){const r=t.getReader(),a=new TextDecoder;try{for(;;){const{value:o,done:s}=await r.read();if(s){const u=a.decode();u&&(yield u);return}o!==void 0&&(typeof o=="string"?yield o:yield a.decode(o,{stream:!0}))}}finally{r.releaseLock()}})():t}function*gJ(t){const r=t.split(`
421
+ </html>`,v2d=Ae.ALL_GOOGLE_FONTS_HREF;function S2d(t,r){const a=t.head;if(a.querySelector("link[data-eb-fonts]")===null){const o=t.createElement("link");o.setAttribute("data-eb-fonts","1"),o.rel="stylesheet",o.href=v2d,a.appendChild(o)}if(a.querySelector("style[data-eb-globals]")===null){const o=t.createElement("style");o.setAttribute("data-eb-globals","1"),o.textContent=Ae.globalsStyles,a.appendChild(o)}t.documentElement.style.overflow="hidden",t.body.style.overflow="hidden",t.body.style.backgroundColor=r}function g2d(){const t=(0,A.useTheme)(),{t:r}=Ze("inspector"),a=i2d(),o=(0,y.useRef)(null),s=(0,y.useRef)(null),[u,d]=(0,y.useState)(null),[c,_]=(0,y.useState)(null),[h,p]=(0,y.useState)("root"),[m,f]=(0,y.useState)(!1),[v,S]=(0,y.useState)(null),[g,b]=(0,y.useState)(null),[T,M]=(0,y.useState)(!1),[O,x]=(0,y.useState)("desktop"),[w,R]=(0,y.useState)(()=>typeof window<"u"?window.innerHeight:800),j=(0,y.useRef)(null),P=(0,y.useCallback)(()=>{const te=o.current;if(te===null)return;const $=te.contentDocument;$!==null&&(S2d($,(F.editorStateStore.getState().document.root?.data??{}).backdropColor??Ly),d($.body))},[]);(0,y.useEffect)(()=>{const te=()=>R(window.innerHeight);return window.addEventListener("resize",te),()=>window.removeEventListener("resize",te)},[]),(0,y.useEffect)(()=>{if(a===null)return;const te=`${a.category}|${a.axis}|${a.id}`;j.current=te,S(null),M(!1),x("desktop");let $=!1;m2d(a).then(W=>{j.current===te&&($=!0,(0,y.startTransition)(()=>{_(W.doc),p(W.rootBlockId)}),f(!1))}).catch(W=>{j.current===te&&($=!0,S(W instanceof Error?W.message:String(W)),f(!1))}),Promise.resolve().then(()=>{!$&&j.current===te&&f(!0)})},[a]),(0,y.useEffect)(()=>{if(u===null||a===null)return;const te=(F.editorStateStore.getState().document.root?.data??{}).backdropColor??Ly;u.style.backgroundColor=te},[u,a]),(0,y.useEffect)(()=>{if(u===null)return;const te=()=>{const W=u.firstElementChild,_e=W!==null&&W.offsetHeight>0?W.offsetHeight:u.scrollHeight;b(_e)};te();const $=new ResizeObserver(te);return $.observe(u),()=>$.disconnect()},[u,c]);const H=a?.category==="template",L=H?d2d:u2d,E=H?Math.round(w*h2d):c2d,z=O==="mobile"?s2d:l2d,V=g??E,k=L/z,D=T?k:Math.min(k,E/V),N=z*D,I=V*D,B=Math.max(_2d,Math.min(I,E));(0,y.useEffect)(()=>{s.current&&(s.current.scrollTop=0)},[T,O,a]);const q=(0,y.useMemo)(()=>c===null?null:(0,n.jsx)(Ae.Reader,{document:c,rootBlockId:h,viewport:O}),[c,h,O]);return(0,n.jsx)(A.Popper,{open:a!==null,anchorEl:a?.anchor??null,placement:"right-start",keepMounted:!0,modifiers:[{name:"offset",options:{offset:[0,8]}},{name:"flip",enabled:!1},{name:"preventOverflow",options:{boundary:"viewport",padding:8,altAxis:!0}}],sx:{zIndex:t.zIndex.tooltip+1,pointerEvents:a!==null?"auto":"none",visibility:a!==null?"visible":"hidden"},children:(0,n.jsxs)(A.Paper,{elevation:6,onMouseEnter:o2d,onMouseLeave:E4r,sx:{width:L+24,padding:1.5,display:"flex",flexDirection:"column",gap:1,backgroundColor:t.palette.background.paper,border:`1px solid ${t.palette.divider}`},children:[(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:.5},children:[(0,n.jsx)(A.Typography,{variant:"caption",color:"text.secondary",sx:{fontWeight:600,flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a?.name??""}),(0,n.jsx)(A.Tooltip,{title:O==="mobile"?r("componentsLibrary.preview.desktop","Desktop view"):r("componentsLibrary.preview.mobile","Mobile view"),children:(0,n.jsx)(A.IconButton,{size:"small",onClick:()=>x(te=>te==="mobile"?"desktop":"mobile"),sx:{flexShrink:0},children:O==="mobile"?(0,n.jsx)(kO,{fontSize:"small"}):(0,n.jsx)(zv,{fontSize:"small"})})}),(0,n.jsx)(A.Tooltip,{title:T?r("componentsLibrary.preview.fit","Fit to view"):r("componentsLibrary.preview.zoom","Zoom in"),children:(0,n.jsx)(A.IconButton,{size:"small",onClick:()=>M(te=>!te),sx:{flexShrink:0},children:T?(0,n.jsx)(XO,{fontSize:"small"}):(0,n.jsx)(ZO,{fontSize:"small"})})})]}),(0,n.jsxs)(A.Box,{ref:s,sx:{position:"relative",width:L,height:B,mx:"auto",display:"flex",justifyContent:"center",alignItems:"flex-start",backgroundColor:t.palette.action.hover,borderRadius:1,overflowY:T?"auto":"hidden",overflowX:"hidden"},children:[(0,n.jsx)(A.Box,{sx:{position:"relative",width:N,height:I,flexShrink:0},children:(0,n.jsx)("iframe",{ref:o,srcDoc:f2d,title:r("componentsLibrary.preview.iframeTitle","Live preview"),sandbox:"allow-same-origin",onLoad:P,style:{position:"absolute",top:0,left:0,width:z,height:V,border:0,display:"block",backgroundColor:"transparent",transform:`scale(${D})`,transformOrigin:"top left",pointerEvents:"none"}})}),u!==null&&q!==null&&v===null&&(0,E2.createPortal)(q,u),m&&(0,n.jsx)(A.Box,{sx:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(255,255,255,0.6)"},children:(0,n.jsx)(A.CircularProgress,{size:24})}),v!==null&&(0,n.jsx)(A.Box,{sx:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",p:2,backgroundColor:t.palette.background.paper},children:(0,n.jsx)(A.Typography,{variant:"body2",color:"error",sx:{textAlign:"center"},children:v})})]})]})})}var b2d=["updatedDesc","createdDesc","nameAsc","nameDesc","sizeDesc","sizeAsc","blocksDesc","blocksAsc"];function T2d(t,r){const a=r.search.trim().toLowerCase();return t.filter(o=>{if(r.axes.length>0&&!r.axes.includes(o.axis))return!1;if(r.tags.length>0){const s=o.tags??[];if(!r.tags.every(u=>s.includes(u)))return!1}return!(a.length>0&&![o.name,o.description??"",o.axis,...o.tags??[]].join(" ").toLowerCase().includes(a))})}function y2d(t,r){const a=[...t],o=(s,u)=>s.name.localeCompare(u.name);switch(r){case"nameAsc":return a.sort(o);case"nameDesc":return a.sort((s,u)=>o(u,s));case"createdDesc":return a.sort((s,u)=>s.createdAt<u.createdAt?1:s.createdAt>u.createdAt?-1:0);case"sizeAsc":return a.sort((s,u)=>s.sizeBytes-u.sizeBytes);case"sizeDesc":return a.sort((s,u)=>u.sizeBytes-s.sizeBytes);case"blocksAsc":return a.sort((s,u)=>s.blockCount-u.blockCount);case"blocksDesc":return a.sort((s,u)=>u.blockCount-s.blockCount);default:return a.sort((s,u)=>s.updatedAt<u.updatedAt?1:s.updatedAt>u.updatedAt?-1:0)}}function C2d({columns:t=2,count:r=4,thumbnailHeight:a=120}){return(0,n.jsx)(A.Box,{sx:{display:"grid",gridTemplateColumns:`repeat(${t}, minmax(0, 1fr))`,gap:.5,pt:.5},"aria-busy":"true","aria-live":"polite",children:Array.from({length:r}).map((o,s)=>(0,n.jsxs)(A.Stack,{spacing:.75,sx:{p:.5},children:[(0,n.jsx)(A.Skeleton,{variant:"rounded",animation:"wave",height:a,sx:{borderRadius:1}}),(0,n.jsx)(A.Skeleton,{variant:"text",animation:"wave",width:"70%"}),(0,n.jsx)(A.Skeleton,{variant:"text",animation:"wave",width:"45%"})]},s))})}X7t();function M2d({src:t,alt:r,height:a=120,placeholderText:o}){const s=(0,A.useTheme)(),u={width:"100%",height:a,borderRadius:4,backgroundColor:s.palette.background.default,display:"block"};return t===null?(0,n.jsxs)(A.Box,{sx:{...u,border:`1px dashed ${s.palette.divider}`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.5,color:"text.secondary"},"aria-label":r,children:[(0,n.jsx)(BO,{sx:{fontSize:24,opacity:.6}}),o!==void 0&&(0,n.jsx)(A.Typography,{variant:"caption",sx:{opacity:.7},children:o})]}):(0,n.jsx)("img",{src:t,alt:r,loading:"lazy",decoding:"async",style:{...u,objectFit:"cover",objectPosition:"top center",border:`1px solid ${s.palette.divider}`},onError:d=>{const c=d.currentTarget;c.style.display="none"}})}var x2d={section:"sections",layout:"layouts",template:"templates"};function O2d(t,r,a){const o=to(),s=x2d[t];if(t==="template")return`${o}/dev/${s}/${encodeURIComponent(a)}/thumbnail`;if(r===null)throw new Error(`category '${t}' requires an axis but received null`);return`${o}/dev/${s}/${encodeURIComponent(r)}/${encodeURIComponent(a)}/thumbnail`}var V0="__other__",w2d=[{key:"blocks",labelKey:"componentsLibrary.drawer.category.blocks",enabled:!0},{key:"sections",labelKey:"componentsLibrary.drawer.category.sections",enabled:!0},{key:"templates",labelKey:"componentsLibrary.drawer.category.templates",enabled:!0}];function nJ({item:t,category:r,onClick:a}){const{t:o}=Ze("inspector"),s=(0,A.useTheme)(),u=r!=="template",[{isDragging:d},c]=a5(()=>({type:ji,item:()=>({kind:ji,category:r,axis:t.axis,id:t.id}),canDrag:()=>u,collect:m=>({isDragging:m.isDragging()})}),[r,t.axis,t.id,u]);(0,y.useEffect)(()=>{d&&V4r()},[d]);const _=r==="section"||r==="layout"||r==="template",h=r==="primitive"&&t.block!==void 0,p=_&&t.hasThumbnail?F.getComponentsStorageMode()==="local"?Ae.getLocalThumbnail(t.id):O2d(r,r==="template"?null:t.axis,t.id):null;return(0,n.jsxs)(A.Box,{ref:m=>{u&&m&&c(m)},onMouseEnter:m=>a2d({anchor:m.currentTarget,category:r,axis:t.axis,id:t.id,name:t.name,primitiveBlock:r==="primitive"?t.block:void 0}),onMouseLeave:E4r,onClick:a?()=>a(t):void 0,sx:{p:1,borderRadius:1,border:"1px dashed",borderColor:s.palette.divider,cursor:a?"pointer":"grab",opacity:d?.5:1,display:"flex",flexDirection:"column",gap:.75,transition:"background-color 120ms ease, border-color 120ms ease","&:hover":{backgroundColor:s.palette.action.hover,borderColor:s.palette.secondary.main},"&:active":{cursor:"grabbing"}},children:[h&&(0,n.jsx)(L4r,{id:t.id,block:t.block,alt:t.name}),_&&(0,n.jsx)(M2d,{src:p,alt:t.name,placeholderText:o("componentsLibrary.thumbnail.placeholder","No preview")}),(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:.75},children:[(0,n.jsx)(Pv,{sx:{fontSize:16,color:"text.secondary",flexShrink:0,display:u?"inline-flex":"none"}}),(0,n.jsx)(A.Box,{sx:{minWidth:0,flex:1},children:(0,n.jsx)(A.Typography,{variant:"body2",sx:{fontSize:"0.8rem",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:t.name,children:t.name})})]})]})}var L8=24;function A2d({items:t,columns:r,renderItem:a}){const[o,s]=(0,y.useState)(L8),u=(0,y.useRef)(null);return(0,y.useEffect)(()=>{s(L8)},[t]),(0,y.useEffect)(()=>{const d=u.current;if(!d)return;const c=new IntersectionObserver(_=>{_[0]?.isIntersecting&&s(h=>h<t.length?Math.min(t.length,h+L8):h)},{rootMargin:"300px"});return c.observe(d),()=>c.disconnect()},[t.length,o]),(0,n.jsxs)(A.Box,{sx:{mt:1.5},children:[(0,n.jsx)(A.Box,{sx:{display:"grid",gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`,gap:.5},children:t.slice(0,o).map(d=>a(d))}),o<t.length&&(0,n.jsx)(A.Box,{ref:u,sx:{height:1}})]})}function k4r({items:t,category:r,loading:a,error:o,groupLabelKey:s,columns:u,virtualize:d,search:c,sort:_,onClick:h,onRename:p,onDelete:m}){const{t:f}=Ze("inspector"),[v]=(0,y.useState)([]),[S,g]=(0,y.useState)({}),b=(0,y.useMemo)(()=>({search:c,axes:[],tags:v,sort:_}),[c,v,_]),T=(0,y.useMemo)(()=>y2d(T2d(t,b),_),[t,b,_]),M=(0,y.useMemo)(()=>{const j=new Map;for(const P of T){const H=j.get(P.axis)??[];H.push(P),j.set(P.axis,H)}return Array.from(j.keys()).sort((P,H)=>P===V0?1:H===V0?-1:P.localeCompare(H)).map(P=>({axis:P,items:j.get(P)??[]}))},[T]),O=M.length===0||M.length===1&&M[0].axis==="",x=j=>j===V0?f("componentsLibrary.drawer.usageOther","Other"):s?f(`${s}.${j}`,j):j,w=(j,P)=>d?(0,n.jsx)(A2d,{items:j,columns:u??2,renderItem:H=>(0,n.jsx)(nJ,{item:H,category:r,onClick:h,onRename:p,onDelete:m},H.id)}):(0,n.jsx)(A.Box,{sx:{display:"grid",gridTemplateColumns:u?`repeat(${u}, minmax(0, 1fr))`:"1fr",gap:.5},children:j.map(H=>(0,n.jsx)(nJ,{item:H,category:r,onClick:h,onRename:p,onDelete:m},`${P}/${H.id}`))}),R=()=>o?(0,n.jsx)(A.Alert,{severity:"error",sx:{mt:1},children:o}):a&&t.length===0?(0,n.jsx)(C2d,{columns:u??2,count:4}):!a&&t.length===0?(0,n.jsx)(kid,{icon:(0,n.jsx)(UO,{}),title:f("componentsLibrary.drawer.emptyTitle","Your library is empty"),description:f("componentsLibrary.drawer.empty")}):(0,n.jsx)(A.Stack,{spacing:1,sx:{pt:.5},children:T.length===0?(0,n.jsx)(A.Typography,{variant:"body2",color:"text.secondary",sx:{mt:1},children:f("componentsLibrary.drawer.noResults","No components match your search.")}):O?w(T,"flat"):(0,n.jsx)(A.Box,{children:M.map((j,P)=>(0,n.jsx)(Xid,{title:x(j.axis),count:j.items.length,expanded:S[j.axis]??P===0,onToggle:H=>g(L=>({...L,[j.axis]:H})),children:w(j.items,j.axis)},j.axis))})});return(0,n.jsx)(n.Fragment,{children:R()})}async function D4r(t,r){const a=await fetch(t);if(!a.ok){const o=await a.json().catch(()=>null);throw a.status===403?new Error(o?.hint??"Endpoint disabled in this environment."):new Error(o?.error??`HTTP ${a.status}`)}return(await a.json())[r]??[]}function R2d({refreshKey:t,search:r,sort:a,onRename:o,onChange:s}){const{t:u}=Ze("inspector"),[d,c]=(0,y.useState)([]),[_,h]=(0,y.useState)(!1),[p,m]=(0,y.useState)(null),f=(0,y.useCallback)(async()=>{h(!0),m(null);try{if(F.getComponentsStorageMode()==="local"){c(Ae.localListSavedComponents("section"));return}const v=await D4r(`${to()}/dev/sections`,"sections");c(v.map(S=>({...S,axis:S.role})))}catch(v){m(v instanceof Error?v.message:String(v))}finally{h(!1)}},[]);return(0,y.useEffect)(()=>{f()},[f,t]),(0,n.jsx)(k4r,{items:d,category:"section",loading:_,error:p,columns:2,groupLabelKey:"componentsLibrary.sectionRole",search:r,sort:a,onRename:v=>o({category:"section",axis:v.axis,id:v.id,name:v.name,description:v.description,tags:v.tags}),onDelete:(0,y.useCallback)(async v=>{if(window.confirm(u("componentsLibrary.drawer.deleteConfirm",'Delete component "{{name}}"? This cannot be undone.',{name:v.name})))try{if(F.getComponentsStorageMode()==="local")Ae.localDeleteSavedComponent("section",v.id);else{const S=await fetch(`${to()}/dev/sections/${encodeURIComponent(v.axis)}/${encodeURIComponent(v.id)}`,{method:"DELETE"});if(!S.ok){const g=await S.json().catch(()=>null);throw new Error(g?.error??`HTTP ${S.status}`)}}c(S=>S.filter(g=>!(g.axis===v.axis&&g.id===v.id))),s()}catch(S){m(S instanceof Error?S.message:String(S))}},[u,s])})}function z2d({refreshKey:t,search:r,sort:a,onRename:o,onChange:s}){const[u,d]=(0,y.useState)([]),[c,_]=(0,y.useState)(!1),[h,p]=(0,y.useState)(null),[m,f]=(0,y.useState)(null),{t:v}=Ze("inspector"),S=(0,y.useCallback)(async()=>{_(!0),p(null);try{if(F.getComponentsStorageMode()==="local"){d(Ae.localListTemplates().map(b=>({...b,axis:V0})));return}const g=await D4r(`${to()}/dev/templates`,"templates");d(g.map(b=>({...b,axis:b.usage||V0})))}catch(g){p(g instanceof Error?g.message:String(g))}finally{_(!1)}},[]);return(0,y.useEffect)(()=>{S()},[S,t]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(k4r,{items:u,category:"template",loading:c,error:h,columns:2,virtualize:!0,search:r,sort:a,onClick:f,onRename:g=>o({category:"template",axis:"",id:g.id,name:g.name,description:g.description,tags:g.tags}),onDelete:(0,y.useCallback)(async g=>{if(window.confirm(v("componentsLibrary.drawer.deleteConfirm","Delete?",{name:g.name})))try{if(F.getComponentsStorageMode()==="local")Ae.localDeleteTemplate(g.id);else{const b=await fetch(`${to()}/dev/templates/${encodeURIComponent(g.id)}`,{method:"DELETE"});if(!b.ok){const T=await b.json().catch(()=>null);throw new Error(T?.error??`HTTP ${b.status}`)}}d(b=>b.filter(T=>T.id!==g.id)),s()}catch(b){p(b instanceof Error?b.message:String(b))}},[v,s])}),(0,n.jsx)(Vid,{templateId:m?.id??null,templateName:m?.name??"",onClose:()=>f(null),onApplied:()=>f(null)})]})}function j2d(){const t=F.useComponentsLibraryDrawerOpen(),r=t?380:64,a=F.useComponentsLibraryEnabled(),o=F.useSelectedMainTab(),s=F.useTemplateSaving(),u=F.useComponentsLibraryRefreshNonce(),{t:d}=Ze("inspector"),c=(0,A.useTheme)(),_=(0,y.useMemo)(()=>w2d.filter(L=>!(!s&&L.key==="templates")),[s]),[h,p]=(0,y.useState)(0),[m,f]=(0,y.useState)(0),[v,S]=(0,y.useState)(null),[g,b]=(0,y.useState)(""),[T,M]=(0,y.useState)("updatedDesc"),[O,x]=(0,y.useState)(null),[w,R]=(0,y.useState)(()=>_[0]?.key??"blocks");(0,y.useEffect)(()=>{_.some(L=>L.key===w)||R(_[0]?.key??"blocks")},[_,w]),(0,y.useEffect)(()=>{u!==0&&(p(L=>L+1),f(L=>L+1),rJ())},[u]);const j=()=>{V4r(),F.setComponentsLibraryDrawerOpen(!1)},P=()=>{p(L=>L+1),f(L=>L+1),rJ()},H=(0,y.useCallback)(L=>{switch(L){case"section":p(E=>E+1);break;case"template":f(E=>E+1);break}},[]);return!a||o!=="editor"?null:(0,n.jsxs)(A.Box,{sx:{position:"absolute",top:0,left:0,bottom:0,zIndex:10,width:r,flexShrink:0,overflow:"hidden",transition:"width 220ms cubic-bezier(0.4, 0, 0.2, 1)",backgroundColor:c.palette.background.paper,borderRight:`1px solid ${c.palette.divider}`,display:"flex",flexDirection:"column",pointerEvents:"auto"},children:[(0,n.jsx)(A.Box,{sx:{width:r,height:"100%",display:"flex",flexDirection:"column"},children:t?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(A.Stack,{direction:"row",sx:{px:1.5,py:1,borderBottom:`1px solid ${c.palette.divider}`,alignItems:"center",justifyContent:"space-between"},children:[(0,n.jsx)(A.Typography,{variant:"subtitle2",children:d("componentsLibrary.drawer.title")}),(0,n.jsxs)(A.Stack,{direction:"row",spacing:.5,children:[(0,n.jsx)(A.Tooltip,{title:d("componentsLibrary.drawer.refresh"),children:(0,n.jsx)(A.IconButton,{size:"small",onClick:P,children:(0,n.jsx)(WO,{fontSize:"small"})})}),(0,n.jsx)(A.Tooltip,{title:d("componentsLibrary.drawer.close"),children:(0,n.jsx)(A.IconButton,{size:"small",onClick:j,children:(0,n.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:[(0,n.jsx)("polyline",{points:"11 17 6 12 11 7"}),(0,n.jsx)("polyline",{points:"18 17 13 12 18 7"})]})})})]})]}),(0,n.jsx)(A.Box,{sx:{px:1.5,borderBottom:`1px solid ${c.palette.divider}`},children:(0,n.jsx)(A.Tabs,{value:w,onChange:(L,E)=>R(E),variant:"fullWidth",slotProps:{indicator:{sx:{height:"3px",borderRadius:"4px"}}},sx:{minHeight:40},children:_.map(L=>(0,n.jsx)(A.Tab,{value:L.key,label:d(L.labelKey),sx:{minHeight:40,minWidth:0,px:1,fontSize:"0.72rem",textTransform:"none"}},L.key))})}),(0,n.jsxs)(A.Box,{sx:{flex:1,minHeight:0,overflowY:"auto",px:1.5,pb:2,pt:1},children:[w==="blocks"&&(0,n.jsx)(Qid,{}),w==="sections"&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A.Box,{sx:{pb:1.5},children:(0,n.jsxs)(A.Stack,{direction:"row",spacing:.5,sx:{alignItems:"center"},children:[(0,n.jsx)(A.TextField,{size:"small",fullWidth:!0,value:g,onChange:L=>b(L.target.value),placeholder:d("componentsLibrary.search.placeholder","Search…"),sx:$o,slotProps:{input:{startAdornment:(0,n.jsx)(A.InputAdornment,{position:"start",children:(0,n.jsx)($O,{fontSize:"small"})})}}}),(0,n.jsx)(A.Tooltip,{title:d("componentsLibrary.search.sortLabel","Sort"),children:(0,n.jsx)(A.IconButton,{size:"small",onClick:L=>x(L.currentTarget),sx:{flexShrink:0,color:O?"primary.main":"text.secondary"},children:(0,n.jsx)(qO,{fontSize:"small"})})}),(0,n.jsx)(A.Menu,{anchorEl:O,open:!!O,onClose:()=>x(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:b2d.map(L=>(0,n.jsx)(A.MenuItem,{selected:T===L,onClick:()=>{M(L),x(null)},sx:{fontSize:"0.8rem"},children:d(`componentsLibrary.search.sort.${L}`,L)},L))})]})}),(0,n.jsx)(R2d,{search:g,sort:T,onRename:S,refreshKey:h,onChange:()=>p(L=>L+1)})]}),w==="templates"&&(0,n.jsx)(z2d,{search:g,sort:T,onRename:S,refreshKey:m,onChange:()=>f(L=>L+1)})]})]}):(0,n.jsx)(e2d,{})}),(0,n.jsx)(Lid,{target:v,onClose:()=>S(null),onRenamed:()=>{v&&H(v.category),S(null)}}),(0,n.jsx)(g2d,{})]})}Rv();function P2d(){const t=F.useComponentsLibraryDrawerOpen(),r=F.useComponentsLibraryEnabled(),a=F.useSelectedMainTab(),{t:o}=Ze("inspector");return!r||a!=="editor"?null:(0,n.jsx)(A.Box,{sx:{position:"absolute",left:t?380:64,top:"50%",transform:"translateY(-50%)",zIndex:10,transition:"left 220ms cubic-bezier(0.4, 0, 0.2, 1)"},children:(0,n.jsx)(A.Tooltip,{title:o(t?"componentsLibrary.drawer.handleClose":"componentsLibrary.drawer.handleOpen"),placement:"right",children:(0,n.jsxs)(A.ButtonBase,{onClick:F.toggleComponentsLibraryDrawerOpen,"aria-label":o(t?"componentsLibrary.drawer.handleClose":"componentsLibrary.drawer.handleOpen"),sx:s=>({width:28,minHeight:96,borderTopRightRadius:8,borderBottomRightRadius:8,backgroundColor:t?s.palette.secondary.main:s.palette.background.paper,color:t?s.palette.secondary.contrastText:s.palette.text.primary,border:`1px solid ${s.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?s.palette.secondary.dark:s.palette.mode==="dark"?s.palette.grey[800]:s.palette.grey[200]}}),children:[(0,n.jsx)(E_,{sx:{fontSize:18}}),(0,n.jsx)(A.Box,{sx:{writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:"0.7rem",fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:o("componentsLibrary.drawer.handle")})]})})})}var N4r=(0,y.createContext)(!1),H2d=N4r.Provider,mo=()=>(0,y.useContext)(N4r);function W_(t,r){F.updateBlock(t,r)}function B4(t,r){W_(t,a=>{const o=a.data&&"props"in a.data?a.data.props:void 0,s={...o!==null&&typeof o=="object"?o:{}},u=typeof r=="function"?r(s):r,d={...s,...typeof u=="object"&&u!==null?u:{}};return s===d?a:{...a,data:{...a.data,props:d}}})}var F4r=(0,y.createContext)(null),o6=()=>(0,y.useContext)(F4r),s9=(0,y.memo)(function({id:r,isNotClient:a}){const o=F.editorStateStore(c=>c.document[r]),s=F.editorStateStore(c=>c.document?.root?.data?.theme),u=F.useSelectedScreenSize(),d=(0,y.useMemo)(()=>o?Ae.resolveBlockData(o,s,u,I3[o.type]):void 0,[o,s,u]);return d?(0,n.jsx)(F4r.Provider,{value:r,children:(0,n.jsx)(nld,{isNotClient:a,...d,blockId:r})}):(console.warn(`Block ${r} not found`),null)},(t,r)=>t.id===r.id&&t.isNotClient===r.isNotClient);function Il({childrenIds:t,onChange:r,parentId:a,position:o,isNotClient:s}){const{t:u}=Ze(),[{isOver:d},c]=z9(()=>({accept:["block",ji],drop:(h,p)=>{if(p.getItemType()==="library-component"){if(p.didDrop()){p.getDropResult();return}if(h.category==="block"&&typeof h.buttonIndex=="number"){const v=Q2[h.buttonIndex];if(!v)return;F.appendBuiltInBlockToParent(a,v.block(),o);return}if(h.category==="block-preset"&&typeof h.presetIndex=="number"){const v=n6[h.presetIndex];if(!v)return;F.appendBuiltInBlockToParent(a,v.block,o);return}const f=h;if(f.category==="template"){console.warn("[ComponentsLibrary] templates cannot be dropped inline; click the card in the drawer to apply.");return}(async()=>{try{F.appendSavedComponentToParent(a,(await r6(f.category,f.axis,f.id)).blocks,o)}catch(v){console.error("[ComponentsLibrary] failed to append saved subtree",v)}})();return}const m=h.blockId;if(p.didDrop()){p.getDropResult();return}return o===void 0?F.insertNewChildInContainer({parentId:a,blockId:m}):F.insertNewChildInColumn({parentId:a,blockId:m,indexArray:o})},canDrop:(h,p)=>{if(p.getItemType()==="library-component")return!0;const m=h.blockId;return!F.isChildOf({targetId:a,draggedId:m})&&m!==a},collect:h=>({isOver:h.canDrop()?!!h.isOver():!1})}),[a,o]),_=t&&t.length>0?(0,n.jsx)(A.Box,{ref:h=>{c(h)},sx:{minHeight:0,border:d?"2px solid":"",borderColor:d?"secondary.main":void 0},"aria-hidden":!0}):null;return s?t.map(h=>(0,n.jsx)(y.Fragment,{children:(0,n.jsx)(s9,{id:h,isNotClient:s})},h)):!t||t.length===0?(0,n.jsx)(A.Box,{ref:h=>{c(h)},sx:{minHeight:96,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:1,border:d?"2px solid":"1px dashed",borderColor:d?"secondary.main":"divider",backgroundImage:h=>`repeating-linear-gradient(45deg, ${h.palette.action.hover} 0, ${h.palette.action.hover} 1px, transparent 1px, transparent 12px)`,backgroundColor:d?"action.hover":"transparent",transition:"background-color 120ms ease, border-color 120ms ease"},children:(0,n.jsxs)(A.Stack,{spacing:.75,sx:{px:2,color:"text.secondary",alignItems:"center"},children:[(0,n.jsx)(YO,{sx:{fontSize:22,opacity:.7}}),(0,n.jsx)(A.Typography,{variant:"body2",color:"text.secondary",sx:{textAlign:"center"},children:u("editor.emptyCanvasDropHint","Drag a block here from the library")})]})}):(0,n.jsxs)(n.Fragment,{children:[t.map(h=>(0,n.jsx)(y.Fragment,{children:(0,n.jsx)(s9,{id:h})},h)),_]})}var aA=Ae.ColumnsContainerPropsSchema,L2d=[{childrenIds:[]},{childrenIds:[]},{childrenIds:[]}];function E2d({style:t,props:r,blockId:a,isNotClient:o}){const s=o6(),{columns:u,...d}=r??{},c=u??L2d,_=(h,{block:p,blockId:m,childrenIds:f})=>{const v=F.editorStateStore.getState().document[s],S=v?.data?.props?.columns??c,g=v?.data?.props?{...v.data.props}:{...d};delete g.columns;const b=S.length===2?[...S,{childrenIds:[]}]:[...S];b[h]={childrenIds:f};const T={...g,fixedWidths:g.fixedWidths?.length===2?[...g.fixedWidths,null]:g.fixedWidths},M={type:"ColumnsContainer",data:aA.parse({style:v?.data?.style??t,props:{...T,columns:b}})};F.applyBlockUpdates({[m]:p,[s]:M}),F.setSelectedBlockId(m)};return o?(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(Ae.ColumnsContainer,{blockId:a,props:d,style:t,columns:[(0,n.jsx)(Il,{isNotClient:o,parentId:a,position:0,childrenIds:u?.[0]?.childrenIds,onChange:h=>_(0,h)}),(0,n.jsx)(Il,{isNotClient:o,parentId:a,position:1,childrenIds:u?.[1]?.childrenIds,onChange:h=>_(1,h)}),(0,n.jsx)(Il,{isNotClient:o,parentId:a,position:2,childrenIds:u?.[2]?.childrenIds,onChange:h=>_(2,h)})]})}):(0,n.jsx)(Ae.ClientOnly,{children:(0,n.jsx)(Ae.ColumnsContainer,{blockId:a,props:d,style:t,columns:[(0,n.jsx)(Il,{parentId:a,position:0,childrenIds:u?.[0]?.childrenIds,onChange:h=>_(0,h)}),(0,n.jsx)(Il,{parentId:a,position:1,childrenIds:u?.[1]?.childrenIds,onChange:h=>_(1,h)}),(0,n.jsx)(Il,{parentId:a,position:2,childrenIds:u?.[2]?.childrenIds,onChange:h=>_(2,h)})]})})}function V2d({childrenIds:t}){return(0,n.jsx)(n.Fragment,{children:t.map(r=>(0,n.jsx)(y.Fragment,{children:(0,n.jsx)(s9,{isNotClient:!0,id:r})},r))})}function k2d({style:t,props:r,blockId:a,isNotClient:o}){const s=r?.childrenIds??[],u=o6();return(0,n.jsx)(Ae.Container,{style:t,blockId:`${a}`,children:o?(0,n.jsx)(V2d,{parentId:a,childrenIds:s,onChange:({block:d,blockId:c,childrenIds:_})=>{F.insertChildAndUpdateParent(u,c,d,_),F.setSelectedBlockId(c)}}):(0,n.jsx)(Ae.ClientOnly,{children:(0,n.jsx)(Il,{parentId:a,childrenIds:s,onChange:({block:d,blockId:c,childrenIds:_})=>{F.insertChildAndUpdateParent(u,c,d,_),F.setSelectedBlockId(c)}})})})}var I4r=Ae.ContainerPropsSchema;function D2d(t){const r=t.childrenIds??[],a=o6(),o=F.useSelectedScreenSize();return(0,n.jsx)("div",{onClick:()=>{F.setSelectedBlockId(null)},style:{backgroundColor:t.backdropColor??"#F5F5F5",color:t.textColor??"#262626",fontFamily:pcr(t?.fontFamily||"OPEN_SANS"),fontSize:"16px",fontWeight:"400",letterSpacing:"0.15008px",lineHeight:"1.5",margin:"0",width:"100%"},children:(0,n.jsx)("table",{role:"presentation",align:"center",width:"100%",style:{margin:"0 auto",maxWidth:o==="desktop"?600:370,backgroundColor:t.canvasColor??"#FFFFFF",borderRadius:t.borderRadius??void 0,border:(()=>{const s=t.borderColor;if(s)return`1px solid ${s}`})()},cellSpacing:"0",cellPadding:"0",border:0,children:(0,n.jsx)("tbody",{children:(0,n.jsx)("tr",{style:{width:"100%"},children:(0,n.jsx)("td",{"data-value":"__content",children:(0,n.jsx)(Ae.ClientOnly,{children:(0,n.jsx)(Il,{listEndPolicy:"root",parentId:a,childrenIds:r,onChange:({block:s,blockId:u,childrenIds:d})=>{F.insertChildAndUpdateParent(a,u,s,d),F.setSelectedBlockId(u)}})})})})})})})}var B4r=VC,N2d=t=>r=>({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:r.palette.secondary.main,padding:"1px",display:"flex",alignItems:"center",justifyContent:"center"}),N5=null;function F2d({blockId:t}){const r=F.useBlock(t),{t:a}=Ze("inspector"),{t:o}=Ze(),s=F.useDevMode(),u=F.useComponentsStorageMode(),d=s&&u!=="local",[c,_]=(0,y.useState)(!1),h=(0,y.useMemo)(()=>{if(!r||r.type==="EmailLayout")return!1;try{const M=F.editorStateStore.getState().document;return wur(t,M)==="section"}catch{return!1}},[r,t]),p=N5&&N5.blockType===r?.type,m=(0,y.useRef)(null),[f,v]=(0,y.useState)(!1);(0,y.useEffect)(()=>{const M=()=>{if(!m.current)return;const x=m.current.parentElement;if(!x)return;const w=x.getBoundingClientRect(),R=x.closest(".preview-container");R&&(R.getBoundingClientRect().right-w.right<48?v(!0):v(!1))};M(),window.addEventListener("resize",M),window.addEventListener("scroll",M,!0);const O=setTimeout(M,100);return()=>{window.removeEventListener("resize",M),window.removeEventListener("scroll",M,!0),clearTimeout(O)}},[t]);const S=(0,y.useCallback)(()=>{const M=F.editorStateStore.getState().document,O=F.editorStateStore.getState().notionTextInlineEditingBlockId,x=(P,H,L=new Set)=>{if(L.has(P))return;L.add(P);const E=H[P];E&&(E.type==="Container"&&(E.data?.props?.childrenIds||[]).forEach(z=>x(z,H,L)),E.type==="ColumnsContainer"&&(E.data?.props?.columns||[]).forEach(z=>{(z.childrenIds||[]).forEach(V=>x(V,H,L))}))},w=new Set;x(t,M,w),w.add(t);const R=P=>P&&P.filter(H=>!w.has(H)),j={...M};for(const[P,H]of Object.entries(j)){if(w.has(P))continue;const L=H;switch(L.type){case"EmailLayout":j[P]={...L,data:{...L.data,childrenIds:R(L.data.childrenIds)}};break;case"Container":j[P]={...L,data:{...L.data,props:{...L.data.props,childrenIds:R(L.data.props?.childrenIds)}}};break;case"ColumnsContainer":j[P]={...L,data:{...L.data,props:{...L.data.props,columns:L.data.props?.columns?.map(E=>({...E,childrenIds:R(E.childrenIds)}))}}};break;default:j[P]=L}}for(const P of w)delete j[P];O&&(O===t||w.has(O))&&F.setNotionTextInlineEditingBlockId(null),F.setDocument(j),F.setSelectedBlockId(null)},[t]),g=(0,y.useCallback)(()=>{r&&"style"in r.data&&r.data.style&&(N5={styles:JSON.parse(JSON.stringify(r.data.style)),blockType:r.type})},[r]),b=(0,y.useCallback)(()=>{const M=F.editorStateStore.getState().document;if(!N5||N5.blockType!==r?.type)return;const O={...M},x=O[t];x&&(O[t]={...x,data:{...x.data,style:JSON.parse(JSON.stringify(N5.styles))}},F.setDocument(O),F.setSelectedBlockId(t))},[t,r]),T=(0,y.useCallback)(()=>{F.duplicateBlock(t)},[t]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(A.Paper,{ref:m,sx:N2d(f),onClick:M=>M.stopPropagation(),elevation:10,children:[(0,n.jsx)(A.Tooltip,{title:a("actions.copyFormat"),placement:"left-start",children:(0,n.jsx)("span",{children:(0,n.jsx)(A.IconButton,{onClick:g,sx:{padding:"4px",overflow:"hidden",color:"text.primary"},disabled:!(r&&"style"in r.data&&r.data.style),children:(0,n.jsxs)("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,n.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"}),(0,n.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"}),(0,n.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"}),(0,n.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"}),(0,n.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"})]})})})}),(0,n.jsx)(A.Tooltip,{title:a(p?"actions.pasteFormatting":"actions.noFormatSupported"),placement:"left-start",children:(0,n.jsx)("span",{children:(0,n.jsx)(A.IconButton,{onClick:b,sx:{padding:"4px",overflow:"hidden",color:p?"text.primary":"text.disabled"},disabled:!p,children:(0,n.jsx)("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,n.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"})})})})}),(0,n.jsx)(A.Tooltip,{title:o("editor.cloneBlock"),placement:"left-start",children:(0,n.jsx)(A.IconButton,{onClick:T,sx:{padding:"4px",overflow:"hidden",color:"text.primary"},children:(0,n.jsx)(ee.ContentCopy,{sx:{fontSize:"1.25rem"}})})}),(0,n.jsx)(A.Tooltip,{title:a("actions.delete"),placement:"left-start",children:(0,n.jsx)(A.IconButton,{onClick:S,sx:{overflow:"hidden",color:"error.main",padding:"4px"},children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:(0,n.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"})})})}),d&&(0,n.jsx)(A.Tooltip,{title:a("componentsLibrary.save.tooltip"),placement:"left-start",children:(0,n.jsx)("span",{children:(0,n.jsx)(A.IconButton,{onClick:()=>_(!0),disabled:!h,sx:{padding:"4px",overflow:"hidden",color:h?"text.primary":"text.disabled"},"aria-label":a("componentsLibrary.save.button"),children:(0,n.jsx)(EO,{sx:{fontSize:"1.25rem"}})})})})]}),d&&c&&h&&(0,n.jsx)(zid,{open:c,rootBlockId:t,onClose:()=>_(!1)})]})}var I2d=(0,y.memo)(F2d);yn();var aJ=150,B2d=25,k0=null,u9=null;function oA(){k0&&(clearTimeout(k0),k0=null),u9=null}function oJ(t){u9===t&&oA()}function J2d(t,r,a,o){oA(),u9=t,k0=setTimeout(()=>{k0=null,u9=null,a()&&(F.setCanvasHoveredBlockId(t),o())},r)}function U2d(t){const r=t.closest(".preview-container");if(!r)return aJ;let a=0,o=t;for(;o&&r.contains(o)&&(o.hasAttribute("data-block-id")&&(a+=1),o!==r);)o=o.parentElement;return aJ+Math.max(0,a-1)*B2d}function W2d(t){const r=F.useNotionTextInlineEditingBlockId();return(0,y.useMemo)(()=>r?F.isChildOf({draggedId:t,targetId:r}):!1,[t,r])}function $2d(t){if(!t||typeof t.nodeType!="number")return null;const r=t,a=r.closest?.(".preview-container");if(!a)return null;const o=r.closest?.("[data-block-id]"),s=o?.getAttribute("data-block-id")??null;return!s||!o||!a.contains(o)?null:s}function G2d({children:t,canEdit:r=!0,isNotClient:a=!1}){const o=o6(),{t:s}=Ze(),u=F.useCanvasHoveredBlockId(),d=F.useIsBlockSelected(o),c=F.useBlockType(o),_=F.useSelectedMainTab(),h=F.useNotionTextInlineEditingBlockId(),p=F.useEditingBlockId();F.useHighlightColor();const m=W2d(o),[f,v]=(0,y.useState)(!1),[S,g]=(0,y.useState)(0),b=(0,y.useRef)(null),T=(0,y.useRef)(null),[M,O]=(0,y.useState)(null),x=$1(),w=F.useIsInFocusedEditingMode(),R=h===o||m,j=p===o,P=x.palette.primary.light||x.palette.primary.main,H=(0,y.useRef)(null),L=(0,y.useRef)(!0);if(a)return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{style:{width:"100%"}}),(0,n.jsx)(A.Box,{sx:{position:"relative",maxWidth:"100%"},children:(0,n.jsx)("div",{children:t})}),(0,n.jsx)("div",{style:{width:"100%"}})]});let E,z;j&&r?(E=`2px solid ${P}`,z="10"):d&&r?(E=`2px solid ${x.palette.secondary.main}`,z="1"):f&&r?E=`2px dotted ${x.palette.secondary.main}`:z="auto";const V=()=>!d||!r?null:(0,n.jsx)(I2d,{blockId:o}),k=Y=>{const re=Y.getClientOffset(),Q=b.current?.getBoundingClientRect(),le=T.current?.getBoundingClientRect();return!re||!Q||!le?null:Math.abs(re.y-Q.y)<Math.abs(re.y-le.y)?"up":"down"},[{isOver:D},N]=z9(()=>({accept:["block",ji],drop:(Y,re)=>{if(re.getItemType()==="library-component"){if(re.didDrop()){re.getDropResult();return}if(Y.category==="block"&&typeof Y.buttonIndex=="number"){const J=Q2[Y.buttonIndex];if(!J)return;k(re)==="up"?F.insertBuiltInBlockBeforeSibling(o,J.block()):F.insertBuiltInBlockAfterSibling(o,J.block());return}if(Y.category==="block-preset"&&typeof Y.presetIndex=="number"){const J=n6[Y.presetIndex];if(!J)return;k(re)==="up"?F.insertBuiltInBlockBeforeSibling(o,J.block):F.insertBuiltInBlockAfterSibling(o,J.block);return}const Z=Y;if(Z.category==="template"){console.warn("[ComponentsLibrary] templates cannot be dropped inline; click the card in the drawer to apply.");return}const se=k(re)==="up"?"before":"after";(async()=>{try{const J=await r6(Z.category,Z.axis,Z.id);se==="after"?F.insertSavedComponentAfterSibling(o,J.blocks):F.insertSavedComponentBeforeSibling(o,J.blocks)}catch(J){console.error("[ComponentsLibrary] failed to insert saved subtree",J)}})();return}const Q=o,le=Y.blockId;if(Q===le)return;if(re.didDrop()){re.getDropResult();return}const ce=k(re);if(ce)F.changeBlockPosition(Q,le,ce);else{F.changeBlockPosition(Q,le,"down");return}},canDrop:(Y,re)=>re.getItemType()==="library-component"?!0:!F.isChildOf({targetId:o,draggedId:Y.blockId}),collect:Y=>({isOver:Y.canDrop()?Y.isOver({shallow:!0}):!1}),hover:(Y,re)=>{if(re.getItemType()==="library-component"){if(!re.canDrop()||!re.isOver({shallow:!0})){O(null);return}const le=k(re);O(le??null);return}if(Y.blockId===o){O(null);return}if(!re.canDrop()||!re.isOver({shallow:!0})){O(null);return}const Q=k(re);if(!Q){O(null);return}O(Q)},end:()=>{O(null)}}));(0,y.useEffect)(()=>{D||O(null)},[D]);const I=()=>(0,n.jsxs)("div",{style:{height:"3px",background:x.palette.secondary.main,position:"relative",color:x.palette.secondary.main},children:[(0,n.jsx)("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:(0,n.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"})}),(0,n.jsx)("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:(0,n.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"})})]}),[{borderDrag:B="",isDragging:q},te]=a5(()=>({type:"block",item:()=>{const Y=F.editorStateStore.getState().notionTextInlineEditingBlockId;return Y&&window.dispatchEvent(new CustomEvent("notion-text-force-save",{detail:{blockId:Y}})),{blockId:o}},canDrag:!R,collect:Y=>({borderDrag:Y.isDragging()?"2px dotted yellow":"",isDragging:Y.isDragging()}),end:()=>{g(Date.now())}}),[R,o])||[{borderDrag:"",isDragging:!1},y.default.useRef(null)],$=r&&_!=="preview"&&!R&&!w&&(q||u===o||u==null&&d);(0,y.useEffect)(()=>(L.current=!0,()=>{L.current=!1,oJ(o),H.current&&(clearTimeout(H.current),H.current=null),F.editorStateStore.getState().canvasHoveredBlockId===o&&F.setCanvasHoveredBlockId(null)}),[o]);const W=Y=>{const re=Date.now()-S;if(!(q||S>0&&re<200)&&(Y.stopPropagation(),_!=="preview")){if(c==="NotionText"){const Q=new CustomEvent("email-builder-highlight-editor",{detail:!0});window.dispatchEvent(Q)}F.setSelectedBlockId(o)}},_e=y.default.useMemo(()=>y.default.cloneElement(t,{onClick:Y=>{t.props.onClick&&t.props.onClick(Y),!Y.defaultPrevented&&!Y.isPropagationStopped()&&(q||W(Y))},onMouseDown:Y=>{t.props.onMouseDown&&t.props.onMouseDown(Y)},onMouseUp:Y=>{t.props.onMouseUp&&t.props.onMouseUp(Y)}}),[t,q,o,c,_]);return(0,n.jsxs)(n.Fragment,{children:[M==="up"&&(0,n.jsx)(I,{}),(0,n.jsx)("div",{ref:b,style:{width:"100%"}}),(0,n.jsx)(A.Box,{"data-block-id":o,sx:{position:"relative",maxWidth:"100%"},ref:N,onMouseEnter:Y=>{Y.stopPropagation(),oA(),H.current&&(clearTimeout(H.current),H.current=null);const re=U2d(Y.currentTarget);J2d(o,re,()=>L.current,()=>v(!0))},onMouseLeave:Y=>{oJ(o),H.current&&clearTimeout(H.current);const re=Y.relatedTarget;H.current=setTimeout(()=>{if(v(!1),F.editorStateStore.getState().canvasHoveredBlockId!==o)return;const Q=$2d(re);Q&&Q!==o?F.setCanvasHoveredBlockId(Q):F.setCanvasHoveredBlockId(null)},150)},onClick:W,children:(0,n.jsxs)(A.Box,{sx:{position:"relative",maxWidth:"100%",outlineOffset:"-1px",outline:E,zIndex:z,transition:"outline 0.2s ease-in-out, z-index 0.2s ease-in-out"},children:[V(),$?(0,n.jsx)(A.Box,{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:j&&r?P:x.palette.secondary.main},children:(0,n.jsx)(A.Tooltip,{title:s("editor.dragBlockHandle"),placement:"top",children:(0,n.jsx)(A.IconButton,{ref:te,type:"button","aria-label":s("editor.dragBlockHandle"),size:"small",onClick:Y=>Y.stopPropagation(),sx:{padding:"3px 6px",rotate:"90deg",borderRadius:0,color:"white",cursor:q?"grabbing":"grab",touchAction:"none","&:hover":{backgroundColor:"rgba(255,255,255,0.15)"}},children:(0,n.jsx)(ee.DragIndicator,{sx:{fontSize:15}})})})}):null,(0,n.jsx)(A.Fade,{in:j&&r,timeout:200,children:(0,n.jsx)(A.Chip,{label:s("editor.editing"),icon:(0,n.jsx)(ee.EditOutlined,{}),size:"small",sx:{position:"absolute",left:-1,top:-26,backgroundColor:P,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"}}})}),(0,n.jsx)("div",{style:{border:B},children:_e})]})}),M==="down"&&(0,n.jsx)(I,{}),(0,n.jsx)("div",{ref:T,style:{width:"100%"}})]})}var gl=(0,y.memo)(G2d,(t,r)=>t.children===r.children&&t.canEdit===r.canEdit&&t.isNotClient===r.isNotClient),q2d=(0,y.memo)(Ae.BlockSocialMedia),K2d=t=>{const r=F.useSelectedScreenSize(),a=F.useDisableEdition();return(0,n.jsx)(q2d,{...t,selectedScreenSize:r,disableEdition:a})},Y2d=(0,y.memo)(Ae.Button),Q2d=(0,y.memo)(k2d),X2d=(0,y.memo)(E2d),Z2d=(0,y.memo)(Ae.Image),eld=(0,y.memo)(Oid),tld=(0,y.memo)(Ae.Spacer),rld=(0,y.memo)(Ae.Divider),J4r=Ae.buildBlockConfigurationDictionary({SocialMedia:{schema:Ae.BlockSocialMediaPropsScheme,Component:t=>(0,n.jsx)(gl,{isNotClient:t.isNotClient,children:(0,n.jsx)(K2d,{...t})})},Button:{schema:Ae.ButtonPropsSchema,Component:t=>(0,n.jsx)(gl,{isNotClient:t.isNotClient,children:(0,n.jsx)(Y2d,{...t})})},Container:{schema:I4r,Component:t=>(0,n.jsx)(gl,{isNotClient:t.isNotClient,children:(0,n.jsx)(Q2d,{...t})})},ColumnsContainer:{schema:aA,Component:t=>(0,n.jsx)(gl,{isNotClient:t.isNotClient,children:(0,n.jsx)(X2d,{...t})})},Image:{schema:Ae.ImagePropsSchema,Component:t=>{const r={...t,props:{...t.props,url:t.props?.url??"https://placehold.co/600x400@2x/F8F8F8/CCC?text=Your%20image"}};return(0,n.jsx)(gl,{isNotClient:t.isNotClient,children:(0,n.jsx)(Z2d,{...r})})}},NotionText:{schema:Ae.NotionTextPropsSchema,Component:t=>(0,n.jsx)(gl,{isNotClient:t.isNotClient,children:(0,n.jsx)(eld,{blockId:t.blockId??"",...t})})},EmailLayout:{schema:B4r,Component:t=>(0,n.jsx)(D2d,{...t})},Spacer:{schema:Ae.SpacerPropsSchema,Component:t=>(0,n.jsx)(gl,{isNotClient:t.isNotClient,children:(0,n.jsx)(tld,{...t})})},Divider:{schema:Ae.DividerPropsSchema,Component:t=>(0,n.jsx)(gl,{isNotClient:t.isNotClient,children:(0,n.jsx)(rld,{...t})})}}),nld=Ae.buildBlockComponent(J4r),I3=Object.fromEntries(Object.entries(J4r).map(([t,r])=>[t,Ae.getSchemaDefaults(r.schema)??{}])),U4r=({tabs:t,defaultTab:r})=>{const a=(0,y.useMemo)(()=>t.filter(d=>d.visible),[t]),[o,s]=(0,y.useState)(null);if((0,y.useEffect)(()=>{if(o&&a.some(c=>c.key===o))return;const d=r&&a.some(c=>c.key===r)?r:a[0]?.key??null;s(d)},[a,r,o]),a.length===0)return null;if(a.length===1)return(0,n.jsx)(A.Box,{children:a[0].render()});const u=a.find(d=>d.key===o)??a[0];return(0,n.jsxs)(A.Box,{children:[(0,n.jsx)(A.Tabs,{value:u.key,onChange:(d,c)=>s(c),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:a.map(d=>(0,n.jsx)(A.Tab,{value:d.key,label:d.label,disableRipple:!0},d.key))}),(0,n.jsx)(A.Box,{children:u.render()})]})},ald={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"}},old=t=>r=>r.document[t],ild=t=>r=>{const a=r.document[t];if(!a)return[];switch(a.type){case"EmailLayout":return a.data?.childrenIds||[];case"Container":return a.data?.props?.childrenIds||[];case"ColumnsContainer":return a.data?.props?.columns?.flatMap(o=>o.childrenIds||[])||[];default:return[]}};function lld(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(r=>r.childrenIds||[])||[];default:return[]}}function W4r(t,r,a){const o=lld(t[r]);for(const s of o)if(s===a||W4r(t,s,a))return!0;return!1}function sld(t,r,a,o){if(!o)return!1;const s=t[r];if(!s||s.type!=="ColumnsContainer")return!1;const u=s.data?.props?.columns?.[a]?.childrenIds||[];for(const d of u)if(d===o||W4r(t,d,o))return!0;return!1}function uld(t){const r=t.document;if(!r||!r.root)return null;function a(s,u){const d=u.document[s];if(!d)return[];switch(d.type){case"EmailLayout":return d.data?.childrenIds||[];case"Container":return d.data?.props?.childrenIds||[];case"ColumnsContainer":return d.data?.props?.columns?.flatMap(c=>c.childrenIds||[])||[];default:return[]}}function o(s,u,d){const c=d.document[s],_=c?.type??"Unknown",h=ald[_]??{label:_,iconName:"WidgetsOutlined"};if(_==="ColumnsContainer"){const m=c.data?.props?.columns,f=c.data?.props?.columnsCount===2?2:3,v=[];for(let S=0;S<f;S++){const g=m?.[S]?.childrenIds??[],b=F.makeComponentTreeColumnSlotId(s,S);v.push({blockId:b,type:"ColumnSlot",label:"",iconName:"WidgetsOutlined",children:g.map(T=>o(T,u+2,d)),depth:u+1,columnSlot:{parentBlockId:s,columnIndex:S,columnsCount:f}})}return{blockId:s,type:_,label:h.label,iconName:h.iconName,children:v,depth:u}}const p=a(s,d).map(m=>o(m,u+1,d));return{blockId:s,type:_,label:h.label,iconName:h.iconName,children:p,depth:u}}return o("root",0,t)}function dld(){const t=F.editorStateStore(r=>r.document);return(0,y.useMemo)(()=>uld({document:t}),[t])}function $4r(t){return F.editorStateStore(old(t))}function cld(t){return F.editorStateStore(ild(t))}var iA=F.create(()=>({credits:{}}));function _ld(t,r){iA.setState(a=>({credits:{...a.credits,[t]:r}}))}function cd(t){iA.setState(r=>{const{[t]:a,...o}=r.credits;return{credits:o}})}function hld(t){return iA(r=>t?r.credits[t]??null:null)}var pld=350,mld=20,fld=10,vld=["any","landscape","portrait","squarish"],xn={query:"",orientation:"any",photos:[],page:0,totalPages:0,selectedPhoto:null},G4r=({backendUrl:t,blockId:r,source:a})=>{const{t:o}=Ze("inspector"),s=(0,y.useMemo)(()=>to(t),[t]),[u,d]=(0,y.useState)(r??null),[c,_]=(0,y.useState)(null),[h,p]=(0,y.useState)(a??"image");(0,y.useEffect)(()=>{r!=null&&d(r)},[r]),(0,y.useEffect)(()=>{a!=null&&p(a)},[a]);const[m,f]=(0,y.useState)(xn.query),[v,S]=(0,y.useState)(xn.orientation),[g,b]=(0,y.useState)(xn.photos),[T,M]=(0,y.useState)(xn.page),[O,x]=(0,y.useState)(xn.totalPages),[w,R]=(0,y.useState)(null),[,j]=(0,y.useState)(xn.selectedPhoto),[P,H]=(0,y.useState)(!1),[L,E]=(0,y.useState)(null),z=(0,y.useRef)(null);(0,y.useEffect)(()=>{const I=B=>{const{detail:q}=B;d(q.blockId),_(q.currentImageUrl),p(q.source??"image")};return window.addEventListener("email-builder-image-panel-opened",I),()=>window.removeEventListener("email-builder-image-panel-opened",I)},[]);const V=(0,y.useCallback)(async(I,B,q,te)=>{z.current?.abort();const $=new AbortController;z.current=$,H(!0),E(null);try{const W=await pY5(s,{query:I,page:q,perPage:mld,orientation:B==="any"?void 0:B,signal:$.signal});R(W.rateLimitRemaining),x(W.totalPages),M(q),b(_e=>{const Y=te?[..._e,...W.results]:W.results;return xn.photos=Y,xn.page=q,xn.totalPages=W.totalPages,Y})}catch(W){if(W?.name==="AbortError")return;E(W instanceof iu?W.kind:"unknown"),te||b([])}finally{z.current===$&&(H(!1),z.current=null)}},[s]);(0,y.useEffect)(()=>{xn.query=m,xn.orientation=v;const I=m.trim();if(I.length===0){z.current?.abort(),b([]),M(0),x(0),E(null),xn.photos=[],xn.page=0,xn.totalPages=0;return}const B=window.setTimeout(()=>{V(I,v,1,!1)},pld);return()=>window.clearTimeout(B)},[m,v,V]),(0,y.useEffect)(()=>()=>z.current?.abort(),[]);const k=T>0&&T<O&&!P,D=()=>{const I=m.trim();!I||!k||V(I,v,T+1,!0)},N=I=>{if(!u)return;const B=mY5(I);h==="image"?B4(u,{url:B,alt:I.attribution}):window.dispatchEvent(new CustomEvent("email-builder-set-image",{detail:{url:B}})),j(I),xn.selectedPhoto=I,_ld(u,{photoId:I.id,photographerName:I.user.name,photographerUrl:I.user.profileUrl,unsplashUrl:I.unsplashUrl}),Our(s,I.links.downloadLocation)};return(0,n.jsxs)(A.Box,{children:[(0,n.jsxs)(A.Stack,{direction:"row",spacing:1,sx:{mb:1,alignItems:"center"},children:[(0,n.jsx)(A.TextField,{fullWidth:!0,size:"small",placeholder:o("inputs.unsplash.searchPlaceholder"),value:m,onChange:I=>f(I.target.value),slotProps:{input:{startAdornment:(0,n.jsx)(A.InputAdornment,{position:"start",children:(0,n.jsx)(ee.Search,{fontSize:"small",sx:{color:"text.secondary"}})})}}}),w!==null&&w<=fld&&(0,n.jsx)(A.Chip,{label:o("inputs.unsplash.quotaLow",{remaining:w}),size:"small",color:"warning",variant:"outlined"})]}),(0,n.jsx)(A.Tabs,{value:v,onChange:(I,B)=>S(B),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:vld.map(I=>(0,n.jsx)(A.Tab,{value:I,label:o(`inputs.unsplash.orientation.${I}`),disableRipple:!0},I))}),L&&(0,n.jsx)(A.Alert,{severity:L==="not_configured"?"warning":"error",sx:{mb:1.5,fontSize:"0.75rem"},children:o(`inputs.unsplash.error.${L}`)}),P&&g.length===0&&(0,n.jsx)(A.Box,{sx:{display:"flex",justifyContent:"center",py:3},children:(0,n.jsx)(A.CircularProgress,{size:22})}),!P&&!L&&g.length===0&&m.trim().length===0&&(0,n.jsx)(A.Box,{sx:{textAlign:"center",py:3},children:(0,n.jsx)(A.Typography,{variant:"caption",color:"text.secondary",children:o("inputs.unsplash.emptyInitial")})}),!P&&!L&&g.length===0&&m.trim().length>0&&(0,n.jsx)(A.Box,{sx:{textAlign:"center",py:3},children:(0,n.jsx)(A.Typography,{variant:"caption",color:"text.secondary",children:o("inputs.unsplash.emptyNoResults",{query:m.trim()})})}),g.length>0&&(0,n.jsx)(A.Box,{sx:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:1,maxHeight:380,overflowY:"auto"},children:g.map(I=>{const B=c?.includes(I.id)??!1;return(0,n.jsx)(Sld,{photo:I,selected:B,onPick:()=>N(I)},I.id)})}),k&&(0,n.jsx)(A.Box,{sx:{textAlign:"center",mt:2},children:(0,n.jsx)(A.Link,{component:"button",variant:"caption",onClick:D,sx:{cursor:"pointer"},children:o("inputs.unsplash.loadMore")})}),(0,n.jsxs)(A.Typography,{variant:"caption",sx:{display:"block",mt:1.5,color:"text.secondary",textAlign:"center",fontSize:"0.65rem"},children:[o("inputs.unsplash.poweredBy")," ",(0,n.jsx)(A.Link,{href:"https://unsplash.com/?utm_source=email-builder-online&utm_medium=referral",target:"_blank",rel:"noreferrer noopener",underline:"hover",color:"inherit",children:"Unsplash"})]})]})},Sld=({photo:t,selected:r,onPick:a})=>{const{t:o}=Ze("inspector"),s=t.color??void 0;return(0,n.jsxs)(A.Box,{sx:{borderRadius:1,overflow:"hidden",border:"2px solid",borderColor:r?"primary.main":"divider",cursor:"pointer",backgroundColor:s??"action.hover",transition:"border-color 0.15s ease","&:hover":{borderColor:"primary.light"}},children:[(0,n.jsx)(A.Box,{sx:{position:"relative",aspectRatio:"1",overflow:"hidden"},children:(0,n.jsx)("img",{src:t.urls.thumb,alt:t.alt,loading:"lazy",onClick:a,style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})}),(0,n.jsx)(A.Box,{sx:{px:.75,py:.5,fontSize:"0.6rem",lineHeight:1.3,bgcolor:"#1a1a1a",color:"#ccc",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:(0,n.jsx)(L$,{t:o,i18nKey:"inputs.unsplash.creditLine",values:{author:t.user.name},components:{authorLink:(0,n.jsx)(A.Link,{href:t.user.profileUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",onClick:u=>u.stopPropagation(),sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}}),unsplashLink:(0,n.jsx)(A.Link,{href:t.unsplashUrl,target:"_blank",rel:"noreferrer noopener",underline:"hover",onClick:u=>u.stopPropagation(),sx:{color:"#fff",fontSize:"inherit",fontWeight:500,"&:hover":{textShadow:"0 0 6px rgba(255,255,255,0.6)"}}})}})})]})};function gld({onClick:t,disabled:r,primary:a=!1}){const{t:o}=Ze("inspector");return(0,n.jsx)(A.IconButton,{"aria-label":o("inputs.common.close"),onClick:t,disabled:r,sx:{position:"absolute",right:8,top:8,color:s=>a?"brand.blue":s.palette.grey[500],"&:hover":{opacity:.8}},children:(0,n.jsx)(ee.Close,{})})}function bld({imageUrl:t,saving:r=!1}){return(0,n.jsxs)(A.Card,{sx:{position:"relative"},children:[r&&(0,n.jsx)(A.Stack,{sx:{justifyContent:"center",alignItems:"center",position:"absolute",top:7,left:0,width:"100%",height:"314px",zIndex:20,backgroundColor:"#212121AA",mb:1},children:(0,n.jsx)(A.CircularProgress,{size:48,thickness:6,color:"inherit",sx:{color:"white"}})}),(0,n.jsx)(A.CardMedia,{component:"img",sx:{objectFit:"contain",width:"100%",height:"326px"},image:t,alt:"Generated Image"})]})}function Tld({value:t,onChange:r,disabled:a}){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A.Typography,{sx:{fontSize:"14px",fontWeight:700},children:"Image description"}),(0,n.jsx)(A.TextField,{disabled:a,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:o=>r(o.target.value),sx:{mt:.5,"& .MuiOutlinedInput-root":{borderRadius:"6px"}}})]})}var yld=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 q4r({src:t,style:r}){const{t:a}=Ze("inspector"),[o,s]=(0,y.useState)(!1),[u,d]=(0,y.useState)(!1),[c,_]=(0,y.useState)(""),[h,p]=(0,y.useState)(null),[m,f]=(0,y.useState)(!1),[v,S]=(0,y.useState)(null),[g,b]=(0,y.useState)(!1),[T,M]=(0,y.useState)(0),[O,x]=(0,y.useState)(0),w=(0,y.useRef)(null),R=[a("inputs.aiImageGeneration.loadingStep1"),a("inputs.aiImageGeneration.loadingStep2"),a("inputs.aiImageGeneration.loadingStep3"),a("inputs.aiImageGeneration.loadingStep4")],j=(0,y.useCallback)(()=>{M(0),x(0),w.current&&clearInterval(w.current);const k=6e4,D=100;let N=0;w.current=setInterval(()=>{N+=D,M(Math.min(N/k*95,95)),x(Math.min(Math.floor(N/k*R.length),R.length-1)),N>=k&&w.current&&clearInterval(w.current)},D)},[R.length]),P=(0,y.useCallback)(()=>{w.current&&(clearInterval(w.current),w.current=null),M(100)},[]),H=()=>{s(!0),S(null)},L=()=>{u||(s(!1),d(!1),p(null),_(""),f(!1),S(null),b(!1),P())},E=()=>{const k=h&&!m?"store-ai-image":"request-ai-image",D=h&&!m?h:c;S(null),k==="store-ai-image"?(b(!0),d(!1),setTimeout(()=>{d(!1),L()},2e3)):(d(!0),j()),window.dispatchEvent(new CustomEvent(k,{detail:D}))},z=()=>{f(!0),p(null),S(null),b(!1)};(0,y.useEffect)(()=>{const k=D=>{const{detail:N}=D;if(P(),d(!1),N.error){S(yld(N.error));return}if(!N.success||!N.url){S({code:0,title:"Generation Failed",message:"Failed to generate the image.",action:"Please try again"});return}p(N.url),f(!1)};return window.addEventListener("generated-image",k),()=>{window.removeEventListener("generated-image",k)}},[]),(0,y.useEffect)(()=>{L()},[t]);const V=!h||m;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A.Button,{style:r,startIcon:(0,n.jsx)(ee.AutoAwesome,{className:"w-4 h-4"}),variant:"contained",onClick:H,children:a("inputs.aiImageGeneration.generate")}),(0,n.jsx)(A.Dialog,{open:o,onClose:L,maxWidth:"sm",fullWidth:!0,slotProps:{paper:{sx:{bgcolor:"background.paper",color:"text.primary",borderRadius:"10px"}}},children:(0,n.jsxs)("form",{onSubmit:k=>{k.preventDefault(),E()},children:[(0,n.jsxs)(A.DialogTitle,{sx:{fontWeight:700,fontSize:"24px",color:v?"error.main":"inherit"},children:[a(v?"inputs.aiImageGeneration.titleError":u?"inputs.aiImageGeneration.titleLoading":h?"inputs.aiImageGeneration.titleReady":"inputs.aiImageGeneration.titleCreate"),(0,n.jsx)(gld,{onClick:L,disabled:u,primary:!0})]}),(0,n.jsxs)(A.DialogContent,{children:[(0,n.jsx)(A.DialogContentText,{sx:{pb:1,color:v?"error.dark":"inherit"},children:a(v?"inputs.aiImageGeneration.descriptionError":u?"inputs.aiImageGeneration.descriptionLoading":V?"inputs.aiImageGeneration.descriptionCreate":"inputs.aiImageGeneration.descriptionReady")}),h&&!m?(0,n.jsxs)(A.Stack,{sx:{position:"relative"},children:[(0,n.jsx)(bld,{imageUrl:h,saving:g}),(0,n.jsxs)(A.Alert,{variant:"outlined",severity:"warning",icon:!1,children:[a("inputs.aiImageGeneration.warningRegenerate")," ",(0,n.jsx)("b",{children:a("inputs.aiImageGeneration.warningInsertFirst")})," ",a("inputs.aiImageGeneration.warningFirst")]})]}):u&&!h?(0,n.jsxs)(A.Stack,{spacing:2,sx:{justifyContent:"center",alignItems:"center",backgroundColor:k=>k.palette.mainColor?.[50]??k.palette.action.hover,height:"326px",width:"100%",borderRadius:"8px"},children:[(0,n.jsx)(ee.AutoAwesome,{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)"}}}}),(0,n.jsx)(A.Typography,{variant:"body2",sx:{color:"text.secondary",fontWeight:500,transition:"opacity 0.3s"},children:R[O]}),(0,n.jsx)(A.LinearProgress,{variant:"determinate",value:T,sx:{width:"60%",borderRadius:4,height:6}})]}):(0,n.jsx)(Tld,{value:c,onChange:_,disabled:u})]}),!u&&(0,n.jsxs)(A.DialogActions,{className:"p-6",children:[h&&!m&&(0,n.jsx)(A.Button,{startIcon:(0,n.jsx)(ee.Refresh,{className:"w-4 h-4"}),onClick:z,variant:"outlined",disabled:u,children:a("inputs.aiImageGeneration.regenerate")}),!h&&!m&&(0,n.jsx)(A.Button,{onClick:L,variant:"text",disabled:m,children:a("inputs.aiImageGeneration.cancel")}),(0,n.jsxs)(A.Button,{startIcon:h&&!m?(0,n.jsx)(ee.Attachment,{className:"w-4 h-4"}):(0,n.jsx)(ee.AutoAwesome,{className:"w-4 h-4"}),onClick:E,variant:"contained",disabled:!c||c?.length<20,children:[a(h&&!m?"inputs.aiImageGeneration.insertImage":"inputs.aiImageGeneration.generateImage"),u&&(0,n.jsx)(A.CircularProgress,{size:16,className:"ml-2"})]})]})]})})]})}var Er=({children:t})=>(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.3rem"},children:t}),K4r=({imageUrl:t,alt:r="",blockId:a,onRemove:o})=>{const{t:s}=Ze("inspector"),u=hld(a??null);return t?(0,n.jsxs)(A.Box,{sx:{position:"relative",mb:1.5,borderRadius:1,overflow:"hidden",border:"1px solid",borderColor:"divider"},children:[(0,n.jsx)("img",{src:t,alt:r,style:{width:"100%",display:"block",maxHeight:140,objectFit:"cover"}}),o&&(0,n.jsx)(A.IconButton,{"aria-label":s("inputs.common.close"),onClick:o,size:"small",sx:{position:"absolute",top:4,right:4,backgroundColor:"background.paper",color:"error.main",width:28,height:28,"&:hover":{backgroundColor:"error.50"}},children:(0,n.jsx)(ee.Close,{fontSize:"small"})}),u&&(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:.5,px:1,py:.5,bgcolor:"#1a1a1a",color:"#ccc",fontSize:"0.65rem"},children:[(0,n.jsx)(ee.CameraAltOutlined,{sx:{fontSize:"0.8rem",flexShrink:0,color:"#ccc"}}),(0,n.jsx)(L$,{t:s,i18nKey:"inputs.unsplash.creditLine",values:{author:u.photographerName},components:{authorLink:(0,n.jsx)(A.Link,{href:u.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:(0,n.jsx)(A.Link,{href:u.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},Cld=["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"],i2={style:{color:"currentColor"},width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l2={stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"},iJ=(0,n.jsx)("svg",{...i2,children:(0,n.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",...l2})});function d9(t){switch(t){case"top left":return(0,n.jsx)("svg",{...i2,children:(0,n.jsx)("path",{d:"M5.26523 9.79159L5.17094 5.17183M5.17094 5.17183L9.79071 5.26611M5.17094 5.17183L10.8278 10.8287",...l2})});case"top center":return(0,n.jsx)("svg",{...i2,children:(0,n.jsx)("path",{d:"M4.7998 7.33333L7.9998 4M7.9998 4L11.1998 7.33333M7.9998 4V12",...l2})});case"top right":return(0,n.jsx)("svg",{...i2,children:(0,n.jsx)("path",{d:"M6.20841 5.2662L10.8282 5.17192M10.8282 5.17192L10.7339 9.79169M10.8282 5.17192L5.17132 10.8288",...l2})});case"center left":return(0,n.jsx)("svg",{...i2,children:(0,n.jsx)("path",{d:"M7.33333 11.2002L4 8.00019M4 8.00019L7.33333 4.8002M4 8.00019L12 8.0002",...l2})});case"center":case"center center":return iJ;case"center right":return(0,n.jsx)("svg",{...i2,children:(0,n.jsx)("path",{d:"M8.66667 4.7998L12 7.9998M12 7.9998L8.66667 11.1998M12 7.9998L4 7.9998",...l2})});case"bottom left":return(0,n.jsx)("svg",{...i2,children:(0,n.jsx)("path",{d:"M9.79062 10.7348L5.17085 10.8291M5.17085 10.8291L5.26513 6.20929M5.17085 10.8291L10.8277 5.1722",...l2})});case"bottom center":return(0,n.jsx)("svg",{...i2,children:(0,n.jsx)("path",{d:"M11.1998 8.66667L7.9998 12M7.9998 12L4.7998 8.66667M7.9998 12L7.99981 4",...l2})});case"bottom right":return(0,n.jsx)("svg",{...i2,children:(0,n.jsx)("path",{d:"M10.7338 6.20938L10.8281 10.8291M10.8281 10.8291L6.20831 10.7349M10.8281 10.8291L5.17122 5.17229",...l2})});default:return iJ}}function c9(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"}}j_();function Y4r(t){return(0,n.jsx)(ea,{viewBox:"0 0 18 18",fontSize:"small",...t,children:(0,n.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"})})}yn();var Mld=({defaultValue:t,onChange:r,values:a})=>{const o=F.useSelectedBlockId(),{t:s}=Ze("inspector");$1();const u=Z=>{if(!Z)return{url:"",repeat:"no-repeat",position:"center center",size:"cover"};const se=Z.trim();let J="";if(se.startsWith("url(")){const ge=se.match(/^url\(\s*['"]?([^'")]+)['"]?\s*\)/);J=ge?ge[1]:""}else(/^https?:\/\//i.test(se)||se.startsWith("data:"))&&(J=se);let X="no-repeat";Z.includes("repeat-x")?X="repeat-x":Z.includes("repeat-y")?X="repeat-y":Z.includes("repeat")&&!Z.includes("no-repeat")&&(X="repeat");let oe="center center";for(const ge of["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"])if(Z.includes(ge)){oe=ge;break}let ie="cover";return Z.includes("contain")?ie="contain":Z.includes("auto")&&(ie="auto"),{url:J,repeat:X,position:oe,size:ie}},d=Z=>Z.url?`url("${Z.url}") ${Z.repeat} ${Z.position} / ${Z.size}`:"",[c,_]=(0,y.useState)(t||null),[h,p]=(0,y.useState)(u(t)),[m,f]=(0,y.useState)(!1),[v,S]=(0,y.useState)(()=>!!window.__emailBuilderEnableAI),[,g]=(0,y.useState)(null),[b,T]=(0,y.useState)(u(t).url||""),[M,O]=(0,y.useState)(!1),[x,w]=(0,y.useState)(""),[R,j]=(0,y.useState)(!1),P=(0,y.useRef)(null),[H,L]=(0,y.useState)(null),E=F.useBackgroundUrlInput(),z=F.useBackgroundUploadInput(),V=E||z,[k,D]=(0,y.useState)(()=>!!window.__emailBuilderUnsplashEnabled);(0,y.useEffect)(()=>{const Z=()=>{D(!!window.__emailBuilderUnsplashEnabled)};return Z(),window.addEventListener("email-builder-unsplash-updated",Z),()=>window.removeEventListener("email-builder-unsplash-updated",Z)},[]),(0,y.useEffect)(()=>{const Z=window.__emailBuilderCustomImageProvider;Z&&(L(Z),setTimeout(()=>{o&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:o,currentImageUrl:h.url||null,alt:null,source:"background"}}))},100))},[]);const[N,I]=(0,y.useState)(()=>sessionStorage.getItem("hideBackgroundImageWarning")==="true"),B=(Z,se)=>{const J={...h,...Z};if(p(J),J.url){const X=d(J);_(X),r(X,se)}else console.error("Update params error: ",J)},q=(Z,se)=>{if(!Z)return!1;const J=Z?.toLowerCase(),X=J.includes(".svg")||J.includes("svg"),oe=se&&(se.includes("image/svg+xml")||se.includes("svg"));return X||!!oe},te=async Z=>{try{O(!0),w(""),j(!1);try{new URL(Z)}catch{return w("Invalid URL format"),!1}const se=new AbortController,J=setTimeout(()=>se.abort(),1e4);try{const X=await fetch(Z,{method:"HEAD",signal:se.signal});if(clearTimeout(J),!X.ok)return w(`HTTP ${X.status}: ${X.statusText}`),!1;const oe=X.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(ie=>oe&&oe.toLowerCase().includes(ie.toLowerCase()))?(q(Z,oe)&&j(!0),w(""),!0):(w("URL does not point to an image"),!1)}catch(X){return clearTimeout(J),X.name==="AbortError"?(w("Request timeout - URL took too long to respond"),!1):new Promise(oe=>{const ie=new Image,ge=setTimeout(()=>{w("Request timeout - URL took too long to respond"),oe(!1)},1e4);ie.onload=()=>{clearTimeout(ge),q(Z)&&j(!0),w(""),oe(!0)},ie.onerror=()=>{clearTimeout(ge),w("Cannot access image - CORS policy, network error, or invalid URL"),oe(!1)},ie.src=Z})}}catch{return w("Unexpected error occurred while validating URL"),!1}finally{O(!1)}},$=async()=>{b.trim()&&await te(b.trim())&&(B({url:b.trim()}),o&&cd(o))},W=Z=>{Z.key==="Enter"&&$()},_e=Z=>{T(Z.target.value),x&&w(""),R&&j(!1)},Y=Z=>{const se=["image/png","image/jpeg","image/gif"],X=Array.isArray(Z)?Z:Array.from(Z),oe=X.filter(ge=>se.includes(ge.type)&&ge.size<=5242880);if(oe.length!==X.length&&alert(s("inputs.common.invalidFiles")),oe.length===0)return;const ie=oe.map(ge=>new Promise(be=>{const Ge=new FileReader;Ge.onload=Qe=>be(Qe.target?.result),Ge.readAsDataURL(ge)}));Promise.all(ie).then(ge=>{const be={images:ge,id:o||"",styles:a};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:be})),F.setImageUploading(!0,o||"")})},re=Z=>{Z.preventDefault(),f(!0)},Q=()=>{f(!1)},le=Z=>{Z.preventDefault(),f(!1);const se=Z.dataTransfer.files;Y(se)},ce=()=>{p({url:"",repeat:"no-repeat",position:"center center",size:"cover"}),_(null),r(null),T(""),j(!1)};return(0,y.useEffect)(()=>{const Z=window.__emailBuilderEnableAI;Z!==void 0&&S(!!Z);const se=J=>{const{detail:X}=J;S(!!X)};return window.addEventListener("email-builder-ai-generation",se),()=>{window.removeEventListener("email-builder-ai-generation",se)}},[]),(0,y.useEffect)(()=>{const Z=oe=>{const{detail:ie}=oe;F.setImageUploading(!1,ie.id||""),B({url:ie.url},ie.styles),o&&cd(o),F.setDisableEdition(!1),T(ie.url)},se=oe=>{F.setImageUploading(oe?.detail?.uploading??!1,oe?.detail?.id??"")},J=()=>{P?.current?.click()},X=oe=>{const ie=oe.detail;if(typeof ie=="string"){if(!ie.includes("url("))B({url:ie}),T(ie);else{const ge=u(ie);p(ge),_(ie),r(ie),T(ge.url)}return}ie?.url!=null&&typeof ie.url=="string"&&(B({url:ie.url},ie.styles),T(ie.url))};return window.addEventListener("email-builder-set-image",X),window.addEventListener("email-builder-upload-image-receive",Z),window.addEventListener("email-builder-upload-file",J),window.addEventListener("email-builder-toggle-upload-file",se),()=>{window.removeEventListener("email-builder-upload-image-receive",Z),window.removeEventListener("email-builder-set-image",X),window.removeEventListener("email-builder-upload-file",J),window.removeEventListener("email-builder-toggle-upload-file",se)}},[h]),(0,y.useEffect)(()=>{t&&j(q(h.url))},[t,h.url]),(0,y.useEffect)(()=>{if(t!==c){const Z=u(t);p(Z),_(t||null),T(Z.url||"")}},[t]),(0,n.jsxs)(Er,{children:[(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,n.jsx)(_1,{label:s("inputs.backgroundImage.label")}),!N&&(0,n.jsx)(A.Tooltip,{title:s("inputs.backgroundImage.warningTooltip"),placement:"top",children:(0,n.jsx)(A.IconButton,{size:"small",color:"warning",disableRipple:!0,sx:{p:0,cursor:"help",lineHeight:0,"&:hover":{backgroundColor:"transparent"}},children:(0,n.jsx)(Y4r,{"aria-hidden":!0})})})]}),(0,n.jsx)(K4r,{imageUrl:h.url||null,blockId:o,onRemove:ce}),(0,n.jsx)(U4r,{tabs:[{key:"gallery",label:s("inputs.tabs.gallery"),visible:k,render:()=>(0,n.jsx)(G4r,{blockId:o,source:"background"})},{key:"yourGallery",label:s("inputs.tabs.yourGallery"),visible:!!H,render:()=>(0,n.jsx)(A.Box,{sx:{mb:2},children:H})},{key:"upload",label:s("inputs.tabs.upload"),visible:V,render:()=>(0,n.jsxs)(A.Stack,{spacing:1,children:[(0,n.jsx)(A.Box,{children:E&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_1,{label:s("inputs.image.urlLabel")}),(0,n.jsxs)(A.Stack,{direction:"row",spacing:1,children:[(0,n.jsx)(A.TextField,{fullWidth:!0,placeholder:s("inputs.image.urlPlaceholder"),value:b,onChange:_e,onKeyPress:W,disabled:M,sx:$o}),(0,n.jsx)(A.Button,{variant:"contained",onClick:$,disabled:!b.trim()||M,sx:{minWidth:"auto",px:2,position:"relative"},children:M?(0,n.jsx)(A.CircularProgress,{size:20,color:"inherit"}):s("inputs.common.add")})]}),x&&(0,n.jsx)(A.Alert,{severity:"error",sx:{mt:1,fontSize:"0.875rem",maxHeight:"70px"},children:x}),R&&(0,n.jsx)(A.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:(0,n.jsx)(A.IconButton,{"aria-label":s("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{j(!1)},children:(0,n.jsx)(ee.Close,{fontSize:"inherit"})}),children:s("inputs.common.svgWarning")})]})}),E&&z&&(0,n.jsxs)(A.Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,n.jsx)(A.Divider,{sx:{flexGrow:1}}),(0,n.jsx)(A.Typography,{variant:"caption",sx:{color:"text.secondary"},children:s("inputs.backgroundImage.or")}),(0,n.jsx)(A.Divider,{sx:{flexGrow:1}})]}),z&&(0,n.jsxs)(A.Box,{onDragOver:re,onDragLeave:Q,onDrop:le,sx:{width:"100%",border:"2px dashed",borderColor:m?"primary.main":"divider",borderRadius:"8px",padding:"24px 8px 36px 8px",textAlign:"center",bgcolor:m?"primary.50":"background.paper",transition:"all 0.2s ease"},children:[(0,n.jsx)(A.Box,{sx:{display:"flex",justifyContent:"center"},children:(0,n.jsx)(ee.PhotoOutlined,{sx:{fontSize:32,color:"primary"}})}),(0,n.jsxs)("label",{style:{cursor:"pointer"},children:[(0,n.jsx)("input",{ref:P,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:Z=>{const se=Z.target.files;se&&se.length>0&&Y(Array.from(se))}}),(0,n.jsx)(A.Typography,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:s("inputs.common.uploadFile")}),(0,n.jsxs)(A.Typography,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",s("inputs.common.dragAndDrop")]})]}),(0,n.jsx)(A.Typography,{variant:"body2",sx:{color:"text.secondary",mt:1},children:s("inputs.common.fileInfo")})]})]})},{key:"generate",label:s("inputs.tabs.generate"),visible:v,render:()=>(0,n.jsx)(q4r,{src:h.url,style:{width:"100%",margin:0}})}],defaultTab:"upload"}),h.url&&(0,n.jsxs)(A.Box,{sx:{mt:2},children:[(0,n.jsxs)(A.Box,{sx:{mb:2},children:[(0,n.jsx)(_1,{label:s("inputs.backgroundImage.fillType")}),(0,n.jsxs)(A.ToggleButtonGroup,{value:h.size,exclusive:!0,onChange:(Z,se)=>{se!=null&&typeof se=="string"&&B({size:se})},size:"small",fullWidth:!0,children:[(0,n.jsx)(A.ToggleButton,{value:"cover",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.Crop,{fontSize:"small"}),(0,n.jsx)("span",{children:s("inputs.backgroundImage.fillOptions.cover")})]})}),(0,n.jsx)(A.ToggleButton,{value:"contain",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.FitScreen,{fontSize:"small"}),(0,n.jsx)("span",{children:s("inputs.backgroundImage.fillOptions.contain")})]})}),(0,n.jsx)(A.ToggleButton,{value:"auto",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.AspectRatio,{fontSize:"small"}),(0,n.jsx)("span",{children:s("inputs.backgroundImage.fillOptions.auto")})]})})]})]}),(0,n.jsxs)(A.Stack,{direction:"row",spacing:2,sx:{mb:2},children:[(0,n.jsxs)("div",{style:{flex:1},children:[(0,n.jsx)(_1,{label:s("inputs.backgroundImage.repeat")}),(0,n.jsxs)(Oa,{style:{width:"100%"},value:h.repeat,size:"small",onChange:Z=>B({repeat:Z.target.value}),children:[(0,n.jsx)(A.MenuItem,{value:"no-repeat",children:s("inputs.backgroundImage.repeatOptions.none")}),(0,n.jsx)(A.MenuItem,{value:"repeat",children:s("inputs.backgroundImage.repeatOptions.repeat")}),(0,n.jsx)(A.MenuItem,{value:"repeat-x",children:s("inputs.backgroundImage.repeatOptions.repeatX")}),(0,n.jsx)(A.MenuItem,{value:"repeat-y",children:s("inputs.backgroundImage.repeatOptions.repeatY")})]})]}),(0,n.jsxs)("div",{style:{flex:1},children:[(0,n.jsx)(_1,{label:s("inputs.backgroundImage.position")}),(0,n.jsx)(Oa,{style:{width:"100%"},value:h.position,size:"small",onChange:Z=>B({position:Z.target.value}),renderValue:Z=>{const se=String(Z??"");return(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[d9(se),s(`inputs.backgroundImage.positions.${c9(se)}`)]})},children:["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"].map(Z=>(0,n.jsx)(A.MenuItem,{sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important "},value:Z,children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[d9(Z),s(`inputs.backgroundImage.positions.${c9(Z)}`)]})},Z))})]})]})]}),!H&&R&&(0,n.jsx)(A.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},children:s("inputs.common.svgWarning")})]})};function lA({label:t,labelAction:r,defaultValue:a,onChange:o,nullable:s,compact:u=!1,inheritedFrom:d}){const[c,_]=(0,y.useState)(null),[h,p]=(0,y.useState)(a),{t:m}=Ze("inspector");(0,y.useEffect)(()=>{h!==a&&p(a)},[a]);const f=M=>{_(M.currentTarget)},v=u?{border:"1px solid",borderColor:"cadet.400",width:28,height:28,borderRadius:"6px",bgcolor:"#FFFFFF"}:{border:t?"1px solid":"",borderColor:"cadet.400",width:"100%",height:36,paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",borderRadius:"6px",bgcolor:"#FFFFFF"},S=M=>{p(M),o(M)},g=()=>!s||typeof h!="string"||h.trim().length===0?null:(0,n.jsx)(A.Tooltip,{title:m("inputs.background.reset"),placement:"left",children:(0,n.jsx)(A.Box,{sx:{minWidth:24,lineHeight:1,flexShrink:0,pr:"4px",display:"grid",placeItems:"center"},onClick:()=>S(null),children:(0,n.jsx)(ee.FormatColorReset,{sx:{color:"primary.main"}})})}),b=h?(0,n.jsx)(A.ButtonBase,{onClick:f,sx:{...v,bgcolor:h}}):(0,n.jsx)(A.ButtonBase,{onClick:f,sx:{...v},children:(0,n.jsx)(ee.AddOutlined,{fontSize:"small"})}),T=(0,n.jsx)(A.Menu,{anchorEl:c,open:!!c,onClose:()=>_(null),sx:{"& .MuiPaper-root":{boxShadow:"0 4px 6px rgba(0, 0, 0, 0.4);",borderRadius:1,maxWidth:"200px",transform:"translateX(-100%) !important;"}},slotProps:{list:{sx:{height:"auto",padding:0}}},children:(0,n.jsx)(Bw,{value:h||"",nullable:s,onChange:M=>S(M)})});return u?(0,n.jsxs)(A.Box,{sx:{display:"inline-flex",opacity:d?.55:1,transition:"opacity 120ms ease-out"},children:[b,T]}):(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:t,action:r}),(0,n.jsxs)(A.Stack,{direction:"row",spacing:1,sx:{alignContent:"center",opacity:d?.55:1,transition:"opacity 120ms ease-out"},children:[b,g()]}),T]})}function Au(t){return(0,n.jsx)(lA,{...t,nullable:!1})}function dm(t){return(0,n.jsx)(lA,{...t,nullable:!0})}yn();var xld=G(A.Box)(({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}`}})),Old=G("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"}})),lJ=G(A.IconButton)(({theme:t})=>({padding:"0",color:t.palette.primary.main,"&:hover":{backgroundColor:ut(t.palette.primary.main,.04)},"& .MuiSvgIcon-root":{fontSize:14}}));function _r({iconLabel:t,label:r,value:a,setValue:o,units:s,min:u=0,max:d,step:c=void 0,marks:_=!0,...h}){const p=a??u,[m,f]=(0,y.useState)(p.toString()),v=x=>{let w=x;w<u&&(w=u),d!==void 0&&w>d&&(w=d),o(w),f(w.toString())},S=x=>{const w=x.target.value;if(f(w),w!==""){const R=Number(w);isNaN(R)||R>=u&&o(R)}},g=()=>{if(m===""||isNaN(Number(m)))f(p.toString());else{const x=Number(m);v(x)}},b=x=>{x.key==="Enter"&&g()};(0,y.useEffect)(()=>{f((a??u).toString())},[a,u]);const T=()=>{const x=p+1;v(x)},M=()=>{const x=p-1;v(x)},O=(x,w)=>{typeof w=="number"&&o(w)};return(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:r}),(0,n.jsxs)(A.Stack,{direction:"row",spacing:2,sx:{alignItems:"center",justifyContent:"space-between",width:"100%",gap:"1rem"},children:[(0,n.jsx)(A.Box,{sx:{minWidth:24,lineHeight:1,flexShrink:0},children:t}),(0,n.jsx)(A.Slider,{...h,value:p,min:u,max:d||1e3,step:c,color:"primary",marks:_,onChange:O}),(0,n.jsxs)(xld,{children:[(0,n.jsx)(Old,{type:"number",value:m,onChange:S,onBlur:g,onKeyDown:b,min:u,max:d,step:c}),(0,n.jsxs)(A.Box,{sx:{display:"flex",flexDirection:"column",ml:.5},children:[(0,n.jsx)(lJ,{onClick:T,disabled:d!==void 0&&p>=d,children:(0,n.jsx)("svg",{width:"15",height:"10",viewBox:"0 0 24 12",children:(0,n.jsx)("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})}),(0,n.jsx)(lJ,{onClick:M,disabled:p<=u,children:(0,n.jsx)("svg",{width:"15",height:"10",viewBox:"0 0 24 12",style:{transform:"rotate(180deg)"},children:(0,n.jsx)("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})})]})]}),(0,n.jsx)(A.Typography,{variant:"caption",color:"text.secondary",sx:{fontSize:"16px",ml:"4px!important"},children:s})]})]})}function Z5({label:t,defaultValue:r,onChange:a,...o}){const[s,u]=(0,y.useState)(r??0);return r!=s&&u(r),(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:t}),(0,n.jsx)(_r,{value:s??0,setValue:d=>{u(d),a(d)},...o})]})}var Vy=({mobile:t=!1,label:r,borderColor:a,borderTop:o,borderBottom:s,borderLeft:u,borderRight:d,onChange:c,sidesLinked:_,onSidesLinkedChange:h})=>{const{t:p}=Ze("inspector"),m=()=>t?{top:"borderTopMobile",bottom:"borderBottomMobile",left:"borderLeftMobile",right:"borderRightMobile"}:{top:"borderTop",bottom:"borderBottom",left:"borderLeft",right:"borderRight"},f=H=>{const L=Object.values(H);return L.every(E=>E===L[0])},v=m(),S={[v.top]:o??0,[v.bottom]:s??0,[v.left]:u??0,[v.right]:d??0},[g,b]=(0,y.useState)(a??"#000000"),[T,M]=(0,y.useState)(S),O={[v.top]:Number(T[v.top]),[v.bottom]:Number(T[v.bottom]),[v.left]:Number(T[v.left]),[v.right]:Number(T[v.right])},x=_!==void 0?_:f(O);(0,y.useEffect)(()=>{a!==g&&b(a??"#000000");const H={[v.top]:o??0,[v.bottom]:s??0,[v.left]:u??0,[v.right]:d??0};Object.keys(H).some(L=>T[L]!==H[L])&&M(H)},[a,o,s,u,d,t]);const w=()=>{if(x)h(!1);else{const H=T[v.top]??0;j(H),h(!0)}},R=H=>{b(H),c({borderColor:H,...T})},j=H=>{const L={[v.top]:H,[v.bottom]:H,[v.left]:H,[v.right]:H};M(L),c({...L,borderColor:g})},P=(H,L)=>{M(E=>({...E,[L]:H})),c({...T,borderColor:g,[L]:H})};return(0,n.jsxs)("div",{children:[(0,n.jsxs)(A.Stack,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center",width:"100%"},children:[(0,n.jsx)(_1,{label:r}),(0,n.jsxs)(A.Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,n.jsx)(Au,{defaultValue:g,onChange:R,compact:!0}),(0,n.jsx)(A.Tooltip,{title:p(x?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:(0,n.jsx)(A.IconButton,{size:"small",onClick:w,sx:{color:x?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:x?(0,n.jsx)(ee.Lock,{fontSize:"small"}):(0,n.jsx)(ee.LockOpen,{fontSize:"small"})})})]})]}),x&&(0,n.jsx)(Z5,{label:"",iconLabel:(0,n.jsx)(ee.BorderOuterOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:T[v.top],onChange:j}),!x&&(0,n.jsxs)(A.Stack,{spacing:2,children:[(0,n.jsx)(Z5,{label:"",iconLabel:(0,n.jsx)(ee.BorderTopOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:T[v.top],onChange:H=>P(H,v.top)}),(0,n.jsx)(Z5,{label:"",iconLabel:(0,n.jsx)(ee.BorderBottomOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:T[v.bottom],onChange:H=>P(H,v.bottom)}),(0,n.jsx)(Z5,{label:"",iconLabel:(0,n.jsx)(ee.BorderLeftOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:T[v.left],onChange:H=>P(H,v.left)}),(0,n.jsx)(Z5,{label:"",iconLabel:(0,n.jsx)(ee.BorderRightOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:T[v.right],onChange:H=>P(H,v.right)})]})]})};function Ft({icon:t,label:r,children:a,modified:o=!1}){const s=mo(),[u,d]=(0,y.useState)(!1),c=(0,y.useRef)(null);return s?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(A.Tooltip,{title:r,placement:"left",children:(0,n.jsxs)(A.Box,{sx:{position:"relative",display:"inline-flex",alignSelf:"center"},children:[(0,n.jsx)(A.IconButton,{ref:c,onClick:()=>d(!u),color:u?"primary":"default",size:"small",sx:{borderRadius:1.5,width:32,height:32},children:(0,n.jsx)(t,{fontSize:"small"})}),o&&(0,n.jsx)(A.Box,{component:"span","aria-hidden":!0,sx:_=>({position:"absolute",top:2,right:2,width:5,height:5,borderRadius:"50%",bgcolor:(0,A.alpha)(_.palette.primary.main,.55),pointerEvents:"none"})})]})}),(0,n.jsx)(A.Popover,{open:u,anchorEl:c.current,onClose:()=>d(!1),anchorOrigin:{vertical:"center",horizontal:"left"},transformOrigin:{vertical:"center",horizontal:"right"},slotProps:{paper:{sx:_=>({width:360,p:2,borderRadius:2,backgroundColor:_.palette.background.paper,border:`1px solid ${_.palette.divider}`,boxShadow:"0 8px 32px rgba(0,0,0,0.12)",transform:"translateX(-18px) !important",overflow:"visible","&::after":{content:'""',position:"absolute",right:-5,top:"50%",transform:"translateY(-50%)",width:0,height:0,borderTop:"5px solid transparent",borderBottom:"5px solid transparent",borderLeft:`5px solid ${_.palette.divider}`},"&::before":{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 ${_.palette.background.paper}`,zIndex:1}})}},children:a})]}):o?(0,n.jsxs)(A.Box,{sx:{position:"relative"},children:[a,(0,n.jsx)(A.Box,{component:"span","aria-hidden":!0,sx:_=>({position:"absolute",top:4,left:-10,width:5,height:5,borderRadius:"50%",bgcolor:(0,A.alpha)(_.palette.primary.main,.55),pointerEvents:"none"})})]}):(0,n.jsx)(n.Fragment,{children:a})}var wld=Ae.FONT_FAMILIES.map(t=>(0,n.jsx)(A.MenuItem,{value:t.key,sx:{fontFamily:t.value},children:t.label},t.key));function sA({label:t,labelAction:r,onChange:a,defaultValue:o}){const s="INHERIT",[u,d]=(0,y.useState)(o??s);(0,y.useEffect)(()=>{u!==o&&d(o??s)},[o]);const c=h=>{const p=h.target.value;d(p),a(p===null?null:p)},_=Ae.FONT_FAMILIES.find(h=>h.key===u)?.value;return(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:t,action:r}),(0,n.jsx)(Oa,{style:{width:"100%",fontFamily:_},value:u,size:"small",onChange:c,children:wld})]})}function _9({label:t,labelAction:r,defaultValue:a=16,onChange:o,maxValue:s,minValue:u,step:d,inheritedFrom:c}){const[_,h]=(0,y.useState)(a);(0,y.useEffect)(()=>{_!==a&&h(a)},[a]);const p=m=>{h(m),o(m)};return(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:t,action:r}),(0,n.jsx)(A.Box,{sx:{opacity:c?.55:1,transition:"opacity 120ms ease-out"},children:(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.TextFieldsOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:_,setValue:p,units:"px",step:d??2,min:u||8,max:s||48})})]})}function bc({label:t,labelAction:r,children:a,defaultValue:o,onChange:s}){const[u,d]=(0,y.useState)(o);return(0,y.useEffect)(()=>{o!==u&&d(o)},[o]),(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:t,action:r}),(0,n.jsx)(A.Box,{sx:{...kT,paddingLeft:"0px",paddingRight:"0px"},children:(0,n.jsx)(A.ToggleButtonGroup,{exclusive:!0,fullWidth:!0,value:u,size:"small",sx:{width:"100%"},onChange:(c,_)=>{if(typeof _!="string")throw new Error("RadioGroupInput can only receive string values");d(_),s(_)},children:a})})]})}function Q4r({label:t,labelAction:r,defaultValue:a,onChange:o}){const{t:s}=Ze("inspector"),[u,d]=(0,y.useState)(a);return(0,y.useEffect)(()=>{u!==a&&d(a)},[a]),(0,n.jsxs)(bc,{label:t,labelAction:r,defaultValue:u,onChange:c=>{d(c),o(c)},children:[(0,n.jsx)(A.ToggleButton,{value:"normal",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.TextFields,{fontSize:"small"}),(0,n.jsx)("span",{children:s("inputs.fontWeightToggle.regular")})]})}),(0,n.jsx)(A.ToggleButton,{value:"bold",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.FormatBold,{fontSize:"small"}),(0,n.jsx)("span",{children:s("inputs.fontWeightToggle.bold")})]})})]})}var ky=({label:t,defaultValue:r,onChange:a,min:o=1,max:s=100,step:u=1})=>{const{t:d}=Ze("inspector");return(0,n.jsx)(_r,{label:t??d("inputs.common.height"),iconLabel:(0,n.jsx)(ee.HeightOutlined,{sx:{color:"text.secondary"}}),units:"px",step:u,min:o,max:s,marks:!1,value:r??o,setValue:a})},Ald=[{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)"}].map(t=>(0,n.jsx)(A.MenuItem,{value:t.key,children:t.label},t.key));function Rld({label:t,onChange:r,defaultValue:a}){const o="INHERIT",[s,u]=(0,y.useState)(a?.toString()??o);(0,y.useEffect)(()=>{s!==a?.toString()&&u(a?.toString()??o)},[a]);const d=c=>{const _=c.target.value;u(_),r(_===o?null:parseFloat(_))};return(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:t}),(0,n.jsxs)(Oa,{style:{width:"100%"},value:s,size:"small",onChange:d,children:[(0,n.jsx)(A.MenuItem,{value:o,children:"Default value"}),Ald]})]})}function zld(t){return(0,n.jsxs)(A.SvgIcon,{...t,viewBox:"0 0 16 16",children:[(0,n.jsx)("path",{fill:"currentColor",d:"M0 0v16h16V0zm15 3h-1v1h1v11H1V3h1V2H1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1V1h1v1h1z"}),(0,n.jsx)("path",{fill:"currentColor",d:"M3 2h1v1H3zM2 3h1v1H2zm2 0h1v1H4zm2 0h1v1H6zM5 2h1v1H5zm2 0h1v1H7zm2 0h1v1H9zM8 3h1v1H8zm2 0h1v1h-1zm2 0h1v1h-1zm-1-1h1v1h-1zm2 0h1v1h-1z"})]})}function jld(t){return(0,n.jsxs)(A.SvgIcon,{...t,viewBox:"0 0 16 16",children:[(0,n.jsx)("path",{fill:"currentColor",d:"M16 16V0H0v16zM1 13h1v-1H1V1h14v12h-1v1h1v1h-1v-1h-1v1h-1v-1h-1v1h-1v-1H9v1H8v-1H7v1H6v-1H5v1H4v-1H3v1H2v-1H1z"}),(0,n.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 Pld(t){return(0,n.jsxs)(A.SvgIcon,{...t,viewBox:"0 0 16 16",children:[(0,n.jsx)("path",{fill:"currentColor",d:"M0 16h16V0H0zM3 1v1h1V1h11v14H3v-1H2v1H1v-1h1v-1H1v-1h1v-1H1v-1h1V9H1V8h1V7H1V6h1V5H1V4h1V3H1V2h1V1z"}),(0,n.jsx)("path",{fill:"currentColor",d:"M2 12h1v1H2zm1 1h1v1H3zm0-2h1v1H3zm0-2h1v1H3zm-1 1h1v1H2zm0-2h1v1H2zm0-2h1v1H2zm1 1h1v1H3zm0-2h1v1H3zm0-2h1v1H3zM2 4h1v1H2zm0-2h1v1H2z"})]})}function Hld(t){return(0,n.jsxs)(A.SvgIcon,{...t,viewBox:"0 0 16 16",children:[(0,n.jsx)("path",{fill:"currentColor",d:"M16 0H0v16h16zm-3 15v-1h-1v1H1V1h12v1h1V1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1h1v1h-1v1z"}),(0,n.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"})]})}var h9=(t=>(0,n.jsxs)(A.SvgIcon,{...t,viewBox:"0 0 16 16",children:[(0,n.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"}),(0,n.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"})]}));h9.muiName="PaddingIcon";function Dy({label:t,labelAction:r,defaultValue:a,onChange:o,sidesLinked:s,onSidesLinkedChange:u,inheritedFrom:d}){const{t:_}=Ze("inspector"),[h,p]=(0,y.useState)(()=>a||{top:0,left:0,bottom:0,right:0});(0,y.useEffect)(()=>{a&&(a.top!==h.top||a.left!==h.left||a.bottom!==h.bottom||a.right!==h.right)&&p(a)},[a]);const m=h.top===h.bottom&&h.top===h.left&&h.top===h.right,f=s===!0&&m;function v(g,b){let T;f?T={top:b,bottom:b,left:b,right:b}:T={...h,[g]:b},p(T),o(T)}const S=()=>{const g=!f;if(!f){const b={top:h.top,bottom:h.top,left:h.top,right:h.top};p(b),o(b)}u(g)};return(0,n.jsxs)(Er,{children:[(0,n.jsxs)(A.Stack,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center",width:"100%"},children:[(0,n.jsx)(_1,{label:t,action:r}),(0,n.jsx)(A.Tooltip,{title:_(f?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:(0,n.jsx)(A.IconButton,{size:"small",onClick:S,sx:{marginTop:"0!important",color:f?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:f?(0,n.jsx)(ee.Lock,{fontSize:"small"}):(0,n.jsx)(ee.LockOpen,{fontSize:"small"})})})]}),(0,n.jsx)(A.Stack,{spacing:1,sx:{opacity:d?.55:1,transition:"opacity 120ms ease-out"},children:f?(0,n.jsx)(_r,{iconLabel:(0,n.jsx)("span",{children:_("inputs.responsiveSize.allSides")}),value:h.top,setValue:g=>v("top",g),units:"px",step:16,min:0,max:120,marks:!0}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(zld,{sx:{fontSize:16,color:"text.primary"}}),value:h.top,setValue:g=>v("top",g),units:"px",step:16,min:0,max:120,marks:!0}),(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(jld,{sx:{fontSize:16,color:"text.primary"}}),value:h.bottom,setValue:g=>v("bottom",g),units:"px",step:16,min:0,max:120,marks:!0}),(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(Pld,{sx:{fontSize:16,color:"text.primary"}}),value:h.left,setValue:g=>v("left",g),units:"px",step:16,min:0,max:120,marks:!0}),(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(Hld,{sx:{fontSize:16,color:"text.primary"}}),value:h.right,setValue:g=>v("right",g),units:"px",step:16,min:0,max:120,marks:!0})]})})]})}var Lld=({label:t,defaultValue:r,onChange:a,maxValue:o=600,shapeSteps:s=8,cornersLinked:u,onCornersLinkedChange:d})=>{const{t:c}=Ze("inspector"),[_,h]=(0,y.useState)(()=>typeof r=="object"&&r!==null?"rounded":r||"rectangle"),[p,m]=(0,y.useState)(()=>typeof r=="object"&&r!==null?r:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0}),f=u===!0;(0,y.useEffect)(()=>{typeof r=="object"&&r!==null?(m(r),h("rounded")):(r==="rectangle"||r==="pill")&&h(r)},[r]);const v=T=>{const M=T;h(M),a(M==="rounded"?p:M)},S=(T,M)=>{let O;f?O={topLeft:M,topRight:M,bottomLeft:M,bottomRight:M}:O={...p,[T]:M},m(O),a(O)},g=()=>{const T=!f;if(!f){const M={topLeft:p.topLeft,topRight:p.topLeft,bottomLeft:p.topLeft,bottomRight:p.topLeft};m(M),a(M)}d(T)},b=typeof o=="number"?o:Number(o)||600;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(bc,{label:t||c("shape.label"),defaultValue:_,onChange:v,children:[(0,n.jsx)(A.ToggleButton,{value:"rectangle",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.CropSquare,{fontSize:"small"}),(0,n.jsx)("span",{children:c("shape.square")})]})}),(0,n.jsx)(A.ToggleButton,{value:"pill",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.PanoramaFishEye,{fontSize:"small"}),(0,n.jsx)("span",{children:c("shape.pill")})]})}),(0,n.jsx)(A.ToggleButton,{value:"rounded",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.RoundedCorner,{fontSize:"small"}),(0,n.jsx)("span",{children:c("shape.custom")})]})})]}),_==="rounded"&&(0,n.jsxs)(A.Stack,{spacing:2,sx:{alignItems:"flex-start",pb:1},children:[(0,n.jsxs)(A.Stack,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center",width:"100%"},children:[(0,n.jsx)(_1,{label:c("shape.borderRadius")}),(0,n.jsx)(A.Tooltip,{title:c(f?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:(0,n.jsx)(A.IconButton,{size:"small",onClick:g,sx:{marginTop:"0!important",color:f?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:f?(0,n.jsx)(ee.Lock,{fontSize:"small"}):(0,n.jsx)(ee.LockOpen,{fontSize:"small"})})})]}),f?(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.RoundedCorner,{sx:{fontSize:16}}),value:Number(p.topRight),setValue:T=>S("topLeft",T),units:"px",min:0,step:s,marks:s>1,max:b})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.RoundedCorner,{sx:{fontSize:16,transform:"rotate(0deg)"}}),value:Number(p.topLeft),setValue:T=>S("topLeft",T),units:"px",min:0,step:s,marks:s>1,max:b}),(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.RoundedCorner,{sx:{fontSize:16,transform:"rotate(270deg)"}}),value:Number(p.topRight),setValue:T=>S("topRight",T),units:"px",min:0,step:s,marks:s>1,max:b}),(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.RoundedCorner,{sx:{fontSize:16,transform:"rotate(180deg)"}}),value:Number(p.bottomLeft),setValue:T=>S("bottomLeft",T),units:"px",min:0,step:s,marks:s>1,max:b}),(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.RoundedCorner,{sx:{fontSize:16,transform:"rotate(90deg)"}}),value:Number(p.bottomRight),setValue:T=>S("bottomRight",T),units:"px",min:0,step:s,marks:s>1,max:b})]})]})]})};function Ny({label:t,labelAction:r,defaultValue:a,onChange:o}){const[s,u]=(0,y.useState)(a??"left");return(0,y.useEffect)(()=>{a!==s&&u(a??"left")},[a]),(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:t,action:r}),(0,n.jsxs)(bc,{label:"",defaultValue:s,onChange:d=>{u(d),o(d)},children:[(0,n.jsx)(A.ToggleButton,{value:"left",children:(0,n.jsx)(ee.FormatAlignLeftOutlined,{fontSize:"small"})}),(0,n.jsx)(A.ToggleButton,{value:"center",children:(0,n.jsx)(ee.FormatAlignCenterOutlined,{fontSize:"small"})}),(0,n.jsx)(A.ToggleButton,{value:"right",children:(0,n.jsx)(ee.FormatAlignRightOutlined,{fontSize:"small"})})]})]})}var sJ=({label:t,defaultValue:r,onChange:a,step:o,...s})=>{const{t:u}=Ze("inspector");return(0,n.jsx)(_r,{label:t??u("inputs.common.width"),iconLabel:(0,n.jsx)(ee.HeightOutlined,{sx:{color:"text.primary",transform:"rotate(90deg)"}}),units:"%",step:o,min:1,max:100,marks:!1,value:r??1,setValue:a,...s})},i6=(t=>(0,n.jsx)(A.SvgIcon,{...t,viewBox:"0 0 24 24",children:(0,n.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"})}));i6.muiName="FontFamilyIcon";var B3=(t=>(0,n.jsx)(A.SvgIcon,{...t,viewBox:"0 0 24 24",children:(0,n.jsxs)("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",children:[(0,n.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"}),(0,n.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"})]})}));B3.muiName="BackgroundColorIcon";var l6=(t=>(0,n.jsx)(A.SvgIcon,{...t,viewBox:"0 0 24 24",children:(0,n.jsxs)("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",children:[(0,n.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"}),(0,n.jsx)("rect",{width:"15.5",height:"4.353",x:"4.25",y:"16.897",rx:"1.5"})]})}));l6.muiName="TextColorIcon";function Eld({name:t,value:r,onChange:a,shapeMaxValue:o,shapeSteps:s}){const u=F.useSelectedScreenSize(),d=F.useRoot(),c=F.useBlockTypeSelected(),{t:_}=Ze("inspector"),h=T=>{if(!c)return r[T]??null;const M=u==="desktop"?"desktop":"mobile",O=d?.theme,x=F.resolveBlockProp({type:c,data:{style:r}},"style",T,O,M);return x!==void 0?x:I3[c]?.style?.[T]??null},p=T=>{if(r[T]!==void 0&&r[T]!==null||!c)return;const M=d?.theme?.blocks?.[c]?.style?.[T];if(M!=null)return"theme";const O=I3[c]?.style?.[T];return O!=null?"default":void 0},m=T=>h(T),f=(T,M)=>{const O=r[T],x=r[M];return O??x},v=(T,M)=>{a(M?{...r,...M,[t]:T}:{...r,[t]:T})},S=T=>{a({...r,...T})},b=(()=>{switch(t){case"textAlignMobile":return h("textAlignMobile")??h("textAlign");case"mobilePadding":return h("mobilePadding")??h("padding");case"fontSizeMobile":return h("fontSizeMobile")??h("fontSize")??16;case"heightMobile":return h("heightMobile")??h("height");case"widthMobile":return h("widthMobile")??h("width");case"borderMobile":return{borderTop:f("borderTopMobile","borderTop"),borderBottom:f("borderBottomMobile","borderBottom"),borderLeft:f("borderLeftMobile","borderLeft"),borderRight:f("borderRightMobile","borderRight")};default:return h(t)}})();switch(t){case"backgroundColor":return(0,n.jsx)(Ft,{icon:B3,label:_("properties.backgroundColor"),children:(0,n.jsx)(dm,{label:_("properties.backgroundColor"),defaultValue:b??d?.canvasColor,onChange:v})});case"background":return(0,n.jsx)(Ft,{icon:ee.WallpaperOutlined,label:_("properties.background","Background"),children:(0,n.jsx)(Mld,{defaultValue:b,onChange:(T,M)=>v(T,M),values:r})});case"borderColor":return(0,n.jsx)(Ft,{icon:B3,label:_("properties.border"),children:(0,n.jsx)(dm,{label:_("properties.border"),defaultValue:b,onChange:v})});case"borderRadius":return(0,n.jsx)(Ft,{icon:ee.RoundedCornerOutlined,label:_("properties.borderRadius"),children:(0,n.jsx)(Z5,{iconLabel:(0,n.jsx)(ee.RoundedCornerOutlined,{}),units:"px",step:4,marks:!0,min:0,max:48,label:_("properties.borderRadius"),defaultValue:b,onChange:v})});case"color":return(0,n.jsx)(Ft,{icon:ee.PaletteOutlined,label:_("properties.color"),children:(0,n.jsx)(dm,{label:_("properties.color"),defaultValue:b,onChange:v})});case"fontFamily":return(0,n.jsx)(Ft,{icon:i6,label:_("properties.fontFamily"),children:(0,n.jsx)(sA,{label:_("properties.fontFamily"),defaultValue:b,onChange:v})});case"fontWeight":return(0,n.jsx)(Ft,{icon:ee.FormatBoldOutlined,label:_("properties.fontWeight"),children:(0,n.jsx)(Q4r,{label:_("properties.fontWeight"),defaultValue:b,onChange:v})});case"textAlign":return u==="desktop"&&(0,n.jsx)(Ft,{icon:ee.FormatAlignCenterOutlined,label:_("properties.alignment"),children:(0,n.jsx)(Ny,{label:_("properties.alignment"),defaultValue:b,onChange:v})});case"textAlignMobile":return u!="desktop"&&(0,n.jsx)(Ft,{icon:ee.FormatAlignCenterOutlined,label:_("properties.alignment"),children:(0,n.jsx)(Ny,{label:_("properties.alignment"),defaultValue:b,onChange:v})});case"padding":return u==="desktop"&&(0,n.jsx)(Ft,{icon:h9,label:_("properties.padding"),children:(0,n.jsx)(Dy,{label:_("properties.padding"),defaultValue:h("padding"),inheritedFrom:p("padding"),onChange:v,sidesLinked:r.paddingSidesLinked,onSidesLinkedChange:T=>a({...r,paddingSidesLinked:T})})});case"mobilePadding":return u!="desktop"&&(0,n.jsx)(Ft,{icon:h9,label:_("properties.padding"),children:(0,n.jsx)(Dy,{label:_("properties.padding"),defaultValue:h("mobilePadding")??h("padding"),inheritedFrom:r.mobilePadding!=null?void 0:"default",onChange:v,sidesLinked:r.mobilePaddingSidesLinked,onSidesLinkedChange:T=>a({...r,mobilePaddingSidesLinked:T})})});case"fontSize":return u==="desktop"&&(0,n.jsx)(Ft,{icon:ee.FormatSizeOutlined,label:_("properties.fontSize"),children:(0,n.jsx)(_9,{maxValue:80,step:8,label:_("properties.fontSize"),defaultValue:b??16,onChange:v})});case"fontSizeMobile":return u!="desktop"&&(0,n.jsx)(Ft,{icon:ee.FormatSizeOutlined,label:_("properties.fontSize"),children:(0,n.jsx)(_9,{maxValue:80,step:8,label:_("properties.fontSize"),defaultValue:b,onChange:v})});case"lineHeight":return(0,n.jsx)(Ft,{icon:ee.FormatLineSpacingOutlined,label:_("properties.lineHeight"),children:(0,n.jsx)(Rld,{label:_("properties.lineHeight"),defaultValue:b??1.5,onChange:v})});case"shape":return(0,n.jsx)(Ft,{icon:ee.RoundedCornerOutlined,label:_("properties.shape"),children:(0,n.jsx)(Lld,{shapeSteps:s,maxValue:o,label:_("properties.shape"),defaultValue:b,onChange:v,cornersLinked:r.shapeCornersLinked,onCornersLinkedChange:T=>a({...r,shapeCornersLinked:T})})});case"height":return u==="desktop"&&(0,n.jsx)(Ft,{icon:ee.HeightOutlined,label:_("properties.height"),children:(0,n.jsx)(ky,{label:_("properties.height"),defaultValue:b,onChange:v})});case"heightMobile":return u!="desktop"&&(0,n.jsx)(Ft,{icon:ee.HeightOutlined,label:_("properties.height"),children:(0,n.jsx)(ky,{label:_("properties.height"),defaultValue:b,onChange:v})});case"width":return u==="desktop"&&(0,n.jsx)(Ft,{icon:ee.WidthFullOutlined,label:_("properties.width"),children:(0,n.jsx)(sJ,{label:_("properties.width"),defaultValue:h("width")??void 0,onChange:v})});case"widthMobile":return u!="desktop"&&(0,n.jsx)(Ft,{icon:ee.WidthFullOutlined,label:_("properties.width"),children:(0,n.jsx)(sJ,{label:_("properties.width"),defaultValue:h("widthMobile")??h("width")??void 0,onChange:v})});case"border":return u==="desktop"&&(0,n.jsx)(Ft,{icon:ee.BorderStyleOutlined,label:_("properties.border"),children:(0,n.jsx)(Vy,{label:_("properties.border"),borderColor:r.borderColor??null,borderTop:m("borderTop"),borderBottom:m("borderBottom"),borderLeft:m("borderLeft"),borderRight:m("borderRight"),onChange:S,sidesLinked:r.borderSidesLinked,onSidesLinkedChange:T=>a({...r,borderSidesLinked:T})})});case"borderMobile":return u!="desktop"&&(0,n.jsx)(Ft,{icon:ee.BorderStyleOutlined,label:_("properties.border"),children:(0,n.jsx)(Vy,{mobile:!0,label:_("properties.border"),borderColor:r.borderColor??null,borderTop:m("borderTopMobile")??m("borderTop"),borderBottom:m("borderBottomMobile")??m("borderBottom"),borderLeft:m("borderLeftMobile")??m("borderLeft"),borderRight:m("borderRightMobile")??m("borderRight"),onChange:S,sidesLinked:r.borderMobileSidesLinked,onSidesLinkedChange:T=>a({...r,borderMobileSidesLinked:T})})});default:return null}}Rv();var qs={section:"style",key:"padding",kind:"padding",labelKey:"theme.fields.padding"},bl={section:"style",key:"backgroundColor",kind:"color",labelKey:"theme.fields.backgroundColor"},Vld={section:"style",key:"fontWeight",kind:"fontWeight",labelKey:"theme.fields.fontWeight"},kld={section:"style",key:"textAlign",kind:"textAlign",labelKey:"theme.fields.textAlign"},Dld=["NotionText","Button","Image","Divider","Spacer","SocialMedia","Container","ColumnsContainer"],X4r={NotionText:{titleKey:"theme.blocks.notionText.title",icon:LO,fields:[bl,{section:"style",key:"fontSize",kind:"fontSize",labelKey:"theme.fields.fontSize"},qs]},Button:{titleKey:"theme.blocks.button.title",icon:GO,fields:[{section:"style",key:"buttonBackgroundColor",kind:"color",labelKey:"theme.fields.buttonBackgroundColor",icon:_f},{section:"style",key:"buttonTextColor",kind:"color",labelKey:"theme.fields.buttonTextColor",icon:l6},{section:"style",key:"fontSize",kind:"fontSize",labelKey:"theme.fields.fontSize"},Vld,kld,bl,qs]},Image:{titleKey:"theme.blocks.image.title",icon:JO,fields:[bl,qs]},Divider:{titleKey:"theme.blocks.divider.title",icon:IO,fields:[{section:"style",key:"color",kind:"color",labelKey:"theme.fields.color",icon:_f},bl,{section:"style",key:"width",kind:"number",labelKey:"theme.fields.width"},{section:"style",key:"height",kind:"number",labelKey:"theme.fields.height"},qs]},Spacer:{titleKey:"theme.blocks.spacer.title",icon:VO,fields:[bl,{section:"style",key:"height",kind:"number",labelKey:"theme.fields.height"}]},SocialMedia:{titleKey:"theme.blocks.socialMedia.title",icon:FO,fields:[bl,qs]},Container:{titleKey:"theme.blocks.container.title",icon:E_,fields:[bl,{section:"style",key:"border",kind:"border",labelKey:"theme.fields.border"},qs]},ColumnsContainer:{titleKey:"theme.blocks.columnsContainer.title",icon:KO,fields:[bl,qs]}};function Rs({title:t,children:r}){const a=mo(),o=F.useBlockTypeSelected(),s=(o?X4r[o]:null)?.icon;return(0,n.jsxs)(A.Container,{sx:{padding:"0!important",paddingTop:"1rem!important"},children:[!a&&(0,n.jsx)(A.Typography,{sx:{fontWeight:"bold",mb:2,color:"text.primary",fontSize:"1.25rem"},children:t}),a&&s&&(0,n.jsx)(A.Tooltip,{title:t,placement:"left",children:(0,n.jsx)(A.Box,{sx:{display:"flex",justifyContent:"center",pb:1.5},children:(0,n.jsx)(s,{sx:{fontSize:22,color:"text.secondary"}})})}),(0,n.jsx)(A.Stack,{spacing:a?.5:1.5,sx:{mb:3,pt:a?0:1},children:r})]})}function $_(){return mo()?(0,n.jsx)(A.Divider,{sx:{my:.5}}):null}function uJ(t){return{top:Number(t.top??0),bottom:Number(t.bottom??0),left:Number(t.left??0),right:Number(t.right??0)}}function Nld({size:t,sizeMobile:r,sizePaddingSidesLinked:a,sizeMobilePaddingSidesLinked:o,onChange:s,label:u,maxValue:d=100,paddingSteps:c=8}){const{t:_}=Ze("inspector"),h=u??_("inputs.common.size"),p=F.useSelectedScreenSize(),[m,f]=(0,y.useState)(()=>{const x=p==="desktop"?t:r!==void 0?r:t;return typeof x=="object"&&x!==null?uJ(x):{top:8,bottom:8,left:16,right:16}}),v=p==="desktop"?a===!0:o===!0;(0,y.useEffect)(()=>{const x=p==="desktop"?t:r!==void 0?r:t;typeof x=="object"&&x!==null&&f(uJ(x))},[t,r,p]);const S=()=>{const x=p==="desktop"?t:r!==void 0?r:t;return typeof x=="object"&&x!==null?"custom":typeof x=="string"?x:"medium"},g=typeof d=="number"?d:Number(d)||100,b=x=>{if(p==="desktop"){const w={size:x==="custom"?m:x};r==null&&(w.sizeMobile=x==="custom"?m:x),s(w)}else s({sizeMobile:x==="custom"?m:x})},T=(x,w)=>{let R;v?R={top:w,bottom:w,left:w,right:w}:R={...m,[x]:w},f(R),s(p==="desktop"?{size:R}:{sizeMobile:R})},M=()=>{if(p==="desktop")if(v)s({sizePaddingSidesLinked:!1});else{const x={top:m.top,bottom:m.top,left:m.top,right:m.top};f(x),s({size:x,sizePaddingSidesLinked:!0})}else if(v)s({sizeMobilePaddingSidesLinked:!1});else{const x={top:m.top,bottom:m.top,left:m.top,right:m.top};f(x),s({sizeMobile:x,sizeMobilePaddingSidesLinked:!0})}},O=S();return(0,n.jsxs)(A.Stack,{spacing:2,children:[(0,n.jsxs)(bc,{label:h,defaultValue:O,onChange:b,children:[(0,n.jsx)(A.ToggleButton,{value:"x-small",children:(0,n.jsx)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:(0,n.jsx)("span",{children:_("inputs.responsiveSize.options.xSmall")})})}),(0,n.jsx)(A.ToggleButton,{value:"small",children:(0,n.jsx)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:(0,n.jsx)("span",{children:_("inputs.responsiveSize.options.small")})})}),(0,n.jsx)(A.ToggleButton,{value:"medium",children:(0,n.jsx)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:(0,n.jsx)("span",{children:_("inputs.responsiveSize.options.medium")})})}),(0,n.jsx)(A.ToggleButton,{value:"custom",children:(0,n.jsx)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:(0,n.jsx)("span",{children:_("inputs.responsiveSize.options.custom")})})})]}),O==="custom"&&(0,n.jsxs)(A.Stack,{spacing:2,sx:{alignItems:"flex-start",pb:1},children:[(0,n.jsxs)(A.Stack,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center",width:"100%"},children:[(0,n.jsx)(_1,{label:_("inputs.responsiveSize.customPadding")}),(0,n.jsx)(A.Tooltip,{title:_(v?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:(0,n.jsx)(A.IconButton,{size:"small",onClick:M,sx:{marginTop:"0!important",color:v?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:v?(0,n.jsx)(ee.Lock,{fontSize:"small"}):(0,n.jsx)(ee.LockOpen,{fontSize:"small"})})})]}),v?(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(A.Typography,{variant:"body2",component:"span",children:_("inputs.responsiveSize.allSides")}),value:m.top,setValue:x=>T("top",x),units:"px",min:0,step:c,marks:c>1,max:g}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.AlignVerticalTopOutlined,{sx:{fontSize:16}}),value:m.top,setValue:x=>T("top",x),units:"px",min:0,step:c,marks:c>1,max:g}),(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.AlignVerticalBottomOutlined,{sx:{fontSize:16}}),value:m.bottom,setValue:x=>T("bottom",x),units:"px",min:0,step:c,marks:c>1,max:g}),(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.AlignHorizontalLeftOutlined,{sx:{fontSize:16}}),value:m.left,setValue:x=>T("left",x),units:"px",min:0,step:c,marks:c>1,max:g}),(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.AlignHorizontalRightOutlined,{sx:{fontSize:16}}),value:m.right,setValue:x=>T("right",x),units:"px",min:0,step:c,marks:c>1,max:g})]})]})]})}function Fld({fullWidth:t,fullWidthMobile:r,onChange:a,label:o="Width"}){const s=F.useSelectedScreenSize(),{t:u}=Ze("inspector"),d=()=>s==="desktop"?t:r!==void 0?r:t,c=_=>{const h=_==="FULL_WIDTH";if(s==="desktop"){const p={fullWidth:h};r==null&&(p.fullWidthMobile=h),a(p)}else a({fullWidthMobile:h})};return(0,n.jsxs)(bc,{label:o,defaultValue:d()?"FULL_WIDTH":"AUTO",onChange:c,children:[(0,n.jsx)(A.ToggleButton,{value:"FULL_WIDTH",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.WidthFull,{fontSize:"small"}),(0,n.jsx)("span",{children:u("inputs.width.full")})]})}),(0,n.jsx)(A.ToggleButton,{value:"AUTO",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.WidthNormal,{fontSize:"small"}),(0,n.jsx)("span",{children:u("inputs.width.auto")})]})})]})}function Ild(t,r){const a=(0,y.useRef)(null),o=(0,y.useRef)(t),s=(0,y.useRef)([]);o.current=t;const u=(0,y.useCallback)((...d)=>{s.current=d,a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{o.current(...d),a.current=null},r)},[r]);return u.flush=(0,y.useCallback)(()=>{a.current&&(clearTimeout(a.current),a.current=null,o.current(...s.current))},[]),u}function p9({helperText:t,label:r,placeholder:a,rows:o,InputProps:s,defaultValue:u,onChange:d}){const[c,_]=(0,y.useState)(u);(0,y.useEffect)(()=>{c!==u&&_(u)},[u]);const h=Ild(p=>{d(p)},150);return(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[(0,n.jsx)(_1,{label:r}),(0,n.jsx)(A.TextField,{fullWidth:!0,multiline:typeof o=="number"&&o>1,minRows:o,variant:"outlined",placeholder:a,helperText:t,slotProps:{input:s},value:c,sx:$o,onChange:p=>{const m=p.target.value;_(m),h(m)},onBlur:()=>{h.flush()}})]})}function $n({names:t,value:r,onChange:a,disabledCSSValidation:o=!1,shapeMaxValue:s,shapeSteps:u}){const d=F.useSelectedSidebarTab(),c=F.useBlockTypeSelected();return(mo()||o||d=="css"||F.BLOCKS_DEFAULT_CSS.includes(c||""))&&(0,n.jsx)(n.Fragment,{children:t.map(_=>(0,n.jsx)(Eld,{shapeMaxValue:s,shapeSteps:u,name:_,value:r||{},onChange:a},_))})}function Bld({data:t,setData:r}){const[,a]=(0,y.useState)(null),o=F.useRoot(),{t:s}=Ze("inspector"),u=T=>{const M=Ae.ButtonPropsSchema.safeParse(T);M.success?(r(M.data),a(null)):a(M.error)},d=t.props?.text??Ae.ButtonPropsDefaults.text,c=t.props?.url??Ae.ButtonPropsDefaults.url,_=t.props?.fullWidth??Ae.ButtonPropsDefaults.fullWidth,h=t.props?.size??Ae.ButtonPropsDefaults.size,p=o,m=t.style?.buttonTextColor??t.props?.buttonTextColor??p?.textColor,f=t.style?.buttonBackgroundColor??t.props?.buttonBackgroundColor??Ae.ButtonPropsDefaults.buttonBackgroundColor,v=t.props?.fullWidthMobile,S=t.props?.sizeMobile,g=F.useSelectedSidebarTab(),b=mo();return(0,n.jsxs)(Rs,{title:s("inputs.panels.button.title"),children:[(g=="block-configuration"||b)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)($n,{disabledCSSValidation:!0,names:["fontFamily","fontSize","fontSizeMobile","fontWeight"],value:t.style,onChange:T=>u({...t,style:T})}),(0,n.jsx)(Ft,{icon:ee.TitleOutlined,label:s("inputs.panels.button.textLabel"),children:(0,n.jsx)(p9,{label:s("inputs.panels.button.textLabel"),defaultValue:d,onChange:T=>u({...t,props:{...t.props,text:T}})})}),(0,n.jsx)(Ft,{icon:ee.LinkOutlined,label:s("inputs.panels.button.targetLabel"),children:(0,n.jsx)(p9,{label:s("inputs.panels.button.targetLabel"),placeholder:s("inputs.panels.button.targetPlaceholder"),defaultValue:c,onChange:T=>u({...t,props:{...t.props,url:T}})})}),(0,n.jsx)(Ft,{icon:ee.WidthFullOutlined,label:s("properties.width"),children:(0,n.jsx)(Fld,{label:s("properties.width"),fullWidth:_,fullWidthMobile:v,onChange:T=>u({...t,props:{...t.props,...T}})})}),(0,n.jsx)(Ft,{icon:ee.AspectRatioOutlined,label:s("properties.size","Size"),children:(0,n.jsx)(Nld,{size:h,sizeMobile:S,sizePaddingSidesLinked:t.props?.sizePaddingSidesLinked,sizeMobilePaddingSidesLinked:t.props?.sizeMobilePaddingSidesLinked,onChange:T=>u({...t,props:{...t.props,...T}})})})]}),(0,n.jsx)($_,{}),(0,n.jsx)($n,{names:["shape","textAlign","textAlignMobile","backgroundColor","border","borderMobile","padding","mobilePadding"],value:t.style,shapeMaxValue:80,onChange:T=>u({...t,style:T})}),(g==="css"||b)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Ft,{icon:l6,label:s("inputs.panels.button.textColor"),children:(0,n.jsx)(Au,{label:s("inputs.panels.button.textColor"),defaultValue:m,onChange:T=>u({...t,style:{...t.style,buttonTextColor:T}})})}),(0,n.jsx)(Ft,{icon:ee.PaletteOutlined,label:s("inputs.panels.button.buttonColor"),children:(0,n.jsx)(Au,{label:s("inputs.panels.button.buttonColor"),defaultValue:f,onChange:T=>u({...t,style:{...t.style,buttonBackgroundColor:T}})})})]})]})}var Jld=(t,r,a)=>{if(!t||!document)return;const o=Ae.shortCssId(t),s=document.querySelector(`.${o}`);if(!s)return;const u=s.parentElement;if(!u)return;const d=Math.ceil(u.getBoundingClientRect().width);a.props?.touched||a.props?.width!==d&&r({...a,props:{...a.props,width:d}})},Uld=t=>{if(!t||!document)return;const r=Ae.shortCssId(t),a=document.querySelector(`.${r}`);if(!a)return;const o=a.parentElement;if(!o)return;const s=Math.ceil(o.getBoundingClientRect().width);return s||null},Wld={desktop:"contentAlignment",mobile:"contentAlignmentMobile"};function $ld({data:t,updateData:r}){const{t:a}=Ze("inspector"),o=F.useSelectedScreenSize(),s=Wld[o]||"contentAlignment",u=t.props?.[s]??t.props?.contentAlignment,d=c=>{r({...t,props:{...t.props,[s]:c}})};return(0,n.jsxs)(bc,{label:a("inputs.alignment.label"),defaultValue:u,onChange:d,children:[(0,n.jsx)(A.ToggleButton,{value:"top",children:(0,n.jsx)(ee.VerticalAlignTopOutlined,{fontSize:"small"})}),(0,n.jsx)(A.ToggleButton,{value:"middle",children:(0,n.jsx)(ee.VerticalAlignCenterOutlined,{fontSize:"small"})}),(0,n.jsx)(A.ToggleButton,{value:"bottom",children:(0,n.jsx)(ee.VerticalAlignBottomOutlined,{fontSize:"small"})})]})}function dJ({value:t,onChange:r,options:a}){return(0,n.jsx)(A.ToggleButtonGroup,{exclusive:!0,value:t,size:"small",onChange:(o,s)=>{typeof s=="string"&&r(s)},sx:{display:"flex",width:"100%"},children:a.map(o=>(0,n.jsx)(A.ToggleButton,{value:o.value,children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[o.icon,(0,n.jsx)("span",{children:o.label})]})},o.value))})}var pp="layout-custom",E8=[{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]}],V8=[{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]}],zl={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 cJ(t){const r=t?.[0];return typeof r=="number"&&!Number.isNaN(r)?Math.min(99,Math.max(1,Math.round(r))):50}function k8(t){let r=typeof t?.[0]=="number"?Math.round(t[0]):34,a=typeof t?.[1]=="number"?Math.round(t[1]):33;return r=Math.min(98,Math.max(1,r)),a=Math.min(98,Math.max(1,a)),r+a>=99&&(a=Math.max(1,99-r)),[r,a]}var D8=({fractions:t,highlight:r})=>{const a=(0,A.useTheme)(),o=r?a.palette.secondary.main:"#e5e7eb";return(0,n.jsx)("div",{style:{...zl.layoutPreview,gridTemplateColumns:t.map(s=>`${s}fr`).join(" ")},children:t.map((s,u)=>(0,n.jsx)("div",{style:{minWidth:0,backgroundColor:o,borderRadius:"4px",transition:"background-color 0.2s ease"}},u))})},Gld=({defaultValue:t,fixedWidths:r,onChange:a,columns:o})=>{const{t:s}=Ze("inspector"),u=(0,A.useTheme)(),[d,c]=(0,y.useState)(null),[_,h]=(0,y.useState)(!1),[p,m]=(0,y.useState)(()=>cJ(r??void 0)),[f,v]=(0,y.useState)(()=>k8(r??void 0)[0]),[S,g]=(0,y.useState)(()=>k8(r??void 0)[1]),b=t??(o===2?"layout-50-50":"layout-33-33-33"),T=d??(b==="layout-33-34-33"?"layout-33-33-33":b),[M,O]=(0,y.useState)(o===2?E8:V8),x=(z,V)=>{c(null),h(!1),a({layout:z,fixedWidths:V})},w=()=>{if(c(pp),h(!0),o===2)m(cJ(r??void 0));else{const[z,V]=k8(r??void 0);v(z),g(V)}},R=()=>{if(o===2){const z=p;a({layout:pp,fixedWidths:[z,100-z,null]})}else{const z=f,V=S;a({layout:pp,fixedWidths:[z,V,100-z-V]})}c(null)};(0,y.useEffect)(()=>{O(o===2?E8:V8)},[o]),(0,y.useEffect)(()=>{c(null),h(!1)},[o,t]),(0,y.useEffect)(()=>{const z=t;o===2?z!=="layout-custom"&&(z==null||!E8.some(V=>V.id===z))&&a({layout:"layout-50-50",fixedWidths:[50,50,null]}):z==="layout-33-34-33"?a({layout:"layout-33-33-33",fixedWidths:[33.34,33.33,33.33]}):z!=="layout-custom"&&(z==null||!V8.some(V=>V.id===z))&&a({layout:"layout-33-33-33",fixedWidths:[33.34,33.33,33.33]})},[o,t,a]);const j=(z,V)=>{const k=V;v(k),g(D=>Math.max(1,Math.min(D,100-k-1)))},P=(z,V)=>{const k=V,D=100-f-1;g(Math.max(1,Math.min(k,D)))},H=100-p,L=100-f-S,E=T===pp;return(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:s("inputs.layout.label")}),(0,n.jsxs)("div",{style:zl.grid,children:[M.map(z=>(0,n.jsx)("div",{onClick:()=>x(z.id,z.distribution),style:{...zl.card,border:T===z.id?`2px solid ${u.palette.secondary.main}`:zl.card.border},children:(0,n.jsx)("div",{style:zl.cardContent,children:(0,n.jsx)(D8,{fractions:z.distribution.filter(V=>V!=null),highlight:T===z.id})})},z.id)),(0,n.jsx)("div",{onClick:w,style:{...zl.card,border:E?`2px solid ${u.palette.secondary.main}`:zl.card.border},role:"button",tabIndex:0,onKeyDown:z=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),w())},children:(0,n.jsx)("div",{style:zl.cardContent,children:(0,n.jsx)(A.Box,{sx:{width:"100%",height:30,minHeight:30,border:"1px dashed",borderColor:"divider",borderRadius:1,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:E?"action.selected":"action.hover",color:"text.primary",transition:u.transitions.create(["background-color"],{duration:u.transitions.duration.shorter})},children:(0,n.jsx)(ee.EditOutlined,{sx:{fontSize:18,color:"text.primary"}})})})})]}),(0,n.jsx)(A.Collapse,{in:_,timeout:"auto",unmountOnExit:!0,children:(0,n.jsxs)(A.Box,{sx:{mt:2,p:2,borderRadius:1,border:1,borderColor:"divider",bgcolor:"background.paper"},children:[o===2?(0,n.jsxs)(A.Stack,{spacing:2,sx:{mt:1},children:[(0,n.jsxs)(A.Typography,{variant:"body2",color:"text.secondary",children:[p,"% | ",H,"%"]}),(0,n.jsx)(A.Slider,{value:p,min:1,max:99,step:1,valueLabelDisplay:"auto","aria-label":s("inputs.layout.custom.split2"),onChange:(z,V)=>m(V)}),(0,n.jsx)(D8,{fractions:[p,H],highlight:!0})]}):(0,n.jsxs)(A.Stack,{spacing:2,sx:{mt:1},children:[(0,n.jsxs)(A.Typography,{variant:"body2",color:"text.secondary",children:[f,"% | ",S,"% | ",L,"%"]}),(0,n.jsxs)(A.Box,{children:[(0,n.jsx)(A.Typography,{variant:"caption",color:"text.secondary",component:"div",children:s("inputs.layout.custom.firstColumn")}),(0,n.jsx)(A.Slider,{value:f,min:1,max:98,step:1,valueLabelDisplay:"auto",onChange:j})]}),(0,n.jsxs)(A.Box,{children:[(0,n.jsx)(A.Typography,{variant:"caption",color:"text.secondary",component:"div",children:s("inputs.layout.custom.secondColumn")}),(0,n.jsx)(A.Slider,{value:S,min:1,max:100-f-1,step:1,valueLabelDisplay:"auto",onChange:P})]}),(0,n.jsx)(D8,{fractions:[f,S,L],highlight:!0})]}),(0,n.jsx)(A.Button,{variant:"contained",size:"small",sx:{mt:2},onClick:R,children:(0,n.jsx)(A.Typography,{variant:"button",component:"span",sx:{color:"#FFFFFF",fontWeight:"bold"},children:s("inputs.layout.custom.apply")})})]})})]})};function qld({label:t,tooltipTitle:r,hideWarning:a}){return(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[(0,n.jsx)(_1,{label:t}),!a&&(0,n.jsx)(A.Tooltip,{title:r,placement:"top",children:(0,n.jsx)(A.IconButton,{size:"small",color:"warning",disableRipple:!0,sx:{p:0,cursor:"help",lineHeight:0,"&:hover":{backgroundColor:"transparent"}},children:(0,n.jsx)(Y4r,{"aria-hidden":!0})})})]})}var Z4r=(t=>(0,n.jsx)(A.SvgIcon,{...t,viewBox:"0 0 24 24",children:(0,n.jsxs)("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",children:[(0,n.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"}),(0,n.jsx)("circle",{cx:"18",cy:"18",r:"3"})]})}));Z4r.muiName="ColumnsCountIcon";function Kld({data:t,setData:r}){const[,a]=(0,y.useState)(null),[o,s]=(0,y.useState)(t.props?.columnsCount??2),u=F.useSelectedSidebarTab(),d=F.useSelectedScreenSize(),c=mo(),{t:_}=Ze("inspector"),h=S=>{const g=F.editorStateStore.getState().document,b=S.filter(T=>g[T]?.type==="Image");d==="desktop"&&b.forEach(T=>{const M=g[T];if(M?.type!=="Image")return;const O=M.data;Jld(T,x=>{W_(T,w=>w.type!=="Image"?w:{...w,data:x})},O)})},p=S=>{const g=aA.safeParse(S);g.success?(g.data.props.columns.map(b=>h(b.childrenIds)),r(g.data),o&&g.data.props?.columnsCount!==o&&s(g.data.props?.columnsCount??2),a(null)):(console.error("Error on columns: ",g.error),a(g.error))},m={layout:"layout-50-50",fixedWidths:[50,50,null],columnsCount:2},f={layout:"layout-33-34-33",fixedWidths:[33,34,33],columnsCount:3},v=S=>{const g=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:[...t.props.columns];return S==="2"?{...m,columns:g}:{...f,columns:g}};return(0,n.jsxs)(Rs,{title:_("inputs.panels.columns.title"),children:[(u=="block-configuration"||c)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Ft,{icon:Z4r,label:_("inputs.panels.columns.countLabel"),children:(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:_("inputs.panels.columns.countLabel")}),(0,n.jsx)(A.Box,{sx:{...kT,paddingLeft:0,paddingRight:0,height:"auto",minHeight:"36px"},children:(0,n.jsx)(dJ,{value:t.props?.columnsCount===2?"2":"3",onChange:S=>{const g=v(S);p({...t,props:{...t.props,...g}})},options:[{value:"2",label:"2",icon:(0,n.jsx)(ee.SplitscreenOutlined,{fontSize:"small"})},{value:"3",label:"3",icon:(0,n.jsx)(ee.ViewWeekOutlined,{fontSize:"small"})}]})})]})}),(0,n.jsx)(Ft,{icon:ee.TableChartOutlined,label:_("inputs.panels.columns.layoutLabel","Layout"),children:(0,n.jsx)(Gld,{columns:t.props?.columnsCount??3,defaultValue:t.props?.layout,fixedWidths:t.props?.fixedWidths??void 0,onChange:({layout:S,fixedWidths:g})=>{const b=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:t.props.columns;p({...t,props:{...t.props,layout:S,fixedWidths:g,columns:b}})}})})]}),(u=="css"||c)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)($_,{}),(0,n.jsx)(Ft,{icon:ee.PhoneIphoneOutlined,label:_("inputs.panels.columns.stackColumnsOnMobile"),children:(0,n.jsxs)(Er,{children:[(0,n.jsx)(qld,{label:_("inputs.panels.columns.stackColumnsOnMobile"),tooltipTitle:_("inputs.panels.columns.stackColumnsOnMobileWarning")}),(0,n.jsx)(A.Box,{sx:{width:"100%",...kT,paddingLeft:0,paddingRight:0,height:"auto",minHeight:"36px"},children:(0,n.jsx)(dJ,{value:t.props?.stackColumnsOnMobile?"stacked":"sideBySide",onChange:S=>{p({...t,props:{...t.props,stackColumnsOnMobile:S==="stacked"}})},options:[{value:"sideBySide",label:_("inputs.panels.columns.stackToggleSideBySide"),icon:(0,n.jsx)(ee.ViewColumnOutlined,{fontSize:"small"})},{value:"stacked",label:_("inputs.panels.columns.stackToggleStacked"),icon:(0,n.jsx)(ee.TableRowsOutlined,{fontSize:"small"})}]})})]})}),(0,n.jsx)(Ft,{icon:ee.AlignVerticalCenterOutlined,label:_("inputs.alignment.label"),children:(0,n.jsx)($ld,{data:t,updateData:r})}),(0,n.jsx)($n,{names:["backgroundColor","background","padding","mobilePadding"],value:t.style,onChange:S=>p({...t,style:S})})]})]})}function e0r({data:t,setData:r}){const[,a]=(0,y.useState)(null),{t:o}=Ze("inspector"),s=u=>{const d=I4r.safeParse(u);d.success?(r(d.data),a(null)):a(d.error)};return(0,n.jsx)(Rs,{title:o("inputs.panels.container.title"),children:(0,n.jsx)($n,{names:["backgroundColor","background","border","borderMobile","shape","padding","mobilePadding"],value:t.style,shapeSteps:30,onChange:u=>s({...t,style:u})})})}function t0r({data:t,setData:r}){const[,a]=(0,y.useState)(null),{t:o}=Ze("inspector"),s=u=>{const d=Ae.DividerPropsSchema.safeParse(u);d.success?(r(d.data),a(null)):a(d.error)};return(0,n.jsx)(Rs,{title:o("inputs.panels.divider.title"),children:(0,n.jsx)($n,{names:["width","widthMobile","height","heightMobile","color","backgroundColor","textAlign","textAlignMobile","padding","mobilePadding"],value:t.style,onChange:u=>s({...t,style:u})})})}var Yld=({label:t,linkColor:r,underline:a=!1,onChange:o})=>{const[s,u]=(0,y.useState)(r??"#FF0000"),[d,c]=(0,y.useState)(a),{t:_}=Ze("inspector"),h=t??_("inputs.links.color"),p=d?"enabled":"disabled",m={container:{width:"100%"}};(0,y.useEffect)(()=>{r!==s&&u(r??"#FF0000")},[r]),(0,y.useEffect)(()=>{a!==d&&c(a)},[a]);const f=S=>{const g=S??"#FF0000";u(g),o({linkColor:g,underline:d})},v=(S,g)=>{if(!g)return;const b=g==="enabled";c(b),o({linkColor:s,underline:b})};return(0,n.jsxs)(Er,{children:[(0,n.jsx)(Au,{label:h,defaultValue:s,onChange:f}),(0,n.jsx)(_1,{label:_("inputs.links.underline")}),(0,n.jsx)(A.Box,{sx:m.container,children:(0,n.jsxs)(A.ToggleButtonGroup,{value:p,exclusive:!0,fullWidth:!0,onChange:v,sx:{width:"100%"},children:[(0,n.jsx)(A.ToggleButton,{value:"enabled",children:(0,n.jsx)(A.Tooltip,{title:_("inputs.links.underlineOn"),children:(0,n.jsx)(A.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(ee.FormatUnderlined,{fontSize:"small"})})})}),(0,n.jsx)(A.ToggleButton,{value:"disabled",children:(0,n.jsx)(A.Tooltip,{title:_("inputs.links.underlineOff"),children:(0,n.jsx)(A.Box,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:(0,n.jsx)(ee.FormatClear,{fontSize:"small"})})})})]})})]})};function r0r({data:t,setData:r}){const[,a]=(0,y.useState)(null),{t:o}=Ze("inspector"),s=u=>{const d=B4r.safeParse(u);d.success?(r(d.data),a(null)):a(d.error)};return(0,n.jsxs)(A.Stack,{spacing:1,children:[(0,n.jsx)(Ft,{icon:B3,label:o("inputs.panels.emailLayout.backgroundColor"),children:(0,n.jsx)(Au,{label:o("inputs.panels.emailLayout.backgroundColor"),defaultValue:t.backdropColor??"#F5F5F5",onChange:u=>s({...t,backdropColor:u})})}),(0,n.jsx)(Ft,{icon:ee.CropSquareOutlined,label:o("inputs.panels.emailLayout.canvasColor"),children:(0,n.jsx)(Au,{label:o("inputs.panels.emailLayout.canvasColor"),defaultValue:t.canvasColor??"#FFFFFF",onChange:u=>s({...t,canvasColor:u})})}),(0,n.jsx)(Ft,{icon:i6,label:o("inputs.panels.emailLayout.fontFamily"),children:(0,n.jsx)(sA,{label:o("inputs.panels.emailLayout.fontFamily"),defaultValue:t.fontFamily||Ae.DEFAULT_FONT.FAMILY,onChange:u=>s({...t,fontFamily:u})})}),(0,n.jsx)(Ft,{icon:l6,label:o("inputs.panels.emailLayout.textColor"),children:(0,n.jsx)(Au,{label:o("inputs.panels.emailLayout.textColor"),defaultValue:t.textColor??"#262626",onChange:u=>s({...t,textColor:u})})}),(0,n.jsx)(Ft,{icon:ee.LinkOutlined,label:o("inputs.panels.emailLayout.linksLabel"),children:(0,n.jsx)(Yld,{label:o("inputs.panels.emailLayout.linksLabel"),linkColor:t.linkGlobal?.linkColor||"#000000",underline:t.linkGlobal?.underline||!1,onChange:u=>s({...t,linkGlobal:u})})})]})}var Qld=(t,r,a)=>{const o=F.useSelectedScreenSize();(0,y.useEffect)(()=>{const s=()=>{if(!t||!document||o=="mobile")return;const c=Ae.shortCssId(t),_=document.querySelector(`.${c}`);if(!_)return;const h=_.parentElement;if(!h)return;const p=Math.ceil(h.getBoundingClientRect().width);a.props?.size===void 0||a.props?.size==="original"||a.props?.touched&&a.props?.width<=p||a.props?.width!==p&&!a.props?.touched&&r({...a,props:{...a.props,width:p}})};s();const u=new ResizeObserver(s),d=document.querySelector(`.${Ae.shortCssId(t)}`);return d?.parentElement&&u.observe(d.parentElement),()=>{u.disconnect()}},[t,r,a,o])},Xld=({data:t,setData:r,blockId:a})=>{const{t:o}=Ze("inspector"),[s,u]=(0,y.useState)(!1),[d,c]=(0,y.useState)(()=>!!window.__emailBuilderEnableAI),[,_]=(0,y.useState)(null),[h,p]=(0,y.useState)(""),[m,f]=(0,y.useState)(!1),[v,S]=(0,y.useState)(""),[g,b]=(0,y.useState)(!1),T=(0,y.useRef)(null),[M,O]=(0,y.useState)(null),x=F.useImageUrlInput(),w=F.useImageUploadInput(),R=x||w,[j,P]=(0,y.useState)(()=>!!window.__emailBuilderUnsplashEnabled);(0,y.useEffect)(()=>{const $=()=>{P(!!window.__emailBuilderUnsplashEnabled)};return $(),window.addEventListener("email-builder-unsplash-updated",$),()=>window.removeEventListener("email-builder-unsplash-updated",$)},[]),(0,y.useEffect)(()=>{const $=window.__emailBuilderCustomImageProvider;$&&(O($),setTimeout(()=>{a&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:a,currentImageUrl:t.props?.url||null,alt:t.props?.alt||null}}))},100))},[]);const H=$=>{const W=Ae.ImagePropsSchema.safeParse($);W.success?(r(W.data),_(null)):_(W.error)},L=($,W)=>{const _e=$.toLowerCase(),Y=_e.includes(".svg")||_e.includes("svg"),re=W&&(W.includes("image/svg+xml")||W.includes("svg"));return Y||!!re},E=async $=>{try{f(!0),S(""),b(!1);try{new URL($)}catch{return S(o("inputs.image.invalidUrl")),!1}const W=new AbortController,_e=setTimeout(()=>W.abort(),1e4);try{const Y=await fetch($,{method:"HEAD",signal:W.signal});if(clearTimeout(_e),!Y.ok)return S(o("inputs.image.httpError",{status:Y.status,statusText:Y.statusText})),!1;const re=Y.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(Q=>re&&re.toLowerCase().includes(Q.toLowerCase()))?(L($,re)&&b(!0),S(""),!0):(S(o("inputs.image.notImage")),!1)}catch(Y){return clearTimeout(_e),Y.name==="AbortError"?(S(o("inputs.image.timeout")),!1):new Promise(re=>{const Q=new Image,le=setTimeout(()=>{S(o("inputs.image.timeout")),re(!1)},1e4);Q.onload=()=>{clearTimeout(le),L($)&&b(!0),S(""),re(!0)},Q.onerror=()=>{clearTimeout(le),S(o("inputs.image.loadError")),re(!1)},Q.src=$})}}catch{return S(o("inputs.image.unexpectedError")),!1}finally{f(!1)}},z=async()=>{h.trim()&&await E(h.trim())&&(H({...t,props:{...t.props,url:h.trim()}}),a&&cd(a),p(""))},V=$=>{$.key==="Enter"&&z()},k=$=>{p($.target.value),v&&S(""),g&&b(!1)},D=$=>{const W=["image/png","image/jpeg","image/gif"],Y=$.filter(Q=>W.includes(Q.type)&&Q.size<=5242880);if(Y.length!==$.length&&alert(o("inputs.common.invalidFiles")),Y.length===0)return;const re=Y.map(Q=>new Promise(le=>{const ce=new FileReader;ce.onload=Z=>le(Z.target?.result),ce.readAsDataURL(Q)}));Promise.all(re).then(Q=>{const le={images:Q,id:a||""};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:le})),F.setImageUploading(!0,a||"")})},N=$=>{$.preventDefault(),u(!0)},I=$=>{const W=$.currentTarget.getBoundingClientRect(),_e=$.clientX,Y=$.clientY;(_e<W.left||_e>=W.right||Y<W.top||Y>=W.bottom)&&u(!1)},B=$=>{$.preventDefault(),u(!1);const W=Array.from($.dataTransfer.files);W.length>0&&D(W)},q=()=>{const $=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent($)};(0,y.useEffect)(()=>{const $=window.__emailBuilderEnableAI;$!==void 0&&c(!!$);const W=_e=>{const{detail:Y}=_e;c(!!Y)};return window.addEventListener("email-builder-ai-generation",W),()=>{window.removeEventListener("email-builder-ai-generation",W)}},[]),(0,y.useEffect)(()=>{const $=re=>{const{detail:Q}=re;F.setImageUploading(!1,Q.id||""),a&&(B4(a,{url:Q.url}),cd(a)),F.setDisableEdition(!1)},W=re=>{F.setImageUploading(re?.detail?.uploading??!1,re?.detail?.id??"")},_e=()=>{T?.current?.click()},Y=re=>{if(!a)return;const Q=re.detail;if(typeof Q=="string"){B4(a,{url:Q}),cd(a);return}if(Q&&typeof Q=="object"&&typeof Q.url=="string"){const le={url:Q.url};typeof Q.alt=="string"&&(le.alt=Q.alt),B4(a,le)}};return window.addEventListener("email-builder-set-image",Y),window.addEventListener("email-builder-upload-image-receive",$),window.addEventListener("email-builder-upload-file",_e),window.addEventListener("email-builder-toggle-upload-file",W),()=>{window.removeEventListener("email-builder-toggle-upload-file",W),window.removeEventListener("email-builder-upload-image-receive",$),window.removeEventListener("email-builder-set-image",Y),window.removeEventListener("email-builder-upload-file",_e)}},[a]),(0,y.useEffect)(()=>{t.props?.url&&b(L(t.props.url))},[t.props?.url]);const te=()=>(0,n.jsxs)(A.Stack,{spacing:1,children:[(0,n.jsx)(Er,{children:x&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(_1,{label:o("inputs.image.urlLabel")}),(0,n.jsxs)(A.Stack,{direction:"row",spacing:1,children:[(0,n.jsx)(A.TextField,{fullWidth:!0,placeholder:o("inputs.image.urlPlaceholder"),value:h,onChange:k,onKeyPress:V,error:!!v,disabled:m,sx:$o}),(0,n.jsx)(A.Button,{variant:"contained",onClick:z,disabled:!h.trim()||m,sx:{minWidth:"auto",px:2},children:m?(0,n.jsx)(A.CircularProgress,{size:20,color:"inherit"}):o("inputs.common.add")})]}),v&&(0,n.jsx)(A.Alert,{severity:"error",sx:{mt:1,fontSize:"0.875rem"},children:v}),g&&(0,n.jsx)(A.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:(0,n.jsx)(A.IconButton,{"aria-label":o("inputs.common.close"),color:"inherit",size:"small",onClick:()=>b(!1),children:(0,n.jsx)(ee.Close,{fontSize:"inherit"})}),children:o("inputs.common.svgWarning")})]})}),x&&w&&(0,n.jsxs)(A.Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,n.jsx)(A.Divider,{sx:{flexGrow:1}}),(0,n.jsx)(A.Typography,{variant:"caption",sx:{color:"text.secondary"},children:o("inputs.backgroundImage.or")}),(0,n.jsx)(A.Divider,{sx:{flexGrow:1}})]}),w&&(0,n.jsxs)(A.Box,{onDragOver:N,onDragLeave:I,onDrop:B,sx:{width:"100%",border:"2px dashed",borderColor:s?"primary.main":"divider",borderRadius:"8px",padding:3,textAlign:"center",bgcolor:s?"action.hover":"background.paper",transition:"all 0.2s ease"},children:[(0,n.jsx)(A.Box,{sx:{display:"flex",justifyContent:"center",mb:1},children:(0,n.jsx)(ee.PhotoOutlined,{sx:{fontSize:28,color:"primary.main"}})}),(0,n.jsxs)("label",{style:{cursor:"pointer"},children:[(0,n.jsx)("input",{ref:T,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:$=>{const W=$.target.files;W&&W.length>0&&D(Array.from(W))}}),(0,n.jsx)(A.Typography,{component:"span",sx:{fontWeight:600,color:"primary.main"},children:o("inputs.common.uploadFile")}),(0,n.jsxs)(A.Typography,{component:"span",sx:{fontWeight:500,color:"text.secondary"},children:[" ",o("inputs.common.dragAndDrop")]})]}),(0,n.jsx)(A.Typography,{variant:"caption",sx:{color:"text.secondary",mt:1,display:"block"},children:o("inputs.common.fileInfo")})]}),!M&&F.getGalleryImages()&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(A.Stack,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[(0,n.jsx)(A.Divider,{sx:{flexGrow:1}}),(0,n.jsx)(A.Typography,{variant:"caption",sx:{color:"text.secondary"},children:o("inputs.backgroundImage.or")}),(0,n.jsx)(A.Divider,{sx:{flexGrow:1}})]}),(0,n.jsx)(A.Button,{variant:"outlined",onClick:q,startIcon:(0,n.jsx)(ee.ImageSearchOutlined,{}),fullWidth:!0,children:o("inputs.backgroundImage.browseGallery")})]})]});return(0,n.jsxs)(A.Stack,{spacing:1,children:[(0,n.jsx)(K4r,{imageUrl:t.props?.url??null,alt:t.props?.alt??"",blockId:a,onRemove:()=>{a&&(B4(a,{url:null}),cd(a)),H({...t,props:{...t.props??{},url:null}})}}),(0,n.jsx)(U4r,{tabs:[{key:"gallery",label:o("inputs.tabs.gallery"),visible:j,render:()=>(0,n.jsx)(G4r,{blockId:a,source:"image"})},{key:"yourGallery",label:o("inputs.tabs.yourGallery"),visible:!!M,render:()=>(0,n.jsx)(A.Box,{children:M})},{key:"upload",label:o("inputs.tabs.upload"),visible:R,render:te},{key:"generate",label:o("inputs.tabs.generate"),visible:d,render:()=>(0,n.jsx)(A.Box,{sx:{py:1},children:(0,n.jsx)(q4r,{src:t.props?.url,style:{width:"100%",margin:0}})})}],defaultTab:"upload"})]})},Zld=({defaultValue:t="original",scale:r=100,onChange:a})=>{const[o,s]=(0,y.useState)(t),[u,d]=(0,y.useState)(r),c=(0,A.useTheme)(),{t:_}=Ze("inspector"),h={container:{width:"100%"},label:{marginBottom:"8px",fontSize:"14px",fontWeight:500,color:c.palette.text.primary},sliderContainer:{marginTop:"16px",padding:"0 8px"},slider:{"& .MuiSlider-thumb":{width:12,height:12,backgroundColor:c.palette.primary.main,"&:hover":{boxShadow:`0 0 0 8px ${c.palette.primary.main}20`}},"& .MuiSlider-rail":{height:4,backgroundColor:c.palette.grey[300]},"& .MuiSlider-track":{height:4,backgroundColor:c.palette.primary.main}},scaleValue:{marginTop:"4px",textAlign:"right",fontSize:"14px",color:c.palette.text.secondary}};(0,y.useEffect)(()=>{(t!==o||r!==u)&&(t!==o&&s(t),t==="scale"&&d(r))},[t,r]);const p=(f,v)=>{v!==null&&(s(v),a&&a({mode:v,scale:v==="scale"?u:void 0}))},m=f=>{d(f),a&&a({mode:o,scale:f})};return(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:_("inputs.sizeSelector.label")}),(0,n.jsxs)(A.Box,{sx:h.container,children:[(0,n.jsxs)(A.ToggleButtonGroup,{value:o,exclusive:!0,onChange:p,sx:{width:"100%"},children:[(0,n.jsx)(A.ToggleButton,{value:"original",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.FitScreen,{fontSize:"small"}),(0,n.jsx)("span",{children:_("inputs.sizeSelector.contain")})]})}),(0,n.jsx)(A.ToggleButton,{value:"fill",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.Crop,{fontSize:"small"}),(0,n.jsx)("span",{children:_("inputs.sizeSelector.cover")})]})}),(0,n.jsx)(A.ToggleButton,{value:"scale",children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[(0,n.jsx)(ee.Percent,{fontSize:"small"}),(0,n.jsx)("span",{children:_("inputs.sizeSelector.scale")})]})})]}),(0,n.jsx)(A.Collapse,{in:o==="scale",children:(0,n.jsx)(A.Box,{sx:h.sliderContainer,children:(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.WidthWideOutlined,{}),value:u,setValue:m,marks:!1,units:"%",min:1,max:100})})})]})]})},_J={cover:(0,n.jsx)(ee.Crop,{fontSize:"small"}),contain:(0,n.jsx)(ee.FitScreen,{fontSize:"small"}),fill:(0,n.jsx)(ee.AspectRatio,{fontSize:"small"})},hJ=t=>t==="cover"||t==="contain"||t==="fill"?_J[t]:_J.cover,pJ=t=>t.length===0?t:t.charAt(0).toUpperCase()+t.slice(1);function esd({data:t,setData:r}){const[a,o]=(0,y.useState)(null),s=F.useSelectedBlockId(),u=F.useSelectedSidebarTab(),d=F.useSelectedScreenSize(),c=mo(),{t:_}=Ze("inspector");Qld(s||"",r,t),y.default.useEffect(()=>{s&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:s,currentImageUrl:t.props?.url||null,alt:t.props?.alt||null,source:"image"}}))},[s,t.props?.url,t.props?.alt]);const h=(0,y.useCallback)(x=>{const w=Ae.ImagePropsSchema.safeParse(x);w.success?JSON.stringify(t)!==JSON.stringify(w.data)&&(r(w.data),o(null)):o(w.error)},[t,r]),p=(0,y.useCallback)((x,w,R)=>{const j=Uld(s)||600,P={...x.props};if(R&&(P.touchedMobile=!0),w.mode==="original"){const H=x.props?.original_width??null;return R?{...P,sizeMobile:w.mode,widthMobile:H}:{...P,size:w.mode,width:H,sizeMobile:P.touchedMobile?P.sizeMobile:w.mode,widthMobile:P.touchedMobile?P.widthMobile:H}}if(w.mode==="fill")return R?{...P,sizeMobile:w.mode,widthMobile:null}:{...P,size:w.mode,width:null,sizeMobile:P.touchedMobile?P.sizeMobile:w.mode,widthMobile:P.touchedMobile?P.widthMobile:null};if(w.mode==="scale"){const H=Math.ceil(j/100*w.scale);return R?{...P,sizeMobile:w.mode,scaleMobile:w.scale,widthMobile:H}:{...P,size:w.mode,scale:w.scale,width:H,sizeMobile:P.touchedMobile?P.sizeMobile:w.mode,scaleMobile:P.touchedMobile?P.scaleMobile:w.scale,widthMobile:P.touchedMobile?P.widthMobile:H}}return P},[s]),m=(0,y.useCallback)((x,w)=>{const R=p(t,x,w);h({...t,props:R})},[t,h,p]),f=(0,y.useMemo)(()=>d!=="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},[d,t.props?.touchedMobile,t.props?.sizeMobile,t.props?.size,t.props?.scaleMobile,t.props?.scale]),v=(0,y.useCallback)(x=>{h({...t,props:{...t.props,alt:x}})},[t,h]),S=(0,y.useCallback)(x=>{const w=x.trim().length===0?null:x.trim();h({...t,props:{...t.props,linkHref:w}})},[t,h]),g=(0,y.useCallback)(x=>{h({...t,style:x})},[t,h]),b=(0,y.useMemo)(()=>d!=="desktop"?t.style?.heightMobile??t.style?.height??void 0:t.style?.height??void 0,[d,t.style?.height,t.style?.heightMobile]),T=(0,y.useCallback)(x=>{const w=d!=="desktop",R={...t.style??{}};w?R.heightMobile=x:R.height=x,h({...t,style:R})},[t,h,d]),M=(0,y.useCallback)(x=>{const w=d!=="desktop",R={...t.style??{}};w?R.objectFitMobile=x:R.objectFit=x,h({...t,style:R})},[t,h,d]),O=(0,y.useCallback)(x=>{const w=d!=="desktop",R={...t.style??{}};w?R.objectPositionMobile=x:R.objectPosition=x,h({...t,style:R})},[t,h,d]);return(0,n.jsxs)(Rs,{title:_("inputs.panels.image.title"),children:[(u==="block-configuration"||c)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Ft,{icon:ee.WallpaperOutlined,label:_("inputs.panels.image.title"),children:(0,n.jsx)(Xld,{data:t,setData:r,blockId:s})}),(0,n.jsx)(Ft,{icon:ee.DescriptionOutlined,label:_("inputs.panels.image.altLabel"),children:(0,n.jsx)(p9,{label:_("inputs.panels.image.altLabel"),placeholder:_("inputs.panels.image.altPlaceholder"),defaultValue:t.props?.alt??"",onChange:v})}),(0,n.jsx)(Ft,{icon:ee.LinkOutlined,label:_("inputs.panels.image.urlLabel"),children:(0,n.jsx)(p9,{label:_("inputs.panels.image.urlLabel"),placeholder:_("inputs.panels.image.urlPlaceholder"),defaultValue:t.props?.linkHref??"",onChange:S})}),(0,n.jsx)(Ft,{icon:ee.AspectRatio,label:_("inputs.panels.image.sizeLabel","Size"),children:(0,n.jsx)(Zld,{defaultValue:f.size,scale:f.scale??void 0,onChange:x=>m(x,d!=="desktop")})}),(0,n.jsx)(Ft,{icon:ee.HeightOutlined,label:_("inputs.panels.image.heightLabel"),children:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ky,{label:_("inputs.panels.image.heightLabel"),defaultValue:b??void 0,min:0,max:800,step:4,onChange:x=>T(x>0?x:null)}),b?(0,n.jsxs)(A.Stack,{direction:"row",spacing:2,sx:{mt:1},children:[(0,n.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,n.jsx)(_1,{label:_("inputs.panels.image.objectFitLabel")}),(0,n.jsx)(Oa,{style:{width:"100%"},size:"small",value:d==="desktop"?t.style?.objectFit??"cover":t.style?.objectFitMobile??t.style?.objectFit??"cover",onChange:x=>M(x.target.value),renderValue:x=>{const w=String(x??"cover");return(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[hJ(w),_(`inputs.panels.image.objectFit${pJ(w)}`)]})},children:["cover","contain","fill"].map(x=>(0,n.jsx)(A.MenuItem,{value:x,sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important"},children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[hJ(x),_(`inputs.panels.image.objectFit${pJ(x)}`)]})},x))})]}),(()=>{const x=d==="desktop"?t.style?.objectFit??"cover":t.style?.objectFitMobile??t.style?.objectFit??"cover",w=d==="desktop"?t.style?.objectPosition??"center":t.style?.objectPositionMobile??t.style?.objectPosition??"center";return x==="fill"?null:(0,n.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,n.jsx)(_1,{label:_("inputs.panels.image.objectPositionLabel")}),(0,n.jsx)(Oa,{style:{width:"100%"},size:"small",value:w,onChange:R=>O(String(R.target.value)),renderValue:R=>{const j=String(R??"center");return(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[d9(j),_(`inputs.backgroundImage.positions.${c9(j)}`)]})},children:Cld.map(R=>(0,n.jsx)(A.MenuItem,{value:R,sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important"},children:(0,n.jsxs)(A.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[d9(R),_(`inputs.backgroundImage.positions.${c9(R)}`)]})},R))})]})})()]}):null]})})]}),(0,n.jsx)($_,{}),(0,n.jsx)($n,{names:["textAlign","textAlignMobile","backgroundColor","shape","padding","mobilePadding"],value:t.style,shapeMaxValue:300,shapeSteps:20,onChange:g})]})}function tsd({data:t,setData:r}){const a=F.useSelectedSidebarTab(),o=mo(),{t:s}=Ze("inspector"),u=t.style||{},d=c=>{const _={...u||{},...c||{}};r({...t,style:_})};return(0,n.jsxs)(Rs,{title:s("inputs.panels.notionText.title","Text"),children:[(a==="block-configuration"||o)&&(0,n.jsxs)(n.Fragment,{children:[o?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)($n,{disabledCSSValidation:!0,names:["fontFamily"],value:u,onChange:d}),(0,n.jsx)($n,{disabledCSSValidation:!0,names:["lineHeight"],value:u,onChange:d})]}):(0,n.jsxs)("div",{style:{display:"flex",gap:"8px"},children:[(0,n.jsx)("div",{style:{flex:1},children:(0,n.jsx)($n,{disabledCSSValidation:!0,names:["fontFamily"],value:u,onChange:d})}),(0,n.jsx)("div",{style:{flex:1},children:(0,n.jsx)($n,{disabledCSSValidation:!0,names:["lineHeight"],value:u,onChange:d})})]}),(0,n.jsx)($n,{disabledCSSValidation:!0,names:["fontSize","fontSizeMobile"],value:u,onChange:d})]}),(a==="css"||o)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)($_,{}),(0,n.jsx)($n,{names:["backgroundColor","border","borderMobile","padding","mobilePadding"],value:u,onChange:d})]})]})}var rsd=({element:t,index:r,moveItem:a,onSelectChange:o,onUrlChange:s,onRemove:u,onDuplicate:d,canRemove:c,theme:_})=>{const h=(0,y.useRef)(null),[p,m]=(0,y.useState)(null),{t:f}=Ze("inspector"),v=H=>{const L=H.getClientOffset(),E=h.current?.getBoundingClientRect();if(!L||!E)return null;const z=(E.bottom-E.top)/2;return L.y-E.top<z?"up":"down"},[{handlerId:S,isOver:g},b]=z9(()=>({accept:"social-media-item",collect(H){return{handlerId:H.getHandlerId(),isOver:H.isOver({shallow:!0})}},hover(H,L){if(!h.current)return;if(H.index===r){m(null);return}if(!L.isOver({shallow:!0})){m(null);return}const E=v(L);m(E)},drop(H,L){if(m(null),!h.current)return;const E=H.index,z=r;if(E===z)return;const V=v(L);let k=z;V==="down"&&(k=z+1),E<k&&(k=k-1),setTimeout(()=>{a(E,k)},0),H.index=k},end:()=>{m(null)}}),[t.id,r,a]),[{isDragging:T},M]=a5(()=>({type:"social-media-item",item:()=>({id:t.id,index:r}),collect:H=>({isDragging:H.isDragging()}),end:()=>{m(null)}}),[t.id,r]);(0,y.useEffect)(()=>{g||m(null)},[g]);const O=T?.4:1;(0,y.useEffect)(()=>{if(h.current&&M&&b){const H=h.current;M(H),b(H)}},[M,b]);const x=()=>{setTimeout(()=>u(r),0)},w=()=>{setTimeout(()=>d(r),0)},R=H=>{const L=H.target.value;setTimeout(()=>o(r,L,t),0)},j=H=>{const L=H.target.value;setTimeout(()=>s(r,L,t),0)},P=()=>(0,n.jsxs)("div",{style:{height:"3px",background:_.palette.secondary.main,position:"relative",color:_.palette.secondary.main,margin:"4px 0"},children:[(0,n.jsx)("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:(0,n.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"})}),(0,n.jsx)("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:(0,n.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(0,n.jsxs)(n.Fragment,{children:[p==="up"&&(0,n.jsx)(P,{}),(0,n.jsxs)(A.Stack,{ref:h,"data-handler-id":S,sx:{border:1,borderColor:"divider",padding:1,paddingTop:0,borderRadius:1,backgroundColor:"background.paper",marginBottom:1.5,opacity:O,cursor:T?"grabbing":"grab",boxShadow:T?_.shadows[3]:"none"},spacing:1,children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:`1px solid ${_.palette.divider}`},children:[(0,n.jsx)("div",{style:{display:"flex",alignItems:"center"},children:(0,n.jsx)(ee.DragIndicator,{sx:{color:T?"primary.main":"text.secondary",cursor:"grab",marginLeft:-.9,"&:hover":{color:"primary.main"}}})}),(0,n.jsxs)("div",{children:[(0,n.jsx)(A.Tooltip,{title:"Duplicate",placement:"left",children:(0,n.jsx)(A.IconButton,{color:"primary",size:"small",onClick:w,children:(0,n.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,n.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"})})})}),c&&(0,n.jsx)(A.Tooltip,{title:"Remove",placement:"left",children:(0,n.jsx)(A.IconButton,{color:"error",size:"small",onClick:x,children:(0,n.jsx)(ee.DeleteOutlined,{sx:{fontSize:20}})})})]})]}),(0,n.jsxs)("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"0.5rem"},children:[(0,n.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[(0,n.jsx)(_1,{label:f("inputs.social.icon")}),(0,n.jsx)(Oa,{fullWidth:!0,labelId:"demo-simple-select-label",id:"demo-simple-select",value:t.key,size:"small",onChange:R,children:H0.map(H=>(0,n.jsx)(A.MenuItem,{value:H.key,children:H.label},`${t.id}_${H.key}`))})]}),(0,n.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[(0,n.jsx)(_1,{label:f("inputs.social.url")}),(0,n.jsx)(A.TextField,{size:"small",fullWidth:!0,value:t.href??"",onChange:j,variant:"outlined",placeholder:"https://your-website.com",sx:$o})]})]})]}),p==="down"&&(0,n.jsx)(P,{})]})};function nsd({items:t=[],onChange:r}){const{t:a}=Ze("inspector"),o=(0,A.useTheme)(),[s,u]=(0,y.useState)(()=>t.map(b=>({...b,id:b.id||O4()}))),[d,c]=(0,y.useState)(t[0]?.theme||"positive"),[_,h]=(0,y.useState)(t[0]?.size||"medium");(0,y.useEffect)(()=>{t.length>0&&(c(t[0].theme),h(t[0].size),u(t.map(b=>({...b,id:b.id||O4()}))))},[t]);const p=(b,T)=>{u(M=>{const O=[...M],[x]=O.splice(b,1);return O.splice(T,0,x),r&&setTimeout(()=>r(O),0),O})},m=()=>{u(b=>{const T={...H0[0],theme:d,size:_,sizePx:z1(_),url:C1(H0[0].iconName,d,_),id:O4()},M=[...b,T];return r&&setTimeout(()=>r(M),0),M})},f=b=>{u(T=>{const M=T.filter((O,x)=>x!==b);return r&&setTimeout(()=>r(M),0),M})},v=(b,T,M)=>{let O=[...s];if(T in Nid?(c(T),O=O.map(x=>{const w=C1(x.iconName,T,x.size);return{...x,theme:T,url:w}})):T in Fid&&(h(T),O=O.map(x=>{const w=C1(x.iconName,x.theme,T),R=z1(T);return{...x,size:T,sizePx:R,url:w}})),b!==null&&M){const x=H0.find(w=>w.key===T);x&&(O=O.map((w,R)=>{const j={key:x.key,label:x.label,iconName:x.iconName,href:x.href},P=C1(j.iconName,M.theme,M.size);return R===b?{...w,...j,url:P,id:M.id}:w}))}u(O),r&&setTimeout(()=>r(O),0)},S=(b,T,M)=>{const O=s.map((x,w)=>w===b?{...M,href:T}:x);u(O),r&&setTimeout(()=>r(O),0)},g=b=>{u(T=>{const M={...JSON.parse(JSON.stringify(T[b])),id:O4()},O=[...T.slice(0,b+1),M,...T.slice(b+1)];return r&&setTimeout(()=>r(O),0),O})};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:{marginBottom:"1rem",display:"grid",gridTemplateColumns:"repeat(2,1fr)",gap:"1rem"},children:[(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:a("inputs.social.theme")}),(0,n.jsx)(Oa,{fullWidth:!0,labelId:"theme-selector",id:"theme-selector",value:d,size:"small",onChange:b=>v(null,b.target.value,null),children:H4r.map(b=>(0,n.jsx)(A.MenuItem,{value:b.key,children:b.label},`${b.key}`))})]}),(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:a("inputs.social.size")}),(0,n.jsx)(Oa,{fullWidth:!0,labelId:"size-selector",id:"size-selector",value:_,size:"small",onChange:b=>v(null,b.target.value,null),children:rA.map(b=>(0,n.jsx)(A.MenuItem,{value:b.key,children:b.label},`${b.key}`))})]})]}),s?.map((b,T)=>(0,n.jsx)(rsd,{element:b,index:T,moveItem:p,onSelectChange:v,onUrlChange:S,onRemove:f,onDuplicate:g,canRemove:s.length>1,theme:o},b.id)),(0,n.jsx)(A.Button,{onClick:m,sx:{borderRadius:1},variant:"contained",endIcon:(0,n.jsx)(ee.Add,{}),children:"Add"})]})}var asd=({data:t,setData:r})=>{const[,a]=(0,y.useState)(null),o=F.useSelectedScreenSize(),{t:s}=Ze("inspector"),u=m=>{const f=Ae.BlockSocialMediaPropsScheme.safeParse(m);f.success?(r(f.data),a(null)):a(f.error)},d=m=>{u({...t,items:m})},c=m=>{u({...t,style:m})},_=(m,f=!1)=>{if(f){u({...t,gapMobile:m});return}u({...t,gap:m})},h=F.useSelectedSidebarTab(),p=mo();return(0,n.jsxs)(Rs,{title:s("inputs.panels.social.title"),children:[(h=="block-configuration"||p)&&(0,n.jsx)(Ft,{icon:ee.ShareOutlined,label:s("inputs.panels.social.title"),children:(0,n.jsx)(A.Box,{sx:{minWidth:120,margin:1},children:(0,n.jsx)(nsd,{items:t?.items??[],onChange:d})})}),(h=="css"||p)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)($_,{}),(0,n.jsx)(Ft,{icon:ee.SpaceBar,label:s("inputs.panels.social.gap"),children:(0,n.jsxs)(Er,{children:[(0,n.jsx)(_1,{label:s("inputs.panels.social.gap")}),o=="desktop"?(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.SpaceBar,{sx:{color:"text.primary"}}),value:Number(t?.gap??4),setValue:m=>_(m,!1),marks:!0,step:4,units:"px",min:0,max:40}):(0,n.jsx)(_r,{iconLabel:(0,n.jsx)(ee.SpaceBar,{sx:{color:"text.primary"}}),value:Number(t?.gapMobile??t?.gap??4),setValue:m=>_(m,!0),marks:!0,step:4,units:"px",min:0,max:40})]})}),(0,n.jsx)($n,{names:["textAlign","textAlignMobile","backgroundColor","padding","mobilePadding"],value:t.style,onChange:m=>c(m)})]})]})};function n0r({data:t,setData:r}){const[,a]=(0,y.useState)(null),{t:o}=Ze("inspector"),s=u=>{const d=Ae.SpacerPropsSchema.safeParse(u);d.success?(r(d.data),a(null)):a(d.error)};return(0,n.jsx)(Rs,{title:o("inputs.panels.spacer.title"),children:(0,n.jsx)($n,{names:["height","heightMobile","backgroundColor"],value:t.style,onChange:u=>s({...t,style:u})})})}function mJ(t){return(0,n.jsx)(A.Box,{sx:{m:3,p:1,border:"1px dashed",borderColor:"divider"},children:(0,n.jsx)(A.Typography,{color:"text.secondary",children:t})})}function osd(){const t=F.useSelectedBlockId(),r=F.useBlock(t||""),a=(0,y.useCallback)(u=>{t&&W_(t,()=>u)},[t]);if(!t)return mJ("Click on a block to inspect.");if(!r)return mJ(`Block with id ${t} was not found. Click on a block to reset.`);const{data:o,type:s}=r;switch(s){case"Button":return(0,n.jsx)(Bld,{data:o,setData:u=>a({type:s,data:u})},t);case"ColumnsContainer":return(0,n.jsx)(Kld,{data:o,setData:u=>a({type:s,data:u})},t);case"Container":return(0,n.jsx)(e0r,{data:o,setData:u=>a({type:s,data:u})},t);case"Divider":return(0,n.jsx)(t0r,{data:o,setData:u=>a({type:s,data:u})},t);case"Image":return(0,n.jsx)(esd,{data:o,setData:u=>a({type:s,data:u})},t);case"EmailLayout":return(0,n.jsx)(r0r,{data:o,setData:u=>a({type:s,data:u})},t);case"Spacer":return(0,n.jsx)(n0r,{data:o,setData:u=>a({type:s,data:u})},t);case"NotionText":return(0,n.jsx)(tsd,{data:o,setData:u=>a({type:s,data:u})},t);case"SocialMedia":return(0,n.jsx)(asd,{data:o,setData:u=>a({type:s,data:u})},t);default:return(0,n.jsx)("pre",{children:JSON.stringify(r,null," ")})}}var isd=(0,y.memo)(osd),lsd="email-builder-standalone",ssd="4.3.1",usd="module",dsd="./dist/index.cjs",csd="./dist/index.mjs",_sd="./dist/index.d.ts",hsd={".":{types:"./dist/index.d.ts",import:"./dist/index.mjs",require:"./dist/index.cjs"},"./standalone":{import:"./dist/standalone.mjs"},"./style.css":"./dist/style.css"},psd=["*.css"],msd={node:">=24"},fsd="A React email builder component with drag and drop functionality",vsd="AGPL-3.0",Ssd={name:"Laravel42",email:"hello@laravel42.com",url:"https://github.com/laravel42/"},gsd=["dist","vite.config.standalone.ts"],bsd={prepack:"pnpm build:all && node prepare-publish.cjs clean",postpack:"node prepare-publish.cjs restore","dev:publish":"pnpm version patch && pnpm publish --no-git-checks",build:"vite build","build:standalone":"vite build --config vite.config.standalone.ts","build:all":"pnpm build && pnpm build:standalone"},Tsd={"@codexteam/icons":"^0.3.3","@eb/document-core":"workspace:*","@emoji-mart/data":"^1.2.1","@emoji-mart/react":"^1.1.1","@emotion/cache":"^11.14.0","@emotion/react":"^11.14.0","@emotion/styled":"^11.14.1","@floating-ui/react":"^0.27.20","@josecortez1/c42-core":"0.1.0","@josecortez1/c42-react":"0.1.0","@mui/icons-material":"^9.2.0","@mui/material":"^9.2.0","@r2wc/react-to-web-component":"^2.1.1","@tiptap/core":"^3.28.0","@tiptap/extension-color":"^3.28.0","@tiptap/extension-link":"^3.28.0","@tiptap/extension-placeholder":"^3.28.0","@tiptap/extension-text-align":"^3.28.0","@tiptap/extension-text-style":"^3.28.0","@tiptap/extension-underline":"^3.28.0","@tiptap/pm":"^3.28.0","@tiptap/react":"^3.28.0","@tiptap/starter-kit":"^3.28.0","@tiptap/suggestion":"^3.28.0","approve-builds":"^1.0.0",csso:"^5.0.5","driver.js":"^1.8.0","emoji-mart":"^5.6.0","fast-json-patch":"^3.1.1","highlight.js":"^11.11.1","html-to-image":"1.11.13",i18next:"^26.3.6","i18next-browser-languagedetector":"^8.2.1","lucide-react":"^1.25.0",prettier:"^3.9.5",r:"^0.0.5",react:"^19.2.7","react-colorful":"^5.8.0","react-dnd":"^16.0.1","react-dnd-html5-backend":"^16.0.1","react-dnd-preview":"^9.0.0","react-dnd-touch-backend":"^16.0.1","react-dom":"^19.2.7","react-i18next":"^17.0.10","react-sticky-el":"^2.1.1",use:"^3.1.1","vite-plugin-dts":"^5.0.3",zod:"^4.4.3",zustand:"^5.0.14"},ysd={react:">=18.0.0 || ^19.0.0","react-dom":">=18.0.0 || ^19.0.0"},Csd={react:{optional:!0},"react-dom":{optional:!0}},Msd={"@codexteam/icons":"^0.3.3","@eb/block-button":"workspace:*","@eb/block-columns-container":"workspace:*","@eb/block-container":"workspace:*","@eb/block-divider":"workspace:*","@eb/block-image":"workspace:*","@eb/block-notion-text":"workspace:*","@eb/block-social-media":"workspace:*","@eb/block-spacer":"workspace:*","@eb/email-builder":"workspace:*","@types/react":"^18.3.18","@types/react-dom":"^18.3.5","@typescript-eslint/eslint-plugin":"^8.64.0","@typescript-eslint/parser":"^8.64.0","@vitejs/plugin-react-swc":"^4.3.1","editorjs-undo":"^2.0.28",esbuild:"^0.28.1",eslint:"^10.7.0","eslint-plugin-react-hooks":"^7.1.1","eslint-plugin-react-refresh":"^0.5.3","eslint-plugin-simple-import-sort":"^14.0.0",rolldown:"1.1.5",react:"^19.2.1","react-dom":"^19.2.1",typescript:"^6.0.3",vite:"^8.1.5"},xsd=["email-builder","email-template","react","typescript","wysiwyg"],t4={name:lsd,version:ssd,type:usd,main:dsd,module:csd,types:_sd,exports:hsd,sideEffects:psd,engines:msd,description:fsd,license:vsd,author:Ssd,files:gsd,scripts:bsd,dependencies:Tsd,peerDependencies:ysd,peerDependenciesMeta:Csd,devDependencies:Msd,keywords:xsd};function Osd({onReset:t,visible:r}){const{t:a}=Ze("inspector");return r?(0,n.jsx)(A.Tooltip,{title:a("theme.reset"),placement:"left",children:(0,n.jsx)(A.IconButton,{size:"small",onClick:t,sx:{color:"primary.main",flexShrink:0,width:32,height:32,"&:hover":{backgroundColor:"action.hover"}},children:(0,n.jsx)(ee.RestartAltOutlined,{fontSize:"small"})})}):(0,n.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:32,height:32,flexShrink:0}})}var wsd={top:0,right:0,bottom:0,left:0},Asd={color:B3,padding:h9,fontSize:ee.FormatSizeOutlined,fontFamily:i6,fontWeight:ee.FormatBoldOutlined,textAlign:ee.FormatAlignCenterOutlined,number:ee.FormatSizeOutlined,border:ee.BorderStyleOutlined};function Rsd({blockType:t,field:r}){const{t:a}=Ze("inspector"),{value:o,isOverridden:s,set:u,reset:d}=F.useThemeField(t,r.section,r.key),[c,_]=(0,y.useState)(!0),h=I3[t]?.[r.section]?.[r.key],p=a(r.labelKey),m=(0,n.jsx)(Osd,{onReset:d,visible:s}),f=r.icon??Asd[r.kind];switch(r.kind){case"color":return(0,n.jsx)(Ft,{icon:f,label:p,modified:s,children:(0,n.jsx)(dm,{label:p,labelAction:m,defaultValue:o??h??null,onChange:v=>v===null?d():u(v)})});case"padding":return(0,n.jsx)(Ft,{icon:f,label:p,modified:s,children:(0,n.jsx)(Dy,{label:p,labelAction:m,defaultValue:o??h??wsd,inheritedFrom:s?void 0:"default",onChange:v=>u(v),sidesLinked:c,onSidesLinkedChange:_})});case"fontSize":return(0,n.jsx)(Ft,{icon:f,label:p,modified:s,children:(0,n.jsx)(_9,{label:p,labelAction:m,defaultValue:o??h??16,onChange:v=>u(v)})});case"fontFamily":return(0,n.jsx)(Ft,{icon:f,label:p,modified:s,children:(0,n.jsx)(sA,{label:p,labelAction:m,defaultValue:o??h??null,onChange:v=>v===null?d():u(v)})});case"fontWeight":return(0,n.jsx)(Ft,{icon:f,label:p,modified:s,children:(0,n.jsx)(Q4r,{label:p,labelAction:m,defaultValue:o??h??"normal",onChange:v=>u(v)})});case"textAlign":return(0,n.jsx)(Ft,{icon:f,label:p,modified:s,children:(0,n.jsx)(Ny,{label:p,labelAction:m,defaultValue:o??h??null,onChange:v=>v===null?d():u(v)})});case"number":return(0,n.jsx)(Ft,{icon:f,label:p,modified:s,children:(0,n.jsx)(_9,{label:p,labelAction:m,defaultValue:o??h??0,onChange:v=>u(v)})});case"border":return(0,n.jsx)(Ft,{icon:f,label:p,modified:s,children:(0,n.jsx)(zsd,{blockType:t,field:r})});default:return r.kind,null}}function zsd({blockType:t,field:r}){const{t:a}=Ze("inspector"),o=F.useThemeField(t,r.section,"borderColor"),s=F.useThemeField(t,r.section,"borderTop"),u=F.useThemeField(t,r.section,"borderBottom"),d=F.useThemeField(t,r.section,"borderLeft"),c=F.useThemeField(t,r.section,"borderRight"),[_,h]=(0,y.useState)(!0),p=I3[t]?.[r.section],m=f=>{f.borderColor!==void 0&&o.set(f.borderColor),f.borderTop!==void 0&&s.set(f.borderTop),f.borderBottom!==void 0&&u.set(f.borderBottom),f.borderLeft!==void 0&&d.set(f.borderLeft),f.borderRight!==void 0&&c.set(f.borderRight)};return(0,n.jsx)(Vy,{label:a(r.labelKey),borderColor:o.value??p?.borderColor??null,borderTop:s.value??p?.borderTop??0,borderBottom:u.value??p?.borderBottom??0,borderLeft:d.value??p?.borderLeft??0,borderRight:c.value??p?.borderRight??0,onChange:m,sidesLinked:_,onSidesLinkedChange:h})}function jsd({blockType:t,spec:r,defaultExpanded:a=!1}){const{t:o}=Ze("inspector"),s=F.useThemeBlockOverride(t),u=mo(),d=Psd(s)>0,c=r.icon;return(0,n.jsxs)(A.Accordion,{defaultExpanded:a,disableGutters:!0,square:!0,sx:{boxShadow:"none",borderTop:_=>`1px solid ${_.palette.divider}`,"&:before":{display:"none"}},children:[(0,n.jsx)(A.AccordionSummary,{expandIcon:u?void 0:(0,n.jsx)(ee.ExpandMoreOutlined,{}),sx:{px:0,minHeight:u?40:48,justifyContent:u?"center":void 0,"& .MuiAccordionSummary-content":{my:u?.5:1,justifyContent:u?"center":void 0}},children:u?(0,n.jsx)(A.Tooltip,{title:o(r.titleKey),placement:"left",children:(0,n.jsxs)(A.Box,{sx:{position:"relative",display:"flex",alignItems:"center",p:.5,borderRadius:2,color:"text.secondary"},children:[(0,n.jsx)(c,{fontSize:"small"}),d&&(0,n.jsx)(A.Box,{component:"span","aria-label":o("theme.modified","Modified"),sx:{position:"absolute",top:2,right:2,width:6,height:6,borderRadius:"50%",bgcolor:"primary.main"}})]})}):(0,n.jsx)(A.Stack,{direction:"row",spacing:1,sx:{width:"100%",alignItems:"center"},children:(0,n.jsxs)(A.Box,{sx:{position:"relative",display:"inline-flex"},children:[(0,n.jsx)(A.Typography,{sx:{fontWeight:600,color:"text.primary"},children:o(r.titleKey)}),d&&(0,n.jsx)(A.Box,{component:"span","aria-label":o("theme.modified","Modified"),sx:{position:"absolute",top:-1,right:-8,width:6,height:6,borderRadius:"50%",bgcolor:"primary.main"}})]})})}),(0,n.jsx)(A.AccordionDetails,{sx:{p:0,pb:3},children:(0,n.jsx)(A.Stack,{spacing:2,children:r.fields.map(_=>(0,n.jsx)(Rsd,{blockType:t,field:_},`${_.section}.${_.key}`))})})]})}function Psd(t){return t?(t.style?Object.keys(t.style).length:0)+(t.props?Object.keys(t.props).length:0):0}function Hsd({defaultExpanded:t=!0}){const{t:r}=Ze("inspector"),a=$4r("root"),o=mo();if(!a||a.type!=="EmailLayout")return null;const{data:s}=a;return(0,n.jsxs)(A.Accordion,{defaultExpanded:t,disableGutters:!0,square:!0,sx:{boxShadow:"none",borderTop:u=>`1px solid ${u.palette.divider}`,"&:before":{display:"none"}},children:[(0,n.jsx)(A.AccordionSummary,{expandIcon:o?void 0:(0,n.jsx)(ee.ExpandMoreOutlined,{}),sx:{px:0,minHeight:o?40:48,justifyContent:o?"center":void 0,"& .MuiAccordionSummary-content":{my:o?.5:1,justifyContent:o?"center":void 0}},children:o?(0,n.jsx)(A.Tooltip,{title:r("theme.blocks.root.title"),placement:"left",children:(0,n.jsx)(A.Box,{sx:{display:"flex",p:.5,borderRadius:2,color:"text.secondary"},children:(0,n.jsx)(ee.TuneOutlined,{fontSize:"small"})})}):(0,n.jsx)(A.Typography,{sx:{fontWeight:600,color:"text.primary"},children:r("theme.blocks.root.title")})}),(0,n.jsx)(A.AccordionDetails,{sx:{px:0,pt:0,pb:3},children:(0,n.jsx)(A.Stack,{spacing:2,children:(0,n.jsx)(r0r,{data:s,setData:u=>{F.clearAppliedTheme(),W_("root",()=>({type:"EmailLayout",data:u}))}})})})]})}async function Lsd(t){const r=await t.json().catch(()=>null);if(!t.ok)throw t.status===403&&r?.hint?new Error(r.hint):new Error(r?.error??`HTTP ${t.status}`);return r}async function a0r(t){return F.getComponentsStorageMode()==="local"?Ae.localSaveTheme(t):Lsd(await fetch(`${to()}/dev/save-theme`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}))}var N8=100,F8=280;function Esd({open:t,onClose:r,onSaved:a}){const{t:o}=Ze("inspector"),[s,u]=(0,y.useState)(""),[d,c]=(0,y.useState)(""),[_,h]=(0,y.useState)(!1),[p,m]=(0,y.useState)(null),f=s.trim(),v=f.length>0&&f.length<=N8&&d.length<=F8,S=(0,y.useCallback)(()=>{_||(u(""),c(""),m(null),r())},[_,r]),g=(0,y.useCallback)(async()=>{if(!(!v||_)){h(!0),m(null);try{const b=F.buildCurrentThemeBundlePayload(),T=await a0r({name:f,description:d.trim()||void 0,bundle:b});a?.(T.id),u(""),c(""),r()}catch(b){m(b instanceof Error?b.message:String(b))}finally{h(!1)}}},[v,_,f,d,r,a]);return(0,n.jsxs)(A.Dialog,{open:t,onClose:S,maxWidth:"sm",fullWidth:!0,children:[(0,n.jsx)(A.DialogTitle,{children:o("theme.save.title","Save current theme")}),(0,n.jsx)(A.DialogContent,{children:(0,n.jsxs)(A.Stack,{spacing:2,sx:{mt:1},children:[(0,n.jsx)(A.Typography,{variant:"body2",color:"text.secondary",children:o("theme.save.description","Snapshots the current root globals and per-block-type theme overrides. Saved themes can be reapplied later from the Components Library.")}),(0,n.jsx)(A.TextField,{label:o("theme.save.nameLabel","Name"),value:s,onChange:b=>u(b.target.value),placeholder:o("theme.save.namePlaceholder","e.g. Brand default"),autoFocus:!0,fullWidth:!0,disabled:_,slotProps:{htmlInput:{maxLength:N8}},helperText:`${f.length}/${N8}`}),(0,n.jsx)(A.TextField,{label:o("theme.save.descriptionLabel","Description (optional)"),value:d,onChange:b=>c(b.target.value),fullWidth:!0,multiline:!0,minRows:2,disabled:_,slotProps:{htmlInput:{maxLength:F8}},helperText:`${d.length}/${F8}`}),p&&(0,n.jsx)(A.Alert,{severity:"error",children:p})]})}),(0,n.jsxs)(A.DialogActions,{children:[(0,n.jsx)(A.Button,{onClick:S,disabled:_,children:o("theme.save.cancel","Cancel")}),(0,n.jsx)(A.Button,{onClick:g,variant:"contained",disabled:!v||_,children:_?o("theme.save.submitting","Saving…"):o("theme.save.submit","Save")})]})]})}function Vsd(){const{t}=Ze("inspector"),r=F.useShowVersion(),a=F.useComponentsLibraryEnabled(),o=F.useTemplateSaving(),s=F.useThemeSaving(),u=mo(),[d,c]=(0,y.useState)(!1),[_,h]=(0,y.useState)(!1);return(0,n.jsxs)(A.Container,{sx:{padding:"0!important",paddingTop:"1rem!important",display:"flex",flexDirection:"column",flex:"1 0 auto",minHeight:"100%"},children:[!u&&(0,n.jsxs)(A.Stack,{direction:"row",sx:{mb:2,flexWrap:"wrap",gap:1,alignItems:"center",justifyContent:"space-between"},children:[(0,n.jsx)(A.Typography,{sx:{fontWeight:"bold",color:"text.primary",fontSize:"1.25rem"},children:t("styles.rootTitle")}),a&&(0,n.jsxs)(A.Stack,{direction:"row",spacing:.5,sx:{width:"100%",ml:"0!important"},children:[s&&(0,n.jsx)(A.Tooltip,{title:t("theme.exportTooltip","Save current theme to the gallery"),children:(0,n.jsx)(A.Button,{size:"small",variant:"outlined",startIcon:(0,n.jsx)(ee.BookmarkAddOutlined,{fontSize:"small"}),onClick:()=>c(!0),children:t("theme.exportButton","Theme")})}),o&&(0,n.jsx)(A.Tooltip,{title:t("componentsLibrary.saveTemplate.tooltip","Save the current document as a reusable template"),children:(0,n.jsx)(A.Button,{size:"small",variant:"outlined",startIcon:(0,n.jsx)(ee.FileDownloadOutlined,{fontSize:"small"}),onClick:()=>h(!0),children:t("componentsLibrary.saveTemplate.button","Template")})})]})]}),(0,n.jsxs)(A.Box,{children:[(0,n.jsx)(Hsd,{defaultExpanded:!0}),Dld.map(p=>(0,n.jsx)(jsd,{blockType:p,spec:X4r[p],defaultExpanded:!1},p))]}),r&&(0,n.jsx)(A.Box,{color:"text.secondary",sx:{display:"flex",justifyContent:"flex-end",mt:"auto",pt:3,pb:3},children:u?(0,n.jsxs)(A.Link,{href:`https://www.npmjs.com/package/${t4.name}`,target:"_blank",rel:"noopener noreferrer",sx:{fontSize:"0.75rem"},children:["v",t4.version]}):(0,n.jsxs)(A.Box,{sx:{textAlign:"right"},children:[(0,n.jsxs)(A.Typography,{variant:"body2",children:[t("inputs.panels.emailLayout.version"),": ",t4.version]}),(0,n.jsx)(A.Link,{href:`https://www.npmjs.com/package/${t4.name}`,target:"_blank",rel:"noopener noreferrer",sx:{fontSize:"0.875rem",mt:.5,display:"inline-block"},children:t4.name})]})}),(0,n.jsx)(Esd,{open:d,onClose:()=>c(!1)}),(0,n.jsx)(Pid,{open:_,onClose:()=>h(!1)})]})}function ksd(){const t=F.useSelectedBlockId(),r=$4r(t??"root"),a=(0,y.useCallback)(u=>{t&&W_(t,()=>u)},[t]);if(!r)return null;const{data:o,type:s}=r;switch(s){case"Container":return(0,n.jsx)(e0r,{data:o,setData:u=>a({type:s,data:u})},t);case"Divider":return(0,n.jsx)(t0r,{data:o,setData:u=>a({type:s,data:u})},t);case"Spacer":return(0,n.jsx)(n0r,{data:o,setData:u=>a({type:s,data:u})},t);case"EmailLayout":return(0,n.jsx)(Vsd,{});default:return(0,n.jsx)("pre",{children:JSON.stringify(r,null," ")})}}function Dsd({sticky:t,heightContent:r}){const a=F.useSelectedSidebarTab(),o=F.useBlockTypeSelected(),s=F.useSelectedBlockId(),u=F.useSelectedScreenSize(),d=F.useInspectorDrawerMode(),c=(0,A.useTheme)(),{t:_}=Ze("inspector");(0,y.useEffect)(()=>{const g=b=>{const T=b.target;F.setWindowWidth(T.innerWidth)};return window&&F.setWindowWidth(window.innerWidth),window.addEventListener("resize",g),()=>{window.removeEventListener("resize",g)}},[a]);const h=()=>{const g={position:"absolute",top:"1rem",right:"0.5rem",color:"primary.main",fontSize:"20px",cursor:"pointer",display:S?"none":void 0},b=()=>F.setSelectedScreenSize(u==="desktop"?"mobile":"desktop");return a==="block-configuration"||a==="css"||S&&s&&!F.BLOCKS_DEFAULT_CSS.includes(o||"")?(0,n.jsxs)("div",{style:{position:"relative",display:"flex",flexDirection:"column",flex:"1 0 auto"},children:[u==="desktop"?(0,n.jsx)(ee.MonitorOutlined,{sx:g,onClick:b}):(0,n.jsx)(ee.PhoneIphoneOutlined,{sx:g,onClick:b}),(0,n.jsx)(isd,{})]}):(0,n.jsxs)("div",{style:{position:"relative",display:"flex",flexDirection:"column",flex:"1 0 auto"},children:[(0,n.jsx)(ksd,{}),u==="desktop"?(0,n.jsx)(ee.MonitorOutlined,{sx:g,onClick:b}):(0,n.jsx)(ee.PhoneIphoneOutlined,{sx:g,onClick:b})]})},p=()=>(0,n.jsx)("svg",{style:{marginRight:"4px",color:"inherit"},width:"21",height:"20",viewBox:"0 0 21 20",fill:"none",children:(0,n.jsx)("path",{d:"M3.83398 5H17.1673M3.83398 10H17.1673M3.83398 15H9.66732",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),m=()=>(0,n.jsx)("svg",{style:{marginRight:"4px",color:"inherit"},width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:(0,n.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,b)=>{F.setSidebarTab(b)},v=t?r?`calc(${r} - 4px)`:void 0:r??void 0,S=d==="compact";return(0,n.jsx)(H2d,{value:S,children:(0,n.jsxs)(A.Container,{sx:g=>({width:S?56:385,padding:"0!important",margin:"0!important",height:v,maxHeight:v,display:"flex",flexDirection:"column",overflow:"hidden",position:t?"sticky":"static",top:t?F.HEADER_HEIGHT:0,backgroundColor:`${g.palette.background.paper} !important`}),children:[(0,n.jsx)(A.Box,{sx:{position:"sticky",top:0,zIndex:1,backgroundColor:`${c.palette.background.paper} !important`,display:S?"none":void 0},children:(0,n.jsxs)(A.Tabs,{sx:{backgroundColor:`${c.palette.background.paper} !important`},value:a,onChange:f,children:[s!=null&&!F.BLOCKS_DEFAULT_CSS.includes(o||"")&&[(0,n.jsx)(A.Tab,{sx:{height:"50px",minHeight:"50px",fontWeight:"bold"},value:"block-configuration",label:_("header.content"),icon:(0,n.jsx)(p,{}),iconPosition:"start"},"block-configuration"),(0,n.jsx)(A.Tab,{sx:{height:"50px",minHeight:"50px",fontWeight:"bold"},value:"css",label:_("header.styles"),icon:(0,n.jsx)(m,{}),iconPosition:"start"},"css")],s!=null&&F.BLOCKS_DEFAULT_CSS.includes(o)&&[(0,n.jsx)(A.Tab,{sx:{height:"50px",minHeight:"50px",fontWeight:"bold"},value:"styles",label:_("header.styles"),icon:(0,n.jsx)(m,{}),iconPosition:"start"},"styles")],s==null&&(0,n.jsx)(A.Tab,{sx:{height:"50px",minHeight:"50px",fontWeight:"bold"},value:"styles",label:_("header.styles"),icon:(0,n.jsx)(m,{}),iconPosition:"start"},"styles")]})}),(0,n.jsx)(A.Container,{sx:g=>({flex:"1 1 auto",minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column",px:S?"0.5rem!important":"1rem!important",backgroundColor:`${g.palette.background.paper} !important`}),children:h()})]})})}var o0r=({children:t,topOffset:r=0,zIndex:a=10,className:o="",style:s={},disabled:u=!1,threshold:d=null,...c})=>{const[_,h]=(0,y.useState)(!1),[p,m]=(0,y.useState)({width:0,height:0}),[f,v]=(0,y.useState)({left:0}),[S,g]=(0,y.useState)(0),[b,T]=(0,y.useState)(!1),M=(0,y.useRef)(null),O=(0,y.useRef)(null),x=(0,y.useRef)(null);(0,y.useEffect)(()=>{if(u){h(!1),T(!1),g(0);return}const j=O.current,P=M.current;if(!j||!P)return;let H=null;d&&(d.startsWith("#")?H=document.getElementById(d.slice(1)):(d.startsWith("."),H=document.querySelector(d)));const L=()=>{const D=P.getBoundingClientRect();m({width:D.width,height:D.height}),v({left:D.left})},E=()=>{if(!H||!P)return{offset:0,isPushed:!1};const D=H.getBoundingClientRect(),N=P.getBoundingClientRect(),I=r+N.height;if(D.top<I){const B=I-D.top,q=N.height+20;return{offset:-Math.min(B,q),isPushed:!0}}return{offset:0,isPushed:!1}},z=new IntersectionObserver(([D])=>{const N=!D.isIntersecting;if(N&&!_&&L(),h(N),N&&d){const{offset:I,isPushed:B}=E();g(I),T(B)}else N||(g(0),T(!1))},{threshold:0,rootMargin:`-${r}px 0px 0px 0px`}),V=new ResizeObserver(()=>{L()}),k=()=>{if(d&&_){const{offset:D,isPushed:N}=E();g(D),T(N)}};return z.observe(j),V.observe(P),d&&window.addEventListener("scroll",k,{passive:!0}),L(),()=>{z.disconnect(),V.disconnect(),d&&window.removeEventListener("scroll",k)}},[r,_,u,d]);const w=!u&&_,R=w?`${r+S}px`:"auto";return(0,n.jsxs)("div",{ref:x,className:o,...c,children:[!u&&(0,n.jsx)("div",{ref:O,style:{height:"1px",position:"absolute",top:`-${r+1}px`,left:0,right:0,pointerEvents:"none"}}),w&&(0,n.jsx)("div",{style:{height:`${p.height}px`,width:`${p.width}px`}}),(0,n.jsx)("div",{ref:M,style:{position:w?"fixed":"static",top:R,width:"auto",height:"auto",zIndex:w?a:"auto",transition:b?"none":"box-shadow 0.2s ease-in-out, top 0.3s ease-out",...b&&S<-p.height*.3&&{opacity:Math.max(0,1+(S+p.height*.3)/(p.height*.7))},...s},children:t})]})};jO();function Nsd(){const t=F.useInspectorDrawerOpen(),r=F.useInspectorDrawerMode(),{t:a}=Ze("inspector");if(!t)return null;const o=()=>F.setInspectorDrawerMode(r==="full"?"compact":"full"),s=r==="compact";return(0,n.jsx)(A.Box,{sx:{position:"absolute",left:0,top:"50%",transform:"translateX(-100%) translateY(-50%)",zIndex:10},children:(0,n.jsx)(A.Tooltip,{title:s?a("inspector.handle.expand","Expand panel"):a("inspector.handle.compact","Compact panel"),placement:"left",children:(0,n.jsx)(A.ButtonBase,{onClick:o,sx:u=>({width:24,minHeight:80,borderTopLeftRadius:8,borderBottomLeftRadius:8,backgroundColor:s?u.palette.primary.main:u.palette.background.paper,color:s?u.palette.primary.contrastText:u.palette.text.secondary,border:`1px solid ${u.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:s?u.palette.primary.dark:u.palette.mode==="dark"?u.palette.grey[800]:u.palette.grey[200]}}),children:(0,n.jsx)(jv,{sx:{fontSize:16}})})})})}var fJ=t=>Symbol.iterator in t,vJ=t=>"entries"in t,SJ=(t,r)=>{const a=t instanceof Map?t:new Map(t.entries()),o=r instanceof Map?r:new Map(r.entries());if(a.size!==o.size)return!1;for(const[s,u]of a)if(!o.has(s)||!Object.is(u,o.get(s)))return!1;return!0},Fsd=(t,r)=>{const a=t[Symbol.iterator](),o=r[Symbol.iterator]();let s=a.next(),u=o.next();for(;!s.done&&!u.done;){if(!Object.is(s.value,u.value))return!1;s=a.next(),u=o.next()}return!!s.done&&!!u.done};function Isd(t,r){return Object.is(t,r)?!0:typeof t!="object"||t===null||typeof r!="object"||r===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(r)?!1:fJ(t)&&fJ(r)?vJ(t)&&vJ(r)?SJ(t,r):Fsd(t,r):SJ({entries:()=>Object.entries(t)},{entries:()=>Object.entries(r)})}function Bsd(t){const r=y.default.useRef(void 0);return a=>{const o=t(a);return Isd(r.current,o)?r.current:r.current=o}}function uA({children:t}){const r=F.useSelectedScreenSize(),a=F.useDisableEdition(),o=F.useImageUploading();return(0,n.jsx)(Ae.ViewportProvider,{value:r,children:(0,n.jsx)(Ae.RootDataProvider,{value:F.useRoot()??null,children:(0,n.jsx)(Ae.DisableEditionProvider,{value:a,children:(0,n.jsx)(Ae.ImageUploadingProvider,{value:o,children:(0,n.jsx)(Ae.ImageAutoWidthProvider,{value:Jsd,children:t})})})})})}function Jsd(t,r){F.updateBlockProps(t,{...F.editorStateStore.getState().document[t]?.data?.props??{},width:r})}function Usd(t){return typeof ReadableStream<"u"&&t instanceof ReadableStream?(async function*(){const r=t.getReader(),a=new TextDecoder;try{for(;;){const{value:o,done:s}=await r.read();if(s){const u=a.decode();u&&(yield u);return}o!==void 0&&(typeof o=="string"?yield o:yield a.decode(o,{stream:!0}))}}finally{r.releaseLock()}})():t}function*gJ(t){const r=t.split(`
422
422
  `);let a=null;const o=[];for(const d of r)if(d.length!==0&&!d.startsWith(":")){if(d.startsWith("event:")){a=d.slice(6).trimStart();continue}if(d.startsWith("data:")){const c=d.slice(5);o.push(c.startsWith(" ")?c.slice(1):c);continue}}const s=o.join(`
423
423
  `);if(s.length===0)return;const u=t.length;if(s==="[DONE]"){yield{kind:"done",raw:t,bytes:u};return}if(a==="error"){let d=s;try{d=JSON.parse(s)}catch{}yield{kind:"error",payload:d,raw:t,bytes:u};return}if(a==="warning"){let d=s;try{d=JSON.parse(s)}catch{}yield{kind:"warning",payload:d,raw:t,bytes:u};return}if(a==="info"){let d=s;try{d=JSON.parse(s)}catch{}yield{kind:"info",payload:d,raw:t,bytes:u};return}try{const d=JSON.parse(s);if(typeof d.id!="string"||typeof d.block!="object"||d.block===null){yield{kind:"malformed",raw:t,reason:"Missing or invalid {id, block} payload",bytes:u};return}yield{kind:"block",id:d.id,block:d.block,raw:t,bytes:u}}catch(d){yield{kind:"malformed",raw:t,reason:d instanceof Error?d.message:"Invalid JSON",bytes:u}}}async function*Wsd(t){const r=Usd(t);let a="";for await(const s of r){a+=s,a=a.replace(/\r\n/g,`
424
424
  `);let u;for(;(u=a.indexOf(`