{"version":3,"sources":["../src/index.tsx"],"sourcesContent":["import DOMPurify from \"isomorphic-dompurify\";\nimport React from \"react\";\nimport { state } from \"./state\";\nimport { Toast } from \"./types\";\n\nconst sanitize = function (content: string | undefined) {\n  if (!content) {\n    return undefined;\n  }\n\n  return DOMPurify.sanitize(content);\n};\n\nexport const ServerToastRegister = function () {\n  const toasts: Toast[] = state.globalToasts.map((toast) => {\n    // Sanitizing the contents of the toast to prevent XSS attack.\n    return {\n      ...toast,\n      title: sanitize(toast.title),\n      description: sanitize(toast.description),\n    };\n  });\n\n  return (\n    <script\n      suppressHydrationWarning\n      dangerouslySetInnerHTML={{\n        __html: `\n          window.toasts = JSON.parse(\\`${JSON.stringify(toasts)}\\`);\n        `,\n      }}\n    ></script>\n  );\n};\n\nexport { toast } from \"./state\";\n"],"mappings":"gDAAA,OAAOA,MAAe,uBACtB,OAAOC,MAAW,QAIlB,IAAMC,EAAW,SAAUC,EAA6B,CACtD,GAAKA,EAIL,OAAOC,EAAU,SAASD,CAAO,CACnC,EAEaE,EAAsB,UAAY,CAC7C,IAAMC,EAAkBC,EAAM,aAAa,IAAKC,IAEvC,CACL,GAAGA,EACH,MAAON,EAASM,EAAM,KAAK,EAC3B,YAAaN,EAASM,EAAM,WAAW,CACzC,EACD,EAED,OACEC,EAAA,cAAC,UACC,yBAAwB,GACxB,wBAAyB,CACvB,OAAQ;AAAA,yCACyB,KAAK,UAAUH,CAAM,CAAC;AAAA,SAEzD,EACD,CAEL","names":["DOMPurify","React","sanitize","content","DOMPurify","ServerToastRegister","toasts","state","toast","React"]}