{"version":3,"file":"index.mjs","names":["marginProperties: (keyof React.CSSProperties)[]","bodyStyle: Record<string, string | number | undefined>"],"sources":["../src/margin-properties.ts","../src/body.tsx"],"sourcesContent":["export const marginProperties: (keyof React.CSSProperties)[] = [\n  'margin',\n  'marginTop',\n  'marginBottom',\n  'marginRight',\n  'marginLeft',\n  'marginInline',\n  'marginBlock',\n  'marginBlockStart',\n  'marginBlockEnd',\n  'marginInlineStart',\n  'marginInlineEnd',\n];\n","import * as React from 'react';\nimport { marginProperties } from './margin-properties';\n\nexport type BodyProps = Readonly<React.HtmlHTMLAttributes<HTMLBodyElement>>;\n\nexport const Body = React.forwardRef<HTMLBodyElement, BodyProps>(\n  ({ children, style, ...props }, ref) => {\n    const bodyStyle: Record<string, string | number | undefined> = {\n      background: style?.background,\n      backgroundColor: style?.backgroundColor,\n    };\n    if (style) {\n      for (const property of marginProperties) {\n        // We reset the margin if the user sets it, this mimics the\n        // same behavior that would happen if this was only using the body.\n        // This avoids the incoming margin summing up with the margin\n        // defined by the email client on the body, or by the browser itself\n        bodyStyle[property] = style[property] !== undefined ? 0 : undefined;\n      }\n    }\n    return (\n      <body {...props} style={bodyStyle} ref={ref}>\n        <table\n          border={0}\n          width=\"100%\"\n          cellPadding=\"0\"\n          cellSpacing=\"0\"\n          role=\"presentation\"\n          align=\"center\"\n        >\n          <tbody>\n            <tr>\n              {/*\n                Yahoo and AOL remove all styles of the body element while converting it to a div,\n                so we need to apply them to to an inner cell.\n\n                See https://github.com/resend/react-email/issues/662.\n              */}\n              <td style={style}>{children}</td>\n            </tr>\n          </tbody>\n        </table>\n      </body>\n    );\n  },\n);\n\nBody.displayName = 'Body';\n"],"mappings":";;;;AAAA,MAAaA,mBAAkD;CAC7D;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;ACPD,MAAa,OAAO,MAAM,YACvB,EAAE,UAAU,MAAO,GAAG,SAAS,QAAQ;CACtC,MAAMC,YAAyD;EAC7D,YAAY,OAAO;EACnB,iBAAiB,OAAO;EACzB;AACD,KAAI,MACF,MAAK,MAAM,YAAY,iBAKrB,WAAU,YAAY,MAAM,cAAc,SAAY,IAAI;AAG9D,QACE,oBAAC;EAAK,GAAI;EAAO,OAAO;EAAgB;YACtC,oBAAC;GACC,QAAQ;GACR,OAAM;GACN,aAAY;GACZ,aAAY;GACZ,MAAK;GACL,OAAM;aAEN,oBAAC,qBACC,oBAAC,kBAOC,oBAAC;IAAU;IAAQ;KAAc,GAC9B,GACC;IACF;GACH;EAGZ;AAED,KAAK,cAAc"}