@record-evolution/widget-overlay 1.0.7 → 1.0.8
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/widget-overlay.js +15 -14
- package/dist/widget-overlay.js.map +1 -1
- package/package.json +1 -1
- package/src/widget-overlay.ts +2 -1
package/dist/widget-overlay.js
CHANGED
|
@@ -16,7 +16,7 @@ const x = $.ShadyDOM?.inUse && $.ShadyDOM?.noPatch === !0 ? $.ShadyDOM.wrap : (o
|
|
|
16
16
|
}) : void 0, De = (o) => o, Ce = (o, e, t) => De, ue = (o, e, t) => j(), Ne = "$lit$", v = `lit$${Math.random().toFixed(9).slice(2)}$`, Se = "?" + v, Ue = `<${Se}>`, V = document, O = () => V.createComment(""), D = (o) => o === null || typeof o != "object" && typeof o != "function", ie = Array.isArray, Ie = (o) => ie(o) || // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
17
|
typeof o?.[Symbol.iterator] == "function", K = `[
|
|
18
18
|
\f\r]`, ze = `[^
|
|
19
|
-
\f\r"'\`<>=]`, Oe = `[^\\s"'>=/]`, R = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, fe = 1, G = 2, He = 3, ge = /-->/g, _e = />/g, S = new RegExp(`>|${K}(?:(${Oe}+)(${K}*=${K}*(?:${ze}|("|')|))|$)`, "g"), Be = 0, ye = 1, je = 2, $e = 3, Y = /'/g,
|
|
19
|
+
\f\r"'\`<>=]`, Oe = `[^\\s"'>=/]`, R = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, fe = 1, G = 2, He = 3, ge = /-->/g, _e = />/g, S = new RegExp(`>|${K}(?:(${Oe}+)(${K}*=${K}*(?:${ze}|("|')|))|$)`, "g"), Be = 0, ye = 1, je = 2, $e = 3, Y = /'/g, q = /"/g, Ee = /^(?:script|style|textarea|title)$/i, J = 2, ee = 3, se = 1, H = 2, We = 3, Fe = 4, Ke = 5, ne = 6, Ge = 7, N = /* @__PURE__ */ Symbol.for("lit-noChange"), _ = /* @__PURE__ */ Symbol.for("lit-nothing"), be = /* @__PURE__ */ new WeakMap(), A = V.createTreeWalker(
|
|
20
20
|
V,
|
|
21
21
|
129
|
|
22
22
|
/* NodeFilter.SHOW_{ELEMENT|COMMENT} */
|
|
@@ -56,8 +56,8 @@ const Ye = (o, e) => {
|
|
|
56
56
|
Ee.test(l[G]) && (n = new RegExp(`</${l[G]}`, "g")), r = S;
|
|
57
57
|
else if (l[He] !== void 0)
|
|
58
58
|
throw new Error("Bindings in tag names are not supported. Please use static templates instead. See https://lit.dev/docs/templates/expressions/#static-expressions");
|
|
59
|
-
} else r === S ? l[Be] === ">" ? (r = n ?? R, f = -1) : l[ye] === void 0 ? f = -2 : (f = r.lastIndex - l[je].length, m = l[ye], r = l[$e] === void 0 ? S : l[$e] === '"' ?
|
|
60
|
-
console.assert(f === -1 || r === S || r === Y || r ===
|
|
59
|
+
} else r === S ? l[Be] === ">" ? (r = n ?? R, f = -1) : l[ye] === void 0 ? f = -2 : (f = r.lastIndex - l[je].length, m = l[ye], r = l[$e] === void 0 ? S : l[$e] === '"' ? q : Y) : r === q || r === Y ? r = S : r === ge || r === _e ? r = R : (r = S, n = void 0);
|
|
60
|
+
console.assert(f === -1 || r === S || r === Y || r === q, "unexpected parse state B");
|
|
61
61
|
const p = r === S && o[a + 1].startsWith("/>") ? " " : "";
|
|
62
62
|
s += r === R ? c + Ue : f >= 0 ? (i.push(m), c.slice(0, f) + Ne + c.slice(f) + v + p) : c + v + (f === -2 ? a : p);
|
|
63
63
|
}
|
|
@@ -93,7 +93,7 @@ class U {
|
|
|
93
93
|
index: n,
|
|
94
94
|
name: g[2],
|
|
95
95
|
strings: p,
|
|
96
|
-
ctor: g[1] === "." ?
|
|
96
|
+
ctor: g[1] === "." ? Ze : g[1] === "?" ? Qe : g[1] === "@" ? Xe : W
|
|
97
97
|
}), s.removeAttribute(m);
|
|
98
98
|
} else m.startsWith(v) && (a.push({
|
|
99
99
|
type: ne,
|
|
@@ -145,7 +145,7 @@ function L(o, e, t = o, i) {
|
|
|
145
145
|
);
|
|
146
146
|
return s?.constructor !== n && (s?._$notifyDirectiveConnectionChanged?.(!1), n === void 0 ? s = void 0 : (s = new n(o), s._$initialize(o, t, i)), i !== void 0 ? (t.__directives ??= [])[i] = s : t.__directive = s), s !== void 0 && (e = L(o, s._$resolve(o, e.values), s, i)), e;
|
|
147
147
|
}
|
|
148
|
-
class
|
|
148
|
+
class qe {
|
|
149
149
|
constructor(e, t) {
|
|
150
150
|
this._$parts = [], this._$disconnectableChildren = void 0, this._$template = e, this._$parent = t;
|
|
151
151
|
}
|
|
@@ -304,7 +304,7 @@ let oe = class Ve {
|
|
|
304
304
|
values: t
|
|
305
305
|
}), this._$committedValue._update(t);
|
|
306
306
|
else {
|
|
307
|
-
const n = new
|
|
307
|
+
const n = new qe(s, this), r = n._clone(this.options);
|
|
308
308
|
u && u({
|
|
309
309
|
kind: "template instantiated",
|
|
310
310
|
template: s,
|
|
@@ -427,7 +427,7 @@ class W {
|
|
|
427
427
|
}), x(this.element).setAttribute(this.name, e ?? ""));
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
|
-
class
|
|
430
|
+
class Ze extends W {
|
|
431
431
|
constructor() {
|
|
432
432
|
super(...arguments), this.type = We;
|
|
433
433
|
}
|
|
@@ -565,7 +565,7 @@ class st extends le {
|
|
|
565
565
|
return N;
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
|
-
const
|
|
568
|
+
const Z = ae(st);
|
|
569
569
|
const nt = 1;
|
|
570
570
|
class de extends le {
|
|
571
571
|
constructor(e) {
|
|
@@ -768,7 +768,7 @@ var ut = Object.defineProperty, C = (o, e, t, i) => {
|
|
|
768
768
|
};
|
|
769
769
|
const he = class he extends Te {
|
|
770
770
|
constructor() {
|
|
771
|
-
super(), this.version = "1.0.
|
|
771
|
+
super(), this.version = "1.0.8", this.getModifier = this.getModifier.bind(this);
|
|
772
772
|
}
|
|
773
773
|
update(e) {
|
|
774
774
|
e.has("inputData") && (this.transform(), this.modifier || this.getModifier()), e.has("theme") && this.registerTheme(this.theme), super.update(e);
|
|
@@ -879,7 +879,7 @@ const he = class he extends Te {
|
|
|
879
879
|
padding: `${6 * i.scaler}px ${12 * i.scaler}px`
|
|
880
880
|
};
|
|
881
881
|
return y`
|
|
882
|
-
<div class="overlay-item" style=${
|
|
882
|
+
<div class="overlay-item" style=${Z(f)}>${t.prefix}${h}${t.suffix}</div>
|
|
883
883
|
`;
|
|
884
884
|
}
|
|
885
885
|
renderProgress(e, t, i) {
|
|
@@ -897,7 +897,7 @@ const he = class he extends Te {
|
|
|
897
897
|
top: `${n.top}px`
|
|
898
898
|
}, c = Number(t.data), f = s.sections ?? {}, m = Math.min(...f.sectionLimits.map(Number)), d = Math.max(...f.sectionLimits.map(Number));
|
|
899
899
|
let l = d === m ? 0 : (c - m) / (d - m);
|
|
900
|
-
return l = Math.min(1, Math.max(0, l)), y` <linear-progress .value=${l} style=${
|
|
900
|
+
return l = Math.min(1, Math.max(0, l)), y` <linear-progress .value=${l} style=${Z(a)}></linear-progress> `;
|
|
901
901
|
}
|
|
902
902
|
renderLayer(e) {
|
|
903
903
|
const t = this.modifier;
|
|
@@ -910,7 +910,7 @@ const he = class he extends Te {
|
|
|
910
910
|
};
|
|
911
911
|
return y`<div
|
|
912
912
|
class="overlay"
|
|
913
|
-
style=${
|
|
913
|
+
style=${Z(i)}
|
|
914
914
|
type="${e.layerType}"
|
|
915
915
|
name="${e.layerName}"
|
|
916
916
|
>
|
|
@@ -973,6 +973,7 @@ he.styles = ve`
|
|
|
973
973
|
font-family: sans-serif;
|
|
974
974
|
box-sizing: border-box;
|
|
975
975
|
margin: auto;
|
|
976
|
+
container-type: size;
|
|
976
977
|
}
|
|
977
978
|
|
|
978
979
|
.paging:not([active]) {
|
|
@@ -984,7 +985,7 @@ he.styles = ve`
|
|
|
984
985
|
flex-direction: column;
|
|
985
986
|
height: 100%;
|
|
986
987
|
width: 100%;
|
|
987
|
-
padding:
|
|
988
|
+
padding: 2cqh 2cqw;
|
|
988
989
|
box-sizing: border-box;
|
|
989
990
|
}
|
|
990
991
|
|
|
@@ -1078,7 +1079,7 @@ C([
|
|
|
1078
1079
|
C([
|
|
1079
1080
|
ke("#base-layer")
|
|
1080
1081
|
], b.prototype, "baseLayer");
|
|
1081
|
-
window.customElements.define("widget-overlay-1.0.
|
|
1082
|
+
window.customElements.define("widget-overlay-1.0.8", b);
|
|
1082
1083
|
export {
|
|
1083
1084
|
b as WidgetImage
|
|
1084
1085
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget-overlay.js","sources":["../node_modules/lit-html/development/lit-html.js","../node_modules/lit-html/development/directive.js","../node_modules/lit-html/development/directives/style-map.js","../node_modules/lit-html/development/directives/unsafe-html.js","../node_modules/lit-html/development/directives/unsafe-svg.js","../node_modules/lit-html/development/directive-helpers.js","../node_modules/lit-html/development/directives/repeat.js","../src/linear-progress.ts","../src/widget-overlay.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst DEV_MODE = true;\nconst ENABLE_EXTRA_SECURITY_HOOKS = true;\nconst ENABLE_SHADYDOM_NOPATCH = true;\nconst NODE_MODE = false;\n// Allows minifiers to rename references to globalThis\nconst global = globalThis;\n/**\n * Useful for visualizing and logging insights into what the Lit template system is doing.\n *\n * Compiled out of prod mode builds.\n */\nconst debugLogEvent = DEV_MODE\n ? (event) => {\n const shouldEmit = global\n .emitLitDebugLogEvents;\n if (!shouldEmit) {\n return;\n }\n global.dispatchEvent(new CustomEvent('lit-debug', {\n detail: event,\n }));\n }\n : undefined;\n// Used for connecting beginRender and endRender events when there are nested\n// renders when errors are thrown preventing an endRender event from being\n// called.\nlet debugLogRenderId = 0;\nlet issueWarning;\nif (DEV_MODE) {\n global.litIssuedWarnings ??= new Set();\n /**\n * Issue a warning if we haven't already, based either on `code` or `warning`.\n * Warnings are disabled automatically only by `warning`; disabling via `code`\n * can be done by users.\n */\n issueWarning = (code, warning) => {\n warning += code\n ? ` See https://lit.dev/msg/${code} for more information.`\n : '';\n if (!global.litIssuedWarnings.has(warning) &&\n !global.litIssuedWarnings.has(code)) {\n console.warn(warning);\n global.litIssuedWarnings.add(warning);\n }\n };\n queueMicrotask(() => {\n issueWarning('dev-mode', `Lit is in dev mode. Not recommended for production!`);\n });\n}\nconst wrap = ENABLE_SHADYDOM_NOPATCH &&\n global.ShadyDOM?.inUse &&\n global.ShadyDOM?.noPatch === true\n ? global.ShadyDOM.wrap\n : (node) => node;\nconst trustedTypes = global.trustedTypes;\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = trustedTypes\n ? trustedTypes.createPolicy('lit-html', {\n createHTML: (s) => s,\n })\n : undefined;\nconst identityFunction = (value) => value;\nconst noopSanitizer = (_node, _name, _type) => identityFunction;\n/** Sets the global sanitizer factory. */\nconst setSanitizer = (newSanitizer) => {\n if (!ENABLE_EXTRA_SECURITY_HOOKS) {\n return;\n }\n if (sanitizerFactoryInternal !== noopSanitizer) {\n throw new Error(`Attempted to overwrite existing lit-html security policy.` +\n ` setSanitizeDOMValueFactory should be called at most once.`);\n }\n sanitizerFactoryInternal = newSanitizer;\n};\n/**\n * Only used in internal tests, not a part of the public API.\n */\nconst _testOnlyClearSanitizerFactoryDoNotCallOrElse = () => {\n sanitizerFactoryInternal = noopSanitizer;\n};\nconst createSanitizer = (node, name, type) => {\n return sanitizerFactoryInternal(node, name, type);\n};\n// Added to an attribute name to mark the attribute as bound so we can find\n// it easily.\nconst boundAttributeSuffix = '$lit$';\n// This marker is used in many syntactic positions in HTML, so it must be\n// a valid element name and attribute name. We don't support dynamic names (yet)\n// but this at least ensures that the parse tree is closer to the template\n// intention.\nconst marker = `lit$${Math.random().toFixed(9).slice(2)}$`;\n// String used to tell if a comment is a marker comment\nconst markerMatch = '?' + marker;\n// Text used to insert a comment marker node. We use processing instruction\n// syntax because it's slightly smaller, but parses as a comment node.\nconst nodeMarker = `<${markerMatch}>`;\nconst d = NODE_MODE && global.document === undefined\n ? {\n createTreeWalker() {\n return {};\n },\n }\n : document;\n// Creates a dynamic marker. We never have to search for these in the DOM.\nconst createMarker = () => d.createComment('');\nconst isPrimitive = (value) => value === null || (typeof value != 'object' && typeof value != 'function');\nconst isArray = Array.isArray;\nconst isIterable = (value) => isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n typeof value?.[Symbol.iterator] === 'function';\nconst SPACE_CHAR = `[ \\t\\n\\f\\r]`;\nconst ATTR_VALUE_CHAR = `[^ \\t\\n\\f\\r\"'\\`<>=]`;\nconst NAME_CHAR = `[^\\\\s\"'>=/]`;\n// These regexes represent the five parsing states that we care about in the\n// Template's HTML scanner. They match the *end* of the state they're named\n// after.\n// Depending on the match, we transition to a new state. If there's no match,\n// we stay in the same state.\n// Note that the regexes are stateful. We utilize lastIndex and sync it\n// across the multiple regexes used. In addition to the five regexes below\n// we also dynamically create a regex to find the matching end tags for raw\n// text elements.\n/**\n * End of text is: `<` followed by:\n * (comment start) or (tag) or (dynamic tag binding)\n */\nconst textEndRegex = /<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g;\nconst COMMENT_START = 1;\nconst TAG_NAME = 2;\nconst DYNAMIC_TAG_NAME = 3;\nconst commentEndRegex = /-->/g;\n/**\n * Comments not started with <!--, like </{, can be ended by a single `>`\n */\nconst comment2EndRegex = />/g;\n/**\n * The tagEnd regex matches the end of the \"inside an opening\" tag syntax\n * position. It either matches a `>`, an attribute-like sequence, or the end\n * of the string after a space (attribute-name position ending).\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\t\\n\\f\\r\" are HTML space characters:\n * https://infra.spec.whatwg.org/#ascii-whitespace\n *\n * So an attribute is:\n * * The name: any character except a whitespace character, (\"), ('), \">\",\n * \"=\", or \"/\". Note: this is different from the HTML spec which also excludes control characters.\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nconst tagEndRegex = new RegExp(`>|${SPACE_CHAR}(?:(${NAME_CHAR}+)(${SPACE_CHAR}*=${SPACE_CHAR}*(?:${ATTR_VALUE_CHAR}|(\"|')|))|$)`, 'g');\nconst ENTIRE_MATCH = 0;\nconst ATTRIBUTE_NAME = 1;\nconst SPACES_AND_EQUALS = 2;\nconst QUOTE_CHAR = 3;\nconst singleQuoteAttrEndRegex = /'/g;\nconst doubleQuoteAttrEndRegex = /\"/g;\n/**\n * Matches the raw text elements.\n *\n * Comments are not parsed within raw text elements, so we need to search their\n * text content for marker strings.\n */\nconst rawTextElement = /^(?:script|style|textarea|title)$/i;\n/** TemplateResult types */\nconst HTML_RESULT = 1;\nconst SVG_RESULT = 2;\nconst MATHML_RESULT = 3;\n// TemplatePart types\n// IMPORTANT: these must match the values in PartType\nconst ATTRIBUTE_PART = 1;\nconst CHILD_PART = 2;\nconst PROPERTY_PART = 3;\nconst BOOLEAN_ATTRIBUTE_PART = 4;\nconst EVENT_PART = 5;\nconst ELEMENT_PART = 6;\nconst COMMENT_PART = 7;\n/**\n * Generates a template literal tag function that returns a TemplateResult with\n * the given result type.\n */\nconst tag = (type) => (strings, ...values) => {\n // Warn against templates octal escape sequences\n // We do this here rather than in render so that the warning is closer to the\n // template definition.\n if (DEV_MODE && strings.some((s) => s === undefined)) {\n console.warn('Some template strings are undefined.\\n' +\n 'This is probably caused by illegal octal escape sequences.');\n }\n if (DEV_MODE) {\n // Import static-html.js results in a circular dependency which g3 doesn't\n // handle. Instead we know that static values must have the field\n // `_$litStatic$`.\n if (values.some((val) => val?.['_$litStatic$'])) {\n issueWarning('', `Static values 'literal' or 'unsafeStatic' cannot be used as values to non-static templates.\\n` +\n `Please use the static 'html' tag function. See https://lit.dev/docs/templates/expressions/#static-expressions`);\n }\n }\n return {\n // This property needs to remain unminified.\n ['_$litType$']: type,\n strings,\n values,\n };\n};\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n *\n * ```ts\n * const header = (title: string) => html`<h1>${title}</h1>`;\n * ```\n *\n * The `html` tag returns a description of the DOM to render as a value. It is\n * lazy, meaning no work is done until the template is rendered. When rendering,\n * if a template comes from the same expression as a previously rendered result,\n * it's efficiently updated instead of replaced.\n */\nexport const html = tag(HTML_RESULT);\n/**\n * Interprets a template literal as an SVG fragment that can efficiently render\n * to and update a container.\n *\n * ```ts\n * const rect = svg`<rect width=\"10\" height=\"10\"></rect>`;\n *\n * const myImage = html`\n * <svg viewBox=\"0 0 10 10\" xmlns=\"http://www.w3.org/2000/svg\">\n * ${rect}\n * </svg>`;\n * ```\n *\n * The `svg` *tag function* should only be used for SVG fragments, or elements\n * that would be contained **inside** an `<svg>` HTML element. A common error is\n * placing an `<svg>` *element* in a template tagged with the `svg` tag\n * function. The `<svg>` element is an HTML element and should be used within a\n * template tagged with the {@linkcode html} tag function.\n *\n * In LitElement usage, it's invalid to return an SVG fragment from the\n * `render()` method, as the SVG fragment will be contained within the element's\n * shadow root and thus not be properly contained within an `<svg>` HTML\n * element.\n */\nexport const svg = tag(SVG_RESULT);\n/**\n * Interprets a template literal as MathML fragment that can efficiently render\n * to and update a container.\n *\n * ```ts\n * const num = mathml`<mn>1</mn>`;\n *\n * const eq = html`\n * <math>\n * ${num}\n * </math>`;\n * ```\n *\n * The `mathml` *tag function* should only be used for MathML fragments, or\n * elements that would be contained **inside** a `<math>` HTML element. A common\n * error is placing a `<math>` *element* in a template tagged with the `mathml`\n * tag function. The `<math>` element is an HTML element and should be used\n * within a template tagged with the {@linkcode html} tag function.\n *\n * In LitElement usage, it's invalid to return an MathML fragment from the\n * `render()` method, as the MathML fragment will be contained within the\n * element's shadow root and thus not be properly contained within a `<math>`\n * HTML element.\n */\nexport const mathml = tag(MATHML_RESULT);\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = Symbol.for('lit-noChange');\n/**\n * A sentinel value that signals a ChildPart to fully clear its content.\n *\n * ```ts\n * const button = html`${\n * user.isAdmin\n * ? html`<button>DELETE</button>`\n * : nothing\n * }`;\n * ```\n *\n * Prefer using `nothing` over other falsy values as it provides a consistent\n * behavior between various expression binding contexts.\n *\n * In child expressions, `undefined`, `null`, `''`, and `nothing` all behave the\n * same and render no nodes. In attribute expressions, `nothing` _removes_ the\n * attribute, while `undefined` and `null` will render an empty string. In\n * property expressions `nothing` becomes `undefined`.\n */\nexport const nothing = Symbol.for('lit-nothing');\n/**\n * The cache of prepared templates, keyed by the tagged TemplateStringsArray\n * and _not_ accounting for the specific template tag used. This means that\n * template tags cannot be dynamic - they must statically be one of html, svg,\n * or attr. This restriction simplifies the cache lookup, which is on the hot\n * path for rendering.\n */\nconst templateCache = new WeakMap();\nconst walker = d.createTreeWalker(d, 129 /* NodeFilter.SHOW_{ELEMENT|COMMENT} */);\nlet sanitizerFactoryInternal = noopSanitizer;\nfunction trustFromTemplateString(tsa, stringFromTSA) {\n // A security check to prevent spoofing of Lit template results.\n // In the future, we may be able to replace this with Array.isTemplateObject,\n // though we might need to make that check inside of the html and svg\n // functions, because precompiled templates don't come in as\n // TemplateStringArray objects.\n if (!isArray(tsa) || !tsa.hasOwnProperty('raw')) {\n let message = 'invalid template strings array';\n if (DEV_MODE) {\n message = `\n Internal Error: expected template strings to be an array\n with a 'raw' field. Faking a template strings array by\n calling html or svg like an ordinary function is effectively\n the same as calling unsafeHtml and can lead to major security\n issues, e.g. opening your code up to XSS attacks.\n If you're using the html or svg tagged template functions normally\n and still seeing this error, please file a bug at\n https://github.com/lit/lit/issues/new?template=bug_report.md\n and include information about your build tooling, if any.\n `\n .trim()\n .replace(/\\n */g, '\\n');\n }\n throw new Error(message);\n }\n return policy !== undefined\n ? policy.createHTML(stringFromTSA)\n : stringFromTSA;\n}\n/**\n * Returns an HTML string for the given TemplateStringsArray and result type\n * (HTML or SVG), along with the case-sensitive bound attribute names in\n * template order. The HTML contains comment markers denoting the `ChildPart`s\n * and suffixes on bound attributes denoting the `AttributeParts`.\n *\n * @param strings template strings array\n * @param type HTML or SVG\n * @return Array containing `[html, attrNames]` (array returned for terseness,\n * to avoid object fields since this code is shared with non-minified SSR\n * code)\n */\nconst getTemplateHtml = (strings, type) => {\n // Insert makers into the template HTML to represent the position of\n // bindings. The following code scans the template strings to determine the\n // syntactic position of the bindings. They can be in text position, where\n // we insert an HTML comment, attribute value position, where we insert a\n // sentinel string and re-write the attribute name, or inside a tag where\n // we insert the sentinel string.\n const l = strings.length - 1;\n // Stores the case-sensitive bound attribute names in the order of their\n // parts. ElementParts are also reflected in this array as undefined\n // rather than a string, to disambiguate from attribute bindings.\n const attrNames = [];\n let html = type === SVG_RESULT ? '<svg>' : type === MATHML_RESULT ? '<math>' : '';\n // When we're inside a raw text tag (not it's text content), the regex\n // will still be tagRegex so we can find attributes, but will switch to\n // this regex when the tag ends.\n let rawTextEndRegex;\n // The current parsing state, represented as a reference to one of the\n // regexes\n let regex = textEndRegex;\n for (let i = 0; i < l; i++) {\n const s = strings[i];\n // The index of the end of the last attribute name. When this is\n // positive at end of a string, it means we're in an attribute value\n // position and need to rewrite the attribute name.\n // We also use a special value of -2 to indicate that we encountered\n // the end of a string in attribute name position.\n let attrNameEndIndex = -1;\n let attrName;\n let lastIndex = 0;\n let match;\n // The conditions in this loop handle the current parse state, and the\n // assignments to the `regex` variable are the state transitions.\n while (lastIndex < s.length) {\n // Make sure we start searching from where we previously left off\n regex.lastIndex = lastIndex;\n match = regex.exec(s);\n if (match === null) {\n break;\n }\n lastIndex = regex.lastIndex;\n if (regex === textEndRegex) {\n if (match[COMMENT_START] === '!--') {\n regex = commentEndRegex;\n }\n else if (match[COMMENT_START] !== undefined) {\n // We started a weird comment, like </{\n regex = comment2EndRegex;\n }\n else if (match[TAG_NAME] !== undefined) {\n if (rawTextElement.test(match[TAG_NAME])) {\n // Record if we encounter a raw-text element. We'll switch to\n // this regex at the end of the tag.\n rawTextEndRegex = new RegExp(`</${match[TAG_NAME]}`, 'g');\n }\n regex = tagEndRegex;\n }\n else if (match[DYNAMIC_TAG_NAME] !== undefined) {\n if (DEV_MODE) {\n throw new Error('Bindings in tag names are not supported. Please use static templates instead. ' +\n 'See https://lit.dev/docs/templates/expressions/#static-expressions');\n }\n regex = tagEndRegex;\n }\n }\n else if (regex === tagEndRegex) {\n if (match[ENTIRE_MATCH] === '>') {\n // End of a tag. If we had started a raw-text element, use that\n // regex\n regex = rawTextEndRegex ?? textEndRegex;\n // We may be ending an unquoted attribute value, so make sure we\n // clear any pending attrNameEndIndex\n attrNameEndIndex = -1;\n }\n else if (match[ATTRIBUTE_NAME] === undefined) {\n // Attribute name position\n attrNameEndIndex = -2;\n }\n else {\n attrNameEndIndex = regex.lastIndex - match[SPACES_AND_EQUALS].length;\n attrName = match[ATTRIBUTE_NAME];\n regex =\n match[QUOTE_CHAR] === undefined\n ? tagEndRegex\n : match[QUOTE_CHAR] === '\"'\n ? doubleQuoteAttrEndRegex\n : singleQuoteAttrEndRegex;\n }\n }\n else if (regex === doubleQuoteAttrEndRegex ||\n regex === singleQuoteAttrEndRegex) {\n regex = tagEndRegex;\n }\n else if (regex === commentEndRegex || regex === comment2EndRegex) {\n regex = textEndRegex;\n }\n else {\n // Not one of the five state regexes, so it must be the dynamically\n // created raw text regex and we're at the close of that element.\n regex = tagEndRegex;\n rawTextEndRegex = undefined;\n }\n }\n if (DEV_MODE) {\n // If we have a attrNameEndIndex, which indicates that we should\n // rewrite the attribute name, assert that we're in a valid attribute\n // position - either in a tag, or a quoted attribute value.\n console.assert(attrNameEndIndex === -1 ||\n regex === tagEndRegex ||\n regex === singleQuoteAttrEndRegex ||\n regex === doubleQuoteAttrEndRegex, 'unexpected parse state B');\n }\n // We have four cases:\n // 1. We're in text position, and not in a raw text element\n // (regex === textEndRegex): insert a comment marker.\n // 2. We have a non-negative attrNameEndIndex which means we need to\n // rewrite the attribute name to add a bound attribute suffix.\n // 3. We're at the non-first binding in a multi-binding attribute, use a\n // plain marker.\n // 4. We're somewhere else inside the tag. If we're in attribute name\n // position (attrNameEndIndex === -2), add a sequential suffix to\n // generate a unique attribute name.\n // Detect a binding next to self-closing tag end and insert a space to\n // separate the marker from the tag end:\n const end = regex === tagEndRegex && strings[i + 1].startsWith('/>') ? ' ' : '';\n html +=\n regex === textEndRegex\n ? s + nodeMarker\n : attrNameEndIndex >= 0\n ? (attrNames.push(attrName),\n s.slice(0, attrNameEndIndex) +\n boundAttributeSuffix +\n s.slice(attrNameEndIndex)) +\n marker +\n end\n : s + marker + (attrNameEndIndex === -2 ? i : end);\n }\n const htmlResult = html +\n (strings[l] || '<?>') +\n (type === SVG_RESULT ? '</svg>' : type === MATHML_RESULT ? '</math>' : '');\n // Returned as an array for terseness\n return [trustFromTemplateString(strings, htmlResult), attrNames];\n};\nclass Template {\n constructor(\n // This property needs to remain unminified.\n { strings, ['_$litType$']: type }, options) {\n this.parts = [];\n let node;\n let nodeIndex = 0;\n let attrNameIndex = 0;\n const partCount = strings.length - 1;\n const parts = this.parts;\n // Create template element\n const [html, attrNames] = getTemplateHtml(strings, type);\n this.el = Template.createElement(html, options);\n walker.currentNode = this.el.content;\n // Re-parent SVG or MathML nodes into template root\n if (type === SVG_RESULT || type === MATHML_RESULT) {\n const wrapper = this.el.content.firstChild;\n wrapper.replaceWith(...wrapper.childNodes);\n }\n // Walk the template to find binding markers and create TemplateParts\n while ((node = walker.nextNode()) !== null && parts.length < partCount) {\n if (node.nodeType === 1) {\n if (DEV_MODE) {\n const tag = node.localName;\n // Warn if `textarea` includes an expression and throw if `template`\n // does since these are not supported. We do this by checking\n // innerHTML for anything that looks like a marker. This catches\n // cases like bindings in textarea there markers turn into text nodes.\n if (/^(?:textarea|template)$/i.test(tag) &&\n node.innerHTML.includes(marker)) {\n const m = `Expressions are not supported inside \\`${tag}\\` ` +\n `elements. See https://lit.dev/msg/expression-in-${tag} for more ` +\n `information.`;\n if (tag === 'template') {\n throw new Error(m);\n }\n else\n issueWarning('', m);\n }\n }\n // TODO (justinfagnani): for attempted dynamic tag names, we don't\n // increment the bindingIndex, and it'll be off by 1 in the element\n // and off by two after it.\n if (node.hasAttributes()) {\n for (const name of node.getAttributeNames()) {\n if (name.endsWith(boundAttributeSuffix)) {\n const realName = attrNames[attrNameIndex++];\n const value = node.getAttribute(name);\n const statics = value.split(marker);\n const m = /([.?@])?(.*)/.exec(realName);\n parts.push({\n type: ATTRIBUTE_PART,\n index: nodeIndex,\n name: m[2],\n strings: statics,\n ctor: m[1] === '.'\n ? PropertyPart\n : m[1] === '?'\n ? BooleanAttributePart\n : m[1] === '@'\n ? EventPart\n : AttributePart,\n });\n node.removeAttribute(name);\n }\n else if (name.startsWith(marker)) {\n parts.push({\n type: ELEMENT_PART,\n index: nodeIndex,\n });\n node.removeAttribute(name);\n }\n }\n }\n // TODO (justinfagnani): benchmark the regex against testing for each\n // of the 3 raw text element names.\n if (rawTextElement.test(node.tagName)) {\n // For raw text elements we need to split the text content on\n // markers, create a Text node for each segment, and create\n // a TemplatePart for each marker.\n const strings = node.textContent.split(marker);\n const lastIndex = strings.length - 1;\n if (lastIndex > 0) {\n node.textContent = trustedTypes\n ? trustedTypes.emptyScript\n : '';\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for child parts\n for (let i = 0; i < lastIndex; i++) {\n node.append(strings[i], createMarker());\n // Walk past the marker node we just added\n walker.nextNode();\n parts.push({ type: CHILD_PART, index: ++nodeIndex });\n }\n // Note because this marker is added after the walker's current\n // node, it will be walked to in the outer loop (and ignored), so\n // we don't need to adjust nodeIndex here\n node.append(strings[lastIndex], createMarker());\n }\n }\n }\n else if (node.nodeType === 8) {\n const data = node.data;\n if (data === markerMatch) {\n parts.push({ type: CHILD_PART, index: nodeIndex });\n }\n else {\n let i = -1;\n while ((i = node.data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n parts.push({ type: COMMENT_PART, index: nodeIndex });\n // Move to the end of the match\n i += marker.length - 1;\n }\n }\n }\n nodeIndex++;\n }\n if (DEV_MODE) {\n // If there was a duplicate attribute on a tag, then when the tag is\n // parsed into an element the attribute gets de-duplicated. We can detect\n // this mismatch if we haven't precisely consumed every attribute name\n // when preparing the template. This works because `attrNames` is built\n // from the template string and `attrNameIndex` comes from processing the\n // resulting DOM.\n if (attrNames.length !== attrNameIndex) {\n throw new Error(`Detected duplicate attribute bindings. This occurs if your template ` +\n `has duplicate attributes on an element tag. For example ` +\n `\"<input ?disabled=\\${true} ?disabled=\\${false}>\" contains a ` +\n `duplicate \"disabled\" attribute. The error was detected in ` +\n `the following template: \\n` +\n '`' +\n strings.join('${...}') +\n '`');\n }\n }\n // We could set walker.currentNode to another node here to prevent a memory\n // leak, but every time we prepare a template, we immediately render it\n // and re-use the walker in new TemplateInstance._clone().\n debugLogEvent &&\n debugLogEvent({\n kind: 'template prep',\n template: this,\n clonableTemplate: this.el,\n parts: this.parts,\n strings,\n });\n }\n // Overridden via `litHtmlPolyfillSupport` to provide platform support.\n /** @nocollapse */\n static createElement(html, _options) {\n const el = d.createElement('template');\n el.innerHTML = html;\n return el;\n }\n}\nfunction resolveDirective(part, value, parent = part, attributeIndex) {\n // Bail early if the value is explicitly noChange. Note, this means any\n // nested directive is still attached and is not run.\n if (value === noChange) {\n return value;\n }\n let currentDirective = attributeIndex !== undefined\n ? parent.__directives?.[attributeIndex]\n : parent.__directive;\n const nextDirectiveConstructor = isPrimitive(value)\n ? undefined\n : // This property needs to remain unminified.\n value['_$litDirective$'];\n if (currentDirective?.constructor !== nextDirectiveConstructor) {\n // This property needs to remain unminified.\n currentDirective?.['_$notifyDirectiveConnectionChanged']?.(false);\n if (nextDirectiveConstructor === undefined) {\n currentDirective = undefined;\n }\n else {\n currentDirective = new nextDirectiveConstructor(part);\n currentDirective._$initialize(part, parent, attributeIndex);\n }\n if (attributeIndex !== undefined) {\n (parent.__directives ??= [])[attributeIndex] =\n currentDirective;\n }\n else {\n parent.__directive = currentDirective;\n }\n }\n if (currentDirective !== undefined) {\n value = resolveDirective(part, currentDirective._$resolve(part, value.values), currentDirective, attributeIndex);\n }\n return value;\n}\n/**\n * An updateable instance of a Template. Holds references to the Parts used to\n * update the template instance.\n */\nclass TemplateInstance {\n constructor(template, parent) {\n this._$parts = [];\n /** @internal */\n this._$disconnectableChildren = undefined;\n this._$template = template;\n this._$parent = parent;\n }\n // Called by ChildPart parentNode getter\n get parentNode() {\n return this._$parent.parentNode;\n }\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n // This method is separate from the constructor because we need to return a\n // DocumentFragment and we don't want to hold onto it with an instance field.\n _clone(options) {\n const { el: { content }, parts: parts, } = this._$template;\n const fragment = (options?.creationScope ?? d).importNode(content, true);\n walker.currentNode = fragment;\n let node = walker.nextNode();\n let nodeIndex = 0;\n let partIndex = 0;\n let templatePart = parts[0];\n while (templatePart !== undefined) {\n if (nodeIndex === templatePart.index) {\n let part;\n if (templatePart.type === CHILD_PART) {\n part = new ChildPart(node, node.nextSibling, this, options);\n }\n else if (templatePart.type === ATTRIBUTE_PART) {\n part = new templatePart.ctor(node, templatePart.name, templatePart.strings, this, options);\n }\n else if (templatePart.type === ELEMENT_PART) {\n part = new ElementPart(node, this, options);\n }\n this._$parts.push(part);\n templatePart = parts[++partIndex];\n }\n if (nodeIndex !== templatePart?.index) {\n node = walker.nextNode();\n nodeIndex++;\n }\n }\n // We need to set the currentNode away from the cloned tree so that we\n // don't hold onto the tree even if the tree is detached and should be\n // freed.\n walker.currentNode = d;\n return fragment;\n }\n _update(values) {\n let i = 0;\n for (const part of this._$parts) {\n if (part !== undefined) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'set part',\n part,\n value: values[i],\n valueIndex: i,\n values,\n templateInstance: this,\n });\n if (part.strings !== undefined) {\n part._$setValue(values, part, i);\n // The number of values the part consumes is part.strings.length - 1\n // since values are in between template spans. We increment i by 1\n // later in the loop, so increment it by part.strings.length - 2 here\n i += part.strings.length - 2;\n }\n else {\n part._$setValue(values[i]);\n }\n }\n i++;\n }\n }\n}\nclass ChildPart {\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n // ChildParts that are not at the root should always be created with a\n // parent; only RootChildNode's won't, so they return the local isConnected\n // state\n return this._$parent?._$isConnected ?? this.__isConnected;\n }\n constructor(startNode, endNode, parent, options) {\n this.type = CHILD_PART;\n this._$committedValue = nothing;\n // The following fields will be patched onto ChildParts when required by\n // AsyncDirective\n /** @internal */\n this._$disconnectableChildren = undefined;\n this._$startNode = startNode;\n this._$endNode = endNode;\n this._$parent = parent;\n this.options = options;\n // Note __isConnected is only ever accessed on RootParts (i.e. when there is\n // no _$parent); the value on a non-root-part is \"don't care\", but checking\n // for parent would be more code\n this.__isConnected = options?.isConnected ?? true;\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n // Explicitly initialize for consistent class shape.\n this._textSanitizer = undefined;\n }\n }\n /**\n * The parent node into which the part renders its content.\n *\n * A ChildPart's content consists of a range of adjacent child nodes of\n * `.parentNode`, possibly bordered by 'marker nodes' (`.startNode` and\n * `.endNode`).\n *\n * - If both `.startNode` and `.endNode` are non-null, then the part's content\n * consists of all siblings between `.startNode` and `.endNode`, exclusively.\n *\n * - If `.startNode` is non-null but `.endNode` is null, then the part's\n * content consists of all siblings following `.startNode`, up to and\n * including the last child of `.parentNode`. If `.endNode` is non-null, then\n * `.startNode` will always be non-null.\n *\n * - If both `.endNode` and `.startNode` are null, then the part's content\n * consists of all child nodes of `.parentNode`.\n */\n get parentNode() {\n let parentNode = wrap(this._$startNode).parentNode;\n const parent = this._$parent;\n if (parent !== undefined &&\n parentNode?.nodeType === 11 /* Node.DOCUMENT_FRAGMENT */) {\n // If the parentNode is a DocumentFragment, it may be because the DOM is\n // still in the cloned fragment during initial render; if so, get the real\n // parentNode the part will be committed into by asking the parent.\n parentNode = parent.parentNode;\n }\n return parentNode;\n }\n /**\n * The part's leading marker node, if any. See `.parentNode` for more\n * information.\n */\n get startNode() {\n return this._$startNode;\n }\n /**\n * The part's trailing marker node, if any. See `.parentNode` for more\n * information.\n */\n get endNode() {\n return this._$endNode;\n }\n _$setValue(value, directiveParent = this) {\n if (DEV_MODE && this.parentNode === null) {\n throw new Error(`This \\`ChildPart\\` has no \\`parentNode\\` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's \\`innerHTML\\` or \\`textContent\\` can do this.`);\n }\n value = resolveDirective(this, value, directiveParent);\n if (isPrimitive(value)) {\n // Non-rendering child values. It's important that these do not render\n // empty text nodes to avoid issues with preventing default <slot>\n // fallback content.\n if (value === nothing || value == null || value === '') {\n if (this._$committedValue !== nothing) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit nothing to child',\n start: this._$startNode,\n end: this._$endNode,\n parent: this._$parent,\n options: this.options,\n });\n this._$clear();\n }\n this._$committedValue = nothing;\n }\n else if (value !== this._$committedValue && value !== noChange) {\n this._commitText(value);\n }\n // This property needs to remain unminified.\n }\n else if (value['_$litType$'] !== undefined) {\n this._commitTemplateResult(value);\n }\n else if (value.nodeType !== undefined) {\n if (DEV_MODE && this.options?.host === value) {\n this._commitText(`[probable mistake: rendered a template's host in itself ` +\n `(commonly caused by writing \\${this} in a template]`);\n console.warn(`Attempted to render the template host`, value, `inside itself. This is almost always a mistake, and in dev mode `, `we render some warning text. In production however, we'll `, `render it, which will usually result in an error, and sometimes `, `in the element disappearing from the DOM.`);\n return;\n }\n this._commitNode(value);\n }\n else if (isIterable(value)) {\n this._commitIterable(value);\n }\n else {\n // Fallback, will render the string representation\n this._commitText(value);\n }\n }\n _insert(node) {\n return wrap(wrap(this._$startNode).parentNode).insertBefore(node, this._$endNode);\n }\n _commitNode(value) {\n if (this._$committedValue !== value) {\n this._$clear();\n if (ENABLE_EXTRA_SECURITY_HOOKS &&\n sanitizerFactoryInternal !== noopSanitizer) {\n const parentNodeName = this._$startNode.parentNode?.nodeName;\n if (parentNodeName === 'STYLE' || parentNodeName === 'SCRIPT') {\n let message = 'Forbidden';\n if (DEV_MODE) {\n if (parentNodeName === 'STYLE') {\n message =\n `Lit does not support binding inside style nodes. ` +\n `This is a security risk, as style injection attacks can ` +\n `exfiltrate data and spoof UIs. ` +\n `Consider instead using css\\`...\\` literals ` +\n `to compose styles, and do dynamic styling with ` +\n `css custom properties, ::parts, <slot>s, ` +\n `and by mutating the DOM rather than stylesheets.`;\n }\n else {\n message =\n `Lit does not support binding inside script nodes. ` +\n `This is a security risk, as it could allow arbitrary ` +\n `code execution.`;\n }\n }\n throw new Error(message);\n }\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit node',\n start: this._$startNode,\n parent: this._$parent,\n value: value,\n options: this.options,\n });\n this._$committedValue = this._insert(value);\n }\n }\n _commitText(value) {\n // If the committed value is a primitive it means we called _commitText on\n // the previous render, and we know that this._$startNode.nextSibling is a\n // Text node. We can now just replace the text content (.data) of the node.\n if (this._$committedValue !== nothing &&\n isPrimitive(this._$committedValue)) {\n const node = wrap(this._$startNode).nextSibling;\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._textSanitizer === undefined) {\n this._textSanitizer = createSanitizer(node, 'data', 'property');\n }\n value = this._textSanitizer(value);\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node,\n value,\n options: this.options,\n });\n node.data = value;\n }\n else {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n const textNode = d.createTextNode('');\n this._commitNode(textNode);\n // When setting text content, for security purposes it matters a lot\n // what the parent is. For example, <style> and <script> need to be\n // handled with care, while <span> does not. So first we need to put a\n // text node into the document, then we can sanitize its content.\n if (this._textSanitizer === undefined) {\n this._textSanitizer = createSanitizer(textNode, 'data', 'property');\n }\n value = this._textSanitizer(value);\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node: textNode,\n value,\n options: this.options,\n });\n textNode.data = value;\n }\n else {\n this._commitNode(d.createTextNode(value));\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node: wrap(this._$startNode).nextSibling,\n value,\n options: this.options,\n });\n }\n }\n this._$committedValue = value;\n }\n _commitTemplateResult(result) {\n // This property needs to remain unminified.\n const { values, ['_$litType$']: type } = result;\n // If $litType$ is a number, result is a plain TemplateResult and we get\n // the template from the template cache. If not, result is a\n // CompiledTemplateResult and _$litType$ is a CompiledTemplate and we need\n // to create the <template> element the first time we see it.\n const template = typeof type === 'number'\n ? this._$getTemplate(result)\n : (type.el === undefined &&\n (type.el = Template.createElement(trustFromTemplateString(type.h, type.h[0]), this.options)),\n type);\n if (this._$committedValue?._$template === template) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'template updating',\n template,\n instance: this._$committedValue,\n parts: this._$committedValue._$parts,\n options: this.options,\n values,\n });\n this._$committedValue._update(values);\n }\n else {\n const instance = new TemplateInstance(template, this);\n const fragment = instance._clone(this.options);\n debugLogEvent &&\n debugLogEvent({\n kind: 'template instantiated',\n template,\n instance,\n parts: instance._$parts,\n options: this.options,\n fragment,\n values,\n });\n instance._update(values);\n debugLogEvent &&\n debugLogEvent({\n kind: 'template instantiated and updated',\n template,\n instance,\n parts: instance._$parts,\n options: this.options,\n fragment,\n values,\n });\n this._commitNode(fragment);\n this._$committedValue = instance;\n }\n }\n // Overridden via `litHtmlPolyfillSupport` to provide platform support.\n /** @internal */\n _$getTemplate(result) {\n let template = templateCache.get(result.strings);\n if (template === undefined) {\n templateCache.set(result.strings, (template = new Template(result)));\n }\n return template;\n }\n _commitIterable(value) {\n // For an Iterable, we create a new InstancePart per item, then set its\n // value to the item. This is a little bit of overhead for every item in\n // an Iterable, but it lets us recurse easily and efficiently update Arrays\n // of TemplateResults that will be commonly returned from expressions like:\n // array.map((i) => html`${i}`), by reusing existing TemplateInstances.\n // If value is an array, then the previous render was of an\n // iterable and value will contain the ChildParts from the previous\n // render. If value is not an array, clear this part and make a new\n // array for ChildParts.\n if (!isArray(this._$committedValue)) {\n this._$committedValue = [];\n this._$clear();\n }\n // Lets us keep track of how many items we stamped so we can clear leftover\n // items from a previous render\n const itemParts = this._$committedValue;\n let partIndex = 0;\n let itemPart;\n for (const item of value) {\n if (partIndex === itemParts.length) {\n // If no existing part, create a new one\n // TODO (justinfagnani): test perf impact of always creating two parts\n // instead of sharing parts between nodes\n // https://github.com/lit/lit/issues/1266\n itemParts.push((itemPart = new ChildPart(this._insert(createMarker()), this._insert(createMarker()), this, this.options)));\n }\n else {\n // Reuse an existing part\n itemPart = itemParts[partIndex];\n }\n itemPart._$setValue(item);\n partIndex++;\n }\n if (partIndex < itemParts.length) {\n // itemParts always have end nodes\n this._$clear(itemPart && wrap(itemPart._$endNode).nextSibling, partIndex);\n // Truncate the parts array so _value reflects the current state\n itemParts.length = partIndex;\n }\n }\n /**\n * Removes the nodes contained within this Part from the DOM.\n *\n * @param start Start node to clear from, for clearing a subset of the part's\n * DOM (used when truncating iterables)\n * @param from When `start` is specified, the index within the iterable from\n * which ChildParts are being removed, used for disconnecting directives in\n * those Parts.\n *\n * @internal\n */\n _$clear(start = wrap(this._$startNode).nextSibling, from) {\n this._$notifyConnectionChanged?.(false, true, from);\n while (start && start !== this._$endNode) {\n const n = wrap(start).nextSibling;\n wrap(start).remove();\n start = n;\n }\n }\n /**\n * Implementation of RootPart's `isConnected`. Note that this method\n * should only be called on `RootPart`s (the `ChildPart` returned from a\n * top-level `render()` call). It has no effect on non-root ChildParts.\n * @param isConnected Whether to set\n * @internal\n */\n setConnected(isConnected) {\n if (this._$parent === undefined) {\n this.__isConnected = isConnected;\n this._$notifyConnectionChanged?.(isConnected);\n }\n else if (DEV_MODE) {\n throw new Error('part.setConnected() may only be called on a ' +\n 'RootPart returned from render().');\n }\n }\n}\nclass AttributePart {\n get tagName() {\n return this.element.tagName;\n }\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n constructor(element, name, strings, parent, options) {\n this.type = ATTRIBUTE_PART;\n /** @internal */\n this._$committedValue = nothing;\n /** @internal */\n this._$disconnectableChildren = undefined;\n this.element = element;\n this.name = name;\n this._$parent = parent;\n this.options = options;\n if (strings.length > 2 || strings[0] !== '' || strings[1] !== '') {\n this._$committedValue = new Array(strings.length - 1).fill(new String());\n this.strings = strings;\n }\n else {\n this._$committedValue = nothing;\n }\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n this._sanitizer = undefined;\n }\n }\n /**\n * Sets the value of this part by resolving the value from possibly multiple\n * values and static strings and committing it to the DOM.\n * If this part is single-valued, `this._strings` will be undefined, and the\n * method will be called with a single value argument. If this part is\n * multi-value, `this._strings` will be defined, and the method is called\n * with the value array of the part's owning TemplateInstance, and an offset\n * into the value array from which the values should be read.\n * This method is overloaded this way to eliminate short-lived array slices\n * of the template instance values, and allow a fast-path for single-valued\n * parts.\n *\n * @param value The part value, or an array of values for multi-valued parts\n * @param valueIndex the index to start reading values from. `undefined` for\n * single-valued parts\n * @param noCommit causes the part to not commit its value to the DOM. Used\n * in hydration to prime attribute parts with their first-rendered value,\n * but not set the attribute, and in SSR to no-op the DOM operation and\n * capture the value for serialization.\n *\n * @internal\n */\n _$setValue(value, directiveParent = this, valueIndex, noCommit) {\n const strings = this.strings;\n // Whether any of the values has changed, for dirty-checking\n let change = false;\n if (strings === undefined) {\n // Single-value binding case\n value = resolveDirective(this, value, directiveParent, 0);\n change =\n !isPrimitive(value) ||\n (value !== this._$committedValue && value !== noChange);\n if (change) {\n this._$committedValue = value;\n }\n }\n else {\n // Interpolation case\n const values = value;\n value = strings[0];\n let i, v;\n for (i = 0; i < strings.length - 1; i++) {\n v = resolveDirective(this, values[valueIndex + i], directiveParent, i);\n if (v === noChange) {\n // If the user-provided value is `noChange`, use the previous value\n v = this._$committedValue[i];\n }\n change ||=\n !isPrimitive(v) || v !== this._$committedValue[i];\n if (v === nothing) {\n value = nothing;\n }\n else if (value !== nothing) {\n value += (v ?? '') + strings[i + 1];\n }\n // We always record each value, even if one is `nothing`, for future\n // change detection.\n this._$committedValue[i] = v;\n }\n }\n if (change && !noCommit) {\n this._commitValue(value);\n }\n }\n /** @internal */\n _commitValue(value) {\n if (value === nothing) {\n wrap(this.element).removeAttribute(this.name);\n }\n else {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._sanitizer === undefined) {\n this._sanitizer = sanitizerFactoryInternal(this.element, this.name, 'attribute');\n }\n value = this._sanitizer(value ?? '');\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit attribute',\n element: this.element,\n name: this.name,\n value,\n options: this.options,\n });\n wrap(this.element).setAttribute(this.name, (value ?? ''));\n }\n }\n}\nclass PropertyPart extends AttributePart {\n constructor() {\n super(...arguments);\n this.type = PROPERTY_PART;\n }\n /** @internal */\n _commitValue(value) {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._sanitizer === undefined) {\n this._sanitizer = sanitizerFactoryInternal(this.element, this.name, 'property');\n }\n value = this._sanitizer(value);\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit property',\n element: this.element,\n name: this.name,\n value,\n options: this.options,\n });\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.element[this.name] = value === nothing ? undefined : value;\n }\n}\nclass BooleanAttributePart extends AttributePart {\n constructor() {\n super(...arguments);\n this.type = BOOLEAN_ATTRIBUTE_PART;\n }\n /** @internal */\n _commitValue(value) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit boolean attribute',\n element: this.element,\n name: this.name,\n value: !!(value && value !== nothing),\n options: this.options,\n });\n wrap(this.element).toggleAttribute(this.name, !!value && value !== nothing);\n }\n}\nclass EventPart extends AttributePart {\n constructor(element, name, strings, parent, options) {\n super(element, name, strings, parent, options);\n this.type = EVENT_PART;\n if (DEV_MODE && this.strings !== undefined) {\n throw new Error(`A \\`<${element.localName}>\\` has a \\`@${name}=...\\` listener with ` +\n 'invalid content. Event listeners in templates must have exactly ' +\n 'one expression and no surrounding text.');\n }\n }\n // EventPart does not use the base _$setValue/_resolveValue implementation\n // since the dirty checking is more complex\n /** @internal */\n _$setValue(newListener, directiveParent = this) {\n newListener =\n resolveDirective(this, newListener, directiveParent, 0) ?? nothing;\n if (newListener === noChange) {\n return;\n }\n const oldListener = this._$committedValue;\n // If the new value is nothing or any options change we have to remove the\n // part as a listener.\n const shouldRemoveListener = (newListener === nothing && oldListener !== nothing) ||\n newListener.capture !==\n oldListener.capture ||\n newListener.once !==\n oldListener.once ||\n newListener.passive !==\n oldListener.passive;\n // If the new value is not nothing and we removed the listener, we have\n // to add the part as a listener.\n const shouldAddListener = newListener !== nothing &&\n (oldListener === nothing || shouldRemoveListener);\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit event listener',\n element: this.element,\n name: this.name,\n value: newListener,\n options: this.options,\n removeListener: shouldRemoveListener,\n addListener: shouldAddListener,\n oldListener,\n });\n if (shouldRemoveListener) {\n this.element.removeEventListener(this.name, this, oldListener);\n }\n if (shouldAddListener) {\n this.element.addEventListener(this.name, this, newListener);\n }\n this._$committedValue = newListener;\n }\n handleEvent(event) {\n if (typeof this._$committedValue === 'function') {\n this._$committedValue.call(this.options?.host ?? this.element, event);\n }\n else {\n this._$committedValue.handleEvent(event);\n }\n }\n}\nclass ElementPart {\n constructor(element, parent, options) {\n this.element = element;\n this.type = ELEMENT_PART;\n /** @internal */\n this._$disconnectableChildren = undefined;\n this._$parent = parent;\n this.options = options;\n }\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n _$setValue(value) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit to element binding',\n element: this.element,\n value,\n options: this.options,\n });\n resolveDirective(this, value);\n }\n}\n/**\n * END USERS SHOULD NOT RELY ON THIS OBJECT.\n *\n * Private exports for use by other Lit packages, not intended for use by\n * external users.\n *\n * We currently do not make a mangled rollup build of the lit-ssr code. In order\n * to keep a number of (otherwise private) top-level exports mangled in the\n * client side code, we export a _$LH object containing those members (or\n * helper methods for accessing private fields of those members), and then\n * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the\n * client-side code is being used in `dev` mode or `prod` mode.\n *\n * This has a unique name, to disambiguate it from private exports in\n * lit-element, which re-exports all of lit-html.\n *\n * @private\n */\nexport const _$LH = {\n // Used in lit-ssr\n _boundAttributeSuffix: boundAttributeSuffix,\n _marker: marker,\n _markerMatch: markerMatch,\n _HTML_RESULT: HTML_RESULT,\n _getTemplateHtml: getTemplateHtml,\n // Used in tests and private-ssr-support\n _TemplateInstance: TemplateInstance,\n _isIterable: isIterable,\n _resolveDirective: resolveDirective,\n _ChildPart: ChildPart,\n _AttributePart: AttributePart,\n _BooleanAttributePart: BooleanAttributePart,\n _EventPart: EventPart,\n _PropertyPart: PropertyPart,\n _ElementPart: ElementPart,\n};\n// Apply polyfills if available\nconst polyfillSupport = DEV_MODE\n ? global.litHtmlPolyfillSupportDevMode\n : global.litHtmlPolyfillSupport;\npolyfillSupport?.(Template, ChildPart);\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for lit-html usage.\n(global.litHtmlVersions ??= []).push('3.3.0');\nif (DEV_MODE && global.litHtmlVersions.length > 1) {\n queueMicrotask(() => {\n issueWarning('multiple-versions', `Multiple versions of Lit loaded. ` +\n `Loading multiple versions is not recommended.`);\n });\n}\n/**\n * Renders a value, usually a lit-html TemplateResult, to the container.\n *\n * This example renders the text \"Hello, Zoe!\" inside a paragraph tag, appending\n * it to the container `document.body`.\n *\n * ```js\n * import {html, render} from 'lit';\n *\n * const name = \"Zoe\";\n * render(html`<p>Hello, ${name}!</p>`, document.body);\n * ```\n *\n * @param value Any [renderable\n * value](https://lit.dev/docs/templates/expressions/#child-expressions),\n * typically a {@linkcode TemplateResult} created by evaluating a template tag\n * like {@linkcode html} or {@linkcode svg}.\n * @param container A DOM container to render to. The first render will append\n * the rendered value to the container, and subsequent renders will\n * efficiently update the rendered value if the same result type was\n * previously rendered there.\n * @param options See {@linkcode RenderOptions} for options documentation.\n * @see\n * {@link https://lit.dev/docs/libraries/standalone-templates/#rendering-lit-html-templates| Rendering Lit HTML Templates}\n */\nexport const render = (value, container, options) => {\n if (DEV_MODE && container == null) {\n // Give a clearer error message than\n // Uncaught TypeError: Cannot read properties of null (reading\n // '_$litPart$')\n // which reads like an internal Lit error.\n throw new TypeError(`The container to render into may not be ${container}`);\n }\n const renderId = DEV_MODE ? debugLogRenderId++ : 0;\n const partOwnerNode = options?.renderBefore ?? container;\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let part = partOwnerNode['_$litPart$'];\n debugLogEvent &&\n debugLogEvent({\n kind: 'begin render',\n id: renderId,\n value,\n container,\n options,\n part,\n });\n if (part === undefined) {\n const endNode = options?.renderBefore ?? null;\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n partOwnerNode['_$litPart$'] = part = new ChildPart(container.insertBefore(createMarker(), endNode), endNode, undefined, options ?? {});\n }\n part._$setValue(value);\n debugLogEvent &&\n debugLogEvent({\n kind: 'end render',\n id: renderId,\n value,\n container,\n options,\n part,\n });\n return part;\n};\nif (ENABLE_EXTRA_SECURITY_HOOKS) {\n render.setSanitizer = setSanitizer;\n render.createSanitizer = createSanitizer;\n if (DEV_MODE) {\n render._testOnlyClearSanitizerFactoryDoNotCallOrElse =\n _testOnlyClearSanitizerFactoryDoNotCallOrElse;\n }\n}\n//# sourceMappingURL=lit-html.js.map","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nexport const PartType = {\n ATTRIBUTE: 1,\n CHILD: 2,\n PROPERTY: 3,\n BOOLEAN_ATTRIBUTE: 4,\n EVENT: 5,\n ELEMENT: 6,\n};\n/**\n * Creates a user-facing directive function from a Directive class. This\n * function has the same parameters as the directive's render() method.\n */\nexport const directive = (c) => (...values) => ({\n // This property needs to remain unminified.\n ['_$litDirective$']: c,\n values,\n});\n/**\n * Base class for creating custom directives. Users should extend this class,\n * implement `render` and/or `update`, and then pass their subclass to\n * `directive`.\n */\nexport class Directive {\n constructor(_partInfo) { }\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n /** @internal */\n _$initialize(part, parent, attributeIndex) {\n this.__part = part;\n this._$parent = parent;\n this.__attributeIndex = attributeIndex;\n }\n /** @internal */\n _$resolve(part, props) {\n return this.update(part, props);\n }\n update(_part, props) {\n return this.render(...props);\n }\n}\n//# sourceMappingURL=directive.js.map","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport { noChange } from '../lit-html.js';\nimport { directive, Directive, PartType, } from '../directive.js';\nconst important = 'important';\n// The leading space is important\nconst importantFlag = ' !' + important;\n// How many characters to remove from a value, as a negative number\nconst flagTrim = 0 - importantFlag.length;\nclass StyleMapDirective extends Directive {\n constructor(partInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.ATTRIBUTE ||\n partInfo.name !== 'style' ||\n partInfo.strings?.length > 2) {\n throw new Error('The `styleMap` directive must be used in the `style` attribute ' +\n 'and must be the only part in the attribute.');\n }\n }\n render(styleInfo) {\n return Object.keys(styleInfo).reduce((style, prop) => {\n const value = styleInfo[prop];\n if (value == null) {\n return style;\n }\n // Convert property names from camel-case to dash-case, i.e.:\n // `backgroundColor` -> `background-color`\n // Vendor-prefixed names need an extra `-` appended to front:\n // `webkitAppearance` -> `-webkit-appearance`\n // Exception is any property name containing a dash, including\n // custom properties; we assume these are already dash-cased i.e.:\n // `--my-button-color` --> `--my-button-color`\n prop = prop.includes('-')\n ? prop\n : prop\n .replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, '-$&')\n .toLowerCase();\n return style + `${prop}:${value};`;\n }, '');\n }\n update(part, [styleInfo]) {\n const { style } = part.element;\n if (this._previousStyleProperties === undefined) {\n this._previousStyleProperties = new Set(Object.keys(styleInfo));\n return this.render(styleInfo);\n }\n // Remove old properties that no longer exist in styleInfo\n for (const name of this._previousStyleProperties) {\n // If the name isn't in styleInfo or it's null/undefined\n if (styleInfo[name] == null) {\n this._previousStyleProperties.delete(name);\n if (name.includes('-')) {\n style.removeProperty(name);\n }\n else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n style[name] = null;\n }\n }\n }\n // Add or update properties\n for (const name in styleInfo) {\n const value = styleInfo[name];\n if (value != null) {\n this._previousStyleProperties.add(name);\n const isImportant = typeof value === 'string' && value.endsWith(importantFlag);\n if (name.includes('-') || isImportant) {\n style.setProperty(name, isImportant\n ? value.slice(0, flagTrim)\n : value, isImportant ? important : '');\n }\n else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n style[name] = value;\n }\n }\n }\n return noChange;\n }\n}\n/**\n * A directive that applies CSS properties to an element.\n *\n * `styleMap` can only be used in the `style` attribute and must be the only\n * expression in the attribute. It takes the property names in the\n * {@link StyleInfo styleInfo} object and adds the properties to the inline\n * style of the element.\n *\n * Property names with dashes (`-`) are assumed to be valid CSS\n * property names and set on the element's style object using `setProperty()`.\n * Names without dashes are assumed to be camelCased JavaScript property names\n * and set on the element's style object using property assignment, allowing the\n * style object to translate JavaScript-style names to CSS property names.\n *\n * For example `styleMap({backgroundColor: 'red', 'border-top': '5px', '--size':\n * '0'})` sets the `background-color`, `border-top` and `--size` properties.\n *\n * @param styleInfo\n * @see {@link https://lit.dev/docs/templates/directives/#stylemap styleMap code samples on Lit.dev}\n */\nexport const styleMap = directive(StyleMapDirective);\n//# sourceMappingURL=style-map.js.map","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport { nothing, noChange } from '../lit-html.js';\nimport { directive, Directive, PartType } from '../directive.js';\nconst HTML_RESULT = 1;\nexport class UnsafeHTMLDirective extends Directive {\n constructor(partInfo) {\n super(partInfo);\n this._value = nothing;\n if (partInfo.type !== PartType.CHILD) {\n throw new Error(`${this.constructor.directiveName}() can only be used in child bindings`);\n }\n }\n render(value) {\n if (value === nothing || value == null) {\n this._templateResult = undefined;\n return (this._value = value);\n }\n if (value === noChange) {\n return value;\n }\n if (typeof value != 'string') {\n throw new Error(`${this.constructor.directiveName}() called with a non-string value`);\n }\n if (value === this._value) {\n return this._templateResult;\n }\n this._value = value;\n const strings = [value];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n strings.raw = strings;\n // WARNING: impersonating a TemplateResult like this is extremely\n // dangerous. Third-party directives should not do this.\n return (this._templateResult = {\n // Cast to a known set of integers that satisfy ResultType so that we\n // don't have to export ResultType and possibly encourage this pattern.\n // This property needs to remain unminified.\n ['_$litType$']: this.constructor\n .resultType,\n strings,\n values: [],\n });\n }\n}\nUnsafeHTMLDirective.directiveName = 'unsafeHTML';\nUnsafeHTMLDirective.resultType = HTML_RESULT;\n/**\n * Renders the result as HTML, rather than text.\n *\n * The values `undefined`, `null`, and `nothing`, will all result in no content\n * (empty string) being rendered.\n *\n * Note, this is unsafe to use with any user-provided input that hasn't been\n * sanitized or escaped, as it may lead to cross-site-scripting\n * vulnerabilities.\n */\nexport const unsafeHTML = directive(UnsafeHTMLDirective);\n//# sourceMappingURL=unsafe-html.js.map","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport { directive } from '../directive.js';\nimport { UnsafeHTMLDirective } from './unsafe-html.js';\nconst SVG_RESULT = 2;\nclass UnsafeSVGDirective extends UnsafeHTMLDirective {\n}\nUnsafeSVGDirective.directiveName = 'unsafeSVG';\nUnsafeSVGDirective.resultType = SVG_RESULT;\n/**\n * Renders the result as SVG, rather than text.\n *\n * The values `undefined`, `null`, and `nothing`, will all result in no content\n * (empty string) being rendered.\n *\n * Note, this is unsafe to use with any user-provided input that hasn't been\n * sanitized or escaped, as it may lead to cross-site-scripting\n * vulnerabilities.\n */\nexport const unsafeSVG = directive(UnsafeSVGDirective);\n//# sourceMappingURL=unsafe-svg.js.map","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport { _$LH, } from './lit-html.js';\nconst { _ChildPart: ChildPart } = _$LH;\nconst ENABLE_SHADYDOM_NOPATCH = true;\nconst wrap = ENABLE_SHADYDOM_NOPATCH &&\n window.ShadyDOM?.inUse &&\n window.ShadyDOM?.noPatch === true\n ? window.ShadyDOM.wrap\n : (node) => node;\n/**\n * Tests if a value is a primitive value.\n *\n * See https://tc39.github.io/ecma262/#sec-typeof-operator\n */\nexport const isPrimitive = (value) => value === null || (typeof value != 'object' && typeof value != 'function');\nexport const TemplateResultType = {\n HTML: 1,\n SVG: 2,\n MATHML: 3,\n};\n/**\n * Tests if a value is a TemplateResult or a CompiledTemplateResult.\n */\nexport const isTemplateResult = (value, type) => type === undefined\n ? // This property needs to remain unminified.\n value?.['_$litType$'] !== undefined\n : value?.['_$litType$'] === type;\n/**\n * Tests if a value is a CompiledTemplateResult.\n */\nexport const isCompiledTemplateResult = (value) => {\n return value?.['_$litType$']?.h != null;\n};\n/**\n * Tests if a value is a DirectiveResult.\n */\nexport const isDirectiveResult = (value) => \n// This property needs to remain unminified.\nvalue?.['_$litDirective$'] !== undefined;\n/**\n * Retrieves the Directive class for a DirectiveResult\n */\nexport const getDirectiveClass = (value) => \n// This property needs to remain unminified.\nvalue?.['_$litDirective$'];\n/**\n * Tests whether a part has only a single-expression with no strings to\n * interpolate between.\n *\n * Only AttributePart and PropertyPart can have multiple expressions.\n * Multi-expression parts have a `strings` property and single-expression\n * parts do not.\n */\nexport const isSingleExpression = (part) => part.strings === undefined;\nconst createMarker = () => document.createComment('');\n/**\n * Inserts a ChildPart into the given container ChildPart's DOM, either at the\n * end of the container ChildPart, or before the optional `refPart`.\n *\n * This does not add the part to the containerPart's committed value. That must\n * be done by callers.\n *\n * @param containerPart Part within which to add the new ChildPart\n * @param refPart Part before which to add the new ChildPart; when omitted the\n * part added to the end of the `containerPart`\n * @param part Part to insert, or undefined to create a new part\n */\nexport const insertPart = (containerPart, refPart, part) => {\n const container = wrap(containerPart._$startNode).parentNode;\n const refNode = refPart === undefined ? containerPart._$endNode : refPart._$startNode;\n if (part === undefined) {\n const startNode = wrap(container).insertBefore(createMarker(), refNode);\n const endNode = wrap(container).insertBefore(createMarker(), refNode);\n part = new ChildPart(startNode, endNode, containerPart, containerPart.options);\n }\n else {\n const endNode = wrap(part._$endNode).nextSibling;\n const oldParent = part._$parent;\n const parentChanged = oldParent !== containerPart;\n if (parentChanged) {\n part._$reparentDisconnectables?.(containerPart);\n // Note that although `_$reparentDisconnectables` updates the part's\n // `_$parent` reference after unlinking from its current parent, that\n // method only exists if Disconnectables are present, so we need to\n // unconditionally set it here\n part._$parent = containerPart;\n // Since the _$isConnected getter is somewhat costly, only\n // read it once we know the subtree has directives that need\n // to be notified\n let newConnectionState;\n if (part._$notifyConnectionChanged !== undefined &&\n (newConnectionState = containerPart._$isConnected) !==\n oldParent._$isConnected) {\n part._$notifyConnectionChanged(newConnectionState);\n }\n }\n if (endNode !== refNode || parentChanged) {\n let start = part._$startNode;\n while (start !== endNode) {\n const n = wrap(start).nextSibling;\n wrap(container).insertBefore(start, refNode);\n start = n;\n }\n }\n }\n return part;\n};\n/**\n * Sets the value of a Part.\n *\n * Note that this should only be used to set/update the value of user-created\n * parts (i.e. those created using `insertPart`); it should not be used\n * by directives to set the value of the directive's container part. Directives\n * should return a value from `update`/`render` to update their part state.\n *\n * For directives that require setting their part value asynchronously, they\n * should extend `AsyncDirective` and call `this.setValue()`.\n *\n * @param part Part to set\n * @param value Value to set\n * @param index For `AttributePart`s, the index to set\n * @param directiveParent Used internally; should not be set by user\n */\nexport const setChildPartValue = (part, value, directiveParent = part) => {\n part._$setValue(value, directiveParent);\n return part;\n};\n// A sentinel value that can never appear as a part value except when set by\n// live(). Used to force a dirty-check to fail and cause a re-render.\nconst RESET_VALUE = {};\n/**\n * Sets the committed value of a ChildPart directly without triggering the\n * commit stage of the part.\n *\n * This is useful in cases where a directive needs to update the part such\n * that the next update detects a value change or not. When value is omitted,\n * the next update will be guaranteed to be detected as a change.\n *\n * @param part\n * @param value\n */\nexport const setCommittedValue = (part, value = RESET_VALUE) => (part._$committedValue = value);\n/**\n * Returns the committed value of a ChildPart.\n *\n * The committed value is used for change detection and efficient updates of\n * the part. It can differ from the value set by the template or directive in\n * cases where the template value is transformed before being committed.\n *\n * - `TemplateResult`s are committed as a `TemplateInstance`\n * - Iterables are committed as `Array<ChildPart>`\n * - All other types are committed as the template value or value returned or\n * set by a directive.\n *\n * @param part\n */\nexport const getCommittedValue = (part) => part._$committedValue;\n/**\n * Removes a ChildPart from the DOM, including any of its content.\n *\n * @param part The Part to remove\n */\nexport const removePart = (part) => {\n part._$notifyConnectionChanged?.(false, true);\n let start = part._$startNode;\n const end = wrap(part._$endNode).nextSibling;\n while (start !== end) {\n const n = wrap(start).nextSibling;\n wrap(start).remove();\n start = n;\n }\n};\nexport const clearPart = (part) => {\n part._$clear();\n};\n//# sourceMappingURL=directive-helpers.js.map","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport { noChange } from '../lit-html.js';\nimport { directive, Directive, PartType } from '../directive.js';\nimport { insertPart, getCommittedValue, removePart, setCommittedValue, setChildPartValue, } from '../directive-helpers.js';\n// Helper for generating a map of array item to its index over a subset\n// of an array (used to lazily generate `newKeyToIndexMap` and\n// `oldKeyToIndexMap`)\nconst generateMap = (list, start, end) => {\n const map = new Map();\n for (let i = start; i <= end; i++) {\n map.set(list[i], i);\n }\n return map;\n};\nclass RepeatDirective extends Directive {\n constructor(partInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.CHILD) {\n throw new Error('repeat() can only be used in text expressions');\n }\n }\n _getValuesAndKeys(items, keyFnOrTemplate, template) {\n let keyFn;\n if (template === undefined) {\n template = keyFnOrTemplate;\n }\n else if (keyFnOrTemplate !== undefined) {\n keyFn = keyFnOrTemplate;\n }\n const keys = [];\n const values = [];\n let index = 0;\n for (const item of items) {\n keys[index] = keyFn ? keyFn(item, index) : index;\n values[index] = template(item, index);\n index++;\n }\n return {\n values,\n keys,\n };\n }\n render(items, keyFnOrTemplate, template) {\n return this._getValuesAndKeys(items, keyFnOrTemplate, template).values;\n }\n update(containerPart, [items, keyFnOrTemplate, template]) {\n // Old part & key lists are retrieved from the last update (which may\n // be primed by hydration)\n const oldParts = getCommittedValue(containerPart);\n const { values: newValues, keys: newKeys } = this._getValuesAndKeys(items, keyFnOrTemplate, template);\n // We check that oldParts, the committed value, is an Array as an\n // indicator that the previous value came from a repeat() call. If\n // oldParts is not an Array then this is the first render and we return\n // an array for lit-html's array handling to render, and remember the\n // keys.\n if (!Array.isArray(oldParts)) {\n this._itemKeys = newKeys;\n return newValues;\n }\n // In SSR hydration it's possible for oldParts to be an array but for us\n // to not have item keys because the update() hasn't run yet. We set the\n // keys to an empty array. This will cause all oldKey/newKey comparisons\n // to fail and execution to fall to the last nested brach below which\n // reuses the oldPart.\n const oldKeys = (this._itemKeys ??= []);\n // New part list will be built up as we go (either reused from\n // old parts or created for new keys in this update). This is\n // saved in the above cache at the end of the update.\n const newParts = [];\n // Maps from key to index for current and previous update; these\n // are generated lazily only when needed as a performance\n // optimization, since they are only required for multiple\n // non-contiguous changes in the list, which are less common.\n let newKeyToIndexMap;\n let oldKeyToIndexMap;\n // Head and tail pointers to old parts and new values\n let oldHead = 0;\n let oldTail = oldParts.length - 1;\n let newHead = 0;\n let newTail = newValues.length - 1;\n // Overview of O(n) reconciliation algorithm (general approach\n // based on ideas found in ivi, vue, snabbdom, etc.):\n //\n // * We start with the list of old parts and new values (and\n // arrays of their respective keys), head/tail pointers into\n // each, and we build up the new list of parts by updating\n // (and when needed, moving) old parts or creating new ones.\n // The initial scenario might look like this (for brevity of\n // the diagrams, the numbers in the array reflect keys\n // associated with the old parts or new values, although keys\n // and parts/values are actually stored in parallel arrays\n // indexed using the same head/tail pointers):\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [ , , , , , , ]\n // newKeys: [0, 2, 1, 4, 3, 7, 6] <- reflects the user's new\n // item order\n // newHead ^ ^ newTail\n //\n // * Iterate old & new lists from both sides, updating,\n // swapping, or removing parts at the head/tail locations\n // until neither head nor tail can move.\n //\n // * Example below: keys at head pointers match, so update old\n // part 0 in-place (no need to move it) and record part 0 in\n // the `newParts` list. The last thing we do is advance the\n // `oldHead` and `newHead` pointers (will be reflected in the\n // next diagram).\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , ] <- heads matched: update 0\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldHead\n // & newHead\n // newHead ^ ^ newTail\n //\n // * Example below: head pointers don't match, but tail\n // pointers do, so update part 6 in place (no need to move\n // it), and record part 6 in the `newParts` list. Last,\n // advance the `oldTail` and `oldHead` pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , 6] <- tails matched: update 6\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldTail\n // & newTail\n // newHead ^ ^ newTail\n //\n // * If neither head nor tail match; next check if one of the\n // old head/tail items was removed. We first need to generate\n // the reverse map of new keys to index (`newKeyToIndexMap`),\n // which is done once lazily as a performance optimization,\n // since we only hit this case if multiple non-contiguous\n // changes were made. Note that for contiguous removal\n // anywhere in the list, the head and tails would advance\n // from either end and pass each other before we get to this\n // case and removals would be handled in the final while loop\n // without needing to generate the map.\n //\n // * Example below: The key at `oldTail` was removed (no longer\n // in the `newKeyToIndexMap`), so remove that part from the\n // DOM and advance just the `oldTail` pointer.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , 6] <- 5 not in new map: remove\n // newKeys: [0, 2, 1, 4, 3, 7, 6] 5 and advance oldTail\n // newHead ^ ^ newTail\n //\n // * Once head and tail cannot move, any mismatches are due to\n // either new or moved items; if a new key is in the previous\n // \"old key to old index\" map, move the old part to the new\n // location, otherwise create and insert a new part. Note\n // that when moving an old part we null its position in the\n // oldParts array if it lies between the head and tail so we\n // know to skip it when the pointers get there.\n //\n // * Example below: neither head nor tail match, and neither\n // were removed; so find the `newHead` key in the\n // `oldKeyToIndexMap`, and move that old part's DOM into the\n // next head position (before `oldParts[oldHead]`). Last,\n // null the part in the `oldPart` array since it was\n // somewhere in the remaining oldParts still to be scanned\n // (between the head and tail pointers) so that we know to\n // skip that old part on future iterations.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, , , , , 6] <- stuck: update & move 2\n // newKeys: [0, 2, 1, 4, 3, 7, 6] into place and advance\n // newHead\n // newHead ^ ^ newTail\n //\n // * Note that for moves/insertions like the one above, a part\n // inserted at the head pointer is inserted before the\n // current `oldParts[oldHead]`, and a part inserted at the\n // tail pointer is inserted before `newParts[newTail+1]`. The\n // seeming asymmetry lies in the fact that new parts are\n // moved into place outside in, so to the right of the head\n // pointer are old parts, and to the right of the tail\n // pointer are new parts.\n //\n // * We always restart back from the top of the algorithm,\n // allowing matching and simple updates in place to\n // continue...\n //\n // * Example below: the head pointers once again match, so\n // simply update part 1 and record it in the `newParts`\n // array. Last, advance both head pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, , , , 6] <- heads matched: update 1\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldHead\n // & newHead\n // newHead ^ ^ newTail\n //\n // * As mentioned above, items that were moved as a result of\n // being stuck (the final else clause in the code below) are\n // marked with null, so we always advance old pointers over\n // these so we're comparing the next actual old value on\n // either end.\n //\n // * Example below: `oldHead` is null (already placed in\n // newParts), so advance `oldHead`.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6] <- old head already used:\n // newParts: [0, 2, 1, , , , 6] advance oldHead\n // newKeys: [0, 2, 1, 4, 3, 7, 6]\n // newHead ^ ^ newTail\n //\n // * Note it's not critical to mark old parts as null when they\n // are moved from head to tail or tail to head, since they\n // will be outside the pointer range and never visited again.\n //\n // * Example below: Here the old tail key matches the new head\n // key, so the part at the `oldTail` position and move its\n // DOM to the new head position (before `oldParts[oldHead]`).\n // Last, advance `oldTail` and `newHead` pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, , , 6] <- old tail matches new\n // newKeys: [0, 2, 1, 4, 3, 7, 6] head: update & move 4,\n // advance oldTail & newHead\n // newHead ^ ^ newTail\n //\n // * Example below: Old and new head keys match, so update the\n // old head part in place, and advance the `oldHead` and\n // `newHead` pointers.\n //\n // oldHead v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, 3, ,6] <- heads match: update 3\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance oldHead &\n // newHead\n // newHead ^ ^ newTail\n //\n // * Once the new or old pointers move past each other then all\n // we have left is additions (if old list exhausted) or\n // removals (if new list exhausted). Those are handled in the\n // final while loops at the end.\n //\n // * Example below: `oldHead` exceeded `oldTail`, so we're done\n // with the main loop. Create the remaining part and insert\n // it at the new head position, and the update is complete.\n //\n // (oldHead > oldTail)\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, 3, 7 ,6] <- create and insert 7\n // newKeys: [0, 2, 1, 4, 3, 7, 6]\n // newHead ^ newTail\n //\n // * Note that the order of the if/else clauses is not\n // important to the algorithm, as long as the null checks\n // come first (to ensure we're always working on valid old\n // parts) and that the final else clause comes last (since\n // that's where the expensive moves occur). The order of\n // remaining clauses is just a simple guess at which cases\n // will be most common.\n //\n // * Note, we could calculate the longest\n // increasing subsequence (LIS) of old items in new position,\n // and only move those not in the LIS set. However that costs\n // O(nlogn) time and adds a bit more code, and only helps\n // make rare types of mutations require fewer moves. The\n // above handles removes, adds, reversal, swaps, and single\n // moves of contiguous items in linear time, in the minimum\n // number of moves. As the number of multiple moves where LIS\n // might help approaches a random shuffle, the LIS\n // optimization becomes less helpful, so it seems not worth\n // the code at this point. Could reconsider if a compelling\n // case arises.\n while (oldHead <= oldTail && newHead <= newTail) {\n if (oldParts[oldHead] === null) {\n // `null` means old part at head has already been used\n // below; skip\n oldHead++;\n }\n else if (oldParts[oldTail] === null) {\n // `null` means old part at tail has already been used\n // below; skip\n oldTail--;\n }\n else if (oldKeys[oldHead] === newKeys[newHead]) {\n // Old head matches new head; update in place\n newParts[newHead] = setChildPartValue(oldParts[oldHead], newValues[newHead]);\n oldHead++;\n newHead++;\n }\n else if (oldKeys[oldTail] === newKeys[newTail]) {\n // Old tail matches new tail; update in place\n newParts[newTail] = setChildPartValue(oldParts[oldTail], newValues[newTail]);\n oldTail--;\n newTail--;\n }\n else if (oldKeys[oldHead] === newKeys[newTail]) {\n // Old head matches new tail; update and move to new tail\n newParts[newTail] = setChildPartValue(oldParts[oldHead], newValues[newTail]);\n insertPart(containerPart, newParts[newTail + 1], oldParts[oldHead]);\n oldHead++;\n newTail--;\n }\n else if (oldKeys[oldTail] === newKeys[newHead]) {\n // Old tail matches new head; update and move to new head\n newParts[newHead] = setChildPartValue(oldParts[oldTail], newValues[newHead]);\n insertPart(containerPart, oldParts[oldHead], oldParts[oldTail]);\n oldTail--;\n newHead++;\n }\n else {\n if (newKeyToIndexMap === undefined) {\n // Lazily generate key-to-index maps, used for removals &\n // moves below\n newKeyToIndexMap = generateMap(newKeys, newHead, newTail);\n oldKeyToIndexMap = generateMap(oldKeys, oldHead, oldTail);\n }\n if (!newKeyToIndexMap.has(oldKeys[oldHead])) {\n // Old head is no longer in new list; remove\n removePart(oldParts[oldHead]);\n oldHead++;\n }\n else if (!newKeyToIndexMap.has(oldKeys[oldTail])) {\n // Old tail is no longer in new list; remove\n removePart(oldParts[oldTail]);\n oldTail--;\n }\n else {\n // Any mismatches at this point are due to additions or\n // moves; see if we have an old part we can reuse and move\n // into place\n const oldIndex = oldKeyToIndexMap.get(newKeys[newHead]);\n const oldPart = oldIndex !== undefined ? oldParts[oldIndex] : null;\n if (oldPart === null) {\n // No old part for this value; create a new one and\n // insert it\n const newPart = insertPart(containerPart, oldParts[oldHead]);\n setChildPartValue(newPart, newValues[newHead]);\n newParts[newHead] = newPart;\n }\n else {\n // Reuse old part\n newParts[newHead] = setChildPartValue(oldPart, newValues[newHead]);\n insertPart(containerPart, oldParts[oldHead], oldPart);\n // This marks the old part as having been used, so that\n // it will be skipped in the first two checks above\n oldParts[oldIndex] = null;\n }\n newHead++;\n }\n }\n }\n // Add parts for any remaining new values\n while (newHead <= newTail) {\n // For all remaining additions, we insert before last new\n // tail, since old pointers are no longer valid\n const newPart = insertPart(containerPart, newParts[newTail + 1]);\n setChildPartValue(newPart, newValues[newHead]);\n newParts[newHead++] = newPart;\n }\n // Remove any remaining unused old parts\n while (oldHead <= oldTail) {\n const oldPart = oldParts[oldHead++];\n if (oldPart !== null) {\n removePart(oldPart);\n }\n }\n // Save order of new parts for next round\n this._itemKeys = newKeys;\n // Directly set part value, bypassing it's dirty-checking\n setCommittedValue(containerPart, newParts);\n return noChange;\n }\n}\n/**\n * A directive that repeats a series of values (usually `TemplateResults`)\n * generated from an iterable, and updates those items efficiently when the\n * iterable changes based on user-provided `keys` associated with each item.\n *\n * Note that if a `keyFn` is provided, strict key-to-DOM mapping is maintained,\n * meaning previous DOM for a given key is moved into the new position if\n * needed, and DOM will never be reused with values for different keys (new DOM\n * will always be created for new keys). This is generally the most efficient\n * way to use `repeat` since it performs minimum unnecessary work for insertions\n * and removals.\n *\n * The `keyFn` takes two parameters, the item and its index, and returns a unique key value.\n *\n * ```js\n * html`\n * <ol>\n * ${repeat(this.items, (item) => item.id, (item, index) => {\n * return html`<li>${index}: ${item.name}</li>`;\n * })}\n * </ol>\n * `\n * ```\n *\n * **Important**: If providing a `keyFn`, keys *must* be unique for all items in a\n * given call to `repeat`. The behavior when two or more items have the same key\n * is undefined.\n *\n * If no `keyFn` is provided, this directive will perform similar to mapping\n * items to values, and DOM will be reused against potentially different items.\n */\nexport const repeat = directive(RepeatDirective);\n//# sourceMappingURL=repeat.js.map","import { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nexport\n@customElement('linear-progress')\nclass LinearProgress extends LitElement {\n /** Progress value between 0 and 1, or undefined for indeterminate */\n @property({ type: Number })\n value?: number\n\n static styles = css`\n :host {\n display: inline-block;\n width: var(--progress-width, 200px);\n height: var(--progress-height, 8px);\n background-color: var(--progress-background, #e0e0e0);\n border-radius: var(--progress-radius, 4px);\n overflow: hidden;\n position: absolute;\n border: 0.5px solid var(--progress-border-color, #ccc);\n }\n\n .bar {\n height: 100%;\n background-color: var(--progress-color, #3b82f6);\n transition: width 0.3s ease;\n }\n\n /* Indeterminate animation */\n .indeterminate {\n position: absolute;\n width: 30%;\n height: 100%;\n background-color: var(--progress-color, #3b82f6);\n animation: indeterminate-slide 1.2s infinite ease-in-out;\n }\n\n @keyframes indeterminate-slide {\n 0% {\n left: -30%;\n width: 30%;\n }\n 50% {\n left: 35%;\n width: 30%;\n }\n 100% {\n left: 100%;\n width: 30%;\n }\n }\n `\n\n render() {\n return html`\n ${this.value !== undefined\n ? html`<div class=\"bar\" style=\"width: ${this.value * 100}%;\"></div>`\n : html`<div class=\"indeterminate\"></div>`}\n `\n }\n}\n","import { html, css, LitElement, PropertyValues, nothing } from 'lit'\nimport { property, query, state } from 'lit/decorators.js'\nimport { styleMap } from 'lit/directives/style-map.js'\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js'\nimport {\n InputData,\n Modifier,\n Overlay,\n ProgressItem,\n ProgressOverlay,\n TextItem,\n TextOverlay\n} from './definition-schema.js'\nimport { repeat } from 'lit/directives/repeat.js'\nimport './linear-progress.js'\n\ntype Theme = {\n theme_name: string\n theme_object: any\n}\nexport class WidgetImage extends LitElement {\n @property({ type: Object })\n inputData?: InputData\n\n @property({ type: Object })\n theme?: Theme\n\n @state() private themeBgColor?: string\n @state() private themeTitleColor?: string\n @state() private themeSubtitleColor?: string\n @state() private previewUrl?: string\n @state() private inlineSvg?: string\n\n @state() private modifier?: Modifier\n\n constructor() {\n super()\n this.getModifier = this.getModifier.bind(this)\n }\n\n @query('#base-layer')\n private baseLayer!: any\n\n version: string = 'versionplaceholder'\n\n update(changedProperties: Map<string, any>) {\n if (changedProperties.has('inputData')) {\n this.transform()\n if (!this.modifier) this.getModifier()\n }\n if (changedProperties.has('theme')) {\n this.registerTheme(this.theme)\n }\n super.update(changedProperties)\n }\n\n protected firstUpdated(_changedProperties: PropertyValues): void {\n this.registerTheme(this.theme)\n\n const ro = new ResizeObserver(this.getModifier)\n ro.observe(this)\n }\n\n registerTheme(theme?: Theme) {\n const cssTextColor = getComputedStyle(this).getPropertyValue('--re-text-color').trim()\n const cssBgColor = getComputedStyle(this).getPropertyValue('--re-tile-background-color').trim()\n this.themeBgColor = cssBgColor || this.theme?.theme_object?.backgroundColor\n this.themeTitleColor = cssTextColor || this.theme?.theme_object?.title?.textStyle?.color\n this.themeSubtitleColor =\n cssTextColor || this.theme?.theme_object?.title?.subtextStyle?.color || this.themeTitleColor\n }\n\n private handleFileChange(ev: Event) {\n const input = ev.target as HTMLInputElement\n const file = input.files?.[0]\n if (!file) return\n // Revoke previous object URL\n if (this.previewUrl) URL.revokeObjectURL(this.previewUrl)\n this.previewUrl = URL.createObjectURL(file)\n this.dispatchEvent(\n new CustomEvent('overlay-file-selected', {\n detail: { file, name: file.name, size: file.size, type: file.type, url: this.previewUrl },\n bubbles: true,\n composed: true\n })\n )\n }\n\n transform() {\n this.inlineSvg = undefined\n if (!this.inputData?.image) {\n this.previewUrl = undefined\n return\n }\n const raw = this.inputData.image.trim()\n\n // Dynamically load progress bar element if needed\n // if (this.inputData?.overlays?.some((o) => o.layerType === 'progress')) {\n // import('./linear-progress.js')\n // }\n\n // Inline SVG markup (optionally starting with an XML declaration or other preamble)\n const trimmed = raw.replace(/^\\uFEFF/, '').trimStart()\n\n // Find the actual <svg ...>...</svg> block even if preceded by <?xml ...?> or <!DOCTYPE ...>\n const svgBlockMatch = trimmed.match(/<svg[\\s\\S]*?<\\/svg>/i)\n\n if (svgBlockMatch) {\n this.inlineSvg = svgBlockMatch[0].trim()\n this.previewUrl = undefined\n return\n }\n\n // Full data URL (already encoded)\n if (/^data:image\\/svg\\+xml[,;]/.test(raw)) {\n // It's an SVG data URL; we could theoretically decode, but safer to keep as src\n this.previewUrl = raw\n return\n }\n if (/^data:image\\/[a-zA-Z.+-]+;base64,/.test(raw)) {\n this.previewUrl = raw\n return\n }\n\n // Bare base64 string (heuristic)\n if (/^[A-Za-z0-9+/]+=*$/.test(raw) && raw.length > 100) {\n this.previewUrl = `data:image/*;base64,${raw}`\n return\n }\n\n // Absolute URL\n try {\n new URL(raw)\n this.previewUrl = raw\n return\n } catch {\n // Relative path\n if (/^([./]|\\/)/.test(raw)) {\n this.previewUrl = raw\n return\n }\n }\n\n // Fallback\n this.previewUrl = undefined\n }\n\n private async getModifier() {\n if (!this.baseLayer) return\n const rect = this.baseLayer.getBoundingClientRect()\n if (!rect) return\n\n const containerRect = this.baseLayer.parentElement?.getBoundingClientRect()\n if (!containerRect) return\n\n let intrinsicWidth: number | undefined\n let intrinsicHeight: number | undefined\n\n if (this.baseLayer instanceof HTMLImageElement) {\n // For <img>\n intrinsicWidth = this.baseLayer.naturalWidth\n intrinsicHeight = this.baseLayer.naturalHeight\n } else {\n const innerSvg = this.baseLayer.querySelector('svg')\n\n if (innerSvg) {\n // For <svg>\n const viewBox = innerSvg.viewBox.baseVal\n console.log(viewBox)\n if (viewBox && viewBox.width > 0 && viewBox.height > 0) {\n intrinsicWidth = viewBox.width\n intrinsicHeight = viewBox.height\n } else {\n // fallback to width/height attributes if set\n const widthAttr = this.baseLayer.getAttribute('width')\n const heightAttr = this.baseLayer.getAttribute('height')\n if (widthAttr && heightAttr) {\n intrinsicWidth = parseFloat(widthAttr)\n intrinsicHeight = parseFloat(heightAttr)\n }\n }\n }\n }\n\n if (!intrinsicWidth || !intrinsicHeight) return\n\n // Actual visible area of the image/svg\n const scaleX = rect.width / intrinsicWidth\n const scaleY = rect.height / intrinsicHeight\n const scale = Math.min(scaleX, scaleY)\n\n const visibleWidth = intrinsicWidth * scale\n const visibleHeight = intrinsicHeight * scale\n\n const xOffset = (containerRect.width - visibleWidth) / 2\n const yOffset = (containerRect.height - visibleHeight) / 2\n\n this.modifier = { scaler: scale, xOffset, yOffset, visibleWidth, visibleHeight }\n }\n\n private getOverlayItemPosition(relX: number, relY: number, modifier: Modifier) {\n return {\n left: relX * modifier.visibleWidth,\n top: relY * modifier.visibleHeight\n }\n }\n\n renderText(_overlay: Overlay, item: TextItem, modifier: Modifier) {\n const overlay = _overlay as TextOverlay\n const pos = this.getOverlayItemPosition(item.relXPos, item.relYPos, modifier)\n if (!pos) return nothing\n\n const precision = overlay.textStyle?.precision ?? 1\n let value = item.data\n const numericValue = Number(value)\n let color = '#333'\n if (!Number.isNaN(numericValue)) {\n if (typeof precision === 'number' && precision >= 0) {\n value = numericValue.toFixed(precision)\n const sectionIndex =\n overlay.sections?.sectionLimits.findIndex((limit: number) => numericValue <= limit) ?? -2\n color = (sectionIndex >= 1 ? overlay.sections?.colors[sectionIndex - 1] : '#333') ?? '#333'\n }\n }\n\n const styles = {\n 'font-size': (overlay.textStyle.fontSize ?? 14) * modifier.scaler + 'px',\n color,\n 'background-color': overlay.textStyle.backgroundColor,\n 'font-weight': overlay.textStyle.fontWeight,\n left: `${pos.left}px`,\n top: `${pos.top}px`,\n 'border-radius': 10 * modifier.scaler + 'px',\n 'transform-origin': '50% 50%',\n transform: `translate(-50%, -50%)`,\n padding: `${6 * modifier.scaler}px ${12 * modifier.scaler}px`\n }\n\n return html`\n <div class=\"overlay-item\" style=${styleMap(styles)}>${item.prefix}${value}${item.suffix}</div>\n `\n }\n\n renderProgress(_overlay: Overlay, item: ProgressItem, modifier: Modifier) {\n const overlay = _overlay as ProgressOverlay\n const pos = this.getOverlayItemPosition(item.relXPos, item.relYPos, modifier)\n if (!pos) return nothing\n\n const sectionIndex =\n overlay.sections?.sectionLimits.findIndex((limit: number) => Number(item.data) <= limit) ?? -2\n const sectionColor = sectionIndex >= 1 ? overlay.sections?.colors[sectionIndex - 1] : undefined\n const styles = {\n '--progress-color': sectionColor ?? '#333',\n '--progress-width': (overlay.progressStyle?.width ?? 10) * modifier.scaler + 'px',\n '--progress-height': (overlay.progressStyle?.height ?? 100) * modifier.scaler + 'px',\n '--progress-background': overlay.progressStyle?.backgroundColor ?? '#fff',\n 'border-radius': 10 * modifier.scaler + 'px',\n 'transform-origin': '50% 50%',\n transform: `translate(-50%, -50%) rotate(${overlay.progressStyle?.rotate ?? 0}deg)`,\n left: `${pos.left}px`,\n top: `${pos.top}px`\n }\n // Derive percentage based on item.data within overlay.sections min/max.\n // Supports several possible property names; falls back to sectionLimits array.\n const rawValue = Number(item.data)\n const sections: any = overlay.sections ?? {}\n const min = Math.min(...sections.sectionLimits.map(Number))\n const max = Math.max(...sections.sectionLimits.map(Number))\n let percent = max === min ? 0 : (rawValue - min) / (max - min)\n percent = Math.min(1, Math.max(0, percent))\n // percent now holds the normalized 0-100 percentage for rawValue\n return html` <linear-progress .value=${percent} style=${styleMap(styles)}></linear-progress> `\n }\n\n renderLayer(overlay: Overlay) {\n const modifier = this.modifier\n if (!modifier) return nothing\n const containerStyles = {\n left: modifier.xOffset + 'px',\n top: modifier.yOffset + 'px',\n width: modifier.visibleWidth + 'px',\n height: modifier.visibleHeight + 'px'\n }\n return html`<div\n class=\"overlay\"\n style=${styleMap(containerStyles)}\n type=\"${overlay.layerType}\"\n name=\"${overlay.layerName}\"\n >\n ${overlay.layerType === 'text'\n ? this.renderTextLayer(overlay as TextOverlay)\n : this.renderProgressLayer(overlay as ProgressOverlay)}\n </div>`\n }\n\n renderTextLayer(overlay: TextOverlay) {\n const modifier = this.modifier\n if (!modifier) return nothing\n return html`${repeat(\n overlay.textPins ?? [],\n (item, idx) => idx,\n (item) => html`${this.renderText(overlay, item, modifier)}`\n )}`\n }\n\n renderProgressLayer(overlay: ProgressOverlay) {\n const modifier = this.modifier\n if (!modifier) return nothing\n return html`${repeat(\n overlay.progressPins ?? [],\n (item, idx) => idx,\n (item) => html`${this.renderProgress(overlay, item, modifier)}`\n )}`\n }\n\n static styles = css`\n :host {\n display: block;\n font-family: sans-serif;\n box-sizing: border-box;\n margin: auto;\n }\n\n .paging:not([active]) {\n display: none !important;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n padding: 2%;\n box-sizing: border-box;\n }\n\n .svg-wrapper {\n width: 100%;\n height: 100%;\n overflow: hidden;\n position: relative;\n }\n\n .svg-wrapper svg {\n width: 100%;\n height: 100%;\n display: block;\n /* preserveAspectRatio inside SVG handles \"contain\"-like scaling */\n }\n\n h3 {\n margin: 0;\n max-width: 300px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n p {\n margin: 10px 0 0 0;\n max-width: 300px;\n font-size: 14px;\n line-height: 17px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .img-container {\n flex: 1;\n box-sizing: border-box;\n overflow: hidden;\n position: relative;\n }\n\n img {\n width: 100%; /* Set the width of the container */\n height: 100%;\n }\n .no-data {\n font-size: 20px;\n display: flex;\n height: 100%;\n width: 100%;\n text-align: center;\n align-items: center;\n justify-content: center;\n }\n\n .overlay {\n position: absolute;\n pointer-events: none;\n }\n\n .overlay-item {\n position: absolute;\n pointer-events: auto;\n }\n `\n\n render() {\n const hasImage = !!this.inlineSvg || !!this.previewUrl\n return html`\n <div class=\"wrapper\" style=\"background-color: ${this.themeBgColor}\">\n <h3 class=\"paging\" ?active=${this.inputData?.title} style=\"color: ${this.themeTitleColor}\">\n ${this.inputData?.title}\n </h3>\n <p\n class=\"paging\"\n ?active=${this.inputData?.subTitle}\n style=\"color: ${this.themeSubtitleColor}\"\n >\n ${this.inputData?.subTitle}\n </p>\n\n <div class=\"paging no-data\" ?active=${!hasImage}>No Image</div>\n <div class=\"img-container paging\" ?active=\"${hasImage}\">\n ${this.inlineSvg\n ? html`<div id=\"base-layer\" class=\"svg-wrapper\">${unsafeSVG(this.inlineSvg)}</div>`\n : this.previewUrl\n ? html`<img\n id=\"base-layer\"\n @load=\"${this.getModifier}\"\n src=\"${this.previewUrl}\"\n alt=\"Image Widget\"\n style=\"object-fit: ${this.inputData?.stretchToFit ? 'fill' : 'contain'}\"\n />`\n : ''}\n ${repeat(\n this.inputData?.overlays ?? [],\n (o) => o.layerName,\n (o) => html` ${this.renderLayer(o)} `\n )}\n </div>\n </div>\n `\n }\n}\nwindow.customElements.define('widget-overlay-versionplaceholder', WidgetImage)\n"],"names":["global","debugLogEvent","event","issueWarning","code","warning","wrap","node","trustedTypes","policy","s","identityFunction","value","noopSanitizer","_node","_name","_type","createSanitizer","name","type","sanitizerFactoryInternal","boundAttributeSuffix","marker","markerMatch","nodeMarker","d","createMarker","isPrimitive","isArray","isIterable","SPACE_CHAR","ATTR_VALUE_CHAR","NAME_CHAR","textEndRegex","COMMENT_START","TAG_NAME","DYNAMIC_TAG_NAME","commentEndRegex","comment2EndRegex","tagEndRegex","ENTIRE_MATCH","ATTRIBUTE_NAME","SPACES_AND_EQUALS","QUOTE_CHAR","singleQuoteAttrEndRegex","doubleQuoteAttrEndRegex","rawTextElement","SVG_RESULT","MATHML_RESULT","ATTRIBUTE_PART","CHILD_PART","PROPERTY_PART","BOOLEAN_ATTRIBUTE_PART","EVENT_PART","ELEMENT_PART","COMMENT_PART","noChange","nothing","templateCache","walker","trustFromTemplateString","tsa","stringFromTSA","message","getTemplateHtml","strings","l","attrNames","html","rawTextEndRegex","regex","i","attrNameEndIndex","attrName","lastIndex","match","end","htmlResult","Template","options","nodeIndex","attrNameIndex","partCount","parts","wrapper","tag","m","realName","statics","PropertyPart","BooleanAttributePart","EventPart","AttributePart","_options","el","resolveDirective","part","parent","attributeIndex","currentDirective","nextDirectiveConstructor","TemplateInstance","template","content","fragment","partIndex","templatePart","ChildPart","ElementPart","values","ChildPart$1","startNode","endNode","parentNode","directiveParent","parentNodeName","textNode","result","instance","itemParts","itemPart","item","start","from","n","isConnected","element","valueIndex","noCommit","change","v","newListener","oldListener","shouldRemoveListener","shouldAddListener","_$LH","polyfillSupport","PartType","directive","c","Directive","_partInfo","props","_part","important","importantFlag","flagTrim","StyleMapDirective","partInfo","styleInfo","style","prop","isImportant","styleMap","HTML_RESULT","UnsafeHTMLDirective","UnsafeSVGDirective","unsafeSVG","insertPart","containerPart","refPart","container","refNode","oldParent","parentChanged","newConnectionState","setChildPartValue","RESET_VALUE","setCommittedValue","getCommittedValue","removePart","generateMap","list","map","RepeatDirective","items","keyFnOrTemplate","keyFn","keys","index","oldParts","newValues","newKeys","oldKeys","newParts","newKeyToIndexMap","oldKeyToIndexMap","oldHead","oldTail","newHead","newTail","oldIndex","oldPart","newPart","repeat","LinearProgress","LitElement","css","__decorateClass","property","customElement","_WidgetImage","changedProperties","_changedProperties","theme","cssTextColor","cssBgColor","ev","file","raw","svgBlockMatch","rect","containerRect","intrinsicWidth","intrinsicHeight","innerSvg","viewBox","widthAttr","heightAttr","scaleX","scaleY","scale","visibleWidth","visibleHeight","xOffset","yOffset","relX","relY","modifier","_overlay","overlay","pos","precision","numericValue","color","sectionIndex","limit","styles","rawValue","sections","min","max","percent","containerStyles","idx","hasImage","o","WidgetImage","state","query"],"mappings":";;AAUA,MAAMA,IAAS,YAMTC,IACA,CAACC,MAAU;AAGT,EAFmBF,EACd,yBAILA,EAAO,cAAc,IAAI,YAAY,aAAa;AAAA,IAC9C,QAAQE;AAAA,EACpB,CAAS,CAAC;AACN;AAMJ,IAAIC;AAEAH,EAAO,sBAAsB,oBAAI,IAAG,GAMpCG,IAAe,CAACC,GAAMC,MAAY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BAAqCA,CAAW;","x_google_ignoreList":[0,1,2,3,4,5,6]}
|
|
1
|
+
{"version":3,"file":"widget-overlay.js","sources":["../node_modules/lit-html/development/lit-html.js","../node_modules/lit-html/development/directive.js","../node_modules/lit-html/development/directives/style-map.js","../node_modules/lit-html/development/directives/unsafe-html.js","../node_modules/lit-html/development/directives/unsafe-svg.js","../node_modules/lit-html/development/directive-helpers.js","../node_modules/lit-html/development/directives/repeat.js","../src/linear-progress.ts","../src/widget-overlay.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst DEV_MODE = true;\nconst ENABLE_EXTRA_SECURITY_HOOKS = true;\nconst ENABLE_SHADYDOM_NOPATCH = true;\nconst NODE_MODE = false;\n// Allows minifiers to rename references to globalThis\nconst global = globalThis;\n/**\n * Useful for visualizing and logging insights into what the Lit template system is doing.\n *\n * Compiled out of prod mode builds.\n */\nconst debugLogEvent = DEV_MODE\n ? (event) => {\n const shouldEmit = global\n .emitLitDebugLogEvents;\n if (!shouldEmit) {\n return;\n }\n global.dispatchEvent(new CustomEvent('lit-debug', {\n detail: event,\n }));\n }\n : undefined;\n// Used for connecting beginRender and endRender events when there are nested\n// renders when errors are thrown preventing an endRender event from being\n// called.\nlet debugLogRenderId = 0;\nlet issueWarning;\nif (DEV_MODE) {\n global.litIssuedWarnings ??= new Set();\n /**\n * Issue a warning if we haven't already, based either on `code` or `warning`.\n * Warnings are disabled automatically only by `warning`; disabling via `code`\n * can be done by users.\n */\n issueWarning = (code, warning) => {\n warning += code\n ? ` See https://lit.dev/msg/${code} for more information.`\n : '';\n if (!global.litIssuedWarnings.has(warning) &&\n !global.litIssuedWarnings.has(code)) {\n console.warn(warning);\n global.litIssuedWarnings.add(warning);\n }\n };\n queueMicrotask(() => {\n issueWarning('dev-mode', `Lit is in dev mode. Not recommended for production!`);\n });\n}\nconst wrap = ENABLE_SHADYDOM_NOPATCH &&\n global.ShadyDOM?.inUse &&\n global.ShadyDOM?.noPatch === true\n ? global.ShadyDOM.wrap\n : (node) => node;\nconst trustedTypes = global.trustedTypes;\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = trustedTypes\n ? trustedTypes.createPolicy('lit-html', {\n createHTML: (s) => s,\n })\n : undefined;\nconst identityFunction = (value) => value;\nconst noopSanitizer = (_node, _name, _type) => identityFunction;\n/** Sets the global sanitizer factory. */\nconst setSanitizer = (newSanitizer) => {\n if (!ENABLE_EXTRA_SECURITY_HOOKS) {\n return;\n }\n if (sanitizerFactoryInternal !== noopSanitizer) {\n throw new Error(`Attempted to overwrite existing lit-html security policy.` +\n ` setSanitizeDOMValueFactory should be called at most once.`);\n }\n sanitizerFactoryInternal = newSanitizer;\n};\n/**\n * Only used in internal tests, not a part of the public API.\n */\nconst _testOnlyClearSanitizerFactoryDoNotCallOrElse = () => {\n sanitizerFactoryInternal = noopSanitizer;\n};\nconst createSanitizer = (node, name, type) => {\n return sanitizerFactoryInternal(node, name, type);\n};\n// Added to an attribute name to mark the attribute as bound so we can find\n// it easily.\nconst boundAttributeSuffix = '$lit$';\n// This marker is used in many syntactic positions in HTML, so it must be\n// a valid element name and attribute name. We don't support dynamic names (yet)\n// but this at least ensures that the parse tree is closer to the template\n// intention.\nconst marker = `lit$${Math.random().toFixed(9).slice(2)}$`;\n// String used to tell if a comment is a marker comment\nconst markerMatch = '?' + marker;\n// Text used to insert a comment marker node. We use processing instruction\n// syntax because it's slightly smaller, but parses as a comment node.\nconst nodeMarker = `<${markerMatch}>`;\nconst d = NODE_MODE && global.document === undefined\n ? {\n createTreeWalker() {\n return {};\n },\n }\n : document;\n// Creates a dynamic marker. We never have to search for these in the DOM.\nconst createMarker = () => d.createComment('');\nconst isPrimitive = (value) => value === null || (typeof value != 'object' && typeof value != 'function');\nconst isArray = Array.isArray;\nconst isIterable = (value) => isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n typeof value?.[Symbol.iterator] === 'function';\nconst SPACE_CHAR = `[ \\t\\n\\f\\r]`;\nconst ATTR_VALUE_CHAR = `[^ \\t\\n\\f\\r\"'\\`<>=]`;\nconst NAME_CHAR = `[^\\\\s\"'>=/]`;\n// These regexes represent the five parsing states that we care about in the\n// Template's HTML scanner. They match the *end* of the state they're named\n// after.\n// Depending on the match, we transition to a new state. If there's no match,\n// we stay in the same state.\n// Note that the regexes are stateful. We utilize lastIndex and sync it\n// across the multiple regexes used. In addition to the five regexes below\n// we also dynamically create a regex to find the matching end tags for raw\n// text elements.\n/**\n * End of text is: `<` followed by:\n * (comment start) or (tag) or (dynamic tag binding)\n */\nconst textEndRegex = /<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g;\nconst COMMENT_START = 1;\nconst TAG_NAME = 2;\nconst DYNAMIC_TAG_NAME = 3;\nconst commentEndRegex = /-->/g;\n/**\n * Comments not started with <!--, like </{, can be ended by a single `>`\n */\nconst comment2EndRegex = />/g;\n/**\n * The tagEnd regex matches the end of the \"inside an opening\" tag syntax\n * position. It either matches a `>`, an attribute-like sequence, or the end\n * of the string after a space (attribute-name position ending).\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\t\\n\\f\\r\" are HTML space characters:\n * https://infra.spec.whatwg.org/#ascii-whitespace\n *\n * So an attribute is:\n * * The name: any character except a whitespace character, (\"), ('), \">\",\n * \"=\", or \"/\". Note: this is different from the HTML spec which also excludes control characters.\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nconst tagEndRegex = new RegExp(`>|${SPACE_CHAR}(?:(${NAME_CHAR}+)(${SPACE_CHAR}*=${SPACE_CHAR}*(?:${ATTR_VALUE_CHAR}|(\"|')|))|$)`, 'g');\nconst ENTIRE_MATCH = 0;\nconst ATTRIBUTE_NAME = 1;\nconst SPACES_AND_EQUALS = 2;\nconst QUOTE_CHAR = 3;\nconst singleQuoteAttrEndRegex = /'/g;\nconst doubleQuoteAttrEndRegex = /\"/g;\n/**\n * Matches the raw text elements.\n *\n * Comments are not parsed within raw text elements, so we need to search their\n * text content for marker strings.\n */\nconst rawTextElement = /^(?:script|style|textarea|title)$/i;\n/** TemplateResult types */\nconst HTML_RESULT = 1;\nconst SVG_RESULT = 2;\nconst MATHML_RESULT = 3;\n// TemplatePart types\n// IMPORTANT: these must match the values in PartType\nconst ATTRIBUTE_PART = 1;\nconst CHILD_PART = 2;\nconst PROPERTY_PART = 3;\nconst BOOLEAN_ATTRIBUTE_PART = 4;\nconst EVENT_PART = 5;\nconst ELEMENT_PART = 6;\nconst COMMENT_PART = 7;\n/**\n * Generates a template literal tag function that returns a TemplateResult with\n * the given result type.\n */\nconst tag = (type) => (strings, ...values) => {\n // Warn against templates octal escape sequences\n // We do this here rather than in render so that the warning is closer to the\n // template definition.\n if (DEV_MODE && strings.some((s) => s === undefined)) {\n console.warn('Some template strings are undefined.\\n' +\n 'This is probably caused by illegal octal escape sequences.');\n }\n if (DEV_MODE) {\n // Import static-html.js results in a circular dependency which g3 doesn't\n // handle. Instead we know that static values must have the field\n // `_$litStatic$`.\n if (values.some((val) => val?.['_$litStatic$'])) {\n issueWarning('', `Static values 'literal' or 'unsafeStatic' cannot be used as values to non-static templates.\\n` +\n `Please use the static 'html' tag function. See https://lit.dev/docs/templates/expressions/#static-expressions`);\n }\n }\n return {\n // This property needs to remain unminified.\n ['_$litType$']: type,\n strings,\n values,\n };\n};\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n *\n * ```ts\n * const header = (title: string) => html`<h1>${title}</h1>`;\n * ```\n *\n * The `html` tag returns a description of the DOM to render as a value. It is\n * lazy, meaning no work is done until the template is rendered. When rendering,\n * if a template comes from the same expression as a previously rendered result,\n * it's efficiently updated instead of replaced.\n */\nexport const html = tag(HTML_RESULT);\n/**\n * Interprets a template literal as an SVG fragment that can efficiently render\n * to and update a container.\n *\n * ```ts\n * const rect = svg`<rect width=\"10\" height=\"10\"></rect>`;\n *\n * const myImage = html`\n * <svg viewBox=\"0 0 10 10\" xmlns=\"http://www.w3.org/2000/svg\">\n * ${rect}\n * </svg>`;\n * ```\n *\n * The `svg` *tag function* should only be used for SVG fragments, or elements\n * that would be contained **inside** an `<svg>` HTML element. A common error is\n * placing an `<svg>` *element* in a template tagged with the `svg` tag\n * function. The `<svg>` element is an HTML element and should be used within a\n * template tagged with the {@linkcode html} tag function.\n *\n * In LitElement usage, it's invalid to return an SVG fragment from the\n * `render()` method, as the SVG fragment will be contained within the element's\n * shadow root and thus not be properly contained within an `<svg>` HTML\n * element.\n */\nexport const svg = tag(SVG_RESULT);\n/**\n * Interprets a template literal as MathML fragment that can efficiently render\n * to and update a container.\n *\n * ```ts\n * const num = mathml`<mn>1</mn>`;\n *\n * const eq = html`\n * <math>\n * ${num}\n * </math>`;\n * ```\n *\n * The `mathml` *tag function* should only be used for MathML fragments, or\n * elements that would be contained **inside** a `<math>` HTML element. A common\n * error is placing a `<math>` *element* in a template tagged with the `mathml`\n * tag function. The `<math>` element is an HTML element and should be used\n * within a template tagged with the {@linkcode html} tag function.\n *\n * In LitElement usage, it's invalid to return an MathML fragment from the\n * `render()` method, as the MathML fragment will be contained within the\n * element's shadow root and thus not be properly contained within a `<math>`\n * HTML element.\n */\nexport const mathml = tag(MATHML_RESULT);\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = Symbol.for('lit-noChange');\n/**\n * A sentinel value that signals a ChildPart to fully clear its content.\n *\n * ```ts\n * const button = html`${\n * user.isAdmin\n * ? html`<button>DELETE</button>`\n * : nothing\n * }`;\n * ```\n *\n * Prefer using `nothing` over other falsy values as it provides a consistent\n * behavior between various expression binding contexts.\n *\n * In child expressions, `undefined`, `null`, `''`, and `nothing` all behave the\n * same and render no nodes. In attribute expressions, `nothing` _removes_ the\n * attribute, while `undefined` and `null` will render an empty string. In\n * property expressions `nothing` becomes `undefined`.\n */\nexport const nothing = Symbol.for('lit-nothing');\n/**\n * The cache of prepared templates, keyed by the tagged TemplateStringsArray\n * and _not_ accounting for the specific template tag used. This means that\n * template tags cannot be dynamic - they must statically be one of html, svg,\n * or attr. This restriction simplifies the cache lookup, which is on the hot\n * path for rendering.\n */\nconst templateCache = new WeakMap();\nconst walker = d.createTreeWalker(d, 129 /* NodeFilter.SHOW_{ELEMENT|COMMENT} */);\nlet sanitizerFactoryInternal = noopSanitizer;\nfunction trustFromTemplateString(tsa, stringFromTSA) {\n // A security check to prevent spoofing of Lit template results.\n // In the future, we may be able to replace this with Array.isTemplateObject,\n // though we might need to make that check inside of the html and svg\n // functions, because precompiled templates don't come in as\n // TemplateStringArray objects.\n if (!isArray(tsa) || !tsa.hasOwnProperty('raw')) {\n let message = 'invalid template strings array';\n if (DEV_MODE) {\n message = `\n Internal Error: expected template strings to be an array\n with a 'raw' field. Faking a template strings array by\n calling html or svg like an ordinary function is effectively\n the same as calling unsafeHtml and can lead to major security\n issues, e.g. opening your code up to XSS attacks.\n If you're using the html or svg tagged template functions normally\n and still seeing this error, please file a bug at\n https://github.com/lit/lit/issues/new?template=bug_report.md\n and include information about your build tooling, if any.\n `\n .trim()\n .replace(/\\n */g, '\\n');\n }\n throw new Error(message);\n }\n return policy !== undefined\n ? policy.createHTML(stringFromTSA)\n : stringFromTSA;\n}\n/**\n * Returns an HTML string for the given TemplateStringsArray and result type\n * (HTML or SVG), along with the case-sensitive bound attribute names in\n * template order. The HTML contains comment markers denoting the `ChildPart`s\n * and suffixes on bound attributes denoting the `AttributeParts`.\n *\n * @param strings template strings array\n * @param type HTML or SVG\n * @return Array containing `[html, attrNames]` (array returned for terseness,\n * to avoid object fields since this code is shared with non-minified SSR\n * code)\n */\nconst getTemplateHtml = (strings, type) => {\n // Insert makers into the template HTML to represent the position of\n // bindings. The following code scans the template strings to determine the\n // syntactic position of the bindings. They can be in text position, where\n // we insert an HTML comment, attribute value position, where we insert a\n // sentinel string and re-write the attribute name, or inside a tag where\n // we insert the sentinel string.\n const l = strings.length - 1;\n // Stores the case-sensitive bound attribute names in the order of their\n // parts. ElementParts are also reflected in this array as undefined\n // rather than a string, to disambiguate from attribute bindings.\n const attrNames = [];\n let html = type === SVG_RESULT ? '<svg>' : type === MATHML_RESULT ? '<math>' : '';\n // When we're inside a raw text tag (not it's text content), the regex\n // will still be tagRegex so we can find attributes, but will switch to\n // this regex when the tag ends.\n let rawTextEndRegex;\n // The current parsing state, represented as a reference to one of the\n // regexes\n let regex = textEndRegex;\n for (let i = 0; i < l; i++) {\n const s = strings[i];\n // The index of the end of the last attribute name. When this is\n // positive at end of a string, it means we're in an attribute value\n // position and need to rewrite the attribute name.\n // We also use a special value of -2 to indicate that we encountered\n // the end of a string in attribute name position.\n let attrNameEndIndex = -1;\n let attrName;\n let lastIndex = 0;\n let match;\n // The conditions in this loop handle the current parse state, and the\n // assignments to the `regex` variable are the state transitions.\n while (lastIndex < s.length) {\n // Make sure we start searching from where we previously left off\n regex.lastIndex = lastIndex;\n match = regex.exec(s);\n if (match === null) {\n break;\n }\n lastIndex = regex.lastIndex;\n if (regex === textEndRegex) {\n if (match[COMMENT_START] === '!--') {\n regex = commentEndRegex;\n }\n else if (match[COMMENT_START] !== undefined) {\n // We started a weird comment, like </{\n regex = comment2EndRegex;\n }\n else if (match[TAG_NAME] !== undefined) {\n if (rawTextElement.test(match[TAG_NAME])) {\n // Record if we encounter a raw-text element. We'll switch to\n // this regex at the end of the tag.\n rawTextEndRegex = new RegExp(`</${match[TAG_NAME]}`, 'g');\n }\n regex = tagEndRegex;\n }\n else if (match[DYNAMIC_TAG_NAME] !== undefined) {\n if (DEV_MODE) {\n throw new Error('Bindings in tag names are not supported. Please use static templates instead. ' +\n 'See https://lit.dev/docs/templates/expressions/#static-expressions');\n }\n regex = tagEndRegex;\n }\n }\n else if (regex === tagEndRegex) {\n if (match[ENTIRE_MATCH] === '>') {\n // End of a tag. If we had started a raw-text element, use that\n // regex\n regex = rawTextEndRegex ?? textEndRegex;\n // We may be ending an unquoted attribute value, so make sure we\n // clear any pending attrNameEndIndex\n attrNameEndIndex = -1;\n }\n else if (match[ATTRIBUTE_NAME] === undefined) {\n // Attribute name position\n attrNameEndIndex = -2;\n }\n else {\n attrNameEndIndex = regex.lastIndex - match[SPACES_AND_EQUALS].length;\n attrName = match[ATTRIBUTE_NAME];\n regex =\n match[QUOTE_CHAR] === undefined\n ? tagEndRegex\n : match[QUOTE_CHAR] === '\"'\n ? doubleQuoteAttrEndRegex\n : singleQuoteAttrEndRegex;\n }\n }\n else if (regex === doubleQuoteAttrEndRegex ||\n regex === singleQuoteAttrEndRegex) {\n regex = tagEndRegex;\n }\n else if (regex === commentEndRegex || regex === comment2EndRegex) {\n regex = textEndRegex;\n }\n else {\n // Not one of the five state regexes, so it must be the dynamically\n // created raw text regex and we're at the close of that element.\n regex = tagEndRegex;\n rawTextEndRegex = undefined;\n }\n }\n if (DEV_MODE) {\n // If we have a attrNameEndIndex, which indicates that we should\n // rewrite the attribute name, assert that we're in a valid attribute\n // position - either in a tag, or a quoted attribute value.\n console.assert(attrNameEndIndex === -1 ||\n regex === tagEndRegex ||\n regex === singleQuoteAttrEndRegex ||\n regex === doubleQuoteAttrEndRegex, 'unexpected parse state B');\n }\n // We have four cases:\n // 1. We're in text position, and not in a raw text element\n // (regex === textEndRegex): insert a comment marker.\n // 2. We have a non-negative attrNameEndIndex which means we need to\n // rewrite the attribute name to add a bound attribute suffix.\n // 3. We're at the non-first binding in a multi-binding attribute, use a\n // plain marker.\n // 4. We're somewhere else inside the tag. If we're in attribute name\n // position (attrNameEndIndex === -2), add a sequential suffix to\n // generate a unique attribute name.\n // Detect a binding next to self-closing tag end and insert a space to\n // separate the marker from the tag end:\n const end = regex === tagEndRegex && strings[i + 1].startsWith('/>') ? ' ' : '';\n html +=\n regex === textEndRegex\n ? s + nodeMarker\n : attrNameEndIndex >= 0\n ? (attrNames.push(attrName),\n s.slice(0, attrNameEndIndex) +\n boundAttributeSuffix +\n s.slice(attrNameEndIndex)) +\n marker +\n end\n : s + marker + (attrNameEndIndex === -2 ? i : end);\n }\n const htmlResult = html +\n (strings[l] || '<?>') +\n (type === SVG_RESULT ? '</svg>' : type === MATHML_RESULT ? '</math>' : '');\n // Returned as an array for terseness\n return [trustFromTemplateString(strings, htmlResult), attrNames];\n};\nclass Template {\n constructor(\n // This property needs to remain unminified.\n { strings, ['_$litType$']: type }, options) {\n this.parts = [];\n let node;\n let nodeIndex = 0;\n let attrNameIndex = 0;\n const partCount = strings.length - 1;\n const parts = this.parts;\n // Create template element\n const [html, attrNames] = getTemplateHtml(strings, type);\n this.el = Template.createElement(html, options);\n walker.currentNode = this.el.content;\n // Re-parent SVG or MathML nodes into template root\n if (type === SVG_RESULT || type === MATHML_RESULT) {\n const wrapper = this.el.content.firstChild;\n wrapper.replaceWith(...wrapper.childNodes);\n }\n // Walk the template to find binding markers and create TemplateParts\n while ((node = walker.nextNode()) !== null && parts.length < partCount) {\n if (node.nodeType === 1) {\n if (DEV_MODE) {\n const tag = node.localName;\n // Warn if `textarea` includes an expression and throw if `template`\n // does since these are not supported. We do this by checking\n // innerHTML for anything that looks like a marker. This catches\n // cases like bindings in textarea there markers turn into text nodes.\n if (/^(?:textarea|template)$/i.test(tag) &&\n node.innerHTML.includes(marker)) {\n const m = `Expressions are not supported inside \\`${tag}\\` ` +\n `elements. See https://lit.dev/msg/expression-in-${tag} for more ` +\n `information.`;\n if (tag === 'template') {\n throw new Error(m);\n }\n else\n issueWarning('', m);\n }\n }\n // TODO (justinfagnani): for attempted dynamic tag names, we don't\n // increment the bindingIndex, and it'll be off by 1 in the element\n // and off by two after it.\n if (node.hasAttributes()) {\n for (const name of node.getAttributeNames()) {\n if (name.endsWith(boundAttributeSuffix)) {\n const realName = attrNames[attrNameIndex++];\n const value = node.getAttribute(name);\n const statics = value.split(marker);\n const m = /([.?@])?(.*)/.exec(realName);\n parts.push({\n type: ATTRIBUTE_PART,\n index: nodeIndex,\n name: m[2],\n strings: statics,\n ctor: m[1] === '.'\n ? PropertyPart\n : m[1] === '?'\n ? BooleanAttributePart\n : m[1] === '@'\n ? EventPart\n : AttributePart,\n });\n node.removeAttribute(name);\n }\n else if (name.startsWith(marker)) {\n parts.push({\n type: ELEMENT_PART,\n index: nodeIndex,\n });\n node.removeAttribute(name);\n }\n }\n }\n // TODO (justinfagnani): benchmark the regex against testing for each\n // of the 3 raw text element names.\n if (rawTextElement.test(node.tagName)) {\n // For raw text elements we need to split the text content on\n // markers, create a Text node for each segment, and create\n // a TemplatePart for each marker.\n const strings = node.textContent.split(marker);\n const lastIndex = strings.length - 1;\n if (lastIndex > 0) {\n node.textContent = trustedTypes\n ? trustedTypes.emptyScript\n : '';\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for child parts\n for (let i = 0; i < lastIndex; i++) {\n node.append(strings[i], createMarker());\n // Walk past the marker node we just added\n walker.nextNode();\n parts.push({ type: CHILD_PART, index: ++nodeIndex });\n }\n // Note because this marker is added after the walker's current\n // node, it will be walked to in the outer loop (and ignored), so\n // we don't need to adjust nodeIndex here\n node.append(strings[lastIndex], createMarker());\n }\n }\n }\n else if (node.nodeType === 8) {\n const data = node.data;\n if (data === markerMatch) {\n parts.push({ type: CHILD_PART, index: nodeIndex });\n }\n else {\n let i = -1;\n while ((i = node.data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n parts.push({ type: COMMENT_PART, index: nodeIndex });\n // Move to the end of the match\n i += marker.length - 1;\n }\n }\n }\n nodeIndex++;\n }\n if (DEV_MODE) {\n // If there was a duplicate attribute on a tag, then when the tag is\n // parsed into an element the attribute gets de-duplicated. We can detect\n // this mismatch if we haven't precisely consumed every attribute name\n // when preparing the template. This works because `attrNames` is built\n // from the template string and `attrNameIndex` comes from processing the\n // resulting DOM.\n if (attrNames.length !== attrNameIndex) {\n throw new Error(`Detected duplicate attribute bindings. This occurs if your template ` +\n `has duplicate attributes on an element tag. For example ` +\n `\"<input ?disabled=\\${true} ?disabled=\\${false}>\" contains a ` +\n `duplicate \"disabled\" attribute. The error was detected in ` +\n `the following template: \\n` +\n '`' +\n strings.join('${...}') +\n '`');\n }\n }\n // We could set walker.currentNode to another node here to prevent a memory\n // leak, but every time we prepare a template, we immediately render it\n // and re-use the walker in new TemplateInstance._clone().\n debugLogEvent &&\n debugLogEvent({\n kind: 'template prep',\n template: this,\n clonableTemplate: this.el,\n parts: this.parts,\n strings,\n });\n }\n // Overridden via `litHtmlPolyfillSupport` to provide platform support.\n /** @nocollapse */\n static createElement(html, _options) {\n const el = d.createElement('template');\n el.innerHTML = html;\n return el;\n }\n}\nfunction resolveDirective(part, value, parent = part, attributeIndex) {\n // Bail early if the value is explicitly noChange. Note, this means any\n // nested directive is still attached and is not run.\n if (value === noChange) {\n return value;\n }\n let currentDirective = attributeIndex !== undefined\n ? parent.__directives?.[attributeIndex]\n : parent.__directive;\n const nextDirectiveConstructor = isPrimitive(value)\n ? undefined\n : // This property needs to remain unminified.\n value['_$litDirective$'];\n if (currentDirective?.constructor !== nextDirectiveConstructor) {\n // This property needs to remain unminified.\n currentDirective?.['_$notifyDirectiveConnectionChanged']?.(false);\n if (nextDirectiveConstructor === undefined) {\n currentDirective = undefined;\n }\n else {\n currentDirective = new nextDirectiveConstructor(part);\n currentDirective._$initialize(part, parent, attributeIndex);\n }\n if (attributeIndex !== undefined) {\n (parent.__directives ??= [])[attributeIndex] =\n currentDirective;\n }\n else {\n parent.__directive = currentDirective;\n }\n }\n if (currentDirective !== undefined) {\n value = resolveDirective(part, currentDirective._$resolve(part, value.values), currentDirective, attributeIndex);\n }\n return value;\n}\n/**\n * An updateable instance of a Template. Holds references to the Parts used to\n * update the template instance.\n */\nclass TemplateInstance {\n constructor(template, parent) {\n this._$parts = [];\n /** @internal */\n this._$disconnectableChildren = undefined;\n this._$template = template;\n this._$parent = parent;\n }\n // Called by ChildPart parentNode getter\n get parentNode() {\n return this._$parent.parentNode;\n }\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n // This method is separate from the constructor because we need to return a\n // DocumentFragment and we don't want to hold onto it with an instance field.\n _clone(options) {\n const { el: { content }, parts: parts, } = this._$template;\n const fragment = (options?.creationScope ?? d).importNode(content, true);\n walker.currentNode = fragment;\n let node = walker.nextNode();\n let nodeIndex = 0;\n let partIndex = 0;\n let templatePart = parts[0];\n while (templatePart !== undefined) {\n if (nodeIndex === templatePart.index) {\n let part;\n if (templatePart.type === CHILD_PART) {\n part = new ChildPart(node, node.nextSibling, this, options);\n }\n else if (templatePart.type === ATTRIBUTE_PART) {\n part = new templatePart.ctor(node, templatePart.name, templatePart.strings, this, options);\n }\n else if (templatePart.type === ELEMENT_PART) {\n part = new ElementPart(node, this, options);\n }\n this._$parts.push(part);\n templatePart = parts[++partIndex];\n }\n if (nodeIndex !== templatePart?.index) {\n node = walker.nextNode();\n nodeIndex++;\n }\n }\n // We need to set the currentNode away from the cloned tree so that we\n // don't hold onto the tree even if the tree is detached and should be\n // freed.\n walker.currentNode = d;\n return fragment;\n }\n _update(values) {\n let i = 0;\n for (const part of this._$parts) {\n if (part !== undefined) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'set part',\n part,\n value: values[i],\n valueIndex: i,\n values,\n templateInstance: this,\n });\n if (part.strings !== undefined) {\n part._$setValue(values, part, i);\n // The number of values the part consumes is part.strings.length - 1\n // since values are in between template spans. We increment i by 1\n // later in the loop, so increment it by part.strings.length - 2 here\n i += part.strings.length - 2;\n }\n else {\n part._$setValue(values[i]);\n }\n }\n i++;\n }\n }\n}\nclass ChildPart {\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n // ChildParts that are not at the root should always be created with a\n // parent; only RootChildNode's won't, so they return the local isConnected\n // state\n return this._$parent?._$isConnected ?? this.__isConnected;\n }\n constructor(startNode, endNode, parent, options) {\n this.type = CHILD_PART;\n this._$committedValue = nothing;\n // The following fields will be patched onto ChildParts when required by\n // AsyncDirective\n /** @internal */\n this._$disconnectableChildren = undefined;\n this._$startNode = startNode;\n this._$endNode = endNode;\n this._$parent = parent;\n this.options = options;\n // Note __isConnected is only ever accessed on RootParts (i.e. when there is\n // no _$parent); the value on a non-root-part is \"don't care\", but checking\n // for parent would be more code\n this.__isConnected = options?.isConnected ?? true;\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n // Explicitly initialize for consistent class shape.\n this._textSanitizer = undefined;\n }\n }\n /**\n * The parent node into which the part renders its content.\n *\n * A ChildPart's content consists of a range of adjacent child nodes of\n * `.parentNode`, possibly bordered by 'marker nodes' (`.startNode` and\n * `.endNode`).\n *\n * - If both `.startNode` and `.endNode` are non-null, then the part's content\n * consists of all siblings between `.startNode` and `.endNode`, exclusively.\n *\n * - If `.startNode` is non-null but `.endNode` is null, then the part's\n * content consists of all siblings following `.startNode`, up to and\n * including the last child of `.parentNode`. If `.endNode` is non-null, then\n * `.startNode` will always be non-null.\n *\n * - If both `.endNode` and `.startNode` are null, then the part's content\n * consists of all child nodes of `.parentNode`.\n */\n get parentNode() {\n let parentNode = wrap(this._$startNode).parentNode;\n const parent = this._$parent;\n if (parent !== undefined &&\n parentNode?.nodeType === 11 /* Node.DOCUMENT_FRAGMENT */) {\n // If the parentNode is a DocumentFragment, it may be because the DOM is\n // still in the cloned fragment during initial render; if so, get the real\n // parentNode the part will be committed into by asking the parent.\n parentNode = parent.parentNode;\n }\n return parentNode;\n }\n /**\n * The part's leading marker node, if any. See `.parentNode` for more\n * information.\n */\n get startNode() {\n return this._$startNode;\n }\n /**\n * The part's trailing marker node, if any. See `.parentNode` for more\n * information.\n */\n get endNode() {\n return this._$endNode;\n }\n _$setValue(value, directiveParent = this) {\n if (DEV_MODE && this.parentNode === null) {\n throw new Error(`This \\`ChildPart\\` has no \\`parentNode\\` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's \\`innerHTML\\` or \\`textContent\\` can do this.`);\n }\n value = resolveDirective(this, value, directiveParent);\n if (isPrimitive(value)) {\n // Non-rendering child values. It's important that these do not render\n // empty text nodes to avoid issues with preventing default <slot>\n // fallback content.\n if (value === nothing || value == null || value === '') {\n if (this._$committedValue !== nothing) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit nothing to child',\n start: this._$startNode,\n end: this._$endNode,\n parent: this._$parent,\n options: this.options,\n });\n this._$clear();\n }\n this._$committedValue = nothing;\n }\n else if (value !== this._$committedValue && value !== noChange) {\n this._commitText(value);\n }\n // This property needs to remain unminified.\n }\n else if (value['_$litType$'] !== undefined) {\n this._commitTemplateResult(value);\n }\n else if (value.nodeType !== undefined) {\n if (DEV_MODE && this.options?.host === value) {\n this._commitText(`[probable mistake: rendered a template's host in itself ` +\n `(commonly caused by writing \\${this} in a template]`);\n console.warn(`Attempted to render the template host`, value, `inside itself. This is almost always a mistake, and in dev mode `, `we render some warning text. In production however, we'll `, `render it, which will usually result in an error, and sometimes `, `in the element disappearing from the DOM.`);\n return;\n }\n this._commitNode(value);\n }\n else if (isIterable(value)) {\n this._commitIterable(value);\n }\n else {\n // Fallback, will render the string representation\n this._commitText(value);\n }\n }\n _insert(node) {\n return wrap(wrap(this._$startNode).parentNode).insertBefore(node, this._$endNode);\n }\n _commitNode(value) {\n if (this._$committedValue !== value) {\n this._$clear();\n if (ENABLE_EXTRA_SECURITY_HOOKS &&\n sanitizerFactoryInternal !== noopSanitizer) {\n const parentNodeName = this._$startNode.parentNode?.nodeName;\n if (parentNodeName === 'STYLE' || parentNodeName === 'SCRIPT') {\n let message = 'Forbidden';\n if (DEV_MODE) {\n if (parentNodeName === 'STYLE') {\n message =\n `Lit does not support binding inside style nodes. ` +\n `This is a security risk, as style injection attacks can ` +\n `exfiltrate data and spoof UIs. ` +\n `Consider instead using css\\`...\\` literals ` +\n `to compose styles, and do dynamic styling with ` +\n `css custom properties, ::parts, <slot>s, ` +\n `and by mutating the DOM rather than stylesheets.`;\n }\n else {\n message =\n `Lit does not support binding inside script nodes. ` +\n `This is a security risk, as it could allow arbitrary ` +\n `code execution.`;\n }\n }\n throw new Error(message);\n }\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit node',\n start: this._$startNode,\n parent: this._$parent,\n value: value,\n options: this.options,\n });\n this._$committedValue = this._insert(value);\n }\n }\n _commitText(value) {\n // If the committed value is a primitive it means we called _commitText on\n // the previous render, and we know that this._$startNode.nextSibling is a\n // Text node. We can now just replace the text content (.data) of the node.\n if (this._$committedValue !== nothing &&\n isPrimitive(this._$committedValue)) {\n const node = wrap(this._$startNode).nextSibling;\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._textSanitizer === undefined) {\n this._textSanitizer = createSanitizer(node, 'data', 'property');\n }\n value = this._textSanitizer(value);\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node,\n value,\n options: this.options,\n });\n node.data = value;\n }\n else {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n const textNode = d.createTextNode('');\n this._commitNode(textNode);\n // When setting text content, for security purposes it matters a lot\n // what the parent is. For example, <style> and <script> need to be\n // handled with care, while <span> does not. So first we need to put a\n // text node into the document, then we can sanitize its content.\n if (this._textSanitizer === undefined) {\n this._textSanitizer = createSanitizer(textNode, 'data', 'property');\n }\n value = this._textSanitizer(value);\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node: textNode,\n value,\n options: this.options,\n });\n textNode.data = value;\n }\n else {\n this._commitNode(d.createTextNode(value));\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node: wrap(this._$startNode).nextSibling,\n value,\n options: this.options,\n });\n }\n }\n this._$committedValue = value;\n }\n _commitTemplateResult(result) {\n // This property needs to remain unminified.\n const { values, ['_$litType$']: type } = result;\n // If $litType$ is a number, result is a plain TemplateResult and we get\n // the template from the template cache. If not, result is a\n // CompiledTemplateResult and _$litType$ is a CompiledTemplate and we need\n // to create the <template> element the first time we see it.\n const template = typeof type === 'number'\n ? this._$getTemplate(result)\n : (type.el === undefined &&\n (type.el = Template.createElement(trustFromTemplateString(type.h, type.h[0]), this.options)),\n type);\n if (this._$committedValue?._$template === template) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'template updating',\n template,\n instance: this._$committedValue,\n parts: this._$committedValue._$parts,\n options: this.options,\n values,\n });\n this._$committedValue._update(values);\n }\n else {\n const instance = new TemplateInstance(template, this);\n const fragment = instance._clone(this.options);\n debugLogEvent &&\n debugLogEvent({\n kind: 'template instantiated',\n template,\n instance,\n parts: instance._$parts,\n options: this.options,\n fragment,\n values,\n });\n instance._update(values);\n debugLogEvent &&\n debugLogEvent({\n kind: 'template instantiated and updated',\n template,\n instance,\n parts: instance._$parts,\n options: this.options,\n fragment,\n values,\n });\n this._commitNode(fragment);\n this._$committedValue = instance;\n }\n }\n // Overridden via `litHtmlPolyfillSupport` to provide platform support.\n /** @internal */\n _$getTemplate(result) {\n let template = templateCache.get(result.strings);\n if (template === undefined) {\n templateCache.set(result.strings, (template = new Template(result)));\n }\n return template;\n }\n _commitIterable(value) {\n // For an Iterable, we create a new InstancePart per item, then set its\n // value to the item. This is a little bit of overhead for every item in\n // an Iterable, but it lets us recurse easily and efficiently update Arrays\n // of TemplateResults that will be commonly returned from expressions like:\n // array.map((i) => html`${i}`), by reusing existing TemplateInstances.\n // If value is an array, then the previous render was of an\n // iterable and value will contain the ChildParts from the previous\n // render. If value is not an array, clear this part and make a new\n // array for ChildParts.\n if (!isArray(this._$committedValue)) {\n this._$committedValue = [];\n this._$clear();\n }\n // Lets us keep track of how many items we stamped so we can clear leftover\n // items from a previous render\n const itemParts = this._$committedValue;\n let partIndex = 0;\n let itemPart;\n for (const item of value) {\n if (partIndex === itemParts.length) {\n // If no existing part, create a new one\n // TODO (justinfagnani): test perf impact of always creating two parts\n // instead of sharing parts between nodes\n // https://github.com/lit/lit/issues/1266\n itemParts.push((itemPart = new ChildPart(this._insert(createMarker()), this._insert(createMarker()), this, this.options)));\n }\n else {\n // Reuse an existing part\n itemPart = itemParts[partIndex];\n }\n itemPart._$setValue(item);\n partIndex++;\n }\n if (partIndex < itemParts.length) {\n // itemParts always have end nodes\n this._$clear(itemPart && wrap(itemPart._$endNode).nextSibling, partIndex);\n // Truncate the parts array so _value reflects the current state\n itemParts.length = partIndex;\n }\n }\n /**\n * Removes the nodes contained within this Part from the DOM.\n *\n * @param start Start node to clear from, for clearing a subset of the part's\n * DOM (used when truncating iterables)\n * @param from When `start` is specified, the index within the iterable from\n * which ChildParts are being removed, used for disconnecting directives in\n * those Parts.\n *\n * @internal\n */\n _$clear(start = wrap(this._$startNode).nextSibling, from) {\n this._$notifyConnectionChanged?.(false, true, from);\n while (start && start !== this._$endNode) {\n const n = wrap(start).nextSibling;\n wrap(start).remove();\n start = n;\n }\n }\n /**\n * Implementation of RootPart's `isConnected`. Note that this method\n * should only be called on `RootPart`s (the `ChildPart` returned from a\n * top-level `render()` call). It has no effect on non-root ChildParts.\n * @param isConnected Whether to set\n * @internal\n */\n setConnected(isConnected) {\n if (this._$parent === undefined) {\n this.__isConnected = isConnected;\n this._$notifyConnectionChanged?.(isConnected);\n }\n else if (DEV_MODE) {\n throw new Error('part.setConnected() may only be called on a ' +\n 'RootPart returned from render().');\n }\n }\n}\nclass AttributePart {\n get tagName() {\n return this.element.tagName;\n }\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n constructor(element, name, strings, parent, options) {\n this.type = ATTRIBUTE_PART;\n /** @internal */\n this._$committedValue = nothing;\n /** @internal */\n this._$disconnectableChildren = undefined;\n this.element = element;\n this.name = name;\n this._$parent = parent;\n this.options = options;\n if (strings.length > 2 || strings[0] !== '' || strings[1] !== '') {\n this._$committedValue = new Array(strings.length - 1).fill(new String());\n this.strings = strings;\n }\n else {\n this._$committedValue = nothing;\n }\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n this._sanitizer = undefined;\n }\n }\n /**\n * Sets the value of this part by resolving the value from possibly multiple\n * values and static strings and committing it to the DOM.\n * If this part is single-valued, `this._strings` will be undefined, and the\n * method will be called with a single value argument. If this part is\n * multi-value, `this._strings` will be defined, and the method is called\n * with the value array of the part's owning TemplateInstance, and an offset\n * into the value array from which the values should be read.\n * This method is overloaded this way to eliminate short-lived array slices\n * of the template instance values, and allow a fast-path for single-valued\n * parts.\n *\n * @param value The part value, or an array of values for multi-valued parts\n * @param valueIndex the index to start reading values from. `undefined` for\n * single-valued parts\n * @param noCommit causes the part to not commit its value to the DOM. Used\n * in hydration to prime attribute parts with their first-rendered value,\n * but not set the attribute, and in SSR to no-op the DOM operation and\n * capture the value for serialization.\n *\n * @internal\n */\n _$setValue(value, directiveParent = this, valueIndex, noCommit) {\n const strings = this.strings;\n // Whether any of the values has changed, for dirty-checking\n let change = false;\n if (strings === undefined) {\n // Single-value binding case\n value = resolveDirective(this, value, directiveParent, 0);\n change =\n !isPrimitive(value) ||\n (value !== this._$committedValue && value !== noChange);\n if (change) {\n this._$committedValue = value;\n }\n }\n else {\n // Interpolation case\n const values = value;\n value = strings[0];\n let i, v;\n for (i = 0; i < strings.length - 1; i++) {\n v = resolveDirective(this, values[valueIndex + i], directiveParent, i);\n if (v === noChange) {\n // If the user-provided value is `noChange`, use the previous value\n v = this._$committedValue[i];\n }\n change ||=\n !isPrimitive(v) || v !== this._$committedValue[i];\n if (v === nothing) {\n value = nothing;\n }\n else if (value !== nothing) {\n value += (v ?? '') + strings[i + 1];\n }\n // We always record each value, even if one is `nothing`, for future\n // change detection.\n this._$committedValue[i] = v;\n }\n }\n if (change && !noCommit) {\n this._commitValue(value);\n }\n }\n /** @internal */\n _commitValue(value) {\n if (value === nothing) {\n wrap(this.element).removeAttribute(this.name);\n }\n else {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._sanitizer === undefined) {\n this._sanitizer = sanitizerFactoryInternal(this.element, this.name, 'attribute');\n }\n value = this._sanitizer(value ?? '');\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit attribute',\n element: this.element,\n name: this.name,\n value,\n options: this.options,\n });\n wrap(this.element).setAttribute(this.name, (value ?? ''));\n }\n }\n}\nclass PropertyPart extends AttributePart {\n constructor() {\n super(...arguments);\n this.type = PROPERTY_PART;\n }\n /** @internal */\n _commitValue(value) {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._sanitizer === undefined) {\n this._sanitizer = sanitizerFactoryInternal(this.element, this.name, 'property');\n }\n value = this._sanitizer(value);\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit property',\n element: this.element,\n name: this.name,\n value,\n options: this.options,\n });\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.element[this.name] = value === nothing ? undefined : value;\n }\n}\nclass BooleanAttributePart extends AttributePart {\n constructor() {\n super(...arguments);\n this.type = BOOLEAN_ATTRIBUTE_PART;\n }\n /** @internal */\n _commitValue(value) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit boolean attribute',\n element: this.element,\n name: this.name,\n value: !!(value && value !== nothing),\n options: this.options,\n });\n wrap(this.element).toggleAttribute(this.name, !!value && value !== nothing);\n }\n}\nclass EventPart extends AttributePart {\n constructor(element, name, strings, parent, options) {\n super(element, name, strings, parent, options);\n this.type = EVENT_PART;\n if (DEV_MODE && this.strings !== undefined) {\n throw new Error(`A \\`<${element.localName}>\\` has a \\`@${name}=...\\` listener with ` +\n 'invalid content. Event listeners in templates must have exactly ' +\n 'one expression and no surrounding text.');\n }\n }\n // EventPart does not use the base _$setValue/_resolveValue implementation\n // since the dirty checking is more complex\n /** @internal */\n _$setValue(newListener, directiveParent = this) {\n newListener =\n resolveDirective(this, newListener, directiveParent, 0) ?? nothing;\n if (newListener === noChange) {\n return;\n }\n const oldListener = this._$committedValue;\n // If the new value is nothing or any options change we have to remove the\n // part as a listener.\n const shouldRemoveListener = (newListener === nothing && oldListener !== nothing) ||\n newListener.capture !==\n oldListener.capture ||\n newListener.once !==\n oldListener.once ||\n newListener.passive !==\n oldListener.passive;\n // If the new value is not nothing and we removed the listener, we have\n // to add the part as a listener.\n const shouldAddListener = newListener !== nothing &&\n (oldListener === nothing || shouldRemoveListener);\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit event listener',\n element: this.element,\n name: this.name,\n value: newListener,\n options: this.options,\n removeListener: shouldRemoveListener,\n addListener: shouldAddListener,\n oldListener,\n });\n if (shouldRemoveListener) {\n this.element.removeEventListener(this.name, this, oldListener);\n }\n if (shouldAddListener) {\n this.element.addEventListener(this.name, this, newListener);\n }\n this._$committedValue = newListener;\n }\n handleEvent(event) {\n if (typeof this._$committedValue === 'function') {\n this._$committedValue.call(this.options?.host ?? this.element, event);\n }\n else {\n this._$committedValue.handleEvent(event);\n }\n }\n}\nclass ElementPart {\n constructor(element, parent, options) {\n this.element = element;\n this.type = ELEMENT_PART;\n /** @internal */\n this._$disconnectableChildren = undefined;\n this._$parent = parent;\n this.options = options;\n }\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n _$setValue(value) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit to element binding',\n element: this.element,\n value,\n options: this.options,\n });\n resolveDirective(this, value);\n }\n}\n/**\n * END USERS SHOULD NOT RELY ON THIS OBJECT.\n *\n * Private exports for use by other Lit packages, not intended for use by\n * external users.\n *\n * We currently do not make a mangled rollup build of the lit-ssr code. In order\n * to keep a number of (otherwise private) top-level exports mangled in the\n * client side code, we export a _$LH object containing those members (or\n * helper methods for accessing private fields of those members), and then\n * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the\n * client-side code is being used in `dev` mode or `prod` mode.\n *\n * This has a unique name, to disambiguate it from private exports in\n * lit-element, which re-exports all of lit-html.\n *\n * @private\n */\nexport const _$LH = {\n // Used in lit-ssr\n _boundAttributeSuffix: boundAttributeSuffix,\n _marker: marker,\n _markerMatch: markerMatch,\n _HTML_RESULT: HTML_RESULT,\n _getTemplateHtml: getTemplateHtml,\n // Used in tests and private-ssr-support\n _TemplateInstance: TemplateInstance,\n _isIterable: isIterable,\n _resolveDirective: resolveDirective,\n _ChildPart: ChildPart,\n _AttributePart: AttributePart,\n _BooleanAttributePart: BooleanAttributePart,\n _EventPart: EventPart,\n _PropertyPart: PropertyPart,\n _ElementPart: ElementPart,\n};\n// Apply polyfills if available\nconst polyfillSupport = DEV_MODE\n ? global.litHtmlPolyfillSupportDevMode\n : global.litHtmlPolyfillSupport;\npolyfillSupport?.(Template, ChildPart);\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for lit-html usage.\n(global.litHtmlVersions ??= []).push('3.3.0');\nif (DEV_MODE && global.litHtmlVersions.length > 1) {\n queueMicrotask(() => {\n issueWarning('multiple-versions', `Multiple versions of Lit loaded. ` +\n `Loading multiple versions is not recommended.`);\n });\n}\n/**\n * Renders a value, usually a lit-html TemplateResult, to the container.\n *\n * This example renders the text \"Hello, Zoe!\" inside a paragraph tag, appending\n * it to the container `document.body`.\n *\n * ```js\n * import {html, render} from 'lit';\n *\n * const name = \"Zoe\";\n * render(html`<p>Hello, ${name}!</p>`, document.body);\n * ```\n *\n * @param value Any [renderable\n * value](https://lit.dev/docs/templates/expressions/#child-expressions),\n * typically a {@linkcode TemplateResult} created by evaluating a template tag\n * like {@linkcode html} or {@linkcode svg}.\n * @param container A DOM container to render to. The first render will append\n * the rendered value to the container, and subsequent renders will\n * efficiently update the rendered value if the same result type was\n * previously rendered there.\n * @param options See {@linkcode RenderOptions} for options documentation.\n * @see\n * {@link https://lit.dev/docs/libraries/standalone-templates/#rendering-lit-html-templates| Rendering Lit HTML Templates}\n */\nexport const render = (value, container, options) => {\n if (DEV_MODE && container == null) {\n // Give a clearer error message than\n // Uncaught TypeError: Cannot read properties of null (reading\n // '_$litPart$')\n // which reads like an internal Lit error.\n throw new TypeError(`The container to render into may not be ${container}`);\n }\n const renderId = DEV_MODE ? debugLogRenderId++ : 0;\n const partOwnerNode = options?.renderBefore ?? container;\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let part = partOwnerNode['_$litPart$'];\n debugLogEvent &&\n debugLogEvent({\n kind: 'begin render',\n id: renderId,\n value,\n container,\n options,\n part,\n });\n if (part === undefined) {\n const endNode = options?.renderBefore ?? null;\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n partOwnerNode['_$litPart$'] = part = new ChildPart(container.insertBefore(createMarker(), endNode), endNode, undefined, options ?? {});\n }\n part._$setValue(value);\n debugLogEvent &&\n debugLogEvent({\n kind: 'end render',\n id: renderId,\n value,\n container,\n options,\n part,\n });\n return part;\n};\nif (ENABLE_EXTRA_SECURITY_HOOKS) {\n render.setSanitizer = setSanitizer;\n render.createSanitizer = createSanitizer;\n if (DEV_MODE) {\n render._testOnlyClearSanitizerFactoryDoNotCallOrElse =\n _testOnlyClearSanitizerFactoryDoNotCallOrElse;\n }\n}\n//# sourceMappingURL=lit-html.js.map","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nexport const PartType = {\n ATTRIBUTE: 1,\n CHILD: 2,\n PROPERTY: 3,\n BOOLEAN_ATTRIBUTE: 4,\n EVENT: 5,\n ELEMENT: 6,\n};\n/**\n * Creates a user-facing directive function from a Directive class. This\n * function has the same parameters as the directive's render() method.\n */\nexport const directive = (c) => (...values) => ({\n // This property needs to remain unminified.\n ['_$litDirective$']: c,\n values,\n});\n/**\n * Base class for creating custom directives. Users should extend this class,\n * implement `render` and/or `update`, and then pass their subclass to\n * `directive`.\n */\nexport class Directive {\n constructor(_partInfo) { }\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n /** @internal */\n _$initialize(part, parent, attributeIndex) {\n this.__part = part;\n this._$parent = parent;\n this.__attributeIndex = attributeIndex;\n }\n /** @internal */\n _$resolve(part, props) {\n return this.update(part, props);\n }\n update(_part, props) {\n return this.render(...props);\n }\n}\n//# sourceMappingURL=directive.js.map","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport { noChange } from '../lit-html.js';\nimport { directive, Directive, PartType, } from '../directive.js';\nconst important = 'important';\n// The leading space is important\nconst importantFlag = ' !' + important;\n// How many characters to remove from a value, as a negative number\nconst flagTrim = 0 - importantFlag.length;\nclass StyleMapDirective extends Directive {\n constructor(partInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.ATTRIBUTE ||\n partInfo.name !== 'style' ||\n partInfo.strings?.length > 2) {\n throw new Error('The `styleMap` directive must be used in the `style` attribute ' +\n 'and must be the only part in the attribute.');\n }\n }\n render(styleInfo) {\n return Object.keys(styleInfo).reduce((style, prop) => {\n const value = styleInfo[prop];\n if (value == null) {\n return style;\n }\n // Convert property names from camel-case to dash-case, i.e.:\n // `backgroundColor` -> `background-color`\n // Vendor-prefixed names need an extra `-` appended to front:\n // `webkitAppearance` -> `-webkit-appearance`\n // Exception is any property name containing a dash, including\n // custom properties; we assume these are already dash-cased i.e.:\n // `--my-button-color` --> `--my-button-color`\n prop = prop.includes('-')\n ? prop\n : prop\n .replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, '-$&')\n .toLowerCase();\n return style + `${prop}:${value};`;\n }, '');\n }\n update(part, [styleInfo]) {\n const { style } = part.element;\n if (this._previousStyleProperties === undefined) {\n this._previousStyleProperties = new Set(Object.keys(styleInfo));\n return this.render(styleInfo);\n }\n // Remove old properties that no longer exist in styleInfo\n for (const name of this._previousStyleProperties) {\n // If the name isn't in styleInfo or it's null/undefined\n if (styleInfo[name] == null) {\n this._previousStyleProperties.delete(name);\n if (name.includes('-')) {\n style.removeProperty(name);\n }\n else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n style[name] = null;\n }\n }\n }\n // Add or update properties\n for (const name in styleInfo) {\n const value = styleInfo[name];\n if (value != null) {\n this._previousStyleProperties.add(name);\n const isImportant = typeof value === 'string' && value.endsWith(importantFlag);\n if (name.includes('-') || isImportant) {\n style.setProperty(name, isImportant\n ? value.slice(0, flagTrim)\n : value, isImportant ? important : '');\n }\n else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n style[name] = value;\n }\n }\n }\n return noChange;\n }\n}\n/**\n * A directive that applies CSS properties to an element.\n *\n * `styleMap` can only be used in the `style` attribute and must be the only\n * expression in the attribute. It takes the property names in the\n * {@link StyleInfo styleInfo} object and adds the properties to the inline\n * style of the element.\n *\n * Property names with dashes (`-`) are assumed to be valid CSS\n * property names and set on the element's style object using `setProperty()`.\n * Names without dashes are assumed to be camelCased JavaScript property names\n * and set on the element's style object using property assignment, allowing the\n * style object to translate JavaScript-style names to CSS property names.\n *\n * For example `styleMap({backgroundColor: 'red', 'border-top': '5px', '--size':\n * '0'})` sets the `background-color`, `border-top` and `--size` properties.\n *\n * @param styleInfo\n * @see {@link https://lit.dev/docs/templates/directives/#stylemap styleMap code samples on Lit.dev}\n */\nexport const styleMap = directive(StyleMapDirective);\n//# sourceMappingURL=style-map.js.map","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport { nothing, noChange } from '../lit-html.js';\nimport { directive, Directive, PartType } from '../directive.js';\nconst HTML_RESULT = 1;\nexport class UnsafeHTMLDirective extends Directive {\n constructor(partInfo) {\n super(partInfo);\n this._value = nothing;\n if (partInfo.type !== PartType.CHILD) {\n throw new Error(`${this.constructor.directiveName}() can only be used in child bindings`);\n }\n }\n render(value) {\n if (value === nothing || value == null) {\n this._templateResult = undefined;\n return (this._value = value);\n }\n if (value === noChange) {\n return value;\n }\n if (typeof value != 'string') {\n throw new Error(`${this.constructor.directiveName}() called with a non-string value`);\n }\n if (value === this._value) {\n return this._templateResult;\n }\n this._value = value;\n const strings = [value];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n strings.raw = strings;\n // WARNING: impersonating a TemplateResult like this is extremely\n // dangerous. Third-party directives should not do this.\n return (this._templateResult = {\n // Cast to a known set of integers that satisfy ResultType so that we\n // don't have to export ResultType and possibly encourage this pattern.\n // This property needs to remain unminified.\n ['_$litType$']: this.constructor\n .resultType,\n strings,\n values: [],\n });\n }\n}\nUnsafeHTMLDirective.directiveName = 'unsafeHTML';\nUnsafeHTMLDirective.resultType = HTML_RESULT;\n/**\n * Renders the result as HTML, rather than text.\n *\n * The values `undefined`, `null`, and `nothing`, will all result in no content\n * (empty string) being rendered.\n *\n * Note, this is unsafe to use with any user-provided input that hasn't been\n * sanitized or escaped, as it may lead to cross-site-scripting\n * vulnerabilities.\n */\nexport const unsafeHTML = directive(UnsafeHTMLDirective);\n//# sourceMappingURL=unsafe-html.js.map","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport { directive } from '../directive.js';\nimport { UnsafeHTMLDirective } from './unsafe-html.js';\nconst SVG_RESULT = 2;\nclass UnsafeSVGDirective extends UnsafeHTMLDirective {\n}\nUnsafeSVGDirective.directiveName = 'unsafeSVG';\nUnsafeSVGDirective.resultType = SVG_RESULT;\n/**\n * Renders the result as SVG, rather than text.\n *\n * The values `undefined`, `null`, and `nothing`, will all result in no content\n * (empty string) being rendered.\n *\n * Note, this is unsafe to use with any user-provided input that hasn't been\n * sanitized or escaped, as it may lead to cross-site-scripting\n * vulnerabilities.\n */\nexport const unsafeSVG = directive(UnsafeSVGDirective);\n//# sourceMappingURL=unsafe-svg.js.map","/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport { _$LH, } from './lit-html.js';\nconst { _ChildPart: ChildPart } = _$LH;\nconst ENABLE_SHADYDOM_NOPATCH = true;\nconst wrap = ENABLE_SHADYDOM_NOPATCH &&\n window.ShadyDOM?.inUse &&\n window.ShadyDOM?.noPatch === true\n ? window.ShadyDOM.wrap\n : (node) => node;\n/**\n * Tests if a value is a primitive value.\n *\n * See https://tc39.github.io/ecma262/#sec-typeof-operator\n */\nexport const isPrimitive = (value) => value === null || (typeof value != 'object' && typeof value != 'function');\nexport const TemplateResultType = {\n HTML: 1,\n SVG: 2,\n MATHML: 3,\n};\n/**\n * Tests if a value is a TemplateResult or a CompiledTemplateResult.\n */\nexport const isTemplateResult = (value, type) => type === undefined\n ? // This property needs to remain unminified.\n value?.['_$litType$'] !== undefined\n : value?.['_$litType$'] === type;\n/**\n * Tests if a value is a CompiledTemplateResult.\n */\nexport const isCompiledTemplateResult = (value) => {\n return value?.['_$litType$']?.h != null;\n};\n/**\n * Tests if a value is a DirectiveResult.\n */\nexport const isDirectiveResult = (value) => \n// This property needs to remain unminified.\nvalue?.['_$litDirective$'] !== undefined;\n/**\n * Retrieves the Directive class for a DirectiveResult\n */\nexport const getDirectiveClass = (value) => \n// This property needs to remain unminified.\nvalue?.['_$litDirective$'];\n/**\n * Tests whether a part has only a single-expression with no strings to\n * interpolate between.\n *\n * Only AttributePart and PropertyPart can have multiple expressions.\n * Multi-expression parts have a `strings` property and single-expression\n * parts do not.\n */\nexport const isSingleExpression = (part) => part.strings === undefined;\nconst createMarker = () => document.createComment('');\n/**\n * Inserts a ChildPart into the given container ChildPart's DOM, either at the\n * end of the container ChildPart, or before the optional `refPart`.\n *\n * This does not add the part to the containerPart's committed value. That must\n * be done by callers.\n *\n * @param containerPart Part within which to add the new ChildPart\n * @param refPart Part before which to add the new ChildPart; when omitted the\n * part added to the end of the `containerPart`\n * @param part Part to insert, or undefined to create a new part\n */\nexport const insertPart = (containerPart, refPart, part) => {\n const container = wrap(containerPart._$startNode).parentNode;\n const refNode = refPart === undefined ? containerPart._$endNode : refPart._$startNode;\n if (part === undefined) {\n const startNode = wrap(container).insertBefore(createMarker(), refNode);\n const endNode = wrap(container).insertBefore(createMarker(), refNode);\n part = new ChildPart(startNode, endNode, containerPart, containerPart.options);\n }\n else {\n const endNode = wrap(part._$endNode).nextSibling;\n const oldParent = part._$parent;\n const parentChanged = oldParent !== containerPart;\n if (parentChanged) {\n part._$reparentDisconnectables?.(containerPart);\n // Note that although `_$reparentDisconnectables` updates the part's\n // `_$parent` reference after unlinking from its current parent, that\n // method only exists if Disconnectables are present, so we need to\n // unconditionally set it here\n part._$parent = containerPart;\n // Since the _$isConnected getter is somewhat costly, only\n // read it once we know the subtree has directives that need\n // to be notified\n let newConnectionState;\n if (part._$notifyConnectionChanged !== undefined &&\n (newConnectionState = containerPart._$isConnected) !==\n oldParent._$isConnected) {\n part._$notifyConnectionChanged(newConnectionState);\n }\n }\n if (endNode !== refNode || parentChanged) {\n let start = part._$startNode;\n while (start !== endNode) {\n const n = wrap(start).nextSibling;\n wrap(container).insertBefore(start, refNode);\n start = n;\n }\n }\n }\n return part;\n};\n/**\n * Sets the value of a Part.\n *\n * Note that this should only be used to set/update the value of user-created\n * parts (i.e. those created using `insertPart`); it should not be used\n * by directives to set the value of the directive's container part. Directives\n * should return a value from `update`/`render` to update their part state.\n *\n * For directives that require setting their part value asynchronously, they\n * should extend `AsyncDirective` and call `this.setValue()`.\n *\n * @param part Part to set\n * @param value Value to set\n * @param index For `AttributePart`s, the index to set\n * @param directiveParent Used internally; should not be set by user\n */\nexport const setChildPartValue = (part, value, directiveParent = part) => {\n part._$setValue(value, directiveParent);\n return part;\n};\n// A sentinel value that can never appear as a part value except when set by\n// live(). Used to force a dirty-check to fail and cause a re-render.\nconst RESET_VALUE = {};\n/**\n * Sets the committed value of a ChildPart directly without triggering the\n * commit stage of the part.\n *\n * This is useful in cases where a directive needs to update the part such\n * that the next update detects a value change or not. When value is omitted,\n * the next update will be guaranteed to be detected as a change.\n *\n * @param part\n * @param value\n */\nexport const setCommittedValue = (part, value = RESET_VALUE) => (part._$committedValue = value);\n/**\n * Returns the committed value of a ChildPart.\n *\n * The committed value is used for change detection and efficient updates of\n * the part. It can differ from the value set by the template or directive in\n * cases where the template value is transformed before being committed.\n *\n * - `TemplateResult`s are committed as a `TemplateInstance`\n * - Iterables are committed as `Array<ChildPart>`\n * - All other types are committed as the template value or value returned or\n * set by a directive.\n *\n * @param part\n */\nexport const getCommittedValue = (part) => part._$committedValue;\n/**\n * Removes a ChildPart from the DOM, including any of its content.\n *\n * @param part The Part to remove\n */\nexport const removePart = (part) => {\n part._$notifyConnectionChanged?.(false, true);\n let start = part._$startNode;\n const end = wrap(part._$endNode).nextSibling;\n while (start !== end) {\n const n = wrap(start).nextSibling;\n wrap(start).remove();\n start = n;\n }\n};\nexport const clearPart = (part) => {\n part._$clear();\n};\n//# sourceMappingURL=directive-helpers.js.map","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport { noChange } from '../lit-html.js';\nimport { directive, Directive, PartType } from '../directive.js';\nimport { insertPart, getCommittedValue, removePart, setCommittedValue, setChildPartValue, } from '../directive-helpers.js';\n// Helper for generating a map of array item to its index over a subset\n// of an array (used to lazily generate `newKeyToIndexMap` and\n// `oldKeyToIndexMap`)\nconst generateMap = (list, start, end) => {\n const map = new Map();\n for (let i = start; i <= end; i++) {\n map.set(list[i], i);\n }\n return map;\n};\nclass RepeatDirective extends Directive {\n constructor(partInfo) {\n super(partInfo);\n if (partInfo.type !== PartType.CHILD) {\n throw new Error('repeat() can only be used in text expressions');\n }\n }\n _getValuesAndKeys(items, keyFnOrTemplate, template) {\n let keyFn;\n if (template === undefined) {\n template = keyFnOrTemplate;\n }\n else if (keyFnOrTemplate !== undefined) {\n keyFn = keyFnOrTemplate;\n }\n const keys = [];\n const values = [];\n let index = 0;\n for (const item of items) {\n keys[index] = keyFn ? keyFn(item, index) : index;\n values[index] = template(item, index);\n index++;\n }\n return {\n values,\n keys,\n };\n }\n render(items, keyFnOrTemplate, template) {\n return this._getValuesAndKeys(items, keyFnOrTemplate, template).values;\n }\n update(containerPart, [items, keyFnOrTemplate, template]) {\n // Old part & key lists are retrieved from the last update (which may\n // be primed by hydration)\n const oldParts = getCommittedValue(containerPart);\n const { values: newValues, keys: newKeys } = this._getValuesAndKeys(items, keyFnOrTemplate, template);\n // We check that oldParts, the committed value, is an Array as an\n // indicator that the previous value came from a repeat() call. If\n // oldParts is not an Array then this is the first render and we return\n // an array for lit-html's array handling to render, and remember the\n // keys.\n if (!Array.isArray(oldParts)) {\n this._itemKeys = newKeys;\n return newValues;\n }\n // In SSR hydration it's possible for oldParts to be an array but for us\n // to not have item keys because the update() hasn't run yet. We set the\n // keys to an empty array. This will cause all oldKey/newKey comparisons\n // to fail and execution to fall to the last nested brach below which\n // reuses the oldPart.\n const oldKeys = (this._itemKeys ??= []);\n // New part list will be built up as we go (either reused from\n // old parts or created for new keys in this update). This is\n // saved in the above cache at the end of the update.\n const newParts = [];\n // Maps from key to index for current and previous update; these\n // are generated lazily only when needed as a performance\n // optimization, since they are only required for multiple\n // non-contiguous changes in the list, which are less common.\n let newKeyToIndexMap;\n let oldKeyToIndexMap;\n // Head and tail pointers to old parts and new values\n let oldHead = 0;\n let oldTail = oldParts.length - 1;\n let newHead = 0;\n let newTail = newValues.length - 1;\n // Overview of O(n) reconciliation algorithm (general approach\n // based on ideas found in ivi, vue, snabbdom, etc.):\n //\n // * We start with the list of old parts and new values (and\n // arrays of their respective keys), head/tail pointers into\n // each, and we build up the new list of parts by updating\n // (and when needed, moving) old parts or creating new ones.\n // The initial scenario might look like this (for brevity of\n // the diagrams, the numbers in the array reflect keys\n // associated with the old parts or new values, although keys\n // and parts/values are actually stored in parallel arrays\n // indexed using the same head/tail pointers):\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [ , , , , , , ]\n // newKeys: [0, 2, 1, 4, 3, 7, 6] <- reflects the user's new\n // item order\n // newHead ^ ^ newTail\n //\n // * Iterate old & new lists from both sides, updating,\n // swapping, or removing parts at the head/tail locations\n // until neither head nor tail can move.\n //\n // * Example below: keys at head pointers match, so update old\n // part 0 in-place (no need to move it) and record part 0 in\n // the `newParts` list. The last thing we do is advance the\n // `oldHead` and `newHead` pointers (will be reflected in the\n // next diagram).\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , ] <- heads matched: update 0\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldHead\n // & newHead\n // newHead ^ ^ newTail\n //\n // * Example below: head pointers don't match, but tail\n // pointers do, so update part 6 in place (no need to move\n // it), and record part 6 in the `newParts` list. Last,\n // advance the `oldTail` and `oldHead` pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , 6] <- tails matched: update 6\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldTail\n // & newTail\n // newHead ^ ^ newTail\n //\n // * If neither head nor tail match; next check if one of the\n // old head/tail items was removed. We first need to generate\n // the reverse map of new keys to index (`newKeyToIndexMap`),\n // which is done once lazily as a performance optimization,\n // since we only hit this case if multiple non-contiguous\n // changes were made. Note that for contiguous removal\n // anywhere in the list, the head and tails would advance\n // from either end and pass each other before we get to this\n // case and removals would be handled in the final while loop\n // without needing to generate the map.\n //\n // * Example below: The key at `oldTail` was removed (no longer\n // in the `newKeyToIndexMap`), so remove that part from the\n // DOM and advance just the `oldTail` pointer.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, 2, 3, 4, 5, 6]\n // newParts: [0, , , , , , 6] <- 5 not in new map: remove\n // newKeys: [0, 2, 1, 4, 3, 7, 6] 5 and advance oldTail\n // newHead ^ ^ newTail\n //\n // * Once head and tail cannot move, any mismatches are due to\n // either new or moved items; if a new key is in the previous\n // \"old key to old index\" map, move the old part to the new\n // location, otherwise create and insert a new part. Note\n // that when moving an old part we null its position in the\n // oldParts array if it lies between the head and tail so we\n // know to skip it when the pointers get there.\n //\n // * Example below: neither head nor tail match, and neither\n // were removed; so find the `newHead` key in the\n // `oldKeyToIndexMap`, and move that old part's DOM into the\n // next head position (before `oldParts[oldHead]`). Last,\n // null the part in the `oldPart` array since it was\n // somewhere in the remaining oldParts still to be scanned\n // (between the head and tail pointers) so that we know to\n // skip that old part on future iterations.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, , , , , 6] <- stuck: update & move 2\n // newKeys: [0, 2, 1, 4, 3, 7, 6] into place and advance\n // newHead\n // newHead ^ ^ newTail\n //\n // * Note that for moves/insertions like the one above, a part\n // inserted at the head pointer is inserted before the\n // current `oldParts[oldHead]`, and a part inserted at the\n // tail pointer is inserted before `newParts[newTail+1]`. The\n // seeming asymmetry lies in the fact that new parts are\n // moved into place outside in, so to the right of the head\n // pointer are old parts, and to the right of the tail\n // pointer are new parts.\n //\n // * We always restart back from the top of the algorithm,\n // allowing matching and simple updates in place to\n // continue...\n //\n // * Example below: the head pointers once again match, so\n // simply update part 1 and record it in the `newParts`\n // array. Last, advance both head pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, , , , 6] <- heads matched: update 1\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldHead\n // & newHead\n // newHead ^ ^ newTail\n //\n // * As mentioned above, items that were moved as a result of\n // being stuck (the final else clause in the code below) are\n // marked with null, so we always advance old pointers over\n // these so we're comparing the next actual old value on\n // either end.\n //\n // * Example below: `oldHead` is null (already placed in\n // newParts), so advance `oldHead`.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6] <- old head already used:\n // newParts: [0, 2, 1, , , , 6] advance oldHead\n // newKeys: [0, 2, 1, 4, 3, 7, 6]\n // newHead ^ ^ newTail\n //\n // * Note it's not critical to mark old parts as null when they\n // are moved from head to tail or tail to head, since they\n // will be outside the pointer range and never visited again.\n //\n // * Example below: Here the old tail key matches the new head\n // key, so the part at the `oldTail` position and move its\n // DOM to the new head position (before `oldParts[oldHead]`).\n // Last, advance `oldTail` and `newHead` pointers.\n //\n // oldHead v v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, , , 6] <- old tail matches new\n // newKeys: [0, 2, 1, 4, 3, 7, 6] head: update & move 4,\n // advance oldTail & newHead\n // newHead ^ ^ newTail\n //\n // * Example below: Old and new head keys match, so update the\n // old head part in place, and advance the `oldHead` and\n // `newHead` pointers.\n //\n // oldHead v oldTail\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, 3, ,6] <- heads match: update 3\n // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance oldHead &\n // newHead\n // newHead ^ ^ newTail\n //\n // * Once the new or old pointers move past each other then all\n // we have left is additions (if old list exhausted) or\n // removals (if new list exhausted). Those are handled in the\n // final while loops at the end.\n //\n // * Example below: `oldHead` exceeded `oldTail`, so we're done\n // with the main loop. Create the remaining part and insert\n // it at the new head position, and the update is complete.\n //\n // (oldHead > oldTail)\n // oldKeys: [0, 1, -, 3, 4, 5, 6]\n // newParts: [0, 2, 1, 4, 3, 7 ,6] <- create and insert 7\n // newKeys: [0, 2, 1, 4, 3, 7, 6]\n // newHead ^ newTail\n //\n // * Note that the order of the if/else clauses is not\n // important to the algorithm, as long as the null checks\n // come first (to ensure we're always working on valid old\n // parts) and that the final else clause comes last (since\n // that's where the expensive moves occur). The order of\n // remaining clauses is just a simple guess at which cases\n // will be most common.\n //\n // * Note, we could calculate the longest\n // increasing subsequence (LIS) of old items in new position,\n // and only move those not in the LIS set. However that costs\n // O(nlogn) time and adds a bit more code, and only helps\n // make rare types of mutations require fewer moves. The\n // above handles removes, adds, reversal, swaps, and single\n // moves of contiguous items in linear time, in the minimum\n // number of moves. As the number of multiple moves where LIS\n // might help approaches a random shuffle, the LIS\n // optimization becomes less helpful, so it seems not worth\n // the code at this point. Could reconsider if a compelling\n // case arises.\n while (oldHead <= oldTail && newHead <= newTail) {\n if (oldParts[oldHead] === null) {\n // `null` means old part at head has already been used\n // below; skip\n oldHead++;\n }\n else if (oldParts[oldTail] === null) {\n // `null` means old part at tail has already been used\n // below; skip\n oldTail--;\n }\n else if (oldKeys[oldHead] === newKeys[newHead]) {\n // Old head matches new head; update in place\n newParts[newHead] = setChildPartValue(oldParts[oldHead], newValues[newHead]);\n oldHead++;\n newHead++;\n }\n else if (oldKeys[oldTail] === newKeys[newTail]) {\n // Old tail matches new tail; update in place\n newParts[newTail] = setChildPartValue(oldParts[oldTail], newValues[newTail]);\n oldTail--;\n newTail--;\n }\n else if (oldKeys[oldHead] === newKeys[newTail]) {\n // Old head matches new tail; update and move to new tail\n newParts[newTail] = setChildPartValue(oldParts[oldHead], newValues[newTail]);\n insertPart(containerPart, newParts[newTail + 1], oldParts[oldHead]);\n oldHead++;\n newTail--;\n }\n else if (oldKeys[oldTail] === newKeys[newHead]) {\n // Old tail matches new head; update and move to new head\n newParts[newHead] = setChildPartValue(oldParts[oldTail], newValues[newHead]);\n insertPart(containerPart, oldParts[oldHead], oldParts[oldTail]);\n oldTail--;\n newHead++;\n }\n else {\n if (newKeyToIndexMap === undefined) {\n // Lazily generate key-to-index maps, used for removals &\n // moves below\n newKeyToIndexMap = generateMap(newKeys, newHead, newTail);\n oldKeyToIndexMap = generateMap(oldKeys, oldHead, oldTail);\n }\n if (!newKeyToIndexMap.has(oldKeys[oldHead])) {\n // Old head is no longer in new list; remove\n removePart(oldParts[oldHead]);\n oldHead++;\n }\n else if (!newKeyToIndexMap.has(oldKeys[oldTail])) {\n // Old tail is no longer in new list; remove\n removePart(oldParts[oldTail]);\n oldTail--;\n }\n else {\n // Any mismatches at this point are due to additions or\n // moves; see if we have an old part we can reuse and move\n // into place\n const oldIndex = oldKeyToIndexMap.get(newKeys[newHead]);\n const oldPart = oldIndex !== undefined ? oldParts[oldIndex] : null;\n if (oldPart === null) {\n // No old part for this value; create a new one and\n // insert it\n const newPart = insertPart(containerPart, oldParts[oldHead]);\n setChildPartValue(newPart, newValues[newHead]);\n newParts[newHead] = newPart;\n }\n else {\n // Reuse old part\n newParts[newHead] = setChildPartValue(oldPart, newValues[newHead]);\n insertPart(containerPart, oldParts[oldHead], oldPart);\n // This marks the old part as having been used, so that\n // it will be skipped in the first two checks above\n oldParts[oldIndex] = null;\n }\n newHead++;\n }\n }\n }\n // Add parts for any remaining new values\n while (newHead <= newTail) {\n // For all remaining additions, we insert before last new\n // tail, since old pointers are no longer valid\n const newPart = insertPart(containerPart, newParts[newTail + 1]);\n setChildPartValue(newPart, newValues[newHead]);\n newParts[newHead++] = newPart;\n }\n // Remove any remaining unused old parts\n while (oldHead <= oldTail) {\n const oldPart = oldParts[oldHead++];\n if (oldPart !== null) {\n removePart(oldPart);\n }\n }\n // Save order of new parts for next round\n this._itemKeys = newKeys;\n // Directly set part value, bypassing it's dirty-checking\n setCommittedValue(containerPart, newParts);\n return noChange;\n }\n}\n/**\n * A directive that repeats a series of values (usually `TemplateResults`)\n * generated from an iterable, and updates those items efficiently when the\n * iterable changes based on user-provided `keys` associated with each item.\n *\n * Note that if a `keyFn` is provided, strict key-to-DOM mapping is maintained,\n * meaning previous DOM for a given key is moved into the new position if\n * needed, and DOM will never be reused with values for different keys (new DOM\n * will always be created for new keys). This is generally the most efficient\n * way to use `repeat` since it performs minimum unnecessary work for insertions\n * and removals.\n *\n * The `keyFn` takes two parameters, the item and its index, and returns a unique key value.\n *\n * ```js\n * html`\n * <ol>\n * ${repeat(this.items, (item) => item.id, (item, index) => {\n * return html`<li>${index}: ${item.name}</li>`;\n * })}\n * </ol>\n * `\n * ```\n *\n * **Important**: If providing a `keyFn`, keys *must* be unique for all items in a\n * given call to `repeat`. The behavior when two or more items have the same key\n * is undefined.\n *\n * If no `keyFn` is provided, this directive will perform similar to mapping\n * items to values, and DOM will be reused against potentially different items.\n */\nexport const repeat = directive(RepeatDirective);\n//# sourceMappingURL=repeat.js.map","import { LitElement, html, css } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nexport\n@customElement('linear-progress')\nclass LinearProgress extends LitElement {\n /** Progress value between 0 and 1, or undefined for indeterminate */\n @property({ type: Number })\n value?: number\n\n static styles = css`\n :host {\n display: inline-block;\n width: var(--progress-width, 200px);\n height: var(--progress-height, 8px);\n background-color: var(--progress-background, #e0e0e0);\n border-radius: var(--progress-radius, 4px);\n overflow: hidden;\n position: absolute;\n border: 0.5px solid var(--progress-border-color, #ccc);\n }\n\n .bar {\n height: 100%;\n background-color: var(--progress-color, #3b82f6);\n transition: width 0.3s ease;\n }\n\n /* Indeterminate animation */\n .indeterminate {\n position: absolute;\n width: 30%;\n height: 100%;\n background-color: var(--progress-color, #3b82f6);\n animation: indeterminate-slide 1.2s infinite ease-in-out;\n }\n\n @keyframes indeterminate-slide {\n 0% {\n left: -30%;\n width: 30%;\n }\n 50% {\n left: 35%;\n width: 30%;\n }\n 100% {\n left: 100%;\n width: 30%;\n }\n }\n `\n\n render() {\n return html`\n ${this.value !== undefined\n ? html`<div class=\"bar\" style=\"width: ${this.value * 100}%;\"></div>`\n : html`<div class=\"indeterminate\"></div>`}\n `\n }\n}\n","import { html, css, LitElement, PropertyValues, nothing } from 'lit'\nimport { property, query, state } from 'lit/decorators.js'\nimport { styleMap } from 'lit/directives/style-map.js'\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js'\nimport {\n InputData,\n Modifier,\n Overlay,\n ProgressItem,\n ProgressOverlay,\n TextItem,\n TextOverlay\n} from './definition-schema.js'\nimport { repeat } from 'lit/directives/repeat.js'\nimport './linear-progress.js'\n\ntype Theme = {\n theme_name: string\n theme_object: any\n}\nexport class WidgetImage extends LitElement {\n @property({ type: Object })\n inputData?: InputData\n\n @property({ type: Object })\n theme?: Theme\n\n @state() private themeBgColor?: string\n @state() private themeTitleColor?: string\n @state() private themeSubtitleColor?: string\n @state() private previewUrl?: string\n @state() private inlineSvg?: string\n\n @state() private modifier?: Modifier\n\n constructor() {\n super()\n this.getModifier = this.getModifier.bind(this)\n }\n\n @query('#base-layer')\n private baseLayer!: any\n\n version: string = 'versionplaceholder'\n\n update(changedProperties: Map<string, any>) {\n if (changedProperties.has('inputData')) {\n this.transform()\n if (!this.modifier) this.getModifier()\n }\n if (changedProperties.has('theme')) {\n this.registerTheme(this.theme)\n }\n super.update(changedProperties)\n }\n\n protected firstUpdated(_changedProperties: PropertyValues): void {\n this.registerTheme(this.theme)\n\n const ro = new ResizeObserver(this.getModifier)\n ro.observe(this)\n }\n\n registerTheme(theme?: Theme) {\n const cssTextColor = getComputedStyle(this).getPropertyValue('--re-text-color').trim()\n const cssBgColor = getComputedStyle(this).getPropertyValue('--re-tile-background-color').trim()\n this.themeBgColor = cssBgColor || this.theme?.theme_object?.backgroundColor\n this.themeTitleColor = cssTextColor || this.theme?.theme_object?.title?.textStyle?.color\n this.themeSubtitleColor =\n cssTextColor || this.theme?.theme_object?.title?.subtextStyle?.color || this.themeTitleColor\n }\n\n private handleFileChange(ev: Event) {\n const input = ev.target as HTMLInputElement\n const file = input.files?.[0]\n if (!file) return\n // Revoke previous object URL\n if (this.previewUrl) URL.revokeObjectURL(this.previewUrl)\n this.previewUrl = URL.createObjectURL(file)\n this.dispatchEvent(\n new CustomEvent('overlay-file-selected', {\n detail: { file, name: file.name, size: file.size, type: file.type, url: this.previewUrl },\n bubbles: true,\n composed: true\n })\n )\n }\n\n transform() {\n this.inlineSvg = undefined\n if (!this.inputData?.image) {\n this.previewUrl = undefined\n return\n }\n const raw = this.inputData.image.trim()\n\n // Dynamically load progress bar element if needed\n // if (this.inputData?.overlays?.some((o) => o.layerType === 'progress')) {\n // import('./linear-progress.js')\n // }\n\n // Inline SVG markup (optionally starting with an XML declaration or other preamble)\n const trimmed = raw.replace(/^\\uFEFF/, '').trimStart()\n\n // Find the actual <svg ...>...</svg> block even if preceded by <?xml ...?> or <!DOCTYPE ...>\n const svgBlockMatch = trimmed.match(/<svg[\\s\\S]*?<\\/svg>/i)\n\n if (svgBlockMatch) {\n this.inlineSvg = svgBlockMatch[0].trim()\n this.previewUrl = undefined\n return\n }\n\n // Full data URL (already encoded)\n if (/^data:image\\/svg\\+xml[,;]/.test(raw)) {\n // It's an SVG data URL; we could theoretically decode, but safer to keep as src\n this.previewUrl = raw\n return\n }\n if (/^data:image\\/[a-zA-Z.+-]+;base64,/.test(raw)) {\n this.previewUrl = raw\n return\n }\n\n // Bare base64 string (heuristic)\n if (/^[A-Za-z0-9+/]+=*$/.test(raw) && raw.length > 100) {\n this.previewUrl = `data:image/*;base64,${raw}`\n return\n }\n\n // Absolute URL\n try {\n new URL(raw)\n this.previewUrl = raw\n return\n } catch {\n // Relative path\n if (/^([./]|\\/)/.test(raw)) {\n this.previewUrl = raw\n return\n }\n }\n\n // Fallback\n this.previewUrl = undefined\n }\n\n private async getModifier() {\n if (!this.baseLayer) return\n const rect = this.baseLayer.getBoundingClientRect()\n if (!rect) return\n\n const containerRect = this.baseLayer.parentElement?.getBoundingClientRect()\n if (!containerRect) return\n\n let intrinsicWidth: number | undefined\n let intrinsicHeight: number | undefined\n\n if (this.baseLayer instanceof HTMLImageElement) {\n // For <img>\n intrinsicWidth = this.baseLayer.naturalWidth\n intrinsicHeight = this.baseLayer.naturalHeight\n } else {\n const innerSvg = this.baseLayer.querySelector('svg')\n\n if (innerSvg) {\n // For <svg>\n const viewBox = innerSvg.viewBox.baseVal\n console.log(viewBox)\n if (viewBox && viewBox.width > 0 && viewBox.height > 0) {\n intrinsicWidth = viewBox.width\n intrinsicHeight = viewBox.height\n } else {\n // fallback to width/height attributes if set\n const widthAttr = this.baseLayer.getAttribute('width')\n const heightAttr = this.baseLayer.getAttribute('height')\n if (widthAttr && heightAttr) {\n intrinsicWidth = parseFloat(widthAttr)\n intrinsicHeight = parseFloat(heightAttr)\n }\n }\n }\n }\n\n if (!intrinsicWidth || !intrinsicHeight) return\n\n // Actual visible area of the image/svg\n const scaleX = rect.width / intrinsicWidth\n const scaleY = rect.height / intrinsicHeight\n const scale = Math.min(scaleX, scaleY)\n\n const visibleWidth = intrinsicWidth * scale\n const visibleHeight = intrinsicHeight * scale\n\n const xOffset = (containerRect.width - visibleWidth) / 2\n const yOffset = (containerRect.height - visibleHeight) / 2\n\n this.modifier = { scaler: scale, xOffset, yOffset, visibleWidth, visibleHeight }\n }\n\n private getOverlayItemPosition(relX: number, relY: number, modifier: Modifier) {\n return {\n left: relX * modifier.visibleWidth,\n top: relY * modifier.visibleHeight\n }\n }\n\n renderText(_overlay: Overlay, item: TextItem, modifier: Modifier) {\n const overlay = _overlay as TextOverlay\n const pos = this.getOverlayItemPosition(item.relXPos, item.relYPos, modifier)\n if (!pos) return nothing\n\n const precision = overlay.textStyle?.precision ?? 1\n let value = item.data\n const numericValue = Number(value)\n let color = '#333'\n if (!Number.isNaN(numericValue)) {\n if (typeof precision === 'number' && precision >= 0) {\n value = numericValue.toFixed(precision)\n const sectionIndex =\n overlay.sections?.sectionLimits.findIndex((limit: number) => numericValue <= limit) ?? -2\n color = (sectionIndex >= 1 ? overlay.sections?.colors[sectionIndex - 1] : '#333') ?? '#333'\n }\n }\n\n const styles = {\n 'font-size': (overlay.textStyle.fontSize ?? 14) * modifier.scaler + 'px',\n color,\n 'background-color': overlay.textStyle.backgroundColor,\n 'font-weight': overlay.textStyle.fontWeight,\n left: `${pos.left}px`,\n top: `${pos.top}px`,\n 'border-radius': 10 * modifier.scaler + 'px',\n 'transform-origin': '50% 50%',\n transform: `translate(-50%, -50%)`,\n padding: `${6 * modifier.scaler}px ${12 * modifier.scaler}px`\n }\n\n return html`\n <div class=\"overlay-item\" style=${styleMap(styles)}>${item.prefix}${value}${item.suffix}</div>\n `\n }\n\n renderProgress(_overlay: Overlay, item: ProgressItem, modifier: Modifier) {\n const overlay = _overlay as ProgressOverlay\n const pos = this.getOverlayItemPosition(item.relXPos, item.relYPos, modifier)\n if (!pos) return nothing\n\n const sectionIndex =\n overlay.sections?.sectionLimits.findIndex((limit: number) => Number(item.data) <= limit) ?? -2\n const sectionColor = sectionIndex >= 1 ? overlay.sections?.colors[sectionIndex - 1] : undefined\n const styles = {\n '--progress-color': sectionColor ?? '#333',\n '--progress-width': (overlay.progressStyle?.width ?? 10) * modifier.scaler + 'px',\n '--progress-height': (overlay.progressStyle?.height ?? 100) * modifier.scaler + 'px',\n '--progress-background': overlay.progressStyle?.backgroundColor ?? '#fff',\n 'border-radius': 10 * modifier.scaler + 'px',\n 'transform-origin': '50% 50%',\n transform: `translate(-50%, -50%) rotate(${overlay.progressStyle?.rotate ?? 0}deg)`,\n left: `${pos.left}px`,\n top: `${pos.top}px`\n }\n // Derive percentage based on item.data within overlay.sections min/max.\n // Supports several possible property names; falls back to sectionLimits array.\n const rawValue = Number(item.data)\n const sections: any = overlay.sections ?? {}\n const min = Math.min(...sections.sectionLimits.map(Number))\n const max = Math.max(...sections.sectionLimits.map(Number))\n let percent = max === min ? 0 : (rawValue - min) / (max - min)\n percent = Math.min(1, Math.max(0, percent))\n // percent now holds the normalized 0-100 percentage for rawValue\n return html` <linear-progress .value=${percent} style=${styleMap(styles)}></linear-progress> `\n }\n\n renderLayer(overlay: Overlay) {\n const modifier = this.modifier\n if (!modifier) return nothing\n const containerStyles = {\n left: modifier.xOffset + 'px',\n top: modifier.yOffset + 'px',\n width: modifier.visibleWidth + 'px',\n height: modifier.visibleHeight + 'px'\n }\n return html`<div\n class=\"overlay\"\n style=${styleMap(containerStyles)}\n type=\"${overlay.layerType}\"\n name=\"${overlay.layerName}\"\n >\n ${overlay.layerType === 'text'\n ? this.renderTextLayer(overlay as TextOverlay)\n : this.renderProgressLayer(overlay as ProgressOverlay)}\n </div>`\n }\n\n renderTextLayer(overlay: TextOverlay) {\n const modifier = this.modifier\n if (!modifier) return nothing\n return html`${repeat(\n overlay.textPins ?? [],\n (item, idx) => idx,\n (item) => html`${this.renderText(overlay, item, modifier)}`\n )}`\n }\n\n renderProgressLayer(overlay: ProgressOverlay) {\n const modifier = this.modifier\n if (!modifier) return nothing\n return html`${repeat(\n overlay.progressPins ?? [],\n (item, idx) => idx,\n (item) => html`${this.renderProgress(overlay, item, modifier)}`\n )}`\n }\n\n static styles = css`\n :host {\n display: block;\n font-family: sans-serif;\n box-sizing: border-box;\n margin: auto;\n container-type: size;\n }\n\n .paging:not([active]) {\n display: none !important;\n }\n\n .wrapper {\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n padding: 2cqh 2cqw;\n box-sizing: border-box;\n }\n\n .svg-wrapper {\n width: 100%;\n height: 100%;\n overflow: hidden;\n position: relative;\n }\n\n .svg-wrapper svg {\n width: 100%;\n height: 100%;\n display: block;\n /* preserveAspectRatio inside SVG handles \"contain\"-like scaling */\n }\n\n h3 {\n margin: 0;\n max-width: 300px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n p {\n margin: 10px 0 0 0;\n max-width: 300px;\n font-size: 14px;\n line-height: 17px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .img-container {\n flex: 1;\n box-sizing: border-box;\n overflow: hidden;\n position: relative;\n }\n\n img {\n width: 100%; /* Set the width of the container */\n height: 100%;\n }\n .no-data {\n font-size: 20px;\n display: flex;\n height: 100%;\n width: 100%;\n text-align: center;\n align-items: center;\n justify-content: center;\n }\n\n .overlay {\n position: absolute;\n pointer-events: none;\n }\n\n .overlay-item {\n position: absolute;\n pointer-events: auto;\n }\n `\n\n render() {\n const hasImage = !!this.inlineSvg || !!this.previewUrl\n return html`\n <div class=\"wrapper\" style=\"background-color: ${this.themeBgColor}\">\n <h3 class=\"paging\" ?active=${this.inputData?.title} style=\"color: ${this.themeTitleColor}\">\n ${this.inputData?.title}\n </h3>\n <p\n class=\"paging\"\n ?active=${this.inputData?.subTitle}\n style=\"color: ${this.themeSubtitleColor}\"\n >\n ${this.inputData?.subTitle}\n </p>\n\n <div class=\"paging no-data\" ?active=${!hasImage}>No Image</div>\n <div class=\"img-container paging\" ?active=\"${hasImage}\">\n ${this.inlineSvg\n ? html`<div id=\"base-layer\" class=\"svg-wrapper\">${unsafeSVG(this.inlineSvg)}</div>`\n : this.previewUrl\n ? html`<img\n id=\"base-layer\"\n @load=\"${this.getModifier}\"\n src=\"${this.previewUrl}\"\n alt=\"Image Widget\"\n style=\"object-fit: ${this.inputData?.stretchToFit ? 'fill' : 'contain'}\"\n />`\n : ''}\n ${repeat(\n this.inputData?.overlays ?? [],\n (o) => o.layerName,\n (o) => html` ${this.renderLayer(o)} `\n )}\n </div>\n </div>\n `\n }\n}\nwindow.customElements.define('widget-overlay-versionplaceholder', WidgetImage)\n"],"names":["global","debugLogEvent","event","issueWarning","code","warning","wrap","node","trustedTypes","policy","s","identityFunction","value","noopSanitizer","_node","_name","_type","createSanitizer","name","type","sanitizerFactoryInternal","boundAttributeSuffix","marker","markerMatch","nodeMarker","d","createMarker","isPrimitive","isArray","isIterable","SPACE_CHAR","ATTR_VALUE_CHAR","NAME_CHAR","textEndRegex","COMMENT_START","TAG_NAME","DYNAMIC_TAG_NAME","commentEndRegex","comment2EndRegex","tagEndRegex","ENTIRE_MATCH","ATTRIBUTE_NAME","SPACES_AND_EQUALS","QUOTE_CHAR","singleQuoteAttrEndRegex","doubleQuoteAttrEndRegex","rawTextElement","SVG_RESULT","MATHML_RESULT","ATTRIBUTE_PART","CHILD_PART","PROPERTY_PART","BOOLEAN_ATTRIBUTE_PART","EVENT_PART","ELEMENT_PART","COMMENT_PART","noChange","nothing","templateCache","walker","trustFromTemplateString","tsa","stringFromTSA","message","getTemplateHtml","strings","l","attrNames","html","rawTextEndRegex","regex","i","attrNameEndIndex","attrName","lastIndex","match","end","htmlResult","Template","options","nodeIndex","attrNameIndex","partCount","parts","wrapper","tag","m","realName","statics","PropertyPart","BooleanAttributePart","EventPart","AttributePart","_options","el","resolveDirective","part","parent","attributeIndex","currentDirective","nextDirectiveConstructor","TemplateInstance","template","content","fragment","partIndex","templatePart","ChildPart","ElementPart","values","ChildPart$1","startNode","endNode","parentNode","directiveParent","parentNodeName","textNode","result","instance","itemParts","itemPart","item","start","from","n","isConnected","element","valueIndex","noCommit","change","v","newListener","oldListener","shouldRemoveListener","shouldAddListener","_$LH","polyfillSupport","PartType","directive","c","Directive","_partInfo","props","_part","important","importantFlag","flagTrim","StyleMapDirective","partInfo","styleInfo","style","prop","isImportant","styleMap","HTML_RESULT","UnsafeHTMLDirective","UnsafeSVGDirective","unsafeSVG","insertPart","containerPart","refPart","container","refNode","oldParent","parentChanged","newConnectionState","setChildPartValue","RESET_VALUE","setCommittedValue","getCommittedValue","removePart","generateMap","list","map","RepeatDirective","items","keyFnOrTemplate","keyFn","keys","index","oldParts","newValues","newKeys","oldKeys","newParts","newKeyToIndexMap","oldKeyToIndexMap","oldHead","oldTail","newHead","newTail","oldIndex","oldPart","newPart","repeat","LinearProgress","LitElement","css","__decorateClass","property","customElement","_WidgetImage","changedProperties","_changedProperties","theme","cssTextColor","cssBgColor","ev","file","raw","svgBlockMatch","rect","containerRect","intrinsicWidth","intrinsicHeight","innerSvg","viewBox","widthAttr","heightAttr","scaleX","scaleY","scale","visibleWidth","visibleHeight","xOffset","yOffset","relX","relY","modifier","_overlay","overlay","pos","precision","numericValue","color","sectionIndex","limit","styles","rawValue","sections","min","max","percent","containerStyles","idx","hasImage","o","WidgetImage","state","query"],"mappings":";;AAUA,MAAMA,IAAS,YAMTC,IACA,CAACC,MAAU;AAGT,EAFmBF,EACd,yBAILA,EAAO,cAAc,IAAI,YAAY,aAAa;AAAA,IAC9C,QAAQE;AAAA,EACpB,CAAS,CAAC;AACN;AAMJ,IAAIC;AAEAH,EAAO,sBAAsB,oBAAI,IAAG,GAMpCG,IAAe,CAACC,GAAMC,MAAY;AAC9B,EAAAA,KAAWD,IACL,4BAA4BA,CAAI,2BAChC,IACF,CAACJ,EAAO,kBAAkB,IAAIK,CAAO,KACrC,CAACL,EAAO,kBAAkB,IAAII,CAAI,MAClC,QAAQ,KAAKC,CAAO,GACpBL,EAAO,kBAAkB,IAAIK,CAAO;AAE5C,GACA,eAAe,MAAM;AACjB,EAAAF,EAAa,YAAY,qDAAqD;AAClF,CAAC;AAEL,MAAMG,IACFN,EAAO,UAAU,SACjBA,EAAO,UAAU,YAAY,KAC3BA,EAAO,SAAS,OAChB,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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAvSb,IAAMkD,IAAN9C;AAEHH,EAAA;AAAA,EADCC,GAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GADjBgD,EAET,WAAA,WAAA;AAGAjD,EAAA;AAAA,EADCC,GAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAJjBgD,EAKT,WAAA,OAAA;AAEiBjD,EAAA;AAAA,EAAhBkD,EAAA;AAAM,GAPED,EAOQ,WAAA,cAAA;AACAjD,EAAA;AAAA,EAAhBkD,EAAA;AAAM,GARED,EAQQ,WAAA,iBAAA;AACAjD,EAAA;AAAA,EAAhBkD,EAAA;AAAM,GATED,EASQ,WAAA,oBAAA;AACAjD,EAAA;AAAA,EAAhBkD,EAAA;AAAM,GAVED,EAUQ,WAAA,YAAA;AACAjD,EAAA;AAAA,EAAhBkD,EAAA;AAAM,GAXED,EAWQ,WAAA,WAAA;AAEAjD,EAAA;AAAA,EAAhBkD,EAAA;AAAM,GAbED,EAaQ,WAAA,UAAA;AAQTjD,EAAA;AAAA,EADPmD,GAAM,aAAa;AAAA,GApBXF,EAqBD,WAAA,WAAA;AA6YZ,OAAO,eAAe,OAAO,wBAAqCA,CAAW;","x_google_ignoreList":[0,1,2,3,4,5,6]}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Webcomponent widget-overlay following open-wc recommendations",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "widget-overlay",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.8",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/widget-overlay.js",
|
|
9
9
|
"types": "dist/src/widget-overlay.d.ts",
|
package/src/widget-overlay.ts
CHANGED
|
@@ -319,6 +319,7 @@ export class WidgetImage extends LitElement {
|
|
|
319
319
|
font-family: sans-serif;
|
|
320
320
|
box-sizing: border-box;
|
|
321
321
|
margin: auto;
|
|
322
|
+
container-type: size;
|
|
322
323
|
}
|
|
323
324
|
|
|
324
325
|
.paging:not([active]) {
|
|
@@ -330,7 +331,7 @@ export class WidgetImage extends LitElement {
|
|
|
330
331
|
flex-direction: column;
|
|
331
332
|
height: 100%;
|
|
332
333
|
width: 100%;
|
|
333
|
-
padding:
|
|
334
|
+
padding: 2cqh 2cqw;
|
|
334
335
|
box-sizing: border-box;
|
|
335
336
|
}
|
|
336
337
|
|