@maily-to/render 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var R=Object.defineProperty,yt=Object.defineProperties,xt=Object.getOwnPropertyDescriptor,St=Object.getOwnPropertyDescriptors,bt=Object.getOwnPropertyNames,k=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var U=(a,t,e)=>t in a?R(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,f=(a,t)=>{for(var e in t||(t={}))F.call(t,e)&&U(a,e,t[e]);if(k)for(var e of k(t))W.call(t,e)&&U(a,e,t[e]);return a},b=(a,t)=>yt(a,St(t));var P=(a,t)=>{var e={};for(var n in a)F.call(a,n)&&t.indexOf(n)<0&&(e[n]=a[n]);if(a!=null&&k)for(var n of k(a))t.indexOf(n)<0&&W.call(a,n)&&(e[n]=a[n]);return e};var Ot=(a,t)=>{for(var e in t)R(a,e,{get:t[e],enumerable:!0})},wt=(a,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of bt(t))!F.call(a,r)&&r!==e&&R(a,r,{get:()=>t[r],enumerable:!(n=xt(t,r))||n.enumerable});return a};var Ct=a=>wt(R({},"__esModule",{value:!0}),a);var M=(a,t,e)=>new Promise((n,r)=>{var i=p=>{try{l(e.next(p))}catch(h){r(h)}},s=p=>{try{l(e.throw(p))}catch(h){r(h)}},l=p=>p.done?n(p.value):Promise.resolve(p.value).then(i,s);l((e=e.apply(a,t)).next())});var Ut={};Ot(Ut,{DEFAULT_BUTTON_PADDING_BOTTOM:()=>gt,DEFAULT_BUTTON_PADDING_LEFT:()=>ft,DEFAULT_BUTTON_PADDING_RIGHT:()=>mt,DEFAULT_BUTTON_PADDING_TOP:()=>dt,DEFAULT_COLUMNS_GAP:()=>at,DEFAULT_COLUMNS_WIDTH:()=>At,DEFAULT_COLUMN_BACKGROUND_COLOR:()=>Dt,DEFAULT_COLUMN_BORDER_COLOR:()=>Rt,DEFAULT_COLUMN_BORDER_RADIUS:()=>Vt,DEFAULT_COLUMN_BORDER_WIDTH:()=>kt,DEFAULT_COLUMN_PADDING_BOTTOM:()=>It,DEFAULT_COLUMN_PADDING_LEFT:()=>Bt,DEFAULT_COLUMN_PADDING_RIGHT:()=>Jt,DEFAULT_COLUMN_PADDING_TOP:()=>Pt,DEFAULT_HTML_PROPS:()=>ht,DEFAULT_INLINE_IMAGE_HEIGHT:()=>lt,DEFAULT_INLINE_IMAGE_WIDTH:()=>ct,DEFAULT_META_TAGS:()=>ut,DEFAULT_SECTION_ALIGN:()=>K,DEFAULT_SECTION_BACKGROUND_COLOR:()=>q,DEFAULT_SECTION_BORDER_COLOR:()=>Q,DEFAULT_SECTION_BORDER_WIDTH:()=>Y,DEFAULT_SECTION_MARGIN_BOTTOM:()=>et,DEFAULT_SECTION_MARGIN_LEFT:()=>nt,DEFAULT_SECTION_MARGIN_RIGHT:()=>tt,DEFAULT_SECTION_MARGIN_TOP:()=>Z,DEFAULT_SECTION_PADDING_BOTTOM:()=>it,DEFAULT_SECTION_PADDING_LEFT:()=>st,DEFAULT_SECTION_PADDING_RIGHT:()=>ot,DEFAULT_SECTION_PADDING_TOP:()=>rt,LINK_PROTOCOL_REGEX:()=>pt,Maily:()=>V,render:()=>Ft});module.exports=Ct(Ut);var D=require("react"),u=require("@react-email/components"),G=require("@react-email/render");var Nt=a=>Object.prototype.toString.call(a);var Tt=a=>Nt(a)==="[object Object]";function Et(a){return Object.keys(a)}function I(a,...t){if(!t.length)return a;let e=t.shift();return e===void 0?a:(J(a)&&J(e)&&Et(e).forEach(n=>{n==="__proto__"||n==="constructor"||n==="prototype"||(J(e[n])?(a[n]||(a[n]={}),J(a[n])?I(a[n],e[n]):a[n]=e[n]):a[n]=e[n])}),I(a,...t))}function J(a){return Tt(a)&&!Array.isArray(a)}var $t=Symbol("p-void");function B(){return Math.random().toString(36).substr(2,6)}var L=require("react/jsx-runtime");function X(a){return a.filter((t,e,n)=>{let r=H(t);return e===n.findIndex(i=>H(i)===r)}).map(vt).filter(Boolean)}function vt(a){if("tagName"in a){let t=a,{tagName:e}=t,n=P(t,["tagName"]);return(0,L.jsx)(e,f({},n),JSON.stringify(n))}return"title"in a?(0,L.jsx)("title",{children:a.title}):"charSet"in a?(0,L.jsx)("meta",{charSet:a.charSet}):(0,L.jsx)("meta",f({},a),JSON.stringify(a))}function H(a){let t=Object.keys(a).sort().reduce((e,n)=>{let r=n;return e[r]=a[r],e},{});return JSON.stringify(t)}var $=require("node-html-parser");var o=require("react/jsx-runtime"),A={WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"};var _t={h1:{fontSize:"36px",lineHeight:"40px",fontWeight:800},h2:{fontSize:"30px",lineHeight:"36px",fontWeight:700},h3:{fontSize:"24px",lineHeight:"38px",fontWeight:600}};var z={sm:"40px",md:"48px",lg:"64px"},Mt={pretty:!1,plainText:!1},j={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:{size:"15px",lineHeight:"26.25px"},footer:{size:"14px",lineHeight:"24px"}}},Lt='SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',q="#ffffff",K="left",Y=1,Q="#000000",Z=0,tt=0,et=0,nt=0,rt=5,ot=5,it=5,st=5,At="100%",at=8,Dt="transparent",Vt=0,kt=0,Rt="transparent",Pt=0,Jt=0,It=0,Bt=0,lt=20,ct=20,pt=/https?:\/\//,ut=[{name:"viewport",content:"width=device-width"},{httpEquiv:"X-UA-Compatible",content:"IE=edge"},{name:"x-apple-disable-message-reformatting"},{name:"format-detection",content:"telephone=no,address=no,email=no,date=no,url=no"},{name:"color-scheme",content:"light"},{name:"supported-color-schemes",content:"light"}],ht={lang:"en",dir:"ltr"},dt=10,mt=32,gt=10,ft=32,V=class{constructor(t={type:"doc",content:[]}){this.config={theme:j};this.variableFormatter=({variable:t,fallback:e})=>e?`{{${t},fallback=${e}}}`:`{{${t}}}`;this.shouldReplaceVariableValues=!1;this.variableValues=new Map;this.linkValues=new Map;this.payloadValues=new Map;this.marksOrder=["underline","bold","italic","textStyle","link"];this.meta=ut;this.htmlProps=ht;this.content=t}setPreviewText(t){this.config.preview=t}setTheme(t){this.config.theme=I(this.config.theme||j,t)}setVariableFormatter(t){this.variableFormatter=t}setVariableValue(t,e){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.variableValues.set(t,e)}setVariableValues(t){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),Object.entries(t).forEach(([e,n])=>{this.setVariableValue(e,n)})}setLinkValue(t,e){this.linkValues.set(t,e)}setLinkValues(t){Object.entries(t).forEach(([e,n])=>{this.setLinkValue(e,n)})}setPayloadValue(t,e){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.payloadValues.set(t,e)}setPayloadValues(t){Object.entries(t).forEach(([e,n])=>{this.setPayloadValue(e,n)})}setOpenTrackingPixel(t){this.openTrackingPixel=t}setShouldReplaceVariableValues(t){this.shouldReplaceVariableValues=t}setMetaTags(t){this.meta.push(...t)}setHtmlProps(t){this.htmlProps=f(f({},this.htmlProps),t)}getAllLinks(){let t=this.content.content||[],e=new Set,n=i=>i&&this.isValidUrl(i)&&!i.startsWith("#")&&!i.startsWith("mailto:")&&!i.startsWith("tel:")&&typeof i=="string",r=i=>{var s;if(i.type==="button"){let l=(s=i.attrs)==null?void 0:s.url;n(l)&&l&&e.add(l)}else i.content&&i.content.forEach(l=>{l.marks&&l.marks.forEach(p=>{var c;let h=(c=p.attrs)==null?void 0:c.href;p.type==="link"&&n(h)&&e.add(h)}),l.content&&r(l)})};return t.forEach(i=>{r(i)}),e}isValidUrl(t){try{let e=new URL(t);return!0}catch(e){return!1}}render(){return M(this,arguments,function*(t=Mt){let e=this.markup();return(0,G.renderAsync)(e,t)})}markup(){let t=this.content.content||[],e=t.map((l,p)=>{let h={prev:t[p-1],next:t[p+1],parent:l},c=this.renderNode(l,h);return c?(0,o.jsx)(D.Fragment,{children:c},B()):null}),{preview:n}=this.config,r=X(this.meta),i=this.htmlProps;return(0,o.jsxs)(u.Html,b(f({},i),{children:[(0,o.jsxs)(u.Head,{children:[(0,o.jsx)(u.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}}"}}),r]}),(0,o.jsxs)(u.Body,{style:{margin:0},children:[n?(0,o.jsx)(u.Preview,{id:"__react-email-preview",children:n}):null,(0,o.jsx)(u.Container,{style:{maxWidth:"600px",minWidth:"300px",width:"100%",marginLeft:"auto",marginRight:"auto",padding:"0.5rem"},children:e}),this.openTrackingPixel?(0,o.jsx)(u.Img,{alt:"",src:this.openTrackingPixel,style:{display:"none",width:"1px",height:"1px"}}):null]})]}))}getMarginOverrideConditions(t,e){let{parent:n,prev:r,next:i}=e||{},s=(i==null?void 0:i.type)==="spacer",l=(r==null?void 0:r.type)==="spacer",p=(n==null?void 0:n.type)==="listItem",h=(n==null?void 0:n.type)==="section"&&!i,c=(n==null?void 0:n.type)==="section"&&!r,m=(n==null?void 0:n.type)==="column"&&!i,d=(n==null?void 0:n.type)==="column"&&!r,g=(n==null?void 0:n.type)==="repeat"&&!r,y=(n==null?void 0:n.type)==="repeat"&&!i,x=(n==null?void 0:n.type)==="show"&&!r,S=(n==null?void 0:n.type)==="show"&&!i;return{isNextSpacer:s,isPrevSpacer:l,isLastSectionElement:h,isFirstSectionElement:c,isParentListItem:p,isLastColumnElement:m,isFirstColumnElement:d,isFirstRepeatElement:g,isLastRepeatElement:y,isFirstShowElement:x,isLastShowElement:S,shouldRemoveTopMargin:l||c||d||g||x,shouldRemoveBottomMargin:s||h||m||y||S}}getMappedContent(t,e){let n=t.content||[];return n.map((r,i)=>{let s=this.renderNode(r,b(f({},e),{next:n[i+1],prev:n[i-1]}));return s?(0,o.jsx)(D.Fragment,{children:s},B()):null}).filter(r=>r!==null)}renderNode(t,e={}){var r;let n=t.type||"";if(n in this)return(r=this[n])==null?void 0:r.call(this,t,e);throw new Error(`Node type "${n}" is not supported.`)}renderMark(t,e){let n=(t==null?void 0:t.text)||(0,o.jsx)(o.Fragment,{children:"\xA0"}),r=(t==null?void 0:t.marks)||[];return r.sort((i,s)=>this.marksOrder.indexOf(i.type)-this.marksOrder.indexOf(s.type)),r.reduce((i,s)=>{var p;let l=s.type;if(l in this)return(p=this[l])==null?void 0:p.call(this,s,i);throw new Error(`Mark type "${l}" is not supported.`)},(0,o.jsx)(o.Fragment,{children:n}))}paragraph(t,e){var h,c,m,d,g,y,x,S;let{attrs:n}=t,r=(n==null?void 0:n.textAlign)||"left",{isParentListItem:i,shouldRemoveBottomMargin:s}=this.getMarginOverrideConditions(t,e);if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let p=i||s?0:20;return(0,o.jsx)(u.Text,{style:b(f(f({},r!=="left"?{textAlign:r}:{}),A),{fontSize:(m=(c=(h=this.config.theme)==null?void 0:h.fontSize)==null?void 0:c.paragraph)==null?void 0:m.size,lineHeight:(y=(g=(d=this.config.theme)==null?void 0:d.fontSize)==null?void 0:g.paragraph)==null?void 0:y.lineHeight,color:(S=(x=this.config.theme)==null?void 0:x.colors)==null?void 0:S.paragraph,margin:`0 0 ${p}px 0`}),children:t.content?this.getMappedContent(t,b(f({},e),{parent:t})):(0,o.jsx)(o.Fragment,{children:"\xA0"})})}text(t,e){let n=t.text||"&nbsp";if(t.marks)return this.renderMark(t,e);let r=n==null?void 0:n.match(/\s/g);return r&&r.length===n.length?(0,o.jsx)(o.Fragment,{children:r.map((i,s)=>(0,o.jsx)(D.Fragment,{children:"\xA0"},s))}):(0,o.jsx)(o.Fragment,{children:n})}bold(t,e){return(0,o.jsx)("strong",{children:e})}italic(t,e){return(0,o.jsx)("em",{children:e})}underline(t,e){return(0,o.jsx)("u",{children:e})}strike(t,e){return(0,o.jsx)("s",{style:{textDecoration:"line-through"},children:e})}textStyle(t,e){var i,s;let{attrs:n}=t,{color:r=(s=(i=this.config.theme)==null?void 0:i.colors)==null?void 0:s.paragraph}=n||{};return(0,o.jsx)("span",{style:{color:r},children:e})}link(t,e,n){var h,c,m;let{attrs:r}=t,i=(r==null?void 0:r.href)||"#",s=(r==null?void 0:r.target)||"_blank",l=(r==null?void 0:r.rel)||"noopener noreferrer nofollow";if((h=r==null?void 0:r.isUrlVariable)!=null?h:!1){let d=this.removeLinkProtocol(i);i=this.variableUrlValue(d,n)}else i=this.linkValues.get(i)||i;return(0,o.jsx)(u.Link,{href:i,rel:l,style:{fontWeight:500,textDecoration:"none",color:(m=(c=this.config.theme)==null?void 0:c.colors)==null?void 0:m.heading},target:s,children:e})}removeLinkProtocol(t){return t.replace(pt,"")}variableUrlValue(t,e){var i,s;let{payloadValue:n}=e||{},r=this.removeLinkProtocol(t);return(s=(i=typeof n=="object"?n[r]:n)!=null?i:this.variableValues.get(r))!=null?s:t}heading(t,e){var m,d;let{attrs:n}=t,r=`h${Number(n==null?void 0:n.level)||1}`,i=(n==null?void 0:n.textAlign)||"left",{shouldRemoveBottomMargin:s}=this.getMarginOverrideConditions(t,e),{fontSize:l,lineHeight:p,fontWeight:h}=_t[r];return this.shouldShow(t,e)?(0,o.jsx)(u.Heading,{as:r,style:{textAlign:i,color:(d=(m=this.config.theme)==null?void 0:m.colors)==null?void 0:d.heading,fontSize:l,lineHeight:p,fontWeight:h},mb:s?0:12,mt:0,mx:0,children:this.getMappedContent(t,b(f({},e),{parent:t}))}):(0,o.jsx)(o.Fragment,{})}variable(t,e){let{payloadValue:n}=e||{},{id:r,fallback:i}=t.attrs||{};if(!this.shouldShow(t,e)||!r)return(0,o.jsx)(o.Fragment,{});let l=this.getVariableValue(r,i,e);return t!=null&&t.marks?this.renderMark({text:l,marks:t.marks},e):(0,o.jsx)(o.Fragment,{children:l})}getVariableValue(t,e,n){var s,l,p;let{payloadValue:r}=n||{},i=this.variableFormatter({variable:t,fallback:e});return this.shouldReplaceVariableValues&&(i=(p=(l=(s=typeof r=="object"?r[t]:r)!=null?s:this.variableValues.get(t))!=null?l:e)!=null?p:i),i}horizontalRule(t,e){return(0,o.jsx)(u.Hr,{style:{marginTop:"32px",marginBottom:"32px"}})}orderedList(t,e){let{shouldRemoveBottomMargin:n}=this.getMarginOverrideConditions(t,e);return(0,o.jsx)(u.Container,{children:(0,o.jsx)("ol",{style:{marginTop:"0px",marginBottom:n?"0":"20px",paddingLeft:"26px",listStyleType:"decimal"},children:this.getMappedContent(t,b(f({},e),{parent:t}))})})}bulletList(t,e){let{parent:n,next:r}=e||{},{shouldRemoveBottomMargin:i}=this.getMarginOverrideConditions(t,{parent:n,next:r});return(0,o.jsx)(u.Container,{style:{maxWidth:"100%"},children:(0,o.jsx)("ul",{style:{marginTop:"0px",marginBottom:i?"0":"20px",paddingLeft:"26px",listStyleType:"disc"},children:this.getMappedContent(t,b(f({},e),{parent:t}))})})}listItem(t,e){return(0,o.jsx)("li",{style:f({marginBottom:"8px",paddingLeft:"6px"},A),children:this.getMappedContent(t,b(f({},e),{parent:t}))})}button(t,e){let{attrs:n}=t,{text:r,isTextVariable:i,url:s,isUrlVariable:l,variant:p,buttonColor:h,textColor:c,borderRadius:m,alignment:d="left",paddingTop:g=dt,paddingRight:y=mt,paddingBottom:x=gt,paddingLeft:S=ft}=n||{};if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let O="0px";m==="round"?O="9999px":m==="smooth"&&(O="6px");let{shouldRemoveBottomMargin:w}=this.getMarginOverrideConditions(t,e),N=l?this.variableUrlValue(s,e):this.linkValues.get(s)||s,T=i?this.variableUrlValue(r,e):r;return g+=2,x+=2,(0,o.jsx)(u.Container,{style:{textAlign:d,maxWidth:"100%",marginBottom:w?"0px":"20px"},children:(0,o.jsx)(u.Button,{href:N,style:{color:String(c),backgroundColor:p==="filled"?String(h):"transparent",borderColor:String(h),borderWidth:"2px",borderStyle:"solid",textDecoration:"none",fontSize:"14px",fontWeight:500,borderRadius:O,padding:`${g}px ${y}px ${x}px ${S}px`},children:T})})}spacer(t,e){let{attrs:n}=t,{height:r}=n||{};return this.shouldShow(t,e)?(0,o.jsx)(u.Container,{style:{height:`${r}px`}}):(0,o.jsx)(o.Fragment,{})}hardBreak(t,e){return(0,o.jsx)("br",{})}logo(t,e){let{attrs:n}=t,{src:r,isSrcVariable:i,alt:s,title:l,size:p,alignment:h="left"}=n||{};if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});r=i?this.variableUrlValue(r,e):r;let{shouldRemoveBottomMargin:m}=this.getMarginOverrideConditions(t,e);return(0,o.jsx)(u.Row,{style:{marginTop:"0px",marginBottom:m?"0px":"32px"},children:(0,o.jsx)(u.Column,{align:h,children:(0,o.jsx)(u.Img,{alt:s||l||"Logo",src:r,style:{width:z[p]||p,height:z[p]||p},title:l||s||"Logo"})})})}image(t,e){let{attrs:n}=t,{src:r,isSrcVariable:i,alt:s,title:l,width:p="auto",alignment:h="center",externalLink:c="",isExternalLinkVariable:m}=n||{};if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let{shouldRemoveBottomMargin:g}=this.getMarginOverrideConditions(t,e);r=i?this.variableUrlValue(r,e):r,c=m?this.variableUrlValue(c,e):c;let y=p==="auto"?"auto":Number(p),x=y==="auto"?"auto":`${y}px`,S=(0,o.jsx)(u.Img,{alt:s||l||"Image",src:r,style:{width:x,maxWidth:"100%",outline:"none",border:"none",textDecoration:"none",display:"block"},title:l||s||"Image"});return(0,o.jsx)(u.Row,{style:{marginTop:"0px",marginBottom:g?"0px":"32px"},children:(0,o.jsx)(u.Column,{align:h,children:c?(0,o.jsx)("a",{href:c,rel:"noopener noreferrer",style:{display:"block",maxWidth:"100%",textDecoration:"none"},target:"_blank",children:S}):S})})}footer(t,e){var s,l,p,h,c,m,d,g;let{attrs:n}=t,{textAlign:r="left"}=n||{},{shouldRemoveBottomMargin:i}=this.getMarginOverrideConditions(t,e);return(0,o.jsx)(u.Text,{style:f({fontSize:(p=(l=(s=this.config.theme)==null?void 0:s.fontSize)==null?void 0:l.footer)==null?void 0:p.size,lineHeight:(m=(c=(h=this.config.theme)==null?void 0:h.fontSize)==null?void 0:c.footer)==null?void 0:m.lineHeight,color:(g=(d=this.config.theme)==null?void 0:d.colors)==null?void 0:g.footer,marginTop:"0px",marginBottom:i?"0px":"20px",textAlign:r},A),children:this.getMappedContent(t,b(f({},e),{parent:t}))})}blockquote(t,e){var i,s;let{isPrevSpacer:n,shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(t,e);return(0,o.jsx)("blockquote",{style:{borderLeftWidth:"4px",borderLeftStyle:"solid",borderLeftColor:(s=(i=this.config.theme)==null?void 0:i.colors)==null?void 0:s.blockquoteBorder,paddingLeft:"16px",marginLeft:"0px",marginRight:"0px",marginTop:n?"0px":"20px",marginBottom:r?"0px":"20px"},children:this.getMappedContent(t,b(f({},e),{parent:t}))})}code(t,e){var n,r,i,s;return(0,o.jsx)("code",{style:{backgroundColor:(r=(n=this.config.theme)==null?void 0:n.colors)==null?void 0:r.codeBackground,color:(s=(i=this.config.theme)==null?void 0:i.colors)==null?void 0:s.codeText,padding:"2px 4px",borderRadius:"6px",fontFamily:Lt,fontWeight:400,letterSpacing:0},children:e})}linkCard(t,e){var g,y,x,S,C,O,w,N,T,v,E,_;let{attrs:n}=t,{shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(t,e),{title:i,description:s,link:l,linkTitle:p,image:h,badgeText:c,subTitle:m}=n||{},d=this.linkValues.get(l)||this.variableValues.get(l)||l||"#";return(0,o.jsxs)("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:[h?(0,o.jsx)(u.Row,{style:{marginBottom:"6px"},children:(0,o.jsx)(u.Column,{style:{width:"100%",height:"100%"},children:(0,o.jsx)(u.Img,{alt:i||"Link Card",src:h,style:{borderRadius:"10px 10px 0 0",width:"100%",height:"100%",objectFit:"cover"},title:i||"Link Card"})})}):null,(0,o.jsx)(u.Row,{style:{padding:"15px",marginTop:0,marginBottom:0},children:(0,o.jsxs)(u.Column,{style:{verticalAlign:"top"},children:[(0,o.jsxs)(u.Row,{align:void 0,style:{marginBottom:"8px",marginTop:"0px"},width:"auto",children:[(0,o.jsx)(u.Column,{children:(0,o.jsx)(u.Text,{style:f({fontSize:"18px",fontWeight:600,color:(y=(g=this.config.theme)==null?void 0:g.colors)==null?void 0:y.linkCardTitle,margin:"0px"},A),children:i})}),c||m?(0,o.jsxs)(u.Column,{style:{paddingLeft:"6px",verticalAlign:"middle"},children:[c?(0,o.jsx)("span",{style:{fontWeight:600,color:(S=(x=this.config.theme)==null?void 0:x.colors)==null?void 0:S.linkCardBadgeText,padding:"4px 8px",borderRadius:"8px",backgroundColor:(O=(C=this.config.theme)==null?void 0:C.colors)==null?void 0:O.linkCardBadgeBackground,fontSize:"12px",lineHeight:"12px"},children:c}):null," ",m&&!c?(0,o.jsx)("span",{style:{fontWeight:"normal",color:(N=(w=this.config.theme)==null?void 0:w.colors)==null?void 0:N.linkCardSubTitle,fontSize:"12px",lineHeight:"12px"},children:m}):null]}):null]}),(0,o.jsxs)(u.Text,{style:f({fontSize:"16px",color:(v=(T=this.config.theme)==null?void 0:T.colors)==null?void 0:v.linkCardDescription,marginTop:"0px",marginBottom:"0px"},A),children:[s," ",p?(0,o.jsx)("a",{href:d,rel:"noopener noreferrer",style:{color:(_=(E=this.config.theme)==null?void 0:E.colors)==null?void 0:_.linkCardTitle,fontSize:"14px",fontWeight:600,textDecoration:"underline"},children:p}):null]})]})})]})}section(t,e){let{attrs:n}=t,{borderRadius:r=0,backgroundColor:i=q,align:s=K,borderWidth:l=Y,borderColor:p=Q,marginTop:h=Z,marginRight:c=tt,marginBottom:m=et,marginLeft:d=nt,paddingTop:g=rt,paddingRight:y=ot,paddingBottom:x=it,paddingLeft:S=st}=n||{};return this.shouldShow(t,e)?(0,o.jsx)(u.Row,{style:{marginTop:h,marginRight:c,marginBottom:m,marginLeft:d},children:(0,o.jsx)(u.Column,{align:s,style:{borderColor:p,borderWidth:l,borderStyle:"solid",backgroundColor:i,borderRadius:r,paddingTop:g,paddingRight:y,paddingBottom:x,paddingLeft:S},children:this.getMappedContent(t,b(f({},e),{parent:t}))})}):(0,o.jsx)(o.Fragment,{})}columns(t,e){let{attrs:n}=t;if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let[i,s]=this.adjustColumnsContent(t);return(0,o.jsx)(u.Row,{width:`${s}%`,style:{margin:0,padding:0,width:`${s}%`},className:"tab-row-full",children:this.getMappedContent(i,b(f({},e),{parent:i}))})}adjustColumnsContent(t){var m;let{content:e=[]}=t,n=100,r=e.filter(d=>{var g;return d.type==="column"&&!!Number(((g=d.attrs)==null?void 0:g.width)||0)}),i=e.filter(d=>{var g,y;return d.type==="column"&&(((g=d.attrs)==null?void 0:g.width)==="auto"||!((y=d.attrs)!=null&&y.width))}),s=r.reduce((d,g)=>{var y;return d+Number((y=g.attrs)==null?void 0:y.width)},0),l=n-s,p=Math.round(l/i.length),h=e.filter(d=>d.type==="column").length,c=((m=t.attrs)==null?void 0:m.gap)||at;return[b(f({},t),{content:e.map((d,g)=>{var N,T,v;let y=d.type==="column"&&(((N=d.attrs)==null?void 0:N.width)==="auto"||!((T=d.attrs)!=null&&T.width)),x=g===0,S=g>0&&g<h-1,C=g===e.length-1,O=0,w=0;if(h<3)O=x?0:c/2,w=C?0:c/2;else{let E=c/2*1.5,_=E/2;O=x?0:S?_:E,w=C?0:S?_:E}return O=Math.round(O*100)/100,w=Math.round(w*100)/100,b(f({},d),{attrs:b(f({},d.attrs),{width:y?p:(v=d.attrs)==null?void 0:v.width,isFirstColumn:x,isLastColumn:C,index:g,paddingLeft:O,paddingRight:w})})})}),i.length===0?Math.min(n,s):n]}column(t,e){let{attrs:n}=t,{width:r,verticalAlign:i="top",paddingLeft:s=0,paddingRight:l=0}=n||{};return(0,o.jsx)(u.Column,{width:`${Number(r)}%`,style:{width:`${Number(r)}%`,margin:0,verticalAlign:i},className:"tab-col-full",children:(0,o.jsx)(u.Section,{style:{margin:0,paddingLeft:s,paddingRight:l},className:"tab-pad",children:this.getMappedContent(t,b(f({},e),{parent:t}))})})}repeat(t,e){var p,h;let{attrs:n}=t,{each:r=""}=n||{};if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let{payloadValue:s}=e||{};s=typeof s=="object"?s:{};let l=(h=(p=this.payloadValues.get(r))!=null?p:s[r])!=null?h:[];if(!Array.isArray(l))throw new Error(`Payload value for each "${r}" is not an array`);return(0,o.jsx)(o.Fragment,{children:l.map(c=>(0,o.jsx)(D.Fragment,{children:this.getMappedContent(t,b(f({},e),{parent:t,payloadValue:c}))},B()))})}for(t,e){return this.repeat(t,e)}shouldShow(t,e){var i,s,l;let n=(s=(i=t==null?void 0:t.attrs)==null?void 0:i.showIfKey)!=null?s:"";if(!n)return!0;let{payloadValue:r}=e||{};return r=typeof r=="object"?r:{},!!((l=this.payloadValues.get(n))!=null?l:r[n])}htmlCodeBlock(t,e){var p;if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let r=((p=t.content)==null?void 0:p.reduce((h,c)=>{var m,d;if((c==null?void 0:c.type)==="text")return h+(c==null?void 0:c.text);if((c==null?void 0:c.type)==="variable"){let g=this.getVariableValue((m=c==null?void 0:c.attrs)==null?void 0:m.id,(d=c==null?void 0:c.attrs)==null?void 0:d.fallback,e);return h+g}return h},""))||"",i=(0,$.parse)(r),s=i.querySelector("head");s==null||s.remove();let l=i.toString();return(0,o.jsx)("table",{align:"left",width:"100%",border:0,cellPadding:"0",cellSpacing:"0",role:"presentation",children:(0,o.jsx)("tbody",{children:(0,o.jsx)("tr",{style:{width:"100%"},children:(0,o.jsx)("td",{style:{width:"100%"},dangerouslySetInnerHTML:{__html:l}})})})})}inlineImage(t,e){let{attrs:n}=t,{src:r,isSrcVariable:i,alt:s="",title:l="",height:p=lt,width:h=ct,externalLink:c="",isExternalLinkVariable:m}=n||{};r=i?this.variableUrlValue(r,e):r,c=m?this.variableUrlValue(c,e):c;let d=(0,o.jsx)("img",{src:r,alt:s,title:l,width:h,height:p,style:{display:"inline",verticalAlign:"middle",width:`${h}px`,height:`${p}px`,outline:"none",border:"none",textDecoration:"none"}});return c?(0,o.jsx)("a",{href:c,rel:"noopener noreferrer",style:{display:"inline",textDecoration:"none"},target:"_blank",children:d}):d}};function Ft(a,t){return M(this,null,function*(){let s=t||{},{theme:e,preview:n}=s,r=P(s,["theme","preview"]),i=new V(a);return i.setPreviewText(n),i.setTheme(e||{}),i.render(r)})}0&&(module.exports={DEFAULT_BUTTON_PADDING_BOTTOM,DEFAULT_BUTTON_PADDING_LEFT,DEFAULT_BUTTON_PADDING_RIGHT,DEFAULT_BUTTON_PADDING_TOP,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_HTML_PROPS,DEFAULT_INLINE_IMAGE_HEIGHT,DEFAULT_INLINE_IMAGE_WIDTH,DEFAULT_META_TAGS,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,LINK_PROTOCOL_REGEX,Maily,render});
1
+ "use strict";var k=Object.defineProperty,yt=Object.defineProperties,xt=Object.getOwnPropertyDescriptor,St=Object.getOwnPropertyDescriptors,bt=Object.getOwnPropertyNames,R=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var U=(a,t,e)=>t in a?k(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e,f=(a,t)=>{for(var e in t||(t={}))F.call(t,e)&&U(a,e,t[e]);if(R)for(var e of R(t))W.call(t,e)&&U(a,e,t[e]);return a},S=(a,t)=>yt(a,St(t));var P=(a,t)=>{var e={};for(var n in a)F.call(a,n)&&t.indexOf(n)<0&&(e[n]=a[n]);if(a!=null&&R)for(var n of R(a))t.indexOf(n)<0&&W.call(a,n)&&(e[n]=a[n]);return e};var Ot=(a,t)=>{for(var e in t)k(a,e,{get:t[e],enumerable:!0})},wt=(a,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of bt(t))!F.call(a,r)&&r!==e&&k(a,r,{get:()=>t[r],enumerable:!(n=xt(t,r))||n.enumerable});return a};var Ct=a=>wt(k({},"__esModule",{value:!0}),a);var M=(a,t,e)=>new Promise((n,r)=>{var i=p=>{try{l(e.next(p))}catch(h){r(h)}},s=p=>{try{l(e.throw(p))}catch(h){r(h)}},l=p=>p.done?n(p.value):Promise.resolve(p.value).then(i,s);l((e=e.apply(a,t)).next())});var Ut={};Ot(Ut,{DEFAULT_BUTTON_PADDING_BOTTOM:()=>gt,DEFAULT_BUTTON_PADDING_LEFT:()=>ft,DEFAULT_BUTTON_PADDING_RIGHT:()=>mt,DEFAULT_BUTTON_PADDING_TOP:()=>dt,DEFAULT_COLUMNS_GAP:()=>at,DEFAULT_COLUMNS_WIDTH:()=>At,DEFAULT_COLUMN_BACKGROUND_COLOR:()=>Dt,DEFAULT_COLUMN_BORDER_COLOR:()=>kt,DEFAULT_COLUMN_BORDER_RADIUS:()=>Vt,DEFAULT_COLUMN_BORDER_WIDTH:()=>Rt,DEFAULT_COLUMN_PADDING_BOTTOM:()=>It,DEFAULT_COLUMN_PADDING_LEFT:()=>Bt,DEFAULT_COLUMN_PADDING_RIGHT:()=>Jt,DEFAULT_COLUMN_PADDING_TOP:()=>Pt,DEFAULT_HTML_PROPS:()=>ht,DEFAULT_INLINE_IMAGE_HEIGHT:()=>lt,DEFAULT_INLINE_IMAGE_WIDTH:()=>ct,DEFAULT_META_TAGS:()=>ut,DEFAULT_SECTION_ALIGN:()=>K,DEFAULT_SECTION_BACKGROUND_COLOR:()=>q,DEFAULT_SECTION_BORDER_COLOR:()=>Q,DEFAULT_SECTION_BORDER_WIDTH:()=>Y,DEFAULT_SECTION_MARGIN_BOTTOM:()=>et,DEFAULT_SECTION_MARGIN_LEFT:()=>nt,DEFAULT_SECTION_MARGIN_RIGHT:()=>tt,DEFAULT_SECTION_MARGIN_TOP:()=>Z,DEFAULT_SECTION_PADDING_BOTTOM:()=>it,DEFAULT_SECTION_PADDING_LEFT:()=>st,DEFAULT_SECTION_PADDING_RIGHT:()=>ot,DEFAULT_SECTION_PADDING_TOP:()=>rt,LINK_PROTOCOL_REGEX:()=>pt,Maily:()=>V,render:()=>Ft});module.exports=Ct(Ut);var D=require("react"),u=require("@react-email/components"),G=require("@react-email/render");var Nt=a=>Object.prototype.toString.call(a);var Tt=a=>Nt(a)==="[object Object]";function Et(a){return Object.keys(a)}function I(a,...t){if(!t.length)return a;let e=t.shift();return e===void 0?a:(J(a)&&J(e)&&Et(e).forEach(n=>{n==="__proto__"||n==="constructor"||n==="prototype"||(J(e[n])?(a[n]||(a[n]={}),J(a[n])?I(a[n],e[n]):a[n]=e[n]):a[n]=e[n])}),I(a,...t))}function J(a){return Tt(a)&&!Array.isArray(a)}var $t=Symbol("p-void");function B(){return Math.random().toString(36).substr(2,6)}var L=require("react/jsx-runtime");function X(a){return a.filter((t,e,n)=>{let r=H(t);return e===n.findIndex(i=>H(i)===r)}).map(vt).filter(Boolean)}function vt(a){if("tagName"in a){let t=a,{tagName:e}=t,n=P(t,["tagName"]);return(0,L.jsx)(e,f({},n),JSON.stringify(n))}return"title"in a?(0,L.jsx)("title",{children:a.title}):"charSet"in a?(0,L.jsx)("meta",{charSet:a.charSet}):(0,L.jsx)("meta",f({},a),JSON.stringify(a))}function H(a){let t=Object.keys(a).sort().reduce((e,n)=>{let r=n;return e[r]=a[r],e},{});return JSON.stringify(t)}var $=require("node-html-parser");var o=require("react/jsx-runtime"),A={WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"};var _t={h1:{fontSize:"36px",lineHeight:"40px",fontWeight:800},h2:{fontSize:"30px",lineHeight:"36px",fontWeight:700},h3:{fontSize:"24px",lineHeight:"38px",fontWeight:600}};var z={sm:"40px",md:"48px",lg:"64px"},Mt={pretty:!1,plainText:!1},j={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:{size:"15px",lineHeight:"26.25px"},footer:{size:"14px",lineHeight:"24px"}}},Lt='SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',q="#ffffff",K="left",Y=1,Q="#000000",Z=0,tt=0,et=0,nt=0,rt=5,ot=5,it=5,st=5,At="100%",at=8,Dt="transparent",Vt=0,Rt=0,kt="transparent",Pt=0,Jt=0,It=0,Bt=0,lt=20,ct=20,pt=/https?:\/\//,ut=[{name:"viewport",content:"width=device-width"},{httpEquiv:"X-UA-Compatible",content:"IE=edge"},{name:"x-apple-disable-message-reformatting"},{name:"format-detection",content:"telephone=no,address=no,email=no,date=no,url=no"},{name:"color-scheme",content:"light"},{name:"supported-color-schemes",content:"light"}],ht={lang:"en",dir:"ltr"},dt=10,mt=32,gt=10,ft=32,V=class{constructor(t={type:"doc",content:[]}){this.config={theme:j};this.variableFormatter=({variable:t,fallback:e})=>e?`{{${t},fallback=${e}}}`:`{{${t}}}`;this.shouldReplaceVariableValues=!1;this.variableValues=new Map;this.linkValues=new Map;this.payloadValues=new Map;this.marksOrder=["underline","bold","italic","textStyle","link"];this.meta=ut;this.htmlProps=ht;this.content=t}setPreviewText(t){this.config.preview=t}setTheme(t){this.config.theme=I(this.config.theme||j,t)}setVariableFormatter(t){this.variableFormatter=t}setVariableValue(t,e){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.variableValues.set(t,e)}setVariableValues(t){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),Object.entries(t).forEach(([e,n])=>{this.setVariableValue(e,n)})}setLinkValue(t,e){this.linkValues.set(t,e)}setLinkValues(t){Object.entries(t).forEach(([e,n])=>{this.setLinkValue(e,n)})}setPayloadValue(t,e){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.payloadValues.set(t,e)}setPayloadValues(t){Object.entries(t).forEach(([e,n])=>{this.setPayloadValue(e,n)})}setOpenTrackingPixel(t){this.openTrackingPixel=t}setShouldReplaceVariableValues(t){this.shouldReplaceVariableValues=t}setMetaTags(t){this.meta.push(...t)}setHtmlProps(t){this.htmlProps=f(f({},this.htmlProps),t)}getAllLinks(){let t=this.content.content||[],e=new Set,n=i=>i&&this.isValidUrl(i)&&!i.startsWith("#")&&!i.startsWith("mailto:")&&!i.startsWith("tel:")&&typeof i=="string",r=i=>{var s;if(i.type==="button"){let l=(s=i.attrs)==null?void 0:s.url;n(l)&&l&&e.add(l)}else i.content&&i.content.forEach(l=>{l.marks&&l.marks.forEach(p=>{var c;let h=(c=p.attrs)==null?void 0:c.href;p.type==="link"&&n(h)&&e.add(h)}),l.content&&r(l)})};return t.forEach(i=>{r(i)}),e}isValidUrl(t){try{let e=new URL(t);return!0}catch(e){return!1}}render(){return M(this,arguments,function*(t=Mt){let e=this.markup();return(0,G.renderAsync)(e,t)})}markup(){let t=this.content.content||[],e=t.map((l,p)=>{let h={prev:t[p-1],next:t[p+1],parent:l},c=this.renderNode(l,h);return c?(0,o.jsx)(D.Fragment,{children:c},B()):null}),{preview:n}=this.config,r=X(this.meta),i=this.htmlProps;return(0,o.jsxs)(u.Html,S(f({},i),{children:[(0,o.jsxs)(u.Head,{children:[(0,o.jsx)(u.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}}"}}),r]}),(0,o.jsxs)(u.Body,{style:{margin:0},children:[n?(0,o.jsx)(u.Preview,{id:"__react-email-preview",children:n}):null,(0,o.jsx)(u.Container,{style:{maxWidth:"600px",minWidth:"300px",width:"100%",marginLeft:"auto",marginRight:"auto",padding:"0.5rem"},children:e}),this.openTrackingPixel?(0,o.jsx)(u.Img,{alt:"",src:this.openTrackingPixel,style:{display:"none",width:"1px",height:"1px"}}):null]})]}))}getMarginOverrideConditions(t,e){let{parent:n,prev:r,next:i}=e||{},s=(i==null?void 0:i.type)==="spacer",l=(r==null?void 0:r.type)==="spacer",p=(n==null?void 0:n.type)==="listItem",h=(n==null?void 0:n.type)==="section"&&!i,c=(n==null?void 0:n.type)==="section"&&!r,m=(n==null?void 0:n.type)==="column"&&!i,d=(n==null?void 0:n.type)==="column"&&!r,g=(n==null?void 0:n.type)==="repeat"&&!r,y=(n==null?void 0:n.type)==="repeat"&&!i,x=(n==null?void 0:n.type)==="show"&&!r,b=(n==null?void 0:n.type)==="show"&&!i;return{isNextSpacer:s,isPrevSpacer:l,isLastSectionElement:h,isFirstSectionElement:c,isParentListItem:p,isLastColumnElement:m,isFirstColumnElement:d,isFirstRepeatElement:g,isLastRepeatElement:y,isFirstShowElement:x,isLastShowElement:b,shouldRemoveTopMargin:l||c||d||g||x,shouldRemoveBottomMargin:s||h||m||y||b}}getMappedContent(t,e){let n=t.content||[];return n.map((r,i)=>{let s=this.renderNode(r,S(f({},e),{next:n[i+1],prev:n[i-1]}));return s?(0,o.jsx)(D.Fragment,{children:s},B()):null}).filter(r=>r!==null)}renderNode(t,e={}){var r;let n=t.type||"";if(n in this)return(r=this[n])==null?void 0:r.call(this,t,e);throw new Error(`Node type "${n}" is not supported.`)}renderMark(t,e){let n=(t==null?void 0:t.text)||(0,o.jsx)(o.Fragment,{children:"\xA0"}),r=(t==null?void 0:t.marks)||[];return r.sort((i,s)=>this.marksOrder.indexOf(i.type)-this.marksOrder.indexOf(s.type)),r.reduce((i,s)=>{var p;let l=s.type;if(l in this)return(p=this[l])==null?void 0:p.call(this,s,i);throw new Error(`Mark type "${l}" is not supported.`)},(0,o.jsx)(o.Fragment,{children:n}))}paragraph(t,e){var h,c,m,d,g,y,x,b;let{attrs:n}=t,r=(n==null?void 0:n.textAlign)||"left",{isParentListItem:i,shouldRemoveBottomMargin:s}=this.getMarginOverrideConditions(t,e);if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let p=i||s?0:20;return(0,o.jsx)(u.Text,{style:S(f(f({},r!=="left"?{textAlign:r}:{}),A),{fontSize:(m=(c=(h=this.config.theme)==null?void 0:h.fontSize)==null?void 0:c.paragraph)==null?void 0:m.size,lineHeight:(y=(g=(d=this.config.theme)==null?void 0:d.fontSize)==null?void 0:g.paragraph)==null?void 0:y.lineHeight,color:(b=(x=this.config.theme)==null?void 0:x.colors)==null?void 0:b.paragraph,margin:`0 0 ${p}px 0`}),children:t.content?this.getMappedContent(t,S(f({},e),{parent:t})):(0,o.jsx)(o.Fragment,{children:"\xA0"})})}text(t,e){let n=t.text||"&nbsp";if(t.marks)return this.renderMark(t,e);let r=n==null?void 0:n.match(/\s/g);return r&&r.length===n.length?(0,o.jsx)(o.Fragment,{children:r.map((i,s)=>(0,o.jsx)(D.Fragment,{children:"\xA0"},s))}):(0,o.jsx)(o.Fragment,{children:n})}bold(t,e){return(0,o.jsx)("strong",{children:e})}italic(t,e){return(0,o.jsx)("em",{children:e})}underline(t,e){return(0,o.jsx)("u",{children:e})}strike(t,e){return(0,o.jsx)("s",{style:{textDecoration:"line-through"},children:e})}textStyle(t,e){var i,s;let{attrs:n}=t,{color:r=(s=(i=this.config.theme)==null?void 0:i.colors)==null?void 0:s.paragraph}=n||{};return(0,o.jsx)("span",{style:{color:r},children:e})}link(t,e,n){var h,c,m;let{attrs:r}=t,i=(r==null?void 0:r.href)||"#",s=(r==null?void 0:r.target)||"_blank",l=(r==null?void 0:r.rel)||"noopener noreferrer nofollow";if((h=r==null?void 0:r.isUrlVariable)!=null?h:!1){let d=this.removeLinkProtocol(i);i=this.variableUrlValue(d,n)}else i=this.linkValues.get(i)||i;return(0,o.jsx)(u.Link,{href:i,rel:l,style:{fontWeight:500,textDecoration:"none",color:(m=(c=this.config.theme)==null?void 0:c.colors)==null?void 0:m.heading},target:s,children:e})}removeLinkProtocol(t){return t.replace(pt,"")}variableUrlValue(t,e){var i,s;let{payloadValue:n}=e||{},r=this.removeLinkProtocol(t);return(s=(i=typeof n=="object"?n[r]:n)!=null?i:this.variableValues.get(r))!=null?s:t}heading(t,e){var m,d;let{attrs:n}=t,r=`h${Number(n==null?void 0:n.level)||1}`,i=(n==null?void 0:n.textAlign)||"left",{shouldRemoveBottomMargin:s}=this.getMarginOverrideConditions(t,e),{fontSize:l,lineHeight:p,fontWeight:h}=_t[r];return this.shouldShow(t,e)?(0,o.jsx)(u.Heading,{as:r,style:{textAlign:i,color:(d=(m=this.config.theme)==null?void 0:m.colors)==null?void 0:d.heading,fontSize:l,lineHeight:p,fontWeight:h},mb:s?0:12,mt:0,mx:0,children:this.getMappedContent(t,S(f({},e),{parent:t}))}):(0,o.jsx)(o.Fragment,{})}variable(t,e){let{payloadValue:n}=e||{},{id:r,fallback:i}=t.attrs||{};if(!this.shouldShow(t,e)||!r)return(0,o.jsx)(o.Fragment,{});let l=this.getVariableValue(r,i,e);return t!=null&&t.marks?this.renderMark({text:l,marks:t.marks},e):(0,o.jsx)(o.Fragment,{children:l})}getVariableValue(t,e,n){var s,l,p;let{payloadValue:r}=n||{},i=this.variableFormatter({variable:t,fallback:e});return this.shouldReplaceVariableValues&&(i=(p=(l=(s=typeof r=="object"?r[t]:r)!=null?s:this.variableValues.get(t))!=null?l:e)!=null?p:i),i}horizontalRule(t,e){return(0,o.jsx)(u.Hr,{style:{marginTop:"32px",marginBottom:"32px"}})}orderedList(t,e){let{shouldRemoveBottomMargin:n}=this.getMarginOverrideConditions(t,e);return(0,o.jsx)(u.Container,{children:(0,o.jsx)("ol",{style:{marginTop:"0px",marginBottom:n?"0":"20px",paddingLeft:"26px",listStyleType:"decimal"},children:this.getMappedContent(t,S(f({},e),{parent:t}))})})}bulletList(t,e){let{parent:n,next:r}=e||{},{shouldRemoveBottomMargin:i}=this.getMarginOverrideConditions(t,{parent:n,next:r});return(0,o.jsx)(u.Container,{style:{maxWidth:"100%"},children:(0,o.jsx)("ul",{style:{marginTop:"0px",marginBottom:i?"0":"20px",paddingLeft:"26px",listStyleType:"disc"},children:this.getMappedContent(t,S(f({},e),{parent:t}))})})}listItem(t,e){return(0,o.jsx)("li",{style:f({marginBottom:"8px",paddingLeft:"6px"},A),children:this.getMappedContent(t,S(f({},e),{parent:t}))})}button(t,e){let{attrs:n}=t,{text:r,isTextVariable:i,url:s,isUrlVariable:l,variant:p,buttonColor:h,textColor:c,borderRadius:m,alignment:d="left",paddingTop:g=dt,paddingRight:y=mt,paddingBottom:x=gt,paddingLeft:b=ft}=n||{};if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let O="0px";m==="round"?O="9999px":m==="smooth"&&(O="6px");let{shouldRemoveBottomMargin:C}=this.getMarginOverrideConditions(t,e),N=l?this.variableUrlValue(s,e):this.linkValues.get(s)||s,T=i?this.variableUrlValue(r,e):r;return g+=2,x+=2,(0,o.jsx)(u.Container,{style:{textAlign:d,maxWidth:"100%",marginBottom:C?"0px":"20px"},children:(0,o.jsx)(u.Button,{href:N,style:{color:String(c),backgroundColor:p==="filled"?String(h):"transparent",borderColor:String(h),borderWidth:"2px",borderStyle:"solid",textDecoration:"none",fontSize:"14px",fontWeight:500,borderRadius:O,padding:`${g}px ${y}px ${x}px ${b}px`},children:T})})}spacer(t,e){let{attrs:n}=t,{height:r}=n||{};return this.shouldShow(t,e)?(0,o.jsx)(u.Container,{style:{height:`${r}px`}}):(0,o.jsx)(o.Fragment,{})}hardBreak(t,e){return(0,o.jsx)("br",{})}logo(t,e){let{attrs:n}=t,{src:r,isSrcVariable:i,alt:s,title:l,size:p,alignment:h="left"}=n||{};if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});r=i?this.variableUrlValue(r,e):r;let{shouldRemoveBottomMargin:m}=this.getMarginOverrideConditions(t,e);return(0,o.jsx)(u.Row,{style:{marginTop:"0px",marginBottom:m?"0px":"32px"},children:(0,o.jsx)(u.Column,{align:h,children:(0,o.jsx)(u.Img,{alt:s||l||"Logo",src:r,style:{width:z[p]||p,height:z[p]||p},title:l||s||"Logo"})})})}image(t,e){let{attrs:n}=t,{src:r,isSrcVariable:i,alt:s,title:l,width:p="auto",alignment:h="center",externalLink:c="",isExternalLinkVariable:m,borderRadius:d=0}=n||{};if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let{shouldRemoveBottomMargin:y}=this.getMarginOverrideConditions(t,e);r=i?this.variableUrlValue(r,e):r,c=m?this.variableUrlValue(c,e):c;let x=p==="auto"?"auto":Number(p),b=x==="auto"?"auto":`${x}px`,w=(0,o.jsx)(u.Img,{alt:s||l||"Image",src:r,style:{width:b,maxWidth:"100%",outline:"none",border:"none",textDecoration:"none",display:"block",borderRadius:d},title:l||s||"Image"});return(0,o.jsx)(u.Row,{style:{marginTop:"0px",marginBottom:y?"0px":"32px"},children:(0,o.jsx)(u.Column,{align:h,children:c?(0,o.jsx)("a",{href:c,rel:"noopener noreferrer",style:{display:"block",maxWidth:"100%",textDecoration:"none"},target:"_blank",children:w}):w})})}footer(t,e){var s,l,p,h,c,m,d,g;let{attrs:n}=t,{textAlign:r="left"}=n||{},{shouldRemoveBottomMargin:i}=this.getMarginOverrideConditions(t,e);return(0,o.jsx)(u.Text,{style:f({fontSize:(p=(l=(s=this.config.theme)==null?void 0:s.fontSize)==null?void 0:l.footer)==null?void 0:p.size,lineHeight:(m=(c=(h=this.config.theme)==null?void 0:h.fontSize)==null?void 0:c.footer)==null?void 0:m.lineHeight,color:(g=(d=this.config.theme)==null?void 0:d.colors)==null?void 0:g.footer,marginTop:"0px",marginBottom:i?"0px":"20px",textAlign:r},A),children:this.getMappedContent(t,S(f({},e),{parent:t}))})}blockquote(t,e){var i,s;let{isPrevSpacer:n,shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(t,e);return(0,o.jsx)("blockquote",{style:{borderLeftWidth:"4px",borderLeftStyle:"solid",borderLeftColor:(s=(i=this.config.theme)==null?void 0:i.colors)==null?void 0:s.blockquoteBorder,paddingLeft:"16px",marginLeft:"0px",marginRight:"0px",marginTop:n?"0px":"20px",marginBottom:r?"0px":"20px"},children:this.getMappedContent(t,S(f({},e),{parent:t}))})}code(t,e){var n,r,i,s;return(0,o.jsx)("code",{style:{backgroundColor:(r=(n=this.config.theme)==null?void 0:n.colors)==null?void 0:r.codeBackground,color:(s=(i=this.config.theme)==null?void 0:i.colors)==null?void 0:s.codeText,padding:"2px 4px",borderRadius:"6px",fontFamily:Lt,fontWeight:400,letterSpacing:0},children:e})}linkCard(t,e){var g,y,x,b,w,O,C,N,T,v,E,_;let{attrs:n}=t,{shouldRemoveBottomMargin:r}=this.getMarginOverrideConditions(t,e),{title:i,description:s,link:l,linkTitle:p,image:h,badgeText:c,subTitle:m}=n||{},d=this.linkValues.get(l)||this.variableValues.get(l)||l||"#";return(0,o.jsxs)("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:[h?(0,o.jsx)(u.Row,{style:{marginBottom:"6px"},children:(0,o.jsx)(u.Column,{style:{width:"100%",height:"100%"},children:(0,o.jsx)(u.Img,{alt:i||"Link Card",src:h,style:{borderRadius:"10px 10px 0 0",width:"100%",height:"100%",objectFit:"cover"},title:i||"Link Card"})})}):null,(0,o.jsx)(u.Row,{style:{padding:"15px",marginTop:0,marginBottom:0},children:(0,o.jsxs)(u.Column,{style:{verticalAlign:"top"},children:[(0,o.jsxs)(u.Row,{align:void 0,style:{marginBottom:"8px",marginTop:"0px"},width:"auto",children:[(0,o.jsx)(u.Column,{children:(0,o.jsx)(u.Text,{style:f({fontSize:"18px",fontWeight:600,color:(y=(g=this.config.theme)==null?void 0:g.colors)==null?void 0:y.linkCardTitle,margin:"0px"},A),children:i})}),c||m?(0,o.jsxs)(u.Column,{style:{paddingLeft:"6px",verticalAlign:"middle"},children:[c?(0,o.jsx)("span",{style:{fontWeight:600,color:(b=(x=this.config.theme)==null?void 0:x.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:c}):null," ",m&&!c?(0,o.jsx)("span",{style:{fontWeight:"normal",color:(N=(C=this.config.theme)==null?void 0:C.colors)==null?void 0:N.linkCardSubTitle,fontSize:"12px",lineHeight:"12px"},children:m}):null]}):null]}),(0,o.jsxs)(u.Text,{style:f({fontSize:"16px",color:(v=(T=this.config.theme)==null?void 0:T.colors)==null?void 0:v.linkCardDescription,marginTop:"0px",marginBottom:"0px"},A),children:[s," ",p?(0,o.jsx)("a",{href:d,rel:"noopener noreferrer",style:{color:(_=(E=this.config.theme)==null?void 0:E.colors)==null?void 0:_.linkCardTitle,fontSize:"14px",fontWeight:600,textDecoration:"underline"},children:p}):null]})]})})]})}section(t,e){let{attrs:n}=t,{borderRadius:r=0,backgroundColor:i=q,align:s=K,borderWidth:l=Y,borderColor:p=Q,marginTop:h=Z,marginRight:c=tt,marginBottom:m=et,marginLeft:d=nt,paddingTop:g=rt,paddingRight:y=ot,paddingBottom:x=it,paddingLeft:b=st}=n||{};return this.shouldShow(t,e)?(0,o.jsx)(u.Row,{style:{marginTop:h,marginRight:c,marginBottom:m,marginLeft:d},children:(0,o.jsx)(u.Column,{align:s,style:{borderColor:p,borderWidth:l,borderStyle:"solid",backgroundColor:i,borderRadius:r,paddingTop:g,paddingRight:y,paddingBottom:x,paddingLeft:b},children:this.getMappedContent(t,S(f({},e),{parent:t}))})}):(0,o.jsx)(o.Fragment,{})}columns(t,e){let{attrs:n}=t;if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let[i,s]=this.adjustColumnsContent(t);return(0,o.jsx)(u.Row,{width:`${s}%`,style:{margin:0,padding:0,width:`${s}%`},className:"tab-row-full",children:this.getMappedContent(i,S(f({},e),{parent:i}))})}adjustColumnsContent(t){var m;let{content:e=[]}=t,n=100,r=e.filter(d=>{var g;return d.type==="column"&&!!Number(((g=d.attrs)==null?void 0:g.width)||0)}),i=e.filter(d=>{var g,y;return d.type==="column"&&(((g=d.attrs)==null?void 0:g.width)==="auto"||!((y=d.attrs)!=null&&y.width))}),s=r.reduce((d,g)=>{var y;return d+Number((y=g.attrs)==null?void 0:y.width)},0),l=n-s,p=Math.round(l/i.length),h=e.filter(d=>d.type==="column").length,c=((m=t.attrs)==null?void 0:m.gap)||at;return[S(f({},t),{content:e.map((d,g)=>{var N,T,v;let y=d.type==="column"&&(((N=d.attrs)==null?void 0:N.width)==="auto"||!((T=d.attrs)!=null&&T.width)),x=g===0,b=g>0&&g<h-1,w=g===e.length-1,O=0,C=0;if(h<3)O=x?0:c/2,C=w?0:c/2;else{let E=c/2*1.5,_=E/2;O=x?0:b?_:E,C=w?0:b?_:E}return O=Math.round(O*100)/100,C=Math.round(C*100)/100,S(f({},d),{attrs:S(f({},d.attrs),{width:y?p:(v=d.attrs)==null?void 0:v.width,isFirstColumn:x,isLastColumn:w,index:g,paddingLeft:O,paddingRight:C})})})}),i.length===0?Math.min(n,s):n]}column(t,e){let{attrs:n}=t,{width:r,verticalAlign:i="top",paddingLeft:s=0,paddingRight:l=0}=n||{};return(0,o.jsx)(u.Column,{width:`${Number(r)}%`,style:{width:`${Number(r)}%`,margin:0,verticalAlign:i},className:"tab-col-full",children:(0,o.jsx)(u.Section,{style:{margin:0,paddingLeft:s,paddingRight:l},className:"tab-pad",children:this.getMappedContent(t,S(f({},e),{parent:t}))})})}repeat(t,e){var p,h;let{attrs:n}=t,{each:r=""}=n||{};if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let{payloadValue:s}=e||{};s=typeof s=="object"?s:{};let l=(h=(p=this.payloadValues.get(r))!=null?p:s[r])!=null?h:[];if(!Array.isArray(l))throw new Error(`Payload value for each "${r}" is not an array`);return(0,o.jsx)(o.Fragment,{children:l.map(c=>(0,o.jsx)(D.Fragment,{children:this.getMappedContent(t,S(f({},e),{parent:t,payloadValue:c}))},B()))})}for(t,e){return this.repeat(t,e)}shouldShow(t,e){var i,s,l;let n=(s=(i=t==null?void 0:t.attrs)==null?void 0:i.showIfKey)!=null?s:"";if(!n)return!0;let{payloadValue:r}=e||{};return r=typeof r=="object"?r:{},!!((l=this.payloadValues.get(n))!=null?l:r[n])}htmlCodeBlock(t,e){var p;if(!this.shouldShow(t,e))return(0,o.jsx)(o.Fragment,{});let r=((p=t.content)==null?void 0:p.reduce((h,c)=>{var m,d;if((c==null?void 0:c.type)==="text")return h+(c==null?void 0:c.text);if((c==null?void 0:c.type)==="variable"){let g=this.getVariableValue((m=c==null?void 0:c.attrs)==null?void 0:m.id,(d=c==null?void 0:c.attrs)==null?void 0:d.fallback,e);return h+g}return h},""))||"",i=(0,$.parse)(r),s=i.querySelector("head");s==null||s.remove();let l=i.toString();return(0,o.jsx)("table",{align:"left",width:"100%",border:0,cellPadding:"0",cellSpacing:"0",role:"presentation",children:(0,o.jsx)("tbody",{children:(0,o.jsx)("tr",{style:{width:"100%"},children:(0,o.jsx)("td",{style:{width:"100%"},dangerouslySetInnerHTML:{__html:l}})})})})}inlineImage(t,e){let{attrs:n}=t,{src:r,isSrcVariable:i,alt:s="",title:l="",height:p=lt,width:h=ct,externalLink:c="",isExternalLinkVariable:m}=n||{};r=i?this.variableUrlValue(r,e):r,c=m?this.variableUrlValue(c,e):c;let d=(0,o.jsx)("img",{src:r,alt:s,title:l,width:h,height:p,style:{display:"inline",verticalAlign:"middle",width:`${h}px`,height:`${p}px`,outline:"none",border:"none",textDecoration:"none"}});return c?(0,o.jsx)("a",{href:c,rel:"noopener noreferrer",style:{display:"inline",textDecoration:"none"},target:"_blank",children:d}):d}};function Ft(a,t){return M(this,null,function*(){let s=t||{},{theme:e,preview:n}=s,r=P(s,["theme","preview"]),i=new V(a);return i.setPreviewText(n),i.setTheme(e||{}),i.render(r)})}0&&(module.exports={DEFAULT_BUTTON_PADDING_BOTTOM,DEFAULT_BUTTON_PADDING_LEFT,DEFAULT_BUTTON_PADDING_RIGHT,DEFAULT_BUTTON_PADDING_TOP,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_HTML_PROPS,DEFAULT_INLINE_IMAGE_HEIGHT,DEFAULT_INLINE_IMAGE_WIDTH,DEFAULT_META_TAGS,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,LINK_PROTOCOL_REGEX,Maily,render});
2
2
  //# sourceMappingURL=index.js.map