x-print-designer 0.2.0 → 0.2.2

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.
@@ -1,4 +1,4 @@
1
- /*! @license DOMPurify 3.4.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.2/LICENSE */
1
+ /*! @license DOMPurify 3.4.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.0/LICENSE */
2
2
  const {
3
3
  entries,
4
4
  setPrototypeOf,
@@ -46,19 +46,13 @@ const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
46
46
  const arrayPop = unapply(Array.prototype.pop);
47
47
  const arrayPush = unapply(Array.prototype.push);
48
48
  const arraySplice = unapply(Array.prototype.splice);
49
- const arrayIsArray = Array.isArray;
50
49
  const stringToLowerCase = unapply(String.prototype.toLowerCase);
51
50
  const stringToString = unapply(String.prototype.toString);
52
51
  const stringMatch = unapply(String.prototype.match);
53
52
  const stringReplace = unapply(String.prototype.replace);
54
53
  const stringIndexOf = unapply(String.prototype.indexOf);
55
54
  const stringTrim = unapply(String.prototype.trim);
56
- const numberToString = unapply(Number.prototype.toString);
57
- const booleanToString = unapply(Boolean.prototype.toString);
58
- const bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString);
59
- const symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString);
60
55
  const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
61
- const objectToString = unapply(Object.prototype.toString);
62
56
  const regExpTest = unapply(RegExp.prototype.test);
63
57
  const typeErrorCreate = unconstruct(TypeError);
64
58
  function unapply(func) {
@@ -85,9 +79,6 @@ function addToSet(set, array) {
85
79
  if (setPrototypeOf) {
86
80
  setPrototypeOf(set, null);
87
81
  }
88
- if (!arrayIsArray(array)) {
89
- return set;
90
- }
91
82
  let l = array.length;
92
83
  while (l--) {
93
84
  let element = array[l];
@@ -118,7 +109,7 @@ function clone(object) {
118
109
  for (const [property, value] of entries(object)) {
119
110
  const isPropertyExist = objectHasOwnProperty(object, property);
120
111
  if (isPropertyExist) {
121
- if (arrayIsArray(value)) {
112
+ if (Array.isArray(value)) {
122
113
  newObject[property] = cleanArray(value);
123
114
  } else if (value && typeof value === "object" && value.constructor === Object) {
124
115
  newObject[property] = clone(value);
@@ -129,44 +120,6 @@ function clone(object) {
129
120
  }
130
121
  return newObject;
131
122
  }
132
- function stringifyValue(value) {
133
- switch (typeof value) {
134
- case "string": {
135
- return value;
136
- }
137
- case "number": {
138
- return numberToString(value);
139
- }
140
- case "boolean": {
141
- return booleanToString(value);
142
- }
143
- case "bigint": {
144
- return bigintToString ? bigintToString(value) : "0";
145
- }
146
- case "symbol": {
147
- return symbolToString ? symbolToString(value) : "Symbol()";
148
- }
149
- case "undefined": {
150
- return objectToString(value);
151
- }
152
- case "function":
153
- case "object": {
154
- if (value === null) {
155
- return objectToString(value);
156
- }
157
- const valueAsRecord = value;
158
- const valueToString = lookupGetter(valueAsRecord, "toString");
159
- if (typeof valueToString === "function") {
160
- const stringified = valueToString(valueAsRecord);
161
- return typeof stringified === "string" ? stringified : objectToString(stringified);
162
- }
163
- return objectToString(value);
164
- }
165
- default: {
166
- return objectToString(value);
167
- }
168
- }
169
- }
170
123
  function lookupGetter(object, prop) {
171
124
  while (object !== null) {
172
125
  const desc = getOwnPropertyDescriptor(object, prop);
@@ -185,14 +138,6 @@ function lookupGetter(object, prop) {
185
138
  }
186
139
  return fallbackValue;
187
140
  }
188
- function isRegex(value) {
189
- try {
190
- regExpTest(value, "");
191
- return true;
192
- } catch (_unused) {
193
- return false;
194
- }
195
- }
196
141
  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", "search", "section", "select", "shadow", "slot", "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"]);
197
142
  const svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
198
143
  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"]);
@@ -200,7 +145,7 @@ const svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "
200
145
  const mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]);
201
146
  const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
202
147
  const text = freeze(["#text"]);
203
- const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns"]);
148
+ const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]);
204
149
  const svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]);
205
150
  const mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnalign", "columnlines", "columnspacing", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lquote", "lspace", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]);
206
151
  const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
@@ -284,7 +229,7 @@ const _createHooksMap = function _createHooksMap2() {
284
229
  function createDOMPurify() {
285
230
  let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
286
231
  const DOMPurify = (root) => createDOMPurify(root);
287
- DOMPurify.version = "3.4.2";
232
+ DOMPurify.version = "3.4.0";
288
233
  DOMPurify.removed = [];
289
234
  if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
290
235
  DOMPurify.isSupported = false;
@@ -439,15 +384,15 @@ function createDOMPurify() {
439
384
  PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
440
385
  SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
441
386
  transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
442
- ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") && arrayIsArray(cfg.ALLOWED_TAGS) ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
443
- ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") && arrayIsArray(cfg.ALLOWED_ATTR) ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
444
- ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") && arrayIsArray(cfg.ALLOWED_NAMESPACES) ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
445
- URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR) ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
446
- DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") && arrayIsArray(cfg.ADD_DATA_URI_TAGS) ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
447
- FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS) ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
448
- FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") && arrayIsArray(cfg.FORBID_TAGS) ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
449
- FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") && arrayIsArray(cfg.FORBID_ATTR) ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
450
- USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
387
+ ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
388
+ ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
389
+ ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
390
+ URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
391
+ DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
392
+ FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
393
+ FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
394
+ FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
395
+ USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES : false;
451
396
  ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
452
397
  ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
453
398
  ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
@@ -463,20 +408,19 @@ function createDOMPurify() {
463
408
  SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
464
409
  KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
465
410
  IN_PLACE = cfg.IN_PLACE || false;
466
- IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
467
- NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
468
- MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "MATHML_TEXT_INTEGRATION_POINTS") && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === "object" ? clone(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
469
- HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "HTML_INTEGRATION_POINTS") && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === "object" ? clone(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, ["annotation-xml"]);
470
- const customElementHandling = objectHasOwnProperty(cfg, "CUSTOM_ELEMENT_HANDLING") && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === "object" ? clone(cfg.CUSTOM_ELEMENT_HANDLING) : create(null);
471
- CUSTOM_ELEMENT_HANDLING = create(null);
472
- if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) {
473
- CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
411
+ IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
412
+ NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
413
+ MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
414
+ HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
415
+ CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || create(null);
416
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
417
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
474
418
  }
475
- if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) {
476
- CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
419
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
420
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
477
421
  }
478
- if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") {
479
- CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
422
+ if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") {
423
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
480
424
  }
481
425
  if (SAFE_FOR_TEMPLATES) {
482
426
  ALLOW_DATA_ATTR = false;
@@ -509,36 +453,36 @@ function createDOMPurify() {
509
453
  }
510
454
  EXTRA_ELEMENT_HANDLING.tagCheck = null;
511
455
  EXTRA_ELEMENT_HANDLING.attributeCheck = null;
512
- if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
456
+ if (cfg.ADD_TAGS) {
513
457
  if (typeof cfg.ADD_TAGS === "function") {
514
458
  EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
515
- } else if (arrayIsArray(cfg.ADD_TAGS)) {
459
+ } else {
516
460
  if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
517
461
  ALLOWED_TAGS = clone(ALLOWED_TAGS);
518
462
  }
519
463
  addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
520
464
  }
521
465
  }
522
- if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
466
+ if (cfg.ADD_ATTR) {
523
467
  if (typeof cfg.ADD_ATTR === "function") {
524
468
  EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
525
- } else if (arrayIsArray(cfg.ADD_ATTR)) {
469
+ } else {
526
470
  if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
527
471
  ALLOWED_ATTR = clone(ALLOWED_ATTR);
528
472
  }
529
473
  addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
530
474
  }
531
475
  }
532
- if (objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) {
476
+ if (cfg.ADD_URI_SAFE_ATTR) {
533
477
  addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
534
478
  }
535
- if (objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS)) {
479
+ if (cfg.FORBID_CONTENTS) {
536
480
  if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
537
481
  FORBID_CONTENTS = clone(FORBID_CONTENTS);
538
482
  }
539
483
  addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
540
484
  }
541
- if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
485
+ if (cfg.ADD_FORBID_CONTENTS) {
542
486
  if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
543
487
  FORBID_CONTENTS = clone(FORBID_CONTENTS);
544
488
  }
@@ -759,6 +703,7 @@ function createDOMPurify() {
759
703
  const childCount = childNodes.length;
760
704
  for (let i = childCount - 1; i >= 0; --i) {
761
705
  const childClone = cloneNode(childNodes[i], true);
706
+ childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
762
707
  parentNode.insertBefore(childClone, getNextSibling(currentNode));
763
708
  }
764
709
  }
@@ -796,10 +741,10 @@ function createDOMPurify() {
796
741
  if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) {
797
742
  return false;
798
743
  }
799
- const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
800
744
  if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) ;
801
745
  else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName)) ;
802
- else if (!nameIsPermitted || FORBID_ATTR[lcName]) {
746
+ else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ;
747
+ else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
803
748
  if (
804
749
  // First condition does a very basic check if a) it's basically a valid custom element tagname AND
805
750
  // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
@@ -820,9 +765,8 @@ function createDOMPurify() {
820
765
  } else ;
821
766
  return true;
822
767
  };
823
- const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]);
824
768
  const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
825
- return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT2, tagName);
769
+ return tagName !== "annotation-xml" && stringMatch(tagName, CUSTOM_ELEMENT2);
826
770
  };
827
771
  const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
828
772
  _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
@@ -856,7 +800,7 @@ function createDOMPurify() {
856
800
  hookEvent.forceKeepAttr = void 0;
857
801
  _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
858
802
  value = hookEvent.attrValue;
859
- if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
803
+ if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name")) {
860
804
  _removeAttribute(name, currentNode);
861
805
  value = SANITIZE_NAMED_PROPS_PREFIX + value;
862
806
  }
@@ -948,9 +892,13 @@ function createDOMPurify() {
948
892
  dirty = "<!-->";
949
893
  }
950
894
  if (typeof dirty !== "string" && !_isNode(dirty)) {
951
- dirty = stringifyValue(dirty);
952
- if (typeof dirty !== "string") {
953
- throw typeErrorCreate("dirty is not a string, aborting");
895
+ if (typeof dirty.toString === "function") {
896
+ dirty = dirty.toString();
897
+ if (typeof dirty !== "string") {
898
+ throw typeErrorCreate("dirty is not a string, aborting");
899
+ }
900
+ } else {
901
+ throw typeErrorCreate("toString is not a function");
954
902
  }
955
903
  }
956
904
  if (!DOMPurify.isSupported) {
@@ -964,9 +912,8 @@ function createDOMPurify() {
964
912
  IN_PLACE = false;
965
913
  }
966
914
  if (IN_PLACE) {
967
- const nn = dirty.nodeName;
968
- if (typeof nn === "string") {
969
- const tagName = transformCaseFunc(nn);
915
+ if (dirty.nodeName) {
916
+ const tagName = transformCaseFunc(dirty.nodeName);
970
917
  if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
971
918
  throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
972
919
  }
@@ -1,4 +1,4 @@
1
- import { isAroundZero, ZRImage, normalizeColor, getLineDash, DEFAULT_PATH_STYLE, map, keys, encodeHTML, CompoundPath, each, isString, createCubicEasingFunc, copyTransform, extend, getSRTTransformString, filter, isNumber, getPathPrecision, PathProxy, liftColor, Path, TSpan, getIdURL, DEFAULT_FONT, adjustTextY, getLineHeight, TEXT_ALIGN_TO_ANCHOR, hasSeparateFont, parseFontSize, DEFAULT_FONT_FAMILY, isLinearGradient, isRadialGradient, retrieve2, logError, round4, isImagePattern, assert, createOrUpdateImage, clone, getMatrixStr, isGradient, isPattern, getElementSSRData, isFunction, hasShadow, getShadowKey, isArray, isObject, getSize, encodeBase64, noop, __extends, disableUserSelect, BoundingRect, REDRAW_BIT, Eventful, devicePixelRatio, platformApi, isGradientObject, getCanvasGradient, isImagePatternObject, createCanvasPattern, brush as brush$1, brushSingle, requestAnimationFrame, env, merge, indexOf } from "./graphic-BP8Wuks8.js";
1
+ import { isAroundZero, ZRImage, normalizeColor, getLineDash, DEFAULT_PATH_STYLE, map, keys, encodeHTML, CompoundPath, each, isString, createCubicEasingFunc, copyTransform, extend, getSRTTransformString, filter, isNumber, getPathPrecision, PathProxy, liftColor, Path, TSpan, getIdURL, DEFAULT_FONT, adjustTextY, getLineHeight, TEXT_ALIGN_TO_ANCHOR, hasSeparateFont, parseFontSize, DEFAULT_FONT_FAMILY, isLinearGradient, isRadialGradient, retrieve2, logError, round4, isImagePattern, assert, createOrUpdateImage, clone, getMatrixStr, isGradient, isPattern, getElementSSRData, isFunction, hasShadow, getShadowKey, isArray, isObject, getSize, encodeBase64, noop, __extends, disableUserSelect, BoundingRect, REDRAW_BIT, Eventful, devicePixelRatio, platformApi, isGradientObject, getCanvasGradient, isImagePatternObject, createCanvasPattern, brush as brush$1, brushSingle, requestAnimationFrame, env, merge, indexOf } from "./graphic-BEFAeatd.js";
2
2
  var mathSin = Math.sin;
3
3
  var mathCos = Math.cos;
4
4
  var PI = Math.PI;