email-builder-online 3.6.1 → 3.6.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 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=wO(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=wO(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 mA{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 Fs{constructor(e){ie(this,"options");ie(this,"renderer");ie(this,"textRenderer");this.options=e||Ru,this.options.renderer=this.options.renderer||new Ub,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new mA}static parse(e,n){return new Fs(n).parse(e)}static parseInline(e,n){return new Fs(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,Mle(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,h=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,h,!!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 Rm{constructor(e){ie(this,"options");this.options=e||Ru}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}ie(Rm,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));var Au,Ck,vU;class uce{constructor(...e){Cc(this,Au);ie(this,"defaults",lA());ie(this,"options",this.setOptions);ie(this,"parse",Wa(this,Au,Ck).call(this,Ls.lex,Fs.parse));ie(this,"parseInline",Wa(this,Au,Ck).call(this,Ls.lexInline,Fs.parseInline));ie(this,"Parser",Fs);ie(this,"Renderer",Ub);ie(this,"TextRenderer",mA);ie(this,"Lexer",Ls);ie(this,"Tokenizer",Bb);ie(this,"Hooks",Rm);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 Ub(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 Bb(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 Rm;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];Rm.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 Ls.lex(e,n??this.defaults)}parser(e,n){return Fs.parse(e,n??this.defaults)}}Au=new WeakSet,Ck=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=Wa(this,Au,vU).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)}}},vU=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>"+Wr(i.message+"",!0)+"</pre>";return n?Promise.resolve(r):r}if(n)return Promise.reject(i);throw i}};const du=new uce;function kn(t,e){return du.parse(t,e)}kn.options=kn.setOptions=function(t){return du.setOptions(t),kn.defaults=du.defaults,uU(kn.defaults),kn};kn.getDefaults=lA;kn.defaults=Ru;kn.use=function(...t){return du.use(...t),kn.defaults=du.defaults,uU(kn.defaults),kn};kn.walkTokens=function(t,e){return du.walkTokens(t,e)};kn.parseInline=du.parseInline;kn.Parser=Fs;kn.parser=Fs.parse;kn.Renderer=Ub;kn.TextRenderer=mA;kn.Lexer=Ls;kn.lexer=Ls.lex;kn.Tokenizer=Bb;kn.Hooks=Rm;kn.parse=kn;kn.options;kn.setOptions;kn.use;kn.walkTokens;kn.parseInline;Fs.parse;Ls.lex;function dce(t){return String(t??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function pce(t){const e=String(t?.text??"");if(t?.markdown===!0){const n=kn.parse(e,{async:!1});return typeof n=="string"?n:String(n)}return`<p>${dce(e)}</p>`}function fce(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 Ud(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=pce(s);e[n]={...i,type:"NotionText",data:{...a,props:{html:o}}}}else r==="Avatar"&&(e[n]=fce(i))}return e}const ig=lU(()=>({past:[],future:[]}));function mce(){return ig(t=>t.past.length>0)}function hce(){return ig(t=>t.future.length>0)}function zb(){return ig.getState()}function Hb(t){ig.setState(t)}function gce(){ig.setState({past:[],future:[]})}const Gb=385,qv="https://ddc4vowthkjlv.cloudfront.net/uploads/gallery/1/69cc1b1083b90.jpg";let N1=null;const _ce=2e3;function Xp(){N1&&clearTimeout(N1),N1=setTimeout(()=>{const t=new CustomEvent("email-builder-auto-save",{detail:!0});window.dispatchEvent(t)},_ce)}const bce=()=>({document:Ud(JSON.parse(JSON.stringify(Dle))),selectedBlockId:null,selectedSidebarTab:"styles",selectedMainTab:"editor",selectedScreenSize:"desktop",windowWidth:0,inspectorDrawerOpen:!0,componentTreeOpen:!1,samplesDrawerOpen:!0,inspectorDrawerWidth:Gb,devMode:!1,imageUploading:{uploading:!1,id:""},disableEdition:!1,disableUpdate:!1,freeMode:!1,minHeight:"calc(100dvh - 65px)",color:{primary:"",secondary:""},galleryImages:!0,imagePlaceholder:qv,darkMode:!0,colorPicker:{paletteColors:wle,isLocked:!1},tour:!1,stickyHeader:!0,heightContent:"calc(100dvh - 50px)",containerGrow:!0,notionTextInlineEditingBlockId:null,canvasHoveredBlockId:null,highlightColor:"#FF6B35",showVersion:!1}),ae=lU(()=>bce());A.createContext(ae);function EU(){const t=ae(e=>e.document[ae(n=>n.selectedBlockId)||""]);return t?t.type:null}function RO(t){return ae.setState({windowWidth:t})}function yce(){return ae(t=>t.devMode)}function vce(t){return ae.setState({devMode:t})}function hA(){return ae(t=>t.document)}function SU(t){return ae(e=>e.document[t])}function Ece(t){return ae(e=>e.document[t]?.type)}function Sce(t){return ae(e=>e.selectedBlockId===t)}function rg(){return ae(t=>t.selectedBlockId)}function Cce(){return ae(t=>t.canvasHoveredBlockId)}function tb(t){ae.setState({canvasHoveredBlockId:t})}function ag(){return ae(t=>t.notionTextInlineEditingBlockId)}function Im(t){const e=ae.getState().notionTextInlineEditingBlockId;return e&&e!==t&&window.dispatchEvent(new CustomEvent("notion-text-force-save",{detail:{blockId:e}})),ae.setState({notionTextInlineEditingBlockId:t})}function CU(){return!!ag()}function Tce(){return ag()}function xce(){return ae(t=>t.highlightColor)}function _i(){return ae(t=>t.selectedScreenSize)}function gA(){return ae(t=>t.selectedMainTab)}function Xg(t){return t==="preview"&&ia(null),ae.setState({inspectorDrawerOpen:t==="editor"}),ae.setState({selectedMainTab:t})}function Xo(){return ae(t=>t.selectedSidebarTab)}function kce(){return ae(t=>t.inspectorDrawerOpen)}function _A(){return ae(t=>t.componentTreeOpen)}function Tk(){ae.setState(t=>({componentTreeOpen:!t.componentTreeOpen}))}function bA(){return ae(t=>t.imageUploading)}function Vv(){return ae(t=>t.disableEdition)}let jb=null,IO=0;const wce=400;let pu=!1,xk=!1;function Iu(t,e){if(pu||xk)return;const n=Date.now(),i=n-IO;if(e&&e===jb&&i<wce){zb().future.length>0&&Hb({future:[]});return}const a=JSON.stringify(t),{past:s}=zb();if(s.length>0&&s[s.length-1]===a)return;const o=[...s,a].slice(-50);Hb({past:o,future:[]}),jb=e??null,IO=n}function ia(t){const e=ae.getState().notionTextInlineEditingBlockId;e&&t!==null&&e!==t&&Im(null);const n=ae.getState().document[t||""]?.type,i=Fb.includes(n||null)?"styles":"block-configuration",r={};return t!==null&&ae.getState().selectedMainTab==="editor"&&(r.inspectorDrawerOpen=!0),ae.setState({selectedBlockId:t,selectedSidebarTab:i,...r})}function Dce(t){return ae.setState({selectedSidebarTab:t})}function Jg(t){const e=Ud(t);return gce(),ae.setState({document:e,selectedSidebarTab:"styles",selectedBlockId:null})}function TU(t){const e=ae.getState().document;xk=!0;let n;try{n=t()}finally{xk=!1}return Iu(e,null),n}function OO(){const{past:t,future:e}=zb();if(t.length!==0){pu=!0;try{const n=ae.getState().document,i=JSON.stringify(n),r=[...t],a=r.pop(),s=JSON.parse(a);Hb({past:r,future:[...e,i]});const o=ae.getState().selectedBlockId,l=o&&!s[o];ae.setState({document:s,...l?{selectedBlockId:null}:{}})}finally{pu=!1,jb=null}}}function MO(){const{past:t,future:e}=zb();if(e.length!==0){pu=!0;try{const n=ae.getState().document,i=JSON.stringify(n),r=[...e],a=r.pop(),s=JSON.parse(a);Hb({past:[...t,i],future:r});const o=ae.getState().selectedBlockId,l=o&&!s[o];ae.setState({document:s,...l?{selectedBlockId:null}:{}})}finally{pu=!1,jb=null}}}function fu(t,e=!0){const n=ae.getState().document,i={...n,...t};e&&Iu(n);const r=()=>{ae.setState({document:i}),Xp()};return e?(A.startTransition(r),ae.getState()):r()}function qb(t){return ae.setState({selectedScreenSize:t})}function zd(t,e){return ae.setState({imageUploading:{uploading:t,id:e||""}})}function xU(t){return ae.setState({disableEdition:t})}function Ace(){return ae.getState().document.root.data}function Wv(){return ae(t=>t.document?.root?.data)}function Nce(t){return ae.setState({color:t})}function Rce(t){return ae.setState({galleryImages:t})}function Vb(){return ae.getState().galleryImages}function Ice(t){return ae.setState({imagePlaceholder:t})}function Oce(){return ae.getState().imagePlaceholder}function Mce(t){return ae.setState({freeMode:t})}function yA(){return ae.getState().freeMode}function Pce(t){return ae.setState({darkMode:t})}function Lce(t){return ae.setState({stickyHeader:t})}function Fce(t){return ae.setState({heightContent:t})}function Bce(t){return ae.setState({containerGrow:t})}function $ce(){return ae.getState().containerGrow}function Uce(t){return ae.setState({showVersion:t})}function zce(){return ae(t=>t.showVersion)}function hh(t,e,n,i=!0){Ou({draggedId:e,targetId:t})&&console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");const r=ae.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 h=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:h}}})}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=cU(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 h=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:h}}}}break}}return fu(a)}function Hce({parentId:t,blockId:e,indexArray:n}){if(Ou({draggedId:e,targetId:t})){console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");return}return TU(()=>{hh("",e,"down",!1);const i=ae.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}}},fu(r)})}function Gce({parentId:t,blockId:e}){if(Ou({draggedId:e,targetId:t})){console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");return}return TU(()=>{hh("",e,"down",!1);const n=ae.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]}}},fu(i)})}function Ou({draggedId:t,targetId:e}){if(t===e)return!0;const n=cU(e),i=n?n.parentBlockId:e;if(t===i)return!0;const r=ae.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 jce(){return ae(t=>t.colorPicker)}function R1(t){ae.setState(e=>({colorPicker:{...e.colorPicker,...t}}))}function kU(t,e){if(pu)return;const n=ae.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};Iu(n,t),A.startTransition(()=>{ae.setState({document:a})}),Xp()}function qce(t,e){if(pu)return;const n=ae.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};Iu(n,t),ae.setState({document:a}),Xp()}function Vce(t,e){kU(t,n=>{const i=typeof e=="function"?e(n.data.props):{...n.data.props,...e};return{...n,data:{...n.data,props:i}}})}function Zg(t,e){qce(t,n=>{const i=typeof e=="function"?e(n.data.props):{...n.data.props,...e};return{...n,data:{...n.data,props:i}}})}function gh(t,e,n,i){const r=ae.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};Iu(r),A.startTransition(()=>{ae.setState({document:o})}),Xp()}function Wce(t,e,n,i,r){const a=ae.getState().document,s=a[t];if(!s?.data?.props?.columns)return;const o=[...s.data.props.columns||[]],l=o[e];if(!l)return;o[e]={...l,childrenIds:r};const c={...s,data:{...s.data,props:{...s.data.props,columns:o}}},u={...a,[n]:i,[t]:c};Iu(a),A.startTransition(()=>{ae.setState({document:u})}),Xp()}function vA(){return`block-${Date.now()}-${Math.random().toString(36).substring(2,5)}`}function EA(t,e){const n=[];for(const i of e){const r={...t[i]},a=vA();if(t[a]={...r,data:{...r.data,props:{...r.data.props}}},r.type==="Container"||r.type==="ColumnsContainer"){const s=r.data.props?.childrenIds||[];if(t[a].data.props.childrenIds=EA(t,s),r.type==="ColumnsContainer"){const o=r.data.props?.columns||[];t[a].data.props.columns=wU(t,o)}}n.push(a)}return n}function wU(t,e){return e.map(n=>{const i={...n},r=n.childrenIds||[];return i.childrenIds=EA(t,r),i})}function Yce(t){const e=ae.getState().document,n=JSON.parse(JSON.stringify({...e})),i=vA(),r=n[t];if(n[i]=JSON.parse(JSON.stringify(r)),r.type==="Container"){const l=r.data.props?.childrenIds||[];l.length>0&&(n[i].data.props.childrenIds=EA(n,l))}else if(r.type==="ColumnsContainer"){const l=r.data.props?.columns||[];n[i].data.props.columns=wU(n,l)}const a=n.root,s=a?.type==="EmailLayout"?a.data.childrenIds??[]:[],o=s.findIndex(l=>l===t);if(a?.type==="EmailLayout"&&o>=0){const l=[...s];l.splice(o,0,i),a.data.childrenIds=l}else for(const[,l]of Object.entries(n)){if(l.type==="Container"){const c=l.data.props?.childrenIds,u=c?.findIndex(d=>d===t)??-1;if(u>=0&&c){const d=[...c];d.splice(u,0,i),l.data.props.childrenIds=d;break}}l.type==="ColumnsContainer"&&l.data.props?.columns?.forEach(c=>{const u=c.childrenIds.findIndex(d=>d===t);u>=0&&c.childrenIds.splice(u,0,i)})}fu(n),ia(i)}function Kce(t,e){const n=vA(),i=ae.getState().document,r=i.root,a=r?.type==="EmailLayout"?r.data.childrenIds??[]:[],s=a.indexOf(t);if(r?.type==="EmailLayout"&&s>=0){const o=[...a];return o.splice(s+1,0,n),gh("root",n,e,o),n}for(const[o,l]of Object.entries(i)){const c=l;if(c.type==="Container"){const u=c.data.props?.childrenIds??[],d=u.indexOf(t);if(d>=0){const p=[...u];return p.splice(d+1,0,n),gh(o,n,e,p),n}}if(c.type==="ColumnsContainer"){const u=c.data.props?.columns??[];for(let d=0;d<u.length;d++){const f=u[d].childrenIds??[],h=f.indexOf(t);if(h>=0){const g=[...f];return g.splice(h+1,0,n),Wce(o,d,n,e,g),n}}}}return null}function Qce(t){const e=ae.getState().document,n={...e,...t};Iu(e),A.startTransition(()=>{ae.setState({document:n})}),Xp()}function Wb(t,e){kU(t,e)}var en;(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})(en||(en={}));var PO;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(PO||(PO={}));const qe=en.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xl=t=>{switch(typeof t){case"undefined":return qe.undefined;case"string":return qe.string;case"number":return Number.isNaN(t)?qe.nan:qe.number;case"boolean":return qe.boolean;case"function":return qe.function;case"bigint":return qe.bigint;case"symbol":return qe.symbol;case"object":return Array.isArray(t)?qe.array:t===null?qe.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?qe.promise:typeof Map<"u"&&t instanceof Map?qe.map:typeof Set<"u"&&t instanceof Set?qe.set:typeof Date<"u"&&t instanceof Date?qe.date:qe.object;default:return qe.unknown}},Ce=en.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,en.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 kk=(t,e)=>{let n;switch(t.code){case Ce.invalid_type:t.received===qe.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case Ce.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,en.jsonStringifyReplacer)}`;break;case Ce.unrecognized_keys:n=`Unrecognized key(s) in object: ${en.joinValues(t.keys,", ")}`;break;case Ce.invalid_union:n="Invalid input";break;case Ce.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${en.joinValues(t.options)}`;break;case Ce.invalid_enum_value:n=`Invalid enum value. Expected ${en.joinValues(t.options)}, received '${t.received}'`;break;case Ce.invalid_arguments:n="Invalid function arguments";break;case Ce.invalid_return_type:n="Invalid function return type";break;case Ce.invalid_date:n="Invalid date";break;case Ce.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:en.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case Ce.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case Ce.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case Ce.custom:n="Invalid input";break;case Ce.invalid_intersection_types:n="Intersection results could not be merged";break;case Ce.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case Ce.not_finite:n="Number must be finite";break;default:n=e.defaultError,en.assertNever(t)}return{message:n}};let Xce=kk;function Jce(){return Xce}const Zce=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 Ue(t,e){const n=Jce(),i=Zce({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===kk?void 0:kk].filter(r=>!!r)});t.common.issues.push(i)}class yr{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 yr.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"}),am=t=>({status:"dirty",value:t}),ja=t=>({status:"valid",value:t}),LO=t=>t.status==="aborted",FO=t=>t.status==="dirty",pp=t=>t.status==="valid",Yb=t=>typeof Promise<"u"&&t instanceof Promise;var Ye;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Ye||(Ye={}));class Xs{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 BO=(t,e)=>{if(pp(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 qt{get description(){return this._def.description}_getType(e){return xl(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:xl(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new yr,ctx:{common:e.parent.common,data:e.data,parsedType:xl(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Yb(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:xl(e)},r=this._parseSync({data:e,path:i.path,parent:i});return BO(i,r)}"~validate"(e){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xl(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return pp(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=>pp(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:xl(e)},r=this._parse({data:e,path:i.path,parent:i}),a=await(Yb(r)?r:Promise.resolve(r));return BO(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:Ce.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 gu({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 _u.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return js.create(this)}promise(){return ey.create(this,this._def)}or(e){return Qb.create([this,e],this._def)}and(e){return Xb.create(this,e,this._def)}transform(e){return new gu({...Pt(this._def),schema:this,typeName:wt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new ty({...Pt(this._def),innerType:this,defaultValue:n,typeName:wt.ZodDefault})}brand(){return new RU({typeName:wt.ZodBranded,type:this,...Pt(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new ny({...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 iy.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const eue=/^c[^\s-]{8,}$/i,tue=/^[0-9a-z]+$/,nue=/^[0-9A-HJKMNP-TV-Z]{26}$/i,iue=/^[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,rue=/^[a-z0-9_-]{21}$/i,aue=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sue=/^[-+]?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)?)??$/,oue=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,lue="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let I1;const cue=/^(?:(?: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])$/,uue=/^(?:(?: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])$/,due=/^(([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]))$/,pue=/^(([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])$/,fue=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mue=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,DU="((\\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])))",hue=new RegExp(`^${DU}$`);function AU(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 gue(t){return new RegExp(`^${AU(t)}$`)}function _ue(t){let e=`${DU}T${AU(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 bue(t,e){return!!((e==="v4"||!e)&&cue.test(t)||(e==="v6"||!e)&&due.test(t))}function yue(t,e){if(!aue.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 vue(t,e){return!!((e==="v4"||!e)&&uue.test(t)||(e==="v6"||!e)&&pue.test(t))}class No extends qt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==qe.string){const a=this._getOrReturnCtx(e);return Ue(a,{code:Ce.invalid_type,expected:qe.string,received:a.parsedType}),kt}const i=new yr;let r;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),Ue(r,{code:Ce.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),Ue(r,{code:Ce.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?Ue(r,{code:Ce.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&Ue(r,{code:Ce.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),i.dirty())}else if(a.kind==="email")oue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"email",code:Ce.invalid_string,message:a.message}),i.dirty());else if(a.kind==="emoji")I1||(I1=new RegExp(lue,"u")),I1.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"emoji",code:Ce.invalid_string,message:a.message}),i.dirty());else if(a.kind==="uuid")iue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"uuid",code:Ce.invalid_string,message:a.message}),i.dirty());else if(a.kind==="nanoid")rue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"nanoid",code:Ce.invalid_string,message:a.message}),i.dirty());else if(a.kind==="cuid")eue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"cuid",code:Ce.invalid_string,message:a.message}),i.dirty());else if(a.kind==="cuid2")tue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"cuid2",code:Ce.invalid_string,message:a.message}),i.dirty());else if(a.kind==="ulid")nue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"ulid",code:Ce.invalid_string,message:a.message}),i.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),Ue(r,{validation:"url",code:Ce.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),Ue(r,{validation:"regex",code:Ce.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),Ue(r,{code:Ce.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),Ue(r,{code:Ce.invalid_string,validation:{startsWith:a.value},message:a.message}),i.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),Ue(r,{code:Ce.invalid_string,validation:{endsWith:a.value},message:a.message}),i.dirty()):a.kind==="datetime"?_ue(a).test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{code:Ce.invalid_string,validation:"datetime",message:a.message}),i.dirty()):a.kind==="date"?hue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{code:Ce.invalid_string,validation:"date",message:a.message}),i.dirty()):a.kind==="time"?gue(a).test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{code:Ce.invalid_string,validation:"time",message:a.message}),i.dirty()):a.kind==="duration"?sue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"duration",code:Ce.invalid_string,message:a.message}),i.dirty()):a.kind==="ip"?bue(e.data,a.version)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"ip",code:Ce.invalid_string,message:a.message}),i.dirty()):a.kind==="jwt"?yue(e.data,a.alg)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"jwt",code:Ce.invalid_string,message:a.message}),i.dirty()):a.kind==="cidr"?vue(e.data,a.version)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"cidr",code:Ce.invalid_string,message:a.message}),i.dirty()):a.kind==="base64"?fue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"base64",code:Ce.invalid_string,message:a.message}),i.dirty()):a.kind==="base64url"?mue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"base64url",code:Ce.invalid_string,message:a.message}),i.dirty()):en.assertNever(a);return{status:i.value,value:e.data}}_regex(e,n,i){return this.refinement(r=>e.test(r),{validation:n,code:Ce.invalid_string,...Ye.errToObj(i)})}_addCheck(e){return new No({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ye.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ye.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ye.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ye.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ye.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ye.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ye.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ye.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ye.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ye.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ye.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ye.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ye.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,...Ye.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,...Ye.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Ye.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Ye.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...Ye.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Ye.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Ye.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Ye.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Ye.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Ye.errToObj(n)})}nonempty(e){return this.min(1,Ye.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 Eue(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 fp extends qt{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)!==qe.number){const a=this._getOrReturnCtx(e);return Ue(a,{code:Ce.invalid_type,expected:qe.number,received:a.parsedType}),kt}let i;const r=new yr;for(const a of this._def.checks)a.kind==="int"?en.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),Ue(i,{code:Ce.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),Ue(i,{code:Ce.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),Ue(i,{code:Ce.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="multipleOf"?Eue(e.data,a.value)!==0&&(i=this._getOrReturnCtx(e,i),Ue(i,{code:Ce.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),Ue(i,{code:Ce.not_finite,message:a.message}),r.dirty()):en.assertNever(a);return{status:r.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Ye.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ye.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ye.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ye.toString(n))}setLimit(e,n,i,r){return new fp({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:Ye.toString(r)}]})}_addCheck(e){return new fp({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ye.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ye.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ye.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ye.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ye.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ye.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Ye.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ye.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ye.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"&&en.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)}}fp.create=t=>new fp({checks:[],typeName:wt.ZodNumber,coerce:t?.coerce||!1,...Pt(t)});class _h extends qt{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)!==qe.bigint)return this._getInvalidInput(e);let i;const r=new yr;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),Ue(i,{code:Ce.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),Ue(i,{code:Ce.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),Ue(i,{code:Ce.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):en.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return Ue(n,{code:Ce.invalid_type,expected:qe.bigint,received:n.parsedType}),kt}gte(e,n){return this.setLimit("min",e,!0,Ye.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ye.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ye.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ye.toString(n))}setLimit(e,n,i,r){return new _h({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:Ye.toString(r)}]})}_addCheck(e){return new _h({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ye.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ye.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ye.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ye.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ye.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}}_h.create=t=>new _h({checks:[],typeName:wt.ZodBigInt,coerce:t?.coerce??!1,...Pt(t)});class wk extends qt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==qe.boolean){const i=this._getOrReturnCtx(e);return Ue(i,{code:Ce.invalid_type,expected:qe.boolean,received:i.parsedType}),kt}return ja(e.data)}}wk.create=t=>new wk({typeName:wt.ZodBoolean,coerce:t?.coerce||!1,...Pt(t)});class Kb extends qt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==qe.date){const a=this._getOrReturnCtx(e);return Ue(a,{code:Ce.invalid_type,expected:qe.date,received:a.parsedType}),kt}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return Ue(a,{code:Ce.invalid_date}),kt}const i=new yr;let r;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),Ue(r,{code:Ce.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),Ue(r,{code:Ce.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),i.dirty()):en.assertNever(a);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Kb({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Ye.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Ye.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}}Kb.create=t=>new Kb({checks:[],coerce:t?.coerce||!1,typeName:wt.ZodDate,...Pt(t)});class $O extends qt{_parse(e){if(this._getType(e)!==qe.symbol){const i=this._getOrReturnCtx(e);return Ue(i,{code:Ce.invalid_type,expected:qe.symbol,received:i.parsedType}),kt}return ja(e.data)}}$O.create=t=>new $O({typeName:wt.ZodSymbol,...Pt(t)});class Dk extends qt{_parse(e){if(this._getType(e)!==qe.undefined){const i=this._getOrReturnCtx(e);return Ue(i,{code:Ce.invalid_type,expected:qe.undefined,received:i.parsedType}),kt}return ja(e.data)}}Dk.create=t=>new Dk({typeName:wt.ZodUndefined,...Pt(t)});class Ak extends qt{_parse(e){if(this._getType(e)!==qe.null){const i=this._getOrReturnCtx(e);return Ue(i,{code:Ce.invalid_type,expected:qe.null,received:i.parsedType}),kt}return ja(e.data)}}Ak.create=t=>new Ak({typeName:wt.ZodNull,...Pt(t)});class UO extends qt{constructor(){super(...arguments),this._any=!0}_parse(e){return ja(e.data)}}UO.create=t=>new UO({typeName:wt.ZodAny,...Pt(t)});class zO extends qt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ja(e.data)}}zO.create=t=>new zO({typeName:wt.ZodUnknown,...Pt(t)});class Jl extends qt{_parse(e){const n=this._getOrReturnCtx(e);return Ue(n,{code:Ce.invalid_type,expected:qe.never,received:n.parsedType}),kt}}Jl.create=t=>new Jl({typeName:wt.ZodNever,...Pt(t)});class HO extends qt{_parse(e){if(this._getType(e)!==qe.undefined){const i=this._getOrReturnCtx(e);return Ue(i,{code:Ce.invalid_type,expected:qe.void,received:i.parsedType}),kt}return ja(e.data)}}HO.create=t=>new HO({typeName:wt.ZodVoid,...Pt(t)});class js extends qt{_parse(e){const{ctx:n,status:i}=this._processInputParams(e),r=this._def;if(n.parsedType!==qe.array)return Ue(n,{code:Ce.invalid_type,expected:qe.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)&&(Ue(n,{code:s?Ce.too_big:Ce.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&&(Ue(n,{code:Ce.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(Ue(n,{code:Ce.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((s,o)=>r.type._parseAsync(new Xs(n,s,n.path,o)))).then(s=>yr.mergeArray(i,s));const a=[...n.data].map((s,o)=>r.type._parseSync(new Xs(n,s,n.path,o)));return yr.mergeArray(i,a)}get element(){return this._def.type}min(e,n){return new js({...this._def,minLength:{value:e,message:Ye.toString(n)}})}max(e,n){return new js({...this._def,maxLength:{value:e,message:Ye.toString(n)}})}length(e,n){return new js({...this._def,exactLength:{value:e,message:Ye.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 Ed(t){if(t instanceof yi){const e={};for(const n in t.shape){const i=t.shape[n];e[n]=Mo.create(Ed(i))}return new yi({...t._def,shape:()=>e})}else return t instanceof js?new js({...t._def,type:Ed(t.element)}):t instanceof Mo?Mo.create(Ed(t.unwrap())):t instanceof _u?_u.create(Ed(t.unwrap())):t instanceof mu?mu.create(t.items.map(e=>Ed(e))):t}class yi extends qt{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=en.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==qe.object){const c=this._getOrReturnCtx(e);return Ue(c,{code:Ce.invalid_type,expected:qe.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 Jl&&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 Xs(r,d,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof Jl){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&&(Ue(r,{code:Ce.unrecognized_keys,keys:o}),i.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of o){const d=r.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Xs(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=>yr.mergeObjectSync(i,c)):yr.mergeObjectSync(i,l)}get shape(){return this._def.shape()}strict(e){return Ye.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:Ye.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 en.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 en.objectKeys(this.shape))e[i]||(n[i]=this.shape[i]);return new yi({...this._def,shape:()=>n})}deepPartial(){return Ed(this)}partial(e){const n={};for(const i of en.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 en.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 NU(en.objectKeys(this.shape))}}yi.create=(t,e)=>new yi({shape:()=>t,unknownKeys:"strip",catchall:Jl.create(),typeName:wt.ZodObject,...Pt(e)});yi.strictCreate=(t,e)=>new yi({shape:()=>t,unknownKeys:"strict",catchall:Jl.create(),typeName:wt.ZodObject,...Pt(e)});yi.lazycreate=(t,e)=>new yi({shape:t,unknownKeys:"strip",catchall:Jl.create(),typeName:wt.ZodObject,...Pt(e)});class Qb extends qt{_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 Ue(n,{code:Ce.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 Ue(n,{code:Ce.invalid_union,unionErrors:o}),kt}}get options(){return this._def.options}}Qb.create=(t,e)=>new Qb({options:t,typeName:wt.ZodUnion,...Pt(e)});const So=t=>t instanceof Rk?So(t.schema):t instanceof gu?So(t.innerType()):t instanceof Zb?[t.value]:t instanceof hu?t.options:t instanceof Ik?en.objectValues(t.enum):t instanceof ty?So(t._def.innerType):t instanceof Dk?[void 0]:t instanceof Ak?[null]:t instanceof Mo?[void 0,...So(t.unwrap())]:t instanceof _u?[null,...So(t.unwrap())]:t instanceof RU||t instanceof iy?So(t.unwrap()):t instanceof ny?So(t._def.innerType):[];class SA extends qt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==qe.object)return Ue(n,{code:Ce.invalid_type,expected:qe.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}):(Ue(n,{code:Ce.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 SA({typeName:wt.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:r,...Pt(i)})}}function Nk(t,e){const n=xl(t),i=xl(e);if(t===e)return{valid:!0,data:t};if(n===qe.object&&i===qe.object){const r=en.objectKeys(e),a=en.objectKeys(t).filter(o=>r.indexOf(o)!==-1),s={...t,...e};for(const o of a){const l=Nk(t[o],e[o]);if(!l.valid)return{valid:!1};s[o]=l.data}return{valid:!0,data:s}}else if(n===qe.array&&i===qe.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=Nk(s,o);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return n===qe.date&&i===qe.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Xb extends qt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e),r=(a,s)=>{if(LO(a)||LO(s))return kt;const o=Nk(a.value,s.value);return o.valid?((FO(a)||FO(s))&&n.dirty(),{status:n.value,value:o.data}):(Ue(i,{code:Ce.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}))}}Xb.create=(t,e,n)=>new Xb({left:t,right:e,typeName:wt.ZodIntersection,...Pt(n)});class mu extends qt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==qe.array)return Ue(i,{code:Ce.invalid_type,expected:qe.array,received:i.parsedType}),kt;if(i.data.length<this._def.items.length)return Ue(i,{code:Ce.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),kt;!this._def.rest&&i.data.length>this._def.items.length&&(Ue(i,{code:Ce.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 Xs(i,s,i.path,o)):null}).filter(s=>!!s);return i.common.async?Promise.all(a).then(s=>yr.mergeArray(n,s)):yr.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new mu({...this._def,rest:e})}}mu.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mu({items:t,typeName:wt.ZodTuple,rest:null,...Pt(e)})};class Jb extends qt{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!==qe.object)return Ue(i,{code:Ce.invalid_type,expected:qe.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 Xs(i,o,i.path,o)),value:s._parse(new Xs(i,i.data[o],i.path,o)),alwaysSet:o in i.data});return i.common.async?yr.mergeObjectAsync(n,r):yr.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(e,n,i){return n instanceof qt?new Jb({keyType:e,valueType:n,typeName:wt.ZodRecord,...Pt(i)}):new Jb({keyType:No.create(),valueType:e,typeName:wt.ZodRecord,...Pt(n)})}}class GO extends qt{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!==qe.map)return Ue(i,{code:Ce.invalid_type,expected:qe.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 Xs(i,o,i.path,[c,"key"])),value:a._parse(new Xs(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}}}}GO.create=(t,e,n)=>new GO({valueType:e,keyType:t,typeName:wt.ZodMap,...Pt(n)});class bh extends qt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==qe.set)return Ue(i,{code:Ce.invalid_type,expected:qe.set,received:i.parsedType}),kt;const r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(Ue(i,{code:Ce.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(Ue(i,{code:Ce.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 Xs(i,l,i.path,c)));return i.common.async?Promise.all(o).then(l=>s(l)):s(o)}min(e,n){return new bh({...this._def,minSize:{value:e,message:Ye.toString(n)}})}max(e,n){return new bh({...this._def,maxSize:{value:e,message:Ye.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}bh.create=(t,e)=>new bh({valueType:t,minSize:null,maxSize:null,typeName:wt.ZodSet,...Pt(e)});class Rk extends qt{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})}}Rk.create=(t,e)=>new Rk({getter:t,typeName:wt.ZodLazy,...Pt(e)});class Zb extends qt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return Ue(n,{received:n.data,code:Ce.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 NU(t,e){return new hu({values:t,typeName:wt.ZodEnum,...Pt(e)})}class hu extends qt{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),i=this._def.values;return Ue(n,{expected:en.joinValues(i),received:n.parsedType,code:Ce.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 Ue(n,{received:n.data,code:Ce.invalid_enum_value,options:i}),kt}return ja(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 hu.create(e,{...this._def,...n})}exclude(e,n=this._def){return hu.create(this.options.filter(i=>!e.includes(i)),{...this._def,...n})}}hu.create=NU;class Ik extends qt{_parse(e){const n=en.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==qe.string&&i.parsedType!==qe.number){const r=en.objectValues(n);return Ue(i,{expected:en.joinValues(r),received:i.parsedType,code:Ce.invalid_type}),kt}if(this._cache||(this._cache=new Set(en.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=en.objectValues(n);return Ue(i,{received:i.data,code:Ce.invalid_enum_value,options:r}),kt}return ja(e.data)}get enum(){return this._def.values}}Ik.create=(t,e)=>new Ik({values:t,typeName:wt.ZodNativeEnum,...Pt(e)});class ey extends qt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==qe.promise&&n.common.async===!1)return Ue(n,{code:Ce.invalid_type,expected:qe.promise,received:n.parsedType}),kt;const i=n.parsedType===qe.promise?n.data:Promise.resolve(n.data);return ja(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}}ey.create=(t,e)=>new ey({type:t,typeName:wt.ZodPromise,...Pt(e)});class gu extends qt{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=>{Ue(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"?am(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"?am(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(!pp(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=>pp(s)?Promise.resolve(r.transform(s.value,a)).then(o=>({status:n.value,value:o})):kt);en.assertNever(r)}}gu.create=(t,e,n)=>new gu({schema:t,typeName:wt.ZodEffects,effect:e,...Pt(n)});gu.createWithPreprocess=(t,e,n)=>new gu({schema:e,effect:{type:"preprocess",transform:t},typeName:wt.ZodEffects,...Pt(n)});class Mo extends qt{_parse(e){return this._getType(e)===qe.undefined?ja(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 _u extends qt{_parse(e){return this._getType(e)===qe.null?ja(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}_u.create=(t,e)=>new _u({innerType:t,typeName:wt.ZodNullable,...Pt(e)});class ty extends qt{_parse(e){const{ctx:n}=this._processInputParams(e);let i=n.data;return n.parsedType===qe.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}ty.create=(t,e)=>new ty({innerType:t,typeName:wt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Pt(e)});class ny extends qt{_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 Yb(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}}ny.create=(t,e)=>new ny({innerType:t,typeName:wt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Pt(e)});class jO extends qt{_parse(e){if(this._getType(e)!==qe.nan){const i=this._getOrReturnCtx(e);return Ue(i,{code:Ce.invalid_type,expected:qe.nan,received:i.parsedType}),kt}return{status:"valid",value:e.data}}}jO.create=t=>new jO({typeName:wt.ZodNaN,...Pt(t)});class RU extends qt{_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 qt{_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(),am(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 iy extends qt{_parse(e){const n=this._def.innerType._parse(e),i=r=>(pp(r)&&(r.value=Object.freeze(r.value)),r);return Yb(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}}iy.create=(t,e)=>new iy({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 nt=No.create,Pe=fp.create,Za=wk.create;Jl.create;const Hd=js.create,vt=yi.create,Gd=Qb.create,Sue=SA.create;Xb.create;const IU=mu.create,Cue=Jb.create,Ok=Zb.create,Wn=hu.create;ey.create;Mo.create;_u.create;function e_(t,e){return!t||t&&t[e]===0?"initial":t[e]!==void 0?`${t[e]}px solid ${t?.color??"black"}`:"initial"}function Jr({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",display:d,lineHeight:p,fontSize:f}){const h=t?`a${t}`:"",g={width:r,minWidth:r,...f!==void 0?{fontSize:f}:{},...p!==void 0?{lineHeight:p}:{},...d!==void 0?{display:d}:{},borderRadius:l??"initial",borderTop:e_(o,"top"),borderBottom:e_(o,"bottom"),borderLeft:e_(o,"left"),borderRight:e_(o,"right"),overflow:u,borderCollapse:"initial"};e&&String(e).trim()!==""?g.background=e:n&&(g.backgroundColor=n);const _=Math.max(0,Number(i.left)||0),b=Math.max(0,Number(i.right)||0),y={width:`${_}px`},E={width:`${b}px`},v=f!==void 0||p!==void 0?{...f!==void 0?{fontSize:f}:{},...p!==void 0?{lineHeight:p}:{}}:void 0;return m.jsx("table",{className:t,width:r,border:0,cellSpacing:"0",cellPadding:"0",style:{...g,tableLayout:"fixed"},children:m.jsxs("tbody",{children:[m.jsxs("tr",{style:{height:`${i.top}px`},className:c?`t${t}`:`it${t}`,children:[m.jsx("td",{style:y,className:c?`l${t}`:`il${t}`}),m.jsx("td",{style:{width:"100%"}}),m.jsx("td",{style:E,className:c?`r${t}`:`ir${t}`})]}),m.jsxs("tr",{children:[m.jsx("td",{style:y,className:c?`l${t}`:`il${t}`}),m.jsx("td",{className:h,align:a,style:{width:"100%",...v},children:s}),m.jsx("td",{style:E,className:c?`r${t}`:`ir${t}`})]}),m.jsxs("tr",{style:{height:`${i.bottom}px`},className:c?`b${t}`:`ib${t}`,children:[m.jsx("td",{style:y,className:c?`l${t}`:`il${t}`}),m.jsx("td",{style:{width:"100%"}}),m.jsx("td",{style:E,className:c?`r${t}`:`ir${t}`})]})]})})}const TA=t=>t?["http","mailto:","tel:","sms:","whatsapp:"].some(n=>t.startsWith(n))?t:`//${t}`:"#",OU=[{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'}],Tue={FAMILY:"MODERN_SANS"},Jp=Wn(["MODERN_SANS","LATO","MERRIWEATHER","MONTSERRAT","OPEN_SANS","OSWALD","PACIFICO","PLAYFAIR","ROBOTO","INHERIT"]).nullable().optional(),qO=t=>OU.find(e=>e.key===t)?.value;function Zl(t){const e=Ace();let n=qO(t);return n||(n=qO(e?.fontFamily),n||"inherit")}const Mu=(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 xA(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 xue(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=(e>>>0)*16777619;return e>>>0}function kue(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 jt(t){const e=xue(t);return`b${kue(e)}`}const Lf=nt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),VO=vt({top:Pe(),bottom:Pe(),right:Pe(),left:Pe()}).optional().nullable(),wue=t=>({top:t?.top??0,right:t?.right??0,bottom:t?.bottom??0,left:t?.left??0}),Due=vt({topLeft:Pe().min(0).optional(),topRight:Pe().min(0).optional(),bottomLeft:Pe().min(0).optional(),bottomRight:Pe().min(0).optional()}),WO=vt({top:Pe().min(0).optional(),bottom:Pe().min(0).optional(),left:Pe().min(0).optional(),right:Pe().min(0).optional()}),MU=vt({style:vt({backgroundColor:Lf,fontSize:Pe().min(0).optional().nullable(),fontSizeMobile:Pe().min(0).optional().nullable(),fontFamily:Jp,background:nt().nullable().optional(),buttonBackgroundColor:Lf,buttonTextColor:Lf,fontWeight:Wn(["bold","normal"]).optional().nullable(),textAlign:Wn(["left","center","right"]).optional().nullable(),textAlignMobile:Wn(["left","center","right"]).optional().nullable(),padding:VO,mobilePadding:VO,shape:Gd([Wn(["rectangle","pill"]),Due]).optional().nullable()}).passthrough().optional().nullable(),props:vt({buttonBackgroundColor:Lf,buttonTextColor:Lf,fullWidth:Za().optional().nullable(),fullWidthMobile:Za().optional().nullable(),size:Gd([Wn(["x-small","small","medium"]),WO]).optional().nullable(),sizeMobile:Gd([Wn(["x-small","small","medium"]),WO]).optional().nullable(),sizePaddingSidesLinked:Za().optional(),sizeMobilePaddingSidesLinked:Za().optional(),text:nt().optional().nullable(),url:nt().optional().nullable()}).optional().nullable()}).passthrough();function YO(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 Nl={text:"",url:"",fullWidth:!1,size:"medium",buttonBackgroundColor:"#999999"};function PU({style:t,props:e,blockId:n,isNotClient:i=!1}){const r=Wv(),a=_i(),o=!Vv()&&!i,l=e?.text??Nl.text,c=e?.url??Nl.url,u=a==="desktop"?e?.fullWidth??!1:e?.fullWidthMobile??e?.fullWidth??!1,d=t?.buttonTextColor??e?.buttonTextColor??r.textColor,p=t?.buttonBackgroundColor??e?.buttonBackgroundColor??Nl.buttonBackgroundColor,f={backgroundColor:t?.backgroundColor??void 0,textAlign:a=="desktop"?t?.textAlign??void 0:t?.textAlignMobile??t?.textAlign,padding:wue(a=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},h={color:d,fontSize:a=="desktop"?t?.fontSize??16:t?.fontSizeMobile??t?.fontSize??16,fontFamily:Zl(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?Mu(_,b):_,E=xA(t),v=jt(n);return m.jsx(Jr,{background:y,backgroundColor:b,padding:f.padding,align:f.textAlign,width:"100%",className:`c${v}`,children:m.jsx("a",{href:TA(c),target:"_blank",className:`abtn-${v}`,onClick:o?T=>T.preventDefault():void 0,children:m.jsx(Jr,{className:v,padding:a=="desktop"?YO(e?.size):YO(e?.sizeMobile??e?.size),borderRadius:E,background:p,backgroundColor:p,isParent:!1,align:"center",width:u?"100%":void 0,display:u?"block":"inline-block",border:g,children:m.jsx("span",{className:`btn${v}`,style:h,children:l})})})})}function _s({title:t,children:e}){return m.jsxs(mh,{sx:{padding:"0!important",paddingTop:"1rem!important"},children:[m.jsx(mn,{sx:{fontWeight:"bold",mb:2,pb:1,color:"text.primary",fontSize:"1.25rem",borderBottom:n=>`1px solid ${n.palette.divider}`},children:t}),m.jsx(gn,{spacing:2,gap:1,mb:3,pt:1,children:e})]})}const LU=pe(m.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),kA=pe(m.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"AddOutlined"),FU=pe(m.jsx("path",{d:"M4 22H2V2h2zM22 7H6v3h16zm-6 7H6v3h10z"}),"AlignHorizontalLeftOutlined"),BU=pe(m.jsx("path",{d:"M20 2h2v20h-2zM2 10h16V7H2zm6 7h10v-3H8z"}),"AlignHorizontalRightOutlined"),$U=pe(m.jsx("path",{d:"M22 22H2v-2h20zM10 2H7v16h3zm7 6h-3v10h3z"}),"AlignVerticalBottomOutlined"),UU=pe(m.jsx("path",{d:"M22 2v2H2V2zM7 22h3V6H7zm7-6h3V6h-3z"}),"AlignVerticalTopOutlined"),Aue=pe(m.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"),zU=pe([m.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"),m.jsx("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")],"ArticleOutlined"),Nue=pe(m.jsx("path",{d:"M19 12h-2v3h-3v2h5zM7 9h3V7H5v5h2zm14-6H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16.01H3V4.99h18z"}),"AspectRatio"),Rue=pe(m.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"),Mk=pe(m.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"),Iue=pe(m.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"),Oue=pe(m.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"),Mue=pe(m.jsx("path",{d:"M13 7h-2v2h2zm0 4h-2v2h2zm4 0h-2v2h2zM3 3v18h18V3zm16 16H5V5h14zm-6-4h-2v2h2zm-4-4H7v2h2z"}),"BorderOuterOutlined"),Pue=pe(m.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"),Lue=pe(m.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"),Fue=pe(m.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"),Bue=pe(m.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"),$ue=pe(m.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"),Yv=pe(m.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"),Uue=pe(m.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"),zue=pe(m.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"}),"ContentCopy"),KO=pe(m.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"),HU=pe(m.jsx("path",{d:"M17 15h2V7c0-1.1-.9-2-2-2H9v2h8zM7 17V1H5v4H1v2h4v10c0 1.1.9 2 2 2h10v4h2v-4h4v-2z"}),"Crop"),GU=pe(m.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"),Hue=pe(m.jsx("path",{d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 14H6V6h12z"}),"CropSquare"),Gue=pe(m.jsx("path",{d:"M19 5v2h-4V5zM9 5v6H5V5zm10 8v6h-4v-6zM9 17v2H5v-2zM21 3h-8v6h8zM11 3H3v10h8zm10 8h-8v10h8zm-10 4H3v6h8z"}),"DashboardOutlined"),jue=pe(m.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"),que=pe(m.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"),Vue=pe(m.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"),Wue=pe(m.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"),jU=pe(m.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"),Yue=pe(m.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"),qU=pe(m.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"),Kue=pe(m.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"),Que=pe(m.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"),Xue=pe(m.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"),Jue=pe(m.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"),VU=pe(m.jsx("path",{d:"M17 4h3c1.1 0 2 .9 2 2v2h-2V6h-3zM4 8V6h3V4H4c-1.1 0-2 .9-2 2v2zm16 8v2h-3v2h3c1.1 0 2-.9 2-2v-2zM7 18H4v-2H2v2c0 1.1.9 2 2 2h3zM18 8H6v8h12z"}),"FitScreen"),WU=pe(m.jsx("path",{d:"M7 15v2h10v-2zm-4 6h18v-2H3zm0-8h18v-2H3zm4-6v2h10V7zM3 3v2h18V3z"}),"FormatAlignCenter"),Zue=pe(m.jsx("path",{d:"M7 15v2h10v-2zm-4 6h18v-2H3zm0-8h18v-2H3zm4-6v2h10V7zM3 3v2h18V3z"}),"FormatAlignCenterOutlined"),YU=pe(m.jsx("path",{d:"M3 21h18v-2H3zm0-4h18v-2H3zm0-4h18v-2H3zm0-4h18V7H3zm0-6v2h18V3z"}),"FormatAlignJustify"),KU=pe(m.jsx("path",{d:"M15 15H3v2h12zm0-8H3v2h12zM3 13h18v-2H3zm0 8h18v-2H3zM3 3v2h18V3z"}),"FormatAlignLeft"),ede=pe(m.jsx("path",{d:"M15 15H3v2h12zm0-8H3v2h12zM3 13h18v-2H3zm0 8h18v-2H3zM3 3v2h18V3z"}),"FormatAlignLeftOutlined"),QU=pe(m.jsx("path",{d:"M3 21h18v-2H3zm6-4h12v-2H9zm-6-4h18v-2H3zm6-4h12V7H9zM3 3v2h18V3z"}),"FormatAlignRight"),tde=pe(m.jsx("path",{d:"M3 21h18v-2H3zm6-4h12v-2H9zm-6-4h18v-2H3zm6-4h12V7H9zM3 3v2h18V3z"}),"FormatAlignRightOutlined"),XU=pe(m.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"),JU=pe(m.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"),nde=pe(m.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"),ZU=pe(m.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"),ide=pe(m.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"),rde=pe(m.jsx("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"}),"FormatItalic"),QO=pe(m.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"),XO=pe(m.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"),e8=pe(m.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"),t8=pe(m.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"),n8=pe(m.jsx("path",{d:"M13 6.99h3L12 3 8 6.99h3v10.02H8L12 21l4-3.99h-3z"}),"HeightOutlined"),i8=pe(m.jsx("path",{fillRule:"evenodd",d:"M4 11h16v2H4z"}),"HorizontalRuleOutlined"),r8=pe(m.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"),a8=pe(m.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"),ade=pe(m.jsx("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown"),sde=pe(m.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"),s8=pe(m.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"),o8=pe(m.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"),ode=pe(m.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"),sg=pe(m.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"),og=pe(m.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"),lde=pe(m.jsx("path",{d:"M19.01 3h-14c-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 7.5c0 .83-.67 1.5-1.5 1.5.83 0 1.5.67 1.5 1.5V15c0 1.11-.9 2-2 2h-4v-2h4v-2h-2v-2h2V9h-4V7h4c1.1 0 2 .89 2 2z"}),"Looks3"),cde=pe(m.jsx("path",{d:"M19 3H5c-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-5 14h-2V9h-2V7h4z"}),"LooksOne"),ude=pe(m.jsx("path",{d:"M19 3H5c-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 8c0 1.11-.9 2-2 2h-2v2h4v2H9v-4c0-1.11.9-2 2-2h2V9H9V7h4c1.1 0 2 .89 2 2z"}),"LooksTwo"),dde=pe(m.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"),pde=pe(m.jsx("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"PanoramaFishEye"),fde=pe(m.jsx("path",{d:"M7.5 11C9.43 11 11 9.43 11 7.5S9.43 4 7.5 4 4 5.57 4 7.5 5.57 11 7.5 11m0-5C8.33 6 9 6.67 9 7.5S8.33 9 7.5 9 6 8.33 6 7.5 6.67 6 7.5 6M4.0025 18.5832 18.59 3.9955l1.4142 1.4143L5.4167 19.9974zM16.5 13c-1.93 0-3.5 1.57-3.5 3.5s1.57 3.5 3.5 3.5 3.5-1.57 3.5-3.5-1.57-3.5-3.5-3.5m0 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.5"}),"Percent"),mde=pe(m.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"),hde=pe(m.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"),l8=pe(m.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"),c8=pe(m.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"),id=pe(m.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"),gde=pe(m.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"),_de=pe(m.jsx("path",{d:"M4 9h16v2H4zm0 4h10v2H4z"}),"ShortText"),u8=pe(m.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"),JO=pe(m.jsx("path",{d:"M18 9v4H6V9H4v6h16V9z"}),"SpaceBar"),bde=pe(m.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"),yde=pe(m.jsx("path",{d:"M14 17H4v2h10zm6-8H4v2h16zM4 15h16v-2H4zM4 5v2h16V5z"}),"Subject"),vde=pe(m.jsx("path",{d:"M2.5 4v3h5v12h3V7h5V4zm19 5h-9v3h3v7h3v-7h3z"}),"TextFields"),d8=pe(m.jsx("path",{d:"M2.5 4v3h5v12h3V7h5V4zm19 5h-9v3h3v7h3v-7h3z"}),"TextFieldsOutlined"),Ede=pe(m.jsx("path",{d:"M5 4v3h5.5v12h3V7H19V4z"}),"Title"),Sde=pe(m.jsx("path",{d:"M16 13h-3V3h-2v10H8l4 4zM4 19v2h16v-2z"}),"VerticalAlignBottomOutlined"),Cde=pe(m.jsx("path",{d:"M8 19h3v4h2v-4h3l-4-4zm8-14h-3V1h-2v4H8l4 4zM4 11v2h16v-2z"}),"VerticalAlignCenterOutlined"),Tde=pe(m.jsx("path",{d:"M8 11h3v10h2V11h3l-4-4zM4 3v2h16V3z"}),"VerticalAlignTopOutlined"),p8=pe(m.jsx("path",{d:"M3 5v14h18V5zm5.33 12H5V7h3.33zm5.34 0h-3.33V7h3.33zM19 17h-3.33V7H19z"}),"ViewColumnOutlined"),f8=pe(m.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"),xde=pe(m.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 6h1v12H4zm16 12h-1V6h1z"}),"WidthFull"),kde=pe(m.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 6h4v12H4zm16 12h-4V6h4z"}),"WidthNormal"),wde=pe(m.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"),Ni=({children:t})=>m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.3rem"},children:t.map(e=>e)}),In=({label:t})=>{const e=sn();return t==null||t===""?null:m.jsx("p",{style:{fontWeight:"bold",color:e.palette.text.primary},children:t})};function Zp(){return(Zp=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 Kv(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 yh(t){var e=A.useRef(t),n=A.useRef(function(i){e.current&&e.current(i)});return e.current=t,n.current}var vh=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t<e?e:t},Om=function(t){return"touches"in t},Pk=function(t){return t&&t.ownerDocument.defaultView||self},ZO=function(t,e,n){var i=t.getBoundingClientRect(),r=Om(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:vh((r.pageX-(i.left+Pk(t).pageXOffset))/i.width),top:vh((r.pageY-(i.top+Pk(t).pageYOffset))/i.height)}},eM=function(t){!Om(t)&&t.preventDefault()},m8=A.memo(function(t){var e=t.onMove,n=t.onKey,i=Kv(t,["onMove","onKey"]),r=A.useRef(null),a=yh(e),s=yh(n),o=A.useRef(null),l=A.useRef(!1),c=A.useMemo(function(){var f=function(_){eM(_),(Om(_)?_.touches.length>0:_.buttons>0)&&r.current?a(ZO(r.current,_,o.current)):g(!1)},h=function(){return g(!1)};function g(_){var b=l.current,y=Pk(r.current),E=_?y.addEventListener:y.removeEventListener;E(b?"touchmove":"mousemove",f),E(b?"touchend":"mouseup",h)}return[function(_){var b=_.nativeEvent,y=r.current;if(y&&(eM(b),!(function(v,T){return T&&!Om(v)})(b,l.current)&&y)){if(Om(b)){l.current=!0;var E=b.changedTouches||[];E.length&&(o.current=E[0].identifier)}y.focus(),a(ZO(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 A.useEffect(function(){return p},[p]),A.createElement("div",Zp({},i,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:r,onKeyDown:d,tabIndex:0,role:"slider"}))}),wA=function(t){return t.filter(Boolean).join(" ")},h8=function(t){var e=t.color,n=t.left,i=t.top,r=i===void 0?.5:i,a=wA(["react-colorful__pointer",t.className]);return A.createElement("div",{className:a,style:{top:100*r+"%",left:100*n+"%"}},A.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},Wi=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n},Dde=function(t){return Ode(Lk(t))},Lk=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?Wi(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?Wi(parseInt(t.substring(6,8),16)/255,2):1}},Ade=function(t){return Ide(Rde(t))},Nde=function(t){var e=t.s,n=t.v,i=t.a,r=(200-e)*n/100;return{h:Wi(t.h),s:Wi(r>0&&r<200?e*n/100/(r<=100?r:200-r)*100:0),l:Wi(r/2),a:Wi(i,2)}},Fk=function(t){var e=Nde(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},Rde=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:Wi(255*[i,o,s,s,l,i][c]),g:Wi(255*[l,i,i,o,s,s][c]),b:Wi(255*[s,s,l,i,i,o][c]),a:Wi(r,2)}},t_=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},Ide=function(t){var e=t.r,n=t.g,i=t.b,r=t.a,a=r<1?t_(Wi(255*r)):"";return"#"+t_(e)+t_(n)+t_(i)+a},Ode=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:Wi(60*(o<0?o+6:o)),s:Wi(a?s/a*100:0),v:Wi(a/255*100),a:r}},Mde=A.memo(function(t){var e=t.hue,n=t.onChange,i=wA(["react-colorful__hue",t.className]);return A.createElement("div",{className:i},A.createElement(m8,{onMove:function(r){n({h:360*r.left})},onKey:function(r){n({h:vh(e+360*r.left,0,360)})},"aria-label":"Hue","aria-valuenow":Wi(e),"aria-valuemax":"360","aria-valuemin":"0"},A.createElement(h8,{className:"react-colorful__hue-pointer",left:e/360,color:Fk({h:e,s:100,v:100,a:1})})))}),Pde=A.memo(function(t){var e=t.hsva,n=t.onChange,i={backgroundColor:Fk({h:e.h,s:100,v:100,a:1})};return A.createElement("div",{className:"react-colorful__saturation",style:i},A.createElement(m8,{onMove:function(r){n({s:100*r.left,v:100-100*r.top})},onKey:function(r){n({s:vh(e.s+100*r.left,0,100),v:vh(e.v-100*r.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Wi(e.s)+"%, Brightness "+Wi(e.v)+"%"},A.createElement(h8,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:Fk(e)})))}),g8=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0},Lde=function(t,e){return t.toLowerCase()===e.toLowerCase()||g8(Lk(t),Lk(e))};function Fde(t,e,n){var i=yh(n),r=A.useState(function(){return t.toHsva(e)}),a=r[0],s=r[1],o=A.useRef({color:e,hsva:a});A.useEffect(function(){if(!t.equal(e,o.current.color)){var c=t.toHsva(e);o.current={hsva:c,color:e},s(c)}},[e,t]),A.useEffect(function(){var c;g8(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=A.useCallback(function(c){s(function(u){return Object.assign({},u,c)})},[]);return[a,l]}var Bde=typeof window<"u"?A.useLayoutEffect:A.useEffect,$de=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},tM=new Map,Ude=function(t){Bde(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!tM.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}`,tM.set(e,n);var i=$de();i&&n.setAttribute("nonce",i),e.head.appendChild(n)}},[])},zde=function(t){var e=t.className,n=t.colorModel,i=t.color,r=i===void 0?n.defaultColor:i,a=t.onChange,s=Kv(t,["className","colorModel","color","onChange"]),o=A.useRef(null);Ude(o);var l=Fde(n,r,a),c=l[0],u=l[1],d=wA(["react-colorful",e]);return A.createElement("div",Zp({},s,{ref:o,className:d}),A.createElement(Pde,{hsva:c,onChange:u}),A.createElement(Mde,{hue:c.h,onChange:u,className:"react-colorful__last-control"}))},Hde={defaultColor:"000",toHsva:Dde,fromHsva:function(t){return Ade({h:t.h,s:t.s,v:t.v,a:1})},equal:Lde},Gde=function(t){return A.createElement(zde,Zp({},t,{colorModel:Hde}))},jde=/^#?([0-9A-F]{3,8})$/i,qde=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=Kv(t,["color","onChange","onBlur","escape","validate","format","process"]),u=A.useState(function(){return a(n)}),d=u[0],p=u[1],f=yh(i),h=yh(r),g=A.useCallback(function(b){var y=a(b.target.value);p(y),s(y)&&f(l?l(y):y)},[a,l,s,f]),_=A.useCallback(function(b){s(b.target.value)||p(a(n)),h(b)},[n,a,s,h]);return A.useEffect(function(){p(a(n))},[n,a]),A.createElement("input",Zp({},c,{value:o?o(d):d,spellCheck:"false",onChange:g,onBlur:_}))},nM=function(t){return"#"+t},Vde=function(t){var e=t.prefixed,n=t.alpha,i=Kv(t,["prefixed","alpha"]),r=A.useCallback(function(s){return s.replace(/([^0-9A-F]+)/gi,"").substring(0,n?8:6)},[n]),a=A.useCallback(function(s){return(function(o,l){var c=jde.exec(o),u=c?c[1].length:0;return u===3||u===6||!!l&&u===4||!!l&&u===8})(s,n)},[n]);return A.createElement(qde,Zp({},i,{escape:r,format:e?nM:void 0,process:nM,validate:a}))};const iM={width:24,height:24};function Wde({paletteColors:t,isLocked:e,onToggleLock:n,onChange:i}){const r=sn(),{t:a}=Qe.useTranslation("inspector"),s=t.slice(30);return m.jsxs(gn,{spacing:1,children:[m.jsx("div",{style:{height:1,width:"100%",margin:"8px 0",backgroundColor:r.palette.grey[400]}}),m.jsxs(Se,{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"4px",children:[s.map((o,l)=>m.jsx(Vi,{sx:{...iM,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&&m.jsx(Vi,{onClick:n,sx:{backgroundColor:"transparent",border:"1px solid",...iM,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?m.jsx(sg,{fontSize:"small"}):m.jsx(og,{fontSize:"small"})})]})]})}const Yde={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%"}},rM=(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 DA({value:t,nullable:e,onChange:n}){const[i,r]=A.useState(t||"#000000"),[a,s]=A.useState(null),{paletteColors:o,isLocked:l}=jce(),[c,u]=A.useState(!1),d=sn(),p=A.useCallback(b=>{if(l)return;a&&clearTimeout(a);const y=setTimeout(()=>{const E=rM(b,o);R1({paletteColors:E})},300);s(y)},[a,l,o]),f=()=>{const b=!l;if(R1({isLocked:b}),!b&&i){const y=rM(i,o);R1({isLocked:b,paletteColors:y})}},h=b=>{u(!0),r(b)},g=()=>{n(i),p(i)},_=b=>{r(b),n(b),p(b)};return A.useEffect(()=>{t!==i&&r(t||"#000000")},[t]),A.useEffect(()=>()=>{a&&clearTimeout(a)},[a]),m.jsxs(gn,{spacing:1,sx:Yde,children:[m.jsx(Gde,{color:i,onChange:h,onMouseUp:g,onTouchEnd:g,onMouseLeave:()=>{c&&(g(),u(!1))}}),m.jsx(Wde,{isLocked:l,onToggleLock:f,paletteColors:o,value:t,nullable:e,onChange:b=>{b?(r(b),n(b),p(b)):n(null)}}),m.jsxs(Se,{pt:1,display:"flex",gap:1,alignItems:"center",children:[m.jsx(Vde,{prefixed:!0,color:i,onChange:_,style:{flex:1,backgroundColor:d.palette.background.paper,color:d.palette.text.primary,padding:"1px 4px",fontSize:"12px"}}),e&&m.jsx(Vi,{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:m.jsx(ZU,{color:"primary",fontSize:"small"})})]})]})}function _8({label:t,defaultValue:e,onChange:n,nullable:i,compact:r=!1,...a}){const[s,o]=A.useState(null),[l,c]=A.useState(e),{t:u}=Qe.useTranslation("inspector");A.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)},h=()=>!i||typeof l!="string"||l.trim().length===0?null:m.jsx(hn,{title:u("inputs.background.reset"),placement:"left",children:m.jsx(Se,{sx:{minWidth:24,lineHeight:1,flexShrink:0,pr:"4px",display:"grid",placeItems:"center"},onClick:()=>f(null),children:m.jsx(ZU,{sx:{color:"primary.main"}})})}),g=l?m.jsx(Ma,{onClick:d,sx:{...p,bgcolor:l}}):m.jsx(Ma,{onClick:d,sx:{...p},children:m.jsx(kA,{fontSize:"small"})}),_=m.jsx(iA,{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:m.jsx(DA,{value:l||"",nullable:i,onChange:b=>f(b)})});return r?m.jsxs(m.Fragment,{children:[g,_]}):m.jsxs(Ni,{children:[m.jsx(In,{label:t}),m.jsxs(gn,{direction:"row",alignContent:"center",spacing:1,children:[g,h()]}),_]})}function Zc(t){return m.jsx(_8,{...t,nullable:!1})}function O1(t){return m.jsx(_8,{...t,nullable:!0})}const zl=36,AA=8,Qv={width:"100%","& .MuiInputBase-root":{"&:not(.MuiInputBase-multiline)":{height:`${zl}px`}},"& .MuiOutlinedInput-root":{borderRadius:`${AA}px`,"&:not(.MuiInputBase-multiline)":{height:`${zl}px`}},"& .MuiInputBase-input":{paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",height:"unset"}},Bk={width:"100%",height:`${zl}px`,paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",display:"flex",alignItems:"center",borderRadius:`${AA}px`};function Pu({label:t,children:e,defaultValue:n,onChange:i}){const[r,a]=A.useState(n);return A.useEffect(()=>{n!==r&&a(n)},[n]),m.jsxs(Ni,{children:[m.jsx(In,{label:t}),m.jsx(Se,{sx:{...Bk,paddingLeft:"0px",paddingRight:"0px"},children:m.jsx(Qp,{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 Kde=me(Se)(({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}`}})),Qde=me("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"}})),aM=me(Rn)(({theme:t})=>({padding:"0",color:t.palette.primary.main,"&:hover":{backgroundColor:Ne(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]=A.useState(u.toString()),f=v=>{let T=v;T<a&&(T=a),s!==void 0&&T>s&&(T=s),i(T),p(T.toString())},h=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()};A.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 m.jsxs(Ni,{children:[m.jsx(In,{label:e}),m.jsxs(gn,{direction:"row",alignItems:"center",spacing:2,justifyContent:"space-between",width:"100%",children:[m.jsx(Se,{sx:{minWidth:24,lineHeight:1,flexShrink:0},children:t}),m.jsx(eb,{...c,value:u,min:a,max:s||1e3,step:o,color:"primary",marks:l,onChange:E}),m.jsxs(Kde,{children:[m.jsx(Qde,{type:"number",value:d,onChange:h,onBlur:g,onKeyDown:_,min:a,max:s,step:o}),m.jsxs(Se,{sx:{display:"flex",flexDirection:"column",ml:.5},children:[m.jsx(aM,{onClick:b,disabled:s!==void 0&&u>=s,children:m.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",children:m.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})}),m.jsx(aM,{onClick:y,disabled:u<=a,children:m.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",style:{transform:"rotate(180deg)"},children:m.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})})]})]}),m.jsx(mn,{variant:"caption",color:"text.secondary",sx:{fontSize:"16px",ml:"4px!important"},children:r})]})]})}function sM(t){return{top:Number(t.top??0),bottom:Number(t.bottom??0),left:Number(t.left??0),right:Number(t.right??0)}}function Xde({size:t,sizeMobile:e,sizePaddingSidesLinked:n,sizeMobilePaddingSidesLinked:i,onChange:r,label:a,maxValue:s=100,paddingSteps:o=8}){const{t:l}=Qe.useTranslation("inspector"),c=a??l("inputs.common.size"),u=_i(),[d,p]=A.useState(()=>{const v=u==="desktop"?t:e!==void 0?e:t;return typeof v=="object"&&v!==null?sM(v):{top:8,bottom:8,left:16,right:16}}),f=u==="desktop"?n===!0:i===!0;A.useEffect(()=>{const v=u==="desktop"?t:e!==void 0?e:t;typeof v=="object"&&v!==null&&p(sM(v))},[t,e,u]);const h=()=>{const v=u==="desktop"?t:e!==void 0?e:t;return typeof v=="object"&&v!==null?"custom":typeof v=="string"?v:"medium"},g=typeof 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=h();return m.jsxs(gn,{spacing:2,children:[m.jsxs(Pu,{label:c,defaultValue:E,onChange:_,children:[m.jsx(_n,{value:"x-small",children:m.jsx(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:m.jsx("span",{children:l("inputs.responsiveSize.options.xSmall")})})}),m.jsx(_n,{value:"small",children:m.jsx(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:m.jsx("span",{children:l("inputs.responsiveSize.options.small")})})}),m.jsx(_n,{value:"medium",children:m.jsx(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:m.jsx("span",{children:l("inputs.responsiveSize.options.medium")})})}),m.jsx(_n,{value:"custom",children:m.jsx(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:m.jsx("span",{children:l("inputs.responsiveSize.options.custom")})})})]}),E==="custom"&&m.jsxs(gn,{spacing:2,alignItems:"flexStart",pb:1,children:[m.jsxs(gn,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[m.jsx(In,{label:l("inputs.responsiveSize.customPadding")}),m.jsx(hn,{title:l(f?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:m.jsx(Rn,{size:"small",onClick:y,sx:{marginTop:"0!important",color:f?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:f?m.jsx(sg,{fontSize:"small"}):m.jsx(og,{fontSize:"small"})})})]}),f?m.jsx(di,{iconLabel:m.jsx(mn,{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}):m.jsxs(m.Fragment,{children:[m.jsx(di,{iconLabel:m.jsx(UU,{sx:{fontSize:16}}),value:d.top,setValue:v=>b("top",v),units:"px",min:0,step:o,marks:o>1,max:g}),m.jsx(di,{iconLabel:m.jsx($U,{sx:{fontSize:16}}),value:d.bottom,setValue:v=>b("bottom",v),units:"px",min:0,step:o,marks:o>1,max:g}),m.jsx(di,{iconLabel:m.jsx(FU,{sx:{fontSize:16}}),value:d.left,setValue:v=>b("left",v),units:"px",min:0,step:o,marks:o>1,max:g}),m.jsx(di,{iconLabel:m.jsx(BU,{sx:{fontSize:16}}),value:d.right,setValue:v=>b("right",v),units:"px",min:0,step:o,marks:o>1,max:g})]})]})]})}function Jde({fullWidth:t,fullWidthMobile:e,onChange:n,label:i="Width"}){const r=_i(),{t:a}=Qe.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 m.jsxs(Pu,{label:i,defaultValue:l?"FULL_WIDTH":"AUTO",onChange:o,children:[m.jsx(_n,{value:"FULL_WIDTH",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(xde,{fontSize:"small"}),m.jsx("span",{children:a("inputs.width.full")})]})}),m.jsx(_n,{value:"AUTO",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(kde,{fontSize:"small"}),m.jsx("span",{children:a("inputs.width.auto")})]})})]})}function Zde(t,e){const n=A.useRef(null),i=A.useRef(t),r=A.useRef([]);i.current=t;const a=A.useCallback((...s)=>{r.current=s,n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{i.current(...s),n.current=null},e)},[e]);return a.flush=A.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=null,i.current(...r.current))},[]),a}function mp({helperText:t,label:e,placeholder:n,rows:i,InputProps:r,defaultValue:a,onChange:s}){const[o,l]=A.useState(a);A.useEffect(()=>{o!==a&&l(a)},[a]);const c=Zde(d=>{s(d)},150),u=typeof i=="number"&&i>1;return m.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[m.jsx(In,{label:e}),m.jsx(Kp,{fullWidth:!0,multiline:u,minRows:i,variant:"outlined",placeholder:n,helperText:t,InputProps:r,value:o,sx:Qv,onChange:d=>{const p=d.target.value;l(p),c(p)},onBlur:()=>{c.flush()}})]})}function epe({onClick:t,disabled:e,primary:n=!1}){const{t:i}=Qe.useTranslation("inspector");return m.jsx(Rn,{"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:m.jsx(Yv,{})})}function tpe({imageUrl:t,saving:e=!1}){return m.jsxs(lie,{sx:{position:"relative"},children:[e&&m.jsx(gn,{justifyContent:"center",alignItems:"center",sx:{position:"absolute",top:7,left:0,width:"100%",height:"314px",zIndex:20,backgroundColor:"#212121AA",mb:1},children:m.jsx(Xl,{size:48,thickness:6,color:"inherit",sx:{color:"white"}})}),m.jsx(hie,{component:"img",sx:{objectFit:"contain",width:"100%",height:"326px"},image:t,alt:"Generated Image"})]})}function npe({value:t,onChange:e,disabled:n}){return m.jsxs(m.Fragment,{children:[m.jsx(mn,{sx:{fontSize:"14px",fontWeight:700},children:"Image description"}),m.jsx(Kp,{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 ipe=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 b8({src:t,style:e}){const{t:n}=Qe.useTranslation("inspector"),[i,r]=A.useState(!1),[a,s]=A.useState(!1),[o,l]=A.useState(""),[c,u]=A.useState(null),[d,p]=A.useState(!1),[f,h]=A.useState(null),[g,_]=A.useState(!1),b=()=>{r(!0),h(null)},y=()=>{a||(r(!1),s(!1),u(null),l(""),p(!1),h(null),_(!1))},E=()=>{const S=c&&!d?"store-ai-image":"request-ai-image",C=c&&!d?c:o;h(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),h(null),_(!1)};A.useEffect(()=>{const S=C=>{const{detail:x}=C;if(s(!1),x.error){h(ipe(x.error));return}if(!x.success||!x.url){h({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)}},[]),A.useEffect(()=>{y()},[t]);const T=!c||d;return m.jsxs(m.Fragment,{children:[m.jsx(Vi,{style:e,startIcon:m.jsx(Mk,{className:"w-4 h-4"}),variant:"contained",onClick:b,children:n("inputs.aiImageGeneration.generate")}),m.jsx(ire,{open:i,onClose:y,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{bgcolor:"background.paper",color:"text.primary",borderRadius:"8px"}},children:m.jsxs("form",{onSubmit:S=>{S.preventDefault(),E()},children:[m.jsxs(Tre,{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"),m.jsx(epe,{onClick:y,disabled:a,primary:!0})]}),m.jsxs(hre,{children:[m.jsx(vre,{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?m.jsxs(gn,{sx:{position:"relative"},children:[m.jsx(tpe,{imageUrl:c,saving:g}),m.jsxs(Ul,{variant:"outlined",severity:"warning",icon:!1,children:[n("inputs.aiImageGeneration.warningRegenerate")," ",m.jsx("b",{children:n("inputs.aiImageGeneration.warningInsertFirst")})," ",n("inputs.aiImageGeneration.warningFirst")]})]}):a&&!c?m.jsx(gn,{justifyContent:"center",alignItems:"center",sx:{backgroundColor:S=>S.palette.mainColor[50],height:"326px",width:"100%"},children:m.jsx(Xl,{size:48,thickness:6})}):m.jsx(npe,{value:o,onChange:l,disabled:a})]}),!a&&m.jsxs(lre,{className:"p-6",children:[c&&!d&&m.jsx(Vi,{startIcon:m.jsx(c8,{className:"w-4 h-4"}),onClick:v,variant:"outlined",disabled:a,children:n("inputs.aiImageGeneration.regenerate")}),!c&&!d&&m.jsx(Vi,{onClick:y,variant:"text",disabled:d,children:n("inputs.aiImageGeneration.cancel")}),m.jsxs(Vi,{startIcon:c&&!d?m.jsx(Rue,{className:"w-4 h-4"}):m.jsx(Mk,{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&&m.jsx(Xl,{size:16,className:"ml-2"})]})]})]})})]})}const rpe=({className:t,...e})=>m.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",className:t,"aria-hidden":"true",focusable:"false",...e,children:m.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 3l6 6l6-6"})}),ape=me(oA)(({theme:t})=>({fontFamily:t.typography.fontFamily,color:t.palette.text.primary,backgroundColor:t.palette.background.input??t.palette.grey[100],width:"100%",height:`${zl}px`,"&.MuiInputBase-root, &.MuiOutlinedInput-root":{height:`${zl}px`,minHeight:`${zl}px`,boxSizing:"border-box",borderRadius:`${AA}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}})),ec=A.forwardRef((t,e)=>{const n=sn(),i={backgroundColor:n.palette.background.input??n.palette.grey[100],marginTop:"4px",borderRadius:"10px",border:`1px solid ${n.palette.divider}`,boxShadow:`0 1px 3px ${Ne("#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 m.jsx(ape,{ref:e,...t,IconComponent:rpe,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}}}}})});ec.displayName="CustomSelect";function y8(t){return m.jsx(Oa,{viewBox:"0 0 18 18",fontSize:"small",...t,children:m.jsx("path",{d:"M9.00015 6.75V8.25M9.00015 11.25H9.00765M3.804 14.25H14.1963C15.351 14.25 16.0727 13 15.4953 12L10.2992 3C9.72184 2 8.27846 2 7.70111 3L2.50496 12C1.92761 13 2.6493 14.25 3.804 14.25Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})}const spe=({defaultValue:t,onChange:e,values:n})=>{const i=rg(),{t:r}=Qe.useTranslation("inspector"),a=sn(),s=j=>{if(!j)return{url:"",repeat:"no-repeat",position:"center center",size:"cover"};const oe=j.match(/url\("([^"]+)"\)/),le=oe?oe[1]:"";let xe="no-repeat";j.includes("repeat-x")?xe="repeat-x":j.includes("repeat-y")?xe="repeat-y":j.includes("repeat")&&!j.includes("no-repeat")&&(xe="repeat");let ve="center center";const he=["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"];for(const at of he)if(j.includes(at)){ve=at;break}let ye="cover";return j.includes("contain")?ye="contain":j.includes("auto")&&(ye="auto"),{url:le,repeat:xe,position:ve,size:ye}},o=j=>j.url?`url("${j.url}") ${j.repeat} ${j.position} / ${j.size}`:"",[l,c]=A.useState(t||null),[u,d]=A.useState(s(t)),[p,f]=A.useState(!1),[h,g]=A.useState(()=>!!window.__emailBuilderEnableAI),[,_]=A.useState(null),[b,y]=A.useState(s(t).url||""),[E,v]=A.useState(!1),[T,S]=A.useState(""),[C,x]=A.useState(!1),k=A.useRef(null),w=yA(),[D,L]=A.useState(null);A.useEffect(()=>{const j=window.__emailBuilderCustomImageProvider;j&&(L(j),setTimeout(()=>{i&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:i,currentImageUrl:u.url||null,alt:null}}))},100))},[]);const[I,O]=A.useState(()=>sessionStorage.getItem("hideBackgroundImageWarning")==="true"),M=(j,oe)=>{const le={...u,...j};if(d(le),le.url){const xe=o(le);c(xe),e(xe,oe)}else console.error("Update params error: ",le)},P=(j,oe)=>{if(!j)return!1;const le=j?.toLowerCase(),xe=le.includes(".svg")||le.includes("svg"),ve=oe&&(oe.includes("image/svg+xml")||oe.includes("svg"));return xe||!!ve},$=async j=>{try{v(!0),S(""),x(!1);try{new URL(j)}catch{return S("Invalid URL format"),!1}const oe=new AbortController,le=setTimeout(()=>oe.abort(),1e4);try{const xe=await fetch(j,{method:"HEAD",signal:oe.signal});if(clearTimeout(le),!xe.ok)return S(`HTTP ${xe.status}: ${xe.statusText}`),!1;const ve=xe.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(at=>ve&&ve.toLowerCase().includes(at.toLowerCase()))?(P(j,ve)&&x(!0),S(""),!0):(S("URL does not point to an image"),!1)}catch(xe){return clearTimeout(le),xe.name==="AbortError"?(S("Request timeout - URL took too long to respond"),!1):new Promise(ve=>{const he=new Image,ye=setTimeout(()=>{S("Request timeout - URL took too long to respond"),ve(!1)},1e4);he.onload=()=>{clearTimeout(ye),P(j)&&x(!0),S(""),ve(!0)},he.onerror=()=>{clearTimeout(ye),S("Cannot access image - CORS policy, network error, or invalid URL"),ve(!1)},he.src=j})}}catch{return S("Unexpected error occurred while validating URL"),!1}finally{v(!1)}},U=async()=>{b.trim()&&await $(b.trim())&&M({url:b.trim()})},G=j=>{j.key==="Enter"&&U()},V=j=>{y(j.target.value),T&&S(""),C&&x(!1)},K=j=>{const oe=["image/png","image/jpeg","image/gif"],xe=Array.isArray(j)?j:Array.from(j),ve=xe.filter(ye=>oe.includes(ye.type)&&ye.size<=5242880);if(ve.length!==xe.length&&alert(r("inputs.common.invalidFiles")),ve.length===0)return;const he=ve.map(ye=>new Promise(at=>{const ht=new FileReader;ht.onload=gt=>at(gt.target?.result),ht.readAsDataURL(ye)}));Promise.all(he).then(ye=>{const at={images:ye,id:i||"",styles:n};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:at})),zd(!0,i||"")})},te=j=>{j.preventDefault(),f(!0)},Te=()=>{f(!1)},de=j=>{j.preventDefault(),f(!1);const oe=j.dataTransfer.files;K(oe)},Oe=()=>{const j=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(j)},se=()=>{d({url:"",repeat:"no-repeat",position:"center center",size:"cover"}),c(null),e(null),y(""),x(!1)},X=j=>{switch(j){case"top left":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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 m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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 m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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 m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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 m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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 m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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 m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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 m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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 m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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 m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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"})})}},J=j=>({"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")})[j]??r("inputs.backgroundImage.positions.center");return A.useEffect(()=>{const j=window.__emailBuilderEnableAI;j!==void 0&&g(!!j);const oe=le=>{const{detail:xe}=le;g(!!xe)};return window.addEventListener("email-builder-ai-generation",oe),()=>{window.removeEventListener("email-builder-ai-generation",oe)}},[]),A.useEffect(()=>{const j=ve=>{const{detail:he}=ve;zd(!1,he.id||""),M({url:he.url},he.styles),xU(!1),y(he.url)},oe=ve=>{zd(ve?.detail?.uploading??!1,ve?.detail?.id??"")},le=()=>{k?.current?.click()},xe=ve=>{const he=ve.detail;if(typeof he=="string"){if(!he.includes("url("))M({url:he}),y(he);else{const ye=s(he);d(ye),c(he),e(he),y(ye.url)}return}he?.url!=null&&typeof he.url=="string"&&(M({url:he.url},he.styles),y(he.url))};return window.addEventListener("email-builder-set-image",xe),window.addEventListener("email-builder-upload-image-receive",j),window.addEventListener("email-builder-upload-file",le),window.addEventListener("email-builder-toggle-upload-file",oe),()=>{window.removeEventListener("email-builder-upload-image-receive",j),window.removeEventListener("email-builder-set-image",xe),window.removeEventListener("email-builder-upload-file",le),window.removeEventListener("email-builder-toggle-upload-file",oe)}},[u]),A.useEffect(()=>{t&&x(P(u.url))},[t,u.url]),A.useEffect(()=>{if(t!==l){const j=s(t);d(j),c(t||null),y(j.url||"")}},[t]),m.jsxs(Ni,{children:[m.jsxs(Se,{sx:{display:"flex",alignItems:"center",gap:1},children:[m.jsx(In,{label:r("inputs.backgroundImage.label")}),!I&&m.jsx(hn,{title:r("inputs.backgroundImage.warningTooltip"),placement:"top",children:m.jsx(Rn,{size:"small",color:"warning",disableRipple:!0,sx:{p:0,cursor:"help",lineHeight:0,"&:hover":{backgroundColor:"transparent"}},children:m.jsx(y8,{"aria-hidden":!0})})})]}),D?m.jsx(Se,{sx:{mb:2},children:D}):m.jsx("div",{style:{display:"flex",gap:8},children:w?m.jsxs(Se,{sx:{width:"100%"},children:[m.jsxs(gn,{direction:"row",spacing:1,children:[m.jsx(Kp,{fullWidth:!0,placeholder:r("inputs.image.urlPlaceholder"),value:b,onChange:V,onKeyPress:G,error:!!T,disabled:E,sx:Qv}),m.jsx(Vi,{variant:"contained",onClick:U,disabled:!b.trim()||E,sx:{minWidth:"auto",px:2,position:"relative"},children:E?m.jsx(Xl,{size:20,color:"inherit"}):r("inputs.common.add")})]}),T&&m.jsx(Ul,{severity:"error",sx:{mt:1,fontSize:"0.875rem",maxHeight:"70px"},children:T}),C&&m.jsx(Ul,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:m.jsx(Rn,{"aria-label":r("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{x(!1)},children:m.jsx(Yv,{fontSize:"inherit"})}),children:r("inputs.common.svgWarning")}),u.url&&m.jsxs(Se,{sx:{position:"relative",maxWidth:"50%",display:"block",margin:"0.5rem auto 0 auto"},children:[m.jsx("img",{src:u.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"}}),m.jsx(Rn,{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:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:m.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"})})})]})]}):m.jsxs(m.Fragment,{children:[u.url&&m.jsxs(Se,{sx:{position:"relative",maxWidth:"40%",minWidth:"40%"},children:[m.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:m.jsx("img",{src:u.url||"",alt:"",style:{width:"100%",objectFit:"contain",aspectRatio:"1 / 1",height:"100%"}})}),m.jsx(Rn,{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:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:m.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"})})})]}),m.jsxs(Se,{onDragOver:te,onDragLeave:Te,onDrop:de,sx:{width:"100%",minWidth:"40%",border:"2px solid",borderColor:p?"primary.main":"divider",borderRadius:"8px",padding:"24px 8px 36px 8px",textAlign:"center",bgcolor:p?"primary.50":"background.paper",transition:"all 0.2s ease"},children:[m.jsx(Se,{sx:{display:"flex",justifyContent:"center"},children:m.jsx(l8,{sx:{fontSize:32,color:"primary"}})}),m.jsxs("label",{style:{cursor:"pointer"},children:[m.jsx("input",{ref:k,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:j=>{const oe=j.target.files;oe&&oe.length>0&&K(Array.from(oe))}}),m.jsx(mn,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:r("inputs.common.uploadFile")}),m.jsxs(mn,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",r("inputs.common.dragAndDrop")]})]}),m.jsx(mn,{variant:"body2",sx:{color:"text.secondary",mt:1},children:r("inputs.common.fileInfo")})]})]})}),u.url&&m.jsxs(Se,{sx:{mt:2},children:[m.jsxs(Se,{sx:{mb:2},children:[m.jsx(In,{label:r("inputs.backgroundImage.fillType")}),m.jsxs(Qp,{value:u.size,exclusive:!0,onChange:(j,oe)=>{oe!=null&&typeof oe=="string"&&M({size:oe})},size:"small",fullWidth:!0,children:[m.jsx(_n,{value:"cover",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(HU,{fontSize:"small"}),m.jsx("span",{children:r("inputs.backgroundImage.fillOptions.cover")})]})}),m.jsx(_n,{value:"contain",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(VU,{fontSize:"small"}),m.jsx("span",{children:r("inputs.backgroundImage.fillOptions.contain")})]})}),m.jsx(_n,{value:"auto",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(Nue,{fontSize:"small"}),m.jsx("span",{children:r("inputs.backgroundImage.fillOptions.auto")})]})})]})]}),m.jsxs(gn,{direction:"row",spacing:2,sx:{mb:2},children:[m.jsxs("div",{style:{flex:1},children:[m.jsx(In,{label:r("inputs.backgroundImage.repeat")}),m.jsxs(ec,{style:{width:"100%"},value:u.repeat,size:"small",onChange:j=>M({repeat:j.target.value}),children:[m.jsx(Xa,{value:"no-repeat",children:r("inputs.backgroundImage.repeatOptions.none")}),m.jsx(Xa,{value:"repeat",children:r("inputs.backgroundImage.repeatOptions.repeat")}),m.jsx(Xa,{value:"repeat-x",children:r("inputs.backgroundImage.repeatOptions.repeatX")}),m.jsx(Xa,{value:"repeat-y",children:r("inputs.backgroundImage.repeatOptions.repeatY")})]})]}),m.jsxs("div",{style:{flex:1},children:[m.jsx(In,{label:r("inputs.backgroundImage.position")}),m.jsx(ec,{style:{width:"100%"},value:u.position,size:"small",onChange:j=>M({position:j.target.value}),renderValue:j=>{const oe=String(j??"");return m.jsxs(Se,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[X(oe),J(oe)]})},children:["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"].map(j=>m.jsx(Xa,{sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important "},value:j,children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",gap:1},children:[X(j),J(j)]})},j))})]})]})]}),!D&&!w&&C&&m.jsx(Ul,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},children:r("inputs.common.svgWarning")}),(!D&&Vb()&&!w||D&&h)&&m.jsxs(m.Fragment,{children:[m.jsxs(gn,{direction:"row",alignItems:"center",spacing:1,sx:{mt:2},children:[m.jsx(dr,{sx:{flexGrow:1}}),m.jsx(mn,{sx:{color:"text.secondary"},children:r("inputs.backgroundImage.or")}),m.jsx(dr,{sx:{flexGrow:1}})]}),m.jsx(gn,{flexDirection:"row",gap:2,sx:{mt:2},children:!D&&Vb()&&!w&&m.jsx(Vi,{variant:"outlined",onClick:Oe,startIcon:m.jsx(a8,{}),sx:{width:"100%"},children:r("inputs.backgroundImage.browseGallery")})})]}),!D&&h&&m.jsx(b8,{src:u.url,style:{width:"100%",margin:0}})]})};function Sd({label:t,defaultValue:e,onChange:n,...i}){const[r,a]=A.useState(e??0);return e!=r&&a(e),m.jsxs(Ni,{children:[m.jsx(In,{label:t}),m.jsx(di,{value:r??0,setValue:s=>{a(s),n(s)},...i})]})}const oM=({mobile:t=!1,label:e,borderColor:n,borderTop:i,borderBottom:r,borderLeft:a,borderRight:s,onChange:o,sidesLinked:l,onSidesLinkedChange:c})=>{const{t:u}=Qe.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(D=>D===w[0])},f=d(),h={[f.top]:i??0,[f.bottom]:r??0,[f.left]:a??0,[f.right]:s??0},[g,_]=A.useState(n??"#000000"),[b,y]=A.useState(h),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);A.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(D=>b[D]!==k[D])&&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 D={...b,borderColor:g,[w]:k};o(D)};return m.jsxs("div",{children:[m.jsxs(gn,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[m.jsx(In,{label:e}),m.jsxs(gn,{direction:"row",spacing:1,alignItems:"center",children:[m.jsx(Zc,{defaultValue:g,onChange:S,compact:!0}),m.jsx(hn,{title:u(v?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:m.jsx(Rn,{size:"small",onClick:T,sx:{color:v?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:v?m.jsx(sg,{fontSize:"small"}):m.jsx(og,{fontSize:"small"})})})]})]}),v&&m.jsx(Sd,{label:"",iconLabel:m.jsx(Mue,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.top],onChange:C}),!v&&m.jsxs(gn,{spacing:2,children:[m.jsx(Sd,{label:"",iconLabel:m.jsx(Lue,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.top],onChange:k=>x(k,f.top)}),m.jsx(Sd,{label:"",iconLabel:m.jsx(Iue,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.bottom],onChange:k=>x(k,f.bottom)}),m.jsx(Sd,{label:"",iconLabel:m.jsx(Oue,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.left],onChange:k=>x(k,f.left)}),m.jsx(Sd,{label:"",iconLabel:m.jsx(Pue,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.right],onChange:k=>x(k,f.right)})]})]})},ope=OU.map(t=>m.jsx(Xa,{value:t.key,sx:{fontFamily:t.value},children:t.label},t.key));function v8({label:t,onChange:e,defaultValue:n}){const i="INHERIT",[r,a]=A.useState(n??i);A.useEffect(()=>{r!==n&&a(n??i)},[n]);const s=o=>{const l=o.target.value;a(l),e(l===null?null:l)};return m.jsxs(Ni,{children:[m.jsx(In,{label:t}),m.jsx(ec,{style:{width:"100%"},value:r,size:"small",onChange:s,children:ope})]})}function lM({label:t,defaultValue:e=16,onChange:n,maxValue:i,minValue:r,step:a}){const[s,o]=A.useState(e);A.useEffect(()=>{s!==e&&o(e)},[e]);const l=c=>{o(c),n(c)};return m.jsxs(Ni,{children:[m.jsx(In,{label:t}),m.jsx(di,{iconLabel:m.jsx(d8,{sx:{fontSize:16,color:"text.primary"}}),value:s,setValue:l,units:"px",step:a??2,min:r||8,max:i||48})]})}function lpe({label:t,defaultValue:e,onChange:n}){const{t:i}=Qe.useTranslation("inspector"),[r,a]=A.useState(e);return A.useEffect(()=>{r!==e&&a(e)},[e]),m.jsxs(Pu,{label:t,defaultValue:r,onChange:s=>{a(s),n(s)},children:[m.jsx(_n,{value:"normal",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(vde,{fontSize:"small"}),m.jsx("span",{children:i("inputs.fontWeightToggle.regular")})]})}),m.jsx(_n,{value:"bold",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(XU,{fontSize:"small"}),m.jsx("span",{children:i("inputs.fontWeightToggle.bold")})]})})]})}const cM=({label:t,defaultValue:e,onChange:n})=>{const{t:i}=Qe.useTranslation("inspector"),r=t??i("inputs.common.height");return m.jsx(di,{label:r,iconLabel:m.jsx(n8,{sx:{color:"text.secondary"}}),units:"px",step:1,min:1,max:100,marks:!1,value:e??1,setValue:n})},cpe=[{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)"}],upe=cpe.map(t=>m.jsx(Xa,{value:t.key,children:t.label},t.key));function dpe({label:t,onChange:e,defaultValue:n}){const i="INHERIT",[r,a]=A.useState(n?.toString()??i);A.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 m.jsxs(Ni,{children:[m.jsx(In,{label:t}),m.jsxs(ec,{style:{width:"100%"},value:r,size:"small",onChange:s,children:[m.jsx(Xa,{value:i,children:"Default value"}),upe]})]})}function uM({label:t,defaultValue:e,onChange:n,sidesLinked:i,onSidesLinkedChange:r}){const{t:s}=Qe.useTranslation("inspector"),[o,l]=A.useState(()=>e||{top:0,left:0,bottom:0,right:0});A.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 h;c?h={top:f,bottom:f,left:f,right:f}:h={...o,[p]:f},l(h),n(h)}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 m.jsxs(Ni,{children:[m.jsxs(gn,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[m.jsx(In,{label:t}),m.jsx(hn,{title:s(c?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:m.jsx(Rn,{size:"small",onClick:d,sx:{marginTop:"0!important",color:c?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:c?m.jsx(sg,{fontSize:"small"}):m.jsx(og,{fontSize:"small"})})})]}),c?m.jsx(di,{iconLabel:m.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}):m.jsxs(m.Fragment,{children:[m.jsx(di,{iconLabel:m.jsx(UU,{sx:{fontSize:16,color:"text.primary"}}),value:o.top,setValue:p=>u("top",p),units:"px",step:16,min:0,max:120,marks:!0}),m.jsx(di,{iconLabel:m.jsx($U,{sx:{fontSize:16,color:"text.primary"}}),value:o.bottom,setValue:p=>u("bottom",p),units:"px",step:16,min:0,max:120,marks:!0}),m.jsx(di,{iconLabel:m.jsx(FU,{sx:{fontSize:16,color:"text.primary"}}),value:o.left,setValue:p=>u("left",p),units:"px",step:16,min:0,max:120,marks:!0}),m.jsx(di,{iconLabel:m.jsx(BU,{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 ppe=({label:t,defaultValue:e,onChange:n,maxValue:i=600,shapeSteps:r=8,cornersLinked:a,onCornersLinkedChange:s})=>{const{t:o}=Qe.useTranslation("inspector"),[l,c]=A.useState(()=>typeof e=="object"&&e!==null?"rounded":e||"rectangle"),[u,d]=A.useState(()=>typeof e=="object"&&e!==null?e:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0}),p=a===!0;A.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)},h=(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 m.jsxs(m.Fragment,{children:[m.jsxs(Pu,{label:b,defaultValue:l,onChange:f,children:[m.jsx(_n,{value:"rectangle",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(Hue,{fontSize:"small"}),m.jsx("span",{children:o("shape.square")})]})}),m.jsx(_n,{value:"pill",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(pde,{fontSize:"small"}),m.jsx("span",{children:o("shape.pill")})]})}),m.jsx(_n,{value:"rounded",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(id,{fontSize:"small"}),m.jsx("span",{children:o("shape.custom")})]})})]}),l==="rounded"&&m.jsxs(gn,{spacing:2,alignItems:"flexStart",pb:1,children:[m.jsxs(gn,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[m.jsx(In,{label:o("shape.borderRadius")}),m.jsx(hn,{title:o(p?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:m.jsx(Rn,{size:"small",onClick:g,sx:{marginTop:"0!important",color:p?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:p?m.jsx(sg,{fontSize:"small"}):m.jsx(og,{fontSize:"small"})})})]}),p?m.jsx(m.Fragment,{children:m.jsx(di,{iconLabel:m.jsx(id,{sx:{fontSize:16}}),value:Number(u.topRight),setValue:y=>h("topLeft",y),units:"px",min:0,step:r,marks:r>1,max:_})}):m.jsxs(m.Fragment,{children:[m.jsx(di,{iconLabel:m.jsx(id,{sx:{fontSize:16,transform:"rotate(0deg)"}}),value:Number(u.topLeft),setValue:y=>h("topLeft",y),units:"px",min:0,step:r,marks:r>1,max:_}),m.jsx(di,{iconLabel:m.jsx(id,{sx:{fontSize:16,transform:"rotate(270deg)"}}),value:Number(u.topRight),setValue:y=>h("topRight",y),units:"px",min:0,step:r,marks:r>1,max:_}),m.jsx(di,{iconLabel:m.jsx(id,{sx:{fontSize:16,transform:"rotate(180deg)"}}),value:Number(u.bottomLeft),setValue:y=>h("bottomLeft",y),units:"px",min:0,step:r,marks:r>1,max:_}),m.jsx(di,{iconLabel:m.jsx(id,{sx:{fontSize:16,transform:"rotate(90deg)"}}),value:Number(u.bottomRight),setValue:y=>h("bottomRight",y),units:"px",min:0,step:r,marks:r>1,max:_})]})]})]})};function dM({label:t,defaultValue:e,onChange:n}){const[i,r]=A.useState(e??"left");return A.useEffect(()=>{e!==i&&r(e??"left")},[e]),m.jsxs(Ni,{children:[m.jsx(In,{label:t}),m.jsxs(Pu,{label:"",defaultValue:i,onChange:a=>{r(a),n(a)},children:[m.jsx(_n,{value:"left",children:m.jsx(ede,{fontSize:"small"})}),m.jsx(_n,{value:"center",children:m.jsx(Zue,{fontSize:"small"})}),m.jsx(_n,{value:"right",children:m.jsx(tde,{fontSize:"small"})})]})]})}const pM=({label:t,defaultValue:e,onChange:n,step:i,...r})=>{const{t:a}=Qe.useTranslation("inspector"),s=t??a("inputs.common.width");return m.jsx(di,{label:s,iconLabel:m.jsx(n8,{sx:{color:"text.primary",transform:"rotate(90deg)"}}),units:"%",step:i,min:1,max:100,marks:!1,value:e??1,setValue:n,...r})};function fpe({name:t,value:e,onChange:n,shapeMaxValue:i,shapeSteps:r}){const a=_i(),s=Wv(),{t:o}=Qe.useTranslation("inspector"),l=(f,h)=>{const g=e[f],_=e[h];return g??_},c=(f,h)=>{n(h?{...e,...h,[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 m.jsx(O1,{label:o("properties.backgroundColor"),defaultValue:p??s?.canvasColor,onChange:c});case"background":return m.jsx(spe,{defaultValue:p,onChange:(f,h)=>c(f,h),values:e});case"borderColor":return m.jsx(O1,{label:o("properties.border"),defaultValue:p,onChange:c});case"borderRadius":return m.jsx(Sd,{iconLabel:m.jsx(gde,{}),units:"px",step:4,marks:!0,min:0,max:48,label:o("properties.borderRadius"),defaultValue:p,onChange:c});case"color":return m.jsx(O1,{label:o("properties.color"),defaultValue:p,onChange:c});case"fontFamily":return m.jsx(v8,{label:o("properties.fontFamily"),defaultValue:p,onChange:c});case"fontWeight":return m.jsx(lpe,{label:o("properties.fontWeight"),defaultValue:p,onChange:c});case"textAlign":return a==="desktop"&&m.jsx(dM,{label:o("properties.alignment"),defaultValue:p,onChange:c});case"textAlignMobile":return a!="desktop"&&m.jsx(dM,{label:o("properties.alignment"),defaultValue:p,onChange:c});case"padding":return a==="desktop"&&m.jsx(uM,{label:o("properties.padding"),defaultValue:p,onChange:c,sidesLinked:e.paddingSidesLinked,onSidesLinkedChange:f=>n({...e,paddingSidesLinked:f})});case"mobilePadding":return a!="desktop"&&m.jsx(uM,{label:o("properties.padding"),defaultValue:p,onChange:c,sidesLinked:e.mobilePaddingSidesLinked,onSidesLinkedChange:f=>n({...e,mobilePaddingSidesLinked:f})});case"fontSize":return a==="desktop"&&m.jsx(lM,{maxValue:80,step:8,label:o("properties.fontSize"),defaultValue:p??16,onChange:c});case"fontSizeMobile":return a!="desktop"&&m.jsx(lM,{maxValue:80,step:8,label:o("properties.fontSize"),defaultValue:p,onChange:c});case"lineHeight":return m.jsx(dpe,{label:o("properties.lineHeight"),defaultValue:p??1.5,onChange:c});case"shape":return m.jsx(ppe,{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"&&m.jsx(cM,{label:o("properties.height"),defaultValue:p,onChange:c});case"heightMobile":return a!="desktop"&&m.jsx(cM,{label:o("properties.height"),defaultValue:p,onChange:c});case"width":return a==="desktop"&&m.jsx(pM,{label:o("properties.width"),defaultValue:p,onChange:c});case"widthMobile":return a!="desktop"&&m.jsx(pM,{label:o("properties.width"),defaultValue:p,onChange:c});case"border":return a==="desktop"&&m.jsx(oM,{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"&&m.jsx(oM,{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 Rr({names:t,value:e,onChange:n,disabledCSSValidation:i=!1,shapeMaxValue:r,shapeSteps:a}){const s=Xo(),o=EU();return(i||s=="css"||Fb.includes(o||""))&&m.jsx(m.Fragment,{children:t.map(l=>m.jsx(fpe,{shapeMaxValue:r,shapeSteps:a,name:l,value:e||{},onChange:n},l))})}function mpe({data:t,setData:e}){const[,n]=A.useState(null),i=Wv(),{t:r}=Qe.useTranslation("inspector"),a=_=>{const b=MU.safeParse(_);b.success?(e(b.data),n(null)):n(b.error)},s=t.props?.text??Nl.text,o=t.props?.url??Nl.url,l=t.props?.fullWidth??Nl.fullWidth,c=t.props?.size??Nl.size,u=i,d=t.style?.buttonTextColor??t.props?.buttonTextColor??u?.textColor,p=t.style?.buttonBackgroundColor??t.props?.buttonBackgroundColor??Nl.buttonBackgroundColor,f=t.props?.fullWidthMobile,h=t.props?.sizeMobile,g=Xo();return m.jsxs(_s,{title:r("inputs.panels.button.title"),children:[g=="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsx(Rr,{disabledCSSValidation:!0,names:["fontFamily","fontSize","fontSizeMobile","fontWeight"],value:t.style,onChange:_=>a({...t,style:_})}),m.jsx(mp,{label:r("inputs.panels.button.textLabel"),defaultValue:s,onChange:_=>a({...t,props:{...t.props,text:_}})}),m.jsx(mp,{label:r("inputs.panels.button.targetLabel"),placeholder:r("inputs.panels.button.targetPlaceholder"),defaultValue:o,onChange:_=>a({...t,props:{...t.props,url:_}})}),m.jsx(Jde,{label:r("properties.width"),fullWidth:l,fullWidthMobile:f,onChange:_=>a({...t,props:{...t.props,..._}})}),m.jsx(Xde,{size:c,sizeMobile:h,sizePaddingSidesLinked:t.props?.sizePaddingSidesLinked,sizeMobilePaddingSidesLinked:t.props?.sizeMobilePaddingSidesLinked,onChange:_=>a({...t,props:{...t.props,..._}})})]}),m.jsx(Rr,{names:["shape","textAlign","textAlignMobile","backgroundColor","border","borderMobile","padding","mobilePadding"],value:t.style,shapeMaxValue:80,onChange:_=>a({...t,style:_})}),g==="css"&&m.jsxs(m.Fragment,{children:[m.jsx(Zc,{label:r("inputs.panels.button.textColor"),defaultValue:d,onChange:_=>a({...t,style:{...t.style,buttonTextColor:_}})}),m.jsx(Zc,{label:r("inputs.panels.button.buttonColor"),defaultValue:p,onChange:_=>a({...t,style:{...t.style,buttonBackgroundColor:_}})})]})]})}var Ff={},M1={};const hpe=Ko(ZZ);var fM;function Xv(){return fM||(fM=1,(function(t){"use client";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return e.createSvgIcon}});var e=hpe})(M1)),M1}var mM;function gpe(){if(mM)return Ff;mM=1;var t=jp();Object.defineProperty(Ff,"__esModule",{value:!0}),Ff.default=void 0;var e=t(Xv()),n=m;return Ff.default=(0,e.default)((0,n.jsx)("path",{d:"M18 4v5H6V4zm0-2H6c-1.1 0-2 .9-2 2v5c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m0 13v5H6v-5zm0-2H6c-1.1 0-2 .9-2 2v5c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-5c0-1.1-.9-2-2-2"}),"SplitscreenOutlined"),Ff}var _pe=gpe();const bpe=lc(_pe);var Bf={},hM;function ype(){if(hM)return Bf;hM=1;var t=jp();Object.defineProperty(Bf,"__esModule",{value:!0}),Bf.default=void 0;var e=t(Xv()),n=m;return Bf.default=(0,e.default)((0,n.jsx)("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 2v3H5V5zm0 5v4H5v-4zM5 19v-3h14v3z"}),"TableRowsOutlined"),Bf}var vpe=ype();const Epe=lc(vpe);var $f={},gM;function Spe(){if(gM)return $f;gM=1;var t=jp();Object.defineProperty($f,"__esModule",{value:!0}),$f.default=void 0;var e=t(Xv()),n=m;return $f.default=(0,e.default)((0,n.jsx)("path",{d:"M3 5v14h18V5zm5.33 12H5V7h3.33zm5.34 0h-3.33V7h3.33zM19 17h-3.33V7H19z"}),"ViewColumnOutlined"),$f}var Cpe=Spe();const Tpe=lc(Cpe);var Uf={},_M;function xpe(){if(_M)return Uf;_M=1;var t=jp();Object.defineProperty(Uf,"__esModule",{value:!0}),Uf.default=void 0;var e=t(Xv()),n=m;return Uf.default=(0,e.default)((0,n.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-2M8 18H4V6h4zm6 0h-4V6h4zm6 0h-4V6h4z"}),"ViewWeekOutlined"),Uf}var kpe=xpe();const wpe=lc(kpe),ry=vt({top:Pe(),bottom:Pe(),right:Pe(),left:Pe()}).optional().nullable(),ef=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},Dpe=IU([Pe().nullish(),Pe().nullish(),Pe().nullish()]).optional().nullable(),E8=vt({style:vt({background:nt().nullable().optional(),backgroundColor:nt().nullable().optional(),padding:ry,mobilePadding:ry}).passthrough().optional().nullable(),props:vt({fixedWidths:Dpe,columnsCount:Gd([Ok(2),Ok(3)]).optional().nullable(),layout:nt().optional().nullable(),contentAlignment:Wn(["top","middle","bottom"]).optional().nullable(),contentAlignmentMobile:Wn(["top","middle","bottom"]).optional().nullable(),stackColumnsOnMobile:Za().optional().nullable()}).optional().nullable()}).passthrough(),Ape={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},Mm={columnsCount:2,contentAlignment:"middle"};function $k({style:t,columns:e,props:n,blockId:i}){const r=_i(),a=bA(),s={padding:ef(r=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},o={columnsCount:n?.columnsCount??Mm.columnsCount,contentAlignment:r=="desktop"?n?.contentAlignment??Mm.contentAlignment:n?.contentAlignmentMobile??n?.contentAlignment??Mm.contentAlignment,fixedWidths:n?.fixedWidths,blockId:i},l=t?.background??"",c=t?.backgroundColor,u=c?Mu(l,c):l,d=jt(i),p=r==="mobile"&&!!n?.stackColumnsOnMobile,f=p?{display:"block",width:"100%"}:void 0;return m.jsxs(Jr,{background:u,backgroundColor:c,className:`${d}`,padding:s.padding,width:"100%",children:[a.uploading&&a.id===i?m.jsx("div",{style:Ape,children:m.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:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}):m.jsx(m.Fragment,{}),m.jsx("table",{border:0,cellSpacing:"0",cellPadding:"0",style:{width:"100%",...f},children:m.jsx("tbody",{style:{width:"100%",...f},children:m.jsxs("tr",{style:{width:"100%",...f},children:[m.jsx(P1,{index:0,props:o,columns:e,stackMobilePreview:p}),m.jsx(P1,{index:1,props:o,columns:e,stackMobilePreview:p}),m.jsx(P1,{index:2,props:o,columns:e,stackMobilePreview:p})]})})})]})}function P1({index:t,props:e,columns:n,stackMobilePreview:i}){const r=e?.contentAlignment??Mm.contentAlignment;if((e?.columnsCount??Mm.columnsCount)===2&&t===2)return null;const s=e.fixedWidths?.[t],o={boxSizing:"border-box",verticalAlign:r,width:s!=null?`${s}%`:void 0,...i?{display:"block",width:"100%"}:{}},l=(n&&n[t])??null,c=e.blockId?jt(e.blockId):"";return m.jsx("td",{className:`col${c}`,style:o,children:l})}const Npe=E8.shape.props.unwrap().unwrap().shape,NA=vt({style:E8.shape.style,props:vt({...Npe,columns:IU([vt({childrenIds:Hd(nt())}),vt({childrenIds:Hd(nt())}),vt({childrenIds:Hd(nt())})])}).optional().nullable(),blockId:nt().optional(),isNotClient:Za().optional()}).passthrough(),Rpe=(t,e,n)=>{if(!t||!document)return;const i=jt(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}})},Ipe=t=>{if(!t||!document)return;const e=jt(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},Ope={desktop:"contentAlignment",mobile:"contentAlignmentMobile"};function Mpe({data:t,updateData:e}){const{t:n}=Qe.useTranslation("inspector"),i=_i(),r=Ope[i]||"contentAlignment",a=t.props?.[r]??t.props?.contentAlignment,s=o=>{e({...t,props:{...t.props,[r]:o}})};return m.jsxs(Pu,{label:n("inputs.alignment.label"),defaultValue:a,onChange:s,children:[m.jsx(_n,{value:"top",children:m.jsx(Tde,{fontSize:"small"})}),m.jsx(_n,{value:"middle",children:m.jsx(Cde,{fontSize:"small"})}),m.jsx(_n,{value:"bottom",children:m.jsx(Sde,{fontSize:"small"})})]})}function bM({value:t,onChange:e,options:n}){return m.jsx(Qp,{exclusive:!0,value:t,size:"small",onChange:(i,r)=>{typeof r=="string"&&e(r)},sx:{display:"flex",width:"100%"},children:n.map(i=>m.jsx(_n,{value:i.value,children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[i.icon,m.jsx("span",{children:i.label})]})},i.value))})}const rd="layout-custom",L1=[{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]}],F1=[{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]}],El={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 yM(t){const e=t?.[0];return typeof e=="number"&&!Number.isNaN(e)?Math.min(99,Math.max(1,Math.round(e))):50}function B1(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 $1=({fractions:t,highlight:e})=>{const n=sn(),i=e?n.palette.secondary.main:"#e5e7eb";return m.jsx("div",{style:{...El.layoutPreview,gridTemplateColumns:t.map(r=>`${r}fr`).join(" ")},children:t.map((r,a)=>m.jsx("div",{style:{minWidth:0,backgroundColor:i,borderRadius:"4px",transition:"background-color 0.2s ease"}},a))})},Ppe=({defaultValue:t,fixedWidths:e,onChange:n,columns:i})=>{const{t:r}=Qe.useTranslation("inspector"),a=sn(),[s,o]=A.useState(null),[l,c]=A.useState(!1),[u,d]=A.useState(()=>yM(e??void 0)),[p,f]=A.useState(()=>B1(e??void 0)[0]),[h,g]=A.useState(()=>B1(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]=A.useState(i===2?L1:F1),S=(O,M)=>{o(null),c(!1),n({layout:O,fixedWidths:M})},C=()=>{if(o(rd),c(!0),i===2)d(yM(e??void 0));else{const[O,M]=B1(e??void 0);f(O),g(M)}},x=()=>{if(i===2){const O=u;n({layout:rd,fixedWidths:[O,100-O,null]})}else{const O=p,M=h;n({layout:rd,fixedWidths:[O,M,100-O-M]})}o(null)};A.useEffect(()=>{T(i===2?L1:F1)},[i]),A.useEffect(()=>{o(null),c(!1)},[i,t]),A.useEffect(()=>{const O=t;i===2?O!==rd&&(O==null||!L1.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!==rd&&(O==null||!F1.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($=>Math.max(1,Math.min($,100-P-1)))},w=(O,M)=>{const P=M,$=100-p-1;g(Math.max(1,Math.min(P,$)))},D=100-u,L=100-p-h,I=E===rd;return m.jsxs(Ni,{children:[m.jsx(In,{label:r("inputs.layout.label")}),m.jsxs("div",{style:El.grid,children:[v.map(O=>m.jsx("div",{onClick:()=>S(O.id,O.distribution),style:{...El.card,border:E===O.id?`2px solid ${a.palette.secondary.main}`:El.card.border},children:m.jsx("div",{style:El.cardContent,children:m.jsx($1,{fractions:O.distribution.filter(M=>M!=null),highlight:E===O.id})})},O.id)),m.jsx("div",{onClick:C,style:{...El.card,border:I?`2px solid ${a.palette.secondary.main}`:El.card.border},role:"button",tabIndex:0,onKeyDown:O=>{(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),C())},children:m.jsx("div",{style:El.cardContent,children:m.jsx(Se,{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:m.jsx(qU,{sx:{fontSize:18,color:"text.primary"}})})})})]}),m.jsx(GD,{in:l,timeout:"auto",unmountOnExit:!0,children:m.jsxs(Se,{sx:{mt:2,p:2,borderRadius:1,border:1,borderColor:"divider",bgcolor:"background.paper"},children:[i===2?m.jsxs(gn,{spacing:2,sx:{mt:1},children:[m.jsxs(mn,{variant:"body2",color:"text.secondary",children:[u,"% | ",D,"%"]}),m.jsx(eb,{value:u,min:1,max:99,step:1,valueLabelDisplay:"auto","aria-label":r("inputs.layout.custom.split2"),onChange:(O,M)=>d(M)}),m.jsx($1,{fractions:[u,D],highlight:!0})]}):m.jsxs(gn,{spacing:2,sx:{mt:1},children:[m.jsxs(mn,{variant:"body2",color:"text.secondary",children:[p,"% | ",h,"% | ",L,"%"]}),m.jsxs(Se,{children:[m.jsx(mn,{variant:"caption",color:"text.secondary",component:"div",children:r("inputs.layout.custom.firstColumn")}),m.jsx(eb,{value:p,min:1,max:98,step:1,valueLabelDisplay:"auto",onChange:k})]}),m.jsxs(Se,{children:[m.jsx(mn,{variant:"caption",color:"text.secondary",component:"div",children:r("inputs.layout.custom.secondColumn")}),m.jsx(eb,{value:h,min:1,max:100-p-1,step:1,valueLabelDisplay:"auto",onChange:w})]}),m.jsx($1,{fractions:[p,h,L],highlight:!0})]}),m.jsx(Vi,{variant:"contained",size:"small",sx:{mt:2},onClick:x,children:m.jsx(mn,{variant:"button",component:"span",sx:{color:"#FFFFFF",fontWeight:"bold"},children:r("inputs.layout.custom.apply")})})]})})]})};function Lpe({label:t,tooltipTitle:e,hideWarning:n}){return m.jsxs(Se,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[m.jsx(In,{label:t}),!n&&m.jsx(hn,{title:e,placement:"top",children:m.jsx(Rn,{size:"small",color:"warning",disableRipple:!0,sx:{p:0,cursor:"help",lineHeight:0,"&:hover":{backgroundColor:"transparent"}},children:m.jsx(y8,{"aria-hidden":!0})})})]})}function Fpe({data:t,setData:e}){const[,n]=A.useState(null),[i,r]=A.useState(t.props?.columnsCount??2),a=Xo(),s=_i(),{t:o}=Qe.useTranslation("inspector"),l=f=>{const h=ae.getState().document,g=f.filter(_=>h[_]?.type==="Image");s==="desktop"&&g.forEach(_=>{const b=h[_];if(b?.type!=="Image")return;const y=b.data;Rpe(_,E=>{Wb(_,v=>v.type!=="Image"?v:{...v,data:E})},y)})},c=f=>{const h=NA.safeParse(f);h.success?(h.data.props.columns.map(g=>l(g.childrenIds)),e(h.data),i&&h.data.props?.columnsCount!==i&&r(h.data.props?.columnsCount??2),n(null)):(console.error("Error on columns: ",h.error),n(h.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 h=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:[...t.props.columns];return f==="2"?{...u,columns:h}:{...d,columns:h}};return m.jsxs(_s,{title:o("inputs.panels.columns.title"),children:[a=="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsxs(Ni,{children:[m.jsx(In,{label:o("inputs.panels.columns.countLabel")}),m.jsx(Se,{sx:{...Bk,paddingLeft:0,paddingRight:0,height:"auto",minHeight:`${zl}px`},children:m.jsx(bM,{value:t.props?.columnsCount===2?"2":"3",onChange:f=>{const h=p(f);c({...t,props:{...t.props,...h}})},options:[{value:"2",label:"2",icon:m.jsx(bpe,{fontSize:"small"})},{value:"3",label:"3",icon:m.jsx(wpe,{fontSize:"small"})}]})})]}),m.jsx(Ppe,{columns:t.props?.columnsCount??3,defaultValue:t.props?.layout,fixedWidths:t.props?.fixedWidths??void 0,onChange:({layout:f,fixedWidths:h})=>{const g=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:t.props.columns;c({...t,props:{...t.props,layout:f,fixedWidths:h,columns:g}})}})]}),a=="css"&&m.jsxs(m.Fragment,{children:[m.jsxs(Ni,{children:[m.jsx(Lpe,{label:o("inputs.panels.columns.stackColumnsOnMobile"),tooltipTitle:o("inputs.panels.columns.stackColumnsOnMobileWarning")}),m.jsx(Se,{sx:{width:"100%",...Bk,paddingLeft:0,paddingRight:0,height:"auto",minHeight:`${zl}px`},children:m.jsx(bM,{value:t.props?.stackColumnsOnMobile?"stacked":"sideBySide",onChange:f=>{c({...t,props:{...t.props,stackColumnsOnMobile:f==="stacked"}})},options:[{value:"sideBySide",label:o("inputs.panels.columns.stackToggleSideBySide"),icon:m.jsx(Tpe,{fontSize:"small"})},{value:"stacked",label:o("inputs.panels.columns.stackToggleStacked"),icon:m.jsx(Epe,{fontSize:"small"})}]})})]}),m.jsx(Mpe,{data:t,updateData:e}),m.jsx(Rr,{names:["backgroundColor","background","padding","mobilePadding"],value:t.style,onChange:f=>c({...t,style:f})})]})]})}const vM=nt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),EM=vt({top:Pe(),bottom:Pe(),right:Pe(),left:Pe()}).optional().nullable(),Bpe=vt({topLeft:Pe().min(0).optional(),topRight:Pe().min(0).optional(),bottomLeft:Pe().min(0).optional(),bottomRight:Pe().min(0).optional()}),SM={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},$pe=vt({style:vt({backgroundColor:vM,background:nt().nullable().optional(),borderColor:vM,borderRadius:Pe().optional().nullable(),borderTop:Pe().optional().nullable(),borderBottom:Pe().optional().nullable(),borderLeft:Pe().optional().nullable(),borderRight:Pe().optional().nullable(),borderTopMobile:Pe().optional().nullable(),borderBottomMobile:Pe().optional().nullable(),borderLeftMobile:Pe().optional().nullable(),borderRightMobile:Pe().optional().nullable(),shape:Gd([Wn(["rectangle","pill"]),Bpe]).optional().nullable(),padding:EM,mobilePadding:EM}).passthrough().optional().nullable()}).passthrough();function S8({style:t,children:e,blockId:n}){const i=_i(),r=bA(),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:ef(i=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},s=t?.background??"",o=t?.backgroundColor,l=o?Mu(s,o):s,c=xA(t),u=jt(n);return e?m.jsx(Jr,{className:`${u}`,background:l,backgroundColor:t?.backgroundColor,borderRadius:c,padding:a.padding,width:"100%",border:a.border,children:m.jsxs(m.Fragment,{children:[r.uploading&&r.id===n&&m.jsx("div",{style:SM,children:m.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:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}),e]})}):m.jsx(Jr,{className:`${u}`,background:l,backgroundColor:o,borderRadius:c,padding:a.padding,width:"100%",border:a.border,children:m.jsx("div",{children:r.uploading&&r.id===n&&m.jsx("div",{style:SM,children:m.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:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})})})}const C8=vt({style:$pe.shape.style,props:vt({childrenIds:Hd(nt()).optional().nullable()}).optional().nullable(),blockId:nt().optional(),isNotClient:Za().optional()}).passthrough();function T8({data:t,setData:e}){const[,n]=A.useState(null),{t:i}=Qe.useTranslation("inspector"),r=a=>{const s=C8.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return m.jsx(_s,{title:i("inputs.panels.container.title"),children:m.jsx(Rr,{names:["backgroundColor","background","border","borderMobile","shape","padding","mobilePadding"],value:t.style,shapeSteps:30,onChange:a=>r({...t,style:a})})})}const Upe=nt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),CM=vt({top:Pe(),bottom:Pe(),right:Pe(),left:Pe()}).optional().nullable(),x8=vt({style:vt({background:nt().nullable().optional(),backgroundColor:Upe,padding:CM,mobilePadding:CM,height:Pe().optional().nullable(),heightMobile:Pe().optional().nullable(),color:nt().optional().nullable(),width:Pe().optional().nullable(),widthMobile:Pe().optional().nullable(),textAlign:nt().optional().nullable(),textAlignMobile:nt().optional().nullable()}).passthrough().optional().nullable()}).passthrough(),Dc={height:1,color:"#333333",width:100,textAlign:"left"};function k8({style:t,blockId:e}){const n=_i(),i=ef(n==="desktop"?t?.padding:t?.mobilePadding??t?.padding),r=n==="desktop"?t?.height??Dc.height:t?.heightMobile??t?.height??Dc.height,a=t?.color??Dc.color,s=n==="desktop"?(t?.width??Dc.width)+"%":(t?.widthMobile??t?.width??Dc.width)+"%",o=n==="desktop"?t?.textAlign??Dc.textAlign:t?.textAlignMobile??t?.textAlign??Dc.textAlign,l=t?.background??"",c=t?.backgroundColor??"",u=c?Mu(l,c):l,d=jt(e);return m.jsx(Jr,{className:`c${d}`,background:u,backgroundColor:c,width:"100%",padding:i,align:o,lineHeight:0,fontSize:0,children:m.jsx(Jr,{display:"inline-block",className:`${d}`,background:a,backgroundColor:c,width:s,padding:{top:r,bottom:0,left:0,right:0},isParent:!1,lineHeight:0,fontSize:0,children:m.jsx("div",{style:{margin:0,padding:0,height:0,overflow:"hidden",fontSize:0,lineHeight:0}})})})}function w8({data:t,setData:e}){const[,n]=A.useState(null),{t:i}=Qe.useTranslation("inspector"),r=a=>{const s=x8.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return m.jsx(_s,{title:i("inputs.panels.divider.title"),children:m.jsx(Rr,{names:["width","widthMobile","height","heightMobile","color","backgroundColor","textAlign","textAlignMobile","padding","mobilePadding"],value:t.style,onChange:a=>r({...t,style:a})})})}const zf=nt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),D8=vt({backdropColor:zf,borderColor:zf,borderRadius:Pe().optional().nullable(),canvasColor:zf,textColor:zf,fontFamily:Jp,childrenIds:Hd(nt()).optional().nullable(),linkGlobal:vt({linkColor:zf,underline:Za()}).optional().nullable(),showVersion:Za().optional().nullable()}),zpe=({label:t,linkColor:e,underline:n=!1,onChange:i})=>{const[r,a]=A.useState(e??"#FF0000"),[s,o]=A.useState(n),{t:l}=Qe.useTranslation("inspector"),c=t??l("inputs.links.color"),u=s?"enabled":"disabled",d={container:{width:"100%"}};A.useEffect(()=>{e!==r&&a(e??"#FF0000")},[e]),A.useEffect(()=>{n!==s&&o(n)},[n]);const p=h=>{const g=h??"#FF0000";a(g),i({linkColor:g,underline:s})},f=(h,g)=>{if(!g)return;const _=g==="enabled";o(_),i({linkColor:r,underline:_})};return m.jsxs(Ni,{children:[m.jsx(Zc,{label:c,defaultValue:r,onChange:p}),m.jsx(In,{label:l("inputs.links.underline")}),m.jsx(Se,{sx:d.container,children:m.jsxs(Qp,{value:u,exclusive:!0,fullWidth:!0,onChange:f,sx:{width:"100%"},children:[m.jsx(_n,{value:"enabled",children:m.jsx(hn,{title:l("inputs.links.underlineOn"),children:m.jsx(Se,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:m.jsx(e8,{fontSize:"small"})})})}),m.jsx(_n,{value:"disabled",children:m.jsx(hn,{title:l("inputs.links.underlineOff"),children:m.jsx(Se,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:m.jsx(JU,{fontSize:"small"})})})})]})})]})},Hpe="email-builder-online",Gpe="3.6.1",U1={name:Hpe,version:Gpe};function A8({data:t,setData:e}){const[,n]=A.useState(null),{t:i}=Qe.useTranslation("inspector"),r=zce(),a=s=>{const o=D8.safeParse(s);o.success?(e(o.data),n(null)):n(o.error)};return m.jsxs(_s,{title:i("inputs.panels.emailLayout.title"),children:[m.jsx(Zc,{label:i("inputs.panels.emailLayout.backgroundColor"),defaultValue:t.backdropColor??"#F5F5F5",onChange:s=>a({...t,backdropColor:s})}),m.jsx(Zc,{label:i("inputs.panels.emailLayout.canvasColor"),defaultValue:t.canvasColor??"#FFFFFF",onChange:s=>a({...t,canvasColor:s})}),m.jsx(v8,{label:i("inputs.panels.emailLayout.fontFamily"),defaultValue:t.fontFamily||Tue.FAMILY,onChange:s=>a({...t,fontFamily:s})}),m.jsx(Zc,{label:i("inputs.panels.emailLayout.textColor"),defaultValue:t.textColor??"#262626",onChange:s=>a({...t,textColor:s})}),m.jsx(zpe,{label:i("inputs.panels.emailLayout.linksLabel"),linkColor:t.linkGlobal?.linkColor||"#000000",underline:t.linkGlobal?.underline||!1,onChange:s=>a({...t,linkGlobal:s})}),r&&m.jsx(Se,{color:"text.secondary",sx:{display:"flex",justifyContent:"flex-end",mt:2},children:m.jsxs(Se,{sx:{textAlign:"right"},children:[m.jsxs(mn,{variant:"body2",children:[i("inputs.panels.emailLayout.version"),": ",U1.version]}),m.jsx(mae,{href:`https://www.npmjs.com/package/${U1.name}`,target:"_blank",rel:"noopener noreferrer",sx:{fontSize:"0.875rem",mt:.5,display:"inline-block"},children:U1.name})]})})]})}const TM=nt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),jpe=vt({top:Pe(),bottom:Pe(),right:Pe(),left:Pe()}).optional().nullable(),qpe=t=>t?`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`:void 0,N8=vt({props:vt({text:nt().optional().nullable(),level:Wn(["h1","h2","h3"]).optional().nullable()}).optional().nullable(),style:vt({color:TM,backgroundColor:TM,fontFamily:Jp,fontWeight:Wn(["bold","normal"]).optional().nullable(),textAlign:Wn(["left","center","right"]).optional().nullable(),padding:jpe}).passthrough().optional().nullable()}),ay={level:"h2",text:""};function R8({props:t,style:e}){const n=t?.level??ay.level,i=t?.text??ay.text,r={color:e?.color??void 0,backgroundColor:e?.backgroundColor??void 0,fontWeight:e?.fontWeight??"bold",textAlign:e?.textAlign??void 0,margin:0,fontFamily:Zl(e?.fontFamily),fontSize:Vpe(n),padding:qpe(e?.padding)};switch(n){case"h1":return m.jsx("h1",{style:r,children:i});case"h2":return m.jsx("h2",{style:r,children:i});case"h3":return m.jsx("h3",{style:r,children:i})}}function Vpe(t){switch(t){case"h1":return 32;case"h2":return 24;case"h3":return 20}}function Wpe({data:t,setData:e}){const[,n]=A.useState(null),{t:i}=Qe.useTranslation("inspector"),r=s=>{const o=N8.safeParse(s);o.success?(e(o.data),n(null)):n(o.error)},a=Xo();return m.jsxs(_s,{title:i("inputs.panels.heading.title"),children:[a=="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsx(mp,{label:i("inputs.panels.heading.contentLabel"),rows:3,defaultValue:t.props?.text??ay.text,onChange:s=>{r({...t,props:{...t.props,text:s}})}}),m.jsxs(Pu,{label:i("inputs.panels.heading.levelLabel"),defaultValue:t.props?.level??ay.level,onChange:s=>{r({...t,props:{...t.props,level:s}})},children:[m.jsx(_n,{value:"h1",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(cde,{fontSize:"small"}),m.jsx("span",{children:"H1"})]})}),m.jsx(_n,{value:"h2",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(ude,{fontSize:"small"}),m.jsx("span",{children:"H2"})]})}),m.jsx(_n,{value:"h3",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(lde,{fontSize:"small"}),m.jsx("span",{children:"H3"})]})})]})]}),m.jsx(Rr,{names:["color","backgroundColor","fontFamily","fontWeight","textAlign","padding","mobilePadding"],value:t.style,onChange:s=>r({...t,style:s})})]})}const xM=nt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),Ype=vt({top:Pe(),bottom:Pe(),right:Pe(),left:Pe()}).optional().nullable(),Kpe=t=>t?`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`:void 0,I8=vt({style:vt({color:xM,backgroundColor:xM,fontFamily:Jp,fontSize:Pe().min(0).optional().nullable(),textAlign:Wn(["left","right","center"]).optional().nullable(),padding:Ype}).passthrough().optional().nullable(),props:vt({contents:nt().optional().nullable()}).optional().nullable()});function O8({style:t,props:e}){const n=e?.contents,i={color:t?.color??void 0,backgroundColor:t?.backgroundColor??void 0,fontFamily:Zl(t?.fontFamily),fontSize:t?.fontSize??void 0,textAlign:t?.textAlign??void 0,padding:Kpe(t?.padding)};return n?m.jsx("div",{style:i,dangerouslySetInnerHTML:{__html:n}}):m.jsx("div",{style:i})}function Qpe({data:t,setData:e}){const[,n]=A.useState(null),{t:i}=Qe.useTranslation("inspector"),r=s=>{const o=I8.safeParse(s);o.success?(e(o.data),n(null)):n(o.error)},a=Xo();return m.jsxs(_s,{title:i("inputs.panels.html.title"),children:[a=="block-configuration"&&m.jsx(m.Fragment,{children:m.jsx(mp,{label:i("inputs.panels.html.contentLabel"),rows:5,defaultValue:t.props?.contents??"",onChange:s=>r({...t,props:{...t.props,contents:s}})})}),m.jsx(Rr,{names:["color","backgroundColor","fontFamily","fontSize","textAlign","padding","mobilePadding"],value:t.style,onChange:s=>r({...t,style:s})})]})}const Xpe=vt({topLeft:Pe().min(0).optional(),topRight:Pe().min(0).optional(),bottomLeft:Pe().min(0).optional(),bottomRight:Pe().min(0).optional()}),RA=vt({style:vt({padding:ry,mobilePadding:ry,background:nt().nullable().optional(),backgroundColor:nt().regex(/^#[0-9a-fA-F]{6}$/).optional().nullable(),textAlign:Wn(["center","left","right"]).optional().nullable(),textAlignMobile:Wn(["center","left","right"]).optional().nullable(),shape:Gd([Wn(["rectangle","pill"]),Xpe]).optional().nullable()}).passthrough(),props:vt({touched:Za().optional().nullable(),scale:Pe().optional().nullable(),size:nt().optional().nullable(),sizeMobile:nt().optional().nullable(),width:Pe().optional().nullable(),widthMobile:Pe().optional().nullable(),scaleMobile:Pe().optional().nullable(),touchedMobile:Za().optional().nullable(),original_width:Pe().optional().nullable(),height:Pe().optional().nullable(),url:nt().optional().nullable(),alt:nt().optional().nullable(),linkHref:nt().optional().nullable(),contentAlignment:Wn(["top","middle","bottom"]).optional().nullable()}).optional().nullable()}).passthrough();function M8({style:t,props:e,blockId:n,isNotClient:i=!1}){const r=_i(),a=bA(),o=!Vv()&&!i,l={padding:ef(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??"",h=t?.backgroundColor,g=h?Mu(f,h):f,_=E=>{const v=E.currentTarget;setTimeout(()=>{if(!e?.width&&v.offsetWidth){const T=v.offsetWidth;Vce(n,{...e,width:T})}},100)},b=m.jsxs(m.Fragment,{children:[m.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:xA(t)}}),a.uploading&&a.id===n&&m.jsx("div",{style:p,children:m.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:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})]}),y=jt(n);return u?m.jsx(Jr,{className:`${y}`,padding:l.padding,background:g,align:l.textAlign,width:"100%",children:m.jsx("a",{href:o?void 0:TA(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})}):m.jsx(Jr,{className:`${y}`,padding:l.padding,background:g,align:l.textAlign,width:"100%",children:b})}const Jpe=(t,e,n)=>{const i=_i();A.useEffect(()=>{const r=()=>{if(!t||!document||i=="mobile")return;const o=jt(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(`.${jt(t)}`);return s?.parentElement&&a.observe(s.parentElement),()=>{a.disconnect()}},[t,e,n,i])},Zpe=({data:t,setData:e,blockId:n})=>{const{t:i}=Qe.useTranslation("inspector"),[r,a]=A.useState(!1),[s,o]=A.useState(()=>!!window.__emailBuilderEnableAI),[,l]=A.useState(null),[c,u]=A.useState(""),[d,p]=A.useState(!1),[f,h]=A.useState(""),[g,_]=A.useState(!1),b=A.useRef(null),y=yA(),[E,v]=A.useState(null);A.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 $=RA.safeParse(P);$.success?(e($.data),l(null)):l($.error)},S=(P,$)=>{const U=P.toLowerCase(),G=U.includes(".svg")||U.includes("svg"),V=$&&($.includes("image/svg+xml")||$.includes("svg"));return G||!!V},C=async P=>{try{p(!0),h(""),_(!1);try{new URL(P)}catch{return h(i("inputs.image.invalidUrl")),!1}const $=new AbortController,U=setTimeout(()=>$.abort(),1e4);try{const G=await fetch(P,{method:"HEAD",signal:$.signal});if(clearTimeout(U),!G.ok)return h(i("inputs.image.httpError",{status:G.status,statusText:G.statusText})),!1;const V=G.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(Te=>V&&V.toLowerCase().includes(Te.toLowerCase()))?(S(P,V)&&_(!0),h(""),!0):(h(i("inputs.image.notImage")),!1)}catch(G){return clearTimeout(U),G.name==="AbortError"?(h(i("inputs.image.timeout")),!1):new Promise(V=>{const K=new Image,te=setTimeout(()=>{h(i("inputs.image.timeout")),V(!1)},1e4);K.onload=()=>{clearTimeout(te),S(P)&&_(!0),h(""),V(!0)},K.onerror=()=>{clearTimeout(te),h(i("inputs.image.loadError")),V(!1)},K.src=P})}}catch{return h(i("inputs.image.unexpectedError")),!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&&h(""),g&&_(!1)},D=P=>{const $=["image/png","image/jpeg","image/gif"],G=P.filter(K=>$.includes(K.type)&&K.size<=5242880);if(G.length!==P.length&&alert(i("inputs.common.invalidFiles")),G.length===0)return;const V=G.map(K=>new Promise(te=>{const Te=new FileReader;Te.onload=de=>te(de.target?.result),Te.readAsDataURL(K)}));Promise.all(V).then(K=>{const te={images:K,id:n||""};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:te})),zd(!0,n||"")})},L=P=>{P.preventDefault(),a(!0)},I=P=>{const $=P.currentTarget.getBoundingClientRect(),U=P.clientX,G=P.clientY;(U<$.left||U>=$.right||G<$.top||G>=$.bottom)&&a(!1)},O=P=>{P.preventDefault(),a(!1);const $=Array.from(P.dataTransfer.files);$.length>0&&D($)},M=()=>{const P=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(P)};return A.useEffect(()=>{const P=window.__emailBuilderEnableAI;P!==void 0&&o(!!P);const $=U=>{const{detail:G}=U;o(!!G)};return window.addEventListener("email-builder-ai-generation",$),()=>{window.removeEventListener("email-builder-ai-generation",$)}},[]),A.useEffect(()=>{const P=V=>{const{detail:K}=V;zd(!1,K.id||""),T({...t,props:{...t.props,url:K.url}}),xU(!1)},$=V=>{zd(V?.detail?.uploading??!1,V?.detail?.id??"")},U=()=>{b?.current?.click()},G=V=>{const{detail:K}=V;T({...t,props:{...t.props,url:K}})};return window.addEventListener("email-builder-set-image",G),window.addEventListener("email-builder-upload-image-receive",P),window.addEventListener("email-builder-upload-file",U),window.addEventListener("email-builder-toggle-upload-file",$),()=>{window.removeEventListener("email-builder-toggle-upload-file",$),window.removeEventListener("email-builder-upload-image-receive",P),window.removeEventListener("email-builder-set-image",G),window.removeEventListener("email-builder-upload-file",U)}},[t]),A.useEffect(()=>{t.props?.url&&_(S(t.props.url))},[t.props?.url]),m.jsxs(gn,{gap:1,children:[E?m.jsx(Se,{sx:{mb:2},children:E}):m.jsx("div",{style:{display:"flex",gap:8},children:y?m.jsxs(Ni,{children:[m.jsx(In,{label:i("inputs.image.urlLabel")}),m.jsxs(gn,{direction:"row",spacing:1,children:[m.jsx(Kp,{fullWidth:!0,placeholder:i("inputs.image.urlPlaceholder"),value:c,onChange:w,onKeyPress:k,error:!!f,disabled:d,sx:{...Qv,"& .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"}}}}),m.jsx(Vi,{variant:"contained",onClick:x,disabled:!c.trim()||d,sx:{minWidth:"auto",px:2,position:"relative"},children:d?m.jsx(Xl,{size:20,color:"inherit"}):i("inputs.common.add")})]}),f&&m.jsx(Ul,{severity:"error",sx:{mt:1,fontSize:"0.875rem","& .MuiAlert-message":{padding:"4px 0",display:"flex",flexDirection:"column",justifyContent:"space-around"}},children:f}),g&&m.jsx(Ul,{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:m.jsx(Rn,{"aria-label":i("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{_(!1)},children:m.jsx(Yv,{fontSize:"inherit"})}),children:i("inputs.common.svgWarning")}),m.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"}})]}):m.jsxs(m.Fragment,{children:[m.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"}}),m.jsxs(Se,{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:[m.jsx(Se,{sx:{display:"flex",justifyContent:"center",mb:2},children:m.jsx(l8,{sx:{fontSize:32,color:"primary"}})}),m.jsxs("label",{style:{cursor:"pointer"},children:[m.jsx("input",{ref:b,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:P=>{const $=P.target.files;$&&$.length>0&&D(Array.from($))}}),m.jsx(mn,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:i("inputs.common.uploadFile")}),m.jsxs(mn,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",i("inputs.common.dragAndDrop")]})]}),m.jsx(mn,{variant:"body2",sx:{color:"text.secondary",mt:1},children:i("inputs.common.fileInfo")})]})]})}),!E&&!y&&g&&m.jsx(Ul,{severity:"warning",sx:{fontSize:"0.875rem","& .MuiAlert-message":{padding:"4px 0",display:"flex",flexDirection:"column",justifyContent:"space-around"}},children:i("inputs.common.svgWarning")}),(!E&&(Vb()&&!y||s)||E&&s)&&m.jsxs(gn,{direction:"row",alignItems:"center",spacing:1,children:[m.jsx(dr,{sx:{flexGrow:1}}),m.jsx(mn,{sx:{color:"text.secondary"},children:i("inputs.backgroundImage.or")}),m.jsx(dr,{sx:{flexGrow:1}})]}),m.jsx(m.Fragment,{children:m.jsxs(gn,{flexDirection:"row",gap:2,children:[!E&&Vb()&&!y&&m.jsx(Vi,{variant:"outlined",onClick:M,startIcon:m.jsx(a8,{}),sx:{color:"mainColor.main",borderColor:"mainColor.light","&:hover":{borderColor:"mainColor.main",backgroundColor:"action.hover"}},style:{width:"100%"},children:i("inputs.backgroundImage.browseGallery")}),s&&m.jsx(b8,{src:t.props?.url,style:{width:"100%",margin:0}})]})})]})},efe=({defaultValue:t="original",scale:e=100,onChange:n})=>{const[i,r]=A.useState(t),[a,s]=A.useState(e),o=sn(),{t:l}=Qe.useTranslation("inspector"),c={container:{width:"100%"},label:{color:o.palette.text.primary},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}};A.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 m.jsxs(Ni,{children:[m.jsx(In,{label:l("inputs.sizeSelector.label")}),m.jsxs(Se,{sx:c.container,children:[m.jsxs(Qp,{value:i,exclusive:!0,onChange:u,sx:{width:"100%"},children:[m.jsx(_n,{value:"original",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(VU,{fontSize:"small"}),m.jsx("span",{children:l("inputs.sizeSelector.contain")})]})}),m.jsx(_n,{value:"fill",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(HU,{fontSize:"small"}),m.jsx("span",{children:l("inputs.sizeSelector.cover")})]})}),m.jsx(_n,{value:"scale",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(fde,{fontSize:"small"}),m.jsx("span",{children:l("inputs.sizeSelector.scale")})]})})]}),m.jsx(GD,{in:i==="scale",children:m.jsx(Se,{sx:c.sliderContainer,children:m.jsx(di,{iconLabel:m.jsx(wde,{}),value:a,setValue:d,marks:!1,units:"%",min:1,max:100})})})]})]})};function tfe({data:t,setData:e}){const[n,i]=A.useState(null),r=rg(),a=Xo(),s=_i(),{t:o}=Qe.useTranslation("inspector");Jpe(r||"",e,t),A.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=A.useCallback(g=>{const _=RA.safeParse(g);_.success?JSON.stringify(t)!==JSON.stringify(_.data)&&(e(_.data),i(null)):i(_.error)},[t,e]),c=A.useCallback((g,_,b)=>{const y=Ipe(r)||Od,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=A.useCallback((g,_)=>{const b=c(t,g,_);l({...t,props:b})},[t,l,c]),d=A.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=A.useCallback(g=>{l({...t,props:{...t.props,alt:g}})},[t,l]),f=A.useCallback(g=>{const _=g.trim().length===0?null:g.trim();l({...t,props:{...t.props,linkHref:_}})},[t,l]),h=A.useCallback(g=>{l({...t,style:g})},[t,l]);return m.jsxs(_s,{title:o("inputs.panels.image.title"),children:[a==="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsx(Zpe,{data:t,setData:e,blockId:r}),m.jsx(mp,{label:o("inputs.panels.image.altLabel"),placeholder:o("inputs.panels.image.altPlaceholder"),defaultValue:t.props?.alt??"",onChange:p}),m.jsx(mp,{label:o("inputs.panels.image.urlLabel"),placeholder:o("inputs.panels.image.urlPlaceholder"),defaultValue:t.props?.linkHref??"",onChange:f}),m.jsx(efe,{defaultValue:d.size,scale:d.scale??void 0,onChange:g=>u(g,s!=="desktop")})]}),m.jsx(Rr,{names:["textAlign","textAlignMobile","backgroundColor","shape","padding","mobilePadding"],value:t.style,shapeMaxValue:300,shapeSteps:20,onChange:h})]})}const kM=nt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),wM=vt({top:Pe(),bottom:Pe(),right:Pe(),left:Pe()}).optional().nullable(),P8=vt({style:vt({color:kM,backgroundColor:kM,background:nt().nullable().optional(),fontSize:Pe().gte(0).optional().nullable(),fontFamily:Jp,fontWeight:Wn(["bold","normal"]).optional().nullable(),textAlign:Wn(["left","center","right"]).optional().nullable(),textAlignMobile:Wn(["left","center","right"]).optional().nullable(),padding:wM,mobilePadding:wM,optionSize:Wn(["small","medium","large"]).optional().nullable(),theme:Wn(["light","dark","colored"]).optional().nullable()}).passthrough().optional().nullable(),gap:Pe().optional(),items:Hd(vt({id:nt(),key:nt(),label:nt(),iconName:nt(),theme:nt(),size:nt(),sizePx:nt(),url:nt(),href:nt().optional().nullable()})),gapMobile:Pe().optional()}).passthrough();function L8({style:t,items:e,blockId:n,gap:i=1,gapMobile:r,isNotClient:a=!1}){const s=_i(),o=t?.background??"",l=t?.backgroundColor,c=l?Mu(o,l):o,u=(s==="desktop"?t?.textAlign:t?.textAlignMobile??t?.textAlign)??void 0,d={background:c,backgroundColor:t?.backgroundColor,textAlign:u,padding:ef(s==="desktop"?t?.padding:t?.mobilePadding??t?.padding)},p=s==="desktop"?i:r??i,f=jt(n),g=!Vv()&&!a;return m.jsx(nfe,{blockId:`${f}`,items:e,wStyle:d,gap:p,guardLinksWhileEditingOnCanvas:g})}const nfe=({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 m.jsx(Jr,{className:e,background:n.background,backgroundColor:n.backgroundColor,padding:n?.padding,align:n.textAlign,width:"100%",children:m.jsx("table",{className:"sm-icons-table",style:{borderCollapse:"collapse",display:"inline-block",lineHeight:0,verticalAlign:"top"},border:0,cellSpacing:"0",cellPadding:"0",children:m.jsx("tbody",{children:m.jsx("tr",{style:{verticalAlign:"top"},children:t.map((s,o)=>{const l=a(o);return m.jsxs(A.Fragment,{children:[l!=="first"&&m.jsx("td",{className:`gap-${e}`,width:Math.ceil(i/2),style:{lineHeight:0,verticalAlign:"top"}}),m.jsx("td",{id:`${s.id}-${s.url}`,width:s.sizePx,style:{lineHeight:0,textAlign:"center",verticalAlign:"top",whiteSpace:"nowrap"},children:m.jsx("a",{target:"_blank",href:r?void 0:TA(s.href),onClick:r?c=>c.preventDefault():void 0,style:{display:"block",lineHeight:0,textDecoration:"none",pointerEvents:r?"none":void 0},children:m.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"&&m.jsx("td",{className:`gap-${e}`,width:Math.ceil(i/2),style:{lineHeight:0,verticalAlign:"top"}})]},s.id)})})})})})},ife="https://maildrill-dev.s3.us-east-2.amazonaws.com/icons/",rfe={positive:!0,original:!0,negative:!0},afe={small:!0,medium:!0,large:!0,xlarge:!0},W={theme:"positive",size:"medium"},rn=(t,e,n="medium")=>{const i=IA.find(a=>a.key===n)?.value,r=F8.find(a=>a.key===e)?.value;return`${ife}${t}_${r}_${i}.png`},En=t=>IA.find(e=>e.key===t)?.value||"36px",IA=[{value:"24px",key:"small",label:"Small"},{value:"36px",key:"medium",label:"Medium"},{value:"48px",key:"large",label:"Large"}],F8=[{value:"Positive",key:"positive",label:"Light"},{value:"Original",key:"original",label:"Color"},{value:"Negative",key:"negative",label:"Dark"}],nb=[{key:"facebook",label:"Facebook",iconName:"Facebook",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("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:En(W.size),url:rn("Web",W.theme,W.size),href:"https://www.google.com"},{key:"mail",label:"Mail",iconName:"Mail",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Mail",W.theme,W.size),href:"https://mail.google.com/"},{key:"apple",label:"Apple",iconName:"Apple",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Apple",W.theme,W.size),href:"https://www.apple.com/"},{key:"bluesky",label:"Bluesky",iconName:"Bluesky",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Bluesky",W.theme,W.size),href:"https://bsky.app/"},{key:"clubhouse",label:"ClubHouse",iconName:"Clubhouse",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Clubhouse",W.theme,W.size),href:"https://www.clubhouse.com/"},{key:"dribbble",label:"Dribbble",iconName:"Dribbble",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Dribbble",W.theme,W.size),href:"https://dribbble.com/"},{key:"figma",label:"Figma",iconName:"Figma",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Figma",W.theme,W.size),href:"https://www.figma.com/"},{key:"github",label:"Github",iconName:"Github",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Github",W.theme,W.size),href:"https://github.com/"},{key:"google",label:"Google",iconName:"Google",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Google",W.theme,W.size),href:"https://google.com/"},{key:"instagram",label:"Instagram",iconName:"Instagram",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("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:En(W.size),url:rn("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:En(W.size),url:rn("Medium",W.theme,W.size),href:"https://medium.com/"},{key:"messenger",label:"Messenger",iconName:"Messenger",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Messenger",W.theme,W.size),href:"https://www.messenger.com/"},{key:"pinterest",label:"Pinterest",iconName:"Pinterest",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Pinterest",W.theme,W.size),href:"https://www.pinterest.com/"},{key:"reddit",label:"Reddit",iconName:"Reddit",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Reddit",W.theme,W.size),href:"https://www.reddit.com/"},{key:"signal",label:"Signal",iconName:"Signal",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Signal",W.theme,W.size),href:"https://signal.org/"},{key:"snapchat",label:"Snapchat",iconName:"Snapchat",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Snapchat",W.theme,W.size),href:"https://www.snapchat.com/"},{key:"spotify",label:"Spotify",iconName:"Spotify",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Spotify",W.theme,W.size),href:"https://www.spotify.com/"},{key:"telegram",label:"Telegram",iconName:"Telegram",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Telegram",W.theme,W.size),href:"https://t.me/your-profile"},{key:"threads",label:"Threads",iconName:"Threads",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Threads",W.theme,W.size),href:"https://www.threads.net/"},{key:"tiktok",label:"TikTok",iconName:"TikTok",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("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:En(W.size),url:rn("Tumblr",W.theme,W.size),href:"https://www.tumblr.com/"},{key:"twitch",label:"Twitch",iconName:"Twitch",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Twitch",W.theme,W.size),href:"https://www.twitch.tv/"},{key:"vk",label:"VK",iconName:"VK",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("VK",W.theme,W.size),href:"https://vk.com/"},{key:"whatsapp",label:"WhatsApp",iconName:"WhatsApp",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("WhatsApp",W.theme,W.size),href:"https://www.whatsapp.com/"},{key:"x",label:"X",iconName:"X",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("X",W.theme,W.size),href:"https://x.com/your-profile"},{key:"youtube",label:"YouTube",iconName:"YouTube",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("YouTube",W.theme,W.size),href:"https://www.youtube.com/channel/your-channel-id"}];function sm(){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 sfe=({element:t,index:e,moveItem:n,onSelectChange:i,onUrlChange:r,onRemove:a,onDuplicate:s,canRemove:o,theme:l})=>{const c=A.useRef(null),[u,d]=A.useState(null),{t:p}=Qe.useTranslation("inspector"),f=k=>{const w=k.getClientOffset(),D=c.current?.getBoundingClientRect();if(!w||!D)return null;const L=(D.bottom-D.top)/2;return w.y-D.top<L?"up":"down"},[{handlerId:h,isOver:g},_]=Ql.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 D=k.index,L=e;if(D===L)return;const I=f(w);let O=L;I==="down"&&(O=L+1),D<O&&(O=O-1),setTimeout(()=>{n(D,O)},0),k.index=O},end:()=>{d(null)}}),[t.id,e,n]),[{isDragging:b},y]=Ql.useDrag(()=>({type:"social-media-item",item:()=>({id:t.id,index:e}),collect:k=>({isDragging:k.isDragging()}),end:()=>{d(null)}}),[t.id,e]);A.useEffect(()=>{g||d(null)},[g]);const E=b?.4:1;A.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=()=>m.jsxs("div",{style:{height:"3px",background:l.palette.secondary.main,position:"relative",color:l.palette.secondary.main,margin:"4px 0"},children:[m.jsx("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:m.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"})}),m.jsx("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:m.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 m.jsxs(m.Fragment,{children:[u==="up"&&m.jsx(x,{}),m.jsxs(gn,{ref:c,"data-handler-id":h,sx:{border:1,borderColor:"divider",padding:1,paddingTop:0,borderRadius:1,backgroundColor:"background.paper",marginBottom:1.5,opacity:E,cursor:b?"grabbing":"grab",boxShadow:b?l.shadows[3]:"none"},gap:1,children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:`1px solid ${l.palette.divider}`},children:[m.jsx("div",{style:{display:"flex",alignItems:"center"},children:m.jsx(jU,{sx:{color:b?"primary.main":"text.secondary",cursor:"grab",marginLeft:-.9,"&:hover":{color:"primary.main"}}})}),m.jsxs("div",{children:[m.jsx(hn,{title:"Duplicate",placement:"left",children:m.jsx(Rn,{color:"primary",size:"small",onClick:T,children:m.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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&&m.jsx(hn,{title:"Remove",placement:"left",children:m.jsx(Rn,{color:"error",size:"small",onClick:v,children:m.jsx(Vue,{sx:{fontSize:20}})})})]})]}),m.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"0.5rem"},children:[m.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[m.jsx(In,{label:p("inputs.social.icon")}),m.jsx(ec,{fullWidth:!0,labelId:"demo-simple-select-label",id:"demo-simple-select",value:t.key,size:"small",onChange:S,children:nb.map(k=>m.jsx(Xa,{value:k.key,children:k.label},`${t.id}_${k.key}`))})]}),m.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[m.jsx(In,{label:p("inputs.social.url")}),m.jsx(Kp,{size:"small",fullWidth:!0,value:t.href??"",onChange:C,variant:"outlined",placeholder:"https://your-website.com",sx:Qv})]})]})]}),u==="down"&&m.jsx(x,{})]})};function ofe({items:t=[],onChange:e}){const{t:n}=Qe.useTranslation("inspector"),i=sn(),[r,a]=A.useState(()=>t.map(_=>({..._,id:_.id||sm()}))),[s,o]=A.useState(t[0]?.theme||"positive"),[l,c]=A.useState(t[0]?.size||"medium");A.useEffect(()=>{t.length>0&&(o(t[0].theme),c(t[0].size),a(t.map(_=>({..._,id:_.id||sm()}))))},[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={...nb[0],theme:s,size:l,sizePx:En(l),url:rn(nb[0].iconName,s,l),id:sm()},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 rfe?(o(b),E=E.map(v=>{const T=rn(v.iconName,b,v.size);return{...v,theme:b,url:T}})):b in afe&&(c(b),E=E.map(v=>{const T=rn(v.iconName,v.theme,b),S=En(b);return{...v,size:b,sizePx:S,url:T}})),_!==null&&y){const v=nb.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=rn(C.iconName,y.theme,y.size);return S===_?{...T,...C,url:x,id:y.id}:T}))}a(E),e&&setTimeout(()=>e(E),0)},h=(_,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:sm()},E=[...b.slice(0,_+1),y,...b.slice(_+1)];return e&&setTimeout(()=>e(E),0),E})};return m.jsxs(m.Fragment,{children:[m.jsxs("div",{style:{marginBottom:"1rem",display:"grid",gridTemplateColumns:"repeat(2,1fr)",gap:"1rem"},children:[m.jsxs(Ni,{children:[m.jsx(In,{label:n("inputs.social.theme")}),m.jsx(ec,{fullWidth:!0,labelId:"theme-selector",id:"theme-selector",value:s,size:"small",onChange:_=>f(null,_.target.value,null),children:F8.map(_=>m.jsx(Xa,{value:_.key,children:_.label},`${_.key}`))})]}),m.jsxs(Ni,{children:[m.jsx(In,{label:n("inputs.social.size")}),m.jsx(ec,{fullWidth:!0,labelId:"size-selector",id:"size-selector",value:l,size:"small",onChange:_=>f(null,_.target.value,null),children:IA.map(_=>m.jsx(Xa,{value:_.key,children:_.label},`${_.key}`))})]})]}),r?.map((_,b)=>m.jsx(sfe,{element:_,index:b,moveItem:u,onSelectChange:f,onUrlChange:h,onRemove:p,onDuplicate:g,canRemove:r.length>1,theme:i},_.id)),m.jsx(Vi,{onClick:d,sx:{borderRadius:1},variant:"contained",endIcon:m.jsx(LU,{}),children:"Add"})]})}const lfe=({data:t,setData:e})=>{const[,n]=A.useState(null),i=_i(),{t:r}=Qe.useTranslation("inspector"),a=u=>{const d=P8.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=Xo();return m.jsxs(_s,{title:r("inputs.panels.social.title"),children:[c=="block-configuration"&&m.jsx(Se,{sx:{minWidth:120,margin:1},children:m.jsx(ofe,{items:t?.items??[],onChange:s})}),c=="css"&&m.jsxs(m.Fragment,{children:[m.jsxs(Ni,{children:[m.jsx(In,{label:r("inputs.panels.social.gap")}),i=="desktop"?m.jsx(di,{iconLabel:m.jsx(JO,{sx:{color:"text.primary"}}),value:Number(t?.gap??4),setValue:u=>l(u,!1),marks:!0,step:4,units:"px",min:0,max:40}):m.jsx(di,{iconLabel:m.jsx(JO,{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})]}),m.jsx(Rr,{names:["textAlign","textAlignMobile","backgroundColor","padding","mobilePadding"],value:t.style,onChange:u=>o(u)})]})]})},cfe=nt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),B8=vt({style:vt({height:Pe().optional().nullable(),heightMobile:Pe().optional().nullable(),background:nt().nullable().optional(),backgroundColor:cfe}).optional().nullable()}),DM={height:16};function $8({style:t,blockId:e}){const i=_i()==="desktop"?t?.height??DM.height:t?.heightMobile??t?.height??DM.height,r=t?.background??"",a=t?.backgroundColor??"",s=a?Mu(r,a):r,o={width:"100%",minWidth:"100%",backgroundColor:a||void 0,background:s||void 0},l=jt(e);return m.jsx("table",{className:l,width:"100%",style:o,children:m.jsx("tbody",{children:m.jsx("tr",{className:`it${l}`,style:{height:i},children:m.jsx("td",{})})})})}function U8({data:t,setData:e}){const[,n]=A.useState(null),{t:i}=Qe.useTranslation("inspector"),r=a=>{const s=B8.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return m.jsx(_s,{title:i("inputs.panels.spacer.title"),children:m.jsx(Rr,{names:["height","heightMobile","backgroundColor"],value:t.style,onChange:a=>r({...t,style:a})})})}function ufe({data:t,setData:e}){const n=Xo(),{t:i}=Qe.useTranslation("inspector"),r=t.style||{},a=s=>{const o={...r||{},...s||{}};e({...t,style:o})};return m.jsxs(_s,{title:i("inputs.panels.notionText.title","Text"),children:[n==="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{style:{display:"flex",gap:"8px"},children:[m.jsx("div",{style:{flex:1},children:m.jsx(Rr,{disabledCSSValidation:!0,names:["fontFamily"],value:r,onChange:a})}),m.jsx("div",{style:{flex:1},children:m.jsx(Rr,{disabledCSSValidation:!0,names:["lineHeight"],value:r,onChange:a})})]}),m.jsx(Rr,{disabledCSSValidation:!0,names:["fontSize","fontSizeMobile"],value:r,onChange:a})]}),n==="css"&&m.jsx(Rr,{names:["backgroundColor","border","borderMobile","padding","mobilePadding"],value:r,onChange:a})]})}function AM(t){return m.jsx(Se,{sx:{m:3,p:1,border:"1px dashed",borderColor:"divider"},children:m.jsx(mn,{color:"text.secondary",children:t})})}function dfe(){const t=rg(),e=SU(t||""),n=A.useCallback(a=>{t&&Wb(t,()=>a)},[t]);if(!t)return AM("Click on a block to inspect.");if(!e)return AM(`Block with id ${t} was not found. Click on a block to reset.`);const{data:i,type:r}=e;switch(r){case"Button":return m.jsx(mpe,{data:i,setData:a=>n({type:r,data:a})},t);case"ColumnsContainer":return m.jsx(Fpe,{data:i,setData:a=>n({type:r,data:a})},t);case"Container":return m.jsx(T8,{data:i,setData:a=>n({type:r,data:a})},t);case"Divider":return m.jsx(w8,{data:i,setData:a=>n({type:r,data:a})},t);case"Heading":return m.jsx(Wpe,{data:i,setData:a=>n({type:r,data:a})},t);case"Html":return m.jsx(Qpe,{data:i,setData:a=>n({type:r,data:a})},t);case"Image":return m.jsx(tfe,{data:i,setData:a=>n({type:r,data:a})},t);case"EmailLayout":return m.jsx(A8,{data:i,setData:a=>n({type:r,data:a})},t);case"Spacer":return m.jsx(U8,{data:i,setData:a=>n({type:r,data:a})},t);case"NotionText":return m.jsx(ufe,{data:i,setData:a=>n({type:r,data:a})},t);case"SocialMedia":return m.jsx(lfe,{data:i,setData:a=>n({type:r,data:a})},t);default:return m.jsx("pre",{children:JSON.stringify(e,null," ")})}}const pfe=A.memo(dfe),ffe={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"}},mfe=t=>e=>e.document[t];function hfe(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 z8(t,e,n){const i=hfe(t[e]);for(const r of i)if(r===n||z8(t,r,n))return!0;return!1}function gfe(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||z8(t,s,i))return!0;return!1}function _fe(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=ffe[l]??{label:l,iconName:"WidgetsOutlined"};if(l==="ColumnsContainer"){const p=o.data?.props?.columns,h=o.data?.props?.columnsCount===2?2:3,g=[];for(let _=0;_<h;_++){const b=p?.[_]?.childrenIds??[],y=Ale(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:h}})}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 bfe(t){return ae(t)}function yfe(t){return ae(mfe(t))}function vfe(){const t=rg(),e=yfe(t??"root"),n=A.useCallback(s=>{t&&Wb(t,()=>s)},[t]),i=A.useCallback(s=>{Wb("root",()=>s)},[]);if(!e)return null;const{data:r,type:a}=e;switch(a){case"Container":return m.jsx(T8,{data:r,setData:s=>n({type:a,data:s})},t);case"Divider":return m.jsx(w8,{data:r,setData:s=>n({type:a,data:s})},t);case"Spacer":return m.jsx(U8,{data:r,setData:s=>n({type:a,data:s})},t);case"EmailLayout":return m.jsx(A8,{data:r,setData:s=>i({type:a,data:s})},"root");default:return m.jsx("pre",{children:JSON.stringify(e,null," ")})}}function Efe({sticky:t,heightContent:e}){const n=Xo(),i=EU(),r=rg(),a=_i(),s=sn(),{t:o}=Qe.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 m.jsxs("div",{style:{position:"relative"},children:[m.jsx(Ob,{color:"primary",sx:f,label:`${o(a==="desktop"?"header.desktop":"header.mobile")}`}),m.jsx(pfe,{})]});case"styles":return m.jsxs("div",{style:{position:"relative"},children:[m.jsx(vfe,{}),m.jsx(Ob,{color:"primary",sx:f,label:`${o(a==="desktop"?"header.desktop":"header.mobile")}`})]})}},c=()=>m.jsx("svg",{style:{marginRight:"4px",color:"inherit"},width:"21",height:"20",viewBox:"0 0 21 20",fill:"none",children:m.jsx("path",{d:"M3.83398 5H17.1673M3.83398 10H17.1673M3.83398 15H9.66732",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),u=()=>m.jsx("svg",{style:{marginRight:"4px",color:"inherit"},width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:m.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"})});A.useEffect(()=>{const f=h=>{const g=h.target;RO(g.innerWidth)};return window&&RO(window.innerWidth),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[n]);const d=(f,h)=>{Dce(h)},p=t?e?`calc(${e} - ${pl})`:void 0:e??void 0;return m.jsxs(mh,{sx:f=>({width:Gb,padding:"0!important",margin:"0!important",height:p,maxHeight:p,display:"flex",flexDirection:"column",overflow:"hidden",position:t?"sticky":"static",top:t?pl:0,backgroundColor:`${f.palette.background.paper} !important`}),children:[m.jsx(Se,{sx:{position:"sticky",top:0,zIndex:1,backgroundColor:`${s.palette.background.paper} !important`},children:m.jsxs(tU,{sx:{backgroundColor:`${s.palette.background.paper} !important`},value:n,onChange:d,children:[r!=null&&!Fb.includes(i||"")&&[m.jsx(Gc,{sx:{height:pl,minHeight:pl,fontWeight:"bold"},value:"block-configuration",label:o("header.content"),icon:m.jsx(c,{}),iconPosition:"start"},"block-configuration"),m.jsx(Gc,{sx:{height:pl,minHeight:pl,fontWeight:"bold"},value:"css",label:o("header.styles"),icon:m.jsx(u,{}),iconPosition:"start"},"css")],Fb.includes(i)&&[m.jsx(Gc,{sx:{height:pl,minHeight:pl,fontWeight:"bold"},value:"styles",label:o("header.styles"),icon:m.jsx(u,{}),iconPosition:"start"},"styles")]]})}),m.jsx(mh,{sx:f=>({flex:"1 1 auto",minHeight:0,overflowY:"auto",px:2,backgroundColor:`${f.palette.background.paper} !important`}),children:l()})]})}const H8=({children:t,topOffset:e=0,zIndex:n=10,className:i="",style:r={},disabled:a=!1,threshold:s=null,...o})=>{const[l,c]=A.useState(!1),[u,d]=A.useState({width:0,height:0}),[p,f]=A.useState({left:0}),[h,g]=A.useState(0),[_,b]=A.useState(!1),y=A.useRef(null),E=A.useRef(null),v=A.useRef(null);A.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})},D=()=>{if(!k||!x)return{offset:0,isPushed:!1};const M=k.getBoundingClientRect(),P=x.getBoundingClientRect(),$=e+P.height;if(M.top<$){const U=$-M.top,G=P.height+20;return{offset:-Math.min(U,G),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:$,isPushed:U}=D();g($),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}=D();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+h}px`:"auto";return m.jsxs("div",{ref:v,className:i,...o,children:[!a&&m.jsx("div",{ref:E,style:{height:"1px",position:"absolute",top:`-${e+1}px`,left:0,right:0,pointerEvents:"none"}}),T&&m.jsx("div",{style:{height:`${u.height}px`,width:`${u.width}px`}}),m.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",..._&&h<-u.height*.3&&{opacity:Math.max(0,1+(h+u.height*.3)/(u.height*.7))},...r},children:t})]})};var G8=aU();function zi(t){this.content=t}zi.prototype={constructor:zi,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 zi(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 zi(n)},addToStart:function(t,e){return new zi([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new zi(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 zi(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=zi.from(t),t.size?new zi(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=zi.from(t),t.size?new zi(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=zi.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}};zi.from=function(t){if(t instanceof zi)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new zi(e)};function j8(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=j8(r.content,a.content,n+1);if(s!=null)return s}n+=r.nodeSize}}function q8(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=q8(s.content,o.content,n-1,i-1);if(c)return c}n-=l,i-=l}}class fe{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 fe(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 fe(i,r)}cutByIndex(e,n){return e==n?fe.empty:e==0&&n==this.content.length?this:new fe(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 fe(r,a)}addToStart(e){return new fe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new fe(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 j8(this,e,n)}findDiffEnd(e,n=this.size,i=e.size){return q8(this,e,n,i)}findIndex(e){if(e==0)return n_(0,e);if(e==this.size)return n_(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?n_(n+1,a):n_(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 fe.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new fe(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return fe.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 fe(n||e,i)}static from(e){if(!e)return fe.empty;if(e instanceof fe)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new fe([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}fe.empty=new fe([],0);const z1={index:0,offset:0};function n_(t,e){return z1.index=t,z1.offset=e,z1}function sy(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(!sy(t[i],e[i]))return!1}else{for(let i in t)if(!(i in e)||!sy(t[i],e[i]))return!1;for(let i in e)if(!(i in t))return!1}return!0}let Pn=class Uk{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&&sy(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 Uk.none;if(e instanceof Uk)return[e];let n=e.slice();return n.sort((i,r)=>i.type.rank-r.type.rank),n}};Pn.none=[];class oy extends Error{}class Be{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=W8(this.content,e+this.openStart,n);return i&&new Be(i,this.openStart,this.openEnd)}removeBetween(e,n){return new Be(V8(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 Be.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 Be(fe.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 Be(e,i,r)}}Be.empty=new Be(fe.empty,0,0);function V8(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(V8(a.content,e-r-1,n-r-1)))}function W8(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=W8(s.content,e-a-1,n,s);return o&&t.replaceChild(r,s.copy(o))}function Sfe(t,e,n){if(n.openStart>t.depth)throw new oy("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new oy("Inconsistent open depths");return Y8(t,e,n,0)}function Y8(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=Y8(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}=Cfe(n,t);return tu(a,Q8(t,s,o,e,i))}else return tu(a,ly(t,e,i))}function K8(t,e){if(!e.type.compatibleContent(t.type))throw new oy("Cannot join "+e.type.name+" onto "+t.type.name)}function zk(t,e,n){let i=t.node(n);return K8(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 Pm(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 Q8(t,e,n,i,r){let a=t.depth>r&&zk(t,e,r+1),s=i.depth>r&&zk(n,i,r+1),o=[];return Pm(null,t,r,o),a&&s&&e.index(r)==n.index(r)?(K8(a,s),eu(tu(a,Q8(t,e,n,i,r+1)),o)):(a&&eu(tu(a,ly(t,e,r+1)),o),Pm(e,n,r,o),s&&eu(tu(s,ly(n,i,r+1)),o)),Pm(i,null,r,o),new fe(o)}function ly(t,e,n){let i=[];if(Pm(null,t,n,i),t.depth>n){let r=zk(t,e,n+1);eu(tu(r,ly(t,e,n+1)),i)}return Pm(e,null,n,i),new fe(i)}function Cfe(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(fe.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class Eh{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 Pn.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 cy(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 Eh(n,i,a)}static resolveCached(e,n){let i=NM.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 NM.set(e,i=new Tfe);let r=i.elts[i.i]=Eh.resolve(e,n);return i.i=(i.i+1)%xfe,r}}class Tfe{constructor(){this.elts=[],this.i=0}}const xfe=12,NM=new WeakMap;class cy{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 kfe=Object.create(null);let Hl=class Hk{constructor(e,n,i,r=Pn.none){this.type=e,this.attrs=n,this.marks=r,this.content=i||fe.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&&sy(this.attrs,n||e.defaultAttrs||kfe)&&Pn.sameSet(this.marks,i||Pn.none)}copy(e=null){return e==this.content?this:new Hk(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Hk(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 Be.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 Be(c,r.depth-s,a.depth-s)}replace(e,n,i){return Sfe(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 Eh.resolveCached(this,e)}resolveNoCache(e){return Eh.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()+")"),X8(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=fe.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=Pn.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(!Pn.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=fe.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,r,i);return a.type.checkAttrs(a.attrs),a}};Hl.prototype.text=void 0;class uy extends Hl{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):X8(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 uy(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new uy(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 X8(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class bu{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let i=new wfe(e,n);if(i.next==null)return bu.empty;let r=J8(i);i.next&&i.err("Unexpected trailing text");let a=Mfe(Ofe(r));return Pfe(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 fe.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>"+Wr(i.message+"",!0)+"</pre>";return n?Promise.resolve(r):r}if(n)return Promise.reject(i);throw i}};const du=new uce;function kn(t,e){return du.parse(t,e)}kn.options=kn.setOptions=function(t){return du.setOptions(t),kn.defaults=du.defaults,uU(kn.defaults),kn};kn.getDefaults=lA;kn.defaults=Ru;kn.use=function(...t){return du.use(...t),kn.defaults=du.defaults,uU(kn.defaults),kn};kn.walkTokens=function(t,e){return du.walkTokens(t,e)};kn.parseInline=du.parseInline;kn.Parser=Fs;kn.parser=Fs.parse;kn.Renderer=Ub;kn.TextRenderer=mA;kn.Lexer=Ls;kn.lexer=Ls.lex;kn.Tokenizer=Bb;kn.Hooks=Rm;kn.parse=kn;kn.options;kn.setOptions;kn.use;kn.walkTokens;kn.parseInline;Fs.parse;Ls.lex;function dce(t){return String(t??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function pce(t){const e=String(t?.text??"");if(t?.markdown===!0){const n=kn.parse(e,{async:!1});return typeof n=="string"?n:String(n)}return`<p>${dce(e)}</p>`}function fce(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 Ud(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=pce(s);e[n]={...i,type:"NotionText",data:{...a,props:{html:o}}}}else r==="Avatar"&&(e[n]=fce(i))}return e}const ig=lU(()=>({past:[],future:[]}));function mce(){return ig(t=>t.past.length>0)}function hce(){return ig(t=>t.future.length>0)}function zb(){return ig.getState()}function Hb(t){ig.setState(t)}function gce(){ig.setState({past:[],future:[]})}const Gb=385,qv="https://ddc4vowthkjlv.cloudfront.net/uploads/gallery/1/69cc1b1083b90.jpg";let N1=null;const _ce=2e3;function Xp(){N1&&clearTimeout(N1),N1=setTimeout(()=>{const t=new CustomEvent("email-builder-auto-save",{detail:!0});window.dispatchEvent(t)},_ce)}const bce=()=>({document:Ud(JSON.parse(JSON.stringify(Dle))),selectedBlockId:null,selectedSidebarTab:"styles",selectedMainTab:"editor",selectedScreenSize:"desktop",windowWidth:0,inspectorDrawerOpen:!0,componentTreeOpen:!1,samplesDrawerOpen:!0,inspectorDrawerWidth:Gb,devMode:!1,imageUploading:{uploading:!1,id:""},disableEdition:!1,disableUpdate:!1,freeMode:!1,minHeight:"calc(100dvh - 65px)",color:{primary:"",secondary:""},galleryImages:!0,imagePlaceholder:qv,darkMode:!0,colorPicker:{paletteColors:wle,isLocked:!1},tour:!1,stickyHeader:!0,heightContent:"calc(100dvh - 50px)",containerGrow:!0,notionTextInlineEditingBlockId:null,canvasHoveredBlockId:null,highlightColor:"#FF6B35",showVersion:!1}),ae=lU(()=>bce());A.createContext(ae);function EU(){const t=ae(e=>e.document[ae(n=>n.selectedBlockId)||""]);return t?t.type:null}function RO(t){return ae.setState({windowWidth:t})}function yce(){return ae(t=>t.devMode)}function vce(t){return ae.setState({devMode:t})}function hA(){return ae(t=>t.document)}function SU(t){return ae(e=>e.document[t])}function Ece(t){return ae(e=>e.document[t]?.type)}function Sce(t){return ae(e=>e.selectedBlockId===t)}function rg(){return ae(t=>t.selectedBlockId)}function Cce(){return ae(t=>t.canvasHoveredBlockId)}function tb(t){ae.setState({canvasHoveredBlockId:t})}function ag(){return ae(t=>t.notionTextInlineEditingBlockId)}function Im(t){const e=ae.getState().notionTextInlineEditingBlockId;return e&&e!==t&&window.dispatchEvent(new CustomEvent("notion-text-force-save",{detail:{blockId:e}})),ae.setState({notionTextInlineEditingBlockId:t})}function CU(){return!!ag()}function Tce(){return ag()}function xce(){return ae(t=>t.highlightColor)}function _i(){return ae(t=>t.selectedScreenSize)}function gA(){return ae(t=>t.selectedMainTab)}function Xg(t){return t==="preview"&&ia(null),ae.setState({inspectorDrawerOpen:t==="editor"}),ae.setState({selectedMainTab:t})}function Xo(){return ae(t=>t.selectedSidebarTab)}function kce(){return ae(t=>t.inspectorDrawerOpen)}function _A(){return ae(t=>t.componentTreeOpen)}function Tk(){ae.setState(t=>({componentTreeOpen:!t.componentTreeOpen}))}function bA(){return ae(t=>t.imageUploading)}function Vv(){return ae(t=>t.disableEdition)}let jb=null,IO=0;const wce=400;let pu=!1,xk=!1;function Iu(t,e){if(pu||xk)return;const n=Date.now(),i=n-IO;if(e&&e===jb&&i<wce){zb().future.length>0&&Hb({future:[]});return}const a=JSON.stringify(t),{past:s}=zb();if(s.length>0&&s[s.length-1]===a)return;const o=[...s,a].slice(-50);Hb({past:o,future:[]}),jb=e??null,IO=n}function ia(t){const e=ae.getState().notionTextInlineEditingBlockId;e&&t!==null&&e!==t&&Im(null);const n=ae.getState().document[t||""]?.type,i=Fb.includes(n||null)?"styles":"block-configuration",r={};return t!==null&&ae.getState().selectedMainTab==="editor"&&(r.inspectorDrawerOpen=!0),ae.setState({selectedBlockId:t,selectedSidebarTab:i,...r})}function Dce(t){return ae.setState({selectedSidebarTab:t})}function Jg(t){const e=Ud(t);return gce(),ae.setState({document:e,selectedSidebarTab:"styles",selectedBlockId:null})}function TU(t){const e=ae.getState().document;xk=!0;let n;try{n=t()}finally{xk=!1}return Iu(e,null),n}function OO(){const{past:t,future:e}=zb();if(t.length!==0){pu=!0;try{const n=ae.getState().document,i=JSON.stringify(n),r=[...t],a=r.pop(),s=JSON.parse(a);Hb({past:r,future:[...e,i]});const o=ae.getState().selectedBlockId,l=o&&!s[o];ae.setState({document:s,...l?{selectedBlockId:null}:{}})}finally{pu=!1,jb=null}}}function MO(){const{past:t,future:e}=zb();if(e.length!==0){pu=!0;try{const n=ae.getState().document,i=JSON.stringify(n),r=[...e],a=r.pop(),s=JSON.parse(a);Hb({past:[...t,i],future:r});const o=ae.getState().selectedBlockId,l=o&&!s[o];ae.setState({document:s,...l?{selectedBlockId:null}:{}})}finally{pu=!1,jb=null}}}function fu(t,e=!0){const n=ae.getState().document,i={...n,...t};e&&Iu(n);const r=()=>{ae.setState({document:i}),Xp()};return e?(A.startTransition(r),ae.getState()):r()}function qb(t){return ae.setState({selectedScreenSize:t})}function zd(t,e){return ae.setState({imageUploading:{uploading:t,id:e||""}})}function xU(t){return ae.setState({disableEdition:t})}function Ace(){return ae.getState().document.root.data}function Wv(){return ae(t=>t.document?.root?.data)}function Nce(t){return ae.setState({color:t})}function Rce(t){return ae.setState({galleryImages:t})}function Vb(){return ae.getState().galleryImages}function Ice(t){return ae.setState({imagePlaceholder:t})}function Oce(){return ae.getState().imagePlaceholder}function Mce(t){return ae.setState({freeMode:t})}function yA(){return ae.getState().freeMode}function Pce(t){return ae.setState({darkMode:t})}function Lce(t){return ae.setState({stickyHeader:t})}function Fce(t){return ae.setState({heightContent:t})}function Bce(t){return ae.setState({containerGrow:t})}function $ce(){return ae.getState().containerGrow}function Uce(t){return ae.setState({showVersion:t})}function zce(){return ae(t=>t.showVersion)}function hh(t,e,n,i=!0){Ou({draggedId:e,targetId:t})&&console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");const r=ae.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 h=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:h}}})}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=cU(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 h=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:h}}}}break}}return fu(a)}function Hce({parentId:t,blockId:e,indexArray:n}){if(Ou({draggedId:e,targetId:t})){console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");return}return TU(()=>{hh("",e,"down",!1);const i=ae.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}}},fu(r)})}function Gce({parentId:t,blockId:e}){if(Ou({draggedId:e,targetId:t})){console.warn("No se puede mover un elemento dentro de uno de sus propios hijos");return}return TU(()=>{hh("",e,"down",!1);const n=ae.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]}}},fu(i)})}function Ou({draggedId:t,targetId:e}){if(t===e)return!0;const n=cU(e),i=n?n.parentBlockId:e;if(t===i)return!0;const r=ae.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 jce(){return ae(t=>t.colorPicker)}function R1(t){ae.setState(e=>({colorPicker:{...e.colorPicker,...t}}))}function kU(t,e){if(pu)return;const n=ae.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};Iu(n,t),A.startTransition(()=>{ae.setState({document:a})}),Xp()}function qce(t,e){if(pu)return;const n=ae.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};Iu(n,t),ae.setState({document:a}),Xp()}function Vce(t,e){kU(t,n=>{const i=typeof e=="function"?e(n.data.props):{...n.data.props,...e};return{...n,data:{...n.data,props:i}}})}function Zg(t,e){qce(t,n=>{const i=typeof e=="function"?e(n.data.props):{...n.data.props,...e};return{...n,data:{...n.data,props:i}}})}function gh(t,e,n,i){const r=ae.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};Iu(r),A.startTransition(()=>{ae.setState({document:o})}),Xp()}function Wce(t,e,n,i,r){const a=ae.getState().document,s=a[t];if(!s?.data?.props?.columns)return;const o=[...s.data.props.columns||[]],l=o[e];if(!l)return;o[e]={...l,childrenIds:r};const c={...s,data:{...s.data,props:{...s.data.props,columns:o}}},u={...a,[n]:i,[t]:c};Iu(a),A.startTransition(()=>{ae.setState({document:u})}),Xp()}function vA(){return`block-${Date.now()}-${Math.random().toString(36).substring(2,5)}`}function EA(t,e){const n=[];for(const i of e){const r={...t[i]},a=vA();if(t[a]={...r,data:{...r.data,props:{...r.data.props}}},r.type==="Container"||r.type==="ColumnsContainer"){const s=r.data.props?.childrenIds||[];if(t[a].data.props.childrenIds=EA(t,s),r.type==="ColumnsContainer"){const o=r.data.props?.columns||[];t[a].data.props.columns=wU(t,o)}}n.push(a)}return n}function wU(t,e){return e.map(n=>{const i={...n},r=n.childrenIds||[];return i.childrenIds=EA(t,r),i})}function Yce(t){const e=ae.getState().document,n=JSON.parse(JSON.stringify({...e})),i=vA(),r=n[t];if(n[i]=JSON.parse(JSON.stringify(r)),r.type==="Container"){const l=r.data.props?.childrenIds||[];l.length>0&&(n[i].data.props.childrenIds=EA(n,l))}else if(r.type==="ColumnsContainer"){const l=r.data.props?.columns||[];n[i].data.props.columns=wU(n,l)}const a=n.root,s=a?.type==="EmailLayout"?a.data.childrenIds??[]:[],o=s.findIndex(l=>l===t);if(a?.type==="EmailLayout"&&o>=0){const l=[...s];l.splice(o,0,i),a.data.childrenIds=l}else for(const[,l]of Object.entries(n)){if(l.type==="Container"){const c=l.data.props?.childrenIds,u=c?.findIndex(d=>d===t)??-1;if(u>=0&&c){const d=[...c];d.splice(u,0,i),l.data.props.childrenIds=d;break}}l.type==="ColumnsContainer"&&l.data.props?.columns?.forEach(c=>{const u=c.childrenIds.findIndex(d=>d===t);u>=0&&c.childrenIds.splice(u,0,i)})}fu(n),ia(i)}function Kce(t,e){const n=vA(),i=ae.getState().document,r=i.root,a=r?.type==="EmailLayout"?r.data.childrenIds??[]:[],s=a.indexOf(t);if(r?.type==="EmailLayout"&&s>=0){const o=[...a];return o.splice(s+1,0,n),gh("root",n,e,o),n}for(const[o,l]of Object.entries(i)){const c=l;if(c.type==="Container"){const u=c.data.props?.childrenIds??[],d=u.indexOf(t);if(d>=0){const p=[...u];return p.splice(d+1,0,n),gh(o,n,e,p),n}}if(c.type==="ColumnsContainer"){const u=c.data.props?.columns??[];for(let d=0;d<u.length;d++){const f=u[d].childrenIds??[],h=f.indexOf(t);if(h>=0){const g=[...f];return g.splice(h+1,0,n),Wce(o,d,n,e,g),n}}}}return null}function Qce(t){const e=ae.getState().document,n={...e,...t};Iu(e),A.startTransition(()=>{ae.setState({document:n})}),Xp()}function Wb(t,e){kU(t,e)}var en;(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})(en||(en={}));var PO;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(PO||(PO={}));const qe=en.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xl=t=>{switch(typeof t){case"undefined":return qe.undefined;case"string":return qe.string;case"number":return Number.isNaN(t)?qe.nan:qe.number;case"boolean":return qe.boolean;case"function":return qe.function;case"bigint":return qe.bigint;case"symbol":return qe.symbol;case"object":return Array.isArray(t)?qe.array:t===null?qe.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?qe.promise:typeof Map<"u"&&t instanceof Map?qe.map:typeof Set<"u"&&t instanceof Set?qe.set:typeof Date<"u"&&t instanceof Date?qe.date:qe.object;default:return qe.unknown}},Ce=en.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,en.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 kk=(t,e)=>{let n;switch(t.code){case Ce.invalid_type:t.received===qe.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case Ce.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,en.jsonStringifyReplacer)}`;break;case Ce.unrecognized_keys:n=`Unrecognized key(s) in object: ${en.joinValues(t.keys,", ")}`;break;case Ce.invalid_union:n="Invalid input";break;case Ce.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${en.joinValues(t.options)}`;break;case Ce.invalid_enum_value:n=`Invalid enum value. Expected ${en.joinValues(t.options)}, received '${t.received}'`;break;case Ce.invalid_arguments:n="Invalid function arguments";break;case Ce.invalid_return_type:n="Invalid function return type";break;case Ce.invalid_date:n="Invalid date";break;case Ce.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:en.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case Ce.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case Ce.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case Ce.custom:n="Invalid input";break;case Ce.invalid_intersection_types:n="Intersection results could not be merged";break;case Ce.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case Ce.not_finite:n="Number must be finite";break;default:n=e.defaultError,en.assertNever(t)}return{message:n}};let Xce=kk;function Jce(){return Xce}const Zce=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 Ue(t,e){const n=Jce(),i=Zce({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===kk?void 0:kk].filter(r=>!!r)});t.common.issues.push(i)}class yr{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 yr.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"}),am=t=>({status:"dirty",value:t}),ja=t=>({status:"valid",value:t}),LO=t=>t.status==="aborted",FO=t=>t.status==="dirty",pp=t=>t.status==="valid",Yb=t=>typeof Promise<"u"&&t instanceof Promise;var Ye;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Ye||(Ye={}));class Xs{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 BO=(t,e)=>{if(pp(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 qt{get description(){return this._def.description}_getType(e){return xl(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:xl(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new yr,ctx:{common:e.parent.common,data:e.data,parsedType:xl(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Yb(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:xl(e)},r=this._parseSync({data:e,path:i.path,parent:i});return BO(i,r)}"~validate"(e){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xl(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return pp(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=>pp(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:xl(e)},r=this._parse({data:e,path:i.path,parent:i}),a=await(Yb(r)?r:Promise.resolve(r));return BO(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:Ce.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 gu({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 _u.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return js.create(this)}promise(){return ey.create(this,this._def)}or(e){return Qb.create([this,e],this._def)}and(e){return Xb.create(this,e,this._def)}transform(e){return new gu({...Pt(this._def),schema:this,typeName:wt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new ty({...Pt(this._def),innerType:this,defaultValue:n,typeName:wt.ZodDefault})}brand(){return new RU({typeName:wt.ZodBranded,type:this,...Pt(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new ny({...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 iy.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const eue=/^c[^\s-]{8,}$/i,tue=/^[0-9a-z]+$/,nue=/^[0-9A-HJKMNP-TV-Z]{26}$/i,iue=/^[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,rue=/^[a-z0-9_-]{21}$/i,aue=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sue=/^[-+]?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)?)??$/,oue=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,lue="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let I1;const cue=/^(?:(?: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])$/,uue=/^(?:(?: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])$/,due=/^(([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]))$/,pue=/^(([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])$/,fue=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mue=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,DU="((\\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])))",hue=new RegExp(`^${DU}$`);function AU(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 gue(t){return new RegExp(`^${AU(t)}$`)}function _ue(t){let e=`${DU}T${AU(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 bue(t,e){return!!((e==="v4"||!e)&&cue.test(t)||(e==="v6"||!e)&&due.test(t))}function yue(t,e){if(!aue.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 vue(t,e){return!!((e==="v4"||!e)&&uue.test(t)||(e==="v6"||!e)&&pue.test(t))}class No extends qt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==qe.string){const a=this._getOrReturnCtx(e);return Ue(a,{code:Ce.invalid_type,expected:qe.string,received:a.parsedType}),kt}const i=new yr;let r;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),Ue(r,{code:Ce.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),Ue(r,{code:Ce.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?Ue(r,{code:Ce.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&Ue(r,{code:Ce.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),i.dirty())}else if(a.kind==="email")oue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"email",code:Ce.invalid_string,message:a.message}),i.dirty());else if(a.kind==="emoji")I1||(I1=new RegExp(lue,"u")),I1.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"emoji",code:Ce.invalid_string,message:a.message}),i.dirty());else if(a.kind==="uuid")iue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"uuid",code:Ce.invalid_string,message:a.message}),i.dirty());else if(a.kind==="nanoid")rue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"nanoid",code:Ce.invalid_string,message:a.message}),i.dirty());else if(a.kind==="cuid")eue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"cuid",code:Ce.invalid_string,message:a.message}),i.dirty());else if(a.kind==="cuid2")tue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"cuid2",code:Ce.invalid_string,message:a.message}),i.dirty());else if(a.kind==="ulid")nue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"ulid",code:Ce.invalid_string,message:a.message}),i.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),Ue(r,{validation:"url",code:Ce.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),Ue(r,{validation:"regex",code:Ce.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),Ue(r,{code:Ce.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),Ue(r,{code:Ce.invalid_string,validation:{startsWith:a.value},message:a.message}),i.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),Ue(r,{code:Ce.invalid_string,validation:{endsWith:a.value},message:a.message}),i.dirty()):a.kind==="datetime"?_ue(a).test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{code:Ce.invalid_string,validation:"datetime",message:a.message}),i.dirty()):a.kind==="date"?hue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{code:Ce.invalid_string,validation:"date",message:a.message}),i.dirty()):a.kind==="time"?gue(a).test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{code:Ce.invalid_string,validation:"time",message:a.message}),i.dirty()):a.kind==="duration"?sue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"duration",code:Ce.invalid_string,message:a.message}),i.dirty()):a.kind==="ip"?bue(e.data,a.version)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"ip",code:Ce.invalid_string,message:a.message}),i.dirty()):a.kind==="jwt"?yue(e.data,a.alg)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"jwt",code:Ce.invalid_string,message:a.message}),i.dirty()):a.kind==="cidr"?vue(e.data,a.version)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"cidr",code:Ce.invalid_string,message:a.message}),i.dirty()):a.kind==="base64"?fue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"base64",code:Ce.invalid_string,message:a.message}),i.dirty()):a.kind==="base64url"?mue.test(e.data)||(r=this._getOrReturnCtx(e,r),Ue(r,{validation:"base64url",code:Ce.invalid_string,message:a.message}),i.dirty()):en.assertNever(a);return{status:i.value,value:e.data}}_regex(e,n,i){return this.refinement(r=>e.test(r),{validation:n,code:Ce.invalid_string,...Ye.errToObj(i)})}_addCheck(e){return new No({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ye.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ye.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ye.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ye.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ye.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ye.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ye.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ye.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ye.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ye.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ye.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ye.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ye.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,...Ye.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,...Ye.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Ye.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Ye.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...Ye.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Ye.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Ye.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Ye.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Ye.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Ye.errToObj(n)})}nonempty(e){return this.min(1,Ye.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 Eue(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 fp extends qt{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)!==qe.number){const a=this._getOrReturnCtx(e);return Ue(a,{code:Ce.invalid_type,expected:qe.number,received:a.parsedType}),kt}let i;const r=new yr;for(const a of this._def.checks)a.kind==="int"?en.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),Ue(i,{code:Ce.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),Ue(i,{code:Ce.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),Ue(i,{code:Ce.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="multipleOf"?Eue(e.data,a.value)!==0&&(i=this._getOrReturnCtx(e,i),Ue(i,{code:Ce.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),Ue(i,{code:Ce.not_finite,message:a.message}),r.dirty()):en.assertNever(a);return{status:r.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Ye.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ye.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ye.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ye.toString(n))}setLimit(e,n,i,r){return new fp({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:Ye.toString(r)}]})}_addCheck(e){return new fp({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ye.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ye.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ye.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ye.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ye.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ye.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Ye.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ye.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ye.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"&&en.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)}}fp.create=t=>new fp({checks:[],typeName:wt.ZodNumber,coerce:t?.coerce||!1,...Pt(t)});class _h extends qt{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)!==qe.bigint)return this._getInvalidInput(e);let i;const r=new yr;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),Ue(i,{code:Ce.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),Ue(i,{code:Ce.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),Ue(i,{code:Ce.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):en.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return Ue(n,{code:Ce.invalid_type,expected:qe.bigint,received:n.parsedType}),kt}gte(e,n){return this.setLimit("min",e,!0,Ye.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Ye.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Ye.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Ye.toString(n))}setLimit(e,n,i,r){return new _h({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:Ye.toString(r)}]})}_addCheck(e){return new _h({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ye.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ye.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ye.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ye.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Ye.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}}_h.create=t=>new _h({checks:[],typeName:wt.ZodBigInt,coerce:t?.coerce??!1,...Pt(t)});class wk extends qt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==qe.boolean){const i=this._getOrReturnCtx(e);return Ue(i,{code:Ce.invalid_type,expected:qe.boolean,received:i.parsedType}),kt}return ja(e.data)}}wk.create=t=>new wk({typeName:wt.ZodBoolean,coerce:t?.coerce||!1,...Pt(t)});class Kb extends qt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==qe.date){const a=this._getOrReturnCtx(e);return Ue(a,{code:Ce.invalid_type,expected:qe.date,received:a.parsedType}),kt}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return Ue(a,{code:Ce.invalid_date}),kt}const i=new yr;let r;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),Ue(r,{code:Ce.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),Ue(r,{code:Ce.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),i.dirty()):en.assertNever(a);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Kb({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Ye.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Ye.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}}Kb.create=t=>new Kb({checks:[],coerce:t?.coerce||!1,typeName:wt.ZodDate,...Pt(t)});class $O extends qt{_parse(e){if(this._getType(e)!==qe.symbol){const i=this._getOrReturnCtx(e);return Ue(i,{code:Ce.invalid_type,expected:qe.symbol,received:i.parsedType}),kt}return ja(e.data)}}$O.create=t=>new $O({typeName:wt.ZodSymbol,...Pt(t)});class Dk extends qt{_parse(e){if(this._getType(e)!==qe.undefined){const i=this._getOrReturnCtx(e);return Ue(i,{code:Ce.invalid_type,expected:qe.undefined,received:i.parsedType}),kt}return ja(e.data)}}Dk.create=t=>new Dk({typeName:wt.ZodUndefined,...Pt(t)});class Ak extends qt{_parse(e){if(this._getType(e)!==qe.null){const i=this._getOrReturnCtx(e);return Ue(i,{code:Ce.invalid_type,expected:qe.null,received:i.parsedType}),kt}return ja(e.data)}}Ak.create=t=>new Ak({typeName:wt.ZodNull,...Pt(t)});class UO extends qt{constructor(){super(...arguments),this._any=!0}_parse(e){return ja(e.data)}}UO.create=t=>new UO({typeName:wt.ZodAny,...Pt(t)});class zO extends qt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ja(e.data)}}zO.create=t=>new zO({typeName:wt.ZodUnknown,...Pt(t)});class Jl extends qt{_parse(e){const n=this._getOrReturnCtx(e);return Ue(n,{code:Ce.invalid_type,expected:qe.never,received:n.parsedType}),kt}}Jl.create=t=>new Jl({typeName:wt.ZodNever,...Pt(t)});class HO extends qt{_parse(e){if(this._getType(e)!==qe.undefined){const i=this._getOrReturnCtx(e);return Ue(i,{code:Ce.invalid_type,expected:qe.void,received:i.parsedType}),kt}return ja(e.data)}}HO.create=t=>new HO({typeName:wt.ZodVoid,...Pt(t)});class js extends qt{_parse(e){const{ctx:n,status:i}=this._processInputParams(e),r=this._def;if(n.parsedType!==qe.array)return Ue(n,{code:Ce.invalid_type,expected:qe.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)&&(Ue(n,{code:s?Ce.too_big:Ce.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&&(Ue(n,{code:Ce.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(Ue(n,{code:Ce.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((s,o)=>r.type._parseAsync(new Xs(n,s,n.path,o)))).then(s=>yr.mergeArray(i,s));const a=[...n.data].map((s,o)=>r.type._parseSync(new Xs(n,s,n.path,o)));return yr.mergeArray(i,a)}get element(){return this._def.type}min(e,n){return new js({...this._def,minLength:{value:e,message:Ye.toString(n)}})}max(e,n){return new js({...this._def,maxLength:{value:e,message:Ye.toString(n)}})}length(e,n){return new js({...this._def,exactLength:{value:e,message:Ye.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 Ed(t){if(t instanceof yi){const e={};for(const n in t.shape){const i=t.shape[n];e[n]=Mo.create(Ed(i))}return new yi({...t._def,shape:()=>e})}else return t instanceof js?new js({...t._def,type:Ed(t.element)}):t instanceof Mo?Mo.create(Ed(t.unwrap())):t instanceof _u?_u.create(Ed(t.unwrap())):t instanceof mu?mu.create(t.items.map(e=>Ed(e))):t}class yi extends qt{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=en.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==qe.object){const c=this._getOrReturnCtx(e);return Ue(c,{code:Ce.invalid_type,expected:qe.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 Jl&&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 Xs(r,d,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof Jl){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&&(Ue(r,{code:Ce.unrecognized_keys,keys:o}),i.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of o){const d=r.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Xs(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=>yr.mergeObjectSync(i,c)):yr.mergeObjectSync(i,l)}get shape(){return this._def.shape()}strict(e){return Ye.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:Ye.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 en.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 en.objectKeys(this.shape))e[i]||(n[i]=this.shape[i]);return new yi({...this._def,shape:()=>n})}deepPartial(){return Ed(this)}partial(e){const n={};for(const i of en.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 en.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 NU(en.objectKeys(this.shape))}}yi.create=(t,e)=>new yi({shape:()=>t,unknownKeys:"strip",catchall:Jl.create(),typeName:wt.ZodObject,...Pt(e)});yi.strictCreate=(t,e)=>new yi({shape:()=>t,unknownKeys:"strict",catchall:Jl.create(),typeName:wt.ZodObject,...Pt(e)});yi.lazycreate=(t,e)=>new yi({shape:t,unknownKeys:"strip",catchall:Jl.create(),typeName:wt.ZodObject,...Pt(e)});class Qb extends qt{_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 Ue(n,{code:Ce.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 Ue(n,{code:Ce.invalid_union,unionErrors:o}),kt}}get options(){return this._def.options}}Qb.create=(t,e)=>new Qb({options:t,typeName:wt.ZodUnion,...Pt(e)});const So=t=>t instanceof Rk?So(t.schema):t instanceof gu?So(t.innerType()):t instanceof Zb?[t.value]:t instanceof hu?t.options:t instanceof Ik?en.objectValues(t.enum):t instanceof ty?So(t._def.innerType):t instanceof Dk?[void 0]:t instanceof Ak?[null]:t instanceof Mo?[void 0,...So(t.unwrap())]:t instanceof _u?[null,...So(t.unwrap())]:t instanceof RU||t instanceof iy?So(t.unwrap()):t instanceof ny?So(t._def.innerType):[];class SA extends qt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==qe.object)return Ue(n,{code:Ce.invalid_type,expected:qe.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}):(Ue(n,{code:Ce.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 SA({typeName:wt.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:r,...Pt(i)})}}function Nk(t,e){const n=xl(t),i=xl(e);if(t===e)return{valid:!0,data:t};if(n===qe.object&&i===qe.object){const r=en.objectKeys(e),a=en.objectKeys(t).filter(o=>r.indexOf(o)!==-1),s={...t,...e};for(const o of a){const l=Nk(t[o],e[o]);if(!l.valid)return{valid:!1};s[o]=l.data}return{valid:!0,data:s}}else if(n===qe.array&&i===qe.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=Nk(s,o);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return n===qe.date&&i===qe.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Xb extends qt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e),r=(a,s)=>{if(LO(a)||LO(s))return kt;const o=Nk(a.value,s.value);return o.valid?((FO(a)||FO(s))&&n.dirty(),{status:n.value,value:o.data}):(Ue(i,{code:Ce.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}))}}Xb.create=(t,e,n)=>new Xb({left:t,right:e,typeName:wt.ZodIntersection,...Pt(n)});class mu extends qt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==qe.array)return Ue(i,{code:Ce.invalid_type,expected:qe.array,received:i.parsedType}),kt;if(i.data.length<this._def.items.length)return Ue(i,{code:Ce.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),kt;!this._def.rest&&i.data.length>this._def.items.length&&(Ue(i,{code:Ce.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 Xs(i,s,i.path,o)):null}).filter(s=>!!s);return i.common.async?Promise.all(a).then(s=>yr.mergeArray(n,s)):yr.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new mu({...this._def,rest:e})}}mu.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mu({items:t,typeName:wt.ZodTuple,rest:null,...Pt(e)})};class Jb extends qt{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!==qe.object)return Ue(i,{code:Ce.invalid_type,expected:qe.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 Xs(i,o,i.path,o)),value:s._parse(new Xs(i,i.data[o],i.path,o)),alwaysSet:o in i.data});return i.common.async?yr.mergeObjectAsync(n,r):yr.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(e,n,i){return n instanceof qt?new Jb({keyType:e,valueType:n,typeName:wt.ZodRecord,...Pt(i)}):new Jb({keyType:No.create(),valueType:e,typeName:wt.ZodRecord,...Pt(n)})}}class GO extends qt{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!==qe.map)return Ue(i,{code:Ce.invalid_type,expected:qe.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 Xs(i,o,i.path,[c,"key"])),value:a._parse(new Xs(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}}}}GO.create=(t,e,n)=>new GO({valueType:e,keyType:t,typeName:wt.ZodMap,...Pt(n)});class bh extends qt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==qe.set)return Ue(i,{code:Ce.invalid_type,expected:qe.set,received:i.parsedType}),kt;const r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(Ue(i,{code:Ce.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(Ue(i,{code:Ce.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 Xs(i,l,i.path,c)));return i.common.async?Promise.all(o).then(l=>s(l)):s(o)}min(e,n){return new bh({...this._def,minSize:{value:e,message:Ye.toString(n)}})}max(e,n){return new bh({...this._def,maxSize:{value:e,message:Ye.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}bh.create=(t,e)=>new bh({valueType:t,minSize:null,maxSize:null,typeName:wt.ZodSet,...Pt(e)});class Rk extends qt{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})}}Rk.create=(t,e)=>new Rk({getter:t,typeName:wt.ZodLazy,...Pt(e)});class Zb extends qt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return Ue(n,{received:n.data,code:Ce.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 NU(t,e){return new hu({values:t,typeName:wt.ZodEnum,...Pt(e)})}class hu extends qt{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),i=this._def.values;return Ue(n,{expected:en.joinValues(i),received:n.parsedType,code:Ce.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 Ue(n,{received:n.data,code:Ce.invalid_enum_value,options:i}),kt}return ja(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 hu.create(e,{...this._def,...n})}exclude(e,n=this._def){return hu.create(this.options.filter(i=>!e.includes(i)),{...this._def,...n})}}hu.create=NU;class Ik extends qt{_parse(e){const n=en.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==qe.string&&i.parsedType!==qe.number){const r=en.objectValues(n);return Ue(i,{expected:en.joinValues(r),received:i.parsedType,code:Ce.invalid_type}),kt}if(this._cache||(this._cache=new Set(en.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=en.objectValues(n);return Ue(i,{received:i.data,code:Ce.invalid_enum_value,options:r}),kt}return ja(e.data)}get enum(){return this._def.values}}Ik.create=(t,e)=>new Ik({values:t,typeName:wt.ZodNativeEnum,...Pt(e)});class ey extends qt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==qe.promise&&n.common.async===!1)return Ue(n,{code:Ce.invalid_type,expected:qe.promise,received:n.parsedType}),kt;const i=n.parsedType===qe.promise?n.data:Promise.resolve(n.data);return ja(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}}ey.create=(t,e)=>new ey({type:t,typeName:wt.ZodPromise,...Pt(e)});class gu extends qt{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=>{Ue(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"?am(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"?am(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(!pp(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=>pp(s)?Promise.resolve(r.transform(s.value,a)).then(o=>({status:n.value,value:o})):kt);en.assertNever(r)}}gu.create=(t,e,n)=>new gu({schema:t,typeName:wt.ZodEffects,effect:e,...Pt(n)});gu.createWithPreprocess=(t,e,n)=>new gu({schema:e,effect:{type:"preprocess",transform:t},typeName:wt.ZodEffects,...Pt(n)});class Mo extends qt{_parse(e){return this._getType(e)===qe.undefined?ja(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 _u extends qt{_parse(e){return this._getType(e)===qe.null?ja(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}_u.create=(t,e)=>new _u({innerType:t,typeName:wt.ZodNullable,...Pt(e)});class ty extends qt{_parse(e){const{ctx:n}=this._processInputParams(e);let i=n.data;return n.parsedType===qe.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}ty.create=(t,e)=>new ty({innerType:t,typeName:wt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Pt(e)});class ny extends qt{_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 Yb(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}}ny.create=(t,e)=>new ny({innerType:t,typeName:wt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Pt(e)});class jO extends qt{_parse(e){if(this._getType(e)!==qe.nan){const i=this._getOrReturnCtx(e);return Ue(i,{code:Ce.invalid_type,expected:qe.nan,received:i.parsedType}),kt}return{status:"valid",value:e.data}}}jO.create=t=>new jO({typeName:wt.ZodNaN,...Pt(t)});class RU extends qt{_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 qt{_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(),am(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 iy extends qt{_parse(e){const n=this._def.innerType._parse(e),i=r=>(pp(r)&&(r.value=Object.freeze(r.value)),r);return Yb(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}}iy.create=(t,e)=>new iy({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 nt=No.create,Pe=fp.create,Za=wk.create;Jl.create;const Hd=js.create,vt=yi.create,Gd=Qb.create,Sue=SA.create;Xb.create;const IU=mu.create,Cue=Jb.create,Ok=Zb.create,Wn=hu.create;ey.create;Mo.create;_u.create;function e_(t,e){return!t||t&&t[e]===0?"initial":t[e]!==void 0?`${t[e]}px solid ${t?.color??"black"}`:"initial"}function Jr({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",display:d,lineHeight:p,fontSize:f}){const h=t?`a${t}`:"",g={width:r,minWidth:r,...f!==void 0?{fontSize:f}:{},...p!==void 0?{lineHeight:p}:{},...d!==void 0?{display:d}:{},borderRadius:l??"initial",borderTop:e_(o,"top"),borderBottom:e_(o,"bottom"),borderLeft:e_(o,"left"),borderRight:e_(o,"right"),overflow:u,borderCollapse:"initial"};e&&String(e).trim()!==""?g.background=e:n&&(g.backgroundColor=n);const _=Math.max(0,Number(i.left)||0),b=Math.max(0,Number(i.right)||0),y={width:`${_}px`},E={width:`${b}px`},v=f!==void 0||p!==void 0?{...f!==void 0?{fontSize:f}:{},...p!==void 0?{lineHeight:p}:{}}:void 0;return m.jsx("table",{className:t,width:r,border:0,cellSpacing:"0",cellPadding:"0",style:{...g,tableLayout:"fixed"},children:m.jsxs("tbody",{children:[m.jsxs("tr",{style:{height:`${i.top}px`},className:c?`t${t}`:`it${t}`,children:[m.jsx("td",{style:y,className:c?`l${t}`:`il${t}`}),m.jsx("td",{style:{width:"100%"}}),m.jsx("td",{style:E,className:c?`r${t}`:`ir${t}`})]}),m.jsxs("tr",{children:[m.jsx("td",{style:y,className:c?`l${t}`:`il${t}`}),m.jsx("td",{className:h,align:a,style:{width:"100%",...v},children:s}),m.jsx("td",{style:E,className:c?`r${t}`:`ir${t}`})]}),m.jsxs("tr",{style:{height:`${i.bottom}px`},className:c?`b${t}`:`ib${t}`,children:[m.jsx("td",{style:y,className:c?`l${t}`:`il${t}`}),m.jsx("td",{style:{width:"100%"}}),m.jsx("td",{style:E,className:c?`r${t}`:`ir${t}`})]})]})})}const TA=t=>t?["http","mailto:","tel:","sms:","whatsapp:"].some(n=>t.startsWith(n))?t:`//${t}`:"#",OU=[{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'}],Tue={FAMILY:"MODERN_SANS"},Jp=Wn(["MODERN_SANS","LATO","MERRIWEATHER","MONTSERRAT","OPEN_SANS","OSWALD","PACIFICO","PLAYFAIR","ROBOTO","INHERIT"]).nullable().optional(),qO=t=>OU.find(e=>e.key===t)?.value;function Zl(t){const e=Ace();let n=qO(t);return n||(n=qO(e?.fontFamily),n||"inherit")}const Mu=(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 xA(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 xue(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=(e>>>0)*16777619;return e>>>0}function kue(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 jt(t){const e=xue(t);return`b${kue(e)}`}const Lf=nt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),VO=vt({top:Pe(),bottom:Pe(),right:Pe(),left:Pe()}).optional().nullable(),wue=t=>({top:t?.top??0,right:t?.right??0,bottom:t?.bottom??0,left:t?.left??0}),Due=vt({topLeft:Pe().min(0).optional(),topRight:Pe().min(0).optional(),bottomLeft:Pe().min(0).optional(),bottomRight:Pe().min(0).optional()}),WO=vt({top:Pe().min(0).optional(),bottom:Pe().min(0).optional(),left:Pe().min(0).optional(),right:Pe().min(0).optional()}),MU=vt({style:vt({backgroundColor:Lf,fontSize:Pe().min(0).optional().nullable(),fontSizeMobile:Pe().min(0).optional().nullable(),fontFamily:Jp,background:nt().nullable().optional(),buttonBackgroundColor:Lf,buttonTextColor:Lf,fontWeight:Wn(["bold","normal"]).optional().nullable(),textAlign:Wn(["left","center","right"]).optional().nullable(),textAlignMobile:Wn(["left","center","right"]).optional().nullable(),padding:VO,mobilePadding:VO,shape:Gd([Wn(["rectangle","pill"]),Due]).optional().nullable()}).passthrough().optional().nullable(),props:vt({buttonBackgroundColor:Lf,buttonTextColor:Lf,fullWidth:Za().optional().nullable(),fullWidthMobile:Za().optional().nullable(),size:Gd([Wn(["x-small","small","medium"]),WO]).optional().nullable(),sizeMobile:Gd([Wn(["x-small","small","medium"]),WO]).optional().nullable(),sizePaddingSidesLinked:Za().optional(),sizeMobilePaddingSidesLinked:Za().optional(),text:nt().optional().nullable(),url:nt().optional().nullable()}).optional().nullable()}).passthrough();function YO(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 Nl={text:"",url:"",fullWidth:!1,size:"medium",buttonBackgroundColor:"#999999"};function PU({style:t,props:e,blockId:n,isNotClient:i=!1}){const r=Wv(),a=_i(),o=!Vv()&&!i,l=e?.text??Nl.text,c=e?.url??Nl.url,u=a==="desktop"?e?.fullWidth??!1:e?.fullWidthMobile??e?.fullWidth??!1,d=t?.buttonTextColor??e?.buttonTextColor??r.textColor,p=t?.buttonBackgroundColor??e?.buttonBackgroundColor??Nl.buttonBackgroundColor,f={backgroundColor:t?.backgroundColor??void 0,textAlign:a=="desktop"?t?.textAlign??void 0:t?.textAlignMobile??t?.textAlign,padding:wue(a=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},h={color:d,fontSize:a=="desktop"?t?.fontSize??16:t?.fontSizeMobile??t?.fontSize??16,fontFamily:Zl(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?Mu(_,b):_,E=xA(t),v=jt(n);return m.jsx(Jr,{background:y,backgroundColor:b,padding:f.padding,align:f.textAlign,width:"100%",className:`c${v}`,children:m.jsx("a",{href:TA(c),target:"_blank",className:`abtn-${v}`,onClick:o?T=>T.preventDefault():void 0,children:m.jsx(Jr,{className:v,padding:a=="desktop"?YO(e?.size):YO(e?.sizeMobile??e?.size),borderRadius:E,background:p,backgroundColor:p,isParent:!1,align:"center",width:u?"100%":void 0,display:u?"block":"inline-block",border:g,children:m.jsx("span",{className:`btn${v}`,style:h,children:l})})})})}function _s({title:t,children:e}){return m.jsxs(mh,{sx:{padding:"0!important",paddingTop:"1rem!important"},children:[m.jsx(mn,{sx:{fontWeight:"bold",mb:2,pb:1,color:"text.primary",fontSize:"1.25rem",borderBottom:n=>`1px solid ${n.palette.divider}`},children:t}),m.jsx(gn,{spacing:2,gap:1,mb:3,pt:1,children:e})]})}const LU=pe(m.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),kA=pe(m.jsx("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"AddOutlined"),FU=pe(m.jsx("path",{d:"M4 22H2V2h2zM22 7H6v3h16zm-6 7H6v3h10z"}),"AlignHorizontalLeftOutlined"),BU=pe(m.jsx("path",{d:"M20 2h2v20h-2zM2 10h16V7H2zm6 7h10v-3H8z"}),"AlignHorizontalRightOutlined"),$U=pe(m.jsx("path",{d:"M22 22H2v-2h20zM10 2H7v16h3zm7 6h-3v10h3z"}),"AlignVerticalBottomOutlined"),UU=pe(m.jsx("path",{d:"M22 2v2H2V2zM7 22h3V6H7zm7-6h3V6h-3z"}),"AlignVerticalTopOutlined"),Aue=pe(m.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"),zU=pe([m.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"),m.jsx("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")],"ArticleOutlined"),Nue=pe(m.jsx("path",{d:"M19 12h-2v3h-3v2h5zM7 9h3V7H5v5h2zm14-6H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16.01H3V4.99h18z"}),"AspectRatio"),Rue=pe(m.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"),Mk=pe(m.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"),Iue=pe(m.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"),Oue=pe(m.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"),Mue=pe(m.jsx("path",{d:"M13 7h-2v2h2zm0 4h-2v2h2zm4 0h-2v2h2zM3 3v18h18V3zm16 16H5V5h14zm-6-4h-2v2h2zm-4-4H7v2h2z"}),"BorderOuterOutlined"),Pue=pe(m.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"),Lue=pe(m.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"),Fue=pe(m.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"),Bue=pe(m.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"),$ue=pe(m.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"),Yv=pe(m.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"),Uue=pe(m.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"),zue=pe(m.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"}),"ContentCopy"),KO=pe(m.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"),HU=pe(m.jsx("path",{d:"M17 15h2V7c0-1.1-.9-2-2-2H9v2h8zM7 17V1H5v4H1v2h4v10c0 1.1.9 2 2 2h10v4h2v-4h4v-2z"}),"Crop"),GU=pe(m.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"),Hue=pe(m.jsx("path",{d:"M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 14H6V6h12z"}),"CropSquare"),Gue=pe(m.jsx("path",{d:"M19 5v2h-4V5zM9 5v6H5V5zm10 8v6h-4v-6zM9 17v2H5v-2zM21 3h-8v6h8zM11 3H3v10h8zm10 8h-8v10h8zm-10 4H3v6h8z"}),"DashboardOutlined"),jue=pe(m.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"),que=pe(m.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"),Vue=pe(m.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"),Wue=pe(m.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"),jU=pe(m.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"),Yue=pe(m.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"),qU=pe(m.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"),Kue=pe(m.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"),Que=pe(m.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"),Xue=pe(m.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"),Jue=pe(m.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"),VU=pe(m.jsx("path",{d:"M17 4h3c1.1 0 2 .9 2 2v2h-2V6h-3zM4 8V6h3V4H4c-1.1 0-2 .9-2 2v2zm16 8v2h-3v2h3c1.1 0 2-.9 2-2v-2zM7 18H4v-2H2v2c0 1.1.9 2 2 2h3zM18 8H6v8h12z"}),"FitScreen"),WU=pe(m.jsx("path",{d:"M7 15v2h10v-2zm-4 6h18v-2H3zm0-8h18v-2H3zm4-6v2h10V7zM3 3v2h18V3z"}),"FormatAlignCenter"),Zue=pe(m.jsx("path",{d:"M7 15v2h10v-2zm-4 6h18v-2H3zm0-8h18v-2H3zm4-6v2h10V7zM3 3v2h18V3z"}),"FormatAlignCenterOutlined"),YU=pe(m.jsx("path",{d:"M3 21h18v-2H3zm0-4h18v-2H3zm0-4h18v-2H3zm0-4h18V7H3zm0-6v2h18V3z"}),"FormatAlignJustify"),KU=pe(m.jsx("path",{d:"M15 15H3v2h12zm0-8H3v2h12zM3 13h18v-2H3zm0 8h18v-2H3zM3 3v2h18V3z"}),"FormatAlignLeft"),ede=pe(m.jsx("path",{d:"M15 15H3v2h12zm0-8H3v2h12zM3 13h18v-2H3zm0 8h18v-2H3zM3 3v2h18V3z"}),"FormatAlignLeftOutlined"),QU=pe(m.jsx("path",{d:"M3 21h18v-2H3zm6-4h12v-2H9zm-6-4h18v-2H3zm6-4h12V7H9zM3 3v2h18V3z"}),"FormatAlignRight"),tde=pe(m.jsx("path",{d:"M3 21h18v-2H3zm6-4h12v-2H9zm-6-4h18v-2H3zm6-4h12V7H9zM3 3v2h18V3z"}),"FormatAlignRightOutlined"),XU=pe(m.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"),JU=pe(m.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"),nde=pe(m.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"),ZU=pe(m.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"),ide=pe(m.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"),rde=pe(m.jsx("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"}),"FormatItalic"),QO=pe(m.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"),XO=pe(m.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"),e8=pe(m.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"),t8=pe(m.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"),n8=pe(m.jsx("path",{d:"M13 6.99h3L12 3 8 6.99h3v10.02H8L12 21l4-3.99h-3z"}),"HeightOutlined"),i8=pe(m.jsx("path",{fillRule:"evenodd",d:"M4 11h16v2H4z"}),"HorizontalRuleOutlined"),r8=pe(m.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"),a8=pe(m.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"),ade=pe(m.jsx("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown"),sde=pe(m.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"),s8=pe(m.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"),o8=pe(m.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"),ode=pe(m.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"),sg=pe(m.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"),og=pe(m.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"),lde=pe(m.jsx("path",{d:"M19.01 3h-14c-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 7.5c0 .83-.67 1.5-1.5 1.5.83 0 1.5.67 1.5 1.5V15c0 1.11-.9 2-2 2h-4v-2h4v-2h-2v-2h2V9h-4V7h4c1.1 0 2 .89 2 2z"}),"Looks3"),cde=pe(m.jsx("path",{d:"M19 3H5c-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-5 14h-2V9h-2V7h4z"}),"LooksOne"),ude=pe(m.jsx("path",{d:"M19 3H5c-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 8c0 1.11-.9 2-2 2h-2v2h4v2H9v-4c0-1.11.9-2 2-2h2V9H9V7h4c1.1 0 2 .89 2 2z"}),"LooksTwo"),dde=pe(m.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"),pde=pe(m.jsx("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"PanoramaFishEye"),fde=pe(m.jsx("path",{d:"M7.5 11C9.43 11 11 9.43 11 7.5S9.43 4 7.5 4 4 5.57 4 7.5 5.57 11 7.5 11m0-5C8.33 6 9 6.67 9 7.5S8.33 9 7.5 9 6 8.33 6 7.5 6.67 6 7.5 6M4.0025 18.5832 18.59 3.9955l1.4142 1.4143L5.4167 19.9974zM16.5 13c-1.93 0-3.5 1.57-3.5 3.5s1.57 3.5 3.5 3.5 3.5-1.57 3.5-3.5-1.57-3.5-3.5-3.5m0 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.5"}),"Percent"),mde=pe(m.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"),hde=pe(m.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"),l8=pe(m.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"),c8=pe(m.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"),id=pe(m.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"),gde=pe(m.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"),_de=pe(m.jsx("path",{d:"M4 9h16v2H4zm0 4h10v2H4z"}),"ShortText"),u8=pe(m.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"),JO=pe(m.jsx("path",{d:"M18 9v4H6V9H4v6h16V9z"}),"SpaceBar"),bde=pe(m.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"),yde=pe(m.jsx("path",{d:"M14 17H4v2h10zm6-8H4v2h16zM4 15h16v-2H4zM4 5v2h16V5z"}),"Subject"),vde=pe(m.jsx("path",{d:"M2.5 4v3h5v12h3V7h5V4zm19 5h-9v3h3v7h3v-7h3z"}),"TextFields"),d8=pe(m.jsx("path",{d:"M2.5 4v3h5v12h3V7h5V4zm19 5h-9v3h3v7h3v-7h3z"}),"TextFieldsOutlined"),Ede=pe(m.jsx("path",{d:"M5 4v3h5.5v12h3V7H19V4z"}),"Title"),Sde=pe(m.jsx("path",{d:"M16 13h-3V3h-2v10H8l4 4zM4 19v2h16v-2z"}),"VerticalAlignBottomOutlined"),Cde=pe(m.jsx("path",{d:"M8 19h3v4h2v-4h3l-4-4zm8-14h-3V1h-2v4H8l4 4zM4 11v2h16v-2z"}),"VerticalAlignCenterOutlined"),Tde=pe(m.jsx("path",{d:"M8 11h3v10h2V11h3l-4-4zM4 3v2h16V3z"}),"VerticalAlignTopOutlined"),p8=pe(m.jsx("path",{d:"M3 5v14h18V5zm5.33 12H5V7h3.33zm5.34 0h-3.33V7h3.33zM19 17h-3.33V7H19z"}),"ViewColumnOutlined"),f8=pe(m.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"),xde=pe(m.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 6h1v12H4zm16 12h-1V6h1z"}),"WidthFull"),kde=pe(m.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 6h4v12H4zm16 12h-4V6h4z"}),"WidthNormal"),wde=pe(m.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"),Ni=({children:t})=>m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.3rem"},children:t.map(e=>e)}),In=({label:t})=>{const e=sn();return t==null||t===""?null:m.jsx("p",{style:{fontWeight:"bold",color:e.palette.text.primary},children:t})};function Zp(){return(Zp=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 Kv(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 yh(t){var e=A.useRef(t),n=A.useRef(function(i){e.current&&e.current(i)});return e.current=t,n.current}var vh=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t<e?e:t},Om=function(t){return"touches"in t},Pk=function(t){return t&&t.ownerDocument.defaultView||self},ZO=function(t,e,n){var i=t.getBoundingClientRect(),r=Om(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:vh((r.pageX-(i.left+Pk(t).pageXOffset))/i.width),top:vh((r.pageY-(i.top+Pk(t).pageYOffset))/i.height)}},eM=function(t){!Om(t)&&t.preventDefault()},m8=A.memo(function(t){var e=t.onMove,n=t.onKey,i=Kv(t,["onMove","onKey"]),r=A.useRef(null),a=yh(e),s=yh(n),o=A.useRef(null),l=A.useRef(!1),c=A.useMemo(function(){var f=function(_){eM(_),(Om(_)?_.touches.length>0:_.buttons>0)&&r.current?a(ZO(r.current,_,o.current)):g(!1)},h=function(){return g(!1)};function g(_){var b=l.current,y=Pk(r.current),E=_?y.addEventListener:y.removeEventListener;E(b?"touchmove":"mousemove",f),E(b?"touchend":"mouseup",h)}return[function(_){var b=_.nativeEvent,y=r.current;if(y&&(eM(b),!(function(v,T){return T&&!Om(v)})(b,l.current)&&y)){if(Om(b)){l.current=!0;var E=b.changedTouches||[];E.length&&(o.current=E[0].identifier)}y.focus(),a(ZO(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 A.useEffect(function(){return p},[p]),A.createElement("div",Zp({},i,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:r,onKeyDown:d,tabIndex:0,role:"slider"}))}),wA=function(t){return t.filter(Boolean).join(" ")},h8=function(t){var e=t.color,n=t.left,i=t.top,r=i===void 0?.5:i,a=wA(["react-colorful__pointer",t.className]);return A.createElement("div",{className:a,style:{top:100*r+"%",left:100*n+"%"}},A.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},Wi=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n},Dde=function(t){return Ode(Lk(t))},Lk=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?Wi(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?Wi(parseInt(t.substring(6,8),16)/255,2):1}},Ade=function(t){return Ide(Rde(t))},Nde=function(t){var e=t.s,n=t.v,i=t.a,r=(200-e)*n/100;return{h:Wi(t.h),s:Wi(r>0&&r<200?e*n/100/(r<=100?r:200-r)*100:0),l:Wi(r/2),a:Wi(i,2)}},Fk=function(t){var e=Nde(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},Rde=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:Wi(255*[i,o,s,s,l,i][c]),g:Wi(255*[l,i,i,o,s,s][c]),b:Wi(255*[s,s,l,i,i,o][c]),a:Wi(r,2)}},t_=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},Ide=function(t){var e=t.r,n=t.g,i=t.b,r=t.a,a=r<1?t_(Wi(255*r)):"";return"#"+t_(e)+t_(n)+t_(i)+a},Ode=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:Wi(60*(o<0?o+6:o)),s:Wi(a?s/a*100:0),v:Wi(a/255*100),a:r}},Mde=A.memo(function(t){var e=t.hue,n=t.onChange,i=wA(["react-colorful__hue",t.className]);return A.createElement("div",{className:i},A.createElement(m8,{onMove:function(r){n({h:360*r.left})},onKey:function(r){n({h:vh(e+360*r.left,0,360)})},"aria-label":"Hue","aria-valuenow":Wi(e),"aria-valuemax":"360","aria-valuemin":"0"},A.createElement(h8,{className:"react-colorful__hue-pointer",left:e/360,color:Fk({h:e,s:100,v:100,a:1})})))}),Pde=A.memo(function(t){var e=t.hsva,n=t.onChange,i={backgroundColor:Fk({h:e.h,s:100,v:100,a:1})};return A.createElement("div",{className:"react-colorful__saturation",style:i},A.createElement(m8,{onMove:function(r){n({s:100*r.left,v:100-100*r.top})},onKey:function(r){n({s:vh(e.s+100*r.left,0,100),v:vh(e.v-100*r.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Wi(e.s)+"%, Brightness "+Wi(e.v)+"%"},A.createElement(h8,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:Fk(e)})))}),g8=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0},Lde=function(t,e){return t.toLowerCase()===e.toLowerCase()||g8(Lk(t),Lk(e))};function Fde(t,e,n){var i=yh(n),r=A.useState(function(){return t.toHsva(e)}),a=r[0],s=r[1],o=A.useRef({color:e,hsva:a});A.useEffect(function(){if(!t.equal(e,o.current.color)){var c=t.toHsva(e);o.current={hsva:c,color:e},s(c)}},[e,t]),A.useEffect(function(){var c;g8(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=A.useCallback(function(c){s(function(u){return Object.assign({},u,c)})},[]);return[a,l]}var Bde=typeof window<"u"?A.useLayoutEffect:A.useEffect,$de=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},tM=new Map,Ude=function(t){Bde(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!tM.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}`,tM.set(e,n);var i=$de();i&&n.setAttribute("nonce",i),e.head.appendChild(n)}},[])},zde=function(t){var e=t.className,n=t.colorModel,i=t.color,r=i===void 0?n.defaultColor:i,a=t.onChange,s=Kv(t,["className","colorModel","color","onChange"]),o=A.useRef(null);Ude(o);var l=Fde(n,r,a),c=l[0],u=l[1],d=wA(["react-colorful",e]);return A.createElement("div",Zp({},s,{ref:o,className:d}),A.createElement(Pde,{hsva:c,onChange:u}),A.createElement(Mde,{hue:c.h,onChange:u,className:"react-colorful__last-control"}))},Hde={defaultColor:"000",toHsva:Dde,fromHsva:function(t){return Ade({h:t.h,s:t.s,v:t.v,a:1})},equal:Lde},Gde=function(t){return A.createElement(zde,Zp({},t,{colorModel:Hde}))},jde=/^#?([0-9A-F]{3,8})$/i,qde=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=Kv(t,["color","onChange","onBlur","escape","validate","format","process"]),u=A.useState(function(){return a(n)}),d=u[0],p=u[1],f=yh(i),h=yh(r),g=A.useCallback(function(b){var y=a(b.target.value);p(y),s(y)&&f(l?l(y):y)},[a,l,s,f]),_=A.useCallback(function(b){s(b.target.value)||p(a(n)),h(b)},[n,a,s,h]);return A.useEffect(function(){p(a(n))},[n,a]),A.createElement("input",Zp({},c,{value:o?o(d):d,spellCheck:"false",onChange:g,onBlur:_}))},nM=function(t){return"#"+t},Vde=function(t){var e=t.prefixed,n=t.alpha,i=Kv(t,["prefixed","alpha"]),r=A.useCallback(function(s){return s.replace(/([^0-9A-F]+)/gi,"").substring(0,n?8:6)},[n]),a=A.useCallback(function(s){return(function(o,l){var c=jde.exec(o),u=c?c[1].length:0;return u===3||u===6||!!l&&u===4||!!l&&u===8})(s,n)},[n]);return A.createElement(qde,Zp({},i,{escape:r,format:e?nM:void 0,process:nM,validate:a}))};const iM={width:24,height:24};function Wde({paletteColors:t,isLocked:e,onToggleLock:n,onChange:i}){const r=sn(),{t:a}=Qe.useTranslation("inspector"),s=t.slice(30);return m.jsxs(gn,{spacing:1,children:[m.jsx("div",{style:{height:1,width:"100%",margin:"8px 0",backgroundColor:r.palette.grey[400]}}),m.jsxs(Se,{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"4px",children:[s.map((o,l)=>m.jsx(Vi,{sx:{...iM,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&&m.jsx(Vi,{onClick:n,sx:{backgroundColor:"transparent",border:"1px solid",...iM,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?m.jsx(sg,{fontSize:"small"}):m.jsx(og,{fontSize:"small"})})]})]})}const Yde={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%"}},rM=(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 DA({value:t,nullable:e,onChange:n}){const[i,r]=A.useState(t||"#000000"),[a,s]=A.useState(null),{paletteColors:o,isLocked:l}=jce(),[c,u]=A.useState(!1),d=sn(),p=A.useCallback(b=>{if(l)return;a&&clearTimeout(a);const y=setTimeout(()=>{const E=rM(b,o);R1({paletteColors:E})},300);s(y)},[a,l,o]),f=()=>{const b=!l;if(R1({isLocked:b}),!b&&i){const y=rM(i,o);R1({isLocked:b,paletteColors:y})}},h=b=>{u(!0),r(b)},g=()=>{n(i),p(i)},_=b=>{r(b),n(b),p(b)};return A.useEffect(()=>{t!==i&&r(t||"#000000")},[t]),A.useEffect(()=>()=>{a&&clearTimeout(a)},[a]),m.jsxs(gn,{spacing:1,sx:Yde,children:[m.jsx(Gde,{color:i,onChange:h,onMouseUp:g,onTouchEnd:g,onMouseLeave:()=>{c&&(g(),u(!1))}}),m.jsx(Wde,{isLocked:l,onToggleLock:f,paletteColors:o,value:t,nullable:e,onChange:b=>{b?(r(b),n(b),p(b)):n(null)}}),m.jsxs(Se,{pt:1,display:"flex",gap:1,alignItems:"center",children:[m.jsx(Vde,{prefixed:!0,color:i,onChange:_,style:{flex:1,backgroundColor:d.palette.background.paper,color:d.palette.text.primary,padding:"1px 4px",fontSize:"12px"}}),e&&m.jsx(Vi,{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:m.jsx(ZU,{color:"primary",fontSize:"small"})})]})]})}function _8({label:t,defaultValue:e,onChange:n,nullable:i,compact:r=!1,...a}){const[s,o]=A.useState(null),[l,c]=A.useState(e),{t:u}=Qe.useTranslation("inspector");A.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)},h=()=>!i||typeof l!="string"||l.trim().length===0?null:m.jsx(hn,{title:u("inputs.background.reset"),placement:"left",children:m.jsx(Se,{sx:{minWidth:24,lineHeight:1,flexShrink:0,pr:"4px",display:"grid",placeItems:"center"},onClick:()=>f(null),children:m.jsx(ZU,{sx:{color:"primary.main"}})})}),g=l?m.jsx(Ma,{onClick:d,sx:{...p,bgcolor:l}}):m.jsx(Ma,{onClick:d,sx:{...p},children:m.jsx(kA,{fontSize:"small"})}),_=m.jsx(iA,{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:m.jsx(DA,{value:l||"",nullable:i,onChange:b=>f(b)})});return r?m.jsxs(m.Fragment,{children:[g,_]}):m.jsxs(Ni,{children:[m.jsx(In,{label:t}),m.jsxs(gn,{direction:"row",alignContent:"center",spacing:1,children:[g,h()]}),_]})}function Zc(t){return m.jsx(_8,{...t,nullable:!1})}function O1(t){return m.jsx(_8,{...t,nullable:!0})}const zl=36,AA=8,Qv={width:"100%","& .MuiInputBase-root":{"&:not(.MuiInputBase-multiline)":{height:`${zl}px`}},"& .MuiOutlinedInput-root":{borderRadius:`${AA}px`,"&:not(.MuiInputBase-multiline)":{height:`${zl}px`}},"& .MuiInputBase-input":{paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",height:"unset"}},Bk={width:"100%",height:`${zl}px`,paddingTop:"8px",paddingBottom:"8px",paddingLeft:"12px",paddingRight:"12px",display:"flex",alignItems:"center",borderRadius:`${AA}px`};function Pu({label:t,children:e,defaultValue:n,onChange:i}){const[r,a]=A.useState(n);return A.useEffect(()=>{n!==r&&a(n)},[n]),m.jsxs(Ni,{children:[m.jsx(In,{label:t}),m.jsx(Se,{sx:{...Bk,paddingLeft:"0px",paddingRight:"0px"},children:m.jsx(Qp,{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 Kde=me(Se)(({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}`}})),Qde=me("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"}})),aM=me(Rn)(({theme:t})=>({padding:"0",color:t.palette.primary.main,"&:hover":{backgroundColor:Ne(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]=A.useState(u.toString()),f=v=>{let T=v;T<a&&(T=a),s!==void 0&&T>s&&(T=s),i(T),p(T.toString())},h=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()};A.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 m.jsxs(Ni,{children:[m.jsx(In,{label:e}),m.jsxs(gn,{direction:"row",alignItems:"center",spacing:2,justifyContent:"space-between",width:"100%",children:[m.jsx(Se,{sx:{minWidth:24,lineHeight:1,flexShrink:0},children:t}),m.jsx(eb,{...c,value:u,min:a,max:s||1e3,step:o,color:"primary",marks:l,onChange:E}),m.jsxs(Kde,{children:[m.jsx(Qde,{type:"number",value:d,onChange:h,onBlur:g,onKeyDown:_,min:a,max:s,step:o}),m.jsxs(Se,{sx:{display:"flex",flexDirection:"column",ml:.5},children:[m.jsx(aM,{onClick:b,disabled:s!==void 0&&u>=s,children:m.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",children:m.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})}),m.jsx(aM,{onClick:y,disabled:u<=a,children:m.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",style:{transform:"rotate(180deg)"},children:m.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 9l6-6l6 6"})})})]})]}),m.jsx(mn,{variant:"caption",color:"text.secondary",sx:{fontSize:"16px",ml:"4px!important"},children:r})]})]})}function sM(t){return{top:Number(t.top??0),bottom:Number(t.bottom??0),left:Number(t.left??0),right:Number(t.right??0)}}function Xde({size:t,sizeMobile:e,sizePaddingSidesLinked:n,sizeMobilePaddingSidesLinked:i,onChange:r,label:a,maxValue:s=100,paddingSteps:o=8}){const{t:l}=Qe.useTranslation("inspector"),c=a??l("inputs.common.size"),u=_i(),[d,p]=A.useState(()=>{const v=u==="desktop"?t:e!==void 0?e:t;return typeof v=="object"&&v!==null?sM(v):{top:8,bottom:8,left:16,right:16}}),f=u==="desktop"?n===!0:i===!0;A.useEffect(()=>{const v=u==="desktop"?t:e!==void 0?e:t;typeof v=="object"&&v!==null&&p(sM(v))},[t,e,u]);const h=()=>{const v=u==="desktop"?t:e!==void 0?e:t;return typeof v=="object"&&v!==null?"custom":typeof v=="string"?v:"medium"},g=typeof 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=h();return m.jsxs(gn,{spacing:2,children:[m.jsxs(Pu,{label:c,defaultValue:E,onChange:_,children:[m.jsx(_n,{value:"x-small",children:m.jsx(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:m.jsx("span",{children:l("inputs.responsiveSize.options.xSmall")})})}),m.jsx(_n,{value:"small",children:m.jsx(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:m.jsx("span",{children:l("inputs.responsiveSize.options.small")})})}),m.jsx(_n,{value:"medium",children:m.jsx(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:m.jsx("span",{children:l("inputs.responsiveSize.options.medium")})})}),m.jsx(_n,{value:"custom",children:m.jsx(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:m.jsx("span",{children:l("inputs.responsiveSize.options.custom")})})})]}),E==="custom"&&m.jsxs(gn,{spacing:2,alignItems:"flexStart",pb:1,children:[m.jsxs(gn,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[m.jsx(In,{label:l("inputs.responsiveSize.customPadding")}),m.jsx(hn,{title:l(f?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:m.jsx(Rn,{size:"small",onClick:y,sx:{marginTop:"0!important",color:f?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:f?m.jsx(sg,{fontSize:"small"}):m.jsx(og,{fontSize:"small"})})})]}),f?m.jsx(di,{iconLabel:m.jsx(mn,{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}):m.jsxs(m.Fragment,{children:[m.jsx(di,{iconLabel:m.jsx(UU,{sx:{fontSize:16}}),value:d.top,setValue:v=>b("top",v),units:"px",min:0,step:o,marks:o>1,max:g}),m.jsx(di,{iconLabel:m.jsx($U,{sx:{fontSize:16}}),value:d.bottom,setValue:v=>b("bottom",v),units:"px",min:0,step:o,marks:o>1,max:g}),m.jsx(di,{iconLabel:m.jsx(FU,{sx:{fontSize:16}}),value:d.left,setValue:v=>b("left",v),units:"px",min:0,step:o,marks:o>1,max:g}),m.jsx(di,{iconLabel:m.jsx(BU,{sx:{fontSize:16}}),value:d.right,setValue:v=>b("right",v),units:"px",min:0,step:o,marks:o>1,max:g})]})]})]})}function Jde({fullWidth:t,fullWidthMobile:e,onChange:n,label:i="Width"}){const r=_i(),{t:a}=Qe.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 m.jsxs(Pu,{label:i,defaultValue:l?"FULL_WIDTH":"AUTO",onChange:o,children:[m.jsx(_n,{value:"FULL_WIDTH",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(xde,{fontSize:"small"}),m.jsx("span",{children:a("inputs.width.full")})]})}),m.jsx(_n,{value:"AUTO",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(kde,{fontSize:"small"}),m.jsx("span",{children:a("inputs.width.auto")})]})})]})}function Zde(t,e){const n=A.useRef(null),i=A.useRef(t),r=A.useRef([]);i.current=t;const a=A.useCallback((...s)=>{r.current=s,n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{i.current(...s),n.current=null},e)},[e]);return a.flush=A.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=null,i.current(...r.current))},[]),a}function mp({helperText:t,label:e,placeholder:n,rows:i,InputProps:r,defaultValue:a,onChange:s}){const[o,l]=A.useState(a);A.useEffect(()=>{o!==a&&l(a)},[a]);const c=Zde(d=>{s(d)},150),u=typeof i=="number"&&i>1;return m.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[m.jsx(In,{label:e}),m.jsx(Kp,{fullWidth:!0,multiline:u,minRows:i,variant:"outlined",placeholder:n,helperText:t,InputProps:r,value:o,sx:Qv,onChange:d=>{const p=d.target.value;l(p),c(p)},onBlur:()=>{c.flush()}})]})}function epe({onClick:t,disabled:e,primary:n=!1}){const{t:i}=Qe.useTranslation("inspector");return m.jsx(Rn,{"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:m.jsx(Yv,{})})}function tpe({imageUrl:t,saving:e=!1}){return m.jsxs(lie,{sx:{position:"relative"},children:[e&&m.jsx(gn,{justifyContent:"center",alignItems:"center",sx:{position:"absolute",top:7,left:0,width:"100%",height:"314px",zIndex:20,backgroundColor:"#212121AA",mb:1},children:m.jsx(Xl,{size:48,thickness:6,color:"inherit",sx:{color:"white"}})}),m.jsx(hie,{component:"img",sx:{objectFit:"contain",width:"100%",height:"326px"},image:t,alt:"Generated Image"})]})}function npe({value:t,onChange:e,disabled:n}){return m.jsxs(m.Fragment,{children:[m.jsx(mn,{sx:{fontSize:"14px",fontWeight:700},children:"Image description"}),m.jsx(Kp,{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 ipe=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 b8({src:t,style:e}){const{t:n}=Qe.useTranslation("inspector"),[i,r]=A.useState(!1),[a,s]=A.useState(!1),[o,l]=A.useState(""),[c,u]=A.useState(null),[d,p]=A.useState(!1),[f,h]=A.useState(null),[g,_]=A.useState(!1),b=()=>{r(!0),h(null)},y=()=>{a||(r(!1),s(!1),u(null),l(""),p(!1),h(null),_(!1))},E=()=>{const S=c&&!d?"store-ai-image":"request-ai-image",C=c&&!d?c:o;h(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),h(null),_(!1)};A.useEffect(()=>{const S=C=>{const{detail:x}=C;if(s(!1),x.error){h(ipe(x.error));return}if(!x.success||!x.url){h({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)}},[]),A.useEffect(()=>{y()},[t]);const T=!c||d;return m.jsxs(m.Fragment,{children:[m.jsx(Vi,{style:e,startIcon:m.jsx(Mk,{className:"w-4 h-4"}),variant:"contained",onClick:b,children:n("inputs.aiImageGeneration.generate")}),m.jsx(ire,{open:i,onClose:y,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{bgcolor:"background.paper",color:"text.primary",borderRadius:"8px"}},children:m.jsxs("form",{onSubmit:S=>{S.preventDefault(),E()},children:[m.jsxs(Tre,{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"),m.jsx(epe,{onClick:y,disabled:a,primary:!0})]}),m.jsxs(hre,{children:[m.jsx(vre,{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?m.jsxs(gn,{sx:{position:"relative"},children:[m.jsx(tpe,{imageUrl:c,saving:g}),m.jsxs(Ul,{variant:"outlined",severity:"warning",icon:!1,children:[n("inputs.aiImageGeneration.warningRegenerate")," ",m.jsx("b",{children:n("inputs.aiImageGeneration.warningInsertFirst")})," ",n("inputs.aiImageGeneration.warningFirst")]})]}):a&&!c?m.jsx(gn,{justifyContent:"center",alignItems:"center",sx:{backgroundColor:S=>S.palette.mainColor[50],height:"326px",width:"100%"},children:m.jsx(Xl,{size:48,thickness:6})}):m.jsx(npe,{value:o,onChange:l,disabled:a})]}),!a&&m.jsxs(lre,{className:"p-6",children:[c&&!d&&m.jsx(Vi,{startIcon:m.jsx(c8,{className:"w-4 h-4"}),onClick:v,variant:"outlined",disabled:a,children:n("inputs.aiImageGeneration.regenerate")}),!c&&!d&&m.jsx(Vi,{onClick:y,variant:"text",disabled:d,children:n("inputs.aiImageGeneration.cancel")}),m.jsxs(Vi,{startIcon:c&&!d?m.jsx(Rue,{className:"w-4 h-4"}):m.jsx(Mk,{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&&m.jsx(Xl,{size:16,className:"ml-2"})]})]})]})})]})}const rpe=({className:t,...e})=>m.jsx("svg",{width:"15",height:"10",viewBox:"0 0 24 12",className:t,"aria-hidden":"true",focusable:"false",...e,children:m.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"3",d:"m6 3l6 6l6-6"})}),ape=me(oA)(({theme:t})=>({fontFamily:t.typography.fontFamily,color:t.palette.text.primary,backgroundColor:t.palette.background.input??t.palette.grey[100],width:"100%",height:`${zl}px`,"&.MuiInputBase-root, &.MuiOutlinedInput-root":{height:`${zl}px`,minHeight:`${zl}px`,boxSizing:"border-box",borderRadius:`${AA}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}})),ec=A.forwardRef((t,e)=>{const n=sn(),i={backgroundColor:n.palette.background.input??n.palette.grey[100],marginTop:"4px",borderRadius:"10px",border:`1px solid ${n.palette.divider}`,boxShadow:`0 1px 3px ${Ne("#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 m.jsx(ape,{ref:e,...t,IconComponent:rpe,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}}}}})});ec.displayName="CustomSelect";function y8(t){return m.jsx(Oa,{viewBox:"0 0 18 18",fontSize:"small",...t,children:m.jsx("path",{d:"M9.00015 6.75V8.25M9.00015 11.25H9.00765M3.804 14.25H14.1963C15.351 14.25 16.0727 13 15.4953 12L10.2992 3C9.72184 2 8.27846 2 7.70111 3L2.50496 12C1.92761 13 2.6493 14.25 3.804 14.25Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})}const spe=({defaultValue:t,onChange:e,values:n})=>{const i=rg(),{t:r}=Qe.useTranslation("inspector"),a=sn(),s=j=>{if(!j)return{url:"",repeat:"no-repeat",position:"center center",size:"cover"};const oe=j.match(/url\("([^"]+)"\)/),le=oe?oe[1]:"";let xe="no-repeat";j.includes("repeat-x")?xe="repeat-x":j.includes("repeat-y")?xe="repeat-y":j.includes("repeat")&&!j.includes("no-repeat")&&(xe="repeat");let ve="center center";const he=["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"];for(const at of he)if(j.includes(at)){ve=at;break}let ye="cover";return j.includes("contain")?ye="contain":j.includes("auto")&&(ye="auto"),{url:le,repeat:xe,position:ve,size:ye}},o=j=>j.url?`url("${j.url}") ${j.repeat} ${j.position} / ${j.size}`:"",[l,c]=A.useState(t||null),[u,d]=A.useState(s(t)),[p,f]=A.useState(!1),[h,g]=A.useState(()=>!!window.__emailBuilderEnableAI),[,_]=A.useState(null),[b,y]=A.useState(s(t).url||""),[E,v]=A.useState(!1),[T,S]=A.useState(""),[C,x]=A.useState(!1),k=A.useRef(null),w=yA(),[D,L]=A.useState(null);A.useEffect(()=>{const j=window.__emailBuilderCustomImageProvider;j&&(L(j),setTimeout(()=>{i&&window.dispatchEvent(new CustomEvent("email-builder-image-panel-opened",{detail:{blockId:i,currentImageUrl:u.url||null,alt:null}}))},100))},[]);const[I,O]=A.useState(()=>sessionStorage.getItem("hideBackgroundImageWarning")==="true"),M=(j,oe)=>{const le={...u,...j};if(d(le),le.url){const xe=o(le);c(xe),e(xe,oe)}else console.error("Update params error: ",le)},P=(j,oe)=>{if(!j)return!1;const le=j?.toLowerCase(),xe=le.includes(".svg")||le.includes("svg"),ve=oe&&(oe.includes("image/svg+xml")||oe.includes("svg"));return xe||!!ve},$=async j=>{try{v(!0),S(""),x(!1);try{new URL(j)}catch{return S("Invalid URL format"),!1}const oe=new AbortController,le=setTimeout(()=>oe.abort(),1e4);try{const xe=await fetch(j,{method:"HEAD",signal:oe.signal});if(clearTimeout(le),!xe.ok)return S(`HTTP ${xe.status}: ${xe.statusText}`),!1;const ve=xe.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(at=>ve&&ve.toLowerCase().includes(at.toLowerCase()))?(P(j,ve)&&x(!0),S(""),!0):(S("URL does not point to an image"),!1)}catch(xe){return clearTimeout(le),xe.name==="AbortError"?(S("Request timeout - URL took too long to respond"),!1):new Promise(ve=>{const he=new Image,ye=setTimeout(()=>{S("Request timeout - URL took too long to respond"),ve(!1)},1e4);he.onload=()=>{clearTimeout(ye),P(j)&&x(!0),S(""),ve(!0)},he.onerror=()=>{clearTimeout(ye),S("Cannot access image - CORS policy, network error, or invalid URL"),ve(!1)},he.src=j})}}catch{return S("Unexpected error occurred while validating URL"),!1}finally{v(!1)}},U=async()=>{b.trim()&&await $(b.trim())&&M({url:b.trim()})},G=j=>{j.key==="Enter"&&U()},V=j=>{y(j.target.value),T&&S(""),C&&x(!1)},K=j=>{const oe=["image/png","image/jpeg","image/gif"],xe=Array.isArray(j)?j:Array.from(j),ve=xe.filter(ye=>oe.includes(ye.type)&&ye.size<=5242880);if(ve.length!==xe.length&&alert(r("inputs.common.invalidFiles")),ve.length===0)return;const he=ve.map(ye=>new Promise(at=>{const ht=new FileReader;ht.onload=gt=>at(gt.target?.result),ht.readAsDataURL(ye)}));Promise.all(he).then(ye=>{const at={images:ye,id:i||"",styles:n};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:at})),zd(!0,i||"")})},te=j=>{j.preventDefault(),f(!0)},Te=()=>{f(!1)},de=j=>{j.preventDefault(),f(!1);const oe=j.dataTransfer.files;K(oe)},Oe=()=>{const j=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(j)},se=()=>{d({url:"",repeat:"no-repeat",position:"center center",size:"cover"}),c(null),e(null),y(""),x(!1)},X=j=>{switch(j){case"top left":return m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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 m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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 m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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 m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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 m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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 m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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 m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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 m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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 m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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 m.jsx("svg",{style:{color:"currentColor"},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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"})})}},J=j=>({"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")})[j]??r("inputs.backgroundImage.positions.center");return A.useEffect(()=>{const j=window.__emailBuilderEnableAI;j!==void 0&&g(!!j);const oe=le=>{const{detail:xe}=le;g(!!xe)};return window.addEventListener("email-builder-ai-generation",oe),()=>{window.removeEventListener("email-builder-ai-generation",oe)}},[]),A.useEffect(()=>{const j=ve=>{const{detail:he}=ve;zd(!1,he.id||""),M({url:he.url},he.styles),xU(!1),y(he.url)},oe=ve=>{zd(ve?.detail?.uploading??!1,ve?.detail?.id??"")},le=()=>{k?.current?.click()},xe=ve=>{const he=ve.detail;if(typeof he=="string"){if(!he.includes("url("))M({url:he}),y(he);else{const ye=s(he);d(ye),c(he),e(he),y(ye.url)}return}he?.url!=null&&typeof he.url=="string"&&(M({url:he.url},he.styles),y(he.url))};return window.addEventListener("email-builder-set-image",xe),window.addEventListener("email-builder-upload-image-receive",j),window.addEventListener("email-builder-upload-file",le),window.addEventListener("email-builder-toggle-upload-file",oe),()=>{window.removeEventListener("email-builder-upload-image-receive",j),window.removeEventListener("email-builder-set-image",xe),window.removeEventListener("email-builder-upload-file",le),window.removeEventListener("email-builder-toggle-upload-file",oe)}},[u]),A.useEffect(()=>{t&&x(P(u.url))},[t,u.url]),A.useEffect(()=>{if(t!==l){const j=s(t);d(j),c(t||null),y(j.url||"")}},[t]),m.jsxs(Ni,{children:[m.jsxs(Se,{sx:{display:"flex",alignItems:"center",gap:1},children:[m.jsx(In,{label:r("inputs.backgroundImage.label")}),!I&&m.jsx(hn,{title:r("inputs.backgroundImage.warningTooltip"),placement:"top",children:m.jsx(Rn,{size:"small",color:"warning",disableRipple:!0,sx:{p:0,cursor:"help",lineHeight:0,"&:hover":{backgroundColor:"transparent"}},children:m.jsx(y8,{"aria-hidden":!0})})})]}),D?m.jsx(Se,{sx:{mb:2},children:D}):m.jsx("div",{style:{display:"flex",gap:8},children:w?m.jsxs(Se,{sx:{width:"100%"},children:[m.jsxs(gn,{direction:"row",spacing:1,children:[m.jsx(Kp,{fullWidth:!0,placeholder:r("inputs.image.urlPlaceholder"),value:b,onChange:V,onKeyPress:G,error:!!T,disabled:E,sx:Qv}),m.jsx(Vi,{variant:"contained",onClick:U,disabled:!b.trim()||E,sx:{minWidth:"auto",px:2,position:"relative"},children:E?m.jsx(Xl,{size:20,color:"inherit"}):r("inputs.common.add")})]}),T&&m.jsx(Ul,{severity:"error",sx:{mt:1,fontSize:"0.875rem",maxHeight:"70px"},children:T}),C&&m.jsx(Ul,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},action:m.jsx(Rn,{"aria-label":r("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{x(!1)},children:m.jsx(Yv,{fontSize:"inherit"})}),children:r("inputs.common.svgWarning")}),u.url&&m.jsxs(Se,{sx:{position:"relative",maxWidth:"50%",display:"block",margin:"0.5rem auto 0 auto"},children:[m.jsx("img",{src:u.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"}}),m.jsx(Rn,{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:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:m.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"})})})]})]}):m.jsxs(m.Fragment,{children:[u.url&&m.jsxs(Se,{sx:{position:"relative",maxWidth:"40%",minWidth:"40%"},children:[m.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:m.jsx("img",{src:u.url||"",alt:"",style:{width:"100%",objectFit:"contain",aspectRatio:"1 / 1",height:"100%"}})}),m.jsx(Rn,{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:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:m.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"})})})]}),m.jsxs(Se,{onDragOver:te,onDragLeave:Te,onDrop:de,sx:{width:"100%",minWidth:"40%",border:"2px solid",borderColor:p?"primary.main":"divider",borderRadius:"8px",padding:"24px 8px 36px 8px",textAlign:"center",bgcolor:p?"primary.50":"background.paper",transition:"all 0.2s ease"},children:[m.jsx(Se,{sx:{display:"flex",justifyContent:"center"},children:m.jsx(l8,{sx:{fontSize:32,color:"primary"}})}),m.jsxs("label",{style:{cursor:"pointer"},children:[m.jsx("input",{ref:k,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:j=>{const oe=j.target.files;oe&&oe.length>0&&K(Array.from(oe))}}),m.jsx(mn,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:r("inputs.common.uploadFile")}),m.jsxs(mn,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",r("inputs.common.dragAndDrop")]})]}),m.jsx(mn,{variant:"body2",sx:{color:"text.secondary",mt:1},children:r("inputs.common.fileInfo")})]})]})}),u.url&&m.jsxs(Se,{sx:{mt:2},children:[m.jsxs(Se,{sx:{mb:2},children:[m.jsx(In,{label:r("inputs.backgroundImage.fillType")}),m.jsxs(Qp,{value:u.size,exclusive:!0,onChange:(j,oe)=>{oe!=null&&typeof oe=="string"&&M({size:oe})},size:"small",fullWidth:!0,children:[m.jsx(_n,{value:"cover",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(HU,{fontSize:"small"}),m.jsx("span",{children:r("inputs.backgroundImage.fillOptions.cover")})]})}),m.jsx(_n,{value:"contain",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(VU,{fontSize:"small"}),m.jsx("span",{children:r("inputs.backgroundImage.fillOptions.contain")})]})}),m.jsx(_n,{value:"auto",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(Nue,{fontSize:"small"}),m.jsx("span",{children:r("inputs.backgroundImage.fillOptions.auto")})]})})]})]}),m.jsxs(gn,{direction:"row",spacing:2,sx:{mb:2},children:[m.jsxs("div",{style:{flex:1},children:[m.jsx(In,{label:r("inputs.backgroundImage.repeat")}),m.jsxs(ec,{style:{width:"100%"},value:u.repeat,size:"small",onChange:j=>M({repeat:j.target.value}),children:[m.jsx(Xa,{value:"no-repeat",children:r("inputs.backgroundImage.repeatOptions.none")}),m.jsx(Xa,{value:"repeat",children:r("inputs.backgroundImage.repeatOptions.repeat")}),m.jsx(Xa,{value:"repeat-x",children:r("inputs.backgroundImage.repeatOptions.repeatX")}),m.jsx(Xa,{value:"repeat-y",children:r("inputs.backgroundImage.repeatOptions.repeatY")})]})]}),m.jsxs("div",{style:{flex:1},children:[m.jsx(In,{label:r("inputs.backgroundImage.position")}),m.jsx(ec,{style:{width:"100%"},value:u.position,size:"small",onChange:j=>M({position:j.target.value}),renderValue:j=>{const oe=String(j??"");return m.jsxs(Se,{sx:{display:"flex",alignItems:"center",gap:1,paddingRight:"1rem"},children:[X(oe),J(oe)]})},children:["top left","top center","top right","center left","center center","center right","bottom left","bottom center","bottom right"].map(j=>m.jsx(Xa,{sx:{padding:"0.5rem 1rem 0.5rem 0.5rem!important "},value:j,children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",gap:1},children:[X(j),J(j)]})},j))})]})]})]}),!D&&!w&&C&&m.jsx(Ul,{severity:"warning",sx:{mt:1,fontSize:"0.875rem"},children:r("inputs.common.svgWarning")}),(!D&&Vb()&&!w||D&&h)&&m.jsxs(m.Fragment,{children:[m.jsxs(gn,{direction:"row",alignItems:"center",spacing:1,sx:{mt:2},children:[m.jsx(dr,{sx:{flexGrow:1}}),m.jsx(mn,{sx:{color:"text.secondary"},children:r("inputs.backgroundImage.or")}),m.jsx(dr,{sx:{flexGrow:1}})]}),m.jsx(gn,{flexDirection:"row",gap:2,sx:{mt:2},children:!D&&Vb()&&!w&&m.jsx(Vi,{variant:"outlined",onClick:Oe,startIcon:m.jsx(a8,{}),sx:{width:"100%"},children:r("inputs.backgroundImage.browseGallery")})})]}),!D&&h&&m.jsx(b8,{src:u.url,style:{width:"100%",margin:0}})]})};function Sd({label:t,defaultValue:e,onChange:n,...i}){const[r,a]=A.useState(e??0);return e!=r&&a(e),m.jsxs(Ni,{children:[m.jsx(In,{label:t}),m.jsx(di,{value:r??0,setValue:s=>{a(s),n(s)},...i})]})}const oM=({mobile:t=!1,label:e,borderColor:n,borderTop:i,borderBottom:r,borderLeft:a,borderRight:s,onChange:o,sidesLinked:l,onSidesLinkedChange:c})=>{const{t:u}=Qe.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(D=>D===w[0])},f=d(),h={[f.top]:i??0,[f.bottom]:r??0,[f.left]:a??0,[f.right]:s??0},[g,_]=A.useState(n??"#000000"),[b,y]=A.useState(h),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);A.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(D=>b[D]!==k[D])&&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 D={...b,borderColor:g,[w]:k};o(D)};return m.jsxs("div",{children:[m.jsxs(gn,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[m.jsx(In,{label:e}),m.jsxs(gn,{direction:"row",spacing:1,alignItems:"center",children:[m.jsx(Zc,{defaultValue:g,onChange:S,compact:!0}),m.jsx(hn,{title:u(v?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:m.jsx(Rn,{size:"small",onClick:T,sx:{color:v?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:v?m.jsx(sg,{fontSize:"small"}):m.jsx(og,{fontSize:"small"})})})]})]}),v&&m.jsx(Sd,{label:"",iconLabel:m.jsx(Mue,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.top],onChange:C}),!v&&m.jsxs(gn,{spacing:2,children:[m.jsx(Sd,{label:"",iconLabel:m.jsx(Lue,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.top],onChange:k=>x(k,f.top)}),m.jsx(Sd,{label:"",iconLabel:m.jsx(Iue,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.bottom],onChange:k=>x(k,f.bottom)}),m.jsx(Sd,{label:"",iconLabel:m.jsx(Oue,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.left],onChange:k=>x(k,f.left)}),m.jsx(Sd,{label:"",iconLabel:m.jsx(Pue,{sx:{color:"text.secondary"}}),units:"px",step:1,min:0,max:8,defaultValue:b[f.right],onChange:k=>x(k,f.right)})]})]})},ope=OU.map(t=>m.jsx(Xa,{value:t.key,sx:{fontFamily:t.value},children:t.label},t.key));function v8({label:t,onChange:e,defaultValue:n}){const i="INHERIT",[r,a]=A.useState(n??i);A.useEffect(()=>{r!==n&&a(n??i)},[n]);const s=o=>{const l=o.target.value;a(l),e(l===null?null:l)};return m.jsxs(Ni,{children:[m.jsx(In,{label:t}),m.jsx(ec,{style:{width:"100%"},value:r,size:"small",onChange:s,children:ope})]})}function lM({label:t,defaultValue:e=16,onChange:n,maxValue:i,minValue:r,step:a}){const[s,o]=A.useState(e);A.useEffect(()=>{s!==e&&o(e)},[e]);const l=c=>{o(c),n(c)};return m.jsxs(Ni,{children:[m.jsx(In,{label:t}),m.jsx(di,{iconLabel:m.jsx(d8,{sx:{fontSize:16,color:"text.primary"}}),value:s,setValue:l,units:"px",step:a??2,min:r||8,max:i||48})]})}function lpe({label:t,defaultValue:e,onChange:n}){const{t:i}=Qe.useTranslation("inspector"),[r,a]=A.useState(e);return A.useEffect(()=>{r!==e&&a(e)},[e]),m.jsxs(Pu,{label:t,defaultValue:r,onChange:s=>{a(s),n(s)},children:[m.jsx(_n,{value:"normal",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(vde,{fontSize:"small"}),m.jsx("span",{children:i("inputs.fontWeightToggle.regular")})]})}),m.jsx(_n,{value:"bold",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(XU,{fontSize:"small"}),m.jsx("span",{children:i("inputs.fontWeightToggle.bold")})]})})]})}const cM=({label:t,defaultValue:e,onChange:n})=>{const{t:i}=Qe.useTranslation("inspector"),r=t??i("inputs.common.height");return m.jsx(di,{label:r,iconLabel:m.jsx(n8,{sx:{color:"text.secondary"}}),units:"px",step:1,min:1,max:100,marks:!1,value:e??1,setValue:n})},cpe=[{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)"}],upe=cpe.map(t=>m.jsx(Xa,{value:t.key,children:t.label},t.key));function dpe({label:t,onChange:e,defaultValue:n}){const i="INHERIT",[r,a]=A.useState(n?.toString()??i);A.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 m.jsxs(Ni,{children:[m.jsx(In,{label:t}),m.jsxs(ec,{style:{width:"100%"},value:r,size:"small",onChange:s,children:[m.jsx(Xa,{value:i,children:"Default value"}),upe]})]})}function uM({label:t,defaultValue:e,onChange:n,sidesLinked:i,onSidesLinkedChange:r}){const{t:s}=Qe.useTranslation("inspector"),[o,l]=A.useState(()=>e||{top:0,left:0,bottom:0,right:0});A.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 h;c?h={top:f,bottom:f,left:f,right:f}:h={...o,[p]:f},l(h),n(h)}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 m.jsxs(Ni,{children:[m.jsxs(gn,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[m.jsx(In,{label:t}),m.jsx(hn,{title:s(c?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:m.jsx(Rn,{size:"small",onClick:d,sx:{marginTop:"0!important",color:c?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:c?m.jsx(sg,{fontSize:"small"}):m.jsx(og,{fontSize:"small"})})})]}),c?m.jsx(di,{iconLabel:m.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}):m.jsxs(m.Fragment,{children:[m.jsx(di,{iconLabel:m.jsx(UU,{sx:{fontSize:16,color:"text.primary"}}),value:o.top,setValue:p=>u("top",p),units:"px",step:16,min:0,max:120,marks:!0}),m.jsx(di,{iconLabel:m.jsx($U,{sx:{fontSize:16,color:"text.primary"}}),value:o.bottom,setValue:p=>u("bottom",p),units:"px",step:16,min:0,max:120,marks:!0}),m.jsx(di,{iconLabel:m.jsx(FU,{sx:{fontSize:16,color:"text.primary"}}),value:o.left,setValue:p=>u("left",p),units:"px",step:16,min:0,max:120,marks:!0}),m.jsx(di,{iconLabel:m.jsx(BU,{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 ppe=({label:t,defaultValue:e,onChange:n,maxValue:i=600,shapeSteps:r=8,cornersLinked:a,onCornersLinkedChange:s})=>{const{t:o}=Qe.useTranslation("inspector"),[l,c]=A.useState(()=>typeof e=="object"&&e!==null?"rounded":e||"rectangle"),[u,d]=A.useState(()=>typeof e=="object"&&e!==null?e:{topLeft:0,topRight:0,bottomLeft:0,bottomRight:0}),p=a===!0;A.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)},h=(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 m.jsxs(m.Fragment,{children:[m.jsxs(Pu,{label:b,defaultValue:l,onChange:f,children:[m.jsx(_n,{value:"rectangle",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(Hue,{fontSize:"small"}),m.jsx("span",{children:o("shape.square")})]})}),m.jsx(_n,{value:"pill",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(pde,{fontSize:"small"}),m.jsx("span",{children:o("shape.pill")})]})}),m.jsx(_n,{value:"rounded",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(id,{fontSize:"small"}),m.jsx("span",{children:o("shape.custom")})]})})]}),l==="rounded"&&m.jsxs(gn,{spacing:2,alignItems:"flexStart",pb:1,children:[m.jsxs(gn,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:[m.jsx(In,{label:o("shape.borderRadius")}),m.jsx(hn,{title:o(p?"lockValues.unlockTooltip":"lockValues.lockTooltip"),children:m.jsx(Rn,{size:"small",onClick:g,sx:{marginTop:"0!important",color:p?"primary.main":"text.secondary","&:hover":{backgroundColor:"action.hover"}},children:p?m.jsx(sg,{fontSize:"small"}):m.jsx(og,{fontSize:"small"})})})]}),p?m.jsx(m.Fragment,{children:m.jsx(di,{iconLabel:m.jsx(id,{sx:{fontSize:16}}),value:Number(u.topRight),setValue:y=>h("topLeft",y),units:"px",min:0,step:r,marks:r>1,max:_})}):m.jsxs(m.Fragment,{children:[m.jsx(di,{iconLabel:m.jsx(id,{sx:{fontSize:16,transform:"rotate(0deg)"}}),value:Number(u.topLeft),setValue:y=>h("topLeft",y),units:"px",min:0,step:r,marks:r>1,max:_}),m.jsx(di,{iconLabel:m.jsx(id,{sx:{fontSize:16,transform:"rotate(270deg)"}}),value:Number(u.topRight),setValue:y=>h("topRight",y),units:"px",min:0,step:r,marks:r>1,max:_}),m.jsx(di,{iconLabel:m.jsx(id,{sx:{fontSize:16,transform:"rotate(180deg)"}}),value:Number(u.bottomLeft),setValue:y=>h("bottomLeft",y),units:"px",min:0,step:r,marks:r>1,max:_}),m.jsx(di,{iconLabel:m.jsx(id,{sx:{fontSize:16,transform:"rotate(90deg)"}}),value:Number(u.bottomRight),setValue:y=>h("bottomRight",y),units:"px",min:0,step:r,marks:r>1,max:_})]})]})]})};function dM({label:t,defaultValue:e,onChange:n}){const[i,r]=A.useState(e??"left");return A.useEffect(()=>{e!==i&&r(e??"left")},[e]),m.jsxs(Ni,{children:[m.jsx(In,{label:t}),m.jsxs(Pu,{label:"",defaultValue:i,onChange:a=>{r(a),n(a)},children:[m.jsx(_n,{value:"left",children:m.jsx(ede,{fontSize:"small"})}),m.jsx(_n,{value:"center",children:m.jsx(Zue,{fontSize:"small"})}),m.jsx(_n,{value:"right",children:m.jsx(tde,{fontSize:"small"})})]})]})}const pM=({label:t,defaultValue:e,onChange:n,step:i,...r})=>{const{t:a}=Qe.useTranslation("inspector"),s=t??a("inputs.common.width");return m.jsx(di,{label:s,iconLabel:m.jsx(n8,{sx:{color:"text.primary",transform:"rotate(90deg)"}}),units:"%",step:i,min:1,max:100,marks:!1,value:e??1,setValue:n,...r})};function fpe({name:t,value:e,onChange:n,shapeMaxValue:i,shapeSteps:r}){const a=_i(),s=Wv(),{t:o}=Qe.useTranslation("inspector"),l=(f,h)=>{const g=e[f],_=e[h];return g??_},c=(f,h)=>{n(h?{...e,...h,[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 m.jsx(O1,{label:o("properties.backgroundColor"),defaultValue:p??s?.canvasColor,onChange:c});case"background":return m.jsx(spe,{defaultValue:p,onChange:(f,h)=>c(f,h),values:e});case"borderColor":return m.jsx(O1,{label:o("properties.border"),defaultValue:p,onChange:c});case"borderRadius":return m.jsx(Sd,{iconLabel:m.jsx(gde,{}),units:"px",step:4,marks:!0,min:0,max:48,label:o("properties.borderRadius"),defaultValue:p,onChange:c});case"color":return m.jsx(O1,{label:o("properties.color"),defaultValue:p,onChange:c});case"fontFamily":return m.jsx(v8,{label:o("properties.fontFamily"),defaultValue:p,onChange:c});case"fontWeight":return m.jsx(lpe,{label:o("properties.fontWeight"),defaultValue:p,onChange:c});case"textAlign":return a==="desktop"&&m.jsx(dM,{label:o("properties.alignment"),defaultValue:p,onChange:c});case"textAlignMobile":return a!="desktop"&&m.jsx(dM,{label:o("properties.alignment"),defaultValue:p,onChange:c});case"padding":return a==="desktop"&&m.jsx(uM,{label:o("properties.padding"),defaultValue:p,onChange:c,sidesLinked:e.paddingSidesLinked,onSidesLinkedChange:f=>n({...e,paddingSidesLinked:f})});case"mobilePadding":return a!="desktop"&&m.jsx(uM,{label:o("properties.padding"),defaultValue:p,onChange:c,sidesLinked:e.mobilePaddingSidesLinked,onSidesLinkedChange:f=>n({...e,mobilePaddingSidesLinked:f})});case"fontSize":return a==="desktop"&&m.jsx(lM,{maxValue:80,step:8,label:o("properties.fontSize"),defaultValue:p??16,onChange:c});case"fontSizeMobile":return a!="desktop"&&m.jsx(lM,{maxValue:80,step:8,label:o("properties.fontSize"),defaultValue:p,onChange:c});case"lineHeight":return m.jsx(dpe,{label:o("properties.lineHeight"),defaultValue:p??1.5,onChange:c});case"shape":return m.jsx(ppe,{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"&&m.jsx(cM,{label:o("properties.height"),defaultValue:p,onChange:c});case"heightMobile":return a!="desktop"&&m.jsx(cM,{label:o("properties.height"),defaultValue:p,onChange:c});case"width":return a==="desktop"&&m.jsx(pM,{label:o("properties.width"),defaultValue:p,onChange:c});case"widthMobile":return a!="desktop"&&m.jsx(pM,{label:o("properties.width"),defaultValue:p,onChange:c});case"border":return a==="desktop"&&m.jsx(oM,{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"&&m.jsx(oM,{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 Rr({names:t,value:e,onChange:n,disabledCSSValidation:i=!1,shapeMaxValue:r,shapeSteps:a}){const s=Xo(),o=EU();return(i||s=="css"||Fb.includes(o||""))&&m.jsx(m.Fragment,{children:t.map(l=>m.jsx(fpe,{shapeMaxValue:r,shapeSteps:a,name:l,value:e||{},onChange:n},l))})}function mpe({data:t,setData:e}){const[,n]=A.useState(null),i=Wv(),{t:r}=Qe.useTranslation("inspector"),a=_=>{const b=MU.safeParse(_);b.success?(e(b.data),n(null)):n(b.error)},s=t.props?.text??Nl.text,o=t.props?.url??Nl.url,l=t.props?.fullWidth??Nl.fullWidth,c=t.props?.size??Nl.size,u=i,d=t.style?.buttonTextColor??t.props?.buttonTextColor??u?.textColor,p=t.style?.buttonBackgroundColor??t.props?.buttonBackgroundColor??Nl.buttonBackgroundColor,f=t.props?.fullWidthMobile,h=t.props?.sizeMobile,g=Xo();return m.jsxs(_s,{title:r("inputs.panels.button.title"),children:[g=="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsx(Rr,{disabledCSSValidation:!0,names:["fontFamily","fontSize","fontSizeMobile","fontWeight"],value:t.style,onChange:_=>a({...t,style:_})}),m.jsx(mp,{label:r("inputs.panels.button.textLabel"),defaultValue:s,onChange:_=>a({...t,props:{...t.props,text:_}})}),m.jsx(mp,{label:r("inputs.panels.button.targetLabel"),placeholder:r("inputs.panels.button.targetPlaceholder"),defaultValue:o,onChange:_=>a({...t,props:{...t.props,url:_}})}),m.jsx(Jde,{label:r("properties.width"),fullWidth:l,fullWidthMobile:f,onChange:_=>a({...t,props:{...t.props,..._}})}),m.jsx(Xde,{size:c,sizeMobile:h,sizePaddingSidesLinked:t.props?.sizePaddingSidesLinked,sizeMobilePaddingSidesLinked:t.props?.sizeMobilePaddingSidesLinked,onChange:_=>a({...t,props:{...t.props,..._}})})]}),m.jsx(Rr,{names:["shape","textAlign","textAlignMobile","backgroundColor","border","borderMobile","padding","mobilePadding"],value:t.style,shapeMaxValue:80,onChange:_=>a({...t,style:_})}),g==="css"&&m.jsxs(m.Fragment,{children:[m.jsx(Zc,{label:r("inputs.panels.button.textColor"),defaultValue:d,onChange:_=>a({...t,style:{...t.style,buttonTextColor:_}})}),m.jsx(Zc,{label:r("inputs.panels.button.buttonColor"),defaultValue:p,onChange:_=>a({...t,style:{...t.style,buttonBackgroundColor:_}})})]})]})}var Ff={},M1={};const hpe=Ko(ZZ);var fM;function Xv(){return fM||(fM=1,(function(t){"use client";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return e.createSvgIcon}});var e=hpe})(M1)),M1}var mM;function gpe(){if(mM)return Ff;mM=1;var t=jp();Object.defineProperty(Ff,"__esModule",{value:!0}),Ff.default=void 0;var e=t(Xv()),n=m;return Ff.default=(0,e.default)((0,n.jsx)("path",{d:"M18 4v5H6V4zm0-2H6c-1.1 0-2 .9-2 2v5c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m0 13v5H6v-5zm0-2H6c-1.1 0-2 .9-2 2v5c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-5c0-1.1-.9-2-2-2"}),"SplitscreenOutlined"),Ff}var _pe=gpe();const bpe=lc(_pe);var Bf={},hM;function ype(){if(hM)return Bf;hM=1;var t=jp();Object.defineProperty(Bf,"__esModule",{value:!0}),Bf.default=void 0;var e=t(Xv()),n=m;return Bf.default=(0,e.default)((0,n.jsx)("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 2v3H5V5zm0 5v4H5v-4zM5 19v-3h14v3z"}),"TableRowsOutlined"),Bf}var vpe=ype();const Epe=lc(vpe);var $f={},gM;function Spe(){if(gM)return $f;gM=1;var t=jp();Object.defineProperty($f,"__esModule",{value:!0}),$f.default=void 0;var e=t(Xv()),n=m;return $f.default=(0,e.default)((0,n.jsx)("path",{d:"M3 5v14h18V5zm5.33 12H5V7h3.33zm5.34 0h-3.33V7h3.33zM19 17h-3.33V7H19z"}),"ViewColumnOutlined"),$f}var Cpe=Spe();const Tpe=lc(Cpe);var Uf={},_M;function xpe(){if(_M)return Uf;_M=1;var t=jp();Object.defineProperty(Uf,"__esModule",{value:!0}),Uf.default=void 0;var e=t(Xv()),n=m;return Uf.default=(0,e.default)((0,n.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-2M8 18H4V6h4zm6 0h-4V6h4zm6 0h-4V6h4z"}),"ViewWeekOutlined"),Uf}var kpe=xpe();const wpe=lc(kpe),ry=vt({top:Pe(),bottom:Pe(),right:Pe(),left:Pe()}).optional().nullable(),ef=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},Dpe=IU([Pe().nullish(),Pe().nullish(),Pe().nullish()]).optional().nullable(),E8=vt({style:vt({background:nt().nullable().optional(),backgroundColor:nt().nullable().optional(),padding:ry,mobilePadding:ry}).passthrough().optional().nullable(),props:vt({fixedWidths:Dpe,columnsCount:Gd([Ok(2),Ok(3)]).optional().nullable(),layout:nt().optional().nullable(),contentAlignment:Wn(["top","middle","bottom"]).optional().nullable(),contentAlignmentMobile:Wn(["top","middle","bottom"]).optional().nullable(),stackColumnsOnMobile:Za().optional().nullable()}).optional().nullable()}).passthrough(),Ape={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},Mm={columnsCount:2,contentAlignment:"middle"};function $k({style:t,columns:e,props:n,blockId:i}){const r=_i(),a=bA(),s={padding:ef(r=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},o={columnsCount:n?.columnsCount??Mm.columnsCount,contentAlignment:r=="desktop"?n?.contentAlignment??Mm.contentAlignment:n?.contentAlignmentMobile??n?.contentAlignment??Mm.contentAlignment,fixedWidths:n?.fixedWidths,blockId:i},l=t?.background??"",c=t?.backgroundColor,u=c?Mu(l,c):l,d=jt(i),p=r==="mobile"&&!!n?.stackColumnsOnMobile,f=p?{display:"block",width:"100%"}:void 0;return m.jsxs(Jr,{background:u,backgroundColor:c,className:`${d}`,padding:s.padding,width:"100%",children:[a.uploading&&a.id===i?m.jsx("div",{style:Ape,children:m.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:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}):m.jsx(m.Fragment,{}),m.jsx("table",{border:0,cellSpacing:"0",cellPadding:"0",style:{width:"100%",...f},children:m.jsx("tbody",{style:{width:"100%",...f},children:m.jsxs("tr",{style:{width:"100%",...f},children:[m.jsx(P1,{index:0,props:o,columns:e,stackMobilePreview:p}),m.jsx(P1,{index:1,props:o,columns:e,stackMobilePreview:p}),m.jsx(P1,{index:2,props:o,columns:e,stackMobilePreview:p})]})})})]})}function P1({index:t,props:e,columns:n,stackMobilePreview:i}){const r=e?.contentAlignment??Mm.contentAlignment;if((e?.columnsCount??Mm.columnsCount)===2&&t===2)return null;const s=e.fixedWidths?.[t],o={boxSizing:"border-box",verticalAlign:r,width:s!=null?`${s}%`:void 0,...i?{display:"block",width:"100%"}:{}},l=(n&&n[t])??null,c=e.blockId?jt(e.blockId):"";return m.jsx("td",{className:`col${c}`,style:o,children:l})}const Npe=E8.shape.props.unwrap().unwrap().shape,NA=vt({style:E8.shape.style,props:vt({...Npe,columns:IU([vt({childrenIds:Hd(nt())}),vt({childrenIds:Hd(nt())}),vt({childrenIds:Hd(nt())})])}).optional().nullable(),blockId:nt().optional(),isNotClient:Za().optional()}).passthrough(),Rpe=(t,e,n)=>{if(!t||!document)return;const i=jt(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}})},Ipe=t=>{if(!t||!document)return;const e=jt(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},Ope={desktop:"contentAlignment",mobile:"contentAlignmentMobile"};function Mpe({data:t,updateData:e}){const{t:n}=Qe.useTranslation("inspector"),i=_i(),r=Ope[i]||"contentAlignment",a=t.props?.[r]??t.props?.contentAlignment,s=o=>{e({...t,props:{...t.props,[r]:o}})};return m.jsxs(Pu,{label:n("inputs.alignment.label"),defaultValue:a,onChange:s,children:[m.jsx(_n,{value:"top",children:m.jsx(Tde,{fontSize:"small"})}),m.jsx(_n,{value:"middle",children:m.jsx(Cde,{fontSize:"small"})}),m.jsx(_n,{value:"bottom",children:m.jsx(Sde,{fontSize:"small"})})]})}function bM({value:t,onChange:e,options:n}){return m.jsx(Qp,{exclusive:!0,value:t,size:"small",onChange:(i,r)=>{typeof r=="string"&&e(r)},sx:{display:"flex",width:"100%"},children:n.map(i=>m.jsx(_n,{value:i.value,children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[i.icon,m.jsx("span",{children:i.label})]})},i.value))})}const rd="layout-custom",L1=[{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]}],F1=[{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]}],El={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 yM(t){const e=t?.[0];return typeof e=="number"&&!Number.isNaN(e)?Math.min(99,Math.max(1,Math.round(e))):50}function B1(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 $1=({fractions:t,highlight:e})=>{const n=sn(),i=e?n.palette.secondary.main:"#e5e7eb";return m.jsx("div",{style:{...El.layoutPreview,gridTemplateColumns:t.map(r=>`${r}fr`).join(" ")},children:t.map((r,a)=>m.jsx("div",{style:{minWidth:0,backgroundColor:i,borderRadius:"4px",transition:"background-color 0.2s ease"}},a))})},Ppe=({defaultValue:t,fixedWidths:e,onChange:n,columns:i})=>{const{t:r}=Qe.useTranslation("inspector"),a=sn(),[s,o]=A.useState(null),[l,c]=A.useState(!1),[u,d]=A.useState(()=>yM(e??void 0)),[p,f]=A.useState(()=>B1(e??void 0)[0]),[h,g]=A.useState(()=>B1(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]=A.useState(i===2?L1:F1),S=(O,M)=>{o(null),c(!1),n({layout:O,fixedWidths:M})},C=()=>{if(o(rd),c(!0),i===2)d(yM(e??void 0));else{const[O,M]=B1(e??void 0);f(O),g(M)}},x=()=>{if(i===2){const O=u;n({layout:rd,fixedWidths:[O,100-O,null]})}else{const O=p,M=h;n({layout:rd,fixedWidths:[O,M,100-O-M]})}o(null)};A.useEffect(()=>{T(i===2?L1:F1)},[i]),A.useEffect(()=>{o(null),c(!1)},[i,t]),A.useEffect(()=>{const O=t;i===2?O!==rd&&(O==null||!L1.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!==rd&&(O==null||!F1.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($=>Math.max(1,Math.min($,100-P-1)))},w=(O,M)=>{const P=M,$=100-p-1;g(Math.max(1,Math.min(P,$)))},D=100-u,L=100-p-h,I=E===rd;return m.jsxs(Ni,{children:[m.jsx(In,{label:r("inputs.layout.label")}),m.jsxs("div",{style:El.grid,children:[v.map(O=>m.jsx("div",{onClick:()=>S(O.id,O.distribution),style:{...El.card,border:E===O.id?`2px solid ${a.palette.secondary.main}`:El.card.border},children:m.jsx("div",{style:El.cardContent,children:m.jsx($1,{fractions:O.distribution.filter(M=>M!=null),highlight:E===O.id})})},O.id)),m.jsx("div",{onClick:C,style:{...El.card,border:I?`2px solid ${a.palette.secondary.main}`:El.card.border},role:"button",tabIndex:0,onKeyDown:O=>{(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),C())},children:m.jsx("div",{style:El.cardContent,children:m.jsx(Se,{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:m.jsx(qU,{sx:{fontSize:18,color:"text.primary"}})})})})]}),m.jsx(GD,{in:l,timeout:"auto",unmountOnExit:!0,children:m.jsxs(Se,{sx:{mt:2,p:2,borderRadius:1,border:1,borderColor:"divider",bgcolor:"background.paper"},children:[i===2?m.jsxs(gn,{spacing:2,sx:{mt:1},children:[m.jsxs(mn,{variant:"body2",color:"text.secondary",children:[u,"% | ",D,"%"]}),m.jsx(eb,{value:u,min:1,max:99,step:1,valueLabelDisplay:"auto","aria-label":r("inputs.layout.custom.split2"),onChange:(O,M)=>d(M)}),m.jsx($1,{fractions:[u,D],highlight:!0})]}):m.jsxs(gn,{spacing:2,sx:{mt:1},children:[m.jsxs(mn,{variant:"body2",color:"text.secondary",children:[p,"% | ",h,"% | ",L,"%"]}),m.jsxs(Se,{children:[m.jsx(mn,{variant:"caption",color:"text.secondary",component:"div",children:r("inputs.layout.custom.firstColumn")}),m.jsx(eb,{value:p,min:1,max:98,step:1,valueLabelDisplay:"auto",onChange:k})]}),m.jsxs(Se,{children:[m.jsx(mn,{variant:"caption",color:"text.secondary",component:"div",children:r("inputs.layout.custom.secondColumn")}),m.jsx(eb,{value:h,min:1,max:100-p-1,step:1,valueLabelDisplay:"auto",onChange:w})]}),m.jsx($1,{fractions:[p,h,L],highlight:!0})]}),m.jsx(Vi,{variant:"contained",size:"small",sx:{mt:2},onClick:x,children:m.jsx(mn,{variant:"button",component:"span",sx:{color:"#FFFFFF",fontWeight:"bold"},children:r("inputs.layout.custom.apply")})})]})})]})};function Lpe({label:t,tooltipTitle:e,hideWarning:n}){return m.jsxs(Se,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[m.jsx(In,{label:t}),!n&&m.jsx(hn,{title:e,placement:"top",children:m.jsx(Rn,{size:"small",color:"warning",disableRipple:!0,sx:{p:0,cursor:"help",lineHeight:0,"&:hover":{backgroundColor:"transparent"}},children:m.jsx(y8,{"aria-hidden":!0})})})]})}function Fpe({data:t,setData:e}){const[,n]=A.useState(null),[i,r]=A.useState(t.props?.columnsCount??2),a=Xo(),s=_i(),{t:o}=Qe.useTranslation("inspector"),l=f=>{const h=ae.getState().document,g=f.filter(_=>h[_]?.type==="Image");s==="desktop"&&g.forEach(_=>{const b=h[_];if(b?.type!=="Image")return;const y=b.data;Rpe(_,E=>{Wb(_,v=>v.type!=="Image"?v:{...v,data:E})},y)})},c=f=>{const h=NA.safeParse(f);h.success?(h.data.props.columns.map(g=>l(g.childrenIds)),e(h.data),i&&h.data.props?.columnsCount!==i&&r(h.data.props?.columnsCount??2),n(null)):(console.error("Error on columns: ",h.error),n(h.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 h=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:[...t.props.columns];return f==="2"?{...u,columns:h}:{...d,columns:h}};return m.jsxs(_s,{title:o("inputs.panels.columns.title"),children:[a=="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsxs(Ni,{children:[m.jsx(In,{label:o("inputs.panels.columns.countLabel")}),m.jsx(Se,{sx:{...Bk,paddingLeft:0,paddingRight:0,height:"auto",minHeight:`${zl}px`},children:m.jsx(bM,{value:t.props?.columnsCount===2?"2":"3",onChange:f=>{const h=p(f);c({...t,props:{...t.props,...h}})},options:[{value:"2",label:"2",icon:m.jsx(bpe,{fontSize:"small"})},{value:"3",label:"3",icon:m.jsx(wpe,{fontSize:"small"})}]})})]}),m.jsx(Ppe,{columns:t.props?.columnsCount??3,defaultValue:t.props?.layout,fixedWidths:t.props?.fixedWidths??void 0,onChange:({layout:f,fixedWidths:h})=>{const g=t.props.columns.length===2?[...t.props.columns,{childrenIds:[]}]:t.props.columns;c({...t,props:{...t.props,layout:f,fixedWidths:h,columns:g}})}})]}),a=="css"&&m.jsxs(m.Fragment,{children:[m.jsxs(Ni,{children:[m.jsx(Lpe,{label:o("inputs.panels.columns.stackColumnsOnMobile"),tooltipTitle:o("inputs.panels.columns.stackColumnsOnMobileWarning")}),m.jsx(Se,{sx:{width:"100%",...Bk,paddingLeft:0,paddingRight:0,height:"auto",minHeight:`${zl}px`},children:m.jsx(bM,{value:t.props?.stackColumnsOnMobile?"stacked":"sideBySide",onChange:f=>{c({...t,props:{...t.props,stackColumnsOnMobile:f==="stacked"}})},options:[{value:"sideBySide",label:o("inputs.panels.columns.stackToggleSideBySide"),icon:m.jsx(Tpe,{fontSize:"small"})},{value:"stacked",label:o("inputs.panels.columns.stackToggleStacked"),icon:m.jsx(Epe,{fontSize:"small"})}]})})]}),m.jsx(Mpe,{data:t,updateData:e}),m.jsx(Rr,{names:["backgroundColor","background","padding","mobilePadding"],value:t.style,onChange:f=>c({...t,style:f})})]})]})}const vM=nt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),EM=vt({top:Pe(),bottom:Pe(),right:Pe(),left:Pe()}).optional().nullable(),Bpe=vt({topLeft:Pe().min(0).optional(),topRight:Pe().min(0).optional(),bottomLeft:Pe().min(0).optional(),bottomRight:Pe().min(0).optional()}),SM={position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center"},$pe=vt({style:vt({backgroundColor:vM,background:nt().nullable().optional(),borderColor:vM,borderRadius:Pe().optional().nullable(),borderTop:Pe().optional().nullable(),borderBottom:Pe().optional().nullable(),borderLeft:Pe().optional().nullable(),borderRight:Pe().optional().nullable(),borderTopMobile:Pe().optional().nullable(),borderBottomMobile:Pe().optional().nullable(),borderLeftMobile:Pe().optional().nullable(),borderRightMobile:Pe().optional().nullable(),shape:Gd([Wn(["rectangle","pill"]),Bpe]).optional().nullable(),padding:EM,mobilePadding:EM}).passthrough().optional().nullable()}).passthrough();function S8({style:t,children:e,blockId:n}){const i=_i(),r=bA(),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:ef(i=="desktop"?t?.padding:t?.mobilePadding??t?.padding)},s=t?.background??"",o=t?.backgroundColor,l=o?Mu(s,o):s,c=xA(t),u=jt(n);return e?m.jsx(Jr,{className:`${u}`,background:l,backgroundColor:t?.backgroundColor,borderRadius:c,padding:a.padding,width:"100%",border:a.border,children:m.jsxs(m.Fragment,{children:[r.uploading&&r.id===n&&m.jsx("div",{style:SM,children:m.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:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}),e]})}):m.jsx(Jr,{className:`${u}`,background:l,backgroundColor:o,borderRadius:c,padding:a.padding,width:"100%",border:a.border,children:m.jsx("div",{children:r.uploading&&r.id===n&&m.jsx("div",{style:SM,children:m.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:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})})})}const C8=vt({style:$pe.shape.style,props:vt({childrenIds:Hd(nt()).optional().nullable()}).optional().nullable(),blockId:nt().optional(),isNotClient:Za().optional()}).passthrough();function T8({data:t,setData:e}){const[,n]=A.useState(null),{t:i}=Qe.useTranslation("inspector"),r=a=>{const s=C8.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return m.jsx(_s,{title:i("inputs.panels.container.title"),children:m.jsx(Rr,{names:["backgroundColor","background","border","borderMobile","shape","padding","mobilePadding"],value:t.style,shapeSteps:30,onChange:a=>r({...t,style:a})})})}const Upe=nt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),CM=vt({top:Pe(),bottom:Pe(),right:Pe(),left:Pe()}).optional().nullable(),x8=vt({style:vt({background:nt().nullable().optional(),backgroundColor:Upe,padding:CM,mobilePadding:CM,height:Pe().optional().nullable(),heightMobile:Pe().optional().nullable(),color:nt().optional().nullable(),width:Pe().optional().nullable(),widthMobile:Pe().optional().nullable(),textAlign:nt().optional().nullable(),textAlignMobile:nt().optional().nullable()}).passthrough().optional().nullable()}).passthrough(),Dc={height:1,color:"#333333",width:100,textAlign:"left"};function k8({style:t,blockId:e}){const n=_i(),i=ef(n==="desktop"?t?.padding:t?.mobilePadding??t?.padding),r=n==="desktop"?t?.height??Dc.height:t?.heightMobile??t?.height??Dc.height,a=t?.color??Dc.color,s=n==="desktop"?(t?.width??Dc.width)+"%":(t?.widthMobile??t?.width??Dc.width)+"%",o=n==="desktop"?t?.textAlign??Dc.textAlign:t?.textAlignMobile??t?.textAlign??Dc.textAlign,l=t?.background??"",c=t?.backgroundColor??"",u=c?Mu(l,c):l,d=jt(e);return m.jsx(Jr,{className:`c${d}`,background:u,backgroundColor:c,width:"100%",padding:i,align:o,lineHeight:0,fontSize:0,children:m.jsx(Jr,{display:"inline-block",className:`${d}`,background:a,backgroundColor:c,width:s,padding:{top:r,bottom:0,left:0,right:0},isParent:!1,lineHeight:0,fontSize:0,children:m.jsx("div",{style:{margin:0,padding:0,height:0,overflow:"hidden",fontSize:0,lineHeight:0}})})})}function w8({data:t,setData:e}){const[,n]=A.useState(null),{t:i}=Qe.useTranslation("inspector"),r=a=>{const s=x8.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return m.jsx(_s,{title:i("inputs.panels.divider.title"),children:m.jsx(Rr,{names:["width","widthMobile","height","heightMobile","color","backgroundColor","textAlign","textAlignMobile","padding","mobilePadding"],value:t.style,onChange:a=>r({...t,style:a})})})}const zf=nt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),D8=vt({backdropColor:zf,borderColor:zf,borderRadius:Pe().optional().nullable(),canvasColor:zf,textColor:zf,fontFamily:Jp,childrenIds:Hd(nt()).optional().nullable(),linkGlobal:vt({linkColor:zf,underline:Za()}).optional().nullable(),showVersion:Za().optional().nullable()}),zpe=({label:t,linkColor:e,underline:n=!1,onChange:i})=>{const[r,a]=A.useState(e??"#FF0000"),[s,o]=A.useState(n),{t:l}=Qe.useTranslation("inspector"),c=t??l("inputs.links.color"),u=s?"enabled":"disabled",d={container:{width:"100%"}};A.useEffect(()=>{e!==r&&a(e??"#FF0000")},[e]),A.useEffect(()=>{n!==s&&o(n)},[n]);const p=h=>{const g=h??"#FF0000";a(g),i({linkColor:g,underline:s})},f=(h,g)=>{if(!g)return;const _=g==="enabled";o(_),i({linkColor:r,underline:_})};return m.jsxs(Ni,{children:[m.jsx(Zc,{label:c,defaultValue:r,onChange:p}),m.jsx(In,{label:l("inputs.links.underline")}),m.jsx(Se,{sx:d.container,children:m.jsxs(Qp,{value:u,exclusive:!0,fullWidth:!0,onChange:f,sx:{width:"100%"},children:[m.jsx(_n,{value:"enabled",children:m.jsx(hn,{title:l("inputs.links.underlineOn"),children:m.jsx(Se,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:m.jsx(e8,{fontSize:"small"})})})}),m.jsx(_n,{value:"disabled",children:m.jsx(hn,{title:l("inputs.links.underlineOff"),children:m.jsx(Se,{component:"span",sx:{display:"inline-flex",alignItems:"center",justifyContent:"center"},children:m.jsx(JU,{fontSize:"small"})})})})]})})]})},Hpe="email-builder-online",Gpe="3.6.2",U1={name:Hpe,version:Gpe};function A8({data:t,setData:e}){const[,n]=A.useState(null),{t:i}=Qe.useTranslation("inspector"),r=zce(),a=s=>{const o=D8.safeParse(s);o.success?(e(o.data),n(null)):n(o.error)};return m.jsxs(_s,{title:i("inputs.panels.emailLayout.title"),children:[m.jsx(Zc,{label:i("inputs.panels.emailLayout.backgroundColor"),defaultValue:t.backdropColor??"#F5F5F5",onChange:s=>a({...t,backdropColor:s})}),m.jsx(Zc,{label:i("inputs.panels.emailLayout.canvasColor"),defaultValue:t.canvasColor??"#FFFFFF",onChange:s=>a({...t,canvasColor:s})}),m.jsx(v8,{label:i("inputs.panels.emailLayout.fontFamily"),defaultValue:t.fontFamily||Tue.FAMILY,onChange:s=>a({...t,fontFamily:s})}),m.jsx(Zc,{label:i("inputs.panels.emailLayout.textColor"),defaultValue:t.textColor??"#262626",onChange:s=>a({...t,textColor:s})}),m.jsx(zpe,{label:i("inputs.panels.emailLayout.linksLabel"),linkColor:t.linkGlobal?.linkColor||"#000000",underline:t.linkGlobal?.underline||!1,onChange:s=>a({...t,linkGlobal:s})}),r&&m.jsx(Se,{color:"text.secondary",sx:{display:"flex",justifyContent:"flex-end",mt:2},children:m.jsxs(Se,{sx:{textAlign:"right"},children:[m.jsxs(mn,{variant:"body2",children:[i("inputs.panels.emailLayout.version"),": ",U1.version]}),m.jsx(mae,{href:`https://www.npmjs.com/package/${U1.name}`,target:"_blank",rel:"noopener noreferrer",sx:{fontSize:"0.875rem",mt:.5,display:"inline-block"},children:U1.name})]})})]})}const TM=nt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),jpe=vt({top:Pe(),bottom:Pe(),right:Pe(),left:Pe()}).optional().nullable(),qpe=t=>t?`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`:void 0,N8=vt({props:vt({text:nt().optional().nullable(),level:Wn(["h1","h2","h3"]).optional().nullable()}).optional().nullable(),style:vt({color:TM,backgroundColor:TM,fontFamily:Jp,fontWeight:Wn(["bold","normal"]).optional().nullable(),textAlign:Wn(["left","center","right"]).optional().nullable(),padding:jpe}).passthrough().optional().nullable()}),ay={level:"h2",text:""};function R8({props:t,style:e}){const n=t?.level??ay.level,i=t?.text??ay.text,r={color:e?.color??void 0,backgroundColor:e?.backgroundColor??void 0,fontWeight:e?.fontWeight??"bold",textAlign:e?.textAlign??void 0,margin:0,fontFamily:Zl(e?.fontFamily),fontSize:Vpe(n),padding:qpe(e?.padding)};switch(n){case"h1":return m.jsx("h1",{style:r,children:i});case"h2":return m.jsx("h2",{style:r,children:i});case"h3":return m.jsx("h3",{style:r,children:i})}}function Vpe(t){switch(t){case"h1":return 32;case"h2":return 24;case"h3":return 20}}function Wpe({data:t,setData:e}){const[,n]=A.useState(null),{t:i}=Qe.useTranslation("inspector"),r=s=>{const o=N8.safeParse(s);o.success?(e(o.data),n(null)):n(o.error)},a=Xo();return m.jsxs(_s,{title:i("inputs.panels.heading.title"),children:[a=="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsx(mp,{label:i("inputs.panels.heading.contentLabel"),rows:3,defaultValue:t.props?.text??ay.text,onChange:s=>{r({...t,props:{...t.props,text:s}})}}),m.jsxs(Pu,{label:i("inputs.panels.heading.levelLabel"),defaultValue:t.props?.level??ay.level,onChange:s=>{r({...t,props:{...t.props,level:s}})},children:[m.jsx(_n,{value:"h1",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(cde,{fontSize:"small"}),m.jsx("span",{children:"H1"})]})}),m.jsx(_n,{value:"h2",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(ude,{fontSize:"small"}),m.jsx("span",{children:"H2"})]})}),m.jsx(_n,{value:"h3",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(lde,{fontSize:"small"}),m.jsx("span",{children:"H3"})]})})]})]}),m.jsx(Rr,{names:["color","backgroundColor","fontFamily","fontWeight","textAlign","padding","mobilePadding"],value:t.style,onChange:s=>r({...t,style:s})})]})}const xM=nt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),Ype=vt({top:Pe(),bottom:Pe(),right:Pe(),left:Pe()}).optional().nullable(),Kpe=t=>t?`${t.top}px ${t.right}px ${t.bottom}px ${t.left}px`:void 0,I8=vt({style:vt({color:xM,backgroundColor:xM,fontFamily:Jp,fontSize:Pe().min(0).optional().nullable(),textAlign:Wn(["left","right","center"]).optional().nullable(),padding:Ype}).passthrough().optional().nullable(),props:vt({contents:nt().optional().nullable()}).optional().nullable()});function O8({style:t,props:e}){const n=e?.contents,i={color:t?.color??void 0,backgroundColor:t?.backgroundColor??void 0,fontFamily:Zl(t?.fontFamily),fontSize:t?.fontSize??void 0,textAlign:t?.textAlign??void 0,padding:Kpe(t?.padding)};return n?m.jsx("div",{style:i,dangerouslySetInnerHTML:{__html:n}}):m.jsx("div",{style:i})}function Qpe({data:t,setData:e}){const[,n]=A.useState(null),{t:i}=Qe.useTranslation("inspector"),r=s=>{const o=I8.safeParse(s);o.success?(e(o.data),n(null)):n(o.error)},a=Xo();return m.jsxs(_s,{title:i("inputs.panels.html.title"),children:[a=="block-configuration"&&m.jsx(m.Fragment,{children:m.jsx(mp,{label:i("inputs.panels.html.contentLabel"),rows:5,defaultValue:t.props?.contents??"",onChange:s=>r({...t,props:{...t.props,contents:s}})})}),m.jsx(Rr,{names:["color","backgroundColor","fontFamily","fontSize","textAlign","padding","mobilePadding"],value:t.style,onChange:s=>r({...t,style:s})})]})}const Xpe=vt({topLeft:Pe().min(0).optional(),topRight:Pe().min(0).optional(),bottomLeft:Pe().min(0).optional(),bottomRight:Pe().min(0).optional()}),RA=vt({style:vt({padding:ry,mobilePadding:ry,background:nt().nullable().optional(),backgroundColor:nt().regex(/^#[0-9a-fA-F]{6}$/).optional().nullable(),textAlign:Wn(["center","left","right"]).optional().nullable(),textAlignMobile:Wn(["center","left","right"]).optional().nullable(),shape:Gd([Wn(["rectangle","pill"]),Xpe]).optional().nullable()}).passthrough(),props:vt({touched:Za().optional().nullable(),scale:Pe().optional().nullable(),size:nt().optional().nullable(),sizeMobile:nt().optional().nullable(),width:Pe().optional().nullable(),widthMobile:Pe().optional().nullable(),scaleMobile:Pe().optional().nullable(),touchedMobile:Za().optional().nullable(),original_width:Pe().optional().nullable(),height:Pe().optional().nullable(),url:nt().optional().nullable(),alt:nt().optional().nullable(),linkHref:nt().optional().nullable(),contentAlignment:Wn(["top","middle","bottom"]).optional().nullable()}).optional().nullable()}).passthrough();function M8({style:t,props:e,blockId:n,isNotClient:i=!1}){const r=_i(),a=bA(),o=!Vv()&&!i,l={padding:ef(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??"",h=t?.backgroundColor,g=h?Mu(f,h):f,_=E=>{const v=E.currentTarget;setTimeout(()=>{if(!e?.width&&v.offsetWidth){const T=v.offsetWidth;Vce(n,{...e,width:T})}},100)},b=m.jsxs(m.Fragment,{children:[m.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:xA(t)}}),a.uploading&&a.id===n&&m.jsx("div",{style:p,children:m.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:m.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})})]}),y=jt(n);return u?m.jsx(Jr,{className:`${y}`,padding:l.padding,background:g,align:l.textAlign,width:"100%",children:m.jsx("a",{href:o?void 0:TA(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})}):m.jsx(Jr,{className:`${y}`,padding:l.padding,background:g,align:l.textAlign,width:"100%",children:b})}const Jpe=(t,e,n)=>{const i=_i();A.useEffect(()=>{const r=()=>{if(!t||!document||i=="mobile")return;const o=jt(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(`.${jt(t)}`);return s?.parentElement&&a.observe(s.parentElement),()=>{a.disconnect()}},[t,e,n,i])},Zpe=({data:t,setData:e,blockId:n})=>{const{t:i}=Qe.useTranslation("inspector"),[r,a]=A.useState(!1),[s,o]=A.useState(()=>!!window.__emailBuilderEnableAI),[,l]=A.useState(null),[c,u]=A.useState(""),[d,p]=A.useState(!1),[f,h]=A.useState(""),[g,_]=A.useState(!1),b=A.useRef(null),y=yA(),[E,v]=A.useState(null);A.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 $=RA.safeParse(P);$.success?(e($.data),l(null)):l($.error)},S=(P,$)=>{const U=P.toLowerCase(),G=U.includes(".svg")||U.includes("svg"),V=$&&($.includes("image/svg+xml")||$.includes("svg"));return G||!!V},C=async P=>{try{p(!0),h(""),_(!1);try{new URL(P)}catch{return h(i("inputs.image.invalidUrl")),!1}const $=new AbortController,U=setTimeout(()=>$.abort(),1e4);try{const G=await fetch(P,{method:"HEAD",signal:$.signal});if(clearTimeout(U),!G.ok)return h(i("inputs.image.httpError",{status:G.status,statusText:G.statusText})),!1;const V=G.headers.get("content-type");return["image/","image/svg+xml","text/xml","application/xml"].some(Te=>V&&V.toLowerCase().includes(Te.toLowerCase()))?(S(P,V)&&_(!0),h(""),!0):(h(i("inputs.image.notImage")),!1)}catch(G){return clearTimeout(U),G.name==="AbortError"?(h(i("inputs.image.timeout")),!1):new Promise(V=>{const K=new Image,te=setTimeout(()=>{h(i("inputs.image.timeout")),V(!1)},1e4);K.onload=()=>{clearTimeout(te),S(P)&&_(!0),h(""),V(!0)},K.onerror=()=>{clearTimeout(te),h(i("inputs.image.loadError")),V(!1)},K.src=P})}}catch{return h(i("inputs.image.unexpectedError")),!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&&h(""),g&&_(!1)},D=P=>{const $=["image/png","image/jpeg","image/gif"],G=P.filter(K=>$.includes(K.type)&&K.size<=5242880);if(G.length!==P.length&&alert(i("inputs.common.invalidFiles")),G.length===0)return;const V=G.map(K=>new Promise(te=>{const Te=new FileReader;Te.onload=de=>te(de.target?.result),Te.readAsDataURL(K)}));Promise.all(V).then(K=>{const te={images:K,id:n||""};window.dispatchEvent(new CustomEvent("email-builder-upload-image",{detail:te})),zd(!0,n||"")})},L=P=>{P.preventDefault(),a(!0)},I=P=>{const $=P.currentTarget.getBoundingClientRect(),U=P.clientX,G=P.clientY;(U<$.left||U>=$.right||G<$.top||G>=$.bottom)&&a(!1)},O=P=>{P.preventDefault(),a(!1);const $=Array.from(P.dataTransfer.files);$.length>0&&D($)},M=()=>{const P=new CustomEvent("toggle-media-library",{detail:!0});window.dispatchEvent(P)};return A.useEffect(()=>{const P=window.__emailBuilderEnableAI;P!==void 0&&o(!!P);const $=U=>{const{detail:G}=U;o(!!G)};return window.addEventListener("email-builder-ai-generation",$),()=>{window.removeEventListener("email-builder-ai-generation",$)}},[]),A.useEffect(()=>{const P=V=>{const{detail:K}=V;zd(!1,K.id||""),T({...t,props:{...t.props,url:K.url}}),xU(!1)},$=V=>{zd(V?.detail?.uploading??!1,V?.detail?.id??"")},U=()=>{b?.current?.click()},G=V=>{const{detail:K}=V;T({...t,props:{...t.props,url:K}})};return window.addEventListener("email-builder-set-image",G),window.addEventListener("email-builder-upload-image-receive",P),window.addEventListener("email-builder-upload-file",U),window.addEventListener("email-builder-toggle-upload-file",$),()=>{window.removeEventListener("email-builder-toggle-upload-file",$),window.removeEventListener("email-builder-upload-image-receive",P),window.removeEventListener("email-builder-set-image",G),window.removeEventListener("email-builder-upload-file",U)}},[t]),A.useEffect(()=>{t.props?.url&&_(S(t.props.url))},[t.props?.url]),m.jsxs(gn,{gap:1,children:[E?m.jsx(Se,{sx:{mb:2},children:E}):m.jsx("div",{style:{display:"flex",gap:8},children:y?m.jsxs(Ni,{children:[m.jsx(In,{label:i("inputs.image.urlLabel")}),m.jsxs(gn,{direction:"row",spacing:1,children:[m.jsx(Kp,{fullWidth:!0,placeholder:i("inputs.image.urlPlaceholder"),value:c,onChange:w,onKeyPress:k,error:!!f,disabled:d,sx:{...Qv,"& .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"}}}}),m.jsx(Vi,{variant:"contained",onClick:x,disabled:!c.trim()||d,sx:{minWidth:"auto",px:2,position:"relative"},children:d?m.jsx(Xl,{size:20,color:"inherit"}):i("inputs.common.add")})]}),f&&m.jsx(Ul,{severity:"error",sx:{mt:1,fontSize:"0.875rem","& .MuiAlert-message":{padding:"4px 0",display:"flex",flexDirection:"column",justifyContent:"space-around"}},children:f}),g&&m.jsx(Ul,{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:m.jsx(Rn,{"aria-label":i("inputs.common.close"),color:"inherit",size:"small",onClick:()=>{_(!1)},children:m.jsx(Yv,{fontSize:"inherit"})}),children:i("inputs.common.svgWarning")}),m.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"}})]}):m.jsxs(m.Fragment,{children:[m.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"}}),m.jsxs(Se,{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:[m.jsx(Se,{sx:{display:"flex",justifyContent:"center",mb:2},children:m.jsx(l8,{sx:{fontSize:32,color:"primary"}})}),m.jsxs("label",{style:{cursor:"pointer"},children:[m.jsx("input",{ref:b,type:"file",style:{display:"none"},accept:"image/png,image/jpeg,image/gif",multiple:!0,onChange:P=>{const $=P.target.files;$&&$.length>0&&D(Array.from($))}}),m.jsx(mn,{component:"span",sx:{fontWeight:"bold",color:"primary.main","&:hover":{fontWeight:"bold",color:"primary.secondary"}},children:i("inputs.common.uploadFile")}),m.jsxs(mn,{component:"span",sx:{fontWeight:"bold",color:"text.secondary"},children:[" ",i("inputs.common.dragAndDrop")]})]}),m.jsx(mn,{variant:"body2",sx:{color:"text.secondary",mt:1},children:i("inputs.common.fileInfo")})]})]})}),!E&&!y&&g&&m.jsx(Ul,{severity:"warning",sx:{fontSize:"0.875rem","& .MuiAlert-message":{padding:"4px 0",display:"flex",flexDirection:"column",justifyContent:"space-around"}},children:i("inputs.common.svgWarning")}),(!E&&(Vb()&&!y||s)||E&&s)&&m.jsxs(gn,{direction:"row",alignItems:"center",spacing:1,children:[m.jsx(dr,{sx:{flexGrow:1}}),m.jsx(mn,{sx:{color:"text.secondary"},children:i("inputs.backgroundImage.or")}),m.jsx(dr,{sx:{flexGrow:1}})]}),m.jsx(m.Fragment,{children:m.jsxs(gn,{flexDirection:"row",gap:2,children:[!E&&Vb()&&!y&&m.jsx(Vi,{variant:"outlined",onClick:M,startIcon:m.jsx(a8,{}),sx:{color:"mainColor.main",borderColor:"mainColor.light","&:hover":{borderColor:"mainColor.main",backgroundColor:"action.hover"}},style:{width:"100%"},children:i("inputs.backgroundImage.browseGallery")}),s&&m.jsx(b8,{src:t.props?.url,style:{width:"100%",margin:0}})]})})]})},efe=({defaultValue:t="original",scale:e=100,onChange:n})=>{const[i,r]=A.useState(t),[a,s]=A.useState(e),o=sn(),{t:l}=Qe.useTranslation("inspector"),c={container:{width:"100%"},label:{color:o.palette.text.primary},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}};A.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 m.jsxs(Ni,{children:[m.jsx(In,{label:l("inputs.sizeSelector.label")}),m.jsxs(Se,{sx:c.container,children:[m.jsxs(Qp,{value:i,exclusive:!0,onChange:u,sx:{width:"100%"},children:[m.jsx(_n,{value:"original",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(VU,{fontSize:"small"}),m.jsx("span",{children:l("inputs.sizeSelector.contain")})]})}),m.jsx(_n,{value:"fill",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(HU,{fontSize:"small"}),m.jsx("span",{children:l("inputs.sizeSelector.cover")})]})}),m.jsx(_n,{value:"scale",children:m.jsxs(Se,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:.75},children:[m.jsx(fde,{fontSize:"small"}),m.jsx("span",{children:l("inputs.sizeSelector.scale")})]})})]}),m.jsx(GD,{in:i==="scale",children:m.jsx(Se,{sx:c.sliderContainer,children:m.jsx(di,{iconLabel:m.jsx(wde,{}),value:a,setValue:d,marks:!1,units:"%",min:1,max:100})})})]})]})};function tfe({data:t,setData:e}){const[n,i]=A.useState(null),r=rg(),a=Xo(),s=_i(),{t:o}=Qe.useTranslation("inspector");Jpe(r||"",e,t),A.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=A.useCallback(g=>{const _=RA.safeParse(g);_.success?JSON.stringify(t)!==JSON.stringify(_.data)&&(e(_.data),i(null)):i(_.error)},[t,e]),c=A.useCallback((g,_,b)=>{const y=Ipe(r)||Od,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=A.useCallback((g,_)=>{const b=c(t,g,_);l({...t,props:b})},[t,l,c]),d=A.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=A.useCallback(g=>{l({...t,props:{...t.props,alt:g}})},[t,l]),f=A.useCallback(g=>{const _=g.trim().length===0?null:g.trim();l({...t,props:{...t.props,linkHref:_}})},[t,l]),h=A.useCallback(g=>{l({...t,style:g})},[t,l]);return m.jsxs(_s,{title:o("inputs.panels.image.title"),children:[a==="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsx(Zpe,{data:t,setData:e,blockId:r}),m.jsx(mp,{label:o("inputs.panels.image.altLabel"),placeholder:o("inputs.panels.image.altPlaceholder"),defaultValue:t.props?.alt??"",onChange:p}),m.jsx(mp,{label:o("inputs.panels.image.urlLabel"),placeholder:o("inputs.panels.image.urlPlaceholder"),defaultValue:t.props?.linkHref??"",onChange:f}),m.jsx(efe,{defaultValue:d.size,scale:d.scale??void 0,onChange:g=>u(g,s!=="desktop")})]}),m.jsx(Rr,{names:["textAlign","textAlignMobile","backgroundColor","shape","padding","mobilePadding"],value:t.style,shapeMaxValue:300,shapeSteps:20,onChange:h})]})}const kM=nt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),wM=vt({top:Pe(),bottom:Pe(),right:Pe(),left:Pe()}).optional().nullable(),P8=vt({style:vt({color:kM,backgroundColor:kM,background:nt().nullable().optional(),fontSize:Pe().gte(0).optional().nullable(),fontFamily:Jp,fontWeight:Wn(["bold","normal"]).optional().nullable(),textAlign:Wn(["left","center","right"]).optional().nullable(),textAlignMobile:Wn(["left","center","right"]).optional().nullable(),padding:wM,mobilePadding:wM,optionSize:Wn(["small","medium","large"]).optional().nullable(),theme:Wn(["light","dark","colored"]).optional().nullable()}).passthrough().optional().nullable(),gap:Pe().optional(),items:Hd(vt({id:nt(),key:nt(),label:nt(),iconName:nt(),theme:nt(),size:nt(),sizePx:nt(),url:nt(),href:nt().optional().nullable()})),gapMobile:Pe().optional()}).passthrough();function L8({style:t,items:e,blockId:n,gap:i=1,gapMobile:r,isNotClient:a=!1}){const s=_i(),o=t?.background??"",l=t?.backgroundColor,c=l?Mu(o,l):o,u=(s==="desktop"?t?.textAlign:t?.textAlignMobile??t?.textAlign)??void 0,d={background:c,backgroundColor:t?.backgroundColor,textAlign:u,padding:ef(s==="desktop"?t?.padding:t?.mobilePadding??t?.padding)},p=s==="desktop"?i:r??i,f=jt(n),g=!Vv()&&!a;return m.jsx(nfe,{blockId:`${f}`,items:e,wStyle:d,gap:p,guardLinksWhileEditingOnCanvas:g})}const nfe=({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 m.jsx(Jr,{className:e,background:n.background,backgroundColor:n.backgroundColor,padding:n?.padding,align:n.textAlign,width:"100%",children:m.jsx("table",{className:"sm-icons-table",style:{borderCollapse:"collapse",display:"inline-block",lineHeight:0,verticalAlign:"top"},border:0,cellSpacing:"0",cellPadding:"0",children:m.jsx("tbody",{children:m.jsx("tr",{style:{verticalAlign:"top"},children:t.map((s,o)=>{const l=a(o);return m.jsxs(A.Fragment,{children:[l!=="first"&&m.jsx("td",{className:`gap-${e}`,width:Math.ceil(i/2),style:{lineHeight:0,verticalAlign:"top"}}),m.jsx("td",{id:`${s.id}-${s.url}`,width:s.sizePx,style:{lineHeight:0,textAlign:"center",verticalAlign:"top",whiteSpace:"nowrap"},children:m.jsx("a",{target:"_blank",href:r?void 0:TA(s.href),onClick:r?c=>c.preventDefault():void 0,style:{display:"block",lineHeight:0,textDecoration:"none",pointerEvents:r?"none":void 0},children:m.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"&&m.jsx("td",{className:`gap-${e}`,width:Math.ceil(i/2),style:{lineHeight:0,verticalAlign:"top"}})]},s.id)})})})})})},ife="https://maildrill-dev.s3.us-east-2.amazonaws.com/icons/",rfe={positive:!0,original:!0,negative:!0},afe={small:!0,medium:!0,large:!0,xlarge:!0},W={theme:"positive",size:"medium"},rn=(t,e,n="medium")=>{const i=IA.find(a=>a.key===n)?.value,r=F8.find(a=>a.key===e)?.value;return`${ife}${t}_${r}_${i}.png`},En=t=>IA.find(e=>e.key===t)?.value||"36px",IA=[{value:"24px",key:"small",label:"Small"},{value:"36px",key:"medium",label:"Medium"},{value:"48px",key:"large",label:"Large"}],F8=[{value:"Positive",key:"positive",label:"Light"},{value:"Original",key:"original",label:"Color"},{value:"Negative",key:"negative",label:"Dark"}],nb=[{key:"facebook",label:"Facebook",iconName:"Facebook",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("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:En(W.size),url:rn("Web",W.theme,W.size),href:"https://www.google.com"},{key:"mail",label:"Mail",iconName:"Mail",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Mail",W.theme,W.size),href:"https://mail.google.com/"},{key:"apple",label:"Apple",iconName:"Apple",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Apple",W.theme,W.size),href:"https://www.apple.com/"},{key:"bluesky",label:"Bluesky",iconName:"Bluesky",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Bluesky",W.theme,W.size),href:"https://bsky.app/"},{key:"clubhouse",label:"ClubHouse",iconName:"Clubhouse",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Clubhouse",W.theme,W.size),href:"https://www.clubhouse.com/"},{key:"dribbble",label:"Dribbble",iconName:"Dribbble",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Dribbble",W.theme,W.size),href:"https://dribbble.com/"},{key:"figma",label:"Figma",iconName:"Figma",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Figma",W.theme,W.size),href:"https://www.figma.com/"},{key:"github",label:"Github",iconName:"Github",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Github",W.theme,W.size),href:"https://github.com/"},{key:"google",label:"Google",iconName:"Google",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Google",W.theme,W.size),href:"https://google.com/"},{key:"instagram",label:"Instagram",iconName:"Instagram",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("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:En(W.size),url:rn("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:En(W.size),url:rn("Medium",W.theme,W.size),href:"https://medium.com/"},{key:"messenger",label:"Messenger",iconName:"Messenger",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Messenger",W.theme,W.size),href:"https://www.messenger.com/"},{key:"pinterest",label:"Pinterest",iconName:"Pinterest",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Pinterest",W.theme,W.size),href:"https://www.pinterest.com/"},{key:"reddit",label:"Reddit",iconName:"Reddit",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Reddit",W.theme,W.size),href:"https://www.reddit.com/"},{key:"signal",label:"Signal",iconName:"Signal",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Signal",W.theme,W.size),href:"https://signal.org/"},{key:"snapchat",label:"Snapchat",iconName:"Snapchat",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Snapchat",W.theme,W.size),href:"https://www.snapchat.com/"},{key:"spotify",label:"Spotify",iconName:"Spotify",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Spotify",W.theme,W.size),href:"https://www.spotify.com/"},{key:"telegram",label:"Telegram",iconName:"Telegram",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Telegram",W.theme,W.size),href:"https://t.me/your-profile"},{key:"threads",label:"Threads",iconName:"Threads",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Threads",W.theme,W.size),href:"https://www.threads.net/"},{key:"tiktok",label:"TikTok",iconName:"TikTok",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("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:En(W.size),url:rn("Tumblr",W.theme,W.size),href:"https://www.tumblr.com/"},{key:"twitch",label:"Twitch",iconName:"Twitch",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("Twitch",W.theme,W.size),href:"https://www.twitch.tv/"},{key:"vk",label:"VK",iconName:"VK",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("VK",W.theme,W.size),href:"https://vk.com/"},{key:"whatsapp",label:"WhatsApp",iconName:"WhatsApp",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("WhatsApp",W.theme,W.size),href:"https://www.whatsapp.com/"},{key:"x",label:"X",iconName:"X",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("X",W.theme,W.size),href:"https://x.com/your-profile"},{key:"youtube",label:"YouTube",iconName:"YouTube",theme:W.theme,size:W.size,sizePx:En(W.size),url:rn("YouTube",W.theme,W.size),href:"https://www.youtube.com/channel/your-channel-id"}];function sm(){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 sfe=({element:t,index:e,moveItem:n,onSelectChange:i,onUrlChange:r,onRemove:a,onDuplicate:s,canRemove:o,theme:l})=>{const c=A.useRef(null),[u,d]=A.useState(null),{t:p}=Qe.useTranslation("inspector"),f=k=>{const w=k.getClientOffset(),D=c.current?.getBoundingClientRect();if(!w||!D)return null;const L=(D.bottom-D.top)/2;return w.y-D.top<L?"up":"down"},[{handlerId:h,isOver:g},_]=Ql.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 D=k.index,L=e;if(D===L)return;const I=f(w);let O=L;I==="down"&&(O=L+1),D<O&&(O=O-1),setTimeout(()=>{n(D,O)},0),k.index=O},end:()=>{d(null)}}),[t.id,e,n]),[{isDragging:b},y]=Ql.useDrag(()=>({type:"social-media-item",item:()=>({id:t.id,index:e}),collect:k=>({isDragging:k.isDragging()}),end:()=>{d(null)}}),[t.id,e]);A.useEffect(()=>{g||d(null)},[g]);const E=b?.4:1;A.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=()=>m.jsxs("div",{style:{height:"3px",background:l.palette.secondary.main,position:"relative",color:l.palette.secondary.main,margin:"4px 0"},children:[m.jsx("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:m.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"})}),m.jsx("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:m.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 m.jsxs(m.Fragment,{children:[u==="up"&&m.jsx(x,{}),m.jsxs(gn,{ref:c,"data-handler-id":h,sx:{border:1,borderColor:"divider",padding:1,paddingTop:0,borderRadius:1,backgroundColor:"background.paper",marginBottom:1.5,opacity:E,cursor:b?"grabbing":"grab",boxShadow:b?l.shadows[3]:"none"},gap:1,children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:`1px solid ${l.palette.divider}`},children:[m.jsx("div",{style:{display:"flex",alignItems:"center"},children:m.jsx(jU,{sx:{color:b?"primary.main":"text.secondary",cursor:"grab",marginLeft:-.9,"&:hover":{color:"primary.main"}}})}),m.jsxs("div",{children:[m.jsx(hn,{title:"Duplicate",placement:"left",children:m.jsx(Rn,{color:"primary",size:"small",onClick:T,children:m.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.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&&m.jsx(hn,{title:"Remove",placement:"left",children:m.jsx(Rn,{color:"error",size:"small",onClick:v,children:m.jsx(Vue,{sx:{fontSize:20}})})})]})]}),m.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",gap:"0.5rem"},children:[m.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[m.jsx(In,{label:p("inputs.social.icon")}),m.jsx(ec,{fullWidth:!0,labelId:"demo-simple-select-label",id:"demo-simple-select",value:t.key,size:"small",onChange:S,children:nb.map(k=>m.jsx(Xa,{value:k.key,children:k.label},`${t.id}_${k.key}`))})]}),m.jsxs("div",{style:{display:"grid",gridTemplateColumns:"40px auto",gap:"4px",alignItems:"center"},children:[m.jsx(In,{label:p("inputs.social.url")}),m.jsx(Kp,{size:"small",fullWidth:!0,value:t.href??"",onChange:C,variant:"outlined",placeholder:"https://your-website.com",sx:Qv})]})]})]}),u==="down"&&m.jsx(x,{})]})};function ofe({items:t=[],onChange:e}){const{t:n}=Qe.useTranslation("inspector"),i=sn(),[r,a]=A.useState(()=>t.map(_=>({..._,id:_.id||sm()}))),[s,o]=A.useState(t[0]?.theme||"positive"),[l,c]=A.useState(t[0]?.size||"medium");A.useEffect(()=>{t.length>0&&(o(t[0].theme),c(t[0].size),a(t.map(_=>({..._,id:_.id||sm()}))))},[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={...nb[0],theme:s,size:l,sizePx:En(l),url:rn(nb[0].iconName,s,l),id:sm()},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 rfe?(o(b),E=E.map(v=>{const T=rn(v.iconName,b,v.size);return{...v,theme:b,url:T}})):b in afe&&(c(b),E=E.map(v=>{const T=rn(v.iconName,v.theme,b),S=En(b);return{...v,size:b,sizePx:S,url:T}})),_!==null&&y){const v=nb.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=rn(C.iconName,y.theme,y.size);return S===_?{...T,...C,url:x,id:y.id}:T}))}a(E),e&&setTimeout(()=>e(E),0)},h=(_,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:sm()},E=[...b.slice(0,_+1),y,...b.slice(_+1)];return e&&setTimeout(()=>e(E),0),E})};return m.jsxs(m.Fragment,{children:[m.jsxs("div",{style:{marginBottom:"1rem",display:"grid",gridTemplateColumns:"repeat(2,1fr)",gap:"1rem"},children:[m.jsxs(Ni,{children:[m.jsx(In,{label:n("inputs.social.theme")}),m.jsx(ec,{fullWidth:!0,labelId:"theme-selector",id:"theme-selector",value:s,size:"small",onChange:_=>f(null,_.target.value,null),children:F8.map(_=>m.jsx(Xa,{value:_.key,children:_.label},`${_.key}`))})]}),m.jsxs(Ni,{children:[m.jsx(In,{label:n("inputs.social.size")}),m.jsx(ec,{fullWidth:!0,labelId:"size-selector",id:"size-selector",value:l,size:"small",onChange:_=>f(null,_.target.value,null),children:IA.map(_=>m.jsx(Xa,{value:_.key,children:_.label},`${_.key}`))})]})]}),r?.map((_,b)=>m.jsx(sfe,{element:_,index:b,moveItem:u,onSelectChange:f,onUrlChange:h,onRemove:p,onDuplicate:g,canRemove:r.length>1,theme:i},_.id)),m.jsx(Vi,{onClick:d,sx:{borderRadius:1},variant:"contained",endIcon:m.jsx(LU,{}),children:"Add"})]})}const lfe=({data:t,setData:e})=>{const[,n]=A.useState(null),i=_i(),{t:r}=Qe.useTranslation("inspector"),a=u=>{const d=P8.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=Xo();return m.jsxs(_s,{title:r("inputs.panels.social.title"),children:[c=="block-configuration"&&m.jsx(Se,{sx:{minWidth:120,margin:1},children:m.jsx(ofe,{items:t?.items??[],onChange:s})}),c=="css"&&m.jsxs(m.Fragment,{children:[m.jsxs(Ni,{children:[m.jsx(In,{label:r("inputs.panels.social.gap")}),i=="desktop"?m.jsx(di,{iconLabel:m.jsx(JO,{sx:{color:"text.primary"}}),value:Number(t?.gap??4),setValue:u=>l(u,!1),marks:!0,step:4,units:"px",min:0,max:40}):m.jsx(di,{iconLabel:m.jsx(JO,{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})]}),m.jsx(Rr,{names:["textAlign","textAlignMobile","backgroundColor","padding","mobilePadding"],value:t.style,onChange:u=>o(u)})]})]})},cfe=nt().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),B8=vt({style:vt({height:Pe().optional().nullable(),heightMobile:Pe().optional().nullable(),background:nt().nullable().optional(),backgroundColor:cfe}).optional().nullable()}),DM={height:16};function $8({style:t,blockId:e}){const i=_i()==="desktop"?t?.height??DM.height:t?.heightMobile??t?.height??DM.height,r=t?.background??"",a=t?.backgroundColor??"",s=a?Mu(r,a):r,o={width:"100%",minWidth:"100%",backgroundColor:a||void 0,background:s||void 0},l=jt(e);return m.jsx("table",{className:l,width:"100%",style:o,children:m.jsx("tbody",{children:m.jsx("tr",{className:`it${l}`,style:{height:i},children:m.jsx("td",{})})})})}function U8({data:t,setData:e}){const[,n]=A.useState(null),{t:i}=Qe.useTranslation("inspector"),r=a=>{const s=B8.safeParse(a);s.success?(e(s.data),n(null)):n(s.error)};return m.jsx(_s,{title:i("inputs.panels.spacer.title"),children:m.jsx(Rr,{names:["height","heightMobile","backgroundColor"],value:t.style,onChange:a=>r({...t,style:a})})})}function ufe({data:t,setData:e}){const n=Xo(),{t:i}=Qe.useTranslation("inspector"),r=t.style||{},a=s=>{const o={...r||{},...s||{}};e({...t,style:o})};return m.jsxs(_s,{title:i("inputs.panels.notionText.title","Text"),children:[n==="block-configuration"&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{style:{display:"flex",gap:"8px"},children:[m.jsx("div",{style:{flex:1},children:m.jsx(Rr,{disabledCSSValidation:!0,names:["fontFamily"],value:r,onChange:a})}),m.jsx("div",{style:{flex:1},children:m.jsx(Rr,{disabledCSSValidation:!0,names:["lineHeight"],value:r,onChange:a})})]}),m.jsx(Rr,{disabledCSSValidation:!0,names:["fontSize","fontSizeMobile"],value:r,onChange:a})]}),n==="css"&&m.jsx(Rr,{names:["backgroundColor","border","borderMobile","padding","mobilePadding"],value:r,onChange:a})]})}function AM(t){return m.jsx(Se,{sx:{m:3,p:1,border:"1px dashed",borderColor:"divider"},children:m.jsx(mn,{color:"text.secondary",children:t})})}function dfe(){const t=rg(),e=SU(t||""),n=A.useCallback(a=>{t&&Wb(t,()=>a)},[t]);if(!t)return AM("Click on a block to inspect.");if(!e)return AM(`Block with id ${t} was not found. Click on a block to reset.`);const{data:i,type:r}=e;switch(r){case"Button":return m.jsx(mpe,{data:i,setData:a=>n({type:r,data:a})},t);case"ColumnsContainer":return m.jsx(Fpe,{data:i,setData:a=>n({type:r,data:a})},t);case"Container":return m.jsx(T8,{data:i,setData:a=>n({type:r,data:a})},t);case"Divider":return m.jsx(w8,{data:i,setData:a=>n({type:r,data:a})},t);case"Heading":return m.jsx(Wpe,{data:i,setData:a=>n({type:r,data:a})},t);case"Html":return m.jsx(Qpe,{data:i,setData:a=>n({type:r,data:a})},t);case"Image":return m.jsx(tfe,{data:i,setData:a=>n({type:r,data:a})},t);case"EmailLayout":return m.jsx(A8,{data:i,setData:a=>n({type:r,data:a})},t);case"Spacer":return m.jsx(U8,{data:i,setData:a=>n({type:r,data:a})},t);case"NotionText":return m.jsx(ufe,{data:i,setData:a=>n({type:r,data:a})},t);case"SocialMedia":return m.jsx(lfe,{data:i,setData:a=>n({type:r,data:a})},t);default:return m.jsx("pre",{children:JSON.stringify(e,null," ")})}}const pfe=A.memo(dfe),ffe={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"}},mfe=t=>e=>e.document[t];function hfe(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 z8(t,e,n){const i=hfe(t[e]);for(const r of i)if(r===n||z8(t,r,n))return!0;return!1}function gfe(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||z8(t,s,i))return!0;return!1}function _fe(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=ffe[l]??{label:l,iconName:"WidgetsOutlined"};if(l==="ColumnsContainer"){const p=o.data?.props?.columns,h=o.data?.props?.columnsCount===2?2:3,g=[];for(let _=0;_<h;_++){const b=p?.[_]?.childrenIds??[],y=Ale(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:h}})}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 bfe(t){return ae(t)}function yfe(t){return ae(mfe(t))}function vfe(){const t=rg(),e=yfe(t??"root"),n=A.useCallback(s=>{t&&Wb(t,()=>s)},[t]),i=A.useCallback(s=>{Wb("root",()=>s)},[]);if(!e)return null;const{data:r,type:a}=e;switch(a){case"Container":return m.jsx(T8,{data:r,setData:s=>n({type:a,data:s})},t);case"Divider":return m.jsx(w8,{data:r,setData:s=>n({type:a,data:s})},t);case"Spacer":return m.jsx(U8,{data:r,setData:s=>n({type:a,data:s})},t);case"EmailLayout":return m.jsx(A8,{data:r,setData:s=>i({type:a,data:s})},"root");default:return m.jsx("pre",{children:JSON.stringify(e,null," ")})}}function Efe({sticky:t,heightContent:e}){const n=Xo(),i=EU(),r=rg(),a=_i(),s=sn(),{t:o}=Qe.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 m.jsxs("div",{style:{position:"relative"},children:[m.jsx(Ob,{color:"primary",sx:f,label:`${o(a==="desktop"?"header.desktop":"header.mobile")}`}),m.jsx(pfe,{})]});case"styles":return m.jsxs("div",{style:{position:"relative"},children:[m.jsx(vfe,{}),m.jsx(Ob,{color:"primary",sx:f,label:`${o(a==="desktop"?"header.desktop":"header.mobile")}`})]})}},c=()=>m.jsx("svg",{style:{marginRight:"4px",color:"inherit"},width:"21",height:"20",viewBox:"0 0 21 20",fill:"none",children:m.jsx("path",{d:"M3.83398 5H17.1673M3.83398 10H17.1673M3.83398 15H9.66732",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),u=()=>m.jsx("svg",{style:{marginRight:"4px",color:"inherit"},width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:m.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"})});A.useEffect(()=>{const f=h=>{const g=h.target;RO(g.innerWidth)};return window&&RO(window.innerWidth),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[n]);const d=(f,h)=>{Dce(h)},p=t?e?`calc(${e} - ${pl})`:void 0:e??void 0;return m.jsxs(mh,{sx:f=>({width:Gb,padding:"0!important",margin:"0!important",height:p,maxHeight:p,display:"flex",flexDirection:"column",overflow:"hidden",position:t?"sticky":"static",top:t?pl:0,backgroundColor:`${f.palette.background.paper} !important`}),children:[m.jsx(Se,{sx:{position:"sticky",top:0,zIndex:1,backgroundColor:`${s.palette.background.paper} !important`},children:m.jsxs(tU,{sx:{backgroundColor:`${s.palette.background.paper} !important`},value:n,onChange:d,children:[r!=null&&!Fb.includes(i||"")&&[m.jsx(Gc,{sx:{height:pl,minHeight:pl,fontWeight:"bold"},value:"block-configuration",label:o("header.content"),icon:m.jsx(c,{}),iconPosition:"start"},"block-configuration"),m.jsx(Gc,{sx:{height:pl,minHeight:pl,fontWeight:"bold"},value:"css",label:o("header.styles"),icon:m.jsx(u,{}),iconPosition:"start"},"css")],Fb.includes(i)&&[m.jsx(Gc,{sx:{height:pl,minHeight:pl,fontWeight:"bold"},value:"styles",label:o("header.styles"),icon:m.jsx(u,{}),iconPosition:"start"},"styles")]]})}),m.jsx(mh,{sx:f=>({flex:"1 1 auto",minHeight:0,overflowY:"auto",px:2,backgroundColor:`${f.palette.background.paper} !important`}),children:l()})]})}const H8=({children:t,topOffset:e=0,zIndex:n=10,className:i="",style:r={},disabled:a=!1,threshold:s=null,...o})=>{const[l,c]=A.useState(!1),[u,d]=A.useState({width:0,height:0}),[p,f]=A.useState({left:0}),[h,g]=A.useState(0),[_,b]=A.useState(!1),y=A.useRef(null),E=A.useRef(null),v=A.useRef(null);A.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})},D=()=>{if(!k||!x)return{offset:0,isPushed:!1};const M=k.getBoundingClientRect(),P=x.getBoundingClientRect(),$=e+P.height;if(M.top<$){const U=$-M.top,G=P.height+20;return{offset:-Math.min(U,G),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:$,isPushed:U}=D();g($),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}=D();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+h}px`:"auto";return m.jsxs("div",{ref:v,className:i,...o,children:[!a&&m.jsx("div",{ref:E,style:{height:"1px",position:"absolute",top:`-${e+1}px`,left:0,right:0,pointerEvents:"none"}}),T&&m.jsx("div",{style:{height:`${u.height}px`,width:`${u.width}px`}}),m.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",..._&&h<-u.height*.3&&{opacity:Math.max(0,1+(h+u.height*.3)/(u.height*.7))},...r},children:t})]})};var G8=aU();function zi(t){this.content=t}zi.prototype={constructor:zi,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 zi(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 zi(n)},addToStart:function(t,e){return new zi([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new zi(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 zi(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=zi.from(t),t.size?new zi(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=zi.from(t),t.size?new zi(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=zi.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}};zi.from=function(t){if(t instanceof zi)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new zi(e)};function j8(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=j8(r.content,a.content,n+1);if(s!=null)return s}n+=r.nodeSize}}function q8(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=q8(s.content,o.content,n-1,i-1);if(c)return c}n-=l,i-=l}}class fe{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 fe(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 fe(i,r)}cutByIndex(e,n){return e==n?fe.empty:e==0&&n==this.content.length?this:new fe(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 fe(r,a)}addToStart(e){return new fe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new fe(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 j8(this,e,n)}findDiffEnd(e,n=this.size,i=e.size){return q8(this,e,n,i)}findIndex(e){if(e==0)return n_(0,e);if(e==this.size)return n_(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?n_(n+1,a):n_(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 fe.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new fe(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return fe.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 fe(n||e,i)}static from(e){if(!e)return fe.empty;if(e instanceof fe)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new fe([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}fe.empty=new fe([],0);const z1={index:0,offset:0};function n_(t,e){return z1.index=t,z1.offset=e,z1}function sy(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(!sy(t[i],e[i]))return!1}else{for(let i in t)if(!(i in e)||!sy(t[i],e[i]))return!1;for(let i in e)if(!(i in t))return!1}return!0}let Pn=class Uk{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&&sy(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 Uk.none;if(e instanceof Uk)return[e];let n=e.slice();return n.sort((i,r)=>i.type.rank-r.type.rank),n}};Pn.none=[];class oy extends Error{}class Be{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=W8(this.content,e+this.openStart,n);return i&&new Be(i,this.openStart,this.openEnd)}removeBetween(e,n){return new Be(V8(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 Be.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 Be(fe.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 Be(e,i,r)}}Be.empty=new Be(fe.empty,0,0);function V8(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(V8(a.content,e-r-1,n-r-1)))}function W8(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=W8(s.content,e-a-1,n,s);return o&&t.replaceChild(r,s.copy(o))}function Sfe(t,e,n){if(n.openStart>t.depth)throw new oy("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new oy("Inconsistent open depths");return Y8(t,e,n,0)}function Y8(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=Y8(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}=Cfe(n,t);return tu(a,Q8(t,s,o,e,i))}else return tu(a,ly(t,e,i))}function K8(t,e){if(!e.type.compatibleContent(t.type))throw new oy("Cannot join "+e.type.name+" onto "+t.type.name)}function zk(t,e,n){let i=t.node(n);return K8(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 Pm(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 Q8(t,e,n,i,r){let a=t.depth>r&&zk(t,e,r+1),s=i.depth>r&&zk(n,i,r+1),o=[];return Pm(null,t,r,o),a&&s&&e.index(r)==n.index(r)?(K8(a,s),eu(tu(a,Q8(t,e,n,i,r+1)),o)):(a&&eu(tu(a,ly(t,e,r+1)),o),Pm(e,n,r,o),s&&eu(tu(s,ly(n,i,r+1)),o)),Pm(i,null,r,o),new fe(o)}function ly(t,e,n){let i=[];if(Pm(null,t,n,i),t.depth>n){let r=zk(t,e,n+1);eu(tu(r,ly(t,e,n+1)),i)}return Pm(e,null,n,i),new fe(i)}function Cfe(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(fe.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class Eh{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 Pn.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 cy(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 Eh(n,i,a)}static resolveCached(e,n){let i=NM.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 NM.set(e,i=new Tfe);let r=i.elts[i.i]=Eh.resolve(e,n);return i.i=(i.i+1)%xfe,r}}class Tfe{constructor(){this.elts=[],this.i=0}}const xfe=12,NM=new WeakMap;class cy{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 kfe=Object.create(null);let Hl=class Hk{constructor(e,n,i,r=Pn.none){this.type=e,this.attrs=n,this.marks=r,this.content=i||fe.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&&sy(this.attrs,n||e.defaultAttrs||kfe)&&Pn.sameSet(this.marks,i||Pn.none)}copy(e=null){return e==this.content?this:new Hk(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Hk(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 Be.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 Be(c,r.depth-s,a.depth-s)}replace(e,n,i){return Sfe(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 Eh.resolveCached(this,e)}resolveNoCache(e){return Eh.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()+")"),X8(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=fe.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=Pn.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(!Pn.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=fe.fromJSON(e,n.content),a=e.nodeType(n.type).create(n.attrs,r,i);return a.type.checkAttrs(a.attrs),a}};Hl.prototype.text=void 0;class uy extends Hl{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):X8(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 uy(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new uy(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 X8(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class bu{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let i=new wfe(e,n);if(i.next==null)return bu.empty;let r=J8(i);i.next&&i.err("Unexpected trailing text");let a=Mfe(Ofe(r));return Pfe(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 fe.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
  `)}}bu.empty=new bu(!0);let wfe=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 J8(t){let e=[];do e.push(Dfe(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Dfe(t){let e=[];do e.push(Afe(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Afe(t){let e=Ife(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=Nfe(t,e);else break;return e}function RM(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Nfe(t,e){let n=RM(t),i=n;return t.eat(",")&&(t.next!="}"?i=RM(t):i=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:i,expr:e}}function Rfe(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 Ife(t){if(t.eat("(")){let e=J8(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=Rfe(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 Ofe(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 Z8(t,e){return e-t}function IM(t,e){let n=[];return i(e),n.sort(Z8);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 Mfe(t){let e=Object.create(null);return n(IM(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]);IM(t,l).forEach(u=>{c||r.push([o,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let a=e[i.join(",")]=new bu(i.indexOf(t.length-1)>-1);for(let s=0;s<r.length;s++){let o=r[s][1].sort(Z8);a.next.push({type:r[s][0],next:e[o.join(",")]||n(o)})}return a}}function Pfe(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 ez(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 tz(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 nz(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 iz(t,e){let n=Object.create(null);if(e)for(let i in e)n[i]=new Ffe(t,i,e[i]);return n}let OM=class rz{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=iz(e,i.attrs),this.defaultAttrs=ez(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==bu.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:tz(this.attrs,e)}create(e=null,n,i){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Hl(this,this.computeAttrs(e),fe.from(n),Pn.setFrom(i))}createChecked(e=null,n,i){return n=fe.from(n),this.checkContent(n),new Hl(this,this.computeAttrs(e),n,Pn.setFrom(i))}createAndFill(e=null,n,i){if(e=this.computeAttrs(e),n=fe.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(fe.empty,!0);return a?new Hl(this,e,n.append(a),Pn.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){nz(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:Pn.none:e}static compile(e,n){let i=Object.create(null);e.forEach((a,s)=>i[a]=new rz(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 Lfe(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 Ffe{constructor(e,n,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?Lfe(e,n,i.validate):i.validate}get isRequired(){return!this.hasDefault}}class Jv{constructor(e,n,i,r){this.name=e,this.rank=n,this.schema=i,this.spec=r,this.attrs=iz(e,r.attrs),this.excluded=null;let a=ez(this.attrs);this.instance=a?new Pn(this,a):null}create(e=null){return!e&&this.instance?this.instance:new Pn(this,tz(this.attrs,e))}static compile(e,n){let i=Object.create(null),r=0;return e.forEach((a,s)=>i[a]=new Jv(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){nz(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class az{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=zi.from(e.nodes),n.marks=zi.from(e.marks||{}),this.nodes=OM.compile(this.spec.nodes,this),this.marks=Jv.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]=bu.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?MM(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==""?[]:MM(this,s.split(" "))}this.nodeFromJSON=r=>Hl.fromJSON(this,r),this.markFromJSON=r=>Pn.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 OM){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 uy(i,i.defaultAttrs,e,Pn.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 MM(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 Bfe(t){return t.tag!=null}function $fe(t){return t.style!=null}class Gl{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let i=this.matchedStyles=[];n.forEach(r=>{if(Bfe(r))this.tags.push(r);else if($fe(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 LM(this,n,!1);return i.addAll(e,Pn.none,n.from,n.to),i.finish()}parseSlice(e,n={}){let i=new LM(this,n,!0);return i.addAll(e,Pn.none,n.from,n.to),Be.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(Hfe(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=FM(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=FM(s)),s.node||s.ignore||s.mark||(s.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Gl(e,Gl.schemaRules(e)))}}const sz={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},Ufe={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},oz={ol:!0,ul:!0},Sh=1,Gk=2,Lm=4;function PM(t,e,n){return e!=null?(e?Sh:0)|(e==="full"?Gk:0):t&&t.whitespace=="pre"?Sh|Gk:n&~Lm}class i_{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=Pn.none,this.match=a||(s&Lm?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(fe.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&Sh)){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=fe.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(fe.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&&!sz.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class LM{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=PM(null,n.preserveWhitespace,0)|(i?Lm:0);r?a=new i_(r.type,r.attrs,Pn.none,!0,n.topMatch||r.type.contentMatch,s):i?a=new i_(null,null,Pn.none,!0,null,s):a=new i_(e.schema.topNodeType,null,Pn.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&Gk?"full":this.localPreserveWS||(r.options&Sh)>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;oz.hasOwnProperty(s)&&this.parser.normalizeLists&&zfe(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,i));e:if(l?l.ignore:Ufe.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(sz.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=Pn.none;for(let o of r.concat(e.marks))(a.type?a.type.allowsMarkType(o.type):BM(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=PM(e,a,s.options);s.options&Lm&&s.content.length==0&&(o|=Lm);let l=Pn.none;return i=i.filter(c=>(s.type?s.type.allowsMarkType(c.type):BM(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new i_(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|=Sh)}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 zfe(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&oz.hasOwnProperty(i)&&n?(n.appendChild(e),e=n):i=="li"?n=e:i&&(n=null)}}function Hfe(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function FM(t){let e={};for(let n in t)e[n]=t[n];return e}function BM(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 Lu{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},i){i||(i=H1(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}=ib(H1(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&&ib(H1(i),r(e,n),null,e.attrs)}static renderSpec(e,n,i=null,r){return ib(e,n,i,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Lu(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=$M(e.nodes);return n.text||(n.text=i=>i.text),n}static marksFromSchema(e){return $M(e.marks)}}function $M(t){let e={};for(let n in t){let i=t[n].spec.toDOM;i&&(e[n]=i)}return e}function H1(t){return t.document||window.document}const UM=new WeakMap;function Gfe(t){let e=UM.get(t);return e===void 0&&UM.set(t,e=jfe(t)),e}function jfe(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 ib(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=Gfe(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:h}=ib(t,p,n,i);if(l.appendChild(f),h){if(o)throw new RangeError("Multiple content holes");o=h}}}return{dom:l,contentDOM:o}}const lz=65535,cz=Math.pow(2,16);function qfe(t,e){return t+e*cz}function zM(t){return t&lz}function Vfe(t){return(t-(t&lz))/cz}const uz=1,dz=2,rb=4,pz=8;class jk{constructor(e,n,i){this.pos=e,this.delInfo=n,this.recover=i}get deleted(){return(this.delInfo&pz)>0}get deletedBefore(){return(this.delInfo&(uz|rb))>0}get deletedAfter(){return(this.delInfo&(dz|rb))>0}get deletedAcross(){return(this.delInfo&rb)>0}}class Qr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Qr.empty)return Qr.empty}recover(e){let n=0,i=zM(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+Vfe(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 h=e==(n<0?l:d)?null:qfe(o/3,e-l),g=e==l?dz:e==d?uz:rb;return(n<0?e!=l:e!=d)&&(g|=pz),new jk(f,g,h)}r+=u-c}return i?e+r:new jk(e+r,0,null)}touches(e,n){let i=0,r=zM(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 Qr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Qr.empty:new Qr(e<0?[0,-e,0]:[0,0,e])}}Qr.empty=new Qr([]);class Ch{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 Ch(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 Ch;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 jk(e,r,null)}}const G1=Object.create(null);class or{getMap(){return Qr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=G1[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 G1)throw new RangeError("Duplicate use of step JSON ID "+e);return G1[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 oy)return Si.fail(a.message);throw a}}}function OA(t,e,n){let i=[];for(let r=0;r<t.childCount;r++){let a=t.child(r);a.content.size&&(a=a.copy(OA(a.content,e,a))),a.isInline&&(a=e(a,n,r)),i.push(a)}return fe.fromArray(i)}class Ll 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 Be(OA(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 es(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 Ll(n.pos,i.pos,this.mark)}merge(e){return e instanceof Ll&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ll(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 Ll(n.from,n.to,e.markFromJSON(n.mark))}}or.jsonID("addMark",Ll);class es 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 Be(OA(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 Ll(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 es(n.pos,i.pos,this.mark)}merge(e){return e instanceof es&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new es(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 es(n.from,n.to,e.markFromJSON(n.mark))}}or.jsonID("removeMark",es);class Fl 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 Be(fe.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 Fl(this.pos,n.marks[r]);return new Fl(this.pos,this.mark)}}return new yu(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Fl(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 Fl(n.pos,e.markFromJSON(n.mark))}}or.jsonID("addNodeMark",Fl);class yu 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 Be(fe.from(i),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Fl(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new yu(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 yu(n.pos,e.markFromJSON(n.mark))}}or.jsonID("removeNodeMark",yu);class Oi 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&&qk(e,this.from,this.to)?Si.fail("Structure replace would overwrite content"):Si.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Qr([this.from,this.to-this.from,this.slice.size])}invert(e){return new Oi(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 Oi(n.pos,Math.max(n.pos,i.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Oi)||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?Be.empty:new Be(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Oi(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?Be.empty:new Be(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Oi(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 Oi(n.from,n.to,Be.fromJSON(e,n.slice),!!n.structure)}}or.jsonID("replace",Oi);class Li 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&&(qk(e,this.from,this.gapFrom)||qk(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 Qr([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 Li(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 Li(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 Li(n.from,n.to,n.gapFrom,n.gapTo,Be.fromJSON(e,n.slice),n.insert,!!n.structure)}}or.jsonID("replaceAround",Li);function qk(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 Wfe(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),h=i.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(h)||(s&&s.to==p&&s.mark.eq(d[g])?s.to=f:r.push(s=new es(p,f,d[g])));o&&o.to==p?o.to=f:a.push(o=new Ll(p,f,i))}}),r.forEach(l=>t.step(l)),a.forEach(l=>t.step(l))}function Yfe(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 Jv){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 h=r[f];h.step==a-1&&d.eq(r[f].style)&&(p=h)}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 es(s.from,s.to,s.style)))}function MA(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 Oi(o,u,Be.empty));else{i=d;for(let p=0;p<c.marks.length;p++)n.allowsMarkType(c.marks[p].type)||t.step(new es(o,u,c.marks[p]));if(r&&c.isText&&n.whitespace!="pre"){let p,f=/\r?\n|\r/g,h;for(;p=f.exec(c.text);)h||(h=new Be(fe.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new Oi(o+p.index,o+p.index+p[0].length,h))}}o=u}if(!i.validEnd){let l=i.fillBefore(fe.empty,!0);t.replace(o,o,new Be(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function Kfe(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function tf(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||!Kfe(s,o,l))break;o&&(r=1),l<s.childCount&&(a=1)}return null}function Qfe(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=fe.empty,d=0;for(let h=a,g=!1;h>n;h--)g||i.index(h)>0?(g=!0,u=fe.from(i.node(h).copy(u)),d++):l--;let p=fe.empty,f=0;for(let h=a,g=!1;h>n;h--)g||r.after(h+1)<r.end(h)?(g=!0,p=fe.from(r.node(h).copy(p)),f++):c++;t.step(new Li(l,c,s,o,new Be(u.append(p),d,f),u.size-d,!0))}function PA(t,e,n=null,i=t){let r=Xfe(t,e),a=r&&Jfe(i,e);return a?r.map(HM).concat({type:e,attrs:n}).concat(a.map(HM)):null}function HM(t){return{type:t,attrs:null}}function Xfe(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 Jfe(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 Zfe(t,e,n){let i=fe.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=fe.from(n[s].type.create(n[s].attrs,i))}let r=e.start,a=e.end;t.step(new Li(r,a,r,a,new Be(i,0,0),n.length,!0))}function eme(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)&&tme(t.doc,t.mapping.slice(a).map(o),i)){let c=null;if(i.schema.linebreakReplacement){let f=i.whitespace=="pre",h=!!i.contentMatch.matchType(i.schema.linebreakReplacement);f&&!h?c=!1:!f&&h&&(c=!0)}c===!1&&mz(t,s,o,a),MA(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 Li(d,p,d+1,p-1,new Be(fe.from(i.create(l,null,s.marks)),0,0),1,!0)),c===!0&&fz(t,s,o,a),!1}})}function fz(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 mz(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(`
@@ -283,7 +283,7 @@ ${f.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(o,10),content:
283
283
  `):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e?.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var i;const r=t.split(`
284
284
  `),[a,s]=s1e(r);if(a.length===0)return;const o=XH(a,0,n);return o.length===0?void 0:{type:"list",ordered:!0,start:((i=a[0])==null?void 0:i.number)||1,items:o,raw:r.slice(0,s).join(`
285
285
  `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(l1e,this.editor.getAttributes(gL)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ep({find:_L,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ep({find:_L,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(gL)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),c1e=/^\s*(\[([( |x])?\])\s$/,u1e=oa.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",hi(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const i=e.parseChildren(t.nestedTokens);n.push(...i)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const r=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return c2(t,e,r)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:i})=>{const r=document.createElement("li"),a=document.createElement("label"),s=document.createElement("span"),o=document.createElement("input"),l=document.createElement("div"),c=d=>{var p,f;o.ariaLabel=((f=(p=this.options.a11y)==null?void 0:p.checkboxLabel)==null?void 0:f.call(p,d,o.checked))||`Task item checkbox for ${d.textContent||"empty task item"}`};c(t),a.contentEditable="false",o.type="checkbox",o.addEventListener("mousedown",d=>d.preventDefault()),o.addEventListener("change",d=>{if(!i.isEditable&&!this.options.onReadOnlyChecked){o.checked=!o.checked;return}const{checked:p}=d.target;i.isEditable&&typeof n=="function"&&i.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const h=n();if(typeof h!="number")return!1;const g=f.doc.nodeAt(h);return f.setNodeMarkup(h,void 0,{...g?.attrs,checked:p}),!0}).run(),!i.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,p)||(o.checked=!o.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,p])=>{r.setAttribute(d,p)}),r.dataset.checked=t.attrs.checked,o.checked=t.attrs.checked,a.append(o,s),r.append(a,l),Object.entries(e).forEach(([d,p])=>{r.setAttribute(d,p)});let u=new Set(Object.keys(e));return{dom:r,contentDOM:l,update:d=>{if(d.type!==this.type)return!1;r.dataset.checked=d.attrs.checked,o.checked=d.attrs.checked,c(d);const p=i.extensionManager.attributes,f=Ah(d,p),h=new Set(Object.keys(f)),g=this.options.HTMLAttributes;return u.forEach(_=>{h.has(_)||(_ in g?r.setAttribute(_,g[_]):r.removeAttribute(_))}),Object.entries(f).forEach(([_,b])=>{b==null?_ in g?r.setAttribute(_,g[_]):r.removeAttribute(_):r.setAttribute(_,b)}),u=h,!0}}}},addInputRules(){return[Ep({find:c1e,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),d1e=oa.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",hi(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
286
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const i=a=>{const s=aw(a,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,l)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:n.inlineTokens(o.mainContent),nestedTokens:l}),customNestedParser:i},n);return s?[{type:"taskList",raw:s.raw,items:s.items}]:n.blockTokens(a)},r=aw(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,s)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:s}),customNestedParser:i},n);if(r)return{type:"taskList",raw:r.raw,items:r.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});bn.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(GH.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(jH.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(QH.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(JH.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(u1e.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(d1e.configure(this.options.taskList)),t}});var bL="&nbsp;",p1e=" ",f1e=oa.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",hi(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const i=e.parseInline(n);return i.length===1&&i[0].type==="text"&&(i[0].text===bL||i[0].text===p1e)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,i)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?bL:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),m1e=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,h1e=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,g1e=pc.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",hi(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[vp({find:m1e,type:this.type})]},addPasteRules(){return[Su({find:h1e,type:this.type})]}}),_1e=oa.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),b1e=pc.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",hi(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!r)return;const a=r[2].trim();return{type:"underline",raw:r[0],text:a,tokens:n.inlineTokens(a)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function y1e(t={}){return new Yn({view(e){return new v1e(e,t)}})}class v1e{constructor(e,n){var i;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(i=n.width)!==null&&i!==void 0?i:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let a=s=>{this[r](s)};return e.dom.addEventListener(r,a),{name:r,handler:a}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,i,r=this.editorView.dom,a=r.getBoundingClientRect(),s=a.width/r.offsetWidth,o=a.height/r.offsetHeight;if(n){let d=e.nodeBefore,p=e.nodeAfter;if(d||p){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let h=f.getBoundingClientRect(),g=d?h.bottom:h.top;d&&p&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let _=this.width/2*o;i={left:h.left,right:h.right,top:g-_,bottom:g+_}}}}if(!i){let d=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;i={left:d.left-p,right:d.left+p,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),p=d.width/l.offsetWidth,f=d.height/l.offsetHeight;c=d.left-l.scrollLeft*p,u=d.top-l.scrollTop*f}this.element.style.left=(i.left-c)/s+"px",this.element.style.top=(i.top-u)/o+"px",this.element.style.width=(i.right-i.left)/s+"px",this.element.style.height=(i.bottom-i.top)/o+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),i=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),r=i&&i.type.spec.disableDropCursor,a=typeof r=="function"?r(this.editorView,n,e):r;if(n&&!a){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let o=gz(this.editorView.state.doc,s,this.editorView.dragging.slice);o!=null&&(s=o)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ui extends bt{constructor(e){super(e,e)}map(e,n){let i=e.resolve(n.map(this.head));return ui.valid(i)?new ui(i):bt.near(i)}content(){return Be.empty}eq(e){return e instanceof ui&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ui(e.resolve(n.pos))}getBookmark(){return new A2(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!E1e(e)||!S1e(e))return!1;let i=n.type.spec.allowGapCursor;if(i!=null)return i;let r=n.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,n,i=!1){e:for(;;){if(!i&&ui.valid(e))return e;let r=e.pos,a=null;for(let s=e.depth;;s--){let o=e.node(s);if(n>0?e.indexAfter(s)<o.childCount:e.index(s)>0){a=o.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;r+=n;let l=e.doc.resolve(r);if(ui.valid(l))return l}for(;;){let s=n>0?a.firstChild:a.lastChild;if(!s){if(a.isAtom&&!a.isText&&!et.isSelectable(a)){e=e.doc.resolve(r+a.nodeSize*n),i=!1;continue e}break}a=s,r+=n;let o=e.doc.resolve(r);if(ui.valid(o))return o}return null}}}ui.prototype.visible=!1;ui.findFrom=ui.findGapCursorFrom;bt.jsonID("gapcursor",ui);class A2{constructor(e){this.pos=e}map(e){return new A2(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ui.valid(n)?new ui(n):bt.near(n)}}function ZH(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function E1e(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),i=t.node(e);if(n==0){if(i.type.spec.isolating)return!0;continue}for(let r=i.child(n-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||ZH(r.type))return!0;if(r.inlineContent)return!1}}return!0}function S1e(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),i=t.node(e);if(n==i.childCount){if(i.type.spec.isolating)return!0;continue}for(let r=i.child(n);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||ZH(r.type))return!0;if(r.inlineContent)return!1}}return!0}function C1e(){return new Yn({props:{decorations:w1e,createSelectionBetween(t,e,n){return e.pos==n.pos&&ui.valid(n)?new ui(n):null},handleClick:x1e,handleKeyDown:T1e,handleDOMEvents:{beforeinput:k1e}}})}const T1e=XA({ArrowLeft:y_("horiz",-1),ArrowRight:y_("horiz",1),ArrowUp:y_("vert",-1),ArrowDown:y_("vert",1)});function y_(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(i,r,a){let s=i.selection,o=e>0?s.$to:s.$from,l=s.empty;if(s instanceof Tt){if(!a.endOfTextblock(n)||o.depth==0)return!1;l=!1,o=i.doc.resolve(e>0?o.after():o.before())}let c=ui.findGapCursorFrom(o,e,l);return c?(r&&r(i.tr.setSelection(new ui(c))),!0):!1}}function x1e(t,e,n){if(!t||!t.editable)return!1;let i=t.state.doc.resolve(e);if(!ui.valid(i))return!1;let r=t.posAtCoords({left:n.clientX,top:n.clientY});return r&&r.inside>-1&&et.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ui(i))),!0)}function k1e(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ui))return!1;let{$from:n}=t.state.selection,i=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!i)return!1;let r=fe.empty;for(let s=i.length-1;s>=0;s--)r=fe.from(i[s].createAndFill(null,r));let a=t.state.tr.replace(n.pos,n.pos,new Be(r,0,0));return a.setSelection(Tt.near(a.doc.resolve(n.pos+1))),t.dispatch(a),!1}function w1e(t){if(!(t.selection instanceof ui))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ii.create(t.doc,[mr.widget(t.selection.head,e,{key:"gapcursor"})])}var Jy=200,Fi=function(){};Fi.prototype.append=function(e){return e.length?(e=Fi.from(e),!this.length&&e||e.length<Jy&&this.leafAppend(e)||this.length<Jy&&e.leafPrepend(this)||this.appendInner(e)):this};Fi.prototype.prepend=function(e){return e.length?Fi.from(e).append(this):this};Fi.prototype.appendInner=function(e){return new D1e(this,e)};Fi.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Fi.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Fi.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Fi.prototype.forEach=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=this.length),n<=i?this.forEachInner(e,n,i,0):this.forEachInvertedInner(e,n,i,0)};Fi.prototype.map=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=this.length);var r=[];return this.forEach(function(a,s){return r.push(e(a,s))},n,i),r};Fi.from=function(e){return e instanceof Fi?e:e&&e.length?new eG(e):Fi.empty};var eG=(function(t){function e(i){t.call(this),this.values=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,a){return r==0&&a==this.length?this:new e(this.values.slice(r,a))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,a,s,o){for(var l=a;l<s;l++)if(r(this.values[l],o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,a,s,o){for(var l=a-1;l>=s;l--)if(r(this.values[l],o+l)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=Jy)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=Jy)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Fi);Fi.empty=new eG([]);var D1e=(function(t){function e(n,i){t.call(this),this.left=n,this.right=i,this.length=n.length+i.length,this.depth=Math.max(n.depth,i.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(i){return i<this.left.length?this.left.get(i):this.right.get(i-this.left.length)},e.prototype.forEachInner=function(i,r,a,s){var o=this.left.length;if(r<o&&this.left.forEachInner(i,r,Math.min(a,o),s)===!1||a>o&&this.right.forEachInner(i,Math.max(r-o,0),Math.min(this.length,a)-o,s+o)===!1)return!1},e.prototype.forEachInvertedInner=function(i,r,a,s){var o=this.left.length;if(r>o&&this.right.forEachInvertedInner(i,r-o,Math.max(a,o)-o,s+o)===!1||a<o&&this.left.forEachInvertedInner(i,Math.min(r,o),a,s)===!1)return!1},e.prototype.sliceInner=function(i,r){if(i==0&&r==this.length)return this;var a=this.left.length;return r<=a?this.left.slice(i,r):i>=a?this.right.slice(i-a,r-a):this.left.slice(i,a).append(this.right.slice(0,r-a))},e.prototype.leafAppend=function(i){var r=this.right.leafAppend(i);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(i){var r=this.left.leafPrepend(i);if(r)return new e(r,this.right)},e.prototype.appendInner=function(i){return this.left.depth>=Math.max(this.right.depth,i.depth)+1?new e(this.left,new e(this.right,i)):new e(this,i)},e})(Fi);const A1e=500;class Ja{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}let r,a;n&&(r=this.remapping(i,this.items.length),a=r.maps.length);let s=e.tr,o,l,c=[],u=[];return this.items.forEach((d,p)=>{if(!d.step){r||(r=this.remapping(i,p+1),a=r.maps.length),a--,u.push(d);return}if(r){u.push(new Ds(d.map));let f=d.step.map(r.slice(a)),h;f&&s.maybeStep(f).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],c.push(new Ds(h,void 0,void 0,c.length+u.length))),a--,h&&r.appendMap(h,a)}else s.maybeStep(d.step);if(d.selection)return o=r?d.selection.map(r.slice(a)):d.selection,l=new Ja(this.items.slice(0,i).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:o}}addTransform(e,n,i,r){let a=[],s=this.eventCount,o=this.items,l=!r&&o.length?o.get(o.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),p=new Ds(e.mapping.maps[u],d,n),f;(f=l&&l.merge(p))&&(p=f,u?a.pop():o=o.slice(0,o.length-1)),a.push(p),n&&(s++,n=void 0),r||(l=p)}let c=s-i.depth;return c>R1e&&(o=N1e(o,c),s-=c),new Ja(o.append(a),s)}remapping(e,n){let i=new Ch;return this.items.forEach((r,a)=>{let s=r.mirrorOffset!=null&&a-r.mirrorOffset>=e?i.maps.length-r.mirrorOffset:void 0;i.appendMap(r.map,s)},e,n),i}addMaps(e){return this.eventCount==0?this:new Ja(this.items.append(e.map(n=>new Ds(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let i=[],r=Math.max(0,this.items.length-n),a=e.mapping,s=e.steps.length,o=this.eventCount;this.items.forEach(p=>{p.selection&&o--},r);let l=n;this.items.forEach(p=>{let f=a.getMirror(--l);if(f==null)return;s=Math.min(s,f);let h=a.maps[f];if(p.step){let g=e.steps[f].invert(e.docs[f]),_=p.selection&&p.selection.map(a.slice(l+1,f));_&&o++,i.push(new Ds(h,g,_))}else i.push(new Ds(h))},r);let c=[];for(let p=n;p<s;p++)c.push(new Ds(a.maps[p]));let u=this.items.slice(0,r).append(c).append(i),d=new Ja(u,o);return d.emptyItemCount()>A1e&&(d=d.compress(this.items.length-i.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),i=n.maps.length,r=[],a=0;return this.items.forEach((s,o)=>{if(o>=e)r.push(s),s.selection&&a++;else if(s.step){let l=s.step.map(n.slice(i)),c=l&&l.getMap();if(i--,c&&n.appendMap(c,i),l){let u=s.selection&&s.selection.map(n.slice(i));u&&a++;let d=new Ds(c.invert(),l,u),p,f=r.length-1;(p=r.length&&r[f].merge(d))?r[f]=p:r.push(d)}}else s.map&&i--},this.items.length,0),new Ja(Fi.from(r.reverse()),a)}}Ja.empty=new Ja(Fi.empty,0);function N1e(t,e){let n;return t.forEach((i,r)=>{if(i.selection&&e--==0)return n=r,!1}),t.slice(n)}class Ds{constructor(e,n,i,r){this.map=e,this.step=n,this.selection=i,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Ds(n.getMap().invert(),n,this.selection)}}}class Dl{constructor(e,n,i,r,a){this.done=e,this.undone=n,this.prevRanges=i,this.prevTime=r,this.prevComposition=a}}const R1e=20;function I1e(t,e,n,i){let r=n.getMeta(ru),a;if(r)return r.historyState;n.getMeta(P1e)&&(t=new Dl(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(ru))return s.getMeta(ru).redo?new Dl(t.done.addTransform(n,void 0,i,lb(e)),t.undone,yL(n.mapping.maps),t.prevTime,t.prevComposition):new Dl(t.done,t.undone.addTransform(n,void 0,i,lb(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let o=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=o&&(t.prevTime<(n.time||0)-i.newGroupDelay||!O1e(n,t.prevRanges)),c=s?gS(t.prevRanges,n.mapping):yL(n.mapping.maps);return new Dl(t.done.addTransform(n,l?e.selection.getBookmark():void 0,i,lb(e)),Ja.empty,c,n.time,o??t.prevComposition)}else return(a=n.getMeta("rebased"))?new Dl(t.done.rebased(n,a),t.undone.rebased(n,a),gS(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Dl(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),gS(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function O1e(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((i,r)=>{for(let a=0;a<e.length;a+=2)i<=e[a+1]&&r>=e[a]&&(n=!0)}),n}function yL(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((i,r,a,s)=>e.push(a,s));return e}function gS(t,e){if(!t)return null;let n=[];for(let i=0;i<t.length;i+=2){let r=e.map(t[i],1),a=e.map(t[i+1],-1);r<=a&&n.push(r,a)}return n}function M1e(t,e,n){let i=lb(e),r=ru.get(e).spec.config,a=(n?t.undone:t.done).popEvent(e,i);if(!a)return null;let s=a.selection.resolve(a.transform.doc),o=(n?t.done:t.undone).addTransform(a.transform,e.selection.getBookmark(),r,i),l=new Dl(n?o:a.remaining,n?a.remaining:o,null,0,-1);return a.transform.setSelection(s).setMeta(ru,{redo:n,historyState:l})}let _S=!1,vL=null;function lb(t){let e=t.plugins;if(vL!=e){_S=!1,vL=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){_S=!0;break}}return _S}const ru=new Zn("history"),P1e=new Zn("closeHistory");function L1e(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Yn({key:ru,state:{init(){return new Dl(Ja.empty,Ja.empty,null,0,-1)},apply(e,n,i){return I1e(n,i,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let i=n.inputType,r=i=="historyUndo"?nG:i=="historyRedo"?iG:null;return!r||!e.editable?!1:(n.preventDefault(),r(e.state,e.dispatch))}}}})}function tG(t,e){return(n,i)=>{let r=ru.getState(n);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(i){let a=M1e(r,n,t);a&&i(e?a.scrollIntoView():a)}return!0}}const nG=tG(!1,!0),iG=tG(!0,!0);bn.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const i=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(i)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Yn({key:new Zn("characterCount"),appendTransaction:(e,n,i)=>{if(t)return;const r=this.options.limit;if(r==null||r===0){t=!0;return}const a=this.storage.characters({node:i.doc});if(a>r){const s=a-r,o=0,l=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`);const c=i.tr.deleteRange(o,l);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const i=this.options.limit;if(!e.docChanged||i===0||i===null||i===void 0)return!0;const r=this.storage.characters({node:n.doc}),a=this.storage.characters({node:e.doc});if(a<=i||r>i&&a>i&&a<=r)return!0;if(r>i&&a>i&&a>r||!e.getMeta("paste"))return!1;const o=e.selection.$head.pos,l=a-i,c=o-l,u=o;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>i)}})]}});var F1e=bn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[y1e(this.options)]}});bn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Yn({key:new Zn("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:i}=this.editor,{anchor:r}=e,a=[];if(!n||!i)return ii.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(l.isText)return;if(!(r>=c&&r<=c+l.nodeSize-1))return!1;s+=1});let o=0;return t.descendants((l,c)=>{if(l.isText||!(r>=c&&r<=c+l.nodeSize-1))return!1;if(o+=1,this.options.mode==="deepest"&&s-o>0||this.options.mode==="shallowest"&&o>1)return this.options.mode==="deepest";a.push(mr.node(c,c+l.nodeSize,{class:this.options.className}))}),ii.create(t,a)}}})]}});var B1e=bn.create({name:"gapCursor",addProseMirrorPlugins(){return[C1e()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=xn(Xe(t,"allowGapCursor",n)))!=null?e:null}}}),EL="placeholder";function $1e(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var U1e=bn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:EL,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${$1e(this.options.dataAttribute)}`:`data-${EL}`;return[new Yn({key:new Zn("placeholder"),props:{decorations:({doc:e,selection:n})=>{const i=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=n,a=[];if(!i)return null;const s=this.editor.isEmpty;return e.descendants((o,l)=>{const c=r>=l&&r<=l+o.nodeSize,u=!o.isLeaf&&cE(o);if((c||!this.options.showOnlyCurrent)&&u){const d=[this.options.emptyNodeClass];s&&d.push(this.options.emptyEditorClass);const p=mr.node(l,l+o.nodeSize,{class:d.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:l,hasAnchor:c}):this.options.placeholder});a.push(p)}return this.options.includeChildren}),ii.create(e,a)}}})]}});bn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Yn({key:new Zn("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||I7(n.selection)||t.view.dragging?null:ii.create(n.doc,[mr.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function SL({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var z1e=bn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Zn(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",i=Object.entries(this.editor.schema.nodes).map(([,r])=>r).filter(r=>(this.options.notAfter||[]).concat(n).includes(r.name));return[new Yn({key:e,appendTransaction:(r,a,s)=>{const{doc:o,tr:l,schema:c}=s,u=e.getState(s),d=o.content.size,p=c.nodes[n];if(u)return l.insert(d,p.create())},state:{init:(r,a)=>{const s=a.tr.doc.lastChild;return!SL({node:s,types:i})},apply:(r,a)=>{if(!r.docChanged||r.getMeta("__uniqueIDTransaction"))return a;const s=r.doc.lastChild;return!SL({node:s,types:i})}}})]}}),H1e=bn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>nG(t,e),redo:()=>({state:t,dispatch:e})=>iG(t,e)}},addProseMirrorPlugins(){return[L1e(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),G1e=bn.create({name:"starterKit",addExtensions(){var t,e,n,i;const r=[];return this.options.bold!==!1&&r.push(fEe.configure(this.options.bold)),this.options.blockquote!==!1&&r.push(lEe.configure(this.options.blockquote)),this.options.bulletList!==!1&&r.push(GH.configure(this.options.bulletList)),this.options.code!==!1&&r.push(gEe.configure(this.options.code)),this.options.codeBlock!==!1&&r.push(yEe.configure(this.options.codeBlock)),this.options.document!==!1&&r.push(vEe.configure(this.options.document)),this.options.dropcursor!==!1&&r.push(F1e.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&r.push(B1e.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&r.push(EEe.configure(this.options.hardBreak)),this.options.heading!==!1&&r.push(SEe.configure(this.options.heading)),this.options.undoRedo!==!1&&r.push(H1e.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&r.push(CEe.configure(this.options.horizontalRule)),this.options.italic!==!1&&r.push(DEe.configure(this.options.italic)),this.options.listItem!==!1&&r.push(jH.configure(this.options.listItem)),this.options.listKeymap!==!1&&r.push(QH.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&r.push(ZEe.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&r.push(JH.configure(this.options.orderedList)),this.options.paragraph!==!1&&r.push(f1e.configure(this.options.paragraph)),this.options.strike!==!1&&r.push(g1e.configure(this.options.strike)),this.options.text!==!1&&r.push(_1e.configure(this.options.text)),this.options.underline!==!1&&r.push(b1e.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&r.push(z1e.configure((i=this.options)==null?void 0:i.trailingNode)),r}}),j1e=G1e,q1e=20,rG=(t,e=0)=>{const n=[];return!t.children.length||e>q1e||Array.from(t.children).forEach(i=>{i.tagName==="SPAN"?n.push(i):i.children.length&&n.push(...rG(i,e+1))}),n},V1e=t=>{if(!t.children.length)return;const e=rG(t);e&&e.forEach(n=>{var i,r;const a=n.getAttribute("style"),s=(r=(i=n.parentElement)==null?void 0:i.closest("span"))==null?void 0:r.getAttribute("style");n.setAttribute("style",`${s};${a}`)})},aG=pc.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&V1e(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",hi(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,i)=>{if(n.isTextblock)return!0;n.marks.filter(r=>r.type===this.type).some(r=>Object.values(r.attrs).some(a=>!!a))||t.removeMark(i,i+n.nodeSize,this.type)}),!0}}}}),W1e=bn.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const i=n.split(";").map(r=>r.trim()).filter(Boolean);for(let r=i.length-1;r>=0;r-=1){const a=i[r].split(":");if(a.length>=2){const s=a[0].trim().toLowerCase(),o=a.slice(1).join(":").trim();if(s==="background-color")return o.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),sG=bn.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const i=n.split(";").map(r=>r.trim()).filter(Boolean);for(let r=i.length-1;r>=0;r-=1){const a=i[r].split(":");if(a.length>=2){const s=a[0].trim().toLowerCase(),o=a.slice(1).join(":").trim();if(s==="color")return o.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),Y1e=bn.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),K1e=bn.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),Q1e=bn.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});bn.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(W1e.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(sG.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(Y1e.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(K1e.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(Q1e.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(aG.configure(this.options.textStyle)),t}});const X1e=bn.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>t.style.backgroundColor?.replace(/['"]+/g,"")||null,renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).run()}}});var J1e=bn.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).some(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),Z1e=J1e,eSe=U1e;function tSe(t){return[j1e.configure({heading:{levels:[1,2,3],HTMLAttributes:{style:null}},trailingNode:!1,codeBlock:!1,code:!1,paragraph:{HTMLAttributes:{style:null}},horizontalRule:{HTMLAttributes:{style:null}},bulletList:{HTMLAttributes:{style:null}},orderedList:{HTMLAttributes:{style:null}},listItem:{HTMLAttributes:{style:null}},blockquote:{HTMLAttributes:{style:null}},link:{openOnClick:!1,HTMLAttributes:{}}}),aG,sG.configure({types:["textStyle"]}),X1e.configure({types:["textStyle"]}),Z1e.configure({types:["heading","paragraph"],alignments:["left","center","right","justify"]}),eSe.configure({placeholder:({node:e})=>t,showOnlyWhenEditable:!0})]}const nSe=J7;function bS(t){return t?t.replace(/<[^>]*>/g,"").replace(/&nbsp;/g,"").trim().length===0:!0}const yS=new Set;function oG({blockId:t,style:e,props:n,isNotClient:i=!1}){const r=A.useRef(null),{t:a}=Qe.useTranslation("common"),s=a("editor.notionTextPlaceholder"),o=ag(),l=_i(),c=Wv(),u=!i&&o===t,[d,p]=A.useState(!1);A.useEffect(()=>{if(!i)return()=>{ae.getState().notionTextInlineEditingBlockId===t&&Im(null)}},[t,i]);const f=A.useRef(xd(n?.html??lS.html)),h=c?.linkGlobal??null,g=A.useRef(!1),_=A.useRef(!1),b=A.useRef(null),y=A.useRef(t);A.useEffect(()=>{if(!u)return;const U=()=>p(!0),G=()=>p(!1);return window.addEventListener("slash-menu-opened",U),window.addEventListener("slash-menu-closed",G),()=>{window.removeEventListener("slash-menu-opened",U),window.removeEventListener("slash-menu-closed",G)}},[u]);const E=A.useCallback(()=>{b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{const U=f.current;t&&ae.getState().document[t]?.data?.props?.html!==U&&Zg(t,{html:U}),b.current=null},300)},[t]);A.useEffect(()=>()=>{b.current&&clearTimeout(b.current)},[]);const v=vye({extensions:tSe(s),content:f.current,editable:i?!1:u,shouldRerenderOnTransaction:!1,immediatelyRender:!i,onUpdate:({editor:U})=>{const G=U.getHTML(),V=f.current;f.current=G,G!==V&&!g.current&&!_.current&&U.isEditable&&E()}},[s]);A.useEffect(()=>{if(!u||!v||!t)return;const U=G=>{const V=G,{processedContent:K,replaceSelection:te,selectionFrom:Te,selectionTo:de}=V.detail;if(K){te&&Te!==void 0&&de!==void 0?v.chain().focus().insertContentAt({from:Te,to:de},K).run():v.chain().focus().setContent(K).run();const Oe=v.getHTML();Zg(t,{html:Oe})}};return window.addEventListener("text-ai-processed",U),()=>{window.removeEventListener("text-ai-processed",U)}},[u,v,t]),A.useEffect(()=>{if(g.current){g.current=!1;return}if(!u&&n?.html!==void 0){if(v?.isEditable||!v||v.isDestroyed)return;const U=xd(n.html),G=xd(v.getHTML());!(bS(U)&&bS(G))&&U!==G&&(f.current=U,_.current=!0,v.commands.setContent(U,{emitUpdate:!1}),Promise.resolve().then(()=>{_.current=!1}))}},[u,n?.html,v,t]),A.useEffect(()=>{if(!u)return;const U=G=>{if(G.detail.blockId!==t||yS.has(t))return;yS.add(t),b.current&&(clearTimeout(b.current),b.current=null);const K=(v?.isEditable?v?.getHTML():null)??f.current;f.current=K,ae.getState().document[t]?.data?.props?.html!==K&&t&&Zg(t,{html:K}),g.current=!0};return window.addEventListener("notion-text-force-save",U),()=>window.removeEventListener("notion-text-force-save",U)},[u,t,v]),A.useEffect(()=>{v&&(v.setEditable(u),u&&(g.current=!1,yS.delete(t),setTimeout(()=>v.commands.focus("end"),0)))},[u,v]),A.useEffect(()=>{if(y.current!==t){y.current=t;const U=xd(n?.html??lS.html);v&&!v.isDestroyed&&v.getHTML()!==U?(f.current=U,_.current=!0,v.commands.setContent(U,{emitUpdate:!1}),Promise.resolve().then(()=>{_.current=!1})):f.current=U}},[t,n?.html,v]);const T=A.useCallback(()=>{!u&&t&&Im(t)},[u,t]),S=A.useCallback(()=>{b.current&&(clearTimeout(b.current),b.current=null);const U=(v?.isEditable?v?.getHTML():null)??f.current;f.current=U,ae.getState().document[t]?.data?.props?.html!==U&&t&&Zg(t,{html:U}),g.current=!0,Im(null)},[t,v]),C=A.useCallback(U=>{if(!(ae.getState().notionTextInlineEditingBlockId===t)||!r.current||r.current.contains(U.target))return;const K=U.target;K?.closest?.("[data-notion-text-toolbar]")||K?.closest?.(".MuiPopover-root, .MuiModal-root, .MuiBackdrop-root, .MuiMenu-root, .MuiDialog-root")||K?.closest?.("[data-slash-menu]")||K?.closest?.("em-emoji-picker")||K?.shadowRoot||K?.closest?.('[role="presentation"]')||document.querySelector(".MuiPopover-root, .MuiModal-root, .MuiDialog-root")||S()},[t,S]);A.useEffect(()=>{if(!u)return;const U=G=>{G.key==="Escape"&&(G.preventDefault(),G.stopPropagation(),S())};return document.addEventListener("keydown",U),document.addEventListener("click",C),()=>{document.removeEventListener("keydown",U),document.removeEventListener("click",C)}},[u,S,C]);const x=ef(l==="desktop"?e?.padding:e?.mobilePadding??e?.padding),k=e?.textAlign??void 0,w={color:e?.borderColor??void 0,top:e?.borderTop??void 0,bottom:e?.borderBottom??void 0,left:e?.borderLeft??void 0,right:e?.borderRight??void 0},D=l==="desktop"?e?.fontSize??void 0:e?.fontSizeMobile??e?.fontSize??void 0,I={color:e?.color??void 0,fontSize:D,fontFamily:Zl(e?.fontFamily),fontWeight:e?.fontWeight??void 0,lineHeight:e?.lineHeight??"inherit",maxWidth:"100%",wordBreak:"break-word"},O=u?f.current:xd(n?.html??lS.html);u||(f.current=O);const M=aEe(t||"default",O,h),P=h?{"--global-link-color":h.linkColor||"inherit","--global-link-text-decoration":h.underline?"underline":"none"}:{};if(i)return m.jsx("div",{style:P,children:m.jsx(Jr,{className:jt(t),padding:x,backgroundColor:e?.backgroundColor,align:k,width:"100%",border:w,children:m.jsx("div",{className:`eb-notion-content ${jt(t)}`,style:{...I,minHeight:"20px"},dangerouslySetInnerHTML:{__html:M}})})});const $=bS(O);return u?m.jsx("div",{ref:r,style:{position:"relative",...P},children:m.jsx(Jr,{className:jt(t),padding:x,backgroundColor:e?.backgroundColor,align:k,width:"100%",border:w,children:m.jsxs("div",{className:"notion-text-inline-editor",style:I,children:[v&&m.jsx(rEe,{editor:v,hidden:d}),m.jsx(nSe,{editor:v,className:"tiptap"})]})})}):m.jsx("div",{ref:r,style:P,children:m.jsx(Jr,{className:jt(t),padding:x,backgroundColor:e?.backgroundColor,align:k,width:"100%",border:w,children:$?m.jsx("div",{className:`eb-notion-content ${jt(t)}`,tabIndex:-1,role:"textbox","aria-label":"Text content",style:{...I,cursor:"text",minHeight:"20px",color:"#adb5bd",transition:"opacity 0.2s ease, box-shadow 0.2s ease"},onClick:T,children:s}):m.jsx("div",{className:`eb-notion-content ${jt(t)}`,tabIndex:-1,role:"textbox","aria-label":"Text content",style:{...I,cursor:"text",minHeight:"20px",transition:"opacity 0.2s ease, box-shadow 0.2s ease"},onClick:T,dangerouslySetInnerHTML:{__html:M}})})})}function rf({children:t}){const e=typeof window<"u",[n,i]=A.useState(e);return A.useEffect(()=>{i(!0)},[]),n?m.jsx(m.Fragment,{children:t}):null}function iSe(t){return function(n){const{type:i,data:r,blockId:a}=n,s=t[i].Component;return n.isNotClient?m.jsx(s,{...r,blockId:a,isNotClient:n.isNotClient}):m.jsx(rf,{children:m.jsx(s,{...r,blockId:a})})}}function rSe(t){const e=Object.keys(t).map(n=>vt({type:Ok(n),data:t[n].schema}));return Sue("type",e).transform(n=>n)}const aSe={p:1.5,display:"flex",flexDirection:"column"},sSe={mb:.75,width:"100%",bgcolor:"cadet.200",display:"flex",justifyContent:"center",p:1,border:"1px solid",borderColor:"cadet.300"};function oSe({label:t,icon:e,onClick:n}){return m.jsxs(Vi,{sx:aSe,onClick:i=>{i.stopPropagation(),n()},children:[m.jsx(Se,{sx:sSe,children:e}),m.jsx(mn,{variant:"body2",children:t})]})}const lSe=[{label:"Text",icon:m.jsx(zU,{}),block:()=>({type:"NotionText",data:{props:{html:""},style:{padding:{top:16,bottom:16,left:24,right:24},mobilePadding:null,fontSize:16,fontWeight:"normal",color:null,backgroundColor:null,textAlign:"left"}}})},{label:"Social",icon:m.jsx(t8,{}),block:()=>({type:"SocialMedia",data:{items:[{id:sm(),key:"facebook",label:"Facebook",iconName:"Facebook",theme:"positive",size:"small",sizePx:"24px",url:"https://maildrill-dev.s3.us-east-2.amazonaws.com/icons/Facebook_Positive_24px.png",href:""}],gap:1,style:{fontSize:36,textAlign:"center",padding:{top:16,bottom:16,left:24,right:24},mobilePadding:null}}})},{label:"Button",icon:m.jsx(u8,{}),block:()=>({type:"Button",data:{props:{text:"Button",buttonTextColor:null,size:"medium"},style:{shape:"rectangle",fontWeight:"normal",fontSize:16,padding:{top:16,bottom:16,left:24,right:24},mobilePadding:null,buttonBackgroundColor:null,buttonTextColor:null}}})},{label:"Image",icon:m.jsx(r8,{}),block:()=>({type:"Image",data:{props:{url:Oce()||qv,alt:null,contentAlignment:"middle",linkHref:null,size:"fill",width:null,height:null,touched:!1},style:{padding:{top:0,bottom:0,left:0,right:0},mobilePadding:null}}})},{label:"Divider",icon:m.jsx(i8,{}),block:()=>({type:"Divider",data:{style:{padding:{top:16,right:0,bottom:16,left:0},mobilePadding:null,width:100},props:{lineColor:"#CCCCCC"}}})},{label:"Spacer",icon:m.jsx(GU,{}),block:()=>({type:"Spacer",data:{}})},{label:"Columns",icon:m.jsx(p8,{}),block:()=>({type:"ColumnsContainer",data:{props:{columnsCount:3,columns:[{childrenIds:[]},{childrenIds:[]},{childrenIds:[]}],fixedWidths:[33,34,33],layout:"layout-33-34-33"},style:{padding:{top:16,bottom:16,left:0,right:0},mobilePadding:null}}})},{label:"Container",icon:m.jsx(s8,{}),block:()=>({type:"Container",data:{style:{padding:{top:16,bottom:16,left:24,right:24},mobilePadding:null}}})}];function lG({anchorEl:t,setAnchorEl:e,onSelect:n}){const i=()=>{e(null)},r=a=>{n(a),e(null)};return t===null?null:m.jsx(iA,{open:!0,anchorEl:t,onClose:i,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},elevation:4,sx:{"& .MuiPaper-root":{borderRadius:"8px"}},children:m.jsx(Se,{sx:{p:1,display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr"},children:lSe.map((a,s)=>m.jsx(oSe,{label:a.label,icon:a.icon,onClick:()=>r(a.block())},s))})})}function cSe({buttonElement:t,onClick:e}){const[n,i]=A.useState(!1);return A.useEffect(()=>{function r({clientX:a,clientY:s}){if(!t)return;const o=t.getBoundingClientRect(),l=o.y,c=o.x,u=c+o.width;if(Math.abs(s-l)<20&&c<a&&a<u){i(!0);return}i(!1)}return window.addEventListener("mousemove",r),()=>{window.removeEventListener("mousemove",r)}},[t,i]),m.jsx(Hv,{in:n,children:m.jsx(Rn,{size:"small",sx:{p:.12,position:"absolute",top:"-12px",left:"50%",transform:"translateX(-10px)",bgcolor:"brand.blue",color:"primary.contrastText",zIndex:"20 !important","&:hover, &:active, &:focus":{bgcolor:"brand.blue",color:"primary.contrastText"}},onClick:r=>{r.stopPropagation(),e()},children:m.jsx(kA,{fontSize:"small"})})})}function uSe({onClick:t}){return m.jsx(Ma,{onClick:e=>{e.stopPropagation(),t()},sx:{display:"flex",alignContent:"center",justifyContent:"center",height:48,width:"fit-content",maxWidth:"fit-content",mx:"auto"},children:m.jsx(kA,{sx:{p:.12,bgcolor:"brand.blue",borderRadius:24,color:"white"},fontSize:"small"})})}function dSe({onSelect:t,placeholder:e}){const[n,i]=A.useState(null),[r,a]=A.useState(null),s=ae(u=>u.selectedMainTab),o=CU(),l=()=>{i(r)},c=()=>e?m.jsx(uSe,{onClick:l}):m.jsx(cSe,{buttonElement:r,onClick:l});return o?null:m.jsxs(m.Fragment,{children:[m.jsx("div",{ref:a,style:{position:"relative",width:"100%",...e?{display:"flex",justifyContent:"center"}:{}},children:s!=="preview"&&c()}),m.jsx(lG,{anchorEl:n,setAnchorEl:i,onSelect:t})]})}function pSe(){return`block-${Date.now()}`}function Al({childrenIds:t,onChange:e,parentId:n,position:i,isNotClient:r}){const a=A.useCallback(c=>{const u=pSe();e({blockId:u,block:c,childrenIds:[...t||[],u]})},[t,e]),[{isOver:s},o]=Ql.useDrop(()=>({accept:"block",drop:(c,u)=>{const d=c.blockId;if(u.didDrop()){u.getDropResult();return}return i===void 0?Gce({parentId:n,blockId:d}):Hce({parentId:n,blockId:d,indexArray:i})},canDrop:c=>!Ou({targetId:n,draggedId:c.blockId})&&c.blockId!==n,collect:c=>({isOver:c.canDrop()?!!c.isOver():!1})}),[n,i]),l=t&&t.length>0?m.jsx(Se,{ref:c=>{o(c)},sx:{minHeight:0,border:s?"2px solid":"",borderColor:s?"secondary.main":void 0},"aria-hidden":!0}):null;return r?t.map(c=>m.jsx(A.Fragment,{children:m.jsx(ev,{id:c,isNotClient:r})},c)):!t||t.length===0?m.jsx(Se,{ref:c=>{o(c)},sx:{border:s?"2px solid":"",borderColor:s?"secondary.main":void 0},children:m.jsx(dSe,{placeholder:!0,onSelect:a})}):m.jsxs(m.Fragment,{children:[t.map(c=>m.jsx(A.Fragment,{children:m.jsx(ev,{id:c})},c)),l]})}const fSe=[{childrenIds:[]},{childrenIds:[]},{childrenIds:[]}];function cG({style:t,props:e,blockId:n,isNotClient:i}){const r=_E(),{columns:a,...s}=e??{},o=a??fSe,l=(c,{block:u,blockId:d,childrenIds:p})=>{const h=ae.getState().document[r],g=h?.data?.props?.columns??o,_=h?.data?.props?{...h.data.props}:{...s};delete _.columns;const b=g.length===2?[...g,{childrenIds:[]}]:[...g];b[c]={childrenIds:p};const y={..._,fixedWidths:_.fixedWidths?.length===2?[..._.fixedWidths,null]:_.fixedWidths},E={type:"ColumnsContainer",data:NA.parse({style:h?.data?.style??t,props:{...y,columns:b}})},v={[d]:u,[r]:E};Qce(v),ia(d)};return i?m.jsx(m.Fragment,{children:m.jsx($k,{blockId:n,props:s,style:t,columns:[m.jsx(Al,{isNotClient:i,parentId:n,position:0,childrenIds:a?.[0]?.childrenIds,onChange:c=>l(0,c)}),m.jsx(Al,{isNotClient:i,parentId:n,position:1,childrenIds:a?.[1]?.childrenIds,onChange:c=>l(1,c)}),m.jsx(Al,{isNotClient:i,parentId:n,position:2,childrenIds:a?.[2]?.childrenIds,onChange:c=>l(2,c)})]})}):m.jsx(rf,{children:m.jsx($k,{blockId:n,props:s,style:t,columns:[m.jsx(Al,{parentId:n,position:0,childrenIds:a?.[0]?.childrenIds,onChange:c=>l(0,c)}),m.jsx(Al,{parentId:n,position:1,childrenIds:a?.[1]?.childrenIds,onChange:c=>l(1,c)}),m.jsx(Al,{parentId:n,position:2,childrenIds:a?.[2]?.childrenIds,onChange:c=>l(2,c)})]})})}function mSe({childrenIds:t}){return m.jsx(m.Fragment,{children:t.map((e,n)=>m.jsx(A.Fragment,{children:m.jsx(ev,{isNotClient:!0,id:e})},e))})}function uG({style:t,props:e,blockId:n,isNotClient:i}){const r=e?.childrenIds??[],a=_E();return m.jsx(S8,{style:t,blockId:`${n}`,children:i?m.jsx(mSe,{parentId:n,childrenIds:r,onChange:({block:s,blockId:o,childrenIds:l})=>{gh(a,o,s,l),ia(o)}}):m.jsx(rf,{children:m.jsx(Al,{parentId:n,childrenIds:r,onChange:({block:s,blockId:o,childrenIds:l})=>{gh(a,o,s,l),ia(o)}})})})}function hSe(t){const e=t.childrenIds??[],n=_E(),i=_i();return m.jsx("div",{onClick:()=>{ia(null)},style:{backgroundColor:t.backdropColor??"#F5F5F5",color:t.textColor??"#262626",fontFamily:Zl(t?.fontFamily||"OPEN_SANS"),fontSize:"16px",fontWeight:"400",letterSpacing:"0.15008px",lineHeight:"1.5",margin:"0",width:"100%"},children:m.jsx("table",{role:"presentation",align:"center",width:"100%",style:{margin:"0 auto",maxWidth:i==="desktop"?Od:vk,backgroundColor:t.canvasColor??"#FFFFFF",borderRadius:t.borderRadius??void 0,border:(()=>{const r=t.borderColor;if(r)return`1px solid ${r}`})()},cellSpacing:"0",cellPadding:"0",border:0,children:m.jsx("tbody",{children:m.jsx("tr",{style:{width:"100%"},children:m.jsx("td",{"data-value":"__content",children:m.jsx(rf,{children:m.jsx(Al,{listEndPolicy:"root",parentId:n,childrenIds:e,onChange:({block:r,blockId:a,childrenIds:s})=>{gh(n,a,r,s),ia(a)}})})})})})})})}const gSe=t=>e=>({position:"absolute",...t?{top:"100%",right:0,marginTop:"8px",flexDirection:"row",width:"auto"}:{top:0,right:"-3rem",flexDirection:"column",width:"2.5rem"},borderRadius:"8px!important",zIndex:"90 !important;",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",border:"1px solid",borderColor:e.palette.secondary.main,padding:"1px",display:"flex",alignItems:"center",justifyContent:"center"});let ld=null;function _Se({blockId:t}){const e=SU(t),{t:n}=Qe.useTranslation("inspector"),{t:i}=Qe.useTranslation(),r=ld&&ld.blockType===e?.type,a=A.useRef(null),[s,o]=A.useState(!1);A.useEffect(()=>{const p=()=>{if(!a.current)return;const g=a.current.parentElement;if(!g)return;const _=g.getBoundingClientRect(),b=g.closest(".preview-container");if(!b)return;b.getBoundingClientRect().right-_.right<48?o(!0):o(!1)};p(),window.addEventListener("resize",p),window.addEventListener("scroll",p,!0);const f=setTimeout(p,100);return()=>{window.removeEventListener("resize",p),window.removeEventListener("scroll",p,!0),clearTimeout(f)}},[t]);const l=A.useCallback(()=>{const p=ae.getState().document,f=ae.getState().notionTextInlineEditingBlockId,h=(y,E,v=new Set)=>{if(v.has(y))return;v.add(y);const T=E[y];T&&(T.type==="Container"&&(T.data?.props?.childrenIds||[]).forEach(C=>h(C,E,v)),T.type==="ColumnsContainer"&&(T.data?.props?.columns||[]).forEach(C=>{(C.childrenIds||[]).forEach(x=>h(x,E,v))}))},g=new Set;h(t,p,g),g.add(t);const _=y=>y&&y.filter(E=>!g.has(E)),b={...p};for(const[y,E]of Object.entries(b)){if(g.has(y))continue;const v=E;switch(v.type){case"EmailLayout":b[y]={...v,data:{...v.data,childrenIds:_(v.data.childrenIds)}};break;case"Container":b[y]={...v,data:{...v.data,props:{...v.data.props,childrenIds:_(v.data.props?.childrenIds)}}};break;case"ColumnsContainer":b[y]={...v,data:{...v.data,props:{...v.data.props,columns:v.data.props?.columns?.map(T=>({...T,childrenIds:_(T.childrenIds)}))}}};break;default:b[y]=v}}for(const y of g)delete b[y];f&&(f===t||g.has(f))&&Im(null),fu(b),ia(null)},[t]),c=A.useCallback(()=>{e&&"style"in e.data&&e.data.style&&(ld={styles:JSON.parse(JSON.stringify(e.data.style)),blockType:e.type})},[e]),u=A.useCallback(()=>{const p=ae.getState().document;if(!ld||ld.blockType!==e?.type)return;const f={...p},h=f[t];h&&(f[t]={...h,data:{...h.data,style:JSON.parse(JSON.stringify(ld.styles))}},fu(f),ia(t))},[t,e]),d=A.useCallback(()=>{Yce(t)},[t]);return m.jsxs(Qo,{ref:a,sx:gSe(s),onClick:p=>p.stopPropagation(),elevation:10,children:[m.jsx(hn,{title:n("actions.copyFormat"),placement:"left-start",children:m.jsx("span",{children:m.jsx(Rn,{onClick:c,sx:{padding:"4px",overflow:"hidden",color:"text.primary"},disabled:!(e&&"style"in e.data&&e.data.style),children:m.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m.jsx("path",{d:"M12 22.5C6.49 22.5 2 18.01 2 12.5C2 6.99 6.49 2.5 12 2.5C17.51 2.5 22 6.54 22 11.5C22 14.81 19.31 17.5 16 17.5H14.23C13.95 17.5 13.73 17.72 13.73 18C13.73 18.12 13.78 18.23 13.86 18.33C14.27 18.8 14.5 19.39 14.5 20C14.5 21.38 13.38 22.5 12 22.5ZM12 4.5C7.59 4.5 4 8.09 4 12.5C4 16.91 7.59 20.5 12 20.5C12.28 20.5 12.5 20.28 12.5 20C12.5 19.84 12.42 19.72 12.36 19.65C11.95 19.19 11.73 18.6 11.73 18C11.73 16.62 12.85 15.5 14.23 15.5H16C18.21 15.5 20 13.71 20 11.5C20 7.64 16.41 4.5 12 4.5Z",fill:"currentColor"}),m.jsx("path",{d:"M6.5 13.5C7.32843 13.5 8 12.8284 8 12C8 11.1716 7.32843 10.5 6.5 10.5C5.67157 10.5 5 11.1716 5 12C5 12.8284 5.67157 13.5 6.5 13.5Z",fill:"currentColor"}),m.jsx("path",{d:"M9.5 9.5C10.3284 9.5 11 8.82843 11 8C11 7.17157 10.3284 6.5 9.5 6.5C8.67157 6.5 8 7.17157 8 8C8 8.82843 8.67157 9.5 9.5 9.5Z",fill:"currentColor"}),m.jsx("path",{d:"M14.5 9.5C15.3284 9.5 16 8.82843 16 8C16 7.17157 15.3284 6.5 14.5 6.5C13.6716 6.5 13 7.17157 13 8C13 8.82843 13.6716 9.5 14.5 9.5Z",fill:"currentColor"}),m.jsx("path",{d:"M17.5 13.5C18.3284 13.5 19 12.8284 19 12C19 11.1716 18.3284 10.5 17.5 10.5C16.6716 10.5 16 11.1716 16 12C16 12.8284 16.6716 13.5 17.5 13.5Z",fill:"currentColor"})]})})})}),m.jsx(hn,{title:n(r?"actions.pasteFormatting":"actions.noFormatSupported"),placement:"left-start",children:m.jsx("span",{children:m.jsx(Rn,{onClick:u,sx:{padding:"4px",overflow:"hidden",color:r?"text.primary":"text.disabled"},disabled:!r,children:m.jsx("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M10.9551 22.6497C10.5139 22.6497 10.1287 22.4888 9.79934 22.167C9.47017 21.8451 9.30559 21.4582 9.30559 21.0062V16.1317H5.54784C5.09367 16.1317 4.69725 15.9624 4.35859 15.6237C4.01992 15.2851 3.85059 14.8886 3.85059 14.4345V7.10448C3.85059 6.07631 4.21 5.19264 4.92884 4.45348C5.6475 3.71431 6.52667 3.34473 7.56634 3.34473H19.2978C19.5378 3.34473 19.7408 3.42773 19.9066 3.59373C20.0726 3.75956 20.1556 3.96248 20.1556 4.20248V14.4345C20.1556 14.8886 19.9871 15.2851 19.6501 15.6237C19.3131 15.9624 18.9138 16.1317 18.4523 16.1317H14.7006V21.0062C14.7006 21.4582 14.536 21.8451 14.2068 22.167C13.8775 22.4888 13.4923 22.6497 13.0511 22.6497H10.9551ZM5.54784 10.6145H18.4523V5.04798H17.0463V8.41773C17.0463 8.63189 16.9744 8.81139 16.8306 8.95623C16.6869 9.10106 16.5063 9.17348 16.2888 9.17348C16.0715 9.17348 15.8924 9.10106 15.7516 8.95623C15.6108 8.81139 15.5403 8.63189 15.5403 8.41773V5.04798H13.7533V6.40148C13.7533 6.61814 13.6815 6.79789 13.5378 6.94073C13.394 7.08373 13.2134 7.15523 12.9961 7.15523C12.7786 7.15523 12.5994 7.08373 12.4586 6.94073C12.3178 6.79789 12.2473 6.61814 12.2473 6.40148V5.04798H7.56634C6.97717 5.04798 6.4935 5.24764 6.11534 5.64698C5.737 6.04631 5.54784 6.53214 5.54784 7.10448V10.6145ZM5.54784 14.4345H18.4523V12.0965H5.54784V14.4345Z",fill:"currentColor"})})})})}),m.jsx(hn,{title:i("editor.cloneBlock"),placement:"left-start",children:m.jsx(Rn,{onClick:d,sx:{padding:"4px",overflow:"hidden",color:"text.primary"},children:m.jsx(zue,{sx:{fontSize:"1.25rem"}})})}),m.jsx(hn,{title:n("actions.delete"),placement:"left-start",children:m.jsx(Rn,{onClick:l,sx:{overflow:"hidden",color:"error.main",padding:"4px"},children:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:m.jsx("path",{d:"M16 9.5V19.5H8V9.5H16ZM14.5 3.5H9.5L8.5 4.5H5V6.5H19V4.5H15.5L14.5 3.5ZM18 7.5H6V19.5C6 20.6 6.9 21.5 8 21.5H16C17.1 21.5 18 20.6 18 19.5V7.5Z",fill:"#EF4444"})})})})]})}const bSe=A.memo(_Se),CL=150,ySe=25;let qm=null,Zy=null;function N2(){qm&&(clearTimeout(qm),qm=null),Zy=null}function TL(t){Zy===t&&N2()}function vSe(t,e,n,i){N2(),Zy=t,qm=setTimeout(()=>{qm=null,Zy=null,n()&&(tb(t),i())},e)}function ESe(t){const e=t.closest(".preview-container");if(!e)return CL;let n=0,i=t;for(;i&&e.contains(i)&&(i.hasAttribute("data-block-id")&&(n+=1),i!==e);)i=i.parentElement;return CL+Math.max(0,n-1)*ySe}function SSe(t){const e=ag();return A.useMemo(()=>e?Ou({draggedId:t,targetId:e}):!1,[t,e])}function CSe(t){if(!t||typeof t.nodeType!="number")return null;const e=t,n=e.closest?.(".preview-container");if(!n)return null;const i=e.closest?.("[data-block-id]"),r=i?.getAttribute("data-block-id")??null;return!r||!i||!n.contains(i)?null:r}function TSe({children:t,canEdit:e=!0,isNotClient:n=!1}){const i=_E(),{t:r}=Qe.useTranslation(),a=Cce(),s=Sce(i),o=Ece(i),l=gA(),c=ag(),u=Tce();xce();const d=SSe(i),[p,f]=A.useState(!1),[h,g]=A.useState(0),_=A.useRef(null),b=A.useRef(null),[y,E]=A.useState(null),v=sn(),T=CU(),[S,C]=A.useState(null),x=c===i||d,k=u===i,w=v.palette.primary.light||v.palette.primary.main,D=A.useRef(null),L=A.useRef(!0);if(n)return m.jsxs(m.Fragment,{children:[m.jsx("div",{style:{width:"100%"}}),m.jsx(Se,{sx:{position:"relative",maxWidth:"100%"},children:m.jsx("div",{children:t})}),m.jsx("div",{style:{width:"100%"}})]});let I,O;k&&e?(I=`2px solid ${w}`,O="10"):s&&e?(I=`2px solid ${v.palette.secondary.main}`,O="1"):p&&e?I=`2px dotted ${v.palette.secondary.main}`:O="auto";const M=()=>!s||!e?null:m.jsx(bSe,{blockId:i}),P=X=>{const J=X.getClientOffset(),j=_.current?.getBoundingClientRect(),oe=b.current?.getBoundingClientRect();if(!J||!j||!oe)return null;const le=Math.abs(J.y-j.y),xe=Math.abs(J.y-oe.y);return le<xe?"up":"down"},[{isOver:$},U]=Ql.useDrop(()=>({accept:"block",drop:(X,J)=>{const j=i,oe=X.blockId;if(j===oe)return;if(J.didDrop()){J.getDropResult();return}const le=P(J);if(le)hh(j,oe,le);else{hh(j,oe,"down");return}},canDrop:(X,J)=>!Ou({targetId:i,draggedId:X.blockId}),collect:X=>({isOver:X.canDrop()?X.isOver({shallow:!0}):!1}),hover:(X,J)=>{if(X.blockId===i){E(null);return}if(!J.canDrop()||!J.isOver({shallow:!0})){E(null);return}const j=P(J);if(!j){E(null);return}E(j)},end:()=>{E(null)}}));A.useEffect(()=>{$||E(null)},[$]);const G=()=>m.jsxs("div",{style:{height:"3px",background:v.palette.secondary.main,position:"relative",color:v.palette.secondary.main},children:[m.jsx("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:m.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"})}),m.jsx("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:m.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"})})]}),V=Ql.useDrag(()=>({type:"block",item:()=>{const X=ae.getState().notionTextInlineEditingBlockId;return X&&window.dispatchEvent(new CustomEvent("notion-text-force-save",{detail:{blockId:X}})),{blockId:i}},canDrag:!x,collect:X=>({borderDrag:X.isDragging()?"2px dotted yellow":"",isDragging:X.isDragging()}),end:()=>{g(Date.now())}}),[x,i]),[{borderDrag:K="",isDragging:te},Te]=V||[{borderDrag:"",isDragging:!1},A.useRef(null)],de=e&&l!=="preview"&&!x&&!T&&(te||a===i||a==null&&s);A.useEffect(()=>(L.current=!0,()=>{L.current=!1,TL(i),D.current&&(clearTimeout(D.current),D.current=null),ae.getState().canvasHoveredBlockId===i&&tb(null)}),[i]);const Oe=X=>{const J=Date.now()-h;if(!(te||h>0&&J<200)&&(X.stopPropagation(),l!=="preview")){if(o==="NotionText"){const j=new CustomEvent("email-builder-highlight-editor",{detail:!0});window.dispatchEvent(j)}ia(i)}},se=A.useMemo(()=>A.cloneElement(t,{onClick:X=>{t.props.onClick&&t.props.onClick(X),!X.defaultPrevented&&!X.isPropagationStopped()&&(te||Oe(X))},onMouseDown:X=>{t.props.onMouseDown&&t.props.onMouseDown(X)},onMouseUp:X=>{t.props.onMouseUp&&t.props.onMouseUp(X)}}),[t,te,i,o,l]);return m.jsxs(m.Fragment,{children:[y==="up"&&m.jsx(G,{}),m.jsx("div",{ref:_,style:{width:"100%"}}),m.jsx(Se,{"data-block-id":i,sx:{position:"relative",maxWidth:"100%"},ref:U,onMouseEnter:X=>{X.stopPropagation(),N2(),D.current&&(clearTimeout(D.current),D.current=null);const J=ESe(X.currentTarget);vSe(i,J,()=>L.current,()=>f(!0))},onMouseLeave:X=>{TL(i),D.current&&clearTimeout(D.current);const J=X.relatedTarget;D.current=setTimeout(()=>{if(f(!1),ae.getState().canvasHoveredBlockId!==i)return;const j=CSe(J);tb(j&&j!==i?j:null)},150)},onClick:Oe,children:m.jsxs(Se,{sx:{position:"relative",maxWidth:"100%",outlineOffset:"-1px",outline:I,zIndex:O,transition:"outline 0.2s ease-in-out, z-index 0.2s ease-in-out"},children:[M(),de?m.jsx(Se,{sx:{position:"absolute",left:"50%",top:-20,transform:"translateX(-50%)",zIndex:10,display:"flex",flexDirection:"row",alignItems:"center",borderRadius:"6px 6px 0 0",overflow:"hidden",backgroundColor:k&&e?w:v.palette.secondary.main},children:m.jsx(hn,{title:r("editor.dragBlockHandle"),placement:"top",children:m.jsx(Rn,{ref:Te,type:"button","aria-label":r("editor.dragBlockHandle"),size:"small",onClick:X=>X.stopPropagation(),sx:{padding:"3px 6px",rotate:"90deg",borderRadius:0,color:"white",cursor:te?"grabbing":"grab","&:hover":{backgroundColor:"rgba(255,255,255,0.15)"}},children:m.jsx(jU,{sx:{fontSize:15}})})})}):null,m.jsx(lG,{anchorEl:S,setAnchorEl:C,onSelect:X=>{const J=Kce(i,X);J&&ia(J),C(null)}}),m.jsx(Hv,{in:k&&e,timeout:200,children:m.jsx(Ob,{label:r("editor.editing"),icon:m.jsx(qU,{}),size:"small",sx:{position:"absolute",left:-1,top:-26,backgroundColor:w,color:"white",fontWeight:600,fontSize:"0.75rem",zIndex:-1,boxShadow:"0 2px 8px rgba(0,0,0,0.15)","& .MuiChip-icon":{color:"white",fontSize:"1rem"}}})}),m.jsx("div",{style:{border:K},children:se}),de?m.jsx(Se,{sx:{position:"absolute",left:"50%",bottom:-10,transform:"translateX(-50%)",zIndex:10,width:20,height:20,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:k&&e?w:v.palette.secondary.main},children:m.jsx(hn,{title:r("editor.addBlockAtEnd"),placement:"bottom",children:m.jsx(Rn,{type:"button",onClick:X=>{X.stopPropagation(),C(X.currentTarget)},sx:{padding:0,width:20,height:20,minWidth:20,borderRadius:"50%",color:"white","&:hover":{backgroundColor:"rgba(255,255,255,0.15)"}},children:m.jsx(LU,{sx:{fontSize:18}})})})}):null]})}),y==="down"&&m.jsx(G,{}),m.jsx("div",{ref:b,style:{width:"100%"}})]})}const Ss=A.memo(TSe,(t,e)=>t.children===e.children&&t.canEdit===e.canEdit&&t.isNotClient===e.isNotClient),xSe=A.memo(L8),kSe=A.memo(PU),wSe=A.memo(uG),DSe=A.memo(cG),ASe=A.memo(R8),NSe=A.memo(O8),RSe=A.memo(M8),ISe=A.memo(oG),OSe=A.memo($8),MSe=A.memo(k8),dG={SocialMedia:{schema:P8,Component:t=>m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(xSe,{...t})})},Button:{schema:MU,Component:t=>m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(kSe,{...t})})},Container:{schema:C8,Component:t=>m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(wSe,{...t})})},ColumnsContainer:{schema:NA,Component:t=>m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(DSe,{...t})})},Heading:{schema:N8,Component:t=>m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(ASe,{...t})})},Html:{schema:I8,Component:t=>m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(NSe,{...t})})},Image:{schema:RA,Component:t=>{const e={...t,props:{...t.props,url:t.props?.url??"https://placehold.co/600x400@2x/F8F8F8/CCC?text=Your%20image"}};return m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(RSe,{...e})})}},NotionText:{schema:sEe,Component:t=>m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(ISe,{blockId:t.blockId??"",...t})})},EmailLayout:{schema:D8,Component:t=>m.jsx(hSe,{...t})},Spacer:{schema:B8,Component:t=>m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(OSe,{...t})})},Divider:{schema:x8,Component:t=>m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(MSe,{...t})})}},PSe=iSe(dG),LSe=rSe(dG),FSe=LSe;Cue(nt(),FSe);const pG=A.createContext(null),_E=()=>A.useContext(pG),ev=A.memo(function({id:e,isNotClient:n}){const i=ae(r=>r.document[e]);return i?m.jsx(pG.Provider,{value:e,children:m.jsx(PSe,{isNotClient:n,...i,blockId:e})}):(console.warn(`Block ${e} not found`),null)},(t,e)=>t.id===e.id&&t.isNotClient===e.isNotClient),xL=()=>{const t=_i(),{t:e}=Qe.useTranslation("inspector"),n=(i,r)=>{switch(r){case"mobile":case"desktop":qb(r);return;default:qb("desktop")}};return m.jsxs(Qp,{value:t,exclusive:!0,size:"small",onChange:n,sx:{"& .MuiToggleButtonGroup-grouped":{minWidth:40,py:.75,px:1}},children:[m.jsx(_n,{value:"desktop",children:m.jsx(hn,{title:e("inputs.screenSelector.desktop"),children:m.jsx(dde,{fontSize:"small"})})}),m.jsx(_n,{value:"mobile",children:m.jsx(hn,{title:e("inputs.screenSelector.mobile"),children:m.jsx(hde,{fontSize:"small"})})})]})};function fG({document:t,disabledInteraction:e=!1,isNotClient:n=!1,onRendered:i}){const r=A.useRef(null),a=_i(),s=A.useMemo(()=>{const h=t.root?.data?.childrenIds??[];return JSON.stringify(h)},[t.root?.data]),o=A.useMemo(()=>{const h=t.root.data.childrenIds??[];return Object.fromEntries(Object.entries(t).filter(([g])=>g!=="root"&&h.includes(g)).sort(([g],[_])=>h.indexOf(g)-h.indexOf(_)))},[t,s]),c=A.useMemo(()=>t.root,[t.root]).data;function u({borderColor:f}){if(f)return`1px solid ${f}`}const d=A.createContext({});A.useEffect(()=>{if(typeof i=="function"){const f=requestAnimationFrame(()=>{i()});return()=>cancelAnimationFrame(f)}},[t,a,i]);const p=(f,h)=>{const g=t[f];if(!g||f==="root")return null;switch(g.type){case"Button":return m.jsx(PU,{...g.data,blockId:f,isNotClient:n},h);case"Container":{if(n){const _=g.data?.props?.childrenIds??[];return m.jsx(S8,{style:g.data?.style,blockId:f,children:_.map((b,y)=>p(b,y))},h)}return m.jsx(uG,{...g.data,blockId:f,isNotClient:n},h)}case"ColumnsContainer":{if(n){const{columns:_,...b}=g.data?.props??{},y=_?.map(E=>E.childrenIds.map((v,T)=>p(v,T)));return m.jsx($k,{blockId:f,props:b,columns:y,style:g.data?.style},h)}return m.jsx(cG,{...g.data,blockId:f,isNotClient:n},h)}case"Heading":return m.jsx(R8,{...g.data},h);case"Html":return m.jsx(O8,{...g.data},h);case"Image":return m.jsx(M8,{...g.data,blockId:f,isNotClient:n},h);case"NotionText":return m.jsx(oG,{...g.data,blockId:f,isNotClient:n},h);case"Spacer":return m.jsx($8,{...g.data,blockId:f},h);case"Divider":return m.jsx(k8,{...g.data,blockId:f,isNotClient:n},h);case"SocialMedia":return m.jsx(L8,{...g.data,blockId:f,isNotClient:n},h);default:return console.warn(`Unknown block type: ${g.type}`),null}};return n?m.jsx("div",{ref:r,style:{backgroundColor:c.backdropColor??"#F5F5F5",color:c.textColor??"#262626",fontFamily:Zl(c.fontFamily),fontSize:"16px",fontWeight:"400",letterSpacing:"0.15008px",lineHeight:"1.5",margin:"0",padding:"0 0",borderRadius:c.borderRadius||0,pointerEvents:"auto"},className:"main-table-container",children:m.jsx("table",{role:"presentation",align:"center",className:"main-table-container",style:{margin:"0 auto",maxWidth:a==="desktop"?Od:vk,width:a==="desktop"?Od:"100%",backgroundColor:c.canvasColor??"#FFFFFF",borderRadius:c.borderRadius??void 0,border:u(c),overflow:"hidden",pointerEvents:e?"none":"auto"},cellSpacing:"0",cellPadding:"0",border:0,children:m.jsx("tbody",{children:m.jsx("tr",{className:"main-table-container",children:m.jsx("td",{children:Object.keys(o).map((f,h)=>p(f,h))})})})})}):m.jsx(rf,{children:m.jsx(d.Provider,{value:t,children:m.jsx("div",{ref:r,style:{backgroundColor:c.backdropColor??"#F5F5F5",color:c.textColor??"#262626",fontFamily:Zl(c.fontFamily),fontSize:"16px",fontWeight:"400",letterSpacing:"0.15008px",lineHeight:"1.5",margin:"0",padding:"0 0",borderRadius:c.borderRadius||0,pointerEvents:"auto"},className:"main-table-container",children:m.jsx("table",{role:"presentation",align:"center",className:"main-table-container",style:{margin:"0 auto",maxWidth:a==="desktop"?Od:vk,width:a==="desktop"?Od:"100%",backgroundColor:c.canvasColor??"#FFFFFF",borderRadius:c.borderRadius??void 0,border:u(c),overflow:"hidden",pointerEvents:e?"none":"auto"},cellSpacing:"0",cellPadding:"0",border:0,children:m.jsx("tbody",{children:m.jsx("tr",{className:"main-table-container",children:m.jsx("td",{children:Object.keys(o).map((f,h)=>p(f,h))})})})})})})})}function BSe(){const t=hA(),e=A.useMemo(()=>`data:text/plain,${encodeURIComponent(JSON.stringify(t,null," "))}`,[t]);return m.jsx(hn,{title:"Download JSON file",children:m.jsx(Rn,{href:e,download:"emailTemplate.json",children:m.jsx(Jue,{fontSize:"small"})})})}const vS=0,je=1,Kt=2,ki=3,zn=4,ds=5,bE=6,Hi=7,Dr=8,Zt=9,xt=10,ni=11,Wt=12,pi=13,mg=14,Ar=15,rr=16,$r=17,ao=18,la=19,ps=20,Ri=21,Nn=22,ar=23,Ba=24,Sr=25,$Se=0;function Mi(t){return t>=48&&t<=57}function rc(t){return Mi(t)||t>=65&&t<=70||t>=97&&t<=102}function R2(t){return t>=65&&t<=90}function USe(t){return t>=97&&t<=122}function zSe(t){return R2(t)||USe(t)}function HSe(t){return t>=128}function tv(t){return zSe(t)||HSe(t)||t===95}function mG(t){return tv(t)||Mi(t)||t===45}function GSe(t){return t>=0&&t<=8||t===11||t>=14&&t<=31||t===127}function nv(t){return t===10||t===13||t===12}function Cu(t){return nv(t)||t===32||t===9}function $s(t,e){return!(t!==92||nv(e)||e===$Se)}function cb(t,e,n){return t===45?tv(e)||e===45||$s(e,n):tv(t)?!0:t===92?$s(t,e):!1}function ES(t,e,n){return t===43||t===45?Mi(e)?2:e===46&&Mi(n)?3:0:t===46?Mi(e)?2:0:Mi(t)?1:0}function hG(t){return t===65279||t===65534?1:0}const Ew=new Array(128),jSe=128,ub=130,gG=131,I2=132,_G=133;for(let t=0;t<Ew.length;t++)Ew[t]=Cu(t)&&ub||Mi(t)&&gG||tv(t)&&I2||GSe(t)&&_G||t||jSe;function SS(t){return t<128?Ew[t]:I2}function Wd(t,e){return e<t.length?t.charCodeAt(e):0}function Sw(t,e,n){return n===13&&Wd(t,e+1)===10?2:1}function Yd(t,e,n){let i=t.charCodeAt(e);return R2(i)&&(i=i|32),i===n}function Oh(t,e,n,i){if(n-e!==i.length||e<0||n>t.length)return!1;for(let r=e;r<n;r++){const a=i.charCodeAt(r-e);let s=t.charCodeAt(r);if(R2(s)&&(s=s|32),s!==a)return!1}return!0}function qSe(t,e){for(;e>=0&&Cu(t.charCodeAt(e));e--);return e+1}function v_(t,e){for(;e<t.length&&Cu(t.charCodeAt(e));e++);return e}function CS(t,e){for(;e<t.length&&Mi(t.charCodeAt(e));e++);return e}function Tp(t,e){if(e+=2,rc(Wd(t,e-1))){for(const i=Math.min(t.length,e+5);e<i&&rc(Wd(t,e));e++);const n=Wd(t,e);Cu(n)&&(e+=Sw(t,e,n))}return e}function E_(t,e){for(;e<t.length;e++){const n=t.charCodeAt(e);if(!mG(n)){if($s(n,Wd(t,e+1))){e=Tp(t,e)-1;continue}break}}return e}function yE(t,e){let n=t.charCodeAt(e);if((n===43||n===45)&&(n=t.charCodeAt(e+=1)),Mi(n)&&(e=CS(t,e+1),n=t.charCodeAt(e)),n===46&&Mi(t.charCodeAt(e+1))&&(e+=2,e=CS(t,e)),Yd(t,e,101)){let i=0;n=t.charCodeAt(e+1),(n===45||n===43)&&(i=1,n=t.charCodeAt(e+2)),Mi(n)&&(e=CS(t,e+1+i+1))}return e}function TS(t,e){for(;e<t.length;e++){const n=t.charCodeAt(e);if(n===41){e++;break}$s(n,Wd(t,e+1))&&(e=Tp(t,e))}return e}function bG(t){if(t.length===1&&!rc(t.charCodeAt(0)))return t[0];let e=parseInt(t,16);return(e===0||e>=55296&&e<=57343||e>1114111)&&(e=65533),String.fromCodePoint(e)}const yG=["EOF-token","ident-token","function-token","at-keyword-token","hash-token","string-token","bad-string-token","url-token","bad-url-token","delim-token","number-token","percentage-token","dimension-token","whitespace-token","CDO-token","CDC-token","colon-token","semicolon-token","comma-token","[-token","]-token","(-token",")-token","{-token","}-token"],VSe=16*1024;function iv(t=null,e){return t===null||t.length<e?new Uint32Array(Math.max(e+1024,VSe)):t}const kL=10,WSe=12,wL=13;function DL(t){const e=t.source,n=e.length,i=e.length>0?hG(e.charCodeAt(0)):0,r=iv(t.lines,n),a=iv(t.columns,n);let s=t.startLine,o=t.startColumn;for(let l=i;l<n;l++){const c=e.charCodeAt(l);r[l]=s,a[l]=o++,(c===kL||c===wL||c===WSe)&&(c===wL&&l+1<n&&e.charCodeAt(l+1)===kL&&(l++,r[l]=s,a[l]=o),s++,o=1)}r[n]=s,a[n]=o,t.lines=r,t.columns=a,t.computed=!0}class YSe{constructor(){this.lines=null,this.columns=null,this.computed=!1}setSource(e,n=0,i=1,r=1){this.source=e,this.startOffset=n,this.startLine=i,this.startColumn=r,this.computed=!1}getLocation(e,n){return this.computed||DL(this),{source:n,offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]}}getLocationRange(e,n,i){return this.computed||DL(this),{source:i,start:{offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]},end:{offset:this.startOffset+n,line:this.lines[n],column:this.columns[n]}}}}const ha=16777215,ml=24,KSe=new Map([[Kt,Nn],[Ri,Nn],[la,ps],[ar,Ba]]);class QSe{constructor(e,n){this.setSource(e,n)}reset(){this.eof=!1,this.tokenIndex=-1,this.tokenType=0,this.tokenStart=this.firstCharOffset,this.tokenEnd=this.firstCharOffset}setSource(e="",n=()=>{}){e=String(e||"");const i=e.length,r=iv(this.offsetAndType,e.length+1),a=iv(this.balance,e.length+1);let s=0,o=0,l=0,c=-1;for(this.offsetAndType=null,this.balance=null,n(e,(u,d,p)=>{switch(u){default:a[s]=i;break;case o:{let f=l&ha;for(l=a[f],o=l>>ml,a[s]=f,a[f++]=s;f<s;f++)a[f]===i&&(a[f]=s);break}case Ri:case Kt:case la:case ar:a[s]=l,o=KSe.get(u),l=o<<ml|s;break}r[s++]=u<<ml|p,c===-1&&(c=d)}),r[s]=vS<<ml|i,a[s]=i,a[i]=i;l!==0;){const u=l&ha;l=a[u],a[u]=i}this.source=e,this.firstCharOffset=c===-1?0:c,this.tokenCount=s,this.offsetAndType=r,this.balance=a,this.reset(),this.next()}lookupType(e){return e+=this.tokenIndex,e<this.tokenCount?this.offsetAndType[e]>>ml:vS}lookupOffset(e){return e+=this.tokenIndex,e<this.tokenCount?this.offsetAndType[e-1]&ha:this.source.length}lookupValue(e,n){return e+=this.tokenIndex,e<this.tokenCount?Oh(this.source,this.offsetAndType[e-1]&ha,this.offsetAndType[e]&ha,n):!1}getTokenStart(e){return e===this.tokenIndex?this.tokenStart:e>0?e<this.tokenCount?this.offsetAndType[e-1]&ha:this.offsetAndType[this.tokenCount]&ha:this.firstCharOffset}substrToCursor(e){return this.source.substring(e,this.tokenStart)}isBalanceEdge(e){return this.balance[this.tokenIndex]<e}isDelim(e,n){return n?this.lookupType(n)===Zt&&this.source.charCodeAt(this.lookupOffset(n))===e:this.tokenType===Zt&&this.source.charCodeAt(this.tokenStart)===e}skip(e){let n=this.tokenIndex+e;n<this.tokenCount?(this.tokenIndex=n,this.tokenStart=this.offsetAndType[n-1]&ha,n=this.offsetAndType[n],this.tokenType=n>>ml,this.tokenEnd=n&ha):(this.tokenIndex=this.tokenCount,this.next())}next(){let e=this.tokenIndex+1;e<this.tokenCount?(this.tokenIndex=e,this.tokenStart=this.tokenEnd,e=this.offsetAndType[e],this.tokenType=e>>ml,this.tokenEnd=e&ha):(this.eof=!0,this.tokenIndex=this.tokenCount,this.tokenType=vS,this.tokenStart=this.tokenEnd=this.source.length)}skipSC(){for(;this.tokenType===pi||this.tokenType===Sr;)this.next()}skipUntilBalanced(e,n){let i=e,r,a;e:for(;i<this.tokenCount;i++){if(r=this.balance[i],r<e)break e;switch(a=i>0?this.offsetAndType[i-1]&ha:this.firstCharOffset,n(this.source.charCodeAt(a))){case 1:break e;case 2:i++;break e;default:this.balance[r]===i&&(i=r)}}this.skip(i-this.tokenIndex)}forEachToken(e){for(let n=0,i=this.firstCharOffset;n<this.tokenCount;n++){const r=i,a=this.offsetAndType[n],s=a&ha,o=a>>ml;i=s,e(o,r,s,n)}}dump(){const e=new Array(this.tokenCount);return this.forEachToken((n,i,r,a)=>{e[a]={idx:a,type:yG[n],chunk:this.source.substring(i,r),balance:this.balance[a]}}),e}}function vE(t,e){function n(d){return d<o?t.charCodeAt(d):0}function i(){if(c=yE(t,c),cb(n(c),n(c+1),n(c+2))){u=Wt,c=E_(t,c);return}if(n(c)===37){u=ni,c++;return}u=xt}function r(){const d=c;if(c=E_(t,c),Oh(t,d,c,"url")&&n(c)===40){if(c=v_(t,c+1),n(c)===34||n(c)===39){u=Kt,c=d+4;return}s();return}if(n(c)===40){u=Kt,c++;return}u=je}function a(d){for(d||(d=n(c++)),u=ds;c<t.length;c++){const p=t.charCodeAt(c);switch(SS(p)){case d:c++;return;case ub:if(nv(p)){c+=Sw(t,c,p),u=bE;return}break;case 92:if(c===t.length-1)break;const f=n(c+1);nv(f)?c+=Sw(t,c+1,f):$s(p,f)&&(c=Tp(t,c)-1);break}}}function s(){for(u=Hi,c=v_(t,c);c<t.length;c++){const d=t.charCodeAt(c);switch(SS(d)){case 41:c++;return;case ub:if(c=v_(t,c),n(c)===41||c>=t.length){c<t.length&&c++;return}c=TS(t,c),u=Dr;return;case 34:case 39:case 40:case _G:c=TS(t,c),u=Dr;return;case 92:if($s(d,n(c+1))){c=Tp(t,c)-1;break}c=TS(t,c),u=Dr;return}}}t=String(t||"");const o=t.length;let l=hG(n(0)),c=l,u;for(;c<o;){const d=t.charCodeAt(c);switch(SS(d)){case ub:u=pi,c=v_(t,c+1);break;case 34:a();break;case 35:mG(n(c+1))||$s(n(c+1),n(c+2))?(u=zn,c=E_(t,c+1)):(u=Zt,c++);break;case 39:a();break;case 40:u=Ri,c++;break;case 41:u=Nn,c++;break;case 43:ES(d,n(c+1),n(c+2))?i():(u=Zt,c++);break;case 44:u=ao,c++;break;case 45:ES(d,n(c+1),n(c+2))?i():n(c+1)===45&&n(c+2)===62?(u=Ar,c=c+3):cb(d,n(c+1),n(c+2))?r():(u=Zt,c++);break;case 46:ES(d,n(c+1),n(c+2))?i():(u=Zt,c++);break;case 47:n(c+1)===42?(u=Sr,c=t.indexOf("*/",c+2),c=c===-1?t.length:c+2):(u=Zt,c++);break;case 58:u=rr,c++;break;case 59:u=$r,c++;break;case 60:n(c+1)===33&&n(c+2)===45&&n(c+3)===45?(u=mg,c=c+4):(u=Zt,c++);break;case 64:cb(n(c+1),n(c+2),n(c+3))?(u=ki,c=E_(t,c+1)):(u=Zt,c++);break;case 91:u=la,c++;break;case 92:$s(d,n(c+1))?r():(u=Zt,c++);break;case 93:u=ps,c++;break;case 123:u=ar,c++;break;case 125:u=Ba,c++;break;case gG:i();break;case I2:r();break;default:u=Zt,c++}e(u,l,l=c)}}let cd=null;class Jt{static createItem(e){return{prev:null,next:null,data:e}}constructor(){this.head=null,this.tail=null,this.cursor=null}createItem(e){return Jt.createItem(e)}allocateCursor(e,n){let i;return cd!==null?(i=cd,cd=cd.cursor,i.prev=e,i.next=n,i.cursor=this.cursor):i={prev:e,next:n,cursor:this.cursor},this.cursor=i,i}releaseCursor(){const{cursor:e}=this;this.cursor=e.cursor,e.prev=null,e.next=null,e.cursor=cd,cd=e}updateCursors(e,n,i,r){let{cursor:a}=this;for(;a!==null;)a.prev===e&&(a.prev=n),a.next===i&&(a.next=r),a=a.cursor}*[Symbol.iterator](){for(let e=this.head;e!==null;e=e.next)yield e.data}get size(){let e=0;for(let n=this.head;n!==null;n=n.next)e++;return e}get isEmpty(){return this.head===null}get first(){return this.head&&this.head.data}get last(){return this.tail&&this.tail.data}fromArray(e){let n=null;this.head=null;for(let i of e){const r=Jt.createItem(i);n!==null?n.next=r:this.head=r,r.prev=n,n=r}return this.tail=n,this}toArray(){return[...this]}toJSON(){return[...this]}forEach(e,n=this){const i=this.allocateCursor(null,this.head);for(;i.next!==null;){const r=i.next;i.next=r.next,e.call(n,r.data,r,this)}this.releaseCursor()}forEachRight(e,n=this){const i=this.allocateCursor(this.tail,null);for(;i.prev!==null;){const r=i.prev;i.prev=r.prev,e.call(n,r.data,r,this)}this.releaseCursor()}reduce(e,n,i=this){let r=this.allocateCursor(null,this.head),a=n,s;for(;r.next!==null;)s=r.next,r.next=s.next,a=e.call(i,a,s.data,s,this);return this.releaseCursor(),a}reduceRight(e,n,i=this){let r=this.allocateCursor(this.tail,null),a=n,s;for(;r.prev!==null;)s=r.prev,r.prev=s.prev,a=e.call(i,a,s.data,s,this);return this.releaseCursor(),a}some(e,n=this){for(let i=this.head;i!==null;i=i.next)if(e.call(n,i.data,i,this))return!0;return!1}map(e,n=this){const i=new Jt;for(let r=this.head;r!==null;r=r.next)i.appendData(e.call(n,r.data,r,this));return i}filter(e,n=this){const i=new Jt;for(let r=this.head;r!==null;r=r.next)e.call(n,r.data,r,this)&&i.appendData(r.data);return i}nextUntil(e,n,i=this){if(e===null)return;const r=this.allocateCursor(null,e);for(;r.next!==null;){const a=r.next;if(r.next=a.next,n.call(i,a.data,a,this))break}this.releaseCursor()}prevUntil(e,n,i=this){if(e===null)return;const r=this.allocateCursor(e,null);for(;r.prev!==null;){const a=r.prev;if(r.prev=a.prev,n.call(i,a.data,a,this))break}this.releaseCursor()}clear(){this.head=null,this.tail=null}copy(){const e=new Jt;for(let n of this)e.appendData(n);return e}prepend(e){return this.updateCursors(null,e,this.head,e),this.head!==null?(this.head.prev=e,e.next=this.head):this.tail=e,this.head=e,this}prependData(e){return this.prepend(Jt.createItem(e))}append(e){return this.insert(e)}appendData(e){return this.insert(Jt.createItem(e))}insert(e,n=null){if(n!==null)if(this.updateCursors(n.prev,e,n,e),n.prev===null){if(this.head!==n)throw new Error("before doesn't belong to list");this.head=e,n.prev=e,e.next=n,this.updateCursors(null,e)}else n.prev.next=e,e.prev=n.prev,n.prev=e,e.next=n;else this.updateCursors(this.tail,e,null,e),this.tail!==null?(this.tail.next=e,e.prev=this.tail):this.head=e,this.tail=e;return this}insertData(e,n){return this.insert(Jt.createItem(e),n)}remove(e){if(this.updateCursors(e,e.prev,e,e.next),e.prev!==null)e.prev.next=e.next;else{if(this.head!==e)throw new Error("item doesn't belong to list");this.head=e.next}if(e.next!==null)e.next.prev=e.prev;else{if(this.tail!==e)throw new Error("item doesn't belong to list");this.tail=e.prev}return e.prev=null,e.next=null,e}push(e){this.insert(Jt.createItem(e))}pop(){return this.tail!==null?this.remove(this.tail):null}unshift(e){this.prepend(Jt.createItem(e))}shift(){return this.head!==null?this.remove(this.head):null}prependList(e){return this.insertList(e,this.head)}appendList(e){return this.insertList(e)}insertList(e,n){return e.head===null?this:(n!=null?(this.updateCursors(n.prev,e.tail,n,e.head),n.prev!==null?(n.prev.next=e.head,e.head.prev=n.prev):this.head=e.head,n.prev=e.tail,e.tail.next=n):(this.updateCursors(this.tail,e.tail,null,e.head),this.tail!==null?(this.tail.next=e.head,e.head.prev=this.tail):this.head=e.head,this.tail=e.tail),e.head=null,e.tail=null,this)}replace(e,n){"head"in n?this.insertList(n,e):this.insert(n,e),this.remove(e)}}function EE(t,e){const n=Object.create(SyntaxError.prototype),i=new Error;return Object.assign(n,{name:t,message:e,get stack(){return(i.stack||"").replace(/^(.+\n){1,3}/,`${t}: ${e}
286
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const i=a=>{const s=aw(a,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,l)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:n.inlineTokens(o.mainContent),nestedTokens:l}),customNestedParser:i},n);return s?[{type:"taskList",raw:s.raw,items:s.items}]:n.blockTokens(a)},r=aw(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,s)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:s}),customNestedParser:i},n);if(r)return{type:"taskList",raw:r.raw,items:r.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});bn.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(GH.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(jH.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(QH.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(JH.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(u1e.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(d1e.configure(this.options.taskList)),t}});var bL="&nbsp;",p1e=" ",f1e=oa.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",hi(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const i=e.parseInline(n);return i.length===1&&i[0].type==="text"&&(i[0].text===bL||i[0].text===p1e)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,i)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?bL:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),m1e=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,h1e=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,g1e=pc.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",hi(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[vp({find:m1e,type:this.type})]},addPasteRules(){return[Su({find:h1e,type:this.type})]}}),_1e=oa.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),b1e=pc.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",hi(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!r)return;const a=r[2].trim();return{type:"underline",raw:r[0],text:a,tokens:n.inlineTokens(a)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function y1e(t={}){return new Yn({view(e){return new v1e(e,t)}})}class v1e{constructor(e,n){var i;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(i=n.width)!==null&&i!==void 0?i:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let a=s=>{this[r](s)};return e.dom.addEventListener(r,a),{name:r,handler:a}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,i,r=this.editorView.dom,a=r.getBoundingClientRect(),s=a.width/r.offsetWidth,o=a.height/r.offsetHeight;if(n){let d=e.nodeBefore,p=e.nodeAfter;if(d||p){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let h=f.getBoundingClientRect(),g=d?h.bottom:h.top;d&&p&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let _=this.width/2*o;i={left:h.left,right:h.right,top:g-_,bottom:g+_}}}}if(!i){let d=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;i={left:d.left-p,right:d.left+p,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),p=d.width/l.offsetWidth,f=d.height/l.offsetHeight;c=d.left-l.scrollLeft*p,u=d.top-l.scrollTop*f}this.element.style.left=(i.left-c)/s+"px",this.element.style.top=(i.top-u)/o+"px",this.element.style.width=(i.right-i.left)/s+"px",this.element.style.height=(i.bottom-i.top)/o+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),i=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),r=i&&i.type.spec.disableDropCursor,a=typeof r=="function"?r(this.editorView,n,e):r;if(n&&!a){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let o=gz(this.editorView.state.doc,s,this.editorView.dragging.slice);o!=null&&(s=o)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ui extends bt{constructor(e){super(e,e)}map(e,n){let i=e.resolve(n.map(this.head));return ui.valid(i)?new ui(i):bt.near(i)}content(){return Be.empty}eq(e){return e instanceof ui&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ui(e.resolve(n.pos))}getBookmark(){return new A2(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!E1e(e)||!S1e(e))return!1;let i=n.type.spec.allowGapCursor;if(i!=null)return i;let r=n.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,n,i=!1){e:for(;;){if(!i&&ui.valid(e))return e;let r=e.pos,a=null;for(let s=e.depth;;s--){let o=e.node(s);if(n>0?e.indexAfter(s)<o.childCount:e.index(s)>0){a=o.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;r+=n;let l=e.doc.resolve(r);if(ui.valid(l))return l}for(;;){let s=n>0?a.firstChild:a.lastChild;if(!s){if(a.isAtom&&!a.isText&&!et.isSelectable(a)){e=e.doc.resolve(r+a.nodeSize*n),i=!1;continue e}break}a=s,r+=n;let o=e.doc.resolve(r);if(ui.valid(o))return o}return null}}}ui.prototype.visible=!1;ui.findFrom=ui.findGapCursorFrom;bt.jsonID("gapcursor",ui);class A2{constructor(e){this.pos=e}map(e){return new A2(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ui.valid(n)?new ui(n):bt.near(n)}}function ZH(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function E1e(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),i=t.node(e);if(n==0){if(i.type.spec.isolating)return!0;continue}for(let r=i.child(n-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||ZH(r.type))return!0;if(r.inlineContent)return!1}}return!0}function S1e(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),i=t.node(e);if(n==i.childCount){if(i.type.spec.isolating)return!0;continue}for(let r=i.child(n);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||ZH(r.type))return!0;if(r.inlineContent)return!1}}return!0}function C1e(){return new Yn({props:{decorations:w1e,createSelectionBetween(t,e,n){return e.pos==n.pos&&ui.valid(n)?new ui(n):null},handleClick:x1e,handleKeyDown:T1e,handleDOMEvents:{beforeinput:k1e}}})}const T1e=XA({ArrowLeft:y_("horiz",-1),ArrowRight:y_("horiz",1),ArrowUp:y_("vert",-1),ArrowDown:y_("vert",1)});function y_(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(i,r,a){let s=i.selection,o=e>0?s.$to:s.$from,l=s.empty;if(s instanceof Tt){if(!a.endOfTextblock(n)||o.depth==0)return!1;l=!1,o=i.doc.resolve(e>0?o.after():o.before())}let c=ui.findGapCursorFrom(o,e,l);return c?(r&&r(i.tr.setSelection(new ui(c))),!0):!1}}function x1e(t,e,n){if(!t||!t.editable)return!1;let i=t.state.doc.resolve(e);if(!ui.valid(i))return!1;let r=t.posAtCoords({left:n.clientX,top:n.clientY});return r&&r.inside>-1&&et.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ui(i))),!0)}function k1e(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ui))return!1;let{$from:n}=t.state.selection,i=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!i)return!1;let r=fe.empty;for(let s=i.length-1;s>=0;s--)r=fe.from(i[s].createAndFill(null,r));let a=t.state.tr.replace(n.pos,n.pos,new Be(r,0,0));return a.setSelection(Tt.near(a.doc.resolve(n.pos+1))),t.dispatch(a),!1}function w1e(t){if(!(t.selection instanceof ui))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ii.create(t.doc,[mr.widget(t.selection.head,e,{key:"gapcursor"})])}var Jy=200,Fi=function(){};Fi.prototype.append=function(e){return e.length?(e=Fi.from(e),!this.length&&e||e.length<Jy&&this.leafAppend(e)||this.length<Jy&&e.leafPrepend(this)||this.appendInner(e)):this};Fi.prototype.prepend=function(e){return e.length?Fi.from(e).append(this):this};Fi.prototype.appendInner=function(e){return new D1e(this,e)};Fi.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Fi.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Fi.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Fi.prototype.forEach=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=this.length),n<=i?this.forEachInner(e,n,i,0):this.forEachInvertedInner(e,n,i,0)};Fi.prototype.map=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=this.length);var r=[];return this.forEach(function(a,s){return r.push(e(a,s))},n,i),r};Fi.from=function(e){return e instanceof Fi?e:e&&e.length?new eG(e):Fi.empty};var eG=(function(t){function e(i){t.call(this),this.values=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,a){return r==0&&a==this.length?this:new e(this.values.slice(r,a))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,a,s,o){for(var l=a;l<s;l++)if(r(this.values[l],o+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,a,s,o){for(var l=a-1;l>=s;l--)if(r(this.values[l],o+l)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=Jy)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=Jy)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(Fi);Fi.empty=new eG([]);var D1e=(function(t){function e(n,i){t.call(this),this.left=n,this.right=i,this.length=n.length+i.length,this.depth=Math.max(n.depth,i.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(i){return i<this.left.length?this.left.get(i):this.right.get(i-this.left.length)},e.prototype.forEachInner=function(i,r,a,s){var o=this.left.length;if(r<o&&this.left.forEachInner(i,r,Math.min(a,o),s)===!1||a>o&&this.right.forEachInner(i,Math.max(r-o,0),Math.min(this.length,a)-o,s+o)===!1)return!1},e.prototype.forEachInvertedInner=function(i,r,a,s){var o=this.left.length;if(r>o&&this.right.forEachInvertedInner(i,r-o,Math.max(a,o)-o,s+o)===!1||a<o&&this.left.forEachInvertedInner(i,Math.min(r,o),a,s)===!1)return!1},e.prototype.sliceInner=function(i,r){if(i==0&&r==this.length)return this;var a=this.left.length;return r<=a?this.left.slice(i,r):i>=a?this.right.slice(i-a,r-a):this.left.slice(i,a).append(this.right.slice(0,r-a))},e.prototype.leafAppend=function(i){var r=this.right.leafAppend(i);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(i){var r=this.left.leafPrepend(i);if(r)return new e(r,this.right)},e.prototype.appendInner=function(i){return this.left.depth>=Math.max(this.right.depth,i.depth)+1?new e(this.left,new e(this.right,i)):new e(this,i)},e})(Fi);const A1e=500;class Ja{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}let r,a;n&&(r=this.remapping(i,this.items.length),a=r.maps.length);let s=e.tr,o,l,c=[],u=[];return this.items.forEach((d,p)=>{if(!d.step){r||(r=this.remapping(i,p+1),a=r.maps.length),a--,u.push(d);return}if(r){u.push(new Ds(d.map));let f=d.step.map(r.slice(a)),h;f&&s.maybeStep(f).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],c.push(new Ds(h,void 0,void 0,c.length+u.length))),a--,h&&r.appendMap(h,a)}else s.maybeStep(d.step);if(d.selection)return o=r?d.selection.map(r.slice(a)):d.selection,l=new Ja(this.items.slice(0,i).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:o}}addTransform(e,n,i,r){let a=[],s=this.eventCount,o=this.items,l=!r&&o.length?o.get(o.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),p=new Ds(e.mapping.maps[u],d,n),f;(f=l&&l.merge(p))&&(p=f,u?a.pop():o=o.slice(0,o.length-1)),a.push(p),n&&(s++,n=void 0),r||(l=p)}let c=s-i.depth;return c>R1e&&(o=N1e(o,c),s-=c),new Ja(o.append(a),s)}remapping(e,n){let i=new Ch;return this.items.forEach((r,a)=>{let s=r.mirrorOffset!=null&&a-r.mirrorOffset>=e?i.maps.length-r.mirrorOffset:void 0;i.appendMap(r.map,s)},e,n),i}addMaps(e){return this.eventCount==0?this:new Ja(this.items.append(e.map(n=>new Ds(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let i=[],r=Math.max(0,this.items.length-n),a=e.mapping,s=e.steps.length,o=this.eventCount;this.items.forEach(p=>{p.selection&&o--},r);let l=n;this.items.forEach(p=>{let f=a.getMirror(--l);if(f==null)return;s=Math.min(s,f);let h=a.maps[f];if(p.step){let g=e.steps[f].invert(e.docs[f]),_=p.selection&&p.selection.map(a.slice(l+1,f));_&&o++,i.push(new Ds(h,g,_))}else i.push(new Ds(h))},r);let c=[];for(let p=n;p<s;p++)c.push(new Ds(a.maps[p]));let u=this.items.slice(0,r).append(c).append(i),d=new Ja(u,o);return d.emptyItemCount()>A1e&&(d=d.compress(this.items.length-i.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),i=n.maps.length,r=[],a=0;return this.items.forEach((s,o)=>{if(o>=e)r.push(s),s.selection&&a++;else if(s.step){let l=s.step.map(n.slice(i)),c=l&&l.getMap();if(i--,c&&n.appendMap(c,i),l){let u=s.selection&&s.selection.map(n.slice(i));u&&a++;let d=new Ds(c.invert(),l,u),p,f=r.length-1;(p=r.length&&r[f].merge(d))?r[f]=p:r.push(d)}}else s.map&&i--},this.items.length,0),new Ja(Fi.from(r.reverse()),a)}}Ja.empty=new Ja(Fi.empty,0);function N1e(t,e){let n;return t.forEach((i,r)=>{if(i.selection&&e--==0)return n=r,!1}),t.slice(n)}class Ds{constructor(e,n,i,r){this.map=e,this.step=n,this.selection=i,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Ds(n.getMap().invert(),n,this.selection)}}}class Dl{constructor(e,n,i,r,a){this.done=e,this.undone=n,this.prevRanges=i,this.prevTime=r,this.prevComposition=a}}const R1e=20;function I1e(t,e,n,i){let r=n.getMeta(ru),a;if(r)return r.historyState;n.getMeta(P1e)&&(t=new Dl(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(ru))return s.getMeta(ru).redo?new Dl(t.done.addTransform(n,void 0,i,lb(e)),t.undone,yL(n.mapping.maps),t.prevTime,t.prevComposition):new Dl(t.done,t.undone.addTransform(n,void 0,i,lb(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let o=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=o&&(t.prevTime<(n.time||0)-i.newGroupDelay||!O1e(n,t.prevRanges)),c=s?gS(t.prevRanges,n.mapping):yL(n.mapping.maps);return new Dl(t.done.addTransform(n,l?e.selection.getBookmark():void 0,i,lb(e)),Ja.empty,c,n.time,o??t.prevComposition)}else return(a=n.getMeta("rebased"))?new Dl(t.done.rebased(n,a),t.undone.rebased(n,a),gS(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Dl(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),gS(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function O1e(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((i,r)=>{for(let a=0;a<e.length;a+=2)i<=e[a+1]&&r>=e[a]&&(n=!0)}),n}function yL(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((i,r,a,s)=>e.push(a,s));return e}function gS(t,e){if(!t)return null;let n=[];for(let i=0;i<t.length;i+=2){let r=e.map(t[i],1),a=e.map(t[i+1],-1);r<=a&&n.push(r,a)}return n}function M1e(t,e,n){let i=lb(e),r=ru.get(e).spec.config,a=(n?t.undone:t.done).popEvent(e,i);if(!a)return null;let s=a.selection.resolve(a.transform.doc),o=(n?t.done:t.undone).addTransform(a.transform,e.selection.getBookmark(),r,i),l=new Dl(n?o:a.remaining,n?a.remaining:o,null,0,-1);return a.transform.setSelection(s).setMeta(ru,{redo:n,historyState:l})}let _S=!1,vL=null;function lb(t){let e=t.plugins;if(vL!=e){_S=!1,vL=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){_S=!0;break}}return _S}const ru=new Zn("history"),P1e=new Zn("closeHistory");function L1e(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Yn({key:ru,state:{init(){return new Dl(Ja.empty,Ja.empty,null,0,-1)},apply(e,n,i){return I1e(n,i,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let i=n.inputType,r=i=="historyUndo"?nG:i=="historyRedo"?iG:null;return!r||!e.editable?!1:(n.preventDefault(),r(e.state,e.dispatch))}}}})}function tG(t,e){return(n,i)=>{let r=ru.getState(n);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(i){let a=M1e(r,n,t);a&&i(e?a.scrollIntoView():a)}return!0}}const nG=tG(!1,!0),iG=tG(!0,!0);bn.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const i=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(i)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Yn({key:new Zn("characterCount"),appendTransaction:(e,n,i)=>{if(t)return;const r=this.options.limit;if(r==null||r===0){t=!0;return}const a=this.storage.characters({node:i.doc});if(a>r){const s=a-r,o=0,l=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`);const c=i.tr.deleteRange(o,l);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const i=this.options.limit;if(!e.docChanged||i===0||i===null||i===void 0)return!0;const r=this.storage.characters({node:n.doc}),a=this.storage.characters({node:e.doc});if(a<=i||r>i&&a>i&&a<=r)return!0;if(r>i&&a>i&&a>r||!e.getMeta("paste"))return!1;const o=e.selection.$head.pos,l=a-i,c=o-l,u=o;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>i)}})]}});var F1e=bn.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[y1e(this.options)]}});bn.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Yn({key:new Zn("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:i}=this.editor,{anchor:r}=e,a=[];if(!n||!i)return ii.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(l.isText)return;if(!(r>=c&&r<=c+l.nodeSize-1))return!1;s+=1});let o=0;return t.descendants((l,c)=>{if(l.isText||!(r>=c&&r<=c+l.nodeSize-1))return!1;if(o+=1,this.options.mode==="deepest"&&s-o>0||this.options.mode==="shallowest"&&o>1)return this.options.mode==="deepest";a.push(mr.node(c,c+l.nodeSize,{class:this.options.className}))}),ii.create(t,a)}}})]}});var B1e=bn.create({name:"gapCursor",addProseMirrorPlugins(){return[C1e()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=xn(Xe(t,"allowGapCursor",n)))!=null?e:null}}}),EL="placeholder";function $1e(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var U1e=bn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:EL,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${$1e(this.options.dataAttribute)}`:`data-${EL}`;return[new Yn({key:new Zn("placeholder"),props:{decorations:({doc:e,selection:n})=>{const i=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=n,a=[];if(!i)return null;const s=this.editor.isEmpty;return e.descendants((o,l)=>{const c=r>=l&&r<=l+o.nodeSize,u=!o.isLeaf&&cE(o);if((c||!this.options.showOnlyCurrent)&&u){const d=[this.options.emptyNodeClass];s&&d.push(this.options.emptyEditorClass);const p=mr.node(l,l+o.nodeSize,{class:d.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:l,hasAnchor:c}):this.options.placeholder});a.push(p)}return this.options.includeChildren}),ii.create(e,a)}}})]}});bn.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Yn({key:new Zn("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||I7(n.selection)||t.view.dragging?null:ii.create(n.doc,[mr.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function SL({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var z1e=bn.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Zn(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",i=Object.entries(this.editor.schema.nodes).map(([,r])=>r).filter(r=>(this.options.notAfter||[]).concat(n).includes(r.name));return[new Yn({key:e,appendTransaction:(r,a,s)=>{const{doc:o,tr:l,schema:c}=s,u=e.getState(s),d=o.content.size,p=c.nodes[n];if(u)return l.insert(d,p.create())},state:{init:(r,a)=>{const s=a.tr.doc.lastChild;return!SL({node:s,types:i})},apply:(r,a)=>{if(!r.docChanged||r.getMeta("__uniqueIDTransaction"))return a;const s=r.doc.lastChild;return!SL({node:s,types:i})}}})]}}),H1e=bn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>nG(t,e),redo:()=>({state:t,dispatch:e})=>iG(t,e)}},addProseMirrorPlugins(){return[L1e(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),G1e=bn.create({name:"starterKit",addExtensions(){var t,e,n,i;const r=[];return this.options.bold!==!1&&r.push(fEe.configure(this.options.bold)),this.options.blockquote!==!1&&r.push(lEe.configure(this.options.blockquote)),this.options.bulletList!==!1&&r.push(GH.configure(this.options.bulletList)),this.options.code!==!1&&r.push(gEe.configure(this.options.code)),this.options.codeBlock!==!1&&r.push(yEe.configure(this.options.codeBlock)),this.options.document!==!1&&r.push(vEe.configure(this.options.document)),this.options.dropcursor!==!1&&r.push(F1e.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&r.push(B1e.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&r.push(EEe.configure(this.options.hardBreak)),this.options.heading!==!1&&r.push(SEe.configure(this.options.heading)),this.options.undoRedo!==!1&&r.push(H1e.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&r.push(CEe.configure(this.options.horizontalRule)),this.options.italic!==!1&&r.push(DEe.configure(this.options.italic)),this.options.listItem!==!1&&r.push(jH.configure(this.options.listItem)),this.options.listKeymap!==!1&&r.push(QH.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&r.push(ZEe.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&r.push(JH.configure(this.options.orderedList)),this.options.paragraph!==!1&&r.push(f1e.configure(this.options.paragraph)),this.options.strike!==!1&&r.push(g1e.configure(this.options.strike)),this.options.text!==!1&&r.push(_1e.configure(this.options.text)),this.options.underline!==!1&&r.push(b1e.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&r.push(z1e.configure((i=this.options)==null?void 0:i.trailingNode)),r}}),j1e=G1e,q1e=20,rG=(t,e=0)=>{const n=[];return!t.children.length||e>q1e||Array.from(t.children).forEach(i=>{i.tagName==="SPAN"?n.push(i):i.children.length&&n.push(...rG(i,e+1))}),n},V1e=t=>{if(!t.children.length)return;const e=rG(t);e&&e.forEach(n=>{var i,r;const a=n.getAttribute("style"),s=(r=(i=n.parentElement)==null?void 0:i.closest("span"))==null?void 0:r.getAttribute("style");n.setAttribute("style",`${s};${a}`)})},aG=pc.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&V1e(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",hi(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleTextStyle:t=>({commands:e})=>e.toggleMark(this.name,t),removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,i)=>{if(n.isTextblock)return!0;n.marks.filter(r=>r.type===this.type).some(r=>Object.values(r.attrs).some(a=>!!a))||t.removeMark(i,i+n.nodeSize,this.type)}),!0}}}}),W1e=bn.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const i=n.split(";").map(r=>r.trim()).filter(Boolean);for(let r=i.length-1;r>=0;r-=1){const a=i[r].split(":");if(a.length>=2){const s=a[0].trim().toLowerCase(),o=a.slice(1).join(":").trim();if(s==="background-color")return o.replace(/['"]+/g,"")}}}return(e=t.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),sG=bn.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;const n=t.getAttribute("style");if(n){const i=n.split(";").map(r=>r.trim()).filter(Boolean);for(let r=i.length-1;r>=0;r-=1){const a=i[r].split(":");if(a.length>=2){const s=a[0].trim().toLowerCase(),o=a.slice(1).join(":").trim();if(s==="color")return o.replace(/['"]+/g,"")}}}return(e=t.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),Y1e=bn.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),K1e=bn.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize,renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),Q1e=bn.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight,renderHTML:t=>t.lineHeight?{style:`line-height: ${t.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:t=>({chain:e})=>e().setMark("textStyle",{lineHeight:t}).run(),unsetLineHeight:()=>({chain:t})=>t().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});bn.create({name:"textStyleKit",addExtensions(){const t=[];return this.options.backgroundColor!==!1&&t.push(W1e.configure(this.options.backgroundColor)),this.options.color!==!1&&t.push(sG.configure(this.options.color)),this.options.fontFamily!==!1&&t.push(Y1e.configure(this.options.fontFamily)),this.options.fontSize!==!1&&t.push(K1e.configure(this.options.fontSize)),this.options.lineHeight!==!1&&t.push(Q1e.configure(this.options.lineHeight)),this.options.textStyle!==!1&&t.push(aG.configure(this.options.textStyle)),t}});const X1e=bn.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:t=>t.style.backgroundColor?.replace(/['"]+/g,"")||null,renderHTML:t=>t.backgroundColor?{style:`background-color: ${t.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).run()}}});var J1e=bn.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).some(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),Z1e=J1e,eSe=U1e;function tSe(t){return[j1e.configure({heading:{levels:[1,2,3],HTMLAttributes:{style:null}},trailingNode:!1,codeBlock:!1,code:!1,paragraph:{HTMLAttributes:{style:null}},horizontalRule:{HTMLAttributes:{style:null}},bulletList:{HTMLAttributes:{style:null}},orderedList:{HTMLAttributes:{style:null}},listItem:{HTMLAttributes:{style:null}},blockquote:{HTMLAttributes:{style:null}},link:{openOnClick:!1,enableClickSelection:!0,HTMLAttributes:{}}}),aG,sG.configure({types:["textStyle"]}),X1e.configure({types:["textStyle"]}),Z1e.configure({types:["heading","paragraph"],alignments:["left","center","right","justify"]}),eSe.configure({placeholder:({node:e})=>t,showOnlyWhenEditable:!0})]}const nSe=J7;function bS(t){return t?t.replace(/<[^>]*>/g,"").replace(/&nbsp;/g,"").trim().length===0:!0}const yS=new Set;function oG({blockId:t,style:e,props:n,isNotClient:i=!1}){const r=A.useRef(null),{t:a}=Qe.useTranslation("common"),s=a("editor.notionTextPlaceholder"),o=ag(),l=_i(),c=Wv(),u=!i&&o===t,[d,p]=A.useState(!1);A.useEffect(()=>{if(!i)return()=>{ae.getState().notionTextInlineEditingBlockId===t&&Im(null)}},[t,i]);const f=A.useRef(xd(n?.html??lS.html)),h=c?.linkGlobal??null,g=A.useRef(!1),_=A.useRef(!1),b=A.useRef(null),y=A.useRef(t);A.useEffect(()=>{if(!u)return;const U=()=>p(!0),G=()=>p(!1);return window.addEventListener("slash-menu-opened",U),window.addEventListener("slash-menu-closed",G),()=>{window.removeEventListener("slash-menu-opened",U),window.removeEventListener("slash-menu-closed",G)}},[u]);const E=A.useCallback(()=>{b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{const U=f.current;t&&ae.getState().document[t]?.data?.props?.html!==U&&Zg(t,{html:U}),b.current=null},300)},[t]);A.useEffect(()=>()=>{b.current&&clearTimeout(b.current)},[]);const v=vye({extensions:tSe(s),content:f.current,editable:i?!1:u,shouldRerenderOnTransaction:!1,immediatelyRender:!i,onUpdate:({editor:U})=>{const G=U.getHTML(),V=f.current;f.current=G,G!==V&&!g.current&&!_.current&&U.isEditable&&E()}},[s]);A.useEffect(()=>{if(!u||!v||!t)return;const U=G=>{const V=G,{processedContent:K,replaceSelection:te,selectionFrom:Te,selectionTo:de}=V.detail;if(K){te&&Te!==void 0&&de!==void 0?v.chain().focus().insertContentAt({from:Te,to:de},K).run():v.chain().focus().setContent(K).run();const Oe=v.getHTML();Zg(t,{html:Oe})}};return window.addEventListener("text-ai-processed",U),()=>{window.removeEventListener("text-ai-processed",U)}},[u,v,t]),A.useEffect(()=>{if(g.current){g.current=!1;return}if(!u&&n?.html!==void 0){if(v?.isEditable||!v||v.isDestroyed)return;const U=xd(n.html),G=xd(v.getHTML());!(bS(U)&&bS(G))&&U!==G&&(f.current=U,_.current=!0,v.commands.setContent(U,{emitUpdate:!1}),Promise.resolve().then(()=>{_.current=!1}))}},[u,n?.html,v,t]),A.useEffect(()=>{if(!u)return;const U=G=>{if(G.detail.blockId!==t||yS.has(t))return;yS.add(t),b.current&&(clearTimeout(b.current),b.current=null);const K=(v?.isEditable?v?.getHTML():null)??f.current;f.current=K,ae.getState().document[t]?.data?.props?.html!==K&&t&&Zg(t,{html:K}),g.current=!0};return window.addEventListener("notion-text-force-save",U),()=>window.removeEventListener("notion-text-force-save",U)},[u,t,v]),A.useEffect(()=>{v&&(v.setEditable(u),u&&(g.current=!1,yS.delete(t),setTimeout(()=>v.commands.focus("end"),0)))},[u,v]),A.useEffect(()=>{if(y.current!==t){y.current=t;const U=xd(n?.html??lS.html);v&&!v.isDestroyed&&v.getHTML()!==U?(f.current=U,_.current=!0,v.commands.setContent(U,{emitUpdate:!1}),Promise.resolve().then(()=>{_.current=!1})):f.current=U}},[t,n?.html,v]);const T=A.useCallback(U=>{U.target.closest?.("a[href]")&&U.preventDefault(),t&&Im(t)},[t]),S=A.useCallback(()=>{b.current&&(clearTimeout(b.current),b.current=null);const U=(v?.isEditable?v?.getHTML():null)??f.current;f.current=U,ae.getState().document[t]?.data?.props?.html!==U&&t&&Zg(t,{html:U}),g.current=!0,Im(null)},[t,v]),C=A.useCallback(U=>{if(!(ae.getState().notionTextInlineEditingBlockId===t)||!r.current||r.current.contains(U.target))return;const K=U.target;K?.closest?.("[data-notion-text-toolbar]")||K?.closest?.(".MuiPopover-root, .MuiModal-root, .MuiBackdrop-root, .MuiMenu-root, .MuiDialog-root")||K?.closest?.("[data-slash-menu]")||K?.closest?.("em-emoji-picker")||K?.shadowRoot||K?.closest?.('[role="presentation"]')||document.querySelector(".MuiPopover-root, .MuiModal-root, .MuiDialog-root")||S()},[t,S]);A.useEffect(()=>{if(!u)return;const U=G=>{G.key==="Escape"&&(G.preventDefault(),G.stopPropagation(),S())};return document.addEventListener("keydown",U),document.addEventListener("click",C),()=>{document.removeEventListener("keydown",U),document.removeEventListener("click",C)}},[u,S,C]);const x=ef(l==="desktop"?e?.padding:e?.mobilePadding??e?.padding),k=e?.textAlign??void 0,w={color:e?.borderColor??void 0,top:e?.borderTop??void 0,bottom:e?.borderBottom??void 0,left:e?.borderLeft??void 0,right:e?.borderRight??void 0},D=l==="desktop"?e?.fontSize??void 0:e?.fontSizeMobile??e?.fontSize??void 0,I={color:e?.color??void 0,fontSize:D,fontFamily:Zl(e?.fontFamily),fontWeight:e?.fontWeight??void 0,lineHeight:e?.lineHeight??"inherit",maxWidth:"100%",wordBreak:"break-word"},O=u?f.current:xd(n?.html??lS.html);u||(f.current=O);const M=aEe(t||"default",O,h),P=h?{"--global-link-color":h.linkColor||"inherit","--global-link-text-decoration":h.underline?"underline":"none"}:{};if(i)return m.jsx("div",{style:P,children:m.jsx(Jr,{className:jt(t),padding:x,backgroundColor:e?.backgroundColor,align:k,width:"100%",border:w,children:m.jsx("div",{className:`eb-notion-content ${jt(t)}`,style:{...I,minHeight:"20px"},dangerouslySetInnerHTML:{__html:M}})})});const $=bS(O);return u?m.jsx("div",{ref:r,style:{position:"relative",...P},children:m.jsx(Jr,{className:jt(t),padding:x,backgroundColor:e?.backgroundColor,align:k,width:"100%",border:w,children:m.jsxs("div",{className:"notion-text-inline-editor",style:I,children:[v&&m.jsx(rEe,{editor:v,hidden:d}),m.jsx(nSe,{editor:v,className:"tiptap"})]})})}):m.jsx("div",{ref:r,style:P,children:m.jsx(Jr,{className:jt(t),padding:x,backgroundColor:e?.backgroundColor,align:k,width:"100%",border:w,children:$?m.jsx("div",{className:`eb-notion-content ${jt(t)}`,tabIndex:-1,role:"textbox","aria-label":"Text content",style:{...I,cursor:"text",minHeight:"20px",color:"#adb5bd",transition:"opacity 0.2s ease, box-shadow 0.2s ease"},onClick:T,children:s}):m.jsx("div",{className:`eb-notion-content ${jt(t)}`,tabIndex:-1,role:"textbox","aria-label":"Text content",style:{...I,cursor:"text",minHeight:"20px",transition:"opacity 0.2s ease, box-shadow 0.2s ease"},onClick:T,dangerouslySetInnerHTML:{__html:M}})})})}function rf({children:t}){const e=typeof window<"u",[n,i]=A.useState(e);return A.useEffect(()=>{i(!0)},[]),n?m.jsx(m.Fragment,{children:t}):null}function iSe(t){return function(n){const{type:i,data:r,blockId:a}=n,s=t[i].Component;return n.isNotClient?m.jsx(s,{...r,blockId:a,isNotClient:n.isNotClient}):m.jsx(rf,{children:m.jsx(s,{...r,blockId:a})})}}function rSe(t){const e=Object.keys(t).map(n=>vt({type:Ok(n),data:t[n].schema}));return Sue("type",e).transform(n=>n)}const aSe={p:1.5,display:"flex",flexDirection:"column"},sSe={mb:.75,width:"100%",bgcolor:"cadet.200",display:"flex",justifyContent:"center",p:1,border:"1px solid",borderColor:"cadet.300"};function oSe({label:t,icon:e,onClick:n}){return m.jsxs(Vi,{sx:aSe,onClick:i=>{i.stopPropagation(),n()},children:[m.jsx(Se,{sx:sSe,children:e}),m.jsx(mn,{variant:"body2",children:t})]})}const lSe=[{label:"Text",icon:m.jsx(zU,{}),block:()=>({type:"NotionText",data:{props:{html:""},style:{padding:{top:16,bottom:16,left:24,right:24},mobilePadding:null,fontSize:16,fontWeight:"normal",color:null,backgroundColor:null,textAlign:"left"}}})},{label:"Social",icon:m.jsx(t8,{}),block:()=>({type:"SocialMedia",data:{items:[{id:sm(),key:"facebook",label:"Facebook",iconName:"Facebook",theme:"positive",size:"small",sizePx:"24px",url:"https://maildrill-dev.s3.us-east-2.amazonaws.com/icons/Facebook_Positive_24px.png",href:""}],gap:1,style:{fontSize:36,textAlign:"center",padding:{top:16,bottom:16,left:24,right:24},mobilePadding:null}}})},{label:"Button",icon:m.jsx(u8,{}),block:()=>({type:"Button",data:{props:{text:"Button",buttonTextColor:null,size:"medium"},style:{shape:"rectangle",fontWeight:"normal",fontSize:16,padding:{top:16,bottom:16,left:24,right:24},mobilePadding:null,buttonBackgroundColor:null,buttonTextColor:null}}})},{label:"Image",icon:m.jsx(r8,{}),block:()=>({type:"Image",data:{props:{url:Oce()||qv,alt:null,contentAlignment:"middle",linkHref:null,size:"fill",width:null,height:null,touched:!1},style:{padding:{top:0,bottom:0,left:0,right:0},mobilePadding:null}}})},{label:"Divider",icon:m.jsx(i8,{}),block:()=>({type:"Divider",data:{style:{padding:{top:16,right:0,bottom:16,left:0},mobilePadding:null,width:100},props:{lineColor:"#CCCCCC"}}})},{label:"Spacer",icon:m.jsx(GU,{}),block:()=>({type:"Spacer",data:{}})},{label:"Columns",icon:m.jsx(p8,{}),block:()=>({type:"ColumnsContainer",data:{props:{columnsCount:3,columns:[{childrenIds:[]},{childrenIds:[]},{childrenIds:[]}],fixedWidths:[33,34,33],layout:"layout-33-34-33"},style:{padding:{top:16,bottom:16,left:0,right:0},mobilePadding:null}}})},{label:"Container",icon:m.jsx(s8,{}),block:()=>({type:"Container",data:{style:{padding:{top:16,bottom:16,left:24,right:24},mobilePadding:null}}})}];function lG({anchorEl:t,setAnchorEl:e,onSelect:n}){const i=()=>{e(null)},r=a=>{n(a),e(null)};return t===null?null:m.jsx(iA,{open:!0,anchorEl:t,onClose:i,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},elevation:4,sx:{"& .MuiPaper-root":{borderRadius:"8px"}},children:m.jsx(Se,{sx:{p:1,display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr"},children:lSe.map((a,s)=>m.jsx(oSe,{label:a.label,icon:a.icon,onClick:()=>r(a.block())},s))})})}function cSe({buttonElement:t,onClick:e}){const[n,i]=A.useState(!1);return A.useEffect(()=>{function r({clientX:a,clientY:s}){if(!t)return;const o=t.getBoundingClientRect(),l=o.y,c=o.x,u=c+o.width;if(Math.abs(s-l)<20&&c<a&&a<u){i(!0);return}i(!1)}return window.addEventListener("mousemove",r),()=>{window.removeEventListener("mousemove",r)}},[t,i]),m.jsx(Hv,{in:n,children:m.jsx(Rn,{size:"small",sx:{p:.12,position:"absolute",top:"-12px",left:"50%",transform:"translateX(-10px)",bgcolor:"brand.blue",color:"primary.contrastText",zIndex:"20 !important","&:hover, &:active, &:focus":{bgcolor:"brand.blue",color:"primary.contrastText"}},onClick:r=>{r.stopPropagation(),e()},children:m.jsx(kA,{fontSize:"small"})})})}function uSe({onClick:t}){return m.jsx(Ma,{onClick:e=>{e.stopPropagation(),t()},sx:{display:"flex",alignContent:"center",justifyContent:"center",height:48,width:"fit-content",maxWidth:"fit-content",mx:"auto"},children:m.jsx(kA,{sx:{p:.12,bgcolor:"brand.blue",borderRadius:24,color:"white"},fontSize:"small"})})}function dSe({onSelect:t,placeholder:e}){const[n,i]=A.useState(null),[r,a]=A.useState(null),s=ae(u=>u.selectedMainTab),o=CU(),l=()=>{i(r)},c=()=>e?m.jsx(uSe,{onClick:l}):m.jsx(cSe,{buttonElement:r,onClick:l});return o?null:m.jsxs(m.Fragment,{children:[m.jsx("div",{ref:a,style:{position:"relative",width:"100%",...e?{display:"flex",justifyContent:"center"}:{}},children:s!=="preview"&&c()}),m.jsx(lG,{anchorEl:n,setAnchorEl:i,onSelect:t})]})}function pSe(){return`block-${Date.now()}`}function Al({childrenIds:t,onChange:e,parentId:n,position:i,isNotClient:r}){const a=A.useCallback(c=>{const u=pSe();e({blockId:u,block:c,childrenIds:[...t||[],u]})},[t,e]),[{isOver:s},o]=Ql.useDrop(()=>({accept:"block",drop:(c,u)=>{const d=c.blockId;if(u.didDrop()){u.getDropResult();return}return i===void 0?Gce({parentId:n,blockId:d}):Hce({parentId:n,blockId:d,indexArray:i})},canDrop:c=>!Ou({targetId:n,draggedId:c.blockId})&&c.blockId!==n,collect:c=>({isOver:c.canDrop()?!!c.isOver():!1})}),[n,i]),l=t&&t.length>0?m.jsx(Se,{ref:c=>{o(c)},sx:{minHeight:0,border:s?"2px solid":"",borderColor:s?"secondary.main":void 0},"aria-hidden":!0}):null;return r?t.map(c=>m.jsx(A.Fragment,{children:m.jsx(ev,{id:c,isNotClient:r})},c)):!t||t.length===0?m.jsx(Se,{ref:c=>{o(c)},sx:{border:s?"2px solid":"",borderColor:s?"secondary.main":void 0},children:m.jsx(dSe,{placeholder:!0,onSelect:a})}):m.jsxs(m.Fragment,{children:[t.map(c=>m.jsx(A.Fragment,{children:m.jsx(ev,{id:c})},c)),l]})}const fSe=[{childrenIds:[]},{childrenIds:[]},{childrenIds:[]}];function cG({style:t,props:e,blockId:n,isNotClient:i}){const r=_E(),{columns:a,...s}=e??{},o=a??fSe,l=(c,{block:u,blockId:d,childrenIds:p})=>{const h=ae.getState().document[r],g=h?.data?.props?.columns??o,_=h?.data?.props?{...h.data.props}:{...s};delete _.columns;const b=g.length===2?[...g,{childrenIds:[]}]:[...g];b[c]={childrenIds:p};const y={..._,fixedWidths:_.fixedWidths?.length===2?[..._.fixedWidths,null]:_.fixedWidths},E={type:"ColumnsContainer",data:NA.parse({style:h?.data?.style??t,props:{...y,columns:b}})},v={[d]:u,[r]:E};Qce(v),ia(d)};return i?m.jsx(m.Fragment,{children:m.jsx($k,{blockId:n,props:s,style:t,columns:[m.jsx(Al,{isNotClient:i,parentId:n,position:0,childrenIds:a?.[0]?.childrenIds,onChange:c=>l(0,c)}),m.jsx(Al,{isNotClient:i,parentId:n,position:1,childrenIds:a?.[1]?.childrenIds,onChange:c=>l(1,c)}),m.jsx(Al,{isNotClient:i,parentId:n,position:2,childrenIds:a?.[2]?.childrenIds,onChange:c=>l(2,c)})]})}):m.jsx(rf,{children:m.jsx($k,{blockId:n,props:s,style:t,columns:[m.jsx(Al,{parentId:n,position:0,childrenIds:a?.[0]?.childrenIds,onChange:c=>l(0,c)}),m.jsx(Al,{parentId:n,position:1,childrenIds:a?.[1]?.childrenIds,onChange:c=>l(1,c)}),m.jsx(Al,{parentId:n,position:2,childrenIds:a?.[2]?.childrenIds,onChange:c=>l(2,c)})]})})}function mSe({childrenIds:t}){return m.jsx(m.Fragment,{children:t.map((e,n)=>m.jsx(A.Fragment,{children:m.jsx(ev,{isNotClient:!0,id:e})},e))})}function uG({style:t,props:e,blockId:n,isNotClient:i}){const r=e?.childrenIds??[],a=_E();return m.jsx(S8,{style:t,blockId:`${n}`,children:i?m.jsx(mSe,{parentId:n,childrenIds:r,onChange:({block:s,blockId:o,childrenIds:l})=>{gh(a,o,s,l),ia(o)}}):m.jsx(rf,{children:m.jsx(Al,{parentId:n,childrenIds:r,onChange:({block:s,blockId:o,childrenIds:l})=>{gh(a,o,s,l),ia(o)}})})})}function hSe(t){const e=t.childrenIds??[],n=_E(),i=_i();return m.jsx("div",{onClick:()=>{ia(null)},style:{backgroundColor:t.backdropColor??"#F5F5F5",color:t.textColor??"#262626",fontFamily:Zl(t?.fontFamily||"OPEN_SANS"),fontSize:"16px",fontWeight:"400",letterSpacing:"0.15008px",lineHeight:"1.5",margin:"0",width:"100%"},children:m.jsx("table",{role:"presentation",align:"center",width:"100%",style:{margin:"0 auto",maxWidth:i==="desktop"?Od:vk,backgroundColor:t.canvasColor??"#FFFFFF",borderRadius:t.borderRadius??void 0,border:(()=>{const r=t.borderColor;if(r)return`1px solid ${r}`})()},cellSpacing:"0",cellPadding:"0",border:0,children:m.jsx("tbody",{children:m.jsx("tr",{style:{width:"100%"},children:m.jsx("td",{"data-value":"__content",children:m.jsx(rf,{children:m.jsx(Al,{listEndPolicy:"root",parentId:n,childrenIds:e,onChange:({block:r,blockId:a,childrenIds:s})=>{gh(n,a,r,s),ia(a)}})})})})})})})}const gSe=t=>e=>({position:"absolute",...t?{top:"100%",right:0,marginTop:"8px",flexDirection:"row",width:"auto"}:{top:0,right:"-3rem",flexDirection:"column",width:"2.5rem"},borderRadius:"8px!important",zIndex:"90 !important;",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",border:"1px solid",borderColor:e.palette.secondary.main,padding:"1px",display:"flex",alignItems:"center",justifyContent:"center"});let ld=null;function _Se({blockId:t}){const e=SU(t),{t:n}=Qe.useTranslation("inspector"),{t:i}=Qe.useTranslation(),r=ld&&ld.blockType===e?.type,a=A.useRef(null),[s,o]=A.useState(!1);A.useEffect(()=>{const p=()=>{if(!a.current)return;const g=a.current.parentElement;if(!g)return;const _=g.getBoundingClientRect(),b=g.closest(".preview-container");if(!b)return;b.getBoundingClientRect().right-_.right<48?o(!0):o(!1)};p(),window.addEventListener("resize",p),window.addEventListener("scroll",p,!0);const f=setTimeout(p,100);return()=>{window.removeEventListener("resize",p),window.removeEventListener("scroll",p,!0),clearTimeout(f)}},[t]);const l=A.useCallback(()=>{const p=ae.getState().document,f=ae.getState().notionTextInlineEditingBlockId,h=(y,E,v=new Set)=>{if(v.has(y))return;v.add(y);const T=E[y];T&&(T.type==="Container"&&(T.data?.props?.childrenIds||[]).forEach(C=>h(C,E,v)),T.type==="ColumnsContainer"&&(T.data?.props?.columns||[]).forEach(C=>{(C.childrenIds||[]).forEach(x=>h(x,E,v))}))},g=new Set;h(t,p,g),g.add(t);const _=y=>y&&y.filter(E=>!g.has(E)),b={...p};for(const[y,E]of Object.entries(b)){if(g.has(y))continue;const v=E;switch(v.type){case"EmailLayout":b[y]={...v,data:{...v.data,childrenIds:_(v.data.childrenIds)}};break;case"Container":b[y]={...v,data:{...v.data,props:{...v.data.props,childrenIds:_(v.data.props?.childrenIds)}}};break;case"ColumnsContainer":b[y]={...v,data:{...v.data,props:{...v.data.props,columns:v.data.props?.columns?.map(T=>({...T,childrenIds:_(T.childrenIds)}))}}};break;default:b[y]=v}}for(const y of g)delete b[y];f&&(f===t||g.has(f))&&Im(null),fu(b),ia(null)},[t]),c=A.useCallback(()=>{e&&"style"in e.data&&e.data.style&&(ld={styles:JSON.parse(JSON.stringify(e.data.style)),blockType:e.type})},[e]),u=A.useCallback(()=>{const p=ae.getState().document;if(!ld||ld.blockType!==e?.type)return;const f={...p},h=f[t];h&&(f[t]={...h,data:{...h.data,style:JSON.parse(JSON.stringify(ld.styles))}},fu(f),ia(t))},[t,e]),d=A.useCallback(()=>{Yce(t)},[t]);return m.jsxs(Qo,{ref:a,sx:gSe(s),onClick:p=>p.stopPropagation(),elevation:10,children:[m.jsx(hn,{title:n("actions.copyFormat"),placement:"left-start",children:m.jsx("span",{children:m.jsx(Rn,{onClick:c,sx:{padding:"4px",overflow:"hidden",color:"text.primary"},disabled:!(e&&"style"in e.data&&e.data.style),children:m.jsxs("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[m.jsx("path",{d:"M12 22.5C6.49 22.5 2 18.01 2 12.5C2 6.99 6.49 2.5 12 2.5C17.51 2.5 22 6.54 22 11.5C22 14.81 19.31 17.5 16 17.5H14.23C13.95 17.5 13.73 17.72 13.73 18C13.73 18.12 13.78 18.23 13.86 18.33C14.27 18.8 14.5 19.39 14.5 20C14.5 21.38 13.38 22.5 12 22.5ZM12 4.5C7.59 4.5 4 8.09 4 12.5C4 16.91 7.59 20.5 12 20.5C12.28 20.5 12.5 20.28 12.5 20C12.5 19.84 12.42 19.72 12.36 19.65C11.95 19.19 11.73 18.6 11.73 18C11.73 16.62 12.85 15.5 14.23 15.5H16C18.21 15.5 20 13.71 20 11.5C20 7.64 16.41 4.5 12 4.5Z",fill:"currentColor"}),m.jsx("path",{d:"M6.5 13.5C7.32843 13.5 8 12.8284 8 12C8 11.1716 7.32843 10.5 6.5 10.5C5.67157 10.5 5 11.1716 5 12C5 12.8284 5.67157 13.5 6.5 13.5Z",fill:"currentColor"}),m.jsx("path",{d:"M9.5 9.5C10.3284 9.5 11 8.82843 11 8C11 7.17157 10.3284 6.5 9.5 6.5C8.67157 6.5 8 7.17157 8 8C8 8.82843 8.67157 9.5 9.5 9.5Z",fill:"currentColor"}),m.jsx("path",{d:"M14.5 9.5C15.3284 9.5 16 8.82843 16 8C16 7.17157 15.3284 6.5 14.5 6.5C13.6716 6.5 13 7.17157 13 8C13 8.82843 13.6716 9.5 14.5 9.5Z",fill:"currentColor"}),m.jsx("path",{d:"M17.5 13.5C18.3284 13.5 19 12.8284 19 12C19 11.1716 18.3284 10.5 17.5 10.5C16.6716 10.5 16 11.1716 16 12C16 12.8284 16.6716 13.5 17.5 13.5Z",fill:"currentColor"})]})})})}),m.jsx(hn,{title:n(r?"actions.pasteFormatting":"actions.noFormatSupported"),placement:"left-start",children:m.jsx("span",{children:m.jsx(Rn,{onClick:u,sx:{padding:"4px",overflow:"hidden",color:r?"text.primary":"text.disabled"},disabled:!r,children:m.jsx("svg",{width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:m.jsx("path",{d:"M10.9551 22.6497C10.5139 22.6497 10.1287 22.4888 9.79934 22.167C9.47017 21.8451 9.30559 21.4582 9.30559 21.0062V16.1317H5.54784C5.09367 16.1317 4.69725 15.9624 4.35859 15.6237C4.01992 15.2851 3.85059 14.8886 3.85059 14.4345V7.10448C3.85059 6.07631 4.21 5.19264 4.92884 4.45348C5.6475 3.71431 6.52667 3.34473 7.56634 3.34473H19.2978C19.5378 3.34473 19.7408 3.42773 19.9066 3.59373C20.0726 3.75956 20.1556 3.96248 20.1556 4.20248V14.4345C20.1556 14.8886 19.9871 15.2851 19.6501 15.6237C19.3131 15.9624 18.9138 16.1317 18.4523 16.1317H14.7006V21.0062C14.7006 21.4582 14.536 21.8451 14.2068 22.167C13.8775 22.4888 13.4923 22.6497 13.0511 22.6497H10.9551ZM5.54784 10.6145H18.4523V5.04798H17.0463V8.41773C17.0463 8.63189 16.9744 8.81139 16.8306 8.95623C16.6869 9.10106 16.5063 9.17348 16.2888 9.17348C16.0715 9.17348 15.8924 9.10106 15.7516 8.95623C15.6108 8.81139 15.5403 8.63189 15.5403 8.41773V5.04798H13.7533V6.40148C13.7533 6.61814 13.6815 6.79789 13.5378 6.94073C13.394 7.08373 13.2134 7.15523 12.9961 7.15523C12.7786 7.15523 12.5994 7.08373 12.4586 6.94073C12.3178 6.79789 12.2473 6.61814 12.2473 6.40148V5.04798H7.56634C6.97717 5.04798 6.4935 5.24764 6.11534 5.64698C5.737 6.04631 5.54784 6.53214 5.54784 7.10448V10.6145ZM5.54784 14.4345H18.4523V12.0965H5.54784V14.4345Z",fill:"currentColor"})})})})}),m.jsx(hn,{title:i("editor.cloneBlock"),placement:"left-start",children:m.jsx(Rn,{onClick:d,sx:{padding:"4px",overflow:"hidden",color:"text.primary"},children:m.jsx(zue,{sx:{fontSize:"1.25rem"}})})}),m.jsx(hn,{title:n("actions.delete"),placement:"left-start",children:m.jsx(Rn,{onClick:l,sx:{overflow:"hidden",color:"error.main",padding:"4px"},children:m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:m.jsx("path",{d:"M16 9.5V19.5H8V9.5H16ZM14.5 3.5H9.5L8.5 4.5H5V6.5H19V4.5H15.5L14.5 3.5ZM18 7.5H6V19.5C6 20.6 6.9 21.5 8 21.5H16C17.1 21.5 18 20.6 18 19.5V7.5Z",fill:"#EF4444"})})})})]})}const bSe=A.memo(_Se),CL=150,ySe=25;let qm=null,Zy=null;function N2(){qm&&(clearTimeout(qm),qm=null),Zy=null}function TL(t){Zy===t&&N2()}function vSe(t,e,n,i){N2(),Zy=t,qm=setTimeout(()=>{qm=null,Zy=null,n()&&(tb(t),i())},e)}function ESe(t){const e=t.closest(".preview-container");if(!e)return CL;let n=0,i=t;for(;i&&e.contains(i)&&(i.hasAttribute("data-block-id")&&(n+=1),i!==e);)i=i.parentElement;return CL+Math.max(0,n-1)*ySe}function SSe(t){const e=ag();return A.useMemo(()=>e?Ou({draggedId:t,targetId:e}):!1,[t,e])}function CSe(t){if(!t||typeof t.nodeType!="number")return null;const e=t,n=e.closest?.(".preview-container");if(!n)return null;const i=e.closest?.("[data-block-id]"),r=i?.getAttribute("data-block-id")??null;return!r||!i||!n.contains(i)?null:r}function TSe({children:t,canEdit:e=!0,isNotClient:n=!1}){const i=_E(),{t:r}=Qe.useTranslation(),a=Cce(),s=Sce(i),o=Ece(i),l=gA(),c=ag(),u=Tce();xce();const d=SSe(i),[p,f]=A.useState(!1),[h,g]=A.useState(0),_=A.useRef(null),b=A.useRef(null),[y,E]=A.useState(null),v=sn(),T=CU(),[S,C]=A.useState(null),x=c===i||d,k=u===i,w=v.palette.primary.light||v.palette.primary.main,D=A.useRef(null),L=A.useRef(!0);if(n)return m.jsxs(m.Fragment,{children:[m.jsx("div",{style:{width:"100%"}}),m.jsx(Se,{sx:{position:"relative",maxWidth:"100%"},children:m.jsx("div",{children:t})}),m.jsx("div",{style:{width:"100%"}})]});let I,O;k&&e?(I=`2px solid ${w}`,O="10"):s&&e?(I=`2px solid ${v.palette.secondary.main}`,O="1"):p&&e?I=`2px dotted ${v.palette.secondary.main}`:O="auto";const M=()=>!s||!e?null:m.jsx(bSe,{blockId:i}),P=X=>{const J=X.getClientOffset(),j=_.current?.getBoundingClientRect(),oe=b.current?.getBoundingClientRect();if(!J||!j||!oe)return null;const le=Math.abs(J.y-j.y),xe=Math.abs(J.y-oe.y);return le<xe?"up":"down"},[{isOver:$},U]=Ql.useDrop(()=>({accept:"block",drop:(X,J)=>{const j=i,oe=X.blockId;if(j===oe)return;if(J.didDrop()){J.getDropResult();return}const le=P(J);if(le)hh(j,oe,le);else{hh(j,oe,"down");return}},canDrop:(X,J)=>!Ou({targetId:i,draggedId:X.blockId}),collect:X=>({isOver:X.canDrop()?X.isOver({shallow:!0}):!1}),hover:(X,J)=>{if(X.blockId===i){E(null);return}if(!J.canDrop()||!J.isOver({shallow:!0})){E(null);return}const j=P(J);if(!j){E(null);return}E(j)},end:()=>{E(null)}}));A.useEffect(()=>{$||E(null)},[$]);const G=()=>m.jsxs("div",{style:{height:"3px",background:v.palette.secondary.main,position:"relative",color:v.palette.secondary.main},children:[m.jsx("svg",{style:{position:"absolute",left:"-25px",top:"50%",transform:"translateY(-50%)"},width:"20",height:"20",viewBox:"0 0 32 32",children:m.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"})}),m.jsx("svg",{style:{position:"absolute",right:"-25px",top:"50%",transform:"translateY(-50%) scaleX(-1)"},width:"20",height:"20",viewBox:"0 0 32 32",children:m.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"})})]}),V=Ql.useDrag(()=>({type:"block",item:()=>{const X=ae.getState().notionTextInlineEditingBlockId;return X&&window.dispatchEvent(new CustomEvent("notion-text-force-save",{detail:{blockId:X}})),{blockId:i}},canDrag:!x,collect:X=>({borderDrag:X.isDragging()?"2px dotted yellow":"",isDragging:X.isDragging()}),end:()=>{g(Date.now())}}),[x,i]),[{borderDrag:K="",isDragging:te},Te]=V||[{borderDrag:"",isDragging:!1},A.useRef(null)],de=e&&l!=="preview"&&!x&&!T&&(te||a===i||a==null&&s);A.useEffect(()=>(L.current=!0,()=>{L.current=!1,TL(i),D.current&&(clearTimeout(D.current),D.current=null),ae.getState().canvasHoveredBlockId===i&&tb(null)}),[i]);const Oe=X=>{const J=Date.now()-h;if(!(te||h>0&&J<200)&&(X.stopPropagation(),l!=="preview")){if(o==="NotionText"){const j=new CustomEvent("email-builder-highlight-editor",{detail:!0});window.dispatchEvent(j)}ia(i)}},se=A.useMemo(()=>A.cloneElement(t,{onClick:X=>{t.props.onClick&&t.props.onClick(X),!X.defaultPrevented&&!X.isPropagationStopped()&&(te||Oe(X))},onMouseDown:X=>{t.props.onMouseDown&&t.props.onMouseDown(X)},onMouseUp:X=>{t.props.onMouseUp&&t.props.onMouseUp(X)}}),[t,te,i,o,l]);return m.jsxs(m.Fragment,{children:[y==="up"&&m.jsx(G,{}),m.jsx("div",{ref:_,style:{width:"100%"}}),m.jsx(Se,{"data-block-id":i,sx:{position:"relative",maxWidth:"100%"},ref:U,onMouseEnter:X=>{X.stopPropagation(),N2(),D.current&&(clearTimeout(D.current),D.current=null);const J=ESe(X.currentTarget);vSe(i,J,()=>L.current,()=>f(!0))},onMouseLeave:X=>{TL(i),D.current&&clearTimeout(D.current);const J=X.relatedTarget;D.current=setTimeout(()=>{if(f(!1),ae.getState().canvasHoveredBlockId!==i)return;const j=CSe(J);tb(j&&j!==i?j:null)},150)},onClick:Oe,children:m.jsxs(Se,{sx:{position:"relative",maxWidth:"100%",outlineOffset:"-1px",outline:I,zIndex:O,transition:"outline 0.2s ease-in-out, z-index 0.2s ease-in-out"},children:[M(),de?m.jsx(Se,{sx:{position:"absolute",left:"50%",top:-20,transform:"translateX(-50%)",zIndex:10,display:"flex",flexDirection:"row",alignItems:"center",borderRadius:"6px 6px 0 0",overflow:"hidden",backgroundColor:k&&e?w:v.palette.secondary.main},children:m.jsx(hn,{title:r("editor.dragBlockHandle"),placement:"top",children:m.jsx(Rn,{ref:Te,type:"button","aria-label":r("editor.dragBlockHandle"),size:"small",onClick:X=>X.stopPropagation(),sx:{padding:"3px 6px",rotate:"90deg",borderRadius:0,color:"white",cursor:te?"grabbing":"grab","&:hover":{backgroundColor:"rgba(255,255,255,0.15)"}},children:m.jsx(jU,{sx:{fontSize:15}})})})}):null,m.jsx(lG,{anchorEl:S,setAnchorEl:C,onSelect:X=>{const J=Kce(i,X);J&&ia(J),C(null)}}),m.jsx(Hv,{in:k&&e,timeout:200,children:m.jsx(Ob,{label:r("editor.editing"),icon:m.jsx(qU,{}),size:"small",sx:{position:"absolute",left:-1,top:-26,backgroundColor:w,color:"white",fontWeight:600,fontSize:"0.75rem",zIndex:-1,boxShadow:"0 2px 8px rgba(0,0,0,0.15)","& .MuiChip-icon":{color:"white",fontSize:"1rem"}}})}),m.jsx("div",{style:{border:K},children:se}),de?m.jsx(Se,{sx:{position:"absolute",left:"50%",bottom:-10,transform:"translateX(-50%)",zIndex:10,width:20,height:20,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:k&&e?w:v.palette.secondary.main},children:m.jsx(hn,{title:r("editor.addBlockAtEnd"),placement:"bottom",children:m.jsx(Rn,{type:"button",onClick:X=>{X.stopPropagation(),C(X.currentTarget)},sx:{padding:0,width:20,height:20,minWidth:20,borderRadius:"50%",color:"white","&:hover":{backgroundColor:"rgba(255,255,255,0.15)"}},children:m.jsx(LU,{sx:{fontSize:18}})})})}):null]})}),y==="down"&&m.jsx(G,{}),m.jsx("div",{ref:b,style:{width:"100%"}})]})}const Ss=A.memo(TSe,(t,e)=>t.children===e.children&&t.canEdit===e.canEdit&&t.isNotClient===e.isNotClient),xSe=A.memo(L8),kSe=A.memo(PU),wSe=A.memo(uG),DSe=A.memo(cG),ASe=A.memo(R8),NSe=A.memo(O8),RSe=A.memo(M8),ISe=A.memo(oG),OSe=A.memo($8),MSe=A.memo(k8),dG={SocialMedia:{schema:P8,Component:t=>m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(xSe,{...t})})},Button:{schema:MU,Component:t=>m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(kSe,{...t})})},Container:{schema:C8,Component:t=>m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(wSe,{...t})})},ColumnsContainer:{schema:NA,Component:t=>m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(DSe,{...t})})},Heading:{schema:N8,Component:t=>m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(ASe,{...t})})},Html:{schema:I8,Component:t=>m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(NSe,{...t})})},Image:{schema:RA,Component:t=>{const e={...t,props:{...t.props,url:t.props?.url??"https://placehold.co/600x400@2x/F8F8F8/CCC?text=Your%20image"}};return m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(RSe,{...e})})}},NotionText:{schema:sEe,Component:t=>m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(ISe,{blockId:t.blockId??"",...t})})},EmailLayout:{schema:D8,Component:t=>m.jsx(hSe,{...t})},Spacer:{schema:B8,Component:t=>m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(OSe,{...t})})},Divider:{schema:x8,Component:t=>m.jsx(Ss,{isNotClient:t.isNotClient,children:m.jsx(MSe,{...t})})}},PSe=iSe(dG),LSe=rSe(dG),FSe=LSe;Cue(nt(),FSe);const pG=A.createContext(null),_E=()=>A.useContext(pG),ev=A.memo(function({id:e,isNotClient:n}){const i=ae(r=>r.document[e]);return i?m.jsx(pG.Provider,{value:e,children:m.jsx(PSe,{isNotClient:n,...i,blockId:e})}):(console.warn(`Block ${e} not found`),null)},(t,e)=>t.id===e.id&&t.isNotClient===e.isNotClient),xL=()=>{const t=_i(),{t:e}=Qe.useTranslation("inspector"),n=(i,r)=>{switch(r){case"mobile":case"desktop":qb(r);return;default:qb("desktop")}};return m.jsxs(Qp,{value:t,exclusive:!0,size:"small",onChange:n,sx:{"& .MuiToggleButtonGroup-grouped":{minWidth:40,py:.75,px:1}},children:[m.jsx(_n,{value:"desktop",children:m.jsx(hn,{title:e("inputs.screenSelector.desktop"),children:m.jsx(dde,{fontSize:"small"})})}),m.jsx(_n,{value:"mobile",children:m.jsx(hn,{title:e("inputs.screenSelector.mobile"),children:m.jsx(hde,{fontSize:"small"})})})]})};function fG({document:t,disabledInteraction:e=!1,isNotClient:n=!1,onRendered:i}){const r=A.useRef(null),a=_i(),s=A.useMemo(()=>{const h=t.root?.data?.childrenIds??[];return JSON.stringify(h)},[t.root?.data]),o=A.useMemo(()=>{const h=t.root.data.childrenIds??[];return Object.fromEntries(Object.entries(t).filter(([g])=>g!=="root"&&h.includes(g)).sort(([g],[_])=>h.indexOf(g)-h.indexOf(_)))},[t,s]),c=A.useMemo(()=>t.root,[t.root]).data;function u({borderColor:f}){if(f)return`1px solid ${f}`}const d=A.createContext({});A.useEffect(()=>{if(typeof i=="function"){const f=requestAnimationFrame(()=>{i()});return()=>cancelAnimationFrame(f)}},[t,a,i]);const p=(f,h)=>{const g=t[f];if(!g||f==="root")return null;switch(g.type){case"Button":return m.jsx(PU,{...g.data,blockId:f,isNotClient:n},h);case"Container":{if(n){const _=g.data?.props?.childrenIds??[];return m.jsx(S8,{style:g.data?.style,blockId:f,children:_.map((b,y)=>p(b,y))},h)}return m.jsx(uG,{...g.data,blockId:f,isNotClient:n},h)}case"ColumnsContainer":{if(n){const{columns:_,...b}=g.data?.props??{},y=_?.map(E=>E.childrenIds.map((v,T)=>p(v,T)));return m.jsx($k,{blockId:f,props:b,columns:y,style:g.data?.style},h)}return m.jsx(cG,{...g.data,blockId:f,isNotClient:n},h)}case"Heading":return m.jsx(R8,{...g.data},h);case"Html":return m.jsx(O8,{...g.data},h);case"Image":return m.jsx(M8,{...g.data,blockId:f,isNotClient:n},h);case"NotionText":return m.jsx(oG,{...g.data,blockId:f,isNotClient:n},h);case"Spacer":return m.jsx($8,{...g.data,blockId:f},h);case"Divider":return m.jsx(k8,{...g.data,blockId:f,isNotClient:n},h);case"SocialMedia":return m.jsx(L8,{...g.data,blockId:f,isNotClient:n},h);default:return console.warn(`Unknown block type: ${g.type}`),null}};return n?m.jsx("div",{ref:r,style:{backgroundColor:c.backdropColor??"#F5F5F5",color:c.textColor??"#262626",fontFamily:Zl(c.fontFamily),fontSize:"16px",fontWeight:"400",letterSpacing:"0.15008px",lineHeight:"1.5",margin:"0",padding:"0 0",borderRadius:c.borderRadius||0,pointerEvents:"auto"},className:"main-table-container",children:m.jsx("table",{role:"presentation",align:"center",className:"main-table-container",style:{margin:"0 auto",maxWidth:a==="desktop"?Od:vk,width:a==="desktop"?Od:"100%",backgroundColor:c.canvasColor??"#FFFFFF",borderRadius:c.borderRadius??void 0,border:u(c),overflow:"hidden",pointerEvents:e?"none":"auto"},cellSpacing:"0",cellPadding:"0",border:0,children:m.jsx("tbody",{children:m.jsx("tr",{className:"main-table-container",children:m.jsx("td",{children:Object.keys(o).map((f,h)=>p(f,h))})})})})}):m.jsx(rf,{children:m.jsx(d.Provider,{value:t,children:m.jsx("div",{ref:r,style:{backgroundColor:c.backdropColor??"#F5F5F5",color:c.textColor??"#262626",fontFamily:Zl(c.fontFamily),fontSize:"16px",fontWeight:"400",letterSpacing:"0.15008px",lineHeight:"1.5",margin:"0",padding:"0 0",borderRadius:c.borderRadius||0,pointerEvents:"auto"},className:"main-table-container",children:m.jsx("table",{role:"presentation",align:"center",className:"main-table-container",style:{margin:"0 auto",maxWidth:a==="desktop"?Od:vk,width:a==="desktop"?Od:"100%",backgroundColor:c.canvasColor??"#FFFFFF",borderRadius:c.borderRadius??void 0,border:u(c),overflow:"hidden",pointerEvents:e?"none":"auto"},cellSpacing:"0",cellPadding:"0",border:0,children:m.jsx("tbody",{children:m.jsx("tr",{className:"main-table-container",children:m.jsx("td",{children:Object.keys(o).map((f,h)=>p(f,h))})})})})})})})}function BSe(){const t=hA(),e=A.useMemo(()=>`data:text/plain,${encodeURIComponent(JSON.stringify(t,null," "))}`,[t]);return m.jsx(hn,{title:"Download JSON file",children:m.jsx(Rn,{href:e,download:"emailTemplate.json",children:m.jsx(Jue,{fontSize:"small"})})})}const vS=0,je=1,Kt=2,ki=3,zn=4,ds=5,bE=6,Hi=7,Dr=8,Zt=9,xt=10,ni=11,Wt=12,pi=13,mg=14,Ar=15,rr=16,$r=17,ao=18,la=19,ps=20,Ri=21,Nn=22,ar=23,Ba=24,Sr=25,$Se=0;function Mi(t){return t>=48&&t<=57}function rc(t){return Mi(t)||t>=65&&t<=70||t>=97&&t<=102}function R2(t){return t>=65&&t<=90}function USe(t){return t>=97&&t<=122}function zSe(t){return R2(t)||USe(t)}function HSe(t){return t>=128}function tv(t){return zSe(t)||HSe(t)||t===95}function mG(t){return tv(t)||Mi(t)||t===45}function GSe(t){return t>=0&&t<=8||t===11||t>=14&&t<=31||t===127}function nv(t){return t===10||t===13||t===12}function Cu(t){return nv(t)||t===32||t===9}function $s(t,e){return!(t!==92||nv(e)||e===$Se)}function cb(t,e,n){return t===45?tv(e)||e===45||$s(e,n):tv(t)?!0:t===92?$s(t,e):!1}function ES(t,e,n){return t===43||t===45?Mi(e)?2:e===46&&Mi(n)?3:0:t===46?Mi(e)?2:0:Mi(t)?1:0}function hG(t){return t===65279||t===65534?1:0}const Ew=new Array(128),jSe=128,ub=130,gG=131,I2=132,_G=133;for(let t=0;t<Ew.length;t++)Ew[t]=Cu(t)&&ub||Mi(t)&&gG||tv(t)&&I2||GSe(t)&&_G||t||jSe;function SS(t){return t<128?Ew[t]:I2}function Wd(t,e){return e<t.length?t.charCodeAt(e):0}function Sw(t,e,n){return n===13&&Wd(t,e+1)===10?2:1}function Yd(t,e,n){let i=t.charCodeAt(e);return R2(i)&&(i=i|32),i===n}function Oh(t,e,n,i){if(n-e!==i.length||e<0||n>t.length)return!1;for(let r=e;r<n;r++){const a=i.charCodeAt(r-e);let s=t.charCodeAt(r);if(R2(s)&&(s=s|32),s!==a)return!1}return!0}function qSe(t,e){for(;e>=0&&Cu(t.charCodeAt(e));e--);return e+1}function v_(t,e){for(;e<t.length&&Cu(t.charCodeAt(e));e++);return e}function CS(t,e){for(;e<t.length&&Mi(t.charCodeAt(e));e++);return e}function Tp(t,e){if(e+=2,rc(Wd(t,e-1))){for(const i=Math.min(t.length,e+5);e<i&&rc(Wd(t,e));e++);const n=Wd(t,e);Cu(n)&&(e+=Sw(t,e,n))}return e}function E_(t,e){for(;e<t.length;e++){const n=t.charCodeAt(e);if(!mG(n)){if($s(n,Wd(t,e+1))){e=Tp(t,e)-1;continue}break}}return e}function yE(t,e){let n=t.charCodeAt(e);if((n===43||n===45)&&(n=t.charCodeAt(e+=1)),Mi(n)&&(e=CS(t,e+1),n=t.charCodeAt(e)),n===46&&Mi(t.charCodeAt(e+1))&&(e+=2,e=CS(t,e)),Yd(t,e,101)){let i=0;n=t.charCodeAt(e+1),(n===45||n===43)&&(i=1,n=t.charCodeAt(e+2)),Mi(n)&&(e=CS(t,e+1+i+1))}return e}function TS(t,e){for(;e<t.length;e++){const n=t.charCodeAt(e);if(n===41){e++;break}$s(n,Wd(t,e+1))&&(e=Tp(t,e))}return e}function bG(t){if(t.length===1&&!rc(t.charCodeAt(0)))return t[0];let e=parseInt(t,16);return(e===0||e>=55296&&e<=57343||e>1114111)&&(e=65533),String.fromCodePoint(e)}const yG=["EOF-token","ident-token","function-token","at-keyword-token","hash-token","string-token","bad-string-token","url-token","bad-url-token","delim-token","number-token","percentage-token","dimension-token","whitespace-token","CDO-token","CDC-token","colon-token","semicolon-token","comma-token","[-token","]-token","(-token",")-token","{-token","}-token"],VSe=16*1024;function iv(t=null,e){return t===null||t.length<e?new Uint32Array(Math.max(e+1024,VSe)):t}const kL=10,WSe=12,wL=13;function DL(t){const e=t.source,n=e.length,i=e.length>0?hG(e.charCodeAt(0)):0,r=iv(t.lines,n),a=iv(t.columns,n);let s=t.startLine,o=t.startColumn;for(let l=i;l<n;l++){const c=e.charCodeAt(l);r[l]=s,a[l]=o++,(c===kL||c===wL||c===WSe)&&(c===wL&&l+1<n&&e.charCodeAt(l+1)===kL&&(l++,r[l]=s,a[l]=o),s++,o=1)}r[n]=s,a[n]=o,t.lines=r,t.columns=a,t.computed=!0}class YSe{constructor(){this.lines=null,this.columns=null,this.computed=!1}setSource(e,n=0,i=1,r=1){this.source=e,this.startOffset=n,this.startLine=i,this.startColumn=r,this.computed=!1}getLocation(e,n){return this.computed||DL(this),{source:n,offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]}}getLocationRange(e,n,i){return this.computed||DL(this),{source:i,start:{offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]},end:{offset:this.startOffset+n,line:this.lines[n],column:this.columns[n]}}}}const ha=16777215,ml=24,KSe=new Map([[Kt,Nn],[Ri,Nn],[la,ps],[ar,Ba]]);class QSe{constructor(e,n){this.setSource(e,n)}reset(){this.eof=!1,this.tokenIndex=-1,this.tokenType=0,this.tokenStart=this.firstCharOffset,this.tokenEnd=this.firstCharOffset}setSource(e="",n=()=>{}){e=String(e||"");const i=e.length,r=iv(this.offsetAndType,e.length+1),a=iv(this.balance,e.length+1);let s=0,o=0,l=0,c=-1;for(this.offsetAndType=null,this.balance=null,n(e,(u,d,p)=>{switch(u){default:a[s]=i;break;case o:{let f=l&ha;for(l=a[f],o=l>>ml,a[s]=f,a[f++]=s;f<s;f++)a[f]===i&&(a[f]=s);break}case Ri:case Kt:case la:case ar:a[s]=l,o=KSe.get(u),l=o<<ml|s;break}r[s++]=u<<ml|p,c===-1&&(c=d)}),r[s]=vS<<ml|i,a[s]=i,a[i]=i;l!==0;){const u=l&ha;l=a[u],a[u]=i}this.source=e,this.firstCharOffset=c===-1?0:c,this.tokenCount=s,this.offsetAndType=r,this.balance=a,this.reset(),this.next()}lookupType(e){return e+=this.tokenIndex,e<this.tokenCount?this.offsetAndType[e]>>ml:vS}lookupOffset(e){return e+=this.tokenIndex,e<this.tokenCount?this.offsetAndType[e-1]&ha:this.source.length}lookupValue(e,n){return e+=this.tokenIndex,e<this.tokenCount?Oh(this.source,this.offsetAndType[e-1]&ha,this.offsetAndType[e]&ha,n):!1}getTokenStart(e){return e===this.tokenIndex?this.tokenStart:e>0?e<this.tokenCount?this.offsetAndType[e-1]&ha:this.offsetAndType[this.tokenCount]&ha:this.firstCharOffset}substrToCursor(e){return this.source.substring(e,this.tokenStart)}isBalanceEdge(e){return this.balance[this.tokenIndex]<e}isDelim(e,n){return n?this.lookupType(n)===Zt&&this.source.charCodeAt(this.lookupOffset(n))===e:this.tokenType===Zt&&this.source.charCodeAt(this.tokenStart)===e}skip(e){let n=this.tokenIndex+e;n<this.tokenCount?(this.tokenIndex=n,this.tokenStart=this.offsetAndType[n-1]&ha,n=this.offsetAndType[n],this.tokenType=n>>ml,this.tokenEnd=n&ha):(this.tokenIndex=this.tokenCount,this.next())}next(){let e=this.tokenIndex+1;e<this.tokenCount?(this.tokenIndex=e,this.tokenStart=this.tokenEnd,e=this.offsetAndType[e],this.tokenType=e>>ml,this.tokenEnd=e&ha):(this.eof=!0,this.tokenIndex=this.tokenCount,this.tokenType=vS,this.tokenStart=this.tokenEnd=this.source.length)}skipSC(){for(;this.tokenType===pi||this.tokenType===Sr;)this.next()}skipUntilBalanced(e,n){let i=e,r,a;e:for(;i<this.tokenCount;i++){if(r=this.balance[i],r<e)break e;switch(a=i>0?this.offsetAndType[i-1]&ha:this.firstCharOffset,n(this.source.charCodeAt(a))){case 1:break e;case 2:i++;break e;default:this.balance[r]===i&&(i=r)}}this.skip(i-this.tokenIndex)}forEachToken(e){for(let n=0,i=this.firstCharOffset;n<this.tokenCount;n++){const r=i,a=this.offsetAndType[n],s=a&ha,o=a>>ml;i=s,e(o,r,s,n)}}dump(){const e=new Array(this.tokenCount);return this.forEachToken((n,i,r,a)=>{e[a]={idx:a,type:yG[n],chunk:this.source.substring(i,r),balance:this.balance[a]}}),e}}function vE(t,e){function n(d){return d<o?t.charCodeAt(d):0}function i(){if(c=yE(t,c),cb(n(c),n(c+1),n(c+2))){u=Wt,c=E_(t,c);return}if(n(c)===37){u=ni,c++;return}u=xt}function r(){const d=c;if(c=E_(t,c),Oh(t,d,c,"url")&&n(c)===40){if(c=v_(t,c+1),n(c)===34||n(c)===39){u=Kt,c=d+4;return}s();return}if(n(c)===40){u=Kt,c++;return}u=je}function a(d){for(d||(d=n(c++)),u=ds;c<t.length;c++){const p=t.charCodeAt(c);switch(SS(p)){case d:c++;return;case ub:if(nv(p)){c+=Sw(t,c,p),u=bE;return}break;case 92:if(c===t.length-1)break;const f=n(c+1);nv(f)?c+=Sw(t,c+1,f):$s(p,f)&&(c=Tp(t,c)-1);break}}}function s(){for(u=Hi,c=v_(t,c);c<t.length;c++){const d=t.charCodeAt(c);switch(SS(d)){case 41:c++;return;case ub:if(c=v_(t,c),n(c)===41||c>=t.length){c<t.length&&c++;return}c=TS(t,c),u=Dr;return;case 34:case 39:case 40:case _G:c=TS(t,c),u=Dr;return;case 92:if($s(d,n(c+1))){c=Tp(t,c)-1;break}c=TS(t,c),u=Dr;return}}}t=String(t||"");const o=t.length;let l=hG(n(0)),c=l,u;for(;c<o;){const d=t.charCodeAt(c);switch(SS(d)){case ub:u=pi,c=v_(t,c+1);break;case 34:a();break;case 35:mG(n(c+1))||$s(n(c+1),n(c+2))?(u=zn,c=E_(t,c+1)):(u=Zt,c++);break;case 39:a();break;case 40:u=Ri,c++;break;case 41:u=Nn,c++;break;case 43:ES(d,n(c+1),n(c+2))?i():(u=Zt,c++);break;case 44:u=ao,c++;break;case 45:ES(d,n(c+1),n(c+2))?i():n(c+1)===45&&n(c+2)===62?(u=Ar,c=c+3):cb(d,n(c+1),n(c+2))?r():(u=Zt,c++);break;case 46:ES(d,n(c+1),n(c+2))?i():(u=Zt,c++);break;case 47:n(c+1)===42?(u=Sr,c=t.indexOf("*/",c+2),c=c===-1?t.length:c+2):(u=Zt,c++);break;case 58:u=rr,c++;break;case 59:u=$r,c++;break;case 60:n(c+1)===33&&n(c+2)===45&&n(c+3)===45?(u=mg,c=c+4):(u=Zt,c++);break;case 64:cb(n(c+1),n(c+2),n(c+3))?(u=ki,c=E_(t,c+1)):(u=Zt,c++);break;case 91:u=la,c++;break;case 92:$s(d,n(c+1))?r():(u=Zt,c++);break;case 93:u=ps,c++;break;case 123:u=ar,c++;break;case 125:u=Ba,c++;break;case gG:i();break;case I2:r();break;default:u=Zt,c++}e(u,l,l=c)}}let cd=null;class Jt{static createItem(e){return{prev:null,next:null,data:e}}constructor(){this.head=null,this.tail=null,this.cursor=null}createItem(e){return Jt.createItem(e)}allocateCursor(e,n){let i;return cd!==null?(i=cd,cd=cd.cursor,i.prev=e,i.next=n,i.cursor=this.cursor):i={prev:e,next:n,cursor:this.cursor},this.cursor=i,i}releaseCursor(){const{cursor:e}=this;this.cursor=e.cursor,e.prev=null,e.next=null,e.cursor=cd,cd=e}updateCursors(e,n,i,r){let{cursor:a}=this;for(;a!==null;)a.prev===e&&(a.prev=n),a.next===i&&(a.next=r),a=a.cursor}*[Symbol.iterator](){for(let e=this.head;e!==null;e=e.next)yield e.data}get size(){let e=0;for(let n=this.head;n!==null;n=n.next)e++;return e}get isEmpty(){return this.head===null}get first(){return this.head&&this.head.data}get last(){return this.tail&&this.tail.data}fromArray(e){let n=null;this.head=null;for(let i of e){const r=Jt.createItem(i);n!==null?n.next=r:this.head=r,r.prev=n,n=r}return this.tail=n,this}toArray(){return[...this]}toJSON(){return[...this]}forEach(e,n=this){const i=this.allocateCursor(null,this.head);for(;i.next!==null;){const r=i.next;i.next=r.next,e.call(n,r.data,r,this)}this.releaseCursor()}forEachRight(e,n=this){const i=this.allocateCursor(this.tail,null);for(;i.prev!==null;){const r=i.prev;i.prev=r.prev,e.call(n,r.data,r,this)}this.releaseCursor()}reduce(e,n,i=this){let r=this.allocateCursor(null,this.head),a=n,s;for(;r.next!==null;)s=r.next,r.next=s.next,a=e.call(i,a,s.data,s,this);return this.releaseCursor(),a}reduceRight(e,n,i=this){let r=this.allocateCursor(this.tail,null),a=n,s;for(;r.prev!==null;)s=r.prev,r.prev=s.prev,a=e.call(i,a,s.data,s,this);return this.releaseCursor(),a}some(e,n=this){for(let i=this.head;i!==null;i=i.next)if(e.call(n,i.data,i,this))return!0;return!1}map(e,n=this){const i=new Jt;for(let r=this.head;r!==null;r=r.next)i.appendData(e.call(n,r.data,r,this));return i}filter(e,n=this){const i=new Jt;for(let r=this.head;r!==null;r=r.next)e.call(n,r.data,r,this)&&i.appendData(r.data);return i}nextUntil(e,n,i=this){if(e===null)return;const r=this.allocateCursor(null,e);for(;r.next!==null;){const a=r.next;if(r.next=a.next,n.call(i,a.data,a,this))break}this.releaseCursor()}prevUntil(e,n,i=this){if(e===null)return;const r=this.allocateCursor(e,null);for(;r.prev!==null;){const a=r.prev;if(r.prev=a.prev,n.call(i,a.data,a,this))break}this.releaseCursor()}clear(){this.head=null,this.tail=null}copy(){const e=new Jt;for(let n of this)e.appendData(n);return e}prepend(e){return this.updateCursors(null,e,this.head,e),this.head!==null?(this.head.prev=e,e.next=this.head):this.tail=e,this.head=e,this}prependData(e){return this.prepend(Jt.createItem(e))}append(e){return this.insert(e)}appendData(e){return this.insert(Jt.createItem(e))}insert(e,n=null){if(n!==null)if(this.updateCursors(n.prev,e,n,e),n.prev===null){if(this.head!==n)throw new Error("before doesn't belong to list");this.head=e,n.prev=e,e.next=n,this.updateCursors(null,e)}else n.prev.next=e,e.prev=n.prev,n.prev=e,e.next=n;else this.updateCursors(this.tail,e,null,e),this.tail!==null?(this.tail.next=e,e.prev=this.tail):this.head=e,this.tail=e;return this}insertData(e,n){return this.insert(Jt.createItem(e),n)}remove(e){if(this.updateCursors(e,e.prev,e,e.next),e.prev!==null)e.prev.next=e.next;else{if(this.head!==e)throw new Error("item doesn't belong to list");this.head=e.next}if(e.next!==null)e.next.prev=e.prev;else{if(this.tail!==e)throw new Error("item doesn't belong to list");this.tail=e.prev}return e.prev=null,e.next=null,e}push(e){this.insert(Jt.createItem(e))}pop(){return this.tail!==null?this.remove(this.tail):null}unshift(e){this.prepend(Jt.createItem(e))}shift(){return this.head!==null?this.remove(this.head):null}prependList(e){return this.insertList(e,this.head)}appendList(e){return this.insertList(e)}insertList(e,n){return e.head===null?this:(n!=null?(this.updateCursors(n.prev,e.tail,n,e.head),n.prev!==null?(n.prev.next=e.head,e.head.prev=n.prev):this.head=e.head,n.prev=e.tail,e.tail.next=n):(this.updateCursors(this.tail,e.tail,null,e.head),this.tail!==null?(this.tail.next=e.head,e.head.prev=this.tail):this.head=e.head,this.tail=e.tail),e.head=null,e.tail=null,this)}replace(e,n){"head"in n?this.insertList(n,e):this.insert(n,e),this.remove(e)}}function EE(t,e){const n=Object.create(SyntaxError.prototype),i=new Error;return Object.assign(n,{name:t,message:e,get stack(){return(i.stack||"").replace(/^(.+\n){1,3}/,`${t}: ${e}
287
287
  `)}})}const xS=100,AL=60,NL=" ";function RL({source:t,line:e,column:n},i){function r(u,d){return a.slice(u,d).map((p,f)=>String(u+f+1).padStart(l)+" |"+p).join(`
288
288
  `)}const a=t.split(/\r\n?|\n|\f/),s=Math.max(1,e-i)-1,o=Math.min(e+i,a.length+1),l=Math.max(4,String(o).length)+1;let c=0;n+=(NL.length-1)*(a[e-1].substr(0,n-1).match(/\t/g)||[]).length,n>xS&&(c=n-AL+3,n=AL-2);for(let u=s;u<=o;u++)u>=0&&u<a.length&&(a[u]=a[u].replace(/\t/g,NL),a[u]=(c>0&&a[u].length>c?"…":"")+a[u].substr(c,xS-2)+(a[u].length>c+xS-1?"…":""));return[r(s,e),new Array(n+l+2).join("-")+"^",r(e,o)].filter(Boolean).join(`
289
289
  `)}function IL(t,e,n,i,r){return Object.assign(EE("SyntaxError",t),{source:e,offset:n,line:i,column:r,sourceFragment(s){return RL({source:e,line:i,column:r},isNaN(s)?0:s)},get formattedMessage(){return`Parse error: ${t}