wrec 0.19.1 → 0.19.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/wrec.es.js +685 -533
- package/dist/wrec.js +3 -6
- package/dist/wrec.js.map +1 -1
- package/dist/wrec.min.js +1 -1
- package/dist/wrec.umd.js +4 -4
- package/package.json +1 -1
package/dist/wrec.es.js
CHANGED
|
@@ -1,126 +1,131 @@
|
|
|
1
|
+
var Ue = (i) => {
|
|
2
|
+
throw TypeError(i);
|
|
3
|
+
};
|
|
4
|
+
var Zt = (i, t, e) => t.has(i) || Ue("Cannot " + e);
|
|
5
|
+
var R = (i, t, e) => (Zt(i, t, "read from private field"), e ? e.call(i) : t.get(i)), j = (i, t, e) => t.has(i) ? Ue("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e), ot = (i, t, e, n) => (Zt(i, t, "write to private field"), n ? n.call(i, e) : t.set(i, e), e), He = (i, t, e) => (Zt(i, t, "access private method"), e);
|
|
1
6
|
const {
|
|
2
|
-
entries:
|
|
3
|
-
setPrototypeOf:
|
|
4
|
-
isFrozen:
|
|
5
|
-
getPrototypeOf:
|
|
6
|
-
getOwnPropertyDescriptor:
|
|
7
|
+
entries: Ke,
|
|
8
|
+
setPrototypeOf: ze,
|
|
9
|
+
isFrozen: Dn,
|
|
10
|
+
getPrototypeOf: In,
|
|
11
|
+
getOwnPropertyDescriptor: vn
|
|
7
12
|
} = Object;
|
|
8
13
|
let {
|
|
9
14
|
freeze: L,
|
|
10
|
-
seal:
|
|
11
|
-
create:
|
|
15
|
+
seal: v,
|
|
16
|
+
create: ce
|
|
12
17
|
} = Object, {
|
|
13
|
-
apply:
|
|
14
|
-
construct:
|
|
18
|
+
apply: le,
|
|
19
|
+
construct: fe
|
|
15
20
|
} = typeof Reflect < "u" && Reflect;
|
|
16
21
|
L || (L = function(t) {
|
|
17
22
|
return t;
|
|
18
23
|
});
|
|
19
|
-
|
|
24
|
+
v || (v = function(t) {
|
|
20
25
|
return t;
|
|
21
26
|
});
|
|
22
|
-
|
|
23
|
-
for (var n = arguments.length,
|
|
24
|
-
|
|
25
|
-
return t.apply(e,
|
|
27
|
+
le || (le = function(t, e) {
|
|
28
|
+
for (var n = arguments.length, s = new Array(n > 2 ? n - 2 : 0), r = 2; r < n; r++)
|
|
29
|
+
s[r - 2] = arguments[r];
|
|
30
|
+
return t.apply(e, s);
|
|
26
31
|
});
|
|
27
|
-
|
|
28
|
-
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0),
|
|
29
|
-
n[
|
|
32
|
+
fe || (fe = function(t) {
|
|
33
|
+
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), s = 1; s < e; s++)
|
|
34
|
+
n[s - 1] = arguments[s];
|
|
30
35
|
return new t(...n);
|
|
31
36
|
});
|
|
32
|
-
const
|
|
33
|
-
function M(
|
|
37
|
+
const Ct = M(Array.prototype.forEach), xn = M(Array.prototype.lastIndexOf), $e = M(Array.prototype.pop), lt = M(Array.prototype.push), Pn = M(Array.prototype.splice), Lt = M(String.prototype.toLowerCase), Jt = M(String.prototype.toString), Qt = M(String.prototype.match), ft = M(String.prototype.replace), kn = M(String.prototype.indexOf), Fn = M(String.prototype.trim), x = M(Object.prototype.hasOwnProperty), N = M(RegExp.prototype.test), ut = Un(TypeError);
|
|
38
|
+
function M(i) {
|
|
34
39
|
return function(t) {
|
|
35
40
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
36
|
-
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0),
|
|
37
|
-
n[
|
|
38
|
-
return
|
|
41
|
+
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), s = 1; s < e; s++)
|
|
42
|
+
n[s - 1] = arguments[s];
|
|
43
|
+
return le(i, t, n);
|
|
39
44
|
};
|
|
40
45
|
}
|
|
41
|
-
function
|
|
46
|
+
function Un(i) {
|
|
42
47
|
return function() {
|
|
43
48
|
for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
|
|
44
49
|
e[n] = arguments[n];
|
|
45
|
-
return
|
|
50
|
+
return fe(i, e);
|
|
46
51
|
};
|
|
47
52
|
}
|
|
48
|
-
function
|
|
49
|
-
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] :
|
|
50
|
-
|
|
53
|
+
function d(i, t) {
|
|
54
|
+
let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Lt;
|
|
55
|
+
ze && ze(i, null);
|
|
51
56
|
let n = t.length;
|
|
52
57
|
for (; n--; ) {
|
|
53
|
-
let
|
|
54
|
-
if (typeof
|
|
55
|
-
const r = e(
|
|
56
|
-
r !==
|
|
58
|
+
let s = t[n];
|
|
59
|
+
if (typeof s == "string") {
|
|
60
|
+
const r = e(s);
|
|
61
|
+
r !== s && (Dn(t) || (t[n] = r), s = r);
|
|
57
62
|
}
|
|
58
|
-
s
|
|
63
|
+
i[s] = !0;
|
|
59
64
|
}
|
|
60
|
-
return
|
|
65
|
+
return i;
|
|
61
66
|
}
|
|
62
|
-
function
|
|
63
|
-
for (let t = 0; t <
|
|
64
|
-
|
|
65
|
-
return
|
|
67
|
+
function Hn(i) {
|
|
68
|
+
for (let t = 0; t < i.length; t++)
|
|
69
|
+
x(i, t) || (i[t] = null);
|
|
70
|
+
return i;
|
|
66
71
|
}
|
|
67
|
-
function
|
|
68
|
-
const t =
|
|
69
|
-
for (const [e, n] of
|
|
70
|
-
|
|
72
|
+
function F(i) {
|
|
73
|
+
const t = ce(null);
|
|
74
|
+
for (const [e, n] of Ke(i))
|
|
75
|
+
x(i, e) && (Array.isArray(n) ? t[e] = Hn(n) : n && typeof n == "object" && n.constructor === Object ? t[e] = F(n) : t[e] = n);
|
|
71
76
|
return t;
|
|
72
77
|
}
|
|
73
|
-
function
|
|
74
|
-
for (;
|
|
75
|
-
const n =
|
|
78
|
+
function pt(i, t) {
|
|
79
|
+
for (; i !== null; ) {
|
|
80
|
+
const n = vn(i, t);
|
|
76
81
|
if (n) {
|
|
77
82
|
if (n.get)
|
|
78
83
|
return M(n.get);
|
|
79
84
|
if (typeof n.value == "function")
|
|
80
85
|
return M(n.value);
|
|
81
86
|
}
|
|
82
|
-
|
|
87
|
+
i = In(i);
|
|
83
88
|
}
|
|
84
89
|
function e() {
|
|
85
90
|
return null;
|
|
86
91
|
}
|
|
87
92
|
return e;
|
|
88
93
|
}
|
|
89
|
-
const
|
|
94
|
+
const Ge = 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"]), te = 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"]), ee = 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"]), zn = 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"]), ne = 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"]), $n = L(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), We = L(["#text"]), Be = 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"]), oe = 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"]), je = 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"]), wt = L(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Gn = v(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Wn = v(/<%[\w\W]*|[\w\W]*%>/gm), Bn = v(/\$\{[\w\W]*/gm), jn = v(/^data-[\-\w.\u00B7-\uFFFF]+$/), Yn = v(/^aria-[\-\w]+$/), Ze = v(
|
|
90
95
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
91
96
|
// eslint-disable-line no-useless-escape
|
|
92
|
-
),
|
|
97
|
+
), Vn = v(/^(?:\w+script|data):/i), Xn = v(
|
|
93
98
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
94
99
|
// eslint-disable-line no-control-regex
|
|
95
|
-
),
|
|
96
|
-
var
|
|
100
|
+
), Je = v(/^html$/i), qn = v(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
101
|
+
var Ye = /* @__PURE__ */ Object.freeze({
|
|
97
102
|
__proto__: null,
|
|
98
|
-
ARIA_ATTR:
|
|
99
|
-
ATTR_WHITESPACE:
|
|
100
|
-
CUSTOM_ELEMENT:
|
|
101
|
-
DATA_ATTR:
|
|
102
|
-
DOCTYPE_NAME:
|
|
103
|
-
ERB_EXPR:
|
|
104
|
-
IS_ALLOWED_URI:
|
|
105
|
-
IS_SCRIPT_OR_DATA:
|
|
106
|
-
MUSTACHE_EXPR:
|
|
107
|
-
TMPLIT_EXPR:
|
|
103
|
+
ARIA_ATTR: Yn,
|
|
104
|
+
ATTR_WHITESPACE: Xn,
|
|
105
|
+
CUSTOM_ELEMENT: qn,
|
|
106
|
+
DATA_ATTR: jn,
|
|
107
|
+
DOCTYPE_NAME: Je,
|
|
108
|
+
ERB_EXPR: Wn,
|
|
109
|
+
IS_ALLOWED_URI: Ze,
|
|
110
|
+
IS_SCRIPT_OR_DATA: Vn,
|
|
111
|
+
MUSTACHE_EXPR: Gn,
|
|
112
|
+
TMPLIT_EXPR: Bn
|
|
108
113
|
});
|
|
109
|
-
const
|
|
114
|
+
const mt = {
|
|
110
115
|
element: 1,
|
|
111
116
|
text: 3,
|
|
112
117
|
// Deprecated
|
|
113
118
|
progressingInstruction: 7,
|
|
114
119
|
comment: 8,
|
|
115
120
|
document: 9
|
|
116
|
-
},
|
|
121
|
+
}, Kn = function() {
|
|
117
122
|
return typeof window > "u" ? null : window;
|
|
118
|
-
},
|
|
123
|
+
}, Zn = function(t, e) {
|
|
119
124
|
if (typeof t != "object" || typeof t.createPolicy != "function")
|
|
120
125
|
return null;
|
|
121
126
|
let n = null;
|
|
122
|
-
const
|
|
123
|
-
e && e.hasAttribute(
|
|
127
|
+
const s = "data-tt-policy-suffix";
|
|
128
|
+
e && e.hasAttribute(s) && (n = e.getAttribute(s));
|
|
124
129
|
const r = "dompurify" + (n ? "#" + n : "");
|
|
125
130
|
try {
|
|
126
131
|
return t.createPolicy(r, {
|
|
@@ -134,7 +139,7 @@ const rt = {
|
|
|
134
139
|
} catch {
|
|
135
140
|
return console.warn("TrustedTypes policy " + r + " could not be created."), null;
|
|
136
141
|
}
|
|
137
|
-
},
|
|
142
|
+
}, Ve = function() {
|
|
138
143
|
return {
|
|
139
144
|
afterSanitizeAttributes: [],
|
|
140
145
|
afterSanitizeElements: [],
|
|
@@ -147,57 +152,57 @@ const rt = {
|
|
|
147
152
|
uponSanitizeShadowNode: []
|
|
148
153
|
};
|
|
149
154
|
};
|
|
150
|
-
function
|
|
151
|
-
let
|
|
152
|
-
const t = (f) =>
|
|
153
|
-
if (t.version = "3.3.1", t.removed = [], !
|
|
155
|
+
function Qe() {
|
|
156
|
+
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Kn();
|
|
157
|
+
const t = (f) => Qe(f);
|
|
158
|
+
if (t.version = "3.3.1", t.removed = [], !i || !i.document || i.document.nodeType !== mt.document || !i.Element)
|
|
154
159
|
return t.isSupported = !1, t;
|
|
155
160
|
let {
|
|
156
161
|
document: e
|
|
157
|
-
} =
|
|
158
|
-
const n = e,
|
|
162
|
+
} = i;
|
|
163
|
+
const n = e, s = n.currentScript, {
|
|
159
164
|
DocumentFragment: r,
|
|
160
165
|
HTMLTemplateElement: c,
|
|
161
|
-
Node:
|
|
162
|
-
Element:
|
|
163
|
-
NodeFilter:
|
|
164
|
-
NamedNodeMap:
|
|
166
|
+
Node: u,
|
|
167
|
+
Element: p,
|
|
168
|
+
NodeFilter: m,
|
|
169
|
+
NamedNodeMap: h = i.NamedNodeMap || i.MozNamedAttrMap,
|
|
165
170
|
HTMLFormElement: b,
|
|
166
|
-
DOMParser:
|
|
167
|
-
trustedTypes:
|
|
168
|
-
} =
|
|
171
|
+
DOMParser: W,
|
|
172
|
+
trustedTypes: H
|
|
173
|
+
} = i, B = p.prototype, un = pt(B, "cloneNode"), pn = pt(B, "remove"), mn = pt(B, "nextSibling"), hn = pt(B, "childNodes"), Et = pt(B, "parentNode");
|
|
169
174
|
if (typeof c == "function") {
|
|
170
175
|
const f = e.createElement("template");
|
|
171
176
|
f.content && f.content.ownerDocument && (e = f.content.ownerDocument);
|
|
172
177
|
}
|
|
173
|
-
let C,
|
|
178
|
+
let C, it = "";
|
|
174
179
|
const {
|
|
175
|
-
implementation:
|
|
176
|
-
createNodeIterator:
|
|
177
|
-
createDocumentFragment:
|
|
178
|
-
getElementsByTagName:
|
|
180
|
+
implementation: Pt,
|
|
181
|
+
createNodeIterator: dn,
|
|
182
|
+
createDocumentFragment: Tn,
|
|
183
|
+
getElementsByTagName: gn
|
|
179
184
|
} = e, {
|
|
180
|
-
importNode:
|
|
185
|
+
importNode: En
|
|
181
186
|
} = n;
|
|
182
|
-
let
|
|
183
|
-
t.isSupported = typeof
|
|
187
|
+
let w = Ve();
|
|
188
|
+
t.isSupported = typeof Ke == "function" && typeof Et == "function" && Pt && Pt.createHTMLDocument !== void 0;
|
|
184
189
|
const {
|
|
185
|
-
MUSTACHE_EXPR:
|
|
186
|
-
ERB_EXPR:
|
|
187
|
-
TMPLIT_EXPR:
|
|
188
|
-
DATA_ATTR:
|
|
189
|
-
ARIA_ATTR:
|
|
190
|
-
IS_SCRIPT_OR_DATA:
|
|
191
|
-
ATTR_WHITESPACE:
|
|
192
|
-
CUSTOM_ELEMENT:
|
|
193
|
-
} =
|
|
190
|
+
MUSTACHE_EXPR: kt,
|
|
191
|
+
ERB_EXPR: Ft,
|
|
192
|
+
TMPLIT_EXPR: Ut,
|
|
193
|
+
DATA_ATTR: An,
|
|
194
|
+
ARIA_ATTR: _n,
|
|
195
|
+
IS_SCRIPT_OR_DATA: bn,
|
|
196
|
+
ATTR_WHITESPACE: he,
|
|
197
|
+
CUSTOM_ELEMENT: Sn
|
|
198
|
+
} = Ye;
|
|
194
199
|
let {
|
|
195
|
-
IS_ALLOWED_URI:
|
|
196
|
-
} =
|
|
197
|
-
const
|
|
200
|
+
IS_ALLOWED_URI: de
|
|
201
|
+
} = Ye, _ = null;
|
|
202
|
+
const Te = d({}, [...Ge, ...te, ...ee, ...ne, ...We]);
|
|
198
203
|
let S = null;
|
|
199
|
-
const
|
|
200
|
-
let
|
|
204
|
+
const ge = d({}, [...Be, ...oe, ...je, ...wt]);
|
|
205
|
+
let g = Object.seal(ce(null, {
|
|
201
206
|
tagNameCheck: {
|
|
202
207
|
writable: !0,
|
|
203
208
|
configurable: !1,
|
|
@@ -216,8 +221,8 @@ function ke() {
|
|
|
216
221
|
enumerable: !0,
|
|
217
222
|
value: !1
|
|
218
223
|
}
|
|
219
|
-
})),
|
|
220
|
-
const
|
|
224
|
+
})), rt = null, Ht = null;
|
|
225
|
+
const K = Object.seal(ce(null, {
|
|
221
226
|
tagCheck: {
|
|
222
227
|
writable: !0,
|
|
223
228
|
configurable: !1,
|
|
@@ -231,70 +236,70 @@ function ke() {
|
|
|
231
236
|
value: null
|
|
232
237
|
}
|
|
233
238
|
}));
|
|
234
|
-
let
|
|
235
|
-
const
|
|
236
|
-
let
|
|
237
|
-
const
|
|
238
|
-
let
|
|
239
|
-
const
|
|
240
|
-
let
|
|
241
|
-
const
|
|
242
|
-
let
|
|
243
|
-
const
|
|
244
|
-
let
|
|
245
|
-
const
|
|
246
|
-
let
|
|
247
|
-
const
|
|
248
|
-
let A = null,
|
|
249
|
-
const
|
|
239
|
+
let Ee = !0, zt = !0, Ae = !1, _e = !0, Z = !1, At = !0, V = !1, $t = !1, Gt = !1, J = !1, _t = !1, bt = !1, be = !0, Se = !1;
|
|
240
|
+
const yn = "user-content-";
|
|
241
|
+
let Wt = !0, at = !1, Q = {}, P = null;
|
|
242
|
+
const Bt = d({}, ["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"]);
|
|
243
|
+
let ye = null;
|
|
244
|
+
const Re = d({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
245
|
+
let jt = null;
|
|
246
|
+
const Oe = d({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), St = "http://www.w3.org/1998/Math/MathML", yt = "http://www.w3.org/2000/svg", z = "http://www.w3.org/1999/xhtml";
|
|
247
|
+
let tt = z, Yt = !1, Vt = null;
|
|
248
|
+
const Rn = d({}, [St, yt, z], Jt);
|
|
249
|
+
let Rt = d({}, ["mi", "mo", "mn", "ms", "mtext"]), Ot = d({}, ["annotation-xml"]);
|
|
250
|
+
const On = d({}, ["title", "style", "font", "a", "script"]);
|
|
251
|
+
let ct = null;
|
|
252
|
+
const Cn = ["application/xhtml+xml", "text/html"], wn = "text/html";
|
|
253
|
+
let A = null, et = null;
|
|
254
|
+
const Nn = e.createElement("form"), Ce = function(o) {
|
|
250
255
|
return o instanceof RegExp || o instanceof Function;
|
|
251
|
-
},
|
|
256
|
+
}, Xt = function() {
|
|
252
257
|
let o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
253
|
-
if (!(
|
|
254
|
-
if ((!o || typeof o != "object") && (o = {}), o =
|
|
255
|
-
|
|
258
|
+
if (!(et && et === o)) {
|
|
259
|
+
if ((!o || typeof o != "object") && (o = {}), o = F(o), ct = // eslint-disable-next-line unicorn/prefer-includes
|
|
260
|
+
Cn.indexOf(o.PARSER_MEDIA_TYPE) === -1 ? wn : o.PARSER_MEDIA_TYPE, A = ct === "application/xhtml+xml" ? Jt : Lt, _ = x(o, "ALLOWED_TAGS") ? d({}, o.ALLOWED_TAGS, A) : Te, S = x(o, "ALLOWED_ATTR") ? d({}, o.ALLOWED_ATTR, A) : ge, Vt = x(o, "ALLOWED_NAMESPACES") ? d({}, o.ALLOWED_NAMESPACES, Jt) : Rn, jt = x(o, "ADD_URI_SAFE_ATTR") ? d(F(Oe), o.ADD_URI_SAFE_ATTR, A) : Oe, ye = x(o, "ADD_DATA_URI_TAGS") ? d(F(Re), o.ADD_DATA_URI_TAGS, A) : Re, P = x(o, "FORBID_CONTENTS") ? d({}, o.FORBID_CONTENTS, A) : Bt, rt = x(o, "FORBID_TAGS") ? d({}, o.FORBID_TAGS, A) : F({}), Ht = x(o, "FORBID_ATTR") ? d({}, o.FORBID_ATTR, A) : F({}), Q = x(o, "USE_PROFILES") ? o.USE_PROFILES : !1, Ee = o.ALLOW_ARIA_ATTR !== !1, zt = o.ALLOW_DATA_ATTR !== !1, Ae = o.ALLOW_UNKNOWN_PROTOCOLS || !1, _e = o.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Z = o.SAFE_FOR_TEMPLATES || !1, At = o.SAFE_FOR_XML !== !1, V = o.WHOLE_DOCUMENT || !1, J = o.RETURN_DOM || !1, _t = o.RETURN_DOM_FRAGMENT || !1, bt = o.RETURN_TRUSTED_TYPE || !1, Gt = o.FORCE_BODY || !1, be = o.SANITIZE_DOM !== !1, Se = o.SANITIZE_NAMED_PROPS || !1, Wt = o.KEEP_CONTENT !== !1, at = o.IN_PLACE || !1, de = o.ALLOWED_URI_REGEXP || Ze, tt = o.NAMESPACE || z, Rt = o.MATHML_TEXT_INTEGRATION_POINTS || Rt, Ot = o.HTML_INTEGRATION_POINTS || Ot, g = o.CUSTOM_ELEMENT_HANDLING || {}, o.CUSTOM_ELEMENT_HANDLING && Ce(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (g.tagNameCheck = o.CUSTOM_ELEMENT_HANDLING.tagNameCheck), o.CUSTOM_ELEMENT_HANDLING && Ce(o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (g.attributeNameCheck = o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), o.CUSTOM_ELEMENT_HANDLING && typeof o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (g.allowCustomizedBuiltInElements = o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), Z && (zt = !1), _t && (J = !0), Q && (_ = d({}, We), S = [], Q.html === !0 && (d(_, Ge), d(S, Be)), Q.svg === !0 && (d(_, te), d(S, oe), d(S, wt)), Q.svgFilters === !0 && (d(_, ee), d(S, oe), d(S, wt)), Q.mathMl === !0 && (d(_, ne), d(S, je), d(S, wt))), o.ADD_TAGS && (typeof o.ADD_TAGS == "function" ? K.tagCheck = o.ADD_TAGS : (_ === Te && (_ = F(_)), d(_, o.ADD_TAGS, A))), o.ADD_ATTR && (typeof o.ADD_ATTR == "function" ? K.attributeCheck = o.ADD_ATTR : (S === ge && (S = F(S)), d(S, o.ADD_ATTR, A))), o.ADD_URI_SAFE_ATTR && d(jt, o.ADD_URI_SAFE_ATTR, A), o.FORBID_CONTENTS && (P === Bt && (P = F(P)), d(P, o.FORBID_CONTENTS, A)), o.ADD_FORBID_CONTENTS && (P === Bt && (P = F(P)), d(P, o.ADD_FORBID_CONTENTS, A)), Wt && (_["#text"] = !0), V && d(_, ["html", "head", "body"]), _.table && (d(_, ["tbody"]), delete rt.tbody), o.TRUSTED_TYPES_POLICY) {
|
|
256
261
|
if (typeof o.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
257
|
-
throw
|
|
262
|
+
throw ut('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
258
263
|
if (typeof o.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
259
|
-
throw
|
|
260
|
-
C = o.TRUSTED_TYPES_POLICY,
|
|
264
|
+
throw ut('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
265
|
+
C = o.TRUSTED_TYPES_POLICY, it = C.createHTML("");
|
|
261
266
|
} else
|
|
262
|
-
C === void 0 && (C =
|
|
263
|
-
L && L(o),
|
|
267
|
+
C === void 0 && (C = Zn(H, s)), C !== null && typeof it == "string" && (it = C.createHTML(""));
|
|
268
|
+
L && L(o), et = o;
|
|
264
269
|
}
|
|
265
|
-
},
|
|
266
|
-
let a =
|
|
270
|
+
}, we = d({}, [...te, ...ee, ...zn]), Ne = d({}, [...ne, ...$n]), Ln = function(o) {
|
|
271
|
+
let a = Et(o);
|
|
267
272
|
(!a || !a.tagName) && (a = {
|
|
268
|
-
namespaceURI:
|
|
273
|
+
namespaceURI: tt,
|
|
269
274
|
tagName: "template"
|
|
270
275
|
});
|
|
271
|
-
const l =
|
|
272
|
-
return
|
|
273
|
-
},
|
|
274
|
-
|
|
276
|
+
const l = Lt(o.tagName), T = Lt(a.tagName);
|
|
277
|
+
return Vt[o.namespaceURI] ? o.namespaceURI === yt ? a.namespaceURI === z ? l === "svg" : a.namespaceURI === St ? l === "svg" && (T === "annotation-xml" || Rt[T]) : !!we[l] : o.namespaceURI === St ? a.namespaceURI === z ? l === "math" : a.namespaceURI === yt ? l === "math" && Ot[T] : !!Ne[l] : o.namespaceURI === z ? a.namespaceURI === yt && !Ot[T] || a.namespaceURI === St && !Rt[T] ? !1 : !Ne[l] && (On[l] || !we[l]) : !!(ct === "application/xhtml+xml" && Vt[o.namespaceURI]) : !1;
|
|
278
|
+
}, k = function(o) {
|
|
279
|
+
lt(t.removed, {
|
|
275
280
|
element: o
|
|
276
281
|
});
|
|
277
282
|
try {
|
|
278
|
-
|
|
283
|
+
Et(o).removeChild(o);
|
|
279
284
|
} catch {
|
|
280
|
-
|
|
285
|
+
pn(o);
|
|
281
286
|
}
|
|
282
|
-
},
|
|
287
|
+
}, X = function(o, a) {
|
|
283
288
|
try {
|
|
284
|
-
|
|
289
|
+
lt(t.removed, {
|
|
285
290
|
attribute: a.getAttributeNode(o),
|
|
286
291
|
from: a
|
|
287
292
|
});
|
|
288
293
|
} catch {
|
|
289
|
-
|
|
294
|
+
lt(t.removed, {
|
|
290
295
|
attribute: null,
|
|
291
296
|
from: a
|
|
292
297
|
});
|
|
293
298
|
}
|
|
294
299
|
if (a.removeAttribute(o), o === "is")
|
|
295
|
-
if (
|
|
300
|
+
if (J || _t)
|
|
296
301
|
try {
|
|
297
|
-
|
|
302
|
+
k(a);
|
|
298
303
|
} catch {
|
|
299
304
|
}
|
|
300
305
|
else
|
|
@@ -302,97 +307,97 @@ function ke() {
|
|
|
302
307
|
a.setAttribute(o, "");
|
|
303
308
|
} catch {
|
|
304
309
|
}
|
|
305
|
-
},
|
|
310
|
+
}, Le = function(o) {
|
|
306
311
|
let a = null, l = null;
|
|
307
|
-
if (
|
|
312
|
+
if (Gt)
|
|
308
313
|
o = "<remove></remove>" + o;
|
|
309
314
|
else {
|
|
310
|
-
const
|
|
311
|
-
l =
|
|
315
|
+
const E = Qt(o, /^[\r\n\t ]+/);
|
|
316
|
+
l = E && E[0];
|
|
312
317
|
}
|
|
313
|
-
|
|
318
|
+
ct === "application/xhtml+xml" && tt === z && (o = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + o + "</body></html>");
|
|
314
319
|
const T = C ? C.createHTML(o) : o;
|
|
315
|
-
if (
|
|
320
|
+
if (tt === z)
|
|
316
321
|
try {
|
|
317
|
-
a = new
|
|
322
|
+
a = new W().parseFromString(T, ct);
|
|
318
323
|
} catch {
|
|
319
324
|
}
|
|
320
325
|
if (!a || !a.documentElement) {
|
|
321
|
-
a =
|
|
326
|
+
a = Pt.createDocument(tt, "template", null);
|
|
322
327
|
try {
|
|
323
|
-
a.documentElement.innerHTML =
|
|
328
|
+
a.documentElement.innerHTML = Yt ? it : T;
|
|
324
329
|
} catch {
|
|
325
330
|
}
|
|
326
331
|
}
|
|
327
|
-
const
|
|
328
|
-
return o && l &&
|
|
329
|
-
},
|
|
330
|
-
return
|
|
332
|
+
const O = a.body || a.documentElement;
|
|
333
|
+
return o && l && O.insertBefore(e.createTextNode(l), O.childNodes[0] || null), tt === z ? gn.call(a, V ? "html" : "body")[0] : V ? a.documentElement : O;
|
|
334
|
+
}, Me = function(o) {
|
|
335
|
+
return dn.call(
|
|
331
336
|
o.ownerDocument || o,
|
|
332
337
|
o,
|
|
333
338
|
// eslint-disable-next-line no-bitwise
|
|
334
|
-
|
|
339
|
+
m.SHOW_ELEMENT | m.SHOW_COMMENT | m.SHOW_TEXT | m.SHOW_PROCESSING_INSTRUCTION | m.SHOW_CDATA_SECTION,
|
|
335
340
|
null
|
|
336
341
|
);
|
|
337
|
-
},
|
|
338
|
-
return o instanceof b && (typeof o.nodeName != "string" || typeof o.textContent != "string" || typeof o.removeChild != "function" || !(o.attributes instanceof
|
|
339
|
-
},
|
|
340
|
-
return typeof
|
|
342
|
+
}, qt = function(o) {
|
|
343
|
+
return o instanceof b && (typeof o.nodeName != "string" || typeof o.textContent != "string" || typeof o.removeChild != "function" || !(o.attributes instanceof h) || typeof o.removeAttribute != "function" || typeof o.setAttribute != "function" || typeof o.namespaceURI != "string" || typeof o.insertBefore != "function" || typeof o.hasChildNodes != "function");
|
|
344
|
+
}, De = function(o) {
|
|
345
|
+
return typeof u == "function" && o instanceof u;
|
|
341
346
|
};
|
|
342
|
-
function
|
|
343
|
-
|
|
344
|
-
l.call(t, o, a,
|
|
347
|
+
function $(f, o, a) {
|
|
348
|
+
Ct(f, (l) => {
|
|
349
|
+
l.call(t, o, a, et);
|
|
345
350
|
});
|
|
346
351
|
}
|
|
347
|
-
const
|
|
352
|
+
const Ie = function(o) {
|
|
348
353
|
let a = null;
|
|
349
|
-
if (
|
|
350
|
-
return
|
|
354
|
+
if ($(w.beforeSanitizeElements, o, null), qt(o))
|
|
355
|
+
return k(o), !0;
|
|
351
356
|
const l = A(o.nodeName);
|
|
352
|
-
if (
|
|
357
|
+
if ($(w.uponSanitizeElement, o, {
|
|
353
358
|
tagName: l,
|
|
354
359
|
allowedTags: _
|
|
355
|
-
}),
|
|
356
|
-
return
|
|
357
|
-
if (!(
|
|
358
|
-
if (!
|
|
360
|
+
}), At && o.hasChildNodes() && !De(o.firstElementChild) && N(/<[/\w!]/g, o.innerHTML) && N(/<[/\w!]/g, o.textContent) || o.nodeType === mt.progressingInstruction || At && o.nodeType === mt.comment && N(/<[/\w]/g, o.data))
|
|
361
|
+
return k(o), !0;
|
|
362
|
+
if (!(K.tagCheck instanceof Function && K.tagCheck(l)) && (!_[l] || rt[l])) {
|
|
363
|
+
if (!rt[l] && xe(l) && (g.tagNameCheck instanceof RegExp && N(g.tagNameCheck, l) || g.tagNameCheck instanceof Function && g.tagNameCheck(l)))
|
|
359
364
|
return !1;
|
|
360
|
-
if (
|
|
361
|
-
const T =
|
|
362
|
-
if (
|
|
363
|
-
const
|
|
364
|
-
for (let
|
|
365
|
-
const
|
|
366
|
-
|
|
365
|
+
if (Wt && !P[l]) {
|
|
366
|
+
const T = Et(o) || o.parentNode, O = hn(o) || o.childNodes;
|
|
367
|
+
if (O && T) {
|
|
368
|
+
const E = O.length;
|
|
369
|
+
for (let D = E - 1; D >= 0; --D) {
|
|
370
|
+
const G = un(O[D], !0);
|
|
371
|
+
G.__removalCount = (o.__removalCount || 0) + 1, T.insertBefore(G, mn(o));
|
|
367
372
|
}
|
|
368
373
|
}
|
|
369
374
|
}
|
|
370
|
-
return
|
|
375
|
+
return k(o), !0;
|
|
371
376
|
}
|
|
372
|
-
return o instanceof
|
|
373
|
-
a =
|
|
374
|
-
}), o.textContent !== a && (
|
|
377
|
+
return o instanceof p && !Ln(o) || (l === "noscript" || l === "noembed" || l === "noframes") && N(/<\/no(script|embed|frames)/i, o.innerHTML) ? (k(o), !0) : (Z && o.nodeType === mt.text && (a = o.textContent, Ct([kt, Ft, Ut], (T) => {
|
|
378
|
+
a = ft(a, T, " ");
|
|
379
|
+
}), o.textContent !== a && (lt(t.removed, {
|
|
375
380
|
element: o.cloneNode()
|
|
376
|
-
}), o.textContent = a)),
|
|
377
|
-
},
|
|
378
|
-
if (
|
|
381
|
+
}), o.textContent = a)), $(w.afterSanitizeElements, o, null), !1);
|
|
382
|
+
}, ve = function(o, a, l) {
|
|
383
|
+
if (be && (a === "id" || a === "name") && (l in e || l in Nn))
|
|
379
384
|
return !1;
|
|
380
|
-
if (!(
|
|
381
|
-
if (!(
|
|
382
|
-
if (!(
|
|
383
|
-
if (!S[a] ||
|
|
385
|
+
if (!(zt && !Ht[a] && N(An, a))) {
|
|
386
|
+
if (!(Ee && N(_n, a))) {
|
|
387
|
+
if (!(K.attributeCheck instanceof Function && K.attributeCheck(a, o))) {
|
|
388
|
+
if (!S[a] || Ht[a]) {
|
|
384
389
|
if (
|
|
385
390
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
386
391
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
387
392
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
388
|
-
!(
|
|
393
|
+
!(xe(o) && (g.tagNameCheck instanceof RegExp && N(g.tagNameCheck, o) || g.tagNameCheck instanceof Function && g.tagNameCheck(o)) && (g.attributeNameCheck instanceof RegExp && N(g.attributeNameCheck, a) || g.attributeNameCheck instanceof Function && g.attributeNameCheck(a, o)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
389
394
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
390
|
-
a === "is" &&
|
|
395
|
+
a === "is" && g.allowCustomizedBuiltInElements && (g.tagNameCheck instanceof RegExp && N(g.tagNameCheck, l) || g.tagNameCheck instanceof Function && g.tagNameCheck(l)))
|
|
391
396
|
) return !1;
|
|
392
|
-
} else if (!
|
|
393
|
-
if (!
|
|
394
|
-
if (!((a === "src" || a === "xlink:href" || a === "href") && o !== "script" &&
|
|
395
|
-
if (!(
|
|
397
|
+
} else if (!jt[a]) {
|
|
398
|
+
if (!N(de, ft(l, he, ""))) {
|
|
399
|
+
if (!((a === "src" || a === "xlink:href" || a === "href") && o !== "script" && kn(l, "data:") === 0 && ye[o])) {
|
|
400
|
+
if (!(Ae && !N(bn, ft(l, he, "")))) {
|
|
396
401
|
if (l)
|
|
397
402
|
return !1;
|
|
398
403
|
}
|
|
@@ -403,14 +408,14 @@ function ke() {
|
|
|
403
408
|
}
|
|
404
409
|
}
|
|
405
410
|
return !0;
|
|
406
|
-
},
|
|
407
|
-
return o !== "annotation-xml" &&
|
|
408
|
-
},
|
|
409
|
-
|
|
411
|
+
}, xe = function(o) {
|
|
412
|
+
return o !== "annotation-xml" && Qt(o, Sn);
|
|
413
|
+
}, Pe = function(o) {
|
|
414
|
+
$(w.beforeSanitizeAttributes, o, null);
|
|
410
415
|
const {
|
|
411
416
|
attributes: a
|
|
412
417
|
} = o;
|
|
413
|
-
if (!a ||
|
|
418
|
+
if (!a || qt(o))
|
|
414
419
|
return;
|
|
415
420
|
const l = {
|
|
416
421
|
attrName: "",
|
|
@@ -421,40 +426,40 @@ function ke() {
|
|
|
421
426
|
};
|
|
422
427
|
let T = a.length;
|
|
423
428
|
for (; T--; ) {
|
|
424
|
-
const
|
|
425
|
-
name:
|
|
426
|
-
namespaceURI:
|
|
427
|
-
value:
|
|
428
|
-
} =
|
|
429
|
-
let y =
|
|
430
|
-
if (l.attrName =
|
|
431
|
-
|
|
429
|
+
const O = a[T], {
|
|
430
|
+
name: E,
|
|
431
|
+
namespaceURI: D,
|
|
432
|
+
value: G
|
|
433
|
+
} = O, nt = A(E), Kt = G;
|
|
434
|
+
let y = E === "value" ? Kt : Fn(Kt);
|
|
435
|
+
if (l.attrName = nt, l.attrValue = y, l.keepAttr = !0, l.forceKeepAttr = void 0, $(w.uponSanitizeAttribute, o, l), y = l.attrValue, Se && (nt === "id" || nt === "name") && (X(E, o), y = yn + y), At && N(/((--!?|])>)|<\/(style|title|textarea)/i, y)) {
|
|
436
|
+
X(E, o);
|
|
432
437
|
continue;
|
|
433
438
|
}
|
|
434
|
-
if (
|
|
435
|
-
|
|
439
|
+
if (nt === "attributename" && Qt(y, "href")) {
|
|
440
|
+
X(E, o);
|
|
436
441
|
continue;
|
|
437
442
|
}
|
|
438
443
|
if (l.forceKeepAttr)
|
|
439
444
|
continue;
|
|
440
445
|
if (!l.keepAttr) {
|
|
441
|
-
|
|
446
|
+
X(E, o);
|
|
442
447
|
continue;
|
|
443
448
|
}
|
|
444
|
-
if (!
|
|
445
|
-
|
|
449
|
+
if (!_e && N(/\/>/i, y)) {
|
|
450
|
+
X(E, o);
|
|
446
451
|
continue;
|
|
447
452
|
}
|
|
448
|
-
|
|
449
|
-
y =
|
|
453
|
+
Z && Ct([kt, Ft, Ut], (Fe) => {
|
|
454
|
+
y = ft(y, Fe, " ");
|
|
450
455
|
});
|
|
451
|
-
const
|
|
452
|
-
if (!
|
|
453
|
-
|
|
456
|
+
const ke = A(o.nodeName);
|
|
457
|
+
if (!ve(ke, nt, y)) {
|
|
458
|
+
X(E, o);
|
|
454
459
|
continue;
|
|
455
460
|
}
|
|
456
|
-
if (C && typeof
|
|
457
|
-
switch (
|
|
461
|
+
if (C && typeof H == "object" && typeof H.getAttributeType == "function" && !D)
|
|
462
|
+
switch (H.getAttributeType(ke, nt)) {
|
|
458
463
|
case "TrustedHTML": {
|
|
459
464
|
y = C.createHTML(y);
|
|
460
465
|
break;
|
|
@@ -464,103 +469,249 @@ function ke() {
|
|
|
464
469
|
break;
|
|
465
470
|
}
|
|
466
471
|
}
|
|
467
|
-
if (y !==
|
|
472
|
+
if (y !== Kt)
|
|
468
473
|
try {
|
|
469
|
-
|
|
474
|
+
D ? o.setAttributeNS(D, E, y) : o.setAttribute(E, y), qt(o) ? k(o) : $e(t.removed);
|
|
470
475
|
} catch {
|
|
471
|
-
|
|
476
|
+
X(E, o);
|
|
472
477
|
}
|
|
473
478
|
}
|
|
474
|
-
|
|
475
|
-
},
|
|
479
|
+
$(w.afterSanitizeAttributes, o, null);
|
|
480
|
+
}, Mn = function f(o) {
|
|
476
481
|
let a = null;
|
|
477
|
-
const l =
|
|
478
|
-
for (
|
|
479
|
-
|
|
480
|
-
|
|
482
|
+
const l = Me(o);
|
|
483
|
+
for ($(w.beforeSanitizeShadowDOM, o, null); a = l.nextNode(); )
|
|
484
|
+
$(w.uponSanitizeShadowNode, a, null), Ie(a), Pe(a), a.content instanceof r && f(a.content);
|
|
485
|
+
$(w.afterSanitizeShadowDOM, o, null);
|
|
481
486
|
};
|
|
482
487
|
return t.sanitize = function(f) {
|
|
483
|
-
let o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = null, l = null, T = null,
|
|
484
|
-
if (
|
|
488
|
+
let o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = null, l = null, T = null, O = null;
|
|
489
|
+
if (Yt = !f, Yt && (f = "<!-->"), typeof f != "string" && !De(f))
|
|
485
490
|
if (typeof f.toString == "function") {
|
|
486
491
|
if (f = f.toString(), typeof f != "string")
|
|
487
|
-
throw
|
|
492
|
+
throw ut("dirty is not a string, aborting");
|
|
488
493
|
} else
|
|
489
|
-
throw
|
|
494
|
+
throw ut("toString is not a function");
|
|
490
495
|
if (!t.isSupported)
|
|
491
496
|
return f;
|
|
492
|
-
if (
|
|
497
|
+
if ($t || Xt(o), t.removed = [], typeof f == "string" && (at = !1), at) {
|
|
493
498
|
if (f.nodeName) {
|
|
494
|
-
const
|
|
495
|
-
if (!_[
|
|
496
|
-
throw
|
|
499
|
+
const G = A(f.nodeName);
|
|
500
|
+
if (!_[G] || rt[G])
|
|
501
|
+
throw ut("root node is forbidden and cannot be sanitized in-place");
|
|
497
502
|
}
|
|
498
|
-
} else if (f instanceof
|
|
499
|
-
a =
|
|
503
|
+
} else if (f instanceof u)
|
|
504
|
+
a = Le("<!---->"), l = a.ownerDocument.importNode(f, !0), l.nodeType === mt.element && l.nodeName === "BODY" || l.nodeName === "HTML" ? a = l : a.appendChild(l);
|
|
500
505
|
else {
|
|
501
|
-
if (!
|
|
506
|
+
if (!J && !Z && !V && // eslint-disable-next-line unicorn/prefer-includes
|
|
502
507
|
f.indexOf("<") === -1)
|
|
503
|
-
return C &&
|
|
504
|
-
if (a =
|
|
505
|
-
return
|
|
508
|
+
return C && bt ? C.createHTML(f) : f;
|
|
509
|
+
if (a = Le(f), !a)
|
|
510
|
+
return J ? null : bt ? it : "";
|
|
506
511
|
}
|
|
507
|
-
a &&
|
|
508
|
-
const
|
|
509
|
-
for (; T =
|
|
510
|
-
|
|
511
|
-
if (
|
|
512
|
+
a && Gt && k(a.firstChild);
|
|
513
|
+
const E = Me(at ? f : a);
|
|
514
|
+
for (; T = E.nextNode(); )
|
|
515
|
+
Ie(T), Pe(T), T.content instanceof r && Mn(T.content);
|
|
516
|
+
if (at)
|
|
512
517
|
return f;
|
|
513
|
-
if (
|
|
514
|
-
if (
|
|
515
|
-
for (
|
|
516
|
-
|
|
518
|
+
if (J) {
|
|
519
|
+
if (_t)
|
|
520
|
+
for (O = Tn.call(a.ownerDocument); a.firstChild; )
|
|
521
|
+
O.appendChild(a.firstChild);
|
|
517
522
|
else
|
|
518
|
-
|
|
519
|
-
return (S.shadowroot || S.shadowrootmode) && (
|
|
523
|
+
O = a;
|
|
524
|
+
return (S.shadowroot || S.shadowrootmode) && (O = En.call(n, O, !0)), O;
|
|
520
525
|
}
|
|
521
|
-
let
|
|
522
|
-
return
|
|
523
|
-
` +
|
|
524
|
-
|
|
525
|
-
}), C &&
|
|
526
|
+
let D = V ? a.outerHTML : a.innerHTML;
|
|
527
|
+
return V && _["!doctype"] && a.ownerDocument && a.ownerDocument.doctype && a.ownerDocument.doctype.name && N(Je, a.ownerDocument.doctype.name) && (D = "<!DOCTYPE " + a.ownerDocument.doctype.name + `>
|
|
528
|
+
` + D), Z && Ct([kt, Ft, Ut], (G) => {
|
|
529
|
+
D = ft(D, G, " ");
|
|
530
|
+
}), C && bt ? C.createHTML(D) : D;
|
|
526
531
|
}, t.setConfig = function() {
|
|
527
532
|
let f = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
528
|
-
|
|
533
|
+
Xt(f), $t = !0;
|
|
529
534
|
}, t.clearConfig = function() {
|
|
530
|
-
|
|
535
|
+
et = null, $t = !1;
|
|
531
536
|
}, t.isValidAttribute = function(f, o, a) {
|
|
532
|
-
|
|
537
|
+
et || Xt({});
|
|
533
538
|
const l = A(f), T = A(o);
|
|
534
|
-
return
|
|
539
|
+
return ve(l, T, a);
|
|
535
540
|
}, t.addHook = function(f, o) {
|
|
536
|
-
typeof o == "function" &&
|
|
541
|
+
typeof o == "function" && lt(w[f], o);
|
|
537
542
|
}, t.removeHook = function(f, o) {
|
|
538
543
|
if (o !== void 0) {
|
|
539
|
-
const a =
|
|
540
|
-
return a === -1 ? void 0 :
|
|
544
|
+
const a = xn(w[f], o);
|
|
545
|
+
return a === -1 ? void 0 : Pn(w[f], a, 1)[0];
|
|
541
546
|
}
|
|
542
|
-
return
|
|
547
|
+
return $e(w[f]);
|
|
543
548
|
}, t.removeHooks = function(f) {
|
|
544
|
-
|
|
549
|
+
w[f] = [];
|
|
545
550
|
}, t.removeAllHooks = function() {
|
|
546
|
-
|
|
551
|
+
w = Ve();
|
|
547
552
|
}, t;
|
|
548
553
|
}
|
|
549
|
-
var
|
|
550
|
-
function
|
|
551
|
-
let e =
|
|
554
|
+
var tn = Qe();
|
|
555
|
+
function Xe(i, t) {
|
|
556
|
+
let e = i;
|
|
552
557
|
for (const n of t.split("."))
|
|
553
558
|
e = e[n];
|
|
554
559
|
return e;
|
|
555
560
|
}
|
|
556
|
-
function
|
|
557
|
-
const n = t.split("."),
|
|
558
|
-
let r =
|
|
559
|
-
n.forEach((c,
|
|
560
|
-
|
|
561
|
+
function Jn(i, t, e) {
|
|
562
|
+
const n = t.split("."), s = n.length - 1;
|
|
563
|
+
let r = i;
|
|
564
|
+
n.forEach((c, u) => {
|
|
565
|
+
u === s ? r[c] = e : r = r[c];
|
|
561
566
|
});
|
|
562
567
|
}
|
|
563
|
-
|
|
568
|
+
function en(i, t, e = "") {
|
|
569
|
+
const n = /* @__PURE__ */ new WeakMap(), s = {
|
|
570
|
+
// Intercept property reads.
|
|
571
|
+
// This creates nested proxies lazily.
|
|
572
|
+
get(r, c) {
|
|
573
|
+
const u = Reflect.get(r, c);
|
|
574
|
+
if (u === null || typeof u != "object") return u;
|
|
575
|
+
const p = n.get(u);
|
|
576
|
+
if (p) return p;
|
|
577
|
+
const m = e ? `${e}.${c}` : c, h = en(u, t, m);
|
|
578
|
+
return n.set(u, h), h;
|
|
579
|
+
},
|
|
580
|
+
// Intercept property writes.
|
|
581
|
+
set(r, c, u) {
|
|
582
|
+
const p = Reflect.get(r, c);
|
|
583
|
+
if (p !== u) {
|
|
584
|
+
Reflect.set(r, c, u);
|
|
585
|
+
const m = e ? `${e}.${c}` : c;
|
|
586
|
+
t(m, p, u);
|
|
587
|
+
}
|
|
588
|
+
return !0;
|
|
589
|
+
}
|
|
590
|
+
};
|
|
591
|
+
return new Proxy(i, s);
|
|
592
|
+
}
|
|
593
|
+
function nn(i) {
|
|
594
|
+
const t = {};
|
|
595
|
+
for (const [e, n] of Object.entries(i)) {
|
|
596
|
+
const s = typeof n == "object" && n !== null;
|
|
597
|
+
t[e] = s ? nn(n) : n;
|
|
598
|
+
}
|
|
599
|
+
return t;
|
|
600
|
+
}
|
|
601
|
+
const Mt = typeof window < "u" && typeof window.document < "u";
|
|
602
|
+
let qe = class extends Error {
|
|
603
|
+
};
|
|
604
|
+
var q, vt, U, Tt, gt, Y, xt, on;
|
|
605
|
+
const st = class st {
|
|
606
|
+
constructor(t, e, n) {
|
|
607
|
+
j(this, xt);
|
|
608
|
+
j(this, vt, /* @__PURE__ */ Symbol("objectId"));
|
|
609
|
+
// This cannot be replaced by a WeakMap<ChangeListener, Set<string>>
|
|
610
|
+
// because there is no way to iterate over the keys of a WeakMap.
|
|
611
|
+
j(this, U, []);
|
|
612
|
+
j(this, Tt);
|
|
613
|
+
j(this, gt);
|
|
614
|
+
j(this, Y);
|
|
615
|
+
if (!t) throw new qe("name cannot be empty");
|
|
616
|
+
if (R(st, q).has(t))
|
|
617
|
+
throw new qe(`WrecState with name "${t}" already exists`);
|
|
618
|
+
if (ot(this, Tt, t), ot(this, gt, e), ot(this, Y, en({}, He(this, xt, on).bind(this))), e && Mt) {
|
|
619
|
+
const s = sessionStorage.getItem("wrec-state-" + t), r = s ? JSON.parse(s) : void 0;
|
|
620
|
+
r && (n = r);
|
|
621
|
+
}
|
|
622
|
+
if (n)
|
|
623
|
+
for (const [s, r] of Object.entries(n))
|
|
624
|
+
this.addProperty(s, r);
|
|
625
|
+
R(st, q).set(t, this);
|
|
626
|
+
}
|
|
627
|
+
// This static method is useful for accessing a specific WrecState object
|
|
628
|
+
// from the DevTools console. For example:
|
|
629
|
+
// state = WrecState.get('vault');
|
|
630
|
+
//
|
|
631
|
+
// WrecState object properties are accessed via nested Proxy objects
|
|
632
|
+
// so all changes can be monitored.
|
|
633
|
+
//
|
|
634
|
+
// Properties can be directly modified as follows:
|
|
635
|
+
// state.color = 'blue';
|
|
636
|
+
// state.team.leader.name = 'Mark';
|
|
637
|
+
static get(t) {
|
|
638
|
+
return R(this, q).get(t);
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* @param listener - object that has a "changed" method
|
|
642
|
+
* @param map - map from state property paths to component properties
|
|
643
|
+
*/
|
|
644
|
+
addListener(t, e = {}) {
|
|
645
|
+
const n = R(this, U).find(
|
|
646
|
+
(s) => s.listenerRef.deref() === t
|
|
647
|
+
);
|
|
648
|
+
if (n) {
|
|
649
|
+
const { propertyMap: s } = n;
|
|
650
|
+
for (const [r, c] of Object.entries(e))
|
|
651
|
+
s[r] = c;
|
|
652
|
+
} else
|
|
653
|
+
R(this, U).push({
|
|
654
|
+
listenerRef: new WeakRef(t),
|
|
655
|
+
propertyMap: e
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
addProperty(t, e) {
|
|
659
|
+
Object.defineProperty(this, t, {
|
|
660
|
+
enumerable: !0,
|
|
661
|
+
get() {
|
|
662
|
+
return R(this, Y)[t];
|
|
663
|
+
},
|
|
664
|
+
set(n) {
|
|
665
|
+
R(this, Y)[t] = n;
|
|
666
|
+
}
|
|
667
|
+
}), R(this, Y)[t] = e;
|
|
668
|
+
}
|
|
669
|
+
get id() {
|
|
670
|
+
return R(this, vt);
|
|
671
|
+
}
|
|
672
|
+
// This is useful for debugging from the DevTools console.
|
|
673
|
+
// For example: state.log()
|
|
674
|
+
log() {
|
|
675
|
+
console.log("WrecState:", R(this, Tt));
|
|
676
|
+
for (const [t, e] of Object.entries(R(this, Y)))
|
|
677
|
+
console.log(` ${t} = ${JSON.stringify(e)}`);
|
|
678
|
+
}
|
|
679
|
+
removeListener(t) {
|
|
680
|
+
ot(this, U, R(this, U).filter((e) => e.listenerRef.deref() !== t));
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
q = new WeakMap(), vt = new WeakMap(), U = new WeakMap(), Tt = new WeakMap(), gt = new WeakMap(), Y = new WeakMap(), xt = new WeakSet(), on = function(t, e, n) {
|
|
684
|
+
const s = /* @__PURE__ */ new Set();
|
|
685
|
+
for (const r of R(this, U)) {
|
|
686
|
+
const c = r.listenerRef.deref();
|
|
687
|
+
if (!c)
|
|
688
|
+
s.add(r);
|
|
689
|
+
else if (Mt && c instanceof HTMLElement && !c.isConnected)
|
|
690
|
+
s.add(r);
|
|
691
|
+
else {
|
|
692
|
+
const { propertyMap: u } = r, p = Object.keys(u);
|
|
693
|
+
(p.length === 0 || p.includes(t)) && c.changed(
|
|
694
|
+
t,
|
|
695
|
+
u[t],
|
|
696
|
+
n,
|
|
697
|
+
e,
|
|
698
|
+
this
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
ot(this, U, R(this, U).filter(
|
|
703
|
+
(r) => !s.has(r)
|
|
704
|
+
));
|
|
705
|
+
}, j(st, q, /* @__PURE__ */ new Map()), Mt && window.addEventListener("beforeunload", () => {
|
|
706
|
+
for (const [t, e] of R(st, q).entries())
|
|
707
|
+
if (R(e, gt)) {
|
|
708
|
+
const n = nn(e);
|
|
709
|
+
sessionStorage.setItem("wrec-state-" + t, JSON.stringify(n));
|
|
710
|
+
}
|
|
711
|
+
});
|
|
712
|
+
let ue = st;
|
|
713
|
+
Mt && process.env.NODE_ENV === "development" && (window.WrecState = ue);
|
|
714
|
+
const Qn = /* @__PURE__ */ new Set([
|
|
564
715
|
"onblur",
|
|
565
716
|
"onchange",
|
|
566
717
|
"onclick",
|
|
@@ -570,102 +721,102 @@ const Pn = /* @__PURE__ */ new Set([
|
|
|
570
721
|
"onreset",
|
|
571
722
|
"onsubmit"
|
|
572
723
|
]);
|
|
573
|
-
|
|
724
|
+
tn.addHook("uponSanitizeAttribute", (i, t) => {
|
|
574
725
|
const { attrName: e } = t, n = e.toLowerCase();
|
|
575
|
-
|
|
726
|
+
Qn.has(n) && (t.forceKeepAttr = !0);
|
|
576
727
|
});
|
|
577
|
-
class
|
|
728
|
+
class Dt extends Error {
|
|
578
729
|
}
|
|
579
|
-
const
|
|
580
|
-
function
|
|
581
|
-
return
|
|
730
|
+
const to = /([a-zA-Z-]+)\s*:\s*([^;}]+)/g, sn = "a-zA-Z_$", eo = sn + "0-9", dt = `[${sn}][${eo}]*`, no = /<!--\s*(.*?)\s*-->/, oo = /<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g, se = new RegExp(`^this\\.${dt}$`), ie = new RegExp(`this\\.${dt}(\\.${dt})*`, "g"), rn = new RegExp(`this\\.${dt}(\\.${dt})*`), so = /* @__PURE__ */ new Set(["class", "style"]), an = 5;
|
|
731
|
+
function io(i) {
|
|
732
|
+
return i instanceof HTMLButtonElement || i instanceof HTMLFieldSetElement || i instanceof HTMLInputElement || i instanceof HTMLSelectElement || i instanceof HTMLTextAreaElement || i instanceof I;
|
|
582
733
|
}
|
|
583
|
-
function
|
|
584
|
-
const n = document.createElement(
|
|
734
|
+
function po(i, t, e) {
|
|
735
|
+
const n = document.createElement(i);
|
|
585
736
|
if (t)
|
|
586
|
-
for (const [
|
|
587
|
-
n.setAttribute(
|
|
737
|
+
for (const [s, r] of Object.entries(t))
|
|
738
|
+
n.setAttribute(s, r);
|
|
588
739
|
return e && (n.innerHTML = e), n;
|
|
589
740
|
}
|
|
590
|
-
const
|
|
591
|
-
function
|
|
741
|
+
const ro = (i) => i === String ? "" : i === Number ? 0 : i === Boolean ? !1 : i === Array ? [] : i === Object ? {} : void 0;
|
|
742
|
+
function It(i) {
|
|
592
743
|
const t = [];
|
|
593
|
-
let e =
|
|
744
|
+
let e = i.firstElementChild;
|
|
594
745
|
for (; e; )
|
|
595
|
-
t.push(e), e.shadowRoot && t.push(...
|
|
746
|
+
t.push(e), e.shadowRoot && t.push(...It(e.shadowRoot)), e.firstElementChild && t.push(...It(e)), e = e.nextElementSibling;
|
|
596
747
|
return t;
|
|
597
748
|
}
|
|
598
|
-
const
|
|
599
|
-
function
|
|
600
|
-
let e =
|
|
601
|
-
return t.forEach((n,
|
|
602
|
-
e += n + s
|
|
749
|
+
const Nt = (i) => i.substring(an).split(".")[0];
|
|
750
|
+
function cn(i, t) {
|
|
751
|
+
let e = i[0];
|
|
752
|
+
return t.forEach((n, s) => {
|
|
753
|
+
e += n + i[s + 1];
|
|
603
754
|
}), e;
|
|
604
755
|
}
|
|
605
|
-
function
|
|
606
|
-
const t = typeof
|
|
756
|
+
function pe(i) {
|
|
757
|
+
const t = typeof i;
|
|
607
758
|
return t === "string" || t === "number" || t === "boolean";
|
|
608
759
|
}
|
|
609
|
-
function
|
|
610
|
-
return
|
|
760
|
+
function ht(i) {
|
|
761
|
+
return i.localName === "textarea";
|
|
611
762
|
}
|
|
612
|
-
function
|
|
613
|
-
const { localName: t } =
|
|
763
|
+
function me(i) {
|
|
764
|
+
const { localName: t } = i;
|
|
614
765
|
return t === "input" || t === "select";
|
|
615
766
|
}
|
|
616
|
-
const
|
|
617
|
-
function
|
|
618
|
-
return
|
|
767
|
+
const ao = (i) => i.replace(/<!--[\s\S]*?-->/g, "");
|
|
768
|
+
function ln(i, t, e, n) {
|
|
769
|
+
return i.slice(0, t) + n + i.slice(t + e);
|
|
619
770
|
}
|
|
620
|
-
function
|
|
621
|
-
let t =
|
|
771
|
+
function co(i) {
|
|
772
|
+
let t = i.trim(), e = null;
|
|
622
773
|
/^\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 n =
|
|
774
|
+
const n = tn.sanitize(t, {
|
|
624
775
|
ADD_TAGS: ["#comment"],
|
|
625
776
|
ALLOW_UNKNOWN_PROTOCOLS: !0,
|
|
626
777
|
RETURN_DOM_FRAGMENT: !0
|
|
627
778
|
});
|
|
628
779
|
if (e) {
|
|
629
|
-
const
|
|
630
|
-
if (
|
|
780
|
+
const s = n.querySelector(e);
|
|
781
|
+
if (s) return s.childNodes;
|
|
631
782
|
}
|
|
632
783
|
return n.childNodes;
|
|
633
784
|
}
|
|
634
|
-
function
|
|
635
|
-
const t = Number(
|
|
636
|
-
if (isNaN(t)) throw new
|
|
785
|
+
function re(i) {
|
|
786
|
+
const t = Number(i);
|
|
787
|
+
if (isNaN(t)) throw new Dt(`can't convert "${i}" to a number`);
|
|
637
788
|
return t;
|
|
638
789
|
}
|
|
639
|
-
function
|
|
640
|
-
const [n,
|
|
641
|
-
if (
|
|
790
|
+
function fn(i, t, e) {
|
|
791
|
+
const [n, s] = t.split(":");
|
|
792
|
+
if (pe(e))
|
|
642
793
|
if (typeof e == "boolean") {
|
|
643
|
-
e ?
|
|
644
|
-
const r =
|
|
645
|
-
|
|
794
|
+
e ? i.setAttribute(n, n) : i.removeAttribute(n);
|
|
795
|
+
const r = I.getPropName(n);
|
|
796
|
+
i[r] = e;
|
|
646
797
|
} else {
|
|
647
|
-
const r =
|
|
648
|
-
r !== c && (
|
|
798
|
+
const r = i.getAttribute(t), c = String(e);
|
|
799
|
+
r !== c && (i.setAttribute(n, c), n === "value" && me(i) && (i.value = c));
|
|
649
800
|
}
|
|
650
801
|
else {
|
|
651
|
-
const r =
|
|
652
|
-
|
|
802
|
+
const r = I.getPropName(t);
|
|
803
|
+
i[r] = e;
|
|
653
804
|
}
|
|
654
805
|
}
|
|
655
|
-
function
|
|
656
|
-
const [n,
|
|
657
|
-
|
|
806
|
+
function ae(i, t, e) {
|
|
807
|
+
const [n, s] = t.split(":");
|
|
808
|
+
i instanceof CSSStyleRule ? i.style.setProperty(n, e) : (fn(i, n, e), n === "value" && me(i) && (i.value = e));
|
|
658
809
|
}
|
|
659
|
-
function
|
|
810
|
+
function lo(i) {
|
|
660
811
|
const t = /* @__PURE__ */ new Set();
|
|
661
|
-
for (const n of
|
|
662
|
-
const { localName:
|
|
663
|
-
|
|
812
|
+
for (const n of It(i)) {
|
|
813
|
+
const { localName: s } = n;
|
|
814
|
+
s.includes("-") && t.add(s);
|
|
664
815
|
}
|
|
665
816
|
const e = [...t].map((n) => customElements.whenDefined(n));
|
|
666
817
|
return Promise.all(e);
|
|
667
818
|
}
|
|
668
|
-
class
|
|
819
|
+
class I extends HTMLElement {
|
|
669
820
|
// This is used to lookup the camelCase property name
|
|
670
821
|
// that corresponds to a kebab-case attribute name.
|
|
671
822
|
static #m = /* @__PURE__ */ new Map();
|
|
@@ -706,7 +857,7 @@ class D extends HTMLElement {
|
|
|
706
857
|
// Each component instance needs its own map.
|
|
707
858
|
#n = /* @__PURE__ */ new Map();
|
|
708
859
|
#c = {};
|
|
709
|
-
#
|
|
860
|
+
#s;
|
|
710
861
|
// For components that set `formAssociated` to true,
|
|
711
862
|
// this stores in the initial value of each property
|
|
712
863
|
// in the formAssociatedCallback method
|
|
@@ -728,12 +879,12 @@ class D extends HTMLElement {
|
|
|
728
879
|
}
|
|
729
880
|
attributeChangedCallback(t, e, n) {
|
|
730
881
|
t === "disabled" && this.#d();
|
|
731
|
-
const
|
|
732
|
-
if (this.#s
|
|
733
|
-
const r = this.#b(
|
|
734
|
-
this[
|
|
735
|
-
const c = this.#c[
|
|
736
|
-
c && this.setFormValue(c, String(r)), this.propertyChangedCallback(
|
|
882
|
+
const s = I.getPropName(t);
|
|
883
|
+
if (this.#i(s)) {
|
|
884
|
+
const r = this.#b(s, String(n));
|
|
885
|
+
this[s] = r;
|
|
886
|
+
const c = this.#c[s];
|
|
887
|
+
c && this.setFormValue(c, String(r)), this.propertyChangedCallback(s, e, n);
|
|
737
888
|
}
|
|
738
889
|
}
|
|
739
890
|
async #R() {
|
|
@@ -745,63 +896,63 @@ class D extends HTMLElement {
|
|
|
745
896
|
:host([hidden]) { display: none; }`;
|
|
746
897
|
t.css && (n += t.css), n += `</style>
|
|
747
898
|
`;
|
|
748
|
-
let
|
|
749
|
-
|
|
899
|
+
let s = t.html.trim();
|
|
900
|
+
s.startsWith("<") || (s = `<span><!--${s}--></span>`), e.innerHTML = n + s;
|
|
750
901
|
}
|
|
751
|
-
await
|
|
902
|
+
await lo(e), this.shadowRoot.replaceChildren(e.content.cloneNode(!0));
|
|
752
903
|
}
|
|
753
904
|
changed(t, e, n) {
|
|
754
905
|
this[e] = n;
|
|
755
906
|
}
|
|
756
907
|
connectedCallback() {
|
|
757
|
-
this.#
|
|
908
|
+
this.#P(), this.#C(), this.#R().then(() => {
|
|
758
909
|
this.hasAttribute("disabled") && this.#d(), requestAnimationFrame(() => {
|
|
759
|
-
this.#y(this.shadowRoot), this.#T(this.shadowRoot), this.#
|
|
910
|
+
this.#y(this.shadowRoot), this.#T(this.shadowRoot), this.#O();
|
|
760
911
|
});
|
|
761
912
|
});
|
|
762
913
|
}
|
|
763
|
-
#
|
|
914
|
+
#O() {
|
|
764
915
|
const t = this.#t, { properties: e } = t;
|
|
765
|
-
for (const [n, { computed:
|
|
766
|
-
|
|
916
|
+
for (const [n, { computed: s }] of Object.entries(e))
|
|
917
|
+
s && (this[n] = this.#o(s));
|
|
767
918
|
}
|
|
768
|
-
#
|
|
919
|
+
#C() {
|
|
769
920
|
const t = this.#t, { observedAttributes: e, properties: n } = t;
|
|
770
|
-
for (const [
|
|
771
|
-
this.#
|
|
921
|
+
for (const [s, r] of Object.entries(n))
|
|
922
|
+
this.#w(s, r, e);
|
|
772
923
|
}
|
|
773
|
-
#
|
|
774
|
-
const
|
|
924
|
+
#w(t, e, n) {
|
|
925
|
+
const s = I.getAttrName(t), r = this.hasAttribute(s);
|
|
775
926
|
e.required && !r && this.#e(this, t, "is a required attribute");
|
|
776
927
|
let c = e.value;
|
|
777
928
|
this.hasOwnProperty(t) && (c = this[t], delete this[t]);
|
|
778
|
-
const { type:
|
|
779
|
-
this[
|
|
929
|
+
const { type: u } = e, p = u === Boolean ? c || r : n.includes(s) && r ? this.#_(t, s) : c || ro(u), m = "#" + t;
|
|
930
|
+
this[m] = p, e.computed && this.#D(t, e), Object.defineProperty(this, t, {
|
|
780
931
|
enumerable: !0,
|
|
781
932
|
get() {
|
|
782
|
-
return this[
|
|
933
|
+
return this[m];
|
|
783
934
|
},
|
|
784
|
-
set(
|
|
785
|
-
|
|
786
|
-
const b = this[
|
|
787
|
-
if (
|
|
788
|
-
this.#F(t,
|
|
789
|
-
const { state:
|
|
790
|
-
|
|
791
|
-
const
|
|
792
|
-
|
|
935
|
+
set(h) {
|
|
936
|
+
u === Number && typeof h == "string" && (h = re(h));
|
|
937
|
+
const b = this[m];
|
|
938
|
+
if (h === b) return;
|
|
939
|
+
this.#F(t, u, h), this[m] = h;
|
|
940
|
+
const { state: W, stateProp: H } = this.#t.properties[t];
|
|
941
|
+
H && Jn(W, H, h), this.#v(t), this.#I(t, u, h, s), this.#A(t), this.#x(t, h);
|
|
942
|
+
const B = this.#c[t];
|
|
943
|
+
B && this.setFormValue(B, String(h)), this.propertyChangedCallback(t, b, h), e.dispatch && this.dispatch("change", {
|
|
793
944
|
tagName: this.localName,
|
|
794
945
|
property: t,
|
|
795
946
|
oldValue: b,
|
|
796
|
-
value:
|
|
947
|
+
value: h
|
|
797
948
|
});
|
|
798
949
|
}
|
|
799
950
|
});
|
|
800
951
|
}
|
|
801
952
|
#d() {
|
|
802
|
-
const t = this.hasAttribute("disabled"), e =
|
|
953
|
+
const t = this.hasAttribute("disabled"), e = It(this.shadowRoot);
|
|
803
954
|
for (const n of e)
|
|
804
|
-
|
|
955
|
+
io(n) && (n.disabled = t);
|
|
805
956
|
}
|
|
806
957
|
disconnectedCallback() {
|
|
807
958
|
this.#n.clear(), this.#l.clear(), this.#u.clear();
|
|
@@ -825,54 +976,54 @@ class D extends HTMLElement {
|
|
|
825
976
|
static elementName() {
|
|
826
977
|
return this.name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
827
978
|
}
|
|
828
|
-
#
|
|
829
|
-
const e = t instanceof
|
|
979
|
+
#N(t) {
|
|
980
|
+
const e = t instanceof I;
|
|
830
981
|
for (const n of t.getAttributeNames()) {
|
|
831
|
-
const
|
|
982
|
+
const s = t.getAttribute(n), r = this.#E(t, s);
|
|
832
983
|
if (r) {
|
|
833
984
|
const c = this[r];
|
|
834
985
|
c === void 0 && this.#a(t, n, r), t[r] = c;
|
|
835
|
-
let [
|
|
836
|
-
|
|
837
|
-
|
|
986
|
+
let [u, p] = n.split(":");
|
|
987
|
+
u === "value" && (p ? (t["on" + p] === void 0 && this.#e(t, n, "refers to an unsupported event name"), t.setAttribute(u, this[r])) : p = "change"), e && t.#u.set(
|
|
988
|
+
I.getPropName(u),
|
|
838
989
|
r
|
|
839
990
|
);
|
|
840
991
|
}
|
|
841
|
-
this.#r(
|
|
992
|
+
this.#r(s, t, n);
|
|
842
993
|
}
|
|
843
994
|
}
|
|
844
995
|
#o(t) {
|
|
845
996
|
const e = new Function("return " + t).call(this);
|
|
846
997
|
return Array.isArray(e) ? e.join("") : e;
|
|
847
998
|
}
|
|
848
|
-
#
|
|
999
|
+
#L(t) {
|
|
849
1000
|
const { localName: e } = t;
|
|
850
1001
|
if (e === "style") {
|
|
851
|
-
const { sheet: n } = t,
|
|
1002
|
+
const { sheet: n } = t, s = n?.cssRules ?? [], r = Array.from(s);
|
|
852
1003
|
for (const c of r)
|
|
853
1004
|
if (c.constructor === CSSStyleRule) {
|
|
854
|
-
const
|
|
855
|
-
for (const
|
|
856
|
-
if (
|
|
857
|
-
const
|
|
858
|
-
this.#r(
|
|
1005
|
+
const u = Array.from(c.style);
|
|
1006
|
+
for (const p of u)
|
|
1007
|
+
if (p.startsWith("--")) {
|
|
1008
|
+
const m = c.style.getPropertyValue(p);
|
|
1009
|
+
this.#r(m, c, p);
|
|
859
1010
|
}
|
|
860
1011
|
}
|
|
861
1012
|
} else {
|
|
862
1013
|
let n = "";
|
|
863
|
-
if (
|
|
1014
|
+
if (ht(t)) {
|
|
864
1015
|
this.#r(t.textContent, t);
|
|
865
|
-
const
|
|
866
|
-
|
|
1016
|
+
const s = t.textContent?.match(no);
|
|
1017
|
+
s && (n = s[1]);
|
|
867
1018
|
} else {
|
|
868
|
-
const
|
|
1019
|
+
const s = Array.from(t.childNodes).find(
|
|
869
1020
|
(r) => r.nodeType === Node.COMMENT_NODE
|
|
870
1021
|
);
|
|
871
|
-
|
|
1022
|
+
s && (n = s.textContent?.trim() ?? "");
|
|
872
1023
|
}
|
|
873
1024
|
if (n) {
|
|
874
|
-
const
|
|
875
|
-
|
|
1025
|
+
const s = this.#E(t, n);
|
|
1026
|
+
s && ht(t) ? t.textContent = this[s] : this.#r(n, t);
|
|
876
1027
|
}
|
|
877
1028
|
}
|
|
878
1029
|
}
|
|
@@ -885,7 +1036,7 @@ class D extends HTMLElement {
|
|
|
885
1036
|
if (!t) {
|
|
886
1037
|
const c = this.getAttribute("name");
|
|
887
1038
|
if (c)
|
|
888
|
-
if (this.#
|
|
1039
|
+
if (this.#i("value"))
|
|
889
1040
|
t = `value:${c}`;
|
|
890
1041
|
else
|
|
891
1042
|
return;
|
|
@@ -894,84 +1045,84 @@ class D extends HTMLElement {
|
|
|
894
1045
|
}
|
|
895
1046
|
const e = {}, n = t.split(",");
|
|
896
1047
|
for (const c of n) {
|
|
897
|
-
const [
|
|
898
|
-
e[
|
|
1048
|
+
const [u, p] = c.split(":");
|
|
1049
|
+
e[u.trim()] = p.trim();
|
|
899
1050
|
}
|
|
900
|
-
this.#c = e, this.#
|
|
901
|
-
const
|
|
902
|
-
for (const c of
|
|
1051
|
+
this.#c = e, this.#s = new FormData(), this.#f = this.attachInternals(), this.#f.setFormValue(this.#s);
|
|
1052
|
+
const s = Object.keys(this.#t.properties), r = this.#l;
|
|
1053
|
+
for (const c of s)
|
|
903
1054
|
r[c] = this[c];
|
|
904
1055
|
}
|
|
905
1056
|
formResetCallback() {
|
|
906
1057
|
const t = this.#l;
|
|
907
1058
|
for (const e of Object.keys(t)) {
|
|
908
1059
|
let n = t[e];
|
|
909
|
-
|
|
1060
|
+
se.test(n) && (n = this.#o(n)), this[e] = n;
|
|
910
1061
|
}
|
|
911
1062
|
}
|
|
912
1063
|
static getAttrName(t) {
|
|
913
|
-
let e =
|
|
914
|
-
return e || (e = t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(),
|
|
1064
|
+
let e = I.#h.get(t);
|
|
1065
|
+
return e || (e = t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), I.#h.set(t, e)), e;
|
|
915
1066
|
}
|
|
916
1067
|
static getPropName(t) {
|
|
917
|
-
let e =
|
|
918
|
-
return e || (e = t.replace(/-([a-z])/g, (n,
|
|
1068
|
+
let e = I.#m.get(t);
|
|
1069
|
+
return e || (e = t.replace(/-([a-z])/g, (n, s) => s.toUpperCase()), I.#m.set(t, e)), e;
|
|
919
1070
|
}
|
|
920
|
-
#
|
|
1071
|
+
#M(t, e, n) {
|
|
921
1072
|
if (n.length !== 1) return;
|
|
922
|
-
const [
|
|
923
|
-
if (!
|
|
924
|
-
const r =
|
|
925
|
-
let [c,
|
|
926
|
-
if (!(r && c === "value" ||
|
|
927
|
-
|
|
928
|
-
const
|
|
929
|
-
t.addEventListener(
|
|
930
|
-
const { target: b } =
|
|
1073
|
+
const [s] = n;
|
|
1074
|
+
if (!se.test(s)) return;
|
|
1075
|
+
const r = me(t) || ht(t);
|
|
1076
|
+
let [c, u] = (e ?? "").split(":");
|
|
1077
|
+
if (!(r && c === "value" || ht(t))) return;
|
|
1078
|
+
u ? t["on" + u] === void 0 && this.#e(t, e, "refers to an unsupported event name") : u = "change";
|
|
1079
|
+
const m = Nt(s);
|
|
1080
|
+
t.addEventListener(u, (h) => {
|
|
1081
|
+
const { target: b } = h;
|
|
931
1082
|
if (!b) return;
|
|
932
|
-
const
|
|
933
|
-
this[
|
|
1083
|
+
const W = b.value, { type: H } = this.#t.properties[m];
|
|
1084
|
+
this[m] = H === Number ? re(W) : W, this.#A(m);
|
|
934
1085
|
});
|
|
935
1086
|
}
|
|
936
|
-
#
|
|
1087
|
+
#i(t) {
|
|
937
1088
|
return !!this.#t.properties[t];
|
|
938
1089
|
}
|
|
939
1090
|
#T(t) {
|
|
940
1091
|
const e = Array.from(t.querySelectorAll("*"));
|
|
941
1092
|
for (const n of e)
|
|
942
|
-
this.#
|
|
1093
|
+
this.#N(n), n.firstElementChild || this.#L(n);
|
|
943
1094
|
}
|
|
944
1095
|
// formAssociated is only needed when the component is inside a form.
|
|
945
|
-
#
|
|
1096
|
+
#g() {
|
|
946
1097
|
if (this.#t.formAssociated || this.closest("form") === null) return;
|
|
947
1098
|
const t = this.#t.name;
|
|
948
|
-
throw new
|
|
1099
|
+
throw new Dt(
|
|
949
1100
|
`inside form, class ${t} requires "static formAssociated = true;"`
|
|
950
1101
|
);
|
|
951
1102
|
}
|
|
952
1103
|
static get observedAttributes() {
|
|
953
|
-
const t = Object.keys(this.properties || {}).map(
|
|
1104
|
+
const t = Object.keys(this.properties || {}).map(I.getAttrName);
|
|
954
1105
|
return t.includes("disabled") || t.push("disabled"), t;
|
|
955
1106
|
}
|
|
956
1107
|
// Subclasses can override this to add functionality.
|
|
957
1108
|
propertyChangedCallback(t, e, n) {
|
|
958
1109
|
}
|
|
959
|
-
#
|
|
960
|
-
if (!e || !
|
|
961
|
-
const n =
|
|
1110
|
+
#E(t, e) {
|
|
1111
|
+
if (!e || !se.test(e)) return;
|
|
1112
|
+
const n = Nt(e);
|
|
962
1113
|
return this[n] === void 0 && this.#a(t, "", n), n;
|
|
963
1114
|
}
|
|
964
1115
|
#A(t) {
|
|
965
|
-
const
|
|
966
|
-
for (const r of
|
|
1116
|
+
const s = this.#t.propToExprsMap.get(t) || [];
|
|
1117
|
+
for (const r of s) {
|
|
967
1118
|
let c = this.#o(r);
|
|
968
|
-
const
|
|
969
|
-
for (const
|
|
970
|
-
if (
|
|
971
|
-
this.#S(
|
|
972
|
-
else if (!(
|
|
973
|
-
const { element:
|
|
974
|
-
|
|
1119
|
+
const u = this.#n.get(r) ?? [];
|
|
1120
|
+
for (const p of u)
|
|
1121
|
+
if (p instanceof HTMLElement)
|
|
1122
|
+
this.#S(p, c);
|
|
1123
|
+
else if (!(p instanceof CSSStyleRule)) {
|
|
1124
|
+
const { element: m, attrName: h } = p;
|
|
1125
|
+
m instanceof CSSStyleRule ? m.style.setProperty(h, c) : ae(m, h, c);
|
|
975
1126
|
}
|
|
976
1127
|
}
|
|
977
1128
|
}
|
|
@@ -980,50 +1131,50 @@ class D extends HTMLElement {
|
|
|
980
1131
|
customElements.get(t) || customElements.define(t, this);
|
|
981
1132
|
}
|
|
982
1133
|
#D(t, e) {
|
|
983
|
-
const { computed: n, uses:
|
|
984
|
-
function c(
|
|
985
|
-
let
|
|
986
|
-
|
|
1134
|
+
const { computed: n, uses: s } = e, r = this.#t.propToComputedMap;
|
|
1135
|
+
function c(p, m) {
|
|
1136
|
+
let h = r.get(p);
|
|
1137
|
+
h || (h = [], r.set(p, h)), h.push([t, m]);
|
|
987
1138
|
}
|
|
988
|
-
const
|
|
989
|
-
for (const
|
|
990
|
-
const
|
|
991
|
-
this[
|
|
1139
|
+
const u = n.match(ie) || [];
|
|
1140
|
+
for (const p of u) {
|
|
1141
|
+
const m = p.substring(an);
|
|
1142
|
+
this[m] === void 0 && this.#a(null, t, m), typeof this[m] != "function" && c(m, n);
|
|
992
1143
|
}
|
|
993
|
-
if (
|
|
994
|
-
for (const
|
|
995
|
-
c(
|
|
1144
|
+
if (s)
|
|
1145
|
+
for (const p of s.split(","))
|
|
1146
|
+
c(p, n);
|
|
996
1147
|
}
|
|
997
1148
|
// WARNING: Do not place untrusted JavaScript expressions
|
|
998
1149
|
// in attribute values or the text content of elements!
|
|
999
1150
|
#r(t, e, n = void 0) {
|
|
1000
1151
|
if (!t) return;
|
|
1001
|
-
const
|
|
1002
|
-
if (!
|
|
1003
|
-
const
|
|
1004
|
-
n ?
|
|
1152
|
+
const s = this.#p(e, n, t);
|
|
1153
|
+
if (!s) {
|
|
1154
|
+
const p = t.replaceAll("this..", "this.");
|
|
1155
|
+
n ? ae(e, n, p) : "textContent" in e && (e.textContent = p);
|
|
1005
1156
|
return;
|
|
1006
1157
|
}
|
|
1007
1158
|
const r = this.#t;
|
|
1008
|
-
|
|
1009
|
-
const
|
|
1010
|
-
if (typeof this[
|
|
1011
|
-
const
|
|
1012
|
-
let b =
|
|
1013
|
-
b || (b = [],
|
|
1159
|
+
s.forEach((p) => {
|
|
1160
|
+
const m = Nt(p);
|
|
1161
|
+
if (typeof this[m] == "function") return;
|
|
1162
|
+
const h = r.propToExprsMap;
|
|
1163
|
+
let b = h.get(m);
|
|
1164
|
+
b || (b = [], h.set(m, b)), b.includes(t) || b.push(t);
|
|
1014
1165
|
});
|
|
1015
|
-
for (const [
|
|
1016
|
-
for (const
|
|
1017
|
-
const b =
|
|
1166
|
+
for (const [p, m] of this.#n.entries())
|
|
1167
|
+
for (const h of m) {
|
|
1168
|
+
const b = h instanceof HTMLElement || h instanceof CSSStyleRule ? h : h.element;
|
|
1018
1169
|
b instanceof CSSStyleRule || b.isConnected || this.#n.set(
|
|
1019
|
-
|
|
1020
|
-
|
|
1170
|
+
p,
|
|
1171
|
+
m.filter((W) => W !== h)
|
|
1021
1172
|
);
|
|
1022
1173
|
}
|
|
1023
1174
|
let c = this.#n.get(t);
|
|
1024
|
-
c || (c = [], this.#n.set(t, c)), c.push(n ? { element: e, attrName: n } : e), e instanceof HTMLElement && this.#
|
|
1025
|
-
const
|
|
1026
|
-
n ?
|
|
1175
|
+
c || (c = [], this.#n.set(t, c)), c.push(n ? { element: e, attrName: n } : e), e instanceof HTMLElement && this.#M(e, n, s);
|
|
1176
|
+
const u = this.#o(t);
|
|
1177
|
+
n ? ae(e, n, u) : this.#S(e, u);
|
|
1027
1178
|
}
|
|
1028
1179
|
// This follows the best practice
|
|
1029
1180
|
// "Do not override author-set, global attributes."
|
|
@@ -1031,12 +1182,12 @@ class D extends HTMLElement {
|
|
|
1031
1182
|
this.hasAttribute(t) || this.setAttribute(t, e);
|
|
1032
1183
|
}
|
|
1033
1184
|
setFormValue(t, e) {
|
|
1034
|
-
!this.#
|
|
1185
|
+
!this.#s || !pe(e) || (this.#s.set(t, e), this.#f?.setFormValue(this.#s));
|
|
1035
1186
|
}
|
|
1036
1187
|
#e(t, e, n) {
|
|
1037
|
-
const
|
|
1038
|
-
throw new
|
|
1039
|
-
`component ${
|
|
1188
|
+
const s = this.#t, r = t instanceof HTMLElement ? t.localName : "CSS rule";
|
|
1189
|
+
throw new Dt(
|
|
1190
|
+
`component ${s.elementName()}` + (t ? `, element "${r}"` : "") + (e ? `, attribute "${e}"` : "") + ` ${n}`
|
|
1040
1191
|
);
|
|
1041
1192
|
}
|
|
1042
1193
|
#a(t, e, n) {
|
|
@@ -1046,11 +1197,11 @@ class D extends HTMLElement {
|
|
|
1046
1197
|
return this.#b(t, this.getAttribute(e));
|
|
1047
1198
|
}
|
|
1048
1199
|
#b(t, e) {
|
|
1049
|
-
if (e?.match(
|
|
1050
|
-
const n = this.#t, { type:
|
|
1051
|
-
if (
|
|
1052
|
-
if (
|
|
1053
|
-
if (
|
|
1200
|
+
if (e?.match(ie)) return e;
|
|
1201
|
+
const n = this.#t, { type: s } = n.properties[t];
|
|
1202
|
+
if (s || this.#e(null, t, "does not specify its type"), s === String) return e;
|
|
1203
|
+
if (s === Number) return re(e);
|
|
1204
|
+
if (s === Boolean)
|
|
1054
1205
|
return e === "true" ? !0 : e === "false" || e === "null" ? !1 : (e && e !== t && this.#e(
|
|
1055
1206
|
null,
|
|
1056
1207
|
t,
|
|
@@ -1059,41 +1210,41 @@ class D extends HTMLElement {
|
|
|
1059
1210
|
}
|
|
1060
1211
|
// Updates the matching attribute for a property if there is one.
|
|
1061
1212
|
// VS Code thinks this is never called, but it is called by #defineProp.
|
|
1062
|
-
#I(t, e, n,
|
|
1063
|
-
if (
|
|
1064
|
-
const r = e === Boolean ? this.hasAttribute(
|
|
1065
|
-
n !== r &&
|
|
1213
|
+
#I(t, e, n, s) {
|
|
1214
|
+
if (pe(n) && this.hasAttribute(s)) {
|
|
1215
|
+
const r = e === Boolean ? this.hasAttribute(s) : this.#_(t, s);
|
|
1216
|
+
n !== r && fn(this, t, n);
|
|
1066
1217
|
}
|
|
1067
1218
|
}
|
|
1068
1219
|
// Updates all computed properties that reference this property.
|
|
1069
1220
|
// VS Code thinks this is never called, but it is called by #defineProp.
|
|
1070
|
-
#
|
|
1221
|
+
#v(t) {
|
|
1071
1222
|
const n = this.#t.propToComputedMap.get(t) || [];
|
|
1072
|
-
for (const [
|
|
1073
|
-
this[
|
|
1223
|
+
for (const [s, r] of n)
|
|
1224
|
+
this[s] = this.#o(r);
|
|
1074
1225
|
}
|
|
1075
1226
|
#S(t, e) {
|
|
1076
1227
|
if (e === void 0) return;
|
|
1077
|
-
const n = t instanceof HTMLElement,
|
|
1078
|
-
if (
|
|
1228
|
+
const n = t instanceof HTMLElement, s = typeof e;
|
|
1229
|
+
if (s !== "string" && s !== "number" && this.#e(
|
|
1079
1230
|
t,
|
|
1080
1231
|
void 0,
|
|
1081
1232
|
" computed content is not a string or number"
|
|
1082
|
-
), t instanceof HTMLElement &&
|
|
1233
|
+
), t instanceof HTMLElement && ht(t))
|
|
1083
1234
|
t.value = e;
|
|
1084
|
-
else if (n &&
|
|
1085
|
-
const r =
|
|
1235
|
+
else if (n && s === "string" && e.trim().startsWith("<")) {
|
|
1236
|
+
const r = co(e);
|
|
1086
1237
|
t.replaceChildren(...r), this.#y(t), this.#T(t);
|
|
1087
1238
|
} else n && (t.textContent = e);
|
|
1088
1239
|
}
|
|
1089
1240
|
// Update corresponding parent web component property if bound to one.
|
|
1090
1241
|
// VS Code thinks this is never called, but it is called by #defineProp.
|
|
1091
|
-
#
|
|
1242
|
+
#x(t, e) {
|
|
1092
1243
|
const n = this.#u.get(t);
|
|
1093
1244
|
if (!n) return;
|
|
1094
|
-
const
|
|
1095
|
-
if (!(
|
|
1096
|
-
const { host: r } =
|
|
1245
|
+
const s = this.getRootNode();
|
|
1246
|
+
if (!(s instanceof ShadowRoot)) return;
|
|
1247
|
+
const { host: r } = s;
|
|
1097
1248
|
if (!r) return;
|
|
1098
1249
|
const c = r;
|
|
1099
1250
|
c[n] = e;
|
|
@@ -1110,19 +1261,19 @@ class D extends HTMLElement {
|
|
|
1110
1261
|
e[n] = n;
|
|
1111
1262
|
}
|
|
1112
1263
|
this.#k(t, e);
|
|
1113
|
-
for (const [n,
|
|
1114
|
-
if (this.#s
|
|
1115
|
-
const r =
|
|
1116
|
-
r !== void 0 && (this[
|
|
1117
|
-
const c = this.#t.properties[
|
|
1264
|
+
for (const [n, s] of Object.entries(e))
|
|
1265
|
+
if (this.#i(s)) {
|
|
1266
|
+
const r = Xe(t, n);
|
|
1267
|
+
r !== void 0 && (this[s] = r);
|
|
1268
|
+
const c = this.#t.properties[s];
|
|
1118
1269
|
c.state = t, c.stateProp = n;
|
|
1119
1270
|
}
|
|
1120
1271
|
t.addListener(this, e);
|
|
1121
1272
|
}
|
|
1122
|
-
#
|
|
1273
|
+
#P() {
|
|
1123
1274
|
const t = this.#t, e = new Set(Object.keys(t.properties));
|
|
1124
1275
|
for (const n of e)
|
|
1125
|
-
|
|
1276
|
+
so.has(n) && this.#e(
|
|
1126
1277
|
null,
|
|
1127
1278
|
"",
|
|
1128
1279
|
`property "${n}" is not allowed because it is a reserved attribute`
|
|
@@ -1130,12 +1281,12 @@ class D extends HTMLElement {
|
|
|
1130
1281
|
for (const n of this.getAttributeNames())
|
|
1131
1282
|
if (n !== "class" && n !== "id" && n !== "disabled" && !n.startsWith("on")) {
|
|
1132
1283
|
if (n === "form-assoc") {
|
|
1133
|
-
this.#
|
|
1284
|
+
this.#g();
|
|
1134
1285
|
continue;
|
|
1135
1286
|
}
|
|
1136
|
-
if (!e.has(
|
|
1287
|
+
if (!e.has(I.getPropName(n))) {
|
|
1137
1288
|
if (n === "name") {
|
|
1138
|
-
this.#
|
|
1289
|
+
this.#g();
|
|
1139
1290
|
continue;
|
|
1140
1291
|
}
|
|
1141
1292
|
this.#e(null, n, "is not a supported attribute");
|
|
@@ -1143,21 +1294,21 @@ class D extends HTMLElement {
|
|
|
1143
1294
|
}
|
|
1144
1295
|
}
|
|
1145
1296
|
#p(t, e, n) {
|
|
1146
|
-
const
|
|
1147
|
-
if (
|
|
1148
|
-
return
|
|
1149
|
-
const c =
|
|
1297
|
+
const s = n.match(ie);
|
|
1298
|
+
if (s)
|
|
1299
|
+
return s.forEach((r) => {
|
|
1300
|
+
const c = Nt(r);
|
|
1150
1301
|
this[c] === void 0 && this.#a(t, e, c);
|
|
1151
|
-
}),
|
|
1302
|
+
}), s;
|
|
1152
1303
|
}
|
|
1153
1304
|
#k(t, e) {
|
|
1154
|
-
for (const [n,
|
|
1155
|
-
let r =
|
|
1305
|
+
for (const [n, s] of Object.entries(e)) {
|
|
1306
|
+
let r = Xe(t, n);
|
|
1156
1307
|
if (r === void 0)
|
|
1157
|
-
throw new
|
|
1158
|
-
r = this[
|
|
1308
|
+
throw new Dt(`invalid state path "${n}"`);
|
|
1309
|
+
r = this[s], this.#i(s) || this.#e(
|
|
1159
1310
|
null,
|
|
1160
|
-
|
|
1311
|
+
s,
|
|
1161
1312
|
"refers to missing property in useState map"
|
|
1162
1313
|
);
|
|
1163
1314
|
}
|
|
@@ -1166,74 +1317,75 @@ class D extends HTMLElement {
|
|
|
1166
1317
|
// This is called by #defineProp.
|
|
1167
1318
|
#F(t, e, n) {
|
|
1168
1319
|
if (n instanceof e) return;
|
|
1169
|
-
let
|
|
1170
|
-
if (
|
|
1320
|
+
let s = typeof n;
|
|
1321
|
+
if (s === "object") {
|
|
1171
1322
|
const { constructor: r } = n;
|
|
1172
|
-
|
|
1323
|
+
s = r.name, r !== e && this.#e(
|
|
1173
1324
|
null,
|
|
1174
1325
|
t,
|
|
1175
|
-
`was set to a ${
|
|
1326
|
+
`was set to a ${s}, but must be a ${e.name}`
|
|
1176
1327
|
);
|
|
1177
1328
|
}
|
|
1178
|
-
|
|
1329
|
+
s !== e.name.toLowerCase() && this.#e(
|
|
1179
1330
|
null,
|
|
1180
1331
|
t,
|
|
1181
|
-
`was set to a ${
|
|
1332
|
+
`was set to a ${s}, but must be a ${e.name}`
|
|
1182
1333
|
);
|
|
1183
1334
|
}
|
|
1184
1335
|
#y(t) {
|
|
1185
1336
|
const e = Array.from(t.querySelectorAll("*"));
|
|
1186
1337
|
for (const n of e) {
|
|
1187
|
-
const
|
|
1338
|
+
const s = [];
|
|
1188
1339
|
for (const r of Array.from(n.attributes)) {
|
|
1189
1340
|
const c = r.name;
|
|
1190
1341
|
if (c.startsWith("on")) {
|
|
1191
|
-
let
|
|
1192
|
-
|
|
1193
|
-
const
|
|
1194
|
-
this.#p(n, c,
|
|
1195
|
-
let
|
|
1196
|
-
typeof this[
|
|
1342
|
+
let u = c.slice(2);
|
|
1343
|
+
u = u[0].toLowerCase() + u.slice(1).toLowerCase();
|
|
1344
|
+
const p = r.value;
|
|
1345
|
+
this.#p(n, c, p);
|
|
1346
|
+
let m;
|
|
1347
|
+
typeof this[p] == "function" ? m = (h) => this[p](h) : (this.#p(n, c, p), m = () => this.#o(p)), n.addEventListener(u, m), s.push(c);
|
|
1197
1348
|
}
|
|
1198
1349
|
}
|
|
1199
|
-
for (const r of
|
|
1350
|
+
for (const r of s)
|
|
1200
1351
|
n.removeAttribute(r);
|
|
1201
1352
|
}
|
|
1202
1353
|
}
|
|
1203
1354
|
}
|
|
1204
|
-
function
|
|
1205
|
-
let e =
|
|
1355
|
+
function mo(i, ...t) {
|
|
1356
|
+
let e = cn(i, t);
|
|
1206
1357
|
for (; ; ) {
|
|
1207
|
-
const n =
|
|
1358
|
+
const n = to.exec(e);
|
|
1208
1359
|
if (!n) break;
|
|
1209
|
-
const
|
|
1210
|
-
if (
|
|
1360
|
+
const s = n[2];
|
|
1361
|
+
if (rn.test(s)) {
|
|
1211
1362
|
const r = n[1];
|
|
1212
1363
|
if (!r.startsWith("--")) {
|
|
1213
|
-
const c = `--${r}: ${
|
|
1364
|
+
const c = `--${r}: ${s};
|
|
1214
1365
|
${r}: var(--${r})`;
|
|
1215
|
-
e =
|
|
1366
|
+
e = ln(e, n.index, n[0].length, c);
|
|
1216
1367
|
}
|
|
1217
1368
|
}
|
|
1218
1369
|
}
|
|
1219
1370
|
return e;
|
|
1220
1371
|
}
|
|
1221
|
-
function
|
|
1222
|
-
let e =
|
|
1372
|
+
function ho(i, ...t) {
|
|
1373
|
+
let e = cn(i, t);
|
|
1223
1374
|
for (; ; ) {
|
|
1224
|
-
const n =
|
|
1375
|
+
const n = oo.exec(e);
|
|
1225
1376
|
if (!n || n[1] === "style") break;
|
|
1226
|
-
const
|
|
1227
|
-
if (
|
|
1228
|
-
const r = `<!-- ${
|
|
1229
|
-
e =
|
|
1377
|
+
const s = ao(n[2]);
|
|
1378
|
+
if (rn.test(s)) {
|
|
1379
|
+
const r = `<!-- ${s.trim()} -->`, c = n.index + n[0].indexOf(">") + 1;
|
|
1380
|
+
e = ln(e, c, s.length, r);
|
|
1230
1381
|
}
|
|
1231
1382
|
}
|
|
1232
1383
|
return e;
|
|
1233
1384
|
}
|
|
1234
1385
|
export {
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1386
|
+
I as Wrec,
|
|
1387
|
+
ue as WrecState,
|
|
1388
|
+
po as createElement,
|
|
1389
|
+
mo as css,
|
|
1390
|
+
ho as html
|
|
1239
1391
|
};
|