@ntix/components-scorad 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,10 +15,10 @@ var cache = /* @__PURE__ */ new Map(), asCachedStyle = (t) => t == null ? [] : (
15
15
  return { list: (t, n, r) => {
16
16
  if (t.dataset[e]) return;
17
17
  t.dataset[e] = "true";
18
- let i = (e, n) => e.find((e) => e instanceof HTMLElement && t.contains(e) && n(e)), a = (e, n, r = () => !0) => !(e instanceof Node) || !t.contains(e) ? null : e == null || e instanceof HTMLElement && r(e) ? e : a(n(e), n, r), o = (e) => a(e?.nextSibling, (e) => e?.nextSibling), s = (e, t) => (n) => n instanceof HTMLElement && (e ?? ((e) => e.classList.contains(t)))(n), c = () => Array.from(t.children).filter(u).reduce((e, t) => e.set(t, t.getBoundingClientRect()), /* @__PURE__ */ new Map()), l = s(r?.gripSelector, "drag-grip"), u = s(r?.itemSelector, "drag-item"), d, f, p, m = 0, h, g, ze = (e) => {
18
+ let i = (e, n) => e.find((e) => e instanceof HTMLElement && t.contains(e) && n(e)), a = (e, n, r = () => !0) => !(e instanceof Node) || !t.contains(e) ? null : e == null || e instanceof HTMLElement && r(e) ? e : a(n(e), n, r), o = (e) => a(e?.nextSibling, (e) => e?.nextSibling), s = (e, t) => (n) => n instanceof HTMLElement && (e ?? ((e) => e.classList.contains(t)))(n), c = () => Array.from(t.children).filter(u).reduce((e, t) => e.set(t, t.getBoundingClientRect()), /* @__PURE__ */ new Map()), l = s(r?.gripSelector, "drag-grip"), u = s(r?.itemSelector, "drag-item"), d, f, p, m = 0, h, g, _ = (e) => {
19
19
  let n = e.composedPath();
20
- d = i(n, l), d && (e.preventDefault(), e.stopPropagation(), window.getSelection()?.removeAllRanges(), f = c(), p = i(n, u), m = e.clientY, h = p.dataset.id, p.classList.add("dragging"), p.style.pointerEvents = "none", p.style.zIndex = "2", t.style.touchAction = "none", t.style.userSelect = "none", document.addEventListener("pointermove", _), document.addEventListener("pointerup", v));
21
- }, _ = (e) => {
20
+ d = i(n, l), d && (e.preventDefault(), e.stopPropagation(), window.getSelection()?.removeAllRanges(), f = c(), p = i(n, u), m = e.clientY, h = p.dataset.id, p.classList.add("dragging"), p.style.pointerEvents = "none", p.style.zIndex = "2", t.style.touchAction = "none", t.style.userSelect = "none", document.addEventListener("pointermove", ze), document.addEventListener("pointerup", v));
21
+ }, ze = (e) => {
22
22
  if (!p || !f) throw Error("drag item is undefined");
23
23
  let n = f.get(p), r = null;
24
24
  for (let [t, i] of f.entries()) {
@@ -36,7 +36,7 @@ var cache = /* @__PURE__ */ new Map(), asCachedStyle = (t) => t == null ? [] : (
36
36
  p.style.transform = `translateY(${e.clientY - m}px)`;
37
37
  }, v = (e) => {
38
38
  if (!p) throw Error("drag item is undefined");
39
- e.stopPropagation(), document.removeEventListener("pointermove", _), document.removeEventListener("pointerup", v), p.classList.remove("dragging"), p.style.transform = "", p.style.pointerEvents = "", p.style.zIndex = "", p = void 0, t.style.touchAction = "", t.style.userSelect = "", h && g && (n(h, g), h = void 0, g = void 0);
39
+ e.stopPropagation(), document.removeEventListener("pointermove", ze), document.removeEventListener("pointerup", v), p.classList.remove("dragging"), p.style.transform = "", p.style.pointerEvents = "", p.style.zIndex = "", p = void 0, t.style.touchAction = "", t.style.userSelect = "", h && g && (n(h, g), h = void 0, g = void 0);
40
40
  }, y = (e) => {
41
41
  if (!e.altKey) return;
42
42
  let r = (e, r) => {
@@ -62,8 +62,8 @@ var cache = /* @__PURE__ */ new Map(), asCachedStyle = (t) => t == null ? [] : (
62
62
  }
63
63
  }
64
64
  };
65
- return t.addEventListener("pointerdown", ze), t.addEventListener("keydown", y), () => {
66
- t.removeEventListener("pointerdown", ze), t.removeEventListener("keydown", y);
65
+ return t.addEventListener("pointerdown", _), t.addEventListener("keydown", y), () => {
66
+ t.removeEventListener("pointerdown", _), t.removeEventListener("keydown", y);
67
67
  };
68
68
  } };
69
69
  })();
@@ -112,7 +112,34 @@ var provideLogger = (() => {
112
112
  if (e) return e;
113
113
  n = Object.getPrototypeOf(n);
114
114
  }
115
- }, objectKeys = (e) => Object.keys(e);
115
+ };
116
+ function splitPath(e) {
117
+ return e.split(/\.|\[|\]\.?/).filter((e) => e !== "").map((e) => {
118
+ let t = Number.parseInt(e);
119
+ return isNaN(t) ? e : t;
120
+ });
121
+ }
122
+ function getValue(e, t) {
123
+ let n = splitPath(t);
124
+ for (let t = 0; t < n.length; t++) {
125
+ if (e == null) return;
126
+ let r = n[t];
127
+ e = e[r];
128
+ }
129
+ return e;
130
+ }
131
+ var objectKeys = (e) => Object.keys(e);
132
+ function setValue(e, t, n) {
133
+ let r = t.match(/[^.\[\]]+/g);
134
+ if (!r) return n;
135
+ let i = { ...e }, a = i;
136
+ for (let e = 0; e < r.length - 1; e++) {
137
+ let t = r[e], n = r[e + 1], i = !isNaN(Number(n));
138
+ t in a ? Array.isArray(a[t]) ? a[t] = [...a[t]] : a[t] = { ...a[t] } : a[t] = i ? [] : {}, a = a[t];
139
+ }
140
+ let o = r[r.length - 1];
141
+ return a[o] = n, i;
142
+ }
116
143
  function isPromise(e) {
117
144
  return e != null && typeof e.then == "function";
118
145
  }
@@ -127,6 +154,7 @@ var Success = class {
127
154
  orNull() {
128
155
  return this.value;
129
156
  }
157
+ errors = [];
130
158
  }, Failure = class e {
131
159
  constructor(e) {
132
160
  this.errors = e;
@@ -257,22 +285,22 @@ function Component(e = { tag: void 0 }) {
257
285
  r?.read && (this[r.propertyName] = r.read(n));
258
286
  }
259
287
  };
260
- let d = o.prototype.connectedCallback ?? n;
288
+ let u = o.prototype.connectedCallback ?? n;
261
289
  o.prototype.connectedCallback = function() {
262
290
  a.forEach((e) => e()), (i.shadowRoot === "open" || i.shadowRoot === "closed") && !this.__shadowRoot && (this.__shadowRoot = this.attachShadow({
263
291
  delegatesFocus: i.delegatesFocus,
264
292
  mode: i.shadowRoot,
265
293
  slotAssignment: "named"
266
- }), this.__shadowRoot.adoptedStyleSheets = i.css), d.call(this), s && s.observe(this);
294
+ }), this.__shadowRoot.adoptedStyleSheets = i.css), u.call(this), s && s.observe(this);
267
295
  };
268
- let f = o.prototype.disconnectedCallback ?? n;
296
+ let d = o.prototype.disconnectedCallback ?? n;
269
297
  o.prototype.disconnectedCallback = function() {
270
- f.call(this), s && s.unobserve(this);
298
+ d.call(this), s && s.unobserve(this);
271
299
  };
272
- let p = o.prototype.beforeRender ?? n, m = o.prototype.render ?? n, h = o.prototype.afterRender ?? n;
300
+ let f = o.prototype.beforeRender ?? n, m = o.prototype.render ?? n, h = o.prototype.afterRender ?? n;
273
301
  return o.prototype.render = async function() {
274
302
  r.debug("render", this.tagName);
275
- let e = p.call(this);
303
+ let e = f.call(this);
276
304
  if (isPromise(e) && await e, this.__shadowRoot) {
277
305
  let e = this.__shadowRoot, t = m.call(this);
278
306
  isComponentRender(t) ? await t.render(e) : e.innerHTML = t;
@@ -526,25 +554,25 @@ var html$1 = freeze(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.a
526
554
  function createDOMPurify() {
527
555
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal(), t = (e) => createDOMPurify(e);
528
556
  if (t.version = "3.3.0", t.removed = [], !e || !e.document || e.document.nodeType !== NODE_TYPE.document || !e.Element) return t.isSupported = !1, t;
529
- let { document: n } = e, r = n, i = r.currentScript, { DocumentFragment: a, HTMLTemplateElement: o, Node: s, Element: c, NodeFilter: l, NamedNodeMap: u = e.NamedNodeMap || e.MozNamedAttrMap, HTMLFormElement: d, DOMParser: f, trustedTypes: p } = e, m = c.prototype, h = lookupGetter(m, "cloneNode"), g = lookupGetter(m, "remove"), ze = lookupGetter(m, "nextSibling"), _ = lookupGetter(m, "childNodes"), v = lookupGetter(m, "parentNode");
557
+ let { document: n } = e, r = n, i = r.currentScript, { DocumentFragment: a, HTMLTemplateElement: o, Node: s, Element: c, NodeFilter: l, NamedNodeMap: u = e.NamedNodeMap || e.MozNamedAttrMap, HTMLFormElement: d, DOMParser: f, trustedTypes: p } = e, m = c.prototype, h = lookupGetter(m, "cloneNode"), g = lookupGetter(m, "remove"), _ = lookupGetter(m, "nextSibling"), ze = lookupGetter(m, "childNodes"), v = lookupGetter(m, "parentNode");
530
558
  if (typeof o == "function") {
531
559
  let e = n.createElement("template");
532
560
  e.content && e.content.ownerDocument && (n = e.content.ownerDocument);
533
561
  }
534
- let y, b = "", { implementation: Be, createNodeIterator: Ve, createDocumentFragment: He, getElementsByTagName: Ue } = n, { importNode: We } = r, x = _createHooksMap();
535
- t.isSupported = typeof entries == "function" && typeof v == "function" && Be && Be.createHTMLDocument !== void 0;
536
- let { MUSTACHE_EXPR: S, ERB_EXPR: Ge, TMPLIT_EXPR: Ke, DATA_ATTR: qe, ARIA_ATTR: Je, IS_SCRIPT_OR_DATA: Ye, ATTR_WHITESPACE: Xe, CUSTOM_ELEMENT: Ze } = EXPRESSIONS, { IS_ALLOWED_URI: Qe } = EXPRESSIONS, C = null, $e = addToSet({}, [
562
+ let y, b = "", { implementation: x, createNodeIterator: Be, createDocumentFragment: Ve, getElementsByTagName: He } = n, { importNode: Ue } = r, S = _createHooksMap();
563
+ t.isSupported = typeof entries == "function" && typeof v == "function" && x && x.createHTMLDocument !== void 0;
564
+ let { MUSTACHE_EXPR: C, ERB_EXPR: w, TMPLIT_EXPR: We, DATA_ATTR: Ge, ARIA_ATTR: Ke, IS_SCRIPT_OR_DATA: qe, ATTR_WHITESPACE: Je, CUSTOM_ELEMENT: Ye } = EXPRESSIONS, { IS_ALLOWED_URI: Xe } = EXPRESSIONS, T = null, Ze = addToSet({}, [
537
565
  ...html$1,
538
566
  ...svg$1,
539
567
  ...svgFilters,
540
568
  ...mathMl$1,
541
569
  ...text
542
- ]), w = null, et = addToSet({}, [
570
+ ]), E = null, Qe = addToSet({}, [
543
571
  ...html$2,
544
572
  ...svg,
545
573
  ...mathMl,
546
574
  ...xml
547
- ]), T = Object.seal(create(null, {
575
+ ]), D = Object.seal(create(null, {
548
576
  tagNameCheck: {
549
577
  writable: !0,
550
578
  configurable: !1,
@@ -563,7 +591,7 @@ function createDOMPurify() {
563
591
  enumerable: !0,
564
592
  value: !1
565
593
  }
566
- })), E = null, D = null, O = Object.seal(create(null, {
594
+ })), O = null, $e = null, k = Object.seal(create(null, {
567
595
  tagCheck: {
568
596
  writable: !0,
569
597
  configurable: !1,
@@ -576,7 +604,7 @@ function createDOMPurify() {
576
604
  enumerable: !0,
577
605
  value: null
578
606
  }
579
- })), tt = !0, k = !0, nt = !1, rt = !0, A = !1, j = !0, M = !1, it = !1, at = !1, N = !1, P = !1, F = !1, ot = !0, st = !1, I = !0, L = !1, R = {}, z = null, ct = addToSet({}, [
607
+ })), et = !0, A = !0, tt = !1, nt = !0, j = !1, M = !0, N = !1, rt = !1, it = !1, P = !1, F = !1, I = !1, at = !0, ot = !1, st = !0, L = !1, R = {}, z = null, ct = addToSet({}, [
580
608
  "annotation-xml",
581
609
  "audio",
582
610
  "colgroup",
@@ -609,7 +637,7 @@ function createDOMPurify() {
609
637
  "source",
610
638
  "image",
611
639
  "track"
612
- ]), dt = null, ft = addToSet({}, [
640
+ ]), B = null, dt = addToSet({}, [
613
641
  "alt",
614
642
  "class",
615
643
  "for",
@@ -624,10 +652,10 @@ function createDOMPurify() {
624
652
  "value",
625
653
  "style",
626
654
  "xmlns"
627
- ]), B = "http://www.w3.org/1998/Math/MathML", V = "http://www.w3.org/2000/svg", H = "http://www.w3.org/1999/xhtml", U = H, W = !1, G = null, pt = addToSet({}, [
628
- B,
655
+ ]), V = "http://www.w3.org/1998/Math/MathML", H = "http://www.w3.org/2000/svg", U = "http://www.w3.org/1999/xhtml", W = U, G = !1, ft = null, pt = addToSet({}, [
629
656
  V,
630
- H
657
+ H,
658
+ U
631
659
  ], stringToString), K = addToSet({}, [
632
660
  "mi",
633
661
  "mo",
@@ -645,11 +673,11 @@ function createDOMPurify() {
645
673
  }, vt = function() {
646
674
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
647
675
  if (!(X && X === e)) {
648
- if ((!e || typeof e != "object") && (e = {}), e = clone(e), J = ht.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, Y = J === "application/xhtml+xml" ? stringToString : stringToLowerCase, C = objectHasOwnProperty(e, "ALLOWED_TAGS") ? addToSet({}, e.ALLOWED_TAGS, Y) : $e, w = objectHasOwnProperty(e, "ALLOWED_ATTR") ? addToSet({}, e.ALLOWED_ATTR, Y) : et, G = objectHasOwnProperty(e, "ALLOWED_NAMESPACES") ? addToSet({}, e.ALLOWED_NAMESPACES, stringToString) : pt, dt = objectHasOwnProperty(e, "ADD_URI_SAFE_ATTR") ? addToSet(clone(ft), e.ADD_URI_SAFE_ATTR, Y) : ft, lt = objectHasOwnProperty(e, "ADD_DATA_URI_TAGS") ? addToSet(clone(ut), e.ADD_DATA_URI_TAGS, Y) : ut, z = objectHasOwnProperty(e, "FORBID_CONTENTS") ? addToSet({}, e.FORBID_CONTENTS, Y) : ct, E = objectHasOwnProperty(e, "FORBID_TAGS") ? addToSet({}, e.FORBID_TAGS, Y) : clone({}), D = objectHasOwnProperty(e, "FORBID_ATTR") ? addToSet({}, e.FORBID_ATTR, Y) : clone({}), R = objectHasOwnProperty(e, "USE_PROFILES") ? e.USE_PROFILES : !1, tt = e.ALLOW_ARIA_ATTR !== !1, k = e.ALLOW_DATA_ATTR !== !1, nt = e.ALLOW_UNKNOWN_PROTOCOLS || !1, rt = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, A = e.SAFE_FOR_TEMPLATES || !1, j = e.SAFE_FOR_XML !== !1, M = e.WHOLE_DOCUMENT || !1, N = e.RETURN_DOM || !1, P = e.RETURN_DOM_FRAGMENT || !1, F = e.RETURN_TRUSTED_TYPE || !1, at = e.FORCE_BODY || !1, ot = e.SANITIZE_DOM !== !1, st = e.SANITIZE_NAMED_PROPS || !1, I = e.KEEP_CONTENT !== !1, L = e.IN_PLACE || !1, Qe = e.ALLOWED_URI_REGEXP || IS_ALLOWED_URI, U = e.NAMESPACE || H, K = e.MATHML_TEXT_INTEGRATION_POINTS || K, q = e.HTML_INTEGRATION_POINTS || q, T = e.CUSTOM_ELEMENT_HANDLING || {}, e.CUSTOM_ELEMENT_HANDLING && _t(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (T.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && _t(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (T.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (T.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), A && (k = !1), P && (N = !0), R && (C = addToSet({}, text), w = [], R.html === !0 && (addToSet(C, html$1), addToSet(w, html$2)), R.svg === !0 && (addToSet(C, svg$1), addToSet(w, svg), addToSet(w, xml)), R.svgFilters === !0 && (addToSet(C, svgFilters), addToSet(w, svg), addToSet(w, xml)), R.mathMl === !0 && (addToSet(C, mathMl$1), addToSet(w, mathMl), addToSet(w, xml))), e.ADD_TAGS && (typeof e.ADD_TAGS == "function" ? O.tagCheck = e.ADD_TAGS : (C === $e && (C = clone(C)), addToSet(C, e.ADD_TAGS, Y))), e.ADD_ATTR && (typeof e.ADD_ATTR == "function" ? O.attributeCheck = e.ADD_ATTR : (w === et && (w = clone(w)), addToSet(w, e.ADD_ATTR, Y))), e.ADD_URI_SAFE_ATTR && addToSet(dt, e.ADD_URI_SAFE_ATTR, Y), e.FORBID_CONTENTS && (z === ct && (z = clone(z)), addToSet(z, e.FORBID_CONTENTS, Y)), I && (C["#text"] = !0), M && addToSet(C, [
676
+ if ((!e || typeof e != "object") && (e = {}), e = clone(e), J = ht.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, Y = J === "application/xhtml+xml" ? stringToString : stringToLowerCase, T = objectHasOwnProperty(e, "ALLOWED_TAGS") ? addToSet({}, e.ALLOWED_TAGS, Y) : Ze, E = objectHasOwnProperty(e, "ALLOWED_ATTR") ? addToSet({}, e.ALLOWED_ATTR, Y) : Qe, ft = objectHasOwnProperty(e, "ALLOWED_NAMESPACES") ? addToSet({}, e.ALLOWED_NAMESPACES, stringToString) : pt, B = objectHasOwnProperty(e, "ADD_URI_SAFE_ATTR") ? addToSet(clone(dt), e.ADD_URI_SAFE_ATTR, Y) : dt, lt = objectHasOwnProperty(e, "ADD_DATA_URI_TAGS") ? addToSet(clone(ut), e.ADD_DATA_URI_TAGS, Y) : ut, z = objectHasOwnProperty(e, "FORBID_CONTENTS") ? addToSet({}, e.FORBID_CONTENTS, Y) : ct, O = objectHasOwnProperty(e, "FORBID_TAGS") ? addToSet({}, e.FORBID_TAGS, Y) : clone({}), $e = objectHasOwnProperty(e, "FORBID_ATTR") ? addToSet({}, e.FORBID_ATTR, Y) : clone({}), R = objectHasOwnProperty(e, "USE_PROFILES") ? e.USE_PROFILES : !1, et = e.ALLOW_ARIA_ATTR !== !1, A = e.ALLOW_DATA_ATTR !== !1, tt = e.ALLOW_UNKNOWN_PROTOCOLS || !1, nt = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, j = e.SAFE_FOR_TEMPLATES || !1, M = e.SAFE_FOR_XML !== !1, N = e.WHOLE_DOCUMENT || !1, P = e.RETURN_DOM || !1, F = e.RETURN_DOM_FRAGMENT || !1, I = e.RETURN_TRUSTED_TYPE || !1, it = e.FORCE_BODY || !1, at = e.SANITIZE_DOM !== !1, ot = e.SANITIZE_NAMED_PROPS || !1, st = e.KEEP_CONTENT !== !1, L = e.IN_PLACE || !1, Xe = e.ALLOWED_URI_REGEXP || IS_ALLOWED_URI, W = e.NAMESPACE || U, K = e.MATHML_TEXT_INTEGRATION_POINTS || K, q = e.HTML_INTEGRATION_POINTS || q, D = e.CUSTOM_ELEMENT_HANDLING || {}, e.CUSTOM_ELEMENT_HANDLING && _t(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (D.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && _t(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (D.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (D.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), j && (A = !1), F && (P = !0), R && (T = addToSet({}, text), E = [], R.html === !0 && (addToSet(T, html$1), addToSet(E, html$2)), R.svg === !0 && (addToSet(T, svg$1), addToSet(E, svg), addToSet(E, xml)), R.svgFilters === !0 && (addToSet(T, svgFilters), addToSet(E, svg), addToSet(E, xml)), R.mathMl === !0 && (addToSet(T, mathMl$1), addToSet(E, mathMl), addToSet(E, xml))), e.ADD_TAGS && (typeof e.ADD_TAGS == "function" ? k.tagCheck = e.ADD_TAGS : (T === Ze && (T = clone(T)), addToSet(T, e.ADD_TAGS, Y))), e.ADD_ATTR && (typeof e.ADD_ATTR == "function" ? k.attributeCheck = e.ADD_ATTR : (E === Qe && (E = clone(E)), addToSet(E, e.ADD_ATTR, Y))), e.ADD_URI_SAFE_ATTR && addToSet(B, e.ADD_URI_SAFE_ATTR, Y), e.FORBID_CONTENTS && (z === ct && (z = clone(z)), addToSet(z, e.FORBID_CONTENTS, Y)), st && (T["#text"] = !0), N && addToSet(T, [
649
677
  "html",
650
678
  "head",
651
679
  "body"
652
- ]), C.table && (addToSet(C, ["tbody"]), delete E.tbody), e.TRUSTED_TYPES_POLICY) {
680
+ ]), T.table && (addToSet(T, ["tbody"]), delete O.tbody), e.TRUSTED_TYPES_POLICY) {
653
681
  if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
654
682
  if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
655
683
  y = e.TRUSTED_TYPES_POLICY, b = y.createHTML("");
@@ -663,11 +691,11 @@ function createDOMPurify() {
663
691
  ]), bt = addToSet({}, [...mathMl$1, ...mathMlDisallowed]), xt = function(e) {
664
692
  let t = v(e);
665
693
  (!t || !t.tagName) && (t = {
666
- namespaceURI: U,
694
+ namespaceURI: W,
667
695
  tagName: "template"
668
696
  });
669
697
  let n = stringToLowerCase(e.tagName), r = stringToLowerCase(t.tagName);
670
- return G[e.namespaceURI] ? e.namespaceURI === V ? t.namespaceURI === H ? n === "svg" : t.namespaceURI === B ? n === "svg" && (r === "annotation-xml" || K[r]) : !!yt[n] : e.namespaceURI === B ? t.namespaceURI === H ? n === "math" : t.namespaceURI === V ? n === "math" && q[r] : !!bt[n] : e.namespaceURI === H ? t.namespaceURI === V && !q[r] || t.namespaceURI === B && !K[r] ? !1 : !bt[n] && (mt[n] || !yt[n]) : !!(J === "application/xhtml+xml" && G[e.namespaceURI]) : !1;
698
+ return ft[e.namespaceURI] ? e.namespaceURI === H ? t.namespaceURI === U ? n === "svg" : t.namespaceURI === V ? n === "svg" && (r === "annotation-xml" || K[r]) : !!yt[n] : e.namespaceURI === V ? t.namespaceURI === U ? n === "math" : t.namespaceURI === H ? n === "math" && q[r] : !!bt[n] : e.namespaceURI === U ? t.namespaceURI === H && !q[r] || t.namespaceURI === V && !K[r] ? !1 : !bt[n] && (mt[n] || !yt[n]) : !!(J === "application/xhtml+xml" && ft[e.namespaceURI]) : !1;
671
699
  }, Z = function(e) {
672
700
  arrayPush(t.removed, { element: e });
673
701
  try {
@@ -687,7 +715,7 @@ function createDOMPurify() {
687
715
  from: n
688
716
  });
689
717
  }
690
- if (n.removeAttribute(e), e === "is") if (N || P) try {
718
+ if (n.removeAttribute(e), e === "is") if (P || F) try {
691
719
  Z(n);
692
720
  } catch {}
693
721
  else try {
@@ -695,26 +723,26 @@ function createDOMPurify() {
695
723
  } catch {}
696
724
  }, St = function(e) {
697
725
  let t = null, r = null;
698
- if (at) e = "<remove></remove>" + e;
726
+ if (it) e = "<remove></remove>" + e;
699
727
  else {
700
728
  let t = stringMatch(e, /^[\r\n\t ]+/);
701
729
  r = t && t[0];
702
730
  }
703
- J === "application/xhtml+xml" && U === H && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
731
+ J === "application/xhtml+xml" && W === U && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
704
732
  let i = y ? y.createHTML(e) : e;
705
- if (U === H) try {
733
+ if (W === U) try {
706
734
  t = new f().parseFromString(i, J);
707
735
  } catch {}
708
736
  if (!t || !t.documentElement) {
709
- t = Be.createDocument(U, "template", null);
737
+ t = x.createDocument(W, "template", null);
710
738
  try {
711
- t.documentElement.innerHTML = W ? b : i;
739
+ t.documentElement.innerHTML = G ? b : i;
712
740
  } catch {}
713
741
  }
714
742
  let a = t.body || t.documentElement;
715
- return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), U === H ? Ue.call(t, M ? "html" : "body")[0] : M ? t.documentElement : a;
743
+ return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), W === U ? He.call(t, N ? "html" : "body")[0] : N ? t.documentElement : a;
716
744
  }, Ct = function(e) {
717
- return Ve.call(e.ownerDocument || e, e, l.SHOW_ELEMENT | l.SHOW_COMMENT | l.SHOW_TEXT | l.SHOW_PROCESSING_INSTRUCTION | l.SHOW_CDATA_SECTION, null);
745
+ return Be.call(e.ownerDocument || e, e, l.SHOW_ELEMENT | l.SHOW_COMMENT | l.SHOW_TEXT | l.SHOW_PROCESSING_INSTRUCTION | l.SHOW_CDATA_SECTION, null);
718
746
  }, wt = function(e) {
719
747
  return e instanceof d && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof u) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
720
748
  }, Tt = function(e) {
@@ -727,57 +755,57 @@ function createDOMPurify() {
727
755
  }
728
756
  let Et = function(e) {
729
757
  let n = null;
730
- if ($(x.beforeSanitizeElements, e, null), wt(e)) return Z(e), !0;
758
+ if ($(S.beforeSanitizeElements, e, null), wt(e)) return Z(e), !0;
731
759
  let r = Y(e.nodeName);
732
- if ($(x.uponSanitizeElement, e, {
760
+ if ($(S.uponSanitizeElement, e, {
733
761
  tagName: r,
734
- allowedTags: C
735
- }), j && e.hasChildNodes() && !Tt(e.firstElementChild) && regExpTest(/<[/\w!]/g, e.innerHTML) && regExpTest(/<[/\w!]/g, e.textContent) || e.nodeType === NODE_TYPE.progressingInstruction || j && e.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, e.data)) return Z(e), !0;
736
- if (!(O.tagCheck instanceof Function && O.tagCheck(r)) && (!C[r] || E[r])) {
737
- if (!E[r] && Ot(r) && (T.tagNameCheck instanceof RegExp && regExpTest(T.tagNameCheck, r) || T.tagNameCheck instanceof Function && T.tagNameCheck(r))) return !1;
738
- if (I && !z[r]) {
739
- let t = v(e) || e.parentNode, n = _(e) || e.childNodes;
762
+ allowedTags: T
763
+ }), M && e.hasChildNodes() && !Tt(e.firstElementChild) && regExpTest(/<[/\w!]/g, e.innerHTML) && regExpTest(/<[/\w!]/g, e.textContent) || e.nodeType === NODE_TYPE.progressingInstruction || M && e.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, e.data)) return Z(e), !0;
764
+ if (!(k.tagCheck instanceof Function && k.tagCheck(r)) && (!T[r] || O[r])) {
765
+ if (!O[r] && Ot(r) && (D.tagNameCheck instanceof RegExp && regExpTest(D.tagNameCheck, r) || D.tagNameCheck instanceof Function && D.tagNameCheck(r))) return !1;
766
+ if (st && !z[r]) {
767
+ let t = v(e) || e.parentNode, n = ze(e) || e.childNodes;
740
768
  if (n && t) {
741
769
  let r = n.length;
742
770
  for (let i = r - 1; i >= 0; --i) {
743
771
  let r = h(n[i], !0);
744
- r.__removalCount = (e.__removalCount || 0) + 1, t.insertBefore(r, ze(e));
772
+ r.__removalCount = (e.__removalCount || 0) + 1, t.insertBefore(r, _(e));
745
773
  }
746
774
  }
747
775
  }
748
776
  return Z(e), !0;
749
777
  }
750
- return e instanceof c && !xt(e) || (r === "noscript" || r === "noembed" || r === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, e.innerHTML) ? (Z(e), !0) : (A && e.nodeType === NODE_TYPE.text && (n = e.textContent, arrayForEach([
751
- S,
752
- Ge,
753
- Ke
778
+ return e instanceof c && !xt(e) || (r === "noscript" || r === "noembed" || r === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, e.innerHTML) ? (Z(e), !0) : (j && e.nodeType === NODE_TYPE.text && (n = e.textContent, arrayForEach([
779
+ C,
780
+ w,
781
+ We
754
782
  ], (e) => {
755
783
  n = stringReplace(n, e, " ");
756
- }), e.textContent !== n && (arrayPush(t.removed, { element: e.cloneNode() }), e.textContent = n)), $(x.afterSanitizeElements, e, null), !1);
784
+ }), e.textContent !== n && (arrayPush(t.removed, { element: e.cloneNode() }), e.textContent = n)), $(S.afterSanitizeElements, e, null), !1);
757
785
  }, Dt = function(e, t, r) {
758
- if (ot && (t === "id" || t === "name") && (r in n || r in gt)) return !1;
759
- if (!(k && !D[t] && regExpTest(qe, t)) && !(tt && regExpTest(Je, t)) && !(O.attributeCheck instanceof Function && O.attributeCheck(t, e))) {
760
- if (!w[t] || D[t]) {
761
- if (!(Ot(e) && (T.tagNameCheck instanceof RegExp && regExpTest(T.tagNameCheck, e) || T.tagNameCheck instanceof Function && T.tagNameCheck(e)) && (T.attributeNameCheck instanceof RegExp && regExpTest(T.attributeNameCheck, t) || T.attributeNameCheck instanceof Function && T.attributeNameCheck(t, e)) || t === "is" && T.allowCustomizedBuiltInElements && (T.tagNameCheck instanceof RegExp && regExpTest(T.tagNameCheck, r) || T.tagNameCheck instanceof Function && T.tagNameCheck(r)))) return !1;
762
- } else if (!dt[t] && !regExpTest(Qe, stringReplace(r, Xe, "")) && !((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && stringIndexOf(r, "data:") === 0 && lt[e]) && !(nt && !regExpTest(Ye, stringReplace(r, Xe, ""))) && r) return !1;
786
+ if (at && (t === "id" || t === "name") && (r in n || r in gt)) return !1;
787
+ if (!(A && !$e[t] && regExpTest(Ge, t)) && !(et && regExpTest(Ke, t)) && !(k.attributeCheck instanceof Function && k.attributeCheck(t, e))) {
788
+ if (!E[t] || $e[t]) {
789
+ if (!(Ot(e) && (D.tagNameCheck instanceof RegExp && regExpTest(D.tagNameCheck, e) || D.tagNameCheck instanceof Function && D.tagNameCheck(e)) && (D.attributeNameCheck instanceof RegExp && regExpTest(D.attributeNameCheck, t) || D.attributeNameCheck instanceof Function && D.attributeNameCheck(t, e)) || t === "is" && D.allowCustomizedBuiltInElements && (D.tagNameCheck instanceof RegExp && regExpTest(D.tagNameCheck, r) || D.tagNameCheck instanceof Function && D.tagNameCheck(r)))) return !1;
790
+ } else if (!B[t] && !regExpTest(Xe, stringReplace(r, Je, "")) && !((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && stringIndexOf(r, "data:") === 0 && lt[e]) && !(tt && !regExpTest(qe, stringReplace(r, Je, ""))) && r) return !1;
763
791
  }
764
792
  return !0;
765
793
  }, Ot = function(e) {
766
- return e !== "annotation-xml" && stringMatch(e, Ze);
794
+ return e !== "annotation-xml" && stringMatch(e, Ye);
767
795
  }, kt = function(e) {
768
- $(x.beforeSanitizeAttributes, e, null);
796
+ $(S.beforeSanitizeAttributes, e, null);
769
797
  let { attributes: n } = e;
770
798
  if (!n || wt(e)) return;
771
799
  let r = {
772
800
  attrName: "",
773
801
  attrValue: "",
774
802
  keepAttr: !0,
775
- allowedAttributes: w,
803
+ allowedAttributes: E,
776
804
  forceKeepAttr: void 0
777
805
  }, i = n.length;
778
806
  for (; i--;) {
779
807
  let { name: a, namespaceURI: o, value: s } = n[i], c = Y(a), l = s, u = a === "value" ? l : stringTrim(l);
780
- if (r.attrName = c, r.attrValue = u, r.keepAttr = !0, r.forceKeepAttr = void 0, $(x.uponSanitizeAttribute, e, r), u = r.attrValue, st && (c === "id" || c === "name") && (Q(a, e), u = "user-content-" + u), j && regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i, u)) {
808
+ if (r.attrName = c, r.attrValue = u, r.keepAttr = !0, r.forceKeepAttr = void 0, $(S.uponSanitizeAttribute, e, r), u = r.attrValue, ot && (c === "id" || c === "name") && (Q(a, e), u = "user-content-" + u), M && regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i, u)) {
781
809
  Q(a, e);
782
810
  continue;
783
811
  }
@@ -790,14 +818,14 @@ function createDOMPurify() {
790
818
  Q(a, e);
791
819
  continue;
792
820
  }
793
- if (!rt && regExpTest(/\/>/i, u)) {
821
+ if (!nt && regExpTest(/\/>/i, u)) {
794
822
  Q(a, e);
795
823
  continue;
796
824
  }
797
- A && arrayForEach([
798
- S,
799
- Ge,
800
- Ke
825
+ j && arrayForEach([
826
+ C,
827
+ w,
828
+ We
801
829
  ], (e) => {
802
830
  u = stringReplace(u, e, " ");
803
831
  });
@@ -820,63 +848,63 @@ function createDOMPurify() {
820
848
  Q(a, e);
821
849
  }
822
850
  }
823
- $(x.afterSanitizeAttributes, e, null);
851
+ $(S.afterSanitizeAttributes, e, null);
824
852
  }, At = function e(t) {
825
853
  let n = null, r = Ct(t);
826
- for ($(x.beforeSanitizeShadowDOM, t, null); n = r.nextNode();) $(x.uponSanitizeShadowNode, n, null), Et(n), kt(n), n.content instanceof a && e(n.content);
827
- $(x.afterSanitizeShadowDOM, t, null);
854
+ for ($(S.beforeSanitizeShadowDOM, t, null); n = r.nextNode();) $(S.uponSanitizeShadowNode, n, null), Et(n), kt(n), n.content instanceof a && e(n.content);
855
+ $(S.afterSanitizeShadowDOM, t, null);
828
856
  };
829
857
  return t.sanitize = function(e) {
830
858
  let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null, o = null, c = null, l = null;
831
- if (W = !e, W && (e = "<!-->"), typeof e != "string" && !Tt(e)) if (typeof e.toString == "function") {
859
+ if (G = !e, G && (e = "<!-->"), typeof e != "string" && !Tt(e)) if (typeof e.toString == "function") {
832
860
  if (e = e.toString(), typeof e != "string") throw typeErrorCreate("dirty is not a string, aborting");
833
861
  } else throw typeErrorCreate("toString is not a function");
834
862
  if (!t.isSupported) return e;
835
- if (it || vt(n), t.removed = [], typeof e == "string" && (L = !1), L) {
863
+ if (rt || vt(n), t.removed = [], typeof e == "string" && (L = !1), L) {
836
864
  if (e.nodeName) {
837
865
  let t = Y(e.nodeName);
838
- if (!C[t] || E[t]) throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
866
+ if (!T[t] || O[t]) throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
839
867
  }
840
868
  } else if (e instanceof s) i = St("<!---->"), o = i.ownerDocument.importNode(e, !0), o.nodeType === NODE_TYPE.element && o.nodeName === "BODY" || o.nodeName === "HTML" ? i = o : i.appendChild(o);
841
869
  else {
842
- if (!N && !A && !M && e.indexOf("<") === -1) return y && F ? y.createHTML(e) : e;
843
- if (i = St(e), !i) return N ? null : F ? b : "";
870
+ if (!P && !j && !N && e.indexOf("<") === -1) return y && I ? y.createHTML(e) : e;
871
+ if (i = St(e), !i) return P ? null : I ? b : "";
844
872
  }
845
- i && at && Z(i.firstChild);
873
+ i && it && Z(i.firstChild);
846
874
  let u = Ct(L ? e : i);
847
875
  for (; c = u.nextNode();) Et(c), kt(c), c.content instanceof a && At(c.content);
848
876
  if (L) return e;
849
- if (N) {
850
- if (P) for (l = He.call(i.ownerDocument); i.firstChild;) l.appendChild(i.firstChild);
877
+ if (P) {
878
+ if (F) for (l = Ve.call(i.ownerDocument); i.firstChild;) l.appendChild(i.firstChild);
851
879
  else l = i;
852
- return (w.shadowroot || w.shadowrootmode) && (l = We.call(r, l, !0)), l;
880
+ return (E.shadowroot || E.shadowrootmode) && (l = Ue.call(r, l, !0)), l;
853
881
  }
854
- let d = M ? i.outerHTML : i.innerHTML;
855
- return M && C["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, i.ownerDocument.doctype.name) && (d = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + d), A && arrayForEach([
856
- S,
857
- Ge,
858
- Ke
882
+ let d = N ? i.outerHTML : i.innerHTML;
883
+ return N && T["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, i.ownerDocument.doctype.name) && (d = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + d), j && arrayForEach([
884
+ C,
885
+ w,
886
+ We
859
887
  ], (e) => {
860
888
  d = stringReplace(d, e, " ");
861
- }), y && F ? y.createHTML(d) : d;
889
+ }), y && I ? y.createHTML(d) : d;
862
890
  }, t.setConfig = function() {
863
- vt(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), it = !0;
891
+ vt(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), rt = !0;
864
892
  }, t.clearConfig = function() {
865
- X = null, it = !1;
893
+ X = null, rt = !1;
866
894
  }, t.isValidAttribute = function(e, t, n) {
867
895
  return X || vt({}), Dt(Y(e), Y(t), n);
868
896
  }, t.addHook = function(e, t) {
869
- typeof t == "function" && arrayPush(x[e], t);
897
+ typeof t == "function" && arrayPush(S[e], t);
870
898
  }, t.removeHook = function(e, t) {
871
899
  if (t !== void 0) {
872
- let n = arrayLastIndexOf(x[e], t);
873
- return n === -1 ? void 0 : arraySplice(x[e], n, 1)[0];
900
+ let n = arrayLastIndexOf(S[e], t);
901
+ return n === -1 ? void 0 : arraySplice(S[e], n, 1)[0];
874
902
  }
875
- return arrayPop(x[e]);
903
+ return arrayPop(S[e]);
876
904
  }, t.removeHooks = function(e) {
877
- x[e] = [];
905
+ S[e] = [];
878
906
  }, t.removeAllHooks = function() {
879
- x = _createHooksMap();
907
+ S = _createHooksMap();
880
908
  }, t;
881
909
  }
882
910
  var purify = createDOMPurify(), HTMLConfig = { sanitize: (e) => purify.sanitize(e) }, html = (e, ...t) => new HTMLLiteralResult(e.reduce((e, n, r) => {
@@ -901,24 +929,24 @@ function __decorate(e, t, n, r) {
901
929
  else for (var s = e.length - 1; s >= 0; s--) (o = e[s]) && (a = (i < 3 ? o(a) : i > 3 ? o(t, n, a) : o(t, n)) || a);
902
930
  return i > 3 && a && Object.defineProperty(t, n, a), a;
903
931
  }
904
- var component_default$1 = ":host{--host-display:flex;--host-heading-border:var(--scorad-heading-border,solid 1px currentColor);--host-score-color:var(--scorad-score-color,var(--color));--host-score-background:var(--scorad-score-background,var(--background-color));--host-score-border:var(--scorad-score-border,solid 2px currentColor);gap:var(--host-spacing-unit);flex-wrap:wrap;width:fit-content}scorad-weightings{margin-bottom:var(--host-spacing-unit);align-self:center}section{flex-direction:column;flex:auto;display:flex}h3{border:var(--host-heading-border);width:1.5em;height:1.5em;padding:var(--host-padding-unit);margin:var(--host-spacing-unit);border-radius:50%;justify-content:center;align-items:center;display:inline-flex}scorad-label{flex:100%;font-size:1.2rem}scorad-label>span{padding:var(--host-padding-unit);outline:var(--host-score-border);border-radius:var(--host-border-radius);color:var(--host-score-color);background:var(--host-score-background)}", host_default = "*{box-sizing:border-box}:host{--host-spacing-unit:var(--scorad-spacing-unit,.25rem);--host-padding-unit:var(--scorad-padding-unit,.333rem);--host-border-radius:var(--scorad-border-radius,3px);--host-border-radius-outer:var(--scorad-border-radius-outer,calc(var(--host-border-radius) + var(--host-padding-unit)));display:var(--host-display,inline-flex)}";
932
+ var component_default = ":host{--host-display:flex;--host-heading-border:var(--scorad-heading-border,solid 1px var(--host-color));--host-score-color:var(--scorad-score-color,var(--host-color));--host-score-background:var(--scorad-score-background,var(--host-background-color));--host-score-border:var(--scorad-score-border,solid 1px var(--host-color));gap:var(--host-spacing-unit);flex-wrap:wrap;width:fit-content}h3{aspect-ratio:1;border:var(--host-heading-border);padding:var(--host-padding-unit);margin:0 0 0 calc(-1*var(--host-padding-unit));border-radius:50%;justify-content:center;align-items:center;line-height:0;display:inline-flex}p{padding:var(--host-padding-unit)0 0;margin:0;font-size:.9em}scorad-label{break-inside:avoid;outline:none;flex:5 19rem}#extent-label{flex-basis:100%}#intensity-label{flex-grow:1}#score-label{background:linear-gradient(to bottom,transparent,var(--background-color)75%);flex-basis:100%;font-size:1.2rem;position:sticky;bottom:0}@media print{#score-label{position:relative}}#score-label>span{padding:var(--host-padding-unit);border-radius:var(--host-border-radius);outline:var(--host-score-border);color:var(--host-score-color);background:var(--host-score-background)}scorad-extent,scorad-intensity,scorad-subjective{margin:.6rem calc(-1*var(--host-padding-unit));flex:100%}", host_default = "*{box-sizing:border-box}:host{--host-color-l:var(--color-l,50%);--host-error-color-h:var(--error-color-h,0);--host-color:var(--color,#444);--host-background-color:var(--background-color,#eee);--host-primary-color:var(--primary-color,var(--host-color));--host-error-color:var(--error-color,hsl(var(--host-error-color-h),66.7%,var(--host-color-l)));--host-spacing-unit:var(--scorad-spacing-unit,.25rem);--host-padding-unit:var(--scorad-padding-unit,.333rem);--host-border-radius:var(--scorad-border-radius,3px);--host-border-radius-outer:var(--scorad-border-radius-outer,calc(var(--host-border-radius) + var(--host-padding-unit)));--host-outline-hover:var(--scorad-outline-hover,dashed 2px var(--host-primary-color));--host-outline-focus:var(--scorad-outline-focus,solid 2px var(--host-primary-color));display:var(--host-display,inline-flex);line-height:1.2}@media (prefers-color-scheme:dark){:host{--host-color-l:var(--color-l,70%)}}";
905
933
  const SCORAD_EXTENT_MAX_VALUE = 100, SCORAD_INTENSITY_MAX_VALUE = 3, SCORAD_SUBJECTIVE_MAX_VALUE = 10, SCORAD_EXTENT_DEFAULT = {
906
- headNeck: -1,
907
- anteriorTrunk: -1,
908
- posteriorTrunk: -1,
909
- upperLimbs: -1,
910
- lowerLimbs: -1,
911
- genitals: -1
934
+ headNeck: null,
935
+ anteriorTrunk: null,
936
+ posteriorTrunk: null,
937
+ upperLimbs: null,
938
+ lowerLimbs: null,
939
+ genitals: null
912
940
  }, SCORAD_INTENSITY_DEFAULT = {
913
- erythema: -1,
914
- oedemaPapulation: -1,
915
- oozingCrusting: -1,
916
- excoriations: -1,
917
- lichenification: -1,
918
- xerosis: -1
941
+ erythema: null,
942
+ oedemaPapulation: null,
943
+ oozingCrusting: null,
944
+ excoriations: null,
945
+ lichenification: null,
946
+ xerosis: null
919
947
  }, SCORAD_SUBJECTIVE_DEFAULT = {
920
- pruritus: -1,
921
- sleeplessness: -1
948
+ pruritus: null,
949
+ sleeplessness: null
922
950
  }, SCORAD_DEFAULT = {
923
951
  child: !1,
924
952
  extent: SCORAD_EXTENT_DEFAULT,
@@ -939,13 +967,91 @@ const SCORAD_EXTENT_MAX_VALUE = 100, SCORAD_INTENSITY_MAX_VALUE = 3, SCORAD_SUBJ
939
967
  lowerLimbs: .28,
940
968
  genitals: 0
941
969
  };
942
- var component_default$6 = ":host{--host-display:inline-flex;--host-font-size:1rem;justify-content:center;align-items:center;gap:var(--host-spacing-unit);flex-wrap:wrap;position:relative}label{padding:var(--host-padding-unit)}svg{width:calc(50% - var(--host-spacing-unit));padding:var(--host-spacing-unit)0;fill:#0000;stroke:currentColor;stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;flex:auto;overflow:visible}path,line{vector-effect:non-scaling-stroke}path{opacity:.333}text,line{opacity:.667}g{outline:none}g[tabindex] path{opacity:1;fill:hsla(var(--scorad-h,0),var(--extent,\"0%\"),50%,var(--opacity,0))}:is(:not(:has(:active)) g[tabindex]:hover path,:not(:has(:active)) g[tabindex]:hover line){stroke-width:2px;stroke:var(--primary-color);stroke-dasharray:2 3.5;opacity:1}g[tabindex]:focus path,g[tabindex]:active path,g[tabindex].selected path,g[tabindex]:focus line,g[tabindex]:active line,g[tabindex].selected line{stroke-width:2px;stroke:var(--primary-color);opacity:1;stroke-dasharray:none!important}g[tabindex] text{fill:currentColor;stroke:none;font-size:var(--host-font-size);text-anchor:end}:is(:not(:has(:active)) g[tabindex]:hover text,g[tabindex]:focus text,g[tabindex]:active text,g[tabindex].selected text){fill:var(--primary-color);opacity:1}", tag$6 = "scorad-extent", HTMLScoradExtentElement = class extends HTMLComponentElement {
970
+ var component_default$6 = ":host{--host-display:inline-flex;--host-font-size:1rem;flex-wrap:wrap;justify-content:center;align-items:center;position:relative}label{padding:var(--host-padding-unit)}svg{min-width:14rem;max-width:18rem;margin:var(--host-padding-unit)0;fill:#0000;stroke:var(--host-color);stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;flex:16rem;overflow:visible}@media print{svg{flex:0 0 14rem;width:14rem}}path,line{vector-effect:non-scaling-stroke}path{opacity:.333}text,line{opacity:.667}g{outline:none}g[tabindex] path{opacity:1;fill:hsla(var(--scorad-h,0),var(--extent,\"0%\"),50%,var(--opacity,0));cursor:grab}:has(:active) g[tabindex] path{cursor:ns-resize}:is(:not(:has(:active)) g[tabindex]:hover path,:not(:has(:active)) g[tabindex]:hover line){stroke-width:2px;stroke:var(--host-primary-color);stroke-dasharray:2 3.5;opacity:1}g[tabindex]:focus path,g[tabindex]:active path,g[tabindex].selected path,g[tabindex]:focus line,g[tabindex]:active line,g[tabindex].selected line{stroke-width:2px;stroke:var(--host-primary-color);opacity:1;stroke-dasharray:none!important}g[tabindex] text{fill:var(--host-color);stroke:none;font-size:var(--host-font-size);text-anchor:end}g[tabindex].posterior-trunk text{text-anchor:start}:is(:not(:has(:active)) g[tabindex]:hover text,g[tabindex]:focus text,g[tabindex]:active text,g[tabindex].selected text){fill:var(--host-primary-color);opacity:1}";
971
+ const selectScoradWeights = (e) => e?.child ? SCORAD_CHILD_WEIGHTS : SCORAD_ADULT_WEIGHTS, validateScoradData = (e) => {
972
+ let t = [], n = (e, n, r) => {
973
+ for (let [i, a] of Object.entries(e)) validateScoradData.isValid(a, r) || t.push(validateScoradData.formatError(n, i, r, a));
974
+ }, r = { ...e?.extent ?? SCORAD_EXTENT_DEFAULT }, i = selectScoradWeights(e);
975
+ for (let [e, t] of Object.entries(i)) t === 0 && delete r[e];
976
+ return n(r, "extent", 100), n(e?.intensity ?? SCORAD_INTENSITY_DEFAULT, "intensity", 3), n(e?.subjective ?? SCORAD_SUBJECTIVE_DEFAULT, "subjective", 10), t.length ? Result.Fail(t) : Result.Ok(e);
977
+ };
978
+ validateScoradData.formatError = (e, t, n, r) => `${e}.${t}: must be between 0 and ${n}, but received ${r}.`, validateScoradData.isValid = (e, t) => typeof e == "number" && Number.isFinite(e) && e >= 0 && e <= t;
979
+ const ScoradResources = {
980
+ child: {
981
+ text: "child",
982
+ description: "use weightings for a child"
983
+ },
984
+ extent: {
985
+ headNeck: {
986
+ text: "head",
987
+ description: "percentage of the head and neck area affected"
988
+ },
989
+ anteriorTrunk: {
990
+ text: "trunk",
991
+ description: "percentage of the front torso area affected"
992
+ },
993
+ posteriorTrunk: {
994
+ text: "back",
995
+ description: "percentage of the back torso area affected"
996
+ },
997
+ genitals: {
998
+ text: "genitals",
999
+ description: "percentage of the genital area affected"
1000
+ },
1001
+ upperLimbs: {
1002
+ text: "arms",
1003
+ description: "percentage of the arms and shoulders affected"
1004
+ },
1005
+ lowerLimbs: {
1006
+ text: "legs",
1007
+ description: "percentage of the legs and hips affected"
1008
+ }
1009
+ },
1010
+ intensity: {
1011
+ erythema: {
1012
+ text: "Erythema",
1013
+ description: "redness of the skin"
1014
+ },
1015
+ oedemaPapulation: {
1016
+ text: "Oedema/Papulation",
1017
+ description: "swelling and small bumps"
1018
+ },
1019
+ oozingCrusting: {
1020
+ text: "Oozing/Crusting",
1021
+ description: "fluid leakage and dried scabs"
1022
+ },
1023
+ excoriations: {
1024
+ text: "Excoriations",
1025
+ description: "scratch marks"
1026
+ },
1027
+ lichenification: {
1028
+ text: "Lichenification",
1029
+ description: "skin thickening and hardening"
1030
+ },
1031
+ xerosis: {
1032
+ text: "Xerosis",
1033
+ description: "dryness of the skin"
1034
+ }
1035
+ },
1036
+ subjective: {
1037
+ pruritus: {
1038
+ text: "Pruritus",
1039
+ description: "itching"
1040
+ },
1041
+ sleeplessness: {
1042
+ text: "Sleeplessness",
1043
+ description: "difficulty sleeping"
1044
+ }
1045
+ }
1046
+ };
1047
+ var tag$6 = "scorad-extent", HTMLScoradExtentElement = class extends HTMLComponentElement {
943
1048
  connectedCallback() {
944
1049
  this.render();
945
1050
  }
946
1051
  child = !1;
947
1052
  value = SCORAD_EXTENT_DEFAULT;
948
1053
  score;
1054
+ errors;
949
1055
  afterRender() {
950
1056
  if (!this.value) {
951
1057
  this.value = SCORAD_EXTENT_DEFAULT;
@@ -957,14 +1063,14 @@ var component_default$6 = ":host{--host-display:inline-flex;--host-font-size:1re
957
1063
  n.style.setProperty("--extent", `${t}%`), n.style.setProperty("--opacity", `${(t ?? 0) / 100}`);
958
1064
  let r = n.querySelector("text");
959
1065
  if (!r) return;
960
- r.textContent = t >= 0 ? `${t}%` : "--";
1066
+ r.textContent = validateScoradData.isValid(t, 100) ? `${t}%` : ScoradResources.extent[e].text, n.querySelectorAll("path").forEach((t) => t.style.stroke = this.errors?.[e] == null ? "" : "var(--host-error-color)");
961
1067
  }
962
1068
  }
963
1069
  resizeCallback() {
964
1070
  if (!this.shadowRoot) return;
965
1071
  let e = this.shadowRoot.querySelector("svg");
966
1072
  if (!e) return;
967
- let t = Math.round(18e3 / e.clientWidth) / 100;
1073
+ let t = Math.round(19e3 / e.clientWidth) / 100;
968
1074
  this.style.setProperty("--host-font-size", `${t}rem`);
969
1075
  }
970
1076
  render() {
@@ -974,28 +1080,28 @@ var component_default$6 = ":host{--host-display:inline-flex;--host-font-size:1re
974
1080
  this.value = {
975
1081
  ...this.value,
976
1082
  [e]: n
977
- }, this.valueInput(this.value);
1083
+ }, this.errors = void 0, this.valueInput(this.value);
978
1084
  };
979
1085
  return (n) => {
980
1086
  if (!n) return;
981
1087
  "ontouchstart" in window && n.addEventListener("touchstart", (e) => {
982
1088
  e.preventDefault();
983
1089
  }, { passive: !1 }), n.style.touchAction = "none", n.addEventListener("pointerdown", (r) => {
984
- r.preventDefault(), r.stopPropagation(), n.focus();
1090
+ r.stopPropagation(), n.focus();
985
1091
  let i = this.value[e], a = r.clientY, o = (e) => {
986
1092
  e.preventDefault();
987
- let n = a - e.clientY;
1093
+ let n = (a - e.clientY) / 2;
988
1094
  t(Math.round((i + n) / 5) * 5);
989
1095
  }, s = () => {
990
1096
  document.removeEventListener("pointermove", o), document.removeEventListener("pointerup", s), document.removeEventListener("pointercancel", s);
991
1097
  };
992
- document.addEventListener("pointermove", o), document.addEventListener("pointerup", s), document.addEventListener("pointercancel", s);
1098
+ document.addEventListener("pointermove", o), document.addEventListener("pointerup", s), document.addEventListener("pointercancel", s), o(r);
993
1099
  });
994
1100
  let r, i;
995
1101
  n.addEventListener("focus", () => {
996
1102
  i = "000", r = this.value[e];
997
1103
  }), n.addEventListener("keydown", (n) => {
998
- let a = this.value[e], o = n.shiftKey ? 5 : 1;
1104
+ let a = validateScoradData.isValid(this.value[e], 100) ? this.value[e] : 0, o = n.shiftKey ? 5 : 1;
999
1105
  switch (n.key) {
1000
1106
  case "0":
1001
1107
  case "1":
@@ -1027,7 +1133,7 @@ var component_default$6 = ":host{--host-display:inline-flex;--host-font-size:1re
1027
1133
  t && (t.textContent = `${this.value[e]}%`);
1028
1134
  };
1029
1135
  return html`
1030
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 164 240" width="200">
1136
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 190 240">
1031
1137
  <g ${e("headNeck")}
1032
1138
  class="head-neck" tabindex="0">
1033
1139
  <text x="40" y="20" ${t("headNeck")}>--</text>
@@ -1072,7 +1178,7 @@ var component_default$6 = ":host{--host-display:inline-flex;--host-font-size:1re
1072
1178
  <path d="M120,139 100,154 100,230 A1,1 0,0,0 120,230Z"></path>
1073
1179
  </g>
1074
1180
  </svg>
1075
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 164 240" width="200">
1181
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 190 240">
1076
1182
  <g class="head-neck">
1077
1183
  <path d="M100,45 100,49 Q95,48 90,49 L90,45 A20,22.5 1,1,1 100,45Z"></path>
1078
1184
  </g>
@@ -1082,8 +1188,8 @@ var component_default$6 = ":host{--host-display:inline-flex;--host-font-size:1re
1082
1188
  </g>
1083
1189
  <g ${e("posteriorTrunk")}
1084
1190
  class="posterior-trunk" tabindex="0">
1085
- <text x="40" y="50" ${t("posteriorTrunk")}>--</text>
1086
- <line x1="45" y1="46" x2="75" y2="52"></line>
1191
+ <text x="150" y="50" ${t("posteriorTrunk")}>--</text>
1192
+ <line x1="145" y1="46" x2="115" y2="52"></line>
1087
1193
  <path d="M80,58 Q95,52 110,58 L120,130 Q110,152 95,142 L95,142 Q80,152 70,130 L80,60Z"></path>
1088
1194
  </g>
1089
1195
  <g class="lower-limbs">
@@ -1096,86 +1202,21 @@ var component_default$6 = ":host{--host-display:inline-flex;--host-font-size:1re
1096
1202
  valueInput;
1097
1203
  valueChange;
1098
1204
  };
1099
- __decorate([Att(AttBoolean)], HTMLScoradExtentElement.prototype, "child", void 0), __decorate([Watch("value")], HTMLScoradExtentElement.prototype, "afterRender", null), __decorate([Watch("child")], HTMLScoradExtentElement.prototype, "render", null), __decorate([Event()], HTMLScoradExtentElement.prototype, "valueInput", void 0), __decorate([Event()], HTMLScoradExtentElement.prototype, "valueChange", void 0), HTMLScoradExtentElement = __decorate([Component({
1205
+ __decorate([Att(AttBoolean)], HTMLScoradExtentElement.prototype, "child", void 0), __decorate([Att({
1206
+ name: "has-errors",
1207
+ write: (e) => e == null ? void 0 : "",
1208
+ read: !1
1209
+ })], HTMLScoradExtentElement.prototype, "errors", void 0), __decorate([Watch("value", "errors")], HTMLScoradExtentElement.prototype, "afterRender", null), __decorate([Watch("child")], HTMLScoradExtentElement.prototype, "render", null), __decorate([Event()], HTMLScoradExtentElement.prototype, "valueInput", void 0), __decorate([Event()], HTMLScoradExtentElement.prototype, "valueChange", void 0), HTMLScoradExtentElement = __decorate([Component({
1100
1210
  tag: tag$6,
1101
1211
  css: [host_default, component_default$6],
1102
1212
  delegatesFocus: !0
1103
1213
  })], HTMLScoradExtentElement);
1104
- var component_default$4 = ":host{--host-display:inline-flex;flex-direction:column;position:relative}scorad-options{margin-left:auto}";
1105
- const ScoradResources = {
1106
- child: {
1107
- text: "child",
1108
- description: "use weightings for a child"
1109
- },
1110
- extent: {
1111
- headNeck: {
1112
- text: "Head/Neck",
1113
- description: "percentage of the head and neck area affected"
1114
- },
1115
- anteriorTrunk: {
1116
- text: "Anterior Trunk",
1117
- description: "percentage of the front torso area affected"
1118
- },
1119
- posteriorTrunk: {
1120
- text: "Posterior Trunk",
1121
- description: "percentage of the back torso area affected"
1122
- },
1123
- genitals: {
1124
- text: "Genitals",
1125
- description: "percentage of the genital area affected"
1126
- },
1127
- upperLimbs: {
1128
- text: "Upper Limbs",
1129
- description: "percentage of the arms and shoulders affected"
1130
- },
1131
- lowerLimbs: {
1132
- text: "Lower Limbs",
1133
- description: "percentage of the legs and hips affected"
1134
- }
1135
- },
1136
- intensity: {
1137
- erythema: {
1138
- text: "Erythema",
1139
- description: "redness of the skin"
1140
- },
1141
- oedemaPapulation: {
1142
- text: "Oedema/Papulation",
1143
- description: "swelling and small, raised bumps"
1144
- },
1145
- oozingCrusting: {
1146
- text: "Oozing/Crusting",
1147
- description: "fluid leakage and dried scabs"
1148
- },
1149
- excoriations: {
1150
- text: "Excoriations",
1151
- description: "scratch marks"
1152
- },
1153
- lichenification: {
1154
- text: "Lichenification",
1155
- description: "skin thickening and hardening"
1156
- },
1157
- xerosis: {
1158
- text: "Xerosis",
1159
- description: "dryness of the skin"
1160
- }
1161
- },
1162
- subjective: {
1163
- pruritus: {
1164
- text: "Pruritus",
1165
- description: "itching"
1166
- },
1167
- sleeplessness: {
1168
- text: "Sleeplessness",
1169
- description: "difficulty sleeping"
1170
- }
1171
- }
1172
- };
1173
- var component_default$5 = ":host{--host-display:inline-flex;--host-option-width:var(--scorad-option-width,1.5em);--host-option-height:var(--scorad-option-height,1.5em);--host-option-border:var(--scorad-option-border,solid 1px var(--color));--host-option-border-selected:var(--scorad-option-border-selected,solid 2px var(--color));--host-option-color:var(--scorad-option-color,var(--color));--host-option-background:var(--scorad-option-background,transparent);--host-option-color-selected:var(--scorad-option-color-selected,var(--background-color));--host-option-background-selected:var(--scorad-option-background-selected,var(--color));gap:var(--host-spacing-unit);padding:calc(1.5*var(--host-padding-unit))0;outline:none;width:max-content;position:relative}span{height:var(--host-option-height);width:var(--host-option-width);outline:var(--host-option-border);border-radius:var(--host-border-radius);padding:calc(.5*var(--host-padding-unit))var(--host-padding-unit);color:var(--host-option-color);background:var(--host-option-background);cursor:pointer;touch-action:none}span:before{content:\"​\";touch-action:none;pointer-events:none}span[aria-selected=true]{outline:var(--host-option-border-selected);color:var(--host-option-color-selected);background:var(--host-option-background-selected)}", tag$5 = "scorad-options", HTMLScoradOptionsElement = class extends HTMLComponentElement {
1214
+ var component_default$4 = ":host{--host-display:inline-flex;flex-direction:column;position:relative}scorad-options{align-self:center;margin-left:auto}", component_default$5 = ":host{--host-display:inline-flex;--host-option-width:var(--scorad-option-width,1.5em);--host-option-height:var(--scorad-option-height,1.5em);--host-option-border:var(--scorad-option-border,solid 1px var(--host-color));--host-option-border-selected:var(--scorad-option-border-selected,solid 2px var(--host-color));--host-option-color:var(--scorad-option-color,var(--host-color));--host-option-background:var(--scorad-option-background,transparent);--host-option-color-selected:var(--scorad-option-color-selected,var(--host-background-color));--host-option-background-selected:var(--scorad-option-background-selected,var(--host-color));gap:var(--host-spacing-unit);margin:var(--host-padding-unit)0;outline:none;width:max-content;position:relative}span{height:var(--host-option-height);width:var(--host-option-width);outline:var(--host-option-border);border-radius:var(--host-border-radius);padding:calc(.5*var(--host-padding-unit))var(--host-padding-unit);color:var(--host-option-color);background:var(--host-option-background);cursor:pointer;touch-action:none}span:before{content:\"​\";touch-action:none;pointer-events:none}span[aria-selected=true]{outline:var(--host-option-border-selected);color:var(--host-option-color-selected);background:var(--host-option-background-selected)}", tag$5 = "scorad-options", HTMLScoradOptionsElement = class extends HTMLComponentElement {
1174
1215
  connectedCallback() {
1175
- this.render(), this.addEventListener("focusin", this._handleFocusIn, { once: !0 }), this.addEventListener("pointerdown", this._handleDown);
1216
+ this.render(), this.addEventListener("focusin", this._handleFocusIn, { once: !0 }), this.addEventListener("click", this._handleClick);
1176
1217
  }
1177
1218
  disconnectedCallback() {
1178
- this.addEventListener("pointerdown", this._handleDown);
1219
+ this.addEventListener("click", this._handleClick);
1179
1220
  }
1180
1221
  _handleFocusIn = () => {
1181
1222
  this.readonly || (this.committedValue = this.value, this.addEventListener("focusout", this._handleFocusOut, { once: !0 }), this.addEventListener("keydown", this._handleKeydown));
@@ -1183,13 +1224,9 @@ var component_default$5 = ":host{--host-display:inline-flex;--host-option-width:
1183
1224
  _handleFocusOut = () => {
1184
1225
  this.removeEventListener("keydown", this._handleKeydown), this.addEventListener("focusin", this._handleFocusIn, { once: !0 }), this.setValue(this.value), this.value !== this.committedValue && this.valueChange(this.value);
1185
1226
  };
1186
- _handleDown = (e) => {
1187
- this.readonly || (e.stopPropagation(), e.preventDefault(), this.focus(), this._handleMove(e), document.addEventListener("pointerup", this._handleUp), document.addEventListener("pointermove", this._handleMove));
1188
- };
1189
- _handleUp = (e) => {
1190
- e.stopPropagation(), document.removeEventListener("pointerup", this._handleUp), document.removeEventListener("pointermove", this._handleMove);
1191
- };
1192
- _handleMove = (e) => {
1227
+ _handleClick = (e) => {
1228
+ if (this.readonly) return;
1229
+ e.stopPropagation(), e.preventDefault(), this.focus();
1193
1230
  let t = e.composedPath()[0];
1194
1231
  if (!(t instanceof HTMLSpanElement)) return;
1195
1232
  let n = Number.parseInt(t.dataset.value);
@@ -1262,6 +1299,7 @@ var tag$4 = "scorad-intensity", HTMLScoradIntensityElement = class extends HTMLC
1262
1299
  }
1263
1300
  value = SCORAD_INTENSITY_DEFAULT;
1264
1301
  score;
1302
+ errors;
1265
1303
  afterRender() {
1266
1304
  if (this.value == null) {
1267
1305
  this.value = SCORAD_INTENSITY_DEFAULT;
@@ -1273,7 +1311,7 @@ var tag$4 = "scorad-intensity", HTMLScoradIntensityElement = class extends HTMLC
1273
1311
  n.dataset.value = `${t}`;
1274
1312
  let r = n.querySelector("scorad-options");
1275
1313
  if (!r) return;
1276
- r.value = t;
1314
+ r.value = t, r.style.setProperty("--host-option-border", this.errors?.[e] == null ? null : "solid 1px var(--host-error-color)");
1277
1315
  }
1278
1316
  }
1279
1317
  render() {
@@ -1303,17 +1341,22 @@ var tag$4 = "scorad-intensity", HTMLScoradIntensityElement = class extends HTMLC
1303
1341
  valueInput;
1304
1342
  valueChange;
1305
1343
  };
1306
- __decorate([Watch("value")], HTMLScoradIntensityElement.prototype, "afterRender", null), __decorate([Event()], HTMLScoradIntensityElement.prototype, "valueInput", void 0), __decorate([Event()], HTMLScoradIntensityElement.prototype, "valueChange", void 0), HTMLScoradIntensityElement = __decorate([Component({
1344
+ __decorate([Att({
1345
+ name: "has-errors",
1346
+ write: (e) => e == null ? void 0 : "",
1347
+ read: !1
1348
+ })], HTMLScoradIntensityElement.prototype, "errors", void 0), __decorate([Watch("value", "errors")], HTMLScoradIntensityElement.prototype, "afterRender", null), __decorate([Event()], HTMLScoradIntensityElement.prototype, "valueInput", void 0), __decorate([Event()], HTMLScoradIntensityElement.prototype, "valueChange", void 0), HTMLScoradIntensityElement = __decorate([Component({
1307
1349
  tag: tag$4,
1308
1350
  css: [host_default, component_default$4],
1309
1351
  delegatesFocus: !0
1310
1352
  })], HTMLScoradIntensityElement);
1311
- var component_default$3 = ":host{--host-display:inline-flex;flex-direction:column;position:relative}scorad-options{margin-left:auto}", tag$3 = "scorad-subjective", HTMLScoradSubjectiveElement = class extends HTMLComponentElement {
1353
+ var component_default$3 = ":host{--host-display:inline-flex;--scorad-label-text-min-width:7rem;flex-direction:column;position:relative}scorad-options{align-self:center;margin-left:auto}", tag$3 = "scorad-subjective", HTMLScoradSubjectiveElement = class extends HTMLComponentElement {
1312
1354
  connectedCallback() {
1313
1355
  this.render();
1314
1356
  }
1315
1357
  value = SCORAD_SUBJECTIVE_DEFAULT;
1316
1358
  score;
1359
+ errors;
1317
1360
  afterRender() {
1318
1361
  if (this.value == null) {
1319
1362
  this.value = SCORAD_SUBJECTIVE_DEFAULT;
@@ -1325,7 +1368,7 @@ var component_default$3 = ":host{--host-display:inline-flex;flex-direction:colum
1325
1368
  n.dataset.value = `${t}`;
1326
1369
  let r = n.querySelector("scorad-options");
1327
1370
  if (!r) return;
1328
- r.value = t;
1371
+ r.value = t, r.style.setProperty("--host-option-border", this.errors?.[e] == null ? null : "solid 1px var(--host-error-color)");
1329
1372
  }
1330
1373
  }
1331
1374
  render() {
@@ -1354,12 +1397,16 @@ var component_default$3 = ":host{--host-display:inline-flex;flex-direction:colum
1354
1397
  valueInput;
1355
1398
  valueChange;
1356
1399
  };
1357
- __decorate([Watch("value")], HTMLScoradSubjectiveElement.prototype, "afterRender", null), __decorate([Event()], HTMLScoradSubjectiveElement.prototype, "valueInput", void 0), __decorate([Event()], HTMLScoradSubjectiveElement.prototype, "valueChange", void 0), HTMLScoradSubjectiveElement = __decorate([Component({
1400
+ __decorate([Att({
1401
+ name: "has-errors",
1402
+ write: (e) => e == null ? void 0 : "",
1403
+ read: !1
1404
+ })], HTMLScoradSubjectiveElement.prototype, "errors", void 0), __decorate([Watch("value", "errors")], HTMLScoradSubjectiveElement.prototype, "afterRender", null), __decorate([Event()], HTMLScoradSubjectiveElement.prototype, "valueInput", void 0), __decorate([Event()], HTMLScoradSubjectiveElement.prototype, "valueChange", void 0), HTMLScoradSubjectiveElement = __decorate([Component({
1358
1405
  tag: tag$3,
1359
1406
  css: [host_default, component_default$3],
1360
1407
  delegatesFocus: !0
1361
1408
  })], HTMLScoradSubjectiveElement);
1362
- var component_default$2 = ":host{--host-display:inline-flex;--host-outline-hover:var(--scorad-weightings-outline-hover,dashed 2px var(--primary-color));--host-outline-focus:var(--scorad-weightings-outline-focus,solid 2px var(--primary-color));padding:0 var(--host-padding-unit);border-radius:var(--host-border-radius);justify-content:center;align-items:baseline;position:relative}:host(:hover){outline:var(--host-outline-hover)}:host(:focus-within){outline:var(--host-outline-focus)}scorad-options{--host-option-width:auto;--host-option-height:auto}", tag$2 = "scorad-weightings", HTMLScoradWeightingsElement = class extends HTMLComponentElement {
1409
+ var component_default$2 = ":host{--host-display:inline-flex;padding:0 var(--host-padding-unit);border-radius:var(--host-border-radius);justify-content:center;align-items:baseline;position:relative}:host(:hover){outline:var(--host-outline-hover)}:host(:focus-within){outline:var(--host-outline-focus)}scorad-options{--host-option-width:auto;--host-option-height:auto}", tag$2 = "scorad-weightings", HTMLScoradWeightingsElement = class extends HTMLComponentElement {
1363
1410
  connectedCallback() {
1364
1411
  this.render();
1365
1412
  }
@@ -1392,14 +1439,6 @@ __decorate([Watch("value")], HTMLScoradWeightingsElement.prototype, "afterRender
1392
1439
  css: [host_default, component_default$2],
1393
1440
  delegatesFocus: !0
1394
1441
  })], HTMLScoradWeightingsElement);
1395
- const selectScoradWeights = (e) => e?.child ? SCORAD_CHILD_WEIGHTS : SCORAD_ADULT_WEIGHTS, validateScoradData = (e) => {
1396
- let t = [], n = (e, n, r) => {
1397
- for (let [i, a] of Object.entries(e)) (a < 0 || a > r) && t.push(validateScoradData.formatError(n, i, r, a));
1398
- }, r = { ...e?.extent ?? SCORAD_EXTENT_DEFAULT }, i = selectScoradWeights(e);
1399
- for (let [e, t] of Object.entries(i)) t === 0 && delete r[e];
1400
- return n(r, "extent", 100), n(e?.intensity ?? SCORAD_INTENSITY_DEFAULT, "intensity", 3), n(e?.subjective ?? SCORAD_SUBJECTIVE_DEFAULT, "subjective", 10), t.length ? Result.Fail(t) : Result.Ok(e);
1401
- };
1402
- validateScoradData.formatError = (e, t, n, r) => `${e}.${t}: must be between 0 and ${n}, but received ${r}.`;
1403
1442
  const getScoradScore = (e) => {
1404
1443
  let t = validateScoradData(e);
1405
1444
  if (t instanceof Failure) return t;
@@ -1412,11 +1451,38 @@ const getScoradScore = (e) => {
1412
1451
  total: o
1413
1452
  });
1414
1453
  };
1415
- var tag$1 = "scorad-component", HTMLScoradElement = class extends HTMLComponentElement {
1454
+ var component_default$1 = ":host{--host-display:var(--scorad-label-display,inline-flex);--host-options:var(--scorad-label-options,solid 1px var(--host-color));--host-text-min-width:var(--scorad-label-text-min-width,none);--host-text-max-width:var(--scorad-label-text-max-width,none);grid-column:1/3;grid-template-columns:subgrid;padding:var(--host-padding-unit);border-radius:var(--host-border-radius-outer);flex-wrap:wrap;align-content:baseline;align-items:baseline;position:relative}:host(:hover){outline:var(--host-outline-hover)}:host(:focus-within){outline:var(--host-outline-focus)}:host>label{min-width:var(--host-text-min-width);max-width:var(--host-text-max-width)}:host>label>slot[name=text]{transition:all .2s ease-in-out;display:block}:host>label>slot[name=description]{opacity:0;margin-bottom:-1.1em;transition:all .4s ease-in-out;display:block}:host(:hover)>label>slot[name=text],:host(:focus-within)>label>slot[name=text]{transform:translateY(-.5em)}:host(:hover)>label>slot[name=description],:host(:focus-within)>label>slot[name=description]{opacity:.667;transform:translateY(-.6em)}@media print{:host>label>slot[name=text]{transform:translateY(-.5em)}:host>label>slot[name=description]{opacity:.667;transform:translateY(-.6em)}}:host>label{padding:var(--host-padding-unit);flex:1;padding-left:0}", tag$1 = "scorad-label", HTMLScoradLabelElement = class extends HTMLComponentElement {
1455
+ connectedCallback() {
1456
+ this.render(), this.addEventListener("click", this._handleClick);
1457
+ }
1458
+ diconnectedCallback() {
1459
+ this.removeEventListener("click", this._handleClick);
1460
+ }
1461
+ _handleClick = (e) => {
1462
+ this.querySelector(FOCUSABLE)?.focus();
1463
+ };
1464
+ text = "(label)";
1465
+ description;
1466
+ render() {
1467
+ return html`
1468
+ <label>
1469
+ <slot name="text"><span>${this.text}</span></slot>
1470
+ <slot name="description"><small>${this.description}</small></slot>
1471
+ </label>
1472
+ <slot></slot>
1473
+ `;
1474
+ }
1475
+ };
1476
+ __decorate([Att({ write: !1 })], HTMLScoradLabelElement.prototype, "text", void 0), __decorate([Att({ write: !1 })], HTMLScoradLabelElement.prototype, "description", void 0), HTMLScoradLabelElement = __decorate([Component({
1477
+ tag: tag$1,
1478
+ css: [host_default, component_default$1]
1479
+ })], HTMLScoradLabelElement);
1480
+ var tag = "scorad-component", HTMLScoradElement = class extends HTMLComponentElement {
1416
1481
  connectedCallback() {
1417
1482
  this.render();
1418
1483
  }
1419
1484
  value = SCORAD_DEFAULT;
1485
+ showErrors = !1;
1420
1486
  afterRender() {
1421
1487
  if (this.value == null) {
1422
1488
  this.value = SCORAD_DEFAULT;
@@ -1425,21 +1491,25 @@ var tag$1 = "scorad-component", HTMLScoradElement = class extends HTMLComponentE
1425
1491
  if (!this.shadowRoot) return;
1426
1492
  let e = this.shadowRoot.querySelector("#score");
1427
1493
  if (!e) return;
1428
- let t = getScoradScore(this.value).orNull();
1429
- e.innerText = `${t?.total ?? "--.--"}`;
1430
- let n = this.shadowRoot.querySelector("scorad-extent");
1431
- n && (n.child = this.value?.child ?? !1, n.value = this.value?.extent ?? SCORAD_EXTENT_DEFAULT, n.score = t?.A);
1432
- let r = this.shadowRoot.querySelector("scorad-weightings");
1433
- r && (r.value = this.value?.child ?? !1);
1434
- let i = this.shadowRoot.querySelector("scorad-intensity");
1435
- i && (i.value = this.value?.intensity ?? SCORAD_INTENSITY_DEFAULT, i.score = t?.B);
1436
- let a = this.shadowRoot.querySelector("scorad-subjective");
1437
- a && (a.value = this.value?.subjective ?? SCORAD_SUBJECTIVE_DEFAULT, a.score = t?.B);
1494
+ let t = getScoradScore(this.value).orNull(), n = {}, r = validateScoradData(this.value).errors.reduce((e, t) => {
1495
+ let n = t.indexOf(":");
1496
+ return setValue(e, t.substring(0, n), t.substring(n + 2));
1497
+ }, n);
1498
+ e.innerText = `${t?.total ?? "Get Score"}`, e.style.color = this.showErrors && r != n ? "var(--host-error-color)" : "";
1499
+ let i = this.shadowRoot.querySelector("scorad-subjective");
1500
+ i && (i.value = this.value?.subjective ?? SCORAD_SUBJECTIVE_DEFAULT, i.score = t?.B, this.showErrors && (i.errors = getValue(r, "subjective")));
1501
+ let a = this.shadowRoot.querySelector("scorad-intensity");
1502
+ a && (a.value = this.value?.intensity ?? SCORAD_INTENSITY_DEFAULT, a.score = t?.B, this.showErrors && (a.errors = getValue(r, "intensity")));
1503
+ let o = this.shadowRoot.querySelector("scorad-extent");
1504
+ o && (o.child = this.value?.child ?? !1, o.value = this.value?.extent ?? SCORAD_EXTENT_DEFAULT, o.score = t?.A, this.showErrors && (o.errors = getValue(r, "extent")));
1505
+ let s = this.shadowRoot.querySelector("scorad-weightings");
1506
+ s && (s.value = this.value?.child ?? !1);
1438
1507
  }
1439
1508
  render() {
1440
1509
  return html`
1441
- <section>
1442
- <h3>A</h3>
1510
+ <scorad-label id="extent-label">
1511
+ <h3 slot="text">A</h3>
1512
+ <p slot="description">extent - effected surface area</p>
1443
1513
  <scorad-weightings ${(e) => {
1444
1514
  e instanceof HTMLScoradWeightingsElement && e.addEventListener("value-input", (e) => {
1445
1515
  this.value = {
@@ -1448,7 +1518,7 @@ var tag$1 = "scorad-component", HTMLScoradElement = class extends HTMLComponentE
1448
1518
  };
1449
1519
  });
1450
1520
  }}></scorad-weightings>
1451
- <scorad-extent ${(e) => {
1521
+ <scorad-extent tabindex="0" ${(e) => {
1452
1522
  e instanceof HTMLScoradExtentElement && e.addEventListener("value-input", (e) => {
1453
1523
  this.value = {
1454
1524
  ...this.value,
@@ -1456,11 +1526,12 @@ var tag$1 = "scorad-component", HTMLScoradElement = class extends HTMLComponentE
1456
1526
  };
1457
1527
  });
1458
1528
  }}></scorad-extent>
1459
- </section>
1529
+ </scorad-label>
1460
1530
 
1461
- <section>
1462
- <h3>B</h3>
1463
- <scorad-intensity ${(e) => {
1531
+ <scorad-label id="intensity-label">
1532
+ <h3 slot="text">B</h3>
1533
+ <p slot="description">intensity - clinical sign severity</p>
1534
+ <scorad-intensity tabindex="0" ${(e) => {
1464
1535
  e instanceof HTMLScoradIntensityElement && e.addEventListener("value-input", (e) => {
1465
1536
  this.value = {
1466
1537
  ...this.value,
@@ -1468,11 +1539,12 @@ var tag$1 = "scorad-component", HTMLScoradElement = class extends HTMLComponentE
1468
1539
  };
1469
1540
  });
1470
1541
  }}></scorad-intensity>
1471
- </section>
1542
+ </scorad-label>
1472
1543
 
1473
- <section>
1474
- <h3>C</h3>
1475
- <scorad-subjective ${(e) => {
1544
+ <scorad-label id="subjective-label">
1545
+ <h3 slot="text">C</h3>
1546
+ <p slot="description">subjective - patient reported symptoms</p>
1547
+ <scorad-subjective tabindex="0" ${(e) => {
1476
1548
  e instanceof HTMLScoradSubjectiveElement && e.addEventListener("value-input", (e) => {
1477
1549
  this.value = {
1478
1550
  ...this.value,
@@ -1480,11 +1552,22 @@ var tag$1 = "scorad-component", HTMLScoradElement = class extends HTMLComponentE
1480
1552
  };
1481
1553
  });
1482
1554
  }}></scorad-subjective>
1483
- </section>
1555
+ </scorad-label>
1484
1556
 
1485
- <scorad-label
1557
+ <scorad-label id="score-label"
1486
1558
  text="SCORAD"
1487
1559
  description="(A / 5) + (7 * B / 2) + C"
1560
+ ${(e) => {
1561
+ e instanceof HTMLScoradLabelElement && e.addEventListener("click", () => {
1562
+ if (!this.shadowRoot) return;
1563
+ this.showErrors = !0, this.afterRender();
1564
+ let e = this.shadowRoot.querySelector("[has-errors]");
1565
+ e && (e.focus({ preventScroll: !0 }), e.scrollIntoView({
1566
+ behavior: "smooth",
1567
+ block: "start"
1568
+ }));
1569
+ });
1570
+ }}
1488
1571
  >
1489
1572
  <span id="score" tabindex="0"></span>
1490
1573
  </scorad-label>
@@ -1492,32 +1575,9 @@ var tag$1 = "scorad-component", HTMLScoradElement = class extends HTMLComponentE
1492
1575
  }
1493
1576
  };
1494
1577
  __decorate([Watch("value")], HTMLScoradElement.prototype, "afterRender", null), HTMLScoradElement = __decorate([Component({
1495
- tag: tag$1,
1496
- css: [host_default, component_default$1],
1578
+ tag,
1579
+ css: [host_default, component_default],
1497
1580
  delegatesFocus: !0
1498
1581
  })], HTMLScoradElement);
1499
1582
  const componentsScoradLogger = provideLogger("@ntix/components-scorad", typeof ANTIX_COMPONENTS_SCORAD_LOG_LEVEL > "u" ? LogLevel.warn : ANTIX_COMPONENTS_SCORAD_LOG_LEVEL);
1500
- var component_default = ":host{--host-display:inline-flex;--host-options:var(--scorad-label-options,solid 1px currentColor);--host-hover:var(--scorad-label-hover,dashed 2px var(--primary-color));--host-focus:var(--scorad-label-focus,solid 2px var(--primary-color));padding:var(--host-padding-unit);border-radius:var(--host-border-radius-outer);flex-wrap:wrap;align-items:baseline;position:relative}:host(:hover){outline:var(--host-hover)}:host(:focus-within){outline:var(--host-focus)}:host>label>span{transition:all .2s ease-in-out;display:block}:host>label>small{opacity:0;height:0;transition:all .4s ease-in-out;display:block}:host(:hover)>label>span,:host(:focus-within)>label>span{transform:translateY(-.5em)}:host(:hover)>label>small,:host(:focus-within)>label>small{opacity:.667;transform:translateY(-.6em)}:host>label{padding:var(--host-padding-unit);flex:1;padding-left:0}", tag = "scorad-label", HTMLScoradLabelElement = class extends HTMLComponentElement {
1501
- connectedCallback() {
1502
- this.render(), this.addEventListener("mousedown", this._handleClick);
1503
- }
1504
- _handleClick = (e) => {
1505
- this.querySelector(FOCUSABLE)?.focus();
1506
- };
1507
- text = "(label)";
1508
- description;
1509
- render() {
1510
- return html`
1511
- <label>
1512
- <span>${this.text}</span>
1513
- <small>${this.description}</small>
1514
- </label>
1515
- <slot></slot>
1516
- `;
1517
- }
1518
- };
1519
- __decorate([Att({ write: !1 })], HTMLScoradLabelElement.prototype, "text", void 0), __decorate([Att({ write: !1 })], HTMLScoradLabelElement.prototype, "description", void 0), HTMLScoradLabelElement = __decorate([Component({
1520
- tag,
1521
- css: [host_default, component_default]
1522
- })], HTMLScoradLabelElement);
1523
1583
  export { HTMLScoradElement, HTMLScoradExtentElement, HTMLScoradIntensityElement, HTMLScoradLabelElement, HTMLScoradOptionsElement, HTMLScoradSubjectiveElement, HTMLScoradWeightingsElement, SCORAD_ADULT_WEIGHTS, SCORAD_CHILD_WEIGHTS, SCORAD_DEFAULT, SCORAD_EXTENT_DEFAULT, SCORAD_EXTENT_MAX_VALUE, SCORAD_INTENSITY_DEFAULT, SCORAD_INTENSITY_MAX_VALUE, SCORAD_SUBJECTIVE_DEFAULT, SCORAD_SUBJECTIVE_MAX_VALUE, ScoradResources, componentsScoradLogger, getScoradScore, selectScoradWeights, validateScoradData };