email-builder-online 3.5.0 → 3.5.2
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 +1 -1
- package/dist/index.mjs +85 -63
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -144,7 +144,7 @@ ${e}</tr>
|
|
|
144
144
|
`}tablecell(e,n){const i=n.header?"th":"td";return(n.align?`<${i} align="${n.align}">`:`<${i}>`)+e+`</${i}>
|
|
145
145
|
`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,n,i){const r=mO(e);if(r===null)return i;e=r;let a='<a href="'+e+'"';return n&&(a+=' title="'+n+'"'),a+=">"+i+"</a>",a}image(e,n,i){const r=mO(e);if(r===null)return i;e=r;let a=`<img src="${e}" alt="${i}"`;return n&&(a+=` title="${n}"`),a+=">",a}text(e){return e}}class nA{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,n,i){return""+i}image(e,n,i){return""+i}br(){return""}}class Ls{constructor(e){ne(this,"options");ne(this,"renderer");ne(this,"textRenderer");this.options=e||Nu,this.options.renderer=this.options.renderer||new Nb,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new nA}static parse(e,n){return new Ls(n).parse(e)}static parseInline(e,n){return new Ls(n).parseInline(e)}parse(e,n=!0){let i="";for(let r=0;r<e.length;r++){const a=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[a.type]){const s=a,o=this.options.extensions.renderers[s.type].call({parser:this},s);if(o!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(s.type)){i+=o||"";continue}}switch(a.type){case"space":continue;case"hr":{i+=this.renderer.hr();continue}case"heading":{const s=a;i+=this.renderer.heading(this.parseInline(s.tokens),s.depth,tle(this.parseInline(s.tokens,this.textRenderer)));continue}case"code":{const s=a;i+=this.renderer.code(s.text,s.lang,!!s.escaped);continue}case"table":{const s=a;let o="",l="";for(let u=0;u<s.header.length;u++)l+=this.renderer.tablecell(this.parseInline(s.header[u].tokens),{header:!0,align:s.align[u]});o+=this.renderer.tablerow(l);let c="";for(let u=0;u<s.rows.length;u++){const d=s.rows[u];l="";for(let p=0;p<d.length;p++)l+=this.renderer.tablecell(this.parseInline(d[p].tokens),{header:!1,align:s.align[p]});c+=this.renderer.tablerow(l)}i+=this.renderer.table(o,c);continue}case"blockquote":{const s=a,o=this.parse(s.tokens);i+=this.renderer.blockquote(o);continue}case"list":{const s=a,o=s.ordered,l=s.start,c=s.loose;let u="";for(let d=0;d<s.items.length;d++){const p=s.items[d],f=p.checked,m=p.task;let g="";if(p.task){const _=this.renderer.checkbox(!!f);c?p.tokens.length>0&&p.tokens[0].type==="paragraph"?(p.tokens[0].text=_+" "+p.tokens[0].text,p.tokens[0].tokens&&p.tokens[0].tokens.length>0&&p.tokens[0].tokens[0].type==="text"&&(p.tokens[0].tokens[0].text=_+" "+p.tokens[0].tokens[0].text)):p.tokens.unshift({type:"text",text:_+" "}):g+=_+" "}g+=this.parse(p.tokens,c),u+=this.renderer.listitem(g,m,!!f)}i+=this.renderer.list(u,o,l);continue}case"html":{const s=a;i+=this.renderer.html(s.text,s.block);continue}case"paragraph":{const s=a;i+=this.renderer.paragraph(this.parseInline(s.tokens));continue}case"text":{let s=a,o=s.tokens?this.parseInline(s.tokens):s.text;for(;r+1<e.length&&e[r+1].type==="text";)s=e[++r],o+=`
|
|
146
146
|
`+(s.tokens?this.parseInline(s.tokens):s.text);i+=n?this.renderer.paragraph(o):o;continue}default:{const s='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return i}parseInline(e,n){n=n||this.renderer;let i="";for(let r=0;r<e.length;r++){const a=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[a.type]){const s=this.options.extensions.renderers[a.type].call({parser:this},a);if(s!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){i+=s||"";continue}}switch(a.type){case"escape":{const s=a;i+=n.text(s.text);break}case"html":{const s=a;i+=n.html(s.text);break}case"link":{const s=a;i+=n.link(s.href,s.title,this.parseInline(s.tokens,n));break}case"image":{const s=a;i+=n.image(s.href,s.title,s.text);break}case"strong":{const s=a;i+=n.strong(this.parseInline(s.tokens,n));break}case"em":{const s=a;i+=n.em(this.parseInline(s.tokens,n));break}case"codespan":{const s=a;i+=n.codespan(s.text);break}case"br":{i+=n.br();break}case"del":{const s=a;i+=n.del(this.parseInline(s.tokens,n));break}case"text":{const s=a;i+=n.text(s.text);break}default:{const s='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return i}}class Sm{constructor(e){ne(this,"options");this.options=e||Nu}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}ne(Sm,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));var Du,dk,tU;class Rle{constructor(...e){Sc(this,Du);ne(this,"defaults",QD());ne(this,"options",this.setOptions);ne(this,"parse",Ya(this,Du,dk).call(this,Ps.lex,Ls.parse));ne(this,"parseInline",Ya(this,Du,dk).call(this,Ps.lexInline,Ls.parseInline));ne(this,"Parser",Ls);ne(this,"Renderer",Nb);ne(this,"TextRenderer",nA);ne(this,"Lexer",Ps);ne(this,"Tokenizer",Db);ne(this,"Hooks",Sm);this.use(...e)}walkTokens(e,n){let i=[];for(const r of e)switch(i=i.concat(n.call(this,r)),r.type){case"table":{const a=r;for(const s of a.header)i=i.concat(this.walkTokens(s.tokens,n));for(const s of a.rows)for(const o of s)i=i.concat(this.walkTokens(o.tokens,n));break}case"list":{const a=r;i=i.concat(this.walkTokens(a.items,n));break}default:{const a=r;this.defaults.extensions?.childTokens?.[a.type]?this.defaults.extensions.childTokens[a.type].forEach(s=>{const o=a[s].flat(1/0);i=i.concat(this.walkTokens(o,n))}):a.tokens&&(i=i.concat(this.walkTokens(a.tokens,n)))}}return i}use(...e){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(i=>{const r={...i};if(r.async=this.defaults.async||r.async||!1,i.extensions&&(i.extensions.forEach(a=>{if(!a.name)throw new Error("extension name required");if("renderer"in a){const s=n.renderers[a.name];s?n.renderers[a.name]=function(...o){let l=a.renderer.apply(this,o);return l===!1&&(l=s.apply(this,o)),l}:n.renderers[a.name]=a.renderer}if("tokenizer"in a){if(!a.level||a.level!=="block"&&a.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const s=n[a.level];s?s.unshift(a.tokenizer):n[a.level]=[a.tokenizer],a.start&&(a.level==="block"?n.startBlock?n.startBlock.push(a.start):n.startBlock=[a.start]:a.level==="inline"&&(n.startInline?n.startInline.push(a.start):n.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(n.childTokens[a.name]=a.childTokens)}),r.extensions=n),i.renderer){const a=this.defaults.renderer||new Nb(this.defaults);for(const s in i.renderer){if(!(s in a))throw new Error(`renderer '${s}' does not exist`);if(s==="options")continue;const o=s,l=i.renderer[o],c=a[o];a[o]=(...u)=>{let d=l.apply(a,u);return d===!1&&(d=c.apply(a,u)),d||""}}r.renderer=a}if(i.tokenizer){const a=this.defaults.tokenizer||new Db(this.defaults);for(const s in i.tokenizer){if(!(s in a))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;const o=s,l=i.tokenizer[o],c=a[o];a[o]=(...u)=>{let d=l.apply(a,u);return d===!1&&(d=c.apply(a,u)),d}}r.tokenizer=a}if(i.hooks){const a=this.defaults.hooks||new Sm;for(const s in i.hooks){if(!(s in a))throw new Error(`hook '${s}' does not exist`);if(s==="options")continue;const o=s,l=i.hooks[o],c=a[o];Sm.passThroughHooks.has(s)?a[o]=u=>{if(this.defaults.async)return Promise.resolve(l.call(a,u)).then(p=>c.call(a,p));const d=l.call(a,u);return c.call(a,d)}:a[o]=(...u)=>{let d=l.apply(a,u);return d===!1&&(d=c.apply(a,u)),d}}r.hooks=a}if(i.walkTokens){const a=this.defaults.walkTokens,s=i.walkTokens;r.walkTokens=function(o){let l=[];return l.push(s.call(this,o)),a&&(l=l.concat(a.call(this,o))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return Ps.lex(e,n??this.defaults)}parser(e,n){return Ls.parse(e,n??this.defaults)}}Du=new WeakSet,dk=function(e,n){return(i,r)=>{const a={...r},s={...this.defaults,...a};this.defaults.async===!0&&a.async===!1&&(s.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),s.async=!0);const o=Ya(this,Du,tU).call(this,!!s.silent,!!s.async);if(typeof i>"u"||i===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof i!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(i)+", string expected"));if(s.hooks&&(s.hooks.options=s),s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(i):i).then(l=>e(l,s)).then(l=>s.hooks?s.hooks.processAllTokens(l):l).then(l=>s.walkTokens?Promise.all(this.walkTokens(l,s.walkTokens)).then(()=>l):l).then(l=>n(l,s)).then(l=>s.hooks?s.hooks.postprocess(l):l).catch(o);try{s.hooks&&(i=s.hooks.preprocess(i));let l=e(i,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let c=n(l,s);return s.hooks&&(c=s.hooks.postprocess(c)),c}catch(l){return o(l)}}},tU=function(e,n){return i=>{if(i.message+=`
|
|
147
|
-
Please report this to https://github.com/markedjs/marked.`,e){const r="<p>An error occurred:</p><pre>"+Yr(i.message+"",!0)+"</pre>";return n?Promise.resolve(r):r}if(n)return Promise.reject(i);throw i}};const du=new Rle;function xn(t,e){return du.parse(t,e)}xn.options=xn.setOptions=function(t){return du.setOptions(t),xn.defaults=du.defaults,q$(xn.defaults),xn};xn.getDefaults=QD;xn.defaults=Nu;xn.use=function(...t){return du.use(...t),xn.defaults=du.defaults,q$(xn.defaults),xn};xn.walkTokens=function(t,e){return du.walkTokens(t,e)};xn.parseInline=du.parseInline;xn.Parser=Ls;xn.parser=Ls.parse;xn.Renderer=Nb;xn.TextRenderer=nA;xn.Lexer=Ps;xn.lexer=Ps.lex;xn.Tokenizer=Db;xn.Hooks=Sm;xn.parse=xn;xn.options;xn.setOptions;xn.use;xn.walkTokens;xn.parseInline;Ls.parse;Ps.lex;function Ile(t){return String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ole(t){const e=String(t?.text??"");if(t?.markdown===!0){const n=xn.parse(e,{async:!1});return typeof n=="string"?n:String(n)}return`<p>${Ile(e)}</p>`}function Mle(t){const e=t.data??{},n=e.style??{},i=e.props??{},r=typeof i.size=="number"&&i.size>0?i.size:64,a=i.shape??"square";let s="rectangle";if(a==="circle")s="pill";else if(a==="rounded"){const o=r*.125;s={topLeft:o,topRight:o,bottomLeft:o,bottomRight:o}}return{...t,type:"Image",data:{style:{padding:n.padding??{top:0,bottom:0,left:0,right:0},mobilePadding:n.mobilePadding??null,backgroundColor:n.backgroundColor??null,textAlign:n.textAlign??null,textAlignMobile:n.textAlignMobile??null,shape:s},props:{url:i.imageUrl??"",alt:i.alt??null,width:r,height:r,contentAlignment:"middle",linkHref:null}}}}function Ld(t){const e={...t};for(const[n,i]of Object.entries(e)){const r=i.type;if(r==="CustomEditor"||r==="Wysiwyg")e[n]={...i,type:"NotionText"};else if(r==="Text"){const a=i.data??{},s=a.props??{},o=Ole(s);e[n]={...i,type:"NotionText",data:{...a,props:{html:o}}}}else r==="Avatar"&&(e[n]=Mle(i))}return e}const pk="eb-component-tree-column:";function Ple(t,e){return`${pk}${t}:${e}`}function nU(t){if(!t.startsWith(pk))return null;const e=t.slice(pk.length),n=e.lastIndexOf(":");if(n<=0)return null;const i=e.slice(0,n),r=Number(e.slice(n+1));return!Number.isInteger(r)||r<0||r>2?null:{parentBlockId:i,columnIndex:r}}const Rb=385,Mv="https://ddc4vowthkjlv.cloudfront.net/uploads/gallery/1/69cc1b1083b90.jpg";let yS=null;const Lle=2e3;function Wh(){yS&&clearTimeout(yS),yS=setTimeout(()=>{const t=new CustomEvent("email-builder-auto-save",{detail:!0});window.dispatchEvent(t)},Lle)}const Fle=()=>({document:Ld(JSON.parse(JSON.stringify(Woe))),selectedBlockId:null,selectedSidebarTab:"styles",selectedMainTab:"editor",selectedScreenSize:"desktop",windowWidth:0,inspectorDrawerOpen:!0,componentTreeOpen:!1,samplesDrawerOpen:!0,inspectorDrawerWidth:Rb,devMode:!1,imageUploading:{uploading:!1,id:""},disableEdition:!1,disableUpdate:!1,freeMode:!1,minHeight:"calc(100dvh - 65px)",color:{primary:"",secondary:""},galleryImages:!0,imagePlaceholder:Mv,darkMode:!0,colorPicker:{paletteColors:Voe,isLocked:!1},tour:!1,stickyHeader:!0,heightContent:"calc(100dvh - 50px)",containerGrow:!0,notionTextInlineEditingBlockId:null,highlightColor:"#FF6B35",showVersion:!1}),ce=j$(()=>Fle());D.createContext(ce);function iU(){const t=ce(e=>e.document[ce(n=>n.selectedBlockId)||""]);return t?t.type:null}function bO(t){return ce.setState({windowWidth:t})}function Ble(){return ce(t=>t.devMode)}function $le(t){return ce.setState({devMode:t})}function iA(){return ce(t=>t.document)}function rU(t){return ce(e=>e.document[t])}function Ule(t){return ce(e=>e.document[t]?.type)}function zle(t){return ce(e=>e.selectedBlockId===t)}function Yh(){return ce(t=>t.selectedBlockId)}function Kh(){return ce(t=>t.notionTextInlineEditingBlockId)}function Cm(t){const e=ce.getState().notionTextInlineEditingBlockId;return e&&e!==t&&window.dispatchEvent(new CustomEvent("notion-text-force-save",{detail:{blockId:e}})),ce.setState({notionTextInlineEditingBlockId:t})}function Gle(){return!!Kh()}function Hle(){return Kh()}function jle(){return ce(t=>t.highlightColor)}function fi(){return ce(t=>t.selectedScreenSize)}function rA(){return ce(t=>t.selectedMainTab)}function zg(t){return t==="preview"&&Na(null),ce.setState({inspectorDrawerOpen:t==="editor"}),ce.setState({selectedMainTab:t})}function Qo(){return ce(t=>t.selectedSidebarTab)}function qle(){return ce(t=>t.inspectorDrawerOpen)}function aA(){return ce(t=>t.componentTreeOpen)}function fk(){ce.setState(t=>({componentTreeOpen:!t.componentTreeOpen}))}function sA(){return ce(t=>t.imageUploading)}function Pv(){return ce(t=>t.disableEdition)}let Ib=null,yO=0;const Vle=400;let pu=!1,mk=!1;function qp(t,e){if(pu||mk)return;const n=Date.now(),i=n-yO;if(e&&e===Ib&&i<Vle){kb().future.length>0&&wb({future:[]});return}const a=JSON.stringify(t),{past:s}=kb();if(s.length>0&&s[s.length-1]===a)return;const o=[...s,a].slice(-50);wb({past:o,future:[]}),Ib=e??null,yO=n}function Na(t){const e=ce.getState().notionTextInlineEditingBlockId;e&&t!==null&&e!==t&&Cm(null);const n=ce.getState().document[t||""]?.type,i=xb.includes(n||null)?"styles":"block-configuration",r={};return t!==null&&ce.getState().selectedMainTab==="editor"&&(r.inspectorDrawerOpen=!0),ce.setState({selectedBlockId:t,selectedSidebarTab:i,...r})}function Wle(t){return ce.setState({selectedSidebarTab:t})}function Gg(t){const e=Ld(t);return Qoe(),ce.setState({document:e,selectedSidebarTab:"styles",selectedBlockId:null})}function aU(t){const e=ce.getState().document;mk=!0;let n;try{n=t()}finally{mk=!1}return qp(e,null),n}function vO(){const{past:t,future:e}=kb();if(t.length!==0){pu=!0;try{const n=ce.getState().document,i=JSON.stringify(n),r=[...t],a=r.pop(),s=JSON.parse(a);wb({past:r,future:[...e,i]});const o=ce.getState().selectedBlockId,l=o&&!s[o];ce.setState({document:s,...l?{selectedBlockId:null}:{}})}finally{pu=!1,Ib=null}}}function EO(){const{past:t,future:e}=kb();if(e.length!==0){pu=!0;try{const n=ce.getState().document,i=JSON.stringify(n),r=[...e],a=r.pop(),s=JSON.parse(a);wb({past:[...t,i],future:r});const o=ce.getState().selectedBlockId,l=o&&!s[o];ce.setState({document:s,...l?{selectedBlockId:null}:{}})}finally{pu=!1,Ib=null}}}function Jc(t,e=!0){const n=ce.getState().document,i={...n,...t};e&&qp(n);const r=()=>{ce.setState({document:i}),Wh()};return e?(D.startTransition(r),ce.getState()):r()}function Ob(t){return ce.setState({selectedScreenSize:t})}function Fd(t,e){return ce.setState({imageUploading:{uploading:t,id:e||""}})}function sU(t){return ce.setState({disableEdition:t})}function Yle(){return ce.getState().document.root.data}function Lv(){return ce(t=>t.document?.root?.data)}function Kle(t){return ce.setState({color:t})}function Qle(t){return ce.setState({galleryImages:t})}function Mb(){return ce.getState().galleryImages}function Xle(t){return ce.setState({imagePlaceholder:t})}function Jle(){return ce.getState().imagePlaceholder}function Zle(t){return ce.setState({freeMode:t})}function oA(){return ce.getState().freeMode}function ece(t){return ce.setState({darkMode:t})}function tce(t){return ce.setState({stickyHeader:t})}function nce(t){return ce.setState({heightContent:t})}function ice(t){return ce.setState({containerGrow:t})}function rce(){return ce.getState().containerGrow}function ace(t){return ce.setState({showVersion:t})}function sce(){return ce(t=>t.showVersion)}function ah(t,e,n,i=!0){Ru({draggedId:e,targetId:t})&&console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");const r=ce.getState().document,a=JSON.parse(JSON.stringify({...r})),s=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 p=n==="up"?d:d+1;return u.toSpliced(p,0,e)};let l=null,c=null;for(const[u,d]of Object.entries(a)){const p=d;if(c)break;switch(p.type){case"EmailLayout":p.data.childrenIds?.length&&p.data.childrenIds.includes(e)&&(c=u,a[u]={...p,data:{...p.data,childrenIds:s(p.data.childrenIds)}});break;case"Container":p.data.props?.childrenIds?.length&&p.data.props.childrenIds.includes(e)&&(c=u,a[u]={...p,data:{...p.data,props:{...p.data.props,childrenIds:s(p.data.props.childrenIds)}}});break;case"ColumnsContainer":if(p.data.props?.columns){let f=!1;const m=p.data.props.columns.map((g,_)=>g?.childrenIds?.includes(e)?(c=`${u}-column-${_}`,f=!0,{...g,childrenIds:s(g.childrenIds)}):g);f&&(a[u]={...p,data:{...p.data,props:{...p.data.props,columns:m}}})}break}}if(l=null,i)for(const[u,d]of Object.entries(a)){const p=d;if(l)break;switch(p.type){case"EmailLayout":p.data.childrenIds?.length&&p.data.childrenIds.includes(t)&&(l=u,a[u]={...p,data:{...p.data,childrenIds:o(p.data.childrenIds)}});break;case"Container":p.data.props?.childrenIds?.length&&p.data.props.childrenIds.includes(t)&&(l=u,a[u]={...p,data:{...p.data,props:{...p.data.props,childrenIds:o(p.data.props.childrenIds)}}});break;case"ColumnsContainer":if(p.data.props?.columns){const f=nU(t);if(f&&f.parentBlockId===u){l=u;const{columnIndex:g}=f,_=p.data.props.columns.map((b,y)=>{if(y!==g)return b;const E=[...b?.childrenIds||[]],v=n==="up"?0:E.length;return{...b,childrenIds:E.toSpliced(v,0,e)}});a[u]={...p,data:{...p.data,props:{...p.data.props,columns:_}}};break}const m=p.data.props.columns.map((g,_)=>g?.childrenIds?.includes(t)?(l=`${u}-column-${_}`,{...g,childrenIds:o(g.childrenIds)}):g);a[u]={...p,data:{...p.data,props:{...p.data.props,columns:m}}}}break}}return Jc(a)}function oce({parentId:t,blockId:e,indexArray:n}){if(Ru({draggedId:e,targetId:t})){console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");return}return aU(()=>{ah("",e,"down",!1);const i=ce.getState().document,r=JSON.parse(JSON.stringify({...i}));if(!r[t])return;const a=r[t],s=[...a.data.props.columns||[]];return s[n||0]={childrenIds:[e]},r[t]={type:"ColumnsContainer",data:{...a.data,props:{...a.data.props,columns:s}}},Jc(r)})}function lce({parentId:t,blockId:e}){if(Ru({draggedId:e,targetId:t})){console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");return}return aU(()=>{ah("",e,"down",!1);const n=ce.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]}}},Jc(i)})}function Ru({draggedId:t,targetId:e}){if(t===e)return!0;const n=nU(e),i=n?n.parentBlockId:e;if(t===i)return!0;const r=ce.getState().document;function a(s,o){const l=r[s];if(!l)return!1;let c=[];switch(l.type){case"EmailLayout":c=l.data.childrenIds||[];break;case"Container":c=l.data.props?.childrenIds||[];break;case"ColumnsContainer":l.data.props?.columns&&l.data.props.columns.forEach(u=>{u?.childrenIds&&(c=[...c,...u.childrenIds])});break}if(c.includes(o))return!0;for(const u of c)if(a(u,o))return!0;return!1}return a(t,i)}function cce(){return ce(t=>t.colorPicker)}function vS(t){ce.setState(e=>({colorPicker:{...e.colorPicker,...t}}))}function oU(t,e){if(pu)return;const n=ce.getState().document,i=n[t];if(!i){console.warn(`Block ${t} not found`);return}const r=e(i);if(i===r)return;const a={...n,[t]:r};qp(n,t),D.startTransition(()=>{ce.setState({document:a})}),Wh()}function uce(t,e){if(pu)return;const n=ce.getState().document,i=n[t];if(!i){console.warn(`Block ${t} not found`);return}const r=e(i);if(i===r)return;const a={...n,[t]:r};qp(n,t),ce.setState({document:a}),Wh()}function dce(t,e){oU(t,n=>{const i=typeof e=="function"?e(n.data.props):{...n.data.props,...e};return{...n,data:{...n.data,props:i}}})}function Hg(t,e){uce(t,n=>{const i=typeof e=="function"?e(n.data.props):{...n.data.props,...e};return{...n,data:{...n.data,props:i}}})}function hk(t,e,n,i){const r=ce.getState().document,a=r[t];if(!a)return;const s=a.type==="EmailLayout"?{...a,data:{...a.data,childrenIds:i}}:{...a,data:{...a.data,props:{...a.data?.props,childrenIds:i}}},o={...r,[e]:n,[t]:s};qp(r),D.startTransition(()=>{ce.setState({document:o})}),Wh()}function pce(t){const e=ce.getState().document,n={...e,...t};qp(e),D.startTransition(()=>{ce.setState({document:n})}),Wh()}function Pb(t,e){oU(t,e)}var tn;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function n(r){throw new Error}t.assertNever=n,t.arrayToEnum=r=>{const a={};for(const s of r)a[s]=s;return a},t.getValidEnumValues=r=>{const a=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),s={};for(const o of a)s[o]=r[o];return t.objectValues(s)},t.objectValues=r=>t.objectKeys(r).map(function(a){return r[a]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const a=[];for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&a.push(s);return a},t.find=(r,a)=>{for(const s of r)if(a(s))return s},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,a=" | "){return r.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}t.joinValues=i,t.jsonStringifyReplacer=(r,a)=>typeof a=="bigint"?a.toString():a})(tn||(tn={}));var SO;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(SO||(SO={}));const je=tn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Tl=t=>{switch(typeof t){case"undefined":return je.undefined;case"string":return je.string;case"number":return Number.isNaN(t)?je.nan:je.number;case"boolean":return je.boolean;case"function":return je.function;case"bigint":return je.bigint;case"symbol":return je.symbol;case"object":return Array.isArray(t)?je.array:t===null?je.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?je.promise:typeof Map<"u"&&t instanceof Map?je.map:typeof Set<"u"&&t instanceof Set?je.set:typeof Date<"u"&&t instanceof Date?je.date:je.object;default:return je.unknown}},ve=tn.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"]);class Ho 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(a){return a.message},i={_errors:[]},r=a=>{for(const s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(r);else if(s.code==="invalid_return_type")r(s.returnTypeError);else if(s.code==="invalid_arguments")r(s.argumentsError);else if(s.path.length===0)i._errors.push(n(s));else{let o=i,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(n(s))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return r(this),i}static assert(e){if(!(e instanceof Ho))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,tn.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 a=r.path[0];n[a]=n[a]||[],n[a].push(e(r))}else i.push(e(r));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}}Ho.create=t=>new Ho(t);const gk=(t,e)=>{let n;switch(t.code){case ve.invalid_type:t.received===je.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case ve.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,tn.jsonStringifyReplacer)}`;break;case ve.unrecognized_keys:n=`Unrecognized key(s) in object: ${tn.joinValues(t.keys,", ")}`;break;case ve.invalid_union:n="Invalid input";break;case ve.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${tn.joinValues(t.options)}`;break;case ve.invalid_enum_value:n=`Invalid enum value. Expected ${tn.joinValues(t.options)}, received '${t.received}'`;break;case ve.invalid_arguments:n="Invalid function arguments";break;case ve.invalid_return_type:n="Invalid function return type";break;case ve.invalid_date:n="Invalid date";break;case ve.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}"`:tn.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case ve.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 ve.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 ve.custom:n="Invalid input";break;case ve.invalid_intersection_types:n="Intersection results could not be merged";break;case ve.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case ve.not_finite:n="Number must be finite";break;default:n=e.defaultError,tn.assertNever(t)}return{message:n}};let fce=gk;function mce(){return fce}const hce=t=>{const{data:e,path:n,errorMaps:i,issueData:r}=t,a=[...n,...r.path||[]],s={...r,path:a};if(r.message!==void 0)return{...r,path:a,message:r.message};let o="";const l=i.filter(c=>!!c).slice().reverse();for(const c of l)o=c(s,{data:e,defaultError:o}).message;return{...r,path:a,message:o}};function $e(t,e){const n=mce(),i=hce({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===gk?void 0:gk].filter(r=>!!r)});t.common.issues.push(i)}class br{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 kt;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 a=await r.key,s=await r.value;i.push({key:a,value:s})}return br.mergeObjectSync(e,i)}static mergeObjectSync(e,n){const i={};for(const r of n){const{key:a,value:s}=r;if(a.status==="aborted"||s.status==="aborted")return kt;a.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof s.value<"u"||r.alwaysSet)&&(i[a.value]=s.value)}return{status:e.value,value:i}}}const kt=Object.freeze({status:"aborted"}),Qf=t=>({status:"dirty",value:t}),qa=t=>({status:"valid",value:t}),CO=t=>t.status==="aborted",TO=t=>t.status==="dirty",cp=t=>t.status==="valid",Lb=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 Qs{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 xO=(t,e)=>{if(cp(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 Ho(t.common.issues);return this._error=n,this._error}}};function Pt(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:(s,o)=>{const{message:l}=t;return s.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??i??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:l??n??o.defaultError}},description:r}}class jt{get description(){return this._def.description}_getType(e){return Tl(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Tl(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new br,ctx:{common:e.parent.common,data:e.data,parsedType:Tl(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Lb(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:Tl(e)},r=this._parseSync({data:e,path:i.path,parent:i});return xO(i,r)}"~validate"(e){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Tl(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return cp(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=>cp(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:Tl(e)},r=this._parse({data:e,path:i.path,parent:i}),a=await(Lb(r)?r:Promise.resolve(r));return xO(i,a)}refine(e,n){const i=r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,a)=>{const s=e(r),o=()=>a.addIssue({code:ve.custom,...i(r)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(o(),!1)):s?!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 hu({schema:this,typeName:wt.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 Mo.create(this,this._def)}nullable(){return gu.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return js.create(this)}promise(){return Gb.create(this,this._def)}or(e){return Bb.create([this,e],this._def)}and(e){return $b.create(this,e,this._def)}transform(e){return new hu({...Pt(this._def),schema:this,typeName:wt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Hb({...Pt(this._def),innerType:this,defaultValue:n,typeName:wt.ZodDefault})}brand(){return new dU({typeName:wt.ZodBranded,type:this,...Pt(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new jb({...Pt(this._def),innerType:this,catchValue:n,typeName:wt.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return cA.create(this,e)}readonly(){return qb.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const gce=/^c[^\s-]{8,}$/i,_ce=/^[0-9a-z]+$/,bce=/^[0-9A-HJKMNP-TV-Z]{26}$/i,yce=/^[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,vce=/^[a-z0-9_-]{21}$/i,Ece=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Sce=/^[-+]?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)?)??$/,Cce=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Tce="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ES;const xce=/^(?:(?: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])$/,kce=/^(?:(?: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])$/,wce=/^(([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]))$/,Dce=/^(([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])$/,Ace=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Nce=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,lU="((\\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])))",Rce=new RegExp(`^${lU}$`);function cU(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 Ice(t){return new RegExp(`^${cU(t)}$`)}function Oce(t){let e=`${lU}T${cU(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 Mce(t,e){return!!((e==="v4"||!e)&&xce.test(t)||(e==="v6"||!e)&&wce.test(t))}function Pce(t,e){if(!Ece.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 Lce(t,e){return!!((e==="v4"||!e)&&kce.test(t)||(e==="v6"||!e)&&Dce.test(t))}class No extends jt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==je.string){const a=this._getOrReturnCtx(e);return $e(a,{code:ve.invalid_type,expected:je.string,received:a.parsedType}),kt}const i=new br;let r;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),i.dirty());else if(a.kind==="max")e.data.length>a.value&&(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),i.dirty());else if(a.kind==="length"){const s=e.data.length>a.value,o=e.data.length<a.value;(s||o)&&(r=this._getOrReturnCtx(e,r),s?$e(r,{code:ve.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&$e(r,{code:ve.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),i.dirty())}else if(a.kind==="email")Cce.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"email",code:ve.invalid_string,message:a.message}),i.dirty());else if(a.kind==="emoji")ES||(ES=new RegExp(Tce,"u")),ES.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"emoji",code:ve.invalid_string,message:a.message}),i.dirty());else if(a.kind==="uuid")yce.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"uuid",code:ve.invalid_string,message:a.message}),i.dirty());else if(a.kind==="nanoid")vce.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"nanoid",code:ve.invalid_string,message:a.message}),i.dirty());else if(a.kind==="cuid")gce.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"cuid",code:ve.invalid_string,message:a.message}),i.dirty());else if(a.kind==="cuid2")_ce.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"cuid2",code:ve.invalid_string,message:a.message}),i.dirty());else if(a.kind==="ulid")bce.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"ulid",code:ve.invalid_string,message:a.message}),i.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),$e(r,{validation:"url",code:ve.invalid_string,message:a.message}),i.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"regex",code:ve.invalid_string,message:a.message}),i.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),i.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.invalid_string,validation:{startsWith:a.value},message:a.message}),i.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.invalid_string,validation:{endsWith:a.value},message:a.message}),i.dirty()):a.kind==="datetime"?Oce(a).test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.invalid_string,validation:"datetime",message:a.message}),i.dirty()):a.kind==="date"?Rce.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.invalid_string,validation:"date",message:a.message}),i.dirty()):a.kind==="time"?Ice(a).test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.invalid_string,validation:"time",message:a.message}),i.dirty()):a.kind==="duration"?Sce.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"duration",code:ve.invalid_string,message:a.message}),i.dirty()):a.kind==="ip"?Mce(e.data,a.version)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"ip",code:ve.invalid_string,message:a.message}),i.dirty()):a.kind==="jwt"?Pce(e.data,a.alg)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"jwt",code:ve.invalid_string,message:a.message}),i.dirty()):a.kind==="cidr"?Lce(e.data,a.version)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"cidr",code:ve.invalid_string,message:a.message}),i.dirty()):a.kind==="base64"?Ace.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"base64",code:ve.invalid_string,message:a.message}),i.dirty()):a.kind==="base64url"?Nce.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"base64url",code:ve.invalid_string,message:a.message}),i.dirty()):tn.assertNever(a);return{status:i.value,value:e.data}}_regex(e,n,i){return this.refinement(r=>e.test(r),{validation:n,code:ve.invalid_string,...Ke.errToObj(i)})}_addCheck(e){return new No({...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 No({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new No({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new No({...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}}No.create=t=>new No({checks:[],typeName:wt.ZodString,coerce:t?.coerce??!1,...Pt(t)});function Fce(t,e){const n=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,r=n>i?n:i,a=Number.parseInt(t.toFixed(r).replace(".","")),s=Number.parseInt(e.toFixed(r).replace(".",""));return a%s/10**r}class up extends jt{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)!==je.number){const a=this._getOrReturnCtx(e);return $e(a,{code:ve.invalid_type,expected:je.number,received:a.parsedType}),kt}let i;const r=new br;for(const a of this._def.checks)a.kind==="int"?tn.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),$e(i,{code:ve.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(i=this._getOrReturnCtx(e,i),$e(i,{code:ve.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(i=this._getOrReturnCtx(e,i),$e(i,{code:ve.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="multipleOf"?Fce(e.data,a.value)!==0&&(i=this._getOrReturnCtx(e,i),$e(i,{code:ve.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),$e(i,{code:ve.not_finite,message:a.message}),r.dirty()):tn.assertNever(a);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 up({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:Ke.toString(r)}]})}_addCheck(e){return new up({...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"&&tn.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)}}up.create=t=>new up({checks:[],typeName:wt.ZodNumber,coerce:t?.coerce||!1,...Pt(t)});class sh extends jt{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)!==je.bigint)return this._getInvalidInput(e);let i;const r=new br;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(i=this._getOrReturnCtx(e,i),$e(i,{code:ve.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(i=this._getOrReturnCtx(e,i),$e(i,{code:ve.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),$e(i,{code:ve.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):tn.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return $e(n,{code:ve.invalid_type,expected:je.bigint,received:n.parsedType}),kt}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 sh({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:Ke.toString(r)}]})}_addCheck(e){return new sh({...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}}sh.create=t=>new sh({checks:[],typeName:wt.ZodBigInt,coerce:t?.coerce??!1,...Pt(t)});class _k extends jt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==je.boolean){const i=this._getOrReturnCtx(e);return $e(i,{code:ve.invalid_type,expected:je.boolean,received:i.parsedType}),kt}return qa(e.data)}}_k.create=t=>new _k({typeName:wt.ZodBoolean,coerce:t?.coerce||!1,...Pt(t)});class Fb extends jt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==je.date){const a=this._getOrReturnCtx(e);return $e(a,{code:ve.invalid_type,expected:je.date,received:a.parsedType}),kt}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return $e(a,{code:ve.invalid_date}),kt}const i=new br;let r;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),i.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),i.dirty()):tn.assertNever(a);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Fb({...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}}Fb.create=t=>new Fb({checks:[],coerce:t?.coerce||!1,typeName:wt.ZodDate,...Pt(t)});class kO extends jt{_parse(e){if(this._getType(e)!==je.symbol){const i=this._getOrReturnCtx(e);return $e(i,{code:ve.invalid_type,expected:je.symbol,received:i.parsedType}),kt}return qa(e.data)}}kO.create=t=>new kO({typeName:wt.ZodSymbol,...Pt(t)});class bk extends jt{_parse(e){if(this._getType(e)!==je.undefined){const i=this._getOrReturnCtx(e);return $e(i,{code:ve.invalid_type,expected:je.undefined,received:i.parsedType}),kt}return qa(e.data)}}bk.create=t=>new bk({typeName:wt.ZodUndefined,...Pt(t)});class yk extends jt{_parse(e){if(this._getType(e)!==je.null){const i=this._getOrReturnCtx(e);return $e(i,{code:ve.invalid_type,expected:je.null,received:i.parsedType}),kt}return qa(e.data)}}yk.create=t=>new yk({typeName:wt.ZodNull,...Pt(t)});class wO extends jt{constructor(){super(...arguments),this._any=!0}_parse(e){return qa(e.data)}}wO.create=t=>new wO({typeName:wt.ZodAny,...Pt(t)});class DO extends jt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return qa(e.data)}}DO.create=t=>new DO({typeName:wt.ZodUnknown,...Pt(t)});class Ql extends jt{_parse(e){const n=this._getOrReturnCtx(e);return $e(n,{code:ve.invalid_type,expected:je.never,received:n.parsedType}),kt}}Ql.create=t=>new Ql({typeName:wt.ZodNever,...Pt(t)});class AO extends jt{_parse(e){if(this._getType(e)!==je.undefined){const i=this._getOrReturnCtx(e);return $e(i,{code:ve.invalid_type,expected:je.void,received:i.parsedType}),kt}return qa(e.data)}}AO.create=t=>new AO({typeName:wt.ZodVoid,...Pt(t)});class js extends jt{_parse(e){const{ctx:n,status:i}=this._processInputParams(e),r=this._def;if(n.parsedType!==je.array)return $e(n,{code:ve.invalid_type,expected:je.array,received:n.parsedType}),kt;if(r.exactLength!==null){const s=n.data.length>r.exactLength.value,o=n.data.length<r.exactLength.value;(s||o)&&($e(n,{code:s?ve.too_big:ve.too_small,minimum:o?r.exactLength.value:void 0,maximum:s?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&&($e(n,{code:ve.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&&($e(n,{code:ve.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((s,o)=>r.type._parseAsync(new Qs(n,s,n.path,o)))).then(s=>br.mergeArray(i,s));const a=[...n.data].map((s,o)=>r.type._parseSync(new Qs(n,s,n.path,o)));return br.mergeArray(i,a)}get element(){return this._def.type}min(e,n){return new js({...this._def,minLength:{value:e,message:Ke.toString(n)}})}max(e,n){return new js({...this._def,maxLength:{value:e,message:Ke.toString(n)}})}length(e,n){return new js({...this._def,exactLength:{value:e,message:Ke.toString(n)}})}nonempty(e){return this.min(1,e)}}js.create=(t,e)=>new js({type:t,minLength:null,maxLength:null,exactLength:null,typeName:wt.ZodArray,...Pt(e)});function _d(t){if(t instanceof yi){const e={};for(const n in t.shape){const i=t.shape[n];e[n]=Mo.create(_d(i))}return new yi({...t._def,shape:()=>e})}else return t instanceof js?new js({...t._def,type:_d(t.element)}):t instanceof Mo?Mo.create(_d(t.unwrap())):t instanceof gu?gu.create(_d(t.unwrap())):t instanceof fu?fu.create(t.items.map(e=>_d(e))):t}class yi extends jt{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=tn.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==je.object){const c=this._getOrReturnCtx(e);return $e(c,{code:ve.invalid_type,expected:je.object,received:c.parsedType}),kt}const{status:i,ctx:r}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof Ql&&this._def.unknownKeys==="strip"))for(const c in r.data)s.includes(c)||o.push(c);const l=[];for(const c of s){const u=a[c],d=r.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Qs(r,d,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof Ql){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&&($e(r,{code:ve.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 Qs(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,p=await u.value;c.push({key:d,value:p,alwaysSet:u.alwaysSet})}return c}).then(c=>br.mergeObjectSync(i,c)):br.mergeObjectSync(i,l)}get shape(){return this._def.shape()}strict(e){return Ke.errToObj,new yi({...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 yi({...this._def,unknownKeys:"strip"})}passthrough(){return new yi({...this._def,unknownKeys:"passthrough"})}extend(e){return new yi({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new yi({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:wt.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new yi({...this._def,catchall:e})}pick(e){const n={};for(const i of tn.objectKeys(e))e[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new yi({...this._def,shape:()=>n})}omit(e){const n={};for(const i of tn.objectKeys(this.shape))e[i]||(n[i]=this.shape[i]);return new yi({...this._def,shape:()=>n})}deepPartial(){return _d(this)}partial(e){const n={};for(const i of tn.objectKeys(this.shape)){const r=this.shape[i];e&&!e[i]?n[i]=r:n[i]=r.optional()}return new yi({...this._def,shape:()=>n})}required(e){const n={};for(const i of tn.objectKeys(this.shape))if(e&&!e[i])n[i]=this.shape[i];else{let a=this.shape[i];for(;a instanceof Mo;)a=a._def.innerType;n[i]=a}return new yi({...this._def,shape:()=>n})}keyof(){return uU(tn.objectKeys(this.shape))}}yi.create=(t,e)=>new yi({shape:()=>t,unknownKeys:"strip",catchall:Ql.create(),typeName:wt.ZodObject,...Pt(e)});yi.strictCreate=(t,e)=>new yi({shape:()=>t,unknownKeys:"strict",catchall:Ql.create(),typeName:wt.ZodObject,...Pt(e)});yi.lazycreate=(t,e)=>new yi({shape:t,unknownKeys:"strip",catchall:Ql.create(),typeName:wt.ZodObject,...Pt(e)});class Bb extends jt{_parse(e){const{ctx:n}=this._processInputParams(e),i=this._def.options;function r(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;const s=a.map(o=>new Ho(o.ctx.common.issues));return $e(n,{code:ve.invalid_union,unionErrors:s}),kt}if(n.common.async)return Promise.all(i.map(async a=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(r);{let a;const s=[];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"&&!a&&(a={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(l=>new Ho(l));return $e(n,{code:ve.invalid_union,unionErrors:o}),kt}}get options(){return this._def.options}}Bb.create=(t,e)=>new Bb({options:t,typeName:wt.ZodUnion,...Pt(e)});const So=t=>t instanceof Ek?So(t.schema):t instanceof hu?So(t.innerType()):t instanceof zb?[t.value]:t instanceof mu?t.options:t instanceof Sk?tn.objectValues(t.enum):t instanceof Hb?So(t._def.innerType):t instanceof bk?[void 0]:t instanceof yk?[null]:t instanceof Mo?[void 0,...So(t.unwrap())]:t instanceof gu?[null,...So(t.unwrap())]:t instanceof dU||t instanceof qb?So(t.unwrap()):t instanceof jb?So(t._def.innerType):[];class lA extends jt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==je.object)return $e(n,{code:ve.invalid_type,expected:je.object,received:n.parsedType}),kt;const i=this.discriminator,r=n.data[i],a=this.optionsMap.get(r);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):($e(n,{code:ve.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),kt)}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 a of n){const s=So(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of s){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,a)}}return new lA({typeName:wt.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:r,...Pt(i)})}}function vk(t,e){const n=Tl(t),i=Tl(e);if(t===e)return{valid:!0,data:t};if(n===je.object&&i===je.object){const r=tn.objectKeys(e),a=tn.objectKeys(t).filter(o=>r.indexOf(o)!==-1),s={...t,...e};for(const o of a){const l=vk(t[o],e[o]);if(!l.valid)return{valid:!1};s[o]=l.data}return{valid:!0,data:s}}else if(n===je.array&&i===je.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let a=0;a<t.length;a++){const s=t[a],o=e[a],l=vk(s,o);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return n===je.date&&i===je.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class $b extends jt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e),r=(a,s)=>{if(CO(a)||CO(s))return kt;const o=vk(a.value,s.value);return o.valid?((TO(a)||TO(s))&&n.dirty(),{status:n.value,value:o.data}):($e(i,{code:ve.invalid_intersection_types}),kt)};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(([a,s])=>r(a,s)):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}))}}$b.create=(t,e,n)=>new $b({left:t,right:e,typeName:wt.ZodIntersection,...Pt(n)});class fu extends jt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==je.array)return $e(i,{code:ve.invalid_type,expected:je.array,received:i.parsedType}),kt;if(i.data.length<this._def.items.length)return $e(i,{code:ve.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),kt;!this._def.rest&&i.data.length>this._def.items.length&&($e(i,{code:ve.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const a=[...i.data].map((s,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new Qs(i,s,i.path,o)):null}).filter(s=>!!s);return i.common.async?Promise.all(a).then(s=>br.mergeArray(n,s)):br.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new fu({...this._def,rest:e})}}fu.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new fu({items:t,typeName:wt.ZodTuple,rest:null,...Pt(e)})};class Ub extends jt{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!==je.object)return $e(i,{code:ve.invalid_type,expected:je.object,received:i.parsedType}),kt;const r=[],a=this._def.keyType,s=this._def.valueType;for(const o in i.data)r.push({key:a._parse(new Qs(i,o,i.path,o)),value:s._parse(new Qs(i,i.data[o],i.path,o)),alwaysSet:o in i.data});return i.common.async?br.mergeObjectAsync(n,r):br.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(e,n,i){return n instanceof jt?new Ub({keyType:e,valueType:n,typeName:wt.ZodRecord,...Pt(i)}):new Ub({keyType:No.create(),valueType:e,typeName:wt.ZodRecord,...Pt(n)})}}class NO extends jt{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!==je.map)return $e(i,{code:ve.invalid_type,expected:je.map,received:i.parsedType}),kt;const r=this._def.keyType,a=this._def.valueType,s=[...i.data.entries()].map(([o,l],c)=>({key:r._parse(new Qs(i,o,i.path,[c,"key"])),value:a._parse(new Qs(i,l,i.path,[c,"value"]))}));if(i.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of s){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return kt;(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 s){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return kt;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),o.set(c.value,u.value)}return{status:n.value,value:o}}}}NO.create=(t,e,n)=>new NO({valueType:e,keyType:t,typeName:wt.ZodMap,...Pt(n)});class oh extends jt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==je.set)return $e(i,{code:ve.invalid_type,expected:je.set,received:i.parsedType}),kt;const r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&($e(i,{code:ve.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&&($e(i,{code:ve.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());const a=this._def.valueType;function s(l){const c=new Set;for(const u of l){if(u.status==="aborted")return kt;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const o=[...i.data.values()].map((l,c)=>a._parse(new Qs(i,l,i.path,c)));return i.common.async?Promise.all(o).then(l=>s(l)):s(o)}min(e,n){return new oh({...this._def,minSize:{value:e,message:Ke.toString(n)}})}max(e,n){return new oh({...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)}}oh.create=(t,e)=>new oh({valueType:t,minSize:null,maxSize:null,typeName:wt.ZodSet,...Pt(e)});class Ek extends jt{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})}}Ek.create=(t,e)=>new Ek({getter:t,typeName:wt.ZodLazy,...Pt(e)});class zb extends jt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return $e(n,{received:n.data,code:ve.invalid_literal,expected:this._def.value}),kt}return{status:"valid",value:e.data}}get value(){return this._def.value}}zb.create=(t,e)=>new zb({value:t,typeName:wt.ZodLiteral,...Pt(e)});function uU(t,e){return new mu({values:t,typeName:wt.ZodEnum,...Pt(e)})}class mu extends jt{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),i=this._def.values;return $e(n,{expected:tn.joinValues(i),received:n.parsedType,code:ve.invalid_type}),kt}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 $e(n,{received:n.data,code:ve.invalid_enum_value,options:i}),kt}return qa(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 mu.create(e,{...this._def,...n})}exclude(e,n=this._def){return mu.create(this.options.filter(i=>!e.includes(i)),{...this._def,...n})}}mu.create=uU;class Sk extends jt{_parse(e){const n=tn.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==je.string&&i.parsedType!==je.number){const r=tn.objectValues(n);return $e(i,{expected:tn.joinValues(r),received:i.parsedType,code:ve.invalid_type}),kt}if(this._cache||(this._cache=new Set(tn.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=tn.objectValues(n);return $e(i,{received:i.data,code:ve.invalid_enum_value,options:r}),kt}return qa(e.data)}get enum(){return this._def.values}}Sk.create=(t,e)=>new Sk({values:t,typeName:wt.ZodNativeEnum,...Pt(e)});class Gb extends jt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==je.promise&&n.common.async===!1)return $e(n,{code:ve.invalid_type,expected:je.promise,received:n.parsedType}),kt;const i=n.parsedType===je.promise?n.data:Promise.resolve(n.data);return qa(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Gb.create=(t,e)=>new Gb({type:t,typeName:wt.ZodPromise,...Pt(e)});class hu extends jt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===wt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:i}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:s=>{$e(i,s),s.fatal?n.abort():n.dirty()},get path(){return i.path}};if(a.addIssue=a.addIssue.bind(a),r.type==="preprocess"){const s=r.transform(i.data,a);if(i.common.async)return Promise.resolve(s).then(async o=>{if(n.value==="aborted")return kt;const l=await this._def.schema._parseAsync({data:o,path:i.path,parent:i});return l.status==="aborted"?kt:l.status==="dirty"||n.value==="dirty"?Qf(l.value):l});{if(n.value==="aborted")return kt;const o=this._def.schema._parseSync({data:s,path:i.path,parent:i});return o.status==="aborted"?kt:o.status==="dirty"||n.value==="dirty"?Qf(o.value):o}}if(r.type==="refinement"){const s=o=>{const l=r.refinement(o,a);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"?kt:(o.status==="dirty"&&n.dirty(),s(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"?kt:(o.status==="dirty"&&n.dirty(),s(o.value).then(()=>({status:n.value,value:o.value}))))}if(r.type==="transform")if(i.common.async===!1){const s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!cp(s))return kt;const o=r.transform(s.value,a);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(s=>cp(s)?Promise.resolve(r.transform(s.value,a)).then(o=>({status:n.value,value:o})):kt);tn.assertNever(r)}}hu.create=(t,e,n)=>new hu({schema:t,typeName:wt.ZodEffects,effect:e,...Pt(n)});hu.createWithPreprocess=(t,e,n)=>new hu({schema:e,effect:{type:"preprocess",transform:t},typeName:wt.ZodEffects,...Pt(n)});class Mo extends jt{_parse(e){return this._getType(e)===je.undefined?qa(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Mo.create=(t,e)=>new Mo({innerType:t,typeName:wt.ZodOptional,...Pt(e)});class gu extends jt{_parse(e){return this._getType(e)===je.null?qa(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}gu.create=(t,e)=>new gu({innerType:t,typeName:wt.ZodNullable,...Pt(e)});class Hb extends jt{_parse(e){const{ctx:n}=this._processInputParams(e);let i=n.data;return n.parsedType===je.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Hb.create=(t,e)=>new Hb({innerType:t,typeName:wt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Pt(e)});class jb extends jt{_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 Lb(r)?r.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Ho(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ho(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}jb.create=(t,e)=>new jb({innerType:t,typeName:wt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Pt(e)});class RO extends jt{_parse(e){if(this._getType(e)!==je.nan){const i=this._getOrReturnCtx(e);return $e(i,{code:ve.invalid_type,expected:je.nan,received:i.parsedType}),kt}return{status:"valid",value:e.data}}}RO.create=t=>new RO({typeName:wt.ZodNaN,...Pt(t)});class dU extends jt{_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 cA extends jt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?kt:a.status==="dirty"?(n.dirty(),Qf(a.value)):this._def.out._parseAsync({data:a.value,path:i.path,parent:i})})();{const r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?kt: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 cA({in:e,out:n,typeName:wt.ZodPipeline})}}class qb extends jt{_parse(e){const n=this._def.innerType._parse(e),i=r=>(cp(r)&&(r.value=Object.freeze(r.value)),r);return Lb(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}}qb.create=(t,e)=>new qb({innerType:t,typeName:wt.ZodReadonly,...Pt(e)});var wt;(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"})(wt||(wt={}));const rt=No.create,Oe=up.create,Fs=_k.create;Ql.create;const Bd=js.create,vt=yi.create,$d=Bb.create,Bce=lA.create;$b.create;const pU=fu.create,$ce=Ub.create,Ck=zb.create,Vn=mu.create;Gb.create;Mo.create;gu.create;function jg(t,e){return!t||t&&t[e]===0?"initial":t[e]!==void 0?`${t[e]}px solid ${t?.color??"black"}`:"initial"}function Zr({className:t,background:e,backgroundColor:n,padding:i={top:0,right:0,bottom:0,left:0},width:r,align:a,children:s,border:o,borderRadius:l,isParent:c=!0,overflow:u="visible"}){const d=t?`a${t}`:"",p={width:r,minWidth:r,borderRadius:l??"initial",borderTop:jg(o,"top"),borderBottom:jg(o,"bottom"),borderLeft:jg(o,"left"),borderRight:jg(o,"right"),overflow:u,borderCollapse:"initial"};return e&&String(e).trim()!==""?p.background=e:n&&(p.backgroundColor=n),h.jsx("table",{className:t,width:r,border:0,cellSpacing:"0",cellPadding:"0",style:p,children:h.jsxs("tbody",{children:[h.jsxs("tr",{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:a,children:s}),h.jsx("td",{style:{width:`${i.right}px`},className:c?`r${t}`:`ir${t}`})]}),h.jsxs("tr",{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 uA=t=>t?["http","mailto:","tel:","sms:","whatsapp:"].some(n=>t.startsWith(n))?t:`//${t}`:"#",fU=[{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'}],Uce={FAMILY:"MODERN_SANS"},Vp=Vn(["MODERN_SANS","LATO","MERRIWEATHER","MONTSERRAT","OPEN_SANS","OSWALD","PACIFICO","PLAYFAIR","ROBOTO","INHERIT"]).nullable().optional(),IO=t=>fU.find(e=>e.key===t)?.value;function Xl(t){const e=Yle();let n=IO(t);return n||(n=IO(e?.fontFamily),n||"inherit")}const Iu=(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 dA(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:a=0}=e;return`${n}px ${i}px ${a}px ${r}px`}}function zce(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=(e>>>0)*16777619;return e>>>0}function Gce(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 Wt(t){const e=zce(t);return`b${Gce(e)}`}const Nf=rt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),OO=vt({top:Oe(),bottom:Oe(),right:Oe(),left:Oe()}).optional().nullable(),Hce=t=>({top:t?.top??0,right:t?.right??0,bottom:t?.bottom??0,left:t?.left??0}),jce=vt({topLeft:Oe().min(0).optional(),topRight:Oe().min(0).optional(),bottomLeft:Oe().min(0).optional(),bottomRight:Oe().min(0).optional()}),MO=vt({top:Oe().min(0).optional(),bottom:Oe().min(0).optional(),left:Oe().min(0).optional(),right:Oe().min(0).optional()}),mU=vt({style:vt({backgroundColor:Nf,fontSize:Oe().min(0).optional().nullable(),fontSizeMobile:Oe().min(0).optional().nullable(),fontFamily:Vp,background:rt().nullable().optional(),buttonBackgroundColor:Nf,buttonTextColor:Nf,fontWeight:Vn(["bold","normal"]).optional().nullable(),textAlign:Vn(["left","center","right"]).optional().nullable(),textAlignMobile:Vn(["left","center","right"]).optional().nullable(),padding:OO,mobilePadding:OO,shape:$d([Vn(["rectangle","pill"]),jce]).optional().nullable()}).passthrough().optional().nullable(),props:vt({buttonBackgroundColor:Nf,buttonTextColor:Nf,fullWidth:Fs().optional().nullable(),fullWidthMobile:Fs().optional().nullable(),size:$d([Vn(["x-small","small","medium"]),MO]).optional().nullable(),sizeMobile:$d([Vn(["x-small","small","medium"]),MO]).optional().nullable(),sizePaddingSidesLinked:Fs().optional(),sizeMobilePaddingSidesLinked:Fs().optional(),text:rt().optional().nullable(),url:rt().optional().nullable()}).optional().nullable()}).passthrough();function PO(t){if(t!=null&&typeof t!="string")return{top:t.top??0,right:t.right??0,bottom:t.bottom??0,left:t.left??0};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 Al={text:"",url:"",fullWidth:!1,size:"medium",buttonBackgroundColor:"#999999"};function hU({style:t,props:e,blockId:n}){const i=Lv(),r=fi(),s=!Pv(),o=e?.text??Al.text,l=e?.url??Al.url,c=r==="desktop"?e?.fullWidth??!1:e?.fullWidthMobile??e?.fullWidth??!1,u=t?.buttonTextColor??e?.buttonTextColor??i.textColor,d=t?.buttonBackgroundColor??e?.buttonBackgroundColor??Al.buttonBackgroundColor,p={backgroundColor:t?.backgroundColor??void 0,textAlign:r=="desktop"?t?.textAlign??void 0:t?.textAlignMobile??t?.textAlign,padding:Hce(r=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},f={color:u,fontSize:r=="desktop"?t?.fontSize??16:t?.fontSizeMobile??t?.fontSize??16,fontFamily:Xl(t?.fontFamily),fontWeight:t?.fontWeight??"bold",display:"inline-block",textDecoration:"none"},m={color:t?.borderColor,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},g=t?.background??"",_=t?.backgroundColor,b=_?Iu(g,_):g,y=dA(t),E=Wt(n);return h.jsx(Zr,{background:b,backgroundColor:_,padding:p.padding,align:p.textAlign,width:"100%",className:`c${E}`,children:h.jsx("a",{href:uA(l),target:"_blank",className:`abtn-${E}`,onClick:s?v=>v.preventDefault():void 0,children:h.jsx(Zr,{className:E,padding:r=="desktop"?PO(e?.size):PO(e?.sizeMobile??e?.size),borderRadius:y,background:d,backgroundColor:d,isParent:!1,align:"center",width:c?"100%":void 0,border:m,children:h.jsx("span",{className:`btn${E}`,style:f,children:o})})})})}function gs({title:t,children:e}){return h.jsxs(rh,{sx:{padding:"0!important",paddingTop:"1rem!important"},children:[h.jsx(gn,{sx:{fontWeight:"bold",mb:2,pb:1,color:"text.primary",fontSize:"1.25rem",borderBottom:n=>`1px solid ${n.palette.divider}`},children:t}),h.jsx(_n,{spacing:2,gap:1,mb:3,pt:1,children:e})]})}const qce=Ee(h.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),pA=Ee(h.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"AddOutlined"),gU=Ee(h.jsx("path",{d:"M4 22H2V2h2zM22 7H6v3h16zm-6 7H6v3h10z"}),"AlignHorizontalLeftOutlined"),_U=Ee(h.jsx("path",{d:"M20 2h2v20h-2zM2 10h16V7H2zm6 7h10v-3H8z"}),"AlignHorizontalRightOutlined"),bU=Ee(h.jsx("path",{d:"M22 22H2v-2h20zM10 2H7v16h3zm7 6h-3v10h3z"}),"AlignVerticalBottomOutlined"),yU=Ee(h.jsx("path",{d:"M22 2v2H2V2zM7 22h3V6H7zm7-6h3V6h-3z"}),"AlignVerticalTopOutlined"),Vce=Ee(h.jsx("path",{d:"m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27M12 17.5 6.5 12H10v-2h4v2h3.5zM5.12 5l.81-1h12l.94 1z"}),"Archive"),vU=Ee([h.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),h.jsx("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")],"ArticleOutlined"),Wce=Ee(h.jsx("path",{d:"M2 12.5C2 9.46 4.46 7 7.5 7H18c2.21 0 4 1.79 4 4s-1.79 4-4 4H9.5C8.12 15 7 13.88 7 12.5S8.12 10 9.5 10H17v2H9.41c-.55 0-.55 1 0 1H18c1.1 0 2-.9 2-2s-.9-2-2-2H7.5C5.57 9 4 10.57 4 12.5S5.57 16 7.5 16H17v2H7.5C4.46 18 2 15.54 2 12.5"}),"Attachment"),Tk=Ee(h.jsx("path",{d:"m19 9 1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25zm-7.5.5L9 4 6.5 9.5 1 12l5.5 2.5L9 20l2.5-5.5L17 12zM19 15l-1.25 2.75L15 19l2.75 1.25L19 23l1.25-2.75L23 19l-2.75-1.25z"}),"AutoAwesome"),Yce=Ee(h.jsx("path",{d:"M9 11H7v2h2zm4 4h-2v2h2zM9 3H7v2h2zm4 8h-2v2h2zM5 3H3v2h2zm8 4h-2v2h2zm4 4h-2v2h2zm-4-8h-2v2h2zm4 0h-2v2h2zm2 10h2v-2h-2zm0 4h2v-2h-2zM5 7H3v2h2zm14-4v2h2V3zm0 6h2V7h-2zM5 11H3v2h2zM3 21h18v-2H3zm2-6H3v2h2z"}),"BorderBottomOutlined"),Kce=Ee(h.jsx("path",{d:"M11 21h2v-2h-2zm0-4h2v-2h-2zm0-12h2V3h-2zm0 4h2V7h-2zm0 4h2v-2h-2zm-4 8h2v-2H7zM7 5h2V3H7zm0 8h2v-2H7zm-4 8h2V3H3zM19 9h2V7h-2zm-4 12h2v-2h-2zm4-4h2v-2h-2zm0-14v2h2V3zm0 10h2v-2h-2zm0 8h2v-2h-2zm-4-8h2v-2h-2zm0-8h2V3h-2z"}),"BorderLeftOutlined"),Qce=Ee(h.jsx("path",{d:"M13 7h-2v2h2zm0 4h-2v2h2zm4 0h-2v2h2zM3 3v18h18V3zm16 16H5V5h14zm-6-4h-2v2h2zm-4-4H7v2h2z"}),"BorderOuterOutlined"),Xce=Ee(h.jsx("path",{d:"M7 21h2v-2H7zM3 5h2V3H3zm4 0h2V3H7zm0 8h2v-2H7zm-4 8h2v-2H3zm8 0h2v-2h-2zm-8-8h2v-2H3zm0 4h2v-2H3zm0-8h2V7H3zm8 8h2v-2h-2zm4-4h2v-2h-2zm4-10v18h2V3zm-4 18h2v-2h-2zm0-16h2V3h-2zm-4 8h2v-2h-2zm0-8h2V3h-2zm0 4h2V7h-2z"}),"BorderRightOutlined"),Jce=Ee(h.jsx("path",{d:"M7 21h2v-2H7zm0-8h2v-2H7zm4 0h2v-2h-2zm0 8h2v-2h-2zm-8-4h2v-2H3zm0 4h2v-2H3zm0-8h2v-2H3zm0-4h2V7H3zm8 8h2v-2h-2zm8-8h2V7h-2zm0 4h2v-2h-2zM3 3v2h18V3zm16 14h2v-2h-2zm-4 4h2v-2h-2zM11 9h2V7h-2zm8 12h2v-2h-2zm-4-8h2v-2h-2z"}),"BorderTopOutlined"),Zce=Ee(h.jsx("path",{d:"M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 18H4V8h16z"}),"CalendarToday"),eue=Ee(h.jsx("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2m5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12z"}),"Cancel"),tue=Ee(h.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z"}),"CheckCircle"),Fv=Ee(h.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),nue=Ee(h.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"}),"CodeOutlined"),LO=Ee(h.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"}),"ContentCopyOutlined"),EU=Ee(h.jsx("path",{d:"M19 6H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2m0 10H5V8h14z"}),"Crop32Outlined"),iue=Ee(h.jsx("path",{d:"M19 5v2h-4V5zM9 5v6H5V5zm10 8v6h-4v-6zM9 17v2H5v-2zM21 3h-8v6h8zM11 3H3v10h8zm10 8h-8v10h8zm-10 4H3v6h8z"}),"DashboardOutlined"),rue=Ee(h.jsx("path",{d:"M9 11H7v2h2zm4 0h-2v2h2zm4 0h-2v2h2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 16H5V9h14z"}),"DateRange"),aue=Ee(h.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"}),"Delete"),sue=Ee(h.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z"}),"DeleteOutline"),oue=Ee(h.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm2 16H8v-2h8zm0-4H8v-2h8zm-3-5V3.5L18.5 9z"}),"Description"),SU=Ee(h.jsx("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator"),lue=Ee(h.jsx("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"Edit"),CU=Ee(h.jsx("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"}),"EditOutlined"),cue=Ee(h.jsx("path",{d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 4-8 5-8-5V6l8 5 8-5z"}),"Email"),uue=Ee(h.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M8.5 8c.83 0 1.5.67 1.5 1.5S9.33 11 8.5 11 7 10.33 7 9.5 7.67 8 8.5 8M12 18c-2.28 0-4.22-1.66-5-4h10c-.78 2.34-2.72 4-5 4m3.5-7c-.83 0-1.5-.67-1.5-1.5S14.67 8 15.5 8s1.5.67 1.5 1.5-.67 1.5-1.5 1.5"}),"EmojiEmotions"),due=Ee(h.jsx("path",{d:"M17 12h-5v5h5zM16 1v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-1V1zm3 18H5V8h14z"}),"Event"),pue=Ee(h.jsx("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3zm-1-4-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5z"}),"FileDownloadOutlined"),TU=Ee(h.jsx("path",{d:"M7 15v2h10v-2zm-4 6h18v-2H3zm0-8h18v-2H3zm4-6v2h10V7zM3 3v2h18V3z"}),"FormatAlignCenter"),fue=Ee(h.jsx("path",{d:"M7 15v2h10v-2zm-4 6h18v-2H3zm0-8h18v-2H3zm4-6v2h10V7zM3 3v2h18V3z"}),"FormatAlignCenterOutlined"),xU=Ee(h.jsx("path",{d:"M3 21h18v-2H3zm0-4h18v-2H3zm0-4h18v-2H3zm0-4h18V7H3zm0-6v2h18V3z"}),"FormatAlignJustify"),kU=Ee(h.jsx("path",{d:"M15 15H3v2h12zm0-8H3v2h12zM3 13h18v-2H3zm0 8h18v-2H3zM3 3v2h18V3z"}),"FormatAlignLeft"),mue=Ee(h.jsx("path",{d:"M15 15H3v2h12zm0-8H3v2h12zM3 13h18v-2H3zm0 8h18v-2H3zM3 3v2h18V3z"}),"FormatAlignLeftOutlined"),wU=Ee(h.jsx("path",{d:"M3 21h18v-2H3zm6-4h12v-2H9zm-6-4h18v-2H3zm6-4h12V7H9zM3 3v2h18V3z"}),"FormatAlignRight"),hue=Ee(h.jsx("path",{d:"M3 21h18v-2H3zm6-4h12v-2H9zm-6-4h18v-2H3zm6-4h12V7H9zM3 3v2h18V3z"}),"FormatAlignRightOutlined"),gue=Ee(h.jsx("path",{d:"M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42M10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5"}),"FormatBold"),_ue=Ee(h.jsx("path",{d:"M3.27 5 2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21 18 19.73 3.55 5.27zM6 5v.18L8.82 8h2.4l-.72 1.68 2.1 2.1L14.21 8H20V5z"}),"FormatClear"),bue=Ee(h.jsx("path",{d:"M16.56 8.94 7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12M5.21 10 10 5.21 14.79 10zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5M2 20h20v4H2z"}),"FormatColorFill"),DU=Ee(h.jsx("path",{d:"M18 14c0-4-6-10.8-6-10.8s-1.33 1.51-2.73 3.52l8.59 8.59c.09-.42.14-.86.14-1.31m-.88 3.12L12.5 12.5 5.27 5.27 4 6.55l3.32 3.32C6.55 11.32 6 12.79 6 14c0 3.31 2.69 6 6 6 1.52 0 2.9-.57 3.96-1.5l2.63 2.63 1.27-1.27z"}),"FormatColorReset"),yue=Ee(h.jsx("path",{d:"M2 20h20v4H2zm3.49-3h2.42l1.27-3.58h5.65L16.09 17h2.42L13.25 3h-2.5zm4.42-5.61 2.03-5.79h.12l2.03 5.79z"}),"FormatColorText"),vue=Ee(h.jsx("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"}),"FormatItalic"),FO=Ee(h.jsx("path",{d:"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5m0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5m0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5M7 19h14v-2H7zm0-6h14v-2H7zm0-8v2h14V5z"}),"FormatListBulleted"),BO=Ee(h.jsx("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2zm1-9h1V4H2v1h1zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2zm5-6v2h14V5zm0 14h14v-2H7zm0-6h14v-2H7z"}),"FormatListNumbered"),Eue=Ee(h.jsx("path",{d:"M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6m-7 2v2h14v-2z"}),"FormatUnderlined"),AU=Ee(h.jsx("path",{d:"M10.27 12h3.46c.93 0 1.63-.83 1.48-1.75l-.3-1.79C14.67 7.04 13.44 6 12 6S9.33 7.04 9.09 8.47l-.3 1.79c-.15.91.55 1.74 1.48 1.74m-8.61-.89c-.13.26-.18.57-.1.88.16.69.76 1.03 1.53 1h1.95c.83 0 1.51-.58 1.51-1.29 0-.14-.03-.27-.07-.4-.01-.03-.01-.05.01-.08.09-.16.14-.34.14-.53 0-.31-.14-.6-.36-.82-.03-.03-.03-.06-.02-.1.07-.2.07-.43.01-.65-.16-.43-.55-.72-.99-.74-.03 0-.05-.01-.07-.03-.17-.21-.48-.35-.83-.35-.3 0-.57.1-.75.26-.03.03-.06.03-.09.02-.14-.06-.3-.09-.46-.09-.65 0-1.18.49-1.24 1.12 0 .02-.01.04-.03.06-.29.26-.46.65-.41 1.05.03.22.12.43.25.6.03.02.03.06.02.09m14.58 2.54c-1.17-.52-2.61-.9-4.24-.9-1.63 0-3.07.39-4.24.9C6.68 14.13 6 15.21 6 16.39V18h12v-1.61c0-1.18-.68-2.26-1.76-2.74m-15.02.93C.48 14.9 0 15.62 0 16.43V18h4.5v-1.61c0-.83.23-1.61.63-2.29-.37-.06-.74-.1-1.13-.1-.99 0-1.93.21-2.78.58m21.56 0c-.85-.37-1.79-.58-2.78-.58-.39 0-.76.04-1.13.1.4.68.63 1.46.63 2.29V18H24v-1.57c0-.81-.48-1.53-1.22-1.85M22 11v-.5c0-1.1-.9-2-2-2h-2c-.42 0-.65.48-.39.81l.7.63c-.19.31-.31.67-.31 1.06 0 1.1.9 2 2 2s2-.9 2-2"}),"Groups2"),NU=Ee(h.jsx("path",{d:"M13 6.99h3L12 3 8 6.99h3v10.02H8L12 21l4-3.99h-3z"}),"HeightOutlined"),RU=Ee(h.jsx("path",{fillRule:"evenodd",d:"M4 11h16v2H4z"}),"HorizontalRuleOutlined"),IU=Ee(h.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-4.86 8.86-3 3.87L9 13.14 6 17h12z"}),"ImageOutlined"),OU=Ee(h.jsx("path",{d:"M18 13v7H4V6h5.02c.05-.71.22-1.38.48-2H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-5zm-1.5 5h-11l2.75-3.53 1.96 2.36 2.75-3.54zm2.8-9.11c.44-.7.7-1.51.7-2.39C20 4.01 17.99 2 15.5 2S11 4.01 11 6.5s2.01 4.5 4.49 4.5c.88 0 1.7-.26 2.39-.7L21 13.42 22.42 12zM15.5 9C14.12 9 13 7.88 13 6.5S14.12 4 15.5 4 18 5.12 18 6.5 16.88 9 15.5 9"}),"ImageSearchOutlined"),Sue=Ee(h.jsx("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown"),Cue=Ee(h.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56M12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96M4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2 0 .68.06 1.34.14 2zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56m2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8M12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96M14.34 14H9.66c-.09-.66-.16-1.32-.16-2 0-.68.07-1.35.16-2h4.68c.09.65.16 1.32.16 2 0 .68-.07 1.34-.16 2m.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56M16.36 14c.08-.66.14-1.32.14-2 0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2z"}),"Language"),MU=Ee(h.jsx("path",{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m0 14H8V4h12zm-7-2h2v-3h3V9h-3V6h-2v3h-3v2h3z"}),"LibraryAddOutlined"),fA=Ee(h.jsx("path",{d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1M8 13h8v-2H8zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5"}),"Link"),Tue=Ee(h.jsx("path",{d:"m21.41 11.58-9-9C12.05 2.22 11.55 2 11 2H4c-1.1 0-2 .9-2 2v7c0 .55.22 1.05.59 1.42l9 9c.36.36.86.58 1.41.58.55 0 1.05-.22 1.41-.59l7-7c.37-.36.59-.86.59-1.41 0-.55-.23-1.06-.59-1.42M5.5 7C4.67 7 4 6.33 4 5.5S4.67 4 5.5 4 7 4.67 7 5.5 6.33 7 5.5 7"}),"LocalOffer"),Qh=Ee(h.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1z"}),"Lock"),Xh=Ee(h.jsx("path",{d:"M12 17c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m6-9h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6h1.9c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m0 12H6V10h12z"}),"LockOpen"),xue=Ee(h.jsx("path",{d:"M20 3H4c-1.1 0-2 .9-2 2v11c0 1.1.9 2 2 2h3l-1 1v2h12v-2l-1-1h3c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 13H4V5h16z"}),"MonitorOutlined"),kue=Ee(h.jsx("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4"}),"Person"),wue=Ee(h.jsx("path",{d:"M15.5 1h-8C6.12 1 5 2.12 5 3.5v17C5 21.88 6.12 23 7.5 23h8c1.38 0 2.5-1.12 2.5-2.5v-17C18 2.12 16.88 1 15.5 1m-4 21c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m4.5-4H7V4h9z"}),"PhoneIphoneOutlined"),PU=Ee(h.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-4.86 8.86-3 3.87L9 13.14 6 17h12z"}),"PhotoOutlined"),LU=Ee(h.jsx("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh"),Rf=Ee(h.jsx("path",{d:"M19 19h2v2h-2zm0-2h2v-2h-2zM3 13h2v-2H3zm0 4h2v-2H3zm0-8h2V7H3zm0-4h2V3H3zm4 0h2V3H7zm8 16h2v-2h-2zm-4 0h2v-2h-2zm4 0h2v-2h-2zm-8 0h2v-2H7zm-4 0h2v-2H3zM21 8c0-2.76-2.24-5-5-5h-5v2h5c1.65 0 3 1.35 3 3v5h2z"}),"RoundedCorner"),Due=Ee(h.jsx("path",{d:"M19 19h2v2h-2zm0-2h2v-2h-2zM3 13h2v-2H3zm0 4h2v-2H3zm0-8h2V7H3zm0-4h2V3H3zm4 0h2V3H7zm8 16h2v-2h-2zm-4 0h2v-2h-2zm4 0h2v-2h-2zm-8 0h2v-2H7zm-4 0h2v-2H3zM21 8c0-2.76-2.24-5-5-5h-5v2h5c1.65 0 3 1.35 3 3v5h2z"}),"RoundedCornerOutlined"),Aue=Ee(h.jsx("path",{d:"M4 9h16v2H4zm0 4h10v2H4z"}),"ShortText"),FU=Ee(h.jsx("path",{d:"M22 9v6c0 1.1-.9 2-2 2h-1v-2h1V9H4v6h6v2H4c-1.1 0-2-.9-2-2V9c0-1.1.9-2 2-2h16c1.1 0 2 .9 2 2m-7.5 10 1.09-2.41L18 15.5l-2.41-1.09L14.5 12l-1.09 2.41L11 15.5l2.41 1.09zm2.5-5 .62-1.38L19 12l-1.38-.62L17 10l-.62 1.38L15 12l1.38.62zm-2.5 5 1.09-2.41L18 15.5l-2.41-1.09L14.5 12l-1.09 2.41L11 15.5l2.41 1.09zm2.5-5 .62-1.38L19 12l-1.38-.62L17 10l-.62 1.38L15 12l1.38.62z"}),"SmartButtonOutlined"),$O=Ee(h.jsx("path",{d:"M18 9v4H6V9H4v6h16V9z"}),"SpaceBar"),Nue=Ee(h.jsx("path",{d:"M6.85 7.08C6.85 4.37 9.45 3 12.24 3c1.64 0 3 .49 3.9 1.28.77.65 1.46 1.73 1.46 3.24h-3.01c0-.31-.05-.59-.15-.85-.29-.86-1.2-1.28-2.25-1.28-1.86 0-2.34 1.02-2.34 1.7 0 .48.25.88.74 1.21.38.25.77.48 1.41.7H7.39c-.21-.34-.54-.89-.54-1.92M21 12v-2H3v2h9.62c1.15.45 1.96.75 1.96 1.97 0 1-.81 1.67-2.28 1.67-1.54 0-2.93-.54-2.93-2.51H6.4c0 .55.08 1.13.24 1.58.81 2.29 3.29 3.3 5.67 3.3 2.27 0 5.3-.89 5.3-4.05 0-.3-.01-1.16-.48-1.94H21z"}),"StrikethroughS"),Rue=Ee(h.jsx("path",{d:"M14 17H4v2h10zm6-8H4v2h16zM4 15h16v-2H4zM4 5v2h16V5z"}),"Subject"),BU=Ee(h.jsx("path",{d:"M2.5 4v3h5v12h3V7h5V4zm19 5h-9v3h3v7h3v-7h3z"}),"TextFieldsOutlined"),Iue=Ee(h.jsx("path",{d:"M5 4v3h5.5v12h3V7H19V4z"}),"Title"),Oue=Ee(h.jsx("path",{d:"M16 13h-3V3h-2v10H8l4 4zM4 19v2h16v-2z"}),"VerticalAlignBottomOutlined"),Mue=Ee(h.jsx("path",{d:"M8 19h3v4h2v-4h3l-4-4zm8-14h-3V1h-2v4H8l4 4zM4 11v2h16v-2z"}),"VerticalAlignCenterOutlined"),Pue=Ee(h.jsx("path",{d:"M8 11h3v10h2V11h3l-4-4zM4 3v2h16V3z"}),"VerticalAlignTopOutlined"),$U=Ee(h.jsx("path",{d:"M3 5v14h18V5zm5.33 12H5V7h3.33zm5.34 0h-3.33V7h3.33zM19 17h-3.33V7H19z"}),"ViewColumnOutlined"),UU=Ee(h.jsx("path",{d:"m16.66 4.52 2.83 2.83-2.83 2.83-2.83-2.83zM9 5v4H5V5zm10 10v4h-4v-4zM9 15v4H5v-4zm7.66-13.31L11 7.34 16.66 13l5.66-5.66zM11 3H3v8h8zm10 10h-8v8h8zm-10 0H3v8h8z"}),"WidgetsOutlined"),Lue=Ee(h.jsx("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2M4 18V6h2v12zm4 0V6h8v12zm12 0h-2V6h2z"}),"WidthWideOutlined"),Ki=({children:t})=>h.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.3rem"},children:t.map(e=>e)}),$n=({label:t})=>{const e=Xt();return t==null||t===""?null:h.jsx("p",{style:{fontWeight:"bold",color:e.palette.text.primary},children:t})};function Wp(){return(Wp=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 Bv(t,e){if(t==null)return{};var n,i,r={},a=Object.keys(t);for(i=0;i<a.length;i++)e.indexOf(n=a[i])>=0||(r[n]=t[n]);return r}function lh(t){var e=D.useRef(t),n=D.useRef(function(i){e.current&&e.current(i)});return e.current=t,n.current}var ch=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t<e?e:t},Tm=function(t){return"touches"in t},xk=function(t){return t&&t.ownerDocument.defaultView||self},UO=function(t,e,n){var i=t.getBoundingClientRect(),r=Tm(e)?(function(a,s){for(var o=0;o<a.length;o++)if(a[o].identifier===s)return a[o];return a[0]})(e.touches,n):e;return{left:ch((r.pageX-(i.left+xk(t).pageXOffset))/i.width),top:ch((r.pageY-(i.top+xk(t).pageYOffset))/i.height)}},zO=function(t){!Tm(t)&&t.preventDefault()},zU=D.memo(function(t){var e=t.onMove,n=t.onKey,i=Bv(t,["onMove","onKey"]),r=D.useRef(null),a=lh(e),s=lh(n),o=D.useRef(null),l=D.useRef(!1),c=D.useMemo(function(){var f=function(_){zO(_),(Tm(_)?_.touches.length>0:_.buttons>0)&&r.current?a(UO(r.current,_,o.current)):g(!1)},m=function(){return g(!1)};function g(_){var b=l.current,y=xk(r.current),E=_?y.addEventListener:y.removeEventListener;E(b?"touchmove":"mousemove",f),E(b?"touchend":"mouseup",m)}return[function(_){var b=_.nativeEvent,y=r.current;if(y&&(zO(b),!(function(v,T){return T&&!Tm(v)})(b,l.current)&&y)){if(Tm(b)){l.current=!0;var E=b.changedTouches||[];E.length&&(o.current=E[0].identifier)}y.focus(),a(UO(y,b,o.current)),g(!0)}},function(_){var b=_.which||_.keyCode;b<37||b>40||(_.preventDefault(),s({left:b===39?.05:b===37?-.05:0,top:b===40?.05:b===38?-.05:0}))},g]},[s,a]),u=c[0],d=c[1],p=c[2];return D.useEffect(function(){return p},[p]),D.createElement("div",Wp({},i,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:r,onKeyDown:d,tabIndex:0,role:"slider"}))}),mA=function(t){return t.filter(Boolean).join(" ")},GU=function(t){var e=t.color,n=t.left,i=t.top,r=i===void 0?.5:i,a=mA(["react-colorful__pointer",t.className]);return D.createElement("div",{className:a,style:{top:100*r+"%",left:100*n+"%"}},D.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},Vi=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n},Fue=function(t){return Gue(kk(t))},kk=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?Vi(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?Vi(parseInt(t.substring(6,8),16)/255,2):1}},Bue=function(t){return zue(Uue(t))},$ue=function(t){var e=t.s,n=t.v,i=t.a,r=(200-e)*n/100;return{h:Vi(t.h),s:Vi(r>0&&r<200?e*n/100/(r<=100?r:200-r)*100:0),l:Vi(r/2),a:Vi(i,2)}},wk=function(t){var e=$ue(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},Uue=function(t){var e=t.h,n=t.s,i=t.v,r=t.a;e=e/360*6,n/=100,i/=100;var a=Math.floor(e),s=i*(1-n),o=i*(1-(e-a)*n),l=i*(1-(1-e+a)*n),c=a%6;return{r:Vi(255*[i,o,s,s,l,i][c]),g:Vi(255*[l,i,i,o,s,s][c]),b:Vi(255*[s,s,l,i,i,o][c]),a:Vi(r,2)}},qg=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},zue=function(t){var e=t.r,n=t.g,i=t.b,r=t.a,a=r<1?qg(Vi(255*r)):"";return"#"+qg(e)+qg(n)+qg(i)+a},Gue=function(t){var e=t.r,n=t.g,i=t.b,r=t.a,a=Math.max(e,n,i),s=a-Math.min(e,n,i),o=s?a===e?(n-i)/s:a===n?2+(i-e)/s:4+(e-n)/s:0;return{h:Vi(60*(o<0?o+6:o)),s:Vi(a?s/a*100:0),v:Vi(a/255*100),a:r}},Hue=D.memo(function(t){var e=t.hue,n=t.onChange,i=mA(["react-colorful__hue",t.className]);return D.createElement("div",{className:i},D.createElement(zU,{onMove:function(r){n({h:360*r.left})},onKey:function(r){n({h:ch(e+360*r.left,0,360)})},"aria-label":"Hue","aria-valuenow":Vi(e),"aria-valuemax":"360","aria-valuemin":"0"},D.createElement(GU,{className:"react-colorful__hue-pointer",left:e/360,color:wk({h:e,s:100,v:100,a:1})})))}),jue=D.memo(function(t){var e=t.hsva,n=t.onChange,i={backgroundColor:wk({h:e.h,s:100,v:100,a:1})};return D.createElement("div",{className:"react-colorful__saturation",style:i},D.createElement(zU,{onMove:function(r){n({s:100*r.left,v:100-100*r.top})},onKey:function(r){n({s:ch(e.s+100*r.left,0,100),v:ch(e.v-100*r.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Vi(e.s)+"%, Brightness "+Vi(e.v)+"%"},D.createElement(GU,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:wk(e)})))}),HU=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0},que=function(t,e){return t.toLowerCase()===e.toLowerCase()||HU(kk(t),kk(e))};function Vue(t,e,n){var i=lh(n),r=D.useState(function(){return t.toHsva(e)}),a=r[0],s=r[1],o=D.useRef({color:e,hsva:a});D.useEffect(function(){if(!t.equal(e,o.current.color)){var c=t.toHsva(e);o.current={hsva:c,color:e},s(c)}},[e,t]),D.useEffect(function(){var c;HU(a,o.current.hsva)||t.equal(c=t.fromHsva(a),o.current.color)||(o.current={hsva:a,color:c},i(c))},[a,t,i]);var l=D.useCallback(function(c){s(function(u){return Object.assign({},u,c)})},[]);return[a,l]}var Wue=typeof window<"u"?D.useLayoutEffect:D.useEffect,Yue=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},GO=new Map,Kue=function(t){Wue(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!GO.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}`,GO.set(e,n);var i=Yue();i&&n.setAttribute("nonce",i),e.head.appendChild(n)}},[])},Que=function(t){var e=t.className,n=t.colorModel,i=t.color,r=i===void 0?n.defaultColor:i,a=t.onChange,s=Bv(t,["className","colorModel","color","onChange"]),o=D.useRef(null);Kue(o);var l=Vue(n,r,a),c=l[0],u=l[1],d=mA(["react-colorful",e]);return D.createElement("div",Wp({},s,{ref:o,className:d}),D.createElement(jue,{hsva:c,onChange:u}),D.createElement(Hue,{hue:c.h,onChange:u,className:"react-colorful__last-control"}))},Xue={defaultColor:"000",toHsva:Fue,fromHsva:function(t){return Bue({h:t.h,s:t.s,v:t.v,a:1})},equal:que},Jue=function(t){return D.createElement(Que,Wp({},t,{colorModel:Xue}))},Zue=/^#?([0-9A-F]{3,8})$/i,ede=function(t){var e=t.color,n=e===void 0?"":e,i=t.onChange,r=t.onBlur,a=t.escape,s=t.validate,o=t.format,l=t.process,c=Bv(t,["color","onChange","onBlur","escape","validate","format","process"]),u=D.useState(function(){return a(n)}),d=u[0],p=u[1],f=lh(i),m=lh(r),g=D.useCallback(function(b){var y=a(b.target.value);p(y),s(y)&&f(l?l(y):y)},[a,l,s,f]),_=D.useCallback(function(b){s(b.target.value)||p(a(n)),m(b)},[n,a,s,m]);return D.useEffect(function(){p(a(n))},[n,a]),D.createElement("input",Wp({},c,{value:o?o(d):d,spellCheck:"false",onChange:g,onBlur:_}))},HO=function(t){return"#"+t},tde=function(t){var e=t.prefixed,n=t.alpha,i=Bv(t,["prefixed","alpha"]),r=D.useCallback(function(s){return s.replace(/([^0-9A-F]+)/gi,"").substring(0,n?8:6)},[n]),a=D.useCallback(function(s){return(function(o,l){var c=Zue.exec(o),u=c?c[1].length:0;return u===3||u===6||!!l&&u===4||!!l&&u===8})(s,n)},[n]);return D.createElement(ede,Wp({},i,{escape:r,format:e?HO:void 0,process:HO,validate:a}))};const jO={width:24,height:24};function nde({paletteColors:t,isLocked:e,onToggleLock:n,onChange:i}){const r=Xt(),{t:a}=nt.useTranslation("inspector"),s=t.slice(30);return h.jsxs(_n,{spacing:1,children:[h.jsx("div",{style:{height:1,width:"100%",margin:"8px 0",backgroundColor:r.palette.grey[400]}}),h.jsxs(We,{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"4px",children:[s.map((o,l)=>h.jsx(qi,{sx:{...jO,backgroundColor:o,border:"1px solid",margin:"0!important",borderColor:r.palette.grey[50],minWidth:24,display:"inline-flex","&:hover":{backgroundColor:o,borderColor:"grey.500"}},onClick:()=>i&&i(o)},l+29)),n&&h.jsx(qi,{onClick:n,sx:{backgroundColor:"transparent",border:"1px solid",...jO,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:a(e?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:e?h.jsx(Qh,{fontSize:"small"}):h.jsx(Xh,{fontSize:"small"})})]})]})}const ide={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%"}},qO=(t,e)=>{if(!t||t.trim()==="")return e;const i=e.slice(-5),r=e.slice(0,30),a=i.filter(o=>o!==t&&o!==""),s=[t,...a].slice(0,5);for(;s.length<5;)s.push("");return[...r,...s]};function hA({value:t,nullable:e,onChange:n}){const[i,r]=D.useState(t||"#000000"),[a,s]=D.useState(null),{paletteColors:o,isLocked:l}=cce(),[c,u]=D.useState(!1),d=Xt(),p=D.useCallback(b=>{if(l)return;a&&clearTimeout(a);const y=setTimeout(()=>{const E=qO(b,o);vS({paletteColors:E})},300);s(y)},[a,l,o]),f=()=>{const b=!l;if(vS({isLocked:b}),!b&&i){const y=qO(i,o);vS({isLocked:b,paletteColors:y})}},m=b=>{u(!0),r(b)},g=()=>{n(i),p(i)},_=b=>{r(b),n(b),p(b)};return D.useEffect(()=>{t!==i&&r(t||"#000000")},[t]),D.useEffect(()=>()=>{a&&clearTimeout(a)},[a]),h.jsxs(_n,{spacing:1,sx:ide,children:[h.jsx(Jue,{color:i,onChange:m,onMouseUp:g,onTouchEnd:g,onMouseLeave:()=>{c&&(g(),u(!1))}}),h.jsx(nde,{isLocked:l,onToggleLock:f,paletteColors:o,value:t,nullable:e,onChange:b=>{b?(r(b),n(b),p(b)):n(null)}}),h.jsxs(We,{pt:1,display:"flex",gap:1,alignItems:"center",children:[h.jsx(tde,{prefixed:!0,color:i,onChange:_,style:{flex:1,backgroundColor:d.palette.background.paper,color:d.palette.text.primary,padding:"1px 4px",fontSize:"12px"}}),e&&h.jsx(qi,{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(DU,{color:"primary",fontSize:"small"})})]})]})}function jU({label:t,defaultValue:e,onChange:n,nullable:i,compact:r=!1,...a}){const[s,o]=D.useState(null),[l,c]=D.useState(e),{t:u}=nt.useTranslation("inspector");D.useEffect(()=>{l!==e&&c(e)},[e]);const d=b=>{o(b.currentTarget)},p=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"},f=b=>{c(b),n(b)},m=()=>!i||typeof l!="string"||l.trim().length===0?null:h.jsx(Nn,{disableInteractive:!0,arrow:!0,title:u("inputs.background.reset"),placement:"left",children:h.jsx(We,{sx:{minWidth:24,lineHeight:1,flexShrink:0,pr:"4px",display:"grid",placeItems:"center"},onClick:()=>f(null),children:h.jsx(DU,{sx:{color:"primary.main"}})})}),g=l?h.jsx(Pa,{onClick:d,sx:{...p,bgcolor:l}}):h.jsx(Pa,{onClick:d,sx:{...p},children:h.jsx(pA,{fontSize:"small"})}),_=h.jsx(qD,{anchorEl:s,open:!!s,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(hA,{value:l||"",nullable:i,onChange:b=>f(b)})});return r?h.jsxs(h.Fragment,{children:[g,_]}):h.jsxs(Ki,{children:[h.jsx($n,{label:t}),h.jsxs(_n,{direction:"row",alignContent:"center",spacing:1,children:[g,m()]}),_]})}function Zc(t){return h.jsx(jU,{...t,nullable:!1})}function SS(t){return h.jsx(jU,{...t,nullable:!0})}const Ud=36,gA=8,$v={width:"100%","& .MuiInputBase-root":{"&:not(.MuiInputBase-multiline)":{height:`${Ud}px`}},"& .MuiOutlinedInput-root":{borderRadius:`${gA}px`,"&:not(.MuiInputBase-multiline)":{height:`${Ud}px`}},"& .MuiInputBase-input":{paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",height:"unset"}},rde={width:"100%",height:`${Ud}px`,paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",display:"flex",alignItems:"center",borderRadius:`${gA}px`};function lc({label:t,children:e,defaultValue:n,onChange:i}){const[r,a]=D.useState(n);return D.useEffect(()=>{n!==r&&a(n)},[n]),h.jsxs(Ki,{children:[h.jsx($n,{label:t}),h.jsx(We,{sx:{...rde,paddingLeft:"0px",paddingRight:"0px"},children:h.jsx(Hh,{exclusive:!0,fullWidth:!0,value:r,size:"small",sx:{width:"100%"},onChange:(s,o)=>{if(typeof o!="string")throw new Error("RadioGroupInput can only receive string values");a(o),i(o)},children:e})})]})}const ade=de(We)(({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}`}})),sde=de("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"}})),VO=de(Wn)(({theme:t})=>({padding:"0",color:t.palette.primary.main,"&:hover":{backgroundColor:we(t.palette.primary.main,.04)},"& .MuiSvgIcon-root":{fontSize:14}}));function di({iconLabel:t,label:e,value:n,setValue:i,units:r,min:a=0,max:s,step:o=void 0,marks:l=!0,...c}){const u=n??a,[d,p]=D.useState(u.toString()),f=v=>{let T=v;T<a&&(T=a),s!==void 0&&T>s&&(T=s),i(T),p(T.toString())},m=v=>{const T=v.target.value;if(p(T),T!==""){const S=Number(T);isNaN(S)||S>=a&&i(S)}},g=()=>{if(d===""||isNaN(Number(d)))p(u.toString());else{const v=Number(d);f(v)}},_=v=>{v.key==="Enter"&&g()};D.useEffect(()=>{p((n??a).toString())},[n,a]);const b=()=>{const v=u+1;f(v)},y=()=>{const v=u-1;f(v)},E=(v,T)=>{typeof T=="number"&&i(T)};return h.jsxs(Ki,{children:[h.jsx($n,{label:e}),h.jsxs(_n,{direction:"row",alignItems:"center",spacing:2,justifyContent:"space-between",width:"100%",children:[h.jsx(We,{sx:{minWidth:24,lineHeight:1,flexShrink:0},children:t}),h.jsx(H_,{...c,value:u,min:a,max:s||1e3,step:o,color:"primary",marks:l,onChange:E}),h.jsxs(ade,{children:[h.jsx(sde,{type:"number",value:d,onChange:m,onBlur:g,onKeyDown:_,min:a,max:s,step:o}),h.jsxs(We,{sx:{display:"flex",flexDirection:"column",ml:.5},children:[h.jsx(VO,{onClick:b,disabled:s!==void 0&&u>=s,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(VO,{onClick:y,disabled:u<=a,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(gn,{variant:"caption",color:"text.secondary",sx:{fontSize:"16px",ml:"4px!important"},children:r})]})]})}function WO(t){return{top:Number(t.top??0),bottom:Number(t.bottom??0),left:Number(t.left??0),right:Number(t.right??0)}}function ode({size:t,sizeMobile:e,sizePaddingSidesLinked:n,sizeMobilePaddingSidesLinked:i,onChange:r,label:a,maxValue:s=100,paddingSteps:o=8}){const{t:l}=nt.useTranslation("inspector"),c=a??l("inputs.common.size"),u=fi(),[d,p]=D.useState(()=>{const v=u==="desktop"?t:e!==void 0?e:t;return typeof v=="object"&&v!==null?WO(v):{top:8,bottom:8,left:16,right:16}}),f=u==="desktop"?n===!0:i===!0;D.useEffect(()=>{const v=u==="desktop"?t:e!==void 0?e:t;typeof v=="object"&&v!==null&&p(WO(v))},[t,e,u]);const m=()=>{const v=u==="desktop"?t:e!==void 0?e:t;return typeof v=="object"&&v!==null?"custom":typeof v=="string"?v:"medium"},g=typeof s=="number"?s:Number(s)||100,_=v=>{if(u==="desktop"){const T={size:v==="custom"?d:v};e==null&&(T.sizeMobile=v==="custom"?d:v),r(T)}else r({sizeMobile:v==="custom"?d:v})},b=(v,T)=>{let S;f?S={top:T,bottom:T,left:T,right:T}:S={...d,[v]:T},p(S),r(u==="desktop"?{size:S}:{sizeMobile:S})},y=()=>{if(u==="desktop")if(f)r({sizePaddingSidesLinked:!1});else{const v={top:d.top,bottom:d.top,left:d.top,right:d.top};p(v),r({size:v,sizePaddingSidesLinked:!0})}else if(f)r({sizeMobilePaddingSidesLinked:!1});else{const v={top:d.top,bottom:d.top,left:d.top,right:d.top};p(v),r({sizeMobile:v,sizeMobilePaddingSidesLinked:!0})}},E=m();return h.jsxs(_n,{spacing:2,children:[h.jsxs(lc,{label:c,defaultValue:E,onChange:_,children:[h.jsx(ln,{value:"x-small",children:l("inputs.responsiveSize.options.xSmall")}),h.jsx(ln,{value:"small",children:l("inputs.responsiveSize.options.small")}),h.jsx(ln,{value:"medium",children:l("inputs.responsiveSize.options.medium")}),h.jsx(ln,{value:"custom",children:l("inputs.responsiveSize.options.custom")})]}),E==="custom"&&h.jsxs(_n,{spacing:2,alignItems:"flexStart",pb:1,children:[h.jsxs(_n,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[h.jsx($n,{label:l("inputs.responsiveSize.customPadding")}),h.jsx(Nn,{title:l(f?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:h.jsx(Wn,{size:"small",onClick:y,sx:{marginTop:"0!important",color:f?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:f?h.jsx(Qh,{fontSize:"small"}):h.jsx(Xh,{fontSize:"small"})})})]}),f?h.jsx(di,{iconLabel:h.jsx(gn,{variant:"body2",component:"span",children:l("inputs.responsiveSize.allSides")}),value:d.top,setValue:v=>b("top",v),units:"px",min:0,step:o,marks:o>1,max:g}):h.jsxs(h.Fragment,{children:[h.jsx(di,{iconLabel:h.jsx(yU,{sx:{fontSize:16}}),value:d.top,setValue:v=>b("top",v),units:"px",min:0,step:o,marks:o>1,max:g}),h.jsx(di,{iconLabel:h.jsx(bU,{sx:{fontSize:16}}),value:d.bottom,setValue:v=>b("bottom",v),units:"px",min:0,step:o,marks:o>1,max:g}),h.jsx(di,{iconLabel:h.jsx(gU,{sx:{fontSize:16}}),value:d.left,setValue:v=>b("left",v),units:"px",min:0,step:o,marks:o>1,max:g}),h.jsx(di,{iconLabel:h.jsx(_U,{sx:{fontSize:16}}),value:d.right,setValue:v=>b("right",v),units:"px",min:0,step:o,marks:o>1,max:g})]})]})]})}function lde({fullWidth:t,fullWidthMobile:e,onChange:n,label:i="Width"}){const r=fi(),{t:a}=nt.useTranslation("inspector"),s=()=>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=s();return h.jsxs(lc,{label:i,defaultValue:l?"FULL_WIDTH":"AUTO",onChange:o,children:[h.jsx(ln,{value:"FULL_WIDTH",children:a("inputs.width.full")}),h.jsx(ln,{value:"AUTO",children:a("inputs.width.auto")})]})}function cde(t,e){const n=D.useRef(null),i=D.useRef(t),r=D.useRef([]);i.current=t;const a=D.useCallback((...s)=>{r.current=s,n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{i.current(...s),n.current=null},e)},[e]);return a.flush=D.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=null,i.current(...r.current))},[]),a}function dp({helperText:t,label:e,placeholder:n,rows:i,InputProps:r,defaultValue:a,onChange:s}){const[o,l]=D.useState(a);D.useEffect(()=>{o!==a&&l(a)},[a]);const c=cde(d=>{s(d)},150),u=typeof i=="number"&&i>1;return h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx($n,{label:e}),h.jsx(jp,{fullWidth:!0,multiline:u,minRows:i,variant:"outlined",placeholder:n,helperText:t,InputProps:r,value:o,sx:$v,onChange:d=>{const p=d.target.value;l(p),c(p)},onBlur:()=>{c.flush()}})]})}function ude({onClick:t,disabled:e,primary:n=!1}){const{t:i}=nt.useTranslation("inspector");return h.jsx(Wn,{"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(Fv,{})})}function dde({imageUrl:t,saving:e=!1}){return h.jsxs(wne,{sx:{position:"relative"},children:[e&&h.jsx(_n,{justifyContent:"center",alignItems:"center",sx:{position:"absolute",top:7,left:0,width:"100%",height:"314px",zIndex:20,backgroundColor:"#212121AA",mb:1},children:h.jsx(Kl,{size:48,thickness:6,color:"inherit",sx:{color:"white"}})}),h.jsx(Mne,{component:"img",sx:{objectFit:"contain",width:"100%",height:"326px"},image:t,alt:"Generated Image"})]})}function pde({value:t,onChange:e,disabled:n}){return h.jsxs(h.Fragment,{children:[h.jsx(gn,{sx:{fontSize:"14px",fontWeight:700},children:"Image description"}),h.jsx(jp,{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 fde=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 qU({src:t,style:e}){const{t:n}=nt.useTranslation("inspector"),[i,r]=D.useState(!1),[a,s]=D.useState(!1),[o,l]=D.useState(""),[c,u]=D.useState(null),[d,p]=D.useState(!1),[f,m]=D.useState(null),[g,_]=D.useState(!1),b=()=>{r(!0),m(null)},y=()=>{a||(r(!1),s(!1),u(null),l(""),p(!1),m(null),_(!1))},E=()=>{const S=c&&!d?"store-ai-image":"request-ai-image",C=c&&!d?c:o;m(null),S==="store-ai-image"?(_(!0),s(!1),setTimeout(()=>{s(!1),y()},2e3)):s(!0),window.dispatchEvent(new CustomEvent(S,{detail:C}))},v=()=>{p(!0),u(null),m(null),_(!1)};D.useEffect(()=>{const S=C=>{const{detail:x}=C;if(s(!1),x.error){m(fde(x.error));return}if(!x.success||!x.url){m({code:0,title:"Generation Failed",message:"Failed to generate the image.",action:"Please try again"});return}u(x.url),p(!1)};return window.addEventListener("generated-image",S),()=>{window.removeEventListener("generated-image",S)}},[]),D.useEffect(()=>{y()},[t]);const T=!c||d;return h.jsxs(h.Fragment,{children:[h.jsx(qi,{style:e,startIcon:h.jsx(Tk,{className:"w-4 h-4"}),variant:"contained",onClick:b,children:n("inputs.aiImageGeneration.generate")}),h.jsx(Sie,{open:i,onClose:y,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{bgcolor:"background.paper",color:"text.primary",borderRadius:"8px"}},children:h.jsxs("form",{onSubmit:S=>{S.preventDefault(),E()},children:[h.jsxs(Hie,{sx:{fontWeight:700,fontSize:"24px",color:f?"error.main":"inherit"},children:[n(f?"inputs.aiImageGeneration.titleError":a?"inputs.aiImageGeneration.titleLoading":c?"inputs.aiImageGeneration.titleReady":"inputs.aiImageGeneration.titleCreate"),h.jsx(ude,{onClick:y,disabled:a,primary:!0})]}),h.jsxs(Mie,{children:[h.jsx($ie,{sx:{pb:1,color:f?"error.dark":"inherit"},children:n(f?"inputs.aiImageGeneration.descriptionError":a?"inputs.aiImageGeneration.descriptionLoading":T?"inputs.aiImageGeneration.descriptionCreate":"inputs.aiImageGeneration.descriptionReady")}),c&&!d?h.jsxs(_n,{sx:{position:"relative"},children:[h.jsx(dde,{imageUrl:c,saving:g}),h.jsxs($l,{variant:"outlined",severity:"warning",icon:!1,children:[n("inputs.aiImageGeneration.warningRegenerate")," ",h.jsx("b",{children:n("inputs.aiImageGeneration.warningInsertFirst")})," ",n("inputs.aiImageGeneration.warningFirst")]})]}):a&&!c?h.jsx(_n,{justifyContent:"center",alignItems:"center",sx:{backgroundColor:S=>S.palette.mainColor[50],height:"326px",width:"100%"},children:h.jsx(Kl,{size:48,thickness:6})}):h.jsx(pde,{value:o,onChange:l,disabled:a})]}),!a&&h.jsxs(wie,{className:"p-6",children:[c&&!d&&h.jsx(qi,{startIcon:h.jsx(LU,{className:"w-4 h-4"}),onClick:v,variant:"outlined",disabled:a,children:n("inputs.aiImageGeneration.regenerate")}),!c&&!d&&h.jsx(qi,{onClick:y,variant:"text",disabled:d,children:n("inputs.aiImageGeneration.cancel")}),h.jsxs(qi,{startIcon:c&&!d?h.jsx(Wce,{className:"w-4 h-4"}):h.jsx(Tk,{className:"w-4 h-4"}),onClick:E,variant:"contained",disabled:!o||o?.length<20,children:[n(c&&!d?"inputs.aiImageGeneration.insertImage":"inputs.aiImageGeneration.generateImage"),a&&h.jsx(Kl,{size:16,className:"ml-2"})]})]})]})})]})}const mde=({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"})}),hde=de(KD)(({theme:t})=>({fontFamily:t.typography.fontFamily,color:t.palette.text.primary,backgroundColor:t.palette.background.input??t.palette.grey[100],width:"100%",height:`${Ud}px`,"&.MuiInputBase-root, &.MuiOutlinedInput-root":{height:`${Ud}px`,minHeight:`${Ud}px`,boxSizing:"border-box",borderRadius:`${gA}px`,border:`1px solid ${t.palette.divider}`},"&& .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.grey[200]},"&.Mui-focused":{borderColor:t.palette.primary.main}})),Jl=D.forwardRef((t,e)=>{const n=Xt(),i={backgroundColor:n.palette.background.input??n.palette.grey[100],marginTop:"4px",borderRadius:"10px",border:`1px solid ${n.palette.divider}`,boxShadow:`0 1px 3px ${we("#000000",.6)}`,color:n.palette.text.primary},r={...t.MenuProps?.PaperProps,sx:{...typeof t.MenuProps?.PaperProps?.sx=="object"&&t.MenuProps.PaperProps?.sx,...i}},a=t.MenuProps?.slotProps??{},s=a.paper??{};return h.jsx(hde,{ref:e,...t,IconComponent:mde,MenuProps:{...t.MenuProps,PaperProps:r,slotProps:{...a,paper:{...s,...r,sx:{...typeof s.sx=="object"&&s.sx,...typeof t.MenuProps?.PaperProps?.sx=="object"&&t.MenuProps.PaperProps?.sx,...i}}}}})});Jl.displayName="CustomSelect";const gde=({defaultValue:t,onChange:e,values:n})=>{const i=Yh(),{t:r}=nt.useTranslation("inspector"),a=Xt(),s=()=>h.jsx(Ma,{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"})}),o=V=>{if(!V)return{url:"",repeat:"no-repeat",position:"center center",size:"cover"};const ee=V.match(/url\("([^"]+)"\)/),Me=ee?ee[1]:"";let be="no-repeat";V.includes("repeat-x")?be="repeat-x":V.includes("repeat-y")?be="repeat-y":V.includes("repeat")&&!V.includes("no-repeat")&&(be="repeat");let me="center center";const le=["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"];for(const Xe of le)if(V.includes(Xe)){me=Xe;break}let Ye="cover";return V.includes("contain")?Ye="contain":V.includes("auto")&&(Ye="auto"),{url:Me,repeat:be,position:me,size:Ye}},l=V=>V.url?`url("${V.url}") ${V.repeat} ${V.position} / ${V.size}`:"",[c,u]=D.useState(t||null),[d,p]=D.useState(o(t)),[f,m]=D.useState(!1),[g,_]=D.useState(()=>!!window.__emailBuilderEnableAI),[,b]=D.useState(null),[y,E]=D.useState(o(t).url||""),[v,T]=D.useState(!1),[S,C]=D.useState(""),[x,k]=D.useState(!1),w=D.useRef(null),A=oA(),[L,I]=D.useState(null);D.useEffect(()=>{const V=window.__emailBuilderCustomImageProvider;V&&(I(V),setTimeout(()=>{i&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:i,currentImageUrl:d.url||null,alt:null}}))},100))},[]);const[O,M]=D.useState(()=>sessionStorage.getItem("hideBackgroundImageWarning")==="true"),P=(V,ee)=>{const Me={...d,...V};if(p(Me),Me.url){const be=l(Me);u(be),e(be,ee)}else console.error("Update params error: ",Me)},F=(V,ee)=>{if(!V)return!1;const Me=V?.toLowerCase(),be=Me.includes(".svg")||Me.includes("svg"),me=ee&&(ee.includes("image/svg+xml")||ee.includes("svg"));return be||!!me},U=async V=>{try{T(!0),C(""),k(!1);try{new URL(V)}catch{return C("Invalid URL format"),!1}const ee=new AbortController,Me=setTimeout(()=>ee.abort(),1e4);try{const be=await fetch(V,{method:"HEAD",signal:ee.signal});if(clearTimeout(Me),!be.ok)return C(`HTTP ${be.status}: ${be.statusText}`),!1;const me=be.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(Xe=>me&&me.toLowerCase().includes(Xe.toLowerCase()))?(F(V,me)&&k(!0),C(""),!0):(C("URL does not point to an image"),!1)}catch(be){return clearTimeout(Me),be.name==="AbortError"?(C("Request timeout - URL took too long to respond"),!1):new Promise(me=>{const le=new Image,Ye=setTimeout(()=>{C("Request timeout - URL took too long to respond"),me(!1)},1e4);le.onload=()=>{clearTimeout(Ye),F(V)&&k(!0),C(""),me(!0)},le.onerror=()=>{clearTimeout(Ye),C("Cannot access image - CORS policy, network error, or invalid URL"),me(!1)},le.src=V})}}catch{return C("Unexpected error occurred while validating URL"),!1}finally{T(!1)}},H=async()=>{y.trim()&&await U(y.trim())&&P({url:y.trim()})},q=V=>{V.key==="Enter"&&H()},Q=V=>{E(V.target.value),S&&C(""),x&&k(!1)},Y=V=>{const ee=["image/png","image/jpeg","image/gif"],be=Array.isArray(V)?V:Array.from(V),me=be.filter(Ye=>ee.includes(Ye.type)&&Ye.size<=5242880);if(me.length!==be.length&&alert(r("inputs.common.invalidFiles")),me.length===0)return;const le=me.map(Ye=>new Promise(Xe=>{const ut=new FileReader;ut.onload=nn=>Xe(nn.target?.result),ut.readAsDataURL(Ye)}));Promise.all(le).then(Ye=>{const Xe={images:Ye,id:i||"",styles:n};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:Xe})),Fd(!0,i||"")})},pe=V=>{V.preventDefault(),m(!0)},ie=()=>{m(!1)},ke=V=>{V.preventDefault(),m(!1);const ee=V.dataTransfer.files;Y(ee)},re=()=>{const V=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(V)},Se=()=>{p({url:"",repeat:"no-repeat",position:"center center",size:"cover"}),u(null),e(null),E(""),k(!1)},fe=V=>{switch(V){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"})})}},Ce=V=>({"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")})[V]??r("inputs.backgroundImage.positions.center");return D.useEffect(()=>{const V=window.__emailBuilderEnableAI;V!==void 0&&_(!!V);const ee=Me=>{const{detail:be}=Me;_(!!be)};return window.addEventListener("email-builder-ai-generation",ee),()=>{window.removeEventListener("email-builder-ai-generation",ee)}},[]),D.useEffect(()=>{const V=me=>{const{detail:le}=me;Fd(!1,le.id||""),P({url:le.url},le.styles),sU(!1),E(le.url)},ee=me=>{Fd(me?.detail?.uploading??!1,me?.detail?.id??"")},Me=()=>{w?.current?.click()},be=me=>{const le=me.detail;if(typeof le=="string"){if(!le.includes("url("))P({url:le}),E(le);else{const Ye=o(le);p(Ye),u(le),e(le),E(Ye.url)}return}le?.url!=null&&typeof le.url=="string"&&(P({url:le.url},le.styles),E(le.url))};return window.addEventListener("email-builder-set-image",be),window.addEventListener("email-builder-upload-image-receive",V),window.addEventListener("email-builder-upload-file",Me),window.addEventListener("email-builder-toggle-upload-file",ee),()=>{window.removeEventListener("email-builder-upload-image-receive",V),window.removeEventListener("email-builder-set-image",be),window.removeEventListener("email-builder-upload-file",Me),window.removeEventListener("email-builder-toggle-upload-file",ee)}},[d]),D.useEffect(()=>{t&&k(F(d.url))},[t,d.url]),D.useEffect(()=>{if(t!==c){const V=o(t);p(V),u(t||null),E(V.url||"")}},[t]),h.jsxs(Ki,{children:[h.jsxs(We,{sx:{display:"flex",alignItems:"center",gap:1},children:[h.jsx($n,{label:r("inputs.backgroundImage.label")}),!O&&h.jsx(Nn,{title:r("inputs.backgroundImage.warningTooltip"),placement:"top",children:h.jsx(Wn,{size:"small",sx:{p:0},children:h.jsx(s,{})})})]}),L?h.jsx(We,{sx:{mb:2},children:L}):h.jsx("div",{style:{display:"flex",gap:8},children:A?h.jsxs(We,{sx:{width:"100%"},children:[h.jsxs(_n,{direction:"row",spacing:1,children:[h.jsx(jp,{fullWidth:!0,placeholder:r("inputs.image.urlPlaceholder"),value:y,onChange:Q,onKeyPress:q,error:!!S,disabled:v,sx:$v}),h.jsx(qi,{variant:"contained",onClick:H,disabled:!y.trim()||v,sx:{minWidth:"auto",px:2,position:"relative"},children:v?h.jsx(Kl,{size:20,color:"inherit"}):r("inputs.common.add")})]}),S&&h.jsx($l,{severity:"error",sx:{mt:1,fontSize:"0.875rem",maxHeight:"70px"},children:S}),x&&h.jsx($l,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:h.jsx(Wn,{"aria-label":r("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{k(!1)},children:h.jsx(Fv,{fontSize:"inherit"})}),children:r("inputs.common.svgWarning")}),d.url&&h.jsxs(We,{sx:{position:"relative",maxWidth:"50%",display:"block",margin:"0.5rem auto 0 auto"},children:[h.jsx("img",{src:d.url||"",alt:"",style:{width:"100%",objectFit:"contain",aspectRatio:"1 / 1",height:"auto",borderRadius:"8px",border:`2px solid ${a.palette.divider}`,backgroundColor:a.palette.background.paper,backgroundImage:`linear-gradient(45deg, ${a.palette.action.hover} 25%, transparent 25%, transparent 75%, ${a.palette.action.hover} 75%), linear-gradient(45deg, ${a.palette.action.hover} 25%, transparent 25%, transparent 75%, ${a.palette.action.hover} 75%)`,backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"}}),h.jsx(Wn,{onClick:Se,sx:{position:"absolute",top:5,right:5,backgroundColor:"background.paper",color:"error.main",padding:1,width:35,height:35,"&:hover":{backgroundColor:"error.50"}},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:"currentColor"})})})]})]}):h.jsxs(h.Fragment,{children:[d.url&&h.jsxs(We,{sx:{position:"relative",maxWidth:"40%",minWidth:"40%"},children:[h.jsx("div",{style:{borderRadius:"8px",border:`2px solid ${a.palette.divider}`,height:"100%",backgroundColor:a.palette.background.paper,backgroundImage:`linear-gradient(45deg, ${a.palette.action.hover} 25%, transparent 25%, transparent 75%, ${a.palette.action.hover} 75%), linear-gradient(45deg, ${a.palette.action.hover} 25%, transparent 25%, transparent 75%, ${a.palette.action.hover} 75%)`,backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"},children:h.jsx("img",{src:d.url||"",alt:"",style:{width:"100%",objectFit:"contain",aspectRatio:"1 / 1",height:"100%"}})}),h.jsx(Wn,{onClick:Se,sx:{position:"absolute",top:5,right:5,backgroundColor:"background.paper",color:"error.main",padding:1,width:35,height:35,"&:hover":{backgroundColor:"error.50"}},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:"currentColor"})})})]}),h.jsxs(We,{onDragOver:pe,onDragLeave:ie,onDrop:ke,sx:{width:"100%",minWidth:"40%",border:"2px solid",borderColor:f?"primary.main":"divider",borderRadius:"8px",padding:"24px 8px 36px 8px",textAlign:"center",bgcolor:f?"primary.50":"background.paper",transition:"all 0.2s ease"},children:[h.jsx(We,{sx:{display:"flex",justifyContent:"center"},children:h.jsx(PU,{sx:{fontSize:32,color:"primary"}})}),h.jsxs("label",{style:{cursor:"pointer"},children:[h.jsx("input",{ref:w,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:V=>{const ee=V.target.files;ee&&ee.length>0&&Y(Array.from(ee))}}),h.jsx(gn,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:r("inputs.common.uploadFile")}),h.jsxs(gn,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",r("inputs.common.dragAndDrop")]})]}),h.jsx(gn,{variant:"body2",sx:{color:"text.secondary",mt:1},children:r("inputs.common.fileInfo")})]})]})}),d.url&&h.jsxs(We,{sx:{mt:2},children:[h.jsxs(We,{sx:{mb:2},children:[h.jsx($n,{label:r("inputs.backgroundImage.fillType")}),h.jsxs(Hh,{value:d.size,exclusive:!0,onChange:(V,ee)=>{ee!=null&&typeof ee=="string"&&P({size:ee})},size:"small",fullWidth:!0,children:[h.jsx(ln,{value:"cover",children:r("inputs.backgroundImage.fillOptions.cover")}),h.jsx(ln,{value:"contain",children:r("inputs.backgroundImage.fillOptions.contain")}),h.jsx(ln,{value:"auto",children:r("inputs.backgroundImage.fillOptions.auto")})]})]}),h.jsxs(_n,{direction:"row",spacing:2,sx:{mb:2},children:[h.jsxs("div",{style:{flex:1},children:[h.jsx($n,{label:r("inputs.backgroundImage.repeat")}),h.jsxs(Jl,{style:{width:"100%"},value:d.repeat,size:"small",onChange:V=>P({repeat:V.target.value}),children:[h.jsx(Xa,{value:"no-repeat",children:r("inputs.backgroundImage.repeatOptions.none")}),h.jsx(Xa,{value:"repeat",children:r("inputs.backgroundImage.repeatOptions.repeat")}),h.jsx(Xa,{value:"repeat-x",children:r("inputs.backgroundImage.repeatOptions.repeatX")}),h.jsx(Xa,{value:"repeat-y",children:r("inputs.backgroundImage.repeatOptions.repeatY")})]})]}),h.jsxs("div",{style:{flex:1},children:[h.jsx($n,{label:r("inputs.backgroundImage.position")}),h.jsx(Jl,{style:{width:"100%"},value:d.position,size:"small",onChange:V=>P({position:V.target.value}),renderValue:V=>{const ee=String(V??"");return h.jsxs(We,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[fe(ee),Ce(ee)]})},children:["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"].map(V=>h.jsx(Xa,{sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important "},value:V,children:h.jsxs(We,{sx:{display:"flex",alignItems:"center",gap:1},children:[fe(V),Ce(V)]})},V))})]})]})]}),!L&&!A&&x&&h.jsx($l,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},children:r("inputs.common.svgWarning")}),(!L&&Mb()&&!A||L&&g)&&h.jsxs(h.Fragment,{children:[h.jsxs(_n,{direction:"row",alignItems:"center",spacing:1,sx:{mt:2},children:[h.jsx(dr,{sx:{flexGrow:1}}),h.jsx(gn,{sx:{color:"text.secondary"},children:r("inputs.backgroundImage.or")}),h.jsx(dr,{sx:{flexGrow:1}})]}),h.jsx(_n,{flexDirection:"row",gap:2,sx:{mt:2},children:!L&&Mb()&&!A&&h.jsx(qi,{variant:"outlined",onClick:re,startIcon:h.jsx(OU,{}),sx:{width:"100%"},children:r("inputs.backgroundImage.browseGallery")})})]}),!L&&g&&h.jsx(qU,{src:d.url,style:{width:"100%",margin:0}})]})};function bd({label:t,defaultValue:e,onChange:n,...i}){const[r,a]=D.useState(e??0);return e!=r&&a(e),h.jsxs(Ki,{children:[h.jsx($n,{label:t}),h.jsx(di,{value:r??0,setValue:s=>{a(s),n(s)},...i})]})}const YO=({mobile:t=!1,label:e,borderColor:n,borderTop:i,borderBottom:r,borderLeft:a,borderRight:s,onChange:o,sidesLinked:l,onSidesLinkedChange:c})=>{const{t:u}=nt.useTranslation("inspector"),d=()=>t?{top:"borderTopMobile",bottom:"borderBottomMobile",left:"borderLeftMobile",right:"borderRightMobile"}:{top:"borderTop",bottom:"borderBottom",left:"borderLeft",right:"borderRight"},p=k=>{const w=Object.values(k);return w.every(A=>A===w[0])},f=d(),m={[f.top]:i??0,[f.bottom]:r??0,[f.left]:a??0,[f.right]:s??0},[g,_]=D.useState(n??"#000000"),[b,y]=D.useState(m),E={[f.top]:Number(b[f.top]),[f.bottom]:Number(b[f.bottom]),[f.left]:Number(b[f.left]),[f.right]:Number(b[f.right])},v=l!==void 0?l:p(E);D.useEffect(()=>{n!==g&&_(n??"#000000");const k={[f.top]:i??0,[f.bottom]:r??0,[f.left]:a??0,[f.right]:s??0};Object.keys(k).some(A=>b[A]!==k[A])&&y(k)},[n,i,r,a,s,t]);const T=()=>{if(v)c(!1);else{const k=b[f.top]??0;C(k),c(!0)}},S=k=>{_(k),o({borderColor:k,...b})},C=k=>{const w={[f.top]:k,[f.bottom]:k,[f.left]:k,[f.right]:k};y(w),o({...w,borderColor:g})},x=(k,w)=>{y(L=>({...L,[w]:k}));const A={...b,borderColor:g,[w]:k};o(A)};return h.jsxs("div",{children:[h.jsxs(_n,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[h.jsx($n,{label:e}),h.jsxs(_n,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(Zc,{defaultValue:g,onChange:S,compact:!0}),h.jsx(Nn,{title:u(v?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:h.jsx(Wn,{size:"small",onClick:T,sx:{color:v?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:v?h.jsx(Qh,{fontSize:"small"}):h.jsx(Xh,{fontSize:"small"})})})]})]}),v&&h.jsx(bd,{label:"",iconLabel:h.jsx(Qce,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.top],onChange:C}),!v&&h.jsxs(_n,{spacing:2,children:[h.jsx(bd,{label:"",iconLabel:h.jsx(Jce,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.top],onChange:k=>x(k,f.top)}),h.jsx(bd,{label:"",iconLabel:h.jsx(Yce,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.bottom],onChange:k=>x(k,f.bottom)}),h.jsx(bd,{label:"",iconLabel:h.jsx(Kce,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.left],onChange:k=>x(k,f.left)}),h.jsx(bd,{label:"",iconLabel:h.jsx(Xce,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.right],onChange:k=>x(k,f.right)})]})]})},_de=fU.map(t=>h.jsx(Xa,{value:t.key,sx:{fontFamily:t.value},children:t.label},t.key));function VU({label:t,onChange:e,defaultValue:n}){const i="INHERIT",[r,a]=D.useState(n??i);D.useEffect(()=>{r!==n&&a(n??i)},[n]);const s=o=>{const l=o.target.value;a(l),e(l===null?null:l)};return h.jsxs(Ki,{children:[h.jsx($n,{label:t}),h.jsx(Jl,{style:{width:"100%"},value:r,size:"small",onChange:s,children:_de})]})}function KO({label:t,defaultValue:e=16,onChange:n,maxValue:i,minValue:r,step:a}){const[s,o]=D.useState(e);D.useEffect(()=>{s!==e&&o(e)},[e]);const l=c=>{o(c),n(c)};return h.jsxs(Ki,{children:[h.jsx($n,{label:t}),h.jsx(di,{iconLabel:h.jsx(BU,{sx:{fontSize:16,color:"text.primary"}}),value:s,setValue:l,units:"px",step:a??2,min:r||8,max:i||48})]})}function bde({label:t,defaultValue:e,onChange:n}){const[i,r]=D.useState(e);return D.useEffect(()=>{i!==e&&r(e)},[e]),h.jsxs(lc,{label:t,defaultValue:i,onChange:a=>{r(a),n(a)},children:[h.jsx(ln,{value:"normal",children:"Regular"}),h.jsx(ln,{value:"bold",children:"Bold"})]})}const QO=({label:t,defaultValue:e,onChange:n})=>{const{t:i}=nt.useTranslation("inspector"),r=t??i("inputs.common.height");return h.jsx(di,{label:r,iconLabel:h.jsx(NU,{sx:{color:"text.secondary"}}),units:"px",step:1,min:1,max:100,marks:!1,value:e??1,setValue:n})},yde=[{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)"}],vde=yde.map(t=>h.jsx(Xa,{value:t.key,children:t.label},t.key));function Ede({label:t,onChange:e,defaultValue:n}){const i="INHERIT",[r,a]=D.useState(n?.toString()??i);D.useEffect(()=>{r!==n?.toString()&&a(n?.toString()??i)},[n]);const s=o=>{const l=o.target.value;a(l),e(l===i?null:parseFloat(l))};return h.jsxs(Ki,{children:[h.jsx($n,{label:t}),h.jsxs(Jl,{style:{width:"100%"},value:r,size:"small",onChange:s,children:[h.jsx(Xa,{value:i,children:"Default value"}),vde]})]})}function XO({label:t,defaultValue:e,onChange:n,sidesLinked:i,onSidesLinkedChange:r}){const{t:s}=nt.useTranslation("inspector"),[o,l]=D.useState(()=>e||{top:0,left:0,bottom:0,right:0});D.useEffect(()=>{e&&(e.top!==o.top||e.left!==o.left||e.bottom!==o.bottom||e.right!==o.right)&&l(e)},[e]);const c=i===!0;function u(p,f){let m;c?m={top:f,bottom:f,left:f,right:f}:m={...o,[p]:f},l(m),n(m)}const d=()=>{const p=!c;if(!c){const f={top:o.top,bottom:o.top,left:o.top,right:o.top};l(f),n(f)}r(p)};return h.jsxs(Ki,{children:[h.jsxs(_n,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[h.jsx($n,{label:t}),h.jsx(Nn,{title:s(c?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:h.jsx(Wn,{size:"small",onClick:d,sx:{marginTop:"0!important",color:c?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:c?h.jsx(Qh,{fontSize:"small"}):h.jsx(Xh,{fontSize:"small"})})})]}),c?h.jsx(di,{iconLabel:h.jsx("span",{children:s("inputs.responsiveSize.allSides")}),value:o.top,setValue:p=>u("top",p),units:"px",step:16,min:0,max:120,marks:!0}):h.jsxs(h.Fragment,{children:[h.jsx(di,{iconLabel:h.jsx(yU,{sx:{fontSize:16,color:"text.primary"}}),value:o.top,setValue:p=>u("top",p),units:"px",step:16,min:0,max:120,marks:!0}),h.jsx(di,{iconLabel:h.jsx(bU,{sx:{fontSize:16,color:"text.primary"}}),value:o.bottom,setValue:p=>u("bottom",p),units:"px",step:16,min:0,max:120,marks:!0}),h.jsx(di,{iconLabel:h.jsx(gU,{sx:{fontSize:16,color:"text.primary"}}),value:o.left,setValue:p=>u("left",p),units:"px",step:16,min:0,max:120,marks:!0}),h.jsx(di,{iconLabel:h.jsx(_U,{sx:{fontSize:16,color:"text.primary"}}),value:o.right,setValue:p=>u("right",p),units:"px",step:16,min:0,max:120,marks:!0})]})]})}const Sde=({label:t,defaultValue:e,onChange:n,maxValue:i=600,shapeSteps:r=8,cornersLinked:a,onCornersLinkedChange:s})=>{const{t:o}=nt.useTranslation("inspector"),[l,c]=D.useState(()=>typeof e=="object"&&e!==null?"rounded":e||"rectangle"),[u,d]=D.useState(()=>typeof e=="object"&&e!==null?e:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0}),p=a===!0;D.useEffect(()=>{typeof e=="object"&&e!==null?(d(e),c("rounded")):(e==="rectangle"||e==="pill")&&c(e)},[e]);const f=y=>{const E=y;c(E),n(E==="rounded"?u:E)},m=(y,E)=>{let v;p?v={topLeft:E,topRight:E,bottomLeft:E,bottomRight:E}:v={...u,[y]:E},d(v),n(v)},g=()=>{const y=!p;if(!p){const E={topLeft:u.topLeft,topRight:u.topLeft,bottomLeft:u.topLeft,bottomRight:u.topLeft};d(E),n(E)}s(y)},_=typeof i=="number"?i:Number(i)||600,b=t||o("shape.label");return h.jsxs(h.Fragment,{children:[h.jsxs(lc,{label:b,defaultValue:l,onChange:f,children:[h.jsx(ln,{value:"rectangle",children:o("shape.square")}),h.jsx(ln,{value:"pill",children:o("shape.pill")}),h.jsx(ln,{value:"rounded",children:o("shape.custom")})]}),l==="rounded"&&h.jsxs(_n,{spacing:2,alignItems:"flexStart",pb:1,children:[h.jsxs(_n,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[h.jsx($n,{label:o("shape.borderRadius")}),h.jsx(Nn,{title:o(p?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:h.jsx(Wn,{size:"small",onClick:g,sx:{marginTop:"0!important",color:p?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:p?h.jsx(Qh,{fontSize:"small"}):h.jsx(Xh,{fontSize:"small"})})})]}),p?h.jsx(h.Fragment,{children:h.jsx(di,{iconLabel:h.jsx(Rf,{sx:{fontSize:16}}),value:Number(u.topRight),setValue:y=>m("topLeft",y),units:"px",min:0,step:r,marks:r>1,max:_})}):h.jsxs(h.Fragment,{children:[h.jsx(di,{iconLabel:h.jsx(Rf,{sx:{fontSize:16,transform:"rotate(0deg)"}}),value:Number(u.topLeft),setValue:y=>m("topLeft",y),units:"px",min:0,step:r,marks:r>1,max:_}),h.jsx(di,{iconLabel:h.jsx(Rf,{sx:{fontSize:16,transform:"rotate(270deg)"}}),value:Number(u.topRight),setValue:y=>m("topRight",y),units:"px",min:0,step:r,marks:r>1,max:_}),h.jsx(di,{iconLabel:h.jsx(Rf,{sx:{fontSize:16,transform:"rotate(180deg)"}}),value:Number(u.bottomLeft),setValue:y=>m("bottomLeft",y),units:"px",min:0,step:r,marks:r>1,max:_}),h.jsx(di,{iconLabel:h.jsx(Rf,{sx:{fontSize:16,transform:"rotate(90deg)"}}),value:Number(u.bottomRight),setValue:y=>m("bottomRight",y),units:"px",min:0,step:r,marks:r>1,max:_})]})]})]})};function JO({label:t,defaultValue:e,onChange:n}){const[i,r]=D.useState(e??"left");return D.useEffect(()=>{e!==i&&r(e??"left")},[e]),h.jsxs(Ki,{children:[h.jsx($n,{label:t}),h.jsxs(lc,{label:"",defaultValue:i,onChange:a=>{r(a),n(a)},children:[h.jsx(ln,{value:"left",children:h.jsx(mue,{fontSize:"small"})}),h.jsx(ln,{value:"center",children:h.jsx(fue,{fontSize:"small"})}),h.jsx(ln,{value:"right",children:h.jsx(hue,{fontSize:"small"})})]})]})}const ZO=({label:t,defaultValue:e,onChange:n,step:i,...r})=>{const{t:a}=nt.useTranslation("inspector"),s=t??a("inputs.common.width");return h.jsx(di,{label:s,iconLabel:h.jsx(NU,{sx:{color:"text.primary",transform:"rotate(90deg)"}}),units:"%",step:i,min:1,max:100,marks:!1,value:e??1,setValue:n,...r})};function Cde({name:t,value:e,onChange:n,shapeMaxValue:i,shapeSteps:r}){const a=fi(),s=Lv(),{t:o}=nt.useTranslation("inspector"),l=(f,m)=>{const g=e[f],_=e[m];return g??_},c=(f,m)=>{n(m?{...e,...m,[t]:f}:{...e,[t]:f})},u=f=>{n({...e,...f})},p=(()=>{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(SS,{label:o("properties.backgroundColor"),defaultValue:p??s?.canvasColor,onChange:c});case"background":return h.jsx(gde,{defaultValue:p,onChange:(f,m)=>c(f,m),values:e});case"borderColor":return h.jsx(SS,{label:o("properties.border"),defaultValue:p,onChange:c});case"borderRadius":return h.jsx(bd,{iconLabel:h.jsx(Due,{}),units:"px",step:4,marks:!0,min:0,max:48,label:o("properties.borderRadius"),defaultValue:p,onChange:c});case"color":return h.jsx(SS,{label:o("properties.color"),defaultValue:p,onChange:c});case"fontFamily":return h.jsx(VU,{label:o("properties.fontFamily"),defaultValue:p,onChange:c});case"fontWeight":return h.jsx(bde,{label:o("properties.fontWeight"),defaultValue:p,onChange:c});case"textAlign":return a==="desktop"&&h.jsx(JO,{label:o("properties.alignment"),defaultValue:p,onChange:c});case"textAlignMobile":return a!="desktop"&&h.jsx(JO,{label:o("properties.alignment"),defaultValue:p,onChange:c});case"padding":return a==="desktop"&&h.jsx(XO,{label:o("properties.padding"),defaultValue:p,onChange:c,sidesLinked:e.paddingSidesLinked,onSidesLinkedChange:f=>n({...e,paddingSidesLinked:f})});case"mobilePadding":return a!="desktop"&&h.jsx(XO,{label:o("properties.padding"),defaultValue:p,onChange:c,sidesLinked:e.mobilePaddingSidesLinked,onSidesLinkedChange:f=>n({...e,mobilePaddingSidesLinked:f})});case"fontSize":return a==="desktop"&&h.jsx(KO,{maxValue:80,step:8,label:o("properties.fontSize"),defaultValue:p??16,onChange:c});case"fontSizeMobile":return a!="desktop"&&h.jsx(KO,{maxValue:80,step:8,label:o("properties.fontSize"),defaultValue:p,onChange:c});case"lineHeight":return h.jsx(Ede,{label:o("properties.lineHeight"),defaultValue:p??1.5,onChange:c});case"shape":return h.jsx(Sde,{shapeSteps:r,maxValue:i,label:o("properties.shape"),defaultValue:p,onChange:c,cornersLinked:e.shapeCornersLinked,onCornersLinkedChange:f=>n({...e,shapeCornersLinked:f})});case"height":return a==="desktop"&&h.jsx(QO,{label:o("properties.height"),defaultValue:p,onChange:c});case"heightMobile":return a!="desktop"&&h.jsx(QO,{label:o("properties.height"),defaultValue:p,onChange:c});case"width":return a==="desktop"&&h.jsx(ZO,{label:o("properties.width"),defaultValue:p,onChange:c});case"widthMobile":return a!="desktop"&&h.jsx(ZO,{label:o("properties.width"),defaultValue:p,onChange:c});case"border":return a==="desktop"&&h.jsx(YO,{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,sidesLinked:e.borderSidesLinked,onSidesLinkedChange:f=>n({...e,borderSidesLinked:f})});case"borderMobile":return a!="desktop"&&h.jsx(YO,{mobile:!0,label:o("properties.border"),borderColor:e.borderColor??null,borderTop:p.borderTop??null,borderBottom:p.borderBottom??null,borderLeft:p.borderLeft??null,borderRight:p.borderRight??null,onChange:u,sidesLinked:e.borderMobileSidesLinked,onSidesLinkedChange:f=>n({...e,borderMobileSidesLinked:f})});default:return null}}function Nr({names:t,value:e,onChange:n,disabledCSSValidation:i=!1,shapeMaxValue:r,shapeSteps:a}){const s=Qo(),o=iU();return(i||s=="css"||xb.includes(o||""))&&h.jsx(h.Fragment,{children:t.map(l=>h.jsx(Cde,{shapeMaxValue:r,shapeSteps:a,name:l,value:e||{},onChange:n},l))})}function Tde({data:t,setData:e}){const[,n]=D.useState(null),i=Lv(),{t:r}=nt.useTranslation("inspector"),a=_=>{const b=mU.safeParse(_);b.success?(e(b.data),n(null)):n(b.error)},s=t.props?.text??Al.text,o=t.props?.url??Al.url,l=t.props?.fullWidth??Al.fullWidth,c=t.props?.size??Al.size,u=i,d=t.style?.buttonTextColor??t.props?.buttonTextColor??u?.textColor,p=t.style?.buttonBackgroundColor??t.props?.buttonBackgroundColor??Al.buttonBackgroundColor,f=t.props?.fullWidthMobile,m=t.props?.sizeMobile,g=Qo();return h.jsxs(gs,{title:r("inputs.panels.button.title"),children:[g=="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsx(Nr,{disabledCSSValidation:!0,names:["fontFamily","fontSize","fontSizeMobile","fontWeight"],value:t.style,onChange:_=>a({...t,style:_})}),h.jsx(dp,{label:r("inputs.panels.button.textLabel"),defaultValue:s,onChange:_=>a({...t,props:{...t.props,text:_}})}),h.jsx(dp,{label:r("inputs.panels.button.targetLabel"),placeholder:r("inputs.panels.button.targetPlaceholder"),defaultValue:o,onChange:_=>a({...t,props:{...t.props,url:_}})}),h.jsx(lde,{label:r("properties.width"),fullWidth:l,fullWidthMobile:f,onChange:_=>a({...t,props:{...t.props,..._}})}),h.jsx(ode,{size:c,sizeMobile:m,sizePaddingSidesLinked:t.props?.sizePaddingSidesLinked,sizeMobilePaddingSidesLinked:t.props?.sizeMobilePaddingSidesLinked,onChange:_=>a({...t,props:{...t.props,..._}})})]}),h.jsx(Nr,{names:["shape","textAlign","textAlignMobile","backgroundColor","border","borderMobile","padding","mobilePadding"],value:t.style,shapeMaxValue:80,onChange:_=>a({...t,style:_})}),g==="css"&&h.jsxs(h.Fragment,{children:[h.jsx(Zc,{label:r("inputs.panels.button.textColor"),defaultValue:d,onChange:_=>a({...t,style:{...t.style,buttonTextColor:_}})}),h.jsx(Zc,{label:r("inputs.panels.button.buttonColor"),defaultValue:p,onChange:_=>a({...t,style:{...t.style,buttonBackgroundColor:_}})})]})]})}const Vb=vt({top:Oe(),bottom:Oe(),right:Oe(),left:Oe()}).optional().nullable(),Yp=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},xde=pU([Oe().nullish(),Oe().nullish(),Oe().nullish()]).optional().nullable(),WU=vt({style:vt({background:rt().nullable().optional(),backgroundColor:rt().nullable().optional(),padding:Vb,mobilePadding:Vb}).passthrough().optional().nullable(),props:vt({fixedWidths:xde,columnsCount:$d([Ck(2),Ck(3)]).optional().nullable(),layout:rt().optional().nullable(),contentAlignment:Vn(["top","middle","bottom"]).optional().nullable(),contentAlignmentMobile:Vn(["top","middle","bottom"]).optional().nullable()}).optional().nullable()}).passthrough(),kde={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},xm={columnsCount:2,contentAlignment:"middle"};function Dk({style:t,columns:e,props:n,blockId:i}){const r=fi(),a=sA(),s={padding:Yp(r=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},o={columnsCount:n?.columnsCount??xm.columnsCount,contentAlignment:r=="desktop"?n?.contentAlignment??xm.contentAlignment:n?.contentAlignmentMobile??n?.contentAlignment??xm.contentAlignment,fixedWidths:n?.fixedWidths,blockId:i},l=t?.background??"",c=t?.backgroundColor,u=c?Iu(l,c):l,d=Wt(i);return h.jsxs(Zr,{background:u,backgroundColor:c,className:`${d}`,padding:s.padding,width:"100%",children:[a.uploading&&a.id===i?h.jsx("div",{style:kde,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(CS,{index:0,props:o,columns:e}),h.jsx(CS,{index:1,props:o,columns:e}),h.jsx(CS,{index:2,props:o,columns:e})]})})})]})}function CS({index:t,props:e,columns:n}){const i=e?.contentAlignment??xm.contentAlignment;if((e?.columnsCount??xm.columnsCount)===2&&t===2)return null;const a=e.fixedWidths?.[t],s={boxSizing:"border-box",verticalAlign:i,width:a!=null?`${a}%`:void 0},o=(n&&n[t])??null,l=e.blockId?Wt(e.blockId):"";return h.jsx("td",{className:`col${l}`,style:s,children:o})}const wde=WU.shape.props.unwrap().unwrap().shape,_A=vt({style:WU.shape.style,props:vt({...wde,columns:pU([vt({childrenIds:Bd(rt())}),vt({childrenIds:Bd(rt())}),vt({childrenIds:Bd(rt())})])}).optional().nullable(),blockId:rt().optional(),isNotClient:Fs().optional()}).passthrough(),Dde=(t,e,n)=>{if(!t||!document)return;const i=Wt(t),r=document.querySelector(`.${i}`);if(!r)return;const a=r.parentElement;if(!a)return;const s=Math.ceil(a.getBoundingClientRect().width);n.props?.touched||n.props?.width!==s&&e({...n,props:{...n.props,width:s}})},Ade=t=>{if(!t||!document)return;const e=Wt(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},Nde={desktop:"contentAlignment",mobile:"contentAlignmentMobile"};function Rde({data:t,updateData:e}){const{t:n}=nt.useTranslation("inspector"),i=fi(),r=Nde[i]||"contentAlignment",a=t.props?.[r]??t.props?.contentAlignment,s=o=>{e({...t,props:{...t.props,[r]:o}})};return h.jsxs(lc,{label:n("inputs.alignment.label"),defaultValue:a,onChange:s,children:[h.jsx(ln,{value:"top",children:h.jsx(Pue,{fontSize:"small"})}),h.jsx(ln,{value:"middle",children:h.jsx(Mue,{fontSize:"small"})}),h.jsx(ln,{value:"bottom",children:h.jsx(Oue,{fontSize:"small"})})]})}const ed="layout-custom",TS=[{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]}],xS=[{id:"layout-33-33-33",distribution:[33.34,33.33,33.33]},{id:"layout-30-40-30",distribution:[30,40,30]},{id:"layout-25-50-25",distribution:[25,50,25]},{id:"layout-20-60-20",distribution:[20,60,20]},{id:"layout-50-25-25",distribution:[50,25,25]},{id:"layout-25-25-50",distribution:[25,25,50]},{id:"layout-60-20-20",distribution:[60,20,20]},{id:"layout-20-20-60",distribution:[20,20,60]},{id:"layout-40-30-30",distribution:[40,30,30]},{id:"layout-40-20-40",distribution:[40,20,40]},{id:"layout-15-70-15",distribution:[15,70,15]}],vl={grid:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:"16px",width:"100%"},card:{cursor:"pointer",border:"1px solid #e5e7eb",borderRadius:"8px",backgroundColor:"primary"},cardContent:{padding:"8px"},layoutPreview:{display:"grid",gap:"4px",height:"30px",width:"100%",minHeight:"30px"}};function eM(t){const e=t?.[0];return typeof e=="number"&&!Number.isNaN(e)?Math.min(99,Math.max(1,Math.round(e))):50}function kS(t){let e=typeof t?.[0]=="number"?Math.round(t[0]):34,n=typeof t?.[1]=="number"?Math.round(t[1]):33;return e=Math.min(98,Math.max(1,e)),n=Math.min(98,Math.max(1,n)),e+n>=99&&(n=Math.max(1,99-e)),[e,n]}const wS=({fractions:t,highlight:e})=>{const n=Xt(),i=e?n.palette.secondary.main:"#e5e7eb";return h.jsx("div",{style:{...vl.layoutPreview,gridTemplateColumns:t.map(r=>`${r}fr`).join(" ")},children:t.map((r,a)=>h.jsx("div",{style:{minWidth:0,backgroundColor:i,borderRadius:"4px",transition:"background-color 0.2s ease"}},a))})},Ide=({defaultValue:t,fixedWidths:e,onChange:n,columns:i})=>{const{t:r}=nt.useTranslation("inspector"),a=Xt(),[s,o]=D.useState(null),[l,c]=D.useState(!1),[u,d]=D.useState(()=>eM(e??void 0)),[p,f]=D.useState(()=>kS(e??void 0)[0]),[m,g]=D.useState(()=>kS(e??void 0)[1]),b=t??(i===2?"layout-50-50":"layout-33-33-33"),E=s??(b==="layout-33-34-33"?"layout-33-33-33":b),[v,T]=D.useState(i===2?TS:xS),S=(O,M)=>{o(null),c(!1),n({layout:O,fixedWidths:M})},C=()=>{if(o(ed),c(!0),i===2)d(eM(e??void 0));else{const[O,M]=kS(e??void 0);f(O),g(M)}},x=()=>{if(i===2){const O=u;n({layout:ed,fixedWidths:[O,100-O,null]})}else{const O=p,M=m;n({layout:ed,fixedWidths:[O,M,100-O-M]})}o(null)};D.useEffect(()=>{T(i===2?TS:xS)},[i]),D.useEffect(()=>{o(null),c(!1)},[i,t]),D.useEffect(()=>{const O=t;i===2?O!==ed&&(O==null||!TS.some(M=>M.id===O))&&n({layout:"layout-50-50",fixedWidths:[50,50,null]}):O==="layout-33-34-33"?n({layout:"layout-33-33-33",fixedWidths:[33.34,33.33,33.33]}):O!==ed&&(O==null||!xS.some(M=>M.id===O))&&n({layout:"layout-33-33-33",fixedWidths:[33.34,33.33,33.33]})},[i,t,n]);const k=(O,M)=>{const P=M;f(P),g(F=>Math.max(1,Math.min(F,100-P-1)))},w=(O,M)=>{const P=M,F=100-p-1;g(Math.max(1,Math.min(P,F)))},A=100-u,L=100-p-m,I=E===ed;return h.jsxs(Ki,{children:[h.jsx($n,{label:r("inputs.layout.label")}),h.jsxs("div",{style:vl.grid,children:[v.map(O=>h.jsx("div",{onClick:()=>S(O.id,O.distribution),style:{...vl.card,border:E===O.id?`2px solid ${a.palette.secondary.main}`:vl.card.border},children:h.jsx("div",{style:vl.cardContent,children:h.jsx(wS,{fractions:O.distribution.filter(M=>M!=null),highlight:E===O.id})})},O.id)),h.jsx("div",{onClick:C,style:{...vl.card,border:I?`2px solid ${a.palette.secondary.main}`:vl.card.border},role:"button",tabIndex:0,onKeyDown:O=>{(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),C())},children:h.jsx("div",{style:vl.cardContent,children:h.jsx(We,{sx:{width:"100%",height:30,minHeight:30,border:"1px dashed",borderColor:"divider",borderRadius:1,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:I?"action.selected":"action.hover",color:"text.primary",transition:a.transitions.create(["background-color"],{duration:a.transitions.duration.shorter})},children:h.jsx(CU,{sx:{fontSize:18,color:"text.primary"}})})})})]}),h.jsx(RD,{in:l,timeout:"auto",unmountOnExit:!0,children:h.jsxs(We,{sx:{mt:2,p:2,borderRadius:1,border:1,borderColor:"divider",bgcolor:"background.paper"},children:[i===2?h.jsxs(_n,{spacing:2,sx:{mt:1},children:[h.jsxs(gn,{variant:"body2",color:"text.secondary",children:[u,"% | ",A,"%"]}),h.jsx(H_,{value:u,min:1,max:99,step:1,valueLabelDisplay:"auto","aria-label":r("inputs.layout.custom.split2"),onChange:(O,M)=>d(M)}),h.jsx(wS,{fractions:[u,A],highlight:!0})]}):h.jsxs(_n,{spacing:2,sx:{mt:1},children:[h.jsxs(gn,{variant:"body2",color:"text.secondary",children:[p,"% | ",m,"% | ",L,"%"]}),h.jsxs(We,{children:[h.jsx(gn,{variant:"caption",color:"text.secondary",component:"div",children:r("inputs.layout.custom.firstColumn")}),h.jsx(H_,{value:p,min:1,max:98,step:1,valueLabelDisplay:"auto",onChange:k})]}),h.jsxs(We,{children:[h.jsx(gn,{variant:"caption",color:"text.secondary",component:"div",children:r("inputs.layout.custom.secondColumn")}),h.jsx(H_,{value:m,min:1,max:100-p-1,step:1,valueLabelDisplay:"auto",onChange:w})]}),h.jsx(wS,{fractions:[p,m,L],highlight:!0})]}),h.jsx(qi,{variant:"contained",size:"small",sx:{mt:2},onClick:x,children:h.jsx(gn,{variant:"button",component:"span",sx:{color:O=>O.palette.text.secondary,fontWeight:"bold"},children:r("inputs.layout.custom.apply")})})]})})]})};function Ode({data:t,setData:e}){const[,n]=D.useState(null),[i,r]=D.useState(t.props?.columnsCount??2),a=Qo(),s=fi(),{t:o}=nt.useTranslation("inspector"),l=f=>{const m=ce.getState().document,g=f.filter(_=>m[_]?.type==="Image");s==="desktop"&&g.forEach(_=>{const b=m[_];if(b?.type!=="Image")return;const y=b.data;Dde(_,E=>{Pb(_,v=>v.type!=="Image"?v:{...v,data:E})},y)})},c=f=>{const m=_A.safeParse(f);m.success?(m.data.props.columns.map(g=>l(g.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},p=f=>{const m=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:[...t.props.columns];return f==="2"?{...u,columns:m}:{...d,columns:m}};return h.jsxs(gs,{title:o("inputs.panels.columns.title"),children:[a=="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsxs(lc,{label:o("inputs.panels.columns.countLabel"),defaultValue:t.props?.columnsCount===2?"2":"3",onChange:f=>{const m=p(f);c({...t,props:{...t.props,...m}})},children:[h.jsx(ln,{style:{fontWeight:"bold"},value:"2",children:"2"}),h.jsx(ln,{style:{fontWeight:"bold"},value:"3",children:"3"})]}),h.jsx(Ide,{columns:t.props?.columnsCount??3,defaultValue:t.props?.layout,fixedWidths:t.props?.fixedWidths??void 0,onChange:({layout:f,fixedWidths:m})=>{const g=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:t.props.columns;c({...t,props:{...t.props,layout:f,fixedWidths:m,columns:g}})}})]}),a=="css"&&h.jsxs(h.Fragment,{children:[h.jsx(Rde,{data:t,updateData:e}),h.jsx(Nr,{names:["backgroundColor","background","padding","mobilePadding"],value:t.style,onChange:f=>c({...t,style:f})})]})]})}const tM=rt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),nM=vt({top:Oe(),bottom:Oe(),right:Oe(),left:Oe()}).optional().nullable(),Mde=vt({topLeft:Oe().min(0).optional(),topRight:Oe().min(0).optional(),bottomLeft:Oe().min(0).optional(),bottomRight:Oe().min(0).optional()}),iM={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},Pde=vt({style:vt({backgroundColor:tM,background:rt().nullable().optional(),borderColor:tM,borderRadius:Oe().optional().nullable(),borderTop:Oe().optional().nullable(),borderBottom:Oe().optional().nullable(),borderLeft:Oe().optional().nullable(),borderRight:Oe().optional().nullable(),borderTopMobile:Oe().optional().nullable(),borderBottomMobile:Oe().optional().nullable(),borderLeftMobile:Oe().optional().nullable(),borderRightMobile:Oe().optional().nullable(),shape:$d([Vn(["rectangle","pill"]),Mde]).optional().nullable(),padding:nM,mobilePadding:nM}).passthrough().optional().nullable()}).passthrough();function YU({style:t,children:e,blockId:n}){const i=fi(),r=sA(),a={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:Yp(i=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},s=t?.background??"",o=t?.backgroundColor,l=o?Iu(s,o):s,c=dA(t),u=Wt(n);return e?h.jsx(Zr,{className:`${u}`,background:l,backgroundColor:t?.backgroundColor,borderRadius:c,padding:a.padding,width:"100%",border:a.border,children:h.jsxs(h.Fragment,{children:[r.uploading&&r.id===n&&h.jsx("div",{style:iM,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(Zr,{className:`${u}`,background:l,backgroundColor:o,borderRadius:c,padding:a.padding,width:"100%",border:a.border,children:h.jsx("div",{children:r.uploading&&r.id===n&&h.jsx("div",{style:iM,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 KU=vt({style:Pde.shape.style,props:vt({childrenIds:Bd(rt()).optional().nullable()}).optional().nullable(),blockId:rt().optional(),isNotClient:Fs().optional()}).passthrough();function QU({data:t,setData:e}){const[,n]=D.useState(null),{t:i}=nt.useTranslation("inspector"),r=a=>{const s=KU.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return h.jsx(gs,{title:i("inputs.panels.container.title"),children:h.jsx(Nr,{names:["backgroundColor","background","border","borderMobile","shape","padding","mobilePadding"],value:t.style,shapeSteps:30,onChange:a=>r({...t,style:a})})})}const Lde=rt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),rM=vt({top:Oe(),bottom:Oe(),right:Oe(),left:Oe()}).optional().nullable(),XU=vt({style:vt({background:rt().nullable().optional(),backgroundColor:Lde,padding:rM,mobilePadding:rM,height:Oe().optional().nullable(),heightMobile:Oe().optional().nullable(),color:rt().optional().nullable(),width:Oe().optional().nullable(),widthMobile:Oe().optional().nullable(),textAlign:rt().optional().nullable(),textAlignMobile:rt().optional().nullable()}).passthrough().optional().nullable()}).passthrough(),wc={height:1,color:"#333333",width:100,textAlign:"left"};function JU({style:t,blockId:e}){const n=fi(),i=Yp(n==="desktop"?t?.padding:t?.mobilePadding??t?.padding),r=n==="desktop"?t?.height??wc.height:t?.heightMobile??t?.height??wc.height,a=t?.color??wc.color,s=n==="desktop"?(t?.width??wc.width)+"%":(t?.widthMobile??t?.width??wc.width)+"%",o=n==="desktop"?t?.textAlign??wc.textAlign:t?.textAlignMobile??t?.textAlign??wc.textAlign,l=t?.background??"",c=t?.backgroundColor??"",u=c?Iu(l,c):l,d=Wt(e);return h.jsx(Zr,{className:`c${d}`,background:u,backgroundColor:c,width:"100%",padding:i,align:o,children:h.jsx(Zr,{display:"inline-block",className:`${d}`,background:a,backgroundColor:c,width:s,padding:{top:r,bottom:0,left:0,right:0},isParent:!1,children:h.jsx("div",{})})})}function ZU({data:t,setData:e}){const[,n]=D.useState(null),{t:i}=nt.useTranslation("inspector"),r=a=>{const s=XU.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return h.jsx(gs,{title:i("inputs.panels.divider.title"),children:h.jsx(Nr,{names:["width","widthMobile","height","heightMobile","color","backgroundColor","textAlign","textAlignMobile","padding","mobilePadding"],value:t.style,onChange:a=>r({...t,style:a})})})}const If=rt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),e8=vt({backdropColor:If,borderColor:If,borderRadius:Oe().optional().nullable(),canvasColor:If,textColor:If,fontFamily:Vp,childrenIds:Bd(rt()).optional().nullable(),linkGlobal:vt({linkColor:If,underline:Fs()}).optional().nullable(),showVersion:Fs().optional().nullable()}),Fde=({label:t,linkColor:e,underline:n=!1,onChange:i})=>{const[r,a]=D.useState(e??"#FF0000"),[s,o]=D.useState(n),l=Xt(),{t:c}=nt.useTranslation("inspector"),u=t??c("inputs.links.color"),d=s?"enabled":"disabled",p={container:{width:"100%"},toggleGroup:{width:"100%",backgroundColor:l.palette.background.paper,padding:"4px",borderRadius:"8px"},toggleButton:{flex:1,padding:"6px 16px",textTransform:"none",fontSize:"14px",color:l.palette.text.primary,"&.Mui-selected":{backgroundColor:l.palette.grey[200],color:l.palette.text.primary,"&:hover":{backgroundColor:l.palette.grey[300]}},"&:hover":{backgroundColor:l.palette.grey[100]}}};D.useEffect(()=>{e!==r&&a(e??"#FF0000")},[e]),D.useEffect(()=>{n!==s&&o(n)},[n]);const f=g=>{const _=g??"#FF0000";a(_),i({linkColor:_,underline:s})},m=(g,_)=>{if(!_)return;const b=_==="enabled";o(b),i({linkColor:r,underline:b})};return h.jsxs(Ki,{children:[h.jsx(Zc,{label:u,defaultValue:r,onChange:f}),h.jsx($n,{label:c("inputs.links.underline")}),h.jsx(We,{sx:p.container,children:h.jsxs(Hh,{value:d,exclusive:!0,onChange:m,sx:p.toggleGroup,children:[h.jsx(ln,{value:"enabled",sx:p.toggleButton,children:h.jsx(Nn,{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(ln,{value:"disabled",sx:p.toggleButton,children:h.jsx(Nn,{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"})]})})})]})})]})},Bde="email-builder-online",$de="3.5.0",DS={name:Bde,version:$de};function t8({data:t,setData:e}){const[,n]=D.useState(null),{t:i}=nt.useTranslation("inspector"),r=sce(),a=s=>{const o=e8.safeParse(s);o.success?(e(o.data),n(null)):n(o.error)};return h.jsxs(gs,{title:i("inputs.panels.emailLayout.title"),children:[h.jsx(Zc,{label:i("inputs.panels.emailLayout.backgroundColor"),defaultValue:t.backdropColor??"#F5F5F5",onChange:s=>a({...t,backdropColor:s})}),h.jsx(Zc,{label:i("inputs.panels.emailLayout.canvasColor"),defaultValue:t.canvasColor??"#FFFFFF",onChange:s=>a({...t,canvasColor:s})}),h.jsx(VU,{label:i("inputs.panels.emailLayout.fontFamily"),defaultValue:t.fontFamily||Uce.FAMILY,onChange:s=>a({...t,fontFamily:s})}),h.jsx(Zc,{label:i("inputs.panels.emailLayout.textColor"),defaultValue:t.textColor??"#262626",onChange:s=>a({...t,textColor:s})}),h.jsx(Fde,{label:i("inputs.panels.emailLayout.linksLabel"),linkColor:t.linkGlobal?.linkColor||"#000000",underline:t.linkGlobal?.underline||!1,onChange:s=>a({...t,linkGlobal:s})}),r&&h.jsx(We,{color:"text.secondary",sx:{display:"flex",justifyContent:"flex-end",mt:2},children:h.jsxs(We,{sx:{textAlign:"right"},children:[h.jsxs(gn,{variant:"body2",children:[i("inputs.panels.emailLayout.version"),": ",DS.version]}),h.jsx(Ore,{href:`https://www.npmjs.com/package/${DS.name}`,target:"_blank",rel:"noopener noreferrer",sx:{fontSize:"0.875rem",mt:.5,display:"inline-block"},children:DS.name})]})})]})}const aM=rt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),Ude=vt({top:Oe(),bottom:Oe(),right:Oe(),left:Oe()}).optional().nullable(),zde=t=>t?`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`:void 0,n8=vt({props:vt({text:rt().optional().nullable(),level:Vn(["h1","h2","h3"]).optional().nullable()}).optional().nullable(),style:vt({color:aM,backgroundColor:aM,fontFamily:Vp,fontWeight:Vn(["bold","normal"]).optional().nullable(),textAlign:Vn(["left","center","right"]).optional().nullable(),padding:Ude}).passthrough().optional().nullable()}),Wb={level:"h2",text:""};function i8({props:t,style:e}){const n=t?.level??Wb.level,i=t?.text??Wb.text,r={color:e?.color??void 0,backgroundColor:e?.backgroundColor??void 0,fontWeight:e?.fontWeight??"bold",textAlign:e?.textAlign??void 0,margin:0,fontFamily:Xl(e?.fontFamily),fontSize:Gde(n),padding:zde(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 Gde(t){switch(t){case"h1":return 32;case"h2":return 24;case"h3":return 20}}function Hde({data:t,setData:e}){const[,n]=D.useState(null),{t:i}=nt.useTranslation("inspector"),r=s=>{const o=n8.safeParse(s);o.success?(e(o.data),n(null)):n(o.error)},a=Qo();return h.jsxs(gs,{title:i("inputs.panels.heading.title"),children:[a=="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsx(dp,{label:i("inputs.panels.heading.contentLabel"),rows:3,defaultValue:t.props?.text??Wb.text,onChange:s=>{r({...t,props:{...t.props,text:s}})}}),h.jsxs(lc,{label:i("inputs.panels.heading.levelLabel"),defaultValue:t.props?.level??Wb.level,onChange:s=>{r({...t,props:{...t.props,level:s}})},children:[h.jsx(ln,{value:"h1",children:"H1"}),h.jsx(ln,{value:"h2",children:"H2"}),h.jsx(ln,{value:"h3",children:"H3"})]})]}),h.jsx(Nr,{names:["color","backgroundColor","fontFamily","fontWeight","textAlign","padding","mobilePadding"],value:t.style,onChange:s=>r({...t,style:s})})]})}const sM=rt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),jde=vt({top:Oe(),bottom:Oe(),right:Oe(),left:Oe()}).optional().nullable(),qde=t=>t?`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`:void 0,r8=vt({style:vt({color:sM,backgroundColor:sM,fontFamily:Vp,fontSize:Oe().min(0).optional().nullable(),textAlign:Vn(["left","right","center"]).optional().nullable(),padding:jde}).passthrough().optional().nullable(),props:vt({contents:rt().optional().nullable()}).optional().nullable()});function a8({style:t,props:e}){const n=e?.contents,i={color:t?.color??void 0,backgroundColor:t?.backgroundColor??void 0,fontFamily:Xl(t?.fontFamily),fontSize:t?.fontSize??void 0,textAlign:t?.textAlign??void 0,padding:qde(t?.padding)};return n?h.jsx("div",{style:i,dangerouslySetInnerHTML:{__html:n}}):h.jsx("div",{style:i})}function Vde({data:t,setData:e}){const[,n]=D.useState(null),{t:i}=nt.useTranslation("inspector"),r=s=>{const o=r8.safeParse(s);o.success?(e(o.data),n(null)):n(o.error)},a=Qo();return h.jsxs(gs,{title:i("inputs.panels.html.title"),children:[a=="block-configuration"&&h.jsx(h.Fragment,{children:h.jsx(dp,{label:i("inputs.panels.html.contentLabel"),rows:5,defaultValue:t.props?.contents??"",onChange:s=>r({...t,props:{...t.props,contents:s}})})}),h.jsx(Nr,{names:["color","backgroundColor","fontFamily","fontSize","textAlign","padding","mobilePadding"],value:t.style,onChange:s=>r({...t,style:s})})]})}const Wde=vt({topLeft:Oe().min(0).optional(),topRight:Oe().min(0).optional(),bottomLeft:Oe().min(0).optional(),bottomRight:Oe().min(0).optional()}),bA=vt({style:vt({padding:Vb,mobilePadding:Vb,background:rt().nullable().optional(),backgroundColor:rt().regex(/^#[0-9a-fA-F]{6}$/).optional().nullable(),textAlign:Vn(["center","left","right"]).optional().nullable(),textAlignMobile:Vn(["center","left","right"]).optional().nullable(),shape:$d([Vn(["rectangle","pill"]),Wde]).optional().nullable()}).passthrough(),props:vt({touched:Fs().optional().nullable(),scale:Oe().optional().nullable(),size:rt().optional().nullable(),sizeMobile:rt().optional().nullable(),width:Oe().optional().nullable(),widthMobile:Oe().optional().nullable(),scaleMobile:Oe().optional().nullable(),touchedMobile:Fs().optional().nullable(),original_width:Oe().optional().nullable(),height:Oe().optional().nullable(),url:rt().optional().nullable(),alt:rt().optional().nullable(),linkHref:rt().optional().nullable(),contentAlignment:Vn(["top","middle","bottom"]).optional().nullable()}).optional().nullable()}).passthrough();function s8({style:t,props:e,blockId:n}){const i=fi(),r=sA(),s=!Pv(),o={padding:Yp(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},l=(y,E)=>y==="fill"?"100%":y==="scale"?`${E}%`:e?.width,c=e?.linkHref??null,u=i=="desktop"?l(e?.size,e?.scale):l(e?.sizeMobile,e?.scaleMobile),d={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},p=t?.background??"",f=t?.backgroundColor,m=f?Iu(p,f):p,g=y=>{const E=y.currentTarget;setTimeout(()=>{if(!e?.width&&E.offsetWidth){const v=E.offsetWidth;dce(n,{...e,width:v})}},100)},_=h.jsxs(h.Fragment,{children:[h.jsx("img",{alt:e?.alt??"",src:e?.url??"",width:u,onLoad:g,style:{width:u,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:dA(t)}}),r.uploading&&r.id===n&&h.jsx("div",{style:d,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"})})})]}),b=Wt(n);return c?h.jsx(Zr,{className:`${b}`,padding:o.padding,background:m,align:o.textAlign,width:"100%",children:h.jsx("a",{href:s?void 0:uA(c),style:{textDecoration:"none",display:"block",width:"100%",height:"100%",pointerEvents:s?"none":void 0},target:s?void 0:"_blank",onClick:s?y=>y.preventDefault():void 0,children:_})}):h.jsx(Zr,{className:`${b}`,padding:o.padding,background:m,align:o.textAlign,width:"100%",children:_})}const Yde=(t,e,n)=>{const i=fi();D.useEffect(()=>{const r=()=>{if(!t||!document||i=="mobile")return;const o=Wt(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 a=new ResizeObserver(r),s=document.querySelector(`.${Wt(t)}`);return s?.parentElement&&a.observe(s.parentElement),()=>{a.disconnect()}},[t,e,n,i])},Kde=({data:t,setData:e,blockId:n})=>{const{t:i}=nt.useTranslation("inspector"),[r,a]=D.useState(!1),[s,o]=D.useState(()=>!!window.__emailBuilderEnableAI),[,l]=D.useState(null),[c,u]=D.useState(""),[d,p]=D.useState(!1),[f,m]=D.useState(""),[g,_]=D.useState(!1),b=D.useRef(null),y=oA(),[E,v]=D.useState(null);D.useEffect(()=>{const P=window.__emailBuilderCustomImageProvider;P&&(v(P),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 T=P=>{const F=bA.safeParse(P);F.success?(e(F.data),l(null)):l(F.error)},S=(P,F)=>{const U=P.toLowerCase(),H=U.includes(".svg")||U.includes("svg"),q=F&&(F.includes("image/svg+xml")||F.includes("svg"));return H||!!q},C=async P=>{try{p(!0),m(""),_(!1);try{new URL(P)}catch{return m(i("inputs.image.invalidUrl")),!1}const F=new AbortController,U=setTimeout(()=>F.abort(),1e4);try{const H=await fetch(P,{method:"HEAD",signal:F.signal});if(clearTimeout(U),!H.ok)return m(`HTTP ${H.status}: ${H.statusText}`),!1;const q=H.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(pe=>q&&q.toLowerCase().includes(pe.toLowerCase()))?(S(P,q)&&_(!0),m(""),!0):(m(i("inputs.image.notImage")),!1)}catch(H){return clearTimeout(U),H.name==="AbortError"?(m(i("inputs.image.timeout")),!1):new Promise(q=>{const Q=new Image,Y=setTimeout(()=>{m(i("inputs.image.timeout")),q(!1)},1e4);Q.onload=()=>{clearTimeout(Y),S(P)&&_(!0),m(""),q(!0)},Q.onerror=()=>{clearTimeout(Y),m("Cannot access image - CORS policy, network error, or invalid URL"),q(!1)},Q.src=P})}}catch{return m("Unexpected error occurred while validating URL"),!1}finally{p(!1)}},x=async()=>{c.trim()&&await C(c.trim())&&(T({...t,props:{...t.props,url:c.trim()}}),u(""))},k=P=>{P.key==="Enter"&&x()},w=P=>{u(P.target.value),f&&m(""),g&&_(!1)},A=P=>{const F=["image/png","image/jpeg","image/gif"],H=P.filter(Q=>F.includes(Q.type)&&Q.size<=5242880);if(H.length!==P.length&&alert(i("inputs.common.invalidFiles")),H.length===0)return;const q=H.map(Q=>new Promise(Y=>{const pe=new FileReader;pe.onload=ie=>Y(ie.target?.result),pe.readAsDataURL(Q)}));Promise.all(q).then(Q=>{const Y={images:Q,id:n||""};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:Y})),Fd(!0,n||"")})},L=P=>{P.preventDefault(),a(!0)},I=P=>{const F=P.currentTarget.getBoundingClientRect(),U=P.clientX,H=P.clientY;(U<F.left||U>=F.right||H<F.top||H>=F.bottom)&&a(!1)},O=P=>{P.preventDefault(),a(!1);const F=Array.from(P.dataTransfer.files);F.length>0&&A(F)},M=()=>{const P=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(P)};return D.useEffect(()=>{const P=window.__emailBuilderEnableAI;P!==void 0&&o(!!P);const F=U=>{const{detail:H}=U;o(!!H)};return window.addEventListener("email-builder-ai-generation",F),()=>{window.removeEventListener("email-builder-ai-generation",F)}},[]),D.useEffect(()=>{const P=q=>{const{detail:Q}=q;Fd(!1,Q.id||""),T({...t,props:{...t.props,url:Q.url}}),sU(!1)},F=q=>{Fd(q?.detail?.uploading??!1,q?.detail?.id??"")},U=()=>{b?.current?.click()},H=q=>{const{detail:Q}=q;T({...t,props:{...t.props,url:Q}})};return window.addEventListener("email-builder-set-image",H),window.addEventListener("email-builder-upload-image-receive",P),window.addEventListener("email-builder-upload-file",U),window.addEventListener("email-builder-toggle-upload-file",F),()=>{window.removeEventListener("email-builder-toggle-upload-file",F),window.removeEventListener("email-builder-upload-image-receive",P),window.removeEventListener("email-builder-set-image",H),window.removeEventListener("email-builder-upload-file",U)}},[t]),D.useEffect(()=>{t.props?.url&&_(S(t.props.url))},[t.props?.url]),h.jsxs(_n,{gap:1,children:[E?h.jsx(We,{sx:{mb:2},children:E}):h.jsx("div",{style:{display:"flex",gap:8},children:y?h.jsxs(Ki,{children:[h.jsx($n,{label:i("inputs.image.urlLabel")}),h.jsxs(_n,{direction:"row",spacing:1,children:[h.jsx(jp,{fullWidth:!0,placeholder:i("inputs.image.urlPlaceholder"),value:c,onChange:w,onKeyPress:k,error:!!f,disabled:d,sx:{...$v,"& .MuiOutlinedInput-root":{"& fieldset":{borderColor:f?"error.main":"#E5E5E5"},"&:hover fieldset":{borderColor:f?"error.main":"primary.main"},"&.Mui-focused fieldset":{borderColor:f?"error.main":"primary.main"}}}}),h.jsx(qi,{variant:"contained",onClick:x,disabled:!c.trim()||d,sx:{minWidth:"auto",px:2,position:"relative"},children:d?h.jsx(Kl,{size:20,color:"inherit"}):i("inputs.common.add")})]}),f&&h.jsx($l,{severity:"error",sx:{mt:1,fontSize:"0.875rem","& .MuiAlert-message":{padding:"4px 0",display:"flex",flexDirection:"column",justifyContent:"space-around"}},children:f}),g&&h.jsx($l,{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(Wn,{"aria-label":i("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{_(!1)},children:h.jsx(Fv,{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(We,{onDragOver:L,onDragLeave:I,onDrop:O,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(We,{sx:{display:"flex",justifyContent:"center",mb:2},children:h.jsx(PU,{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:P=>{const F=P.target.files;F&&F.length>0&&A(Array.from(F))}}),h.jsx(gn,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:i("inputs.common.uploadFile")}),h.jsxs(gn,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",i("inputs.common.dragAndDrop")]})]}),h.jsx(gn,{variant:"body2",sx:{color:"text.secondary",mt:1},children:i("inputs.common.fileInfo")})]})]})}),!E&&!y&&g&&h.jsx($l,{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."}),(!E&&(Mb()&&!y||s)||E&&s)&&h.jsxs(_n,{direction:"row",alignItems:"center",spacing:1,children:[h.jsx(dr,{sx:{flexGrow:1}}),h.jsx(gn,{sx:{color:"text.secondary"},children:"or"}),h.jsx(dr,{sx:{flexGrow:1}})]}),h.jsx(h.Fragment,{children:h.jsxs(_n,{flexDirection:"row",gap:2,children:[!E&&Mb()&&!y&&h.jsx(qi,{variant:"outlined",onClick:M,startIcon:h.jsx(OU,{}),sx:{color:"mainColor.main",borderColor:"mainColor.light","&:hover":{borderColor:"mainColor.main",backgroundColor:"action.hover"}},style:{width:"100%"},children:"Browse gallery"}),s&&h.jsx(qU,{src:t.props?.url,style:{width:"100%",margin:0}})]})})]})},Qde=({defaultValue:t="original",scale:e=100,onChange:n})=>{const[i,r]=D.useState(t),[a,s]=D.useState(e);fi();const o=Xt(),{t:l}=nt.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}};D.useEffect(()=>{(t!==i||e!==a)&&(t!==i&&r(t),t==="scale"&&s(e))},[t,e]);const u=(p,f)=>{f!==null&&(r(f),n&&n({mode:f,scale:f==="scale"?a:void 0}))},d=p=>{s(p),n&&n({mode:i,scale:p})};return h.jsxs(Ki,{children:[h.jsx($n,{label:l("inputs.sizeSelector.label")}),h.jsxs(We,{sx:c.container,children:[h.jsxs(Hh,{value:i,exclusive:!0,onChange:u,sx:c.toggleGroup,children:[h.jsx(ln,{value:"original",sx:c.toggleButton,children:l("inputs.sizeSelector.contain")}),h.jsx(ln,{value:"fill",sx:c.toggleButton,children:l("inputs.sizeSelector.cover")}),h.jsx(ln,{value:"scale",sx:c.toggleButton,children:l("inputs.sizeSelector.scale")})]}),h.jsx(RD,{in:i==="scale",children:h.jsx(We,{sx:c.sliderContainer,children:h.jsx(di,{iconLabel:h.jsx(Lue,{}),value:a,setValue:d,marks:!1,units:"%",min:1,max:100})})})]})]})};function Xde({data:t,setData:e}){const[n,i]=D.useState(null),r=Yh(),a=Qo(),s=fi(),{t:o}=nt.useTranslation("inspector");Yde(r||"",e,t),D.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=D.useCallback(g=>{const _=bA.safeParse(g);_.success?JSON.stringify(t)!==JSON.stringify(_.data)&&(e(_.data),i(null)):i(_.error)},[t,e]),c=D.useCallback((g,_,b)=>{const y=Ade(r)||Ad,E={...g.props};if(b&&(E.touchedMobile=!0),_.mode==="original"){const v=g.props?.original_width??null;return b?{...E,sizeMobile:_.mode,widthMobile:v}:{...E,size:_.mode,width:v,sizeMobile:E.touchedMobile?E.sizeMobile:_.mode,widthMobile:E.touchedMobile?E.widthMobile:v}}if(_.mode==="fill")return b?{...E,sizeMobile:_.mode,widthMobile:null}:{...E,size:_.mode,width:null,sizeMobile:E.touchedMobile?E.sizeMobile:_.mode,widthMobile:E.touchedMobile?E.widthMobile:null};if(_.mode==="scale"){const v=Math.ceil(y/100*_.scale);return b?{...E,sizeMobile:_.mode,scaleMobile:_.scale,widthMobile:v}:{...E,size:_.mode,scale:_.scale,width:v,sizeMobile:E.touchedMobile?E.sizeMobile:_.mode,scaleMobile:E.touchedMobile?E.scaleMobile:_.scale,widthMobile:E.touchedMobile?E.widthMobile:v}}return E},[r]),u=D.useCallback((g,_)=>{const b=c(t,g,_);l({...t,props:b})},[t,l,c]),d=D.useMemo(()=>s!=="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},[s,t.props?.touchedMobile,t.props?.sizeMobile,t.props?.size,t.props?.scaleMobile,t.props?.scale]),p=D.useCallback(g=>{l({...t,props:{...t.props,alt:g}})},[t,l]),f=D.useCallback(g=>{const _=g.trim().length===0?null:g.trim();l({...t,props:{...t.props,linkHref:_}})},[t,l]),m=D.useCallback(g=>{l({...t,style:g})},[t,l]);return h.jsxs(gs,{title:o("inputs.panels.image.title"),children:[a==="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsx(Kde,{data:t,setData:e,blockId:r}),h.jsx(dp,{label:o("inputs.panels.image.altLabel"),placeholder:o("inputs.panels.image.altPlaceholder"),defaultValue:t.props?.alt??"",onChange:p}),h.jsx(dp,{label:o("inputs.panels.image.urlLabel"),placeholder:o("inputs.panels.image.urlPlaceholder"),defaultValue:t.props?.linkHref??"",onChange:f}),h.jsx(Qde,{defaultValue:d.size,scale:d.scale??void 0,onChange:g=>u(g,s!=="desktop")})]}),h.jsx(Nr,{names:["textAlign","textAlignMobile","backgroundColor","shape","padding","mobilePadding"],value:t.style,shapeMaxValue:300,shapeSteps:20,onChange:m})]})}const oM=rt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),lM=vt({top:Oe(),bottom:Oe(),right:Oe(),left:Oe()}).optional().nullable(),o8=vt({style:vt({color:oM,backgroundColor:oM,background:rt().nullable().optional(),fontSize:Oe().gte(0).optional().nullable(),fontFamily:Vp,fontWeight:Vn(["bold","normal"]).optional().nullable(),textAlign:Vn(["left","center","right"]).optional().nullable(),textAlignMobile:Vn(["left","center","right"]).optional().nullable(),padding:lM,mobilePadding:lM,optionSize:Vn(["small","medium","large"]).optional().nullable(),theme:Vn(["light","dark","colored"]).optional().nullable()}).passthrough().optional().nullable(),gap:Oe().optional(),items:Bd(vt({id:rt(),key:rt(),label:rt(),iconName:rt(),theme:rt(),size:rt(),sizePx:rt(),url:rt(),href:rt().optional().nullable()})),gapMobile:Oe().optional()}).passthrough();function l8({style:t,items:e,blockId:n,gap:i=1,gapMobile:r}){const a=fi(),s=t?.background??"",o=t?.backgroundColor,l=o?Iu(s,o):s,c=(a==="desktop"?t?.textAlign:t?.textAlignMobile??t?.textAlign)??void 0,u={background:l,backgroundColor:t?.backgroundColor,textAlign:c,padding:Yp(a==="desktop"?t?.padding:t?.mobilePadding??t?.padding)},d=a==="desktop"?i:r??i,p=Wt(n),m=!Pv();return h.jsx(Jde,{blockId:`${p}`,items:e,wStyle:u,gap:d,isEditorMode:m})}const Jde=({items:t,blockId:e,wStyle:n,gap:i,isEditorMode:r})=>{const a=s=>{switch(s){case 0:return"first";case t.length-1:return"last";default:return"inside"}};return h.jsx(Zr,{className:e,background:n.background,backgroundColor:n.backgroundColor,padding:n?.padding,align:n.textAlign,width:"100%",children:h.jsx("table",{style:{borderCollapse:"collapse",display:"inline-block",lineHeight:0,verticalAlign:"top"},border:0,cellSpacing:"0",cellPadding:"0",children:h.jsx("tbody",{children:h.jsx("tr",{style:{verticalAlign:"top"},children:t.map((s,o)=>{const l=a(o);return h.jsxs(D.Fragment,{children:[l!=="first"&&h.jsx("td",{className:`gap-${e}`,width:Math.ceil(i/2),style:{lineHeight:0,verticalAlign:"top"}}),h.jsx("td",{id:`${s.id}-${s.url}`,width:s.sizePx,style:{lineHeight:0,textAlign:"center",verticalAlign:"top",whiteSpace:"nowrap"},children:h.jsx("a",{target:"_blank",href:r?void 0:uA(s.href),onClick:r?c=>c.preventDefault():void 0,style:{display:"block",lineHeight:0,textDecoration:"none",pointerEvents:r?"none":void 0},children:h.jsx("img",{src:s.url,alt:s.key,style:{width:s.sizePx||36,height:s.sizePx||36,display:"block"}})},`item_${o}`)},`${s.id}-${s.url}`),l!=="last"&&h.jsx("td",{className:`gap-${e}`,width:Math.ceil(i/2),style:{lineHeight:0,verticalAlign:"top"}})]},s.id)})})})})})},Zde="https://maildrill-dev.s3.us-east-2.amazonaws.com/icons/",epe={positive:!0,original:!0,negative:!0},tpe={small:!0,medium:!0,large:!0,xlarge:!0},W={theme:"positive",size:"medium"},sn=(t,e,n="medium")=>{const i=yA.find(a=>a.key===n)?.value,r=c8.find(a=>a.key===e)?.value;return`${Zde}${t}_${r}_${i}.png`},vn=t=>yA.find(e=>e.key===t)?.value||"36px",yA=[{value:"24px",key:"small",label:"Small"},{value:"36px",key:"medium",label:"Medium"},{value:"48px",key:"large",label:"Large"}],c8=[{value:"Positive",key:"positive",label:"Light"},{value:"Original",key:"original",label:"Color"},{value:"Negative",key:"negative",label:"Dark"}],j_=[{key:"facebook",label:"Facebook",iconName:"Facebook",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Facebook",W.theme,W.size),href:"https://www.facebook.com/your-profile"},{key:"web",label:"Web",iconName:"Web",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Web",W.theme,W.size),href:"https://www.google.com"},{key:"mail",label:"Mail",iconName:"Mail",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Mail",W.theme,W.size),href:"https://mail.google.com/"},{key:"apple",label:"Apple",iconName:"Apple",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Apple",W.theme,W.size),href:"https://www.apple.com/"},{key:"bluesky",label:"Bluesky",iconName:"Bluesky",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Bluesky",W.theme,W.size),href:"https://bsky.app/"},{key:"clubhouse",label:"ClubHouse",iconName:"Clubhouse",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Clubhouse",W.theme,W.size),href:"https://www.clubhouse.com/"},{key:"dribbble",label:"Dribbble",iconName:"Dribbble",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Dribbble",W.theme,W.size),href:"https://dribbble.com/"},{key:"figma",label:"Figma",iconName:"Figma",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Figma",W.theme,W.size),href:"https://www.figma.com/"},{key:"github",label:"Github",iconName:"Github",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Github",W.theme,W.size),href:"https://github.com/"},{key:"google",label:"Google",iconName:"Google",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Google",W.theme,W.size),href:"https://google.com/"},{key:"instagram",label:"Instagram",iconName:"Instagram",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Instagram",W.theme,W.size),href:"https://www.instagram.com/your-profile"},{key:"linkedin",label:"LinkedIn",iconName:"LinkedIn",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("LinkedIn",W.theme,W.size),href:"https://www.linkedin.com/in/your-profile"},{key:"medium-social",label:"Medium",iconName:"Medium",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Medium",W.theme,W.size),href:"https://medium.com/"},{key:"messenger",label:"Messenger",iconName:"Messenger",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Messenger",W.theme,W.size),href:"https://www.messenger.com/"},{key:"pinterest",label:"Pinterest",iconName:"Pinterest",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Pinterest",W.theme,W.size),href:"https://www.pinterest.com/"},{key:"reddit",label:"Reddit",iconName:"Reddit",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Reddit",W.theme,W.size),href:"https://www.reddit.com/"},{key:"signal",label:"Signal",iconName:"Signal",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Signal",W.theme,W.size),href:"https://signal.org/"},{key:"snapchat",label:"Snapchat",iconName:"Snapchat",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Snapchat",W.theme,W.size),href:"https://www.snapchat.com/"},{key:"spotify",label:"Spotify",iconName:"Spotify",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Spotify",W.theme,W.size),href:"https://www.spotify.com/"},{key:"telegram",label:"Telegram",iconName:"Telegram",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Telegram",W.theme,W.size),href:"https://t.me/your-profile"},{key:"threads",label:"Threads",iconName:"Threads",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Threads",W.theme,W.size),href:"https://www.threads.net/"},{key:"tiktok",label:"TikTok",iconName:"TikTok",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("TikTok",W.theme,W.size),href:"https://www.tiktok.com/@your-profile"},{key:"tumblr",label:"Tumblr",iconName:"Tumblr",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Tumblr",W.theme,W.size),href:"https://www.tumblr.com/"},{key:"twitch",label:"Twitch",iconName:"Twitch",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Twitch",W.theme,W.size),href:"https://www.twitch.tv/"},{key:"vk",label:"VK",iconName:"VK",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("VK",W.theme,W.size),href:"https://vk.com/"},{key:"whatsapp",label:"WhatsApp",iconName:"WhatsApp",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("WhatsApp",W.theme,W.size),href:"https://www.whatsapp.com/"},{key:"x",label:"X",iconName:"X",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("X",W.theme,W.size),href:"https://x.com/your-profile"},{key:"youtube",label:"YouTube",iconName:"YouTube",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("YouTube",W.theme,W.size),href:"https://www.youtube.com/channel/your-channel-id"}];function Xf(){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 npe=({element:t,index:e,moveItem:n,onSelectChange:i,onUrlChange:r,onRemove:a,onDuplicate:s,canRemove:o,theme:l})=>{const c=D.useRef(null),[u,d]=D.useState(null),{t:p}=nt.useTranslation("inspector"),f=k=>{const w=k.getClientOffset(),A=c.current?.getBoundingClientRect();if(!w||!A)return null;const L=(A.bottom-A.top)/2;return w.y-A.top<L?"up":"down"},[{handlerId:m,isOver:g},_]=Yl.useDrop(()=>({accept:"social-media-item",collect(k){return{handlerId:k.getHandlerId(),isOver:k.isOver({shallow:!0})}},hover(k,w){if(!c.current)return;if(k.index===e){d(null);return}if(!w.isOver({shallow:!0})){d(null);return}const I=f(w);d(I)},drop(k,w){if(d(null),!c.current)return;const A=k.index,L=e;if(A===L)return;const I=f(w);let O=L;I==="down"&&(O=L+1),A<O&&(O=O-1),setTimeout(()=>{n(A,O)},0),k.index=O},end:()=>{d(null)}}),[t.id,e,n]),[{isDragging:b},y]=Yl.useDrag(()=>({type:"social-media-item",item:()=>({id:t.id,index:e}),collect:k=>({isDragging:k.isDragging()}),end:()=>{d(null)}}),[t.id,e]);D.useEffect(()=>{g||d(null)},[g]);const E=b?.4:1;D.useEffect(()=>{if(c.current&&y&&_){const k=c.current;y(k),_(k)}},[y,_]);const v=()=>{setTimeout(()=>a(e),0)},T=()=>{setTimeout(()=>s(e),0)},S=k=>{const w=k.target.value;setTimeout(()=>i(e,w,t),0)},C=k=>{const w=k.target.value;setTimeout(()=>r(e,w,t),0)},x=()=>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(x,{}),h.jsxs(_n,{ref:c,"data-handler-id":m,sx:{border:1,borderColor:"divider",padding:1,paddingTop:0,borderRadius:1,backgroundColor:"background.paper",marginBottom:1.5,opacity:E,cursor:b?"grabbing":"grab",boxShadow:b?l.shadows[3]:"none"},gap:1,children:[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(SU,{sx:{color:b?"primary.main":"text.secondary",cursor:"grab",marginLeft:-.9,"&:hover":{color:"primary.main"}}})}),h.jsxs("div",{children:[h.jsx(Nn,{disableInteractive:!0,arrow:!0,title:"Duplicate",placement:"left",children:h.jsx(Wn,{color:"primary",size:"small",onClick:T,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(Nn,{disableInteractive:!0,arrow:!0,title:"Remove",placement:"left",children:h.jsx(Wn,{color:"error",size:"small",onClick:v,children:h.jsx(sue,{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($n,{label:p("inputs.social.icon")}),h.jsx(Jl,{fullWidth:!0,labelId:"demo-simple-select-label",id:"demo-simple-select",value:t.key,size:"small",onChange:S,children:j_.map(k=>h.jsx(Xa,{value:k.key,children:k.label},`${t.id}_${k.key}`))})]}),h.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[h.jsx($n,{label:p("inputs.social.url")}),h.jsx(jp,{size:"small",fullWidth:!0,value:t.href??"",onChange:C,variant:"outlined",placeholder:"https://your-website.com",sx:$v})]})]})]}),u==="down"&&h.jsx(x,{})]})};function ipe({items:t=[],onChange:e}){const{t:n}=nt.useTranslation("inspector"),i=Xt(),[r,a]=D.useState(()=>t.map(_=>({..._,id:_.id||Xf()}))),[s,o]=D.useState(t[0]?.theme||"positive"),[l,c]=D.useState(t[0]?.size||"medium");D.useEffect(()=>{t.length>0&&(o(t[0].theme),c(t[0].size),a(t.map(_=>({..._,id:_.id||Xf()}))))},[t]);const u=(_,b)=>{a(y=>{const E=[...y],[v]=E.splice(_,1);return E.splice(b,0,v),e&&setTimeout(()=>e(E),0),E})},d=()=>{a(_=>{const b={...j_[0],theme:s,size:l,sizePx:vn(l),url:sn(j_[0].iconName,s,l),id:Xf()},y=[..._,b];return e&&setTimeout(()=>e(y),0),y})},p=_=>{a(b=>{const y=b.filter((E,v)=>v!==_);return e&&setTimeout(()=>e(y),0),y})},f=(_,b,y)=>{let E=[...r];if(b in epe?(o(b),E=E.map(v=>{const T=sn(v.iconName,b,v.size);return{...v,theme:b,url:T}})):b in tpe&&(c(b),E=E.map(v=>{const T=sn(v.iconName,v.theme,b),S=vn(b);return{...v,size:b,sizePx:S,url:T}})),_!==null&&y){const v=j_.find(T=>T.key===b);v&&(E=E.map((T,S)=>{const C={key:v.key,label:v.label,iconName:v.iconName,href:v.href},x=sn(C.iconName,y.theme,y.size);return S===_?{...T,...C,url:x,id:y.id}:T}))}a(E),e&&setTimeout(()=>e(E),0)},m=(_,b,y)=>{const E=r.map((v,T)=>T===_?{...y,href:b}:v);a(E),e&&setTimeout(()=>e(E),0)},g=_=>{a(b=>{const y={...JSON.parse(JSON.stringify(b[_])),id:Xf()},E=[...b.slice(0,_+1),y,...b.slice(_+1)];return e&&setTimeout(()=>e(E),0),E})};return h.jsxs(h.Fragment,{children:[h.jsxs("div",{style:{marginBottom:"1rem",display:"grid",gridTemplateColumns:"repeat(2,1fr)",gap:"1rem"},children:[h.jsxs(Ki,{children:[h.jsx($n,{label:n("inputs.social.theme")}),h.jsx(Jl,{fullWidth:!0,labelId:"theme-selector",id:"theme-selector",value:s,size:"small",onChange:_=>f(null,_.target.value,null),children:c8.map(_=>h.jsx(Xa,{value:_.key,children:_.label},`${_.key}`))})]}),h.jsxs(Ki,{children:[h.jsx($n,{label:n("inputs.social.size")}),h.jsx(Jl,{fullWidth:!0,labelId:"size-selector",id:"size-selector",value:l,size:"small",onChange:_=>f(null,_.target.value,null),children:yA.map(_=>h.jsx(Xa,{value:_.key,children:_.label},`${_.key}`))})]})]}),r?.map((_,b)=>h.jsx(npe,{element:_,index:b,moveItem:u,onSelectChange:f,onUrlChange:m,onRemove:p,onDuplicate:g,canRemove:r.length>1,theme:i},_.id)),h.jsx(qi,{onClick:d,sx:{borderRadius:1},variant:"contained",endIcon:h.jsx(qce,{}),children:"Add"})]})}const rpe=({data:t,setData:e})=>{const[,n]=D.useState(null),i=fi(),{t:r}=nt.useTranslation("inspector"),a=u=>{const d=o8.safeParse(u);d.success?(e(d.data),n(null)):n(d.error)},s=u=>{a({...t,items:u})},o=u=>{a({...t,style:u})},l=(u,d=!1)=>{if(d){a({...t,gapMobile:u});return}a({...t,gap:u})},c=Qo();return h.jsxs(gs,{title:r("inputs.panels.social.title"),children:[c=="block-configuration"&&h.jsx(We,{sx:{minWidth:120,margin:1},children:h.jsx(ipe,{items:t?.items??[],onChange:s})}),c=="css"&&h.jsxs(h.Fragment,{children:[h.jsxs(Ki,{children:[h.jsx($n,{label:r("inputs.panels.social.gap")}),i=="desktop"?h.jsx(di,{iconLabel:h.jsx($O,{sx:{color:"text.primary"}}),value:Number(t?.gap??4),setValue:u=>l(u,!1),marks:!0,step:4,units:"px",min:0,max:40}):h.jsx(di,{iconLabel:h.jsx($O,{sx:{color:"text.primary"}}),value:Number(t?.gapMobile??t?.gap??4),setValue:u=>l(u,!0),marks:!0,step:4,units:"px",min:0,max:40})]}),h.jsx(Nr,{names:["textAlign","textAlignMobile","backgroundColor","padding","mobilePadding"],value:t.style,onChange:u=>o(u)})]})]})},ape=rt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),u8=vt({style:vt({height:Oe().optional().nullable(),heightMobile:Oe().optional().nullable(),background:rt().nullable().optional(),backgroundColor:ape}).optional().nullable()}),cM={height:16};function d8({style:t,blockId:e}){const i=fi()==="desktop"?t?.height??cM.height:t?.heightMobile??t?.height??cM.height,r=t?.background??"",a=t?.backgroundColor??"",s=a?Iu(r,a):r,o={width:"100%",minWidth:"100%",backgroundColor:a||void 0,background:s||void 0},l=Wt(e);return h.jsx("table",{className:l,width:"100%",style:o,children:h.jsx("tbody",{children:h.jsx("tr",{className:`it${l}`,style:{height:i},children:h.jsx("td",{})})})})}function p8({data:t,setData:e}){const[,n]=D.useState(null),{t:i}=nt.useTranslation("inspector"),r=a=>{const s=u8.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return h.jsx(gs,{title:i("inputs.panels.spacer.title"),children:h.jsx(Nr,{names:["height","heightMobile","backgroundColor"],value:t.style,onChange:a=>r({...t,style:a})})})}function spe({data:t,setData:e}){const n=Qo(),{t:i}=nt.useTranslation("inspector"),r=t.style||{},a=s=>{const o={...r||{},...s||{}};e({...t,style:o})};return h.jsxs(gs,{title:i("inputs.panels.notionText.title","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(Nr,{disabledCSSValidation:!0,names:["fontFamily"],value:r,onChange:a})}),h.jsx("div",{style:{flex:1},children:h.jsx(Nr,{disabledCSSValidation:!0,names:["lineHeight"],value:r,onChange:a})})]}),h.jsx(Nr,{disabledCSSValidation:!0,names:["fontSize","fontSizeMobile"],value:r,onChange:a})]}),n==="css"&&h.jsx(Nr,{names:["backgroundColor","border","borderMobile","padding","mobilePadding"],value:r,onChange:a})]})}function uM(t){return h.jsx(We,{sx:{m:3,p:1,border:"1px dashed",borderColor:"divider"},children:h.jsx(gn,{color:"text.secondary",children:t})})}function ope(){const t=Yh(),e=rU(t||""),n=D.useCallback(a=>{t&&Pb(t,()=>a)},[t]);if(!t)return uM("Click on a block to inspect.");if(!e)return uM(`Block with id ${t} was not found. Click on a block to reset.`);const{data:i,type:r}=e;switch(r){case"Button":return h.jsx(Tde,{data:i,setData:a=>n({type:r,data:a})},t);case"ColumnsContainer":return h.jsx(Ode,{data:i,setData:a=>n({type:r,data:a})},t);case"Container":return h.jsx(QU,{data:i,setData:a=>n({type:r,data:a})},t);case"Divider":return h.jsx(ZU,{data:i,setData:a=>n({type:r,data:a})},t);case"Heading":return h.jsx(Hde,{data:i,setData:a=>n({type:r,data:a})},t);case"Html":return h.jsx(Vde,{data:i,setData:a=>n({type:r,data:a})},t);case"Image":return h.jsx(Xde,{data:i,setData:a=>n({type:r,data:a})},t);case"EmailLayout":return h.jsx(t8,{data:i,setData:a=>n({type:r,data:a})},t);case"Spacer":return h.jsx(p8,{data:i,setData:a=>n({type:r,data:a})},t);case"NotionText":return h.jsx(spe,{data:i,setData:a=>n({type:r,data:a})},t);case"SocialMedia":return h.jsx(rpe,{data:i,setData:a=>n({type:r,data:a})},t);default:return h.jsx("pre",{children:JSON.stringify(e,null," ")})}}const lpe=D.memo(ope),cpe={EmailLayout:{label:"Email",iconName:"DashboardOutlined"},NotionText:{label:"Text",iconName:"ArticleOutlined"},SocialMedia:{label:"Social",iconName:"Groups2"},Button:{label:"Button",iconName:"SmartButtonOutlined"},Image:{label:"Image",iconName:"ImageOutlined"},Divider:{label:"Divider",iconName:"HorizontalRuleOutlined"},Spacer:{label:"Spacer",iconName:"Crop32Outlined"},ColumnsContainer:{label:"Columns",iconName:"ViewColumnOutlined"},Container:{label:"Container",iconName:"LibraryAddOutlined"},Heading:{label:"Heading",iconName:"Title"},Html:{label:"HTML",iconName:"CodeOutlined"}},upe=t=>e=>e.document[t];function dpe(t){if(!t)return[];switch(t.type){case"EmailLayout":return t.data?.childrenIds||[];case"Container":return t.data?.props?.childrenIds||[];case"ColumnsContainer":return t.data?.props?.columns?.flatMap(e=>e.childrenIds||[])||[];default:return[]}}function f8(t,e,n){const i=dpe(t[e]);for(const r of i)if(r===n||f8(t,r,n))return!0;return!1}function ppe(t,e,n,i){if(!i)return!1;const r=t[e];if(!r||r.type!=="ColumnsContainer")return!1;const a=r.data?.props?.columns?.[n]?.childrenIds||[];for(const s of a)if(s===i||f8(t,s,i))return!0;return!1}function fpe(t){const e=t.document;if(!e||!e.root)return null;function n(r,a){const s=a.document[r];if(!s)return[];switch(s.type){case"EmailLayout":return s.data?.childrenIds||[];case"Container":return s.data?.props?.childrenIds||[];case"ColumnsContainer":return s.data?.props?.columns?.flatMap(o=>o.childrenIds||[])||[];default:return[]}}function i(r,a,s){const o=s.document[r],l=o?.type??"Unknown",c=cpe[l]??{label:l,iconName:"WidgetsOutlined"};if(l==="ColumnsContainer"){const p=o.data?.props?.columns,m=o.data?.props?.columnsCount===2?2:3,g=[];for(let _=0;_<m;_++){const b=p?.[_]?.childrenIds??[],y=Ple(r,_);g.push({blockId:y,type:"ColumnSlot",label:"",iconName:"WidgetsOutlined",children:b.map(E=>i(E,a+2,s)),depth:a+1,columnSlot:{parentBlockId:r,columnIndex:_,columnsCount:m}})}return{blockId:r,type:l,label:c.label,iconName:c.iconName,children:g,depth:a}}const d=n(r,s).map(p=>i(p,a+1,s));return{blockId:r,type:l,label:c.label,iconName:c.iconName,children:d,depth:a}}return i("root",0,t)}function mpe(t){return ce(t)}function hpe(t){return ce(upe(t))}function gpe(){const t=Yh(),e=hpe(t??"root"),n=D.useCallback(s=>{t&&Pb(t,()=>s)},[t]),i=D.useCallback(s=>{Pb("root",()=>s)},[]);if(!e)return null;const{data:r,type:a}=e;switch(a){case"Container":return h.jsx(QU,{data:r,setData:s=>n({type:a,data:s})},t);case"Divider":return h.jsx(ZU,{data:r,setData:s=>n({type:a,data:s})},t);case"Spacer":return h.jsx(p8,{data:r,setData:s=>n({type:a,data:s})},t);case"EmailLayout":return h.jsx(t8,{data:r,setData:s=>i({type:a,data:s})},"root");default:return h.jsx("pre",{children:JSON.stringify(e,null," ")})}}function _pe({sticky:t,heightContent:e}){const n=Qo(),i=iU(),r=Yh(),a=fi(),s=Xt(),{t:o}=nt.useTranslation("inspector"),l=()=>{const f={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(Eb,{color:"primary",sx:f,label:`${o(a==="desktop"?"header.desktop":"header.mobile")}`}),h.jsx(lpe,{})]});case"styles":return h.jsxs("div",{style:{position:"relative"},children:[h.jsx(gpe,{}),h.jsx(Eb,{color:"primary",sx:f,label:`${o(a==="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"})});D.useEffect(()=>{const f=m=>{const g=m.target;bO(g.innerWidth)};return window&&bO(window.innerWidth),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[n]);const d=(f,m)=>{Wle(m)},p=t?e?`calc(${e} - ${dl})`:void 0:e??void 0;return h.jsxs(rh,{sx:f=>({width:Rb,padding:"0!important",margin:"0!important",height:p,maxHeight:p,display:"flex",flexDirection:"column",overflow:"hidden",position:t?"sticky":"static",top:t?dl:0,backgroundColor:`${f.palette.background.paper} !important`}),children:[h.jsx(We,{sx:{position:"sticky",top:0,zIndex:1,backgroundColor:`${s.palette.background.paper} !important`},children:h.jsxs(F$,{sx:{backgroundColor:`${s.palette.background.paper} !important`},value:n,onChange:d,children:[r!=null&&!xb.includes(i||"")&&[h.jsx(Gc,{sx:{height:dl,minHeight:dl,fontWeight:"bold"},value:"block-configuration",label:o("header.content"),icon:h.jsx(c,{}),iconPosition:"start"},"block-configuration"),h.jsx(Gc,{sx:{height:dl,minHeight:dl,fontWeight:"bold"},value:"css",label:o("header.styles"),icon:h.jsx(u,{}),iconPosition:"start"},"css")],xb.includes(i)&&[h.jsx(Gc,{sx:{height:dl,minHeight:dl,fontWeight:"bold"},value:"styles",label:o("header.styles"),icon:h.jsx(u,{}),iconPosition:"start"},"styles")]]})}),h.jsx(rh,{sx:f=>({flex:"1 1 auto",minHeight:0,overflowY:"auto",px:2,backgroundColor:`${f.palette.background.paper} !important`}),children:l()})]})}const m8=({children:t,topOffset:e=0,zIndex:n=10,className:i="",style:r={},disabled:a=!1,threshold:s=null,...o})=>{const[l,c]=D.useState(!1),[u,d]=D.useState({width:0,height:0}),[p,f]=D.useState({left:0}),[m,g]=D.useState(0),[_,b]=D.useState(!1),y=D.useRef(null),E=D.useRef(null),v=D.useRef(null);D.useEffect(()=>{if(a){c(!1),b(!1),g(0);return}const C=E.current,x=y.current;if(!C||!x)return;let k=null;s&&(s.startsWith("#")?k=document.getElementById(s.slice(1)):(s.startsWith("."),k=document.querySelector(s)));const w=()=>{const M=x.getBoundingClientRect();d({width:M.width,height:M.height}),f({left:M.left})},A=()=>{if(!k||!x)return{offset:0,isPushed:!1};const M=k.getBoundingClientRect(),P=x.getBoundingClientRect(),F=e+P.height;if(M.top<F){const U=F-M.top,H=P.height+20;return{offset:-Math.min(U,H),isPushed:!0}}return{offset:0,isPushed:!1}},L=new IntersectionObserver(([M])=>{const P=!M.isIntersecting;if(P&&!l&&w(),c(P),P&&s){const{offset:F,isPushed:U}=A();g(F),b(U)}else P||(g(0),b(!1))},{threshold:0,rootMargin:`-${e}px 0px 0px 0px`}),I=new ResizeObserver(()=>{w()}),O=()=>{if(s&&l){const{offset:M,isPushed:P}=A();g(M),b(P)}};return L.observe(C),I.observe(x),s&&window.addEventListener("scroll",O,{passive:!0}),w(),()=>{L.disconnect(),I.disconnect(),s&&window.removeEventListener("scroll",O)}},[e,l,a,s]);const T=!a&&l,S=T?`${e+m}px`:"auto";return h.jsxs("div",{ref:v,className:i,...o,children:[!a&&h.jsx("div",{ref:E,style:{height:"1px",position:"absolute",top:`-${e+1}px`,left:0,right:0,pointerEvents:"none"}}),T&&h.jsx("div",{style:{height:`${u.height}px`,width:`${u.width}px`}}),h.jsx("div",{ref:y,style:{position:T?"fixed":"static",top:S,width:"auto",height:"auto",zIndex:T?n:"auto",transition:_?"none":"box-shadow 0.2s ease-in-out, top 0.3s ease-out",..._&&m<-u.height*.3&&{opacity:Math.max(0,1+(m+u.height*.3)/(u.height*.7))},...r},children:t})]})};var h8=z$();function Ui(t){this.content=t}Ui.prototype={constructor:Ui,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var i=n&&n!=t?this.remove(n):this,r=i.find(t),a=i.content.slice();return r==-1?a.push(n||t,e):(a[r+1]=e,n&&(a[r]=n)),new Ui(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Ui(n)},addToStart:function(t,e){return new Ui([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ui(n)},addBefore:function(t,e,n){var i=this.remove(e),r=i.content.slice(),a=i.find(t);return r.splice(a==-1?r.length:a,0,e,n),new Ui(r)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Ui.from(t),t.size?new Ui(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ui.from(t),t.size?new Ui(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ui.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Ui.from=function(t){if(t instanceof Ui)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ui(e)};function g8(t,e,n){for(let i=0;;i++){if(i==t.childCount||i==e.childCount)return t.childCount==e.childCount?null:n;let r=t.child(i),a=e.child(i);if(r==a){n+=r.nodeSize;continue}if(!r.sameMarkup(a))return n;if(r.isText&&r.text!=a.text){for(let s=0;r.text[s]==a.text[s];s++)n++;return n}if(r.content.size||a.content.size){let s=g8(r.content,a.content,n+1);if(s!=null)return s}n+=r.nodeSize}}function _8(t,e,n,i){for(let r=t.childCount,a=e.childCount;;){if(r==0||a==0)return r==a?null:{a:n,b:i};let s=t.child(--r),o=e.child(--a),l=s.nodeSize;if(s==o){n-=l,i-=l;continue}if(!s.sameMarkup(o))return{a:n,b:i};if(s.isText&&s.text!=o.text){let c=0,u=Math.min(s.text.length,o.text.length);for(;c<u&&s.text[s.text.length-c-1]==o.text[o.text.length-c-1];)c++,n--,i--;return{a:n,b:i}}if(s.content.size||o.content.size){let c=_8(s.content,o.content,n-1,i-1);if(c)return c}n-=l,i-=l}}class ue{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let i=0;i<e.length;i++)this.size+=e[i].nodeSize}nodesBetween(e,n,i,r=0,a){for(let s=0,o=0;o<n;s++){let l=this.content[s],c=o+l.nodeSize;if(c>e&&i(l,r+o,a||null,s)!==!1&&l.content.size){let u=o+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),i,r+u)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,i,r){let a="",s=!0;return this.nodesBetween(e,n,(o,l)=>{let c=o.isText?o.text.slice(Math.max(e,l)-l,n-l):o.isLeaf?r?typeof r=="function"?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&i&&(s?s=!1:a+=i),a+=c},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,i=e.firstChild,r=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(i)&&(r[r.length-1]=n.withText(n.text+i.text),a=1);a<e.content.length;a++)r.push(e.content[a]);return new ue(r,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let i=[],r=0;if(n>e)for(let a=0,s=0;s<n;a++){let o=this.content[a],l=s+o.nodeSize;l>e&&((s<e||l>n)&&(o.isText?o=o.cut(Math.max(0,e-s),Math.min(o.text.length,n-s)):o=o.cut(Math.max(0,e-s-1),Math.min(o.content.size,n-s-1))),i.push(o),r+=o.nodeSize),s=l}return new ue(i,r)}cutByIndex(e,n){return e==n?ue.empty:e==0&&n==this.content.length?this:new ue(this.content.slice(e,n))}replaceChild(e,n){let i=this.content[e];if(i==n)return this;let r=this.content.slice(),a=this.size+n.nodeSize-i.nodeSize;return r[e]=n,new ue(r,a)}addToStart(e){return new ue([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ue(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,i=0;n<this.content.length;n++){let r=this.content[n];e(r,i,n),i+=r.nodeSize}}findDiffStart(e,n=0){return g8(this,e,n)}findDiffEnd(e,n=this.size,i=e.size){return _8(this,e,n,i)}findIndex(e){if(e==0)return Vg(0,e);if(e==this.size)return Vg(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,i=0;;n++){let r=this.child(n),a=i+r.nodeSize;if(a>=e)return a==e?Vg(n+1,a):Vg(n,i);i=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return ue.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ue(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ue.empty;let n,i=0;for(let r=0;r<e.length;r++){let a=e[r];i+=a.nodeSize,r&&a.isText&&e[r-1].sameMarkup(a)?(n||(n=e.slice(0,r)),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new ue(n||e,i)}static from(e){if(!e)return ue.empty;if(e instanceof ue)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ue([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ue.empty=new ue([],0);const AS={index:0,offset:0};function Vg(t,e){return AS.index=t,AS.offset=e,AS}function Yb(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!Yb(t[i],e[i]))return!1}else{for(let i in t)if(!(i in e)||!Yb(t[i],e[i]))return!1;for(let i in e)if(!(i in t))return!1}return!0}let On=class Ak{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,i=!1;for(let r=0;r<e.length;r++){let a=e[r];if(this.eq(a))return e;if(this.type.excludes(a.type))n||(n=e.slice(0,r));else{if(a.type.excludes(this.type))return e;!i&&a.type.rank>this.type.rank&&(n||(n=e.slice(0,r)),n.push(this),i=!0),n&&n.push(a)}}return n||(n=e.slice()),i||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Yb(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let i=e.marks[n.type];if(!i)throw new RangeError(`There is no mark type ${n.type} in this schema`);let r=i.create(n.attrs);return i.checkAttrs(r.attrs),r}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let i=0;i<e.length;i++)if(!e[i].eq(n[i]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ak.none;if(e instanceof Ak)return[e];let n=e.slice();return n.sort((i,r)=>i.type.rank-r.type.rank),n}};On.none=[];class Kb extends Error{}class Fe{constructor(e,n,i){this.content=e,this.openStart=n,this.openEnd=i}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let i=y8(this.content,e+this.openStart,n);return i&&new Fe(i,this.openStart,this.openEnd)}removeBetween(e,n){return new Fe(b8(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Fe.empty;let i=n.openStart||0,r=n.openEnd||0;if(typeof i!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Fe(ue.fromJSON(e,n.content),i,r)}static maxOpen(e,n=!0){let i=0,r=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)i++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)r++;return new Fe(e,i,r)}}Fe.empty=new Fe(ue.empty,0,0);function b8(t,e,n){let{index:i,offset:r}=t.findIndex(e),a=t.maybeChild(i),{index:s,offset:o}=t.findIndex(n);if(r==e||a.isText){if(o!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(i!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(i,a.copy(b8(a.content,e-r-1,n-r-1)))}function y8(t,e,n,i){let{index:r,offset:a}=t.findIndex(e),s=t.maybeChild(r);if(a==e||s.isText)return i&&!i.canReplace(r,r,n)?null:t.cut(0,e).append(n).append(t.cut(e));let o=y8(s.content,e-a-1,n,s);return o&&t.replaceChild(r,s.copy(o))}function bpe(t,e,n){if(n.openStart>t.depth)throw new Kb("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Kb("Inconsistent open depths");return v8(t,e,n,0)}function v8(t,e,n,i){let r=t.index(i),a=t.node(i);if(r==e.index(i)&&i<t.depth-n.openStart){let s=v8(t,e,n,i+1);return a.copy(a.content.replaceChild(r,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==i&&e.depth==i){let s=t.parent,o=s.content;return tu(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=ype(n,t);return tu(a,S8(t,s,o,e,i))}else return tu(a,Qb(t,e,i))}function E8(t,e){if(!e.type.compatibleContent(t.type))throw new Kb("Cannot join "+e.type.name+" onto "+t.type.name)}function Nk(t,e,n){let i=t.node(n);return E8(i,e.node(n)),i}function eu(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function km(t,e,n,i){let r=(e||t).node(n),a=0,s=e?e.index(n):r.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(eu(t.nodeAfter,i),a++));for(let o=a;o<s;o++)eu(r.child(o),i);e&&e.depth==n&&e.textOffset&&eu(e.nodeBefore,i)}function tu(t,e){return t.type.checkContent(e),t.copy(e)}function S8(t,e,n,i,r){let a=t.depth>r&&Nk(t,e,r+1),s=i.depth>r&&Nk(n,i,r+1),o=[];return km(null,t,r,o),a&&s&&e.index(r)==n.index(r)?(E8(a,s),eu(tu(a,S8(t,e,n,i,r+1)),o)):(a&&eu(tu(a,Qb(t,e,r+1)),o),km(e,n,r,o),s&&eu(tu(s,Qb(n,i,r+1)),o)),km(i,null,r,o),new ue(o)}function Qb(t,e,n){let i=[];if(km(null,t,n,i),t.depth>n){let r=Nk(t,e,n+1);eu(tu(r,Qb(t,e,n+1)),i)}return km(e,null,n,i),new ue(i)}function ype(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)r=e.node(a).copy(ue.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class uh{constructor(e,n,i){this.pos=e,this.path=n,this.parentOffset=i,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let i=this.pos-this.path[this.path.length-1],r=e.child(n);return i?e.child(n).cut(i):r}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let i=this.path[n*3],r=n==0?0:this.path[n*3-1]+1;for(let a=0;a<e;a++)r+=i.child(a).nodeSize;return r}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return On.none;if(this.textOffset)return e.child(n).marks;let i=e.maybeChild(n-1),r=e.maybeChild(n);if(!i){let o=i;i=r,r=o}let a=i.marks;for(var s=0;s<a.length;s++)a[s].type.spec.inclusive===!1&&(!r||!a[s].isInSet(r.marks))&&(a=a[s--].removeFromSet(a));return a}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let i=n.marks,r=e.parent.maybeChild(e.index());for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let i=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);i>=0;i--)if(e.pos<=this.end(i)&&(!n||n(this.node(i))))return new Xb(this,e,i);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let i=[],r=0,a=n;for(let s=e;;){let{index:o,offset:l}=s.content.findIndex(a),c=a-l;if(i.push(s,o,r+l),!c||(s=s.child(o),s.isText))break;a=c-1,r+=l+1}return new uh(n,i,a)}static resolveCached(e,n){let i=dM.get(e);if(i)for(let a=0;a<i.elts.length;a++){let s=i.elts[a];if(s.pos==n)return s}else dM.set(e,i=new vpe);let r=i.elts[i.i]=uh.resolve(e,n);return i.i=(i.i+1)%Epe,r}}class vpe{constructor(){this.elts=[],this.i=0}}const Epe=12,dM=new WeakMap;class Xb{constructor(e,n,i){this.$from=e,this.$to=n,this.depth=i}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Spe=Object.create(null);let Ul=class Rk{constructor(e,n,i,r=On.none){this.type=e,this.attrs=n,this.marks=r,this.content=i||ue.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,i,r=0){this.content.nodesBetween(e,n,i,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,i,r){return this.content.textBetween(e,n,i,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,i){return this.type==e&&Yb(this.attrs,n||e.defaultAttrs||Spe)&&On.sameSet(this.marks,i||On.none)}copy(e=null){return e==this.content?this:new Rk(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Rk(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,i=!1){if(e==n)return Fe.empty;let r=this.resolve(e),a=this.resolve(n),s=i?0:r.sharedDepth(n),o=r.start(s),c=r.node(s).content.cut(r.pos-o,a.pos-o);return new Fe(c,r.depth-s,a.depth-s)}replace(e,n,i){return bpe(this.resolve(e),this.resolve(n),i)}nodeAt(e){for(let n=this;;){let{index:i,offset:r}=n.content.findIndex(e);if(n=n.maybeChild(i),!n)return null;if(r==e||n.isText)return n;e-=r+1}}childAfter(e){let{index:n,offset:i}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:i}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:i}=this.content.findIndex(e);if(i<e)return{node:this.content.child(n),index:n,offset:i};let r=this.content.child(n-1);return{node:r,index:n-1,offset:i-r.nodeSize}}resolve(e){return uh.resolveCached(this,e)}resolveNoCache(e){return uh.resolve(this,e)}rangeHasMark(e,n,i){let r=!1;return n>e&&this.nodesBetween(e,n,a=>(i.isInSet(a.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),C8(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,i=ue.empty,r=0,a=i.childCount){let s=this.contentMatchAt(e).matchFragment(i,r,a),o=s&&s.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let l=r;l<a;l++)if(!this.type.allowsMarks(i.child(l).marks))return!1;return!0}canReplaceWith(e,n,i,r){if(r&&!this.type.allowsMarks(r))return!1;let a=this.contentMatchAt(e).matchType(i),s=a&&a.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=On.none;for(let n=0;n<this.marks.length;n++){let i=this.marks[n];i.type.checkAttrs(i.attrs),e=i.addToSet(e)}if(!On.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let i;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");i=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,i)}let r=ue.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,r,i);return a.type.checkAttrs(a.attrs),a}};Ul.prototype.text=void 0;class Jb extends Ul{constructor(e,n,i,r){if(super(e,n,null,r),!i)throw new RangeError("Empty text nodes are not allowed");this.text=i}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):C8(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Jb(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Jb(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function C8(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class _u{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let i=new Cpe(e,n);if(i.next==null)return _u.empty;let r=T8(i);i.next&&i.err("Unexpected trailing text");let a=Npe(Ape(r));return Rpe(a,i),a}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,i=e.childCount){let r=this;for(let a=n;r&&a<i;a++)r=r.matchType(e.child(a).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let i=0;i<e.next.length;i++)if(this.next[n].type==e.next[i].type)return!0;return!1}fillBefore(e,n=!1,i=0){let r=[this];function a(s,o){let l=s.matchFragment(e,i);if(l&&(!n||l.validEnd))return ue.from(o.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&r.indexOf(d)==-1){r.push(d);let p=a(d,o.concat(u));if(p)return p}}return null}return a(this,[])}findWrapping(e){for(let i=0;i<this.wrapCache.length;i+=2)if(this.wrapCache[i]==e)return this.wrapCache[i+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),i=[{match:this,type:null,via:null}];for(;i.length;){let r=i.shift(),a=r.match;if(a.matchType(e)){let s=[];for(let o=r;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<a.next.length;s++){let{type:o,next:l}=a.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!r.type||l.validEnd)&&(i.push({match:o.contentMatch,type:o,via:r}),n[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(i){e.push(i);for(let r=0;r<i.next.length;r++)e.indexOf(i.next[r].next)==-1&&n(i.next[r].next)}return n(this),e.map((i,r)=>{let a=r+(i.validEnd?"*":" ")+" ";for(let s=0;s<i.next.length;s++)a+=(s?", ":"")+i.next[s].type.name+"->"+e.indexOf(i.next[s].next);return a}).join(`
|
|
147
|
+
Please report this to https://github.com/markedjs/marked.`,e){const r="<p>An error occurred:</p><pre>"+Yr(i.message+"",!0)+"</pre>";return n?Promise.resolve(r):r}if(n)return Promise.reject(i);throw i}};const du=new Rle;function xn(t,e){return du.parse(t,e)}xn.options=xn.setOptions=function(t){return du.setOptions(t),xn.defaults=du.defaults,q$(xn.defaults),xn};xn.getDefaults=QD;xn.defaults=Nu;xn.use=function(...t){return du.use(...t),xn.defaults=du.defaults,q$(xn.defaults),xn};xn.walkTokens=function(t,e){return du.walkTokens(t,e)};xn.parseInline=du.parseInline;xn.Parser=Ls;xn.parser=Ls.parse;xn.Renderer=Nb;xn.TextRenderer=nA;xn.Lexer=Ps;xn.lexer=Ps.lex;xn.Tokenizer=Db;xn.Hooks=Sm;xn.parse=xn;xn.options;xn.setOptions;xn.use;xn.walkTokens;xn.parseInline;Ls.parse;Ps.lex;function Ile(t){return String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ole(t){const e=String(t?.text??"");if(t?.markdown===!0){const n=xn.parse(e,{async:!1});return typeof n=="string"?n:String(n)}return`<p>${Ile(e)}</p>`}function Mle(t){const e=t.data??{},n=e.style??{},i=e.props??{},r=typeof i.size=="number"&&i.size>0?i.size:64,a=i.shape??"square";let s="rectangle";if(a==="circle")s="pill";else if(a==="rounded"){const o=r*.125;s={topLeft:o,topRight:o,bottomLeft:o,bottomRight:o}}return{...t,type:"Image",data:{style:{padding:n.padding??{top:0,bottom:0,left:0,right:0},mobilePadding:n.mobilePadding??null,backgroundColor:n.backgroundColor??null,textAlign:n.textAlign??null,textAlignMobile:n.textAlignMobile??null,shape:s},props:{url:i.imageUrl??"",alt:i.alt??null,width:r,height:r,contentAlignment:"middle",linkHref:null}}}}function Ld(t){const e={...t};for(const[n,i]of Object.entries(e)){const r=i.type;if(r==="CustomEditor"||r==="Wysiwyg")e[n]={...i,type:"NotionText"};else if(r==="Text"){const a=i.data??{},s=a.props??{},o=Ole(s);e[n]={...i,type:"NotionText",data:{...a,props:{html:o}}}}else r==="Avatar"&&(e[n]=Mle(i))}return e}const pk="eb-component-tree-column:";function Ple(t,e){return`${pk}${t}:${e}`}function nU(t){if(!t.startsWith(pk))return null;const e=t.slice(pk.length),n=e.lastIndexOf(":");if(n<=0)return null;const i=e.slice(0,n),r=Number(e.slice(n+1));return!Number.isInteger(r)||r<0||r>2?null:{parentBlockId:i,columnIndex:r}}const Rb=385,Mv="https://ddc4vowthkjlv.cloudfront.net/uploads/gallery/1/69cc1b1083b90.jpg";let yS=null;const Lle=2e3;function Wh(){yS&&clearTimeout(yS),yS=setTimeout(()=>{const t=new CustomEvent("email-builder-auto-save",{detail:!0});window.dispatchEvent(t)},Lle)}const Fle=()=>({document:Ld(JSON.parse(JSON.stringify(Woe))),selectedBlockId:null,selectedSidebarTab:"styles",selectedMainTab:"editor",selectedScreenSize:"desktop",windowWidth:0,inspectorDrawerOpen:!0,componentTreeOpen:!1,samplesDrawerOpen:!0,inspectorDrawerWidth:Rb,devMode:!1,imageUploading:{uploading:!1,id:""},disableEdition:!1,disableUpdate:!1,freeMode:!1,minHeight:"calc(100dvh - 65px)",color:{primary:"",secondary:""},galleryImages:!0,imagePlaceholder:Mv,darkMode:!0,colorPicker:{paletteColors:Voe,isLocked:!1},tour:!1,stickyHeader:!0,heightContent:"calc(100dvh - 50px)",containerGrow:!0,notionTextInlineEditingBlockId:null,highlightColor:"#FF6B35",showVersion:!1}),ce=j$(()=>Fle());D.createContext(ce);function iU(){const t=ce(e=>e.document[ce(n=>n.selectedBlockId)||""]);return t?t.type:null}function bO(t){return ce.setState({windowWidth:t})}function Ble(){return ce(t=>t.devMode)}function $le(t){return ce.setState({devMode:t})}function iA(){return ce(t=>t.document)}function rU(t){return ce(e=>e.document[t])}function Ule(t){return ce(e=>e.document[t]?.type)}function zle(t){return ce(e=>e.selectedBlockId===t)}function Yh(){return ce(t=>t.selectedBlockId)}function Kh(){return ce(t=>t.notionTextInlineEditingBlockId)}function Cm(t){const e=ce.getState().notionTextInlineEditingBlockId;return e&&e!==t&&window.dispatchEvent(new CustomEvent("notion-text-force-save",{detail:{blockId:e}})),ce.setState({notionTextInlineEditingBlockId:t})}function Gle(){return!!Kh()}function Hle(){return Kh()}function jle(){return ce(t=>t.highlightColor)}function fi(){return ce(t=>t.selectedScreenSize)}function rA(){return ce(t=>t.selectedMainTab)}function zg(t){return t==="preview"&&Na(null),ce.setState({inspectorDrawerOpen:t==="editor"}),ce.setState({selectedMainTab:t})}function Qo(){return ce(t=>t.selectedSidebarTab)}function qle(){return ce(t=>t.inspectorDrawerOpen)}function aA(){return ce(t=>t.componentTreeOpen)}function fk(){ce.setState(t=>({componentTreeOpen:!t.componentTreeOpen}))}function sA(){return ce(t=>t.imageUploading)}function Pv(){return ce(t=>t.disableEdition)}let Ib=null,yO=0;const Vle=400;let pu=!1,mk=!1;function qp(t,e){if(pu||mk)return;const n=Date.now(),i=n-yO;if(e&&e===Ib&&i<Vle){kb().future.length>0&&wb({future:[]});return}const a=JSON.stringify(t),{past:s}=kb();if(s.length>0&&s[s.length-1]===a)return;const o=[...s,a].slice(-50);wb({past:o,future:[]}),Ib=e??null,yO=n}function Na(t){const e=ce.getState().notionTextInlineEditingBlockId;e&&t!==null&&e!==t&&Cm(null);const n=ce.getState().document[t||""]?.type,i=xb.includes(n||null)?"styles":"block-configuration",r={};return t!==null&&ce.getState().selectedMainTab==="editor"&&(r.inspectorDrawerOpen=!0),ce.setState({selectedBlockId:t,selectedSidebarTab:i,...r})}function Wle(t){return ce.setState({selectedSidebarTab:t})}function Gg(t){const e=Ld(t);return Qoe(),ce.setState({document:e,selectedSidebarTab:"styles",selectedBlockId:null})}function aU(t){const e=ce.getState().document;mk=!0;let n;try{n=t()}finally{mk=!1}return qp(e,null),n}function vO(){const{past:t,future:e}=kb();if(t.length!==0){pu=!0;try{const n=ce.getState().document,i=JSON.stringify(n),r=[...t],a=r.pop(),s=JSON.parse(a);wb({past:r,future:[...e,i]});const o=ce.getState().selectedBlockId,l=o&&!s[o];ce.setState({document:s,...l?{selectedBlockId:null}:{}})}finally{pu=!1,Ib=null}}}function EO(){const{past:t,future:e}=kb();if(e.length!==0){pu=!0;try{const n=ce.getState().document,i=JSON.stringify(n),r=[...e],a=r.pop(),s=JSON.parse(a);wb({past:[...t,i],future:r});const o=ce.getState().selectedBlockId,l=o&&!s[o];ce.setState({document:s,...l?{selectedBlockId:null}:{}})}finally{pu=!1,Ib=null}}}function Jc(t,e=!0){const n=ce.getState().document,i={...n,...t};e&&qp(n);const r=()=>{ce.setState({document:i}),Wh()};return e?(D.startTransition(r),ce.getState()):r()}function Ob(t){return ce.setState({selectedScreenSize:t})}function Fd(t,e){return ce.setState({imageUploading:{uploading:t,id:e||""}})}function sU(t){return ce.setState({disableEdition:t})}function Yle(){return ce.getState().document.root.data}function Lv(){return ce(t=>t.document?.root?.data)}function Kle(t){return ce.setState({color:t})}function Qle(t){return ce.setState({galleryImages:t})}function Mb(){return ce.getState().galleryImages}function Xle(t){return ce.setState({imagePlaceholder:t})}function Jle(){return ce.getState().imagePlaceholder}function Zle(t){return ce.setState({freeMode:t})}function oA(){return ce.getState().freeMode}function ece(t){return ce.setState({darkMode:t})}function tce(t){return ce.setState({stickyHeader:t})}function nce(t){return ce.setState({heightContent:t})}function ice(t){return ce.setState({containerGrow:t})}function rce(){return ce.getState().containerGrow}function ace(t){return ce.setState({showVersion:t})}function sce(){return ce(t=>t.showVersion)}function ah(t,e,n,i=!0){Ru({draggedId:e,targetId:t})&&console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");const r=ce.getState().document,a=JSON.parse(JSON.stringify({...r})),s=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 p=n==="up"?d:d+1;return u.toSpliced(p,0,e)};let l=null,c=null;for(const[u,d]of Object.entries(a)){const p=d;if(c)break;switch(p.type){case"EmailLayout":p.data.childrenIds?.length&&p.data.childrenIds.includes(e)&&(c=u,a[u]={...p,data:{...p.data,childrenIds:s(p.data.childrenIds)}});break;case"Container":p.data.props?.childrenIds?.length&&p.data.props.childrenIds.includes(e)&&(c=u,a[u]={...p,data:{...p.data,props:{...p.data.props,childrenIds:s(p.data.props.childrenIds)}}});break;case"ColumnsContainer":if(p.data.props?.columns){let f=!1;const m=p.data.props.columns.map((g,_)=>g?.childrenIds?.includes(e)?(c=`${u}-column-${_}`,f=!0,{...g,childrenIds:s(g.childrenIds)}):g);f&&(a[u]={...p,data:{...p.data,props:{...p.data.props,columns:m}}})}break}}if(l=null,i)for(const[u,d]of Object.entries(a)){const p=d;if(l)break;switch(p.type){case"EmailLayout":p.data.childrenIds?.length&&p.data.childrenIds.includes(t)&&(l=u,a[u]={...p,data:{...p.data,childrenIds:o(p.data.childrenIds)}});break;case"Container":p.data.props?.childrenIds?.length&&p.data.props.childrenIds.includes(t)&&(l=u,a[u]={...p,data:{...p.data,props:{...p.data.props,childrenIds:o(p.data.props.childrenIds)}}});break;case"ColumnsContainer":if(p.data.props?.columns){const f=nU(t);if(f&&f.parentBlockId===u){l=u;const{columnIndex:g}=f,_=p.data.props.columns.map((b,y)=>{if(y!==g)return b;const E=[...b?.childrenIds||[]],v=n==="up"?0:E.length;return{...b,childrenIds:E.toSpliced(v,0,e)}});a[u]={...p,data:{...p.data,props:{...p.data.props,columns:_}}};break}const m=p.data.props.columns.map((g,_)=>g?.childrenIds?.includes(t)?(l=`${u}-column-${_}`,{...g,childrenIds:o(g.childrenIds)}):g);a[u]={...p,data:{...p.data,props:{...p.data.props,columns:m}}}}break}}return Jc(a)}function oce({parentId:t,blockId:e,indexArray:n}){if(Ru({draggedId:e,targetId:t})){console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");return}return aU(()=>{ah("",e,"down",!1);const i=ce.getState().document,r=JSON.parse(JSON.stringify({...i}));if(!r[t])return;const a=r[t],s=[...a.data.props.columns||[]];return s[n||0]={childrenIds:[e]},r[t]={type:"ColumnsContainer",data:{...a.data,props:{...a.data.props,columns:s}}},Jc(r)})}function lce({parentId:t,blockId:e}){if(Ru({draggedId:e,targetId:t})){console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");return}return aU(()=>{ah("",e,"down",!1);const n=ce.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]}}},Jc(i)})}function Ru({draggedId:t,targetId:e}){if(t===e)return!0;const n=nU(e),i=n?n.parentBlockId:e;if(t===i)return!0;const r=ce.getState().document;function a(s,o){const l=r[s];if(!l)return!1;let c=[];switch(l.type){case"EmailLayout":c=l.data.childrenIds||[];break;case"Container":c=l.data.props?.childrenIds||[];break;case"ColumnsContainer":l.data.props?.columns&&l.data.props.columns.forEach(u=>{u?.childrenIds&&(c=[...c,...u.childrenIds])});break}if(c.includes(o))return!0;for(const u of c)if(a(u,o))return!0;return!1}return a(t,i)}function cce(){return ce(t=>t.colorPicker)}function vS(t){ce.setState(e=>({colorPicker:{...e.colorPicker,...t}}))}function oU(t,e){if(pu)return;const n=ce.getState().document,i=n[t];if(!i){console.warn(`Block ${t} not found`);return}const r=e(i);if(i===r)return;const a={...n,[t]:r};qp(n,t),D.startTransition(()=>{ce.setState({document:a})}),Wh()}function uce(t,e){if(pu)return;const n=ce.getState().document,i=n[t];if(!i){console.warn(`Block ${t} not found`);return}const r=e(i);if(i===r)return;const a={...n,[t]:r};qp(n,t),ce.setState({document:a}),Wh()}function dce(t,e){oU(t,n=>{const i=typeof e=="function"?e(n.data.props):{...n.data.props,...e};return{...n,data:{...n.data,props:i}}})}function Hg(t,e){uce(t,n=>{const i=typeof e=="function"?e(n.data.props):{...n.data.props,...e};return{...n,data:{...n.data,props:i}}})}function hk(t,e,n,i){const r=ce.getState().document,a=r[t];if(!a)return;const s=a.type==="EmailLayout"?{...a,data:{...a.data,childrenIds:i}}:{...a,data:{...a.data,props:{...a.data?.props,childrenIds:i}}},o={...r,[e]:n,[t]:s};qp(r),D.startTransition(()=>{ce.setState({document:o})}),Wh()}function pce(t){const e=ce.getState().document,n={...e,...t};qp(e),D.startTransition(()=>{ce.setState({document:n})}),Wh()}function Pb(t,e){oU(t,e)}var tn;(function(t){t.assertEqual=r=>{};function e(r){}t.assertIs=e;function n(r){throw new Error}t.assertNever=n,t.arrayToEnum=r=>{const a={};for(const s of r)a[s]=s;return a},t.getValidEnumValues=r=>{const a=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),s={};for(const o of a)s[o]=r[o];return t.objectValues(s)},t.objectValues=r=>t.objectKeys(r).map(function(a){return r[a]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const a=[];for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&a.push(s);return a},t.find=(r,a)=>{for(const s of r)if(a(s))return s},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,a=" | "){return r.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}t.joinValues=i,t.jsonStringifyReplacer=(r,a)=>typeof a=="bigint"?a.toString():a})(tn||(tn={}));var SO;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(SO||(SO={}));const je=tn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Tl=t=>{switch(typeof t){case"undefined":return je.undefined;case"string":return je.string;case"number":return Number.isNaN(t)?je.nan:je.number;case"boolean":return je.boolean;case"function":return je.function;case"bigint":return je.bigint;case"symbol":return je.symbol;case"object":return Array.isArray(t)?je.array:t===null?je.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?je.promise:typeof Map<"u"&&t instanceof Map?je.map:typeof Set<"u"&&t instanceof Set?je.set:typeof Date<"u"&&t instanceof Date?je.date:je.object;default:return je.unknown}},ve=tn.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"]);class Ho 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(a){return a.message},i={_errors:[]},r=a=>{for(const s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(r);else if(s.code==="invalid_return_type")r(s.returnTypeError);else if(s.code==="invalid_arguments")r(s.argumentsError);else if(s.path.length===0)i._errors.push(n(s));else{let o=i,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(n(s))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return r(this),i}static assert(e){if(!(e instanceof Ho))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,tn.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 a=r.path[0];n[a]=n[a]||[],n[a].push(e(r))}else i.push(e(r));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}}Ho.create=t=>new Ho(t);const gk=(t,e)=>{let n;switch(t.code){case ve.invalid_type:t.received===je.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case ve.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,tn.jsonStringifyReplacer)}`;break;case ve.unrecognized_keys:n=`Unrecognized key(s) in object: ${tn.joinValues(t.keys,", ")}`;break;case ve.invalid_union:n="Invalid input";break;case ve.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${tn.joinValues(t.options)}`;break;case ve.invalid_enum_value:n=`Invalid enum value. Expected ${tn.joinValues(t.options)}, received '${t.received}'`;break;case ve.invalid_arguments:n="Invalid function arguments";break;case ve.invalid_return_type:n="Invalid function return type";break;case ve.invalid_date:n="Invalid date";break;case ve.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}"`:tn.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case ve.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 ve.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 ve.custom:n="Invalid input";break;case ve.invalid_intersection_types:n="Intersection results could not be merged";break;case ve.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case ve.not_finite:n="Number must be finite";break;default:n=e.defaultError,tn.assertNever(t)}return{message:n}};let fce=gk;function mce(){return fce}const hce=t=>{const{data:e,path:n,errorMaps:i,issueData:r}=t,a=[...n,...r.path||[]],s={...r,path:a};if(r.message!==void 0)return{...r,path:a,message:r.message};let o="";const l=i.filter(c=>!!c).slice().reverse();for(const c of l)o=c(s,{data:e,defaultError:o}).message;return{...r,path:a,message:o}};function $e(t,e){const n=mce(),i=hce({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===gk?void 0:gk].filter(r=>!!r)});t.common.issues.push(i)}class br{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 kt;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 a=await r.key,s=await r.value;i.push({key:a,value:s})}return br.mergeObjectSync(e,i)}static mergeObjectSync(e,n){const i={};for(const r of n){const{key:a,value:s}=r;if(a.status==="aborted"||s.status==="aborted")return kt;a.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof s.value<"u"||r.alwaysSet)&&(i[a.value]=s.value)}return{status:e.value,value:i}}}const kt=Object.freeze({status:"aborted"}),Qf=t=>({status:"dirty",value:t}),qa=t=>({status:"valid",value:t}),CO=t=>t.status==="aborted",TO=t=>t.status==="dirty",cp=t=>t.status==="valid",Lb=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 Qs{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 xO=(t,e)=>{if(cp(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 Ho(t.common.issues);return this._error=n,this._error}}};function Pt(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:(s,o)=>{const{message:l}=t;return s.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??i??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:l??n??o.defaultError}},description:r}}class jt{get description(){return this._def.description}_getType(e){return Tl(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Tl(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new br,ctx:{common:e.parent.common,data:e.data,parsedType:Tl(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Lb(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:Tl(e)},r=this._parseSync({data:e,path:i.path,parent:i});return xO(i,r)}"~validate"(e){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Tl(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return cp(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=>cp(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:Tl(e)},r=this._parse({data:e,path:i.path,parent:i}),a=await(Lb(r)?r:Promise.resolve(r));return xO(i,a)}refine(e,n){const i=r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,a)=>{const s=e(r),o=()=>a.addIssue({code:ve.custom,...i(r)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(o(),!1)):s?!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 hu({schema:this,typeName:wt.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 Mo.create(this,this._def)}nullable(){return gu.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return js.create(this)}promise(){return Gb.create(this,this._def)}or(e){return Bb.create([this,e],this._def)}and(e){return $b.create(this,e,this._def)}transform(e){return new hu({...Pt(this._def),schema:this,typeName:wt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Hb({...Pt(this._def),innerType:this,defaultValue:n,typeName:wt.ZodDefault})}brand(){return new dU({typeName:wt.ZodBranded,type:this,...Pt(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new jb({...Pt(this._def),innerType:this,catchValue:n,typeName:wt.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return cA.create(this,e)}readonly(){return qb.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const gce=/^c[^\s-]{8,}$/i,_ce=/^[0-9a-z]+$/,bce=/^[0-9A-HJKMNP-TV-Z]{26}$/i,yce=/^[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,vce=/^[a-z0-9_-]{21}$/i,Ece=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Sce=/^[-+]?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)?)??$/,Cce=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Tce="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ES;const xce=/^(?:(?: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])$/,kce=/^(?:(?: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])$/,wce=/^(([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]))$/,Dce=/^(([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])$/,Ace=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Nce=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,lU="((\\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])))",Rce=new RegExp(`^${lU}$`);function cU(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 Ice(t){return new RegExp(`^${cU(t)}$`)}function Oce(t){let e=`${lU}T${cU(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 Mce(t,e){return!!((e==="v4"||!e)&&xce.test(t)||(e==="v6"||!e)&&wce.test(t))}function Pce(t,e){if(!Ece.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 Lce(t,e){return!!((e==="v4"||!e)&&kce.test(t)||(e==="v6"||!e)&&Dce.test(t))}class No extends jt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==je.string){const a=this._getOrReturnCtx(e);return $e(a,{code:ve.invalid_type,expected:je.string,received:a.parsedType}),kt}const i=new br;let r;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),i.dirty());else if(a.kind==="max")e.data.length>a.value&&(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),i.dirty());else if(a.kind==="length"){const s=e.data.length>a.value,o=e.data.length<a.value;(s||o)&&(r=this._getOrReturnCtx(e,r),s?$e(r,{code:ve.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&$e(r,{code:ve.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),i.dirty())}else if(a.kind==="email")Cce.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"email",code:ve.invalid_string,message:a.message}),i.dirty());else if(a.kind==="emoji")ES||(ES=new RegExp(Tce,"u")),ES.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"emoji",code:ve.invalid_string,message:a.message}),i.dirty());else if(a.kind==="uuid")yce.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"uuid",code:ve.invalid_string,message:a.message}),i.dirty());else if(a.kind==="nanoid")vce.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"nanoid",code:ve.invalid_string,message:a.message}),i.dirty());else if(a.kind==="cuid")gce.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"cuid",code:ve.invalid_string,message:a.message}),i.dirty());else if(a.kind==="cuid2")_ce.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"cuid2",code:ve.invalid_string,message:a.message}),i.dirty());else if(a.kind==="ulid")bce.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"ulid",code:ve.invalid_string,message:a.message}),i.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),$e(r,{validation:"url",code:ve.invalid_string,message:a.message}),i.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"regex",code:ve.invalid_string,message:a.message}),i.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),i.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.invalid_string,validation:{startsWith:a.value},message:a.message}),i.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.invalid_string,validation:{endsWith:a.value},message:a.message}),i.dirty()):a.kind==="datetime"?Oce(a).test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.invalid_string,validation:"datetime",message:a.message}),i.dirty()):a.kind==="date"?Rce.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.invalid_string,validation:"date",message:a.message}),i.dirty()):a.kind==="time"?Ice(a).test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.invalid_string,validation:"time",message:a.message}),i.dirty()):a.kind==="duration"?Sce.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"duration",code:ve.invalid_string,message:a.message}),i.dirty()):a.kind==="ip"?Mce(e.data,a.version)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"ip",code:ve.invalid_string,message:a.message}),i.dirty()):a.kind==="jwt"?Pce(e.data,a.alg)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"jwt",code:ve.invalid_string,message:a.message}),i.dirty()):a.kind==="cidr"?Lce(e.data,a.version)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"cidr",code:ve.invalid_string,message:a.message}),i.dirty()):a.kind==="base64"?Ace.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"base64",code:ve.invalid_string,message:a.message}),i.dirty()):a.kind==="base64url"?Nce.test(e.data)||(r=this._getOrReturnCtx(e,r),$e(r,{validation:"base64url",code:ve.invalid_string,message:a.message}),i.dirty()):tn.assertNever(a);return{status:i.value,value:e.data}}_regex(e,n,i){return this.refinement(r=>e.test(r),{validation:n,code:ve.invalid_string,...Ke.errToObj(i)})}_addCheck(e){return new No({...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 No({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new No({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new No({...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}}No.create=t=>new No({checks:[],typeName:wt.ZodString,coerce:t?.coerce??!1,...Pt(t)});function Fce(t,e){const n=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,r=n>i?n:i,a=Number.parseInt(t.toFixed(r).replace(".","")),s=Number.parseInt(e.toFixed(r).replace(".",""));return a%s/10**r}class up extends jt{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)!==je.number){const a=this._getOrReturnCtx(e);return $e(a,{code:ve.invalid_type,expected:je.number,received:a.parsedType}),kt}let i;const r=new br;for(const a of this._def.checks)a.kind==="int"?tn.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),$e(i,{code:ve.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(i=this._getOrReturnCtx(e,i),$e(i,{code:ve.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(i=this._getOrReturnCtx(e,i),$e(i,{code:ve.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="multipleOf"?Fce(e.data,a.value)!==0&&(i=this._getOrReturnCtx(e,i),$e(i,{code:ve.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),$e(i,{code:ve.not_finite,message:a.message}),r.dirty()):tn.assertNever(a);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 up({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:Ke.toString(r)}]})}_addCheck(e){return new up({...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"&&tn.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)}}up.create=t=>new up({checks:[],typeName:wt.ZodNumber,coerce:t?.coerce||!1,...Pt(t)});class sh extends jt{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)!==je.bigint)return this._getInvalidInput(e);let i;const r=new br;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(i=this._getOrReturnCtx(e,i),$e(i,{code:ve.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(i=this._getOrReturnCtx(e,i),$e(i,{code:ve.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),$e(i,{code:ve.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):tn.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return $e(n,{code:ve.invalid_type,expected:je.bigint,received:n.parsedType}),kt}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 sh({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:Ke.toString(r)}]})}_addCheck(e){return new sh({...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}}sh.create=t=>new sh({checks:[],typeName:wt.ZodBigInt,coerce:t?.coerce??!1,...Pt(t)});class _k extends jt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==je.boolean){const i=this._getOrReturnCtx(e);return $e(i,{code:ve.invalid_type,expected:je.boolean,received:i.parsedType}),kt}return qa(e.data)}}_k.create=t=>new _k({typeName:wt.ZodBoolean,coerce:t?.coerce||!1,...Pt(t)});class Fb extends jt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==je.date){const a=this._getOrReturnCtx(e);return $e(a,{code:ve.invalid_type,expected:je.date,received:a.parsedType}),kt}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return $e(a,{code:ve.invalid_date}),kt}const i=new br;let r;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),i.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),$e(r,{code:ve.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),i.dirty()):tn.assertNever(a);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Fb({...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}}Fb.create=t=>new Fb({checks:[],coerce:t?.coerce||!1,typeName:wt.ZodDate,...Pt(t)});class kO extends jt{_parse(e){if(this._getType(e)!==je.symbol){const i=this._getOrReturnCtx(e);return $e(i,{code:ve.invalid_type,expected:je.symbol,received:i.parsedType}),kt}return qa(e.data)}}kO.create=t=>new kO({typeName:wt.ZodSymbol,...Pt(t)});class bk extends jt{_parse(e){if(this._getType(e)!==je.undefined){const i=this._getOrReturnCtx(e);return $e(i,{code:ve.invalid_type,expected:je.undefined,received:i.parsedType}),kt}return qa(e.data)}}bk.create=t=>new bk({typeName:wt.ZodUndefined,...Pt(t)});class yk extends jt{_parse(e){if(this._getType(e)!==je.null){const i=this._getOrReturnCtx(e);return $e(i,{code:ve.invalid_type,expected:je.null,received:i.parsedType}),kt}return qa(e.data)}}yk.create=t=>new yk({typeName:wt.ZodNull,...Pt(t)});class wO extends jt{constructor(){super(...arguments),this._any=!0}_parse(e){return qa(e.data)}}wO.create=t=>new wO({typeName:wt.ZodAny,...Pt(t)});class DO extends jt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return qa(e.data)}}DO.create=t=>new DO({typeName:wt.ZodUnknown,...Pt(t)});class Ql extends jt{_parse(e){const n=this._getOrReturnCtx(e);return $e(n,{code:ve.invalid_type,expected:je.never,received:n.parsedType}),kt}}Ql.create=t=>new Ql({typeName:wt.ZodNever,...Pt(t)});class AO extends jt{_parse(e){if(this._getType(e)!==je.undefined){const i=this._getOrReturnCtx(e);return $e(i,{code:ve.invalid_type,expected:je.void,received:i.parsedType}),kt}return qa(e.data)}}AO.create=t=>new AO({typeName:wt.ZodVoid,...Pt(t)});class js extends jt{_parse(e){const{ctx:n,status:i}=this._processInputParams(e),r=this._def;if(n.parsedType!==je.array)return $e(n,{code:ve.invalid_type,expected:je.array,received:n.parsedType}),kt;if(r.exactLength!==null){const s=n.data.length>r.exactLength.value,o=n.data.length<r.exactLength.value;(s||o)&&($e(n,{code:s?ve.too_big:ve.too_small,minimum:o?r.exactLength.value:void 0,maximum:s?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&&($e(n,{code:ve.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&&($e(n,{code:ve.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((s,o)=>r.type._parseAsync(new Qs(n,s,n.path,o)))).then(s=>br.mergeArray(i,s));const a=[...n.data].map((s,o)=>r.type._parseSync(new Qs(n,s,n.path,o)));return br.mergeArray(i,a)}get element(){return this._def.type}min(e,n){return new js({...this._def,minLength:{value:e,message:Ke.toString(n)}})}max(e,n){return new js({...this._def,maxLength:{value:e,message:Ke.toString(n)}})}length(e,n){return new js({...this._def,exactLength:{value:e,message:Ke.toString(n)}})}nonempty(e){return this.min(1,e)}}js.create=(t,e)=>new js({type:t,minLength:null,maxLength:null,exactLength:null,typeName:wt.ZodArray,...Pt(e)});function _d(t){if(t instanceof yi){const e={};for(const n in t.shape){const i=t.shape[n];e[n]=Mo.create(_d(i))}return new yi({...t._def,shape:()=>e})}else return t instanceof js?new js({...t._def,type:_d(t.element)}):t instanceof Mo?Mo.create(_d(t.unwrap())):t instanceof gu?gu.create(_d(t.unwrap())):t instanceof fu?fu.create(t.items.map(e=>_d(e))):t}class yi extends jt{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=tn.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==je.object){const c=this._getOrReturnCtx(e);return $e(c,{code:ve.invalid_type,expected:je.object,received:c.parsedType}),kt}const{status:i,ctx:r}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof Ql&&this._def.unknownKeys==="strip"))for(const c in r.data)s.includes(c)||o.push(c);const l=[];for(const c of s){const u=a[c],d=r.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Qs(r,d,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof Ql){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&&($e(r,{code:ve.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 Qs(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,p=await u.value;c.push({key:d,value:p,alwaysSet:u.alwaysSet})}return c}).then(c=>br.mergeObjectSync(i,c)):br.mergeObjectSync(i,l)}get shape(){return this._def.shape()}strict(e){return Ke.errToObj,new yi({...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 yi({...this._def,unknownKeys:"strip"})}passthrough(){return new yi({...this._def,unknownKeys:"passthrough"})}extend(e){return new yi({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new yi({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:wt.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new yi({...this._def,catchall:e})}pick(e){const n={};for(const i of tn.objectKeys(e))e[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new yi({...this._def,shape:()=>n})}omit(e){const n={};for(const i of tn.objectKeys(this.shape))e[i]||(n[i]=this.shape[i]);return new yi({...this._def,shape:()=>n})}deepPartial(){return _d(this)}partial(e){const n={};for(const i of tn.objectKeys(this.shape)){const r=this.shape[i];e&&!e[i]?n[i]=r:n[i]=r.optional()}return new yi({...this._def,shape:()=>n})}required(e){const n={};for(const i of tn.objectKeys(this.shape))if(e&&!e[i])n[i]=this.shape[i];else{let a=this.shape[i];for(;a instanceof Mo;)a=a._def.innerType;n[i]=a}return new yi({...this._def,shape:()=>n})}keyof(){return uU(tn.objectKeys(this.shape))}}yi.create=(t,e)=>new yi({shape:()=>t,unknownKeys:"strip",catchall:Ql.create(),typeName:wt.ZodObject,...Pt(e)});yi.strictCreate=(t,e)=>new yi({shape:()=>t,unknownKeys:"strict",catchall:Ql.create(),typeName:wt.ZodObject,...Pt(e)});yi.lazycreate=(t,e)=>new yi({shape:t,unknownKeys:"strip",catchall:Ql.create(),typeName:wt.ZodObject,...Pt(e)});class Bb extends jt{_parse(e){const{ctx:n}=this._processInputParams(e),i=this._def.options;function r(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;const s=a.map(o=>new Ho(o.ctx.common.issues));return $e(n,{code:ve.invalid_union,unionErrors:s}),kt}if(n.common.async)return Promise.all(i.map(async a=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(r);{let a;const s=[];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"&&!a&&(a={result:u,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(l=>new Ho(l));return $e(n,{code:ve.invalid_union,unionErrors:o}),kt}}get options(){return this._def.options}}Bb.create=(t,e)=>new Bb({options:t,typeName:wt.ZodUnion,...Pt(e)});const So=t=>t instanceof Ek?So(t.schema):t instanceof hu?So(t.innerType()):t instanceof zb?[t.value]:t instanceof mu?t.options:t instanceof Sk?tn.objectValues(t.enum):t instanceof Hb?So(t._def.innerType):t instanceof bk?[void 0]:t instanceof yk?[null]:t instanceof Mo?[void 0,...So(t.unwrap())]:t instanceof gu?[null,...So(t.unwrap())]:t instanceof dU||t instanceof qb?So(t.unwrap()):t instanceof jb?So(t._def.innerType):[];class lA extends jt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==je.object)return $e(n,{code:ve.invalid_type,expected:je.object,received:n.parsedType}),kt;const i=this.discriminator,r=n.data[i],a=this.optionsMap.get(r);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):($e(n,{code:ve.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),kt)}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 a of n){const s=So(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of s){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,a)}}return new lA({typeName:wt.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:r,...Pt(i)})}}function vk(t,e){const n=Tl(t),i=Tl(e);if(t===e)return{valid:!0,data:t};if(n===je.object&&i===je.object){const r=tn.objectKeys(e),a=tn.objectKeys(t).filter(o=>r.indexOf(o)!==-1),s={...t,...e};for(const o of a){const l=vk(t[o],e[o]);if(!l.valid)return{valid:!1};s[o]=l.data}return{valid:!0,data:s}}else if(n===je.array&&i===je.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let a=0;a<t.length;a++){const s=t[a],o=e[a],l=vk(s,o);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return n===je.date&&i===je.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class $b extends jt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e),r=(a,s)=>{if(CO(a)||CO(s))return kt;const o=vk(a.value,s.value);return o.valid?((TO(a)||TO(s))&&n.dirty(),{status:n.value,value:o.data}):($e(i,{code:ve.invalid_intersection_types}),kt)};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(([a,s])=>r(a,s)):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}))}}$b.create=(t,e,n)=>new $b({left:t,right:e,typeName:wt.ZodIntersection,...Pt(n)});class fu extends jt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==je.array)return $e(i,{code:ve.invalid_type,expected:je.array,received:i.parsedType}),kt;if(i.data.length<this._def.items.length)return $e(i,{code:ve.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),kt;!this._def.rest&&i.data.length>this._def.items.length&&($e(i,{code:ve.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const a=[...i.data].map((s,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new Qs(i,s,i.path,o)):null}).filter(s=>!!s);return i.common.async?Promise.all(a).then(s=>br.mergeArray(n,s)):br.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new fu({...this._def,rest:e})}}fu.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new fu({items:t,typeName:wt.ZodTuple,rest:null,...Pt(e)})};class Ub extends jt{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!==je.object)return $e(i,{code:ve.invalid_type,expected:je.object,received:i.parsedType}),kt;const r=[],a=this._def.keyType,s=this._def.valueType;for(const o in i.data)r.push({key:a._parse(new Qs(i,o,i.path,o)),value:s._parse(new Qs(i,i.data[o],i.path,o)),alwaysSet:o in i.data});return i.common.async?br.mergeObjectAsync(n,r):br.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(e,n,i){return n instanceof jt?new Ub({keyType:e,valueType:n,typeName:wt.ZodRecord,...Pt(i)}):new Ub({keyType:No.create(),valueType:e,typeName:wt.ZodRecord,...Pt(n)})}}class NO extends jt{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!==je.map)return $e(i,{code:ve.invalid_type,expected:je.map,received:i.parsedType}),kt;const r=this._def.keyType,a=this._def.valueType,s=[...i.data.entries()].map(([o,l],c)=>({key:r._parse(new Qs(i,o,i.path,[c,"key"])),value:a._parse(new Qs(i,l,i.path,[c,"value"]))}));if(i.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of s){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return kt;(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 s){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return kt;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),o.set(c.value,u.value)}return{status:n.value,value:o}}}}NO.create=(t,e,n)=>new NO({valueType:e,keyType:t,typeName:wt.ZodMap,...Pt(n)});class oh extends jt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==je.set)return $e(i,{code:ve.invalid_type,expected:je.set,received:i.parsedType}),kt;const r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&($e(i,{code:ve.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&&($e(i,{code:ve.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());const a=this._def.valueType;function s(l){const c=new Set;for(const u of l){if(u.status==="aborted")return kt;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const o=[...i.data.values()].map((l,c)=>a._parse(new Qs(i,l,i.path,c)));return i.common.async?Promise.all(o).then(l=>s(l)):s(o)}min(e,n){return new oh({...this._def,minSize:{value:e,message:Ke.toString(n)}})}max(e,n){return new oh({...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)}}oh.create=(t,e)=>new oh({valueType:t,minSize:null,maxSize:null,typeName:wt.ZodSet,...Pt(e)});class Ek extends jt{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})}}Ek.create=(t,e)=>new Ek({getter:t,typeName:wt.ZodLazy,...Pt(e)});class zb extends jt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return $e(n,{received:n.data,code:ve.invalid_literal,expected:this._def.value}),kt}return{status:"valid",value:e.data}}get value(){return this._def.value}}zb.create=(t,e)=>new zb({value:t,typeName:wt.ZodLiteral,...Pt(e)});function uU(t,e){return new mu({values:t,typeName:wt.ZodEnum,...Pt(e)})}class mu extends jt{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),i=this._def.values;return $e(n,{expected:tn.joinValues(i),received:n.parsedType,code:ve.invalid_type}),kt}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 $e(n,{received:n.data,code:ve.invalid_enum_value,options:i}),kt}return qa(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 mu.create(e,{...this._def,...n})}exclude(e,n=this._def){return mu.create(this.options.filter(i=>!e.includes(i)),{...this._def,...n})}}mu.create=uU;class Sk extends jt{_parse(e){const n=tn.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==je.string&&i.parsedType!==je.number){const r=tn.objectValues(n);return $e(i,{expected:tn.joinValues(r),received:i.parsedType,code:ve.invalid_type}),kt}if(this._cache||(this._cache=new Set(tn.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=tn.objectValues(n);return $e(i,{received:i.data,code:ve.invalid_enum_value,options:r}),kt}return qa(e.data)}get enum(){return this._def.values}}Sk.create=(t,e)=>new Sk({values:t,typeName:wt.ZodNativeEnum,...Pt(e)});class Gb extends jt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==je.promise&&n.common.async===!1)return $e(n,{code:ve.invalid_type,expected:je.promise,received:n.parsedType}),kt;const i=n.parsedType===je.promise?n.data:Promise.resolve(n.data);return qa(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Gb.create=(t,e)=>new Gb({type:t,typeName:wt.ZodPromise,...Pt(e)});class hu extends jt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===wt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:i}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:s=>{$e(i,s),s.fatal?n.abort():n.dirty()},get path(){return i.path}};if(a.addIssue=a.addIssue.bind(a),r.type==="preprocess"){const s=r.transform(i.data,a);if(i.common.async)return Promise.resolve(s).then(async o=>{if(n.value==="aborted")return kt;const l=await this._def.schema._parseAsync({data:o,path:i.path,parent:i});return l.status==="aborted"?kt:l.status==="dirty"||n.value==="dirty"?Qf(l.value):l});{if(n.value==="aborted")return kt;const o=this._def.schema._parseSync({data:s,path:i.path,parent:i});return o.status==="aborted"?kt:o.status==="dirty"||n.value==="dirty"?Qf(o.value):o}}if(r.type==="refinement"){const s=o=>{const l=r.refinement(o,a);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"?kt:(o.status==="dirty"&&n.dirty(),s(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"?kt:(o.status==="dirty"&&n.dirty(),s(o.value).then(()=>({status:n.value,value:o.value}))))}if(r.type==="transform")if(i.common.async===!1){const s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!cp(s))return kt;const o=r.transform(s.value,a);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(s=>cp(s)?Promise.resolve(r.transform(s.value,a)).then(o=>({status:n.value,value:o})):kt);tn.assertNever(r)}}hu.create=(t,e,n)=>new hu({schema:t,typeName:wt.ZodEffects,effect:e,...Pt(n)});hu.createWithPreprocess=(t,e,n)=>new hu({schema:e,effect:{type:"preprocess",transform:t},typeName:wt.ZodEffects,...Pt(n)});class Mo extends jt{_parse(e){return this._getType(e)===je.undefined?qa(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Mo.create=(t,e)=>new Mo({innerType:t,typeName:wt.ZodOptional,...Pt(e)});class gu extends jt{_parse(e){return this._getType(e)===je.null?qa(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}gu.create=(t,e)=>new gu({innerType:t,typeName:wt.ZodNullable,...Pt(e)});class Hb extends jt{_parse(e){const{ctx:n}=this._processInputParams(e);let i=n.data;return n.parsedType===je.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Hb.create=(t,e)=>new Hb({innerType:t,typeName:wt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Pt(e)});class jb extends jt{_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 Lb(r)?r.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Ho(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ho(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}jb.create=(t,e)=>new jb({innerType:t,typeName:wt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Pt(e)});class RO extends jt{_parse(e){if(this._getType(e)!==je.nan){const i=this._getOrReturnCtx(e);return $e(i,{code:ve.invalid_type,expected:je.nan,received:i.parsedType}),kt}return{status:"valid",value:e.data}}}RO.create=t=>new RO({typeName:wt.ZodNaN,...Pt(t)});class dU extends jt{_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 cA extends jt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?kt:a.status==="dirty"?(n.dirty(),Qf(a.value)):this._def.out._parseAsync({data:a.value,path:i.path,parent:i})})();{const r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?kt: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 cA({in:e,out:n,typeName:wt.ZodPipeline})}}class qb extends jt{_parse(e){const n=this._def.innerType._parse(e),i=r=>(cp(r)&&(r.value=Object.freeze(r.value)),r);return Lb(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}}qb.create=(t,e)=>new qb({innerType:t,typeName:wt.ZodReadonly,...Pt(e)});var wt;(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"})(wt||(wt={}));const rt=No.create,Oe=up.create,Fs=_k.create;Ql.create;const Bd=js.create,vt=yi.create,$d=Bb.create,Bce=lA.create;$b.create;const pU=fu.create,$ce=Ub.create,Ck=zb.create,Vn=mu.create;Gb.create;Mo.create;gu.create;function jg(t,e){return!t||t&&t[e]===0?"initial":t[e]!==void 0?`${t[e]}px solid ${t?.color??"black"}`:"initial"}function Zr({className:t,background:e,backgroundColor:n,padding:i={top:0,right:0,bottom:0,left:0},width:r,align:a,children:s,border:o,borderRadius:l,isParent:c=!0,overflow:u="visible"}){const d=t?`a${t}`:"",p={width:r,minWidth:r,borderRadius:l??"initial",borderTop:jg(o,"top"),borderBottom:jg(o,"bottom"),borderLeft:jg(o,"left"),borderRight:jg(o,"right"),overflow:u,borderCollapse:"initial"};return e&&String(e).trim()!==""?p.background=e:n&&(p.backgroundColor=n),h.jsx("table",{className:t,width:r,border:0,cellSpacing:"0",cellPadding:"0",style:p,children:h.jsxs("tbody",{children:[h.jsxs("tr",{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:a,children:s}),h.jsx("td",{style:{width:`${i.right}px`},className:c?`r${t}`:`ir${t}`})]}),h.jsxs("tr",{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 uA=t=>t?["http","mailto:","tel:","sms:","whatsapp:"].some(n=>t.startsWith(n))?t:`//${t}`:"#",fU=[{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'}],Uce={FAMILY:"MODERN_SANS"},Vp=Vn(["MODERN_SANS","LATO","MERRIWEATHER","MONTSERRAT","OPEN_SANS","OSWALD","PACIFICO","PLAYFAIR","ROBOTO","INHERIT"]).nullable().optional(),IO=t=>fU.find(e=>e.key===t)?.value;function Xl(t){const e=Yle();let n=IO(t);return n||(n=IO(e?.fontFamily),n||"inherit")}const Iu=(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 dA(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:a=0}=e;return`${n}px ${i}px ${a}px ${r}px`}}function zce(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=(e>>>0)*16777619;return e>>>0}function Gce(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 Wt(t){const e=zce(t);return`b${Gce(e)}`}const Nf=rt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),OO=vt({top:Oe(),bottom:Oe(),right:Oe(),left:Oe()}).optional().nullable(),Hce=t=>({top:t?.top??0,right:t?.right??0,bottom:t?.bottom??0,left:t?.left??0}),jce=vt({topLeft:Oe().min(0).optional(),topRight:Oe().min(0).optional(),bottomLeft:Oe().min(0).optional(),bottomRight:Oe().min(0).optional()}),MO=vt({top:Oe().min(0).optional(),bottom:Oe().min(0).optional(),left:Oe().min(0).optional(),right:Oe().min(0).optional()}),mU=vt({style:vt({backgroundColor:Nf,fontSize:Oe().min(0).optional().nullable(),fontSizeMobile:Oe().min(0).optional().nullable(),fontFamily:Vp,background:rt().nullable().optional(),buttonBackgroundColor:Nf,buttonTextColor:Nf,fontWeight:Vn(["bold","normal"]).optional().nullable(),textAlign:Vn(["left","center","right"]).optional().nullable(),textAlignMobile:Vn(["left","center","right"]).optional().nullable(),padding:OO,mobilePadding:OO,shape:$d([Vn(["rectangle","pill"]),jce]).optional().nullable()}).passthrough().optional().nullable(),props:vt({buttonBackgroundColor:Nf,buttonTextColor:Nf,fullWidth:Fs().optional().nullable(),fullWidthMobile:Fs().optional().nullable(),size:$d([Vn(["x-small","small","medium"]),MO]).optional().nullable(),sizeMobile:$d([Vn(["x-small","small","medium"]),MO]).optional().nullable(),sizePaddingSidesLinked:Fs().optional(),sizeMobilePaddingSidesLinked:Fs().optional(),text:rt().optional().nullable(),url:rt().optional().nullable()}).optional().nullable()}).passthrough();function PO(t){if(t!=null&&typeof t!="string")return{top:t.top??0,right:t.right??0,bottom:t.bottom??0,left:t.left??0};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 Al={text:"",url:"",fullWidth:!1,size:"medium",buttonBackgroundColor:"#999999"};function hU({style:t,props:e,blockId:n,isNotClient:i=!1}){const r=Lv(),a=fi(),o=!Pv()&&!i,l=e?.text??Al.text,c=e?.url??Al.url,u=a==="desktop"?e?.fullWidth??!1:e?.fullWidthMobile??e?.fullWidth??!1,d=t?.buttonTextColor??e?.buttonTextColor??r.textColor,p=t?.buttonBackgroundColor??e?.buttonBackgroundColor??Al.buttonBackgroundColor,f={backgroundColor:t?.backgroundColor??void 0,textAlign:a=="desktop"?t?.textAlign??void 0:t?.textAlignMobile??t?.textAlign,padding:Hce(a=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},m={color:d,fontSize:a=="desktop"?t?.fontSize??16:t?.fontSizeMobile??t?.fontSize??16,fontFamily:Xl(t?.fontFamily),fontWeight:t?.fontWeight??"bold",display:"inline-block",textDecoration:"none"},g={color:t?.borderColor,top:a=="desktop"?t?.borderTop??void 0:t?.borderTopMobile??t?.borderTop,bottom:a=="desktop"?t?.borderBottom??void 0:t?.borderBottomMobile??t?.borderBottom,left:a=="desktop"?t?.borderLeft??void 0:t?.borderLeftMobile??t?.borderLeft,right:a=="desktop"?t?.borderRight??void 0:t?.borderRightMobile??t?.borderRight},_=t?.background??"",b=t?.backgroundColor,y=b?Iu(_,b):_,E=dA(t),v=Wt(n);return h.jsx(Zr,{background:y,backgroundColor:b,padding:f.padding,align:f.textAlign,width:"100%",className:`c${v}`,children:h.jsx("a",{href:uA(c),target:"_blank",className:`abtn-${v}`,onClick:o?T=>T.preventDefault():void 0,children:h.jsx(Zr,{className:v,padding:a=="desktop"?PO(e?.size):PO(e?.sizeMobile??e?.size),borderRadius:E,background:p,backgroundColor:p,isParent:!1,align:"center",width:u?"100%":void 0,border:g,children:h.jsx("span",{className:`btn${v}`,style:m,children:l})})})})}function gs({title:t,children:e}){return h.jsxs(rh,{sx:{padding:"0!important",paddingTop:"1rem!important"},children:[h.jsx(gn,{sx:{fontWeight:"bold",mb:2,pb:1,color:"text.primary",fontSize:"1.25rem",borderBottom:n=>`1px solid ${n.palette.divider}`},children:t}),h.jsx(_n,{spacing:2,gap:1,mb:3,pt:1,children:e})]})}const qce=Ee(h.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),pA=Ee(h.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"AddOutlined"),gU=Ee(h.jsx("path",{d:"M4 22H2V2h2zM22 7H6v3h16zm-6 7H6v3h10z"}),"AlignHorizontalLeftOutlined"),_U=Ee(h.jsx("path",{d:"M20 2h2v20h-2zM2 10h16V7H2zm6 7h10v-3H8z"}),"AlignHorizontalRightOutlined"),bU=Ee(h.jsx("path",{d:"M22 22H2v-2h20zM10 2H7v16h3zm7 6h-3v10h3z"}),"AlignVerticalBottomOutlined"),yU=Ee(h.jsx("path",{d:"M22 2v2H2V2zM7 22h3V6H7zm7-6h3V6h-3z"}),"AlignVerticalTopOutlined"),Vce=Ee(h.jsx("path",{d:"m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27M12 17.5 6.5 12H10v-2h4v2h3.5zM5.12 5l.81-1h12l.94 1z"}),"Archive"),vU=Ee([h.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),h.jsx("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")],"ArticleOutlined"),Wce=Ee(h.jsx("path",{d:"M2 12.5C2 9.46 4.46 7 7.5 7H18c2.21 0 4 1.79 4 4s-1.79 4-4 4H9.5C8.12 15 7 13.88 7 12.5S8.12 10 9.5 10H17v2H9.41c-.55 0-.55 1 0 1H18c1.1 0 2-.9 2-2s-.9-2-2-2H7.5C5.57 9 4 10.57 4 12.5S5.57 16 7.5 16H17v2H7.5C4.46 18 2 15.54 2 12.5"}),"Attachment"),Tk=Ee(h.jsx("path",{d:"m19 9 1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25zm-7.5.5L9 4 6.5 9.5 1 12l5.5 2.5L9 20l2.5-5.5L17 12zM19 15l-1.25 2.75L15 19l2.75 1.25L19 23l1.25-2.75L23 19l-2.75-1.25z"}),"AutoAwesome"),Yce=Ee(h.jsx("path",{d:"M9 11H7v2h2zm4 4h-2v2h2zM9 3H7v2h2zm4 8h-2v2h2zM5 3H3v2h2zm8 4h-2v2h2zm4 4h-2v2h2zm-4-8h-2v2h2zm4 0h-2v2h2zm2 10h2v-2h-2zm0 4h2v-2h-2zM5 7H3v2h2zm14-4v2h2V3zm0 6h2V7h-2zM5 11H3v2h2zM3 21h18v-2H3zm2-6H3v2h2z"}),"BorderBottomOutlined"),Kce=Ee(h.jsx("path",{d:"M11 21h2v-2h-2zm0-4h2v-2h-2zm0-12h2V3h-2zm0 4h2V7h-2zm0 4h2v-2h-2zm-4 8h2v-2H7zM7 5h2V3H7zm0 8h2v-2H7zm-4 8h2V3H3zM19 9h2V7h-2zm-4 12h2v-2h-2zm4-4h2v-2h-2zm0-14v2h2V3zm0 10h2v-2h-2zm0 8h2v-2h-2zm-4-8h2v-2h-2zm0-8h2V3h-2z"}),"BorderLeftOutlined"),Qce=Ee(h.jsx("path",{d:"M13 7h-2v2h2zm0 4h-2v2h2zm4 0h-2v2h2zM3 3v18h18V3zm16 16H5V5h14zm-6-4h-2v2h2zm-4-4H7v2h2z"}),"BorderOuterOutlined"),Xce=Ee(h.jsx("path",{d:"M7 21h2v-2H7zM3 5h2V3H3zm4 0h2V3H7zm0 8h2v-2H7zm-4 8h2v-2H3zm8 0h2v-2h-2zm-8-8h2v-2H3zm0 4h2v-2H3zm0-8h2V7H3zm8 8h2v-2h-2zm4-4h2v-2h-2zm4-10v18h2V3zm-4 18h2v-2h-2zm0-16h2V3h-2zm-4 8h2v-2h-2zm0-8h2V3h-2zm0 4h2V7h-2z"}),"BorderRightOutlined"),Jce=Ee(h.jsx("path",{d:"M7 21h2v-2H7zm0-8h2v-2H7zm4 0h2v-2h-2zm0 8h2v-2h-2zm-8-4h2v-2H3zm0 4h2v-2H3zm0-8h2v-2H3zm0-4h2V7H3zm8 8h2v-2h-2zm8-8h2V7h-2zm0 4h2v-2h-2zM3 3v2h18V3zm16 14h2v-2h-2zm-4 4h2v-2h-2zM11 9h2V7h-2zm8 12h2v-2h-2zm-4-8h2v-2h-2z"}),"BorderTopOutlined"),Zce=Ee(h.jsx("path",{d:"M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 18H4V8h16z"}),"CalendarToday"),eue=Ee(h.jsx("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2m5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12z"}),"Cancel"),tue=Ee(h.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z"}),"CheckCircle"),Fv=Ee(h.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),nue=Ee(h.jsx("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"}),"CodeOutlined"),LO=Ee(h.jsx("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"}),"ContentCopyOutlined"),EU=Ee(h.jsx("path",{d:"M19 6H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2m0 10H5V8h14z"}),"Crop32Outlined"),iue=Ee(h.jsx("path",{d:"M19 5v2h-4V5zM9 5v6H5V5zm10 8v6h-4v-6zM9 17v2H5v-2zM21 3h-8v6h8zM11 3H3v10h8zm10 8h-8v10h8zm-10 4H3v6h8z"}),"DashboardOutlined"),rue=Ee(h.jsx("path",{d:"M9 11H7v2h2zm4 0h-2v2h2zm4 0h-2v2h2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 16H5V9h14z"}),"DateRange"),aue=Ee(h.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"}),"Delete"),sue=Ee(h.jsx("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM8 9h8v10H8zm7.5-5-1-1h-5l-1 1H5v2h14V4z"}),"DeleteOutline"),oue=Ee(h.jsx("path",{d:"M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm2 16H8v-2h8zm0-4H8v-2h8zm-3-5V3.5L18.5 9z"}),"Description"),SU=Ee(h.jsx("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}),"DragIndicator"),lue=Ee(h.jsx("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"Edit"),CU=Ee(h.jsx("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"}),"EditOutlined"),cue=Ee(h.jsx("path",{d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 4-8 5-8-5V6l8 5 8-5z"}),"Email"),uue=Ee(h.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M8.5 8c.83 0 1.5.67 1.5 1.5S9.33 11 8.5 11 7 10.33 7 9.5 7.67 8 8.5 8M12 18c-2.28 0-4.22-1.66-5-4h10c-.78 2.34-2.72 4-5 4m3.5-7c-.83 0-1.5-.67-1.5-1.5S14.67 8 15.5 8s1.5.67 1.5 1.5-.67 1.5-1.5 1.5"}),"EmojiEmotions"),due=Ee(h.jsx("path",{d:"M17 12h-5v5h5zM16 1v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-1V1zm3 18H5V8h14z"}),"Event"),pue=Ee(h.jsx("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3zm-1-4-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5z"}),"FileDownloadOutlined"),TU=Ee(h.jsx("path",{d:"M7 15v2h10v-2zm-4 6h18v-2H3zm0-8h18v-2H3zm4-6v2h10V7zM3 3v2h18V3z"}),"FormatAlignCenter"),fue=Ee(h.jsx("path",{d:"M7 15v2h10v-2zm-4 6h18v-2H3zm0-8h18v-2H3zm4-6v2h10V7zM3 3v2h18V3z"}),"FormatAlignCenterOutlined"),xU=Ee(h.jsx("path",{d:"M3 21h18v-2H3zm0-4h18v-2H3zm0-4h18v-2H3zm0-4h18V7H3zm0-6v2h18V3z"}),"FormatAlignJustify"),kU=Ee(h.jsx("path",{d:"M15 15H3v2h12zm0-8H3v2h12zM3 13h18v-2H3zm0 8h18v-2H3zM3 3v2h18V3z"}),"FormatAlignLeft"),mue=Ee(h.jsx("path",{d:"M15 15H3v2h12zm0-8H3v2h12zM3 13h18v-2H3zm0 8h18v-2H3zM3 3v2h18V3z"}),"FormatAlignLeftOutlined"),wU=Ee(h.jsx("path",{d:"M3 21h18v-2H3zm6-4h12v-2H9zm-6-4h18v-2H3zm6-4h12V7H9zM3 3v2h18V3z"}),"FormatAlignRight"),hue=Ee(h.jsx("path",{d:"M3 21h18v-2H3zm6-4h12v-2H9zm-6-4h18v-2H3zm6-4h12V7H9zM3 3v2h18V3z"}),"FormatAlignRightOutlined"),gue=Ee(h.jsx("path",{d:"M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42M10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5"}),"FormatBold"),_ue=Ee(h.jsx("path",{d:"M3.27 5 2 6.27l6.97 6.97L6.5 19h3l1.57-3.66L16.73 21 18 19.73 3.55 5.27zM6 5v.18L8.82 8h2.4l-.72 1.68 2.1 2.1L14.21 8H20V5z"}),"FormatClear"),bue=Ee(h.jsx("path",{d:"M16.56 8.94 7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12M5.21 10 10 5.21 14.79 10zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5M2 20h20v4H2z"}),"FormatColorFill"),DU=Ee(h.jsx("path",{d:"M18 14c0-4-6-10.8-6-10.8s-1.33 1.51-2.73 3.52l8.59 8.59c.09-.42.14-.86.14-1.31m-.88 3.12L12.5 12.5 5.27 5.27 4 6.55l3.32 3.32C6.55 11.32 6 12.79 6 14c0 3.31 2.69 6 6 6 1.52 0 2.9-.57 3.96-1.5l2.63 2.63 1.27-1.27z"}),"FormatColorReset"),yue=Ee(h.jsx("path",{d:"M2 20h20v4H2zm3.49-3h2.42l1.27-3.58h5.65L16.09 17h2.42L13.25 3h-2.5zm4.42-5.61 2.03-5.79h.12l2.03 5.79z"}),"FormatColorText"),vue=Ee(h.jsx("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"}),"FormatItalic"),FO=Ee(h.jsx("path",{d:"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5m0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5m0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5M7 19h14v-2H7zm0-6h14v-2H7zm0-8v2h14V5z"}),"FormatListBulleted"),BO=Ee(h.jsx("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2zm1-9h1V4H2v1h1zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2zm5-6v2h14V5zm0 14h14v-2H7zm0-6h14v-2H7z"}),"FormatListNumbered"),Eue=Ee(h.jsx("path",{d:"M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6m-7 2v2h14v-2z"}),"FormatUnderlined"),AU=Ee(h.jsx("path",{d:"M10.27 12h3.46c.93 0 1.63-.83 1.48-1.75l-.3-1.79C14.67 7.04 13.44 6 12 6S9.33 7.04 9.09 8.47l-.3 1.79c-.15.91.55 1.74 1.48 1.74m-8.61-.89c-.13.26-.18.57-.1.88.16.69.76 1.03 1.53 1h1.95c.83 0 1.51-.58 1.51-1.29 0-.14-.03-.27-.07-.4-.01-.03-.01-.05.01-.08.09-.16.14-.34.14-.53 0-.31-.14-.6-.36-.82-.03-.03-.03-.06-.02-.1.07-.2.07-.43.01-.65-.16-.43-.55-.72-.99-.74-.03 0-.05-.01-.07-.03-.17-.21-.48-.35-.83-.35-.3 0-.57.1-.75.26-.03.03-.06.03-.09.02-.14-.06-.3-.09-.46-.09-.65 0-1.18.49-1.24 1.12 0 .02-.01.04-.03.06-.29.26-.46.65-.41 1.05.03.22.12.43.25.6.03.02.03.06.02.09m14.58 2.54c-1.17-.52-2.61-.9-4.24-.9-1.63 0-3.07.39-4.24.9C6.68 14.13 6 15.21 6 16.39V18h12v-1.61c0-1.18-.68-2.26-1.76-2.74m-15.02.93C.48 14.9 0 15.62 0 16.43V18h4.5v-1.61c0-.83.23-1.61.63-2.29-.37-.06-.74-.1-1.13-.1-.99 0-1.93.21-2.78.58m21.56 0c-.85-.37-1.79-.58-2.78-.58-.39 0-.76.04-1.13.1.4.68.63 1.46.63 2.29V18H24v-1.57c0-.81-.48-1.53-1.22-1.85M22 11v-.5c0-1.1-.9-2-2-2h-2c-.42 0-.65.48-.39.81l.7.63c-.19.31-.31.67-.31 1.06 0 1.1.9 2 2 2s2-.9 2-2"}),"Groups2"),NU=Ee(h.jsx("path",{d:"M13 6.99h3L12 3 8 6.99h3v10.02H8L12 21l4-3.99h-3z"}),"HeightOutlined"),RU=Ee(h.jsx("path",{fillRule:"evenodd",d:"M4 11h16v2H4z"}),"HorizontalRuleOutlined"),IU=Ee(h.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-4.86 8.86-3 3.87L9 13.14 6 17h12z"}),"ImageOutlined"),OU=Ee(h.jsx("path",{d:"M18 13v7H4V6h5.02c.05-.71.22-1.38.48-2H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-5zm-1.5 5h-11l2.75-3.53 1.96 2.36 2.75-3.54zm2.8-9.11c.44-.7.7-1.51.7-2.39C20 4.01 17.99 2 15.5 2S11 4.01 11 6.5s2.01 4.5 4.49 4.5c.88 0 1.7-.26 2.39-.7L21 13.42 22.42 12zM15.5 9C14.12 9 13 7.88 13 6.5S14.12 4 15.5 4 18 5.12 18 6.5 16.88 9 15.5 9"}),"ImageSearchOutlined"),Sue=Ee(h.jsx("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown"),Cue=Ee(h.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56M12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96M4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2 0 .68.06 1.34.14 2zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56m2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8M12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96M14.34 14H9.66c-.09-.66-.16-1.32-.16-2 0-.68.07-1.35.16-2h4.68c.09.65.16 1.32.16 2 0 .68-.07 1.34-.16 2m.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56M16.36 14c.08-.66.14-1.32.14-2 0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2z"}),"Language"),MU=Ee(h.jsx("path",{d:"M4 6H2v14c0 1.1.9 2 2 2h14v-2H4zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m0 14H8V4h12zm-7-2h2v-3h3V9h-3V6h-2v3h-3v2h3z"}),"LibraryAddOutlined"),fA=Ee(h.jsx("path",{d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1M8 13h8v-2H8zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5"}),"Link"),Tue=Ee(h.jsx("path",{d:"m21.41 11.58-9-9C12.05 2.22 11.55 2 11 2H4c-1.1 0-2 .9-2 2v7c0 .55.22 1.05.59 1.42l9 9c.36.36.86.58 1.41.58.55 0 1.05-.22 1.41-.59l7-7c.37-.36.59-.86.59-1.41 0-.55-.23-1.06-.59-1.42M5.5 7C4.67 7 4 6.33 4 5.5S4.67 4 5.5 4 7 4.67 7 5.5 6.33 7 5.5 7"}),"LocalOffer"),Qh=Ee(h.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1z"}),"Lock"),Xh=Ee(h.jsx("path",{d:"M12 17c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m6-9h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6h1.9c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m0 12H6V10h12z"}),"LockOpen"),xue=Ee(h.jsx("path",{d:"M20 3H4c-1.1 0-2 .9-2 2v11c0 1.1.9 2 2 2h3l-1 1v2h12v-2l-1-1h3c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 13H4V5h16z"}),"MonitorOutlined"),kue=Ee(h.jsx("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4m0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4"}),"Person"),wue=Ee(h.jsx("path",{d:"M15.5 1h-8C6.12 1 5 2.12 5 3.5v17C5 21.88 6.12 23 7.5 23h8c1.38 0 2.5-1.12 2.5-2.5v-17C18 2.12 16.88 1 15.5 1m-4 21c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m4.5-4H7V4h9z"}),"PhoneIphoneOutlined"),PU=Ee(h.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-4.86 8.86-3 3.87L9 13.14 6 17h12z"}),"PhotoOutlined"),LU=Ee(h.jsx("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh"),Rf=Ee(h.jsx("path",{d:"M19 19h2v2h-2zm0-2h2v-2h-2zM3 13h2v-2H3zm0 4h2v-2H3zm0-8h2V7H3zm0-4h2V3H3zm4 0h2V3H7zm8 16h2v-2h-2zm-4 0h2v-2h-2zm4 0h2v-2h-2zm-8 0h2v-2H7zm-4 0h2v-2H3zM21 8c0-2.76-2.24-5-5-5h-5v2h5c1.65 0 3 1.35 3 3v5h2z"}),"RoundedCorner"),Due=Ee(h.jsx("path",{d:"M19 19h2v2h-2zm0-2h2v-2h-2zM3 13h2v-2H3zm0 4h2v-2H3zm0-8h2V7H3zm0-4h2V3H3zm4 0h2V3H7zm8 16h2v-2h-2zm-4 0h2v-2h-2zm4 0h2v-2h-2zm-8 0h2v-2H7zm-4 0h2v-2H3zM21 8c0-2.76-2.24-5-5-5h-5v2h5c1.65 0 3 1.35 3 3v5h2z"}),"RoundedCornerOutlined"),Aue=Ee(h.jsx("path",{d:"M4 9h16v2H4zm0 4h10v2H4z"}),"ShortText"),FU=Ee(h.jsx("path",{d:"M22 9v6c0 1.1-.9 2-2 2h-1v-2h1V9H4v6h6v2H4c-1.1 0-2-.9-2-2V9c0-1.1.9-2 2-2h16c1.1 0 2 .9 2 2m-7.5 10 1.09-2.41L18 15.5l-2.41-1.09L14.5 12l-1.09 2.41L11 15.5l2.41 1.09zm2.5-5 .62-1.38L19 12l-1.38-.62L17 10l-.62 1.38L15 12l1.38.62zm-2.5 5 1.09-2.41L18 15.5l-2.41-1.09L14.5 12l-1.09 2.41L11 15.5l2.41 1.09zm2.5-5 .62-1.38L19 12l-1.38-.62L17 10l-.62 1.38L15 12l1.38.62z"}),"SmartButtonOutlined"),$O=Ee(h.jsx("path",{d:"M18 9v4H6V9H4v6h16V9z"}),"SpaceBar"),Nue=Ee(h.jsx("path",{d:"M6.85 7.08C6.85 4.37 9.45 3 12.24 3c1.64 0 3 .49 3.9 1.28.77.65 1.46 1.73 1.46 3.24h-3.01c0-.31-.05-.59-.15-.85-.29-.86-1.2-1.28-2.25-1.28-1.86 0-2.34 1.02-2.34 1.7 0 .48.25.88.74 1.21.38.25.77.48 1.41.7H7.39c-.21-.34-.54-.89-.54-1.92M21 12v-2H3v2h9.62c1.15.45 1.96.75 1.96 1.97 0 1-.81 1.67-2.28 1.67-1.54 0-2.93-.54-2.93-2.51H6.4c0 .55.08 1.13.24 1.58.81 2.29 3.29 3.3 5.67 3.3 2.27 0 5.3-.89 5.3-4.05 0-.3-.01-1.16-.48-1.94H21z"}),"StrikethroughS"),Rue=Ee(h.jsx("path",{d:"M14 17H4v2h10zm6-8H4v2h16zM4 15h16v-2H4zM4 5v2h16V5z"}),"Subject"),BU=Ee(h.jsx("path",{d:"M2.5 4v3h5v12h3V7h5V4zm19 5h-9v3h3v7h3v-7h3z"}),"TextFieldsOutlined"),Iue=Ee(h.jsx("path",{d:"M5 4v3h5.5v12h3V7H19V4z"}),"Title"),Oue=Ee(h.jsx("path",{d:"M16 13h-3V3h-2v10H8l4 4zM4 19v2h16v-2z"}),"VerticalAlignBottomOutlined"),Mue=Ee(h.jsx("path",{d:"M8 19h3v4h2v-4h3l-4-4zm8-14h-3V1h-2v4H8l4 4zM4 11v2h16v-2z"}),"VerticalAlignCenterOutlined"),Pue=Ee(h.jsx("path",{d:"M8 11h3v10h2V11h3l-4-4zM4 3v2h16V3z"}),"VerticalAlignTopOutlined"),$U=Ee(h.jsx("path",{d:"M3 5v14h18V5zm5.33 12H5V7h3.33zm5.34 0h-3.33V7h3.33zM19 17h-3.33V7H19z"}),"ViewColumnOutlined"),UU=Ee(h.jsx("path",{d:"m16.66 4.52 2.83 2.83-2.83 2.83-2.83-2.83zM9 5v4H5V5zm10 10v4h-4v-4zM9 15v4H5v-4zm7.66-13.31L11 7.34 16.66 13l5.66-5.66zM11 3H3v8h8zm10 10h-8v8h8zm-10 0H3v8h8z"}),"WidgetsOutlined"),Lue=Ee(h.jsx("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2M4 18V6h2v12zm4 0V6h8v12zm12 0h-2V6h2z"}),"WidthWideOutlined"),Ki=({children:t})=>h.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.3rem"},children:t.map(e=>e)}),$n=({label:t})=>{const e=Xt();return t==null||t===""?null:h.jsx("p",{style:{fontWeight:"bold",color:e.palette.text.primary},children:t})};function Wp(){return(Wp=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 Bv(t,e){if(t==null)return{};var n,i,r={},a=Object.keys(t);for(i=0;i<a.length;i++)e.indexOf(n=a[i])>=0||(r[n]=t[n]);return r}function lh(t){var e=D.useRef(t),n=D.useRef(function(i){e.current&&e.current(i)});return e.current=t,n.current}var ch=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t<e?e:t},Tm=function(t){return"touches"in t},xk=function(t){return t&&t.ownerDocument.defaultView||self},UO=function(t,e,n){var i=t.getBoundingClientRect(),r=Tm(e)?(function(a,s){for(var o=0;o<a.length;o++)if(a[o].identifier===s)return a[o];return a[0]})(e.touches,n):e;return{left:ch((r.pageX-(i.left+xk(t).pageXOffset))/i.width),top:ch((r.pageY-(i.top+xk(t).pageYOffset))/i.height)}},zO=function(t){!Tm(t)&&t.preventDefault()},zU=D.memo(function(t){var e=t.onMove,n=t.onKey,i=Bv(t,["onMove","onKey"]),r=D.useRef(null),a=lh(e),s=lh(n),o=D.useRef(null),l=D.useRef(!1),c=D.useMemo(function(){var f=function(_){zO(_),(Tm(_)?_.touches.length>0:_.buttons>0)&&r.current?a(UO(r.current,_,o.current)):g(!1)},m=function(){return g(!1)};function g(_){var b=l.current,y=xk(r.current),E=_?y.addEventListener:y.removeEventListener;E(b?"touchmove":"mousemove",f),E(b?"touchend":"mouseup",m)}return[function(_){var b=_.nativeEvent,y=r.current;if(y&&(zO(b),!(function(v,T){return T&&!Tm(v)})(b,l.current)&&y)){if(Tm(b)){l.current=!0;var E=b.changedTouches||[];E.length&&(o.current=E[0].identifier)}y.focus(),a(UO(y,b,o.current)),g(!0)}},function(_){var b=_.which||_.keyCode;b<37||b>40||(_.preventDefault(),s({left:b===39?.05:b===37?-.05:0,top:b===40?.05:b===38?-.05:0}))},g]},[s,a]),u=c[0],d=c[1],p=c[2];return D.useEffect(function(){return p},[p]),D.createElement("div",Wp({},i,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:r,onKeyDown:d,tabIndex:0,role:"slider"}))}),mA=function(t){return t.filter(Boolean).join(" ")},GU=function(t){var e=t.color,n=t.left,i=t.top,r=i===void 0?.5:i,a=mA(["react-colorful__pointer",t.className]);return D.createElement("div",{className:a,style:{top:100*r+"%",left:100*n+"%"}},D.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},Vi=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n},Fue=function(t){return Gue(kk(t))},kk=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?Vi(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?Vi(parseInt(t.substring(6,8),16)/255,2):1}},Bue=function(t){return zue(Uue(t))},$ue=function(t){var e=t.s,n=t.v,i=t.a,r=(200-e)*n/100;return{h:Vi(t.h),s:Vi(r>0&&r<200?e*n/100/(r<=100?r:200-r)*100:0),l:Vi(r/2),a:Vi(i,2)}},wk=function(t){var e=$ue(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},Uue=function(t){var e=t.h,n=t.s,i=t.v,r=t.a;e=e/360*6,n/=100,i/=100;var a=Math.floor(e),s=i*(1-n),o=i*(1-(e-a)*n),l=i*(1-(1-e+a)*n),c=a%6;return{r:Vi(255*[i,o,s,s,l,i][c]),g:Vi(255*[l,i,i,o,s,s][c]),b:Vi(255*[s,s,l,i,i,o][c]),a:Vi(r,2)}},qg=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},zue=function(t){var e=t.r,n=t.g,i=t.b,r=t.a,a=r<1?qg(Vi(255*r)):"";return"#"+qg(e)+qg(n)+qg(i)+a},Gue=function(t){var e=t.r,n=t.g,i=t.b,r=t.a,a=Math.max(e,n,i),s=a-Math.min(e,n,i),o=s?a===e?(n-i)/s:a===n?2+(i-e)/s:4+(e-n)/s:0;return{h:Vi(60*(o<0?o+6:o)),s:Vi(a?s/a*100:0),v:Vi(a/255*100),a:r}},Hue=D.memo(function(t){var e=t.hue,n=t.onChange,i=mA(["react-colorful__hue",t.className]);return D.createElement("div",{className:i},D.createElement(zU,{onMove:function(r){n({h:360*r.left})},onKey:function(r){n({h:ch(e+360*r.left,0,360)})},"aria-label":"Hue","aria-valuenow":Vi(e),"aria-valuemax":"360","aria-valuemin":"0"},D.createElement(GU,{className:"react-colorful__hue-pointer",left:e/360,color:wk({h:e,s:100,v:100,a:1})})))}),jue=D.memo(function(t){var e=t.hsva,n=t.onChange,i={backgroundColor:wk({h:e.h,s:100,v:100,a:1})};return D.createElement("div",{className:"react-colorful__saturation",style:i},D.createElement(zU,{onMove:function(r){n({s:100*r.left,v:100-100*r.top})},onKey:function(r){n({s:ch(e.s+100*r.left,0,100),v:ch(e.v-100*r.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Vi(e.s)+"%, Brightness "+Vi(e.v)+"%"},D.createElement(GU,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:wk(e)})))}),HU=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0},que=function(t,e){return t.toLowerCase()===e.toLowerCase()||HU(kk(t),kk(e))};function Vue(t,e,n){var i=lh(n),r=D.useState(function(){return t.toHsva(e)}),a=r[0],s=r[1],o=D.useRef({color:e,hsva:a});D.useEffect(function(){if(!t.equal(e,o.current.color)){var c=t.toHsva(e);o.current={hsva:c,color:e},s(c)}},[e,t]),D.useEffect(function(){var c;HU(a,o.current.hsva)||t.equal(c=t.fromHsva(a),o.current.color)||(o.current={hsva:a,color:c},i(c))},[a,t,i]);var l=D.useCallback(function(c){s(function(u){return Object.assign({},u,c)})},[]);return[a,l]}var Wue=typeof window<"u"?D.useLayoutEffect:D.useEffect,Yue=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},GO=new Map,Kue=function(t){Wue(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!GO.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}`,GO.set(e,n);var i=Yue();i&&n.setAttribute("nonce",i),e.head.appendChild(n)}},[])},Que=function(t){var e=t.className,n=t.colorModel,i=t.color,r=i===void 0?n.defaultColor:i,a=t.onChange,s=Bv(t,["className","colorModel","color","onChange"]),o=D.useRef(null);Kue(o);var l=Vue(n,r,a),c=l[0],u=l[1],d=mA(["react-colorful",e]);return D.createElement("div",Wp({},s,{ref:o,className:d}),D.createElement(jue,{hsva:c,onChange:u}),D.createElement(Hue,{hue:c.h,onChange:u,className:"react-colorful__last-control"}))},Xue={defaultColor:"000",toHsva:Fue,fromHsva:function(t){return Bue({h:t.h,s:t.s,v:t.v,a:1})},equal:que},Jue=function(t){return D.createElement(Que,Wp({},t,{colorModel:Xue}))},Zue=/^#?([0-9A-F]{3,8})$/i,ede=function(t){var e=t.color,n=e===void 0?"":e,i=t.onChange,r=t.onBlur,a=t.escape,s=t.validate,o=t.format,l=t.process,c=Bv(t,["color","onChange","onBlur","escape","validate","format","process"]),u=D.useState(function(){return a(n)}),d=u[0],p=u[1],f=lh(i),m=lh(r),g=D.useCallback(function(b){var y=a(b.target.value);p(y),s(y)&&f(l?l(y):y)},[a,l,s,f]),_=D.useCallback(function(b){s(b.target.value)||p(a(n)),m(b)},[n,a,s,m]);return D.useEffect(function(){p(a(n))},[n,a]),D.createElement("input",Wp({},c,{value:o?o(d):d,spellCheck:"false",onChange:g,onBlur:_}))},HO=function(t){return"#"+t},tde=function(t){var e=t.prefixed,n=t.alpha,i=Bv(t,["prefixed","alpha"]),r=D.useCallback(function(s){return s.replace(/([^0-9A-F]+)/gi,"").substring(0,n?8:6)},[n]),a=D.useCallback(function(s){return(function(o,l){var c=Zue.exec(o),u=c?c[1].length:0;return u===3||u===6||!!l&&u===4||!!l&&u===8})(s,n)},[n]);return D.createElement(ede,Wp({},i,{escape:r,format:e?HO:void 0,process:HO,validate:a}))};const jO={width:24,height:24};function nde({paletteColors:t,isLocked:e,onToggleLock:n,onChange:i}){const r=Xt(),{t:a}=nt.useTranslation("inspector"),s=t.slice(30);return h.jsxs(_n,{spacing:1,children:[h.jsx("div",{style:{height:1,width:"100%",margin:"8px 0",backgroundColor:r.palette.grey[400]}}),h.jsxs(We,{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"4px",children:[s.map((o,l)=>h.jsx(qi,{sx:{...jO,backgroundColor:o,border:"1px solid",margin:"0!important",borderColor:r.palette.grey[50],minWidth:24,display:"inline-flex","&:hover":{backgroundColor:o,borderColor:"grey.500"}},onClick:()=>i&&i(o)},l+29)),n&&h.jsx(qi,{onClick:n,sx:{backgroundColor:"transparent",border:"1px solid",...jO,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:a(e?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:e?h.jsx(Qh,{fontSize:"small"}):h.jsx(Xh,{fontSize:"small"})})]})]})}const ide={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%"}},qO=(t,e)=>{if(!t||t.trim()==="")return e;const i=e.slice(-5),r=e.slice(0,30),a=i.filter(o=>o!==t&&o!==""),s=[t,...a].slice(0,5);for(;s.length<5;)s.push("");return[...r,...s]};function hA({value:t,nullable:e,onChange:n}){const[i,r]=D.useState(t||"#000000"),[a,s]=D.useState(null),{paletteColors:o,isLocked:l}=cce(),[c,u]=D.useState(!1),d=Xt(),p=D.useCallback(b=>{if(l)return;a&&clearTimeout(a);const y=setTimeout(()=>{const E=qO(b,o);vS({paletteColors:E})},300);s(y)},[a,l,o]),f=()=>{const b=!l;if(vS({isLocked:b}),!b&&i){const y=qO(i,o);vS({isLocked:b,paletteColors:y})}},m=b=>{u(!0),r(b)},g=()=>{n(i),p(i)},_=b=>{r(b),n(b),p(b)};return D.useEffect(()=>{t!==i&&r(t||"#000000")},[t]),D.useEffect(()=>()=>{a&&clearTimeout(a)},[a]),h.jsxs(_n,{spacing:1,sx:ide,children:[h.jsx(Jue,{color:i,onChange:m,onMouseUp:g,onTouchEnd:g,onMouseLeave:()=>{c&&(g(),u(!1))}}),h.jsx(nde,{isLocked:l,onToggleLock:f,paletteColors:o,value:t,nullable:e,onChange:b=>{b?(r(b),n(b),p(b)):n(null)}}),h.jsxs(We,{pt:1,display:"flex",gap:1,alignItems:"center",children:[h.jsx(tde,{prefixed:!0,color:i,onChange:_,style:{flex:1,backgroundColor:d.palette.background.paper,color:d.palette.text.primary,padding:"1px 4px",fontSize:"12px"}}),e&&h.jsx(qi,{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(DU,{color:"primary",fontSize:"small"})})]})]})}function jU({label:t,defaultValue:e,onChange:n,nullable:i,compact:r=!1,...a}){const[s,o]=D.useState(null),[l,c]=D.useState(e),{t:u}=nt.useTranslation("inspector");D.useEffect(()=>{l!==e&&c(e)},[e]);const d=b=>{o(b.currentTarget)},p=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"},f=b=>{c(b),n(b)},m=()=>!i||typeof l!="string"||l.trim().length===0?null:h.jsx(Nn,{disableInteractive:!0,arrow:!0,title:u("inputs.background.reset"),placement:"left",children:h.jsx(We,{sx:{minWidth:24,lineHeight:1,flexShrink:0,pr:"4px",display:"grid",placeItems:"center"},onClick:()=>f(null),children:h.jsx(DU,{sx:{color:"primary.main"}})})}),g=l?h.jsx(Pa,{onClick:d,sx:{...p,bgcolor:l}}):h.jsx(Pa,{onClick:d,sx:{...p},children:h.jsx(pA,{fontSize:"small"})}),_=h.jsx(qD,{anchorEl:s,open:!!s,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(hA,{value:l||"",nullable:i,onChange:b=>f(b)})});return r?h.jsxs(h.Fragment,{children:[g,_]}):h.jsxs(Ki,{children:[h.jsx($n,{label:t}),h.jsxs(_n,{direction:"row",alignContent:"center",spacing:1,children:[g,m()]}),_]})}function Zc(t){return h.jsx(jU,{...t,nullable:!1})}function SS(t){return h.jsx(jU,{...t,nullable:!0})}const Ud=36,gA=8,$v={width:"100%","& .MuiInputBase-root":{"&:not(.MuiInputBase-multiline)":{height:`${Ud}px`}},"& .MuiOutlinedInput-root":{borderRadius:`${gA}px`,"&:not(.MuiInputBase-multiline)":{height:`${Ud}px`}},"& .MuiInputBase-input":{paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",height:"unset"}},rde={width:"100%",height:`${Ud}px`,paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",display:"flex",alignItems:"center",borderRadius:`${gA}px`};function lc({label:t,children:e,defaultValue:n,onChange:i}){const[r,a]=D.useState(n);return D.useEffect(()=>{n!==r&&a(n)},[n]),h.jsxs(Ki,{children:[h.jsx($n,{label:t}),h.jsx(We,{sx:{...rde,paddingLeft:"0px",paddingRight:"0px"},children:h.jsx(Hh,{exclusive:!0,fullWidth:!0,value:r,size:"small",sx:{width:"100%"},onChange:(s,o)=>{if(typeof o!="string")throw new Error("RadioGroupInput can only receive string values");a(o),i(o)},children:e})})]})}const ade=de(We)(({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}`}})),sde=de("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"}})),VO=de(Wn)(({theme:t})=>({padding:"0",color:t.palette.primary.main,"&:hover":{backgroundColor:we(t.palette.primary.main,.04)},"& .MuiSvgIcon-root":{fontSize:14}}));function di({iconLabel:t,label:e,value:n,setValue:i,units:r,min:a=0,max:s,step:o=void 0,marks:l=!0,...c}){const u=n??a,[d,p]=D.useState(u.toString()),f=v=>{let T=v;T<a&&(T=a),s!==void 0&&T>s&&(T=s),i(T),p(T.toString())},m=v=>{const T=v.target.value;if(p(T),T!==""){const S=Number(T);isNaN(S)||S>=a&&i(S)}},g=()=>{if(d===""||isNaN(Number(d)))p(u.toString());else{const v=Number(d);f(v)}},_=v=>{v.key==="Enter"&&g()};D.useEffect(()=>{p((n??a).toString())},[n,a]);const b=()=>{const v=u+1;f(v)},y=()=>{const v=u-1;f(v)},E=(v,T)=>{typeof T=="number"&&i(T)};return h.jsxs(Ki,{children:[h.jsx($n,{label:e}),h.jsxs(_n,{direction:"row",alignItems:"center",spacing:2,justifyContent:"space-between",width:"100%",children:[h.jsx(We,{sx:{minWidth:24,lineHeight:1,flexShrink:0},children:t}),h.jsx(H_,{...c,value:u,min:a,max:s||1e3,step:o,color:"primary",marks:l,onChange:E}),h.jsxs(ade,{children:[h.jsx(sde,{type:"number",value:d,onChange:m,onBlur:g,onKeyDown:_,min:a,max:s,step:o}),h.jsxs(We,{sx:{display:"flex",flexDirection:"column",ml:.5},children:[h.jsx(VO,{onClick:b,disabled:s!==void 0&&u>=s,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(VO,{onClick:y,disabled:u<=a,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(gn,{variant:"caption",color:"text.secondary",sx:{fontSize:"16px",ml:"4px!important"},children:r})]})]})}function WO(t){return{top:Number(t.top??0),bottom:Number(t.bottom??0),left:Number(t.left??0),right:Number(t.right??0)}}function ode({size:t,sizeMobile:e,sizePaddingSidesLinked:n,sizeMobilePaddingSidesLinked:i,onChange:r,label:a,maxValue:s=100,paddingSteps:o=8}){const{t:l}=nt.useTranslation("inspector"),c=a??l("inputs.common.size"),u=fi(),[d,p]=D.useState(()=>{const v=u==="desktop"?t:e!==void 0?e:t;return typeof v=="object"&&v!==null?WO(v):{top:8,bottom:8,left:16,right:16}}),f=u==="desktop"?n===!0:i===!0;D.useEffect(()=>{const v=u==="desktop"?t:e!==void 0?e:t;typeof v=="object"&&v!==null&&p(WO(v))},[t,e,u]);const m=()=>{const v=u==="desktop"?t:e!==void 0?e:t;return typeof v=="object"&&v!==null?"custom":typeof v=="string"?v:"medium"},g=typeof s=="number"?s:Number(s)||100,_=v=>{if(u==="desktop"){const T={size:v==="custom"?d:v};e==null&&(T.sizeMobile=v==="custom"?d:v),r(T)}else r({sizeMobile:v==="custom"?d:v})},b=(v,T)=>{let S;f?S={top:T,bottom:T,left:T,right:T}:S={...d,[v]:T},p(S),r(u==="desktop"?{size:S}:{sizeMobile:S})},y=()=>{if(u==="desktop")if(f)r({sizePaddingSidesLinked:!1});else{const v={top:d.top,bottom:d.top,left:d.top,right:d.top};p(v),r({size:v,sizePaddingSidesLinked:!0})}else if(f)r({sizeMobilePaddingSidesLinked:!1});else{const v={top:d.top,bottom:d.top,left:d.top,right:d.top};p(v),r({sizeMobile:v,sizeMobilePaddingSidesLinked:!0})}},E=m();return h.jsxs(_n,{spacing:2,children:[h.jsxs(lc,{label:c,defaultValue:E,onChange:_,children:[h.jsx(ln,{value:"x-small",children:l("inputs.responsiveSize.options.xSmall")}),h.jsx(ln,{value:"small",children:l("inputs.responsiveSize.options.small")}),h.jsx(ln,{value:"medium",children:l("inputs.responsiveSize.options.medium")}),h.jsx(ln,{value:"custom",children:l("inputs.responsiveSize.options.custom")})]}),E==="custom"&&h.jsxs(_n,{spacing:2,alignItems:"flexStart",pb:1,children:[h.jsxs(_n,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[h.jsx($n,{label:l("inputs.responsiveSize.customPadding")}),h.jsx(Nn,{title:l(f?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:h.jsx(Wn,{size:"small",onClick:y,sx:{marginTop:"0!important",color:f?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:f?h.jsx(Qh,{fontSize:"small"}):h.jsx(Xh,{fontSize:"small"})})})]}),f?h.jsx(di,{iconLabel:h.jsx(gn,{variant:"body2",component:"span",children:l("inputs.responsiveSize.allSides")}),value:d.top,setValue:v=>b("top",v),units:"px",min:0,step:o,marks:o>1,max:g}):h.jsxs(h.Fragment,{children:[h.jsx(di,{iconLabel:h.jsx(yU,{sx:{fontSize:16}}),value:d.top,setValue:v=>b("top",v),units:"px",min:0,step:o,marks:o>1,max:g}),h.jsx(di,{iconLabel:h.jsx(bU,{sx:{fontSize:16}}),value:d.bottom,setValue:v=>b("bottom",v),units:"px",min:0,step:o,marks:o>1,max:g}),h.jsx(di,{iconLabel:h.jsx(gU,{sx:{fontSize:16}}),value:d.left,setValue:v=>b("left",v),units:"px",min:0,step:o,marks:o>1,max:g}),h.jsx(di,{iconLabel:h.jsx(_U,{sx:{fontSize:16}}),value:d.right,setValue:v=>b("right",v),units:"px",min:0,step:o,marks:o>1,max:g})]})]})]})}function lde({fullWidth:t,fullWidthMobile:e,onChange:n,label:i="Width"}){const r=fi(),{t:a}=nt.useTranslation("inspector"),s=()=>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=s();return h.jsxs(lc,{label:i,defaultValue:l?"FULL_WIDTH":"AUTO",onChange:o,children:[h.jsx(ln,{value:"FULL_WIDTH",children:a("inputs.width.full")}),h.jsx(ln,{value:"AUTO",children:a("inputs.width.auto")})]})}function cde(t,e){const n=D.useRef(null),i=D.useRef(t),r=D.useRef([]);i.current=t;const a=D.useCallback((...s)=>{r.current=s,n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{i.current(...s),n.current=null},e)},[e]);return a.flush=D.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=null,i.current(...r.current))},[]),a}function dp({helperText:t,label:e,placeholder:n,rows:i,InputProps:r,defaultValue:a,onChange:s}){const[o,l]=D.useState(a);D.useEffect(()=>{o!==a&&l(a)},[a]);const c=cde(d=>{s(d)},150),u=typeof i=="number"&&i>1;return h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx($n,{label:e}),h.jsx(jp,{fullWidth:!0,multiline:u,minRows:i,variant:"outlined",placeholder:n,helperText:t,InputProps:r,value:o,sx:$v,onChange:d=>{const p=d.target.value;l(p),c(p)},onBlur:()=>{c.flush()}})]})}function ude({onClick:t,disabled:e,primary:n=!1}){const{t:i}=nt.useTranslation("inspector");return h.jsx(Wn,{"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(Fv,{})})}function dde({imageUrl:t,saving:e=!1}){return h.jsxs(wne,{sx:{position:"relative"},children:[e&&h.jsx(_n,{justifyContent:"center",alignItems:"center",sx:{position:"absolute",top:7,left:0,width:"100%",height:"314px",zIndex:20,backgroundColor:"#212121AA",mb:1},children:h.jsx(Kl,{size:48,thickness:6,color:"inherit",sx:{color:"white"}})}),h.jsx(Mne,{component:"img",sx:{objectFit:"contain",width:"100%",height:"326px"},image:t,alt:"Generated Image"})]})}function pde({value:t,onChange:e,disabled:n}){return h.jsxs(h.Fragment,{children:[h.jsx(gn,{sx:{fontSize:"14px",fontWeight:700},children:"Image description"}),h.jsx(jp,{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 fde=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 qU({src:t,style:e}){const{t:n}=nt.useTranslation("inspector"),[i,r]=D.useState(!1),[a,s]=D.useState(!1),[o,l]=D.useState(""),[c,u]=D.useState(null),[d,p]=D.useState(!1),[f,m]=D.useState(null),[g,_]=D.useState(!1),b=()=>{r(!0),m(null)},y=()=>{a||(r(!1),s(!1),u(null),l(""),p(!1),m(null),_(!1))},E=()=>{const S=c&&!d?"store-ai-image":"request-ai-image",C=c&&!d?c:o;m(null),S==="store-ai-image"?(_(!0),s(!1),setTimeout(()=>{s(!1),y()},2e3)):s(!0),window.dispatchEvent(new CustomEvent(S,{detail:C}))},v=()=>{p(!0),u(null),m(null),_(!1)};D.useEffect(()=>{const S=C=>{const{detail:x}=C;if(s(!1),x.error){m(fde(x.error));return}if(!x.success||!x.url){m({code:0,title:"Generation Failed",message:"Failed to generate the image.",action:"Please try again"});return}u(x.url),p(!1)};return window.addEventListener("generated-image",S),()=>{window.removeEventListener("generated-image",S)}},[]),D.useEffect(()=>{y()},[t]);const T=!c||d;return h.jsxs(h.Fragment,{children:[h.jsx(qi,{style:e,startIcon:h.jsx(Tk,{className:"w-4 h-4"}),variant:"contained",onClick:b,children:n("inputs.aiImageGeneration.generate")}),h.jsx(Sie,{open:i,onClose:y,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{bgcolor:"background.paper",color:"text.primary",borderRadius:"8px"}},children:h.jsxs("form",{onSubmit:S=>{S.preventDefault(),E()},children:[h.jsxs(Hie,{sx:{fontWeight:700,fontSize:"24px",color:f?"error.main":"inherit"},children:[n(f?"inputs.aiImageGeneration.titleError":a?"inputs.aiImageGeneration.titleLoading":c?"inputs.aiImageGeneration.titleReady":"inputs.aiImageGeneration.titleCreate"),h.jsx(ude,{onClick:y,disabled:a,primary:!0})]}),h.jsxs(Mie,{children:[h.jsx($ie,{sx:{pb:1,color:f?"error.dark":"inherit"},children:n(f?"inputs.aiImageGeneration.descriptionError":a?"inputs.aiImageGeneration.descriptionLoading":T?"inputs.aiImageGeneration.descriptionCreate":"inputs.aiImageGeneration.descriptionReady")}),c&&!d?h.jsxs(_n,{sx:{position:"relative"},children:[h.jsx(dde,{imageUrl:c,saving:g}),h.jsxs($l,{variant:"outlined",severity:"warning",icon:!1,children:[n("inputs.aiImageGeneration.warningRegenerate")," ",h.jsx("b",{children:n("inputs.aiImageGeneration.warningInsertFirst")})," ",n("inputs.aiImageGeneration.warningFirst")]})]}):a&&!c?h.jsx(_n,{justifyContent:"center",alignItems:"center",sx:{backgroundColor:S=>S.palette.mainColor[50],height:"326px",width:"100%"},children:h.jsx(Kl,{size:48,thickness:6})}):h.jsx(pde,{value:o,onChange:l,disabled:a})]}),!a&&h.jsxs(wie,{className:"p-6",children:[c&&!d&&h.jsx(qi,{startIcon:h.jsx(LU,{className:"w-4 h-4"}),onClick:v,variant:"outlined",disabled:a,children:n("inputs.aiImageGeneration.regenerate")}),!c&&!d&&h.jsx(qi,{onClick:y,variant:"text",disabled:d,children:n("inputs.aiImageGeneration.cancel")}),h.jsxs(qi,{startIcon:c&&!d?h.jsx(Wce,{className:"w-4 h-4"}):h.jsx(Tk,{className:"w-4 h-4"}),onClick:E,variant:"contained",disabled:!o||o?.length<20,children:[n(c&&!d?"inputs.aiImageGeneration.insertImage":"inputs.aiImageGeneration.generateImage"),a&&h.jsx(Kl,{size:16,className:"ml-2"})]})]})]})})]})}const mde=({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"})}),hde=de(KD)(({theme:t})=>({fontFamily:t.typography.fontFamily,color:t.palette.text.primary,backgroundColor:t.palette.background.input??t.palette.grey[100],width:"100%",height:`${Ud}px`,"&.MuiInputBase-root, &.MuiOutlinedInput-root":{height:`${Ud}px`,minHeight:`${Ud}px`,boxSizing:"border-box",borderRadius:`${gA}px`,border:`1px solid ${t.palette.divider}`},"&& .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.grey[200]},"&.Mui-focused":{borderColor:t.palette.primary.main}})),Jl=D.forwardRef((t,e)=>{const n=Xt(),i={backgroundColor:n.palette.background.input??n.palette.grey[100],marginTop:"4px",borderRadius:"10px",border:`1px solid ${n.palette.divider}`,boxShadow:`0 1px 3px ${we("#000000",.6)}`,color:n.palette.text.primary},r={...t.MenuProps?.PaperProps,sx:{...typeof t.MenuProps?.PaperProps?.sx=="object"&&t.MenuProps.PaperProps?.sx,...i}},a=t.MenuProps?.slotProps??{},s=a.paper??{};return h.jsx(hde,{ref:e,...t,IconComponent:mde,MenuProps:{...t.MenuProps,PaperProps:r,slotProps:{...a,paper:{...s,...r,sx:{...typeof s.sx=="object"&&s.sx,...typeof t.MenuProps?.PaperProps?.sx=="object"&&t.MenuProps.PaperProps?.sx,...i}}}}})});Jl.displayName="CustomSelect";const gde=({defaultValue:t,onChange:e,values:n})=>{const i=Yh(),{t:r}=nt.useTranslation("inspector"),a=Xt(),s=()=>h.jsx(Ma,{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"})}),o=V=>{if(!V)return{url:"",repeat:"no-repeat",position:"center center",size:"cover"};const ee=V.match(/url\("([^"]+)"\)/),Me=ee?ee[1]:"";let be="no-repeat";V.includes("repeat-x")?be="repeat-x":V.includes("repeat-y")?be="repeat-y":V.includes("repeat")&&!V.includes("no-repeat")&&(be="repeat");let me="center center";const le=["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"];for(const Xe of le)if(V.includes(Xe)){me=Xe;break}let Ye="cover";return V.includes("contain")?Ye="contain":V.includes("auto")&&(Ye="auto"),{url:Me,repeat:be,position:me,size:Ye}},l=V=>V.url?`url("${V.url}") ${V.repeat} ${V.position} / ${V.size}`:"",[c,u]=D.useState(t||null),[d,p]=D.useState(o(t)),[f,m]=D.useState(!1),[g,_]=D.useState(()=>!!window.__emailBuilderEnableAI),[,b]=D.useState(null),[y,E]=D.useState(o(t).url||""),[v,T]=D.useState(!1),[S,C]=D.useState(""),[x,k]=D.useState(!1),w=D.useRef(null),A=oA(),[L,I]=D.useState(null);D.useEffect(()=>{const V=window.__emailBuilderCustomImageProvider;V&&(I(V),setTimeout(()=>{i&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:i,currentImageUrl:d.url||null,alt:null}}))},100))},[]);const[O,M]=D.useState(()=>sessionStorage.getItem("hideBackgroundImageWarning")==="true"),P=(V,ee)=>{const Me={...d,...V};if(p(Me),Me.url){const be=l(Me);u(be),e(be,ee)}else console.error("Update params error: ",Me)},F=(V,ee)=>{if(!V)return!1;const Me=V?.toLowerCase(),be=Me.includes(".svg")||Me.includes("svg"),me=ee&&(ee.includes("image/svg+xml")||ee.includes("svg"));return be||!!me},U=async V=>{try{T(!0),C(""),k(!1);try{new URL(V)}catch{return C("Invalid URL format"),!1}const ee=new AbortController,Me=setTimeout(()=>ee.abort(),1e4);try{const be=await fetch(V,{method:"HEAD",signal:ee.signal});if(clearTimeout(Me),!be.ok)return C(`HTTP ${be.status}: ${be.statusText}`),!1;const me=be.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(Xe=>me&&me.toLowerCase().includes(Xe.toLowerCase()))?(F(V,me)&&k(!0),C(""),!0):(C("URL does not point to an image"),!1)}catch(be){return clearTimeout(Me),be.name==="AbortError"?(C("Request timeout - URL took too long to respond"),!1):new Promise(me=>{const le=new Image,Ye=setTimeout(()=>{C("Request timeout - URL took too long to respond"),me(!1)},1e4);le.onload=()=>{clearTimeout(Ye),F(V)&&k(!0),C(""),me(!0)},le.onerror=()=>{clearTimeout(Ye),C("Cannot access image - CORS policy, network error, or invalid URL"),me(!1)},le.src=V})}}catch{return C("Unexpected error occurred while validating URL"),!1}finally{T(!1)}},H=async()=>{y.trim()&&await U(y.trim())&&P({url:y.trim()})},q=V=>{V.key==="Enter"&&H()},Q=V=>{E(V.target.value),S&&C(""),x&&k(!1)},Y=V=>{const ee=["image/png","image/jpeg","image/gif"],be=Array.isArray(V)?V:Array.from(V),me=be.filter(Ye=>ee.includes(Ye.type)&&Ye.size<=5242880);if(me.length!==be.length&&alert(r("inputs.common.invalidFiles")),me.length===0)return;const le=me.map(Ye=>new Promise(Xe=>{const ut=new FileReader;ut.onload=nn=>Xe(nn.target?.result),ut.readAsDataURL(Ye)}));Promise.all(le).then(Ye=>{const Xe={images:Ye,id:i||"",styles:n};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:Xe})),Fd(!0,i||"")})},pe=V=>{V.preventDefault(),m(!0)},ie=()=>{m(!1)},ke=V=>{V.preventDefault(),m(!1);const ee=V.dataTransfer.files;Y(ee)},re=()=>{const V=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(V)},Se=()=>{p({url:"",repeat:"no-repeat",position:"center center",size:"cover"}),u(null),e(null),E(""),k(!1)},fe=V=>{switch(V){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"})})}},Ce=V=>({"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")})[V]??r("inputs.backgroundImage.positions.center");return D.useEffect(()=>{const V=window.__emailBuilderEnableAI;V!==void 0&&_(!!V);const ee=Me=>{const{detail:be}=Me;_(!!be)};return window.addEventListener("email-builder-ai-generation",ee),()=>{window.removeEventListener("email-builder-ai-generation",ee)}},[]),D.useEffect(()=>{const V=me=>{const{detail:le}=me;Fd(!1,le.id||""),P({url:le.url},le.styles),sU(!1),E(le.url)},ee=me=>{Fd(me?.detail?.uploading??!1,me?.detail?.id??"")},Me=()=>{w?.current?.click()},be=me=>{const le=me.detail;if(typeof le=="string"){if(!le.includes("url("))P({url:le}),E(le);else{const Ye=o(le);p(Ye),u(le),e(le),E(Ye.url)}return}le?.url!=null&&typeof le.url=="string"&&(P({url:le.url},le.styles),E(le.url))};return window.addEventListener("email-builder-set-image",be),window.addEventListener("email-builder-upload-image-receive",V),window.addEventListener("email-builder-upload-file",Me),window.addEventListener("email-builder-toggle-upload-file",ee),()=>{window.removeEventListener("email-builder-upload-image-receive",V),window.removeEventListener("email-builder-set-image",be),window.removeEventListener("email-builder-upload-file",Me),window.removeEventListener("email-builder-toggle-upload-file",ee)}},[d]),D.useEffect(()=>{t&&k(F(d.url))},[t,d.url]),D.useEffect(()=>{if(t!==c){const V=o(t);p(V),u(t||null),E(V.url||"")}},[t]),h.jsxs(Ki,{children:[h.jsxs(We,{sx:{display:"flex",alignItems:"center",gap:1},children:[h.jsx($n,{label:r("inputs.backgroundImage.label")}),!O&&h.jsx(Nn,{title:r("inputs.backgroundImage.warningTooltip"),placement:"top",children:h.jsx(Wn,{size:"small",sx:{p:0},children:h.jsx(s,{})})})]}),L?h.jsx(We,{sx:{mb:2},children:L}):h.jsx("div",{style:{display:"flex",gap:8},children:A?h.jsxs(We,{sx:{width:"100%"},children:[h.jsxs(_n,{direction:"row",spacing:1,children:[h.jsx(jp,{fullWidth:!0,placeholder:r("inputs.image.urlPlaceholder"),value:y,onChange:Q,onKeyPress:q,error:!!S,disabled:v,sx:$v}),h.jsx(qi,{variant:"contained",onClick:H,disabled:!y.trim()||v,sx:{minWidth:"auto",px:2,position:"relative"},children:v?h.jsx(Kl,{size:20,color:"inherit"}):r("inputs.common.add")})]}),S&&h.jsx($l,{severity:"error",sx:{mt:1,fontSize:"0.875rem",maxHeight:"70px"},children:S}),x&&h.jsx($l,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:h.jsx(Wn,{"aria-label":r("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{k(!1)},children:h.jsx(Fv,{fontSize:"inherit"})}),children:r("inputs.common.svgWarning")}),d.url&&h.jsxs(We,{sx:{position:"relative",maxWidth:"50%",display:"block",margin:"0.5rem auto 0 auto"},children:[h.jsx("img",{src:d.url||"",alt:"",style:{width:"100%",objectFit:"contain",aspectRatio:"1 / 1",height:"auto",borderRadius:"8px",border:`2px solid ${a.palette.divider}`,backgroundColor:a.palette.background.paper,backgroundImage:`linear-gradient(45deg, ${a.palette.action.hover} 25%, transparent 25%, transparent 75%, ${a.palette.action.hover} 75%), linear-gradient(45deg, ${a.palette.action.hover} 25%, transparent 25%, transparent 75%, ${a.palette.action.hover} 75%)`,backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"}}),h.jsx(Wn,{onClick:Se,sx:{position:"absolute",top:5,right:5,backgroundColor:"background.paper",color:"error.main",padding:1,width:35,height:35,"&:hover":{backgroundColor:"error.50"}},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:"currentColor"})})})]})]}):h.jsxs(h.Fragment,{children:[d.url&&h.jsxs(We,{sx:{position:"relative",maxWidth:"40%",minWidth:"40%"},children:[h.jsx("div",{style:{borderRadius:"8px",border:`2px solid ${a.palette.divider}`,height:"100%",backgroundColor:a.palette.background.paper,backgroundImage:`linear-gradient(45deg, ${a.palette.action.hover} 25%, transparent 25%, transparent 75%, ${a.palette.action.hover} 75%), linear-gradient(45deg, ${a.palette.action.hover} 25%, transparent 25%, transparent 75%, ${a.palette.action.hover} 75%)`,backgroundSize:"20px 20px",backgroundPosition:"0 0, 10px 10px"},children:h.jsx("img",{src:d.url||"",alt:"",style:{width:"100%",objectFit:"contain",aspectRatio:"1 / 1",height:"100%"}})}),h.jsx(Wn,{onClick:Se,sx:{position:"absolute",top:5,right:5,backgroundColor:"background.paper",color:"error.main",padding:1,width:35,height:35,"&:hover":{backgroundColor:"error.50"}},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:"currentColor"})})})]}),h.jsxs(We,{onDragOver:pe,onDragLeave:ie,onDrop:ke,sx:{width:"100%",minWidth:"40%",border:"2px solid",borderColor:f?"primary.main":"divider",borderRadius:"8px",padding:"24px 8px 36px 8px",textAlign:"center",bgcolor:f?"primary.50":"background.paper",transition:"all 0.2s ease"},children:[h.jsx(We,{sx:{display:"flex",justifyContent:"center"},children:h.jsx(PU,{sx:{fontSize:32,color:"primary"}})}),h.jsxs("label",{style:{cursor:"pointer"},children:[h.jsx("input",{ref:w,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:V=>{const ee=V.target.files;ee&&ee.length>0&&Y(Array.from(ee))}}),h.jsx(gn,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:r("inputs.common.uploadFile")}),h.jsxs(gn,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",r("inputs.common.dragAndDrop")]})]}),h.jsx(gn,{variant:"body2",sx:{color:"text.secondary",mt:1},children:r("inputs.common.fileInfo")})]})]})}),d.url&&h.jsxs(We,{sx:{mt:2},children:[h.jsxs(We,{sx:{mb:2},children:[h.jsx($n,{label:r("inputs.backgroundImage.fillType")}),h.jsxs(Hh,{value:d.size,exclusive:!0,onChange:(V,ee)=>{ee!=null&&typeof ee=="string"&&P({size:ee})},size:"small",fullWidth:!0,children:[h.jsx(ln,{value:"cover",children:r("inputs.backgroundImage.fillOptions.cover")}),h.jsx(ln,{value:"contain",children:r("inputs.backgroundImage.fillOptions.contain")}),h.jsx(ln,{value:"auto",children:r("inputs.backgroundImage.fillOptions.auto")})]})]}),h.jsxs(_n,{direction:"row",spacing:2,sx:{mb:2},children:[h.jsxs("div",{style:{flex:1},children:[h.jsx($n,{label:r("inputs.backgroundImage.repeat")}),h.jsxs(Jl,{style:{width:"100%"},value:d.repeat,size:"small",onChange:V=>P({repeat:V.target.value}),children:[h.jsx(Xa,{value:"no-repeat",children:r("inputs.backgroundImage.repeatOptions.none")}),h.jsx(Xa,{value:"repeat",children:r("inputs.backgroundImage.repeatOptions.repeat")}),h.jsx(Xa,{value:"repeat-x",children:r("inputs.backgroundImage.repeatOptions.repeatX")}),h.jsx(Xa,{value:"repeat-y",children:r("inputs.backgroundImage.repeatOptions.repeatY")})]})]}),h.jsxs("div",{style:{flex:1},children:[h.jsx($n,{label:r("inputs.backgroundImage.position")}),h.jsx(Jl,{style:{width:"100%"},value:d.position,size:"small",onChange:V=>P({position:V.target.value}),renderValue:V=>{const ee=String(V??"");return h.jsxs(We,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[fe(ee),Ce(ee)]})},children:["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"].map(V=>h.jsx(Xa,{sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important "},value:V,children:h.jsxs(We,{sx:{display:"flex",alignItems:"center",gap:1},children:[fe(V),Ce(V)]})},V))})]})]})]}),!L&&!A&&x&&h.jsx($l,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},children:r("inputs.common.svgWarning")}),(!L&&Mb()&&!A||L&&g)&&h.jsxs(h.Fragment,{children:[h.jsxs(_n,{direction:"row",alignItems:"center",spacing:1,sx:{mt:2},children:[h.jsx(dr,{sx:{flexGrow:1}}),h.jsx(gn,{sx:{color:"text.secondary"},children:r("inputs.backgroundImage.or")}),h.jsx(dr,{sx:{flexGrow:1}})]}),h.jsx(_n,{flexDirection:"row",gap:2,sx:{mt:2},children:!L&&Mb()&&!A&&h.jsx(qi,{variant:"outlined",onClick:re,startIcon:h.jsx(OU,{}),sx:{width:"100%"},children:r("inputs.backgroundImage.browseGallery")})})]}),!L&&g&&h.jsx(qU,{src:d.url,style:{width:"100%",margin:0}})]})};function bd({label:t,defaultValue:e,onChange:n,...i}){const[r,a]=D.useState(e??0);return e!=r&&a(e),h.jsxs(Ki,{children:[h.jsx($n,{label:t}),h.jsx(di,{value:r??0,setValue:s=>{a(s),n(s)},...i})]})}const YO=({mobile:t=!1,label:e,borderColor:n,borderTop:i,borderBottom:r,borderLeft:a,borderRight:s,onChange:o,sidesLinked:l,onSidesLinkedChange:c})=>{const{t:u}=nt.useTranslation("inspector"),d=()=>t?{top:"borderTopMobile",bottom:"borderBottomMobile",left:"borderLeftMobile",right:"borderRightMobile"}:{top:"borderTop",bottom:"borderBottom",left:"borderLeft",right:"borderRight"},p=k=>{const w=Object.values(k);return w.every(A=>A===w[0])},f=d(),m={[f.top]:i??0,[f.bottom]:r??0,[f.left]:a??0,[f.right]:s??0},[g,_]=D.useState(n??"#000000"),[b,y]=D.useState(m),E={[f.top]:Number(b[f.top]),[f.bottom]:Number(b[f.bottom]),[f.left]:Number(b[f.left]),[f.right]:Number(b[f.right])},v=l!==void 0?l:p(E);D.useEffect(()=>{n!==g&&_(n??"#000000");const k={[f.top]:i??0,[f.bottom]:r??0,[f.left]:a??0,[f.right]:s??0};Object.keys(k).some(A=>b[A]!==k[A])&&y(k)},[n,i,r,a,s,t]);const T=()=>{if(v)c(!1);else{const k=b[f.top]??0;C(k),c(!0)}},S=k=>{_(k),o({borderColor:k,...b})},C=k=>{const w={[f.top]:k,[f.bottom]:k,[f.left]:k,[f.right]:k};y(w),o({...w,borderColor:g})},x=(k,w)=>{y(L=>({...L,[w]:k}));const A={...b,borderColor:g,[w]:k};o(A)};return h.jsxs("div",{children:[h.jsxs(_n,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[h.jsx($n,{label:e}),h.jsxs(_n,{direction:"row",spacing:1,alignItems:"center",children:[h.jsx(Zc,{defaultValue:g,onChange:S,compact:!0}),h.jsx(Nn,{title:u(v?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:h.jsx(Wn,{size:"small",onClick:T,sx:{color:v?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:v?h.jsx(Qh,{fontSize:"small"}):h.jsx(Xh,{fontSize:"small"})})})]})]}),v&&h.jsx(bd,{label:"",iconLabel:h.jsx(Qce,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.top],onChange:C}),!v&&h.jsxs(_n,{spacing:2,children:[h.jsx(bd,{label:"",iconLabel:h.jsx(Jce,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.top],onChange:k=>x(k,f.top)}),h.jsx(bd,{label:"",iconLabel:h.jsx(Yce,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.bottom],onChange:k=>x(k,f.bottom)}),h.jsx(bd,{label:"",iconLabel:h.jsx(Kce,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.left],onChange:k=>x(k,f.left)}),h.jsx(bd,{label:"",iconLabel:h.jsx(Xce,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.right],onChange:k=>x(k,f.right)})]})]})},_de=fU.map(t=>h.jsx(Xa,{value:t.key,sx:{fontFamily:t.value},children:t.label},t.key));function VU({label:t,onChange:e,defaultValue:n}){const i="INHERIT",[r,a]=D.useState(n??i);D.useEffect(()=>{r!==n&&a(n??i)},[n]);const s=o=>{const l=o.target.value;a(l),e(l===null?null:l)};return h.jsxs(Ki,{children:[h.jsx($n,{label:t}),h.jsx(Jl,{style:{width:"100%"},value:r,size:"small",onChange:s,children:_de})]})}function KO({label:t,defaultValue:e=16,onChange:n,maxValue:i,minValue:r,step:a}){const[s,o]=D.useState(e);D.useEffect(()=>{s!==e&&o(e)},[e]);const l=c=>{o(c),n(c)};return h.jsxs(Ki,{children:[h.jsx($n,{label:t}),h.jsx(di,{iconLabel:h.jsx(BU,{sx:{fontSize:16,color:"text.primary"}}),value:s,setValue:l,units:"px",step:a??2,min:r||8,max:i||48})]})}function bde({label:t,defaultValue:e,onChange:n}){const[i,r]=D.useState(e);return D.useEffect(()=>{i!==e&&r(e)},[e]),h.jsxs(lc,{label:t,defaultValue:i,onChange:a=>{r(a),n(a)},children:[h.jsx(ln,{value:"normal",children:"Regular"}),h.jsx(ln,{value:"bold",children:"Bold"})]})}const QO=({label:t,defaultValue:e,onChange:n})=>{const{t:i}=nt.useTranslation("inspector"),r=t??i("inputs.common.height");return h.jsx(di,{label:r,iconLabel:h.jsx(NU,{sx:{color:"text.secondary"}}),units:"px",step:1,min:1,max:100,marks:!1,value:e??1,setValue:n})},yde=[{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)"}],vde=yde.map(t=>h.jsx(Xa,{value:t.key,children:t.label},t.key));function Ede({label:t,onChange:e,defaultValue:n}){const i="INHERIT",[r,a]=D.useState(n?.toString()??i);D.useEffect(()=>{r!==n?.toString()&&a(n?.toString()??i)},[n]);const s=o=>{const l=o.target.value;a(l),e(l===i?null:parseFloat(l))};return h.jsxs(Ki,{children:[h.jsx($n,{label:t}),h.jsxs(Jl,{style:{width:"100%"},value:r,size:"small",onChange:s,children:[h.jsx(Xa,{value:i,children:"Default value"}),vde]})]})}function XO({label:t,defaultValue:e,onChange:n,sidesLinked:i,onSidesLinkedChange:r}){const{t:s}=nt.useTranslation("inspector"),[o,l]=D.useState(()=>e||{top:0,left:0,bottom:0,right:0});D.useEffect(()=>{e&&(e.top!==o.top||e.left!==o.left||e.bottom!==o.bottom||e.right!==o.right)&&l(e)},[e]);const c=i===!0;function u(p,f){let m;c?m={top:f,bottom:f,left:f,right:f}:m={...o,[p]:f},l(m),n(m)}const d=()=>{const p=!c;if(!c){const f={top:o.top,bottom:o.top,left:o.top,right:o.top};l(f),n(f)}r(p)};return h.jsxs(Ki,{children:[h.jsxs(_n,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[h.jsx($n,{label:t}),h.jsx(Nn,{title:s(c?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:h.jsx(Wn,{size:"small",onClick:d,sx:{marginTop:"0!important",color:c?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:c?h.jsx(Qh,{fontSize:"small"}):h.jsx(Xh,{fontSize:"small"})})})]}),c?h.jsx(di,{iconLabel:h.jsx("span",{children:s("inputs.responsiveSize.allSides")}),value:o.top,setValue:p=>u("top",p),units:"px",step:16,min:0,max:120,marks:!0}):h.jsxs(h.Fragment,{children:[h.jsx(di,{iconLabel:h.jsx(yU,{sx:{fontSize:16,color:"text.primary"}}),value:o.top,setValue:p=>u("top",p),units:"px",step:16,min:0,max:120,marks:!0}),h.jsx(di,{iconLabel:h.jsx(bU,{sx:{fontSize:16,color:"text.primary"}}),value:o.bottom,setValue:p=>u("bottom",p),units:"px",step:16,min:0,max:120,marks:!0}),h.jsx(di,{iconLabel:h.jsx(gU,{sx:{fontSize:16,color:"text.primary"}}),value:o.left,setValue:p=>u("left",p),units:"px",step:16,min:0,max:120,marks:!0}),h.jsx(di,{iconLabel:h.jsx(_U,{sx:{fontSize:16,color:"text.primary"}}),value:o.right,setValue:p=>u("right",p),units:"px",step:16,min:0,max:120,marks:!0})]})]})}const Sde=({label:t,defaultValue:e,onChange:n,maxValue:i=600,shapeSteps:r=8,cornersLinked:a,onCornersLinkedChange:s})=>{const{t:o}=nt.useTranslation("inspector"),[l,c]=D.useState(()=>typeof e=="object"&&e!==null?"rounded":e||"rectangle"),[u,d]=D.useState(()=>typeof e=="object"&&e!==null?e:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0}),p=a===!0;D.useEffect(()=>{typeof e=="object"&&e!==null?(d(e),c("rounded")):(e==="rectangle"||e==="pill")&&c(e)},[e]);const f=y=>{const E=y;c(E),n(E==="rounded"?u:E)},m=(y,E)=>{let v;p?v={topLeft:E,topRight:E,bottomLeft:E,bottomRight:E}:v={...u,[y]:E},d(v),n(v)},g=()=>{const y=!p;if(!p){const E={topLeft:u.topLeft,topRight:u.topLeft,bottomLeft:u.topLeft,bottomRight:u.topLeft};d(E),n(E)}s(y)},_=typeof i=="number"?i:Number(i)||600,b=t||o("shape.label");return h.jsxs(h.Fragment,{children:[h.jsxs(lc,{label:b,defaultValue:l,onChange:f,children:[h.jsx(ln,{value:"rectangle",children:o("shape.square")}),h.jsx(ln,{value:"pill",children:o("shape.pill")}),h.jsx(ln,{value:"rounded",children:o("shape.custom")})]}),l==="rounded"&&h.jsxs(_n,{spacing:2,alignItems:"flexStart",pb:1,children:[h.jsxs(_n,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[h.jsx($n,{label:o("shape.borderRadius")}),h.jsx(Nn,{title:o(p?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:h.jsx(Wn,{size:"small",onClick:g,sx:{marginTop:"0!important",color:p?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:p?h.jsx(Qh,{fontSize:"small"}):h.jsx(Xh,{fontSize:"small"})})})]}),p?h.jsx(h.Fragment,{children:h.jsx(di,{iconLabel:h.jsx(Rf,{sx:{fontSize:16}}),value:Number(u.topRight),setValue:y=>m("topLeft",y),units:"px",min:0,step:r,marks:r>1,max:_})}):h.jsxs(h.Fragment,{children:[h.jsx(di,{iconLabel:h.jsx(Rf,{sx:{fontSize:16,transform:"rotate(0deg)"}}),value:Number(u.topLeft),setValue:y=>m("topLeft",y),units:"px",min:0,step:r,marks:r>1,max:_}),h.jsx(di,{iconLabel:h.jsx(Rf,{sx:{fontSize:16,transform:"rotate(270deg)"}}),value:Number(u.topRight),setValue:y=>m("topRight",y),units:"px",min:0,step:r,marks:r>1,max:_}),h.jsx(di,{iconLabel:h.jsx(Rf,{sx:{fontSize:16,transform:"rotate(180deg)"}}),value:Number(u.bottomLeft),setValue:y=>m("bottomLeft",y),units:"px",min:0,step:r,marks:r>1,max:_}),h.jsx(di,{iconLabel:h.jsx(Rf,{sx:{fontSize:16,transform:"rotate(90deg)"}}),value:Number(u.bottomRight),setValue:y=>m("bottomRight",y),units:"px",min:0,step:r,marks:r>1,max:_})]})]})]})};function JO({label:t,defaultValue:e,onChange:n}){const[i,r]=D.useState(e??"left");return D.useEffect(()=>{e!==i&&r(e??"left")},[e]),h.jsxs(Ki,{children:[h.jsx($n,{label:t}),h.jsxs(lc,{label:"",defaultValue:i,onChange:a=>{r(a),n(a)},children:[h.jsx(ln,{value:"left",children:h.jsx(mue,{fontSize:"small"})}),h.jsx(ln,{value:"center",children:h.jsx(fue,{fontSize:"small"})}),h.jsx(ln,{value:"right",children:h.jsx(hue,{fontSize:"small"})})]})]})}const ZO=({label:t,defaultValue:e,onChange:n,step:i,...r})=>{const{t:a}=nt.useTranslation("inspector"),s=t??a("inputs.common.width");return h.jsx(di,{label:s,iconLabel:h.jsx(NU,{sx:{color:"text.primary",transform:"rotate(90deg)"}}),units:"%",step:i,min:1,max:100,marks:!1,value:e??1,setValue:n,...r})};function Cde({name:t,value:e,onChange:n,shapeMaxValue:i,shapeSteps:r}){const a=fi(),s=Lv(),{t:o}=nt.useTranslation("inspector"),l=(f,m)=>{const g=e[f],_=e[m];return g??_},c=(f,m)=>{n(m?{...e,...m,[t]:f}:{...e,[t]:f})},u=f=>{n({...e,...f})},p=(()=>{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(SS,{label:o("properties.backgroundColor"),defaultValue:p??s?.canvasColor,onChange:c});case"background":return h.jsx(gde,{defaultValue:p,onChange:(f,m)=>c(f,m),values:e});case"borderColor":return h.jsx(SS,{label:o("properties.border"),defaultValue:p,onChange:c});case"borderRadius":return h.jsx(bd,{iconLabel:h.jsx(Due,{}),units:"px",step:4,marks:!0,min:0,max:48,label:o("properties.borderRadius"),defaultValue:p,onChange:c});case"color":return h.jsx(SS,{label:o("properties.color"),defaultValue:p,onChange:c});case"fontFamily":return h.jsx(VU,{label:o("properties.fontFamily"),defaultValue:p,onChange:c});case"fontWeight":return h.jsx(bde,{label:o("properties.fontWeight"),defaultValue:p,onChange:c});case"textAlign":return a==="desktop"&&h.jsx(JO,{label:o("properties.alignment"),defaultValue:p,onChange:c});case"textAlignMobile":return a!="desktop"&&h.jsx(JO,{label:o("properties.alignment"),defaultValue:p,onChange:c});case"padding":return a==="desktop"&&h.jsx(XO,{label:o("properties.padding"),defaultValue:p,onChange:c,sidesLinked:e.paddingSidesLinked,onSidesLinkedChange:f=>n({...e,paddingSidesLinked:f})});case"mobilePadding":return a!="desktop"&&h.jsx(XO,{label:o("properties.padding"),defaultValue:p,onChange:c,sidesLinked:e.mobilePaddingSidesLinked,onSidesLinkedChange:f=>n({...e,mobilePaddingSidesLinked:f})});case"fontSize":return a==="desktop"&&h.jsx(KO,{maxValue:80,step:8,label:o("properties.fontSize"),defaultValue:p??16,onChange:c});case"fontSizeMobile":return a!="desktop"&&h.jsx(KO,{maxValue:80,step:8,label:o("properties.fontSize"),defaultValue:p,onChange:c});case"lineHeight":return h.jsx(Ede,{label:o("properties.lineHeight"),defaultValue:p??1.5,onChange:c});case"shape":return h.jsx(Sde,{shapeSteps:r,maxValue:i,label:o("properties.shape"),defaultValue:p,onChange:c,cornersLinked:e.shapeCornersLinked,onCornersLinkedChange:f=>n({...e,shapeCornersLinked:f})});case"height":return a==="desktop"&&h.jsx(QO,{label:o("properties.height"),defaultValue:p,onChange:c});case"heightMobile":return a!="desktop"&&h.jsx(QO,{label:o("properties.height"),defaultValue:p,onChange:c});case"width":return a==="desktop"&&h.jsx(ZO,{label:o("properties.width"),defaultValue:p,onChange:c});case"widthMobile":return a!="desktop"&&h.jsx(ZO,{label:o("properties.width"),defaultValue:p,onChange:c});case"border":return a==="desktop"&&h.jsx(YO,{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,sidesLinked:e.borderSidesLinked,onSidesLinkedChange:f=>n({...e,borderSidesLinked:f})});case"borderMobile":return a!="desktop"&&h.jsx(YO,{mobile:!0,label:o("properties.border"),borderColor:e.borderColor??null,borderTop:p.borderTop??null,borderBottom:p.borderBottom??null,borderLeft:p.borderLeft??null,borderRight:p.borderRight??null,onChange:u,sidesLinked:e.borderMobileSidesLinked,onSidesLinkedChange:f=>n({...e,borderMobileSidesLinked:f})});default:return null}}function Nr({names:t,value:e,onChange:n,disabledCSSValidation:i=!1,shapeMaxValue:r,shapeSteps:a}){const s=Qo(),o=iU();return(i||s=="css"||xb.includes(o||""))&&h.jsx(h.Fragment,{children:t.map(l=>h.jsx(Cde,{shapeMaxValue:r,shapeSteps:a,name:l,value:e||{},onChange:n},l))})}function Tde({data:t,setData:e}){const[,n]=D.useState(null),i=Lv(),{t:r}=nt.useTranslation("inspector"),a=_=>{const b=mU.safeParse(_);b.success?(e(b.data),n(null)):n(b.error)},s=t.props?.text??Al.text,o=t.props?.url??Al.url,l=t.props?.fullWidth??Al.fullWidth,c=t.props?.size??Al.size,u=i,d=t.style?.buttonTextColor??t.props?.buttonTextColor??u?.textColor,p=t.style?.buttonBackgroundColor??t.props?.buttonBackgroundColor??Al.buttonBackgroundColor,f=t.props?.fullWidthMobile,m=t.props?.sizeMobile,g=Qo();return h.jsxs(gs,{title:r("inputs.panels.button.title"),children:[g=="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsx(Nr,{disabledCSSValidation:!0,names:["fontFamily","fontSize","fontSizeMobile","fontWeight"],value:t.style,onChange:_=>a({...t,style:_})}),h.jsx(dp,{label:r("inputs.panels.button.textLabel"),defaultValue:s,onChange:_=>a({...t,props:{...t.props,text:_}})}),h.jsx(dp,{label:r("inputs.panels.button.targetLabel"),placeholder:r("inputs.panels.button.targetPlaceholder"),defaultValue:o,onChange:_=>a({...t,props:{...t.props,url:_}})}),h.jsx(lde,{label:r("properties.width"),fullWidth:l,fullWidthMobile:f,onChange:_=>a({...t,props:{...t.props,..._}})}),h.jsx(ode,{size:c,sizeMobile:m,sizePaddingSidesLinked:t.props?.sizePaddingSidesLinked,sizeMobilePaddingSidesLinked:t.props?.sizeMobilePaddingSidesLinked,onChange:_=>a({...t,props:{...t.props,..._}})})]}),h.jsx(Nr,{names:["shape","textAlign","textAlignMobile","backgroundColor","border","borderMobile","padding","mobilePadding"],value:t.style,shapeMaxValue:80,onChange:_=>a({...t,style:_})}),g==="css"&&h.jsxs(h.Fragment,{children:[h.jsx(Zc,{label:r("inputs.panels.button.textColor"),defaultValue:d,onChange:_=>a({...t,style:{...t.style,buttonTextColor:_}})}),h.jsx(Zc,{label:r("inputs.panels.button.buttonColor"),defaultValue:p,onChange:_=>a({...t,style:{...t.style,buttonBackgroundColor:_}})})]})]})}const Vb=vt({top:Oe(),bottom:Oe(),right:Oe(),left:Oe()}).optional().nullable(),Yp=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},xde=pU([Oe().nullish(),Oe().nullish(),Oe().nullish()]).optional().nullable(),WU=vt({style:vt({background:rt().nullable().optional(),backgroundColor:rt().nullable().optional(),padding:Vb,mobilePadding:Vb}).passthrough().optional().nullable(),props:vt({fixedWidths:xde,columnsCount:$d([Ck(2),Ck(3)]).optional().nullable(),layout:rt().optional().nullable(),contentAlignment:Vn(["top","middle","bottom"]).optional().nullable(),contentAlignmentMobile:Vn(["top","middle","bottom"]).optional().nullable()}).optional().nullable()}).passthrough(),kde={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},xm={columnsCount:2,contentAlignment:"middle"};function Dk({style:t,columns:e,props:n,blockId:i}){const r=fi(),a=sA(),s={padding:Yp(r=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},o={columnsCount:n?.columnsCount??xm.columnsCount,contentAlignment:r=="desktop"?n?.contentAlignment??xm.contentAlignment:n?.contentAlignmentMobile??n?.contentAlignment??xm.contentAlignment,fixedWidths:n?.fixedWidths,blockId:i},l=t?.background??"",c=t?.backgroundColor,u=c?Iu(l,c):l,d=Wt(i);return h.jsxs(Zr,{background:u,backgroundColor:c,className:`${d}`,padding:s.padding,width:"100%",children:[a.uploading&&a.id===i?h.jsx("div",{style:kde,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(CS,{index:0,props:o,columns:e}),h.jsx(CS,{index:1,props:o,columns:e}),h.jsx(CS,{index:2,props:o,columns:e})]})})})]})}function CS({index:t,props:e,columns:n}){const i=e?.contentAlignment??xm.contentAlignment;if((e?.columnsCount??xm.columnsCount)===2&&t===2)return null;const a=e.fixedWidths?.[t],s={boxSizing:"border-box",verticalAlign:i,width:a!=null?`${a}%`:void 0},o=(n&&n[t])??null,l=e.blockId?Wt(e.blockId):"";return h.jsx("td",{className:`col${l}`,style:s,children:o})}const wde=WU.shape.props.unwrap().unwrap().shape,_A=vt({style:WU.shape.style,props:vt({...wde,columns:pU([vt({childrenIds:Bd(rt())}),vt({childrenIds:Bd(rt())}),vt({childrenIds:Bd(rt())})])}).optional().nullable(),blockId:rt().optional(),isNotClient:Fs().optional()}).passthrough(),Dde=(t,e,n)=>{if(!t||!document)return;const i=Wt(t),r=document.querySelector(`.${i}`);if(!r)return;const a=r.parentElement;if(!a)return;const s=Math.ceil(a.getBoundingClientRect().width);n.props?.touched||n.props?.width!==s&&e({...n,props:{...n.props,width:s}})},Ade=t=>{if(!t||!document)return;const e=Wt(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},Nde={desktop:"contentAlignment",mobile:"contentAlignmentMobile"};function Rde({data:t,updateData:e}){const{t:n}=nt.useTranslation("inspector"),i=fi(),r=Nde[i]||"contentAlignment",a=t.props?.[r]??t.props?.contentAlignment,s=o=>{e({...t,props:{...t.props,[r]:o}})};return h.jsxs(lc,{label:n("inputs.alignment.label"),defaultValue:a,onChange:s,children:[h.jsx(ln,{value:"top",children:h.jsx(Pue,{fontSize:"small"})}),h.jsx(ln,{value:"middle",children:h.jsx(Mue,{fontSize:"small"})}),h.jsx(ln,{value:"bottom",children:h.jsx(Oue,{fontSize:"small"})})]})}const ed="layout-custom",TS=[{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]}],xS=[{id:"layout-33-33-33",distribution:[33.34,33.33,33.33]},{id:"layout-30-40-30",distribution:[30,40,30]},{id:"layout-25-50-25",distribution:[25,50,25]},{id:"layout-20-60-20",distribution:[20,60,20]},{id:"layout-50-25-25",distribution:[50,25,25]},{id:"layout-25-25-50",distribution:[25,25,50]},{id:"layout-60-20-20",distribution:[60,20,20]},{id:"layout-20-20-60",distribution:[20,20,60]},{id:"layout-40-30-30",distribution:[40,30,30]},{id:"layout-40-20-40",distribution:[40,20,40]},{id:"layout-15-70-15",distribution:[15,70,15]}],vl={grid:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:"16px",width:"100%"},card:{cursor:"pointer",border:"1px solid #e5e7eb",borderRadius:"8px",backgroundColor:"primary"},cardContent:{padding:"8px"},layoutPreview:{display:"grid",gap:"4px",height:"30px",width:"100%",minHeight:"30px"}};function eM(t){const e=t?.[0];return typeof e=="number"&&!Number.isNaN(e)?Math.min(99,Math.max(1,Math.round(e))):50}function kS(t){let e=typeof t?.[0]=="number"?Math.round(t[0]):34,n=typeof t?.[1]=="number"?Math.round(t[1]):33;return e=Math.min(98,Math.max(1,e)),n=Math.min(98,Math.max(1,n)),e+n>=99&&(n=Math.max(1,99-e)),[e,n]}const wS=({fractions:t,highlight:e})=>{const n=Xt(),i=e?n.palette.secondary.main:"#e5e7eb";return h.jsx("div",{style:{...vl.layoutPreview,gridTemplateColumns:t.map(r=>`${r}fr`).join(" ")},children:t.map((r,a)=>h.jsx("div",{style:{minWidth:0,backgroundColor:i,borderRadius:"4px",transition:"background-color 0.2s ease"}},a))})},Ide=({defaultValue:t,fixedWidths:e,onChange:n,columns:i})=>{const{t:r}=nt.useTranslation("inspector"),a=Xt(),[s,o]=D.useState(null),[l,c]=D.useState(!1),[u,d]=D.useState(()=>eM(e??void 0)),[p,f]=D.useState(()=>kS(e??void 0)[0]),[m,g]=D.useState(()=>kS(e??void 0)[1]),b=t??(i===2?"layout-50-50":"layout-33-33-33"),E=s??(b==="layout-33-34-33"?"layout-33-33-33":b),[v,T]=D.useState(i===2?TS:xS),S=(O,M)=>{o(null),c(!1),n({layout:O,fixedWidths:M})},C=()=>{if(o(ed),c(!0),i===2)d(eM(e??void 0));else{const[O,M]=kS(e??void 0);f(O),g(M)}},x=()=>{if(i===2){const O=u;n({layout:ed,fixedWidths:[O,100-O,null]})}else{const O=p,M=m;n({layout:ed,fixedWidths:[O,M,100-O-M]})}o(null)};D.useEffect(()=>{T(i===2?TS:xS)},[i]),D.useEffect(()=>{o(null),c(!1)},[i,t]),D.useEffect(()=>{const O=t;i===2?O!==ed&&(O==null||!TS.some(M=>M.id===O))&&n({layout:"layout-50-50",fixedWidths:[50,50,null]}):O==="layout-33-34-33"?n({layout:"layout-33-33-33",fixedWidths:[33.34,33.33,33.33]}):O!==ed&&(O==null||!xS.some(M=>M.id===O))&&n({layout:"layout-33-33-33",fixedWidths:[33.34,33.33,33.33]})},[i,t,n]);const k=(O,M)=>{const P=M;f(P),g(F=>Math.max(1,Math.min(F,100-P-1)))},w=(O,M)=>{const P=M,F=100-p-1;g(Math.max(1,Math.min(P,F)))},A=100-u,L=100-p-m,I=E===ed;return h.jsxs(Ki,{children:[h.jsx($n,{label:r("inputs.layout.label")}),h.jsxs("div",{style:vl.grid,children:[v.map(O=>h.jsx("div",{onClick:()=>S(O.id,O.distribution),style:{...vl.card,border:E===O.id?`2px solid ${a.palette.secondary.main}`:vl.card.border},children:h.jsx("div",{style:vl.cardContent,children:h.jsx(wS,{fractions:O.distribution.filter(M=>M!=null),highlight:E===O.id})})},O.id)),h.jsx("div",{onClick:C,style:{...vl.card,border:I?`2px solid ${a.palette.secondary.main}`:vl.card.border},role:"button",tabIndex:0,onKeyDown:O=>{(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),C())},children:h.jsx("div",{style:vl.cardContent,children:h.jsx(We,{sx:{width:"100%",height:30,minHeight:30,border:"1px dashed",borderColor:"divider",borderRadius:1,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:I?"action.selected":"action.hover",color:"text.primary",transition:a.transitions.create(["background-color"],{duration:a.transitions.duration.shorter})},children:h.jsx(CU,{sx:{fontSize:18,color:"text.primary"}})})})})]}),h.jsx(RD,{in:l,timeout:"auto",unmountOnExit:!0,children:h.jsxs(We,{sx:{mt:2,p:2,borderRadius:1,border:1,borderColor:"divider",bgcolor:"background.paper"},children:[i===2?h.jsxs(_n,{spacing:2,sx:{mt:1},children:[h.jsxs(gn,{variant:"body2",color:"text.secondary",children:[u,"% | ",A,"%"]}),h.jsx(H_,{value:u,min:1,max:99,step:1,valueLabelDisplay:"auto","aria-label":r("inputs.layout.custom.split2"),onChange:(O,M)=>d(M)}),h.jsx(wS,{fractions:[u,A],highlight:!0})]}):h.jsxs(_n,{spacing:2,sx:{mt:1},children:[h.jsxs(gn,{variant:"body2",color:"text.secondary",children:[p,"% | ",m,"% | ",L,"%"]}),h.jsxs(We,{children:[h.jsx(gn,{variant:"caption",color:"text.secondary",component:"div",children:r("inputs.layout.custom.firstColumn")}),h.jsx(H_,{value:p,min:1,max:98,step:1,valueLabelDisplay:"auto",onChange:k})]}),h.jsxs(We,{children:[h.jsx(gn,{variant:"caption",color:"text.secondary",component:"div",children:r("inputs.layout.custom.secondColumn")}),h.jsx(H_,{value:m,min:1,max:100-p-1,step:1,valueLabelDisplay:"auto",onChange:w})]}),h.jsx(wS,{fractions:[p,m,L],highlight:!0})]}),h.jsx(qi,{variant:"contained",size:"small",sx:{mt:2},onClick:x,children:h.jsx(gn,{variant:"button",component:"span",sx:{color:"#FFFFFF",fontWeight:"bold"},children:r("inputs.layout.custom.apply")})})]})})]})};function Ode({data:t,setData:e}){const[,n]=D.useState(null),[i,r]=D.useState(t.props?.columnsCount??2),a=Qo(),s=fi(),{t:o}=nt.useTranslation("inspector"),l=f=>{const m=ce.getState().document,g=f.filter(_=>m[_]?.type==="Image");s==="desktop"&&g.forEach(_=>{const b=m[_];if(b?.type!=="Image")return;const y=b.data;Dde(_,E=>{Pb(_,v=>v.type!=="Image"?v:{...v,data:E})},y)})},c=f=>{const m=_A.safeParse(f);m.success?(m.data.props.columns.map(g=>l(g.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},p=f=>{const m=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:[...t.props.columns];return f==="2"?{...u,columns:m}:{...d,columns:m}};return h.jsxs(gs,{title:o("inputs.panels.columns.title"),children:[a=="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsxs(lc,{label:o("inputs.panels.columns.countLabel"),defaultValue:t.props?.columnsCount===2?"2":"3",onChange:f=>{const m=p(f);c({...t,props:{...t.props,...m}})},children:[h.jsx(ln,{style:{fontWeight:"bold"},value:"2",children:"2"}),h.jsx(ln,{style:{fontWeight:"bold"},value:"3",children:"3"})]}),h.jsx(Ide,{columns:t.props?.columnsCount??3,defaultValue:t.props?.layout,fixedWidths:t.props?.fixedWidths??void 0,onChange:({layout:f,fixedWidths:m})=>{const g=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:t.props.columns;c({...t,props:{...t.props,layout:f,fixedWidths:m,columns:g}})}})]}),a=="css"&&h.jsxs(h.Fragment,{children:[h.jsx(Rde,{data:t,updateData:e}),h.jsx(Nr,{names:["backgroundColor","background","padding","mobilePadding"],value:t.style,onChange:f=>c({...t,style:f})})]})]})}const tM=rt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),nM=vt({top:Oe(),bottom:Oe(),right:Oe(),left:Oe()}).optional().nullable(),Mde=vt({topLeft:Oe().min(0).optional(),topRight:Oe().min(0).optional(),bottomLeft:Oe().min(0).optional(),bottomRight:Oe().min(0).optional()}),iM={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},Pde=vt({style:vt({backgroundColor:tM,background:rt().nullable().optional(),borderColor:tM,borderRadius:Oe().optional().nullable(),borderTop:Oe().optional().nullable(),borderBottom:Oe().optional().nullable(),borderLeft:Oe().optional().nullable(),borderRight:Oe().optional().nullable(),borderTopMobile:Oe().optional().nullable(),borderBottomMobile:Oe().optional().nullable(),borderLeftMobile:Oe().optional().nullable(),borderRightMobile:Oe().optional().nullable(),shape:$d([Vn(["rectangle","pill"]),Mde]).optional().nullable(),padding:nM,mobilePadding:nM}).passthrough().optional().nullable()}).passthrough();function YU({style:t,children:e,blockId:n}){const i=fi(),r=sA(),a={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:Yp(i=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},s=t?.background??"",o=t?.backgroundColor,l=o?Iu(s,o):s,c=dA(t),u=Wt(n);return e?h.jsx(Zr,{className:`${u}`,background:l,backgroundColor:t?.backgroundColor,borderRadius:c,padding:a.padding,width:"100%",border:a.border,children:h.jsxs(h.Fragment,{children:[r.uploading&&r.id===n&&h.jsx("div",{style:iM,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(Zr,{className:`${u}`,background:l,backgroundColor:o,borderRadius:c,padding:a.padding,width:"100%",border:a.border,children:h.jsx("div",{children:r.uploading&&r.id===n&&h.jsx("div",{style:iM,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 KU=vt({style:Pde.shape.style,props:vt({childrenIds:Bd(rt()).optional().nullable()}).optional().nullable(),blockId:rt().optional(),isNotClient:Fs().optional()}).passthrough();function QU({data:t,setData:e}){const[,n]=D.useState(null),{t:i}=nt.useTranslation("inspector"),r=a=>{const s=KU.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return h.jsx(gs,{title:i("inputs.panels.container.title"),children:h.jsx(Nr,{names:["backgroundColor","background","border","borderMobile","shape","padding","mobilePadding"],value:t.style,shapeSteps:30,onChange:a=>r({...t,style:a})})})}const Lde=rt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),rM=vt({top:Oe(),bottom:Oe(),right:Oe(),left:Oe()}).optional().nullable(),XU=vt({style:vt({background:rt().nullable().optional(),backgroundColor:Lde,padding:rM,mobilePadding:rM,height:Oe().optional().nullable(),heightMobile:Oe().optional().nullable(),color:rt().optional().nullable(),width:Oe().optional().nullable(),widthMobile:Oe().optional().nullable(),textAlign:rt().optional().nullable(),textAlignMobile:rt().optional().nullable()}).passthrough().optional().nullable()}).passthrough(),wc={height:1,color:"#333333",width:100,textAlign:"left"};function JU({style:t,blockId:e}){const n=fi(),i=Yp(n==="desktop"?t?.padding:t?.mobilePadding??t?.padding),r=n==="desktop"?t?.height??wc.height:t?.heightMobile??t?.height??wc.height,a=t?.color??wc.color,s=n==="desktop"?(t?.width??wc.width)+"%":(t?.widthMobile??t?.width??wc.width)+"%",o=n==="desktop"?t?.textAlign??wc.textAlign:t?.textAlignMobile??t?.textAlign??wc.textAlign,l=t?.background??"",c=t?.backgroundColor??"",u=c?Iu(l,c):l,d=Wt(e);return h.jsx(Zr,{className:`c${d}`,background:u,backgroundColor:c,width:"100%",padding:i,align:o,children:h.jsx(Zr,{display:"inline-block",className:`${d}`,background:a,backgroundColor:c,width:s,padding:{top:r,bottom:0,left:0,right:0},isParent:!1,children:h.jsx("div",{})})})}function ZU({data:t,setData:e}){const[,n]=D.useState(null),{t:i}=nt.useTranslation("inspector"),r=a=>{const s=XU.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return h.jsx(gs,{title:i("inputs.panels.divider.title"),children:h.jsx(Nr,{names:["width","widthMobile","height","heightMobile","color","backgroundColor","textAlign","textAlignMobile","padding","mobilePadding"],value:t.style,onChange:a=>r({...t,style:a})})})}const If=rt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),e8=vt({backdropColor:If,borderColor:If,borderRadius:Oe().optional().nullable(),canvasColor:If,textColor:If,fontFamily:Vp,childrenIds:Bd(rt()).optional().nullable(),linkGlobal:vt({linkColor:If,underline:Fs()}).optional().nullable(),showVersion:Fs().optional().nullable()}),Fde=({label:t,linkColor:e,underline:n=!1,onChange:i})=>{const[r,a]=D.useState(e??"#FF0000"),[s,o]=D.useState(n),l=Xt(),{t:c}=nt.useTranslation("inspector"),u=t??c("inputs.links.color"),d=s?"enabled":"disabled",p={container:{width:"100%"},toggleGroup:{width:"100%",backgroundColor:l.palette.background.paper,padding:"4px",borderRadius:"8px"},toggleButton:{flex:1,padding:"6px 16px",textTransform:"none",fontSize:"14px",color:l.palette.text.primary,"&.Mui-selected":{backgroundColor:l.palette.grey[200],color:l.palette.text.primary,"&:hover":{backgroundColor:l.palette.grey[300]}},"&:hover":{backgroundColor:l.palette.grey[100]}}};D.useEffect(()=>{e!==r&&a(e??"#FF0000")},[e]),D.useEffect(()=>{n!==s&&o(n)},[n]);const f=g=>{const _=g??"#FF0000";a(_),i({linkColor:_,underline:s})},m=(g,_)=>{if(!_)return;const b=_==="enabled";o(b),i({linkColor:r,underline:b})};return h.jsxs(Ki,{children:[h.jsx(Zc,{label:u,defaultValue:r,onChange:f}),h.jsx($n,{label:c("inputs.links.underline")}),h.jsx(We,{sx:p.container,children:h.jsxs(Hh,{value:d,exclusive:!0,onChange:m,sx:p.toggleGroup,children:[h.jsx(ln,{value:"enabled",sx:p.toggleButton,children:h.jsx(Nn,{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(ln,{value:"disabled",sx:p.toggleButton,children:h.jsx(Nn,{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"})]})})})]})})]})},Bde="email-builder-online",$de="3.5.2",DS={name:Bde,version:$de};function t8({data:t,setData:e}){const[,n]=D.useState(null),{t:i}=nt.useTranslation("inspector"),r=sce(),a=s=>{const o=e8.safeParse(s);o.success?(e(o.data),n(null)):n(o.error)};return h.jsxs(gs,{title:i("inputs.panels.emailLayout.title"),children:[h.jsx(Zc,{label:i("inputs.panels.emailLayout.backgroundColor"),defaultValue:t.backdropColor??"#F5F5F5",onChange:s=>a({...t,backdropColor:s})}),h.jsx(Zc,{label:i("inputs.panels.emailLayout.canvasColor"),defaultValue:t.canvasColor??"#FFFFFF",onChange:s=>a({...t,canvasColor:s})}),h.jsx(VU,{label:i("inputs.panels.emailLayout.fontFamily"),defaultValue:t.fontFamily||Uce.FAMILY,onChange:s=>a({...t,fontFamily:s})}),h.jsx(Zc,{label:i("inputs.panels.emailLayout.textColor"),defaultValue:t.textColor??"#262626",onChange:s=>a({...t,textColor:s})}),h.jsx(Fde,{label:i("inputs.panels.emailLayout.linksLabel"),linkColor:t.linkGlobal?.linkColor||"#000000",underline:t.linkGlobal?.underline||!1,onChange:s=>a({...t,linkGlobal:s})}),r&&h.jsx(We,{color:"text.secondary",sx:{display:"flex",justifyContent:"flex-end",mt:2},children:h.jsxs(We,{sx:{textAlign:"right"},children:[h.jsxs(gn,{variant:"body2",children:[i("inputs.panels.emailLayout.version"),": ",DS.version]}),h.jsx(Ore,{href:`https://www.npmjs.com/package/${DS.name}`,target:"_blank",rel:"noopener noreferrer",sx:{fontSize:"0.875rem",mt:.5,display:"inline-block"},children:DS.name})]})})]})}const aM=rt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),Ude=vt({top:Oe(),bottom:Oe(),right:Oe(),left:Oe()}).optional().nullable(),zde=t=>t?`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`:void 0,n8=vt({props:vt({text:rt().optional().nullable(),level:Vn(["h1","h2","h3"]).optional().nullable()}).optional().nullable(),style:vt({color:aM,backgroundColor:aM,fontFamily:Vp,fontWeight:Vn(["bold","normal"]).optional().nullable(),textAlign:Vn(["left","center","right"]).optional().nullable(),padding:Ude}).passthrough().optional().nullable()}),Wb={level:"h2",text:""};function i8({props:t,style:e}){const n=t?.level??Wb.level,i=t?.text??Wb.text,r={color:e?.color??void 0,backgroundColor:e?.backgroundColor??void 0,fontWeight:e?.fontWeight??"bold",textAlign:e?.textAlign??void 0,margin:0,fontFamily:Xl(e?.fontFamily),fontSize:Gde(n),padding:zde(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 Gde(t){switch(t){case"h1":return 32;case"h2":return 24;case"h3":return 20}}function Hde({data:t,setData:e}){const[,n]=D.useState(null),{t:i}=nt.useTranslation("inspector"),r=s=>{const o=n8.safeParse(s);o.success?(e(o.data),n(null)):n(o.error)},a=Qo();return h.jsxs(gs,{title:i("inputs.panels.heading.title"),children:[a=="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsx(dp,{label:i("inputs.panels.heading.contentLabel"),rows:3,defaultValue:t.props?.text??Wb.text,onChange:s=>{r({...t,props:{...t.props,text:s}})}}),h.jsxs(lc,{label:i("inputs.panels.heading.levelLabel"),defaultValue:t.props?.level??Wb.level,onChange:s=>{r({...t,props:{...t.props,level:s}})},children:[h.jsx(ln,{value:"h1",children:"H1"}),h.jsx(ln,{value:"h2",children:"H2"}),h.jsx(ln,{value:"h3",children:"H3"})]})]}),h.jsx(Nr,{names:["color","backgroundColor","fontFamily","fontWeight","textAlign","padding","mobilePadding"],value:t.style,onChange:s=>r({...t,style:s})})]})}const sM=rt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),jde=vt({top:Oe(),bottom:Oe(),right:Oe(),left:Oe()}).optional().nullable(),qde=t=>t?`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`:void 0,r8=vt({style:vt({color:sM,backgroundColor:sM,fontFamily:Vp,fontSize:Oe().min(0).optional().nullable(),textAlign:Vn(["left","right","center"]).optional().nullable(),padding:jde}).passthrough().optional().nullable(),props:vt({contents:rt().optional().nullable()}).optional().nullable()});function a8({style:t,props:e}){const n=e?.contents,i={color:t?.color??void 0,backgroundColor:t?.backgroundColor??void 0,fontFamily:Xl(t?.fontFamily),fontSize:t?.fontSize??void 0,textAlign:t?.textAlign??void 0,padding:qde(t?.padding)};return n?h.jsx("div",{style:i,dangerouslySetInnerHTML:{__html:n}}):h.jsx("div",{style:i})}function Vde({data:t,setData:e}){const[,n]=D.useState(null),{t:i}=nt.useTranslation("inspector"),r=s=>{const o=r8.safeParse(s);o.success?(e(o.data),n(null)):n(o.error)},a=Qo();return h.jsxs(gs,{title:i("inputs.panels.html.title"),children:[a=="block-configuration"&&h.jsx(h.Fragment,{children:h.jsx(dp,{label:i("inputs.panels.html.contentLabel"),rows:5,defaultValue:t.props?.contents??"",onChange:s=>r({...t,props:{...t.props,contents:s}})})}),h.jsx(Nr,{names:["color","backgroundColor","fontFamily","fontSize","textAlign","padding","mobilePadding"],value:t.style,onChange:s=>r({...t,style:s})})]})}const Wde=vt({topLeft:Oe().min(0).optional(),topRight:Oe().min(0).optional(),bottomLeft:Oe().min(0).optional(),bottomRight:Oe().min(0).optional()}),bA=vt({style:vt({padding:Vb,mobilePadding:Vb,background:rt().nullable().optional(),backgroundColor:rt().regex(/^#[0-9a-fA-F]{6}$/).optional().nullable(),textAlign:Vn(["center","left","right"]).optional().nullable(),textAlignMobile:Vn(["center","left","right"]).optional().nullable(),shape:$d([Vn(["rectangle","pill"]),Wde]).optional().nullable()}).passthrough(),props:vt({touched:Fs().optional().nullable(),scale:Oe().optional().nullable(),size:rt().optional().nullable(),sizeMobile:rt().optional().nullable(),width:Oe().optional().nullable(),widthMobile:Oe().optional().nullable(),scaleMobile:Oe().optional().nullable(),touchedMobile:Fs().optional().nullable(),original_width:Oe().optional().nullable(),height:Oe().optional().nullable(),url:rt().optional().nullable(),alt:rt().optional().nullable(),linkHref:rt().optional().nullable(),contentAlignment:Vn(["top","middle","bottom"]).optional().nullable()}).optional().nullable()}).passthrough();function s8({style:t,props:e,blockId:n,isNotClient:i=!1}){const r=fi(),a=sA(),o=!Pv()&&!i,l={padding:Yp(r=="desktop"?t?.padding:t?.mobilePadding??t?.padding),backgroundColor:t?.backgroundColor??void 0,textAlign:r=="desktop"?t?.textAlign??void 0:t?.textAlignMobile??t?.textAlign??void 0},c=(E,v)=>E==="fill"?"100%":E==="scale"?`${v}%`:e?.width,u=e?.linkHref??null,d=r=="desktop"?c(e?.size,e?.scale):c(e?.sizeMobile,e?.scaleMobile),p={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},f=t?.background??"",m=t?.backgroundColor,g=m?Iu(f,m):f,_=E=>{const v=E.currentTarget;setTimeout(()=>{if(!e?.width&&v.offsetWidth){const T=v.offsetWidth;dce(n,{...e,width:T})}},100)},b=h.jsxs(h.Fragment,{children:[h.jsx("img",{alt:e?.alt??"",src:e?.url??"",width:d,onLoad:_,style:{width:d,height:"auto",outline:"none",border:"none",textDecoration:"none",verticalAlign:e?.contentAlignment??"middle",display:"inline-block",maxWidth:"100%",opacity:a.uploading&&a.id===n?.5:1,transition:"opacity 0.2s ease-in-out",borderRadius:dA(t)}}),a.uploading&&a.id===n&&h.jsx("div",{style:p,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"})})})]}),y=Wt(n);return u?h.jsx(Zr,{className:`${y}`,padding:l.padding,background:g,align:l.textAlign,width:"100%",children:h.jsx("a",{href:o?void 0:uA(u),style:{textDecoration:"none",display:"block",width:"100%",height:"100%",pointerEvents:o?"none":void 0},target:o?void 0:"_blank",onClick:o?E=>E.preventDefault():void 0,children:b})}):h.jsx(Zr,{className:`${y}`,padding:l.padding,background:g,align:l.textAlign,width:"100%",children:b})}const Yde=(t,e,n)=>{const i=fi();D.useEffect(()=>{const r=()=>{if(!t||!document||i=="mobile")return;const o=Wt(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 a=new ResizeObserver(r),s=document.querySelector(`.${Wt(t)}`);return s?.parentElement&&a.observe(s.parentElement),()=>{a.disconnect()}},[t,e,n,i])},Kde=({data:t,setData:e,blockId:n})=>{const{t:i}=nt.useTranslation("inspector"),[r,a]=D.useState(!1),[s,o]=D.useState(()=>!!window.__emailBuilderEnableAI),[,l]=D.useState(null),[c,u]=D.useState(""),[d,p]=D.useState(!1),[f,m]=D.useState(""),[g,_]=D.useState(!1),b=D.useRef(null),y=oA(),[E,v]=D.useState(null);D.useEffect(()=>{const P=window.__emailBuilderCustomImageProvider;P&&(v(P),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 T=P=>{const F=bA.safeParse(P);F.success?(e(F.data),l(null)):l(F.error)},S=(P,F)=>{const U=P.toLowerCase(),H=U.includes(".svg")||U.includes("svg"),q=F&&(F.includes("image/svg+xml")||F.includes("svg"));return H||!!q},C=async P=>{try{p(!0),m(""),_(!1);try{new URL(P)}catch{return m(i("inputs.image.invalidUrl")),!1}const F=new AbortController,U=setTimeout(()=>F.abort(),1e4);try{const H=await fetch(P,{method:"HEAD",signal:F.signal});if(clearTimeout(U),!H.ok)return m(`HTTP ${H.status}: ${H.statusText}`),!1;const q=H.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(pe=>q&&q.toLowerCase().includes(pe.toLowerCase()))?(S(P,q)&&_(!0),m(""),!0):(m(i("inputs.image.notImage")),!1)}catch(H){return clearTimeout(U),H.name==="AbortError"?(m(i("inputs.image.timeout")),!1):new Promise(q=>{const Q=new Image,Y=setTimeout(()=>{m(i("inputs.image.timeout")),q(!1)},1e4);Q.onload=()=>{clearTimeout(Y),S(P)&&_(!0),m(""),q(!0)},Q.onerror=()=>{clearTimeout(Y),m("Cannot access image - CORS policy, network error, or invalid URL"),q(!1)},Q.src=P})}}catch{return m("Unexpected error occurred while validating URL"),!1}finally{p(!1)}},x=async()=>{c.trim()&&await C(c.trim())&&(T({...t,props:{...t.props,url:c.trim()}}),u(""))},k=P=>{P.key==="Enter"&&x()},w=P=>{u(P.target.value),f&&m(""),g&&_(!1)},A=P=>{const F=["image/png","image/jpeg","image/gif"],H=P.filter(Q=>F.includes(Q.type)&&Q.size<=5242880);if(H.length!==P.length&&alert(i("inputs.common.invalidFiles")),H.length===0)return;const q=H.map(Q=>new Promise(Y=>{const pe=new FileReader;pe.onload=ie=>Y(ie.target?.result),pe.readAsDataURL(Q)}));Promise.all(q).then(Q=>{const Y={images:Q,id:n||""};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:Y})),Fd(!0,n||"")})},L=P=>{P.preventDefault(),a(!0)},I=P=>{const F=P.currentTarget.getBoundingClientRect(),U=P.clientX,H=P.clientY;(U<F.left||U>=F.right||H<F.top||H>=F.bottom)&&a(!1)},O=P=>{P.preventDefault(),a(!1);const F=Array.from(P.dataTransfer.files);F.length>0&&A(F)},M=()=>{const P=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(P)};return D.useEffect(()=>{const P=window.__emailBuilderEnableAI;P!==void 0&&o(!!P);const F=U=>{const{detail:H}=U;o(!!H)};return window.addEventListener("email-builder-ai-generation",F),()=>{window.removeEventListener("email-builder-ai-generation",F)}},[]),D.useEffect(()=>{const P=q=>{const{detail:Q}=q;Fd(!1,Q.id||""),T({...t,props:{...t.props,url:Q.url}}),sU(!1)},F=q=>{Fd(q?.detail?.uploading??!1,q?.detail?.id??"")},U=()=>{b?.current?.click()},H=q=>{const{detail:Q}=q;T({...t,props:{...t.props,url:Q}})};return window.addEventListener("email-builder-set-image",H),window.addEventListener("email-builder-upload-image-receive",P),window.addEventListener("email-builder-upload-file",U),window.addEventListener("email-builder-toggle-upload-file",F),()=>{window.removeEventListener("email-builder-toggle-upload-file",F),window.removeEventListener("email-builder-upload-image-receive",P),window.removeEventListener("email-builder-set-image",H),window.removeEventListener("email-builder-upload-file",U)}},[t]),D.useEffect(()=>{t.props?.url&&_(S(t.props.url))},[t.props?.url]),h.jsxs(_n,{gap:1,children:[E?h.jsx(We,{sx:{mb:2},children:E}):h.jsx("div",{style:{display:"flex",gap:8},children:y?h.jsxs(Ki,{children:[h.jsx($n,{label:i("inputs.image.urlLabel")}),h.jsxs(_n,{direction:"row",spacing:1,children:[h.jsx(jp,{fullWidth:!0,placeholder:i("inputs.image.urlPlaceholder"),value:c,onChange:w,onKeyPress:k,error:!!f,disabled:d,sx:{...$v,"& .MuiOutlinedInput-root":{"& fieldset":{borderColor:f?"error.main":"#E5E5E5"},"&:hover fieldset":{borderColor:f?"error.main":"primary.main"},"&.Mui-focused fieldset":{borderColor:f?"error.main":"primary.main"}}}}),h.jsx(qi,{variant:"contained",onClick:x,disabled:!c.trim()||d,sx:{minWidth:"auto",px:2,position:"relative"},children:d?h.jsx(Kl,{size:20,color:"inherit"}):i("inputs.common.add")})]}),f&&h.jsx($l,{severity:"error",sx:{mt:1,fontSize:"0.875rem","& .MuiAlert-message":{padding:"4px 0",display:"flex",flexDirection:"column",justifyContent:"space-around"}},children:f}),g&&h.jsx($l,{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(Wn,{"aria-label":i("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{_(!1)},children:h.jsx(Fv,{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(We,{onDragOver:L,onDragLeave:I,onDrop:O,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(We,{sx:{display:"flex",justifyContent:"center",mb:2},children:h.jsx(PU,{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:P=>{const F=P.target.files;F&&F.length>0&&A(Array.from(F))}}),h.jsx(gn,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:i("inputs.common.uploadFile")}),h.jsxs(gn,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",i("inputs.common.dragAndDrop")]})]}),h.jsx(gn,{variant:"body2",sx:{color:"text.secondary",mt:1},children:i("inputs.common.fileInfo")})]})]})}),!E&&!y&&g&&h.jsx($l,{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."}),(!E&&(Mb()&&!y||s)||E&&s)&&h.jsxs(_n,{direction:"row",alignItems:"center",spacing:1,children:[h.jsx(dr,{sx:{flexGrow:1}}),h.jsx(gn,{sx:{color:"text.secondary"},children:"or"}),h.jsx(dr,{sx:{flexGrow:1}})]}),h.jsx(h.Fragment,{children:h.jsxs(_n,{flexDirection:"row",gap:2,children:[!E&&Mb()&&!y&&h.jsx(qi,{variant:"outlined",onClick:M,startIcon:h.jsx(OU,{}),sx:{color:"mainColor.main",borderColor:"mainColor.light","&:hover":{borderColor:"mainColor.main",backgroundColor:"action.hover"}},style:{width:"100%"},children:"Browse gallery"}),s&&h.jsx(qU,{src:t.props?.url,style:{width:"100%",margin:0}})]})})]})},Qde=({defaultValue:t="original",scale:e=100,onChange:n})=>{const[i,r]=D.useState(t),[a,s]=D.useState(e);fi();const o=Xt(),{t:l}=nt.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}};D.useEffect(()=>{(t!==i||e!==a)&&(t!==i&&r(t),t==="scale"&&s(e))},[t,e]);const u=(p,f)=>{f!==null&&(r(f),n&&n({mode:f,scale:f==="scale"?a:void 0}))},d=p=>{s(p),n&&n({mode:i,scale:p})};return h.jsxs(Ki,{children:[h.jsx($n,{label:l("inputs.sizeSelector.label")}),h.jsxs(We,{sx:c.container,children:[h.jsxs(Hh,{value:i,exclusive:!0,onChange:u,sx:c.toggleGroup,children:[h.jsx(ln,{value:"original",sx:c.toggleButton,children:l("inputs.sizeSelector.contain")}),h.jsx(ln,{value:"fill",sx:c.toggleButton,children:l("inputs.sizeSelector.cover")}),h.jsx(ln,{value:"scale",sx:c.toggleButton,children:l("inputs.sizeSelector.scale")})]}),h.jsx(RD,{in:i==="scale",children:h.jsx(We,{sx:c.sliderContainer,children:h.jsx(di,{iconLabel:h.jsx(Lue,{}),value:a,setValue:d,marks:!1,units:"%",min:1,max:100})})})]})]})};function Xde({data:t,setData:e}){const[n,i]=D.useState(null),r=Yh(),a=Qo(),s=fi(),{t:o}=nt.useTranslation("inspector");Yde(r||"",e,t),D.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=D.useCallback(g=>{const _=bA.safeParse(g);_.success?JSON.stringify(t)!==JSON.stringify(_.data)&&(e(_.data),i(null)):i(_.error)},[t,e]),c=D.useCallback((g,_,b)=>{const y=Ade(r)||Ad,E={...g.props};if(b&&(E.touchedMobile=!0),_.mode==="original"){const v=g.props?.original_width??null;return b?{...E,sizeMobile:_.mode,widthMobile:v}:{...E,size:_.mode,width:v,sizeMobile:E.touchedMobile?E.sizeMobile:_.mode,widthMobile:E.touchedMobile?E.widthMobile:v}}if(_.mode==="fill")return b?{...E,sizeMobile:_.mode,widthMobile:null}:{...E,size:_.mode,width:null,sizeMobile:E.touchedMobile?E.sizeMobile:_.mode,widthMobile:E.touchedMobile?E.widthMobile:null};if(_.mode==="scale"){const v=Math.ceil(y/100*_.scale);return b?{...E,sizeMobile:_.mode,scaleMobile:_.scale,widthMobile:v}:{...E,size:_.mode,scale:_.scale,width:v,sizeMobile:E.touchedMobile?E.sizeMobile:_.mode,scaleMobile:E.touchedMobile?E.scaleMobile:_.scale,widthMobile:E.touchedMobile?E.widthMobile:v}}return E},[r]),u=D.useCallback((g,_)=>{const b=c(t,g,_);l({...t,props:b})},[t,l,c]),d=D.useMemo(()=>s!=="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},[s,t.props?.touchedMobile,t.props?.sizeMobile,t.props?.size,t.props?.scaleMobile,t.props?.scale]),p=D.useCallback(g=>{l({...t,props:{...t.props,alt:g}})},[t,l]),f=D.useCallback(g=>{const _=g.trim().length===0?null:g.trim();l({...t,props:{...t.props,linkHref:_}})},[t,l]),m=D.useCallback(g=>{l({...t,style:g})},[t,l]);return h.jsxs(gs,{title:o("inputs.panels.image.title"),children:[a==="block-configuration"&&h.jsxs(h.Fragment,{children:[h.jsx(Kde,{data:t,setData:e,blockId:r}),h.jsx(dp,{label:o("inputs.panels.image.altLabel"),placeholder:o("inputs.panels.image.altPlaceholder"),defaultValue:t.props?.alt??"",onChange:p}),h.jsx(dp,{label:o("inputs.panels.image.urlLabel"),placeholder:o("inputs.panels.image.urlPlaceholder"),defaultValue:t.props?.linkHref??"",onChange:f}),h.jsx(Qde,{defaultValue:d.size,scale:d.scale??void 0,onChange:g=>u(g,s!=="desktop")})]}),h.jsx(Nr,{names:["textAlign","textAlignMobile","backgroundColor","shape","padding","mobilePadding"],value:t.style,shapeMaxValue:300,shapeSteps:20,onChange:m})]})}const oM=rt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),lM=vt({top:Oe(),bottom:Oe(),right:Oe(),left:Oe()}).optional().nullable(),o8=vt({style:vt({color:oM,backgroundColor:oM,background:rt().nullable().optional(),fontSize:Oe().gte(0).optional().nullable(),fontFamily:Vp,fontWeight:Vn(["bold","normal"]).optional().nullable(),textAlign:Vn(["left","center","right"]).optional().nullable(),textAlignMobile:Vn(["left","center","right"]).optional().nullable(),padding:lM,mobilePadding:lM,optionSize:Vn(["small","medium","large"]).optional().nullable(),theme:Vn(["light","dark","colored"]).optional().nullable()}).passthrough().optional().nullable(),gap:Oe().optional(),items:Bd(vt({id:rt(),key:rt(),label:rt(),iconName:rt(),theme:rt(),size:rt(),sizePx:rt(),url:rt(),href:rt().optional().nullable()})),gapMobile:Oe().optional()}).passthrough();function l8({style:t,items:e,blockId:n,gap:i=1,gapMobile:r,isNotClient:a=!1}){const s=fi(),o=t?.background??"",l=t?.backgroundColor,c=l?Iu(o,l):o,u=(s==="desktop"?t?.textAlign:t?.textAlignMobile??t?.textAlign)??void 0,d={background:c,backgroundColor:t?.backgroundColor,textAlign:u,padding:Yp(s==="desktop"?t?.padding:t?.mobilePadding??t?.padding)},p=s==="desktop"?i:r??i,f=Wt(n),g=!Pv()&&!a;return h.jsx(Jde,{blockId:`${f}`,items:e,wStyle:d,gap:p,guardLinksWhileEditingOnCanvas:g})}const Jde=({items:t,blockId:e,wStyle:n,gap:i,guardLinksWhileEditingOnCanvas:r})=>{const a=s=>{switch(s){case 0:return"first";case t.length-1:return"last";default:return"inside"}};return h.jsx(Zr,{className:e,background:n.background,backgroundColor:n.backgroundColor,padding:n?.padding,align:n.textAlign,width:"100%",children:h.jsx("table",{style:{borderCollapse:"collapse",display:"inline-block",lineHeight:0,verticalAlign:"top"},border:0,cellSpacing:"0",cellPadding:"0",children:h.jsx("tbody",{children:h.jsx("tr",{style:{verticalAlign:"top"},children:t.map((s,o)=>{const l=a(o);return h.jsxs(D.Fragment,{children:[l!=="first"&&h.jsx("td",{className:`gap-${e}`,width:Math.ceil(i/2),style:{lineHeight:0,verticalAlign:"top"}}),h.jsx("td",{id:`${s.id}-${s.url}`,width:s.sizePx,style:{lineHeight:0,textAlign:"center",verticalAlign:"top",whiteSpace:"nowrap"},children:h.jsx("a",{target:"_blank",href:r?void 0:uA(s.href),onClick:r?c=>c.preventDefault():void 0,style:{display:"block",lineHeight:0,textDecoration:"none",pointerEvents:r?"none":void 0},children:h.jsx("img",{src:s.url,alt:s.key,style:{width:s.sizePx||36,height:s.sizePx||36,display:"block"}})},`item_${o}`)},`${s.id}-${s.url}`),l!=="last"&&h.jsx("td",{className:`gap-${e}`,width:Math.ceil(i/2),style:{lineHeight:0,verticalAlign:"top"}})]},s.id)})})})})})},Zde="https://maildrill-dev.s3.us-east-2.amazonaws.com/icons/",epe={positive:!0,original:!0,negative:!0},tpe={small:!0,medium:!0,large:!0,xlarge:!0},W={theme:"positive",size:"medium"},sn=(t,e,n="medium")=>{const i=yA.find(a=>a.key===n)?.value,r=c8.find(a=>a.key===e)?.value;return`${Zde}${t}_${r}_${i}.png`},vn=t=>yA.find(e=>e.key===t)?.value||"36px",yA=[{value:"24px",key:"small",label:"Small"},{value:"36px",key:"medium",label:"Medium"},{value:"48px",key:"large",label:"Large"}],c8=[{value:"Positive",key:"positive",label:"Light"},{value:"Original",key:"original",label:"Color"},{value:"Negative",key:"negative",label:"Dark"}],j_=[{key:"facebook",label:"Facebook",iconName:"Facebook",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Facebook",W.theme,W.size),href:"https://www.facebook.com/your-profile"},{key:"web",label:"Web",iconName:"Web",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Web",W.theme,W.size),href:"https://www.google.com"},{key:"mail",label:"Mail",iconName:"Mail",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Mail",W.theme,W.size),href:"https://mail.google.com/"},{key:"apple",label:"Apple",iconName:"Apple",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Apple",W.theme,W.size),href:"https://www.apple.com/"},{key:"bluesky",label:"Bluesky",iconName:"Bluesky",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Bluesky",W.theme,W.size),href:"https://bsky.app/"},{key:"clubhouse",label:"ClubHouse",iconName:"Clubhouse",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Clubhouse",W.theme,W.size),href:"https://www.clubhouse.com/"},{key:"dribbble",label:"Dribbble",iconName:"Dribbble",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Dribbble",W.theme,W.size),href:"https://dribbble.com/"},{key:"figma",label:"Figma",iconName:"Figma",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Figma",W.theme,W.size),href:"https://www.figma.com/"},{key:"github",label:"Github",iconName:"Github",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Github",W.theme,W.size),href:"https://github.com/"},{key:"google",label:"Google",iconName:"Google",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Google",W.theme,W.size),href:"https://google.com/"},{key:"instagram",label:"Instagram",iconName:"Instagram",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Instagram",W.theme,W.size),href:"https://www.instagram.com/your-profile"},{key:"linkedin",label:"LinkedIn",iconName:"LinkedIn",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("LinkedIn",W.theme,W.size),href:"https://www.linkedin.com/in/your-profile"},{key:"medium-social",label:"Medium",iconName:"Medium",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Medium",W.theme,W.size),href:"https://medium.com/"},{key:"messenger",label:"Messenger",iconName:"Messenger",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Messenger",W.theme,W.size),href:"https://www.messenger.com/"},{key:"pinterest",label:"Pinterest",iconName:"Pinterest",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Pinterest",W.theme,W.size),href:"https://www.pinterest.com/"},{key:"reddit",label:"Reddit",iconName:"Reddit",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Reddit",W.theme,W.size),href:"https://www.reddit.com/"},{key:"signal",label:"Signal",iconName:"Signal",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Signal",W.theme,W.size),href:"https://signal.org/"},{key:"snapchat",label:"Snapchat",iconName:"Snapchat",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Snapchat",W.theme,W.size),href:"https://www.snapchat.com/"},{key:"spotify",label:"Spotify",iconName:"Spotify",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Spotify",W.theme,W.size),href:"https://www.spotify.com/"},{key:"telegram",label:"Telegram",iconName:"Telegram",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Telegram",W.theme,W.size),href:"https://t.me/your-profile"},{key:"threads",label:"Threads",iconName:"Threads",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Threads",W.theme,W.size),href:"https://www.threads.net/"},{key:"tiktok",label:"TikTok",iconName:"TikTok",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("TikTok",W.theme,W.size),href:"https://www.tiktok.com/@your-profile"},{key:"tumblr",label:"Tumblr",iconName:"Tumblr",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Tumblr",W.theme,W.size),href:"https://www.tumblr.com/"},{key:"twitch",label:"Twitch",iconName:"Twitch",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("Twitch",W.theme,W.size),href:"https://www.twitch.tv/"},{key:"vk",label:"VK",iconName:"VK",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("VK",W.theme,W.size),href:"https://vk.com/"},{key:"whatsapp",label:"WhatsApp",iconName:"WhatsApp",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("WhatsApp",W.theme,W.size),href:"https://www.whatsapp.com/"},{key:"x",label:"X",iconName:"X",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("X",W.theme,W.size),href:"https://x.com/your-profile"},{key:"youtube",label:"YouTube",iconName:"YouTube",theme:W.theme,size:W.size,sizePx:vn(W.size),url:sn("YouTube",W.theme,W.size),href:"https://www.youtube.com/channel/your-channel-id"}];function Xf(){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 npe=({element:t,index:e,moveItem:n,onSelectChange:i,onUrlChange:r,onRemove:a,onDuplicate:s,canRemove:o,theme:l})=>{const c=D.useRef(null),[u,d]=D.useState(null),{t:p}=nt.useTranslation("inspector"),f=k=>{const w=k.getClientOffset(),A=c.current?.getBoundingClientRect();if(!w||!A)return null;const L=(A.bottom-A.top)/2;return w.y-A.top<L?"up":"down"},[{handlerId:m,isOver:g},_]=Yl.useDrop(()=>({accept:"social-media-item",collect(k){return{handlerId:k.getHandlerId(),isOver:k.isOver({shallow:!0})}},hover(k,w){if(!c.current)return;if(k.index===e){d(null);return}if(!w.isOver({shallow:!0})){d(null);return}const I=f(w);d(I)},drop(k,w){if(d(null),!c.current)return;const A=k.index,L=e;if(A===L)return;const I=f(w);let O=L;I==="down"&&(O=L+1),A<O&&(O=O-1),setTimeout(()=>{n(A,O)},0),k.index=O},end:()=>{d(null)}}),[t.id,e,n]),[{isDragging:b},y]=Yl.useDrag(()=>({type:"social-media-item",item:()=>({id:t.id,index:e}),collect:k=>({isDragging:k.isDragging()}),end:()=>{d(null)}}),[t.id,e]);D.useEffect(()=>{g||d(null)},[g]);const E=b?.4:1;D.useEffect(()=>{if(c.current&&y&&_){const k=c.current;y(k),_(k)}},[y,_]);const v=()=>{setTimeout(()=>a(e),0)},T=()=>{setTimeout(()=>s(e),0)},S=k=>{const w=k.target.value;setTimeout(()=>i(e,w,t),0)},C=k=>{const w=k.target.value;setTimeout(()=>r(e,w,t),0)},x=()=>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(x,{}),h.jsxs(_n,{ref:c,"data-handler-id":m,sx:{border:1,borderColor:"divider",padding:1,paddingTop:0,borderRadius:1,backgroundColor:"background.paper",marginBottom:1.5,opacity:E,cursor:b?"grabbing":"grab",boxShadow:b?l.shadows[3]:"none"},gap:1,children:[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(SU,{sx:{color:b?"primary.main":"text.secondary",cursor:"grab",marginLeft:-.9,"&:hover":{color:"primary.main"}}})}),h.jsxs("div",{children:[h.jsx(Nn,{disableInteractive:!0,arrow:!0,title:"Duplicate",placement:"left",children:h.jsx(Wn,{color:"primary",size:"small",onClick:T,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(Nn,{disableInteractive:!0,arrow:!0,title:"Remove",placement:"left",children:h.jsx(Wn,{color:"error",size:"small",onClick:v,children:h.jsx(sue,{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($n,{label:p("inputs.social.icon")}),h.jsx(Jl,{fullWidth:!0,labelId:"demo-simple-select-label",id:"demo-simple-select",value:t.key,size:"small",onChange:S,children:j_.map(k=>h.jsx(Xa,{value:k.key,children:k.label},`${t.id}_${k.key}`))})]}),h.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[h.jsx($n,{label:p("inputs.social.url")}),h.jsx(jp,{size:"small",fullWidth:!0,value:t.href??"",onChange:C,variant:"outlined",placeholder:"https://your-website.com",sx:$v})]})]})]}),u==="down"&&h.jsx(x,{})]})};function ipe({items:t=[],onChange:e}){const{t:n}=nt.useTranslation("inspector"),i=Xt(),[r,a]=D.useState(()=>t.map(_=>({..._,id:_.id||Xf()}))),[s,o]=D.useState(t[0]?.theme||"positive"),[l,c]=D.useState(t[0]?.size||"medium");D.useEffect(()=>{t.length>0&&(o(t[0].theme),c(t[0].size),a(t.map(_=>({..._,id:_.id||Xf()}))))},[t]);const u=(_,b)=>{a(y=>{const E=[...y],[v]=E.splice(_,1);return E.splice(b,0,v),e&&setTimeout(()=>e(E),0),E})},d=()=>{a(_=>{const b={...j_[0],theme:s,size:l,sizePx:vn(l),url:sn(j_[0].iconName,s,l),id:Xf()},y=[..._,b];return e&&setTimeout(()=>e(y),0),y})},p=_=>{a(b=>{const y=b.filter((E,v)=>v!==_);return e&&setTimeout(()=>e(y),0),y})},f=(_,b,y)=>{let E=[...r];if(b in epe?(o(b),E=E.map(v=>{const T=sn(v.iconName,b,v.size);return{...v,theme:b,url:T}})):b in tpe&&(c(b),E=E.map(v=>{const T=sn(v.iconName,v.theme,b),S=vn(b);return{...v,size:b,sizePx:S,url:T}})),_!==null&&y){const v=j_.find(T=>T.key===b);v&&(E=E.map((T,S)=>{const C={key:v.key,label:v.label,iconName:v.iconName,href:v.href},x=sn(C.iconName,y.theme,y.size);return S===_?{...T,...C,url:x,id:y.id}:T}))}a(E),e&&setTimeout(()=>e(E),0)},m=(_,b,y)=>{const E=r.map((v,T)=>T===_?{...y,href:b}:v);a(E),e&&setTimeout(()=>e(E),0)},g=_=>{a(b=>{const y={...JSON.parse(JSON.stringify(b[_])),id:Xf()},E=[...b.slice(0,_+1),y,...b.slice(_+1)];return e&&setTimeout(()=>e(E),0),E})};return h.jsxs(h.Fragment,{children:[h.jsxs("div",{style:{marginBottom:"1rem",display:"grid",gridTemplateColumns:"repeat(2,1fr)",gap:"1rem"},children:[h.jsxs(Ki,{children:[h.jsx($n,{label:n("inputs.social.theme")}),h.jsx(Jl,{fullWidth:!0,labelId:"theme-selector",id:"theme-selector",value:s,size:"small",onChange:_=>f(null,_.target.value,null),children:c8.map(_=>h.jsx(Xa,{value:_.key,children:_.label},`${_.key}`))})]}),h.jsxs(Ki,{children:[h.jsx($n,{label:n("inputs.social.size")}),h.jsx(Jl,{fullWidth:!0,labelId:"size-selector",id:"size-selector",value:l,size:"small",onChange:_=>f(null,_.target.value,null),children:yA.map(_=>h.jsx(Xa,{value:_.key,children:_.label},`${_.key}`))})]})]}),r?.map((_,b)=>h.jsx(npe,{element:_,index:b,moveItem:u,onSelectChange:f,onUrlChange:m,onRemove:p,onDuplicate:g,canRemove:r.length>1,theme:i},_.id)),h.jsx(qi,{onClick:d,sx:{borderRadius:1},variant:"contained",endIcon:h.jsx(qce,{}),children:"Add"})]})}const rpe=({data:t,setData:e})=>{const[,n]=D.useState(null),i=fi(),{t:r}=nt.useTranslation("inspector"),a=u=>{const d=o8.safeParse(u);d.success?(e(d.data),n(null)):n(d.error)},s=u=>{a({...t,items:u})},o=u=>{a({...t,style:u})},l=(u,d=!1)=>{if(d){a({...t,gapMobile:u});return}a({...t,gap:u})},c=Qo();return h.jsxs(gs,{title:r("inputs.panels.social.title"),children:[c=="block-configuration"&&h.jsx(We,{sx:{minWidth:120,margin:1},children:h.jsx(ipe,{items:t?.items??[],onChange:s})}),c=="css"&&h.jsxs(h.Fragment,{children:[h.jsxs(Ki,{children:[h.jsx($n,{label:r("inputs.panels.social.gap")}),i=="desktop"?h.jsx(di,{iconLabel:h.jsx($O,{sx:{color:"text.primary"}}),value:Number(t?.gap??4),setValue:u=>l(u,!1),marks:!0,step:4,units:"px",min:0,max:40}):h.jsx(di,{iconLabel:h.jsx($O,{sx:{color:"text.primary"}}),value:Number(t?.gapMobile??t?.gap??4),setValue:u=>l(u,!0),marks:!0,step:4,units:"px",min:0,max:40})]}),h.jsx(Nr,{names:["textAlign","textAlignMobile","backgroundColor","padding","mobilePadding"],value:t.style,onChange:u=>o(u)})]})]})},ape=rt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),u8=vt({style:vt({height:Oe().optional().nullable(),heightMobile:Oe().optional().nullable(),background:rt().nullable().optional(),backgroundColor:ape}).optional().nullable()}),cM={height:16};function d8({style:t,blockId:e}){const i=fi()==="desktop"?t?.height??cM.height:t?.heightMobile??t?.height??cM.height,r=t?.background??"",a=t?.backgroundColor??"",s=a?Iu(r,a):r,o={width:"100%",minWidth:"100%",backgroundColor:a||void 0,background:s||void 0},l=Wt(e);return h.jsx("table",{className:l,width:"100%",style:o,children:h.jsx("tbody",{children:h.jsx("tr",{className:`it${l}`,style:{height:i},children:h.jsx("td",{})})})})}function p8({data:t,setData:e}){const[,n]=D.useState(null),{t:i}=nt.useTranslation("inspector"),r=a=>{const s=u8.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return h.jsx(gs,{title:i("inputs.panels.spacer.title"),children:h.jsx(Nr,{names:["height","heightMobile","backgroundColor"],value:t.style,onChange:a=>r({...t,style:a})})})}function spe({data:t,setData:e}){const n=Qo(),{t:i}=nt.useTranslation("inspector"),r=t.style||{},a=s=>{const o={...r||{},...s||{}};e({...t,style:o})};return h.jsxs(gs,{title:i("inputs.panels.notionText.title","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(Nr,{disabledCSSValidation:!0,names:["fontFamily"],value:r,onChange:a})}),h.jsx("div",{style:{flex:1},children:h.jsx(Nr,{disabledCSSValidation:!0,names:["lineHeight"],value:r,onChange:a})})]}),h.jsx(Nr,{disabledCSSValidation:!0,names:["fontSize","fontSizeMobile"],value:r,onChange:a})]}),n==="css"&&h.jsx(Nr,{names:["backgroundColor","border","borderMobile","padding","mobilePadding"],value:r,onChange:a})]})}function uM(t){return h.jsx(We,{sx:{m:3,p:1,border:"1px dashed",borderColor:"divider"},children:h.jsx(gn,{color:"text.secondary",children:t})})}function ope(){const t=Yh(),e=rU(t||""),n=D.useCallback(a=>{t&&Pb(t,()=>a)},[t]);if(!t)return uM("Click on a block to inspect.");if(!e)return uM(`Block with id ${t} was not found. Click on a block to reset.`);const{data:i,type:r}=e;switch(r){case"Button":return h.jsx(Tde,{data:i,setData:a=>n({type:r,data:a})},t);case"ColumnsContainer":return h.jsx(Ode,{data:i,setData:a=>n({type:r,data:a})},t);case"Container":return h.jsx(QU,{data:i,setData:a=>n({type:r,data:a})},t);case"Divider":return h.jsx(ZU,{data:i,setData:a=>n({type:r,data:a})},t);case"Heading":return h.jsx(Hde,{data:i,setData:a=>n({type:r,data:a})},t);case"Html":return h.jsx(Vde,{data:i,setData:a=>n({type:r,data:a})},t);case"Image":return h.jsx(Xde,{data:i,setData:a=>n({type:r,data:a})},t);case"EmailLayout":return h.jsx(t8,{data:i,setData:a=>n({type:r,data:a})},t);case"Spacer":return h.jsx(p8,{data:i,setData:a=>n({type:r,data:a})},t);case"NotionText":return h.jsx(spe,{data:i,setData:a=>n({type:r,data:a})},t);case"SocialMedia":return h.jsx(rpe,{data:i,setData:a=>n({type:r,data:a})},t);default:return h.jsx("pre",{children:JSON.stringify(e,null," ")})}}const lpe=D.memo(ope),cpe={EmailLayout:{label:"Email",iconName:"DashboardOutlined"},NotionText:{label:"Text",iconName:"ArticleOutlined"},SocialMedia:{label:"Social",iconName:"Groups2"},Button:{label:"Button",iconName:"SmartButtonOutlined"},Image:{label:"Image",iconName:"ImageOutlined"},Divider:{label:"Divider",iconName:"HorizontalRuleOutlined"},Spacer:{label:"Spacer",iconName:"Crop32Outlined"},ColumnsContainer:{label:"Columns",iconName:"ViewColumnOutlined"},Container:{label:"Container",iconName:"LibraryAddOutlined"},Heading:{label:"Heading",iconName:"Title"},Html:{label:"HTML",iconName:"CodeOutlined"}},upe=t=>e=>e.document[t];function dpe(t){if(!t)return[];switch(t.type){case"EmailLayout":return t.data?.childrenIds||[];case"Container":return t.data?.props?.childrenIds||[];case"ColumnsContainer":return t.data?.props?.columns?.flatMap(e=>e.childrenIds||[])||[];default:return[]}}function f8(t,e,n){const i=dpe(t[e]);for(const r of i)if(r===n||f8(t,r,n))return!0;return!1}function ppe(t,e,n,i){if(!i)return!1;const r=t[e];if(!r||r.type!=="ColumnsContainer")return!1;const a=r.data?.props?.columns?.[n]?.childrenIds||[];for(const s of a)if(s===i||f8(t,s,i))return!0;return!1}function fpe(t){const e=t.document;if(!e||!e.root)return null;function n(r,a){const s=a.document[r];if(!s)return[];switch(s.type){case"EmailLayout":return s.data?.childrenIds||[];case"Container":return s.data?.props?.childrenIds||[];case"ColumnsContainer":return s.data?.props?.columns?.flatMap(o=>o.childrenIds||[])||[];default:return[]}}function i(r,a,s){const o=s.document[r],l=o?.type??"Unknown",c=cpe[l]??{label:l,iconName:"WidgetsOutlined"};if(l==="ColumnsContainer"){const p=o.data?.props?.columns,m=o.data?.props?.columnsCount===2?2:3,g=[];for(let _=0;_<m;_++){const b=p?.[_]?.childrenIds??[],y=Ple(r,_);g.push({blockId:y,type:"ColumnSlot",label:"",iconName:"WidgetsOutlined",children:b.map(E=>i(E,a+2,s)),depth:a+1,columnSlot:{parentBlockId:r,columnIndex:_,columnsCount:m}})}return{blockId:r,type:l,label:c.label,iconName:c.iconName,children:g,depth:a}}const d=n(r,s).map(p=>i(p,a+1,s));return{blockId:r,type:l,label:c.label,iconName:c.iconName,children:d,depth:a}}return i("root",0,t)}function mpe(t){return ce(t)}function hpe(t){return ce(upe(t))}function gpe(){const t=Yh(),e=hpe(t??"root"),n=D.useCallback(s=>{t&&Pb(t,()=>s)},[t]),i=D.useCallback(s=>{Pb("root",()=>s)},[]);if(!e)return null;const{data:r,type:a}=e;switch(a){case"Container":return h.jsx(QU,{data:r,setData:s=>n({type:a,data:s})},t);case"Divider":return h.jsx(ZU,{data:r,setData:s=>n({type:a,data:s})},t);case"Spacer":return h.jsx(p8,{data:r,setData:s=>n({type:a,data:s})},t);case"EmailLayout":return h.jsx(t8,{data:r,setData:s=>i({type:a,data:s})},"root");default:return h.jsx("pre",{children:JSON.stringify(e,null," ")})}}function _pe({sticky:t,heightContent:e}){const n=Qo(),i=iU(),r=Yh(),a=fi(),s=Xt(),{t:o}=nt.useTranslation("inspector"),l=()=>{const f={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(Eb,{color:"primary",sx:f,label:`${o(a==="desktop"?"header.desktop":"header.mobile")}`}),h.jsx(lpe,{})]});case"styles":return h.jsxs("div",{style:{position:"relative"},children:[h.jsx(gpe,{}),h.jsx(Eb,{color:"primary",sx:f,label:`${o(a==="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"})});D.useEffect(()=>{const f=m=>{const g=m.target;bO(g.innerWidth)};return window&&bO(window.innerWidth),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[n]);const d=(f,m)=>{Wle(m)},p=t?e?`calc(${e} - ${dl})`:void 0:e??void 0;return h.jsxs(rh,{sx:f=>({width:Rb,padding:"0!important",margin:"0!important",height:p,maxHeight:p,display:"flex",flexDirection:"column",overflow:"hidden",position:t?"sticky":"static",top:t?dl:0,backgroundColor:`${f.palette.background.paper} !important`}),children:[h.jsx(We,{sx:{position:"sticky",top:0,zIndex:1,backgroundColor:`${s.palette.background.paper} !important`},children:h.jsxs(F$,{sx:{backgroundColor:`${s.palette.background.paper} !important`},value:n,onChange:d,children:[r!=null&&!xb.includes(i||"")&&[h.jsx(Gc,{sx:{height:dl,minHeight:dl,fontWeight:"bold"},value:"block-configuration",label:o("header.content"),icon:h.jsx(c,{}),iconPosition:"start"},"block-configuration"),h.jsx(Gc,{sx:{height:dl,minHeight:dl,fontWeight:"bold"},value:"css",label:o("header.styles"),icon:h.jsx(u,{}),iconPosition:"start"},"css")],xb.includes(i)&&[h.jsx(Gc,{sx:{height:dl,minHeight:dl,fontWeight:"bold"},value:"styles",label:o("header.styles"),icon:h.jsx(u,{}),iconPosition:"start"},"styles")]]})}),h.jsx(rh,{sx:f=>({flex:"1 1 auto",minHeight:0,overflowY:"auto",px:2,backgroundColor:`${f.palette.background.paper} !important`}),children:l()})]})}const m8=({children:t,topOffset:e=0,zIndex:n=10,className:i="",style:r={},disabled:a=!1,threshold:s=null,...o})=>{const[l,c]=D.useState(!1),[u,d]=D.useState({width:0,height:0}),[p,f]=D.useState({left:0}),[m,g]=D.useState(0),[_,b]=D.useState(!1),y=D.useRef(null),E=D.useRef(null),v=D.useRef(null);D.useEffect(()=>{if(a){c(!1),b(!1),g(0);return}const C=E.current,x=y.current;if(!C||!x)return;let k=null;s&&(s.startsWith("#")?k=document.getElementById(s.slice(1)):(s.startsWith("."),k=document.querySelector(s)));const w=()=>{const M=x.getBoundingClientRect();d({width:M.width,height:M.height}),f({left:M.left})},A=()=>{if(!k||!x)return{offset:0,isPushed:!1};const M=k.getBoundingClientRect(),P=x.getBoundingClientRect(),F=e+P.height;if(M.top<F){const U=F-M.top,H=P.height+20;return{offset:-Math.min(U,H),isPushed:!0}}return{offset:0,isPushed:!1}},L=new IntersectionObserver(([M])=>{const P=!M.isIntersecting;if(P&&!l&&w(),c(P),P&&s){const{offset:F,isPushed:U}=A();g(F),b(U)}else P||(g(0),b(!1))},{threshold:0,rootMargin:`-${e}px 0px 0px 0px`}),I=new ResizeObserver(()=>{w()}),O=()=>{if(s&&l){const{offset:M,isPushed:P}=A();g(M),b(P)}};return L.observe(C),I.observe(x),s&&window.addEventListener("scroll",O,{passive:!0}),w(),()=>{L.disconnect(),I.disconnect(),s&&window.removeEventListener("scroll",O)}},[e,l,a,s]);const T=!a&&l,S=T?`${e+m}px`:"auto";return h.jsxs("div",{ref:v,className:i,...o,children:[!a&&h.jsx("div",{ref:E,style:{height:"1px",position:"absolute",top:`-${e+1}px`,left:0,right:0,pointerEvents:"none"}}),T&&h.jsx("div",{style:{height:`${u.height}px`,width:`${u.width}px`}}),h.jsx("div",{ref:y,style:{position:T?"fixed":"static",top:S,width:"auto",height:"auto",zIndex:T?n:"auto",transition:_?"none":"box-shadow 0.2s ease-in-out, top 0.3s ease-out",..._&&m<-u.height*.3&&{opacity:Math.max(0,1+(m+u.height*.3)/(u.height*.7))},...r},children:t})]})};var h8=z$();function Ui(t){this.content=t}Ui.prototype={constructor:Ui,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var i=n&&n!=t?this.remove(n):this,r=i.find(t),a=i.content.slice();return r==-1?a.push(n||t,e):(a[r+1]=e,n&&(a[r]=n)),new Ui(a)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Ui(n)},addToStart:function(t,e){return new Ui([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Ui(n)},addBefore:function(t,e,n){var i=this.remove(e),r=i.content.slice(),a=i.find(t);return r.splice(a==-1?r.length:a,0,e,n),new Ui(r)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Ui.from(t),t.size?new Ui(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Ui.from(t),t.size?new Ui(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Ui.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Ui.from=function(t){if(t instanceof Ui)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Ui(e)};function g8(t,e,n){for(let i=0;;i++){if(i==t.childCount||i==e.childCount)return t.childCount==e.childCount?null:n;let r=t.child(i),a=e.child(i);if(r==a){n+=r.nodeSize;continue}if(!r.sameMarkup(a))return n;if(r.isText&&r.text!=a.text){for(let s=0;r.text[s]==a.text[s];s++)n++;return n}if(r.content.size||a.content.size){let s=g8(r.content,a.content,n+1);if(s!=null)return s}n+=r.nodeSize}}function _8(t,e,n,i){for(let r=t.childCount,a=e.childCount;;){if(r==0||a==0)return r==a?null:{a:n,b:i};let s=t.child(--r),o=e.child(--a),l=s.nodeSize;if(s==o){n-=l,i-=l;continue}if(!s.sameMarkup(o))return{a:n,b:i};if(s.isText&&s.text!=o.text){let c=0,u=Math.min(s.text.length,o.text.length);for(;c<u&&s.text[s.text.length-c-1]==o.text[o.text.length-c-1];)c++,n--,i--;return{a:n,b:i}}if(s.content.size||o.content.size){let c=_8(s.content,o.content,n-1,i-1);if(c)return c}n-=l,i-=l}}class ue{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let i=0;i<e.length;i++)this.size+=e[i].nodeSize}nodesBetween(e,n,i,r=0,a){for(let s=0,o=0;o<n;s++){let l=this.content[s],c=o+l.nodeSize;if(c>e&&i(l,r+o,a||null,s)!==!1&&l.content.size){let u=o+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),i,r+u)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,i,r){let a="",s=!0;return this.nodesBetween(e,n,(o,l)=>{let c=o.isText?o.text.slice(Math.max(e,l)-l,n-l):o.isLeaf?r?typeof r=="function"?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&i&&(s?s=!1:a+=i),a+=c},0),a}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,i=e.firstChild,r=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(i)&&(r[r.length-1]=n.withText(n.text+i.text),a=1);a<e.content.length;a++)r.push(e.content[a]);return new ue(r,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let i=[],r=0;if(n>e)for(let a=0,s=0;s<n;a++){let o=this.content[a],l=s+o.nodeSize;l>e&&((s<e||l>n)&&(o.isText?o=o.cut(Math.max(0,e-s),Math.min(o.text.length,n-s)):o=o.cut(Math.max(0,e-s-1),Math.min(o.content.size,n-s-1))),i.push(o),r+=o.nodeSize),s=l}return new ue(i,r)}cutByIndex(e,n){return e==n?ue.empty:e==0&&n==this.content.length?this:new ue(this.content.slice(e,n))}replaceChild(e,n){let i=this.content[e];if(i==n)return this;let r=this.content.slice(),a=this.size+n.nodeSize-i.nodeSize;return r[e]=n,new ue(r,a)}addToStart(e){return new ue([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ue(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,i=0;n<this.content.length;n++){let r=this.content[n];e(r,i,n),i+=r.nodeSize}}findDiffStart(e,n=0){return g8(this,e,n)}findDiffEnd(e,n=this.size,i=e.size){return _8(this,e,n,i)}findIndex(e){if(e==0)return Vg(0,e);if(e==this.size)return Vg(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,i=0;;n++){let r=this.child(n),a=i+r.nodeSize;if(a>=e)return a==e?Vg(n+1,a):Vg(n,i);i=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return ue.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ue(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ue.empty;let n,i=0;for(let r=0;r<e.length;r++){let a=e[r];i+=a.nodeSize,r&&a.isText&&e[r-1].sameMarkup(a)?(n||(n=e.slice(0,r)),n[n.length-1]=a.withText(n[n.length-1].text+a.text)):n&&n.push(a)}return new ue(n||e,i)}static from(e){if(!e)return ue.empty;if(e instanceof ue)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ue([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ue.empty=new ue([],0);const AS={index:0,offset:0};function Vg(t,e){return AS.index=t,AS.offset=e,AS}function Yb(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!Yb(t[i],e[i]))return!1}else{for(let i in t)if(!(i in e)||!Yb(t[i],e[i]))return!1;for(let i in e)if(!(i in t))return!1}return!0}let On=class Ak{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,i=!1;for(let r=0;r<e.length;r++){let a=e[r];if(this.eq(a))return e;if(this.type.excludes(a.type))n||(n=e.slice(0,r));else{if(a.type.excludes(this.type))return e;!i&&a.type.rank>this.type.rank&&(n||(n=e.slice(0,r)),n.push(this),i=!0),n&&n.push(a)}}return n||(n=e.slice()),i||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Yb(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let i=e.marks[n.type];if(!i)throw new RangeError(`There is no mark type ${n.type} in this schema`);let r=i.create(n.attrs);return i.checkAttrs(r.attrs),r}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let i=0;i<e.length;i++)if(!e[i].eq(n[i]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ak.none;if(e instanceof Ak)return[e];let n=e.slice();return n.sort((i,r)=>i.type.rank-r.type.rank),n}};On.none=[];class Kb extends Error{}class Fe{constructor(e,n,i){this.content=e,this.openStart=n,this.openEnd=i}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let i=y8(this.content,e+this.openStart,n);return i&&new Fe(i,this.openStart,this.openEnd)}removeBetween(e,n){return new Fe(b8(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Fe.empty;let i=n.openStart||0,r=n.openEnd||0;if(typeof i!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Fe(ue.fromJSON(e,n.content),i,r)}static maxOpen(e,n=!0){let i=0,r=0;for(let a=e.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)i++;for(let a=e.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)r++;return new Fe(e,i,r)}}Fe.empty=new Fe(ue.empty,0,0);function b8(t,e,n){let{index:i,offset:r}=t.findIndex(e),a=t.maybeChild(i),{index:s,offset:o}=t.findIndex(n);if(r==e||a.isText){if(o!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(i!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(i,a.copy(b8(a.content,e-r-1,n-r-1)))}function y8(t,e,n,i){let{index:r,offset:a}=t.findIndex(e),s=t.maybeChild(r);if(a==e||s.isText)return i&&!i.canReplace(r,r,n)?null:t.cut(0,e).append(n).append(t.cut(e));let o=y8(s.content,e-a-1,n,s);return o&&t.replaceChild(r,s.copy(o))}function bpe(t,e,n){if(n.openStart>t.depth)throw new Kb("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Kb("Inconsistent open depths");return v8(t,e,n,0)}function v8(t,e,n,i){let r=t.index(i),a=t.node(i);if(r==e.index(i)&&i<t.depth-n.openStart){let s=v8(t,e,n,i+1);return a.copy(a.content.replaceChild(r,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==i&&e.depth==i){let s=t.parent,o=s.content;return tu(s,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}else{let{start:s,end:o}=ype(n,t);return tu(a,S8(t,s,o,e,i))}else return tu(a,Qb(t,e,i))}function E8(t,e){if(!e.type.compatibleContent(t.type))throw new Kb("Cannot join "+e.type.name+" onto "+t.type.name)}function Nk(t,e,n){let i=t.node(n);return E8(i,e.node(n)),i}function eu(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function km(t,e,n,i){let r=(e||t).node(n),a=0,s=e?e.index(n):r.childCount;t&&(a=t.index(n),t.depth>n?a++:t.textOffset&&(eu(t.nodeAfter,i),a++));for(let o=a;o<s;o++)eu(r.child(o),i);e&&e.depth==n&&e.textOffset&&eu(e.nodeBefore,i)}function tu(t,e){return t.type.checkContent(e),t.copy(e)}function S8(t,e,n,i,r){let a=t.depth>r&&Nk(t,e,r+1),s=i.depth>r&&Nk(n,i,r+1),o=[];return km(null,t,r,o),a&&s&&e.index(r)==n.index(r)?(E8(a,s),eu(tu(a,S8(t,e,n,i,r+1)),o)):(a&&eu(tu(a,Qb(t,e,r+1)),o),km(e,n,r,o),s&&eu(tu(s,Qb(n,i,r+1)),o)),km(i,null,r,o),new ue(o)}function Qb(t,e,n){let i=[];if(km(null,t,n,i),t.depth>n){let r=Nk(t,e,n+1);eu(tu(r,Qb(t,e,n+1)),i)}return km(e,null,n,i),new ue(i)}function ype(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let a=n-1;a>=0;a--)r=e.node(a).copy(ue.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class uh{constructor(e,n,i){this.pos=e,this.path=n,this.parentOffset=i,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let i=this.pos-this.path[this.path.length-1],r=e.child(n);return i?e.child(n).cut(i):r}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let i=this.path[n*3],r=n==0?0:this.path[n*3-1]+1;for(let a=0;a<e;a++)r+=i.child(a).nodeSize;return r}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return On.none;if(this.textOffset)return e.child(n).marks;let i=e.maybeChild(n-1),r=e.maybeChild(n);if(!i){let o=i;i=r,r=o}let a=i.marks;for(var s=0;s<a.length;s++)a[s].type.spec.inclusive===!1&&(!r||!a[s].isInSet(r.marks))&&(a=a[s--].removeFromSet(a));return a}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let i=n.marks,r=e.parent.maybeChild(e.index());for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let i=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);i>=0;i--)if(e.pos<=this.end(i)&&(!n||n(this.node(i))))return new Xb(this,e,i);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let i=[],r=0,a=n;for(let s=e;;){let{index:o,offset:l}=s.content.findIndex(a),c=a-l;if(i.push(s,o,r+l),!c||(s=s.child(o),s.isText))break;a=c-1,r+=l+1}return new uh(n,i,a)}static resolveCached(e,n){let i=dM.get(e);if(i)for(let a=0;a<i.elts.length;a++){let s=i.elts[a];if(s.pos==n)return s}else dM.set(e,i=new vpe);let r=i.elts[i.i]=uh.resolve(e,n);return i.i=(i.i+1)%Epe,r}}class vpe{constructor(){this.elts=[],this.i=0}}const Epe=12,dM=new WeakMap;class Xb{constructor(e,n,i){this.$from=e,this.$to=n,this.depth=i}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Spe=Object.create(null);let Ul=class Rk{constructor(e,n,i,r=On.none){this.type=e,this.attrs=n,this.marks=r,this.content=i||ue.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,i,r=0){this.content.nodesBetween(e,n,i,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,i,r){return this.content.textBetween(e,n,i,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,i){return this.type==e&&Yb(this.attrs,n||e.defaultAttrs||Spe)&&On.sameSet(this.marks,i||On.none)}copy(e=null){return e==this.content?this:new Rk(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Rk(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,i=!1){if(e==n)return Fe.empty;let r=this.resolve(e),a=this.resolve(n),s=i?0:r.sharedDepth(n),o=r.start(s),c=r.node(s).content.cut(r.pos-o,a.pos-o);return new Fe(c,r.depth-s,a.depth-s)}replace(e,n,i){return bpe(this.resolve(e),this.resolve(n),i)}nodeAt(e){for(let n=this;;){let{index:i,offset:r}=n.content.findIndex(e);if(n=n.maybeChild(i),!n)return null;if(r==e||n.isText)return n;e-=r+1}}childAfter(e){let{index:n,offset:i}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:i}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:i}=this.content.findIndex(e);if(i<e)return{node:this.content.child(n),index:n,offset:i};let r=this.content.child(n-1);return{node:r,index:n-1,offset:i-r.nodeSize}}resolve(e){return uh.resolveCached(this,e)}resolveNoCache(e){return uh.resolve(this,e)}rangeHasMark(e,n,i){let r=!1;return n>e&&this.nodesBetween(e,n,a=>(i.isInSet(a.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),C8(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,i=ue.empty,r=0,a=i.childCount){let s=this.contentMatchAt(e).matchFragment(i,r,a),o=s&&s.matchFragment(this.content,n);if(!o||!o.validEnd)return!1;for(let l=r;l<a;l++)if(!this.type.allowsMarks(i.child(l).marks))return!1;return!0}canReplaceWith(e,n,i,r){if(r&&!this.type.allowsMarks(r))return!1;let a=this.contentMatchAt(e).matchType(i),s=a&&a.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=On.none;for(let n=0;n<this.marks.length;n++){let i=this.marks[n];i.type.checkAttrs(i.attrs),e=i.addToSet(e)}if(!On.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let i;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");i=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,i)}let r=ue.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,r,i);return a.type.checkAttrs(a.attrs),a}};Ul.prototype.text=void 0;class Jb extends Ul{constructor(e,n,i,r){if(super(e,n,null,r),!i)throw new RangeError("Empty text nodes are not allowed");this.text=i}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):C8(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Jb(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Jb(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function C8(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class _u{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let i=new Cpe(e,n);if(i.next==null)return _u.empty;let r=T8(i);i.next&&i.err("Unexpected trailing text");let a=Npe(Ape(r));return Rpe(a,i),a}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,i=e.childCount){let r=this;for(let a=n;r&&a<i;a++)r=r.matchType(e.child(a).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let i=0;i<e.next.length;i++)if(this.next[n].type==e.next[i].type)return!0;return!1}fillBefore(e,n=!1,i=0){let r=[this];function a(s,o){let l=s.matchFragment(e,i);if(l&&(!n||l.validEnd))return ue.from(o.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&r.indexOf(d)==-1){r.push(d);let p=a(d,o.concat(u));if(p)return p}}return null}return a(this,[])}findWrapping(e){for(let i=0;i<this.wrapCache.length;i+=2)if(this.wrapCache[i]==e)return this.wrapCache[i+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),i=[{match:this,type:null,via:null}];for(;i.length;){let r=i.shift(),a=r.match;if(a.matchType(e)){let s=[];for(let o=r;o.type;o=o.via)s.push(o.type);return s.reverse()}for(let s=0;s<a.next.length;s++){let{type:o,next:l}=a.next[s];!o.isLeaf&&!o.hasRequiredAttrs()&&!(o.name in n)&&(!r.type||l.validEnd)&&(i.push({match:o.contentMatch,type:o,via:r}),n[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(i){e.push(i);for(let r=0;r<i.next.length;r++)e.indexOf(i.next[r].next)==-1&&n(i.next[r].next)}return n(this),e.map((i,r)=>{let a=r+(i.validEnd?"*":" ")+" ";for(let s=0;s<i.next.length;s++)a+=(s?", ":"")+i.next[s].type.name+"->"+e.indexOf(i.next[s].next);return a}).join(`
|
|
148
148
|
`)}}_u.empty=new _u(!0);let Cpe=class{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function T8(t){let e=[];do e.push(Tpe(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Tpe(t){let e=[];do e.push(xpe(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function xpe(t){let e=Dpe(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=kpe(t,e);else break;return e}function pM(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function kpe(t,e){let n=pM(t),i=n;return t.eat(",")&&(t.next!="}"?i=pM(t):i=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:i,expr:e}}function wpe(t,e){let n=t.nodeTypes,i=n[e];if(i)return[i];let r=[];for(let a in n){let s=n[a];s.isInGroup(e)&&r.push(s)}return r.length==0&&t.err("No node type or group '"+e+"' found"),r}function Dpe(t){if(t.eat("(")){let e=T8(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=wpe(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Ape(t){let e=[[]];return r(a(t,0),n()),e;function n(){return e.push([])-1}function i(s,o,l){let c={term:l,to:o};return e[s].push(c),c}function r(s,o){s.forEach(l=>l.to=o)}function a(s,o){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(a(c,o)),[]);if(s.type=="seq")for(let l=0;;l++){let c=a(s.exprs[l],o);if(l==s.exprs.length-1)return c;r(c,o=n())}else if(s.type=="star"){let l=n();return i(o,l),r(a(s.expr,l),l),[i(l)]}else if(s.type=="plus"){let l=n();return r(a(s.expr,o),l),r(a(s.expr,l),l),[i(l)]}else{if(s.type=="opt")return[i(o)].concat(a(s.expr,o));if(s.type=="range"){let l=o;for(let c=0;c<s.min;c++){let u=n();r(a(s.expr,l),u),l=u}if(s.max==-1)r(a(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let u=n();i(l,u),r(a(s.expr,l),u),l=u}return[i(l)]}else{if(s.type=="name")return[i(o,void 0,s.value)];throw new Error("Unknown expr type")}}}}function x8(t,e){return e-t}function fM(t,e){let n=[];return i(e),n.sort(x8);function i(r){let a=t[r];if(a.length==1&&!a[0].term)return i(a[0].to);n.push(r);for(let s=0;s<a.length;s++){let{term:o,to:l}=a[s];!o&&n.indexOf(l)==-1&&i(l)}}}function Npe(t){let e=Object.create(null);return n(fM(t,0));function n(i){let r=[];i.forEach(s=>{t[s].forEach(({term:o,to:l})=>{if(!o)return;let c;for(let u=0;u<r.length;u++)r[u][0]==o&&(c=r[u][1]);fM(t,l).forEach(u=>{c||r.push([o,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let a=e[i.join(",")]=new _u(i.indexOf(t.length-1)>-1);for(let s=0;s<r.length;s++){let o=r[s][1].sort(x8);a.next.push({type:r[s][0],next:e[o.join(",")]||n(o)})}return a}}function Rpe(t,e){for(let n=0,i=[t];n<i.length;n++){let r=i[n],a=!r.validEnd,s=[];for(let o=0;o<r.next.length;o++){let{type:l,next:c}=r.next[o];s.push(l.name),a&&!(l.isText||l.hasRequiredAttrs())&&(a=!1),i.indexOf(c)==-1&&i.push(c)}a&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function k8(t){let e=Object.create(null);for(let n in t){let i=t[n];if(!i.hasDefault)return null;e[n]=i.default}return e}function w8(t,e){let n=Object.create(null);for(let i in t){let r=e&&e[i];if(r===void 0){let a=t[i];if(a.hasDefault)r=a.default;else throw new RangeError("No value supplied for attribute "+i)}n[i]=r}return n}function D8(t,e,n,i){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let r in t){let a=t[r];a.validate&&a.validate(e[r])}}function A8(t,e){let n=Object.create(null);if(e)for(let i in e)n[i]=new Ope(t,i,e[i]);return n}let mM=class N8{constructor(e,n,i){this.name=e,this.schema=n,this.spec=i,this.markSet=null,this.groups=i.group?i.group.split(" "):[],this.attrs=A8(e,i.attrs),this.defaultAttrs=k8(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(i.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==_u.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:w8(this.attrs,e)}create(e=null,n,i){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ul(this,this.computeAttrs(e),ue.from(n),On.setFrom(i))}createChecked(e=null,n,i){return n=ue.from(n),this.checkContent(n),new Ul(this,this.computeAttrs(e),n,On.setFrom(i))}createAndFill(e=null,n,i){if(e=this.computeAttrs(e),n=ue.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let r=this.contentMatch.matchFragment(n),a=r&&r.fillBefore(ue.empty,!0);return a?new Ul(this,e,n.append(a),On.setFrom(i)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let i=0;i<e.childCount;i++)if(!this.allowsMarks(e.child(i).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){D8(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let i=0;i<e.length;i++)this.allowsMarkType(e[i].type)?n&&n.push(e[i]):n||(n=e.slice(0,i));return n?n.length?n:On.none:e}static compile(e,n){let i=Object.create(null);e.forEach((a,s)=>i[a]=new N8(a,n,s));let r=n.spec.topNode||"doc";if(!i[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!i.text)throw new RangeError("Every schema needs a 'text' type");for(let a in i.text.attrs)throw new RangeError("The text node type should not have attributes");return i}};function Ipe(t,e,n){let i=n.split("|");return r=>{let a=r===null?"null":typeof r;if(i.indexOf(a)<0)throw new RangeError(`Expected value of type ${i} for attribute ${e} on type ${t}, got ${a}`)}}class Ope{constructor(e,n,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?Ipe(e,n,i.validate):i.validate}get isRequired(){return!this.hasDefault}}class Uv{constructor(e,n,i,r){this.name=e,this.rank=n,this.schema=i,this.spec=r,this.attrs=A8(e,r.attrs),this.excluded=null;let a=k8(this.attrs);this.instance=a?new On(this,a):null}create(e=null){return!e&&this.instance?this.instance:new On(this,w8(this.attrs,e))}static compile(e,n){let i=Object.create(null),r=0;return e.forEach((a,s)=>i[a]=new Uv(a,r++,n,s)),i}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){D8(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class R8{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let r in e)n[r]=e[r];n.nodes=Ui.from(e.nodes),n.marks=Ui.from(e.marks||{}),this.nodes=mM.compile(this.spec.nodes,this),this.marks=Uv.compile(this.spec.marks,this);let i=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let a=this.nodes[r],s=a.spec.content||"",o=a.spec.marks;if(a.contentMatch=i[s]||(i[s]=_u.parse(s,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=o=="_"?null:o?hM(this,o.split(" ")):o==""||!a.inlineContent?[]:null}for(let r in this.marks){let a=this.marks[r],s=a.spec.excludes;a.excluded=s==null?[a]:s==""?[]:hM(this,s.split(" "))}this.nodeFromJSON=r=>Ul.fromJSON(this,r),this.markFromJSON=r=>On.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,i,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof mM){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,i,r)}text(e,n){let i=this.nodes.text;return new Jb(i,i.defaultAttrs,e,On.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function hM(t,e){let n=[];for(let i=0;i<e.length;i++){let r=e[i],a=t.marks[r],s=a;if(a)n.push(a);else for(let o in t.marks){let l=t.marks[o];(r=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(r)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[i]+"'")}return n}function Mpe(t){return t.tag!=null}function Ppe(t){return t.style!=null}class zl{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let i=this.matchedStyles=[];n.forEach(r=>{if(Mpe(r))this.tags.push(r);else if(Ppe(r)){let a=/[^=]*/.exec(r.style)[0];i.indexOf(a)<0&&i.push(a),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let a=e.nodes[r.node];return a.contentMatch.matchType(a)})}parse(e,n={}){let i=new _M(this,n,!1);return i.addAll(e,On.none,n.from,n.to),i.finish()}parseSlice(e,n={}){let i=new _M(this,n,!0);return i.addAll(e,On.none,n.from,n.to),Fe.maxOpen(i.finish())}matchTag(e,n,i){for(let r=i?this.tags.indexOf(i)+1:0;r<this.tags.length;r++){let a=this.tags[r];if(Bpe(e,a.tag)&&(a.namespace===void 0||e.namespaceURI==a.namespace)&&(!a.context||n.matchesContext(a.context))){if(a.getAttrs){let s=a.getAttrs(e);if(s===!1)continue;a.attrs=s||void 0}return a}}}matchStyle(e,n,i,r){for(let a=r?this.styles.indexOf(r)+1:0;a<this.styles.length;a++){let s=this.styles[a],o=s.style;if(!(o.indexOf(e)!=0||s.context&&!i.matchesContext(s.context)||o.length>e.length&&(o.charCodeAt(e.length)!=61||o.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function i(r){let a=r.priority==null?50:r.priority,s=0;for(;s<n.length;s++){let o=n[s];if((o.priority==null?50:o.priority)<a)break}n.splice(s,0,r)}for(let r in e.marks){let a=e.marks[r].spec.parseDOM;a&&a.forEach(s=>{i(s=bM(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let a=e.nodes[r].spec.parseDOM;a&&a.forEach(s=>{i(s=bM(s)),s.node||s.ignore||s.mark||(s.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new zl(e,zl.schemaRules(e)))}}const I8={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Lpe={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},O8={ol:!0,ul:!0},dh=1,Ik=2,wm=4;function gM(t,e,n){return e!=null?(e?dh:0)|(e==="full"?Ik:0):t&&t.whitespace=="pre"?dh|Ik:n&~wm}class Wg{constructor(e,n,i,r,a,s){this.type=e,this.attrs=n,this.marks=i,this.solid=r,this.options=s,this.content=[],this.activeMarks=On.none,this.match=a||(s&wm?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ue.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let i=this.type.contentMatch,r;return(r=i.findWrapping(e.type))?(this.match=i,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&dh)){let i=this.content[this.content.length-1],r;if(i&&i.isText&&(r=/[ \t\r\n\u000c]+$/.exec(i.text))){let a=i;i.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-r[0].length))}}let n=ue.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ue.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!I8.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class _M{constructor(e,n,i){this.parser=e,this.options=n,this.isOpen=i,this.open=0,this.localPreserveWS=!1;let r=n.topNode,a,s=gM(null,n.preserveWhitespace,0)|(i?wm:0);r?a=new Wg(r.type,r.attrs,On.none,!0,n.topMatch||r.type.contentMatch,s):i?a=new Wg(null,null,On.none,!0,null,s):a=new Wg(e.schema.topNodeType,null,On.none,!0,null,s),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let i=e.nodeValue,r=this.top,a=r.options&Ik?"full":this.localPreserveWS||(r.options&dh)>0,{schema:s}=this.parser;if(a==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(i)){if(a)if(a==="full")i=i.replace(/\r\n?/g,`
|
|
149
149
|
`);else if(s.linebreakReplacement&&/[\r\n]/.test(i)&&this.top.findWrapping(s.linebreakReplacement.create())){let o=i.split(/\r?\n|\r/);for(let l=0;l<o.length;l++)l&&this.insertNode(s.linebreakReplacement.create(),n,!0),o[l]&&this.insertNode(s.text(o[l]),n,!/\S/.test(o[l]));i=""}else i=i.replace(/\r?\n|\r/g," ");else if(i=i.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(i)&&this.open==this.nodes.length-1){let o=r.content[r.content.length-1],l=e.previousSibling;(!o||l&&l.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(i=i.slice(1))}i&&this.insertNode(s.text(i),n,!/\S/.test(i)),this.findInText(e)}else this.findInside(e)}addElement(e,n,i){let r=this.localPreserveWS,a=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),o;O8.hasOwnProperty(s)&&this.parser.normalizeLists&&Fpe(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,i));e:if(l?l.ignore:Lpe.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(I8.hasOwnProperty(s))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),c=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(a),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
150
150
|
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let i=e.style;if(i&&i.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let a=this.parser.matchedStyles[r],s=i.getPropertyValue(a);if(s)for(let o=void 0;;){let l=this.parser.matchStyle(a,s,this,o);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)o=l;else break}}return n}addElementByRule(e,n,i,r){let a,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),i,e.nodeName=="BR")||this.leafFallback(e,i);else{let l=this.enter(s,n.attrs||null,i,n.preserveWhitespace);l&&(a=!0,i=l)}else{let l=this.parser.schema.marks[n.mark];i=i.concat(l.create(n.attrs))}let o=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,i,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,i,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,i),this.findAround(e,l,!1)}a&&this.sync(o)&&this.open--}addAll(e,n,i,r){let a=i||0;for(let s=i?e.childNodes[i]:e.firstChild,o=r==null?null:e.childNodes[r];s!=o;s=s.nextSibling,++a)this.findAtPoint(e,a),this.addDOM(s,n);this.findAtPoint(e,a)}findPlace(e,n,i){let r,a;for(let s=this.open,o=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!r||r.length>c.length+o)&&(r=c,a=l,!c.length))break;if(l.solid){if(i)break;o+=2}}if(!r)return null;this.sync(a);for(let s=0;s<r.length;s++)n=this.enterInner(r[s],null,n,!1);return n}insertNode(e,n,i){if(e.isInline&&this.needsBlock&&!this.top.type){let a=this.textblockFromContext();a&&(n=this.enterInner(a,null,n))}let r=this.findPlace(e,n,i);if(r){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(e.type));let s=On.none;for(let o of r.concat(e.marks))(a.type?a.type.allowsMarkType(o.type):yM(o.type,e.type))&&(s=o.addToSet(s));return a.content.push(e.mark(s)),!0}return!1}enter(e,n,i,r){let a=this.findPlace(e.create(n),i,!1);return a&&(a=this.enterInner(e,n,i,!0,r)),a}enterInner(e,n,i,r=!1,a){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let o=gM(e,a,s.options);s.options&wm&&s.content.length==0&&(o|=wm);let l=On.none;return i=i.filter(c=>(s.type?s.type.allowsMarkType(c.type):yM(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Wg(e,n,l,r,null,o)),this.open++,i}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=dh)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let i=this.nodes[n].content;for(let r=i.length-1;r>=0;r--)e+=i[r].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].node==e&&this.find[i].offset==n&&(this.find[i].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,i){if(e!=n&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&n.compareDocumentPosition(this.find[r].node)&(i?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),i=this.options.context,r=!this.isOpen&&(!i||i.parent.type==this.nodes[0].type),a=-(i?i.depth+1:0)+(r?0:1),s=(o,l)=>{for(;o>=0;o--){let c=n[o];if(c==""){if(o==n.length-1||o==0)continue;for(;l>=a;l--)if(s(o-1,l))return!0;return!1}else{let u=l>0||l==0&&r?this.nodes[l].type:i&&l>=a?i.node(l-a).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(i&&i.isTextblock&&i.defaultAttrs)return i}for(let n in this.parser.schema.nodes){let i=this.parser.schema.nodes[n];if(i.isTextblock&&i.defaultAttrs)return i}}}function Fpe(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&O8.hasOwnProperty(i)&&n?(n.appendChild(e),e=n):i=="li"?n=e:i&&(n=null)}}function Bpe(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function bM(t){let e={};for(let n in t)e[n]=t[n];return e}function yM(t,e){let n=e.schema.nodes;for(let i in n){let r=n[i];if(!r.allowsMarkType(t))continue;let a=[],s=o=>{a.push(o);for(let l=0;l<o.edgeCount;l++){let{type:c,next:u}=o.edge(l);if(c==e||a.indexOf(u)<0&&s(u))return!0}};if(s(r.contentMatch))return!0}}class Ou{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},i){i||(i=NS(n).createDocumentFragment());let r=i,a=[];return e.forEach(s=>{if(a.length||s.marks.length){let o=0,l=0;for(;o<a.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(a[o][0])||c.type.spec.spanning===!1)break;o++,l++}for(;o<a.length;)r=a.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],u=this.serializeMark(c,s.isInline,n);u&&(a.push([c,r]),r.appendChild(u.dom),r=u.contentDOM||u.dom)}}r.appendChild(this.serializeNodeInner(s,n))}),i}serializeNodeInner(e,n){let{dom:i,contentDOM:r}=q_(NS(n),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,r)}return i}serializeNode(e,n={}){let i=this.serializeNodeInner(e,n);for(let r=e.marks.length-1;r>=0;r--){let a=this.serializeMark(e.marks[r],e.isInline,n);a&&((a.contentDOM||a.dom).appendChild(i),i=a.dom)}return i}serializeMark(e,n,i={}){let r=this.marks[e.type.name];return r&&q_(NS(i),r(e,n),null,e.attrs)}static renderSpec(e,n,i=null,r){return q_(e,n,i,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ou(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=vM(e.nodes);return n.text||(n.text=i=>i.text),n}static marksFromSchema(e){return vM(e.marks)}}function vM(t){let e={};for(let n in t){let i=t[n].spec.toDOM;i&&(e[n]=i)}return e}function NS(t){return t.document||window.document}const EM=new WeakMap;function $pe(t){let e=EM.get(t);return e===void 0&&EM.set(t,e=Upe(t)),e}function Upe(t){let e=null;function n(i){if(i&&typeof i=="object")if(Array.isArray(i))if(typeof i[0]=="string")e||(e=[]),e.push(i);else for(let r=0;r<i.length;r++)n(i[r]);else for(let r in i)n(i[r])}return n(t),e}function q_(t,e,n,i){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],a;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(i&&(a=$pe(i))&&a.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=r.indexOf(" ");s>0&&(n=r.slice(0,s),r=r.slice(s+1));let o,l=n?t.createElementNS(n,r):t.createElement(r),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let p=d.indexOf(" ");p>0?l.setAttributeNS(d.slice(0,p),d.slice(p+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let p=e[d];if(p===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:m}=q_(t,p,n,i);if(l.appendChild(f),m){if(o)throw new RangeError("Multiple content holes");o=m}}}return{dom:l,contentDOM:o}}const M8=65535,P8=Math.pow(2,16);function zpe(t,e){return t+e*P8}function SM(t){return t&M8}function Gpe(t){return(t-(t&M8))/P8}const L8=1,F8=2,V_=4,B8=8;class Ok{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&B8)>0}get deletedBefore(){return(this.delInfo&(L8|V_))>0}get deletedAfter(){return(this.delInfo&(F8|V_))>0}get deletedAcross(){return(this.delInfo&V_)>0}}class Xr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Xr.empty)return Xr.empty}recover(e){let n=0,i=SM(e);if(!this.inverted)for(let r=0;r<i;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[i*3]+n+Gpe(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,i){let r=0,a=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[o+a],u=this.ranges[o+s],d=l+c;if(e<=d){let p=c?e==l?-1:e==d?1:n:n,f=l+r+(p<0?0:u);if(i)return f;let m=e==(n<0?l:d)?null:zpe(o/3,e-l),g=e==l?F8:e==d?L8:V_;return(n<0?e!=l:e!=d)&&(g|=B8),new Ok(f,g,m)}r+=u-c}return i?e+r:new Ok(e+r,0,null)}touches(e,n){let i=0,r=SM(n),a=this.inverted?2:1,s=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let l=this.ranges[o]-(this.inverted?i:0);if(l>e)break;let c=this.ranges[o+a],u=l+c;if(e<=u&&o==r*3)return!0;i+=this.ranges[o+s]-c}return!1}forEach(e){let n=this.inverted?2:1,i=this.inverted?1:2;for(let r=0,a=0;r<this.ranges.length;r+=3){let s=this.ranges[r],o=s-(this.inverted?a:0),l=s+(this.inverted?0:a),c=this.ranges[r+n],u=this.ranges[r+i];e(o,o+c,l,l+u),a+=u-c}}invert(){return new Xr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Xr.empty:new Xr(e<0?[0,-e,0]:[0,0,e])}}Xr.empty=new Xr([]);class ph{constructor(e,n,i=0,r=e?e.length:0){this.mirror=n,this.from=i,this.to=r,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new ph(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,i=this._maps.length;n<e._maps.length;n++){let r=e.getMirror(n);this.appendMap(e._maps[n],r!=null&&r<n?i+r:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,i=this._maps.length+e._maps.length;n>=0;n--){let r=e.getMirror(n);this.appendMap(e._maps[n].invert(),r!=null&&r>n?i-r-1:void 0)}}invert(){let e=new ph;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let i=this.from;i<this.to;i++)e=this._maps[i].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,i){let r=0;for(let a=this.from;a<this.to;a++){let s=this._maps[a],o=s.mapResult(e,n);if(o.recover!=null){let l=this.getMirror(a);if(l!=null&&l>a&&l<this.to){a=l,e=this._maps[l].recover(o.recover);continue}}r|=o.delInfo,e=o.pos}return i?e:new Ok(e,r,null)}}const RS=Object.create(null);class or{getMap(){return Xr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=RS[n.stepType];if(!i)throw new RangeError(`No step type ${n.stepType} defined`);return i.fromJSON(e,n)}static jsonID(e,n){if(e in RS)throw new RangeError("Duplicate use of step JSON ID "+e);return RS[e]=n,n.prototype.jsonID=e,n}}class Si{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Si(e,null)}static fail(e){return new Si(null,e)}static fromReplace(e,n,i,r){try{return Si.ok(e.replace(n,i,r))}catch(a){if(a instanceof Kb)return Si.fail(a.message);throw a}}}function vA(t,e,n){let i=[];for(let r=0;r<t.childCount;r++){let a=t.child(r);a.content.size&&(a=a.copy(vA(a.content,e,a))),a.isInline&&(a=e(a,n,r)),i.push(a)}return ue.fromArray(i)}class Pl extends or{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=e.resolve(this.from),r=i.node(i.sharedDepth(this.to)),a=new Fe(vA(n.content,(s,o)=>!s.isAtom||!o.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),n.openStart,n.openEnd);return Si.fromReplace(e,this.from,this.to,a)}invert(){return new Za(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new Pl(n.pos,i.pos,this.mark)}merge(e){return e instanceof Pl&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Pl(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Pl(n.from,n.to,e.markFromJSON(n.mark))}}or.jsonID("addMark",Pl);class Za extends or{constructor(e,n,i){super(),this.from=e,this.to=n,this.mark=i}apply(e){let n=e.slice(this.from,this.to),i=new Fe(vA(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return Si.fromReplace(e,this.from,this.to,i)}invert(){return new Pl(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deleted&&i.deleted||n.pos>=i.pos?null:new Za(n.pos,i.pos,this.mark)}merge(e){return e instanceof Za&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Za(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Za(n.from,n.to,e.markFromJSON(n.mark))}}or.jsonID("removeMark",Za);class Ll extends or{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Si.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Si.fromReplace(e,this.pos,this.pos+1,new Fe(ue.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let i=this.mark.addToSet(n.marks);if(i.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(i))return new Ll(this.pos,n.marks[r]);return new Ll(this.pos,this.mark)}}return new bu(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ll(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ll(n.pos,e.markFromJSON(n.mark))}}or.jsonID("addNodeMark",Ll);class bu extends or{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Si.fail("No node at mark step's position");let i=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Si.fromReplace(e,this.pos,this.pos+1,new Fe(ue.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Ll(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new bu(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new bu(n.pos,e.markFromJSON(n.mark))}}or.jsonID("removeNodeMark",bu);class Ri extends or{constructor(e,n,i,r=!1){super(),this.from=e,this.to=n,this.slice=i,this.structure=r}apply(e){return this.structure&&Mk(e,this.from,this.to)?Si.fail("Structure replace would overwrite content"):Si.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Xr([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ri(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return n.deletedAcross&&i.deletedAcross?null:new Ri(n.pos,Math.max(n.pos,i.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ri)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?Fe.empty:new Fe(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ri(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?Fe.empty:new Fe(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ri(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ri(n.from,n.to,Fe.fromJSON(e,n.slice),!!n.structure)}}or.jsonID("replace",Ri);class Pi extends or{constructor(e,n,i,r,a,s,o=!1){super(),this.from=e,this.to=n,this.gapFrom=i,this.gapTo=r,this.slice=a,this.insert=s,this.structure=o}apply(e){if(this.structure&&(Mk(e,this.from,this.gapFrom)||Mk(e,this.gapTo,this.to)))return Si.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Si.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,n.content);return i?Si.fromReplace(e,this.from,this.to,i):Si.fail("Content does not fit in gap")}getMap(){return new Xr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Pi(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),a=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return n.deletedAcross&&i.deletedAcross||r<n.pos||a>i.pos?null:new Pi(n.pos,i.pos,r,a,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Pi(n.from,n.to,n.gapFrom,n.gapTo,Fe.fromJSON(e,n.slice),n.insert,!!n.structure)}}or.jsonID("replaceAround",Pi);function Mk(t,e,n){let i=t.resolve(e),r=n-e,a=i.depth;for(;r>0&&a>0&&i.indexAfter(a)==i.node(a).childCount;)a--,r--;if(r>0){let s=i.node(a).maybeChild(i.indexAfter(a));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function Hpe(t,e,n,i){let r=[],a=[],s,o;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!i.isInSet(d)&&u.type.allowsMarkType(i.type)){let p=Math.max(c,e),f=Math.min(c+l.nodeSize,n),m=i.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(m)||(s&&s.to==p&&s.mark.eq(d[g])?s.to=f:r.push(s=new Za(p,f,d[g])));o&&o.to==p?o.to=f:a.push(o=new Pl(p,f,i))}}),r.forEach(l=>t.step(l)),a.forEach(l=>t.step(l))}function jpe(t,e,n,i){let r=[],a=0;t.doc.nodesBetween(e,n,(s,o)=>{if(!s.isInline)return;a++;let l=null;if(i instanceof Uv){let c=s.marks,u;for(;u=i.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else i?i.isInSet(s.marks)&&(l=[i]):l=s.marks;if(l&&l.length){let c=Math.min(o+s.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],p;for(let f=0;f<r.length;f++){let m=r[f];m.step==a-1&&d.eq(r[f].style)&&(p=m)}p?(p.to=c,p.step=a):r.push({style:d,from:Math.max(o,e),to:c,step:a})}}}),r.forEach(s=>t.step(new Za(s.from,s.to,s.style)))}function EA(t,e,n,i=n.contentMatch,r=!0){let a=t.doc.nodeAt(e),s=[],o=e+1;for(let l=0;l<a.childCount;l++){let c=a.child(l),u=o+c.nodeSize,d=i.matchType(c.type);if(!d)s.push(new Ri(o,u,Fe.empty));else{i=d;for(let p=0;p<c.marks.length;p++)n.allowsMarkType(c.marks[p].type)||t.step(new Za(o,u,c.marks[p]));if(r&&c.isText&&n.whitespace!="pre"){let p,f=/\r?\n|\r/g,m;for(;p=f.exec(c.text);)m||(m=new Fe(ue.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new Ri(o+p.index,o+p.index+p[0].length,m))}}o=u}if(!i.validEnd){let l=i.fillBefore(ue.empty,!0);t.replace(o,o,new Fe(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function qpe(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Kp(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let i=t.depth,r=0,a=0;;--i){let s=t.$from.node(i),o=t.$from.index(i)+r,l=t.$to.indexAfter(i)-a;if(i<t.depth&&s.canReplace(o,l,n))return i;if(i==0||s.type.spec.isolating||!qpe(s,o,l))break;o&&(r=1),l<s.childCount&&(a=1)}return null}function Vpe(t,e,n){let{$from:i,$to:r,depth:a}=e,s=i.before(a+1),o=r.after(a+1),l=s,c=o,u=ue.empty,d=0;for(let m=a,g=!1;m>n;m--)g||i.index(m)>0?(g=!0,u=ue.from(i.node(m).copy(u)),d++):l--;let p=ue.empty,f=0;for(let m=a,g=!1;m>n;m--)g||r.after(m+1)<r.end(m)?(g=!0,p=ue.from(r.node(m).copy(p)),f++):c++;t.step(new Pi(l,c,s,o,new Fe(u.append(p),d,f),u.size-d,!0))}function SA(t,e,n=null,i=t){let r=Wpe(t,e),a=r&&Ype(i,e);return a?r.map(CM).concat({type:e,attrs:n}).concat(a.map(CM)):null}function CM(t){return{type:t,attrs:null}}function Wpe(t,e){let{parent:n,startIndex:i,endIndex:r}=t,a=n.contentMatchAt(i).findWrapping(e);if(!a)return null;let s=a.length?a[0]:e;return n.canReplaceWith(i,r,s)?a:null}function Ype(t,e){let{parent:n,startIndex:i,endIndex:r}=t,a=n.child(i),s=e.contentMatch.findWrapping(a.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let c=i;l&&c<r;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:s}function Kpe(t,e,n){let i=ue.empty;for(let s=n.length-1;s>=0;s--){if(i.size){let o=n[s].type.contentMatch.matchFragment(i);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=ue.from(n[s].type.create(n[s].attrs,i))}let r=e.start,a=e.end;t.step(new Pi(r,a,r,a,new Fe(i,0,0),n.length,!0))}function Qpe(t,e,n,i,r){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(e,n,(s,o)=>{let l=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(i,l)&&Xpe(t.doc,t.mapping.slice(a).map(o),i)){let c=null;if(i.schema.linebreakReplacement){let f=i.whitespace=="pre",m=!!i.contentMatch.matchType(i.schema.linebreakReplacement);f&&!m?c=!1:!f&&m&&(c=!0)}c===!1&&U8(t,s,o,a),EA(t,t.mapping.slice(a).map(o,1),i,void 0,c===null);let u=t.mapping.slice(a),d=u.map(o,1),p=u.map(o+s.nodeSize,1);return t.step(new Pi(d,p,d+1,p-1,new Fe(ue.from(i.create(l,null,s.marks)),0,0),1,!0)),c===!0&&$8(t,s,o,a),!1}})}function $8(t,e,n,i){e.forEach((r,a)=>{if(r.isText){let s,o=/\r?\n|\r/g;for(;s=o.exec(r.text);){let l=t.mapping.slice(i).map(n+1+a+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function U8(t,e,n,i){e.forEach((r,a)=>{if(r.type==r.type.schema.linebreakReplacement){let s=t.mapping.slice(i).map(n+1+a);t.replaceWith(s,s+1,e.type.schema.text(`
|