wrec 0.20.1 → 0.20.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/dist/wrec.es.js +113 -110
- package/dist/wrec.umd.js +4 -4
- package/package.json +1 -1
- package/dist/wrec.es.d.ts +0 -2
package/dist/wrec.es.js
CHANGED
|
@@ -11,14 +11,14 @@ const {
|
|
|
11
11
|
getOwnPropertyDescriptor: Pn
|
|
12
12
|
} = Object;
|
|
13
13
|
let {
|
|
14
|
-
freeze:
|
|
14
|
+
freeze: L,
|
|
15
15
|
seal: I,
|
|
16
16
|
create: ce
|
|
17
17
|
} = Object, {
|
|
18
18
|
apply: le,
|
|
19
19
|
construct: fe
|
|
20
20
|
} = typeof Reflect < "u" && Reflect;
|
|
21
|
-
|
|
21
|
+
L || (L = function(t) {
|
|
22
22
|
return t;
|
|
23
23
|
});
|
|
24
24
|
I || (I = function(t) {
|
|
@@ -34,8 +34,8 @@ fe || (fe = function(t) {
|
|
|
34
34
|
n[s - 1] = arguments[s];
|
|
35
35
|
return new t(...n);
|
|
36
36
|
});
|
|
37
|
-
const
|
|
38
|
-
function
|
|
37
|
+
const Ct = N(Array.prototype.forEach), vn = N(Array.prototype.lastIndexOf), $e = N(Array.prototype.pop), ft = N(Array.prototype.push), xn = N(Array.prototype.splice), Nt = N(String.prototype.toLowerCase), Jt = N(String.prototype.toString), Qt = N(String.prototype.match), ut = N(String.prototype.replace), kn = N(String.prototype.indexOf), Fn = N(String.prototype.trim), P = N(Object.prototype.hasOwnProperty), M = N(RegExp.prototype.test), pt = Un(TypeError);
|
|
38
|
+
function N(i) {
|
|
39
39
|
return function(t) {
|
|
40
40
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
41
41
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), s = 1; s < e; s++)
|
|
@@ -75,14 +75,14 @@ function k(i) {
|
|
|
75
75
|
P(i, e) && (Array.isArray(n) ? t[e] = Hn(n) : n && typeof n == "object" && n.constructor === Object ? t[e] = k(n) : t[e] = n);
|
|
76
76
|
return t;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function ht(i, t) {
|
|
79
79
|
for (; i !== null; ) {
|
|
80
80
|
const n = Pn(i, t);
|
|
81
81
|
if (n) {
|
|
82
82
|
if (n.get)
|
|
83
|
-
return
|
|
83
|
+
return N(n.get);
|
|
84
84
|
if (typeof n.value == "function")
|
|
85
|
-
return
|
|
85
|
+
return N(n.value);
|
|
86
86
|
}
|
|
87
87
|
i = In(i);
|
|
88
88
|
}
|
|
@@ -91,7 +91,7 @@ function pt(i, t) {
|
|
|
91
91
|
}
|
|
92
92
|
return e;
|
|
93
93
|
}
|
|
94
|
-
const We =
|
|
94
|
+
const We = 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"]), Ge = 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"]), Mt = L(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Wn = I(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Gn = I(/<%[\w\W]*|[\w\W]*%>/gm), Bn = I(/\$\{[\w\W]*/gm), jn = I(/^data-[\-\w.\u00B7-\uFFFF]+$/), Yn = I(/^aria-[\-\w]+$/), Ze = I(
|
|
95
95
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
96
96
|
// eslint-disable-line no-useless-escape
|
|
97
97
|
), Vn = I(/^(?:\w+script|data):/i), Xn = I(
|
|
@@ -111,7 +111,7 @@ var Ye = /* @__PURE__ */ Object.freeze({
|
|
|
111
111
|
MUSTACHE_EXPR: Wn,
|
|
112
112
|
TMPLIT_EXPR: Bn
|
|
113
113
|
});
|
|
114
|
-
const
|
|
114
|
+
const mt = {
|
|
115
115
|
element: 1,
|
|
116
116
|
text: 3,
|
|
117
117
|
// Deprecated
|
|
@@ -155,7 +155,7 @@ const ht = {
|
|
|
155
155
|
function Qe() {
|
|
156
156
|
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Kn();
|
|
157
157
|
const t = (f) => Qe(f);
|
|
158
|
-
if (t.version = "3.3.1", t.removed = [], !i || !i.document || i.document.nodeType !==
|
|
158
|
+
if (t.version = "3.3.1", t.removed = [], !i || !i.document || i.document.nodeType !== mt.document || !i.Element)
|
|
159
159
|
return t.isSupported = !1, t;
|
|
160
160
|
let {
|
|
161
161
|
document: e
|
|
@@ -170,12 +170,12 @@ function Qe() {
|
|
|
170
170
|
HTMLFormElement: b,
|
|
171
171
|
DOMParser: G,
|
|
172
172
|
trustedTypes: H
|
|
173
|
-
} = i, B = p.prototype, un =
|
|
173
|
+
} = i, B = p.prototype, un = ht(B, "cloneNode"), pn = ht(B, "remove"), hn = ht(B, "nextSibling"), mn = ht(B, "childNodes"), At = ht(B, "parentNode");
|
|
174
174
|
if (typeof c == "function") {
|
|
175
175
|
const f = e.createElement("template");
|
|
176
176
|
f.content && f.content.ownerDocument && (e = f.content.ownerDocument);
|
|
177
177
|
}
|
|
178
|
-
let O,
|
|
178
|
+
let O, rt = "";
|
|
179
179
|
const {
|
|
180
180
|
implementation: xt,
|
|
181
181
|
createNodeIterator: dn,
|
|
@@ -185,7 +185,7 @@ function Qe() {
|
|
|
185
185
|
importNode: gn
|
|
186
186
|
} = n;
|
|
187
187
|
let C = Ve();
|
|
188
|
-
t.isSupported = typeof Ke == "function" && typeof
|
|
188
|
+
t.isSupported = typeof Ke == "function" && typeof At == "function" && xt && xt.createHTMLDocument !== void 0;
|
|
189
189
|
const {
|
|
190
190
|
MUSTACHE_EXPR: kt,
|
|
191
191
|
ERB_EXPR: Ft,
|
|
@@ -201,7 +201,7 @@ function Qe() {
|
|
|
201
201
|
} = Ye, _ = null;
|
|
202
202
|
const Te = d({}, [...We, ...te, ...ee, ...ne, ...Ge]);
|
|
203
203
|
let S = null;
|
|
204
|
-
const Ee = d({}, [...Be, ...oe, ...je, ...
|
|
204
|
+
const Ee = d({}, [...Be, ...oe, ...je, ...Mt]);
|
|
205
205
|
let E = Object.seal(ce(null, {
|
|
206
206
|
tagNameCheck: {
|
|
207
207
|
writable: !0,
|
|
@@ -221,7 +221,7 @@ function Qe() {
|
|
|
221
221
|
enumerable: !0,
|
|
222
222
|
value: !1
|
|
223
223
|
}
|
|
224
|
-
})),
|
|
224
|
+
})), at = null, Ht = null;
|
|
225
225
|
const K = Object.seal(ce(null, {
|
|
226
226
|
tagCheck: {
|
|
227
227
|
writable: !0,
|
|
@@ -236,19 +236,19 @@ function Qe() {
|
|
|
236
236
|
value: null
|
|
237
237
|
}
|
|
238
238
|
}));
|
|
239
|
-
let ge = !0, zt = !0, Ae = !1, _e = !0, Z = !1,
|
|
239
|
+
let ge = !0, zt = !0, Ae = !1, _e = !0, Z = !1, _t = !0, V = !1, $t = !1, Wt = !1, J = !1, bt = !1, St = !1, be = !0, Se = !1;
|
|
240
240
|
const yn = "user-content-";
|
|
241
|
-
let Gt = !0,
|
|
241
|
+
let Gt = !0, ct = !1, Q = {}, v = null;
|
|
242
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
243
|
let ye = null;
|
|
244
244
|
const Re = d({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
245
245
|
let jt = null;
|
|
246
|
-
const we = d({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]),
|
|
246
|
+
const we = d({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), yt = "http://www.w3.org/1998/Math/MathML", Rt = "http://www.w3.org/2000/svg", z = "http://www.w3.org/1999/xhtml";
|
|
247
247
|
let tt = z, Yt = !1, Vt = null;
|
|
248
|
-
const Rn = d({}, [
|
|
249
|
-
let
|
|
248
|
+
const Rn = d({}, [yt, Rt, z], Jt);
|
|
249
|
+
let wt = d({}, ["mi", "mo", "mn", "ms", "mtext"]), Ot = d({}, ["annotation-xml"]);
|
|
250
250
|
const wn = d({}, ["title", "style", "font", "a", "script"]);
|
|
251
|
-
let
|
|
251
|
+
let lt = null;
|
|
252
252
|
const On = ["application/xhtml+xml", "text/html"], Cn = "text/html";
|
|
253
253
|
let A = null, et = null;
|
|
254
254
|
const Mn = e.createElement("form"), Oe = function(o) {
|
|
@@ -256,48 +256,48 @@ function Qe() {
|
|
|
256
256
|
}, Xt = function() {
|
|
257
257
|
let o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
258
258
|
if (!(et && et === o)) {
|
|
259
|
-
if ((!o || typeof o != "object") && (o = {}), o = k(o),
|
|
260
|
-
On.indexOf(o.PARSER_MEDIA_TYPE) === -1 ? Cn : o.PARSER_MEDIA_TYPE, A =
|
|
259
|
+
if ((!o || typeof o != "object") && (o = {}), o = k(o), lt = // eslint-disable-next-line unicorn/prefer-includes
|
|
260
|
+
On.indexOf(o.PARSER_MEDIA_TYPE) === -1 ? Cn : o.PARSER_MEDIA_TYPE, A = lt === "application/xhtml+xml" ? Jt : Nt, _ = P(o, "ALLOWED_TAGS") ? d({}, o.ALLOWED_TAGS, A) : Te, S = P(o, "ALLOWED_ATTR") ? d({}, o.ALLOWED_ATTR, A) : Ee, Vt = P(o, "ALLOWED_NAMESPACES") ? d({}, o.ALLOWED_NAMESPACES, Jt) : Rn, jt = P(o, "ADD_URI_SAFE_ATTR") ? d(k(we), o.ADD_URI_SAFE_ATTR, A) : we, ye = P(o, "ADD_DATA_URI_TAGS") ? d(k(Re), o.ADD_DATA_URI_TAGS, A) : Re, v = P(o, "FORBID_CONTENTS") ? d({}, o.FORBID_CONTENTS, A) : Bt, at = P(o, "FORBID_TAGS") ? d({}, o.FORBID_TAGS, A) : k({}), Ht = P(o, "FORBID_ATTR") ? d({}, o.FORBID_ATTR, A) : k({}), Q = P(o, "USE_PROFILES") ? o.USE_PROFILES : !1, ge = 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, _t = o.SAFE_FOR_XML !== !1, V = o.WHOLE_DOCUMENT || !1, J = o.RETURN_DOM || !1, bt = o.RETURN_DOM_FRAGMENT || !1, St = o.RETURN_TRUSTED_TYPE || !1, Wt = o.FORCE_BODY || !1, be = o.SANITIZE_DOM !== !1, Se = o.SANITIZE_NAMED_PROPS || !1, Gt = o.KEEP_CONTENT !== !1, ct = o.IN_PLACE || !1, de = o.ALLOWED_URI_REGEXP || Ze, tt = o.NAMESPACE || z, wt = o.MATHML_TEXT_INTEGRATION_POINTS || wt, Ot = o.HTML_INTEGRATION_POINTS || Ot, E = o.CUSTOM_ELEMENT_HANDLING || {}, o.CUSTOM_ELEMENT_HANDLING && Oe(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (E.tagNameCheck = o.CUSTOM_ELEMENT_HANDLING.tagNameCheck), o.CUSTOM_ELEMENT_HANDLING && Oe(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), Z && (zt = !1), bt && (J = !0), Q && (_ = d({}, Ge), S = [], Q.html === !0 && (d(_, We), d(S, Be)), Q.svg === !0 && (d(_, te), d(S, oe), d(S, Mt)), Q.svgFilters === !0 && (d(_, ee), d(S, oe), d(S, Mt)), Q.mathMl === !0 && (d(_, ne), d(S, je), d(S, Mt))), o.ADD_TAGS && (typeof o.ADD_TAGS == "function" ? K.tagCheck = o.ADD_TAGS : (_ === Te && (_ = k(_)), d(_, o.ADD_TAGS, A))), o.ADD_ATTR && (typeof o.ADD_ATTR == "function" ? K.attributeCheck = o.ADD_ATTR : (S === Ee && (S = k(S)), d(S, o.ADD_ATTR, A))), o.ADD_URI_SAFE_ATTR && d(jt, o.ADD_URI_SAFE_ATTR, A), o.FORBID_CONTENTS && (v === Bt && (v = k(v)), d(v, o.FORBID_CONTENTS, A)), o.ADD_FORBID_CONTENTS && (v === Bt && (v = k(v)), d(v, o.ADD_FORBID_CONTENTS, A)), Gt && (_["#text"] = !0), V && d(_, ["html", "head", "body"]), _.table && (d(_, ["tbody"]), delete at.tbody), o.TRUSTED_TYPES_POLICY) {
|
|
261
261
|
if (typeof o.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
262
|
-
throw
|
|
262
|
+
throw pt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
263
263
|
if (typeof o.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
264
|
-
throw
|
|
265
|
-
O = o.TRUSTED_TYPES_POLICY,
|
|
264
|
+
throw pt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
265
|
+
O = o.TRUSTED_TYPES_POLICY, rt = O.createHTML("");
|
|
266
266
|
} else
|
|
267
|
-
O === void 0 && (O = Zn(H, s)), O !== null && typeof
|
|
268
|
-
|
|
267
|
+
O === void 0 && (O = Zn(H, s)), O !== null && typeof rt == "string" && (rt = O.createHTML(""));
|
|
268
|
+
L && L(o), et = o;
|
|
269
269
|
}
|
|
270
|
-
}, Ce = d({}, [...te, ...ee, ...zn]), Me = d({}, [...ne, ...$n]),
|
|
271
|
-
let a =
|
|
270
|
+
}, Ce = d({}, [...te, ...ee, ...zn]), Me = d({}, [...ne, ...$n]), Ln = function(o) {
|
|
271
|
+
let a = At(o);
|
|
272
272
|
(!a || !a.tagName) && (a = {
|
|
273
273
|
namespaceURI: tt,
|
|
274
274
|
tagName: "template"
|
|
275
275
|
});
|
|
276
276
|
const l = Nt(o.tagName), T = Nt(a.tagName);
|
|
277
|
-
return Vt[o.namespaceURI] ? o.namespaceURI ===
|
|
277
|
+
return Vt[o.namespaceURI] ? o.namespaceURI === Rt ? a.namespaceURI === z ? l === "svg" : a.namespaceURI === yt ? l === "svg" && (T === "annotation-xml" || wt[T]) : !!Ce[l] : o.namespaceURI === yt ? a.namespaceURI === z ? l === "math" : a.namespaceURI === Rt ? l === "math" && Ot[T] : !!Me[l] : o.namespaceURI === z ? a.namespaceURI === Rt && !Ot[T] || a.namespaceURI === yt && !wt[T] ? !1 : !Me[l] && (wn[l] || !Ce[l]) : !!(lt === "application/xhtml+xml" && Vt[o.namespaceURI]) : !1;
|
|
278
278
|
}, x = function(o) {
|
|
279
|
-
|
|
279
|
+
ft(t.removed, {
|
|
280
280
|
element: o
|
|
281
281
|
});
|
|
282
282
|
try {
|
|
283
|
-
|
|
283
|
+
At(o).removeChild(o);
|
|
284
284
|
} catch {
|
|
285
285
|
pn(o);
|
|
286
286
|
}
|
|
287
287
|
}, X = function(o, a) {
|
|
288
288
|
try {
|
|
289
|
-
|
|
289
|
+
ft(t.removed, {
|
|
290
290
|
attribute: a.getAttributeNode(o),
|
|
291
291
|
from: a
|
|
292
292
|
});
|
|
293
293
|
} catch {
|
|
294
|
-
|
|
294
|
+
ft(t.removed, {
|
|
295
295
|
attribute: null,
|
|
296
296
|
from: a
|
|
297
297
|
});
|
|
298
298
|
}
|
|
299
299
|
if (a.removeAttribute(o), o === "is")
|
|
300
|
-
if (J ||
|
|
300
|
+
if (J || bt)
|
|
301
301
|
try {
|
|
302
302
|
x(a);
|
|
303
303
|
} catch {
|
|
@@ -307,7 +307,7 @@ function Qe() {
|
|
|
307
307
|
a.setAttribute(o, "");
|
|
308
308
|
} catch {
|
|
309
309
|
}
|
|
310
|
-
},
|
|
310
|
+
}, Le = function(o) {
|
|
311
311
|
let a = null, l = null;
|
|
312
312
|
if (Wt)
|
|
313
313
|
o = "<remove></remove>" + o;
|
|
@@ -315,23 +315,23 @@ function Qe() {
|
|
|
315
315
|
const g = Qt(o, /^[\r\n\t ]+/);
|
|
316
316
|
l = g && g[0];
|
|
317
317
|
}
|
|
318
|
-
|
|
318
|
+
lt === "application/xhtml+xml" && tt === z && (o = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + o + "</body></html>");
|
|
319
319
|
const T = O ? O.createHTML(o) : o;
|
|
320
320
|
if (tt === z)
|
|
321
321
|
try {
|
|
322
|
-
a = new G().parseFromString(T,
|
|
322
|
+
a = new G().parseFromString(T, lt);
|
|
323
323
|
} catch {
|
|
324
324
|
}
|
|
325
325
|
if (!a || !a.documentElement) {
|
|
326
326
|
a = xt.createDocument(tt, "template", null);
|
|
327
327
|
try {
|
|
328
|
-
a.documentElement.innerHTML = Yt ?
|
|
328
|
+
a.documentElement.innerHTML = Yt ? rt : T;
|
|
329
329
|
} catch {
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
332
|
const w = a.body || a.documentElement;
|
|
333
333
|
return o && l && w.insertBefore(e.createTextNode(l), w.childNodes[0] || null), tt === z ? En.call(a, V ? "html" : "body")[0] : V ? a.documentElement : w;
|
|
334
|
-
},
|
|
334
|
+
}, Ne = function(o) {
|
|
335
335
|
return dn.call(
|
|
336
336
|
o.ownerDocument || o,
|
|
337
337
|
o,
|
|
@@ -345,7 +345,7 @@ function Qe() {
|
|
|
345
345
|
return typeof u == "function" && o instanceof u;
|
|
346
346
|
};
|
|
347
347
|
function $(f, o, a) {
|
|
348
|
-
|
|
348
|
+
Ct(f, (l) => {
|
|
349
349
|
l.call(t, o, a, et);
|
|
350
350
|
});
|
|
351
351
|
}
|
|
@@ -357,13 +357,13 @@ function Qe() {
|
|
|
357
357
|
if ($(C.uponSanitizeElement, o, {
|
|
358
358
|
tagName: l,
|
|
359
359
|
allowedTags: _
|
|
360
|
-
}),
|
|
360
|
+
}), _t && o.hasChildNodes() && !De(o.firstElementChild) && M(/<[/\w!]/g, o.innerHTML) && M(/<[/\w!]/g, o.textContent) || o.nodeType === mt.progressingInstruction || _t && o.nodeType === mt.comment && M(/<[/\w]/g, o.data))
|
|
361
361
|
return x(o), !0;
|
|
362
|
-
if (!(K.tagCheck instanceof Function && K.tagCheck(l)) && (!_[l] ||
|
|
363
|
-
if (!
|
|
362
|
+
if (!(K.tagCheck instanceof Function && K.tagCheck(l)) && (!_[l] || at[l])) {
|
|
363
|
+
if (!at[l] && ve(l) && (E.tagNameCheck instanceof RegExp && M(E.tagNameCheck, l) || E.tagNameCheck instanceof Function && E.tagNameCheck(l)))
|
|
364
364
|
return !1;
|
|
365
365
|
if (Gt && !v[l]) {
|
|
366
|
-
const T =
|
|
366
|
+
const T = At(o) || o.parentNode, w = mn(o) || o.childNodes;
|
|
367
367
|
if (w && T) {
|
|
368
368
|
const g = w.length;
|
|
369
369
|
for (let D = g - 1; D >= 0; --D) {
|
|
@@ -374,9 +374,9 @@ function Qe() {
|
|
|
374
374
|
}
|
|
375
375
|
return x(o), !0;
|
|
376
376
|
}
|
|
377
|
-
return o instanceof p && !
|
|
378
|
-
a =
|
|
379
|
-
}), o.textContent !== a && (
|
|
377
|
+
return o instanceof p && !Ln(o) || (l === "noscript" || l === "noembed" || l === "noframes") && M(/<\/no(script|embed|frames)/i, o.innerHTML) ? (x(o), !0) : (Z && o.nodeType === mt.text && (a = o.textContent, Ct([kt, Ft, Ut], (T) => {
|
|
378
|
+
a = ut(a, T, " ");
|
|
379
|
+
}), o.textContent !== a && (ft(t.removed, {
|
|
380
380
|
element: o.cloneNode()
|
|
381
381
|
}), o.textContent = a)), $(C.afterSanitizeElements, o, null), !1);
|
|
382
382
|
}, Pe = function(o, a, l) {
|
|
@@ -395,9 +395,9 @@ function Qe() {
|
|
|
395
395
|
a === "is" && E.allowCustomizedBuiltInElements && (E.tagNameCheck instanceof RegExp && M(E.tagNameCheck, l) || E.tagNameCheck instanceof Function && E.tagNameCheck(l)))
|
|
396
396
|
) return !1;
|
|
397
397
|
} else if (!jt[a]) {
|
|
398
|
-
if (!M(de,
|
|
398
|
+
if (!M(de, ut(l, me, ""))) {
|
|
399
399
|
if (!((a === "src" || a === "xlink:href" || a === "href") && o !== "script" && kn(l, "data:") === 0 && ye[o])) {
|
|
400
|
-
if (!(Ae && !M(bn,
|
|
400
|
+
if (!(Ae && !M(bn, ut(l, me, "")))) {
|
|
401
401
|
if (l)
|
|
402
402
|
return !1;
|
|
403
403
|
}
|
|
@@ -432,7 +432,7 @@ function Qe() {
|
|
|
432
432
|
value: W
|
|
433
433
|
} = w, nt = A(g), Kt = W;
|
|
434
434
|
let y = g === "value" ? Kt : Fn(Kt);
|
|
435
|
-
if (l.attrName = nt, l.attrValue = y, l.keepAttr = !0, l.forceKeepAttr = void 0, $(C.uponSanitizeAttribute, o, l), y = l.attrValue, Se && (nt === "id" || nt === "name") && (X(g, o), y = yn + y),
|
|
435
|
+
if (l.attrName = nt, l.attrValue = y, l.keepAttr = !0, l.forceKeepAttr = void 0, $(C.uponSanitizeAttribute, o, l), y = l.attrValue, Se && (nt === "id" || nt === "name") && (X(g, o), y = yn + y), _t && M(/((--!?|])>)|<\/(style|title|textarea)/i, y)) {
|
|
436
436
|
X(g, o);
|
|
437
437
|
continue;
|
|
438
438
|
}
|
|
@@ -450,8 +450,8 @@ function Qe() {
|
|
|
450
450
|
X(g, o);
|
|
451
451
|
continue;
|
|
452
452
|
}
|
|
453
|
-
Z &&
|
|
454
|
-
y =
|
|
453
|
+
Z && Ct([kt, Ft, Ut], (Fe) => {
|
|
454
|
+
y = ut(y, Fe, " ");
|
|
455
455
|
});
|
|
456
456
|
const ke = A(o.nodeName);
|
|
457
457
|
if (!Pe(ke, nt, y)) {
|
|
@@ -477,9 +477,9 @@ function Qe() {
|
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
479
|
$(C.afterSanitizeAttributes, o, null);
|
|
480
|
-
},
|
|
480
|
+
}, Nn = function f(o) {
|
|
481
481
|
let a = null;
|
|
482
|
-
const l =
|
|
482
|
+
const l = Ne(o);
|
|
483
483
|
for ($(C.beforeSanitizeShadowDOM, o, null); a = l.nextNode(); )
|
|
484
484
|
$(C.uponSanitizeShadowNode, a, null), Ie(a), xe(a), a.content instanceof r && f(a.content);
|
|
485
485
|
$(C.afterSanitizeShadowDOM, o, null);
|
|
@@ -489,34 +489,34 @@ function Qe() {
|
|
|
489
489
|
if (Yt = !f, Yt && (f = "<!-->"), typeof f != "string" && !De(f))
|
|
490
490
|
if (typeof f.toString == "function") {
|
|
491
491
|
if (f = f.toString(), typeof f != "string")
|
|
492
|
-
throw
|
|
492
|
+
throw pt("dirty is not a string, aborting");
|
|
493
493
|
} else
|
|
494
|
-
throw
|
|
494
|
+
throw pt("toString is not a function");
|
|
495
495
|
if (!t.isSupported)
|
|
496
496
|
return f;
|
|
497
|
-
if ($t || Xt(o), t.removed = [], typeof f == "string" && (
|
|
497
|
+
if ($t || Xt(o), t.removed = [], typeof f == "string" && (ct = !1), ct) {
|
|
498
498
|
if (f.nodeName) {
|
|
499
499
|
const W = A(f.nodeName);
|
|
500
|
-
if (!_[W] ||
|
|
501
|
-
throw
|
|
500
|
+
if (!_[W] || at[W])
|
|
501
|
+
throw pt("root node is forbidden and cannot be sanitized in-place");
|
|
502
502
|
}
|
|
503
503
|
} else if (f instanceof u)
|
|
504
|
-
a =
|
|
504
|
+
a = Le("<!---->"), l = a.ownerDocument.importNode(f, !0), l.nodeType === mt.element && l.nodeName === "BODY" || l.nodeName === "HTML" ? a = l : a.appendChild(l);
|
|
505
505
|
else {
|
|
506
506
|
if (!J && !Z && !V && // eslint-disable-next-line unicorn/prefer-includes
|
|
507
507
|
f.indexOf("<") === -1)
|
|
508
|
-
return O &&
|
|
509
|
-
if (a =
|
|
510
|
-
return J ? null :
|
|
508
|
+
return O && St ? O.createHTML(f) : f;
|
|
509
|
+
if (a = Le(f), !a)
|
|
510
|
+
return J ? null : St ? rt : "";
|
|
511
511
|
}
|
|
512
512
|
a && Wt && x(a.firstChild);
|
|
513
|
-
const g =
|
|
513
|
+
const g = Ne(ct ? f : a);
|
|
514
514
|
for (; T = g.nextNode(); )
|
|
515
|
-
Ie(T), xe(T), T.content instanceof r &&
|
|
516
|
-
if (
|
|
515
|
+
Ie(T), xe(T), T.content instanceof r && Nn(T.content);
|
|
516
|
+
if (ct)
|
|
517
517
|
return f;
|
|
518
518
|
if (J) {
|
|
519
|
-
if (
|
|
519
|
+
if (bt)
|
|
520
520
|
for (w = Tn.call(a.ownerDocument); a.firstChild; )
|
|
521
521
|
w.appendChild(a.firstChild);
|
|
522
522
|
else
|
|
@@ -525,9 +525,9 @@ function Qe() {
|
|
|
525
525
|
}
|
|
526
526
|
let D = V ? a.outerHTML : a.innerHTML;
|
|
527
527
|
return V && _["!doctype"] && a.ownerDocument && a.ownerDocument.doctype && a.ownerDocument.doctype.name && M(Je, a.ownerDocument.doctype.name) && (D = "<!DOCTYPE " + a.ownerDocument.doctype.name + `>
|
|
528
|
-
` + D), Z &&
|
|
529
|
-
D =
|
|
530
|
-
}), O &&
|
|
528
|
+
` + D), Z && Ct([kt, Ft, Ut], (W) => {
|
|
529
|
+
D = ut(D, W, " ");
|
|
530
|
+
}), O && St ? O.createHTML(D) : D;
|
|
531
531
|
}, t.setConfig = function() {
|
|
532
532
|
let f = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
533
533
|
Xt(f), $t = !0;
|
|
@@ -538,7 +538,7 @@ function Qe() {
|
|
|
538
538
|
const l = A(f), T = A(o);
|
|
539
539
|
return Pe(l, T, a);
|
|
540
540
|
}, t.addHook = function(f, o) {
|
|
541
|
-
typeof o == "function" &&
|
|
541
|
+
typeof o == "function" && ft(C[f], o);
|
|
542
542
|
}, t.removeHook = function(f, o) {
|
|
543
543
|
if (o !== void 0) {
|
|
544
544
|
const a = vn(C[f], o);
|
|
@@ -598,31 +598,31 @@ function nn(i) {
|
|
|
598
598
|
}
|
|
599
599
|
return t;
|
|
600
600
|
}
|
|
601
|
-
const
|
|
601
|
+
const Dt = typeof window < "u" && typeof window.document < "u";
|
|
602
602
|
let qe = class extends Error {
|
|
603
603
|
};
|
|
604
|
-
var q, Pt, F,
|
|
605
|
-
const
|
|
604
|
+
var q, Pt, F, Et, gt, Y, vt, on;
|
|
605
|
+
const it = class it {
|
|
606
606
|
constructor(t, e, n) {
|
|
607
607
|
j(this, vt);
|
|
608
608
|
j(this, Pt, /* @__PURE__ */ Symbol("objectId"));
|
|
609
609
|
// This cannot be replaced by a WeakMap<ChangeListener, Set<string>>
|
|
610
610
|
// because there is no way to iterate over the keys of a WeakMap.
|
|
611
611
|
j(this, F, []);
|
|
612
|
-
j(this, Tt);
|
|
613
612
|
j(this, Et);
|
|
613
|
+
j(this, gt);
|
|
614
614
|
j(this, Y);
|
|
615
615
|
if (!t) throw new qe("name cannot be empty");
|
|
616
|
-
if (R(
|
|
616
|
+
if (R(it, q).has(t))
|
|
617
617
|
throw new qe(`WrecState with name "${t}" already exists`);
|
|
618
|
-
if (ot(this,
|
|
618
|
+
if (ot(this, Et, t), ot(this, gt, e), ot(this, Y, en({}, He(this, vt, on).bind(this))), e && Dt) {
|
|
619
619
|
const s = sessionStorage.getItem("wrec-state-" + t), r = s ? JSON.parse(s) : void 0;
|
|
620
620
|
r && (n = r);
|
|
621
621
|
}
|
|
622
622
|
if (n)
|
|
623
623
|
for (const [s, r] of Object.entries(n))
|
|
624
624
|
this.addProperty(s, r);
|
|
625
|
-
R(
|
|
625
|
+
R(it, q).set(t, this);
|
|
626
626
|
}
|
|
627
627
|
// This static method is useful for accessing a specific WrecState object
|
|
628
628
|
// from the DevTools console. For example:
|
|
@@ -672,7 +672,7 @@ const st = class st {
|
|
|
672
672
|
// This is useful for debugging from the DevTools console.
|
|
673
673
|
// For example: state.log()
|
|
674
674
|
log() {
|
|
675
|
-
console.log("WrecState:", R(this,
|
|
675
|
+
console.log("WrecState:", R(this, Et));
|
|
676
676
|
for (const [t, e] of Object.entries(R(this, Y)))
|
|
677
677
|
console.log(` ${t} = ${JSON.stringify(e)}`);
|
|
678
678
|
}
|
|
@@ -680,13 +680,13 @@ const st = class st {
|
|
|
680
680
|
ot(this, F, R(this, F).filter((e) => e.listenerRef.deref() !== t));
|
|
681
681
|
}
|
|
682
682
|
};
|
|
683
|
-
q = new WeakMap(), Pt = new WeakMap(), F = new WeakMap(),
|
|
683
|
+
q = new WeakMap(), Pt = new WeakMap(), F = new WeakMap(), Et = new WeakMap(), gt = new WeakMap(), Y = new WeakMap(), vt = new WeakSet(), on = function(t, e, n) {
|
|
684
684
|
const s = /* @__PURE__ */ new Set();
|
|
685
685
|
for (const r of R(this, F)) {
|
|
686
686
|
const c = r.listenerRef.deref();
|
|
687
687
|
if (!c)
|
|
688
688
|
s.add(r);
|
|
689
|
-
else if (
|
|
689
|
+
else if (Dt && c instanceof HTMLElement && !c.isConnected)
|
|
690
690
|
s.add(r);
|
|
691
691
|
else {
|
|
692
692
|
const { propertyMap: u } = r, p = Object.keys(u);
|
|
@@ -702,15 +702,15 @@ q = new WeakMap(), Pt = new WeakMap(), F = new WeakMap(), Tt = new WeakMap(), Et
|
|
|
702
702
|
ot(this, F, R(this, F).filter(
|
|
703
703
|
(r) => !s.has(r)
|
|
704
704
|
));
|
|
705
|
-
}, j(
|
|
706
|
-
for (const [t, e] of R(
|
|
707
|
-
if (R(e,
|
|
705
|
+
}, j(it, q, /* @__PURE__ */ new Map()), Dt && window.addEventListener("beforeunload", () => {
|
|
706
|
+
for (const [t, e] of R(it, q).entries())
|
|
707
|
+
if (R(e, gt)) {
|
|
708
708
|
const n = nn(e);
|
|
709
709
|
sessionStorage.setItem("wrec-state-" + t, JSON.stringify(n));
|
|
710
710
|
}
|
|
711
711
|
});
|
|
712
|
-
let ue =
|
|
713
|
-
|
|
712
|
+
let ue = it;
|
|
713
|
+
Dt && process.env.NODE_ENV === "development" && (window.WrecState = ue);
|
|
714
714
|
const Qn = /* @__PURE__ */ new Set([
|
|
715
715
|
"onblur",
|
|
716
716
|
"onchange",
|
|
@@ -725,9 +725,9 @@ tn.addHook("uponSanitizeAttribute", (i, t) => {
|
|
|
725
725
|
const { attrName: e } = t, n = e.toLowerCase();
|
|
726
726
|
Qn.has(n) && (t.forceKeepAttr = !0);
|
|
727
727
|
});
|
|
728
|
-
class
|
|
728
|
+
class st extends Error {
|
|
729
729
|
}
|
|
730
|
-
const to = /([a-zA-Z-]+)\s*:\s*([^;}]+)/g, sn = "a-zA-Z_$", eo = sn + "0-9",
|
|
730
|
+
const to = /([a-zA-Z-]+)\s*:\s*([^;}]+)/g, sn = "a-zA-Z_$", eo = sn + "0-9", Tt = `[${sn}][${eo}]*`, no = /<!--\s*(.*?)\s*-->/, oo = /<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g, se = new RegExp(`^this\\.${Tt}$`), ie = new RegExp(`this\\.${Tt}(\\.${Tt})*`, "g"), rn = new RegExp(`this\\.${Tt}(\\.${Tt})*`), so = /* @__PURE__ */ new Set(["class", "style"]), an = 5;
|
|
731
731
|
function io(i) {
|
|
732
732
|
return i instanceof HTMLButtonElement || i instanceof HTMLFieldSetElement || i instanceof HTMLInputElement || i instanceof HTMLSelectElement || i instanceof HTMLTextAreaElement || i instanceof U;
|
|
733
733
|
}
|
|
@@ -746,7 +746,7 @@ function It(i) {
|
|
|
746
746
|
t.push(e), e.shadowRoot && t.push(...It(e.shadowRoot)), e.firstElementChild && t.push(...It(e)), e = e.nextElementSibling;
|
|
747
747
|
return t;
|
|
748
748
|
}
|
|
749
|
-
const
|
|
749
|
+
const Lt = (i) => i.substring(an).split(".")[0];
|
|
750
750
|
function cn(i, t) {
|
|
751
751
|
let e = i[0];
|
|
752
752
|
return t.forEach((n, s) => {
|
|
@@ -757,7 +757,7 @@ function pe(i) {
|
|
|
757
757
|
const t = typeof i;
|
|
758
758
|
return t === "string" || t === "number" || t === "boolean";
|
|
759
759
|
}
|
|
760
|
-
function
|
|
760
|
+
function dt(i) {
|
|
761
761
|
return i.localName === "textarea";
|
|
762
762
|
}
|
|
763
763
|
function he(i) {
|
|
@@ -784,7 +784,7 @@ function co(i) {
|
|
|
784
784
|
}
|
|
785
785
|
function re(i) {
|
|
786
786
|
const t = Number(i);
|
|
787
|
-
if (isNaN(t)) throw new
|
|
787
|
+
if (isNaN(t)) throw new st(`can't convert "${i}" to a number`);
|
|
788
788
|
return t;
|
|
789
789
|
}
|
|
790
790
|
function fn(i, t, e) {
|
|
@@ -887,7 +887,9 @@ class U extends HTMLElement {
|
|
|
887
887
|
// when the corresponding child property value changes.
|
|
888
888
|
#u = /* @__PURE__ */ new Map();
|
|
889
889
|
static define(t) {
|
|
890
|
-
this.elementName = t, customElements.
|
|
890
|
+
if (this.elementName = t, customElements.get(t))
|
|
891
|
+
throw new st(`custom element ${t} is already defined`);
|
|
892
|
+
customElements.define(t, this);
|
|
891
893
|
}
|
|
892
894
|
constructor() {
|
|
893
895
|
super(), this.attachShadow({ mode: "open" });
|
|
@@ -914,6 +916,7 @@ class U extends HTMLElement {
|
|
|
914
916
|
t.css && (n += t.css), n += `</style>
|
|
915
917
|
`;
|
|
916
918
|
let s = t.html.trim();
|
|
919
|
+
if (!s) throw new st("static property html must be set");
|
|
917
920
|
s.startsWith("<") || (s = `<span><!--${s}--></span>`), e.innerHTML = n + s;
|
|
918
921
|
}
|
|
919
922
|
await lo(e), this.shadowRoot.replaceChildren(e.content.cloneNode(!0));
|
|
@@ -942,7 +945,7 @@ class U extends HTMLElement {
|
|
|
942
945
|
let c = e.value;
|
|
943
946
|
this.hasOwnProperty(t) && (c = this[t], delete this[t]);
|
|
944
947
|
const { type: u } = e, p = u === Boolean ? c || r : n.includes(s) && r ? this.#g(t, s) : c || ro(u), h = "#" + t;
|
|
945
|
-
this[h] = p, e.computed && this.#
|
|
948
|
+
this[h] = p, e.computed && this.#L(t, e), Object.defineProperty(this, t, {
|
|
946
949
|
enumerable: !0,
|
|
947
950
|
get() {
|
|
948
951
|
return this[h];
|
|
@@ -953,7 +956,7 @@ class U extends HTMLElement {
|
|
|
953
956
|
if (m === b) return;
|
|
954
957
|
this.#x(t, u, m), this[h] = m;
|
|
955
958
|
const { state: G, stateProp: H } = this.#t.properties[t];
|
|
956
|
-
H && Jn(G, H, m), this.#D(t), this.#
|
|
959
|
+
H && Jn(G, H, m), this.#D(t), this.#N(t, u, m, s), this.#E(t), this.#I(t, m);
|
|
957
960
|
const B = this.#c[t];
|
|
958
961
|
B && this.setFormValue(B, String(m)), this.propertyChangedCallback(t, b, m), e.dispatch && this.dispatch("change", {
|
|
959
962
|
tagName: this.localName,
|
|
@@ -1021,7 +1024,7 @@ class U extends HTMLElement {
|
|
|
1021
1024
|
}
|
|
1022
1025
|
} else {
|
|
1023
1026
|
let n = "";
|
|
1024
|
-
if (
|
|
1027
|
+
if (dt(t)) {
|
|
1025
1028
|
this.#r(t.textContent, t);
|
|
1026
1029
|
const s = t.textContent?.match(no);
|
|
1027
1030
|
s && (n = s[1]);
|
|
@@ -1033,7 +1036,7 @@ class U extends HTMLElement {
|
|
|
1033
1036
|
}
|
|
1034
1037
|
if (n) {
|
|
1035
1038
|
const s = this.#T(t, n);
|
|
1036
|
-
s &&
|
|
1039
|
+
s && dt(t) ? t.textContent = this[s] : this.#r(n, t);
|
|
1037
1040
|
}
|
|
1038
1041
|
}
|
|
1039
1042
|
}
|
|
@@ -1082,11 +1085,11 @@ class U extends HTMLElement {
|
|
|
1082
1085
|
if (n.length !== 1) return;
|
|
1083
1086
|
const [s] = n;
|
|
1084
1087
|
if (!se.test(s)) return;
|
|
1085
|
-
const r = he(t) ||
|
|
1088
|
+
const r = he(t) || dt(t);
|
|
1086
1089
|
let [c, u] = (e ?? "").split(":");
|
|
1087
|
-
if (!(r && c === "value" ||
|
|
1090
|
+
if (!(r && c === "value" || dt(t))) return;
|
|
1088
1091
|
u ? t["on" + u] === void 0 && this.#e(t, e, "refers to an unsupported event name") : u = "change";
|
|
1089
|
-
const h =
|
|
1092
|
+
const h = Lt(s);
|
|
1090
1093
|
t.addEventListener(u, (m) => {
|
|
1091
1094
|
const { target: b } = m;
|
|
1092
1095
|
if (!b) return;
|
|
@@ -1106,7 +1109,7 @@ class U extends HTMLElement {
|
|
|
1106
1109
|
#d() {
|
|
1107
1110
|
if (this.#t.formAssociated || this.closest("form") === null) return;
|
|
1108
1111
|
const t = this.#t.name;
|
|
1109
|
-
throw new
|
|
1112
|
+
throw new st(
|
|
1110
1113
|
`inside form, class ${t} requires "static formAssociated = true;"`
|
|
1111
1114
|
);
|
|
1112
1115
|
}
|
|
@@ -1121,7 +1124,7 @@ class U extends HTMLElement {
|
|
|
1121
1124
|
}
|
|
1122
1125
|
#T(t, e) {
|
|
1123
1126
|
if (!e || !se.test(e)) return;
|
|
1124
|
-
const n =
|
|
1127
|
+
const n = Lt(e);
|
|
1125
1128
|
return this[n] === void 0 && this.#a(t, "", n), n;
|
|
1126
1129
|
}
|
|
1127
1130
|
#E(t) {
|
|
@@ -1138,7 +1141,7 @@ class U extends HTMLElement {
|
|
|
1138
1141
|
}
|
|
1139
1142
|
}
|
|
1140
1143
|
}
|
|
1141
|
-
#
|
|
1144
|
+
#L(t, e) {
|
|
1142
1145
|
const { computed: n, uses: s } = e, r = this.#t.propToComputedMap;
|
|
1143
1146
|
function c(p, h) {
|
|
1144
1147
|
let m = r.get(p);
|
|
@@ -1165,7 +1168,7 @@ class U extends HTMLElement {
|
|
|
1165
1168
|
}
|
|
1166
1169
|
const r = this.#t;
|
|
1167
1170
|
s.forEach((p) => {
|
|
1168
|
-
const h =
|
|
1171
|
+
const h = Lt(p);
|
|
1169
1172
|
if (typeof this[h] == "function") return;
|
|
1170
1173
|
const m = r.propToExprsMap;
|
|
1171
1174
|
let b = m.get(h);
|
|
@@ -1194,7 +1197,7 @@ class U extends HTMLElement {
|
|
|
1194
1197
|
}
|
|
1195
1198
|
#e(t, e, n) {
|
|
1196
1199
|
const s = t instanceof HTMLElement ? t.localName : "CSS rule";
|
|
1197
|
-
throw new
|
|
1200
|
+
throw new st(
|
|
1198
1201
|
`component ${this.#t.elementName}` + (t ? `, element "${s}"` : "") + (e ? `, attribute "${e}"` : "") + ` ${n}`
|
|
1199
1202
|
);
|
|
1200
1203
|
}
|
|
@@ -1218,7 +1221,7 @@ class U extends HTMLElement {
|
|
|
1218
1221
|
}
|
|
1219
1222
|
// Updates the matching attribute for a property if there is one.
|
|
1220
1223
|
// VS Code thinks this is never called, but it is called by #defineProp.
|
|
1221
|
-
#
|
|
1224
|
+
#N(t, e, n, s) {
|
|
1222
1225
|
if (pe(n) && this.hasAttribute(s)) {
|
|
1223
1226
|
const r = e === Boolean ? this.hasAttribute(s) : this.#g(t, s);
|
|
1224
1227
|
n !== r && fn(this, t, n);
|
|
@@ -1238,7 +1241,7 @@ class U extends HTMLElement {
|
|
|
1238
1241
|
t,
|
|
1239
1242
|
void 0,
|
|
1240
1243
|
" computed content is not a string or number"
|
|
1241
|
-
), t instanceof HTMLElement &&
|
|
1244
|
+
), t instanceof HTMLElement && dt(t))
|
|
1242
1245
|
t.value = e;
|
|
1243
1246
|
else if (n && s === "string" && e.trim().startsWith("<")) {
|
|
1244
1247
|
const r = co(e);
|
|
@@ -1305,7 +1308,7 @@ class U extends HTMLElement {
|
|
|
1305
1308
|
const s = n.match(ie);
|
|
1306
1309
|
if (s)
|
|
1307
1310
|
return s.forEach((r) => {
|
|
1308
|
-
const c =
|
|
1311
|
+
const c = Lt(r);
|
|
1309
1312
|
this[c] === void 0 && this.#a(t, e, c);
|
|
1310
1313
|
}), s;
|
|
1311
1314
|
}
|
|
@@ -1313,7 +1316,7 @@ class U extends HTMLElement {
|
|
|
1313
1316
|
for (const [n, s] of Object.entries(e)) {
|
|
1314
1317
|
let r = Xe(t, n);
|
|
1315
1318
|
if (r === void 0)
|
|
1316
|
-
throw new
|
|
1319
|
+
throw new st(`invalid state path "${n}"`);
|
|
1317
1320
|
r = this[s], this.#i(s) || this.#e(
|
|
1318
1321
|
null,
|
|
1319
1322
|
s,
|
package/dist/wrec.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(T,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(T=typeof globalThis<"u"?globalThis:T||self,g(T.wrec={}))})(this,(function(T){"use strict";var fn=T=>{throw TypeError(T)};var Ee=(T,g,M)=>g.has(T)||fn("Cannot "+M);var O=(T,g,M)=>(Ee(T,g,"read from private field"),M?M.call(T):g.get(T)),q=(T,g,M)=>g.has(T)?fn("Cannot add the same private member more than once"):g instanceof WeakSet?g.add(T):g.set(T,M),at=(T,g,M,bt)=>(Ee(T,g,"write to private field"),bt?bt.call(T,M):g.set(T,M),M),un=(T,g,M)=>(Ee(T,g,"access private method"),M);var K,Lt,H,dt,Tt,Y,Dt,pn;const{entries:g,setPrototypeOf:M,isFrozen:bt,getPrototypeOf:hn,getOwnPropertyDescriptor:mn}=Object;let{freeze:N,seal:x,create:zt}=Object,{apply:$t,construct:Wt}=typeof Reflect<"u"&&Reflect;N||(N=function(t){return t}),x||(x=function(t){return t}),$t||($t=function(t,e){for(var n=arguments.length,s=new Array(n>2?n-2:0),i=2;i<n;i++)s[i-2]=arguments[i];return t.apply(e,s)}),Wt||(Wt=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),s=1;s<e;s++)n[s-1]=arguments[s];return new t(...n)});const St=D(Array.prototype.forEach),dn=D(Array.prototype.lastIndexOf),ge=D(Array.prototype.pop),ct=D(Array.prototype.push),Tn=D(Array.prototype.splice),yt=D(String.prototype.toLowerCase),Gt=D(String.prototype.toString),Bt=D(String.prototype.match),lt=D(String.prototype.replace),En=D(String.prototype.indexOf),gn=D(String.prototype.trim),k=D(Object.prototype.hasOwnProperty),L=D(RegExp.prototype.test),ft=An(TypeError);function D(r){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var e=arguments.length,n=new Array(e>1?e-1:0),s=1;s<e;s++)n[s-1]=arguments[s];return $t(r,t,n)}}function An(r){return function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Wt(r,e)}}function d(r,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yt;M&&M(r,null);let n=t.length;for(;n--;){let s=t[n];if(typeof s=="string"){const i=e(s);i!==s&&(bt(t)||(t[n]=i),s=i)}r[s]=!0}return r}function _n(r){for(let t=0;t<r.length;t++)k(r,t)||(r[t]=null);return r}function U(r){const t=zt(null);for(const[e,n]of g(r))k(r,e)&&(Array.isArray(n)?t[e]=_n(n):n&&typeof n=="object"&&n.constructor===Object?t[e]=U(n):t[e]=n);return t}function ut(r,t){for(;r!==null;){const n=mn(r,t);if(n){if(n.get)return D(n.get);if(typeof n.value=="function")return D(n.value)}r=hn(r)}function e(){return null}return e}const Ae=N(["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"]),jt=N(["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"]),Yt=N(["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"]),bn=N(["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"]),Vt=N(["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"]),Sn=N(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_e=N(["#text"]),be=N(["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"]),Xt=N(["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"]),Se=N(["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"]),Rt=N(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),yn=x(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Rn=x(/<%[\w\W]*|[\w\W]*%>/gm),wn=x(/\$\{[\w\W]*/gm),On=x(/^data-[\-\w.\u00B7-\uFFFF]+$/),Cn=x(/^aria-[\-\w]+$/),ye=x(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Mn=x(/^(?:\w+script|data):/i),Nn=x(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Re=x(/^html$/i),Ln=x(/^[a-z][.\w]*(-[.\w]+)+$/i);var we=Object.freeze({__proto__:null,ARIA_ATTR:Cn,ATTR_WHITESPACE:Nn,CUSTOM_ELEMENT:Ln,DATA_ATTR:On,DOCTYPE_NAME:Re,ERB_EXPR:Rn,IS_ALLOWED_URI:ye,IS_SCRIPT_OR_DATA:Mn,MUSTACHE_EXPR:yn,TMPLIT_EXPR:wn});const pt={element:1,text:3,progressingInstruction:7,comment:8,document:9},Dn=function(){return typeof window>"u"?null:window},In=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null;const s="data-tt-policy-suffix";e&&e.hasAttribute(s)&&(n=e.getAttribute(s));const i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Oe=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ce(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Dn();const t=f=>Ce(f);if(t.version="3.3.1",t.removed=[],!r||!r.document||r.document.nodeType!==pt.document||!r.Element)return t.isSupported=!1,t;let{document:e}=r;const n=e,s=n.currentScript,{DocumentFragment:i,HTMLTemplateElement:c,Node:u,Element:p,NodeFilter:h,NamedNodeMap:m=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:y,DOMParser:V,trustedTypes:W}=r,X=p.prototype,Xn=ut(X,"cloneNode"),qn=ut(X,"remove"),Kn=ut(X,"nextSibling"),Zn=ut(X,"childNodes"),It=ut(X,"parentNode");if(typeof c=="function"){const f=e.createElement("template");f.content&&f.content.ownerDocument&&(e=f.content.ownerDocument)}let I,Et="";const{implementation:ee,createNodeIterator:Jn,createDocumentFragment:Qn,getElementsByTagName:to}=e,{importNode:eo}=n;let P=Oe();t.isSupported=typeof g=="function"&&typeof It=="function"&&ee&&ee.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ne,ERB_EXPR:oe,TMPLIT_EXPR:se,DATA_ATTR:no,ARIA_ATTR:oo,IS_SCRIPT_OR_DATA:so,ATTR_WHITESPACE:He,CUSTOM_ELEMENT:io}=we;let{IS_ALLOWED_URI:ze}=we,S=null;const $e=d({},[...Ae,...jt,...Yt,...Vt,..._e]);let R=null;const We=d({},[...be,...Xt,...Se,...Rt]);let A=Object.seal(zt(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),gt=null,ie=null;const tt=Object.seal(zt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ge=!0,re=!0,Be=!1,je=!0,et=!1,Pt=!0,Z=!1,ae=!1,ce=!1,nt=!1,vt=!1,xt=!1,Ye=!0,Ve=!1;const ro="user-content-";let le=!0,At=!1,ot={},z=null;const fe=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"]);let Xe=null;const qe=d({},["audio","video","img","source","image","track"]);let ue=null;const Ke=d({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),kt="http://www.w3.org/1998/Math/MathML",Ft="http://www.w3.org/2000/svg",G="http://www.w3.org/1999/xhtml";let st=G,pe=!1,he=null;const ao=d({},[kt,Ft,G],Gt);let Ut=d({},["mi","mo","mn","ms","mtext"]),Ht=d({},["annotation-xml"]);const co=d({},["title","style","font","a","script"]);let _t=null;const lo=["application/xhtml+xml","text/html"],fo="text/html";let b=null,it=null;const uo=e.createElement("form"),Ze=function(o){return o instanceof RegExp||o instanceof Function},me=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(it&&it===o)){if((!o||typeof o!="object")&&(o={}),o=U(o),_t=lo.indexOf(o.PARSER_MEDIA_TYPE)===-1?fo:o.PARSER_MEDIA_TYPE,b=_t==="application/xhtml+xml"?Gt:yt,S=k(o,"ALLOWED_TAGS")?d({},o.ALLOWED_TAGS,b):$e,R=k(o,"ALLOWED_ATTR")?d({},o.ALLOWED_ATTR,b):We,he=k(o,"ALLOWED_NAMESPACES")?d({},o.ALLOWED_NAMESPACES,Gt):ao,ue=k(o,"ADD_URI_SAFE_ATTR")?d(U(Ke),o.ADD_URI_SAFE_ATTR,b):Ke,Xe=k(o,"ADD_DATA_URI_TAGS")?d(U(qe),o.ADD_DATA_URI_TAGS,b):qe,z=k(o,"FORBID_CONTENTS")?d({},o.FORBID_CONTENTS,b):fe,gt=k(o,"FORBID_TAGS")?d({},o.FORBID_TAGS,b):U({}),ie=k(o,"FORBID_ATTR")?d({},o.FORBID_ATTR,b):U({}),ot=k(o,"USE_PROFILES")?o.USE_PROFILES:!1,Ge=o.ALLOW_ARIA_ATTR!==!1,re=o.ALLOW_DATA_ATTR!==!1,Be=o.ALLOW_UNKNOWN_PROTOCOLS||!1,je=o.ALLOW_SELF_CLOSE_IN_ATTR!==!1,et=o.SAFE_FOR_TEMPLATES||!1,Pt=o.SAFE_FOR_XML!==!1,Z=o.WHOLE_DOCUMENT||!1,nt=o.RETURN_DOM||!1,vt=o.RETURN_DOM_FRAGMENT||!1,xt=o.RETURN_TRUSTED_TYPE||!1,ce=o.FORCE_BODY||!1,Ye=o.SANITIZE_DOM!==!1,Ve=o.SANITIZE_NAMED_PROPS||!1,le=o.KEEP_CONTENT!==!1,At=o.IN_PLACE||!1,ze=o.ALLOWED_URI_REGEXP||ye,st=o.NAMESPACE||G,Ut=o.MATHML_TEXT_INTEGRATION_POINTS||Ut,Ht=o.HTML_INTEGRATION_POINTS||Ht,A=o.CUSTOM_ELEMENT_HANDLING||{},o.CUSTOM_ELEMENT_HANDLING&&Ze(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(A.tagNameCheck=o.CUSTOM_ELEMENT_HANDLING.tagNameCheck),o.CUSTOM_ELEMENT_HANDLING&&Ze(o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(A.attributeNameCheck=o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),o.CUSTOM_ELEMENT_HANDLING&&typeof o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(A.allowCustomizedBuiltInElements=o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),et&&(re=!1),vt&&(nt=!0),ot&&(S=d({},_e),R=[],ot.html===!0&&(d(S,Ae),d(R,be)),ot.svg===!0&&(d(S,jt),d(R,Xt),d(R,Rt)),ot.svgFilters===!0&&(d(S,Yt),d(R,Xt),d(R,Rt)),ot.mathMl===!0&&(d(S,Vt),d(R,Se),d(R,Rt))),o.ADD_TAGS&&(typeof o.ADD_TAGS=="function"?tt.tagCheck=o.ADD_TAGS:(S===$e&&(S=U(S)),d(S,o.ADD_TAGS,b))),o.ADD_ATTR&&(typeof o.ADD_ATTR=="function"?tt.attributeCheck=o.ADD_ATTR:(R===We&&(R=U(R)),d(R,o.ADD_ATTR,b))),o.ADD_URI_SAFE_ATTR&&d(ue,o.ADD_URI_SAFE_ATTR,b),o.FORBID_CONTENTS&&(z===fe&&(z=U(z)),d(z,o.FORBID_CONTENTS,b)),o.ADD_FORBID_CONTENTS&&(z===fe&&(z=U(z)),d(z,o.ADD_FORBID_CONTENTS,b)),le&&(S["#text"]=!0),Z&&d(S,["html","head","body"]),S.table&&(d(S,["tbody"]),delete gt.tbody),o.TRUSTED_TYPES_POLICY){if(typeof o.TRUSTED_TYPES_POLICY.createHTML!="function")throw ft('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof o.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ft('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');I=o.TRUSTED_TYPES_POLICY,Et=I.createHTML("")}else I===void 0&&(I=In(W,s)),I!==null&&typeof Et=="string"&&(Et=I.createHTML(""));N&&N(o),it=o}},Je=d({},[...jt,...Yt,...bn]),Qe=d({},[...Vt,...Sn]),po=function(o){let a=It(o);(!a||!a.tagName)&&(a={namespaceURI:st,tagName:"template"});const l=yt(o.tagName),E=yt(a.tagName);return he[o.namespaceURI]?o.namespaceURI===Ft?a.namespaceURI===G?l==="svg":a.namespaceURI===kt?l==="svg"&&(E==="annotation-xml"||Ut[E]):!!Je[l]:o.namespaceURI===kt?a.namespaceURI===G?l==="math":a.namespaceURI===Ft?l==="math"&&Ht[E]:!!Qe[l]:o.namespaceURI===G?a.namespaceURI===Ft&&!Ht[E]||a.namespaceURI===kt&&!Ut[E]?!1:!Qe[l]&&(co[l]||!Je[l]):!!(_t==="application/xhtml+xml"&&he[o.namespaceURI]):!1},$=function(o){ct(t.removed,{element:o});try{It(o).removeChild(o)}catch{qn(o)}},J=function(o,a){try{ct(t.removed,{attribute:a.getAttributeNode(o),from:a})}catch{ct(t.removed,{attribute:null,from:a})}if(a.removeAttribute(o),o==="is")if(nt||vt)try{$(a)}catch{}else try{a.setAttribute(o,"")}catch{}},tn=function(o){let a=null,l=null;if(ce)o="<remove></remove>"+o;else{const _=Bt(o,/^[\r\n\t ]+/);l=_&&_[0]}_t==="application/xhtml+xml"&&st===G&&(o='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+o+"</body></html>");const E=I?I.createHTML(o):o;if(st===G)try{a=new V().parseFromString(E,_t)}catch{}if(!a||!a.documentElement){a=ee.createDocument(st,"template",null);try{a.documentElement.innerHTML=pe?Et:E}catch{}}const C=a.body||a.documentElement;return o&&l&&C.insertBefore(e.createTextNode(l),C.childNodes[0]||null),st===G?to.call(a,Z?"html":"body")[0]:Z?a.documentElement:C},en=function(o){return Jn.call(o.ownerDocument||o,o,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},de=function(o){return o instanceof y&&(typeof o.nodeName!="string"||typeof o.textContent!="string"||typeof o.removeChild!="function"||!(o.attributes instanceof m)||typeof o.removeAttribute!="function"||typeof o.setAttribute!="function"||typeof o.namespaceURI!="string"||typeof o.insertBefore!="function"||typeof o.hasChildNodes!="function")},nn=function(o){return typeof u=="function"&&o instanceof u};function B(f,o,a){St(f,l=>{l.call(t,o,a,it)})}const on=function(o){let a=null;if(B(P.beforeSanitizeElements,o,null),de(o))return $(o),!0;const l=b(o.nodeName);if(B(P.uponSanitizeElement,o,{tagName:l,allowedTags:S}),Pt&&o.hasChildNodes()&&!nn(o.firstElementChild)&&L(/<[/\w!]/g,o.innerHTML)&&L(/<[/\w!]/g,o.textContent)||o.nodeType===pt.progressingInstruction||Pt&&o.nodeType===pt.comment&&L(/<[/\w]/g,o.data))return $(o),!0;if(!(tt.tagCheck instanceof Function&&tt.tagCheck(l))&&(!S[l]||gt[l])){if(!gt[l]&&rn(l)&&(A.tagNameCheck instanceof RegExp&&L(A.tagNameCheck,l)||A.tagNameCheck instanceof Function&&A.tagNameCheck(l)))return!1;if(le&&!z[l]){const E=It(o)||o.parentNode,C=Zn(o)||o.childNodes;if(C&&E){const _=C.length;for(let v=_-1;v>=0;--v){const j=Xn(C[v],!0);j.__removalCount=(o.__removalCount||0)+1,E.insertBefore(j,Kn(o))}}}return $(o),!0}return o instanceof p&&!po(o)||(l==="noscript"||l==="noembed"||l==="noframes")&&L(/<\/no(script|embed|frames)/i,o.innerHTML)?($(o),!0):(et&&o.nodeType===pt.text&&(a=o.textContent,St([ne,oe,se],E=>{a=lt(a,E," ")}),o.textContent!==a&&(ct(t.removed,{element:o.cloneNode()}),o.textContent=a)),B(P.afterSanitizeElements,o,null),!1)},sn=function(o,a,l){if(Ye&&(a==="id"||a==="name")&&(l in e||l in uo))return!1;if(!(re&&!ie[a]&&L(no,a))){if(!(Ge&&L(oo,a))){if(!(tt.attributeCheck instanceof Function&&tt.attributeCheck(a,o))){if(!R[a]||ie[a]){if(!(rn(o)&&(A.tagNameCheck instanceof RegExp&&L(A.tagNameCheck,o)||A.tagNameCheck instanceof Function&&A.tagNameCheck(o))&&(A.attributeNameCheck instanceof RegExp&&L(A.attributeNameCheck,a)||A.attributeNameCheck instanceof Function&&A.attributeNameCheck(a,o))||a==="is"&&A.allowCustomizedBuiltInElements&&(A.tagNameCheck instanceof RegExp&&L(A.tagNameCheck,l)||A.tagNameCheck instanceof Function&&A.tagNameCheck(l))))return!1}else if(!ue[a]){if(!L(ze,lt(l,He,""))){if(!((a==="src"||a==="xlink:href"||a==="href")&&o!=="script"&&En(l,"data:")===0&&Xe[o])){if(!(Be&&!L(so,lt(l,He,"")))){if(l)return!1}}}}}}}return!0},rn=function(o){return o!=="annotation-xml"&&Bt(o,io)},an=function(o){B(P.beforeSanitizeAttributes,o,null);const{attributes:a}=o;if(!a||de(o))return;const l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0};let E=a.length;for(;E--;){const C=a[E],{name:_,namespaceURI:v,value:j}=C,rt=b(_),Te=j;let w=_==="value"?Te:gn(Te);if(l.attrName=rt,l.attrValue=w,l.keepAttr=!0,l.forceKeepAttr=void 0,B(P.uponSanitizeAttribute,o,l),w=l.attrValue,Ve&&(rt==="id"||rt==="name")&&(J(_,o),w=ro+w),Pt&&L(/((--!?|])>)|<\/(style|title|textarea)/i,w)){J(_,o);continue}if(rt==="attributename"&&Bt(w,"href")){J(_,o);continue}if(l.forceKeepAttr)continue;if(!l.keepAttr){J(_,o);continue}if(!je&&L(/\/>/i,w)){J(_,o);continue}et&&St([ne,oe,se],ln=>{w=lt(w,ln," ")});const cn=b(o.nodeName);if(!sn(cn,rt,w)){J(_,o);continue}if(I&&typeof W=="object"&&typeof W.getAttributeType=="function"&&!v)switch(W.getAttributeType(cn,rt)){case"TrustedHTML":{w=I.createHTML(w);break}case"TrustedScriptURL":{w=I.createScriptURL(w);break}}if(w!==Te)try{v?o.setAttributeNS(v,_,w):o.setAttribute(_,w),de(o)?$(o):ge(t.removed)}catch{J(_,o)}}B(P.afterSanitizeAttributes,o,null)},ho=function f(o){let a=null;const l=en(o);for(B(P.beforeSanitizeShadowDOM,o,null);a=l.nextNode();)B(P.uponSanitizeShadowNode,a,null),on(a),an(a),a.content instanceof i&&f(a.content);B(P.afterSanitizeShadowDOM,o,null)};return t.sanitize=function(f){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=null,l=null,E=null,C=null;if(pe=!f,pe&&(f="<!-->"),typeof f!="string"&&!nn(f))if(typeof f.toString=="function"){if(f=f.toString(),typeof f!="string")throw ft("dirty is not a string, aborting")}else throw ft("toString is not a function");if(!t.isSupported)return f;if(ae||me(o),t.removed=[],typeof f=="string"&&(At=!1),At){if(f.nodeName){const j=b(f.nodeName);if(!S[j]||gt[j])throw ft("root node is forbidden and cannot be sanitized in-place")}}else if(f instanceof u)a=tn("<!---->"),l=a.ownerDocument.importNode(f,!0),l.nodeType===pt.element&&l.nodeName==="BODY"||l.nodeName==="HTML"?a=l:a.appendChild(l);else{if(!nt&&!et&&!Z&&f.indexOf("<")===-1)return I&&xt?I.createHTML(f):f;if(a=tn(f),!a)return nt?null:xt?Et:""}a&&ce&&$(a.firstChild);const _=en(At?f:a);for(;E=_.nextNode();)on(E),an(E),E.content instanceof i&&ho(E.content);if(At)return f;if(nt){if(vt)for(C=Qn.call(a.ownerDocument);a.firstChild;)C.appendChild(a.firstChild);else C=a;return(R.shadowroot||R.shadowrootmode)&&(C=eo.call(n,C,!0)),C}let v=Z?a.outerHTML:a.innerHTML;return Z&&S["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&L(Re,a.ownerDocument.doctype.name)&&(v="<!DOCTYPE "+a.ownerDocument.doctype.name+`>
|
|
2
|
-
`+v),
|
|
1
|
+
(function(T,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(T=typeof globalThis<"u"?globalThis:T||self,g(T.wrec={}))})(this,(function(T){"use strict";var fn=T=>{throw TypeError(T)};var Ee=(T,g,M)=>g.has(T)||fn("Cannot "+M);var O=(T,g,M)=>(Ee(T,g,"read from private field"),M?M.call(T):g.get(T)),q=(T,g,M)=>g.has(T)?fn("Cannot add the same private member more than once"):g instanceof WeakSet?g.add(T):g.set(T,M),ct=(T,g,M,St)=>(Ee(T,g,"write to private field"),St?St.call(T,M):g.set(T,M),M),un=(T,g,M)=>(Ee(T,g,"access private method"),M);var K,Nt,H,Tt,Et,Y,Dt,pn;const{entries:g,setPrototypeOf:M,isFrozen:St,getPrototypeOf:hn,getOwnPropertyDescriptor:mn}=Object;let{freeze:L,seal:x,create:zt}=Object,{apply:$t,construct:Wt}=typeof Reflect<"u"&&Reflect;L||(L=function(t){return t}),x||(x=function(t){return t}),$t||($t=function(t,e){for(var n=arguments.length,s=new Array(n>2?n-2:0),i=2;i<n;i++)s[i-2]=arguments[i];return t.apply(e,s)}),Wt||(Wt=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),s=1;s<e;s++)n[s-1]=arguments[s];return new t(...n)});const yt=D(Array.prototype.forEach),dn=D(Array.prototype.lastIndexOf),ge=D(Array.prototype.pop),lt=D(Array.prototype.push),Tn=D(Array.prototype.splice),Rt=D(String.prototype.toLowerCase),Gt=D(String.prototype.toString),Bt=D(String.prototype.match),ft=D(String.prototype.replace),En=D(String.prototype.indexOf),gn=D(String.prototype.trim),k=D(Object.prototype.hasOwnProperty),N=D(RegExp.prototype.test),ut=An(TypeError);function D(r){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var e=arguments.length,n=new Array(e>1?e-1:0),s=1;s<e;s++)n[s-1]=arguments[s];return $t(r,t,n)}}function An(r){return function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Wt(r,e)}}function d(r,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Rt;M&&M(r,null);let n=t.length;for(;n--;){let s=t[n];if(typeof s=="string"){const i=e(s);i!==s&&(St(t)||(t[n]=i),s=i)}r[s]=!0}return r}function _n(r){for(let t=0;t<r.length;t++)k(r,t)||(r[t]=null);return r}function U(r){const t=zt(null);for(const[e,n]of g(r))k(r,e)&&(Array.isArray(n)?t[e]=_n(n):n&&typeof n=="object"&&n.constructor===Object?t[e]=U(n):t[e]=n);return t}function pt(r,t){for(;r!==null;){const n=mn(r,t);if(n){if(n.get)return D(n.get);if(typeof n.value=="function")return D(n.value)}r=hn(r)}function e(){return null}return e}const Ae=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"]),jt=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"]),Yt=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"]),bn=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"]),Vt=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"]),Sn=L(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_e=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"]),Xt=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"]),Se=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"]),yn=x(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Rn=x(/<%[\w\W]*|[\w\W]*%>/gm),wn=x(/\$\{[\w\W]*/gm),On=x(/^data-[\-\w.\u00B7-\uFFFF]+$/),Cn=x(/^aria-[\-\w]+$/),ye=x(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Mn=x(/^(?:\w+script|data):/i),Ln=x(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Re=x(/^html$/i),Nn=x(/^[a-z][.\w]*(-[.\w]+)+$/i);var we=Object.freeze({__proto__:null,ARIA_ATTR:Cn,ATTR_WHITESPACE:Ln,CUSTOM_ELEMENT:Nn,DATA_ATTR:On,DOCTYPE_NAME:Re,ERB_EXPR:Rn,IS_ALLOWED_URI:ye,IS_SCRIPT_OR_DATA:Mn,MUSTACHE_EXPR:yn,TMPLIT_EXPR:wn});const ht={element:1,text:3,progressingInstruction:7,comment:8,document:9},Dn=function(){return typeof window>"u"?null:window},In=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null;const s="data-tt-policy-suffix";e&&e.hasAttribute(s)&&(n=e.getAttribute(s));const i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Oe=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ce(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Dn();const t=f=>Ce(f);if(t.version="3.3.1",t.removed=[],!r||!r.document||r.document.nodeType!==ht.document||!r.Element)return t.isSupported=!1,t;let{document:e}=r;const n=e,s=n.currentScript,{DocumentFragment:i,HTMLTemplateElement:c,Node:u,Element:p,NodeFilter:h,NamedNodeMap:m=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:y,DOMParser:V,trustedTypes:W}=r,X=p.prototype,Xn=pt(X,"cloneNode"),qn=pt(X,"remove"),Kn=pt(X,"nextSibling"),Zn=pt(X,"childNodes"),It=pt(X,"parentNode");if(typeof c=="function"){const f=e.createElement("template");f.content&&f.content.ownerDocument&&(e=f.content.ownerDocument)}let I,gt="";const{implementation:ee,createNodeIterator:Jn,createDocumentFragment:Qn,getElementsByTagName:to}=e,{importNode:eo}=n;let P=Oe();t.isSupported=typeof g=="function"&&typeof It=="function"&&ee&&ee.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ne,ERB_EXPR:oe,TMPLIT_EXPR:se,DATA_ATTR:no,ARIA_ATTR:oo,IS_SCRIPT_OR_DATA:so,ATTR_WHITESPACE:He,CUSTOM_ELEMENT:io}=we;let{IS_ALLOWED_URI:ze}=we,S=null;const $e=d({},[...Ae,...jt,...Yt,...Vt,..._e]);let R=null;const We=d({},[...be,...Xt,...Se,...wt]);let A=Object.seal(zt(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),At=null,ie=null;const et=Object.seal(zt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ge=!0,re=!0,Be=!1,je=!0,nt=!1,Pt=!0,Z=!1,ae=!1,ce=!1,ot=!1,vt=!1,xt=!1,Ye=!0,Ve=!1;const ro="user-content-";let le=!0,_t=!1,st={},z=null;const fe=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"]);let Xe=null;const qe=d({},["audio","video","img","source","image","track"]);let ue=null;const Ke=d({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),kt="http://www.w3.org/1998/Math/MathML",Ft="http://www.w3.org/2000/svg",G="http://www.w3.org/1999/xhtml";let it=G,pe=!1,he=null;const ao=d({},[kt,Ft,G],Gt);let Ut=d({},["mi","mo","mn","ms","mtext"]),Ht=d({},["annotation-xml"]);const co=d({},["title","style","font","a","script"]);let bt=null;const lo=["application/xhtml+xml","text/html"],fo="text/html";let b=null,rt=null;const uo=e.createElement("form"),Ze=function(o){return o instanceof RegExp||o instanceof Function},me=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(rt&&rt===o)){if((!o||typeof o!="object")&&(o={}),o=U(o),bt=lo.indexOf(o.PARSER_MEDIA_TYPE)===-1?fo:o.PARSER_MEDIA_TYPE,b=bt==="application/xhtml+xml"?Gt:Rt,S=k(o,"ALLOWED_TAGS")?d({},o.ALLOWED_TAGS,b):$e,R=k(o,"ALLOWED_ATTR")?d({},o.ALLOWED_ATTR,b):We,he=k(o,"ALLOWED_NAMESPACES")?d({},o.ALLOWED_NAMESPACES,Gt):ao,ue=k(o,"ADD_URI_SAFE_ATTR")?d(U(Ke),o.ADD_URI_SAFE_ATTR,b):Ke,Xe=k(o,"ADD_DATA_URI_TAGS")?d(U(qe),o.ADD_DATA_URI_TAGS,b):qe,z=k(o,"FORBID_CONTENTS")?d({},o.FORBID_CONTENTS,b):fe,At=k(o,"FORBID_TAGS")?d({},o.FORBID_TAGS,b):U({}),ie=k(o,"FORBID_ATTR")?d({},o.FORBID_ATTR,b):U({}),st=k(o,"USE_PROFILES")?o.USE_PROFILES:!1,Ge=o.ALLOW_ARIA_ATTR!==!1,re=o.ALLOW_DATA_ATTR!==!1,Be=o.ALLOW_UNKNOWN_PROTOCOLS||!1,je=o.ALLOW_SELF_CLOSE_IN_ATTR!==!1,nt=o.SAFE_FOR_TEMPLATES||!1,Pt=o.SAFE_FOR_XML!==!1,Z=o.WHOLE_DOCUMENT||!1,ot=o.RETURN_DOM||!1,vt=o.RETURN_DOM_FRAGMENT||!1,xt=o.RETURN_TRUSTED_TYPE||!1,ce=o.FORCE_BODY||!1,Ye=o.SANITIZE_DOM!==!1,Ve=o.SANITIZE_NAMED_PROPS||!1,le=o.KEEP_CONTENT!==!1,_t=o.IN_PLACE||!1,ze=o.ALLOWED_URI_REGEXP||ye,it=o.NAMESPACE||G,Ut=o.MATHML_TEXT_INTEGRATION_POINTS||Ut,Ht=o.HTML_INTEGRATION_POINTS||Ht,A=o.CUSTOM_ELEMENT_HANDLING||{},o.CUSTOM_ELEMENT_HANDLING&&Ze(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(A.tagNameCheck=o.CUSTOM_ELEMENT_HANDLING.tagNameCheck),o.CUSTOM_ELEMENT_HANDLING&&Ze(o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(A.attributeNameCheck=o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),o.CUSTOM_ELEMENT_HANDLING&&typeof o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(A.allowCustomizedBuiltInElements=o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),nt&&(re=!1),vt&&(ot=!0),st&&(S=d({},_e),R=[],st.html===!0&&(d(S,Ae),d(R,be)),st.svg===!0&&(d(S,jt),d(R,Xt),d(R,wt)),st.svgFilters===!0&&(d(S,Yt),d(R,Xt),d(R,wt)),st.mathMl===!0&&(d(S,Vt),d(R,Se),d(R,wt))),o.ADD_TAGS&&(typeof o.ADD_TAGS=="function"?et.tagCheck=o.ADD_TAGS:(S===$e&&(S=U(S)),d(S,o.ADD_TAGS,b))),o.ADD_ATTR&&(typeof o.ADD_ATTR=="function"?et.attributeCheck=o.ADD_ATTR:(R===We&&(R=U(R)),d(R,o.ADD_ATTR,b))),o.ADD_URI_SAFE_ATTR&&d(ue,o.ADD_URI_SAFE_ATTR,b),o.FORBID_CONTENTS&&(z===fe&&(z=U(z)),d(z,o.FORBID_CONTENTS,b)),o.ADD_FORBID_CONTENTS&&(z===fe&&(z=U(z)),d(z,o.ADD_FORBID_CONTENTS,b)),le&&(S["#text"]=!0),Z&&d(S,["html","head","body"]),S.table&&(d(S,["tbody"]),delete At.tbody),o.TRUSTED_TYPES_POLICY){if(typeof o.TRUSTED_TYPES_POLICY.createHTML!="function")throw ut('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof o.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ut('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');I=o.TRUSTED_TYPES_POLICY,gt=I.createHTML("")}else I===void 0&&(I=In(W,s)),I!==null&&typeof gt=="string"&&(gt=I.createHTML(""));L&&L(o),rt=o}},Je=d({},[...jt,...Yt,...bn]),Qe=d({},[...Vt,...Sn]),po=function(o){let a=It(o);(!a||!a.tagName)&&(a={namespaceURI:it,tagName:"template"});const l=Rt(o.tagName),E=Rt(a.tagName);return he[o.namespaceURI]?o.namespaceURI===Ft?a.namespaceURI===G?l==="svg":a.namespaceURI===kt?l==="svg"&&(E==="annotation-xml"||Ut[E]):!!Je[l]:o.namespaceURI===kt?a.namespaceURI===G?l==="math":a.namespaceURI===Ft?l==="math"&&Ht[E]:!!Qe[l]:o.namespaceURI===G?a.namespaceURI===Ft&&!Ht[E]||a.namespaceURI===kt&&!Ut[E]?!1:!Qe[l]&&(co[l]||!Je[l]):!!(bt==="application/xhtml+xml"&&he[o.namespaceURI]):!1},$=function(o){lt(t.removed,{element:o});try{It(o).removeChild(o)}catch{qn(o)}},J=function(o,a){try{lt(t.removed,{attribute:a.getAttributeNode(o),from:a})}catch{lt(t.removed,{attribute:null,from:a})}if(a.removeAttribute(o),o==="is")if(ot||vt)try{$(a)}catch{}else try{a.setAttribute(o,"")}catch{}},tn=function(o){let a=null,l=null;if(ce)o="<remove></remove>"+o;else{const _=Bt(o,/^[\r\n\t ]+/);l=_&&_[0]}bt==="application/xhtml+xml"&&it===G&&(o='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+o+"</body></html>");const E=I?I.createHTML(o):o;if(it===G)try{a=new V().parseFromString(E,bt)}catch{}if(!a||!a.documentElement){a=ee.createDocument(it,"template",null);try{a.documentElement.innerHTML=pe?gt:E}catch{}}const C=a.body||a.documentElement;return o&&l&&C.insertBefore(e.createTextNode(l),C.childNodes[0]||null),it===G?to.call(a,Z?"html":"body")[0]:Z?a.documentElement:C},en=function(o){return Jn.call(o.ownerDocument||o,o,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},de=function(o){return o instanceof y&&(typeof o.nodeName!="string"||typeof o.textContent!="string"||typeof o.removeChild!="function"||!(o.attributes instanceof m)||typeof o.removeAttribute!="function"||typeof o.setAttribute!="function"||typeof o.namespaceURI!="string"||typeof o.insertBefore!="function"||typeof o.hasChildNodes!="function")},nn=function(o){return typeof u=="function"&&o instanceof u};function B(f,o,a){yt(f,l=>{l.call(t,o,a,rt)})}const on=function(o){let a=null;if(B(P.beforeSanitizeElements,o,null),de(o))return $(o),!0;const l=b(o.nodeName);if(B(P.uponSanitizeElement,o,{tagName:l,allowedTags:S}),Pt&&o.hasChildNodes()&&!nn(o.firstElementChild)&&N(/<[/\w!]/g,o.innerHTML)&&N(/<[/\w!]/g,o.textContent)||o.nodeType===ht.progressingInstruction||Pt&&o.nodeType===ht.comment&&N(/<[/\w]/g,o.data))return $(o),!0;if(!(et.tagCheck instanceof Function&&et.tagCheck(l))&&(!S[l]||At[l])){if(!At[l]&&rn(l)&&(A.tagNameCheck instanceof RegExp&&N(A.tagNameCheck,l)||A.tagNameCheck instanceof Function&&A.tagNameCheck(l)))return!1;if(le&&!z[l]){const E=It(o)||o.parentNode,C=Zn(o)||o.childNodes;if(C&&E){const _=C.length;for(let v=_-1;v>=0;--v){const j=Xn(C[v],!0);j.__removalCount=(o.__removalCount||0)+1,E.insertBefore(j,Kn(o))}}}return $(o),!0}return o instanceof p&&!po(o)||(l==="noscript"||l==="noembed"||l==="noframes")&&N(/<\/no(script|embed|frames)/i,o.innerHTML)?($(o),!0):(nt&&o.nodeType===ht.text&&(a=o.textContent,yt([ne,oe,se],E=>{a=ft(a,E," ")}),o.textContent!==a&&(lt(t.removed,{element:o.cloneNode()}),o.textContent=a)),B(P.afterSanitizeElements,o,null),!1)},sn=function(o,a,l){if(Ye&&(a==="id"||a==="name")&&(l in e||l in uo))return!1;if(!(re&&!ie[a]&&N(no,a))){if(!(Ge&&N(oo,a))){if(!(et.attributeCheck instanceof Function&&et.attributeCheck(a,o))){if(!R[a]||ie[a]){if(!(rn(o)&&(A.tagNameCheck instanceof RegExp&&N(A.tagNameCheck,o)||A.tagNameCheck instanceof Function&&A.tagNameCheck(o))&&(A.attributeNameCheck instanceof RegExp&&N(A.attributeNameCheck,a)||A.attributeNameCheck instanceof Function&&A.attributeNameCheck(a,o))||a==="is"&&A.allowCustomizedBuiltInElements&&(A.tagNameCheck instanceof RegExp&&N(A.tagNameCheck,l)||A.tagNameCheck instanceof Function&&A.tagNameCheck(l))))return!1}else if(!ue[a]){if(!N(ze,ft(l,He,""))){if(!((a==="src"||a==="xlink:href"||a==="href")&&o!=="script"&&En(l,"data:")===0&&Xe[o])){if(!(Be&&!N(so,ft(l,He,"")))){if(l)return!1}}}}}}}return!0},rn=function(o){return o!=="annotation-xml"&&Bt(o,io)},an=function(o){B(P.beforeSanitizeAttributes,o,null);const{attributes:a}=o;if(!a||de(o))return;const l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0};let E=a.length;for(;E--;){const C=a[E],{name:_,namespaceURI:v,value:j}=C,at=b(_),Te=j;let w=_==="value"?Te:gn(Te);if(l.attrName=at,l.attrValue=w,l.keepAttr=!0,l.forceKeepAttr=void 0,B(P.uponSanitizeAttribute,o,l),w=l.attrValue,Ve&&(at==="id"||at==="name")&&(J(_,o),w=ro+w),Pt&&N(/((--!?|])>)|<\/(style|title|textarea)/i,w)){J(_,o);continue}if(at==="attributename"&&Bt(w,"href")){J(_,o);continue}if(l.forceKeepAttr)continue;if(!l.keepAttr){J(_,o);continue}if(!je&&N(/\/>/i,w)){J(_,o);continue}nt&&yt([ne,oe,se],ln=>{w=ft(w,ln," ")});const cn=b(o.nodeName);if(!sn(cn,at,w)){J(_,o);continue}if(I&&typeof W=="object"&&typeof W.getAttributeType=="function"&&!v)switch(W.getAttributeType(cn,at)){case"TrustedHTML":{w=I.createHTML(w);break}case"TrustedScriptURL":{w=I.createScriptURL(w);break}}if(w!==Te)try{v?o.setAttributeNS(v,_,w):o.setAttribute(_,w),de(o)?$(o):ge(t.removed)}catch{J(_,o)}}B(P.afterSanitizeAttributes,o,null)},ho=function f(o){let a=null;const l=en(o);for(B(P.beforeSanitizeShadowDOM,o,null);a=l.nextNode();)B(P.uponSanitizeShadowNode,a,null),on(a),an(a),a.content instanceof i&&f(a.content);B(P.afterSanitizeShadowDOM,o,null)};return t.sanitize=function(f){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=null,l=null,E=null,C=null;if(pe=!f,pe&&(f="<!-->"),typeof f!="string"&&!nn(f))if(typeof f.toString=="function"){if(f=f.toString(),typeof f!="string")throw ut("dirty is not a string, aborting")}else throw ut("toString is not a function");if(!t.isSupported)return f;if(ae||me(o),t.removed=[],typeof f=="string"&&(_t=!1),_t){if(f.nodeName){const j=b(f.nodeName);if(!S[j]||At[j])throw ut("root node is forbidden and cannot be sanitized in-place")}}else if(f instanceof u)a=tn("<!---->"),l=a.ownerDocument.importNode(f,!0),l.nodeType===ht.element&&l.nodeName==="BODY"||l.nodeName==="HTML"?a=l:a.appendChild(l);else{if(!ot&&!nt&&!Z&&f.indexOf("<")===-1)return I&&xt?I.createHTML(f):f;if(a=tn(f),!a)return ot?null:xt?gt:""}a&&ce&&$(a.firstChild);const _=en(_t?f:a);for(;E=_.nextNode();)on(E),an(E),E.content instanceof i&&ho(E.content);if(_t)return f;if(ot){if(vt)for(C=Qn.call(a.ownerDocument);a.firstChild;)C.appendChild(a.firstChild);else C=a;return(R.shadowroot||R.shadowrootmode)&&(C=eo.call(n,C,!0)),C}let v=Z?a.outerHTML:a.innerHTML;return Z&&S["!doctype"]&&a.ownerDocument&&a.ownerDocument.doctype&&a.ownerDocument.doctype.name&&N(Re,a.ownerDocument.doctype.name)&&(v="<!DOCTYPE "+a.ownerDocument.doctype.name+`>
|
|
2
|
+
`+v),nt&&yt([ne,oe,se],j=>{v=ft(v,j," ")}),I&&xt?I.createHTML(v):v},t.setConfig=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};me(f),ae=!0},t.clearConfig=function(){rt=null,ae=!1},t.isValidAttribute=function(f,o,a){rt||me({});const l=b(f),E=b(o);return sn(l,E,a)},t.addHook=function(f,o){typeof o=="function"&<(P[f],o)},t.removeHook=function(f,o){if(o!==void 0){const a=dn(P[f],o);return a===-1?void 0:Tn(P[f],a,1)[0]}return ge(P[f])},t.removeHooks=function(f){P[f]=[]},t.removeAllHooks=function(){P=Oe()},t}var Me=Ce();function Le(r,t){let e=r;for(const n of t.split("."))e=e[n];return e}function Pn(r,t,e){const n=t.split("."),s=n.length-1;let i=r;n.forEach((c,u)=>{u===s?i[c]=e:i=i[c]})}function Ne(r,t,e=""){const n=new WeakMap,s={get(i,c){const u=Reflect.get(i,c);if(u===null||typeof u!="object")return u;const p=n.get(u);if(p)return p;const h=e?`${e}.${c}`:c,m=Ne(u,t,h);return n.set(u,m),m},set(i,c,u){const p=Reflect.get(i,c);if(p!==u){Reflect.set(i,c,u);const h=e?`${e}.${c}`:c;t(h,p,u)}return!0}};return new Proxy(r,s)}function De(r){const t={};for(const[e,n]of Object.entries(r)){const s=typeof n=="object"&&n!==null;t[e]=s?De(n):n}return t}const Ot=typeof window<"u"&&typeof window.document<"u";let Ie=class extends Error{};const tt=class tt{constructor(t,e,n){q(this,Dt);q(this,Nt,Symbol("objectId"));q(this,H,[]);q(this,Tt);q(this,Et);q(this,Y);if(!t)throw new Ie("name cannot be empty");if(O(tt,K).has(t))throw new Ie(`WrecState with name "${t}" already exists`);if(ct(this,Tt,t),ct(this,Et,e),ct(this,Y,Ne({},un(this,Dt,pn).bind(this))),e&&Ot){const s=sessionStorage.getItem("wrec-state-"+t),i=s?JSON.parse(s):void 0;i&&(n=i)}if(n)for(const[s,i]of Object.entries(n))this.addProperty(s,i);O(tt,K).set(t,this)}static get(t){return O(this,K).get(t)}addListener(t,e={}){const n=O(this,H).find(s=>s.listenerRef.deref()===t);if(n){const{propertyMap:s}=n;for(const[i,c]of Object.entries(e))s[i]=c}else O(this,H).push({listenerRef:new WeakRef(t),propertyMap:e})}addProperty(t,e){Object.defineProperty(this,t,{enumerable:!0,get(){return O(this,Y)[t]},set(n){O(this,Y)[t]=n}}),O(this,Y)[t]=e}get id(){return O(this,Nt)}log(){console.log("WrecState:",O(this,Tt));for(const[t,e]of Object.entries(O(this,Y)))console.log(` ${t} = ${JSON.stringify(e)}`)}removeListener(t){ct(this,H,O(this,H).filter(e=>e.listenerRef.deref()!==t))}};K=new WeakMap,Nt=new WeakMap,H=new WeakMap,Tt=new WeakMap,Et=new WeakMap,Y=new WeakMap,Dt=new WeakSet,pn=function(t,e,n){const s=new Set;for(const i of O(this,H)){const c=i.listenerRef.deref();if(!c)s.add(i);else if(Ot&&c instanceof HTMLElement&&!c.isConnected)s.add(i);else{const{propertyMap:u}=i,p=Object.keys(u);(p.length===0||p.includes(t))&&c.changed(t,u[t],n,e,this)}}ct(this,H,O(this,H).filter(i=>!s.has(i)))},q(tt,K,new Map),Ot&&window.addEventListener("beforeunload",()=>{for(const[t,e]of O(tt,K).entries())if(O(e,Et)){const n=De(e);sessionStorage.setItem("wrec-state-"+t,JSON.stringify(n))}});let Ct=tt;Ot&&process.env.NODE_ENV==="development"&&(window.WrecState=Ct);const vn=new Set(["onblur","onchange","onclick","onfocus","oninput","onkeydown","onreset","onsubmit"]);Me.addHook("uponSanitizeAttribute",(r,t)=>{const{attrName:e}=t,n=e.toLowerCase();vn.has(n)&&(t.forceKeepAttr=!0)});class Q extends Error{}const xn=/([a-zA-Z-]+)\s*:\s*([^;}]+)/g,Pe="a-zA-Z_$",kn=Pe+"0-9",mt=`[${Pe}][${kn}]*`,Fn=/<!--\s*(.*?)\s*-->/,Un=/<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g,qt=new RegExp(`^this\\.${mt}$`),Kt=new RegExp(`this\\.${mt}(\\.${mt})*`,"g"),ve=new RegExp(`this\\.${mt}(\\.${mt})*`),Hn=new Set(["class","style"]),xe=5;function zn(r){return r instanceof HTMLButtonElement||r instanceof HTMLFieldSetElement||r instanceof HTMLInputElement||r instanceof HTMLSelectElement||r instanceof HTMLTextAreaElement||r instanceof F}function $n(r,t,e){const n=document.createElement(r);if(t)for(const[s,i]of Object.entries(t))n.setAttribute(s,i);return e&&(n.innerHTML=e),n}const Wn=r=>r===String?"":r===Number?0:r===Boolean?!1:r===Array?[]:r===Object?{}:void 0;function Mt(r){const t=[];let e=r.firstElementChild;for(;e;)t.push(e),e.shadowRoot&&t.push(...Mt(e.shadowRoot)),e.firstElementChild&&t.push(...Mt(e)),e=e.nextElementSibling;return t}const Lt=r=>r.substring(xe).split(".")[0];function ke(r,t){let e=r[0];return t.forEach((n,s)=>{e+=n+r[s+1]}),e}function Zt(r){const t=typeof r;return t==="string"||t==="number"||t==="boolean"}function dt(r){return r.localName==="textarea"}function Jt(r){const{localName:t}=r;return t==="input"||t==="select"}const Gn=r=>r.replace(/<!--[\s\S]*?-->/g,"");function Fe(r,t,e,n){return r.slice(0,t)+n+r.slice(t+e)}function Bn(r){let t=r.trim(),e=null;/^\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");const n=Me.sanitize(t,{ADD_TAGS:["#comment"],ALLOW_UNKNOWN_PROTOCOLS:!0,RETURN_DOM_FRAGMENT:!0});if(e){const s=n.querySelector(e);if(s)return s.childNodes}return n.childNodes}function Qt(r){const t=Number(r);if(isNaN(t))throw new Q(`can't convert "${r}" to a number`);return t}function Ue(r,t,e){const[n,s]=t.split(":");if(Zt(e))if(typeof e=="boolean"){e?r.setAttribute(n,n):r.removeAttribute(n);const i=F.getPropName(n);r[i]=e}else{const i=r.getAttribute(t),c=String(e);i!==c&&(r.setAttribute(n,c),n==="value"&&Jt(r)&&(r.value=c))}else{const i=F.getPropName(t);r[i]=e}}function te(r,t,e){const[n,s]=t.split(":");r instanceof CSSStyleRule?r.style.setProperty(n,e):(Ue(r,n,e),n==="value"&&Jt(r)&&(r.value=e))}async function jn(r){const t=new Set;for(const n of Mt(r.content)){const{localName:s}=n;s.includes("-")&&t.add(s)}function e(n){return new Promise((s,i)=>{setTimeout(()=>{const c=`custom element <${n}> not defined`;i(new Error(c))},1e3)})}return Promise.all([...t].map(async n=>Promise.race([customElements.whenDefined(n),e(n)])))}class F extends HTMLElement{static attrToPropMap=new Map;static propToAttrMap=new Map;static css="";static elementName="";static formAssociated=!1;static html="";static properties;static propToComputedMap;static propToExprsMap;static template=null;#t=this.constructor;#n=new Map;#c={};#s;#l={};#f=null;#u=new Map;static define(t){if(this.elementName=t,customElements.get(t))throw new Q(`custom element ${t} is already defined`);customElements.define(t,this)}constructor(){super(),this.attachShadow({mode:"open"});const t=this.#t;t.attrToPropMap||(t.attrToPropMap=new Map),t.properties||(t.properties={}),t.propToAttrMap||(t.propToExprsMap=new Map),t.propToComputedMap||(t.propToComputedMap=new Map),t.propToExprsMap||(t.propToExprsMap=new Map)}attributeChangedCallback(t,e,n){t==="disabled"&&this.#h();const s=F.getPropName(t);if(this.#i(s)){const i=this.#A(s,String(n));this[s]=i;const c=this.#c[s];c&&this.setFormValue(c,String(i)),this.propertyChangedCallback(s,e,n)}}async#S(){const t=this.#t;let{template:e}=t;if(!e){e=t.template=document.createElement("template");let n=`<style>
|
|
3
3
|
:host([hidden]) { display: none; }`;t.css&&(n+=t.css),n+=`</style>
|
|
4
|
-
`;let s=t.html.trim();s.startsWith("<")||(s=`<span><!--${s}--></span>`),e.innerHTML=n+s}await jn(e),this.shadowRoot.replaceChildren(e.content.cloneNode(!0))}changed(t,e,n){this[e]=n}connectedCallback(){this.#P(),this.#R(),this.#S().then(()=>{this.hasAttribute("disabled")&&this.#h(),this.#b(this.shadowRoot),this.#m(this.shadowRoot),this.#y()})}#y(){const t=this.#t,{properties:e}=t;for(const[n,{computed:s}]of Object.entries(e))s&&(this[n]=this.#o(s))}#R(){const t=this.#t,{observedAttributes:e,properties:n}=t;for(const[s,i]of Object.entries(n))this.#w(s,i,e)}#w(t,e,n){const s=F.getAttrName(t),i=this.hasAttribute(s);e.required&&!i&&this.#e(this,t,"is a required attribute");let c=e.value;this.hasOwnProperty(t)&&(c=this[t],delete this[t]);const{type:u}=e,p=u===Boolean?c||i:n.includes(s)&&i?this.#g(t,s):c||Wn(u),h="#"+t;this[h]=p,e.computed&&this.#
|
|
5
|
-
${i}: var(--${i})`;e=Fe(e,n.index,n[0].length,c)}}}return e}function Vn(r,...t){let e=ke(r,t);for(;;){const n=Un.exec(e);if(!n||n[1]==="style")break;const s=Gn(n[2]);if(ve.test(s)){const i=`<!-- ${s.trim()} -->`,c=n.index+n[0].indexOf(">")+1;e=Fe(e,c,s.length,i)}}return e}T.Wrec=F,T.WrecState=
|
|
4
|
+
`;let s=t.html.trim();if(!s)throw new Q("static property html must be set");s.startsWith("<")||(s=`<span><!--${s}--></span>`),e.innerHTML=n+s}await jn(e),this.shadowRoot.replaceChildren(e.content.cloneNode(!0))}changed(t,e,n){this[e]=n}connectedCallback(){this.#P(),this.#R(),this.#S().then(()=>{this.hasAttribute("disabled")&&this.#h(),this.#b(this.shadowRoot),this.#m(this.shadowRoot),this.#y()})}#y(){const t=this.#t,{properties:e}=t;for(const[n,{computed:s}]of Object.entries(e))s&&(this[n]=this.#o(s))}#R(){const t=this.#t,{observedAttributes:e,properties:n}=t;for(const[s,i]of Object.entries(n))this.#w(s,i,e)}#w(t,e,n){const s=F.getAttrName(t),i=this.hasAttribute(s);e.required&&!i&&this.#e(this,t,"is a required attribute");let c=e.value;this.hasOwnProperty(t)&&(c=this[t],delete this[t]);const{type:u}=e,p=u===Boolean?c||i:n.includes(s)&&i?this.#g(t,s):c||Wn(u),h="#"+t;this[h]=p,e.computed&&this.#L(t,e),Object.defineProperty(this,t,{enumerable:!0,get(){return this[h]},set(m){u===Number&&typeof m=="string"&&(m=Qt(m));const y=this[h];if(m===y)return;this.#x(t,u,m),this[h]=m;const{state:V,stateProp:W}=this.#t.properties[t];W&&Pn(V,W,m),this.#D(t),this.#N(t,u,m,s),this.#E(t),this.#I(t,m);const X=this.#c[t];X&&this.setFormValue(X,String(m)),this.propertyChangedCallback(t,y,m),e.dispatch&&this.dispatch("change",{tagName:this.localName,property:t,oldValue:y,value:m})}})}#h(){const t=this.hasAttribute("disabled"),e=Mt(this.shadowRoot);for(const n of e)zn(n)&&(n.disabled=t)}disconnectedCallback(){this.#n.clear(),this.#l.clear(),this.#u.clear()}dispatch(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}displayIfSet(t,e="block"){return`display: ${t?e:"none"}`}#O(t){const e=t instanceof F;for(const n of t.getAttributeNames()){const s=t.getAttribute(n),i=this.#T(t,s);if(i){const c=this[i];c===void 0&&this.#a(t,n,i),t[i]=c;let[u,p]=n.split(":");u==="value"&&(p?(t["on"+p]===void 0&&this.#e(t,n,"refers to an unsupported event name"),t.setAttribute(u,this[i])):p="change"),e&&t.#u.set(F.getPropName(u),i)}this.#r(s,t,n)}}#o(t){const e=new Function("return "+t).call(this);return Array.isArray(e)?e.join(""):e}#C(t){const{localName:e}=t;if(e==="style"){const{sheet:n}=t,s=n?.cssRules??[],i=Array.from(s);for(const c of i)if(c.constructor===CSSStyleRule){const u=Array.from(c.style);for(const p of u)if(p.startsWith("--")){const h=c.style.getPropertyValue(p);this.#r(h,c,p)}}}else{let n="";if(dt(t)){this.#r(t.textContent,t);const s=t.textContent?.match(Fn);s&&(n=s[1])}else{const s=Array.from(t.childNodes).find(i=>i.nodeType===Node.COMMENT_NODE);s&&(n=s.textContent?.trim()??"")}if(n){const s=this.#T(t,n);s&&dt(t)?t.textContent=this[s]:this.#r(n,t)}}}formAssociatedCallback(){let t=this.getAttribute("form-assoc");if(!t){const c=this.getAttribute("name");if(c)if(this.#i("value"))t=`value:${c}`;else return;else return}const e={},n=t.split(",");for(const c of n){const[u,p]=c.split(":");e[u.trim()]=p.trim()}this.#c=e,this.#s=new FormData,this.#f=this.attachInternals(),this.#f.setFormValue(this.#s);const s=Object.keys(this.#t.properties),i=this.#l;for(const c of s)i[c]=this[c]}formResetCallback(){const t=this.#l;for(const e of Object.keys(t)){let n=t[e];qt.test(n)&&(n=this.#o(n)),this[e]=n}}static getAttrName(t){let e=this.propToAttrMap.get(t);return e||(e=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),this.propToAttrMap.set(t,e)),e}static getPropName(t){let e=this.attrToPropMap.get(t);return e||(e=t.replace(/-([a-z])/g,(n,s)=>s.toUpperCase()),this.attrToPropMap.set(t,e)),e}#M(t,e,n){if(n.length!==1)return;const[s]=n;if(!qt.test(s))return;const i=Jt(t)||dt(t);let[c,u]=(e??"").split(":");if(!(i&&c==="value"||dt(t)))return;u?t["on"+u]===void 0&&this.#e(t,e,"refers to an unsupported event name"):u="change";const h=Lt(s);t.addEventListener(u,m=>{const{target:y}=m;if(!y)return;const V=y.value,{type:W}=this.#t.properties[h];this[h]=W===Number?Qt(V):V,this.#E(h)})}#i(t){return!!this.#t.properties[t]}#m(t){const e=Array.from(t.querySelectorAll("*"));for(const n of e)this.#O(n),n.firstElementChild||this.#C(n)}#d(){if(this.#t.formAssociated||this.closest("form")===null)return;const t=this.#t.name;throw new Q(`inside form, class ${t} requires "static formAssociated = true;"`)}static get observedAttributes(){const t=Object.keys(this.properties||{}).map(e=>F.getAttrName(e));return t.includes("disabled")||t.push("disabled"),t}propertyChangedCallback(t,e,n){}#T(t,e){if(!e||!qt.test(e))return;const n=Lt(e);return this[n]===void 0&&this.#a(t,"",n),n}#E(t){const s=this.#t.propToExprsMap.get(t)||[];for(const i of s){let c=this.#o(i);const u=this.#n.get(i)??[];for(const p of u)if(p instanceof HTMLElement)this.#_(p,c);else if(!(p instanceof CSSStyleRule)){const{element:h,attrName:m}=p;h instanceof CSSStyleRule?h.style.setProperty(m,c):te(h,m,c)}}}#L(t,e){const{computed:n,uses:s}=e,i=this.#t.propToComputedMap;function c(p,h){let m=i.get(p);m||(m=[],i.set(p,m)),m.push([t,h])}const u=n.match(Kt)||[];for(const p of u){const h=p.substring(xe);this[h]===void 0&&this.#a(null,t,h),typeof this[h]!="function"&&c(h,n)}if(s)for(const p of s.split(","))c(p,n)}#r(t,e,n=void 0){if(!t)return;const s=this.#p(e,n,t);if(!s){const p=t.replaceAll("this..","this.");n?te(e,n,p):"textContent"in e&&(e.textContent=p);return}const i=this.#t;s.forEach(p=>{const h=Lt(p);if(typeof this[h]=="function")return;const m=i.propToExprsMap;let y=m.get(h);y||(y=[],m.set(h,y)),y.includes(t)||y.push(t)});for(const[p,h]of this.#n.entries())for(const m of h){const y=m instanceof HTMLElement||m instanceof CSSStyleRule?m:m.element;y instanceof CSSStyleRule||y.isConnected||this.#n.set(p,h.filter(V=>V!==m))}let c=this.#n.get(t);c||(c=[],this.#n.set(t,c)),c.push(n?{element:e,attrName:n}:e),e instanceof HTMLElement&&this.#M(e,n,s);const u=this.#o(t);n?te(e,n,u):this.#_(e,u)}setAttributeSafe(t,e){this.hasAttribute(t)||this.setAttribute(t,e)}setFormValue(t,e){!this.#s||!Zt(e)||(this.#s.set(t,e),this.#f?.setFormValue(this.#s))}#e(t,e,n){const s=t instanceof HTMLElement?t.localName:"CSS rule";throw new Q(`component ${this.#t.elementName}`+(t?`, element "${s}"`:"")+(e?`, attribute "${e}"`:"")+` ${n}`)}#a(t,e,n){this.#e(t,e,`refers to missing property "${n}"`)}#g(t,e){return this.#A(t,this.getAttribute(e))}#A(t,e){if(e?.match(Kt))return e;const n=this.#t,{type:s}=n.properties[t];if(s||this.#e(null,t,"does not specify its type"),s===String)return e;if(s===Number)return Qt(e);if(s===Boolean)return e==="true"?!0:e==="false"||e==="null"?!1:(e&&e!==t&&this.#e(null,t,"is a Boolean attribute, so its value must match attribute name or be missing"),e===t)}#N(t,e,n,s){if(Zt(n)&&this.hasAttribute(s)){const i=e===Boolean?this.hasAttribute(s):this.#g(t,s);n!==i&&Ue(this,t,n)}}#D(t){const n=this.#t.propToComputedMap.get(t)||[];for(const[s,i]of n)this[s]=this.#o(i)}#_(t,e){if(e===void 0)return;const n=t instanceof HTMLElement,s=typeof e;if(s!=="string"&&s!=="number"&&this.#e(t,void 0," computed content is not a string or number"),t instanceof HTMLElement&&dt(t))t.value=e;else if(n&&s==="string"&&e.trim().startsWith("<")){const i=Bn(e);t.replaceChildren(...i),this.#b(t),this.#m(t)}else n&&(t.textContent=e)}#I(t,e){const n=this.#u.get(t);if(!n)return;const s=this.getRootNode();if(!(s instanceof ShadowRoot))return;const{host:i}=s;if(!i)return;const c=i;c[n]=e}useState(t,e){if(!e){e={};for(const n of Object.keys(t))e[n]=n}this.#v(t,e);for(const[n,s]of Object.entries(e))if(this.#i(s)){const i=Le(t,n);i!==void 0&&(this[s]=i);const c=this.#t.properties[s];c.state=t,c.stateProp=n}t.addListener(this,e)}#P(){const t=this.#t,e=new Set(Object.keys(t.properties));for(const n of e)Hn.has(n)&&this.#e(null,"",`property "${n}" is not allowed because it is a reserved attribute`);for(const n of this.getAttributeNames())if(n!=="class"&&n!=="id"&&n!=="disabled"&&!n.startsWith("on")){if(n==="form-assoc"){this.#d();continue}if(!e.has(F.getPropName(n))){if(n==="name"){this.#d();continue}this.#e(null,n,"is not a supported attribute")}}}#p(t,e,n){const s=n.match(Kt);if(s)return s.forEach(i=>{const c=Lt(i);this[c]===void 0&&this.#a(t,e,c)}),s}#v(t,e){for(const[n,s]of Object.entries(e)){let i=Le(t,n);if(i===void 0)throw new Q(`invalid state path "${n}"`);i=this[s],this.#i(s)||this.#e(null,s,"refers to missing property in useState map")}}#x(t,e,n){if(n instanceof e)return;let s=typeof n;if(s==="object"){const{constructor:i}=n;s=i.name,i!==e&&this.#e(null,t,`was set to a ${s}, but must be a ${e.name}`)}s!==e.name.toLowerCase()&&this.#e(null,t,`was set to a ${s}, but must be a ${e.name}`)}#b(t){const e=Array.from(t.querySelectorAll("*"));for(const n of e){const s=[];for(const i of Array.from(n.attributes)){const c=i.name;if(c.startsWith("on")){let u=c.slice(2);u=u[0].toLowerCase()+u.slice(1).toLowerCase();const p=i.value;this.#p(n,c,p);let h;typeof this[p]=="function"?h=m=>this[p](m):(this.#p(n,c,p),h=()=>this.#o(p)),n.addEventListener(u,h),s.push(c)}}for(const i of s)n.removeAttribute(i)}}}function Yn(r,...t){let e=ke(r,t);for(;;){const n=xn.exec(e);if(!n)break;const s=n[2];if(ve.test(s)){const i=n[1];if(!i.startsWith("--")){const c=`--${i}: ${s};
|
|
5
|
+
${i}: var(--${i})`;e=Fe(e,n.index,n[0].length,c)}}}return e}function Vn(r,...t){let e=ke(r,t);for(;;){const n=Un.exec(e);if(!n||n[1]==="style")break;const s=Gn(n[2]);if(ve.test(s)){const i=`<!-- ${s.trim()} -->`,c=n.index+n[0].indexOf(">")+1;e=Fe(e,c,s.length,i)}}return e}T.Wrec=F,T.WrecState=Ct,T.createElement=$n,T.css=Yn,T.html=Vn,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
package/dist/wrec.es.d.ts
DELETED