wrec 0.20.12 → 0.20.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/wrec.d.ts CHANGED
@@ -18,6 +18,7 @@ export declare abstract class Wrec extends HTMLElement implements ChangeListener
18
18
  #private;
19
19
  static attrToPropMap: Map<string, string>;
20
20
  static propToAttrMap: Map<string, string>;
21
+ static context: {};
21
22
  static css: string;
22
23
  static elementName: string;
23
24
  static formAssociated: boolean;
package/dist/wrec.es.js CHANGED
@@ -163,11 +163,11 @@ function Qe() {
163
163
  const n = e, s = n.currentScript, {
164
164
  DocumentFragment: r,
165
165
  HTMLTemplateElement: a,
166
- Node: f,
166
+ Node: l,
167
167
  Element: p,
168
168
  NodeFilter: h,
169
169
  NamedNodeMap: m = i.NamedNodeMap || i.MozNamedAttrMap,
170
- HTMLFormElement: b,
170
+ HTMLFormElement: A,
171
171
  DOMParser: G,
172
172
  trustedTypes: H
173
173
  } = i, B = p.prototype, fn = pt(B, "cloneNode"), un = pt(B, "remove"), pn = pt(B, "nextSibling"), hn = pt(B, "childNodes"), At = pt(B, "parentNode");
@@ -198,7 +198,7 @@ function Qe() {
198
198
  } = Ye;
199
199
  let {
200
200
  IS_ALLOWED_URI: de
201
- } = Ye, _ = null;
201
+ } = Ye, b = null;
202
202
  const Te = d({}, [...We, ...te, ...ee, ...ne, ...Ge]);
203
203
  let S = null;
204
204
  const ge = d({}, [...Be, ...oe, ...je, ...Ct]);
@@ -250,14 +250,14 @@ function Qe() {
250
250
  const Rn = d({}, ["title", "style", "font", "a", "script"]);
251
251
  let ct = null;
252
252
  const On = ["application/xhtml+xml", "text/html"], wn = "text/html";
253
- let A = null, et = null;
253
+ let _ = null, et = null;
254
254
  const Mn = e.createElement("form"), we = function(o) {
255
255
  return o instanceof RegExp || o instanceof Function;
256
256
  }, Xt = function() {
257
257
  let o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
258
258
  if (!(et && et === o)) {
259
259
  if ((!o || typeof o != "object") && (o = {}), o = k(o), ct = // eslint-disable-next-line unicorn/prefer-includes
260
- On.indexOf(o.PARSER_MEDIA_TYPE) === -1 ? wn : o.PARSER_MEDIA_TYPE, A = ct === "application/xhtml+xml" ? Jt : Nt, _ = v(o, "ALLOWED_TAGS") ? d({}, o.ALLOWED_TAGS, A) : Te, S = v(o, "ALLOWED_ATTR") ? d({}, o.ALLOWED_ATTR, A) : ge, Vt = v(o, "ALLOWED_NAMESPACES") ? d({}, o.ALLOWED_NAMESPACES, Jt) : yn, jt = v(o, "ADD_URI_SAFE_ATTR") ? d(k(Oe), o.ADD_URI_SAFE_ATTR, A) : Oe, ye = v(o, "ADD_DATA_URI_TAGS") ? d(k(Re), o.ADD_DATA_URI_TAGS, A) : Re, I = v(o, "FORBID_CONTENTS") ? d({}, o.FORBID_CONTENTS, A) : Bt, rt = v(o, "FORBID_TAGS") ? d({}, o.FORBID_TAGS, A) : k({}), Ht = v(o, "FORBID_ATTR") ? d({}, o.FORBID_ATTR, A) : k({}), Q = v(o, "USE_PROFILES") ? o.USE_PROFILES : !1, Ee = o.ALLOW_ARIA_ATTR !== !1, zt = o.ALLOW_DATA_ATTR !== !1, Ae = o.ALLOW_UNKNOWN_PROTOCOLS || !1, _e = o.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Z = o.SAFE_FOR_TEMPLATES || !1, _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, at = o.IN_PLACE || !1, de = o.ALLOWED_URI_REGEXP || Ze, tt = o.NAMESPACE || z, Ot = o.MATHML_TEXT_INTEGRATION_POINTS || Ot, wt = o.HTML_INTEGRATION_POINTS || wt, g = o.CUSTOM_ELEMENT_HANDLING || {}, o.CUSTOM_ELEMENT_HANDLING && we(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (g.tagNameCheck = o.CUSTOM_ELEMENT_HANDLING.tagNameCheck), o.CUSTOM_ELEMENT_HANDLING && we(o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (g.attributeNameCheck = o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), o.CUSTOM_ELEMENT_HANDLING && typeof o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (g.allowCustomizedBuiltInElements = o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), Z && (zt = !1), 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, Ct)), Q.svgFilters === !0 && (d(_, ee), d(S, oe), d(S, Ct)), Q.mathMl === !0 && (d(_, ne), d(S, je), d(S, Ct))), 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 === ge && (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 && (I === Bt && (I = k(I)), d(I, o.FORBID_CONTENTS, A)), o.ADD_FORBID_CONTENTS && (I === Bt && (I = k(I)), d(I, o.ADD_FORBID_CONTENTS, A)), Gt && (_["#text"] = !0), V && d(_, ["html", "head", "body"]), _.table && (d(_, ["tbody"]), delete rt.tbody), o.TRUSTED_TYPES_POLICY) {
260
+ On.indexOf(o.PARSER_MEDIA_TYPE) === -1 ? wn : o.PARSER_MEDIA_TYPE, _ = ct === "application/xhtml+xml" ? Jt : Nt, b = v(o, "ALLOWED_TAGS") ? d({}, o.ALLOWED_TAGS, _) : Te, S = v(o, "ALLOWED_ATTR") ? d({}, o.ALLOWED_ATTR, _) : ge, Vt = v(o, "ALLOWED_NAMESPACES") ? d({}, o.ALLOWED_NAMESPACES, Jt) : yn, jt = v(o, "ADD_URI_SAFE_ATTR") ? d(k(Oe), o.ADD_URI_SAFE_ATTR, _) : Oe, ye = v(o, "ADD_DATA_URI_TAGS") ? d(k(Re), o.ADD_DATA_URI_TAGS, _) : Re, I = v(o, "FORBID_CONTENTS") ? d({}, o.FORBID_CONTENTS, _) : Bt, rt = v(o, "FORBID_TAGS") ? d({}, o.FORBID_TAGS, _) : k({}), Ht = v(o, "FORBID_ATTR") ? d({}, o.FORBID_ATTR, _) : k({}), Q = v(o, "USE_PROFILES") ? o.USE_PROFILES : !1, Ee = o.ALLOW_ARIA_ATTR !== !1, zt = o.ALLOW_DATA_ATTR !== !1, Ae = o.ALLOW_UNKNOWN_PROTOCOLS || !1, _e = o.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Z = o.SAFE_FOR_TEMPLATES || !1, _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, at = o.IN_PLACE || !1, de = o.ALLOWED_URI_REGEXP || Ze, tt = o.NAMESPACE || z, Ot = o.MATHML_TEXT_INTEGRATION_POINTS || Ot, wt = o.HTML_INTEGRATION_POINTS || wt, g = o.CUSTOM_ELEMENT_HANDLING || {}, o.CUSTOM_ELEMENT_HANDLING && we(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (g.tagNameCheck = o.CUSTOM_ELEMENT_HANDLING.tagNameCheck), o.CUSTOM_ELEMENT_HANDLING && we(o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (g.attributeNameCheck = o.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), o.CUSTOM_ELEMENT_HANDLING && typeof o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (g.allowCustomizedBuiltInElements = o.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), Z && (zt = !1), bt && (J = !0), Q && (b = d({}, Ge), S = [], Q.html === !0 && (d(b, We), d(S, Be)), Q.svg === !0 && (d(b, te), d(S, oe), d(S, Ct)), Q.svgFilters === !0 && (d(b, ee), d(S, oe), d(S, Ct)), Q.mathMl === !0 && (d(b, ne), d(S, je), d(S, Ct))), o.ADD_TAGS && (typeof o.ADD_TAGS == "function" ? K.tagCheck = o.ADD_TAGS : (b === Te && (b = k(b)), d(b, o.ADD_TAGS, _))), o.ADD_ATTR && (typeof o.ADD_ATTR == "function" ? K.attributeCheck = o.ADD_ATTR : (S === ge && (S = k(S)), d(S, o.ADD_ATTR, _))), o.ADD_URI_SAFE_ATTR && d(jt, o.ADD_URI_SAFE_ATTR, _), o.FORBID_CONTENTS && (I === Bt && (I = k(I)), d(I, o.FORBID_CONTENTS, _)), o.ADD_FORBID_CONTENTS && (I === Bt && (I = k(I)), d(I, o.ADD_FORBID_CONTENTS, _)), Gt && (b["#text"] = !0), V && d(b, ["html", "head", "body"]), b.table && (d(b, ["tbody"]), delete rt.tbody), o.TRUSTED_TYPES_POLICY) {
261
261
  if (typeof o.TRUSTED_TYPES_POLICY.createHTML != "function")
262
262
  throw ut('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
263
263
  if (typeof o.TRUSTED_TYPES_POLICY.createScriptURL != "function")
@@ -273,8 +273,8 @@ function Qe() {
273
273
  namespaceURI: tt,
274
274
  tagName: "template"
275
275
  });
276
- const l = Nt(o.tagName), T = Nt(c.tagName);
277
- return Vt[o.namespaceURI] ? o.namespaceURI === Rt ? c.namespaceURI === z ? l === "svg" : c.namespaceURI === yt ? l === "svg" && (T === "annotation-xml" || Ot[T]) : !!Me[l] : o.namespaceURI === yt ? c.namespaceURI === z ? l === "math" : c.namespaceURI === Rt ? l === "math" && wt[T] : !!Ce[l] : o.namespaceURI === z ? c.namespaceURI === Rt && !wt[T] || c.namespaceURI === yt && !Ot[T] ? !1 : !Ce[l] && (Rn[l] || !Me[l]) : !!(ct === "application/xhtml+xml" && Vt[o.namespaceURI]) : !1;
276
+ const f = Nt(o.tagName), T = Nt(c.tagName);
277
+ return Vt[o.namespaceURI] ? o.namespaceURI === Rt ? c.namespaceURI === z ? f === "svg" : c.namespaceURI === yt ? f === "svg" && (T === "annotation-xml" || Ot[T]) : !!Me[f] : o.namespaceURI === yt ? c.namespaceURI === z ? f === "math" : c.namespaceURI === Rt ? f === "math" && wt[T] : !!Ce[f] : o.namespaceURI === z ? c.namespaceURI === Rt && !wt[T] || c.namespaceURI === yt && !Ot[T] ? !1 : !Ce[f] && (Rn[f] || !Me[f]) : !!(ct === "application/xhtml+xml" && Vt[o.namespaceURI]) : !1;
278
278
  }, P = function(o) {
279
279
  lt(t.removed, {
280
280
  element: o
@@ -308,12 +308,12 @@ function Qe() {
308
308
  } catch {
309
309
  }
310
310
  }, Ne = function(o) {
311
- let c = null, l = null;
311
+ let c = null, f = null;
312
312
  if (Wt)
313
313
  o = "<remove></remove>" + o;
314
314
  else {
315
315
  const E = Qt(o, /^[\r\n\t ]+/);
316
- l = E && E[0];
316
+ f = E && E[0];
317
317
  }
318
318
  ct === "application/xhtml+xml" && tt === z && (o = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + o + "</body></html>");
319
319
  const T = w ? w.createHTML(o) : o;
@@ -330,7 +330,7 @@ function Qe() {
330
330
  }
331
331
  }
332
332
  const O = c.body || c.documentElement;
333
- return o && l && O.insertBefore(e.createTextNode(l), O.childNodes[0] || null), tt === z ? Tn.call(c, V ? "html" : "body")[0] : V ? c.documentElement : O;
333
+ return o && f && O.insertBefore(e.createTextNode(f), O.childNodes[0] || null), tt === z ? Tn.call(c, V ? "html" : "body")[0] : V ? c.documentElement : O;
334
334
  }, Le = function(o) {
335
335
  return mn.call(
336
336
  o.ownerDocument || o,
@@ -340,29 +340,29 @@ function Qe() {
340
340
  null
341
341
  );
342
342
  }, qt = function(o) {
343
- return o instanceof b && (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");
343
+ return o instanceof A && (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");
344
344
  }, De = function(o) {
345
- return typeof f == "function" && o instanceof f;
345
+ return typeof l == "function" && o instanceof l;
346
346
  };
347
347
  function $(u, o, c) {
348
- Mt(u, (l) => {
349
- l.call(t, o, c, et);
348
+ Mt(u, (f) => {
349
+ f.call(t, o, c, et);
350
350
  });
351
351
  }
352
352
  const xe = function(o) {
353
353
  let c = null;
354
354
  if ($(M.beforeSanitizeElements, o, null), qt(o))
355
355
  return P(o), !0;
356
- const l = A(o.nodeName);
356
+ const f = _(o.nodeName);
357
357
  if ($(M.uponSanitizeElement, o, {
358
- tagName: l,
359
- allowedTags: _
358
+ tagName: f,
359
+ allowedTags: b
360
360
  }), _t && o.hasChildNodes() && !De(o.firstElementChild) && C(/<[/\w!]/g, o.innerHTML) && C(/<[/\w!]/g, o.textContent) || o.nodeType === ht.progressingInstruction || _t && o.nodeType === ht.comment && C(/<[/\w]/g, o.data))
361
361
  return P(o), !0;
362
- if (!(K.tagCheck instanceof Function && K.tagCheck(l)) && (!_[l] || rt[l])) {
363
- if (!rt[l] && Ie(l) && (g.tagNameCheck instanceof RegExp && C(g.tagNameCheck, l) || g.tagNameCheck instanceof Function && g.tagNameCheck(l)))
362
+ if (!(K.tagCheck instanceof Function && K.tagCheck(f)) && (!b[f] || rt[f])) {
363
+ if (!rt[f] && Ie(f) && (g.tagNameCheck instanceof RegExp && C(g.tagNameCheck, f) || g.tagNameCheck instanceof Function && g.tagNameCheck(f)))
364
364
  return !1;
365
- if (Gt && !I[l]) {
365
+ if (Gt && !I[f]) {
366
366
  const T = At(o) || o.parentNode, O = hn(o) || o.childNodes;
367
367
  if (O && T) {
368
368
  const E = O.length;
@@ -374,13 +374,13 @@ function Qe() {
374
374
  }
375
375
  return P(o), !0;
376
376
  }
377
- return o instanceof p && !Cn(o) || (l === "noscript" || l === "noembed" || l === "noframes") && C(/<\/no(script|embed|frames)/i, o.innerHTML) ? (P(o), !0) : (Z && o.nodeType === ht.text && (c = o.textContent, Mt([kt, Ft, Ut], (T) => {
377
+ return o instanceof p && !Cn(o) || (f === "noscript" || f === "noembed" || f === "noframes") && C(/<\/no(script|embed|frames)/i, o.innerHTML) ? (P(o), !0) : (Z && o.nodeType === ht.text && (c = o.textContent, Mt([kt, Ft, Ut], (T) => {
378
378
  c = ft(c, T, " ");
379
379
  }), o.textContent !== c && (lt(t.removed, {
380
380
  element: o.cloneNode()
381
381
  }), o.textContent = c)), $(M.afterSanitizeElements, o, null), !1);
382
- }, ve = function(o, c, l) {
383
- if (be && (c === "id" || c === "name") && (l in e || l in Mn))
382
+ }, ve = function(o, c, f) {
383
+ if (be && (c === "id" || c === "name") && (f in e || f in Mn))
384
384
  return !1;
385
385
  if (!(zt && !Ht[c] && C(En, c))) {
386
386
  if (!(Ee && C(An, c))) {
@@ -392,13 +392,13 @@ function Qe() {
392
392
  // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
393
393
  !(Ie(o) && (g.tagNameCheck instanceof RegExp && C(g.tagNameCheck, o) || g.tagNameCheck instanceof Function && g.tagNameCheck(o)) && (g.attributeNameCheck instanceof RegExp && C(g.attributeNameCheck, c) || g.attributeNameCheck instanceof Function && g.attributeNameCheck(c, o)) || // Alternative, second condition checks if it's an `is`-attribute, AND
394
394
  // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
395
- c === "is" && g.allowCustomizedBuiltInElements && (g.tagNameCheck instanceof RegExp && C(g.tagNameCheck, l) || g.tagNameCheck instanceof Function && g.tagNameCheck(l)))
395
+ c === "is" && g.allowCustomizedBuiltInElements && (g.tagNameCheck instanceof RegExp && C(g.tagNameCheck, f) || g.tagNameCheck instanceof Function && g.tagNameCheck(f)))
396
396
  ) return !1;
397
397
  } else if (!jt[c]) {
398
- if (!C(de, ft(l, me, ""))) {
399
- if (!((c === "src" || c === "xlink:href" || c === "href") && o !== "script" && Pn(l, "data:") === 0 && ye[o])) {
400
- if (!(Ae && !C(_n, ft(l, me, "")))) {
401
- if (l)
398
+ if (!C(de, ft(f, me, ""))) {
399
+ if (!((c === "src" || c === "xlink:href" || c === "href") && o !== "script" && Pn(f, "data:") === 0 && ye[o])) {
400
+ if (!(Ae && !C(_n, ft(f, me, "")))) {
401
+ if (f)
402
402
  return !1;
403
403
  }
404
404
  }
@@ -417,7 +417,7 @@ function Qe() {
417
417
  } = o;
418
418
  if (!c || qt(o))
419
419
  return;
420
- const l = {
420
+ const f = {
421
421
  attrName: "",
422
422
  attrValue: "",
423
423
  keepAttr: !0,
@@ -430,9 +430,9 @@ function Qe() {
430
430
  name: E,
431
431
  namespaceURI: D,
432
432
  value: W
433
- } = O, nt = A(E), Kt = W;
433
+ } = O, nt = _(E), Kt = W;
434
434
  let y = E === "value" ? Kt : kn(Kt);
435
- if (l.attrName = nt, l.attrValue = y, l.keepAttr = !0, l.forceKeepAttr = void 0, $(M.uponSanitizeAttribute, o, l), y = l.attrValue, Se && (nt === "id" || nt === "name") && (X(E, o), y = Sn + y), _t && C(/((--!?|])>)|<\/(style|title|textarea)/i, y)) {
435
+ if (f.attrName = nt, f.attrValue = y, f.keepAttr = !0, f.forceKeepAttr = void 0, $(M.uponSanitizeAttribute, o, f), y = f.attrValue, Se && (nt === "id" || nt === "name") && (X(E, o), y = Sn + y), _t && C(/((--!?|])>)|<\/(style|title|textarea)/i, y)) {
436
436
  X(E, o);
437
437
  continue;
438
438
  }
@@ -440,9 +440,9 @@ function Qe() {
440
440
  X(E, o);
441
441
  continue;
442
442
  }
443
- if (l.forceKeepAttr)
443
+ if (f.forceKeepAttr)
444
444
  continue;
445
- if (!l.keepAttr) {
445
+ if (!f.keepAttr) {
446
446
  X(E, o);
447
447
  continue;
448
448
  }
@@ -453,7 +453,7 @@ function Qe() {
453
453
  Z && Mt([kt, Ft, Ut], (Fe) => {
454
454
  y = ft(y, Fe, " ");
455
455
  });
456
- const ke = A(o.nodeName);
456
+ const ke = _(o.nodeName);
457
457
  if (!ve(ke, nt, y)) {
458
458
  X(E, o);
459
459
  continue;
@@ -479,13 +479,13 @@ function Qe() {
479
479
  $(M.afterSanitizeAttributes, o, null);
480
480
  }, Nn = function u(o) {
481
481
  let c = null;
482
- const l = Le(o);
483
- for ($(M.beforeSanitizeShadowDOM, o, null); c = l.nextNode(); )
482
+ const f = Le(o);
483
+ for ($(M.beforeSanitizeShadowDOM, o, null); c = f.nextNode(); )
484
484
  $(M.uponSanitizeShadowNode, c, null), xe(c), Pe(c), c.content instanceof r && u(c.content);
485
485
  $(M.afterSanitizeShadowDOM, o, null);
486
486
  };
487
487
  return t.sanitize = function(u) {
488
- let o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, c = null, l = null, T = null, O = null;
488
+ let o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, c = null, f = null, T = null, O = null;
489
489
  if (Yt = !u, Yt && (u = "<!-->"), typeof u != "string" && !De(u))
490
490
  if (typeof u.toString == "function") {
491
491
  if (u = u.toString(), typeof u != "string")
@@ -496,12 +496,12 @@ function Qe() {
496
496
  return u;
497
497
  if ($t || Xt(o), t.removed = [], typeof u == "string" && (at = !1), at) {
498
498
  if (u.nodeName) {
499
- const W = A(u.nodeName);
500
- if (!_[W] || rt[W])
499
+ const W = _(u.nodeName);
500
+ if (!b[W] || rt[W])
501
501
  throw ut("root node is forbidden and cannot be sanitized in-place");
502
502
  }
503
- } else if (u instanceof f)
504
- c = Ne("<!---->"), l = c.ownerDocument.importNode(u, !0), l.nodeType === ht.element && l.nodeName === "BODY" || l.nodeName === "HTML" ? c = l : c.appendChild(l);
503
+ } else if (u instanceof l)
504
+ c = Ne("<!---->"), f = c.ownerDocument.importNode(u, !0), f.nodeType === ht.element && f.nodeName === "BODY" || f.nodeName === "HTML" ? c = f : c.appendChild(f);
505
505
  else {
506
506
  if (!J && !Z && !V && // eslint-disable-next-line unicorn/prefer-includes
507
507
  u.indexOf("<") === -1)
@@ -524,7 +524,7 @@ function Qe() {
524
524
  return (S.shadowroot || S.shadowrootmode) && (O = gn.call(n, O, !0)), O;
525
525
  }
526
526
  let D = V ? c.outerHTML : c.innerHTML;
527
- return V && _["!doctype"] && c.ownerDocument && c.ownerDocument.doctype && c.ownerDocument.doctype.name && C(Je, c.ownerDocument.doctype.name) && (D = "<!DOCTYPE " + c.ownerDocument.doctype.name + `>
527
+ return V && b["!doctype"] && c.ownerDocument && c.ownerDocument.doctype && c.ownerDocument.doctype.name && C(Je, c.ownerDocument.doctype.name) && (D = "<!DOCTYPE " + c.ownerDocument.doctype.name + `>
528
528
  ` + D), Z && Mt([kt, Ft, Ut], (W) => {
529
529
  D = ft(D, W, " ");
530
530
  }), w && St ? w.createHTML(D) : D;
@@ -535,8 +535,8 @@ function Qe() {
535
535
  et = null, $t = !1;
536
536
  }, t.isValidAttribute = function(u, o, c) {
537
537
  et || Xt({});
538
- const l = A(u), T = A(o);
539
- return ve(l, T, c);
538
+ const f = _(u), T = _(o);
539
+ return ve(f, T, c);
540
540
  }, t.addHook = function(u, o) {
541
541
  typeof o == "function" && lt(M[u], o);
542
542
  }, t.removeHook = function(u, o) {
@@ -557,20 +557,20 @@ function en(i, t, e = "") {
557
557
  // Intercept property reads.
558
558
  // This creates nested proxies lazily.
559
559
  get(r, a) {
560
- const f = Reflect.get(r, a);
561
- if (f === null || typeof f != "object") return f;
562
- const p = n.get(f);
560
+ const l = Reflect.get(r, a);
561
+ if (l === null || typeof l != "object") return l;
562
+ const p = n.get(l);
563
563
  if (p) return p;
564
- const h = e ? `${e}.${a}` : a, m = en(f, t, h);
565
- return n.set(f, m), m;
564
+ const h = e ? `${e}.${a}` : a, m = en(l, t, h);
565
+ return n.set(l, m), m;
566
566
  },
567
567
  // Intercept property writes.
568
- set(r, a, f) {
568
+ set(r, a, l) {
569
569
  const p = Reflect.get(r, a);
570
- if (p !== f) {
571
- Reflect.set(r, a, f);
570
+ if (p !== l) {
571
+ Reflect.set(r, a, l);
572
572
  const h = e ? `${e}.${a}` : a;
573
- t(h, p, f);
573
+ t(h, p, l);
574
574
  }
575
575
  return !0;
576
576
  }
@@ -676,10 +676,10 @@ q = new WeakMap(), vt = new WeakMap(), F = new WeakMap(), gt = new WeakMap(), Et
676
676
  else if (Lt && a instanceof HTMLElement && !a.isConnected)
677
677
  s.add(r);
678
678
  else {
679
- const { propertyMap: f } = r, p = Object.keys(f);
679
+ const { propertyMap: l } = r, p = Object.keys(l);
680
680
  (p.length === 0 || p.includes(t)) && a.changed(
681
681
  t,
682
- f[t],
682
+ l[t],
683
683
  n,
684
684
  e,
685
685
  this
@@ -707,8 +707,8 @@ function qe(i, t) {
707
707
  function Zn(i, t, e) {
708
708
  const n = t.split("."), s = n.length - 1;
709
709
  let r = i;
710
- n.forEach((a, f) => {
711
- f === s ? r[a] = e : r = r[a];
710
+ n.forEach((a, l) => {
711
+ l === s ? r[a] = e : r = r[a];
712
712
  });
713
713
  }
714
714
  const Jn = /* @__PURE__ */ new Set([
@@ -846,6 +846,10 @@ class U extends HTMLElement {
846
846
  // This is used to lookup the kebab-case attribute name
847
847
  // that corresponds to a camelCase property name.
848
848
  static propToAttrMap = /* @__PURE__ */ new Map();
849
+ // This can be overridden in each Wrec subclass.
850
+ // It lists all the module-level functions
851
+ // that be used in JavaScript expressions.
852
+ static context = {};
849
853
  // This can be set in each Wrec subclass.
850
854
  // It describes CSS rules that a web component uses.
851
855
  static css = "";
@@ -920,25 +924,33 @@ class U extends HTMLElement {
920
924
  batchSet(t) {
921
925
  this.#c = !0;
922
926
  const e = this.#t.propToExprsMap, n = /* @__PURE__ */ new Set();
923
- for (const [f, p] of Object.entries(t)) {
924
- this[f] = p;
925
- const h = e.get(f) ?? [];
927
+ for (const [l, p] of Object.entries(t)) {
928
+ this[l] = p;
929
+ const h = e.get(l) ?? [];
926
930
  for (const m of h)
927
931
  n.add(m);
928
932
  }
929
933
  const s = this.#t.propToComputedMap, r = /* @__PURE__ */ new Set(), a = {};
930
- for (const f of Object.keys(t)) {
931
- const p = s.get(f) || [];
934
+ for (const l of Object.keys(t)) {
935
+ const p = s.get(l) || [];
932
936
  for (const [h, m] of p)
933
937
  r.add(h), a[h] = m;
934
938
  }
935
- for (const f of r) {
936
- const p = a[f];
937
- this[f] = this.#n(p);
938
- const h = e.get(f) ?? [];
939
+ for (const l of r) {
940
+ const p = a[l];
941
+ this[l] = this.#n(p);
942
+ const h = e.get(l) ?? [];
939
943
  for (const m of h)
940
944
  n.add(m);
941
945
  }
946
+ for (; ; ) {
947
+ let l = !1;
948
+ for (const p of r) {
949
+ const h = a[p], m = this.#n(h), A = this[p];
950
+ JSON.stringify(m) !== JSON.stringify(A) && (this[p] = m, l = !0);
951
+ }
952
+ if (!l) break;
953
+ }
942
954
  this.#T([...n]), this.#c = !1;
943
955
  }
944
956
  async #O() {
@@ -982,24 +994,24 @@ class U extends HTMLElement {
982
994
  e.required && !r && this.#e(this, s, "is a required attribute");
983
995
  let a = e.value;
984
996
  this.hasOwnProperty(t) && (a = this[t], delete this[t]);
985
- const { type: f } = e, p = f === Boolean ? a || r : n.includes(s) && r ? this.#b(t, s) : a || ro(f), h = "#" + t;
997
+ const { type: l } = e, p = l === Boolean ? a || r : n.includes(s) && r ? this.#b(t, s) : a || ro(l), h = "#" + t;
986
998
  this[h] = p, e.computed && this.#D(t, e), Object.defineProperty(this, t, {
987
999
  enumerable: !0,
988
1000
  get() {
989
1001
  return this[h];
990
1002
  },
991
1003
  set(m) {
992
- f === Number && typeof m == "string" && (m = re(m));
993
- const b = this[h];
994
- if (m === b) return;
995
- this.#F(t, f, m), this[h] = m;
1004
+ l === Number && typeof m == "string" && (m = re(m));
1005
+ const A = this[h];
1006
+ if (m === A) return;
1007
+ this.#F(t, l, m), this[h] = m;
996
1008
  const { state: G, stateProp: H } = this.#t.properties[t];
997
- H && Zn(G, H, m), this.#x(t, f, m, s), this.#c || (this.#v(t), this.#_(t)), this.#I(t, m);
1009
+ H && Zn(G, H, m), this.#x(t, l, m, s), this.#c || (this.#v(t), this.#_(t)), this.#I(t, m);
998
1010
  const B = this.#l[t];
999
- B && this.setFormValue(B, String(m)), this.propertyChangedCallback(t, b, m), e.dispatch && this.dispatch("change", {
1011
+ B && this.setFormValue(B, String(m)), this.propertyChangedCallback(t, A, m), e.dispatch && this.dispatch("change", {
1000
1012
  tagName: this.localName,
1001
1013
  property: t,
1002
- oldValue: b,
1014
+ oldValue: A,
1003
1015
  value: m
1004
1016
  });
1005
1017
  }
@@ -1034,9 +1046,9 @@ class U extends HTMLElement {
1034
1046
  if (r) {
1035
1047
  const a = this[r];
1036
1048
  a === void 0 && this.#a(t, n, r), t[r] = a;
1037
- let [f, p] = n.split(":");
1038
- f === "value" && (p ? (t["on" + p] === void 0 && this.#e(t, n, "refers to an unsupported event name"), t.setAttribute(f, this[r])) : p = "change"), e && t.#p.set(
1039
- U.getPropName(f),
1049
+ let [l, p] = n.split(":");
1050
+ l === "value" && (p ? (t["on" + p] === void 0 && this.#e(t, n, "refers to an unsupported event name"), t.setAttribute(l, this[r])) : p = "change"), e && t.#p.set(
1051
+ U.getPropName(l),
1040
1052
  r
1041
1053
  );
1042
1054
  }
@@ -1050,13 +1062,17 @@ class U extends HTMLElement {
1050
1062
  if (r instanceof HTMLElement)
1051
1063
  this.#y(r, n);
1052
1064
  else if (!(r instanceof CSSStyleRule)) {
1053
- const { element: a, attrName: f } = r;
1054
- a instanceof CSSStyleRule ? a.style.setProperty(f, n) : ae(a, f, n);
1065
+ const { element: a, attrName: l } = r;
1066
+ a instanceof CSSStyleRule ? a.style.setProperty(l, n) : ae(a, l, n);
1055
1067
  }
1056
1068
  }
1057
1069
  }
1058
1070
  #n(t) {
1059
- return new Function("return " + t).call(this);
1071
+ const { context: e } = this.#t;
1072
+ return new Function(
1073
+ "context",
1074
+ `const {${Object.keys(e).join(",")}} = context; return ${t};`
1075
+ ).call(this, e);
1060
1076
  }
1061
1077
  #N(t) {
1062
1078
  const { localName: e } = t;
@@ -1064,8 +1080,8 @@ class U extends HTMLElement {
1064
1080
  const { sheet: n } = t, s = n?.cssRules ?? [], r = Array.from(s);
1065
1081
  for (const a of r)
1066
1082
  if (a.constructor === CSSStyleRule) {
1067
- const f = Array.from(a.style);
1068
- for (const p of f)
1083
+ const l = Array.from(a.style);
1084
+ for (const p of l)
1069
1085
  if (p.startsWith("--")) {
1070
1086
  const h = a.style.getPropertyValue(p);
1071
1087
  this.#r(h, a, p);
@@ -1107,8 +1123,8 @@ class U extends HTMLElement {
1107
1123
  }
1108
1124
  const e = {}, n = t.split(",");
1109
1125
  for (const a of n) {
1110
- const [f, p] = a.split(":");
1111
- e[f.trim()] = p.trim();
1126
+ const [l, p] = a.split(":");
1127
+ e[l.trim()] = p.trim();
1112
1128
  }
1113
1129
  this.#l = e, this.#s = new FormData(), this.#u = this.attachInternals(), this.#u.setFormValue(this.#s);
1114
1130
  const s = Object.keys(this.#t.properties), r = this.#f;
@@ -1135,14 +1151,14 @@ class U extends HTMLElement {
1135
1151
  const [s] = n;
1136
1152
  if (!se.test(s)) return;
1137
1153
  const r = he(t) || dt(t);
1138
- let [a, f] = (e ?? "").split(":");
1154
+ let [a, l] = (e ?? "").split(":");
1139
1155
  if (!(r && a === "value" || dt(t))) return;
1140
- f ? t["on" + f] === void 0 && this.#e(t, e, "refers to an unsupported event name") : f = "change";
1156
+ l ? t["on" + l] === void 0 && this.#e(t, e, "refers to an unsupported event name") : l = "change";
1141
1157
  const h = mt(s);
1142
- t.addEventListener(f, (m) => {
1143
- const { target: b } = m;
1144
- if (!b) return;
1145
- const G = b.value, { type: H } = this.#t.properties[h];
1158
+ t.addEventListener(l, (m) => {
1159
+ const { target: A } = m;
1160
+ if (!A) return;
1161
+ const G = A.value, { type: H } = this.#t.properties[h];
1146
1162
  this[h] = H === Number ? re(G) : G, this.#_(h);
1147
1163
  });
1148
1164
  }
@@ -1188,14 +1204,14 @@ class U extends HTMLElement {
1188
1204
  let m = r.get(p);
1189
1205
  m || (m = [], r.set(p, m)), m.push([t, h]);
1190
1206
  }
1191
- const f = n.match(ie) || [];
1192
- for (const p of f) {
1207
+ const l = n.match(ie) || [];
1208
+ for (const p of l) {
1193
1209
  const h = mt(p);
1194
1210
  this[h] === void 0 && this.#a(null, t, h), typeof this[h] != "function" && a(h, n);
1195
1211
  }
1196
1212
  if (s)
1197
1213
  for (const p of s.split(","))
1198
- a(p, n);
1214
+ a(p.trim(), n);
1199
1215
  }
1200
1216
  // WARNING: Do not place untrusted JavaScript expressions
1201
1217
  // in attribute values or the text content of elements!
@@ -1212,21 +1228,21 @@ class U extends HTMLElement {
1212
1228
  const h = mt(p);
1213
1229
  if (typeof this[h] == "function") return;
1214
1230
  const m = r.propToExprsMap;
1215
- let b = m.get(h);
1216
- b || (b = [], m.set(h, b)), b.includes(t) || b.push(t);
1231
+ let A = m.get(h);
1232
+ A || (A = [], m.set(h, A)), A.includes(t) || A.push(t);
1217
1233
  });
1218
1234
  for (const [p, h] of this.#o.entries())
1219
1235
  for (const m of h) {
1220
- const b = m instanceof HTMLElement || m instanceof CSSStyleRule ? m : m.element;
1221
- b instanceof CSSStyleRule || b.isConnected || this.#o.set(
1236
+ const A = m instanceof HTMLElement || m instanceof CSSStyleRule ? m : m.element;
1237
+ A instanceof CSSStyleRule || A.isConnected || this.#o.set(
1222
1238
  p,
1223
1239
  h.filter((G) => G !== m)
1224
1240
  );
1225
1241
  }
1226
1242
  let a = this.#o.get(t);
1227
1243
  a || (a = [], this.#o.set(t, a)), a.push(n ? { element: e, attrName: n } : e), e instanceof HTMLElement && this.#L(e, n, s);
1228
- const f = this.#n(t);
1229
- n ? ae(e, n, f) : this.#y(e, f);
1244
+ const l = this.#n(t);
1245
+ n ? ae(e, n, l) : this.#y(e, l);
1230
1246
  }
1231
1247
  // This follows the best practice
1232
1248
  // "Do not override author-set, global attributes."
@@ -1387,12 +1403,12 @@ class U extends HTMLElement {
1387
1403
  for (const r of Array.from(n.attributes)) {
1388
1404
  const a = r.name;
1389
1405
  if (a.startsWith("on")) {
1390
- let f = a.slice(2);
1391
- f = f[0].toLowerCase() + f.slice(1).toLowerCase();
1406
+ let l = a.slice(2);
1407
+ l = l[0].toLowerCase() + l.slice(1).toLowerCase();
1392
1408
  const p = r.value;
1393
1409
  this.#h(n, a, p);
1394
1410
  let h;
1395
- typeof this[p] == "function" ? h = (m) => this[p](m) : (this.#h(n, a, p), h = () => this.#n(p)), n.addEventListener(f, h), s.push(a);
1411
+ typeof this[p] == "function" ? h = (m) => this[p](m) : (this.#h(n, a, p), h = () => this.#n(p)), n.addEventListener(l, h), s.push(a);
1396
1412
  }
1397
1413
  }
1398
1414
  for (const r of s)
package/dist/wrec.umd.js CHANGED
@@ -1,5 +1,5 @@
1
- (function(T,E){typeof exports=="object"&&typeof module<"u"?E(exports):typeof define=="function"&&define.amd?define(["exports"],E):(T=typeof globalThis<"u"?globalThis:T||self,E(T.wrec={}))})(this,(function(T){"use strict";var ln=T=>{throw TypeError(T)};var ge=(T,E,C)=>E.has(T)||ln("Cannot "+C);var w=(T,E,C)=>(ge(T,E,"read from private field"),C?C.call(T):E.get(T)),q=(T,E,C)=>E.has(T)?ln("Cannot add the same private member more than once"):E instanceof WeakSet?E.add(T):E.set(T,C),at=(T,E,C,St)=>(ge(T,E,"write to private field"),St?St.call(T,C):E.set(T,C),C),fn=(T,E,C)=>(ge(T,E,"access private method"),C);var K,Lt,H,Tt,gt,Y,Dt,un;const{entries:E,setPrototypeOf:C,isFrozen:St,getPrototypeOf:pn,getOwnPropertyDescriptor:hn}=Object;let{freeze:N,seal:P,create:zt}=Object,{apply:$t,construct:Wt}=typeof Reflect<"u"&&Reflect;N||(N=function(t){return t}),P||(P=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),mn=D(Array.prototype.lastIndexOf),Ee=D(Array.prototype.pop),ct=D(Array.prototype.push),dn=D(Array.prototype.splice),Rt=D(String.prototype.toLowerCase),Gt=D(String.prototype.toString),Bt=D(String.prototype.match),lt=D(String.prototype.replace),Tn=D(String.prototype.indexOf),gn=D(String.prototype.trim),k=D(Object.prototype.hasOwnProperty),L=D(RegExp.prototype.test),ft=En(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 En(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;C&&C(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 An(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 E(r))k(r,e)&&(Array.isArray(n)?t[e]=An(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=hn(r,t);if(n){if(n.get)return D(n.get);if(typeof n.value=="function")return D(n.value)}r=pn(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"]),_n=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"]),bn=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"]),Ot=N(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Sn=P(/\{\{[\w\W]*|[\w\W]*\}\}/gm),yn=P(/<%[\w\W]*|[\w\W]*%>/gm),Rn=P(/\$\{[\w\W]*/gm),On=P(/^data-[\-\w.\u00B7-\uFFFF]+$/),wn=P(/^aria-[\-\w]+$/),ye=P(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Mn=P(/^(?:\w+script|data):/i),Cn=P(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Re=P(/^html$/i),Nn=P(/^[a-z][.\w]*(-[.\w]+)+$/i);var Oe=Object.freeze({__proto__:null,ARIA_ATTR:wn,ATTR_WHITESPACE:Cn,CUSTOM_ELEMENT:Nn,DATA_ATTR:On,DOCTYPE_NAME:Re,ERB_EXPR:yn,IS_ALLOWED_URI:ye,IS_SCRIPT_OR_DATA:Mn,MUSTACHE_EXPR:Sn,TMPLIT_EXPR:Rn});const pt={element:1,text:3,progressingInstruction:7,comment:8,document:9},Ln=function(){return typeof window>"u"?null:window},Dn=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(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},we=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Me(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ln();const t=u=>Me(u);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:a,Node:f,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"),xt=ut(X,"parentNode");if(typeof a=="function"){const u=e.createElement("template");u.content&&u.content.ownerDocument&&(e=u.content.ownerDocument)}let x,Et="";const{implementation:ee,createNodeIterator:Jn,createDocumentFragment:Qn,getElementsByTagName:to}=e,{importNode:eo}=n;let v=we();t.isSupported=typeof E=="function"&&typeof xt=="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:Ue,CUSTOM_ELEMENT:io}=Oe;let{IS_ALLOWED_URI:He}=Oe,S=null;const ze=d({},[...Ae,...jt,...Yt,...Vt,..._e]);let R=null;const $e=d({},[...be,...Xt,...Se,...Ot]);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 tt=Object.seal(zt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let We=!0,re=!0,Ge=!1,Be=!0,et=!1,vt=!0,Z=!1,ae=!1,ce=!1,nt=!1,It=!1,Pt=!1,je=!0,Ye=!1;const ro="user-content-";let le=!0,_t=!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 Ve=null;const Xe=d({},["audio","video","img","source","image","track"]);let ue=null;const qe=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 bt=null;const lo=["application/xhtml+xml","text/html"],fo="text/html";let b=null,it=null;const uo=e.createElement("form"),Ke=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),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):ze,R=k(o,"ALLOWED_ATTR")?d({},o.ALLOWED_ATTR,b):$e,he=k(o,"ALLOWED_NAMESPACES")?d({},o.ALLOWED_NAMESPACES,Gt):ao,ue=k(o,"ADD_URI_SAFE_ATTR")?d(U(qe),o.ADD_URI_SAFE_ATTR,b):qe,Ve=k(o,"ADD_DATA_URI_TAGS")?d(U(Xe),o.ADD_DATA_URI_TAGS,b):Xe,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({}),ot=k(o,"USE_PROFILES")?o.USE_PROFILES:!1,We=o.ALLOW_ARIA_ATTR!==!1,re=o.ALLOW_DATA_ATTR!==!1,Ge=o.ALLOW_UNKNOWN_PROTOCOLS||!1,Be=o.ALLOW_SELF_CLOSE_IN_ATTR!==!1,et=o.SAFE_FOR_TEMPLATES||!1,vt=o.SAFE_FOR_XML!==!1,Z=o.WHOLE_DOCUMENT||!1,nt=o.RETURN_DOM||!1,It=o.RETURN_DOM_FRAGMENT||!1,Pt=o.RETURN_TRUSTED_TYPE||!1,ce=o.FORCE_BODY||!1,je=o.SANITIZE_DOM!==!1,Ye=o.SANITIZE_NAMED_PROPS||!1,le=o.KEEP_CONTENT!==!1,_t=o.IN_PLACE||!1,He=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&&Ke(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(A.tagNameCheck=o.CUSTOM_ELEMENT_HANDLING.tagNameCheck),o.CUSTOM_ELEMENT_HANDLING&&Ke(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),It&&(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,Ot)),ot.svgFilters===!0&&(d(S,Yt),d(R,Xt),d(R,Ot)),ot.mathMl===!0&&(d(S,Vt),d(R,Se),d(R,Ot))),o.ADD_TAGS&&(typeof o.ADD_TAGS=="function"?tt.tagCheck=o.ADD_TAGS:(S===ze&&(S=U(S)),d(S,o.ADD_TAGS,b))),o.ADD_ATTR&&(typeof o.ADD_ATTR=="function"?tt.attributeCheck=o.ADD_ATTR:(R===$e&&(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 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.');x=o.TRUSTED_TYPES_POLICY,Et=x.createHTML("")}else x===void 0&&(x=Dn(W,s)),x!==null&&typeof Et=="string"&&(Et=x.createHTML(""));N&&N(o),it=o}},Ze=d({},[...jt,...Yt,..._n]),Je=d({},[...Vt,...bn]),po=function(o){let c=xt(o);(!c||!c.tagName)&&(c={namespaceURI:st,tagName:"template"});const l=Rt(o.tagName),g=Rt(c.tagName);return he[o.namespaceURI]?o.namespaceURI===Ft?c.namespaceURI===G?l==="svg":c.namespaceURI===kt?l==="svg"&&(g==="annotation-xml"||Ut[g]):!!Ze[l]:o.namespaceURI===kt?c.namespaceURI===G?l==="math":c.namespaceURI===Ft?l==="math"&&Ht[g]:!!Je[l]:o.namespaceURI===G?c.namespaceURI===Ft&&!Ht[g]||c.namespaceURI===kt&&!Ut[g]?!1:!Je[l]&&(co[l]||!Ze[l]):!!(bt==="application/xhtml+xml"&&he[o.namespaceURI]):!1},$=function(o){ct(t.removed,{element:o});try{xt(o).removeChild(o)}catch{qn(o)}},J=function(o,c){try{ct(t.removed,{attribute:c.getAttributeNode(o),from:c})}catch{ct(t.removed,{attribute:null,from:c})}if(c.removeAttribute(o),o==="is")if(nt||It)try{$(c)}catch{}else try{c.setAttribute(o,"")}catch{}},Qe=function(o){let c=null,l=null;if(ce)o="<remove></remove>"+o;else{const _=Bt(o,/^[\r\n\t ]+/);l=_&&_[0]}bt==="application/xhtml+xml"&&st===G&&(o='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+o+"</body></html>");const g=x?x.createHTML(o):o;if(st===G)try{c=new V().parseFromString(g,bt)}catch{}if(!c||!c.documentElement){c=ee.createDocument(st,"template",null);try{c.documentElement.innerHTML=pe?Et:g}catch{}}const M=c.body||c.documentElement;return o&&l&&M.insertBefore(e.createTextNode(l),M.childNodes[0]||null),st===G?to.call(c,Z?"html":"body")[0]:Z?c.documentElement:M},tn=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")},en=function(o){return typeof f=="function"&&o instanceof f};function B(u,o,c){yt(u,l=>{l.call(t,o,c,it)})}const nn=function(o){let c=null;if(B(v.beforeSanitizeElements,o,null),de(o))return $(o),!0;const l=b(o.nodeName);if(B(v.uponSanitizeElement,o,{tagName:l,allowedTags:S}),vt&&o.hasChildNodes()&&!en(o.firstElementChild)&&L(/<[/\w!]/g,o.innerHTML)&&L(/<[/\w!]/g,o.textContent)||o.nodeType===pt.progressingInstruction||vt&&o.nodeType===pt.comment&&L(/<[/\w]/g,o.data))return $(o),!0;if(!(tt.tagCheck instanceof Function&&tt.tagCheck(l))&&(!S[l]||At[l])){if(!At[l]&&sn(l)&&(A.tagNameCheck instanceof RegExp&&L(A.tagNameCheck,l)||A.tagNameCheck instanceof Function&&A.tagNameCheck(l)))return!1;if(le&&!z[l]){const g=xt(o)||o.parentNode,M=Zn(o)||o.childNodes;if(M&&g){const _=M.length;for(let I=_-1;I>=0;--I){const j=Xn(M[I],!0);j.__removalCount=(o.__removalCount||0)+1,g.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&&(c=o.textContent,yt([ne,oe,se],g=>{c=lt(c,g," ")}),o.textContent!==c&&(ct(t.removed,{element:o.cloneNode()}),o.textContent=c)),B(v.afterSanitizeElements,o,null),!1)},on=function(o,c,l){if(je&&(c==="id"||c==="name")&&(l in e||l in uo))return!1;if(!(re&&!ie[c]&&L(no,c))){if(!(We&&L(oo,c))){if(!(tt.attributeCheck instanceof Function&&tt.attributeCheck(c,o))){if(!R[c]||ie[c]){if(!(sn(o)&&(A.tagNameCheck instanceof RegExp&&L(A.tagNameCheck,o)||A.tagNameCheck instanceof Function&&A.tagNameCheck(o))&&(A.attributeNameCheck instanceof RegExp&&L(A.attributeNameCheck,c)||A.attributeNameCheck instanceof Function&&A.attributeNameCheck(c,o))||c==="is"&&A.allowCustomizedBuiltInElements&&(A.tagNameCheck instanceof RegExp&&L(A.tagNameCheck,l)||A.tagNameCheck instanceof Function&&A.tagNameCheck(l))))return!1}else if(!ue[c]){if(!L(He,lt(l,Ue,""))){if(!((c==="src"||c==="xlink:href"||c==="href")&&o!=="script"&&Tn(l,"data:")===0&&Ve[o])){if(!(Ge&&!L(so,lt(l,Ue,"")))){if(l)return!1}}}}}}}return!0},sn=function(o){return o!=="annotation-xml"&&Bt(o,io)},rn=function(o){B(v.beforeSanitizeAttributes,o,null);const{attributes:c}=o;if(!c||de(o))return;const l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0};let g=c.length;for(;g--;){const M=c[g],{name:_,namespaceURI:I,value:j}=M,rt=b(_),Te=j;let O=_==="value"?Te:gn(Te);if(l.attrName=rt,l.attrValue=O,l.keepAttr=!0,l.forceKeepAttr=void 0,B(v.uponSanitizeAttribute,o,l),O=l.attrValue,Ye&&(rt==="id"||rt==="name")&&(J(_,o),O=ro+O),vt&&L(/((--!?|])>)|<\/(style|title|textarea)/i,O)){J(_,o);continue}if(rt==="attributename"&&Bt(O,"href")){J(_,o);continue}if(l.forceKeepAttr)continue;if(!l.keepAttr){J(_,o);continue}if(!Be&&L(/\/>/i,O)){J(_,o);continue}et&&yt([ne,oe,se],cn=>{O=lt(O,cn," ")});const an=b(o.nodeName);if(!on(an,rt,O)){J(_,o);continue}if(x&&typeof W=="object"&&typeof W.getAttributeType=="function"&&!I)switch(W.getAttributeType(an,rt)){case"TrustedHTML":{O=x.createHTML(O);break}case"TrustedScriptURL":{O=x.createScriptURL(O);break}}if(O!==Te)try{I?o.setAttributeNS(I,_,O):o.setAttribute(_,O),de(o)?$(o):Ee(t.removed)}catch{J(_,o)}}B(v.afterSanitizeAttributes,o,null)},ho=function u(o){let c=null;const l=tn(o);for(B(v.beforeSanitizeShadowDOM,o,null);c=l.nextNode();)B(v.uponSanitizeShadowNode,c,null),nn(c),rn(c),c.content instanceof i&&u(c.content);B(v.afterSanitizeShadowDOM,o,null)};return t.sanitize=function(u){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=null,l=null,g=null,M=null;if(pe=!u,pe&&(u="<!-->"),typeof u!="string"&&!en(u))if(typeof u.toString=="function"){if(u=u.toString(),typeof u!="string")throw ft("dirty is not a string, aborting")}else throw ft("toString is not a function");if(!t.isSupported)return u;if(ae||me(o),t.removed=[],typeof u=="string"&&(_t=!1),_t){if(u.nodeName){const j=b(u.nodeName);if(!S[j]||At[j])throw ft("root node is forbidden and cannot be sanitized in-place")}}else if(u instanceof f)c=Qe("<!---->"),l=c.ownerDocument.importNode(u,!0),l.nodeType===pt.element&&l.nodeName==="BODY"||l.nodeName==="HTML"?c=l:c.appendChild(l);else{if(!nt&&!et&&!Z&&u.indexOf("<")===-1)return x&&Pt?x.createHTML(u):u;if(c=Qe(u),!c)return nt?null:Pt?Et:""}c&&ce&&$(c.firstChild);const _=tn(_t?u:c);for(;g=_.nextNode();)nn(g),rn(g),g.content instanceof i&&ho(g.content);if(_t)return u;if(nt){if(It)for(M=Qn.call(c.ownerDocument);c.firstChild;)M.appendChild(c.firstChild);else M=c;return(R.shadowroot||R.shadowrootmode)&&(M=eo.call(n,M,!0)),M}let I=Z?c.outerHTML:c.innerHTML;return Z&&S["!doctype"]&&c.ownerDocument&&c.ownerDocument.doctype&&c.ownerDocument.doctype.name&&L(Re,c.ownerDocument.doctype.name)&&(I="<!DOCTYPE "+c.ownerDocument.doctype.name+`>
2
- `+I),et&&yt([ne,oe,se],j=>{I=lt(I,j," ")}),x&&Pt?x.createHTML(I):I},t.setConfig=function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};me(u),ae=!0},t.clearConfig=function(){it=null,ae=!1},t.isValidAttribute=function(u,o,c){it||me({});const l=b(u),g=b(o);return on(l,g,c)},t.addHook=function(u,o){typeof o=="function"&&ct(v[u],o)},t.removeHook=function(u,o){if(o!==void 0){const c=mn(v[u],o);return c===-1?void 0:dn(v[u],c,1)[0]}return Ee(v[u])},t.removeHooks=function(u){v[u]=[]},t.removeAllHooks=function(){v=we()},t}var Ce=Me();function Ne(r,t,e=""){const n=new WeakMap,s={get(i,a){const f=Reflect.get(i,a);if(f===null||typeof f!="object")return f;const p=n.get(f);if(p)return p;const h=e?`${e}.${a}`:a,m=Ne(f,t,h);return n.set(f,m),m},set(i,a,f){const p=Reflect.get(i,a);if(p!==f){Reflect.set(i,a,f);const h=e?`${e}.${a}`:a;t(h,p,f)}return!0}};return new Proxy(r,s)}function Le(r){const t={};for(const[e,n]of Object.entries(r)){const s=typeof n=="object"&&n!==null;t[e]=s?Le(n):n}return t}const wt=typeof window<"u"&&typeof window.document<"u";let De=class extends Error{};const Q=class Q{constructor(t,e,n){q(this,Dt);q(this,Lt,Symbol("objectId"));q(this,H,[]);q(this,Tt);q(this,gt);q(this,Y);if(!t)throw new De("name cannot be empty");if(w(Q,K).has(t))throw new De(`WrecState with name "${t}" already exists`);if(at(this,Tt,t),at(this,gt,e),at(this,Y,Ne({},fn(this,Dt,un).bind(this))),e&&wt){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);w(Q,K).set(t,this)}static get(t){return w(this,K).get(t)}addListener(t,e={}){const n=w(this,H).find(s=>s.listenerRef.deref()===t);if(n){const{propertyMap:s}=n;for(const[i,a]of Object.entries(e))s[i]=a}else w(this,H).push({listenerRef:new WeakRef(t),propertyMap:e})}addProperty(t,e){Object.defineProperty(this,t,{enumerable:!0,get(){return w(this,Y)[t]},set(n){w(this,Y)[t]=n}}),w(this,Y)[t]=e}get id(){return w(this,Lt)}log(){console.log("WrecState:",w(this,Tt));for(const[t,e]of Object.entries(w(this,Y)))console.log(` ${t} = ${JSON.stringify(e)}`)}removeListener(t){at(this,H,w(this,H).filter(e=>e.listenerRef.deref()!==t))}};K=new WeakMap,Lt=new WeakMap,H=new WeakMap,Tt=new WeakMap,gt=new WeakMap,Y=new WeakMap,Dt=new WeakSet,un=function(t,e,n){const s=new Set;for(const i of w(this,H)){const a=i.listenerRef.deref();if(!a)s.add(i);else if(wt&&a instanceof HTMLElement&&!a.isConnected)s.add(i);else{const{propertyMap:f}=i,p=Object.keys(f);(p.length===0||p.includes(t))&&a.changed(t,f[t],n,e,this)}}at(this,H,w(this,H).filter(i=>!s.has(i)))},q(Q,K,new Map),wt&&window.addEventListener("beforeunload",()=>{for(const[t,e]of w(Q,K).entries())if(w(e,gt)){const n=Le(e);sessionStorage.setItem("wrec-state-"+t,JSON.stringify(n))}});let Mt=Q;wt&&process.env.NODE_ENV==="development"&&(window.WrecState=Mt);function xe(r,t){let e=r;for(const n of t.split("."))e=e[n];return e}function xn(r,t,e){const n=t.split("."),s=n.length-1;let i=r;n.forEach((a,f)=>{f===s?i[a]=e:i=i[a]})}const vn=new Set(["class","disabled","hidden","id","tabindex","title"]),In=new Set(["onblur","onchange","onclick","onfocus","oninput","onkeydown","onreset","onsubmit"]);Ce.addHook("uponSanitizeAttribute",(r,t)=>{const{attrName:e}=t,n=e.toLowerCase();In.has(n)&&(t.forceKeepAttr=!0)});class Ct extends Error{}const Pn=/([a-zA-Z-]+)\s*:\s*([^;}]+)/g,ve="a-zA-Z_$",kn=ve+"0-9",ht=`[${ve}][${kn}]*`,Fn=/<!--\s*(.*?)\s*-->/,Un=/<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g,qt=new RegExp(`^this\\.${ht}$`),Kt=new RegExp(`this\\.${ht}(\\.${ht})*`,"g"),Ie=new RegExp(`this\\.${ht}(\\.${ht})*`),Hn=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 Nt(r){const t=[];let e=r.firstElementChild;for(;e;)t.push(e),e.shadowRoot&&t.push(...Nt(e.shadowRoot)),e.firstElementChild&&t.push(...Nt(e)),e=e.nextElementSibling;return t}const mt=r=>r.substring(Hn).split(".")[0];function Pe(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 ke(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=Ce.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 Ct(`can't convert "${r}" to a number`);return t}function Fe(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),a=String(e);i!==a&&(r.setAttribute(n,a),n==="value"&&Jt(r)&&(r.value=a))}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):(Fe(r,n,e),n==="value"&&Jt(r)&&(r.value=e))}async function jn(r){const t=new Set;for(const n of Nt(r.content)){const{localName:s}=n;s.includes("-")&&t.add(s)}function e(n){return new Promise((s,i)=>{setTimeout(()=>{const a=`custom element <${n}> not defined`;i(new Error(a))},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;#c=!1;#t=this.constructor;#o=new Map;#l={};#s;#f={};#u=null;#p=new Map;static define(t){if(this.elementName=t,customElements.get(t))throw new Ct(`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.#d();const s=F.getPropName(t);if(this.#i(s)){const i=this.#S(s,String(n));this[s]=i;const a=this.#l[s];a&&this.setFormValue(a,String(i)),this.propertyChangedCallback(s,e,n)}}batchSet(t){this.#c=!0;const e=this.#t.propToExprsMap,n=new Set;for(const[f,p]of Object.entries(t)){this[f]=p;const h=e.get(f)??[];for(const m of h)n.add(m)}const s=this.#t.propToComputedMap,i=new Set,a={};for(const f of Object.keys(t)){const p=s.get(f)||[];for(const[h,m]of p)i.add(h),a[h]=m}for(const f of i){const p=a[f];this[f]=this.#n(p);const h=e.get(f)??[];for(const m of h)n.add(m)}this.#T([...n]),this.#c=!1}async#O(){const t=this.#t;let{template:e}=t;if(!e){e=t.template=document.createElement("template");let n=`<style>
1
+ (function(T,E){typeof exports=="object"&&typeof module<"u"?E(exports):typeof define=="function"&&define.amd?define(["exports"],E):(T=typeof globalThis<"u"?globalThis:T||self,E(T.wrec={}))})(this,(function(T){"use strict";var ln=T=>{throw TypeError(T)};var ge=(T,E,C)=>E.has(T)||ln("Cannot "+C);var w=(T,E,C)=>(ge(T,E,"read from private field"),C?C.call(T):E.get(T)),q=(T,E,C)=>E.has(T)?ln("Cannot add the same private member more than once"):E instanceof WeakSet?E.add(T):E.set(T,C),at=(T,E,C,St)=>(ge(T,E,"write to private field"),St?St.call(T,C):E.set(T,C),C),fn=(T,E,C)=>(ge(T,E,"access private method"),C);var K,Lt,H,Tt,gt,Y,Dt,un;const{entries:E,setPrototypeOf:C,isFrozen:St,getPrototypeOf:pn,getOwnPropertyDescriptor:hn}=Object;let{freeze:N,seal:P,create:zt}=Object,{apply:$t,construct:Wt}=typeof Reflect<"u"&&Reflect;N||(N=function(t){return t}),P||(P=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),mn=D(Array.prototype.lastIndexOf),Ee=D(Array.prototype.pop),ct=D(Array.prototype.push),dn=D(Array.prototype.splice),Rt=D(String.prototype.toLowerCase),Gt=D(String.prototype.toString),jt=D(String.prototype.match),lt=D(String.prototype.replace),Tn=D(String.prototype.indexOf),gn=D(String.prototype.trim),k=D(Object.prototype.hasOwnProperty),L=D(RegExp.prototype.test),ft=En(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 En(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;C&&C(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 An(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 E(r))k(r,e)&&(Array.isArray(n)?t[e]=An(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=hn(r,t);if(n){if(n.get)return D(n.get);if(typeof n.value=="function")return D(n.value)}r=pn(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"]),Bt=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"]),_n=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"]),bn=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"]),Ot=N(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Sn=P(/\{\{[\w\W]*|[\w\W]*\}\}/gm),yn=P(/<%[\w\W]*|[\w\W]*%>/gm),Rn=P(/\$\{[\w\W]*/gm),On=P(/^data-[\-\w.\u00B7-\uFFFF]+$/),wn=P(/^aria-[\-\w]+$/),ye=P(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Mn=P(/^(?:\w+script|data):/i),Cn=P(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Re=P(/^html$/i),Nn=P(/^[a-z][.\w]*(-[.\w]+)+$/i);var Oe=Object.freeze({__proto__:null,ARIA_ATTR:wn,ATTR_WHITESPACE:Cn,CUSTOM_ELEMENT:Nn,DATA_ATTR:On,DOCTYPE_NAME:Re,ERB_EXPR:yn,IS_ALLOWED_URI:ye,IS_SCRIPT_OR_DATA:Mn,MUSTACHE_EXPR:Sn,TMPLIT_EXPR:Rn});const pt={element:1,text:3,progressingInstruction:7,comment:8,document:9},Ln=function(){return typeof window>"u"?null:window},Dn=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(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},we=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Me(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ln();const t=u=>Me(u);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:a,Node:l,Element:p,NodeFilter:h,NamedNodeMap:m=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:b,DOMParser:V,trustedTypes:W}=r,X=p.prototype,Xn=ut(X,"cloneNode"),qn=ut(X,"remove"),Kn=ut(X,"nextSibling"),Zn=ut(X,"childNodes"),xt=ut(X,"parentNode");if(typeof a=="function"){const u=e.createElement("template");u.content&&u.content.ownerDocument&&(e=u.content.ownerDocument)}let x,Et="";const{implementation:ee,createNodeIterator:Jn,createDocumentFragment:Qn,getElementsByTagName:to}=e,{importNode:eo}=n;let v=we();t.isSupported=typeof E=="function"&&typeof xt=="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:Ue,CUSTOM_ELEMENT:io}=Oe;let{IS_ALLOWED_URI:He}=Oe,y=null;const ze=d({},[...Ae,...Bt,...Yt,...Vt,..._e]);let R=null;const $e=d({},[...be,...Xt,...Se,...Ot]);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 tt=Object.seal(zt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let We=!0,re=!0,Ge=!1,je=!0,et=!1,vt=!0,Z=!1,ae=!1,ce=!1,nt=!1,It=!1,Pt=!1,Be=!0,Ye=!1;const ro="user-content-";let le=!0,_t=!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 Ve=null;const Xe=d({},["audio","video","img","source","image","track"]);let ue=null;const qe=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 bt=null;const lo=["application/xhtml+xml","text/html"],fo="text/html";let S=null,it=null;const uo=e.createElement("form"),Ke=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),bt=lo.indexOf(o.PARSER_MEDIA_TYPE)===-1?fo:o.PARSER_MEDIA_TYPE,S=bt==="application/xhtml+xml"?Gt:Rt,y=k(o,"ALLOWED_TAGS")?d({},o.ALLOWED_TAGS,S):ze,R=k(o,"ALLOWED_ATTR")?d({},o.ALLOWED_ATTR,S):$e,he=k(o,"ALLOWED_NAMESPACES")?d({},o.ALLOWED_NAMESPACES,Gt):ao,ue=k(o,"ADD_URI_SAFE_ATTR")?d(U(qe),o.ADD_URI_SAFE_ATTR,S):qe,Ve=k(o,"ADD_DATA_URI_TAGS")?d(U(Xe),o.ADD_DATA_URI_TAGS,S):Xe,z=k(o,"FORBID_CONTENTS")?d({},o.FORBID_CONTENTS,S):fe,At=k(o,"FORBID_TAGS")?d({},o.FORBID_TAGS,S):U({}),ie=k(o,"FORBID_ATTR")?d({},o.FORBID_ATTR,S):U({}),ot=k(o,"USE_PROFILES")?o.USE_PROFILES:!1,We=o.ALLOW_ARIA_ATTR!==!1,re=o.ALLOW_DATA_ATTR!==!1,Ge=o.ALLOW_UNKNOWN_PROTOCOLS||!1,je=o.ALLOW_SELF_CLOSE_IN_ATTR!==!1,et=o.SAFE_FOR_TEMPLATES||!1,vt=o.SAFE_FOR_XML!==!1,Z=o.WHOLE_DOCUMENT||!1,nt=o.RETURN_DOM||!1,It=o.RETURN_DOM_FRAGMENT||!1,Pt=o.RETURN_TRUSTED_TYPE||!1,ce=o.FORCE_BODY||!1,Be=o.SANITIZE_DOM!==!1,Ye=o.SANITIZE_NAMED_PROPS||!1,le=o.KEEP_CONTENT!==!1,_t=o.IN_PLACE||!1,He=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&&Ke(o.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(A.tagNameCheck=o.CUSTOM_ELEMENT_HANDLING.tagNameCheck),o.CUSTOM_ELEMENT_HANDLING&&Ke(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),It&&(nt=!0),ot&&(y=d({},_e),R=[],ot.html===!0&&(d(y,Ae),d(R,be)),ot.svg===!0&&(d(y,Bt),d(R,Xt),d(R,Ot)),ot.svgFilters===!0&&(d(y,Yt),d(R,Xt),d(R,Ot)),ot.mathMl===!0&&(d(y,Vt),d(R,Se),d(R,Ot))),o.ADD_TAGS&&(typeof o.ADD_TAGS=="function"?tt.tagCheck=o.ADD_TAGS:(y===ze&&(y=U(y)),d(y,o.ADD_TAGS,S))),o.ADD_ATTR&&(typeof o.ADD_ATTR=="function"?tt.attributeCheck=o.ADD_ATTR:(R===$e&&(R=U(R)),d(R,o.ADD_ATTR,S))),o.ADD_URI_SAFE_ATTR&&d(ue,o.ADD_URI_SAFE_ATTR,S),o.FORBID_CONTENTS&&(z===fe&&(z=U(z)),d(z,o.FORBID_CONTENTS,S)),o.ADD_FORBID_CONTENTS&&(z===fe&&(z=U(z)),d(z,o.ADD_FORBID_CONTENTS,S)),le&&(y["#text"]=!0),Z&&d(y,["html","head","body"]),y.table&&(d(y,["tbody"]),delete At.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.');x=o.TRUSTED_TYPES_POLICY,Et=x.createHTML("")}else x===void 0&&(x=Dn(W,s)),x!==null&&typeof Et=="string"&&(Et=x.createHTML(""));N&&N(o),it=o}},Ze=d({},[...Bt,...Yt,..._n]),Je=d({},[...Vt,...bn]),po=function(o){let c=xt(o);(!c||!c.tagName)&&(c={namespaceURI:st,tagName:"template"});const f=Rt(o.tagName),g=Rt(c.tagName);return he[o.namespaceURI]?o.namespaceURI===Ft?c.namespaceURI===G?f==="svg":c.namespaceURI===kt?f==="svg"&&(g==="annotation-xml"||Ut[g]):!!Ze[f]:o.namespaceURI===kt?c.namespaceURI===G?f==="math":c.namespaceURI===Ft?f==="math"&&Ht[g]:!!Je[f]:o.namespaceURI===G?c.namespaceURI===Ft&&!Ht[g]||c.namespaceURI===kt&&!Ut[g]?!1:!Je[f]&&(co[f]||!Ze[f]):!!(bt==="application/xhtml+xml"&&he[o.namespaceURI]):!1},$=function(o){ct(t.removed,{element:o});try{xt(o).removeChild(o)}catch{qn(o)}},J=function(o,c){try{ct(t.removed,{attribute:c.getAttributeNode(o),from:c})}catch{ct(t.removed,{attribute:null,from:c})}if(c.removeAttribute(o),o==="is")if(nt||It)try{$(c)}catch{}else try{c.setAttribute(o,"")}catch{}},Qe=function(o){let c=null,f=null;if(ce)o="<remove></remove>"+o;else{const _=jt(o,/^[\r\n\t ]+/);f=_&&_[0]}bt==="application/xhtml+xml"&&st===G&&(o='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+o+"</body></html>");const g=x?x.createHTML(o):o;if(st===G)try{c=new V().parseFromString(g,bt)}catch{}if(!c||!c.documentElement){c=ee.createDocument(st,"template",null);try{c.documentElement.innerHTML=pe?Et:g}catch{}}const M=c.body||c.documentElement;return o&&f&&M.insertBefore(e.createTextNode(f),M.childNodes[0]||null),st===G?to.call(c,Z?"html":"body")[0]:Z?c.documentElement:M},tn=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 b&&(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")},en=function(o){return typeof l=="function"&&o instanceof l};function j(u,o,c){yt(u,f=>{f.call(t,o,c,it)})}const nn=function(o){let c=null;if(j(v.beforeSanitizeElements,o,null),de(o))return $(o),!0;const f=S(o.nodeName);if(j(v.uponSanitizeElement,o,{tagName:f,allowedTags:y}),vt&&o.hasChildNodes()&&!en(o.firstElementChild)&&L(/<[/\w!]/g,o.innerHTML)&&L(/<[/\w!]/g,o.textContent)||o.nodeType===pt.progressingInstruction||vt&&o.nodeType===pt.comment&&L(/<[/\w]/g,o.data))return $(o),!0;if(!(tt.tagCheck instanceof Function&&tt.tagCheck(f))&&(!y[f]||At[f])){if(!At[f]&&sn(f)&&(A.tagNameCheck instanceof RegExp&&L(A.tagNameCheck,f)||A.tagNameCheck instanceof Function&&A.tagNameCheck(f)))return!1;if(le&&!z[f]){const g=xt(o)||o.parentNode,M=Zn(o)||o.childNodes;if(M&&g){const _=M.length;for(let I=_-1;I>=0;--I){const B=Xn(M[I],!0);B.__removalCount=(o.__removalCount||0)+1,g.insertBefore(B,Kn(o))}}}return $(o),!0}return o instanceof p&&!po(o)||(f==="noscript"||f==="noembed"||f==="noframes")&&L(/<\/no(script|embed|frames)/i,o.innerHTML)?($(o),!0):(et&&o.nodeType===pt.text&&(c=o.textContent,yt([ne,oe,se],g=>{c=lt(c,g," ")}),o.textContent!==c&&(ct(t.removed,{element:o.cloneNode()}),o.textContent=c)),j(v.afterSanitizeElements,o,null),!1)},on=function(o,c,f){if(Be&&(c==="id"||c==="name")&&(f in e||f in uo))return!1;if(!(re&&!ie[c]&&L(no,c))){if(!(We&&L(oo,c))){if(!(tt.attributeCheck instanceof Function&&tt.attributeCheck(c,o))){if(!R[c]||ie[c]){if(!(sn(o)&&(A.tagNameCheck instanceof RegExp&&L(A.tagNameCheck,o)||A.tagNameCheck instanceof Function&&A.tagNameCheck(o))&&(A.attributeNameCheck instanceof RegExp&&L(A.attributeNameCheck,c)||A.attributeNameCheck instanceof Function&&A.attributeNameCheck(c,o))||c==="is"&&A.allowCustomizedBuiltInElements&&(A.tagNameCheck instanceof RegExp&&L(A.tagNameCheck,f)||A.tagNameCheck instanceof Function&&A.tagNameCheck(f))))return!1}else if(!ue[c]){if(!L(He,lt(f,Ue,""))){if(!((c==="src"||c==="xlink:href"||c==="href")&&o!=="script"&&Tn(f,"data:")===0&&Ve[o])){if(!(Ge&&!L(so,lt(f,Ue,"")))){if(f)return!1}}}}}}}return!0},sn=function(o){return o!=="annotation-xml"&&jt(o,io)},rn=function(o){j(v.beforeSanitizeAttributes,o,null);const{attributes:c}=o;if(!c||de(o))return;const f={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0};let g=c.length;for(;g--;){const M=c[g],{name:_,namespaceURI:I,value:B}=M,rt=S(_),Te=B;let O=_==="value"?Te:gn(Te);if(f.attrName=rt,f.attrValue=O,f.keepAttr=!0,f.forceKeepAttr=void 0,j(v.uponSanitizeAttribute,o,f),O=f.attrValue,Ye&&(rt==="id"||rt==="name")&&(J(_,o),O=ro+O),vt&&L(/((--!?|])>)|<\/(style|title|textarea)/i,O)){J(_,o);continue}if(rt==="attributename"&&jt(O,"href")){J(_,o);continue}if(f.forceKeepAttr)continue;if(!f.keepAttr){J(_,o);continue}if(!je&&L(/\/>/i,O)){J(_,o);continue}et&&yt([ne,oe,se],cn=>{O=lt(O,cn," ")});const an=S(o.nodeName);if(!on(an,rt,O)){J(_,o);continue}if(x&&typeof W=="object"&&typeof W.getAttributeType=="function"&&!I)switch(W.getAttributeType(an,rt)){case"TrustedHTML":{O=x.createHTML(O);break}case"TrustedScriptURL":{O=x.createScriptURL(O);break}}if(O!==Te)try{I?o.setAttributeNS(I,_,O):o.setAttribute(_,O),de(o)?$(o):Ee(t.removed)}catch{J(_,o)}}j(v.afterSanitizeAttributes,o,null)},ho=function u(o){let c=null;const f=tn(o);for(j(v.beforeSanitizeShadowDOM,o,null);c=f.nextNode();)j(v.uponSanitizeShadowNode,c,null),nn(c),rn(c),c.content instanceof i&&u(c.content);j(v.afterSanitizeShadowDOM,o,null)};return t.sanitize=function(u){let o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=null,f=null,g=null,M=null;if(pe=!u,pe&&(u="<!-->"),typeof u!="string"&&!en(u))if(typeof u.toString=="function"){if(u=u.toString(),typeof u!="string")throw ft("dirty is not a string, aborting")}else throw ft("toString is not a function");if(!t.isSupported)return u;if(ae||me(o),t.removed=[],typeof u=="string"&&(_t=!1),_t){if(u.nodeName){const B=S(u.nodeName);if(!y[B]||At[B])throw ft("root node is forbidden and cannot be sanitized in-place")}}else if(u instanceof l)c=Qe("<!---->"),f=c.ownerDocument.importNode(u,!0),f.nodeType===pt.element&&f.nodeName==="BODY"||f.nodeName==="HTML"?c=f:c.appendChild(f);else{if(!nt&&!et&&!Z&&u.indexOf("<")===-1)return x&&Pt?x.createHTML(u):u;if(c=Qe(u),!c)return nt?null:Pt?Et:""}c&&ce&&$(c.firstChild);const _=tn(_t?u:c);for(;g=_.nextNode();)nn(g),rn(g),g.content instanceof i&&ho(g.content);if(_t)return u;if(nt){if(It)for(M=Qn.call(c.ownerDocument);c.firstChild;)M.appendChild(c.firstChild);else M=c;return(R.shadowroot||R.shadowrootmode)&&(M=eo.call(n,M,!0)),M}let I=Z?c.outerHTML:c.innerHTML;return Z&&y["!doctype"]&&c.ownerDocument&&c.ownerDocument.doctype&&c.ownerDocument.doctype.name&&L(Re,c.ownerDocument.doctype.name)&&(I="<!DOCTYPE "+c.ownerDocument.doctype.name+`>
2
+ `+I),et&&yt([ne,oe,se],B=>{I=lt(I,B," ")}),x&&Pt?x.createHTML(I):I},t.setConfig=function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};me(u),ae=!0},t.clearConfig=function(){it=null,ae=!1},t.isValidAttribute=function(u,o,c){it||me({});const f=S(u),g=S(o);return on(f,g,c)},t.addHook=function(u,o){typeof o=="function"&&ct(v[u],o)},t.removeHook=function(u,o){if(o!==void 0){const c=mn(v[u],o);return c===-1?void 0:dn(v[u],c,1)[0]}return Ee(v[u])},t.removeHooks=function(u){v[u]=[]},t.removeAllHooks=function(){v=we()},t}var Ce=Me();function Ne(r,t,e=""){const n=new WeakMap,s={get(i,a){const l=Reflect.get(i,a);if(l===null||typeof l!="object")return l;const p=n.get(l);if(p)return p;const h=e?`${e}.${a}`:a,m=Ne(l,t,h);return n.set(l,m),m},set(i,a,l){const p=Reflect.get(i,a);if(p!==l){Reflect.set(i,a,l);const h=e?`${e}.${a}`:a;t(h,p,l)}return!0}};return new Proxy(r,s)}function Le(r){const t={};for(const[e,n]of Object.entries(r)){const s=typeof n=="object"&&n!==null;t[e]=s?Le(n):n}return t}const wt=typeof window<"u"&&typeof window.document<"u";let De=class extends Error{};const Q=class Q{constructor(t,e,n){q(this,Dt);q(this,Lt,Symbol("objectId"));q(this,H,[]);q(this,Tt);q(this,gt);q(this,Y);if(!t)throw new De("name cannot be empty");if(w(Q,K).has(t))throw new De(`WrecState with name "${t}" already exists`);if(at(this,Tt,t),at(this,gt,e),at(this,Y,Ne({},fn(this,Dt,un).bind(this))),e&&wt){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);w(Q,K).set(t,this)}static get(t){return w(this,K).get(t)}addListener(t,e={}){const n=w(this,H).find(s=>s.listenerRef.deref()===t);if(n){const{propertyMap:s}=n;for(const[i,a]of Object.entries(e))s[i]=a}else w(this,H).push({listenerRef:new WeakRef(t),propertyMap:e})}addProperty(t,e){Object.defineProperty(this,t,{enumerable:!0,get(){return w(this,Y)[t]},set(n){w(this,Y)[t]=n}}),w(this,Y)[t]=e}get id(){return w(this,Lt)}log(){console.log("WrecState:",w(this,Tt));for(const[t,e]of Object.entries(w(this,Y)))console.log(` ${t} = ${JSON.stringify(e)}`)}removeListener(t){at(this,H,w(this,H).filter(e=>e.listenerRef.deref()!==t))}};K=new WeakMap,Lt=new WeakMap,H=new WeakMap,Tt=new WeakMap,gt=new WeakMap,Y=new WeakMap,Dt=new WeakSet,un=function(t,e,n){const s=new Set;for(const i of w(this,H)){const a=i.listenerRef.deref();if(!a)s.add(i);else if(wt&&a instanceof HTMLElement&&!a.isConnected)s.add(i);else{const{propertyMap:l}=i,p=Object.keys(l);(p.length===0||p.includes(t))&&a.changed(t,l[t],n,e,this)}}at(this,H,w(this,H).filter(i=>!s.has(i)))},q(Q,K,new Map),wt&&window.addEventListener("beforeunload",()=>{for(const[t,e]of w(Q,K).entries())if(w(e,gt)){const n=Le(e);sessionStorage.setItem("wrec-state-"+t,JSON.stringify(n))}});let Mt=Q;wt&&process.env.NODE_ENV==="development"&&(window.WrecState=Mt);function xe(r,t){let e=r;for(const n of t.split("."))e=e[n];return e}function xn(r,t,e){const n=t.split("."),s=n.length-1;let i=r;n.forEach((a,l)=>{l===s?i[a]=e:i=i[a]})}const vn=new Set(["class","disabled","hidden","id","tabindex","title"]),In=new Set(["onblur","onchange","onclick","onfocus","oninput","onkeydown","onreset","onsubmit"]);Ce.addHook("uponSanitizeAttribute",(r,t)=>{const{attrName:e}=t,n=e.toLowerCase();In.has(n)&&(t.forceKeepAttr=!0)});class Ct extends Error{}const Pn=/([a-zA-Z-]+)\s*:\s*([^;}]+)/g,ve="a-zA-Z_$",kn=ve+"0-9",ht=`[${ve}][${kn}]*`,Fn=/<!--\s*(.*?)\s*-->/,Un=/<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g,qt=new RegExp(`^this\\.${ht}$`),Kt=new RegExp(`this\\.${ht}(\\.${ht})*`,"g"),Ie=new RegExp(`this\\.${ht}(\\.${ht})*`),Hn=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 Nt(r){const t=[];let e=r.firstElementChild;for(;e;)t.push(e),e.shadowRoot&&t.push(...Nt(e.shadowRoot)),e.firstElementChild&&t.push(...Nt(e)),e=e.nextElementSibling;return t}const mt=r=>r.substring(Hn).split(".")[0];function Pe(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 ke(r,t,e,n){return r.slice(0,t)+n+r.slice(t+e)}function jn(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=Ce.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 Ct(`can't convert "${r}" to a number`);return t}function Fe(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),a=String(e);i!==a&&(r.setAttribute(n,a),n==="value"&&Jt(r)&&(r.value=a))}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):(Fe(r,n,e),n==="value"&&Jt(r)&&(r.value=e))}async function Bn(r){const t=new Set;for(const n of Nt(r.content)){const{localName:s}=n;s.includes("-")&&t.add(s)}function e(n){return new Promise((s,i)=>{setTimeout(()=>{const a=`custom element <${n}> not defined`;i(new Error(a))},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 context={};static css="";static elementName="";static formAssociated=!1;static html="";static properties;static propToComputedMap;static propToExprsMap;static template=null;#c=!1;#t=this.constructor;#o=new Map;#l={};#s;#f={};#u=null;#p=new Map;static define(t){if(this.elementName=t,customElements.get(t))throw new Ct(`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.#d();const s=F.getPropName(t);if(this.#i(s)){const i=this.#S(s,String(n));this[s]=i;const a=this.#l[s];a&&this.setFormValue(a,String(i)),this.propertyChangedCallback(s,e,n)}}batchSet(t){this.#c=!0;const e=this.#t.propToExprsMap,n=new Set;for(const[l,p]of Object.entries(t)){this[l]=p;const h=e.get(l)??[];for(const m of h)n.add(m)}const s=this.#t.propToComputedMap,i=new Set,a={};for(const l of Object.keys(t)){const p=s.get(l)||[];for(const[h,m]of p)i.add(h),a[h]=m}for(const l of i){const p=a[l];this[l]=this.#n(p);const h=e.get(l)??[];for(const m of h)n.add(m)}for(;;){let l=!1;for(const p of i){const h=a[p],m=this.#n(h),b=this[p];JSON.stringify(m)!==JSON.stringify(b)&&(this[p]=m,l=!0)}if(!l)break}this.#T([...n]),this.#c=!1}async#O(){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||this.#e(this,void 0,"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.#M(),this.#O().then(()=>{this.hasAttribute("disabled")&&this.#d(),this.#R(this.shadowRoot),this.#g(this.shadowRoot),this.#w()})}#w(){const t=this.#t,{properties:e}=t;for(const[n,{computed:s}]of Object.entries(e))s&&(this[n]=this.#n(s))}#M(){const t=this.#t,{observedAttributes:e,properties:n}=t;for(const[s,i]of Object.entries(n))i.computed||this.#m(s,i,e);for(const[s,i]of Object.entries(n))i.computed&&this.#m(s,i,e)}#m(t,e,n){if(t==="class"||t==="style")throw new Ct(`"${t}" is a reserved property`);const s=F.getAttrName(t),i=this.hasAttribute(s);e.required&&!i&&this.#e(this,s,"is a required attribute");let a=e.value;this.hasOwnProperty(t)&&(a=this[t],delete this[t]);const{type:f}=e,p=f===Boolean?a||i:n.includes(s)&&i?this.#b(t,s):a||Wn(f),h="#"+t;this[h]=p,e.computed&&this.#D(t,e),Object.defineProperty(this,t,{enumerable:!0,get(){return this[h]},set(m){f===Number&&typeof m=="string"&&(m=Qt(m));const y=this[h];if(m===y)return;this.#F(t,f,m),this[h]=m;const{state:V,stateProp:W}=this.#t.properties[t];W&&xn(V,W,m),this.#x(t,f,m,s),this.#c||(this.#v(t),this.#_(t)),this.#I(t,m);const X=this.#l[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})}})}#d(){const t=this.hasAttribute("disabled"),e=Nt(this.shadowRoot);for(const n of e)zn(n)&&(n.disabled=t)}disconnectedCallback(){this.#o.clear(),this.#f.clear(),this.#p.clear()}dispatch(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}displayIfSet(t,e="block"){return`display: ${t?e:"none"}`}#C(t){const e=t instanceof F;for(const n of t.getAttributeNames()){const s=t.getAttribute(n),i=this.#A(t,s);if(i){const a=this[i];a===void 0&&this.#a(t,n,i),t[i]=a;let[f,p]=n.split(":");f==="value"&&(p?(t["on"+p]===void 0&&this.#e(t,n,"refers to an unsupported event name"),t.setAttribute(f,this[i])):p="change"),e&&t.#p.set(F.getPropName(f),i)}this.#r(s,t,n)}}#T(t){for(const e of t){const n=this.#n(e),s=this.#o.get(e)??[];for(const i of s)if(i instanceof HTMLElement)this.#y(i,n);else if(!(i instanceof CSSStyleRule)){const{element:a,attrName:f}=i;a instanceof CSSStyleRule?a.style.setProperty(f,n):te(a,f,n)}}}#n(t){return new Function("return "+t).call(this)}#N(t){const{localName:e}=t;if(e==="style"){const{sheet:n}=t,s=n?.cssRules??[],i=Array.from(s);for(const a of i)if(a.constructor===CSSStyleRule){const f=Array.from(a.style);for(const p of f)if(p.startsWith("--")){const h=a.style.getPropertyValue(p);this.#r(h,a,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.#A(t,n);s&&dt(t)?t.textContent=this[s]:this.#r(n,t)}}}formAssociatedCallback(){let t=this.getAttribute("form-assoc");if(!t){const a=this.getAttribute("name");if(a)if(this.#i("value"))t=`value:${a}`;else return;else return}const e={},n=t.split(",");for(const a of n){const[f,p]=a.split(":");e[f.trim()]=p.trim()}this.#l=e,this.#s=new FormData,this.#u=this.attachInternals(),this.#u.setFormValue(this.#s);const s=Object.keys(this.#t.properties),i=this.#f;for(const a of s)i[a]=this[a]}formResetCallback(){const t=this.#f;for(const e of Object.keys(t)){let n=t[e];qt.test(n)&&(n=this.#n(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}#L(t,e,n){if(n.length!==1)return;const[s]=n;if(!qt.test(s))return;const i=Jt(t)||dt(t);let[a,f]=(e??"").split(":");if(!(i&&a==="value"||dt(t)))return;f?t["on"+f]===void 0&&this.#e(t,e,"refers to an unsupported event name"):f="change";const h=mt(s);t.addEventListener(f,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.#_(h)})}#i(t){return!!this.#t.properties[t]}#g(t){const e=Array.from(t.querySelectorAll("*"));for(const n of e)this.#C(n),n.firstElementChild||this.#N(n)}#E(){if(this.#t.formAssociated||this.closest("form")===null)return;const t=this.#t.name;this.#e(this,void 0,`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){}#A(t,e){if(!e||!qt.test(e))return;const n=mt(e);return this[n]===void 0&&this.#a(t,"",n),n}#_(t){const e=this.#t.propToExprsMap.get(t)||[];this.#T(e)}#D(t,e){const{computed:n,uses:s}=e,i=this.#t.propToComputedMap;function a(p,h){let m=i.get(p);m||(m=[],i.set(p,m)),m.push([t,h])}const f=n.match(Kt)||[];for(const p of f){const h=mt(p);this[h]===void 0&&this.#a(null,t,h),typeof this[h]!="function"&&a(h,n)}if(s)for(const p of s.split(","))a(p,n)}#r(t,e,n=void 0){if(!t)return;const s=this.#h(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=mt(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.#o.entries())for(const m of h){const y=m instanceof HTMLElement||m instanceof CSSStyleRule?m:m.element;y instanceof CSSStyleRule||y.isConnected||this.#o.set(p,h.filter(V=>V!==m))}let a=this.#o.get(t);a||(a=[],this.#o.set(t,a)),a.push(n?{element:e,attrName:n}:e),e instanceof HTMLElement&&this.#L(e,n,s);const f=this.#n(t);n?te(e,n,f):this.#y(e,f)}setAttributeSafe(t,e){this.hasAttribute(t)||this.setAttribute(t,e)}setFormValue(t,e){!this.#s||!Zt(e)||(this.#s.set(t,e),this.#u?.setFormValue(this.#s))}#e(t,e,n){const s=t instanceof HTMLElement?t.localName:"CSS rule";throw new Ct(`component ${this.#t.elementName}`+(t?`, element "${s}"`:"")+(e?`, attribute "${e}"`:"")+` ${n}`)}#a(t,e,n){this.#e(t,e,`refers to missing property "${n}"`)}#b(t,e){return this.#S(t,this.getAttribute(e))}#S(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)}#x(t,e,n,s){if(Zt(n)){const i=e===Boolean?this.hasAttribute(s):this.#b(t,s);n!==i&&Fe(this,s||t,n)}}#v(t){const n=this.#t.propToComputedMap.get(t)||[];for(const[s,i]of n)this[s]=this.#n(i)}#y(t,e){if(e===void 0)return;const n=t instanceof HTMLElement;Array.isArray(e)&&(e=e.join(""));const s=typeof e;s!=="string"&&s!=="number"&&this.#e(t,void 0," computed content is not a string or number");const i=String(e);if(t instanceof HTMLElement&&dt(t))t.value=i;else if(n&&s==="string"&&i.trim().startsWith("<")){const a=Bn(i);t.replaceChildren(...a),this.#R(t),this.#g(t)}else n&&(t.textContent=i)}#I(t,e){const n=this.#p.get(t);if(!n)return;const s=this.getRootNode();if(!(s instanceof ShadowRoot))return;const{host:i}=s;if(!i)return;const a=i;a[n]=e}useState(t,e){if(!e){e={};for(const n of Object.keys(t))e[n]=n}this.#k(t,e);for(const[n,s]of Object.entries(e))if(this.#i(s)){const i=xe(t,n);i!==void 0&&(this[s]=i);const a=this.#t.properties[s];a.state=t,a.stateProp=n}t.addListener(this,e)}#P(){const t=new Set(Object.keys(this.#t.properties));for(const e of this.getAttributeNames())if(!vn.has(e)&&!e.startsWith("on")){if(e==="form-assoc"){this.#E();continue}if(!t.has(F.getPropName(e))){if(e==="name"){this.#E();continue}this.#e(null,e,"is not a supported attribute")}}}#h(t,e,n){const s=n.match(Kt);if(s)return s.forEach(i=>{const a=mt(i);this[a]===void 0&&this.#a(t,e,a)}),s}#k(t,e){for(const[n,s]of Object.entries(e)){let i=xe(t,n);i===void 0&&this.#e(this,void 0,`invalid state path "${n}"`),i=this[s],this.#i(s)||this.#e(null,s,"refers to missing property in useState map")}}#F(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}`)}#R(t){const e=Array.from(t.querySelectorAll("*"));for(const n of e){const s=[];for(const i of Array.from(n.attributes)){const a=i.name;if(a.startsWith("on")){let f=a.slice(2);f=f[0].toLowerCase()+f.slice(1).toLowerCase();const p=i.value;this.#h(n,a,p);let h;typeof this[p]=="function"?h=m=>this[p](m):(this.#h(n,a,p),h=()=>this.#n(p)),n.addEventListener(f,h),s.push(a)}}for(const i of s)n.removeAttribute(i)}}}function Yn(r,...t){let e=Pe(r,t);for(;;){const n=Pn.exec(e);if(!n)break;const s=n[2];if(Ie.test(s)){const i=n[1];if(!i.startsWith("--")){const a=`--${i}: ${s};
4
+ `;let s=t.html.trim();s||this.#e(this,void 0,"static property html must be set"),s.startsWith("<")||(s=`<span><!--${s}--></span>`),e.innerHTML=n+s}await Bn(e),this.shadowRoot.replaceChildren(e.content.cloneNode(!0))}changed(t,e,n){this[e]=n}connectedCallback(){this.#P(),this.#M(),this.#O().then(()=>{this.hasAttribute("disabled")&&this.#d(),this.#R(this.shadowRoot),this.#g(this.shadowRoot),this.#w()})}#w(){const t=this.#t,{properties:e}=t;for(const[n,{computed:s}]of Object.entries(e))s&&(this[n]=this.#n(s))}#M(){const t=this.#t,{observedAttributes:e,properties:n}=t;for(const[s,i]of Object.entries(n))i.computed||this.#m(s,i,e);for(const[s,i]of Object.entries(n))i.computed&&this.#m(s,i,e)}#m(t,e,n){if(t==="class"||t==="style")throw new Ct(`"${t}" is a reserved property`);const s=F.getAttrName(t),i=this.hasAttribute(s);e.required&&!i&&this.#e(this,s,"is a required attribute");let a=e.value;this.hasOwnProperty(t)&&(a=this[t],delete this[t]);const{type:l}=e,p=l===Boolean?a||i:n.includes(s)&&i?this.#b(t,s):a||Wn(l),h="#"+t;this[h]=p,e.computed&&this.#D(t,e),Object.defineProperty(this,t,{enumerable:!0,get(){return this[h]},set(m){l===Number&&typeof m=="string"&&(m=Qt(m));const b=this[h];if(m===b)return;this.#F(t,l,m),this[h]=m;const{state:V,stateProp:W}=this.#t.properties[t];W&&xn(V,W,m),this.#x(t,l,m,s),this.#c||(this.#v(t),this.#_(t)),this.#I(t,m);const X=this.#l[t];X&&this.setFormValue(X,String(m)),this.propertyChangedCallback(t,b,m),e.dispatch&&this.dispatch("change",{tagName:this.localName,property:t,oldValue:b,value:m})}})}#d(){const t=this.hasAttribute("disabled"),e=Nt(this.shadowRoot);for(const n of e)zn(n)&&(n.disabled=t)}disconnectedCallback(){this.#o.clear(),this.#f.clear(),this.#p.clear()}dispatch(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}displayIfSet(t,e="block"){return`display: ${t?e:"none"}`}#C(t){const e=t instanceof F;for(const n of t.getAttributeNames()){const s=t.getAttribute(n),i=this.#A(t,s);if(i){const a=this[i];a===void 0&&this.#a(t,n,i),t[i]=a;let[l,p]=n.split(":");l==="value"&&(p?(t["on"+p]===void 0&&this.#e(t,n,"refers to an unsupported event name"),t.setAttribute(l,this[i])):p="change"),e&&t.#p.set(F.getPropName(l),i)}this.#r(s,t,n)}}#T(t){for(const e of t){const n=this.#n(e),s=this.#o.get(e)??[];for(const i of s)if(i instanceof HTMLElement)this.#y(i,n);else if(!(i instanceof CSSStyleRule)){const{element:a,attrName:l}=i;a instanceof CSSStyleRule?a.style.setProperty(l,n):te(a,l,n)}}}#n(t){const{context:e}=this.#t;return new Function("context",`const {${Object.keys(e).join(",")}} = context; return ${t};`).call(this,e)}#N(t){const{localName:e}=t;if(e==="style"){const{sheet:n}=t,s=n?.cssRules??[],i=Array.from(s);for(const a of i)if(a.constructor===CSSStyleRule){const l=Array.from(a.style);for(const p of l)if(p.startsWith("--")){const h=a.style.getPropertyValue(p);this.#r(h,a,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.#A(t,n);s&&dt(t)?t.textContent=this[s]:this.#r(n,t)}}}formAssociatedCallback(){let t=this.getAttribute("form-assoc");if(!t){const a=this.getAttribute("name");if(a)if(this.#i("value"))t=`value:${a}`;else return;else return}const e={},n=t.split(",");for(const a of n){const[l,p]=a.split(":");e[l.trim()]=p.trim()}this.#l=e,this.#s=new FormData,this.#u=this.attachInternals(),this.#u.setFormValue(this.#s);const s=Object.keys(this.#t.properties),i=this.#f;for(const a of s)i[a]=this[a]}formResetCallback(){const t=this.#f;for(const e of Object.keys(t)){let n=t[e];qt.test(n)&&(n=this.#n(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}#L(t,e,n){if(n.length!==1)return;const[s]=n;if(!qt.test(s))return;const i=Jt(t)||dt(t);let[a,l]=(e??"").split(":");if(!(i&&a==="value"||dt(t)))return;l?t["on"+l]===void 0&&this.#e(t,e,"refers to an unsupported event name"):l="change";const h=mt(s);t.addEventListener(l,m=>{const{target:b}=m;if(!b)return;const V=b.value,{type:W}=this.#t.properties[h];this[h]=W===Number?Qt(V):V,this.#_(h)})}#i(t){return!!this.#t.properties[t]}#g(t){const e=Array.from(t.querySelectorAll("*"));for(const n of e)this.#C(n),n.firstElementChild||this.#N(n)}#E(){if(this.#t.formAssociated||this.closest("form")===null)return;const t=this.#t.name;this.#e(this,void 0,`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){}#A(t,e){if(!e||!qt.test(e))return;const n=mt(e);return this[n]===void 0&&this.#a(t,"",n),n}#_(t){const e=this.#t.propToExprsMap.get(t)||[];this.#T(e)}#D(t,e){const{computed:n,uses:s}=e,i=this.#t.propToComputedMap;function a(p,h){let m=i.get(p);m||(m=[],i.set(p,m)),m.push([t,h])}const l=n.match(Kt)||[];for(const p of l){const h=mt(p);this[h]===void 0&&this.#a(null,t,h),typeof this[h]!="function"&&a(h,n)}if(s)for(const p of s.split(","))a(p.trim(),n)}#r(t,e,n=void 0){if(!t)return;const s=this.#h(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=mt(p);if(typeof this[h]=="function")return;const m=i.propToExprsMap;let b=m.get(h);b||(b=[],m.set(h,b)),b.includes(t)||b.push(t)});for(const[p,h]of this.#o.entries())for(const m of h){const b=m instanceof HTMLElement||m instanceof CSSStyleRule?m:m.element;b instanceof CSSStyleRule||b.isConnected||this.#o.set(p,h.filter(V=>V!==m))}let a=this.#o.get(t);a||(a=[],this.#o.set(t,a)),a.push(n?{element:e,attrName:n}:e),e instanceof HTMLElement&&this.#L(e,n,s);const l=this.#n(t);n?te(e,n,l):this.#y(e,l)}setAttributeSafe(t,e){this.hasAttribute(t)||this.setAttribute(t,e)}setFormValue(t,e){!this.#s||!Zt(e)||(this.#s.set(t,e),this.#u?.setFormValue(this.#s))}#e(t,e,n){const s=t instanceof HTMLElement?t.localName:"CSS rule";throw new Ct(`component ${this.#t.elementName}`+(t?`, element "${s}"`:"")+(e?`, attribute "${e}"`:"")+` ${n}`)}#a(t,e,n){this.#e(t,e,`refers to missing property "${n}"`)}#b(t,e){return this.#S(t,this.getAttribute(e))}#S(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)}#x(t,e,n,s){if(Zt(n)){const i=e===Boolean?this.hasAttribute(s):this.#b(t,s);n!==i&&Fe(this,s||t,n)}}#v(t){const n=this.#t.propToComputedMap.get(t)||[];for(const[s,i]of n)this[s]=this.#n(i)}#y(t,e){if(e===void 0)return;const n=t instanceof HTMLElement;Array.isArray(e)&&(e=e.join(""));const s=typeof e;s!=="string"&&s!=="number"&&this.#e(t,void 0," computed content is not a string or number");const i=String(e);if(t instanceof HTMLElement&&dt(t))t.value=i;else if(n&&s==="string"&&i.trim().startsWith("<")){const a=jn(i);t.replaceChildren(...a),this.#R(t),this.#g(t)}else n&&(t.textContent=i)}#I(t,e){const n=this.#p.get(t);if(!n)return;const s=this.getRootNode();if(!(s instanceof ShadowRoot))return;const{host:i}=s;if(!i)return;const a=i;a[n]=e}useState(t,e){if(!e){e={};for(const n of Object.keys(t))e[n]=n}this.#k(t,e);for(const[n,s]of Object.entries(e))if(this.#i(s)){const i=xe(t,n);i!==void 0&&(this[s]=i);const a=this.#t.properties[s];a.state=t,a.stateProp=n}t.addListener(this,e)}#P(){const t=new Set(Object.keys(this.#t.properties));for(const e of this.getAttributeNames())if(!vn.has(e)&&!e.startsWith("on")){if(e==="form-assoc"){this.#E();continue}if(!t.has(F.getPropName(e))){if(e==="name"){this.#E();continue}this.#e(null,e,"is not a supported attribute")}}}#h(t,e,n){const s=n.match(Kt);if(s)return s.forEach(i=>{const a=mt(i);this[a]===void 0&&this.#a(t,e,a)}),s}#k(t,e){for(const[n,s]of Object.entries(e)){let i=xe(t,n);i===void 0&&this.#e(this,void 0,`invalid state path "${n}"`),i=this[s],this.#i(s)||this.#e(null,s,"refers to missing property in useState map")}}#F(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}`)}#R(t){const e=Array.from(t.querySelectorAll("*"));for(const n of e){const s=[];for(const i of Array.from(n.attributes)){const a=i.name;if(a.startsWith("on")){let l=a.slice(2);l=l[0].toLowerCase()+l.slice(1).toLowerCase();const p=i.value;this.#h(n,a,p);let h;typeof this[p]=="function"?h=m=>this[p](m):(this.#h(n,a,p),h=()=>this.#n(p)),n.addEventListener(l,h),s.push(a)}}for(const i of s)n.removeAttribute(i)}}}function Yn(r,...t){let e=Pe(r,t);for(;;){const n=Pn.exec(e);if(!n)break;const s=n[2];if(Ie.test(s)){const i=n[1];if(!i.startsWith("--")){const a=`--${i}: ${s};
5
5
  ${i}: var(--${i})`;e=ke(e,n.index,n[0].length,a)}}}return e}function Vn(r,...t){let e=Pe(r,t);for(;;){const n=Un.exec(e);if(!n||n[1]==="style")break;const s=Gn(n[2]);if(Ie.test(s)){const i=`<!-- ${s.trim()} -->`,a=n.index+n[0].indexOf(">")+1;e=ke(e,a,s.length,i)}}return e}T.Wrec=F,T.WrecState=Mt,T.createElement=$n,T.css=Yn,T.html=Vn,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "wrec",
3
3
  "description": "a small library that greatly simplifies building web components",
4
4
  "author": "R. Mark Volkmann",
5
- "version": "0.20.12",
5
+ "version": "0.20.14",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -34,20 +34,20 @@
34
34
  "clean": "rm -rf dist",
35
35
  "preview": "vite preview",
36
36
  "lint": "oxlint",
37
- "reinstall": "rm -rf node_modules package-lock.json && npm install",
38
37
  "test": "playwright test",
39
38
  "testui": "playwright test --ui",
40
39
  "unittest": "vitest"
41
40
  },
42
41
  "devDependencies": {
43
- "@playwright/test": "^1.57.0",
44
- "@types/node": "^25.0.6",
45
- "oxlint": "^1.38.0",
42
+ "@playwright/test": "^1.58.2",
43
+ "@types/node": "^25.3.3",
44
+ "oxlint": "^1.51.0",
46
45
  "typescript": "^5.9.3",
47
46
  "vite": "^7.3.1",
48
47
  "vite-plugin-dts": "^4.5.4"
49
48
  },
50
49
  "dependencies": {
51
- "dompurify": "^3.3.1"
50
+ "dompurify": "^3.3.2",
51
+ "linkedom": "^0.18.12"
52
52
  }
53
53
  }