wrec 0.18.7 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wrec.es.js +346 -332
- package/dist/wrec.js +30 -12
- package/dist/wrec.js.map +1 -1
- package/dist/wrec.min.js +1 -1
- package/dist/wrec.umd.js +5 -5
- package/package.json +1 -1
package/dist/wrec.es.js
CHANGED
|
@@ -8,10 +8,10 @@ const {
|
|
|
8
8
|
let {
|
|
9
9
|
freeze: L,
|
|
10
10
|
seal: I,
|
|
11
|
-
create:
|
|
11
|
+
create: qt
|
|
12
12
|
} = Object, {
|
|
13
|
-
apply:
|
|
14
|
-
construct:
|
|
13
|
+
apply: Kt,
|
|
14
|
+
construct: Zt
|
|
15
15
|
} = typeof Reflect < "u" && Reflect;
|
|
16
16
|
L || (L = function(t) {
|
|
17
17
|
return t;
|
|
@@ -19,41 +19,41 @@ L || (L = function(t) {
|
|
|
19
19
|
I || (I = function(t) {
|
|
20
20
|
return t;
|
|
21
21
|
});
|
|
22
|
-
|
|
23
|
-
for (var
|
|
22
|
+
Kt || (Kt = function(t, e) {
|
|
23
|
+
for (var n = arguments.length, i = new Array(n > 2 ? n - 2 : 0), r = 2; r < n; r++)
|
|
24
24
|
i[r - 2] = arguments[r];
|
|
25
25
|
return t.apply(e, i);
|
|
26
26
|
});
|
|
27
|
-
|
|
28
|
-
for (var e = arguments.length,
|
|
29
|
-
|
|
30
|
-
return new t(...
|
|
27
|
+
Zt || (Zt = function(t) {
|
|
28
|
+
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++)
|
|
29
|
+
n[i - 1] = arguments[i];
|
|
30
|
+
return new t(...n);
|
|
31
31
|
});
|
|
32
|
-
const Et = M(Array.prototype.forEach), hn = M(Array.prototype.lastIndexOf), Ce = M(Array.prototype.pop), nt = M(Array.prototype.push), dn = M(Array.prototype.splice), _t = M(String.prototype.toLowerCase),
|
|
32
|
+
const Et = M(Array.prototype.forEach), hn = M(Array.prototype.lastIndexOf), Ce = M(Array.prototype.pop), nt = M(Array.prototype.push), dn = M(Array.prototype.splice), _t = M(String.prototype.toLowerCase), Ht = M(String.prototype.toString), zt = M(String.prototype.match), ot = M(String.prototype.replace), Tn = M(String.prototype.indexOf), En = M(String.prototype.trim), P = M(Object.prototype.hasOwnProperty), O = M(RegExp.prototype.test), it = gn(TypeError);
|
|
33
33
|
function M(s) {
|
|
34
34
|
return function(t) {
|
|
35
35
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
36
|
-
for (var e = arguments.length,
|
|
37
|
-
|
|
38
|
-
return
|
|
36
|
+
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++)
|
|
37
|
+
n[i - 1] = arguments[i];
|
|
38
|
+
return Kt(s, t, n);
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
function gn(s) {
|
|
42
42
|
return function() {
|
|
43
|
-
for (var t = arguments.length, e = new Array(t),
|
|
44
|
-
e[
|
|
45
|
-
return
|
|
43
|
+
for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
|
|
44
|
+
e[n] = arguments[n];
|
|
45
|
+
return Zt(s, e);
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
function m(s, t) {
|
|
49
49
|
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : _t;
|
|
50
50
|
Re && Re(s, null);
|
|
51
|
-
let
|
|
52
|
-
for (;
|
|
53
|
-
let i = t[
|
|
51
|
+
let n = t.length;
|
|
52
|
+
for (; n--; ) {
|
|
53
|
+
let i = t[n];
|
|
54
54
|
if (typeof i == "string") {
|
|
55
55
|
const r = e(i);
|
|
56
|
-
r !== i && (un(t) || (t[
|
|
56
|
+
r !== i && (un(t) || (t[n] = r), i = r);
|
|
57
57
|
}
|
|
58
58
|
s[i] = !0;
|
|
59
59
|
}
|
|
@@ -65,19 +65,19 @@ function An(s) {
|
|
|
65
65
|
return s;
|
|
66
66
|
}
|
|
67
67
|
function k(s) {
|
|
68
|
-
const t =
|
|
69
|
-
for (const [e,
|
|
70
|
-
P(s, e) && (Array.isArray(
|
|
68
|
+
const t = qt(null);
|
|
69
|
+
for (const [e, n] of Pe(s))
|
|
70
|
+
P(s, e) && (Array.isArray(n) ? t[e] = An(n) : n && typeof n == "object" && n.constructor === Object ? t[e] = k(n) : t[e] = n);
|
|
71
71
|
return t;
|
|
72
72
|
}
|
|
73
73
|
function st(s, t) {
|
|
74
74
|
for (; s !== null; ) {
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
if (
|
|
78
|
-
return M(
|
|
79
|
-
if (typeof
|
|
80
|
-
return M(
|
|
75
|
+
const n = mn(s, t);
|
|
76
|
+
if (n) {
|
|
77
|
+
if (n.get)
|
|
78
|
+
return M(n.get);
|
|
79
|
+
if (typeof n.value == "function")
|
|
80
|
+
return M(n.value);
|
|
81
81
|
}
|
|
82
82
|
s = pn(s);
|
|
83
83
|
}
|
|
@@ -86,22 +86,22 @@ function st(s, t) {
|
|
|
86
86
|
}
|
|
87
87
|
return e;
|
|
88
88
|
}
|
|
89
|
-
const Ne = L(["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"]),
|
|
89
|
+
const Ne = L(["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"]), Gt = L(["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"]), $t = L(["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"]), _n = L(["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"]), Bt = L(["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"]), bn = L(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Oe = L(["#text"]), Le = L(["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"]), Wt = L(["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"]), Me = L(["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"]), gt = L(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Sn = I(/\{\{[\w\W]*|[\w\W]*\}\}/gm), yn = I(/<%[\w\W]*|[\w\W]*%>/gm), Rn = I(/\$\{[\w\W]*/gm), Cn = I(/^data-[\-\w.\u00B7-\uFFFF]+$/), Nn = I(/^aria-[\-\w]+$/), ve = I(
|
|
90
90
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
91
91
|
// eslint-disable-line no-useless-escape
|
|
92
92
|
), On = I(/^(?:\w+script|data):/i), Ln = I(
|
|
93
93
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
94
94
|
// eslint-disable-line no-control-regex
|
|
95
|
-
),
|
|
95
|
+
), xe = I(/^html$/i), Mn = I(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
96
96
|
var we = /* @__PURE__ */ Object.freeze({
|
|
97
97
|
__proto__: null,
|
|
98
98
|
ARIA_ATTR: Nn,
|
|
99
99
|
ATTR_WHITESPACE: Ln,
|
|
100
100
|
CUSTOM_ELEMENT: Mn,
|
|
101
101
|
DATA_ATTR: Cn,
|
|
102
|
-
DOCTYPE_NAME:
|
|
102
|
+
DOCTYPE_NAME: xe,
|
|
103
103
|
ERB_EXPR: yn,
|
|
104
|
-
IS_ALLOWED_URI:
|
|
104
|
+
IS_ALLOWED_URI: ve,
|
|
105
105
|
IS_SCRIPT_OR_DATA: On,
|
|
106
106
|
MUSTACHE_EXPR: Sn,
|
|
107
107
|
TMPLIT_EXPR: Rn
|
|
@@ -118,10 +118,10 @@ const rt = {
|
|
|
118
118
|
}, Dn = function(t, e) {
|
|
119
119
|
if (typeof t != "object" || typeof t.createPolicy != "function")
|
|
120
120
|
return null;
|
|
121
|
-
let
|
|
121
|
+
let n = null;
|
|
122
122
|
const i = "data-tt-policy-suffix";
|
|
123
|
-
e && e.hasAttribute(i) && (
|
|
124
|
-
const r = "dompurify" + (
|
|
123
|
+
e && e.hasAttribute(i) && (n = e.getAttribute(i));
|
|
124
|
+
const r = "dompurify" + (n ? "#" + n : "");
|
|
125
125
|
try {
|
|
126
126
|
return t.createPolicy(r, {
|
|
127
127
|
createHTML(c) {
|
|
@@ -155,14 +155,14 @@ function ke() {
|
|
|
155
155
|
let {
|
|
156
156
|
document: e
|
|
157
157
|
} = s;
|
|
158
|
-
const
|
|
158
|
+
const n = e, i = n.currentScript, {
|
|
159
159
|
DocumentFragment: r,
|
|
160
160
|
HTMLTemplateElement: c,
|
|
161
161
|
Node: h,
|
|
162
162
|
Element: u,
|
|
163
163
|
NodeFilter: p,
|
|
164
164
|
NamedNodeMap: d = s.NamedNodeMap || s.MozNamedAttrMap,
|
|
165
|
-
HTMLFormElement:
|
|
165
|
+
HTMLFormElement: b,
|
|
166
166
|
DOMParser: G,
|
|
167
167
|
trustedTypes: F
|
|
168
168
|
} = s, $ = u.prototype, We = st($, "cloneNode"), je = st($, "remove"), Ye = st($, "nextSibling"), Ve = st($, "childNodes"), lt = st($, "parentNode");
|
|
@@ -172,19 +172,19 @@ function ke() {
|
|
|
172
172
|
}
|
|
173
173
|
let C, J = "";
|
|
174
174
|
const {
|
|
175
|
-
implementation:
|
|
175
|
+
implementation: yt,
|
|
176
176
|
createNodeIterator: Xe,
|
|
177
177
|
createDocumentFragment: qe,
|
|
178
178
|
getElementsByTagName: Ke
|
|
179
179
|
} = e, {
|
|
180
180
|
importNode: Ze
|
|
181
|
-
} =
|
|
181
|
+
} = n;
|
|
182
182
|
let N = De();
|
|
183
|
-
t.isSupported = typeof Pe == "function" && typeof lt == "function" &&
|
|
183
|
+
t.isSupported = typeof Pe == "function" && typeof lt == "function" && yt && yt.createHTMLDocument !== void 0;
|
|
184
184
|
const {
|
|
185
|
-
MUSTACHE_EXPR:
|
|
186
|
-
ERB_EXPR:
|
|
187
|
-
TMPLIT_EXPR:
|
|
185
|
+
MUSTACHE_EXPR: Rt,
|
|
186
|
+
ERB_EXPR: Ct,
|
|
187
|
+
TMPLIT_EXPR: Nt,
|
|
188
188
|
DATA_ATTR: Je,
|
|
189
189
|
ARIA_ATTR: Qe,
|
|
190
190
|
IS_SCRIPT_OR_DATA: tn,
|
|
@@ -194,10 +194,10 @@ function ke() {
|
|
|
194
194
|
let {
|
|
195
195
|
IS_ALLOWED_URI: ee
|
|
196
196
|
} = we, _ = null;
|
|
197
|
-
const ne = m({}, [...Ne, ...
|
|
198
|
-
let
|
|
199
|
-
const oe = m({}, [...Le, ...
|
|
200
|
-
let E = Object.seal(
|
|
197
|
+
const ne = m({}, [...Ne, ...Gt, ...$t, ...Bt, ...Oe]);
|
|
198
|
+
let S = null;
|
|
199
|
+
const oe = m({}, [...Le, ...Wt, ...Me, ...gt]);
|
|
200
|
+
let E = Object.seal(qt(null, {
|
|
201
201
|
tagNameCheck: {
|
|
202
202
|
writable: !0,
|
|
203
203
|
configurable: !1,
|
|
@@ -216,8 +216,8 @@ function ke() {
|
|
|
216
216
|
enumerable: !0,
|
|
217
217
|
value: !1
|
|
218
218
|
}
|
|
219
|
-
})), Q = null,
|
|
220
|
-
const j = Object.seal(
|
|
219
|
+
})), Q = null, Ot = null;
|
|
220
|
+
const j = Object.seal(qt(null, {
|
|
221
221
|
tagCheck: {
|
|
222
222
|
writable: !0,
|
|
223
223
|
configurable: !1,
|
|
@@ -231,58 +231,58 @@ function ke() {
|
|
|
231
231
|
value: null
|
|
232
232
|
}
|
|
233
233
|
}));
|
|
234
|
-
let ie = !0,
|
|
234
|
+
let ie = !0, Lt = !0, se = !1, re = !0, Y = !1, ft = !0, B = !1, Mt = !1, wt = !1, V = !1, ut = !1, pt = !1, ae = !0, ce = !1;
|
|
235
235
|
const nn = "user-content-";
|
|
236
|
-
let
|
|
237
|
-
const
|
|
236
|
+
let Dt = !0, tt = !1, X = {}, v = null;
|
|
237
|
+
const It = m({}, ["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"]);
|
|
238
238
|
let le = null;
|
|
239
239
|
const fe = m({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
240
|
-
let
|
|
240
|
+
let Pt = null;
|
|
241
241
|
const ue = m({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), mt = "http://www.w3.org/1998/Math/MathML", ht = "http://www.w3.org/2000/svg", U = "http://www.w3.org/1999/xhtml";
|
|
242
|
-
let q = U,
|
|
243
|
-
const on = m({}, [mt, ht, U],
|
|
242
|
+
let q = U, vt = !1, xt = null;
|
|
243
|
+
const on = m({}, [mt, ht, U], Ht);
|
|
244
244
|
let dt = m({}, ["mi", "mo", "mn", "ms", "mtext"]), Tt = m({}, ["annotation-xml"]);
|
|
245
245
|
const sn = m({}, ["title", "style", "font", "a", "script"]);
|
|
246
246
|
let et = null;
|
|
247
247
|
const rn = ["application/xhtml+xml", "text/html"], an = "text/html";
|
|
248
248
|
let A = null, K = null;
|
|
249
|
-
const cn = e.createElement("form"), pe = function(
|
|
250
|
-
return
|
|
251
|
-
},
|
|
252
|
-
let
|
|
253
|
-
if (!(K && K ===
|
|
254
|
-
if ((!
|
|
255
|
-
rn.indexOf(
|
|
256
|
-
if (typeof
|
|
249
|
+
const cn = e.createElement("form"), pe = function(o) {
|
|
250
|
+
return o instanceof RegExp || o instanceof Function;
|
|
251
|
+
}, kt = function() {
|
|
252
|
+
let o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
253
|
+
if (!(K && K === o)) {
|
|
254
|
+
if ((!o || typeof o != "object") && (o = {}), o = k(o), et = // eslint-disable-next-line unicorn/prefer-includes
|
|
255
|
+
rn.indexOf(o.PARSER_MEDIA_TYPE) === -1 ? an : o.PARSER_MEDIA_TYPE, A = et === "application/xhtml+xml" ? Ht : _t, _ = P(o, "ALLOWED_TAGS") ? m({}, o.ALLOWED_TAGS, A) : ne, S = P(o, "ALLOWED_ATTR") ? m({}, o.ALLOWED_ATTR, A) : oe, xt = P(o, "ALLOWED_NAMESPACES") ? m({}, o.ALLOWED_NAMESPACES, Ht) : on, Pt = P(o, "ADD_URI_SAFE_ATTR") ? m(k(ue), o.ADD_URI_SAFE_ATTR, A) : ue, le = P(o, "ADD_DATA_URI_TAGS") ? m(k(fe), o.ADD_DATA_URI_TAGS, A) : fe, v = P(o, "FORBID_CONTENTS") ? m({}, o.FORBID_CONTENTS, A) : It, Q = P(o, "FORBID_TAGS") ? m({}, o.FORBID_TAGS, A) : k({}), Ot = P(o, "FORBID_ATTR") ? m({}, o.FORBID_ATTR, A) : k({}), X = P(o, "USE_PROFILES") ? o.USE_PROFILES : !1, ie = o.ALLOW_ARIA_ATTR !== !1, Lt = o.ALLOW_DATA_ATTR !== !1, se = o.ALLOW_UNKNOWN_PROTOCOLS || !1, re = o.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Y = o.SAFE_FOR_TEMPLATES || !1, ft = o.SAFE_FOR_XML !== !1, B = o.WHOLE_DOCUMENT || !1, V = o.RETURN_DOM || !1, ut = o.RETURN_DOM_FRAGMENT || !1, pt = o.RETURN_TRUSTED_TYPE || !1, wt = o.FORCE_BODY || !1, ae = o.SANITIZE_DOM !== !1, ce = o.SANITIZE_NAMED_PROPS || !1, Dt = o.KEEP_CONTENT !== !1, tt = o.IN_PLACE || !1, ee = o.ALLOWED_URI_REGEXP || ve, q = o.NAMESPACE || U, dt = o.MATHML_TEXT_INTEGRATION_POINTS || dt, Tt = o.HTML_INTEGRATION_POINTS || Tt, E = o.CUSTOM_ELEMENT_HANDLING || {}, o.CUSTOM_ELEMENT_HANDLING && pe(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (E.tagNameCheck = o.CUSTOM_ELEMENT_HANDLING.tagNameCheck), o.CUSTOM_ELEMENT_HANDLING && pe(o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (E.attributeNameCheck = o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), o.CUSTOM_ELEMENT_HANDLING && typeof o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (E.allowCustomizedBuiltInElements = o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), Y && (Lt = !1), ut && (V = !0), X && (_ = m({}, Oe), S = [], X.html === !0 && (m(_, Ne), m(S, Le)), X.svg === !0 && (m(_, Gt), m(S, Wt), m(S, gt)), X.svgFilters === !0 && (m(_, $t), m(S, Wt), m(S, gt)), X.mathMl === !0 && (m(_, Bt), m(S, Me), m(S, gt))), o.ADD_TAGS && (typeof o.ADD_TAGS == "function" ? j.tagCheck = o.ADD_TAGS : (_ === ne && (_ = k(_)), m(_, o.ADD_TAGS, A))), o.ADD_ATTR && (typeof o.ADD_ATTR == "function" ? j.attributeCheck = o.ADD_ATTR : (S === oe && (S = k(S)), m(S, o.ADD_ATTR, A))), o.ADD_URI_SAFE_ATTR && m(Pt, o.ADD_URI_SAFE_ATTR, A), o.FORBID_CONTENTS && (v === It && (v = k(v)), m(v, o.FORBID_CONTENTS, A)), o.ADD_FORBID_CONTENTS && (v === It && (v = k(v)), m(v, o.ADD_FORBID_CONTENTS, A)), Dt && (_["#text"] = !0), B && m(_, ["html", "head", "body"]), _.table && (m(_, ["tbody"]), delete Q.tbody), o.TRUSTED_TYPES_POLICY) {
|
|
256
|
+
if (typeof o.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
257
257
|
throw it('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
258
|
-
if (typeof
|
|
258
|
+
if (typeof o.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
259
259
|
throw it('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
260
|
-
C =
|
|
260
|
+
C = o.TRUSTED_TYPES_POLICY, J = C.createHTML("");
|
|
261
261
|
} else
|
|
262
262
|
C === void 0 && (C = Dn(F, i)), C !== null && typeof J == "string" && (J = C.createHTML(""));
|
|
263
|
-
L && L(
|
|
263
|
+
L && L(o), K = o;
|
|
264
264
|
}
|
|
265
|
-
}, me = m({}, [...
|
|
266
|
-
let a = lt(
|
|
265
|
+
}, me = m({}, [...Gt, ...$t, ..._n]), he = m({}, [...Bt, ...bn]), ln = function(o) {
|
|
266
|
+
let a = lt(o);
|
|
267
267
|
(!a || !a.tagName) && (a = {
|
|
268
268
|
namespaceURI: q,
|
|
269
269
|
tagName: "template"
|
|
270
270
|
});
|
|
271
|
-
const l = _t(
|
|
272
|
-
return xt[
|
|
273
|
-
},
|
|
271
|
+
const l = _t(o.tagName), T = _t(a.tagName);
|
|
272
|
+
return xt[o.namespaceURI] ? o.namespaceURI === ht ? a.namespaceURI === U ? l === "svg" : a.namespaceURI === mt ? l === "svg" && (T === "annotation-xml" || dt[T]) : !!me[l] : o.namespaceURI === mt ? a.namespaceURI === U ? l === "math" : a.namespaceURI === ht ? l === "math" && Tt[T] : !!he[l] : o.namespaceURI === U ? a.namespaceURI === ht && !Tt[T] || a.namespaceURI === mt && !dt[T] ? !1 : !he[l] && (sn[l] || !me[l]) : !!(et === "application/xhtml+xml" && xt[o.namespaceURI]) : !1;
|
|
273
|
+
}, x = function(o) {
|
|
274
274
|
nt(t.removed, {
|
|
275
|
-
element:
|
|
275
|
+
element: o
|
|
276
276
|
});
|
|
277
277
|
try {
|
|
278
|
-
lt(
|
|
278
|
+
lt(o).removeChild(o);
|
|
279
279
|
} catch {
|
|
280
|
-
je(
|
|
280
|
+
je(o);
|
|
281
281
|
}
|
|
282
|
-
}, W = function(
|
|
282
|
+
}, W = function(o, a) {
|
|
283
283
|
try {
|
|
284
284
|
nt(t.removed, {
|
|
285
|
-
attribute: a.getAttributeNode(
|
|
285
|
+
attribute: a.getAttributeNode(o),
|
|
286
286
|
from: a
|
|
287
287
|
});
|
|
288
288
|
} catch {
|
|
@@ -291,107 +291,107 @@ function ke() {
|
|
|
291
291
|
from: a
|
|
292
292
|
});
|
|
293
293
|
}
|
|
294
|
-
if (a.removeAttribute(
|
|
294
|
+
if (a.removeAttribute(o), o === "is")
|
|
295
295
|
if (V || ut)
|
|
296
296
|
try {
|
|
297
|
-
|
|
297
|
+
x(a);
|
|
298
298
|
} catch {
|
|
299
299
|
}
|
|
300
300
|
else
|
|
301
301
|
try {
|
|
302
|
-
a.setAttribute(
|
|
302
|
+
a.setAttribute(o, "");
|
|
303
303
|
} catch {
|
|
304
304
|
}
|
|
305
|
-
}, de = function(
|
|
305
|
+
}, de = function(o) {
|
|
306
306
|
let a = null, l = null;
|
|
307
|
-
if (
|
|
308
|
-
|
|
307
|
+
if (wt)
|
|
308
|
+
o = "<remove></remove>" + o;
|
|
309
309
|
else {
|
|
310
|
-
const g =
|
|
310
|
+
const g = zt(o, /^[\r\n\t ]+/);
|
|
311
311
|
l = g && g[0];
|
|
312
312
|
}
|
|
313
|
-
et === "application/xhtml+xml" && q === U && (
|
|
314
|
-
const T = C ? C.createHTML(
|
|
313
|
+
et === "application/xhtml+xml" && q === U && (o = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + o + "</body></html>");
|
|
314
|
+
const T = C ? C.createHTML(o) : o;
|
|
315
315
|
if (q === U)
|
|
316
316
|
try {
|
|
317
317
|
a = new G().parseFromString(T, et);
|
|
318
318
|
} catch {
|
|
319
319
|
}
|
|
320
320
|
if (!a || !a.documentElement) {
|
|
321
|
-
a =
|
|
321
|
+
a = yt.createDocument(q, "template", null);
|
|
322
322
|
try {
|
|
323
|
-
a.documentElement.innerHTML =
|
|
323
|
+
a.documentElement.innerHTML = vt ? J : T;
|
|
324
324
|
} catch {
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
const R = a.body || a.documentElement;
|
|
328
|
-
return
|
|
329
|
-
}, Te = function(
|
|
328
|
+
return o && l && R.insertBefore(e.createTextNode(l), R.childNodes[0] || null), q === U ? Ke.call(a, B ? "html" : "body")[0] : B ? a.documentElement : R;
|
|
329
|
+
}, Te = function(o) {
|
|
330
330
|
return Xe.call(
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
o.ownerDocument || o,
|
|
332
|
+
o,
|
|
333
333
|
// eslint-disable-next-line no-bitwise
|
|
334
334
|
p.SHOW_ELEMENT | p.SHOW_COMMENT | p.SHOW_TEXT | p.SHOW_PROCESSING_INSTRUCTION | p.SHOW_CDATA_SECTION,
|
|
335
335
|
null
|
|
336
336
|
);
|
|
337
|
-
},
|
|
338
|
-
return
|
|
339
|
-
}, Ee = function(
|
|
340
|
-
return typeof h == "function" &&
|
|
337
|
+
}, Ft = function(o) {
|
|
338
|
+
return o instanceof b && (typeof o.nodeName != "string" || typeof o.textContent != "string" || typeof o.removeChild != "function" || !(o.attributes instanceof d) || typeof o.removeAttribute != "function" || typeof o.setAttribute != "function" || typeof o.namespaceURI != "string" || typeof o.insertBefore != "function" || typeof o.hasChildNodes != "function");
|
|
339
|
+
}, Ee = function(o) {
|
|
340
|
+
return typeof h == "function" && o instanceof h;
|
|
341
341
|
};
|
|
342
|
-
function H(f,
|
|
342
|
+
function H(f, o, a) {
|
|
343
343
|
Et(f, (l) => {
|
|
344
|
-
l.call(t,
|
|
344
|
+
l.call(t, o, a, K);
|
|
345
345
|
});
|
|
346
346
|
}
|
|
347
|
-
const ge = function(
|
|
347
|
+
const ge = function(o) {
|
|
348
348
|
let a = null;
|
|
349
|
-
if (H(N.beforeSanitizeElements,
|
|
350
|
-
return
|
|
351
|
-
const l = A(
|
|
352
|
-
if (H(N.uponSanitizeElement,
|
|
349
|
+
if (H(N.beforeSanitizeElements, o, null), Ft(o))
|
|
350
|
+
return x(o), !0;
|
|
351
|
+
const l = A(o.nodeName);
|
|
352
|
+
if (H(N.uponSanitizeElement, o, {
|
|
353
353
|
tagName: l,
|
|
354
354
|
allowedTags: _
|
|
355
|
-
}), ft &&
|
|
356
|
-
return
|
|
355
|
+
}), ft && o.hasChildNodes() && !Ee(o.firstElementChild) && O(/<[/\w!]/g, o.innerHTML) && O(/<[/\w!]/g, o.textContent) || o.nodeType === rt.progressingInstruction || ft && o.nodeType === rt.comment && O(/<[/\w]/g, o.data))
|
|
356
|
+
return x(o), !0;
|
|
357
357
|
if (!(j.tagCheck instanceof Function && j.tagCheck(l)) && (!_[l] || Q[l])) {
|
|
358
358
|
if (!Q[l] && _e(l) && (E.tagNameCheck instanceof RegExp && O(E.tagNameCheck, l) || E.tagNameCheck instanceof Function && E.tagNameCheck(l)))
|
|
359
359
|
return !1;
|
|
360
|
-
if (
|
|
361
|
-
const T = lt(
|
|
360
|
+
if (Dt && !v[l]) {
|
|
361
|
+
const T = lt(o) || o.parentNode, R = Ve(o) || o.childNodes;
|
|
362
362
|
if (R && T) {
|
|
363
363
|
const g = R.length;
|
|
364
364
|
for (let w = g - 1; w >= 0; --w) {
|
|
365
365
|
const z = We(R[w], !0);
|
|
366
|
-
z.__removalCount = (
|
|
366
|
+
z.__removalCount = (o.__removalCount || 0) + 1, T.insertBefore(z, Ye(o));
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
return
|
|
370
|
+
return x(o), !0;
|
|
371
371
|
}
|
|
372
|
-
return
|
|
372
|
+
return o instanceof u && !ln(o) || (l === "noscript" || l === "noembed" || l === "noframes") && O(/<\/no(script|embed|frames)/i, o.innerHTML) ? (x(o), !0) : (Y && o.nodeType === rt.text && (a = o.textContent, Et([Rt, Ct, Nt], (T) => {
|
|
373
373
|
a = ot(a, T, " ");
|
|
374
|
-
}),
|
|
375
|
-
element:
|
|
376
|
-
}),
|
|
377
|
-
}, Ae = function(
|
|
374
|
+
}), o.textContent !== a && (nt(t.removed, {
|
|
375
|
+
element: o.cloneNode()
|
|
376
|
+
}), o.textContent = a)), H(N.afterSanitizeElements, o, null), !1);
|
|
377
|
+
}, Ae = function(o, a, l) {
|
|
378
378
|
if (ae && (a === "id" || a === "name") && (l in e || l in cn))
|
|
379
379
|
return !1;
|
|
380
|
-
if (!(
|
|
380
|
+
if (!(Lt && !Ot[a] && O(Je, a))) {
|
|
381
381
|
if (!(ie && O(Qe, a))) {
|
|
382
|
-
if (!(j.attributeCheck instanceof Function && j.attributeCheck(a,
|
|
383
|
-
if (!
|
|
382
|
+
if (!(j.attributeCheck instanceof Function && j.attributeCheck(a, o))) {
|
|
383
|
+
if (!S[a] || Ot[a]) {
|
|
384
384
|
if (
|
|
385
385
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
386
386
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
387
387
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
388
|
-
!(_e(
|
|
388
|
+
!(_e(o) && (E.tagNameCheck instanceof RegExp && O(E.tagNameCheck, o) || E.tagNameCheck instanceof Function && E.tagNameCheck(o)) && (E.attributeNameCheck instanceof RegExp && O(E.attributeNameCheck, a) || E.attributeNameCheck instanceof Function && E.attributeNameCheck(a, o)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
389
389
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
390
390
|
a === "is" && E.allowCustomizedBuiltInElements && (E.tagNameCheck instanceof RegExp && O(E.tagNameCheck, l) || E.tagNameCheck instanceof Function && E.tagNameCheck(l)))
|
|
391
391
|
) return !1;
|
|
392
|
-
} else if (!
|
|
392
|
+
} else if (!Pt[a]) {
|
|
393
393
|
if (!O(ee, ot(l, te, ""))) {
|
|
394
|
-
if (!((a === "src" || a === "xlink:href" || a === "href") &&
|
|
394
|
+
if (!((a === "src" || a === "xlink:href" || a === "href") && o !== "script" && Tn(l, "data:") === 0 && le[o])) {
|
|
395
395
|
if (!(se && !O(tn, ot(l, te, "")))) {
|
|
396
396
|
if (l)
|
|
397
397
|
return !1;
|
|
@@ -403,20 +403,20 @@ function ke() {
|
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
405
|
return !0;
|
|
406
|
-
}, _e = function(
|
|
407
|
-
return
|
|
408
|
-
}, be = function(
|
|
409
|
-
H(N.beforeSanitizeAttributes,
|
|
406
|
+
}, _e = function(o) {
|
|
407
|
+
return o !== "annotation-xml" && zt(o, en);
|
|
408
|
+
}, be = function(o) {
|
|
409
|
+
H(N.beforeSanitizeAttributes, o, null);
|
|
410
410
|
const {
|
|
411
411
|
attributes: a
|
|
412
|
-
} =
|
|
413
|
-
if (!a ||
|
|
412
|
+
} = o;
|
|
413
|
+
if (!a || Ft(o))
|
|
414
414
|
return;
|
|
415
415
|
const l = {
|
|
416
416
|
attrName: "",
|
|
417
417
|
attrValue: "",
|
|
418
418
|
keepAttr: !0,
|
|
419
|
-
allowedAttributes:
|
|
419
|
+
allowedAttributes: S,
|
|
420
420
|
forceKeepAttr: void 0
|
|
421
421
|
};
|
|
422
422
|
let T = a.length;
|
|
@@ -425,63 +425,63 @@ function ke() {
|
|
|
425
425
|
name: g,
|
|
426
426
|
namespaceURI: w,
|
|
427
427
|
value: z
|
|
428
|
-
} = R, Z = A(g),
|
|
429
|
-
let
|
|
430
|
-
if (l.attrName = Z, l.attrValue =
|
|
431
|
-
W(g,
|
|
428
|
+
} = R, Z = A(g), Ut = z;
|
|
429
|
+
let y = g === "value" ? Ut : En(Ut);
|
|
430
|
+
if (l.attrName = Z, l.attrValue = y, l.keepAttr = !0, l.forceKeepAttr = void 0, H(N.uponSanitizeAttribute, o, l), y = l.attrValue, ce && (Z === "id" || Z === "name") && (W(g, o), y = nn + y), ft && O(/((--!?|])>)|<\/(style|title|textarea)/i, y)) {
|
|
431
|
+
W(g, o);
|
|
432
432
|
continue;
|
|
433
433
|
}
|
|
434
|
-
if (Z === "attributename" &&
|
|
435
|
-
W(g,
|
|
434
|
+
if (Z === "attributename" && zt(y, "href")) {
|
|
435
|
+
W(g, o);
|
|
436
436
|
continue;
|
|
437
437
|
}
|
|
438
438
|
if (l.forceKeepAttr)
|
|
439
439
|
continue;
|
|
440
440
|
if (!l.keepAttr) {
|
|
441
|
-
W(g,
|
|
441
|
+
W(g, o);
|
|
442
442
|
continue;
|
|
443
443
|
}
|
|
444
|
-
if (!re && O(/\/>/i,
|
|
445
|
-
W(g,
|
|
444
|
+
if (!re && O(/\/>/i, y)) {
|
|
445
|
+
W(g, o);
|
|
446
446
|
continue;
|
|
447
447
|
}
|
|
448
|
-
Y && Et([
|
|
449
|
-
|
|
448
|
+
Y && Et([Rt, Ct, Nt], (ye) => {
|
|
449
|
+
y = ot(y, ye, " ");
|
|
450
450
|
});
|
|
451
|
-
const Se = A(
|
|
452
|
-
if (!Ae(Se, Z,
|
|
453
|
-
W(g,
|
|
451
|
+
const Se = A(o.nodeName);
|
|
452
|
+
if (!Ae(Se, Z, y)) {
|
|
453
|
+
W(g, o);
|
|
454
454
|
continue;
|
|
455
455
|
}
|
|
456
456
|
if (C && typeof F == "object" && typeof F.getAttributeType == "function" && !w)
|
|
457
457
|
switch (F.getAttributeType(Se, Z)) {
|
|
458
458
|
case "TrustedHTML": {
|
|
459
|
-
|
|
459
|
+
y = C.createHTML(y);
|
|
460
460
|
break;
|
|
461
461
|
}
|
|
462
462
|
case "TrustedScriptURL": {
|
|
463
|
-
|
|
463
|
+
y = C.createScriptURL(y);
|
|
464
464
|
break;
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
|
-
if (
|
|
467
|
+
if (y !== Ut)
|
|
468
468
|
try {
|
|
469
|
-
w ?
|
|
469
|
+
w ? o.setAttributeNS(w, g, y) : o.setAttribute(g, y), Ft(o) ? x(o) : Ce(t.removed);
|
|
470
470
|
} catch {
|
|
471
|
-
W(g,
|
|
471
|
+
W(g, o);
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
|
-
H(N.afterSanitizeAttributes,
|
|
475
|
-
}, fn = function f(
|
|
474
|
+
H(N.afterSanitizeAttributes, o, null);
|
|
475
|
+
}, fn = function f(o) {
|
|
476
476
|
let a = null;
|
|
477
|
-
const l = Te(
|
|
478
|
-
for (H(N.beforeSanitizeShadowDOM,
|
|
477
|
+
const l = Te(o);
|
|
478
|
+
for (H(N.beforeSanitizeShadowDOM, o, null); a = l.nextNode(); )
|
|
479
479
|
H(N.uponSanitizeShadowNode, a, null), ge(a), be(a), a.content instanceof r && f(a.content);
|
|
480
|
-
H(N.afterSanitizeShadowDOM,
|
|
480
|
+
H(N.afterSanitizeShadowDOM, o, null);
|
|
481
481
|
};
|
|
482
482
|
return t.sanitize = function(f) {
|
|
483
|
-
let
|
|
484
|
-
if (
|
|
483
|
+
let o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = null, l = null, T = null, R = null;
|
|
484
|
+
if (vt = !f, vt && (f = "<!-->"), typeof f != "string" && !Ee(f))
|
|
485
485
|
if (typeof f.toString == "function") {
|
|
486
486
|
if (f = f.toString(), typeof f != "string")
|
|
487
487
|
throw it("dirty is not a string, aborting");
|
|
@@ -489,7 +489,7 @@ function ke() {
|
|
|
489
489
|
throw it("toString is not a function");
|
|
490
490
|
if (!t.isSupported)
|
|
491
491
|
return f;
|
|
492
|
-
if (
|
|
492
|
+
if (Mt || kt(o), t.removed = [], typeof f == "string" && (tt = !1), tt) {
|
|
493
493
|
if (f.nodeName) {
|
|
494
494
|
const z = A(f.nodeName);
|
|
495
495
|
if (!_[z] || Q[z])
|
|
@@ -504,7 +504,7 @@ function ke() {
|
|
|
504
504
|
if (a = de(f), !a)
|
|
505
505
|
return V ? null : pt ? J : "";
|
|
506
506
|
}
|
|
507
|
-
a &&
|
|
507
|
+
a && wt && x(a.firstChild);
|
|
508
508
|
const g = Te(tt ? f : a);
|
|
509
509
|
for (; T = g.nextNode(); )
|
|
510
510
|
ge(T), be(T), T.content instanceof r && fn(T.content);
|
|
@@ -516,27 +516,27 @@ function ke() {
|
|
|
516
516
|
R.appendChild(a.firstChild);
|
|
517
517
|
else
|
|
518
518
|
R = a;
|
|
519
|
-
return (
|
|
519
|
+
return (S.shadowroot || S.shadowrootmode) && (R = Ze.call(n, R, !0)), R;
|
|
520
520
|
}
|
|
521
521
|
let w = B ? a.outerHTML : a.innerHTML;
|
|
522
|
-
return B && _["!doctype"] && a.ownerDocument && a.ownerDocument.doctype && a.ownerDocument.doctype.name && O(
|
|
523
|
-
` + w), Y && Et([
|
|
522
|
+
return B && _["!doctype"] && a.ownerDocument && a.ownerDocument.doctype && a.ownerDocument.doctype.name && O(xe, a.ownerDocument.doctype.name) && (w = "<!DOCTYPE " + a.ownerDocument.doctype.name + `>
|
|
523
|
+
` + w), Y && Et([Rt, Ct, Nt], (z) => {
|
|
524
524
|
w = ot(w, z, " ");
|
|
525
525
|
}), C && pt ? C.createHTML(w) : w;
|
|
526
526
|
}, t.setConfig = function() {
|
|
527
527
|
let f = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
528
|
-
|
|
528
|
+
kt(f), Mt = !0;
|
|
529
529
|
}, t.clearConfig = function() {
|
|
530
|
-
K = null,
|
|
531
|
-
}, t.isValidAttribute = function(f,
|
|
532
|
-
K ||
|
|
533
|
-
const l = A(f), T = A(
|
|
530
|
+
K = null, Mt = !1;
|
|
531
|
+
}, t.isValidAttribute = function(f, o, a) {
|
|
532
|
+
K || kt({});
|
|
533
|
+
const l = A(f), T = A(o);
|
|
534
534
|
return Ae(l, T, a);
|
|
535
|
-
}, t.addHook = function(f,
|
|
536
|
-
typeof
|
|
537
|
-
}, t.removeHook = function(f,
|
|
538
|
-
if (
|
|
539
|
-
const a = hn(N[f],
|
|
535
|
+
}, t.addHook = function(f, o) {
|
|
536
|
+
typeof o == "function" && nt(N[f], o);
|
|
537
|
+
}, t.removeHook = function(f, o) {
|
|
538
|
+
if (o !== void 0) {
|
|
539
|
+
const a = hn(N[f], o);
|
|
540
540
|
return a === -1 ? void 0 : dn(N[f], a, 1)[0];
|
|
541
541
|
}
|
|
542
542
|
return Ce(N[f]);
|
|
@@ -549,14 +549,14 @@ function ke() {
|
|
|
549
549
|
var Fe = ke();
|
|
550
550
|
function Ie(s, t) {
|
|
551
551
|
let e = s;
|
|
552
|
-
for (const
|
|
553
|
-
e = e[
|
|
552
|
+
for (const n of t.split("."))
|
|
553
|
+
e = e[n];
|
|
554
554
|
return e;
|
|
555
555
|
}
|
|
556
556
|
function In(s, t, e) {
|
|
557
|
-
const
|
|
557
|
+
const n = t.split("."), i = n.length - 1;
|
|
558
558
|
let r = s;
|
|
559
|
-
|
|
559
|
+
n.forEach((c, h) => {
|
|
560
560
|
h === i ? r[c] = e : r = r[c];
|
|
561
561
|
});
|
|
562
562
|
}
|
|
@@ -571,35 +571,35 @@ const Pn = /* @__PURE__ */ new Set([
|
|
|
571
571
|
"onsubmit"
|
|
572
572
|
]);
|
|
573
573
|
Fe.addHook("uponSanitizeAttribute", (s, t) => {
|
|
574
|
-
const { attrName: e } = t,
|
|
575
|
-
Pn.has(
|
|
574
|
+
const { attrName: e } = t, n = e.toLowerCase();
|
|
575
|
+
Pn.has(n) && (t.forceKeepAttr = !0);
|
|
576
576
|
});
|
|
577
577
|
class bt extends Error {
|
|
578
578
|
}
|
|
579
|
-
const
|
|
579
|
+
const vn = /([a-zA-Z-]+)\s*:\s*([^;}]+)/g, Ue = "a-zA-Z_$", xn = Ue + "0-9", ct = `[${Ue}][${xn}]*`, kn = /<!--\s*(.*?)\s*-->/, Fn = /<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g, jt = new RegExp(`^this\\.${ct}$`), Yt = new RegExp(`this\\.${ct}(\\.${ct})*`, "g"), He = new RegExp(`this\\.${ct}(\\.${ct})*`), Un = /* @__PURE__ */ new Set(["class", "style"]), ze = 5;
|
|
580
580
|
function Hn(s) {
|
|
581
581
|
return s instanceof HTMLButtonElement || s instanceof HTMLFieldSetElement || s instanceof HTMLInputElement || s instanceof HTMLSelectElement || s instanceof HTMLTextAreaElement || s instanceof D;
|
|
582
582
|
}
|
|
583
|
-
function
|
|
584
|
-
const
|
|
583
|
+
function Wn(s, t, e) {
|
|
584
|
+
const n = document.createElement(s);
|
|
585
585
|
if (t)
|
|
586
586
|
for (const [i, r] of Object.entries(t))
|
|
587
|
-
|
|
588
|
-
return e && (
|
|
587
|
+
n.setAttribute(i, r);
|
|
588
|
+
return e && (n.innerHTML = e), n;
|
|
589
589
|
}
|
|
590
590
|
const zn = (s) => s === String ? "" : s === Number ? 0 : s === Boolean ? !1 : s === Array ? [] : s === Object ? {} : void 0;
|
|
591
|
-
function
|
|
591
|
+
function St(s) {
|
|
592
592
|
const t = [];
|
|
593
593
|
let e = s.firstElementChild;
|
|
594
594
|
for (; e; )
|
|
595
|
-
t.push(e), e.shadowRoot && t.push(...
|
|
595
|
+
t.push(e), e.shadowRoot && t.push(...St(e.shadowRoot)), e.firstElementChild && t.push(...St(e)), e = e.nextElementSibling;
|
|
596
596
|
return t;
|
|
597
597
|
}
|
|
598
598
|
const At = (s) => s.substring(ze).split(".")[0];
|
|
599
599
|
function Ge(s, t) {
|
|
600
600
|
let e = s[0];
|
|
601
|
-
return t.forEach((
|
|
602
|
-
e +=
|
|
601
|
+
return t.forEach((n, i) => {
|
|
602
|
+
e += n + s[i + 1];
|
|
603
603
|
}), e;
|
|
604
604
|
}
|
|
605
605
|
function Jt(s) {
|
|
@@ -614,47 +614,56 @@ function Qt(s) {
|
|
|
614
614
|
return t === "input" || t === "select";
|
|
615
615
|
}
|
|
616
616
|
const Gn = (s) => s.replace(/<!--[\s\S]*?-->/g, "");
|
|
617
|
-
function $e(s, t, e,
|
|
618
|
-
return s.slice(0, t) +
|
|
617
|
+
function $e(s, t, e, n) {
|
|
618
|
+
return s.slice(0, t) + n + s.slice(t + e);
|
|
619
619
|
}
|
|
620
620
|
function $n(s) {
|
|
621
621
|
let t = s.trim(), e = null;
|
|
622
622
|
/^\s*<tr[\s>]/i.test(t) ? (t = `<table><tbody>${t}</tbody></table>`, e = "tbody") : /^\s*<(td|th)[\s>]/i.test(t) ? (t = `<table><tbody><tr>${t}</tr></tbody></table>`, e = "tr") : /^\s*<option[\s>]/i.test(t) ? (t = `<select>${t}</select>`, e = "select") : /^\s*<col[\s>]/i.test(t) && (t = `<table><colgroup>${t}</colgroup></table>`, e = "colgroup");
|
|
623
|
-
const
|
|
623
|
+
const n = Fe.sanitize(t, {
|
|
624
624
|
ADD_TAGS: ["#comment"],
|
|
625
625
|
ALLOW_UNKNOWN_PROTOCOLS: !0,
|
|
626
626
|
RETURN_DOM_FRAGMENT: !0
|
|
627
627
|
});
|
|
628
628
|
if (e) {
|
|
629
|
-
const i =
|
|
629
|
+
const i = n.querySelector(e);
|
|
630
630
|
if (i) return i.childNodes;
|
|
631
631
|
}
|
|
632
|
-
return
|
|
632
|
+
return n.childNodes;
|
|
633
633
|
}
|
|
634
|
-
function
|
|
634
|
+
function Vt(s) {
|
|
635
635
|
const t = Number(s);
|
|
636
636
|
if (isNaN(t)) throw new bt(`can't convert "${s}" to a number`);
|
|
637
637
|
return t;
|
|
638
638
|
}
|
|
639
639
|
function Be(s, t, e) {
|
|
640
|
-
const [
|
|
640
|
+
const [n, i] = t.split(":");
|
|
641
641
|
if (Jt(e))
|
|
642
642
|
if (typeof e == "boolean") {
|
|
643
|
-
e ? s.setAttribute(
|
|
644
|
-
const r = D.getPropName(
|
|
643
|
+
e ? s.setAttribute(n, n) : s.removeAttribute(n);
|
|
644
|
+
const r = D.getPropName(n);
|
|
645
645
|
s[r] = e;
|
|
646
646
|
} else {
|
|
647
647
|
const r = s.getAttribute(t), c = String(e);
|
|
648
|
-
r !== c && (s.setAttribute(
|
|
648
|
+
r !== c && (s.setAttribute(n, c), n === "value" && Qt(s) && (s.value = c));
|
|
649
649
|
}
|
|
650
650
|
else {
|
|
651
651
|
const r = D.getPropName(t);
|
|
652
652
|
s[r] = e;
|
|
653
653
|
}
|
|
654
654
|
}
|
|
655
|
-
function
|
|
656
|
-
const [
|
|
657
|
-
s instanceof CSSStyleRule ? s.style.setProperty(
|
|
655
|
+
function Xt(s, t, e) {
|
|
656
|
+
const [n, i] = t.split(":");
|
|
657
|
+
s instanceof CSSStyleRule ? s.style.setProperty(n, e) : (Be(s, n, e), n === "value" && Qt(s) && (s.value = e));
|
|
658
|
+
}
|
|
659
|
+
function Bn(s) {
|
|
660
|
+
const t = /* @__PURE__ */ new Set();
|
|
661
|
+
for (const n of St(s)) {
|
|
662
|
+
const { localName: i } = n;
|
|
663
|
+
i.includes("-") && t.add(i);
|
|
664
|
+
}
|
|
665
|
+
const e = [...t].map((n) => customElements.whenDefined(n));
|
|
666
|
+
return Promise.all(e);
|
|
658
667
|
}
|
|
659
668
|
class D extends HTMLElement {
|
|
660
669
|
// This is used to lookup the camelCase property name
|
|
@@ -717,78 +726,82 @@ class D extends HTMLElement {
|
|
|
717
726
|
const t = this.#t;
|
|
718
727
|
t.properties || (t.properties = {}), t.propToComputedMap || (t.propToComputedMap = /* @__PURE__ */ new Map()), t.propToExprsMap || (t.propToExprsMap = /* @__PURE__ */ new Map());
|
|
719
728
|
}
|
|
720
|
-
attributeChangedCallback(t, e,
|
|
729
|
+
attributeChangedCallback(t, e, n) {
|
|
721
730
|
t === "disabled" && this.#d();
|
|
722
731
|
const i = D.getPropName(t);
|
|
723
732
|
if (this.#s(i)) {
|
|
724
|
-
const r = this.#b(i, String(
|
|
733
|
+
const r = this.#b(i, String(n));
|
|
725
734
|
this[i] = r;
|
|
726
735
|
const c = this.#c[i];
|
|
727
|
-
c && this.setFormValue(c, String(r)), this.propertyChangedCallback(i, e,
|
|
736
|
+
c && this.setFormValue(c, String(r)), this.propertyChangedCallback(i, e, n);
|
|
728
737
|
}
|
|
729
738
|
}
|
|
730
|
-
#R() {
|
|
731
|
-
if (!this.shadowRoot) return;
|
|
739
|
+
async #R() {
|
|
732
740
|
const t = this.#t;
|
|
733
741
|
let { template: e } = t;
|
|
734
742
|
if (!e) {
|
|
735
743
|
e = t.template = document.createElement("template");
|
|
736
|
-
let
|
|
744
|
+
let n = `<style>
|
|
737
745
|
:host([hidden]) { display: none; }`;
|
|
738
|
-
t.css && (
|
|
746
|
+
t.css && (n += t.css), n += `</style>
|
|
739
747
|
`;
|
|
740
748
|
let i = t.html.trim();
|
|
741
|
-
i.startsWith("<") || (i = `<span><!--${i}--></span>`), e.innerHTML =
|
|
749
|
+
i.startsWith("<") || (i = `<span><!--${i}--></span>`), e.innerHTML = n + i;
|
|
742
750
|
}
|
|
743
|
-
this.shadowRoot.replaceChildren(e.content.cloneNode(!0));
|
|
751
|
+
await Bn(e), this.shadowRoot.replaceChildren(e.content.cloneNode(!0));
|
|
744
752
|
}
|
|
745
|
-
changed(t, e,
|
|
746
|
-
this[e] =
|
|
753
|
+
changed(t, e, n) {
|
|
754
|
+
this[e] = n;
|
|
747
755
|
}
|
|
748
756
|
connectedCallback() {
|
|
749
|
-
this.#
|
|
750
|
-
this
|
|
751
|
-
this
|
|
757
|
+
this.#x(), this.#N(), this.#R().then(() => {
|
|
758
|
+
this.hasAttribute("disabled") && this.#d(), requestAnimationFrame(() => {
|
|
759
|
+
this.#y(this.shadowRoot), this.#T(this.shadowRoot), this.#C();
|
|
752
760
|
});
|
|
753
761
|
});
|
|
754
762
|
}
|
|
755
763
|
#C() {
|
|
756
764
|
const t = this.#t, { properties: e } = t;
|
|
757
|
-
for (const [
|
|
758
|
-
i && (this[
|
|
765
|
+
for (const [n, { computed: i }] of Object.entries(e))
|
|
766
|
+
i && (this[n] = this.#o(i));
|
|
759
767
|
}
|
|
760
768
|
#N() {
|
|
761
|
-
const t = this.#t, { observedAttributes: e, properties:
|
|
762
|
-
for (const [i, r] of Object.entries(
|
|
769
|
+
const t = this.#t, { observedAttributes: e, properties: n } = t;
|
|
770
|
+
for (const [i, r] of Object.entries(n))
|
|
763
771
|
this.#O(i, r, e);
|
|
764
772
|
}
|
|
765
|
-
#O(t, e,
|
|
773
|
+
#O(t, e, n) {
|
|
766
774
|
const i = D.getAttrName(t), r = this.hasAttribute(i);
|
|
767
775
|
e.required && !r && this.#e(this, t, "is a required attribute");
|
|
768
776
|
let c = e.value;
|
|
769
777
|
this.hasOwnProperty(t) && (c = this[t], delete this[t]);
|
|
770
|
-
const { type: h } = e, u = h === Boolean ? c || r :
|
|
778
|
+
const { type: h } = e, u = h === Boolean ? c || r : n.includes(i) && r ? this.#_(t, i) : c || zn(h), p = "#" + t;
|
|
771
779
|
this[p] = u, e.computed && this.#D(t, e), Object.defineProperty(this, t, {
|
|
772
780
|
enumerable: !0,
|
|
773
781
|
get() {
|
|
774
782
|
return this[p];
|
|
775
783
|
},
|
|
776
784
|
set(d) {
|
|
777
|
-
h === Number && typeof d == "string" && (d =
|
|
778
|
-
const
|
|
779
|
-
if (d ===
|
|
785
|
+
h === Number && typeof d == "string" && (d = Vt(d));
|
|
786
|
+
const b = this[p];
|
|
787
|
+
if (d === b) return;
|
|
780
788
|
this.#F(t, h, d), this[p] = d;
|
|
781
789
|
const { state: G, stateProp: F } = this.#t.properties[t];
|
|
782
|
-
F && In(G, F, d), this.#P(t), this.#I(t, h, d, i), this.#A(t), this.#
|
|
790
|
+
F && In(G, F, d), this.#P(t), this.#I(t, h, d, i), this.#A(t), this.#v(t, d);
|
|
783
791
|
const $ = this.#c[t];
|
|
784
|
-
$ && this.setFormValue($, String(d)), this.propertyChangedCallback(t,
|
|
792
|
+
$ && this.setFormValue($, String(d)), this.propertyChangedCallback(t, b, d), e.dispatch && this.dispatch("change", {
|
|
793
|
+
tagName: this.localName,
|
|
794
|
+
property: t,
|
|
795
|
+
oldValue: b,
|
|
796
|
+
value: d
|
|
797
|
+
});
|
|
785
798
|
}
|
|
786
799
|
});
|
|
787
800
|
}
|
|
788
801
|
#d() {
|
|
789
|
-
const t = this.hasAttribute("disabled"), e =
|
|
790
|
-
for (const
|
|
791
|
-
Hn(
|
|
802
|
+
const t = this.hasAttribute("disabled"), e = St(this.shadowRoot);
|
|
803
|
+
for (const n of e)
|
|
804
|
+
Hn(n) && (n.disabled = t);
|
|
792
805
|
}
|
|
793
806
|
disconnectedCallback() {
|
|
794
807
|
this.#n.clear(), this.#l.clear(), this.#u.clear();
|
|
@@ -814,18 +827,18 @@ class D extends HTMLElement {
|
|
|
814
827
|
}
|
|
815
828
|
#L(t) {
|
|
816
829
|
const e = t instanceof D;
|
|
817
|
-
for (const
|
|
818
|
-
const i = t.getAttribute(
|
|
830
|
+
for (const n of t.getAttributeNames()) {
|
|
831
|
+
const i = t.getAttribute(n), r = this.#g(t, i);
|
|
819
832
|
if (r) {
|
|
820
833
|
const c = this[r];
|
|
821
|
-
c === void 0 && this.#a(t,
|
|
822
|
-
let [h, u] =
|
|
823
|
-
h === "value" && (u ? (t["on" + u] === void 0 && this.#e(t,
|
|
834
|
+
c === void 0 && this.#a(t, n, r), t[r] = c;
|
|
835
|
+
let [h, u] = n.split(":");
|
|
836
|
+
h === "value" && (u ? (t["on" + u] === void 0 && this.#e(t, n, "refers to an unsupported event name"), t.setAttribute(h, this[r])) : u = "change"), e && t.#u.set(
|
|
824
837
|
D.getPropName(h),
|
|
825
838
|
r
|
|
826
839
|
);
|
|
827
840
|
}
|
|
828
|
-
this.#r(i, t,
|
|
841
|
+
this.#r(i, t, n);
|
|
829
842
|
}
|
|
830
843
|
}
|
|
831
844
|
#o(t) {
|
|
@@ -835,7 +848,7 @@ class D extends HTMLElement {
|
|
|
835
848
|
#M(t) {
|
|
836
849
|
const { localName: e } = t;
|
|
837
850
|
if (e === "style") {
|
|
838
|
-
const { sheet:
|
|
851
|
+
const { sheet: n } = t, i = n?.cssRules ?? [], r = Array.from(i);
|
|
839
852
|
for (const c of r)
|
|
840
853
|
if (c.constructor === CSSStyleRule) {
|
|
841
854
|
const h = Array.from(c.style);
|
|
@@ -846,20 +859,20 @@ class D extends HTMLElement {
|
|
|
846
859
|
}
|
|
847
860
|
}
|
|
848
861
|
} else {
|
|
849
|
-
let
|
|
862
|
+
let n = "";
|
|
850
863
|
if (at(t)) {
|
|
851
864
|
this.#r(t.textContent, t);
|
|
852
865
|
const i = t.textContent?.match(kn);
|
|
853
|
-
i && (
|
|
866
|
+
i && (n = i[1]);
|
|
854
867
|
} else {
|
|
855
868
|
const i = Array.from(t.childNodes).find(
|
|
856
869
|
(r) => r.nodeType === Node.COMMENT_NODE
|
|
857
870
|
);
|
|
858
|
-
i && (
|
|
871
|
+
i && (n = i.textContent?.trim() ?? "");
|
|
859
872
|
}
|
|
860
|
-
if (
|
|
861
|
-
const i = this.#g(t,
|
|
862
|
-
i && at(t) ? t.textContent = this[i] : this.#r(
|
|
873
|
+
if (n) {
|
|
874
|
+
const i = this.#g(t, n);
|
|
875
|
+
i && at(t) ? t.textContent = this[i] : this.#r(n, t);
|
|
863
876
|
}
|
|
864
877
|
}
|
|
865
878
|
}
|
|
@@ -879,8 +892,8 @@ class D extends HTMLElement {
|
|
|
879
892
|
else
|
|
880
893
|
return;
|
|
881
894
|
}
|
|
882
|
-
const e = {},
|
|
883
|
-
for (const c of
|
|
895
|
+
const e = {}, n = t.split(",");
|
|
896
|
+
for (const c of n) {
|
|
884
897
|
const [h, u] = c.split(":");
|
|
885
898
|
e[h.trim()] = u.trim();
|
|
886
899
|
}
|
|
@@ -892,8 +905,8 @@ class D extends HTMLElement {
|
|
|
892
905
|
formResetCallback() {
|
|
893
906
|
const t = this.#l;
|
|
894
907
|
for (const e of Object.keys(t)) {
|
|
895
|
-
let
|
|
896
|
-
|
|
908
|
+
let n = t[e];
|
|
909
|
+
jt.test(n) && (n = this.#o(n)), this[e] = n;
|
|
897
910
|
}
|
|
898
911
|
}
|
|
899
912
|
static getAttrName(t) {
|
|
@@ -902,22 +915,22 @@ class D extends HTMLElement {
|
|
|
902
915
|
}
|
|
903
916
|
static getPropName(t) {
|
|
904
917
|
let e = D.#m.get(t);
|
|
905
|
-
return e || (e = t.replace(/-([a-z])/g, (
|
|
918
|
+
return e || (e = t.replace(/-([a-z])/g, (n, i) => i.toUpperCase()), D.#m.set(t, e)), e;
|
|
906
919
|
}
|
|
907
|
-
#w(t, e,
|
|
908
|
-
if (
|
|
909
|
-
const [i] =
|
|
910
|
-
if (!
|
|
920
|
+
#w(t, e, n) {
|
|
921
|
+
if (n.length !== 1) return;
|
|
922
|
+
const [i] = n;
|
|
923
|
+
if (!jt.test(i)) return;
|
|
911
924
|
const r = Qt(t) || at(t);
|
|
912
925
|
let [c, h] = (e ?? "").split(":");
|
|
913
926
|
if (!(r && c === "value" || at(t))) return;
|
|
914
927
|
h ? t["on" + h] === void 0 && this.#e(t, e, "refers to an unsupported event name") : h = "change";
|
|
915
928
|
const p = At(i);
|
|
916
929
|
t.addEventListener(h, (d) => {
|
|
917
|
-
const { target:
|
|
918
|
-
if (!
|
|
919
|
-
const G =
|
|
920
|
-
this[p] = F === Number ?
|
|
930
|
+
const { target: b } = d;
|
|
931
|
+
if (!b) return;
|
|
932
|
+
const G = b.value, { type: F } = this.#t.properties[p];
|
|
933
|
+
this[p] = F === Number ? Vt(G) : G, this.#A(p);
|
|
921
934
|
});
|
|
922
935
|
}
|
|
923
936
|
#s(t) {
|
|
@@ -925,8 +938,8 @@ class D extends HTMLElement {
|
|
|
925
938
|
}
|
|
926
939
|
#T(t) {
|
|
927
940
|
const e = Array.from(t.querySelectorAll("*"));
|
|
928
|
-
for (const
|
|
929
|
-
this.#L(
|
|
941
|
+
for (const n of e)
|
|
942
|
+
this.#L(n), n.firstElementChild || this.#M(n);
|
|
930
943
|
}
|
|
931
944
|
// formAssociated is only needed when the component is inside a form.
|
|
932
945
|
#E() {
|
|
@@ -941,12 +954,12 @@ class D extends HTMLElement {
|
|
|
941
954
|
return t.includes("disabled") || t.push("disabled"), t;
|
|
942
955
|
}
|
|
943
956
|
// Subclasses can override this to add functionality.
|
|
944
|
-
propertyChangedCallback(t, e,
|
|
957
|
+
propertyChangedCallback(t, e, n) {
|
|
945
958
|
}
|
|
946
959
|
#g(t, e) {
|
|
947
|
-
if (!e || !
|
|
948
|
-
const
|
|
949
|
-
return this[
|
|
960
|
+
if (!e || !jt.test(e)) return;
|
|
961
|
+
const n = At(e);
|
|
962
|
+
return this[n] === void 0 && this.#a(t, "", n), n;
|
|
950
963
|
}
|
|
951
964
|
#A(t) {
|
|
952
965
|
const i = this.#t.propToExprsMap.get(t) || [];
|
|
@@ -958,7 +971,7 @@ class D extends HTMLElement {
|
|
|
958
971
|
this.#S(u, c);
|
|
959
972
|
else if (!(u instanceof CSSStyleRule)) {
|
|
960
973
|
const { element: p, attrName: d } = u;
|
|
961
|
-
p instanceof CSSStyleRule ? p.style.setProperty(d, c) :
|
|
974
|
+
p instanceof CSSStyleRule ? p.style.setProperty(d, c) : Xt(p, d, c);
|
|
962
975
|
}
|
|
963
976
|
}
|
|
964
977
|
}
|
|
@@ -967,28 +980,28 @@ class D extends HTMLElement {
|
|
|
967
980
|
customElements.get(t) || customElements.define(t, this);
|
|
968
981
|
}
|
|
969
982
|
#D(t, e) {
|
|
970
|
-
const { computed:
|
|
983
|
+
const { computed: n, uses: i } = e, r = this.#t.propToComputedMap;
|
|
971
984
|
function c(u, p) {
|
|
972
985
|
let d = r.get(u);
|
|
973
986
|
d || (d = [], r.set(u, d)), d.push([t, p]);
|
|
974
987
|
}
|
|
975
|
-
const h =
|
|
988
|
+
const h = n.match(Yt) || [];
|
|
976
989
|
for (const u of h) {
|
|
977
990
|
const p = u.substring(ze);
|
|
978
|
-
this[p] === void 0 && this.#a(null, t, p), typeof this[p] != "function" && c(p,
|
|
991
|
+
this[p] === void 0 && this.#a(null, t, p), typeof this[p] != "function" && c(p, n);
|
|
979
992
|
}
|
|
980
993
|
if (i)
|
|
981
994
|
for (const u of i.split(","))
|
|
982
|
-
c(u,
|
|
995
|
+
c(u, n);
|
|
983
996
|
}
|
|
984
997
|
// WARNING: Do not place untrusted JavaScript expressions
|
|
985
998
|
// in attribute values or the text content of elements!
|
|
986
|
-
#r(t, e,
|
|
999
|
+
#r(t, e, n = void 0) {
|
|
987
1000
|
if (!t) return;
|
|
988
|
-
const i = this.#p(e,
|
|
1001
|
+
const i = this.#p(e, n, t);
|
|
989
1002
|
if (!i) {
|
|
990
1003
|
const u = t.replaceAll("this..", "this.");
|
|
991
|
-
|
|
1004
|
+
n ? Xt(e, n, u) : "textContent" in e && (e.textContent = u);
|
|
992
1005
|
return;
|
|
993
1006
|
}
|
|
994
1007
|
const r = this.#t;
|
|
@@ -996,21 +1009,21 @@ class D extends HTMLElement {
|
|
|
996
1009
|
const p = At(u);
|
|
997
1010
|
if (typeof this[p] == "function") return;
|
|
998
1011
|
const d = r.propToExprsMap;
|
|
999
|
-
let
|
|
1000
|
-
|
|
1012
|
+
let b = d.get(p);
|
|
1013
|
+
b || (b = [], d.set(p, b)), b.includes(t) || b.push(t);
|
|
1001
1014
|
});
|
|
1002
1015
|
for (const [u, p] of this.#n.entries())
|
|
1003
1016
|
for (const d of p) {
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1017
|
+
const b = d instanceof HTMLElement || d instanceof CSSStyleRule ? d : d.element;
|
|
1018
|
+
b instanceof CSSStyleRule || b.isConnected || this.#n.set(
|
|
1006
1019
|
u,
|
|
1007
1020
|
p.filter((G) => G !== d)
|
|
1008
1021
|
);
|
|
1009
1022
|
}
|
|
1010
1023
|
let c = this.#n.get(t);
|
|
1011
|
-
c || (c = [], this.#n.set(t, c)), c.push(
|
|
1024
|
+
c || (c = [], this.#n.set(t, c)), c.push(n ? { element: e, attrName: n } : e), e instanceof HTMLElement && this.#w(e, n, i);
|
|
1012
1025
|
const h = this.#o(t);
|
|
1013
|
-
|
|
1026
|
+
n ? Xt(e, n, h) : this.#S(e, h);
|
|
1014
1027
|
}
|
|
1015
1028
|
// This follows the best practice
|
|
1016
1029
|
// "Do not override author-set, global attributes."
|
|
@@ -1020,23 +1033,23 @@ class D extends HTMLElement {
|
|
|
1020
1033
|
setFormValue(t, e) {
|
|
1021
1034
|
!this.#i || !Jt(e) || (this.#i.set(t, e), this.#f?.setFormValue(this.#i));
|
|
1022
1035
|
}
|
|
1023
|
-
#e(t, e,
|
|
1036
|
+
#e(t, e, n) {
|
|
1024
1037
|
const i = this.#t, r = t instanceof HTMLElement ? t.localName : "CSS rule";
|
|
1025
1038
|
throw new bt(
|
|
1026
|
-
`component ${i.elementName()}` + (t ? `, element "${r}"` : "") + (e ? `, attribute "${e}"` : "") + ` ${
|
|
1039
|
+
`component ${i.elementName()}` + (t ? `, element "${r}"` : "") + (e ? `, attribute "${e}"` : "") + ` ${n}`
|
|
1027
1040
|
);
|
|
1028
1041
|
}
|
|
1029
|
-
#a(t, e,
|
|
1030
|
-
this.#e(t, e, `refers to missing property "${
|
|
1042
|
+
#a(t, e, n) {
|
|
1043
|
+
this.#e(t, e, `refers to missing property "${n}"`);
|
|
1031
1044
|
}
|
|
1032
1045
|
#_(t, e) {
|
|
1033
1046
|
return this.#b(t, this.getAttribute(e));
|
|
1034
1047
|
}
|
|
1035
1048
|
#b(t, e) {
|
|
1036
|
-
if (e?.match(
|
|
1037
|
-
const
|
|
1049
|
+
if (e?.match(Yt)) return e;
|
|
1050
|
+
const n = this.#t, { type: i } = n.properties[t];
|
|
1038
1051
|
if (i || this.#e(null, t, "does not specify its type"), i === String) return e;
|
|
1039
|
-
if (i === Number) return
|
|
1052
|
+
if (i === Number) return Vt(e);
|
|
1040
1053
|
if (i === Boolean)
|
|
1041
1054
|
return e === "true" ? !0 : e === "false" || e === "null" ? !1 : (e && e !== t && this.#e(
|
|
1042
1055
|
null,
|
|
@@ -1046,44 +1059,44 @@ class D extends HTMLElement {
|
|
|
1046
1059
|
}
|
|
1047
1060
|
// Updates the matching attribute for a property if there is one.
|
|
1048
1061
|
// VS Code thinks this is never called, but it is called by #defineProp.
|
|
1049
|
-
#I(t, e,
|
|
1050
|
-
if (Jt(
|
|
1062
|
+
#I(t, e, n, i) {
|
|
1063
|
+
if (Jt(n) && this.hasAttribute(i)) {
|
|
1051
1064
|
const r = e === Boolean ? this.hasAttribute(i) : this.#_(t, i);
|
|
1052
|
-
|
|
1065
|
+
n !== r && Be(this, t, n);
|
|
1053
1066
|
}
|
|
1054
1067
|
}
|
|
1055
1068
|
// Updates all computed properties that reference this property.
|
|
1056
1069
|
// VS Code thinks this is never called, but it is called by #defineProp.
|
|
1057
1070
|
#P(t) {
|
|
1058
|
-
const
|
|
1059
|
-
for (const [i, r] of
|
|
1071
|
+
const n = this.#t.propToComputedMap.get(t) || [];
|
|
1072
|
+
for (const [i, r] of n)
|
|
1060
1073
|
this[i] = this.#o(r);
|
|
1061
1074
|
}
|
|
1062
1075
|
#S(t, e) {
|
|
1063
1076
|
if (e === void 0) return;
|
|
1064
|
-
const
|
|
1077
|
+
const n = t instanceof HTMLElement, i = typeof e;
|
|
1065
1078
|
if (i !== "string" && i !== "number" && this.#e(
|
|
1066
1079
|
t,
|
|
1067
1080
|
void 0,
|
|
1068
1081
|
" computed content is not a string or number"
|
|
1069
1082
|
), t instanceof HTMLElement && at(t))
|
|
1070
1083
|
t.value = e;
|
|
1071
|
-
else if (
|
|
1084
|
+
else if (n && i === "string" && e.trim().startsWith("<")) {
|
|
1072
1085
|
const r = $n(e);
|
|
1073
1086
|
t.replaceChildren(...r), this.#y(t), this.#T(t);
|
|
1074
|
-
} else
|
|
1087
|
+
} else n && (t.textContent = e);
|
|
1075
1088
|
}
|
|
1076
1089
|
// Update corresponding parent web component property if bound to one.
|
|
1077
1090
|
// VS Code thinks this is never called, but it is called by #defineProp.
|
|
1078
|
-
#
|
|
1079
|
-
const
|
|
1080
|
-
if (!
|
|
1091
|
+
#v(t, e) {
|
|
1092
|
+
const n = this.#u.get(t);
|
|
1093
|
+
if (!n) return;
|
|
1081
1094
|
const i = this.getRootNode();
|
|
1082
1095
|
if (!(i instanceof ShadowRoot)) return;
|
|
1083
1096
|
const { host: r } = i;
|
|
1084
1097
|
if (!r) return;
|
|
1085
1098
|
const c = r;
|
|
1086
|
-
c[
|
|
1099
|
+
c[n] = e;
|
|
1087
1100
|
}
|
|
1088
1101
|
/**
|
|
1089
1102
|
* @param state - WrecState object
|
|
@@ -1093,44 +1106,44 @@ class D extends HTMLElement {
|
|
|
1093
1106
|
useState(t, e) {
|
|
1094
1107
|
if (!e) {
|
|
1095
1108
|
e = {};
|
|
1096
|
-
for (const
|
|
1097
|
-
e[
|
|
1109
|
+
for (const n of Object.keys(t))
|
|
1110
|
+
e[n] = n;
|
|
1098
1111
|
}
|
|
1099
1112
|
this.#k(t, e);
|
|
1100
|
-
for (const [
|
|
1113
|
+
for (const [n, i] of Object.entries(e))
|
|
1101
1114
|
if (this.#s(i)) {
|
|
1102
|
-
const r = Ie(t,
|
|
1115
|
+
const r = Ie(t, n);
|
|
1103
1116
|
r !== void 0 && (this[i] = r);
|
|
1104
1117
|
const c = this.#t.properties[i];
|
|
1105
|
-
c.state = t, c.stateProp =
|
|
1118
|
+
c.state = t, c.stateProp = n;
|
|
1106
1119
|
}
|
|
1107
1120
|
t.addListener(this, e);
|
|
1108
1121
|
}
|
|
1109
|
-
#
|
|
1122
|
+
#x() {
|
|
1110
1123
|
const t = this.#t, e = new Set(Object.keys(t.properties));
|
|
1111
|
-
for (const
|
|
1112
|
-
Un.has(
|
|
1124
|
+
for (const n of e)
|
|
1125
|
+
Un.has(n) && this.#e(
|
|
1113
1126
|
null,
|
|
1114
1127
|
"",
|
|
1115
|
-
`property "${
|
|
1128
|
+
`property "${n}" is not allowed because it is a reserved attribute`
|
|
1116
1129
|
);
|
|
1117
|
-
for (const
|
|
1118
|
-
if (
|
|
1119
|
-
if (
|
|
1130
|
+
for (const n of this.getAttributeNames())
|
|
1131
|
+
if (n !== "class" && n !== "id" && n !== "disabled" && !n.startsWith("on")) {
|
|
1132
|
+
if (n === "form-assoc") {
|
|
1120
1133
|
this.#E();
|
|
1121
1134
|
continue;
|
|
1122
1135
|
}
|
|
1123
|
-
if (!e.has(D.getPropName(
|
|
1124
|
-
if (
|
|
1136
|
+
if (!e.has(D.getPropName(n))) {
|
|
1137
|
+
if (n === "name") {
|
|
1125
1138
|
this.#E();
|
|
1126
1139
|
continue;
|
|
1127
1140
|
}
|
|
1128
|
-
this.#e(null,
|
|
1141
|
+
this.#e(null, n, "is not a supported attribute");
|
|
1129
1142
|
}
|
|
1130
1143
|
}
|
|
1131
1144
|
}
|
|
1132
|
-
#p(t, e,
|
|
1133
|
-
const i =
|
|
1145
|
+
#p(t, e, n) {
|
|
1146
|
+
const i = n.match(Yt);
|
|
1134
1147
|
if (i)
|
|
1135
1148
|
return i.forEach((r) => {
|
|
1136
1149
|
const c = At(r);
|
|
@@ -1138,10 +1151,10 @@ class D extends HTMLElement {
|
|
|
1138
1151
|
}), i;
|
|
1139
1152
|
}
|
|
1140
1153
|
#k(t, e) {
|
|
1141
|
-
for (const [
|
|
1142
|
-
let r = Ie(t,
|
|
1154
|
+
for (const [n, i] of Object.entries(e)) {
|
|
1155
|
+
let r = Ie(t, n);
|
|
1143
1156
|
if (r === void 0)
|
|
1144
|
-
throw new bt(`invalid state path "${
|
|
1157
|
+
throw new bt(`invalid state path "${n}"`);
|
|
1145
1158
|
r = this[i], this.#s(i) || this.#e(
|
|
1146
1159
|
null,
|
|
1147
1160
|
i,
|
|
@@ -1150,11 +1163,12 @@ class D extends HTMLElement {
|
|
|
1150
1163
|
}
|
|
1151
1164
|
}
|
|
1152
1165
|
// When type is an array, this can't validate the type of the array elements.
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1166
|
+
// This is called by #defineProp.
|
|
1167
|
+
#F(t, e, n) {
|
|
1168
|
+
if (n instanceof e) return;
|
|
1169
|
+
let i = typeof n;
|
|
1156
1170
|
if (i === "object") {
|
|
1157
|
-
const { constructor: r } =
|
|
1171
|
+
const { constructor: r } = n;
|
|
1158
1172
|
i = r.name, r !== e && this.#e(
|
|
1159
1173
|
null,
|
|
1160
1174
|
t,
|
|
@@ -1169,49 +1183,49 @@ class D extends HTMLElement {
|
|
|
1169
1183
|
}
|
|
1170
1184
|
#y(t) {
|
|
1171
1185
|
const e = Array.from(t.querySelectorAll("*"));
|
|
1172
|
-
for (const
|
|
1186
|
+
for (const n of e) {
|
|
1173
1187
|
const i = [];
|
|
1174
|
-
for (const r of Array.from(
|
|
1188
|
+
for (const r of Array.from(n.attributes)) {
|
|
1175
1189
|
const c = r.name;
|
|
1176
1190
|
if (c.startsWith("on")) {
|
|
1177
1191
|
let h = c.slice(2);
|
|
1178
1192
|
h = h[0].toLowerCase() + h.slice(1).toLowerCase();
|
|
1179
1193
|
const u = r.value;
|
|
1180
|
-
this.#p(
|
|
1194
|
+
this.#p(n, c, u);
|
|
1181
1195
|
let p;
|
|
1182
|
-
typeof this[u] == "function" ? p = (d) => this[u](d) : (this.#p(
|
|
1196
|
+
typeof this[u] == "function" ? p = (d) => this[u](d) : (this.#p(n, c, u), p = () => this.#o(u)), n.addEventListener(h, p), i.push(c);
|
|
1183
1197
|
}
|
|
1184
1198
|
}
|
|
1185
1199
|
for (const r of i)
|
|
1186
|
-
|
|
1200
|
+
n.removeAttribute(r);
|
|
1187
1201
|
}
|
|
1188
1202
|
}
|
|
1189
1203
|
}
|
|
1190
|
-
function
|
|
1204
|
+
function jn(s, ...t) {
|
|
1191
1205
|
let e = Ge(s, t);
|
|
1192
1206
|
for (; ; ) {
|
|
1193
|
-
const
|
|
1194
|
-
if (!
|
|
1195
|
-
const i =
|
|
1207
|
+
const n = vn.exec(e);
|
|
1208
|
+
if (!n) break;
|
|
1209
|
+
const i = n[2];
|
|
1196
1210
|
if (He.test(i)) {
|
|
1197
|
-
const r =
|
|
1211
|
+
const r = n[1];
|
|
1198
1212
|
if (!r.startsWith("--")) {
|
|
1199
1213
|
const c = `--${r}: ${i};
|
|
1200
1214
|
${r}: var(--${r})`;
|
|
1201
|
-
e = $e(e,
|
|
1215
|
+
e = $e(e, n.index, n[0].length, c);
|
|
1202
1216
|
}
|
|
1203
1217
|
}
|
|
1204
1218
|
}
|
|
1205
1219
|
return e;
|
|
1206
1220
|
}
|
|
1207
|
-
function
|
|
1221
|
+
function Yn(s, ...t) {
|
|
1208
1222
|
let e = Ge(s, t);
|
|
1209
1223
|
for (; ; ) {
|
|
1210
|
-
const
|
|
1211
|
-
if (!
|
|
1212
|
-
const i = Gn(
|
|
1224
|
+
const n = Fn.exec(e);
|
|
1225
|
+
if (!n || n[1] === "style") break;
|
|
1226
|
+
const i = Gn(n[2]);
|
|
1213
1227
|
if (He.test(i)) {
|
|
1214
|
-
const r = `<!-- ${i.trim()} -->`, c =
|
|
1228
|
+
const r = `<!-- ${i.trim()} -->`, c = n.index + n[0].indexOf(">") + 1;
|
|
1215
1229
|
e = $e(e, c, i.length, r);
|
|
1216
1230
|
}
|
|
1217
1231
|
}
|
|
@@ -1219,7 +1233,7 @@ function jn(s, ...t) {
|
|
|
1219
1233
|
}
|
|
1220
1234
|
export {
|
|
1221
1235
|
D as Wrec,
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1236
|
+
Wn as createElement,
|
|
1237
|
+
jn as css,
|
|
1238
|
+
Yn as html
|
|
1225
1239
|
};
|