@iblai/web-containers 1.73.0 → 1.74.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 (281) hide show
  1. package/dist/cjs/_virtual/index2.js +2 -2
  2. package/dist/cjs/_virtual/index3.js +2 -2
  3. package/dist/cjs/components/activity-tab/activity-empty-state.js +2 -2
  4. package/dist/cjs/components/activity-tab/activity-empty-state.js.map +1 -1
  5. package/dist/cjs/components/canvas/canvas-rich-text-editor.js +8 -8
  6. package/dist/cjs/components/canvas/tiptap-math-extension.js +1 -1
  7. package/dist/cjs/components/modals/edit-mentor-modal/tabs/evaluation-tab/benchmark-combobox.js +2 -2
  8. package/dist/cjs/components/modals/edit-mentor-modal/tabs/evaluation-tab/benchmark-combobox.js.map +1 -1
  9. package/dist/cjs/components/modals/edit-mentor-modal/tabs/evaluation-tab/delete-experiment-modal.js +5 -5
  10. package/dist/cjs/components/modals/edit-mentor-modal/tabs/evaluation-tab/delete-experiment-modal.js.map +1 -1
  11. package/dist/cjs/components/modals/edit-mentor-modal/tabs/evaluation-tab/evaluate-llm-picker.js +7 -6
  12. package/dist/cjs/components/modals/edit-mentor-modal/tabs/evaluation-tab/evaluate-llm-picker.js.map +1 -1
  13. package/dist/cjs/components/modals/edit-mentor-modal/tabs/evaluation-tab/experiment-detail-modal.js +50 -42
  14. package/dist/cjs/components/modals/edit-mentor-modal/tabs/evaluation-tab/experiment-detail-modal.js.map +1 -1
  15. package/dist/cjs/components/modals/edit-mentor-modal/tabs/evaluation-tab/index.js +64 -33
  16. package/dist/cjs/components/modals/edit-mentor-modal/tabs/evaluation-tab/index.js.map +1 -1
  17. package/dist/cjs/components/modals/edit-mentor-modal/tabs/evaluation-tab/labels.js +68 -46
  18. package/dist/cjs/components/modals/edit-mentor-modal/tabs/evaluation-tab/labels.js.map +1 -1
  19. package/dist/cjs/components/modals/edit-mentor-modal/tabs/evaluation-tab/llm-judge-modal.js +13 -6
  20. package/dist/cjs/components/modals/edit-mentor-modal/tabs/evaluation-tab/llm-judge-modal.js.map +1 -1
  21. package/dist/cjs/components/modals/edit-mentor-modal/tabs/evaluation-tab/start-experiment-modal.js +16 -7
  22. package/dist/cjs/components/modals/edit-mentor-modal/tabs/evaluation-tab/start-experiment-modal.js.map +1 -1
  23. package/dist/cjs/components/modals/edit-mentor-modal/tabs/evaluation-tab/utils.js +14 -0
  24. package/dist/cjs/components/modals/edit-mentor-modal/tabs/evaluation-tab/utils.js.map +1 -1
  25. package/dist/cjs/components/modals/edit-mentor-modal/tabs/human-support-tab/use-support-tickets-with-pagination.js +1 -1
  26. package/dist/cjs/components/modals/edit-mentor-modal/tabs/skills-tab/index.js +1 -1
  27. package/dist/cjs/components/modals/edit-mentor-modal/tabs/tasks-tab/tasks-tab-content.js +1 -1
  28. package/dist/cjs/components/modals/edit-mentor-modal/tabs/tasks-tab/tasks-tab-toolbar.js +1 -1
  29. package/dist/cjs/components/modals/edit-mentor-modal/tabs/tasks-tab.js +1 -1
  30. package/dist/cjs/components/modals/user-profile-modal.js +1 -1
  31. package/dist/cjs/components/platform-sidebar/index.js +2 -0
  32. package/dist/cjs/components/platform-sidebar/index.js.map +1 -1
  33. package/dist/cjs/components/profile/benchmarks/add-items-modal.js +25 -90
  34. package/dist/cjs/components/profile/benchmarks/add-items-modal.js.map +1 -1
  35. package/dist/cjs/components/profile/benchmarks/benchmark-items-modal.js +27 -6
  36. package/dist/cjs/components/profile/benchmarks/benchmark-items-modal.js.map +1 -1
  37. package/dist/cjs/components/profile/benchmarks/create-benchmark-modal.js +164 -18
  38. package/dist/cjs/components/profile/benchmarks/create-benchmark-modal.js.map +1 -1
  39. package/dist/cjs/components/profile/benchmarks/delete-item-confirm.js +9 -8
  40. package/dist/cjs/components/profile/benchmarks/delete-item-confirm.js.map +1 -1
  41. package/dist/cjs/components/profile/benchmarks/evals-ui.js +43 -0
  42. package/dist/cjs/components/profile/benchmarks/evals-ui.js.map +1 -0
  43. package/dist/cjs/components/profile/benchmarks/index.js +29 -10
  44. package/dist/cjs/components/profile/benchmarks/index.js.map +1 -1
  45. package/dist/cjs/components/profile/benchmarks/qa-form.js +236 -0
  46. package/dist/cjs/components/profile/benchmarks/qa-form.js.map +1 -0
  47. package/dist/cjs/components/rich-text-editor.js +33 -12
  48. package/dist/cjs/components/rich-text-editor.js.map +1 -1
  49. package/dist/cjs/components/summernote-text-editor.js +1 -1
  50. package/dist/cjs/components/workflows/workflow-editor.js +28 -8
  51. package/dist/cjs/components/workflows/workflow-editor.js.map +1 -1
  52. package/dist/cjs/i18n/messages/en.json.js +100 -74
  53. package/dist/cjs/i18n/messages/en.json.js.map +1 -1
  54. package/dist/cjs/i18n/messages/es.json.js +81 -55
  55. package/dist/cjs/i18n/messages/es.json.js.map +1 -1
  56. package/dist/cjs/i18n/messages/fr.json.js +82 -56
  57. package/dist/cjs/i18n/messages/fr.json.js.map +1 -1
  58. package/dist/cjs/i18n/messages/zh.json.js +71 -45
  59. package/dist/cjs/i18n/messages/zh.json.js.map +1 -1
  60. package/dist/cjs/index.js +1 -1
  61. package/dist/cjs/lib/sanitize-html.js +1 -1
  62. package/dist/cjs/lib/utils.js +1 -1
  63. package/dist/cjs/node_modules/.pnpm/@tiptap_core@3.34.0_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/index.js +6650 -0
  64. package/dist/cjs/node_modules/.pnpm/@tiptap_core@3.34.0_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/index.js.map +1 -0
  65. package/dist/cjs/node_modules/.pnpm/@tiptap_core@3.34.0_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +59 -0
  66. package/dist/cjs/node_modules/.pnpm/@tiptap_core@3.34.0_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +1 -0
  67. package/dist/cjs/node_modules/.pnpm/@tiptap_core@3.34.0_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js +16 -0
  68. package/dist/cjs/node_modules/.pnpm/@tiptap_core@3.34.0_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js.map +1 -0
  69. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-blockquote@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-blockquote@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-blockquote/dist/index.js +2 -2
  70. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-blockquote@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-blockquote@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-blockquote/dist/index.js.map +1 -1
  71. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-bold@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-bold@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-bold/dist/index.js +2 -2
  72. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-bold@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-bold@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-bold/dist/index.js.map +1 -1
  73. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-code-block@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extension-code-block@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extension-code-block/dist/index.js +1 -1
  74. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-code-block@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extension-code-block@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extension-code-block/dist/index.js.map +1 -1
  75. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-code@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-code@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-code/dist/index.js +1 -1
  76. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-code@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-code@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-code/dist/index.js.map +1 -1
  77. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-document@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-document@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-document/dist/index.js +1 -1
  78. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-document@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-document@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-document/dist/index.js.map +1 -1
  79. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-hard-break@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-hard-break@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-hard-break/dist/index.js +1 -1
  80. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-hard-break@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-hard-break@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-hard-break/dist/index.js.map +1 -1
  81. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-heading@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-heading@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-heading/dist/index.js +1 -1
  82. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-heading@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-heading@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-heading/dist/index.js.map +1 -1
  83. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-horizontal-rule@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extension-horizontal-rule@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +1 -1
  84. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-horizontal-rule@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extension-horizontal-rule@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +1 -1
  85. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-image@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-image@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-image/dist/index.js +1 -1
  86. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-image@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-image@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-image/dist/index.js.map +1 -1
  87. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-italic@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-italic@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-italic/dist/index.js +1 -1
  88. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-italic@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-italic@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-italic/dist/index.js.map +1 -1
  89. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-link@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extension-link@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extension-link/dist/index.js +1 -1
  90. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-link@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extension-link@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extension-link/dist/index.js.map +1 -1
  91. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-list@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extension-list@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extension-list/dist/index.js +1 -1
  92. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-list@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extension-list@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extension-list/dist/index.js.map +1 -1
  93. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-paragraph@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-paragraph@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-paragraph/dist/index.js +1 -1
  94. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-paragraph@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-paragraph@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-paragraph/dist/index.js.map +1 -1
  95. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-placeholder@3.20.4_@tiptap_extensions@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4_ → @tiptap_extension-placeholder@3.20.4_@tiptap_extensions@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-placeholder/dist/index.js +1 -1
  96. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-placeholder@3.20.4_@tiptap_extensions@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4_ → @tiptap_extension-placeholder@3.20.4_@tiptap_extensions@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-placeholder/dist/index.js.map +1 -1
  97. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-strike@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-strike@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-strike/dist/index.js +1 -1
  98. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-strike@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-strike@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-strike/dist/index.js.map +1 -1
  99. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-table-cell@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.20.4__e5a3c3ff8b554aab527bcd6db879f930 → @tiptap_extension-table-cell@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.34.0__9df690ad40c269aaedbdba7ccdf2b3c5}/node_modules/@tiptap/extension-table-cell/dist/index.js +1 -1
  100. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-table-cell@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.20.4__e5a3c3ff8b554aab527bcd6db879f930 → @tiptap_extension-table-cell@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.34.0__9df690ad40c269aaedbdba7ccdf2b3c5}/node_modules/@tiptap/extension-table-cell/dist/index.js.map +1 -1
  101. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-table-header@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.20._c6a57e4e630f72502685143ac4e5ec96 → @tiptap_extension-table-header@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.34._e738836bb39716a2c7e36c23583c8027}/node_modules/@tiptap/extension-table-header/dist/index.js +1 -1
  102. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-table-header@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.20._c6a57e4e630f72502685143ac4e5ec96 → @tiptap_extension-table-header@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.34._e738836bb39716a2c7e36c23583c8027}/node_modules/@tiptap/extension-table-header/dist/index.js.map +1 -1
  103. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-table-row@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.20.4_@_65ee6090c5cc8114f0f28fc8fa71a1d1 → @tiptap_extension-table-row@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.34.0_@_5ee469de7f353d0b0b7ac18cdf819cfe}/node_modules/@tiptap/extension-table-row/dist/index.js +1 -1
  104. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-table-row@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.20.4_@_65ee6090c5cc8114f0f28fc8fa71a1d1 → @tiptap_extension-table-row@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.34.0_@_5ee469de7f353d0b0b7ac18cdf819cfe}/node_modules/@tiptap/extension-table-row/dist/index.js.map +1 -1
  105. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-table@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extension-table@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extension-table/dist/index.js +1 -1
  106. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-table@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extension-table@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extension-table/dist/index.js.map +1 -1
  107. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-text-align@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-text-align@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-text-align/dist/index.js +1 -1
  108. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-text-align@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-text-align@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-text-align/dist/index.js.map +1 -1
  109. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-text-style@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-text-style@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-text-style/dist/index.js +1 -1
  110. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-text-style@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-text-style@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-text-style/dist/index.js.map +1 -1
  111. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-text@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-text@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-text/dist/index.js +1 -1
  112. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-text@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-text@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-text/dist/index.js.map +1 -1
  113. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-underline@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-underline@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-underline/dist/index.js +1 -1
  114. package/dist/cjs/node_modules/.pnpm/{@tiptap_extension-underline@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-underline@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-underline/dist/index.js.map +1 -1
  115. package/dist/cjs/node_modules/.pnpm/{@tiptap_extensions@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extensions@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extensions/dist/index.js +1 -1
  116. package/dist/cjs/node_modules/.pnpm/{@tiptap_extensions@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extensions@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extensions/dist/index.js.map +1 -1
  117. package/dist/cjs/node_modules/.pnpm/{@tiptap_react@3.14.0_@floating-ui_dom@1.7.6_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tip_17d91a0ec98b7b4802004f8a5d3f7d72 → @tiptap_react@3.14.0_@floating-ui_dom@1.7.6_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tip_3f15bb542eb86077efc89f6845872e48}/node_modules/@tiptap/react/dist/index.js +5 -8
  118. package/dist/cjs/node_modules/.pnpm/{@tiptap_react@3.14.0_@floating-ui_dom@1.7.6_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tip_17d91a0ec98b7b4802004f8a5d3f7d72 → @tiptap_react@3.14.0_@floating-ui_dom@1.7.6_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tip_3f15bb542eb86077efc89f6845872e48}/node_modules/@tiptap/react/dist/index.js.map +1 -1
  119. package/dist/cjs/node_modules/.pnpm/@tiptap_starter-kit@3.14.0/node_modules/@tiptap/starter-kit/dist/index.js +17 -17
  120. package/dist/cjs/node_modules/.pnpm/css-mediaquery@0.1.2/node_modules/css-mediaquery/index.js +1 -1
  121. package/dist/cjs/node_modules/.pnpm/dompurify@3.4.18/node_modules/dompurify/dist/purify.es.js +2403 -0
  122. package/dist/cjs/node_modules/.pnpm/dompurify@3.4.18/node_modules/dompurify/dist/purify.es.js.map +1 -0
  123. package/dist/cjs/node_modules/.pnpm/matchmediaquery@0.4.2/node_modules/matchmediaquery/index.js +1 -1
  124. package/dist/cjs/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js +1 -1
  125. package/dist/cjs/node_modules/.pnpm/prosemirror-commands@1.7.1/node_modules/prosemirror-commands/dist/index.js +47 -47
  126. package/dist/cjs/node_modules/.pnpm/prosemirror-commands@1.7.1/node_modules/prosemirror-commands/dist/index.js.map +1 -1
  127. package/dist/cjs/node_modules/.pnpm/prosemirror-history@1.5.0/node_modules/prosemirror-history/dist/index.js +9 -0
  128. package/dist/cjs/node_modules/.pnpm/prosemirror-history@1.5.0/node_modules/prosemirror-history/dist/index.js.map +1 -1
  129. package/dist/cjs/web-containers/tsconfig.build.tsbuildinfo +1 -1
  130. package/dist/esm/_virtual/index2.js +2 -2
  131. package/dist/esm/_virtual/index3.js +2 -2
  132. package/dist/esm/components/activity-tab/activity-empty-state.js +2 -2
  133. package/dist/esm/components/activity-tab/activity-empty-state.js.map +1 -1
  134. package/dist/esm/components/canvas/canvas-rich-text-editor.js +8 -8
  135. package/dist/esm/components/canvas/tiptap-math-extension.js +3 -3
  136. package/dist/esm/components/canvas/tiptap-math-extension.js.map +1 -1
  137. package/dist/esm/components/modals/edit-mentor-modal/tabs/evaluation-tab/benchmark-combobox.js +2 -2
  138. package/dist/esm/components/modals/edit-mentor-modal/tabs/evaluation-tab/benchmark-combobox.js.map +1 -1
  139. package/dist/esm/components/modals/edit-mentor-modal/tabs/evaluation-tab/delete-experiment-modal.js +6 -6
  140. package/dist/esm/components/modals/edit-mentor-modal/tabs/evaluation-tab/delete-experiment-modal.js.map +1 -1
  141. package/dist/esm/components/modals/edit-mentor-modal/tabs/evaluation-tab/evaluate-llm-picker.js +7 -6
  142. package/dist/esm/components/modals/edit-mentor-modal/tabs/evaluation-tab/evaluate-llm-picker.js.map +1 -1
  143. package/dist/esm/components/modals/edit-mentor-modal/tabs/evaluation-tab/experiment-detail-modal.js +51 -43
  144. package/dist/esm/components/modals/edit-mentor-modal/tabs/evaluation-tab/experiment-detail-modal.js.map +1 -1
  145. package/dist/esm/components/modals/edit-mentor-modal/tabs/evaluation-tab/index.js +68 -37
  146. package/dist/esm/components/modals/edit-mentor-modal/tabs/evaluation-tab/index.js.map +1 -1
  147. package/dist/esm/components/modals/edit-mentor-modal/tabs/evaluation-tab/labels.js +68 -46
  148. package/dist/esm/components/modals/edit-mentor-modal/tabs/evaluation-tab/labels.js.map +1 -1
  149. package/dist/esm/components/modals/edit-mentor-modal/tabs/evaluation-tab/llm-judge-modal.js +13 -6
  150. package/dist/esm/components/modals/edit-mentor-modal/tabs/evaluation-tab/llm-judge-modal.js.map +1 -1
  151. package/dist/esm/components/modals/edit-mentor-modal/tabs/evaluation-tab/start-experiment-modal.js +16 -7
  152. package/dist/esm/components/modals/edit-mentor-modal/tabs/evaluation-tab/start-experiment-modal.js.map +1 -1
  153. package/dist/esm/components/modals/edit-mentor-modal/tabs/evaluation-tab/utils.js +14 -1
  154. package/dist/esm/components/modals/edit-mentor-modal/tabs/evaluation-tab/utils.js.map +1 -1
  155. package/dist/esm/components/modals/edit-mentor-modal/tabs/human-support-tab/use-support-tickets-with-pagination.js +1 -1
  156. package/dist/esm/components/modals/edit-mentor-modal/tabs/skills-tab/index.js +1 -1
  157. package/dist/esm/components/modals/edit-mentor-modal/tabs/tasks-tab/tasks-tab-content.js +1 -1
  158. package/dist/esm/components/modals/edit-mentor-modal/tabs/tasks-tab/tasks-tab-toolbar.js +1 -1
  159. package/dist/esm/components/modals/edit-mentor-modal/tabs/tasks-tab.js +1 -1
  160. package/dist/esm/components/modals/user-profile-modal.js +1 -1
  161. package/dist/esm/components/platform-sidebar/index.js +2 -0
  162. package/dist/esm/components/platform-sidebar/index.js.map +1 -1
  163. package/dist/esm/components/profile/benchmarks/add-items-modal.js +26 -91
  164. package/dist/esm/components/profile/benchmarks/add-items-modal.js.map +1 -1
  165. package/dist/esm/components/profile/benchmarks/benchmark-items-modal.js +28 -7
  166. package/dist/esm/components/profile/benchmarks/benchmark-items-modal.js.map +1 -1
  167. package/dist/esm/components/profile/benchmarks/create-benchmark-modal.js +166 -20
  168. package/dist/esm/components/profile/benchmarks/create-benchmark-modal.js.map +1 -1
  169. package/dist/esm/components/profile/benchmarks/delete-item-confirm.js +10 -9
  170. package/dist/esm/components/profile/benchmarks/delete-item-confirm.js.map +1 -1
  171. package/dist/esm/components/profile/benchmarks/evals-ui.js +39 -0
  172. package/dist/esm/components/profile/benchmarks/evals-ui.js.map +1 -0
  173. package/dist/esm/components/profile/benchmarks/index.js +30 -11
  174. package/dist/esm/components/profile/benchmarks/index.js.map +1 -1
  175. package/dist/esm/components/profile/benchmarks/qa-form.js +233 -0
  176. package/dist/esm/components/profile/benchmarks/qa-form.js.map +1 -0
  177. package/dist/esm/components/rich-text-editor.js +37 -16
  178. package/dist/esm/components/rich-text-editor.js.map +1 -1
  179. package/dist/esm/components/summernote-text-editor.js +2 -2
  180. package/dist/esm/components/summernote-text-editor.js.map +1 -1
  181. package/dist/esm/components/workflows/workflow-editor.js +28 -8
  182. package/dist/esm/components/workflows/workflow-editor.js.map +1 -1
  183. package/dist/esm/i18n/messages/en.json.js +100 -74
  184. package/dist/esm/i18n/messages/en.json.js.map +1 -1
  185. package/dist/esm/i18n/messages/es.json.js +81 -55
  186. package/dist/esm/i18n/messages/es.json.js.map +1 -1
  187. package/dist/esm/i18n/messages/fr.json.js +82 -56
  188. package/dist/esm/i18n/messages/fr.json.js.map +1 -1
  189. package/dist/esm/i18n/messages/zh.json.js +71 -45
  190. package/dist/esm/i18n/messages/zh.json.js.map +1 -1
  191. package/dist/esm/index.js +1 -1
  192. package/dist/esm/lib/sanitize-html.js +2 -2
  193. package/dist/esm/lib/sanitize-html.js.map +1 -1
  194. package/dist/esm/lib/utils.js +1 -1
  195. package/dist/esm/node_modules/.pnpm/@tiptap_core@3.34.0_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/index.js +6554 -0
  196. package/dist/esm/node_modules/.pnpm/@tiptap_core@3.34.0_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/index.js.map +1 -0
  197. package/dist/esm/node_modules/.pnpm/@tiptap_core@3.34.0_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +55 -0
  198. package/dist/esm/node_modules/.pnpm/@tiptap_core@3.34.0_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +1 -0
  199. package/dist/esm/node_modules/.pnpm/@tiptap_core@3.34.0_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js +14 -0
  200. package/dist/esm/node_modules/.pnpm/@tiptap_core@3.34.0_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js.map +1 -0
  201. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-blockquote@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-blockquote@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-blockquote/dist/index.js +3 -3
  202. package/dist/esm/node_modules/.pnpm/@tiptap_extension-blockquote@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_/node_modules/@tiptap/extension-blockquote/dist/index.js.map +1 -0
  203. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-bold@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-bold@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-bold/dist/index.js +2 -2
  204. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-bold@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-bold@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-bold/dist/index.js.map +1 -1
  205. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-code-block@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extension-code-block@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extension-code-block/dist/index.js +2 -2
  206. package/dist/esm/node_modules/.pnpm/@tiptap_extension-code-block@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4/node_modules/@tiptap/extension-code-block/dist/index.js.map +1 -0
  207. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-code@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-code@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-code/dist/index.js +1 -1
  208. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-code@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-code@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-code/dist/index.js.map +1 -1
  209. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-document@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-document@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-document/dist/index.js +2 -2
  210. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-document@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-document@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-document/dist/index.js.map +1 -1
  211. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-hard-break@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-hard-break@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-hard-break/dist/index.js +2 -2
  212. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-hard-break@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-hard-break@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-hard-break/dist/index.js.map +1 -1
  213. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-heading@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-heading@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-heading/dist/index.js +2 -2
  214. package/dist/esm/node_modules/.pnpm/@tiptap_extension-heading@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_/node_modules/@tiptap/extension-heading/dist/index.js.map +1 -0
  215. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-horizontal-rule@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extension-horizontal-rule@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +2 -2
  216. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-horizontal-rule@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extension-horizontal-rule@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +1 -1
  217. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-image@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-image@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-image/dist/index.js +2 -2
  218. package/dist/esm/node_modules/.pnpm/@tiptap_extension-image@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_/node_modules/@tiptap/extension-image/dist/index.js.map +1 -0
  219. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-italic@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-italic@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-italic/dist/index.js +1 -1
  220. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-italic@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-italic@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-italic/dist/index.js.map +1 -1
  221. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-link@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extension-link@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extension-link/dist/index.js +1 -1
  222. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-link@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extension-link@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extension-link/dist/index.js.map +1 -1
  223. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-list@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extension-list@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extension-list/dist/index.js +6 -6
  224. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-list@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extension-list@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extension-list/dist/index.js.map +1 -1
  225. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-paragraph@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-paragraph@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-paragraph/dist/index.js +2 -2
  226. package/dist/esm/node_modules/.pnpm/@tiptap_extension-paragraph@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_/node_modules/@tiptap/extension-paragraph/dist/index.js.map +1 -0
  227. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-placeholder@3.20.4_@tiptap_extensions@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4_ → @tiptap_extension-placeholder@3.20.4_@tiptap_extensions@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-placeholder/dist/index.js +1 -1
  228. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-placeholder@3.20.4_@tiptap_extensions@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4_ → @tiptap_extension-placeholder@3.20.4_@tiptap_extensions@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-placeholder/dist/index.js.map +1 -1
  229. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-strike@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-strike@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-strike/dist/index.js +1 -1
  230. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-strike@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-strike@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-strike/dist/index.js.map +1 -1
  231. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-table-cell@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.20.4__e5a3c3ff8b554aab527bcd6db879f930 → @tiptap_extension-table-cell@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.34.0__9df690ad40c269aaedbdba7ccdf2b3c5}/node_modules/@tiptap/extension-table-cell/dist/index.js +1 -1
  232. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-table-cell@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.20.4__e5a3c3ff8b554aab527bcd6db879f930 → @tiptap_extension-table-cell@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.34.0__9df690ad40c269aaedbdba7ccdf2b3c5}/node_modules/@tiptap/extension-table-cell/dist/index.js.map +1 -1
  233. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-table-header@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.20._c6a57e4e630f72502685143ac4e5ec96 → @tiptap_extension-table-header@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.34._e738836bb39716a2c7e36c23583c8027}/node_modules/@tiptap/extension-table-header/dist/index.js +1 -1
  234. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-table-header@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.20._c6a57e4e630f72502685143ac4e5ec96 → @tiptap_extension-table-header@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.34._e738836bb39716a2c7e36c23583c8027}/node_modules/@tiptap/extension-table-header/dist/index.js.map +1 -1
  235. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-table-row@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.20.4_@_65ee6090c5cc8114f0f28fc8fa71a1d1 → @tiptap_extension-table-row@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.34.0_@_5ee469de7f353d0b0b7ac18cdf819cfe}/node_modules/@tiptap/extension-table-row/dist/index.js +1 -1
  236. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-table-row@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.20.4_@_65ee6090c5cc8114f0f28fc8fa71a1d1 → @tiptap_extension-table-row@3.20.4_@tiptap_extension-table@3.20.4_@tiptap_core@3.34.0_@_5ee469de7f353d0b0b7ac18cdf819cfe}/node_modules/@tiptap/extension-table-row/dist/index.js.map +1 -1
  237. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-table@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extension-table@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extension-table/dist/index.js +5 -5
  238. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-table@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extension-table@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extension-table/dist/index.js.map +1 -1
  239. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-text-align@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-text-align@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-text-align/dist/index.js +1 -1
  240. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-text-align@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-text-align@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-text-align/dist/index.js.map +1 -1
  241. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-text-style@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-text-style@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-text-style/dist/index.js +1 -1
  242. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-text-style@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-text-style@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-text-style/dist/index.js.map +1 -1
  243. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-text@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-text@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-text/dist/index.js +2 -2
  244. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-text@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-text@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-text/dist/index.js.map +1 -1
  245. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-underline@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-underline@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-underline/dist/index.js +1 -1
  246. package/dist/esm/node_modules/.pnpm/{@tiptap_extension-underline@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_ → @tiptap_extension-underline@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4_}/node_modules/@tiptap/extension-underline/dist/index.js.map +1 -1
  247. package/dist/esm/node_modules/.pnpm/{@tiptap_extensions@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extensions@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extensions/dist/index.js +1 -1
  248. package/dist/esm/node_modules/.pnpm/{@tiptap_extensions@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4 → @tiptap_extensions@3.20.4_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4}/node_modules/@tiptap/extensions/dist/index.js.map +1 -1
  249. package/dist/esm/node_modules/.pnpm/{@tiptap_react@3.14.0_@floating-ui_dom@1.7.6_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tip_17d91a0ec98b7b4802004f8a5d3f7d72 → @tiptap_react@3.14.0_@floating-ui_dom@1.7.6_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tip_3f15bb542eb86077efc89f6845872e48}/node_modules/@tiptap/react/dist/index.js +2 -2
  250. package/dist/esm/node_modules/.pnpm/{@tiptap_react@3.14.0_@floating-ui_dom@1.7.6_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tip_17d91a0ec98b7b4802004f8a5d3f7d72 → @tiptap_react@3.14.0_@floating-ui_dom@1.7.6_@tiptap_core@3.34.0_@tiptap_pm@3.20.4__@tip_3f15bb542eb86077efc89f6845872e48}/node_modules/@tiptap/react/dist/index.js.map +1 -1
  251. package/dist/esm/node_modules/.pnpm/@tiptap_starter-kit@3.14.0/node_modules/@tiptap/starter-kit/dist/index.js +17 -17
  252. package/dist/esm/node_modules/.pnpm/css-mediaquery@0.1.2/node_modules/css-mediaquery/index.js +1 -1
  253. package/dist/esm/node_modules/.pnpm/dompurify@3.4.18/node_modules/dompurify/dist/purify.es.js +2401 -0
  254. package/dist/esm/node_modules/.pnpm/dompurify@3.4.18/node_modules/dompurify/dist/purify.es.js.map +1 -0
  255. package/dist/esm/node_modules/.pnpm/matchmediaquery@0.4.2/node_modules/matchmediaquery/index.js +1 -1
  256. package/dist/esm/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js +1 -1
  257. package/dist/esm/node_modules/.pnpm/prosemirror-commands@1.7.1/node_modules/prosemirror-commands/dist/index.js +2 -2
  258. package/dist/esm/node_modules/.pnpm/prosemirror-history@1.5.0/node_modules/prosemirror-history/dist/index.js +9 -1
  259. package/dist/esm/node_modules/.pnpm/prosemirror-history@1.5.0/node_modules/prosemirror-history/dist/index.js.map +1 -1
  260. package/dist/esm/node_modules/.pnpm/prosemirror-schema-list@1.5.1/node_modules/prosemirror-schema-list/dist/index.js +1 -1
  261. package/dist/esm/web-containers/tsconfig.build.tsbuildinfo +1 -1
  262. package/dist/next/index.d.ts +26 -11
  263. package/dist/package.json +1 -1
  264. package/package.json +4 -4
  265. package/dist/cjs/node_modules/.pnpm/@tiptap_core@3.20.4_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/index.js +0 -6229
  266. package/dist/cjs/node_modules/.pnpm/@tiptap_core@3.20.4_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/index.js.map +0 -1
  267. package/dist/cjs/node_modules/.pnpm/@tiptap_core@3.20.4_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +0 -23
  268. package/dist/cjs/node_modules/.pnpm/@tiptap_core@3.20.4_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +0 -1
  269. package/dist/cjs/node_modules/.pnpm/dompurify@3.4.11/node_modules/dompurify/dist/purify.es.js +0 -2251
  270. package/dist/cjs/node_modules/.pnpm/dompurify@3.4.11/node_modules/dompurify/dist/purify.es.js.map +0 -1
  271. package/dist/esm/node_modules/.pnpm/@tiptap_core@3.20.4_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/index.js +0 -6130
  272. package/dist/esm/node_modules/.pnpm/@tiptap_core@3.20.4_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/index.js.map +0 -1
  273. package/dist/esm/node_modules/.pnpm/@tiptap_core@3.20.4_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +0 -17
  274. package/dist/esm/node_modules/.pnpm/@tiptap_core@3.20.4_@tiptap_pm@3.20.4/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +0 -1
  275. package/dist/esm/node_modules/.pnpm/@tiptap_extension-blockquote@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_/node_modules/@tiptap/extension-blockquote/dist/index.js.map +0 -1
  276. package/dist/esm/node_modules/.pnpm/@tiptap_extension-code-block@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4__@tiptap_pm@3.20.4/node_modules/@tiptap/extension-code-block/dist/index.js.map +0 -1
  277. package/dist/esm/node_modules/.pnpm/@tiptap_extension-heading@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_/node_modules/@tiptap/extension-heading/dist/index.js.map +0 -1
  278. package/dist/esm/node_modules/.pnpm/@tiptap_extension-image@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_/node_modules/@tiptap/extension-image/dist/index.js.map +0 -1
  279. package/dist/esm/node_modules/.pnpm/@tiptap_extension-paragraph@3.20.4_@tiptap_core@3.20.4_@tiptap_pm@3.20.4_/node_modules/@tiptap/extension-paragraph/dist/index.js.map +0 -1
  280. package/dist/esm/node_modules/.pnpm/dompurify@3.4.11/node_modules/dompurify/dist/purify.es.js +0 -2249
  281. package/dist/esm/node_modules/.pnpm/dompurify@3.4.11/node_modules/dompurify/dist/purify.es.js.map +0 -1
@@ -1,2251 +0,0 @@
1
- 'use strict';
2
-
3
- /*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE */
4
-
5
- function _arrayLikeToArray(r, a) {
6
- (null == a || a > r.length) && (a = r.length);
7
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
8
- return n;
9
- }
10
- function _arrayWithHoles(r) {
11
- if (Array.isArray(r)) return r;
12
- }
13
- function _iterableToArrayLimit(r, l) {
14
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
15
- if (null != t) {
16
- var e,
17
- n,
18
- i,
19
- u,
20
- a = [],
21
- f = true,
22
- o = false;
23
- try {
24
- if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
25
- } catch (r) {
26
- o = true, n = r;
27
- } finally {
28
- try {
29
- if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
30
- } finally {
31
- if (o) throw n;
32
- }
33
- }
34
- return a;
35
- }
36
- }
37
- function _nonIterableRest() {
38
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
39
- }
40
- function _slicedToArray(r, e) {
41
- return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
42
- }
43
- function _unsupportedIterableToArray(r, a) {
44
- if (r) {
45
- if ("string" == typeof r) return _arrayLikeToArray(r, a);
46
- var t = {}.toString.call(r).slice(8, -1);
47
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
48
- }
49
- }
50
-
51
- const entries = Object.entries,
52
- setPrototypeOf = Object.setPrototypeOf,
53
- isFrozen = Object.isFrozen,
54
- getPrototypeOf = Object.getPrototypeOf,
55
- getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
56
- let freeze = Object.freeze,
57
- seal = Object.seal,
58
- create = Object.create; // eslint-disable-line import/no-mutable-exports
59
- let _ref = typeof Reflect !== 'undefined' && Reflect,
60
- apply = _ref.apply,
61
- construct = _ref.construct;
62
- if (!freeze) {
63
- freeze = function freeze(x) {
64
- return x;
65
- };
66
- }
67
- if (!seal) {
68
- seal = function seal(x) {
69
- return x;
70
- };
71
- }
72
- if (!apply) {
73
- apply = function apply(func, thisArg) {
74
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
75
- args[_key - 2] = arguments[_key];
76
- }
77
- return func.apply(thisArg, args);
78
- };
79
- }
80
- if (!construct) {
81
- construct = function construct(Func) {
82
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
83
- args[_key2 - 1] = arguments[_key2];
84
- }
85
- return new Func(...args);
86
- };
87
- }
88
- const arrayForEach = unapply(Array.prototype.forEach);
89
- const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
90
- const arrayPop = unapply(Array.prototype.pop);
91
- const arrayPush = unapply(Array.prototype.push);
92
- const arraySplice = unapply(Array.prototype.splice);
93
- const arrayIsArray = Array.isArray;
94
- const stringToLowerCase = unapply(String.prototype.toLowerCase);
95
- const stringToString = unapply(String.prototype.toString);
96
- const stringMatch = unapply(String.prototype.match);
97
- const stringReplace = unapply(String.prototype.replace);
98
- const stringIndexOf = unapply(String.prototype.indexOf);
99
- const stringTrim = unapply(String.prototype.trim);
100
- const numberToString = unapply(Number.prototype.toString);
101
- const booleanToString = unapply(Boolean.prototype.toString);
102
- const bigintToString = typeof BigInt === 'undefined' ? null : unapply(BigInt.prototype.toString);
103
- const symbolToString = typeof Symbol === 'undefined' ? null : unapply(Symbol.prototype.toString);
104
- const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
105
- const objectToString = unapply(Object.prototype.toString);
106
- const regExpTest = unapply(RegExp.prototype.test);
107
- const typeErrorCreate = unconstruct(TypeError);
108
- /**
109
- * Creates a new function that calls the given function with a specified thisArg and arguments.
110
- *
111
- * @param func - The function to be wrapped and called.
112
- * @returns A new function that calls the given function with a specified thisArg and arguments.
113
- */
114
- function unapply(func) {
115
- return function (thisArg) {
116
- if (thisArg instanceof RegExp) {
117
- thisArg.lastIndex = 0;
118
- }
119
- for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
120
- args[_key3 - 1] = arguments[_key3];
121
- }
122
- return apply(func, thisArg, args);
123
- };
124
- }
125
- /**
126
- * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
127
- *
128
- * @param func - The constructor function to be wrapped and called.
129
- * @returns A new function that constructs an instance of the given constructor function with the provided arguments.
130
- */
131
- function unconstruct(Func) {
132
- return function () {
133
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
134
- args[_key4] = arguments[_key4];
135
- }
136
- return construct(Func, args);
137
- };
138
- }
139
- /**
140
- * Add properties to a lookup table
141
- *
142
- * @param set - The set to which elements will be added.
143
- * @param array - The array containing elements to be added to the set.
144
- * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
145
- * @returns The modified set with added elements.
146
- */
147
- function addToSet(set, array) {
148
- let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;
149
- if (setPrototypeOf) {
150
- // Make 'in' and truthy checks like Boolean(set.constructor)
151
- // independent of any properties defined on Object.prototype.
152
- // Prevent prototype setters from intercepting set as a this value.
153
- setPrototypeOf(set, null);
154
- }
155
- if (!arrayIsArray(array)) {
156
- return set;
157
- }
158
- let l = array.length;
159
- while (l--) {
160
- let element = array[l];
161
- if (typeof element === 'string') {
162
- const lcElement = transformCaseFunc(element);
163
- if (lcElement !== element) {
164
- // Config presets (e.g. tags.js, attrs.js) are immutable.
165
- if (!isFrozen(array)) {
166
- array[l] = lcElement;
167
- }
168
- element = lcElement;
169
- }
170
- }
171
- set[element] = true;
172
- }
173
- return set;
174
- }
175
- /**
176
- * Clean up an array to harden against CSPP
177
- *
178
- * @param array - The array to be cleaned.
179
- * @returns The cleaned version of the array
180
- */
181
- function cleanArray(array) {
182
- for (let index = 0; index < array.length; index++) {
183
- const isPropertyExist = objectHasOwnProperty(array, index);
184
- if (!isPropertyExist) {
185
- array[index] = null;
186
- }
187
- }
188
- return array;
189
- }
190
- /**
191
- * Shallow clone an object
192
- *
193
- * @param object - The object to be cloned.
194
- * @returns A new object that copies the original.
195
- */
196
- function clone(object) {
197
- const newObject = create(null);
198
- for (const _ref2 of entries(object)) {
199
- var _ref3 = _slicedToArray(_ref2, 2);
200
- const property = _ref3[0];
201
- const value = _ref3[1];
202
- const isPropertyExist = objectHasOwnProperty(object, property);
203
- if (isPropertyExist) {
204
- if (arrayIsArray(value)) {
205
- newObject[property] = cleanArray(value);
206
- } else if (value && typeof value === 'object' && value.constructor === Object) {
207
- newObject[property] = clone(value);
208
- } else {
209
- newObject[property] = value;
210
- }
211
- }
212
- }
213
- return newObject;
214
- }
215
- /**
216
- * Convert non-node values into strings without depending on direct property access.
217
- *
218
- * @param value - The value to stringify.
219
- * @returns A string representation of the provided value.
220
- */
221
- function stringifyValue(value) {
222
- switch (typeof value) {
223
- case 'string':
224
- {
225
- return value;
226
- }
227
- case 'number':
228
- {
229
- return numberToString(value);
230
- }
231
- case 'boolean':
232
- {
233
- return booleanToString(value);
234
- }
235
- case 'bigint':
236
- {
237
- return bigintToString ? bigintToString(value) : '0';
238
- }
239
- case 'symbol':
240
- {
241
- return symbolToString ? symbolToString(value) : 'Symbol()';
242
- }
243
- case 'undefined':
244
- {
245
- return objectToString(value);
246
- }
247
- case 'function':
248
- case 'object':
249
- {
250
- if (value === null) {
251
- return objectToString(value);
252
- }
253
- const valueAsRecord = value;
254
- const valueToString = lookupGetter(valueAsRecord, 'toString');
255
- if (typeof valueToString === 'function') {
256
- const stringified = valueToString(valueAsRecord);
257
- return typeof stringified === 'string' ? stringified : objectToString(stringified);
258
- }
259
- return objectToString(value);
260
- }
261
- default:
262
- {
263
- return objectToString(value);
264
- }
265
- }
266
- }
267
- /**
268
- * This method automatically checks if the prop is function or getter and behaves accordingly.
269
- *
270
- * @param object - The object to look up the getter function in its prototype chain.
271
- * @param prop - The property name for which to find the getter function.
272
- * @returns The getter function found in the prototype chain or a fallback function.
273
- */
274
- function lookupGetter(object, prop) {
275
- while (object !== null) {
276
- const desc = getOwnPropertyDescriptor(object, prop);
277
- if (desc) {
278
- if (desc.get) {
279
- return unapply(desc.get);
280
- }
281
- if (typeof desc.value === 'function') {
282
- return unapply(desc.value);
283
- }
284
- }
285
- object = getPrototypeOf(object);
286
- }
287
- function fallbackValue() {
288
- return null;
289
- }
290
- return fallbackValue;
291
- }
292
- function isRegex(value) {
293
- try {
294
- regExpTest(value, '');
295
- return true;
296
- } catch (_unused) {
297
- return false;
298
- }
299
- }
300
-
301
- const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'search', 'section', 'select', 'shadow', 'slot', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
302
- const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'enterkeyhint', 'exportparts', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'inputmode', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'part', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
303
- const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
304
- // List of SVG elements that are disallowed by default.
305
- // We still need to know them so that we can do namespace
306
- // checks properly in case one wants to add them to
307
- // allow-list.
308
- const svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
309
- const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']);
310
- // Similarly to SVG, we want to know all MathML elements,
311
- // even those that we disallow by default.
312
- const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
313
- const text = freeze(['#text']);
314
-
315
- const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'command', 'commandfor', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'exportparts', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inert', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'part', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns']);
316
- const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'mask-type', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
317
- const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnalign', 'columnlines', 'columnspacing', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lquote', 'lspace', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
318
- const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
319
-
320
- const MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
321
- const ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
322
- const TMPLIT_EXPR = seal(/\${[\w\W]*/g);
323
- const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); // eslint-disable-line no-useless-escape
324
- const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
325
- const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
326
- );
327
- const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
328
- const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
329
- );
330
- const DOCTYPE_NAME = seal(/^html$/i);
331
- const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
332
- // Markup-significant character probes used by _sanitizeElements.
333
- // Shared module-level instances are safe despite the sticky /g flags:
334
- // unapply() resets lastIndex for RegExp receivers before every call.
335
- const ELEMENT_MARKUP_PROBE = seal(/<[/\w!]/g);
336
- const COMMENT_MARKUP_PROBE = seal(/<[/\w]/g);
337
- const FALLBACK_TAG_CLOSE = seal(/<\/no(script|embed|frames)/i);
338
- const SELF_CLOSING_TAG = seal(/\/>/i);
339
-
340
- // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
341
- const NODE_TYPE = {
342
- element: 1,
343
- attribute: 2,
344
- text: 3,
345
- cdataSection: 4,
346
- entityReference: 5,
347
- // Deprecated
348
- entityNode: 6,
349
- // Deprecated
350
- processingInstruction: 7,
351
- comment: 8,
352
- document: 9,
353
- documentType: 10,
354
- documentFragment: 11,
355
- notation: 12 // Deprecated
356
- };
357
- const getGlobal = function getGlobal() {
358
- return typeof window === 'undefined' ? null : window;
359
- };
360
- /**
361
- * Creates a no-op policy for internal use only.
362
- * Don't export this function outside this module!
363
- * @param trustedTypes The policy factory.
364
- * @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
365
- * @return The policy created (or null, if Trusted Types
366
- * are not supported or creating the policy failed).
367
- */
368
- const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
369
- if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
370
- return null;
371
- }
372
- // Allow the callers to control the unique policy name
373
- // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
374
- // Policy creation with duplicate names throws in Trusted Types.
375
- let suffix = null;
376
- const ATTR_NAME = 'data-tt-policy-suffix';
377
- if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
378
- suffix = purifyHostElement.getAttribute(ATTR_NAME);
379
- }
380
- const policyName = 'dompurify' + (suffix ? '#' + suffix : '');
381
- try {
382
- return trustedTypes.createPolicy(policyName, {
383
- createHTML(html) {
384
- return html;
385
- },
386
- createScriptURL(scriptUrl) {
387
- return scriptUrl;
388
- }
389
- });
390
- } catch (_) {
391
- // Policy creation failed (most likely another DOMPurify script has
392
- // already run). Skip creating the policy, as this will only cause errors
393
- // if TT are enforced.
394
- console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
395
- return null;
396
- }
397
- };
398
- const _createHooksMap = function _createHooksMap() {
399
- return {
400
- afterSanitizeAttributes: [],
401
- afterSanitizeElements: [],
402
- afterSanitizeShadowDOM: [],
403
- beforeSanitizeAttributes: [],
404
- beforeSanitizeElements: [],
405
- beforeSanitizeShadowDOM: [],
406
- uponSanitizeAttribute: [],
407
- uponSanitizeElement: [],
408
- uponSanitizeShadowNode: []
409
- };
410
- };
411
- /**
412
- * Resolve a set-valued configuration option: a fresh set built from
413
- * cfg[key] when it is an own array property (seeded with a clone of
414
- * options.base when given, case-normalized via options.transform),
415
- * the fallback set otherwise.
416
- *
417
- * @param cfg the cloned, prototype-free configuration object
418
- * @param key the configuration property to read
419
- * @param fallback the set to use when the option is absent or not an array
420
- * @param options transform and optional base set to merge into
421
- * @returns the resolved set
422
- */
423
- const _resolveSetOption = function _resolveSetOption(cfg, key, fallback, options) {
424
- return objectHasOwnProperty(cfg, key) && arrayIsArray(cfg[key]) ? addToSet(options.base ? clone(options.base) : {}, cfg[key], options.transform) : fallback;
425
- };
426
- function createDOMPurify() {
427
- let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
428
- const DOMPurify = root => createDOMPurify(root);
429
- DOMPurify.version = '3.4.11';
430
- DOMPurify.removed = [];
431
- if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
432
- // Not running in a browser, provide a factory function
433
- // so that you can pass your own Window
434
- DOMPurify.isSupported = false;
435
- return DOMPurify;
436
- }
437
- let document = window.document;
438
- const originalDocument = document;
439
- const currentScript = originalDocument.currentScript;
440
- window.DocumentFragment;
441
- const HTMLTemplateElement = window.HTMLTemplateElement,
442
- Node = window.Node,
443
- Element = window.Element,
444
- NodeFilter = window.NodeFilter,
445
- _window$NamedNodeMap = window.NamedNodeMap;
446
- _window$NamedNodeMap === void 0 ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap;
447
- window.HTMLFormElement;
448
- const DOMParser = window.DOMParser,
449
- trustedTypes = window.trustedTypes;
450
- const ElementPrototype = Element.prototype;
451
- const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
452
- const remove = lookupGetter(ElementPrototype, 'remove');
453
- const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
454
- const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
455
- const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
456
- const getShadowRoot = lookupGetter(ElementPrototype, 'shadowRoot');
457
- const getAttributes = lookupGetter(ElementPrototype, 'attributes');
458
- const getNodeType = Node && Node.prototype ? lookupGetter(Node.prototype, 'nodeType') : null;
459
- const getNodeName = Node && Node.prototype ? lookupGetter(Node.prototype, 'nodeName') : null;
460
- // As per issue #47, the web-components registry is inherited by a
461
- // new document created via createHTMLDocument. As per the spec
462
- // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
463
- // a new empty registry is used when creating a template contents owner
464
- // document, so we use that as our parent document to ensure nothing
465
- // is inherited.
466
- if (typeof HTMLTemplateElement === 'function') {
467
- const template = document.createElement('template');
468
- if (template.content && template.content.ownerDocument) {
469
- document = template.content.ownerDocument;
470
- }
471
- }
472
- let trustedTypesPolicy;
473
- let emptyHTML = '';
474
- // The instance's own internal Trusted Types policy. Unlike a caller-supplied
475
- // `TRUSTED_TYPES_POLICY`, this is created at most once — Trusted Types throws
476
- // on duplicate policy names — and is the only policy allowed to persist
477
- // across configurations and survive `clearConfig()`.
478
- let defaultTrustedTypesPolicy;
479
- let defaultTrustedTypesPolicyResolved = false;
480
- // Tracks whether we are already inside a call to the configured Trusted Types
481
- // policy (`createHTML` or `createScriptURL`). If a supplied policy callback
482
- // itself calls `DOMPurify.sanitize` (the cause of #1422), `sanitize` would
483
- // re-enter the policy and recurse until the stack overflows. We detect that
484
- // re-entry and throw a clear, actionable error instead. The guard is shared
485
- // across both callbacks, because either one re-entering `sanitize` triggers
486
- // the same unbounded recursion.
487
- let IN_TRUSTED_TYPES_POLICY = 0;
488
- const _assertNotInTrustedTypesPolicy = function _assertNotInTrustedTypesPolicy() {
489
- if (IN_TRUSTED_TYPES_POLICY > 0) {
490
- throw typeErrorCreate('A configured TRUSTED_TYPES_POLICY callback (createHTML or ' + 'createScriptURL) must not call DOMPurify.sanitize, as that causes ' + 'infinite recursion. Do not pass a policy whose callbacks wrap ' + 'DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted ' + 'Types" section of the README.');
491
- }
492
- };
493
- const _createTrustedHTML = function _createTrustedHTML(html) {
494
- _assertNotInTrustedTypesPolicy();
495
- IN_TRUSTED_TYPES_POLICY++;
496
- try {
497
- return trustedTypesPolicy.createHTML(html);
498
- } finally {
499
- IN_TRUSTED_TYPES_POLICY--;
500
- }
501
- };
502
- const _createTrustedScriptURL = function _createTrustedScriptURL(scriptUrl) {
503
- _assertNotInTrustedTypesPolicy();
504
- IN_TRUSTED_TYPES_POLICY++;
505
- try {
506
- return trustedTypesPolicy.createScriptURL(scriptUrl);
507
- } finally {
508
- IN_TRUSTED_TYPES_POLICY--;
509
- }
510
- };
511
- // Lazily resolve (and cache) the instance's internal default policy.
512
- // Resolution is attempted at most once: a successful `createPolicy` cannot be
513
- // repeated (Trusted Types throws on duplicate names), and a failed or
514
- // unsupported attempt must not be retried on every parse.
515
- const _getDefaultTrustedTypesPolicy = function _getDefaultTrustedTypesPolicy() {
516
- if (!defaultTrustedTypesPolicyResolved) {
517
- defaultTrustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
518
- defaultTrustedTypesPolicyResolved = true;
519
- }
520
- return defaultTrustedTypesPolicy;
521
- };
522
- const _document = document,
523
- implementation = _document.implementation,
524
- createNodeIterator = _document.createNodeIterator,
525
- createDocumentFragment = _document.createDocumentFragment,
526
- getElementsByTagName = _document.getElementsByTagName;
527
- const importNode = originalDocument.importNode;
528
- let hooks = _createHooksMap();
529
- /**
530
- * Expose whether this browser supports running the full DOMPurify.
531
- */
532
- DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
533
- const MUSTACHE_EXPR$1 = MUSTACHE_EXPR,
534
- ERB_EXPR$1 = ERB_EXPR,
535
- TMPLIT_EXPR$1 = TMPLIT_EXPR,
536
- DATA_ATTR$1 = DATA_ATTR,
537
- ARIA_ATTR$1 = ARIA_ATTR,
538
- IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA,
539
- ATTR_WHITESPACE$1 = ATTR_WHITESPACE,
540
- CUSTOM_ELEMENT$1 = CUSTOM_ELEMENT;
541
- let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
542
- /**
543
- * We consider the elements and attributes below to be safe. Ideally
544
- * don't add any new ones but feel free to remove unwanted ones.
545
- */
546
- /* allowed element names */
547
- let ALLOWED_TAGS = null;
548
- const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
549
- /* Allowed attribute names */
550
- let ALLOWED_ATTR = null;
551
- const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
552
- /*
553
- * Configure how DOMPurify should handle custom elements and their attributes as well as customized built-in elements.
554
- * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
555
- * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
556
- * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
557
- */
558
- let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
559
- tagNameCheck: {
560
- writable: true,
561
- configurable: false,
562
- enumerable: true,
563
- value: null
564
- },
565
- attributeNameCheck: {
566
- writable: true,
567
- configurable: false,
568
- enumerable: true,
569
- value: null
570
- },
571
- allowCustomizedBuiltInElements: {
572
- writable: true,
573
- configurable: false,
574
- enumerable: true,
575
- value: false
576
- }
577
- }));
578
- /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
579
- let FORBID_TAGS = null;
580
- /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
581
- let FORBID_ATTR = null;
582
- /* Config object to store ADD_TAGS/ADD_ATTR functions (when used as functions) */
583
- const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
584
- tagCheck: {
585
- writable: true,
586
- configurable: false,
587
- enumerable: true,
588
- value: null
589
- },
590
- attributeCheck: {
591
- writable: true,
592
- configurable: false,
593
- enumerable: true,
594
- value: null
595
- }
596
- }));
597
- /* Decide if ARIA attributes are okay */
598
- let ALLOW_ARIA_ATTR = true;
599
- /* Decide if custom data attributes are okay */
600
- let ALLOW_DATA_ATTR = true;
601
- /* Decide if unknown protocols are okay */
602
- let ALLOW_UNKNOWN_PROTOCOLS = false;
603
- /* Decide if self-closing tags in attributes are allowed.
604
- * Usually removed due to a mXSS issue in jQuery 3.0 */
605
- let ALLOW_SELF_CLOSE_IN_ATTR = true;
606
- /* Output should be safe for common template engines.
607
- * This means, DOMPurify removes data attributes, mustaches and ERB
608
- */
609
- let SAFE_FOR_TEMPLATES = false;
610
- /* Output should be safe even for XML used within HTML and alike.
611
- * This means, DOMPurify removes comments when containing risky content.
612
- */
613
- let SAFE_FOR_XML = true;
614
- /* Decide if document with <html>... should be returned */
615
- let WHOLE_DOCUMENT = false;
616
- /* Track whether config is already set on this instance of DOMPurify. */
617
- let SET_CONFIG = false;
618
- /* Pristine allowlist bindings captured at setConfig() time. On the
619
- * persistent-config path sanitize() restores the sets from these before
620
- * the per-walk hook clone-guard, so a hook's in-call widening cannot
621
- * carry across calls. Null until setConfig() is called; reset by
622
- * clearConfig(). */
623
- let SET_CONFIG_ALLOWED_TAGS = null;
624
- let SET_CONFIG_ALLOWED_ATTR = null;
625
- /* Decide if all elements (e.g. style, script) must be children of
626
- * document.body. By default, browsers might move them to document.head */
627
- let FORCE_BODY = false;
628
- /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
629
- * string (or a TrustedHTML object if Trusted Types are supported).
630
- * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
631
- */
632
- let RETURN_DOM = false;
633
- /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
634
- * string (or a TrustedHTML object if Trusted Types are supported) */
635
- let RETURN_DOM_FRAGMENT = false;
636
- /* Try to return a Trusted Type object instead of a string, return a string in
637
- * case Trusted Types are not supported */
638
- let RETURN_TRUSTED_TYPE = false;
639
- /* Output should be free from DOM clobbering attacks?
640
- * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
641
- */
642
- let SANITIZE_DOM = true;
643
- /* Achieve full DOM Clobbering protection by isolating the namespace of named
644
- * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
645
- *
646
- * HTML/DOM spec rules that enable DOM Clobbering:
647
- * - Named Access on Window (§7.3.3)
648
- * - DOM Tree Accessors (§3.1.5)
649
- * - Form Element Parent-Child Relations (§4.10.3)
650
- * - Iframe srcdoc / Nested WindowProxies (§4.8.5)
651
- * - HTMLCollection (§4.2.10.2)
652
- *
653
- * Namespace isolation is implemented by prefixing `id` and `name` attributes
654
- * with a constant string, i.e., `user-content-`
655
- */
656
- let SANITIZE_NAMED_PROPS = false;
657
- const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
658
- /* Keep element content when removing element? */
659
- let KEEP_CONTENT = true;
660
- /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
661
- * of importing it into a new Document and returning a sanitized copy */
662
- let IN_PLACE = false;
663
- /* Allow usage of profiles like html, svg and mathMl */
664
- let USE_PROFILES = {};
665
- /* Tags to ignore content of when KEEP_CONTENT is true */
666
- let FORBID_CONTENTS = null;
667
- const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script',
668
- // <selectedcontent> mirrors the selected <option>'s subtree, cloned by
669
- // the UA (customizable <select>) — including any on* handlers — and the
670
- // engine re-mirrors synchronously whenever a removal changes which
671
- // option/selectedcontent is current, even inside DOMPurify's inert
672
- // DOMParser document. Hoisting its children on removal re-inserts a fresh
673
- // mirror target ahead of the walk, which the engine refills, looping
674
- // forever (DoS) and amplifying output. Dropping its content on removal
675
- // (rather than hoisting) breaks that cascade; the content is a duplicate
676
- // of the option, which is sanitized on its own. See campaign-3 F1/F6.
677
- 'selectedcontent', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
678
- /* Tags that are safe for data: URIs */
679
- let DATA_URI_TAGS = null;
680
- const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
681
- /* Attributes safe for values like "javascript:" */
682
- let URI_SAFE_ATTRIBUTES = null;
683
- const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
684
- const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
685
- const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
686
- const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
687
- /* Document namespace */
688
- let NAMESPACE = HTML_NAMESPACE;
689
- let IS_EMPTY_INPUT = false;
690
- /* Allowed XHTML+XML namespaces */
691
- let ALLOWED_NAMESPACES = null;
692
- const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
693
- const DEFAULT_MATHML_TEXT_INTEGRATION_POINTS = freeze(['mi', 'mo', 'mn', 'ms', 'mtext']);
694
- let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
695
- const DEFAULT_HTML_INTEGRATION_POINTS = freeze(['annotation-xml']);
696
- let HTML_INTEGRATION_POINTS = addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
697
- // Certain elements are allowed in both SVG and HTML
698
- // namespace. We need to specify them explicitly
699
- // so that they don't get erroneously deleted from
700
- // HTML namespace.
701
- const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
702
- /* Parsing of strict XHTML documents */
703
- let PARSER_MEDIA_TYPE = null;
704
- const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
705
- const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
706
- let transformCaseFunc = null;
707
- /* Keep a reference to config to pass to hooks */
708
- let CONFIG = null;
709
- /* Ideally, do not touch anything below this line */
710
- /* ______________________________________________ */
711
- const formElement = document.createElement('form');
712
- const isRegexOrFunction = function isRegexOrFunction(testValue) {
713
- return testValue instanceof RegExp || testValue instanceof Function;
714
- };
715
- /**
716
- * _parseConfig
717
- *
718
- * @param cfg optional config literal
719
- */
720
- // eslint-disable-next-line complexity
721
- const _parseConfig = function _parseConfig() {
722
- let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
723
- if (CONFIG && CONFIG === cfg) {
724
- return;
725
- }
726
- /* Shield configuration object from tampering */
727
- if (!cfg || typeof cfg !== 'object') {
728
- cfg = {};
729
- }
730
- /* Shield configuration object from prototype pollution */
731
- cfg = clone(cfg);
732
- PARSER_MEDIA_TYPE =
733
- // eslint-disable-next-line unicorn/prefer-includes
734
- SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
735
- // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
736
- transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
737
- /* Set configuration parameters */
738
- ALLOWED_TAGS = _resolveSetOption(cfg, 'ALLOWED_TAGS', DEFAULT_ALLOWED_TAGS, {
739
- transform: transformCaseFunc
740
- });
741
- ALLOWED_ATTR = _resolveSetOption(cfg, 'ALLOWED_ATTR', DEFAULT_ALLOWED_ATTR, {
742
- transform: transformCaseFunc
743
- });
744
- ALLOWED_NAMESPACES = _resolveSetOption(cfg, 'ALLOWED_NAMESPACES', DEFAULT_ALLOWED_NAMESPACES, {
745
- transform: stringToString
746
- });
747
- URI_SAFE_ATTRIBUTES = _resolveSetOption(cfg, 'ADD_URI_SAFE_ATTR', DEFAULT_URI_SAFE_ATTRIBUTES, {
748
- transform: transformCaseFunc,
749
- base: DEFAULT_URI_SAFE_ATTRIBUTES
750
- });
751
- DATA_URI_TAGS = _resolveSetOption(cfg, 'ADD_DATA_URI_TAGS', DEFAULT_DATA_URI_TAGS, {
752
- transform: transformCaseFunc,
753
- base: DEFAULT_DATA_URI_TAGS
754
- });
755
- FORBID_CONTENTS = _resolveSetOption(cfg, 'FORBID_CONTENTS', DEFAULT_FORBID_CONTENTS, {
756
- transform: transformCaseFunc
757
- });
758
- FORBID_TAGS = _resolveSetOption(cfg, 'FORBID_TAGS', clone({}), {
759
- transform: transformCaseFunc
760
- });
761
- FORBID_ATTR = _resolveSetOption(cfg, 'FORBID_ATTR', clone({}), {
762
- transform: transformCaseFunc
763
- });
764
- USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === 'object' ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
765
- ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
766
- ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
767
- ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
768
- ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
769
- SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
770
- SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; // Default true
771
- WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
772
- RETURN_DOM = cfg.RETURN_DOM || false; // Default false
773
- RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
774
- RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
775
- FORCE_BODY = cfg.FORCE_BODY || false; // Default false
776
- SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
777
- SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
778
- KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
779
- IN_PLACE = cfg.IN_PLACE || false; // Default false
780
- IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI; // Default regexp
781
- NAMESPACE = typeof cfg.NAMESPACE === 'string' ? cfg.NAMESPACE : HTML_NAMESPACE; // Default HTML namespace
782
- MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, 'MATHML_TEXT_INTEGRATION_POINTS') && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === 'object' ? clone(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS); // Default built-in map
783
- HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, 'HTML_INTEGRATION_POINTS') && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === 'object' ? clone(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS); // Default built-in map
784
- const customElementHandling = objectHasOwnProperty(cfg, 'CUSTOM_ELEMENT_HANDLING') && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === 'object' ? clone(cfg.CUSTOM_ELEMENT_HANDLING) : create(null);
785
- CUSTOM_ELEMENT_HANDLING = create(null);
786
- if (objectHasOwnProperty(customElementHandling, 'tagNameCheck') && isRegexOrFunction(customElementHandling.tagNameCheck)) {
787
- CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck; // Default undefined
788
- }
789
- if (objectHasOwnProperty(customElementHandling, 'attributeNameCheck') && isRegexOrFunction(customElementHandling.attributeNameCheck)) {
790
- CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck; // Default undefined
791
- }
792
- if (objectHasOwnProperty(customElementHandling, 'allowCustomizedBuiltInElements') && typeof customElementHandling.allowCustomizedBuiltInElements === 'boolean') {
793
- CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements; // Default undefined
794
- }
795
- seal(CUSTOM_ELEMENT_HANDLING);
796
- if (SAFE_FOR_TEMPLATES) {
797
- ALLOW_DATA_ATTR = false;
798
- }
799
- if (RETURN_DOM_FRAGMENT) {
800
- RETURN_DOM = true;
801
- }
802
- /* Parse profile info */
803
- if (USE_PROFILES) {
804
- ALLOWED_TAGS = addToSet({}, text);
805
- ALLOWED_ATTR = create(null);
806
- if (USE_PROFILES.html === true) {
807
- addToSet(ALLOWED_TAGS, html$1);
808
- addToSet(ALLOWED_ATTR, html);
809
- }
810
- if (USE_PROFILES.svg === true) {
811
- addToSet(ALLOWED_TAGS, svg$1);
812
- addToSet(ALLOWED_ATTR, svg);
813
- addToSet(ALLOWED_ATTR, xml);
814
- }
815
- if (USE_PROFILES.svgFilters === true) {
816
- addToSet(ALLOWED_TAGS, svgFilters);
817
- addToSet(ALLOWED_ATTR, svg);
818
- addToSet(ALLOWED_ATTR, xml);
819
- }
820
- if (USE_PROFILES.mathMl === true) {
821
- addToSet(ALLOWED_TAGS, mathMl$1);
822
- addToSet(ALLOWED_ATTR, mathMl);
823
- addToSet(ALLOWED_ATTR, xml);
824
- }
825
- }
826
- /* Always reset function-based ADD_TAGS / ADD_ATTR checks to prevent
827
- * leaking across calls when switching from function to array config */
828
- EXTRA_ELEMENT_HANDLING.tagCheck = null;
829
- EXTRA_ELEMENT_HANDLING.attributeCheck = null;
830
- /* Merge configuration parameters */
831
- if (objectHasOwnProperty(cfg, 'ADD_TAGS')) {
832
- if (typeof cfg.ADD_TAGS === 'function') {
833
- EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
834
- } else if (arrayIsArray(cfg.ADD_TAGS)) {
835
- if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
836
- ALLOWED_TAGS = clone(ALLOWED_TAGS);
837
- }
838
- addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
839
- }
840
- }
841
- if (objectHasOwnProperty(cfg, 'ADD_ATTR')) {
842
- if (typeof cfg.ADD_ATTR === 'function') {
843
- EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
844
- } else if (arrayIsArray(cfg.ADD_ATTR)) {
845
- if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
846
- ALLOWED_ATTR = clone(ALLOWED_ATTR);
847
- }
848
- addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
849
- }
850
- }
851
- if (objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) {
852
- addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
853
- }
854
- if (objectHasOwnProperty(cfg, 'FORBID_CONTENTS') && arrayIsArray(cfg.FORBID_CONTENTS)) {
855
- if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
856
- FORBID_CONTENTS = clone(FORBID_CONTENTS);
857
- }
858
- addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
859
- }
860
- if (objectHasOwnProperty(cfg, 'ADD_FORBID_CONTENTS') && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
861
- if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
862
- FORBID_CONTENTS = clone(FORBID_CONTENTS);
863
- }
864
- addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
865
- }
866
- /* Add #text in case KEEP_CONTENT is set to true */
867
- if (KEEP_CONTENT) {
868
- ALLOWED_TAGS['#text'] = true;
869
- }
870
- /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
871
- if (WHOLE_DOCUMENT) {
872
- addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
873
- }
874
- /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
875
- if (ALLOWED_TAGS.table) {
876
- addToSet(ALLOWED_TAGS, ['tbody']);
877
- delete FORBID_TAGS.tbody;
878
- }
879
- // Re-derive the active Trusted Types policy from this configuration on
880
- // every parse. The active policy must never be sticky closure state that
881
- // outlives the config that set it: a caller-supplied policy left in place
882
- // after `clearConfig()` — or after a later call that supplied none, or
883
- // `TRUSTED_TYPES_POLICY: null` — could sign a subsequent "default"
884
- // `RETURN_TRUSTED_TYPE` result with a foreign, possibly unsafe policy.
885
- // See GHSA-vxr8-fq34-vvx9.
886
- if (cfg.TRUSTED_TYPES_POLICY) {
887
- if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
888
- throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
889
- }
890
- if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
891
- throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
892
- }
893
- // A caller-supplied policy applies to this configuration only.
894
- const previousTrustedTypesPolicy = trustedTypesPolicy;
895
- trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
896
- // Sign local variables required by `sanitize`. If the supplied policy's
897
- // `createHTML` is circular (i.e. it calls `DOMPurify.sanitize`), this
898
- // throws via the re-entrancy guard. Restore the previous policy first so
899
- // the instance is not left in a poisoned state. See #1422.
900
- try {
901
- emptyHTML = _createTrustedHTML('');
902
- } catch (error) {
903
- trustedTypesPolicy = previousTrustedTypesPolicy;
904
- throw error;
905
- }
906
- } else if (cfg.TRUSTED_TYPES_POLICY === null) {
907
- // Explicit opt-out for this call: perform no Trusted Types signing and
908
- // create nothing (so a strict `trusted-types` CSP that disallows a
909
- // `dompurify` policy can still call `sanitize` from inside its own
910
- // policy — see #1422). Resetting to `undefined` rather than a sticky
911
- // `null` also drops any previously retained caller policy, so it cannot
912
- // resurface on a later call, while still allowing the next config-less
913
- // call to restore the internal default policy. See GHSA-vxr8-fq34-vvx9.
914
- trustedTypesPolicy = undefined;
915
- emptyHTML = '';
916
- } else {
917
- // No policy supplied: keep the currently active policy if one is set — a
918
- // previously supplied policy is intentionally sticky across config-less
919
- // calls — otherwise fall back to the instance's own internal policy,
920
- // created at most once. (A policy supplied for a *single* call still
921
- // lingers by design; what must not linger is a policy whose configuration
922
- // has been torn down via `clearConfig()`, which restores the default.)
923
- if (trustedTypesPolicy === undefined) {
924
- trustedTypesPolicy = _getDefaultTrustedTypesPolicy();
925
- }
926
- // Sign internal variables only when a policy is active. A falsy policy
927
- // (Trusted Types unsupported, creation failed, or an explicit opt-out)
928
- // leaves `emptyHTML` as a plain string, so we never call `.createHTML` on
929
- // a non-policy and throw. See #1422.
930
- if (trustedTypesPolicy && typeof emptyHTML === 'string') {
931
- emptyHTML = _createTrustedHTML('');
932
- }
933
- }
934
- // Prevent further manipulation of configuration.
935
- // Not available in IE8, Safari 5, etc.
936
- if (freeze) {
937
- freeze(cfg);
938
- }
939
- CONFIG = cfg;
940
- };
941
- /* Keep track of all possible SVG and MathML tags
942
- * so that we can perform the namespace checks
943
- * correctly. */
944
- const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
945
- const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
946
- /**
947
- * Namespace rules for an element in the SVG namespace.
948
- *
949
- * @param tagName the element's lowercase tag name
950
- * @param parent the (possibly simulated) parent node
951
- * @param parentTagName the parent's lowercase tag name
952
- * @returns true if a spec-compliant parser could produce this element
953
- */
954
- const _checkSvgNamespace = function _checkSvgNamespace(tagName, parent, parentTagName) {
955
- // The only way to switch from HTML namespace to SVG
956
- // is via <svg>. If it happens via any other tag, then
957
- // it should be killed.
958
- if (parent.namespaceURI === HTML_NAMESPACE) {
959
- return tagName === 'svg';
960
- }
961
- // The only way to switch from MathML to SVG is via <svg>
962
- // if the parent is either <annotation-xml> or a MathML
963
- // text integration point.
964
- if (parent.namespaceURI === MATHML_NAMESPACE) {
965
- return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
966
- }
967
- // We only allow elements that are defined in SVG
968
- // spec. All others are disallowed in SVG namespace.
969
- return Boolean(ALL_SVG_TAGS[tagName]);
970
- };
971
- /**
972
- * Namespace rules for an element in the MathML namespace.
973
- *
974
- * @param tagName the element's lowercase tag name
975
- * @param parent the (possibly simulated) parent node
976
- * @param parentTagName the parent's lowercase tag name
977
- * @returns true if a spec-compliant parser could produce this element
978
- */
979
- const _checkMathMlNamespace = function _checkMathMlNamespace(tagName, parent, parentTagName) {
980
- // The only way to switch from HTML namespace to MathML
981
- // is via <math>. If it happens via any other tag, then
982
- // it should be killed.
983
- if (parent.namespaceURI === HTML_NAMESPACE) {
984
- return tagName === 'math';
985
- }
986
- // The only way to switch from SVG to MathML is via
987
- // <math> and HTML integration points
988
- if (parent.namespaceURI === SVG_NAMESPACE) {
989
- return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
990
- }
991
- // We only allow elements that are defined in MathML
992
- // spec. All others are disallowed in MathML namespace.
993
- return Boolean(ALL_MATHML_TAGS[tagName]);
994
- };
995
- /**
996
- * Namespace rules for an element in the HTML namespace.
997
- *
998
- * @param tagName the element's lowercase tag name
999
- * @param parent the (possibly simulated) parent node
1000
- * @param parentTagName the parent's lowercase tag name
1001
- * @returns true if a spec-compliant parser could produce this element
1002
- */
1003
- const _checkHtmlNamespace = function _checkHtmlNamespace(tagName, parent, parentTagName) {
1004
- // The only way to switch from SVG to HTML is via
1005
- // HTML integration points, and from MathML to HTML
1006
- // is via MathML text integration points
1007
- if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
1008
- return false;
1009
- }
1010
- if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
1011
- return false;
1012
- }
1013
- // We disallow tags that are specific for MathML
1014
- // or SVG and should never appear in HTML namespace
1015
- return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
1016
- };
1017
- /**
1018
- * @param element a DOM element whose namespace is being checked
1019
- * @returns Return false if the element has a
1020
- * namespace that a spec-compliant parser would never
1021
- * return. Return true otherwise.
1022
- */
1023
- const _checkValidNamespace = function _checkValidNamespace(element) {
1024
- let parent = getParentNode(element);
1025
- // In JSDOM, if we're inside shadow DOM, then parentNode
1026
- // can be null. We just simulate parent in this case.
1027
- if (!parent || !parent.tagName) {
1028
- parent = {
1029
- namespaceURI: NAMESPACE,
1030
- tagName: 'template'
1031
- };
1032
- }
1033
- const tagName = stringToLowerCase(element.tagName);
1034
- const parentTagName = stringToLowerCase(parent.tagName);
1035
- if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
1036
- return false;
1037
- }
1038
- if (element.namespaceURI === SVG_NAMESPACE) {
1039
- return _checkSvgNamespace(tagName, parent, parentTagName);
1040
- }
1041
- if (element.namespaceURI === MATHML_NAMESPACE) {
1042
- return _checkMathMlNamespace(tagName, parent, parentTagName);
1043
- }
1044
- if (element.namespaceURI === HTML_NAMESPACE) {
1045
- return _checkHtmlNamespace(tagName, parent, parentTagName);
1046
- }
1047
- // For XHTML and XML documents that support custom namespaces
1048
- if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
1049
- return true;
1050
- }
1051
- // The code should never reach this place (this means
1052
- // that the element somehow got namespace that is not
1053
- // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
1054
- // Return false just in case.
1055
- return false;
1056
- };
1057
- /**
1058
- * _forceRemove
1059
- *
1060
- * @param node a DOM node
1061
- */
1062
- const _forceRemove = function _forceRemove(node) {
1063
- arrayPush(DOMPurify.removed, {
1064
- element: node
1065
- });
1066
- try {
1067
- // eslint-disable-next-line unicorn/prefer-dom-node-remove
1068
- getParentNode(node).removeChild(node);
1069
- } catch (_) {
1070
- /* The normal detach failed — this is reached for a parentless node
1071
- (getParentNode() is null, so .removeChild throws). Element.prototype
1072
- .remove() is itself a spec no-op on a parentless node, so a recorded
1073
- "removal" would otherwise hand the caller back an intact,
1074
- payload-bearing node (e.g. a detached IN_PLACE root the mXSS canary or
1075
- the style-with-element-child rule decided to kill). Fail closed by
1076
- throwing — exactly as a clobbered root does at the IN_PLACE entry —
1077
- rather than trying to "neutralize" the node via its own methods.
1078
- Neutralizing would mean calling getAttributeNames()/removeAttribute()
1079
- on the node, both of which a <form> root can clobber via a named child
1080
- (and _isClobbered does not even probe getAttributeNames), so the
1081
- neutralize step could itself be silently defeated, leaving the payload
1082
- intact. A throw touches only the cached, clobber-safe remove() and
1083
- getParentNode(). Generalizes GHSA-r47g-fvhr-h676 (clobbered-form root)
1084
- to every root-kill reason. REPORT-3.
1085
- This lives inside the catch, so it never fires for a normally-removed
1086
- in-tree node: those have a parent, removeChild() succeeds, and the
1087
- catch is not entered. Only a kept (parentless) root reaches here. */
1088
- remove(node);
1089
- if (!getParentNode(node)) {
1090
- throw typeErrorCreate('a node selected for removal could not be detached from its tree ' + 'and cannot be safely returned; refusing to sanitize in place');
1091
- }
1092
- }
1093
- };
1094
- /**
1095
- * _neutralizeRoot
1096
- *
1097
- * Fail-closed teardown of an in-place root after the sanitize walk aborts
1098
- * (campaign-3 F2). An internal throw mid-walk — e.g. a page-registered
1099
- * custom element's reaction detaches a node so `_forceRemove`'s deliberate
1100
- * parentless guard throws, or any other re-entrant engine mutation — would
1101
- * otherwise leave the caller's *live* tree half-sanitized, with everything
1102
- * after the abort point still carrying its handlers. There is no safe way
1103
- * to resume the walk (the tree mutated under us), so we strip the root bare:
1104
- * remove every child and every attribute, then let the caller's catch see
1105
- * the original error. Clobber-safe (cached `remove`/`childNodes`/`attributes`
1106
- * getters; the root was already clobber-pre-flighted at the IN_PLACE entry).
1107
- *
1108
- * @param root the in-place root to empty
1109
- */
1110
- const _neutralizeRoot = function _neutralizeRoot(root) {
1111
- const childNodes = getChildNodes(root);
1112
- if (childNodes) {
1113
- const snapshot = [];
1114
- arrayForEach(childNodes, child => {
1115
- arrayPush(snapshot, child);
1116
- });
1117
- arrayForEach(snapshot, child => {
1118
- try {
1119
- remove(child);
1120
- } catch (_) {
1121
- /* Best-effort teardown; a still-attached child is handled below */
1122
- }
1123
- });
1124
- }
1125
- const attributes = getAttributes(root);
1126
- if (attributes) {
1127
- for (let i = attributes.length - 1; i >= 0; --i) {
1128
- const attribute = attributes[i];
1129
- const name = attribute && attribute.name;
1130
- if (typeof name === 'string') {
1131
- try {
1132
- root.removeAttribute(name);
1133
- } catch (_) {
1134
- /* Clobbered removeAttribute — ignore (fail-closed best effort) */
1135
- }
1136
- }
1137
- }
1138
- }
1139
- };
1140
- /**
1141
- * _removeAttribute
1142
- *
1143
- * @param name an Attribute name
1144
- * @param element a DOM node
1145
- */
1146
- const _removeAttribute = function _removeAttribute(name, element) {
1147
- try {
1148
- arrayPush(DOMPurify.removed, {
1149
- attribute: element.getAttributeNode(name),
1150
- from: element
1151
- });
1152
- } catch (_) {
1153
- arrayPush(DOMPurify.removed, {
1154
- attribute: null,
1155
- from: element
1156
- });
1157
- }
1158
- element.removeAttribute(name);
1159
- // We void attribute values for unremovable "is" attributes
1160
- if (name === 'is') {
1161
- if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
1162
- try {
1163
- _forceRemove(element);
1164
- } catch (_) {}
1165
- } else {
1166
- try {
1167
- element.setAttribute(name, '');
1168
- } catch (_) {}
1169
- }
1170
- }
1171
- };
1172
- /**
1173
- * _stripDisallowedAttributes
1174
- *
1175
- * Removes every attribute the active configuration does not allow from a
1176
- * single element, using the same allowlist as the main attribute pass (so
1177
- * `on*` handlers go, but no `/^on/` blocklist is introduced). Used only to
1178
- * neutralise nodes that are being discarded from an in-place tree.
1179
- *
1180
- * @param element the element to strip
1181
- */
1182
- const _stripDisallowedAttributes = function _stripDisallowedAttributes(element) {
1183
- const attributes = getAttributes(element);
1184
- if (!attributes) {
1185
- return;
1186
- }
1187
- for (let i = attributes.length - 1; i >= 0; --i) {
1188
- const attribute = attributes[i];
1189
- const name = attribute && attribute.name;
1190
- if (typeof name !== 'string' || ALLOWED_ATTR[transformCaseFunc(name)]) {
1191
- continue;
1192
- }
1193
- try {
1194
- element.removeAttribute(name);
1195
- } catch (_) {
1196
- /* Clobbered removeAttribute on a doomed node — ignore */
1197
- }
1198
- }
1199
- };
1200
- /**
1201
- * _neutralizeSubtree
1202
- *
1203
- * Completes the audit-5 F1 fix across every removal path. The KEEP_CONTENT
1204
- * move-hoist neutralises only disallowed-tag removals; clobber, mXSS-canary,
1205
- * namespace, comment, processing-instruction and KEEP_CONTENT:false removals
1206
- * all drop their subtree wholesale via `_forceRemove`. On the IN_PLACE path
1207
- * those dropped nodes are detached from the caller's LIVE tree but a
1208
- * handler-bearing original among them (an `<img onerror>`/`<video>` that was
1209
- * loading) keeps its queued resource event, which fires in page scope after
1210
- * sanitize returns. This walks a removed subtree and strips every attribute
1211
- * the active configuration does not allow — so `on*` handlers are cancelled
1212
- * through the SAME allowlist that governs kept nodes, not a separate `/^on/`
1213
- * blocklist. Run synchronously before sanitize returns, i.e. before any
1214
- * queued event can fire. Hook-free by design: these nodes leave the output,
1215
- * so firing attribute hooks for them would be surprising. Clobber-safe reads;
1216
- * a doomed clobbered node may shadow `removeAttribute` (its own attributes are
1217
- * irrelevant — it is discarded — while its non-clobbered descendants, e.g.
1218
- * the `<img>`, are reached and scrubbed).
1219
- *
1220
- * @param root the root of a removed subtree to neutralise
1221
- */
1222
- const _neutralizeSubtree = function _neutralizeSubtree(root) {
1223
- const stack = [root];
1224
- while (stack.length > 0) {
1225
- const node = stack.pop();
1226
- const nodeType = getNodeType ? getNodeType(node) : node.nodeType;
1227
- if (nodeType === NODE_TYPE.element) {
1228
- _stripDisallowedAttributes(node);
1229
- }
1230
- const childNodes = getChildNodes(node);
1231
- if (childNodes) {
1232
- for (let i = childNodes.length - 1; i >= 0; --i) {
1233
- stack.push(childNodes[i]);
1234
- }
1235
- }
1236
- }
1237
- };
1238
- /**
1239
- * _initDocument
1240
- *
1241
- * @param dirty - a string of dirty markup
1242
- * @return a DOM, filled with the dirty markup
1243
- */
1244
- const _initDocument = function _initDocument(dirty) {
1245
- /* Create a HTML document */
1246
- let doc = null;
1247
- let leadingWhitespace = null;
1248
- if (FORCE_BODY) {
1249
- dirty = '<remove></remove>' + dirty;
1250
- } else {
1251
- /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
1252
- const matches = stringMatch(dirty, /^[\r\n\t ]+/);
1253
- leadingWhitespace = matches && matches[0];
1254
- }
1255
- if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
1256
- // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
1257
- dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
1258
- }
1259
- const dirtyPayload = trustedTypesPolicy ? _createTrustedHTML(dirty) : dirty;
1260
- /*
1261
- * Use the DOMParser API by default, fallback later if needs be
1262
- * DOMParser not work for svg when has multiple root element.
1263
- */
1264
- if (NAMESPACE === HTML_NAMESPACE) {
1265
- try {
1266
- doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
1267
- } catch (_) {}
1268
- }
1269
- /* Use createHTMLDocument in case DOMParser is not available */
1270
- if (!doc || !doc.documentElement) {
1271
- doc = implementation.createDocument(NAMESPACE, 'template', null);
1272
- try {
1273
- doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
1274
- } catch (_) {
1275
- // Syntax error if dirtyPayload is invalid xml
1276
- }
1277
- }
1278
- const body = doc.body || doc.documentElement;
1279
- if (dirty && leadingWhitespace) {
1280
- body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
1281
- }
1282
- /* Work on whole document or just its body */
1283
- if (NAMESPACE === HTML_NAMESPACE) {
1284
- return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
1285
- }
1286
- return WHOLE_DOCUMENT ? doc.documentElement : body;
1287
- };
1288
- /**
1289
- * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
1290
- *
1291
- * @param root The root element or node to start traversing on.
1292
- * @return The created NodeIterator
1293
- */
1294
- const _createNodeIterator = function _createNodeIterator(root) {
1295
- return createNodeIterator.call(root.ownerDocument || root, root,
1296
- // eslint-disable-next-line no-bitwise
1297
- NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
1298
- };
1299
- /**
1300
- * Replace template expression syntax (mustache, ERB, template
1301
- * literal) with a space; shared by all SAFE_FOR_TEMPLATES scrub
1302
- * sites. Order matters: mustache, then ERB, then template literal.
1303
- *
1304
- * @param value the string to scrub
1305
- * @returns the scrubbed string
1306
- */
1307
- const _stripTemplateExpressions = function _stripTemplateExpressions(value) {
1308
- value = stringReplace(value, MUSTACHE_EXPR$1, ' ');
1309
- value = stringReplace(value, ERB_EXPR$1, ' ');
1310
- value = stringReplace(value, TMPLIT_EXPR$1, ' ');
1311
- return value;
1312
- };
1313
- /**
1314
- * Strip template-engine expressions ({{...}}, ${...}, <%...%>) from the
1315
- * character data of an element subtree. Used as the final safety net for
1316
- * SAFE_FOR_TEMPLATES on every DOM-returning code path so that expressions
1317
- * which only form after text-node normalization (e.g. fragments split across
1318
- * stripped elements) cannot survive into a template-evaluating framework.
1319
- *
1320
- * Walks text/comment/CDATA/processing-instruction nodes and mutates `.data`
1321
- * in place rather than round-tripping through innerHTML. This preserves
1322
- * descendant node references (important for IN_PLACE callers), avoids a
1323
- * serialize/reparse cycle, and reads literal character data — which means
1324
- * `<%...%>` in text content matches the ERB regex against its real bytes
1325
- * instead of the HTML-entity-escaped form innerHTML would produce.
1326
- *
1327
- * Attribute values are not visited here; SAFE_FOR_TEMPLATES handling for
1328
- * attributes is performed during the per-node `_sanitizeAttributes` pass.
1329
- *
1330
- * @param node The root element whose character data should be scrubbed.
1331
- */
1332
- const _scrubTemplateExpressions2 = function _scrubTemplateExpressions(node) {
1333
- var _node$querySelectorAl;
1334
- node.normalize();
1335
- const walker = createNodeIterator.call(node.ownerDocument || node, node,
1336
- // eslint-disable-next-line no-bitwise
1337
- NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION, null);
1338
- let currentNode = walker.nextNode();
1339
- while (currentNode) {
1340
- currentNode.data = _stripTemplateExpressions(currentNode.data);
1341
- currentNode = walker.nextNode();
1342
- }
1343
- // NodeIterator does not descend into <template>.content per the DOM spec,
1344
- // so we must explicitly recurse into each template's content fragment,
1345
- // mirroring the approach used by _sanitizeShadowDOM.
1346
- const templates = (_node$querySelectorAl = node.querySelectorAll) === null || _node$querySelectorAl === void 0 ? void 0 : _node$querySelectorAl.call(node, 'template');
1347
- if (templates) {
1348
- arrayForEach(templates, tmpl => {
1349
- if (_isDocumentFragment(tmpl.content)) {
1350
- _scrubTemplateExpressions2(tmpl.content);
1351
- }
1352
- });
1353
- }
1354
- };
1355
- /**
1356
- * _isClobbered
1357
- *
1358
- * Detect DOM-clobbering on HTMLFormElement nodes. Form is the only HTML
1359
- * interface with [LegacyOverrideBuiltIns]; a descendant element with a
1360
- * `name` attribute matching a prototype property shadows that property
1361
- * on direct reads. We use this check at the IN_PLACE entry-point and
1362
- * during attribute sanitization to refuse clobbered forms.
1363
- *
1364
- * @param element element to check for clobbering attacks
1365
- * @return true if clobbered, false if safe
1366
- */
1367
- const _isClobbered = function _isClobbered(element) {
1368
- // Realm-independent tag-name probe. If we can't determine the tag
1369
- // name at all, we can't reason about clobbering — return false
1370
- // (the caller's other defences still apply).
1371
- const realTagName = getNodeName ? getNodeName(element) : null;
1372
- if (typeof realTagName !== 'string') {
1373
- return false;
1374
- }
1375
- if (transformCaseFunc(realTagName) !== 'form') {
1376
- return false;
1377
- }
1378
- return typeof element.nodeName !== 'string' || typeof element.textContent !== 'string' || typeof element.removeChild !== 'function' ||
1379
- // Realm-safe NamedNodeMap detection: equality against the cached
1380
- // prototype getter. Clobbered .attributes (e.g. <input name="attributes">)
1381
- // makes the direct read diverge from the cached read; a clean form
1382
- // (same-realm OR foreign-realm) has both reads pointing at the same
1383
- // canonical NamedNodeMap.
1384
- element.attributes !== getAttributes(element) || typeof element.removeAttribute !== 'function' || typeof element.setAttribute !== 'function' || typeof element.namespaceURI !== 'string' || typeof element.insertBefore !== 'function' || typeof element.hasChildNodes !== 'function' ||
1385
- // NodeType clobbering probe. Cached Node.prototype.nodeType getter
1386
- // returns the integer 1 for any Element regardless of realm; direct
1387
- // read on a clobbered form (e.g. <input name="nodeType">) returns
1388
- // the named child element. Cheap addition — nodeType is read from
1389
- // an internal slot, no serialization cost — and removes a residual
1390
- // clobbering surface used by several mXSS / PI / comment branches
1391
- // in _sanitizeElements that compare currentNode.nodeType directly.
1392
- element.nodeType !== getNodeType(element) ||
1393
- // HTMLFormElement has [LegacyOverrideBuiltIns]: a descendant named
1394
- // "childNodes" shadows the prototype getter. Direct reads of
1395
- // form.childNodes from a clobbered form return the named child
1396
- // instead of the real NodeList, so any walk that reads it directly
1397
- // skips the form's real children. Compare the direct read to the
1398
- // cached Node.prototype getter — when the form's named-property
1399
- // getter intercepts the read, the two values differ and we flag
1400
- // the form. This catches every clobbering child type (input,
1401
- // select, etc.) regardless of whether the named child happens to
1402
- // carry a numeric .length, which a typeof-based probe would miss
1403
- // (e.g. HTMLSelectElement.length is a defined unsigned-long).
1404
- element.childNodes !== getChildNodes(element);
1405
- };
1406
- /**
1407
- * Checks whether the given value is a DocumentFragment from any realm.
1408
- *
1409
- * The realm-independent replacement reads `nodeType` through the cached
1410
- * Node.prototype getter and compares to the DOCUMENT_FRAGMENT_NODE
1411
- * constant (11). nodeType is a numeric value resolved from the node's
1412
- * internal slot, identical across realms for the same kind of node.
1413
- *
1414
- * @param value object to check
1415
- * @return true if value is a DocumentFragment-shaped node from any realm
1416
- */
1417
- const _isDocumentFragment = function _isDocumentFragment(value) {
1418
- if (!getNodeType || typeof value !== 'object' || value === null) {
1419
- return false;
1420
- }
1421
- try {
1422
- return getNodeType(value) === NODE_TYPE.documentFragment;
1423
- } catch (_) {
1424
- return false;
1425
- }
1426
- };
1427
- /**
1428
- * Checks whether the given object is a DOM node, including nodes that
1429
- * originate from a different window/realm (e.g. an iframe's
1430
- * contentDocument). The previous `value instanceof Node` check was
1431
- * realm-bound: nodes from a different window failed it, causing
1432
- * sanitize() to silently stringify them and reset IN_PLACE to false,
1433
- * returning the original node unsanitized. See GHSA-4w3q-35jp-p934.
1434
- *
1435
- * @param value object to check whether it's a DOM node
1436
- * @return true if value is a DOM node from any realm
1437
- */
1438
- const _isNode = function _isNode(value) {
1439
- if (!getNodeType || typeof value !== 'object' || value === null) {
1440
- return false;
1441
- }
1442
- try {
1443
- return typeof getNodeType(value) === 'number';
1444
- } catch (_) {
1445
- return false;
1446
- }
1447
- };
1448
- function _executeHooks(hooks, currentNode, data) {
1449
- if (hooks.length === 0) {
1450
- return;
1451
- }
1452
- arrayForEach(hooks, hook => {
1453
- hook.call(DOMPurify, currentNode, data, CONFIG);
1454
- });
1455
- }
1456
- /**
1457
- * Structural-threat checks that condemn a node regardless of the
1458
- * allowlists: mXSS via namespace confusion, risky CSS construction,
1459
- * processing instructions, markup-bearing comments. Pure predicate;
1460
- * the caller removes. Check order is load-bearing.
1461
- *
1462
- * @param currentNode the node to inspect
1463
- * @param tagName the node's transformCaseFunc'd tag name
1464
- * @return true if the node must be removed
1465
- */
1466
- const _isUnsafeNode = function _isUnsafeNode(currentNode, tagName) {
1467
- /* Detect mXSS attempts abusing namespace confusion */
1468
- if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) {
1469
- return true;
1470
- }
1471
- /* Remove risky CSS construction leading to mXSS */
1472
- if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === 'style' && _isNode(currentNode.firstElementChild)) {
1473
- return true;
1474
- }
1475
- /* Remove any occurrence of processing instructions */
1476
- if (currentNode.nodeType === NODE_TYPE.processingInstruction) {
1477
- return true;
1478
- }
1479
- /* Remove any kind of possibly harmful comments */
1480
- if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data)) {
1481
- return true;
1482
- }
1483
- return false;
1484
- };
1485
- /**
1486
- * Handle a node whose tag is forbidden or not allowlisted: keep
1487
- * allowed custom elements (false return exits _sanitizeElements
1488
- * early - namespace/fallback checks and the afterSanitizeElements
1489
- * hook are intentionally skipped for kept custom elements), else
1490
- * hoist content per KEEP_CONTENT and remove.
1491
- *
1492
- * @param currentNode the disallowed node
1493
- * @param tagName the node's transformCaseFunc'd tag name
1494
- * @return true if the node was removed, false if kept
1495
- */
1496
- const _sanitizeDisallowedNode = function _sanitizeDisallowedNode(currentNode, tagName) {
1497
- /* Check if we have a custom element to handle */
1498
- if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
1499
- if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
1500
- return false;
1501
- }
1502
- if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
1503
- return false;
1504
- }
1505
- }
1506
- /* Keep content except for bad-listed elements.
1507
- Use the cached prototype getters exclusively — the previous code
1508
- had `|| currentNode.parentNode` / `|| currentNode.childNodes`
1509
- fallbacks, but the cached getters always return the canonical
1510
- value (or null for a real parent-less node), so the fallback
1511
- path was dead in safe cases and a clobbering surface in unsafe
1512
- ones. Falsy cached results stay falsy; the `if (childNodes &&
1513
- parentNode)` check already gates correctly. */
1514
- if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
1515
- const parentNode = getParentNode(currentNode);
1516
- const childNodes = getChildNodes(currentNode);
1517
- if (childNodes && parentNode) {
1518
- const childCount = childNodes.length;
1519
- /* In-place: hoist the *original* children so the iterator visits
1520
- and sanitises them through the same allowlist pass as every other
1521
- node. The caller built the tree in the live document, so the
1522
- originals carry already-queued resource events (`<img onerror>`,
1523
- `<video>`/`<audio>` error, lazy/`onload`, …); cloning would leave
1524
- those originals detached but still armed, firing in page scope
1525
- while the returned tree looked clean. Moving is safe in-place: the
1526
- root is pre-validated as an allowed tag and so is never the node
1527
- being removed, which keeps `parentNode` inside the iterator root
1528
- and the relocated child inside the serialised tree.
1529
- Otherwise (string / DOM-copy paths): clone. The iterator is rooted
1530
- at — and the result serialised from — `body`, so a restrictive
1531
- ALLOWED_TAGS that removes `body` itself must leave its content in
1532
- place, which only cloning does; and those paths parse into an
1533
- inert document, so their discarded originals never had a queued
1534
- event to neutralise.
1535
- `childNodes` is live; a tail-to-head walk keeps `childNodes[i]`
1536
- valid whether we move (drops the trailing entry) or clone (leaves
1537
- the list intact). */
1538
- for (let i = childCount - 1; i >= 0; --i) {
1539
- const hoisted = IN_PLACE ? childNodes[i] : cloneNode(childNodes[i], true);
1540
- parentNode.insertBefore(hoisted, getNextSibling(currentNode));
1541
- }
1542
- }
1543
- }
1544
- _forceRemove(currentNode);
1545
- return true;
1546
- };
1547
- /**
1548
- * _sanitizeElements
1549
- *
1550
- * @protect nodeName
1551
- * @protect textContent
1552
- * @protect removeChild
1553
- * @param currentNode to check for permission to exist
1554
- * @return true if node was killed, false if left alive
1555
- */
1556
- const _sanitizeElements = function _sanitizeElements(currentNode) {
1557
- /* Execute a hook if present */
1558
- _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
1559
- /* Check if element is clobbered or can clobber */
1560
- if (_isClobbered(currentNode)) {
1561
- _forceRemove(currentNode);
1562
- return true;
1563
- }
1564
- /* Now let's check the element's type and name */
1565
- const tagName = transformCaseFunc(getNodeName ? getNodeName(currentNode) : currentNode.nodeName);
1566
- /* Execute a hook if present */
1567
- _executeHooks(hooks.uponSanitizeElement, currentNode, {
1568
- tagName,
1569
- allowedTags: ALLOWED_TAGS
1570
- });
1571
- /* Remove mXSS vectors, processing instructions and risky comments */
1572
- if (_isUnsafeNode(currentNode, tagName)) {
1573
- _forceRemove(currentNode);
1574
- return true;
1575
- }
1576
- /* Remove element if anything forbids its presence */
1577
- if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
1578
- return _sanitizeDisallowedNode(currentNode, tagName);
1579
- }
1580
- /* Check whether element has a valid namespace.
1581
- Realm-safe check (GHSA-hpcv-96wg-7vj8): use the cached Node.prototype
1582
- nodeType getter rather than `instanceof Element`, which is realm-
1583
- bound and short-circuits to false for any node minted in a different
1584
- realm — letting a foreign-realm element with a forbidden namespace
1585
- slip past the namespace check entirely. */
1586
- const nt = getNodeType ? getNodeType(currentNode) : currentNode.nodeType;
1587
- if (nt === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
1588
- _forceRemove(currentNode);
1589
- return true;
1590
- }
1591
- /* Make sure that older browsers don't get fallback-tag mXSS */
1592
- if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(FALLBACK_TAG_CLOSE, currentNode.innerHTML)) {
1593
- _forceRemove(currentNode);
1594
- return true;
1595
- }
1596
- /* Sanitize element content to be template-safe */
1597
- if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
1598
- /* Get the element's text content */
1599
- const content = _stripTemplateExpressions(currentNode.textContent);
1600
- if (currentNode.textContent !== content) {
1601
- arrayPush(DOMPurify.removed, {
1602
- element: currentNode.cloneNode()
1603
- });
1604
- currentNode.textContent = content;
1605
- }
1606
- }
1607
- /* Execute a hook if present */
1608
- _executeHooks(hooks.afterSanitizeElements, currentNode, null);
1609
- return false;
1610
- };
1611
- /**
1612
- * _isValidAttribute
1613
- *
1614
- * @param lcTag Lowercase tag name of containing element.
1615
- * @param lcName Lowercase attribute name.
1616
- * @param value Attribute value.
1617
- * @return Returns true if `value` is valid, otherwise false.
1618
- */
1619
- // eslint-disable-next-line complexity
1620
- const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
1621
- /* FORBID_ATTR must always win, even if ADD_ATTR predicate would allow it */
1622
- if (FORBID_ATTR[lcName]) {
1623
- return false;
1624
- }
1625
- /* Make sure attribute cannot clobber */
1626
- if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
1627
- return false;
1628
- }
1629
- const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
1630
- /* Allow valid data-* attributes: At least one character after "-"
1631
- (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
1632
- XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
1633
- We don't need to check the value; it's always URI safe. */
1634
- if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) ; else if (!nameIsPermitted) {
1635
- if (
1636
- // First condition does a very basic check if a) it's basically a valid custom element tagname AND
1637
- // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1638
- // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
1639
- _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) ||
1640
- // Alternative, second condition checks if it's an `is`-attribute, AND
1641
- // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1642
- lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {
1643
- return false;
1644
- }
1645
- /* Check value is safe. First, is attr inert? If so, is safe */
1646
- } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ''))) ; else if (value) {
1647
- return false;
1648
- } else ;
1649
- return true;
1650
- };
1651
- /* Names the HTML spec reserves from valid-custom-element-name; these must
1652
- * never be treated as basic custom elements even when a permissive
1653
- * CUSTOM_ELEMENT_HANDLING.tagNameCheck is configured. */
1654
- const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, ['annotation-xml', 'color-profile', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'missing-glyph']);
1655
- /**
1656
- * _isBasicCustomElement
1657
- * checks if at least one dash is included in tagName, and it's not the first char
1658
- * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
1659
- *
1660
- * @param tagName name of the tag of the node to sanitize
1661
- * @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
1662
- */
1663
- const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
1664
- return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
1665
- };
1666
- /**
1667
- * Wrap an attribute value in the matching Trusted Types object when
1668
- * the active policy requires it. Namespaced attributes pass through
1669
- * unchanged (no TT support yet, see
1670
- * https://bugs.chromium.org/p/chromium/issues/detail?id=1305293).
1671
- *
1672
- * @param lcTag lowercase tag name of the containing element
1673
- * @param lcName lowercase attribute name
1674
- * @param namespaceURI the attribute's namespace, if any
1675
- * @param value the attribute value to wrap
1676
- * @return the value, wrapped when Trusted Types demand it
1677
- */
1678
- const _applyTrustedTypesToAttribute = function _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value) {
1679
- if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function' && !namespaceURI) {
1680
- switch (trustedTypes.getAttributeType(lcTag, lcName)) {
1681
- case 'TrustedHTML':
1682
- {
1683
- return _createTrustedHTML(value);
1684
- }
1685
- case 'TrustedScriptURL':
1686
- {
1687
- return _createTrustedScriptURL(value);
1688
- }
1689
- }
1690
- }
1691
- return value;
1692
- };
1693
- /**
1694
- * Write a modified attribute value back onto the element. On
1695
- * success, re-probe for clobbering introduced by the new value and
1696
- * remove the element when found; otherwise pop the removal entry
1697
- * recorded by the earlier _removeAttribute (long-standing pairing
1698
- * with the SANITIZE_NAMED_PROPS path - do not "fix" casually). On
1699
- * failure, remove the attribute instead.
1700
- *
1701
- * @param currentNode the element carrying the attribute
1702
- * @param name the attribute name as present on the element
1703
- * @param namespaceURI the attribute's namespace, if any
1704
- * @param value the new attribute value
1705
- */
1706
- const _setAttributeValue = function _setAttributeValue(currentNode, name, namespaceURI, value) {
1707
- try {
1708
- if (namespaceURI) {
1709
- currentNode.setAttributeNS(namespaceURI, name, value);
1710
- } else {
1711
- /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
1712
- currentNode.setAttribute(name, value);
1713
- }
1714
- if (_isClobbered(currentNode)) {
1715
- _forceRemove(currentNode);
1716
- } else {
1717
- arrayPop(DOMPurify.removed);
1718
- }
1719
- } catch (_) {
1720
- _removeAttribute(name, currentNode);
1721
- }
1722
- };
1723
- /**
1724
- * _sanitizeAttributes
1725
- *
1726
- * @protect attributes
1727
- * @protect nodeName
1728
- * @protect removeAttribute
1729
- * @protect setAttribute
1730
- *
1731
- * @param currentNode to sanitize
1732
- */
1733
- const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
1734
- /* Execute a hook if present */
1735
- _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
1736
- const attributes = currentNode.attributes;
1737
- /* Check if we have attributes; if not we might have a text node */
1738
- if (!attributes || _isClobbered(currentNode)) {
1739
- return;
1740
- }
1741
- const hookEvent = {
1742
- attrName: '',
1743
- attrValue: '',
1744
- keepAttr: true,
1745
- allowedAttributes: ALLOWED_ATTR,
1746
- forceKeepAttr: undefined
1747
- };
1748
- let l = attributes.length;
1749
- const lcTag = transformCaseFunc(currentNode.nodeName);
1750
- /* Go backwards over all attributes; safely remove bad ones */
1751
- while (l--) {
1752
- const attr = attributes[l];
1753
- const name = attr.name,
1754
- namespaceURI = attr.namespaceURI,
1755
- attrValue = attr.value;
1756
- const lcName = transformCaseFunc(name);
1757
- const initValue = attrValue;
1758
- let value = name === 'value' ? initValue : stringTrim(initValue);
1759
- /* Execute a hook if present */
1760
- hookEvent.attrName = lcName;
1761
- hookEvent.attrValue = value;
1762
- hookEvent.keepAttr = true;
1763
- hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
1764
- _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
1765
- value = hookEvent.attrValue;
1766
- /* Full DOM Clobbering protection via namespace isolation,
1767
- * Prefix id and name attributes with `user-content-`
1768
- */
1769
- if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name') && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
1770
- // Remove the attribute with this value
1771
- _removeAttribute(name, currentNode);
1772
- // Prefix the value and later re-create the attribute with the sanitized value
1773
- value = SANITIZE_NAMED_PROPS_PREFIX + value;
1774
- }
1775
- // Else: already prefixed, leave the attribute alone — the prefix is
1776
- // itself the clobbering protection, and re-applying it is incorrect.
1777
- /* Work around a security issue with comments inside attributes */
1778
- if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
1779
- _removeAttribute(name, currentNode);
1780
- continue;
1781
- }
1782
- /* Make sure we cannot easily use animated hrefs, even if animations are allowed */
1783
- if (lcName === 'attributename' && stringMatch(value, 'href')) {
1784
- _removeAttribute(name, currentNode);
1785
- continue;
1786
- }
1787
- /* Did the hooks force-keep the attribute? */
1788
- if (hookEvent.forceKeepAttr) {
1789
- continue;
1790
- }
1791
- /* Did the hooks approve of the attribute? */
1792
- if (!hookEvent.keepAttr) {
1793
- _removeAttribute(name, currentNode);
1794
- continue;
1795
- }
1796
- /* Work around a security issue in jQuery 3.0 */
1797
- if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(SELF_CLOSING_TAG, value)) {
1798
- _removeAttribute(name, currentNode);
1799
- continue;
1800
- }
1801
- /* Sanitize attribute content to be template-safe */
1802
- if (SAFE_FOR_TEMPLATES) {
1803
- value = _stripTemplateExpressions(value);
1804
- }
1805
- /* Is `value` valid for this attribute? */
1806
- if (!_isValidAttribute(lcTag, lcName, value)) {
1807
- _removeAttribute(name, currentNode);
1808
- continue;
1809
- }
1810
- /* Handle attributes that require Trusted Types */
1811
- value = _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value);
1812
- /* Handle invalid data-* attribute set by try-catching it */
1813
- if (value !== initValue) {
1814
- _setAttributeValue(currentNode, name, namespaceURI, value);
1815
- }
1816
- }
1817
- /* Execute a hook if present */
1818
- _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
1819
- };
1820
- /**
1821
- * _sanitizeShadowDOM
1822
- *
1823
- * @param fragment to iterate over recursively
1824
- */
1825
- const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
1826
- let shadowNode = null;
1827
- const shadowIterator = _createNodeIterator(fragment);
1828
- /* Execute a hook if present */
1829
- _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
1830
- while (shadowNode = shadowIterator.nextNode()) {
1831
- /* Execute a hook if present */
1832
- _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
1833
- /* Sanitize tags and elements */
1834
- _sanitizeElements(shadowNode);
1835
- /* Check attributes next */
1836
- _sanitizeAttributes(shadowNode);
1837
- /* Deep shadow DOM detected.
1838
- Realm-safe check (GHSA-hpcv-96wg-7vj8): use nodeType against the
1839
- DOCUMENT_FRAGMENT_NODE constant rather than instanceof, so we
1840
- recurse into <template>.content from foreign realms too. */
1841
- if (_isDocumentFragment(shadowNode.content)) {
1842
- _sanitizeShadowDOM2(shadowNode.content);
1843
- }
1844
- /* An element iterated here may itself host an attached
1845
- shadow root. The default NodeIterator does not enter shadow
1846
- trees, so a shadow root nested inside template.content was
1847
- previously reached by no walk at all (the pre-pass at
1848
- _sanitizeAttachedShadowRoots descends via childNodes, which
1849
- doesn't enter template.content; the template-content recursion
1850
- above iterates the content but never inspected shadowRoot).
1851
- Walk it explicitly. The nodeType guard avoids reading
1852
- shadowRoot off text / comment / CDATA / PI nodes that the
1853
- iterator also surfaces. */
1854
- const shadowNodeType = getNodeType ? getNodeType(shadowNode) : shadowNode.nodeType;
1855
- if (shadowNodeType === NODE_TYPE.element) {
1856
- const innerSr = getShadowRoot(shadowNode);
1857
- if (_isDocumentFragment(innerSr)) {
1858
- _sanitizeAttachedShadowRoots(innerSr);
1859
- _sanitizeShadowDOM2(innerSr);
1860
- }
1861
- }
1862
- }
1863
- /* Execute a hook if present */
1864
- _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
1865
- };
1866
- /**
1867
- * _sanitizeAttachedShadowRoots
1868
- *
1869
- * Walks `root` and feeds every attached shadow root we encounter into
1870
- * the existing _sanitizeShadowDOM pipeline. The default node iterator
1871
- * does not descend into shadow trees, so nodes inside an attached
1872
- * shadow root would otherwise be skipped entirely.
1873
- *
1874
- * Two real input paths put attached shadow roots in front of us:
1875
- * 1. IN_PLACE on a DOM node that already has shadow roots attached.
1876
- * 2. DOM-node input where importNode(dirty, true) deep-clones the
1877
- * shadow root because it was created with `clonable: true`.
1878
- *
1879
- * This pass runs once, up front, so the main iteration loop (and the
1880
- * existing _sanitizeShadowDOM template-content recursion) stay
1881
- * untouched — string-input paths are not affected.
1882
- *
1883
- * @param root the subtree root to walk for attached shadow roots
1884
- */
1885
- const _sanitizeAttachedShadowRoots = function _sanitizeAttachedShadowRoots(root) {
1886
- /* Iterative (explicit stack) rather than per-child recursion. DOM APIs
1887
- impose no depth cap, so an attacker-shaped tree (JSON/CRDT/editor data
1888
- built straight into the DOM — the IN_PLACE surface) deeper than the JS
1889
- call-stack budget would otherwise overflow native recursion here and
1890
- throw at the IN_PLACE entry pre-pass, before a single node is
1891
- sanitized, leaving the caller's live tree untouched (fail-open). See
1892
- campaign-3 F4. A heap stack keeps depth off the call stack.
1893
- Each work item is either a node to descend into, or a deferred
1894
- `_sanitizeShadowDOM` for an already-walked shadow root. The deferred
1895
- form preserves the original post-order discipline: a shadow root's
1896
- nested shadow roots are discovered before the outer shadow is
1897
- sanitized (which may remove hosts). Pushes are in reverse of the
1898
- desired processing order (LIFO): template content, then children, then
1899
- the shadow-sanitize, then the shadow walk — so the order matches the
1900
- previous recursion exactly. */
1901
- const stack = [{
1902
- node: root,
1903
- shadow: null
1904
- }];
1905
- while (stack.length > 0) {
1906
- const item = stack.pop();
1907
- /* Deferred shadow-DOM sanitisation: runs after its subtree was walked. */
1908
- if (item.shadow) {
1909
- _sanitizeShadowDOM2(item.shadow);
1910
- continue;
1911
- }
1912
- const node = item.node;
1913
- const nodeType = getNodeType ? getNodeType(node) : node.nodeType;
1914
- const isElement = nodeType === NODE_TYPE.element;
1915
- /* (pushed last → processed first) Children, snapshotted in reverse so
1916
- the first child is processed first. Snapshotting matters because a
1917
- hook may detach siblings mid-walk. */
1918
- const childNodes = getChildNodes(node);
1919
- if (childNodes) {
1920
- for (let i = childNodes.length - 1; i >= 0; --i) {
1921
- stack.push({
1922
- node: childNodes[i],
1923
- shadow: null
1924
- });
1925
- }
1926
- }
1927
- /* (pushed before children → processed after them, matching the old
1928
- "template content last" order) When the node is a <template>,
1929
- descend into its content. */
1930
- if (isElement) {
1931
- const rootName = getNodeName ? getNodeName(node) : null;
1932
- if (typeof rootName === 'string' && transformCaseFunc(rootName) === 'template') {
1933
- const content = node.content;
1934
- if (_isDocumentFragment(content)) {
1935
- stack.push({
1936
- node: content,
1937
- shadow: null
1938
- });
1939
- }
1940
- }
1941
- }
1942
- /* Shadow root (processed first): walk its subtree, then sanitise it.
1943
- Realm-safe check (GHSA-hpcv-96wg-7vj8): nodeType-based detection
1944
- rather than `instanceof DocumentFragment`, which is realm-bound and
1945
- silently skipped foreign-realm shadow roots (e.g.
1946
- iframe.contentDocument attachShadow). */
1947
- if (isElement) {
1948
- const sr = getShadowRoot(node);
1949
- if (_isDocumentFragment(sr)) {
1950
- /* Push the deferred sanitise first so it pops after the shadow
1951
- walk we push next, i.e. nested shadow roots are discovered
1952
- before this one is sanitised. */
1953
- stack.push({
1954
- node: null,
1955
- shadow: sr
1956
- }, {
1957
- node: sr,
1958
- shadow: null
1959
- });
1960
- }
1961
- }
1962
- }
1963
- };
1964
- // eslint-disable-next-line complexity
1965
- DOMPurify.sanitize = function (dirty) {
1966
- let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1967
- let body = null;
1968
- let importedNode = null;
1969
- let currentNode = null;
1970
- let returnNode = null;
1971
- /* Make sure we have a string to sanitize.
1972
- DO NOT return early, as this will return the wrong type if
1973
- the user has requested a DOM object rather than a string */
1974
- IS_EMPTY_INPUT = !dirty;
1975
- if (IS_EMPTY_INPUT) {
1976
- dirty = '<!-->';
1977
- }
1978
- /* Stringify, in case dirty is an object */
1979
- if (typeof dirty !== 'string' && !_isNode(dirty)) {
1980
- dirty = stringifyValue(dirty);
1981
- if (typeof dirty !== 'string') {
1982
- throw typeErrorCreate('dirty is not a string, aborting');
1983
- }
1984
- }
1985
- /* Return dirty HTML if DOMPurify cannot run */
1986
- if (!DOMPurify.isSupported) {
1987
- return dirty;
1988
- }
1989
- /* Assign config vars */
1990
- if (SET_CONFIG) {
1991
- /* Persistent setConfig() path: _parseConfig is skipped, so the sets are
1992
- * not re-derived per call. Restore them from the pristine bindings
1993
- * captured at setConfig() time so a previous call's hook clone (mutated
1994
- * below) does not carry over. */
1995
- ALLOWED_TAGS = SET_CONFIG_ALLOWED_TAGS;
1996
- ALLOWED_ATTR = SET_CONFIG_ALLOWED_ATTR;
1997
- } else {
1998
- _parseConfig(cfg);
1999
- }
2000
- /* Clone the hook-mutable allowlists before the walk whenever an
2001
- * uponSanitize* hook is registered. The hook event exposes ALLOWED_TAGS
2002
- * and ALLOWED_ATTR by reference (as allowedTags / allowedAttributes), so
2003
- * a hook that widens them would otherwise mutate the shared set
2004
- * permanently: across later calls and across every element. Cloning per
2005
- * walk keeps documented in-call widening working while scoping it to the
2006
- * call. A single guard for both config paths - the per-call path rebinds
2007
- * the sets in _parseConfig each call, the persistent path restores them
2008
- * from the captured bindings just above - so the two cannot diverge. */
2009
- if (hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) {
2010
- ALLOWED_TAGS = clone(ALLOWED_TAGS);
2011
- }
2012
- if (hooks.uponSanitizeAttribute.length > 0) {
2013
- ALLOWED_ATTR = clone(ALLOWED_ATTR);
2014
- }
2015
- /* Clean up removed elements */
2016
- DOMPurify.removed = [];
2017
- /* Resolve IN_PLACE for this call without mutating persistent config.
2018
- Writing the IN_PLACE closure variable here leaks under setConfig(),
2019
- where _parseConfig is skipped on later calls: a single string call would
2020
- disable in-place mode for every subsequent node call, returning a
2021
- sanitized copy while leaving the caller's node — which in-place callers
2022
- keep using and whose return value they ignore — unsanitized. REPORT-2. */
2023
- const inPlace = IN_PLACE && typeof dirty !== 'string' && _isNode(dirty);
2024
- if (inPlace) {
2025
- /* Do some early pre-sanitization to avoid unsafe root nodes.
2026
- Read nodeName through the cached prototype getter — a clobbering
2027
- child named "nodeName" on the form root would otherwise shadow
2028
- the property and let this check skip the root-allowlist
2029
- validation entirely. */
2030
- const nn = getNodeName ? getNodeName(dirty) : dirty.nodeName;
2031
- if (typeof nn === 'string') {
2032
- const tagName = transformCaseFunc(nn);
2033
- if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
2034
- throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
2035
- }
2036
- }
2037
- /* Pre-flight the root through _isClobbered. The iterator-driven
2038
- removal path can not detach a parent-less root: _forceRemove
2039
- falls through to Element.prototype.remove(), which per spec
2040
- is a no-op on a node with no parent. A clobbered root would
2041
- then survive the main loop with its attributes uninspected,
2042
- because _sanitizeAttributes early-returns on _isClobbered. The
2043
- result would be an attacker-controlled form, complete with any
2044
- event-handler attributes the caller passed in, handed back to
2045
- the application unsanitized. Refuse to sanitize such a root
2046
- the same way we refuse a forbidden tag. GHSA-r47g-fvhr-h676. */
2047
- if (_isClobbered(dirty)) {
2048
- throw typeErrorCreate('root node is clobbered and cannot be sanitized in-place');
2049
- }
2050
- /* Sanitize attached shadow roots before the main iterator runs.
2051
- The iterator does not descend into shadow trees. Same fail-closed
2052
- barrier as the main walk (campaign-3 F2): a custom-element reaction
2053
- inside a shadow root could abort this pre-pass before the walk runs,
2054
- which would otherwise leave the entire live tree unsanitized. */
2055
- try {
2056
- _sanitizeAttachedShadowRoots(dirty);
2057
- } catch (error) {
2058
- _neutralizeRoot(dirty);
2059
- throw error;
2060
- }
2061
- } else if (_isNode(dirty)) {
2062
- /* If dirty is a DOM element, append to an empty document to avoid
2063
- elements being stripped by the parser */
2064
- body = _initDocument('<!---->');
2065
- importedNode = body.ownerDocument.importNode(dirty, true);
2066
- if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === 'BODY') {
2067
- /* Node is already a body, use as is */
2068
- body = importedNode;
2069
- } else if (importedNode.nodeName === 'HTML') {
2070
- body = importedNode;
2071
- } else {
2072
- // eslint-disable-next-line unicorn/prefer-dom-node-append
2073
- body.appendChild(importedNode);
2074
- }
2075
- /* Clonable shadow roots are deep-cloned by importNode(); sanitize
2076
- them before the main iterator runs, since the iterator does not
2077
- descend into shadow trees. The walk routes every read through a
2078
- cached prototype getter so clobbering descendants on a form root
2079
- cannot hide a shadow host from this pass. */
2080
- _sanitizeAttachedShadowRoots(importedNode);
2081
- } else {
2082
- /* Exit directly if we have nothing to do */
2083
- if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
2084
- // eslint-disable-next-line unicorn/prefer-includes
2085
- dirty.indexOf('<') === -1) {
2086
- return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(dirty) : dirty;
2087
- }
2088
- /* Initialize the document to work on */
2089
- body = _initDocument(dirty);
2090
- /* Check we have a DOM node from the data */
2091
- if (!body) {
2092
- return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
2093
- }
2094
- }
2095
- /* Remove first element node (ours) if FORCE_BODY is set */
2096
- if (body && FORCE_BODY) {
2097
- _forceRemove(body.firstChild);
2098
- }
2099
- /* Get node iterator */
2100
- const nodeIterator = _createNodeIterator(inPlace ? dirty : body);
2101
- /* Now start iterating over the created document.
2102
- The walk runs inside an exception barrier (campaign-3 F2): a re-entrant
2103
- engine/custom-element mutation can detach a node mid-walk so
2104
- `_forceRemove`'s parentless guard throws, aborting the loop. Without the
2105
- barrier the caller's in-place tree would be left half-sanitized with the
2106
- unvisited tail still armed. On any throw we fail closed — strip the
2107
- in-place root bare — then rethrow so the existing throw contract is
2108
- preserved. (String/DOM-copy paths never return the partial body, so the
2109
- propagating throw is already fail-closed there.) */
2110
- try {
2111
- while (currentNode = nodeIterator.nextNode()) {
2112
- /* Sanitize tags and elements */
2113
- _sanitizeElements(currentNode);
2114
- /* Check attributes next */
2115
- _sanitizeAttributes(currentNode);
2116
- /* Shadow DOM detected, sanitize it.
2117
- Realm-safe check (GHSA-hpcv-96wg-7vj8): nodeType-based detection
2118
- instead of instanceof, so foreign-realm <template>.content is
2119
- walked correctly. */
2120
- if (_isDocumentFragment(currentNode.content)) {
2121
- _sanitizeShadowDOM2(currentNode.content);
2122
- }
2123
- }
2124
- } catch (error) {
2125
- if (inPlace) {
2126
- _neutralizeRoot(dirty);
2127
- }
2128
- throw error;
2129
- }
2130
- /* If we sanitized `dirty` in-place, return it. */
2131
- if (inPlace) {
2132
- /* Fail-closed completion of the audit-5 F1 fix: every node removed from
2133
- the caller's live tree is detached but may still hold a queued
2134
- resource-event handler that fires in page scope after we return. The
2135
- move-hoist covers only disallowed-tag KEEP_CONTENT removals; strip the
2136
- non-allow-listed attributes off every other removed subtree (clobber,
2137
- mXSS, namespace, comments, KEEP_CONTENT:false, …) so those handlers are
2138
- cancelled before any event can fire. Runs synchronously, pre-return. */
2139
- arrayForEach(DOMPurify.removed, entry => {
2140
- if (entry.element) {
2141
- _neutralizeSubtree(entry.element);
2142
- }
2143
- });
2144
- if (SAFE_FOR_TEMPLATES) {
2145
- _scrubTemplateExpressions2(dirty);
2146
- }
2147
- return dirty;
2148
- }
2149
- /* Return sanitized string or DOM */
2150
- if (RETURN_DOM) {
2151
- if (SAFE_FOR_TEMPLATES) {
2152
- _scrubTemplateExpressions2(body);
2153
- }
2154
- if (RETURN_DOM_FRAGMENT) {
2155
- returnNode = createDocumentFragment.call(body.ownerDocument);
2156
- while (body.firstChild) {
2157
- // eslint-disable-next-line unicorn/prefer-dom-node-append
2158
- returnNode.appendChild(body.firstChild);
2159
- }
2160
- } else {
2161
- returnNode = body;
2162
- }
2163
- if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
2164
- /*
2165
- AdoptNode() is not used because internal state is not reset
2166
- (e.g. the past names map of a HTMLFormElement), this is safe
2167
- in theory but we would rather not risk another attack vector.
2168
- The state that is cloned by importNode() is explicitly defined
2169
- by the specs.
2170
- */
2171
- returnNode = importNode.call(originalDocument, returnNode, true);
2172
- }
2173
- return returnNode;
2174
- }
2175
- let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
2176
- /* Serialize doctype if allowed */
2177
- if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
2178
- serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
2179
- }
2180
- /* Sanitize final string template-safe */
2181
- if (SAFE_FOR_TEMPLATES) {
2182
- serializedHTML = _stripTemplateExpressions(serializedHTML);
2183
- }
2184
- return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(serializedHTML) : serializedHTML;
2185
- };
2186
- DOMPurify.setConfig = function () {
2187
- let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2188
- _parseConfig(cfg);
2189
- SET_CONFIG = true;
2190
- SET_CONFIG_ALLOWED_TAGS = ALLOWED_TAGS;
2191
- SET_CONFIG_ALLOWED_ATTR = ALLOWED_ATTR;
2192
- };
2193
- DOMPurify.clearConfig = function () {
2194
- CONFIG = null;
2195
- SET_CONFIG = false;
2196
- SET_CONFIG_ALLOWED_TAGS = null;
2197
- SET_CONFIG_ALLOWED_ATTR = null;
2198
- // Drop any caller-supplied Trusted Types policy so it cannot poison later
2199
- // `RETURN_TRUSTED_TYPE` output. The internal default policy (cached, and
2200
- // never recreated — Trusted Types throws on duplicate names) is restored by
2201
- // the next `_parseConfig`. See GHSA-vxr8-fq34-vvx9.
2202
- trustedTypesPolicy = defaultTrustedTypesPolicy;
2203
- emptyHTML = '';
2204
- };
2205
- DOMPurify.isValidAttribute = function (tag, attr, value) {
2206
- /* Initialize shared config vars if necessary. */
2207
- if (!CONFIG) {
2208
- _parseConfig({});
2209
- }
2210
- const lcTag = transformCaseFunc(tag);
2211
- const lcName = transformCaseFunc(attr);
2212
- return _isValidAttribute(lcTag, lcName, value);
2213
- };
2214
- DOMPurify.addHook = function (entryPoint, hookFunction) {
2215
- if (typeof hookFunction !== 'function') {
2216
- return;
2217
- }
2218
- /* Reject unknown entry points. Without this, a non-hook key (e.g.
2219
- * '__proto__') indexes off the prototype chain rather than a real
2220
- * hook array, and arrayPush then writes to Object.prototype. Guard
2221
- * with an own-property check against the known hook names. */
2222
- if (!objectHasOwnProperty(hooks, entryPoint)) {
2223
- return;
2224
- }
2225
- arrayPush(hooks[entryPoint], hookFunction);
2226
- };
2227
- DOMPurify.removeHook = function (entryPoint, hookFunction) {
2228
- if (!objectHasOwnProperty(hooks, entryPoint)) {
2229
- return undefined;
2230
- }
2231
- if (hookFunction !== undefined) {
2232
- const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
2233
- return index === -1 ? undefined : arraySplice(hooks[entryPoint], index, 1)[0];
2234
- }
2235
- return arrayPop(hooks[entryPoint]);
2236
- };
2237
- DOMPurify.removeHooks = function (entryPoint) {
2238
- if (!objectHasOwnProperty(hooks, entryPoint)) {
2239
- return;
2240
- }
2241
- hooks[entryPoint] = [];
2242
- };
2243
- DOMPurify.removeAllHooks = function () {
2244
- hooks = _createHooksMap();
2245
- };
2246
- return DOMPurify;
2247
- }
2248
- var purify = createDOMPurify();
2249
-
2250
- module.exports = purify;
2251
- //# sourceMappingURL=purify.es.js.map