@alfadocs/ui-kit-debug 0.57.0 → 0.59.0

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.
Files changed (151) hide show
  1. package/dist/_chunks/{bishop-score-CMQxsdy4.js → bishop-score-B9tvgoIq.js} +2 -2
  2. package/dist/_chunks/{bishop-score-CMQxsdy4.js.map → bishop-score-B9tvgoIq.js.map} +1 -1
  3. package/dist/_chunks/{bmi-calculator-DuUneHuZ.js → bmi-calculator-DA2NGmVK.js} +2 -2
  4. package/dist/_chunks/{bmi-calculator-DuUneHuZ.js.map → bmi-calculator-DA2NGmVK.js.map} +1 -1
  5. package/dist/_chunks/{calendar-oYWOCrnf.js → calendar-CkuJIg3s.js} +1 -1
  6. package/dist/_chunks/{calendar-oYWOCrnf.js.map → calendar-CkuJIg3s.js.map} +1 -1
  7. package/dist/_chunks/{cycle-calculator-vTtZZAmn.js → cycle-calculator-C_t1Hs8V.js} +2 -2
  8. package/dist/_chunks/{cycle-calculator-vTtZZAmn.js.map → cycle-calculator-C_t1Hs8V.js.map} +1 -1
  9. package/dist/_chunks/date-picker-variants-CXEAx3O_.js.map +1 -1
  10. package/dist/_chunks/{due-date-calculator-CUm5KJbf.js → due-date-calculator-Q8MIwEVV.js} +2 -2
  11. package/dist/_chunks/{due-date-calculator-CUm5KJbf.js.map → due-date-calculator-Q8MIwEVV.js.map} +1 -1
  12. package/dist/_chunks/{fetal-weight-Xf8-ZoDy.js → fetal-weight-D1a6BmM-.js} +2 -2
  13. package/dist/_chunks/{fetal-weight-Xf8-ZoDy.js.map → fetal-weight-D1a6BmM-.js.map} +1 -1
  14. package/dist/_chunks/{gestational-age-calculator-830KJql3.js → gestational-age-calculator-AkNFfZYs.js} +2 -2
  15. package/dist/_chunks/{gestational-age-calculator-830KJql3.js.map → gestational-age-calculator-AkNFfZYs.js.map} +1 -1
  16. package/dist/_chunks/{hcg-doubling-kVOpDfny.js → hcg-doubling-Dg0Hr7ey.js} +2 -2
  17. package/dist/_chunks/{hcg-doubling-kVOpDfny.js.map → hcg-doubling-Dg0Hr7ey.js.map} +1 -1
  18. package/dist/_chunks/{insert-result-njqBthzT.js → insert-result-C1SYdueh.js} +125 -115
  19. package/dist/_chunks/insert-result-C1SYdueh.js.map +1 -0
  20. package/dist/_chunks/{pregnancy-dating-BA37LSkF.js → pregnancy-dating-Dg6dTe1p.js} +2 -2
  21. package/dist/_chunks/{pregnancy-dating-BA37LSkF.js.map → pregnancy-dating-Dg6dTe1p.js.map} +1 -1
  22. package/dist/_chunks/{pregnancy-weight-gain-BMRBeA8V.js → pregnancy-weight-gain-DI7X-0JX.js} +2 -2
  23. package/dist/_chunks/{pregnancy-weight-gain-BMRBeA8V.js.map → pregnancy-weight-gain-DI7X-0JX.js.map} +1 -1
  24. package/dist/_chunks/rich-text-editor-B03qM22-.js +334 -0
  25. package/dist/_chunks/rich-text-editor-B03qM22-.js.map +1 -0
  26. package/dist/_chunks/{unit-converter-BQ6lEYvd.js → unit-converter-3sINXO3m.js} +2 -2
  27. package/dist/_chunks/{unit-converter-BQ6lEYvd.js.map → unit-converter-3sINXO3m.js.map} +1 -1
  28. package/dist/agent-catalog.json +2 -2
  29. package/dist/components/_shared/safe-html.d.ts +1 -1
  30. package/dist/components/bishop-score/index.js +1 -1
  31. package/dist/components/bmi-calculator/index.js +1 -1
  32. package/dist/components/calendar/index.js +1 -1
  33. package/dist/components/cycle-calculator/index.js +1 -1
  34. package/dist/components/due-date-calculator/index.js +1 -1
  35. package/dist/components/fetal-weight/index.js +1 -1
  36. package/dist/components/gestational-age-calculator/index.js +1 -1
  37. package/dist/components/hcg-doubling/index.js +1 -1
  38. package/dist/components/pregnancy-dating/index.js +1 -1
  39. package/dist/components/pregnancy-weight-gain/index.js +1 -1
  40. package/dist/components/rich-text-editor/index.d.ts +2 -2
  41. package/dist/components/rich-text-editor/index.d.ts.map +1 -1
  42. package/dist/components/rich-text-editor/index.js +4 -7
  43. package/dist/components/rich-text-editor/rich-text-editor.agent.d.ts.map +1 -1
  44. package/dist/components/rich-text-editor/rich-text-editor.d.ts +21 -15
  45. package/dist/components/rich-text-editor/rich-text-editor.d.ts.map +1 -1
  46. package/dist/components/unit-converter/index.js +1 -1
  47. package/dist/hooks/index.d.ts +1 -0
  48. package/dist/hooks/index.d.ts.map +1 -1
  49. package/dist/hooks/index.js +99 -77
  50. package/dist/hooks/index.js.map +1 -1
  51. package/dist/hooks/use-countdown.d.ts +34 -0
  52. package/dist/hooks/use-countdown.d.ts.map +1 -0
  53. package/dist/i18n/locales/ar.d.ts +1 -0
  54. package/dist/i18n/locales/ar.d.ts.map +1 -1
  55. package/dist/i18n/locales/ar.js +1 -0
  56. package/dist/i18n/locales/ar.js.map +1 -1
  57. package/dist/i18n/locales/de.d.ts +1 -0
  58. package/dist/i18n/locales/de.d.ts.map +1 -1
  59. package/dist/i18n/locales/de.js +1 -0
  60. package/dist/i18n/locales/de.js.map +1 -1
  61. package/dist/i18n/locales/el.d.ts +1 -0
  62. package/dist/i18n/locales/el.d.ts.map +1 -1
  63. package/dist/i18n/locales/el.js +1 -0
  64. package/dist/i18n/locales/el.js.map +1 -1
  65. package/dist/i18n/locales/en.d.ts +1 -0
  66. package/dist/i18n/locales/en.d.ts.map +1 -1
  67. package/dist/i18n/locales/en.js +1 -0
  68. package/dist/i18n/locales/en.js.map +1 -1
  69. package/dist/i18n/locales/es.d.ts +1 -0
  70. package/dist/i18n/locales/es.d.ts.map +1 -1
  71. package/dist/i18n/locales/es.js +1 -0
  72. package/dist/i18n/locales/es.js.map +1 -1
  73. package/dist/i18n/locales/fr.d.ts +1 -0
  74. package/dist/i18n/locales/fr.d.ts.map +1 -1
  75. package/dist/i18n/locales/fr.js +1 -0
  76. package/dist/i18n/locales/fr.js.map +1 -1
  77. package/dist/i18n/locales/hi.d.ts +1 -0
  78. package/dist/i18n/locales/hi.d.ts.map +1 -1
  79. package/dist/i18n/locales/hi.js +1 -0
  80. package/dist/i18n/locales/hi.js.map +1 -1
  81. package/dist/i18n/locales/it.d.ts +1 -0
  82. package/dist/i18n/locales/it.d.ts.map +1 -1
  83. package/dist/i18n/locales/it.js +1 -0
  84. package/dist/i18n/locales/it.js.map +1 -1
  85. package/dist/i18n/locales/ja.d.ts +1 -0
  86. package/dist/i18n/locales/ja.d.ts.map +1 -1
  87. package/dist/i18n/locales/ja.js +1 -0
  88. package/dist/i18n/locales/ja.js.map +1 -1
  89. package/dist/i18n/locales/nl.d.ts +1 -0
  90. package/dist/i18n/locales/nl.d.ts.map +1 -1
  91. package/dist/i18n/locales/nl.js +1 -0
  92. package/dist/i18n/locales/nl.js.map +1 -1
  93. package/dist/i18n/locales/pl.d.ts +1 -0
  94. package/dist/i18n/locales/pl.d.ts.map +1 -1
  95. package/dist/i18n/locales/pl.js +1 -0
  96. package/dist/i18n/locales/pl.js.map +1 -1
  97. package/dist/i18n/locales/pt.d.ts +1 -0
  98. package/dist/i18n/locales/pt.d.ts.map +1 -1
  99. package/dist/i18n/locales/pt.js +1 -0
  100. package/dist/i18n/locales/pt.js.map +1 -1
  101. package/dist/i18n/locales/ro.d.ts +1 -0
  102. package/dist/i18n/locales/ro.d.ts.map +1 -1
  103. package/dist/i18n/locales/ro.js +1 -0
  104. package/dist/i18n/locales/ro.js.map +1 -1
  105. package/dist/i18n/locales/ru.d.ts +1 -0
  106. package/dist/i18n/locales/ru.d.ts.map +1 -1
  107. package/dist/i18n/locales/ru.js +1 -0
  108. package/dist/i18n/locales/ru.js.map +1 -1
  109. package/dist/i18n/locales/sq.d.ts +1 -0
  110. package/dist/i18n/locales/sq.d.ts.map +1 -1
  111. package/dist/i18n/locales/sq.js +1 -0
  112. package/dist/i18n/locales/sq.js.map +1 -1
  113. package/dist/i18n/locales/sv.d.ts +1 -0
  114. package/dist/i18n/locales/sv.d.ts.map +1 -1
  115. package/dist/i18n/locales/sv.js +1 -0
  116. package/dist/i18n/locales/sv.js.map +1 -1
  117. package/dist/i18n/locales/tr.d.ts +1 -0
  118. package/dist/i18n/locales/tr.d.ts.map +1 -1
  119. package/dist/i18n/locales/tr.js +1 -0
  120. package/dist/i18n/locales/tr.js.map +1 -1
  121. package/dist/i18n/locales/zh.d.ts +1 -0
  122. package/dist/i18n/locales/zh.d.ts.map +1 -1
  123. package/dist/i18n/locales/zh.js +1 -0
  124. package/dist/i18n/locales/zh.js.map +1 -1
  125. package/dist/index.js +143 -146
  126. package/dist/locales/ar.json +1 -0
  127. package/dist/locales/de.json +1 -0
  128. package/dist/locales/el.json +1 -0
  129. package/dist/locales/en.json +1 -0
  130. package/dist/locales/es.json +1 -0
  131. package/dist/locales/fr.json +1 -0
  132. package/dist/locales/hi.json +1 -0
  133. package/dist/locales/it.json +1 -0
  134. package/dist/locales/ja.json +1 -0
  135. package/dist/locales/nl.json +1 -0
  136. package/dist/locales/pl.json +1 -0
  137. package/dist/locales/pt.json +1 -0
  138. package/dist/locales/ro.json +1 -0
  139. package/dist/locales/ru.json +1 -0
  140. package/dist/locales/sq.json +1 -0
  141. package/dist/locales/sv.json +1 -0
  142. package/dist/locales/tr.json +1 -0
  143. package/dist/locales/zh.json +1 -0
  144. package/dist/safe-html/index.js.map +1 -1
  145. package/dist/tokens.css +23 -25
  146. package/package.json +2 -52
  147. package/dist/_chunks/image-C6RM5hfF.js +0 -16
  148. package/dist/_chunks/image-C6RM5hfF.js.map +0 -1
  149. package/dist/_chunks/insert-result-njqBthzT.js.map +0 -1
  150. package/dist/_chunks/rich-text-editor-DhGIBd4a.js +0 -921
  151. package/dist/_chunks/rich-text-editor-DhGIBd4a.js.map +0 -1
@@ -1648,6 +1648,7 @@
1648
1648
  },
1649
1649
  "editor": {
1650
1650
  "toolbarLabel": "Μορφοποίηση κειμένου",
1651
+ "regionLabel": "Επεξεργαστής εμπλουτισμένου κειμένου",
1651
1652
  "placeholder": "Αρχίστε να γράφετε…",
1652
1653
  "bold": "Έντονα",
1653
1654
  "italic": "Πλάγια",
@@ -1648,6 +1648,7 @@
1648
1648
  },
1649
1649
  "editor": {
1650
1650
  "toolbarLabel": "Text formatting",
1651
+ "regionLabel": "Rich text editor",
1651
1652
  "placeholder": "Start typing…",
1652
1653
  "bold": "Bold",
1653
1654
  "italic": "Italic",
@@ -1648,6 +1648,7 @@
1648
1648
  },
1649
1649
  "editor": {
1650
1650
  "toolbarLabel": "Formato de texto",
1651
+ "regionLabel": "Editor de texto enriquecido",
1651
1652
  "placeholder": "Empiece a escribir…",
1652
1653
  "bold": "Negrita",
1653
1654
  "italic": "Cursiva",
@@ -1648,6 +1648,7 @@
1648
1648
  },
1649
1649
  "editor": {
1650
1650
  "toolbarLabel": "Mise en forme du texte",
1651
+ "regionLabel": "Éditeur de texte enrichi",
1651
1652
  "placeholder": "Commencez à écrire…",
1652
1653
  "bold": "Gras",
1653
1654
  "italic": "Italique",
@@ -1648,6 +1648,7 @@
1648
1648
  },
1649
1649
  "editor": {
1650
1650
  "toolbarLabel": "टेक्स्ट फ़ॉर्मेटिंग",
1651
+ "regionLabel": "रिच टेक्स्ट एडिटर",
1651
1652
  "placeholder": "लिखना शुरू करें…",
1652
1653
  "bold": "बोल्ड",
1653
1654
  "italic": "इटैलिक",
@@ -1648,6 +1648,7 @@
1648
1648
  },
1649
1649
  "editor": {
1650
1650
  "toolbarLabel": "Formattazione testo",
1651
+ "regionLabel": "Editor di testo formattato",
1651
1652
  "placeholder": "Inizia a scrivere…",
1652
1653
  "bold": "Grassetto",
1653
1654
  "italic": "Corsivo",
@@ -1648,6 +1648,7 @@
1648
1648
  },
1649
1649
  "editor": {
1650
1650
  "toolbarLabel": "テキスト書式設定",
1651
+ "regionLabel": "リッチテキストエディター",
1651
1652
  "placeholder": "入力を開始…",
1652
1653
  "bold": "太字",
1653
1654
  "italic": "斜体",
@@ -1648,6 +1648,7 @@
1648
1648
  },
1649
1649
  "editor": {
1650
1650
  "toolbarLabel": "Tekstopmaak",
1651
+ "regionLabel": "Tekstverwerker",
1651
1652
  "placeholder": "Begin met typen…",
1652
1653
  "bold": "Vetgedrukt",
1653
1654
  "italic": "Cursief",
@@ -1648,6 +1648,7 @@
1648
1648
  },
1649
1649
  "editor": {
1650
1650
  "toolbarLabel": "Formatowanie tekstu",
1651
+ "regionLabel": "Edytor tekstu sformatowanego",
1651
1652
  "placeholder": "Zacznij pisać…",
1652
1653
  "bold": "Pogrubienie",
1653
1654
  "italic": "Kursywa",
@@ -1648,6 +1648,7 @@
1648
1648
  },
1649
1649
  "editor": {
1650
1650
  "toolbarLabel": "Formatação de texto",
1651
+ "regionLabel": "Editor de texto formatado",
1651
1652
  "placeholder": "Comece a escrever…",
1652
1653
  "bold": "Negrito",
1653
1654
  "italic": "Itálico",
@@ -1648,6 +1648,7 @@
1648
1648
  },
1649
1649
  "editor": {
1650
1650
  "toolbarLabel": "Formatare text",
1651
+ "regionLabel": "Editor de text îmbogățit",
1651
1652
  "placeholder": "Începe să scrii…",
1652
1653
  "bold": "Îngroșat",
1653
1654
  "italic": "Cursiv",
@@ -1648,6 +1648,7 @@
1648
1648
  },
1649
1649
  "editor": {
1650
1650
  "toolbarLabel": "Форматирование текста",
1651
+ "regionLabel": "Редактор форматированного текста",
1651
1652
  "placeholder": "Начните ввод…",
1652
1653
  "bold": "Жирный",
1653
1654
  "italic": "Курсив",
@@ -1648,6 +1648,7 @@
1648
1648
  },
1649
1649
  "editor": {
1650
1650
  "toolbarLabel": "Formatimi i tekstit",
1651
+ "regionLabel": "Redaktues teksti i pasur",
1651
1652
  "placeholder": "Filloni të shkruani…",
1652
1653
  "bold": "I trashë",
1653
1654
  "italic": "I pjerrët",
@@ -1648,6 +1648,7 @@
1648
1648
  },
1649
1649
  "editor": {
1650
1650
  "toolbarLabel": "Textformatering",
1651
+ "regionLabel": "Redigerare för formaterad text",
1651
1652
  "placeholder": "Börja skriva…",
1652
1653
  "bold": "Fet",
1653
1654
  "italic": "Kursiv",
@@ -1648,6 +1648,7 @@
1648
1648
  },
1649
1649
  "editor": {
1650
1650
  "toolbarLabel": "Metin biçimlendirme",
1651
+ "regionLabel": "Zengin metin düzenleyici",
1651
1652
  "placeholder": "Yazmaya başlayın…",
1652
1653
  "bold": "Kalın",
1653
1654
  "italic": "İtalik",
@@ -1648,6 +1648,7 @@
1648
1648
  },
1649
1649
  "editor": {
1650
1650
  "toolbarLabel": "文本格式",
1651
+ "regionLabel": "富文本编辑器",
1651
1652
  "placeholder": "开始输入……",
1652
1653
  "bold": "粗体",
1653
1654
  "italic": "斜体",
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/components/_shared/safe-html.tsx"],"sourcesContent":["import DOMPurify, { type Config as DOMPurifyConfig } from 'dompurify';\nimport { forwardRef, useMemo, type HTMLAttributes } from 'react';\n\n/**\n * The only permissible carrier of `dangerouslySetInnerHTML` in the repo\n * (per `23-constraints.mdx §8` + `12-security.mdx §12.1`). ESLint's\n * `react/no-danger` rule is expected to ignore this file and fail everywhere\n * else.\n *\n * `profile` switches between sanitiser configurations tuned for the three\n * surfaces that have a legitimate need for raw HTML:\n * - `markdown` — narrow inline HTML inside a Markdown pipeline (links,\n * strong/em, simple code, lists). Used by ChatMessage's LLM output.\n * - `email` — paragraphs + links only; everything else coerced to text.\n * Used for rendering transactional email previews.\n * - `rich-text`— full Tiptap-compatible HTML (headings, lists, tables,\n * inline formatting, safe images, safe links). Used by RichTextEditor\n * when setting / reading content programmatically.\n *\n * Pasted HTML / LLM output flowing through `SafeHtml` is always stripped\n * of script tags, on* attributes, `form`/`object`/`embed`/`base`/`meta`\n * tags, and every scheme outside http/https/mailto/tel on links or the\n * raster set on images.\n */\nexport type SafeHtmlProfile = 'markdown' | 'email' | 'rich-text';\n\nconst MARKDOWN_CONFIG: DOMPurifyConfig = {\n ALLOWED_TAGS: [\n 'a',\n 'b',\n 'i',\n 'em',\n 'strong',\n 'code',\n 'pre',\n 'br',\n 'p',\n 'ul',\n 'ol',\n 'li',\n 'blockquote',\n ],\n ALLOWED_ATTR: ['href', 'title', 'target', 'rel'],\n ALLOWED_URI_REGEXP: /^(https?:|mailto:|tel:)/i,\n};\n\nconst EMAIL_CONFIG: DOMPurifyConfig = {\n ALLOWED_TAGS: ['a', 'p', 'br', 'strong', 'em', 'b', 'i'],\n ALLOWED_ATTR: ['href'],\n ALLOWED_URI_REGEXP: /^(https?:|mailto:)/i,\n};\n\nconst RICH_TEXT_CONFIG: DOMPurifyConfig = {\n // DOMPurify strips on* attributes by default; the explicit FORBID_TAGS\n // below adds defence-in-depth against the few tags that are not always\n // removed by defaults under relaxed configs.\n FORBID_TAGS: [\n 'script',\n 'style',\n 'iframe',\n 'object',\n 'embed',\n 'form',\n 'base',\n 'meta',\n ],\n FORBID_ATTR: [\n 'onerror',\n 'onclick',\n 'onload',\n 'onmouseover',\n 'onfocus',\n 'onblur',\n ],\n};\n\nfunction configFor(profile: SafeHtmlProfile): DOMPurifyConfig {\n switch (profile) {\n case 'markdown':\n return MARKDOWN_CONFIG;\n case 'email':\n return EMAIL_CONFIG;\n case 'rich-text':\n return RICH_TEXT_CONFIG;\n }\n}\n\nexport function sanitiseHtml(html: string, profile: SafeHtmlProfile): string {\n return DOMPurify.sanitize(html, configFor(profile)) as unknown as string;\n}\n\nexport interface SafeHtmlProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'dangerouslySetInnerHTML'\n> {\n html: string;\n profile?: SafeHtmlProfile;\n}\n\nexport const SafeHtml = forwardRef<HTMLDivElement, SafeHtmlProps>(\n ({ html, profile = 'markdown', ...rest }, ref) => {\n const sanitised = useMemo(\n () => sanitiseHtml(html, profile),\n [html, profile],\n );\n\n return (\n <div\n ref={ref}\n data-component=\"safe-html\"\n {...rest}\n dangerouslySetInnerHTML={{ __html: sanitised }}\n />\n );\n },\n);\nSafeHtml.displayName = 'SafeHtml';\n"],"names":["MARKDOWN_CONFIG","EMAIL_CONFIG","RICH_TEXT_CONFIG","configFor","profile","sanitiseHtml","html","DOMPurify","SafeHtml","forwardRef","rest","ref","sanitised","useMemo","jsx"],"mappings":";;;AA0BA,MAAMA,IAAmC;AAAA,EACv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;AAAA,IAAA;AAAA,EAGnD;AACF;AACAJ,EAAS,cAAc;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/components/_shared/safe-html.tsx"],"sourcesContent":["import DOMPurify, { type Config as DOMPurifyConfig } from 'dompurify';\nimport { forwardRef, useMemo, type HTMLAttributes } from 'react';\n\n/**\n * The only permissible carrier of `dangerouslySetInnerHTML` in the repo\n * (per `23-constraints.mdx §8` + `12-security.mdx §12.1`). ESLint's\n * `react/no-danger` rule is expected to ignore this file and fail everywhere\n * else.\n *\n * `profile` switches between sanitiser configurations tuned for the three\n * surfaces that have a legitimate need for raw HTML:\n * - `markdown` — narrow inline HTML inside a Markdown pipeline (links,\n * strong/em, simple code, lists). Used by ChatMessage's LLM output.\n * - `email` — paragraphs + links only; everything else coerced to text.\n * Used for rendering transactional email previews.\n * - `rich-text`— full Redactor-compatible HTML (headings, lists, tables,\n * inline formatting, safe images, safe links). Used by RichTextEditor\n * when setting / reading content programmatically.\n *\n * Pasted HTML / LLM output flowing through `SafeHtml` is always stripped\n * of script tags, on* attributes, `form`/`object`/`embed`/`base`/`meta`\n * tags, and every scheme outside http/https/mailto/tel on links or the\n * raster set on images.\n */\nexport type SafeHtmlProfile = 'markdown' | 'email' | 'rich-text';\n\nconst MARKDOWN_CONFIG: DOMPurifyConfig = {\n ALLOWED_TAGS: [\n 'a',\n 'b',\n 'i',\n 'em',\n 'strong',\n 'code',\n 'pre',\n 'br',\n 'p',\n 'ul',\n 'ol',\n 'li',\n 'blockquote',\n ],\n ALLOWED_ATTR: ['href', 'title', 'target', 'rel'],\n ALLOWED_URI_REGEXP: /^(https?:|mailto:|tel:)/i,\n};\n\nconst EMAIL_CONFIG: DOMPurifyConfig = {\n ALLOWED_TAGS: ['a', 'p', 'br', 'strong', 'em', 'b', 'i'],\n ALLOWED_ATTR: ['href'],\n ALLOWED_URI_REGEXP: /^(https?:|mailto:)/i,\n};\n\nconst RICH_TEXT_CONFIG: DOMPurifyConfig = {\n // DOMPurify strips on* attributes by default; the explicit FORBID_TAGS\n // below adds defence-in-depth against the few tags that are not always\n // removed by defaults under relaxed configs.\n FORBID_TAGS: [\n 'script',\n 'style',\n 'iframe',\n 'object',\n 'embed',\n 'form',\n 'base',\n 'meta',\n ],\n FORBID_ATTR: [\n 'onerror',\n 'onclick',\n 'onload',\n 'onmouseover',\n 'onfocus',\n 'onblur',\n ],\n};\n\nfunction configFor(profile: SafeHtmlProfile): DOMPurifyConfig {\n switch (profile) {\n case 'markdown':\n return MARKDOWN_CONFIG;\n case 'email':\n return EMAIL_CONFIG;\n case 'rich-text':\n return RICH_TEXT_CONFIG;\n }\n}\n\nexport function sanitiseHtml(html: string, profile: SafeHtmlProfile): string {\n return DOMPurify.sanitize(html, configFor(profile)) as unknown as string;\n}\n\nexport interface SafeHtmlProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'dangerouslySetInnerHTML'\n> {\n html: string;\n profile?: SafeHtmlProfile;\n}\n\nexport const SafeHtml = forwardRef<HTMLDivElement, SafeHtmlProps>(\n ({ html, profile = 'markdown', ...rest }, ref) => {\n const sanitised = useMemo(\n () => sanitiseHtml(html, profile),\n [html, profile],\n );\n\n return (\n <div\n ref={ref}\n data-component=\"safe-html\"\n {...rest}\n dangerouslySetInnerHTML={{ __html: sanitised }}\n />\n );\n },\n);\nSafeHtml.displayName = 'SafeHtml';\n"],"names":["MARKDOWN_CONFIG","EMAIL_CONFIG","RICH_TEXT_CONFIG","configFor","profile","sanitiseHtml","html","DOMPurify","SafeHtml","forwardRef","rest","ref","sanitised","useMemo","jsx"],"mappings":";;;AA0BA,MAAMA,IAAmC;AAAA,EACvC,cAAc;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAAA,EAEF,cAAc,CAAC,QAAQ,SAAS,UAAU,KAAK;AAAA,EAC/C,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