PluginProbe ʕ •ᴥ•ʔ
Independent Analytics – WordPress Analytics Plugin / 2.7.3
Independent Analytics – WordPress Analytics Plugin v2.7.3
2.15.5 2.15.4 2.15.3 2.15.2 2.15.1 2.15.0 2.14.10 trunk 1.1 1.10 1.10.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.17.1 1.17.2 1.17.3 1.17.4 1.18 1.18.1 1.19.0 1.19.1 1.2 1.20.0 1.21.0 1.22.0 1.22.1 1.23.0 1.23.1 1.24.0 1.24.1 1.25.0 1.25.1 1.26.0 1.27.0 1.28.0 1.28.1 1.28.2 1.28.3 1.29.0 1.3 1.30.0 1.30.1 1.4 1.5 1.6 1.7 1.8 1.9 2.0.0 2.0.1 2.1.4 2.1.5 2.1.6 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.10 2.11.2 2.11.3 2.11.4 2.11.5 2.11.6 2.11.7 2.11.8 2.11.9 2.12.0 2.12.1 2.12.2 2.13.1 2.13.2 2.13.5 2.13.6 2.14.0 2.14.1 2.14.2 2.14.4 2.14.6 2.14.7 2.14.8 2.14.9 2.2.0 2.2.1 2.3.1 2.3.2 2.4.2 2.4.3 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.7.1 2.7.2 2.7.3 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7
independent-analytics / javascript-unminified / purify.2550ab20.js
independent-analytics / javascript-unminified Last commit date
dashboard_widget.js 2 years ago dashboard_widget.js.map 2 years ago download.js 2 years ago download.js.map 2 years ago index.es.aa861507.js 2 years ago index.es.aa861507.js.map 2 years ago index.js 2 years ago index.js.map 2 years ago layout.js 2 years ago layout.js.map 2 years ago purify.2550ab20.js 2 years ago purify.2550ab20.js.map 2 years ago settings.js 2 years ago settings.js.map 2 years ago
purify.2550ab20.js
1906 lines
1 // modules are defined as an array
2 // [ module function, map of requires ]
3 //
4 // map of requires is short require name -> numeric require
5 //
6 // anything defined in a previous bundle is accessed via the
7 // orig method which is the require for previous bundles
8
9 (function (modules, entry, mainEntry, parcelRequireName, globalName) {
10 /* eslint-disable no-undef */
11 var globalObject =
12 typeof globalThis !== 'undefined'
13 ? globalThis
14 : typeof self !== 'undefined'
15 ? self
16 : typeof window !== 'undefined'
17 ? window
18 : typeof global !== 'undefined'
19 ? global
20 : {};
21 /* eslint-enable no-undef */
22
23 // Save the require from previous bundle to this closure if any
24 var previousRequire =
25 typeof globalObject[parcelRequireName] === 'function' &&
26 globalObject[parcelRequireName];
27
28 var cache = previousRequire.cache || {};
29 // Do not use `require` to prevent Webpack from trying to bundle this call
30 var nodeRequire =
31 typeof module !== 'undefined' &&
32 typeof module.require === 'function' &&
33 module.require.bind(module);
34
35 function newRequire(name, jumped) {
36 if (!cache[name]) {
37 if (!modules[name]) {
38 // if we cannot find the module within our internal map or
39 // cache jump to the current global require ie. the last bundle
40 // that was added to the page.
41 var currentRequire =
42 typeof globalObject[parcelRequireName] === 'function' &&
43 globalObject[parcelRequireName];
44 if (!jumped && currentRequire) {
45 return currentRequire(name, true);
46 }
47
48 // If there are other bundles on this page the require from the
49 // previous one is saved to 'previousRequire'. Repeat this as
50 // many times as there are bundles until the module is found or
51 // we exhaust the require chain.
52 if (previousRequire) {
53 return previousRequire(name, true);
54 }
55
56 // Try the node require function if it exists.
57 if (nodeRequire && typeof name === 'string') {
58 return nodeRequire(name);
59 }
60
61 var err = new Error("Cannot find module '" + name + "'");
62 err.code = 'MODULE_NOT_FOUND';
63 throw err;
64 }
65
66 localRequire.resolve = resolve;
67 localRequire.cache = {};
68
69 var module = (cache[name] = new newRequire.Module(name));
70
71 modules[name][0].call(
72 module.exports,
73 localRequire,
74 module,
75 module.exports,
76 this
77 );
78 }
79
80 return cache[name].exports;
81
82 function localRequire(x) {
83 var res = localRequire.resolve(x);
84 return res === false ? {} : newRequire(res);
85 }
86
87 function resolve(x) {
88 var id = modules[name][1][x];
89 return id != null ? id : x;
90 }
91 }
92
93 function Module(moduleName) {
94 this.id = moduleName;
95 this.bundle = newRequire;
96 this.exports = {};
97 }
98
99 newRequire.isParcelRequire = true;
100 newRequire.Module = Module;
101 newRequire.modules = modules;
102 newRequire.cache = cache;
103 newRequire.parent = previousRequire;
104 newRequire.register = function (id, exports) {
105 modules[id] = [
106 function (require, module) {
107 module.exports = exports;
108 },
109 {},
110 ];
111 };
112
113 Object.defineProperty(newRequire, 'root', {
114 get: function () {
115 return globalObject[parcelRequireName];
116 },
117 });
118
119 globalObject[parcelRequireName] = newRequire;
120
121 for (var i = 0; i < entry.length; i++) {
122 newRequire(entry[i]);
123 }
124
125 if (mainEntry) {
126 // Expose entry point to Node, AMD or browser globals
127 // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
128 var mainExports = newRequire(mainEntry);
129
130 // CommonJS
131 if (typeof exports === 'object' && typeof module !== 'undefined') {
132 module.exports = mainExports;
133
134 // RequireJS
135 } else if (typeof define === 'function' && define.amd) {
136 define(function () {
137 return mainExports;
138 });
139
140 // <script>
141 } else if (globalName) {
142 this[globalName] = mainExports;
143 }
144 }
145 })({"6VJva":[function(require,module,exports) {
146 /*! @license DOMPurify 2.5.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.5.2/LICENSE */ (function(global, factory) {
147 module.exports = factory();
148 })(this, function() {
149 "use strict";
150 function _typeof(obj) {
151 "@babel/helpers - typeof";
152 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function _typeof(obj) {
153 return typeof obj;
154 } : function(obj) {
155 return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
156 }, _typeof(obj);
157 }
158 function _setPrototypeOf(o, p) {
159 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
160 o.__proto__ = p;
161 return o;
162 };
163 return _setPrototypeOf(o, p);
164 }
165 function _isNativeReflectConstruct() {
166 if (typeof Reflect === "undefined" || !Reflect.construct) return false;
167 if (Reflect.construct.sham) return false;
168 if (typeof Proxy === "function") return true;
169 try {
170 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
171 return true;
172 } catch (e) {
173 return false;
174 }
175 }
176 function _construct(Parent, args, Class) {
177 if (_isNativeReflectConstruct()) _construct = Reflect.construct;
178 else _construct = function _construct(Parent, args, Class) {
179 var a = [
180 null
181 ];
182 a.push.apply(a, args);
183 var Constructor = Function.bind.apply(Parent, a);
184 var instance = new Constructor();
185 if (Class) _setPrototypeOf(instance, Class.prototype);
186 return instance;
187 };
188 return _construct.apply(null, arguments);
189 }
190 function _toConsumableArray(arr) {
191 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
192 }
193 function _arrayWithoutHoles(arr) {
194 if (Array.isArray(arr)) return _arrayLikeToArray(arr);
195 }
196 function _iterableToArray(iter) {
197 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
198 }
199 function _unsupportedIterableToArray(o, minLen) {
200 if (!o) return;
201 if (typeof o === "string") return _arrayLikeToArray(o, minLen);
202 var n = Object.prototype.toString.call(o).slice(8, -1);
203 if (n === "Object" && o.constructor) n = o.constructor.name;
204 if (n === "Map" || n === "Set") return Array.from(o);
205 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
206 }
207 function _arrayLikeToArray(arr, len) {
208 if (len == null || len > arr.length) len = arr.length;
209 for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
210 return arr2;
211 }
212 function _nonIterableSpread() {
213 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
214 }
215 var hasOwnProperty = Object.hasOwnProperty, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
216 var freeze = Object.freeze, seal = Object.seal, create = Object.create; // eslint-disable-line import/no-mutable-exports
217 var _ref = typeof Reflect !== "undefined" && Reflect, apply = _ref.apply, construct = _ref.construct;
218 if (!apply) apply = function apply(fun, thisValue, args) {
219 return fun.apply(thisValue, args);
220 };
221 if (!freeze) freeze = function freeze(x) {
222 return x;
223 };
224 if (!seal) seal = function seal(x) {
225 return x;
226 };
227 if (!construct) construct = function construct(Func, args) {
228 return _construct(Func, _toConsumableArray(args));
229 };
230 var arrayForEach = unapply(Array.prototype.forEach);
231 var arrayPop = unapply(Array.prototype.pop);
232 var arrayPush = unapply(Array.prototype.push);
233 var stringToLowerCase = unapply(String.prototype.toLowerCase);
234 var stringToString = unapply(String.prototype.toString);
235 var stringMatch = unapply(String.prototype.match);
236 var stringReplace = unapply(String.prototype.replace);
237 var stringIndexOf = unapply(String.prototype.indexOf);
238 var stringTrim = unapply(String.prototype.trim);
239 var regExpTest = unapply(RegExp.prototype.test);
240 var typeErrorCreate = unconstruct(TypeError);
241 function unapply(func) {
242 return function(thisArg) {
243 for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)args[_key - 1] = arguments[_key];
244 return apply(func, thisArg, args);
245 };
246 }
247 function unconstruct(func) {
248 return function() {
249 for(var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++)args[_key2] = arguments[_key2];
250 return construct(func, args);
251 };
252 }
253 /* Add properties to a lookup table */ function addToSet(set, array, transformCaseFunc) {
254 var _transformCaseFunc;
255 transformCaseFunc = (_transformCaseFunc = transformCaseFunc) !== null && _transformCaseFunc !== void 0 ? _transformCaseFunc : stringToLowerCase;
256 if (setPrototypeOf) // Make 'in' and truthy checks like Boolean(set.constructor)
257 // independent of any properties defined on Object.prototype.
258 // Prevent prototype setters from intercepting set as a this value.
259 setPrototypeOf(set, null);
260 var l = array.length;
261 while(l--){
262 var element = array[l];
263 if (typeof element === "string") {
264 var lcElement = transformCaseFunc(element);
265 if (lcElement !== element) {
266 // Config presets (e.g. tags.js, attrs.js) are immutable.
267 if (!isFrozen(array)) array[l] = lcElement;
268 element = lcElement;
269 }
270 }
271 set[element] = true;
272 }
273 return set;
274 }
275 /* Shallow clone an object */ function clone(object) {
276 var newObject = create(null);
277 var property;
278 for(property in object)if (apply(hasOwnProperty, object, [
279 property
280 ]) === true) newObject[property] = object[property];
281 return newObject;
282 }
283 /* IE10 doesn't support __lookupGetter__ so lets'
284 * simulate it. It also automatically checks
285 * if the prop is function or getter and behaves
286 * accordingly. */ function lookupGetter(object, prop) {
287 while(object !== null){
288 var desc = getOwnPropertyDescriptor(object, prop);
289 if (desc) {
290 if (desc.get) return unapply(desc.get);
291 if (typeof desc.value === "function") return unapply(desc.value);
292 }
293 object = getPrototypeOf(object);
294 }
295 function fallbackValue(element) {
296 console.warn("fallback value for", element);
297 return null;
298 }
299 return fallbackValue;
300 }
301 var html$1 = freeze([
302 "a",
303 "abbr",
304 "acronym",
305 "address",
306 "area",
307 "article",
308 "aside",
309 "audio",
310 "b",
311 "bdi",
312 "bdo",
313 "big",
314 "blink",
315 "blockquote",
316 "body",
317 "br",
318 "button",
319 "canvas",
320 "caption",
321 "center",
322 "cite",
323 "code",
324 "col",
325 "colgroup",
326 "content",
327 "data",
328 "datalist",
329 "dd",
330 "decorator",
331 "del",
332 "details",
333 "dfn",
334 "dialog",
335 "dir",
336 "div",
337 "dl",
338 "dt",
339 "element",
340 "em",
341 "fieldset",
342 "figcaption",
343 "figure",
344 "font",
345 "footer",
346 "form",
347 "h1",
348 "h2",
349 "h3",
350 "h4",
351 "h5",
352 "h6",
353 "head",
354 "header",
355 "hgroup",
356 "hr",
357 "html",
358 "i",
359 "img",
360 "input",
361 "ins",
362 "kbd",
363 "label",
364 "legend",
365 "li",
366 "main",
367 "map",
368 "mark",
369 "marquee",
370 "menu",
371 "menuitem",
372 "meter",
373 "nav",
374 "nobr",
375 "ol",
376 "optgroup",
377 "option",
378 "output",
379 "p",
380 "picture",
381 "pre",
382 "progress",
383 "q",
384 "rp",
385 "rt",
386 "ruby",
387 "s",
388 "samp",
389 "section",
390 "select",
391 "shadow",
392 "small",
393 "source",
394 "spacer",
395 "span",
396 "strike",
397 "strong",
398 "style",
399 "sub",
400 "summary",
401 "sup",
402 "table",
403 "tbody",
404 "td",
405 "template",
406 "textarea",
407 "tfoot",
408 "th",
409 "thead",
410 "time",
411 "tr",
412 "track",
413 "tt",
414 "u",
415 "ul",
416 "var",
417 "video",
418 "wbr"
419 ]);
420 // SVG
421 var svg$1 = freeze([
422 "svg",
423 "a",
424 "altglyph",
425 "altglyphdef",
426 "altglyphitem",
427 "animatecolor",
428 "animatemotion",
429 "animatetransform",
430 "circle",
431 "clippath",
432 "defs",
433 "desc",
434 "ellipse",
435 "filter",
436 "font",
437 "g",
438 "glyph",
439 "glyphref",
440 "hkern",
441 "image",
442 "line",
443 "lineargradient",
444 "marker",
445 "mask",
446 "metadata",
447 "mpath",
448 "path",
449 "pattern",
450 "polygon",
451 "polyline",
452 "radialgradient",
453 "rect",
454 "stop",
455 "style",
456 "switch",
457 "symbol",
458 "text",
459 "textpath",
460 "title",
461 "tref",
462 "tspan",
463 "view",
464 "vkern"
465 ]);
466 var svgFilters = freeze([
467 "feBlend",
468 "feColorMatrix",
469 "feComponentTransfer",
470 "feComposite",
471 "feConvolveMatrix",
472 "feDiffuseLighting",
473 "feDisplacementMap",
474 "feDistantLight",
475 "feFlood",
476 "feFuncA",
477 "feFuncB",
478 "feFuncG",
479 "feFuncR",
480 "feGaussianBlur",
481 "feImage",
482 "feMerge",
483 "feMergeNode",
484 "feMorphology",
485 "feOffset",
486 "fePointLight",
487 "feSpecularLighting",
488 "feSpotLight",
489 "feTile",
490 "feTurbulence"
491 ]);
492 // List of SVG elements that are disallowed by default.
493 // We still need to know them so that we can do namespace
494 // checks properly in case one wants to add them to
495 // allow-list.
496 var svgDisallowed = freeze([
497 "animate",
498 "color-profile",
499 "cursor",
500 "discard",
501 "fedropshadow",
502 "font-face",
503 "font-face-format",
504 "font-face-name",
505 "font-face-src",
506 "font-face-uri",
507 "foreignobject",
508 "hatch",
509 "hatchpath",
510 "mesh",
511 "meshgradient",
512 "meshpatch",
513 "meshrow",
514 "missing-glyph",
515 "script",
516 "set",
517 "solidcolor",
518 "unknown",
519 "use"
520 ]);
521 var mathMl$1 = freeze([
522 "math",
523 "menclose",
524 "merror",
525 "mfenced",
526 "mfrac",
527 "mglyph",
528 "mi",
529 "mlabeledtr",
530 "mmultiscripts",
531 "mn",
532 "mo",
533 "mover",
534 "mpadded",
535 "mphantom",
536 "mroot",
537 "mrow",
538 "ms",
539 "mspace",
540 "msqrt",
541 "mstyle",
542 "msub",
543 "msup",
544 "msubsup",
545 "mtable",
546 "mtd",
547 "mtext",
548 "mtr",
549 "munder",
550 "munderover"
551 ]);
552 // Similarly to SVG, we want to know all MathML elements,
553 // even those that we disallow by default.
554 var mathMlDisallowed = freeze([
555 "maction",
556 "maligngroup",
557 "malignmark",
558 "mlongdiv",
559 "mscarries",
560 "mscarry",
561 "msgroup",
562 "mstack",
563 "msline",
564 "msrow",
565 "semantics",
566 "annotation",
567 "annotation-xml",
568 "mprescripts",
569 "none"
570 ]);
571 var text = freeze([
572 "#text"
573 ]);
574 var html = freeze([
575 "accept",
576 "action",
577 "align",
578 "alt",
579 "autocapitalize",
580 "autocomplete",
581 "autopictureinpicture",
582 "autoplay",
583 "background",
584 "bgcolor",
585 "border",
586 "capture",
587 "cellpadding",
588 "cellspacing",
589 "checked",
590 "cite",
591 "class",
592 "clear",
593 "color",
594 "cols",
595 "colspan",
596 "controls",
597 "controlslist",
598 "coords",
599 "crossorigin",
600 "datetime",
601 "decoding",
602 "default",
603 "dir",
604 "disabled",
605 "disablepictureinpicture",
606 "disableremoteplayback",
607 "download",
608 "draggable",
609 "enctype",
610 "enterkeyhint",
611 "face",
612 "for",
613 "headers",
614 "height",
615 "hidden",
616 "high",
617 "href",
618 "hreflang",
619 "id",
620 "inputmode",
621 "integrity",
622 "ismap",
623 "kind",
624 "label",
625 "lang",
626 "list",
627 "loading",
628 "loop",
629 "low",
630 "max",
631 "maxlength",
632 "media",
633 "method",
634 "min",
635 "minlength",
636 "multiple",
637 "muted",
638 "name",
639 "nonce",
640 "noshade",
641 "novalidate",
642 "nowrap",
643 "open",
644 "optimum",
645 "pattern",
646 "placeholder",
647 "playsinline",
648 "poster",
649 "preload",
650 "pubdate",
651 "radiogroup",
652 "readonly",
653 "rel",
654 "required",
655 "rev",
656 "reversed",
657 "role",
658 "rows",
659 "rowspan",
660 "spellcheck",
661 "scope",
662 "selected",
663 "shape",
664 "size",
665 "sizes",
666 "span",
667 "srclang",
668 "start",
669 "src",
670 "srcset",
671 "step",
672 "style",
673 "summary",
674 "tabindex",
675 "title",
676 "translate",
677 "type",
678 "usemap",
679 "valign",
680 "value",
681 "width",
682 "xmlns",
683 "slot"
684 ]);
685 var svg = freeze([
686 "accent-height",
687 "accumulate",
688 "additive",
689 "alignment-baseline",
690 "ascent",
691 "attributename",
692 "attributetype",
693 "azimuth",
694 "basefrequency",
695 "baseline-shift",
696 "begin",
697 "bias",
698 "by",
699 "class",
700 "clip",
701 "clippathunits",
702 "clip-path",
703 "clip-rule",
704 "color",
705 "color-interpolation",
706 "color-interpolation-filters",
707 "color-profile",
708 "color-rendering",
709 "cx",
710 "cy",
711 "d",
712 "dx",
713 "dy",
714 "diffuseconstant",
715 "direction",
716 "display",
717 "divisor",
718 "dur",
719 "edgemode",
720 "elevation",
721 "end",
722 "fill",
723 "fill-opacity",
724 "fill-rule",
725 "filter",
726 "filterunits",
727 "flood-color",
728 "flood-opacity",
729 "font-family",
730 "font-size",
731 "font-size-adjust",
732 "font-stretch",
733 "font-style",
734 "font-variant",
735 "font-weight",
736 "fx",
737 "fy",
738 "g1",
739 "g2",
740 "glyph-name",
741 "glyphref",
742 "gradientunits",
743 "gradienttransform",
744 "height",
745 "href",
746 "id",
747 "image-rendering",
748 "in",
749 "in2",
750 "k",
751 "k1",
752 "k2",
753 "k3",
754 "k4",
755 "kerning",
756 "keypoints",
757 "keysplines",
758 "keytimes",
759 "lang",
760 "lengthadjust",
761 "letter-spacing",
762 "kernelmatrix",
763 "kernelunitlength",
764 "lighting-color",
765 "local",
766 "marker-end",
767 "marker-mid",
768 "marker-start",
769 "markerheight",
770 "markerunits",
771 "markerwidth",
772 "maskcontentunits",
773 "maskunits",
774 "max",
775 "mask",
776 "media",
777 "method",
778 "mode",
779 "min",
780 "name",
781 "numoctaves",
782 "offset",
783 "operator",
784 "opacity",
785 "order",
786 "orient",
787 "orientation",
788 "origin",
789 "overflow",
790 "paint-order",
791 "path",
792 "pathlength",
793 "patterncontentunits",
794 "patterntransform",
795 "patternunits",
796 "points",
797 "preservealpha",
798 "preserveaspectratio",
799 "primitiveunits",
800 "r",
801 "rx",
802 "ry",
803 "radius",
804 "refx",
805 "refy",
806 "repeatcount",
807 "repeatdur",
808 "restart",
809 "result",
810 "rotate",
811 "scale",
812 "seed",
813 "shape-rendering",
814 "specularconstant",
815 "specularexponent",
816 "spreadmethod",
817 "startoffset",
818 "stddeviation",
819 "stitchtiles",
820 "stop-color",
821 "stop-opacity",
822 "stroke-dasharray",
823 "stroke-dashoffset",
824 "stroke-linecap",
825 "stroke-linejoin",
826 "stroke-miterlimit",
827 "stroke-opacity",
828 "stroke",
829 "stroke-width",
830 "style",
831 "surfacescale",
832 "systemlanguage",
833 "tabindex",
834 "targetx",
835 "targety",
836 "transform",
837 "transform-origin",
838 "text-anchor",
839 "text-decoration",
840 "text-rendering",
841 "textlength",
842 "type",
843 "u1",
844 "u2",
845 "unicode",
846 "values",
847 "viewbox",
848 "visibility",
849 "version",
850 "vert-adv-y",
851 "vert-origin-x",
852 "vert-origin-y",
853 "width",
854 "word-spacing",
855 "wrap",
856 "writing-mode",
857 "xchannelselector",
858 "ychannelselector",
859 "x",
860 "x1",
861 "x2",
862 "xmlns",
863 "y",
864 "y1",
865 "y2",
866 "z",
867 "zoomandpan"
868 ]);
869 var mathMl = freeze([
870 "accent",
871 "accentunder",
872 "align",
873 "bevelled",
874 "close",
875 "columnsalign",
876 "columnlines",
877 "columnspan",
878 "denomalign",
879 "depth",
880 "dir",
881 "display",
882 "displaystyle",
883 "encoding",
884 "fence",
885 "frame",
886 "height",
887 "href",
888 "id",
889 "largeop",
890 "length",
891 "linethickness",
892 "lspace",
893 "lquote",
894 "mathbackground",
895 "mathcolor",
896 "mathsize",
897 "mathvariant",
898 "maxsize",
899 "minsize",
900 "movablelimits",
901 "notation",
902 "numalign",
903 "open",
904 "rowalign",
905 "rowlines",
906 "rowspacing",
907 "rowspan",
908 "rspace",
909 "rquote",
910 "scriptlevel",
911 "scriptminsize",
912 "scriptsizemultiplier",
913 "selection",
914 "separator",
915 "separators",
916 "stretchy",
917 "subscriptshift",
918 "supscriptshift",
919 "symmetric",
920 "voffset",
921 "width",
922 "xmlns"
923 ]);
924 var xml = freeze([
925 "xlink:href",
926 "xml:id",
927 "xlink:title",
928 "xml:space",
929 "xmlns:xlink"
930 ]);
931 // eslint-disable-next-line unicorn/better-regex
932 var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
933 var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
934 var TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
935 var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
936 var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
937 var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
938 );
939 var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
940 var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
941 );
942 var DOCTYPE_NAME = seal(/^html$/i);
943 var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
944 var getGlobal = function getGlobal() {
945 return typeof window === "undefined" ? null : window;
946 };
947 /**
948 * Creates a no-op policy for internal use only.
949 * Don't export this function outside this module!
950 * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.
951 * @param {Document} document The document object (to determine policy name suffix)
952 * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types
953 * are not supported).
954 */ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) {
955 if (_typeof(trustedTypes) !== "object" || typeof trustedTypes.createPolicy !== "function") return null;
956 // Allow the callers to control the unique policy name
957 // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
958 // Policy creation with duplicate names throws in Trusted Types.
959 var suffix = null;
960 var ATTR_NAME = "data-tt-policy-suffix";
961 if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) suffix = document.currentScript.getAttribute(ATTR_NAME);
962 var policyName = "dompurify" + (suffix ? "#" + suffix : "");
963 try {
964 return trustedTypes.createPolicy(policyName, {
965 createHTML: function createHTML(html) {
966 return html;
967 },
968 createScriptURL: function createScriptURL(scriptUrl) {
969 return scriptUrl;
970 }
971 });
972 } catch (_) {
973 // Policy creation failed (most likely another DOMPurify script has
974 // already run). Skip creating the policy, as this will only cause errors
975 // if TT are enforced.
976 console.warn("TrustedTypes policy " + policyName + " could not be created.");
977 return null;
978 }
979 };
980 function createDOMPurify() {
981 var window1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
982 var DOMPurify = function DOMPurify(root) {
983 return createDOMPurify(root);
984 };
985 /**
986 * Version label, exposed for easier checks
987 * if DOMPurify is up to date or not
988 */ DOMPurify.version = "2.5.2";
989 /**
990 * Array of elements that DOMPurify removed during sanitation.
991 * Empty if nothing was removed.
992 */ DOMPurify.removed = [];
993 if (!window1 || !window1.document || window1.document.nodeType !== 9) {
994 // Not running in a browser, provide a factory function
995 // so that you can pass your own Window
996 DOMPurify.isSupported = false;
997 return DOMPurify;
998 }
999 var originalDocument = window1.document;
1000 var document = window1.document;
1001 var DocumentFragment = window1.DocumentFragment, HTMLTemplateElement = window1.HTMLTemplateElement, Node = window1.Node, Element = window1.Element, NodeFilter = window1.NodeFilter, _window$NamedNodeMap = window1.NamedNodeMap, NamedNodeMap = _window$NamedNodeMap === void 0 ? window1.NamedNodeMap || window1.MozNamedAttrMap : _window$NamedNodeMap, HTMLFormElement = window1.HTMLFormElement, DOMParser = window1.DOMParser, trustedTypes = window1.trustedTypes;
1002 var ElementPrototype = Element.prototype;
1003 var cloneNode = lookupGetter(ElementPrototype, "cloneNode");
1004 var getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
1005 var getChildNodes = lookupGetter(ElementPrototype, "childNodes");
1006 var getParentNode = lookupGetter(ElementPrototype, "parentNode");
1007 // As per issue #47, the web-components registry is inherited by a
1008 // new document created via createHTMLDocument. As per the spec
1009 // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
1010 // a new empty registry is used when creating a template contents owner
1011 // document, so we use that as our parent document to ensure nothing
1012 // is inherited.
1013 if (typeof HTMLTemplateElement === "function") {
1014 var template = document.createElement("template");
1015 if (template.content && template.content.ownerDocument) document = template.content.ownerDocument;
1016 }
1017 var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument);
1018 var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML("") : "";
1019 var _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName;
1020 var importNode = originalDocument.importNode;
1021 var documentMode = {};
1022 try {
1023 documentMode = clone(document).documentMode ? document.documentMode : {};
1024 } catch (_) {}
1025 var hooks = {};
1026 /**
1027 * Expose whether this browser supports running the full DOMPurify.
1028 */ DOMPurify.isSupported = typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== undefined && documentMode !== 9;
1029 var MUSTACHE_EXPR$1 = MUSTACHE_EXPR, ERB_EXPR$1 = ERB_EXPR, TMPLIT_EXPR$1 = TMPLIT_EXPR, DATA_ATTR$1 = DATA_ATTR, ARIA_ATTR$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$1 = ATTR_WHITESPACE, CUSTOM_ELEMENT$1 = CUSTOM_ELEMENT;
1030 var IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
1031 /**
1032 * We consider the elements and attributes below to be safe. Ideally
1033 * don't add any new ones but feel free to remove unwanted ones.
1034 */ /* allowed element names */ var ALLOWED_TAGS = null;
1035 var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(svgFilters), _toConsumableArray(mathMl$1), _toConsumableArray(text)));
1036 /* Allowed attribute names */ var ALLOWED_ATTR = null;
1037 var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(mathMl), _toConsumableArray(xml)));
1038 /*
1039 * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
1040 * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
1041 * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
1042 * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
1043 */ var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, {
1044 tagNameCheck: {
1045 writable: true,
1046 configurable: false,
1047 enumerable: true,
1048 value: null
1049 },
1050 attributeNameCheck: {
1051 writable: true,
1052 configurable: false,
1053 enumerable: true,
1054 value: null
1055 },
1056 allowCustomizedBuiltInElements: {
1057 writable: true,
1058 configurable: false,
1059 enumerable: true,
1060 value: false
1061 }
1062 }));
1063 /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */ var FORBID_TAGS = null;
1064 /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */ var FORBID_ATTR = null;
1065 /* Decide if ARIA attributes are okay */ var ALLOW_ARIA_ATTR = true;
1066 /* Decide if custom data attributes are okay */ var ALLOW_DATA_ATTR = true;
1067 /* Decide if unknown protocols are okay */ var ALLOW_UNKNOWN_PROTOCOLS = false;
1068 /* Decide if self-closing tags in attributes are allowed.
1069 * Usually removed due to a mXSS issue in jQuery 3.0 */ var ALLOW_SELF_CLOSE_IN_ATTR = true;
1070 /* Output should be safe for common template engines.
1071 * This means, DOMPurify removes data attributes, mustaches and ERB
1072 */ var SAFE_FOR_TEMPLATES = false;
1073 /* Output should be safe even for XML used within HTML and alike.
1074 * This means, DOMPurify removes comments when containing risky content.
1075 */ var SAFE_FOR_XML = true;
1076 /* Decide if document with <html>... should be returned */ var WHOLE_DOCUMENT = false;
1077 /* Track whether config is already set on this instance of DOMPurify. */ var SET_CONFIG = false;
1078 /* Decide if all elements (e.g. style, script) must be children of
1079 * document.body. By default, browsers might move them to document.head */ var FORCE_BODY = false;
1080 /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
1081 * string (or a TrustedHTML object if Trusted Types are supported).
1082 * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
1083 */ var RETURN_DOM = false;
1084 /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
1085 * string (or a TrustedHTML object if Trusted Types are supported) */ var RETURN_DOM_FRAGMENT = false;
1086 /* Try to return a Trusted Type object instead of a string, return a string in
1087 * case Trusted Types are not supported */ var RETURN_TRUSTED_TYPE = false;
1088 /* Output should be free from DOM clobbering attacks?
1089 * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
1090 */ var SANITIZE_DOM = true;
1091 /* Achieve full DOM Clobbering protection by isolating the namespace of named
1092 * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
1093 *
1094 * HTML/DOM spec rules that enable DOM Clobbering:
1095 * - Named Access on Window (§7.3.3)
1096 * - DOM Tree Accessors (§3.1.5)
1097 * - Form Element Parent-Child Relations (§4.10.3)
1098 * - Iframe srcdoc / Nested WindowProxies (§4.8.5)
1099 * - HTMLCollection (§4.2.10.2)
1100 *
1101 * Namespace isolation is implemented by prefixing `id` and `name` attributes
1102 * with a constant string, i.e., `user-content-`
1103 */ var SANITIZE_NAMED_PROPS = false;
1104 var SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
1105 /* Keep element content when removing element? */ var KEEP_CONTENT = true;
1106 /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
1107 * of importing it into a new Document and returning a sanitized copy */ var IN_PLACE = false;
1108 /* Allow usage of profiles like html, svg and mathMl */ var USE_PROFILES = {};
1109 /* Tags to ignore content of when KEEP_CONTENT is true */ var FORBID_CONTENTS = null;
1110 var DEFAULT_FORBID_CONTENTS = addToSet({}, [
1111 "annotation-xml",
1112 "audio",
1113 "colgroup",
1114 "desc",
1115 "foreignobject",
1116 "head",
1117 "iframe",
1118 "math",
1119 "mi",
1120 "mn",
1121 "mo",
1122 "ms",
1123 "mtext",
1124 "noembed",
1125 "noframes",
1126 "noscript",
1127 "plaintext",
1128 "script",
1129 "style",
1130 "svg",
1131 "template",
1132 "thead",
1133 "title",
1134 "video",
1135 "xmp"
1136 ]);
1137 /* Tags that are safe for data: URIs */ var DATA_URI_TAGS = null;
1138 var DEFAULT_DATA_URI_TAGS = addToSet({}, [
1139 "audio",
1140 "video",
1141 "img",
1142 "source",
1143 "image",
1144 "track"
1145 ]);
1146 /* Attributes safe for values like "javascript:" */ var URI_SAFE_ATTRIBUTES = null;
1147 var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, [
1148 "alt",
1149 "class",
1150 "for",
1151 "id",
1152 "label",
1153 "name",
1154 "pattern",
1155 "placeholder",
1156 "role",
1157 "summary",
1158 "title",
1159 "value",
1160 "style",
1161 "xmlns"
1162 ]);
1163 var MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
1164 var SVG_NAMESPACE = "http://www.w3.org/2000/svg";
1165 var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
1166 /* Document namespace */ var NAMESPACE = HTML_NAMESPACE;
1167 var IS_EMPTY_INPUT = false;
1168 /* Allowed XHTML+XML namespaces */ var ALLOWED_NAMESPACES = null;
1169 var DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [
1170 MATHML_NAMESPACE,
1171 SVG_NAMESPACE,
1172 HTML_NAMESPACE
1173 ], stringToString);
1174 /* Parsing of strict XHTML documents */ var PARSER_MEDIA_TYPE;
1175 var SUPPORTED_PARSER_MEDIA_TYPES = [
1176 "application/xhtml+xml",
1177 "text/html"
1178 ];
1179 var DEFAULT_PARSER_MEDIA_TYPE = "text/html";
1180 var transformCaseFunc;
1181 /* Keep a reference to config to pass to hooks */ var CONFIG = null;
1182 /* Specify the maximum element nesting depth to prevent mXSS */ var MAX_NESTING_DEPTH = 255;
1183 /* Ideally, do not touch anything below this line */ /* ______________________________________________ */ var formElement = document.createElement("form");
1184 var isRegexOrFunction = function isRegexOrFunction(testValue) {
1185 return testValue instanceof RegExp || testValue instanceof Function;
1186 };
1187 /**
1188 * _parseConfig
1189 *
1190 * @param {Object} cfg optional config literal
1191 */ // eslint-disable-next-line complexity
1192 var _parseConfig = function _parseConfig(cfg) {
1193 if (CONFIG && CONFIG === cfg) return;
1194 /* Shield configuration object from tampering */ if (!cfg || _typeof(cfg) !== "object") cfg = {};
1195 /* Shield configuration object from prototype pollution */ cfg = clone(cfg);
1196 PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
1197 SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE;
1198 // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
1199 transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
1200 /* Set configuration parameters */ ALLOWED_TAGS = "ALLOWED_TAGS" in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
1201 ALLOWED_ATTR = "ALLOWED_ATTR" in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
1202 ALLOWED_NAMESPACES = "ALLOWED_NAMESPACES" in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
1203 URI_SAFE_ATTRIBUTES = "ADD_URI_SAFE_ATTR" in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent
1204 cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent
1205 transformCaseFunc // eslint-disable-line indent
1206 ) // eslint-disable-line indent
1207 : DEFAULT_URI_SAFE_ATTRIBUTES;
1208 DATA_URI_TAGS = "ADD_DATA_URI_TAGS" in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent
1209 cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent
1210 transformCaseFunc // eslint-disable-line indent
1211 ) // eslint-disable-line indent
1212 : DEFAULT_DATA_URI_TAGS;
1213 FORBID_CONTENTS = "FORBID_CONTENTS" in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
1214 FORBID_TAGS = "FORBID_TAGS" in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
1215 FORBID_ATTR = "FORBID_ATTR" in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
1216 USE_PROFILES = "USE_PROFILES" in cfg ? cfg.USE_PROFILES : false;
1217 ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
1218 ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
1219 ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
1220 ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
1221 SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
1222 SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; // Default true
1223 WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
1224 RETURN_DOM = cfg.RETURN_DOM || false; // Default false
1225 RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
1226 RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
1227 FORCE_BODY = cfg.FORCE_BODY || false; // Default false
1228 SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
1229 SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
1230 KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
1231 IN_PLACE = cfg.IN_PLACE || false; // Default false
1232 IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$1;
1233 NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
1234 CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
1235 if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
1236 if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
1237 if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
1238 if (SAFE_FOR_TEMPLATES) ALLOW_DATA_ATTR = false;
1239 if (RETURN_DOM_FRAGMENT) RETURN_DOM = true;
1240 /* Parse profile info */ if (USE_PROFILES) {
1241 ALLOWED_TAGS = addToSet({}, _toConsumableArray(text));
1242 ALLOWED_ATTR = [];
1243 if (USE_PROFILES.html === true) {
1244 addToSet(ALLOWED_TAGS, html$1);
1245 addToSet(ALLOWED_ATTR, html);
1246 }
1247 if (USE_PROFILES.svg === true) {
1248 addToSet(ALLOWED_TAGS, svg$1);
1249 addToSet(ALLOWED_ATTR, svg);
1250 addToSet(ALLOWED_ATTR, xml);
1251 }
1252 if (USE_PROFILES.svgFilters === true) {
1253 addToSet(ALLOWED_TAGS, svgFilters);
1254 addToSet(ALLOWED_ATTR, svg);
1255 addToSet(ALLOWED_ATTR, xml);
1256 }
1257 if (USE_PROFILES.mathMl === true) {
1258 addToSet(ALLOWED_TAGS, mathMl$1);
1259 addToSet(ALLOWED_ATTR, mathMl);
1260 addToSet(ALLOWED_ATTR, xml);
1261 }
1262 }
1263 /* Merge configuration parameters */ if (cfg.ADD_TAGS) {
1264 if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) ALLOWED_TAGS = clone(ALLOWED_TAGS);
1265 addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
1266 }
1267 if (cfg.ADD_ATTR) {
1268 if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) ALLOWED_ATTR = clone(ALLOWED_ATTR);
1269 addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
1270 }
1271 if (cfg.ADD_URI_SAFE_ATTR) addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
1272 if (cfg.FORBID_CONTENTS) {
1273 if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS);
1274 addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
1275 }
1276 /* Add #text in case KEEP_CONTENT is set to true */ if (KEEP_CONTENT) ALLOWED_TAGS["#text"] = true;
1277 /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */ if (WHOLE_DOCUMENT) addToSet(ALLOWED_TAGS, [
1278 "html",
1279 "head",
1280 "body"
1281 ]);
1282 /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */ if (ALLOWED_TAGS.table) {
1283 addToSet(ALLOWED_TAGS, [
1284 "tbody"
1285 ]);
1286 delete FORBID_TAGS.tbody;
1287 }
1288 // Prevent further manipulation of configuration.
1289 // Not available in IE8, Safari 5, etc.
1290 if (freeze) freeze(cfg);
1291 CONFIG = cfg;
1292 };
1293 var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, [
1294 "mi",
1295 "mo",
1296 "mn",
1297 "ms",
1298 "mtext"
1299 ]);
1300 var HTML_INTEGRATION_POINTS = addToSet({}, [
1301 "foreignobject",
1302 "annotation-xml"
1303 ]);
1304 // Certain elements are allowed in both SVG and HTML
1305 // namespace. We need to specify them explicitly
1306 // so that they don't get erroneously deleted from
1307 // HTML namespace.
1308 var COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [
1309 "title",
1310 "style",
1311 "font",
1312 "a",
1313 "script"
1314 ]);
1315 /* Keep track of all possible SVG and MathML tags
1316 * so that we can perform the namespace checks
1317 * correctly. */ var ALL_SVG_TAGS = addToSet({}, svg$1);
1318 addToSet(ALL_SVG_TAGS, svgFilters);
1319 addToSet(ALL_SVG_TAGS, svgDisallowed);
1320 var ALL_MATHML_TAGS = addToSet({}, mathMl$1);
1321 addToSet(ALL_MATHML_TAGS, mathMlDisallowed);
1322 /**
1323 *
1324 *
1325 * @param {Element} element a DOM element whose namespace is being checked
1326 * @returns {boolean} Return false if the element has a
1327 * namespace that a spec-compliant parser would never
1328 * return. Return true otherwise.
1329 */ var _checkValidNamespace = function _checkValidNamespace(element) {
1330 var parent = getParentNode(element);
1331 // In JSDOM, if we're inside shadow DOM, then parentNode
1332 // can be null. We just simulate parent in this case.
1333 if (!parent || !parent.tagName) parent = {
1334 namespaceURI: NAMESPACE,
1335 tagName: "template"
1336 };
1337 var tagName = stringToLowerCase(element.tagName);
1338 var parentTagName = stringToLowerCase(parent.tagName);
1339 if (!ALLOWED_NAMESPACES[element.namespaceURI]) return false;
1340 if (element.namespaceURI === SVG_NAMESPACE) {
1341 // The only way to switch from HTML namespace to SVG
1342 // is via <svg>. If it happens via any other tag, then
1343 // it should be killed.
1344 if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "svg";
1345 // The only way to switch from MathML to SVG is via`
1346 // svg if parent is either <annotation-xml> or MathML
1347 // text integration points.
1348 if (parent.namespaceURI === MATHML_NAMESPACE) return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
1349 // We only allow elements that are defined in SVG
1350 // spec. All others are disallowed in SVG namespace.
1351 return Boolean(ALL_SVG_TAGS[tagName]);
1352 }
1353 if (element.namespaceURI === MATHML_NAMESPACE) {
1354 // The only way to switch from HTML namespace to MathML
1355 // is via <math>. If it happens via any other tag, then
1356 // it should be killed.
1357 if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "math";
1358 // The only way to switch from SVG to MathML is via
1359 // <math> and HTML integration points
1360 if (parent.namespaceURI === SVG_NAMESPACE) return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
1361 // We only allow elements that are defined in MathML
1362 // spec. All others are disallowed in MathML namespace.
1363 return Boolean(ALL_MATHML_TAGS[tagName]);
1364 }
1365 if (element.namespaceURI === HTML_NAMESPACE) {
1366 // The only way to switch from SVG to HTML is via
1367 // HTML integration points, and from MathML to HTML
1368 // is via MathML text integration points
1369 if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) return false;
1370 if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) return false;
1371 // We disallow tags that are specific for MathML
1372 // or SVG and should never appear in HTML namespace
1373 return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
1374 }
1375 // For XHTML and XML documents that support custom namespaces
1376 if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) return true;
1377 // The code should never reach this place (this means
1378 // that the element somehow got namespace that is not
1379 // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
1380 // Return false just in case.
1381 return false;
1382 };
1383 /**
1384 * _forceRemove
1385 *
1386 * @param {Node} node a DOM node
1387 */ var _forceRemove = function _forceRemove(node) {
1388 arrayPush(DOMPurify.removed, {
1389 element: node
1390 });
1391 try {
1392 // eslint-disable-next-line unicorn/prefer-dom-node-remove
1393 node.parentNode.removeChild(node);
1394 } catch (_) {
1395 try {
1396 node.outerHTML = emptyHTML;
1397 } catch (_) {
1398 node.remove();
1399 }
1400 }
1401 };
1402 /**
1403 * _removeAttribute
1404 *
1405 * @param {String} name an Attribute name
1406 * @param {Node} node a DOM node
1407 */ var _removeAttribute = function _removeAttribute(name, node) {
1408 try {
1409 arrayPush(DOMPurify.removed, {
1410 attribute: node.getAttributeNode(name),
1411 from: node
1412 });
1413 } catch (_) {
1414 arrayPush(DOMPurify.removed, {
1415 attribute: null,
1416 from: node
1417 });
1418 }
1419 node.removeAttribute(name);
1420 // We void attribute values for unremovable "is"" attributes
1421 if (name === "is" && !ALLOWED_ATTR[name]) {
1422 if (RETURN_DOM || RETURN_DOM_FRAGMENT) try {
1423 _forceRemove(node);
1424 } catch (_) {}
1425 else try {
1426 node.setAttribute(name, "");
1427 } catch (_) {}
1428 }
1429 };
1430 /**
1431 * _initDocument
1432 *
1433 * @param {String} dirty a string of dirty markup
1434 * @return {Document} a DOM, filled with the dirty markup
1435 */ var _initDocument = function _initDocument(dirty) {
1436 /* Create a HTML document */ var doc;
1437 var leadingWhitespace;
1438 if (FORCE_BODY) dirty = "<remove></remove>" + dirty;
1439 else {
1440 /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */ var matches = stringMatch(dirty, /^[\r\n\t ]+/);
1441 leadingWhitespace = matches && matches[0];
1442 }
1443 if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
1444 dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
1445 var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
1446 /*
1447 * Use the DOMParser API by default, fallback later if needs be
1448 * DOMParser not work for svg when has multiple root element.
1449 */ if (NAMESPACE === HTML_NAMESPACE) try {
1450 doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
1451 } catch (_) {}
1452 /* Use createHTMLDocument in case DOMParser is not available */ if (!doc || !doc.documentElement) {
1453 doc = implementation.createDocument(NAMESPACE, "template", null);
1454 try {
1455 doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
1456 } catch (_) {
1457 // Syntax error if dirtyPayload is invalid xml
1458 }
1459 }
1460 var body = doc.body || doc.documentElement;
1461 if (dirty && leadingWhitespace) body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
1462 /* Work on whole document or just its body */ if (NAMESPACE === HTML_NAMESPACE) return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
1463 return WHOLE_DOCUMENT ? doc.documentElement : body;
1464 };
1465 /**
1466 * _createIterator
1467 *
1468 * @param {Document} root document/fragment to create iterator for
1469 * @return {Iterator} iterator instance
1470 */ var _createIterator = function _createIterator(root) {
1471 return createNodeIterator.call(root.ownerDocument || root, root, // eslint-disable-next-line no-bitwise
1472 NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null, false);
1473 };
1474 /**
1475 * _isClobbered
1476 *
1477 * @param {Node} elm element to check for clobbering attacks
1478 * @return {Boolean} true if clobbered, false if safe
1479 */ var _isClobbered = function _isClobbered(elm) {
1480 return elm instanceof HTMLFormElement && (typeof elm.__depth !== "undefined" && typeof elm.__depth !== "number" || typeof elm.__removalCount !== "undefined" && typeof elm.__removalCount !== "number" || 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");
1481 };
1482 /**
1483 * _isNode
1484 *
1485 * @param {Node} obj object to check whether it's a DOM node
1486 * @return {Boolean} true is object is a DOM node
1487 */ var _isNode = function _isNode(object) {
1488 return _typeof(Node) === "object" ? object instanceof Node : object && _typeof(object) === "object" && typeof object.nodeType === "number" && typeof object.nodeName === "string";
1489 };
1490 /**
1491 * _executeHook
1492 * Execute user configurable hooks
1493 *
1494 * @param {String} entryPoint Name of the hook's entry point
1495 * @param {Node} currentNode node to work on with the hook
1496 * @param {Object} data additional hook parameters
1497 */ var _executeHook = function _executeHook(entryPoint, currentNode, data) {
1498 if (!hooks[entryPoint]) return;
1499 arrayForEach(hooks[entryPoint], function(hook) {
1500 hook.call(DOMPurify, currentNode, data, CONFIG);
1501 });
1502 };
1503 /**
1504 * _sanitizeElements
1505 *
1506 * @protect nodeName
1507 * @protect textContent
1508 * @protect removeChild
1509 *
1510 * @param {Node} currentNode to check for permission to exist
1511 * @return {Boolean} true if node was killed, false if left alive
1512 */ var _sanitizeElements = function _sanitizeElements(currentNode) {
1513 var content;
1514 /* Execute a hook if present */ _executeHook("beforeSanitizeElements", currentNode, null);
1515 /* Check if element is clobbered or can clobber */ if (_isClobbered(currentNode)) {
1516 _forceRemove(currentNode);
1517 return true;
1518 }
1519 /* Check if tagname contains Unicode */ if (regExpTest(/[\u0080-\uFFFF]/, currentNode.nodeName)) {
1520 _forceRemove(currentNode);
1521 return true;
1522 }
1523 /* Now let's check the element's type and name */ var tagName = transformCaseFunc(currentNode.nodeName);
1524 /* Execute a hook if present */ _executeHook("uponSanitizeElement", currentNode, {
1525 tagName: tagName,
1526 allowedTags: ALLOWED_TAGS
1527 });
1528 /* Detect mXSS attempts abusing namespace confusion */ if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
1529 _forceRemove(currentNode);
1530 return true;
1531 }
1532 /* Mitigate a problem with templates inside select */ if (tagName === "select" && regExpTest(/<template/i, currentNode.innerHTML)) {
1533 _forceRemove(currentNode);
1534 return true;
1535 }
1536 /* Remove any ocurrence of processing instructions */ if (currentNode.nodeType === 7) {
1537 _forceRemove(currentNode);
1538 return true;
1539 }
1540 /* Remove any kind of possibly harmful comments */ if (SAFE_FOR_XML && currentNode.nodeType === 8 && regExpTest(/<[/\w]/g, currentNode.data)) {
1541 _forceRemove(currentNode);
1542 return true;
1543 }
1544 /* Remove element if anything forbids its presence */ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1545 /* Check if we have a custom element to handle */ if (!FORBID_TAGS[tagName] && _basicCustomElementTest(tagName)) {
1546 if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
1547 if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
1548 }
1549 /* Keep content except for bad-listed elements */ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
1550 var parentNode = getParentNode(currentNode) || currentNode.parentNode;
1551 var childNodes = getChildNodes(currentNode) || currentNode.childNodes;
1552 if (childNodes && parentNode) {
1553 var childCount = childNodes.length;
1554 for(var i = childCount - 1; i >= 0; --i){
1555 var childClone = cloneNode(childNodes[i], true);
1556 childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
1557 parentNode.insertBefore(childClone, getNextSibling(currentNode));
1558 }
1559 }
1560 }
1561 _forceRemove(currentNode);
1562 return true;
1563 }
1564 /* Check whether element has a valid namespace */ if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
1565 _forceRemove(currentNode);
1566 return true;
1567 }
1568 /* Make sure that older browsers don't get fallback-tag mXSS */ if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
1569 _forceRemove(currentNode);
1570 return true;
1571 }
1572 /* Sanitize element content to be template-safe */ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
1573 /* Get the element's text content */ content = currentNode.textContent;
1574 content = stringReplace(content, MUSTACHE_EXPR$1, " ");
1575 content = stringReplace(content, ERB_EXPR$1, " ");
1576 content = stringReplace(content, TMPLIT_EXPR$1, " ");
1577 if (currentNode.textContent !== content) {
1578 arrayPush(DOMPurify.removed, {
1579 element: currentNode.cloneNode()
1580 });
1581 currentNode.textContent = content;
1582 }
1583 }
1584 /* Execute a hook if present */ _executeHook("afterSanitizeElements", currentNode, null);
1585 return false;
1586 };
1587 /**
1588 * _isValidAttribute
1589 *
1590 * @param {string} lcTag Lowercase tag name of containing element.
1591 * @param {string} lcName Lowercase attribute name.
1592 * @param {string} value Attribute value.
1593 * @return {Boolean} Returns true if `value` is valid, otherwise false.
1594 */ // eslint-disable-next-line complexity
1595 var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
1596 /* Make sure attribute cannot clobber */ if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) return false;
1597 /* Allow valid data-* attributes: At least one character after "-"
1598 (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
1599 XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
1600 We don't need to check the value; it's always URI safe. */ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$1, lcName)) ;
1601 else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) ;
1602 else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
1603 if (// First condition does a very basic check if a) it's basically a valid custom element tagname AND
1604 // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1605 // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
1606 _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
1607 // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1608 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))) ;
1609 else return false;
1610 /* Check value is safe. First, is attr inert? If so, is safe */ } else if (URI_SAFE_ATTRIBUTES[lcName]) ;
1611 else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) ;
1612 else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) ;
1613 else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) ;
1614 else if (value) return false;
1615 return true;
1616 };
1617 /**
1618 * _basicCustomElementCheck
1619 * checks if at least one dash is included in tagName, and it's not the first char
1620 * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
1621 * @param {string} tagName name of the tag of the node to sanitize
1622 */ var _basicCustomElementTest = function _basicCustomElementTest(tagName) {
1623 return tagName !== "annotation-xml" && stringMatch(tagName, CUSTOM_ELEMENT$1);
1624 };
1625 /**
1626 * _sanitizeAttributes
1627 *
1628 * @protect attributes
1629 * @protect nodeName
1630 * @protect removeAttribute
1631 * @protect setAttribute
1632 *
1633 * @param {Node} currentNode to sanitize
1634 */ var _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
1635 var attr;
1636 var value;
1637 var lcName;
1638 var l;
1639 /* Execute a hook if present */ _executeHook("beforeSanitizeAttributes", currentNode, null);
1640 var attributes = currentNode.attributes;
1641 /* Check if we have attributes; if not we might have a text node */ if (!attributes) return;
1642 var hookEvent = {
1643 attrName: "",
1644 attrValue: "",
1645 keepAttr: true,
1646 allowedAttributes: ALLOWED_ATTR
1647 };
1648 l = attributes.length;
1649 /* Go backwards over all attributes; safely remove bad ones */ while(l--){
1650 attr = attributes[l];
1651 var _attr = attr, name = _attr.name, namespaceURI = _attr.namespaceURI;
1652 value = name === "value" ? attr.value : stringTrim(attr.value);
1653 lcName = transformCaseFunc(name);
1654 /* Execute a hook if present */ hookEvent.attrName = lcName;
1655 hookEvent.attrValue = value;
1656 hookEvent.keepAttr = true;
1657 hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
1658 _executeHook("uponSanitizeAttribute", currentNode, hookEvent);
1659 value = hookEvent.attrValue;
1660 /* Did the hooks approve of the attribute? */ if (hookEvent.forceKeepAttr) continue;
1661 /* Remove attribute */ _removeAttribute(name, currentNode);
1662 /* Did the hooks approve of the attribute? */ if (!hookEvent.keepAttr) continue;
1663 /* Work around a security issue in jQuery 3.0 */ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
1664 _removeAttribute(name, currentNode);
1665 continue;
1666 }
1667 /* Sanitize attribute content to be template-safe */ if (SAFE_FOR_TEMPLATES) {
1668 value = stringReplace(value, MUSTACHE_EXPR$1, " ");
1669 value = stringReplace(value, ERB_EXPR$1, " ");
1670 value = stringReplace(value, TMPLIT_EXPR$1, " ");
1671 }
1672 /* Is `value` valid for this attribute? */ var lcTag = transformCaseFunc(currentNode.nodeName);
1673 if (!_isValidAttribute(lcTag, lcName, value)) continue;
1674 /* Full DOM Clobbering protection via namespace isolation,
1675 * Prefix id and name attributes with `user-content-`
1676 */ if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name")) {
1677 // Remove the attribute with this value
1678 _removeAttribute(name, currentNode);
1679 // Prefix the value and later re-create the attribute with the sanitized value
1680 value = SANITIZE_NAMED_PROPS_PREFIX + value;
1681 }
1682 /* Handle attributes that require Trusted Types */ if (trustedTypesPolicy && _typeof(trustedTypes) === "object" && typeof trustedTypes.getAttributeType === "function") {
1683 if (namespaceURI) ;
1684 else switch(trustedTypes.getAttributeType(lcTag, lcName)){
1685 case "TrustedHTML":
1686 value = trustedTypesPolicy.createHTML(value);
1687 break;
1688 case "TrustedScriptURL":
1689 value = trustedTypesPolicy.createScriptURL(value);
1690 break;
1691 }
1692 }
1693 /* Handle invalid data-* attribute set by try-catching it */ try {
1694 if (namespaceURI) currentNode.setAttributeNS(namespaceURI, name, value);
1695 else /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */ currentNode.setAttribute(name, value);
1696 arrayPop(DOMPurify.removed);
1697 } catch (_) {}
1698 }
1699 /* Execute a hook if present */ _executeHook("afterSanitizeAttributes", currentNode, null);
1700 };
1701 /**
1702 * _sanitizeShadowDOM
1703 *
1704 * @param {DocumentFragment} fragment to iterate over recursively
1705 */ var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
1706 var shadowNode;
1707 var shadowIterator = _createIterator(fragment);
1708 /* Execute a hook if present */ _executeHook("beforeSanitizeShadowDOM", fragment, null);
1709 while(shadowNode = shadowIterator.nextNode()){
1710 /* Execute a hook if present */ _executeHook("uponSanitizeShadowNode", shadowNode, null);
1711 /* Sanitize tags and elements */ if (_sanitizeElements(shadowNode)) continue;
1712 var parentNode = getParentNode(shadowNode);
1713 /* Set the nesting depth of an element */ if (shadowNode.nodeType === 1) {
1714 if (parentNode && parentNode.__depth) /*
1715 We want the depth of the node in the original tree, which can
1716 change when it's removed from its parent.
1717 */ shadowNode.__depth = (shadowNode.__removalCount || 0) + parentNode.__depth + 1;
1718 else shadowNode.__depth = 1;
1719 }
1720 /* Remove an element if nested too deeply to avoid mXSS */ if (shadowNode.__depth >= MAX_NESTING_DEPTH) _forceRemove(shadowNode);
1721 /* Deep shadow DOM detected */ if (shadowNode.content instanceof DocumentFragment) {
1722 shadowNode.content.__depth = shadowNode.__depth;
1723 _sanitizeShadowDOM(shadowNode.content);
1724 }
1725 /* Check attributes, sanitize if necessary */ _sanitizeAttributes(shadowNode);
1726 }
1727 /* Execute a hook if present */ _executeHook("afterSanitizeShadowDOM", fragment, null);
1728 };
1729 /**
1730 * Sanitize
1731 * Public method providing core sanitation functionality
1732 *
1733 * @param {String|Node} dirty string or DOM node
1734 * @param {Object} configuration object
1735 */ // eslint-disable-next-line complexity
1736 DOMPurify.sanitize = function(dirty) {
1737 var cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1738 var body;
1739 var importedNode;
1740 var currentNode;
1741 var oldNode;
1742 var returnNode;
1743 /* Make sure we have a string to sanitize.
1744 DO NOT return early, as this will return the wrong type if
1745 the user has requested a DOM object rather than a string */ IS_EMPTY_INPUT = !dirty;
1746 if (IS_EMPTY_INPUT) dirty = "<!-->";
1747 /* Stringify, in case dirty is an object */ if (typeof dirty !== "string" && !_isNode(dirty)) {
1748 if (typeof dirty.toString === "function") {
1749 dirty = dirty.toString();
1750 if (typeof dirty !== "string") throw typeErrorCreate("dirty is not a string, aborting");
1751 } else throw typeErrorCreate("toString is not a function");
1752 }
1753 /* Check we can run. Otherwise fall back or ignore */ if (!DOMPurify.isSupported) {
1754 if (_typeof(window1.toStaticHTML) === "object" || typeof window1.toStaticHTML === "function") {
1755 if (typeof dirty === "string") return window1.toStaticHTML(dirty);
1756 if (_isNode(dirty)) return window1.toStaticHTML(dirty.outerHTML);
1757 }
1758 return dirty;
1759 }
1760 /* Assign config vars */ if (!SET_CONFIG) _parseConfig(cfg);
1761 /* Clean up removed elements */ DOMPurify.removed = [];
1762 /* Check if dirty is correctly typed for IN_PLACE */ if (typeof dirty === "string") IN_PLACE = false;
1763 if (IN_PLACE) /* Do some early pre-sanitization to avoid unsafe root nodes */ {
1764 if (dirty.nodeName) {
1765 var tagName = transformCaseFunc(dirty.nodeName);
1766 if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
1767 }
1768 } else if (dirty instanceof Node) {
1769 /* If dirty is a DOM element, append to an empty document to avoid
1770 elements being stripped by the parser */ body = _initDocument("<!---->");
1771 importedNode = body.ownerDocument.importNode(dirty, true);
1772 if (importedNode.nodeType === 1 && importedNode.nodeName === "BODY") /* Node is already a body, use as is */ body = importedNode;
1773 else if (importedNode.nodeName === "HTML") body = importedNode;
1774 else // eslint-disable-next-line unicorn/prefer-dom-node-append
1775 body.appendChild(importedNode);
1776 } else {
1777 /* Exit directly if we have nothing to do */ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
1778 dirty.indexOf("<") === -1) return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
1779 /* Initialize the document to work on */ body = _initDocument(dirty);
1780 /* Check we have a DOM node from the data */ if (!body) return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
1781 }
1782 /* Remove first element node (ours) if FORCE_BODY is set */ if (body && FORCE_BODY) _forceRemove(body.firstChild);
1783 /* Get node iterator */ var nodeIterator = _createIterator(IN_PLACE ? dirty : body);
1784 /* Now start iterating over the created document */ while(currentNode = nodeIterator.nextNode()){
1785 /* Fix IE's strange behavior with manipulated textNodes #89 */ if (currentNode.nodeType === 3 && currentNode === oldNode) continue;
1786 /* Sanitize tags and elements */ if (_sanitizeElements(currentNode)) continue;
1787 var parentNode = getParentNode(currentNode);
1788 /* Set the nesting depth of an element */ if (currentNode.nodeType === 1) {
1789 if (parentNode && parentNode.__depth) /*
1790 We want the depth of the node in the original tree, which can
1791 change when it's removed from its parent.
1792 */ currentNode.__depth = (currentNode.__removalCount || 0) + parentNode.__depth + 1;
1793 else currentNode.__depth = 1;
1794 }
1795 /* Remove an element if nested too deeply to avoid mXSS */ if (currentNode.__depth >= MAX_NESTING_DEPTH) _forceRemove(currentNode);
1796 /* Shadow DOM detected, sanitize it */ if (currentNode.content instanceof DocumentFragment) {
1797 currentNode.content.__depth = currentNode.__depth;
1798 _sanitizeShadowDOM(currentNode.content);
1799 }
1800 /* Check attributes, sanitize if necessary */ _sanitizeAttributes(currentNode);
1801 oldNode = currentNode;
1802 }
1803 oldNode = null;
1804 /* If we sanitized `dirty` in-place, return it. */ if (IN_PLACE) return dirty;
1805 /* Return sanitized string or DOM */ if (RETURN_DOM) {
1806 if (RETURN_DOM_FRAGMENT) {
1807 returnNode = createDocumentFragment.call(body.ownerDocument);
1808 while(body.firstChild)// eslint-disable-next-line unicorn/prefer-dom-node-append
1809 returnNode.appendChild(body.firstChild);
1810 } else returnNode = body;
1811 if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmod) /*
1812 AdoptNode() is not used because internal state is not reset
1813 (e.g. the past names map of a HTMLFormElement), this is safe
1814 in theory but we would rather not risk another attack vector.
1815 The state that is cloned by importNode() is explicitly defined
1816 by the specs.
1817 */ returnNode = importNode.call(originalDocument, returnNode, true);
1818 return returnNode;
1819 }
1820 var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
1821 /* Serialize doctype if allowed */ if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
1822 /* Sanitize final string template-safe */ if (SAFE_FOR_TEMPLATES) {
1823 serializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR$1, " ");
1824 serializedHTML = stringReplace(serializedHTML, ERB_EXPR$1, " ");
1825 serializedHTML = stringReplace(serializedHTML, TMPLIT_EXPR$1, " ");
1826 }
1827 return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
1828 };
1829 /**
1830 * Public method to set the configuration once
1831 * setConfig
1832 *
1833 * @param {Object} cfg configuration object
1834 */ DOMPurify.setConfig = function(cfg) {
1835 _parseConfig(cfg);
1836 SET_CONFIG = true;
1837 };
1838 /**
1839 * Public method to remove the configuration
1840 * clearConfig
1841 *
1842 */ DOMPurify.clearConfig = function() {
1843 CONFIG = null;
1844 SET_CONFIG = false;
1845 };
1846 /**
1847 * Public method to check if an attribute value is valid.
1848 * Uses last set config, if any. Otherwise, uses config defaults.
1849 * isValidAttribute
1850 *
1851 * @param {string} tag Tag name of containing element.
1852 * @param {string} attr Attribute name.
1853 * @param {string} value Attribute value.
1854 * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
1855 */ DOMPurify.isValidAttribute = function(tag, attr, value) {
1856 /* Initialize shared config vars if necessary. */ if (!CONFIG) _parseConfig({});
1857 var lcTag = transformCaseFunc(tag);
1858 var lcName = transformCaseFunc(attr);
1859 return _isValidAttribute(lcTag, lcName, value);
1860 };
1861 /**
1862 * AddHook
1863 * Public method to add DOMPurify hooks
1864 *
1865 * @param {String} entryPoint entry point for the hook to add
1866 * @param {Function} hookFunction function to execute
1867 */ DOMPurify.addHook = function(entryPoint, hookFunction) {
1868 if (typeof hookFunction !== "function") return;
1869 hooks[entryPoint] = hooks[entryPoint] || [];
1870 arrayPush(hooks[entryPoint], hookFunction);
1871 };
1872 /**
1873 * RemoveHook
1874 * Public method to remove a DOMPurify hook at a given entryPoint
1875 * (pops it from the stack of hooks if more are present)
1876 *
1877 * @param {String} entryPoint entry point for the hook to remove
1878 * @return {Function} removed(popped) hook
1879 */ DOMPurify.removeHook = function(entryPoint) {
1880 if (hooks[entryPoint]) return arrayPop(hooks[entryPoint]);
1881 };
1882 /**
1883 * RemoveHooks
1884 * Public method to remove all DOMPurify hooks at a given entryPoint
1885 *
1886 * @param {String} entryPoint entry point for the hooks to remove
1887 */ DOMPurify.removeHooks = function(entryPoint) {
1888 if (hooks[entryPoint]) hooks[entryPoint] = [];
1889 };
1890 /**
1891 * RemoveAllHooks
1892 * Public method to remove all DOMPurify hooks
1893 *
1894 */ DOMPurify.removeAllHooks = function() {
1895 hooks = {};
1896 };
1897 return DOMPurify;
1898 }
1899 var purify = createDOMPurify();
1900 return purify;
1901 });
1902
1903 },{}]},[], null, "parcelRequirec571")
1904
1905 //# sourceMappingURL=purify.2550ab20.js.map
1906