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