@maily-to/render 0.0.14 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var T=Object.defineProperty,rt=Object.defineProperties,it=Object.getOwnPropertyDescriptor,st=Object.getOwnPropertyDescriptors,at=Object.getOwnPropertyNames,E=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var P=(c,t,n)=>t in c?T(c,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):c[t]=n,g=(c,t)=>{for(var n in t||(t={}))R.call(t,n)&&P(c,n,t[n]);if(E)for(var n of E(t))I.call(t,n)&&P(c,n,t[n]);return c},x=(c,t)=>rt(c,st(t));var U=(c,t)=>{var n={};for(var e in c)R.call(c,e)&&t.indexOf(e)<0&&(n[e]=c[e]);if(c!=null&&E)for(var e of E(c))t.indexOf(e)<0&&I.call(c,e)&&(n[e]=c[e]);return n};var lt=(c,t)=>{for(var n in t)T(c,n,{get:t[n],enumerable:!0})},ct=(c,t,n,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of at(t))!R.call(c,i)&&i!==n&&T(c,i,{get:()=>t[i],enumerable:!(e=it(t,i))||e.enumerable});return c};var pt=c=>ct(T({},"__esModule",{value:!0}),c);var C=(c,t,n)=>new Promise((e,i)=>{var r=p=>{try{a(n.next(p))}catch(u){i(u)}},s=p=>{try{a(n.throw(p))}catch(u){i(u)}},a=p=>p.done?e(p.value):Promise.resolve(p.value).then(r,s);a((n=n.apply(c,t)).next())});var _t={};lt(_t,{DEFAULT_COLUMNS_GAP:()=>ot,DEFAULT_COLUMNS_WIDTH:()=>yt,DEFAULT_COLUMN_BACKGROUND_COLOR:()=>St,DEFAULT_COLUMN_BORDER_COLOR:()=>Ot,DEFAULT_COLUMN_BORDER_RADIUS:()=>bt,DEFAULT_COLUMN_BORDER_WIDTH:()=>wt,DEFAULT_COLUMN_PADDING_BOTTOM:()=>Nt,DEFAULT_COLUMN_PADDING_LEFT:()=>Et,DEFAULT_COLUMN_PADDING_RIGHT:()=>vt,DEFAULT_COLUMN_PADDING_TOP:()=>Ct,DEFAULT_SECTION_ALIGN:()=>H,DEFAULT_SECTION_BACKGROUND_COLOR:()=>j,DEFAULT_SECTION_BORDER_COLOR:()=>q,DEFAULT_SECTION_BORDER_WIDTH:()=>G,DEFAULT_SECTION_MARGIN_BOTTOM:()=>Y,DEFAULT_SECTION_MARGIN_LEFT:()=>Q,DEFAULT_SECTION_MARGIN_RIGHT:()=>K,DEFAULT_SECTION_MARGIN_TOP:()=>$,DEFAULT_SECTION_PADDING_BOTTOM:()=>et,DEFAULT_SECTION_PADDING_LEFT:()=>nt,DEFAULT_SECTION_PADDING_RIGHT:()=>tt,DEFAULT_SECTION_PADDING_TOP:()=>Z,Maily:()=>N,render:()=>Tt});module.exports=pt(_t);var A=require("react"),l=require("@react-email/components"),z=require("@react-email/render");var ut=c=>Object.prototype.toString.call(c);var ht=c=>ut(c)==="[object Object]";function dt(c){return Object.keys(c)}function L(c,...t){if(!t.length)return c;let n=t.shift();return n===void 0?c:(_(c)&&_(n)&&dt(n).forEach(e=>{e==="__proto__"||e==="constructor"||e==="prototype"||(_(n[e])?(c[e]||(c[e]={}),_(c[e])?L(c[e],n[e]):c[e]=n[e]):c[e]=n[e])}),L(c,...t))}function _(c){return ht(c)&&!Array.isArray(c)}var Jt=Symbol("p-void");function M(){return Math.random().toString(36).substr(2,6)}var o=require("react/jsx-runtime");var mt={sm:"8px",md:"16px",lg:"32px",xl:"64px"},v={WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"};var ft={h1:{fontSize:"36px",lineHeight:"40px",fontWeight:800},h2:{fontSize:"30px",lineHeight:"36px",fontWeight:700},h3:{fontSize:"24px",lineHeight:"38px",fontWeight:600}};var W={sm:"40px",md:"48px",lg:"64px"},gt={pretty:!1,plainText:!1},X={colors:{heading:"#111827",paragraph:"#374151",horizontal:"#EAEAEA",footer:"#64748B",blockquoteBorder:"#D1D5DB",codeBackground:"#EFEFEF",codeText:"#111827",linkCardTitle:"#111827",linkCardDescription:"#6B7280",linkCardBadgeText:"#111827",linkCardBadgeBackground:"#FEF08A",linkCardSubTitle:"#6B7280"},fontSize:{paragraph:"15px",footer:{size:"14px",lineHeight:"24px"}}},xt='SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',j="#ffffff",H="left",G=1,q="#000000",$=0,K=0,Y=0,Q=0,Z=5,tt=5,et=5,nt=5,yt="100%",ot=8,St="transparent",bt=0,wt=0,Ot="transparent",Ct=0,vt=0,Nt=0,Et=0,N=class{constructor(t={type:"doc",content:[]}){this.config={theme:X};this.variableFormatter=({variable:t,fallback:n})=>n?`{{${t},fallback=${n}}}`:`{{${t}}}`;this.shouldReplaceVariableValues=!1;this.variableValues=new Map;this.linkValues=new Map;this.payloadValues=new Map;this.content=t}setPreviewText(t){this.config.preview=t}setTheme(t){this.config.theme=L(this.config.theme||X,t)}setVariableFormatter(t){this.variableFormatter=t}setVariableValue(t,n){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.variableValues.set(t,n)}setVariableValues(t){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),Object.entries(t).forEach(([n,e])=>{this.setVariableValue(n,e)})}setLinkValue(t,n){this.linkValues.set(t,n)}setLinkValues(t){Object.entries(t).forEach(([n,e])=>{this.setLinkValue(n,e)})}setPayloadValue(t,n){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.payloadValues.set(t,n)}setPayloadValues(t){Object.entries(t).forEach(([n,e])=>{this.setPayloadValue(n,e)})}setOpenTrackingPixel(t){this.openTrackingPixel=t}setShouldReplaceVariableValues(t){this.shouldReplaceVariableValues=t}getAllLinks(){let t=this.content.content||[],n=new Set,e=r=>r&&this.isValidUrl(r)&&!r.startsWith("#")&&!r.startsWith("mailto:")&&!r.startsWith("tel:")&&typeof r=="string",i=r=>{var s;if(r.type==="button"){let a=(s=r.attrs)==null?void 0:s.url;e(a)&&a&&n.add(a)}else r.content&&r.content.forEach(a=>{a.marks&&a.marks.forEach(p=>{var h;let u=(h=p.attrs)==null?void 0:h.href;p.type==="link"&&e(u)&&n.add(u)}),a.content&&i(a)})};return t.forEach(r=>{i(r)}),n}isValidUrl(t){try{let n=new URL(t);return!0}catch(n){return!1}}render(){return C(this,arguments,function*(t=gt){let n=this.markup();return(0,z.renderAsync)(n,t)})}markup(){let t=this.content.content||[],n=t.map((r,s)=>{let a={prev:t[s-1],next:t[s+1],parent:r},p=this.renderNode(r,a);return p?(0,o.jsx)(A.Fragment,{children:p},M()):null}),{preview:e}=this.config;return(0,o.jsxs)(l.Html,{children:[(0,o.jsxs)(l.Head,{children:[(0,o.jsx)(l.Font,{fallbackFontFamily:"sans-serif",fontFamily:"Inter",fontStyle:"normal",fontWeight:400,webFont:{url:"https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19",format:"woff2"}}),(0,o.jsx)("style",{dangerouslySetInnerHTML:{__html:"blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}@media only screen and (max-width:425px){.tab-row-full{width:100%!important}.tab-col-full{display:block!important;width:100%!important}.tab-pad{padding:0!important}}"}}),(0,o.jsx)("meta",{content:"width=device-width",name:"viewport"}),(0,o.jsx)("meta",{content:"IE=edge",httpEquiv:"X-UA-Compatible"}),(0,o.jsx)("meta",{name:"x-apple-disable-message-reformatting"}),(0,o.jsx)("meta",{content:"telephone=no,address=no,email=no,date=no,url=no",name:"format-detection"}),(0,o.jsx)("meta",{content:"light",name:"color-scheme"}),(0,o.jsx)("meta",{content:"light",name:"supported-color-schemes"})]}),(0,o.jsxs)(l.Body,{style:{margin:0},children:[e?(0,o.jsx)(l.Preview,{id:"__react-email-preview",children:e}):null,(0,o.jsx)(l.Container,{style:{maxWidth:"600px",minWidth:"300px",width:"100%",marginLeft:"auto",marginRight:"auto",padding:"0.5rem"},children:n}),this.openTrackingPixel?(0,o.jsx)(l.Img,{alt:"",src:this.openTrackingPixel,style:{display:"none",width:"1px",height:"1px"}}):null]})]})}getMarginOverrideConditions(t,n){let{parent:e,prev:i,next:r}=n||{},s=(r==null?void 0:r.type)==="spacer",a=(i==null?void 0:i.type)==="spacer",p=(e==null?void 0:e.type)==="listItem",u=(e==null?void 0:e.type)==="section"&&!r,h=(e==null?void 0:e.type)==="section"&&!i,d=(e==null?void 0:e.type)==="column"&&!r,m=(e==null?void 0:e.type)==="column"&&!i,f=(e==null?void 0:e.type)==="for"&&!i,y=(e==null?void 0:e.type)==="for"&&!r,S=(e==null?void 0:e.type)==="show"&&!i,b=(e==null?void 0:e.type)==="show"&&!r;return{isNextSpacer:s,isPrevSpacer:a,isLastSectionElement:u,isFirstSectionElement:h,isParentListItem:p,isLastColumnElement:d,isFirstColumnElement:m,isFirstForElement:f,isLastForElement:y,isFirstShowElement:S,isLastShowElement:b,shouldRemoveTopMargin:a||h||m||f||S,shouldRemoveBottomMargin:s||u||d||y||b}}getMappedContent(t,n){let e=t.content||[];return e.map((i,r)=>{let s=this.renderNode(i,x(g({},n),{next:e[r+1],prev:e[r-1]}));return s?(0,o.jsx)(A.Fragment,{children:s},M()):null}).filter(i=>i!==null)}renderNode(t,n={}){var i;let e=t.type||"";if(e in this)return(i=this[e])==null?void 0:i.call(this,t,n);throw new Error(`Node type "${e}" is not supported.`)}renderMark(t){let n=(t==null?void 0:t.text)||(0,o.jsx)(o.Fragment,{children:"\xA0"});return((t==null?void 0:t.marks)||[]).reduce((i,r)=>{var a;let s=r.type;if(s in this)return(a=this[s])==null?void 0:a.call(this,r,i);throw new Error(`Mark type "${s}" is not supported.`)},(0,o.jsx)(o.Fragment,{children:n}))}paragraph(t,n){var a,p,u,h;let{attrs:e}=t,i=(e==null?void 0:e.textAlign)||"left",{isParentListItem:r,shouldRemoveBottomMargin:s}=this.getMarginOverrideConditions(t,n);return(0,o.jsx)(l.Text,{style:g({textAlign:i,marginBottom:r||s?"0px":"20px",marginTop:"0px",fontSize:(p=(a=this.config.theme)==null?void 0:a.fontSize)==null?void 0:p.paragraph,color:(h=(u=this.config.theme)==null?void 0:u.colors)==null?void 0:h.paragraph},v),children:t.content?this.getMappedContent(t,x(g({},n),{parent:t})):(0,o.jsx)(o.Fragment,{children:"\xA0"})})}text(t,n){let e=t.text||"&nbsp";return t.marks?this.renderMark(t):(0,o.jsx)(o.Fragment,{children:e})}bold(t,n){return(0,o.jsx)("strong",{children:n})}italic(t,n){return(0,o.jsx)("em",{children:n})}underline(t,n){return(0,o.jsx)("u",{children:n})}strike(t,n){return(0,o.jsx)("s",{style:{textDecoration:"line-through"},children:n})}textStyle(t,n){var r,s;let{attrs:e}=t,{color:i=(s=(r=this.config.theme)==null?void 0:r.colors)==null?void 0:s.paragraph}=e||{};return(0,o.jsx)("span",{style:{color:i},children:n})}link(t,n){var a,p;let{attrs:e}=t,i=(e==null?void 0:e.href)||"#",r=(e==null?void 0:e.target)||"_blank",s=(e==null?void 0:e.rel)||"noopener noreferrer nofollow";return(typeof this.linkValues=="object"||typeof this.variableValues=="object")&&(i=this.linkValues.get(i)||this.variableValues.get(i)||i),(0,o.jsx)(l.Link,{href:i,rel:s,style:{fontWeight:500,textDecoration:"underline",color:(p=(a=this.config.theme)==null?void 0:a.colors)==null?void 0:p.heading},target:r,children:n})}heading(t,n){var h,d;let{attrs:e}=t,i=`h${Number(e==null?void 0:e.level)||1}`,r=(e==null?void 0:e.textAlign)||"left",{shouldRemoveBottomMargin:s}=this.getMarginOverrideConditions(t,n),{fontSize:a,lineHeight:p,fontWeight:u}=ft[i];return(0,o.jsx)(l.Heading,{as:i,style:{textAlign:r,color:(d=(h=this.config.theme)==null?void 0:h.colors)==null?void 0:d.heading,marginBottom:s?"0":"12px",marginTop:0,fontSize:a,lineHeight:p,fontWeight:u},children:this.getMappedContent(t,x(g({},n),{parent:t}))})}variable(t,n){var p,u,h;let{payloadValue:e}=n||{},{id:i,fallback:r}=t.attrs||{};if(!this.shouldShow(t,n)||!i)return(0,o.jsx)(o.Fragment,{});let a=this.variableFormatter({variable:i,fallback:r});return this.shouldReplaceVariableValues&&(a=(h=(u=(p=typeof e=="object"?e[i]:e)!=null?p:this.variableValues.get(i))!=null?u:r)!=null?h:a),t!=null&&t.marks?this.renderMark({text:a,marks:t.marks}):(0,o.jsx)(o.Fragment,{children:a})}horizontalRule(t,n){return(0,o.jsx)(l.Hr,{style:{marginTop:"32px",marginBottom:"32px"}})}orderedList(t,n){let{shouldRemoveBottomMargin:e}=this.getMarginOverrideConditions(t,n);return(0,o.jsx)(l.Container,{children:(0,o.jsx)("ol",{style:{marginTop:"0px",marginBottom:e?"0":"20px",paddingLeft:"26px",listStyleType:"decimal"},children:this.getMappedContent(t,x(g({},n),{parent:t}))})})}bulletList(t,n){let{parent:e,next:i}=n||{},{shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(t,{parent:e,next:i});return(0,o.jsx)(l.Container,{style:{maxWidth:"100%"},children:(0,o.jsx)("ul",{style:{marginTop:"0px",marginBottom:r?"0":"20px",paddingLeft:"26px",listStyleType:"disc"},children:this.getMappedContent(t,x(g({},n),{parent:t}))})})}listItem(t,n){return(0,o.jsx)("li",{style:g({marginBottom:"8px",paddingLeft:"6px"},v),children:this.getMappedContent(t,x(g({},n),{parent:t}))})}button(t,n){let{attrs:e}=t,{text:i,url:r,variant:s,buttonColor:a,textColor:p,borderRadius:u,alignment:h="left"}=e||{};if(!this.shouldShow(t,n))return(0,o.jsx)(o.Fragment,{});let m="0px";u==="round"?m="9999px":u==="smooth"&&(m="6px");let{shouldRemoveBottomMargin:f}=this.getMarginOverrideConditions(t,n),y=this.linkValues.get(r)||this.variableValues.get(r)||r;return(0,o.jsx)(l.Container,{style:{textAlign:h,maxWidth:"100%",marginBottom:f?"0px":"20px"},children:(0,o.jsx)(l.Button,{href:y,style:{color:String(p),backgroundColor:s==="filled"?String(a):"transparent",borderColor:String(a),padding:s==="filled"?"12px 34px":"10px 34px",borderWidth:"2px",borderStyle:"solid",textDecoration:"none",fontSize:"14px",fontWeight:500,borderRadius:m},children:i})})}spacer(t,n){let{attrs:e}=t,{height:i="auto"}=e||{};return this.shouldShow(t,n)?(0,o.jsx)(l.Container,{style:{height:mt[i]||i}}):(0,o.jsx)(o.Fragment,{})}hardBreak(t,n){return(0,o.jsx)("br",{})}logo(t,n){let{attrs:e}=t,{src:i,alt:r,title:s,size:a,alignment:p="left"}=e||{};if(!this.shouldShow(t,n))return(0,o.jsx)(o.Fragment,{});let{shouldRemoveBottomMargin:h}=this.getMarginOverrideConditions(t,n);return(0,o.jsx)(l.Row,{style:{marginTop:"0px",marginBottom:h?"0px":"32px"},children:(0,o.jsx)(l.Column,{align:p,children:(0,o.jsx)(l.Img,{alt:r||s||"Logo",src:i,style:{width:W[a]||a,height:W[a]||a},title:s||r||"Logo"})})})}image(t,n){let{attrs:e}=t,{src:i,alt:r,title:s,width:a="auto",alignment:p="center",externalLink:u=""}=e||{};if(!this.shouldShow(t,n))return(0,o.jsx)(o.Fragment,{});let{shouldRemoveBottomMargin:d}=this.getMarginOverrideConditions(t,n),m=a==="auto"?"auto":Number(a),f=(0,o.jsx)(l.Img,{alt:r||s||"Image",src:i,style:{height:"auto",width:"100%",outline:"none",border:"none",textDecoration:"none"},height:"auto",width:m,title:s||r||"Image"});return(0,o.jsx)(l.Row,{style:{marginTop:"0px",marginBottom:d?"0px":"32px"},children:(0,o.jsx)(l.Column,{align:p,children:u?(0,o.jsx)("a",{href:u,rel:"noopener noreferrer",style:{display:"block",maxWidth:"100%",textDecoration:"none"},target:"_blank",children:f}):f})})}footer(t,n){var s,a,p,u,h,d,m,f;let{attrs:e}=t,{textAlign:i="left"}=e||{},{shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(t,n);return(0,o.jsx)(l.Text,{style:g({fontSize:(p=(a=(s=this.config.theme)==null?void 0:s.fontSize)==null?void 0:a.footer)==null?void 0:p.size,lineHeight:(d=(h=(u=this.config.theme)==null?void 0:u.fontSize)==null?void 0:h.footer)==null?void 0:d.lineHeight,color:(f=(m=this.config.theme)==null?void 0:m.colors)==null?void 0:f.footer,marginTop:"0px",marginBottom:r?"0px":"20px",textAlign:i},v),children:this.getMappedContent(t,x(g({},n),{parent:t}))})}blockquote(t,n){var r,s;let{isPrevSpacer:e,shouldRemoveBottomMargin:i}=this.getMarginOverrideConditions(t,n);return(0,o.jsx)("blockquote",{style:{borderLeftWidth:"4px",borderLeftStyle:"solid",borderLeftColor:(s=(r=this.config.theme)==null?void 0:r.colors)==null?void 0:s.blockquoteBorder,paddingLeft:"16px",marginLeft:"0px",marginRight:"0px",marginTop:e?"0px":"20px",marginBottom:i?"0px":"20px"},children:this.getMappedContent(t,x(g({},n),{parent:t}))})}code(t,n){var e,i,r,s;return(0,o.jsx)("code",{style:{backgroundColor:(i=(e=this.config.theme)==null?void 0:e.colors)==null?void 0:i.codeBackground,color:(s=(r=this.config.theme)==null?void 0:r.colors)==null?void 0:s.codeText,padding:"2px 4px",borderRadius:"6px",fontFamily:xt,fontWeight:400,letterSpacing:0},children:n})}linkCard(t,n){var f,y,S,b,w,O,V,k,J,D,B,F;let{attrs:e}=t,{shouldRemoveBottomMargin:i}=this.getMarginOverrideConditions(t,n),{title:r,description:s,link:a,linkTitle:p,image:u,badgeText:h,subTitle:d}=e||{},m=this.linkValues.get(a)||this.variableValues.get(a)||a||"#";return(0,o.jsxs)("a",{href:m,rel:"noopener noreferrer",style:{border:"1px solid #eaeaea",borderRadius:"10px",textDecoration:"none",color:"inherit",display:"block",marginBottom:i?"0px":"20px"},target:"_blank",children:[u?(0,o.jsx)(l.Row,{style:{marginBottom:"6px"},children:(0,o.jsx)(l.Column,{style:{width:"100%",height:"100%"},children:(0,o.jsx)(l.Img,{alt:r||"Link Card",src:u,style:{borderRadius:"10px 10px 0 0",width:"100%",height:"100%",objectFit:"cover"},title:r||"Link Card"})})}):null,(0,o.jsx)(l.Row,{style:{padding:"15px",marginTop:0,marginBottom:0},children:(0,o.jsxs)(l.Column,{style:{verticalAlign:"top"},children:[(0,o.jsxs)(l.Row,{align:void 0,style:{marginBottom:"8px",marginTop:"0px"},width:"auto",children:[(0,o.jsx)(l.Column,{children:(0,o.jsx)(l.Text,{style:g({fontSize:"18px",fontWeight:600,color:(y=(f=this.config.theme)==null?void 0:f.colors)==null?void 0:y.linkCardTitle,margin:"0px"},v),children:r})}),h||d?(0,o.jsxs)(l.Column,{style:{paddingLeft:"6px",verticalAlign:"middle"},children:[h?(0,o.jsx)("span",{style:{fontWeight:600,color:(b=(S=this.config.theme)==null?void 0:S.colors)==null?void 0:b.linkCardBadgeText,padding:"4px 8px",borderRadius:"8px",backgroundColor:(O=(w=this.config.theme)==null?void 0:w.colors)==null?void 0:O.linkCardBadgeBackground,fontSize:"12px",lineHeight:"12px"},children:h}):null," ",d&&!h?(0,o.jsx)("span",{style:{fontWeight:"normal",color:(k=(V=this.config.theme)==null?void 0:V.colors)==null?void 0:k.linkCardSubTitle,fontSize:"12px",lineHeight:"12px"},children:d}):null]}):null]}),(0,o.jsxs)(l.Text,{style:g({fontSize:"16px",color:(D=(J=this.config.theme)==null?void 0:J.colors)==null?void 0:D.linkCardDescription,marginTop:"0px",marginBottom:"0px"},v),children:[s," ",p?(0,o.jsx)("a",{href:m,rel:"noopener noreferrer",style:{color:(F=(B=this.config.theme)==null?void 0:B.colors)==null?void 0:F.linkCardTitle,fontSize:"14px",fontWeight:600,textDecoration:"underline"},children:p}):null]})]})})]})}section(t,n){let{attrs:e}=t,{borderRadius:i=0,backgroundColor:r=j,align:s=H,borderWidth:a=G,borderColor:p=q,marginTop:u=$,marginRight:h=K,marginBottom:d=Y,marginLeft:m=Q,paddingTop:f=Z,paddingRight:y=tt,paddingBottom:S=et,paddingLeft:b=nt}=e||{};return this.shouldShow(t,n)?(0,o.jsx)(l.Row,{style:{marginTop:u,marginRight:h,marginBottom:d,marginLeft:m},children:(0,o.jsx)(l.Column,{align:s,style:{borderColor:p,borderWidth:a,borderStyle:"solid",backgroundColor:r,borderRadius:i,paddingTop:f,paddingRight:y,paddingBottom:S,paddingLeft:b},children:this.getMappedContent(t,x(g({},n),{parent:t}))})}):(0,o.jsx)(o.Fragment,{})}columns(t,n){let{attrs:e}=t;if(!this.shouldShow(t,n))return(0,o.jsx)(o.Fragment,{});let[r,s]=this.adjustColumnsContent(t);return(0,o.jsx)(l.Row,{width:`${s}%`,style:{margin:0,padding:0,width:`${s}%`},className:"tab-row-full",children:this.getMappedContent(r,x(g({},n),{parent:r}))})}adjustColumnsContent(t){var h;let{content:n=[]}=t,e=100,i=n.filter(d=>{var m;return d.type==="column"&&!!Number(((m=d.attrs)==null?void 0:m.width)||0)}),r=n.filter(d=>{var m,f;return d.type==="column"&&(((m=d.attrs)==null?void 0:m.width)==="auto"||!((f=d.attrs)!=null&&f.width))}),s=i.reduce((d,m)=>{var f;return d+Number((f=m.attrs)==null?void 0:f.width)},0),p=(e-s)/r.length,u=((h=t.attrs)==null?void 0:h.gap)||ot;return[x(g({},t),{content:n.map((d,m)=>{var b,w,O;let f=d.type==="column"&&(((b=d.attrs)==null?void 0:b.width)==="auto"||!((w=d.attrs)!=null&&w.width)),y=m===0,S=m===n.length-1;return x(g({},d),{attrs:x(g({},d.attrs),{width:f?p:(O=d.attrs)==null?void 0:O.width,isFirstColumn:y,isLastColumn:S,index:m,paddingLeft:y?0:u/2,paddingRight:S?0:u/2})})})}),r.length===0?Math.min(e,s):e]}column(t,n){let{attrs:e}=t,{width:i,verticalAlign:r="top",paddingLeft:s=0,paddingRight:a=0}=e||{};return(0,o.jsx)(l.Column,{width:`${Number(i)}%`,style:{width:`${Number(i)}%`,margin:0,verticalAlign:r},className:"tab-col-full",children:(0,o.jsx)(l.Section,{style:{margin:0,paddingLeft:s,paddingRight:a},className:"tab-pad",children:this.getMappedContent(t,x(g({},n),{parent:t}))})})}for(t,n){var p,u;let{attrs:e}=t,{each:i=""}=e||{};if(!this.shouldShow(t,n))return(0,o.jsx)(o.Fragment,{});let{payloadValue:s}=n||{};s=typeof s=="object"?s:{};let a=(u=(p=this.payloadValues.get(i))!=null?p:s[i])!=null?u:[];if(!Array.isArray(a))throw new Error(`Payload value for each "${i}" is not an array`);return(0,o.jsx)(o.Fragment,{children:a.map(h=>(0,o.jsx)(A.Fragment,{children:this.getMappedContent(t,x(g({},n),{parent:t,payloadValue:h}))},M()))})}shouldShow(t,n){var r,s,a;let e=(s=(r=t==null?void 0:t.attrs)==null?void 0:r.showIfKey)!=null?s:"";if(!e)return!0;let{payloadValue:i}=n||{};return i=typeof i=="object"?i:{},!!((a=this.payloadValues.get(e))!=null?a:i[e])}};function Tt(c,t){return C(this,null,function*(){let s=t||{},{theme:n,preview:e}=s,i=U(s,["theme","preview"]),r=new N(c);return r.setPreviewText(e),r.setTheme(n||{}),r.setPayloadValue("items",[{name:"John Doe"},{name:"Novu"}]),r.setPayloadValue("shouldShow",!0),r.render(i)})}0&&(module.exports={DEFAULT_COLUMNS_GAP,DEFAULT_COLUMNS_WIDTH,DEFAULT_COLUMN_BACKGROUND_COLOR,DEFAULT_COLUMN_BORDER_COLOR,DEFAULT_COLUMN_BORDER_RADIUS,DEFAULT_COLUMN_BORDER_WIDTH,DEFAULT_COLUMN_PADDING_BOTTOM,DEFAULT_COLUMN_PADDING_LEFT,DEFAULT_COLUMN_PADDING_RIGHT,DEFAULT_COLUMN_PADDING_TOP,DEFAULT_SECTION_ALIGN,DEFAULT_SECTION_BACKGROUND_COLOR,DEFAULT_SECTION_BORDER_COLOR,DEFAULT_SECTION_BORDER_WIDTH,DEFAULT_SECTION_MARGIN_BOTTOM,DEFAULT_SECTION_MARGIN_LEFT,DEFAULT_SECTION_MARGIN_RIGHT,DEFAULT_SECTION_MARGIN_TOP,DEFAULT_SECTION_PADDING_BOTTOM,DEFAULT_SECTION_PADDING_LEFT,DEFAULT_SECTION_PADDING_RIGHT,DEFAULT_SECTION_PADDING_TOP,Maily,render});
1
+ "use strict";var T=Object.defineProperty,rt=Object.defineProperties,it=Object.getOwnPropertyDescriptor,st=Object.getOwnPropertyDescriptors,at=Object.getOwnPropertyNames,E=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var P=(c,t,n)=>t in c?T(c,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):c[t]=n,g=(c,t)=>{for(var n in t||(t={}))R.call(t,n)&&P(c,n,t[n]);if(E)for(var n of E(t))I.call(t,n)&&P(c,n,t[n]);return c},x=(c,t)=>rt(c,st(t));var U=(c,t)=>{var n={};for(var e in c)R.call(c,e)&&t.indexOf(e)<0&&(n[e]=c[e]);if(c!=null&&E)for(var e of E(c))t.indexOf(e)<0&&I.call(c,e)&&(n[e]=c[e]);return n};var lt=(c,t)=>{for(var n in t)T(c,n,{get:t[n],enumerable:!0})},ct=(c,t,n,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of at(t))!R.call(c,i)&&i!==n&&T(c,i,{get:()=>t[i],enumerable:!(e=it(t,i))||e.enumerable});return c};var pt=c=>ct(T({},"__esModule",{value:!0}),c);var C=(c,t,n)=>new Promise((e,i)=>{var r=p=>{try{a(n.next(p))}catch(u){i(u)}},s=p=>{try{a(n.throw(p))}catch(u){i(u)}},a=p=>p.done?e(p.value):Promise.resolve(p.value).then(r,s);a((n=n.apply(c,t)).next())});var _t={};lt(_t,{DEFAULT_COLUMNS_GAP:()=>ot,DEFAULT_COLUMNS_WIDTH:()=>yt,DEFAULT_COLUMN_BACKGROUND_COLOR:()=>St,DEFAULT_COLUMN_BORDER_COLOR:()=>Ot,DEFAULT_COLUMN_BORDER_RADIUS:()=>bt,DEFAULT_COLUMN_BORDER_WIDTH:()=>wt,DEFAULT_COLUMN_PADDING_BOTTOM:()=>Nt,DEFAULT_COLUMN_PADDING_LEFT:()=>Et,DEFAULT_COLUMN_PADDING_RIGHT:()=>vt,DEFAULT_COLUMN_PADDING_TOP:()=>Ct,DEFAULT_SECTION_ALIGN:()=>H,DEFAULT_SECTION_BACKGROUND_COLOR:()=>j,DEFAULT_SECTION_BORDER_COLOR:()=>q,DEFAULT_SECTION_BORDER_WIDTH:()=>G,DEFAULT_SECTION_MARGIN_BOTTOM:()=>Y,DEFAULT_SECTION_MARGIN_LEFT:()=>Q,DEFAULT_SECTION_MARGIN_RIGHT:()=>K,DEFAULT_SECTION_MARGIN_TOP:()=>$,DEFAULT_SECTION_PADDING_BOTTOM:()=>et,DEFAULT_SECTION_PADDING_LEFT:()=>nt,DEFAULT_SECTION_PADDING_RIGHT:()=>tt,DEFAULT_SECTION_PADDING_TOP:()=>Z,Maily:()=>N,render:()=>Tt});module.exports=pt(_t);var A=require("react"),l=require("@react-email/components"),z=require("@react-email/render");var ut=c=>Object.prototype.toString.call(c);var ht=c=>ut(c)==="[object Object]";function dt(c){return Object.keys(c)}function L(c,...t){if(!t.length)return c;let n=t.shift();return n===void 0?c:(_(c)&&_(n)&&dt(n).forEach(e=>{e==="__proto__"||e==="constructor"||e==="prototype"||(_(n[e])?(c[e]||(c[e]={}),_(c[e])?L(c[e],n[e]):c[e]=n[e]):c[e]=n[e])}),L(c,...t))}function _(c){return ht(c)&&!Array.isArray(c)}var Jt=Symbol("p-void");function M(){return Math.random().toString(36).substr(2,6)}var o=require("react/jsx-runtime");var mt={sm:"8px",md:"16px",lg:"32px",xl:"64px"},v={WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"};var ft={h1:{fontSize:"36px",lineHeight:"40px",fontWeight:800},h2:{fontSize:"30px",lineHeight:"36px",fontWeight:700},h3:{fontSize:"24px",lineHeight:"38px",fontWeight:600}};var W={sm:"40px",md:"48px",lg:"64px"},gt={pretty:!1,plainText:!1},X={colors:{heading:"#111827",paragraph:"#374151",horizontal:"#EAEAEA",footer:"#64748B",blockquoteBorder:"#D1D5DB",codeBackground:"#EFEFEF",codeText:"#111827",linkCardTitle:"#111827",linkCardDescription:"#6B7280",linkCardBadgeText:"#111827",linkCardBadgeBackground:"#FEF08A",linkCardSubTitle:"#6B7280"},fontSize:{paragraph:"15px",footer:{size:"14px",lineHeight:"24px"}}},xt='SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',j="#ffffff",H="left",G=1,q="#000000",$=0,K=0,Y=0,Q=0,Z=5,tt=5,et=5,nt=5,yt="100%",ot=8,St="transparent",bt=0,wt=0,Ot="transparent",Ct=0,vt=0,Nt=0,Et=0,N=class{constructor(t={type:"doc",content:[]}){this.config={theme:X};this.variableFormatter=({variable:t,fallback:n})=>n?`{{${t},fallback=${n}}}`:`{{${t}}}`;this.shouldReplaceVariableValues=!1;this.variableValues=new Map;this.linkValues=new Map;this.payloadValues=new Map;this.content=t}setPreviewText(t){this.config.preview=t}setTheme(t){this.config.theme=L(this.config.theme||X,t)}setVariableFormatter(t){this.variableFormatter=t}setVariableValue(t,n){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.variableValues.set(t,n)}setVariableValues(t){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),Object.entries(t).forEach(([n,e])=>{this.setVariableValue(n,e)})}setLinkValue(t,n){this.linkValues.set(t,n)}setLinkValues(t){Object.entries(t).forEach(([n,e])=>{this.setLinkValue(n,e)})}setPayloadValue(t,n){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.payloadValues.set(t,n)}setPayloadValues(t){Object.entries(t).forEach(([n,e])=>{this.setPayloadValue(n,e)})}setOpenTrackingPixel(t){this.openTrackingPixel=t}setShouldReplaceVariableValues(t){this.shouldReplaceVariableValues=t}getAllLinks(){let t=this.content.content||[],n=new Set,e=r=>r&&this.isValidUrl(r)&&!r.startsWith("#")&&!r.startsWith("mailto:")&&!r.startsWith("tel:")&&typeof r=="string",i=r=>{var s;if(r.type==="button"){let a=(s=r.attrs)==null?void 0:s.url;e(a)&&a&&n.add(a)}else r.content&&r.content.forEach(a=>{a.marks&&a.marks.forEach(p=>{var h;let u=(h=p.attrs)==null?void 0:h.href;p.type==="link"&&e(u)&&n.add(u)}),a.content&&i(a)})};return t.forEach(r=>{i(r)}),n}isValidUrl(t){try{let n=new URL(t);return!0}catch(n){return!1}}render(){return C(this,arguments,function*(t=gt){let n=this.markup();return(0,z.renderAsync)(n,t)})}markup(){let t=this.content.content||[],n=t.map((r,s)=>{let a={prev:t[s-1],next:t[s+1],parent:r},p=this.renderNode(r,a);return p?(0,o.jsx)(A.Fragment,{children:p},M()):null}),{preview:e}=this.config;return(0,o.jsxs)(l.Html,{children:[(0,o.jsxs)(l.Head,{children:[(0,o.jsx)(l.Font,{fallbackFontFamily:"sans-serif",fontFamily:"Inter",fontStyle:"normal",fontWeight:400,webFont:{url:"https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19",format:"woff2"}}),(0,o.jsx)("style",{dangerouslySetInnerHTML:{__html:"blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}@media only screen and (max-width:425px){.tab-row-full{width:100%!important}.tab-col-full{display:block!important;width:100%!important}.tab-pad{padding:0!important}}"}}),(0,o.jsx)("meta",{content:"width=device-width",name:"viewport"}),(0,o.jsx)("meta",{content:"IE=edge",httpEquiv:"X-UA-Compatible"}),(0,o.jsx)("meta",{name:"x-apple-disable-message-reformatting"}),(0,o.jsx)("meta",{content:"telephone=no,address=no,email=no,date=no,url=no",name:"format-detection"}),(0,o.jsx)("meta",{content:"light",name:"color-scheme"}),(0,o.jsx)("meta",{content:"light",name:"supported-color-schemes"})]}),(0,o.jsxs)(l.Body,{style:{margin:0},children:[e?(0,o.jsx)(l.Preview,{id:"__react-email-preview",children:e}):null,(0,o.jsx)(l.Container,{style:{maxWidth:"600px",minWidth:"300px",width:"100%",marginLeft:"auto",marginRight:"auto",padding:"0.5rem"},children:n}),this.openTrackingPixel?(0,o.jsx)(l.Img,{alt:"",src:this.openTrackingPixel,style:{display:"none",width:"1px",height:"1px"}}):null]})]})}getMarginOverrideConditions(t,n){let{parent:e,prev:i,next:r}=n||{},s=(r==null?void 0:r.type)==="spacer",a=(i==null?void 0:i.type)==="spacer",p=(e==null?void 0:e.type)==="listItem",u=(e==null?void 0:e.type)==="section"&&!r,h=(e==null?void 0:e.type)==="section"&&!i,d=(e==null?void 0:e.type)==="column"&&!r,m=(e==null?void 0:e.type)==="column"&&!i,f=(e==null?void 0:e.type)==="for"&&!i,y=(e==null?void 0:e.type)==="for"&&!r,S=(e==null?void 0:e.type)==="show"&&!i,b=(e==null?void 0:e.type)==="show"&&!r;return{isNextSpacer:s,isPrevSpacer:a,isLastSectionElement:u,isFirstSectionElement:h,isParentListItem:p,isLastColumnElement:d,isFirstColumnElement:m,isFirstForElement:f,isLastForElement:y,isFirstShowElement:S,isLastShowElement:b,shouldRemoveTopMargin:a||h||m||f||S,shouldRemoveBottomMargin:s||u||d||y||b}}getMappedContent(t,n){let e=t.content||[];return e.map((i,r)=>{let s=this.renderNode(i,x(g({},n),{next:e[r+1],prev:e[r-1]}));return s?(0,o.jsx)(A.Fragment,{children:s},M()):null}).filter(i=>i!==null)}renderNode(t,n={}){var i;let e=t.type||"";if(e in this)return(i=this[e])==null?void 0:i.call(this,t,n);throw new Error(`Node type "${e}" is not supported.`)}renderMark(t){let n=(t==null?void 0:t.text)||(0,o.jsx)(o.Fragment,{children:"\xA0"});return((t==null?void 0:t.marks)||[]).reduce((i,r)=>{var a;let s=r.type;if(s in this)return(a=this[s])==null?void 0:a.call(this,r,i);throw new Error(`Mark type "${s}" is not supported.`)},(0,o.jsx)(o.Fragment,{children:n}))}paragraph(t,n){var a,p,u,h;let{attrs:e}=t,i=(e==null?void 0:e.textAlign)||"left",{isParentListItem:r,shouldRemoveBottomMargin:s}=this.getMarginOverrideConditions(t,n);return(0,o.jsx)(l.Text,{style:g({textAlign:i,marginBottom:r||s?"0px":"20px",marginTop:"0px",fontSize:(p=(a=this.config.theme)==null?void 0:a.fontSize)==null?void 0:p.paragraph,color:(h=(u=this.config.theme)==null?void 0:u.colors)==null?void 0:h.paragraph},v),children:t.content?this.getMappedContent(t,x(g({},n),{parent:t})):(0,o.jsx)(o.Fragment,{children:"\xA0"})})}text(t,n){let e=t.text||"&nbsp";return t.marks?this.renderMark(t):(0,o.jsx)(o.Fragment,{children:e})}bold(t,n){return(0,o.jsx)("strong",{children:n})}italic(t,n){return(0,o.jsx)("em",{children:n})}underline(t,n){return(0,o.jsx)("u",{children:n})}strike(t,n){return(0,o.jsx)("s",{style:{textDecoration:"line-through"},children:n})}textStyle(t,n){var r,s;let{attrs:e}=t,{color:i=(s=(r=this.config.theme)==null?void 0:r.colors)==null?void 0:s.paragraph}=e||{};return(0,o.jsx)("span",{style:{color:i},children:n})}link(t,n){var a,p;let{attrs:e}=t,i=(e==null?void 0:e.href)||"#",r=(e==null?void 0:e.target)||"_blank",s=(e==null?void 0:e.rel)||"noopener noreferrer nofollow";return(typeof this.linkValues=="object"||typeof this.variableValues=="object")&&(i=this.linkValues.get(i)||this.variableValues.get(i)||i),(0,o.jsx)(l.Link,{href:i,rel:s,style:{fontWeight:500,textDecoration:"underline",color:(p=(a=this.config.theme)==null?void 0:a.colors)==null?void 0:p.heading},target:r,children:n})}heading(t,n){var h,d;let{attrs:e}=t,i=`h${Number(e==null?void 0:e.level)||1}`,r=(e==null?void 0:e.textAlign)||"left",{shouldRemoveBottomMargin:s}=this.getMarginOverrideConditions(t,n),{fontSize:a,lineHeight:p,fontWeight:u}=ft[i];return(0,o.jsx)(l.Heading,{as:i,style:{textAlign:r,color:(d=(h=this.config.theme)==null?void 0:h.colors)==null?void 0:d.heading,marginBottom:s?"0":"12px",marginTop:0,fontSize:a,lineHeight:p,fontWeight:u},children:this.getMappedContent(t,x(g({},n),{parent:t}))})}variable(t,n){var p,u,h;let{payloadValue:e}=n||{},{id:i,fallback:r}=t.attrs||{};if(!this.shouldShow(t,n)||!i)return(0,o.jsx)(o.Fragment,{});let a=this.variableFormatter({variable:i,fallback:r});return this.shouldReplaceVariableValues&&(a=(h=(u=(p=typeof e=="object"?e[i]:e)!=null?p:this.variableValues.get(i))!=null?u:r)!=null?h:a),t!=null&&t.marks?this.renderMark({text:a,marks:t.marks}):(0,o.jsx)(o.Fragment,{children:a})}horizontalRule(t,n){return(0,o.jsx)(l.Hr,{style:{marginTop:"32px",marginBottom:"32px"}})}orderedList(t,n){let{shouldRemoveBottomMargin:e}=this.getMarginOverrideConditions(t,n);return(0,o.jsx)(l.Container,{children:(0,o.jsx)("ol",{style:{marginTop:"0px",marginBottom:e?"0":"20px",paddingLeft:"26px",listStyleType:"decimal"},children:this.getMappedContent(t,x(g({},n),{parent:t}))})})}bulletList(t,n){let{parent:e,next:i}=n||{},{shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(t,{parent:e,next:i});return(0,o.jsx)(l.Container,{style:{maxWidth:"100%"},children:(0,o.jsx)("ul",{style:{marginTop:"0px",marginBottom:r?"0":"20px",paddingLeft:"26px",listStyleType:"disc"},children:this.getMappedContent(t,x(g({},n),{parent:t}))})})}listItem(t,n){return(0,o.jsx)("li",{style:g({marginBottom:"8px",paddingLeft:"6px"},v),children:this.getMappedContent(t,x(g({},n),{parent:t}))})}button(t,n){let{attrs:e}=t,{text:i,url:r,variant:s,buttonColor:a,textColor:p,borderRadius:u,alignment:h="left"}=e||{};if(!this.shouldShow(t,n))return(0,o.jsx)(o.Fragment,{});let m="0px";u==="round"?m="9999px":u==="smooth"&&(m="6px");let{shouldRemoveBottomMargin:f}=this.getMarginOverrideConditions(t,n),y=this.linkValues.get(r)||this.variableValues.get(r)||r;return(0,o.jsx)(l.Container,{style:{textAlign:h,maxWidth:"100%",marginBottom:f?"0px":"20px"},children:(0,o.jsx)(l.Button,{href:y,style:{color:String(p),backgroundColor:s==="filled"?String(a):"transparent",borderColor:String(a),padding:s==="filled"?"12px 34px":"10px 34px",borderWidth:"2px",borderStyle:"solid",textDecoration:"none",fontSize:"14px",fontWeight:500,borderRadius:m},children:i})})}spacer(t,n){let{attrs:e}=t,{height:i="auto"}=e||{};return this.shouldShow(t,n)?(0,o.jsx)(l.Container,{style:{height:mt[i]||i}}):(0,o.jsx)(o.Fragment,{})}hardBreak(t,n){return(0,o.jsx)("br",{})}logo(t,n){let{attrs:e}=t,{src:i,alt:r,title:s,size:a,alignment:p="left"}=e||{};if(!this.shouldShow(t,n))return(0,o.jsx)(o.Fragment,{});let{shouldRemoveBottomMargin:h}=this.getMarginOverrideConditions(t,n);return(0,o.jsx)(l.Row,{style:{marginTop:"0px",marginBottom:h?"0px":"32px"},children:(0,o.jsx)(l.Column,{align:p,children:(0,o.jsx)(l.Img,{alt:r||s||"Logo",src:i,style:{width:W[a]||a,height:W[a]||a},title:s||r||"Logo"})})})}image(t,n){let{attrs:e}=t,{src:i,alt:r,title:s,width:a="auto",alignment:p="center",externalLink:u=""}=e||{};if(!this.shouldShow(t,n))return(0,o.jsx)(o.Fragment,{});let{shouldRemoveBottomMargin:d}=this.getMarginOverrideConditions(t,n),m=a==="auto"?"auto":Number(a),f=m==="auto"?"auto":`${m}px`,y=(0,o.jsx)(l.Img,{alt:r||s||"Image",src:i,style:{width:f,maxWidth:"100%",outline:"none",border:"none",textDecoration:"none",display:"block"},title:s||r||"Image"});return(0,o.jsx)(l.Row,{style:{marginTop:"0px",marginBottom:d?"0px":"32px"},children:(0,o.jsx)(l.Column,{align:p,children:u?(0,o.jsx)("a",{href:u,rel:"noopener noreferrer",style:{display:"block",maxWidth:"100%",textDecoration:"none"},target:"_blank",children:y}):y})})}footer(t,n){var s,a,p,u,h,d,m,f;let{attrs:e}=t,{textAlign:i="left"}=e||{},{shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(t,n);return(0,o.jsx)(l.Text,{style:g({fontSize:(p=(a=(s=this.config.theme)==null?void 0:s.fontSize)==null?void 0:a.footer)==null?void 0:p.size,lineHeight:(d=(h=(u=this.config.theme)==null?void 0:u.fontSize)==null?void 0:h.footer)==null?void 0:d.lineHeight,color:(f=(m=this.config.theme)==null?void 0:m.colors)==null?void 0:f.footer,marginTop:"0px",marginBottom:r?"0px":"20px",textAlign:i},v),children:this.getMappedContent(t,x(g({},n),{parent:t}))})}blockquote(t,n){var r,s;let{isPrevSpacer:e,shouldRemoveBottomMargin:i}=this.getMarginOverrideConditions(t,n);return(0,o.jsx)("blockquote",{style:{borderLeftWidth:"4px",borderLeftStyle:"solid",borderLeftColor:(s=(r=this.config.theme)==null?void 0:r.colors)==null?void 0:s.blockquoteBorder,paddingLeft:"16px",marginLeft:"0px",marginRight:"0px",marginTop:e?"0px":"20px",marginBottom:i?"0px":"20px"},children:this.getMappedContent(t,x(g({},n),{parent:t}))})}code(t,n){var e,i,r,s;return(0,o.jsx)("code",{style:{backgroundColor:(i=(e=this.config.theme)==null?void 0:e.colors)==null?void 0:i.codeBackground,color:(s=(r=this.config.theme)==null?void 0:r.colors)==null?void 0:s.codeText,padding:"2px 4px",borderRadius:"6px",fontFamily:xt,fontWeight:400,letterSpacing:0},children:n})}linkCard(t,n){var f,y,S,b,w,O,k,V,J,D,B,F;let{attrs:e}=t,{shouldRemoveBottomMargin:i}=this.getMarginOverrideConditions(t,n),{title:r,description:s,link:a,linkTitle:p,image:u,badgeText:h,subTitle:d}=e||{},m=this.linkValues.get(a)||this.variableValues.get(a)||a||"#";return(0,o.jsxs)("a",{href:m,rel:"noopener noreferrer",style:{border:"1px solid #eaeaea",borderRadius:"10px",textDecoration:"none",color:"inherit",display:"block",marginBottom:i?"0px":"20px"},target:"_blank",children:[u?(0,o.jsx)(l.Row,{style:{marginBottom:"6px"},children:(0,o.jsx)(l.Column,{style:{width:"100%",height:"100%"},children:(0,o.jsx)(l.Img,{alt:r||"Link Card",src:u,style:{borderRadius:"10px 10px 0 0",width:"100%",height:"100%",objectFit:"cover"},title:r||"Link Card"})})}):null,(0,o.jsx)(l.Row,{style:{padding:"15px",marginTop:0,marginBottom:0},children:(0,o.jsxs)(l.Column,{style:{verticalAlign:"top"},children:[(0,o.jsxs)(l.Row,{align:void 0,style:{marginBottom:"8px",marginTop:"0px"},width:"auto",children:[(0,o.jsx)(l.Column,{children:(0,o.jsx)(l.Text,{style:g({fontSize:"18px",fontWeight:600,color:(y=(f=this.config.theme)==null?void 0:f.colors)==null?void 0:y.linkCardTitle,margin:"0px"},v),children:r})}),h||d?(0,o.jsxs)(l.Column,{style:{paddingLeft:"6px",verticalAlign:"middle"},children:[h?(0,o.jsx)("span",{style:{fontWeight:600,color:(b=(S=this.config.theme)==null?void 0:S.colors)==null?void 0:b.linkCardBadgeText,padding:"4px 8px",borderRadius:"8px",backgroundColor:(O=(w=this.config.theme)==null?void 0:w.colors)==null?void 0:O.linkCardBadgeBackground,fontSize:"12px",lineHeight:"12px"},children:h}):null," ",d&&!h?(0,o.jsx)("span",{style:{fontWeight:"normal",color:(V=(k=this.config.theme)==null?void 0:k.colors)==null?void 0:V.linkCardSubTitle,fontSize:"12px",lineHeight:"12px"},children:d}):null]}):null]}),(0,o.jsxs)(l.Text,{style:g({fontSize:"16px",color:(D=(J=this.config.theme)==null?void 0:J.colors)==null?void 0:D.linkCardDescription,marginTop:"0px",marginBottom:"0px"},v),children:[s," ",p?(0,o.jsx)("a",{href:m,rel:"noopener noreferrer",style:{color:(F=(B=this.config.theme)==null?void 0:B.colors)==null?void 0:F.linkCardTitle,fontSize:"14px",fontWeight:600,textDecoration:"underline"},children:p}):null]})]})})]})}section(t,n){let{attrs:e}=t,{borderRadius:i=0,backgroundColor:r=j,align:s=H,borderWidth:a=G,borderColor:p=q,marginTop:u=$,marginRight:h=K,marginBottom:d=Y,marginLeft:m=Q,paddingTop:f=Z,paddingRight:y=tt,paddingBottom:S=et,paddingLeft:b=nt}=e||{};return this.shouldShow(t,n)?(0,o.jsx)(l.Row,{style:{marginTop:u,marginRight:h,marginBottom:d,marginLeft:m},children:(0,o.jsx)(l.Column,{align:s,style:{borderColor:p,borderWidth:a,borderStyle:"solid",backgroundColor:r,borderRadius:i,paddingTop:f,paddingRight:y,paddingBottom:S,paddingLeft:b},children:this.getMappedContent(t,x(g({},n),{parent:t}))})}):(0,o.jsx)(o.Fragment,{})}columns(t,n){let{attrs:e}=t;if(!this.shouldShow(t,n))return(0,o.jsx)(o.Fragment,{});let[r,s]=this.adjustColumnsContent(t);return(0,o.jsx)(l.Row,{width:`${s}%`,style:{margin:0,padding:0,width:`${s}%`},className:"tab-row-full",children:this.getMappedContent(r,x(g({},n),{parent:r}))})}adjustColumnsContent(t){var h;let{content:n=[]}=t,e=100,i=n.filter(d=>{var m;return d.type==="column"&&!!Number(((m=d.attrs)==null?void 0:m.width)||0)}),r=n.filter(d=>{var m,f;return d.type==="column"&&(((m=d.attrs)==null?void 0:m.width)==="auto"||!((f=d.attrs)!=null&&f.width))}),s=i.reduce((d,m)=>{var f;return d+Number((f=m.attrs)==null?void 0:f.width)},0),p=(e-s)/r.length,u=((h=t.attrs)==null?void 0:h.gap)||ot;return[x(g({},t),{content:n.map((d,m)=>{var b,w,O;let f=d.type==="column"&&(((b=d.attrs)==null?void 0:b.width)==="auto"||!((w=d.attrs)!=null&&w.width)),y=m===0,S=m===n.length-1;return x(g({},d),{attrs:x(g({},d.attrs),{width:f?p:(O=d.attrs)==null?void 0:O.width,isFirstColumn:y,isLastColumn:S,index:m,paddingLeft:y?0:u/2,paddingRight:S?0:u/2})})})}),r.length===0?Math.min(e,s):e]}column(t,n){let{attrs:e}=t,{width:i,verticalAlign:r="top",paddingLeft:s=0,paddingRight:a=0}=e||{};return(0,o.jsx)(l.Column,{width:`${Number(i)}%`,style:{width:`${Number(i)}%`,margin:0,verticalAlign:r},className:"tab-col-full",children:(0,o.jsx)(l.Section,{style:{margin:0,paddingLeft:s,paddingRight:a},className:"tab-pad",children:this.getMappedContent(t,x(g({},n),{parent:t}))})})}for(t,n){var p,u;let{attrs:e}=t,{each:i=""}=e||{};if(!this.shouldShow(t,n))return(0,o.jsx)(o.Fragment,{});let{payloadValue:s}=n||{};s=typeof s=="object"?s:{};let a=(u=(p=this.payloadValues.get(i))!=null?p:s[i])!=null?u:[];if(!Array.isArray(a))throw new Error(`Payload value for each "${i}" is not an array`);return(0,o.jsx)(o.Fragment,{children:a.map(h=>(0,o.jsx)(A.Fragment,{children:this.getMappedContent(t,x(g({},n),{parent:t,payloadValue:h}))},M()))})}shouldShow(t,n){var r,s,a;let e=(s=(r=t==null?void 0:t.attrs)==null?void 0:r.showIfKey)!=null?s:"";if(!e)return!0;let{payloadValue:i}=n||{};return i=typeof i=="object"?i:{},!!((a=this.payloadValues.get(e))!=null?a:i[e])}};function Tt(c,t){return C(this,null,function*(){let s=t||{},{theme:n,preview:e}=s,i=U(s,["theme","preview"]),r=new N(c);return r.setPreviewText(e),r.setTheme(n||{}),r.setPayloadValue("items",[{name:"John Doe"},{name:"Novu"}]),r.setPayloadValue("shouldShow",!0),r.render(i)})}0&&(module.exports={DEFAULT_COLUMNS_GAP,DEFAULT_COLUMNS_WIDTH,DEFAULT_COLUMN_BACKGROUND_COLOR,DEFAULT_COLUMN_BORDER_COLOR,DEFAULT_COLUMN_BORDER_RADIUS,DEFAULT_COLUMN_BORDER_WIDTH,DEFAULT_COLUMN_PADDING_BOTTOM,DEFAULT_COLUMN_PADDING_LEFT,DEFAULT_COLUMN_PADDING_RIGHT,DEFAULT_COLUMN_PADDING_TOP,DEFAULT_SECTION_ALIGN,DEFAULT_SECTION_BACKGROUND_COLOR,DEFAULT_SECTION_BORDER_COLOR,DEFAULT_SECTION_BORDER_WIDTH,DEFAULT_SECTION_MARGIN_BOTTOM,DEFAULT_SECTION_MARGIN_LEFT,DEFAULT_SECTION_MARGIN_RIGHT,DEFAULT_SECTION_MARGIN_TOP,DEFAULT_SECTION_PADDING_BOTTOM,DEFAULT_SECTION_PADDING_LEFT,DEFAULT_SECTION_PADDING_RIGHT,DEFAULT_SECTION_PADDING_TOP,Maily,render});
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/maily.tsx","../../../node_modules/.pnpm/@antfu+utils@0.7.10/node_modules/@antfu/utils/dist/index.mjs","../src/utils.ts","../src/render.ts"],"sourcesContent":["export * from './maily';\nexport * from './render';\nexport type { JSONContent } from '@tiptap/core';\n","import { Fragment, type CSSProperties } from 'react';\nimport {\n Text,\n Html,\n Head,\n Body,\n Font,\n Container,\n Link,\n Heading,\n Hr,\n Button,\n Img,\n Preview,\n Row,\n Column,\n Section,\n} from '@react-email/components';\nimport { renderAsync as reactEmailRenderAsync } from '@react-email/render';\nimport type { JSONContent } from '@tiptap/core';\nimport { deepMerge } from '@antfu/utils';\nimport { generateKey } from './utils';\n\ninterface NodeOptions {\n parent?: JSONContent;\n prev?: JSONContent;\n next?: JSONContent;\n\n payloadValue?: PayloadValue;\n}\n\nexport interface MarkType {\n [key: string]: any;\n type: string;\n attrs?: Record<string, any> | undefined;\n}\n\nconst allowedSpacers = ['sm', 'md', 'lg', 'xl'] as const;\nexport type AllowedSpacers = (typeof allowedSpacers)[number];\n\nconst spacers: Record<AllowedSpacers, string> = {\n sm: '8px',\n md: '16px',\n lg: '32px',\n xl: '64px',\n};\n\nconst antialiased: CSSProperties = {\n WebkitFontSmoothing: 'antialiased',\n MozOsxFontSmoothing: 'grayscale',\n};\n\nconst allowedHeadings = ['h1', 'h2', 'h3'] as const;\ntype AllowedHeadings = (typeof allowedHeadings)[number];\n\nconst headings: Record<AllowedHeadings, CSSProperties> = {\n h1: {\n fontSize: '36px',\n lineHeight: '40px',\n fontWeight: 800,\n },\n h2: {\n fontSize: '30px',\n lineHeight: '36px',\n fontWeight: 700,\n },\n h3: {\n fontSize: '24px',\n lineHeight: '38px',\n fontWeight: 600,\n },\n};\n\nconst allowedLogoSizes = ['sm', 'md', 'lg'] as const;\ntype AllowedLogoSizes = (typeof allowedLogoSizes)[number];\n\nconst logoSizes: Record<AllowedLogoSizes, string> = {\n sm: '40px',\n md: '48px',\n lg: '64px',\n};\n\nexport interface ThemeOptions {\n colors?: Partial<{\n heading: string;\n paragraph: string;\n horizontal: string;\n footer: string;\n blockquoteBorder: string;\n codeBackground: string;\n codeText: string;\n linkCardTitle: string;\n linkCardDescription: string;\n linkCardBadgeText: string;\n linkCardBadgeBackground: string;\n linkCardSubTitle: string;\n }>;\n fontSize?: Partial<{\n paragraph: string;\n footer: {\n size: string;\n lineHeight: string;\n };\n }>;\n}\n\nexport interface MailyConfig {\n /**\n * The preview text is the snippet of text that is pulled into the inbox\n * preview of an email client, usually right after the subject line.\n *\n * Default: `undefined`\n */\n preview?: string;\n /**\n * The theme object allows you to customize the colors and font sizes of the\n * rendered email.\n *\n * Default:\n * ```js\n * {\n * colors: {\n * heading: '#111827',\n * paragraph: '#374151',\n * horizontal: '#EAEAEA',\n * footer: '#64748B',\n * },\n * fontSize: {\n * paragraph: '15px',\n * footer: {\n * size: '14px',\n * lineHeight: '24px',\n * },\n * },\n * }\n * ```\n *\n * @example\n * ```js\n * const maily = new Maily(content, {\n * theme: {\n * colors: {\n * heading: '#111827',\n * },\n * fontSize: {\n * footer: {\n * size: '14px',\n * lineHeight: '24px',\n * },\n * },\n * },\n * });\n * ```\n */\n theme?: Partial<ThemeOptions>;\n}\n\nconst DEFAULT_RENDER_OPTIONS: RenderOptions = {\n pretty: false,\n plainText: false,\n};\n\nconst DEFAULT_THEME: ThemeOptions = {\n colors: {\n heading: '#111827',\n paragraph: '#374151',\n horizontal: '#EAEAEA',\n footer: '#64748B',\n blockquoteBorder: '#D1D5DB',\n codeBackground: '#EFEFEF',\n codeText: '#111827',\n linkCardTitle: '#111827',\n linkCardDescription: '#6B7280',\n linkCardBadgeText: '#111827',\n linkCardBadgeBackground: '#FEF08A',\n linkCardSubTitle: '#6B7280',\n },\n fontSize: {\n paragraph: '15px',\n footer: {\n size: '14px',\n lineHeight: '24px',\n },\n },\n};\n\nconst CODE_FONT_FAMILY =\n 'SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace';\nexport const DEFAULT_SECTION_BACKGROUND_COLOR = '#ffffff';\nexport const DEFAULT_SECTION_ALIGN = 'left';\nexport const DEFAULT_SECTION_BORDER_WIDTH = 1;\nexport const DEFAULT_SECTION_BORDER_COLOR = '#000000';\n\nexport const DEFAULT_SECTION_MARGIN_TOP = 0;\nexport const DEFAULT_SECTION_MARGIN_RIGHT = 0;\nexport const DEFAULT_SECTION_MARGIN_BOTTOM = 0;\nexport const DEFAULT_SECTION_MARGIN_LEFT = 0;\n\nexport const DEFAULT_SECTION_PADDING_TOP = 5;\nexport const DEFAULT_SECTION_PADDING_RIGHT = 5;\nexport const DEFAULT_SECTION_PADDING_BOTTOM = 5;\nexport const DEFAULT_SECTION_PADDING_LEFT = 5;\n\nexport const DEFAULT_COLUMNS_WIDTH = '100%';\nexport const DEFAULT_COLUMNS_GAP = 8;\n\nexport const DEFAULT_COLUMN_BACKGROUND_COLOR = 'transparent';\nexport const DEFAULT_COLUMN_BORDER_RADIUS = 0;\nexport const DEFAULT_COLUMN_BORDER_WIDTH = 0;\nexport const DEFAULT_COLUMN_BORDER_COLOR = 'transparent';\n\nexport const DEFAULT_COLUMN_PADDING_TOP = 0;\nexport const DEFAULT_COLUMN_PADDING_RIGHT = 0;\nexport const DEFAULT_COLUMN_PADDING_BOTTOM = 0;\nexport const DEFAULT_COLUMN_PADDING_LEFT = 0;\n\nexport interface RenderOptions {\n /**\n * The options object allows you to customize the output of the rendered\n * email.\n * - `pretty` - If `true`, the output will be formatted with indentation and\n * line breaks.\n * - `plainText` - If `true`, the output will be plain text instead of HTML.\n * This is useful for testing purposes.\n *\n * Default: `pretty` - `false`, `plainText` - `false`\n */\n pretty?: boolean;\n plainText?: boolean;\n}\n\nexport type VariableFormatter = (options: {\n variable: string;\n fallback?: string;\n}) => string;\nexport type VariableValues = Map<string, string>;\nexport type LinkValues = Map<string, string>;\n\nexport type PayloadValue = Record<string, any> | boolean;\nexport type PayloadValues = Map<string, PayloadValue>;\n\nexport class Maily {\n private readonly content: JSONContent;\n private config: MailyConfig = {\n theme: DEFAULT_THEME,\n };\n\n private variableFormatter: VariableFormatter = ({ variable, fallback }) => {\n return fallback\n ? `{{${variable},fallback=${fallback}}}`\n : `{{${variable}}}`;\n };\n\n private shouldReplaceVariableValues = false;\n private variableValues: VariableValues = new Map();\n private linkValues: LinkValues = new Map();\n private openTrackingPixel: string | undefined;\n private payloadValues: PayloadValues = new Map();\n\n constructor(content: JSONContent = { type: 'doc', content: [] }) {\n this.content = content;\n }\n\n setPreviewText(preview?: string) {\n this.config.preview = preview;\n }\n\n setTheme(theme: Partial<ThemeOptions>) {\n this.config.theme = deepMerge(this.config.theme || DEFAULT_THEME, theme);\n }\n\n setVariableFormatter(formatter: VariableFormatter) {\n this.variableFormatter = formatter;\n }\n\n /**\n * `setVariableValue` will set the variable value.\n * It will also set `shouldReplaceVariableValues` to `true`.\n *\n * @param variable - The variable name\n * @param value - The variable value\n */\n setVariableValue(variable: string, value: string) {\n if (!this.shouldReplaceVariableValues) {\n this.shouldReplaceVariableValues = true;\n }\n\n this.variableValues.set(variable, value);\n }\n\n /**\n * `setVariableValues` will set the variable values.\n * It will also set `shouldReplaceVariableValues` to `true`.\n *\n * @param values - The variable values\n *\n * @example\n * ```js\n * const maily = new Maily(content);\n * maily.setVariableValues({\n * name: 'John Doe',\n * email: 'john@doe.com',\n * });\n * ```\n */\n setVariableValues(values: Record<string, string>) {\n if (!this.shouldReplaceVariableValues) {\n this.shouldReplaceVariableValues = true;\n }\n\n Object.entries(values).forEach(([variable, value]) => {\n this.setVariableValue(variable, value);\n });\n }\n\n setLinkValue(link: string, value: string) {\n this.linkValues.set(link, value);\n }\n\n setLinkValues(values: Record<string, string>) {\n Object.entries(values).forEach(([link, value]) => {\n this.setLinkValue(link, value);\n });\n }\n\n setPayloadValue(key: string, value: PayloadValue) {\n if (!this.shouldReplaceVariableValues) {\n this.shouldReplaceVariableValues = true;\n }\n\n this.payloadValues.set(key, value);\n }\n\n setPayloadValues(values: Record<string, PayloadValue>) {\n Object.entries(values).forEach(([key, value]) => {\n this.setPayloadValue(key, value);\n });\n }\n\n /**\n * `setOpenTrackingPixel` will set the open tracking pixel.\n *\n * @param pixel - The open tracking pixel\n */\n setOpenTrackingPixel(pixel?: string) {\n this.openTrackingPixel = pixel;\n }\n\n /**\n * `setShouldReplaceVariableValues` will determine whether to replace the\n * variable values or not. Otherwise, it will just return the formatted variable.\n *\n * Default: `false`\n */\n setShouldReplaceVariableValues(shouldReplace: boolean) {\n this.shouldReplaceVariableValues = shouldReplace;\n }\n\n getAllLinks() {\n const nodes = this.content.content || [];\n const links = new Set<string>();\n\n const isValidLink = (href: string) => {\n return (\n href &&\n this.isValidUrl(href) &&\n !href.startsWith('#') &&\n !href.startsWith('mailto:') &&\n !href.startsWith('tel:') &&\n typeof href === 'string'\n );\n };\n\n const extractLinksFromNode = (node: JSONContent) => {\n if (node.type === 'button') {\n const originalLink = node.attrs?.url;\n if (isValidLink(originalLink) && originalLink) {\n links.add(originalLink);\n }\n } else if (node.content) {\n node.content.forEach((childNode) => {\n if (childNode.marks) {\n childNode.marks.forEach((mark) => {\n const originalLink = mark.attrs?.href;\n if (mark.type === 'link' && isValidLink(originalLink)) {\n links.add(originalLink);\n }\n });\n }\n if (childNode.content) {\n extractLinksFromNode(childNode);\n }\n });\n }\n };\n\n nodes.forEach((childNode) => {\n extractLinksFromNode(childNode);\n });\n\n return links;\n }\n\n private isValidUrl(href: string) {\n try {\n const _ = new URL(href);\n return true;\n } catch (err) {\n return false;\n }\n }\n\n async render(\n options: RenderOptions = DEFAULT_RENDER_OPTIONS\n ): Promise<string> {\n const markup = this.markup();\n return reactEmailRenderAsync(markup, options);\n }\n\n /**\n * `markup` will render the JSON content into React Email markup.\n * and return the raw React Tree.\n */\n markup() {\n const nodes = this.content.content || [];\n const jsxNodes = nodes.map((node, index) => {\n const nodeOptions: NodeOptions = {\n prev: nodes[index - 1],\n next: nodes[index + 1],\n parent: node,\n };\n\n const component = this.renderNode(node, nodeOptions);\n if (!component) {\n return null;\n }\n\n return <Fragment key={generateKey()}>{component}</Fragment>;\n });\n\n const { preview } = this.config;\n\n const markup = (\n <Html>\n <Head>\n <Font\n fallbackFontFamily=\"sans-serif\"\n fontFamily=\"Inter\"\n fontStyle=\"normal\"\n fontWeight={400}\n webFont={{\n url: 'https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19',\n format: 'woff2',\n }}\n />\n <style\n dangerouslySetInnerHTML={{\n __html: `blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}@media only screen and (max-width:425px){.tab-row-full{width:100%!important}.tab-col-full{display:block!important;width:100%!important}.tab-pad{padding:0!important}}`,\n }}\n />\n\n <meta content=\"width=device-width\" name=\"viewport\" />\n <meta content=\"IE=edge\" httpEquiv=\"X-UA-Compatible\" />\n <meta name=\"x-apple-disable-message-reformatting\" />\n <meta\n // http://www.html-5.com/metatags/format-detection-meta-tag.html\n // It will prevent iOS from automatically detecting possible phone numbers in a block of text\n content=\"telephone=no,address=no,email=no,date=no,url=no\"\n name=\"format-detection\"\n />\n <meta content=\"light\" name=\"color-scheme\" />\n <meta content=\"light\" name=\"supported-color-schemes\" />\n </Head>\n <Body\n style={{\n margin: 0,\n }}\n >\n {preview ? (\n <Preview id=\"__react-email-preview\">{preview}</Preview>\n ) : null}\n <Container\n style={{\n maxWidth: '600px',\n minWidth: '300px',\n width: '100%',\n marginLeft: 'auto',\n marginRight: 'auto',\n padding: '0.5rem',\n }}\n >\n {jsxNodes}\n </Container>\n {this.openTrackingPixel ? (\n <Img\n alt=\"\"\n src={this.openTrackingPixel}\n style={{\n display: 'none',\n width: '1px',\n height: '1px',\n }}\n />\n ) : null}\n </Body>\n </Html>\n );\n\n return markup;\n }\n\n private getMarginOverrideConditions(\n node: JSONContent,\n options?: NodeOptions\n ) {\n const { parent, prev, next } = options || {};\n\n const isNextSpacer = next?.type === 'spacer';\n const isPrevSpacer = prev?.type === 'spacer';\n\n const isParentListItem = parent?.type === 'listItem';\n\n const isLastSectionElement = parent?.type === 'section' && !next;\n const isFirstSectionElement = parent?.type === 'section' && !prev;\n\n const isLastColumnElement = parent?.type === 'column' && !next;\n const isFirstColumnElement = parent?.type === 'column' && !prev;\n\n const isFirstForElement = parent?.type === 'for' && !prev;\n const isLastForElement = parent?.type === 'for' && !next;\n\n const isFirstShowElement = parent?.type === 'show' && !prev;\n const isLastShowElement = parent?.type === 'show' && !next;\n\n return {\n isNextSpacer,\n isPrevSpacer,\n isLastSectionElement,\n isFirstSectionElement,\n isParentListItem,\n isLastColumnElement,\n isFirstColumnElement,\n isFirstForElement,\n isLastForElement,\n isFirstShowElement,\n isLastShowElement,\n\n shouldRemoveTopMargin:\n isPrevSpacer ||\n isFirstSectionElement ||\n isFirstColumnElement ||\n isFirstForElement ||\n isFirstShowElement,\n shouldRemoveBottomMargin:\n isNextSpacer ||\n isLastSectionElement ||\n isLastColumnElement ||\n isLastForElement ||\n isLastShowElement,\n };\n }\n\n // `getMappedContent` will call corresponding node type\n // and return text content\n private getMappedContent(\n node: JSONContent,\n options?: NodeOptions\n ): JSX.Element[] {\n const allNodes = node.content || [];\n return allNodes\n .map((childNode, index) => {\n const component = this.renderNode(childNode, {\n ...options,\n next: allNodes[index + 1],\n prev: allNodes[index - 1],\n });\n if (!component) {\n return null;\n }\n\n return <Fragment key={generateKey()}>{component}</Fragment>;\n })\n .filter((n) => n !== null) as JSX.Element[];\n }\n\n // `renderNode` will call the method of the corresponding node type\n private renderNode(\n node: JSONContent,\n options: NodeOptions = {}\n ): JSX.Element | null {\n const type = node.type || '';\n\n if (type in this) {\n // @ts-expect-error - `this` is not assignable to type 'never'\n return this[type]?.(node, options) as JSX.Element;\n }\n\n throw new Error(`Node type \"${type}\" is not supported.`);\n }\n\n // `renderMark` will call the method of the corresponding mark type\n private renderMark(node: JSONContent): JSX.Element {\n // It will wrap the text with the corresponding mark type\n const text = node?.text || <>&nbsp;</>;\n const marks = node?.marks || [];\n\n return marks.reduce(\n (acc, mark) => {\n const type = mark.type;\n if (type in this) {\n // @ts-expect-error - `this` is not assignable to type 'never'\n return this[type]?.(mark, acc) as JSX.Element;\n }\n\n throw new Error(`Mark type \"${type}\" is not supported.`);\n },\n <>{text}</>\n );\n }\n\n private paragraph(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const alignment = attrs?.textAlign || 'left';\n const { isParentListItem, shouldRemoveBottomMargin } =\n this.getMarginOverrideConditions(node, options);\n\n return (\n <Text\n style={{\n textAlign: alignment,\n marginBottom:\n isParentListItem || shouldRemoveBottomMargin ? '0px' : '20px',\n marginTop: '0px',\n fontSize: this.config.theme?.fontSize?.paragraph,\n color: this.config.theme?.colors?.paragraph,\n ...antialiased,\n }}\n >\n {node.content ? (\n this.getMappedContent(node, {\n ...options,\n parent: node,\n })\n ) : (\n <>&nbsp;</>\n )}\n </Text>\n );\n }\n\n private text(node: JSONContent, _?: NodeOptions): JSX.Element {\n const text = node.text || '&nbsp';\n if (node.marks) {\n return this.renderMark(node);\n }\n\n return <>{text}</>;\n }\n\n private bold(_: MarkType, text: JSX.Element): JSX.Element {\n return <strong>{text}</strong>;\n }\n\n private italic(_: MarkType, text: JSX.Element): JSX.Element {\n return <em>{text}</em>;\n }\n\n private underline(_: MarkType, text: JSX.Element): JSX.Element {\n return <u>{text}</u>;\n }\n\n private strike(_: MarkType, text: JSX.Element): JSX.Element {\n return <s style={{ textDecoration: 'line-through' }}>{text}</s>;\n }\n\n private textStyle(mark: MarkType, text: JSX.Element): JSX.Element {\n const { attrs } = mark;\n const { color = this.config.theme?.colors?.paragraph } = attrs || {};\n\n return (\n <span\n style={{\n color,\n }}\n >\n {text}\n </span>\n );\n }\n\n private link(mark: MarkType, text: JSX.Element): JSX.Element {\n const { attrs } = mark;\n let href = attrs?.href || '#';\n const target = attrs?.target || '_blank';\n const rel = attrs?.rel || 'noopener noreferrer nofollow';\n\n // If the href value is provided, use it to replace the link\n // Otherwise, use the original link\n if (\n typeof this.linkValues === 'object' ||\n typeof this.variableValues === 'object'\n ) {\n href = this.linkValues.get(href) || this.variableValues.get(href) || href;\n }\n\n return (\n <Link\n href={href}\n rel={rel}\n style={{\n fontWeight: 500,\n textDecoration: 'underline',\n color: this.config.theme?.colors?.heading,\n }}\n target={target}\n >\n {text}\n </Link>\n );\n }\n\n private heading(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n\n const level = `h${Number(attrs?.level) || 1}`;\n const alignment = attrs?.textAlign || 'left';\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n const { fontSize, lineHeight, fontWeight } =\n headings[level as AllowedHeadings];\n\n return (\n <Heading\n // @ts-expect-error - `this` is not assignable to type 'never'\n as={level}\n style={{\n textAlign: alignment,\n color: this.config.theme?.colors?.heading,\n marginBottom: shouldRemoveBottomMargin ? '0' : '12px',\n marginTop: 0,\n fontSize,\n lineHeight,\n fontWeight,\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Heading>\n );\n }\n\n private variable(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { payloadValue } = options || {};\n const { id: variable, fallback } = node.attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow || !variable) {\n return <></>;\n }\n\n let formattedVariable = this.variableFormatter({\n variable,\n fallback,\n });\n\n // If `shouldReplaceVariableValues` is true, replace the variable values\n // Otherwise, just return the formatted variable\n if (this.shouldReplaceVariableValues) {\n formattedVariable =\n (typeof payloadValue === 'object'\n ? payloadValue[variable]\n : payloadValue) ??\n this.variableValues.get(variable) ??\n fallback ??\n formattedVariable;\n }\n\n if (node?.marks) {\n return this.renderMark({\n text: formattedVariable,\n marks: node.marks,\n });\n }\n\n return <>{formattedVariable}</>;\n }\n\n private horizontalRule(_: JSONContent, __?: NodeOptions): JSX.Element {\n return (\n <Hr\n style={{\n marginTop: '32px',\n marginBottom: '32px',\n }}\n />\n );\n }\n\n private orderedList(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n return (\n <Container>\n <ol\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0' : '20px',\n paddingLeft: '26px',\n listStyleType: 'decimal',\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </ol>\n </Container>\n );\n }\n\n private bulletList(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { parent, next } = options || {};\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n {\n parent,\n next,\n }\n );\n\n return (\n <Container\n style={{\n maxWidth: '100%',\n }}\n >\n <ul\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0' : '20px',\n paddingLeft: '26px',\n listStyleType: 'disc',\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </ul>\n </Container>\n );\n }\n\n private listItem(node: JSONContent, options?: NodeOptions): JSX.Element {\n return (\n <li\n style={{\n marginBottom: '8px',\n paddingLeft: '6px',\n ...antialiased,\n }}\n >\n {this.getMappedContent(node, { ...options, parent: node })}\n </li>\n );\n }\n\n private button(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n text,\n url,\n variant,\n buttonColor,\n textColor,\n borderRadius,\n // @TODO: Update the attribute to `textAlign`\n alignment = 'left',\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n let radius: string | undefined = '0px';\n if (borderRadius === 'round') {\n radius = '9999px';\n } else if (borderRadius === 'smooth') {\n radius = '6px';\n }\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n const href =\n this.linkValues.get(url) || this.variableValues.get(url) || url;\n\n return (\n <Container\n style={{\n textAlign: alignment,\n maxWidth: '100%',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n }}\n >\n <Button\n href={href}\n style={{\n color: String(textColor),\n backgroundColor:\n variant === 'filled' ? String(buttonColor) : 'transparent',\n borderColor: String(buttonColor),\n padding: variant === 'filled' ? '12px 34px' : '10px 34px',\n borderWidth: '2px',\n borderStyle: 'solid',\n textDecoration: 'none',\n fontSize: '14px',\n fontWeight: 500,\n borderRadius: radius,\n }}\n >\n {text}\n </Button>\n </Container>\n );\n }\n\n private spacer(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { height = 'auto' } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n return (\n <Container\n style={{\n height: spacers[height as AllowedSpacers] || height,\n }}\n />\n );\n }\n\n private hardBreak(_: JSONContent, __?: NodeOptions): JSX.Element {\n return <br />;\n }\n\n private logo(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n src,\n alt,\n title,\n size,\n // @TODO: Update the attribute to `textAlign`\n alignment = 'left',\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n return (\n <Row\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '32px',\n }}\n >\n <Column align={alignment}>\n <Img\n alt={alt || title || 'Logo'}\n src={src}\n style={{\n width: logoSizes[size as AllowedLogoSizes] || size,\n height: logoSizes[size as AllowedLogoSizes] || size,\n }}\n title={title || alt || 'Logo'}\n />\n </Column>\n </Row>\n );\n }\n\n private image(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n src,\n alt,\n title,\n width = 'auto',\n alignment = 'center',\n externalLink = '',\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n const wi = width === 'auto' ? 'auto' : Number(width);\n\n const mainImage = (\n <Img\n alt={alt || title || 'Image'}\n src={src}\n style={{\n height: 'auto',\n width: '100%',\n outline: 'none',\n border: 'none',\n textDecoration: 'none',\n }}\n height=\"auto\"\n width={wi}\n title={title || alt || 'Image'}\n />\n );\n\n return (\n <Row\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '32px',\n }}\n >\n <Column align={alignment}>\n {externalLink ? (\n <a\n href={externalLink}\n rel=\"noopener noreferrer\"\n style={{\n display: 'block',\n maxWidth: '100%',\n textDecoration: 'none',\n }}\n target=\"_blank\"\n >\n {mainImage}\n </a>\n ) : (\n mainImage\n )}\n </Column>\n </Row>\n );\n }\n\n private footer(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { textAlign = 'left' } = attrs || {};\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n return (\n <Text\n style={{\n fontSize: this.config.theme?.fontSize?.footer?.size,\n lineHeight: this.config.theme?.fontSize?.footer?.lineHeight,\n color: this.config.theme?.colors?.footer,\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n textAlign,\n ...antialiased,\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Text>\n );\n }\n\n private blockquote(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { isPrevSpacer, shouldRemoveBottomMargin } =\n this.getMarginOverrideConditions(node, options);\n\n return (\n <blockquote\n style={{\n borderLeftWidth: '4px',\n borderLeftStyle: 'solid',\n borderLeftColor: this.config.theme?.colors?.blockquoteBorder,\n paddingLeft: '16px',\n marginLeft: '0px',\n marginRight: '0px',\n marginTop: isPrevSpacer ? '0px' : '20px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </blockquote>\n );\n }\n private code(_: MarkType, text: JSX.Element): JSX.Element {\n return (\n <code\n style={{\n backgroundColor: this.config.theme?.colors?.codeBackground,\n color: this.config.theme?.colors?.codeText,\n padding: '2px 4px',\n borderRadius: '6px',\n fontFamily: CODE_FONT_FAMILY,\n fontWeight: 400,\n letterSpacing: 0,\n }}\n >\n {text}\n </code>\n );\n }\n private linkCard(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n const { title, description, link, linkTitle, image, badgeText, subTitle } =\n attrs || {};\n const href =\n this.linkValues.get(link) || this.variableValues.get(link) || link || '#';\n\n return (\n <a\n href={href}\n rel=\"noopener noreferrer\"\n style={{\n border: '1px solid #eaeaea',\n borderRadius: '10px',\n textDecoration: 'none',\n color: 'inherit',\n display: 'block',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n }}\n target=\"_blank\"\n >\n {image ? (\n <Row\n style={{\n marginBottom: '6px',\n }}\n >\n <Column\n style={{\n width: '100%',\n height: '100%',\n }}\n >\n <Img\n alt={title || 'Link Card'}\n src={image}\n style={{\n borderRadius: '10px 10px 0 0',\n width: '100%',\n height: '100%',\n objectFit: 'cover',\n }}\n title={title || 'Link Card'}\n />\n </Column>\n </Row>\n ) : null}\n\n <Row\n style={{\n padding: '15px',\n marginTop: 0,\n marginBottom: 0,\n }}\n >\n <Column\n style={{\n verticalAlign: 'top',\n }}\n >\n <Row\n align={undefined}\n style={{\n marginBottom: '8px',\n marginTop: '0px',\n }}\n width=\"auto\"\n >\n <Column>\n <Text\n style={{\n fontSize: '18px',\n fontWeight: 600,\n color: this.config.theme?.colors?.linkCardTitle,\n margin: '0px',\n ...antialiased,\n }}\n >\n {title}\n </Text>\n </Column>\n {badgeText || subTitle ? (\n <Column\n style={{\n paddingLeft: '6px',\n verticalAlign: 'middle',\n }}\n >\n {badgeText ? (\n <span\n style={{\n fontWeight: 600,\n color: this.config.theme?.colors?.linkCardBadgeText,\n padding: '4px 8px',\n borderRadius: '8px',\n backgroundColor:\n this.config.theme?.colors?.linkCardBadgeBackground,\n fontSize: '12px',\n lineHeight: '12px',\n }}\n >\n {badgeText}\n </span>\n ) : null}{' '}\n {subTitle && !badgeText ? (\n <span\n style={{\n fontWeight: 'normal',\n color: this.config.theme?.colors?.linkCardSubTitle,\n fontSize: '12px',\n lineHeight: '12px',\n }}\n >\n {subTitle}\n </span>\n ) : null}\n </Column>\n ) : null}\n </Row>\n <Text\n style={{\n fontSize: '16px',\n color: this.config.theme?.colors?.linkCardDescription,\n marginTop: '0px',\n marginBottom: '0px',\n ...antialiased,\n }}\n >\n {description}{' '}\n {linkTitle ? (\n <a\n href={href}\n rel=\"noopener noreferrer\"\n style={{\n color: this.config.theme?.colors?.linkCardTitle,\n fontSize: '14px',\n fontWeight: 600,\n textDecoration: 'underline',\n }}\n >\n {linkTitle}\n </a>\n ) : null}\n </Text>\n </Column>\n </Row>\n </a>\n );\n }\n\n private section(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n borderRadius = 0,\n backgroundColor = DEFAULT_SECTION_BACKGROUND_COLOR,\n align = DEFAULT_SECTION_ALIGN,\n borderWidth = DEFAULT_SECTION_BORDER_WIDTH,\n borderColor = DEFAULT_SECTION_BORDER_COLOR,\n\n marginTop = DEFAULT_SECTION_MARGIN_TOP,\n marginRight = DEFAULT_SECTION_MARGIN_RIGHT,\n marginBottom = DEFAULT_SECTION_MARGIN_BOTTOM,\n marginLeft = DEFAULT_SECTION_MARGIN_LEFT,\n\n paddingTop = DEFAULT_SECTION_PADDING_TOP,\n paddingRight = DEFAULT_SECTION_PADDING_RIGHT,\n paddingBottom = DEFAULT_SECTION_PADDING_BOTTOM,\n paddingLeft = DEFAULT_SECTION_PADDING_LEFT,\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n return (\n <Row\n style={{\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n }}\n >\n <Column\n align={align}\n style={{\n borderColor,\n borderWidth,\n borderStyle: 'solid',\n backgroundColor,\n borderRadius,\n\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Column>\n </Row>\n );\n }\n\n private columns(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n const [newNode, totalWidth] = this.adjustColumnsContent(node);\n\n return (\n <Row\n width={`${totalWidth}%`}\n style={{\n margin: 0,\n padding: 0,\n width: `${totalWidth}%`,\n }}\n className=\"tab-row-full\"\n >\n {this.getMappedContent(newNode, {\n ...options,\n parent: newNode,\n })}\n </Row>\n );\n }\n\n private adjustColumnsContent(node: JSONContent): [JSONContent, number] {\n const { content = [] } = node;\n const totalWidth = 100;\n const columnsWithWidth = content.filter(\n (c) => c.type === 'column' && Boolean(Number(c.attrs?.width || 0))\n );\n const autoWidthColumns = content.filter(\n (c) =>\n c.type === 'column' && (c.attrs?.width === 'auto' || !c.attrs?.width)\n );\n\n const totalWidthUsed = columnsWithWidth.reduce(\n (acc, c) => acc + Number(c.attrs?.width),\n 0\n );\n\n const remainingWidth = totalWidth - totalWidthUsed;\n const measuredWidth = remainingWidth / autoWidthColumns.length;\n\n const gap = node.attrs?.gap || DEFAULT_COLUMNS_GAP;\n\n return [\n {\n ...node,\n content: content.map((c, index) => {\n const isAutoWidthColumn =\n c.type === 'column' &&\n (c.attrs?.width === 'auto' || !c.attrs?.width);\n const isFirstColumn = index === 0;\n const isLastColumn = index === content.length - 1;\n\n return {\n ...c,\n attrs: {\n ...c.attrs,\n width: isAutoWidthColumn ? measuredWidth : c.attrs?.width,\n\n isFirstColumn,\n isLastColumn,\n index,\n\n paddingLeft: isFirstColumn ? 0 : gap / 2,\n paddingRight: isLastColumn ? 0 : gap / 2,\n },\n };\n }),\n },\n autoWidthColumns.length === 0\n ? Math.min(totalWidth, totalWidthUsed)\n : totalWidth,\n ];\n }\n\n private column(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n width,\n verticalAlign = 'top',\n paddingLeft = 0,\n paddingRight = 0,\n } = attrs || {};\n\n return (\n <Column\n width={`${Number(width)}%`}\n style={{\n width: `${Number(width)}%`,\n margin: 0,\n verticalAlign,\n }}\n className=\"tab-col-full\"\n >\n <Section\n style={{\n margin: 0,\n paddingLeft,\n paddingRight,\n }}\n className=\"tab-pad\"\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Section>\n </Column>\n );\n }\n\n private for(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { each = '' } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n let { payloadValue } = options || {};\n payloadValue = typeof payloadValue === 'object' ? payloadValue : {};\n\n const values = this.payloadValues.get(each) ?? payloadValue[each] ?? [];\n if (!Array.isArray(values)) {\n throw new Error(`Payload value for each \"${each}\" is not an array`);\n }\n\n return (\n <>\n {values.map((value) => {\n return (\n <Fragment key={generateKey()}>\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n payloadValue: value,\n })}\n </Fragment>\n );\n })}\n </>\n );\n }\n\n private shouldShow(node: JSONContent, options?: NodeOptions): boolean {\n const showIfKey = node?.attrs?.showIfKey ?? '';\n if (!showIfKey) {\n return true;\n }\n\n let { payloadValue } = options || {};\n payloadValue = typeof payloadValue === 'object' ? payloadValue : {};\n return !!(this.payloadValues.get(showIfKey) ?? payloadValue[showIfKey]);\n }\n}\n","function clamp(n, min, max) {\n return Math.min(max, Math.max(min, n));\n}\nfunction sum(...args) {\n return flattenArrayable(args).reduce((a, b) => a + b, 0);\n}\nfunction lerp(min, max, t) {\n const interpolation = clamp(t, 0, 1);\n return min + (max - min) * interpolation;\n}\nfunction remap(n, inMin, inMax, outMin, outMax) {\n const interpolation = (n - inMin) / (inMax - inMin);\n return lerp(outMin, outMax, interpolation);\n}\n\nfunction toArray(array) {\n array = array ?? [];\n return Array.isArray(array) ? array : [array];\n}\nfunction flattenArrayable(array) {\n return toArray(array).flat(1);\n}\nfunction mergeArrayable(...args) {\n return args.flatMap((i) => toArray(i));\n}\nfunction partition(array, ...filters) {\n const result = Array.from({ length: filters.length + 1 }).fill(null).map(() => []);\n array.forEach((e, idx, arr) => {\n let i = 0;\n for (const filter of filters) {\n if (filter(e, idx, arr)) {\n result[i].push(e);\n return;\n }\n i += 1;\n }\n result[i].push(e);\n });\n return result;\n}\nfunction uniq(array) {\n return Array.from(new Set(array));\n}\nfunction uniqueBy(array, equalFn) {\n return array.reduce((acc, cur) => {\n const index = acc.findIndex((item) => equalFn(cur, item));\n if (index === -1)\n acc.push(cur);\n return acc;\n }, []);\n}\nfunction last(array) {\n return at(array, -1);\n}\nfunction remove(array, value) {\n if (!array)\n return false;\n const index = array.indexOf(value);\n if (index >= 0) {\n array.splice(index, 1);\n return true;\n }\n return false;\n}\nfunction at(array, index) {\n const len = array.length;\n if (!len)\n return void 0;\n if (index < 0)\n index += len;\n return array[index];\n}\nfunction range(...args) {\n let start, stop, step;\n if (args.length === 1) {\n start = 0;\n step = 1;\n [stop] = args;\n } else {\n [start, stop, step = 1] = args;\n }\n const arr = [];\n let current = start;\n while (current < stop) {\n arr.push(current);\n current += step || 1;\n }\n return arr;\n}\nfunction move(arr, from, to) {\n arr.splice(to, 0, arr.splice(from, 1)[0]);\n return arr;\n}\nfunction clampArrayRange(n, arr) {\n return clamp(n, 0, arr.length - 1);\n}\nfunction sample(arr, quantity) {\n return Array.from({ length: quantity }, (_) => arr[Math.round(Math.random() * (arr.length - 1))]);\n}\nfunction shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [array[i], array[j]] = [array[j], array[i]];\n }\n return array;\n}\n\nfunction assert(condition, message) {\n if (!condition)\n throw new Error(message);\n}\nconst toString = (v) => Object.prototype.toString.call(v);\nfunction getTypeName(v) {\n if (v === null)\n return \"null\";\n const type = toString(v).slice(8, -1).toLowerCase();\n return typeof v === \"object\" || typeof v === \"function\" ? type : typeof v;\n}\nfunction noop() {\n}\n\nfunction isDeepEqual(value1, value2) {\n const type1 = getTypeName(value1);\n const type2 = getTypeName(value2);\n if (type1 !== type2)\n return false;\n if (type1 === \"array\") {\n if (value1.length !== value2.length)\n return false;\n return value1.every((item, i) => {\n return isDeepEqual(item, value2[i]);\n });\n }\n if (type1 === \"object\") {\n const keyArr = Object.keys(value1);\n if (keyArr.length !== Object.keys(value2).length)\n return false;\n return keyArr.every((key) => {\n return isDeepEqual(value1[key], value2[key]);\n });\n }\n return Object.is(value1, value2);\n}\n\nfunction notNullish(v) {\n return v != null;\n}\nfunction noNull(v) {\n return v !== null;\n}\nfunction notUndefined(v) {\n return v !== void 0;\n}\nfunction isTruthy(v) {\n return Boolean(v);\n}\n\nconst isDef = (val) => typeof val !== \"undefined\";\nconst isBoolean = (val) => typeof val === \"boolean\";\nconst isFunction = (val) => typeof val === \"function\";\nconst isNumber = (val) => typeof val === \"number\";\nconst isString = (val) => typeof val === \"string\";\nconst isObject = (val) => toString(val) === \"[object Object]\";\nconst isUndefined = (val) => toString(val) === \"[object Undefined]\";\nconst isNull = (val) => toString(val) === \"[object Null]\";\nconst isRegExp = (val) => toString(val) === \"[object RegExp]\";\nconst isDate = (val) => toString(val) === \"[object Date]\";\nconst isWindow = (val) => typeof window !== \"undefined\" && toString(val) === \"[object Window]\";\nconst isBrowser = typeof window !== \"undefined\";\n\nfunction slash(str) {\n return str.replace(/\\\\/g, \"/\");\n}\nfunction ensurePrefix(prefix, str) {\n if (!str.startsWith(prefix))\n return prefix + str;\n return str;\n}\nfunction ensureSuffix(suffix, str) {\n if (!str.endsWith(suffix))\n return str + suffix;\n return str;\n}\nfunction template(str, ...args) {\n const [firstArg, fallback] = args;\n if (isObject(firstArg)) {\n const vars = firstArg;\n return str.replace(/{([\\w\\d]+)}/g, (_, key) => vars[key] || ((typeof fallback === \"function\" ? fallback(key) : fallback) ?? key));\n } else {\n return str.replace(/{(\\d+)}/g, (_, key) => {\n const index = Number(key);\n if (Number.isNaN(index))\n return key;\n return args[index];\n });\n }\n}\nconst urlAlphabet = \"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict\";\nfunction randomStr(size = 16, dict = urlAlphabet) {\n let id = \"\";\n let i = size;\n const len = dict.length;\n while (i--)\n id += dict[Math.random() * len | 0];\n return id;\n}\nfunction capitalize(str) {\n return str[0].toUpperCase() + str.slice(1).toLowerCase();\n}\nconst _reFullWs = /^\\s*$/;\nfunction unindent(str) {\n const lines = (typeof str === \"string\" ? str : str[0]).split(\"\\n\");\n const whitespaceLines = lines.map((line) => _reFullWs.test(line));\n const commonIndent = lines.reduce((min, line, idx) => {\n var _a;\n if (whitespaceLines[idx])\n return min;\n const indent = (_a = line.match(/^\\s*/)) == null ? void 0 : _a[0].length;\n return indent === void 0 ? min : Math.min(min, indent);\n }, Number.POSITIVE_INFINITY);\n let emptyLinesHead = 0;\n while (emptyLinesHead < lines.length && whitespaceLines[emptyLinesHead])\n emptyLinesHead++;\n let emptyLinesTail = 0;\n while (emptyLinesTail < lines.length && whitespaceLines[lines.length - emptyLinesTail - 1])\n emptyLinesTail++;\n return lines.slice(emptyLinesHead, lines.length - emptyLinesTail).map((line) => line.slice(commonIndent)).join(\"\\n\");\n}\n\nconst timestamp = () => +Date.now();\n\nfunction batchInvoke(functions) {\n functions.forEach((fn) => fn && fn());\n}\nfunction invoke(fn) {\n return fn();\n}\nfunction tap(value, callback) {\n callback(value);\n return value;\n}\n\nfunction objectMap(obj, fn) {\n return Object.fromEntries(\n Object.entries(obj).map(([k, v]) => fn(k, v)).filter(notNullish)\n );\n}\nfunction isKeyOf(obj, k) {\n return k in obj;\n}\nfunction objectKeys(obj) {\n return Object.keys(obj);\n}\nfunction objectEntries(obj) {\n return Object.entries(obj);\n}\nfunction deepMerge(target, ...sources) {\n if (!sources.length)\n return target;\n const source = sources.shift();\n if (source === void 0)\n return target;\n if (isMergableObject(target) && isMergableObject(source)) {\n objectKeys(source).forEach((key) => {\n if (key === \"__proto__\" || key === \"constructor\" || key === \"prototype\")\n return;\n if (isMergableObject(source[key])) {\n if (!target[key])\n target[key] = {};\n if (isMergableObject(target[key])) {\n deepMerge(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n } else {\n target[key] = source[key];\n }\n });\n }\n return deepMerge(target, ...sources);\n}\nfunction deepMergeWithArray(target, ...sources) {\n if (!sources.length)\n return target;\n const source = sources.shift();\n if (source === void 0)\n return target;\n if (Array.isArray(target) && Array.isArray(source))\n target.push(...source);\n if (isMergableObject(target) && isMergableObject(source)) {\n objectKeys(source).forEach((key) => {\n if (key === \"__proto__\" || key === \"constructor\" || key === \"prototype\")\n return;\n if (Array.isArray(source[key])) {\n if (!target[key])\n target[key] = [];\n deepMergeWithArray(target[key], source[key]);\n } else if (isMergableObject(source[key])) {\n if (!target[key])\n target[key] = {};\n deepMergeWithArray(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n });\n }\n return deepMergeWithArray(target, ...sources);\n}\nfunction isMergableObject(item) {\n return isObject(item) && !Array.isArray(item);\n}\nfunction objectPick(obj, keys, omitUndefined = false) {\n return keys.reduce((n, k) => {\n if (k in obj) {\n if (!omitUndefined || obj[k] !== void 0)\n n[k] = obj[k];\n }\n return n;\n }, {});\n}\nfunction clearUndefined(obj) {\n Object.keys(obj).forEach((key) => obj[key] === void 0 ? delete obj[key] : {});\n return obj;\n}\nfunction hasOwnProperty(obj, v) {\n if (obj == null)\n return false;\n return Object.prototype.hasOwnProperty.call(obj, v);\n}\n\nfunction createSingletonPromise(fn) {\n let _promise;\n function wrapper() {\n if (!_promise)\n _promise = fn();\n return _promise;\n }\n wrapper.reset = async () => {\n const _prev = _promise;\n _promise = void 0;\n if (_prev)\n await _prev;\n };\n return wrapper;\n}\nfunction sleep(ms, callback) {\n return new Promise(\n (resolve) => setTimeout(async () => {\n await (callback == null ? void 0 : callback());\n resolve();\n }, ms)\n );\n}\nfunction createPromiseLock() {\n const locks = [];\n return {\n async run(fn) {\n const p = fn();\n locks.push(p);\n try {\n return await p;\n } finally {\n remove(locks, p);\n }\n },\n async wait() {\n await Promise.allSettled(locks);\n },\n isWaiting() {\n return Boolean(locks.length);\n },\n clear() {\n locks.length = 0;\n }\n };\n}\nfunction createControlledPromise() {\n let resolve, reject;\n const promise = new Promise((_resolve, _reject) => {\n resolve = _resolve;\n reject = _reject;\n });\n promise.resolve = resolve;\n promise.reject = reject;\n return promise;\n}\n\n/* eslint-disable no-undefined,no-param-reassign,no-shadow */\n\n/**\n * Throttle execution of a function. Especially useful for rate limiting\n * execution of handlers on events like resize and scroll.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)\n * are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,\n * as-is, to `callback` when the throttled-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds\n * while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed\n * one final time after the last throttled-function call. (After the throttled-function has not been called for\n * `delay` milliseconds, the internal counter is reset).\n * @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback\n * immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that\n * callback will never executed if both noLeading = true and noTrailing = true.\n * @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is\n * false (at end), schedule `callback` to execute after `delay` ms.\n *\n * @returns {Function} A new, throttled, function.\n */\nfunction throttle (delay, callback, options) {\n var _ref = options || {},\n _ref$noTrailing = _ref.noTrailing,\n noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,\n _ref$noLeading = _ref.noLeading,\n noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,\n _ref$debounceMode = _ref.debounceMode,\n debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;\n /*\n * After wrapper has stopped being called, this timeout ensures that\n * `callback` is executed at the proper times in `throttle` and `end`\n * debounce modes.\n */\n\n\n var timeoutID;\n var cancelled = false; // Keep track of the last time `callback` was executed.\n\n var lastExec = 0; // Function to clear existing timeout\n\n function clearExistingTimeout() {\n if (timeoutID) {\n clearTimeout(timeoutID);\n }\n } // Function to cancel next exec\n\n\n function cancel(options) {\n var _ref2 = options || {},\n _ref2$upcomingOnly = _ref2.upcomingOnly,\n upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;\n\n clearExistingTimeout();\n cancelled = !upcomingOnly;\n }\n /*\n * The `wrapper` function encapsulates all of the throttling / debouncing\n * functionality and when executed will limit the rate at which `callback`\n * is executed.\n */\n\n\n function wrapper() {\n for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {\n arguments_[_key] = arguments[_key];\n }\n\n var self = this;\n var elapsed = Date.now() - lastExec;\n\n if (cancelled) {\n return;\n } // Execute `callback` and update the `lastExec` timestamp.\n\n\n function exec() {\n lastExec = Date.now();\n callback.apply(self, arguments_);\n }\n /*\n * If `debounceMode` is true (at begin) this is used to clear the flag\n * to allow future `callback` executions.\n */\n\n\n function clear() {\n timeoutID = undefined;\n }\n\n if (!noLeading && debounceMode && !timeoutID) {\n /*\n * Since `wrapper` is being called for the first time and\n * `debounceMode` is true (at begin), execute `callback`\n * and noLeading != true.\n */\n exec();\n }\n\n clearExistingTimeout();\n\n if (debounceMode === undefined && elapsed > delay) {\n if (noLeading) {\n /*\n * In throttle mode with noLeading, if `delay` time has\n * been exceeded, update `lastExec` and schedule `callback`\n * to execute after `delay` ms.\n */\n lastExec = Date.now();\n\n if (!noTrailing) {\n timeoutID = setTimeout(debounceMode ? clear : exec, delay);\n }\n } else {\n /*\n * In throttle mode without noLeading, if `delay` time has been exceeded, execute\n * `callback`.\n */\n exec();\n }\n } else if (noTrailing !== true) {\n /*\n * In trailing throttle mode, since `delay` time has not been\n * exceeded, schedule `callback` to execute `delay` ms after most\n * recent execution.\n *\n * If `debounceMode` is true (at begin), schedule `clear` to execute\n * after `delay` ms.\n *\n * If `debounceMode` is false (at end), schedule `callback` to\n * execute after `delay` ms.\n */\n timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);\n }\n }\n\n wrapper.cancel = cancel; // Return the wrapper function.\n\n return wrapper;\n}\n\n/* eslint-disable no-undefined */\n/**\n * Debounce execution of a function. Debouncing, unlike throttling,\n * guarantees that a function is only executed a single time, either at the\n * very beginning of a series of calls, or at the very end.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n * to `callback` when the debounced-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds\n * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.\n * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).\n *\n * @returns {Function} A new, debounced function.\n */\n\nfunction debounce (delay, callback, options) {\n var _ref = options || {},\n _ref$atBegin = _ref.atBegin,\n atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin;\n\n return throttle(delay, callback, {\n debounceMode: atBegin !== false\n });\n}\n\n/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nclass Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n}\n\nconst AsyncResource = {\n\tbind(fn, _type, thisArg) {\n\t\treturn fn.bind(thisArg);\n\t},\n};\n\nfunction pLimit(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst next = () => {\n\t\tactiveCount--;\n\n\t\tif (queue.size > 0) {\n\t\t\tqueue.dequeue()();\n\t\t}\n\t};\n\n\tconst run = async (function_, resolve, arguments_) => {\n\t\tactiveCount++;\n\n\t\tconst result = (async () => function_(...arguments_))();\n\n\t\tresolve(result);\n\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\tnext();\n\t};\n\n\tconst enqueue = (function_, resolve, arguments_) => {\n\t\tqueue.enqueue(\n\t\t\tAsyncResource.bind(run.bind(undefined, function_, resolve, arguments_)),\n\t\t);\n\n\t\t(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// when the run function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve();\n\n\t\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\t\tqueue.dequeue()();\n\t\t\t}\n\t\t})();\n\t};\n\n\tconst generator = (function_, ...arguments_) => new Promise(resolve => {\n\t\tenqueue(function_, resolve, arguments_);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue() {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n\nconst VOID = Symbol(\"p-void\");\nclass PInstance extends Promise {\n constructor(items = [], options) {\n super(() => {\n });\n this.items = items;\n this.options = options;\n this.promises = /* @__PURE__ */ new Set();\n }\n get promise() {\n var _a;\n let batch;\n const items = [...Array.from(this.items), ...Array.from(this.promises)];\n if ((_a = this.options) == null ? void 0 : _a.concurrency) {\n const limit = pLimit(this.options.concurrency);\n batch = Promise.all(items.map((p2) => limit(() => p2)));\n } else {\n batch = Promise.all(items);\n }\n return batch.then((l) => l.filter((i) => i !== VOID));\n }\n add(...args) {\n args.forEach((i) => {\n this.promises.add(i);\n });\n }\n map(fn) {\n return new PInstance(\n Array.from(this.items).map(async (i, idx) => {\n const v = await i;\n if (v === VOID)\n return VOID;\n return fn(v, idx);\n }),\n this.options\n );\n }\n filter(fn) {\n return new PInstance(\n Array.from(this.items).map(async (i, idx) => {\n const v = await i;\n const r = await fn(v, idx);\n if (!r)\n return VOID;\n return v;\n }),\n this.options\n );\n }\n forEach(fn) {\n return this.map(fn).then();\n }\n reduce(fn, initialValue) {\n return this.promise.then((array) => array.reduce(fn, initialValue));\n }\n clear() {\n this.promises.clear();\n }\n then(fn) {\n const p2 = this.promise;\n if (fn)\n return p2.then(fn);\n else\n return p2;\n }\n catch(fn) {\n return this.promise.catch(fn);\n }\n finally(fn) {\n return this.promise.finally(fn);\n }\n}\nfunction p(items, options) {\n return new PInstance(items, options);\n}\n\nexport { assert, at, batchInvoke, capitalize, clamp, clampArrayRange, clearUndefined, createControlledPromise, createPromiseLock, createSingletonPromise, debounce, deepMerge, deepMergeWithArray, ensurePrefix, ensureSuffix, flattenArrayable, getTypeName, hasOwnProperty, invoke, isBoolean, isBrowser, isDate, isDeepEqual, isDef, isFunction, isKeyOf, isNull, isNumber, isObject, isRegExp, isString, isTruthy, isUndefined, isWindow, last, lerp, mergeArrayable, move, noNull, noop, notNullish, notUndefined, objectEntries, objectKeys, objectMap, objectPick, p, partition, randomStr, range, remap, remove, sample, shuffle, slash, sleep, sum, tap, template, throttle, timestamp, toArray, toString, unindent, uniq, uniqueBy };\n","export function generateKey() {\n // Length of 6 is enough to avoid collisions\n // for react keys\n return Math.random().toString(36).substr(2, 6);\n}\n","import type { JSONContent } from '@tiptap/core';\nimport { Maily } from './maily';\nimport type { MailyConfig, RenderOptions } from './maily';\n\nexport async function render(\n content: JSONContent,\n config?: MailyConfig & RenderOptions\n): Promise<string> {\n const { theme, preview, ...rest } = config || {};\n\n const maily = new Maily(content);\n maily.setPreviewText(preview);\n maily.setTheme(theme || {});\n\n maily.setPayloadValue('items', [\n {\n name: 'John Doe',\n },\n {\n name: 'Novu',\n },\n ]);\n\n maily.setPayloadValue('shouldShow', true);\n\n return maily.render(rest);\n}\n"],"mappings":"+nCAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,yBAAAE,GAAA,0BAAAC,GAAA,oCAAAC,GAAA,gCAAAC,GAAA,iCAAAC,GAAA,gCAAAC,GAAA,kCAAAC,GAAA,gCAAAC,GAAA,iCAAAC,GAAA,+BAAAC,GAAA,0BAAAC,EAAA,qCAAAC,EAAA,iCAAAC,EAAA,iCAAAC,EAAA,kCAAAC,EAAA,gCAAAC,EAAA,iCAAAC,EAAA,+BAAAC,EAAA,mCAAAC,GAAA,iCAAAC,GAAA,kCAAAC,GAAA,gCAAAC,EAAA,UAAAC,EAAA,WAAAC,KAAA,eAAAC,GAAA1B,ICAA,IAAA2B,EAA6C,iBAC7CC,EAgBO,mCACPC,EAAqD,+BC6FrD,IAAMC,GAAYC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A,EAAM,QAAN,YAAAC,EAAa,YAAb,KAAAoC,EAA0B,GAC5C,GAAI,CAACyE,EACH,MAAO,GAGT,GAAI,CAAE,aAAA1D,CAAa,EAAI5C,GAAW,CAAC,EACnC,OAAA4C,EAAe,OAAOA,GAAiB,SAAWA,EAAe,CAAC,EAC3D,CAAC,GAAEd,EAAA,KAAK,cAAc,IAAIwE,CAAS,IAAhC,KAAAxE,EAAqCc,EAAa0D,CAAS,EACvE,CACF,EGv+CA,SAAsBC,GACpBC,EACAC,EACiB,QAAAC,EAAA,sBACjB,IAAoCC,EAAAF,GAAU,CAAC,EAAvC,OAAAG,EAAO,QAAAC,CARjB,EAQsCF,EAATG,EAAAC,EAASJ,EAAT,CAAnB,QAAO,YAETK,EAAQ,IAAIC,EAAMT,CAAO,EAC/B,OAAAQ,EAAM,eAAeH,CAAO,EAC5BG,EAAM,SAASJ,GAAS,CAAC,CAAC,EAE1BI,EAAM,gBAAgB,QAAS,CAC7B,CACE,KAAM,UACR,EACA,CACE,KAAM,MACR,CACF,CAAC,EAEDA,EAAM,gBAAgB,aAAc,EAAI,EAEjCA,EAAM,OAAOF,CAAI,CAC1B","names":["src_exports","__export","DEFAULT_COLUMNS_GAP","DEFAULT_COLUMNS_WIDTH","DEFAULT_COLUMN_BACKGROUND_COLOR","DEFAULT_COLUMN_BORDER_COLOR","DEFAULT_COLUMN_BORDER_RADIUS","DEFAULT_COLUMN_BORDER_WIDTH","DEFAULT_COLUMN_PADDING_BOTTOM","DEFAULT_COLUMN_PADDING_LEFT","DEFAULT_COLUMN_PADDING_RIGHT","DEFAULT_COLUMN_PADDING_TOP","DEFAULT_SECTION_ALIGN","DEFAULT_SECTION_BACKGROUND_COLOR","DEFAULT_SECTION_BORDER_COLOR","DEFAULT_SECTION_BORDER_WIDTH","DEFAULT_SECTION_MARGIN_BOTTOM","DEFAULT_SECTION_MARGIN_LEFT","DEFAULT_SECTION_MARGIN_RIGHT","DEFAULT_SECTION_MARGIN_TOP","DEFAULT_SECTION_PADDING_BOTTOM","DEFAULT_SECTION_PADDING_LEFT","DEFAULT_SECTION_PADDING_RIGHT","DEFAULT_SECTION_PADDING_TOP","Maily","render","__toCommonJS","import_react","import_components","import_render","toString","v","isObject","val","toString","objectKeys","obj","deepMerge","target","sources","source","isMergableObject","objectKeys","key","isMergableObject","item","isObject","VOID","generateKey","import_jsx_runtime","spacers","antialiased","headings","logoSizes","DEFAULT_RENDER_OPTIONS","DEFAULT_THEME","CODE_FONT_FAMILY","DEFAULT_SECTION_BACKGROUND_COLOR","DEFAULT_SECTION_ALIGN","DEFAULT_SECTION_BORDER_WIDTH","DEFAULT_SECTION_BORDER_COLOR","DEFAULT_SECTION_MARGIN_TOP","DEFAULT_SECTION_MARGIN_RIGHT","DEFAULT_SECTION_MARGIN_BOTTOM","DEFAULT_SECTION_MARGIN_LEFT","DEFAULT_SECTION_PADDING_TOP","DEFAULT_SECTION_PADDING_RIGHT","DEFAULT_SECTION_PADDING_BOTTOM","DEFAULT_SECTION_PADDING_LEFT","DEFAULT_COLUMNS_WIDTH","DEFAULT_COLUMNS_GAP","DEFAULT_COLUMN_BACKGROUND_COLOR","DEFAULT_COLUMN_BORDER_RADIUS","DEFAULT_COLUMN_BORDER_WIDTH","DEFAULT_COLUMN_BORDER_COLOR","DEFAULT_COLUMN_PADDING_TOP","DEFAULT_COLUMN_PADDING_RIGHT","DEFAULT_COLUMN_PADDING_BOTTOM","DEFAULT_COLUMN_PADDING_LEFT","Maily","content","variable","fallback","preview","theme","deepMerge","formatter","value","values","link","key","pixel","shouldReplace","nodes","links","isValidLink","href","extractLinksFromNode","node","_a","originalLink","childNode","mark","_","err","__async","options","markup","reactEmailRenderAsync","jsxNodes","index","nodeOptions","component","generateKey","parent","prev","next","isNextSpacer","isPrevSpacer","isParentListItem","isLastSectionElement","isFirstSectionElement","isLastColumnElement","isFirstColumnElement","isFirstForElement","isLastForElement","isFirstShowElement","isLastShowElement","allNodes","__spreadProps","__spreadValues","n","type","text","acc","_b","_c","_d","attrs","alignment","shouldRemoveBottomMargin","antialiased","color","target","rel","level","fontSize","lineHeight","fontWeight","headings","payloadValue","formattedVariable","__","url","variant","buttonColor","textColor","borderRadius","radius","height","spacers","src","alt","title","size","width","externalLink","wi","mainImage","_e","_f","_g","_h","textAlign","_i","_j","_k","_l","description","linkTitle","image","badgeText","subTitle","backgroundColor","align","borderWidth","borderColor","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","newNode","totalWidth","columnsWithWidth","c","autoWidthColumns","totalWidthUsed","measuredWidth","gap","isAutoWidthColumn","isFirstColumn","isLastColumn","verticalAlign","each","showIfKey","render","content","config","__async","_a","theme","preview","rest","__objRest","maily","Maily"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/maily.tsx","../../../node_modules/.pnpm/@antfu+utils@0.7.10/node_modules/@antfu/utils/dist/index.mjs","../src/utils.ts","../src/render.ts"],"sourcesContent":["export * from './maily';\nexport * from './render';\nexport type { JSONContent } from '@tiptap/core';\n","import { Fragment, type CSSProperties } from 'react';\nimport {\n Text,\n Html,\n Head,\n Body,\n Font,\n Container,\n Link,\n Heading,\n Hr,\n Button,\n Img,\n Preview,\n Row,\n Column,\n Section,\n} from '@react-email/components';\nimport { renderAsync as reactEmailRenderAsync } from '@react-email/render';\nimport type { JSONContent } from '@tiptap/core';\nimport { deepMerge } from '@antfu/utils';\nimport { generateKey } from './utils';\n\ninterface NodeOptions {\n parent?: JSONContent;\n prev?: JSONContent;\n next?: JSONContent;\n\n payloadValue?: PayloadValue;\n}\n\nexport interface MarkType {\n [key: string]: any;\n type: string;\n attrs?: Record<string, any> | undefined;\n}\n\nconst allowedSpacers = ['sm', 'md', 'lg', 'xl'] as const;\nexport type AllowedSpacers = (typeof allowedSpacers)[number];\n\nconst spacers: Record<AllowedSpacers, string> = {\n sm: '8px',\n md: '16px',\n lg: '32px',\n xl: '64px',\n};\n\nconst antialiased: CSSProperties = {\n WebkitFontSmoothing: 'antialiased',\n MozOsxFontSmoothing: 'grayscale',\n};\n\nconst allowedHeadings = ['h1', 'h2', 'h3'] as const;\ntype AllowedHeadings = (typeof allowedHeadings)[number];\n\nconst headings: Record<AllowedHeadings, CSSProperties> = {\n h1: {\n fontSize: '36px',\n lineHeight: '40px',\n fontWeight: 800,\n },\n h2: {\n fontSize: '30px',\n lineHeight: '36px',\n fontWeight: 700,\n },\n h3: {\n fontSize: '24px',\n lineHeight: '38px',\n fontWeight: 600,\n },\n};\n\nconst allowedLogoSizes = ['sm', 'md', 'lg'] as const;\ntype AllowedLogoSizes = (typeof allowedLogoSizes)[number];\n\nconst logoSizes: Record<AllowedLogoSizes, string> = {\n sm: '40px',\n md: '48px',\n lg: '64px',\n};\n\nexport interface ThemeOptions {\n colors?: Partial<{\n heading: string;\n paragraph: string;\n horizontal: string;\n footer: string;\n blockquoteBorder: string;\n codeBackground: string;\n codeText: string;\n linkCardTitle: string;\n linkCardDescription: string;\n linkCardBadgeText: string;\n linkCardBadgeBackground: string;\n linkCardSubTitle: string;\n }>;\n fontSize?: Partial<{\n paragraph: string;\n footer: {\n size: string;\n lineHeight: string;\n };\n }>;\n}\n\nexport interface MailyConfig {\n /**\n * The preview text is the snippet of text that is pulled into the inbox\n * preview of an email client, usually right after the subject line.\n *\n * Default: `undefined`\n */\n preview?: string;\n /**\n * The theme object allows you to customize the colors and font sizes of the\n * rendered email.\n *\n * Default:\n * ```js\n * {\n * colors: {\n * heading: '#111827',\n * paragraph: '#374151',\n * horizontal: '#EAEAEA',\n * footer: '#64748B',\n * },\n * fontSize: {\n * paragraph: '15px',\n * footer: {\n * size: '14px',\n * lineHeight: '24px',\n * },\n * },\n * }\n * ```\n *\n * @example\n * ```js\n * const maily = new Maily(content, {\n * theme: {\n * colors: {\n * heading: '#111827',\n * },\n * fontSize: {\n * footer: {\n * size: '14px',\n * lineHeight: '24px',\n * },\n * },\n * },\n * });\n * ```\n */\n theme?: Partial<ThemeOptions>;\n}\n\nconst DEFAULT_RENDER_OPTIONS: RenderOptions = {\n pretty: false,\n plainText: false,\n};\n\nconst DEFAULT_THEME: ThemeOptions = {\n colors: {\n heading: '#111827',\n paragraph: '#374151',\n horizontal: '#EAEAEA',\n footer: '#64748B',\n blockquoteBorder: '#D1D5DB',\n codeBackground: '#EFEFEF',\n codeText: '#111827',\n linkCardTitle: '#111827',\n linkCardDescription: '#6B7280',\n linkCardBadgeText: '#111827',\n linkCardBadgeBackground: '#FEF08A',\n linkCardSubTitle: '#6B7280',\n },\n fontSize: {\n paragraph: '15px',\n footer: {\n size: '14px',\n lineHeight: '24px',\n },\n },\n};\n\nconst CODE_FONT_FAMILY =\n 'SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace';\nexport const DEFAULT_SECTION_BACKGROUND_COLOR = '#ffffff';\nexport const DEFAULT_SECTION_ALIGN = 'left';\nexport const DEFAULT_SECTION_BORDER_WIDTH = 1;\nexport const DEFAULT_SECTION_BORDER_COLOR = '#000000';\n\nexport const DEFAULT_SECTION_MARGIN_TOP = 0;\nexport const DEFAULT_SECTION_MARGIN_RIGHT = 0;\nexport const DEFAULT_SECTION_MARGIN_BOTTOM = 0;\nexport const DEFAULT_SECTION_MARGIN_LEFT = 0;\n\nexport const DEFAULT_SECTION_PADDING_TOP = 5;\nexport const DEFAULT_SECTION_PADDING_RIGHT = 5;\nexport const DEFAULT_SECTION_PADDING_BOTTOM = 5;\nexport const DEFAULT_SECTION_PADDING_LEFT = 5;\n\nexport const DEFAULT_COLUMNS_WIDTH = '100%';\nexport const DEFAULT_COLUMNS_GAP = 8;\n\nexport const DEFAULT_COLUMN_BACKGROUND_COLOR = 'transparent';\nexport const DEFAULT_COLUMN_BORDER_RADIUS = 0;\nexport const DEFAULT_COLUMN_BORDER_WIDTH = 0;\nexport const DEFAULT_COLUMN_BORDER_COLOR = 'transparent';\n\nexport const DEFAULT_COLUMN_PADDING_TOP = 0;\nexport const DEFAULT_COLUMN_PADDING_RIGHT = 0;\nexport const DEFAULT_COLUMN_PADDING_BOTTOM = 0;\nexport const DEFAULT_COLUMN_PADDING_LEFT = 0;\n\nexport interface RenderOptions {\n /**\n * The options object allows you to customize the output of the rendered\n * email.\n * - `pretty` - If `true`, the output will be formatted with indentation and\n * line breaks.\n * - `plainText` - If `true`, the output will be plain text instead of HTML.\n * This is useful for testing purposes.\n *\n * Default: `pretty` - `false`, `plainText` - `false`\n */\n pretty?: boolean;\n plainText?: boolean;\n}\n\nexport type VariableFormatter = (options: {\n variable: string;\n fallback?: string;\n}) => string;\nexport type VariableValues = Map<string, string>;\nexport type LinkValues = Map<string, string>;\n\nexport type PayloadValue = Record<string, any> | boolean;\nexport type PayloadValues = Map<string, PayloadValue>;\n\nexport class Maily {\n private readonly content: JSONContent;\n private config: MailyConfig = {\n theme: DEFAULT_THEME,\n };\n\n private variableFormatter: VariableFormatter = ({ variable, fallback }) => {\n return fallback\n ? `{{${variable},fallback=${fallback}}}`\n : `{{${variable}}}`;\n };\n\n private shouldReplaceVariableValues = false;\n private variableValues: VariableValues = new Map();\n private linkValues: LinkValues = new Map();\n private openTrackingPixel: string | undefined;\n private payloadValues: PayloadValues = new Map();\n\n constructor(content: JSONContent = { type: 'doc', content: [] }) {\n this.content = content;\n }\n\n setPreviewText(preview?: string) {\n this.config.preview = preview;\n }\n\n setTheme(theme: Partial<ThemeOptions>) {\n this.config.theme = deepMerge(this.config.theme || DEFAULT_THEME, theme);\n }\n\n setVariableFormatter(formatter: VariableFormatter) {\n this.variableFormatter = formatter;\n }\n\n /**\n * `setVariableValue` will set the variable value.\n * It will also set `shouldReplaceVariableValues` to `true`.\n *\n * @param variable - The variable name\n * @param value - The variable value\n */\n setVariableValue(variable: string, value: string) {\n if (!this.shouldReplaceVariableValues) {\n this.shouldReplaceVariableValues = true;\n }\n\n this.variableValues.set(variable, value);\n }\n\n /**\n * `setVariableValues` will set the variable values.\n * It will also set `shouldReplaceVariableValues` to `true`.\n *\n * @param values - The variable values\n *\n * @example\n * ```js\n * const maily = new Maily(content);\n * maily.setVariableValues({\n * name: 'John Doe',\n * email: 'john@doe.com',\n * });\n * ```\n */\n setVariableValues(values: Record<string, string>) {\n if (!this.shouldReplaceVariableValues) {\n this.shouldReplaceVariableValues = true;\n }\n\n Object.entries(values).forEach(([variable, value]) => {\n this.setVariableValue(variable, value);\n });\n }\n\n setLinkValue(link: string, value: string) {\n this.linkValues.set(link, value);\n }\n\n setLinkValues(values: Record<string, string>) {\n Object.entries(values).forEach(([link, value]) => {\n this.setLinkValue(link, value);\n });\n }\n\n setPayloadValue(key: string, value: PayloadValue) {\n if (!this.shouldReplaceVariableValues) {\n this.shouldReplaceVariableValues = true;\n }\n\n this.payloadValues.set(key, value);\n }\n\n setPayloadValues(values: Record<string, PayloadValue>) {\n Object.entries(values).forEach(([key, value]) => {\n this.setPayloadValue(key, value);\n });\n }\n\n /**\n * `setOpenTrackingPixel` will set the open tracking pixel.\n *\n * @param pixel - The open tracking pixel\n */\n setOpenTrackingPixel(pixel?: string) {\n this.openTrackingPixel = pixel;\n }\n\n /**\n * `setShouldReplaceVariableValues` will determine whether to replace the\n * variable values or not. Otherwise, it will just return the formatted variable.\n *\n * Default: `false`\n */\n setShouldReplaceVariableValues(shouldReplace: boolean) {\n this.shouldReplaceVariableValues = shouldReplace;\n }\n\n getAllLinks() {\n const nodes = this.content.content || [];\n const links = new Set<string>();\n\n const isValidLink = (href: string) => {\n return (\n href &&\n this.isValidUrl(href) &&\n !href.startsWith('#') &&\n !href.startsWith('mailto:') &&\n !href.startsWith('tel:') &&\n typeof href === 'string'\n );\n };\n\n const extractLinksFromNode = (node: JSONContent) => {\n if (node.type === 'button') {\n const originalLink = node.attrs?.url;\n if (isValidLink(originalLink) && originalLink) {\n links.add(originalLink);\n }\n } else if (node.content) {\n node.content.forEach((childNode) => {\n if (childNode.marks) {\n childNode.marks.forEach((mark) => {\n const originalLink = mark.attrs?.href;\n if (mark.type === 'link' && isValidLink(originalLink)) {\n links.add(originalLink);\n }\n });\n }\n if (childNode.content) {\n extractLinksFromNode(childNode);\n }\n });\n }\n };\n\n nodes.forEach((childNode) => {\n extractLinksFromNode(childNode);\n });\n\n return links;\n }\n\n private isValidUrl(href: string) {\n try {\n const _ = new URL(href);\n return true;\n } catch (err) {\n return false;\n }\n }\n\n async render(\n options: RenderOptions = DEFAULT_RENDER_OPTIONS\n ): Promise<string> {\n const markup = this.markup();\n return reactEmailRenderAsync(markup, options);\n }\n\n /**\n * `markup` will render the JSON content into React Email markup.\n * and return the raw React Tree.\n */\n markup() {\n const nodes = this.content.content || [];\n const jsxNodes = nodes.map((node, index) => {\n const nodeOptions: NodeOptions = {\n prev: nodes[index - 1],\n next: nodes[index + 1],\n parent: node,\n };\n\n const component = this.renderNode(node, nodeOptions);\n if (!component) {\n return null;\n }\n\n return <Fragment key={generateKey()}>{component}</Fragment>;\n });\n\n const { preview } = this.config;\n\n const markup = (\n <Html>\n <Head>\n <Font\n fallbackFontFamily=\"sans-serif\"\n fontFamily=\"Inter\"\n fontStyle=\"normal\"\n fontWeight={400}\n webFont={{\n url: 'https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19',\n format: 'woff2',\n }}\n />\n <style\n dangerouslySetInnerHTML={{\n __html: `blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}@media only screen and (max-width:425px){.tab-row-full{width:100%!important}.tab-col-full{display:block!important;width:100%!important}.tab-pad{padding:0!important}}`,\n }}\n />\n\n <meta content=\"width=device-width\" name=\"viewport\" />\n <meta content=\"IE=edge\" httpEquiv=\"X-UA-Compatible\" />\n <meta name=\"x-apple-disable-message-reformatting\" />\n <meta\n // http://www.html-5.com/metatags/format-detection-meta-tag.html\n // It will prevent iOS from automatically detecting possible phone numbers in a block of text\n content=\"telephone=no,address=no,email=no,date=no,url=no\"\n name=\"format-detection\"\n />\n <meta content=\"light\" name=\"color-scheme\" />\n <meta content=\"light\" name=\"supported-color-schemes\" />\n </Head>\n <Body\n style={{\n margin: 0,\n }}\n >\n {preview ? (\n <Preview id=\"__react-email-preview\">{preview}</Preview>\n ) : null}\n <Container\n style={{\n maxWidth: '600px',\n minWidth: '300px',\n width: '100%',\n marginLeft: 'auto',\n marginRight: 'auto',\n padding: '0.5rem',\n }}\n >\n {jsxNodes}\n </Container>\n {this.openTrackingPixel ? (\n <Img\n alt=\"\"\n src={this.openTrackingPixel}\n style={{\n display: 'none',\n width: '1px',\n height: '1px',\n }}\n />\n ) : null}\n </Body>\n </Html>\n );\n\n return markup;\n }\n\n private getMarginOverrideConditions(\n node: JSONContent,\n options?: NodeOptions\n ) {\n const { parent, prev, next } = options || {};\n\n const isNextSpacer = next?.type === 'spacer';\n const isPrevSpacer = prev?.type === 'spacer';\n\n const isParentListItem = parent?.type === 'listItem';\n\n const isLastSectionElement = parent?.type === 'section' && !next;\n const isFirstSectionElement = parent?.type === 'section' && !prev;\n\n const isLastColumnElement = parent?.type === 'column' && !next;\n const isFirstColumnElement = parent?.type === 'column' && !prev;\n\n const isFirstForElement = parent?.type === 'for' && !prev;\n const isLastForElement = parent?.type === 'for' && !next;\n\n const isFirstShowElement = parent?.type === 'show' && !prev;\n const isLastShowElement = parent?.type === 'show' && !next;\n\n return {\n isNextSpacer,\n isPrevSpacer,\n isLastSectionElement,\n isFirstSectionElement,\n isParentListItem,\n isLastColumnElement,\n isFirstColumnElement,\n isFirstForElement,\n isLastForElement,\n isFirstShowElement,\n isLastShowElement,\n\n shouldRemoveTopMargin:\n isPrevSpacer ||\n isFirstSectionElement ||\n isFirstColumnElement ||\n isFirstForElement ||\n isFirstShowElement,\n shouldRemoveBottomMargin:\n isNextSpacer ||\n isLastSectionElement ||\n isLastColumnElement ||\n isLastForElement ||\n isLastShowElement,\n };\n }\n\n // `getMappedContent` will call corresponding node type\n // and return text content\n private getMappedContent(\n node: JSONContent,\n options?: NodeOptions\n ): JSX.Element[] {\n const allNodes = node.content || [];\n return allNodes\n .map((childNode, index) => {\n const component = this.renderNode(childNode, {\n ...options,\n next: allNodes[index + 1],\n prev: allNodes[index - 1],\n });\n if (!component) {\n return null;\n }\n\n return <Fragment key={generateKey()}>{component}</Fragment>;\n })\n .filter((n) => n !== null) as JSX.Element[];\n }\n\n // `renderNode` will call the method of the corresponding node type\n private renderNode(\n node: JSONContent,\n options: NodeOptions = {}\n ): JSX.Element | null {\n const type = node.type || '';\n\n if (type in this) {\n // @ts-expect-error - `this` is not assignable to type 'never'\n return this[type]?.(node, options) as JSX.Element;\n }\n\n throw new Error(`Node type \"${type}\" is not supported.`);\n }\n\n // `renderMark` will call the method of the corresponding mark type\n private renderMark(node: JSONContent): JSX.Element {\n // It will wrap the text with the corresponding mark type\n const text = node?.text || <>&nbsp;</>;\n const marks = node?.marks || [];\n\n return marks.reduce(\n (acc, mark) => {\n const type = mark.type;\n if (type in this) {\n // @ts-expect-error - `this` is not assignable to type 'never'\n return this[type]?.(mark, acc) as JSX.Element;\n }\n\n throw new Error(`Mark type \"${type}\" is not supported.`);\n },\n <>{text}</>\n );\n }\n\n private paragraph(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const alignment = attrs?.textAlign || 'left';\n const { isParentListItem, shouldRemoveBottomMargin } =\n this.getMarginOverrideConditions(node, options);\n\n return (\n <Text\n style={{\n textAlign: alignment,\n marginBottom:\n isParentListItem || shouldRemoveBottomMargin ? '0px' : '20px',\n marginTop: '0px',\n fontSize: this.config.theme?.fontSize?.paragraph,\n color: this.config.theme?.colors?.paragraph,\n ...antialiased,\n }}\n >\n {node.content ? (\n this.getMappedContent(node, {\n ...options,\n parent: node,\n })\n ) : (\n <>&nbsp;</>\n )}\n </Text>\n );\n }\n\n private text(node: JSONContent, _?: NodeOptions): JSX.Element {\n const text = node.text || '&nbsp';\n if (node.marks) {\n return this.renderMark(node);\n }\n\n return <>{text}</>;\n }\n\n private bold(_: MarkType, text: JSX.Element): JSX.Element {\n return <strong>{text}</strong>;\n }\n\n private italic(_: MarkType, text: JSX.Element): JSX.Element {\n return <em>{text}</em>;\n }\n\n private underline(_: MarkType, text: JSX.Element): JSX.Element {\n return <u>{text}</u>;\n }\n\n private strike(_: MarkType, text: JSX.Element): JSX.Element {\n return <s style={{ textDecoration: 'line-through' }}>{text}</s>;\n }\n\n private textStyle(mark: MarkType, text: JSX.Element): JSX.Element {\n const { attrs } = mark;\n const { color = this.config.theme?.colors?.paragraph } = attrs || {};\n\n return (\n <span\n style={{\n color,\n }}\n >\n {text}\n </span>\n );\n }\n\n private link(mark: MarkType, text: JSX.Element): JSX.Element {\n const { attrs } = mark;\n let href = attrs?.href || '#';\n const target = attrs?.target || '_blank';\n const rel = attrs?.rel || 'noopener noreferrer nofollow';\n\n // If the href value is provided, use it to replace the link\n // Otherwise, use the original link\n if (\n typeof this.linkValues === 'object' ||\n typeof this.variableValues === 'object'\n ) {\n href = this.linkValues.get(href) || this.variableValues.get(href) || href;\n }\n\n return (\n <Link\n href={href}\n rel={rel}\n style={{\n fontWeight: 500,\n textDecoration: 'underline',\n color: this.config.theme?.colors?.heading,\n }}\n target={target}\n >\n {text}\n </Link>\n );\n }\n\n private heading(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n\n const level = `h${Number(attrs?.level) || 1}`;\n const alignment = attrs?.textAlign || 'left';\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n const { fontSize, lineHeight, fontWeight } =\n headings[level as AllowedHeadings];\n\n return (\n <Heading\n // @ts-expect-error - `this` is not assignable to type 'never'\n as={level}\n style={{\n textAlign: alignment,\n color: this.config.theme?.colors?.heading,\n marginBottom: shouldRemoveBottomMargin ? '0' : '12px',\n marginTop: 0,\n fontSize,\n lineHeight,\n fontWeight,\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Heading>\n );\n }\n\n private variable(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { payloadValue } = options || {};\n const { id: variable, fallback } = node.attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow || !variable) {\n return <></>;\n }\n\n let formattedVariable = this.variableFormatter({\n variable,\n fallback,\n });\n\n // If `shouldReplaceVariableValues` is true, replace the variable values\n // Otherwise, just return the formatted variable\n if (this.shouldReplaceVariableValues) {\n formattedVariable =\n (typeof payloadValue === 'object'\n ? payloadValue[variable]\n : payloadValue) ??\n this.variableValues.get(variable) ??\n fallback ??\n formattedVariable;\n }\n\n if (node?.marks) {\n return this.renderMark({\n text: formattedVariable,\n marks: node.marks,\n });\n }\n\n return <>{formattedVariable}</>;\n }\n\n private horizontalRule(_: JSONContent, __?: NodeOptions): JSX.Element {\n return (\n <Hr\n style={{\n marginTop: '32px',\n marginBottom: '32px',\n }}\n />\n );\n }\n\n private orderedList(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n return (\n <Container>\n <ol\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0' : '20px',\n paddingLeft: '26px',\n listStyleType: 'decimal',\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </ol>\n </Container>\n );\n }\n\n private bulletList(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { parent, next } = options || {};\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n {\n parent,\n next,\n }\n );\n\n return (\n <Container\n style={{\n maxWidth: '100%',\n }}\n >\n <ul\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0' : '20px',\n paddingLeft: '26px',\n listStyleType: 'disc',\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </ul>\n </Container>\n );\n }\n\n private listItem(node: JSONContent, options?: NodeOptions): JSX.Element {\n return (\n <li\n style={{\n marginBottom: '8px',\n paddingLeft: '6px',\n ...antialiased,\n }}\n >\n {this.getMappedContent(node, { ...options, parent: node })}\n </li>\n );\n }\n\n private button(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n text,\n url,\n variant,\n buttonColor,\n textColor,\n borderRadius,\n // @TODO: Update the attribute to `textAlign`\n alignment = 'left',\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n let radius: string | undefined = '0px';\n if (borderRadius === 'round') {\n radius = '9999px';\n } else if (borderRadius === 'smooth') {\n radius = '6px';\n }\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n const href =\n this.linkValues.get(url) || this.variableValues.get(url) || url;\n\n return (\n <Container\n style={{\n textAlign: alignment,\n maxWidth: '100%',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n }}\n >\n <Button\n href={href}\n style={{\n color: String(textColor),\n backgroundColor:\n variant === 'filled' ? String(buttonColor) : 'transparent',\n borderColor: String(buttonColor),\n padding: variant === 'filled' ? '12px 34px' : '10px 34px',\n borderWidth: '2px',\n borderStyle: 'solid',\n textDecoration: 'none',\n fontSize: '14px',\n fontWeight: 500,\n borderRadius: radius,\n }}\n >\n {text}\n </Button>\n </Container>\n );\n }\n\n private spacer(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { height = 'auto' } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n return (\n <Container\n style={{\n height: spacers[height as AllowedSpacers] || height,\n }}\n />\n );\n }\n\n private hardBreak(_: JSONContent, __?: NodeOptions): JSX.Element {\n return <br />;\n }\n\n private logo(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n src,\n alt,\n title,\n size,\n // @TODO: Update the attribute to `textAlign`\n alignment = 'left',\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n return (\n <Row\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '32px',\n }}\n >\n <Column align={alignment}>\n <Img\n alt={alt || title || 'Logo'}\n src={src}\n style={{\n width: logoSizes[size as AllowedLogoSizes] || size,\n height: logoSizes[size as AllowedLogoSizes] || size,\n }}\n title={title || alt || 'Logo'}\n />\n </Column>\n </Row>\n );\n }\n\n private image(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n src,\n alt,\n title,\n width = 'auto',\n alignment = 'center',\n externalLink = '',\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n // Handle width value\n const imageWidth = width === 'auto' ? 'auto' : Number(width);\n const widthStyle = imageWidth === 'auto' ? 'auto' : `${imageWidth}px`;\n\n const mainImage = (\n <Img\n alt={alt || title || 'Image'}\n src={src}\n style={{\n width: widthStyle, // Use the calculated width\n maxWidth: '100%', // Ensure image doesn't overflow container\n outline: 'none',\n border: 'none',\n textDecoration: 'none',\n display: 'block', // Prevent unwanted spacing\n }}\n title={title || alt || 'Image'}\n />\n );\n\n return (\n <Row\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '32px',\n }}\n >\n <Column align={alignment}>\n {externalLink ? (\n <a\n href={externalLink}\n rel=\"noopener noreferrer\"\n style={{\n display: 'block',\n maxWidth: '100%',\n textDecoration: 'none',\n }}\n target=\"_blank\"\n >\n {mainImage}\n </a>\n ) : (\n mainImage\n )}\n </Column>\n </Row>\n );\n }\n\n private footer(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { textAlign = 'left' } = attrs || {};\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n return (\n <Text\n style={{\n fontSize: this.config.theme?.fontSize?.footer?.size,\n lineHeight: this.config.theme?.fontSize?.footer?.lineHeight,\n color: this.config.theme?.colors?.footer,\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n textAlign,\n ...antialiased,\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Text>\n );\n }\n\n private blockquote(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { isPrevSpacer, shouldRemoveBottomMargin } =\n this.getMarginOverrideConditions(node, options);\n\n return (\n <blockquote\n style={{\n borderLeftWidth: '4px',\n borderLeftStyle: 'solid',\n borderLeftColor: this.config.theme?.colors?.blockquoteBorder,\n paddingLeft: '16px',\n marginLeft: '0px',\n marginRight: '0px',\n marginTop: isPrevSpacer ? '0px' : '20px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </blockquote>\n );\n }\n private code(_: MarkType, text: JSX.Element): JSX.Element {\n return (\n <code\n style={{\n backgroundColor: this.config.theme?.colors?.codeBackground,\n color: this.config.theme?.colors?.codeText,\n padding: '2px 4px',\n borderRadius: '6px',\n fontFamily: CODE_FONT_FAMILY,\n fontWeight: 400,\n letterSpacing: 0,\n }}\n >\n {text}\n </code>\n );\n }\n private linkCard(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n const { title, description, link, linkTitle, image, badgeText, subTitle } =\n attrs || {};\n const href =\n this.linkValues.get(link) || this.variableValues.get(link) || link || '#';\n\n return (\n <a\n href={href}\n rel=\"noopener noreferrer\"\n style={{\n border: '1px solid #eaeaea',\n borderRadius: '10px',\n textDecoration: 'none',\n color: 'inherit',\n display: 'block',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n }}\n target=\"_blank\"\n >\n {image ? (\n <Row\n style={{\n marginBottom: '6px',\n }}\n >\n <Column\n style={{\n width: '100%',\n height: '100%',\n }}\n >\n <Img\n alt={title || 'Link Card'}\n src={image}\n style={{\n borderRadius: '10px 10px 0 0',\n width: '100%',\n height: '100%',\n objectFit: 'cover',\n }}\n title={title || 'Link Card'}\n />\n </Column>\n </Row>\n ) : null}\n\n <Row\n style={{\n padding: '15px',\n marginTop: 0,\n marginBottom: 0,\n }}\n >\n <Column\n style={{\n verticalAlign: 'top',\n }}\n >\n <Row\n align={undefined}\n style={{\n marginBottom: '8px',\n marginTop: '0px',\n }}\n width=\"auto\"\n >\n <Column>\n <Text\n style={{\n fontSize: '18px',\n fontWeight: 600,\n color: this.config.theme?.colors?.linkCardTitle,\n margin: '0px',\n ...antialiased,\n }}\n >\n {title}\n </Text>\n </Column>\n {badgeText || subTitle ? (\n <Column\n style={{\n paddingLeft: '6px',\n verticalAlign: 'middle',\n }}\n >\n {badgeText ? (\n <span\n style={{\n fontWeight: 600,\n color: this.config.theme?.colors?.linkCardBadgeText,\n padding: '4px 8px',\n borderRadius: '8px',\n backgroundColor:\n this.config.theme?.colors?.linkCardBadgeBackground,\n fontSize: '12px',\n lineHeight: '12px',\n }}\n >\n {badgeText}\n </span>\n ) : null}{' '}\n {subTitle && !badgeText ? (\n <span\n style={{\n fontWeight: 'normal',\n color: this.config.theme?.colors?.linkCardSubTitle,\n fontSize: '12px',\n lineHeight: '12px',\n }}\n >\n {subTitle}\n </span>\n ) : null}\n </Column>\n ) : null}\n </Row>\n <Text\n style={{\n fontSize: '16px',\n color: this.config.theme?.colors?.linkCardDescription,\n marginTop: '0px',\n marginBottom: '0px',\n ...antialiased,\n }}\n >\n {description}{' '}\n {linkTitle ? (\n <a\n href={href}\n rel=\"noopener noreferrer\"\n style={{\n color: this.config.theme?.colors?.linkCardTitle,\n fontSize: '14px',\n fontWeight: 600,\n textDecoration: 'underline',\n }}\n >\n {linkTitle}\n </a>\n ) : null}\n </Text>\n </Column>\n </Row>\n </a>\n );\n }\n\n private section(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n borderRadius = 0,\n backgroundColor = DEFAULT_SECTION_BACKGROUND_COLOR,\n align = DEFAULT_SECTION_ALIGN,\n borderWidth = DEFAULT_SECTION_BORDER_WIDTH,\n borderColor = DEFAULT_SECTION_BORDER_COLOR,\n\n marginTop = DEFAULT_SECTION_MARGIN_TOP,\n marginRight = DEFAULT_SECTION_MARGIN_RIGHT,\n marginBottom = DEFAULT_SECTION_MARGIN_BOTTOM,\n marginLeft = DEFAULT_SECTION_MARGIN_LEFT,\n\n paddingTop = DEFAULT_SECTION_PADDING_TOP,\n paddingRight = DEFAULT_SECTION_PADDING_RIGHT,\n paddingBottom = DEFAULT_SECTION_PADDING_BOTTOM,\n paddingLeft = DEFAULT_SECTION_PADDING_LEFT,\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n return (\n <Row\n style={{\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n }}\n >\n <Column\n align={align}\n style={{\n borderColor,\n borderWidth,\n borderStyle: 'solid',\n backgroundColor,\n borderRadius,\n\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Column>\n </Row>\n );\n }\n\n private columns(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n const [newNode, totalWidth] = this.adjustColumnsContent(node);\n\n return (\n <Row\n width={`${totalWidth}%`}\n style={{\n margin: 0,\n padding: 0,\n width: `${totalWidth}%`,\n }}\n className=\"tab-row-full\"\n >\n {this.getMappedContent(newNode, {\n ...options,\n parent: newNode,\n })}\n </Row>\n );\n }\n\n private adjustColumnsContent(node: JSONContent): [JSONContent, number] {\n const { content = [] } = node;\n const totalWidth = 100;\n const columnsWithWidth = content.filter(\n (c) => c.type === 'column' && Boolean(Number(c.attrs?.width || 0))\n );\n const autoWidthColumns = content.filter(\n (c) =>\n c.type === 'column' && (c.attrs?.width === 'auto' || !c.attrs?.width)\n );\n\n const totalWidthUsed = columnsWithWidth.reduce(\n (acc, c) => acc + Number(c.attrs?.width),\n 0\n );\n\n const remainingWidth = totalWidth - totalWidthUsed;\n const measuredWidth = remainingWidth / autoWidthColumns.length;\n\n const gap = node.attrs?.gap || DEFAULT_COLUMNS_GAP;\n\n return [\n {\n ...node,\n content: content.map((c, index) => {\n const isAutoWidthColumn =\n c.type === 'column' &&\n (c.attrs?.width === 'auto' || !c.attrs?.width);\n const isFirstColumn = index === 0;\n const isLastColumn = index === content.length - 1;\n\n return {\n ...c,\n attrs: {\n ...c.attrs,\n width: isAutoWidthColumn ? measuredWidth : c.attrs?.width,\n\n isFirstColumn,\n isLastColumn,\n index,\n\n paddingLeft: isFirstColumn ? 0 : gap / 2,\n paddingRight: isLastColumn ? 0 : gap / 2,\n },\n };\n }),\n },\n autoWidthColumns.length === 0\n ? Math.min(totalWidth, totalWidthUsed)\n : totalWidth,\n ];\n }\n\n private column(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n width,\n verticalAlign = 'top',\n paddingLeft = 0,\n paddingRight = 0,\n } = attrs || {};\n\n return (\n <Column\n width={`${Number(width)}%`}\n style={{\n width: `${Number(width)}%`,\n margin: 0,\n verticalAlign,\n }}\n className=\"tab-col-full\"\n >\n <Section\n style={{\n margin: 0,\n paddingLeft,\n paddingRight,\n }}\n className=\"tab-pad\"\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Section>\n </Column>\n );\n }\n\n private for(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { each = '' } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n let { payloadValue } = options || {};\n payloadValue = typeof payloadValue === 'object' ? payloadValue : {};\n\n const values = this.payloadValues.get(each) ?? payloadValue[each] ?? [];\n if (!Array.isArray(values)) {\n throw new Error(`Payload value for each \"${each}\" is not an array`);\n }\n\n return (\n <>\n {values.map((value) => {\n return (\n <Fragment key={generateKey()}>\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n payloadValue: value,\n })}\n </Fragment>\n );\n })}\n </>\n );\n }\n\n private shouldShow(node: JSONContent, options?: NodeOptions): boolean {\n const showIfKey = node?.attrs?.showIfKey ?? '';\n if (!showIfKey) {\n return true;\n }\n\n let { payloadValue } = options || {};\n payloadValue = typeof payloadValue === 'object' ? payloadValue : {};\n return !!(this.payloadValues.get(showIfKey) ?? payloadValue[showIfKey]);\n }\n}\n","function clamp(n, min, max) {\n return Math.min(max, Math.max(min, n));\n}\nfunction sum(...args) {\n return flattenArrayable(args).reduce((a, b) => a + b, 0);\n}\nfunction lerp(min, max, t) {\n const interpolation = clamp(t, 0, 1);\n return min + (max - min) * interpolation;\n}\nfunction remap(n, inMin, inMax, outMin, outMax) {\n const interpolation = (n - inMin) / (inMax - inMin);\n return lerp(outMin, outMax, interpolation);\n}\n\nfunction toArray(array) {\n array = array ?? [];\n return Array.isArray(array) ? array : [array];\n}\nfunction flattenArrayable(array) {\n return toArray(array).flat(1);\n}\nfunction mergeArrayable(...args) {\n return args.flatMap((i) => toArray(i));\n}\nfunction partition(array, ...filters) {\n const result = Array.from({ length: filters.length + 1 }).fill(null).map(() => []);\n array.forEach((e, idx, arr) => {\n let i = 0;\n for (const filter of filters) {\n if (filter(e, idx, arr)) {\n result[i].push(e);\n return;\n }\n i += 1;\n }\n result[i].push(e);\n });\n return result;\n}\nfunction uniq(array) {\n return Array.from(new Set(array));\n}\nfunction uniqueBy(array, equalFn) {\n return array.reduce((acc, cur) => {\n const index = acc.findIndex((item) => equalFn(cur, item));\n if (index === -1)\n acc.push(cur);\n return acc;\n }, []);\n}\nfunction last(array) {\n return at(array, -1);\n}\nfunction remove(array, value) {\n if (!array)\n return false;\n const index = array.indexOf(value);\n if (index >= 0) {\n array.splice(index, 1);\n return true;\n }\n return false;\n}\nfunction at(array, index) {\n const len = array.length;\n if (!len)\n return void 0;\n if (index < 0)\n index += len;\n return array[index];\n}\nfunction range(...args) {\n let start, stop, step;\n if (args.length === 1) {\n start = 0;\n step = 1;\n [stop] = args;\n } else {\n [start, stop, step = 1] = args;\n }\n const arr = [];\n let current = start;\n while (current < stop) {\n arr.push(current);\n current += step || 1;\n }\n return arr;\n}\nfunction move(arr, from, to) {\n arr.splice(to, 0, arr.splice(from, 1)[0]);\n return arr;\n}\nfunction clampArrayRange(n, arr) {\n return clamp(n, 0, arr.length - 1);\n}\nfunction sample(arr, quantity) {\n return Array.from({ length: quantity }, (_) => arr[Math.round(Math.random() * (arr.length - 1))]);\n}\nfunction shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [array[i], array[j]] = [array[j], array[i]];\n }\n return array;\n}\n\nfunction assert(condition, message) {\n if (!condition)\n throw new Error(message);\n}\nconst toString = (v) => Object.prototype.toString.call(v);\nfunction getTypeName(v) {\n if (v === null)\n return \"null\";\n const type = toString(v).slice(8, -1).toLowerCase();\n return typeof v === \"object\" || typeof v === \"function\" ? type : typeof v;\n}\nfunction noop() {\n}\n\nfunction isDeepEqual(value1, value2) {\n const type1 = getTypeName(value1);\n const type2 = getTypeName(value2);\n if (type1 !== type2)\n return false;\n if (type1 === \"array\") {\n if (value1.length !== value2.length)\n return false;\n return value1.every((item, i) => {\n return isDeepEqual(item, value2[i]);\n });\n }\n if (type1 === \"object\") {\n const keyArr = Object.keys(value1);\n if (keyArr.length !== Object.keys(value2).length)\n return false;\n return keyArr.every((key) => {\n return isDeepEqual(value1[key], value2[key]);\n });\n }\n return Object.is(value1, value2);\n}\n\nfunction notNullish(v) {\n return v != null;\n}\nfunction noNull(v) {\n return v !== null;\n}\nfunction notUndefined(v) {\n return v !== void 0;\n}\nfunction isTruthy(v) {\n return Boolean(v);\n}\n\nconst isDef = (val) => typeof val !== \"undefined\";\nconst isBoolean = (val) => typeof val === \"boolean\";\nconst isFunction = (val) => typeof val === \"function\";\nconst isNumber = (val) => typeof val === \"number\";\nconst isString = (val) => typeof val === \"string\";\nconst isObject = (val) => toString(val) === \"[object Object]\";\nconst isUndefined = (val) => toString(val) === \"[object Undefined]\";\nconst isNull = (val) => toString(val) === \"[object Null]\";\nconst isRegExp = (val) => toString(val) === \"[object RegExp]\";\nconst isDate = (val) => toString(val) === \"[object Date]\";\nconst isWindow = (val) => typeof window !== \"undefined\" && toString(val) === \"[object Window]\";\nconst isBrowser = typeof window !== \"undefined\";\n\nfunction slash(str) {\n return str.replace(/\\\\/g, \"/\");\n}\nfunction ensurePrefix(prefix, str) {\n if (!str.startsWith(prefix))\n return prefix + str;\n return str;\n}\nfunction ensureSuffix(suffix, str) {\n if (!str.endsWith(suffix))\n return str + suffix;\n return str;\n}\nfunction template(str, ...args) {\n const [firstArg, fallback] = args;\n if (isObject(firstArg)) {\n const vars = firstArg;\n return str.replace(/{([\\w\\d]+)}/g, (_, key) => vars[key] || ((typeof fallback === \"function\" ? fallback(key) : fallback) ?? key));\n } else {\n return str.replace(/{(\\d+)}/g, (_, key) => {\n const index = Number(key);\n if (Number.isNaN(index))\n return key;\n return args[index];\n });\n }\n}\nconst urlAlphabet = \"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict\";\nfunction randomStr(size = 16, dict = urlAlphabet) {\n let id = \"\";\n let i = size;\n const len = dict.length;\n while (i--)\n id += dict[Math.random() * len | 0];\n return id;\n}\nfunction capitalize(str) {\n return str[0].toUpperCase() + str.slice(1).toLowerCase();\n}\nconst _reFullWs = /^\\s*$/;\nfunction unindent(str) {\n const lines = (typeof str === \"string\" ? str : str[0]).split(\"\\n\");\n const whitespaceLines = lines.map((line) => _reFullWs.test(line));\n const commonIndent = lines.reduce((min, line, idx) => {\n var _a;\n if (whitespaceLines[idx])\n return min;\n const indent = (_a = line.match(/^\\s*/)) == null ? void 0 : _a[0].length;\n return indent === void 0 ? min : Math.min(min, indent);\n }, Number.POSITIVE_INFINITY);\n let emptyLinesHead = 0;\n while (emptyLinesHead < lines.length && whitespaceLines[emptyLinesHead])\n emptyLinesHead++;\n let emptyLinesTail = 0;\n while (emptyLinesTail < lines.length && whitespaceLines[lines.length - emptyLinesTail - 1])\n emptyLinesTail++;\n return lines.slice(emptyLinesHead, lines.length - emptyLinesTail).map((line) => line.slice(commonIndent)).join(\"\\n\");\n}\n\nconst timestamp = () => +Date.now();\n\nfunction batchInvoke(functions) {\n functions.forEach((fn) => fn && fn());\n}\nfunction invoke(fn) {\n return fn();\n}\nfunction tap(value, callback) {\n callback(value);\n return value;\n}\n\nfunction objectMap(obj, fn) {\n return Object.fromEntries(\n Object.entries(obj).map(([k, v]) => fn(k, v)).filter(notNullish)\n );\n}\nfunction isKeyOf(obj, k) {\n return k in obj;\n}\nfunction objectKeys(obj) {\n return Object.keys(obj);\n}\nfunction objectEntries(obj) {\n return Object.entries(obj);\n}\nfunction deepMerge(target, ...sources) {\n if (!sources.length)\n return target;\n const source = sources.shift();\n if (source === void 0)\n return target;\n if (isMergableObject(target) && isMergableObject(source)) {\n objectKeys(source).forEach((key) => {\n if (key === \"__proto__\" || key === \"constructor\" || key === \"prototype\")\n return;\n if (isMergableObject(source[key])) {\n if (!target[key])\n target[key] = {};\n if (isMergableObject(target[key])) {\n deepMerge(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n } else {\n target[key] = source[key];\n }\n });\n }\n return deepMerge(target, ...sources);\n}\nfunction deepMergeWithArray(target, ...sources) {\n if (!sources.length)\n return target;\n const source = sources.shift();\n if (source === void 0)\n return target;\n if (Array.isArray(target) && Array.isArray(source))\n target.push(...source);\n if (isMergableObject(target) && isMergableObject(source)) {\n objectKeys(source).forEach((key) => {\n if (key === \"__proto__\" || key === \"constructor\" || key === \"prototype\")\n return;\n if (Array.isArray(source[key])) {\n if (!target[key])\n target[key] = [];\n deepMergeWithArray(target[key], source[key]);\n } else if (isMergableObject(source[key])) {\n if (!target[key])\n target[key] = {};\n deepMergeWithArray(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n });\n }\n return deepMergeWithArray(target, ...sources);\n}\nfunction isMergableObject(item) {\n return isObject(item) && !Array.isArray(item);\n}\nfunction objectPick(obj, keys, omitUndefined = false) {\n return keys.reduce((n, k) => {\n if (k in obj) {\n if (!omitUndefined || obj[k] !== void 0)\n n[k] = obj[k];\n }\n return n;\n }, {});\n}\nfunction clearUndefined(obj) {\n Object.keys(obj).forEach((key) => obj[key] === void 0 ? delete obj[key] : {});\n return obj;\n}\nfunction hasOwnProperty(obj, v) {\n if (obj == null)\n return false;\n return Object.prototype.hasOwnProperty.call(obj, v);\n}\n\nfunction createSingletonPromise(fn) {\n let _promise;\n function wrapper() {\n if (!_promise)\n _promise = fn();\n return _promise;\n }\n wrapper.reset = async () => {\n const _prev = _promise;\n _promise = void 0;\n if (_prev)\n await _prev;\n };\n return wrapper;\n}\nfunction sleep(ms, callback) {\n return new Promise(\n (resolve) => setTimeout(async () => {\n await (callback == null ? void 0 : callback());\n resolve();\n }, ms)\n );\n}\nfunction createPromiseLock() {\n const locks = [];\n return {\n async run(fn) {\n const p = fn();\n locks.push(p);\n try {\n return await p;\n } finally {\n remove(locks, p);\n }\n },\n async wait() {\n await Promise.allSettled(locks);\n },\n isWaiting() {\n return Boolean(locks.length);\n },\n clear() {\n locks.length = 0;\n }\n };\n}\nfunction createControlledPromise() {\n let resolve, reject;\n const promise = new Promise((_resolve, _reject) => {\n resolve = _resolve;\n reject = _reject;\n });\n promise.resolve = resolve;\n promise.reject = reject;\n return promise;\n}\n\n/* eslint-disable no-undefined,no-param-reassign,no-shadow */\n\n/**\n * Throttle execution of a function. Especially useful for rate limiting\n * execution of handlers on events like resize and scroll.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)\n * are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,\n * as-is, to `callback` when the throttled-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds\n * while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed\n * one final time after the last throttled-function call. (After the throttled-function has not been called for\n * `delay` milliseconds, the internal counter is reset).\n * @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback\n * immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that\n * callback will never executed if both noLeading = true and noTrailing = true.\n * @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is\n * false (at end), schedule `callback` to execute after `delay` ms.\n *\n * @returns {Function} A new, throttled, function.\n */\nfunction throttle (delay, callback, options) {\n var _ref = options || {},\n _ref$noTrailing = _ref.noTrailing,\n noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,\n _ref$noLeading = _ref.noLeading,\n noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,\n _ref$debounceMode = _ref.debounceMode,\n debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;\n /*\n * After wrapper has stopped being called, this timeout ensures that\n * `callback` is executed at the proper times in `throttle` and `end`\n * debounce modes.\n */\n\n\n var timeoutID;\n var cancelled = false; // Keep track of the last time `callback` was executed.\n\n var lastExec = 0; // Function to clear existing timeout\n\n function clearExistingTimeout() {\n if (timeoutID) {\n clearTimeout(timeoutID);\n }\n } // Function to cancel next exec\n\n\n function cancel(options) {\n var _ref2 = options || {},\n _ref2$upcomingOnly = _ref2.upcomingOnly,\n upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;\n\n clearExistingTimeout();\n cancelled = !upcomingOnly;\n }\n /*\n * The `wrapper` function encapsulates all of the throttling / debouncing\n * functionality and when executed will limit the rate at which `callback`\n * is executed.\n */\n\n\n function wrapper() {\n for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {\n arguments_[_key] = arguments[_key];\n }\n\n var self = this;\n var elapsed = Date.now() - lastExec;\n\n if (cancelled) {\n return;\n } // Execute `callback` and update the `lastExec` timestamp.\n\n\n function exec() {\n lastExec = Date.now();\n callback.apply(self, arguments_);\n }\n /*\n * If `debounceMode` is true (at begin) this is used to clear the flag\n * to allow future `callback` executions.\n */\n\n\n function clear() {\n timeoutID = undefined;\n }\n\n if (!noLeading && debounceMode && !timeoutID) {\n /*\n * Since `wrapper` is being called for the first time and\n * `debounceMode` is true (at begin), execute `callback`\n * and noLeading != true.\n */\n exec();\n }\n\n clearExistingTimeout();\n\n if (debounceMode === undefined && elapsed > delay) {\n if (noLeading) {\n /*\n * In throttle mode with noLeading, if `delay` time has\n * been exceeded, update `lastExec` and schedule `callback`\n * to execute after `delay` ms.\n */\n lastExec = Date.now();\n\n if (!noTrailing) {\n timeoutID = setTimeout(debounceMode ? clear : exec, delay);\n }\n } else {\n /*\n * In throttle mode without noLeading, if `delay` time has been exceeded, execute\n * `callback`.\n */\n exec();\n }\n } else if (noTrailing !== true) {\n /*\n * In trailing throttle mode, since `delay` time has not been\n * exceeded, schedule `callback` to execute `delay` ms after most\n * recent execution.\n *\n * If `debounceMode` is true (at begin), schedule `clear` to execute\n * after `delay` ms.\n *\n * If `debounceMode` is false (at end), schedule `callback` to\n * execute after `delay` ms.\n */\n timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);\n }\n }\n\n wrapper.cancel = cancel; // Return the wrapper function.\n\n return wrapper;\n}\n\n/* eslint-disable no-undefined */\n/**\n * Debounce execution of a function. Debouncing, unlike throttling,\n * guarantees that a function is only executed a single time, either at the\n * very beginning of a series of calls, or at the very end.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n * to `callback` when the debounced-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds\n * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.\n * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).\n *\n * @returns {Function} A new, debounced function.\n */\n\nfunction debounce (delay, callback, options) {\n var _ref = options || {},\n _ref$atBegin = _ref.atBegin,\n atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin;\n\n return throttle(delay, callback, {\n debounceMode: atBegin !== false\n });\n}\n\n/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nclass Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n}\n\nconst AsyncResource = {\n\tbind(fn, _type, thisArg) {\n\t\treturn fn.bind(thisArg);\n\t},\n};\n\nfunction pLimit(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst next = () => {\n\t\tactiveCount--;\n\n\t\tif (queue.size > 0) {\n\t\t\tqueue.dequeue()();\n\t\t}\n\t};\n\n\tconst run = async (function_, resolve, arguments_) => {\n\t\tactiveCount++;\n\n\t\tconst result = (async () => function_(...arguments_))();\n\n\t\tresolve(result);\n\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\tnext();\n\t};\n\n\tconst enqueue = (function_, resolve, arguments_) => {\n\t\tqueue.enqueue(\n\t\t\tAsyncResource.bind(run.bind(undefined, function_, resolve, arguments_)),\n\t\t);\n\n\t\t(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// when the run function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve();\n\n\t\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\t\tqueue.dequeue()();\n\t\t\t}\n\t\t})();\n\t};\n\n\tconst generator = (function_, ...arguments_) => new Promise(resolve => {\n\t\tenqueue(function_, resolve, arguments_);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue() {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n\nconst VOID = Symbol(\"p-void\");\nclass PInstance extends Promise {\n constructor(items = [], options) {\n super(() => {\n });\n this.items = items;\n this.options = options;\n this.promises = /* @__PURE__ */ new Set();\n }\n get promise() {\n var _a;\n let batch;\n const items = [...Array.from(this.items), ...Array.from(this.promises)];\n if ((_a = this.options) == null ? void 0 : _a.concurrency) {\n const limit = pLimit(this.options.concurrency);\n batch = Promise.all(items.map((p2) => limit(() => p2)));\n } else {\n batch = Promise.all(items);\n }\n return batch.then((l) => l.filter((i) => i !== VOID));\n }\n add(...args) {\n args.forEach((i) => {\n this.promises.add(i);\n });\n }\n map(fn) {\n return new PInstance(\n Array.from(this.items).map(async (i, idx) => {\n const v = await i;\n if (v === VOID)\n return VOID;\n return fn(v, idx);\n }),\n this.options\n );\n }\n filter(fn) {\n return new PInstance(\n Array.from(this.items).map(async (i, idx) => {\n const v = await i;\n const r = await fn(v, idx);\n if (!r)\n return VOID;\n return v;\n }),\n this.options\n );\n }\n forEach(fn) {\n return this.map(fn).then();\n }\n reduce(fn, initialValue) {\n return this.promise.then((array) => array.reduce(fn, initialValue));\n }\n clear() {\n this.promises.clear();\n }\n then(fn) {\n const p2 = this.promise;\n if (fn)\n return p2.then(fn);\n else\n return p2;\n }\n catch(fn) {\n return this.promise.catch(fn);\n }\n finally(fn) {\n return this.promise.finally(fn);\n }\n}\nfunction p(items, options) {\n return new PInstance(items, options);\n}\n\nexport { assert, at, batchInvoke, capitalize, clamp, clampArrayRange, clearUndefined, createControlledPromise, createPromiseLock, createSingletonPromise, debounce, deepMerge, deepMergeWithArray, ensurePrefix, ensureSuffix, flattenArrayable, getTypeName, hasOwnProperty, invoke, isBoolean, isBrowser, isDate, isDeepEqual, isDef, isFunction, isKeyOf, isNull, isNumber, isObject, isRegExp, isString, isTruthy, isUndefined, isWindow, last, lerp, mergeArrayable, move, noNull, noop, notNullish, notUndefined, objectEntries, objectKeys, objectMap, objectPick, p, partition, randomStr, range, remap, remove, sample, shuffle, slash, sleep, sum, tap, template, throttle, timestamp, toArray, toString, unindent, uniq, uniqueBy };\n","export function generateKey() {\n // Length of 6 is enough to avoid collisions\n // for react keys\n return Math.random().toString(36).substr(2, 6);\n}\n","import type { JSONContent } from '@tiptap/core';\nimport { Maily } from './maily';\nimport type { MailyConfig, RenderOptions } from './maily';\n\nexport async function render(\n content: JSONContent,\n config?: MailyConfig & RenderOptions\n): Promise<string> {\n const { theme, preview, ...rest } = config || {};\n\n const maily = new Maily(content);\n maily.setPreviewText(preview);\n maily.setTheme(theme || {});\n\n maily.setPayloadValue('items', [\n {\n name: 'John Doe',\n },\n {\n name: 'Novu',\n },\n ]);\n\n maily.setPayloadValue('shouldShow', true);\n\n return maily.render(rest);\n}\n"],"mappings":"+nCAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,yBAAAE,GAAA,0BAAAC,GAAA,oCAAAC,GAAA,gCAAAC,GAAA,iCAAAC,GAAA,gCAAAC,GAAA,kCAAAC,GAAA,gCAAAC,GAAA,iCAAAC,GAAA,+BAAAC,GAAA,0BAAAC,EAAA,qCAAAC,EAAA,iCAAAC,EAAA,iCAAAC,EAAA,kCAAAC,EAAA,gCAAAC,EAAA,iCAAAC,EAAA,+BAAAC,EAAA,mCAAAC,GAAA,iCAAAC,GAAA,kCAAAC,GAAA,gCAAAC,EAAA,UAAAC,EAAA,WAAAC,KAAA,eAAAC,GAAA1B,ICAA,IAAA2B,EAA6C,iBAC7CC,EAgBO,mCACPC,EAAqD,+BC6FrD,IAAMC,GAAYC,GAAM,OAAO,UAAU,SAAS,KAAKA,CAAC,EAmDxD,IAAMC,GAAYC,GAAQC,GAASD,CAAG,IAAM,kBAwF5C,SAASE,GAAWC,EAAK,CACvB,OAAO,OAAO,KAAKA,CAAG,CACxB,CAIA,SAASC,EAAUC,KAAWC,EAAS,CACrC,GAAI,CAACA,EAAQ,OACX,OAAOD,EACT,IAAME,EAASD,EAAQ,MAAM,EAC7B,OAAIC,IAAW,OACNF,GACLG,EAAiBH,CAAM,GAAKG,EAAiBD,CAAM,GACrDE,GAAWF,CAAM,EAAE,QAASG,GAAQ,CAC9BA,IAAQ,aAAeA,IAAQ,eAAiBA,IAAQ,cAExDF,EAAiBD,EAAOG,CAAG,CAAC,GACzBL,EAAOK,CAAG,IACbL,EAAOK,CAAG,EAAI,CAAC,GACbF,EAAiBH,EAAOK,CAAG,CAAC,EAC9BN,EAAUC,EAA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eH,CAAO,EAC5BG,EAAM,SAASJ,GAAS,CAAC,CAAC,EAE1BI,EAAM,gBAAgB,QAAS,CAC7B,CACE,KAAM,UACR,EACA,CACE,KAAM,MACR,CACF,CAAC,EAEDA,EAAM,gBAAgB,aAAc,EAAI,EAEjCA,EAAM,OAAOF,CAAI,CAC1B","names":["src_exports","__export","DEFAULT_COLUMNS_GAP","DEFAULT_COLUMNS_WIDTH","DEFAULT_COLUMN_BACKGROUND_COLOR","DEFAULT_COLUMN_BORDER_COLOR","DEFAULT_COLUMN_BORDER_RADIUS","DEFAULT_COLUMN_BORDER_WIDTH","DEFAULT_COLUMN_PADDING_BOTTOM","DEFAULT_COLUMN_PADDING_LEFT","DEFAULT_COLUMN_PADDING_RIGHT","DEFAULT_COLUMN_PADDING_TOP","DEFAULT_SECTION_ALIGN","DEFAULT_SECTION_BACKGROUND_COLOR","DEFAULT_SECTION_BORDER_COLOR","DEFAULT_SECTION_BORDER_WIDTH","DEFAULT_SECTION_MARGIN_BOTTOM","DEFAULT_SECTION_MARGIN_LEFT","DEFAULT_SECTION_MARGIN_RIGHT","DEFAULT_SECTION_MARGIN_TOP","DEFAULT_SECTION_PADDING_BOTTOM","DEFAULT_SECTION_PADDING_LEFT","DEFAULT_SECTION_PADDING_RIGHT","DEFAULT_SECTION_PADDING_TOP","Maily","render","__toCommonJS","import_react","import_components","import_render","toString","v","isObject","val","toString","objectKeys","obj","deepMerge","target","sources","source","isMergableObject","objectKeys","key","isMergableObject","item","isObject","VOID","generateKey","import_jsx_runtime","spacers","antialiased","headings","logoSizes","DEFAULT_RENDER_OPTIONS","DEFAULT_THEME","CODE_FONT_FAMILY","DEFAULT_SECTION_BACKGROUND_COLOR","DEFAULT_SECTION_ALIGN","DEFAULT_SECTION_BORDER_WIDTH","DEFAULT_SECTION_BORDER_COLOR","DEFAULT_SECTION_MARGIN_TOP","DEFAULT_SECTION_MARGIN_RIGHT","DEFAULT_SECTION_MARGIN_BOTTOM","DEFAULT_SECTION_MARGIN_LEFT","DEFAULT_SECTION_PADDING_TOP","DEFAULT_SECTION_PADDING_RIGHT","DEFAULT_SECTION_PADDING_BOTTOM","DEFAULT_SECTION_PADDING_LEFT","DEFAULT_COLUMNS_WIDTH","DEFAULT_COLUMNS_GAP","DEFAULT_COLUMN_BACKGROUND_COLOR","DEFAULT_COLUMN_BORDER_RADIUS","DEFAULT_COLUMN_BORDER_WIDTH","DEFAULT_COLUMN_BORDER_COLOR","DEFAULT_COLUMN_PADDING_TOP","DEFAULT_COLUMN_PADDING_RIGHT","DEFAULT_COLUMN_PADDING_BOTTOM","DEFAULT_COLUMN_PADDING_LEFT","Maily","content","variable","fallback","preview","theme","deepMerge","formatter","value","values","link","key","pixel","shouldReplace","nodes","links","isValidLink","href","extractLinksFromNode","node","_a","originalLink","childNode","mark","_","err","__async","options","markup","reactEmailRenderAsync","jsxNodes","index","nodeOptions","component","generateKey","parent","prev","next","isNextSpacer","isPrevSpacer","isParentListItem","isLastSectionElement","isFirstSectionElement","isLastColumnElement","isFirstColumnElement","isFirstForElement","isLastForElement","isFirstShowElement","isLastShowElement","allNodes","__spreadProps","__spreadValues","n","type","text","acc","_b","_c","_d","attrs","alignment","shouldRemoveBottomMargin","antialiased","color","target","rel","level","fontSize","lineHeight","fontWeight","headings","payloadValue","formattedVariable","__","url","variant","buttonColor","textColor","borderRadius","radius","height","spacers","src","alt","title","size","width","externalLink","imageWidth","widthStyle","mainImage","_e","_f","_g","_h","textAlign","_i","_j","_k","_l","description","linkTitle","image","badgeText","subTitle","backgroundColor","align","borderWidth","borderColor","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","newNode","totalWidth","columnsWithWidth","c","autoWidthColumns","totalWidthUsed","measuredWidth","gap","isAutoWidthColumn","isFirstColumn","isLastColumn","verticalAlign","each","showIfKey","render","content","config","__async","_a","theme","preview","rest","__objRest","maily","Maily"]}
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- var $=Object.defineProperty,K=Object.defineProperties;var Y=Object.getOwnPropertyDescriptors;var L=Object.getOwnPropertySymbols;var z=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var X=(c,t,n)=>t in c?$(c,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):c[t]=n,f=(c,t)=>{for(var n in t||(t={}))z.call(t,n)&&X(c,n,t[n]);if(L)for(var n of L(t))j.call(t,n)&&X(c,n,t[n]);return c},g=(c,t)=>K(c,Y(t));var H=(c,t)=>{var n={};for(var e in c)z.call(c,e)&&t.indexOf(e)<0&&(n[e]=c[e]);if(c!=null&&L)for(var e of L(c))t.indexOf(e)<0&&j.call(c,e)&&(n[e]=c[e]);return n};var E=(c,t,n)=>new Promise((e,r)=>{var o=l=>{try{a(n.next(l))}catch(p){r(p)}},s=l=>{try{a(n.throw(l))}catch(p){r(p)}},a=l=>l.done?e(l.value):Promise.resolve(l.value).then(o,s);a((n=n.apply(c,t)).next())});import{Fragment as D}from"react";import{Text as V,Html as et,Head as nt,Body as ot,Font as rt,Container as T,Link as it,Heading as st,Hr as at,Button as lt,Img as k,Preview as ct,Row as C,Column as w,Section as pt}from"@react-email/components";import{renderAsync as ut}from"@react-email/render";var Q=c=>Object.prototype.toString.call(c);var Z=c=>Q(c)==="[object Object]";function tt(c){return Object.keys(c)}function A(c,...t){if(!t.length)return c;let n=t.shift();return n===void 0?c:(M(c)&&M(n)&&tt(n).forEach(e=>{e==="__proto__"||e==="constructor"||e==="prototype"||(M(n[e])?(c[e]||(c[e]={}),M(c[e])?A(c[e],n[e]):c[e]=n[e]):c[e]=n[e])}),A(c,...t))}function M(c){return Z(c)&&!Array.isArray(c)}var Jt=Symbol("p-void");function R(){return Math.random().toString(36).substr(2,6)}import{Fragment as x,jsx as i,jsxs as O}from"react/jsx-runtime";var ht={sm:"8px",md:"16px",lg:"32px",xl:"64px"},_={WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"};var dt={h1:{fontSize:"36px",lineHeight:"40px",fontWeight:800},h2:{fontSize:"30px",lineHeight:"36px",fontWeight:700},h3:{fontSize:"24px",lineHeight:"38px",fontWeight:600}};var G={sm:"40px",md:"48px",lg:"64px"},mt={pretty:!1,plainText:!1},q={colors:{heading:"#111827",paragraph:"#374151",horizontal:"#EAEAEA",footer:"#64748B",blockquoteBorder:"#D1D5DB",codeBackground:"#EFEFEF",codeText:"#111827",linkCardTitle:"#111827",linkCardDescription:"#6B7280",linkCardBadgeText:"#111827",linkCardBadgeBackground:"#FEF08A",linkCardSubTitle:"#6B7280"},fontSize:{paragraph:"15px",footer:{size:"14px",lineHeight:"24px"}}},ft='SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',gt="#ffffff",xt="left",yt=1,St="#000000",bt=0,wt=0,Ot=0,Ct=0,vt=5,Nt=5,Et=5,Tt=5,zt="100%",_t=8,jt="transparent",Ht=0,Gt=0,qt="transparent",$t=0,Kt=0,Yt=0,Qt=0,J=class{constructor(t={type:"doc",content:[]}){this.config={theme:q};this.variableFormatter=({variable:t,fallback:n})=>n?`{{${t},fallback=${n}}}`:`{{${t}}}`;this.shouldReplaceVariableValues=!1;this.variableValues=new Map;this.linkValues=new Map;this.payloadValues=new Map;this.content=t}setPreviewText(t){this.config.preview=t}setTheme(t){this.config.theme=A(this.config.theme||q,t)}setVariableFormatter(t){this.variableFormatter=t}setVariableValue(t,n){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.variableValues.set(t,n)}setVariableValues(t){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),Object.entries(t).forEach(([n,e])=>{this.setVariableValue(n,e)})}setLinkValue(t,n){this.linkValues.set(t,n)}setLinkValues(t){Object.entries(t).forEach(([n,e])=>{this.setLinkValue(n,e)})}setPayloadValue(t,n){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.payloadValues.set(t,n)}setPayloadValues(t){Object.entries(t).forEach(([n,e])=>{this.setPayloadValue(n,e)})}setOpenTrackingPixel(t){this.openTrackingPixel=t}setShouldReplaceVariableValues(t){this.shouldReplaceVariableValues=t}getAllLinks(){let t=this.content.content||[],n=new Set,e=o=>o&&this.isValidUrl(o)&&!o.startsWith("#")&&!o.startsWith("mailto:")&&!o.startsWith("tel:")&&typeof o=="string",r=o=>{var s;if(o.type==="button"){let a=(s=o.attrs)==null?void 0:s.url;e(a)&&a&&n.add(a)}else o.content&&o.content.forEach(a=>{a.marks&&a.marks.forEach(l=>{var u;let p=(u=l.attrs)==null?void 0:u.href;l.type==="link"&&e(p)&&n.add(p)}),a.content&&r(a)})};return t.forEach(o=>{r(o)}),n}isValidUrl(t){try{let n=new URL(t);return!0}catch(n){return!1}}render(){return E(this,arguments,function*(t=mt){let n=this.markup();return ut(n,t)})}markup(){let t=this.content.content||[],n=t.map((o,s)=>{let a={prev:t[s-1],next:t[s+1],parent:o},l=this.renderNode(o,a);return l?i(D,{children:l},R()):null}),{preview:e}=this.config;return O(et,{children:[O(nt,{children:[i(rt,{fallbackFontFamily:"sans-serif",fontFamily:"Inter",fontStyle:"normal",fontWeight:400,webFont:{url:"https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19",format:"woff2"}}),i("style",{dangerouslySetInnerHTML:{__html:"blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}@media only screen and (max-width:425px){.tab-row-full{width:100%!important}.tab-col-full{display:block!important;width:100%!important}.tab-pad{padding:0!important}}"}}),i("meta",{content:"width=device-width",name:"viewport"}),i("meta",{content:"IE=edge",httpEquiv:"X-UA-Compatible"}),i("meta",{name:"x-apple-disable-message-reformatting"}),i("meta",{content:"telephone=no,address=no,email=no,date=no,url=no",name:"format-detection"}),i("meta",{content:"light",name:"color-scheme"}),i("meta",{content:"light",name:"supported-color-schemes"})]}),O(ot,{style:{margin:0},children:[e?i(ct,{id:"__react-email-preview",children:e}):null,i(T,{style:{maxWidth:"600px",minWidth:"300px",width:"100%",marginLeft:"auto",marginRight:"auto",padding:"0.5rem"},children:n}),this.openTrackingPixel?i(k,{alt:"",src:this.openTrackingPixel,style:{display:"none",width:"1px",height:"1px"}}):null]})]})}getMarginOverrideConditions(t,n){let{parent:e,prev:r,next:o}=n||{},s=(o==null?void 0:o.type)==="spacer",a=(r==null?void 0:r.type)==="spacer",l=(e==null?void 0:e.type)==="listItem",p=(e==null?void 0:e.type)==="section"&&!o,u=(e==null?void 0:e.type)==="section"&&!r,h=(e==null?void 0:e.type)==="column"&&!o,d=(e==null?void 0:e.type)==="column"&&!r,m=(e==null?void 0:e.type)==="for"&&!r,y=(e==null?void 0:e.type)==="for"&&!o,S=(e==null?void 0:e.type)==="show"&&!r,b=(e==null?void 0:e.type)==="show"&&!o;return{isNextSpacer:s,isPrevSpacer:a,isLastSectionElement:p,isFirstSectionElement:u,isParentListItem:l,isLastColumnElement:h,isFirstColumnElement:d,isFirstForElement:m,isLastForElement:y,isFirstShowElement:S,isLastShowElement:b,shouldRemoveTopMargin:a||u||d||m||S,shouldRemoveBottomMargin:s||p||h||y||b}}getMappedContent(t,n){let e=t.content||[];return e.map((r,o)=>{let s=this.renderNode(r,g(f({},n),{next:e[o+1],prev:e[o-1]}));return s?i(D,{children:s},R()):null}).filter(r=>r!==null)}renderNode(t,n={}){var r;let e=t.type||"";if(e in this)return(r=this[e])==null?void 0:r.call(this,t,n);throw new Error(`Node type "${e}" is not supported.`)}renderMark(t){let n=(t==null?void 0:t.text)||i(x,{children:"\xA0"});return((t==null?void 0:t.marks)||[]).reduce((r,o)=>{var a;let s=o.type;if(s in this)return(a=this[s])==null?void 0:a.call(this,o,r);throw new Error(`Mark type "${s}" is not supported.`)},i(x,{children:n}))}paragraph(t,n){var a,l,p,u;let{attrs:e}=t,r=(e==null?void 0:e.textAlign)||"left",{isParentListItem:o,shouldRemoveBottomMargin:s}=this.getMarginOverrideConditions(t,n);return i(V,{style:f({textAlign:r,marginBottom:o||s?"0px":"20px",marginTop:"0px",fontSize:(l=(a=this.config.theme)==null?void 0:a.fontSize)==null?void 0:l.paragraph,color:(u=(p=this.config.theme)==null?void 0:p.colors)==null?void 0:u.paragraph},_),children:t.content?this.getMappedContent(t,g(f({},n),{parent:t})):i(x,{children:"\xA0"})})}text(t,n){let e=t.text||"&nbsp";return t.marks?this.renderMark(t):i(x,{children:e})}bold(t,n){return i("strong",{children:n})}italic(t,n){return i("em",{children:n})}underline(t,n){return i("u",{children:n})}strike(t,n){return i("s",{style:{textDecoration:"line-through"},children:n})}textStyle(t,n){var o,s;let{attrs:e}=t,{color:r=(s=(o=this.config.theme)==null?void 0:o.colors)==null?void 0:s.paragraph}=e||{};return i("span",{style:{color:r},children:n})}link(t,n){var a,l;let{attrs:e}=t,r=(e==null?void 0:e.href)||"#",o=(e==null?void 0:e.target)||"_blank",s=(e==null?void 0:e.rel)||"noopener noreferrer nofollow";return(typeof this.linkValues=="object"||typeof this.variableValues=="object")&&(r=this.linkValues.get(r)||this.variableValues.get(r)||r),i(it,{href:r,rel:s,style:{fontWeight:500,textDecoration:"underline",color:(l=(a=this.config.theme)==null?void 0:a.colors)==null?void 0:l.heading},target:o,children:n})}heading(t,n){var u,h;let{attrs:e}=t,r=`h${Number(e==null?void 0:e.level)||1}`,o=(e==null?void 0:e.textAlign)||"left",{shouldRemoveBottomMargin:s}=this.getMarginOverrideConditions(t,n),{fontSize:a,lineHeight:l,fontWeight:p}=dt[r];return i(st,{as:r,style:{textAlign:o,color:(h=(u=this.config.theme)==null?void 0:u.colors)==null?void 0:h.heading,marginBottom:s?"0":"12px",marginTop:0,fontSize:a,lineHeight:l,fontWeight:p},children:this.getMappedContent(t,g(f({},n),{parent:t}))})}variable(t,n){var l,p,u;let{payloadValue:e}=n||{},{id:r,fallback:o}=t.attrs||{};if(!this.shouldShow(t,n)||!r)return i(x,{});let a=this.variableFormatter({variable:r,fallback:o});return this.shouldReplaceVariableValues&&(a=(u=(p=(l=typeof e=="object"?e[r]:e)!=null?l:this.variableValues.get(r))!=null?p:o)!=null?u:a),t!=null&&t.marks?this.renderMark({text:a,marks:t.marks}):i(x,{children:a})}horizontalRule(t,n){return i(at,{style:{marginTop:"32px",marginBottom:"32px"}})}orderedList(t,n){let{shouldRemoveBottomMargin:e}=this.getMarginOverrideConditions(t,n);return i(T,{children:i("ol",{style:{marginTop:"0px",marginBottom:e?"0":"20px",paddingLeft:"26px",listStyleType:"decimal"},children:this.getMappedContent(t,g(f({},n),{parent:t}))})})}bulletList(t,n){let{parent:e,next:r}=n||{},{shouldRemoveBottomMargin:o}=this.getMarginOverrideConditions(t,{parent:e,next:r});return i(T,{style:{maxWidth:"100%"},children:i("ul",{style:{marginTop:"0px",marginBottom:o?"0":"20px",paddingLeft:"26px",listStyleType:"disc"},children:this.getMappedContent(t,g(f({},n),{parent:t}))})})}listItem(t,n){return i("li",{style:f({marginBottom:"8px",paddingLeft:"6px"},_),children:this.getMappedContent(t,g(f({},n),{parent:t}))})}button(t,n){let{attrs:e}=t,{text:r,url:o,variant:s,buttonColor:a,textColor:l,borderRadius:p,alignment:u="left"}=e||{};if(!this.shouldShow(t,n))return i(x,{});let d="0px";p==="round"?d="9999px":p==="smooth"&&(d="6px");let{shouldRemoveBottomMargin:m}=this.getMarginOverrideConditions(t,n),y=this.linkValues.get(o)||this.variableValues.get(o)||o;return i(T,{style:{textAlign:u,maxWidth:"100%",marginBottom:m?"0px":"20px"},children:i(lt,{href:y,style:{color:String(l),backgroundColor:s==="filled"?String(a):"transparent",borderColor:String(a),padding:s==="filled"?"12px 34px":"10px 34px",borderWidth:"2px",borderStyle:"solid",textDecoration:"none",fontSize:"14px",fontWeight:500,borderRadius:d},children:r})})}spacer(t,n){let{attrs:e}=t,{height:r="auto"}=e||{};return this.shouldShow(t,n)?i(T,{style:{height:ht[r]||r}}):i(x,{})}hardBreak(t,n){return i("br",{})}logo(t,n){let{attrs:e}=t,{src:r,alt:o,title:s,size:a,alignment:l="left"}=e||{};if(!this.shouldShow(t,n))return i(x,{});let{shouldRemoveBottomMargin:u}=this.getMarginOverrideConditions(t,n);return i(C,{style:{marginTop:"0px",marginBottom:u?"0px":"32px"},children:i(w,{align:l,children:i(k,{alt:o||s||"Logo",src:r,style:{width:G[a]||a,height:G[a]||a},title:s||o||"Logo"})})})}image(t,n){let{attrs:e}=t,{src:r,alt:o,title:s,width:a="auto",alignment:l="center",externalLink:p=""}=e||{};if(!this.shouldShow(t,n))return i(x,{});let{shouldRemoveBottomMargin:h}=this.getMarginOverrideConditions(t,n),d=a==="auto"?"auto":Number(a),m=i(k,{alt:o||s||"Image",src:r,style:{height:"auto",width:"100%",outline:"none",border:"none",textDecoration:"none"},height:"auto",width:d,title:s||o||"Image"});return i(C,{style:{marginTop:"0px",marginBottom:h?"0px":"32px"},children:i(w,{align:l,children:p?i("a",{href:p,rel:"noopener noreferrer",style:{display:"block",maxWidth:"100%",textDecoration:"none"},target:"_blank",children:m}):m})})}footer(t,n){var s,a,l,p,u,h,d,m;let{attrs:e}=t,{textAlign:r="left"}=e||{},{shouldRemoveBottomMargin:o}=this.getMarginOverrideConditions(t,n);return i(V,{style:f({fontSize:(l=(a=(s=this.config.theme)==null?void 0:s.fontSize)==null?void 0:a.footer)==null?void 0:l.size,lineHeight:(h=(u=(p=this.config.theme)==null?void 0:p.fontSize)==null?void 0:u.footer)==null?void 0:h.lineHeight,color:(m=(d=this.config.theme)==null?void 0:d.colors)==null?void 0:m.footer,marginTop:"0px",marginBottom:o?"0px":"20px",textAlign:r},_),children:this.getMappedContent(t,g(f({},n),{parent:t}))})}blockquote(t,n){var o,s;let{isPrevSpacer:e,shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(t,n);return i("blockquote",{style:{borderLeftWidth:"4px",borderLeftStyle:"solid",borderLeftColor:(s=(o=this.config.theme)==null?void 0:o.colors)==null?void 0:s.blockquoteBorder,paddingLeft:"16px",marginLeft:"0px",marginRight:"0px",marginTop:e?"0px":"20px",marginBottom:r?"0px":"20px"},children:this.getMappedContent(t,g(f({},n),{parent:t}))})}code(t,n){var e,r,o,s;return i("code",{style:{backgroundColor:(r=(e=this.config.theme)==null?void 0:e.colors)==null?void 0:r.codeBackground,color:(s=(o=this.config.theme)==null?void 0:o.colors)==null?void 0:s.codeText,padding:"2px 4px",borderRadius:"6px",fontFamily:ft,fontWeight:400,letterSpacing:0},children:n})}linkCard(t,n){var m,y,S,b,v,N,B,F,P,I,U,W;let{attrs:e}=t,{shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(t,n),{title:o,description:s,link:a,linkTitle:l,image:p,badgeText:u,subTitle:h}=e||{},d=this.linkValues.get(a)||this.variableValues.get(a)||a||"#";return O("a",{href:d,rel:"noopener noreferrer",style:{border:"1px solid #eaeaea",borderRadius:"10px",textDecoration:"none",color:"inherit",display:"block",marginBottom:r?"0px":"20px"},target:"_blank",children:[p?i(C,{style:{marginBottom:"6px"},children:i(w,{style:{width:"100%",height:"100%"},children:i(k,{alt:o||"Link Card",src:p,style:{borderRadius:"10px 10px 0 0",width:"100%",height:"100%",objectFit:"cover"},title:o||"Link Card"})})}):null,i(C,{style:{padding:"15px",marginTop:0,marginBottom:0},children:O(w,{style:{verticalAlign:"top"},children:[O(C,{align:void 0,style:{marginBottom:"8px",marginTop:"0px"},width:"auto",children:[i(w,{children:i(V,{style:f({fontSize:"18px",fontWeight:600,color:(y=(m=this.config.theme)==null?void 0:m.colors)==null?void 0:y.linkCardTitle,margin:"0px"},_),children:o})}),u||h?O(w,{style:{paddingLeft:"6px",verticalAlign:"middle"},children:[u?i("span",{style:{fontWeight:600,color:(b=(S=this.config.theme)==null?void 0:S.colors)==null?void 0:b.linkCardBadgeText,padding:"4px 8px",borderRadius:"8px",backgroundColor:(N=(v=this.config.theme)==null?void 0:v.colors)==null?void 0:N.linkCardBadgeBackground,fontSize:"12px",lineHeight:"12px"},children:u}):null," ",h&&!u?i("span",{style:{fontWeight:"normal",color:(F=(B=this.config.theme)==null?void 0:B.colors)==null?void 0:F.linkCardSubTitle,fontSize:"12px",lineHeight:"12px"},children:h}):null]}):null]}),O(V,{style:f({fontSize:"16px",color:(I=(P=this.config.theme)==null?void 0:P.colors)==null?void 0:I.linkCardDescription,marginTop:"0px",marginBottom:"0px"},_),children:[s," ",l?i("a",{href:d,rel:"noopener noreferrer",style:{color:(W=(U=this.config.theme)==null?void 0:U.colors)==null?void 0:W.linkCardTitle,fontSize:"14px",fontWeight:600,textDecoration:"underline"},children:l}):null]})]})})]})}section(t,n){let{attrs:e}=t,{borderRadius:r=0,backgroundColor:o=gt,align:s=xt,borderWidth:a=yt,borderColor:l=St,marginTop:p=bt,marginRight:u=wt,marginBottom:h=Ot,marginLeft:d=Ct,paddingTop:m=vt,paddingRight:y=Nt,paddingBottom:S=Et,paddingLeft:b=Tt}=e||{};return this.shouldShow(t,n)?i(C,{style:{marginTop:p,marginRight:u,marginBottom:h,marginLeft:d},children:i(w,{align:s,style:{borderColor:l,borderWidth:a,borderStyle:"solid",backgroundColor:o,borderRadius:r,paddingTop:m,paddingRight:y,paddingBottom:S,paddingLeft:b},children:this.getMappedContent(t,g(f({},n),{parent:t}))})}):i(x,{})}columns(t,n){let{attrs:e}=t;if(!this.shouldShow(t,n))return i(x,{});let[o,s]=this.adjustColumnsContent(t);return i(C,{width:`${s}%`,style:{margin:0,padding:0,width:`${s}%`},className:"tab-row-full",children:this.getMappedContent(o,g(f({},n),{parent:o}))})}adjustColumnsContent(t){var u;let{content:n=[]}=t,e=100,r=n.filter(h=>{var d;return h.type==="column"&&!!Number(((d=h.attrs)==null?void 0:d.width)||0)}),o=n.filter(h=>{var d,m;return h.type==="column"&&(((d=h.attrs)==null?void 0:d.width)==="auto"||!((m=h.attrs)!=null&&m.width))}),s=r.reduce((h,d)=>{var m;return h+Number((m=d.attrs)==null?void 0:m.width)},0),l=(e-s)/o.length,p=((u=t.attrs)==null?void 0:u.gap)||_t;return[g(f({},t),{content:n.map((h,d)=>{var b,v,N;let m=h.type==="column"&&(((b=h.attrs)==null?void 0:b.width)==="auto"||!((v=h.attrs)!=null&&v.width)),y=d===0,S=d===n.length-1;return g(f({},h),{attrs:g(f({},h.attrs),{width:m?l:(N=h.attrs)==null?void 0:N.width,isFirstColumn:y,isLastColumn:S,index:d,paddingLeft:y?0:p/2,paddingRight:S?0:p/2})})})}),o.length===0?Math.min(e,s):e]}column(t,n){let{attrs:e}=t,{width:r,verticalAlign:o="top",paddingLeft:s=0,paddingRight:a=0}=e||{};return i(w,{width:`${Number(r)}%`,style:{width:`${Number(r)}%`,margin:0,verticalAlign:o},className:"tab-col-full",children:i(pt,{style:{margin:0,paddingLeft:s,paddingRight:a},className:"tab-pad",children:this.getMappedContent(t,g(f({},n),{parent:t}))})})}for(t,n){var l,p;let{attrs:e}=t,{each:r=""}=e||{};if(!this.shouldShow(t,n))return i(x,{});let{payloadValue:s}=n||{};s=typeof s=="object"?s:{};let a=(p=(l=this.payloadValues.get(r))!=null?l:s[r])!=null?p:[];if(!Array.isArray(a))throw new Error(`Payload value for each "${r}" is not an array`);return i(x,{children:a.map(u=>i(D,{children:this.getMappedContent(t,g(f({},n),{parent:t,payloadValue:u}))},R()))})}shouldShow(t,n){var o,s,a;let e=(s=(o=t==null?void 0:t.attrs)==null?void 0:o.showIfKey)!=null?s:"";if(!e)return!0;let{payloadValue:r}=n||{};return r=typeof r=="object"?r:{},!!((a=this.payloadValues.get(e))!=null?a:r[e])}};function oe(c,t){return E(this,null,function*(){let s=t||{},{theme:n,preview:e}=s,r=H(s,["theme","preview"]),o=new J(c);return o.setPreviewText(e),o.setTheme(n||{}),o.setPayloadValue("items",[{name:"John Doe"},{name:"Novu"}]),o.setPayloadValue("shouldShow",!0),o.render(r)})}export{_t as DEFAULT_COLUMNS_GAP,zt as DEFAULT_COLUMNS_WIDTH,jt as DEFAULT_COLUMN_BACKGROUND_COLOR,qt as DEFAULT_COLUMN_BORDER_COLOR,Ht as DEFAULT_COLUMN_BORDER_RADIUS,Gt as DEFAULT_COLUMN_BORDER_WIDTH,Yt as DEFAULT_COLUMN_PADDING_BOTTOM,Qt as DEFAULT_COLUMN_PADDING_LEFT,Kt as DEFAULT_COLUMN_PADDING_RIGHT,$t as DEFAULT_COLUMN_PADDING_TOP,xt as DEFAULT_SECTION_ALIGN,gt as DEFAULT_SECTION_BACKGROUND_COLOR,St as DEFAULT_SECTION_BORDER_COLOR,yt as DEFAULT_SECTION_BORDER_WIDTH,Ot as DEFAULT_SECTION_MARGIN_BOTTOM,Ct as DEFAULT_SECTION_MARGIN_LEFT,wt as DEFAULT_SECTION_MARGIN_RIGHT,bt as DEFAULT_SECTION_MARGIN_TOP,Et as DEFAULT_SECTION_PADDING_BOTTOM,Tt as DEFAULT_SECTION_PADDING_LEFT,Nt as DEFAULT_SECTION_PADDING_RIGHT,vt as DEFAULT_SECTION_PADDING_TOP,J as Maily,oe as render};
1
+ var $=Object.defineProperty,K=Object.defineProperties;var Y=Object.getOwnPropertyDescriptors;var L=Object.getOwnPropertySymbols;var z=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var X=(c,t,n)=>t in c?$(c,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):c[t]=n,f=(c,t)=>{for(var n in t||(t={}))z.call(t,n)&&X(c,n,t[n]);if(L)for(var n of L(t))j.call(t,n)&&X(c,n,t[n]);return c},g=(c,t)=>K(c,Y(t));var H=(c,t)=>{var n={};for(var e in c)z.call(c,e)&&t.indexOf(e)<0&&(n[e]=c[e]);if(c!=null&&L)for(var e of L(c))t.indexOf(e)<0&&j.call(c,e)&&(n[e]=c[e]);return n};var E=(c,t,n)=>new Promise((e,r)=>{var o=l=>{try{a(n.next(l))}catch(p){r(p)}},s=l=>{try{a(n.throw(l))}catch(p){r(p)}},a=l=>l.done?e(l.value):Promise.resolve(l.value).then(o,s);a((n=n.apply(c,t)).next())});import{Fragment as D}from"react";import{Text as k,Html as et,Head as nt,Body as ot,Font as rt,Container as T,Link as it,Heading as st,Hr as at,Button as lt,Img as V,Preview as ct,Row as C,Column as w,Section as pt}from"@react-email/components";import{renderAsync as ut}from"@react-email/render";var Q=c=>Object.prototype.toString.call(c);var Z=c=>Q(c)==="[object Object]";function tt(c){return Object.keys(c)}function A(c,...t){if(!t.length)return c;let n=t.shift();return n===void 0?c:(M(c)&&M(n)&&tt(n).forEach(e=>{e==="__proto__"||e==="constructor"||e==="prototype"||(M(n[e])?(c[e]||(c[e]={}),M(c[e])?A(c[e],n[e]):c[e]=n[e]):c[e]=n[e])}),A(c,...t))}function M(c){return Z(c)&&!Array.isArray(c)}var Jt=Symbol("p-void");function R(){return Math.random().toString(36).substr(2,6)}import{Fragment as y,jsx as i,jsxs as O}from"react/jsx-runtime";var ht={sm:"8px",md:"16px",lg:"32px",xl:"64px"},_={WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"};var dt={h1:{fontSize:"36px",lineHeight:"40px",fontWeight:800},h2:{fontSize:"30px",lineHeight:"36px",fontWeight:700},h3:{fontSize:"24px",lineHeight:"38px",fontWeight:600}};var G={sm:"40px",md:"48px",lg:"64px"},mt={pretty:!1,plainText:!1},q={colors:{heading:"#111827",paragraph:"#374151",horizontal:"#EAEAEA",footer:"#64748B",blockquoteBorder:"#D1D5DB",codeBackground:"#EFEFEF",codeText:"#111827",linkCardTitle:"#111827",linkCardDescription:"#6B7280",linkCardBadgeText:"#111827",linkCardBadgeBackground:"#FEF08A",linkCardSubTitle:"#6B7280"},fontSize:{paragraph:"15px",footer:{size:"14px",lineHeight:"24px"}}},ft='SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',gt="#ffffff",xt="left",yt=1,St="#000000",bt=0,wt=0,Ot=0,Ct=0,vt=5,Nt=5,Et=5,Tt=5,zt="100%",_t=8,jt="transparent",Ht=0,Gt=0,qt="transparent",$t=0,Kt=0,Yt=0,Qt=0,J=class{constructor(t={type:"doc",content:[]}){this.config={theme:q};this.variableFormatter=({variable:t,fallback:n})=>n?`{{${t},fallback=${n}}}`:`{{${t}}}`;this.shouldReplaceVariableValues=!1;this.variableValues=new Map;this.linkValues=new Map;this.payloadValues=new Map;this.content=t}setPreviewText(t){this.config.preview=t}setTheme(t){this.config.theme=A(this.config.theme||q,t)}setVariableFormatter(t){this.variableFormatter=t}setVariableValue(t,n){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.variableValues.set(t,n)}setVariableValues(t){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),Object.entries(t).forEach(([n,e])=>{this.setVariableValue(n,e)})}setLinkValue(t,n){this.linkValues.set(t,n)}setLinkValues(t){Object.entries(t).forEach(([n,e])=>{this.setLinkValue(n,e)})}setPayloadValue(t,n){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.payloadValues.set(t,n)}setPayloadValues(t){Object.entries(t).forEach(([n,e])=>{this.setPayloadValue(n,e)})}setOpenTrackingPixel(t){this.openTrackingPixel=t}setShouldReplaceVariableValues(t){this.shouldReplaceVariableValues=t}getAllLinks(){let t=this.content.content||[],n=new Set,e=o=>o&&this.isValidUrl(o)&&!o.startsWith("#")&&!o.startsWith("mailto:")&&!o.startsWith("tel:")&&typeof o=="string",r=o=>{var s;if(o.type==="button"){let a=(s=o.attrs)==null?void 0:s.url;e(a)&&a&&n.add(a)}else o.content&&o.content.forEach(a=>{a.marks&&a.marks.forEach(l=>{var u;let p=(u=l.attrs)==null?void 0:u.href;l.type==="link"&&e(p)&&n.add(p)}),a.content&&r(a)})};return t.forEach(o=>{r(o)}),n}isValidUrl(t){try{let n=new URL(t);return!0}catch(n){return!1}}render(){return E(this,arguments,function*(t=mt){let n=this.markup();return ut(n,t)})}markup(){let t=this.content.content||[],n=t.map((o,s)=>{let a={prev:t[s-1],next:t[s+1],parent:o},l=this.renderNode(o,a);return l?i(D,{children:l},R()):null}),{preview:e}=this.config;return O(et,{children:[O(nt,{children:[i(rt,{fallbackFontFamily:"sans-serif",fontFamily:"Inter",fontStyle:"normal",fontWeight:400,webFont:{url:"https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19",format:"woff2"}}),i("style",{dangerouslySetInnerHTML:{__html:"blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}@media only screen and (max-width:425px){.tab-row-full{width:100%!important}.tab-col-full{display:block!important;width:100%!important}.tab-pad{padding:0!important}}"}}),i("meta",{content:"width=device-width",name:"viewport"}),i("meta",{content:"IE=edge",httpEquiv:"X-UA-Compatible"}),i("meta",{name:"x-apple-disable-message-reformatting"}),i("meta",{content:"telephone=no,address=no,email=no,date=no,url=no",name:"format-detection"}),i("meta",{content:"light",name:"color-scheme"}),i("meta",{content:"light",name:"supported-color-schemes"})]}),O(ot,{style:{margin:0},children:[e?i(ct,{id:"__react-email-preview",children:e}):null,i(T,{style:{maxWidth:"600px",minWidth:"300px",width:"100%",marginLeft:"auto",marginRight:"auto",padding:"0.5rem"},children:n}),this.openTrackingPixel?i(V,{alt:"",src:this.openTrackingPixel,style:{display:"none",width:"1px",height:"1px"}}):null]})]})}getMarginOverrideConditions(t,n){let{parent:e,prev:r,next:o}=n||{},s=(o==null?void 0:o.type)==="spacer",a=(r==null?void 0:r.type)==="spacer",l=(e==null?void 0:e.type)==="listItem",p=(e==null?void 0:e.type)==="section"&&!o,u=(e==null?void 0:e.type)==="section"&&!r,h=(e==null?void 0:e.type)==="column"&&!o,d=(e==null?void 0:e.type)==="column"&&!r,m=(e==null?void 0:e.type)==="for"&&!r,x=(e==null?void 0:e.type)==="for"&&!o,S=(e==null?void 0:e.type)==="show"&&!r,b=(e==null?void 0:e.type)==="show"&&!o;return{isNextSpacer:s,isPrevSpacer:a,isLastSectionElement:p,isFirstSectionElement:u,isParentListItem:l,isLastColumnElement:h,isFirstColumnElement:d,isFirstForElement:m,isLastForElement:x,isFirstShowElement:S,isLastShowElement:b,shouldRemoveTopMargin:a||u||d||m||S,shouldRemoveBottomMargin:s||p||h||x||b}}getMappedContent(t,n){let e=t.content||[];return e.map((r,o)=>{let s=this.renderNode(r,g(f({},n),{next:e[o+1],prev:e[o-1]}));return s?i(D,{children:s},R()):null}).filter(r=>r!==null)}renderNode(t,n={}){var r;let e=t.type||"";if(e in this)return(r=this[e])==null?void 0:r.call(this,t,n);throw new Error(`Node type "${e}" is not supported.`)}renderMark(t){let n=(t==null?void 0:t.text)||i(y,{children:"\xA0"});return((t==null?void 0:t.marks)||[]).reduce((r,o)=>{var a;let s=o.type;if(s in this)return(a=this[s])==null?void 0:a.call(this,o,r);throw new Error(`Mark type "${s}" is not supported.`)},i(y,{children:n}))}paragraph(t,n){var a,l,p,u;let{attrs:e}=t,r=(e==null?void 0:e.textAlign)||"left",{isParentListItem:o,shouldRemoveBottomMargin:s}=this.getMarginOverrideConditions(t,n);return i(k,{style:f({textAlign:r,marginBottom:o||s?"0px":"20px",marginTop:"0px",fontSize:(l=(a=this.config.theme)==null?void 0:a.fontSize)==null?void 0:l.paragraph,color:(u=(p=this.config.theme)==null?void 0:p.colors)==null?void 0:u.paragraph},_),children:t.content?this.getMappedContent(t,g(f({},n),{parent:t})):i(y,{children:"\xA0"})})}text(t,n){let e=t.text||"&nbsp";return t.marks?this.renderMark(t):i(y,{children:e})}bold(t,n){return i("strong",{children:n})}italic(t,n){return i("em",{children:n})}underline(t,n){return i("u",{children:n})}strike(t,n){return i("s",{style:{textDecoration:"line-through"},children:n})}textStyle(t,n){var o,s;let{attrs:e}=t,{color:r=(s=(o=this.config.theme)==null?void 0:o.colors)==null?void 0:s.paragraph}=e||{};return i("span",{style:{color:r},children:n})}link(t,n){var a,l;let{attrs:e}=t,r=(e==null?void 0:e.href)||"#",o=(e==null?void 0:e.target)||"_blank",s=(e==null?void 0:e.rel)||"noopener noreferrer nofollow";return(typeof this.linkValues=="object"||typeof this.variableValues=="object")&&(r=this.linkValues.get(r)||this.variableValues.get(r)||r),i(it,{href:r,rel:s,style:{fontWeight:500,textDecoration:"underline",color:(l=(a=this.config.theme)==null?void 0:a.colors)==null?void 0:l.heading},target:o,children:n})}heading(t,n){var u,h;let{attrs:e}=t,r=`h${Number(e==null?void 0:e.level)||1}`,o=(e==null?void 0:e.textAlign)||"left",{shouldRemoveBottomMargin:s}=this.getMarginOverrideConditions(t,n),{fontSize:a,lineHeight:l,fontWeight:p}=dt[r];return i(st,{as:r,style:{textAlign:o,color:(h=(u=this.config.theme)==null?void 0:u.colors)==null?void 0:h.heading,marginBottom:s?"0":"12px",marginTop:0,fontSize:a,lineHeight:l,fontWeight:p},children:this.getMappedContent(t,g(f({},n),{parent:t}))})}variable(t,n){var l,p,u;let{payloadValue:e}=n||{},{id:r,fallback:o}=t.attrs||{};if(!this.shouldShow(t,n)||!r)return i(y,{});let a=this.variableFormatter({variable:r,fallback:o});return this.shouldReplaceVariableValues&&(a=(u=(p=(l=typeof e=="object"?e[r]:e)!=null?l:this.variableValues.get(r))!=null?p:o)!=null?u:a),t!=null&&t.marks?this.renderMark({text:a,marks:t.marks}):i(y,{children:a})}horizontalRule(t,n){return i(at,{style:{marginTop:"32px",marginBottom:"32px"}})}orderedList(t,n){let{shouldRemoveBottomMargin:e}=this.getMarginOverrideConditions(t,n);return i(T,{children:i("ol",{style:{marginTop:"0px",marginBottom:e?"0":"20px",paddingLeft:"26px",listStyleType:"decimal"},children:this.getMappedContent(t,g(f({},n),{parent:t}))})})}bulletList(t,n){let{parent:e,next:r}=n||{},{shouldRemoveBottomMargin:o}=this.getMarginOverrideConditions(t,{parent:e,next:r});return i(T,{style:{maxWidth:"100%"},children:i("ul",{style:{marginTop:"0px",marginBottom:o?"0":"20px",paddingLeft:"26px",listStyleType:"disc"},children:this.getMappedContent(t,g(f({},n),{parent:t}))})})}listItem(t,n){return i("li",{style:f({marginBottom:"8px",paddingLeft:"6px"},_),children:this.getMappedContent(t,g(f({},n),{parent:t}))})}button(t,n){let{attrs:e}=t,{text:r,url:o,variant:s,buttonColor:a,textColor:l,borderRadius:p,alignment:u="left"}=e||{};if(!this.shouldShow(t,n))return i(y,{});let d="0px";p==="round"?d="9999px":p==="smooth"&&(d="6px");let{shouldRemoveBottomMargin:m}=this.getMarginOverrideConditions(t,n),x=this.linkValues.get(o)||this.variableValues.get(o)||o;return i(T,{style:{textAlign:u,maxWidth:"100%",marginBottom:m?"0px":"20px"},children:i(lt,{href:x,style:{color:String(l),backgroundColor:s==="filled"?String(a):"transparent",borderColor:String(a),padding:s==="filled"?"12px 34px":"10px 34px",borderWidth:"2px",borderStyle:"solid",textDecoration:"none",fontSize:"14px",fontWeight:500,borderRadius:d},children:r})})}spacer(t,n){let{attrs:e}=t,{height:r="auto"}=e||{};return this.shouldShow(t,n)?i(T,{style:{height:ht[r]||r}}):i(y,{})}hardBreak(t,n){return i("br",{})}logo(t,n){let{attrs:e}=t,{src:r,alt:o,title:s,size:a,alignment:l="left"}=e||{};if(!this.shouldShow(t,n))return i(y,{});let{shouldRemoveBottomMargin:u}=this.getMarginOverrideConditions(t,n);return i(C,{style:{marginTop:"0px",marginBottom:u?"0px":"32px"},children:i(w,{align:l,children:i(V,{alt:o||s||"Logo",src:r,style:{width:G[a]||a,height:G[a]||a},title:s||o||"Logo"})})})}image(t,n){let{attrs:e}=t,{src:r,alt:o,title:s,width:a="auto",alignment:l="center",externalLink:p=""}=e||{};if(!this.shouldShow(t,n))return i(y,{});let{shouldRemoveBottomMargin:h}=this.getMarginOverrideConditions(t,n),d=a==="auto"?"auto":Number(a),m=d==="auto"?"auto":`${d}px`,x=i(V,{alt:o||s||"Image",src:r,style:{width:m,maxWidth:"100%",outline:"none",border:"none",textDecoration:"none",display:"block"},title:s||o||"Image"});return i(C,{style:{marginTop:"0px",marginBottom:h?"0px":"32px"},children:i(w,{align:l,children:p?i("a",{href:p,rel:"noopener noreferrer",style:{display:"block",maxWidth:"100%",textDecoration:"none"},target:"_blank",children:x}):x})})}footer(t,n){var s,a,l,p,u,h,d,m;let{attrs:e}=t,{textAlign:r="left"}=e||{},{shouldRemoveBottomMargin:o}=this.getMarginOverrideConditions(t,n);return i(k,{style:f({fontSize:(l=(a=(s=this.config.theme)==null?void 0:s.fontSize)==null?void 0:a.footer)==null?void 0:l.size,lineHeight:(h=(u=(p=this.config.theme)==null?void 0:p.fontSize)==null?void 0:u.footer)==null?void 0:h.lineHeight,color:(m=(d=this.config.theme)==null?void 0:d.colors)==null?void 0:m.footer,marginTop:"0px",marginBottom:o?"0px":"20px",textAlign:r},_),children:this.getMappedContent(t,g(f({},n),{parent:t}))})}blockquote(t,n){var o,s;let{isPrevSpacer:e,shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(t,n);return i("blockquote",{style:{borderLeftWidth:"4px",borderLeftStyle:"solid",borderLeftColor:(s=(o=this.config.theme)==null?void 0:o.colors)==null?void 0:s.blockquoteBorder,paddingLeft:"16px",marginLeft:"0px",marginRight:"0px",marginTop:e?"0px":"20px",marginBottom:r?"0px":"20px"},children:this.getMappedContent(t,g(f({},n),{parent:t}))})}code(t,n){var e,r,o,s;return i("code",{style:{backgroundColor:(r=(e=this.config.theme)==null?void 0:e.colors)==null?void 0:r.codeBackground,color:(s=(o=this.config.theme)==null?void 0:o.colors)==null?void 0:s.codeText,padding:"2px 4px",borderRadius:"6px",fontFamily:ft,fontWeight:400,letterSpacing:0},children:n})}linkCard(t,n){var m,x,S,b,v,N,B,F,P,I,U,W;let{attrs:e}=t,{shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(t,n),{title:o,description:s,link:a,linkTitle:l,image:p,badgeText:u,subTitle:h}=e||{},d=this.linkValues.get(a)||this.variableValues.get(a)||a||"#";return O("a",{href:d,rel:"noopener noreferrer",style:{border:"1px solid #eaeaea",borderRadius:"10px",textDecoration:"none",color:"inherit",display:"block",marginBottom:r?"0px":"20px"},target:"_blank",children:[p?i(C,{style:{marginBottom:"6px"},children:i(w,{style:{width:"100%",height:"100%"},children:i(V,{alt:o||"Link Card",src:p,style:{borderRadius:"10px 10px 0 0",width:"100%",height:"100%",objectFit:"cover"},title:o||"Link Card"})})}):null,i(C,{style:{padding:"15px",marginTop:0,marginBottom:0},children:O(w,{style:{verticalAlign:"top"},children:[O(C,{align:void 0,style:{marginBottom:"8px",marginTop:"0px"},width:"auto",children:[i(w,{children:i(k,{style:f({fontSize:"18px",fontWeight:600,color:(x=(m=this.config.theme)==null?void 0:m.colors)==null?void 0:x.linkCardTitle,margin:"0px"},_),children:o})}),u||h?O(w,{style:{paddingLeft:"6px",verticalAlign:"middle"},children:[u?i("span",{style:{fontWeight:600,color:(b=(S=this.config.theme)==null?void 0:S.colors)==null?void 0:b.linkCardBadgeText,padding:"4px 8px",borderRadius:"8px",backgroundColor:(N=(v=this.config.theme)==null?void 0:v.colors)==null?void 0:N.linkCardBadgeBackground,fontSize:"12px",lineHeight:"12px"},children:u}):null," ",h&&!u?i("span",{style:{fontWeight:"normal",color:(F=(B=this.config.theme)==null?void 0:B.colors)==null?void 0:F.linkCardSubTitle,fontSize:"12px",lineHeight:"12px"},children:h}):null]}):null]}),O(k,{style:f({fontSize:"16px",color:(I=(P=this.config.theme)==null?void 0:P.colors)==null?void 0:I.linkCardDescription,marginTop:"0px",marginBottom:"0px"},_),children:[s," ",l?i("a",{href:d,rel:"noopener noreferrer",style:{color:(W=(U=this.config.theme)==null?void 0:U.colors)==null?void 0:W.linkCardTitle,fontSize:"14px",fontWeight:600,textDecoration:"underline"},children:l}):null]})]})})]})}section(t,n){let{attrs:e}=t,{borderRadius:r=0,backgroundColor:o=gt,align:s=xt,borderWidth:a=yt,borderColor:l=St,marginTop:p=bt,marginRight:u=wt,marginBottom:h=Ot,marginLeft:d=Ct,paddingTop:m=vt,paddingRight:x=Nt,paddingBottom:S=Et,paddingLeft:b=Tt}=e||{};return this.shouldShow(t,n)?i(C,{style:{marginTop:p,marginRight:u,marginBottom:h,marginLeft:d},children:i(w,{align:s,style:{borderColor:l,borderWidth:a,borderStyle:"solid",backgroundColor:o,borderRadius:r,paddingTop:m,paddingRight:x,paddingBottom:S,paddingLeft:b},children:this.getMappedContent(t,g(f({},n),{parent:t}))})}):i(y,{})}columns(t,n){let{attrs:e}=t;if(!this.shouldShow(t,n))return i(y,{});let[o,s]=this.adjustColumnsContent(t);return i(C,{width:`${s}%`,style:{margin:0,padding:0,width:`${s}%`},className:"tab-row-full",children:this.getMappedContent(o,g(f({},n),{parent:o}))})}adjustColumnsContent(t){var u;let{content:n=[]}=t,e=100,r=n.filter(h=>{var d;return h.type==="column"&&!!Number(((d=h.attrs)==null?void 0:d.width)||0)}),o=n.filter(h=>{var d,m;return h.type==="column"&&(((d=h.attrs)==null?void 0:d.width)==="auto"||!((m=h.attrs)!=null&&m.width))}),s=r.reduce((h,d)=>{var m;return h+Number((m=d.attrs)==null?void 0:m.width)},0),l=(e-s)/o.length,p=((u=t.attrs)==null?void 0:u.gap)||_t;return[g(f({},t),{content:n.map((h,d)=>{var b,v,N;let m=h.type==="column"&&(((b=h.attrs)==null?void 0:b.width)==="auto"||!((v=h.attrs)!=null&&v.width)),x=d===0,S=d===n.length-1;return g(f({},h),{attrs:g(f({},h.attrs),{width:m?l:(N=h.attrs)==null?void 0:N.width,isFirstColumn:x,isLastColumn:S,index:d,paddingLeft:x?0:p/2,paddingRight:S?0:p/2})})})}),o.length===0?Math.min(e,s):e]}column(t,n){let{attrs:e}=t,{width:r,verticalAlign:o="top",paddingLeft:s=0,paddingRight:a=0}=e||{};return i(w,{width:`${Number(r)}%`,style:{width:`${Number(r)}%`,margin:0,verticalAlign:o},className:"tab-col-full",children:i(pt,{style:{margin:0,paddingLeft:s,paddingRight:a},className:"tab-pad",children:this.getMappedContent(t,g(f({},n),{parent:t}))})})}for(t,n){var l,p;let{attrs:e}=t,{each:r=""}=e||{};if(!this.shouldShow(t,n))return i(y,{});let{payloadValue:s}=n||{};s=typeof s=="object"?s:{};let a=(p=(l=this.payloadValues.get(r))!=null?l:s[r])!=null?p:[];if(!Array.isArray(a))throw new Error(`Payload value for each "${r}" is not an array`);return i(y,{children:a.map(u=>i(D,{children:this.getMappedContent(t,g(f({},n),{parent:t,payloadValue:u}))},R()))})}shouldShow(t,n){var o,s,a;let e=(s=(o=t==null?void 0:t.attrs)==null?void 0:o.showIfKey)!=null?s:"";if(!e)return!0;let{payloadValue:r}=n||{};return r=typeof r=="object"?r:{},!!((a=this.payloadValues.get(e))!=null?a:r[e])}};function oe(c,t){return E(this,null,function*(){let s=t||{},{theme:n,preview:e}=s,r=H(s,["theme","preview"]),o=new J(c);return o.setPreviewText(e),o.setTheme(n||{}),o.setPayloadValue("items",[{name:"John Doe"},{name:"Novu"}]),o.setPayloadValue("shouldShow",!0),o.render(r)})}export{_t as DEFAULT_COLUMNS_GAP,zt as DEFAULT_COLUMNS_WIDTH,jt as DEFAULT_COLUMN_BACKGROUND_COLOR,qt as DEFAULT_COLUMN_BORDER_COLOR,Ht as DEFAULT_COLUMN_BORDER_RADIUS,Gt as DEFAULT_COLUMN_BORDER_WIDTH,Yt as DEFAULT_COLUMN_PADDING_BOTTOM,Qt as DEFAULT_COLUMN_PADDING_LEFT,Kt as DEFAULT_COLUMN_PADDING_RIGHT,$t as DEFAULT_COLUMN_PADDING_TOP,xt as DEFAULT_SECTION_ALIGN,gt as DEFAULT_SECTION_BACKGROUND_COLOR,St as DEFAULT_SECTION_BORDER_COLOR,yt as DEFAULT_SECTION_BORDER_WIDTH,Ot as DEFAULT_SECTION_MARGIN_BOTTOM,Ct as DEFAULT_SECTION_MARGIN_LEFT,wt as DEFAULT_SECTION_MARGIN_RIGHT,bt as DEFAULT_SECTION_MARGIN_TOP,Et as DEFAULT_SECTION_PADDING_BOTTOM,Tt as DEFAULT_SECTION_PADDING_LEFT,Nt as DEFAULT_SECTION_PADDING_RIGHT,vt as DEFAULT_SECTION_PADDING_TOP,J as Maily,oe as render};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/maily.tsx","../../../node_modules/.pnpm/@antfu+utils@0.7.10/node_modules/@antfu/utils/dist/index.mjs","../src/utils.ts","../src/render.ts"],"sourcesContent":["import { Fragment, type CSSProperties } from 'react';\nimport {\n Text,\n Html,\n Head,\n Body,\n Font,\n Container,\n Link,\n Heading,\n Hr,\n Button,\n Img,\n Preview,\n Row,\n Column,\n Section,\n} from '@react-email/components';\nimport { renderAsync as reactEmailRenderAsync } from '@react-email/render';\nimport type { JSONContent } from '@tiptap/core';\nimport { deepMerge } from '@antfu/utils';\nimport { generateKey } from './utils';\n\ninterface NodeOptions {\n parent?: JSONContent;\n prev?: JSONContent;\n next?: JSONContent;\n\n payloadValue?: PayloadValue;\n}\n\nexport interface MarkType {\n [key: string]: any;\n type: string;\n attrs?: Record<string, any> | undefined;\n}\n\nconst allowedSpacers = ['sm', 'md', 'lg', 'xl'] as const;\nexport type AllowedSpacers = (typeof allowedSpacers)[number];\n\nconst spacers: Record<AllowedSpacers, string> = {\n sm: '8px',\n md: '16px',\n lg: '32px',\n xl: '64px',\n};\n\nconst antialiased: CSSProperties = {\n WebkitFontSmoothing: 'antialiased',\n MozOsxFontSmoothing: 'grayscale',\n};\n\nconst allowedHeadings = ['h1', 'h2', 'h3'] as const;\ntype AllowedHeadings = (typeof allowedHeadings)[number];\n\nconst headings: Record<AllowedHeadings, CSSProperties> = {\n h1: {\n fontSize: '36px',\n lineHeight: '40px',\n fontWeight: 800,\n },\n h2: {\n fontSize: '30px',\n lineHeight: '36px',\n fontWeight: 700,\n },\n h3: {\n fontSize: '24px',\n lineHeight: '38px',\n fontWeight: 600,\n },\n};\n\nconst allowedLogoSizes = ['sm', 'md', 'lg'] as const;\ntype AllowedLogoSizes = (typeof allowedLogoSizes)[number];\n\nconst logoSizes: Record<AllowedLogoSizes, string> = {\n sm: '40px',\n md: '48px',\n lg: '64px',\n};\n\nexport interface ThemeOptions {\n colors?: Partial<{\n heading: string;\n paragraph: string;\n horizontal: string;\n footer: string;\n blockquoteBorder: string;\n codeBackground: string;\n codeText: string;\n linkCardTitle: string;\n linkCardDescription: string;\n linkCardBadgeText: string;\n linkCardBadgeBackground: string;\n linkCardSubTitle: string;\n }>;\n fontSize?: Partial<{\n paragraph: string;\n footer: {\n size: string;\n lineHeight: string;\n };\n }>;\n}\n\nexport interface MailyConfig {\n /**\n * The preview text is the snippet of text that is pulled into the inbox\n * preview of an email client, usually right after the subject line.\n *\n * Default: `undefined`\n */\n preview?: string;\n /**\n * The theme object allows you to customize the colors and font sizes of the\n * rendered email.\n *\n * Default:\n * ```js\n * {\n * colors: {\n * heading: '#111827',\n * paragraph: '#374151',\n * horizontal: '#EAEAEA',\n * footer: '#64748B',\n * },\n * fontSize: {\n * paragraph: '15px',\n * footer: {\n * size: '14px',\n * lineHeight: '24px',\n * },\n * },\n * }\n * ```\n *\n * @example\n * ```js\n * const maily = new Maily(content, {\n * theme: {\n * colors: {\n * heading: '#111827',\n * },\n * fontSize: {\n * footer: {\n * size: '14px',\n * lineHeight: '24px',\n * },\n * },\n * },\n * });\n * ```\n */\n theme?: Partial<ThemeOptions>;\n}\n\nconst DEFAULT_RENDER_OPTIONS: RenderOptions = {\n pretty: false,\n plainText: false,\n};\n\nconst DEFAULT_THEME: ThemeOptions = {\n colors: {\n heading: '#111827',\n paragraph: '#374151',\n horizontal: '#EAEAEA',\n footer: '#64748B',\n blockquoteBorder: '#D1D5DB',\n codeBackground: '#EFEFEF',\n codeText: '#111827',\n linkCardTitle: '#111827',\n linkCardDescription: '#6B7280',\n linkCardBadgeText: '#111827',\n linkCardBadgeBackground: '#FEF08A',\n linkCardSubTitle: '#6B7280',\n },\n fontSize: {\n paragraph: '15px',\n footer: {\n size: '14px',\n lineHeight: '24px',\n },\n },\n};\n\nconst CODE_FONT_FAMILY =\n 'SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace';\nexport const DEFAULT_SECTION_BACKGROUND_COLOR = '#ffffff';\nexport const DEFAULT_SECTION_ALIGN = 'left';\nexport const DEFAULT_SECTION_BORDER_WIDTH = 1;\nexport const DEFAULT_SECTION_BORDER_COLOR = '#000000';\n\nexport const DEFAULT_SECTION_MARGIN_TOP = 0;\nexport const DEFAULT_SECTION_MARGIN_RIGHT = 0;\nexport const DEFAULT_SECTION_MARGIN_BOTTOM = 0;\nexport const DEFAULT_SECTION_MARGIN_LEFT = 0;\n\nexport const DEFAULT_SECTION_PADDING_TOP = 5;\nexport const DEFAULT_SECTION_PADDING_RIGHT = 5;\nexport const DEFAULT_SECTION_PADDING_BOTTOM = 5;\nexport const DEFAULT_SECTION_PADDING_LEFT = 5;\n\nexport const DEFAULT_COLUMNS_WIDTH = '100%';\nexport const DEFAULT_COLUMNS_GAP = 8;\n\nexport const DEFAULT_COLUMN_BACKGROUND_COLOR = 'transparent';\nexport const DEFAULT_COLUMN_BORDER_RADIUS = 0;\nexport const DEFAULT_COLUMN_BORDER_WIDTH = 0;\nexport const DEFAULT_COLUMN_BORDER_COLOR = 'transparent';\n\nexport const DEFAULT_COLUMN_PADDING_TOP = 0;\nexport const DEFAULT_COLUMN_PADDING_RIGHT = 0;\nexport const DEFAULT_COLUMN_PADDING_BOTTOM = 0;\nexport const DEFAULT_COLUMN_PADDING_LEFT = 0;\n\nexport interface RenderOptions {\n /**\n * The options object allows you to customize the output of the rendered\n * email.\n * - `pretty` - If `true`, the output will be formatted with indentation and\n * line breaks.\n * - `plainText` - If `true`, the output will be plain text instead of HTML.\n * This is useful for testing purposes.\n *\n * Default: `pretty` - `false`, `plainText` - `false`\n */\n pretty?: boolean;\n plainText?: boolean;\n}\n\nexport type VariableFormatter = (options: {\n variable: string;\n fallback?: string;\n}) => string;\nexport type VariableValues = Map<string, string>;\nexport type LinkValues = Map<string, string>;\n\nexport type PayloadValue = Record<string, any> | boolean;\nexport type PayloadValues = Map<string, PayloadValue>;\n\nexport class Maily {\n private readonly content: JSONContent;\n private config: MailyConfig = {\n theme: DEFAULT_THEME,\n };\n\n private variableFormatter: VariableFormatter = ({ variable, fallback }) => {\n return fallback\n ? `{{${variable},fallback=${fallback}}}`\n : `{{${variable}}}`;\n };\n\n private shouldReplaceVariableValues = false;\n private variableValues: VariableValues = new Map();\n private linkValues: LinkValues = new Map();\n private openTrackingPixel: string | undefined;\n private payloadValues: PayloadValues = new Map();\n\n constructor(content: JSONContent = { type: 'doc', content: [] }) {\n this.content = content;\n }\n\n setPreviewText(preview?: string) {\n this.config.preview = preview;\n }\n\n setTheme(theme: Partial<ThemeOptions>) {\n this.config.theme = deepMerge(this.config.theme || DEFAULT_THEME, theme);\n }\n\n setVariableFormatter(formatter: VariableFormatter) {\n this.variableFormatter = formatter;\n }\n\n /**\n * `setVariableValue` will set the variable value.\n * It will also set `shouldReplaceVariableValues` to `true`.\n *\n * @param variable - The variable name\n * @param value - The variable value\n */\n setVariableValue(variable: string, value: string) {\n if (!this.shouldReplaceVariableValues) {\n this.shouldReplaceVariableValues = true;\n }\n\n this.variableValues.set(variable, value);\n }\n\n /**\n * `setVariableValues` will set the variable values.\n * It will also set `shouldReplaceVariableValues` to `true`.\n *\n * @param values - The variable values\n *\n * @example\n * ```js\n * const maily = new Maily(content);\n * maily.setVariableValues({\n * name: 'John Doe',\n * email: 'john@doe.com',\n * });\n * ```\n */\n setVariableValues(values: Record<string, string>) {\n if (!this.shouldReplaceVariableValues) {\n this.shouldReplaceVariableValues = true;\n }\n\n Object.entries(values).forEach(([variable, value]) => {\n this.setVariableValue(variable, value);\n });\n }\n\n setLinkValue(link: string, value: string) {\n this.linkValues.set(link, value);\n }\n\n setLinkValues(values: Record<string, string>) {\n Object.entries(values).forEach(([link, value]) => {\n this.setLinkValue(link, value);\n });\n }\n\n setPayloadValue(key: string, value: PayloadValue) {\n if (!this.shouldReplaceVariableValues) {\n this.shouldReplaceVariableValues = true;\n }\n\n this.payloadValues.set(key, value);\n }\n\n setPayloadValues(values: Record<string, PayloadValue>) {\n Object.entries(values).forEach(([key, value]) => {\n this.setPayloadValue(key, value);\n });\n }\n\n /**\n * `setOpenTrackingPixel` will set the open tracking pixel.\n *\n * @param pixel - The open tracking pixel\n */\n setOpenTrackingPixel(pixel?: string) {\n this.openTrackingPixel = pixel;\n }\n\n /**\n * `setShouldReplaceVariableValues` will determine whether to replace the\n * variable values or not. Otherwise, it will just return the formatted variable.\n *\n * Default: `false`\n */\n setShouldReplaceVariableValues(shouldReplace: boolean) {\n this.shouldReplaceVariableValues = shouldReplace;\n }\n\n getAllLinks() {\n const nodes = this.content.content || [];\n const links = new Set<string>();\n\n const isValidLink = (href: string) => {\n return (\n href &&\n this.isValidUrl(href) &&\n !href.startsWith('#') &&\n !href.startsWith('mailto:') &&\n !href.startsWith('tel:') &&\n typeof href === 'string'\n );\n };\n\n const extractLinksFromNode = (node: JSONContent) => {\n if (node.type === 'button') {\n const originalLink = node.attrs?.url;\n if (isValidLink(originalLink) && originalLink) {\n links.add(originalLink);\n }\n } else if (node.content) {\n node.content.forEach((childNode) => {\n if (childNode.marks) {\n childNode.marks.forEach((mark) => {\n const originalLink = mark.attrs?.href;\n if (mark.type === 'link' && isValidLink(originalLink)) {\n links.add(originalLink);\n }\n });\n }\n if (childNode.content) {\n extractLinksFromNode(childNode);\n }\n });\n }\n };\n\n nodes.forEach((childNode) => {\n extractLinksFromNode(childNode);\n });\n\n return links;\n }\n\n private isValidUrl(href: string) {\n try {\n const _ = new URL(href);\n return true;\n } catch (err) {\n return false;\n }\n }\n\n async render(\n options: RenderOptions = DEFAULT_RENDER_OPTIONS\n ): Promise<string> {\n const markup = this.markup();\n return reactEmailRenderAsync(markup, options);\n }\n\n /**\n * `markup` will render the JSON content into React Email markup.\n * and return the raw React Tree.\n */\n markup() {\n const nodes = this.content.content || [];\n const jsxNodes = nodes.map((node, index) => {\n const nodeOptions: NodeOptions = {\n prev: nodes[index - 1],\n next: nodes[index + 1],\n parent: node,\n };\n\n const component = this.renderNode(node, nodeOptions);\n if (!component) {\n return null;\n }\n\n return <Fragment key={generateKey()}>{component}</Fragment>;\n });\n\n const { preview } = this.config;\n\n const markup = (\n <Html>\n <Head>\n <Font\n fallbackFontFamily=\"sans-serif\"\n fontFamily=\"Inter\"\n fontStyle=\"normal\"\n fontWeight={400}\n webFont={{\n url: 'https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19',\n format: 'woff2',\n }}\n />\n <style\n dangerouslySetInnerHTML={{\n __html: `blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}@media only screen and (max-width:425px){.tab-row-full{width:100%!important}.tab-col-full{display:block!important;width:100%!important}.tab-pad{padding:0!important}}`,\n }}\n />\n\n <meta content=\"width=device-width\" name=\"viewport\" />\n <meta content=\"IE=edge\" httpEquiv=\"X-UA-Compatible\" />\n <meta name=\"x-apple-disable-message-reformatting\" />\n <meta\n // http://www.html-5.com/metatags/format-detection-meta-tag.html\n // It will prevent iOS from automatically detecting possible phone numbers in a block of text\n content=\"telephone=no,address=no,email=no,date=no,url=no\"\n name=\"format-detection\"\n />\n <meta content=\"light\" name=\"color-scheme\" />\n <meta content=\"light\" name=\"supported-color-schemes\" />\n </Head>\n <Body\n style={{\n margin: 0,\n }}\n >\n {preview ? (\n <Preview id=\"__react-email-preview\">{preview}</Preview>\n ) : null}\n <Container\n style={{\n maxWidth: '600px',\n minWidth: '300px',\n width: '100%',\n marginLeft: 'auto',\n marginRight: 'auto',\n padding: '0.5rem',\n }}\n >\n {jsxNodes}\n </Container>\n {this.openTrackingPixel ? (\n <Img\n alt=\"\"\n src={this.openTrackingPixel}\n style={{\n display: 'none',\n width: '1px',\n height: '1px',\n }}\n />\n ) : null}\n </Body>\n </Html>\n );\n\n return markup;\n }\n\n private getMarginOverrideConditions(\n node: JSONContent,\n options?: NodeOptions\n ) {\n const { parent, prev, next } = options || {};\n\n const isNextSpacer = next?.type === 'spacer';\n const isPrevSpacer = prev?.type === 'spacer';\n\n const isParentListItem = parent?.type === 'listItem';\n\n const isLastSectionElement = parent?.type === 'section' && !next;\n const isFirstSectionElement = parent?.type === 'section' && !prev;\n\n const isLastColumnElement = parent?.type === 'column' && !next;\n const isFirstColumnElement = parent?.type === 'column' && !prev;\n\n const isFirstForElement = parent?.type === 'for' && !prev;\n const isLastForElement = parent?.type === 'for' && !next;\n\n const isFirstShowElement = parent?.type === 'show' && !prev;\n const isLastShowElement = parent?.type === 'show' && !next;\n\n return {\n isNextSpacer,\n isPrevSpacer,\n isLastSectionElement,\n isFirstSectionElement,\n isParentListItem,\n isLastColumnElement,\n isFirstColumnElement,\n isFirstForElement,\n isLastForElement,\n isFirstShowElement,\n isLastShowElement,\n\n shouldRemoveTopMargin:\n isPrevSpacer ||\n isFirstSectionElement ||\n isFirstColumnElement ||\n isFirstForElement ||\n isFirstShowElement,\n shouldRemoveBottomMargin:\n isNextSpacer ||\n isLastSectionElement ||\n isLastColumnElement ||\n isLastForElement ||\n isLastShowElement,\n };\n }\n\n // `getMappedContent` will call corresponding node type\n // and return text content\n private getMappedContent(\n node: JSONContent,\n options?: NodeOptions\n ): JSX.Element[] {\n const allNodes = node.content || [];\n return allNodes\n .map((childNode, index) => {\n const component = this.renderNode(childNode, {\n ...options,\n next: allNodes[index + 1],\n prev: allNodes[index - 1],\n });\n if (!component) {\n return null;\n }\n\n return <Fragment key={generateKey()}>{component}</Fragment>;\n })\n .filter((n) => n !== null) as JSX.Element[];\n }\n\n // `renderNode` will call the method of the corresponding node type\n private renderNode(\n node: JSONContent,\n options: NodeOptions = {}\n ): JSX.Element | null {\n const type = node.type || '';\n\n if (type in this) {\n // @ts-expect-error - `this` is not assignable to type 'never'\n return this[type]?.(node, options) as JSX.Element;\n }\n\n throw new Error(`Node type \"${type}\" is not supported.`);\n }\n\n // `renderMark` will call the method of the corresponding mark type\n private renderMark(node: JSONContent): JSX.Element {\n // It will wrap the text with the corresponding mark type\n const text = node?.text || <>&nbsp;</>;\n const marks = node?.marks || [];\n\n return marks.reduce(\n (acc, mark) => {\n const type = mark.type;\n if (type in this) {\n // @ts-expect-error - `this` is not assignable to type 'never'\n return this[type]?.(mark, acc) as JSX.Element;\n }\n\n throw new Error(`Mark type \"${type}\" is not supported.`);\n },\n <>{text}</>\n );\n }\n\n private paragraph(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const alignment = attrs?.textAlign || 'left';\n const { isParentListItem, shouldRemoveBottomMargin } =\n this.getMarginOverrideConditions(node, options);\n\n return (\n <Text\n style={{\n textAlign: alignment,\n marginBottom:\n isParentListItem || shouldRemoveBottomMargin ? '0px' : '20px',\n marginTop: '0px',\n fontSize: this.config.theme?.fontSize?.paragraph,\n color: this.config.theme?.colors?.paragraph,\n ...antialiased,\n }}\n >\n {node.content ? (\n this.getMappedContent(node, {\n ...options,\n parent: node,\n })\n ) : (\n <>&nbsp;</>\n )}\n </Text>\n );\n }\n\n private text(node: JSONContent, _?: NodeOptions): JSX.Element {\n const text = node.text || '&nbsp';\n if (node.marks) {\n return this.renderMark(node);\n }\n\n return <>{text}</>;\n }\n\n private bold(_: MarkType, text: JSX.Element): JSX.Element {\n return <strong>{text}</strong>;\n }\n\n private italic(_: MarkType, text: JSX.Element): JSX.Element {\n return <em>{text}</em>;\n }\n\n private underline(_: MarkType, text: JSX.Element): JSX.Element {\n return <u>{text}</u>;\n }\n\n private strike(_: MarkType, text: JSX.Element): JSX.Element {\n return <s style={{ textDecoration: 'line-through' }}>{text}</s>;\n }\n\n private textStyle(mark: MarkType, text: JSX.Element): JSX.Element {\n const { attrs } = mark;\n const { color = this.config.theme?.colors?.paragraph } = attrs || {};\n\n return (\n <span\n style={{\n color,\n }}\n >\n {text}\n </span>\n );\n }\n\n private link(mark: MarkType, text: JSX.Element): JSX.Element {\n const { attrs } = mark;\n let href = attrs?.href || '#';\n const target = attrs?.target || '_blank';\n const rel = attrs?.rel || 'noopener noreferrer nofollow';\n\n // If the href value is provided, use it to replace the link\n // Otherwise, use the original link\n if (\n typeof this.linkValues === 'object' ||\n typeof this.variableValues === 'object'\n ) {\n href = this.linkValues.get(href) || this.variableValues.get(href) || href;\n }\n\n return (\n <Link\n href={href}\n rel={rel}\n style={{\n fontWeight: 500,\n textDecoration: 'underline',\n color: this.config.theme?.colors?.heading,\n }}\n target={target}\n >\n {text}\n </Link>\n );\n }\n\n private heading(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n\n const level = `h${Number(attrs?.level) || 1}`;\n const alignment = attrs?.textAlign || 'left';\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n const { fontSize, lineHeight, fontWeight } =\n headings[level as AllowedHeadings];\n\n return (\n <Heading\n // @ts-expect-error - `this` is not assignable to type 'never'\n as={level}\n style={{\n textAlign: alignment,\n color: this.config.theme?.colors?.heading,\n marginBottom: shouldRemoveBottomMargin ? '0' : '12px',\n marginTop: 0,\n fontSize,\n lineHeight,\n fontWeight,\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Heading>\n );\n }\n\n private variable(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { payloadValue } = options || {};\n const { id: variable, fallback } = node.attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow || !variable) {\n return <></>;\n }\n\n let formattedVariable = this.variableFormatter({\n variable,\n fallback,\n });\n\n // If `shouldReplaceVariableValues` is true, replace the variable values\n // Otherwise, just return the formatted variable\n if (this.shouldReplaceVariableValues) {\n formattedVariable =\n (typeof payloadValue === 'object'\n ? payloadValue[variable]\n : payloadValue) ??\n this.variableValues.get(variable) ??\n fallback ??\n formattedVariable;\n }\n\n if (node?.marks) {\n return this.renderMark({\n text: formattedVariable,\n marks: node.marks,\n });\n }\n\n return <>{formattedVariable}</>;\n }\n\n private horizontalRule(_: JSONContent, __?: NodeOptions): JSX.Element {\n return (\n <Hr\n style={{\n marginTop: '32px',\n marginBottom: '32px',\n }}\n />\n );\n }\n\n private orderedList(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n return (\n <Container>\n <ol\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0' : '20px',\n paddingLeft: '26px',\n listStyleType: 'decimal',\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </ol>\n </Container>\n );\n }\n\n private bulletList(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { parent, next } = options || {};\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n {\n parent,\n next,\n }\n );\n\n return (\n <Container\n style={{\n maxWidth: '100%',\n }}\n >\n <ul\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0' : '20px',\n paddingLeft: '26px',\n listStyleType: 'disc',\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </ul>\n </Container>\n );\n }\n\n private listItem(node: JSONContent, options?: NodeOptions): JSX.Element {\n return (\n <li\n style={{\n marginBottom: '8px',\n paddingLeft: '6px',\n ...antialiased,\n }}\n >\n {this.getMappedContent(node, { ...options, parent: node })}\n </li>\n );\n }\n\n private button(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n text,\n url,\n variant,\n buttonColor,\n textColor,\n borderRadius,\n // @TODO: Update the attribute to `textAlign`\n alignment = 'left',\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n let radius: string | undefined = '0px';\n if (borderRadius === 'round') {\n radius = '9999px';\n } else if (borderRadius === 'smooth') {\n radius = '6px';\n }\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n const href =\n this.linkValues.get(url) || this.variableValues.get(url) || url;\n\n return (\n <Container\n style={{\n textAlign: alignment,\n maxWidth: '100%',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n }}\n >\n <Button\n href={href}\n style={{\n color: String(textColor),\n backgroundColor:\n variant === 'filled' ? String(buttonColor) : 'transparent',\n borderColor: String(buttonColor),\n padding: variant === 'filled' ? '12px 34px' : '10px 34px',\n borderWidth: '2px',\n borderStyle: 'solid',\n textDecoration: 'none',\n fontSize: '14px',\n fontWeight: 500,\n borderRadius: radius,\n }}\n >\n {text}\n </Button>\n </Container>\n );\n }\n\n private spacer(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { height = 'auto' } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n return (\n <Container\n style={{\n height: spacers[height as AllowedSpacers] || height,\n }}\n />\n );\n }\n\n private hardBreak(_: JSONContent, __?: NodeOptions): JSX.Element {\n return <br />;\n }\n\n private logo(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n src,\n alt,\n title,\n size,\n // @TODO: Update the attribute to `textAlign`\n alignment = 'left',\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n return (\n <Row\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '32px',\n }}\n >\n <Column align={alignment}>\n <Img\n alt={alt || title || 'Logo'}\n src={src}\n style={{\n width: logoSizes[size as AllowedLogoSizes] || size,\n height: logoSizes[size as AllowedLogoSizes] || size,\n }}\n title={title || alt || 'Logo'}\n />\n </Column>\n </Row>\n );\n }\n\n private image(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n src,\n alt,\n title,\n width = 'auto',\n alignment = 'center',\n externalLink = '',\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n const wi = width === 'auto' ? 'auto' : Number(width);\n\n const mainImage = (\n <Img\n alt={alt || title || 'Image'}\n src={src}\n style={{\n height: 'auto',\n width: '100%',\n outline: 'none',\n border: 'none',\n textDecoration: 'none',\n }}\n height=\"auto\"\n width={wi}\n title={title || alt || 'Image'}\n />\n );\n\n return (\n <Row\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '32px',\n }}\n >\n <Column align={alignment}>\n {externalLink ? (\n <a\n href={externalLink}\n rel=\"noopener noreferrer\"\n style={{\n display: 'block',\n maxWidth: '100%',\n textDecoration: 'none',\n }}\n target=\"_blank\"\n >\n {mainImage}\n </a>\n ) : (\n mainImage\n )}\n </Column>\n </Row>\n );\n }\n\n private footer(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { textAlign = 'left' } = attrs || {};\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n return (\n <Text\n style={{\n fontSize: this.config.theme?.fontSize?.footer?.size,\n lineHeight: this.config.theme?.fontSize?.footer?.lineHeight,\n color: this.config.theme?.colors?.footer,\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n textAlign,\n ...antialiased,\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Text>\n );\n }\n\n private blockquote(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { isPrevSpacer, shouldRemoveBottomMargin } =\n this.getMarginOverrideConditions(node, options);\n\n return (\n <blockquote\n style={{\n borderLeftWidth: '4px',\n borderLeftStyle: 'solid',\n borderLeftColor: this.config.theme?.colors?.blockquoteBorder,\n paddingLeft: '16px',\n marginLeft: '0px',\n marginRight: '0px',\n marginTop: isPrevSpacer ? '0px' : '20px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </blockquote>\n );\n }\n private code(_: MarkType, text: JSX.Element): JSX.Element {\n return (\n <code\n style={{\n backgroundColor: this.config.theme?.colors?.codeBackground,\n color: this.config.theme?.colors?.codeText,\n padding: '2px 4px',\n borderRadius: '6px',\n fontFamily: CODE_FONT_FAMILY,\n fontWeight: 400,\n letterSpacing: 0,\n }}\n >\n {text}\n </code>\n );\n }\n private linkCard(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n const { title, description, link, linkTitle, image, badgeText, subTitle } =\n attrs || {};\n const href =\n this.linkValues.get(link) || this.variableValues.get(link) || link || '#';\n\n return (\n <a\n href={href}\n rel=\"noopener noreferrer\"\n style={{\n border: '1px solid #eaeaea',\n borderRadius: '10px',\n textDecoration: 'none',\n color: 'inherit',\n display: 'block',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n }}\n target=\"_blank\"\n >\n {image ? (\n <Row\n style={{\n marginBottom: '6px',\n }}\n >\n <Column\n style={{\n width: '100%',\n height: '100%',\n }}\n >\n <Img\n alt={title || 'Link Card'}\n src={image}\n style={{\n borderRadius: '10px 10px 0 0',\n width: '100%',\n height: '100%',\n objectFit: 'cover',\n }}\n title={title || 'Link Card'}\n />\n </Column>\n </Row>\n ) : null}\n\n <Row\n style={{\n padding: '15px',\n marginTop: 0,\n marginBottom: 0,\n }}\n >\n <Column\n style={{\n verticalAlign: 'top',\n }}\n >\n <Row\n align={undefined}\n style={{\n marginBottom: '8px',\n marginTop: '0px',\n }}\n width=\"auto\"\n >\n <Column>\n <Text\n style={{\n fontSize: '18px',\n fontWeight: 600,\n color: this.config.theme?.colors?.linkCardTitle,\n margin: '0px',\n ...antialiased,\n }}\n >\n {title}\n </Text>\n </Column>\n {badgeText || subTitle ? (\n <Column\n style={{\n paddingLeft: '6px',\n verticalAlign: 'middle',\n }}\n >\n {badgeText ? (\n <span\n style={{\n fontWeight: 600,\n color: this.config.theme?.colors?.linkCardBadgeText,\n padding: '4px 8px',\n borderRadius: '8px',\n backgroundColor:\n this.config.theme?.colors?.linkCardBadgeBackground,\n fontSize: '12px',\n lineHeight: '12px',\n }}\n >\n {badgeText}\n </span>\n ) : null}{' '}\n {subTitle && !badgeText ? (\n <span\n style={{\n fontWeight: 'normal',\n color: this.config.theme?.colors?.linkCardSubTitle,\n fontSize: '12px',\n lineHeight: '12px',\n }}\n >\n {subTitle}\n </span>\n ) : null}\n </Column>\n ) : null}\n </Row>\n <Text\n style={{\n fontSize: '16px',\n color: this.config.theme?.colors?.linkCardDescription,\n marginTop: '0px',\n marginBottom: '0px',\n ...antialiased,\n }}\n >\n {description}{' '}\n {linkTitle ? (\n <a\n href={href}\n rel=\"noopener noreferrer\"\n style={{\n color: this.config.theme?.colors?.linkCardTitle,\n fontSize: '14px',\n fontWeight: 600,\n textDecoration: 'underline',\n }}\n >\n {linkTitle}\n </a>\n ) : null}\n </Text>\n </Column>\n </Row>\n </a>\n );\n }\n\n private section(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n borderRadius = 0,\n backgroundColor = DEFAULT_SECTION_BACKGROUND_COLOR,\n align = DEFAULT_SECTION_ALIGN,\n borderWidth = DEFAULT_SECTION_BORDER_WIDTH,\n borderColor = DEFAULT_SECTION_BORDER_COLOR,\n\n marginTop = DEFAULT_SECTION_MARGIN_TOP,\n marginRight = DEFAULT_SECTION_MARGIN_RIGHT,\n marginBottom = DEFAULT_SECTION_MARGIN_BOTTOM,\n marginLeft = DEFAULT_SECTION_MARGIN_LEFT,\n\n paddingTop = DEFAULT_SECTION_PADDING_TOP,\n paddingRight = DEFAULT_SECTION_PADDING_RIGHT,\n paddingBottom = DEFAULT_SECTION_PADDING_BOTTOM,\n paddingLeft = DEFAULT_SECTION_PADDING_LEFT,\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n return (\n <Row\n style={{\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n }}\n >\n <Column\n align={align}\n style={{\n borderColor,\n borderWidth,\n borderStyle: 'solid',\n backgroundColor,\n borderRadius,\n\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Column>\n </Row>\n );\n }\n\n private columns(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n const [newNode, totalWidth] = this.adjustColumnsContent(node);\n\n return (\n <Row\n width={`${totalWidth}%`}\n style={{\n margin: 0,\n padding: 0,\n width: `${totalWidth}%`,\n }}\n className=\"tab-row-full\"\n >\n {this.getMappedContent(newNode, {\n ...options,\n parent: newNode,\n })}\n </Row>\n );\n }\n\n private adjustColumnsContent(node: JSONContent): [JSONContent, number] {\n const { content = [] } = node;\n const totalWidth = 100;\n const columnsWithWidth = content.filter(\n (c) => c.type === 'column' && Boolean(Number(c.attrs?.width || 0))\n );\n const autoWidthColumns = content.filter(\n (c) =>\n c.type === 'column' && (c.attrs?.width === 'auto' || !c.attrs?.width)\n );\n\n const totalWidthUsed = columnsWithWidth.reduce(\n (acc, c) => acc + Number(c.attrs?.width),\n 0\n );\n\n const remainingWidth = totalWidth - totalWidthUsed;\n const measuredWidth = remainingWidth / autoWidthColumns.length;\n\n const gap = node.attrs?.gap || DEFAULT_COLUMNS_GAP;\n\n return [\n {\n ...node,\n content: content.map((c, index) => {\n const isAutoWidthColumn =\n c.type === 'column' &&\n (c.attrs?.width === 'auto' || !c.attrs?.width);\n const isFirstColumn = index === 0;\n const isLastColumn = index === content.length - 1;\n\n return {\n ...c,\n attrs: {\n ...c.attrs,\n width: isAutoWidthColumn ? measuredWidth : c.attrs?.width,\n\n isFirstColumn,\n isLastColumn,\n index,\n\n paddingLeft: isFirstColumn ? 0 : gap / 2,\n paddingRight: isLastColumn ? 0 : gap / 2,\n },\n };\n }),\n },\n autoWidthColumns.length === 0\n ? Math.min(totalWidth, totalWidthUsed)\n : totalWidth,\n ];\n }\n\n private column(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n width,\n verticalAlign = 'top',\n paddingLeft = 0,\n paddingRight = 0,\n } = attrs || {};\n\n return (\n <Column\n width={`${Number(width)}%`}\n style={{\n width: `${Number(width)}%`,\n margin: 0,\n verticalAlign,\n }}\n className=\"tab-col-full\"\n >\n <Section\n style={{\n margin: 0,\n paddingLeft,\n paddingRight,\n }}\n className=\"tab-pad\"\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Section>\n </Column>\n );\n }\n\n private for(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { each = '' } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n let { payloadValue } = options || {};\n payloadValue = typeof payloadValue === 'object' ? payloadValue : {};\n\n const values = this.payloadValues.get(each) ?? payloadValue[each] ?? [];\n if (!Array.isArray(values)) {\n throw new Error(`Payload value for each \"${each}\" is not an array`);\n }\n\n return (\n <>\n {values.map((value) => {\n return (\n <Fragment key={generateKey()}>\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n payloadValue: value,\n })}\n </Fragment>\n );\n })}\n </>\n );\n }\n\n private shouldShow(node: JSONContent, options?: NodeOptions): boolean {\n const showIfKey = node?.attrs?.showIfKey ?? '';\n if (!showIfKey) {\n return true;\n }\n\n let { payloadValue } = options || {};\n payloadValue = typeof payloadValue === 'object' ? payloadValue : {};\n return !!(this.payloadValues.get(showIfKey) ?? payloadValue[showIfKey]);\n }\n}\n","function clamp(n, min, max) {\n return Math.min(max, Math.max(min, n));\n}\nfunction sum(...args) {\n return flattenArrayable(args).reduce((a, b) => a + b, 0);\n}\nfunction lerp(min, max, t) {\n const interpolation = clamp(t, 0, 1);\n return min + (max - min) * interpolation;\n}\nfunction remap(n, inMin, inMax, outMin, outMax) {\n const interpolation = (n - inMin) / (inMax - inMin);\n return lerp(outMin, outMax, interpolation);\n}\n\nfunction toArray(array) {\n array = array ?? [];\n return Array.isArray(array) ? array : [array];\n}\nfunction flattenArrayable(array) {\n return toArray(array).flat(1);\n}\nfunction mergeArrayable(...args) {\n return args.flatMap((i) => toArray(i));\n}\nfunction partition(array, ...filters) {\n const result = Array.from({ length: filters.length + 1 }).fill(null).map(() => []);\n array.forEach((e, idx, arr) => {\n let i = 0;\n for (const filter of filters) {\n if (filter(e, idx, arr)) {\n result[i].push(e);\n return;\n }\n i += 1;\n }\n result[i].push(e);\n });\n return result;\n}\nfunction uniq(array) {\n return Array.from(new Set(array));\n}\nfunction uniqueBy(array, equalFn) {\n return array.reduce((acc, cur) => {\n const index = acc.findIndex((item) => equalFn(cur, item));\n if (index === -1)\n acc.push(cur);\n return acc;\n }, []);\n}\nfunction last(array) {\n return at(array, -1);\n}\nfunction remove(array, value) {\n if (!array)\n return false;\n const index = array.indexOf(value);\n if (index >= 0) {\n array.splice(index, 1);\n return true;\n }\n return false;\n}\nfunction at(array, index) {\n const len = array.length;\n if (!len)\n return void 0;\n if (index < 0)\n index += len;\n return array[index];\n}\nfunction range(...args) {\n let start, stop, step;\n if (args.length === 1) {\n start = 0;\n step = 1;\n [stop] = args;\n } else {\n [start, stop, step = 1] = args;\n }\n const arr = [];\n let current = start;\n while (current < stop) {\n arr.push(current);\n current += step || 1;\n }\n return arr;\n}\nfunction move(arr, from, to) {\n arr.splice(to, 0, arr.splice(from, 1)[0]);\n return arr;\n}\nfunction clampArrayRange(n, arr) {\n return clamp(n, 0, arr.length - 1);\n}\nfunction sample(arr, quantity) {\n return Array.from({ length: quantity }, (_) => arr[Math.round(Math.random() * (arr.length - 1))]);\n}\nfunction shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [array[i], array[j]] = [array[j], array[i]];\n }\n return array;\n}\n\nfunction assert(condition, message) {\n if (!condition)\n throw new Error(message);\n}\nconst toString = (v) => Object.prototype.toString.call(v);\nfunction getTypeName(v) {\n if (v === null)\n return \"null\";\n const type = toString(v).slice(8, -1).toLowerCase();\n return typeof v === \"object\" || typeof v === \"function\" ? type : typeof v;\n}\nfunction noop() {\n}\n\nfunction isDeepEqual(value1, value2) {\n const type1 = getTypeName(value1);\n const type2 = getTypeName(value2);\n if (type1 !== type2)\n return false;\n if (type1 === \"array\") {\n if (value1.length !== value2.length)\n return false;\n return value1.every((item, i) => {\n return isDeepEqual(item, value2[i]);\n });\n }\n if (type1 === \"object\") {\n const keyArr = Object.keys(value1);\n if (keyArr.length !== Object.keys(value2).length)\n return false;\n return keyArr.every((key) => {\n return isDeepEqual(value1[key], value2[key]);\n });\n }\n return Object.is(value1, value2);\n}\n\nfunction notNullish(v) {\n return v != null;\n}\nfunction noNull(v) {\n return v !== null;\n}\nfunction notUndefined(v) {\n return v !== void 0;\n}\nfunction isTruthy(v) {\n return Boolean(v);\n}\n\nconst isDef = (val) => typeof val !== \"undefined\";\nconst isBoolean = (val) => typeof val === \"boolean\";\nconst isFunction = (val) => typeof val === \"function\";\nconst isNumber = (val) => typeof val === \"number\";\nconst isString = (val) => typeof val === \"string\";\nconst isObject = (val) => toString(val) === \"[object Object]\";\nconst isUndefined = (val) => toString(val) === \"[object Undefined]\";\nconst isNull = (val) => toString(val) === \"[object Null]\";\nconst isRegExp = (val) => toString(val) === \"[object RegExp]\";\nconst isDate = (val) => toString(val) === \"[object Date]\";\nconst isWindow = (val) => typeof window !== \"undefined\" && toString(val) === \"[object Window]\";\nconst isBrowser = typeof window !== \"undefined\";\n\nfunction slash(str) {\n return str.replace(/\\\\/g, \"/\");\n}\nfunction ensurePrefix(prefix, str) {\n if (!str.startsWith(prefix))\n return prefix + str;\n return str;\n}\nfunction ensureSuffix(suffix, str) {\n if (!str.endsWith(suffix))\n return str + suffix;\n return str;\n}\nfunction template(str, ...args) {\n const [firstArg, fallback] = args;\n if (isObject(firstArg)) {\n const vars = firstArg;\n return str.replace(/{([\\w\\d]+)}/g, (_, key) => vars[key] || ((typeof fallback === \"function\" ? fallback(key) : fallback) ?? key));\n } else {\n return str.replace(/{(\\d+)}/g, (_, key) => {\n const index = Number(key);\n if (Number.isNaN(index))\n return key;\n return args[index];\n });\n }\n}\nconst urlAlphabet = \"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict\";\nfunction randomStr(size = 16, dict = urlAlphabet) {\n let id = \"\";\n let i = size;\n const len = dict.length;\n while (i--)\n id += dict[Math.random() * len | 0];\n return id;\n}\nfunction capitalize(str) {\n return str[0].toUpperCase() + str.slice(1).toLowerCase();\n}\nconst _reFullWs = /^\\s*$/;\nfunction unindent(str) {\n const lines = (typeof str === \"string\" ? str : str[0]).split(\"\\n\");\n const whitespaceLines = lines.map((line) => _reFullWs.test(line));\n const commonIndent = lines.reduce((min, line, idx) => {\n var _a;\n if (whitespaceLines[idx])\n return min;\n const indent = (_a = line.match(/^\\s*/)) == null ? void 0 : _a[0].length;\n return indent === void 0 ? min : Math.min(min, indent);\n }, Number.POSITIVE_INFINITY);\n let emptyLinesHead = 0;\n while (emptyLinesHead < lines.length && whitespaceLines[emptyLinesHead])\n emptyLinesHead++;\n let emptyLinesTail = 0;\n while (emptyLinesTail < lines.length && whitespaceLines[lines.length - emptyLinesTail - 1])\n emptyLinesTail++;\n return lines.slice(emptyLinesHead, lines.length - emptyLinesTail).map((line) => line.slice(commonIndent)).join(\"\\n\");\n}\n\nconst timestamp = () => +Date.now();\n\nfunction batchInvoke(functions) {\n functions.forEach((fn) => fn && fn());\n}\nfunction invoke(fn) {\n return fn();\n}\nfunction tap(value, callback) {\n callback(value);\n return value;\n}\n\nfunction objectMap(obj, fn) {\n return Object.fromEntries(\n Object.entries(obj).map(([k, v]) => fn(k, v)).filter(notNullish)\n );\n}\nfunction isKeyOf(obj, k) {\n return k in obj;\n}\nfunction objectKeys(obj) {\n return Object.keys(obj);\n}\nfunction objectEntries(obj) {\n return Object.entries(obj);\n}\nfunction deepMerge(target, ...sources) {\n if (!sources.length)\n return target;\n const source = sources.shift();\n if (source === void 0)\n return target;\n if (isMergableObject(target) && isMergableObject(source)) {\n objectKeys(source).forEach((key) => {\n if (key === \"__proto__\" || key === \"constructor\" || key === \"prototype\")\n return;\n if (isMergableObject(source[key])) {\n if (!target[key])\n target[key] = {};\n if (isMergableObject(target[key])) {\n deepMerge(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n } else {\n target[key] = source[key];\n }\n });\n }\n return deepMerge(target, ...sources);\n}\nfunction deepMergeWithArray(target, ...sources) {\n if (!sources.length)\n return target;\n const source = sources.shift();\n if (source === void 0)\n return target;\n if (Array.isArray(target) && Array.isArray(source))\n target.push(...source);\n if (isMergableObject(target) && isMergableObject(source)) {\n objectKeys(source).forEach((key) => {\n if (key === \"__proto__\" || key === \"constructor\" || key === \"prototype\")\n return;\n if (Array.isArray(source[key])) {\n if (!target[key])\n target[key] = [];\n deepMergeWithArray(target[key], source[key]);\n } else if (isMergableObject(source[key])) {\n if (!target[key])\n target[key] = {};\n deepMergeWithArray(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n });\n }\n return deepMergeWithArray(target, ...sources);\n}\nfunction isMergableObject(item) {\n return isObject(item) && !Array.isArray(item);\n}\nfunction objectPick(obj, keys, omitUndefined = false) {\n return keys.reduce((n, k) => {\n if (k in obj) {\n if (!omitUndefined || obj[k] !== void 0)\n n[k] = obj[k];\n }\n return n;\n }, {});\n}\nfunction clearUndefined(obj) {\n Object.keys(obj).forEach((key) => obj[key] === void 0 ? delete obj[key] : {});\n return obj;\n}\nfunction hasOwnProperty(obj, v) {\n if (obj == null)\n return false;\n return Object.prototype.hasOwnProperty.call(obj, v);\n}\n\nfunction createSingletonPromise(fn) {\n let _promise;\n function wrapper() {\n if (!_promise)\n _promise = fn();\n return _promise;\n }\n wrapper.reset = async () => {\n const _prev = _promise;\n _promise = void 0;\n if (_prev)\n await _prev;\n };\n return wrapper;\n}\nfunction sleep(ms, callback) {\n return new Promise(\n (resolve) => setTimeout(async () => {\n await (callback == null ? void 0 : callback());\n resolve();\n }, ms)\n );\n}\nfunction createPromiseLock() {\n const locks = [];\n return {\n async run(fn) {\n const p = fn();\n locks.push(p);\n try {\n return await p;\n } finally {\n remove(locks, p);\n }\n },\n async wait() {\n await Promise.allSettled(locks);\n },\n isWaiting() {\n return Boolean(locks.length);\n },\n clear() {\n locks.length = 0;\n }\n };\n}\nfunction createControlledPromise() {\n let resolve, reject;\n const promise = new Promise((_resolve, _reject) => {\n resolve = _resolve;\n reject = _reject;\n });\n promise.resolve = resolve;\n promise.reject = reject;\n return promise;\n}\n\n/* eslint-disable no-undefined,no-param-reassign,no-shadow */\n\n/**\n * Throttle execution of a function. Especially useful for rate limiting\n * execution of handlers on events like resize and scroll.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)\n * are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,\n * as-is, to `callback` when the throttled-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds\n * while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed\n * one final time after the last throttled-function call. (After the throttled-function has not been called for\n * `delay` milliseconds, the internal counter is reset).\n * @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback\n * immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that\n * callback will never executed if both noLeading = true and noTrailing = true.\n * @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is\n * false (at end), schedule `callback` to execute after `delay` ms.\n *\n * @returns {Function} A new, throttled, function.\n */\nfunction throttle (delay, callback, options) {\n var _ref = options || {},\n _ref$noTrailing = _ref.noTrailing,\n noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,\n _ref$noLeading = _ref.noLeading,\n noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,\n _ref$debounceMode = _ref.debounceMode,\n debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;\n /*\n * After wrapper has stopped being called, this timeout ensures that\n * `callback` is executed at the proper times in `throttle` and `end`\n * debounce modes.\n */\n\n\n var timeoutID;\n var cancelled = false; // Keep track of the last time `callback` was executed.\n\n var lastExec = 0; // Function to clear existing timeout\n\n function clearExistingTimeout() {\n if (timeoutID) {\n clearTimeout(timeoutID);\n }\n } // Function to cancel next exec\n\n\n function cancel(options) {\n var _ref2 = options || {},\n _ref2$upcomingOnly = _ref2.upcomingOnly,\n upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;\n\n clearExistingTimeout();\n cancelled = !upcomingOnly;\n }\n /*\n * The `wrapper` function encapsulates all of the throttling / debouncing\n * functionality and when executed will limit the rate at which `callback`\n * is executed.\n */\n\n\n function wrapper() {\n for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {\n arguments_[_key] = arguments[_key];\n }\n\n var self = this;\n var elapsed = Date.now() - lastExec;\n\n if (cancelled) {\n return;\n } // Execute `callback` and update the `lastExec` timestamp.\n\n\n function exec() {\n lastExec = Date.now();\n callback.apply(self, arguments_);\n }\n /*\n * If `debounceMode` is true (at begin) this is used to clear the flag\n * to allow future `callback` executions.\n */\n\n\n function clear() {\n timeoutID = undefined;\n }\n\n if (!noLeading && debounceMode && !timeoutID) {\n /*\n * Since `wrapper` is being called for the first time and\n * `debounceMode` is true (at begin), execute `callback`\n * and noLeading != true.\n */\n exec();\n }\n\n clearExistingTimeout();\n\n if (debounceMode === undefined && elapsed > delay) {\n if (noLeading) {\n /*\n * In throttle mode with noLeading, if `delay` time has\n * been exceeded, update `lastExec` and schedule `callback`\n * to execute after `delay` ms.\n */\n lastExec = Date.now();\n\n if (!noTrailing) {\n timeoutID = setTimeout(debounceMode ? clear : exec, delay);\n }\n } else {\n /*\n * In throttle mode without noLeading, if `delay` time has been exceeded, execute\n * `callback`.\n */\n exec();\n }\n } else if (noTrailing !== true) {\n /*\n * In trailing throttle mode, since `delay` time has not been\n * exceeded, schedule `callback` to execute `delay` ms after most\n * recent execution.\n *\n * If `debounceMode` is true (at begin), schedule `clear` to execute\n * after `delay` ms.\n *\n * If `debounceMode` is false (at end), schedule `callback` to\n * execute after `delay` ms.\n */\n timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);\n }\n }\n\n wrapper.cancel = cancel; // Return the wrapper function.\n\n return wrapper;\n}\n\n/* eslint-disable no-undefined */\n/**\n * Debounce execution of a function. Debouncing, unlike throttling,\n * guarantees that a function is only executed a single time, either at the\n * very beginning of a series of calls, or at the very end.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n * to `callback` when the debounced-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds\n * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.\n * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).\n *\n * @returns {Function} A new, debounced function.\n */\n\nfunction debounce (delay, callback, options) {\n var _ref = options || {},\n _ref$atBegin = _ref.atBegin,\n atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin;\n\n return throttle(delay, callback, {\n debounceMode: atBegin !== false\n });\n}\n\n/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nclass Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n}\n\nconst AsyncResource = {\n\tbind(fn, _type, thisArg) {\n\t\treturn fn.bind(thisArg);\n\t},\n};\n\nfunction pLimit(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst next = () => {\n\t\tactiveCount--;\n\n\t\tif (queue.size > 0) {\n\t\t\tqueue.dequeue()();\n\t\t}\n\t};\n\n\tconst run = async (function_, resolve, arguments_) => {\n\t\tactiveCount++;\n\n\t\tconst result = (async () => function_(...arguments_))();\n\n\t\tresolve(result);\n\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\tnext();\n\t};\n\n\tconst enqueue = (function_, resolve, arguments_) => {\n\t\tqueue.enqueue(\n\t\t\tAsyncResource.bind(run.bind(undefined, function_, resolve, arguments_)),\n\t\t);\n\n\t\t(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// when the run function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve();\n\n\t\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\t\tqueue.dequeue()();\n\t\t\t}\n\t\t})();\n\t};\n\n\tconst generator = (function_, ...arguments_) => new Promise(resolve => {\n\t\tenqueue(function_, resolve, arguments_);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue() {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n\nconst VOID = Symbol(\"p-void\");\nclass PInstance extends Promise {\n constructor(items = [], options) {\n super(() => {\n });\n this.items = items;\n this.options = options;\n this.promises = /* @__PURE__ */ new Set();\n }\n get promise() {\n var _a;\n let batch;\n const items = [...Array.from(this.items), ...Array.from(this.promises)];\n if ((_a = this.options) == null ? void 0 : _a.concurrency) {\n const limit = pLimit(this.options.concurrency);\n batch = Promise.all(items.map((p2) => limit(() => p2)));\n } else {\n batch = Promise.all(items);\n }\n return batch.then((l) => l.filter((i) => i !== VOID));\n }\n add(...args) {\n args.forEach((i) => {\n this.promises.add(i);\n });\n }\n map(fn) {\n return new PInstance(\n Array.from(this.items).map(async (i, idx) => {\n const v = await i;\n if (v === VOID)\n return VOID;\n return fn(v, idx);\n }),\n this.options\n );\n }\n filter(fn) {\n return new PInstance(\n Array.from(this.items).map(async (i, idx) => {\n const v = await i;\n const r = await fn(v, idx);\n if (!r)\n return VOID;\n return v;\n }),\n this.options\n );\n }\n forEach(fn) {\n return this.map(fn).then();\n }\n reduce(fn, initialValue) {\n return this.promise.then((array) => array.reduce(fn, initialValue));\n }\n clear() {\n this.promises.clear();\n }\n then(fn) {\n const p2 = this.promise;\n if (fn)\n return p2.then(fn);\n else\n return p2;\n }\n catch(fn) {\n return this.promise.catch(fn);\n }\n finally(fn) {\n return this.promise.finally(fn);\n }\n}\nfunction p(items, options) {\n return new PInstance(items, options);\n}\n\nexport { assert, at, batchInvoke, capitalize, clamp, clampArrayRange, clearUndefined, createControlledPromise, createPromiseLock, createSingletonPromise, debounce, deepMerge, deepMergeWithArray, ensurePrefix, ensureSuffix, flattenArrayable, getTypeName, hasOwnProperty, invoke, isBoolean, isBrowser, isDate, isDeepEqual, isDef, isFunction, isKeyOf, isNull, isNumber, isObject, isRegExp, isString, isTruthy, isUndefined, isWindow, last, lerp, mergeArrayable, move, noNull, noop, notNullish, notUndefined, objectEntries, objectKeys, objectMap, objectPick, p, partition, randomStr, range, remap, remove, sample, shuffle, slash, sleep, sum, tap, template, throttle, timestamp, toArray, toString, unindent, uniq, uniqueBy };\n","export function generateKey() {\n // Length of 6 is enough to avoid collisions\n // for react keys\n return Math.random().toString(36).substr(2, 6);\n}\n","import type { JSONContent } from '@tiptap/core';\nimport { Maily } from './maily';\nimport type { MailyConfig, RenderOptions } from './maily';\n\nexport async function render(\n content: JSONContent,\n config?: MailyConfig & RenderOptions\n): Promise<string> {\n const { theme, preview, ...rest } = config || {};\n\n const maily = new Maily(content);\n maily.setPreviewText(preview);\n maily.setTheme(theme || {});\n\n maily.setPayloadValue('items', [\n {\n name: 'John Doe',\n },\n {\n name: 'Novu',\n },\n ]);\n\n maily.setPayloadValue('shouldShow', true);\n\n return maily.render(rest);\n}\n"],"mappings":"4xBAAA,OAAS,YAAAA,MAAoC,QAC7C,OACE,QAAAC,EACA,QAAAC,GACA,QAAAC,GACA,QAAAC,GACA,QAAAC,GACA,aAAAC,EACA,QAAAC,GACA,WAAAC,GACA,MAAAC,GACA,UAAAC,GACA,OAAAC,EACA,WAAAC,GACA,OAAAC,EACA,UAAAC,EACA,WAAAC,OACK,0BACP,OAAS,eAAeC,OAA6B,sBC6FrD,IAAMC,EAAYC,GAAM,OAAO,UAAU,SAAS,KAAKA,CAAC,EAmDxD,IAAMC,EAAYC,GAAQC,EAASD,CAAG,IAAM,kBAwF5C,SAASE,GAAWC,EAAK,CACvB,OAAO,OAAO,KAAKA,CAAG,CACxB,CAIA,SAASC,EAAUC,KAAWC,EAAS,CACrC,GAAI,CAACA,EAAQ,OACX,OAAOD,EACT,IAAME,EAASD,EAAQ,MAAM,EAC7B,OAAIC,IAAW,OACNF,GACLG,EAAiBH,CAAM,GAAKG,EAAiBD,CAAM,GACrDE,GAAWF,CAAM,EAAE,QAASG,GAAQ,CAC9BA,IAAQ,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I,MAAM,2BAA2ByI,CAAI,mBAAmB,EAGpE,OACEhH,EAAAC,EAAA,CACG,SAAA1B,EAAO,IAAKD,GAET0B,EAACC,EAAA,CACE,cAAK,iBAAiBhB,EAAMyC,EAAAC,EAAA,GACxBlC,GADwB,CAE3B,OAAQR,EACR,aAAcX,CAChB,EAAC,GALY4B,EAAY,CAM3B,CAEH,EACH,CAEJ,CAEQ,WAAWjB,EAAmBQ,EAAgC,CAj+CxE,IAAAP,EAAA8C,EAAAC,EAk+CI,IAAMgF,GAAYjF,GAAA9C,EAAAD,GAAA,YAAAA,EAAM,QAAN,YAAAC,EAAa,YAAb,KAAA8C,EAA0B,GAC5C,GAAI,CAACiF,EACH,MAAO,GAGT,GAAI,CAAE,aAAA/D,CAAa,EAAIzD,GAAW,CAAC,EACnC,OAAAyD,EAAe,OAAOA,GAAiB,SAAWA,EAAe,CAAC,EAC3D,CAAC,GAAEjB,EAAA,KAAK,cAAc,IAAIgF,CAAS,IAAhC,KAAAhF,EAAqCiB,EAAa+D,CAAS,EACvE,CACF,EGv+CA,SAAsBC,GACpBC,EACAC,EACiB,QAAAC,EAAA,sBACjB,IAAoCC,EAAAF,GAAU,CAAC,EAAvC,OAAAG,EAAO,QAAAC,CARjB,EAQsCF,EAATG,EAAAC,EAASJ,EAAT,CAAnB,QAAO,YAETK,EAAQ,IAAIC,EAAMT,CAAO,EAC/B,OAAAQ,EAAM,eAAeH,CAAO,EAC5BG,EAAM,SAASJ,GAAS,CAAC,CAAC,EAE1BI,EAAM,gBAAgB,QAAS,CAC7B,CACE,KAAM,UACR,EACA,CACE,KAAM,MACR,CACF,CAAC,EAEDA,EAAM,gBAAgB,aAAc,EAAI,EAEjCA,EAAM,OAAOF,CAAI,CAC1B","names":["Fragment","Text","Html","Head","Body","Font","Container","Link","Heading","Hr","Button","Img","Preview","Row","Column","Section","reactEmailRenderAsync","toString","v","isObject","val","toString","objectKeys","obj","deepMerge","target","sources","source","isMergableObject","objectKeys","key","isMergableObject","item","isObject","VOID","generateKey","Fragment","jsx","jsxs","spacers","antialiased","headings","logoSizes","DEFAULT_RENDER_OPTIONS","DEFAULT_THEME","CODE_FONT_FAMILY","DEFAULT_SECTION_BACKGROUND_COLOR","DEFAULT_SECTION_ALIGN","DEFAULT_SECTION_BORDER_WIDTH","DEFAULT_SECTION_BORDER_COLOR","DEFAULT_SECTION_MARGIN_TOP","DEFAULT_SECTION_MARGIN_RIGHT","DEFAULT_SECTION_MARGIN_BOTTOM","DEFAULT_SECTION_MARGIN_LEFT","DEFAULT_SECTION_PADDING_TOP","DEFAULT_SECTION_PADDING_RIGHT","DEFAULT_SECTION_PADDING_BOTTOM","DEFAULT_SECTION_PADDING_LEFT","DEFAULT_COLUMNS_WIDTH","DEFAULT_COLUMNS_GAP","DEFAULT_COLUMN_BACKGROUND_COLOR","DEFAULT_COLUMN_BORDER_RADIUS","DEFAULT_COLUMN_BORDER_WIDTH","DEFAULT_COLUMN_BORDER_COLOR","DEFAULT_COLUMN_PADDING_TOP","DEFAULT_COLUMN_PADDING_RIGHT","DEFAULT_COLUMN_PADDING_BOTTOM","DEFAULT_COLUMN_PADDING_LEFT","Maily","content","variable","fallback","preview","theme","deepMerge","formatter","value","values","link","key","pixel","shouldReplace","nodes","links","isValidLink","href","extractLinksFromNode","node","_a","originalLink","childNode","mark","_","err","__async","options","markup","reactEmailRenderAsync","jsxNodes","index","nodeOptions","component","jsx","Fragment","generateKey","jsxs","Html","Head","Font","Body","Preview","Container","Img","parent","prev","next","isNextSpacer","isPrevSpacer","isParentListItem","isLastSectionElement","isFirstSectionElement","isLastColumnElement","isFirstColumnElement","isFirstForElement","isLastForElement","isFirstShowElement","isLastShowElement","allNodes","__spreadProps","__spreadValues","n","type","text","acc","_b","_c","_d","attrs","alignment","shouldRemoveBottomMargin","Text","antialiased","color","target","rel","Link","level","fontSize","lineHeight","fontWeight","headings","Heading","payloadValue","formattedVariable","__","Hr","url","variant","buttonColor","textColor","borderRadius","radius","Button","height","spacers","src","alt","title","size","Row","Column","width","externalLink","wi","mainImage","_e","_f","_g","_h","textAlign","_i","_j","_k","_l","description","linkTitle","image","badgeText","subTitle","backgroundColor","align","borderWidth","borderColor","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","newNode","totalWidth","columnsWithWidth","c","autoWidthColumns","totalWidthUsed","measuredWidth","gap","isAutoWidthColumn","isFirstColumn","isLastColumn","verticalAlign","Section","each","showIfKey","render","content","config","__async","_a","theme","preview","rest","__objRest","maily","Maily"]}
1
+ {"version":3,"sources":["../src/maily.tsx","../../../node_modules/.pnpm/@antfu+utils@0.7.10/node_modules/@antfu/utils/dist/index.mjs","../src/utils.ts","../src/render.ts"],"sourcesContent":["import { Fragment, type CSSProperties } from 'react';\nimport {\n Text,\n Html,\n Head,\n Body,\n Font,\n Container,\n Link,\n Heading,\n Hr,\n Button,\n Img,\n Preview,\n Row,\n Column,\n Section,\n} from '@react-email/components';\nimport { renderAsync as reactEmailRenderAsync } from '@react-email/render';\nimport type { JSONContent } from '@tiptap/core';\nimport { deepMerge } from '@antfu/utils';\nimport { generateKey } from './utils';\n\ninterface NodeOptions {\n parent?: JSONContent;\n prev?: JSONContent;\n next?: JSONContent;\n\n payloadValue?: PayloadValue;\n}\n\nexport interface MarkType {\n [key: string]: any;\n type: string;\n attrs?: Record<string, any> | undefined;\n}\n\nconst allowedSpacers = ['sm', 'md', 'lg', 'xl'] as const;\nexport type AllowedSpacers = (typeof allowedSpacers)[number];\n\nconst spacers: Record<AllowedSpacers, string> = {\n sm: '8px',\n md: '16px',\n lg: '32px',\n xl: '64px',\n};\n\nconst antialiased: CSSProperties = {\n WebkitFontSmoothing: 'antialiased',\n MozOsxFontSmoothing: 'grayscale',\n};\n\nconst allowedHeadings = ['h1', 'h2', 'h3'] as const;\ntype AllowedHeadings = (typeof allowedHeadings)[number];\n\nconst headings: Record<AllowedHeadings, CSSProperties> = {\n h1: {\n fontSize: '36px',\n lineHeight: '40px',\n fontWeight: 800,\n },\n h2: {\n fontSize: '30px',\n lineHeight: '36px',\n fontWeight: 700,\n },\n h3: {\n fontSize: '24px',\n lineHeight: '38px',\n fontWeight: 600,\n },\n};\n\nconst allowedLogoSizes = ['sm', 'md', 'lg'] as const;\ntype AllowedLogoSizes = (typeof allowedLogoSizes)[number];\n\nconst logoSizes: Record<AllowedLogoSizes, string> = {\n sm: '40px',\n md: '48px',\n lg: '64px',\n};\n\nexport interface ThemeOptions {\n colors?: Partial<{\n heading: string;\n paragraph: string;\n horizontal: string;\n footer: string;\n blockquoteBorder: string;\n codeBackground: string;\n codeText: string;\n linkCardTitle: string;\n linkCardDescription: string;\n linkCardBadgeText: string;\n linkCardBadgeBackground: string;\n linkCardSubTitle: string;\n }>;\n fontSize?: Partial<{\n paragraph: string;\n footer: {\n size: string;\n lineHeight: string;\n };\n }>;\n}\n\nexport interface MailyConfig {\n /**\n * The preview text is the snippet of text that is pulled into the inbox\n * preview of an email client, usually right after the subject line.\n *\n * Default: `undefined`\n */\n preview?: string;\n /**\n * The theme object allows you to customize the colors and font sizes of the\n * rendered email.\n *\n * Default:\n * ```js\n * {\n * colors: {\n * heading: '#111827',\n * paragraph: '#374151',\n * horizontal: '#EAEAEA',\n * footer: '#64748B',\n * },\n * fontSize: {\n * paragraph: '15px',\n * footer: {\n * size: '14px',\n * lineHeight: '24px',\n * },\n * },\n * }\n * ```\n *\n * @example\n * ```js\n * const maily = new Maily(content, {\n * theme: {\n * colors: {\n * heading: '#111827',\n * },\n * fontSize: {\n * footer: {\n * size: '14px',\n * lineHeight: '24px',\n * },\n * },\n * },\n * });\n * ```\n */\n theme?: Partial<ThemeOptions>;\n}\n\nconst DEFAULT_RENDER_OPTIONS: RenderOptions = {\n pretty: false,\n plainText: false,\n};\n\nconst DEFAULT_THEME: ThemeOptions = {\n colors: {\n heading: '#111827',\n paragraph: '#374151',\n horizontal: '#EAEAEA',\n footer: '#64748B',\n blockquoteBorder: '#D1D5DB',\n codeBackground: '#EFEFEF',\n codeText: '#111827',\n linkCardTitle: '#111827',\n linkCardDescription: '#6B7280',\n linkCardBadgeText: '#111827',\n linkCardBadgeBackground: '#FEF08A',\n linkCardSubTitle: '#6B7280',\n },\n fontSize: {\n paragraph: '15px',\n footer: {\n size: '14px',\n lineHeight: '24px',\n },\n },\n};\n\nconst CODE_FONT_FAMILY =\n 'SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace';\nexport const DEFAULT_SECTION_BACKGROUND_COLOR = '#ffffff';\nexport const DEFAULT_SECTION_ALIGN = 'left';\nexport const DEFAULT_SECTION_BORDER_WIDTH = 1;\nexport const DEFAULT_SECTION_BORDER_COLOR = '#000000';\n\nexport const DEFAULT_SECTION_MARGIN_TOP = 0;\nexport const DEFAULT_SECTION_MARGIN_RIGHT = 0;\nexport const DEFAULT_SECTION_MARGIN_BOTTOM = 0;\nexport const DEFAULT_SECTION_MARGIN_LEFT = 0;\n\nexport const DEFAULT_SECTION_PADDING_TOP = 5;\nexport const DEFAULT_SECTION_PADDING_RIGHT = 5;\nexport const DEFAULT_SECTION_PADDING_BOTTOM = 5;\nexport const DEFAULT_SECTION_PADDING_LEFT = 5;\n\nexport const DEFAULT_COLUMNS_WIDTH = '100%';\nexport const DEFAULT_COLUMNS_GAP = 8;\n\nexport const DEFAULT_COLUMN_BACKGROUND_COLOR = 'transparent';\nexport const DEFAULT_COLUMN_BORDER_RADIUS = 0;\nexport const DEFAULT_COLUMN_BORDER_WIDTH = 0;\nexport const DEFAULT_COLUMN_BORDER_COLOR = 'transparent';\n\nexport const DEFAULT_COLUMN_PADDING_TOP = 0;\nexport const DEFAULT_COLUMN_PADDING_RIGHT = 0;\nexport const DEFAULT_COLUMN_PADDING_BOTTOM = 0;\nexport const DEFAULT_COLUMN_PADDING_LEFT = 0;\n\nexport interface RenderOptions {\n /**\n * The options object allows you to customize the output of the rendered\n * email.\n * - `pretty` - If `true`, the output will be formatted with indentation and\n * line breaks.\n * - `plainText` - If `true`, the output will be plain text instead of HTML.\n * This is useful for testing purposes.\n *\n * Default: `pretty` - `false`, `plainText` - `false`\n */\n pretty?: boolean;\n plainText?: boolean;\n}\n\nexport type VariableFormatter = (options: {\n variable: string;\n fallback?: string;\n}) => string;\nexport type VariableValues = Map<string, string>;\nexport type LinkValues = Map<string, string>;\n\nexport type PayloadValue = Record<string, any> | boolean;\nexport type PayloadValues = Map<string, PayloadValue>;\n\nexport class Maily {\n private readonly content: JSONContent;\n private config: MailyConfig = {\n theme: DEFAULT_THEME,\n };\n\n private variableFormatter: VariableFormatter = ({ variable, fallback }) => {\n return fallback\n ? `{{${variable},fallback=${fallback}}}`\n : `{{${variable}}}`;\n };\n\n private shouldReplaceVariableValues = false;\n private variableValues: VariableValues = new Map();\n private linkValues: LinkValues = new Map();\n private openTrackingPixel: string | undefined;\n private payloadValues: PayloadValues = new Map();\n\n constructor(content: JSONContent = { type: 'doc', content: [] }) {\n this.content = content;\n }\n\n setPreviewText(preview?: string) {\n this.config.preview = preview;\n }\n\n setTheme(theme: Partial<ThemeOptions>) {\n this.config.theme = deepMerge(this.config.theme || DEFAULT_THEME, theme);\n }\n\n setVariableFormatter(formatter: VariableFormatter) {\n this.variableFormatter = formatter;\n }\n\n /**\n * `setVariableValue` will set the variable value.\n * It will also set `shouldReplaceVariableValues` to `true`.\n *\n * @param variable - The variable name\n * @param value - The variable value\n */\n setVariableValue(variable: string, value: string) {\n if (!this.shouldReplaceVariableValues) {\n this.shouldReplaceVariableValues = true;\n }\n\n this.variableValues.set(variable, value);\n }\n\n /**\n * `setVariableValues` will set the variable values.\n * It will also set `shouldReplaceVariableValues` to `true`.\n *\n * @param values - The variable values\n *\n * @example\n * ```js\n * const maily = new Maily(content);\n * maily.setVariableValues({\n * name: 'John Doe',\n * email: 'john@doe.com',\n * });\n * ```\n */\n setVariableValues(values: Record<string, string>) {\n if (!this.shouldReplaceVariableValues) {\n this.shouldReplaceVariableValues = true;\n }\n\n Object.entries(values).forEach(([variable, value]) => {\n this.setVariableValue(variable, value);\n });\n }\n\n setLinkValue(link: string, value: string) {\n this.linkValues.set(link, value);\n }\n\n setLinkValues(values: Record<string, string>) {\n Object.entries(values).forEach(([link, value]) => {\n this.setLinkValue(link, value);\n });\n }\n\n setPayloadValue(key: string, value: PayloadValue) {\n if (!this.shouldReplaceVariableValues) {\n this.shouldReplaceVariableValues = true;\n }\n\n this.payloadValues.set(key, value);\n }\n\n setPayloadValues(values: Record<string, PayloadValue>) {\n Object.entries(values).forEach(([key, value]) => {\n this.setPayloadValue(key, value);\n });\n }\n\n /**\n * `setOpenTrackingPixel` will set the open tracking pixel.\n *\n * @param pixel - The open tracking pixel\n */\n setOpenTrackingPixel(pixel?: string) {\n this.openTrackingPixel = pixel;\n }\n\n /**\n * `setShouldReplaceVariableValues` will determine whether to replace the\n * variable values or not. Otherwise, it will just return the formatted variable.\n *\n * Default: `false`\n */\n setShouldReplaceVariableValues(shouldReplace: boolean) {\n this.shouldReplaceVariableValues = shouldReplace;\n }\n\n getAllLinks() {\n const nodes = this.content.content || [];\n const links = new Set<string>();\n\n const isValidLink = (href: string) => {\n return (\n href &&\n this.isValidUrl(href) &&\n !href.startsWith('#') &&\n !href.startsWith('mailto:') &&\n !href.startsWith('tel:') &&\n typeof href === 'string'\n );\n };\n\n const extractLinksFromNode = (node: JSONContent) => {\n if (node.type === 'button') {\n const originalLink = node.attrs?.url;\n if (isValidLink(originalLink) && originalLink) {\n links.add(originalLink);\n }\n } else if (node.content) {\n node.content.forEach((childNode) => {\n if (childNode.marks) {\n childNode.marks.forEach((mark) => {\n const originalLink = mark.attrs?.href;\n if (mark.type === 'link' && isValidLink(originalLink)) {\n links.add(originalLink);\n }\n });\n }\n if (childNode.content) {\n extractLinksFromNode(childNode);\n }\n });\n }\n };\n\n nodes.forEach((childNode) => {\n extractLinksFromNode(childNode);\n });\n\n return links;\n }\n\n private isValidUrl(href: string) {\n try {\n const _ = new URL(href);\n return true;\n } catch (err) {\n return false;\n }\n }\n\n async render(\n options: RenderOptions = DEFAULT_RENDER_OPTIONS\n ): Promise<string> {\n const markup = this.markup();\n return reactEmailRenderAsync(markup, options);\n }\n\n /**\n * `markup` will render the JSON content into React Email markup.\n * and return the raw React Tree.\n */\n markup() {\n const nodes = this.content.content || [];\n const jsxNodes = nodes.map((node, index) => {\n const nodeOptions: NodeOptions = {\n prev: nodes[index - 1],\n next: nodes[index + 1],\n parent: node,\n };\n\n const component = this.renderNode(node, nodeOptions);\n if (!component) {\n return null;\n }\n\n return <Fragment key={generateKey()}>{component}</Fragment>;\n });\n\n const { preview } = this.config;\n\n const markup = (\n <Html>\n <Head>\n <Font\n fallbackFontFamily=\"sans-serif\"\n fontFamily=\"Inter\"\n fontStyle=\"normal\"\n fontWeight={400}\n webFont={{\n url: 'https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19',\n format: 'woff2',\n }}\n />\n <style\n dangerouslySetInnerHTML={{\n __html: `blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}@media only screen and (max-width:425px){.tab-row-full{width:100%!important}.tab-col-full{display:block!important;width:100%!important}.tab-pad{padding:0!important}}`,\n }}\n />\n\n <meta content=\"width=device-width\" name=\"viewport\" />\n <meta content=\"IE=edge\" httpEquiv=\"X-UA-Compatible\" />\n <meta name=\"x-apple-disable-message-reformatting\" />\n <meta\n // http://www.html-5.com/metatags/format-detection-meta-tag.html\n // It will prevent iOS from automatically detecting possible phone numbers in a block of text\n content=\"telephone=no,address=no,email=no,date=no,url=no\"\n name=\"format-detection\"\n />\n <meta content=\"light\" name=\"color-scheme\" />\n <meta content=\"light\" name=\"supported-color-schemes\" />\n </Head>\n <Body\n style={{\n margin: 0,\n }}\n >\n {preview ? (\n <Preview id=\"__react-email-preview\">{preview}</Preview>\n ) : null}\n <Container\n style={{\n maxWidth: '600px',\n minWidth: '300px',\n width: '100%',\n marginLeft: 'auto',\n marginRight: 'auto',\n padding: '0.5rem',\n }}\n >\n {jsxNodes}\n </Container>\n {this.openTrackingPixel ? (\n <Img\n alt=\"\"\n src={this.openTrackingPixel}\n style={{\n display: 'none',\n width: '1px',\n height: '1px',\n }}\n />\n ) : null}\n </Body>\n </Html>\n );\n\n return markup;\n }\n\n private getMarginOverrideConditions(\n node: JSONContent,\n options?: NodeOptions\n ) {\n const { parent, prev, next } = options || {};\n\n const isNextSpacer = next?.type === 'spacer';\n const isPrevSpacer = prev?.type === 'spacer';\n\n const isParentListItem = parent?.type === 'listItem';\n\n const isLastSectionElement = parent?.type === 'section' && !next;\n const isFirstSectionElement = parent?.type === 'section' && !prev;\n\n const isLastColumnElement = parent?.type === 'column' && !next;\n const isFirstColumnElement = parent?.type === 'column' && !prev;\n\n const isFirstForElement = parent?.type === 'for' && !prev;\n const isLastForElement = parent?.type === 'for' && !next;\n\n const isFirstShowElement = parent?.type === 'show' && !prev;\n const isLastShowElement = parent?.type === 'show' && !next;\n\n return {\n isNextSpacer,\n isPrevSpacer,\n isLastSectionElement,\n isFirstSectionElement,\n isParentListItem,\n isLastColumnElement,\n isFirstColumnElement,\n isFirstForElement,\n isLastForElement,\n isFirstShowElement,\n isLastShowElement,\n\n shouldRemoveTopMargin:\n isPrevSpacer ||\n isFirstSectionElement ||\n isFirstColumnElement ||\n isFirstForElement ||\n isFirstShowElement,\n shouldRemoveBottomMargin:\n isNextSpacer ||\n isLastSectionElement ||\n isLastColumnElement ||\n isLastForElement ||\n isLastShowElement,\n };\n }\n\n // `getMappedContent` will call corresponding node type\n // and return text content\n private getMappedContent(\n node: JSONContent,\n options?: NodeOptions\n ): JSX.Element[] {\n const allNodes = node.content || [];\n return allNodes\n .map((childNode, index) => {\n const component = this.renderNode(childNode, {\n ...options,\n next: allNodes[index + 1],\n prev: allNodes[index - 1],\n });\n if (!component) {\n return null;\n }\n\n return <Fragment key={generateKey()}>{component}</Fragment>;\n })\n .filter((n) => n !== null) as JSX.Element[];\n }\n\n // `renderNode` will call the method of the corresponding node type\n private renderNode(\n node: JSONContent,\n options: NodeOptions = {}\n ): JSX.Element | null {\n const type = node.type || '';\n\n if (type in this) {\n // @ts-expect-error - `this` is not assignable to type 'never'\n return this[type]?.(node, options) as JSX.Element;\n }\n\n throw new Error(`Node type \"${type}\" is not supported.`);\n }\n\n // `renderMark` will call the method of the corresponding mark type\n private renderMark(node: JSONContent): JSX.Element {\n // It will wrap the text with the corresponding mark type\n const text = node?.text || <>&nbsp;</>;\n const marks = node?.marks || [];\n\n return marks.reduce(\n (acc, mark) => {\n const type = mark.type;\n if (type in this) {\n // @ts-expect-error - `this` is not assignable to type 'never'\n return this[type]?.(mark, acc) as JSX.Element;\n }\n\n throw new Error(`Mark type \"${type}\" is not supported.`);\n },\n <>{text}</>\n );\n }\n\n private paragraph(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const alignment = attrs?.textAlign || 'left';\n const { isParentListItem, shouldRemoveBottomMargin } =\n this.getMarginOverrideConditions(node, options);\n\n return (\n <Text\n style={{\n textAlign: alignment,\n marginBottom:\n isParentListItem || shouldRemoveBottomMargin ? '0px' : '20px',\n marginTop: '0px',\n fontSize: this.config.theme?.fontSize?.paragraph,\n color: this.config.theme?.colors?.paragraph,\n ...antialiased,\n }}\n >\n {node.content ? (\n this.getMappedContent(node, {\n ...options,\n parent: node,\n })\n ) : (\n <>&nbsp;</>\n )}\n </Text>\n );\n }\n\n private text(node: JSONContent, _?: NodeOptions): JSX.Element {\n const text = node.text || '&nbsp';\n if (node.marks) {\n return this.renderMark(node);\n }\n\n return <>{text}</>;\n }\n\n private bold(_: MarkType, text: JSX.Element): JSX.Element {\n return <strong>{text}</strong>;\n }\n\n private italic(_: MarkType, text: JSX.Element): JSX.Element {\n return <em>{text}</em>;\n }\n\n private underline(_: MarkType, text: JSX.Element): JSX.Element {\n return <u>{text}</u>;\n }\n\n private strike(_: MarkType, text: JSX.Element): JSX.Element {\n return <s style={{ textDecoration: 'line-through' }}>{text}</s>;\n }\n\n private textStyle(mark: MarkType, text: JSX.Element): JSX.Element {\n const { attrs } = mark;\n const { color = this.config.theme?.colors?.paragraph } = attrs || {};\n\n return (\n <span\n style={{\n color,\n }}\n >\n {text}\n </span>\n );\n }\n\n private link(mark: MarkType, text: JSX.Element): JSX.Element {\n const { attrs } = mark;\n let href = attrs?.href || '#';\n const target = attrs?.target || '_blank';\n const rel = attrs?.rel || 'noopener noreferrer nofollow';\n\n // If the href value is provided, use it to replace the link\n // Otherwise, use the original link\n if (\n typeof this.linkValues === 'object' ||\n typeof this.variableValues === 'object'\n ) {\n href = this.linkValues.get(href) || this.variableValues.get(href) || href;\n }\n\n return (\n <Link\n href={href}\n rel={rel}\n style={{\n fontWeight: 500,\n textDecoration: 'underline',\n color: this.config.theme?.colors?.heading,\n }}\n target={target}\n >\n {text}\n </Link>\n );\n }\n\n private heading(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n\n const level = `h${Number(attrs?.level) || 1}`;\n const alignment = attrs?.textAlign || 'left';\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n const { fontSize, lineHeight, fontWeight } =\n headings[level as AllowedHeadings];\n\n return (\n <Heading\n // @ts-expect-error - `this` is not assignable to type 'never'\n as={level}\n style={{\n textAlign: alignment,\n color: this.config.theme?.colors?.heading,\n marginBottom: shouldRemoveBottomMargin ? '0' : '12px',\n marginTop: 0,\n fontSize,\n lineHeight,\n fontWeight,\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Heading>\n );\n }\n\n private variable(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { payloadValue } = options || {};\n const { id: variable, fallback } = node.attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow || !variable) {\n return <></>;\n }\n\n let formattedVariable = this.variableFormatter({\n variable,\n fallback,\n });\n\n // If `shouldReplaceVariableValues` is true, replace the variable values\n // Otherwise, just return the formatted variable\n if (this.shouldReplaceVariableValues) {\n formattedVariable =\n (typeof payloadValue === 'object'\n ? payloadValue[variable]\n : payloadValue) ??\n this.variableValues.get(variable) ??\n fallback ??\n formattedVariable;\n }\n\n if (node?.marks) {\n return this.renderMark({\n text: formattedVariable,\n marks: node.marks,\n });\n }\n\n return <>{formattedVariable}</>;\n }\n\n private horizontalRule(_: JSONContent, __?: NodeOptions): JSX.Element {\n return (\n <Hr\n style={{\n marginTop: '32px',\n marginBottom: '32px',\n }}\n />\n );\n }\n\n private orderedList(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n return (\n <Container>\n <ol\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0' : '20px',\n paddingLeft: '26px',\n listStyleType: 'decimal',\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </ol>\n </Container>\n );\n }\n\n private bulletList(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { parent, next } = options || {};\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n {\n parent,\n next,\n }\n );\n\n return (\n <Container\n style={{\n maxWidth: '100%',\n }}\n >\n <ul\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0' : '20px',\n paddingLeft: '26px',\n listStyleType: 'disc',\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </ul>\n </Container>\n );\n }\n\n private listItem(node: JSONContent, options?: NodeOptions): JSX.Element {\n return (\n <li\n style={{\n marginBottom: '8px',\n paddingLeft: '6px',\n ...antialiased,\n }}\n >\n {this.getMappedContent(node, { ...options, parent: node })}\n </li>\n );\n }\n\n private button(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n text,\n url,\n variant,\n buttonColor,\n textColor,\n borderRadius,\n // @TODO: Update the attribute to `textAlign`\n alignment = 'left',\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n let radius: string | undefined = '0px';\n if (borderRadius === 'round') {\n radius = '9999px';\n } else if (borderRadius === 'smooth') {\n radius = '6px';\n }\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n const href =\n this.linkValues.get(url) || this.variableValues.get(url) || url;\n\n return (\n <Container\n style={{\n textAlign: alignment,\n maxWidth: '100%',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n }}\n >\n <Button\n href={href}\n style={{\n color: String(textColor),\n backgroundColor:\n variant === 'filled' ? String(buttonColor) : 'transparent',\n borderColor: String(buttonColor),\n padding: variant === 'filled' ? '12px 34px' : '10px 34px',\n borderWidth: '2px',\n borderStyle: 'solid',\n textDecoration: 'none',\n fontSize: '14px',\n fontWeight: 500,\n borderRadius: radius,\n }}\n >\n {text}\n </Button>\n </Container>\n );\n }\n\n private spacer(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { height = 'auto' } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n return (\n <Container\n style={{\n height: spacers[height as AllowedSpacers] || height,\n }}\n />\n );\n }\n\n private hardBreak(_: JSONContent, __?: NodeOptions): JSX.Element {\n return <br />;\n }\n\n private logo(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n src,\n alt,\n title,\n size,\n // @TODO: Update the attribute to `textAlign`\n alignment = 'left',\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n return (\n <Row\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '32px',\n }}\n >\n <Column align={alignment}>\n <Img\n alt={alt || title || 'Logo'}\n src={src}\n style={{\n width: logoSizes[size as AllowedLogoSizes] || size,\n height: logoSizes[size as AllowedLogoSizes] || size,\n }}\n title={title || alt || 'Logo'}\n />\n </Column>\n </Row>\n );\n }\n\n private image(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n src,\n alt,\n title,\n width = 'auto',\n alignment = 'center',\n externalLink = '',\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n // Handle width value\n const imageWidth = width === 'auto' ? 'auto' : Number(width);\n const widthStyle = imageWidth === 'auto' ? 'auto' : `${imageWidth}px`;\n\n const mainImage = (\n <Img\n alt={alt || title || 'Image'}\n src={src}\n style={{\n width: widthStyle, // Use the calculated width\n maxWidth: '100%', // Ensure image doesn't overflow container\n outline: 'none',\n border: 'none',\n textDecoration: 'none',\n display: 'block', // Prevent unwanted spacing\n }}\n title={title || alt || 'Image'}\n />\n );\n\n return (\n <Row\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '32px',\n }}\n >\n <Column align={alignment}>\n {externalLink ? (\n <a\n href={externalLink}\n rel=\"noopener noreferrer\"\n style={{\n display: 'block',\n maxWidth: '100%',\n textDecoration: 'none',\n }}\n target=\"_blank\"\n >\n {mainImage}\n </a>\n ) : (\n mainImage\n )}\n </Column>\n </Row>\n );\n }\n\n private footer(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { textAlign = 'left' } = attrs || {};\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n return (\n <Text\n style={{\n fontSize: this.config.theme?.fontSize?.footer?.size,\n lineHeight: this.config.theme?.fontSize?.footer?.lineHeight,\n color: this.config.theme?.colors?.footer,\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n textAlign,\n ...antialiased,\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Text>\n );\n }\n\n private blockquote(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { isPrevSpacer, shouldRemoveBottomMargin } =\n this.getMarginOverrideConditions(node, options);\n\n return (\n <blockquote\n style={{\n borderLeftWidth: '4px',\n borderLeftStyle: 'solid',\n borderLeftColor: this.config.theme?.colors?.blockquoteBorder,\n paddingLeft: '16px',\n marginLeft: '0px',\n marginRight: '0px',\n marginTop: isPrevSpacer ? '0px' : '20px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </blockquote>\n );\n }\n private code(_: MarkType, text: JSX.Element): JSX.Element {\n return (\n <code\n style={{\n backgroundColor: this.config.theme?.colors?.codeBackground,\n color: this.config.theme?.colors?.codeText,\n padding: '2px 4px',\n borderRadius: '6px',\n fontFamily: CODE_FONT_FAMILY,\n fontWeight: 400,\n letterSpacing: 0,\n }}\n >\n {text}\n </code>\n );\n }\n private linkCard(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n const { title, description, link, linkTitle, image, badgeText, subTitle } =\n attrs || {};\n const href =\n this.linkValues.get(link) || this.variableValues.get(link) || link || '#';\n\n return (\n <a\n href={href}\n rel=\"noopener noreferrer\"\n style={{\n border: '1px solid #eaeaea',\n borderRadius: '10px',\n textDecoration: 'none',\n color: 'inherit',\n display: 'block',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n }}\n target=\"_blank\"\n >\n {image ? (\n <Row\n style={{\n marginBottom: '6px',\n }}\n >\n <Column\n style={{\n width: '100%',\n height: '100%',\n }}\n >\n <Img\n alt={title || 'Link Card'}\n src={image}\n style={{\n borderRadius: '10px 10px 0 0',\n width: '100%',\n height: '100%',\n objectFit: 'cover',\n }}\n title={title || 'Link Card'}\n />\n </Column>\n </Row>\n ) : null}\n\n <Row\n style={{\n padding: '15px',\n marginTop: 0,\n marginBottom: 0,\n }}\n >\n <Column\n style={{\n verticalAlign: 'top',\n }}\n >\n <Row\n align={undefined}\n style={{\n marginBottom: '8px',\n marginTop: '0px',\n }}\n width=\"auto\"\n >\n <Column>\n <Text\n style={{\n fontSize: '18px',\n fontWeight: 600,\n color: this.config.theme?.colors?.linkCardTitle,\n margin: '0px',\n ...antialiased,\n }}\n >\n {title}\n </Text>\n </Column>\n {badgeText || subTitle ? (\n <Column\n style={{\n paddingLeft: '6px',\n verticalAlign: 'middle',\n }}\n >\n {badgeText ? (\n <span\n style={{\n fontWeight: 600,\n color: this.config.theme?.colors?.linkCardBadgeText,\n padding: '4px 8px',\n borderRadius: '8px',\n backgroundColor:\n this.config.theme?.colors?.linkCardBadgeBackground,\n fontSize: '12px',\n lineHeight: '12px',\n }}\n >\n {badgeText}\n </span>\n ) : null}{' '}\n {subTitle && !badgeText ? (\n <span\n style={{\n fontWeight: 'normal',\n color: this.config.theme?.colors?.linkCardSubTitle,\n fontSize: '12px',\n lineHeight: '12px',\n }}\n >\n {subTitle}\n </span>\n ) : null}\n </Column>\n ) : null}\n </Row>\n <Text\n style={{\n fontSize: '16px',\n color: this.config.theme?.colors?.linkCardDescription,\n marginTop: '0px',\n marginBottom: '0px',\n ...antialiased,\n }}\n >\n {description}{' '}\n {linkTitle ? (\n <a\n href={href}\n rel=\"noopener noreferrer\"\n style={{\n color: this.config.theme?.colors?.linkCardTitle,\n fontSize: '14px',\n fontWeight: 600,\n textDecoration: 'underline',\n }}\n >\n {linkTitle}\n </a>\n ) : null}\n </Text>\n </Column>\n </Row>\n </a>\n );\n }\n\n private section(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n borderRadius = 0,\n backgroundColor = DEFAULT_SECTION_BACKGROUND_COLOR,\n align = DEFAULT_SECTION_ALIGN,\n borderWidth = DEFAULT_SECTION_BORDER_WIDTH,\n borderColor = DEFAULT_SECTION_BORDER_COLOR,\n\n marginTop = DEFAULT_SECTION_MARGIN_TOP,\n marginRight = DEFAULT_SECTION_MARGIN_RIGHT,\n marginBottom = DEFAULT_SECTION_MARGIN_BOTTOM,\n marginLeft = DEFAULT_SECTION_MARGIN_LEFT,\n\n paddingTop = DEFAULT_SECTION_PADDING_TOP,\n paddingRight = DEFAULT_SECTION_PADDING_RIGHT,\n paddingBottom = DEFAULT_SECTION_PADDING_BOTTOM,\n paddingLeft = DEFAULT_SECTION_PADDING_LEFT,\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n return (\n <Row\n style={{\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n }}\n >\n <Column\n align={align}\n style={{\n borderColor,\n borderWidth,\n borderStyle: 'solid',\n backgroundColor,\n borderRadius,\n\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Column>\n </Row>\n );\n }\n\n private columns(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n const [newNode, totalWidth] = this.adjustColumnsContent(node);\n\n return (\n <Row\n width={`${totalWidth}%`}\n style={{\n margin: 0,\n padding: 0,\n width: `${totalWidth}%`,\n }}\n className=\"tab-row-full\"\n >\n {this.getMappedContent(newNode, {\n ...options,\n parent: newNode,\n })}\n </Row>\n );\n }\n\n private adjustColumnsContent(node: JSONContent): [JSONContent, number] {\n const { content = [] } = node;\n const totalWidth = 100;\n const columnsWithWidth = content.filter(\n (c) => c.type === 'column' && Boolean(Number(c.attrs?.width || 0))\n );\n const autoWidthColumns = content.filter(\n (c) =>\n c.type === 'column' && (c.attrs?.width === 'auto' || !c.attrs?.width)\n );\n\n const totalWidthUsed = columnsWithWidth.reduce(\n (acc, c) => acc + Number(c.attrs?.width),\n 0\n );\n\n const remainingWidth = totalWidth - totalWidthUsed;\n const measuredWidth = remainingWidth / autoWidthColumns.length;\n\n const gap = node.attrs?.gap || DEFAULT_COLUMNS_GAP;\n\n return [\n {\n ...node,\n content: content.map((c, index) => {\n const isAutoWidthColumn =\n c.type === 'column' &&\n (c.attrs?.width === 'auto' || !c.attrs?.width);\n const isFirstColumn = index === 0;\n const isLastColumn = index === content.length - 1;\n\n return {\n ...c,\n attrs: {\n ...c.attrs,\n width: isAutoWidthColumn ? measuredWidth : c.attrs?.width,\n\n isFirstColumn,\n isLastColumn,\n index,\n\n paddingLeft: isFirstColumn ? 0 : gap / 2,\n paddingRight: isLastColumn ? 0 : gap / 2,\n },\n };\n }),\n },\n autoWidthColumns.length === 0\n ? Math.min(totalWidth, totalWidthUsed)\n : totalWidth,\n ];\n }\n\n private column(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n width,\n verticalAlign = 'top',\n paddingLeft = 0,\n paddingRight = 0,\n } = attrs || {};\n\n return (\n <Column\n width={`${Number(width)}%`}\n style={{\n width: `${Number(width)}%`,\n margin: 0,\n verticalAlign,\n }}\n className=\"tab-col-full\"\n >\n <Section\n style={{\n margin: 0,\n paddingLeft,\n paddingRight,\n }}\n className=\"tab-pad\"\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Section>\n </Column>\n );\n }\n\n private for(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { each = '' } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n let { payloadValue } = options || {};\n payloadValue = typeof payloadValue === 'object' ? payloadValue : {};\n\n const values = this.payloadValues.get(each) ?? payloadValue[each] ?? [];\n if (!Array.isArray(values)) {\n throw new Error(`Payload value for each \"${each}\" is not an array`);\n }\n\n return (\n <>\n {values.map((value) => {\n return (\n <Fragment key={generateKey()}>\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n payloadValue: value,\n })}\n </Fragment>\n );\n })}\n </>\n );\n }\n\n private shouldShow(node: JSONContent, options?: NodeOptions): boolean {\n const showIfKey = node?.attrs?.showIfKey ?? '';\n if (!showIfKey) {\n return true;\n }\n\n let { payloadValue } = options || {};\n payloadValue = typeof payloadValue === 'object' ? payloadValue : {};\n return !!(this.payloadValues.get(showIfKey) ?? payloadValue[showIfKey]);\n }\n}\n","function clamp(n, min, max) {\n return Math.min(max, Math.max(min, n));\n}\nfunction sum(...args) {\n return flattenArrayable(args).reduce((a, b) => a + b, 0);\n}\nfunction lerp(min, max, t) {\n const interpolation = clamp(t, 0, 1);\n return min + (max - min) * interpolation;\n}\nfunction remap(n, inMin, inMax, outMin, outMax) {\n const interpolation = (n - inMin) / (inMax - inMin);\n return lerp(outMin, outMax, interpolation);\n}\n\nfunction toArray(array) {\n array = array ?? [];\n return Array.isArray(array) ? array : [array];\n}\nfunction flattenArrayable(array) {\n return toArray(array).flat(1);\n}\nfunction mergeArrayable(...args) {\n return args.flatMap((i) => toArray(i));\n}\nfunction partition(array, ...filters) {\n const result = Array.from({ length: filters.length + 1 }).fill(null).map(() => []);\n array.forEach((e, idx, arr) => {\n let i = 0;\n for (const filter of filters) {\n if (filter(e, idx, arr)) {\n result[i].push(e);\n return;\n }\n i += 1;\n }\n result[i].push(e);\n });\n return result;\n}\nfunction uniq(array) {\n return Array.from(new Set(array));\n}\nfunction uniqueBy(array, equalFn) {\n return array.reduce((acc, cur) => {\n const index = acc.findIndex((item) => equalFn(cur, item));\n if (index === -1)\n acc.push(cur);\n return acc;\n }, []);\n}\nfunction last(array) {\n return at(array, -1);\n}\nfunction remove(array, value) {\n if (!array)\n return false;\n const index = array.indexOf(value);\n if (index >= 0) {\n array.splice(index, 1);\n return true;\n }\n return false;\n}\nfunction at(array, index) {\n const len = array.length;\n if (!len)\n return void 0;\n if (index < 0)\n index += len;\n return array[index];\n}\nfunction range(...args) {\n let start, stop, step;\n if (args.length === 1) {\n start = 0;\n step = 1;\n [stop] = args;\n } else {\n [start, stop, step = 1] = args;\n }\n const arr = [];\n let current = start;\n while (current < stop) {\n arr.push(current);\n current += step || 1;\n }\n return arr;\n}\nfunction move(arr, from, to) {\n arr.splice(to, 0, arr.splice(from, 1)[0]);\n return arr;\n}\nfunction clampArrayRange(n, arr) {\n return clamp(n, 0, arr.length - 1);\n}\nfunction sample(arr, quantity) {\n return Array.from({ length: quantity }, (_) => arr[Math.round(Math.random() * (arr.length - 1))]);\n}\nfunction shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [array[i], array[j]] = [array[j], array[i]];\n }\n return array;\n}\n\nfunction assert(condition, message) {\n if (!condition)\n throw new Error(message);\n}\nconst toString = (v) => Object.prototype.toString.call(v);\nfunction getTypeName(v) {\n if (v === null)\n return \"null\";\n const type = toString(v).slice(8, -1).toLowerCase();\n return typeof v === \"object\" || typeof v === \"function\" ? type : typeof v;\n}\nfunction noop() {\n}\n\nfunction isDeepEqual(value1, value2) {\n const type1 = getTypeName(value1);\n const type2 = getTypeName(value2);\n if (type1 !== type2)\n return false;\n if (type1 === \"array\") {\n if (value1.length !== value2.length)\n return false;\n return value1.every((item, i) => {\n return isDeepEqual(item, value2[i]);\n });\n }\n if (type1 === \"object\") {\n const keyArr = Object.keys(value1);\n if (keyArr.length !== Object.keys(value2).length)\n return false;\n return keyArr.every((key) => {\n return isDeepEqual(value1[key], value2[key]);\n });\n }\n return Object.is(value1, value2);\n}\n\nfunction notNullish(v) {\n return v != null;\n}\nfunction noNull(v) {\n return v !== null;\n}\nfunction notUndefined(v) {\n return v !== void 0;\n}\nfunction isTruthy(v) {\n return Boolean(v);\n}\n\nconst isDef = (val) => typeof val !== \"undefined\";\nconst isBoolean = (val) => typeof val === \"boolean\";\nconst isFunction = (val) => typeof val === \"function\";\nconst isNumber = (val) => typeof val === \"number\";\nconst isString = (val) => typeof val === \"string\";\nconst isObject = (val) => toString(val) === \"[object Object]\";\nconst isUndefined = (val) => toString(val) === \"[object Undefined]\";\nconst isNull = (val) => toString(val) === \"[object Null]\";\nconst isRegExp = (val) => toString(val) === \"[object RegExp]\";\nconst isDate = (val) => toString(val) === \"[object Date]\";\nconst isWindow = (val) => typeof window !== \"undefined\" && toString(val) === \"[object Window]\";\nconst isBrowser = typeof window !== \"undefined\";\n\nfunction slash(str) {\n return str.replace(/\\\\/g, \"/\");\n}\nfunction ensurePrefix(prefix, str) {\n if (!str.startsWith(prefix))\n return prefix + str;\n return str;\n}\nfunction ensureSuffix(suffix, str) {\n if (!str.endsWith(suffix))\n return str + suffix;\n return str;\n}\nfunction template(str, ...args) {\n const [firstArg, fallback] = args;\n if (isObject(firstArg)) {\n const vars = firstArg;\n return str.replace(/{([\\w\\d]+)}/g, (_, key) => vars[key] || ((typeof fallback === \"function\" ? fallback(key) : fallback) ?? key));\n } else {\n return str.replace(/{(\\d+)}/g, (_, key) => {\n const index = Number(key);\n if (Number.isNaN(index))\n return key;\n return args[index];\n });\n }\n}\nconst urlAlphabet = \"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict\";\nfunction randomStr(size = 16, dict = urlAlphabet) {\n let id = \"\";\n let i = size;\n const len = dict.length;\n while (i--)\n id += dict[Math.random() * len | 0];\n return id;\n}\nfunction capitalize(str) {\n return str[0].toUpperCase() + str.slice(1).toLowerCase();\n}\nconst _reFullWs = /^\\s*$/;\nfunction unindent(str) {\n const lines = (typeof str === \"string\" ? str : str[0]).split(\"\\n\");\n const whitespaceLines = lines.map((line) => _reFullWs.test(line));\n const commonIndent = lines.reduce((min, line, idx) => {\n var _a;\n if (whitespaceLines[idx])\n return min;\n const indent = (_a = line.match(/^\\s*/)) == null ? void 0 : _a[0].length;\n return indent === void 0 ? min : Math.min(min, indent);\n }, Number.POSITIVE_INFINITY);\n let emptyLinesHead = 0;\n while (emptyLinesHead < lines.length && whitespaceLines[emptyLinesHead])\n emptyLinesHead++;\n let emptyLinesTail = 0;\n while (emptyLinesTail < lines.length && whitespaceLines[lines.length - emptyLinesTail - 1])\n emptyLinesTail++;\n return lines.slice(emptyLinesHead, lines.length - emptyLinesTail).map((line) => line.slice(commonIndent)).join(\"\\n\");\n}\n\nconst timestamp = () => +Date.now();\n\nfunction batchInvoke(functions) {\n functions.forEach((fn) => fn && fn());\n}\nfunction invoke(fn) {\n return fn();\n}\nfunction tap(value, callback) {\n callback(value);\n return value;\n}\n\nfunction objectMap(obj, fn) {\n return Object.fromEntries(\n Object.entries(obj).map(([k, v]) => fn(k, v)).filter(notNullish)\n );\n}\nfunction isKeyOf(obj, k) {\n return k in obj;\n}\nfunction objectKeys(obj) {\n return Object.keys(obj);\n}\nfunction objectEntries(obj) {\n return Object.entries(obj);\n}\nfunction deepMerge(target, ...sources) {\n if (!sources.length)\n return target;\n const source = sources.shift();\n if (source === void 0)\n return target;\n if (isMergableObject(target) && isMergableObject(source)) {\n objectKeys(source).forEach((key) => {\n if (key === \"__proto__\" || key === \"constructor\" || key === \"prototype\")\n return;\n if (isMergableObject(source[key])) {\n if (!target[key])\n target[key] = {};\n if (isMergableObject(target[key])) {\n deepMerge(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n } else {\n target[key] = source[key];\n }\n });\n }\n return deepMerge(target, ...sources);\n}\nfunction deepMergeWithArray(target, ...sources) {\n if (!sources.length)\n return target;\n const source = sources.shift();\n if (source === void 0)\n return target;\n if (Array.isArray(target) && Array.isArray(source))\n target.push(...source);\n if (isMergableObject(target) && isMergableObject(source)) {\n objectKeys(source).forEach((key) => {\n if (key === \"__proto__\" || key === \"constructor\" || key === \"prototype\")\n return;\n if (Array.isArray(source[key])) {\n if (!target[key])\n target[key] = [];\n deepMergeWithArray(target[key], source[key]);\n } else if (isMergableObject(source[key])) {\n if (!target[key])\n target[key] = {};\n deepMergeWithArray(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n });\n }\n return deepMergeWithArray(target, ...sources);\n}\nfunction isMergableObject(item) {\n return isObject(item) && !Array.isArray(item);\n}\nfunction objectPick(obj, keys, omitUndefined = false) {\n return keys.reduce((n, k) => {\n if (k in obj) {\n if (!omitUndefined || obj[k] !== void 0)\n n[k] = obj[k];\n }\n return n;\n }, {});\n}\nfunction clearUndefined(obj) {\n Object.keys(obj).forEach((key) => obj[key] === void 0 ? delete obj[key] : {});\n return obj;\n}\nfunction hasOwnProperty(obj, v) {\n if (obj == null)\n return false;\n return Object.prototype.hasOwnProperty.call(obj, v);\n}\n\nfunction createSingletonPromise(fn) {\n let _promise;\n function wrapper() {\n if (!_promise)\n _promise = fn();\n return _promise;\n }\n wrapper.reset = async () => {\n const _prev = _promise;\n _promise = void 0;\n if (_prev)\n await _prev;\n };\n return wrapper;\n}\nfunction sleep(ms, callback) {\n return new Promise(\n (resolve) => setTimeout(async () => {\n await (callback == null ? void 0 : callback());\n resolve();\n }, ms)\n );\n}\nfunction createPromiseLock() {\n const locks = [];\n return {\n async run(fn) {\n const p = fn();\n locks.push(p);\n try {\n return await p;\n } finally {\n remove(locks, p);\n }\n },\n async wait() {\n await Promise.allSettled(locks);\n },\n isWaiting() {\n return Boolean(locks.length);\n },\n clear() {\n locks.length = 0;\n }\n };\n}\nfunction createControlledPromise() {\n let resolve, reject;\n const promise = new Promise((_resolve, _reject) => {\n resolve = _resolve;\n reject = _reject;\n });\n promise.resolve = resolve;\n promise.reject = reject;\n return promise;\n}\n\n/* eslint-disable no-undefined,no-param-reassign,no-shadow */\n\n/**\n * Throttle execution of a function. Especially useful for rate limiting\n * execution of handlers on events like resize and scroll.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)\n * are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,\n * as-is, to `callback` when the throttled-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds\n * while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed\n * one final time after the last throttled-function call. (After the throttled-function has not been called for\n * `delay` milliseconds, the internal counter is reset).\n * @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback\n * immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that\n * callback will never executed if both noLeading = true and noTrailing = true.\n * @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is\n * false (at end), schedule `callback` to execute after `delay` ms.\n *\n * @returns {Function} A new, throttled, function.\n */\nfunction throttle (delay, callback, options) {\n var _ref = options || {},\n _ref$noTrailing = _ref.noTrailing,\n noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,\n _ref$noLeading = _ref.noLeading,\n noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,\n _ref$debounceMode = _ref.debounceMode,\n debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;\n /*\n * After wrapper has stopped being called, this timeout ensures that\n * `callback` is executed at the proper times in `throttle` and `end`\n * debounce modes.\n */\n\n\n var timeoutID;\n var cancelled = false; // Keep track of the last time `callback` was executed.\n\n var lastExec = 0; // Function to clear existing timeout\n\n function clearExistingTimeout() {\n if (timeoutID) {\n clearTimeout(timeoutID);\n }\n } // Function to cancel next exec\n\n\n function cancel(options) {\n var _ref2 = options || {},\n _ref2$upcomingOnly = _ref2.upcomingOnly,\n upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;\n\n clearExistingTimeout();\n cancelled = !upcomingOnly;\n }\n /*\n * The `wrapper` function encapsulates all of the throttling / debouncing\n * functionality and when executed will limit the rate at which `callback`\n * is executed.\n */\n\n\n function wrapper() {\n for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {\n arguments_[_key] = arguments[_key];\n }\n\n var self = this;\n var elapsed = Date.now() - lastExec;\n\n if (cancelled) {\n return;\n } // Execute `callback` and update the `lastExec` timestamp.\n\n\n function exec() {\n lastExec = Date.now();\n callback.apply(self, arguments_);\n }\n /*\n * If `debounceMode` is true (at begin) this is used to clear the flag\n * to allow future `callback` executions.\n */\n\n\n function clear() {\n timeoutID = undefined;\n }\n\n if (!noLeading && debounceMode && !timeoutID) {\n /*\n * Since `wrapper` is being called for the first time and\n * `debounceMode` is true (at begin), execute `callback`\n * and noLeading != true.\n */\n exec();\n }\n\n clearExistingTimeout();\n\n if (debounceMode === undefined && elapsed > delay) {\n if (noLeading) {\n /*\n * In throttle mode with noLeading, if `delay` time has\n * been exceeded, update `lastExec` and schedule `callback`\n * to execute after `delay` ms.\n */\n lastExec = Date.now();\n\n if (!noTrailing) {\n timeoutID = setTimeout(debounceMode ? clear : exec, delay);\n }\n } else {\n /*\n * In throttle mode without noLeading, if `delay` time has been exceeded, execute\n * `callback`.\n */\n exec();\n }\n } else if (noTrailing !== true) {\n /*\n * In trailing throttle mode, since `delay` time has not been\n * exceeded, schedule `callback` to execute `delay` ms after most\n * recent execution.\n *\n * If `debounceMode` is true (at begin), schedule `clear` to execute\n * after `delay` ms.\n *\n * If `debounceMode` is false (at end), schedule `callback` to\n * execute after `delay` ms.\n */\n timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);\n }\n }\n\n wrapper.cancel = cancel; // Return the wrapper function.\n\n return wrapper;\n}\n\n/* eslint-disable no-undefined */\n/**\n * Debounce execution of a function. Debouncing, unlike throttling,\n * guarantees that a function is only executed a single time, either at the\n * very beginning of a series of calls, or at the very end.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n * to `callback` when the debounced-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds\n * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.\n * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).\n *\n * @returns {Function} A new, debounced function.\n */\n\nfunction debounce (delay, callback, options) {\n var _ref = options || {},\n _ref$atBegin = _ref.atBegin,\n atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin;\n\n return throttle(delay, callback, {\n debounceMode: atBegin !== false\n });\n}\n\n/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nclass Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n}\n\nconst AsyncResource = {\n\tbind(fn, _type, thisArg) {\n\t\treturn fn.bind(thisArg);\n\t},\n};\n\nfunction pLimit(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst next = () => {\n\t\tactiveCount--;\n\n\t\tif (queue.size > 0) {\n\t\t\tqueue.dequeue()();\n\t\t}\n\t};\n\n\tconst run = async (function_, resolve, arguments_) => {\n\t\tactiveCount++;\n\n\t\tconst result = (async () => function_(...arguments_))();\n\n\t\tresolve(result);\n\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\tnext();\n\t};\n\n\tconst enqueue = (function_, resolve, arguments_) => {\n\t\tqueue.enqueue(\n\t\t\tAsyncResource.bind(run.bind(undefined, function_, resolve, arguments_)),\n\t\t);\n\n\t\t(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// when the run function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve();\n\n\t\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\t\tqueue.dequeue()();\n\t\t\t}\n\t\t})();\n\t};\n\n\tconst generator = (function_, ...arguments_) => new Promise(resolve => {\n\t\tenqueue(function_, resolve, arguments_);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue() {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n\nconst VOID = Symbol(\"p-void\");\nclass PInstance extends Promise {\n constructor(items = [], options) {\n super(() => {\n });\n this.items = items;\n this.options = options;\n this.promises = /* @__PURE__ */ new Set();\n }\n get promise() {\n var _a;\n let batch;\n const items = [...Array.from(this.items), ...Array.from(this.promises)];\n if ((_a = this.options) == null ? void 0 : _a.concurrency) {\n const limit = pLimit(this.options.concurrency);\n batch = Promise.all(items.map((p2) => limit(() => p2)));\n } else {\n batch = Promise.all(items);\n }\n return batch.then((l) => l.filter((i) => i !== VOID));\n }\n add(...args) {\n args.forEach((i) => {\n this.promises.add(i);\n });\n }\n map(fn) {\n return new PInstance(\n Array.from(this.items).map(async (i, idx) => {\n const v = await i;\n if (v === VOID)\n return VOID;\n return fn(v, idx);\n }),\n this.options\n );\n }\n filter(fn) {\n return new PInstance(\n Array.from(this.items).map(async (i, idx) => {\n const v = await i;\n const r = await fn(v, idx);\n if (!r)\n return VOID;\n return v;\n }),\n this.options\n );\n }\n forEach(fn) {\n return this.map(fn).then();\n }\n reduce(fn, initialValue) {\n return this.promise.then((array) => array.reduce(fn, initialValue));\n }\n clear() {\n this.promises.clear();\n }\n then(fn) {\n const p2 = this.promise;\n if (fn)\n return p2.then(fn);\n else\n return p2;\n }\n catch(fn) {\n return this.promise.catch(fn);\n }\n finally(fn) {\n return this.promise.finally(fn);\n }\n}\nfunction p(items, options) {\n return new PInstance(items, options);\n}\n\nexport { assert, at, batchInvoke, capitalize, clamp, clampArrayRange, clearUndefined, createControlledPromise, createPromiseLock, createSingletonPromise, debounce, deepMerge, deepMergeWithArray, ensurePrefix, ensureSuffix, flattenArrayable, getTypeName, hasOwnProperty, invoke, isBoolean, isBrowser, isDate, isDeepEqual, isDef, isFunction, isKeyOf, isNull, isNumber, isObject, isRegExp, isString, isTruthy, isUndefined, isWindow, last, lerp, mergeArrayable, move, noNull, noop, notNullish, notUndefined, objectEntries, objectKeys, objectMap, objectPick, p, partition, randomStr, range, remap, remove, sample, shuffle, slash, sleep, sum, tap, template, throttle, timestamp, toArray, toString, unindent, uniq, uniqueBy };\n","export function generateKey() {\n // Length of 6 is enough to avoid collisions\n // for react keys\n return Math.random().toString(36).substr(2, 6);\n}\n","import type { JSONContent } from '@tiptap/core';\nimport { Maily } from './maily';\nimport type { MailyConfig, RenderOptions } from './maily';\n\nexport async function render(\n content: JSONContent,\n config?: MailyConfig & RenderOptions\n): Promise<string> {\n const { theme, preview, ...rest } = config || {};\n\n const maily = new Maily(content);\n maily.setPreviewText(preview);\n maily.setTheme(theme || {});\n\n maily.setPayloadValue('items', [\n {\n name: 'John Doe',\n },\n {\n name: 'Novu',\n },\n ]);\n\n maily.setPayloadValue('shouldShow', true);\n\n return ma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iB,SAAWA,EAAe,CAAC,EAC3D,CAAC,GAAEjB,EAAA,KAAK,cAAc,IAAIiF,CAAS,IAAhC,KAAAjF,EAAqCiB,EAAagE,CAAS,EACvE,CACF,EGx+CA,SAAsBC,GACpBC,EACAC,EACiB,QAAAC,EAAA,sBACjB,IAAoCC,EAAAF,GAAU,CAAC,EAAvC,OAAAG,EAAO,QAAAC,CARjB,EAQsCF,EAATG,EAAAC,EAASJ,EAAT,CAAnB,QAAO,YAETK,EAAQ,IAAIC,EAAMT,CAAO,EAC/B,OAAAQ,EAAM,eAAeH,CAAO,EAC5BG,EAAM,SAASJ,GAAS,CAAC,CAAC,EAE1BI,EAAM,gBAAgB,QAAS,CAC7B,CACE,KAAM,UACR,EACA,CACE,KAAM,MACR,CACF,CAAC,EAEDA,EAAM,gBAAgB,aAAc,EAAI,EAEjCA,EAAM,OAAOF,CAAI,CAC1B","names":["Fragment","Text","Html","Head","Body","Font","Container","Link","Heading","Hr","Button","Img","Preview","Row","Column","Section","reactEmailRenderAsync","toString","v","isObject","val","toString","objectKeys","obj","deepMerge","target","sources","source","isMergableObject","objectKeys","key","isMergableObject","item","isObject","VOID","generateKey","Fragment","jsx","jsxs","spacers","antialiased","headings","logoSizes","DEFAULT_RENDER_OPTIONS","DEFAULT_THEME","CODE_FONT_FAMILY","DEFAULT_SECTION_BACKGROUND_COLOR","DEFAULT_SECTION_ALIGN","DEFAULT_SECTION_BORDER_WIDTH","DEFAULT_SECTION_BORDER_COLOR","DEFAULT_SECTION_MARGIN_TOP","DEFAULT_SECTION_MARGIN_RIGHT","DEFAULT_SECTION_MARGIN_BOTTOM","DEFAULT_SECTION_MARGIN_LEFT","DEFAULT_SECTION_PADDING_TOP","DEFAULT_SECTION_PADDING_RIGHT","DEFAULT_SECTION_PADDING_BOTTOM","DEFAULT_SECTION_PADDING_LEFT","DEFAULT_COLUMNS_WIDTH","DEFAULT_COLUMNS_GAP","DEFAULT_COLUMN_BACKGROUND_COLOR","DEFAULT_COLUMN_BORDER_RADIUS","DEFAULT_COLUMN_BORDER_WIDTH","DEFAULT_COLUMN_BORDER_COLOR","DEFAULT_COLUMN_PADDING_TOP","DEFAULT_COLUMN_PADDING_RIGHT","DEFAULT_COLUMN_PADDING_BOTTOM","DEFAULT_COLUMN_PADDING_LEFT","Maily","content","variable","fallback","preview","theme","deepMerge","formatter","value","values","link","key","pixel","shouldReplace","nodes","links","isValidLink","href","extractLinksFromNode","node","_a","originalLink","childNode","mark","_","err","__async","options","markup","reactEmailRenderAsync","jsxNodes","index","nodeOptions","component","jsx","Fragment","generateKey","jsxs","Html","Head","Font","Body","Preview","Container","Img","parent","prev","next","isNextSpacer","isPrevSpacer","isParentListItem","isLastSectionElement","isFirstSectionElement","isLastColumnElement","isFirstColumnElement","isFirstForElement","isLastForElement","isFirstShowElement","isLastShowElement","allNodes","__spreadProps","__spreadValues","n","type","text","acc","_b","_c","_d","attrs","alignment","shouldRemoveBottomMargin","Text","antialiased","color","target","rel","Link","level","fontSize","lineHeight","fontWeight","headings","Heading","payloadValue","formattedVariable","__","Hr","url","variant","buttonColor","textColor","borderRadius","radius","Button","height","spacers","src","alt","title","size","Row","Column","width","externalLink","imageWidth","widthStyle","mainImage","_e","_f","_g","_h","textAlign","_i","_j","_k","_l","description","linkTitle","image","badgeText","subTitle","backgroundColor","align","borderWidth","borderColor","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","newNode","totalWidth","columnsWithWidth","c","autoWidthColumns","totalWidthUsed","measuredWidth","gap","isAutoWidthColumn","isFirstColumn","isLastColumn","verticalAlign","Section","each","showIfKey","render","content","config","__async","_a","theme","preview","rest","__objRest","maily","Maily"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maily-to/render",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "private": false,
5
5
  "description": "A transformer that converts Maily content into HTML email templates.",
6
6
  "sideEffects": false,