{"version":3,"sources":["../../../../src/components/notification-item/Markdown.tsx"],"sourcesContent":["import { markdownStyles, parseMarkdownIntoTokens } from '@novu/js/ui-core';\nimport React, { Fragment, useMemo } from 'react';\nimport { useStyle } from '../../hooks/internal/useEngineStores';\n\ntype MarkdownProps = {\n  children: string;\n  strongKey: string;\n  emKey: string;\n  context: Record<string, unknown>;\n};\n\n/** Renders the same inline markdown as the engine: `**strong**`, `*em*`, and both nested. */\nexport const Markdown = ({ children, strongKey, emKey, context }: MarkdownProps) => {\n  const style = useStyle();\n  const tokens = useMemo(() => parseMarkdownIntoTokens(children), [children]);\n  const strongClassName = style({ key: strongKey as never, className: markdownStyles.strong.className, context });\n  const emClassName = style({ key: emKey as never, className: markdownStyles.em.className, context });\n\n  return (\n    <>\n      {tokens.map((token, index) => {\n        const key = `${index}-${token.type}`;\n        if (token.type === 'boldItalic') {\n          return (\n            <strong key={key} className={strongClassName}>\n              <em className={emClassName}>{token.content}</em>\n            </strong>\n          );\n        }\n        if (token.type === 'bold') {\n          return (\n            <strong key={key} className={strongClassName}>\n              {token.content}\n            </strong>\n          );\n        }\n        if (token.type === 'italic') {\n          return (\n            <em key={key} className={emClassName}>\n              {token.content}\n            </em>\n          );\n        }\n\n        return <Fragment key={key}>{token.content}</Fragment>;\n      })}\n    </>\n  );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwD;AACxD,mBAAyC;AACzC,6BAAyB;AAiBrB;AAPG,IAAM,WAAW,CAAC,EAAE,UAAU,WAAW,OAAO,QAAQ,MAAqB;AAClF,QAAM,YAAQ,iCAAS;AACvB,QAAM,aAAS,sBAAQ,UAAM,wCAAwB,QAAQ,GAAG,CAAC,QAAQ,CAAC;AAC1E,QAAM,kBAAkB,MAAM,EAAE,KAAK,WAAoB,WAAW,8BAAe,OAAO,WAAW,QAAQ,CAAC;AAC9G,QAAM,cAAc,MAAM,EAAE,KAAK,OAAgB,WAAW,8BAAe,GAAG,WAAW,QAAQ,CAAC;AAElG,SACE,2EACG,iBAAO,IAAI,CAAC,OAAO,UAAU;AAC5B,UAAM,MAAM,GAAG,KAAK,IAAI,MAAM,IAAI;AAClC,QAAI,MAAM,SAAS,cAAc;AAC/B,aACE,4CAAC,YAAiB,WAAW,iBAC3B,sDAAC,QAAG,WAAW,aAAc,gBAAM,SAAQ,KADhC,GAEb;AAAA,IAEJ;AACA,QAAI,MAAM,SAAS,QAAQ;AACzB,aACE,4CAAC,YAAiB,WAAW,iBAC1B,gBAAM,WADI,GAEb;AAAA,IAEJ;AACA,QAAI,MAAM,SAAS,UAAU;AAC3B,aACE,4CAAC,QAAa,WAAW,aACtB,gBAAM,WADA,GAET;AAAA,IAEJ;AAEA,WAAO,4CAAC,yBAAoB,gBAAM,WAAZ,GAAoB;AAAA,EAC5C,CAAC,GACH;AAEJ;","names":[]}