@dinert/element-plus 1.1.12 → 1.1.14

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.
@@ -0,0 +1,502 @@
1
+ /*! @license DOMPurify 3.1.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.1.0/LICENSE */
2
+ const {
3
+ entries: ut,
4
+ setPrototypeOf: ot,
5
+ isFrozen: Ht,
6
+ getPrototypeOf: zt,
7
+ getOwnPropertyDescriptor: Wt
8
+ } = Object;
9
+ let {
10
+ freeze: g,
11
+ seal: L,
12
+ create: mt
13
+ } = Object, {
14
+ apply: Ne,
15
+ construct: De
16
+ } = typeof Reflect < "u" && Reflect;
17
+ g || (g = function(o) {
18
+ return o;
19
+ });
20
+ L || (L = function(o) {
21
+ return o;
22
+ });
23
+ Ne || (Ne = function(o, l, r) {
24
+ return o.apply(l, r);
25
+ });
26
+ De || (De = function(o, l) {
27
+ return new o(...l);
28
+ });
29
+ const te = R(Array.prototype.forEach), it = R(Array.prototype.pop), j = R(Array.prototype.push), ie = R(String.prototype.toLowerCase), Se = R(String.prototype.toString), at = R(String.prototype.match), V = R(String.prototype.replace), Gt = R(String.prototype.indexOf), Bt = R(String.prototype.trim), O = R(Object.prototype.hasOwnProperty), S = R(RegExp.prototype.test), $ = Yt(TypeError);
30
+ function R(s) {
31
+ return function(o) {
32
+ for (var l = arguments.length, r = new Array(l > 1 ? l - 1 : 0), d = 1; d < l; d++)
33
+ r[d - 1] = arguments[d];
34
+ return Ne(s, o, r);
35
+ };
36
+ }
37
+ function Yt(s) {
38
+ return function() {
39
+ for (var o = arguments.length, l = new Array(o), r = 0; r < o; r++)
40
+ l[r] = arguments[r];
41
+ return De(s, l);
42
+ };
43
+ }
44
+ function a(s, o) {
45
+ let l = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ie;
46
+ ot && ot(s, null);
47
+ let r = o.length;
48
+ for (; r--; ) {
49
+ let d = o[r];
50
+ if (typeof d == "string") {
51
+ const N = l(d);
52
+ N !== d && (Ht(o) || (o[r] = N), d = N);
53
+ }
54
+ s[d] = !0;
55
+ }
56
+ return s;
57
+ }
58
+ function Xt(s) {
59
+ for (let o = 0; o < s.length; o++)
60
+ O(s, o) || (s[o] = null);
61
+ return s;
62
+ }
63
+ function w(s) {
64
+ const o = mt(null);
65
+ for (const [l, r] of ut(s))
66
+ O(s, l) && (Array.isArray(r) ? o[l] = Xt(r) : r && typeof r == "object" && r.constructor === Object ? o[l] = w(r) : o[l] = r);
67
+ return o;
68
+ }
69
+ function ne(s, o) {
70
+ for (; s !== null; ) {
71
+ const r = Wt(s, o);
72
+ if (r) {
73
+ if (r.get)
74
+ return R(r.get);
75
+ if (typeof r.value == "function")
76
+ return R(r.value);
77
+ }
78
+ s = zt(s);
79
+ }
80
+ function l() {
81
+ return null;
82
+ }
83
+ return l;
84
+ }
85
+ const rt = g(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), Re = g(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Le = g(["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"]), jt = g(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), Oe = g(["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"]), Vt = g(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), st = g(["#text"]), lt = g(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), ye = g(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), ct = g(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), oe = g(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), $t = L(/\{\{[\w\W]*|[\w\W]*\}\}/gm), qt = L(/<%[\w\W]*|[\w\W]*%>/gm), Kt = L(/\${[\w\W]*}/gm), Zt = L(/^data-[\-\w.\u00B7-\uFFFF]/), Jt = L(/^aria-[\-\w]+$/), pt = L(
86
+ /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
87
+ // eslint-disable-line no-useless-escape
88
+ ), Qt = L(/^(?:\w+script|data):/i), en = L(
89
+ /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
90
+ // eslint-disable-line no-control-regex
91
+ ), dt = L(/^html$/i), tn = L(/^[a-z][.\w]*(-[.\w]+)+$/i);
92
+ var ft = /* @__PURE__ */ Object.freeze({
93
+ __proto__: null,
94
+ MUSTACHE_EXPR: $t,
95
+ ERB_EXPR: qt,
96
+ TMPLIT_EXPR: Kt,
97
+ DATA_ATTR: Zt,
98
+ ARIA_ATTR: Jt,
99
+ IS_ALLOWED_URI: pt,
100
+ IS_SCRIPT_OR_DATA: Qt,
101
+ ATTR_WHITESPACE: en,
102
+ DOCTYPE_NAME: dt,
103
+ CUSTOM_ELEMENT: tn
104
+ });
105
+ const nn = function() {
106
+ return typeof window > "u" ? null : window;
107
+ }, on = function(o, l) {
108
+ if (typeof o != "object" || typeof o.createPolicy != "function")
109
+ return null;
110
+ let r = null;
111
+ const d = "data-tt-policy-suffix";
112
+ l && l.hasAttribute(d) && (r = l.getAttribute(d));
113
+ const N = "dompurify" + (r ? "#" + r : "");
114
+ try {
115
+ return o.createPolicy(N, {
116
+ createHTML(x) {
117
+ return x;
118
+ },
119
+ createScriptURL(x) {
120
+ return x;
121
+ }
122
+ });
123
+ } catch {
124
+ return console.warn("TrustedTypes policy " + N + " could not be created."), null;
125
+ }
126
+ };
127
+ function Tt() {
128
+ let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : nn();
129
+ const o = (i) => Tt(i);
130
+ if (o.version = "3.1.0", o.removed = [], !s || !s.document || s.document.nodeType !== 9)
131
+ return o.isSupported = !1, o;
132
+ let {
133
+ document: l
134
+ } = s;
135
+ const r = l, d = r.currentScript, {
136
+ DocumentFragment: N,
137
+ HTMLTemplateElement: x,
138
+ Node: ae,
139
+ Element: be,
140
+ NodeFilter: z,
141
+ NamedNodeMap: Et = s.NamedNodeMap || s.MozNamedAttrMap,
142
+ HTMLFormElement: _t,
143
+ DOMParser: gt,
144
+ trustedTypes: q
145
+ } = s, K = be.prototype, ht = ne(K, "cloneNode"), At = ne(K, "nextSibling"), St = ne(K, "childNodes"), re = ne(K, "parentNode");
146
+ if (typeof x == "function") {
147
+ const i = l.createElement("template");
148
+ i.content && i.content.ownerDocument && (l = i.content.ownerDocument);
149
+ }
150
+ let _, W = "";
151
+ const {
152
+ implementation: se,
153
+ createNodeIterator: Rt,
154
+ createDocumentFragment: Lt,
155
+ getElementsByTagName: Ot
156
+ } = l, {
157
+ importNode: yt
158
+ } = r;
159
+ let y = {};
160
+ o.isSupported = typeof ut == "function" && typeof re == "function" && se && se.createHTMLDocument !== void 0;
161
+ const {
162
+ MUSTACHE_EXPR: le,
163
+ ERB_EXPR: ce,
164
+ TMPLIT_EXPR: fe,
165
+ DATA_ATTR: Nt,
166
+ ARIA_ATTR: Dt,
167
+ IS_SCRIPT_OR_DATA: bt,
168
+ ATTR_WHITESPACE: Ie,
169
+ CUSTOM_ELEMENT: It
170
+ } = ft;
171
+ let {
172
+ IS_ALLOWED_URI: Ce
173
+ } = ft, u = null;
174
+ const Me = a({}, [...rt, ...Re, ...Le, ...Oe, ...st]);
175
+ let m = null;
176
+ const we = a({}, [...lt, ...ye, ...ct, ...oe]);
177
+ let f = Object.seal(mt(null, {
178
+ tagNameCheck: {
179
+ writable: !0,
180
+ configurable: !1,
181
+ enumerable: !0,
182
+ value: null
183
+ },
184
+ attributeNameCheck: {
185
+ writable: !0,
186
+ configurable: !1,
187
+ enumerable: !0,
188
+ value: null
189
+ },
190
+ allowCustomizedBuiltInElements: {
191
+ writable: !0,
192
+ configurable: !1,
193
+ enumerable: !0,
194
+ value: !1
195
+ }
196
+ })), G = null, ue = null, xe = !0, me = !0, Pe = !1, ke = !0, P = !1, ve = !0, C = !1, pe = !1, de = !1, k = !1, Z = !1, J = !1, Ue = !0, Fe = !1;
197
+ const Ct = "user-content-";
198
+ let Te = !0, B = !1, v = {}, U = null;
199
+ const He = a({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
200
+ let ze = null;
201
+ const We = a({}, ["audio", "video", "img", "source", "image", "track"]);
202
+ let Ee = null;
203
+ const Ge = a({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), Q = "http://www.w3.org/1998/Math/MathML", ee = "http://www.w3.org/2000/svg", D = "http://www.w3.org/1999/xhtml";
204
+ let F = D, _e = !1, ge = null;
205
+ const Mt = a({}, [Q, ee, D], Se);
206
+ let Y = null;
207
+ const wt = ["application/xhtml+xml", "text/html"], xt = "text/html";
208
+ let p = null, H = null;
209
+ const Pt = l.createElement("form"), Be = function(e) {
210
+ return e instanceof RegExp || e instanceof Function;
211
+ }, he = function() {
212
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
213
+ if (!(H && H === e)) {
214
+ if ((!e || typeof e != "object") && (e = {}), e = w(e), Y = // eslint-disable-next-line unicorn/prefer-includes
215
+ wt.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? xt : e.PARSER_MEDIA_TYPE, p = Y === "application/xhtml+xml" ? Se : ie, u = O(e, "ALLOWED_TAGS") ? a({}, e.ALLOWED_TAGS, p) : Me, m = O(e, "ALLOWED_ATTR") ? a({}, e.ALLOWED_ATTR, p) : we, ge = O(e, "ALLOWED_NAMESPACES") ? a({}, e.ALLOWED_NAMESPACES, Se) : Mt, Ee = O(e, "ADD_URI_SAFE_ATTR") ? a(
216
+ w(Ge),
217
+ // eslint-disable-line indent
218
+ e.ADD_URI_SAFE_ATTR,
219
+ // eslint-disable-line indent
220
+ p
221
+ // eslint-disable-line indent
222
+ ) : Ge, ze = O(e, "ADD_DATA_URI_TAGS") ? a(
223
+ w(We),
224
+ // eslint-disable-line indent
225
+ e.ADD_DATA_URI_TAGS,
226
+ // eslint-disable-line indent
227
+ p
228
+ // eslint-disable-line indent
229
+ ) : We, U = O(e, "FORBID_CONTENTS") ? a({}, e.FORBID_CONTENTS, p) : He, G = O(e, "FORBID_TAGS") ? a({}, e.FORBID_TAGS, p) : {}, ue = O(e, "FORBID_ATTR") ? a({}, e.FORBID_ATTR, p) : {}, v = O(e, "USE_PROFILES") ? e.USE_PROFILES : !1, xe = e.ALLOW_ARIA_ATTR !== !1, me = e.ALLOW_DATA_ATTR !== !1, Pe = e.ALLOW_UNKNOWN_PROTOCOLS || !1, ke = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, P = e.SAFE_FOR_TEMPLATES || !1, ve = e.SAFE_FOR_XML !== !1, C = e.WHOLE_DOCUMENT || !1, k = e.RETURN_DOM || !1, Z = e.RETURN_DOM_FRAGMENT || !1, J = e.RETURN_TRUSTED_TYPE || !1, de = e.FORCE_BODY || !1, Ue = e.SANITIZE_DOM !== !1, Fe = e.SANITIZE_NAMED_PROPS || !1, Te = e.KEEP_CONTENT !== !1, B = e.IN_PLACE || !1, Ce = e.ALLOWED_URI_REGEXP || pt, F = e.NAMESPACE || D, f = e.CUSTOM_ELEMENT_HANDLING || {}, e.CUSTOM_ELEMENT_HANDLING && Be(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (f.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && Be(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (f.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (f.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), P && (me = !1), Z && (k = !0), v && (u = a({}, st), m = [], v.html === !0 && (a(u, rt), a(m, lt)), v.svg === !0 && (a(u, Re), a(m, ye), a(m, oe)), v.svgFilters === !0 && (a(u, Le), a(m, ye), a(m, oe)), v.mathMl === !0 && (a(u, Oe), a(m, ct), a(m, oe))), e.ADD_TAGS && (u === Me && (u = w(u)), a(u, e.ADD_TAGS, p)), e.ADD_ATTR && (m === we && (m = w(m)), a(m, e.ADD_ATTR, p)), e.ADD_URI_SAFE_ATTR && a(Ee, e.ADD_URI_SAFE_ATTR, p), e.FORBID_CONTENTS && (U === He && (U = w(U)), a(U, e.FORBID_CONTENTS, p)), Te && (u["#text"] = !0), C && a(u, ["html", "head", "body"]), u.table && (a(u, ["tbody"]), delete G.tbody), e.TRUSTED_TYPES_POLICY) {
230
+ if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function")
231
+ throw $('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
232
+ if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function")
233
+ throw $('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
234
+ _ = e.TRUSTED_TYPES_POLICY, W = _.createHTML("");
235
+ } else
236
+ _ === void 0 && (_ = on(q, d)), _ !== null && typeof W == "string" && (W = _.createHTML(""));
237
+ g && g(e), H = e;
238
+ }
239
+ }, Ye = a({}, ["mi", "mo", "mn", "ms", "mtext"]), Xe = a({}, ["foreignobject", "desc", "title", "annotation-xml"]), kt = a({}, ["title", "style", "font", "a", "script"]), je = a({}, [...Re, ...Le, ...jt]), Ve = a({}, [...Oe, ...Vt]), vt = function(e) {
240
+ let t = re(e);
241
+ (!t || !t.tagName) && (t = {
242
+ namespaceURI: F,
243
+ tagName: "template"
244
+ });
245
+ const n = ie(e.tagName), c = ie(t.tagName);
246
+ return ge[e.namespaceURI] ? e.namespaceURI === ee ? t.namespaceURI === D ? n === "svg" : t.namespaceURI === Q ? n === "svg" && (c === "annotation-xml" || Ye[c]) : !!je[n] : e.namespaceURI === Q ? t.namespaceURI === D ? n === "math" : t.namespaceURI === ee ? n === "math" && Xe[c] : !!Ve[n] : e.namespaceURI === D ? t.namespaceURI === ee && !Xe[c] || t.namespaceURI === Q && !Ye[c] ? !1 : !Ve[n] && (kt[n] || !je[n]) : !!(Y === "application/xhtml+xml" && ge[e.namespaceURI]) : !1;
247
+ }, b = function(e) {
248
+ j(o.removed, {
249
+ element: e
250
+ });
251
+ try {
252
+ e.parentNode.removeChild(e);
253
+ } catch {
254
+ e.remove();
255
+ }
256
+ }, Ae = function(e, t) {
257
+ try {
258
+ j(o.removed, {
259
+ attribute: t.getAttributeNode(e),
260
+ from: t
261
+ });
262
+ } catch {
263
+ j(o.removed, {
264
+ attribute: null,
265
+ from: t
266
+ });
267
+ }
268
+ if (t.removeAttribute(e), e === "is" && !m[e])
269
+ if (k || Z)
270
+ try {
271
+ b(t);
272
+ } catch {
273
+ }
274
+ else
275
+ try {
276
+ t.setAttribute(e, "");
277
+ } catch {
278
+ }
279
+ }, $e = function(e) {
280
+ let t = null, n = null;
281
+ if (de)
282
+ e = "<remove></remove>" + e;
283
+ else {
284
+ const E = at(e, /^[\r\n\t ]+/);
285
+ n = E && E[0];
286
+ }
287
+ Y === "application/xhtml+xml" && F === D && (e = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + e + "</body></html>");
288
+ const c = _ ? _.createHTML(e) : e;
289
+ if (F === D)
290
+ try {
291
+ t = new gt().parseFromString(c, Y);
292
+ } catch {
293
+ }
294
+ if (!t || !t.documentElement) {
295
+ t = se.createDocument(F, "template", null);
296
+ try {
297
+ t.documentElement.innerHTML = _e ? W : c;
298
+ } catch {
299
+ }
300
+ }
301
+ const T = t.body || t.documentElement;
302
+ return e && n && T.insertBefore(l.createTextNode(n), T.childNodes[0] || null), F === D ? Ot.call(t, C ? "html" : "body")[0] : C ? t.documentElement : T;
303
+ }, qe = function(e) {
304
+ return Rt.call(
305
+ e.ownerDocument || e,
306
+ e,
307
+ // eslint-disable-next-line no-bitwise
308
+ z.SHOW_ELEMENT | z.SHOW_COMMENT | z.SHOW_TEXT | z.SHOW_PROCESSING_INSTRUCTION | z.SHOW_CDATA_SECTION,
309
+ null
310
+ );
311
+ }, Ut = function(e) {
312
+ return e instanceof _t && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof Et) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
313
+ }, Ke = function(e) {
314
+ return typeof ae == "function" && e instanceof ae;
315
+ }, I = function(e, t, n) {
316
+ y[e] && te(y[e], (c) => {
317
+ c.call(o, t, n, H);
318
+ });
319
+ }, Ze = function(e) {
320
+ let t = null;
321
+ if (I("beforeSanitizeElements", e, null), Ut(e))
322
+ return b(e), !0;
323
+ const n = p(e.nodeName);
324
+ if (I("uponSanitizeElement", e, {
325
+ tagName: n,
326
+ allowedTags: u
327
+ }), e.hasChildNodes() && !Ke(e.firstElementChild) && S(/<[/\w]/g, e.innerHTML) && S(/<[/\w]/g, e.textContent) || e.nodeType === 7 || ve && e.nodeType === 8 && S(/<[/\w]/g, e.data))
328
+ return b(e), !0;
329
+ if (!u[n] || G[n]) {
330
+ if (!G[n] && Qe(n) && (f.tagNameCheck instanceof RegExp && S(f.tagNameCheck, n) || f.tagNameCheck instanceof Function && f.tagNameCheck(n)))
331
+ return !1;
332
+ if (Te && !U[n]) {
333
+ const c = re(e) || e.parentNode, T = St(e) || e.childNodes;
334
+ if (T && c) {
335
+ const E = T.length;
336
+ for (let h = E - 1; h >= 0; --h)
337
+ c.insertBefore(ht(T[h], !0), At(e));
338
+ }
339
+ }
340
+ return b(e), !0;
341
+ }
342
+ return e instanceof be && !vt(e) || (n === "noscript" || n === "noembed" || n === "noframes") && S(/<\/no(script|embed|frames)/i, e.innerHTML) ? (b(e), !0) : (P && e.nodeType === 3 && (t = e.textContent, te([le, ce, fe], (c) => {
343
+ t = V(t, c, " ");
344
+ }), e.textContent !== t && (j(o.removed, {
345
+ element: e.cloneNode()
346
+ }), e.textContent = t)), I("afterSanitizeElements", e, null), !1);
347
+ }, Je = function(e, t, n) {
348
+ if (Ue && (t === "id" || t === "name") && (n in l || n in Pt))
349
+ return !1;
350
+ if (!(me && !ue[t] && S(Nt, t))) {
351
+ if (!(xe && S(Dt, t))) {
352
+ if (!m[t] || ue[t]) {
353
+ if (
354
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
355
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
356
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
357
+ !(Qe(e) && (f.tagNameCheck instanceof RegExp && S(f.tagNameCheck, e) || f.tagNameCheck instanceof Function && f.tagNameCheck(e)) && (f.attributeNameCheck instanceof RegExp && S(f.attributeNameCheck, t) || f.attributeNameCheck instanceof Function && f.attributeNameCheck(t)) || // Alternative, second condition checks if it's an `is`-attribute, AND
358
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
359
+ t === "is" && f.allowCustomizedBuiltInElements && (f.tagNameCheck instanceof RegExp && S(f.tagNameCheck, n) || f.tagNameCheck instanceof Function && f.tagNameCheck(n)))
360
+ )
361
+ return !1;
362
+ } else if (!Ee[t]) {
363
+ if (!S(Ce, V(n, Ie, ""))) {
364
+ if (!((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && Gt(n, "data:") === 0 && ze[e])) {
365
+ if (!(Pe && !S(bt, V(n, Ie, "")))) {
366
+ if (n)
367
+ return !1;
368
+ }
369
+ }
370
+ }
371
+ }
372
+ }
373
+ }
374
+ return !0;
375
+ }, Qe = function(e) {
376
+ return e !== "annotation-xml" && at(e, It);
377
+ }, et = function(e) {
378
+ I("beforeSanitizeAttributes", e, null);
379
+ const {
380
+ attributes: t
381
+ } = e;
382
+ if (!t)
383
+ return;
384
+ const n = {
385
+ attrName: "",
386
+ attrValue: "",
387
+ keepAttr: !0,
388
+ allowedAttributes: m
389
+ };
390
+ let c = t.length;
391
+ for (; c--; ) {
392
+ const T = t[c], {
393
+ name: E,
394
+ namespaceURI: h,
395
+ value: M
396
+ } = T, X = p(E);
397
+ let A = E === "value" ? M : Bt(M);
398
+ if (n.attrName = X, n.attrValue = A, n.keepAttr = !0, n.forceKeepAttr = void 0, I("uponSanitizeAttribute", e, n), A = n.attrValue, n.forceKeepAttr || (Ae(E, e), !n.keepAttr))
399
+ continue;
400
+ if (!ke && S(/\/>/i, A)) {
401
+ Ae(E, e);
402
+ continue;
403
+ }
404
+ P && te([le, ce, fe], (nt) => {
405
+ A = V(A, nt, " ");
406
+ });
407
+ const tt = p(e.nodeName);
408
+ if (Je(tt, X, A)) {
409
+ if (Fe && (X === "id" || X === "name") && (Ae(E, e), A = Ct + A), _ && typeof q == "object" && typeof q.getAttributeType == "function" && !h)
410
+ switch (q.getAttributeType(tt, X)) {
411
+ case "TrustedHTML": {
412
+ A = _.createHTML(A);
413
+ break;
414
+ }
415
+ case "TrustedScriptURL": {
416
+ A = _.createScriptURL(A);
417
+ break;
418
+ }
419
+ }
420
+ try {
421
+ h ? e.setAttributeNS(h, E, A) : e.setAttribute(E, A), it(o.removed);
422
+ } catch {
423
+ }
424
+ }
425
+ }
426
+ I("afterSanitizeAttributes", e, null);
427
+ }, Ft = function i(e) {
428
+ let t = null;
429
+ const n = qe(e);
430
+ for (I("beforeSanitizeShadowDOM", e, null); t = n.nextNode(); )
431
+ I("uponSanitizeShadowNode", t, null), !Ze(t) && (t.content instanceof N && i(t.content), et(t));
432
+ I("afterSanitizeShadowDOM", e, null);
433
+ };
434
+ return o.sanitize = function(i) {
435
+ let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = null, n = null, c = null, T = null;
436
+ if (_e = !i, _e && (i = "<!-->"), typeof i != "string" && !Ke(i))
437
+ if (typeof i.toString == "function") {
438
+ if (i = i.toString(), typeof i != "string")
439
+ throw $("dirty is not a string, aborting");
440
+ } else
441
+ throw $("toString is not a function");
442
+ if (!o.isSupported)
443
+ return i;
444
+ if (pe || he(e), o.removed = [], typeof i == "string" && (B = !1), B) {
445
+ if (i.nodeName) {
446
+ const M = p(i.nodeName);
447
+ if (!u[M] || G[M])
448
+ throw $("root node is forbidden and cannot be sanitized in-place");
449
+ }
450
+ } else if (i instanceof ae)
451
+ t = $e("<!---->"), n = t.ownerDocument.importNode(i, !0), n.nodeType === 1 && n.nodeName === "BODY" || n.nodeName === "HTML" ? t = n : t.appendChild(n);
452
+ else {
453
+ if (!k && !P && !C && // eslint-disable-next-line unicorn/prefer-includes
454
+ i.indexOf("<") === -1)
455
+ return _ && J ? _.createHTML(i) : i;
456
+ if (t = $e(i), !t)
457
+ return k ? null : J ? W : "";
458
+ }
459
+ t && de && b(t.firstChild);
460
+ const E = qe(B ? i : t);
461
+ for (; c = E.nextNode(); )
462
+ Ze(c) || (c.content instanceof N && Ft(c.content), et(c));
463
+ if (B)
464
+ return i;
465
+ if (k) {
466
+ if (Z)
467
+ for (T = Lt.call(t.ownerDocument); t.firstChild; )
468
+ T.appendChild(t.firstChild);
469
+ else
470
+ T = t;
471
+ return (m.shadowroot || m.shadowrootmode) && (T = yt.call(r, T, !0)), T;
472
+ }
473
+ let h = C ? t.outerHTML : t.innerHTML;
474
+ return C && u["!doctype"] && t.ownerDocument && t.ownerDocument.doctype && t.ownerDocument.doctype.name && S(dt, t.ownerDocument.doctype.name) && (h = "<!DOCTYPE " + t.ownerDocument.doctype.name + `>
475
+ ` + h), P && te([le, ce, fe], (M) => {
476
+ h = V(h, M, " ");
477
+ }), _ && J ? _.createHTML(h) : h;
478
+ }, o.setConfig = function() {
479
+ let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
480
+ he(i), pe = !0;
481
+ }, o.clearConfig = function() {
482
+ H = null, pe = !1;
483
+ }, o.isValidAttribute = function(i, e, t) {
484
+ H || he({});
485
+ const n = p(i), c = p(e);
486
+ return Je(n, c, t);
487
+ }, o.addHook = function(i, e) {
488
+ typeof e == "function" && (y[i] = y[i] || [], j(y[i], e));
489
+ }, o.removeHook = function(i) {
490
+ if (y[i])
491
+ return it(y[i]);
492
+ }, o.removeHooks = function(i) {
493
+ y[i] && (y[i] = []);
494
+ }, o.removeAllHooks = function() {
495
+ y = {};
496
+ }, o;
497
+ }
498
+ var an = Tt();
499
+ export {
500
+ an as default
501
+ };
502
+ //# sourceMappingURL=purify.es.mjs.map