@bigbinary/neeto-molecules 3.13.14 → 3.13.15

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