easy-email-pro-migrations 1.59.7 → 1.59.9

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/lib/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";var me=Object.defineProperty,ye=Object.defineProperties;var _e=Object.getOwnPropertyDescriptors;var Ut=Object.getOwnPropertySymbols;var Ae=Object.prototype.hasOwnProperty,ke=Object.prototype.propertyIsEnumerable;var jt=(t,o,e)=>o in t?me(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,E=(t,o)=>{for(var e in o||(o={}))Ae.call(o,e)&&jt(t,e,o[e]);if(Ut)for(var e of Ut(o))ke.call(o,e)&&jt(t,e,o[e]);return t},F=(t,o)=>ye(t,_e(o));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const xe=require("he"),Lt={PAGE:"page",SECTION:"section",COLUMN:"column",GROUP:"group",TEXT:"text",IMAGE:"image",DIVIDER:"divider",SPACER:"spacer",BUTTON:"button",WRAPPER:"wrapper",RAW:"raw",HERO:"hero",CAROUSEL:"carousel",NAVBAR:"navbar",NAVBAR_LINK:"navbar-link",SOCIAL:"social",SOCIAL_ELEMENT:"social-element",MERGETAG:"mergetag",LINE_BREAK:"line-break",PLACEHOLDER:"placeholder",TABLE:"table",DANGEROUS_CODE:"dangerous-code",HTML_NODE:"html-node",HTML_BLOCK_NODE:"html-block-node",HTML_DOM_NODE:"html-dom-node",CONTENT_WIDGET:"content_widget",SECTION_WIDGET:"section_widget",WRAPPER_WIDGET:"wrapper_widget",PAGE_HEADER:"page-header",PAGE_FOOTER:"page-footer"},Se={STANDARD_HERO:"standard-hero",STANDARD_WRAPPER:"standard-wrapper",STANDARD_SECTION:"standard-section",STANDARD_GROUP:"standard-group",STANDARD_COLUMN:"standard-column",STANDARD_IMAGE:"standard-image",STANDARD_DIVIDER:"standard-divider",STANDARD_SPACER:"standard-spacer",STANDARD_NAVBAR:"standard-navbar",STANDARD_NAVBAR_LINK:"standard-navbar-link",STANDARD_SOCIAL:"standard-social",STANDARD_SOCIAL_ELEMENT:"standard-social-element",STANDARD_BUTTON:"standard-button",STANDARD_TEXT:"standard-text",STANDARD_PARAGRAPH:"standard-paragraph",STANDARD_H1:"standard-h1",STANDARD_H2:"standard-h2",STANDARD_H3:"standard-h3",STANDARD_H4:"standard-h4",STANDARD_TABLE:"standard-table",STANDARD_TEXT_LIST:"standard-text-list",STANDARD_TEXT_LIST_ITEM:"standard-text-list-item",STANDARD_BLOCK_QUOTE:"standard-blockquote",STANDARD_TABLE2:"standard-table2",STANDARD_TABLE2_TR:"standard-table2-tr",STANDARD_TABLE2_TD:"standard-table2-td"},Te={FOR_EACH:"logic-for-each",SHOW:"logic-show"},m=E(E(E({},Lt),Se),Te),ne={PAGE:"page",RAW:"raw",HERO:"hero",WRAPPER:"wrapper",SECTION:"section",COLUMN:"column",GROUP:"group",TEXT:"text",TABLE:"table",BUTTON:"button",IMAGE:"image",DIVIDER:"divider",NAVBAR:"navbar",NAVBAR_LINK:"navbar-link",SOCIAL:"social",SOCIAL_ELEMENT:"social-element",SPACER:"spacer",TEXT_LIST:"text-list",TEXT_LIST_ITEM:"text-list-item",INLINE_TEXT:"inline-text",BLOCK_NODE:"block-node",DANGEROUS_CODE:"dangerous_code",UNKNOWN_CONTENT:"unknown-content ",AMP_BLOCK:"amp-block",UNSET:"unset",UNSET_RENDER:"unset-render",TABLE2_TR:"table2-tr",TABLE2_TD:"table2-td",PAGE_HEADER:"page-header",PAGE_FOOTER:"page-footer"};function Tt(t){if(!t||typeof t!="string")return null;const o=t.trim().split(/\s+/).filter(Boolean);if(o.length===0)return null;let e,n,i,r;return o.length===1?e=n=i=r=o[0]:o.length===2?(e=i=o[0],n=r=o[1]):o.length===3?(e=o[0],n=r=o[1],i=o[2]):(e=o[0],n=o[1],i=o[2],r=o[3]),{top:e,right:n,bottom:i,left:r}}function J(t,o="padding"){const e=t[o];if(!e)return t;const n=Tt(e);if(!n)return delete t[o],t;const i={top:`${o}-top`,right:`${o}-right`,bottom:`${o}-bottom`,left:`${o}-left`};return t[i.top]==null&&(t[i.top]=n.top),t[i.right]==null&&(t[i.right]=n.right),t[i.bottom]==null&&(t[i.bottom]=n.bottom),t[i.left]==null&&(t[i.left]=n.left),delete t[o],t}function oe(t){return xe.decode(t)}function we(t){var i,r,a;const o={},e=/([a-zA-Z_:][-\w:.]*)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g;let n;for(;(n=e.exec(t))!==null;)o[n[1].toLowerCase()]=oe((a=(r=(i=n[2])!=null?i:n[3])!=null?r:n[4])!=null?a:"");return o}function De(t){const o={};return t.split(";").forEach(e=>{const n=e.indexOf(":");if(n<0)return;const i=e.slice(0,n).trim().toLowerCase(),r=e.slice(n+1).trim();r&&(i==="color"?o.color=r:i==="font-size"?o.fontSize=r:i==="font-family"?o.fontFamily=r:i==="line-height"?o.lineHeight=r:i==="font-weight"&&/^(bold|[6-9]\d{2})$/.test(r)?o.bold=!0:i==="font-style"&&r==="italic"?o.italic=!0:i==="text-decoration"&&/underline/.test(r)?o.underline=!0:i==="text-decoration"&&/line-through/.test(r)&&(o.strikethrough=!0))}),o}const Re=new Set(["br","img","hr","input","meta","link"]),Vt=new Set(["p","div","h1","h2","h3","h4","h5","h6","li"]);function Ce(t){const o=[],e=/<!--[\s\S]*?-->|<\/([a-zA-Z][\w-]*)\s*>|<([a-zA-Z][\w-]*)([^>]*?)\/?\s*>/g;let n=0,i;for(;(i=e.exec(t))!==null;)if(i.index>n&&o.push({kind:"text",text:t.slice(n,i.index)}),n=i.index+i[0].length,!i[0].startsWith("<!--")){if(i[1])o.push({kind:"close",name:i[1].toLowerCase()});else if(i[2]){const r=i[2].toLowerCase(),a=we(i[3]||""),d=i[0].endsWith("/>")||Re.has(r);o.push({kind:"open",name:r,attrs:a,selfClose:d})}}return n<t.length&&o.push({kind:"text",text:t.slice(n)}),o}function U(t){if(!t)return[{text:""}];const o=Ce(t),e=[{}],n=[];let i=0;const r=()=>e[e.length-1],a=g=>{if(!g)return;const p={text:g},c=r();c.bold&&(p.bold=!0),c.italic&&(p.italic=!0),c.underline&&(p.underline=!0),c.strikethrough&&(p.strikethrough=!0),c.color&&(p.color=c.color),c.fontSize&&(p.fontSize=c.fontSize),c.fontFamily&&(p.fontFamily=c.fontFamily),c.lineHeight&&(p.lineHeight=c.lineHeight),c.link&&(p.link={href:c.link.href,blank:c.link.blank}),n.push(p)},d=()=>{n.push({type:Lt.LINE_BREAK,data:{},attributes:{},children:[{text:""}]})},s=()=>{const g=n[n.length-1];return!!g&&"type"in g&&g.type===Lt.LINE_BREAK},l=()=>{if(i>0&&n.length>0)for(let g=0;g<i;g++)d();i=0},u=g=>!!g&&g.kind==="open"&&!g.selfClose&&!Vt.has(g.name);for(let g=0;g<o.length;g++){const p=o[g];if(p.kind==="text"){const c=oe(p.text);if(i>0&&!c.trim())continue;let f=c.replace(/\s+/g," ");if(!f)continue;f.endsWith(" ")&&u(o[g+1])&&(f+="​"),l(),a(f)}else if(p.kind==="open"){const{name:c,attrs:f,selfClose:T}=p;if(c==="br"){l(),d();continue}const h=F(E({},r()),{tag:c});if(c==="strong"||c==="b"?h.bold=!0:c==="em"||c==="i"?h.italic=!0:c==="u"?h.underline=!0:c==="s"||c==="strike"||c==="del"?h.strikethrough=!0:c==="a"&&f.href&&(h.link={href:f.href,blank:(f.target||"").toLowerCase()==="_blank"}),f.style&&Object.assign(h,De(f.style)),T)continue;e.push(h)}else{const c=e.findLastIndex(f=>f.tag===p.name);c>0&&(e.splice(c),Vt.has(p.name)&&!s()&&(i+=1))}}return n.length===0?[{text:""}]:n}function Ne(t,o={}){var f,T,h,x;const e=[],n=$e(t,(f=o.pageIndex)!=null?f:0);if(!n)throw new Error("unlayerToEasyEmailPro: could not find a design with body.rows in the input");const i=n.body,r=(i==null?void 0:i.values)||{},a=typeof r.contentWidth=="number"?r.contentWidth:parseInt(String(r.contentWidth||""),10)||600,d=`${a}px`,s={};(T=r.fontFamily)!=null&&T.value&&(s["font-family"]=r.fontFamily.value);const l={};r.textColor&&(l[ne.TEXT]={color:r.textColor});const u=Je(i,r.fontFamily),g=a+20,p=((i==null?void 0:i.rows)||[]).flatMap(A=>{var S,_;return Pe(A,{contentWidthPx:a,columnPxWidth:a,bodyLinkColor:((S=r.linkStyle)==null?void 0:S.linkColor)||"",bodyFontFamily:((_=r.fontFamily)==null?void 0:_.value)||"",templateUsesFullWidth:Ee((i==null?void 0:i.rows)||[],a),warnings:e})});return{page:{type:m.PAGE,data:E({breakpoint:`${g}px`,globalAttributes:s,categoryAttributes:l,blockAttributes:{},classAttributes:{},preheader:r.preheaderText||""},u.length>0?{fonts:u}:{}),attributes:M({width:d,"background-color":r.backgroundColor||"","content-background-color":"","margin-top":"0px","margin-bottom":"0px","link-color":((h=r.linkStyle)==null?void 0:h.linkColor)||"","link-text-decoration":(x=r.linkStyle)!=null&&x.linkUnderline?"underline":""}),children:p},warnings:e}}function Ee(t,o){for(const e of t){const n=(e==null?void 0:e.values)||{},i=n.backgroundImage;if((i==null?void 0:i.fullWidth)===!0&&typeof i.width=="number"&&i.width>o||n.backgroundColor||i!=null&&i.url)return!0}return!1}function $e(t,o){var e,n,i,r,a,d,s,l,u,g,p;if(!t)return null;if((e=t.body)!=null&&e.rows)return t;if((i=(n=t.design)==null?void 0:n.body)!=null&&i.rows)return t.design;if(Array.isArray(t.templates)&&t.templates.length>0){const c=t.templates[0],f=((r=c.StockTemplatePages)==null?void 0:r[o])||((a=c.StockTemplatePages)==null?void 0:a[0]);if((s=(d=f==null?void 0:f.design)==null?void 0:d.body)!=null&&s.rows)return f.design;if((u=(l=c.design)==null?void 0:l.body)!=null&&u.rows)return c.design}if(Array.isArray(t.StockTemplatePages)){const c=t.StockTemplatePages[o]||t.StockTemplatePages[0];if((p=(g=c==null?void 0:c.design)==null?void 0:g.body)!=null&&p.rows)return c.design}return null}function Pe(t,o){var g;const e=t.values||{};if(at(e)==="hidden")return[];const n=(g=Tt(e.padding))!=null?g:{top:"0px",right:"0px",bottom:"0px",left:"0px"},i=Qt(n.top),r=Qt(n.bottom),a=!!e.backgroundColor,s=!!(wt(t.columns||[])||e.columnsBackgroundColor),l=!a&&s&&(!i||!r);if(on(t))return $t([rn(t,o,n)],e);if(nn(t),!l)return $t([Kt(t,o,n,!0)],e);const u=[];return i||u.push(Xt({top:n.top,right:n.right,bottom:"0px",left:n.left},o)),u.push(Kt(t,o,{top:"0px",right:n.right,bottom:"0px",left:n.left},!0)),r||u.push(Xt({top:"0px",right:n.right,bottom:n.bottom,left:n.left},o)),$t(u,e)}function Kt(t,o,e,n){var k,y,w,D;const i=t.values||{},r=t.cells||[1],a=r.reduce((R,$)=>R+Number($||0),0)||1,d=n?wt(t.columns||[]):"",s=n&&!d?en(t.columns||[]):"",l=d||s||i.columnsBackgroundColor||"",u=d||s||i.backgroundColor||l||"",g=n&&!i.backgroundColor&&(!!d||!!s||se(t.columns||[])),p={"background-color":u,"padding-top":e.top,"padding-right":e.right,"padding-bottom":e.bottom,"padding-left":e.left};zt(p);const c=(t.columns||[]).map(R=>{var N;const $=((N=R.values)==null?void 0:N.border)||{};return H($.borderLeftWidth)+H($.borderRightWidth)});if(n){const R=Ye(t.columns||[]);Object.assign(p,R);const $=Qe(t.columns||[]);Object.assign(p,$)}const f=i.backgroundImage;!!(f!=null&&f.url)&&(Object.assign(p,ee(f)),p["background-image-enabled"]=!0),o.templateUsesFullWidth&&!g&&(p["full-width"]="full-width");const h=Q(i._override),x=(y=(k=i._override)==null?void 0:k.mobile)==null?void 0:y.backgroundImage;x!=null&&x.url&&x.url!==(f==null?void 0:f.url)&&(Object.assign(h,ee(x)),h["background-image-enabled"]=!0);const A=(t.columns||[]).map((R,$)=>{var v;const N=Number((v=r[$])!=null?v:1)/a,P=Ze(N),L=Math.max(1,Math.round(o.contentWidthPx*N)-(c[$]||0));return Le(R,P,F(E({},o),{columnPxWidth:L}))}).filter(R=>R!=null),S=!!((D=(w=i._override)==null?void 0:w.mobile)!=null&&D.noStackMobile),_=A.length>0?S&&A.length>1?[B({type:m.STANDARD_GROUP,data:{},attributes:{width:"100%"},children:A})]:A:[Xe()];return B({type:m.STANDARD_SECTION,data:{},attributes:M(p),mobileAttributes:M(h),children:_})}function Xt(t,o){const e={"background-color":"","padding-top":t.top,"padding-right":t.right,"padding-bottom":t.bottom,"padding-left":t.left};zt(e),o.templateUsesFullWidth&&(e["full-width"]="full-width");const n=B({type:m.STANDARD_PARAGRAPH,data:{},attributes:{"padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"0px",padding:"0px 0px 0px 0px","font-size":"0px","line-height":"0"},children:[{text:""}]}),i=B({type:m.STANDARD_COLUMN,data:{},attributes:{width:"100%","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"0px"},children:[n]});return B({type:m.STANDARD_SECTION,data:{},attributes:M(e),children:[i]})}function Le(t,o,e){var d,s;const n=t.values||{};if(at(n)==="hidden")return null;const i={width:o,"background-color":n.backgroundColor||"","border-radius":n.borderRadius||""};J(Object.assign(i,sn(n))),Object.assign(i,te(n.border));const r=Q(n._override);Object.assign(r,te((s=(d=n._override)==null?void 0:d.mobile)==null?void 0:s.border,{includeZero:!0}));let a=(t.contents||[]).map(l=>ie(l,e)).filter(l=>l!=null);return a.length===0&&(a=[yt()]),Dt(B({type:m.STANDARD_COLUMN,data:{},attributes:M(i),mobileAttributes:M(r),children:a}),n)}function ie(t,o){const e=t.values||{};if(at(e)==="hidden")return null;let n;switch(t.type){case"heading":n=Be(e,o);break;case"text":n=re(e,o);break;case"paragraph":n=Me(e,o);break;case"image":n=ae(e,o);break;case"button":n=ve(e,o);break;case"divider":n=Fe(e);break;case"menu":n=Ge(e,o);break;case"social":n=Ue(e);break;case"timer":throw new Error("Unlayer countdown/timer block is not supported — skip this template");case"html":n=Ke(e);break;default:return o.warnings.push(`Unsupported block type "${t.type}" — skipped`),null}return Dt(n,e)}function Mt(t,o){const e=t==null?void 0:t.linkStyle;return e&&e.inherit===!1&&e.linkColor?e.linkColor:o.bodyLinkColor}function Ot(t,o){return o?t.map(e=>"text"in e&&e.link&&!e.color?F(E({},e),{color:o}):e):t}function Ht(t,o){const e=Ie(t),n={align:t.textAlign||"",color:t.color||"","font-family":Wt(t.fontFamily,o),"font-size":t.fontSize||"","line-height":e||t.lineHeight||"","letter-spacing":t.letterSpacing||"","container-background-color":""};return J(Object.assign(n,ft(t))),n}function Wt(t,o){const e=(t==null?void 0:t.value)||"";return e?e.trim().toLowerCase()==="inherit"?o.bodyFontFamily||"":e:""}const Oe=/<(?:span|strong|em|b|i)\b[^>]*\bstyle\s*=\s*"[^"]*\bline-height\s*:\s*([^;"]+)/i;function Ie(t){const o=t.text;if(!o)return"";const e=Oe.exec(o);if(!e)return"";const n=e[1].trim(),i=H(t.fontSize);if(!i)return"";const r=qt(n,i),a=qt(t.lineHeight,i);return r==null||a!=null&&r<=a?"":n}function qt(t,o){if(t==null||t==="")return null;const e=String(t).trim();if(e.endsWith("%")){const i=parseFloat(e);return Number.isFinite(i)?i/100*o:null}if(e.endsWith("px")){const i=parseFloat(e);return Number.isFinite(i)?i:null}const n=parseFloat(e);return Number.isFinite(n)?n*o:null}function Be(t,o){const e=qe(t.headingType),n=Ht(t,o);return t.fontWeight==null&&!n["font-weight"]&&(n["font-weight"]="400"),B({type:e,data:{},attributes:M(n),mobileAttributes:M(Q(t._override,{padding:!0})),children:Ot(U(t.text),Mt(t,o))})}function re(t,o){const e=Ht(t,o),n=ce(t.text||"",Mt(t,o));return B({type:m.STANDARD_PARAGRAPH,data:{},attributes:M(e),mobileAttributes:M(Q(t._override,{padding:!0})),children:n.length>0?n:[{text:""}]})}function Me(t,o){const e=He(t.textJson);return re(F(E({},t),{text:e}),o)}function He(t){if(!t)return"";let o;try{o=typeof t=="string"?JSON.parse(t):t}catch(n){return""}const e=o==null?void 0:o.root;return!e||!Array.isArray(e.children)?"":St(e.children)}function St(t){return t.map(We).join("")}function We(t){var e,n,i,r,a,d;if(!t)return"";switch(t.type){case"paragraph":return`<p>${St(t.children||[])||"&nbsp;"}</p>`;case"extended-link":case"link":{const s=t.url||((e=t.values)==null?void 0:e.href)||((n=t.attrs)==null?void 0:n.href)||"",l=t.target||((i=t.values)==null?void 0:i.target)||((r=t.attrs)==null?void 0:r.target)||"",u=St(t.children||[]),g=[`href="${Jt(s)}"`];return l&&g.push(`target="${Jt(l)}"`),`<a ${g.join(" ")}>${u}</a>`}case"extended-text":case"text":{const s=Zt(String((a=t.text)!=null?a:""));return ze(s,Number(t.format||0))}case"merge_tag":{const s=t.text||((d=t.properties)==null?void 0:d.value)||t.value||"";return Zt(String(s))}case"linebreak":return"<br>";default:return Array.isArray(t.children)?St(t.children):""}}function ze(t,o){return o&&(o&1&&(t=`<strong>${t}</strong>`),o&2&&(t=`<em>${t}</em>`),o&4&&(t=`<s>${t}</s>`),o&8&&(t=`<u>${t}</u>`)),t}function Zt(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Jt(t){return String(t).replace(/"/g,"&quot;")}function ae(t,o){var x,A,S,_,k,y,w,D,R,$,N,P,L,v,X,dt,lt,st,At;const e=((x=t.src)==null?void 0:x.url)||"",n=t.action||{},i={src:e,alt:t.altText||"",title:t.title||"",href:((A=n.values)==null?void 0:A.href)||"",target:((S=n.values)==null?void 0:S.target)||"",align:t.textAlign||"center"};J(Object.assign(i,ft(t)));const r=typeof((_=t.src)==null?void 0:_.height)=="number"?t.src.height:0,a=typeof((k=t.src)==null?void 0:k.width)=="number"?t.src.width:0;if(r>0&&r<=5&&a>0&&a/r>=50){const q=H((y=i["padding-bottom"])!=null?y:"0px");i["padding-bottom"]=`${q+16}px`}const d=H(i["padding-left"])+H(i["padding-right"]),s=Math.max(1,o.columnPxWidth-d),l=(w=t.src)==null?void 0:w.maxWidth;l?i.width=It(l,s):typeof((D=t.src)==null?void 0:D.width)=="number"&&(i.width=`${Math.min(t.src.width,s)}px`),Yt(e)&&(i.height=(R=t.src)!=null&&R.height?le(t.src.height,($=t.src)==null?void 0:$.width,i.width):"18px");const u=typeof((N=t.src)==null?void 0:N.width)=="number"?t.src.width:void 0,g=H(i.width),p=pn(t._override,u,g||void 0,typeof((P=t.src)==null?void 0:P.maxWidth)=="string"?t.src.maxWidth:void 0,{brokenImage:Yt(e),srcNativeHeight:typeof((L=t.src)==null?void 0:L.height)=="number"?t.src.height:void 0,desktopPaddingLeft:H(i["padding-left"]),desktopPaddingRight:H(i["padding-right"]),align:t.textAlign||"center"}),c=(lt=(dt=(X=(v=t._override)==null?void 0:v.mobile)==null?void 0:X.src)==null?void 0:dt.maxWidth)!=null?lt:l,f=c==="0%"||c==="0"||c===0,T=tt=>{if(!tt)return!1;const q=String(tt).trim();return q!=="0"&&q!=="0px"&&q!=="0 0 0 0"},h=T(p["padding-top"])||T(p["padding-bottom"])||T(p.padding);if(f&&!h&&(p["padding-top"]="8px",p["padding-bottom"]="9px"),g&&p["fluid-on-mobile"]!=="true"){const tt=H(i["padding-left"]),q=H(i["padding-right"]),kt=Math.max(1,o.columnPxWidth-tt-q),ht=Math.min(g,kt),ct=p["padding-left"],pt=p["padding-right"],gt=ct!=null&&ct!==""?H(String(ct)):tt,W=pt!=null&&pt!==""?H(String(pt)):q;if(o.columnPxWidth-gt-W<ht){const j=Math.max(0,o.columnPxWidth-ht),ut=gt+W;if(ut>0&&j<ut){const Ct=j/ut,Nt=Math.round(gt*Ct),Gt=j-Nt;if(p["padding-left"]=`${Nt}px`,p["padding-right"]=`${Gt}px`,p.padding){const he=H(String((st=p["padding-top"])!=null?st:0)),be=H(String((At=p["padding-bottom"])!=null?At:0));p.padding=`${he}px ${Gt}px ${be}px ${Nt}px`}}}}return B({type:m.STANDARD_IMAGE,data:{},attributes:M(i),mobileAttributes:M(p),children:[{text:""}]})}function ve(t,o){var a,d;const e=t.href||{},n=t.buttonColors||{},i={align:t.textAlign||"center",href:((a=e.values)==null?void 0:a.href)||"",target:((d=e.values)==null?void 0:d.target)||"",color:n.color||"","background-color":n.backgroundColor||"","font-size":t.fontSize||"","font-family":Wt(t.fontFamily,o),"line-height":t.lineHeight||"","border-radius":t.borderRadius||"",width:de(t.size)};J(Object.assign(i,ft(t))),J(Object.assign(i,{"inner-padding":t.padding}),"inner-padding");const r=pe(t.border);return r.width&&(i["border-enabled"]=!0,i["border-width"]=r.width,i["border-style"]=r.style,i["border-color"]=r.color),B({type:m.STANDARD_BUTTON,data:{},attributes:M(i),mobileAttributes:M(gn(t._override)),children:U(t.text)})}function Fe(t){const o=pe(t.border,"borderTop"),e={width:t.width||"100%",align:t.textAlign||"center","border-color":o.color||"#000000","border-style":o.style||"solid","border-width":o.width||"1px"};return J(Object.assign(e,ft(t))),B({type:m.STANDARD_DIVIDER,data:{},attributes:M(e),mobileAttributes:M(Q(t._override,{padding:!0})),children:[{text:""}]})}function Ge(t,o){var f,T,h;const e=((f=t.menu)==null?void 0:f.items)||[],n="",i=t.linkColor||t.textColor||"",r=t.fontSize||"",a=Wt(t.fontFamily,o),d=t.padding||"",s=((h=(T=t._override)==null?void 0:T.mobile)==null?void 0:h.padding)||"",l=t.textTransform||"none",u=(x,A,S)=>{var _,k;return B({type:m.STANDARD_NAVBAR_LINK,data:{},attributes:M({href:A?"":((_=S==null?void 0:S.values)==null?void 0:_.href)||"",target:A?"":((k=S==null?void 0:S.values)==null?void 0:k.target)||"",color:i,"font-size":r,"font-family":a,"line-height":"1.2",padding:d,"text-transform":l,"text-decoration":"none"}),mobileAttributes:s?{padding:s}:void 0,children:A?[{text:x}]:U(x)})},g=[];e.forEach((x,A)=>{A>0&&n&&g.push(u(n,!0)),g.push(u(x.text||"",!1,x.link))});const p={align:t.align||"center",color:i,"font-size":r,"font-family":a,"text-transform":l};J(Object.assign(p,ft(t)));const c=t._override?F(E({},t._override),{mobile:t._override.mobile?F(E({},t._override.mobile),{padding:void 0}):void 0}):void 0;return B({type:m.STANDARD_NAVBAR,data:{},attributes:M(p),mobileAttributes:M(Q(c,{padding:!0})),children:g.length>0?g:[yt()]})}function Ue(t,o){var a,d;const e=((a=t.icons)==null?void 0:a.icons)||[],n=((d=t.icons)==null?void 0:d.iconType)||"rounded",i=e.map(s=>{const l=String(s.name||"").trim(),u=Ve(l);return B({type:m.STANDARD_SOCIAL_ELEMENT,data:{},attributes:M({src:u?je(n,u):"",mode:"custom",href:s.url||"",name:l.toLowerCase(),alt:l?`${l} icon`:"",title:l,target:"_blank"}),children:[{text:""}]})}),r={align:t.align||"center",mode:"horizontal","icon-size":t.iconSize?`${t.iconSize}px`:"",spacing:t.spacing!=null?`${t.spacing}px`:"",color:t.color||"","font-size":t.fontSize||""};return J(Object.assign(r,ft(t))),B({type:m.STANDARD_SOCIAL,data:{},attributes:M(r),mobileAttributes:M(Q(t._override,{padding:!0})),children:i.length>0?i:[yt()]})}function je(t,o){return`https://cdn.tools.unlayer.com/social/icons/${t}/${o}.png`}function Ve(t){var n;if(!t)return"";const o={facebook:"facebook",linkedin:"linkedin",instagram:"instagram",twitter:"twitter",x:"x",youtube:"youtube",pinterest:"pinterest",tiktok:"tiktok",snapchat:"snapchat",whatsapp:"whatsapp",github:"github"},e=t.toLowerCase();return(n=o[e])!=null?n:e.replace(/[^a-z0-9]/g,"")}function Ke(t){return B({type:m.RAW,data:{content:t.html||""},attributes:{},children:[{text:""}]})}function Xe(){return B({type:m.STANDARD_COLUMN,data:{},attributes:{width:"100%"},children:[yt()]})}function yt(){return B({type:m.STANDARD_PARAGRAPH,data:{},attributes:{},children:[{text:""}]})}function qe(t){switch(t){case"h2":return m.STANDARD_H2;case"h3":return m.STANDARD_H3;case"h4":return m.STANDARD_H4;case"h1":default:return m.STANDARD_H1}}function de(t){if(t==null)return"";if(typeof t=="number")return`${t}px`;if(typeof t=="string")return t;if(typeof t=="object"){if(t.autoWidth)return"";if(typeof t.width=="number")return`${t.width}px`;if(typeof t.width=="string")return t.width}return""}function H(t){if(typeof t=="number")return t;if(typeof t!="string")return 0;const o=/^(-?\d+(?:\.\d+)?)(px)?$/.exec(t.trim());return o?parseFloat(o[1]):0}function Ze(t){return`${Number((t*100).toFixed(4))}%`}function It(t,o){if(!t)return"";const e=String(t).trim(),n=/^(-?\d+(?:\.\d+)?)%$/.exec(e);if(n){const i=parseFloat(n[1]);return`${Math.max(1,Math.round(i/100*o))}px`}return/^-?\d+(?:\.\d+)?$/.test(e)?`${e}px`:e}function Yt(t){const o=String(t||"").trim();return o?!/^(?:https?:|data:|blob:)/i.test(o):!1}function le(t,o,e){if(typeof t!="number"||t<=0)return"";const n=typeof o=="number"&&o>0?o:0,i=H(e);return n>0&&i>0?`${Math.max(1,Math.round(t*i/n))}px`:`${t}px`}function Je(t,o){const e=new Set,n=[],i=a=>{if(!a||typeof a!="object"||!a.url)return;const d=String(a.url);e.has(d)||(e.add(d),n.push({name:String(a.label||a.value||"").trim(),href:d}))};i(o);const r=a=>{if(!(!a||typeof a!="object")){a.fontFamily&&i(a.fontFamily);for(const d of Object.keys(a)){const s=a[d];Array.isArray(s)?s.forEach(r):s&&typeof s=="object"&&r(s)}}};return r(t),n}function Ye(t){var a,d,s,l,u,g;if(t.length===0)return{};const o={},e=(t[0].contents||[]).map(p=>p.type).join(","),n=((a=t[0].values)==null?void 0:a.backgroundColor)||"",i=!!e&&t.every(p=>{var T;const c=(p.contents||[]).map(h=>h.type).join(","),f=((T=p.values)==null?void 0:T.backgroundColor)||"";return c===e&&f===n}),r=["Top"];i||r.push("Bottom");for(const p of r){const c=`border${p}Width`,f=`border${p}Color`,T=`border${p}Style`,h=(s=(d=t[0])==null?void 0:d.values)==null?void 0:s.border;if(!h)continue;const x=h[c],A=h[f],S=h[T]||"solid";if(!x||x==="0"||x==="0px")continue;let _=!0;for(let k=1;k<t.length;k++){const y=(u=(l=t[k])==null?void 0:l.values)==null?void 0:u.border;if(!y||y[c]!==x||y[f]!==A||(y[T]||"solid")!==S){_=!1;break}}if(_){o[`border-${p.toLowerCase()}`]=`${x} ${S} ${A||"transparent"}`;for(const k of t){const y=(g=k.values)==null?void 0:g.border;y&&(y[c]="0px")}}}return o}function Qe(t){const o={};if(t.length===0)return o;const e=(n,i,r)=>{var u;const a=(u=n==null?void 0:n.values)==null?void 0:u.border;if(!a)return;const d=a[`border${i}Width`],s=a[`border${i}Color`],l=a[`border${i}Style`]||"solid";!d||d==="0"||d==="0px"||(o[r]=`${d} ${l} ${s||"transparent"}`,a[`border${i}Width`]="0px")};return e(t[0],"Left","border-left"),e(t[t.length-1],"Right","border-right"),o}function wt(t){var e,n,i,r;if(t.length===0)return"";const o=(n=(e=t[0])==null?void 0:e.values)==null?void 0:n.backgroundColor;if(!o)return"";for(let a=1;a<t.length;a++)if(((r=(i=t[a])==null?void 0:i.values)==null?void 0:r.backgroundColor)!==o)return"";return o}function tn(t){var i,r;const o=t.contents||[];if(o.length===0)return!0;if(o.length>1)return!1;const e=o[0];if(e.type!=="image")return!1;const n=(r=(i=e.values)==null?void 0:i.src)==null?void 0:r.maxWidth;return n==="0%"||n==="0"||n===0}function en(t){var i,r,a,d,s;if(t.length<3)return"";const o=((r=(i=t[0])==null?void 0:i.values)==null?void 0:r.backgroundColor)||"",e=((d=(a=t[t.length-1])==null?void 0:a.values)==null?void 0:d.backgroundColor)||"";if(!o||o!==e)return"";let n="";for(let l=1;l<t.length-1;l++){const u=t[l],g=((s=u==null?void 0:u.values)==null?void 0:s.backgroundColor)||"";if(g&&g!==o){if(!tn(u)||n&&n!==g)return"";n=g}}return n}function se(t){var o;for(const e of t){const n=(o=e==null?void 0:e.values)==null?void 0:o.border;if(!n)continue;const i=["borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth"];for(const r of i){const a=n[r];if(a&&a!=="0px"&&a!=="0")return!0}}return!1}function nn(t){var i,r,a;const o=t.columns||[];if(o.length<2)return;const e=t.cells||o.map(()=>1),n=new Map;o.forEach((d,s)=>{var c;const l=(d.contents||[]).map(f=>f.type).join(","),u=((c=d.values)==null?void 0:c.backgroundColor)||"";if(!l)return;const g=`${l}|${u}`,p=n.get(g)||[];p.push(s),n.set(g,p)});for(const d of n.values()){if(d.length<2)continue;const s=d.map(p=>{var c;return Number((c=e[p])!=null?c:1)}),l=Math.min(...s),u=Math.max(...s);if(u>0&&(u-l)/u>.2)continue;const g=o[d[0]].contents.length;for(let p=0;p<g;p++){let c=0,f=0,T=1/0,h=1/0;for(const _ of d){const k=o[_].contents[p],y=Tt((i=k.values)==null?void 0:i.containerPadding),w=y?H(y.top):0,D=y?H(y.bottom):0;c=Math.max(c,w),f=Math.max(f,D),T=Math.min(T,w),h=Math.min(h,D)}const x=c-T>80,A=f-h>80,S=c>T;for(const _ of d){const k=o[_].contents[p],y=(a=Tt((r=k.values)==null?void 0:r.containerPadding))!=null?a:{top:"0px",right:"0px",bottom:"0px",left:"0px"};let w=!1;!x&&!S&&H(y.top)<c&&(y.top=`${c}px`,w=!0),!A&&H(y.bottom)<f&&(y.bottom=`${f}px`,w=!0),w&&(k.values=k.values||{},k.values.containerPadding=`${y.top} ${y.right} ${y.bottom} ${y.left}`)}}}}function on(t){var i,r,a,d;const o=t.columns||[];if(o.length<2||!((a=(r=(i=t.values)==null?void 0:i._override)==null?void 0:r.mobile)!=null&&a.noStackMobile)||!wt(o)||!se(o))return!1;const e=new Set(["image","text","heading"]),n=(o[0].contents||[]).map(s=>s.type).join(",");if(!n)return!1;for(const s of o){const l=((d=s.values)==null?void 0:d.border)||{},u=l.borderTopWidth,g=l.borderBottomWidth;if(!u||u==="0"||u==="0px"||!g||g==="0"||g==="0px")return!1}for(const s of o){const l=s.contents||[];for(const g of l)if(!e.has(g.type))return!1;if(l.map(g=>g.type).join(",")!==n)return!1}return!0}function rn(t,o,e){var h;const n=t.values||{},i=t.columns||[],r=t.cells||i.map(()=>1),a=r.reduce((x,A)=>x+Number(A||0),0)||1,d=wt(i);let s="#000000",l="solid",u="1px";for(const x of i){const A=(h=x.values)==null?void 0:h.border;if(!A)continue;const S=A.borderTopWidth||A.borderRightWidth||A.borderBottomWidth||A.borderLeftWidth;if(S&&S!=="0px"&&S!=="0"){u=S,s=A.borderTopColor||A.borderRightColor||A.borderBottomColor||A.borderLeftColor||s,l=A.borderTopStyle||A.borderRightStyle||A.borderBottomStyle||A.borderLeftStyle||l;break}}const g=i.map((x,A)=>{var $,N,P;const S=x.values||{};if(at(S)==="hidden")return null;const _=Number(($=r[A])!=null?$:1)/a,k=Math.round(o.contentWidthPx*_),y=(x.contents||[]).map(L=>an(L,F(E({},o),{columnPxWidth:k}))).filter(L=>L!=null),w=((N=x.values)==null?void 0:N.border)||{},D=[w.borderTopWidth,w.borderRightWidth,w.borderBottomWidth,w.borderLeftWidth].some(L=>L&&L!=="0px"&&L!=="0"),R=`${(Number((P=r[A])!=null?P:1)/a*100).toFixed(4)}%`;return Dt(B({type:m.STANDARD_TABLE2_TD,data:{rowspan:1,colspan:1},attributes:M({"border-enabled":D?!0:void 0,"text-align":"center",width:R}),children:y.length>0?y:[yt()]}),S)}).filter(x=>x!=null),p=B({type:m.STANDARD_TABLE2_TR,data:{},attributes:M({"background-color":d||""}),children:g}),c=B({type:m.STANDARD_TABLE2,data:{},attributes:M({"border-enabled":!0,"border-color":s,"border-style":l,"border-width":u,"text-align":"center","cell-padding-top":"0px","cell-padding-right":"0px","cell-padding-bottom":"0px","cell-padding-left":"0px",padding:"0px 0px 0px 0px","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"0px",width:"100%"}),children:[p]}),f=B({type:m.STANDARD_COLUMN,data:{},attributes:{width:"100%","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"0px"},children:[c]}),T={"background-color":n.backgroundColor||"","padding-top":e.top,"padding-right":e.right,"padding-bottom":e.bottom,"padding-left":e.left};return zt(T),o.templateUsesFullWidth&&(T["full-width"]="full-width"),B({type:m.STANDARD_SECTION,data:{},attributes:M(T),children:[f]})}function an(t,o){const e=t.values||{};if(at(e)==="hidden")return null;let n;switch(t.type){case"image":n=dn(e,o);break;case"heading":case"text":n=ln(e,o);break;default:return ie(t,o)}return Dt(n,e)}function dn(t,o){var f,T;const e=((f=t.src)==null?void 0:f.url)||"",n=t.altText||"",r=(T=ae(t,o).attributes)!=null?T:{},a=r.width||"",d=r["padding-top"]||"0px",s=r["padding-right"]||"0px",l=r["padding-bottom"]||"0px",u=r["padding-left"]||"0px",g=["display:block","margin:0 auto","max-width:100%","height:auto","border:0",a?`width:${a}`:""].filter(Boolean).join(";"),p=`padding:${d} ${s} ${l} ${u};text-align:center`,c=B({type:m.HTML_BLOCK_NODE,data:{tagName:"img"},attributes:{src:e,alt:n,style:g},children:[{text:""}]});return B({type:m.HTML_BLOCK_NODE,data:{tagName:"div"},attributes:{style:p},children:[c]})}function ln(t,o){const e=Ht(t,o),n=e["padding-top"]||"0px",i=e["padding-right"]||"0px",r=e["padding-bottom"]||"0px",a=e["padding-left"]||"0px",d=[e.color?`color:${e.color}`:"",e["font-family"]?`font-family:${e["font-family"]}`:"",e["font-size"]?`font-size:${e["font-size"]}`:"",e["line-height"]?`line-height:${e["line-height"]}`:"",e["letter-spacing"]?`letter-spacing:${e["letter-spacing"]}`:"",e.align?`text-align:${e.align}`:"",`padding:${n} ${i} ${r} ${a}`,"margin:0","word-wrap:break-word"].filter(Boolean).join(";"),s=ce(t.text||"",Mt(t,o));return B({type:m.HTML_BLOCK_NODE,data:{tagName:"div"},attributes:{style:d},children:s.length>0?s:[{text:""}]})}function ce(t,o){if(!t)return[];const e=(l,u,g)=>{if(!g&&!l.trim())return null;const p=Ot(U(l),o),c=u?`margin:0;${u}`:"margin:0";return{type:m.HTML_BLOCK_NODE,data:{tagName:"p"},attributes:{style:c},children:p.length?p:[{text:""}]}},n=(l,u,g)=>{const p=/<li\b([^>]*)>([\s\S]*?)<\/li>/gi,c=[];let f;for(;(f=p.exec(g))!==null;){const h=Et(f[1]||""),x=Ot(U(f[2]),o);c.push({type:m.HTML_BLOCK_NODE,data:{tagName:"li"},attributes:h?{style:h}:{},children:x.length?x:[{text:""}]})}if(c.length===0)return null;const T=Et(u);return{type:m.HTML_BLOCK_NODE,data:{tagName:l},attributes:T?{style:T}:{},children:c}},i=[],r=/<(p|ul|ol)\b([^>]*)>([\s\S]*?)<\/\1>/gi;let a=0,d;for(;(d=r.exec(t))!==null;){const l=e(t.slice(a,d.index),"",!1);l&&i.push(l);const u=d[1].toLowerCase(),g=d[2]||"",p=u==="p"?e(d[3],Et(g),!0):n(u,g,d[3]);p&&i.push(p),a=d.index+d[0].length}const s=e(t.slice(a),"",!1);return s&&i.push(s),i}function Et(t){var e,n;const o=/\bstyle\s*=\s*"([^"]*)"|\bstyle\s*=\s*'([^']*)'/i.exec(t);return o&&(n=(e=o[1])!=null?e:o[2])!=null?n:""}function zt(t){const o=t["padding-top"],e=t["padding-right"],n=t["padding-bottom"],i=t["padding-left"];o==null&&e==null&&n==null&&i==null||(t.padding=`${o!=null?o:"0px"} ${e!=null?e:"0px"} ${n!=null?n:"0px"} ${i!=null?i:"0px"}`)}function sn(t){const o={};return t!=null&&t.padding&&(o.padding=t.padding),o}function Qt(t){return t?/^0(?:px|em|rem|%|pt)?$/i.test(t.trim()):!0}function ft(t){const o={};return t!=null&&t.containerPadding&&(o.padding=t.containerPadding),o}function te(t,o={}){if(!t||typeof t!="object")return{};const e={},n=["Top","Right","Bottom","Left"];let i=!1;for(const r of n){const a=t[`border${r}Width`],d=t[`border${r}Color`],s=t[`border${r}Style`];(a||d||s)&&(a&&a!=="0"&&a!=="0px"&&(i=!0),e[`border-${r.toLowerCase()}`]=`${a||"0px"} ${s||"solid"} ${d||"transparent"}`)}return i||o.includeZero?e:{}}function pe(t,o="borderAll"){if(!t||typeof t!="object")return{width:"",style:"",color:""};const e=(o==="borderTop"||t.borderTopWidth||t.borderTopColor,"borderTop");return{width:t[`${e}Width`]||"",style:t[`${e}Style`]||"",color:t[`${e}Color`]||""}}function ee(t){const o={};return t.url&&(o["background-url"]=t.url),t.repeat&&(o["background-repeat"]=t.repeat),t.position?o["background-position"]=cn(t.position):t.customPosition&&(o["background-position"]=t.customPosition.join(" ")),typeof t.size=="string"?t.size==="custom"&&t.width?o["background-size"]=`${t.width}px auto`:t.size!=="custom"&&(o["background-size"]=t.size):t.fullWidth&&t.width&&(o["background-size"]=`${t.width}px auto`),o}function cn(t){const o=t.trim();if(!o||o.includes(" ")||/[%\d]/.test(o))return o;const e=o.split("-").filter(Boolean);if(e.length!==2)return o;const n=new Set(["top","bottom"]);return n.has(e[0])&&!n.has(e[1])?`${e[1]} ${e[0]}`:e.join(" ")}function Q(t,o={}){const e=t==null?void 0:t.mobile;if(!e)return{};const n={};return e.textAlign&&(n.align=e.textAlign),e.fontSize&&(n["font-size"]=e.fontSize),e.lineHeight&&(n["line-height"]=e.lineHeight),e.backgroundColor&&(n["background-color"]=e.backgroundColor),o.padding&&e.containerPadding&&(Object.assign(n,{padding:e.containerPadding}),J(n,"padding")),e.padding&&J(Object.assign(n,{padding:e.padding}),"padding"),n}const bt=375;function pn(t,o,e,n,i={}){var d,s,l,u,g,p;const r=Q(t,{padding:!0}),a=t==null?void 0:t.mobile;if(!((d=a==null?void 0:a.src)!=null&&d.maxWidth)&&n&&/^-?\d+(?:\.\d+)?%$/.test(n.trim())){const c=It(n,bt);if(c){const f=H(c);e&&f>e?r.width=`${e}px`:r.width=c}}if(((s=a==null?void 0:a.src)==null?void 0:s.autoWidth)===!0&&(o&&(r.width=`${o}px`),r["fluid-on-mobile"]="true"),(l=a==null?void 0:a.src)!=null&&l.maxWidth&&((u=a==null?void 0:a.src)==null?void 0:u.autoWidth)!==!0){const c=String(a.src.maxWidth).trim(),f=/^(-?\d+(?:\.\d+)?)%$/.exec(c),T=c==="100%"||c==="100",h=It(c,bt);let x=h;if(h){const A=H(h);!i.brokenImage&&o&&o>0&&A>o&&(x=`${o}px`)}if(x&&(r.width=x),T)r["fluid-on-mobile"]="true";else if(f){const A=parseFloat(f[1]),S=r["padding-left"]!=null?H(String(r["padding-left"])):(g=i.desktopPaddingLeft)!=null?g:0,_=r["padding-right"]!=null?H(String(r["padding-right"])):(p=i.desktopPaddingRight)!=null?p:0,k=Math.max(0,bt-S-_);let y=A/100*k;if(!i.brokenImage&&o&&o>0&&y>o&&(y=o),y>0&&y<bt){r.width=`${Math.round(y)}px`;const w=Math.max(0,bt-y),D=String(i.align||"").toLowerCase();let R=w/2,$=w/2;D==="left"?(R=S,$=Math.max(0,w-R)):D==="right"&&($=_,R=Math.max(0,w-$)),r["padding-left"]=`${R}px`,r["padding-right"]=`${$}px`,r["fluid-on-mobile"]="true"}}}if(i.brokenImage&&i.srcNativeHeight&&o){const c=H(r.width);c>0&&(r.height=le(i.srcNativeHeight,o,`${c}px`))}return r}function gn(t){const o=Q(t,{padding:!0}),e=t==null?void 0:t.mobile,n=de(e==null?void 0:e.size);return n&&(o.width=n),o}function M(t){const o={};for(const e of Object.keys(t)){const n=t[e];n===""||n==null||(o[e]=n)}return o}function at(t){var n,i,r,a;if(!t)return;const o=t.hideDesktop===!0||((i=(n=t._override)==null?void 0:n.desktop)==null?void 0:i.hideDesktop)===!0,e=t.hideMobile===!0||((a=(r=t._override)==null?void 0:r.mobile)==null?void 0:a.hideMobile)===!0;if(o&&e)return"hidden";if(o)return"mobile";if(e)return"desktop"}function Dt(t,o){if(!t)return t;const e=at(o);return e==="hidden"?null:(e&&(t.visible=e),t)}function $t(t,o){const e=at(o);return e==="hidden"?[]:e?t.map(n=>F(E({},n),{visible:e})):t}function B(t){return t!=null&&t.mobileAttributes&&typeof t.mobileAttributes=="object"&&Object.keys(t.mobileAttributes).length===0&&delete t.mobileAttributes,t}const V={HEADING:"mailup-bee-newsletter-modules-heading",PARAGRAPH:"mailup-bee-newsletter-modules-paragraph",TEXT:"mailup-bee-newsletter-modules-text",BUTTON:"mailup-bee-newsletter-modules-button",IMAGE:"mailup-bee-newsletter-modules-image",SPACER:"mailup-bee-newsletter-modules-spacer",DIVIDER:"mailup-bee-newsletter-modules-divider",MENU:"mailup-bee-newsletter-modules-menu",SOCIAL:"mailup-bee-newsletter-modules-social",ICONS:"mailup-bee-newsletter-modules-icons",HTML:"mailup-bee-newsletter-modules-html",LIST:"mailup-bee-newsletter-modules-list",TABLE:"mailup-bee-newsletter-modules-table",VIDEO:"mailup-bee-newsletter-modules-video",CAROUSEL:"mailup-bee-newsletter-modules-carousel",FORM:"mailup-bee-newsletter-modules-form",MERGE_CONTENT:"mailup-bee-newsletter-modules-merge-content",EMPTY:"mailup-bee-newsletter-modules-empty"};function un(t){var h,x,A,S,_,k,y,w,D,R,$,N;const o=[],e=fn(t);if(!e)throw new Error("beefreeToEasyEmailPro: input has no { page: { body, rows } }");for(const P of e.rows||[])for(const L of P.columns||[])for(const v of L.modules||[])if(v.type===V.MENU)throw new Error("beefreeToEasyEmailPro: template uses `menu` module (navbar), which is not supported — conversion aborted");const n=e.body,i=((x=(h=n==null?void 0:n.content)==null?void 0:h.computedStyle)==null?void 0:x.messageWidth)||"700px",r=parseInt(String(i),10)||700,a=((S=(A=n==null?void 0:n.content)==null?void 0:A.computedStyle)==null?void 0:S.linkColor)||"",d=((k=(_=n==null?void 0:n.content)==null?void 0:_.style)==null?void 0:k["background-color"])||((w=(y=n==null?void 0:n.container)==null?void 0:y.style)==null?void 0:w["background-color"])||"",s=((R=(D=n==null?void 0:n.content)==null?void 0:D.style)==null?void 0:R["font-family"])||"",l=((N=($=n==null?void 0:n.content)==null?void 0:$.style)==null?void 0:N.color)||"",u={};s&&(u["font-family"]=s);const g={};l&&(g[ne.TEXT]={color:l});const c=(e.rows||[]).flatMap(P=>hn(P,{contentWidthPx:r,columnPxWidth:r,bodyLinkColor:a,warnings:o})),f=((n==null?void 0:n.webFonts)||[]).map(P=>({name:P.name||"",href:P.url||""})).filter(P=>P.name&&P.href);return{page:{type:m.PAGE,data:E({breakpoint:r>700?"768px":"720px",globalAttributes:u,categoryAttributes:g,blockAttributes:{},classAttributes:{},preheader:""},f.length>0?{fonts:f}:{}),attributes:O({width:`${r}px`,"background-color":d,"content-background-color":"","margin-top":"0px","margin-bottom":"0px","link-color":a}),children:c},warnings:o}}function fn(t){var o,e,n;return t?(o=t.page)!=null&&o.rows?t.page:(n=(e=t.template)==null?void 0:e.page)!=null&&n.rows?t.template.page:t.rows&&t.body?t:null:null}function hn(t,o){var ht,ct,pt,gt;const e=((ht=t.content)==null?void 0:ht.style)||{},n=((ct=t.content)==null?void 0:ct.mobileStyle)||{},i=((pt=t.container)==null?void 0:pt.style)||{},r=((gt=t.content)==null?void 0:gt.computedStyle)||{},a=t.columns||[];if(a.length===0)return[];if(r.hideContentOnDesktop===!0&&r.hideContentOnMobile===!0)return[];const d=r.hideContentOnDesktop===!0?"mobile":r.hideContentOnMobile===!0?"desktop":void 0,s=(e["background-color"]||"").trim(),l=(i["background-color"]||"").trim(),u=W=>!W||W.toLowerCase()==="transparent",g=u(s)&&!u(l)?l:s,p=u(s)&&(!u(l)||!!mt(i["background-image"])),c=a.reduce((W,K)=>W+(K["grid-columns"]||0),0)||12,f=r.rowColStackOnMobile===!1&&a.length>1,T=(a[0].style||{})["background-color"]||"",x=(W=>!!W&&W.trim().toLowerCase()!=="transparent")(T)&&a.every(W=>(W.style||{})["background-color"]===T),A=String(r.columnsSpacing||"").trim(),S=!!A&&A!=="0px"&&A!=="0",_=x&&!S?T:"",k=r.columnsBorderRadius||"",y=S?k:"",w=e.padding||e["padding-top"]||e["padding-right"]||e["padding-bottom"]||e["padding-left"],D={top:e["padding-top"]||"",right:e["padding-right"]||"",bottom:e["padding-bottom"]||"",left:e["padding-left"]||"",shorthand:e.padding||(w?"":"0")},R=mt(e["background-image"])?e:u(s)&&mt(i["background-image"])?i:null,$=R?mt(R["background-image"]):"",N=$?O({"background-url":$,"background-position":R["background-position"]||"","background-repeat":R["background-repeat"]||"","background-size":R["background-size"]||"","background-image-enabled":!0}):{},P=!f&&a.length>1,L=W=>W.map((K,j)=>{const ut=K["grid-columns"]||12,Ct=Math.round(o.contentWidthPx*ut/c);return bn(K,ut,c,F(E({},o),{columnPxWidth:Ct,columnStacksOnMobile:P,skipColBg:!!_,perColumnRadius:y,columnsSpacing:S?A:"",colIndex:j,colCount:W.length}))}).filter(K=>K!=null),v=r.rowReverseColStackOnMobile===!0&&r.rowColStackOnMobile!==!1&&a.length>1;let X;if(v){const W=L(a).map(j=>F(E({},j),{visible:"desktop"})),K=L([...a].reverse()).map(j=>F(E({},j),{visible:"mobile"}));X=[...W,...K]}else X=L(a);if(X.length===0)return[];const dt=f?[I({type:m.STANDARD_GROUP,data:{},attributes:{width:"100%"},children:X})]:X,lt=ue(n);if(_){const W=O(E({"background-color":g,"border-radius":e["border-radius"]||"",padding:D.shorthand,"padding-top":D.top,"padding-right":D.right,"padding-bottom":D.bottom,"padding-left":D.left},N)),K=I({type:m.STANDARD_SECTION,data:{},attributes:O({"background-color":_,"border-radius":k,padding:"0"}),children:dt}),j=I({type:m.STANDARD_WRAPPER,data:{},attributes:W,mobileAttributes:lt,children:[K]});return d&&(j.visible=d),[j]}const st=mt(i["background-image"]),At=!!st||!u(l)&&l!==s,tt=!u(s);if(!_&&At&&tt){const W=O(E({"full-width":"full-width","background-color":l,padding:D.shorthand,"padding-top":D.top,"padding-right":D.right,"padding-bottom":D.bottom,"padding-left":D.left},st?{"background-url":st,"background-position":i["background-position"]||"","background-repeat":i["background-repeat"]||"","background-size":i["background-size"]||"","background-image-enabled":!0}:{})),K=I({type:m.STANDARD_SECTION,data:{},attributes:O({"background-color":s,"border-radius":(y?"":k)||e["border-radius"]||"",padding:"0"}),children:dt}),j=I({type:m.STANDARD_WRAPPER,data:{},attributes:W,mobileAttributes:lt,children:[K]});return d&&(j.visible=d),[j]}const q=O(E(F(E({},p?{"full-width":"full-width"}:{}),{"background-color":g,"border-radius":(y?"":k)||e["border-radius"]||"",padding:D.shorthand,"padding-top":D.top,"padding-right":D.right,"padding-bottom":D.bottom,"padding-left":D.left}),N)),kt=I({type:m.STANDARD_SECTION,data:{},attributes:q,mobileAttributes:lt,children:dt});return d&&(kt.visible=d),[kt]}function bn(t,o,e,n){const i=t.style||{},r=t.mobileStyle||{},a=`${Math.round(100*o/e)}%`,d=O({width:a,"background-color":n.skipColBg?"":i["background-color"]||"","border-radius":i["border-radius"]||n.perColumnRadius||"","border-top":et(i["border-top"]),"border-right":et(i["border-right"]),"border-bottom":et(i["border-bottom"]),"border-left":et(i["border-left"]),padding:i.padding||"","padding-top":i["padding-top"]||"","padding-right":i["padding-right"]||"","padding-bottom":i["padding-bottom"]||"","padding-left":i["padding-left"]||"","vertical-align":i["vertical-align"]||""}),s=ue(r),l=n.colCount!=null&&n.colIndex!=null?n.colIndex>=n.colCount-1:!0;if(n.columnsSpacing&&!l){const g=parseInt(n.columnsSpacing,10)||0;if(g>0){const p=parseInt(s["padding-bottom"]||"0",10)||0;s["padding-bottom"]=`${p+g}px`}}const u=(t.modules||[]).map(g=>mn(g,n)).filter(g=>!!g);return u.length===0?null:I({type:m.STANDARD_COLUMN,data:{},attributes:d,mobileAttributes:s,children:u})}function mn(t,o){const e=t.descriptor||{},n=(()=>{switch(t.type){case V.HEADING:return _n(e,o);case V.PARAGRAPH:case V.TEXT:return An(e,o);case V.BUTTON:return kn(e);case V.IMAGE:return xn(e,o);case V.SPACER:return Sn(e);case V.DIVIDER:return Tn(e);case V.HTML:return Cn(e);case V.LIST:return Nn(e);case V.SOCIAL:return wn(e);case V.ICONS:return Dn(e);case V.TABLE:return Rn(e,o);case V.EMPTY:return null;default:return o.warnings.push(`unsupported module type: ${t.type}`),null}})();return yn(n,e)}function yn(t,o){if(!t)return t;const e=(o==null?void 0:o.computedStyle)||{},n=e.hideContentOnDesktop===!0,i=e.hideContentOnMobile===!0;return n&&i?null:(n?t.visible="mobile":i&&(t.visible="desktop"),t)}function _n(t,o){var c;const e=t.heading||{},n=t.style||{},i=e.style||{},r=e.title||"h1",a=e.text||"",d=r==="h2"?m.STANDARD_H2:r==="h3"?m.STANDARD_H3:m.STANDARD_H1,s=O({align:i["text-align"]||n["text-align"]||"",color:i.color||"","font-family":_t(i["font-family"]),"font-size":i["font-size"]||"","font-weight":i["font-weight"]||"","letter-spacing":i["letter-spacing"]||"","line-height":i["line-height"]||"","padding-top":n["padding-top"]||"","padding-right":n["padding-right"]||"","padding-bottom":n["padding-bottom"]||"","padding-left":n["padding-left"]||""}),l=Y(t.mobileStyle||{}),u=((c=e.computedStyle)==null?void 0:c.linkColor)||o.bodyLinkColor||"",g=u?vt(a,u):a,p=U(Rt(g))||[{text:""}];return I({type:d,data:{},attributes:s,mobileAttributes:l,children:p})}function An(t,o){var p,c,f;const e=t.paragraph||{},n=t.style||{},i=e.style||{},r=e.html||((p=t.text)==null?void 0:p.html)||"",a=i["line-height"]||((c=e.computedStyle)==null?void 0:c.paragraphSpacing)||"",d=((f=e.computedStyle)==null?void 0:f.linkColor)||o.bodyLinkColor||"",s=d?vt(r,d):r,l=O({align:i["text-align"]||"",color:i.color||"","font-family":_t(i["font-family"]),"font-size":i["font-size"]||"","font-weight":i["font-weight"]||"","letter-spacing":i["letter-spacing"]||"","line-height":a,"padding-top":n["padding-top"]||"","padding-right":n["padding-right"]||"","padding-bottom":n["padding-bottom"]||"","padding-left":n["padding-left"]||""}),u=Y(t.mobileStyle||{}),g=U(Rt(s))||[{text:""}];return I({type:m.STANDARD_PARAGRAPH,data:{},attributes:l,mobileAttributes:u,children:g})}function kn(t,o){const e=t.button||{},n=t.style||{},i=e.style||{},r=Rt(e.label||""),a=i.width&&i.width!=="auto"?i.width:"",d=O({align:n["text-align"]||"center",href:e.href||"",target:e.target||"",color:i.color||"","background-color":i["background-color"]||"","border-top":et(i["border-top"]),"border-right":et(i["border-right"]),"border-bottom":et(i["border-bottom"]),"border-left":et(i["border-left"]),"border-radius":i["border-radius"]||"","font-family":_t(i["font-family"]),"font-size":i["font-size"]||"","font-weight":i["font-weight"]||"","letter-spacing":i["letter-spacing"]||"","line-height":i["line-height"]||"","inner-padding-top":i["padding-top"]||"","inner-padding-right":i["padding-right"]||"","inner-padding-bottom":i["padding-bottom"]||"","inner-padding-left":i["padding-left"]||"","padding-top":n["padding-top"]||"","padding-right":n["padding-right"]||"","padding-bottom":n["padding-bottom"]||"","padding-left":n["padding-left"]||"",width:a}),s=Y(t.mobileStyle||{}),l=U(r)||[{text:""}];return I({type:m.STANDARD_BUTTON,data:{},attributes:d,mobileAttributes:s,children:l})}function xn(t,o){const e=t.image||{},n=t.style||{},i=t.computedStyle||{},r=i.width||n.width||e.width||"",a=Pn(r,o.columnPxWidth),d=En(i.class)||"center",s=O(F(E({src:e.src||"",alt:e.alt||"",title:e.title||"",href:e.href||"",target:e.target||"",align:d,width:a},Pt(i.class,"fullwidthOnMobile")?{"fluid-on-mobile":"true"}:{}),{"border-radius":n["border-radius"]||"","padding-top":n["padding-top"]||"","padding-right":n["padding-right"]||"","padding-bottom":n["padding-bottom"]||"","padding-left":n["padding-left"]||""})),l=Y(t.mobileStyle||{});return o.columnStacksOnMobile&&Pt(i.class,"fixedwidth")&&!Pt(i.class,"fullwidthOnMobile")&&d!=="center"&&!l.align&&(l.align="center"),I({type:m.STANDARD_IMAGE,data:{},attributes:s,mobileAttributes:l,children:[{text:""}]})}function Sn(t){var n,i,r;const o=((i=(n=t.spacer)==null?void 0:n.style)==null?void 0:i.height)||"10px",e=((r=t.mobileStyle)==null?void 0:r.height)||"";return I({type:m.STANDARD_SPACER,data:{},attributes:O({height:o}),mobileAttributes:e?{height:e}:{},children:[{text:""}]})}function Tn(t){var u;const o=((u=t.divider)==null?void 0:u.style)||{},e=t.style||{},n=ge(o["border-top"]),i=o["border-top-color"]||o.color||n.color||"",r=o["border-top-style"]||n.style||"solid",a=o["border-top-width"]||n.width||"1px",d=parseInt(o.height||"0",10)||0;if((!i||i.toLowerCase()==="transparent"||a==="0"||a==="0px")&&d>0)return I({type:m.STANDARD_SPACER,data:{},attributes:O({height:`${d}px`,"padding-top":e["padding-top"]||"","padding-right":e["padding-right"]||"","padding-bottom":e["padding-bottom"]||"","padding-left":e["padding-left"]||""}),mobileAttributes:Y(t.mobileStyle||{}),children:[{text:""}]});const l=O({"border-color":i,"border-style":r,"border-width":a,width:o.width||"100%","padding-top":e["padding-top"]||"","padding-right":e["padding-right"]||"","padding-bottom":e["padding-bottom"]||"","padding-left":e["padding-left"]||""});return I({type:m.STANDARD_DIVIDER,data:{},attributes:l,mobileAttributes:Y(t.mobileStyle||{}),children:[{text:""}]})}function ge(t){if(!t||typeof t!="string")return{width:"",style:"",color:""};const o=t.trim().split(/\s+/),e=new Set(["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset"]);let n="",i="",r="";for(const a of o)!n&&/^[\d.]+(px|em|rem|%|pt)?$/.test(a)?n=a:!i&&e.has(a.toLowerCase())?i=a:r||(r=a);return{width:n,style:i,color:r}}function wn(t){var a;const o=((a=t.iconsList)==null?void 0:a.icons)||[],e=t.style||{},n=t.computedStyle||{},i=o.map(d=>{const s=d.image||{},l=String(d.name||d.id||"").toLowerCase();return I({type:m.STANDARD_SOCIAL_ELEMENT,data:{},attributes:O({src:s.src||"",mode:"custom",href:s.href||"",name:l,alt:s.alt||l,title:s.title||l,target:s.target||"_blank"}),children:[{text:""}]})}),r=typeof n.iconsDefaultWidth=="number"?`${n.iconsDefaultWidth}px`:"";return I({type:m.STANDARD_SOCIAL,data:{},attributes:O({align:e["text-align"]||"center",mode:"horizontal","icon-size":r,"inner-padding":typeof n.padding=="string"?n.padding:"","padding-top":e["padding-top"]||"","padding-right":e["padding-right"]||"","padding-bottom":e["padding-bottom"]||"","padding-left":e["padding-left"]||""}),mobileAttributes:Y(t.mobileStyle||{}),children:i.length>0?i:[{text:""}]})}function Dn(t){var f,T;const e=(((f=t.iconsList)==null?void 0:f.icons)||[]).filter(h=>{const x=String((h==null?void 0:h.href)||"");return!/(?:^|\/\/)(?:www\.)?designedwithbeefree\.com/i.test(x)});if(e.length===0)return null;const n=t.style||{},i=t.computedStyle||{},r=parseInt(String(i.iconHeight||"0"),10)||0;if(e.length===1&&!((T=e[0])!=null&&T.text)){const h=e[0],x=parseInt(String(h.width||"0"),10)||0,A=parseInt(String(h.height||"0"),10)||0,S=r>0&&x>0&&A>0?`${Math.round(r*x/A)}px`:x>0?`${x}px`:"",_=i.iconSpacing||{};return I({type:m.STANDARD_IMAGE,data:{},attributes:O({src:h.image||"",alt:h.alt||"",title:h.title||h.alt||"",href:h.href||"",target:h.target||"_blank",align:n["text-align"]||"center",width:S,"padding-top":_["padding-top"]||n["padding-top"]||"","padding-right":_["padding-right"]||n["padding-right"]||"","padding-bottom":_["padding-bottom"]||n["padding-bottom"]||"","padding-left":_["padding-left"]||n["padding-left"]||""}),children:[{text:""}]})}const a=i.iconSpacing||{},d=a["padding-top"]||"",s=a["padding-right"]||"",l=a["padding-bottom"]||"",u=a["padding-left"]||"",g=e.map(h=>{const x=typeof h.text=="string"?h.text:"",A=parseInt(String(h.width||"0"),10)||0,S=parseInt(String(h.height||"0"),10)||0,_=r>0&&A>0&&S>0?`${Math.round(r*A/S)}px`:"",k=r>0?`${r}px`:"";return I({type:m.STANDARD_SOCIAL_ELEMENT,data:{},attributes:O(F(E(E({src:h.image||"",mode:"custom",href:h.href||"",alt:h.alt||"",title:h.title||h.alt||"",target:h.target||"_blank"},_?{"icon-size":_}:{}),k?{"icon-height":k}:{}),{"padding-top":d,"padding-right":s,"padding-bottom":l,"padding-left":u})),children:x?[{text:x}]:[{text:""}]})}),p=typeof i.iconHeight=="string"?i.iconHeight:"",c=d||s||l||u?`${d||"0px"} ${s||"0px"} ${l||"0px"} ${u||"0px"}`:"";return I({type:m.STANDARD_SOCIAL,data:{},attributes:O({align:n["text-align"]||"left",mode:"horizontal","icon-size":p,"inner-padding":c,color:n.color||"","font-family":n["font-family"]||"","font-size":n["font-size"]||"","font-weight":n["font-weight"]||"","padding-top":n["padding-top"]||"","padding-right":n["padding-right"]||"","padding-bottom":n["padding-bottom"]||"","padding-left":n["padding-left"]||""}),mobileAttributes:Y(t.mobileStyle||{}),children:g})}function Rn(t,o){var R,$;const e=t.table||{},n=e.style||{},i=e.computedStyle||{},r=t.style||{},a=((R=e.content)==null?void 0:R.rows)||[],d=(($=e.content)==null?void 0:$.headers)||[];if(a.length===0&&d.length===0)return null;const s=ge(n["border-top"]||n["border-right"]||n["border-bottom"]||n["border-left"]||""),l=s.color||"",u=s.style||"solid",g=s.width||"1px",p=!!l&&l.toLowerCase()!=="transparent",c=i.linkColor||o.bodyLinkColor||"",f=(N,P={})=>{const L=c?vt(N,c):N,v=U(Rt(L))||[{text:""}];return I({type:m.STANDARD_TABLE2_TD,data:{rowspan:1,colspan:1},attributes:O(P),children:v})},T=(N,P,L={})=>I({type:m.STANDARD_TABLE2_TR,data:{},attributes:O({"background-color":P}),children:N.map(v=>f((v==null?void 0:v.html)||"",L))}),h=[],x=i.headersBackgroundColor||"",A=i.headersColor||"",S=i.headersFontSize||"",_=i.headersFontWeight||"",k=i.headersTextAlign||"",y=[A?`color:${A}`:"",S?`font-size:${S}`:"",_?`font-weight:${_}`:"",k?`text-align:${k}`:""].filter(Boolean).join(";"),w=N=>y&&N.trim()?`<span style="${y}">${N}</span>`:N;d.forEach(N=>{const P=(N.cells||[]).map(L=>({html:w((L==null?void 0:L.html)||"")}));h.push(T(P,x))});const D=i.alternateRowBackgroundColor||"";return a.forEach((N,P)=>{const L=P%2===1?D:"";h.push(T(N.cells||[],L))}),h.length===0?null:I({type:m.STANDARD_TABLE2,data:{},attributes:O({align:n["text-align"]||"center",color:n.color||"","font-family":_t(n["font-family"]),"font-size":n["font-size"]||"","line-height":n["line-height"]||"",width:"100%","table-layout":"auto","border-color":l,"border-style":u,"border-width":g,"border-enabled":!!p,"cell-padding-top":"10px","cell-padding-right":"10px","cell-padding-bottom":"10px","cell-padding-left":"10px","padding-top":r["padding-top"]||"","padding-right":r["padding-right"]||"","padding-bottom":r["padding-bottom"]||"","padding-left":r["padding-left"]||""}),children:h})}function Cn(t){var i,r,a,d,s;const o=((i=t.html)==null?void 0:i.html)||"",e=U(o)||[{text:o}],n=I({type:m.HTML_BLOCK_NODE,data:{tagName:"div"},attributes:{},children:e});return I({type:m.STANDARD_PARAGRAPH,data:{},attributes:O({"padding-top":((r=t.style)==null?void 0:r["padding-top"])||"","padding-right":((a=t.style)==null?void 0:a["padding-right"])||"","padding-bottom":((d=t.style)==null?void 0:d["padding-bottom"])||"","padding-left":((s=t.style)==null?void 0:s["padding-left"])||""}),children:[n]})}function Nn(t,o){const e=t.list||{},n=t.style||{},i=e.style||{},r=e.computedStyle||{},a=e.html||"",d=(e.tag||"ul").toLowerCase()==="ol"?"ol":"ul",s=$n({"margin-bottom":r.liSpacing&&r.liSpacing!=="0px"?r.liSpacing:"","padding-left":r.liIndent||"","list-style-position":r.listStylePosition||""}),l=[],u=/<li[^>]*>([\s\S]*?)<\/li>/gi;let g;for(;(g=u.exec(a))!==null;)l.push(g[1]);l.length===0&&l.push(a);const p=l.map(T=>{const h=U(T)||[{text:T}];return I({type:m.HTML_BLOCK_NODE,data:{tagName:"li"},attributes:O({style:s}),children:h})}),c=I({type:m.HTML_BLOCK_NODE,data:{tagName:d},attributes:O({style:"margin:0;padding:0 0 0 1.25em"}),children:p}),f=O({align:i["text-align"]||"",color:i.color||"","font-family":_t(i["font-family"]),"font-size":i["font-size"]||"","font-weight":i["font-weight"]||"","letter-spacing":i["letter-spacing"]||"","line-height":i["line-height"]||"","padding-top":n["padding-top"]||"","padding-right":n["padding-right"]||"","padding-bottom":n["padding-bottom"]||"","padding-left":n["padding-left"]||""});return I({type:m.STANDARD_PARAGRAPH,data:{},attributes:f,mobileAttributes:Y(t.mobileStyle||{}),children:[c]})}function ue(t){if(!t)return{};const o={},e=["padding-top","padding-right","padding-bottom","padding-left","font-size"];for(const n of e)t[n]&&(o[n]=t[n]);return t["text-align"]&&(o.align=t["text-align"]),o}function et(t){if(!t||typeof t!="string")return"";const o=t.trim().toLowerCase();return!o||o.startsWith("0px")||o.startsWith("0 ")||o.includes("transparent")?"":t}function mt(t){if(!t||typeof t!="string")return"";const o=t.trim();if(!o||o==="none")return"";const e=/^url\((['"]?)([^)]+?)\1\)$/.exec(o);return e?e[2]:""}function vt(t,o){return!t||!o?t:t.replace(/<a\b([^>]*)>/gi,(e,n)=>{if(/\bcolor\s*:/i.test(n))return e;const i=/\bstyle\s*=\s*"([^"]*)"/i.exec(n);if(i){const r=i[1].trim(),a=r&&!r.endsWith(";")?";":"",d=`${r}${a}color:${o};`;return`<a${n.replace(/\bstyle\s*=\s*"[^"]*"/i,`style="${d}"`)}>`}return`<a${n} style="color:${o};">`})}function En(t){if(!t||typeof t!="string")return"";const o=t.toLowerCase().split(/\s+/);return o.includes("left")?"left":o.includes("right")?"right":o.includes("center")?"center":""}function Pt(t,o){return!t||typeof t!="string"?!1:t.split(/\s+/).includes(o)}function $n(t){const o=[];for(const[e,n]of Object.entries(t))n&&o.push(`${e}:${n}`);return o.join(";")}function Rt(t){return t.replace(/<span class="tinyMce-placeholder">/g,"<span>").replace(/<div class="txtTinyMce-wrapper"[^>]*>/g,"<div>")}function _t(t,o){return!t||t==="inherit"?"":t}function Y(t){const o={};for(const[e,n]of Object.entries(t))n&&(e==="padding-top"||e==="padding-right"||e==="padding-bottom"||e==="padding-left"||e==="font-size"||e==="text-align")&&(e==="text-align"?o.align=n:o[e]=n);return o}function Pn(t,o){if(!t)return"";const e=String(t).trim(),n=/^(-?\d+(?:\.\d+)?)%$/.exec(e);if(n)return`${Math.max(1,Math.round(parseFloat(n[1])/100*o))}px`;const i=/^(-?\d+(?:\.\d+)?)(?:px)?$/.exec(e);return i?`${i[1]}px`:e}function O(t){const o={};for(const e of Object.keys(t)){const n=t[e];n===""||n==null||(o[e]=n)}return o}function I(t){return t!=null&&t.mobileAttributes&&typeof t.mobileAttributes=="object"&&Object.keys(t.mobileAttributes).length===0&&delete t.mobileAttributes,t}const Z={Text:0,Image:1,Button:2,Social:3,Split:4,Table:5,Product:6,Spacer:7,DropShadow:8,HorizontalRule:9,Header:10,Review:11,Video:13,Coupon:14},Ln={0:"Text",1:"Image",2:"Button",3:"Social",4:"Split",5:"Table",6:"Product",7:"Spacer",8:"DropShadow",9:"HorizontalRule",10:"Header",11:"Review",13:"Video",14:"Coupon"},On=600;function In(t){var h,x,A,S,_;const o=[],e=Bn(t);if(!e)throw new Error("klaviyoToEasyEmailPro: input has no { body: { sections } } — pass the template `.data`, not the outer entry");const n=((h=e.body)==null?void 0:h.attributes)||{},i=Yn((x=n.width)!=null?x:n.content_width,On),r=xt(n.background_color,n.bg_color,""),a=e.styles||[],d=((A=a.find(k=>(k==null?void 0:k.style_type)===200))==null?void 0:A.attributes)||{},s=((S=a.find(k=>(k==null?void 0:k.style_type)===300))==null?void 0:S.attributes)||{},l=xt(d.font_family),u=xt(d.color),g=xt(s.color),p={contentWidthPx:i,warnings:o,globalParagraphStyle:d},f=(((_=e.body)==null?void 0:_.sections)||[]).slice().sort(it).flatMap(k=>Mn(k,p));return{page:{type:m.PAGE,data:{breakpoint:i>700?"768px":"600px",globalAttributes:z({"font-family":l}),categoryAttributes:{},blockAttributes:{},classAttributes:{},preheader:""},attributes:z(E({width:`${i}px`,"background-color":r,"content-background-color":"","margin-top":"0px","margin-bottom":"0px","link-color":g},u?{color:u}:{})),children:f},warnings:o}}function Bn(t){var o,e,n;return t?(o=t.body)!=null&&o.sections?t:(n=(e=t.data)==null?void 0:e.body)!=null&&n.sections?t.data:null:null}function Mn(t,o){var l,u,g;const e=((l=t.data)==null?void 0:l.rows)||[];if(e.length===0)return[];const n=E({},((u=t.data)==null?void 0:u.attributes)||{});let i=!1,r;const d=e.flatMap(p=>{var c;return(((c=p.data)==null?void 0:c.columns)||[]).flatMap(f=>{var T;return((T=f.data)==null?void 0:T.blocks)||[]})}).filter(p=>{var c;return((c=p.data)==null?void 0:c.block_type)!==Z.Spacer});if(d.length===1){const p=((g=d[0].data)==null?void 0:g.attributes)||{};n.background_color==null&&p.block_background_color!=null&&(r=b(n.background_color,n.content_color),n.background_color=p.block_background_color,i=!0),n.inner_padding_top==null&&p.block_padding_top!=null&&(n.inner_padding_top=p.block_padding_top,i=!0),n.inner_padding_right==null&&p.block_padding_right!=null&&(n.inner_padding_right=p.block_padding_right,i=!0),n.inner_padding_bottom==null&&p.block_padding_bottom!=null&&(n.inner_padding_bottom=p.block_padding_bottom,i=!0),n.inner_padding_left==null&&p.block_padding_left!=null&&(n.inner_padding_left=p.block_padding_left,i=!0)}const s=F(E({},o),{sectionAttrs:n,hoistedToSection:i,originalSectionBg:r});return e.slice().sort(it).flatMap(p=>Hn(p,s))}function Hn(t,o){var p;const e=(((p=t.data)==null?void 0:p.columns)||[]).slice().sort(it);if(e.length===0)return[];const n=o.sectionAttrs||{},i=b(n.background_url),r=b(n.background_color,n.content_color),a=b(n.background_format),d=n.background_repeat===!1?"no-repeat":n.background_repeat===!0?"repeat":"",s=b(n.background_position),l=z(F(E({"background-color":r,"background-url":i,"background-position":s,"background-repeat":d,"background-size":a==="cover"?"cover":a==="contain"?"contain":""},i?{"background-image-enabled":"true"}:{}),{"padding-top":C(n.inner_padding_top)||"0px","padding-right":C(n.inner_padding_right)||"0px","padding-bottom":C(n.inner_padding_bottom)||"0px","padding-left":C(n.inner_padding_left)||"0px"})),u={type:m.STANDARD_SECTION,data:{},attributes:l,children:[]},g=e.map(c=>Wn(c,o));if(e.length===1)u.children=g;else{const c={type:m.STANDARD_GROUP,data:{},attributes:{},children:g};u.children=[c]}return[u]}function Wn(t,o){var i;const n=(((i=t.data)==null?void 0:i.blocks)||[]).slice().sort(it).flatMap(r=>zn(r,o));return{type:m.STANDARD_COLUMN,data:{},attributes:{},children:n}}function zn(t,o){var n;const e=(n=t.data)==null?void 0:n.block_type;switch(e){case Z.Text:return vn(t,o);case Z.Spacer:return Fn(t,o);case Z.HorizontalRule:return Jn(t,o);case Z.Image:return Gn(t,o);case Z.Button:return Un(t,o);case Z.Social:return jn(t,o);case Z.Header:return Zn(t,o);case Z.Split:return qn(t,o);case Z.Table:return Vn(t);default:{const i=Ln[e]||`Unknown(${e})`;return o.warnings.push(`block:${i}`),[fe(`[TODO Klaviyo block_type=${e} (${i})]`)]}}}function vn(t,o){var P;const e=ot(t,o),n=(((P=t.data)==null?void 0:P.content)||"").trim();if(!n)return[];const i=(L,v)=>{var X;return(X=e[L])!=null?X:v?e[v]:void 0},r=nt(i("block_padding_top","block-padding-top"),i("inner_padding_top","inner-padding-top")),a=nt(i("block_padding_right","block-padding-right"),i("inner_padding_right","inner-padding-right")),d=nt(i("block_padding_bottom","block-padding-bottom"),i("inner_padding_bottom","inner-padding-bottom")),s=nt(i("block_padding_left","block-padding-left"),i("inner_padding_left","inner-padding-left")),l=to(n),u=b(i("text_align","text-align"),l.styles["text-align"]),g=b(i("color"),l.styles.color),p=b(i("font_family","font-family"),l.styles["font-family"]),c=b(i("font_size","font-size"),l.styles["font-size"]),f=o.globalParagraphStyle||{},T=b(i("line_height","line-height"),l.styles["line-height"],f.line_height),h=b(i("letter_spacing","letter-spacing"),l.styles["letter-spacing"]),x=b(i("font_weight","font-weight"),l.styles["font-weight"]),A=b(i("font_style","font-style"),l.styles["font-style"]),S=b(i("block_background_color"),i("background_color")),_=b(i("block_border_width")),k=b(i("block_border_color")),y=b(i("block_border_style")),w=l.tag||Qn(n),D=w==="h1"?m.STANDARD_H1:w==="h2"?m.STANDARD_H2:w==="h3"?m.STANDARD_H3:m.STANDARD_PARAGRAPH,R=z({align:u,color:g,"font-family":p,"font-size":G(c),"font-weight":x,"font-style":A,"letter-spacing":G(h),"line-height":T,padding:"0px","padding-top":r||"0px","padding-right":a||"0px","padding-bottom":d||"0px","padding-left":s||"0px","container-background-color":S,border:_&&y&&k?`${G(_)} ${y} ${k}`:""}),N=(n.match(/<p[\s>]/gi)||[]).length>1?[{text:n}]:U(n)||[{text:Ft(n)}];return[{type:D,data:{},attributes:R,children:N}]}function Fn(t,o){const e=ot(t,o),n=rt(e.height),i=b(e.background_color)||(o.hoistedToSection?o.originalSectionBg||"transparent":"");return[{type:m.STANDARD_SPACER,data:{},attributes:z({height:`${n!=null?n:30}px`,"container-background-color":i}),children:[{text:""}]}]}function Gn(t,o){const e=ot(t,o),n=b(e.cropped_src,e.src);if(!n)return[];const i=(h,x)=>{var A;return(A=e[h])!=null?A:x?e[x]:void 0},r=b(e.max_width),a=b(e.align)||"center",d=nt(i("block_padding_top","block-padding-top"),i("inner_padding_top","inner-padding-top")),s=nt(i("block_padding_right","block-padding-right"),i("inner_padding_right","inner-padding-right")),l=nt(i("block_padding_bottom","block-padding-bottom"),i("inner_padding_bottom","inner-padding-bottom")),u=nt(i("block_padding_left","block-padding-left"),i("inner_padding_left","inner-padding-left")),g=b(i("border_width")),p=b(i("border_color")),c=b(i("border_style")),f=e.full_width_mobile===!0||e.mobile_stretch_content===!0,T=z(E({src:n,alt:b(e.alt_text),href:b(e.href),align:a,width:r?G(r):"",padding:"0px","padding-top":d||"0px","padding-right":s||"0px","padding-bottom":l||"0px","padding-left":u||"0px","container-background-color":b(e.block_background_color,e.background_color),border:g&&c&&p?`${G(g)} ${c} ${p}`:""},f?{"fluid-on-mobile":"true"}:{}));return[{type:m.STANDARD_IMAGE,data:{},attributes:T,children:[{text:""}]}]}function Un(t,o){var c;const e=ot(t,o),n=(((c=t.data)==null?void 0:c.content)||"").trim(),i=(f,T)=>{var h;return(h=e[f])!=null?h:T?e[T]:void 0},r=b(i("border_width")),a=b(i("border_color")),d=b(i("border_style")),s=r&&d&&a?`${G(r)} ${d} ${a}`:"",l=b(i("font_style")),u=e.stretch===!0,g=z({align:b(i("text_align","text-align"))||"center",href:b(i("href")),color:b(i("color")),"background-color":b(i("background_color")),"border-radius":C(i("border_radius")),border:s,"font-family":b(i("font_family","font-family")),"font-size":G(b(i("font_size","font-size"))),"font-weight":b(i("font_weight","font-weight")),"font-style":l,"line-height":"100%","letter-spacing":G(b(i("letter_spacing","letter-spacing"))),"text-decoration":b(i("text_decoration","text-decoration")),"inner-padding-top":C(i("inner_padding_top","inner-padding-top")),"inner-padding-right":C(i("inner_padding_right","inner-padding-right")),"inner-padding-bottom":C(i("inner_padding_bottom","inner-padding-bottom")),"inner-padding-left":C(i("inner_padding_left","inner-padding-left")),padding:"0px","padding-top":C(i("block_padding_top","block-padding-top"))||"0px","padding-right":C(i("block_padding_right","block-padding-right"))||"0px","padding-bottom":C(i("block_padding_bottom","block-padding-bottom"))||"0px","padding-left":C(i("block_padding_left","block-padding-left"))||"0px","container-background-color":b(i("block_background_color")),width:u?"100%":""}),p=U(n)||[{text:n}];return[{type:m.STANDARD_BUTTON,data:{},attributes:g,children:p}]}function jn(t,o){var s;const e=ot(t,o),n=(l,u)=>{var g;return(g=e[l])!=null?g:u?e[u]:void 0},r=(((s=t.data)==null?void 0:s.sub_blocks)||[]).slice().sort(it).filter(l=>l.block_type===2).map(l=>{const u=l.attributes||{},g=b(u.type).toLowerCase(),p=b(u.link_url,u["link-url"]),c=b(u.text),f=b(u.icon_url);return{type:m.STANDARD_SOCIAL_ELEMENT,data:{},attributes:z(F(E({name:g},f?{mode:"custom",src:f}:{}),{href:p,alt:c||g,title:c||g,target:p?"_blank":""})),children:[{text:""}]}});if(r.length===0)return[];const a=rt(n("spacing")),d=a!=null?`0px ${a}px`:"";return[{type:m.STANDARD_SOCIAL,data:{},attributes:z({align:b(n("align"))||"center",mode:e.stack_on_mobile===!0?"vertical":"horizontal","icon-size":G(b(n("size"))),"inner-padding":d,"padding-top":C(n("block_padding_top","block-padding-top")),"padding-right":C(n("block_padding_right","block-padding-right")),"padding-bottom":C(n("block_padding_bottom","block-padding-bottom")),"padding-left":C(n("block_padding_left","block-padding-left")),"container-background-color":b(n("block_background_color"))}),children:r}]}function Vn(t,o){var _,k;const e=((_=t.data)==null?void 0:_.attributes)||{},n=(((k=t.data)==null?void 0:k.sub_blocks)||[]).slice().sort(it);if(n.length===0)return[];const i=(y,w)=>{var D;return(D=e[y])!=null?D:w?e[w]:void 0},r=rt(i("static_num_columns"))||n.length,a=Math.max(1,Math.floor(r)),d=e.headers_enabled===!0,s=n.map(y=>Kn(y)),l=[];for(let y=0;y<s.length;y+=a)l.push(s.slice(y,y+a));const u=b(i("table_background_color")),g=C(i("cell_padding_top"))||"10px",p=C(i("cell_padding_right"))||"10px",c=C(i("cell_padding_bottom"))||"10px",f=C(i("cell_padding_left"))||"10px",T=b(i("block_border_width")),h=b(i("block_border_color")),x=b(i("block_border_style")),A=!!T&&!!h,S=l.map((y,w)=>{const D=d&&w===0;return{type:m.STANDARD_TABLE2_TR,data:{},attributes:z({"background-color":D?u:""}),children:y.map(R=>Xn(R))}});return[{type:m.STANDARD_TABLE2,data:{},attributes:z({align:"center",width:"100%","table-layout":"auto","border-color":h,"border-style":x||"solid","border-width":G(T)||"1px","border-enabled":!!A,"cell-padding-top":g,"cell-padding-right":p,"cell-padding-bottom":c,"cell-padding-left":f,"padding-top":C(i("block_padding_top","block-padding-top")),"padding-right":C(i("block_padding_right","block-padding-right")),"padding-bottom":C(i("block_padding_bottom","block-padding-bottom")),"padding-left":C(i("block_padding_left","block-padding-left")),"container-background-color":b(i("block_background_color"))}),children:S}]}function Kn(t){const o=t.attributes||{};if(t.block_type===6){const e=b(o.cropped_src,o.src);if(!e)return"";const n=b(o.image_width,o.width),i=b(o.image_align),r=b(o.href),a=[];n&&a.push(`width:${G(n)}`),a.push("display:block"),i==="center"?a.push("margin:0 auto"):i==="right"&&a.push("margin-left:auto");const d=` style="${a.join(";")}"`,s=`<img src="${e}" alt="${Bt(b(o.alt))}"${d}>`;return r?`<a href="${r}">${s}</a>`:s}return(t.content||"").trim()}function Xn(t){const o=U(t)||[{text:Ft(t)||""}];return{type:m.STANDARD_TABLE2_TD,data:{rowspan:1,colspan:1},attributes:{},children:o}}function qn(t,o){var x,A;const e=ot(t,o),n=(((x=t.data)==null?void 0:x.sub_blocks)||[]).slice().sort(it);if(n.length===0)return[];const i=(S,_)=>{var k;return(k=e[S])!=null?k:_?e[_]:void 0},r=b(i("block_background_color")),a=C(i("block_padding_top","block-padding-top")),d=C(i("block_padding_bottom","block-padding-bottom")),s=C(i("block_padding_left","block-padding-left")),l=C(i("block_padding_right","block-padding-right")),u=(A=rt(i("padding_in_between")))!=null?A:0,g=(()=>{const _=b(i("column_widths")).match(/^(\d+(?:\.\d+)?)%$/);return _?parseFloat(_[1]):null})(),p=S=>{const _=S.attributes||{};if(S.block_type===6){const k=b(_.cropped_src,_.src);if(!k)return null;const y=b(_.image_width,_.width),w=y?` width="${parseInt(y,10)||y}"`:"",D=Bt(b(_.alt,_.alt_text));return`<img src="${Bt(k)}" alt="${D}"${w} style="display:block;max-width:100%;border:0;">`}return S.block_type===5||S.block_type===7?(S.content||"").trim():null};if(n.length===1){const S=n[0],_=S.attributes||{};if(S.block_type===6){const y=b(_.cropped_src,_.src);return y?[{type:m.STANDARD_IMAGE,data:{},attributes:z({src:y,alt:b(_.alt,_.alt_text),href:b(_.href,_.link_url),align:b(_.image_align)||"center",width:b(_.image_width,_.width)?G(b(_.image_width,_.width)):"",padding:"0px","padding-top":a||"0px","padding-right":l||"0px","padding-bottom":d||"0px","padding-left":s||"0px","container-background-color":r}),children:[{text:""}]}]:[]}const k=(S.content||"").trim();return k?[{type:m.STANDARD_PARAGRAPH,data:{},attributes:z({padding:"0px","padding-top":a||"0px","padding-right":l||"0px","padding-bottom":d||"0px","padding-left":s||"0px","container-background-color":r}),children:U(k)||[{text:Ft(k)}]}]:[]}const c=(()=>{if(g!=null&&n.length===2)return[g,100-g];const S=(100/n.length).toFixed(2);return n.map(()=>parseFloat(S))})(),T=`<table role="presentation" cellspacing="0" cellpadding="0" border="0" style="width:100%;border-collapse:collapse"><tr>${n.map((S,_)=>{const k=p(S);if(k==null)return"";const y=c[_]!=null?`width:${c[_]}%;`:"",D=!(_===n.length-1)&&u>0?`padding-right:${u/2}px;`:"",R=_>0&&u>0?`padding-left:${u/2}px;`:"";return`<td valign="top" style="${y}${D}${R}">${k}</td>`}).join("")}</tr></table>`,h=[{type:m.HTML_BLOCK_NODE,data:{tagName:"div"},attributes:{},children:[{text:T}]}];return[{type:m.STANDARD_PARAGRAPH,data:{},attributes:z({padding:"0px","padding-top":a||"0px","padding-right":l||"0px","padding-bottom":d||"0px","padding-left":s||"0px","container-background-color":r}),children:h}]}function Zn(t,o){var _;const e=ot(t,o),n=(((_=t.data)==null?void 0:_.sub_blocks)||[]).slice().sort(it),i=(k,y)=>{var w;return(w=e[k])!=null?w:y?e[y]:void 0},r=b(i("block_background_color")),a=C(i("block_padding_top","block-padding-top")),d=C(i("block_padding_right","block-padding-right")),s=C(i("block_padding_bottom","block-padding-bottom")),l=C(i("block_padding_left","block-padding-left")),u=b(i("color")),g=b(i("font_family","font-family")),p=G(b(i("font_size","font-size"))),c=b(i("font_weight","font-weight")),f=b(i("font_style","font-style")),T=G(b(i("letter_spacing","letter-spacing"))),h=b(i("text_decoration","text-decoration")),x=C(i("logo_link_spacing")),A=[];for(const k of n){const y=k.attributes||{};if(k.block_type===10||k.block_type===12){const w=b(y.src);if(!w)continue;const D=b(y.width),R=b(y.height);A.push({type:m.STANDARD_IMAGE,data:{},attributes:z({src:w,alt:b(y.alt_text,y.alt),href:b(y.link_url,y["link-url"],y.href),align:b(i("logo_align"))||"center",width:D?G(D):"",height:R?G(R):"",padding:"0px","padding-top":a||"0px","padding-right":d||"0px","padding-bottom":x||"0px","padding-left":l||"0px","container-background-color":r}),children:[{text:""}]})}}const S=n.filter(k=>k.block_type===11);if(S.length>0){const k=z({color:u,"font-family":g,"font-size":p,"font-weight":c,"font-style":f,"letter-spacing":T,"line-height":"100%","text-decoration":h||"none","text-transform":"none","padding-top":"10px","padding-right":"10px","padding-bottom":"10px","padding-left":"10px"}),y=S.map(w=>{const D=b((w.attributes||{}).text,w.content),R=b((w.attributes||{}).link_url,(w.attributes||{})["link-url"]);return{type:m.STANDARD_NAVBAR_LINK,data:{},attributes:z(E({href:R,target:R?"_blank":""},k)),children:[{text:D}]}});A.push({type:m.STANDARD_NAVBAR,data:{},attributes:z({align:b(i("item_align"))||"center","padding-top":"0px","padding-right":d,"padding-bottom":s,"padding-left":l,"container-background-color":r}),children:y})}return A.length===0?[fe("[TODO Klaviyo Header (no recognized sub_blocks)]")]:A}function Jn(t,o){const e=ot(t,o),n=(i,r)=>{var a;return(a=e[i])!=null?a:r?e[r]:void 0};return[{type:m.STANDARD_DIVIDER,data:{},attributes:z({"border-color":b(n("border_color")),"border-style":b(n("border_style"))||"solid","border-width":G(b(n("border_width"))||"1"),width:"100%",padding:"0px","padding-top":C(n("block_padding_top","block-padding-top"))||"0px","padding-right":C(n("block_padding_right","block-padding-right"))||"0px","padding-bottom":C(n("block_padding_bottom","block-padding-bottom"))||"0px","padding-left":C(n("block_padding_left","block-padding-left"))||"0px","container-background-color":b(n("block_background_color"))}),children:[{text:""}]}]}function ot(t,o){var n;const e=E({},((n=t.data)==null?void 0:n.attributes)||{});return o.hoistedToSection&&(delete e.block_background_color,delete e.block_padding_top,delete e.block_padding_right,delete e.block_padding_bottom,delete e.block_padding_left,delete e["block-padding-top"],delete e["block-padding-right"],delete e["block-padding-bottom"],delete e["block-padding-left"]),e}function fe(t){return{type:m.STANDARD_PARAGRAPH,data:{},attributes:{color:"#888888","font-size":"12px"},children:[{text:t}]}}function it(t,o){var e,n;return((e=t.position)!=null?e:0)-((n=o.position)!=null?n:0)}function Yn(t,o){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"){const e=parseInt(t,10);if(Number.isFinite(e)&&e>0)return e}return o}function xt(...t){for(const o of t)if(typeof o=="string"&&o.length>0)return o;return""}function z(t){const o={};for(const e of Object.keys(t))t[e]!==""&&t[e]!=null&&(o[e]=t[e]);return o}function b(...t){for(const o of t){if(typeof o=="string"&&o.length>0)return o;if(typeof o=="number"&&Number.isFinite(o))return String(o)}return""}function nt(t,o){const e=rt(t),n=rt(o);return e==null&&n==null?"":`${(e||0)+(n||0)}px`}function rt(t){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"){const o=t.match(/^(-?\d+(?:\.\d+)?)/);if(o)return parseFloat(o[1])}return null}function G(t){return t?/^\d+(?:\.\d+)?$/.test(t)?`${t}px`:t:""}function C(t){const o=rt(t);return o==null?"":`${o}px`}function Qn(t){const o=t.match(/<\s*(h1|h2|h3|p|div)\b/i);return o?o[1].toLowerCase():"p"}function to(t){const o=t.match(/^\s*<(p|h[1-6]|div)\b([^>]*)>([\s\S]*?)<\/\1>\s*$/i);if(!o)return{tag:"",styles:{}};const e=o[1].toLowerCase(),i=o[2].match(/style\s*=\s*"([^"]*)"/i),r={};if(i)for(const a of i[1].split(";")){const d=a.indexOf(":");if(d<0)continue;const s=a.slice(0,d).trim().toLowerCase(),l=a.slice(d+1).trim();s&&l&&(r[s]=l)}return{tag:e,styles:r}}function Ft(t){return t.replace(/<[^>]*>/g,"")}function Bt(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}exports.beefreeToEasyEmailPro=un;exports.htmlToTextNodes=U;exports.klaviyoToEasyEmailPro=In;exports.unlayerToEasyEmailPro=Ne;
1
+ "use strict";var ye=Object.defineProperty,_e=Object.defineProperties;var Ae=Object.getOwnPropertyDescriptors;var Ut=Object.getOwnPropertySymbols;var ke=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable;var jt=(t,n,e)=>n in t?ye(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e,N=(t,n)=>{for(var e in n||(n={}))ke.call(n,e)&&jt(t,e,n[e]);if(Ut)for(var e of Ut(n))xe.call(n,e)&&jt(t,e,n[e]);return t},z=(t,n)=>_e(t,Ae(n));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Se=require("he"),Lt={PAGE:"page",SECTION:"section",COLUMN:"column",GROUP:"group",TEXT:"text",IMAGE:"image",DIVIDER:"divider",SPACER:"spacer",BUTTON:"button",WRAPPER:"wrapper",RAW:"raw",HERO:"hero",CAROUSEL:"carousel",NAVBAR:"navbar",NAVBAR_LINK:"navbar-link",SOCIAL:"social",SOCIAL_ELEMENT:"social-element",MERGETAG:"mergetag",LINE_BREAK:"line-break",PLACEHOLDER:"placeholder",TABLE:"table",DANGEROUS_CODE:"dangerous-code",HTML_NODE:"html-node",HTML_BLOCK_NODE:"html-block-node",HTML_DOM_NODE:"html-dom-node",CONTENT_WIDGET:"content_widget",SECTION_WIDGET:"section_widget",WRAPPER_WIDGET:"wrapper_widget",PAGE_HEADER:"page-header",PAGE_FOOTER:"page-footer"},Te={STANDARD_HERO:"standard-hero",STANDARD_WRAPPER:"standard-wrapper",STANDARD_SECTION:"standard-section",STANDARD_GROUP:"standard-group",STANDARD_COLUMN:"standard-column",STANDARD_IMAGE:"standard-image",STANDARD_DIVIDER:"standard-divider",STANDARD_SPACER:"standard-spacer",STANDARD_NAVBAR:"standard-navbar",STANDARD_NAVBAR_LINK:"standard-navbar-link",STANDARD_SOCIAL:"standard-social",STANDARD_SOCIAL_ELEMENT:"standard-social-element",STANDARD_BUTTON:"standard-button",STANDARD_TEXT:"standard-text",STANDARD_PARAGRAPH:"standard-paragraph",STANDARD_H1:"standard-h1",STANDARD_H2:"standard-h2",STANDARD_H3:"standard-h3",STANDARD_H4:"standard-h4",STANDARD_TABLE:"standard-table",STANDARD_TEXT_LIST:"standard-text-list",STANDARD_TEXT_LIST_ITEM:"standard-text-list-item",STANDARD_BLOCK_QUOTE:"standard-blockquote",STANDARD_TABLE2:"standard-table2",STANDARD_TABLE2_TR:"standard-table2-tr",STANDARD_TABLE2_TD:"standard-table2-td"},we={FOR_EACH:"logic-for-each",SHOW:"logic-show"},m=N(N(N({},Lt),Te),we),ne={PAGE:"page",RAW:"raw",HERO:"hero",WRAPPER:"wrapper",SECTION:"section",COLUMN:"column",GROUP:"group",TEXT:"text",TABLE:"table",BUTTON:"button",IMAGE:"image",DIVIDER:"divider",NAVBAR:"navbar",NAVBAR_LINK:"navbar-link",SOCIAL:"social",SOCIAL_ELEMENT:"social-element",SPACER:"spacer",TEXT_LIST:"text-list",TEXT_LIST_ITEM:"text-list-item",INLINE_TEXT:"inline-text",BLOCK_NODE:"block-node",DANGEROUS_CODE:"dangerous_code",UNKNOWN_CONTENT:"unknown-content ",AMP_BLOCK:"amp-block",UNSET:"unset",UNSET_RENDER:"unset-render",TABLE2_TR:"table2-tr",TABLE2_TD:"table2-td",PAGE_HEADER:"page-header",PAGE_FOOTER:"page-footer"};function Tt(t){if(!t||typeof t!="string")return null;const n=t.trim().split(/\s+/).filter(Boolean);if(n.length===0)return null;let e,o,i,r;return n.length===1?e=o=i=r=n[0]:n.length===2?(e=i=n[0],o=r=n[1]):n.length===3?(e=n[0],o=r=n[1],i=n[2]):(e=n[0],o=n[1],i=n[2],r=n[3]),{top:e,right:o,bottom:i,left:r}}function J(t,n="padding"){const e=t[n];if(!e)return t;const o=Tt(e);if(!o)return delete t[n],t;const i={top:`${n}-top`,right:`${n}-right`,bottom:`${n}-bottom`,left:`${n}-left`};return t[i.top]==null&&(t[i.top]=o.top),t[i.right]==null&&(t[i.right]=o.right),t[i.bottom]==null&&(t[i.bottom]=o.bottom),t[i.left]==null&&(t[i.left]=o.left),delete t[n],t}function oe(t){return Se.decode(t)}function De(t){var i,r,a;const n={},e=/([a-zA-Z_:][-\w:.]*)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g;let o;for(;(o=e.exec(t))!==null;)n[o[1].toLowerCase()]=oe((a=(r=(i=o[2])!=null?i:o[3])!=null?r:o[4])!=null?a:"");return n}function Re(t){const n={};return t.split(";").forEach(e=>{const o=e.indexOf(":");if(o<0)return;const i=e.slice(0,o).trim().toLowerCase(),r=e.slice(o+1).trim();r&&(i==="color"?n.color=r:i==="font-size"?n.fontSize=r:i==="font-family"?n.fontFamily=r:i==="line-height"?n.lineHeight=r:i==="font-weight"&&/^(bold|[6-9]\d{2})$/.test(r)?n.bold=!0:i==="font-style"&&r==="italic"?n.italic=!0:i==="text-decoration"&&/underline/.test(r)?n.underline=!0:i==="text-decoration"&&/line-through/.test(r)&&(n.strikethrough=!0))}),n}const Ce=new Set(["br","img","hr","input","meta","link"]),Vt=new Set(["p","div","h1","h2","h3","h4","h5","h6","li"]);function Ee(t){const n=[],e=/<!--[\s\S]*?-->|<\/([a-zA-Z][\w-]*)\s*>|<([a-zA-Z][\w-]*)([^>]*?)\/?\s*>/g;let o=0,i;for(;(i=e.exec(t))!==null;)if(i.index>o&&n.push({kind:"text",text:t.slice(o,i.index)}),o=i.index+i[0].length,!i[0].startsWith("<!--")){if(i[1])n.push({kind:"close",name:i[1].toLowerCase()});else if(i[2]){const r=i[2].toLowerCase(),a=De(i[3]||""),l=i[0].endsWith("/>")||Ce.has(r);n.push({kind:"open",name:r,attrs:a,selfClose:l})}}return o<t.length&&n.push({kind:"text",text:t.slice(o)}),n}function j(t){if(!t)return[{text:""}];const n=Ee(t),e=[{}],o=[];let i=0;const r=()=>e[e.length-1],a=g=>{if(!g)return;const c={text:g},p=r();p.bold&&(c.bold=!0),p.italic&&(c.italic=!0),p.underline&&(c.underline=!0),p.strikethrough&&(c.strikethrough=!0),p.color&&(c.color=p.color),p.fontSize&&(c.fontSize=p.fontSize),p.fontFamily&&(c.fontFamily=p.fontFamily),p.lineHeight&&(c.lineHeight=p.lineHeight),p.link&&(c.link={href:p.link.href,blank:p.link.blank}),o.push(c)},l=()=>{o.push({type:Lt.LINE_BREAK,data:{},attributes:{},children:[{text:""}]})},s=()=>{const g=o[o.length-1];return!!g&&"type"in g&&g.type===Lt.LINE_BREAK},d=()=>{if(i>0&&o.length>0)for(let g=0;g<i;g++)l();i=0},u=g=>!!g&&g.kind==="open"&&!g.selfClose&&!Vt.has(g.name);for(let g=0;g<n.length;g++){const c=n[g];if(c.kind==="text"){const p=oe(c.text);if(i>0&&!p.trim())continue;let f=p.replace(/\s+/g," ");if(!f)continue;f.endsWith(" ")&&u(n[g+1])&&(f+="​"),d(),a(f)}else if(c.kind==="open"){const{name:p,attrs:f,selfClose:T}=c;if(p==="br"){d(),l();continue}const h=z(N({},r()),{tag:p});if(p==="strong"||p==="b"?h.bold=!0:p==="em"||p==="i"?h.italic=!0:p==="u"?h.underline=!0:p==="s"||p==="strike"||p==="del"?h.strikethrough=!0:p==="a"&&f.href&&(h.link={href:f.href,blank:(f.target||"").toLowerCase()==="_blank"}),f.style&&Object.assign(h,Re(f.style)),T)continue;e.push(h)}else{const p=e.findLastIndex(f=>f.tag===c.name);p>0&&(e.splice(p),Vt.has(c.name)&&!s()&&(i+=1))}}return o.length===0?[{text:""}]:o}function Ne(t,n={}){var f,T,h,S;const e=[],o=Pe(t,(f=n.pageIndex)!=null?f:0);if(!o)throw new Error("unlayerToEasyEmailPro: could not find a design with body.rows in the input");const i=o.body,r=(i==null?void 0:i.values)||{},a=typeof r.contentWidth=="number"?r.contentWidth:parseInt(String(r.contentWidth||""),10)||600,l=`${a}px`,s={};(T=r.fontFamily)!=null&&T.value&&(s["font-family"]=r.fontFamily.value);const d={};r.textColor&&(d[ne.TEXT]={color:r.textColor});const u=tn(i,r.fontFamily),g=480,c=((i==null?void 0:i.rows)||[]).flatMap(k=>{var x,_;return Le(k,{contentWidthPx:a,columnPxWidth:a,bodyLinkColor:((x=r.linkStyle)==null?void 0:x.linkColor)||"",bodyFontFamily:((_=r.fontFamily)==null?void 0:_.value)||"",templateUsesFullWidth:$e((i==null?void 0:i.rows)||[],a),warnings:e})});return{page:{type:m.PAGE,data:N({breakpoint:`${g}px`,globalAttributes:s,categoryAttributes:d,blockAttributes:{},classAttributes:{},preheader:r.preheaderText||""},u.length>0?{fonts:u}:{}),attributes:M({width:l,"background-color":r.backgroundColor||"","content-background-color":"","margin-top":"0px","margin-bottom":"0px","link-color":((h=r.linkStyle)==null?void 0:h.linkColor)||"","link-text-decoration":(S=r.linkStyle)!=null&&S.linkUnderline?"underline":""}),children:c},warnings:e}}function $e(t,n){for(const e of t){const i=((e==null?void 0:e.values)||{}).backgroundImage;if((i==null?void 0:i.fullWidth)===!0&&typeof i.width=="number"&&i.width>n)return!0}return!1}function Pe(t,n){var e,o,i,r,a,l,s,d,u,g,c;if(!t)return null;if((e=t.body)!=null&&e.rows)return t;if((i=(o=t.design)==null?void 0:o.body)!=null&&i.rows)return t.design;if(Array.isArray(t.templates)&&t.templates.length>0){const p=t.templates[0],f=((r=p.StockTemplatePages)==null?void 0:r[n])||((a=p.StockTemplatePages)==null?void 0:a[0]);if((s=(l=f==null?void 0:f.design)==null?void 0:l.body)!=null&&s.rows)return f.design;if((u=(d=p.design)==null?void 0:d.body)!=null&&u.rows)return p.design}if(Array.isArray(t.StockTemplatePages)){const p=t.StockTemplatePages[n]||t.StockTemplatePages[0];if((c=(g=p==null?void 0:p.design)==null?void 0:g.body)!=null&&c.rows)return p.design}return null}function Le(t,n){var g;const e=t.values||{};if(lt(e)==="hidden")return[];const o=(g=Tt(e.padding))!=null?g:{top:"0px",right:"0px",bottom:"0px",left:"0px"},i=Qt(o.top),r=Qt(o.bottom),a=!!e.backgroundColor,s=!!(wt(t.columns||[])||e.columnsBackgroundColor),d=!a&&s&&(!i||!r);if(ln(t))return $t([dn(t,n,o)],e);if(an(t),!d)return $t([Kt(t,n,o,!0)],e);const u=[];return i||u.push(Xt({top:o.top,right:o.right,bottom:"0px",left:o.left},n)),u.push(Kt(t,n,{top:"0px",right:o.right,bottom:"0px",left:o.left},!0)),r||u.push(Xt({top:"0px",right:o.right,bottom:o.bottom,left:o.left},n)),$t(u,e)}function Kt(t,n,e,o){var y,w,D,C;const i=t.values||{},r=t.cells||[1],a=r.reduce((P,E)=>P+Number(E||0),0)||1,l=o?wt(t.columns||[]):"",s=o&&!l?rn(t.columns||[]):"",d=l||s||i.columnsBackgroundColor||"",u=l||s||i.backgroundColor||d||"",g=o&&!i.backgroundColor&&(!!l||!!s||se(t.columns||[])),c={"background-color":u,"padding-top":e.top,"padding-right":e.right,"padding-bottom":e.bottom,"padding-left":e.left};zt(c);const p=(t.columns||[]).map(P=>{var $;const E=(($=P.values)==null?void 0:$.border)||{};return H(E.borderLeftWidth)+H(E.borderRightWidth)});if(o){const P=en(t.columns||[]);Object.assign(c,P);const E=nn(t.columns||[]);Object.assign(c,E)}const f=i.backgroundImage;!!(f!=null&&f.url)&&(Object.assign(c,ee(f)),c["background-image-enabled"]=!0),n.templateUsesFullWidth&&!g&&(c["full-width"]="full-width");const h=tt(i._override);c["border-left"]&&(h["border-left"]="0px solid transparent"),c["border-right"]&&(h["border-right"]="0px solid transparent");const S=(w=(y=i._override)==null?void 0:y.mobile)==null?void 0:w.backgroundImage;S!=null&&S.url&&S.url!==(f==null?void 0:f.url)&&(Object.assign(h,ee(S)),h["background-image-enabled"]=!0);const k=Ye(i.alignItems),x=(t.columns||[]).map((P,E)=>{var Y;const $=Number((Y=r[E])!=null?Y:1)/a,L=Je($),F=Math.max(1,Math.round(n.contentWidthPx*$)-(p[E]||0)),U=Oe(P,L,z(N({},n),{columnPxWidth:F}));return U&&k&&(U.attributes=z(N({},U.attributes),{"vertical-align":k})),U}).filter(P=>P!=null),_=!!((C=(D=i._override)==null?void 0:D.mobile)!=null&&C.noStackMobile),A=x.length>0?_&&x.length>1?[B({type:m.STANDARD_GROUP,data:{},attributes:{width:"100%"},children:x})]:x:[qe()];return B({type:m.STANDARD_SECTION,data:{},attributes:M(c),mobileAttributes:M(h),children:A})}function Xt(t,n){const e={"background-color":"","padding-top":t.top,"padding-right":t.right,"padding-bottom":t.bottom,"padding-left":t.left};zt(e),n.templateUsesFullWidth&&(e["full-width"]="full-width");const o=B({type:m.STANDARD_PARAGRAPH,data:{},attributes:{"padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"0px",padding:"0px 0px 0px 0px","font-size":"0px","line-height":"0"},children:[{text:""}]}),i=B({type:m.STANDARD_COLUMN,data:{},attributes:{width:"100%","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"0px"},children:[o]});return B({type:m.STANDARD_SECTION,data:{},attributes:M(e),children:[i]})}function Oe(t,n,e){var l,s;const o=t.values||{};if(lt(o)==="hidden")return null;const i={width:n,"background-color":o.backgroundColor||"","border-radius":o.borderRadius||""};J(Object.assign(i,gn(o))),Object.assign(i,te(o.border));const r=tt(o._override);Object.assign(r,te((s=(l=o._override)==null?void 0:l.mobile)==null?void 0:s.border,{includeZero:!0}));let a=(t.contents||[]).map(d=>ie(d,e)).filter(d=>d!=null);return a.length===0&&(a=[yt()]),Dt(B({type:m.STANDARD_COLUMN,data:{},attributes:M(i),mobileAttributes:M(r),children:a}),o)}function ie(t,n){const e=t.values||{};if(lt(e)==="hidden")return null;let o;switch(t.type){case"heading":o=Me(e,n);break;case"text":o=re(e,n);break;case"paragraph":o=He(e,n);break;case"image":o=ae(e,n);break;case"button":o=Fe(e,n);break;case"divider":o=Ge(e);break;case"menu":o=Ue(e,n);break;case"social":o=je(e);break;case"timer":throw new Error("Unlayer countdown/timer block is not supported — skip this template");case"html":o=Xe(e);break;default:return n.warnings.push(`Unsupported block type "${t.type}" — skipped`),null}return Dt(o,e)}function Mt(t,n){const e=t==null?void 0:t.linkStyle;return e&&e.inherit===!1&&e.linkColor?e.linkColor:n.bodyLinkColor}function Ot(t,n){return n?t.map(e=>"text"in e&&e.link&&!e.color?z(N({},e),{color:n}):e):t}function Ht(t,n){const e=Be(t),o={align:t.textAlign||"",color:t.color||"","font-family":Wt(t.fontFamily,n),"font-size":t.fontSize||"","line-height":e||t.lineHeight||"","letter-spacing":t.letterSpacing||"","container-background-color":""};return J(Object.assign(o,ft(t))),o}function Wt(t,n){const e=(t==null?void 0:t.value)||"";return e?e.trim().toLowerCase()==="inherit"?n.bodyFontFamily||"":e:""}const Ie=/<(?:span|strong|em|b|i)\b[^>]*\bstyle\s*=\s*"[^"]*\bline-height\s*:\s*([^;"]+)/i;function Be(t){const n=t.text;if(!n)return"";const e=Ie.exec(n);if(!e)return"";const o=e[1].trim(),i=H(t.fontSize);if(!i)return"";const r=qt(o,i),a=qt(t.lineHeight,i);return r==null||a!=null&&r<=a?"":o}function qt(t,n){if(t==null||t==="")return null;const e=String(t).trim();if(e.endsWith("%")){const i=parseFloat(e);return Number.isFinite(i)?i/100*n:null}if(e.endsWith("px")){const i=parseFloat(e);return Number.isFinite(i)?i:null}const o=parseFloat(e);return Number.isFinite(o)?o*n:null}function Me(t,n){const e=Ze(t.headingType),o=Ht(t,n);return t.fontWeight==null&&!o["font-weight"]&&(o["font-weight"]="400"),B({type:e,data:{},attributes:M(o),mobileAttributes:M(tt(t._override,{padding:!0})),children:Ot(j(t.text),Mt(t,n))})}function re(t,n){const e=Ht(t,n),o=ce(t.text||"",Mt(t,n));return B({type:m.STANDARD_PARAGRAPH,data:{},attributes:M(e),mobileAttributes:M(tt(t._override,{padding:!0})),children:o.length>0?o:[{text:""}]})}function He(t,n){const e=We(t.textJson);return re(z(N({},t),{text:e}),n)}function We(t){if(!t)return"";let n;try{n=typeof t=="string"?JSON.parse(t):t}catch(o){return""}const e=n==null?void 0:n.root;return!e||!Array.isArray(e.children)?"":St(e.children)}function St(t){return t.map(ze).join("")}function ze(t){var e,o,i,r,a,l;if(!t)return"";switch(t.type){case"paragraph":return`<p>${St(t.children||[])||"&nbsp;"}</p>`;case"extended-link":case"link":{const s=t.url||((e=t.values)==null?void 0:e.href)||((o=t.attrs)==null?void 0:o.href)||"",d=t.target||((i=t.values)==null?void 0:i.target)||((r=t.attrs)==null?void 0:r.target)||"",u=St(t.children||[]),g=[`href="${Jt(s)}"`];return d&&g.push(`target="${Jt(d)}"`),`<a ${g.join(" ")}>${u}</a>`}case"extended-text":case"text":{const s=Zt(String((a=t.text)!=null?a:""));return ve(s,Number(t.format||0))}case"merge_tag":{const s=t.text||((l=t.properties)==null?void 0:l.value)||t.value||"";return Zt(String(s))}case"linebreak":return"<br>";default:return Array.isArray(t.children)?St(t.children):""}}function ve(t,n){return n&&(n&1&&(t=`<strong>${t}</strong>`),n&2&&(t=`<em>${t}</em>`),n&4&&(t=`<s>${t}</s>`),n&8&&(t=`<u>${t}</u>`)),t}function Zt(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Jt(t){return String(t).replace(/"/g,"&quot;")}function ae(t,n){var S,k,x,_,A,y,w,D,C,P,E,$,L,F,U,Y,dt,st,At;const e=((S=t.src)==null?void 0:S.url)||"",o=t.action||{},i={src:e,alt:t.altText||"",title:t.title||"",href:((k=o.values)==null?void 0:k.href)||"",target:((x=o.values)==null?void 0:x.target)||"",align:t.textAlign||"center"};J(Object.assign(i,ft(t)));const r=typeof((_=t.src)==null?void 0:_.height)=="number"?t.src.height:0,a=typeof((A=t.src)==null?void 0:A.width)=="number"?t.src.width:0;if(r>0&&r<=5&&a>0&&a/r>=50){const q=H((y=i["padding-bottom"])!=null?y:"0px");i["padding-bottom"]=`${q+16}px`}const l=H(i["padding-left"])+H(i["padding-right"]),s=Math.max(1,n.columnPxWidth-l),d=(w=t.src)==null?void 0:w.maxWidth;d?i.width=It(d,s):typeof((D=t.src)==null?void 0:D.width)=="number"&&(i.width=`${Math.min(t.src.width,s)}px`),Yt(e)&&(i.height=(C=t.src)!=null&&C.height?de(t.src.height,(P=t.src)==null?void 0:P.width,i.width):"18px");const u=typeof((E=t.src)==null?void 0:E.width)=="number"?t.src.width:void 0,g=H(i.width),c=fn(t._override,u,g||void 0,typeof(($=t.src)==null?void 0:$.maxWidth)=="string"?t.src.maxWidth:void 0,{brokenImage:Yt(e),srcNativeHeight:typeof((L=t.src)==null?void 0:L.height)=="number"?t.src.height:void 0,desktopPaddingLeft:H(i["padding-left"]),desktopPaddingRight:H(i["padding-right"]),align:t.textAlign||"center"}),p=(dt=(Y=(U=(F=t._override)==null?void 0:F.mobile)==null?void 0:U.src)==null?void 0:Y.maxWidth)!=null?dt:d,f=p==="0%"||p==="0"||p===0,T=et=>{if(!et)return!1;const q=String(et).trim();return q!=="0"&&q!=="0px"&&q!=="0 0 0 0"},h=T(c["padding-top"])||T(c["padding-bottom"])||T(c.padding);if(f&&!h&&(c["padding-top"]="8px",c["padding-bottom"]="9px"),g&&c["fluid-on-mobile"]!=="true"){const et=H(i["padding-left"]),q=H(i["padding-right"]),kt=Math.max(1,n.columnPxWidth-et-q),ht=Math.min(g,kt),ct=c["padding-left"],pt=c["padding-right"],gt=ct!=null&&ct!==""?H(String(ct)):et,W=pt!=null&&pt!==""?H(String(pt)):q;if(n.columnPxWidth-gt-W<ht){const V=Math.max(0,n.columnPxWidth-ht),ut=gt+W;if(ut>0&&V<ut){const Ct=V/ut,Et=Math.round(gt*Ct),Gt=V-Et;if(c["padding-left"]=`${Et}px`,c["padding-right"]=`${Gt}px`,c.padding){const be=H(String((st=c["padding-top"])!=null?st:0)),me=H(String((At=c["padding-bottom"])!=null?At:0));c.padding=`${be}px ${Gt}px ${me}px ${Et}px`}}}}return B({type:m.STANDARD_IMAGE,data:{},attributes:M(i),mobileAttributes:M(c),children:[{text:""}]})}function Fe(t,n){var a,l;const e=t.href||{},o=t.buttonColors||{},i={align:t.textAlign||"center",href:((a=e.values)==null?void 0:a.href)||"",target:((l=e.values)==null?void 0:l.target)||"",color:o.color||"","background-color":o.backgroundColor||"","font-size":t.fontSize||"","font-family":Wt(t.fontFamily,n),"line-height":t.lineHeight||"","border-radius":t.borderRadius||"",width:le(t.size)};J(Object.assign(i,ft(t))),J(Object.assign(i,{"inner-padding":t.padding}),"inner-padding");const r=pe(t.border);return r.width&&(i["border-enabled"]=!0,i["border-width"]=r.width,i["border-style"]=r.style,i["border-color"]=r.color),B({type:m.STANDARD_BUTTON,data:{},attributes:M(i),mobileAttributes:M(hn(t._override)),children:j(t.text)})}function Ge(t){const n=pe(t.border,"borderTop"),e={width:t.width||"100%",align:t.textAlign||"center","border-color":n.color||"#000000","border-style":n.style||"solid","border-width":n.width||"1px"};return J(Object.assign(e,ft(t))),B({type:m.STANDARD_DIVIDER,data:{},attributes:M(e),mobileAttributes:M(tt(t._override,{padding:!0})),children:[{text:""}]})}function Ue(t,n){var f,T,h;const e=((f=t.menu)==null?void 0:f.items)||[],o="",i=t.linkColor||t.textColor||"",r=t.fontSize||"",a=Wt(t.fontFamily,n),l=t.padding||"",s=((h=(T=t._override)==null?void 0:T.mobile)==null?void 0:h.padding)||"",d=t.textTransform||"none",u=(S,k,x)=>{var _,A;return B({type:m.STANDARD_NAVBAR_LINK,data:{},attributes:M({href:k?"":((_=x==null?void 0:x.values)==null?void 0:_.href)||"",target:k?"":((A=x==null?void 0:x.values)==null?void 0:A.target)||"",color:i,"font-size":r,"font-family":a,"line-height":"1.2",padding:l,"text-transform":d,"text-decoration":"none"}),mobileAttributes:s?{padding:s}:void 0,children:k?[{text:S}]:j(S)})},g=[];e.forEach((S,k)=>{k>0&&o&&g.push(u(o,!0)),g.push(u(S.text||"",!1,S.link))});const c={align:t.align||"center",color:i,"font-size":r,"font-family":a,"text-transform":d};J(Object.assign(c,ft(t)));const p=t._override?z(N({},t._override),{mobile:t._override.mobile?z(N({},t._override.mobile),{padding:void 0}):void 0}):void 0;return B({type:m.STANDARD_NAVBAR,data:{},attributes:M(c),mobileAttributes:M(tt(p,{padding:!0})),children:g.length>0?g:[yt()]})}function je(t,n){var a,l;const e=((a=t.icons)==null?void 0:a.icons)||[],o=((l=t.icons)==null?void 0:l.iconType)||"rounded",i=e.map(s=>{const d=String(s.name||"").trim(),u=Ke(d);return B({type:m.STANDARD_SOCIAL_ELEMENT,data:{},attributes:M({src:u?Ve(o,u):"",mode:"custom",href:s.url||"",name:d.toLowerCase(),alt:d?`${d} icon`:"",title:d,target:"_blank"}),children:[{text:""}]})}),r={align:t.align||"center",mode:"horizontal","icon-size":t.iconSize?`${t.iconSize}px`:"",spacing:t.spacing!=null?`${t.spacing}px`:"",color:t.color||"","font-size":t.fontSize||""};return J(Object.assign(r,ft(t))),B({type:m.STANDARD_SOCIAL,data:{},attributes:M(r),mobileAttributes:M(tt(t._override,{padding:!0})),children:i.length>0?i:[yt()]})}function Ve(t,n){return`https://cdn.tools.unlayer.com/social/icons/${t}/${n}.png`}function Ke(t){var o;if(!t)return"";const n={facebook:"facebook",linkedin:"linkedin",instagram:"instagram",twitter:"twitter",x:"x",youtube:"youtube",pinterest:"pinterest",tiktok:"tiktok",snapchat:"snapchat",whatsapp:"whatsapp",github:"github"},e=t.toLowerCase();return(o=n[e])!=null?o:e.replace(/[^a-z0-9]/g,"")}function Xe(t){return B({type:m.DANGEROUS_CODE,data:{code:t.html||t.content||""},attributes:{},children:[{text:""}]})}function qe(){return B({type:m.STANDARD_COLUMN,data:{},attributes:{width:"100%"},children:[yt()]})}function yt(){return B({type:m.STANDARD_PARAGRAPH,data:{},attributes:{},children:[{text:""}]})}function Ze(t){switch(t){case"h2":return m.STANDARD_H2;case"h3":return m.STANDARD_H3;case"h4":return m.STANDARD_H4;case"h1":default:return m.STANDARD_H1}}function le(t){if(t==null)return"";if(typeof t=="number")return`${t}px`;if(typeof t=="string")return t;if(typeof t=="object"){if(t.autoWidth)return"";if(typeof t.width=="number")return`${t.width}px`;if(typeof t.width=="string")return t.width}return""}function H(t){if(typeof t=="number")return t;if(typeof t!="string")return 0;const n=/^(-?\d+(?:\.\d+)?)(px)?$/.exec(t.trim());return n?parseFloat(n[1]):0}function Je(t){return`${Number((t*100).toFixed(4))}%`}function Ye(t){const n=String(t||"").trim().toLowerCase();return n?n==="center"||n==="middle"?"middle":n==="flex-end"||n==="end"||n==="bottom"?"bottom":n==="flex-start"||n==="start"||n==="top"?"top":"":""}function It(t,n){if(!t)return"";const e=String(t).trim(),o=/^(-?\d+(?:\.\d+)?)%$/.exec(e);if(o){const i=parseFloat(o[1]);return`${Math.max(1,Math.round(i/100*n))}px`}return/^-?\d+(?:\.\d+)?$/.test(e)?`${e}px`:e}function Yt(t){const n=String(t||"").trim();return!n||Qe(n)?!1:!/^(?:https?:|data:|blob:)/i.test(n)}function Qe(t){return/%%[A-Za-z0-9_]+%%/.test(t)}function de(t,n,e){if(typeof t!="number"||t<=0)return"";const o=typeof n=="number"&&n>0?n:0,i=H(e);return o>0&&i>0?`${Math.max(1,Math.round(t*i/o))}px`:`${t}px`}function tn(t,n){const e=new Set,o=[],i=a=>{if(!a||typeof a!="object"||!a.url)return;const l=String(a.url);e.has(l)||(e.add(l),o.push({name:String(a.label||a.value||"").trim(),href:l}))};i(n);const r=a=>{if(!(!a||typeof a!="object")){a.fontFamily&&i(a.fontFamily);for(const l of Object.keys(a)){const s=a[l];Array.isArray(s)?s.forEach(r):s&&typeof s=="object"&&r(s)}}};return r(t),o}function en(t){var a,l,s,d,u,g;if(t.length===0)return{};const n={},e=(t[0].contents||[]).map(c=>c.type).join(","),o=((a=t[0].values)==null?void 0:a.backgroundColor)||"",i=!!e&&t.every(c=>{var T;const p=(c.contents||[]).map(h=>h.type).join(","),f=((T=c.values)==null?void 0:T.backgroundColor)||"";return p===e&&f===o}),r=["Top"];i||r.push("Bottom");for(const c of r){const p=`border${c}Width`,f=`border${c}Color`,T=`border${c}Style`,h=(s=(l=t[0])==null?void 0:l.values)==null?void 0:s.border;if(!h)continue;const S=h[p],k=h[f],x=h[T]||"solid";if(!S||S==="0"||S==="0px")continue;let _=!0;for(let A=1;A<t.length;A++){const y=(u=(d=t[A])==null?void 0:d.values)==null?void 0:u.border;if(!y||y[p]!==S||y[f]!==k||(y[T]||"solid")!==x){_=!1;break}}if(_){n[`border-${c.toLowerCase()}`]=`${S} ${x} ${k||"transparent"}`;for(const A of t){const y=(g=A.values)==null?void 0:g.border;y&&(y[p]="0px")}}}return n}function nn(t){const n={};if(t.length===0)return n;const e=(o,i,r)=>{var u;const a=(u=o==null?void 0:o.values)==null?void 0:u.border;if(!a)return;const l=a[`border${i}Width`],s=a[`border${i}Color`],d=a[`border${i}Style`]||"solid";!l||l==="0"||l==="0px"||(n[r]=`${l} ${d} ${s||"transparent"}`,a[`border${i}Width`]="0px")};return e(t[0],"Left","border-left"),e(t[t.length-1],"Right","border-right"),n}function wt(t){var e,o,i,r;if(t.length===0)return"";const n=(o=(e=t[0])==null?void 0:e.values)==null?void 0:o.backgroundColor;if(!n)return"";for(let a=1;a<t.length;a++)if(((r=(i=t[a])==null?void 0:i.values)==null?void 0:r.backgroundColor)!==n)return"";return n}function on(t){var i,r;const n=t.contents||[];if(n.length===0)return!0;if(n.length>1)return!1;const e=n[0];if(e.type!=="image")return!1;const o=(r=(i=e.values)==null?void 0:i.src)==null?void 0:r.maxWidth;return o==="0%"||o==="0"||o===0}function rn(t){var i,r,a,l,s;if(t.length<3)return"";const n=((r=(i=t[0])==null?void 0:i.values)==null?void 0:r.backgroundColor)||"",e=((l=(a=t[t.length-1])==null?void 0:a.values)==null?void 0:l.backgroundColor)||"";if(!n||n!==e)return"";let o="";for(let d=1;d<t.length-1;d++){const u=t[d],g=((s=u==null?void 0:u.values)==null?void 0:s.backgroundColor)||"";if(g&&g!==n){if(!on(u)||o&&o!==g)return"";o=g}}return o}function se(t){var n;for(const e of t){const o=(n=e==null?void 0:e.values)==null?void 0:n.border;if(!o)continue;const i=["borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth"];for(const r of i){const a=o[r];if(a&&a!=="0px"&&a!=="0")return!0}}return!1}function an(t){var i,r,a;const n=t.columns||[];if(n.length<2)return;const e=t.cells||n.map(()=>1),o=new Map;n.forEach((l,s)=>{var p;const d=(l.contents||[]).map(f=>f.type).join(","),u=((p=l.values)==null?void 0:p.backgroundColor)||"";if(!d)return;const g=`${d}|${u}`,c=o.get(g)||[];c.push(s),o.set(g,c)});for(const l of o.values()){if(l.length<2)continue;const s=l.map(c=>{var p;return Number((p=e[c])!=null?p:1)}),d=Math.min(...s),u=Math.max(...s);if(u>0&&(u-d)/u>.2)continue;const g=n[l[0]].contents.length;for(let c=0;c<g;c++){let p=0,f=0,T=1/0,h=1/0;for(const _ of l){const A=n[_].contents[c],y=Tt((i=A.values)==null?void 0:i.containerPadding),w=y?H(y.top):0,D=y?H(y.bottom):0;p=Math.max(p,w),f=Math.max(f,D),T=Math.min(T,w),h=Math.min(h,D)}const S=p-T>80,k=f-h>80,x=p>T;for(const _ of l){const A=n[_].contents[c],y=(a=Tt((r=A.values)==null?void 0:r.containerPadding))!=null?a:{top:"0px",right:"0px",bottom:"0px",left:"0px"};let w=!1;!S&&!x&&H(y.top)<p&&(y.top=`${p}px`,w=!0),!k&&H(y.bottom)<f&&(y.bottom=`${f}px`,w=!0),w&&(A.values=A.values||{},A.values.containerPadding=`${y.top} ${y.right} ${y.bottom} ${y.left}`)}}}}function ln(t){var i,r,a,l;const n=t.columns||[];if(n.length<2||!((a=(r=(i=t.values)==null?void 0:i._override)==null?void 0:r.mobile)!=null&&a.noStackMobile)||!wt(n)||!se(n))return!1;const e=new Set(["image","text","heading"]),o=(n[0].contents||[]).map(s=>s.type).join(",");if(!o)return!1;for(const s of n){const d=((l=s.values)==null?void 0:l.border)||{},u=d.borderTopWidth,g=d.borderBottomWidth;if(!u||u==="0"||u==="0px"||!g||g==="0"||g==="0px")return!1}for(const s of n){const d=s.contents||[];for(const g of d)if(!e.has(g.type))return!1;if(d.map(g=>g.type).join(",")!==o)return!1}return!0}function dn(t,n,e){var h;const o=t.values||{},i=t.columns||[],r=t.cells||i.map(()=>1),a=r.reduce((S,k)=>S+Number(k||0),0)||1,l=wt(i);let s="#000000",d="solid",u="1px";for(const S of i){const k=(h=S.values)==null?void 0:h.border;if(!k)continue;const x=k.borderTopWidth||k.borderRightWidth||k.borderBottomWidth||k.borderLeftWidth;if(x&&x!=="0px"&&x!=="0"){u=x,s=k.borderTopColor||k.borderRightColor||k.borderBottomColor||k.borderLeftColor||s,d=k.borderTopStyle||k.borderRightStyle||k.borderBottomStyle||k.borderLeftStyle||d;break}}const g=i.map((S,k)=>{var P,E,$;const x=S.values||{};if(lt(x)==="hidden")return null;const _=Number((P=r[k])!=null?P:1)/a,A=Math.round(n.contentWidthPx*_),y=(S.contents||[]).map(L=>sn(L,z(N({},n),{columnPxWidth:A}))).filter(L=>L!=null),w=((E=S.values)==null?void 0:E.border)||{},D=[w.borderTopWidth,w.borderRightWidth,w.borderBottomWidth,w.borderLeftWidth].some(L=>L&&L!=="0px"&&L!=="0"),C=`${(Number(($=r[k])!=null?$:1)/a*100).toFixed(4)}%`;return Dt(B({type:m.STANDARD_TABLE2_TD,data:{rowspan:1,colspan:1},attributes:M({"border-enabled":D?!0:void 0,"text-align":"center",width:C}),children:y.length>0?y:[yt()]}),x)}).filter(S=>S!=null),c=B({type:m.STANDARD_TABLE2_TR,data:{},attributes:M({"background-color":l||""}),children:g}),p=B({type:m.STANDARD_TABLE2,data:{},attributes:M({"border-enabled":!0,"border-color":s,"border-style":d,"border-width":u,"text-align":"center","cell-padding-top":"0px","cell-padding-right":"0px","cell-padding-bottom":"0px","cell-padding-left":"0px",padding:"0px 0px 0px 0px","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"0px",width:"100%"}),children:[c]}),f=B({type:m.STANDARD_COLUMN,data:{},attributes:{width:"100%","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"0px"},children:[p]}),T={"background-color":o.backgroundColor||"","padding-top":e.top,"padding-right":e.right,"padding-bottom":e.bottom,"padding-left":e.left};return zt(T),n.templateUsesFullWidth&&(T["full-width"]="full-width"),B({type:m.STANDARD_SECTION,data:{},attributes:M(T),children:[f]})}function sn(t,n){const e=t.values||{};if(lt(e)==="hidden")return null;let o;switch(t.type){case"image":o=cn(e,n);break;case"heading":case"text":o=pn(e,n);break;default:return ie(t,n)}return Dt(o,e)}function cn(t,n){var f,T;const e=((f=t.src)==null?void 0:f.url)||"",o=t.altText||"",r=(T=ae(t,n).attributes)!=null?T:{},a=r.width||"",l=r["padding-top"]||"0px",s=r["padding-right"]||"0px",d=r["padding-bottom"]||"0px",u=r["padding-left"]||"0px",g=["display:block","margin:0 auto","max-width:100%","height:auto","border:0",a?`width:${a}`:""].filter(Boolean).join(";"),c=`padding:${l} ${s} ${d} ${u};text-align:center`,p=B({type:m.HTML_BLOCK_NODE,data:{tagName:"img"},attributes:{src:e,alt:o,style:g},children:[{text:""}]});return B({type:m.HTML_BLOCK_NODE,data:{tagName:"div"},attributes:{style:c},children:[p]})}function pn(t,n){const e=Ht(t,n),o=e["padding-top"]||"0px",i=e["padding-right"]||"0px",r=e["padding-bottom"]||"0px",a=e["padding-left"]||"0px",l=[e.color?`color:${e.color}`:"",e["font-family"]?`font-family:${e["font-family"]}`:"",e["font-size"]?`font-size:${e["font-size"]}`:"",e["line-height"]?`line-height:${e["line-height"]}`:"",e["letter-spacing"]?`letter-spacing:${e["letter-spacing"]}`:"",e.align?`text-align:${e.align}`:"",`padding:${o} ${i} ${r} ${a}`,"margin:0","word-wrap:break-word"].filter(Boolean).join(";"),s=ce(t.text||"",Mt(t,n));return B({type:m.HTML_BLOCK_NODE,data:{tagName:"div"},attributes:{style:l},children:s.length>0?s:[{text:""}]})}function ce(t,n){if(!t)return[];const e=(d,u,g)=>{if(!g&&!d.trim())return null;const c=Ot(j(d),n),p=u?`margin:0;${u}`:"margin:0";return{type:m.HTML_BLOCK_NODE,data:{tagName:"p"},attributes:{style:p},children:c.length?c:[{text:""}]}},o=(d,u,g)=>{const c=/<li\b([^>]*)>([\s\S]*?)<\/li>/gi,p=[];let f;for(;(f=c.exec(g))!==null;){const h=Nt(f[1]||""),S=Ot(j(f[2]),n);p.push({type:m.HTML_BLOCK_NODE,data:{tagName:"li"},attributes:h?{style:h}:{},children:S.length?S:[{text:""}]})}if(p.length===0)return null;const T=Nt(u);return{type:m.HTML_BLOCK_NODE,data:{tagName:d},attributes:T?{style:T}:{},children:p}},i=[],r=/<(p|ul|ol)\b([^>]*)>([\s\S]*?)<\/\1>/gi;let a=0,l;for(;(l=r.exec(t))!==null;){const d=e(t.slice(a,l.index),"",!1);d&&i.push(d);const u=l[1].toLowerCase(),g=l[2]||"",c=u==="p"?e(l[3],Nt(g),!0):o(u,g,l[3]);c&&i.push(c),a=l.index+l[0].length}const s=e(t.slice(a),"",!1);return s&&i.push(s),i}function Nt(t){var e,o;const n=/\bstyle\s*=\s*"([^"]*)"|\bstyle\s*=\s*'([^']*)'/i.exec(t);return n&&(o=(e=n[1])!=null?e:n[2])!=null?o:""}function zt(t){const n=t["padding-top"],e=t["padding-right"],o=t["padding-bottom"],i=t["padding-left"];n==null&&e==null&&o==null&&i==null||(t.padding=`${n!=null?n:"0px"} ${e!=null?e:"0px"} ${o!=null?o:"0px"} ${i!=null?i:"0px"}`)}function gn(t){const n={};return t!=null&&t.padding&&(n.padding=t.padding),n}function Qt(t){return t?/^0(?:px|em|rem|%|pt)?$/i.test(t.trim()):!0}function ft(t){const n={};return t!=null&&t.containerPadding&&(n.padding=t.containerPadding),n}function te(t,n={}){if(!t||typeof t!="object")return{};const e={},o=["Top","Right","Bottom","Left"];let i=!1;for(const r of o){const a=t[`border${r}Width`],l=t[`border${r}Color`],s=t[`border${r}Style`];(a||l||s)&&(a&&a!=="0"&&a!=="0px"&&(i=!0),e[`border-${r.toLowerCase()}`]=`${a||"0px"} ${s||"solid"} ${l||"transparent"}`)}return i||n.includeZero?e:{}}function pe(t,n="borderAll"){if(!t||typeof t!="object")return{width:"",style:"",color:""};const e=(n==="borderTop"||t.borderTopWidth||t.borderTopColor,"borderTop");return{width:t[`${e}Width`]||"",style:t[`${e}Style`]||"",color:t[`${e}Color`]||""}}function ee(t){const n={};return t.url&&(n["background-url"]=t.url),t.repeat&&(n["background-repeat"]=t.repeat),t.position==="custom"&&t.customPosition?n["background-position"]=t.customPosition.join(" "):t.position?n["background-position"]=un(t.position):t.customPosition&&(n["background-position"]=t.customPosition.join(" ")),typeof t.size=="string"?t.size==="custom"&&t.width?n["background-size"]=`${t.width}px auto`:t.size!=="custom"&&(n["background-size"]=t.size):t.fullWidth&&t.width&&(n["background-size"]=`${t.width}px auto`),n}function un(t){const n=t.trim();if(!n||n.includes(" ")||/[%\d]/.test(n))return n;const e=n.split("-").filter(Boolean);if(e.length!==2)return n;const o=new Set(["top","bottom"]);return o.has(e[0])&&!o.has(e[1])?`${e[1]} ${e[0]}`:e.join(" ")}function tt(t,n={}){const e=t==null?void 0:t.mobile;if(!e)return{};const o={};return e.textAlign&&(o.align=e.textAlign),e.fontSize&&(o["font-size"]=e.fontSize),e.lineHeight&&(o["line-height"]=e.lineHeight),e.backgroundColor&&(o["background-color"]=e.backgroundColor),n.padding&&e.containerPadding&&(Object.assign(o,{padding:e.containerPadding}),J(o,"padding")),e.padding&&J(Object.assign(o,{padding:e.padding}),"padding"),o}const bt=375;function fn(t,n,e,o,i={}){var l,s,d,u,g,c;const r=tt(t,{padding:!0}),a=t==null?void 0:t.mobile;if(!((l=a==null?void 0:a.src)!=null&&l.maxWidth)&&o&&/^-?\d+(?:\.\d+)?%$/.test(o.trim())){const p=It(o,bt);if(p){const f=H(p);e&&f>e?r.width=`${e}px`:r.width=p}}if(((s=a==null?void 0:a.src)==null?void 0:s.autoWidth)===!0&&(n&&(r.width=`${n}px`),r["fluid-on-mobile"]="true"),(d=a==null?void 0:a.src)!=null&&d.maxWidth&&((u=a==null?void 0:a.src)==null?void 0:u.autoWidth)!==!0){const p=String(a.src.maxWidth).trim(),f=/^(-?\d+(?:\.\d+)?)%$/.exec(p),T=p==="100%"||p==="100",h=It(p,bt);let S=h;if(h){const k=H(h);!i.brokenImage&&n&&n>0&&k>n&&(S=`${n}px`)}if(S&&(r.width=S),T)r["fluid-on-mobile"]="true";else if(f){const k=parseFloat(f[1]),x=r["padding-left"]!=null?H(String(r["padding-left"])):(g=i.desktopPaddingLeft)!=null?g:0,_=r["padding-right"]!=null?H(String(r["padding-right"])):(c=i.desktopPaddingRight)!=null?c:0,A=Math.max(0,bt-x-_);let y=k/100*A;if(!i.brokenImage&&n&&n>0&&y>n&&(y=n),y>0&&y<bt){r.width=`${Math.round(y)}px`;const w=Math.max(0,bt-y),D=String(i.align||"").toLowerCase();let C=w/2,P=w/2;D==="left"?(C=x,P=Math.max(0,w-C)):D==="right"&&(P=_,C=Math.max(0,w-P)),r["padding-left"]=`${C}px`,r["padding-right"]=`${P}px`,r["fluid-on-mobile"]="true"}}}if(i.brokenImage&&i.srcNativeHeight&&n){const p=H(r.width);p>0&&(r.height=de(i.srcNativeHeight,n,`${p}px`))}return r}function hn(t){const n=tt(t,{padding:!0}),e=t==null?void 0:t.mobile,o=le(e==null?void 0:e.size);return o&&(n.width=o),n}function M(t){const n={};for(const e of Object.keys(t)){const o=t[e];o===""||o==null||(n[e]=o)}return n}function lt(t){var o,i,r,a;if(!t)return;const n=t.hideDesktop===!0||((i=(o=t._override)==null?void 0:o.desktop)==null?void 0:i.hideDesktop)===!0,e=t.hideMobile===!0||((a=(r=t._override)==null?void 0:r.mobile)==null?void 0:a.hideMobile)===!0;if(n&&e)return"hidden";if(n)return"mobile";if(e)return"desktop"}function Dt(t,n){if(!t)return t;const e=lt(n);return e==="hidden"?null:(e&&(t.visible=e),ge(t,n))}function $t(t,n){const e=lt(n);return e==="hidden"?[]:t.map(o=>{const i=e?z(N({},o),{visible:e}):o;return ge(i,n)})}function ge(t,n){const e=bn(n==null?void 0:n.displayCondition);return e?z(N({},t),{logic:z(N({},t.logic),{condition:{expression:e,enabled:!0}})}):t}function bn(t){const n=String((t==null?void 0:t.before)||"").trim();if(!n)return;const e=n.match(/^\{%\s*if\s+([\s\S]*?)\s*%\}$/);return e?e[1].trim()||void 0:n}function B(t){return t!=null&&t.mobileAttributes&&typeof t.mobileAttributes=="object"&&Object.keys(t.mobileAttributes).length===0&&delete t.mobileAttributes,t}const K={HEADING:"mailup-bee-newsletter-modules-heading",PARAGRAPH:"mailup-bee-newsletter-modules-paragraph",TEXT:"mailup-bee-newsletter-modules-text",BUTTON:"mailup-bee-newsletter-modules-button",IMAGE:"mailup-bee-newsletter-modules-image",SPACER:"mailup-bee-newsletter-modules-spacer",DIVIDER:"mailup-bee-newsletter-modules-divider",MENU:"mailup-bee-newsletter-modules-menu",SOCIAL:"mailup-bee-newsletter-modules-social",ICONS:"mailup-bee-newsletter-modules-icons",HTML:"mailup-bee-newsletter-modules-html",LIST:"mailup-bee-newsletter-modules-list",TABLE:"mailup-bee-newsletter-modules-table",VIDEO:"mailup-bee-newsletter-modules-video",CAROUSEL:"mailup-bee-newsletter-modules-carousel",FORM:"mailup-bee-newsletter-modules-form",MERGE_CONTENT:"mailup-bee-newsletter-modules-merge-content",EMPTY:"mailup-bee-newsletter-modules-empty"};function mn(t){var h,S,k,x,_,A,y,w,D,C,P,E;const n=[],e=yn(t);if(!e)throw new Error("beefreeToEasyEmailPro: input has no { page: { body, rows } }");for(const $ of e.rows||[])for(const L of $.columns||[])for(const F of L.modules||[])if(F.type===K.MENU)throw new Error("beefreeToEasyEmailPro: template uses `menu` module (navbar), which is not supported — conversion aborted");const o=e.body,i=((S=(h=o==null?void 0:o.content)==null?void 0:h.computedStyle)==null?void 0:S.messageWidth)||"700px",r=parseInt(String(i),10)||700,a=((x=(k=o==null?void 0:o.content)==null?void 0:k.computedStyle)==null?void 0:x.linkColor)||"",l=((A=(_=o==null?void 0:o.content)==null?void 0:_.style)==null?void 0:A["background-color"])||((w=(y=o==null?void 0:o.container)==null?void 0:y.style)==null?void 0:w["background-color"])||"",s=((C=(D=o==null?void 0:o.content)==null?void 0:D.style)==null?void 0:C["font-family"])||"",d=((E=(P=o==null?void 0:o.content)==null?void 0:P.style)==null?void 0:E.color)||"",u={};s&&(u["font-family"]=s);const g={};d&&(g[ne.TEXT]={color:d});const p=(e.rows||[]).flatMap($=>_n($,{contentWidthPx:r,columnPxWidth:r,bodyLinkColor:a,warnings:n})),f=((o==null?void 0:o.webFonts)||[]).map($=>({name:$.name||"",href:$.url||""})).filter($=>$.name&&$.href);return{page:{type:m.PAGE,data:N({breakpoint:r>700?"768px":"720px",globalAttributes:u,categoryAttributes:g,blockAttributes:{},classAttributes:{},preheader:""},f.length>0?{fonts:f}:{}),attributes:O({width:`${r}px`,"background-color":l,"content-background-color":"","margin-top":"0px","margin-bottom":"0px","link-color":a}),children:p},warnings:n}}function yn(t){var n,e,o;return t?(n=t.page)!=null&&n.rows?t.page:(o=(e=t.template)==null?void 0:e.page)!=null&&o.rows?t.template.page:t.rows&&t.body?t:null:null}function _n(t,n){var ht,ct,pt,gt;const e=((ht=t.content)==null?void 0:ht.style)||{},o=((ct=t.content)==null?void 0:ct.mobileStyle)||{},i=((pt=t.container)==null?void 0:pt.style)||{},r=((gt=t.content)==null?void 0:gt.computedStyle)||{},a=t.columns||[];if(a.length===0)return[];if(r.hideContentOnDesktop===!0&&r.hideContentOnMobile===!0)return[];const l=r.hideContentOnDesktop===!0?"mobile":r.hideContentOnMobile===!0?"desktop":void 0,s=(e["background-color"]||"").trim(),d=(i["background-color"]||"").trim(),u=W=>!W||W.toLowerCase()==="transparent",g=u(s)&&!u(d)?d:s,c=u(s)&&(!u(d)||!!mt(i["background-image"])),p=a.reduce((W,X)=>W+(X["grid-columns"]||0),0)||12,f=r.rowColStackOnMobile===!1&&a.length>1,T=(a[0].style||{})["background-color"]||"",S=(W=>!!W&&W.trim().toLowerCase()!=="transparent")(T)&&a.every(W=>(W.style||{})["background-color"]===T),k=String(r.columnsSpacing||"").trim(),x=!!k&&k!=="0px"&&k!=="0",_=S&&!x?T:"",A=r.columnsBorderRadius||"",y=x?A:"",w=e.padding||e["padding-top"]||e["padding-right"]||e["padding-bottom"]||e["padding-left"],D={top:e["padding-top"]||"",right:e["padding-right"]||"",bottom:e["padding-bottom"]||"",left:e["padding-left"]||"",shorthand:e.padding||(w?"":"0")},C=mt(e["background-image"])?e:u(s)&&mt(i["background-image"])?i:null,P=C?mt(C["background-image"]):"",E=P?O({"background-url":P,"background-position":C["background-position"]||"","background-repeat":C["background-repeat"]||"","background-size":C["background-size"]||"","background-image-enabled":!0}):{},$=!f&&a.length>1,L=W=>W.map((X,V)=>{const ut=X["grid-columns"]||12,Ct=Math.round(n.contentWidthPx*ut/p);return An(X,ut,p,z(N({},n),{columnPxWidth:Ct,columnStacksOnMobile:$,skipColBg:!!_,perColumnRadius:y,columnsSpacing:x?k:"",colIndex:V,colCount:W.length}))}).filter(X=>X!=null),F=r.rowReverseColStackOnMobile===!0&&r.rowColStackOnMobile!==!1&&a.length>1;let U;if(F){const W=L(a).map(V=>z(N({},V),{visible:"desktop"})),X=L([...a].reverse()).map(V=>z(N({},V),{visible:"mobile"}));U=[...W,...X]}else U=L(a);if(U.length===0)return[];const Y=f?[I({type:m.STANDARD_GROUP,data:{},attributes:{width:"100%"},children:U})]:U,dt=fe(o);if(_){const W=O(N({"background-color":g,"border-radius":e["border-radius"]||"",padding:D.shorthand,"padding-top":D.top,"padding-right":D.right,"padding-bottom":D.bottom,"padding-left":D.left},E)),X=I({type:m.STANDARD_SECTION,data:{},attributes:O({"background-color":_,"border-radius":A,padding:"0"}),children:Y}),V=I({type:m.STANDARD_WRAPPER,data:{},attributes:W,mobileAttributes:dt,children:[X]});return l&&(V.visible=l),[V]}const st=mt(i["background-image"]),At=!!st||!u(d)&&d!==s,et=!u(s);if(!_&&At&&et){const W=O(N({"full-width":"full-width","background-color":d,padding:D.shorthand,"padding-top":D.top,"padding-right":D.right,"padding-bottom":D.bottom,"padding-left":D.left},st?{"background-url":st,"background-position":i["background-position"]||"","background-repeat":i["background-repeat"]||"","background-size":i["background-size"]||"","background-image-enabled":!0}:{})),X=I({type:m.STANDARD_SECTION,data:{},attributes:O({"background-color":s,"border-radius":(y?"":A)||e["border-radius"]||"",padding:"0"}),children:Y}),V=I({type:m.STANDARD_WRAPPER,data:{},attributes:W,mobileAttributes:dt,children:[X]});return l&&(V.visible=l),[V]}const q=O(N(z(N({},c?{"full-width":"full-width"}:{}),{"background-color":g,"border-radius":(y?"":A)||e["border-radius"]||"",padding:D.shorthand,"padding-top":D.top,"padding-right":D.right,"padding-bottom":D.bottom,"padding-left":D.left}),E)),kt=I({type:m.STANDARD_SECTION,data:{},attributes:q,mobileAttributes:dt,children:Y});return l&&(kt.visible=l),[kt]}function An(t,n,e,o){const i=t.style||{},r=t.mobileStyle||{},a=`${Math.round(100*n/e)}%`,l=O({width:a,"background-color":o.skipColBg?"":i["background-color"]||"","border-radius":i["border-radius"]||o.perColumnRadius||"","border-top":nt(i["border-top"]),"border-right":nt(i["border-right"]),"border-bottom":nt(i["border-bottom"]),"border-left":nt(i["border-left"]),padding:i.padding||"","padding-top":i["padding-top"]||"","padding-right":i["padding-right"]||"","padding-bottom":i["padding-bottom"]||"","padding-left":i["padding-left"]||"","vertical-align":i["vertical-align"]||""}),s=fe(r),d=o.colCount!=null&&o.colIndex!=null?o.colIndex>=o.colCount-1:!0;if(o.columnsSpacing&&!d){const g=parseInt(o.columnsSpacing,10)||0;if(g>0){const c=parseInt(s["padding-bottom"]||"0",10)||0;s["padding-bottom"]=`${c+g}px`}}const u=(t.modules||[]).map(g=>kn(g,o)).filter(g=>!!g);return u.length===0?null:I({type:m.STANDARD_COLUMN,data:{},attributes:l,mobileAttributes:s,children:u})}function kn(t,n){const e=t.descriptor||{},o=(()=>{switch(t.type){case K.HEADING:return Sn(e,n);case K.PARAGRAPH:case K.TEXT:return Tn(e,n);case K.BUTTON:return wn(e);case K.IMAGE:return Dn(e,n);case K.SPACER:return Rn(e);case K.DIVIDER:return Cn(e);case K.HTML:return Pn(e);case K.LIST:return Ln(e);case K.SOCIAL:return En(e);case K.ICONS:return Nn(e);case K.TABLE:return $n(e,n);case K.EMPTY:return null;default:return n.warnings.push(`unsupported module type: ${t.type}`),null}})();return xn(o,e)}function xn(t,n){if(!t)return t;const e=(n==null?void 0:n.computedStyle)||{},o=e.hideContentOnDesktop===!0,i=e.hideContentOnMobile===!0;return o&&i?null:(o?t.visible="mobile":i&&(t.visible="desktop"),t)}function Sn(t,n){var p;const e=t.heading||{},o=t.style||{},i=e.style||{},r=e.title||"h1",a=e.text||"",l=r==="h2"?m.STANDARD_H2:r==="h3"?m.STANDARD_H3:m.STANDARD_H1,s=O({align:i["text-align"]||o["text-align"]||"",color:i.color||"","font-family":_t(i["font-family"]),"font-size":i["font-size"]||"","font-weight":i["font-weight"]||"","letter-spacing":i["letter-spacing"]||"","line-height":i["line-height"]||"","padding-top":o["padding-top"]||"","padding-right":o["padding-right"]||"","padding-bottom":o["padding-bottom"]||"","padding-left":o["padding-left"]||""}),d=Q(t.mobileStyle||{}),u=((p=e.computedStyle)==null?void 0:p.linkColor)||n.bodyLinkColor||"",g=u?vt(a,u):a,c=j(Rt(g))||[{text:""}];return I({type:l,data:{},attributes:s,mobileAttributes:d,children:c})}function Tn(t,n){var c,p,f;const e=t.paragraph||{},o=t.style||{},i=e.style||{},r=e.html||((c=t.text)==null?void 0:c.html)||"",a=i["line-height"]||((p=e.computedStyle)==null?void 0:p.paragraphSpacing)||"",l=((f=e.computedStyle)==null?void 0:f.linkColor)||n.bodyLinkColor||"",s=l?vt(r,l):r,d=O({align:i["text-align"]||"",color:i.color||"","font-family":_t(i["font-family"]),"font-size":i["font-size"]||"","font-weight":i["font-weight"]||"","letter-spacing":i["letter-spacing"]||"","line-height":a,"padding-top":o["padding-top"]||"","padding-right":o["padding-right"]||"","padding-bottom":o["padding-bottom"]||"","padding-left":o["padding-left"]||""}),u=Q(t.mobileStyle||{}),g=j(Rt(s))||[{text:""}];return I({type:m.STANDARD_PARAGRAPH,data:{},attributes:d,mobileAttributes:u,children:g})}function wn(t,n){const e=t.button||{},o=t.style||{},i=e.style||{},r=Rt(e.label||""),a=i.width&&i.width!=="auto"?i.width:"",l=O({align:o["text-align"]||"center",href:e.href||"",target:e.target||"",color:i.color||"","background-color":i["background-color"]||"","border-top":nt(i["border-top"]),"border-right":nt(i["border-right"]),"border-bottom":nt(i["border-bottom"]),"border-left":nt(i["border-left"]),"border-radius":i["border-radius"]||"","font-family":_t(i["font-family"]),"font-size":i["font-size"]||"","font-weight":i["font-weight"]||"","letter-spacing":i["letter-spacing"]||"","line-height":i["line-height"]||"","inner-padding-top":i["padding-top"]||"","inner-padding-right":i["padding-right"]||"","inner-padding-bottom":i["padding-bottom"]||"","inner-padding-left":i["padding-left"]||"","padding-top":o["padding-top"]||"","padding-right":o["padding-right"]||"","padding-bottom":o["padding-bottom"]||"","padding-left":o["padding-left"]||"",width:a}),s=Q(t.mobileStyle||{}),d=j(r)||[{text:""}];return I({type:m.STANDARD_BUTTON,data:{},attributes:l,mobileAttributes:s,children:d})}function Dn(t,n){const e=t.image||{},o=t.style||{},i=t.computedStyle||{},r=i.width||o.width||e.width||"",a=Bn(r,n.columnPxWidth),l=On(i.class)||"center",s=O(z(N({src:e.src||"",alt:e.alt||"",title:e.title||"",href:e.href||"",target:e.target||"",align:l,width:a},Pt(i.class,"fullwidthOnMobile")?{"fluid-on-mobile":"true"}:{}),{"border-radius":o["border-radius"]||"","padding-top":o["padding-top"]||"","padding-right":o["padding-right"]||"","padding-bottom":o["padding-bottom"]||"","padding-left":o["padding-left"]||""})),d=Q(t.mobileStyle||{});return n.columnStacksOnMobile&&Pt(i.class,"fixedwidth")&&!Pt(i.class,"fullwidthOnMobile")&&l!=="center"&&!d.align&&(d.align="center"),I({type:m.STANDARD_IMAGE,data:{},attributes:s,mobileAttributes:d,children:[{text:""}]})}function Rn(t){var o,i,r;const n=((i=(o=t.spacer)==null?void 0:o.style)==null?void 0:i.height)||"10px",e=((r=t.mobileStyle)==null?void 0:r.height)||"";return I({type:m.STANDARD_SPACER,data:{},attributes:O({height:n}),mobileAttributes:e?{height:e}:{},children:[{text:""}]})}function Cn(t){var u;const n=((u=t.divider)==null?void 0:u.style)||{},e=t.style||{},o=ue(n["border-top"]),i=n["border-top-color"]||n.color||o.color||"",r=n["border-top-style"]||o.style||"solid",a=n["border-top-width"]||o.width||"1px",l=parseInt(n.height||"0",10)||0;if((!i||i.toLowerCase()==="transparent"||a==="0"||a==="0px")&&l>0)return I({type:m.STANDARD_SPACER,data:{},attributes:O({height:`${l}px`,"padding-top":e["padding-top"]||"","padding-right":e["padding-right"]||"","padding-bottom":e["padding-bottom"]||"","padding-left":e["padding-left"]||""}),mobileAttributes:Q(t.mobileStyle||{}),children:[{text:""}]});const d=O({"border-color":i,"border-style":r,"border-width":a,width:n.width||"100%","padding-top":e["padding-top"]||"","padding-right":e["padding-right"]||"","padding-bottom":e["padding-bottom"]||"","padding-left":e["padding-left"]||""});return I({type:m.STANDARD_DIVIDER,data:{},attributes:d,mobileAttributes:Q(t.mobileStyle||{}),children:[{text:""}]})}function ue(t){if(!t||typeof t!="string")return{width:"",style:"",color:""};const n=t.trim().split(/\s+/),e=new Set(["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset"]);let o="",i="",r="";for(const a of n)!o&&/^[\d.]+(px|em|rem|%|pt)?$/.test(a)?o=a:!i&&e.has(a.toLowerCase())?i=a:r||(r=a);return{width:o,style:i,color:r}}function En(t){var a;const n=((a=t.iconsList)==null?void 0:a.icons)||[],e=t.style||{},o=t.computedStyle||{},i=n.map(l=>{const s=l.image||{},d=String(l.name||l.id||"").toLowerCase();return I({type:m.STANDARD_SOCIAL_ELEMENT,data:{},attributes:O({src:s.src||"",mode:"custom",href:s.href||"",name:d,alt:s.alt||d,title:s.title||d,target:s.target||"_blank"}),children:[{text:""}]})}),r=typeof o.iconsDefaultWidth=="number"?`${o.iconsDefaultWidth}px`:"";return I({type:m.STANDARD_SOCIAL,data:{},attributes:O({align:e["text-align"]||"center",mode:"horizontal","icon-size":r,"inner-padding":typeof o.padding=="string"?o.padding:"","padding-top":e["padding-top"]||"","padding-right":e["padding-right"]||"","padding-bottom":e["padding-bottom"]||"","padding-left":e["padding-left"]||""}),mobileAttributes:Q(t.mobileStyle||{}),children:i.length>0?i:[{text:""}]})}function Nn(t){var f,T;const e=(((f=t.iconsList)==null?void 0:f.icons)||[]).filter(h=>{const S=String((h==null?void 0:h.href)||"");return!/(?:^|\/\/)(?:www\.)?designedwithbeefree\.com/i.test(S)});if(e.length===0)return null;const o=t.style||{},i=t.computedStyle||{},r=parseInt(String(i.iconHeight||"0"),10)||0;if(e.length===1&&!((T=e[0])!=null&&T.text)){const h=e[0],S=parseInt(String(h.width||"0"),10)||0,k=parseInt(String(h.height||"0"),10)||0,x=r>0&&S>0&&k>0?`${Math.round(r*S/k)}px`:S>0?`${S}px`:"",_=i.iconSpacing||{};return I({type:m.STANDARD_IMAGE,data:{},attributes:O({src:h.image||"",alt:h.alt||"",title:h.title||h.alt||"",href:h.href||"",target:h.target||"_blank",align:o["text-align"]||"center",width:x,"padding-top":_["padding-top"]||o["padding-top"]||"","padding-right":_["padding-right"]||o["padding-right"]||"","padding-bottom":_["padding-bottom"]||o["padding-bottom"]||"","padding-left":_["padding-left"]||o["padding-left"]||""}),children:[{text:""}]})}const a=i.iconSpacing||{},l=a["padding-top"]||"",s=a["padding-right"]||"",d=a["padding-bottom"]||"",u=a["padding-left"]||"",g=e.map(h=>{const S=typeof h.text=="string"?h.text:"",k=parseInt(String(h.width||"0"),10)||0,x=parseInt(String(h.height||"0"),10)||0,_=r>0&&k>0&&x>0?`${Math.round(r*k/x)}px`:"",A=r>0?`${r}px`:"";return I({type:m.STANDARD_SOCIAL_ELEMENT,data:{},attributes:O(z(N(N({src:h.image||"",mode:"custom",href:h.href||"",alt:h.alt||"",title:h.title||h.alt||"",target:h.target||"_blank"},_?{"icon-size":_}:{}),A?{"icon-height":A}:{}),{"padding-top":l,"padding-right":s,"padding-bottom":d,"padding-left":u})),children:S?[{text:S}]:[{text:""}]})}),c=typeof i.iconHeight=="string"?i.iconHeight:"",p=l||s||d||u?`${l||"0px"} ${s||"0px"} ${d||"0px"} ${u||"0px"}`:"";return I({type:m.STANDARD_SOCIAL,data:{},attributes:O({align:o["text-align"]||"left",mode:"horizontal","icon-size":c,"inner-padding":p,color:o.color||"","font-family":o["font-family"]||"","font-size":o["font-size"]||"","font-weight":o["font-weight"]||"","padding-top":o["padding-top"]||"","padding-right":o["padding-right"]||"","padding-bottom":o["padding-bottom"]||"","padding-left":o["padding-left"]||""}),mobileAttributes:Q(t.mobileStyle||{}),children:g})}function $n(t,n){var C,P;const e=t.table||{},o=e.style||{},i=e.computedStyle||{},r=t.style||{},a=((C=e.content)==null?void 0:C.rows)||[],l=((P=e.content)==null?void 0:P.headers)||[];if(a.length===0&&l.length===0)return null;const s=ue(o["border-top"]||o["border-right"]||o["border-bottom"]||o["border-left"]||""),d=s.color||"",u=s.style||"solid",g=s.width||"1px",c=!!d&&d.toLowerCase()!=="transparent",p=i.linkColor||n.bodyLinkColor||"",f=(E,$={})=>{const L=p?vt(E,p):E,F=j(Rt(L))||[{text:""}];return I({type:m.STANDARD_TABLE2_TD,data:{rowspan:1,colspan:1},attributes:O($),children:F})},T=(E,$,L={})=>I({type:m.STANDARD_TABLE2_TR,data:{},attributes:O({"background-color":$}),children:E.map(F=>f((F==null?void 0:F.html)||"",L))}),h=[],S=i.headersBackgroundColor||"",k=i.headersColor||"",x=i.headersFontSize||"",_=i.headersFontWeight||"",A=i.headersTextAlign||"",y=[k?`color:${k}`:"",x?`font-size:${x}`:"",_?`font-weight:${_}`:"",A?`text-align:${A}`:""].filter(Boolean).join(";"),w=E=>y&&E.trim()?`<span style="${y}">${E}</span>`:E;l.forEach(E=>{const $=(E.cells||[]).map(L=>({html:w((L==null?void 0:L.html)||"")}));h.push(T($,S))});const D=i.alternateRowBackgroundColor||"";return a.forEach((E,$)=>{const L=$%2===1?D:"";h.push(T(E.cells||[],L))}),h.length===0?null:I({type:m.STANDARD_TABLE2,data:{},attributes:O({align:o["text-align"]||"center",color:o.color||"","font-family":_t(o["font-family"]),"font-size":o["font-size"]||"","line-height":o["line-height"]||"",width:"100%","table-layout":"auto","border-color":d,"border-style":u,"border-width":g,"border-enabled":!!c,"cell-padding-top":"10px","cell-padding-right":"10px","cell-padding-bottom":"10px","cell-padding-left":"10px","padding-top":r["padding-top"]||"","padding-right":r["padding-right"]||"","padding-bottom":r["padding-bottom"]||"","padding-left":r["padding-left"]||""}),children:h})}function Pn(t){var i,r,a,l,s;const n=((i=t.html)==null?void 0:i.html)||"",e=j(n)||[{text:n}],o=I({type:m.HTML_BLOCK_NODE,data:{tagName:"div"},attributes:{},children:e});return I({type:m.STANDARD_PARAGRAPH,data:{},attributes:O({"padding-top":((r=t.style)==null?void 0:r["padding-top"])||"","padding-right":((a=t.style)==null?void 0:a["padding-right"])||"","padding-bottom":((l=t.style)==null?void 0:l["padding-bottom"])||"","padding-left":((s=t.style)==null?void 0:s["padding-left"])||""}),children:[o]})}function Ln(t,n){const e=t.list||{},o=t.style||{},i=e.style||{},r=e.computedStyle||{},a=e.html||"",l=(e.tag||"ul").toLowerCase()==="ol"?"ol":"ul",s=In({"margin-bottom":r.liSpacing&&r.liSpacing!=="0px"?r.liSpacing:"","padding-left":r.liIndent||"","list-style-position":r.listStylePosition||""}),d=[],u=/<li[^>]*>([\s\S]*?)<\/li>/gi;let g;for(;(g=u.exec(a))!==null;)d.push(g[1]);d.length===0&&d.push(a);const c=d.map(T=>{const h=j(T)||[{text:T}];return I({type:m.HTML_BLOCK_NODE,data:{tagName:"li"},attributes:O({style:s}),children:h})}),p=I({type:m.HTML_BLOCK_NODE,data:{tagName:l},attributes:O({style:"margin:0;padding:0 0 0 1.25em"}),children:c}),f=O({align:i["text-align"]||"",color:i.color||"","font-family":_t(i["font-family"]),"font-size":i["font-size"]||"","font-weight":i["font-weight"]||"","letter-spacing":i["letter-spacing"]||"","line-height":i["line-height"]||"","padding-top":o["padding-top"]||"","padding-right":o["padding-right"]||"","padding-bottom":o["padding-bottom"]||"","padding-left":o["padding-left"]||""});return I({type:m.STANDARD_PARAGRAPH,data:{},attributes:f,mobileAttributes:Q(t.mobileStyle||{}),children:[p]})}function fe(t){if(!t)return{};const n={},e=["padding-top","padding-right","padding-bottom","padding-left","font-size"];for(const o of e)t[o]&&(n[o]=t[o]);return t["text-align"]&&(n.align=t["text-align"]),n}function nt(t){if(!t||typeof t!="string")return"";const n=t.trim().toLowerCase();return!n||n.startsWith("0px")||n.startsWith("0 ")||n.includes("transparent")?"":t}function mt(t){if(!t||typeof t!="string")return"";const n=t.trim();if(!n||n==="none")return"";const e=/^url\((['"]?)([^)]+?)\1\)$/.exec(n);return e?e[2]:""}function vt(t,n){return!t||!n?t:t.replace(/<a\b([^>]*)>/gi,(e,o)=>{if(/\bcolor\s*:/i.test(o))return e;const i=/\bstyle\s*=\s*"([^"]*)"/i.exec(o);if(i){const r=i[1].trim(),a=r&&!r.endsWith(";")?";":"",l=`${r}${a}color:${n};`;return`<a${o.replace(/\bstyle\s*=\s*"[^"]*"/i,`style="${l}"`)}>`}return`<a${o} style="color:${n};">`})}function On(t){if(!t||typeof t!="string")return"";const n=t.toLowerCase().split(/\s+/);return n.includes("left")?"left":n.includes("right")?"right":n.includes("center")?"center":""}function Pt(t,n){return!t||typeof t!="string"?!1:t.split(/\s+/).includes(n)}function In(t){const n=[];for(const[e,o]of Object.entries(t))o&&n.push(`${e}:${o}`);return n.join(";")}function Rt(t){return t.replace(/<span class="tinyMce-placeholder">/g,"<span>").replace(/<div class="txtTinyMce-wrapper"[^>]*>/g,"<div>")}function _t(t,n){return!t||t==="inherit"?"":t}function Q(t){const n={};for(const[e,o]of Object.entries(t))o&&(e==="padding-top"||e==="padding-right"||e==="padding-bottom"||e==="padding-left"||e==="font-size"||e==="text-align")&&(e==="text-align"?n.align=o:n[e]=o);return n}function Bn(t,n){if(!t)return"";const e=String(t).trim(),o=/^(-?\d+(?:\.\d+)?)%$/.exec(e);if(o)return`${Math.max(1,Math.round(parseFloat(o[1])/100*n))}px`;const i=/^(-?\d+(?:\.\d+)?)(?:px)?$/.exec(e);return i?`${i[1]}px`:e}function O(t){const n={};for(const e of Object.keys(t)){const o=t[e];o===""||o==null||(n[e]=o)}return n}function I(t){return t!=null&&t.mobileAttributes&&typeof t.mobileAttributes=="object"&&Object.keys(t.mobileAttributes).length===0&&delete t.mobileAttributes,t}const Z={Text:0,Image:1,Button:2,Social:3,Split:4,Table:5,Product:6,Spacer:7,DropShadow:8,HorizontalRule:9,Header:10,Review:11,Video:13,Coupon:14},Mn={0:"Text",1:"Image",2:"Button",3:"Social",4:"Split",5:"Table",6:"Product",7:"Spacer",8:"DropShadow",9:"HorizontalRule",10:"Header",11:"Review",13:"Video",14:"Coupon"},Hn=600;function Wn(t){var h,S,k,x,_;const n=[],e=zn(t);if(!e)throw new Error("klaviyoToEasyEmailPro: input has no { body: { sections } } — pass the template `.data`, not the outer entry");const o=((h=e.body)==null?void 0:h.attributes)||{},i=no((S=o.width)!=null?S:o.content_width,Hn),r=xt(o.background_color,o.bg_color,""),a=e.styles||[],l=((k=a.find(A=>(A==null?void 0:A.style_type)===200))==null?void 0:k.attributes)||{},s=((x=a.find(A=>(A==null?void 0:A.style_type)===300))==null?void 0:x.attributes)||{},d=xt(l.font_family),u=xt(l.color),g=xt(s.color),c={contentWidthPx:i,warnings:n,globalParagraphStyle:l},f=(((_=e.body)==null?void 0:_.sections)||[]).slice().sort(rt).flatMap(A=>vn(A,c));return{page:{type:m.PAGE,data:{breakpoint:i>700?"768px":"600px",globalAttributes:v({"font-family":d}),categoryAttributes:{},blockAttributes:{},classAttributes:{},preheader:""},attributes:v(N({width:`${i}px`,"background-color":r,"content-background-color":"","margin-top":"0px","margin-bottom":"0px","link-color":g},u?{color:u}:{})),children:f},warnings:n}}function zn(t){var n,e,o;return t?(n=t.body)!=null&&n.sections?t:(o=(e=t.data)==null?void 0:e.body)!=null&&o.sections?t.data:null:null}function vn(t,n){var d,u,g;const e=((d=t.data)==null?void 0:d.rows)||[];if(e.length===0)return[];const o=N({},((u=t.data)==null?void 0:u.attributes)||{});let i=!1,r;const l=e.flatMap(c=>{var p;return(((p=c.data)==null?void 0:p.columns)||[]).flatMap(f=>{var T;return((T=f.data)==null?void 0:T.blocks)||[]})}).filter(c=>{var p;return((p=c.data)==null?void 0:p.block_type)!==Z.Spacer});if(l.length===1){const c=((g=l[0].data)==null?void 0:g.attributes)||{};o.background_color==null&&c.block_background_color!=null&&(r=b(o.background_color,o.content_color),o.background_color=c.block_background_color,i=!0),o.inner_padding_top==null&&c.block_padding_top!=null&&(o.inner_padding_top=c.block_padding_top,i=!0),o.inner_padding_right==null&&c.block_padding_right!=null&&(o.inner_padding_right=c.block_padding_right,i=!0),o.inner_padding_bottom==null&&c.block_padding_bottom!=null&&(o.inner_padding_bottom=c.block_padding_bottom,i=!0),o.inner_padding_left==null&&c.block_padding_left!=null&&(o.inner_padding_left=c.block_padding_left,i=!0)}const s=z(N({},n),{sectionAttrs:o,hoistedToSection:i,originalSectionBg:r});return e.slice().sort(rt).flatMap(c=>Fn(c,s))}function Fn(t,n){var c;const e=(((c=t.data)==null?void 0:c.columns)||[]).slice().sort(rt);if(e.length===0)return[];const o=n.sectionAttrs||{},i=b(o.background_url),r=b(o.background_color,o.content_color),a=b(o.background_format),l=o.background_repeat===!1?"no-repeat":o.background_repeat===!0?"repeat":"",s=b(o.background_position),d=v(z(N({"background-color":r,"background-url":i,"background-position":s,"background-repeat":l,"background-size":a==="cover"?"cover":a==="contain"?"contain":""},i?{"background-image-enabled":"true"}:{}),{"padding-top":R(o.inner_padding_top)||"0px","padding-right":R(o.inner_padding_right)||"0px","padding-bottom":R(o.inner_padding_bottom)||"0px","padding-left":R(o.inner_padding_left)||"0px"})),u={type:m.STANDARD_SECTION,data:{},attributes:d,children:[]},g=e.map(p=>Gn(p,n));if(e.length===1)u.children=g;else{const p={type:m.STANDARD_GROUP,data:{},attributes:{},children:g};u.children=[p]}return[u]}function Gn(t,n){var i;const o=(((i=t.data)==null?void 0:i.blocks)||[]).slice().sort(rt).flatMap(r=>Un(r,n));return{type:m.STANDARD_COLUMN,data:{},attributes:{},children:o}}function Un(t,n){var o;const e=(o=t.data)==null?void 0:o.block_type;switch(e){case Z.Text:return jn(t,n);case Z.Spacer:return Vn(t,n);case Z.HorizontalRule:return eo(t,n);case Z.Image:return Kn(t,n);case Z.Button:return Xn(t,n);case Z.Social:return qn(t,n);case Z.Header:return to(t,n);case Z.Split:return Qn(t,n);case Z.Table:return Zn(t);default:{const i=Mn[e]||`Unknown(${e})`;return n.warnings.push(`block:${i}`),[he(`[TODO Klaviyo block_type=${e} (${i})]`)]}}}function jn(t,n){var $;const e=it(t,n),o=((($=t.data)==null?void 0:$.content)||"").trim();if(!o)return[];const i=(L,F)=>{var U;return(U=e[L])!=null?U:F?e[F]:void 0},r=ot(i("block_padding_top","block-padding-top"),i("inner_padding_top","inner-padding-top")),a=ot(i("block_padding_right","block-padding-right"),i("inner_padding_right","inner-padding-right")),l=ot(i("block_padding_bottom","block-padding-bottom"),i("inner_padding_bottom","inner-padding-bottom")),s=ot(i("block_padding_left","block-padding-left"),i("inner_padding_left","inner-padding-left")),d=io(o),u=b(i("text_align","text-align"),d.styles["text-align"]),g=b(i("color"),d.styles.color),c=b(i("font_family","font-family"),d.styles["font-family"]),p=b(i("font_size","font-size"),d.styles["font-size"]),f=n.globalParagraphStyle||{},T=b(i("line_height","line-height"),d.styles["line-height"],f.line_height),h=b(i("letter_spacing","letter-spacing"),d.styles["letter-spacing"]),S=b(i("font_weight","font-weight"),d.styles["font-weight"]),k=b(i("font_style","font-style"),d.styles["font-style"]),x=b(i("block_background_color"),i("background_color")),_=b(i("block_border_width")),A=b(i("block_border_color")),y=b(i("block_border_style")),w=d.tag||oo(o),D=w==="h1"?m.STANDARD_H1:w==="h2"?m.STANDARD_H2:w==="h3"?m.STANDARD_H3:m.STANDARD_PARAGRAPH,C=v({align:u,color:g,"font-family":c,"font-size":G(p),"font-weight":S,"font-style":k,"letter-spacing":G(h),"line-height":T,padding:"0px","padding-top":r||"0px","padding-right":a||"0px","padding-bottom":l||"0px","padding-left":s||"0px","container-background-color":x,border:_&&y&&A?`${G(_)} ${y} ${A}`:""}),E=(o.match(/<p[\s>]/gi)||[]).length>1?[{text:o}]:j(o)||[{text:Ft(o)}];return[{type:D,data:{},attributes:C,children:E}]}function Vn(t,n){const e=it(t,n),o=at(e.height),i=b(e.background_color)||(n.hoistedToSection?n.originalSectionBg||"transparent":"");return[{type:m.STANDARD_SPACER,data:{},attributes:v({height:`${o!=null?o:30}px`,"container-background-color":i}),children:[{text:""}]}]}function Kn(t,n){const e=it(t,n),o=b(e.cropped_src,e.src);if(!o)return[];const i=(h,S)=>{var k;return(k=e[h])!=null?k:S?e[S]:void 0},r=b(e.max_width),a=b(e.align)||"center",l=ot(i("block_padding_top","block-padding-top"),i("inner_padding_top","inner-padding-top")),s=ot(i("block_padding_right","block-padding-right"),i("inner_padding_right","inner-padding-right")),d=ot(i("block_padding_bottom","block-padding-bottom"),i("inner_padding_bottom","inner-padding-bottom")),u=ot(i("block_padding_left","block-padding-left"),i("inner_padding_left","inner-padding-left")),g=b(i("border_width")),c=b(i("border_color")),p=b(i("border_style")),f=e.full_width_mobile===!0||e.mobile_stretch_content===!0,T=v(N({src:o,alt:b(e.alt_text),href:b(e.href),align:a,width:r?G(r):"",padding:"0px","padding-top":l||"0px","padding-right":s||"0px","padding-bottom":d||"0px","padding-left":u||"0px","container-background-color":b(e.block_background_color,e.background_color),border:g&&p&&c?`${G(g)} ${p} ${c}`:""},f?{"fluid-on-mobile":"true"}:{}));return[{type:m.STANDARD_IMAGE,data:{},attributes:T,children:[{text:""}]}]}function Xn(t,n){var p;const e=it(t,n),o=(((p=t.data)==null?void 0:p.content)||"").trim(),i=(f,T)=>{var h;return(h=e[f])!=null?h:T?e[T]:void 0},r=b(i("border_width")),a=b(i("border_color")),l=b(i("border_style")),s=r&&l&&a?`${G(r)} ${l} ${a}`:"",d=b(i("font_style")),u=e.stretch===!0,g=v({align:b(i("text_align","text-align"))||"center",href:b(i("href")),color:b(i("color")),"background-color":b(i("background_color")),"border-radius":R(i("border_radius")),border:s,"font-family":b(i("font_family","font-family")),"font-size":G(b(i("font_size","font-size"))),"font-weight":b(i("font_weight","font-weight")),"font-style":d,"line-height":"100%","letter-spacing":G(b(i("letter_spacing","letter-spacing"))),"text-decoration":b(i("text_decoration","text-decoration")),"inner-padding-top":R(i("inner_padding_top","inner-padding-top")),"inner-padding-right":R(i("inner_padding_right","inner-padding-right")),"inner-padding-bottom":R(i("inner_padding_bottom","inner-padding-bottom")),"inner-padding-left":R(i("inner_padding_left","inner-padding-left")),padding:"0px","padding-top":R(i("block_padding_top","block-padding-top"))||"0px","padding-right":R(i("block_padding_right","block-padding-right"))||"0px","padding-bottom":R(i("block_padding_bottom","block-padding-bottom"))||"0px","padding-left":R(i("block_padding_left","block-padding-left"))||"0px","container-background-color":b(i("block_background_color")),width:u?"100%":""}),c=j(o)||[{text:o}];return[{type:m.STANDARD_BUTTON,data:{},attributes:g,children:c}]}function qn(t,n){var s;const e=it(t,n),o=(d,u)=>{var g;return(g=e[d])!=null?g:u?e[u]:void 0},r=(((s=t.data)==null?void 0:s.sub_blocks)||[]).slice().sort(rt).filter(d=>d.block_type===2).map(d=>{const u=d.attributes||{},g=b(u.type).toLowerCase(),c=b(u.link_url,u["link-url"]),p=b(u.text),f=b(u.icon_url);return{type:m.STANDARD_SOCIAL_ELEMENT,data:{},attributes:v(z(N({name:g},f?{mode:"custom",src:f}:{}),{href:c,alt:p||g,title:p||g,target:c?"_blank":""})),children:[{text:""}]}});if(r.length===0)return[];const a=at(o("spacing")),l=a!=null?`0px ${a}px`:"";return[{type:m.STANDARD_SOCIAL,data:{},attributes:v({align:b(o("align"))||"center",mode:e.stack_on_mobile===!0?"vertical":"horizontal","icon-size":G(b(o("size"))),"inner-padding":l,"padding-top":R(o("block_padding_top","block-padding-top")),"padding-right":R(o("block_padding_right","block-padding-right")),"padding-bottom":R(o("block_padding_bottom","block-padding-bottom")),"padding-left":R(o("block_padding_left","block-padding-left")),"container-background-color":b(o("block_background_color"))}),children:r}]}function Zn(t,n){var _,A;const e=((_=t.data)==null?void 0:_.attributes)||{},o=(((A=t.data)==null?void 0:A.sub_blocks)||[]).slice().sort(rt);if(o.length===0)return[];const i=(y,w)=>{var D;return(D=e[y])!=null?D:w?e[w]:void 0},r=at(i("static_num_columns"))||o.length,a=Math.max(1,Math.floor(r)),l=e.headers_enabled===!0,s=o.map(y=>Jn(y)),d=[];for(let y=0;y<s.length;y+=a)d.push(s.slice(y,y+a));const u=b(i("table_background_color")),g=R(i("cell_padding_top"))||"10px",c=R(i("cell_padding_right"))||"10px",p=R(i("cell_padding_bottom"))||"10px",f=R(i("cell_padding_left"))||"10px",T=b(i("block_border_width")),h=b(i("block_border_color")),S=b(i("block_border_style")),k=!!T&&!!h,x=d.map((y,w)=>{const D=l&&w===0;return{type:m.STANDARD_TABLE2_TR,data:{},attributes:v({"background-color":D?u:""}),children:y.map(C=>Yn(C))}});return[{type:m.STANDARD_TABLE2,data:{},attributes:v({align:"center",width:"100%","table-layout":"auto","border-color":h,"border-style":S||"solid","border-width":G(T)||"1px","border-enabled":!!k,"cell-padding-top":g,"cell-padding-right":c,"cell-padding-bottom":p,"cell-padding-left":f,"padding-top":R(i("block_padding_top","block-padding-top")),"padding-right":R(i("block_padding_right","block-padding-right")),"padding-bottom":R(i("block_padding_bottom","block-padding-bottom")),"padding-left":R(i("block_padding_left","block-padding-left")),"container-background-color":b(i("block_background_color"))}),children:x}]}function Jn(t){const n=t.attributes||{};if(t.block_type===6){const e=b(n.cropped_src,n.src);if(!e)return"";const o=b(n.image_width,n.width),i=b(n.image_align),r=b(n.href),a=[];o&&a.push(`width:${G(o)}`),a.push("display:block"),i==="center"?a.push("margin:0 auto"):i==="right"&&a.push("margin-left:auto");const l=` style="${a.join(";")}"`,s=`<img src="${e}" alt="${Bt(b(n.alt))}"${l}>`;return r?`<a href="${r}">${s}</a>`:s}return(t.content||"").trim()}function Yn(t){const n=j(t)||[{text:Ft(t)||""}];return{type:m.STANDARD_TABLE2_TD,data:{rowspan:1,colspan:1},attributes:{},children:n}}function Qn(t,n){var S,k;const e=it(t,n),o=(((S=t.data)==null?void 0:S.sub_blocks)||[]).slice().sort(rt);if(o.length===0)return[];const i=(x,_)=>{var A;return(A=e[x])!=null?A:_?e[_]:void 0},r=b(i("block_background_color")),a=R(i("block_padding_top","block-padding-top")),l=R(i("block_padding_bottom","block-padding-bottom")),s=R(i("block_padding_left","block-padding-left")),d=R(i("block_padding_right","block-padding-right")),u=(k=at(i("padding_in_between")))!=null?k:0,g=(()=>{const _=b(i("column_widths")).match(/^(\d+(?:\.\d+)?)%$/);return _?parseFloat(_[1]):null})(),c=x=>{const _=x.attributes||{};if(x.block_type===6){const A=b(_.cropped_src,_.src);if(!A)return null;const y=b(_.image_width,_.width),w=y?` width="${parseInt(y,10)||y}"`:"",D=Bt(b(_.alt,_.alt_text));return`<img src="${Bt(A)}" alt="${D}"${w} style="display:block;max-width:100%;border:0;">`}return x.block_type===5||x.block_type===7?(x.content||"").trim():null};if(o.length===1){const x=o[0],_=x.attributes||{};if(x.block_type===6){const y=b(_.cropped_src,_.src);return y?[{type:m.STANDARD_IMAGE,data:{},attributes:v({src:y,alt:b(_.alt,_.alt_text),href:b(_.href,_.link_url),align:b(_.image_align)||"center",width:b(_.image_width,_.width)?G(b(_.image_width,_.width)):"",padding:"0px","padding-top":a||"0px","padding-right":d||"0px","padding-bottom":l||"0px","padding-left":s||"0px","container-background-color":r}),children:[{text:""}]}]:[]}const A=(x.content||"").trim();return A?[{type:m.STANDARD_PARAGRAPH,data:{},attributes:v({padding:"0px","padding-top":a||"0px","padding-right":d||"0px","padding-bottom":l||"0px","padding-left":s||"0px","container-background-color":r}),children:j(A)||[{text:Ft(A)}]}]:[]}const p=(()=>{if(g!=null&&o.length===2)return[g,100-g];const x=(100/o.length).toFixed(2);return o.map(()=>parseFloat(x))})(),T=`<table role="presentation" cellspacing="0" cellpadding="0" border="0" style="width:100%;border-collapse:collapse"><tr>${o.map((x,_)=>{const A=c(x);if(A==null)return"";const y=p[_]!=null?`width:${p[_]}%;`:"",D=!(_===o.length-1)&&u>0?`padding-right:${u/2}px;`:"",C=_>0&&u>0?`padding-left:${u/2}px;`:"";return`<td valign="top" style="${y}${D}${C}">${A}</td>`}).join("")}</tr></table>`,h=[{type:m.HTML_BLOCK_NODE,data:{tagName:"div"},attributes:{},children:[{text:T}]}];return[{type:m.STANDARD_PARAGRAPH,data:{},attributes:v({padding:"0px","padding-top":a||"0px","padding-right":d||"0px","padding-bottom":l||"0px","padding-left":s||"0px","container-background-color":r}),children:h}]}function to(t,n){var _;const e=it(t,n),o=(((_=t.data)==null?void 0:_.sub_blocks)||[]).slice().sort(rt),i=(A,y)=>{var w;return(w=e[A])!=null?w:y?e[y]:void 0},r=b(i("block_background_color")),a=R(i("block_padding_top","block-padding-top")),l=R(i("block_padding_right","block-padding-right")),s=R(i("block_padding_bottom","block-padding-bottom")),d=R(i("block_padding_left","block-padding-left")),u=b(i("color")),g=b(i("font_family","font-family")),c=G(b(i("font_size","font-size"))),p=b(i("font_weight","font-weight")),f=b(i("font_style","font-style")),T=G(b(i("letter_spacing","letter-spacing"))),h=b(i("text_decoration","text-decoration")),S=R(i("logo_link_spacing")),k=[];for(const A of o){const y=A.attributes||{};if(A.block_type===10||A.block_type===12){const w=b(y.src);if(!w)continue;const D=b(y.width),C=b(y.height);k.push({type:m.STANDARD_IMAGE,data:{},attributes:v({src:w,alt:b(y.alt_text,y.alt),href:b(y.link_url,y["link-url"],y.href),align:b(i("logo_align"))||"center",width:D?G(D):"",height:C?G(C):"",padding:"0px","padding-top":a||"0px","padding-right":l||"0px","padding-bottom":S||"0px","padding-left":d||"0px","container-background-color":r}),children:[{text:""}]})}}const x=o.filter(A=>A.block_type===11);if(x.length>0){const A=v({color:u,"font-family":g,"font-size":c,"font-weight":p,"font-style":f,"letter-spacing":T,"line-height":"100%","text-decoration":h||"none","text-transform":"none","padding-top":"10px","padding-right":"10px","padding-bottom":"10px","padding-left":"10px"}),y=x.map(w=>{const D=b((w.attributes||{}).text,w.content),C=b((w.attributes||{}).link_url,(w.attributes||{})["link-url"]);return{type:m.STANDARD_NAVBAR_LINK,data:{},attributes:v(N({href:C,target:C?"_blank":""},A)),children:[{text:D}]}});k.push({type:m.STANDARD_NAVBAR,data:{},attributes:v({align:b(i("item_align"))||"center","padding-top":"0px","padding-right":l,"padding-bottom":s,"padding-left":d,"container-background-color":r}),children:y})}return k.length===0?[he("[TODO Klaviyo Header (no recognized sub_blocks)]")]:k}function eo(t,n){const e=it(t,n),o=(i,r)=>{var a;return(a=e[i])!=null?a:r?e[r]:void 0};return[{type:m.STANDARD_DIVIDER,data:{},attributes:v({"border-color":b(o("border_color")),"border-style":b(o("border_style"))||"solid","border-width":G(b(o("border_width"))||"1"),width:"100%",padding:"0px","padding-top":R(o("block_padding_top","block-padding-top"))||"0px","padding-right":R(o("block_padding_right","block-padding-right"))||"0px","padding-bottom":R(o("block_padding_bottom","block-padding-bottom"))||"0px","padding-left":R(o("block_padding_left","block-padding-left"))||"0px","container-background-color":b(o("block_background_color"))}),children:[{text:""}]}]}function it(t,n){var o;const e=N({},((o=t.data)==null?void 0:o.attributes)||{});return n.hoistedToSection&&(delete e.block_background_color,delete e.block_padding_top,delete e.block_padding_right,delete e.block_padding_bottom,delete e.block_padding_left,delete e["block-padding-top"],delete e["block-padding-right"],delete e["block-padding-bottom"],delete e["block-padding-left"]),e}function he(t){return{type:m.STANDARD_PARAGRAPH,data:{},attributes:{color:"#888888","font-size":"12px"},children:[{text:t}]}}function rt(t,n){var e,o;return((e=t.position)!=null?e:0)-((o=n.position)!=null?o:0)}function no(t,n){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"){const e=parseInt(t,10);if(Number.isFinite(e)&&e>0)return e}return n}function xt(...t){for(const n of t)if(typeof n=="string"&&n.length>0)return n;return""}function v(t){const n={};for(const e of Object.keys(t))t[e]!==""&&t[e]!=null&&(n[e]=t[e]);return n}function b(...t){for(const n of t){if(typeof n=="string"&&n.length>0)return n;if(typeof n=="number"&&Number.isFinite(n))return String(n)}return""}function ot(t,n){const e=at(t),o=at(n);return e==null&&o==null?"":`${(e||0)+(o||0)}px`}function at(t){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"){const n=t.match(/^(-?\d+(?:\.\d+)?)/);if(n)return parseFloat(n[1])}return null}function G(t){return t?/^\d+(?:\.\d+)?$/.test(t)?`${t}px`:t:""}function R(t){const n=at(t);return n==null?"":`${n}px`}function oo(t){const n=t.match(/<\s*(h1|h2|h3|p|div)\b/i);return n?n[1].toLowerCase():"p"}function io(t){const n=t.match(/^\s*<(p|h[1-6]|div)\b([^>]*)>([\s\S]*?)<\/\1>\s*$/i);if(!n)return{tag:"",styles:{}};const e=n[1].toLowerCase(),i=n[2].match(/style\s*=\s*"([^"]*)"/i),r={};if(i)for(const a of i[1].split(";")){const l=a.indexOf(":");if(l<0)continue;const s=a.slice(0,l).trim().toLowerCase(),d=a.slice(l+1).trim();s&&d&&(r[s]=d)}return{tag:e,styles:r}}function Ft(t){return t.replace(/<[^>]*>/g,"")}function Bt(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}exports.beefreeToEasyEmailPro=mn;exports.htmlToTextNodes=j;exports.klaviyoToEasyEmailPro=Wn;exports.unlayerToEasyEmailPro=Ne;