@3t-transform/threeteeui 0.1.37 → 0.1.41

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 (125) hide show
  1. package/dist/cjs/domsanitiser.options-277161b9.js +1667 -0
  2. package/dist/cjs/{index-457ca775.js → index-76f14107.js} +2 -88
  3. package/dist/cjs/loader.cjs.js +2 -3
  4. package/dist/cjs/tttx-button.cjs.entry.js +25 -25
  5. package/dist/cjs/tttx-filter.cjs.entry.js +159 -159
  6. package/dist/cjs/tttx-form.cjs.entry.js +457 -373
  7. package/dist/cjs/tttx-icon.cjs.entry.js +11 -11
  8. package/dist/cjs/tttx-keyvalue-block.cjs.entry.js +59 -59
  9. package/dist/cjs/tttx-list.cjs.entry.js +32 -1694
  10. package/dist/cjs/tttx-loading-spinner.cjs.entry.js +16 -16
  11. package/dist/cjs/tttx-sorter.cjs.entry.js +102 -102
  12. package/dist/cjs/tttx-standalone-input.cjs.entry.js +79 -79
  13. package/dist/cjs/tttx-toolbar.cjs.entry.js +10 -10
  14. package/dist/cjs/tttx.cjs.js +2 -6
  15. package/dist/collection/collection-manifest.json +2 -2
  16. package/dist/collection/components/atoms/tttx-button/tttx-button.css +4 -4
  17. package/dist/collection/components/atoms/tttx-button/tttx-button.js +110 -110
  18. package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +14 -14
  19. package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +62 -62
  20. package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +22 -22
  21. package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js +109 -109
  22. package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.js +38 -38
  23. package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.js +67 -67
  24. package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +17 -17
  25. package/dist/collection/components/molecules/tttx-filter/tttx-filter.js +334 -334
  26. package/dist/collection/components/molecules/tttx-filter/tttx-filter.stories.js +62 -62
  27. package/dist/collection/components/molecules/tttx-form/lib/setErrorState.js +37 -37
  28. package/dist/collection/components/molecules/tttx-form/lib/validityCheck.js +61 -58
  29. package/dist/collection/components/molecules/tttx-form/tttx-form.css +98 -2
  30. package/dist/collection/components/molecules/tttx-form/tttx-form.js +477 -393
  31. package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +274 -218
  32. package/dist/collection/components/molecules/tttx-list/tttx-list.js +105 -105
  33. package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +43 -43
  34. package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.js +224 -224
  35. package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.stories.js +42 -42
  36. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +759 -759
  37. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +172 -172
  38. package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.js +44 -44
  39. package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.stories.js +14 -14
  40. package/dist/collection/components/palette.stories.js +7 -7
  41. package/dist/collection/docs/gettingstarted-developer.stories.js +5 -5
  42. package/dist/collection/icons.js +2838 -2838
  43. package/dist/collection/index.js +1 -1
  44. package/dist/collection/shared/domsanitiser.options.js +14 -14
  45. package/dist/components/domsanitiser.options.js +1664 -0
  46. package/dist/components/index.d.ts +0 -9
  47. package/dist/components/index.js +1 -1
  48. package/dist/components/tttx-button.js +49 -49
  49. package/dist/components/tttx-filter.js +191 -191
  50. package/dist/components/tttx-form.js +475 -391
  51. package/dist/components/tttx-icon2.js +28 -28
  52. package/dist/components/tttx-keyvalue-block.js +76 -76
  53. package/dist/components/tttx-list.js +54 -1716
  54. package/dist/components/tttx-loading-spinner.js +33 -33
  55. package/dist/components/tttx-sorter.js +130 -130
  56. package/dist/components/tttx-standalone-input.js +130 -130
  57. package/dist/components/tttx-toolbar.js +26 -26
  58. package/dist/esm/domsanitiser.options-cc420431.js +1664 -0
  59. package/dist/esm/{index-d784fb3e.js → index-9cde46a5.js} +3 -88
  60. package/dist/esm/loader.js +2 -3
  61. package/dist/esm/polyfills/core-js.js +0 -0
  62. package/dist/esm/polyfills/css-shim.js +1 -1
  63. package/dist/esm/polyfills/dom.js +0 -0
  64. package/dist/esm/polyfills/es5-html-element.js +0 -0
  65. package/dist/esm/polyfills/index.js +0 -0
  66. package/dist/esm/polyfills/system.js +0 -0
  67. package/dist/esm/tttx-button.entry.js +25 -25
  68. package/dist/esm/tttx-filter.entry.js +159 -159
  69. package/dist/esm/tttx-form.entry.js +457 -373
  70. package/dist/esm/tttx-icon.entry.js +11 -11
  71. package/dist/esm/tttx-keyvalue-block.entry.js +59 -59
  72. package/dist/esm/tttx-list.entry.js +32 -1694
  73. package/dist/esm/tttx-loading-spinner.entry.js +16 -16
  74. package/dist/esm/tttx-sorter.entry.js +102 -102
  75. package/dist/esm/tttx-standalone-input.entry.js +79 -79
  76. package/dist/esm/tttx-toolbar.entry.js +10 -10
  77. package/dist/esm/tttx.js +2 -3
  78. package/dist/tttx/{p-400868f1.entry.js → p-3b1be372.entry.js} +1 -1
  79. package/dist/tttx/{p-563605b2.entry.js → p-561224f5.entry.js} +1 -1
  80. package/dist/tttx/{p-b720c4ad.entry.js → p-9f1e9cc1.entry.js} +1 -1
  81. package/dist/tttx/{p-798a098a.entry.js → p-aef96333.entry.js} +1 -1
  82. package/dist/tttx/p-b4290a5b.js +3 -0
  83. package/dist/tttx/p-bd1edaed.entry.js +1 -0
  84. package/dist/tttx/p-d0ff9ad0.entry.js +1 -0
  85. package/dist/tttx/{p-cac26a1b.entry.js → p-d2f1aa8e.entry.js} +1 -1
  86. package/dist/tttx/p-db059a69.js +2 -0
  87. package/dist/tttx/p-dc2a37b0.entry.js +1 -0
  88. package/dist/tttx/{p-ab6ce9f6.entry.js → p-e53c7f9d.entry.js} +1 -1
  89. package/dist/tttx/{p-92cade7f.entry.js → p-f885f17a.entry.js} +1 -1
  90. package/dist/tttx/tttx.esm.js +1 -1
  91. package/dist/types/components/atoms/tttx-button/tttx-button.d.ts +10 -10
  92. package/dist/types/components/atoms/tttx-button/tttx-button.stories.d.ts +10 -10
  93. package/dist/types/components/atoms/tttx-icon/tttx-icon.d.ts +5 -5
  94. package/dist/types/components/atoms/tttx-icon/tttx-icon.stories.d.ts +20 -20
  95. package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.d.ts +7 -7
  96. package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.d.ts +9 -9
  97. package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.d.ts +6 -6
  98. package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.d.ts +17 -17
  99. package/dist/types/components/molecules/tttx-filter/tttx-filter.d.ts +39 -39
  100. package/dist/types/components/molecules/tttx-filter/tttx-filter.stories.d.ts +68 -68
  101. package/dist/types/components/molecules/tttx-form/lib/setErrorState.d.ts +13 -13
  102. package/dist/types/components/molecules/tttx-form/lib/validityCheck.d.ts +17 -17
  103. package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +133 -111
  104. package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +278 -13
  105. package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +11 -11
  106. package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +14 -14
  107. package/dist/types/components/molecules/tttx-sorter/tttx-sorter.d.ts +19 -19
  108. package/dist/types/components/molecules/tttx-sorter/tttx-sorter.stories.d.ts +30 -30
  109. package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +69 -69
  110. package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.d.ts +143 -143
  111. package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.d.ts +4 -4
  112. package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.stories.d.ts +13 -13
  113. package/dist/types/components/palette.stories.d.ts +6 -6
  114. package/dist/types/components.d.ts +1 -1
  115. package/dist/types/docs/gettingstarted-developer.stories.d.ts +5 -5
  116. package/dist/types/icons.d.ts +2 -2
  117. package/dist/types/index.d.ts +1 -1
  118. package/dist/types/shared/domsanitiser.options.d.ts +10 -10
  119. package/dist/types/stencil-public-runtime.d.ts +3 -59
  120. package/loader/index.d.ts +0 -9
  121. package/package.json +1 -1
  122. package/dist/tttx/p-0ebffdfc.js +0 -2
  123. package/dist/tttx/p-72e7f7dd.entry.js +0 -3
  124. package/dist/tttx/p-c4162029.entry.js +0 -1
  125. package/dist/tttx/p-eb126fd0.entry.js +0 -1
@@ -0,0 +1,1664 @@
1
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
+
3
+ function createCommonjsModule(fn, basedir, module) {
4
+ return module = {
5
+ path: basedir,
6
+ exports: {},
7
+ require: function (path, base) {
8
+ return commonjsRequire();
9
+ }
10
+ }, fn(module, module.exports), module.exports;
11
+ }
12
+
13
+ function commonjsRequire () {
14
+ throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
15
+ }
16
+
17
+ var purify = createCommonjsModule(function (module, exports) {
18
+ /*! @license DOMPurify 3.0.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.3/LICENSE */
19
+
20
+ (function (global, factory) {
21
+ module.exports = factory() ;
22
+ })(commonjsGlobal, (function () {
23
+ const {
24
+ entries,
25
+ setPrototypeOf,
26
+ isFrozen,
27
+ getPrototypeOf,
28
+ getOwnPropertyDescriptor
29
+ } = Object;
30
+ let {
31
+ freeze,
32
+ seal,
33
+ create
34
+ } = Object; // eslint-disable-line import/no-mutable-exports
35
+
36
+ let {
37
+ apply,
38
+ construct
39
+ } = typeof Reflect !== 'undefined' && Reflect;
40
+
41
+ if (!apply) {
42
+ apply = function apply(fun, thisValue, args) {
43
+ return fun.apply(thisValue, args);
44
+ };
45
+ }
46
+
47
+ if (!freeze) {
48
+ freeze = function freeze(x) {
49
+ return x;
50
+ };
51
+ }
52
+
53
+ if (!seal) {
54
+ seal = function seal(x) {
55
+ return x;
56
+ };
57
+ }
58
+
59
+ if (!construct) {
60
+ construct = function construct(Func, args) {
61
+ return new Func(...args);
62
+ };
63
+ }
64
+
65
+ const arrayForEach = unapply(Array.prototype.forEach);
66
+ const arrayPop = unapply(Array.prototype.pop);
67
+ const arrayPush = unapply(Array.prototype.push);
68
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
69
+ const stringToString = unapply(String.prototype.toString);
70
+ const stringMatch = unapply(String.prototype.match);
71
+ const stringReplace = unapply(String.prototype.replace);
72
+ const stringIndexOf = unapply(String.prototype.indexOf);
73
+ const stringTrim = unapply(String.prototype.trim);
74
+ const regExpTest = unapply(RegExp.prototype.test);
75
+ const typeErrorCreate = unconstruct(TypeError);
76
+ function unapply(func) {
77
+ return function (thisArg) {
78
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
79
+ args[_key - 1] = arguments[_key];
80
+ }
81
+
82
+ return apply(func, thisArg, args);
83
+ };
84
+ }
85
+ function unconstruct(func) {
86
+ return function () {
87
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
88
+ args[_key2] = arguments[_key2];
89
+ }
90
+
91
+ return construct(func, args);
92
+ };
93
+ }
94
+ /* Add properties to a lookup table */
95
+
96
+ function addToSet(set, array, transformCaseFunc) {
97
+ var _transformCaseFunc;
98
+
99
+ transformCaseFunc = (_transformCaseFunc = transformCaseFunc) !== null && _transformCaseFunc !== void 0 ? _transformCaseFunc : stringToLowerCase;
100
+
101
+ if (setPrototypeOf) {
102
+ // Make 'in' and truthy checks like Boolean(set.constructor)
103
+ // independent of any properties defined on Object.prototype.
104
+ // Prevent prototype setters from intercepting set as a this value.
105
+ setPrototypeOf(set, null);
106
+ }
107
+
108
+ let l = array.length;
109
+
110
+ while (l--) {
111
+ let element = array[l];
112
+
113
+ if (typeof element === 'string') {
114
+ const lcElement = transformCaseFunc(element);
115
+
116
+ if (lcElement !== element) {
117
+ // Config presets (e.g. tags.js, attrs.js) are immutable.
118
+ if (!isFrozen(array)) {
119
+ array[l] = lcElement;
120
+ }
121
+
122
+ element = lcElement;
123
+ }
124
+ }
125
+
126
+ set[element] = true;
127
+ }
128
+
129
+ return set;
130
+ }
131
+ /* Shallow clone an object */
132
+
133
+ function clone(object) {
134
+ const newObject = create(null);
135
+
136
+ for (const [property, value] of entries(object)) {
137
+ newObject[property] = value;
138
+ }
139
+
140
+ return newObject;
141
+ }
142
+ /* This method automatically checks if the prop is function
143
+ * or getter and behaves accordingly. */
144
+
145
+ function lookupGetter(object, prop) {
146
+ while (object !== null) {
147
+ const desc = getOwnPropertyDescriptor(object, prop);
148
+
149
+ if (desc) {
150
+ if (desc.get) {
151
+ return unapply(desc.get);
152
+ }
153
+
154
+ if (typeof desc.value === 'function') {
155
+ return unapply(desc.value);
156
+ }
157
+ }
158
+
159
+ object = getPrototypeOf(object);
160
+ }
161
+
162
+ function fallbackValue(element) {
163
+ console.warn('fallback value for', element);
164
+ return null;
165
+ }
166
+
167
+ return fallbackValue;
168
+ }
169
+
170
+ const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG
171
+
172
+ const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
173
+ const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); // List of SVG elements that are disallowed by default.
174
+ // We still need to know them so that we can do namespace
175
+ // checks properly in case one wants to add them to
176
+ // allow-list.
177
+
178
+ const svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
179
+ 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']); // Similarly to SVG, we want to know all MathML elements,
180
+ // even those that we disallow by default.
181
+
182
+ const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
183
+ const text = freeze(['#text']);
184
+
185
+ 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', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', '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', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']);
186
+ const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', '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', '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', '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', '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', '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', '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']);
187
+ const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', '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']);
188
+ const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
189
+
190
+ const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
191
+
192
+ const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
193
+ const TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
194
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
195
+
196
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
197
+
198
+ const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
199
+ );
200
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
201
+ const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
202
+ );
203
+ const DOCTYPE_NAME = seal(/^html$/i);
204
+
205
+ var EXPRESSIONS = /*#__PURE__*/Object.freeze({
206
+ __proto__: null,
207
+ MUSTACHE_EXPR: MUSTACHE_EXPR,
208
+ ERB_EXPR: ERB_EXPR,
209
+ TMPLIT_EXPR: TMPLIT_EXPR,
210
+ DATA_ATTR: DATA_ATTR,
211
+ ARIA_ATTR: ARIA_ATTR,
212
+ IS_ALLOWED_URI: IS_ALLOWED_URI,
213
+ IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
214
+ ATTR_WHITESPACE: ATTR_WHITESPACE,
215
+ DOCTYPE_NAME: DOCTYPE_NAME
216
+ });
217
+
218
+ const getGlobal = () => typeof window === 'undefined' ? null : window;
219
+ /**
220
+ * Creates a no-op policy for internal use only.
221
+ * Don't export this function outside this module!
222
+ * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.
223
+ * @param {HTMLScriptElement} purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
224
+ * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types
225
+ * are not supported or creating the policy failed).
226
+ */
227
+
228
+
229
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
230
+ if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
231
+ return null;
232
+ } // Allow the callers to control the unique policy name
233
+ // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
234
+ // Policy creation with duplicate names throws in Trusted Types.
235
+
236
+
237
+ let suffix = null;
238
+ const ATTR_NAME = 'data-tt-policy-suffix';
239
+
240
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
241
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
242
+ }
243
+
244
+ const policyName = 'dompurify' + (suffix ? '#' + suffix : '');
245
+
246
+ try {
247
+ return trustedTypes.createPolicy(policyName, {
248
+ createHTML(html) {
249
+ return html;
250
+ },
251
+
252
+ createScriptURL(scriptUrl) {
253
+ return scriptUrl;
254
+ }
255
+
256
+ });
257
+ } catch (_) {
258
+ // Policy creation failed (most likely another DOMPurify script has
259
+ // already run). Skip creating the policy, as this will only cause errors
260
+ // if TT are enforced.
261
+ console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
262
+ return null;
263
+ }
264
+ };
265
+
266
+ function createDOMPurify() {
267
+ let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
268
+
269
+ const DOMPurify = root => createDOMPurify(root);
270
+ /**
271
+ * Version label, exposed for easier checks
272
+ * if DOMPurify is up to date or not
273
+ */
274
+
275
+
276
+ DOMPurify.version = '3.0.3';
277
+ /**
278
+ * Array of elements that DOMPurify removed during sanitation.
279
+ * Empty if nothing was removed.
280
+ */
281
+
282
+ DOMPurify.removed = [];
283
+
284
+ if (!window || !window.document || window.document.nodeType !== 9) {
285
+ // Not running in a browser, provide a factory function
286
+ // so that you can pass your own Window
287
+ DOMPurify.isSupported = false;
288
+ return DOMPurify;
289
+ }
290
+
291
+ const originalDocument = window.document;
292
+ const currentScript = originalDocument.currentScript;
293
+ let {
294
+ document
295
+ } = window;
296
+ const {
297
+ DocumentFragment,
298
+ HTMLTemplateElement,
299
+ Node,
300
+ Element,
301
+ NodeFilter,
302
+ NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,
303
+ HTMLFormElement,
304
+ DOMParser,
305
+ trustedTypes
306
+ } = window;
307
+ const ElementPrototype = Element.prototype;
308
+ const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
309
+ const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
310
+ const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
311
+ const getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a
312
+ // new document created via createHTMLDocument. As per the spec
313
+ // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
314
+ // a new empty registry is used when creating a template contents owner
315
+ // document, so we use that as our parent document to ensure nothing
316
+ // is inherited.
317
+
318
+ if (typeof HTMLTemplateElement === 'function') {
319
+ const template = document.createElement('template');
320
+
321
+ if (template.content && template.content.ownerDocument) {
322
+ document = template.content.ownerDocument;
323
+ }
324
+ }
325
+
326
+ let trustedTypesPolicy;
327
+ let emptyHTML = '';
328
+ const {
329
+ implementation,
330
+ createNodeIterator,
331
+ createDocumentFragment,
332
+ getElementsByTagName
333
+ } = document;
334
+ const {
335
+ importNode
336
+ } = originalDocument;
337
+ let hooks = {};
338
+ /**
339
+ * Expose whether this browser supports running the full DOMPurify.
340
+ */
341
+
342
+ DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
343
+ const {
344
+ MUSTACHE_EXPR,
345
+ ERB_EXPR,
346
+ TMPLIT_EXPR,
347
+ DATA_ATTR,
348
+ ARIA_ATTR,
349
+ IS_SCRIPT_OR_DATA,
350
+ ATTR_WHITESPACE
351
+ } = EXPRESSIONS;
352
+ let {
353
+ IS_ALLOWED_URI: IS_ALLOWED_URI$1
354
+ } = EXPRESSIONS;
355
+ /**
356
+ * We consider the elements and attributes below to be safe. Ideally
357
+ * don't add any new ones but feel free to remove unwanted ones.
358
+ */
359
+
360
+ /* allowed element names */
361
+
362
+ let ALLOWED_TAGS = null;
363
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
364
+ /* Allowed attribute names */
365
+
366
+ let ALLOWED_ATTR = null;
367
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
368
+ /*
369
+ * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
370
+ * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
371
+ * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
372
+ * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
373
+ */
374
+
375
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, {
376
+ tagNameCheck: {
377
+ writable: true,
378
+ configurable: false,
379
+ enumerable: true,
380
+ value: null
381
+ },
382
+ attributeNameCheck: {
383
+ writable: true,
384
+ configurable: false,
385
+ enumerable: true,
386
+ value: null
387
+ },
388
+ allowCustomizedBuiltInElements: {
389
+ writable: true,
390
+ configurable: false,
391
+ enumerable: true,
392
+ value: false
393
+ }
394
+ }));
395
+ /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
396
+
397
+ let FORBID_TAGS = null;
398
+ /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
399
+
400
+ let FORBID_ATTR = null;
401
+ /* Decide if ARIA attributes are okay */
402
+
403
+ let ALLOW_ARIA_ATTR = true;
404
+ /* Decide if custom data attributes are okay */
405
+
406
+ let ALLOW_DATA_ATTR = true;
407
+ /* Decide if unknown protocols are okay */
408
+
409
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
410
+ /* Decide if self-closing tags in attributes are allowed.
411
+ * Usually removed due to a mXSS issue in jQuery 3.0 */
412
+
413
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
414
+ /* Output should be safe for common template engines.
415
+ * This means, DOMPurify removes data attributes, mustaches and ERB
416
+ */
417
+
418
+ let SAFE_FOR_TEMPLATES = false;
419
+ /* Decide if document with <html>... should be returned */
420
+
421
+ let WHOLE_DOCUMENT = false;
422
+ /* Track whether config is already set on this instance of DOMPurify. */
423
+
424
+ let SET_CONFIG = false;
425
+ /* Decide if all elements (e.g. style, script) must be children of
426
+ * document.body. By default, browsers might move them to document.head */
427
+
428
+ let FORCE_BODY = false;
429
+ /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
430
+ * string (or a TrustedHTML object if Trusted Types are supported).
431
+ * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
432
+ */
433
+
434
+ let RETURN_DOM = false;
435
+ /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
436
+ * string (or a TrustedHTML object if Trusted Types are supported) */
437
+
438
+ let RETURN_DOM_FRAGMENT = false;
439
+ /* Try to return a Trusted Type object instead of a string, return a string in
440
+ * case Trusted Types are not supported */
441
+
442
+ let RETURN_TRUSTED_TYPE = false;
443
+ /* Output should be free from DOM clobbering attacks?
444
+ * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
445
+ */
446
+
447
+ let SANITIZE_DOM = true;
448
+ /* Achieve full DOM Clobbering protection by isolating the namespace of named
449
+ * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
450
+ *
451
+ * HTML/DOM spec rules that enable DOM Clobbering:
452
+ * - Named Access on Window (§7.3.3)
453
+ * - DOM Tree Accessors (§3.1.5)
454
+ * - Form Element Parent-Child Relations (§4.10.3)
455
+ * - Iframe srcdoc / Nested WindowProxies (§4.8.5)
456
+ * - HTMLCollection (§4.2.10.2)
457
+ *
458
+ * Namespace isolation is implemented by prefixing `id` and `name` attributes
459
+ * with a constant string, i.e., `user-content-`
460
+ */
461
+
462
+ let SANITIZE_NAMED_PROPS = false;
463
+ const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
464
+ /* Keep element content when removing element? */
465
+
466
+ let KEEP_CONTENT = true;
467
+ /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
468
+ * of importing it into a new Document and returning a sanitized copy */
469
+
470
+ let IN_PLACE = false;
471
+ /* Allow usage of profiles like html, svg and mathMl */
472
+
473
+ let USE_PROFILES = {};
474
+ /* Tags to ignore content of when KEEP_CONTENT is true */
475
+
476
+ let FORBID_CONTENTS = null;
477
+ 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']);
478
+ /* Tags that are safe for data: URIs */
479
+
480
+ let DATA_URI_TAGS = null;
481
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
482
+ /* Attributes safe for values like "javascript:" */
483
+
484
+ let URI_SAFE_ATTRIBUTES = null;
485
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
486
+ const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
487
+ const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
488
+ const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
489
+ /* Document namespace */
490
+
491
+ let NAMESPACE = HTML_NAMESPACE;
492
+ let IS_EMPTY_INPUT = false;
493
+ /* Allowed XHTML+XML namespaces */
494
+
495
+ let ALLOWED_NAMESPACES = null;
496
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
497
+ /* Parsing of strict XHTML documents */
498
+
499
+ let PARSER_MEDIA_TYPE;
500
+ const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
501
+ const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
502
+ let transformCaseFunc;
503
+ /* Keep a reference to config to pass to hooks */
504
+
505
+ let CONFIG = null;
506
+ /* Ideally, do not touch anything below this line */
507
+
508
+ /* ______________________________________________ */
509
+
510
+ const formElement = document.createElement('form');
511
+
512
+ const isRegexOrFunction = function isRegexOrFunction(testValue) {
513
+ return testValue instanceof RegExp || testValue instanceof Function;
514
+ };
515
+ /**
516
+ * _parseConfig
517
+ *
518
+ * @param {Object} cfg optional config literal
519
+ */
520
+ // eslint-disable-next-line complexity
521
+
522
+
523
+ const _parseConfig = function _parseConfig(cfg) {
524
+ if (CONFIG && CONFIG === cfg) {
525
+ return;
526
+ }
527
+ /* Shield configuration object from tampering */
528
+
529
+
530
+ if (!cfg || typeof cfg !== 'object') {
531
+ cfg = {};
532
+ }
533
+ /* Shield configuration object from prototype pollution */
534
+
535
+
536
+ cfg = clone(cfg);
537
+ PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
538
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
539
+
540
+ transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
541
+ /* Set configuration parameters */
542
+
543
+ ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
544
+ ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
545
+ ALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
546
+ URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent
547
+ cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent
548
+ transformCaseFunc // eslint-disable-line indent
549
+ ) // eslint-disable-line indent
550
+ : DEFAULT_URI_SAFE_ATTRIBUTES;
551
+ DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent
552
+ cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent
553
+ transformCaseFunc // eslint-disable-line indent
554
+ ) // eslint-disable-line indent
555
+ : DEFAULT_DATA_URI_TAGS;
556
+ FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
557
+ FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
558
+ FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
559
+ USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
560
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
561
+
562
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
563
+
564
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
565
+
566
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
567
+
568
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
569
+
570
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
571
+
572
+ RETURN_DOM = cfg.RETURN_DOM || false; // Default false
573
+
574
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
575
+
576
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
577
+
578
+ FORCE_BODY = cfg.FORCE_BODY || false; // Default false
579
+
580
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
581
+
582
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
583
+
584
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
585
+
586
+ IN_PLACE = cfg.IN_PLACE || false; // Default false
587
+
588
+ IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
589
+ NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
590
+ CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
591
+
592
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
593
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
594
+ }
595
+
596
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
597
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
598
+ }
599
+
600
+ if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
601
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
602
+ }
603
+
604
+ if (SAFE_FOR_TEMPLATES) {
605
+ ALLOW_DATA_ATTR = false;
606
+ }
607
+
608
+ if (RETURN_DOM_FRAGMENT) {
609
+ RETURN_DOM = true;
610
+ }
611
+ /* Parse profile info */
612
+
613
+
614
+ if (USE_PROFILES) {
615
+ ALLOWED_TAGS = addToSet({}, [...text]);
616
+ ALLOWED_ATTR = [];
617
+
618
+ if (USE_PROFILES.html === true) {
619
+ addToSet(ALLOWED_TAGS, html$1);
620
+ addToSet(ALLOWED_ATTR, html);
621
+ }
622
+
623
+ if (USE_PROFILES.svg === true) {
624
+ addToSet(ALLOWED_TAGS, svg$1);
625
+ addToSet(ALLOWED_ATTR, svg);
626
+ addToSet(ALLOWED_ATTR, xml);
627
+ }
628
+
629
+ if (USE_PROFILES.svgFilters === true) {
630
+ addToSet(ALLOWED_TAGS, svgFilters);
631
+ addToSet(ALLOWED_ATTR, svg);
632
+ addToSet(ALLOWED_ATTR, xml);
633
+ }
634
+
635
+ if (USE_PROFILES.mathMl === true) {
636
+ addToSet(ALLOWED_TAGS, mathMl$1);
637
+ addToSet(ALLOWED_ATTR, mathMl);
638
+ addToSet(ALLOWED_ATTR, xml);
639
+ }
640
+ }
641
+ /* Merge configuration parameters */
642
+
643
+
644
+ if (cfg.ADD_TAGS) {
645
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
646
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
647
+ }
648
+
649
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
650
+ }
651
+
652
+ if (cfg.ADD_ATTR) {
653
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
654
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
655
+ }
656
+
657
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
658
+ }
659
+
660
+ if (cfg.ADD_URI_SAFE_ATTR) {
661
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
662
+ }
663
+
664
+ if (cfg.FORBID_CONTENTS) {
665
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
666
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
667
+ }
668
+
669
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
670
+ }
671
+ /* Add #text in case KEEP_CONTENT is set to true */
672
+
673
+
674
+ if (KEEP_CONTENT) {
675
+ ALLOWED_TAGS['#text'] = true;
676
+ }
677
+ /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
678
+
679
+
680
+ if (WHOLE_DOCUMENT) {
681
+ addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
682
+ }
683
+ /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
684
+
685
+
686
+ if (ALLOWED_TAGS.table) {
687
+ addToSet(ALLOWED_TAGS, ['tbody']);
688
+ delete FORBID_TAGS.tbody;
689
+ }
690
+
691
+ if (cfg.TRUSTED_TYPES_POLICY) {
692
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
693
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
694
+ }
695
+
696
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
697
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
698
+ } // Overwrite existing TrustedTypes policy.
699
+
700
+
701
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY; // Sign local variables required by `sanitize`.
702
+
703
+ emptyHTML = trustedTypesPolicy.createHTML('');
704
+ } else {
705
+ // Uninitialized policy, attempt to initialize the internal dompurify policy.
706
+ if (trustedTypesPolicy === undefined) {
707
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
708
+ } // If creating the internal policy succeeded sign internal variables.
709
+
710
+
711
+ if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
712
+ emptyHTML = trustedTypesPolicy.createHTML('');
713
+ }
714
+ } // Prevent further manipulation of configuration.
715
+ // Not available in IE8, Safari 5, etc.
716
+
717
+
718
+ if (freeze) {
719
+ freeze(cfg);
720
+ }
721
+
722
+ CONFIG = cfg;
723
+ };
724
+
725
+ const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
726
+ const HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); // Certain elements are allowed in both SVG and HTML
727
+ // namespace. We need to specify them explicitly
728
+ // so that they don't get erroneously deleted from
729
+ // HTML namespace.
730
+
731
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
732
+ /* Keep track of all possible SVG and MathML tags
733
+ * so that we can perform the namespace checks
734
+ * correctly. */
735
+
736
+ const ALL_SVG_TAGS = addToSet({}, svg$1);
737
+ addToSet(ALL_SVG_TAGS, svgFilters);
738
+ addToSet(ALL_SVG_TAGS, svgDisallowed);
739
+ const ALL_MATHML_TAGS = addToSet({}, mathMl$1);
740
+ addToSet(ALL_MATHML_TAGS, mathMlDisallowed);
741
+ /**
742
+ *
743
+ *
744
+ * @param {Element} element a DOM element whose namespace is being checked
745
+ * @returns {boolean} Return false if the element has a
746
+ * namespace that a spec-compliant parser would never
747
+ * return. Return true otherwise.
748
+ */
749
+
750
+ const _checkValidNamespace = function _checkValidNamespace(element) {
751
+ let parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode
752
+ // can be null. We just simulate parent in this case.
753
+
754
+ if (!parent || !parent.tagName) {
755
+ parent = {
756
+ namespaceURI: NAMESPACE,
757
+ tagName: 'template'
758
+ };
759
+ }
760
+
761
+ const tagName = stringToLowerCase(element.tagName);
762
+ const parentTagName = stringToLowerCase(parent.tagName);
763
+
764
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
765
+ return false;
766
+ }
767
+
768
+ if (element.namespaceURI === SVG_NAMESPACE) {
769
+ // The only way to switch from HTML namespace to SVG
770
+ // is via <svg>. If it happens via any other tag, then
771
+ // it should be killed.
772
+ if (parent.namespaceURI === HTML_NAMESPACE) {
773
+ return tagName === 'svg';
774
+ } // The only way to switch from MathML to SVG is via`
775
+ // svg if parent is either <annotation-xml> or MathML
776
+ // text integration points.
777
+
778
+
779
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
780
+ return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
781
+ } // We only allow elements that are defined in SVG
782
+ // spec. All others are disallowed in SVG namespace.
783
+
784
+
785
+ return Boolean(ALL_SVG_TAGS[tagName]);
786
+ }
787
+
788
+ if (element.namespaceURI === MATHML_NAMESPACE) {
789
+ // The only way to switch from HTML namespace to MathML
790
+ // is via <math>. If it happens via any other tag, then
791
+ // it should be killed.
792
+ if (parent.namespaceURI === HTML_NAMESPACE) {
793
+ return tagName === 'math';
794
+ } // The only way to switch from SVG to MathML is via
795
+ // <math> and HTML integration points
796
+
797
+
798
+ if (parent.namespaceURI === SVG_NAMESPACE) {
799
+ return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
800
+ } // We only allow elements that are defined in MathML
801
+ // spec. All others are disallowed in MathML namespace.
802
+
803
+
804
+ return Boolean(ALL_MATHML_TAGS[tagName]);
805
+ }
806
+
807
+ if (element.namespaceURI === HTML_NAMESPACE) {
808
+ // The only way to switch from SVG to HTML is via
809
+ // HTML integration points, and from MathML to HTML
810
+ // is via MathML text integration points
811
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
812
+ return false;
813
+ }
814
+
815
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
816
+ return false;
817
+ } // We disallow tags that are specific for MathML
818
+ // or SVG and should never appear in HTML namespace
819
+
820
+
821
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
822
+ } // For XHTML and XML documents that support custom namespaces
823
+
824
+
825
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
826
+ return true;
827
+ } // The code should never reach this place (this means
828
+ // that the element somehow got namespace that is not
829
+ // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
830
+ // Return false just in case.
831
+
832
+
833
+ return false;
834
+ };
835
+ /**
836
+ * _forceRemove
837
+ *
838
+ * @param {Node} node a DOM node
839
+ */
840
+
841
+
842
+ const _forceRemove = function _forceRemove(node) {
843
+ arrayPush(DOMPurify.removed, {
844
+ element: node
845
+ });
846
+
847
+ try {
848
+ // eslint-disable-next-line unicorn/prefer-dom-node-remove
849
+ node.parentNode.removeChild(node);
850
+ } catch (_) {
851
+ node.remove();
852
+ }
853
+ };
854
+ /**
855
+ * _removeAttribute
856
+ *
857
+ * @param {String} name an Attribute name
858
+ * @param {Node} node a DOM node
859
+ */
860
+
861
+
862
+ const _removeAttribute = function _removeAttribute(name, node) {
863
+ try {
864
+ arrayPush(DOMPurify.removed, {
865
+ attribute: node.getAttributeNode(name),
866
+ from: node
867
+ });
868
+ } catch (_) {
869
+ arrayPush(DOMPurify.removed, {
870
+ attribute: null,
871
+ from: node
872
+ });
873
+ }
874
+
875
+ node.removeAttribute(name); // We void attribute values for unremovable "is"" attributes
876
+
877
+ if (name === 'is' && !ALLOWED_ATTR[name]) {
878
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
879
+ try {
880
+ _forceRemove(node);
881
+ } catch (_) {}
882
+ } else {
883
+ try {
884
+ node.setAttribute(name, '');
885
+ } catch (_) {}
886
+ }
887
+ }
888
+ };
889
+ /**
890
+ * _initDocument
891
+ *
892
+ * @param {String} dirty a string of dirty markup
893
+ * @return {Document} a DOM, filled with the dirty markup
894
+ */
895
+
896
+
897
+ const _initDocument = function _initDocument(dirty) {
898
+ /* Create a HTML document */
899
+ let doc;
900
+ let leadingWhitespace;
901
+
902
+ if (FORCE_BODY) {
903
+ dirty = '<remove></remove>' + dirty;
904
+ } else {
905
+ /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
906
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
907
+ leadingWhitespace = matches && matches[0];
908
+ }
909
+
910
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
911
+ // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
912
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
913
+ }
914
+
915
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
916
+ /*
917
+ * Use the DOMParser API by default, fallback later if needs be
918
+ * DOMParser not work for svg when has multiple root element.
919
+ */
920
+
921
+ if (NAMESPACE === HTML_NAMESPACE) {
922
+ try {
923
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
924
+ } catch (_) {}
925
+ }
926
+ /* Use createHTMLDocument in case DOMParser is not available */
927
+
928
+
929
+ if (!doc || !doc.documentElement) {
930
+ doc = implementation.createDocument(NAMESPACE, 'template', null);
931
+
932
+ try {
933
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
934
+ } catch (_) {// Syntax error if dirtyPayload is invalid xml
935
+ }
936
+ }
937
+
938
+ const body = doc.body || doc.documentElement;
939
+
940
+ if (dirty && leadingWhitespace) {
941
+ body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
942
+ }
943
+ /* Work on whole document or just its body */
944
+
945
+
946
+ if (NAMESPACE === HTML_NAMESPACE) {
947
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
948
+ }
949
+
950
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
951
+ };
952
+ /**
953
+ * _createIterator
954
+ *
955
+ * @param {Document} root document/fragment to create iterator for
956
+ * @return {Iterator} iterator instance
957
+ */
958
+
959
+
960
+ const _createIterator = function _createIterator(root) {
961
+ return createNodeIterator.call(root.ownerDocument || root, root, // eslint-disable-next-line no-bitwise
962
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false);
963
+ };
964
+ /**
965
+ * _isClobbered
966
+ *
967
+ * @param {Node} elm element to check for clobbering attacks
968
+ * @return {Boolean} true if clobbered, false if safe
969
+ */
970
+
971
+
972
+ const _isClobbered = function _isClobbered(elm) {
973
+ return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');
974
+ };
975
+ /**
976
+ * _isNode
977
+ *
978
+ * @param {Node} obj object to check whether it's a DOM node
979
+ * @return {Boolean} true is object is a DOM node
980
+ */
981
+
982
+
983
+ const _isNode = function _isNode(object) {
984
+ return typeof Node === 'object' ? object instanceof Node : object && typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string';
985
+ };
986
+ /**
987
+ * _executeHook
988
+ * Execute user configurable hooks
989
+ *
990
+ * @param {String} entryPoint Name of the hook's entry point
991
+ * @param {Node} currentNode node to work on with the hook
992
+ * @param {Object} data additional hook parameters
993
+ */
994
+
995
+
996
+ const _executeHook = function _executeHook(entryPoint, currentNode, data) {
997
+ if (!hooks[entryPoint]) {
998
+ return;
999
+ }
1000
+
1001
+ arrayForEach(hooks[entryPoint], hook => {
1002
+ hook.call(DOMPurify, currentNode, data, CONFIG);
1003
+ });
1004
+ };
1005
+ /**
1006
+ * _sanitizeElements
1007
+ *
1008
+ * @protect nodeName
1009
+ * @protect textContent
1010
+ * @protect removeChild
1011
+ *
1012
+ * @param {Node} currentNode to check for permission to exist
1013
+ * @return {Boolean} true if node was killed, false if left alive
1014
+ */
1015
+
1016
+
1017
+ const _sanitizeElements = function _sanitizeElements(currentNode) {
1018
+ let content;
1019
+ /* Execute a hook if present */
1020
+
1021
+ _executeHook('beforeSanitizeElements', currentNode, null);
1022
+ /* Check if element is clobbered or can clobber */
1023
+
1024
+
1025
+ if (_isClobbered(currentNode)) {
1026
+ _forceRemove(currentNode);
1027
+
1028
+ return true;
1029
+ }
1030
+ /* Now let's check the element's type and name */
1031
+
1032
+
1033
+ const tagName = transformCaseFunc(currentNode.nodeName);
1034
+ /* Execute a hook if present */
1035
+
1036
+ _executeHook('uponSanitizeElement', currentNode, {
1037
+ tagName,
1038
+ allowedTags: ALLOWED_TAGS
1039
+ });
1040
+ /* Detect mXSS attempts abusing namespace confusion */
1041
+
1042
+
1043
+ if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
1044
+ _forceRemove(currentNode);
1045
+
1046
+ return true;
1047
+ }
1048
+ /* Remove element if anything forbids its presence */
1049
+
1050
+
1051
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1052
+ /* Check if we have a custom element to handle */
1053
+ if (!FORBID_TAGS[tagName] && _basicCustomElementTest(tagName)) {
1054
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
1055
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
1056
+ }
1057
+ /* Keep content except for bad-listed elements */
1058
+
1059
+
1060
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
1061
+ const parentNode = getParentNode(currentNode) || currentNode.parentNode;
1062
+ const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
1063
+
1064
+ if (childNodes && parentNode) {
1065
+ const childCount = childNodes.length;
1066
+
1067
+ for (let i = childCount - 1; i >= 0; --i) {
1068
+ parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));
1069
+ }
1070
+ }
1071
+ }
1072
+
1073
+ _forceRemove(currentNode);
1074
+
1075
+ return true;
1076
+ }
1077
+ /* Check whether element has a valid namespace */
1078
+
1079
+
1080
+ if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
1081
+ _forceRemove(currentNode);
1082
+
1083
+ return true;
1084
+ }
1085
+ /* Make sure that older browsers don't get noscript mXSS */
1086
+
1087
+
1088
+ if ((tagName === 'noscript' || tagName === 'noembed') && regExpTest(/<\/no(script|embed)/i, currentNode.innerHTML)) {
1089
+ _forceRemove(currentNode);
1090
+
1091
+ return true;
1092
+ }
1093
+ /* Sanitize element content to be template-safe */
1094
+
1095
+
1096
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
1097
+ /* Get the element's text content */
1098
+ content = currentNode.textContent;
1099
+ content = stringReplace(content, MUSTACHE_EXPR, ' ');
1100
+ content = stringReplace(content, ERB_EXPR, ' ');
1101
+ content = stringReplace(content, TMPLIT_EXPR, ' ');
1102
+
1103
+ if (currentNode.textContent !== content) {
1104
+ arrayPush(DOMPurify.removed, {
1105
+ element: currentNode.cloneNode()
1106
+ });
1107
+ currentNode.textContent = content;
1108
+ }
1109
+ }
1110
+ /* Execute a hook if present */
1111
+
1112
+
1113
+ _executeHook('afterSanitizeElements', currentNode, null);
1114
+
1115
+ return false;
1116
+ };
1117
+ /**
1118
+ * _isValidAttribute
1119
+ *
1120
+ * @param {string} lcTag Lowercase tag name of containing element.
1121
+ * @param {string} lcName Lowercase attribute name.
1122
+ * @param {string} value Attribute value.
1123
+ * @return {Boolean} Returns true if `value` is valid, otherwise false.
1124
+ */
1125
+ // eslint-disable-next-line complexity
1126
+
1127
+
1128
+ const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
1129
+ /* Make sure attribute cannot clobber */
1130
+ if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
1131
+ return false;
1132
+ }
1133
+ /* Allow valid data-* attributes: At least one character after "-"
1134
+ (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
1135
+ XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
1136
+ We don't need to check the value; it's always URI safe. */
1137
+
1138
+
1139
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
1140
+ if ( // First condition does a very basic check if a) it's basically a valid custom element tagname AND
1141
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1142
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
1143
+ _basicCustomElementTest(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND
1144
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1145
+ lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {
1146
+ return false;
1147
+ }
1148
+ /* Check value is safe. First, is attr inert? If so, is safe */
1149
+
1150
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) {
1151
+ return false;
1152
+ } else ;
1153
+
1154
+ return true;
1155
+ };
1156
+ /**
1157
+ * _basicCustomElementCheck
1158
+ * checks if at least one dash is included in tagName, and it's not the first char
1159
+ * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
1160
+ * @param {string} tagName name of the tag of the node to sanitize
1161
+ */
1162
+
1163
+
1164
+ const _basicCustomElementTest = function _basicCustomElementTest(tagName) {
1165
+ return tagName.indexOf('-') > 0;
1166
+ };
1167
+ /**
1168
+ * _sanitizeAttributes
1169
+ *
1170
+ * @protect attributes
1171
+ * @protect nodeName
1172
+ * @protect removeAttribute
1173
+ * @protect setAttribute
1174
+ *
1175
+ * @param {Node} currentNode to sanitize
1176
+ */
1177
+
1178
+
1179
+ const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
1180
+ let attr;
1181
+ let value;
1182
+ let lcName;
1183
+ let l;
1184
+ /* Execute a hook if present */
1185
+
1186
+ _executeHook('beforeSanitizeAttributes', currentNode, null);
1187
+
1188
+ const {
1189
+ attributes
1190
+ } = currentNode;
1191
+ /* Check if we have attributes; if not we might have a text node */
1192
+
1193
+ if (!attributes) {
1194
+ return;
1195
+ }
1196
+
1197
+ const hookEvent = {
1198
+ attrName: '',
1199
+ attrValue: '',
1200
+ keepAttr: true,
1201
+ allowedAttributes: ALLOWED_ATTR
1202
+ };
1203
+ l = attributes.length;
1204
+ /* Go backwards over all attributes; safely remove bad ones */
1205
+
1206
+ while (l--) {
1207
+ attr = attributes[l];
1208
+ const {
1209
+ name,
1210
+ namespaceURI
1211
+ } = attr;
1212
+ value = name === 'value' ? attr.value : stringTrim(attr.value);
1213
+ lcName = transformCaseFunc(name);
1214
+ /* Execute a hook if present */
1215
+
1216
+ hookEvent.attrName = lcName;
1217
+ hookEvent.attrValue = value;
1218
+ hookEvent.keepAttr = true;
1219
+ hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
1220
+
1221
+ _executeHook('uponSanitizeAttribute', currentNode, hookEvent);
1222
+
1223
+ value = hookEvent.attrValue;
1224
+ /* Did the hooks approve of the attribute? */
1225
+
1226
+ if (hookEvent.forceKeepAttr) {
1227
+ continue;
1228
+ }
1229
+ /* Remove attribute */
1230
+
1231
+
1232
+ _removeAttribute(name, currentNode);
1233
+ /* Did the hooks approve of the attribute? */
1234
+
1235
+
1236
+ if (!hookEvent.keepAttr) {
1237
+ continue;
1238
+ }
1239
+ /* Work around a security issue in jQuery 3.0 */
1240
+
1241
+
1242
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
1243
+ _removeAttribute(name, currentNode);
1244
+
1245
+ continue;
1246
+ }
1247
+ /* Sanitize attribute content to be template-safe */
1248
+
1249
+
1250
+ if (SAFE_FOR_TEMPLATES) {
1251
+ value = stringReplace(value, MUSTACHE_EXPR, ' ');
1252
+ value = stringReplace(value, ERB_EXPR, ' ');
1253
+ value = stringReplace(value, TMPLIT_EXPR, ' ');
1254
+ }
1255
+ /* Is `value` valid for this attribute? */
1256
+
1257
+
1258
+ const lcTag = transformCaseFunc(currentNode.nodeName);
1259
+
1260
+ if (!_isValidAttribute(lcTag, lcName, value)) {
1261
+ continue;
1262
+ }
1263
+ /* Full DOM Clobbering protection via namespace isolation,
1264
+ * Prefix id and name attributes with `user-content-`
1265
+ */
1266
+
1267
+
1268
+ if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
1269
+ // Remove the attribute with this value
1270
+ _removeAttribute(name, currentNode); // Prefix the value and later re-create the attribute with the sanitized value
1271
+
1272
+
1273
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
1274
+ }
1275
+ /* Handle attributes that require Trusted Types */
1276
+
1277
+
1278
+ if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
1279
+ if (namespaceURI) ; else {
1280
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
1281
+ case 'TrustedHTML':
1282
+ {
1283
+ value = trustedTypesPolicy.createHTML(value);
1284
+ break;
1285
+ }
1286
+
1287
+ case 'TrustedScriptURL':
1288
+ {
1289
+ value = trustedTypesPolicy.createScriptURL(value);
1290
+ break;
1291
+ }
1292
+ }
1293
+ }
1294
+ }
1295
+ /* Handle invalid data-* attribute set by try-catching it */
1296
+
1297
+
1298
+ try {
1299
+ if (namespaceURI) {
1300
+ currentNode.setAttributeNS(namespaceURI, name, value);
1301
+ } else {
1302
+ /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
1303
+ currentNode.setAttribute(name, value);
1304
+ }
1305
+
1306
+ arrayPop(DOMPurify.removed);
1307
+ } catch (_) {}
1308
+ }
1309
+ /* Execute a hook if present */
1310
+
1311
+
1312
+ _executeHook('afterSanitizeAttributes', currentNode, null);
1313
+ };
1314
+ /**
1315
+ * _sanitizeShadowDOM
1316
+ *
1317
+ * @param {DocumentFragment} fragment to iterate over recursively
1318
+ */
1319
+
1320
+
1321
+ const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
1322
+ let shadowNode;
1323
+
1324
+ const shadowIterator = _createIterator(fragment);
1325
+ /* Execute a hook if present */
1326
+
1327
+
1328
+ _executeHook('beforeSanitizeShadowDOM', fragment, null);
1329
+
1330
+ while (shadowNode = shadowIterator.nextNode()) {
1331
+ /* Execute a hook if present */
1332
+ _executeHook('uponSanitizeShadowNode', shadowNode, null);
1333
+ /* Sanitize tags and elements */
1334
+
1335
+
1336
+ if (_sanitizeElements(shadowNode)) {
1337
+ continue;
1338
+ }
1339
+ /* Deep shadow DOM detected */
1340
+
1341
+
1342
+ if (shadowNode.content instanceof DocumentFragment) {
1343
+ _sanitizeShadowDOM(shadowNode.content);
1344
+ }
1345
+ /* Check attributes, sanitize if necessary */
1346
+
1347
+
1348
+ _sanitizeAttributes(shadowNode);
1349
+ }
1350
+ /* Execute a hook if present */
1351
+
1352
+
1353
+ _executeHook('afterSanitizeShadowDOM', fragment, null);
1354
+ };
1355
+ /**
1356
+ * Sanitize
1357
+ * Public method providing core sanitation functionality
1358
+ *
1359
+ * @param {String|Node} dirty string or DOM node
1360
+ * @param {Object} configuration object
1361
+ */
1362
+ // eslint-disable-next-line complexity
1363
+
1364
+
1365
+ DOMPurify.sanitize = function (dirty) {
1366
+ let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1367
+ let body;
1368
+ let importedNode;
1369
+ let currentNode;
1370
+ let returnNode;
1371
+ /* Make sure we have a string to sanitize.
1372
+ DO NOT return early, as this will return the wrong type if
1373
+ the user has requested a DOM object rather than a string */
1374
+
1375
+ IS_EMPTY_INPUT = !dirty;
1376
+
1377
+ if (IS_EMPTY_INPUT) {
1378
+ dirty = '<!-->';
1379
+ }
1380
+ /* Stringify, in case dirty is an object */
1381
+
1382
+
1383
+ if (typeof dirty !== 'string' && !_isNode(dirty)) {
1384
+ if (typeof dirty.toString === 'function') {
1385
+ dirty = dirty.toString();
1386
+
1387
+ if (typeof dirty !== 'string') {
1388
+ throw typeErrorCreate('dirty is not a string, aborting');
1389
+ }
1390
+ } else {
1391
+ throw typeErrorCreate('toString is not a function');
1392
+ }
1393
+ }
1394
+ /* Return dirty HTML if DOMPurify cannot run */
1395
+
1396
+
1397
+ if (!DOMPurify.isSupported) {
1398
+ return dirty;
1399
+ }
1400
+ /* Assign config vars */
1401
+
1402
+
1403
+ if (!SET_CONFIG) {
1404
+ _parseConfig(cfg);
1405
+ }
1406
+ /* Clean up removed elements */
1407
+
1408
+
1409
+ DOMPurify.removed = [];
1410
+ /* Check if dirty is correctly typed for IN_PLACE */
1411
+
1412
+ if (typeof dirty === 'string') {
1413
+ IN_PLACE = false;
1414
+ }
1415
+
1416
+ if (IN_PLACE) {
1417
+ /* Do some early pre-sanitization to avoid unsafe root nodes */
1418
+ if (dirty.nodeName) {
1419
+ const tagName = transformCaseFunc(dirty.nodeName);
1420
+
1421
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1422
+ throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
1423
+ }
1424
+ }
1425
+ } else if (dirty instanceof Node) {
1426
+ /* If dirty is a DOM element, append to an empty document to avoid
1427
+ elements being stripped by the parser */
1428
+ body = _initDocument('<!---->');
1429
+ importedNode = body.ownerDocument.importNode(dirty, true);
1430
+
1431
+ if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
1432
+ /* Node is already a body, use as is */
1433
+ body = importedNode;
1434
+ } else if (importedNode.nodeName === 'HTML') {
1435
+ body = importedNode;
1436
+ } else {
1437
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
1438
+ body.appendChild(importedNode);
1439
+ }
1440
+ } else {
1441
+ /* Exit directly if we have nothing to do */
1442
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
1443
+ dirty.indexOf('<') === -1) {
1444
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
1445
+ }
1446
+ /* Initialize the document to work on */
1447
+
1448
+
1449
+ body = _initDocument(dirty);
1450
+ /* Check we have a DOM node from the data */
1451
+
1452
+ if (!body) {
1453
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
1454
+ }
1455
+ }
1456
+ /* Remove first element node (ours) if FORCE_BODY is set */
1457
+
1458
+
1459
+ if (body && FORCE_BODY) {
1460
+ _forceRemove(body.firstChild);
1461
+ }
1462
+ /* Get node iterator */
1463
+
1464
+
1465
+ const nodeIterator = _createIterator(IN_PLACE ? dirty : body);
1466
+ /* Now start iterating over the created document */
1467
+
1468
+
1469
+ while (currentNode = nodeIterator.nextNode()) {
1470
+ /* Sanitize tags and elements */
1471
+ if (_sanitizeElements(currentNode)) {
1472
+ continue;
1473
+ }
1474
+ /* Shadow DOM detected, sanitize it */
1475
+
1476
+
1477
+ if (currentNode.content instanceof DocumentFragment) {
1478
+ _sanitizeShadowDOM(currentNode.content);
1479
+ }
1480
+ /* Check attributes, sanitize if necessary */
1481
+
1482
+
1483
+ _sanitizeAttributes(currentNode);
1484
+ }
1485
+ /* If we sanitized `dirty` in-place, return it. */
1486
+
1487
+
1488
+ if (IN_PLACE) {
1489
+ return dirty;
1490
+ }
1491
+ /* Return sanitized string or DOM */
1492
+
1493
+
1494
+ if (RETURN_DOM) {
1495
+ if (RETURN_DOM_FRAGMENT) {
1496
+ returnNode = createDocumentFragment.call(body.ownerDocument);
1497
+
1498
+ while (body.firstChild) {
1499
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
1500
+ returnNode.appendChild(body.firstChild);
1501
+ }
1502
+ } else {
1503
+ returnNode = body;
1504
+ }
1505
+
1506
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmod) {
1507
+ /*
1508
+ AdoptNode() is not used because internal state is not reset
1509
+ (e.g. the past names map of a HTMLFormElement), this is safe
1510
+ in theory but we would rather not risk another attack vector.
1511
+ The state that is cloned by importNode() is explicitly defined
1512
+ by the specs.
1513
+ */
1514
+ returnNode = importNode.call(originalDocument, returnNode, true);
1515
+ }
1516
+
1517
+ return returnNode;
1518
+ }
1519
+
1520
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
1521
+ /* Serialize doctype if allowed */
1522
+
1523
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
1524
+ serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
1525
+ }
1526
+ /* Sanitize final string template-safe */
1527
+
1528
+
1529
+ if (SAFE_FOR_TEMPLATES) {
1530
+ serializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR, ' ');
1531
+ serializedHTML = stringReplace(serializedHTML, ERB_EXPR, ' ');
1532
+ serializedHTML = stringReplace(serializedHTML, TMPLIT_EXPR, ' ');
1533
+ }
1534
+
1535
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
1536
+ };
1537
+ /**
1538
+ * Public method to set the configuration once
1539
+ * setConfig
1540
+ *
1541
+ * @param {Object} cfg configuration object
1542
+ */
1543
+
1544
+
1545
+ DOMPurify.setConfig = function (cfg) {
1546
+ _parseConfig(cfg);
1547
+
1548
+ SET_CONFIG = true;
1549
+ };
1550
+ /**
1551
+ * Public method to remove the configuration
1552
+ * clearConfig
1553
+ *
1554
+ */
1555
+
1556
+
1557
+ DOMPurify.clearConfig = function () {
1558
+ CONFIG = null;
1559
+ SET_CONFIG = false;
1560
+ };
1561
+ /**
1562
+ * Public method to check if an attribute value is valid.
1563
+ * Uses last set config, if any. Otherwise, uses config defaults.
1564
+ * isValidAttribute
1565
+ *
1566
+ * @param {string} tag Tag name of containing element.
1567
+ * @param {string} attr Attribute name.
1568
+ * @param {string} value Attribute value.
1569
+ * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
1570
+ */
1571
+
1572
+
1573
+ DOMPurify.isValidAttribute = function (tag, attr, value) {
1574
+ /* Initialize shared config vars if necessary. */
1575
+ if (!CONFIG) {
1576
+ _parseConfig({});
1577
+ }
1578
+
1579
+ const lcTag = transformCaseFunc(tag);
1580
+ const lcName = transformCaseFunc(attr);
1581
+ return _isValidAttribute(lcTag, lcName, value);
1582
+ };
1583
+ /**
1584
+ * AddHook
1585
+ * Public method to add DOMPurify hooks
1586
+ *
1587
+ * @param {String} entryPoint entry point for the hook to add
1588
+ * @param {Function} hookFunction function to execute
1589
+ */
1590
+
1591
+
1592
+ DOMPurify.addHook = function (entryPoint, hookFunction) {
1593
+ if (typeof hookFunction !== 'function') {
1594
+ return;
1595
+ }
1596
+
1597
+ hooks[entryPoint] = hooks[entryPoint] || [];
1598
+ arrayPush(hooks[entryPoint], hookFunction);
1599
+ };
1600
+ /**
1601
+ * RemoveHook
1602
+ * Public method to remove a DOMPurify hook at a given entryPoint
1603
+ * (pops it from the stack of hooks if more are present)
1604
+ *
1605
+ * @param {String} entryPoint entry point for the hook to remove
1606
+ * @return {Function} removed(popped) hook
1607
+ */
1608
+
1609
+
1610
+ DOMPurify.removeHook = function (entryPoint) {
1611
+ if (hooks[entryPoint]) {
1612
+ return arrayPop(hooks[entryPoint]);
1613
+ }
1614
+ };
1615
+ /**
1616
+ * RemoveHooks
1617
+ * Public method to remove all DOMPurify hooks at a given entryPoint
1618
+ *
1619
+ * @param {String} entryPoint entry point for the hooks to remove
1620
+ */
1621
+
1622
+
1623
+ DOMPurify.removeHooks = function (entryPoint) {
1624
+ if (hooks[entryPoint]) {
1625
+ hooks[entryPoint] = [];
1626
+ }
1627
+ };
1628
+ /**
1629
+ * RemoveAllHooks
1630
+ * Public method to remove all DOMPurify hooks
1631
+ *
1632
+ */
1633
+
1634
+
1635
+ DOMPurify.removeAllHooks = function () {
1636
+ hooks = {};
1637
+ };
1638
+
1639
+ return DOMPurify;
1640
+ }
1641
+
1642
+ var purify = createDOMPurify();
1643
+
1644
+ return purify;
1645
+
1646
+ }));
1647
+ //# sourceMappingURL=purify.js.map
1648
+ });
1649
+
1650
+ function tagRegXp(tagName) {
1651
+ return RegExp(/^tttx-/).exec(tagName);
1652
+ }
1653
+ function attributeNameCheck() {
1654
+ return true;
1655
+ }
1656
+ const domSanitiserOptions = {
1657
+ CUSTOM_ELEMENT_HANDLING: {
1658
+ tagNameCheck: tagRegXp,
1659
+ attributeNameCheck: attributeNameCheck,
1660
+ allowCustomizedBuiltInElements: false, // customized built-ins are not allowed
1661
+ }
1662
+ };
1663
+
1664
+ export { domSanitiserOptions as d, purify as p };