@seed-ship/mcp-ui-solid 6.15.0 → 6.17.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 (265) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +20 -3
  3. package/dist/_virtual/leaflet.markercluster-src.cjs +30 -7
  4. package/dist/_virtual/leaflet.markercluster-src.cjs.map +1 -1
  5. package/dist/_virtual/leaflet.markercluster-src.js +28 -5
  6. package/dist/_virtual/leaflet.markercluster-src.js.map +1 -1
  7. package/dist/_virtual/{leaflet.markercluster-src2.cjs → leaflet2.markercluster-src.cjs} +1 -1
  8. package/dist/_virtual/leaflet2.markercluster-src.cjs.map +1 -0
  9. package/dist/_virtual/{leaflet.markercluster-src2.js → leaflet2.markercluster-src.js} +1 -1
  10. package/dist/_virtual/leaflet2.markercluster-src.js.map +1 -0
  11. package/dist/adapters/connector.js +1 -1
  12. package/dist/components/ActionGroupRenderer.js +1 -1
  13. package/dist/components/ActionRenderer.js +1 -1
  14. package/dist/components/AgentCard.js +1 -1
  15. package/dist/components/AgentHandoff.js +1 -1
  16. package/dist/components/ArtifactRenderer.js +1 -1
  17. package/dist/components/AutocompleteDropdown.cjs +1 -2
  18. package/dist/components/AutocompleteDropdown.cjs.map +1 -1
  19. package/dist/components/AutocompleteDropdown.js +2 -3
  20. package/dist/components/AutocompleteFormField.cjs +1 -2
  21. package/dist/components/AutocompleteFormField.cjs.map +1 -1
  22. package/dist/components/AutocompleteFormField.js +2 -3
  23. package/dist/components/BriefingDiff.js +1 -1
  24. package/dist/components/CarouselRenderer.js +1 -1
  25. package/dist/components/ChartJSRenderer.js +1 -1
  26. package/dist/components/ChatPrompt.js +1 -1
  27. package/dist/components/CodeBlockRenderer.js +1 -1
  28. package/dist/components/ComponentToolbar.js +1 -1
  29. package/dist/components/DataPreviewSection.js +1 -1
  30. package/dist/components/DegradedFallback.cjs.map +1 -1
  31. package/dist/components/DegradedFallback.d.ts +1 -1
  32. package/dist/components/DegradedFallback.js +1 -1
  33. package/dist/components/DegradedFallback.js.map +1 -1
  34. package/dist/components/DraggableGridItem.cjs +1 -2
  35. package/dist/components/DraggableGridItem.cjs.map +1 -1
  36. package/dist/components/DraggableGridItem.js +2 -3
  37. package/dist/components/EditableUIResourceRenderer.cjs +1 -2
  38. package/dist/components/EditableUIResourceRenderer.cjs.map +1 -1
  39. package/dist/components/EditableUIResourceRenderer.js +2 -3
  40. package/dist/components/ExpandableWrapper.js +2 -2
  41. package/dist/components/FeedbackInline.js +1 -1
  42. package/dist/components/FooterRenderer.js +1 -1
  43. package/dist/components/FormFieldRenderer.js +1 -1
  44. package/dist/components/FormRenderer.js +1 -1
  45. package/dist/components/GenerativeUIErrorBoundary.js +1 -1
  46. package/dist/components/GhostText.cjs +1 -2
  47. package/dist/components/GhostText.cjs.map +1 -1
  48. package/dist/components/GhostText.js +2 -3
  49. package/dist/components/GraphRenderer.cjs +2 -19
  50. package/dist/components/GraphRenderer.cjs.map +1 -1
  51. package/dist/components/GraphRenderer.d.ts.map +1 -1
  52. package/dist/components/GraphRenderer.js +2 -19
  53. package/dist/components/GraphRenderer.js.map +1 -1
  54. package/dist/components/GridRenderer.cjs +1 -2
  55. package/dist/components/GridRenderer.cjs.map +1 -1
  56. package/dist/components/GridRenderer.js +2 -3
  57. package/dist/components/ImageGalleryRenderer.js +1 -1
  58. package/dist/components/LightboxOverlay.js +1 -1
  59. package/dist/components/MapRenderer.cjs +10 -11
  60. package/dist/components/MapRenderer.cjs.map +1 -1
  61. package/dist/components/MapRenderer.d.ts +6 -1
  62. package/dist/components/MapRenderer.d.ts.map +1 -1
  63. package/dist/components/MapRenderer.js +7 -8
  64. package/dist/components/MapRenderer.js.map +1 -1
  65. package/dist/components/ModalRenderer.js +1 -1
  66. package/dist/components/PortalDropdownMenu.js +1 -1
  67. package/dist/components/PresentationFeedback.js +1 -1
  68. package/dist/components/RenderContext.js +1 -1
  69. package/dist/components/ResizeHandle.cjs +1 -2
  70. package/dist/components/ResizeHandle.cjs.map +1 -1
  71. package/dist/components/ResizeHandle.js +2 -3
  72. package/dist/components/ScratchpadPanel.js +1 -1
  73. package/dist/components/SplitStepper.js +1 -1
  74. package/dist/components/StreamingUIRenderer.js +1 -1
  75. package/dist/components/UIResourceRenderer.cjs +12 -1
  76. package/dist/components/UIResourceRenderer.cjs.map +1 -1
  77. package/dist/components/UIResourceRenderer.d.ts.map +1 -1
  78. package/dist/components/UIResourceRenderer.js +13 -2
  79. package/dist/components/UIResourceRenderer.js.map +1 -1
  80. package/dist/components/VerifiedText.js +1 -1
  81. package/dist/components/VideoRenderer.js +1 -1
  82. package/dist/components/index.d.ts.map +1 -1
  83. package/dist/index.d.cts +1 -1
  84. package/dist/index.d.ts +1 -1
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/core/component.cjs +1 -1
  87. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/core/component.js +1 -1
  88. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/axis/axis.cjs +1 -1
  89. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/axis/axis.js +1 -1
  90. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/axis/constant.cjs +1 -1
  91. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/axis/constant.js +1 -1
  92. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/axis/guides/grid.cjs +2 -2
  93. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/axis/guides/grid.js +2 -2
  94. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/axis/guides/labels.cjs +6 -6
  95. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/axis/guides/labels.js +6 -6
  96. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/axis/guides/line.cjs +1 -1
  97. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/axis/guides/line.js +1 -1
  98. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/axis/guides/ticks.cjs +2 -2
  99. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/axis/guides/ticks.js +2 -2
  100. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/axis/guides/title.cjs +1 -1
  101. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/axis/guides/title.js +1 -1
  102. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/axis/guides/utils.cjs +1 -1
  103. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/axis/guides/utils.js +1 -1
  104. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/grid/index.cjs +3 -3
  105. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/grid/index.js +3 -3
  106. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/indicator/indicator.cjs +4 -4
  107. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/indicator/indicator.js +4 -4
  108. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/legend/category/item.cjs +5 -5
  109. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/legend/category/item.js +5 -5
  110. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/legend/category/items.cjs +5 -5
  111. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/legend/category/items.js +5 -5
  112. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/legend/category.cjs +2 -2
  113. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/legend/category.js +2 -2
  114. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/legend/continuous/handle.cjs +1 -1
  115. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/legend/continuous/handle.js +1 -1
  116. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/legend/title/index.cjs +3 -3
  117. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/legend/title/index.js +3 -3
  118. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/marker/utils.cjs +1 -1
  119. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/marker/utils.js +1 -1
  120. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/navigator/index.cjs +5 -5
  121. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/navigator/index.js +5 -5
  122. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/poptip/index.cjs +2 -2
  123. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/poptip/index.js +2 -2
  124. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/select/option.cjs +2 -2
  125. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/select/option.js +2 -2
  126. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/select/select.cjs +2 -2
  127. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/select/select.js +2 -2
  128. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/slider/handle.cjs +2 -2
  129. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/slider/handle.js +2 -2
  130. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/slider/index.cjs +4 -4
  131. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/slider/index.js +4 -4
  132. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/sparkline/columns.cjs +1 -1
  133. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/sparkline/columns.js +1 -1
  134. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/sparkline/index.cjs +2 -2
  135. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/sparkline/index.js +2 -2
  136. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/sparkline/lines.cjs +1 -1
  137. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/sparkline/lines.js +1 -1
  138. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/sparkline/utils.cjs +2 -2
  139. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/sparkline/utils.js +2 -2
  140. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/timebar/controller.cjs +2 -2
  141. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/timebar/controller.js +2 -2
  142. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/timebar/handle.cjs +1 -1
  143. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/timebar/handle.js +1 -1
  144. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/timebar/icons.cjs +4 -4
  145. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/timebar/icons.js +4 -4
  146. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/timebar/timebar.cjs +3 -3
  147. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/timebar/timebar.js +3 -3
  148. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/tooltip/index.cjs +1 -1
  149. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/ui/tooltip/index.js +1 -1
  150. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/util/selection.cjs +1 -1
  151. package/dist/node_modules/.pnpm/@antv_component@2.1.11/node_modules/@antv/component/esm/util/selection.js +1 -1
  152. package/dist/node_modules/.pnpm/@antv_g-lite@2.7.0/node_modules/@antv/g-lite/dist/index.esm.js +1 -1
  153. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/behaviors/scroll-canvas.cjs +1 -1
  154. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/behaviors/scroll-canvas.js +1 -1
  155. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/elements/combos/base-combo.cjs +1 -1
  156. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/elements/combos/base-combo.js +1 -1
  157. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/elements/edges/base-edge.cjs +1 -1
  158. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/elements/edges/base-edge.js +1 -1
  159. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/index.cjs +58 -58
  160. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/plugins/legend.cjs +1 -1
  161. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/plugins/legend.js +1 -1
  162. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/plugins/minimap/index.cjs +1 -1
  163. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/plugins/minimap/index.js +1 -1
  164. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/plugins/snapline/index.cjs +1 -1
  165. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/plugins/snapline/index.js +1 -1
  166. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/plugins/tooltip.cjs +1 -1
  167. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/plugins/tooltip.js +1 -1
  168. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/registry/build-in.cjs +1 -1
  169. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/registry/build-in.js +1 -1
  170. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/runtime/data.cjs +1 -1
  171. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/runtime/data.js +1 -1
  172. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/runtime/element.cjs +1 -1
  173. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/runtime/element.js +1 -1
  174. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/runtime/graph.cjs +1 -1
  175. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/runtime/graph.js +1 -1
  176. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/runtime/layout.cjs +2 -2
  177. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/runtime/layout.js +2 -2
  178. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/runtime/viewport.cjs +1 -1
  179. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/runtime/viewport.js +1 -1
  180. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/utils/element.cjs +1 -1
  181. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/utils/element.js +1 -1
  182. package/dist/node_modules/.pnpm/@antv_g6@5.1.0/node_modules/@antv/g6/esm/utils/point.js +1 -1
  183. package/dist/node_modules/.pnpm/@antv_layout@2.0.0/node_modules/@antv/layout/lib/algorithm/antv-dagre/rank/index.js +1 -1
  184. package/dist/node_modules/.pnpm/@antv_layout@2.0.0/node_modules/@antv/layout/lib/algorithm/concentric/index.js +1 -1
  185. package/dist/node_modules/.pnpm/@antv_scale@0.4.16/node_modules/@antv/scale/esm/scales/continuous.cjs +1 -1
  186. package/dist/node_modules/.pnpm/@antv_scale@0.4.16/node_modules/@antv/scale/esm/scales/continuous.js +1 -1
  187. package/dist/node_modules/.pnpm/@tanstack_solid-virtual@3.13.18_solid-js@1.9.11/node_modules/@tanstack/solid-virtual/dist/esm/index.cjs +13 -0
  188. package/dist/node_modules/.pnpm/@tanstack_solid-virtual@3.13.18_solid-js@1.9.11/node_modules/@tanstack/solid-virtual/dist/esm/index.cjs.map +1 -1
  189. package/dist/node_modules/.pnpm/@tanstack_solid-virtual@3.13.18_solid-js@1.9.11/node_modules/@tanstack/solid-virtual/dist/esm/index.js +15 -2
  190. package/dist/node_modules/.pnpm/@tanstack_solid-virtual@3.13.18_solid-js@1.9.11/node_modules/@tanstack/solid-virtual/dist/esm/index.js.map +1 -1
  191. package/dist/node_modules/.pnpm/@tanstack_virtual-core@3.13.18/node_modules/@tanstack/virtual-core/dist/esm/index.cjs +64 -0
  192. package/dist/node_modules/.pnpm/@tanstack_virtual-core@3.13.18/node_modules/@tanstack/virtual-core/dist/esm/index.cjs.map +1 -1
  193. package/dist/node_modules/.pnpm/@tanstack_virtual-core@3.13.18/node_modules/@tanstack/virtual-core/dist/esm/index.js +66 -2
  194. package/dist/node_modules/.pnpm/@tanstack_virtual-core@3.13.18/node_modules/@tanstack/virtual-core/dist/esm/index.js.map +1 -1
  195. package/dist/node_modules/.pnpm/@tanstack_virtual-core@3.13.18/node_modules/@tanstack/virtual-core/dist/esm/utils.cjs +1 -1
  196. package/dist/node_modules/.pnpm/@tanstack_virtual-core@3.13.18/node_modules/@tanstack/virtual-core/dist/esm/utils.cjs.map +1 -1
  197. package/dist/node_modules/.pnpm/@tanstack_virtual-core@3.13.18/node_modules/@tanstack/virtual-core/dist/esm/utils.js +1 -1
  198. package/dist/node_modules/.pnpm/@tanstack_virtual-core@3.13.18/node_modules/@tanstack/virtual-core/dist/esm/utils.js.map +1 -1
  199. package/dist/node_modules/.pnpm/color-string@1.9.1/node_modules/color-string/index.cjs +6 -6
  200. package/dist/node_modules/.pnpm/{dompurify@3.4.1 → dompurify@3.4.13}/node_modules/dompurify/dist/purify.es.cjs +671 -233
  201. package/dist/node_modules/.pnpm/dompurify@3.4.13/node_modules/dompurify/dist/purify.es.cjs.map +1 -0
  202. package/dist/node_modules/.pnpm/{dompurify@3.4.1 → dompurify@3.4.13}/node_modules/dompurify/dist/purify.es.js +671 -233
  203. package/dist/node_modules/.pnpm/dompurify@3.4.13/node_modules/dompurify/dist/purify.es.js.map +1 -0
  204. package/dist/node_modules/.pnpm/leaflet.markercluster@1.5.3_leaflet@1.9.4/node_modules/leaflet.markercluster/dist/leaflet.markercluster-src.cjs +7 -7
  205. package/dist/node_modules/.pnpm/leaflet.markercluster@1.5.3_leaflet@1.9.4/node_modules/leaflet.markercluster/dist/leaflet.markercluster-src.cjs.map +1 -1
  206. package/dist/node_modules/.pnpm/leaflet.markercluster@1.5.3_leaflet@1.9.4/node_modules/leaflet.markercluster/dist/leaflet.markercluster-src.js +7 -7
  207. package/dist/node_modules/.pnpm/leaflet.markercluster@1.5.3_leaflet@1.9.4/node_modules/leaflet.markercluster/dist/leaflet.markercluster-src.js.map +1 -1
  208. package/dist/node_modules/.pnpm/leaflet@1.9.4/node_modules/leaflet/dist/leaflet-src.cjs +83 -83
  209. package/dist/node_modules/.pnpm/leaflet@1.9.4/node_modules/leaflet/dist/leaflet-src.cjs.map +1 -1
  210. package/dist/node_modules/.pnpm/leaflet@1.9.4/node_modules/leaflet/dist/leaflet-src.js +83 -83
  211. package/dist/node_modules/.pnpm/leaflet@1.9.4/node_modules/leaflet/dist/leaflet-src.js.map +1 -1
  212. package/dist/plugins/groq.cjs +1 -2
  213. package/dist/plugins/groq.cjs.map +1 -1
  214. package/dist/plugins/groq.js +1 -2
  215. package/dist/plugins/rest.cjs +1 -2
  216. package/dist/plugins/rest.cjs.map +1 -1
  217. package/dist/plugins/rest.js +1 -2
  218. package/dist/plugins/supabase.cjs +1 -2
  219. package/dist/plugins/supabase.cjs.map +1 -1
  220. package/dist/plugins/supabase.js +1 -2
  221. package/dist/services/component-registry.cjs +223 -7
  222. package/dist/services/component-registry.cjs.map +1 -1
  223. package/dist/services/component-registry.d.ts +0 -3
  224. package/dist/services/component-registry.d.ts.map +1 -1
  225. package/dist/services/component-registry.js +223 -7
  226. package/dist/services/component-registry.js.map +1 -1
  227. package/dist/services/validation.cjs +1 -23
  228. package/dist/services/validation.cjs.map +1 -1
  229. package/dist/services/validation.d.ts.map +1 -1
  230. package/dist/services/validation.js +2 -24
  231. package/dist/services/validation.js.map +1 -1
  232. package/dist/types/index.d.ts +12 -6
  233. package/dist/types/index.d.ts.map +1 -1
  234. package/dist/types.d.cts +12 -6
  235. package/dist/types.d.ts +12 -6
  236. package/dist/utils/escape-html.cjs +10 -0
  237. package/dist/utils/escape-html.cjs.map +1 -0
  238. package/dist/utils/escape-html.d.ts +13 -0
  239. package/dist/utils/escape-html.d.ts.map +1 -0
  240. package/dist/utils/escape-html.js +10 -0
  241. package/dist/utils/escape-html.js.map +1 -0
  242. package/docs/briefs/BRIEF-graph-component-g6.md +10 -0
  243. package/package.json +2 -2
  244. package/src/components/DegradedFallback.tsx +1 -1
  245. package/src/components/GraphRenderer.tsx +1 -19
  246. package/src/components/MapRenderer.security.test.ts +55 -2
  247. package/src/components/MapRenderer.tsx +15 -13
  248. package/src/components/UIResourceRenderer.tsx +8 -0
  249. package/src/components/UnsupportedComponent.test.tsx +28 -1
  250. package/src/components/index.ts +3 -0
  251. package/src/hooks/useStreamingUI.test.ts +194 -0
  252. package/src/index.ts +1 -0
  253. package/src/services/component-registry.test.ts +104 -2
  254. package/src/services/component-registry.ts +236 -7
  255. package/src/services/validation.test.ts +26 -0
  256. package/src/services/validation.ts +12 -24
  257. package/src/types/index.ts +12 -26
  258. package/src/types/map-types.test.ts +20 -0
  259. package/src/utils/escape-html.test.ts +30 -0
  260. package/src/utils/escape-html.ts +24 -0
  261. package/tsconfig.tsbuildinfo +1 -1
  262. package/dist/_virtual/leaflet.markercluster-src2.cjs.map +0 -1
  263. package/dist/_virtual/leaflet.markercluster-src2.js.map +0 -1
  264. package/dist/node_modules/.pnpm/dompurify@3.4.1/node_modules/dompurify/dist/purify.es.cjs.map +0 -1
  265. package/dist/node_modules/.pnpm/dompurify@3.4.1/node_modules/dompurify/dist/purify.es.js.map +0 -1
@@ -1,20 +1,47 @@
1
- /*! @license DOMPurify 3.4.1 | (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.1/LICENSE */
2
- const {
3
- entries,
4
- setPrototypeOf,
5
- isFrozen,
6
- getPrototypeOf,
7
- getOwnPropertyDescriptor
8
- } = Object;
9
- let {
10
- freeze,
11
- seal,
12
- create
13
- } = Object;
14
- let {
15
- apply,
16
- construct
17
- } = typeof Reflect !== "undefined" && Reflect;
1
+ /*! @license DOMPurify 3.4.13 | (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.13/LICENSE */
2
+ function _arrayLikeToArray(r, a) {
3
+ (null == a || a > r.length) && (a = r.length);
4
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
5
+ return n;
6
+ }
7
+ function _arrayWithHoles(r) {
8
+ if (Array.isArray(r)) return r;
9
+ }
10
+ function _iterableToArrayLimit(r, l) {
11
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
12
+ if (null != t) {
13
+ var e, n, i, u, a = [], f = true, o = false;
14
+ try {
15
+ if (i = (t = t.call(r)).next, 0 === l) ;
16
+ else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = true) ;
17
+ } catch (r2) {
18
+ o = true, n = r2;
19
+ } finally {
20
+ try {
21
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
22
+ } finally {
23
+ if (o) throw n;
24
+ }
25
+ }
26
+ return a;
27
+ }
28
+ }
29
+ function _nonIterableRest() {
30
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
31
+ }
32
+ function _slicedToArray(r, e) {
33
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
34
+ }
35
+ function _unsupportedIterableToArray(r, a) {
36
+ if (r) {
37
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
38
+ var t = {}.toString.call(r).slice(8, -1);
39
+ 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;
40
+ }
41
+ }
42
+ const entries = Object.entries, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
43
+ let freeze = Object.freeze, seal = Object.seal, create = Object.create;
44
+ let _ref = typeof Reflect !== "undefined" && Reflect, apply = _ref.apply, construct = _ref.construct;
18
45
  if (!freeze) {
19
46
  freeze = function freeze2(x) {
20
47
  return x;
@@ -115,7 +142,10 @@ function cleanArray(array) {
115
142
  }
116
143
  function clone(object) {
117
144
  const newObject = create(null);
118
- for (const [property, value] of entries(object)) {
145
+ for (const _ref2 of entries(object)) {
146
+ var _ref3 = _slicedToArray(_ref2, 2);
147
+ const property = _ref3[0];
148
+ const value = _ref3[1];
119
149
  const isPropertyExist = objectHasOwnProperty(object, property);
120
150
  if (isPropertyExist) {
121
151
  if (arrayIsArray(value)) {
@@ -200,13 +230,13 @@ const svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "
200
230
  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"]);
201
231
  const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
202
232
  const text = freeze(["#text"]);
203
- const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "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"]);
204
- 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"]);
233
+ 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"]);
234
+ 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", "dominant-baseline", "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-orientation", "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"]);
205
235
  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"]);
206
236
  const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
207
- const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
208
- const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
209
- const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm);
237
+ const MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
238
+ const ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
239
+ const TMPLIT_EXPR = seal(/\${[\w\W]*/g);
210
240
  const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
211
241
  const ARIA_ATTR = seal(/^aria-[\-\w]+$/);
212
242
  const IS_ALLOWED_URI = seal(
@@ -220,26 +250,26 @@ const ATTR_WHITESPACE = seal(
220
250
  );
221
251
  const DOCTYPE_NAME = seal(/^html$/i);
222
252
  const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
223
- var EXPRESSIONS = /* @__PURE__ */ Object.freeze({
224
- __proto__: null,
225
- ARIA_ATTR,
226
- ATTR_WHITESPACE,
227
- CUSTOM_ELEMENT,
228
- DATA_ATTR,
229
- DOCTYPE_NAME,
230
- ERB_EXPR,
231
- IS_ALLOWED_URI,
232
- IS_SCRIPT_OR_DATA,
233
- MUSTACHE_EXPR,
234
- TMPLIT_EXPR
235
- });
253
+ const ELEMENT_MARKUP_PROBE = seal(/<[/\w!]/g);
254
+ const COMMENT_MARKUP_PROBE = seal(/<[/\w]/g);
255
+ const FALLBACK_TAG_CLOSE = seal(/<\/no(script|embed|frames)/i);
256
+ const SELF_CLOSING_TAG = seal(/\/>/i);
236
257
  const NODE_TYPE = {
237
258
  element: 1,
259
+ attribute: 2,
238
260
  text: 3,
261
+ cdataSection: 4,
262
+ entityReference: 5,
239
263
  // Deprecated
240
- progressingInstruction: 7,
264
+ entityNode: 6,
265
+ // Deprecated
266
+ processingInstruction: 7,
241
267
  comment: 8,
242
- document: 9
268
+ document: 9,
269
+ documentType: 10,
270
+ documentFragment: 11,
271
+ notation: 12
272
+ // Deprecated
243
273
  };
244
274
  const getGlobal = function getGlobal2() {
245
275
  return typeof window === "undefined" ? null : window;
@@ -281,37 +311,37 @@ const _createHooksMap = function _createHooksMap2() {
281
311
  uponSanitizeShadowNode: []
282
312
  };
283
313
  };
314
+ const _resolveSetOption = function _resolveSetOption2(cfg, key, fallback, options) {
315
+ return objectHasOwnProperty(cfg, key) && arrayIsArray(cfg[key]) ? addToSet(options.base ? clone(options.base) : {}, cfg[key], options.transform) : fallback;
316
+ };
284
317
  function createDOMPurify() {
285
318
  let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
286
319
  const DOMPurify = (root) => createDOMPurify(root);
287
- DOMPurify.version = "3.4.1";
320
+ DOMPurify.version = "3.4.13";
288
321
  DOMPurify.removed = [];
289
322
  if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
290
323
  DOMPurify.isSupported = false;
291
324
  return DOMPurify;
292
325
  }
293
- let {
294
- document
295
- } = window2;
326
+ let document = window2.document;
296
327
  const originalDocument = document;
297
328
  const currentScript = originalDocument.currentScript;
298
- const {
299
- DocumentFragment,
300
- HTMLTemplateElement,
301
- Node,
302
- Element,
303
- NodeFilter,
304
- NamedNodeMap = window2.NamedNodeMap || window2.MozNamedAttrMap,
305
- HTMLFormElement,
306
- DOMParser,
307
- trustedTypes
308
- } = window2;
329
+ window2.DocumentFragment;
330
+ const HTMLTemplateElement = window2.HTMLTemplateElement, Node = window2.Node, Element = window2.Element, NodeFilter = window2.NodeFilter, _window$NamedNodeMap = window2.NamedNodeMap;
331
+ _window$NamedNodeMap === void 0 ? window2.NamedNodeMap || window2.MozNamedAttrMap : _window$NamedNodeMap;
332
+ window2.HTMLFormElement;
333
+ const DOMParser = window2.DOMParser, trustedTypes = window2.trustedTypes;
309
334
  const ElementPrototype = Element.prototype;
310
335
  const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
311
336
  const remove = lookupGetter(ElementPrototype, "remove");
312
337
  const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
313
338
  const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
314
339
  const getParentNode = lookupGetter(ElementPrototype, "parentNode");
340
+ const getShadowRoot = lookupGetter(ElementPrototype, "shadowRoot");
341
+ const getAttributes = lookupGetter(ElementPrototype, "attributes");
342
+ const getNodeType = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeType") : null;
343
+ const getNodeName = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeName") : null;
344
+ const getOwnerDocument = Node && Node.prototype ? lookupGetter(Node.prototype, "ownerDocument") : null;
315
345
  if (typeof HTMLTemplateElement === "function") {
316
346
  const template = document.createElement("template");
317
347
  if (template.content && template.content.ownerDocument) {
@@ -320,30 +350,45 @@ function createDOMPurify() {
320
350
  }
321
351
  let trustedTypesPolicy;
322
352
  let emptyHTML = "";
323
- const {
324
- implementation,
325
- createNodeIterator,
326
- createDocumentFragment,
327
- getElementsByTagName
328
- } = document;
329
- const {
330
- importNode
331
- } = originalDocument;
353
+ let defaultTrustedTypesPolicy;
354
+ let defaultTrustedTypesPolicyResolved = false;
355
+ let IN_TRUSTED_TYPES_POLICY = 0;
356
+ const _assertNotInTrustedTypesPolicy = function _assertNotInTrustedTypesPolicy2() {
357
+ if (IN_TRUSTED_TYPES_POLICY > 0) {
358
+ 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.');
359
+ }
360
+ };
361
+ const _createTrustedHTML = function _createTrustedHTML2(html2) {
362
+ _assertNotInTrustedTypesPolicy();
363
+ IN_TRUSTED_TYPES_POLICY++;
364
+ try {
365
+ return trustedTypesPolicy.createHTML(html2);
366
+ } finally {
367
+ IN_TRUSTED_TYPES_POLICY--;
368
+ }
369
+ };
370
+ const _createTrustedScriptURL = function _createTrustedScriptURL2(scriptUrl) {
371
+ _assertNotInTrustedTypesPolicy();
372
+ IN_TRUSTED_TYPES_POLICY++;
373
+ try {
374
+ return trustedTypesPolicy.createScriptURL(scriptUrl);
375
+ } finally {
376
+ IN_TRUSTED_TYPES_POLICY--;
377
+ }
378
+ };
379
+ const _getDefaultTrustedTypesPolicy = function _getDefaultTrustedTypesPolicy2() {
380
+ if (!defaultTrustedTypesPolicyResolved) {
381
+ defaultTrustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
382
+ defaultTrustedTypesPolicyResolved = true;
383
+ }
384
+ return defaultTrustedTypesPolicy;
385
+ };
386
+ const _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName;
387
+ const importNode = originalDocument.importNode;
332
388
  let hooks = _createHooksMap();
333
389
  DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
334
- const {
335
- MUSTACHE_EXPR: MUSTACHE_EXPR2,
336
- ERB_EXPR: ERB_EXPR2,
337
- TMPLIT_EXPR: TMPLIT_EXPR2,
338
- DATA_ATTR: DATA_ATTR2,
339
- ARIA_ATTR: ARIA_ATTR2,
340
- IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA2,
341
- ATTR_WHITESPACE: ATTR_WHITESPACE2,
342
- CUSTOM_ELEMENT: CUSTOM_ELEMENT2
343
- } = EXPRESSIONS;
344
- let {
345
- IS_ALLOWED_URI: IS_ALLOWED_URI$1
346
- } = EXPRESSIONS;
390
+ const MUSTACHE_EXPR$1 = MUSTACHE_EXPR, ERB_EXPR$1 = ERB_EXPR, TMPLIT_EXPR$1 = TMPLIT_EXPR, DATA_ATTR$1 = DATA_ATTR, ARIA_ATTR$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$1 = ATTR_WHITESPACE, CUSTOM_ELEMENT$1 = CUSTOM_ELEMENT;
391
+ let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
347
392
  let ALLOWED_TAGS = null;
348
393
  const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
349
394
  let ALLOWED_ATTR = null;
@@ -392,6 +437,8 @@ function createDOMPurify() {
392
437
  let SAFE_FOR_XML = true;
393
438
  let WHOLE_DOCUMENT = false;
394
439
  let SET_CONFIG = false;
440
+ let SET_CONFIG_ALLOWED_TAGS = null;
441
+ let SET_CONFIG_ALLOWED_ATTR = null;
395
442
  let FORCE_BODY = false;
396
443
  let RETURN_DOM = false;
397
444
  let RETURN_DOM_FRAGMENT = false;
@@ -403,7 +450,43 @@ function createDOMPurify() {
403
450
  let IN_PLACE = false;
404
451
  let USE_PROFILES = {};
405
452
  let FORBID_CONTENTS = null;
406
- const DEFAULT_FORBID_CONTENTS = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
453
+ const DEFAULT_FORBID_CONTENTS = addToSet({}, [
454
+ "annotation-xml",
455
+ "audio",
456
+ "colgroup",
457
+ "desc",
458
+ "foreignobject",
459
+ "head",
460
+ "iframe",
461
+ "math",
462
+ "mi",
463
+ "mn",
464
+ "mo",
465
+ "ms",
466
+ "mtext",
467
+ "noembed",
468
+ "noframes",
469
+ "noscript",
470
+ "plaintext",
471
+ "script",
472
+ // <selectedcontent> mirrors the selected <option>'s subtree, cloned by
473
+ // the UA (customizable <select>) — including any on* handlers — and the
474
+ // engine re-mirrors synchronously whenever a removal changes which
475
+ // option/selectedcontent is current, even inside DOMPurify's inert
476
+ // DOMParser document. Hoisting its children on removal re-inserts a fresh
477
+ // mirror target ahead of the walk, which the engine refills, looping
478
+ // forever (DoS) and amplifying output. Dropping its content on removal
479
+ // (rather than hoisting) breaks that cascade; the content is a duplicate
480
+ // of the option, which is sanitized on its own. See campaign-3 F1/F6.
481
+ "selectedcontent",
482
+ "style",
483
+ "svg",
484
+ "template",
485
+ "thead",
486
+ "title",
487
+ "video",
488
+ "xmp"
489
+ ]);
407
490
  let DATA_URI_TAGS = null;
408
491
  const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
409
492
  let URI_SAFE_ATTRIBUTES = null;
@@ -415,8 +498,10 @@ function createDOMPurify() {
415
498
  let IS_EMPTY_INPUT = false;
416
499
  let ALLOWED_NAMESPACES = null;
417
500
  const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
418
- let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
419
- let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
501
+ const DEFAULT_MATHML_TEXT_INTEGRATION_POINTS = freeze(["mi", "mo", "mn", "ms", "mtext"]);
502
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
503
+ const DEFAULT_HTML_INTEGRATION_POINTS = freeze(["annotation-xml"]);
504
+ let HTML_INTEGRATION_POINTS = addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
420
505
  const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
421
506
  let PARSER_MEDIA_TYPE = null;
422
507
  const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
@@ -439,14 +524,32 @@ function createDOMPurify() {
439
524
  PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
440
525
  SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
441
526
  transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
442
- ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") && arrayIsArray(cfg.ALLOWED_TAGS) ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
443
- ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") && arrayIsArray(cfg.ALLOWED_ATTR) ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
444
- ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") && arrayIsArray(cfg.ALLOWED_NAMESPACES) ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
445
- URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR) ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
446
- DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") && arrayIsArray(cfg.ADD_DATA_URI_TAGS) ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
447
- FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS) ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
448
- FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") && arrayIsArray(cfg.FORBID_TAGS) ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
449
- FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") && arrayIsArray(cfg.FORBID_ATTR) ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
527
+ ALLOWED_TAGS = _resolveSetOption(cfg, "ALLOWED_TAGS", DEFAULT_ALLOWED_TAGS, {
528
+ transform: transformCaseFunc
529
+ });
530
+ ALLOWED_ATTR = _resolveSetOption(cfg, "ALLOWED_ATTR", DEFAULT_ALLOWED_ATTR, {
531
+ transform: transformCaseFunc
532
+ });
533
+ ALLOWED_NAMESPACES = _resolveSetOption(cfg, "ALLOWED_NAMESPACES", DEFAULT_ALLOWED_NAMESPACES, {
534
+ transform: stringToString
535
+ });
536
+ URI_SAFE_ATTRIBUTES = _resolveSetOption(cfg, "ADD_URI_SAFE_ATTR", DEFAULT_URI_SAFE_ATTRIBUTES, {
537
+ transform: transformCaseFunc,
538
+ base: DEFAULT_URI_SAFE_ATTRIBUTES
539
+ });
540
+ DATA_URI_TAGS = _resolveSetOption(cfg, "ADD_DATA_URI_TAGS", DEFAULT_DATA_URI_TAGS, {
541
+ transform: transformCaseFunc,
542
+ base: DEFAULT_DATA_URI_TAGS
543
+ });
544
+ FORBID_CONTENTS = _resolveSetOption(cfg, "FORBID_CONTENTS", DEFAULT_FORBID_CONTENTS, {
545
+ transform: transformCaseFunc
546
+ });
547
+ FORBID_TAGS = _resolveSetOption(cfg, "FORBID_TAGS", clone({}), {
548
+ transform: transformCaseFunc
549
+ });
550
+ FORBID_ATTR = _resolveSetOption(cfg, "FORBID_ATTR", clone({}), {
551
+ transform: transformCaseFunc
552
+ });
450
553
  USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
451
554
  ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
452
555
  ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
@@ -465,8 +568,8 @@ function createDOMPurify() {
465
568
  IN_PLACE = cfg.IN_PLACE || false;
466
569
  IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
467
570
  NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
468
- 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({}, ["mi", "mo", "mn", "ms", "mtext"]);
469
- HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "HTML_INTEGRATION_POINTS") && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === "object" ? clone(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, ["annotation-xml"]);
571
+ 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);
572
+ 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);
470
573
  const customElementHandling = objectHasOwnProperty(cfg, "CUSTOM_ELEMENT_HANDLING") && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === "object" ? clone(cfg.CUSTOM_ELEMENT_HANDLING) : create(null);
471
574
  CUSTOM_ELEMENT_HANDLING = create(null);
472
575
  if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) {
@@ -478,6 +581,7 @@ function createDOMPurify() {
478
581
  if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") {
479
582
  CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
480
583
  }
584
+ seal(CUSTOM_ELEMENT_HANDLING);
481
585
  if (SAFE_FOR_TEMPLATES) {
482
586
  ALLOW_DATA_ATTR = false;
483
587
  }
@@ -561,14 +665,23 @@ function createDOMPurify() {
561
665
  if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
562
666
  throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
563
667
  }
668
+ const previousTrustedTypesPolicy = trustedTypesPolicy;
564
669
  trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
565
- emptyHTML = trustedTypesPolicy.createHTML("");
670
+ try {
671
+ emptyHTML = _createTrustedHTML("");
672
+ } catch (error) {
673
+ trustedTypesPolicy = previousTrustedTypesPolicy;
674
+ throw error;
675
+ }
676
+ } else if (cfg.TRUSTED_TYPES_POLICY === null) {
677
+ trustedTypesPolicy = void 0;
678
+ emptyHTML = "";
566
679
  } else {
567
680
  if (trustedTypesPolicy === void 0) {
568
- trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
681
+ trustedTypesPolicy = _getDefaultTrustedTypesPolicy();
569
682
  }
570
- if (trustedTypesPolicy !== null && typeof emptyHTML === "string") {
571
- emptyHTML = trustedTypesPolicy.createHTML("");
683
+ if (trustedTypesPolicy && typeof emptyHTML === "string") {
684
+ emptyHTML = _createTrustedHTML("");
572
685
  }
573
686
  }
574
687
  if (freeze) {
@@ -578,6 +691,33 @@ function createDOMPurify() {
578
691
  };
579
692
  const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
580
693
  const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
694
+ const _checkSvgNamespace = function _checkSvgNamespace2(tagName, parent, parentTagName) {
695
+ if (parent.namespaceURI === HTML_NAMESPACE) {
696
+ return tagName === "svg";
697
+ }
698
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
699
+ return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
700
+ }
701
+ return Boolean(ALL_SVG_TAGS[tagName]);
702
+ };
703
+ const _checkMathMlNamespace = function _checkMathMlNamespace2(tagName, parent, parentTagName) {
704
+ if (parent.namespaceURI === HTML_NAMESPACE) {
705
+ return tagName === "math";
706
+ }
707
+ if (parent.namespaceURI === SVG_NAMESPACE) {
708
+ return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
709
+ }
710
+ return Boolean(ALL_MATHML_TAGS[tagName]);
711
+ };
712
+ const _checkHtmlNamespace = function _checkHtmlNamespace2(tagName, parent, parentTagName) {
713
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
714
+ return false;
715
+ }
716
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
717
+ return false;
718
+ }
719
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
720
+ };
581
721
  const _checkValidNamespace = function _checkValidNamespace2(element) {
582
722
  let parent = getParentNode(element);
583
723
  if (!parent || !parent.tagName) {
@@ -592,31 +732,13 @@ function createDOMPurify() {
592
732
  return false;
593
733
  }
594
734
  if (element.namespaceURI === SVG_NAMESPACE) {
595
- if (parent.namespaceURI === HTML_NAMESPACE) {
596
- return tagName === "svg";
597
- }
598
- if (parent.namespaceURI === MATHML_NAMESPACE) {
599
- return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
600
- }
601
- return Boolean(ALL_SVG_TAGS[tagName]);
735
+ return _checkSvgNamespace(tagName, parent, parentTagName);
602
736
  }
603
737
  if (element.namespaceURI === MATHML_NAMESPACE) {
604
- if (parent.namespaceURI === HTML_NAMESPACE) {
605
- return tagName === "math";
606
- }
607
- if (parent.namespaceURI === SVG_NAMESPACE) {
608
- return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
609
- }
610
- return Boolean(ALL_MATHML_TAGS[tagName]);
738
+ return _checkMathMlNamespace(tagName, parent, parentTagName);
611
739
  }
612
740
  if (element.namespaceURI === HTML_NAMESPACE) {
613
- if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
614
- return false;
615
- }
616
- if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
617
- return false;
618
- }
619
- return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
741
+ return _checkHtmlNamespace(tagName, parent, parentTagName);
620
742
  }
621
743
  if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
622
744
  return true;
@@ -631,6 +753,38 @@ function createDOMPurify() {
631
753
  getParentNode(node).removeChild(node);
632
754
  } catch (_) {
633
755
  remove(node);
756
+ if (!getParentNode(node)) {
757
+ throw typeErrorCreate("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
758
+ }
759
+ }
760
+ };
761
+ const _neutralizeRoot = function _neutralizeRoot2(root) {
762
+ _neutralizeSubtree(root);
763
+ const childNodes = getChildNodes(root);
764
+ if (childNodes) {
765
+ const snapshot = [];
766
+ arrayForEach(childNodes, (child) => {
767
+ arrayPush(snapshot, child);
768
+ });
769
+ arrayForEach(snapshot, (child) => {
770
+ try {
771
+ remove(child);
772
+ } catch (_) {
773
+ }
774
+ });
775
+ }
776
+ const attributes = getAttributes(root);
777
+ if (attributes) {
778
+ for (let i = attributes.length - 1; i >= 0; --i) {
779
+ const attribute = attributes[i];
780
+ const name = attribute && attribute.name;
781
+ if (typeof name === "string") {
782
+ try {
783
+ root.removeAttribute(name);
784
+ } catch (_) {
785
+ }
786
+ }
787
+ }
634
788
  }
635
789
  };
636
790
  const _removeAttribute = function _removeAttribute2(name, element) {
@@ -660,6 +814,75 @@ function createDOMPurify() {
660
814
  }
661
815
  }
662
816
  };
817
+ const _stripDisallowedAttributes = function _stripDisallowedAttributes2(element) {
818
+ const attributes = getAttributes(element);
819
+ if (!attributes) {
820
+ return;
821
+ }
822
+ for (let i = attributes.length - 1; i >= 0; --i) {
823
+ const attribute = attributes[i];
824
+ const name = attribute && attribute.name;
825
+ if (typeof name !== "string" || ALLOWED_ATTR[transformCaseFunc(name)]) {
826
+ continue;
827
+ }
828
+ try {
829
+ element.removeAttribute(name);
830
+ } catch (_) {
831
+ }
832
+ }
833
+ };
834
+ const _neutralizeSubtree = function _neutralizeSubtree2(root) {
835
+ const stack = [root];
836
+ while (stack.length > 0) {
837
+ const node = stack.pop();
838
+ const nodeType = getNodeType ? getNodeType(node) : node.nodeType;
839
+ if (nodeType === NODE_TYPE.element) {
840
+ _stripDisallowedAttributes(node);
841
+ }
842
+ const childNodes = getChildNodes(node);
843
+ if (childNodes) {
844
+ for (let i = childNodes.length - 1; i >= 0; --i) {
845
+ stack.push(childNodes[i]);
846
+ }
847
+ }
848
+ }
849
+ };
850
+ const _neutralizePatchLinkage = function _neutralizePatchLinkage2(root) {
851
+ if (!SAFE_FOR_XML) {
852
+ return;
853
+ }
854
+ const stack = [root];
855
+ while (stack.length > 0) {
856
+ const node = stack.pop();
857
+ const nodeType = getNodeType ? getNodeType(node) : node.nodeType;
858
+ if (nodeType === NODE_TYPE.processingInstruction || nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, node.data)) {
859
+ try {
860
+ remove(node);
861
+ } catch (_) {
862
+ }
863
+ continue;
864
+ }
865
+ if (nodeType === NODE_TYPE.element) {
866
+ const element = node;
867
+ const lcTag = transformCaseFunc(getNodeName ? getNodeName(node) : node.nodeName);
868
+ try {
869
+ if (element.hasAttribute && element.hasAttribute("patchsrc")) {
870
+ element.removeAttribute("patchsrc");
871
+ }
872
+ if (element.hasAttribute && element.hasAttribute("for") && lcTag !== "label" && lcTag !== "output") {
873
+ element.removeAttribute("for");
874
+ }
875
+ } catch (_) {
876
+ }
877
+ }
878
+ const childNodes = getChildNodes(node);
879
+ if (childNodes) {
880
+ for (let i = childNodes.length - 1; i >= 0; --i) {
881
+ stack.push(childNodes[i]);
882
+ }
883
+ }
884
+ }
885
+ };
663
886
  const _initDocument = function _initDocument2(dirty) {
664
887
  let doc = null;
665
888
  let leadingWhitespace = null;
@@ -672,7 +895,7 @@ function createDOMPurify() {
672
895
  if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
673
896
  dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
674
897
  }
675
- const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
898
+ const dirtyPayload = trustedTypesPolicy ? _createTrustedHTML(dirty) : dirty;
676
899
  if (NAMESPACE === HTML_NAMESPACE) {
677
900
  try {
678
901
  doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
@@ -696,89 +919,197 @@ function createDOMPurify() {
696
919
  return WHOLE_DOCUMENT ? doc.documentElement : body;
697
920
  };
698
921
  const _createNodeIterator = function _createNodeIterator2(root) {
922
+ const doc = getOwnerDocument ? getOwnerDocument(root) : root.ownerDocument;
699
923
  return createNodeIterator.call(
700
- root.ownerDocument || root,
924
+ doc || root,
701
925
  root,
702
926
  // eslint-disable-next-line no-bitwise
703
927
  NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
704
928
  null
705
929
  );
706
930
  };
931
+ const _stripTemplateExpressions = function _stripTemplateExpressions2(value) {
932
+ value = stringReplace(value, MUSTACHE_EXPR$1, " ");
933
+ value = stringReplace(value, ERB_EXPR$1, " ");
934
+ value = stringReplace(value, TMPLIT_EXPR$1, " ");
935
+ return value;
936
+ };
937
+ const _scrubTemplateExpressions2 = function _scrubTemplateExpressions(node) {
938
+ var _node$querySelectorAl;
939
+ node.normalize();
940
+ const doc = getOwnerDocument ? getOwnerDocument(node) : node.ownerDocument;
941
+ const walker = createNodeIterator.call(
942
+ doc || node,
943
+ node,
944
+ // eslint-disable-next-line no-bitwise
945
+ NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION,
946
+ null
947
+ );
948
+ let currentNode = walker.nextNode();
949
+ while (currentNode) {
950
+ currentNode.data = _stripTemplateExpressions(currentNode.data);
951
+ currentNode = walker.nextNode();
952
+ }
953
+ const templates = (_node$querySelectorAl = node.querySelectorAll) === null || _node$querySelectorAl === void 0 ? void 0 : _node$querySelectorAl.call(node, "template");
954
+ if (templates) {
955
+ arrayForEach(templates, (tmpl) => {
956
+ if (_isDocumentFragment(tmpl.content)) {
957
+ _scrubTemplateExpressions2(tmpl.content);
958
+ }
959
+ });
960
+ }
961
+ };
707
962
  const _isClobbered = function _isClobbered2(element) {
708
- return element instanceof HTMLFormElement && (typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function");
963
+ const realTagName = getNodeName ? getNodeName(element) : null;
964
+ if (typeof realTagName !== "string") {
965
+ return false;
966
+ }
967
+ if (transformCaseFunc(realTagName) !== "form") {
968
+ return false;
969
+ }
970
+ return typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || // Realm-safe NamedNodeMap detection: equality against the cached
971
+ // prototype getter. Clobbered .attributes (e.g. <input name="attributes">)
972
+ // makes the direct read diverge from the cached read; a clean form
973
+ // (same-realm OR foreign-realm) has both reads pointing at the same
974
+ // canonical NamedNodeMap.
975
+ element.attributes !== getAttributes(element) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function" || // NodeType clobbering probe. Cached Node.prototype.nodeType getter
976
+ // returns the integer 1 for any Element regardless of realm; direct
977
+ // read on a clobbered form (e.g. <input name="nodeType">) returns
978
+ // the named child element. Cheap addition — nodeType is read from
979
+ // an internal slot, no serialization cost — and removes a residual
980
+ // clobbering surface used by several mXSS / PI / comment branches
981
+ // in _sanitizeElements that compare currentNode.nodeType directly.
982
+ element.nodeType !== getNodeType(element) || // HTMLFormElement has [LegacyOverrideBuiltIns]: a descendant named
983
+ // "childNodes" shadows the prototype getter. Direct reads of
984
+ // form.childNodes from a clobbered form return the named child
985
+ // instead of the real NodeList, so any walk that reads it directly
986
+ // skips the form's real children. Compare the direct read to the
987
+ // cached Node.prototype getter — when the form's named-property
988
+ // getter intercepts the read, the two values differ and we flag
989
+ // the form. This catches every clobbering child type (input,
990
+ // select, etc.) regardless of whether the named child happens to
991
+ // carry a numeric .length, which a typeof-based probe would miss
992
+ // (e.g. HTMLSelectElement.length is a defined unsigned-long).
993
+ element.childNodes !== getChildNodes(element);
994
+ };
995
+ const _isDocumentFragment = function _isDocumentFragment2(value) {
996
+ if (!getNodeType || typeof value !== "object" || value === null) {
997
+ return false;
998
+ }
999
+ try {
1000
+ return getNodeType(value) === NODE_TYPE.documentFragment;
1001
+ } catch (_) {
1002
+ return false;
1003
+ }
709
1004
  };
710
1005
  const _isNode = function _isNode2(value) {
711
- return typeof Node === "function" && value instanceof Node;
1006
+ if (!getNodeType || typeof value !== "object" || value === null) {
1007
+ return false;
1008
+ }
1009
+ try {
1010
+ return typeof getNodeType(value) === "number";
1011
+ } catch (_) {
1012
+ return false;
1013
+ }
712
1014
  };
713
1015
  function _executeHooks(hooks2, currentNode, data) {
1016
+ if (hooks2.length === 0) {
1017
+ return;
1018
+ }
714
1019
  arrayForEach(hooks2, (hook) => {
715
1020
  hook.call(DOMPurify, currentNode, data, CONFIG);
716
1021
  });
717
1022
  }
718
- const _sanitizeElements = function _sanitizeElements2(currentNode) {
719
- let content = null;
1023
+ const _isUnsafeNode = function _isUnsafeNode2(currentNode, tagName) {
1024
+ if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) {
1025
+ return true;
1026
+ }
1027
+ if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) {
1028
+ return true;
1029
+ }
1030
+ if (currentNode.nodeType === NODE_TYPE.processingInstruction) {
1031
+ return true;
1032
+ }
1033
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data)) {
1034
+ return true;
1035
+ }
1036
+ return false;
1037
+ };
1038
+ const _sanitizeDisallowedNode = function _sanitizeDisallowedNode2(currentNode, tagName, root) {
1039
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
1040
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
1041
+ return false;
1042
+ }
1043
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
1044
+ return false;
1045
+ }
1046
+ }
1047
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
1048
+ const parentNode = getParentNode(currentNode);
1049
+ const childNodes = getChildNodes(currentNode);
1050
+ if (childNodes && parentNode) {
1051
+ const childCount = childNodes.length;
1052
+ for (let i = childCount - 1; i >= 0; --i) {
1053
+ const hoisted = currentNode === root ? cloneNode(childNodes[i], true) : childNodes[i];
1054
+ parentNode.insertBefore(hoisted, getNextSibling(currentNode));
1055
+ }
1056
+ }
1057
+ }
1058
+ _forceRemove(currentNode);
1059
+ return true;
1060
+ };
1061
+ const _forkSharedAllowlist = function _forkSharedAllowlist2(hookList, set, defaultSet, setConfigSet) {
1062
+ if (hookList.length === 0) {
1063
+ return set;
1064
+ }
1065
+ return set === defaultSet || set === setConfigSet ? clone(set) : set;
1066
+ };
1067
+ const _sanitizeElements = function _sanitizeElements2(currentNode, root) {
720
1068
  _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
1069
+ if (currentNode !== root && getParentNode(currentNode) === null) {
1070
+ if (IN_PLACE) {
1071
+ _neutralizeSubtree(currentNode);
1072
+ }
1073
+ return true;
1074
+ }
721
1075
  if (_isClobbered(currentNode)) {
722
1076
  _forceRemove(currentNode);
723
1077
  return true;
724
1078
  }
725
- const tagName = transformCaseFunc(currentNode.nodeName);
1079
+ const tagName = transformCaseFunc(getNodeName ? getNodeName(currentNode) : currentNode.nodeName);
1080
+ ALLOWED_TAGS = _forkSharedAllowlist(hooks.uponSanitizeElement, ALLOWED_TAGS, DEFAULT_ALLOWED_TAGS, SET_CONFIG_ALLOWED_TAGS);
726
1081
  _executeHooks(hooks.uponSanitizeElement, currentNode, {
727
1082
  tagName,
728
1083
  allowedTags: ALLOWED_TAGS
729
1084
  });
730
- if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
731
- _forceRemove(currentNode);
732
- return true;
733
- }
734
- if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) {
735
- _forceRemove(currentNode);
736
- return true;
737
- }
738
- if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
739
- _forceRemove(currentNode);
1085
+ if (currentNode !== root && getParentNode(currentNode) === null) {
1086
+ if (IN_PLACE) {
1087
+ _neutralizeSubtree(currentNode);
1088
+ }
740
1089
  return true;
741
1090
  }
742
- if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
1091
+ if (_isUnsafeNode(currentNode, tagName)) {
743
1092
  _forceRemove(currentNode);
744
1093
  return true;
745
1094
  }
746
1095
  if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
747
- if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
748
- if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
749
- return false;
750
- }
751
- if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
752
- return false;
753
- }
1096
+ const removed = _sanitizeDisallowedNode(currentNode, tagName, root);
1097
+ if (removed === false) {
1098
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
754
1099
  }
755
- if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
756
- const parentNode = getParentNode(currentNode) || currentNode.parentNode;
757
- const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
758
- if (childNodes && parentNode) {
759
- const childCount = childNodes.length;
760
- for (let i = childCount - 1; i >= 0; --i) {
761
- const childClone = cloneNode(childNodes[i], true);
762
- parentNode.insertBefore(childClone, getNextSibling(currentNode));
763
- }
764
- }
765
- }
766
- _forceRemove(currentNode);
767
- return true;
1100
+ return removed;
768
1101
  }
769
- if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
1102
+ const nt = getNodeType ? getNodeType(currentNode) : currentNode.nodeType;
1103
+ if (nt === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
770
1104
  _forceRemove(currentNode);
771
1105
  return true;
772
1106
  }
773
- if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
1107
+ if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(FALLBACK_TAG_CLOSE, currentNode.innerHTML)) {
774
1108
  _forceRemove(currentNode);
775
1109
  return true;
776
1110
  }
777
1111
  if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
778
- content = currentNode.textContent;
779
- arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
780
- content = stringReplace(content, expr, " ");
781
- });
1112
+ const content = _stripTemplateExpressions(currentNode.textContent);
782
1113
  if (currentNode.textContent !== content) {
783
1114
  arrayPush(DOMPurify.removed, {
784
1115
  element: currentNode.cloneNode()
@@ -793,13 +1124,19 @@ function createDOMPurify() {
793
1124
  if (FORBID_ATTR[lcName]) {
794
1125
  return false;
795
1126
  }
1127
+ if (SAFE_FOR_XML && lcName === "patchsrc") {
1128
+ return false;
1129
+ }
1130
+ if (SAFE_FOR_XML && lcName === "for" && lcTag !== "label" && lcTag !== "output") {
1131
+ return false;
1132
+ }
796
1133
  if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) {
797
1134
  return false;
798
1135
  }
799
- if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) ;
800
- else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName)) ;
801
- else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ;
802
- else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
1136
+ const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
1137
+ if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName)) ;
1138
+ else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) ;
1139
+ else if (!nameIsPermitted) {
803
1140
  if (
804
1141
  // First condition does a very basic check if a) it's basically a valid custom element tagname AND
805
1142
  // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
@@ -812,9 +1149,9 @@ function createDOMPurify() {
812
1149
  return false;
813
1150
  }
814
1151
  } else if (URI_SAFE_ATTRIBUTES[lcName]) ;
815
- else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE2, ""))) ;
1152
+ else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) ;
816
1153
  else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) ;
817
- else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA2, stringReplace(value, ATTR_WHITESPACE2, ""))) ;
1154
+ else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) ;
818
1155
  else if (value) {
819
1156
  return false;
820
1157
  } else ;
@@ -822,16 +1159,44 @@ function createDOMPurify() {
822
1159
  };
823
1160
  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"]);
824
1161
  const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
825
- return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT2, tagName);
1162
+ return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
1163
+ };
1164
+ const _applyTrustedTypesToAttribute = function _applyTrustedTypesToAttribute2(lcTag, lcName, namespaceURI, value) {
1165
+ if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function" && !namespaceURI) {
1166
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
1167
+ case "TrustedHTML": {
1168
+ return _createTrustedHTML(value);
1169
+ }
1170
+ case "TrustedScriptURL": {
1171
+ return _createTrustedScriptURL(value);
1172
+ }
1173
+ }
1174
+ }
1175
+ return value;
1176
+ };
1177
+ const _setAttributeValue = function _setAttributeValue2(currentNode, name, namespaceURI, value) {
1178
+ try {
1179
+ if (namespaceURI) {
1180
+ currentNode.setAttributeNS(namespaceURI, name, value);
1181
+ } else {
1182
+ currentNode.setAttribute(name, value);
1183
+ }
1184
+ if (_isClobbered(currentNode)) {
1185
+ _forceRemove(currentNode);
1186
+ } else {
1187
+ arrayPop(DOMPurify.removed);
1188
+ }
1189
+ } catch (_) {
1190
+ _removeAttribute(name, currentNode);
1191
+ }
826
1192
  };
827
1193
  const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
828
1194
  _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
829
- const {
830
- attributes
831
- } = currentNode;
1195
+ const attributes = currentNode.attributes;
832
1196
  if (!attributes || _isClobbered(currentNode)) {
833
1197
  return;
834
1198
  }
1199
+ ALLOWED_ATTR = _forkSharedAllowlist(hooks.uponSanitizeAttribute, ALLOWED_ATTR, DEFAULT_ALLOWED_ATTR, SET_CONFIG_ALLOWED_ATTR);
835
1200
  const hookEvent = {
836
1201
  attrName: "",
837
1202
  attrValue: "",
@@ -840,13 +1205,10 @@ function createDOMPurify() {
840
1205
  forceKeepAttr: void 0
841
1206
  };
842
1207
  let l = attributes.length;
1208
+ const lcTag = transformCaseFunc(currentNode.nodeName);
843
1209
  while (l--) {
844
1210
  const attr = attributes[l];
845
- const {
846
- name,
847
- namespaceURI,
848
- value: attrValue
849
- } = attr;
1211
+ const name = attr.name, namespaceURI = attr.namespaceURI, attrValue = attr.value;
850
1212
  const lcName = transformCaseFunc(name);
851
1213
  const initValue = attrValue;
852
1214
  let value = name === "value" ? initValue : stringTrim(initValue);
@@ -875,50 +1237,20 @@ function createDOMPurify() {
875
1237
  _removeAttribute(name, currentNode);
876
1238
  continue;
877
1239
  }
878
- if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
1240
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(SELF_CLOSING_TAG, value)) {
879
1241
  _removeAttribute(name, currentNode);
880
1242
  continue;
881
1243
  }
882
1244
  if (SAFE_FOR_TEMPLATES) {
883
- arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
884
- value = stringReplace(value, expr, " ");
885
- });
1245
+ value = _stripTemplateExpressions(value);
886
1246
  }
887
- const lcTag = transformCaseFunc(currentNode.nodeName);
888
1247
  if (!_isValidAttribute(lcTag, lcName, value)) {
889
1248
  _removeAttribute(name, currentNode);
890
1249
  continue;
891
1250
  }
892
- if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
893
- if (namespaceURI) ;
894
- else {
895
- switch (trustedTypes.getAttributeType(lcTag, lcName)) {
896
- case "TrustedHTML": {
897
- value = trustedTypesPolicy.createHTML(value);
898
- break;
899
- }
900
- case "TrustedScriptURL": {
901
- value = trustedTypesPolicy.createScriptURL(value);
902
- break;
903
- }
904
- }
905
- }
906
- }
1251
+ value = _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value);
907
1252
  if (value !== initValue) {
908
- try {
909
- if (namespaceURI) {
910
- currentNode.setAttributeNS(namespaceURI, name, value);
911
- } else {
912
- currentNode.setAttribute(name, value);
913
- }
914
- if (_isClobbered(currentNode)) {
915
- _forceRemove(currentNode);
916
- } else {
917
- arrayPop(DOMPurify.removed);
918
- }
919
- } catch (_) {
920
- _removeAttribute(name, currentNode);
921
- }
1253
+ _setAttributeValue(currentNode, name, namespaceURI, value);
922
1254
  }
923
1255
  }
924
1256
  _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
@@ -929,14 +1261,71 @@ function createDOMPurify() {
929
1261
  _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
930
1262
  while (shadowNode = shadowIterator.nextNode()) {
931
1263
  _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
932
- _sanitizeElements(shadowNode);
1264
+ _sanitizeElements(shadowNode, fragment);
933
1265
  _sanitizeAttributes(shadowNode);
934
- if (shadowNode.content instanceof DocumentFragment) {
1266
+ if (_isDocumentFragment(shadowNode.content)) {
935
1267
  _sanitizeShadowDOM2(shadowNode.content);
936
1268
  }
1269
+ const shadowNodeType = getNodeType ? getNodeType(shadowNode) : shadowNode.nodeType;
1270
+ if (shadowNodeType === NODE_TYPE.element) {
1271
+ const innerSr = getShadowRoot(shadowNode);
1272
+ if (_isDocumentFragment(innerSr)) {
1273
+ _sanitizeAttachedShadowRoots(innerSr);
1274
+ _sanitizeShadowDOM2(innerSr);
1275
+ }
1276
+ }
937
1277
  }
938
1278
  _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
939
1279
  };
1280
+ const _sanitizeAttachedShadowRoots = function _sanitizeAttachedShadowRoots2(root) {
1281
+ const stack = [{
1282
+ node: root,
1283
+ shadow: null
1284
+ }];
1285
+ while (stack.length > 0) {
1286
+ const item = stack.pop();
1287
+ if (item.shadow) {
1288
+ _sanitizeShadowDOM2(item.shadow);
1289
+ continue;
1290
+ }
1291
+ const node = item.node;
1292
+ const nodeType = getNodeType ? getNodeType(node) : node.nodeType;
1293
+ const isElement = nodeType === NODE_TYPE.element;
1294
+ const childNodes = getChildNodes(node);
1295
+ if (childNodes) {
1296
+ for (let i = childNodes.length - 1; i >= 0; --i) {
1297
+ stack.push({
1298
+ node: childNodes[i],
1299
+ shadow: null
1300
+ });
1301
+ }
1302
+ }
1303
+ if (isElement) {
1304
+ const rootName = getNodeName ? getNodeName(node) : null;
1305
+ if (typeof rootName === "string" && transformCaseFunc(rootName) === "template") {
1306
+ const content = node.content;
1307
+ if (_isDocumentFragment(content)) {
1308
+ stack.push({
1309
+ node: content,
1310
+ shadow: null
1311
+ });
1312
+ }
1313
+ }
1314
+ }
1315
+ if (isElement) {
1316
+ const sr = getShadowRoot(node);
1317
+ if (_isDocumentFragment(sr)) {
1318
+ stack.push({
1319
+ node: null,
1320
+ shadow: sr
1321
+ }, {
1322
+ node: sr,
1323
+ shadow: null
1324
+ });
1325
+ }
1326
+ }
1327
+ }
1328
+ };
940
1329
  DOMPurify.sanitize = function(dirty) {
941
1330
  let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
942
1331
  let body = null;
@@ -956,22 +1345,41 @@ function createDOMPurify() {
956
1345
  if (!DOMPurify.isSupported) {
957
1346
  return dirty;
958
1347
  }
959
- if (!SET_CONFIG) {
1348
+ if (SET_CONFIG) {
1349
+ ALLOWED_TAGS = SET_CONFIG_ALLOWED_TAGS;
1350
+ ALLOWED_ATTR = SET_CONFIG_ALLOWED_ATTR;
1351
+ } else {
960
1352
  _parseConfig(cfg);
961
1353
  }
962
- DOMPurify.removed = [];
963
- if (typeof dirty === "string") {
964
- IN_PLACE = false;
1354
+ if (hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) {
1355
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
965
1356
  }
966
- if (IN_PLACE) {
967
- const nn = dirty.nodeName;
1357
+ if (hooks.uponSanitizeAttribute.length > 0) {
1358
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
1359
+ }
1360
+ DOMPurify.removed = [];
1361
+ const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
1362
+ if (inPlace) {
1363
+ _neutralizePatchLinkage(dirty);
1364
+ const nn = getNodeName ? getNodeName(dirty) : dirty.nodeName;
968
1365
  if (typeof nn === "string") {
969
1366
  const tagName = transformCaseFunc(nn);
970
1367
  if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1368
+ _neutralizeRoot(dirty);
971
1369
  throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
972
1370
  }
973
1371
  }
974
- } else if (dirty instanceof Node) {
1372
+ if (_isClobbered(dirty)) {
1373
+ _neutralizeRoot(dirty);
1374
+ throw typeErrorCreate("root node is clobbered and cannot be sanitized in-place");
1375
+ }
1376
+ try {
1377
+ _sanitizeAttachedShadowRoots(dirty);
1378
+ } catch (error) {
1379
+ _neutralizeRoot(dirty);
1380
+ throw error;
1381
+ }
1382
+ } else if (_isNode(dirty)) {
975
1383
  body = _initDocument("<!---->");
976
1384
  importedNode = body.ownerDocument.importNode(dirty, true);
977
1385
  if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") {
@@ -981,10 +1389,11 @@ function createDOMPurify() {
981
1389
  } else {
982
1390
  body.appendChild(importedNode);
983
1391
  }
1392
+ _sanitizeAttachedShadowRoots(importedNode);
984
1393
  } else {
985
1394
  if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
986
1395
  dirty.indexOf("<") === -1) {
987
- return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
1396
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(dirty) : dirty;
988
1397
  }
989
1398
  body = _initDocument(dirty);
990
1399
  if (!body) {
@@ -994,25 +1403,41 @@ function createDOMPurify() {
994
1403
  if (body && FORCE_BODY) {
995
1404
  _forceRemove(body.firstChild);
996
1405
  }
997
- const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
998
- while (currentNode = nodeIterator.nextNode()) {
999
- _sanitizeElements(currentNode);
1000
- _sanitizeAttributes(currentNode);
1001
- if (currentNode.content instanceof DocumentFragment) {
1002
- _sanitizeShadowDOM2(currentNode.content);
1406
+ const walkRoot = inPlace ? dirty : body;
1407
+ try {
1408
+ const nodeIterator = _createNodeIterator(walkRoot);
1409
+ while (currentNode = nodeIterator.nextNode()) {
1410
+ _sanitizeElements(currentNode, walkRoot);
1411
+ _sanitizeAttributes(currentNode);
1412
+ if (_isDocumentFragment(currentNode.content)) {
1413
+ _sanitizeShadowDOM2(currentNode.content);
1414
+ }
1003
1415
  }
1416
+ } catch (error) {
1417
+ if (inPlace) {
1418
+ _neutralizeRoot(dirty);
1419
+ arrayForEach(DOMPurify.removed, (entry) => {
1420
+ if (entry.element) {
1421
+ _neutralizeSubtree(entry.element);
1422
+ }
1423
+ });
1424
+ }
1425
+ throw error;
1004
1426
  }
1005
- if (IN_PLACE) {
1427
+ if (inPlace) {
1428
+ arrayForEach(DOMPurify.removed, (entry) => {
1429
+ if (entry.element) {
1430
+ _neutralizeSubtree(entry.element);
1431
+ }
1432
+ });
1433
+ if (SAFE_FOR_TEMPLATES) {
1434
+ _scrubTemplateExpressions2(dirty);
1435
+ }
1006
1436
  return dirty;
1007
1437
  }
1008
1438
  if (RETURN_DOM) {
1009
1439
  if (SAFE_FOR_TEMPLATES) {
1010
- body.normalize();
1011
- let html2 = body.innerHTML;
1012
- arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
1013
- html2 = stringReplace(html2, expr, " ");
1014
- });
1015
- body.innerHTML = html2;
1440
+ _scrubTemplateExpressions2(body);
1016
1441
  }
1017
1442
  if (RETURN_DOM_FRAGMENT) {
1018
1443
  returnNode = createDocumentFragment.call(body.ownerDocument);
@@ -1032,20 +1457,24 @@ function createDOMPurify() {
1032
1457
  serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
1033
1458
  }
1034
1459
  if (SAFE_FOR_TEMPLATES) {
1035
- arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
1036
- serializedHTML = stringReplace(serializedHTML, expr, " ");
1037
- });
1460
+ serializedHTML = _stripTemplateExpressions(serializedHTML);
1038
1461
  }
1039
- return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
1462
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(serializedHTML) : serializedHTML;
1040
1463
  };
1041
1464
  DOMPurify.setConfig = function() {
1042
1465
  let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1043
1466
  _parseConfig(cfg);
1044
1467
  SET_CONFIG = true;
1468
+ SET_CONFIG_ALLOWED_TAGS = ALLOWED_TAGS;
1469
+ SET_CONFIG_ALLOWED_ATTR = ALLOWED_ATTR;
1045
1470
  };
1046
1471
  DOMPurify.clearConfig = function() {
1047
1472
  CONFIG = null;
1048
1473
  SET_CONFIG = false;
1474
+ SET_CONFIG_ALLOWED_TAGS = null;
1475
+ SET_CONFIG_ALLOWED_ATTR = null;
1476
+ trustedTypesPolicy = defaultTrustedTypesPolicy;
1477
+ emptyHTML = "";
1049
1478
  };
1050
1479
  DOMPurify.isValidAttribute = function(tag, attr, value) {
1051
1480
  if (!CONFIG) {
@@ -1059,9 +1488,15 @@ function createDOMPurify() {
1059
1488
  if (typeof hookFunction !== "function") {
1060
1489
  return;
1061
1490
  }
1491
+ if (!objectHasOwnProperty(hooks, entryPoint)) {
1492
+ return;
1493
+ }
1062
1494
  arrayPush(hooks[entryPoint], hookFunction);
1063
1495
  };
1064
1496
  DOMPurify.removeHook = function(entryPoint, hookFunction) {
1497
+ if (!objectHasOwnProperty(hooks, entryPoint)) {
1498
+ return void 0;
1499
+ }
1065
1500
  if (hookFunction !== void 0) {
1066
1501
  const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
1067
1502
  return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0];
@@ -1069,6 +1504,9 @@ function createDOMPurify() {
1069
1504
  return arrayPop(hooks[entryPoint]);
1070
1505
  };
1071
1506
  DOMPurify.removeHooks = function(entryPoint) {
1507
+ if (!objectHasOwnProperty(hooks, entryPoint)) {
1508
+ return;
1509
+ }
1072
1510
  hooks[entryPoint] = [];
1073
1511
  };
1074
1512
  DOMPurify.removeAllHooks = function() {