email-builder-online 3.4.28 → 3.4.30

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
@@ -1,4 +1,4 @@
1
- "use strict";var JW=Object.defineProperty;var CN=t=>{throw TypeError(t)};var ZW=(t,e,n)=>e in t?JW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Y=(t,e,n)=>ZW(t,typeof e!="symbol"?e+"":e,n),mv=(t,e,n)=>e.has(t)||CN("Cannot "+n);var Ni=(t,e,n)=>(mv(t,e,"read from private field"),n?n.call(t):e.get(t)),Nc=(t,e,n)=>e.has(t)?CN("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),gv=(t,e,n,i)=>(mv(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),Ps=(t,e,n)=>(mv(t,e,"access private method"),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("react/jsx-runtime"),E=require("react"),Yl=require("react-dnd"),eY=require("react-dnd-html5-backend"),It=require("react-i18next"),k=require("@mui/material"),s9=require("react-dom/client"),Q=require("@mui/icons-material"),fe=require("@mui/material/styles"),Ou=require("react-dom"),tY=require("react-dom/server"),Zc=require("i18next");var nY=Object.defineProperty,iY=(t,e,n)=>e in t?nY(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,xg=(t,e,n)=>iY(t,typeof e!="symbol"?e+"":e,n);const rY={stringify:t=>t?"true":"false",parse:t=>/^[ty1-9]/i.test(t)},sY={stringify:t=>t.name,parse:(t,e,n)=>{const i=(()=>{if(typeof window<"u"&&t in window)return window[t];if(typeof global<"u"&&t in global)return global[t]})();return typeof i=="function"?i.bind(n):void 0}},aY={stringify:t=>JSON.stringify(t),parse:t=>JSON.parse(t)};function oY(t){return t.replace(/([a-z0-9])([A-Z])/g,(e,n,i)=>`${n}-${i.toLowerCase()}`)}function a9(t){return t.replace(/[-:]([a-z])/g,(e,n)=>`${n.toUpperCase()}`)}const lY={stringify:t=>t.name,parse:(t,e,n)=>{const i=(()=>{const r=a9(e);if(typeof n<"u"&&r in n.container)return n.container[r]})();return typeof i=="function"?i.bind(n):void 0}},cY={stringify:t=>`${t}`,parse:t=>parseFloat(t)},uY={stringify:t=>t,parse:t=>t},_v={string:uY,number:cY,boolean:rY,function:sY,method:lY,json:aY},gp=Symbol.for("r2wc.render"),kg=Symbol.for("r2wc.connected"),Ic=Symbol.for("r2wc.context"),Ur=Symbol.for("r2wc.props");function o9(t,e,n){var i,r,s;e.props||(e.props=t.propTypes?Object.keys(t.propTypes):[]),e.events||(e.events=[]);const a=Array.isArray(e.props)?e.props.slice():Object.keys(e.props),o=Array.isArray(e.events)?e.events.slice():Object.keys(e.events),l={},c={},u={},d={};for(const p of a){l[p]=Array.isArray(e.props)?"string":e.props[p];const m=oY(p);u[p]=m,d[m]=p}for(const p of o)c[p]=Array.isArray(e.events)?{}:e.events[p];class f extends HTMLElement{constructor(){super(),xg(this,s,!0),xg(this,r),xg(this,i,{}),xg(this,"container"),e.shadow?this.container=this.attachShadow({mode:e.shadow}):this.container=this,this[Ur].container=this.container;for(const m of a){const _=u[m],g=this.getAttribute(_),b=l[m],y=b?_v[b]:null;if(b==="method"){const v=a9(_);Object.defineProperty(this[Ur].container,v,{enumerable:!0,configurable:!0,get(){return this[Ur][v]},set(T){this[Ur][v]=T,this[gp]()}}),this[Ur][m]=y.parse(g,_,this)}y!=null&&y.parse&&g&&(this[Ur][m]=y.parse(g,_,this))}for(const m of o)this[Ur][m]=_=>{const g=m.replace(/^on/,"").toLowerCase();this.dispatchEvent(new CustomEvent(g,{detail:_,...c[m]}))}}static get observedAttributes(){return Object.keys(d)}connectedCallback(){this[kg]=!0,this[gp]()}disconnectedCallback(){this[kg]=!1,this[Ic]&&n.unmount(this[Ic]),delete this[Ic]}attributeChangedCallback(m,_,g){const b=d[m],y=l[b],v=y?_v[y]:null;b in l&&v!=null&&v.parse&&g&&(this[Ur][b]=v.parse(g,m,this),this[gp]())}[(s=kg,r=Ic,i=Ur,gp)](){this[kg]&&(this[Ic]?n.update(this[Ic],this[Ur]):this[Ic]=n.mount(this.container,t,this[Ur]))}}for(const p of a){const m=u[p],_=l[p];Object.defineProperty(f.prototype,p,{enumerable:!0,configurable:!0,get(){return this[Ur][p]},set(g){this[Ur][p]=g;const b=_?_v[_]:null;if(b!=null&&b.stringify){const y=b.stringify(g,m,this);this.getAttribute(m)!==y&&this.setAttribute(m,y)}else this[gp]()}})}return f}function dY(t,e,n){const i=s9.createRoot(t),r=E.createElement(e,n);return i.render(r),{root:i,ReactComponent:e}}function fY({root:t,ReactComponent:e},n){const i=E.createElement(e,n);t.render(i)}function pY({root:t}){t.unmount()}function hY(t,e={}){return o9(t,e,{mount:dY,update:fY,unmount:pY})}const mY={},xN=t=>{let e;const n=new Set,i=(u,d)=>{const f=typeof u=="function"?u(e):u;if(!Object.is(f,e)){const p=e;e=d??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(m=>m(e,p))}},r=()=>e,l={setState:i,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(mY?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=e=t(i,r,l);return l},l9=t=>t?xN(t):xN;var Ml=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pm(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var bv={exports:{}},yv={},Ev={exports:{}},vv={};var kN;function gY(){if(kN)return vv;kN=1;var t=E;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:e,i=t.useState,r=t.useEffect,s=t.useLayoutEffect,a=t.useDebugValue;function o(d,f){var p=f(),m=i({inst:{value:p,getSnapshot:f}}),_=m[0].inst,g=m[1];return s(function(){_.value=p,_.getSnapshot=f,l(_)&&g({inst:_})},[d,p,f]),r(function(){return l(_)&&g({inst:_}),d(function(){l(_)&&g({inst:_})})},[d]),a(p),p}function l(d){var f=d.getSnapshot;d=d.value;try{var p=f();return!n(d,p)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:o;return vv.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,vv}var wN;function c9(){return wN||(wN=1,Ev.exports=gY()),Ev.exports}var AN;function _Y(){if(AN)return yv;AN=1;var t=E,e=c9();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var i=typeof Object.is=="function"?Object.is:n,r=e.useSyncExternalStore,s=t.useRef,a=t.useEffect,o=t.useMemo,l=t.useDebugValue;return yv.useSyncExternalStoreWithSelector=function(c,u,d,f,p){var m=s(null);if(m.current===null){var _={hasValue:!1,value:null};m.current=_}else _=m.current;m=o(function(){function b(w){if(!y){if(y=!0,v=w,w=f(w),p!==void 0&&_.hasValue){var I=_.value;if(p(I,w))return T=I}return T=w}if(I=T,i(v,w))return I;var A=f(w);return p!==void 0&&p(I,A)?(v=w,I):(v=w,T=A)}var y=!1,v,T,x=d===void 0?null:d;return[function(){return b(u())},x===null?void 0:function(){return b(x())}]},[u,d,f,p]);var g=r(c,m[0],m[1]);return a(function(){_.hasValue=!0,_.value=g},[g]),l(g),g},yv}var DN;function bY(){return DN||(DN=1,bv.exports=_Y()),bv.exports}var u9=bY();const yY=Pm(u9),d9={},{useDebugValue:EY}=E,{useSyncExternalStoreWithSelector:vY}=yY;let NN=!1;const SY=t=>t;function TY(t,e=SY,n){(d9?"production":void 0)!=="production"&&n&&!NN&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),NN=!0);const i=vY(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return EY(i),i}const IN=t=>{(d9?"production":void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof t=="function"?l9(t):t,n=(i,r)=>TY(e,i,r);return Object.assign(n,e),n},f9=t=>t?IN(t):IN,Gd=600,vx=370,pl="50px",CY=["#DC2626","#EF4444","#F87171","#EC4899","#BE185D","#7C2D12","#EA580C","#F97316","#FBBF24","#D97706","#A16207","#92400E","#059669","#10B981","#22C55E","#65A30D","#166534","#064E3B","#2563EB","#3B82F6","#60A5FA","#0EA5E9","#0891B2","#1E40AF","#7C3AED","#A855F7","#FFFFFF","#000000","#F9FAFB","#111827","","","","",""],xY={root:{type:"EmailLayout",data:{backdropColor:"#F5F5F5",canvasColor:"#FFFFFF",textColor:"#262626",fontFamily:"MODERN_SANS",linkGlobal:{linkColor:"#2563EB",underline:!0},childrenIds:["block-1770848212159"],showVersion:!0}},"block-1770848212159":{type:"NotionText",data:{props:{html:'<p>Double-click to edit then type "/" for commands...</p>'},style:{padding:{top:16,bottom:16,left:24,right:24},mobilePadding:null,fontSize:16,fontWeight:"normal",color:null,backgroundColor:null,textAlign:"left"}}}},ub=["Spacer","Divider","Container",null],Kl=f9(()=>({stackUndo:[],stackRedo:[],pendingUndoTimeout:null,pendingOriginalDocument:null,lastChange:null}));function kY(){return Kl(t=>t.stackUndo.length>0||t.pendingOriginalDocument!==null)}function wY(){return Kl(t=>t.stackRedo.length>0)}function p9(){return Kl.getState()}function Ky(){return Kl.getState().stackUndo}function h9(){return Kl.getState().stackRedo}function jc(t){Kl.setState(t)}function AY(){const{pendingUndoTimeout:t}=Kl.getState();t&&clearTimeout(t),Kl.setState({stackUndo:[],stackRedo:[],pendingUndoTimeout:null,pendingOriginalDocument:null,lastChange:null})}function Qd(t){const e={...t};for(const[n,i]of Object.entries(e))(i.type==="CustomEditor"||i.type==="Wysiwyg")&&(e[n]={...i,type:"NotionText"});return e}const db=385,qh="https://maildrill.s3.eu-south-1.amazonaws.com/assets/emailbuilder-placeholder.jpg";let Sv=null;const DY=2e3;function Fm(){Sv&&clearTimeout(Sv),Sv=setTimeout(()=>{const t=new CustomEvent("email-builder-auto-save",{detail:!0});window.dispatchEvent(t)},DY)}const m9=()=>({document:Qd(JSON.parse(JSON.stringify(xY))),selectedBlockId:null,selectedSidebarTab:"styles",selectedMainTab:"editor",selectedScreenSize:"desktop",windowWidth:0,inspectorDrawerOpen:!0,componentTreeOpen:!1,samplesDrawerOpen:!0,inspectorDrawerWidth:db,devMode:!1,imageUploading:{uploading:!1,id:""},disableEdition:!1,disableUpdate:!1,freeMode:!1,minHeight:"calc(100dvh - 65px)",color:{primary:"",secondary:""},galleryImages:!0,imagePlaceholder:qh,darkMode:!0,colorPicker:{paletteColors:CY,isLocked:!1},tour:!1,stickyHeader:!0,heightContent:"calc(100dvh - 50px)",containerGrow:!0,wysiwygInlineEditingBlockId:null,notionTextInlineEditingBlockId:null,highlightColor:"#FF6B35"}),ye=f9(()=>m9()),NY=t=>{const e=m9();return l9(()=>({...e,...t,document:e.document}))},IY=E.createContext(ye),OY=({store:t=ye,children:e})=>h.jsx(IY.Provider,{value:t,children:e});function g9(){const t=ye(e=>e.document[ye(n=>n.selectedBlockId)||""]);return t?t.type:null}function ON(t){return ye.setState({windowWidth:t})}function RY(){return ye(t=>t.devMode)}function MY(t){return ye.setState({devMode:t})}function Gw(){return ye(t=>t.document)}function _9(t){return ye(e=>e.document[t])}function LY(t){return ye(e=>e.document[t]?.type)}function PY(t){return ye(e=>e.selectedBlockId===t)}function uc(){return ye(t=>t.selectedBlockId)}function Bm(){return ye(t=>t.wysiwygInlineEditingBlockId)}function RN(t){return ye.setState({wysiwygInlineEditingBlockId:t})}function Um(){return ye(t=>t.notionTextInlineEditingBlockId)}function MN(t){return ye.setState({notionTextInlineEditingBlockId:t})}function FY(){const t=Um(),e=Bm();return!!(t||e)}function BY(){const t=Um(),e=Bm();return t||e}function UY(){return ye(t=>t.highlightColor)}function Vn(){return ye(t=>t.selectedScreenSize)}function Qy(){return ye(t=>t.selectedMainTab)}function wg(t){return t==="preview"&&Kr(null),ye.setState({inspectorDrawerOpen:t==="editor"}),ye.setState({selectedMainTab:t})}function Za(){return ye(t=>t.selectedSidebarTab)}function $Y(){return ye(t=>t.inspectorDrawerOpen)}function jw(){return ye(t=>t.componentTreeOpen)}function Sx(){ye.setState(t=>({componentTreeOpen:!t.componentTreeOpen}))}function Xy(){return ye(t=>t.imageUploading)}function qY(){return ye(t=>t.disableEdition)}function Kr(t){hf();const e=ye.getState().document[t||""]?.type,n=ub.includes(e||null)?"styles":"block-configuration",i={};return t!==null&&ye.getState().selectedMainTab==="editor"&&(i.inspectorDrawerOpen=!0),ye.setState({selectedBlockId:t,selectedSidebarTab:n,...i})}function zY(t){return ye.setState({selectedSidebarTab:t})}function jd(t){const e=ye.getState().document,n=Qd(t);return $m(e,n),AY(),ye.setState({document:n,selectedSidebarTab:"styles",selectedBlockId:null})}const Tx=(t,e,n=5,i=0)=>{if(t===e)return!0;if(t===null||e===null||t===void 0||e===void 0)return t===e;if(typeof t!=typeof e)return!1;if(typeof t!="object")return t===e;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let a=0;a<t.length;a++)if(i<n){if(!Tx(t[a],e[a],n,i+1))return!1}else if(t[a]!==e[a])return!1;return!0}if(i>=n)try{return JSON.stringify(t)===JSON.stringify(e)}catch{return!1}const r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length)return!1;for(const a of r){if(!s.includes(a))return!1;const o=t[a],l=e[a];if(!Tx(o,l,n,i+1))return!1}return!0},GY=1e3;let Hc=null,Xd=null,Jd=null;function b9(t){const e=ye.getState().document;$m(e,t)}function $m(t,e){Jd=t,Xd=e,Hc&&clearTimeout(Hc),Hc=setTimeout(()=>{y9(Jd,Xd),Hc=null,Xd=null,Jd=null},GY)}function hf(){Hc&&(clearTimeout(Hc),Hc=null),Xd&&Jd&&(y9(Jd,Xd),Xd=null,Jd=null);const{pendingUndoTimeout:t,pendingOriginalDocument:e}=p9();if(t&&(clearTimeout(t),e)){const n=[...Ky()];jc({stackUndo:[...n,JSON.stringify(e)],pendingOriginalDocument:null,pendingUndoTimeout:null,lastChange:null})}}function y9(t,e){const{pendingUndoTimeout:r,pendingOriginalDocument:s,lastChange:a}=p9();let o=!0,l=null;const c=(p,m)=>{if(p?.type==="Image"&&m?.type==="Image"){const _=p.data.props?.width,g=m.data.props?.width;return _==null&&typeof g=="number"}return!1};if(t===e)return null;const u=Object.keys(t),d=Object.keys(e);if(u.length!==d.length)l=d.find(p=>!t[p])||u.find(p=>!e[p])||null;else for(const p of d){const m=t[p],_=e[p];if(m!==_){if(m&&_&&c(m,_)){o=!1;break}if(!Tx(m,_)){l=p;break}}}if(o&&l!==null){const p=Date.now(),m=[...Ky()];if(m.length>=50&&m.shift(),l)if(a&&a.blockId===l&&p-a.timestamp<400){r&&clearTimeout(r);const _=setTimeout(()=>{jc({stackUndo:[...m,JSON.stringify(s)],pendingOriginalDocument:null,pendingUndoTimeout:null,lastChange:null,stackRedo:[]})},400);jc({pendingUndoTimeout:_,stackRedo:[],lastChange:{blockId:l,timestamp:p}})}else{r&&clearTimeout(r);const _=setTimeout(()=>{jc({stackUndo:[...m,JSON.stringify(t)],stackRedo:[],pendingOriginalDocument:null,pendingUndoTimeout:null,lastChange:null})},400);jc({pendingOriginalDocument:t,pendingUndoTimeout:_,stackRedo:[],lastChange:{blockId:l,timestamp:p}})}}return null}function qm(t,e=!0){const n=ye.getState().document,i={...n,...t},r=()=>{ye.setState({document:i}),e&&Promise.resolve().then(()=>{$m(n,i)}),Fm();const s=new CustomEvent("email-builder-auto-save",{detail:e});window.dispatchEvent(s)};return e?(E.startTransition(r),ye.getState()):r()}function fb(t){return ye.setState({selectedScreenSize:t})}function Zd(t,e){return ye.setState({imageUploading:{uploading:t,id:e||""}})}function E9(t){return ye.setState({disableEdition:t})}function jY(){return ye.getState().document.root.data}function Ru(){return ye(t=>t.document?.root?.data)}function LN(){hf();const t=ye.getState().document,e=Ky(),n=h9();if(e.length===0)return;const i=[...e],r=i.pop();if(!r)return;const s=ye.getState().selectedBlockId,a=JSON.parse(r);jc({stackUndo:i,stackRedo:[...n,JSON.stringify(t)]}),a.root.data.childrenIds.includes(s)||Kr(null),ye.setState({document:a})}function PN(){hf();const t=ye.getState().document,e=Ky(),n=h9();if(n.length===0)return;const i=[...n],r=i.pop();if(!r)return;const s=ye.getState().selectedBlockId,a=JSON.parse(r);jc({stackUndo:[...e,JSON.stringify(t)],stackRedo:i}),a?.root?.data?.childrenIds?.includes(s)||Kr(null),ye.setState({document:a})}function HY(t){return ye.setState({color:t})}function VY(t){return ye.setState({galleryImages:t})}function v9(){return ye.getState().galleryImages}function WY(t){return ye.setState({imagePlaceholder:t})}function YY(){return ye.getState().imagePlaceholder}function KY(t){return ye.setState({freeMode:t})}function Wf(){return ye.getState().freeMode}function QY(t){return ye.setState({darkMode:t})}function XY(t){return ye.setState({heightContent:t})}function JY(t){return ye.setState({containerGrow:t})}function ZY(){return ye.getState().containerGrow}function zh(t,e,n,i=!0){Mu({draggedId:e,targetId:t})&&console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");const r=ye.getState().document,s=JSON.parse(JSON.stringify({...r})),a=u=>{if(!u||t===e)return u;const d=u.indexOf(e);return d<0?u:u.toSpliced(d,1)},o=u=>{if(!u||t===e)return u;const d=u.indexOf(t);if(d<0)return u;const f=n==="up"?d:d+1;return u.toSpliced(f,0,e)};let l=null,c=null;for(const[u,d]of Object.entries(s)){const f=d;if(c)break;switch(f.type){case"EmailLayout":f.data.childrenIds?.length&&f.data.childrenIds.includes(e)&&(c=u,s[u]={...f,data:{...f.data,childrenIds:a(f.data.childrenIds)}});break;case"Container":f.data.props?.childrenIds?.length&&f.data.props.childrenIds.includes(e)&&(c=u,s[u]={...f,data:{...f.data,props:{...f.data.props,childrenIds:a(f.data.props.childrenIds)}}});break;case"ColumnsContainer":if(f.data.props?.columns){let p=!1;const m=f.data.props.columns.map((_,g)=>_?.childrenIds?.includes(e)?(c=`${u}-column-${g}`,p=!0,{..._,childrenIds:a(_.childrenIds)}):_);p&&(s[u]={...f,data:{...f.data,props:{...f.data.props,columns:m}}})}break}}if(l=null,i)for(const[u,d]of Object.entries(s)){const f=d;if(l)break;switch(f.type){case"EmailLayout":f.data.childrenIds?.length&&f.data.childrenIds.includes(t)&&(l=u,s[u]={...f,data:{...f.data,childrenIds:o(f.data.childrenIds)}});break;case"Container":f.data.props?.childrenIds?.length&&f.data.props.childrenIds.includes(t)&&(l=u,s[u]={...f,data:{...f.data,props:{...f.data.props,childrenIds:o(f.data.props.childrenIds)}}});break;case"ColumnsContainer":if(f.data.props?.columns){const p=f.data.props.columns.map((m,_)=>m?.childrenIds?.includes(t)?(l=`${u}-column-${_}`,{...m,childrenIds:o(m.childrenIds)}):m);s[u]={...f,data:{...f.data,props:{...f.data.props,columns:p}}}}break}}return qm(s)}function eK({parentId:t,blockId:e,indexArray:n}){if(Mu({draggedId:e,targetId:t})){console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");return}zh("",e,"down",!1);const i=ye.getState().document,r=JSON.parse(JSON.stringify({...i}));if(!r[t])return;const s=r[t],a=[...s.data.props.columns||[]];return a[n||0]={childrenIds:[e]},r[t]={type:"ColumnsContainer",data:{...s.data,props:{...s.data.props,columns:a}}},qm(r)}function tK({parentId:t,blockId:e}){if(Mu({draggedId:e,targetId:t})){console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");return}zh("",e,"down",!1);const n=ye.getState().document,i=JSON.parse(JSON.stringify({...n}));if(!i[t])return;const r=i[t];return i[t]={type:"Container",data:{...r.data,props:{...r.data.props,childrenIds:[e]}}},qm(i)}function Mu({draggedId:t,targetId:e}){if(t===e)return!0;const n=ye.getState().document;function i(r,s){const a=n[r];if(!a)return!1;let o=[];switch(a.type){case"EmailLayout":o=a.data.childrenIds||[];break;case"Container":o=a.data.props?.childrenIds||[];break;case"ColumnsContainer":a.data.props?.columns&&a.data.props.columns.forEach(l=>{l?.childrenIds&&(o=[...o,...l.childrenIds])});break}if(o.includes(s))return!0;for(const l of o)if(i(l,s))return!0;return!1}return i(t,e)}function nK(){return ye(t=>t.colorPicker)}function Tv(t){ye.setState(e=>({colorPicker:{...e.colorPicker,...t}}))}function S9(t,e){const n=ye.getState().document,i=n[t];if(!i){console.warn(`Block ${t} not found`);return}const r=e(i);if(i===r)return;const s={...n,[t]:r},a=n;E.startTransition(()=>{ye.setState({document:s}),Promise.resolve().then(()=>{$m(a,s)})}),Fm()}function iK(t,e){const n=ye.getState().document,i=n[t];if(!i){console.warn(`Block ${t} not found`);return}const r=e(i);if(i===r)return;const s={...n,[t]:r},a=n;ye.setState({document:s}),Promise.resolve().then(()=>{$m(a,s)}),Fm()}function T9(t,e){S9(t,n=>{const i=typeof e=="function"?e(n.data.props):{...n.data.props,...e};return{...n,data:{...n.data,props:i}}})}function Cx(t,e){iK(t,n=>{const i=typeof e=="function"?e(n.data.props):{...n.data.props,...e};return{...n,data:{...n.data,props:i}}})}function xx(t,e,n,i){ye.setState(s=>{const a=s.document,o=a[t];if(!o)return s;const l=o.type==="EmailLayout"?{...o,data:{...o.data,childrenIds:i}}:{...o,data:{...o.data,props:{...o.data?.props,childrenIds:i}}};return{...s,document:{...a,[e]:n,[t]:l}}});const r=ye.getState().document;E.startTransition(()=>{Promise.resolve().then(()=>b9(r))}),Fm()}function rK(t){ye.setState(n=>({...n,document:{...n.document,...t}}));const e=ye.getState().document;E.startTransition(()=>{Promise.resolve().then(()=>b9(e))}),Fm()}function Ql(t,e){S9(t,e)}function C9(t,e){Ql(t,n=>{const i=n.data?.props||{},r=typeof e=="function"?e(i):{...i,...e};return i===r?n:{...n,data:{...n.data,props:r}}})}function sK(t,e,n){Ql(t,i=>i.data?.props?.[e]===n?i:{...i,data:{...i.data,props:{...i.data.props,[e]:n}}})}function x9(t,e){Ql(t,n=>{const i=n.data?.style||{},r=typeof e=="function"?e(i):{...i,...e};return i===r?n:{...n,data:{...n.data,style:r}}})}function aK(t,e,n){Ql(t,i=>i.data?.style?.[e]===n?i:{...i,data:{...i.data,style:{...i.data.style,[e]:n}}})}function oK(t,e){C9(t,n=>({...n,...e}))}function lK(t,e){x9(t,n=>({...n,...e}))}var qt;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function n(r){throw new Error}t.assertNever=n,t.arrayToEnum=r=>{const s={};for(const a of r)s[a]=a;return s},t.getValidEnumValues=r=>{const s=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),a={};for(const o of s)a[o]=r[o];return t.objectValues(a)},t.objectValues=r=>t.objectKeys(r).map(function(s){return r[s]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const s=[];for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&s.push(a);return s},t.find=(r,s)=>{for(const a of r)if(s(a))return a},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,s=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}t.joinValues=i,t.jsonStringifyReplacer=(r,s)=>typeof s=="bigint"?s.toString():s})(qt||(qt={}));var kx;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(kx||(kx={}));const Ge=qt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ko=t=>{switch(typeof t){case"undefined":return Ge.undefined;case"string":return Ge.string;case"number":return Number.isNaN(t)?Ge.nan:Ge.number;case"boolean":return Ge.boolean;case"function":return Ge.function;case"bigint":return Ge.bigint;case"symbol":return Ge.symbol;case"object":return Array.isArray(t)?Ge.array:t===null?Ge.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ge.promise:typeof Map<"u"&&t instanceof Map?Ge.map:typeof Set<"u"&&t instanceof Set?Ge.set:typeof Date<"u"&&t instanceof Date?Ge.date:Ge.object;default:return Ge.unknown}},Ce=qt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),cK=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class Hr extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(s){return s.message},i={_errors:[]},r=s=>{for(const a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)i._errors.push(n(a));else{let o=i,l=0;for(;l<a.path.length;){const c=a.path[l];l===a.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(n(a))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return r(this),i}static assert(e){if(!(e instanceof Hr))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,qt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},i=[];for(const r of this.issues)if(r.path.length>0){const s=r.path[0];n[s]=n[s]||[],n[s].push(e(r))}else i.push(e(r));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}}Hr.create=t=>new Hr(t);const mf=(t,e)=>{let n;switch(t.code){case Ce.invalid_type:t.received===Ge.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case Ce.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,qt.jsonStringifyReplacer)}`;break;case Ce.unrecognized_keys:n=`Unrecognized key(s) in object: ${qt.joinValues(t.keys,", ")}`;break;case Ce.invalid_union:n="Invalid input";break;case Ce.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${qt.joinValues(t.options)}`;break;case Ce.invalid_enum_value:n=`Invalid enum value. Expected ${qt.joinValues(t.options)}, received '${t.received}'`;break;case Ce.invalid_arguments:n="Invalid function arguments";break;case Ce.invalid_return_type:n="Invalid function return type";break;case Ce.invalid_date:n="Invalid date";break;case Ce.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:qt.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case Ce.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case Ce.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case Ce.custom:n="Invalid input";break;case Ce.invalid_intersection_types:n="Intersection results could not be merged";break;case Ce.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case Ce.not_finite:n="Number must be finite";break;default:n=e.defaultError,qt.assertNever(t)}return{message:n}};let k9=mf;function uK(t){k9=t}function pb(){return k9}const hb=t=>{const{data:e,path:n,errorMaps:i,issueData:r}=t,s=[...n,...r.path||[]],a={...r,path:s};if(r.message!==void 0)return{...r,path:s,message:r.message};let o="";const l=i.filter(c=>!!c).slice().reverse();for(const c of l)o=c(a,{data:e,defaultError:o}).message;return{...r,path:s,message:o}},dK=[];function Fe(t,e){const n=pb(),i=hb({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===mf?void 0:mf].filter(r=>!!r)});t.common.issues.push(i)}class er{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const i=[];for(const r of n){if(r.status==="aborted")return ct;r.status==="dirty"&&e.dirty(),i.push(r.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,n){const i=[];for(const r of n){const s=await r.key,a=await r.value;i.push({key:s,value:a})}return er.mergeObjectSync(e,i)}static mergeObjectSync(e,n){const i={};for(const r of n){const{key:s,value:a}=r;if(s.status==="aborted"||a.status==="aborted")return ct;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||r.alwaysSet)&&(i[s.value]=a.value)}return{status:e.value,value:i}}}const ct=Object.freeze({status:"aborted"}),Hd=t=>({status:"dirty",value:t}),gr=t=>({status:"valid",value:t}),wx=t=>t.status==="aborted",Ax=t=>t.status==="dirty",du=t=>t.status==="valid",Gh=t=>typeof Promise<"u"&&t instanceof Promise;var Ke;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Ke||(Ke={}));class za{constructor(e,n,i,r){this._cachedPath=[],this.parent=e,this.data=n,this._path=i,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const FN=(t,e)=>{if(du(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Hr(t.common.issues);return this._error=n,this._error}}};function St(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:i,description:r}=t;if(e&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(a,o)=>{const{message:l}=t;return a.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??i??o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:l??n??o.defaultError}},description:r}}class Nt{get description(){return this._def.description}_getType(e){return ko(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:ko(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new er,ctx:{common:e.parent.common,data:e.data,parsedType:ko(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Gh(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const i=this.safeParse(e,n);if(i.success)return i.data;throw i.error}safeParse(e,n){const i={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ko(e)},r=this._parseSync({data:e,path:i.path,parent:i});return FN(i,r)}"~validate"(e){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ko(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return du(i)?{value:i.value}:{issues:n.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>du(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const i=await this.safeParseAsync(e,n);if(i.success)return i.data;throw i.error}async safeParseAsync(e,n){const i={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ko(e)},r=this._parse({data:e,path:i.path,parent:i}),s=await(Gh(r)?r:Promise.resolve(r));return FN(i,s)}refine(e,n){const i=r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,s)=>{const a=e(r),o=()=>s.addIssue({code:Ce.custom,...i(r)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,n){return this._refinement((i,r)=>e(i)?!0:(r.addIssue(typeof n=="function"?n(i,r):n),!1))}_refinement(e){return new ta({schema:this,typeName:ft.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return La.create(this,this._def)}nullable(){return ec.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ks.create(this)}promise(){return _f.create(this,this._def)}or(e){return Wh.create([this,e],this._def)}and(e){return Yh.create(this,e,this._def)}transform(e){return new ta({...St(this._def),schema:this,typeName:ft.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Zh({...St(this._def),innerType:this,defaultValue:n,typeName:ft.ZodDefault})}brand(){return new Hw({typeName:ft.ZodBranded,type:this,...St(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new em({...St(this._def),innerType:this,catchValue:n,typeName:ft.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return zm.create(this,e)}readonly(){return tm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const fK=/^c[^\s-]{8,}$/i,pK=/^[0-9a-z]+$/,hK=/^[0-9A-HJKMNP-TV-Z]{26}$/i,mK=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,gK=/^[a-z0-9_-]{21}$/i,_K=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,bK=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,yK=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,EK="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Cv;const vK=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,SK=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,TK=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,CK=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,xK=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,kK=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,w9="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",wK=new RegExp(`^${w9}$`);function A9(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function AK(t){return new RegExp(`^${A9(t)}$`)}function D9(t){let e=`${w9}T${A9(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function DK(t,e){return!!((e==="v4"||!e)&&vK.test(t)||(e==="v6"||!e)&&TK.test(t))}function NK(t,e){if(!_K.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const i=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function IK(t,e){return!!((e==="v4"||!e)&&SK.test(t)||(e==="v6"||!e)&&CK.test(t))}class js extends Nt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ge.string){const s=this._getOrReturnCtx(e);return Fe(s,{code:Ce.invalid_type,expected:Ge.string,received:s.parsedType}),ct}const i=new er;let r;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="max")e.data.length>s.value&&(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,o=e.data.length<s.value;(a||o)&&(r=this._getOrReturnCtx(e,r),a?Fe(r,{code:Ce.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&Fe(r,{code:Ce.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),i.dirty())}else if(s.kind==="email")yK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"email",code:Ce.invalid_string,message:s.message}),i.dirty());else if(s.kind==="emoji")Cv||(Cv=new RegExp(EK,"u")),Cv.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"emoji",code:Ce.invalid_string,message:s.message}),i.dirty());else if(s.kind==="uuid")mK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"uuid",code:Ce.invalid_string,message:s.message}),i.dirty());else if(s.kind==="nanoid")gK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"nanoid",code:Ce.invalid_string,message:s.message}),i.dirty());else if(s.kind==="cuid")fK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"cuid",code:Ce.invalid_string,message:s.message}),i.dirty());else if(s.kind==="cuid2")pK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"cuid2",code:Ce.invalid_string,message:s.message}),i.dirty());else if(s.kind==="ulid")hK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"ulid",code:Ce.invalid_string,message:s.message}),i.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),Fe(r,{validation:"url",code:Ce.invalid_string,message:s.message}),i.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"regex",code:Ce.invalid_string,message:s.message}),i.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),i.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.invalid_string,validation:{startsWith:s.value},message:s.message}),i.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.invalid_string,validation:{endsWith:s.value},message:s.message}),i.dirty()):s.kind==="datetime"?D9(s).test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.invalid_string,validation:"datetime",message:s.message}),i.dirty()):s.kind==="date"?wK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.invalid_string,validation:"date",message:s.message}),i.dirty()):s.kind==="time"?AK(s).test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.invalid_string,validation:"time",message:s.message}),i.dirty()):s.kind==="duration"?bK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"duration",code:Ce.invalid_string,message:s.message}),i.dirty()):s.kind==="ip"?DK(e.data,s.version)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"ip",code:Ce.invalid_string,message:s.message}),i.dirty()):s.kind==="jwt"?NK(e.data,s.alg)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"jwt",code:Ce.invalid_string,message:s.message}),i.dirty()):s.kind==="cidr"?IK(e.data,s.version)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"cidr",code:Ce.invalid_string,message:s.message}),i.dirty()):s.kind==="base64"?xK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"base64",code:Ce.invalid_string,message:s.message}),i.dirty()):s.kind==="base64url"?kK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"base64url",code:Ce.invalid_string,message:s.message}),i.dirty()):qt.assertNever(s);return{status:i.value,value:e.data}}_regex(e,n,i){return this.refinement(r=>e.test(r),{validation:n,code:Ce.invalid_string,...Ke.errToObj(i)})}_addCheck(e){return new js({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ke.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ke.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ke.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ke.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ke.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ke.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ke.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ke.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ke.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ke.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ke.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ke.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ke.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Ke.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Ke.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Ke.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Ke.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...Ke.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Ke.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Ke.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Ke.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Ke.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Ke.errToObj(n)})}nonempty(e){return this.min(1,Ke.errToObj(e))}trim(){return new js({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new js({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new js({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}js.create=t=>new js({checks:[],typeName:ft.ZodString,coerce:t?.coerce??!1,...St(t)});function OK(t,e){const n=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,r=n>i?n:i,s=Number.parseInt(t.toFixed(r).replace(".","")),a=Number.parseInt(e.toFixed(r).replace(".",""));return s%a/10**r}class Xl extends Nt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ge.number){const s=this._getOrReturnCtx(e);return Fe(s,{code:Ce.invalid_type,expected:Ge.number,received:s.parsedType}),ct}let i;const r=new er;for(const s of this._def.checks)s.kind==="int"?qt.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),Fe(i,{code:Ce.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(i=this._getOrReturnCtx(e,i),Fe(i,{code:Ce.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(i=this._getOrReturnCtx(e,i),Fe(i,{code:Ce.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?OK(e.data,s.value)!==0&&(i=this._getOrReturnCtx(e,i),Fe(i,{code:Ce.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),Fe(i,{code:Ce.not_finite,message:s.message}),r.dirty()):qt.assertNever(s);return{status:r.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Ke.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ke.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ke.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ke.toString(n))}setLimit(e,n,i,r){return new Xl({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:Ke.toString(r)}]})}_addCheck(e){return new Xl({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ke.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ke.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ke.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ke.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ke.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ke.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Ke.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ke.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ke.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&qt.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Xl.create=t=>new Xl({checks:[],typeName:ft.ZodNumber,coerce:t?.coerce||!1,...St(t)});class Jl extends Nt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Ge.bigint)return this._getInvalidInput(e);let i;const r=new er;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(i=this._getOrReturnCtx(e,i),Fe(i,{code:Ce.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(i=this._getOrReturnCtx(e,i),Fe(i,{code:Ce.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),Fe(i,{code:Ce.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):qt.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return Fe(n,{code:Ce.invalid_type,expected:Ge.bigint,received:n.parsedType}),ct}gte(e,n){return this.setLimit("min",e,!0,Ke.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ke.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ke.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ke.toString(n))}setLimit(e,n,i,r){return new Jl({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:Ke.toString(r)}]})}_addCheck(e){return new Jl({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ke.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ke.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ke.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ke.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ke.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Jl.create=t=>new Jl({checks:[],typeName:ft.ZodBigInt,coerce:t?.coerce??!1,...St(t)});class jh extends Nt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ge.boolean){const i=this._getOrReturnCtx(e);return Fe(i,{code:Ce.invalid_type,expected:Ge.boolean,received:i.parsedType}),ct}return gr(e.data)}}jh.create=t=>new jh({typeName:ft.ZodBoolean,coerce:t?.coerce||!1,...St(t)});class fu extends Nt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ge.date){const s=this._getOrReturnCtx(e);return Fe(s,{code:Ce.invalid_type,expected:Ge.date,received:s.parsedType}),ct}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return Fe(s,{code:Ce.invalid_date}),ct}const i=new er;let r;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),i.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),i.dirty()):qt.assertNever(s);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new fu({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Ke.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Ke.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}fu.create=t=>new fu({checks:[],coerce:t?.coerce||!1,typeName:ft.ZodDate,...St(t)});class mb extends Nt{_parse(e){if(this._getType(e)!==Ge.symbol){const i=this._getOrReturnCtx(e);return Fe(i,{code:Ce.invalid_type,expected:Ge.symbol,received:i.parsedType}),ct}return gr(e.data)}}mb.create=t=>new mb({typeName:ft.ZodSymbol,...St(t)});class Hh extends Nt{_parse(e){if(this._getType(e)!==Ge.undefined){const i=this._getOrReturnCtx(e);return Fe(i,{code:Ce.invalid_type,expected:Ge.undefined,received:i.parsedType}),ct}return gr(e.data)}}Hh.create=t=>new Hh({typeName:ft.ZodUndefined,...St(t)});class Vh extends Nt{_parse(e){if(this._getType(e)!==Ge.null){const i=this._getOrReturnCtx(e);return Fe(i,{code:Ce.invalid_type,expected:Ge.null,received:i.parsedType}),ct}return gr(e.data)}}Vh.create=t=>new Vh({typeName:ft.ZodNull,...St(t)});class gf extends Nt{constructor(){super(...arguments),this._any=!0}_parse(e){return gr(e.data)}}gf.create=t=>new gf({typeName:ft.ZodAny,...St(t)});class eu extends Nt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return gr(e.data)}}eu.create=t=>new eu({typeName:ft.ZodUnknown,...St(t)});class Fo extends Nt{_parse(e){const n=this._getOrReturnCtx(e);return Fe(n,{code:Ce.invalid_type,expected:Ge.never,received:n.parsedType}),ct}}Fo.create=t=>new Fo({typeName:ft.ZodNever,...St(t)});class gb extends Nt{_parse(e){if(this._getType(e)!==Ge.undefined){const i=this._getOrReturnCtx(e);return Fe(i,{code:Ce.invalid_type,expected:Ge.void,received:i.parsedType}),ct}return gr(e.data)}}gb.create=t=>new gb({typeName:ft.ZodVoid,...St(t)});class Ks extends Nt{_parse(e){const{ctx:n,status:i}=this._processInputParams(e),r=this._def;if(n.parsedType!==Ge.array)return Fe(n,{code:Ce.invalid_type,expected:Ge.array,received:n.parsedType}),ct;if(r.exactLength!==null){const a=n.data.length>r.exactLength.value,o=n.data.length<r.exactLength.value;(a||o)&&(Fe(n,{code:a?Ce.too_big:Ce.too_small,minimum:o?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),i.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(Fe(n,{code:Ce.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(Fe(n,{code:Ce.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((a,o)=>r.type._parseAsync(new za(n,a,n.path,o)))).then(a=>er.mergeArray(i,a));const s=[...n.data].map((a,o)=>r.type._parseSync(new za(n,a,n.path,o)));return er.mergeArray(i,s)}get element(){return this._def.type}min(e,n){return new Ks({...this._def,minLength:{value:e,message:Ke.toString(n)}})}max(e,n){return new Ks({...this._def,maxLength:{value:e,message:Ke.toString(n)}})}length(e,n){return new Ks({...this._def,exactLength:{value:e,message:Ke.toString(n)}})}nonempty(e){return this.min(1,e)}}Ks.create=(t,e)=>new Ks({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ft.ZodArray,...St(e)});function Dd(t){if(t instanceof Fn){const e={};for(const n in t.shape){const i=t.shape[n];e[n]=La.create(Dd(i))}return new Fn({...t._def,shape:()=>e})}else return t instanceof Ks?new Ks({...t._def,type:Dd(t.element)}):t instanceof La?La.create(Dd(t.unwrap())):t instanceof ec?ec.create(Dd(t.unwrap())):t instanceof Ga?Ga.create(t.items.map(e=>Dd(e))):t}class Fn extends Nt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=qt.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Ge.object){const c=this._getOrReturnCtx(e);return Fe(c,{code:Ce.invalid_type,expected:Ge.object,received:c.parsedType}),ct}const{status:i,ctx:r}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof Fo&&this._def.unknownKeys==="strip"))for(const c in r.data)a.includes(c)||o.push(c);const l=[];for(const c of a){const u=s[c],d=r.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new za(r,d,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof Fo){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of o)l.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(c==="strict")o.length>0&&(Fe(r,{code:Ce.unrecognized_keys,keys:o}),i.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of o){const d=r.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new za(r,d,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>er.mergeObjectSync(i,c)):er.mergeObjectSync(i,l)}get shape(){return this._def.shape()}strict(e){return Ke.errToObj,new Fn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,i)=>{const r=this._def.errorMap?.(n,i).message??i.defaultError;return n.code==="unrecognized_keys"?{message:Ke.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new Fn({...this._def,unknownKeys:"strip"})}passthrough(){return new Fn({...this._def,unknownKeys:"passthrough"})}extend(e){return new Fn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Fn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ft.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Fn({...this._def,catchall:e})}pick(e){const n={};for(const i of qt.objectKeys(e))e[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new Fn({...this._def,shape:()=>n})}omit(e){const n={};for(const i of qt.objectKeys(this.shape))e[i]||(n[i]=this.shape[i]);return new Fn({...this._def,shape:()=>n})}deepPartial(){return Dd(this)}partial(e){const n={};for(const i of qt.objectKeys(this.shape)){const r=this.shape[i];e&&!e[i]?n[i]=r:n[i]=r.optional()}return new Fn({...this._def,shape:()=>n})}required(e){const n={};for(const i of qt.objectKeys(this.shape))if(e&&!e[i])n[i]=this.shape[i];else{let s=this.shape[i];for(;s instanceof La;)s=s._def.innerType;n[i]=s}return new Fn({...this._def,shape:()=>n})}keyof(){return N9(qt.objectKeys(this.shape))}}Fn.create=(t,e)=>new Fn({shape:()=>t,unknownKeys:"strip",catchall:Fo.create(),typeName:ft.ZodObject,...St(e)});Fn.strictCreate=(t,e)=>new Fn({shape:()=>t,unknownKeys:"strict",catchall:Fo.create(),typeName:ft.ZodObject,...St(e)});Fn.lazycreate=(t,e)=>new Fn({shape:t,unknownKeys:"strip",catchall:Fo.create(),typeName:ft.ZodObject,...St(e)});class Wh extends Nt{_parse(e){const{ctx:n}=this._processInputParams(e),i=this._def.options;function r(s){for(const o of s)if(o.result.status==="valid")return o.result;for(const o of s)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;const a=s.map(o=>new Hr(o.ctx.common.issues));return Fe(n,{code:Ce.invalid_union,unionErrors:a}),ct}if(n.common.async)return Promise.all(i.map(async s=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(r);{let s;const a=[];for(const l of i){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const o=a.map(l=>new Hr(l));return Fe(n,{code:Ce.invalid_union,unionErrors:o}),ct}}get options(){return this._def.options}}Wh.create=(t,e)=>new Wh({options:t,typeName:ft.ZodUnion,...St(e)});const vo=t=>t instanceof Qh?vo(t.schema):t instanceof ta?vo(t.innerType()):t instanceof Xh?[t.value]:t instanceof Zl?t.options:t instanceof Jh?qt.objectValues(t.enum):t instanceof Zh?vo(t._def.innerType):t instanceof Hh?[void 0]:t instanceof Vh?[null]:t instanceof La?[void 0,...vo(t.unwrap())]:t instanceof ec?[null,...vo(t.unwrap())]:t instanceof Hw||t instanceof tm?vo(t.unwrap()):t instanceof em?vo(t._def.innerType):[];class Jy extends Nt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ge.object)return Fe(n,{code:Ce.invalid_type,expected:Ge.object,received:n.parsedType}),ct;const i=this.discriminator,r=n.data[i],s=this.optionsMap.get(r);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(Fe(n,{code:Ce.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),ct)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,i){const r=new Map;for(const s of n){const a=vo(s.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,s)}}return new Jy({typeName:ft.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:r,...St(i)})}}function Dx(t,e){const n=ko(t),i=ko(e);if(t===e)return{valid:!0,data:t};if(n===Ge.object&&i===Ge.object){const r=qt.objectKeys(e),s=qt.objectKeys(t).filter(o=>r.indexOf(o)!==-1),a={...t,...e};for(const o of s){const l=Dx(t[o],e[o]);if(!l.valid)return{valid:!1};a[o]=l.data}return{valid:!0,data:a}}else if(n===Ge.array&&i===Ge.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let s=0;s<t.length;s++){const a=t[s],o=e[s],l=Dx(a,o);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return n===Ge.date&&i===Ge.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Yh extends Nt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e),r=(s,a)=>{if(wx(s)||wx(a))return ct;const o=Dx(s.value,a.value);return o.valid?((Ax(s)||Ax(a))&&n.dirty(),{status:n.value,value:o.data}):(Fe(i,{code:Ce.invalid_intersection_types}),ct)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([s,a])=>r(s,a)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}Yh.create=(t,e,n)=>new Yh({left:t,right:e,typeName:ft.ZodIntersection,...St(n)});class Ga extends Nt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ge.array)return Fe(i,{code:Ce.invalid_type,expected:Ge.array,received:i.parsedType}),ct;if(i.data.length<this._def.items.length)return Fe(i,{code:Ce.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ct;!this._def.rest&&i.data.length>this._def.items.length&&(Fe(i,{code:Ce.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...i.data].map((a,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new za(i,a,i.path,o)):null}).filter(a=>!!a);return i.common.async?Promise.all(s).then(a=>er.mergeArray(n,a)):er.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Ga({...this._def,rest:e})}}Ga.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ga({items:t,typeName:ft.ZodTuple,rest:null,...St(e)})};class Kh extends Nt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ge.object)return Fe(i,{code:Ce.invalid_type,expected:Ge.object,received:i.parsedType}),ct;const r=[],s=this._def.keyType,a=this._def.valueType;for(const o in i.data)r.push({key:s._parse(new za(i,o,i.path,o)),value:a._parse(new za(i,i.data[o],i.path,o)),alwaysSet:o in i.data});return i.common.async?er.mergeObjectAsync(n,r):er.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(e,n,i){return n instanceof Nt?new Kh({keyType:e,valueType:n,typeName:ft.ZodRecord,...St(i)}):new Kh({keyType:js.create(),valueType:e,typeName:ft.ZodRecord,...St(n)})}}class _b extends Nt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ge.map)return Fe(i,{code:Ce.invalid_type,expected:Ge.map,received:i.parsedType}),ct;const r=this._def.keyType,s=this._def.valueType,a=[...i.data.entries()].map(([o,l],c)=>({key:r._parse(new za(i,o,i.path,[c,"key"])),value:s._parse(new za(i,l,i.path,[c,"value"]))}));if(i.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of a){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return ct;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),o.set(c.value,u.value)}return{status:n.value,value:o}})}else{const o=new Map;for(const l of a){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return ct;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),o.set(c.value,u.value)}return{status:n.value,value:o}}}}_b.create=(t,e,n)=>new _b({valueType:e,keyType:t,typeName:ft.ZodMap,...St(n)});class pu extends Nt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ge.set)return Fe(i,{code:Ce.invalid_type,expected:Ge.set,received:i.parsedType}),ct;const r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(Fe(i,{code:Ce.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(Fe(i,{code:Ce.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());const s=this._def.valueType;function a(l){const c=new Set;for(const u of l){if(u.status==="aborted")return ct;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const o=[...i.data.values()].map((l,c)=>s._parse(new za(i,l,i.path,c)));return i.common.async?Promise.all(o).then(l=>a(l)):a(o)}min(e,n){return new pu({...this._def,minSize:{value:e,message:Ke.toString(n)}})}max(e,n){return new pu({...this._def,maxSize:{value:e,message:Ke.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}pu.create=(t,e)=>new pu({valueType:t,minSize:null,maxSize:null,typeName:ft.ZodSet,...St(e)});class ef extends Nt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ge.function)return Fe(n,{code:Ce.invalid_type,expected:Ge.function,received:n.parsedType}),ct;function i(o,l){return hb({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,pb(),mf].filter(c=>!!c),issueData:{code:Ce.invalid_arguments,argumentsError:l}})}function r(o,l){return hb({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,pb(),mf].filter(c=>!!c),issueData:{code:Ce.invalid_return_type,returnTypeError:l}})}const s={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof _f){const o=this;return gr(async function(...l){const c=new Hr([]),u=await o._def.args.parseAsync(l,s).catch(p=>{throw c.addIssue(i(l,p)),c}),d=await Reflect.apply(a,this,u);return await o._def.returns._def.type.parseAsync(d,s).catch(p=>{throw c.addIssue(r(d,p)),c})})}else{const o=this;return gr(function(...l){const c=o._def.args.safeParse(l,s);if(!c.success)throw new Hr([i(l,c.error)]);const u=Reflect.apply(a,this,c.data),d=o._def.returns.safeParse(u,s);if(!d.success)throw new Hr([r(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ef({...this._def,args:Ga.create(e).rest(eu.create())})}returns(e){return new ef({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,i){return new ef({args:e||Ga.create([]).rest(eu.create()),returns:n||eu.create(),typeName:ft.ZodFunction,...St(i)})}}class Qh extends Nt{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Qh.create=(t,e)=>new Qh({getter:t,typeName:ft.ZodLazy,...St(e)});class Xh extends Nt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return Fe(n,{received:n.data,code:Ce.invalid_literal,expected:this._def.value}),ct}return{status:"valid",value:e.data}}get value(){return this._def.value}}Xh.create=(t,e)=>new Xh({value:t,typeName:ft.ZodLiteral,...St(e)});function N9(t,e){return new Zl({values:t,typeName:ft.ZodEnum,...St(e)})}class Zl extends Nt{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),i=this._def.values;return Fe(n,{expected:qt.joinValues(i),received:n.parsedType,code:Ce.invalid_type}),ct}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),i=this._def.values;return Fe(n,{received:n.data,code:Ce.invalid_enum_value,options:i}),ct}return gr(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Zl.create(e,{...this._def,...n})}exclude(e,n=this._def){return Zl.create(this.options.filter(i=>!e.includes(i)),{...this._def,...n})}}Zl.create=N9;class Jh extends Nt{_parse(e){const n=qt.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==Ge.string&&i.parsedType!==Ge.number){const r=qt.objectValues(n);return Fe(i,{expected:qt.joinValues(r),received:i.parsedType,code:Ce.invalid_type}),ct}if(this._cache||(this._cache=new Set(qt.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=qt.objectValues(n);return Fe(i,{received:i.data,code:Ce.invalid_enum_value,options:r}),ct}return gr(e.data)}get enum(){return this._def.values}}Jh.create=(t,e)=>new Jh({values:t,typeName:ft.ZodNativeEnum,...St(e)});class _f extends Nt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ge.promise&&n.common.async===!1)return Fe(n,{code:Ce.invalid_type,expected:Ge.promise,received:n.parsedType}),ct;const i=n.parsedType===Ge.promise?n.data:Promise.resolve(n.data);return gr(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}}_f.create=(t,e)=>new _f({type:t,typeName:ft.ZodPromise,...St(e)});class ta extends Nt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ft.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:i}=this._processInputParams(e),r=this._def.effect||null,s={addIssue:a=>{Fe(i,a),a.fatal?n.abort():n.dirty()},get path(){return i.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){const a=r.transform(i.data,s);if(i.common.async)return Promise.resolve(a).then(async o=>{if(n.value==="aborted")return ct;const l=await this._def.schema._parseAsync({data:o,path:i.path,parent:i});return l.status==="aborted"?ct:l.status==="dirty"||n.value==="dirty"?Hd(l.value):l});{if(n.value==="aborted")return ct;const o=this._def.schema._parseSync({data:a,path:i.path,parent:i});return o.status==="aborted"?ct:o.status==="dirty"||n.value==="dirty"?Hd(o.value):o}}if(r.type==="refinement"){const a=o=>{const l=r.refinement(o,s);if(i.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(i.common.async===!1){const o=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?ct:(o.status==="dirty"&&n.dirty(),a(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(o=>o.status==="aborted"?ct:(o.status==="dirty"&&n.dirty(),a(o.value).then(()=>({status:n.value,value:o.value}))))}if(r.type==="transform")if(i.common.async===!1){const a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!du(a))return ct;const o=r.transform(a.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>du(a)?Promise.resolve(r.transform(a.value,s)).then(o=>({status:n.value,value:o})):ct);qt.assertNever(r)}}ta.create=(t,e,n)=>new ta({schema:t,typeName:ft.ZodEffects,effect:e,...St(n)});ta.createWithPreprocess=(t,e,n)=>new ta({schema:e,effect:{type:"preprocess",transform:t},typeName:ft.ZodEffects,...St(n)});class La extends Nt{_parse(e){return this._getType(e)===Ge.undefined?gr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}La.create=(t,e)=>new La({innerType:t,typeName:ft.ZodOptional,...St(e)});class ec extends Nt{_parse(e){return this._getType(e)===Ge.null?gr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ec.create=(t,e)=>new ec({innerType:t,typeName:ft.ZodNullable,...St(e)});class Zh extends Nt{_parse(e){const{ctx:n}=this._processInputParams(e);let i=n.data;return n.parsedType===Ge.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Zh.create=(t,e)=>new Zh({innerType:t,typeName:ft.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...St(e)});class em extends Nt{_parse(e){const{ctx:n}=this._processInputParams(e),i={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return Gh(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Hr(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Hr(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}em.create=(t,e)=>new em({innerType:t,typeName:ft.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...St(e)});class bb extends Nt{_parse(e){if(this._getType(e)!==Ge.nan){const i=this._getOrReturnCtx(e);return Fe(i,{code:Ce.invalid_type,expected:Ge.nan,received:i.parsedType}),ct}return{status:"valid",value:e.data}}}bb.create=t=>new bb({typeName:ft.ZodNaN,...St(t)});const RK=Symbol("zod_brand");class Hw extends Nt{_parse(e){const{ctx:n}=this._processInputParams(e),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}}class zm extends Nt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?ct:s.status==="dirty"?(n.dirty(),Hd(s.value)):this._def.out._parseAsync({data:s.value,path:i.path,parent:i})})();{const r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?ct:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(e,n){return new zm({in:e,out:n,typeName:ft.ZodPipeline})}}class tm extends Nt{_parse(e){const n=this._def.innerType._parse(e),i=r=>(du(r)&&(r.value=Object.freeze(r.value)),r);return Gh(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}}tm.create=(t,e)=>new tm({innerType:t,typeName:ft.ZodReadonly,...St(e)});function BN(t,e){const n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function I9(t,e={},n){return t?gf.create().superRefine((i,r)=>{const s=t(i);if(s instanceof Promise)return s.then(a=>{if(!a){const o=BN(e,i),l=o.fatal??n??!0;r.addIssue({code:"custom",...o,fatal:l})}});if(!s){const a=BN(e,i),o=a.fatal??n??!0;r.addIssue({code:"custom",...a,fatal:o})}}):gf.create()}const MK={object:Fn.lazycreate};var ft;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ft||(ft={}));const LK=(t,e={message:`Input not instance of ${t.name}`})=>I9(n=>n instanceof t,e),Xe=js.create,we=Xl.create,PK=bb.create,FK=Jl.create,Bo=jh.create,BK=fu.create,UK=mb.create,$K=Hh.create,qK=Vh.create,zK=gf.create,GK=eu.create,jK=Fo.create,HK=gb.create,tu=Ks.create,Ze=Fn.create,VK=Fn.strictCreate,nu=Wh.create,O9=Jy.create,WK=Yh.create,Vw=Ga.create,R9=Kh.create,YK=_b.create,KK=pu.create,QK=ef.create,XK=Qh.create,yb=Xh.create,an=Zl.create,JK=Jh.create,ZK=_f.create,UN=ta.create,eQ=La.create,tQ=ec.create,nQ=ta.createWithPreprocess,iQ=zm.create,rQ=()=>Xe().optional(),sQ=()=>we().optional(),aQ=()=>Bo().optional(),oQ={string:(t=>js.create({...t,coerce:!0})),number:(t=>Xl.create({...t,coerce:!0})),boolean:(t=>jh.create({...t,coerce:!0})),bigint:(t=>Jl.create({...t,coerce:!0})),date:(t=>fu.create({...t,coerce:!0}))},lQ=ct,tn=Object.freeze(Object.defineProperty({__proto__:null,BRAND:RK,DIRTY:Hd,EMPTY_PATH:dK,INVALID:ct,NEVER:lQ,OK:gr,ParseStatus:er,Schema:Nt,ZodAny:gf,ZodArray:Ks,ZodBigInt:Jl,ZodBoolean:jh,ZodBranded:Hw,ZodCatch:em,ZodDate:fu,ZodDefault:Zh,ZodDiscriminatedUnion:Jy,ZodEffects:ta,ZodEnum:Zl,ZodError:Hr,get ZodFirstPartyTypeKind(){return ft},ZodFunction:ef,ZodIntersection:Yh,ZodIssueCode:Ce,ZodLazy:Qh,ZodLiteral:Xh,ZodMap:_b,ZodNaN:bb,ZodNativeEnum:Jh,ZodNever:Fo,ZodNull:Vh,ZodNullable:ec,ZodNumber:Xl,ZodObject:Fn,ZodOptional:La,ZodParsedType:Ge,ZodPipeline:zm,ZodPromise:_f,ZodReadonly:tm,ZodRecord:Kh,ZodSchema:Nt,ZodSet:pu,ZodString:js,ZodSymbol:mb,ZodTransformer:ta,ZodTuple:Ga,ZodType:Nt,ZodUndefined:Hh,ZodUnion:Wh,ZodUnknown:eu,ZodVoid:gb,addIssueToContext:Fe,any:zK,array:tu,bigint:FK,boolean:Bo,coerce:oQ,custom:I9,date:BK,datetimeRegex:D9,defaultErrorMap:mf,discriminatedUnion:O9,effect:UN,enum:an,function:QK,getErrorMap:pb,getParsedType:ko,instanceof:LK,intersection:WK,isAborted:wx,isAsync:Gh,isDirty:Ax,isValid:du,late:MK,lazy:XK,literal:yb,makeIssue:hb,map:YK,nan:PK,nativeEnum:JK,never:jK,null:qK,nullable:tQ,number:we,object:Ze,get objectUtil(){return kx},oboolean:aQ,onumber:sQ,optional:eQ,ostring:rQ,pipeline:iQ,preprocess:nQ,promise:ZK,quotelessJson:cK,record:R9,set:KK,setErrorMap:uK,strictObject:VK,string:Xe,symbol:UK,transformer:UN,tuple:Vw,undefined:$K,union:nu,unknown:GK,get util(){return qt},void:HK},Symbol.toStringTag,{value:"Module"}));function Ag(t,e){return!t||t&&t[e]===0?"initial":t[e]!==void 0?`${t[e]}px solid ${t?.color??"black"}`:"initial"}function pi({className:t,background:e,backgroundColor:n,padding:i={top:0,right:0,bottom:0,left:0},width:r,align:s,children:a,border:o,borderRadius:l,isParent:c=!0,overflow:u="visible"}){const d=t?`a${t}`:"";return h.jsx("table",{className:t,width:r,border:0,cellSpacing:"0",cellPadding:"0",style:{width:r,minWidth:r,backgroundColor:n??void 0,background:e??void 0,borderRadius:l??"initial",borderTop:Ag(o,"top"),borderBottom:Ag(o,"bottom"),borderLeft:Ag(o,"left"),borderRight:Ag(o,"right"),overflow:u,borderCollapse:"initial"},children:h.jsxs("tbody",{children:[h.jsxs("tr",{height:i.top,style:{height:`${i.top}px`},className:c?`t${t}`:`it${t}`,children:[h.jsx("td",{style:{width:`${i.left}px`},className:c?`l${t}`:`il${t}`}),h.jsx("td",{}),h.jsx("td",{style:{width:`${i.right}px`},className:c?`r${t}`:`ir${t}`})]}),h.jsxs("tr",{children:[h.jsx("td",{style:{width:`${i.left}px`},className:c?`l${t}`:`il${t}`}),h.jsx("td",{className:d,align:s,children:a}),h.jsx("td",{style:{width:`${i.right}px`},className:c?`r${t}`:`ir${t}`})]}),h.jsxs("tr",{height:i.bottom,style:{height:`${i.bottom}px`},className:c?`b${t}`:`ib${t}`,children:[h.jsx("td",{style:{width:`${i.left}px`},className:c?`l${t}`:`il${t}`}),h.jsx("td",{}),h.jsx("td",{style:{width:`${i.right}px`},className:c?`r${t}`:`ir${t}`})]})]})})}const Yo=(t,e)=>{const n=/#([0-9a-fA-F]{3,6})\b/;return n.test(t)?t.replace(n,e):t.trim()===""?e:t.replace(/^(\S+)/,`$1 ${e}`)};function Eb(t){const e=t?.shape??"rectangle";if(typeof e=="string")switch(e){case"rectangle":return;case"pill":return 9999;default:return}else if(typeof e=="object"&&e!==null){const{topLeft:n=0,topRight:i=0,bottomLeft:r=0,bottomRight:s=0}=e;return`${i}px ${n}px ${s}px ${r}px`}}function M9(t,e){const n=new RegExp(`${e}\\s*:\\s*([^;"']+)`,"gi"),i=[];let r;for(;(r=n.exec(t))!==null;)i.push(r[1].trim());return i}function Hs(t){const n=new DOMParser().parseFromString(t,"text/html");return n.body.querySelectorAll("*").forEach(i=>{i.childNodes.forEach(r=>{if(r.nodeType===Node.TEXT_NODE){let s=r.textContent??"";s=s.replace(/ {2,}/g,o=>"&nbsp;".repeat(o.length-1)+" ");const a=document.createElement("span");a.innerHTML=s,i.replaceChild(a.firstChild,r)}})}),n.body.innerHTML}function cQ(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=(e>>>0)*16777619;return e>>>0}function uQ(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";if(t===0)return"a";let n="";for(;t>0;)n=e[t%62]+n,t=Math.floor(t/62);return n}function vt(t){const e=cQ(t);return`b${uQ(e)}`}const $N=Ze({top:we(),bottom:we(),right:we(),left:we()}).optional().nullable(),L9=Ze({style:Ze({textAlign:an(["left","center","right"]).optional().nullable(),padding:$N,mobilePadding:$N,backgroundColor:Xe().optional()}).passthrough().optional().nullable(),props:Ze({size:we().gt(0).optional().nullable(),shape:an(["circle","square","rounded"]).optional().nullable(),imageUrl:Xe().optional().nullable(),alt:Xe().optional().nullable()}).optional().nullable()}).passthrough(),Vc={size:64,imageUrl:"",alt:"",shape:"square"};function P9({style:t,props:e,blockId:n}){const i=e?.size??Vc.size,r=e?.imageUrl??Vc.imageUrl,s=e?.alt??Vc.alt;e?.shape??Vc.shape;const a=Xy(),o={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},l=h.jsx(pi,{isParent:!1,children:h.jsxs(h.Fragment,{children:[h.jsx("img",{alt:s??"",src:r??"",width:i,style:{width:i,height:"auto",outline:"none",border:"none",textDecoration:"none",verticalAlign:t?.contentAlignment??"middle",display:"inline-block",maxWidth:"100%",opacity:a.uploading&&a.id===n?.5:1,transition:"opacity 0.2s ease-in-out"}}),a.uploading&&a.id===n&&h.jsx("div",{style:o,children:h.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:h.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})]})}),c=vt(n);return h.jsx(pi,{className:`${c}`,padding:t.padding,backgroundColor:t.backgroundColor,align:t.textAlign,width:"100%",children:l})}function Is({title:t,children:e}){return h.jsxs(k.Container,{sx:{padding:"0!important",paddingTop:"1rem!important"},children:[h.jsx(k.Typography,{sx:{fontWeight:"bold",mb:2,pb:1,color:"text.primary",fontSize:"1.25rem",borderBottom:n=>`1px solid ${n.palette.divider}`},children:t}),h.jsx(k.Stack,{spacing:2,gap:1,mb:3,pt:1,children:e})]})}const Sn=({label:t})=>{const e=fe.useTheme();return t?h.jsx("p",{style:{fontWeight:"bold",color:e.palette.text.primary},children:t}):null},tr=({children:t})=>h.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.3rem"},children:t.map(e=>e)}),dQ=fe.styled(k.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}`}})),fQ=fe.styled("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"}})),qN=fe.styled(k.IconButton)(({theme:t})=>({padding:"0",color:t.palette.primary.main,"&:hover":{backgroundColor:fe.alpha(t.palette.primary.main,.04)},"& .MuiSvgIcon-root":{fontSize:14}}));function jn({iconLabel:t,label:e,value:n,setValue:i,units:r,min:s=0,max:a,step:o=void 0,marks:l=!0,...c}){const u=n??s,[d,f]=E.useState(u.toString()),p=T=>{let x=T;x<s&&(x=s),a!==void 0&&x>a&&(x=a),i(x),f(x.toString())},m=T=>{const x=T.target.value;if(f(x),x!==""){const w=Number(x);isNaN(w)||w>=s&&i(w)}},_=()=>{if(d===""||isNaN(Number(d)))f(u.toString());else{const T=Number(d);p(T)}},g=T=>{T.key==="Enter"&&_()};E.useEffect(()=>{f((n??s).toString())},[n,s]);const b=()=>{const T=u+1;p(T)},y=()=>{const T=u-1;p(T)},v=(T,x)=>{typeof x=="number"&&i(x)};return h.jsxs(tr,{children:[h.jsx(Sn,{label:e}),h.jsxs(k.Stack,{direction:"row",alignItems:"center",spacing:2,justifyContent:"space-between",width:"100%",children:[h.jsx(k.Box,{sx:{minWidth:24,lineHeight:1,flexShrink:0},children:t}),h.jsx(k.Slider,{...c,value:u,min:s,max:a||1e3,step:o,color:"primary",marks:l,onChange:v}),h.jsxs(dQ,{children:[h.jsx(fQ,{type:"number",value:d,onChange:m,onBlur:_,onKeyDown:g,min:s,max:a,step:o}),h.jsxs(k.Box,{sx:{display:"flex",flexDirection:"column",ml:.5},children:[h.jsx(qN,{onClick:b,disabled:a!==void 0&&u>=a,children:h.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",children:h.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})}),h.jsx(qN,{onClick:y,disabled:u<=s,children:h.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",style:{transform:"rotate(180deg)"},children:h.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})})]})]}),h.jsx(k.Typography,{variant:"caption",color:"text.secondary",sx:{fontSize:"16px",ml:"4px!important"},children:r})]})]})}function qc({label:t,defaultValue:e,onChange:n,...i}){const[r,s]=E.useState(e??0);return e!=r&&s(e),h.jsxs(tr,{children:[h.jsx(Sn,{label:t}),h.jsx(jn,{value:r??0,setValue:a=>{s(a),n(a)},...i})]})}function Ww(t,e){const n=E.useRef(null),i=E.useRef(t),r=E.useRef([]);i.current=t;const s=E.useCallback((...a)=>{r.current=a,n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{i.current(...a),n.current=null},e)},[e]);return s.flush=E.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=null,i.current(...r.current))},[]),s}const tf=36,Yw=8,Zy={width:"100%","& .MuiInputBase-root":{"&:not(.MuiInputBase-multiline)":{height:`${tf}px`}},"& .MuiOutlinedInput-root":{borderRadius:`${Yw}px`,"&:not(.MuiInputBase-multiline)":{height:`${tf}px`}},"& .MuiInputBase-input":{paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",height:"unset"}},F9={width:"100%",height:`${tf}px`,paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",display:"flex",alignItems:"center",borderRadius:`${Yw}px`};function hu({helperText:t,label:e,placeholder:n,rows:i,InputProps:r,defaultValue:s,onChange:a}){const[o,l]=E.useState(s);E.useEffect(()=>{o!==s&&l(s)},[s]);const c=Ww(d=>{a(d)},150),u=typeof i=="number"&&i>1;return h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx(Sn,{label:e}),h.jsx(k.TextField,{fullWidth:!0,multiline:u,minRows:i,variant:"outlined",placeholder:n,helperText:t,InputProps:r,value:o,sx:Zy,onChange:d=>{const f=d.target.value;l(f),c(f)},onBlur:()=>{c.flush()}})]})}function pQ({onClick:t,disabled:e,primary:n=!1}){const{t:i}=It.useTranslation("inspector");return h.jsx(k.IconButton,{"aria-label":i("inputs.common.close"),onClick:t,disabled:e,sx:{position:"absolute",right:8,top:8,color:r=>n?"brand.blue":r.palette.grey[500],"&:hover":{opacity:.8}},children:h.jsx(Q.Close,{})})}function hQ({imageUrl:t,saving:e=!1}){return h.jsxs(k.Card,{sx:{position:"relative"},children:[e&&h.jsx(k.Stack,{justifyContent:"center",alignItems:"center",sx:{position:"absolute",top:7,left:0,width:"100%",height:"314px",zIndex:20,backgroundColor:"#212121AA",mb:1},children:h.jsx(k.CircularProgress,{size:48,thickness:6,color:"inherit",sx:{color:"white"}})}),h.jsx(k.CardMedia,{component:"img",sx:{objectFit:"contain",width:"100%",height:"326px"},image:t,alt:"Generated Image"})]})}function mQ({value:t,onChange:e,disabled:n}){return h.jsxs(h.Fragment,{children:[h.jsx(k.Typography,{sx:{fontSize:"14px",fontWeight:700},children:"Image description"}),h.jsx(k.TextField,{disabled:n,autoFocus:!0,margin:"dense",id:"prompt",placeholder:"Enter a detailed description here...",type:"text",fullWidth:!0,multiline:!0,rows:4,variant:"outlined",value:t,onChange:i=>e(i.target.value),sx:{mt:.5,"& .MuiOutlinedInput-root":{borderRadius:"8px"}}})]})}const gQ=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 B9({src:t,style:e}){const[n,i]=E.useState(!1),[r,s]=E.useState(!1),[a,o]=E.useState(""),[l,c]=E.useState(null),[u,d]=E.useState(!1),[f,p]=E.useState(null),[m,_]=E.useState(!1),g=()=>{i(!0),p(null)},b=()=>{r||(i(!1),s(!1),c(null),o(""),d(!1),p(null),_(!1))},y=()=>{const x=l&&!u?"store-ai-image":"request-ai-image",w=l&&!u?l:a;p(null),x==="store-ai-image"?(_(!0),s(!1),setTimeout(()=>{s(!1),b()},2e3)):s(!0),window.dispatchEvent(new CustomEvent(x,{detail:w}))},v=()=>{d(!0),c(null),p(null),_(!1)};E.useEffect(()=>{const x=w=>{const{detail:I}=w;if(s(!1),I.error){p(gQ(I.error));return}if(!I.success||!I.url){p({code:0,title:"Generation Failed",message:"Failed to generate the image.",action:"Please try again"});return}c(I.url),d(!1)};return window.addEventListener("generated-image",x),()=>{window.removeEventListener("generated-image",x)}},[]),E.useEffect(()=>{b()},[t]);const T=!l||u;return h.jsxs(h.Fragment,{children:[h.jsx(k.Button,{style:e,startIcon:h.jsx(Q.AutoAwesome,{className:"w-4 h-4"}),variant:"contained",onClick:g,children:"Generate"}),h.jsx(k.Dialog,{open:n,onClose:b,maxWidth:"sm",fullWidth:!0,className:"backgroundTranspatent",children:h.jsxs("form",{style:{background:"white"},onSubmit:x=>{x.preventDefault(),y()},children:[h.jsxs(k.DialogTitle,{sx:{fontWeight:700,fontSize:"24px",color:f?"#EF4444":"inherit"},children:[f?"Image generation failed":r?"Generating Your Image":l?"Your Image is ready":"Create your image",h.jsx(pQ,{onClick:b,disabled:r,primary:!0})]}),h.jsxs(k.DialogContent,{children:[h.jsx(k.DialogContentText,{sx:{pb:1,color:f?"#7F1D1D":"inherit"},children:f?"Try simplifying your prompt or describing something else. If the issue persists, please try again later.":r?"Hang tight! This may take a few seconds as we bring your image to life.":T?"Describe the image you want us to generate. Be specific to get the best results.":"Here’s your image. Not quite right? You can tweak it and try again."}),l&&!u?h.jsxs(k.Stack,{sx:{position:"relative"},children:[h.jsx(hQ,{imageUrl:l,saving:m}),h.jsxs(k.Alert,{variant:"outlined",severity:"warning",icon:!1,children:[h.jsx("b",{children:"IMPORTANT:"})," Regenerating will discard this image, and it won't be saved in your gallery. To keep it, make sure to ",h.jsx("b",{children:"Insert the image"})," first."]})]}):r&&!l?h.jsx(k.Stack,{justifyContent:"center",alignItems:"center",sx:{backgroundColor:x=>x.palette.mainColor[50],height:"326px",width:"100%"},children:h.jsx(k.CircularProgress,{size:48,thickness:6})}):h.jsx(mQ,{value:a,onChange:o,disabled:r})]}),!r&&h.jsxs(k.DialogActions,{className:"p-6",children:[l&&!u&&h.jsx(k.Button,{startIcon:h.jsx(Q.Refresh,{className:"w-4 h-4"}),onClick:v,variant:"outlined",disabled:r,children:"Regenerate"}),!l&&!u&&h.jsx(k.Button,{className:"primary",onClick:b,variant:"text",disabled:u,children:"Cancel"}),h.jsxs(k.Button,{startIcon:l&&!u?h.jsx(Q.Attachment,{className:"w-4 h-4"}):h.jsx(Q.AutoAwesome,{className:"w-4 h-4"}),onClick:y,variant:"contained",disabled:!a||a?.length<20,children:[l&&!u?"Insert Image":"Generate image",r&&h.jsx(k.CircularProgress,{size:16,className:"ml-2"})]})]})]})})]})}const _Q=({className:t,...e})=>h.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",className:t,"aria-hidden":"true",focusable:"false",...e,children:h.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 3l6 6l6-6"})}),bQ=k.styled(k.Select)(({theme:t})=>({fontFamily:t.typography.fontFamily,color:t.palette.text.primary,backgroundColor:t.palette.background.paper,width:"100%",height:`${tf}px`,"&.MuiInputBase-root, &.MuiOutlinedInput-root":{height:`${tf}px`,minHeight:`${tf}px`,boxSizing:"border-box",borderRadius:`${Yw}px`},"&& .MuiSelect-select, && .MuiInputBase-input":{paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"36px",lineHeight:"20px",minHeight:"unset"},"& .MuiSelect-icon":{color:t.palette.secondary.main,right:12,top:"calc(50% - 4px)",transition:"transform 200ms ease",pointerEvents:"none"},"& .MuiSelect-iconOpen":{transform:"rotate(180deg)"},"&:hover":{backgroundColor:t.palette.action.hover},"&.Mui-focused":{borderColor:t.palette.primary.main}})),tc=E.forwardRef((t,e)=>{const n=k.useTheme();return h.jsx(bQ,{ref:e,...t,IconComponent:_Q,MenuProps:{PaperProps:{sx:{backgroundColor:n.palette.background.paper,color:n.palette.text.primary}},...t.MenuProps}})});tc.displayName="CustomSelect";const yQ=({defaultValue:t,onChange:e,values:n})=>{const i=uc(),{t:r}=It.useTranslation("inspector"),s=()=>h.jsx(k.SvgIcon,{viewBox:"0 0 18 18",fontSize:"small",children:h.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:"#F59E0B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})}),a=te=>{if(!te)return{url:"",repeat:"no-repeat",position:"center center",size:"cover"};const K=te.match(/url\("([^"]+)"\)/),ne=K?K[1]:"";let he="no-repeat";te.includes("repeat-x")?he="repeat-x":te.includes("repeat-y")?he="repeat-y":te.includes("repeat")&&!te.includes("no-repeat")&&(he="repeat");let Se="center center";const De=["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"];for(const st of De)if(te.includes(st)){Se=st;break}let Ie="cover";return te.includes("contain")?Ie="contain":te.includes("auto")&&(Ie="auto"),{url:ne,repeat:he,position:Se,size:Ie}},o=te=>te.url?`url("${te.url}") ${te.repeat} ${te.position} / ${te.size}`:"",[l,c]=E.useState(t||null),[u,d]=E.useState(a(t)),[f,p]=E.useState(!1),[m,_]=E.useState(window.emailAIGeneration||!1),[,g]=E.useState(null),[b,y]=E.useState(a(t).url||""),[v,T]=E.useState(!1),[x,w]=E.useState(""),[I,A]=E.useState(!1),N=E.useRef(null),M=Wf(),[C,F]=E.useState(()=>sessionStorage.getItem("hideBackgroundImageWarning")==="true"),D=(te,K)=>{const ne={...u,...te};if(d(ne),ne.url){const he=o(ne);c(he),e(he,K)}else console.error("Update params error: ",ne)},q=(te,K)=>{if(!te)return!1;const ne=te?.toLowerCase(),he=ne.includes(".svg")||ne.includes("svg"),Se=K&&(K.includes("image/svg+xml")||K.includes("svg"));return he||!!Se},z=async te=>{try{T(!0),w(""),A(!1);try{new URL(te)}catch{return w("Invalid URL format"),!1}const K=new AbortController,ne=setTimeout(()=>K.abort(),1e4);try{const he=await fetch(te,{method:"HEAD",signal:K.signal});if(clearTimeout(ne),!he.ok)return w(`HTTP ${he.status}: ${he.statusText}`),!1;const Se=he.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(st=>Se&&Se.toLowerCase().includes(st.toLowerCase()))?(q(te,Se)&&A(!0),w(""),!0):(w("URL does not point to an image"),!1)}catch(he){return clearTimeout(ne),he.name==="AbortError"?(w("Request timeout - URL took too long to respond"),!1):new Promise(Se=>{const De=new Image,Ie=setTimeout(()=>{w("Request timeout - URL took too long to respond"),Se(!1)},1e4);De.onload=()=>{clearTimeout(Ie),q(te)&&A(!0),w(""),Se(!0)},De.onerror=()=>{clearTimeout(Ie),w("Cannot access image - CORS policy, network error, or invalid URL"),Se(!1)},De.src=te})}}catch{return w("Unexpected error occurred while validating URL"),!1}finally{T(!1)}},O=async()=>{b.trim()&&await z(b.trim())&&D({url:b.trim()})},P=te=>{te.key==="Enter"&&O()},j=te=>{y(te.target.value),x&&w(""),I&&A(!1)},ee=te=>{const K=["image/png","image/jpeg","image/gif"],he=Array.from(te),Se=he.filter(Ie=>K.includes(Ie.type)&&Ie.size<=5242880);if(Se.length!==he.length&&alert(r("inputs.common.invalidFiles")),Se.length===0)return;const De=Se.map(Ie=>new Promise(st=>{const Lt=new FileReader;Lt.onload=dn=>st(dn.target?.result),Lt.readAsDataURL(Ie)}));Promise.all(De).then(Ie=>{const st={images:Ie,id:i||"",styles:n};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:st})),Zd(!0,i||"")})},X=te=>{te.preventDefault(),p(!0)},_e=()=>{p(!1)},se=te=>{te.preventDefault(),p(!1);const K=te.dataTransfer.files;ee(K)},re=()=>{const te=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(te)},le=()=>{d({url:"",repeat:"no-repeat",position:"center center",size:"cover"}),c(null),e(null),y(""),A(!1)},pe=te=>{switch(te){case"top left":return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M5.26523 9.79159L5.17094 5.17183M5.17094 5.17183L9.79071 5.26611M5.17094 5.17183L10.8278 10.8287",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"top center":return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M4.7998 7.33333L7.9998 4M7.9998 4L11.1998 7.33333M7.9998 4V12",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"top right":return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M6.20841 5.2662L10.8282 5.17192M10.8282 5.17192L10.7339 9.79169M10.8282 5.17192L5.17132 10.8288",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"center left":return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M7.33333 11.2002L4 8.00019M4 8.00019L7.33333 4.8002M4 8.00019L12 8.0002",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"center center":return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.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",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"center right":return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M8.66667 4.7998L12 7.9998M12 7.9998L8.66667 11.1998M12 7.9998L4 7.9998",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"bottom left":return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M9.79062 10.7348L5.17085 10.8291M5.17085 10.8291L5.26513 6.20929M5.17085 10.8291L10.8277 5.1722",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"bottom center":return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M11.1998 8.66667L7.9998 12M7.9998 12L4.7998 8.66667M7.9998 12L7.99981 4",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"bottom right":return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M10.7338 6.20938L10.8281 10.8291M10.8281 10.8291L6.20831 10.7349M10.8281 10.8291L5.17122 5.17229",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});default:return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.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",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})})}},Le=te=>({"top left":r("inputs.backgroundImage.positions.topLeft"),"top center":r("inputs.backgroundImage.positions.topCenter"),"top right":r("inputs.backgroundImage.positions.topRight"),"center left":r("inputs.backgroundImage.positions.centerLeft"),"center center":r("inputs.backgroundImage.positions.center"),"center right":r("inputs.backgroundImage.positions.centerRight"),"bottom left":r("inputs.backgroundImage.positions.bottomLeft"),"bottom center":r("inputs.backgroundImage.positions.bottomCenter"),"bottom right":r("inputs.backgroundImage.positions.bottomRight")})[te]??r("inputs.backgroundImage.positions.center");return E.useEffect(()=>{const te=De=>{const{detail:Ie}=De;Zd(!1,Ie.id||""),D({url:Ie.url},Ie.styles),E9(!1),y(Ie.url)},K=De=>{Zd(De?.detail?.uploading??!1,De?.detail?.id??"")},ne=De=>{const{detail:Ie}=De;_(Ie)},he=()=>{N?.current?.click()},Se=De=>{const{detail:Ie}=De;if(Ie&&!Ie.includes("url("))D({url:Ie},Ie.styles),y(Ie);else{const st=a(Ie);d(st),c(Ie),e(Ie),y(st.url)}};return window.addEventListener("email-builder-set-image",Se),window.addEventListener("email-builder-upload-image-receive",te),window.addEventListener("email-builder-ai-generation",ne),window.addEventListener("email-builder-upload-file",he),window.addEventListener("email-builder-toggle-upload-file",K),()=>{window.removeEventListener("email-builder-ai-generation",ne),window.removeEventListener("email-builder-upload-image-receive",te),window.removeEventListener("email-builder-set-image",Se),window.removeEventListener("email-builder-upload-file",he),window.removeEventListener("email-builder-toggle-upload-file",K)}},[u]),E.useEffect(()=>{t&&A(q(u.url))},[t,u.url]),E.useEffect(()=>{if(t!==l){const te=a(t);d(te),c(t||null),y(te.url||"")}},[t]),h.jsxs(tr,{children:[h.jsxs(k.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[h.jsx(Sn,{label:r("inputs.backgroundImage.label")}),!C&&h.jsx(k.Tooltip,{title:"Some email clients don’t support background images. Add a background color as fallback.",placement:"top",children:h.jsx(k.IconButton,{size:"small",sx:{p:0},children:h.jsx(s,{})})})]}),h.jsx("div",{style:{display:"flex",gap:8},children:M?h.jsxs(k.Box,{sx:{width:"100%"},children:[h.jsxs(k.Stack,{direction:"row",spacing:1,children:[h.jsx(k.TextField,{fullWidth:!0,placeholder:r("inputs.image.urlPlaceholder"),value:b,onChange:j,onKeyPress:P,error:!!x,disabled:v,sx:Zy}),h.jsx(k.Button,{variant:"contained",onClick:O,disabled:!b.trim()||v,sx:{minWidth:"auto",px:2,position:"relative"},children:v?h.jsx(k.CircularProgress,{size:20,color:"inherit"}):"Add"})]}),x&&h.jsx(k.Alert,{severity:"error",sx:{mt:1,fontSize:"0.875rem",maxHeight:"70px"},children:x}),I&&h.jsx(k.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:h.jsx(k.IconButton,{"aria-label":r("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{A(!1)},children:h.jsx(Q.Close,{fontSize:"inherit"})}),children:r("inputs.common.svgWarning")}),u.url&&h.jsxs(k.Box,{sx:{position:"relative",maxWidth:"50%",display:"block",margin:"0.5rem auto 0 auto"},children:[h.jsx("img",{src:u.url||"",alt:"",style:{width:"100%",objectFit:"contain",aspectRatio:"1 / 1",height:"auto",borderRadius:"8px",border:"2px solid #E5E5E5",backgroundColor:"#ffffff",backgroundImage:"linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%), linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%)",backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"}}),h.jsx(k.IconButton,{onClick:le,sx:{position:"absolute",top:5,right:5,backgroundColor:"white",color:"error.main",padding:1,width:35,height:35,"&:hover":{backgroundColor:"#f2e7e7"}},size:"small",children:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:h.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:"#EF4444"})})})]})]}):h.jsxs(h.Fragment,{children:[u.url&&h.jsxs(k.Box,{sx:{position:"relative",maxWidth:"40%"},children:[h.jsx("div",{style:{borderRadius:"8px",border:"2px solid #E5E5E5",height:"100%",backgroundColor:"#ffffff",backgroundImage:"linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%), linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%)",backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"},children:h.jsx("img",{src:u.url||"",alt:"",style:{width:"100%",objectFit:"contain",aspectRatio:"1 / 1",height:"100%"}})}),h.jsx(k.IconButton,{onClick:le,sx:{position:"absolute",top:5,right:5,backgroundColor:"white",color:"error.main",padding:1,width:35,height:35,"&:hover":{backgroundColor:"#f2e7e7"}},size:"small",children:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:h.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:"#EF4444"})})})]}),h.jsxs(k.Box,{onDragOver:X,onDragLeave:_e,onDrop:se,sx:{width:"100%",minWidth:"40%",border:"2px solid",borderColor:f?"primary.main":"#E5E5E5",borderRadius:"8px",padding:"24px 8px 36px 8px",textAlign:"center",bgcolor:f?"primary.50":"background.paper",transition:"all 0.2s ease"},children:[h.jsx(k.Box,{sx:{display:"flex",justifyContent:"center"},children:h.jsx(Q.PhotoOutlined,{sx:{fontSize:32,color:"primary"}})}),h.jsxs("label",{style:{cursor:"pointer"},children:[h.jsx("input",{ref:N,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:te=>{const K=te.target.files;K&&K.length>0&&ee(Array.from(K))}}),h.jsx(k.Typography,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:r("inputs.common.uploadFile")}),h.jsxs(k.Typography,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",r("inputs.common.dragAndDrop")]})]}),h.jsx(k.Typography,{variant:"body2",sx:{color:"text.secondary",mt:1},children:r("inputs.common.fileInfo")})]})]})}),u.url&&h.jsxs(k.Box,{sx:{mt:2},children:[h.jsxs(k.Box,{sx:{mb:2},children:[h.jsx(Sn,{label:r("inputs.backgroundImage.fillType")}),h.jsxs(k.ToggleButtonGroup,{value:u.size,exclusive:!0,onChange:(te,K)=>{K!==null&&D({size:K})},size:"small",fullWidth:!0,children:[h.jsx(k.ToggleButton,{value:"cover",children:r("inputs.backgroundImage.fillOptions.cover")}),h.jsx(k.ToggleButton,{value:"contain",children:r("inputs.backgroundImage.fillOptions.contain")}),h.jsx(k.ToggleButton,{value:"auto",children:r("inputs.backgroundImage.fillOptions.auto")})]})]}),h.jsxs(k.Stack,{direction:"row",spacing:2,sx:{mb:2},children:[h.jsxs("div",{style:{flex:1},children:[h.jsx(Sn,{label:r("inputs.backgroundImage.repeat")}),h.jsxs(tc,{style:{width:"100%"},value:u.repeat,size:"small",onChange:te=>D({repeat:te.target.value}),children:[h.jsx(k.MenuItem,{value:"no-repeat",children:r("inputs.backgroundImage.repeatOptions.none")}),h.jsx(k.MenuItem,{value:"repeat",children:r("inputs.backgroundImage.repeatOptions.repeat")}),h.jsx(k.MenuItem,{value:"repeat-x",children:r("inputs.backgroundImage.repeatOptions.repeatX")}),h.jsx(k.MenuItem,{value:"repeat-y",children:r("inputs.backgroundImage.repeatOptions.repeatY")})]})]}),h.jsxs("div",{style:{flex:1},children:[h.jsx(Sn,{label:r("inputs.backgroundImage.position")}),h.jsx(tc,{style:{width:"100%"},value:u.position,size:"small",onChange:te=>D({position:te.target.value}),renderValue:te=>h.jsxs(k.Box,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[pe(te),Le(te)]}),children:["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"].map(te=>h.jsx(k.MenuItem,{sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important "},value:te,children:h.jsxs(k.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[pe(te),Le(te)]})},te))})]})]})]}),!M&&I&&h.jsx(k.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},children:r("inputs.common.svgWarning")}),v9()&&!M&&h.jsxs(h.Fragment,{children:[h.jsxs(k.Stack,{direction:"row",alignItems:"center",spacing:1,sx:{mt:2},children:[h.jsx(k.Divider,{sx:{flexGrow:1}}),h.jsx(k.Typography,{sx:{color:"text.secondary"},children:"or"}),h.jsx(k.Divider,{sx:{flexGrow:1}})]}),h.jsxs(k.Stack,{flexDirection:"row",gap:2,sx:{mt:2},children:[h.jsx(k.Button,{variant:"outlined",onClick:re,startIcon:h.jsx(Q.ImageSearchOutlined,{}),sx:{width:"100%"},children:"Browse gallery"}),m&&h.jsx(B9,{src:u.url,style:{width:"100%",margin:0}})]})]})]})};function Yf(){return(Yf=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function eE(t,e){if(t==null)return{};var n,i,r={},s=Object.keys(t);for(i=0;i<s.length;i++)e.indexOf(n=s[i])>=0||(r[n]=t[n]);return r}function nm(t){var e=E.useRef(t),n=E.useRef(function(i){e.current&&e.current(i)});return e.current=t,n.current}var im=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t<e?e:t},ah=function(t){return"touches"in t},Nx=function(t){return t&&t.ownerDocument.defaultView||self},zN=function(t,e,n){var i=t.getBoundingClientRect(),r=ah(e)?(function(s,a){for(var o=0;o<s.length;o++)if(s[o].identifier===a)return s[o];return s[0]})(e.touches,n):e;return{left:im((r.pageX-(i.left+Nx(t).pageXOffset))/i.width),top:im((r.pageY-(i.top+Nx(t).pageYOffset))/i.height)}},GN=function(t){!ah(t)&&t.preventDefault()},U9=E.memo(function(t){var e=t.onMove,n=t.onKey,i=eE(t,["onMove","onKey"]),r=E.useRef(null),s=nm(e),a=nm(n),o=E.useRef(null),l=E.useRef(!1),c=E.useMemo(function(){var p=function(g){GN(g),(ah(g)?g.touches.length>0:g.buttons>0)&&r.current?s(zN(r.current,g,o.current)):_(!1)},m=function(){return _(!1)};function _(g){var b=l.current,y=Nx(r.current),v=g?y.addEventListener:y.removeEventListener;v(b?"touchmove":"mousemove",p),v(b?"touchend":"mouseup",m)}return[function(g){var b=g.nativeEvent,y=r.current;if(y&&(GN(b),!(function(T,x){return x&&!ah(T)})(b,l.current)&&y)){if(ah(b)){l.current=!0;var v=b.changedTouches||[];v.length&&(o.current=v[0].identifier)}y.focus(),s(zN(y,b,o.current)),_(!0)}},function(g){var b=g.which||g.keyCode;b<37||b>40||(g.preventDefault(),a({left:b===39?.05:b===37?-.05:0,top:b===40?.05:b===38?-.05:0}))},_]},[a,s]),u=c[0],d=c[1],f=c[2];return E.useEffect(function(){return f},[f]),E.createElement("div",Yf({},i,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:r,onKeyDown:d,tabIndex:0,role:"slider"}))}),Kw=function(t){return t.filter(Boolean).join(" ")},$9=function(t){var e=t.color,n=t.left,i=t.top,r=i===void 0?.5:i,s=Kw(["react-colorful__pointer",t.className]);return E.createElement("div",{className:s,style:{top:100*r+"%",left:100*n+"%"}},E.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},Li=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n},EQ=function(t){return xQ(Ix(t))},Ix=function(t){return t[0]==="#"&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?Li(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:t.length===8?Li(parseInt(t.substring(6,8),16)/255,2):1}},vQ=function(t){return CQ(TQ(t))},SQ=function(t){var e=t.s,n=t.v,i=t.a,r=(200-e)*n/100;return{h:Li(t.h),s:Li(r>0&&r<200?e*n/100/(r<=100?r:200-r)*100:0),l:Li(r/2),a:Li(i,2)}},Ox=function(t){var e=SQ(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},TQ=function(t){var e=t.h,n=t.s,i=t.v,r=t.a;e=e/360*6,n/=100,i/=100;var s=Math.floor(e),a=i*(1-n),o=i*(1-(e-s)*n),l=i*(1-(1-e+s)*n),c=s%6;return{r:Li(255*[i,o,a,a,l,i][c]),g:Li(255*[l,i,i,o,a,a][c]),b:Li(255*[a,a,l,i,i,o][c]),a:Li(r,2)}},Dg=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},CQ=function(t){var e=t.r,n=t.g,i=t.b,r=t.a,s=r<1?Dg(Li(255*r)):"";return"#"+Dg(e)+Dg(n)+Dg(i)+s},xQ=function(t){var e=t.r,n=t.g,i=t.b,r=t.a,s=Math.max(e,n,i),a=s-Math.min(e,n,i),o=a?s===e?(n-i)/a:s===n?2+(i-e)/a:4+(e-n)/a:0;return{h:Li(60*(o<0?o+6:o)),s:Li(s?a/s*100:0),v:Li(s/255*100),a:r}},kQ=E.memo(function(t){var e=t.hue,n=t.onChange,i=Kw(["react-colorful__hue",t.className]);return E.createElement("div",{className:i},E.createElement(U9,{onMove:function(r){n({h:360*r.left})},onKey:function(r){n({h:im(e+360*r.left,0,360)})},"aria-label":"Hue","aria-valuenow":Li(e),"aria-valuemax":"360","aria-valuemin":"0"},E.createElement($9,{className:"react-colorful__hue-pointer",left:e/360,color:Ox({h:e,s:100,v:100,a:1})})))}),wQ=E.memo(function(t){var e=t.hsva,n=t.onChange,i={backgroundColor:Ox({h:e.h,s:100,v:100,a:1})};return E.createElement("div",{className:"react-colorful__saturation",style:i},E.createElement(U9,{onMove:function(r){n({s:100*r.left,v:100-100*r.top})},onKey:function(r){n({s:im(e.s+100*r.left,0,100),v:im(e.v-100*r.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Li(e.s)+"%, Brightness "+Li(e.v)+"%"},E.createElement($9,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:Ox(e)})))}),q9=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0},AQ=function(t,e){return t.toLowerCase()===e.toLowerCase()||q9(Ix(t),Ix(e))};function DQ(t,e,n){var i=nm(n),r=E.useState(function(){return t.toHsva(e)}),s=r[0],a=r[1],o=E.useRef({color:e,hsva:s});E.useEffect(function(){if(!t.equal(e,o.current.color)){var c=t.toHsva(e);o.current={hsva:c,color:e},a(c)}},[e,t]),E.useEffect(function(){var c;q9(s,o.current.hsva)||t.equal(c=t.fromHsva(s),o.current.color)||(o.current={hsva:s,color:c},i(c))},[s,t,i]);var l=E.useCallback(function(c){a(function(u){return Object.assign({},u,c)})},[]);return[s,l]}var NQ=typeof window<"u"?E.useLayoutEffect:E.useEffect,IQ=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},jN=new Map,OQ=function(t){NQ(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!jN.has(e)){var n=e.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,jN.set(e,n);var i=IQ();i&&n.setAttribute("nonce",i),e.head.appendChild(n)}},[])},RQ=function(t){var e=t.className,n=t.colorModel,i=t.color,r=i===void 0?n.defaultColor:i,s=t.onChange,a=eE(t,["className","colorModel","color","onChange"]),o=E.useRef(null);OQ(o);var l=DQ(n,r,s),c=l[0],u=l[1],d=Kw(["react-colorful",e]);return E.createElement("div",Yf({},a,{ref:o,className:d}),E.createElement(wQ,{hsva:c,onChange:u}),E.createElement(kQ,{hue:c.h,onChange:u,className:"react-colorful__last-control"}))},MQ={defaultColor:"000",toHsva:EQ,fromHsva:function(t){return vQ({h:t.h,s:t.s,v:t.v,a:1})},equal:AQ},LQ=function(t){return E.createElement(RQ,Yf({},t,{colorModel:MQ}))},PQ=/^#?([0-9A-F]{3,8})$/i,FQ=function(t){var e=t.color,n=e===void 0?"":e,i=t.onChange,r=t.onBlur,s=t.escape,a=t.validate,o=t.format,l=t.process,c=eE(t,["color","onChange","onBlur","escape","validate","format","process"]),u=E.useState(function(){return s(n)}),d=u[0],f=u[1],p=nm(i),m=nm(r),_=E.useCallback(function(b){var y=s(b.target.value);f(y),a(y)&&p(l?l(y):y)},[s,l,a,p]),g=E.useCallback(function(b){a(b.target.value)||f(s(n)),m(b)},[n,s,a,m]);return E.useEffect(function(){f(s(n))},[n,s]),E.createElement("input",Yf({},c,{value:o?o(d):d,spellCheck:"false",onChange:_,onBlur:g}))},HN=function(t){return"#"+t},BQ=function(t){var e=t.prefixed,n=t.alpha,i=eE(t,["prefixed","alpha"]),r=E.useCallback(function(a){return a.replace(/([^0-9A-F]+)/gi,"").substring(0,n?8:6)},[n]),s=E.useCallback(function(a){return(function(o,l){var c=PQ.exec(o),u=c?c[1].length:0;return u===3||u===6||!!l&&u===4||!!l&&u===8})(a,n)},[n]);return E.createElement(FQ,Yf({},i,{escape:r,format:e?HN:void 0,process:HN,validate:s}))};const VN={width:24,height:24};function UQ({paletteColors:t,isLocked:e,onToggleLock:n,onChange:i}){const r=fe.useTheme(),s=t.slice(30);return h.jsxs(k.Stack,{spacing:1,children:[h.jsx("div",{style:{height:1,width:"100%",margin:"8px 0",backgroundColor:r.palette.grey[400]}}),h.jsxs(k.Box,{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"4px",children:[s.map((a,o)=>h.jsx(k.Button,{sx:{...VN,backgroundColor:a,border:"1px solid",margin:"0!important",borderColor:r.palette.grey[50],minWidth:24,display:"inline-flex","&:hover":{backgroundColor:a,borderColor:"grey.500"}},onClick:()=>i&&i(a)},o+29)),n&&h.jsx(k.Button,{onClick:n,sx:{backgroundColor:"transparent",border:"1px solid",...VN,minWidth:24,margin:"0!important",borderColor:e?r.palette.error.main:r.palette.divider,display:"inline-flex",color:e?r.palette.error.main:r.palette.text.secondary,"&:hover":{backgroundColor:e?r.palette.error.light+"20":"action.hover",borderColor:e?r.palette.error.main:r.palette.text.secondary}},title:e?"Unlock recent colors":"Lock recent colors",children:e?h.jsx(Q.Lock,{fontSize:"small"}):h.jsx(Q.LockOpen,{fontSize:"small"})})]})]})}const $Q={p:1,".react-colorful__pointer ":{width:16,height:16},".react-colorful__saturation":{mb:1,borderRadius:"8px"},".react-colorful__last-control":{borderRadius:"8px"},".react-colorful__hue-pointer":{width:"4px",borderRadius:"8px",height:24,cursor:"col-resize"},".react-colorful__saturation-pointer":{cursor:"all-scroll"},input:{padding:1,border:"1px solid",borderColor:"grey.300",borderRadius:"8px",width:"100%"}},WN=(t,e)=>{if(!t||t.trim()==="")return e;const i=e.slice(-5),r=e.slice(0,30),s=i.filter(o=>o!==t&&o!==""),a=[t,...s].slice(0,5);for(;a.length<5;)a.push("");return[...r,...a]};function mu({value:t,nullable:e,onChange:n}){const[i,r]=E.useState(t||"#000000"),[s,a]=E.useState(null),{paletteColors:o,isLocked:l}=nK(),[c,u]=E.useState(!1),d=fe.useTheme(),f=E.useCallback(b=>{if(l)return;s&&clearTimeout(s);const y=setTimeout(()=>{const v=WN(b,o);Tv({paletteColors:v})},300);a(y)},[s,l,o]),p=()=>{const b=!l;if(Tv({isLocked:b}),!b&&i){const y=WN(i,o);Tv({isLocked:b,paletteColors:y})}},m=b=>{u(!0),r(b)},_=()=>{n(i),f(i)},g=b=>{r(b),n(b),f(b)};return E.useEffect(()=>{t!==i&&r(t||"#000000")},[t]),E.useEffect(()=>()=>{s&&clearTimeout(s)},[s]),h.jsxs(k.Stack,{spacing:1,sx:$Q,children:[h.jsx(LQ,{color:i,onChange:m,onMouseUp:_,onTouchEnd:_,onMouseLeave:b=>c?_():null}),h.jsx(UQ,{isLocked:l,onToggleLock:p,paletteColors:o,value:t,nullable:e,onChange:b=>{b?(r(b),n(b),f(b)):n(null)}}),h.jsxs(k.Box,{pt:1,display:"flex",gap:1,alignItems:"center",children:[h.jsx(BQ,{prefixed:!0,color:i,onChange:g,style:{flex:1,backgroundColor:d.palette.background.paper,color:d.palette.text.primary,padding:"1px 4px",fontSize:"12px"}}),e&&h.jsx(k.Button,{onClick:()=>n&&n(null),sx:{backgroundColor:"transparent",width:24,height:24,minWidth:24,margin:"0!important",borderColor:d.palette.divider,display:"inline-flex","&:hover":{backgroundColor:"action.hover",borderColor:d.palette.text.secondary}},children:h.jsx(Q.FormatColorReset,{color:"primary",fontSize:"small"})})]})]})}function z9({label:t,defaultValue:e,onChange:n,nullable:i,compact:r=!1,...s}){const[a,o]=E.useState(null),[l,c]=E.useState(e),{t:u}=It.useTranslation("inspector");E.useEffect(()=>{l!==e&&c(e)},[e]);const d=b=>{o(b.currentTarget)},f=r?{border:"1px solid",borderColor:"cadet.400",width:28,height:28,borderRadius:"8px",bgcolor:"#FFFFFF"}:{border:t?"1px solid":"",borderColor:"cadet.400",width:"100%",height:36,paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",borderRadius:"8px",bgcolor:"#FFFFFF"},p=b=>{c(b),n(b)},m=()=>!i||typeof l!="string"||l.trim().length===0?null:h.jsx(k.Tooltip,{disableInteractive:!0,arrow:!0,title:u("inputs.background.reset"),placement:"left",children:h.jsx(k.Box,{sx:{minWidth:24,lineHeight:1,flexShrink:0,pr:"4px",display:"grid",placeItems:"center"},onClick:()=>p(null),children:h.jsx(Q.FormatColorReset,{sx:{color:"primary.main"}})})}),_=l?h.jsx(k.ButtonBase,{onClick:d,sx:{...f,bgcolor:l}}):h.jsx(k.ButtonBase,{onClick:d,sx:{...f},children:h.jsx(Q.AddOutlined,{fontSize:"small"})}),g=h.jsx(k.Menu,{anchorEl:a,open:!!a,onClose:()=>o(null),sx:{"& .MuiPaper-root":{boxShadow:"0 4px 6px rgba(0, 0, 0, 0.4);",borderRadius:1,maxWidth:"200px",transform:"translateX(-100%) !important;"}},MenuListProps:{sx:{height:"auto",padding:0}},children:h.jsx(mu,{value:l||"",nullable:i,onChange:b=>p(b)})});return r?h.jsxs(h.Fragment,{children:[_,g]}):h.jsxs(tr,{children:[h.jsx(Sn,{label:t}),h.jsxs(k.Stack,{direction:"row",alignContent:"center",spacing:1,children:[_,m()]}),g]})}function iu(t){return h.jsx(z9,{...t,nullable:!1})}function xv(t){return h.jsx(z9,{...t,nullable:!0})}const YN=({mobile:t=!1,label:e,borderColor:n,borderTop:i,borderBottom:r,borderLeft:s,borderRight:a,onChange:o})=>{const{t:l}=It.useTranslation("inspector"),c=()=>t?{top:"borderTopMobile",bottom:"borderBottomMobile",left:"borderLeftMobile",right:"borderRightMobile"}:{top:"borderTop",bottom:"borderBottom",left:"borderLeft",right:"borderRight"},u=I=>{const A=Object.values(I);return A.every(N=>N===A[0])},d=c(),f={[d.top]:i??0,[d.bottom]:r??0,[d.left]:s??0,[d.right]:a??0},[p,m]=E.useState(()=>u(f)?"all":"custom"),[_,g]=E.useState(n??"#000000"),[b,y]=E.useState(f);E.useEffect(()=>{n!==_&&g(n??"#000000");const I={[d.top]:i??0,[d.bottom]:r??0,[d.left]:s??0,[d.right]:a??0};Object.keys(I).some(N=>b[N]!==I[N])&&(y(I),u(I)||m("custom"))},[n,i,r,s,a,t]);const v=()=>{if(p!=="all"){const I=b[d.top]??0;x(I),m("all")}else m("custom")},T=I=>{g(I),o({borderColor:I,...b})},x=I=>{const A={[d.top]:I,[d.bottom]:I,[d.left]:I,[d.right]:I};y(A),o({...A,borderColor:_})},w=(I,A)=>{y(M=>({...M,[A]:I}));const N={...b,borderColor:_,[A]:I};u(N)||m("custom"),o(N)};return h.jsxs("div",{children:[h.jsxs(k.Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[h.jsx(Sn,{label:e}),h.jsxs(k.Stack,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(iu,{defaultValue:_,onChange:T,compact:!0}),h.jsx(k.Tooltip,{title:l(p==="all"?"border.unlockBorders":"border.lockBordersTogether"),children:h.jsx(k.IconButton,{size:"small",onClick:v,sx:{color:p==="all"?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:p==="all"?h.jsx(Q.Lock,{fontSize:"small"}):h.jsx(Q.LockOpen,{fontSize:"small"})})})]})]}),p==="all"&&h.jsx(qc,{label:"",iconLabel:h.jsx(Q.BorderOuterOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.top],onChange:x}),p==="custom"&&h.jsxs(k.Stack,{spacing:2,children:[h.jsx(qc,{label:"",iconLabel:h.jsx(Q.BorderTopOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.top],onChange:I=>w(I,d.top)}),h.jsx(qc,{label:"",iconLabel:h.jsx(Q.BorderBottomOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.bottom],onChange:I=>w(I,d.bottom)}),h.jsx(qc,{label:"",iconLabel:h.jsx(Q.BorderLeftOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.left],onChange:I=>w(I,d.left)}),h.jsx(qc,{label:"",iconLabel:h.jsx(Q.BorderRightOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.right],onChange:I=>w(I,d.right)})]})]})},bf=[{key:"INHERIT",label:"Inherit",value:"inherit"},{key:"LATO",label:"Lato",value:'"Lato", sans-serif'},{key:"MERRIWEATHER",label:"Merriweather",value:'"Merriweather", serif'},{key:"MONTSERRAT",label:"Montserrat",value:'"Montserrat", sans-serif'},{key:"OPEN_SANS",label:"Open Sans",value:'"Open Sans", sans-serif'},{key:"OSWALD",label:"Oswald",value:'"Oswald", sans-serif'},{key:"PACIFICO",label:"Pacifico",value:'"Pacifico", cursive'},{key:"PLAYFAIR",label:"Playfair",value:'"Playfair", serif'},{key:"ROBOTO",label:"Roboto",value:'"Roboto", sans-serif'},{key:"MODERN_SANS",label:"Modern sans",value:'"Helvetica Neue", "Arial Nova", "Nimbus Sans", Arial, sans-serif'}],Ul={FAMILY:"MODERN_SANS",SIZE:16},Ko=an(["MODERN_SANS","LATO","MERRIWEATHER","MONTSERRAT","OPEN_SANS","OSWALD","PACIFICO","PLAYFAIR","ROBOTO","INHERIT"]).nullable().optional(),KN=t=>bf.find(e=>e.key===t)?.value;function Qr(t){const e=jY();let n=KN(t);return n||(n=KN(e?.fontFamily),n||"inherit")}const qQ=bf.map(t=>h.jsx(k.MenuItem,{value:t.key,sx:{fontFamily:t.value},children:t.label},t.key));function G9({label:t,onChange:e,defaultValue:n}){const i="INHERIT",[r,s]=E.useState(n??i);E.useEffect(()=>{r!==n&&s(n??i)},[n]);const a=o=>{const l=o?.target?.value;s(l),e(l===null?null:l)};return h.jsxs(tr,{children:[h.jsx(Sn,{label:t}),h.jsx(tc,{style:{width:"100%"},value:r,size:"small",onChange:a,children:qQ})]})}function QN({label:t,defaultValue:e=16,onChange:n,maxValue:i,minValue:r,step:s}){const[a,o]=E.useState(e);E.useEffect(()=>{a!==e&&o(e)},[e]);const l=c=>{o(c),n(c)};return h.jsxs(tr,{children:[h.jsx(Sn,{label:t}),h.jsx(jn,{iconLabel:h.jsx(Q.TextFieldsOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:a,setValue:l,units:"px",step:s??2,min:r||8,max:i||48})]})}function dc({label:t,children:e,defaultValue:n,onChange:i}){const[r,s]=E.useState(n);return E.useEffect(()=>{n!==r&&s(n)},[n]),h.jsxs(tr,{children:[h.jsx(Sn,{label:t}),h.jsx(k.Box,{sx:{...F9,paddingLeft:"0px",paddingRight:"0px"},children:h.jsx(k.ToggleButtonGroup,{exclusive:!0,fullWidth:!0,value:r,size:"small",sx:{width:"100%"},onChange:(a,o)=>{if(typeof o!="string")throw new Error("RadioGroupInput can only receive string values");s(o),i(o)},children:e})})]})}function zQ({label:t,defaultValue:e,onChange:n}){const[i,r]=E.useState(e);return E.useEffect(()=>{i!==e&&r(e)},[e]),h.jsxs(dc,{label:t,defaultValue:i,onChange:s=>{r(s),n(s)},children:[h.jsx(k.ToggleButton,{value:"normal",children:"Regular"}),h.jsx(k.ToggleButton,{value:"bold",children:"Bold"})]})}const XN=({label:t,defaultValue:e,onChange:n})=>{const{t:i}=It.useTranslation("inspector"),r=t??i("inputs.common.height");return h.jsx(jn,{label:r,iconLabel:h.jsx(Q.HeightOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:1,max:100,marks:!1,value:e??1,setValue:n})},GQ=[{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)"}],jQ=GQ.map(t=>h.jsx(k.MenuItem,{value:t.key,children:t.label},t.key));function HQ({label:t,onChange:e,defaultValue:n}){const i="INHERIT",[r,s]=E.useState(n?.toString()??i);E.useEffect(()=>{r!==n?.toString()&&s(n?.toString()??i)},[n]);const a=o=>{const l=o?.target?.value;s(l),e(l===i?null:parseFloat(l))};return h.jsxs(tr,{children:[h.jsx(Sn,{label:t}),h.jsxs(tc,{style:{width:"100%"},value:r,size:"small",onChange:a,children:[h.jsx(k.MenuItem,{value:i,children:"Default value"}),jQ]})]})}function JN({label:t,defaultValue:e,onChange:n}){const{t:r}=It.useTranslation("inspector"),[s,a]=E.useState(()=>e||{top:0,left:0,bottom:0,right:0});E.useEffect(()=>{e&&(e.top!==s.top||e.left!==s.left||e.bottom!==s.bottom||e.right!==s.right)&&a(e)},[e]);const[o,l]=E.useState(!1);function c(d,f){let p;o?p={top:f,bottom:f,left:f,right:f}:p={...s,[d]:f},a(p),n(p)}const u=()=>{if(!o){const d={top:s.top,bottom:s.top,left:s.top,right:s.top};a(d),n(d)}l(!o)};return h.jsxs(tr,{children:[h.jsxs(k.Stack,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[h.jsx(Sn,{label:t}),h.jsx(k.Tooltip,{title:r(o?"inputs.responsiveSize.unlockTooltip":"inputs.responsiveSize.lockTooltip"),children:h.jsx(k.IconButton,{size:"small",onClick:u,sx:{marginTop:"0!important",color:o?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:o?h.jsx(Q.Lock,{fontSize:"small"}):h.jsx(Q.LockOpen,{fontSize:"small"})})})]}),o?h.jsx(jn,{iconLabel:h.jsx("span",{children:r("inputs.responsiveSize.allSides")}),value:s.top,setValue:d=>c("top",d),units:"px",step:16,min:0,max:120,marks:!0}):h.jsxs(h.Fragment,{children:[h.jsx(jn,{iconLabel:h.jsx(Q.AlignVerticalTopOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:s.top,setValue:d=>c("top",d),units:"px",step:16,min:0,max:120,marks:!0}),h.jsx(jn,{iconLabel:h.jsx(Q.AlignVerticalBottomOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:s.bottom,setValue:d=>c("bottom",d),units:"px",step:16,min:0,max:120,marks:!0}),h.jsx(jn,{iconLabel:h.jsx(Q.AlignHorizontalLeftOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:s.left,setValue:d=>c("left",d),units:"px",step:16,min:0,max:120,marks:!0}),h.jsx(jn,{iconLabel:h.jsx(Q.AlignHorizontalRightOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:s.right,setValue:d=>c("right",d),units:"px",step:16,min:0,max:120,marks:!0})]})]})}const VQ=({label:t,defaultValue:e,onChange:n,maxValue:i=600,shapeSteps:r=8})=>{const{t:s}=It.useTranslation("inspector"),[a,o]=E.useState(()=>typeof e=="object"&&e!==null?"rectangle":e||"rectangle"),[l,c]=E.useState(()=>typeof e=="object"&&e!==null?e:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0}),[u,d]=E.useState(!1);E.useEffect(()=>{typeof e=="object"&&e!==null?(c(e),o("rounded")):e&&o(e)},[e]);const f=b=>{o(b),n(b==="rounded"?l:b)},p=(b,y)=>{let v;u?v={topLeft:y,topRight:y,bottomLeft:y,bottomRight:y}:v={...l,[b]:y},c(v),n(v)},m=()=>{if(!u){const b={topLeft:l.topLeft,topRight:l.topLeft,bottomLeft:l.topLeft,bottomRight:l.topLeft};c(b),n(b)}d(!u)},_=i,g=t||s("shape.label");return h.jsxs(h.Fragment,{children:[h.jsxs(dc,{label:g,defaultValue:a,onChange:f,children:[h.jsx(k.ToggleButton,{value:"rectangle",children:s("shape.square")}),h.jsx(k.ToggleButton,{value:"pill",children:s("shape.pill")}),h.jsx(k.ToggleButton,{value:"rounded",children:s("shape.custom")})]}),a==="rounded"&&h.jsxs(k.Stack,{spacing:2,alignItems:"flexStart",pb:1,children:[h.jsxs(k.Stack,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[h.jsx(Sn,{label:s("shape.borderRadius")}),h.jsx(k.Tooltip,{title:s(u?"shape.unlockTooltip":"shape.lockTooltip"),children:h.jsx(k.IconButton,{size:"small",onClick:m,sx:{marginTop:"0!important",color:u?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:u?h.jsx(Q.Lock,{fontSize:"small"}):h.jsx(Q.LockOpen,{fontSize:"small"})})})]}),u?h.jsx(h.Fragment,{children:h.jsx(jn,{iconLabel:h.jsx(Q.RoundedCorner,{sx:{fontSize:16}}),value:l.topRight,setValue:b=>p("topLeft",b),units:"px",min:0,step:r,marks:r>1,max:_})}):h.jsxs(h.Fragment,{children:[h.jsx(jn,{iconLabel:h.jsx(Q.RoundedCorner,{sx:{fontSize:16,transform:"rotate(0deg)"}}),value:l.topLeft,setValue:b=>p("topLeft",b),units:"px",min:0,step:r,marks:r>1,max:_}),h.jsx(jn,{iconLabel:h.jsx(Q.RoundedCorner,{sx:{fontSize:16,transform:"rotate(270deg)"}}),value:l.topRight,setValue:b=>p("topRight",b),units:"px",min:0,step:r,marks:r>1,max:_}),h.jsx(jn,{iconLabel:h.jsx(Q.RoundedCorner,{sx:{fontSize:16,transform:"rotate(180deg)"}}),value:l.bottomLeft,setValue:b=>p("bottomLeft",b),units:"px",min:0,step:r,marks:r>1,max:_}),h.jsx(jn,{iconLabel:h.jsx(Q.RoundedCorner,{sx:{fontSize:16,transform:"rotate(90deg)"}}),value:l.bottomRight,setValue:b=>p("bottomRight",b),units:"px",min:0,step:r,marks:r>1,max:_})]})]})]})};function ZN({label:t,defaultValue:e,onChange:n}){const[i,r]=E.useState(e??"left");return E.useEffect(()=>{e!==i&&r(e??"left")},[e]),h.jsxs(tr,{children:[h.jsx(Sn,{label:t}),h.jsxs(dc,{label:"",defaultValue:i,onChange:s=>{r(s),n(s)},children:[h.jsx(k.ToggleButton,{value:"left",children:h.jsx(Q.FormatAlignLeftOutlined,{fontSize:"small"})}),h.jsx(k.ToggleButton,{value:"center",children:h.jsx(Q.FormatAlignCenterOutlined,{fontSize:"small"})}),h.jsx(k.ToggleButton,{value:"right",children:h.jsx(Q.FormatAlignRightOutlined,{fontSize:"small"})})]})]})}const eI=({label:t,defaultValue:e,onChange:n,step:i,...r})=>{const{t:s}=It.useTranslation("inspector"),a=t??s("inputs.common.width");return h.jsx(jn,{label:a,iconLabel:h.jsx(Q.HeightOutlined,{sx:{color:"text.primary",transform:"rotate(90deg)"}}),units:"%",step:i,min:1,max:100,marks:!1,value:e??1,setValue:n,...r})};function WQ({name:t,value:e,onChange:n,shapeMaxValue:i,shapeSteps:r}){const s=Vn(),a=Ru(),{t:o}=It.useTranslation("inspector"),l=(p,m)=>{const _=e[p],g=e[m];return _??g},c=(p,m)=>{n(m?{...e,...m,[t]:p}:{...e,[t]:p})},u=p=>{n({...e,...p})},f=(()=>{switch(t){case"textAlignMobile":return l("textAlignMobile","textAlign");case"mobilePadding":return l("mobilePadding","padding");case"fontSizeMobile":return l("fontSizeMobile","fontSize")??16;case"heightMobile":return l("heightMobile","height");case"widthMobile":return l("widthMobile","width");case"borderMobile":return{borderTop:l("borderTopMobile","borderTop"),borderBottom:l("borderBottomMobile","borderBottom"),borderLeft:l("borderLeftMobile","borderLeft"),borderRight:l("borderRightMobile","borderRight")};default:return e[t]??null}})();switch(t){case"backgroundColor":return h.jsx(xv,{label:o("properties.backgroundColor"),defaultValue:f??a?.canvasColor,onChange:c});case"background":return h.jsx(yQ,{defaultValue:f,onChange:(p,m)=>c(p,m),values:e});case"borderColor":return h.jsx(xv,{label:o("properties.border"),defaultValue:f,onChange:c});case"borderRadius":return h.jsx(qc,{iconLabel:h.jsx(Q.RoundedCornerOutlined,{}),units:"px",step:4,marks:!0,min:0,max:48,label:o("properties.borderRadius"),defaultValue:f,onChange:c});case"color":return h.jsx(xv,{label:o("properties.color"),defaultValue:f,onChange:c});case"fontFamily":return h.jsx(G9,{label:o("properties.fontFamily"),defaultValue:f,onChange:c});case"fontWeight":return h.jsx(zQ,{label:o("properties.fontWeight"),defaultValue:f,onChange:c});case"textAlign":return s==="desktop"&&h.jsx(ZN,{label:o("properties.alignment"),defaultValue:f,onChange:c});case"textAlignMobile":return s!="desktop"&&h.jsx(ZN,{label:o("properties.alignment"),defaultValue:f,onChange:c});case"padding":return s==="desktop"&&h.jsx(JN,{label:o("properties.padding"),defaultValue:f,onChange:c});case"mobilePadding":return s!="desktop"&&h.jsx(JN,{label:o("properties.padding"),defaultValue:f,onChange:c});case"fontSize":return s==="desktop"&&h.jsx(QN,{maxValue:80,step:8,label:o("properties.fontSize"),defaultValue:f??16,onChange:c});case"fontSizeMobile":return s!="desktop"&&h.jsx(QN,{maxValue:80,step:8,label:o("properties.fontSize"),defaultValue:f,onChange:c});case"lineHeight":return h.jsx(HQ,{label:o("properties.lineHeight"),defaultValue:f??1.5,onChange:c});case"shape":return h.jsx(VQ,{shapeSteps:r,maxValue:i,label:o("properties.shape"),defaultValue:f,onChange:c});case"height":return s==="desktop"&&h.jsx(XN,{label:o("properties.height"),defaultValue:f,onChange:c});case"heightMobile":return s!="desktop"&&h.jsx(XN,{label:o("properties.height"),defaultValue:f,onChange:c});case"width":return s==="desktop"&&h.jsx(eI,{label:o("properties.width"),defaultValue:f,onChange:c});case"widthMobile":return s!="desktop"&&h.jsx(eI,{label:o("properties.width"),defaultValue:f,onChange:c});case"border":return s==="desktop"&&h.jsx(YN,{label:o("properties.border"),borderColor:e.borderColor??null,borderTop:e.borderTop??null,borderBottom:e.borderBottom??null,borderLeft:e.borderLeft??null,borderRight:e.borderRight??null,onChange:u});case"borderMobile":return s!="desktop"&&h.jsx(YN,{mobile:!0,label:o("properties.border"),borderColor:e.borderColor??null,borderTop:f.borderTop??null,borderBottom:f.borderBottom??null,borderLeft:f.borderLeft??null,borderRight:f.borderRight??null,onChange:u});default:return null}}function pr({names:t,value:e,onChange:n,disabledCSSValidation:i=!1,shapeMaxValue:r,shapeSteps:s}){const a=Za(),o=g9();return(i||a=="css"||ub.includes(o||""))&&h.jsx(h.Fragment,{children:t.map(l=>h.jsx(WQ,{shapeMaxValue:r,shapeSteps:s,name:l,value:e||{},onChange:n},l))})}const Qw=t=>t?["http","mailto:","tel:","sms:","whatsapp:"].some(n=>t.startsWith(n))?t:`//${t}`:"#",vb=Ze({top:we(),bottom:we(),right:we(),left:we()}).optional().nullable(),Lu=t=>t?{top:t?.top??0,right:t?.right??0,bottom:t?.bottom??0,left:t?.left??0}:{top:0,right:0,bottom:0,left:0},YQ=Ze({topLeft:we().min(0).optional(),topRight:we().min(0).optional(),bottomLeft:we().min(0).optional(),bottomRight:we().min(0).optional()}),Xw=Ze({style:Ze({padding:vb,mobilePadding:vb,background:Xe().nullable().optional(),backgroundColor:Xe().regex(/^#[0-9a-fA-F]{6}$/).optional().nullable(),textAlign:an(["center","left","right"]).optional().nullable(),textAlignMobile:an(["center","left","right"]).optional().nullable(),shape:nu([an(["rectangle","pill"]),YQ]).optional().nullable()}),props:Ze({touched:Bo().optional().nullable(),scale:we().optional().nullable(),size:Xe().optional().nullable(),sizeMobile:Xe().optional().nullable(),width:we().optional().nullable(),widthMobile:we().optional().nullable(),scaleMobile:we().optional().nullable(),touchedMobile:Bo().optional().nullable(),original_width:we().optional().nullable(),height:we().optional().nullable(),url:Xe().optional().nullable(),alt:Xe().optional().nullable(),linkHref:Xe().optional().nullable(),contentAlignment:an(["top","middle","bottom"]).optional().nullable()}).optional().nullable()}).passthrough();function j9({style:t,props:e,blockId:n}){const i=Vn(),r=Xy(),s={padding:Lu(i=="desktop"?t?.padding:t?.mobilePadding??t?.padding),backgroundColor:t?.backgroundColor??void 0,textAlign:i=="desktop"?t?.textAlign??void 0:t?.textAlignMobile??t?.textAlign??void 0},a=(g,b)=>g==="fill"?"100%":g==="scale"?`${b}%`:e?.width,o=e?.linkHref??null,l=i=="desktop"?a(e?.size,e?.scale):a(e?.sizeMobile,e?.scaleMobile),c={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},u=t?.background??"",d=t?.backgroundColor,f=d?Yo(u,d):u,p=g=>{const b=g.currentTarget;setTimeout(()=>{if(!e?.width&&b.offsetWidth){const y=b.offsetWidth;T9(n,{...e,width:y})}},100)},m=h.jsxs(h.Fragment,{children:[h.jsx("img",{alt:e?.alt??"",src:e?.url??"",width:l,onLoad:p,style:{width:l,height:"auto",outline:"none",border:"none",textDecoration:"none",verticalAlign:e?.contentAlignment??"middle",display:"inline-block",maxWidth:"100%",opacity:r.uploading&&r.id===n?.5:1,transition:"opacity 0.2s ease-in-out",borderRadius:Eb(t)}}),r.uploading&&r.id===n&&h.jsx("div",{style:c,children:h.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:h.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})]}),_=vt(n);return o?h.jsx(pi,{className:`${_}`,padding:s.padding,background:f,align:s.textAlign,width:"100%",children:h.jsx("a",{href:Qw(o),style:{textDecoration:"none",display:"block",width:"100%",height:"100%"},target:"_blank",children:m})}):h.jsx(pi,{className:`${_}`,padding:s.padding,background:f,align:s.textAlign,width:"100%",children:m})}const H9=({data:t,setData:e,blockId:n})=>{const{t:i}=It.useTranslation("inspector"),[r,s]=E.useState(!1),[a,o]=E.useState(window.emailAIGeneration||!1),[,l]=E.useState(null),[c,u]=E.useState(""),[d,f]=E.useState(!1),[p,m]=E.useState(""),[_,g]=E.useState(!1),b=E.useRef(null),y=Wf(),[v,T]=E.useState(null);E.useEffect(()=>{const O=window.__emailBuilderCustomImageProvider;O&&(T(O),setTimeout(()=>{n&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:n,currentImageUrl:t.props?.url||null,alt:t.props?.alt||null}}))},100))},[]);const x=O=>{const P=Xw.safeParse(O);P.success?(e(P.data),l(null)):l(P.error)},w=(O,P)=>{const j=O.toLowerCase(),ee=j.includes(".svg")||j.includes("svg"),X=P&&(P.includes("image/svg+xml")||P.includes("svg"));return ee||!!X},I=async O=>{try{f(!0),m(""),g(!1);try{new URL(O)}catch{return m(i("inputs.image.invalidUrl")),!1}const P=new AbortController,j=setTimeout(()=>P.abort(),1e4);try{const ee=await fetch(O,{method:"HEAD",signal:P.signal});if(clearTimeout(j),!ee.ok)return m(`HTTP ${ee.status}: ${ee.statusText}`),!1;const X=ee.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(re=>X&&X.toLowerCase().includes(re.toLowerCase()))?(w(O,X)&&g(!0),m(""),!0):(m(i("inputs.image.notImage")),!1)}catch(ee){return clearTimeout(j),ee.name==="AbortError"?(m(i("inputs.image.timeout")),!1):new Promise(X=>{const _e=new Image,se=setTimeout(()=>{m(i("inputs.image.timeout")),X(!1)},1e4);_e.onload=()=>{clearTimeout(se),w(O)&&g(!0),m(""),X(!0)},_e.onerror=()=>{clearTimeout(se),m("Cannot access image - CORS policy, network error, or invalid URL"),X(!1)},_e.src=O})}}catch{return m("Unexpected error occurred while validating URL"),!1}finally{f(!1)}},A=async()=>{c.trim()&&await I(c.trim())&&(x({...t,props:{...t.props,url:c.trim()}}),u(""))},N=O=>{O.key==="Enter"&&A()},M=O=>{u(O.target.value),p&&m(""),_&&g(!1)},C=O=>{const P=["image/png","image/jpeg","image/gif"],ee=O.filter(_e=>P.includes(_e.type)&&_e.size<=5242880);if(ee.length!==O.length&&alert(i("inputs.common.invalidFiles")),ee.length===0)return;const X=ee.map(_e=>new Promise(se=>{const re=new FileReader;re.onload=le=>se(le.target?.result),re.readAsDataURL(_e)}));Promise.all(X).then(_e=>{const se={images:_e,id:n||""};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:se})),Zd(!0,n||"")})},F=O=>{O.preventDefault(),s(!0)},D=O=>{const P=O.currentTarget.getBoundingClientRect(),j=O.clientX,ee=O.clientY;(j<P.left||j>=P.right||ee<P.top||ee>=P.bottom)&&s(!1)},q=O=>{O.preventDefault(),s(!1);const P=Array.from(O.dataTransfer.files);P.length>0&&C(P)},z=()=>{const O=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(O)};return E.useEffect(()=>{const O=_e=>{const{detail:se}=_e;Zd(!1,se.id||""),x({...t,props:{...t.props,url:se.url}}),E9(!1)},P=_e=>{Zd(_e?.detail?.uploading??!1,_e?.detail?.id??"")},j=_e=>{const{detail:se}=_e;o(se)},ee=()=>{b?.current?.click()},X=_e=>{const{detail:se}=_e;x({...t,props:{...t.props,url:se}})};return window.addEventListener("email-builder-set-image",X),window.addEventListener("email-builder-upload-image-receive",O),window.addEventListener("email-builder-ai-generation",j),window.addEventListener("email-builder-upload-file",ee),window.addEventListener("email-builder-toggle-upload-file",P),()=>{window.removeEventListener("email-builder-toggle-upload-file",P),window.removeEventListener("email-builder-ai-generation",j),window.removeEventListener("email-builder-upload-image-receive",O),window.removeEventListener("email-builder-set-image",X),window.removeEventListener("email-builder-upload-file",ee)}},[t]),E.useEffect(()=>{t.props?.url&&g(w(t.props.url))},[t.props?.url]),h.jsxs(k.Stack,{gap:1,children:[v?h.jsx(k.Box,{sx:{mb:2},children:v}):h.jsx("div",{style:{display:"flex",gap:8},children:y?h.jsxs(tr,{children:[h.jsx(Sn,{label:i("inputs.image.urlLabel")}),h.jsxs(k.Stack,{direction:"row",spacing:1,children:[h.jsx(k.TextField,{fullWidth:!0,placeholder:i("inputs.image.urlPlaceholder"),value:c,onChange:M,onKeyPress:N,error:!!p,disabled:d,sx:{...Zy,"& .MuiOutlinedInput-root":{"& fieldset":{borderColor:p?"error.main":"#E5E5E5"},"&:hover fieldset":{borderColor:p?"error.main":"primary.main"},"&.Mui-focused fieldset":{borderColor:p?"error.main":"primary.main"}}}}),h.jsx(k.Button,{variant:"contained",onClick:A,disabled:!c.trim()||d,sx:{minWidth:"auto",px:2,position:"relative"},children:d?h.jsx(k.CircularProgress,{size:20,color:"inherit"}):i("inputs.common.add")})]}),p&&h.jsx(k.Alert,{severity:"error",sx:{mt:1,fontSize:"0.875rem","& .MuiAlert-message":{padding:"4px 0",display:"flex",flexDirection:"column",justifyContent:"space-around"}},children:p}),_&&h.jsx(k.Alert,{severity:"warning",sx:{mt:1,marginX:"4px",fontSize:"0.875rem",top:0,"& .MuiAlert-message":{padding:"4px 0",display:"flex",flexDirection:"column",justifyContent:"space-around"}},action:h.jsx(k.IconButton,{"aria-label":i("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{g(!1)},children:h.jsx(Q.Close,{fontSize:"inherit"})}),children:i("inputs.common.svgWarning")}),h.jsx("img",{src:t.props?.url,alt:t.props?.alt,style:{width:"70%",margin:"0.5rem auto 0 auto",objectFit:"contain",display:"block",aspectRatio:"1 / 1",height:"auto",borderRadius:"8px",border:"2px solid #E5E5E5",backgroundColor:"#fff",backgroundImage:"linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%), linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%)",backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"}})]}):h.jsxs(h.Fragment,{children:[h.jsx("img",{src:t.props?.url,alt:t.props?.alt,style:{width:"50%",objectFit:"contain",aspectRatio:"1 / 1",height:"auto",borderRadius:"8px",border:"2px solid #E5E5E5",backgroundColor:"#ffffff",backgroundImage:"linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%), linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%)",backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"}}),h.jsxs(k.Box,{onDragOver:F,onDragLeave:D,onDrop:q,sx:{width:"100%",border:"2px solid",borderColor:r?"primary.main":"#E5E5E5",borderRadius:"8px",padding:4,textAlign:"center",bgcolor:r?"primary.50":"background.paper",transition:"all 0.2s ease"},children:[h.jsx(k.Box,{sx:{display:"flex",justifyContent:"center",mb:2},children:h.jsx(Q.PhotoOutlined,{sx:{fontSize:32,color:"primary"}})}),h.jsxs("label",{style:{cursor:"pointer"},children:[h.jsx("input",{ref:b,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:O=>{const P=O.target.files;P&&P.length>0&&C(Array.from(P))}}),h.jsx(k.Typography,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:i("inputs.common.uploadFile")}),h.jsxs(k.Typography,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",i("inputs.common.dragAndDrop")]})]}),h.jsx(k.Typography,{variant:"body2",sx:{color:"text.secondary",mt:1},children:i("inputs.common.fileInfo")})]})]})}),!v&&!y&&_&&h.jsx(k.Alert,{severity:"warning",sx:{fontSize:"0.875rem","& .MuiAlert-message":{padding:"4px 0",display:"flex",flexDirection:"column",justifyContent:"space-around"}},children:"SVG images may not display correctly in Outlook email clients. Consider using PNG or JPG format for better compatibility."}),!v&&v9()&&!y&&h.jsxs(h.Fragment,{children:[h.jsxs(k.Stack,{direction:"row",alignItems:"center",spacing:1,children:[h.jsx(k.Divider,{sx:{flexGrow:1}}),h.jsx(k.Typography,{sx:{color:"text.secondary"},children:"or"}),h.jsx(k.Divider,{sx:{flexGrow:1}})]}),h.jsxs(k.Stack,{flexDirection:"row",gap:2,children:[h.jsx(k.Button,{variant:"outlined",onClick:z,startIcon:h.jsx(Q.ImageSearchOutlined,{}),sx:{color:"mainColor.main",borderColor:"mainColor.light","&:hover":{borderColor:"mainColor.main",backgroundColor:"action.hover"}},style:{width:"100%"},children:"Browse gallery"}),a&&h.jsx(B9,{src:t.props?.url,style:{width:"100%",margin:0}})]})]})]})};function KQ({data:t,setData:e}){const[,n]=E.useState(null),i=uc(),{t:r}=It.useTranslation("inspector"),s=c=>{const u=L9.safeParse(c);u.success?(e(u.data),n(null)):n(u.error)},a=t.props?.size??Vc.size,o=t.props?.alt??Vc.alt;t.props?.shape??Vc.shape;const l=Za();return E.useEffect(()=>{const c=u=>{const{detail:d}=u;s({...t,props:{...t.props,alt:o}}),s({...t,props:{...t.props,imageUrl:d}})};return window.addEventListener("email-builder-set-image",c),()=>{window.removeEventListener("email-builder-set-image",c)}},[t,s]),h.jsxs(Is,{title:r("inputs.panels.avatar.title"),children:[l=="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsx(H9,{data:t,setData:c=>e({...t,props:{...t.props,imageUrl:c.props.url,alt:o}}),blockId:i}),h.jsx(qc,{label:r("inputs.panels.avatar.sizeLabel"),iconLabel:h.jsx(Q.AspectRatioOutlined,{sx:{color:"text.secondary"}}),units:"px",step:3,min:32,max:256,defaultValue:a,onChange:c=>{s({...t,props:{...t.props,size:c}})}}),h.jsx(hu,{label:r("inputs.panels.avatar.altLabel"),defaultValue:o,onChange:c=>{s({...t,props:{...t.props,alt:c}})}})]}),h.jsx(pr,{names:["textAlign","backgroundColor","padding","mobilePadding"],value:t.style,onChange:c=>s({...t,style:c})})]})}const kv=Xe().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),tI=Ze({top:we(),bottom:we(),right:we(),left:we()}).optional().nullable(),QQ=t=>({top:t?.top??0,right:t?.right??0,bottom:t?.bottom??0,left:t?.left??0}),XQ=Ze({topLeft:we().min(0).optional(),topRight:we().min(0).optional(),bottomLeft:we().min(0).optional(),bottomRight:we().min(0).optional()}),nI=Ze({top:we().min(0).optional(),bottom:we().min(0).optional(),left:we().min(0).optional(),right:we().min(0).optional()}),V9=Ze({style:Ze({backgroundColor:kv,fontSize:we().min(0).optional().nullable(),fontSizeMobile:we().min(0).optional().nullable(),fontFamily:Ko,background:Xe().nullable().optional(),fontWeight:an(["bold","normal"]).optional().nullable(),textAlign:an(["left","center","right"]).optional().nullable(),textAlignMobile:an(["left","center","right"]).optional().nullable(),padding:tI,mobilePadding:tI,shape:nu([an(["rectangle","pill"]),XQ]).optional().nullable()}).passthrough().optional().nullable(),props:Ze({buttonBackgroundColor:kv,buttonTextColor:kv,fullWidth:Bo().optional().nullable(),fullWidthMobile:Bo().optional().nullable(),size:nu([an(["x-small","small","medium"]),nI]).optional().nullable(),sizeMobile:nu([an(["x-small","small","medium"]),nI]).optional().nullable(),text:Xe().optional().nullable(),url:Xe().optional().nullable()}).optional().nullable()}).passthrough();function iI(t){if(typeof t!="string")return t;switch(t){case"x-small":return{top:4,bottom:4,right:8,left:8};case"small":return{top:8,bottom:8,right:12,left:12};case"medium":default:return{top:12,bottom:12,left:20,right:20}}}const Il={text:"",url:"",fullWidth:!1,size:"medium",buttonBackgroundColor:"#999999"};function W9({style:t,props:e,blockId:n}){const i=Ru(),r=Vn(),s=e?.text??Il.text,a=e?.url??Il.url,o=r==="desktop"?e?.fullWidth??!1:e?.fullWidthMobile??e?.fullWidth??!1,l=e?.buttonTextColor??i.textColor,c=e?.buttonBackgroundColor??Il.buttonBackgroundColor,u={backgroundColor:t?.backgroundColor??void 0,textAlign:r=="desktop"?t?.textAlign??void 0:t?.textAlignMobile??t?.textAlign,padding:QQ(r=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},d={color:l,fontSize:r=="desktop"?t?.fontSize??16:t?.fontSizeMobile??t?.fontSize??16,fontFamily:Qr(t?.fontFamily),fontWeight:t?.fontWeight??"bold",display:"inline-block",textDecoration:"none"},f={color:t?.borderColor??void 0,top:r=="desktop"?t?.borderTop??void 0:t?.borderTopMobile??t?.borderTop,bottom:r=="desktop"?t?.borderBottom??void 0:t?.borderBottomMobile??t?.borderBottom,left:r=="desktop"?t?.borderLeft??void 0:t?.borderLeftMobile??t?.borderLeft,right:r=="desktop"?t?.borderRight??void 0:t?.borderRightMobile??t?.borderRight},p=t?.background??"",m=t?.backgroundColor,_=m?Yo(p,m):p,g=vt(n);return h.jsx(pi,{background:_,backgroundColor:m,padding:u.padding,align:u.textAlign,width:"100%",className:`c${g}`,children:h.jsx("a",{href:Qw(a),target:"_blank",className:`abtn-${g}`,children:h.jsx(pi,{className:g,padding:r=="desktop"?iI(e?.size):iI(e?.sizeMobile??e?.size),borderRadius:Eb(t),background:c,backgroundColor:c,isParent:!1,align:"center",width:o?"100%":void 0,border:f,children:h.jsx("span",{className:`btn${g}`,style:d,children:s})})})})}function JQ({size:t,sizeMobile:e,onChange:n,label:i,maxValue:r=100,paddingSteps:s=8}){const{t:a}=It.useTranslation("inspector"),o=i??a("inputs.common.size"),l=Vn(),[c,u]=E.useState(()=>{const y=l==="desktop"?t:e!==void 0?e:t;return typeof y=="object"&&y!==null?y:{top:8,bottom:8,left:16,right:16}}),[d,f]=E.useState(!1);E.useEffect(()=>{const y=l==="desktop"?t:e!==void 0?e:t;typeof y=="object"&&y!==null&&u(y)},[t,e,l]);const p=()=>{const y=l==="desktop"?t:e!==void 0?e:t;return typeof y=="object"&&y!==null?"custom":y},m=y=>{if(l==="desktop"){const v={size:y==="custom"?c:y};e==null&&(v.sizeMobile=y==="custom"?c:y),n(v)}else n({sizeMobile:y==="custom"?c:y})},_=(y,v)=>{let T;d?T={top:v,bottom:v,left:v,right:v}:T={...c,[y]:v},u(T),n(l==="desktop"?{size:T}:{sizeMobile:T})},g=()=>{if(!d){const v={top:16,bottom:16,left:16,right:16};u(v),n(l==="desktop"?{size:v}:{sizeMobile:v})}f(!d)},b=p();return h.jsxs(k.Stack,{spacing:2,children:[h.jsxs(dc,{label:o,defaultValue:b,onChange:m,children:[h.jsx(k.ToggleButton,{value:"x-small",children:a("inputs.responsiveSize.options.xSmall")}),h.jsx(k.ToggleButton,{value:"small",children:a("inputs.responsiveSize.options.small")}),h.jsx(k.ToggleButton,{value:"medium",children:a("inputs.responsiveSize.options.medium")}),h.jsx(k.ToggleButton,{value:"custom",children:a("inputs.responsiveSize.options.custom")})]}),b==="custom"&&h.jsxs(k.Stack,{spacing:2,alignItems:"flexStart",pb:1,children:[h.jsxs(k.Stack,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[h.jsx(Sn,{label:a("inputs.responsiveSize.customPadding")}),h.jsx(k.Tooltip,{title:a(d?"inputs.responsiveSize.unlockTooltip":"inputs.responsiveSize.lockTooltip"),children:h.jsx(k.IconButton,{size:"small",onClick:g,sx:{marginTop:"0!important",color:d?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:d?h.jsx(Q.Lock,{fontSize:"small"}):h.jsx(Q.LockOpen,{fontSize:"small"})})})]}),d?h.jsx(jn,{iconLabel:a("inputs.responsiveSize.allSides"),value:c.top,setValue:y=>_("top",y),units:"px",min:0,step:s,marks:s>1,max:r}):h.jsxs(h.Fragment,{children:[h.jsx(jn,{iconLabel:h.jsx(Q.AlignVerticalTopOutlined,{sx:{fontSize:16}}),value:c.top,setValue:y=>_("top",y),units:"px",min:0,step:s,marks:s>1,max:r}),h.jsx(jn,{iconLabel:h.jsx(Q.AlignVerticalBottomOutlined,{sx:{fontSize:16}}),value:c.bottom,setValue:y=>_("bottom",y),units:"px",min:0,step:s,marks:s>1,max:r}),h.jsx(jn,{iconLabel:h.jsx(Q.AlignHorizontalLeftOutlined,{sx:{fontSize:16}}),value:c.left,setValue:y=>_("left",y),units:"px",min:0,step:s,marks:s>1,max:r}),h.jsx(jn,{iconLabel:h.jsx(Q.AlignHorizontalRightOutlined,{sx:{fontSize:16}}),value:c.right,setValue:y=>_("right",y),units:"px",min:0,step:s,marks:s>1,max:r})]})]})]})}function ZQ({fullWidth:t,fullWidthMobile:e,onChange:n,label:i="Width"}){const r=Vn(),{t:s}=It.useTranslation("inspector"),a=()=>r==="desktop"?t:e!==void 0?e:t,o=c=>{const u=c==="FULL_WIDTH";if(r==="desktop"){const d={fullWidth:u};e==null&&(d.fullWidthMobile=u),n(d)}else n({fullWidthMobile:u})},l=a();return h.jsxs(dc,{label:i,defaultValue:l?"FULL_WIDTH":"AUTO",onChange:o,children:[h.jsx(k.ToggleButton,{value:"FULL_WIDTH",children:s("inputs.width.full")}),h.jsx(k.ToggleButton,{value:"AUTO",children:s("inputs.width.auto")})]})}function eX({data:t,setData:e}){const[,n]=E.useState(null),i=Ru(),{t:r}=It.useTranslation("inspector"),s=_=>{const g=V9.safeParse(_);g.success?(e(g.data),n(null)):n(g.error)},a=t.props?.text??Il.text,o=t.props?.url??Il.url,l=t.props?.fullWidth??Il.fullWidth,c=t.props?.size??Il.size,u=t.props?.buttonTextColor??i.textColor,d=t.props?.buttonBackgroundColor??Il.buttonBackgroundColor,f=t.props?.fullWidthMobile,p=t.props?.sizeMobile,m=Za();return h.jsxs(Is,{title:r("inputs.panels.button.title"),children:[m=="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsx(pr,{disabledCSSValidation:!0,names:["fontFamily","fontSize","fontSizeMobile","fontWeight"],value:t.style,onChange:_=>s({...t,style:_})}),h.jsx(hu,{label:r("inputs.panels.button.textLabel"),defaultValue:a,onChange:_=>s({...t,props:{...t.props,text:_}})}),h.jsx(hu,{label:r("inputs.panels.button.targetLabel"),placeholder:r("inputs.panels.button.targetPlaceholder"),defaultValue:o,onChange:_=>s({...t,props:{...t.props,url:_}})}),h.jsx(ZQ,{label:r("properties.width"),fullWidth:l,fullWidthMobile:f,onChange:_=>s({...t,props:{...t.props,..._}})}),h.jsx(JQ,{size:c,sizeMobile:p,onChange:_=>s({...t,props:{...t.props,..._}})}),h.jsx(iu,{label:r("inputs.panels.button.textColor"),defaultValue:u,onChange:_=>s({...t,props:{...t.props,buttonTextColor:_}})}),h.jsx(iu,{label:r("inputs.panels.button.buttonColor"),defaultValue:d,onChange:_=>s({...t,props:{...t.props,buttonBackgroundColor:_}})})]}),h.jsx(pr,{names:["shape","textAlign","textAlignMobile","backgroundColor","border","borderMobile","padding","mobilePadding"],value:t.style,shapeMaxValue:80,onChange:_=>s({...t,style:_})})]})}const tX=Vw([we().nullish(),we().nullish(),we().nullish()]).optional().nullable(),Y9=Ze({style:Ze({background:Xe().nullable().optional(),backgroundColor:Xe().nullable().optional(),padding:vb,mobilePadding:vb}).optional().nullable(),props:Ze({fixedWidths:tX,columnsCount:nu([yb(2),yb(3)]).optional().nullable(),layout:Xe().optional().nullable(),contentAlignment:an(["top","middle","bottom"]).optional().nullable(),contentAlignmentMobile:an(["top","middle","bottom"]).optional().nullable()}).optional().nullable()}).passthrough(),nX={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},oh={columnsCount:2,contentAlignment:"middle"};function Rx({style:t,columns:e,props:n,blockId:i}){const r=Vn(),s=Xy(),a={padding:Lu(r=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},o={columnsCount:n?.columnsCount??oh.columnsCount,contentAlignment:r=="desktop"?n?.contentAlignment??oh.contentAlignment:n?.contentAlignmentMobile??n?.contentAlignment??oh.contentAlignment,fixedWidths:n?.fixedWidths,blockId:i},l=t?.background??"",c=t?.backgroundColor,u=c?Yo(l,c):l,d=vt(i);return h.jsxs(pi,{background:u,backgroundColor:c,className:`${d}`,padding:a.padding,width:"100%",children:[s.uploading&&s.id===i?h.jsx("div",{style:nX,children:h.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:h.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}):h.jsx(h.Fragment,{}),h.jsx("table",{border:0,cellSpacing:"0",cellPadding:"0",style:{width:"100%"},children:h.jsx("tbody",{style:{width:"100%"},children:h.jsxs("tr",{style:{width:"100%"},children:[h.jsx(wv,{index:0,props:o,columns:e}),h.jsx(wv,{index:1,props:o,columns:e}),h.jsx(wv,{index:2,props:o,columns:e})]})})})]})}function wv({index:t,props:e,columns:n}){const i=e?.contentAlignment??oh.contentAlignment;if((e?.columnsCount??oh.columnsCount)===2&&t===2)return null;const s={boxSizing:"border-box",verticalAlign:i,width:`${e.fixedWidths?.[t]}%`??void 0},a=(n&&n[t])??null,o=e.blockId?vt(e.blockId):"";return h.jsx("td",{className:`col${o}`,style:s,children:a})}const iX=Y9.shape.props.unwrap().unwrap().shape,Jw=Ze({style:Y9.shape.style,props:Ze({...iX,columns:Vw([Ze({childrenIds:tu(Xe())}),Ze({childrenIds:tu(Xe())}),Ze({childrenIds:tu(Xe())})])}).optional().nullable()}).passthrough(),rX=(t,e,n)=>{if(!t||!document)return;const i=vt(t),r=document.querySelector(`.${i}`);if(!r)return;const s=r.parentElement;if(!s)return;const a=Math.ceil(s.getBoundingClientRect().width);n.props?.touched||n.props?.width!==a&&e({...n,props:{...n.props,width:a}})},sX=t=>{if(!t||!document)return;const e=vt(t),n=document.querySelector(`.${e}`);if(!n)return;const i=n.parentElement;if(!i)return;const r=Math.ceil(i.getBoundingClientRect().width);return r||null},aX={desktop:"contentAlignment",mobile:"contentAlignmentMobile"};function oX({data:t,updateData:e}){const{t:n}=It.useTranslation("inspector"),i=Vn(),r=aX[i]||"contentAlignment",s=t.props?.[r]??t.props?.contentAlignment,a=o=>{e({...t,props:{...t.props,[r]:o}})};return h.jsxs(dc,{label:n("inputs.alignment.label"),defaultValue:s,onChange:a,children:[h.jsx(k.ToggleButton,{value:"top",children:h.jsx(Q.VerticalAlignTopOutlined,{fontSize:"small"})}),h.jsx(k.ToggleButton,{value:"middle",children:h.jsx(Q.VerticalAlignCenterOutlined,{fontSize:"small"})}),h.jsx(k.ToggleButton,{value:"bottom",children:h.jsx(Q.VerticalAlignBottomOutlined,{fontSize:"small"})})]})}const _p={grid:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(100px, 1fr))",gap:"16px",width:"100%"},card:{cursor:"pointer",border:"1px solid #e5e7eb",borderRadius:"8px",backgroundColor:"primary"},cardContent:{padding:"8px"},layoutPreview:{display:"flex",gap:"4px",height:"30px",width:"100%",justifyContent:"space-between"}},lX=({defaultValue:t,onChange:e,columns:n})=>{const{t:i}=It.useTranslation("inspector"),[r,s]=E.useState(t||"layout-50-50"),a=k.useTheme();E.useEffect(()=>{r!==t&&s(t==="layout-33-34-33"?"layout-33-33-33":t)},[t]);const o=[{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]}],l=[{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-30-30-40",distribution:[30,30,40]},{id:"layout-40-20-40",distribution:[40,20,40]}],[c,u]=E.useState(l),d=(f,p)=>{s(f),e({layout:f,fixedWidths:p})};return E.useEffect(()=>{if(n===2)u(o),o.findIndex(f=>f.id==t)===-1&&d("layout-50-50",[50,50,null]);else{if(u(l),t==="layout-33-34-33"){d("layout-33-33-33",[33.34,33.33,33.33]);return}l.findIndex(f=>f.id==t)===-1&&d("layout-33-33-33",[33.34,33.33,33.33])}},[n]),E.useEffect(()=>{t==="layout-33-34-33"&&d("layout-33-33-33",[33.34,33.33,33.33])},[t]),h.jsxs(tr,{children:[h.jsx(Sn,{label:i("inputs.layout.label")}),h.jsx("div",{style:_p.grid,children:c.map((f,p)=>h.jsx("div",{onClick:()=>d(f.id,f.distribution),style:{..._p.card,gridColumn:p===0?"span 2":void 0,border:r===f.id?`2px solid ${a.palette.secondary.main}`:_p.card.border},children:h.jsx("div",{style:_p.cardContent,children:h.jsx("div",{style:_p.layoutPreview,children:f.distribution.map((m,_)=>h.jsx("div",{style:{width:`${m}%`,backgroundColor:r===f.id?a.palette.secondary.main:"#e5e7eb",borderRadius:"4px",transition:"background-color 0.2s ease",display:"grid",placeItems:"center",fontSize:"12px",color:r===f.id?"white":"black"}},_))})})},f.id))})]})};function cX({data:t,setData:e}){const[,n]=E.useState(null),[i,r]=E.useState(t.props?.columnsCount??2),s=Za(),a=Vn(),{t:o}=It.useTranslation("inspector"),l=p=>{const m=ye.getState().document,_=p.filter(g=>m[g]?.type==="Image");a==="desktop"&&_.map(g=>rX(g,e,m[g].data))},c=p=>{const m=Jw.safeParse(p);m.success?(m.data.props.columns.map(_=>l(_.childrenIds)),e(m.data),i&&m.data.props?.columnsCount!==i&&r(m.data.props?.columnsCount??2),n(null)):(console.error("Error on columns: ",m.error),n(m.error))},u={layout:"layout-50-50",fixedWidths:[50,50,null],columnsCount:2},d={layout:"layout-33-34-33",fixedWidths:[33,34,33],columnsCount:3},f=p=>{const m=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:[...t.props.columns];return p==="2"?{...u,columns:m}:{...d,columns:m}};return h.jsxs(Is,{title:o("inputs.panels.columns.title"),children:[s=="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsxs(dc,{label:o("inputs.panels.columns.countLabel"),defaultValue:t.props?.columnsCount===2?"2":"3",onChange:p=>{const m=f(p);c({...t,props:{...t.props,...m}})},children:[h.jsx(k.ToggleButton,{style:{fontWeight:"bold"},value:"2",children:"2"}),h.jsx(k.ToggleButton,{style:{fontWeight:"bold"},value:"3",children:"3"})]}),h.jsx(lX,{columns:t.props?.columnsCount??3,defaultValue:t.props?.layout,onChange:({layout:p,fixedWidths:m})=>{const _=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:t.props.columns;c({...t,props:{...t.props,layout:p,fixedWidths:m,columns:_}})}})]}),s=="css"&&h.jsxs(h.Fragment,{children:[h.jsx(oX,{data:t,updateData:e}),h.jsx(pr,{names:["backgroundColor","background","padding","mobilePadding"],value:t.style,onChange:p=>c({...t,style:p})})]})]})}const rI=Xe().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),sI=Ze({top:we(),bottom:we(),right:we(),left:we()}).optional().nullable(),uX=Ze({topLeft:we().min(0).optional(),topRight:we().min(0).optional(),bottomLeft:we().min(0).optional(),bottomRight:we().min(0).optional()}),aI={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},dX=Ze({style:Ze({backgroundColor:rI,background:Xe().nullable().optional(),borderColor:rI,borderRadius:we().optional().nullable(),borderTop:we().optional().nullable(),borderBottom:we().optional().nullable(),borderLeft:we().optional().nullable(),borderRight:we().optional().nullable(),borderTopMobile:we().optional().nullable(),borderBottomMobile:we().optional().nullable(),borderLeftMobile:we().optional().nullable(),borderRightMobile:we().optional().nullable(),shape:nu([an(["rectangle","pill"]),uX]).optional().nullable(),padding:sI,mobilePadding:sI}).optional().nullable()}).passthrough();function K9({style:t,children:e,blockId:n}){const i=Vn(),r=Xy(),s={border:{color:t?.borderColor??void 0,top:i=="desktop"?t?.borderTop??void 0:t?.borderTopMobile??t?.borderTop,bottom:i=="desktop"?t?.borderBottom??void 0:t?.borderBottomMobile??t?.borderBottom,left:i=="desktop"?t?.borderLeft??void 0:t?.borderLeftMobile??t?.borderLeft,right:i=="desktop"?t?.borderRight??void 0:t?.borderRightMobile??t?.borderRight},padding:Lu(i=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},a=t?.background??"",o=t?.backgroundColor,l=o?Yo(a,o):a,c=vt(n);return e?h.jsx(pi,{className:`${c}`,background:l,backgroundColor:t?.backgroundColor,borderRadius:Eb(t),padding:s.padding,width:"100%",border:s.border,children:h.jsxs(h.Fragment,{children:[r.uploading&&r.id===n&&h.jsx("div",{style:aI,children:h.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:h.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}),e]})}):h.jsx(pi,{className:`${c}`,background:l,backgroundColor:o,borderRadius:Eb(t),padding:s.padding,width:"100%",border:s.border,children:h.jsx("div",{children:r.uploading&&r.id===n&&h.jsx("div",{style:aI,children:h.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:h.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})})})}const Q9=Ze({style:dX.shape.style,props:Ze({childrenIds:tu(Xe()).optional().nullable()}).optional().nullable()}).passthrough();function X9({data:t,setData:e}){const[,n]=E.useState(null),{t:i}=It.useTranslation("inspector"),r=s=>{const a=Q9.safeParse(s);a.success?(e(a.data),n(null)):n(a.error)};return h.jsx(Is,{title:i("inputs.panels.container.title"),children:h.jsx(pr,{names:["backgroundColor","background","border","borderMobile","shape","padding","mobilePadding"],value:t.style,shapeSteps:30,onChange:s=>r({...t,style:s})})})}const fX=Xe().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),oI=Ze({top:we(),bottom:we(),right:we(),left:we()}).optional().nullable(),J9=Ze({style:Ze({background:Xe().nullable().optional(),backgroundColor:fX,padding:oI,mobilePadding:oI,height:we().optional().nullable(),heightMobile:we().optional().nullable(),color:Xe().optional().nullable(),width:we().optional().nullable(),widthMobile:we().optional().nullable(),textAlign:Xe().optional().nullable(),textAlignMobile:Xe().optional().nullable()}).passthrough().optional().nullable()}).passthrough(),Oc={height:1,color:"#333333",width:100,textAlign:"left"};function Z9({style:t,blockId:e}){const n=Vn(),i=Lu(n==="desktop"?t?.padding:t?.mobilePadding??t?.padding),r=n==="desktop"?t?.height??Oc.height:t?.heightMobile??t?.height??Oc.height,s=t?.color??Oc.color,a=n==="desktop"?(t?.width??Oc.width)+"%":(t?.widthMobile??t?.width??Oc.width)+"%",o=n==="desktop"?t?.textAlign??Oc.textAlign:t?.textAlignMobile??t?.textAlign??Oc.textAlign,l=t?.background??"",c=t?.backgroundColor??"",u=c?Yo(l,c):l,d=vt(e);return h.jsx(pi,{className:`c${d}`,background:u,backgroundColor:c,width:"100%",padding:i,align:o,children:h.jsx(pi,{display:"inline-block",className:`${d}`,background:s,backgroundColor:c,width:a,padding:{top:r,bottom:0,left:0,right:0},isParent:!1,children:h.jsx("div",{})})})}function e5({data:t,setData:e}){const[,n]=E.useState(null),{t:i}=It.useTranslation("inspector"),r=s=>{const a=J9.safeParse(s);a.success?(e(a.data),n(null)):n(a.error)};return h.jsx(Is,{title:i("inputs.panels.divider.title"),children:h.jsx(pr,{names:["width","widthMobile","height","heightMobile","color","backgroundColor","textAlign","textAlignMobile","padding","mobilePadding"],value:t.style,onChange:s=>r({...t,style:s})})})}const bp=Xe().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),t5=Ze({backdropColor:bp,borderColor:bp,borderRadius:we().optional().nullable(),canvasColor:bp,textColor:bp,fontFamily:Ko,childrenIds:tu(Xe()).optional().nullable(),linkGlobal:Ze({linkColor:bp,underline:Bo()}).optional().nullable(),showVersion:Bo().optional().nullable()}),pX=({label:t,linkColor:e,underline:n=!1,onChange:i})=>{const[r,s]=E.useState(e??"#FF0000"),[a,o]=E.useState(n),l=k.useTheme(),{t:c}=It.useTranslation("inspector"),u=t??c("inputs.links.color"),d=a?"enabled":"disabled",f={width:"100%","& .MuiToggleButton-root":{flex:1,color:l.palette.text.primary,borderColor:l.palette.grey[300],minWidth:"40px","&.Mui-selected":{backgroundColor:l.palette.primary.main,color:l.palette.primary.contrastText,borderColor:l.palette.primary.main,"&:hover":{backgroundColor:l.palette.primary.dark}},"&:hover":{backgroundColor:l.palette.grey[100]}}};E.useEffect(()=>{e!==r&&s(e??"#FF0000")},[e]),E.useEffect(()=>{n!==a&&o(n)},[n]);const p=_=>{const g=_??"#FF0000";s(g),i({linkColor:g,underline:a})},m=(_,g)=>{if(!g)return;const b=g==="enabled";o(b),i({linkColor:r,underline:b})};return h.jsx(k.Stack,{spacing:2,children:h.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:"16px",gap:"16px"},children:[h.jsx(iu,{label:u,defaultValue:r,onChange:p}),h.jsxs("div",{children:[h.jsx(Sn,{label:c("inputs.links.underline")}),h.jsx(k.Box,{sx:{...F9,padding:0,mt:1},children:h.jsxs(k.ToggleButtonGroup,{value:d,exclusive:!0,size:"small",onChange:m,sx:f,children:[h.jsx(k.ToggleButton,{value:"enabled",children:h.jsx(k.Tooltip,{disableInteractive:!0,arrow:!0,title:c("inputs.links.underlineOn"),children:h.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 40 40",role:"img","aria-label":"aiia subrayado",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("title",{children:"aiia subrayado"}),h.jsx("rect",{width:"20",height:"20",fill:"none"}),h.jsx("text",{x:"50%",y:"26",textAnchor:"middle",fontFamily:"system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif",fontSize:"24",fill:"currentColor",children:"aiia"}),h.jsx("line",{x1:"6",y1:"31",x2:"34",y2:"31",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})})}),h.jsx(k.ToggleButton,{value:"disabled",children:h.jsx(k.Tooltip,{disableInteractive:!0,arrow:!0,title:c("inputs.links.underlineOff"),children:h.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 40 40",role:"img","aria-label":"aiia",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("title",{children:"aiia"}),h.jsx("rect",{width:"20",height:"20",fill:"none"}),h.jsx("text",{x:"50%",y:"26",textAnchor:"middle",fontFamily:"system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif",fontSize:"24",fill:"currentColor",children:"aiia"})]})})})]})})]})]})})},hX="email-builder-online",mX="3.4.28",Av={name:hX,version:mX};function n5({data:t,setData:e}){const[,n]=E.useState(null),{t:i}=It.useTranslation("inspector"),r=s=>{const a=t5.safeParse(s);a.success?(e(a.data),n(null)):n(a.error)};return h.jsxs(Is,{title:i("inputs.panels.emailLayout.title"),children:[h.jsx(iu,{label:i("inputs.panels.emailLayout.backgroundColor"),defaultValue:t.backdropColor??"#F5F5F5",onChange:s=>r({...t,backdropColor:s})}),h.jsx(iu,{label:i("inputs.panels.emailLayout.canvasColor"),defaultValue:t.canvasColor??"#FFFFFF",onChange:s=>r({...t,canvasColor:s})}),h.jsx(G9,{label:i("inputs.panels.emailLayout.fontFamily"),defaultValue:t.fontFamily||Ul.FAMILY,onChange:s=>r({...t,fontFamily:s})}),h.jsx(iu,{label:i("inputs.panels.emailLayout.textColor"),defaultValue:t.textColor??"#262626",onChange:s=>r({...t,textColor:s})}),h.jsx(pX,{label:i("inputs.panels.emailLayout.linksLabel"),linkColor:t.linkGlobal?.linkColor||"#000000",underline:t.linkGlobal?.underline||!1,onChange:s=>r({...t,linkGlobal:s})}),t.showVersion&&h.jsx(k.Box,{color:"text.secondary",sx:{display:"flex",justifyContent:"flex-end",mt:2},children:h.jsxs(k.Box,{sx:{textAlign:"right"},children:[h.jsxs(k.Typography,{variant:"body2",children:[i("inputs.panels.emailLayout.version"),": ",Av.version]}),h.jsx(k.Link,{href:`https://www.npmjs.com/package/${Av.name}`,target:"_blank",rel:"noopener noreferrer",sx:{fontSize:"0.875rem",mt:.5,display:"inline-block"},children:Av.name})]})})]})}const lI=Xe().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),gX=Ze({top:we(),bottom:we(),right:we(),left:we()}).optional().nullable(),_X=t=>t?`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`:void 0,i5=Ze({props:Ze({text:Xe().optional().nullable(),level:an(["h1","h2","h3"]).optional().nullable()}).optional().nullable(),style:Ze({color:lI,backgroundColor:lI,fontFamily:Ko,fontWeight:an(["bold","normal"]).optional().nullable(),textAlign:an(["left","center","right"]).optional().nullable(),padding:gX}).optional().nullable()}),Sb={level:"h2",text:""};function r5({props:t,style:e}){const n=t?.level??Sb.level,i=t?.text??Sb.text,r={color:e?.color??void 0,backgroundColor:e?.backgroundColor??void 0,fontWeight:e?.fontWeight??"bold",textAlign:e?.textAlign??void 0,margin:0,fontFamily:Qr(e?.fontFamily),fontSize:bX(n),padding:_X(e?.padding)};switch(n){case"h1":return h.jsx("h1",{style:r,children:i});case"h2":return h.jsx("h2",{style:r,children:i});case"h3":return h.jsx("h3",{style:r,children:i})}}function bX(t){switch(t){case"h1":return 32;case"h2":return 24;case"h3":return 20}}function yX({data:t,setData:e}){const[,n]=E.useState(null),{t:i}=It.useTranslation("inspector"),r=a=>{const o=i5.safeParse(a);o.success?(e(o.data),n(null)):n(o.error)},s=Za();return h.jsxs(Is,{title:i("inputs.panels.heading.title"),children:[s=="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsx(hu,{label:i("inputs.panels.heading.contentLabel"),rows:3,defaultValue:t.props?.text??Sb.text,onChange:a=>{r({...t,props:{...t.props,text:a}})}}),h.jsxs(dc,{label:i("inputs.panels.heading.levelLabel"),defaultValue:t.props?.level??Sb.level,onChange:a=>{r({...t,props:{...t.props,level:a}})},children:[h.jsx(k.ToggleButton,{value:"h1",children:"H1"}),h.jsx(k.ToggleButton,{value:"h2",children:"H2"}),h.jsx(k.ToggleButton,{value:"h3",children:"H3"})]})]}),h.jsx(pr,{names:["color","backgroundColor","fontFamily","fontWeight","textAlign","padding","mobilePadding"],value:t.style,onChange:a=>r({...t,style:a})})]})}const cI=Xe().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),EX=Ze({top:we(),bottom:we(),right:we(),left:we()}).optional().nullable(),vX=t=>t?`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`:void 0,s5=Ze({style:Ze({color:cI,backgroundColor:cI,fontFamily:Ko,fontSize:we().min(0).optional().nullable(),textAlign:an(["left","right","center"]).optional().nullable(),padding:EX}).optional().nullable(),props:Ze({contents:Xe().optional().nullable()}).optional().nullable()});function a5({style:t,props:e}){const n=e?.contents,i={color:t?.color??void 0,backgroundColor:t?.backgroundColor??void 0,fontFamily:Qr(t?.fontFamily),fontSize:t?.fontSize??void 0,textAlign:t?.textAlign??void 0,padding:vX(t?.padding)};return n?h.jsx("div",{style:i,dangerouslySetInnerHTML:{__html:n}}):h.jsx("div",{style:i})}function SX({data:t,setData:e}){const[,n]=E.useState(null),{t:i}=It.useTranslation("inspector"),r=a=>{const o=s5.safeParse(a);o.success?(e(o.data),n(null)):n(o.error)},s=Za();return h.jsxs(Is,{title:i("inputs.panels.html.title"),children:[s=="block-configuration"&&h.jsx(h.Fragment,{children:h.jsx(hu,{label:i("inputs.panels.html.contentLabel"),rows:5,defaultValue:t.props?.contents??"",onChange:a=>r({...t,props:{...t.props,contents:a}})})}),h.jsx(pr,{names:["color","backgroundColor","fontFamily","fontSize","textAlign","padding","mobilePadding"],value:t.style,onChange:a=>r({...t,style:a})})]})}const TX=(t,e,n)=>{const i=Vn();E.useEffect(()=>{const r=()=>{if(!t||!document||i=="mobile")return;const o=vt(t),l=document.querySelector(`.${o}`);if(!l)return;const c=l.parentElement;if(!c)return;const u=Math.ceil(c.getBoundingClientRect().width);n.props?.size===void 0||n.props?.size==="original"||n.props?.touched&&n.props?.width<=u||n.props?.width!==u&&!n.props?.touched&&e({...n,props:{...n.props,width:u}})};r();const s=new ResizeObserver(r),a=document.querySelector(`.${vt(t)}`);return a?.parentElement&&s.observe(a.parentElement),()=>{s.disconnect()}},[t,e,n,i])},CX=({defaultValue:t="original",scale:e=100,onChange:n})=>{const[i,r]=E.useState(t),[s,a]=E.useState(e);Vn();const o=k.useTheme(),{t:l}=It.useTranslation("inspector"),c={container:{width:"100%"},label:{color:o.palette.text.primary},toggleGroup:{width:"100%",backgroundColor:o.palette.background.paper,padding:"4px",borderRadius:"8px"},toggleButton:{flex:1,padding:"6px 16px",textTransform:"none",fontSize:"14px",color:o.palette.text.primary,"&.Mui-selected":{backgroundColor:o.palette.grey[200],color:o.palette.text.primary,"&:hover":{backgroundColor:o.palette.grey[300]}},"&:hover":{backgroundColor:o.palette.grey[100]}},sliderContainer:{marginTop:"16px",padding:"0 8px"},slider:{"& .MuiSlider-thumb":{backgroundColor:o.palette.primary.main,"&:hover":{boxShadow:`0 0 0 8px ${o.palette.primary.main}20`}},"& .MuiSlider-rail":{backgroundColor:o.palette.grey[300]},"& .MuiSlider-track":{backgroundColor:o.palette.primary.main}},scaleValue:{color:o.palette.text.secondary}};E.useEffect(()=>{(t!==i||e!==s)&&(t!==i&&r(t),t==="scale"&&a(e))},[t,e]);const u=(f,p)=>{p!==null&&(r(p),n&&n({mode:p,scale:p==="scale"?s:void 0}))},d=f=>{a(f),n&&n({mode:i,scale:f})};return h.jsxs(tr,{children:[h.jsx(Sn,{label:l("inputs.sizeSelector.label")}),h.jsxs(k.Box,{sx:c.container,children:[h.jsxs(k.ToggleButtonGroup,{value:i,exclusive:!0,onChange:u,sx:c.toggleGroup,children:[h.jsx(k.ToggleButton,{value:"original",sx:c.toggleButton,children:l("inputs.sizeSelector.contain")}),h.jsx(k.ToggleButton,{value:"fill",sx:c.toggleButton,children:l("inputs.sizeSelector.cover")}),h.jsx(k.ToggleButton,{value:"scale",sx:c.toggleButton,children:l("inputs.sizeSelector.scale")})]}),h.jsx(k.Collapse,{in:i==="scale",children:h.jsx(k.Box,{sx:c.sliderContainer,children:h.jsx(jn,{iconLabel:h.jsx(Q.WidthWideOutlined,{}),value:s,setValue:d,marks:!1,units:"%",min:1,max:100})})})]})]})};function xX({data:t,setData:e}){const[n,i]=E.useState(null),r=uc(),s=Za(),a=Vn(),{t:o}=It.useTranslation("inspector");TX(r||"",e,t),E.useEffect(()=>{r&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:r,currentImageUrl:t.props?.url||null,alt:t.props?.alt||null}}))},[r,t.props?.url,t.props?.alt]);const l=E.useCallback(_=>{const g=Xw.safeParse(_);g.success?JSON.stringify(t)!==JSON.stringify(g.data)&&(e(g.data),i(null)):i(g.error)},[t,e]),c=E.useCallback((_,g,b)=>{const y=sX(r)||Gd,v={..._.props};if(b&&(v.touchedMobile=!0),g.mode==="original"){const T=_.props?.original_width??null;return b?{...v,sizeMobile:g.mode,widthMobile:T}:{...v,size:g.mode,width:T,sizeMobile:v.touchedMobile?v.sizeMobile:g.mode,widthMobile:v.touchedMobile?v.widthMobile:T}}if(g.mode==="fill")return b?{...v,sizeMobile:g.mode,widthMobile:null}:{...v,size:g.mode,width:null,sizeMobile:v.touchedMobile?v.sizeMobile:g.mode,widthMobile:v.touchedMobile?v.widthMobile:null};if(g.mode==="scale"){const T=Math.ceil(y/100*g.scale);return b?{...v,sizeMobile:g.mode,scaleMobile:g.scale,widthMobile:T}:{...v,size:g.mode,scale:g.scale,width:T,sizeMobile:v.touchedMobile?v.sizeMobile:g.mode,scaleMobile:v.touchedMobile?v.scaleMobile:g.scale,widthMobile:v.touchedMobile?v.widthMobile:T}}return v},[r]),u=E.useCallback((_,g)=>{const b=c(t,_,g);l({...t,props:b})},[t,l,c]),d=E.useMemo(()=>a!=="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},[a,t.props?.touchedMobile,t.props?.sizeMobile,t.props?.size,t.props?.scaleMobile,t.props?.scale]),f=E.useCallback(_=>{l({...t,props:{...t.props,alt:_}})},[t,l]),p=E.useCallback(_=>{const g=_.trim().length===0?null:_.trim();l({...t,props:{...t.props,linkHref:g}})},[t,l]),m=E.useCallback(_=>{l({...t,style:_})},[t,l]);return h.jsxs(Is,{title:o("inputs.panels.image.title"),children:[s==="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsx(H9,{data:t,setData:e,blockId:r}),h.jsx(hu,{label:o("inputs.panels.image.altLabel"),placeholder:o("inputs.panels.image.altPlaceholder"),defaultValue:t.props?.alt??"",onChange:f}),h.jsx(hu,{label:o("inputs.panels.image.urlLabel"),placeholder:o("inputs.panels.image.urlPlaceholder"),defaultValue:t.props?.linkHref??"",onChange:p}),h.jsx(CX,{defaultValue:d.size,scale:d.scale??void 0,onChange:_=>u(_,a!=="desktop")})]}),h.jsx(pr,{names:["textAlign","textAlignMobile","backgroundColor","shape","padding","mobilePadding"],value:t.style,shapeMaxValue:300,shapeSteps:20,onChange:m})]})}const uI=Xe().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),dI=Ze({top:we(),bottom:we(),right:we(),left:we()}).optional().nullable(),o5=Ze({style:Ze({color:uI,backgroundColor:uI,background:Xe().nullable().optional(),fontSize:we().gte(0).optional().nullable(),fontFamily:Ko,fontWeight:an(["bold","normal"]).optional().nullable(),textAlign:an(["left","center","right"]).optional().nullable(),padding:dI,mobilePadding:dI,optionSize:an(["small","medium","large"]).optional().nullable(),theme:an(["light","dark","colored"]).optional().nullable()}).passthrough().optional().nullable(),gap:we().optional(),items:tu(Ze({id:Xe(),key:Xe(),label:Xe(),iconName:Xe(),theme:Xe(),size:Xe(),sizePx:Xe(),url:Xe(),href:Xe().optional().nullable()}))}).passthrough();function l5({style:t,items:e,blockId:n,gap:i=1,gapMobile:r}){var s,a,o,l,c,u;const d=Vn(),f=(s=t?.background)!==null&&s!==void 0?s:"",p=t?.backgroundColor,m=p?Yo(f,p):f,_={color:(a=t?.color)!==null&&a!==void 0?a:void 0,background:m,backgroundColor:t?.backgroundColor,fontSize:(o=t?.fontSize)!==null&&o!==void 0?o:16,fontFamily:Qr(t?.fontFamily),fontWeight:(l=t?.fontWeight)!==null&&l!==void 0?l:void 0,textAlign:d=="desktop"?t?.textAlign:(c=t?.textAlignMobile)!==null&&c!==void 0?c:t?.textAlign,padding:d=="desktop"?t?.padding:(u=t?.mobilePadding)!==null&&u!==void 0?u:t?.padding},g=d==="desktop"?i:r??i,b=vt(n);return E.createElement(kX,{blockId:`${b}`,items:e,wStyle:_,gap:g})}const kX=({items:t,blockId:e,wStyle:n,gap:i})=>{const r=s=>{switch(s){case 0:return"first";case t.length-1:return"last";default:return"inside"}};return E.createElement(pi,{className:e,background:n.background,backgroundColor:n.backgroundColor,padding:n?.padding,align:n.textAlign,width:"100%"},E.createElement("table",{style:{display:"inline-block"},border:0,cellSpacing:"0",cellPadding:"0"},E.createElement("tbody",null,E.createElement("tr",null,t.map((s,a)=>{const o=r(a);return E.createElement(E.Fragment,{key:s.id},o!=="first"&&E.createElement("td",{className:`gap-${e}`,width:Math.ceil(i/2)}),E.createElement("td",{key:`${s.id}-${s.url}`,id:`${s.id}-${s.url}`,width:s.sizePx,style:{textAlign:"center",whiteSpace:"nowrap"}},E.createElement("a",{key:`item_${a}`,target:"_blank",href:Qw(s.href),style:{textDecoration:"none"}},E.createElement("img",{src:s.url,alt:s.key,style:{width:s.sizePx||36,height:s.sizePx||36,display:"block"}}))),o!=="last"&&E.createElement("td",{className:`gap-${e}`,width:Math.ceil(i/2)}))})))))},wX="https://maildrill-dev.s3.us-east-2.amazonaws.com/icons/",AX={positive:!0,original:!0,negative:!0},DX={small:!0,medium:!0,large:!0,xlarge:!0},ie={theme:"positive",size:"medium"},Vt=(t,e,n="medium")=>{var i,r;const s=(i=Zw.find(o=>o.key===n))===null||i===void 0?void 0:i.value,a=(r=c5.find(o=>o.key===e))===null||r===void 0?void 0:r.value;return`${wX}${t}_${a}_${s}.png`},en=t=>{var e;return((e=Zw.find(n=>n.key===t))===null||e===void 0?void 0:e.value)||"36px"},Zw=[{value:"24px",key:"small",label:"Small"},{value:"36px",key:"medium",label:"Medium"},{value:"48px",key:"large",label:"Large"}],c5=[{value:"Positive",key:"positive",label:"Light"},{value:"Original",key:"original",label:"Color"},{value:"Negative",key:"negative",label:"Dark"}],P_=[{key:"facebook",label:"Facebook",iconName:"Facebook",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Facebook",ie.theme,ie.size),href:"https://www.facebook.com/your-profile"},{key:"web",label:"Web",iconName:"Web",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Web",ie.theme,ie.size),href:"https://www.google.com"},{key:"mail",label:"Mail",iconName:"Mail",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Mail",ie.theme,ie.size),href:"https://mail.google.com/"},{key:"apple",label:"Apple",iconName:"Apple",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Apple",ie.theme,ie.size),href:"https://www.apple.com/"},{key:"bluesky",label:"Bluesky",iconName:"Bluesky",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Bluesky",ie.theme,ie.size),href:"https://bsky.app/"},{key:"clubhouse",label:"ClubHouse",iconName:"Clubhouse",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Clubhouse",ie.theme,ie.size),href:"https://www.clubhouse.com/"},{key:"dribbble",label:"Dribbble",iconName:"Dribbble",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Dribbble",ie.theme,ie.size),href:"https://dribbble.com/"},{key:"figma",label:"Figma",iconName:"Figma",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Figma",ie.theme,ie.size),href:"https://www.figma.com/"},{key:"github",label:"Github",iconName:"Github",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Github",ie.theme,ie.size),href:"https://github.com/"},{key:"google",label:"Google",iconName:"Google",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Google",ie.theme,ie.size),href:"https://google.com/"},{key:"instagram",label:"Instagram",iconName:"Instagram",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Instagram",ie.theme,ie.size),href:"https://www.instagram.com/your-profile"},{key:"linkedin",label:"LinkedIn",iconName:"LinkedIn",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("LinkedIn",ie.theme,ie.size),href:"https://www.linkedin.com/in/your-profile"},{key:"medium-social",label:"Medium",iconName:"Medium",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Medium",ie.theme,ie.size),href:"https://medium.com/"},{key:"messenger",label:"Messenger",iconName:"Messenger",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Messenger",ie.theme,ie.size),href:"https://www.messenger.com/"},{key:"pinterest",label:"Pinterest",iconName:"Pinterest",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Pinterest",ie.theme,ie.size),href:"https://www.pinterest.com/"},{key:"reddit",label:"Reddit",iconName:"Reddit",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Reddit",ie.theme,ie.size),href:"https://www.reddit.com/"},{key:"signal",label:"Signal",iconName:"Signal",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Signal",ie.theme,ie.size),href:"https://signal.org/"},{key:"snapchat",label:"Snapchat",iconName:"Snapchat",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Snapchat",ie.theme,ie.size),href:"https://www.snapchat.com/"},{key:"spotify",label:"Spotify",iconName:"Spotify",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Spotify",ie.theme,ie.size),href:"https://www.spotify.com/"},{key:"telegram",label:"Telegram",iconName:"Telegram",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Telegram",ie.theme,ie.size),href:"https://t.me/your-profile"},{key:"threads",label:"Threads",iconName:"Threads",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Threads",ie.theme,ie.size),href:"https://www.threads.net/"},{key:"tiktok",label:"TikTok",iconName:"TikTok",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("TikTok",ie.theme,ie.size),href:"https://www.tiktok.com/@your-profile"},{key:"tumblr",label:"Tumblr",iconName:"Tumblr",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Tumblr",ie.theme,ie.size),href:"https://www.tumblr.com/"},{key:"twitch",label:"Twitch",iconName:"Twitch",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Twitch",ie.theme,ie.size),href:"https://www.twitch.tv/"},{key:"vk",label:"VK",iconName:"VK",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("VK",ie.theme,ie.size),href:"https://vk.com/"},{key:"whatsapp",label:"WhatsApp",iconName:"WhatsApp",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("WhatsApp",ie.theme,ie.size),href:"https://www.whatsapp.com/"},{key:"x",label:"X",iconName:"X",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("X",ie.theme,ie.size),href:"https://x.com/your-profile"},{key:"youtube",label:"YouTube",iconName:"YouTube",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("YouTube",ie.theme,ie.size),href:"https://www.youtube.com/channel/your-channel-id"}];function Bp(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}const NX=({element:t,index:e,moveItem:n,onSelectChange:i,onUrlChange:r,onRemove:s,onDuplicate:a,canRemove:o,theme:l})=>{const c=E.useRef(null),[u,d]=E.useState(null),{t:f}=It.useTranslation("inspector"),p=N=>{const M=N.getClientOffset(),C=c.current?.getBoundingClientRect();if(!M||!C)return null;const F=(C.bottom-C.top)/2;return M.y-C.top<F?"up":"down"},[{handlerId:m,isOver:_},g]=Yl.useDrop(()=>({accept:"social-media-item",collect(N){return{handlerId:N.getHandlerId(),isOver:N.isOver({shallow:!0})}},hover(N,M){if(!c.current)return;if(N.index===e){d(null);return}if(!M.isOver({shallow:!0})){d(null);return}const D=p(M);d(D)},drop(N,M){if(d(null),!c.current)return;const C=N.index,F=e;if(C===F)return;const D=p(M);let q=F;D==="down"&&(q=F+1),C<q&&(q=q-1),setTimeout(()=>{n(C,q)},0),N.index=q},end:()=>{d(null)}}),[t.id,e,n]),[{isDragging:b},y]=Yl.useDrag(()=>({type:"social-media-item",item:()=>({id:t.id,index:e}),collect:N=>({isDragging:N.isDragging()}),end:()=>{d(null)}}),[t.id,e]);E.useEffect(()=>{_||d(null)},[_]);const v=b?.4:1;E.useEffect(()=>{if(c.current&&y&&g){const N=c.current;y(N),g(N)}},[y,g]);const T=()=>{setTimeout(()=>s(e),0)},x=()=>{setTimeout(()=>a(e),0)},w=N=>{const M=N.target.value;setTimeout(()=>i(e,M,t),0)},I=N=>{const M=N.target.value;setTimeout(()=>r(e,M,t),0)},A=()=>h.jsxs("div",{style:{height:"3px",background:l.palette.secondary.main,position:"relative",color:l.palette.secondary.main,margin:"4px 0"},children:[h.jsx("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:h.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"})}),h.jsx("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:h.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 h.jsxs(h.Fragment,{children:[u==="up"&&h.jsx(A,{}),h.jsxs(k.Stack,{ref:c,"data-handler-id":m,sx:{border:1,borderColor:"divider",padding:1,paddingTop:0,borderRadius:1,backgroundColor:"background.paper",marginBottom:1.5,opacity:v,cursor:b?"grabbing":"grab",boxShadow:b?l.shadows[3]:"none"},gap:1,children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:`1px solid ${l.palette.divider}`},children:[h.jsx("div",{style:{display:"flex",alignItems:"center"},children:h.jsx(Q.DragIndicator,{sx:{color:b?"primary.main":"text.secondary",cursor:"grab",marginLeft:-.9,"&:hover":{color:"primary.main"}}})}),h.jsxs("div",{children:[h.jsx(k.Tooltip,{disableInteractive:!0,arrow:!0,title:"Duplicate",placement:"left",children:h.jsx(k.IconButton,{color:"primary",size:"small",onClick:x,children:h.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.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"})})})}),o&&h.jsx(k.Tooltip,{disableInteractive:!0,arrow:!0,title:"Remove",placement:"left",children:h.jsx(k.IconButton,{color:"error",size:"small",onClick:T,children:h.jsx(Q.DeleteOutline,{sx:{fontSize:20}})})})]})]}),h.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"0.5rem"},children:[h.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[h.jsx(Sn,{label:f("inputs.social.icon")}),h.jsx(tc,{fullWidth:!0,labelId:"demo-simple-select-label",id:"demo-simple-select",value:t.key,size:"small",onChange:w,children:P_.map(N=>h.jsx(k.MenuItem,{value:N.key,children:N.label},`${t.id}_${N.key}`))})]}),h.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[h.jsx(Sn,{label:f("inputs.social.url")}),h.jsx(k.TextField,{size:"small",fullWidth:!0,value:t.href??"",onChange:I,variant:"outlined",placeholder:"https://your-website.com",sx:Zy})]})]})]}),u==="down"&&h.jsx(A,{})]})};function IX({items:t=[],onChange:e}){const{t:n}=It.useTranslation("inspector"),i=k.useTheme(),[r,s]=E.useState(()=>t.map(g=>({...g,id:g.id||Bp()}))),[a,o]=E.useState(t[0]?.theme||"default"),[l,c]=E.useState(t[0]?.size||"medium");E.useEffect(()=>{t.length>0&&(o(t[0].theme),c(t[0].size),s(t.map(g=>({...g,id:g.id||Bp()}))))},[t]);const u=(g,b)=>{s(y=>{const v=[...y],[T]=v.splice(g,1);return v.splice(b,0,T),e&&setTimeout(()=>e(v),0),v})},d=()=>{s(g=>{const b={...P_[0],theme:a,size:l,sizePx:en(l),url:Vt(P_[0].iconName,a,l),id:Bp()},y=[...g,b];return e&&setTimeout(()=>e(y),0),y})},f=g=>{s(b=>{const y=b.filter((v,T)=>T!==g);return e&&setTimeout(()=>e(y),0),y})},p=(g,b,y)=>{let v=[...r];if(b in AX?(o(b),v=v.map(T=>{const x=Vt(T.iconName,b,T.size);return{...T,theme:b,url:x}})):b in DX&&(c(b),v=v.map(T=>{const x=Vt(T.iconName,T.theme,b),w=en(b);return{...T,size:b,sizePx:w,url:x}})),g!==null&&y){const T=P_.find(x=>x.key===b);T&&(v=v.map((x,w)=>{const I={key:T.key,label:T.label,iconName:T.iconName,href:T.href},A=Vt(I.iconName,y.theme,y.size);return w===g?{...x,...I,url:A,id:y.id}:x}))}s(v),e&&setTimeout(()=>e(v),0)},m=(g,b,y)=>{const v=r.map((T,x)=>x===g?{...y,href:b}:T);s(v),e&&setTimeout(()=>e(v),0)},_=g=>{s(b=>{const y={...JSON.parse(JSON.stringify(b[g])),id:Bp()},v=[...b.slice(0,g+1),y,...b.slice(g+1)];return e&&setTimeout(()=>e(v),0),v})};return h.jsxs(h.Fragment,{children:[h.jsxs("div",{style:{marginBottom:"1rem",display:"grid",gridTemplateColumns:"repeat(2,1fr)",gap:"1rem"},children:[h.jsxs(tr,{children:[h.jsx(Sn,{label:n("inputs.social.theme")}),h.jsx(tc,{fullWidth:!0,labelId:"theme-selector",id:"theme-selector",value:a,size:"small",onChange:g=>p(null,g.target.value,null),children:c5.map(g=>h.jsx(k.MenuItem,{value:g.key,children:g.label},`${g.key}`))})]}),h.jsxs(tr,{children:[h.jsx(Sn,{label:n("inputs.social.size")}),h.jsx(tc,{fullWidth:!0,labelId:"size-selector",id:"size-selector",value:l,size:"small",onChange:g=>p(null,g.target.value,null),children:Zw.map(g=>h.jsx(k.MenuItem,{value:g.key,children:g.label},`${g.key}`))})]})]}),r?.map((g,b)=>h.jsx(NX,{element:g,index:b,moveItem:u,onSelectChange:p,onUrlChange:m,onRemove:f,onDuplicate:_,canRemove:r.length>1,theme:i},g.id)),h.jsx(k.Button,{onClick:d,sx:{borderRadius:1},variant:"contained",endIcon:h.jsx(Q.Add,{}),children:"Add"})]})}const OX=({data:t,setData:e})=>{const[,n]=E.useState(null),i=Vn(),{t:r}=It.useTranslation("inspector"),s=u=>{const d=o5.safeParse(u);d.success?(e(d.data),n(null)):n(d.error)},a=u=>{s({...t,items:u})},o=u=>{s({...t,style:u})},l=(u,d=!1)=>{if(d){s({...t,gapMobile:u});return}s({...t,gap:u})},c=Za();return h.jsxs(Is,{title:r("inputs.panels.social.title"),children:[c=="block-configuration"&&h.jsx(k.Box,{sx:{minWidth:120,margin:1},children:h.jsx(IX,{items:t?.items||[],onChange:a})}),c=="css"&&h.jsxs(h.Fragment,{children:[h.jsxs(tr,{children:[h.jsx(Sn,{label:r("inputs.panels.social.gap")}),i=="desktop"?h.jsx(jn,{iconLabel:h.jsx(Q.SpaceBar,{sx:{color:"text.primary"}}),value:t?.gap??4,setValue:l,marks:!0,step:4,units:"px",min:0,max:40}):h.jsx(jn,{iconLabel:h.jsx(Q.SpaceBar,{sx:{color:"text.primary"}}),value:t?.gapMobile??t?.gap??4,setValue:u=>l(u,!0),marks:!0,step:4,units:"px",min:0,max:40})]}),h.jsx(pr,{names:["textAlign","textAlignMobile","backgroundColor","padding","mobilePadding"],value:t.style,onChange:u=>o(u)})]})]})},RX=Xe().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),u5=Ze({style:Ze({height:we().optional().nullable(),heightMobile:we().optional().nullable(),background:Xe().nullable().optional(),backgroundColor:RX}).optional().nullable()}),fI={height:16};function d5({style:t,blockId:e}){const i=Vn()==="desktop"?t?.height??fI.height:t?.heightMobile??t?.height??fI.height,r=t?.background??"",s=t?.backgroundColor??"",a=s?Yo(r,s):r,o={width:"100%",minWidth:"100%",backgroundColor:s||void 0,background:a||void 0},l=vt(e);return h.jsx("table",{className:l,width:"100%",style:o,children:h.jsx("tbody",{children:h.jsx("tr",{className:`it${l}`,height:i,style:{height:i},children:h.jsx("td",{})})})})}function f5({data:t,setData:e}){const[,n]=E.useState(null),{t:i}=It.useTranslation("inspector"),r=s=>{const a=u5.safeParse(s);a.success?(e(a.data),n(null)):n(a.error)};return h.jsx(Is,{title:i("inputs.panels.spacer.title"),children:h.jsx(pr,{names:["height","heightMobile","backgroundColor"],value:t.style,onChange:s=>r({...t,style:s})})})}const MX={EmailLayout:{label:"Email",iconName:"DashboardOutlined"},NotionText:{label:"Notion 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"},Heading:{label:"Heading",iconName:"Title"},Text:{label:"Text",iconName:"TextFieldsOutlined"},Html:{label:"HTML",iconName:"CodeOutlined"},CustomEditor:{label:"Custom Editor",iconName:"EditOutlined"},Wysiwyg:{label:"WYSIWYG",iconName:"EditNoteOutlined"},Avatar:{label:"Avatar",iconName:"AccountCircleOutlined"}},LX=t=>e=>e.document[t],PX=t=>e=>e.document[t]?.data?.style;function FX(t){const e=t.document;if(!e||!e.root)return null;function n(r,s){const a=s.document[r];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 i(r,s,a){const l=a.document[r]?.type??"Unknown",c=MX[l]??{label:l,iconName:"WidgetsOutlined"},d=n(r,a).map(f=>i(f,s+1,a));return{blockId:r,type:l,label:c.label,iconName:c.iconName,children:d,depth:s}}return i("root",0,t)}function BX(t){return ye(t)}function UX(t){return ye(LX(t))}function $X(t){return ye(PX(t))}function qX(t){const e=E.useCallback(l=>{Ql(t,l)},[t]),n=E.useCallback(l=>{C9(t,l)},[t]),i=E.useCallback((l,c)=>{sK(t,l,c)},[t]),r=E.useCallback(l=>{x9(t,l)},[t]),s=E.useCallback((l,c)=>{aK(t,l,c)},[t]),a=E.useCallback(l=>{oK(t,l)},[t]),o=E.useCallback(l=>{lK(t,l)},[t]);return E.useMemo(()=>({updateBlock:e,updateProps:n,updateProp:i,updateStyles:r,updateStyle:s,batchUpdateProps:a,batchUpdateStyles:o}),[e,n,i,r,s,a,o])}function zX(t){const e=uc(),n=Za(),{t:i}=It.useTranslation("inspector"),r=$X(e??""),{updateStyles:s}=qX(e??"");if(!e)return null;const a=o=>{s(()=>o)};return h.jsxs(Is,{title:i("inputs.panels.notionText.title","Notion Text"),children:[n==="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{style:{display:"flex",gap:"8px"},children:[h.jsx("div",{style:{flex:1},children:h.jsx(pr,{disabledCSSValidation:!0,names:["fontFamily"],value:r,onChange:a})}),h.jsx("div",{style:{flex:1},children:h.jsx(pr,{disabledCSSValidation:!0,names:["lineHeight"],value:r,onChange:a})})]}),h.jsx(pr,{disabledCSSValidation:!0,names:["fontSize","fontSizeMobile"],value:r,onChange:a})]}),n==="css"&&h.jsx(pr,{names:["backgroundColor","border","borderMobile","padding","mobilePadding"],value:r,onChange:a})]})}function pI(t){return h.jsx(k.Box,{sx:{m:3,p:1,border:"1px dashed",borderColor:"divider"},children:h.jsx(k.Typography,{color:"text.secondary",children:t})})}function GX(){const t=uc(),e=_9(t||"");if(!t)return pI("Click on a block to inspect.");if(!e)return pI(`Block with id ${t} was not found. Click on a block to reset.`);const{data:n,type:i}=e,r=E.useCallback(s=>{Ql(t,()=>s)},[t]);switch(i){case"Avatar":return h.jsx(KQ,{data:n,setData:s=>r({type:i,data:s})},t);case"Button":return h.jsx(eX,{data:n,setData:s=>r({type:i,data:s})},t);case"ColumnsContainer":return h.jsx(cX,{data:n,setData:s=>r({type:i,data:s})},t);case"Container":return h.jsx(X9,{data:n,setData:s=>r({type:i,data:s})},t);case"Divider":return h.jsx(e5,{data:n,setData:s=>r({type:i,data:s})},t);case"Heading":return h.jsx(yX,{data:n,setData:s=>r({type:i,data:s})},t);case"Html":return h.jsx(SX,{data:n,setData:s=>r({type:i,data:s})},t);case"Image":return h.jsx(xX,{data:n,setData:s=>r({type:i,data:s})},t);case"EmailLayout":return h.jsx(n5,{data:n,setData:s=>r({type:i,data:s})},t);case"Spacer":return h.jsx(f5,{data:n,setData:s=>r({type:i,data:s})},t);case"CustomEditor":case"Wysiwyg":case"NotionText":return h.jsx(zX,{data:n,setData:s=>r({type:i,data:s})},t);case"SocialMedia":return h.jsx(OX,{data:n,setData:s=>r({type:i,data:s})},t);default:return h.jsx("pre",{children:JSON.stringify(e,null," ")})}}const jX=E.memo(GX);function HX(){const t=uc(),e=UX(t??"root");if(!e)return null;const{data:n,type:i}=e,r=E.useCallback(a=>{t&&Ql(t,()=>a)},[t]),s=E.useCallback(a=>{Ql("root",()=>a)},[]);switch(i){case"Container":return h.jsx(X9,{data:n,setData:a=>r({type:i,data:a})},t);case"Divider":return h.jsx(e5,{data:n,setData:a=>r({type:i,data:a})},t);case"Spacer":return h.jsx(f5,{data:n,setData:a=>r({type:i,data:a})},t);case"EmailLayout":return h.jsx(n5,{data:n,setData:a=>s({type:i,data:a})},"root");default:return h.jsx("pre",{children:JSON.stringify(e,null," ")})}}function VX({sticky:t,heightContent:e}){const n=Za(),i=g9(),r=uc(),s=Vn(),a=k.useTheme(),{t:o}=It.useTranslation("inspector"),l=()=>{const p={position:"absolute",top:"1rem",right:"0rem",height:"24px",lineHeight:"normal",width:"fit",fontSize:"12px"};switch(n){case"block-configuration":case"css":return h.jsxs("div",{style:{position:"relative"},children:[h.jsx(k.Chip,{color:"primary",sx:p,label:`${o(s==="desktop"?"header.desktop":"header.mobile")}`}),h.jsx(jX,{})]});case"styles":return h.jsxs("div",{style:{position:"relative"},children:[h.jsx(HX,{}),h.jsx(k.Chip,{color:"primary",sx:p,label:`${o(s==="desktop"?"header.desktop":"header.mobile")}`})]})}},c=()=>h.jsx("svg",{style:{marginRight:"4px",color:"inherit"},width:"21",height:"20",viewBox:"0 0 21 20",fill:"none",children:h.jsx("path",{d:"M3.83398 5H17.1673M3.83398 10H17.1673M3.83398 15H9.66732",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),u=()=>h.jsx("svg",{style:{marginRight:"4px",color:"inherit"},width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:h.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"})});E.useEffect(()=>{const p=m=>{const _=m.target;ON(_.innerWidth)};return window&&ON(window.innerWidth),window.addEventListener("resize",p),()=>{window.removeEventListener("resize",p)}},[n]);const d=(p,m)=>{zY(m)},f=t?e?`calc(${e} - ${pl})`:void 0:e??void 0;return h.jsxs(k.Container,{sx:p=>({width:db,padding:"0!important",margin:"0!important",height:f,maxHeight:f,display:"flex",flexDirection:"column",overflow:"hidden",position:t?"sticky":"static",top:t?pl:0,backgroundColor:`${p.palette.background.paper} !important`}),children:[h.jsx(k.Box,{sx:{position:"sticky",top:0,zIndex:1,backgroundColor:`${a.palette.background.paper} !important`},children:h.jsxs(k.Tabs,{sx:{backgroundColor:`${a.palette.background.paper} !important`},value:n,onChange:d,children:[r!=null&&!ub.includes(i||"")&&[h.jsx(k.Tab,{sx:{height:pl,minHeight:pl,fontWeight:"bold"},value:"block-configuration",label:o("header.content"),icon:h.jsx(c,{}),iconPosition:"start"},"block-configuration"),h.jsx(k.Tab,{sx:{height:pl,minHeight:pl,fontWeight:"bold"},value:"css",label:o("header.styles"),icon:h.jsx(u,{}),iconPosition:"start"},"css")],ub.includes(i)&&[h.jsx(k.Tab,{sx:{height:pl,minHeight:pl,fontWeight:"bold"},value:"styles",label:o("header.styles"),icon:h.jsx(u,{}),iconPosition:"start"},"styles")]]})}),h.jsx(k.Container,{sx:p=>({flex:"1 1 auto",minHeight:0,overflowY:"auto",px:2,backgroundColor:`${p.palette.background.paper} !important`}),children:l()})]})}const p5=({children:t,topOffset:e=0,zIndex:n=10,className:i="",style:r={},disabled:s=!1,threshold:a=null,...o})=>{const[l,c]=E.useState(!1),[u,d]=E.useState({width:0,height:0}),[f,p]=E.useState({left:0}),[m,_]=E.useState(0),[g,b]=E.useState(!1),y=E.useRef(null),v=E.useRef(null),T=E.useRef(null);E.useEffect(()=>{if(s){c(!1),b(!1),_(0);return}const I=v.current,A=y.current;if(!I||!A)return;let N=null;a&&(a.startsWith("#")?N=document.getElementById(a.slice(1)):(a.startsWith("."),N=document.querySelector(a)));const M=()=>{const z=A.getBoundingClientRect();d({width:z.width,height:z.height}),p({left:z.left})},C=()=>{if(!N||!A)return{offset:0,isPushed:!1};const z=N.getBoundingClientRect(),O=A.getBoundingClientRect(),P=e+O.height;if(z.top<P){const j=P-z.top,ee=O.height+20;return{offset:-Math.min(j,ee),isPushed:!0}}return{offset:0,isPushed:!1}},F=new IntersectionObserver(([z])=>{const O=!z.isIntersecting;if(O&&!l&&M(),c(O),O&&a){const{offset:P,isPushed:j}=C();_(P),b(j)}else O||(_(0),b(!1))},{threshold:0,rootMargin:`-${e}px 0px 0px 0px`}),D=new ResizeObserver(()=>{M()}),q=()=>{if(a&&l){const{offset:z,isPushed:O}=C();_(z),b(O)}};return F.observe(I),D.observe(A),a&&window.addEventListener("scroll",q,{passive:!0}),M(),()=>{F.disconnect(),D.disconnect(),a&&window.removeEventListener("scroll",q)}},[e,l,s,a]);const x=!s&&l,w=x?`${e+m}px`:"auto";return h.jsxs("div",{ref:T,className:i,...o,children:[!s&&h.jsx("div",{ref:v,style:{height:"1px",position:"absolute",top:`-${e+1}px`,left:0,right:0,pointerEvents:"none"}}),x&&h.jsx("div",{style:{height:`${u.height}px`,width:`${u.width}px`}}),h.jsx("div",{ref:y,style:{position:x?"fixed":"static",top:w,width:"auto",height:"auto",zIndex:x?n:"auto",transition:g?"none":"box-shadow 0.2s ease-in-out, top 0.3s ease-out",...g&&m<-u.height*.3&&{opacity:Math.max(0,1+(m+u.height*.3)/(u.height*.7))},...r},children:t})]})};var Dv,hI;function eA(){if(hI)return Dv;hI=1;var t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},e={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},n=/(&amp;|&lt;|&gt;|&quot;|&#39;)/g,i=/[&<>"']/g;function r(l){return t[l]}function s(l){return e[l]}function a(l){return l==null?"":String(l).replace(i,r)}function o(l){return l==null?"":String(l).replace(n,s)}return a.options=o.options={},Dv={encode:a,escape:a,decode:o,unescape:o,version:"1.0.0-browser"},Dv}var Nv,mI;function WX(){if(mI)return Nv;mI=1;function t(e){for(var n=Array.prototype.slice.call(arguments,1),i,r;n.length;){i=n.shift();for(r in i)i.hasOwnProperty(r)&&(Object.prototype.toString.call(e[r])==="[object Object]"?e[r]=t(e[r],i[r]):e[r]=i[r])}return e}return Nv=t,Nv}var Iv,gI;function h5(){return gI||(gI=1,Iv=function(e){return typeof e=="string"?e.toLowerCase():e}),Iv}var Ov,_I;function m5(){if(_I)return Ov;_I=1;function t(n){return n.reduce(e,{})}function e(n,i){return n[i]=!0,n}return Ov=t,Ov}var Rv,bI;function g5(){if(bI)return Rv;bI=1;var t=m5(),e=["background","base","cite","href","longdesc","src","usemap"];return Rv={uris:t(e)},Rv}var Mv,yI;function _5(){if(yI)return Mv;yI=1;var t=m5(),e=["area","br","col","hr","img","wbr","input","base","basefont","link","meta"];return Mv={voids:t(e)},Mv}var Lv,EI;function YX(){if(EI)return Lv;EI=1;var t=eA(),e=h5();g5();var n=_5(),i=/^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,r=/^<\s*\/\s*([\w:-]+)[^>]*>/,s=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,a=/^</,o=/^<\s*\//;function l(){var u=[];return u.lastItem=function(){return u[u.length-1]},u}function c(u,d){for(var f=l(),p=u,m;u;)_();x();function _(){m=!0,g();var w=u===p;p=u,w&&(u="")}function g(){u.substr(0,4)==="<!--"?y():o.test(u)?b(r,x):a.test(u)&&b(i,T),v()}function b(w,I){var A=u.match(w);A&&(u=u.substring(A[0].length),A[0].replace(w,I),m=!1)}function y(){var w=u.indexOf("-->");w>=0&&(d.comment&&d.comment(u.substring(4,w)),u=u.substring(w+3),m=!1)}function v(){if(m){var w,I=u.indexOf("<");I>=0?(w=u.substring(0,I),u=u.substring(I)):(w=u,u=""),d.chars&&d.chars(w)}}function T(w,I,A,N){var M={},C=e(I),F=n.voids[C]||!!N;A.replace(s,D),F||f.push(C),d.start&&d.start(C,M,F);function D(q,z,O,P,j){O===void 0&&P===void 0&&j===void 0?M[z]=void 0:M[z]=t.decode(O||P||j||"")}}function x(w,I){var A,N=0,M=e(I);if(M)for(N=f.length-1;N>=0&&f[N]!==M;N--);if(N>=0){for(A=f.length-1;A>=N;A--)d.end&&d.end(f[A]);f.length=N}}}return Lv=c,Lv}var Pv,vI;function KX(){if(vI)return Pv;vI=1;var t=eA(),e=h5(),n=g5(),i=_5();function r(s,a){var o,l=a||{};return g(),{start:u,end:d,chars:p};function c(b){s.push(b)}function u(b,y,v){var T=e(b);if(o.ignoring){m(T);return}if((l.allowedTags||[]).indexOf(T)===-1){m(T);return}if(l.filter&&!l.filter({tag:T,attrs:y})){m(T);return}c("<"),c(T),Object.keys(y).forEach(x),c(v?"/>":">");function x(w){var I=y[w],A=(l.allowedClasses||{})[T]||[],N=(l.allowedAttributes||{})[T]||[],M,C=e(w);C==="class"&&N.indexOf(C)===-1?(I=I.split(" ").filter(F).join(" ").trim(),M=I.length):M=N.indexOf(C)!==-1&&(n.uris[C]!==!0||f(I)),M&&(c(" "),c(w),typeof I=="string"&&(c('="'),c(t.encode(I)),c('"')));function F(D){return A&&A.indexOf(D)!==-1}}}function d(b){var y=e(b),v=(l.allowedTags||[]).indexOf(y)!==-1;v&&o.ignoring===!1?(c("</"),c(y),c(">")):_(y)}function f(b){var y=b[0];if(y==="#"||y==="/")return!0;var v=b.indexOf(":");if(v===-1)return!0;var T=b.indexOf("?");if(T!==-1&&v>T)return!0;var x=b.indexOf("#");if(x!==-1&&v>x)return!0;return l.allowedSchemes.some(w);function w(I){return b.indexOf(I+":")===0}}function p(b){o.ignoring===!1&&c(l.transformText?l.transformText(b):b)}function m(b){i.voids[b]||(o.ignoring===!1?o={ignoring:b,depth:1}:o.ignoring===b&&o.depth++)}function _(b){o.ignoring===b&&--o.depth<=0&&g()}function g(){o={ignoring:!1,depth:0}}}return Pv=r,Pv}var Fv,SI;function QX(){if(SI)return Fv;SI=1;var t={allowedAttributes:{a:["href","name","target","title","aria-label"],iframe:["allowfullscreen","frameborder","src"],img:["src","alt","title","aria-label"]},allowedClasses:{},allowedSchemes:["http","https","mailto"],allowedTags:["a","abbr","article","b","blockquote","br","caption","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","main","mark","ol","p","pre","section","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],filter:null};return Fv=t,Fv}var Bv,TI;function XX(){if(TI)return Bv;TI=1,eA();var t=WX(),e=YX(),n=KX(),i=QX();function r(s,a,o){var l=[],c=o===!0?a:t({},i,a),u=n(l,c);return e(s,u),l.join("")}return r.defaults=i,Bv=r,Bv}var JX=XX();const ZX=Pm(JX);function tA(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Pu=tA();function b5(t){Pu=t}const y5=/[&<>"']/,eJ=new RegExp(y5.source,"g"),E5=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,tJ=new RegExp(E5.source,"g"),nJ={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},CI=t=>nJ[t];function qr(t,e){if(e){if(y5.test(t))return t.replace(eJ,CI)}else if(E5.test(t))return t.replace(tJ,CI);return t}const iJ=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function rJ(t){return t.replace(iJ,(e,n)=>(n=n.toLowerCase(),n==="colon"?":":n.charAt(0)==="#"?n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1)):""))}const sJ=/(^|[^\[])\^/g;function un(t,e){let n=typeof t=="string"?t:t.source;e=e||"";const i={replace:(r,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(sJ,"$1"),n=n.replace(r,a),i},getRegex:()=>new RegExp(n,e)};return i}function xI(t){try{t=encodeURI(t).replace(/%25/g,"%")}catch{return null}return t}const lh={exec:()=>null};function kI(t,e){const n=t.replace(/\|/g,(s,a,o)=>{let l=!1,c=a;for(;--c>=0&&o[c]==="\\";)l=!l;return l?"|":" |"}),i=n.split(/ \|/);let r=0;if(i[0].trim()||i.shift(),i.length>0&&!i[i.length-1].trim()&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;r<i.length;r++)i[r]=i[r].trim().replace(/\\\|/g,"|");return i}function Ng(t,e,n){const i=t.length;if(i===0)return"";let r=0;for(;r<i&&t.charAt(i-r-1)===e;)r++;return t.slice(0,i-r)}function aJ(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let i=0;i<t.length;i++)if(t[i]==="\\")i++;else if(t[i]===e[0])n++;else if(t[i]===e[1]&&(n--,n<0))return i;return-1}function wI(t,e,n,i){const r=e.href,s=e.title?qr(e.title):null,a=t[1].replace(/\\([\[\]])/g,"$1");if(t[0].charAt(0)!=="!"){i.state.inLink=!0;const o={type:"link",raw:n,href:r,title:s,text:a,tokens:i.inlineTokens(a)};return i.state.inLink=!1,o}return{type:"image",raw:n,href:r,title:s,text:qr(a)}}function oJ(t,e){const n=t.match(/^(\s+)(?:```)/);if(n===null)return e;const i=n[1];return e.split(`
1
+ "use strict";var JW=Object.defineProperty;var CN=t=>{throw TypeError(t)};var ZW=(t,e,n)=>e in t?JW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Y=(t,e,n)=>ZW(t,typeof e!="symbol"?e+"":e,n),mv=(t,e,n)=>e.has(t)||CN("Cannot "+n);var Ni=(t,e,n)=>(mv(t,e,"read from private field"),n?n.call(t):e.get(t)),Nc=(t,e,n)=>e.has(t)?CN("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),gv=(t,e,n,i)=>(mv(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),Ps=(t,e,n)=>(mv(t,e,"access private method"),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("react/jsx-runtime"),E=require("react"),Yl=require("react-dnd"),eY=require("react-dnd-html5-backend"),It=require("react-i18next"),k=require("@mui/material"),s9=require("react-dom/client"),Q=require("@mui/icons-material"),fe=require("@mui/material/styles"),Ou=require("react-dom"),tY=require("react-dom/server"),Zc=require("i18next");var nY=Object.defineProperty,iY=(t,e,n)=>e in t?nY(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,xg=(t,e,n)=>iY(t,typeof e!="symbol"?e+"":e,n);const rY={stringify:t=>t?"true":"false",parse:t=>/^[ty1-9]/i.test(t)},sY={stringify:t=>t.name,parse:(t,e,n)=>{const i=(()=>{if(typeof window<"u"&&t in window)return window[t];if(typeof global<"u"&&t in global)return global[t]})();return typeof i=="function"?i.bind(n):void 0}},aY={stringify:t=>JSON.stringify(t),parse:t=>JSON.parse(t)};function oY(t){return t.replace(/([a-z0-9])([A-Z])/g,(e,n,i)=>`${n}-${i.toLowerCase()}`)}function a9(t){return t.replace(/[-:]([a-z])/g,(e,n)=>`${n.toUpperCase()}`)}const lY={stringify:t=>t.name,parse:(t,e,n)=>{const i=(()=>{const r=a9(e);if(typeof n<"u"&&r in n.container)return n.container[r]})();return typeof i=="function"?i.bind(n):void 0}},cY={stringify:t=>`${t}`,parse:t=>parseFloat(t)},uY={stringify:t=>t,parse:t=>t},_v={string:uY,number:cY,boolean:rY,function:sY,method:lY,json:aY},gp=Symbol.for("r2wc.render"),kg=Symbol.for("r2wc.connected"),Ic=Symbol.for("r2wc.context"),Ur=Symbol.for("r2wc.props");function o9(t,e,n){var i,r,s;e.props||(e.props=t.propTypes?Object.keys(t.propTypes):[]),e.events||(e.events=[]);const a=Array.isArray(e.props)?e.props.slice():Object.keys(e.props),o=Array.isArray(e.events)?e.events.slice():Object.keys(e.events),l={},c={},u={},d={};for(const p of a){l[p]=Array.isArray(e.props)?"string":e.props[p];const m=oY(p);u[p]=m,d[m]=p}for(const p of o)c[p]=Array.isArray(e.events)?{}:e.events[p];class f extends HTMLElement{constructor(){super(),xg(this,s,!0),xg(this,r),xg(this,i,{}),xg(this,"container"),e.shadow?this.container=this.attachShadow({mode:e.shadow}):this.container=this,this[Ur].container=this.container;for(const m of a){const _=u[m],g=this.getAttribute(_),b=l[m],y=b?_v[b]:null;if(b==="method"){const v=a9(_);Object.defineProperty(this[Ur].container,v,{enumerable:!0,configurable:!0,get(){return this[Ur][v]},set(T){this[Ur][v]=T,this[gp]()}}),this[Ur][m]=y.parse(g,_,this)}y!=null&&y.parse&&g&&(this[Ur][m]=y.parse(g,_,this))}for(const m of o)this[Ur][m]=_=>{const g=m.replace(/^on/,"").toLowerCase();this.dispatchEvent(new CustomEvent(g,{detail:_,...c[m]}))}}static get observedAttributes(){return Object.keys(d)}connectedCallback(){this[kg]=!0,this[gp]()}disconnectedCallback(){this[kg]=!1,this[Ic]&&n.unmount(this[Ic]),delete this[Ic]}attributeChangedCallback(m,_,g){const b=d[m],y=l[b],v=y?_v[y]:null;b in l&&v!=null&&v.parse&&g&&(this[Ur][b]=v.parse(g,m,this),this[gp]())}[(s=kg,r=Ic,i=Ur,gp)](){this[kg]&&(this[Ic]?n.update(this[Ic],this[Ur]):this[Ic]=n.mount(this.container,t,this[Ur]))}}for(const p of a){const m=u[p],_=l[p];Object.defineProperty(f.prototype,p,{enumerable:!0,configurable:!0,get(){return this[Ur][p]},set(g){this[Ur][p]=g;const b=_?_v[_]:null;if(b!=null&&b.stringify){const y=b.stringify(g,m,this);this.getAttribute(m)!==y&&this.setAttribute(m,y)}else this[gp]()}})}return f}function dY(t,e,n){const i=s9.createRoot(t),r=E.createElement(e,n);return i.render(r),{root:i,ReactComponent:e}}function fY({root:t,ReactComponent:e},n){const i=E.createElement(e,n);t.render(i)}function pY({root:t}){t.unmount()}function hY(t,e={}){return o9(t,e,{mount:dY,update:fY,unmount:pY})}const mY={},xN=t=>{let e;const n=new Set,i=(u,d)=>{const f=typeof u=="function"?u(e):u;if(!Object.is(f,e)){const p=e;e=d??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(m=>m(e,p))}},r=()=>e,l={setState:i,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(mY?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=e=t(i,r,l);return l},l9=t=>t?xN(t):xN;var Ml=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Pm(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var bv={exports:{}},yv={},Ev={exports:{}},vv={};var kN;function gY(){if(kN)return vv;kN=1;var t=E;function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:e,i=t.useState,r=t.useEffect,s=t.useLayoutEffect,a=t.useDebugValue;function o(d,f){var p=f(),m=i({inst:{value:p,getSnapshot:f}}),_=m[0].inst,g=m[1];return s(function(){_.value=p,_.getSnapshot=f,l(_)&&g({inst:_})},[d,p,f]),r(function(){return l(_)&&g({inst:_}),d(function(){l(_)&&g({inst:_})})},[d]),a(p),p}function l(d){var f=d.getSnapshot;d=d.value;try{var p=f();return!n(d,p)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:o;return vv.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,vv}var wN;function c9(){return wN||(wN=1,Ev.exports=gY()),Ev.exports}var AN;function _Y(){if(AN)return yv;AN=1;var t=E,e=c9();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var i=typeof Object.is=="function"?Object.is:n,r=e.useSyncExternalStore,s=t.useRef,a=t.useEffect,o=t.useMemo,l=t.useDebugValue;return yv.useSyncExternalStoreWithSelector=function(c,u,d,f,p){var m=s(null);if(m.current===null){var _={hasValue:!1,value:null};m.current=_}else _=m.current;m=o(function(){function b(w){if(!y){if(y=!0,v=w,w=f(w),p!==void 0&&_.hasValue){var I=_.value;if(p(I,w))return T=I}return T=w}if(I=T,i(v,w))return I;var A=f(w);return p!==void 0&&p(I,A)?(v=w,I):(v=w,T=A)}var y=!1,v,T,x=d===void 0?null:d;return[function(){return b(u())},x===null?void 0:function(){return b(x())}]},[u,d,f,p]);var g=r(c,m[0],m[1]);return a(function(){_.hasValue=!0,_.value=g},[g]),l(g),g},yv}var DN;function bY(){return DN||(DN=1,bv.exports=_Y()),bv.exports}var u9=bY();const yY=Pm(u9),d9={},{useDebugValue:EY}=E,{useSyncExternalStoreWithSelector:vY}=yY;let NN=!1;const SY=t=>t;function TY(t,e=SY,n){(d9?"production":void 0)!=="production"&&n&&!NN&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),NN=!0);const i=vY(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return EY(i),i}const IN=t=>{(d9?"production":void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof t=="function"?l9(t):t,n=(i,r)=>TY(e,i,r);return Object.assign(n,e),n},f9=t=>t?IN(t):IN,Gd=600,vx=370,pl="50px",CY=["#DC2626","#EF4444","#F87171","#EC4899","#BE185D","#7C2D12","#EA580C","#F97316","#FBBF24","#D97706","#A16207","#92400E","#059669","#10B981","#22C55E","#65A30D","#166534","#064E3B","#2563EB","#3B82F6","#60A5FA","#0EA5E9","#0891B2","#1E40AF","#7C3AED","#A855F7","#FFFFFF","#000000","#F9FAFB","#111827","","","","",""],xY={root:{type:"EmailLayout",data:{backdropColor:"#F5F5F5",canvasColor:"#FFFFFF",textColor:"#262626",fontFamily:"MODERN_SANS",linkGlobal:{linkColor:"#2563EB",underline:!0},childrenIds:["block-1770848212159"],showVersion:!0}},"block-1770848212159":{type:"NotionText",data:{props:{html:'<p>Double-click to edit then type "/" for commands...</p>'},style:{padding:{top:16,bottom:16,left:24,right:24},mobilePadding:null,fontSize:16,fontWeight:"normal",color:null,backgroundColor:null,textAlign:"left"}}}},ub=["Spacer","Divider","Container",null],Kl=f9(()=>({stackUndo:[],stackRedo:[],pendingUndoTimeout:null,pendingOriginalDocument:null,lastChange:null}));function kY(){return Kl(t=>t.stackUndo.length>0||t.pendingOriginalDocument!==null)}function wY(){return Kl(t=>t.stackRedo.length>0)}function p9(){return Kl.getState()}function Ky(){return Kl.getState().stackUndo}function h9(){return Kl.getState().stackRedo}function jc(t){Kl.setState(t)}function AY(){const{pendingUndoTimeout:t}=Kl.getState();t&&clearTimeout(t),Kl.setState({stackUndo:[],stackRedo:[],pendingUndoTimeout:null,pendingOriginalDocument:null,lastChange:null})}function Qd(t){const e={...t};for(const[n,i]of Object.entries(e))(i.type==="CustomEditor"||i.type==="Wysiwyg")&&(e[n]={...i,type:"NotionText"});return e}const db=385,qh="https://maildrill.s3.eu-south-1.amazonaws.com/assets/emailbuilder-placeholder.jpg";let Sv=null;const DY=2e3;function Fm(){Sv&&clearTimeout(Sv),Sv=setTimeout(()=>{const t=new CustomEvent("email-builder-auto-save",{detail:!0});window.dispatchEvent(t)},DY)}const m9=()=>({document:Qd(JSON.parse(JSON.stringify(xY))),selectedBlockId:null,selectedSidebarTab:"styles",selectedMainTab:"editor",selectedScreenSize:"desktop",windowWidth:0,inspectorDrawerOpen:!0,componentTreeOpen:!1,samplesDrawerOpen:!0,inspectorDrawerWidth:db,devMode:!1,imageUploading:{uploading:!1,id:""},disableEdition:!1,disableUpdate:!1,freeMode:!1,minHeight:"calc(100dvh - 65px)",color:{primary:"",secondary:""},galleryImages:!0,imagePlaceholder:qh,darkMode:!0,colorPicker:{paletteColors:CY,isLocked:!1},tour:!1,stickyHeader:!0,heightContent:"calc(100dvh - 50px)",containerGrow:!0,wysiwygInlineEditingBlockId:null,notionTextInlineEditingBlockId:null,highlightColor:"#FF6B35"}),ye=f9(()=>m9()),NY=t=>{const e=m9();return l9(()=>({...e,...t,document:e.document}))},IY=E.createContext(ye),OY=({store:t=ye,children:e})=>h.jsx(IY.Provider,{value:t,children:e});function g9(){const t=ye(e=>e.document[ye(n=>n.selectedBlockId)||""]);return t?t.type:null}function ON(t){return ye.setState({windowWidth:t})}function RY(){return ye(t=>t.devMode)}function MY(t){return ye.setState({devMode:t})}function Gw(){return ye(t=>t.document)}function _9(t){return ye(e=>e.document[t])}function LY(t){return ye(e=>e.document[t]?.type)}function PY(t){return ye(e=>e.selectedBlockId===t)}function uc(){return ye(t=>t.selectedBlockId)}function Bm(){return ye(t=>t.wysiwygInlineEditingBlockId)}function RN(t){return ye.setState({wysiwygInlineEditingBlockId:t})}function Um(){return ye(t=>t.notionTextInlineEditingBlockId)}function MN(t){return ye.setState({notionTextInlineEditingBlockId:t})}function FY(){const t=Um(),e=Bm();return!!(t||e)}function BY(){const t=Um(),e=Bm();return t||e}function UY(){return ye(t=>t.highlightColor)}function Vn(){return ye(t=>t.selectedScreenSize)}function Qy(){return ye(t=>t.selectedMainTab)}function wg(t){return t==="preview"&&Kr(null),ye.setState({inspectorDrawerOpen:t==="editor"}),ye.setState({selectedMainTab:t})}function Za(){return ye(t=>t.selectedSidebarTab)}function $Y(){return ye(t=>t.inspectorDrawerOpen)}function jw(){return ye(t=>t.componentTreeOpen)}function Sx(){ye.setState(t=>({componentTreeOpen:!t.componentTreeOpen}))}function Xy(){return ye(t=>t.imageUploading)}function qY(){return ye(t=>t.disableEdition)}function Kr(t){hf();const e=ye.getState().document[t||""]?.type,n=ub.includes(e||null)?"styles":"block-configuration",i={};return t!==null&&ye.getState().selectedMainTab==="editor"&&(i.inspectorDrawerOpen=!0),ye.setState({selectedBlockId:t,selectedSidebarTab:n,...i})}function zY(t){return ye.setState({selectedSidebarTab:t})}function jd(t){const e=ye.getState().document,n=Qd(t);return $m(e,n),AY(),ye.setState({document:n,selectedSidebarTab:"styles",selectedBlockId:null})}const Tx=(t,e,n=5,i=0)=>{if(t===e)return!0;if(t===null||e===null||t===void 0||e===void 0)return t===e;if(typeof t!=typeof e)return!1;if(typeof t!="object")return t===e;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let a=0;a<t.length;a++)if(i<n){if(!Tx(t[a],e[a],n,i+1))return!1}else if(t[a]!==e[a])return!1;return!0}if(i>=n)try{return JSON.stringify(t)===JSON.stringify(e)}catch{return!1}const r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length)return!1;for(const a of r){if(!s.includes(a))return!1;const o=t[a],l=e[a];if(!Tx(o,l,n,i+1))return!1}return!0},GY=1e3;let Hc=null,Xd=null,Jd=null;function b9(t){const e=ye.getState().document;$m(e,t)}function $m(t,e){Jd=t,Xd=e,Hc&&clearTimeout(Hc),Hc=setTimeout(()=>{y9(Jd,Xd),Hc=null,Xd=null,Jd=null},GY)}function hf(){Hc&&(clearTimeout(Hc),Hc=null),Xd&&Jd&&(y9(Jd,Xd),Xd=null,Jd=null);const{pendingUndoTimeout:t,pendingOriginalDocument:e}=p9();if(t&&(clearTimeout(t),e)){const n=[...Ky()];jc({stackUndo:[...n,JSON.stringify(e)],pendingOriginalDocument:null,pendingUndoTimeout:null,lastChange:null})}}function y9(t,e){const{pendingUndoTimeout:r,pendingOriginalDocument:s,lastChange:a}=p9();let o=!0,l=null;const c=(p,m)=>{if(p?.type==="Image"&&m?.type==="Image"){const _=p.data.props?.width,g=m.data.props?.width;return _==null&&typeof g=="number"}return!1};if(t===e)return null;const u=Object.keys(t),d=Object.keys(e);if(u.length!==d.length)l=d.find(p=>!t[p])||u.find(p=>!e[p])||null;else for(const p of d){const m=t[p],_=e[p];if(m!==_){if(m&&_&&c(m,_)){o=!1;break}if(!Tx(m,_)){l=p;break}}}if(o&&l!==null){const p=Date.now(),m=[...Ky()];if(m.length>=50&&m.shift(),l)if(a&&a.blockId===l&&p-a.timestamp<400){r&&clearTimeout(r);const _=setTimeout(()=>{jc({stackUndo:[...m,JSON.stringify(s)],pendingOriginalDocument:null,pendingUndoTimeout:null,lastChange:null,stackRedo:[]})},400);jc({pendingUndoTimeout:_,stackRedo:[],lastChange:{blockId:l,timestamp:p}})}else{r&&clearTimeout(r);const _=setTimeout(()=>{jc({stackUndo:[...m,JSON.stringify(t)],stackRedo:[],pendingOriginalDocument:null,pendingUndoTimeout:null,lastChange:null})},400);jc({pendingOriginalDocument:t,pendingUndoTimeout:_,stackRedo:[],lastChange:{blockId:l,timestamp:p}})}}return null}function qm(t,e=!0){const n=ye.getState().document,i={...n,...t},r=()=>{ye.setState({document:i}),e&&Promise.resolve().then(()=>{$m(n,i)}),Fm();const s=new CustomEvent("email-builder-auto-save",{detail:e});window.dispatchEvent(s)};return e?(E.startTransition(r),ye.getState()):r()}function fb(t){return ye.setState({selectedScreenSize:t})}function Zd(t,e){return ye.setState({imageUploading:{uploading:t,id:e||""}})}function E9(t){return ye.setState({disableEdition:t})}function jY(){return ye.getState().document.root.data}function Ru(){return ye(t=>t.document?.root?.data)}function LN(){hf();const t=ye.getState().document,e=Ky(),n=h9();if(e.length===0)return;const i=[...e],r=i.pop();if(!r)return;const s=ye.getState().selectedBlockId,a=JSON.parse(r);jc({stackUndo:i,stackRedo:[...n,JSON.stringify(t)]}),a.root.data.childrenIds.includes(s)||Kr(null),ye.setState({document:a})}function PN(){hf();const t=ye.getState().document,e=Ky(),n=h9();if(n.length===0)return;const i=[...n],r=i.pop();if(!r)return;const s=ye.getState().selectedBlockId,a=JSON.parse(r);jc({stackUndo:[...e,JSON.stringify(t)],stackRedo:i}),a?.root?.data?.childrenIds?.includes(s)||Kr(null),ye.setState({document:a})}function HY(t){return ye.setState({color:t})}function VY(t){return ye.setState({galleryImages:t})}function v9(){return ye.getState().galleryImages}function WY(t){return ye.setState({imagePlaceholder:t})}function YY(){return ye.getState().imagePlaceholder}function KY(t){return ye.setState({freeMode:t})}function Wf(){return ye.getState().freeMode}function QY(t){return ye.setState({darkMode:t})}function XY(t){return ye.setState({heightContent:t})}function JY(t){return ye.setState({containerGrow:t})}function ZY(){return ye.getState().containerGrow}function zh(t,e,n,i=!0){Mu({draggedId:e,targetId:t})&&console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");const r=ye.getState().document,s=JSON.parse(JSON.stringify({...r})),a=u=>{if(!u||t===e)return u;const d=u.indexOf(e);return d<0?u:u.toSpliced(d,1)},o=u=>{if(!u||t===e)return u;const d=u.indexOf(t);if(d<0)return u;const f=n==="up"?d:d+1;return u.toSpliced(f,0,e)};let l=null,c=null;for(const[u,d]of Object.entries(s)){const f=d;if(c)break;switch(f.type){case"EmailLayout":f.data.childrenIds?.length&&f.data.childrenIds.includes(e)&&(c=u,s[u]={...f,data:{...f.data,childrenIds:a(f.data.childrenIds)}});break;case"Container":f.data.props?.childrenIds?.length&&f.data.props.childrenIds.includes(e)&&(c=u,s[u]={...f,data:{...f.data,props:{...f.data.props,childrenIds:a(f.data.props.childrenIds)}}});break;case"ColumnsContainer":if(f.data.props?.columns){let p=!1;const m=f.data.props.columns.map((_,g)=>_?.childrenIds?.includes(e)?(c=`${u}-column-${g}`,p=!0,{..._,childrenIds:a(_.childrenIds)}):_);p&&(s[u]={...f,data:{...f.data,props:{...f.data.props,columns:m}}})}break}}if(l=null,i)for(const[u,d]of Object.entries(s)){const f=d;if(l)break;switch(f.type){case"EmailLayout":f.data.childrenIds?.length&&f.data.childrenIds.includes(t)&&(l=u,s[u]={...f,data:{...f.data,childrenIds:o(f.data.childrenIds)}});break;case"Container":f.data.props?.childrenIds?.length&&f.data.props.childrenIds.includes(t)&&(l=u,s[u]={...f,data:{...f.data,props:{...f.data.props,childrenIds:o(f.data.props.childrenIds)}}});break;case"ColumnsContainer":if(f.data.props?.columns){const p=f.data.props.columns.map((m,_)=>m?.childrenIds?.includes(t)?(l=`${u}-column-${_}`,{...m,childrenIds:o(m.childrenIds)}):m);s[u]={...f,data:{...f.data,props:{...f.data.props,columns:p}}}}break}}return qm(s)}function eK({parentId:t,blockId:e,indexArray:n}){if(Mu({draggedId:e,targetId:t})){console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");return}zh("",e,"down",!1);const i=ye.getState().document,r=JSON.parse(JSON.stringify({...i}));if(!r[t])return;const s=r[t],a=[...s.data.props.columns||[]];return a[n||0]={childrenIds:[e]},r[t]={type:"ColumnsContainer",data:{...s.data,props:{...s.data.props,columns:a}}},qm(r)}function tK({parentId:t,blockId:e}){if(Mu({draggedId:e,targetId:t})){console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");return}zh("",e,"down",!1);const n=ye.getState().document,i=JSON.parse(JSON.stringify({...n}));if(!i[t])return;const r=i[t];return i[t]={type:"Container",data:{...r.data,props:{...r.data.props,childrenIds:[e]}}},qm(i)}function Mu({draggedId:t,targetId:e}){if(t===e)return!0;const n=ye.getState().document;function i(r,s){const a=n[r];if(!a)return!1;let o=[];switch(a.type){case"EmailLayout":o=a.data.childrenIds||[];break;case"Container":o=a.data.props?.childrenIds||[];break;case"ColumnsContainer":a.data.props?.columns&&a.data.props.columns.forEach(l=>{l?.childrenIds&&(o=[...o,...l.childrenIds])});break}if(o.includes(s))return!0;for(const l of o)if(i(l,s))return!0;return!1}return i(t,e)}function nK(){return ye(t=>t.colorPicker)}function Tv(t){ye.setState(e=>({colorPicker:{...e.colorPicker,...t}}))}function S9(t,e){const n=ye.getState().document,i=n[t];if(!i){console.warn(`Block ${t} not found`);return}const r=e(i);if(i===r)return;const s={...n,[t]:r},a=n;E.startTransition(()=>{ye.setState({document:s}),Promise.resolve().then(()=>{$m(a,s)})}),Fm()}function iK(t,e){const n=ye.getState().document,i=n[t];if(!i){console.warn(`Block ${t} not found`);return}const r=e(i);if(i===r)return;const s={...n,[t]:r},a=n;ye.setState({document:s}),Promise.resolve().then(()=>{$m(a,s)}),Fm()}function T9(t,e){S9(t,n=>{const i=typeof e=="function"?e(n.data.props):{...n.data.props,...e};return{...n,data:{...n.data,props:i}}})}function Cx(t,e){iK(t,n=>{const i=typeof e=="function"?e(n.data.props):{...n.data.props,...e};return{...n,data:{...n.data,props:i}}})}function xx(t,e,n,i){ye.setState(s=>{const a=s.document,o=a[t];if(!o)return s;const l=o.type==="EmailLayout"?{...o,data:{...o.data,childrenIds:i}}:{...o,data:{...o.data,props:{...o.data?.props,childrenIds:i}}};return{...s,document:{...a,[e]:n,[t]:l}}});const r=ye.getState().document;E.startTransition(()=>{Promise.resolve().then(()=>b9(r))}),Fm()}function rK(t){ye.setState(n=>({...n,document:{...n.document,...t}}));const e=ye.getState().document;E.startTransition(()=>{Promise.resolve().then(()=>b9(e))}),Fm()}function Ql(t,e){S9(t,e)}function C9(t,e){Ql(t,n=>{const i=n.data?.props||{},r=typeof e=="function"?e(i):{...i,...e};return i===r?n:{...n,data:{...n.data,props:r}}})}function sK(t,e,n){Ql(t,i=>i.data?.props?.[e]===n?i:{...i,data:{...i.data,props:{...i.data.props,[e]:n}}})}function x9(t,e){Ql(t,n=>{const i=n.data?.style||{},r=typeof e=="function"?e(i):{...i,...e};return i===r?n:{...n,data:{...n.data,style:r}}})}function aK(t,e,n){Ql(t,i=>i.data?.style?.[e]===n?i:{...i,data:{...i.data,style:{...i.data.style,[e]:n}}})}function oK(t,e){C9(t,n=>({...n,...e}))}function lK(t,e){x9(t,n=>({...n,...e}))}var qt;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function n(r){throw new Error}t.assertNever=n,t.arrayToEnum=r=>{const s={};for(const a of r)s[a]=a;return s},t.getValidEnumValues=r=>{const s=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),a={};for(const o of s)a[o]=r[o];return t.objectValues(a)},t.objectValues=r=>t.objectKeys(r).map(function(s){return r[s]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const s=[];for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&s.push(a);return s},t.find=(r,s)=>{for(const a of r)if(s(a))return a},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,s=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}t.joinValues=i,t.jsonStringifyReplacer=(r,s)=>typeof s=="bigint"?s.toString():s})(qt||(qt={}));var kx;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(kx||(kx={}));const Ge=qt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ko=t=>{switch(typeof t){case"undefined":return Ge.undefined;case"string":return Ge.string;case"number":return Number.isNaN(t)?Ge.nan:Ge.number;case"boolean":return Ge.boolean;case"function":return Ge.function;case"bigint":return Ge.bigint;case"symbol":return Ge.symbol;case"object":return Array.isArray(t)?Ge.array:t===null?Ge.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ge.promise:typeof Map<"u"&&t instanceof Map?Ge.map:typeof Set<"u"&&t instanceof Set?Ge.set:typeof Date<"u"&&t instanceof Date?Ge.date:Ge.object;default:return Ge.unknown}},Ce=qt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),cK=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class Hr extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(s){return s.message},i={_errors:[]},r=s=>{for(const a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)i._errors.push(n(a));else{let o=i,l=0;for(;l<a.path.length;){const c=a.path[l];l===a.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(n(a))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return r(this),i}static assert(e){if(!(e instanceof Hr))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,qt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},i=[];for(const r of this.issues)if(r.path.length>0){const s=r.path[0];n[s]=n[s]||[],n[s].push(e(r))}else i.push(e(r));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}}Hr.create=t=>new Hr(t);const mf=(t,e)=>{let n;switch(t.code){case Ce.invalid_type:t.received===Ge.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case Ce.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,qt.jsonStringifyReplacer)}`;break;case Ce.unrecognized_keys:n=`Unrecognized key(s) in object: ${qt.joinValues(t.keys,", ")}`;break;case Ce.invalid_union:n="Invalid input";break;case Ce.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${qt.joinValues(t.options)}`;break;case Ce.invalid_enum_value:n=`Invalid enum value. Expected ${qt.joinValues(t.options)}, received '${t.received}'`;break;case Ce.invalid_arguments:n="Invalid function arguments";break;case Ce.invalid_return_type:n="Invalid function return type";break;case Ce.invalid_date:n="Invalid date";break;case Ce.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:qt.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case Ce.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case Ce.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case Ce.custom:n="Invalid input";break;case Ce.invalid_intersection_types:n="Intersection results could not be merged";break;case Ce.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case Ce.not_finite:n="Number must be finite";break;default:n=e.defaultError,qt.assertNever(t)}return{message:n}};let k9=mf;function uK(t){k9=t}function pb(){return k9}const hb=t=>{const{data:e,path:n,errorMaps:i,issueData:r}=t,s=[...n,...r.path||[]],a={...r,path:s};if(r.message!==void 0)return{...r,path:s,message:r.message};let o="";const l=i.filter(c=>!!c).slice().reverse();for(const c of l)o=c(a,{data:e,defaultError:o}).message;return{...r,path:s,message:o}},dK=[];function Fe(t,e){const n=pb(),i=hb({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===mf?void 0:mf].filter(r=>!!r)});t.common.issues.push(i)}class er{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const i=[];for(const r of n){if(r.status==="aborted")return ct;r.status==="dirty"&&e.dirty(),i.push(r.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,n){const i=[];for(const r of n){const s=await r.key,a=await r.value;i.push({key:s,value:a})}return er.mergeObjectSync(e,i)}static mergeObjectSync(e,n){const i={};for(const r of n){const{key:s,value:a}=r;if(s.status==="aborted"||a.status==="aborted")return ct;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||r.alwaysSet)&&(i[s.value]=a.value)}return{status:e.value,value:i}}}const ct=Object.freeze({status:"aborted"}),Hd=t=>({status:"dirty",value:t}),gr=t=>({status:"valid",value:t}),wx=t=>t.status==="aborted",Ax=t=>t.status==="dirty",du=t=>t.status==="valid",Gh=t=>typeof Promise<"u"&&t instanceof Promise;var Ke;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Ke||(Ke={}));class za{constructor(e,n,i,r){this._cachedPath=[],this.parent=e,this.data=n,this._path=i,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const FN=(t,e)=>{if(du(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Hr(t.common.issues);return this._error=n,this._error}}};function St(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:i,description:r}=t;if(e&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(a,o)=>{const{message:l}=t;return a.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??i??o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:l??n??o.defaultError}},description:r}}class Nt{get description(){return this._def.description}_getType(e){return ko(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:ko(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new er,ctx:{common:e.parent.common,data:e.data,parsedType:ko(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Gh(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const i=this.safeParse(e,n);if(i.success)return i.data;throw i.error}safeParse(e,n){const i={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ko(e)},r=this._parseSync({data:e,path:i.path,parent:i});return FN(i,r)}"~validate"(e){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ko(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return du(i)?{value:i.value}:{issues:n.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>du(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const i=await this.safeParseAsync(e,n);if(i.success)return i.data;throw i.error}async safeParseAsync(e,n){const i={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ko(e)},r=this._parse({data:e,path:i.path,parent:i}),s=await(Gh(r)?r:Promise.resolve(r));return FN(i,s)}refine(e,n){const i=r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,s)=>{const a=e(r),o=()=>s.addIssue({code:Ce.custom,...i(r)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,n){return this._refinement((i,r)=>e(i)?!0:(r.addIssue(typeof n=="function"?n(i,r):n),!1))}_refinement(e){return new ta({schema:this,typeName:ft.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return La.create(this,this._def)}nullable(){return ec.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ks.create(this)}promise(){return _f.create(this,this._def)}or(e){return Wh.create([this,e],this._def)}and(e){return Yh.create(this,e,this._def)}transform(e){return new ta({...St(this._def),schema:this,typeName:ft.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Zh({...St(this._def),innerType:this,defaultValue:n,typeName:ft.ZodDefault})}brand(){return new Hw({typeName:ft.ZodBranded,type:this,...St(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new em({...St(this._def),innerType:this,catchValue:n,typeName:ft.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return zm.create(this,e)}readonly(){return tm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const fK=/^c[^\s-]{8,}$/i,pK=/^[0-9a-z]+$/,hK=/^[0-9A-HJKMNP-TV-Z]{26}$/i,mK=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,gK=/^[a-z0-9_-]{21}$/i,_K=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,bK=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,yK=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,EK="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Cv;const vK=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,SK=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,TK=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,CK=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,xK=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,kK=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,w9="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",wK=new RegExp(`^${w9}$`);function A9(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function AK(t){return new RegExp(`^${A9(t)}$`)}function D9(t){let e=`${w9}T${A9(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function DK(t,e){return!!((e==="v4"||!e)&&vK.test(t)||(e==="v6"||!e)&&TK.test(t))}function NK(t,e){if(!_K.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const i=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function IK(t,e){return!!((e==="v4"||!e)&&SK.test(t)||(e==="v6"||!e)&&CK.test(t))}class js extends Nt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ge.string){const s=this._getOrReturnCtx(e);return Fe(s,{code:Ce.invalid_type,expected:Ge.string,received:s.parsedType}),ct}const i=new er;let r;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="max")e.data.length>s.value&&(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,o=e.data.length<s.value;(a||o)&&(r=this._getOrReturnCtx(e,r),a?Fe(r,{code:Ce.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&Fe(r,{code:Ce.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),i.dirty())}else if(s.kind==="email")yK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"email",code:Ce.invalid_string,message:s.message}),i.dirty());else if(s.kind==="emoji")Cv||(Cv=new RegExp(EK,"u")),Cv.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"emoji",code:Ce.invalid_string,message:s.message}),i.dirty());else if(s.kind==="uuid")mK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"uuid",code:Ce.invalid_string,message:s.message}),i.dirty());else if(s.kind==="nanoid")gK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"nanoid",code:Ce.invalid_string,message:s.message}),i.dirty());else if(s.kind==="cuid")fK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"cuid",code:Ce.invalid_string,message:s.message}),i.dirty());else if(s.kind==="cuid2")pK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"cuid2",code:Ce.invalid_string,message:s.message}),i.dirty());else if(s.kind==="ulid")hK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"ulid",code:Ce.invalid_string,message:s.message}),i.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),Fe(r,{validation:"url",code:Ce.invalid_string,message:s.message}),i.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"regex",code:Ce.invalid_string,message:s.message}),i.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),i.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.invalid_string,validation:{startsWith:s.value},message:s.message}),i.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.invalid_string,validation:{endsWith:s.value},message:s.message}),i.dirty()):s.kind==="datetime"?D9(s).test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.invalid_string,validation:"datetime",message:s.message}),i.dirty()):s.kind==="date"?wK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.invalid_string,validation:"date",message:s.message}),i.dirty()):s.kind==="time"?AK(s).test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.invalid_string,validation:"time",message:s.message}),i.dirty()):s.kind==="duration"?bK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"duration",code:Ce.invalid_string,message:s.message}),i.dirty()):s.kind==="ip"?DK(e.data,s.version)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"ip",code:Ce.invalid_string,message:s.message}),i.dirty()):s.kind==="jwt"?NK(e.data,s.alg)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"jwt",code:Ce.invalid_string,message:s.message}),i.dirty()):s.kind==="cidr"?IK(e.data,s.version)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"cidr",code:Ce.invalid_string,message:s.message}),i.dirty()):s.kind==="base64"?xK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"base64",code:Ce.invalid_string,message:s.message}),i.dirty()):s.kind==="base64url"?kK.test(e.data)||(r=this._getOrReturnCtx(e,r),Fe(r,{validation:"base64url",code:Ce.invalid_string,message:s.message}),i.dirty()):qt.assertNever(s);return{status:i.value,value:e.data}}_regex(e,n,i){return this.refinement(r=>e.test(r),{validation:n,code:Ce.invalid_string,...Ke.errToObj(i)})}_addCheck(e){return new js({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ke.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ke.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ke.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ke.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ke.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ke.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ke.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ke.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ke.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ke.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ke.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ke.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ke.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Ke.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Ke.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Ke.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Ke.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...Ke.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Ke.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Ke.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Ke.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Ke.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Ke.errToObj(n)})}nonempty(e){return this.min(1,Ke.errToObj(e))}trim(){return new js({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new js({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new js({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}js.create=t=>new js({checks:[],typeName:ft.ZodString,coerce:t?.coerce??!1,...St(t)});function OK(t,e){const n=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,r=n>i?n:i,s=Number.parseInt(t.toFixed(r).replace(".","")),a=Number.parseInt(e.toFixed(r).replace(".",""));return s%a/10**r}class Xl extends Nt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ge.number){const s=this._getOrReturnCtx(e);return Fe(s,{code:Ce.invalid_type,expected:Ge.number,received:s.parsedType}),ct}let i;const r=new er;for(const s of this._def.checks)s.kind==="int"?qt.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),Fe(i,{code:Ce.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(i=this._getOrReturnCtx(e,i),Fe(i,{code:Ce.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(i=this._getOrReturnCtx(e,i),Fe(i,{code:Ce.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?OK(e.data,s.value)!==0&&(i=this._getOrReturnCtx(e,i),Fe(i,{code:Ce.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),Fe(i,{code:Ce.not_finite,message:s.message}),r.dirty()):qt.assertNever(s);return{status:r.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Ke.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ke.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ke.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ke.toString(n))}setLimit(e,n,i,r){return new Xl({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:Ke.toString(r)}]})}_addCheck(e){return new Xl({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ke.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ke.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ke.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ke.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ke.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ke.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Ke.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ke.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ke.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&qt.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Xl.create=t=>new Xl({checks:[],typeName:ft.ZodNumber,coerce:t?.coerce||!1,...St(t)});class Jl extends Nt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Ge.bigint)return this._getInvalidInput(e);let i;const r=new er;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(i=this._getOrReturnCtx(e,i),Fe(i,{code:Ce.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(i=this._getOrReturnCtx(e,i),Fe(i,{code:Ce.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),Fe(i,{code:Ce.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):qt.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return Fe(n,{code:Ce.invalid_type,expected:Ge.bigint,received:n.parsedType}),ct}gte(e,n){return this.setLimit("min",e,!0,Ke.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ke.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ke.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ke.toString(n))}setLimit(e,n,i,r){return new Jl({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:Ke.toString(r)}]})}_addCheck(e){return new Jl({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ke.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ke.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ke.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ke.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ke.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Jl.create=t=>new Jl({checks:[],typeName:ft.ZodBigInt,coerce:t?.coerce??!1,...St(t)});class jh extends Nt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ge.boolean){const i=this._getOrReturnCtx(e);return Fe(i,{code:Ce.invalid_type,expected:Ge.boolean,received:i.parsedType}),ct}return gr(e.data)}}jh.create=t=>new jh({typeName:ft.ZodBoolean,coerce:t?.coerce||!1,...St(t)});class fu extends Nt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ge.date){const s=this._getOrReturnCtx(e);return Fe(s,{code:Ce.invalid_type,expected:Ge.date,received:s.parsedType}),ct}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return Fe(s,{code:Ce.invalid_date}),ct}const i=new er;let r;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),i.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(r=this._getOrReturnCtx(e,r),Fe(r,{code:Ce.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),i.dirty()):qt.assertNever(s);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new fu({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Ke.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Ke.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}fu.create=t=>new fu({checks:[],coerce:t?.coerce||!1,typeName:ft.ZodDate,...St(t)});class mb extends Nt{_parse(e){if(this._getType(e)!==Ge.symbol){const i=this._getOrReturnCtx(e);return Fe(i,{code:Ce.invalid_type,expected:Ge.symbol,received:i.parsedType}),ct}return gr(e.data)}}mb.create=t=>new mb({typeName:ft.ZodSymbol,...St(t)});class Hh extends Nt{_parse(e){if(this._getType(e)!==Ge.undefined){const i=this._getOrReturnCtx(e);return Fe(i,{code:Ce.invalid_type,expected:Ge.undefined,received:i.parsedType}),ct}return gr(e.data)}}Hh.create=t=>new Hh({typeName:ft.ZodUndefined,...St(t)});class Vh extends Nt{_parse(e){if(this._getType(e)!==Ge.null){const i=this._getOrReturnCtx(e);return Fe(i,{code:Ce.invalid_type,expected:Ge.null,received:i.parsedType}),ct}return gr(e.data)}}Vh.create=t=>new Vh({typeName:ft.ZodNull,...St(t)});class gf extends Nt{constructor(){super(...arguments),this._any=!0}_parse(e){return gr(e.data)}}gf.create=t=>new gf({typeName:ft.ZodAny,...St(t)});class eu extends Nt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return gr(e.data)}}eu.create=t=>new eu({typeName:ft.ZodUnknown,...St(t)});class Fo extends Nt{_parse(e){const n=this._getOrReturnCtx(e);return Fe(n,{code:Ce.invalid_type,expected:Ge.never,received:n.parsedType}),ct}}Fo.create=t=>new Fo({typeName:ft.ZodNever,...St(t)});class gb extends Nt{_parse(e){if(this._getType(e)!==Ge.undefined){const i=this._getOrReturnCtx(e);return Fe(i,{code:Ce.invalid_type,expected:Ge.void,received:i.parsedType}),ct}return gr(e.data)}}gb.create=t=>new gb({typeName:ft.ZodVoid,...St(t)});class Ks extends Nt{_parse(e){const{ctx:n,status:i}=this._processInputParams(e),r=this._def;if(n.parsedType!==Ge.array)return Fe(n,{code:Ce.invalid_type,expected:Ge.array,received:n.parsedType}),ct;if(r.exactLength!==null){const a=n.data.length>r.exactLength.value,o=n.data.length<r.exactLength.value;(a||o)&&(Fe(n,{code:a?Ce.too_big:Ce.too_small,minimum:o?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),i.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(Fe(n,{code:Ce.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(Fe(n,{code:Ce.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((a,o)=>r.type._parseAsync(new za(n,a,n.path,o)))).then(a=>er.mergeArray(i,a));const s=[...n.data].map((a,o)=>r.type._parseSync(new za(n,a,n.path,o)));return er.mergeArray(i,s)}get element(){return this._def.type}min(e,n){return new Ks({...this._def,minLength:{value:e,message:Ke.toString(n)}})}max(e,n){return new Ks({...this._def,maxLength:{value:e,message:Ke.toString(n)}})}length(e,n){return new Ks({...this._def,exactLength:{value:e,message:Ke.toString(n)}})}nonempty(e){return this.min(1,e)}}Ks.create=(t,e)=>new Ks({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ft.ZodArray,...St(e)});function Dd(t){if(t instanceof Fn){const e={};for(const n in t.shape){const i=t.shape[n];e[n]=La.create(Dd(i))}return new Fn({...t._def,shape:()=>e})}else return t instanceof Ks?new Ks({...t._def,type:Dd(t.element)}):t instanceof La?La.create(Dd(t.unwrap())):t instanceof ec?ec.create(Dd(t.unwrap())):t instanceof Ga?Ga.create(t.items.map(e=>Dd(e))):t}class Fn extends Nt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=qt.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Ge.object){const c=this._getOrReturnCtx(e);return Fe(c,{code:Ce.invalid_type,expected:Ge.object,received:c.parsedType}),ct}const{status:i,ctx:r}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof Fo&&this._def.unknownKeys==="strip"))for(const c in r.data)a.includes(c)||o.push(c);const l=[];for(const c of a){const u=s[c],d=r.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new za(r,d,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof Fo){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of o)l.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(c==="strict")o.length>0&&(Fe(r,{code:Ce.unrecognized_keys,keys:o}),i.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of o){const d=r.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new za(r,d,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>er.mergeObjectSync(i,c)):er.mergeObjectSync(i,l)}get shape(){return this._def.shape()}strict(e){return Ke.errToObj,new Fn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,i)=>{const r=this._def.errorMap?.(n,i).message??i.defaultError;return n.code==="unrecognized_keys"?{message:Ke.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new Fn({...this._def,unknownKeys:"strip"})}passthrough(){return new Fn({...this._def,unknownKeys:"passthrough"})}extend(e){return new Fn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Fn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ft.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Fn({...this._def,catchall:e})}pick(e){const n={};for(const i of qt.objectKeys(e))e[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new Fn({...this._def,shape:()=>n})}omit(e){const n={};for(const i of qt.objectKeys(this.shape))e[i]||(n[i]=this.shape[i]);return new Fn({...this._def,shape:()=>n})}deepPartial(){return Dd(this)}partial(e){const n={};for(const i of qt.objectKeys(this.shape)){const r=this.shape[i];e&&!e[i]?n[i]=r:n[i]=r.optional()}return new Fn({...this._def,shape:()=>n})}required(e){const n={};for(const i of qt.objectKeys(this.shape))if(e&&!e[i])n[i]=this.shape[i];else{let s=this.shape[i];for(;s instanceof La;)s=s._def.innerType;n[i]=s}return new Fn({...this._def,shape:()=>n})}keyof(){return N9(qt.objectKeys(this.shape))}}Fn.create=(t,e)=>new Fn({shape:()=>t,unknownKeys:"strip",catchall:Fo.create(),typeName:ft.ZodObject,...St(e)});Fn.strictCreate=(t,e)=>new Fn({shape:()=>t,unknownKeys:"strict",catchall:Fo.create(),typeName:ft.ZodObject,...St(e)});Fn.lazycreate=(t,e)=>new Fn({shape:t,unknownKeys:"strip",catchall:Fo.create(),typeName:ft.ZodObject,...St(e)});class Wh extends Nt{_parse(e){const{ctx:n}=this._processInputParams(e),i=this._def.options;function r(s){for(const o of s)if(o.result.status==="valid")return o.result;for(const o of s)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;const a=s.map(o=>new Hr(o.ctx.common.issues));return Fe(n,{code:Ce.invalid_union,unionErrors:a}),ct}if(n.common.async)return Promise.all(i.map(async s=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(r);{let s;const a=[];for(const l of i){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!s&&(s={result:u,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const o=a.map(l=>new Hr(l));return Fe(n,{code:Ce.invalid_union,unionErrors:o}),ct}}get options(){return this._def.options}}Wh.create=(t,e)=>new Wh({options:t,typeName:ft.ZodUnion,...St(e)});const vo=t=>t instanceof Qh?vo(t.schema):t instanceof ta?vo(t.innerType()):t instanceof Xh?[t.value]:t instanceof Zl?t.options:t instanceof Jh?qt.objectValues(t.enum):t instanceof Zh?vo(t._def.innerType):t instanceof Hh?[void 0]:t instanceof Vh?[null]:t instanceof La?[void 0,...vo(t.unwrap())]:t instanceof ec?[null,...vo(t.unwrap())]:t instanceof Hw||t instanceof tm?vo(t.unwrap()):t instanceof em?vo(t._def.innerType):[];class Jy extends Nt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ge.object)return Fe(n,{code:Ce.invalid_type,expected:Ge.object,received:n.parsedType}),ct;const i=this.discriminator,r=n.data[i],s=this.optionsMap.get(r);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(Fe(n,{code:Ce.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),ct)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,i){const r=new Map;for(const s of n){const a=vo(s.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of a){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,s)}}return new Jy({typeName:ft.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:r,...St(i)})}}function Dx(t,e){const n=ko(t),i=ko(e);if(t===e)return{valid:!0,data:t};if(n===Ge.object&&i===Ge.object){const r=qt.objectKeys(e),s=qt.objectKeys(t).filter(o=>r.indexOf(o)!==-1),a={...t,...e};for(const o of s){const l=Dx(t[o],e[o]);if(!l.valid)return{valid:!1};a[o]=l.data}return{valid:!0,data:a}}else if(n===Ge.array&&i===Ge.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let s=0;s<t.length;s++){const a=t[s],o=e[s],l=Dx(a,o);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return n===Ge.date&&i===Ge.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Yh extends Nt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e),r=(s,a)=>{if(wx(s)||wx(a))return ct;const o=Dx(s.value,a.value);return o.valid?((Ax(s)||Ax(a))&&n.dirty(),{status:n.value,value:o.data}):(Fe(i,{code:Ce.invalid_intersection_types}),ct)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([s,a])=>r(s,a)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}Yh.create=(t,e,n)=>new Yh({left:t,right:e,typeName:ft.ZodIntersection,...St(n)});class Ga extends Nt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ge.array)return Fe(i,{code:Ce.invalid_type,expected:Ge.array,received:i.parsedType}),ct;if(i.data.length<this._def.items.length)return Fe(i,{code:Ce.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ct;!this._def.rest&&i.data.length>this._def.items.length&&(Fe(i,{code:Ce.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...i.data].map((a,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new za(i,a,i.path,o)):null}).filter(a=>!!a);return i.common.async?Promise.all(s).then(a=>er.mergeArray(n,a)):er.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Ga({...this._def,rest:e})}}Ga.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ga({items:t,typeName:ft.ZodTuple,rest:null,...St(e)})};class Kh extends Nt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ge.object)return Fe(i,{code:Ce.invalid_type,expected:Ge.object,received:i.parsedType}),ct;const r=[],s=this._def.keyType,a=this._def.valueType;for(const o in i.data)r.push({key:s._parse(new za(i,o,i.path,o)),value:a._parse(new za(i,i.data[o],i.path,o)),alwaysSet:o in i.data});return i.common.async?er.mergeObjectAsync(n,r):er.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(e,n,i){return n instanceof Nt?new Kh({keyType:e,valueType:n,typeName:ft.ZodRecord,...St(i)}):new Kh({keyType:js.create(),valueType:e,typeName:ft.ZodRecord,...St(n)})}}class _b extends Nt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ge.map)return Fe(i,{code:Ce.invalid_type,expected:Ge.map,received:i.parsedType}),ct;const r=this._def.keyType,s=this._def.valueType,a=[...i.data.entries()].map(([o,l],c)=>({key:r._parse(new za(i,o,i.path,[c,"key"])),value:s._parse(new za(i,l,i.path,[c,"value"]))}));if(i.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of a){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return ct;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),o.set(c.value,u.value)}return{status:n.value,value:o}})}else{const o=new Map;for(const l of a){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return ct;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),o.set(c.value,u.value)}return{status:n.value,value:o}}}}_b.create=(t,e,n)=>new _b({valueType:e,keyType:t,typeName:ft.ZodMap,...St(n)});class pu extends Nt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ge.set)return Fe(i,{code:Ce.invalid_type,expected:Ge.set,received:i.parsedType}),ct;const r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(Fe(i,{code:Ce.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(Fe(i,{code:Ce.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());const s=this._def.valueType;function a(l){const c=new Set;for(const u of l){if(u.status==="aborted")return ct;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const o=[...i.data.values()].map((l,c)=>s._parse(new za(i,l,i.path,c)));return i.common.async?Promise.all(o).then(l=>a(l)):a(o)}min(e,n){return new pu({...this._def,minSize:{value:e,message:Ke.toString(n)}})}max(e,n){return new pu({...this._def,maxSize:{value:e,message:Ke.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}pu.create=(t,e)=>new pu({valueType:t,minSize:null,maxSize:null,typeName:ft.ZodSet,...St(e)});class ef extends Nt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ge.function)return Fe(n,{code:Ce.invalid_type,expected:Ge.function,received:n.parsedType}),ct;function i(o,l){return hb({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,pb(),mf].filter(c=>!!c),issueData:{code:Ce.invalid_arguments,argumentsError:l}})}function r(o,l){return hb({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,pb(),mf].filter(c=>!!c),issueData:{code:Ce.invalid_return_type,returnTypeError:l}})}const s={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof _f){const o=this;return gr(async function(...l){const c=new Hr([]),u=await o._def.args.parseAsync(l,s).catch(p=>{throw c.addIssue(i(l,p)),c}),d=await Reflect.apply(a,this,u);return await o._def.returns._def.type.parseAsync(d,s).catch(p=>{throw c.addIssue(r(d,p)),c})})}else{const o=this;return gr(function(...l){const c=o._def.args.safeParse(l,s);if(!c.success)throw new Hr([i(l,c.error)]);const u=Reflect.apply(a,this,c.data),d=o._def.returns.safeParse(u,s);if(!d.success)throw new Hr([r(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ef({...this._def,args:Ga.create(e).rest(eu.create())})}returns(e){return new ef({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,i){return new ef({args:e||Ga.create([]).rest(eu.create()),returns:n||eu.create(),typeName:ft.ZodFunction,...St(i)})}}class Qh extends Nt{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Qh.create=(t,e)=>new Qh({getter:t,typeName:ft.ZodLazy,...St(e)});class Xh extends Nt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return Fe(n,{received:n.data,code:Ce.invalid_literal,expected:this._def.value}),ct}return{status:"valid",value:e.data}}get value(){return this._def.value}}Xh.create=(t,e)=>new Xh({value:t,typeName:ft.ZodLiteral,...St(e)});function N9(t,e){return new Zl({values:t,typeName:ft.ZodEnum,...St(e)})}class Zl extends Nt{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),i=this._def.values;return Fe(n,{expected:qt.joinValues(i),received:n.parsedType,code:Ce.invalid_type}),ct}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),i=this._def.values;return Fe(n,{received:n.data,code:Ce.invalid_enum_value,options:i}),ct}return gr(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Zl.create(e,{...this._def,...n})}exclude(e,n=this._def){return Zl.create(this.options.filter(i=>!e.includes(i)),{...this._def,...n})}}Zl.create=N9;class Jh extends Nt{_parse(e){const n=qt.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==Ge.string&&i.parsedType!==Ge.number){const r=qt.objectValues(n);return Fe(i,{expected:qt.joinValues(r),received:i.parsedType,code:Ce.invalid_type}),ct}if(this._cache||(this._cache=new Set(qt.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=qt.objectValues(n);return Fe(i,{received:i.data,code:Ce.invalid_enum_value,options:r}),ct}return gr(e.data)}get enum(){return this._def.values}}Jh.create=(t,e)=>new Jh({values:t,typeName:ft.ZodNativeEnum,...St(e)});class _f extends Nt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ge.promise&&n.common.async===!1)return Fe(n,{code:Ce.invalid_type,expected:Ge.promise,received:n.parsedType}),ct;const i=n.parsedType===Ge.promise?n.data:Promise.resolve(n.data);return gr(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}}_f.create=(t,e)=>new _f({type:t,typeName:ft.ZodPromise,...St(e)});class ta extends Nt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ft.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:i}=this._processInputParams(e),r=this._def.effect||null,s={addIssue:a=>{Fe(i,a),a.fatal?n.abort():n.dirty()},get path(){return i.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){const a=r.transform(i.data,s);if(i.common.async)return Promise.resolve(a).then(async o=>{if(n.value==="aborted")return ct;const l=await this._def.schema._parseAsync({data:o,path:i.path,parent:i});return l.status==="aborted"?ct:l.status==="dirty"||n.value==="dirty"?Hd(l.value):l});{if(n.value==="aborted")return ct;const o=this._def.schema._parseSync({data:a,path:i.path,parent:i});return o.status==="aborted"?ct:o.status==="dirty"||n.value==="dirty"?Hd(o.value):o}}if(r.type==="refinement"){const a=o=>{const l=r.refinement(o,s);if(i.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(i.common.async===!1){const o=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?ct:(o.status==="dirty"&&n.dirty(),a(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(o=>o.status==="aborted"?ct:(o.status==="dirty"&&n.dirty(),a(o.value).then(()=>({status:n.value,value:o.value}))))}if(r.type==="transform")if(i.common.async===!1){const a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!du(a))return ct;const o=r.transform(a.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>du(a)?Promise.resolve(r.transform(a.value,s)).then(o=>({status:n.value,value:o})):ct);qt.assertNever(r)}}ta.create=(t,e,n)=>new ta({schema:t,typeName:ft.ZodEffects,effect:e,...St(n)});ta.createWithPreprocess=(t,e,n)=>new ta({schema:e,effect:{type:"preprocess",transform:t},typeName:ft.ZodEffects,...St(n)});class La extends Nt{_parse(e){return this._getType(e)===Ge.undefined?gr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}La.create=(t,e)=>new La({innerType:t,typeName:ft.ZodOptional,...St(e)});class ec extends Nt{_parse(e){return this._getType(e)===Ge.null?gr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ec.create=(t,e)=>new ec({innerType:t,typeName:ft.ZodNullable,...St(e)});class Zh extends Nt{_parse(e){const{ctx:n}=this._processInputParams(e);let i=n.data;return n.parsedType===Ge.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Zh.create=(t,e)=>new Zh({innerType:t,typeName:ft.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...St(e)});class em extends Nt{_parse(e){const{ctx:n}=this._processInputParams(e),i={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return Gh(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Hr(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Hr(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}em.create=(t,e)=>new em({innerType:t,typeName:ft.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...St(e)});class bb extends Nt{_parse(e){if(this._getType(e)!==Ge.nan){const i=this._getOrReturnCtx(e);return Fe(i,{code:Ce.invalid_type,expected:Ge.nan,received:i.parsedType}),ct}return{status:"valid",value:e.data}}}bb.create=t=>new bb({typeName:ft.ZodNaN,...St(t)});const RK=Symbol("zod_brand");class Hw extends Nt{_parse(e){const{ctx:n}=this._processInputParams(e),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}}class zm extends Nt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?ct:s.status==="dirty"?(n.dirty(),Hd(s.value)):this._def.out._parseAsync({data:s.value,path:i.path,parent:i})})();{const r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?ct:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(e,n){return new zm({in:e,out:n,typeName:ft.ZodPipeline})}}class tm extends Nt{_parse(e){const n=this._def.innerType._parse(e),i=r=>(du(r)&&(r.value=Object.freeze(r.value)),r);return Gh(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}}tm.create=(t,e)=>new tm({innerType:t,typeName:ft.ZodReadonly,...St(e)});function BN(t,e){const n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function I9(t,e={},n){return t?gf.create().superRefine((i,r)=>{const s=t(i);if(s instanceof Promise)return s.then(a=>{if(!a){const o=BN(e,i),l=o.fatal??n??!0;r.addIssue({code:"custom",...o,fatal:l})}});if(!s){const a=BN(e,i),o=a.fatal??n??!0;r.addIssue({code:"custom",...a,fatal:o})}}):gf.create()}const MK={object:Fn.lazycreate};var ft;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ft||(ft={}));const LK=(t,e={message:`Input not instance of ${t.name}`})=>I9(n=>n instanceof t,e),Xe=js.create,we=Xl.create,PK=bb.create,FK=Jl.create,Bo=jh.create,BK=fu.create,UK=mb.create,$K=Hh.create,qK=Vh.create,zK=gf.create,GK=eu.create,jK=Fo.create,HK=gb.create,tu=Ks.create,Ze=Fn.create,VK=Fn.strictCreate,nu=Wh.create,O9=Jy.create,WK=Yh.create,Vw=Ga.create,R9=Kh.create,YK=_b.create,KK=pu.create,QK=ef.create,XK=Qh.create,yb=Xh.create,an=Zl.create,JK=Jh.create,ZK=_f.create,UN=ta.create,eQ=La.create,tQ=ec.create,nQ=ta.createWithPreprocess,iQ=zm.create,rQ=()=>Xe().optional(),sQ=()=>we().optional(),aQ=()=>Bo().optional(),oQ={string:(t=>js.create({...t,coerce:!0})),number:(t=>Xl.create({...t,coerce:!0})),boolean:(t=>jh.create({...t,coerce:!0})),bigint:(t=>Jl.create({...t,coerce:!0})),date:(t=>fu.create({...t,coerce:!0}))},lQ=ct,tn=Object.freeze(Object.defineProperty({__proto__:null,BRAND:RK,DIRTY:Hd,EMPTY_PATH:dK,INVALID:ct,NEVER:lQ,OK:gr,ParseStatus:er,Schema:Nt,ZodAny:gf,ZodArray:Ks,ZodBigInt:Jl,ZodBoolean:jh,ZodBranded:Hw,ZodCatch:em,ZodDate:fu,ZodDefault:Zh,ZodDiscriminatedUnion:Jy,ZodEffects:ta,ZodEnum:Zl,ZodError:Hr,get ZodFirstPartyTypeKind(){return ft},ZodFunction:ef,ZodIntersection:Yh,ZodIssueCode:Ce,ZodLazy:Qh,ZodLiteral:Xh,ZodMap:_b,ZodNaN:bb,ZodNativeEnum:Jh,ZodNever:Fo,ZodNull:Vh,ZodNullable:ec,ZodNumber:Xl,ZodObject:Fn,ZodOptional:La,ZodParsedType:Ge,ZodPipeline:zm,ZodPromise:_f,ZodReadonly:tm,ZodRecord:Kh,ZodSchema:Nt,ZodSet:pu,ZodString:js,ZodSymbol:mb,ZodTransformer:ta,ZodTuple:Ga,ZodType:Nt,ZodUndefined:Hh,ZodUnion:Wh,ZodUnknown:eu,ZodVoid:gb,addIssueToContext:Fe,any:zK,array:tu,bigint:FK,boolean:Bo,coerce:oQ,custom:I9,date:BK,datetimeRegex:D9,defaultErrorMap:mf,discriminatedUnion:O9,effect:UN,enum:an,function:QK,getErrorMap:pb,getParsedType:ko,instanceof:LK,intersection:WK,isAborted:wx,isAsync:Gh,isDirty:Ax,isValid:du,late:MK,lazy:XK,literal:yb,makeIssue:hb,map:YK,nan:PK,nativeEnum:JK,never:jK,null:qK,nullable:tQ,number:we,object:Ze,get objectUtil(){return kx},oboolean:aQ,onumber:sQ,optional:eQ,ostring:rQ,pipeline:iQ,preprocess:nQ,promise:ZK,quotelessJson:cK,record:R9,set:KK,setErrorMap:uK,strictObject:VK,string:Xe,symbol:UK,transformer:UN,tuple:Vw,undefined:$K,union:nu,unknown:GK,get util(){return qt},void:HK},Symbol.toStringTag,{value:"Module"}));function Ag(t,e){return!t||t&&t[e]===0?"initial":t[e]!==void 0?`${t[e]}px solid ${t?.color??"black"}`:"initial"}function pi({className:t,background:e,backgroundColor:n,padding:i={top:0,right:0,bottom:0,left:0},width:r,align:s,children:a,border:o,borderRadius:l,isParent:c=!0,overflow:u="visible"}){const d=t?`a${t}`:"";return h.jsx("table",{className:t,width:r,border:0,cellSpacing:"0",cellPadding:"0",style:{width:r,minWidth:r,backgroundColor:n??void 0,background:e??void 0,borderRadius:l??"initial",borderTop:Ag(o,"top"),borderBottom:Ag(o,"bottom"),borderLeft:Ag(o,"left"),borderRight:Ag(o,"right"),overflow:u,borderCollapse:"initial"},children:h.jsxs("tbody",{children:[h.jsxs("tr",{height:i.top,style:{height:`${i.top}px`},className:c?`t${t}`:`it${t}`,children:[h.jsx("td",{style:{width:`${i.left}px`},className:c?`l${t}`:`il${t}`}),h.jsx("td",{}),h.jsx("td",{style:{width:`${i.right}px`},className:c?`r${t}`:`ir${t}`})]}),h.jsxs("tr",{children:[h.jsx("td",{style:{width:`${i.left}px`},className:c?`l${t}`:`il${t}`}),h.jsx("td",{className:d,align:s,children:a}),h.jsx("td",{style:{width:`${i.right}px`},className:c?`r${t}`:`ir${t}`})]}),h.jsxs("tr",{height:i.bottom,style:{height:`${i.bottom}px`},className:c?`b${t}`:`ib${t}`,children:[h.jsx("td",{style:{width:`${i.left}px`},className:c?`l${t}`:`il${t}`}),h.jsx("td",{}),h.jsx("td",{style:{width:`${i.right}px`},className:c?`r${t}`:`ir${t}`})]})]})})}const Yo=(t,e)=>{const n=/#([0-9a-fA-F]{3,6})\b/;return n.test(t)?t.replace(n,e):t.trim()===""?e:t.replace(/^(\S+)/,`$1 ${e}`)};function Eb(t){const e=t?.shape??"rectangle";if(typeof e=="string")switch(e){case"rectangle":return;case"pill":return 9999;default:return}else if(typeof e=="object"&&e!==null){const{topLeft:n=0,topRight:i=0,bottomLeft:r=0,bottomRight:s=0}=e;return`${i}px ${n}px ${s}px ${r}px`}}function M9(t,e){const n=new RegExp(`${e}\\s*:\\s*([^;"']+)`,"gi"),i=[];let r;for(;(r=n.exec(t))!==null;)i.push(r[1].trim());return i}function Hs(t){const n=new DOMParser().parseFromString(t,"text/html");return n.body.querySelectorAll("*").forEach(i=>{i.childNodes.forEach(r=>{if(r.nodeType===Node.TEXT_NODE){let s=r.textContent??"";s=s.replace(/ {2,}/g,o=>"&nbsp;".repeat(o.length-1)+" ");const a=document.createElement("span");a.innerHTML=s,i.replaceChild(a.firstChild,r)}})}),n.body.innerHTML}function cQ(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=(e>>>0)*16777619;return e>>>0}function uQ(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";if(t===0)return"a";let n="";for(;t>0;)n=e[t%62]+n,t=Math.floor(t/62);return n}function vt(t){const e=cQ(t);return`b${uQ(e)}`}const $N=Ze({top:we(),bottom:we(),right:we(),left:we()}).optional().nullable(),L9=Ze({style:Ze({textAlign:an(["left","center","right"]).optional().nullable(),padding:$N,mobilePadding:$N,backgroundColor:Xe().optional()}).passthrough().optional().nullable(),props:Ze({size:we().gt(0).optional().nullable(),shape:an(["circle","square","rounded"]).optional().nullable(),imageUrl:Xe().optional().nullable(),alt:Xe().optional().nullable()}).optional().nullable()}).passthrough(),Vc={size:64,imageUrl:"",alt:"",shape:"square"};function P9({style:t,props:e,blockId:n}){const i=e?.size??Vc.size,r=e?.imageUrl??Vc.imageUrl,s=e?.alt??Vc.alt;e?.shape??Vc.shape;const a=Xy(),o={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},l=h.jsx(pi,{isParent:!1,children:h.jsxs(h.Fragment,{children:[h.jsx("img",{alt:s??"",src:r??"",width:i,style:{width:i,height:"auto",outline:"none",border:"none",textDecoration:"none",verticalAlign:t?.contentAlignment??"middle",display:"inline-block",maxWidth:"100%",opacity:a.uploading&&a.id===n?.5:1,transition:"opacity 0.2s ease-in-out"}}),a.uploading&&a.id===n&&h.jsx("div",{style:o,children:h.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:h.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})]})}),c=vt(n);return h.jsx(pi,{className:`${c}`,padding:t.padding,backgroundColor:t.backgroundColor,align:t.textAlign,width:"100%",children:l})}function Is({title:t,children:e}){return h.jsxs(k.Container,{sx:{padding:"0!important",paddingTop:"1rem!important"},children:[h.jsx(k.Typography,{sx:{fontWeight:"bold",mb:2,pb:1,color:"text.primary",fontSize:"1.25rem",borderBottom:n=>`1px solid ${n.palette.divider}`},children:t}),h.jsx(k.Stack,{spacing:2,gap:1,mb:3,pt:1,children:e})]})}const Sn=({label:t})=>{const e=fe.useTheme();return t?h.jsx("p",{style:{fontWeight:"bold",color:e.palette.text.primary},children:t}):null},tr=({children:t})=>h.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.3rem"},children:t.map(e=>e)}),dQ=fe.styled(k.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}`}})),fQ=fe.styled("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"}})),qN=fe.styled(k.IconButton)(({theme:t})=>({padding:"0",color:t.palette.primary.main,"&:hover":{backgroundColor:fe.alpha(t.palette.primary.main,.04)},"& .MuiSvgIcon-root":{fontSize:14}}));function jn({iconLabel:t,label:e,value:n,setValue:i,units:r,min:s=0,max:a,step:o=void 0,marks:l=!0,...c}){const u=n??s,[d,f]=E.useState(u.toString()),p=T=>{let x=T;x<s&&(x=s),a!==void 0&&x>a&&(x=a),i(x),f(x.toString())},m=T=>{const x=T.target.value;if(f(x),x!==""){const w=Number(x);isNaN(w)||w>=s&&i(w)}},_=()=>{if(d===""||isNaN(Number(d)))f(u.toString());else{const T=Number(d);p(T)}},g=T=>{T.key==="Enter"&&_()};E.useEffect(()=>{f((n??s).toString())},[n,s]);const b=()=>{const T=u+1;p(T)},y=()=>{const T=u-1;p(T)},v=(T,x)=>{typeof x=="number"&&i(x)};return h.jsxs(tr,{children:[h.jsx(Sn,{label:e}),h.jsxs(k.Stack,{direction:"row",alignItems:"center",spacing:2,justifyContent:"space-between",width:"100%",children:[h.jsx(k.Box,{sx:{minWidth:24,lineHeight:1,flexShrink:0},children:t}),h.jsx(k.Slider,{...c,value:u,min:s,max:a||1e3,step:o,color:"primary",marks:l,onChange:v}),h.jsxs(dQ,{children:[h.jsx(fQ,{type:"number",value:d,onChange:m,onBlur:_,onKeyDown:g,min:s,max:a,step:o}),h.jsxs(k.Box,{sx:{display:"flex",flexDirection:"column",ml:.5},children:[h.jsx(qN,{onClick:b,disabled:a!==void 0&&u>=a,children:h.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",children:h.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})}),h.jsx(qN,{onClick:y,disabled:u<=s,children:h.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",style:{transform:"rotate(180deg)"},children:h.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})})]})]}),h.jsx(k.Typography,{variant:"caption",color:"text.secondary",sx:{fontSize:"16px",ml:"4px!important"},children:r})]})]})}function qc({label:t,defaultValue:e,onChange:n,...i}){const[r,s]=E.useState(e??0);return e!=r&&s(e),h.jsxs(tr,{children:[h.jsx(Sn,{label:t}),h.jsx(jn,{value:r??0,setValue:a=>{s(a),n(a)},...i})]})}function Ww(t,e){const n=E.useRef(null),i=E.useRef(t),r=E.useRef([]);i.current=t;const s=E.useCallback((...a)=>{r.current=a,n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{i.current(...a),n.current=null},e)},[e]);return s.flush=E.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=null,i.current(...r.current))},[]),s}const tf=36,Yw=8,Zy={width:"100%","& .MuiInputBase-root":{"&:not(.MuiInputBase-multiline)":{height:`${tf}px`}},"& .MuiOutlinedInput-root":{borderRadius:`${Yw}px`,"&:not(.MuiInputBase-multiline)":{height:`${tf}px`}},"& .MuiInputBase-input":{paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",height:"unset"}},F9={width:"100%",height:`${tf}px`,paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",display:"flex",alignItems:"center",borderRadius:`${Yw}px`};function hu({helperText:t,label:e,placeholder:n,rows:i,InputProps:r,defaultValue:s,onChange:a}){const[o,l]=E.useState(s);E.useEffect(()=>{o!==s&&l(s)},[s]);const c=Ww(d=>{a(d)},150),u=typeof i=="number"&&i>1;return h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx(Sn,{label:e}),h.jsx(k.TextField,{fullWidth:!0,multiline:u,minRows:i,variant:"outlined",placeholder:n,helperText:t,InputProps:r,value:o,sx:Zy,onChange:d=>{const f=d.target.value;l(f),c(f)},onBlur:()=>{c.flush()}})]})}function pQ({onClick:t,disabled:e,primary:n=!1}){const{t:i}=It.useTranslation("inspector");return h.jsx(k.IconButton,{"aria-label":i("inputs.common.close"),onClick:t,disabled:e,sx:{position:"absolute",right:8,top:8,color:r=>n?"brand.blue":r.palette.grey[500],"&:hover":{opacity:.8}},children:h.jsx(Q.Close,{})})}function hQ({imageUrl:t,saving:e=!1}){return h.jsxs(k.Card,{sx:{position:"relative"},children:[e&&h.jsx(k.Stack,{justifyContent:"center",alignItems:"center",sx:{position:"absolute",top:7,left:0,width:"100%",height:"314px",zIndex:20,backgroundColor:"#212121AA",mb:1},children:h.jsx(k.CircularProgress,{size:48,thickness:6,color:"inherit",sx:{color:"white"}})}),h.jsx(k.CardMedia,{component:"img",sx:{objectFit:"contain",width:"100%",height:"326px"},image:t,alt:"Generated Image"})]})}function mQ({value:t,onChange:e,disabled:n}){return h.jsxs(h.Fragment,{children:[h.jsx(k.Typography,{sx:{fontSize:"14px",fontWeight:700},children:"Image description"}),h.jsx(k.TextField,{disabled:n,autoFocus:!0,margin:"dense",id:"prompt",placeholder:"Enter a detailed description here...",type:"text",fullWidth:!0,multiline:!0,rows:4,variant:"outlined",value:t,onChange:i=>e(i.target.value),sx:{mt:.5,"& .MuiOutlinedInput-root":{borderRadius:"8px"}}})]})}const gQ=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 B9({src:t,style:e}){const[n,i]=E.useState(!1),[r,s]=E.useState(!1),[a,o]=E.useState(""),[l,c]=E.useState(null),[u,d]=E.useState(!1),[f,p]=E.useState(null),[m,_]=E.useState(!1),g=()=>{i(!0),p(null)},b=()=>{r||(i(!1),s(!1),c(null),o(""),d(!1),p(null),_(!1))},y=()=>{const x=l&&!u?"store-ai-image":"request-ai-image",w=l&&!u?l:a;p(null),x==="store-ai-image"?(_(!0),s(!1),setTimeout(()=>{s(!1),b()},2e3)):s(!0),window.dispatchEvent(new CustomEvent(x,{detail:w}))},v=()=>{d(!0),c(null),p(null),_(!1)};E.useEffect(()=>{const x=w=>{const{detail:I}=w;if(s(!1),I.error){p(gQ(I.error));return}if(!I.success||!I.url){p({code:0,title:"Generation Failed",message:"Failed to generate the image.",action:"Please try again"});return}c(I.url),d(!1)};return window.addEventListener("generated-image",x),()=>{window.removeEventListener("generated-image",x)}},[]),E.useEffect(()=>{b()},[t]);const T=!l||u;return h.jsxs(h.Fragment,{children:[h.jsx(k.Button,{style:e,startIcon:h.jsx(Q.AutoAwesome,{className:"w-4 h-4"}),variant:"contained",onClick:g,children:"Generate"}),h.jsx(k.Dialog,{open:n,onClose:b,maxWidth:"sm",fullWidth:!0,className:"backgroundTranspatent",children:h.jsxs("form",{style:{background:"white"},onSubmit:x=>{x.preventDefault(),y()},children:[h.jsxs(k.DialogTitle,{sx:{fontWeight:700,fontSize:"24px",color:f?"#EF4444":"inherit"},children:[f?"Image generation failed":r?"Generating Your Image":l?"Your Image is ready":"Create your image",h.jsx(pQ,{onClick:b,disabled:r,primary:!0})]}),h.jsxs(k.DialogContent,{children:[h.jsx(k.DialogContentText,{sx:{pb:1,color:f?"#7F1D1D":"inherit"},children:f?"Try simplifying your prompt or describing something else. If the issue persists, please try again later.":r?"Hang tight! This may take a few seconds as we bring your image to life.":T?"Describe the image you want us to generate. Be specific to get the best results.":"Here’s your image. Not quite right? You can tweak it and try again."}),l&&!u?h.jsxs(k.Stack,{sx:{position:"relative"},children:[h.jsx(hQ,{imageUrl:l,saving:m}),h.jsxs(k.Alert,{variant:"outlined",severity:"warning",icon:!1,children:[h.jsx("b",{children:"IMPORTANT:"})," Regenerating will discard this image, and it won't be saved in your gallery. To keep it, make sure to ",h.jsx("b",{children:"Insert the image"})," first."]})]}):r&&!l?h.jsx(k.Stack,{justifyContent:"center",alignItems:"center",sx:{backgroundColor:x=>x.palette.mainColor[50],height:"326px",width:"100%"},children:h.jsx(k.CircularProgress,{size:48,thickness:6})}):h.jsx(mQ,{value:a,onChange:o,disabled:r})]}),!r&&h.jsxs(k.DialogActions,{className:"p-6",children:[l&&!u&&h.jsx(k.Button,{startIcon:h.jsx(Q.Refresh,{className:"w-4 h-4"}),onClick:v,variant:"outlined",disabled:r,children:"Regenerate"}),!l&&!u&&h.jsx(k.Button,{className:"primary",onClick:b,variant:"text",disabled:u,children:"Cancel"}),h.jsxs(k.Button,{startIcon:l&&!u?h.jsx(Q.Attachment,{className:"w-4 h-4"}):h.jsx(Q.AutoAwesome,{className:"w-4 h-4"}),onClick:y,variant:"contained",disabled:!a||a?.length<20,children:[l&&!u?"Insert Image":"Generate image",r&&h.jsx(k.CircularProgress,{size:16,className:"ml-2"})]})]})]})})]})}const _Q=({className:t,...e})=>h.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",className:t,"aria-hidden":"true",focusable:"false",...e,children:h.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 3l6 6l6-6"})}),bQ=k.styled(k.Select)(({theme:t})=>({fontFamily:t.typography.fontFamily,color:t.palette.text.primary,backgroundColor:t.palette.background.paper,width:"100%",height:`${tf}px`,"&.MuiInputBase-root, &.MuiOutlinedInput-root":{height:`${tf}px`,minHeight:`${tf}px`,boxSizing:"border-box",borderRadius:`${Yw}px`},"&& .MuiSelect-select, && .MuiInputBase-input":{paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"36px",lineHeight:"20px",minHeight:"unset"},"& .MuiSelect-icon":{color:t.palette.secondary.main,right:12,top:"calc(50% - 4px)",transition:"transform 200ms ease",pointerEvents:"none"},"& .MuiSelect-iconOpen":{transform:"rotate(180deg)"},"&:hover":{backgroundColor:t.palette.action.hover},"&.Mui-focused":{borderColor:t.palette.primary.main}})),tc=E.forwardRef((t,e)=>{const n=k.useTheme();return h.jsx(bQ,{ref:e,...t,IconComponent:_Q,MenuProps:{PaperProps:{sx:{backgroundColor:n.palette.background.paper,color:n.palette.text.primary}},...t.MenuProps}})});tc.displayName="CustomSelect";const yQ=({defaultValue:t,onChange:e,values:n})=>{const i=uc(),{t:r}=It.useTranslation("inspector"),s=()=>h.jsx(k.SvgIcon,{viewBox:"0 0 18 18",fontSize:"small",children:h.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:"#F59E0B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})}),a=te=>{if(!te)return{url:"",repeat:"no-repeat",position:"center center",size:"cover"};const K=te.match(/url\("([^"]+)"\)/),ne=K?K[1]:"";let he="no-repeat";te.includes("repeat-x")?he="repeat-x":te.includes("repeat-y")?he="repeat-y":te.includes("repeat")&&!te.includes("no-repeat")&&(he="repeat");let Se="center center";const De=["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"];for(const st of De)if(te.includes(st)){Se=st;break}let Ie="cover";return te.includes("contain")?Ie="contain":te.includes("auto")&&(Ie="auto"),{url:ne,repeat:he,position:Se,size:Ie}},o=te=>te.url?`url("${te.url}") ${te.repeat} ${te.position} / ${te.size}`:"",[l,c]=E.useState(t||null),[u,d]=E.useState(a(t)),[f,p]=E.useState(!1),[m,_]=E.useState(window.emailAIGeneration||!1),[,g]=E.useState(null),[b,y]=E.useState(a(t).url||""),[v,T]=E.useState(!1),[x,w]=E.useState(""),[I,A]=E.useState(!1),N=E.useRef(null),M=Wf(),[C,F]=E.useState(()=>sessionStorage.getItem("hideBackgroundImageWarning")==="true"),D=(te,K)=>{const ne={...u,...te};if(d(ne),ne.url){const he=o(ne);c(he),e(he,K)}else console.error("Update params error: ",ne)},q=(te,K)=>{if(!te)return!1;const ne=te?.toLowerCase(),he=ne.includes(".svg")||ne.includes("svg"),Se=K&&(K.includes("image/svg+xml")||K.includes("svg"));return he||!!Se},z=async te=>{try{T(!0),w(""),A(!1);try{new URL(te)}catch{return w("Invalid URL format"),!1}const K=new AbortController,ne=setTimeout(()=>K.abort(),1e4);try{const he=await fetch(te,{method:"HEAD",signal:K.signal});if(clearTimeout(ne),!he.ok)return w(`HTTP ${he.status}: ${he.statusText}`),!1;const Se=he.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(st=>Se&&Se.toLowerCase().includes(st.toLowerCase()))?(q(te,Se)&&A(!0),w(""),!0):(w("URL does not point to an image"),!1)}catch(he){return clearTimeout(ne),he.name==="AbortError"?(w("Request timeout - URL took too long to respond"),!1):new Promise(Se=>{const De=new Image,Ie=setTimeout(()=>{w("Request timeout - URL took too long to respond"),Se(!1)},1e4);De.onload=()=>{clearTimeout(Ie),q(te)&&A(!0),w(""),Se(!0)},De.onerror=()=>{clearTimeout(Ie),w("Cannot access image - CORS policy, network error, or invalid URL"),Se(!1)},De.src=te})}}catch{return w("Unexpected error occurred while validating URL"),!1}finally{T(!1)}},O=async()=>{b.trim()&&await z(b.trim())&&D({url:b.trim()})},P=te=>{te.key==="Enter"&&O()},j=te=>{y(te.target.value),x&&w(""),I&&A(!1)},ee=te=>{const K=["image/png","image/jpeg","image/gif"],he=Array.from(te),Se=he.filter(Ie=>K.includes(Ie.type)&&Ie.size<=5242880);if(Se.length!==he.length&&alert(r("inputs.common.invalidFiles")),Se.length===0)return;const De=Se.map(Ie=>new Promise(st=>{const Lt=new FileReader;Lt.onload=dn=>st(dn.target?.result),Lt.readAsDataURL(Ie)}));Promise.all(De).then(Ie=>{const st={images:Ie,id:i||"",styles:n};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:st})),Zd(!0,i||"")})},X=te=>{te.preventDefault(),p(!0)},_e=()=>{p(!1)},se=te=>{te.preventDefault(),p(!1);const K=te.dataTransfer.files;ee(K)},re=()=>{const te=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(te)},le=()=>{d({url:"",repeat:"no-repeat",position:"center center",size:"cover"}),c(null),e(null),y(""),A(!1)},pe=te=>{switch(te){case"top left":return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M5.26523 9.79159L5.17094 5.17183M5.17094 5.17183L9.79071 5.26611M5.17094 5.17183L10.8278 10.8287",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"top center":return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M4.7998 7.33333L7.9998 4M7.9998 4L11.1998 7.33333M7.9998 4V12",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"top right":return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M6.20841 5.2662L10.8282 5.17192M10.8282 5.17192L10.7339 9.79169M10.8282 5.17192L5.17132 10.8288",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"center left":return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M7.33333 11.2002L4 8.00019M4 8.00019L7.33333 4.8002M4 8.00019L12 8.0002",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"center center":return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.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",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"center right":return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M8.66667 4.7998L12 7.9998M12 7.9998L8.66667 11.1998M12 7.9998L4 7.9998",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"bottom left":return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M9.79062 10.7348L5.17085 10.8291M5.17085 10.8291L5.26513 6.20929M5.17085 10.8291L10.8277 5.1722",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"bottom center":return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M11.1998 8.66667L7.9998 12M7.9998 12L4.7998 8.66667M7.9998 12L7.99981 4",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});case"bottom right":return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:"M10.7338 6.20938L10.8281 10.8291M10.8281 10.8291L6.20831 10.7349M10.8281 10.8291L5.17122 5.17229",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});default:return h.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.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",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})})}},Le=te=>({"top left":r("inputs.backgroundImage.positions.topLeft"),"top center":r("inputs.backgroundImage.positions.topCenter"),"top right":r("inputs.backgroundImage.positions.topRight"),"center left":r("inputs.backgroundImage.positions.centerLeft"),"center center":r("inputs.backgroundImage.positions.center"),"center right":r("inputs.backgroundImage.positions.centerRight"),"bottom left":r("inputs.backgroundImage.positions.bottomLeft"),"bottom center":r("inputs.backgroundImage.positions.bottomCenter"),"bottom right":r("inputs.backgroundImage.positions.bottomRight")})[te]??r("inputs.backgroundImage.positions.center");return E.useEffect(()=>{const te=De=>{const{detail:Ie}=De;Zd(!1,Ie.id||""),D({url:Ie.url},Ie.styles),E9(!1),y(Ie.url)},K=De=>{Zd(De?.detail?.uploading??!1,De?.detail?.id??"")},ne=De=>{const{detail:Ie}=De;_(Ie)},he=()=>{N?.current?.click()},Se=De=>{const{detail:Ie}=De;if(Ie&&!Ie.includes("url("))D({url:Ie},Ie.styles),y(Ie);else{const st=a(Ie);d(st),c(Ie),e(Ie),y(st.url)}};return window.addEventListener("email-builder-set-image",Se),window.addEventListener("email-builder-upload-image-receive",te),window.addEventListener("email-builder-ai-generation",ne),window.addEventListener("email-builder-upload-file",he),window.addEventListener("email-builder-toggle-upload-file",K),()=>{window.removeEventListener("email-builder-ai-generation",ne),window.removeEventListener("email-builder-upload-image-receive",te),window.removeEventListener("email-builder-set-image",Se),window.removeEventListener("email-builder-upload-file",he),window.removeEventListener("email-builder-toggle-upload-file",K)}},[u]),E.useEffect(()=>{t&&A(q(u.url))},[t,u.url]),E.useEffect(()=>{if(t!==l){const te=a(t);d(te),c(t||null),y(te.url||"")}},[t]),h.jsxs(tr,{children:[h.jsxs(k.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[h.jsx(Sn,{label:r("inputs.backgroundImage.label")}),!C&&h.jsx(k.Tooltip,{title:"Some email clients don’t support background images. Add a background color as fallback.",placement:"top",children:h.jsx(k.IconButton,{size:"small",sx:{p:0},children:h.jsx(s,{})})})]}),h.jsx("div",{style:{display:"flex",gap:8},children:M?h.jsxs(k.Box,{sx:{width:"100%"},children:[h.jsxs(k.Stack,{direction:"row",spacing:1,children:[h.jsx(k.TextField,{fullWidth:!0,placeholder:r("inputs.image.urlPlaceholder"),value:b,onChange:j,onKeyPress:P,error:!!x,disabled:v,sx:Zy}),h.jsx(k.Button,{variant:"contained",onClick:O,disabled:!b.trim()||v,sx:{minWidth:"auto",px:2,position:"relative"},children:v?h.jsx(k.CircularProgress,{size:20,color:"inherit"}):"Add"})]}),x&&h.jsx(k.Alert,{severity:"error",sx:{mt:1,fontSize:"0.875rem",maxHeight:"70px"},children:x}),I&&h.jsx(k.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:h.jsx(k.IconButton,{"aria-label":r("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{A(!1)},children:h.jsx(Q.Close,{fontSize:"inherit"})}),children:r("inputs.common.svgWarning")}),u.url&&h.jsxs(k.Box,{sx:{position:"relative",maxWidth:"50%",display:"block",margin:"0.5rem auto 0 auto"},children:[h.jsx("img",{src:u.url||"",alt:"",style:{width:"100%",objectFit:"contain",aspectRatio:"1 / 1",height:"auto",borderRadius:"8px",border:"2px solid #E5E5E5",backgroundColor:"#ffffff",backgroundImage:"linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%), linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%)",backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"}}),h.jsx(k.IconButton,{onClick:le,sx:{position:"absolute",top:5,right:5,backgroundColor:"white",color:"error.main",padding:1,width:35,height:35,"&:hover":{backgroundColor:"#f2e7e7"}},size:"small",children:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:h.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:"#EF4444"})})})]})]}):h.jsxs(h.Fragment,{children:[u.url&&h.jsxs(k.Box,{sx:{position:"relative",maxWidth:"40%"},children:[h.jsx("div",{style:{borderRadius:"8px",border:"2px solid #E5E5E5",height:"100%",backgroundColor:"#ffffff",backgroundImage:"linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%), linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%)",backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"},children:h.jsx("img",{src:u.url||"",alt:"",style:{width:"100%",objectFit:"contain",aspectRatio:"1 / 1",height:"100%"}})}),h.jsx(k.IconButton,{onClick:le,sx:{position:"absolute",top:5,right:5,backgroundColor:"white",color:"error.main",padding:1,width:35,height:35,"&:hover":{backgroundColor:"#f2e7e7"}},size:"small",children:h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:h.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:"#EF4444"})})})]}),h.jsxs(k.Box,{onDragOver:X,onDragLeave:_e,onDrop:se,sx:{width:"100%",minWidth:"40%",border:"2px solid",borderColor:f?"primary.main":"#E5E5E5",borderRadius:"8px",padding:"24px 8px 36px 8px",textAlign:"center",bgcolor:f?"primary.50":"background.paper",transition:"all 0.2s ease"},children:[h.jsx(k.Box,{sx:{display:"flex",justifyContent:"center"},children:h.jsx(Q.PhotoOutlined,{sx:{fontSize:32,color:"primary"}})}),h.jsxs("label",{style:{cursor:"pointer"},children:[h.jsx("input",{ref:N,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:te=>{const K=te.target.files;K&&K.length>0&&ee(Array.from(K))}}),h.jsx(k.Typography,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:r("inputs.common.uploadFile")}),h.jsxs(k.Typography,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",r("inputs.common.dragAndDrop")]})]}),h.jsx(k.Typography,{variant:"body2",sx:{color:"text.secondary",mt:1},children:r("inputs.common.fileInfo")})]})]})}),u.url&&h.jsxs(k.Box,{sx:{mt:2},children:[h.jsxs(k.Box,{sx:{mb:2},children:[h.jsx(Sn,{label:r("inputs.backgroundImage.fillType")}),h.jsxs(k.ToggleButtonGroup,{value:u.size,exclusive:!0,onChange:(te,K)=>{K!==null&&D({size:K})},size:"small",fullWidth:!0,children:[h.jsx(k.ToggleButton,{value:"cover",children:r("inputs.backgroundImage.fillOptions.cover")}),h.jsx(k.ToggleButton,{value:"contain",children:r("inputs.backgroundImage.fillOptions.contain")}),h.jsx(k.ToggleButton,{value:"auto",children:r("inputs.backgroundImage.fillOptions.auto")})]})]}),h.jsxs(k.Stack,{direction:"row",spacing:2,sx:{mb:2},children:[h.jsxs("div",{style:{flex:1},children:[h.jsx(Sn,{label:r("inputs.backgroundImage.repeat")}),h.jsxs(tc,{style:{width:"100%"},value:u.repeat,size:"small",onChange:te=>D({repeat:te.target.value}),children:[h.jsx(k.MenuItem,{value:"no-repeat",children:r("inputs.backgroundImage.repeatOptions.none")}),h.jsx(k.MenuItem,{value:"repeat",children:r("inputs.backgroundImage.repeatOptions.repeat")}),h.jsx(k.MenuItem,{value:"repeat-x",children:r("inputs.backgroundImage.repeatOptions.repeatX")}),h.jsx(k.MenuItem,{value:"repeat-y",children:r("inputs.backgroundImage.repeatOptions.repeatY")})]})]}),h.jsxs("div",{style:{flex:1},children:[h.jsx(Sn,{label:r("inputs.backgroundImage.position")}),h.jsx(tc,{style:{width:"100%"},value:u.position,size:"small",onChange:te=>D({position:te.target.value}),renderValue:te=>h.jsxs(k.Box,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[pe(te),Le(te)]}),children:["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"].map(te=>h.jsx(k.MenuItem,{sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important "},value:te,children:h.jsxs(k.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[pe(te),Le(te)]})},te))})]})]})]}),!M&&I&&h.jsx(k.Alert,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},children:r("inputs.common.svgWarning")}),v9()&&!M&&h.jsxs(h.Fragment,{children:[h.jsxs(k.Stack,{direction:"row",alignItems:"center",spacing:1,sx:{mt:2},children:[h.jsx(k.Divider,{sx:{flexGrow:1}}),h.jsx(k.Typography,{sx:{color:"text.secondary"},children:"or"}),h.jsx(k.Divider,{sx:{flexGrow:1}})]}),h.jsxs(k.Stack,{flexDirection:"row",gap:2,sx:{mt:2},children:[h.jsx(k.Button,{variant:"outlined",onClick:re,startIcon:h.jsx(Q.ImageSearchOutlined,{}),sx:{width:"100%"},children:"Browse gallery"}),m&&h.jsx(B9,{src:u.url,style:{width:"100%",margin:0}})]})]})]})};function Yf(){return(Yf=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function eE(t,e){if(t==null)return{};var n,i,r={},s=Object.keys(t);for(i=0;i<s.length;i++)e.indexOf(n=s[i])>=0||(r[n]=t[n]);return r}function nm(t){var e=E.useRef(t),n=E.useRef(function(i){e.current&&e.current(i)});return e.current=t,n.current}var im=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t<e?e:t},ah=function(t){return"touches"in t},Nx=function(t){return t&&t.ownerDocument.defaultView||self},zN=function(t,e,n){var i=t.getBoundingClientRect(),r=ah(e)?(function(s,a){for(var o=0;o<s.length;o++)if(s[o].identifier===a)return s[o];return s[0]})(e.touches,n):e;return{left:im((r.pageX-(i.left+Nx(t).pageXOffset))/i.width),top:im((r.pageY-(i.top+Nx(t).pageYOffset))/i.height)}},GN=function(t){!ah(t)&&t.preventDefault()},U9=E.memo(function(t){var e=t.onMove,n=t.onKey,i=eE(t,["onMove","onKey"]),r=E.useRef(null),s=nm(e),a=nm(n),o=E.useRef(null),l=E.useRef(!1),c=E.useMemo(function(){var p=function(g){GN(g),(ah(g)?g.touches.length>0:g.buttons>0)&&r.current?s(zN(r.current,g,o.current)):_(!1)},m=function(){return _(!1)};function _(g){var b=l.current,y=Nx(r.current),v=g?y.addEventListener:y.removeEventListener;v(b?"touchmove":"mousemove",p),v(b?"touchend":"mouseup",m)}return[function(g){var b=g.nativeEvent,y=r.current;if(y&&(GN(b),!(function(T,x){return x&&!ah(T)})(b,l.current)&&y)){if(ah(b)){l.current=!0;var v=b.changedTouches||[];v.length&&(o.current=v[0].identifier)}y.focus(),s(zN(y,b,o.current)),_(!0)}},function(g){var b=g.which||g.keyCode;b<37||b>40||(g.preventDefault(),a({left:b===39?.05:b===37?-.05:0,top:b===40?.05:b===38?-.05:0}))},_]},[a,s]),u=c[0],d=c[1],f=c[2];return E.useEffect(function(){return f},[f]),E.createElement("div",Yf({},i,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:r,onKeyDown:d,tabIndex:0,role:"slider"}))}),Kw=function(t){return t.filter(Boolean).join(" ")},$9=function(t){var e=t.color,n=t.left,i=t.top,r=i===void 0?.5:i,s=Kw(["react-colorful__pointer",t.className]);return E.createElement("div",{className:s,style:{top:100*r+"%",left:100*n+"%"}},E.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},Li=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n},EQ=function(t){return xQ(Ix(t))},Ix=function(t){return t[0]==="#"&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?Li(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:t.length===8?Li(parseInt(t.substring(6,8),16)/255,2):1}},vQ=function(t){return CQ(TQ(t))},SQ=function(t){var e=t.s,n=t.v,i=t.a,r=(200-e)*n/100;return{h:Li(t.h),s:Li(r>0&&r<200?e*n/100/(r<=100?r:200-r)*100:0),l:Li(r/2),a:Li(i,2)}},Ox=function(t){var e=SQ(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},TQ=function(t){var e=t.h,n=t.s,i=t.v,r=t.a;e=e/360*6,n/=100,i/=100;var s=Math.floor(e),a=i*(1-n),o=i*(1-(e-s)*n),l=i*(1-(1-e+s)*n),c=s%6;return{r:Li(255*[i,o,a,a,l,i][c]),g:Li(255*[l,i,i,o,a,a][c]),b:Li(255*[a,a,l,i,i,o][c]),a:Li(r,2)}},Dg=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},CQ=function(t){var e=t.r,n=t.g,i=t.b,r=t.a,s=r<1?Dg(Li(255*r)):"";return"#"+Dg(e)+Dg(n)+Dg(i)+s},xQ=function(t){var e=t.r,n=t.g,i=t.b,r=t.a,s=Math.max(e,n,i),a=s-Math.min(e,n,i),o=a?s===e?(n-i)/a:s===n?2+(i-e)/a:4+(e-n)/a:0;return{h:Li(60*(o<0?o+6:o)),s:Li(s?a/s*100:0),v:Li(s/255*100),a:r}},kQ=E.memo(function(t){var e=t.hue,n=t.onChange,i=Kw(["react-colorful__hue",t.className]);return E.createElement("div",{className:i},E.createElement(U9,{onMove:function(r){n({h:360*r.left})},onKey:function(r){n({h:im(e+360*r.left,0,360)})},"aria-label":"Hue","aria-valuenow":Li(e),"aria-valuemax":"360","aria-valuemin":"0"},E.createElement($9,{className:"react-colorful__hue-pointer",left:e/360,color:Ox({h:e,s:100,v:100,a:1})})))}),wQ=E.memo(function(t){var e=t.hsva,n=t.onChange,i={backgroundColor:Ox({h:e.h,s:100,v:100,a:1})};return E.createElement("div",{className:"react-colorful__saturation",style:i},E.createElement(U9,{onMove:function(r){n({s:100*r.left,v:100-100*r.top})},onKey:function(r){n({s:im(e.s+100*r.left,0,100),v:im(e.v-100*r.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Li(e.s)+"%, Brightness "+Li(e.v)+"%"},E.createElement($9,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:Ox(e)})))}),q9=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0},AQ=function(t,e){return t.toLowerCase()===e.toLowerCase()||q9(Ix(t),Ix(e))};function DQ(t,e,n){var i=nm(n),r=E.useState(function(){return t.toHsva(e)}),s=r[0],a=r[1],o=E.useRef({color:e,hsva:s});E.useEffect(function(){if(!t.equal(e,o.current.color)){var c=t.toHsva(e);o.current={hsva:c,color:e},a(c)}},[e,t]),E.useEffect(function(){var c;q9(s,o.current.hsva)||t.equal(c=t.fromHsva(s),o.current.color)||(o.current={hsva:s,color:c},i(c))},[s,t,i]);var l=E.useCallback(function(c){a(function(u){return Object.assign({},u,c)})},[]);return[s,l]}var NQ=typeof window<"u"?E.useLayoutEffect:E.useEffect,IQ=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},jN=new Map,OQ=function(t){NQ(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!jN.has(e)){var n=e.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,jN.set(e,n);var i=IQ();i&&n.setAttribute("nonce",i),e.head.appendChild(n)}},[])},RQ=function(t){var e=t.className,n=t.colorModel,i=t.color,r=i===void 0?n.defaultColor:i,s=t.onChange,a=eE(t,["className","colorModel","color","onChange"]),o=E.useRef(null);OQ(o);var l=DQ(n,r,s),c=l[0],u=l[1],d=Kw(["react-colorful",e]);return E.createElement("div",Yf({},a,{ref:o,className:d}),E.createElement(wQ,{hsva:c,onChange:u}),E.createElement(kQ,{hue:c.h,onChange:u,className:"react-colorful__last-control"}))},MQ={defaultColor:"000",toHsva:EQ,fromHsva:function(t){return vQ({h:t.h,s:t.s,v:t.v,a:1})},equal:AQ},LQ=function(t){return E.createElement(RQ,Yf({},t,{colorModel:MQ}))},PQ=/^#?([0-9A-F]{3,8})$/i,FQ=function(t){var e=t.color,n=e===void 0?"":e,i=t.onChange,r=t.onBlur,s=t.escape,a=t.validate,o=t.format,l=t.process,c=eE(t,["color","onChange","onBlur","escape","validate","format","process"]),u=E.useState(function(){return s(n)}),d=u[0],f=u[1],p=nm(i),m=nm(r),_=E.useCallback(function(b){var y=s(b.target.value);f(y),a(y)&&p(l?l(y):y)},[s,l,a,p]),g=E.useCallback(function(b){a(b.target.value)||f(s(n)),m(b)},[n,s,a,m]);return E.useEffect(function(){f(s(n))},[n,s]),E.createElement("input",Yf({},c,{value:o?o(d):d,spellCheck:"false",onChange:_,onBlur:g}))},HN=function(t){return"#"+t},BQ=function(t){var e=t.prefixed,n=t.alpha,i=eE(t,["prefixed","alpha"]),r=E.useCallback(function(a){return a.replace(/([^0-9A-F]+)/gi,"").substring(0,n?8:6)},[n]),s=E.useCallback(function(a){return(function(o,l){var c=PQ.exec(o),u=c?c[1].length:0;return u===3||u===6||!!l&&u===4||!!l&&u===8})(a,n)},[n]);return E.createElement(FQ,Yf({},i,{escape:r,format:e?HN:void 0,process:HN,validate:s}))};const VN={width:24,height:24};function UQ({paletteColors:t,isLocked:e,onToggleLock:n,onChange:i}){const r=fe.useTheme(),s=t.slice(30);return h.jsxs(k.Stack,{spacing:1,children:[h.jsx("div",{style:{height:1,width:"100%",margin:"8px 0",backgroundColor:r.palette.grey[400]}}),h.jsxs(k.Box,{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"4px",children:[s.map((a,o)=>h.jsx(k.Button,{sx:{...VN,backgroundColor:a,border:"1px solid",margin:"0!important",borderColor:r.palette.grey[50],minWidth:24,display:"inline-flex","&:hover":{backgroundColor:a,borderColor:"grey.500"}},onClick:()=>i&&i(a)},o+29)),n&&h.jsx(k.Button,{onClick:n,sx:{backgroundColor:"transparent",border:"1px solid",...VN,minWidth:24,margin:"0!important",borderColor:e?r.palette.error.main:r.palette.divider,display:"inline-flex",color:e?r.palette.error.main:r.palette.text.secondary,"&:hover":{backgroundColor:e?r.palette.error.light+"20":"action.hover",borderColor:e?r.palette.error.main:r.palette.text.secondary}},title:e?"Unlock recent colors":"Lock recent colors",children:e?h.jsx(Q.Lock,{fontSize:"small"}):h.jsx(Q.LockOpen,{fontSize:"small"})})]})]})}const $Q={p:1,".react-colorful__pointer ":{width:16,height:16},".react-colorful__saturation":{mb:1,borderRadius:"8px"},".react-colorful__last-control":{borderRadius:"8px"},".react-colorful__hue-pointer":{width:"4px",borderRadius:"8px",height:24,cursor:"col-resize"},".react-colorful__saturation-pointer":{cursor:"all-scroll"},input:{padding:1,border:"1px solid",borderColor:"grey.300",borderRadius:"8px",width:"100%"}},WN=(t,e)=>{if(!t||t.trim()==="")return e;const i=e.slice(-5),r=e.slice(0,30),s=i.filter(o=>o!==t&&o!==""),a=[t,...s].slice(0,5);for(;a.length<5;)a.push("");return[...r,...a]};function mu({value:t,nullable:e,onChange:n}){const[i,r]=E.useState(t||"#000000"),[s,a]=E.useState(null),{paletteColors:o,isLocked:l}=nK(),[c,u]=E.useState(!1),d=fe.useTheme(),f=E.useCallback(b=>{if(l)return;s&&clearTimeout(s);const y=setTimeout(()=>{const v=WN(b,o);Tv({paletteColors:v})},300);a(y)},[s,l,o]),p=()=>{const b=!l;if(Tv({isLocked:b}),!b&&i){const y=WN(i,o);Tv({isLocked:b,paletteColors:y})}},m=b=>{u(!0),r(b)},_=()=>{n(i),f(i)},g=b=>{r(b),n(b),f(b)};return E.useEffect(()=>{t!==i&&r(t||"#000000")},[t]),E.useEffect(()=>()=>{s&&clearTimeout(s)},[s]),h.jsxs(k.Stack,{spacing:1,sx:$Q,children:[h.jsx(LQ,{color:i,onChange:m,onMouseUp:_,onTouchEnd:_,onMouseLeave:b=>c?_():null}),h.jsx(UQ,{isLocked:l,onToggleLock:p,paletteColors:o,value:t,nullable:e,onChange:b=>{b?(r(b),n(b),f(b)):n(null)}}),h.jsxs(k.Box,{pt:1,display:"flex",gap:1,alignItems:"center",children:[h.jsx(BQ,{prefixed:!0,color:i,onChange:g,style:{flex:1,backgroundColor:d.palette.background.paper,color:d.palette.text.primary,padding:"1px 4px",fontSize:"12px"}}),e&&h.jsx(k.Button,{onClick:()=>n&&n(null),sx:{backgroundColor:"transparent",width:24,height:24,minWidth:24,margin:"0!important",borderColor:d.palette.divider,display:"inline-flex","&:hover":{backgroundColor:"action.hover",borderColor:d.palette.text.secondary}},children:h.jsx(Q.FormatColorReset,{color:"primary",fontSize:"small"})})]})]})}function z9({label:t,defaultValue:e,onChange:n,nullable:i,compact:r=!1,...s}){const[a,o]=E.useState(null),[l,c]=E.useState(e),{t:u}=It.useTranslation("inspector");E.useEffect(()=>{l!==e&&c(e)},[e]);const d=b=>{o(b.currentTarget)},f=r?{border:"1px solid",borderColor:"cadet.400",width:28,height:28,borderRadius:"8px",bgcolor:"#FFFFFF"}:{border:t?"1px solid":"",borderColor:"cadet.400",width:"100%",height:36,paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",borderRadius:"8px",bgcolor:"#FFFFFF"},p=b=>{c(b),n(b)},m=()=>!i||typeof l!="string"||l.trim().length===0?null:h.jsx(k.Tooltip,{disableInteractive:!0,arrow:!0,title:u("inputs.background.reset"),placement:"left",children:h.jsx(k.Box,{sx:{minWidth:24,lineHeight:1,flexShrink:0,pr:"4px",display:"grid",placeItems:"center"},onClick:()=>p(null),children:h.jsx(Q.FormatColorReset,{sx:{color:"primary.main"}})})}),_=l?h.jsx(k.ButtonBase,{onClick:d,sx:{...f,bgcolor:l}}):h.jsx(k.ButtonBase,{onClick:d,sx:{...f},children:h.jsx(Q.AddOutlined,{fontSize:"small"})}),g=h.jsx(k.Menu,{anchorEl:a,open:!!a,onClose:()=>o(null),sx:{"& .MuiPaper-root":{boxShadow:"0 4px 6px rgba(0, 0, 0, 0.4);",borderRadius:1,maxWidth:"200px",transform:"translateX(-100%) !important;"}},MenuListProps:{sx:{height:"auto",padding:0}},children:h.jsx(mu,{value:l||"",nullable:i,onChange:b=>p(b)})});return r?h.jsxs(h.Fragment,{children:[_,g]}):h.jsxs(tr,{children:[h.jsx(Sn,{label:t}),h.jsxs(k.Stack,{direction:"row",alignContent:"center",spacing:1,children:[_,m()]}),g]})}function iu(t){return h.jsx(z9,{...t,nullable:!1})}function xv(t){return h.jsx(z9,{...t,nullable:!0})}const YN=({mobile:t=!1,label:e,borderColor:n,borderTop:i,borderBottom:r,borderLeft:s,borderRight:a,onChange:o})=>{const{t:l}=It.useTranslation("inspector"),c=()=>t?{top:"borderTopMobile",bottom:"borderBottomMobile",left:"borderLeftMobile",right:"borderRightMobile"}:{top:"borderTop",bottom:"borderBottom",left:"borderLeft",right:"borderRight"},u=I=>{const A=Object.values(I);return A.every(N=>N===A[0])},d=c(),f={[d.top]:i??0,[d.bottom]:r??0,[d.left]:s??0,[d.right]:a??0},[p,m]=E.useState(()=>u(f)?"all":"custom"),[_,g]=E.useState(n??"#000000"),[b,y]=E.useState(f);E.useEffect(()=>{n!==_&&g(n??"#000000");const I={[d.top]:i??0,[d.bottom]:r??0,[d.left]:s??0,[d.right]:a??0};Object.keys(I).some(N=>b[N]!==I[N])&&(y(I),u(I)||m("custom"))},[n,i,r,s,a,t]);const v=()=>{if(p!=="all"){const I=b[d.top]??0;x(I),m("all")}else m("custom")},T=I=>{g(I),o({borderColor:I,...b})},x=I=>{const A={[d.top]:I,[d.bottom]:I,[d.left]:I,[d.right]:I};y(A),o({...A,borderColor:_})},w=(I,A)=>{y(M=>({...M,[A]:I}));const N={...b,borderColor:_,[A]:I};u(N)||m("custom"),o(N)};return h.jsxs("div",{children:[h.jsxs(k.Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[h.jsx(Sn,{label:e}),h.jsxs(k.Stack,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(iu,{defaultValue:_,onChange:T,compact:!0}),h.jsx(k.Tooltip,{title:l(p==="all"?"border.unlockBorders":"border.lockBordersTogether"),children:h.jsx(k.IconButton,{size:"small",onClick:v,sx:{color:p==="all"?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:p==="all"?h.jsx(Q.Lock,{fontSize:"small"}):h.jsx(Q.LockOpen,{fontSize:"small"})})})]})]}),p==="all"&&h.jsx(qc,{label:"",iconLabel:h.jsx(Q.BorderOuterOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.top],onChange:x}),p==="custom"&&h.jsxs(k.Stack,{spacing:2,children:[h.jsx(qc,{label:"",iconLabel:h.jsx(Q.BorderTopOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.top],onChange:I=>w(I,d.top)}),h.jsx(qc,{label:"",iconLabel:h.jsx(Q.BorderBottomOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.bottom],onChange:I=>w(I,d.bottom)}),h.jsx(qc,{label:"",iconLabel:h.jsx(Q.BorderLeftOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.left],onChange:I=>w(I,d.left)}),h.jsx(qc,{label:"",iconLabel:h.jsx(Q.BorderRightOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[d.right],onChange:I=>w(I,d.right)})]})]})},bf=[{key:"INHERIT",label:"Inherit",value:"inherit"},{key:"LATO",label:"Lato",value:'"Lato", sans-serif'},{key:"MERRIWEATHER",label:"Merriweather",value:'"Merriweather", serif'},{key:"MONTSERRAT",label:"Montserrat",value:'"Montserrat", sans-serif'},{key:"OPEN_SANS",label:"Open Sans",value:'"Open Sans", sans-serif'},{key:"OSWALD",label:"Oswald",value:'"Oswald", sans-serif'},{key:"PACIFICO",label:"Pacifico",value:'"Pacifico", cursive'},{key:"PLAYFAIR",label:"Playfair",value:'"Playfair", serif'},{key:"ROBOTO",label:"Roboto",value:'"Roboto", sans-serif'},{key:"MODERN_SANS",label:"Modern sans",value:'"Helvetica Neue", "Arial Nova", "Nimbus Sans", Arial, sans-serif'}],Ul={FAMILY:"MODERN_SANS",SIZE:16},Ko=an(["MODERN_SANS","LATO","MERRIWEATHER","MONTSERRAT","OPEN_SANS","OSWALD","PACIFICO","PLAYFAIR","ROBOTO","INHERIT"]).nullable().optional(),KN=t=>bf.find(e=>e.key===t)?.value;function Qr(t){const e=jY();let n=KN(t);return n||(n=KN(e?.fontFamily),n||"inherit")}const qQ=bf.map(t=>h.jsx(k.MenuItem,{value:t.key,sx:{fontFamily:t.value},children:t.label},t.key));function G9({label:t,onChange:e,defaultValue:n}){const i="INHERIT",[r,s]=E.useState(n??i);E.useEffect(()=>{r!==n&&s(n??i)},[n]);const a=o=>{const l=o?.target?.value;s(l),e(l===null?null:l)};return h.jsxs(tr,{children:[h.jsx(Sn,{label:t}),h.jsx(tc,{style:{width:"100%"},value:r,size:"small",onChange:a,children:qQ})]})}function QN({label:t,defaultValue:e=16,onChange:n,maxValue:i,minValue:r,step:s}){const[a,o]=E.useState(e);E.useEffect(()=>{a!==e&&o(e)},[e]);const l=c=>{o(c),n(c)};return h.jsxs(tr,{children:[h.jsx(Sn,{label:t}),h.jsx(jn,{iconLabel:h.jsx(Q.TextFieldsOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:a,setValue:l,units:"px",step:s??2,min:r||8,max:i||48})]})}function dc({label:t,children:e,defaultValue:n,onChange:i}){const[r,s]=E.useState(n);return E.useEffect(()=>{n!==r&&s(n)},[n]),h.jsxs(tr,{children:[h.jsx(Sn,{label:t}),h.jsx(k.Box,{sx:{...F9,paddingLeft:"0px",paddingRight:"0px"},children:h.jsx(k.ToggleButtonGroup,{exclusive:!0,fullWidth:!0,value:r,size:"small",sx:{width:"100%"},onChange:(a,o)=>{if(typeof o!="string")throw new Error("RadioGroupInput can only receive string values");s(o),i(o)},children:e})})]})}function zQ({label:t,defaultValue:e,onChange:n}){const[i,r]=E.useState(e);return E.useEffect(()=>{i!==e&&r(e)},[e]),h.jsxs(dc,{label:t,defaultValue:i,onChange:s=>{r(s),n(s)},children:[h.jsx(k.ToggleButton,{value:"normal",children:"Regular"}),h.jsx(k.ToggleButton,{value:"bold",children:"Bold"})]})}const XN=({label:t,defaultValue:e,onChange:n})=>{const{t:i}=It.useTranslation("inspector"),r=t??i("inputs.common.height");return h.jsx(jn,{label:r,iconLabel:h.jsx(Q.HeightOutlined,{sx:{color:"text.secondary"}}),units:"px",step:1,min:1,max:100,marks:!1,value:e??1,setValue:n})},GQ=[{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)"}],jQ=GQ.map(t=>h.jsx(k.MenuItem,{value:t.key,children:t.label},t.key));function HQ({label:t,onChange:e,defaultValue:n}){const i="INHERIT",[r,s]=E.useState(n?.toString()??i);E.useEffect(()=>{r!==n?.toString()&&s(n?.toString()??i)},[n]);const a=o=>{const l=o?.target?.value;s(l),e(l===i?null:parseFloat(l))};return h.jsxs(tr,{children:[h.jsx(Sn,{label:t}),h.jsxs(tc,{style:{width:"100%"},value:r,size:"small",onChange:a,children:[h.jsx(k.MenuItem,{value:i,children:"Default value"}),jQ]})]})}function JN({label:t,defaultValue:e,onChange:n}){const{t:r}=It.useTranslation("inspector"),[s,a]=E.useState(()=>e||{top:0,left:0,bottom:0,right:0});E.useEffect(()=>{e&&(e.top!==s.top||e.left!==s.left||e.bottom!==s.bottom||e.right!==s.right)&&a(e)},[e]);const[o,l]=E.useState(!1);function c(d,f){let p;o?p={top:f,bottom:f,left:f,right:f}:p={...s,[d]:f},a(p),n(p)}const u=()=>{if(!o){const d={top:s.top,bottom:s.top,left:s.top,right:s.top};a(d),n(d)}l(!o)};return h.jsxs(tr,{children:[h.jsxs(k.Stack,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[h.jsx(Sn,{label:t}),h.jsx(k.Tooltip,{title:r(o?"inputs.responsiveSize.unlockTooltip":"inputs.responsiveSize.lockTooltip"),children:h.jsx(k.IconButton,{size:"small",onClick:u,sx:{marginTop:"0!important",color:o?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:o?h.jsx(Q.Lock,{fontSize:"small"}):h.jsx(Q.LockOpen,{fontSize:"small"})})})]}),o?h.jsx(jn,{iconLabel:h.jsx("span",{children:r("inputs.responsiveSize.allSides")}),value:s.top,setValue:d=>c("top",d),units:"px",step:16,min:0,max:120,marks:!0}):h.jsxs(h.Fragment,{children:[h.jsx(jn,{iconLabel:h.jsx(Q.AlignVerticalTopOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:s.top,setValue:d=>c("top",d),units:"px",step:16,min:0,max:120,marks:!0}),h.jsx(jn,{iconLabel:h.jsx(Q.AlignVerticalBottomOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:s.bottom,setValue:d=>c("bottom",d),units:"px",step:16,min:0,max:120,marks:!0}),h.jsx(jn,{iconLabel:h.jsx(Q.AlignHorizontalLeftOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:s.left,setValue:d=>c("left",d),units:"px",step:16,min:0,max:120,marks:!0}),h.jsx(jn,{iconLabel:h.jsx(Q.AlignHorizontalRightOutlined,{sx:{fontSize:16,color:"text.primary"}}),value:s.right,setValue:d=>c("right",d),units:"px",step:16,min:0,max:120,marks:!0})]})]})}const VQ=({label:t,defaultValue:e,onChange:n,maxValue:i=600,shapeSteps:r=8})=>{const{t:s}=It.useTranslation("inspector"),[a,o]=E.useState(()=>typeof e=="object"&&e!==null?"rectangle":e||"rectangle"),[l,c]=E.useState(()=>typeof e=="object"&&e!==null?e:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0}),[u,d]=E.useState(!1);E.useEffect(()=>{typeof e=="object"&&e!==null?(c(e),o("rounded")):e&&o(e)},[e]);const f=b=>{o(b),n(b==="rounded"?l:b)},p=(b,y)=>{let v;u?v={topLeft:y,topRight:y,bottomLeft:y,bottomRight:y}:v={...l,[b]:y},c(v),n(v)},m=()=>{if(!u){const b={topLeft:l.topLeft,topRight:l.topLeft,bottomLeft:l.topLeft,bottomRight:l.topLeft};c(b),n(b)}d(!u)},_=i,g=t||s("shape.label");return h.jsxs(h.Fragment,{children:[h.jsxs(dc,{label:g,defaultValue:a,onChange:f,children:[h.jsx(k.ToggleButton,{value:"rectangle",children:s("shape.square")}),h.jsx(k.ToggleButton,{value:"pill",children:s("shape.pill")}),h.jsx(k.ToggleButton,{value:"rounded",children:s("shape.custom")})]}),a==="rounded"&&h.jsxs(k.Stack,{spacing:2,alignItems:"flexStart",pb:1,children:[h.jsxs(k.Stack,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[h.jsx(Sn,{label:s("shape.borderRadius")}),h.jsx(k.Tooltip,{title:s(u?"shape.unlockTooltip":"shape.lockTooltip"),children:h.jsx(k.IconButton,{size:"small",onClick:m,sx:{marginTop:"0!important",color:u?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:u?h.jsx(Q.Lock,{fontSize:"small"}):h.jsx(Q.LockOpen,{fontSize:"small"})})})]}),u?h.jsx(h.Fragment,{children:h.jsx(jn,{iconLabel:h.jsx(Q.RoundedCorner,{sx:{fontSize:16}}),value:l.topRight,setValue:b=>p("topLeft",b),units:"px",min:0,step:r,marks:r>1,max:_})}):h.jsxs(h.Fragment,{children:[h.jsx(jn,{iconLabel:h.jsx(Q.RoundedCorner,{sx:{fontSize:16,transform:"rotate(0deg)"}}),value:l.topLeft,setValue:b=>p("topLeft",b),units:"px",min:0,step:r,marks:r>1,max:_}),h.jsx(jn,{iconLabel:h.jsx(Q.RoundedCorner,{sx:{fontSize:16,transform:"rotate(270deg)"}}),value:l.topRight,setValue:b=>p("topRight",b),units:"px",min:0,step:r,marks:r>1,max:_}),h.jsx(jn,{iconLabel:h.jsx(Q.RoundedCorner,{sx:{fontSize:16,transform:"rotate(180deg)"}}),value:l.bottomLeft,setValue:b=>p("bottomLeft",b),units:"px",min:0,step:r,marks:r>1,max:_}),h.jsx(jn,{iconLabel:h.jsx(Q.RoundedCorner,{sx:{fontSize:16,transform:"rotate(90deg)"}}),value:l.bottomRight,setValue:b=>p("bottomRight",b),units:"px",min:0,step:r,marks:r>1,max:_})]})]})]})};function ZN({label:t,defaultValue:e,onChange:n}){const[i,r]=E.useState(e??"left");return E.useEffect(()=>{e!==i&&r(e??"left")},[e]),h.jsxs(tr,{children:[h.jsx(Sn,{label:t}),h.jsxs(dc,{label:"",defaultValue:i,onChange:s=>{r(s),n(s)},children:[h.jsx(k.ToggleButton,{value:"left",children:h.jsx(Q.FormatAlignLeftOutlined,{fontSize:"small"})}),h.jsx(k.ToggleButton,{value:"center",children:h.jsx(Q.FormatAlignCenterOutlined,{fontSize:"small"})}),h.jsx(k.ToggleButton,{value:"right",children:h.jsx(Q.FormatAlignRightOutlined,{fontSize:"small"})})]})]})}const eI=({label:t,defaultValue:e,onChange:n,step:i,...r})=>{const{t:s}=It.useTranslation("inspector"),a=t??s("inputs.common.width");return h.jsx(jn,{label:a,iconLabel:h.jsx(Q.HeightOutlined,{sx:{color:"text.primary",transform:"rotate(90deg)"}}),units:"%",step:i,min:1,max:100,marks:!1,value:e??1,setValue:n,...r})};function WQ({name:t,value:e,onChange:n,shapeMaxValue:i,shapeSteps:r}){const s=Vn(),a=Ru(),{t:o}=It.useTranslation("inspector"),l=(p,m)=>{const _=e[p],g=e[m];return _??g},c=(p,m)=>{n(m?{...e,...m,[t]:p}:{...e,[t]:p})},u=p=>{n({...e,...p})},f=(()=>{switch(t){case"textAlignMobile":return l("textAlignMobile","textAlign");case"mobilePadding":return l("mobilePadding","padding");case"fontSizeMobile":return l("fontSizeMobile","fontSize")??16;case"heightMobile":return l("heightMobile","height");case"widthMobile":return l("widthMobile","width");case"borderMobile":return{borderTop:l("borderTopMobile","borderTop"),borderBottom:l("borderBottomMobile","borderBottom"),borderLeft:l("borderLeftMobile","borderLeft"),borderRight:l("borderRightMobile","borderRight")};default:return e[t]??null}})();switch(t){case"backgroundColor":return h.jsx(xv,{label:o("properties.backgroundColor"),defaultValue:f??a?.canvasColor,onChange:c});case"background":return h.jsx(yQ,{defaultValue:f,onChange:(p,m)=>c(p,m),values:e});case"borderColor":return h.jsx(xv,{label:o("properties.border"),defaultValue:f,onChange:c});case"borderRadius":return h.jsx(qc,{iconLabel:h.jsx(Q.RoundedCornerOutlined,{}),units:"px",step:4,marks:!0,min:0,max:48,label:o("properties.borderRadius"),defaultValue:f,onChange:c});case"color":return h.jsx(xv,{label:o("properties.color"),defaultValue:f,onChange:c});case"fontFamily":return h.jsx(G9,{label:o("properties.fontFamily"),defaultValue:f,onChange:c});case"fontWeight":return h.jsx(zQ,{label:o("properties.fontWeight"),defaultValue:f,onChange:c});case"textAlign":return s==="desktop"&&h.jsx(ZN,{label:o("properties.alignment"),defaultValue:f,onChange:c});case"textAlignMobile":return s!="desktop"&&h.jsx(ZN,{label:o("properties.alignment"),defaultValue:f,onChange:c});case"padding":return s==="desktop"&&h.jsx(JN,{label:o("properties.padding"),defaultValue:f,onChange:c});case"mobilePadding":return s!="desktop"&&h.jsx(JN,{label:o("properties.padding"),defaultValue:f,onChange:c});case"fontSize":return s==="desktop"&&h.jsx(QN,{maxValue:80,step:8,label:o("properties.fontSize"),defaultValue:f??16,onChange:c});case"fontSizeMobile":return s!="desktop"&&h.jsx(QN,{maxValue:80,step:8,label:o("properties.fontSize"),defaultValue:f,onChange:c});case"lineHeight":return h.jsx(HQ,{label:o("properties.lineHeight"),defaultValue:f??1.5,onChange:c});case"shape":return h.jsx(VQ,{shapeSteps:r,maxValue:i,label:o("properties.shape"),defaultValue:f,onChange:c});case"height":return s==="desktop"&&h.jsx(XN,{label:o("properties.height"),defaultValue:f,onChange:c});case"heightMobile":return s!="desktop"&&h.jsx(XN,{label:o("properties.height"),defaultValue:f,onChange:c});case"width":return s==="desktop"&&h.jsx(eI,{label:o("properties.width"),defaultValue:f,onChange:c});case"widthMobile":return s!="desktop"&&h.jsx(eI,{label:o("properties.width"),defaultValue:f,onChange:c});case"border":return s==="desktop"&&h.jsx(YN,{label:o("properties.border"),borderColor:e.borderColor??null,borderTop:e.borderTop??null,borderBottom:e.borderBottom??null,borderLeft:e.borderLeft??null,borderRight:e.borderRight??null,onChange:u});case"borderMobile":return s!="desktop"&&h.jsx(YN,{mobile:!0,label:o("properties.border"),borderColor:e.borderColor??null,borderTop:f.borderTop??null,borderBottom:f.borderBottom??null,borderLeft:f.borderLeft??null,borderRight:f.borderRight??null,onChange:u});default:return null}}function pr({names:t,value:e,onChange:n,disabledCSSValidation:i=!1,shapeMaxValue:r,shapeSteps:s}){const a=Za(),o=g9();return(i||a=="css"||ub.includes(o||""))&&h.jsx(h.Fragment,{children:t.map(l=>h.jsx(WQ,{shapeMaxValue:r,shapeSteps:s,name:l,value:e||{},onChange:n},l))})}const Qw=t=>t?["http","mailto:","tel:","sms:","whatsapp:"].some(n=>t.startsWith(n))?t:`//${t}`:"#",vb=Ze({top:we(),bottom:we(),right:we(),left:we()}).optional().nullable(),Lu=t=>t?{top:t?.top??0,right:t?.right??0,bottom:t?.bottom??0,left:t?.left??0}:{top:0,right:0,bottom:0,left:0},YQ=Ze({topLeft:we().min(0).optional(),topRight:we().min(0).optional(),bottomLeft:we().min(0).optional(),bottomRight:we().min(0).optional()}),Xw=Ze({style:Ze({padding:vb,mobilePadding:vb,background:Xe().nullable().optional(),backgroundColor:Xe().regex(/^#[0-9a-fA-F]{6}$/).optional().nullable(),textAlign:an(["center","left","right"]).optional().nullable(),textAlignMobile:an(["center","left","right"]).optional().nullable(),shape:nu([an(["rectangle","pill"]),YQ]).optional().nullable()}),props:Ze({touched:Bo().optional().nullable(),scale:we().optional().nullable(),size:Xe().optional().nullable(),sizeMobile:Xe().optional().nullable(),width:we().optional().nullable(),widthMobile:we().optional().nullable(),scaleMobile:we().optional().nullable(),touchedMobile:Bo().optional().nullable(),original_width:we().optional().nullable(),height:we().optional().nullable(),url:Xe().optional().nullable(),alt:Xe().optional().nullable(),linkHref:Xe().optional().nullable(),contentAlignment:an(["top","middle","bottom"]).optional().nullable()}).optional().nullable()}).passthrough();function j9({style:t,props:e,blockId:n}){const i=Vn(),r=Xy(),s={padding:Lu(i=="desktop"?t?.padding:t?.mobilePadding??t?.padding),backgroundColor:t?.backgroundColor??void 0,textAlign:i=="desktop"?t?.textAlign??void 0:t?.textAlignMobile??t?.textAlign??void 0},a=(g,b)=>g==="fill"?"100%":g==="scale"?`${b}%`:e?.width,o=e?.linkHref??null,l=i=="desktop"?a(e?.size,e?.scale):a(e?.sizeMobile,e?.scaleMobile),c={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},u=t?.background??"",d=t?.backgroundColor,f=d?Yo(u,d):u,p=g=>{const b=g.currentTarget;setTimeout(()=>{if(!e?.width&&b.offsetWidth){const y=b.offsetWidth;T9(n,{...e,width:y})}},100)},m=h.jsxs(h.Fragment,{children:[h.jsx("img",{alt:e?.alt??"",src:e?.url??"",width:l,onLoad:p,style:{width:l,height:"auto",outline:"none",border:"none",textDecoration:"none",verticalAlign:e?.contentAlignment??"middle",display:"inline-block",maxWidth:"100%",opacity:r.uploading&&r.id===n?.5:1,transition:"opacity 0.2s ease-in-out",borderRadius:Eb(t)}}),r.uploading&&r.id===n&&h.jsx("div",{style:c,children:h.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:h.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})]}),_=vt(n);return o?h.jsx(pi,{className:`${_}`,padding:s.padding,background:f,align:s.textAlign,width:"100%",children:h.jsx("a",{href:Qw(o),style:{textDecoration:"none",display:"block",width:"100%",height:"100%"},target:"_blank",children:m})}):h.jsx(pi,{className:`${_}`,padding:s.padding,background:f,align:s.textAlign,width:"100%",children:m})}const H9=({data:t,setData:e,blockId:n})=>{const{t:i}=It.useTranslation("inspector"),[r,s]=E.useState(!1),[a,o]=E.useState(window.emailAIGeneration||!1),[,l]=E.useState(null),[c,u]=E.useState(""),[d,f]=E.useState(!1),[p,m]=E.useState(""),[_,g]=E.useState(!1),b=E.useRef(null),y=Wf(),[v,T]=E.useState(null);E.useEffect(()=>{const O=window.__emailBuilderCustomImageProvider;O&&(T(O),setTimeout(()=>{n&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:n,currentImageUrl:t.props?.url||null,alt:t.props?.alt||null}}))},100))},[]);const x=O=>{const P=Xw.safeParse(O);P.success?(e(P.data),l(null)):l(P.error)},w=(O,P)=>{const j=O.toLowerCase(),ee=j.includes(".svg")||j.includes("svg"),X=P&&(P.includes("image/svg+xml")||P.includes("svg"));return ee||!!X},I=async O=>{try{f(!0),m(""),g(!1);try{new URL(O)}catch{return m(i("inputs.image.invalidUrl")),!1}const P=new AbortController,j=setTimeout(()=>P.abort(),1e4);try{const ee=await fetch(O,{method:"HEAD",signal:P.signal});if(clearTimeout(j),!ee.ok)return m(`HTTP ${ee.status}: ${ee.statusText}`),!1;const X=ee.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(re=>X&&X.toLowerCase().includes(re.toLowerCase()))?(w(O,X)&&g(!0),m(""),!0):(m(i("inputs.image.notImage")),!1)}catch(ee){return clearTimeout(j),ee.name==="AbortError"?(m(i("inputs.image.timeout")),!1):new Promise(X=>{const _e=new Image,se=setTimeout(()=>{m(i("inputs.image.timeout")),X(!1)},1e4);_e.onload=()=>{clearTimeout(se),w(O)&&g(!0),m(""),X(!0)},_e.onerror=()=>{clearTimeout(se),m("Cannot access image - CORS policy, network error, or invalid URL"),X(!1)},_e.src=O})}}catch{return m("Unexpected error occurred while validating URL"),!1}finally{f(!1)}},A=async()=>{c.trim()&&await I(c.trim())&&(x({...t,props:{...t.props,url:c.trim()}}),u(""))},N=O=>{O.key==="Enter"&&A()},M=O=>{u(O.target.value),p&&m(""),_&&g(!1)},C=O=>{const P=["image/png","image/jpeg","image/gif"],ee=O.filter(_e=>P.includes(_e.type)&&_e.size<=5242880);if(ee.length!==O.length&&alert(i("inputs.common.invalidFiles")),ee.length===0)return;const X=ee.map(_e=>new Promise(se=>{const re=new FileReader;re.onload=le=>se(le.target?.result),re.readAsDataURL(_e)}));Promise.all(X).then(_e=>{const se={images:_e,id:n||""};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:se})),Zd(!0,n||"")})},F=O=>{O.preventDefault(),s(!0)},D=O=>{const P=O.currentTarget.getBoundingClientRect(),j=O.clientX,ee=O.clientY;(j<P.left||j>=P.right||ee<P.top||ee>=P.bottom)&&s(!1)},q=O=>{O.preventDefault(),s(!1);const P=Array.from(O.dataTransfer.files);P.length>0&&C(P)},z=()=>{const O=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(O)};return E.useEffect(()=>{const O=_e=>{const{detail:se}=_e;Zd(!1,se.id||""),x({...t,props:{...t.props,url:se.url}}),E9(!1)},P=_e=>{Zd(_e?.detail?.uploading??!1,_e?.detail?.id??"")},j=_e=>{const{detail:se}=_e;o(se)},ee=()=>{b?.current?.click()},X=_e=>{const{detail:se}=_e;x({...t,props:{...t.props,url:se}})};return window.addEventListener("email-builder-set-image",X),window.addEventListener("email-builder-upload-image-receive",O),window.addEventListener("email-builder-ai-generation",j),window.addEventListener("email-builder-upload-file",ee),window.addEventListener("email-builder-toggle-upload-file",P),()=>{window.removeEventListener("email-builder-toggle-upload-file",P),window.removeEventListener("email-builder-ai-generation",j),window.removeEventListener("email-builder-upload-image-receive",O),window.removeEventListener("email-builder-set-image",X),window.removeEventListener("email-builder-upload-file",ee)}},[t]),E.useEffect(()=>{t.props?.url&&g(w(t.props.url))},[t.props?.url]),h.jsxs(k.Stack,{gap:1,children:[v?h.jsx(k.Box,{sx:{mb:2},children:v}):h.jsx("div",{style:{display:"flex",gap:8},children:y?h.jsxs(tr,{children:[h.jsx(Sn,{label:i("inputs.image.urlLabel")}),h.jsxs(k.Stack,{direction:"row",spacing:1,children:[h.jsx(k.TextField,{fullWidth:!0,placeholder:i("inputs.image.urlPlaceholder"),value:c,onChange:M,onKeyPress:N,error:!!p,disabled:d,sx:{...Zy,"& .MuiOutlinedInput-root":{"& fieldset":{borderColor:p?"error.main":"#E5E5E5"},"&:hover fieldset":{borderColor:p?"error.main":"primary.main"},"&.Mui-focused fieldset":{borderColor:p?"error.main":"primary.main"}}}}),h.jsx(k.Button,{variant:"contained",onClick:A,disabled:!c.trim()||d,sx:{minWidth:"auto",px:2,position:"relative"},children:d?h.jsx(k.CircularProgress,{size:20,color:"inherit"}):i("inputs.common.add")})]}),p&&h.jsx(k.Alert,{severity:"error",sx:{mt:1,fontSize:"0.875rem","& .MuiAlert-message":{padding:"4px 0",display:"flex",flexDirection:"column",justifyContent:"space-around"}},children:p}),_&&h.jsx(k.Alert,{severity:"warning",sx:{mt:1,marginX:"4px",fontSize:"0.875rem",top:0,"& .MuiAlert-message":{padding:"4px 0",display:"flex",flexDirection:"column",justifyContent:"space-around"}},action:h.jsx(k.IconButton,{"aria-label":i("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{g(!1)},children:h.jsx(Q.Close,{fontSize:"inherit"})}),children:i("inputs.common.svgWarning")}),h.jsx("img",{src:t.props?.url,alt:t.props?.alt,style:{width:"70%",margin:"0.5rem auto 0 auto",objectFit:"contain",display:"block",aspectRatio:"1 / 1",height:"auto",borderRadius:"8px",border:"2px solid #E5E5E5",backgroundColor:"#fff",backgroundImage:"linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%), linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%)",backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"}})]}):h.jsxs(h.Fragment,{children:[h.jsx("img",{src:t.props?.url,alt:t.props?.alt,style:{width:"50%",objectFit:"contain",aspectRatio:"1 / 1",height:"auto",borderRadius:"8px",border:"2px solid #E5E5E5",backgroundColor:"#ffffff",backgroundImage:"linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%), linear-gradient(45deg, #d0d0d0 25%, transparent 25%, transparent 75%, #d0d0d0 75%)",backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"}}),h.jsxs(k.Box,{onDragOver:F,onDragLeave:D,onDrop:q,sx:{width:"100%",border:"2px solid",borderColor:r?"primary.main":"#E5E5E5",borderRadius:"8px",padding:4,textAlign:"center",bgcolor:r?"primary.50":"background.paper",transition:"all 0.2s ease"},children:[h.jsx(k.Box,{sx:{display:"flex",justifyContent:"center",mb:2},children:h.jsx(Q.PhotoOutlined,{sx:{fontSize:32,color:"primary"}})}),h.jsxs("label",{style:{cursor:"pointer"},children:[h.jsx("input",{ref:b,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:O=>{const P=O.target.files;P&&P.length>0&&C(Array.from(P))}}),h.jsx(k.Typography,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:i("inputs.common.uploadFile")}),h.jsxs(k.Typography,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",i("inputs.common.dragAndDrop")]})]}),h.jsx(k.Typography,{variant:"body2",sx:{color:"text.secondary",mt:1},children:i("inputs.common.fileInfo")})]})]})}),!v&&!y&&_&&h.jsx(k.Alert,{severity:"warning",sx:{fontSize:"0.875rem","& .MuiAlert-message":{padding:"4px 0",display:"flex",flexDirection:"column",justifyContent:"space-around"}},children:"SVG images may not display correctly in Outlook email clients. Consider using PNG or JPG format for better compatibility."}),!v&&v9()&&!y&&h.jsxs(h.Fragment,{children:[h.jsxs(k.Stack,{direction:"row",alignItems:"center",spacing:1,children:[h.jsx(k.Divider,{sx:{flexGrow:1}}),h.jsx(k.Typography,{sx:{color:"text.secondary"},children:"or"}),h.jsx(k.Divider,{sx:{flexGrow:1}})]}),h.jsxs(k.Stack,{flexDirection:"row",gap:2,children:[h.jsx(k.Button,{variant:"outlined",onClick:z,startIcon:h.jsx(Q.ImageSearchOutlined,{}),sx:{color:"mainColor.main",borderColor:"mainColor.light","&:hover":{borderColor:"mainColor.main",backgroundColor:"action.hover"}},style:{width:"100%"},children:"Browse gallery"}),a&&h.jsx(B9,{src:t.props?.url,style:{width:"100%",margin:0}})]})]})]})};function KQ({data:t,setData:e}){const[,n]=E.useState(null),i=uc(),{t:r}=It.useTranslation("inspector"),s=c=>{const u=L9.safeParse(c);u.success?(e(u.data),n(null)):n(u.error)},a=t.props?.size??Vc.size,o=t.props?.alt??Vc.alt;t.props?.shape??Vc.shape;const l=Za();return E.useEffect(()=>{const c=u=>{const{detail:d}=u;s({...t,props:{...t.props,alt:o}}),s({...t,props:{...t.props,imageUrl:d}})};return window.addEventListener("email-builder-set-image",c),()=>{window.removeEventListener("email-builder-set-image",c)}},[t,s]),h.jsxs(Is,{title:r("inputs.panels.avatar.title"),children:[l=="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsx(H9,{data:t,setData:c=>e({...t,props:{...t.props,imageUrl:c.props.url,alt:o}}),blockId:i}),h.jsx(qc,{label:r("inputs.panels.avatar.sizeLabel"),iconLabel:h.jsx(Q.AspectRatioOutlined,{sx:{color:"text.secondary"}}),units:"px",step:3,min:32,max:256,defaultValue:a,onChange:c=>{s({...t,props:{...t.props,size:c}})}}),h.jsx(hu,{label:r("inputs.panels.avatar.altLabel"),defaultValue:o,onChange:c=>{s({...t,props:{...t.props,alt:c}})}})]}),h.jsx(pr,{names:["textAlign","backgroundColor","padding","mobilePadding"],value:t.style,onChange:c=>s({...t,style:c})})]})}const kv=Xe().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),tI=Ze({top:we(),bottom:we(),right:we(),left:we()}).optional().nullable(),QQ=t=>({top:t?.top??0,right:t?.right??0,bottom:t?.bottom??0,left:t?.left??0}),XQ=Ze({topLeft:we().min(0).optional(),topRight:we().min(0).optional(),bottomLeft:we().min(0).optional(),bottomRight:we().min(0).optional()}),nI=Ze({top:we().min(0).optional(),bottom:we().min(0).optional(),left:we().min(0).optional(),right:we().min(0).optional()}),V9=Ze({style:Ze({backgroundColor:kv,fontSize:we().min(0).optional().nullable(),fontSizeMobile:we().min(0).optional().nullable(),fontFamily:Ko,background:Xe().nullable().optional(),fontWeight:an(["bold","normal"]).optional().nullable(),textAlign:an(["left","center","right"]).optional().nullable(),textAlignMobile:an(["left","center","right"]).optional().nullable(),padding:tI,mobilePadding:tI,shape:nu([an(["rectangle","pill"]),XQ]).optional().nullable()}).passthrough().optional().nullable(),props:Ze({buttonBackgroundColor:kv,buttonTextColor:kv,fullWidth:Bo().optional().nullable(),fullWidthMobile:Bo().optional().nullable(),size:nu([an(["x-small","small","medium"]),nI]).optional().nullable(),sizeMobile:nu([an(["x-small","small","medium"]),nI]).optional().nullable(),text:Xe().optional().nullable(),url:Xe().optional().nullable()}).optional().nullable()}).passthrough();function iI(t){if(typeof t!="string")return t;switch(t){case"x-small":return{top:4,bottom:4,right:8,left:8};case"small":return{top:8,bottom:8,right:12,left:12};case"medium":default:return{top:12,bottom:12,left:20,right:20}}}const Il={text:"",url:"",fullWidth:!1,size:"medium",buttonBackgroundColor:"#999999"};function W9({style:t,props:e,blockId:n}){const i=Ru(),r=Vn(),s=e?.text??Il.text,a=e?.url??Il.url,o=r==="desktop"?e?.fullWidth??!1:e?.fullWidthMobile??e?.fullWidth??!1,l=e?.buttonTextColor??i.textColor,c=e?.buttonBackgroundColor??Il.buttonBackgroundColor,u={backgroundColor:t?.backgroundColor??void 0,textAlign:r=="desktop"?t?.textAlign??void 0:t?.textAlignMobile??t?.textAlign,padding:QQ(r=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},d={color:l,fontSize:r=="desktop"?t?.fontSize??16:t?.fontSizeMobile??t?.fontSize??16,fontFamily:Qr(t?.fontFamily),fontWeight:t?.fontWeight??"bold",display:"inline-block",textDecoration:"none"},f={color:t?.borderColor??void 0,top:r=="desktop"?t?.borderTop??void 0:t?.borderTopMobile??t?.borderTop,bottom:r=="desktop"?t?.borderBottom??void 0:t?.borderBottomMobile??t?.borderBottom,left:r=="desktop"?t?.borderLeft??void 0:t?.borderLeftMobile??t?.borderLeft,right:r=="desktop"?t?.borderRight??void 0:t?.borderRightMobile??t?.borderRight},p=t?.background??"",m=t?.backgroundColor,_=m?Yo(p,m):p,g=vt(n);return h.jsx(pi,{background:_,backgroundColor:m,padding:u.padding,align:u.textAlign,width:"100%",className:`c${g}`,children:h.jsx("a",{href:Qw(a),target:"_blank",className:`abtn-${g}`,children:h.jsx(pi,{className:g,padding:r=="desktop"?iI(e?.size):iI(e?.sizeMobile??e?.size),borderRadius:Eb(t),background:c,backgroundColor:c,isParent:!1,align:"center",width:o?"100%":void 0,border:f,children:h.jsx("span",{className:`btn${g}`,style:d,children:s})})})})}function JQ({size:t,sizeMobile:e,onChange:n,label:i,maxValue:r=100,paddingSteps:s=8}){const{t:a}=It.useTranslation("inspector"),o=i??a("inputs.common.size"),l=Vn(),[c,u]=E.useState(()=>{const y=l==="desktop"?t:e!==void 0?e:t;return typeof y=="object"&&y!==null?y:{top:8,bottom:8,left:16,right:16}}),[d,f]=E.useState(!1);E.useEffect(()=>{const y=l==="desktop"?t:e!==void 0?e:t;typeof y=="object"&&y!==null&&u(y)},[t,e,l]);const p=()=>{const y=l==="desktop"?t:e!==void 0?e:t;return typeof y=="object"&&y!==null?"custom":y},m=y=>{if(l==="desktop"){const v={size:y==="custom"?c:y};e==null&&(v.sizeMobile=y==="custom"?c:y),n(v)}else n({sizeMobile:y==="custom"?c:y})},_=(y,v)=>{let T;d?T={top:v,bottom:v,left:v,right:v}:T={...c,[y]:v},u(T),n(l==="desktop"?{size:T}:{sizeMobile:T})},g=()=>{if(!d){const v={top:16,bottom:16,left:16,right:16};u(v),n(l==="desktop"?{size:v}:{sizeMobile:v})}f(!d)},b=p();return h.jsxs(k.Stack,{spacing:2,children:[h.jsxs(dc,{label:o,defaultValue:b,onChange:m,children:[h.jsx(k.ToggleButton,{value:"x-small",children:a("inputs.responsiveSize.options.xSmall")}),h.jsx(k.ToggleButton,{value:"small",children:a("inputs.responsiveSize.options.small")}),h.jsx(k.ToggleButton,{value:"medium",children:a("inputs.responsiveSize.options.medium")}),h.jsx(k.ToggleButton,{value:"custom",children:a("inputs.responsiveSize.options.custom")})]}),b==="custom"&&h.jsxs(k.Stack,{spacing:2,alignItems:"flexStart",pb:1,children:[h.jsxs(k.Stack,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[h.jsx(Sn,{label:a("inputs.responsiveSize.customPadding")}),h.jsx(k.Tooltip,{title:a(d?"inputs.responsiveSize.unlockTooltip":"inputs.responsiveSize.lockTooltip"),children:h.jsx(k.IconButton,{size:"small",onClick:g,sx:{marginTop:"0!important",color:d?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:d?h.jsx(Q.Lock,{fontSize:"small"}):h.jsx(Q.LockOpen,{fontSize:"small"})})})]}),d?h.jsx(jn,{iconLabel:a("inputs.responsiveSize.allSides"),value:c.top,setValue:y=>_("top",y),units:"px",min:0,step:s,marks:s>1,max:r}):h.jsxs(h.Fragment,{children:[h.jsx(jn,{iconLabel:h.jsx(Q.AlignVerticalTopOutlined,{sx:{fontSize:16}}),value:c.top,setValue:y=>_("top",y),units:"px",min:0,step:s,marks:s>1,max:r}),h.jsx(jn,{iconLabel:h.jsx(Q.AlignVerticalBottomOutlined,{sx:{fontSize:16}}),value:c.bottom,setValue:y=>_("bottom",y),units:"px",min:0,step:s,marks:s>1,max:r}),h.jsx(jn,{iconLabel:h.jsx(Q.AlignHorizontalLeftOutlined,{sx:{fontSize:16}}),value:c.left,setValue:y=>_("left",y),units:"px",min:0,step:s,marks:s>1,max:r}),h.jsx(jn,{iconLabel:h.jsx(Q.AlignHorizontalRightOutlined,{sx:{fontSize:16}}),value:c.right,setValue:y=>_("right",y),units:"px",min:0,step:s,marks:s>1,max:r})]})]})]})}function ZQ({fullWidth:t,fullWidthMobile:e,onChange:n,label:i="Width"}){const r=Vn(),{t:s}=It.useTranslation("inspector"),a=()=>r==="desktop"?t:e!==void 0?e:t,o=c=>{const u=c==="FULL_WIDTH";if(r==="desktop"){const d={fullWidth:u};e==null&&(d.fullWidthMobile=u),n(d)}else n({fullWidthMobile:u})},l=a();return h.jsxs(dc,{label:i,defaultValue:l?"FULL_WIDTH":"AUTO",onChange:o,children:[h.jsx(k.ToggleButton,{value:"FULL_WIDTH",children:s("inputs.width.full")}),h.jsx(k.ToggleButton,{value:"AUTO",children:s("inputs.width.auto")})]})}function eX({data:t,setData:e}){const[,n]=E.useState(null),i=Ru(),{t:r}=It.useTranslation("inspector"),s=_=>{const g=V9.safeParse(_);g.success?(e(g.data),n(null)):n(g.error)},a=t.props?.text??Il.text,o=t.props?.url??Il.url,l=t.props?.fullWidth??Il.fullWidth,c=t.props?.size??Il.size,u=t.props?.buttonTextColor??i.textColor,d=t.props?.buttonBackgroundColor??Il.buttonBackgroundColor,f=t.props?.fullWidthMobile,p=t.props?.sizeMobile,m=Za();return h.jsxs(Is,{title:r("inputs.panels.button.title"),children:[m=="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsx(pr,{disabledCSSValidation:!0,names:["fontFamily","fontSize","fontSizeMobile","fontWeight"],value:t.style,onChange:_=>s({...t,style:_})}),h.jsx(hu,{label:r("inputs.panels.button.textLabel"),defaultValue:a,onChange:_=>s({...t,props:{...t.props,text:_}})}),h.jsx(hu,{label:r("inputs.panels.button.targetLabel"),placeholder:r("inputs.panels.button.targetPlaceholder"),defaultValue:o,onChange:_=>s({...t,props:{...t.props,url:_}})}),h.jsx(ZQ,{label:r("properties.width"),fullWidth:l,fullWidthMobile:f,onChange:_=>s({...t,props:{...t.props,..._}})}),h.jsx(JQ,{size:c,sizeMobile:p,onChange:_=>s({...t,props:{...t.props,..._}})}),h.jsx(iu,{label:r("inputs.panels.button.textColor"),defaultValue:u,onChange:_=>s({...t,props:{...t.props,buttonTextColor:_}})}),h.jsx(iu,{label:r("inputs.panels.button.buttonColor"),defaultValue:d,onChange:_=>s({...t,props:{...t.props,buttonBackgroundColor:_}})})]}),h.jsx(pr,{names:["shape","textAlign","textAlignMobile","backgroundColor","border","borderMobile","padding","mobilePadding"],value:t.style,shapeMaxValue:80,onChange:_=>s({...t,style:_})})]})}const tX=Vw([we().nullish(),we().nullish(),we().nullish()]).optional().nullable(),Y9=Ze({style:Ze({background:Xe().nullable().optional(),backgroundColor:Xe().nullable().optional(),padding:vb,mobilePadding:vb}).optional().nullable(),props:Ze({fixedWidths:tX,columnsCount:nu([yb(2),yb(3)]).optional().nullable(),layout:Xe().optional().nullable(),contentAlignment:an(["top","middle","bottom"]).optional().nullable(),contentAlignmentMobile:an(["top","middle","bottom"]).optional().nullable()}).optional().nullable()}).passthrough(),nX={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},oh={columnsCount:2,contentAlignment:"middle"};function Rx({style:t,columns:e,props:n,blockId:i}){const r=Vn(),s=Xy(),a={padding:Lu(r=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},o={columnsCount:n?.columnsCount??oh.columnsCount,contentAlignment:r=="desktop"?n?.contentAlignment??oh.contentAlignment:n?.contentAlignmentMobile??n?.contentAlignment??oh.contentAlignment,fixedWidths:n?.fixedWidths,blockId:i},l=t?.background??"",c=t?.backgroundColor,u=c?Yo(l,c):l,d=vt(i);return h.jsxs(pi,{background:u,backgroundColor:c,className:`${d}`,padding:a.padding,width:"100%",children:[s.uploading&&s.id===i?h.jsx("div",{style:nX,children:h.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:h.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}):h.jsx(h.Fragment,{}),h.jsx("table",{border:0,cellSpacing:"0",cellPadding:"0",style:{width:"100%"},children:h.jsx("tbody",{style:{width:"100%"},children:h.jsxs("tr",{style:{width:"100%"},children:[h.jsx(wv,{index:0,props:o,columns:e}),h.jsx(wv,{index:1,props:o,columns:e}),h.jsx(wv,{index:2,props:o,columns:e})]})})})]})}function wv({index:t,props:e,columns:n}){const i=e?.contentAlignment??oh.contentAlignment;if((e?.columnsCount??oh.columnsCount)===2&&t===2)return null;const s={boxSizing:"border-box",verticalAlign:i,width:`${e.fixedWidths?.[t]}%`??void 0},a=(n&&n[t])??null,o=e.blockId?vt(e.blockId):"";return h.jsx("td",{className:`col${o}`,style:s,children:a})}const iX=Y9.shape.props.unwrap().unwrap().shape,Jw=Ze({style:Y9.shape.style,props:Ze({...iX,columns:Vw([Ze({childrenIds:tu(Xe())}),Ze({childrenIds:tu(Xe())}),Ze({childrenIds:tu(Xe())})])}).optional().nullable()}).passthrough(),rX=(t,e,n)=>{if(!t||!document)return;const i=vt(t),r=document.querySelector(`.${i}`);if(!r)return;const s=r.parentElement;if(!s)return;const a=Math.ceil(s.getBoundingClientRect().width);n.props?.touched||n.props?.width!==a&&e({...n,props:{...n.props,width:a}})},sX=t=>{if(!t||!document)return;const e=vt(t),n=document.querySelector(`.${e}`);if(!n)return;const i=n.parentElement;if(!i)return;const r=Math.ceil(i.getBoundingClientRect().width);return r||null},aX={desktop:"contentAlignment",mobile:"contentAlignmentMobile"};function oX({data:t,updateData:e}){const{t:n}=It.useTranslation("inspector"),i=Vn(),r=aX[i]||"contentAlignment",s=t.props?.[r]??t.props?.contentAlignment,a=o=>{e({...t,props:{...t.props,[r]:o}})};return h.jsxs(dc,{label:n("inputs.alignment.label"),defaultValue:s,onChange:a,children:[h.jsx(k.ToggleButton,{value:"top",children:h.jsx(Q.VerticalAlignTopOutlined,{fontSize:"small"})}),h.jsx(k.ToggleButton,{value:"middle",children:h.jsx(Q.VerticalAlignCenterOutlined,{fontSize:"small"})}),h.jsx(k.ToggleButton,{value:"bottom",children:h.jsx(Q.VerticalAlignBottomOutlined,{fontSize:"small"})})]})}const _p={grid:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(100px, 1fr))",gap:"16px",width:"100%"},card:{cursor:"pointer",border:"1px solid #e5e7eb",borderRadius:"8px",backgroundColor:"primary"},cardContent:{padding:"8px"},layoutPreview:{display:"flex",gap:"4px",height:"30px",width:"100%",justifyContent:"space-between"}},lX=({defaultValue:t,onChange:e,columns:n})=>{const{t:i}=It.useTranslation("inspector"),[r,s]=E.useState(t||"layout-50-50"),a=k.useTheme();E.useEffect(()=>{r!==t&&s(t==="layout-33-34-33"?"layout-33-33-33":t)},[t]);const o=[{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]}],l=[{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-30-30-40",distribution:[30,30,40]},{id:"layout-40-20-40",distribution:[40,20,40]}],[c,u]=E.useState(l),d=(f,p)=>{s(f),e({layout:f,fixedWidths:p})};return E.useEffect(()=>{if(n===2)u(o),o.findIndex(f=>f.id==t)===-1&&d("layout-50-50",[50,50,null]);else{if(u(l),t==="layout-33-34-33"){d("layout-33-33-33",[33.34,33.33,33.33]);return}l.findIndex(f=>f.id==t)===-1&&d("layout-33-33-33",[33.34,33.33,33.33])}},[n]),E.useEffect(()=>{t==="layout-33-34-33"&&d("layout-33-33-33",[33.34,33.33,33.33])},[t]),h.jsxs(tr,{children:[h.jsx(Sn,{label:i("inputs.layout.label")}),h.jsx("div",{style:_p.grid,children:c.map((f,p)=>h.jsx("div",{onClick:()=>d(f.id,f.distribution),style:{..._p.card,gridColumn:p===0?"span 2":void 0,border:r===f.id?`2px solid ${a.palette.secondary.main}`:_p.card.border},children:h.jsx("div",{style:_p.cardContent,children:h.jsx("div",{style:_p.layoutPreview,children:f.distribution.map((m,_)=>h.jsx("div",{style:{width:`${m}%`,backgroundColor:r===f.id?a.palette.secondary.main:"#e5e7eb",borderRadius:"4px",transition:"background-color 0.2s ease",display:"grid",placeItems:"center",fontSize:"12px",color:r===f.id?"white":"black"}},_))})})},f.id))})]})};function cX({data:t,setData:e}){const[,n]=E.useState(null),[i,r]=E.useState(t.props?.columnsCount??2),s=Za(),a=Vn(),{t:o}=It.useTranslation("inspector"),l=p=>{const m=ye.getState().document,_=p.filter(g=>m[g]?.type==="Image");a==="desktop"&&_.map(g=>rX(g,e,m[g].data))},c=p=>{const m=Jw.safeParse(p);m.success?(m.data.props.columns.map(_=>l(_.childrenIds)),e(m.data),i&&m.data.props?.columnsCount!==i&&r(m.data.props?.columnsCount??2),n(null)):(console.error("Error on columns: ",m.error),n(m.error))},u={layout:"layout-50-50",fixedWidths:[50,50,null],columnsCount:2},d={layout:"layout-33-34-33",fixedWidths:[33,34,33],columnsCount:3},f=p=>{const m=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:[...t.props.columns];return p==="2"?{...u,columns:m}:{...d,columns:m}};return h.jsxs(Is,{title:o("inputs.panels.columns.title"),children:[s=="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsxs(dc,{label:o("inputs.panels.columns.countLabel"),defaultValue:t.props?.columnsCount===2?"2":"3",onChange:p=>{const m=f(p);c({...t,props:{...t.props,...m}})},children:[h.jsx(k.ToggleButton,{style:{fontWeight:"bold"},value:"2",children:"2"}),h.jsx(k.ToggleButton,{style:{fontWeight:"bold"},value:"3",children:"3"})]}),h.jsx(lX,{columns:t.props?.columnsCount??3,defaultValue:t.props?.layout,onChange:({layout:p,fixedWidths:m})=>{const _=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:t.props.columns;c({...t,props:{...t.props,layout:p,fixedWidths:m,columns:_}})}})]}),s=="css"&&h.jsxs(h.Fragment,{children:[h.jsx(oX,{data:t,updateData:e}),h.jsx(pr,{names:["backgroundColor","background","padding","mobilePadding"],value:t.style,onChange:p=>c({...t,style:p})})]})]})}const rI=Xe().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),sI=Ze({top:we(),bottom:we(),right:we(),left:we()}).optional().nullable(),uX=Ze({topLeft:we().min(0).optional(),topRight:we().min(0).optional(),bottomLeft:we().min(0).optional(),bottomRight:we().min(0).optional()}),aI={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},dX=Ze({style:Ze({backgroundColor:rI,background:Xe().nullable().optional(),borderColor:rI,borderRadius:we().optional().nullable(),borderTop:we().optional().nullable(),borderBottom:we().optional().nullable(),borderLeft:we().optional().nullable(),borderRight:we().optional().nullable(),borderTopMobile:we().optional().nullable(),borderBottomMobile:we().optional().nullable(),borderLeftMobile:we().optional().nullable(),borderRightMobile:we().optional().nullable(),shape:nu([an(["rectangle","pill"]),uX]).optional().nullable(),padding:sI,mobilePadding:sI}).optional().nullable()}).passthrough();function K9({style:t,children:e,blockId:n}){const i=Vn(),r=Xy(),s={border:{color:t?.borderColor??void 0,top:i=="desktop"?t?.borderTop??void 0:t?.borderTopMobile??t?.borderTop,bottom:i=="desktop"?t?.borderBottom??void 0:t?.borderBottomMobile??t?.borderBottom,left:i=="desktop"?t?.borderLeft??void 0:t?.borderLeftMobile??t?.borderLeft,right:i=="desktop"?t?.borderRight??void 0:t?.borderRightMobile??t?.borderRight},padding:Lu(i=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},a=t?.background??"",o=t?.backgroundColor,l=o?Yo(a,o):a,c=vt(n);return e?h.jsx(pi,{className:`${c}`,background:l,backgroundColor:t?.backgroundColor,borderRadius:Eb(t),padding:s.padding,width:"100%",border:s.border,children:h.jsxs(h.Fragment,{children:[r.uploading&&r.id===n&&h.jsx("div",{style:aI,children:h.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:h.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}),e]})}):h.jsx(pi,{className:`${c}`,background:l,backgroundColor:o,borderRadius:Eb(t),padding:s.padding,width:"100%",border:s.border,children:h.jsx("div",{children:r.uploading&&r.id===n&&h.jsx("div",{style:aI,children:h.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-loader-circle",style:{width:"32px",height:"32px",animation:"1s linear infinite spin",stroke:"currentColor"},children:h.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})})})}const Q9=Ze({style:dX.shape.style,props:Ze({childrenIds:tu(Xe()).optional().nullable()}).optional().nullable()}).passthrough();function X9({data:t,setData:e}){const[,n]=E.useState(null),{t:i}=It.useTranslation("inspector"),r=s=>{const a=Q9.safeParse(s);a.success?(e(a.data),n(null)):n(a.error)};return h.jsx(Is,{title:i("inputs.panels.container.title"),children:h.jsx(pr,{names:["backgroundColor","background","border","borderMobile","shape","padding","mobilePadding"],value:t.style,shapeSteps:30,onChange:s=>r({...t,style:s})})})}const fX=Xe().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),oI=Ze({top:we(),bottom:we(),right:we(),left:we()}).optional().nullable(),J9=Ze({style:Ze({background:Xe().nullable().optional(),backgroundColor:fX,padding:oI,mobilePadding:oI,height:we().optional().nullable(),heightMobile:we().optional().nullable(),color:Xe().optional().nullable(),width:we().optional().nullable(),widthMobile:we().optional().nullable(),textAlign:Xe().optional().nullable(),textAlignMobile:Xe().optional().nullable()}).passthrough().optional().nullable()}).passthrough(),Oc={height:1,color:"#333333",width:100,textAlign:"left"};function Z9({style:t,blockId:e}){const n=Vn(),i=Lu(n==="desktop"?t?.padding:t?.mobilePadding??t?.padding),r=n==="desktop"?t?.height??Oc.height:t?.heightMobile??t?.height??Oc.height,s=t?.color??Oc.color,a=n==="desktop"?(t?.width??Oc.width)+"%":(t?.widthMobile??t?.width??Oc.width)+"%",o=n==="desktop"?t?.textAlign??Oc.textAlign:t?.textAlignMobile??t?.textAlign??Oc.textAlign,l=t?.background??"",c=t?.backgroundColor??"",u=c?Yo(l,c):l,d=vt(e);return h.jsx(pi,{className:`c${d}`,background:u,backgroundColor:c,width:"100%",padding:i,align:o,children:h.jsx(pi,{display:"inline-block",className:`${d}`,background:s,backgroundColor:c,width:a,padding:{top:r,bottom:0,left:0,right:0},isParent:!1,children:h.jsx("div",{})})})}function e5({data:t,setData:e}){const[,n]=E.useState(null),{t:i}=It.useTranslation("inspector"),r=s=>{const a=J9.safeParse(s);a.success?(e(a.data),n(null)):n(a.error)};return h.jsx(Is,{title:i("inputs.panels.divider.title"),children:h.jsx(pr,{names:["width","widthMobile","height","heightMobile","color","backgroundColor","textAlign","textAlignMobile","padding","mobilePadding"],value:t.style,onChange:s=>r({...t,style:s})})})}const bp=Xe().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),t5=Ze({backdropColor:bp,borderColor:bp,borderRadius:we().optional().nullable(),canvasColor:bp,textColor:bp,fontFamily:Ko,childrenIds:tu(Xe()).optional().nullable(),linkGlobal:Ze({linkColor:bp,underline:Bo()}).optional().nullable(),showVersion:Bo().optional().nullable()}),pX=({label:t,linkColor:e,underline:n=!1,onChange:i})=>{const[r,s]=E.useState(e??"#FF0000"),[a,o]=E.useState(n),l=k.useTheme(),{t:c}=It.useTranslation("inspector"),u=t??c("inputs.links.color"),d=a?"enabled":"disabled",f={width:"100%","& .MuiToggleButton-root":{flex:1,color:l.palette.text.primary,borderColor:l.palette.grey[300],minWidth:"40px","&.Mui-selected":{backgroundColor:l.palette.primary.main,color:l.palette.primary.contrastText,borderColor:l.palette.primary.main,"&:hover":{backgroundColor:l.palette.primary.dark}},"&:hover":{backgroundColor:l.palette.grey[100]}}};E.useEffect(()=>{e!==r&&s(e??"#FF0000")},[e]),E.useEffect(()=>{n!==a&&o(n)},[n]);const p=_=>{const g=_??"#FF0000";s(g),i({linkColor:g,underline:a})},m=(_,g)=>{if(!g)return;const b=g==="enabled";o(b),i({linkColor:r,underline:b})};return h.jsx(k.Stack,{spacing:2,children:h.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:"16px",gap:"16px"},children:[h.jsx(iu,{label:u,defaultValue:r,onChange:p}),h.jsxs("div",{children:[h.jsx(Sn,{label:c("inputs.links.underline")}),h.jsx(k.Box,{sx:{...F9,padding:0,mt:1},children:h.jsxs(k.ToggleButtonGroup,{value:d,exclusive:!0,size:"small",onChange:m,sx:f,children:[h.jsx(k.ToggleButton,{value:"enabled",children:h.jsx(k.Tooltip,{disableInteractive:!0,arrow:!0,title:c("inputs.links.underlineOn"),children:h.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 40 40",role:"img","aria-label":"aiia subrayado",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("title",{children:"aiia subrayado"}),h.jsx("rect",{width:"20",height:"20",fill:"none"}),h.jsx("text",{x:"50%",y:"26",textAnchor:"middle",fontFamily:"system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif",fontSize:"24",fill:"currentColor",children:"aiia"}),h.jsx("line",{x1:"6",y1:"31",x2:"34",y2:"31",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})})}),h.jsx(k.ToggleButton,{value:"disabled",children:h.jsx(k.Tooltip,{disableInteractive:!0,arrow:!0,title:c("inputs.links.underlineOff"),children:h.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 40 40",role:"img","aria-label":"aiia",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("title",{children:"aiia"}),h.jsx("rect",{width:"20",height:"20",fill:"none"}),h.jsx("text",{x:"50%",y:"26",textAnchor:"middle",fontFamily:"system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif",fontSize:"24",fill:"currentColor",children:"aiia"})]})})})]})})]})]})})},hX="email-builder-online",mX="3.4.29",Av={name:hX,version:mX};function n5({data:t,setData:e}){const[,n]=E.useState(null),{t:i}=It.useTranslation("inspector"),r=s=>{const a=t5.safeParse(s);a.success?(e(a.data),n(null)):n(a.error)};return h.jsxs(Is,{title:i("inputs.panels.emailLayout.title"),children:[h.jsx(iu,{label:i("inputs.panels.emailLayout.backgroundColor"),defaultValue:t.backdropColor??"#F5F5F5",onChange:s=>r({...t,backdropColor:s})}),h.jsx(iu,{label:i("inputs.panels.emailLayout.canvasColor"),defaultValue:t.canvasColor??"#FFFFFF",onChange:s=>r({...t,canvasColor:s})}),h.jsx(G9,{label:i("inputs.panels.emailLayout.fontFamily"),defaultValue:t.fontFamily||Ul.FAMILY,onChange:s=>r({...t,fontFamily:s})}),h.jsx(iu,{label:i("inputs.panels.emailLayout.textColor"),defaultValue:t.textColor??"#262626",onChange:s=>r({...t,textColor:s})}),h.jsx(pX,{label:i("inputs.panels.emailLayout.linksLabel"),linkColor:t.linkGlobal?.linkColor||"#000000",underline:t.linkGlobal?.underline||!1,onChange:s=>r({...t,linkGlobal:s})}),t.showVersion&&h.jsx(k.Box,{color:"text.secondary",sx:{display:"flex",justifyContent:"flex-end",mt:2},children:h.jsxs(k.Box,{sx:{textAlign:"right"},children:[h.jsxs(k.Typography,{variant:"body2",children:[i("inputs.panels.emailLayout.version"),": ",Av.version]}),h.jsx(k.Link,{href:`https://www.npmjs.com/package/${Av.name}`,target:"_blank",rel:"noopener noreferrer",sx:{fontSize:"0.875rem",mt:.5,display:"inline-block"},children:Av.name})]})})]})}const lI=Xe().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),gX=Ze({top:we(),bottom:we(),right:we(),left:we()}).optional().nullable(),_X=t=>t?`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`:void 0,i5=Ze({props:Ze({text:Xe().optional().nullable(),level:an(["h1","h2","h3"]).optional().nullable()}).optional().nullable(),style:Ze({color:lI,backgroundColor:lI,fontFamily:Ko,fontWeight:an(["bold","normal"]).optional().nullable(),textAlign:an(["left","center","right"]).optional().nullable(),padding:gX}).optional().nullable()}),Sb={level:"h2",text:""};function r5({props:t,style:e}){const n=t?.level??Sb.level,i=t?.text??Sb.text,r={color:e?.color??void 0,backgroundColor:e?.backgroundColor??void 0,fontWeight:e?.fontWeight??"bold",textAlign:e?.textAlign??void 0,margin:0,fontFamily:Qr(e?.fontFamily),fontSize:bX(n),padding:_X(e?.padding)};switch(n){case"h1":return h.jsx("h1",{style:r,children:i});case"h2":return h.jsx("h2",{style:r,children:i});case"h3":return h.jsx("h3",{style:r,children:i})}}function bX(t){switch(t){case"h1":return 32;case"h2":return 24;case"h3":return 20}}function yX({data:t,setData:e}){const[,n]=E.useState(null),{t:i}=It.useTranslation("inspector"),r=a=>{const o=i5.safeParse(a);o.success?(e(o.data),n(null)):n(o.error)},s=Za();return h.jsxs(Is,{title:i("inputs.panels.heading.title"),children:[s=="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsx(hu,{label:i("inputs.panels.heading.contentLabel"),rows:3,defaultValue:t.props?.text??Sb.text,onChange:a=>{r({...t,props:{...t.props,text:a}})}}),h.jsxs(dc,{label:i("inputs.panels.heading.levelLabel"),defaultValue:t.props?.level??Sb.level,onChange:a=>{r({...t,props:{...t.props,level:a}})},children:[h.jsx(k.ToggleButton,{value:"h1",children:"H1"}),h.jsx(k.ToggleButton,{value:"h2",children:"H2"}),h.jsx(k.ToggleButton,{value:"h3",children:"H3"})]})]}),h.jsx(pr,{names:["color","backgroundColor","fontFamily","fontWeight","textAlign","padding","mobilePadding"],value:t.style,onChange:a=>r({...t,style:a})})]})}const cI=Xe().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),EX=Ze({top:we(),bottom:we(),right:we(),left:we()}).optional().nullable(),vX=t=>t?`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`:void 0,s5=Ze({style:Ze({color:cI,backgroundColor:cI,fontFamily:Ko,fontSize:we().min(0).optional().nullable(),textAlign:an(["left","right","center"]).optional().nullable(),padding:EX}).optional().nullable(),props:Ze({contents:Xe().optional().nullable()}).optional().nullable()});function a5({style:t,props:e}){const n=e?.contents,i={color:t?.color??void 0,backgroundColor:t?.backgroundColor??void 0,fontFamily:Qr(t?.fontFamily),fontSize:t?.fontSize??void 0,textAlign:t?.textAlign??void 0,padding:vX(t?.padding)};return n?h.jsx("div",{style:i,dangerouslySetInnerHTML:{__html:n}}):h.jsx("div",{style:i})}function SX({data:t,setData:e}){const[,n]=E.useState(null),{t:i}=It.useTranslation("inspector"),r=a=>{const o=s5.safeParse(a);o.success?(e(o.data),n(null)):n(o.error)},s=Za();return h.jsxs(Is,{title:i("inputs.panels.html.title"),children:[s=="block-configuration"&&h.jsx(h.Fragment,{children:h.jsx(hu,{label:i("inputs.panels.html.contentLabel"),rows:5,defaultValue:t.props?.contents??"",onChange:a=>r({...t,props:{...t.props,contents:a}})})}),h.jsx(pr,{names:["color","backgroundColor","fontFamily","fontSize","textAlign","padding","mobilePadding"],value:t.style,onChange:a=>r({...t,style:a})})]})}const TX=(t,e,n)=>{const i=Vn();E.useEffect(()=>{const r=()=>{if(!t||!document||i=="mobile")return;const o=vt(t),l=document.querySelector(`.${o}`);if(!l)return;const c=l.parentElement;if(!c)return;const u=Math.ceil(c.getBoundingClientRect().width);n.props?.size===void 0||n.props?.size==="original"||n.props?.touched&&n.props?.width<=u||n.props?.width!==u&&!n.props?.touched&&e({...n,props:{...n.props,width:u}})};r();const s=new ResizeObserver(r),a=document.querySelector(`.${vt(t)}`);return a?.parentElement&&s.observe(a.parentElement),()=>{s.disconnect()}},[t,e,n,i])},CX=({defaultValue:t="original",scale:e=100,onChange:n})=>{const[i,r]=E.useState(t),[s,a]=E.useState(e);Vn();const o=k.useTheme(),{t:l}=It.useTranslation("inspector"),c={container:{width:"100%"},label:{color:o.palette.text.primary},toggleGroup:{width:"100%",backgroundColor:o.palette.background.paper,padding:"4px",borderRadius:"8px"},toggleButton:{flex:1,padding:"6px 16px",textTransform:"none",fontSize:"14px",color:o.palette.text.primary,"&.Mui-selected":{backgroundColor:o.palette.grey[200],color:o.palette.text.primary,"&:hover":{backgroundColor:o.palette.grey[300]}},"&:hover":{backgroundColor:o.palette.grey[100]}},sliderContainer:{marginTop:"16px",padding:"0 8px"},slider:{"& .MuiSlider-thumb":{backgroundColor:o.palette.primary.main,"&:hover":{boxShadow:`0 0 0 8px ${o.palette.primary.main}20`}},"& .MuiSlider-rail":{backgroundColor:o.palette.grey[300]},"& .MuiSlider-track":{backgroundColor:o.palette.primary.main}},scaleValue:{color:o.palette.text.secondary}};E.useEffect(()=>{(t!==i||e!==s)&&(t!==i&&r(t),t==="scale"&&a(e))},[t,e]);const u=(f,p)=>{p!==null&&(r(p),n&&n({mode:p,scale:p==="scale"?s:void 0}))},d=f=>{a(f),n&&n({mode:i,scale:f})};return h.jsxs(tr,{children:[h.jsx(Sn,{label:l("inputs.sizeSelector.label")}),h.jsxs(k.Box,{sx:c.container,children:[h.jsxs(k.ToggleButtonGroup,{value:i,exclusive:!0,onChange:u,sx:c.toggleGroup,children:[h.jsx(k.ToggleButton,{value:"original",sx:c.toggleButton,children:l("inputs.sizeSelector.contain")}),h.jsx(k.ToggleButton,{value:"fill",sx:c.toggleButton,children:l("inputs.sizeSelector.cover")}),h.jsx(k.ToggleButton,{value:"scale",sx:c.toggleButton,children:l("inputs.sizeSelector.scale")})]}),h.jsx(k.Collapse,{in:i==="scale",children:h.jsx(k.Box,{sx:c.sliderContainer,children:h.jsx(jn,{iconLabel:h.jsx(Q.WidthWideOutlined,{}),value:s,setValue:d,marks:!1,units:"%",min:1,max:100})})})]})]})};function xX({data:t,setData:e}){const[n,i]=E.useState(null),r=uc(),s=Za(),a=Vn(),{t:o}=It.useTranslation("inspector");TX(r||"",e,t),E.useEffect(()=>{r&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:r,currentImageUrl:t.props?.url||null,alt:t.props?.alt||null}}))},[r,t.props?.url,t.props?.alt]);const l=E.useCallback(_=>{const g=Xw.safeParse(_);g.success?JSON.stringify(t)!==JSON.stringify(g.data)&&(e(g.data),i(null)):i(g.error)},[t,e]),c=E.useCallback((_,g,b)=>{const y=sX(r)||Gd,v={..._.props};if(b&&(v.touchedMobile=!0),g.mode==="original"){const T=_.props?.original_width??null;return b?{...v,sizeMobile:g.mode,widthMobile:T}:{...v,size:g.mode,width:T,sizeMobile:v.touchedMobile?v.sizeMobile:g.mode,widthMobile:v.touchedMobile?v.widthMobile:T}}if(g.mode==="fill")return b?{...v,sizeMobile:g.mode,widthMobile:null}:{...v,size:g.mode,width:null,sizeMobile:v.touchedMobile?v.sizeMobile:g.mode,widthMobile:v.touchedMobile?v.widthMobile:null};if(g.mode==="scale"){const T=Math.ceil(y/100*g.scale);return b?{...v,sizeMobile:g.mode,scaleMobile:g.scale,widthMobile:T}:{...v,size:g.mode,scale:g.scale,width:T,sizeMobile:v.touchedMobile?v.sizeMobile:g.mode,scaleMobile:v.touchedMobile?v.scaleMobile:g.scale,widthMobile:v.touchedMobile?v.widthMobile:T}}return v},[r]),u=E.useCallback((_,g)=>{const b=c(t,_,g);l({...t,props:b})},[t,l,c]),d=E.useMemo(()=>a!=="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},[a,t.props?.touchedMobile,t.props?.sizeMobile,t.props?.size,t.props?.scaleMobile,t.props?.scale]),f=E.useCallback(_=>{l({...t,props:{...t.props,alt:_}})},[t,l]),p=E.useCallback(_=>{const g=_.trim().length===0?null:_.trim();l({...t,props:{...t.props,linkHref:g}})},[t,l]),m=E.useCallback(_=>{l({...t,style:_})},[t,l]);return h.jsxs(Is,{title:o("inputs.panels.image.title"),children:[s==="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsx(H9,{data:t,setData:e,blockId:r}),h.jsx(hu,{label:o("inputs.panels.image.altLabel"),placeholder:o("inputs.panels.image.altPlaceholder"),defaultValue:t.props?.alt??"",onChange:f}),h.jsx(hu,{label:o("inputs.panels.image.urlLabel"),placeholder:o("inputs.panels.image.urlPlaceholder"),defaultValue:t.props?.linkHref??"",onChange:p}),h.jsx(CX,{defaultValue:d.size,scale:d.scale??void 0,onChange:_=>u(_,a!=="desktop")})]}),h.jsx(pr,{names:["textAlign","textAlignMobile","backgroundColor","shape","padding","mobilePadding"],value:t.style,shapeMaxValue:300,shapeSteps:20,onChange:m})]})}const uI=Xe().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),dI=Ze({top:we(),bottom:we(),right:we(),left:we()}).optional().nullable(),o5=Ze({style:Ze({color:uI,backgroundColor:uI,background:Xe().nullable().optional(),fontSize:we().gte(0).optional().nullable(),fontFamily:Ko,fontWeight:an(["bold","normal"]).optional().nullable(),textAlign:an(["left","center","right"]).optional().nullable(),padding:dI,mobilePadding:dI,optionSize:an(["small","medium","large"]).optional().nullable(),theme:an(["light","dark","colored"]).optional().nullable()}).passthrough().optional().nullable(),gap:we().optional(),items:tu(Ze({id:Xe(),key:Xe(),label:Xe(),iconName:Xe(),theme:Xe(),size:Xe(),sizePx:Xe(),url:Xe(),href:Xe().optional().nullable()}))}).passthrough();function l5({style:t,items:e,blockId:n,gap:i=1,gapMobile:r}){var s,a,o,l,c,u;const d=Vn(),f=(s=t?.background)!==null&&s!==void 0?s:"",p=t?.backgroundColor,m=p?Yo(f,p):f,_={color:(a=t?.color)!==null&&a!==void 0?a:void 0,background:m,backgroundColor:t?.backgroundColor,fontSize:(o=t?.fontSize)!==null&&o!==void 0?o:16,fontFamily:Qr(t?.fontFamily),fontWeight:(l=t?.fontWeight)!==null&&l!==void 0?l:void 0,textAlign:d=="desktop"?t?.textAlign:(c=t?.textAlignMobile)!==null&&c!==void 0?c:t?.textAlign,padding:d=="desktop"?t?.padding:(u=t?.mobilePadding)!==null&&u!==void 0?u:t?.padding},g=d==="desktop"?i:r??i,b=vt(n);return E.createElement(kX,{blockId:`${b}`,items:e,wStyle:_,gap:g})}const kX=({items:t,blockId:e,wStyle:n,gap:i})=>{const r=s=>{switch(s){case 0:return"first";case t.length-1:return"last";default:return"inside"}};return E.createElement(pi,{className:e,background:n.background,backgroundColor:n.backgroundColor,padding:n?.padding,align:n.textAlign,width:"100%"},E.createElement("table",{style:{display:"inline-block"},border:0,cellSpacing:"0",cellPadding:"0"},E.createElement("tbody",null,E.createElement("tr",null,t.map((s,a)=>{const o=r(a);return E.createElement(E.Fragment,{key:s.id},o!=="first"&&E.createElement("td",{className:`gap-${e}`,width:Math.ceil(i/2)}),E.createElement("td",{key:`${s.id}-${s.url}`,id:`${s.id}-${s.url}`,width:s.sizePx,style:{textAlign:"center",whiteSpace:"nowrap"}},E.createElement("a",{key:`item_${a}`,target:"_blank",href:Qw(s.href),style:{textDecoration:"none"}},E.createElement("img",{src:s.url,alt:s.key,style:{width:s.sizePx||36,height:s.sizePx||36,display:"block"}}))),o!=="last"&&E.createElement("td",{className:`gap-${e}`,width:Math.ceil(i/2)}))})))))},wX="https://maildrill-dev.s3.us-east-2.amazonaws.com/icons/",AX={positive:!0,original:!0,negative:!0},DX={small:!0,medium:!0,large:!0,xlarge:!0},ie={theme:"positive",size:"medium"},Vt=(t,e,n="medium")=>{var i,r;const s=(i=Zw.find(o=>o.key===n))===null||i===void 0?void 0:i.value,a=(r=c5.find(o=>o.key===e))===null||r===void 0?void 0:r.value;return`${wX}${t}_${a}_${s}.png`},en=t=>{var e;return((e=Zw.find(n=>n.key===t))===null||e===void 0?void 0:e.value)||"36px"},Zw=[{value:"24px",key:"small",label:"Small"},{value:"36px",key:"medium",label:"Medium"},{value:"48px",key:"large",label:"Large"}],c5=[{value:"Positive",key:"positive",label:"Light"},{value:"Original",key:"original",label:"Color"},{value:"Negative",key:"negative",label:"Dark"}],P_=[{key:"facebook",label:"Facebook",iconName:"Facebook",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Facebook",ie.theme,ie.size),href:"https://www.facebook.com/your-profile"},{key:"web",label:"Web",iconName:"Web",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Web",ie.theme,ie.size),href:"https://www.google.com"},{key:"mail",label:"Mail",iconName:"Mail",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Mail",ie.theme,ie.size),href:"https://mail.google.com/"},{key:"apple",label:"Apple",iconName:"Apple",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Apple",ie.theme,ie.size),href:"https://www.apple.com/"},{key:"bluesky",label:"Bluesky",iconName:"Bluesky",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Bluesky",ie.theme,ie.size),href:"https://bsky.app/"},{key:"clubhouse",label:"ClubHouse",iconName:"Clubhouse",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Clubhouse",ie.theme,ie.size),href:"https://www.clubhouse.com/"},{key:"dribbble",label:"Dribbble",iconName:"Dribbble",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Dribbble",ie.theme,ie.size),href:"https://dribbble.com/"},{key:"figma",label:"Figma",iconName:"Figma",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Figma",ie.theme,ie.size),href:"https://www.figma.com/"},{key:"github",label:"Github",iconName:"Github",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Github",ie.theme,ie.size),href:"https://github.com/"},{key:"google",label:"Google",iconName:"Google",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Google",ie.theme,ie.size),href:"https://google.com/"},{key:"instagram",label:"Instagram",iconName:"Instagram",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Instagram",ie.theme,ie.size),href:"https://www.instagram.com/your-profile"},{key:"linkedin",label:"LinkedIn",iconName:"LinkedIn",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("LinkedIn",ie.theme,ie.size),href:"https://www.linkedin.com/in/your-profile"},{key:"medium-social",label:"Medium",iconName:"Medium",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Medium",ie.theme,ie.size),href:"https://medium.com/"},{key:"messenger",label:"Messenger",iconName:"Messenger",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Messenger",ie.theme,ie.size),href:"https://www.messenger.com/"},{key:"pinterest",label:"Pinterest",iconName:"Pinterest",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Pinterest",ie.theme,ie.size),href:"https://www.pinterest.com/"},{key:"reddit",label:"Reddit",iconName:"Reddit",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Reddit",ie.theme,ie.size),href:"https://www.reddit.com/"},{key:"signal",label:"Signal",iconName:"Signal",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Signal",ie.theme,ie.size),href:"https://signal.org/"},{key:"snapchat",label:"Snapchat",iconName:"Snapchat",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Snapchat",ie.theme,ie.size),href:"https://www.snapchat.com/"},{key:"spotify",label:"Spotify",iconName:"Spotify",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Spotify",ie.theme,ie.size),href:"https://www.spotify.com/"},{key:"telegram",label:"Telegram",iconName:"Telegram",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Telegram",ie.theme,ie.size),href:"https://t.me/your-profile"},{key:"threads",label:"Threads",iconName:"Threads",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Threads",ie.theme,ie.size),href:"https://www.threads.net/"},{key:"tiktok",label:"TikTok",iconName:"TikTok",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("TikTok",ie.theme,ie.size),href:"https://www.tiktok.com/@your-profile"},{key:"tumblr",label:"Tumblr",iconName:"Tumblr",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Tumblr",ie.theme,ie.size),href:"https://www.tumblr.com/"},{key:"twitch",label:"Twitch",iconName:"Twitch",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("Twitch",ie.theme,ie.size),href:"https://www.twitch.tv/"},{key:"vk",label:"VK",iconName:"VK",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("VK",ie.theme,ie.size),href:"https://vk.com/"},{key:"whatsapp",label:"WhatsApp",iconName:"WhatsApp",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("WhatsApp",ie.theme,ie.size),href:"https://www.whatsapp.com/"},{key:"x",label:"X",iconName:"X",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("X",ie.theme,ie.size),href:"https://x.com/your-profile"},{key:"youtube",label:"YouTube",iconName:"YouTube",theme:ie.theme,size:ie.size,sizePx:en(ie.size),url:Vt("YouTube",ie.theme,ie.size),href:"https://www.youtube.com/channel/your-channel-id"}];function Bp(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}const NX=({element:t,index:e,moveItem:n,onSelectChange:i,onUrlChange:r,onRemove:s,onDuplicate:a,canRemove:o,theme:l})=>{const c=E.useRef(null),[u,d]=E.useState(null),{t:f}=It.useTranslation("inspector"),p=N=>{const M=N.getClientOffset(),C=c.current?.getBoundingClientRect();if(!M||!C)return null;const F=(C.bottom-C.top)/2;return M.y-C.top<F?"up":"down"},[{handlerId:m,isOver:_},g]=Yl.useDrop(()=>({accept:"social-media-item",collect(N){return{handlerId:N.getHandlerId(),isOver:N.isOver({shallow:!0})}},hover(N,M){if(!c.current)return;if(N.index===e){d(null);return}if(!M.isOver({shallow:!0})){d(null);return}const D=p(M);d(D)},drop(N,M){if(d(null),!c.current)return;const C=N.index,F=e;if(C===F)return;const D=p(M);let q=F;D==="down"&&(q=F+1),C<q&&(q=q-1),setTimeout(()=>{n(C,q)},0),N.index=q},end:()=>{d(null)}}),[t.id,e,n]),[{isDragging:b},y]=Yl.useDrag(()=>({type:"social-media-item",item:()=>({id:t.id,index:e}),collect:N=>({isDragging:N.isDragging()}),end:()=>{d(null)}}),[t.id,e]);E.useEffect(()=>{_||d(null)},[_]);const v=b?.4:1;E.useEffect(()=>{if(c.current&&y&&g){const N=c.current;y(N),g(N)}},[y,g]);const T=()=>{setTimeout(()=>s(e),0)},x=()=>{setTimeout(()=>a(e),0)},w=N=>{const M=N.target.value;setTimeout(()=>i(e,M,t),0)},I=N=>{const M=N.target.value;setTimeout(()=>r(e,M,t),0)},A=()=>h.jsxs("div",{style:{height:"3px",background:l.palette.secondary.main,position:"relative",color:l.palette.secondary.main,margin:"4px 0"},children:[h.jsx("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:h.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"})}),h.jsx("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:h.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 h.jsxs(h.Fragment,{children:[u==="up"&&h.jsx(A,{}),h.jsxs(k.Stack,{ref:c,"data-handler-id":m,sx:{border:1,borderColor:"divider",padding:1,paddingTop:0,borderRadius:1,backgroundColor:"background.paper",marginBottom:1.5,opacity:v,cursor:b?"grabbing":"grab",boxShadow:b?l.shadows[3]:"none"},gap:1,children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:`1px solid ${l.palette.divider}`},children:[h.jsx("div",{style:{display:"flex",alignItems:"center"},children:h.jsx(Q.DragIndicator,{sx:{color:b?"primary.main":"text.secondary",cursor:"grab",marginLeft:-.9,"&:hover":{color:"primary.main"}}})}),h.jsxs("div",{children:[h.jsx(k.Tooltip,{disableInteractive:!0,arrow:!0,title:"Duplicate",placement:"left",children:h.jsx(k.IconButton,{color:"primary",size:"small",onClick:x,children:h.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:h.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"})})})}),o&&h.jsx(k.Tooltip,{disableInteractive:!0,arrow:!0,title:"Remove",placement:"left",children:h.jsx(k.IconButton,{color:"error",size:"small",onClick:T,children:h.jsx(Q.DeleteOutline,{sx:{fontSize:20}})})})]})]}),h.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"0.5rem"},children:[h.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[h.jsx(Sn,{label:f("inputs.social.icon")}),h.jsx(tc,{fullWidth:!0,labelId:"demo-simple-select-label",id:"demo-simple-select",value:t.key,size:"small",onChange:w,children:P_.map(N=>h.jsx(k.MenuItem,{value:N.key,children:N.label},`${t.id}_${N.key}`))})]}),h.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[h.jsx(Sn,{label:f("inputs.social.url")}),h.jsx(k.TextField,{size:"small",fullWidth:!0,value:t.href??"",onChange:I,variant:"outlined",placeholder:"https://your-website.com",sx:Zy})]})]})]}),u==="down"&&h.jsx(A,{})]})};function IX({items:t=[],onChange:e}){const{t:n}=It.useTranslation("inspector"),i=k.useTheme(),[r,s]=E.useState(()=>t.map(g=>({...g,id:g.id||Bp()}))),[a,o]=E.useState(t[0]?.theme||"default"),[l,c]=E.useState(t[0]?.size||"medium");E.useEffect(()=>{t.length>0&&(o(t[0].theme),c(t[0].size),s(t.map(g=>({...g,id:g.id||Bp()}))))},[t]);const u=(g,b)=>{s(y=>{const v=[...y],[T]=v.splice(g,1);return v.splice(b,0,T),e&&setTimeout(()=>e(v),0),v})},d=()=>{s(g=>{const b={...P_[0],theme:a,size:l,sizePx:en(l),url:Vt(P_[0].iconName,a,l),id:Bp()},y=[...g,b];return e&&setTimeout(()=>e(y),0),y})},f=g=>{s(b=>{const y=b.filter((v,T)=>T!==g);return e&&setTimeout(()=>e(y),0),y})},p=(g,b,y)=>{let v=[...r];if(b in AX?(o(b),v=v.map(T=>{const x=Vt(T.iconName,b,T.size);return{...T,theme:b,url:x}})):b in DX&&(c(b),v=v.map(T=>{const x=Vt(T.iconName,T.theme,b),w=en(b);return{...T,size:b,sizePx:w,url:x}})),g!==null&&y){const T=P_.find(x=>x.key===b);T&&(v=v.map((x,w)=>{const I={key:T.key,label:T.label,iconName:T.iconName,href:T.href},A=Vt(I.iconName,y.theme,y.size);return w===g?{...x,...I,url:A,id:y.id}:x}))}s(v),e&&setTimeout(()=>e(v),0)},m=(g,b,y)=>{const v=r.map((T,x)=>x===g?{...y,href:b}:T);s(v),e&&setTimeout(()=>e(v),0)},_=g=>{s(b=>{const y={...JSON.parse(JSON.stringify(b[g])),id:Bp()},v=[...b.slice(0,g+1),y,...b.slice(g+1)];return e&&setTimeout(()=>e(v),0),v})};return h.jsxs(h.Fragment,{children:[h.jsxs("div",{style:{marginBottom:"1rem",display:"grid",gridTemplateColumns:"repeat(2,1fr)",gap:"1rem"},children:[h.jsxs(tr,{children:[h.jsx(Sn,{label:n("inputs.social.theme")}),h.jsx(tc,{fullWidth:!0,labelId:"theme-selector",id:"theme-selector",value:a,size:"small",onChange:g=>p(null,g.target.value,null),children:c5.map(g=>h.jsx(k.MenuItem,{value:g.key,children:g.label},`${g.key}`))})]}),h.jsxs(tr,{children:[h.jsx(Sn,{label:n("inputs.social.size")}),h.jsx(tc,{fullWidth:!0,labelId:"size-selector",id:"size-selector",value:l,size:"small",onChange:g=>p(null,g.target.value,null),children:Zw.map(g=>h.jsx(k.MenuItem,{value:g.key,children:g.label},`${g.key}`))})]})]}),r?.map((g,b)=>h.jsx(NX,{element:g,index:b,moveItem:u,onSelectChange:p,onUrlChange:m,onRemove:f,onDuplicate:_,canRemove:r.length>1,theme:i},g.id)),h.jsx(k.Button,{onClick:d,sx:{borderRadius:1},variant:"contained",endIcon:h.jsx(Q.Add,{}),children:"Add"})]})}const OX=({data:t,setData:e})=>{const[,n]=E.useState(null),i=Vn(),{t:r}=It.useTranslation("inspector"),s=u=>{const d=o5.safeParse(u);d.success?(e(d.data),n(null)):n(d.error)},a=u=>{s({...t,items:u})},o=u=>{s({...t,style:u})},l=(u,d=!1)=>{if(d){s({...t,gapMobile:u});return}s({...t,gap:u})},c=Za();return h.jsxs(Is,{title:r("inputs.panels.social.title"),children:[c=="block-configuration"&&h.jsx(k.Box,{sx:{minWidth:120,margin:1},children:h.jsx(IX,{items:t?.items||[],onChange:a})}),c=="css"&&h.jsxs(h.Fragment,{children:[h.jsxs(tr,{children:[h.jsx(Sn,{label:r("inputs.panels.social.gap")}),i=="desktop"?h.jsx(jn,{iconLabel:h.jsx(Q.SpaceBar,{sx:{color:"text.primary"}}),value:t?.gap??4,setValue:l,marks:!0,step:4,units:"px",min:0,max:40}):h.jsx(jn,{iconLabel:h.jsx(Q.SpaceBar,{sx:{color:"text.primary"}}),value:t?.gapMobile??t?.gap??4,setValue:u=>l(u,!0),marks:!0,step:4,units:"px",min:0,max:40})]}),h.jsx(pr,{names:["textAlign","textAlignMobile","backgroundColor","padding","mobilePadding"],value:t.style,onChange:u=>o(u)})]})]})},RX=Xe().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),u5=Ze({style:Ze({height:we().optional().nullable(),heightMobile:we().optional().nullable(),background:Xe().nullable().optional(),backgroundColor:RX}).optional().nullable()}),fI={height:16};function d5({style:t,blockId:e}){const i=Vn()==="desktop"?t?.height??fI.height:t?.heightMobile??t?.height??fI.height,r=t?.background??"",s=t?.backgroundColor??"",a=s?Yo(r,s):r,o={width:"100%",minWidth:"100%",backgroundColor:s||void 0,background:a||void 0},l=vt(e);return h.jsx("table",{className:l,width:"100%",style:o,children:h.jsx("tbody",{children:h.jsx("tr",{className:`it${l}`,height:i,style:{height:i},children:h.jsx("td",{})})})})}function f5({data:t,setData:e}){const[,n]=E.useState(null),{t:i}=It.useTranslation("inspector"),r=s=>{const a=u5.safeParse(s);a.success?(e(a.data),n(null)):n(a.error)};return h.jsx(Is,{title:i("inputs.panels.spacer.title"),children:h.jsx(pr,{names:["height","heightMobile","backgroundColor"],value:t.style,onChange:s=>r({...t,style:s})})})}const MX={EmailLayout:{label:"Email",iconName:"DashboardOutlined"},NotionText:{label:"Notion 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"},Heading:{label:"Heading",iconName:"Title"},Text:{label:"Text",iconName:"TextFieldsOutlined"},Html:{label:"HTML",iconName:"CodeOutlined"},CustomEditor:{label:"Custom Editor",iconName:"EditOutlined"},Wysiwyg:{label:"WYSIWYG",iconName:"EditNoteOutlined"},Avatar:{label:"Avatar",iconName:"AccountCircleOutlined"}},LX=t=>e=>e.document[t],PX=t=>e=>e.document[t]?.data?.style;function FX(t){const e=t.document;if(!e||!e.root)return null;function n(r,s){const a=s.document[r];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 i(r,s,a){const l=a.document[r]?.type??"Unknown",c=MX[l]??{label:l,iconName:"WidgetsOutlined"},d=n(r,a).map(f=>i(f,s+1,a));return{blockId:r,type:l,label:c.label,iconName:c.iconName,children:d,depth:s}}return i("root",0,t)}function BX(t){return ye(t)}function UX(t){return ye(LX(t))}function $X(t){return ye(PX(t))}function qX(t){const e=E.useCallback(l=>{Ql(t,l)},[t]),n=E.useCallback(l=>{C9(t,l)},[t]),i=E.useCallback((l,c)=>{sK(t,l,c)},[t]),r=E.useCallback(l=>{x9(t,l)},[t]),s=E.useCallback((l,c)=>{aK(t,l,c)},[t]),a=E.useCallback(l=>{oK(t,l)},[t]),o=E.useCallback(l=>{lK(t,l)},[t]);return E.useMemo(()=>({updateBlock:e,updateProps:n,updateProp:i,updateStyles:r,updateStyle:s,batchUpdateProps:a,batchUpdateStyles:o}),[e,n,i,r,s,a,o])}function zX(t){const e=uc(),n=Za(),{t:i}=It.useTranslation("inspector"),r=$X(e??""),{updateStyles:s}=qX(e??"");if(!e)return null;const a=o=>{s(()=>o)};return h.jsxs(Is,{title:i("inputs.panels.notionText.title","Notion Text"),children:[n==="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{style:{display:"flex",gap:"8px"},children:[h.jsx("div",{style:{flex:1},children:h.jsx(pr,{disabledCSSValidation:!0,names:["fontFamily"],value:r,onChange:a})}),h.jsx("div",{style:{flex:1},children:h.jsx(pr,{disabledCSSValidation:!0,names:["lineHeight"],value:r,onChange:a})})]}),h.jsx(pr,{disabledCSSValidation:!0,names:["fontSize","fontSizeMobile"],value:r,onChange:a})]}),n==="css"&&h.jsx(pr,{names:["backgroundColor","border","borderMobile","padding","mobilePadding"],value:r,onChange:a})]})}function pI(t){return h.jsx(k.Box,{sx:{m:3,p:1,border:"1px dashed",borderColor:"divider"},children:h.jsx(k.Typography,{color:"text.secondary",children:t})})}function GX(){const t=uc(),e=_9(t||"");if(!t)return pI("Click on a block to inspect.");if(!e)return pI(`Block with id ${t} was not found. Click on a block to reset.`);const{data:n,type:i}=e,r=E.useCallback(s=>{Ql(t,()=>s)},[t]);switch(i){case"Avatar":return h.jsx(KQ,{data:n,setData:s=>r({type:i,data:s})},t);case"Button":return h.jsx(eX,{data:n,setData:s=>r({type:i,data:s})},t);case"ColumnsContainer":return h.jsx(cX,{data:n,setData:s=>r({type:i,data:s})},t);case"Container":return h.jsx(X9,{data:n,setData:s=>r({type:i,data:s})},t);case"Divider":return h.jsx(e5,{data:n,setData:s=>r({type:i,data:s})},t);case"Heading":return h.jsx(yX,{data:n,setData:s=>r({type:i,data:s})},t);case"Html":return h.jsx(SX,{data:n,setData:s=>r({type:i,data:s})},t);case"Image":return h.jsx(xX,{data:n,setData:s=>r({type:i,data:s})},t);case"EmailLayout":return h.jsx(n5,{data:n,setData:s=>r({type:i,data:s})},t);case"Spacer":return h.jsx(f5,{data:n,setData:s=>r({type:i,data:s})},t);case"CustomEditor":case"Wysiwyg":case"NotionText":return h.jsx(zX,{data:n,setData:s=>r({type:i,data:s})},t);case"SocialMedia":return h.jsx(OX,{data:n,setData:s=>r({type:i,data:s})},t);default:return h.jsx("pre",{children:JSON.stringify(e,null," ")})}}const jX=E.memo(GX);function HX(){const t=uc(),e=UX(t??"root");if(!e)return null;const{data:n,type:i}=e,r=E.useCallback(a=>{t&&Ql(t,()=>a)},[t]),s=E.useCallback(a=>{Ql("root",()=>a)},[]);switch(i){case"Container":return h.jsx(X9,{data:n,setData:a=>r({type:i,data:a})},t);case"Divider":return h.jsx(e5,{data:n,setData:a=>r({type:i,data:a})},t);case"Spacer":return h.jsx(f5,{data:n,setData:a=>r({type:i,data:a})},t);case"EmailLayout":return h.jsx(n5,{data:n,setData:a=>s({type:i,data:a})},"root");default:return h.jsx("pre",{children:JSON.stringify(e,null," ")})}}function VX({sticky:t,heightContent:e}){const n=Za(),i=g9(),r=uc(),s=Vn(),a=k.useTheme(),{t:o}=It.useTranslation("inspector"),l=()=>{const p={position:"absolute",top:"1rem",right:"0rem",height:"24px",lineHeight:"normal",width:"fit",fontSize:"12px"};switch(n){case"block-configuration":case"css":return h.jsxs("div",{style:{position:"relative"},children:[h.jsx(k.Chip,{color:"primary",sx:p,label:`${o(s==="desktop"?"header.desktop":"header.mobile")}`}),h.jsx(jX,{})]});case"styles":return h.jsxs("div",{style:{position:"relative"},children:[h.jsx(HX,{}),h.jsx(k.Chip,{color:"primary",sx:p,label:`${o(s==="desktop"?"header.desktop":"header.mobile")}`})]})}},c=()=>h.jsx("svg",{style:{marginRight:"4px",color:"inherit"},width:"21",height:"20",viewBox:"0 0 21 20",fill:"none",children:h.jsx("path",{d:"M3.83398 5H17.1673M3.83398 10H17.1673M3.83398 15H9.66732",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),u=()=>h.jsx("svg",{style:{marginRight:"4px",color:"inherit"},width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:h.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"})});E.useEffect(()=>{const p=m=>{const _=m.target;ON(_.innerWidth)};return window&&ON(window.innerWidth),window.addEventListener("resize",p),()=>{window.removeEventListener("resize",p)}},[n]);const d=(p,m)=>{zY(m)},f=t?e?`calc(${e} - ${pl})`:void 0:e??void 0;return h.jsxs(k.Container,{sx:p=>({width:db,padding:"0!important",margin:"0!important",height:f,maxHeight:f,display:"flex",flexDirection:"column",overflow:"hidden",position:t?"sticky":"static",top:t?pl:0,backgroundColor:`${p.palette.background.paper} !important`}),children:[h.jsx(k.Box,{sx:{position:"sticky",top:0,zIndex:1,backgroundColor:`${a.palette.background.paper} !important`},children:h.jsxs(k.Tabs,{sx:{backgroundColor:`${a.palette.background.paper} !important`},value:n,onChange:d,children:[r!=null&&!ub.includes(i||"")&&[h.jsx(k.Tab,{sx:{height:pl,minHeight:pl,fontWeight:"bold"},value:"block-configuration",label:o("header.content"),icon:h.jsx(c,{}),iconPosition:"start"},"block-configuration"),h.jsx(k.Tab,{sx:{height:pl,minHeight:pl,fontWeight:"bold"},value:"css",label:o("header.styles"),icon:h.jsx(u,{}),iconPosition:"start"},"css")],ub.includes(i)&&[h.jsx(k.Tab,{sx:{height:pl,minHeight:pl,fontWeight:"bold"},value:"styles",label:o("header.styles"),icon:h.jsx(u,{}),iconPosition:"start"},"styles")]]})}),h.jsx(k.Container,{sx:p=>({flex:"1 1 auto",minHeight:0,overflowY:"auto",px:2,backgroundColor:`${p.palette.background.paper} !important`}),children:l()})]})}const p5=({children:t,topOffset:e=0,zIndex:n=10,className:i="",style:r={},disabled:s=!1,threshold:a=null,...o})=>{const[l,c]=E.useState(!1),[u,d]=E.useState({width:0,height:0}),[f,p]=E.useState({left:0}),[m,_]=E.useState(0),[g,b]=E.useState(!1),y=E.useRef(null),v=E.useRef(null),T=E.useRef(null);E.useEffect(()=>{if(s){c(!1),b(!1),_(0);return}const I=v.current,A=y.current;if(!I||!A)return;let N=null;a&&(a.startsWith("#")?N=document.getElementById(a.slice(1)):(a.startsWith("."),N=document.querySelector(a)));const M=()=>{const z=A.getBoundingClientRect();d({width:z.width,height:z.height}),p({left:z.left})},C=()=>{if(!N||!A)return{offset:0,isPushed:!1};const z=N.getBoundingClientRect(),O=A.getBoundingClientRect(),P=e+O.height;if(z.top<P){const j=P-z.top,ee=O.height+20;return{offset:-Math.min(j,ee),isPushed:!0}}return{offset:0,isPushed:!1}},F=new IntersectionObserver(([z])=>{const O=!z.isIntersecting;if(O&&!l&&M(),c(O),O&&a){const{offset:P,isPushed:j}=C();_(P),b(j)}else O||(_(0),b(!1))},{threshold:0,rootMargin:`-${e}px 0px 0px 0px`}),D=new ResizeObserver(()=>{M()}),q=()=>{if(a&&l){const{offset:z,isPushed:O}=C();_(z),b(O)}};return F.observe(I),D.observe(A),a&&window.addEventListener("scroll",q,{passive:!0}),M(),()=>{F.disconnect(),D.disconnect(),a&&window.removeEventListener("scroll",q)}},[e,l,s,a]);const x=!s&&l,w=x?`${e+m}px`:"auto";return h.jsxs("div",{ref:T,className:i,...o,children:[!s&&h.jsx("div",{ref:v,style:{height:"1px",position:"absolute",top:`-${e+1}px`,left:0,right:0,pointerEvents:"none"}}),x&&h.jsx("div",{style:{height:`${u.height}px`,width:`${u.width}px`}}),h.jsx("div",{ref:y,style:{position:x?"fixed":"static",top:w,width:"auto",height:"auto",zIndex:x?n:"auto",transition:g?"none":"box-shadow 0.2s ease-in-out, top 0.3s ease-out",...g&&m<-u.height*.3&&{opacity:Math.max(0,1+(m+u.height*.3)/(u.height*.7))},...r},children:t})]})};var Dv,hI;function eA(){if(hI)return Dv;hI=1;var t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},e={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},n=/(&amp;|&lt;|&gt;|&quot;|&#39;)/g,i=/[&<>"']/g;function r(l){return t[l]}function s(l){return e[l]}function a(l){return l==null?"":String(l).replace(i,r)}function o(l){return l==null?"":String(l).replace(n,s)}return a.options=o.options={},Dv={encode:a,escape:a,decode:o,unescape:o,version:"1.0.0-browser"},Dv}var Nv,mI;function WX(){if(mI)return Nv;mI=1;function t(e){for(var n=Array.prototype.slice.call(arguments,1),i,r;n.length;){i=n.shift();for(r in i)i.hasOwnProperty(r)&&(Object.prototype.toString.call(e[r])==="[object Object]"?e[r]=t(e[r],i[r]):e[r]=i[r])}return e}return Nv=t,Nv}var Iv,gI;function h5(){return gI||(gI=1,Iv=function(e){return typeof e=="string"?e.toLowerCase():e}),Iv}var Ov,_I;function m5(){if(_I)return Ov;_I=1;function t(n){return n.reduce(e,{})}function e(n,i){return n[i]=!0,n}return Ov=t,Ov}var Rv,bI;function g5(){if(bI)return Rv;bI=1;var t=m5(),e=["background","base","cite","href","longdesc","src","usemap"];return Rv={uris:t(e)},Rv}var Mv,yI;function _5(){if(yI)return Mv;yI=1;var t=m5(),e=["area","br","col","hr","img","wbr","input","base","basefont","link","meta"];return Mv={voids:t(e)},Mv}var Lv,EI;function YX(){if(EI)return Lv;EI=1;var t=eA(),e=h5();g5();var n=_5(),i=/^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/,r=/^<\s*\/\s*([\w:-]+)[^>]*>/,s=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,a=/^</,o=/^<\s*\//;function l(){var u=[];return u.lastItem=function(){return u[u.length-1]},u}function c(u,d){for(var f=l(),p=u,m;u;)_();x();function _(){m=!0,g();var w=u===p;p=u,w&&(u="")}function g(){u.substr(0,4)==="<!--"?y():o.test(u)?b(r,x):a.test(u)&&b(i,T),v()}function b(w,I){var A=u.match(w);A&&(u=u.substring(A[0].length),A[0].replace(w,I),m=!1)}function y(){var w=u.indexOf("-->");w>=0&&(d.comment&&d.comment(u.substring(4,w)),u=u.substring(w+3),m=!1)}function v(){if(m){var w,I=u.indexOf("<");I>=0?(w=u.substring(0,I),u=u.substring(I)):(w=u,u=""),d.chars&&d.chars(w)}}function T(w,I,A,N){var M={},C=e(I),F=n.voids[C]||!!N;A.replace(s,D),F||f.push(C),d.start&&d.start(C,M,F);function D(q,z,O,P,j){O===void 0&&P===void 0&&j===void 0?M[z]=void 0:M[z]=t.decode(O||P||j||"")}}function x(w,I){var A,N=0,M=e(I);if(M)for(N=f.length-1;N>=0&&f[N]!==M;N--);if(N>=0){for(A=f.length-1;A>=N;A--)d.end&&d.end(f[A]);f.length=N}}}return Lv=c,Lv}var Pv,vI;function KX(){if(vI)return Pv;vI=1;var t=eA(),e=h5(),n=g5(),i=_5();function r(s,a){var o,l=a||{};return g(),{start:u,end:d,chars:p};function c(b){s.push(b)}function u(b,y,v){var T=e(b);if(o.ignoring){m(T);return}if((l.allowedTags||[]).indexOf(T)===-1){m(T);return}if(l.filter&&!l.filter({tag:T,attrs:y})){m(T);return}c("<"),c(T),Object.keys(y).forEach(x),c(v?"/>":">");function x(w){var I=y[w],A=(l.allowedClasses||{})[T]||[],N=(l.allowedAttributes||{})[T]||[],M,C=e(w);C==="class"&&N.indexOf(C)===-1?(I=I.split(" ").filter(F).join(" ").trim(),M=I.length):M=N.indexOf(C)!==-1&&(n.uris[C]!==!0||f(I)),M&&(c(" "),c(w),typeof I=="string"&&(c('="'),c(t.encode(I)),c('"')));function F(D){return A&&A.indexOf(D)!==-1}}}function d(b){var y=e(b),v=(l.allowedTags||[]).indexOf(y)!==-1;v&&o.ignoring===!1?(c("</"),c(y),c(">")):_(y)}function f(b){var y=b[0];if(y==="#"||y==="/")return!0;var v=b.indexOf(":");if(v===-1)return!0;var T=b.indexOf("?");if(T!==-1&&v>T)return!0;var x=b.indexOf("#");if(x!==-1&&v>x)return!0;return l.allowedSchemes.some(w);function w(I){return b.indexOf(I+":")===0}}function p(b){o.ignoring===!1&&c(l.transformText?l.transformText(b):b)}function m(b){i.voids[b]||(o.ignoring===!1?o={ignoring:b,depth:1}:o.ignoring===b&&o.depth++)}function _(b){o.ignoring===b&&--o.depth<=0&&g()}function g(){o={ignoring:!1,depth:0}}}return Pv=r,Pv}var Fv,SI;function QX(){if(SI)return Fv;SI=1;var t={allowedAttributes:{a:["href","name","target","title","aria-label"],iframe:["allowfullscreen","frameborder","src"],img:["src","alt","title","aria-label"]},allowedClasses:{},allowedSchemes:["http","https","mailto"],allowedTags:["a","abbr","article","b","blockquote","br","caption","code","del","details","div","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","main","mark","ol","p","pre","section","span","strike","strong","sub","summary","sup","table","tbody","td","th","thead","tr","u","ul"],filter:null};return Fv=t,Fv}var Bv,TI;function XX(){if(TI)return Bv;TI=1,eA();var t=WX(),e=YX(),n=KX(),i=QX();function r(s,a,o){var l=[],c=o===!0?a:t({},i,a),u=n(l,c);return e(s,u),l.join("")}return r.defaults=i,Bv=r,Bv}var JX=XX();const ZX=Pm(JX);function tA(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Pu=tA();function b5(t){Pu=t}const y5=/[&<>"']/,eJ=new RegExp(y5.source,"g"),E5=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,tJ=new RegExp(E5.source,"g"),nJ={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},CI=t=>nJ[t];function qr(t,e){if(e){if(y5.test(t))return t.replace(eJ,CI)}else if(E5.test(t))return t.replace(tJ,CI);return t}const iJ=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function rJ(t){return t.replace(iJ,(e,n)=>(n=n.toLowerCase(),n==="colon"?":":n.charAt(0)==="#"?n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1)):""))}const sJ=/(^|[^\[])\^/g;function un(t,e){let n=typeof t=="string"?t:t.source;e=e||"";const i={replace:(r,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(sJ,"$1"),n=n.replace(r,a),i},getRegex:()=>new RegExp(n,e)};return i}function xI(t){try{t=encodeURI(t).replace(/%25/g,"%")}catch{return null}return t}const lh={exec:()=>null};function kI(t,e){const n=t.replace(/\|/g,(s,a,o)=>{let l=!1,c=a;for(;--c>=0&&o[c]==="\\";)l=!l;return l?"|":" |"}),i=n.split(/ \|/);let r=0;if(i[0].trim()||i.shift(),i.length>0&&!i[i.length-1].trim()&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;r<i.length;r++)i[r]=i[r].trim().replace(/\\\|/g,"|");return i}function Ng(t,e,n){const i=t.length;if(i===0)return"";let r=0;for(;r<i&&t.charAt(i-r-1)===e;)r++;return t.slice(0,i-r)}function aJ(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let i=0;i<t.length;i++)if(t[i]==="\\")i++;else if(t[i]===e[0])n++;else if(t[i]===e[1]&&(n--,n<0))return i;return-1}function wI(t,e,n,i){const r=e.href,s=e.title?qr(e.title):null,a=t[1].replace(/\\([\[\]])/g,"$1");if(t[0].charAt(0)!=="!"){i.state.inLink=!0;const o={type:"link",raw:n,href:r,title:s,text:a,tokens:i.inlineTokens(a)};return i.state.inLink=!1,o}return{type:"image",raw:n,href:r,title:s,text:qr(a)}}function oJ(t,e){const n=t.match(/^(\s+)(?:```)/);if(n===null)return e;const i=n[1];return e.split(`
2
2
  `).map(r=>{const s=r.match(/^\s+/);if(s===null)return r;const[a]=s;return a.length>=i.length?r.slice(i.length):r}).join(`
3
3
  `)}class Tb{constructor(e){Y(this,"options");Y(this,"rules");Y(this,"lexer");this.options=e||Pu}space(e){const n=this.rules.block.newline.exec(e);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(e){const n=this.rules.block.code.exec(e);if(n){const i=n[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?i:Ng(i,`
4
4
  `)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const i=n[0],r=oJ(i,n[3]||"");return{type:"code",raw:i,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:r}}}heading(e){const n=this.rules.block.heading.exec(e);if(n){let i=n[2].trim();if(/#$/.test(i)){const r=Ng(i,"#");(this.options.pedantic||!r||/ $/.test(r))&&(i=r.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:i,tokens:this.lexer.inline(i)}}}hr(e){const n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:n[0]}}blockquote(e){const n=this.rules.block.blockquote.exec(e);if(n){let i=n[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`