Skip to content

Instantly share code, notes, and snippets.

@regevbr
Last active December 25, 2023 22:10
Show Gist options
  • Save regevbr/047092e6f76fb2777a4ed8f4fe698bb8 to your computer and use it in GitHub Desktop.
Save regevbr/047092e6f76fb2777a4ed8f4fe698bb8 to your computer and use it in GitHub Desktop.
mini-climate-card-bundle.js
;
(function () {
"use strict";
function _taggedTemplateLiteral(strings, raw) {
if (!raw) {
raw = strings.slice(0);
}
return Object.freeze(Object.defineProperties(strings, {
raw: {
value: Object.freeze(raw)
}
}));
}
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37, _templateObject38, _templateObject39, _templateObject40, _templateObject41, _templateObject42, _templateObject43, _templateObject44, _templateObject45, _templateObject46, _templateObject47, _templateObject48, _templateObject49, _templateObject50, _templateObject51, _templateObject52, _templateObject53, _templateObject54, _templateObject55, _templateObject56, _templateObject57, _templateObject58, _templateObject59, _templateObject60, _templateObject61, _templateObject62, _templateObject63, _templateObject64, _templateObject65, _templateObject66, _templateObject67, _templateObject68, _templateObject69, _templateObject70, _templateObject71, _templateObject72, _templateObject73, _templateObject74, _templateObject75, _templateObject76, _templateObject77, _templateObject78, _templateObject79, _templateObject80, _templateObject81, _templateObject82, _templateObject83, _templateObject84, _templateObject85, _templateObject86, _templateObject87, _templateObject88, _templateObject89, _templateObject90;
function ownKeys(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
if (r) {
o = o.filter(function (r) {
return Object.getOwnPropertyDescriptor(e, r).enumerable;
});
}
t.push.apply(t, o);
}
return t;
}
function _objectSpread(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
if (r % 2) {
ownKeys(Object(t), true).forEach(function (r) {
_defineProperty(e, r, t[r]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(e, Object.getOwnPropertyDescriptors(t));
} else {
ownKeys(Object(t)).forEach(function (r) {
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
});
}
}
return e;
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
if (typeof key === "symbol") {
return key;
} else {
return String(key);
}
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) {
return input;
}
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") {
return res;
}
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _asyncToGenerator(fn) {
return function () {
var self = this;
var args = arguments;
return new Promise(function (resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
(function (factory) {
if (typeof define === 'function' && define.amd) {
define(factory);
} else {
factory();
}
})(function () {
'use strict';
var _Symbol$metadata, _global$h$litProperty, _global$h$reactiveEle, _global$g$ShadyDOM, _global$g$ShadyDOM2, _global$g$litHtmlVers, _globalThis$litElemen, _globalThis$litElemen2;
(function () {
function h(b) {
var c = 0;
return function () {
if (c < b.length) {
return {
done: false,
value: b[c++]
};
} else {
return {
done: true
};
}
};
}
function l(b) {
var c = "undefined" != typeof Symbol && Symbol.iterator && b[Symbol.iterator];
if (c) {
return c.call(b);
} else {
return {
next: h(b)
};
}
}
function m(b) {
if (!(b instanceof Array)) {
b = l(b);
for (var c, a = []; !(c = b.next()).done;) {
a.push(c.value);
}
b = a;
}
return b;
}
var n = "function" == typeof Object.create ? Object.create : function (b) {
function c() {}
c.prototype = b;
return new c();
};
function p(b) {
b = ["object" == typeof globalThis && globalThis, b, "object" == typeof window && window, "object" == typeof self && self, "object" == typeof global && global];
for (var c = 0; c < b.length; ++c) {
var a = b[c];
if (a && a.Math == Math) {
return a;
}
}
throw Error("Cannot find global object");
}
var t;
var q = p(this);
var r = function () {
function b() {
function a() {}
Reflect.construct(a, [], function () {});
return new a() instanceof a;
}
if ("undefined" != typeof Reflect && Reflect.construct) {
if (b()) {
return Reflect.construct;
}
var c = Reflect.construct;
return function (a, d, e) {
a = c(a, d);
if (e) {
Reflect.setPrototypeOf(a, e.prototype);
}
return a;
};
}
return function (a, d, e) {
if (void 0 === e) {
e = a;
}
e = n(e.prototype || Object.prototype);
return Function.prototype.apply.call(a, e, d) || e;
};
}();
if ("function" == typeof Object.setPrototypeOf) {
t = Object.setPrototypeOf;
} else {
var u;
a: {
var v = {
a: true
};
var w = {};
try {
w.__proto__ = v;
u = w.a;
break a;
} catch (b) {}
u = false;
}
if (u) {
t = function t(b, c) {
b.__proto__ = c;
if (b.__proto__ !== c) {
throw new TypeError(b + " is not extensible");
}
return b;
};
} else {
t = null;
}
}
var x = t;
if (!ShadowRoot.prototype.createElement) {
var y = window.HTMLElement;
var A = window.customElements.define;
var B = window.customElements.get;
var C = window.customElements;
var D = new WeakMap();
var E = new WeakMap();
var F = new WeakMap();
var G = new WeakMap();
window.CustomElementRegistry = function () {
this.l = new Map();
this.o = new Map();
this.i = new Map();
this.h = new Map();
};
window.CustomElementRegistry.prototype.define = function (b, c) {
b = b.toLowerCase();
if (void 0 !== this.j(b)) {
throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': the name \"" + b + '" has already been used with this registry');
}
if (void 0 !== this.o.get(c)) {
throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");
}
var a = c.prototype.attributeChangedCallback;
var d = new Set(c.observedAttributes || []);
H(c, d, a);
a = {
g: c,
connectedCallback: c.prototype.connectedCallback,
disconnectedCallback: c.prototype.disconnectedCallback,
adoptedCallback: c.prototype.adoptedCallback,
attributeChangedCallback: a,
formAssociated: c.formAssociated,
formAssociatedCallback: c.prototype.formAssociatedCallback,
formDisabledCallback: c.prototype.formDisabledCallback,
formResetCallback: c.prototype.formResetCallback,
formStateRestoreCallback: c.prototype.formStateRestoreCallback,
observedAttributes: d
};
this.l.set(b, a);
this.o.set(c, a);
d = B.call(C, b);
if (!d) {
d = I(b);
A.call(C, b, d);
}
if (this === window.customElements) {
F.set(c, a);
a.s = d;
}
if (d = this.h.get(b)) {
this.h.delete(b);
d = l(d);
for (var e = d.next(); !e.done; e = d.next()) {
e = e.value;
E.delete(e);
J(e, a, true);
}
}
a = this.i.get(b);
if (void 0 !== a) {
a.resolve(c);
this.i.delete(b);
}
return c;
};
window.CustomElementRegistry.prototype.upgrade = function () {
K.push(this);
C.upgrade.apply(C, arguments);
K.pop();
};
window.CustomElementRegistry.prototype.get = function (b) {
var c;
if (null == (c = this.l.get(b))) {
0;
return;
} else {
return c.g;
}
};
window.CustomElementRegistry.prototype.j = function (b) {
return this.l.get(b);
};
window.CustomElementRegistry.prototype.whenDefined = function (b) {
var c = this.j(b);
if (void 0 !== c) {
return Promise.resolve(c.g);
}
var a = this.i.get(b);
if (void 0 === a) {
a = {};
a.promise = new Promise(function (d) {
return a.resolve = d;
});
this.i.set(b, a);
}
return a.promise;
};
window.CustomElementRegistry.prototype.m = function (b, c, a) {
var d = this.h.get(c);
if (!d) {
this.h.set(c, d = new Set());
}
if (a) {
d.add(b);
} else {
d.delete(b);
}
};
var L;
window.HTMLElement = function () {
var b = L;
if (b) {
L = void 0;
return b;
}
var c = F.get(this.constructor);
if (!c) {
throw new TypeError("Illegal constructor (custom element class must be registered with global customElements registry to be newable)");
}
b = Reflect.construct(y, [], c.s);
Object.setPrototypeOf(b, this.constructor.prototype);
D.set(b, c);
return b;
};
window.HTMLElement.prototype = y.prototype;
var I = function I(b) {
function c() {
var a = Reflect.construct(y, [], this.constructor);
Object.setPrototypeOf(a, HTMLElement.prototype);
a: {
var d = a.getRootNode();
if (!(d === document || d instanceof ShadowRoot)) {
d = K[K.length - 1];
if (d instanceof CustomElementRegistry) {
var e = d;
break a;
}
d = d.getRootNode();
if (!(d === document || d instanceof ShadowRoot)) {
d = (null == (e = G.get(d)) ? void 0 : e.getRootNode()) || document;
}
}
e = d.customElements;
}
e = e || window.customElements;
if (d = e.j(b)) {
J(a, d);
} else {
E.set(a, e);
}
return a;
}
q.Object.defineProperty(c, "formAssociated", {
configurable: true,
enumerable: true,
get() {
return true;
}
});
c.prototype.connectedCallback = function () {
var a = D.get(this);
if (a) {
if (a.connectedCallback) {
a.connectedCallback.apply(this, arguments);
}
} else {
E.get(this).m(this, b, true);
}
};
c.prototype.disconnectedCallback = function () {
var a = D.get(this);
if (a) {
if (a.disconnectedCallback) {
a.disconnectedCallback.apply(this, arguments);
}
} else {
E.get(this).m(this, b, false);
}
};
c.prototype.adoptedCallback = function () {
var a, d;
if (!(null == (a = D.get(this)) || null == (d = a.adoptedCallback))) {
d.apply(this, arguments);
}
};
c.prototype.formAssociatedCallback = function () {
var a = D.get(this);
if (a && a.formAssociated) {
var d;
if (!(null == a || null == (d = a.formAssociatedCallback))) {
d.apply(this, arguments);
}
}
};
c.prototype.formDisabledCallback = function () {
var a = D.get(this);
if (null == a ? 0 : a.formAssociated) {
var d;
if (!(null == a || null == (d = a.formDisabledCallback))) {
d.apply(this, arguments);
}
}
};
c.prototype.formResetCallback = function () {
var a = D.get(this);
if (null == a ? 0 : a.formAssociated) {
var d;
if (!(null == a || null == (d = a.formResetCallback))) {
d.apply(this, arguments);
}
}
};
c.prototype.formStateRestoreCallback = function () {
var a = D.get(this);
if (null == a ? 0 : a.formAssociated) {
var d;
if (!(null == a || null == (d = a.formStateRestoreCallback))) {
d.apply(this, arguments);
}
}
};
return c;
};
var H = function H(b, c, a) {
if (0 !== c.size && void 0 !== a) {
var d = b.prototype.setAttribute;
if (d) {
b.prototype.setAttribute = function (f, k) {
f = f.toLowerCase();
if (c.has(f)) {
var z = this.getAttribute(f);
d.call(this, f, k);
a.call(this, f, z, k);
} else {
d.call(this, f, k);
}
};
}
var e = b.prototype.removeAttribute;
if (e) {
b.prototype.removeAttribute = function (f) {
f = f.toLowerCase();
if (c.has(f)) {
var k = this.getAttribute(f);
e.call(this, f);
a.call(this, f, k, null);
} else {
e.call(this, f);
}
};
}
var g = b.prototype.toggleAttribute;
if (g) {
b.prototype.toggleAttribute = function (f, k) {
f = f.toLowerCase();
if (c.has(f)) {
var z = this.getAttribute(f);
g.call(this, f, k);
k = this.getAttribute(f);
a.call(this, f, z, k);
} else {
g.call(this, f, k);
}
};
}
}
};
var M = function M(b) {
var c = Object.getPrototypeOf(b);
if (c !== window.HTMLElement) {
if (c === y) {
return Object.setPrototypeOf(b, window.HTMLElement);
} else {
return M(c);
}
}
};
var J = function J(b, c, a) {
if (void 0 === a) {
a = false;
} else {
a = a;
}
Object.setPrototypeOf(b, c.g.prototype);
D.set(b, c);
L = b;
try {
new c.g();
} catch (d) {
M(c.g);
new c.g();
}
if (c.attributeChangedCallback) {
c.observedAttributes.forEach(function (d) {
if (b.hasAttribute(d)) {
c.attributeChangedCallback.call(b, d, null, b.getAttribute(d));
}
});
}
if (a && c.connectedCallback && b.isConnected) {
c.connectedCallback.call(b);
}
};
var N = Element.prototype.attachShadow;
Element.prototype.attachShadow = function (b) {
var c = N.apply(this, arguments);
if (b.customElements) {
c.customElements = b.customElements;
}
return c;
};
var K = [document];
var O = function O(b, c, a) {
var d = (a ? Object.getPrototypeOf(a) : b.prototype)[c];
b.prototype[c] = function () {
K.push(this);
var e = d.apply(a || this, arguments);
if (void 0 !== e) {
G.set(e, this);
}
K.pop();
return e;
};
};
O(ShadowRoot, "createElement", document);
O(ShadowRoot, "importNode", document);
O(Element, "insertAdjacentHTML");
var P = function P(b) {
var c = Object.getOwnPropertyDescriptor(b.prototype, "innerHTML");
Object.defineProperty(b.prototype, "innerHTML", Object.assign({}, c, {
set(a) {
K.push(this);
c.set.call(this, a);
K.pop();
}
}));
};
P(Element);
P(ShadowRoot);
Object.defineProperty(window, "customElements", {
value: new CustomElementRegistry(),
configurable: true,
writable: true
});
if (window.ElementInternals && window.ElementInternals.prototype.setFormValue) {
var Q = new WeakMap();
var R = HTMLElement.prototype.attachInternals;
var methods = ["setFormValue", "setValidity", "checkValidity", "reportValidity"];
HTMLElement.prototype.attachInternals = function (b) {
for (var c = [], a = 0; a < arguments.length; ++a) {
c[a] = arguments[a];
}
c = R.call.apply(R, [this].concat(m(c)));
Q.set(c, this);
return c;
};
methods.forEach(function (b) {
var c = window.ElementInternals.prototype;
var a = c[b];
c[b] = function (d) {
for (var e = [], g = 0; g < arguments.length; ++g) {
e[g] = arguments[g];
}
g = Q.get(this);
if (true === D.get(g).formAssociated) {
if (null == a) {
0;
return;
} else {
return a.call.apply(a, [this].concat(m(e)));
}
}
throw new DOMException("Failed to execute " + a + " on 'ElementInternals': The target element is not a form-associated custom element.");
};
});
var RadioNodeList = function RadioNodeList(b) {
var c = r(Array, [].concat(m(b)), this.constructor);
c.h = b;
return c;
};
var S = RadioNodeList;
var T = Array;
S.prototype = n(T.prototype);
S.prototype.constructor = S;
if (x) {
x(S, T);
} else {
for (var U in T) if ("prototype" != U) {
if (Object.defineProperties) {
var V = Object.getOwnPropertyDescriptor(T, U);
if (V) {
Object.defineProperty(S, U, V);
}
} else {
S[U] = T[U];
}
}
}
S.u = T.prototype;
q.Object.defineProperty(RadioNodeList.prototype, "value", {
configurable: true,
enumerable: true,
get() {
var b;
return (null == (b = this.h.find(function (c) {
return true === c.checked;
})) ? void 0 : b.value) || "";
}
});
var HTMLFormControlsCollection = function HTMLFormControlsCollection(b) {
var c = this;
var a = new Map();
b.forEach(function (d, e) {
var g = d.getAttribute("name");
var f = a.get(g) || [];
c[+e] = d;
f.push(d);
a.set(g, f);
});
this.length = b.length;
a.forEach(function (d, e) {
if (d) {
if (1 === d.length) {
c[e] = d[0];
} else {
c[e] = new RadioNodeList(d);
}
}
});
};
HTMLFormControlsCollection.prototype.namedItem = function (b) {
return this[b];
};
var W = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, "elements");
Object.defineProperty(HTMLFormElement.prototype, "elements", {
get() {
var b = W.get.call(this, []);
var c = [];
b = l(b);
for (var a = b.next(); !a.done; a = b.next()) {
a = a.value;
var d = D.get(a);
if (!(d && true !== d.formAssociated)) {
c.push(a);
}
}
return new HTMLFormControlsCollection(c);
}
});
}
}
}).call(typeof globalThis === 'object' ? globalThis : window);
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var NODE_MODE$4 = false;
var global$i = globalThis;
var supportsAdoptingStyleSheets$4 = global$i.ShadowRoot && (global$i.ShadyCSS === undefined || global$i.ShadyCSS.nativeShadow) && 'adoptedStyleSheets' in Document.prototype && 'replace' in CSSStyleSheet.prototype;
var constructionToken$4 = Symbol();
var cssTagCache$4 = new WeakMap();
class CSSResult$4 {
constructor(cssText, strings, safeToken) {
this['_$cssResult$'] = true;
if (safeToken !== constructionToken$4) {
throw new Error('CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');
}
this.cssText = cssText;
this._strings = strings;
}
get styleSheet() {
var styleSheet = this._styleSheet;
var strings = this._strings;
if (supportsAdoptingStyleSheets$4 && styleSheet === undefined) {
var cacheable = strings !== undefined && strings.length === 1;
if (cacheable) {
styleSheet = cssTagCache$4.get(strings);
}
if (styleSheet === undefined) {
(this._styleSheet = styleSheet = new CSSStyleSheet()).replaceSync(this.cssText);
if (cacheable) {
cssTagCache$4.set(strings, styleSheet);
}
}
}
return styleSheet;
}
toString() {
return this.cssText;
}
}
var textFromCSSResult$3 = value => {
if (value['_$cssResult$'] === true) {
return value.cssText;
} else if (typeof value === 'number') {
return value;
} else {
throw new Error("Value passed to 'css' function must be a 'css' function result: " + "".concat(value, ". Use 'unsafeCSS' to pass non-literal values, but take care ") + "to ensure page security.");
}
};
var unsafeCSS$4 = value => new CSSResult$4(typeof value === 'string' ? value : String(value), undefined, constructionToken$4);
var css$3 = function css$3(strings) {
for (var _len = arguments.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
values[_key - 1] = arguments[_key];
}
var cssText = strings.length === 1 ? strings[0] : values.reduce((acc, v, idx) => acc + textFromCSSResult$3(v) + strings[idx + 1], strings[0]);
return new CSSResult$4(cssText, strings, constructionToken$4);
};
var adoptStyles$4 = (renderRoot, styles) => {
if (supportsAdoptingStyleSheets$4) {
renderRoot.adoptedStyleSheets = styles.map(s => s instanceof CSSStyleSheet ? s : s.styleSheet);
} else {
for (var s of styles) {
var _style = document.createElement('style');
var nonce = global$i['litNonce'];
if (nonce !== undefined) {
_style.setAttribute('nonce', nonce);
}
_style.textContent = s.cssText;
renderRoot.appendChild(_style);
}
}
};
var cssResultFromStyleSheet$4 = sheet => {
var cssText = '';
for (var rule of sheet.cssRules) {
cssText += rule.cssText;
}
return unsafeCSS$4(cssText);
};
var getCompatibleStyle$4 = supportsAdoptingStyleSheets$4 || NODE_MODE$4 ? s => s : s => s instanceof CSSStyleSheet ? cssResultFromStyleSheet$4(s) : s;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var {
is,
defineProperty,
getOwnPropertyDescriptor,
getOwnPropertyNames,
getOwnPropertySymbols,
getPrototypeOf
} = Object;
var global$h = globalThis;
var issueWarning$e;
var trustedTypes$9 = global$h.trustedTypes;
var emptyStringForBooleanAttribute$8 = trustedTypes$9 ? trustedTypes$9.emptyScript : '';
var polyfillSupport$e = global$h.reactiveElementPolyfillSupportDevMode;
{
var _global$h$litIssuedWa, _global$h$ShadyDOM;
var issuedWarnings = (_global$h$litIssuedWa = global$h.litIssuedWarnings) !== null && _global$h$litIssuedWa !== void 0 ? _global$h$litIssuedWa : global$h.litIssuedWarnings = new Set();
issueWarning$e = (code, warning) => {
warning += " See https://lit.dev/msg/".concat(code, " for more information.");
if (!issuedWarnings.has(warning)) {
console.warn(warning);
issuedWarnings.add(warning);
}
};
issueWarning$e('dev-mode', "Lit is in dev mode. Not recommended for production!");
if ((_global$h$ShadyDOM = global$h.ShadyDOM) !== null && _global$h$ShadyDOM !== void 0 && _global$h$ShadyDOM.inUse && polyfillSupport$e === undefined) {
issueWarning$e('polyfill-support-missing', "Shadow DOM is being polyfilled via `ShadyDOM` but " + "the `polyfill-support` module has not been loaded.");
}
}
var debugLogEvent$9 = event => {
var shouldEmit = global$h.emitLitDebugLogEvents;
if (!shouldEmit) {
return;
}
global$h.dispatchEvent(new CustomEvent('lit-debug', {
detail: event
}));
};
var JSCompiler_renameProperty$5 = (prop, _obj) => prop;
var defaultConverter$4 = {
toAttribute(value, type) {
switch (type) {
case Boolean:
if (value) {
value = emptyStringForBooleanAttribute$8;
} else {
value = null;
}
break;
case Object:
case Array:
if (value == null) {
value = value;
} else {
value = JSON.stringify(value);
}
break;
}
return value;
},
fromAttribute(value, type) {
var fromValue = value;
switch (type) {
case Boolean:
fromValue = value !== null;
break;
case Number:
if (value === null) {
fromValue = null;
} else {
fromValue = Number(value);
}
break;
case Object:
case Array:
try {
fromValue = JSON.parse(value);
} catch (e) {
fromValue = null;
}
break;
}
return fromValue;
}
};
var notEqual$4 = (value, old) => !is(value, old);
var defaultPropertyDeclaration$4 = {
attribute: true,
type: String,
converter: defaultConverter$4,
reflect: false,
hasChanged: notEqual$4
};
if (!Symbol.metadata) {
Symbol.metadata = Symbol('metadata');
}
if (!global$h.litPropertyMetadata) {
global$h.litPropertyMetadata = new WeakMap();
}
class ReactiveElement$4 extends HTMLElement {
static addInitializer(initializer) {
var _this$_initializers;
this.__prepare();
((_this$_initializers = this._initializers) !== null && _this$_initializers !== void 0 ? _this$_initializers : this._initializers = []).push(initializer);
}
static get observedAttributes() {
this.finalize();
return this.__attributeToPropertyMap && [...this.__attributeToPropertyMap.keys()];
}
static createProperty(name) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultPropertyDeclaration$4;
if (options.state) {
options.attribute = false;
}
this.__prepare();
this.elementProperties.set(name, options);
if (!options.noAccessor) {
var key = Symbol.for("".concat(String(name), " (@property() cache)"));
var descriptor = this.getPropertyDescriptor(name, key, options);
if (descriptor !== undefined) {
defineProperty(this.prototype, name, descriptor);
}
}
}
static getPropertyDescriptor(name, key, options) {
var _getOwnPropertyDescri;
var {
get,
set
} = (_getOwnPropertyDescri = getOwnPropertyDescriptor(this.prototype, name)) !== null && _getOwnPropertyDescri !== void 0 ? _getOwnPropertyDescri : {
get() {
return this[key];
},
set(v) {
this[key] = v;
}
};
if (get == null) {
var _getOwnPropertyDescri2;
if ('value' in ((_getOwnPropertyDescri2 = getOwnPropertyDescriptor(this.prototype, name)) !== null && _getOwnPropertyDescri2 !== void 0 ? _getOwnPropertyDescri2 : {})) {
throw new Error("Field ".concat(JSON.stringify(String(name)), " on ") + "".concat(this.name, " was declared as a reactive property ") + "but it's actually declared as a value on the prototype. " + "Usually this is due to using @property or @state on a method.");
}
issueWarning$e('reactive-property-without-getter', "Field ".concat(JSON.stringify(String(name)), " on ") + "".concat(this.name, " was declared as a reactive property ") + "but it does not have a getter. This will be an error in a " + "future version of Lit.");
}
return {
get() {
if (get === null || get === void 0) {
0;
return;
} else {
return get.call(this);
}
},
set(value) {
var oldValue = get === null || get === void 0 ? void 0 : get.call(this);
set.call(this, value);
this.requestUpdate(name, oldValue, options);
},
configurable: true,
enumerable: true
};
}
static getPropertyOptions(name) {
var _this$elementProperti;
if ((_this$elementProperti = this.elementProperties.get(name)) !== null && _this$elementProperti !== void 0) {
return _this$elementProperti;
} else {
return defaultPropertyDeclaration$4;
}
}
static __prepare() {
if (this.hasOwnProperty(JSCompiler_renameProperty$5('elementProperties'))) {
return;
}
var superCtor = getPrototypeOf(this);
superCtor.finalize();
if (superCtor._initializers !== undefined) {
this._initializers = [...superCtor._initializers];
}
this.elementProperties = new Map(superCtor.elementProperties);
}
static finalize() {
if (this.hasOwnProperty(JSCompiler_renameProperty$5('finalized'))) {
return;
}
this.finalized = true;
this.__prepare();
if (this.hasOwnProperty(JSCompiler_renameProperty$5('properties'))) {
var props = this.properties;
var propKeys = [...getOwnPropertyNames(props), ...getOwnPropertySymbols(props)];
for (var p of propKeys) {
this.createProperty(p, props[p]);
}
}
var metadata = this[Symbol.metadata];
if (metadata !== null) {
var properties = litPropertyMetadata.get(metadata);
if (properties !== undefined) {
for (var [_p, options] of properties) {
this.elementProperties.set(_p, options);
}
}
}
this.__attributeToPropertyMap = new Map();
for (var [_p2, _options2] of this.elementProperties) {
var attr = this.__attributeNameForProperty(_p2, _options2);
if (attr !== undefined) {
this.__attributeToPropertyMap.set(attr, _p2);
}
}
this.elementStyles = this.finalizeStyles(this.styles);
{
if (this.hasOwnProperty('createProperty')) {
issueWarning$e('no-override-create-property', 'Overriding ReactiveElement.createProperty() is deprecated. ' + 'The override will not be called with standard decorators');
}
if (this.hasOwnProperty('getPropertyDescriptor')) {
issueWarning$e('no-override-get-property-descriptor', 'Overriding ReactiveElement.getPropertyDescriptor() is deprecated. ' + 'The override will not be called with standard decorators');
}
}
}
static finalizeStyles(styles) {
var elementStyles = [];
if (Array.isArray(styles)) {
var set = new Set(styles.flat(Infinity).reverse());
for (var s of set) {
elementStyles.unshift(getCompatibleStyle$4(s));
}
} else if (styles !== undefined) {
elementStyles.push(getCompatibleStyle$4(styles));
}
return elementStyles;
}
static __attributeNameForProperty(name, options) {
var attribute = options.attribute;
if (attribute === false) {
return undefined;
} else {
if (typeof attribute === 'string') {
return attribute;
} else {
if (typeof name === 'string') {
return name.toLowerCase();
} else {
return undefined;
}
}
}
}
constructor() {
super();
this.__instanceProperties = undefined;
this.isUpdatePending = false;
this.hasUpdated = false;
this.__reflectingProperty = null;
this.__initialize();
}
__initialize() {
var _this$constructor$_in;
this.__updatePromise = new Promise(res => this.enableUpdating = res);
this._$changedProperties = new Map();
this.__saveInstanceProperties();
this.requestUpdate();
if (!((_this$constructor$_in = this.constructor._initializers) === null || _this$constructor$_in === void 0)) {
_this$constructor$_in.forEach(i => i(this));
}
}
addController(controller) {
var _this$__controllers;
((_this$__controllers = this.__controllers) !== null && _this$__controllers !== void 0 ? _this$__controllers : this.__controllers = new Set()).add(controller);
if (this.renderRoot !== undefined && this.isConnected) {
var _controller$hostConne;
if (!((_controller$hostConne = controller.hostConnected) === null || _controller$hostConne === void 0)) {
_controller$hostConne.call(controller);
}
}
}
removeController(controller) {
var _this$__controllers2;
if (!((_this$__controllers2 = this.__controllers) === null || _this$__controllers2 === void 0)) {
_this$__controllers2.delete(controller);
}
}
__saveInstanceProperties() {
var instanceProperties = new Map();
var elementProperties = this.constructor.elementProperties;
for (var p of elementProperties.keys()) {
if (this.hasOwnProperty(p)) {
instanceProperties.set(p, this[p]);
delete this[p];
}
}
if (instanceProperties.size > 0) {
this.__instanceProperties = instanceProperties;
}
}
createRenderRoot() {
var _this$shadowRoot;
var renderRoot = (_this$shadowRoot = this.shadowRoot) !== null && _this$shadowRoot !== void 0 ? _this$shadowRoot : this.attachShadow(this.constructor.shadowRootOptions);
adoptStyles$4(renderRoot, this.constructor.elementStyles);
return renderRoot;
}
connectedCallback() {
var _this$renderRoot, _this$__controllers3;
if (!this.renderRoot) {
this.renderRoot = this.createRenderRoot();
}
this.enableUpdating(true);
if (!((_this$__controllers3 = this.__controllers) === null || _this$__controllers3 === void 0)) {
_this$__controllers3.forEach(c => {
var _c$hostConnected;
if ((_c$hostConnected = c.hostConnected) === null || _c$hostConnected === void 0) {
0;
return;
} else {
return _c$hostConnected.call(c);
}
});
}
}
enableUpdating(_requestedUpdate) {}
disconnectedCallback() {
var _this$__controllers4;
if (!((_this$__controllers4 = this.__controllers) === null || _this$__controllers4 === void 0)) {
_this$__controllers4.forEach(c => {
var _c$hostDisconnected;
if ((_c$hostDisconnected = c.hostDisconnected) === null || _c$hostDisconnected === void 0) {
0;
return;
} else {
return _c$hostDisconnected.call(c);
}
});
}
}
attributeChangedCallback(name, _old, value) {
this._$attributeToProperty(name, value);
}
__propertyToAttribute(name, value) {
var elemProperties = this.constructor.elementProperties;
var options = elemProperties.get(name);
var attr = this.constructor.__attributeNameForProperty(name, options);
if (attr !== undefined && options.reflect === true) {
var _options$converter;
var converter = ((_options$converter = options.converter) === null || _options$converter === void 0 ? void 0 : _options$converter.toAttribute) !== undefined ? options.converter : defaultConverter$4;
var attrValue = converter.toAttribute(value, options.type);
if (this.constructor.enabledWarnings.includes('migration') && attrValue === undefined) {
issueWarning$e('undefined-attribute-value', "The attribute value for the ".concat(name, " property is ") + "undefined on element ".concat(this.localName, ". The attribute will be ") + "removed, but in the previous version of `ReactiveElement`, " + "the attribute would not have changed.");
}
this.__reflectingProperty = name;
if (attrValue == null) {
this.removeAttribute(attr);
} else {
this.setAttribute(attr, attrValue);
}
this.__reflectingProperty = null;
}
}
_$attributeToProperty(name, value) {
var ctor = this.constructor;
var propName = ctor.__attributeToPropertyMap.get(name);
if (propName !== undefined && this.__reflectingProperty !== propName) {
var _options$converter2;
var options = ctor.getPropertyOptions(propName);
var converter = typeof options.converter === 'function' ? {
fromAttribute: options.converter
} : ((_options$converter2 = options.converter) === null || _options$converter2 === void 0 ? void 0 : _options$converter2.fromAttribute) !== undefined ? options.converter : defaultConverter$4;
this.__reflectingProperty = propName;
this[propName] = converter.fromAttribute(value, options.type);
this.__reflectingProperty = null;
}
}
requestUpdate(name, oldValue, options) {
var initial = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var initialValue = arguments.length > 4 ? arguments[4] : undefined;
if (name !== undefined) {
var _options3, _options$hasChanged;
if (!options) {
options = this.constructor.getPropertyOptions(name);
}
var hasChanged = (_options$hasChanged = options.hasChanged) !== null && _options$hasChanged !== void 0 ? _options$hasChanged : notEqual$4;
var newValue = initial ? initialValue : this[name];
if (hasChanged(newValue, oldValue)) {
this._$changeProperty(name, oldValue, options);
} else {
return;
}
}
if (this.isUpdatePending === false) {
this.__updatePromise = this.__enqueueUpdate();
}
}
_$changeProperty(name, oldValue, options) {
if (!this._$changedProperties.has(name)) {
this._$changedProperties.set(name, oldValue);
}
if (options.reflect === true && this.__reflectingProperty !== name) {
var _this$__reflectingPro;
((_this$__reflectingPro = this.__reflectingProperties) !== null && _this$__reflectingPro !== void 0 ? _this$__reflectingPro : this.__reflectingProperties = new Set()).add(name);
}
}
__enqueueUpdate() {
var _this2 = this;
return _asyncToGenerator(function* () {
_this2.isUpdatePending = true;
try {
yield _this2.__updatePromise;
} catch (e) {
Promise.reject(e);
}
var result = _this2.scheduleUpdate();
if (result != null) {
yield result;
}
return !_this2.isUpdatePending;
})();
}
scheduleUpdate() {
var result = this.performUpdate();
if (this.constructor.enabledWarnings.includes('async-perform-update') && typeof (result === null || result === void 0 ? void 0 : result.then) === 'function') {
issueWarning$e('async-perform-update', "Element ".concat(this.localName, " returned a Promise from performUpdate(). ") + "This behavior is deprecated and will be removed in a future " + "version of ReactiveElement.");
}
return result;
}
performUpdate() {
if (!this.isUpdatePending) {
return;
}
if (!(debugLogEvent$9 === null || debugLogEvent$9 === void 0)) {
debugLogEvent$9({
kind: 'update'
});
}
if (!this.hasUpdated) {
var _this$renderRoot2;
if (!this.renderRoot) {
this.renderRoot = this.createRenderRoot();
}
{
var ctor = this.constructor;
var shadowedProperties = [...ctor.elementProperties.keys()].filter(p => this.hasOwnProperty(p) && p in getPrototypeOf(this));
if (shadowedProperties.length) {
throw new Error("The following properties on element ".concat(this.localName, " will not ") + "trigger updates as expected because they are set using class " + "fields: ".concat(shadowedProperties.join(', '), ". ") + "Native class fields and some compiled output will overwrite " + "accessors used for detecting changes. See " + "https://lit.dev/msg/class-field-shadowing " + "for more information.");
}
}
if (this.__instanceProperties) {
for (var [p, value] of this.__instanceProperties) {
this[p] = value;
}
this.__instanceProperties = undefined;
}
var elementProperties = this.constructor.elementProperties;
if (elementProperties.size > 0) {
for (var [_p3, options] of elementProperties) {
if (options.wrapped === true && !this._$changedProperties.has(_p3) && this[_p3] !== undefined) {
this._$changeProperty(_p3, this[_p3], options);
}
}
}
}
var shouldUpdate = false;
var changedProperties = this._$changedProperties;
try {
shouldUpdate = this.shouldUpdate(changedProperties);
if (shouldUpdate) {
var _this$__controllers5;
this.willUpdate(changedProperties);
if (!((_this$__controllers5 = this.__controllers) === null || _this$__controllers5 === void 0)) {
_this$__controllers5.forEach(c => {
var _c$hostUpdate;
if ((_c$hostUpdate = c.hostUpdate) === null || _c$hostUpdate === void 0) {
0;
return;
} else {
return _c$hostUpdate.call(c);
}
});
}
this.update(changedProperties);
} else {
this.__markUpdated();
}
} catch (e) {
shouldUpdate = false;
this.__markUpdated();
throw e;
}
if (shouldUpdate) {
this._$didUpdate(changedProperties);
}
}
willUpdate(_changedProperties) {}
_$didUpdate(changedProperties) {
var _this$__controllers6;
if (!((_this$__controllers6 = this.__controllers) === null || _this$__controllers6 === void 0)) {
_this$__controllers6.forEach(c => {
var _c$hostUpdated;
if ((_c$hostUpdated = c.hostUpdated) === null || _c$hostUpdated === void 0) {
0;
return;
} else {
return _c$hostUpdated.call(c);
}
});
}
if (!this.hasUpdated) {
this.hasUpdated = true;
this.firstUpdated(changedProperties);
}
this.updated(changedProperties);
if (this.isUpdatePending && this.constructor.enabledWarnings.includes('change-in-update')) {
issueWarning$e('change-in-update', "Element ".concat(this.localName, " scheduled an update ") + "(generally because a property was set) " + "after an update completed, causing a new update to be scheduled. " + "This is inefficient and should be avoided unless the next update " + "can only be scheduled as a side effect of the previous update.");
}
}
__markUpdated() {
this._$changedProperties = new Map();
this.isUpdatePending = false;
}
get updateComplete() {
return this.getUpdateComplete();
}
getUpdateComplete() {
return this.__updatePromise;
}
shouldUpdate(_changedProperties) {
return true;
}
update(_changedProperties) {
if (this.__reflectingProperties) {
this.__reflectingProperties = this.__reflectingProperties.forEach(p => this.__propertyToAttribute(p, this[p]));
}
this.__markUpdated();
}
updated(_changedProperties) {}
firstUpdated(_changedProperties) {}
}
ReactiveElement$4.elementStyles = [];
ReactiveElement$4.shadowRootOptions = {
mode: 'open'
};
ReactiveElement$4[JSCompiler_renameProperty$5('elementProperties')] = new Map();
ReactiveElement$4[JSCompiler_renameProperty$5('finalized')] = new Map();
if (!(polyfillSupport$e === null || polyfillSupport$e === void 0)) {
polyfillSupport$e({
ReactiveElement: ReactiveElement$4
});
}
{
ReactiveElement$4.enabledWarnings = ['change-in-update', 'async-perform-update'];
var ensureOwnWarnings = function ensureOwnWarnings(ctor) {
if (!ctor.hasOwnProperty(JSCompiler_renameProperty$5('enabledWarnings'))) {
ctor.enabledWarnings = ctor.enabledWarnings.slice();
}
};
ReactiveElement$4.enableWarning = function (warning) {
ensureOwnWarnings(this);
if (!this.enabledWarnings.includes(warning)) {
this.enabledWarnings.push(warning);
}
};
ReactiveElement$4.disableWarning = function (warning) {
ensureOwnWarnings(this);
var i = this.enabledWarnings.indexOf(warning);
if (i >= 0) {
this.enabledWarnings.splice(i, 1);
}
};
}
((_global$h$reactiveEle = global$h.reactiveElementVersions) !== null && _global$h$reactiveEle !== void 0 ? _global$h$reactiveEle : global$h.reactiveElementVersions = []).push('2.0.2');
if (global$h.reactiveElementVersions.length > 1) {
issueWarning$e('multiple-versions', "Multiple versions of Lit loaded. Loading multiple versions " + "is not recommended.");
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var global$g = globalThis;
var debugLogEvent$8 = event => {
var shouldEmit = global$g.emitLitDebugLogEvents;
if (!shouldEmit) {
return;
}
global$g.dispatchEvent(new CustomEvent('lit-debug', {
detail: event
}));
};
var debugLogRenderId$4 = 0;
var issueWarning$d;
{
var _global$g$litIssuedWa;
if (!global$g.litIssuedWarnings) {
global$g.litIssuedWarnings = new Set();
}
issueWarning$d = (code, warning) => {
if (code) {
warning += " See https://lit.dev/msg/".concat(code, " for more information.");
} else {
warning += '';
}
if (!global$g.litIssuedWarnings.has(warning)) {
console.warn(warning);
global$g.litIssuedWarnings.add(warning);
}
};
issueWarning$d('dev-mode', "Lit is in dev mode. Not recommended for production!");
}
var wrap$4 = (_global$g$ShadyDOM = global$g.ShadyDOM) !== null && _global$g$ShadyDOM !== void 0 && _global$g$ShadyDOM.inUse && ((_global$g$ShadyDOM2 = global$g.ShadyDOM) === null || _global$g$ShadyDOM2 === void 0 ? void 0 : _global$g$ShadyDOM2.noPatch) === true ? global$g.ShadyDOM.wrap : node => node;
var trustedTypes$8 = global$g.trustedTypes;
var policy$4 = trustedTypes$8 ? trustedTypes$8.createPolicy('lit-html', {
createHTML: s => s
}) : undefined;
var identityFunction$4 = value => value;
var noopSanitizer$4 = (_node, _name, _type) => identityFunction$4;
var setSanitizer$4 = newSanitizer => {
if (sanitizerFactoryInternal$4 !== noopSanitizer$4) {
throw new Error("Attempted to overwrite existing lit-html security policy." + " setSanitizeDOMValueFactory should be called at most once.");
}
sanitizerFactoryInternal$4 = newSanitizer;
};
var _testOnlyClearSanitizerFactoryDoNotCallOrElse$4 = () => {
sanitizerFactoryInternal$4 = noopSanitizer$4;
};
var createSanitizer$4 = (node, name, type) => {
return sanitizerFactoryInternal$4(node, name, type);
};
var boundAttributeSuffix$4 = '$lit$';
var marker$4 = "lit$".concat(String(Math.random()).slice(9), "$");
var markerMatch$4 = '?' + marker$4;
var nodeMarker$4 = "<".concat(markerMatch$4, ">");
var d$4 = document;
var createMarker$4 = () => d$4.createComment('');
var isPrimitive$4 = value => value === null || typeof value != 'object' && typeof value != 'function';
var isArray$4 = Array.isArray;
var isIterable$4 = value => isArray$4(value) || typeof (value === null || value === void 0 ? void 0 : value[Symbol.iterator]) === 'function';
var SPACE_CHAR$4 = "[ \t\n\f\r]";
var ATTR_VALUE_CHAR$4 = "[^ \t\n\f\r\"'`<>=]";
var NAME_CHAR$4 = "[^\\s\"'>=/]";
var textEndRegex$4 = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g;
var COMMENT_START$4 = 1;
var TAG_NAME$4 = 2;
var DYNAMIC_TAG_NAME$4 = 3;
var commentEndRegex$4 = /-->/g;
var comment2EndRegex$4 = />/g;
var tagEndRegex$4 = new RegExp(">|".concat(SPACE_CHAR$4, "(?:(").concat(NAME_CHAR$4, "+)(").concat(SPACE_CHAR$4, "*=").concat(SPACE_CHAR$4, "*(?:").concat(ATTR_VALUE_CHAR$4, "|(\"|')|))|$)"), 'g');
var ENTIRE_MATCH$4 = 0;
var ATTRIBUTE_NAME$4 = 1;
var SPACES_AND_EQUALS$4 = 2;
var QUOTE_CHAR$4 = 3;
var singleQuoteAttrEndRegex$4 = /'/g;
var doubleQuoteAttrEndRegex$4 = /"/g;
var rawTextElement$4 = /^(?:script|style|textarea|title)$/i;
var HTML_RESULT$3 = 1;
var SVG_RESULT$4 = 2;
var ATTRIBUTE_PART$4 = 1;
var CHILD_PART$4 = 2;
var PROPERTY_PART$4 = 3;
var BOOLEAN_ATTRIBUTE_PART$4 = 4;
var EVENT_PART$4 = 5;
var ELEMENT_PART$4 = 6;
var COMMENT_PART$4 = 7;
var tag$3 = type => function (strings) {
if (strings.some(s => s === undefined)) {
console.warn('Some template strings are undefined.\n' + 'This is probably caused by illegal octal escape sequences.');
}
for (var _len2 = arguments.length, values = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
values[_key2 - 1] = arguments[_key2];
}
{
if (values.some(val => val === null || val === void 0 ? void 0 : val['_$litStatic$'])) {
issueWarning$d('', "Static values 'literal' or 'unsafeStatic' cannot be used as values to non-static templates.\n" + "Please use the static 'html' tag function. See https://lit.dev/docs/templates/expressions/#static-expressions");
}
}
return {
['_$litType$']: type,
strings,
values
};
};
var html$3 = tag$3(HTML_RESULT$3);
var noChange$4 = Symbol.for('lit-noChange');
var nothing$4 = Symbol.for('lit-nothing');
var templateCache$4 = new WeakMap();
var walker$4 = d$4.createTreeWalker(d$4, 129);
var sanitizerFactoryInternal$4 = noopSanitizer$4;
function trustFromTemplateString$4(tsa, stringFromTSA) {
if (!Array.isArray(tsa) || !tsa.hasOwnProperty('raw')) {
var message = 'invalid template strings array';
{
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 ".trim().replace(/\n */g, '\n');
}
throw new Error(message);
}
if (policy$4 !== undefined) {
return policy$4.createHTML(stringFromTSA);
} else {
return stringFromTSA;
}
}
var getTemplateHtml$4 = (strings, type) => {
var l = strings.length - 1;
var attrNames = [];
var html = type === SVG_RESULT$4 ? '<svg>' : '';
var rawTextEndRegex;
var regex = textEndRegex$4;
for (var i = 0; i < l; i++) {
var s = strings[i];
var attrNameEndIndex = -1;
var attrName = void 0;
var lastIndex = 0;
var match = void 0;
while (lastIndex < s.length) {
regex.lastIndex = lastIndex;
match = regex.exec(s);
if (match === null) {
break;
}
lastIndex = regex.lastIndex;
if (regex === textEndRegex$4) {
if (match[COMMENT_START$4] === '!--') {
regex = commentEndRegex$4;
} else if (match[COMMENT_START$4] !== undefined) {
regex = comment2EndRegex$4;
} else if (match[TAG_NAME$4] !== undefined) {
if (rawTextElement$4.test(match[TAG_NAME$4])) {
rawTextEndRegex = new RegExp("</".concat(match[TAG_NAME$4]), 'g');
}
regex = tagEndRegex$4;
} else if (match[DYNAMIC_TAG_NAME$4] !== undefined) {
{
throw new Error('Bindings in tag names are not supported. Please use static templates instead. ' + 'See https://lit.dev/docs/templates/expressions/#static-expressions');
}
}
} else if (regex === tagEndRegex$4) {
if (match[ENTIRE_MATCH$4] === '>') {
var _rawTextEndRegex;
if ((_rawTextEndRegex = rawTextEndRegex) !== null && _rawTextEndRegex !== void 0) {
regex = _rawTextEndRegex;
} else {
regex = textEndRegex$4;
}
attrNameEndIndex = -1;
} else if (match[ATTRIBUTE_NAME$4] === undefined) {
attrNameEndIndex = -2;
} else {
attrNameEndIndex = regex.lastIndex - match[SPACES_AND_EQUALS$4].length;
attrName = match[ATTRIBUTE_NAME$4];
if (match[QUOTE_CHAR$4] === undefined) {
regex = tagEndRegex$4;
} else if (match[QUOTE_CHAR$4] === '"') {
regex = doubleQuoteAttrEndRegex$4;
} else {
regex = singleQuoteAttrEndRegex$4;
}
}
} else if (regex === doubleQuoteAttrEndRegex$4 || regex === singleQuoteAttrEndRegex$4) {
regex = tagEndRegex$4;
} else if (regex === commentEndRegex$4 || regex === comment2EndRegex$4) {
regex = textEndRegex$4;
} else {
regex = tagEndRegex$4;
rawTextEndRegex = undefined;
}
}
{
console.assert(attrNameEndIndex === -1 || regex === tagEndRegex$4 || regex === singleQuoteAttrEndRegex$4 || regex === doubleQuoteAttrEndRegex$4, 'unexpected parse state B');
}
var end = regex === tagEndRegex$4 && strings[i + 1].startsWith('/>') ? ' ' : '';
if (regex === textEndRegex$4) {
html += s + nodeMarker$4;
} else if (attrNameEndIndex >= 0) {
html += (attrNames.push(attrName), s.slice(0, attrNameEndIndex) + boundAttributeSuffix$4 + s.slice(attrNameEndIndex)) + marker$4 + end;
} else {
html += s + marker$4 + (attrNameEndIndex === -2 ? i : end);
}
}
var htmlResult = html + (strings[l] || '<?>') + (type === SVG_RESULT$4 ? '</svg>' : '');
return [trustFromTemplateString$4(strings, htmlResult), attrNames];
};
class Template$4 {
constructor(_ref, options) {
var {
strings,
['_$litType$']: type
} = _ref;
this.parts = [];
var node;
var nodeIndex = 0;
var attrNameIndex = 0;
var partCount = strings.length - 1;
var parts = this.parts;
var [html, attrNames] = getTemplateHtml$4(strings, type);
this.el = Template$4.createElement(html, options);
walker$4.currentNode = this.el.content;
if (type === SVG_RESULT$4) {
var svgElement = this.el.content.firstChild;
svgElement.replaceWith(...svgElement.childNodes);
}
while ((node = walker$4.nextNode()) !== null && parts.length < partCount) {
if (node.nodeType === 1) {
{
var _tag = node.localName;
if (/^(?:textarea|template)$/i.test(_tag) && node.innerHTML.includes(marker$4)) {
var m = "Expressions are not supported inside `".concat(_tag, "` ") + "elements. See https://lit.dev/msg/expression-in-".concat(_tag, " for more ") + "information.";
if (_tag === 'template') {
throw new Error(m);
} else {
issueWarning$d('', m);
}
}
}
if (node.hasAttributes()) {
for (var name of node.getAttributeNames()) {
if (name.endsWith(boundAttributeSuffix$4)) {
var realName = attrNames[attrNameIndex++];
var value = node.getAttribute(name);
var statics = value.split(marker$4);
var _m = /([.?@])?(.*)/.exec(realName);
parts.push({
type: ATTRIBUTE_PART$4,
index: nodeIndex,
name: _m[2],
strings: statics,
ctor: _m[1] === '.' ? PropertyPart$4 : _m[1] === '?' ? BooleanAttributePart$4 : _m[1] === '@' ? EventPart$4 : AttributePart$4
});
node.removeAttribute(name);
} else if (name.startsWith(marker$4)) {
parts.push({
type: ELEMENT_PART$4,
index: nodeIndex
});
node.removeAttribute(name);
}
}
}
if (rawTextElement$4.test(node.tagName)) {
var _strings = node.textContent.split(marker$4);
var lastIndex = _strings.length - 1;
if (lastIndex > 0) {
if (trustedTypes$8) {
node.textContent = trustedTypes$8.emptyScript;
} else {
node.textContent = '';
}
for (var i = 0; i < lastIndex; i++) {
node.append(_strings[i], createMarker$4());
walker$4.nextNode();
parts.push({
type: CHILD_PART$4,
index: ++nodeIndex
});
}
node.append(_strings[lastIndex], createMarker$4());
}
}
} else if (node.nodeType === 8) {
var data = node.data;
if (data === markerMatch$4) {
parts.push({
type: CHILD_PART$4,
index: nodeIndex
});
} else {
var _i2 = -1;
while ((_i2 = node.data.indexOf(marker$4, _i2 + 1)) !== -1) {
parts.push({
type: COMMENT_PART$4,
index: nodeIndex
});
_i2 += marker$4.length - 1;
}
}
}
nodeIndex++;
}
if (debugLogEvent$8) {
debugLogEvent$8({
kind: 'template prep',
template: this,
clonableTemplate: this.el,
parts: this.parts,
strings
});
}
}
static createElement(html, _options) {
var el = d$4.createElement('template');
el.innerHTML = html;
return el;
}
}
function resolveDirective$4(part, value) {
var _parent$__directives, _currentDirective;
var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : part;
var attributeIndex = arguments.length > 3 ? arguments[3] : undefined;
if (value === noChange$4) {
return value;
}
var currentDirective = attributeIndex !== undefined ? (_parent$__directives = parent.__directives) === null || _parent$__directives === void 0 ? void 0 : _parent$__directives[attributeIndex] : parent.__directive;
var nextDirectiveConstructor = isPrimitive$4(value) ? undefined : value['_$litDirective$'];
if (((_currentDirective = currentDirective) === null || _currentDirective === void 0 ? void 0 : _currentDirective.constructor) !== nextDirectiveConstructor) {
var _currentDirective2, _currentDirective2$_$;
if (!((_currentDirective2 = currentDirective) === null || _currentDirective2 === void 0 || (_currentDirective2$_$ = _currentDirective2['_$notifyDirectiveConnectionChanged']) === null || _currentDirective2$_$ === void 0)) {
_currentDirective2$_$.call(_currentDirective2, false);
}
if (nextDirectiveConstructor === undefined) {
currentDirective = undefined;
} else {
currentDirective = new nextDirectiveConstructor(part);
currentDirective._$initialize(part, parent, attributeIndex);
}
if (attributeIndex !== undefined) {
var _parent$__directives2;
((_parent$__directives2 = parent.__directives) !== null && _parent$__directives2 !== void 0 ? _parent$__directives2 : parent.__directives = [])[attributeIndex] = currentDirective;
} else {
parent.__directive = currentDirective;
}
}
if (currentDirective !== undefined) {
value = resolveDirective$4(part, currentDirective._$resolve(part, value.values), currentDirective, attributeIndex);
}
return value;
}
class TemplateInstance$4 {
constructor(template, parent) {
this._$parts = [];
this._$disconnectableChildren = undefined;
this._$template = template;
this._$parent = parent;
}
get parentNode() {
return this._$parent.parentNode;
}
get _$isConnected() {
return this._$parent._$isConnected;
}
_clone(options) {
var _options$creationScop;
var {
el: {
content
},
parts: parts
} = this._$template;
var fragment = ((_options$creationScop = options === null || options === void 0 ? void 0 : options.creationScope) !== null && _options$creationScop !== void 0 ? _options$creationScop : d$4).importNode(content, true);
walker$4.currentNode = fragment;
var node = walker$4.nextNode();
var nodeIndex = 0;
var partIndex = 0;
var templatePart = parts[0];
while (templatePart !== undefined) {
var _templatePart;
if (nodeIndex === templatePart.index) {
var part = void 0;
if (templatePart.type === CHILD_PART$4) {
part = new ChildPart$4(node, node.nextSibling, this, options);
} else if (templatePart.type === ATTRIBUTE_PART$4) {
part = new templatePart.ctor(node, templatePart.name, templatePart.strings, this, options);
} else if (templatePart.type === ELEMENT_PART$4) {
part = new ElementPart$4(node, this, options);
}
this._$parts.push(part);
templatePart = parts[++partIndex];
}
if (nodeIndex !== ((_templatePart = templatePart) === null || _templatePart === void 0 ? void 0 : _templatePart.index)) {
node = walker$4.nextNode();
nodeIndex++;
}
}
walker$4.currentNode = d$4;
return fragment;
}
_update(values) {
var i = 0;
for (var part of this._$parts) {
if (part !== undefined) {
if (debugLogEvent$8) {
debugLogEvent$8({
kind: 'set part',
part,
value: values[i],
valueIndex: i,
values,
templateInstance: this
});
}
if (part.strings !== undefined) {
part._$setValue(values, part, i);
i += part.strings.length - 2;
} else {
part._$setValue(values[i]);
}
}
i++;
}
}
}
class ChildPart$4 {
get _$isConnected() {
var _this$_$parent$_$isCo, _this$_$parent;
if ((_this$_$parent$_$isCo = (_this$_$parent = this._$parent) === null || _this$_$parent === void 0 ? void 0 : _this$_$parent._$isConnected) !== null && _this$_$parent$_$isCo !== void 0) {
return _this$_$parent$_$isCo;
} else {
return this.__isConnected;
}
}
constructor(startNode, endNode, parent, options) {
var _options$isConnected;
this.type = CHILD_PART$4;
this._$committedValue = nothing$4;
this._$disconnectableChildren = undefined;
this._$startNode = startNode;
this._$endNode = endNode;
this._$parent = parent;
this.options = options;
if ((_options$isConnected = options === null || options === void 0 ? void 0 : options.isConnected) !== null && _options$isConnected !== void 0) {
this.__isConnected = _options$isConnected;
} else {
this.__isConnected = true;
}
{
this._textSanitizer = undefined;
}
}
get parentNode() {
var _parentNode;
var parentNode = wrap$4(this._$startNode).parentNode;
var parent = this._$parent;
if (parent !== undefined && ((_parentNode = parentNode) === null || _parentNode === void 0 ? void 0 : _parentNode.nodeType) === 11) {
parentNode = parent.parentNode;
}
return parentNode;
}
get startNode() {
return this._$startNode;
}
get endNode() {
return this._$endNode;
}
_$setValue(value) {
var directiveParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
if (this.parentNode === null) {
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.");
}
value = resolveDirective$4(this, value, directiveParent);
if (isPrimitive$4(value)) {
if (value === nothing$4 || value == null || value === '') {
if (this._$committedValue !== nothing$4) {
if (debugLogEvent$8) {
debugLogEvent$8({
kind: 'commit nothing to child',
start: this._$startNode,
end: this._$endNode,
parent: this._$parent,
options: this.options
});
}
this._$clear();
}
this._$committedValue = nothing$4;
} else if (value !== this._$committedValue && value !== noChange$4) {
this._commitText(value);
}
} else if (value['_$litType$'] !== undefined) {
this._commitTemplateResult(value);
} else if (value.nodeType !== undefined) {
var _this$options;
if (((_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.host) === value) {
this._commitText("[probable mistake: rendered a template's host in itself " + "(commonly caused by writing ${this} in a template]");
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.");
return;
}
this._commitNode(value);
} else if (isIterable$4(value)) {
this._commitIterable(value);
} else {
this._commitText(value);
}
}
_insert(node) {
return wrap$4(wrap$4(this._$startNode).parentNode).insertBefore(node, this._$endNode);
}
_commitNode(value) {
if (this._$committedValue !== value) {
this._$clear();
if (sanitizerFactoryInternal$4 !== noopSanitizer$4) {
var _this$_$startNode$par;
var parentNodeName = (_this$_$startNode$par = this._$startNode.parentNode) === null || _this$_$startNode$par === void 0 ? void 0 : _this$_$startNode$par.nodeName;
if (parentNodeName === 'STYLE' || parentNodeName === 'SCRIPT') {
var message = 'Forbidden';
{
if (parentNodeName === 'STYLE') {
message = "Lit does not support binding inside style nodes. " + "This is a security risk, as style injection attacks can " + "exfiltrate data and spoof UIs. " + "Consider instead using css`...` literals " + "to compose styles, and make do dynamic styling with " + "css custom properties, ::parts, <slot>s, " + "and by mutating the DOM rather than stylesheets.";
} else {
message = "Lit does not support binding inside script nodes. " + "This is a security risk, as it could allow arbitrary " + "code execution.";
}
}
throw new Error(message);
}
}
if (debugLogEvent$8) {
debugLogEvent$8({
kind: 'commit node',
start: this._$startNode,
parent: this._$parent,
value: value,
options: this.options
});
}
this._$committedValue = this._insert(value);
}
}
_commitText(value) {
if (this._$committedValue !== nothing$4 && isPrimitive$4(this._$committedValue)) {
var node = wrap$4(this._$startNode).nextSibling;
{
if (this._textSanitizer === undefined) {
this._textSanitizer = createSanitizer$4(node, 'data', 'property');
}
value = this._textSanitizer(value);
}
if (debugLogEvent$8) {
debugLogEvent$8({
kind: 'commit text',
node,
value,
options: this.options
});
}
node.data = value;
} else {
{
var textNode = d$4.createTextNode('');
this._commitNode(textNode);
if (this._textSanitizer === undefined) {
this._textSanitizer = createSanitizer$4(textNode, 'data', 'property');
}
value = this._textSanitizer(value);
if (debugLogEvent$8) {
debugLogEvent$8({
kind: 'commit text',
node: textNode,
value,
options: this.options
});
}
textNode.data = value;
}
}
this._$committedValue = value;
}
_commitTemplateResult(result) {
var _this$_$committedValu;
var {
values,
['_$litType$']: type
} = result;
var template = typeof type === 'number' ? this._$getTemplate(result) : (type.el === undefined && (type.el = Template$4.createElement(trustFromTemplateString$4(type.h, type.h[0]), this.options)), type);
if (((_this$_$committedValu = this._$committedValue) === null || _this$_$committedValu === void 0 ? void 0 : _this$_$committedValu._$template) === template) {
if (debugLogEvent$8) {
debugLogEvent$8({
kind: 'template updating',
template,
instance: this._$committedValue,
parts: this._$committedValue._$parts,
options: this.options,
values
});
}
this._$committedValue._update(values);
} else {
var instance = new TemplateInstance$4(template, this);
var fragment = instance._clone(this.options);
if (debugLogEvent$8) {
debugLogEvent$8({
kind: 'template instantiated',
template,
instance,
parts: instance._$parts,
options: this.options,
fragment,
values
});
}
instance._update(values);
if (debugLogEvent$8) {
debugLogEvent$8({
kind: 'template instantiated and updated',
template,
instance,
parts: instance._$parts,
options: this.options,
fragment,
values
});
}
this._commitNode(fragment);
this._$committedValue = instance;
}
}
_$getTemplate(result) {
var template = templateCache$4.get(result.strings);
if (template === undefined) {
templateCache$4.set(result.strings, template = new Template$4(result));
}
return template;
}
_commitIterable(value) {
if (!isArray$4(this._$committedValue)) {
this._$committedValue = [];
this._$clear();
}
var itemParts = this._$committedValue;
var partIndex = 0;
var itemPart;
for (var item of value) {
if (partIndex === itemParts.length) {
itemParts.push(itemPart = new ChildPart$4(this._insert(createMarker$4()), this._insert(createMarker$4()), this, this.options));
} else {
itemPart = itemParts[partIndex];
}
itemPart._$setValue(item);
partIndex++;
}
if (partIndex < itemParts.length) {
this._$clear(itemPart && wrap$4(itemPart._$endNode).nextSibling, partIndex);
itemParts.length = partIndex;
}
}
_$clear() {
var _this$_$notifyConnect;
var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : wrap$4(this._$startNode).nextSibling;
var from = arguments.length > 1 ? arguments[1] : undefined;
if (!((_this$_$notifyConnect = this._$notifyConnectionChanged) === null || _this$_$notifyConnect === void 0)) {
_this$_$notifyConnect.call(this, false, true, from);
}
while (start && start !== this._$endNode) {
var n = wrap$4(start).nextSibling;
wrap$4(start).remove();
start = n;
}
}
setConnected(isConnected) {
if (this._$parent === undefined) {
var _this$_$notifyConnect2;
this.__isConnected = isConnected;
if (!((_this$_$notifyConnect2 = this._$notifyConnectionChanged) === null || _this$_$notifyConnect2 === void 0)) {
_this$_$notifyConnect2.call(this, isConnected);
}
} else {
throw new Error('part.setConnected() may only be called on a ' + 'RootPart returned from render().');
}
}
}
class AttributePart$4 {
get tagName() {
return this.element.tagName;
}
get _$isConnected() {
return this._$parent._$isConnected;
}
constructor(element, name, strings, parent, options) {
this.type = ATTRIBUTE_PART$4;
this._$committedValue = nothing$4;
this._$disconnectableChildren = undefined;
this.element = element;
this.name = name;
this._$parent = parent;
this.options = options;
if (strings.length > 2 || strings[0] !== '' || strings[1] !== '') {
this._$committedValue = new Array(strings.length - 1).fill(new String());
this.strings = strings;
} else {
this._$committedValue = nothing$4;
}
{
this._sanitizer = undefined;
}
}
_$setValue(value) {
var directiveParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
var valueIndex = arguments.length > 2 ? arguments[2] : undefined;
var noCommit = arguments.length > 3 ? arguments[3] : undefined;
var strings = this.strings;
var change = false;
if (strings === undefined) {
value = resolveDirective$4(this, value, directiveParent, 0);
change = !isPrimitive$4(value) || value !== this._$committedValue && value !== noChange$4;
if (change) {
this._$committedValue = value;
}
} else {
var values = value;
value = strings[0];
var i, v;
for (i = 0; i < strings.length - 1; i++) {
v = resolveDirective$4(this, values[valueIndex + i], directiveParent, i);
if (v === noChange$4) {
v = this._$committedValue[i];
}
if (!change) {
change = !isPrimitive$4(v) || v !== this._$committedValue[i];
}
if (v === nothing$4) {
value = nothing$4;
} else if (value !== nothing$4) {
var _v2;
value += ((_v2 = v) !== null && _v2 !== void 0 ? _v2 : '') + strings[i + 1];
}
this._$committedValue[i] = v;
}
}
if (change && !noCommit) {
this._commitValue(value);
}
}
_commitValue(value) {
if (value === nothing$4) {
wrap$4(this.element).removeAttribute(this.name);
} else {
var _value2;
{
var _value;
if (this._sanitizer === undefined) {
this._sanitizer = sanitizerFactoryInternal$4(this.element, this.name, 'attribute');
}
value = this._sanitizer((_value = value) !== null && _value !== void 0 ? _value : '');
}
if (debugLogEvent$8) {
debugLogEvent$8({
kind: 'commit attribute',
element: this.element,
name: this.name,
value,
options: this.options
});
}
wrap$4(this.element).setAttribute(this.name, (_value2 = value) !== null && _value2 !== void 0 ? _value2 : '');
}
}
}
class PropertyPart$4 extends AttributePart$4 {
constructor() {
super(...arguments);
this.type = PROPERTY_PART$4;
}
_commitValue(value) {
{
if (this._sanitizer === undefined) {
this._sanitizer = sanitizerFactoryInternal$4(this.element, this.name, 'property');
}
value = this._sanitizer(value);
}
if (debugLogEvent$8) {
debugLogEvent$8({
kind: 'commit property',
element: this.element,
name: this.name,
value,
options: this.options
});
}
if (value === nothing$4) {
this.element[this.name] = undefined;
} else {
this.element[this.name] = value;
}
}
}
class BooleanAttributePart$4 extends AttributePart$4 {
constructor() {
super(...arguments);
this.type = BOOLEAN_ATTRIBUTE_PART$4;
}
_commitValue(value) {
if (debugLogEvent$8) {
debugLogEvent$8({
kind: 'commit boolean attribute',
element: this.element,
name: this.name,
value: !!(value && value !== nothing$4),
options: this.options
});
}
wrap$4(this.element).toggleAttribute(this.name, !!value && value !== nothing$4);
}
}
class EventPart$4 extends AttributePart$4 {
constructor(element, name, strings, parent, options) {
super(element, name, strings, parent, options);
this.type = EVENT_PART$4;
if (this.strings !== undefined) {
throw new Error("A `<".concat(element.localName, ">` has a `@").concat(name, "=...` listener with ") + 'invalid content. Event listeners in templates must have exactly ' + 'one expression and no surrounding text.');
}
}
_$setValue(newListener) {
var _resolveDirective$;
var directiveParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
if ((_resolveDirective$ = resolveDirective$4(this, newListener, directiveParent, 0)) !== null && _resolveDirective$ !== void 0) {
newListener = _resolveDirective$;
} else {
newListener = nothing$4;
}
if (newListener === noChange$4) {
return;
}
var oldListener = this._$committedValue;
var shouldRemoveListener = newListener === nothing$4 && oldListener !== nothing$4 || newListener.capture !== oldListener.capture || newListener.once !== oldListener.once || newListener.passive !== oldListener.passive;
var shouldAddListener = newListener !== nothing$4 && (oldListener === nothing$4 || shouldRemoveListener);
if (debugLogEvent$8) {
debugLogEvent$8({
kind: 'commit event listener',
element: this.element,
name: this.name,
value: newListener,
options: this.options,
removeListener: shouldRemoveListener,
addListener: shouldAddListener,
oldListener
});
}
if (shouldRemoveListener) {
this.element.removeEventListener(this.name, this, oldListener);
}
if (shouldAddListener) {
this.element.addEventListener(this.name, this, newListener);
}
this._$committedValue = newListener;
}
handleEvent(event) {
if (typeof this._$committedValue === 'function') {
var _this$options$host, _this$options2;
this._$committedValue.call((_this$options$host = (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.host) !== null && _this$options$host !== void 0 ? _this$options$host : this.element, event);
} else {
this._$committedValue.handleEvent(event);
}
}
}
class ElementPart$4 {
constructor(element, parent, options) {
this.element = element;
this.type = ELEMENT_PART$4;
this._$disconnectableChildren = undefined;
this._$parent = parent;
this.options = options;
}
get _$isConnected() {
return this._$parent._$isConnected;
}
_$setValue(value) {
if (debugLogEvent$8) {
debugLogEvent$8({
kind: 'commit to element binding',
element: this.element,
value,
options: this.options
});
}
resolveDirective$4(this, value);
}
}
var polyfillSupport$d = global$g.litHtmlPolyfillSupportDevMode;
if (!(polyfillSupport$d === null || polyfillSupport$d === void 0)) {
polyfillSupport$d(Template$4, ChildPart$4);
}
((_global$g$litHtmlVers = global$g.litHtmlVersions) !== null && _global$g$litHtmlVers !== void 0 ? _global$g$litHtmlVers : global$g.litHtmlVersions = []).push('3.1.0');
if (global$g.litHtmlVersions.length > 1) {
issueWarning$d('multiple-versions', "Multiple versions of Lit loaded. " + "Loading multiple versions is not recommended.");
}
var render$4 = (value, container, options) => {
var _options$renderBefore;
if (container == null) {
throw new TypeError("The container to render into may not be ".concat(container));
}
var renderId = debugLogRenderId$4++;
var partOwnerNode = (_options$renderBefore = options === null || options === void 0 ? void 0 : options.renderBefore) !== null && _options$renderBefore !== void 0 ? _options$renderBefore : container;
var part = partOwnerNode['_$litPart$'];
if (debugLogEvent$8) {
debugLogEvent$8({
kind: 'begin render',
id: renderId,
value,
container,
options,
part
});
}
if (part === undefined) {
var _options$renderBefore2;
var endNode = (_options$renderBefore2 = options === null || options === void 0 ? void 0 : options.renderBefore) !== null && _options$renderBefore2 !== void 0 ? _options$renderBefore2 : null;
partOwnerNode['_$litPart$'] = part = new ChildPart$4(container.insertBefore(createMarker$4(), endNode), endNode, undefined, options !== null && options !== void 0 ? options : {});
}
part._$setValue(value);
if (debugLogEvent$8) {
debugLogEvent$8({
kind: 'end render',
id: renderId,
value,
container,
options,
part
});
}
return part;
};
{
render$4.setSanitizer = setSanitizer$4;
render$4.createSanitizer = createSanitizer$4;
{
render$4._testOnlyClearSanitizerFactoryDoNotCallOrElse = _testOnlyClearSanitizerFactoryDoNotCallOrElse$4;
}
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var JSCompiler_renameProperty$4 = (prop, _obj) => prop;
var issueWarning$c;
{
var _globalThis$litIssued;
var _issuedWarnings = (_globalThis$litIssued = globalThis.litIssuedWarnings) !== null && _globalThis$litIssued !== void 0 ? _globalThis$litIssued : globalThis.litIssuedWarnings = new Set();
issueWarning$c = (code, warning) => {
warning += " See https://lit.dev/msg/".concat(code, " for more information.");
if (!_issuedWarnings.has(warning)) {
console.warn(warning);
_issuedWarnings.add(warning);
}
};
}
class LitElement$4 extends ReactiveElement$4 {
constructor() {
super(...arguments);
this.renderOptions = {
host: this
};
this.__childPart = undefined;
}
createRenderRoot() {
var _this$renderOptions, _this$renderOptions$r;
var renderRoot = super.createRenderRoot();
if (!(_this$renderOptions = this.renderOptions).renderBefore) {
_this$renderOptions.renderBefore = renderRoot.firstChild;
}
return renderRoot;
}
update(changedProperties) {
var value = this.render();
if (!this.hasUpdated) {
this.renderOptions.isConnected = this.isConnected;
}
super.update(changedProperties);
this.__childPart = render$4(value, this.renderRoot, this.renderOptions);
}
connectedCallback() {
var _this$__childPart;
super.connectedCallback();
if (!((_this$__childPart = this.__childPart) === null || _this$__childPart === void 0)) {
_this$__childPart.setConnected(true);
}
}
disconnectedCallback() {
var _this$__childPart2;
super.disconnectedCallback();
if (!((_this$__childPart2 = this.__childPart) === null || _this$__childPart2 === void 0)) {
_this$__childPart2.setConnected(false);
}
}
render() {
return noChange$4;
}
}
LitElement$4['_$litElement$'] = true;
LitElement$4[JSCompiler_renameProperty$4('finalized')] = true;
if (!((_globalThis$litElemen = globalThis.litElementHydrateSupport) === null || _globalThis$litElemen === void 0)) {
_globalThis$litElemen.call(globalThis, {
LitElement: LitElement$4
});
}
var polyfillSupport$c = globalThis.litElementPolyfillSupportDevMode;
if (!(polyfillSupport$c === null || polyfillSupport$c === void 0)) {
polyfillSupport$c({
LitElement: LitElement$4
});
}
((_globalThis$litElemen2 = globalThis.litElementVersions) !== null && _globalThis$litElemen2 !== void 0 ? _globalThis$litElemen2 : globalThis.litElementVersions = []).push('4.0.2');
if (globalThis.litElementVersions.length > 1) {
issueWarning$c('multiple-versions', "Multiple versions of Lit loaded. Loading multiple versions " + "is not recommended.");
}
var MapShim = function () {
if (typeof Map !== 'undefined') {
return Map;
}
function getIndex(arr, key) {
var result = -1;
arr.some(function (entry, index) {
if (entry[0] === key) {
result = index;
return true;
}
return false;
});
return result;
}
return function () {
function class_1() {
this.__entries__ = [];
}
Object.defineProperty(class_1.prototype, "size", {
get() {
return this.__entries__.length;
},
enumerable: true,
configurable: true
});
class_1.prototype.get = function (key) {
var index = getIndex(this.__entries__, key);
var entry = this.__entries__[index];
return entry && entry[1];
};
class_1.prototype.set = function (key, value) {
var index = getIndex(this.__entries__, key);
if (~index) {
this.__entries__[index][1] = value;
} else {
this.__entries__.push([key, value]);
}
};
class_1.prototype.delete = function (key) {
var entries = this.__entries__;
var index = getIndex(entries, key);
if (~index) {
entries.splice(index, 1);
}
};
class_1.prototype.has = function (key) {
return !!~getIndex(this.__entries__, key);
};
class_1.prototype.clear = function () {
this.__entries__.splice(0);
};
class_1.prototype.forEach = function (callback, ctx) {
if (ctx === void 0) {
ctx = null;
}
for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) {
var entry = _a[_i];
callback.call(ctx, entry[1], entry[0]);
}
};
return class_1;
}();
}();
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document;
var global$1$1 = function () {
if (typeof global !== 'undefined' && global.Math === Math) {
return global;
}
if (typeof self !== 'undefined' && self.Math === Math) {
return self;
}
if (typeof window !== 'undefined' && window.Math === Math) {
return window;
}
return Function('return this')();
}();
var requestAnimationFrame$1 = function () {
if (typeof requestAnimationFrame === 'function') {
return requestAnimationFrame.bind(global$1$1);
}
return function (callback) {
return setTimeout(function () {
return callback(Date.now());
}, 1000 / 60);
};
}();
var trailingTimeout = 2;
function throttle(callback, delay) {
var leadingCall = false;
var trailingCall = false;
var lastCallTime = 0;
function resolvePending() {
if (leadingCall) {
leadingCall = false;
callback();
}
if (trailingCall) {
proxy();
}
}
function timeoutCallback() {
requestAnimationFrame$1(resolvePending);
}
function proxy() {
var timeStamp = Date.now();
if (leadingCall) {
if (timeStamp - lastCallTime < trailingTimeout) {
return;
}
trailingCall = true;
} else {
leadingCall = true;
trailingCall = false;
setTimeout(timeoutCallback, delay);
}
lastCallTime = timeStamp;
}
return proxy;
}
var REFRESH_DELAY = 20;
var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight'];
var mutationObserverSupported = typeof MutationObserver !== 'undefined';
var ResizeObserverController = function () {
function ResizeObserverController() {
this.connected_ = false;
this.mutationEventsAdded_ = false;
this.mutationsObserver_ = null;
this.observers_ = [];
this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY);
}
ResizeObserverController.prototype.addObserver = function (observer) {
if (!~this.observers_.indexOf(observer)) {
this.observers_.push(observer);
}
if (!this.connected_) {
this.connect_();
}
};
ResizeObserverController.prototype.removeObserver = function (observer) {
var observers = this.observers_;
var index = observers.indexOf(observer);
if (~index) {
observers.splice(index, 1);
}
if (!observers.length && this.connected_) {
this.disconnect_();
}
};
ResizeObserverController.prototype.refresh = function () {
var changesDetected = this.updateObservers_();
if (changesDetected) {
this.refresh();
}
};
ResizeObserverController.prototype.updateObservers_ = function () {
var activeObservers = this.observers_.filter(function (observer) {
observer.gatherActive();
return observer.hasActive();
});
activeObservers.forEach(function (observer) {
return observer.broadcastActive();
});
return activeObservers.length > 0;
};
ResizeObserverController.prototype.connect_ = function () {
if (!isBrowser || this.connected_) {
return;
}
document.addEventListener('transitionend', this.onTransitionEnd_);
window.addEventListener('resize', this.refresh);
if (mutationObserverSupported) {
this.mutationsObserver_ = new MutationObserver(this.refresh);
this.mutationsObserver_.observe(document, {
attributes: true,
childList: true,
characterData: true,
subtree: true
});
} else {
document.addEventListener('DOMSubtreeModified', this.refresh);
this.mutationEventsAdded_ = true;
}
this.connected_ = true;
};
ResizeObserverController.prototype.disconnect_ = function () {
if (!isBrowser || !this.connected_) {
return;
}
document.removeEventListener('transitionend', this.onTransitionEnd_);
window.removeEventListener('resize', this.refresh);
if (this.mutationsObserver_) {
this.mutationsObserver_.disconnect();
}
if (this.mutationEventsAdded_) {
document.removeEventListener('DOMSubtreeModified', this.refresh);
}
this.mutationsObserver_ = null;
this.mutationEventsAdded_ = false;
this.connected_ = false;
};
ResizeObserverController.prototype.onTransitionEnd_ = function (_a) {
var _b = _a.propertyName;
var propertyName = _b === void 0 ? '' : _b;
var isReflowProperty = transitionKeys.some(function (key) {
return !!~propertyName.indexOf(key);
});
if (isReflowProperty) {
this.refresh();
}
};
ResizeObserverController.getInstance = function () {
if (!this.instance_) {
this.instance_ = new ResizeObserverController();
}
return this.instance_;
};
ResizeObserverController.instance_ = null;
return ResizeObserverController;
}();
var defineConfigurable = function defineConfigurable(target, props) {
for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {
var key = _a[_i];
Object.defineProperty(target, key, {
value: props[key],
enumerable: false,
writable: false,
configurable: true
});
}
return target;
};
var getWindowOf = function getWindowOf(target) {
var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;
return ownerGlobal || global$1$1;
};
var emptyRect = createRectInit(0, 0, 0, 0);
function toFloat(value) {
return parseFloat(value) || 0;
}
function getBordersSize(styles) {
var positions = [];
for (var _i = 1; _i < arguments.length; _i++) {
positions[_i - 1] = arguments[_i];
}
return positions.reduce(function (size, position) {
var value = styles['border-' + position + '-width'];
return size + toFloat(value);
}, 0);
}
function getPaddings(styles) {
var positions = ['top', 'right', 'bottom', 'left'];
var paddings = {};
for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
var position = positions_1[_i];
var value = styles['padding-' + position];
paddings[position] = toFloat(value);
}
return paddings;
}
function getSVGContentRect(target) {
var bbox = target.getBBox();
return createRectInit(0, 0, bbox.width, bbox.height);
}
function getHTMLElementContentRect(target) {
var clientWidth = target.clientWidth;
var clientHeight = target.clientHeight;
if (!clientWidth && !clientHeight) {
return emptyRect;
}
var styles = getWindowOf(target).getComputedStyle(target);
var paddings = getPaddings(styles);
var horizPad = paddings.left + paddings.right;
var vertPad = paddings.top + paddings.bottom;
var width = toFloat(styles.width);
var height = toFloat(styles.height);
if (styles.boxSizing === 'border-box') {
if (Math.round(width + horizPad) !== clientWidth) {
width -= getBordersSize(styles, 'left', 'right') + horizPad;
}
if (Math.round(height + vertPad) !== clientHeight) {
height -= getBordersSize(styles, 'top', 'bottom') + vertPad;
}
}
if (!isDocumentElement(target)) {
var vertScrollbar = Math.round(width + horizPad) - clientWidth;
var horizScrollbar = Math.round(height + vertPad) - clientHeight;
if (Math.abs(vertScrollbar) !== 1) {
width -= vertScrollbar;
}
if (Math.abs(horizScrollbar) !== 1) {
height -= horizScrollbar;
}
}
return createRectInit(paddings.left, paddings.top, width, height);
}
var isSVGGraphicsElement = function () {
if (typeof SVGGraphicsElement !== 'undefined') {
return function (target) {
return target instanceof getWindowOf(target).SVGGraphicsElement;
};
}
return function (target) {
return target instanceof getWindowOf(target).SVGElement && typeof target.getBBox === 'function';
};
}();
function isDocumentElement(target) {
return target === getWindowOf(target).document.documentElement;
}
function getContentRect(target) {
if (!isBrowser) {
return emptyRect;
}
if (isSVGGraphicsElement(target)) {
return getSVGContentRect(target);
}
return getHTMLElementContentRect(target);
}
function createReadOnlyRect(_a) {
var x = _a.x;
var y = _a.y;
var width = _a.width;
var height = _a.height;
var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object;
var rect = Object.create(Constr.prototype);
defineConfigurable(rect, {
x: x,
y: y,
width: width,
height: height,
top: y,
right: x + width,
bottom: height + y,
left: x
});
return rect;
}
function createRectInit(x, y, width, height) {
return {
x: x,
y: y,
width: width,
height: height
};
}
var ResizeObservation = function () {
function ResizeObservation(target) {
this.broadcastWidth = 0;
this.broadcastHeight = 0;
this.contentRect_ = createRectInit(0, 0, 0, 0);
this.target = target;
}
ResizeObservation.prototype.isActive = function () {
var rect = getContentRect(this.target);
this.contentRect_ = rect;
return rect.width !== this.broadcastWidth || rect.height !== this.broadcastHeight;
};
ResizeObservation.prototype.broadcastRect = function () {
var rect = this.contentRect_;
this.broadcastWidth = rect.width;
this.broadcastHeight = rect.height;
return rect;
};
return ResizeObservation;
}();
var ResizeObserverEntry = function () {
function ResizeObserverEntry(target, rectInit) {
var contentRect = createReadOnlyRect(rectInit);
defineConfigurable(this, {
target: target,
contentRect: contentRect
});
}
return ResizeObserverEntry;
}();
var ResizeObserverSPI = function () {
function ResizeObserverSPI(callback, controller, callbackCtx) {
this.activeObservations_ = [];
this.observations_ = new MapShim();
if (typeof callback !== 'function') {
throw new TypeError('The callback provided as parameter 1 is not a function.');
}
this.callback_ = callback;
this.controller_ = controller;
this.callbackCtx_ = callbackCtx;
}
ResizeObserverSPI.prototype.observe = function (target) {
if (!arguments.length) {
throw new TypeError('1 argument required, but only 0 present.');
}
if (typeof Element === 'undefined' || !(Element instanceof Object)) {
return;
}
if (!(target instanceof getWindowOf(target).Element)) {
throw new TypeError('parameter 1 is not of type "Element".');
}
var observations = this.observations_;
if (observations.has(target)) {
return;
}
observations.set(target, new ResizeObservation(target));
this.controller_.addObserver(this);
this.controller_.refresh();
};
ResizeObserverSPI.prototype.unobserve = function (target) {
if (!arguments.length) {
throw new TypeError('1 argument required, but only 0 present.');
}
if (typeof Element === 'undefined' || !(Element instanceof Object)) {
return;
}
if (!(target instanceof getWindowOf(target).Element)) {
throw new TypeError('parameter 1 is not of type "Element".');
}
var observations = this.observations_;
if (!observations.has(target)) {
return;
}
observations.delete(target);
if (!observations.size) {
this.controller_.removeObserver(this);
}
};
ResizeObserverSPI.prototype.disconnect = function () {
this.clearActive();
this.observations_.clear();
this.controller_.removeObserver(this);
};
ResizeObserverSPI.prototype.gatherActive = function () {
var _this = this;
this.clearActive();
this.observations_.forEach(function (observation) {
if (observation.isActive()) {
_this.activeObservations_.push(observation);
}
});
};
ResizeObserverSPI.prototype.broadcastActive = function () {
if (!this.hasActive()) {
return;
}
var ctx = this.callbackCtx_;
var entries = this.activeObservations_.map(function (observation) {
return new ResizeObserverEntry(observation.target, observation.broadcastRect());
});
this.callback_.call(ctx, entries, ctx);
this.clearActive();
};
ResizeObserverSPI.prototype.clearActive = function () {
this.activeObservations_.splice(0);
};
ResizeObserverSPI.prototype.hasActive = function () {
return this.activeObservations_.length > 0;
};
return ResizeObserverSPI;
}();
var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim();
var ResizeObserver = function () {
function ResizeObserver(callback) {
if (!(this instanceof ResizeObserver)) {
throw new TypeError('Cannot call a class as a function.');
}
if (!arguments.length) {
throw new TypeError('1 argument required, but only 0 present.');
}
var controller = ResizeObserverController.getInstance();
var observer = new ResizeObserverSPI(callback, controller, this);
observers.set(this, observer);
}
return ResizeObserver;
}();
['observe', 'unobserve', 'disconnect'].forEach(function (method) {
ResizeObserver.prototype[method] = function () {
var _a;
return (_a = observers.get(this))[method].apply(_a, arguments);
};
});
var index = function () {
if (typeof global$1$1.ResizeObserver !== 'undefined') {
return global$1$1.ResizeObserver;
}
return ResizeObserver;
}();
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var PartType$3 = {
ATTRIBUTE: 1,
CHILD: 2,
PROPERTY: 3,
BOOLEAN_ATTRIBUTE: 4,
EVENT: 5,
ELEMENT: 6
};
var directive$3 = c => function () {
for (var _len3 = arguments.length, values = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
values[_key3] = arguments[_key3];
}
return {
['_$litDirective$']: c,
values
};
};
class Directive$3 {
constructor(_partInfo) {}
get _$isConnected() {
return this._$parent._$isConnected;
}
_$initialize(part, parent, attributeIndex) {
this.__part = part;
this._$parent = parent;
this.__attributeIndex = attributeIndex;
}
_$resolve(part, props) {
return this.update(part, props);
}
update(_part, props) {
return this.render(...props);
}
}
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
class ClassMapDirective$3 extends Directive$3 {
constructor(partInfo) {
var _partInfo$strings;
super(partInfo);
if (partInfo.type !== PartType$3.ATTRIBUTE || partInfo.name !== 'class' || ((_partInfo$strings = partInfo.strings) === null || _partInfo$strings === void 0 ? void 0 : _partInfo$strings.length) > 2) {
throw new Error('`classMap()` can only be used in the `class` attribute ' + 'and must be the only part in the attribute.');
}
}
render(classInfo) {
return ' ' + Object.keys(classInfo).filter(key => classInfo[key]).join(' ') + ' ';
}
update(part, _ref2) {
var [classInfo] = _ref2;
if (this._previousClasses === undefined) {
this._previousClasses = new Set();
if (part.strings !== undefined) {
this._staticClasses = new Set(part.strings.join(' ').split(/\s/).filter(s => s !== ''));
}
for (var name in classInfo) {
var _this$_staticClasses;
if (classInfo[name] && !((_this$_staticClasses = this._staticClasses) !== null && _this$_staticClasses !== void 0 && _this$_staticClasses.has(name))) {
this._previousClasses.add(name);
}
}
return this.render(classInfo);
}
var classList = part.element.classList;
for (var _name2 of this._previousClasses) {
if (!(_name2 in classInfo)) {
classList.remove(_name2);
this._previousClasses.delete(_name2);
}
}
for (var _name3 in classInfo) {
var _this$_staticClasses2;
var value = !!classInfo[_name3];
if (value !== this._previousClasses.has(_name3) && !((_this$_staticClasses2 = this._staticClasses) !== null && _this$_staticClasses2 !== void 0 && _this$_staticClasses2.has(_name3))) {
if (value) {
classList.add(_name3);
this._previousClasses.add(_name3);
} else {
classList.remove(_name3);
this._previousClasses.delete(_name3);
}
}
}
return noChange$4;
}
}
var classMap$3 = directive$3(ClassMapDirective$3);
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var important$2 = 'important';
var importantFlag$2 = ' !' + important$2;
var flagTrim$2 = 0 - importantFlag$2.length;
class StyleMapDirective$2 extends Directive$3 {
constructor(partInfo) {
var _partInfo$strings2;
super(partInfo);
if (partInfo.type !== PartType$3.ATTRIBUTE || partInfo.name !== 'style' || ((_partInfo$strings2 = partInfo.strings) === null || _partInfo$strings2 === void 0 ? void 0 : _partInfo$strings2.length) > 2) {
throw new Error('The `styleMap` directive must be used in the `style` attribute ' + 'and must be the only part in the attribute.');
}
}
render(styleInfo) {
return Object.keys(styleInfo).reduce((style, prop) => {
var value = styleInfo[prop];
if (value == null) {
return style;
}
if (prop.includes('-')) {
prop = prop;
} else {
prop = prop.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, '-$&').toLowerCase();
}
return style + "".concat(prop, ":").concat(value, ";");
}, '');
}
update(part, _ref3) {
var [styleInfo] = _ref3;
var {
style
} = part.element;
if (this._previousStyleProperties === undefined) {
this._previousStyleProperties = new Set(Object.keys(styleInfo));
return this.render(styleInfo);
}
for (var name of this._previousStyleProperties) {
if (styleInfo[name] == null) {
this._previousStyleProperties.delete(name);
if (name.includes('-')) {
style.removeProperty(name);
} else {
style[name] = null;
}
}
}
for (var _name4 in styleInfo) {
var value = styleInfo[_name4];
if (value != null) {
this._previousStyleProperties.add(_name4);
var isImportant = typeof value === 'string' && value.endsWith(importantFlag$2);
if (_name4.includes('-') || isImportant) {
style.setProperty(_name4, isImportant ? value.slice(0, flagTrim$2) : value, isImportant ? important$2 : '');
} else {
style[_name4] = value;
}
}
}
return noChange$4;
}
}
var styleMap$2 = directive$3(StyleMapDirective$2);
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function ScopedRegistryHost(superclass) {
return class ScopedRegistryMixin extends superclass {
createRenderRoot() {
var constructor = this.constructor;
var {
registry,
elementDefinitions,
shadowRootOptions
} = constructor;
if (elementDefinitions && !registry) {
constructor.registry = new CustomElementRegistry();
Object.entries(elementDefinitions).forEach(_ref4 => {
var [tagName, klass] = _ref4;
return constructor.registry.define(tagName, klass);
});
}
var renderRoot = this.renderOptions.creationScope = this.attachShadow(_objectSpread(_objectSpread({}, shadowRootOptions), {}, {
customElements: constructor.registry
}));
adoptStyles$4(renderRoot, this.constructor.elementStyles);
return renderRoot;
}
};
}
var style = css$3(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n :host {\n overflow: visible !important;\n display: block;\n --mc-scale: var(--mini-climate-scale, 1);\n --mc-unit: calc(var(--mc-scale) * 40px);\n --mc-name-font-weight: var(--mini-climate-name-font-weight, 400);\n --mc-info-font-weight: var(--mini-climate-info-font-weight, 300);\n --mc-entity-info-left-offset: 8px;\n --mc-accent-color: var(--mini-climate-accent-color, var(--accent-color, #f39c12));\n --mc-text-color: var(--mini-climate-base-color, var(--primary-text-color, #000));\n --mc-active-color: var(--mc-accent-color);\n --mc-button-color: var(--mini-climate-button-color, var(--paper-item-icon-color, #44739e));\n --mc-icon-color:\n var(--mini-climate-icon-color,\n var(--mini-climate-base-color,\n var(--paper-item-icon-color, #44739e)));\n --mc-icon-active-color: var(--state-binary_sensor-active-color, #ffc107);\n --mc-info-opacity: 1;\n --mc-bg-opacity: var(--mini-climate-background-opacity, 1);\n color: var(--mc-text-color);\n --mc-dropdown-unit: calc(var(--mc-unit) * .75);\n --paper-item-min-height: var(--mc-unit);\n --mdc-icon-button-size: calc(var(--mc-unit) * 0.75);\n }\n ha-card.--group {\n box-shadow: none;\n }\n ha-card.--bg {\n --mc-info-opacity: .75;\n }\n ha-card {\n cursor: default;\n display: flex;\n background: transparent;\n overflow: visible;\n padding: 0;\n position: relative;\n color: inherit;\n font-size: calc(var(--mc-unit) * 0.35);\n border: none;\n }\n ha-card:before {\n content: '';\n padding-top: 0px;\n transition: padding-top .5s cubic-bezier(.21,.61,.35,1);\n will-change: padding-top;\n }\n header {\n display: none;\n }\n .mc__bg {\n background: var(--ha-card-background, var(--card-background-color, var(--paper-card-background-color, white)));\n position: absolute;\n top: 0; right: 0; bottom: 0; left: 0;\n overflow: hidden;\n -webkit-transform: translateZ(0);\n transform: translateZ(0);\n opacity: var(--mc-bg-opacity);\n box-shadow: var(--ha-card-box-shadow, none);\n box-sizing: border-box;\n border-radius: var(--ha-card-border-radius, 12px);\n border-width: var(--ha-card-border-width, 1px);\n border-style: solid;\n border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0) );\n }\n ha-card.--group .mc__bg {\n background: none;\n border: none;\n }\n .mc-climate {\n align-self: flex-end;\n box-sizing: border-box;\n position: relative;\n padding: 16px 16px 0px 16px;\n transition: padding .25s ease-out;\n width: 100%;\n will-change: padding;\n }\n .flex {\n display: flex;\n display: -ms-flexbox;\n display: -webkit-flex;\n flex-direction: row;\n }\n .mc-climate__core {\n position: relative;\n padding-right: 5px;\n }\n .entity__info {\n user-select: none;\n margin-left: var(--mc-entity-info-left-offset);\n flex: 1;\n min-width: 0;\n white-space: nowrap;\n }\n .entity__icon {\n color: var(--mc-icon-color);\n white-space: nowrap;\n }\n .entity__icon[color] {\n color: var(--mc-icon-active-color);\n }\n .entity__icon {\n animation: fade-in .25s ease-out;\n background-position: center center;\n background-repeat: no-repeat;\n background-size: cover;\n border-radius: 100%;\n height: var(--mc-unit);\n width: var(--mc-unit);\n min-width: var(--mc-unit);\n line-height: var(--mc-unit);\n margin-right: calc(var(--mc-unit) / 5);\n position: relative;\n text-align: center;\n will-change: border-color;\n transition: border-color .25s ease-out;\n }\n .entity__info__name {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n line-height: calc(var(--mc-unit) / 2);\n color: var(--mc-text-color);\n font-weight: var(--mc-name-font-weight);\n }\n .entity__secondary_info {\n margin-top: -2px;\n }\n ha-card.--initial .mc-climate {\n padding: 16px 16px 5px 16px;\n }\n ha-card.--unavailable .mc-climate {\n padding: 16px;\n }\n ha-card.--group .mc-climate {\n padding: 8px 0px 0px 0px;\n }\n .toggle-button {\n width: calc(var(--mc-unit) * .75);\n height: calc(var(--mc-unit) * .75);\n --mdc-icon-button-size: calc(var(--mc-unit) * .75);\n color: var(--mc-icon-color);\n margin-left: auto;\n margin-top: calc(var(--mc-unit) * -.125);\n margin-right: calc(var(--mc-unit) * .05);\n --ha-icon-display: flex;\n }\n .toggle-button.open {\n transform: rotate(180deg);\n color: var(--mc-active-color);\n }\n .wrap {\n display: flex;\n flex-direction: row;\n }\n .entity__controls {\n margin-left: auto;\n display: flex;\n white-space: nowrap;\n margin-top: calc(var(--mc-unit) * -.25);\n }\n .ctl-wrap {\n display: flex;\n flex-direction: row;\n margin-left: auto;\n margin-top: auto;\n margin-bottom: 0;\n --ha-icon-display: flex;\n }\n .bottom {\n margin-top: calc(var(--mc-unit) * .05);\n height: calc(var(--mc-unit) * .625);;\n }\n .entity__info__name_wrap {\n margin-right: 10px;\n max-width: calc(calc(var(--mc-card-width) - 191.3px) / 1.43);\n min-width: calc(var(--mc-unit) * 2.5);\n cursor: pointer;\n height: var(--mc-unit);\n }\n mc-buttons {\n width: 100%;\n justify-content: space-evenly;\n display: flex;\n --ha-icon-display: flex;\n }\n mc-temperature {\n min-width: 0;\n }\n .--unavailable .ctl-wrap {\n margin-left: auto;\n margin-top: auto;\n margin-bottom: auto;\n }\n .--unavailable .entity__info {\n margin-top: auto;\n margin-bottom: auto;\n }\n .mc-toggle_content {\n margin-top: calc(var(--mc-unit) * .05);\n }\n .ctl-wrap mc-dropdown, .ctl-wrap mc-button {\n min-width: calc(var(--mc-unit) * .75);\n margin-right: 3px;\n }\n .ctl-wrap mc-button {\n width: calc(var(--mc-unit) * 0.75);\n height: calc(var(--mc-unit) * 0.75);\n }\n"])));
var sharedStyle = css$3(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .label {\n margin: 0 8px;\n }\n ha-icon {\n width: calc(var(--mc-unit) * .6);\n height: calc(var(--mc-unit) * .6);\n }\n ha-icon-button {\n color: var(--mc-button-color);\n transition: color .25s;\n }\n ha-icon-button[color] {\n color: var(--mc-icon-active-color) !important;\n opacity: 1 !important;\n }\n ha-icon-button[inactive] {\n opacity: .5;\n }\n"])));
var handleClick = (node, hass, config, entityId) => {
var e;
if (!config) {
return;
}
switch (config.action) {
case 'more-info':
{
e = new Event('hass-more-info', {
composed: true
});
e.detail = {
entityId: config.entity || entityId
};
node.dispatchEvent(e);
break;
}
case 'navigate':
{
if (!config.navigation_path) {
return;
}
window.history.pushState(null, '', config.navigation_path);
e = new Event('location-changed', {
composed: true
});
e.detail = {
replace: false
};
window.dispatchEvent(e);
break;
}
case 'call-service':
{
if (!config.service) {
return;
}
var [domain, service] = config.service.split('.', 2);
var serviceData = _objectSpread({}, config.service_data);
hass.callService(domain, service, serviceData);
break;
}
case 'fire-dom-event':
{
e = new Event('ll-custom', {
composed: true,
bubbles: true
});
e.detail = _objectSpread({}, config);
node.dispatchEvent(e);
break;
}
case 'url':
{
if (!config.url) {
return;
}
window.location.href = config.url;
}
}
};
var getLabel = function getLabel(hass, labels) {
var fallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'unknown';
var lang = hass.selectedLanguage || hass.language;
var resources = hass.resources[lang];
if (!resources) {
return fallback;
}
for (var i = 0; i < labels.length; i += 1) {
var label = labels[i];
if (resources[label]) {
return resources[label];
}
}
return fallback;
};
var version = "v2.7.0";
console.info("%c MINI-CLIMATE-CARD %c ".concat(version, " "), 'color: white; background: coral; font-weight: 700;', 'color: coral; background: white; font-weight: 700;');
var ICON = {
DEFAULT: 'mdi:air-conditioner',
FAN: 'mdi:fan',
OFF: 'mdi:power',
HEAT: 'mdi:weather-sunny',
AUTO: 'mdi:cached',
COOL: 'mdi:snowflake',
HEAT_COOL: 'mdi:sun-snowflake',
DRY: 'mdi:water',
FAN_ONLY: 'mdi:fan',
TOGGLE: 'mdi:dots-horizontal',
UP: 'mdi:chevron-up',
DOWN: 'mdi:chevron-down'
};
var STATES_OFF = ['closed', 'locked', 'off'];
var UNAVAILABLE = 'unavailable';
var UNKNOWN = 'unknown';
var UNAVAILABLE_STATES = [UNAVAILABLE, UNKNOWN];
var ACTION_TIMEOUT = 2000;
var TAP_ACTIONS = ['more-info', 'navigate', 'call-service', 'url', 'fire-dom-event'];
var NO_TARGET_TEMPERATURE = '-';
var toggleState = state => {
if (!state) {
return state;
}
if (!STATES_OFF.includes(state) && !UNAVAILABLE_STATES.includes(state)) {
return 'off';
}
if (STATES_OFF.includes(state) && !UNAVAILABLE_STATES.includes(state)) {
return 'on';
}
return state;
};
var getEntityValue = (entity, config) => {
if (!entity) {
return undefined;
}
if (!config) {
return entity.state;
}
if (config.attribute && entity.attributes) {
return entity.attributes[config.attribute];
}
return entity.state;
};
var round = (value, decimals) => Number("".concat(Math.round(Number("".concat(value, "e").concat(decimals))), "e-").concat(decimals));
var compileTemplate = (template, context) => {
try {
return new Function('', "return ".concat(template)).call(context || {});
} catch (e) {
throw new Error("\n[COMPILE ERROR]: [".concat(e.toString(), "]\n[SOURCE]: ").concat(template, "\n"));
}
};
class TemperatureObject {
constructor(temperatureEntity, targetTemperatureEntity, config, climate) {
this.climate = climate || {};
this.temperatureEntity = temperatureEntity || {};
this.targetTemperatureEntity = targetTemperatureEntity || {};
this.config = config;
if (this.config.hide_current_temperature) {
if (typeof this.config.hide_current_temperature === 'boolean') {
this.shouldHideCurrentTemperature = () => true;
} else {
this.shouldHideCurrentTemperature = compileTemplate(this.config.hide_current_temperature);
}
} else {
this.shouldHideCurrentTemperature = () => false;
}
}
get unit() {
return this.config.temperature.unit || this.config.target_temperature.unit;
}
get step() {
var entity = this.targetTemperatureEntity;
if ('step' in this.config.target_temperature) {
return this.config.target_temperature.step;
}
if (entity && entity.attributes && entity.attributes.target_temp_step) {
return entity.attributes.target_temp_step;
}
return 1;
}
get value() {
var value = this.rawValue;
if (value !== undefined) {
if ('fixed' in this.config.temperature) {
return parseFloat(value.toString()).toFixed(this.config.temperature.fixed);
}
if ('round' in this.config.temperature) {
return round(value, this.config.temperature.round);
}
}
return value;
}
get rawValue() {
return getEntityValue(this.temperatureEntity, this.config.temperature.source);
}
get hide() {
return this.shouldHideCurrentTemperature(this.value, this.temperatureEntity, this.targetTemperatureEntity, this.climate.entity, this.climate.mode);
}
}
class TargetTemperatureObject {
constructor(entity, config, hass) {
this.entity = entity || {};
this.config = config;
this._hass = hass;
this.min = this.getMin();
this.max = this.getMax();
this.step = this.getStep();
}
get hass() {
return this._hass;
}
get icons() {
return this.config.target_temperature.icons;
}
getStep() {
if ('step' in this.config.target_temperature) {
return parseFloat(this.config.target_temperature.step);
}
if (this.entity && this.entity.attributes && this.entity.attributes.target_temp_step) {
return parseFloat(this.entity.attributes.target_temp_step);
}
return 1.0;
}
getMin() {
if ('min' in this.config.target_temperature) {
return parseFloat(this.config.target_temperature.min);
}
if (this.entity && this.entity.attributes && this.entity.attributes.min_temp) {
return parseFloat(this.entity.attributes.min_temp);
}
return 16.0;
}
getMax() {
if ('max' in this.config.target_temperature) {
return parseFloat(this.config.target_temperature.max);
}
if (this.entity && this.entity.attributes && this.entity.attributes.max_temp) {
return parseFloat(this.entity.attributes.max_temp);
}
return 30.0;
}
_floatOrPlaceholder(value) {
if (Number.isNaN(value)) {
return NO_TARGET_TEMPERATURE;
}
return value;
}
get value() {
if (this._targetTemperature !== undefined) {
return this._floatOrPlaceholder(parseFloat(this._targetTemperature));
}
var newValue = getEntityValue(this.entity, this.config.target_temperature.source);
return this._floatOrPlaceholder(parseFloat(newValue));
}
set value(value) {
this._targetTemperature = parseFloat(value);
}
increment() {
var oldValue = this.value;
if (oldValue === NO_TARGET_TEMPERATURE) {
return false;
}
var newVal = this._round(this.value + this.step);
if (newVal <= this.max) {
if (newVal <= this.min) {
this.value = this.min;
} else {
this.value = newVal;
}
} else {
this.value = this.max;
}
return oldValue !== this.value;
}
decrement() {
var oldValue = this.value;
if (oldValue === NO_TARGET_TEMPERATURE) {
return false;
}
var newVal = this._round(this.value - this.step);
if (newVal >= this.min) {
this.value = newVal;
} else {
this.value = this.min;
}
return oldValue !== this.value;
}
_round(val) {
var s = this.step.toString().split('.');
if (s[1]) {
return parseFloat(val.toFixed(s[1].length));
} else {
return Math.round(val);
}
}
update(value) {
if (this.config.target_temperature.functions.change_action) {
var climateEntity = this.hass[this.config.entity];
return this.config.target_temperature.functions.change_action(value, this.entity, climateEntity);
}
return this.hass.callService('climate', 'set_temperature', {
entity_id: this.entity.entity_id,
temperature: value
});
}
}
class ButtonObject {
constructor(entity, config, climate, hass) {
this.config = config || {};
this.entity = entity || {};
this.climate = climate || {};
this._hass = hass || {};
}
get id() {
return this.config.id;
}
get location() {
return this.config.location || 'bottom';
}
get hass() {
return this._hass;
}
get type() {
return this.config.type;
}
get order() {
return this.config.order;
}
get hide() {
if (this.config.functions.hide) {
return this.config.functions.hide(this.state, this.entity, this.climate.entity, this.climate.mode);
}
return false;
}
get icon() {
return this.config.icon;
}
get originalState() {
return getEntityValue(this.entity, this.config.state);
}
get state() {
var state = this.originalState;
if (this.config.functions.state && this.config.functions.state.mapper) {
state = this.config.functions.state.mapper(state, this.entity, this.climate.entity, this.climate.mode);
}
return state;
}
isActive(state) {
if (this.config.functions.active) {
return this.config.functions.active(state, this.entity, this.climate.entity, this.climate.mode);
}
return false;
}
get isUnavailable() {
return this.entity === undefined || UNAVAILABLE_STATES.includes(this.state);
}
get isOn() {
return this.entity !== undefined && !STATES_OFF.includes(this.state) && !UNAVAILABLE_STATES.includes(this.state);
}
get disabled() {
if (this.config.functions.disabled) {
return this.config.functions.disabled(this.state, this.entity, this.climate.entity, this.climate.mode);
}
return false;
}
get style() {
if (this.config.functions.style) {
return this.config.functions.style(this.state, this.entity, this.climate.entity, this.climate.mode) || {};
}
return {};
}
get source() {
var {
functions
} = this.config;
var source = Object.entries(this.config.source || {}).filter(_ref5 => {
var [key] = _ref5;
return key !== '__filter';
}).map(_ref6 => {
var [key, value] = _ref6;
if (typeof value === 'object') {
return _objectSpread({
id: key
}, value || {});
}
return {
id: key,
name: value
};
});
if (source.some(s => 'order' in s)) {
source = source.sort((a, b) => a.order > b.order ? 1 : b.order > a.order ? -1 : 0);
}
if (functions.source && functions.source.filter) {
return functions.source.filter(source, this.state, this.entity, this.climate.entity, this.climate.mode);
}
return source;
}
get selected() {
var {
state
} = this;
if (state === undefined || state === null) {
return undefined;
}
return this.source.find(s => s.id === state.toString());
}
get actionTimeout() {
if ('action_timeout' in this.config) {
return this.config.action_timeout;
}
return ACTION_TIMEOUT;
}
handleToggle() {
if (this.config.functions.toggle_action) {
return this.config.functions.toggle_action(this.state, this.entity, this.climate.entity, this.climate.mode);
}
return this.climate.callService('switch', 'toggle', {
entity_id: this.entity.entity_id
});
}
handleChange(selected) {
if (this.config.functions.change_action) {
return this.config.functions.change_action(selected, this.state, this.entity, this.climate.entity, this.climate.mode);
}
return undefined;
}
}
class IndicatorObject {
constructor(entity, config, climate, hass) {
this.config = config || {};
this.entity = entity || {};
this.climate = climate || {};
this._hass = hass || {};
}
get id() {
return this.config.id;
}
get hass() {
return this._hass;
}
get originalValue() {
return getEntityValue(this.entity, this.config.source);
}
get value() {
var value = this.originalValue;
if (this.config.functions.mapper) {
value = this.config.functions.mapper(value, this.entity, this.climate.entity, this.climate.mode);
}
if ('round' in this.config && Number.isNaN(value) === false) {
value = round(value, this.config.round);
}
return value;
}
get unit() {
return this.config.unit;
}
get icon() {
if (this.config.functions.icon && this.config.functions.icon.template) {
return this.config.functions.icon.template(this.value, this.entity, this.climate.entity, this.climate.mode);
} else if (this.config.icon && typeof this.config.icon === 'string') {
return this.config.icon;
}
return '';
}
get iconStyle() {
if (this.config.functions.icon && this.config.functions.icon.style) {
return this.config.functions.icon.style(this.value, this.entity, this.climate.entity, this.climate.mode) || {};
}
return {};
}
get valueStyle() {
if (this.config.functions.value && this.config.functions.value.style) {
return this.config.functions.value.style(this.value, this.entity, this.climate.entity, this.climate.mode) || {};
}
return {};
}
get hide() {
if (this.config.functions.hide) {
return this.config.functions.hide(this.value, this.entity, this.climate.entity, this.climate.mode);
}
return false;
}
}
class ClimateObject {
constructor(hass, config, entity) {
this.hass = hass || {};
this.config = config || {};
this.entity = entity || {};
this.state = entity.state;
this.attr = _objectSpread({
friendly_name: '',
temperature: 16,
current_temperature: 24,
fan_mode: '',
hvac_modes: [],
target_temp_step: undefined,
min_temp: undefined,
max_temp: undefined,
hvac_action: '',
fan_modes: []
}, entity.attributes || {});
}
get lastChanged() {
return this.entity.last_changed;
}
get lastUpdated() {
return this.entity.last_updated;
}
get hvacAction() {
var source = this.config.secondary_info && this.config.secondary_info.source || {};
var action = this.attr.hvac_action;
var item = {
id: action
};
var labelPrefix = 'state_attributes.climate.hvac_action';
item.name = getLabel(this.hass, ["".concat(labelPrefix, ".").concat(action)], action);
if (action in source) {
if (typeof source[action] === 'string') {
item.name = source[action];
} else {
item = _objectSpread(_objectSpread({}, item), source[action]);
}
}
return item;
}
get mode() {
return this._hvac_mode;
}
set mode(value) {
this._hvac_mode = value;
}
get defaultHvacModes() {
var hvacModes = this.attr.hvac_modes;
var source = [];
for (var i = 0; i < hvacModes.length; i += 1) {
var hvacMode = hvacModes[i];
var labels = ["state.climate.".concat(hvacMode), "component.climate.state._.".concat(hvacMode)];
var item = {
id: hvacMode,
name: getLabel(this.hass, labels, hvacMode)
};
var iconId = hvacMode.toString().toUpperCase();
if (iconId in ICON) {
item.icon = ICON[iconId];
}
source.push(item);
}
return source;
}
get defaultFanModes() {
var fanModes = this.attr.fan_modes;
var source = {};
var labelPrefix = 'state_attributes.climate.fan_mode';
for (var i = 0; i < fanModes.length; i += 1) {
var mode = fanModes[i];
source[mode] = getLabel(this.hass, ["".concat(labelPrefix, ".").concat(mode)], mode);
}
return source;
}
get id() {
return this.entity.entity_id;
}
get icon() {
return this.attr.icon;
}
get name() {
return this.attr.friendly_name || '';
}
get isOff() {
return this.entity !== undefined && STATES_OFF.includes(this.state) && !UNAVAILABLE_STATES.includes(this.state);
}
get isActive() {
return this.isOff === false && this.isUnavailable === false || false;
}
get isUnavailable() {
return this.entity === undefined || UNAVAILABLE_STATES.includes(this.state);
}
get isOn() {
return this.entity !== undefined && !STATES_OFF.includes(this.state) && !UNAVAILABLE_STATES.includes(this.state);
}
callService(domain, service, inOptions) {
return this.hass.callService(domain, service, _objectSpread({
entity_id: this.config.entity
}, inOptions));
}
}
class HvacModeObject {
constructor(entity, config, climate) {
this.config = config || {};
this.entity = entity || {};
this.climate = climate || {};
}
get hide() {
if (this.config.functions.hide) {
return this.config.functions.hide(this.state, this.entity, this.climate.entity, this.climate.mode);
}
return false;
}
get originalState() {
return getEntityValue(this.entity, this.config.state);
}
get state() {
var state = this.originalState;
if (this.config.functions.state && this.config.functions.state.mapper) {
state = this.config.functions.state.mapper(state, this.entity, this.climate.entity);
}
return state;
}
isActive(state) {
if (this.config.functions.active) {
return this.config.functions.active(state, this.entity, this.climate.entity);
}
return false;
}
get disabled() {
if (this.config.functions.disabled) {
return this.config.functions.disabled(this.state, this.entity, this.climate.entity);
}
return false;
}
get style() {
if (this.config.functions.style) {
return this.config.functions.style(this.state, this.entity, this.climate.entity) || {};
}
return {};
}
get source() {
var {
functions
} = this.config;
var source = Object.entries(this.config.source || {}).filter(_ref7 => {
var [key] = _ref7;
return key !== '__filter';
}).map(_ref8 => {
var [key, value] = _ref8;
if (typeof value === 'object') {
return _objectSpread({
id: key
}, value || {});
}
return {
id: key,
name: value
};
});
if (source.some(s => 'order' in s)) {
source = source.sort((a, b) => a.order > b.order ? 1 : b.order > a.order ? -1 : 0);
}
if (functions.source && functions.source.filter) {
return functions.source.filter(source, this.state, this.entity, this.climate.entity);
}
return source;
}
get selected() {
var {
state
} = this;
if (state === undefined || state === null) {
return undefined;
}
return this.source.find(s => s.id === state.toString());
}
handleChange(selected) {
if (this.config.functions.change_action) {
return this.config.functions.change_action(selected, this.entity, this.climate.entity);
}
return undefined;
}
}
var buildElementDefinitions = (elements, constructor) => {
var promises = [];
var definitions = elements.reduce((aggregate, element) => {
if (typeof element === 'string') {
var clazz = customElements.get(element);
if (clazz) {
aggregate[element] = clazz;
} else {
promises.push(customElements.whenDefined(element).then(() => {
if (constructor.registry.get(element) === undefined) {
constructor.registry.define(element, customElements.get(element));
}
}));
}
} else {
aggregate[element.defineId] = element;
}
return aggregate;
}, {});
constructor.elementDefinitionsLoaded = promises.length === 0;
if (!constructor.elementDefinitionsLoaded) {
Promise.all(promises).then(() => {
constructor.elementDefinitionsLoaded = true;
});
}
return definitions;
};
class ClimateTemperature extends ScopedRegistryHost(LitElement$4) {
static get defineId() {
return 'mc-temperature';
}
static get elementDefinitions() {
return buildElementDefinitions([], ClimateTemperature);
}
static get properties() {
return {
temperature: Object,
changing: Boolean,
target: Number,
swapTemperatures: Boolean
};
}
get targetStr() {
var targetStr = this.target.toString();
var targetNum = parseFloat(targetStr);
if (Number.isNaN(targetNum) || targetStr === NO_TARGET_TEMPERATURE) {
return NO_TARGET_TEMPERATURE;
}
var parts = this.temperature.step.toString().split('.');
if (parts[1]) {
return targetNum.toFixed(parts[1].length);
} else {
return targetStr;
}
}
renderTemperature() {
if (this.temperature.value === undefined || this.temperature.hide) {
return '';
}
if (this.swapTemperatures) {
return html$3(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n <span class='state__value'>", "</span>\n <span class='state__value'>/</span>"])), this.temperature.value);
}
return html$3(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n <span class='state__value'>/</span>\n <span class='state__value'>", "</span>"])), this.temperature.value);
}
render() {
if (!ClimateTemperature.elementDefinitionsLoaded) {
return html$3(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral([""])));
}
if (!this.temperature) {
return html$3(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral([""])));
}
var cls = this.changing ? 'changing' : '';
var {
unit
} = this.temperature;
if (this.swapTemperatures) {
return html$3(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n <div class='state ellipsis'>\n ", "\n <span class='state__value ", "'>", "</span>\n <span class='state__uom'>", "</span>\n </div>"])), this.renderTemperature(), cls, this.targetStr, unit);
}
return html$3(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n <div class='state ellipsis'>\n <span class='state__value ", "'>", "</span>\n ", "\n <span class='state__uom'>", "</span>\n </div>\n "])), cls, this.targetStr, this.renderTemperature(), unit);
}
static get styles() {
return css$3(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n .state {\n margin-top:calc(var(--mc-unit) * .15);\n }\n .state__value {\n font-weight: var(--mc-info-font-weight);\n line-height: calc(var(--mc-unit) * .475);\n font-size: calc(var(--mc-unit) * .475);\n }\n .state__uom {\n font-size: calc(var(--mc-unit) * 0.35);\n font-weight: var(--mc-name-font-weight);\n opacity: 0.6;\n line-height: calc(var(--mc-unit) * 0.475);\n }\n .ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .changing {\n color: var(--mc-accent-color);\n }\n "])));
}
}
class ClimateTargetTemperature extends ScopedRegistryHost(LitElement$4) {
static get defineId() {
return 'mc-target-temperature';
}
static get elementDefinitions() {
return buildElementDefinitions(['ha-icon', 'ha-icon-button'], ClimateTargetTemperature);
}
constructor() {
super();
this.timeout = 800;
}
static get properties() {
return {
targetTemperature: {
type: Object
}
};
}
increment(e) {
e.stopPropagation();
var changed = this.targetTemperature.increment();
if (changed) {
this.temp_last_changed = Date.now();
this.targetTemperatureChanged();
}
}
decrement(e) {
e.stopPropagation();
var changed = this.targetTemperature.decrement();
if (changed) {
this.temp_last_changed = Date.now();
this.targetTemperatureChanged();
}
}
sendChangeEvent(changing) {
var data = {
detail: {
changing
}
};
var event = new CustomEvent('changing', data);
this.dispatchEvent(event);
}
targetTemperatureChanged() {
if (!this.temp_last_changed) {
return;
}
this.sendChangeEvent(true);
window.setTimeout(() => {
var now = Date.now();
if (now - this.temp_last_changed >= this.timeout) {
var {
value
} = this.targetTemperature;
try {
this.targetTemperature.update(value);
} finally {
this.sendChangeEvent(false);
this.temp_last_changed = null;
}
}
}, this.timeout + 10);
}
render() {
if (!ClimateTargetTemperature.elementDefinitionsLoaded) {
return html$3(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral([""])));
}
if (!this.targetTemperature) {
return '';
}
return html$3(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n <div class='controls-wrap'>\n <ha-icon-button class='temp --up'\n .icon=", "\n @click=", ">\n <ha-icon .icon=", "></ha-icon>\n </ha-icon-button>\n <ha-icon-button class='temp --down'\n .icon=", "\n @click=", ">\n <ha-icon .icon=", "></ha-icon>\n </ha-icon-button>\n </div>\n "])), this.targetTemperature.icons.up, e => this.increment(e), this.targetTemperature.icons.up, this.targetTemperature.icons.down, e => this.decrement(e), this.targetTemperature.icons.down);
}
static get styles() {
return css$3(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n .controls-wrap {\n display: flex;\n flex-direction: column;\n height: 100%;\n --ha-icon-display: flex;\n }\n .temp {\n width: calc(var(--mc-unit) * .75);\n height: calc(var(--mc-unit) * .75);\n --mdc-icon-button-size: calc(var(--mc-unit) * .75);\n color: var(--mc-icon-color);\n }\n .temp.--up {\n margin-top: -2px;\n }\n .temp.--down {\n margin-top: -2px;\n }\n .temp.--down {\n margin-top: auto;\n }\n "])));
}
}
var _extendStatics = function extendStatics(d, b) {
_extendStatics = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function (d, b) {
d.__proto__ = b;
} || function (d, b) {
for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) {
d[p] = b[p];
}
};
return _extendStatics(d, b);
};
function __extends(d, b) {
if (typeof b !== "function" && b !== null) {
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
}
_extendStatics(d, b);
function __() {
this.constructor = d;
}
if (b === null) {
d.prototype = Object.create(b);
} else {
d.prototype = (__.prototype = b.prototype, new __());
}
}
var _assign = function __assign() {
_assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) {
t[p] = s[p];
}
}
return t;
};
return _assign.apply(this, arguments);
};
function __decorate(decorators, target, key, desc) {
var d;
var c = arguments.length;
var r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
r = Reflect.decorate(decorators, target, key, desc);
} else {
for (var i = decorators.length - 1; i >= 0; i--) {
if (d = decorators[i]) {
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
}
}
}
if (c > 3 && r) {
Object.defineProperty(target, key, r);
}
return r;
}
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator;
var m = s && o[s];
var i = 0;
if (m) {
return m.call(o);
}
if (o && typeof o.length === "number") {
return {
next() {
if (o && i >= o.length) {
o = void 0;
}
return {
value: o && o[i++],
done: !o
};
}
};
}
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
if (typeof SuppressedError === "function") {
SuppressedError;
} else {
(function (error, suppressed, message) {
var e = new Error(message);
e.name = "SuppressedError";
e.error = error;
e.suppressed = suppressed;
return e;
});
}
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var cssClasses$3 = {
MENU_SELECTED_LIST_ITEM: 'mdc-menu-item--selected',
MENU_SELECTION_GROUP: 'mdc-menu__selection-group',
ROOT: 'mdc-menu'
};
var strings$3 = {
ARIA_CHECKED_ATTR: 'aria-checked',
ARIA_DISABLED_ATTR: 'aria-disabled',
CHECKBOX_SELECTOR: 'input[type="checkbox"]',
LIST_SELECTOR: '.mdc-list,.mdc-deprecated-list',
SELECTED_EVENT: 'MDCMenu:selected',
SKIP_RESTORE_FOCUS: 'data-menu-item-skip-restore-focus'
};
var numbers$3 = {
FOCUS_ROOT_INDEX: -1
};
var DefaultFocusState;
(function (DefaultFocusState) {
DefaultFocusState[DefaultFocusState["NONE"] = 0] = "NONE";
DefaultFocusState[DefaultFocusState["LIST_ROOT"] = 1] = "LIST_ROOT";
DefaultFocusState[DefaultFocusState["FIRST_ITEM"] = 2] = "FIRST_ITEM";
DefaultFocusState[DefaultFocusState["LAST_ITEM"] = 3] = "LAST_ITEM";
})(DefaultFocusState || (DefaultFocusState = {}));
/**
* @license
* Copyright 2016 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var MDCFoundation = function () {
function MDCFoundation(adapter) {
if (adapter === void 0) {
adapter = {};
}
this.adapter = adapter;
}
Object.defineProperty(MDCFoundation, "cssClasses", {
get() {
return {};
},
enumerable: false,
configurable: true
});
Object.defineProperty(MDCFoundation, "strings", {
get() {
return {};
},
enumerable: false,
configurable: true
});
Object.defineProperty(MDCFoundation, "numbers", {
get() {
return {};
},
enumerable: false,
configurable: true
});
Object.defineProperty(MDCFoundation, "defaultAdapter", {
get() {
return {};
},
enumerable: false,
configurable: true
});
MDCFoundation.prototype.init = function () {};
MDCFoundation.prototype.destroy = function () {};
return MDCFoundation;
}();
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var _a$b, _b$c;
var cssClasses$2 = {
LIST_ITEM_ACTIVATED_CLASS: 'mdc-list-item--activated',
LIST_ITEM_CLASS: 'mdc-list-item',
LIST_ITEM_DISABLED_CLASS: 'mdc-list-item--disabled',
LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected',
LIST_ITEM_TEXT_CLASS: 'mdc-list-item__text',
LIST_ITEM_PRIMARY_TEXT_CLASS: 'mdc-list-item__primary-text',
ROOT: 'mdc-list'
};
_a$b = {};
_a$b["" + cssClasses$2.LIST_ITEM_ACTIVATED_CLASS] = 'mdc-list-item--activated';
_a$b["" + cssClasses$2.LIST_ITEM_CLASS] = 'mdc-list-item';
_a$b["" + cssClasses$2.LIST_ITEM_DISABLED_CLASS] = 'mdc-list-item--disabled';
_a$b["" + cssClasses$2.LIST_ITEM_SELECTED_CLASS] = 'mdc-list-item--selected';
_a$b["" + cssClasses$2.LIST_ITEM_PRIMARY_TEXT_CLASS] = 'mdc-list-item__primary-text';
_a$b["" + cssClasses$2.ROOT] = 'mdc-list';
_a$b;
var deprecatedClassNameMap = (_b$c = {}, _b$c["" + cssClasses$2.LIST_ITEM_ACTIVATED_CLASS] = 'mdc-deprecated-list-item--activated', _b$c["" + cssClasses$2.LIST_ITEM_CLASS] = 'mdc-deprecated-list-item', _b$c["" + cssClasses$2.LIST_ITEM_DISABLED_CLASS] = 'mdc-deprecated-list-item--disabled', _b$c["" + cssClasses$2.LIST_ITEM_SELECTED_CLASS] = 'mdc-deprecated-list-item--selected', _b$c["" + cssClasses$2.LIST_ITEM_TEXT_CLASS] = 'mdc-deprecated-list-item__text', _b$c["" + cssClasses$2.LIST_ITEM_PRIMARY_TEXT_CLASS] = 'mdc-deprecated-list-item__primary-text', _b$c["" + cssClasses$2.ROOT] = 'mdc-deprecated-list', _b$c);
var strings$2 = {
ACTION_EVENT: 'MDCList:action',
SELECTION_CHANGE_EVENT: 'MDCList:selectionChange',
ARIA_CHECKED: 'aria-checked',
ARIA_CHECKED_CHECKBOX_SELECTOR: '[role="checkbox"][aria-checked="true"]',
ARIA_CHECKED_RADIO_SELECTOR: '[role="radio"][aria-checked="true"]',
ARIA_CURRENT: 'aria-current',
ARIA_DISABLED: 'aria-disabled',
ARIA_ORIENTATION: 'aria-orientation',
ARIA_ORIENTATION_HORIZONTAL: 'horizontal',
ARIA_ROLE_CHECKBOX_SELECTOR: '[role="checkbox"]',
ARIA_SELECTED: 'aria-selected',
ARIA_INTERACTIVE_ROLES_SELECTOR: '[role="listbox"], [role="menu"]',
ARIA_MULTI_SELECTABLE_SELECTOR: '[aria-multiselectable="true"]',
CHECKBOX_RADIO_SELECTOR: 'input[type="checkbox"], input[type="radio"]',
CHECKBOX_SELECTOR: 'input[type="checkbox"]',
CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: "\n ." + cssClasses$2.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses$2.LIST_ITEM_CLASS + " a,\n ." + deprecatedClassNameMap[cssClasses$2.LIST_ITEM_CLASS] + " button:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses$2.LIST_ITEM_CLASS] + " a\n ",
DEPRECATED_SELECTOR: '.mdc-deprecated-list',
FOCUSABLE_CHILD_ELEMENTS: "\n ." + cssClasses$2.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses$2.LIST_ITEM_CLASS + " a,\n ." + cssClasses$2.LIST_ITEM_CLASS + " input[type=\"radio\"]:not(:disabled),\n ." + cssClasses$2.LIST_ITEM_CLASS + " input[type=\"checkbox\"]:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses$2.LIST_ITEM_CLASS] + " button:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses$2.LIST_ITEM_CLASS] + " a,\n ." + deprecatedClassNameMap[cssClasses$2.LIST_ITEM_CLASS] + " input[type=\"radio\"]:not(:disabled),\n ." + deprecatedClassNameMap[cssClasses$2.LIST_ITEM_CLASS] + " input[type=\"checkbox\"]:not(:disabled)\n ",
RADIO_SELECTOR: 'input[type="radio"]',
SELECTED_ITEM_SELECTOR: '[aria-selected="true"], [aria-current="true"]'
};
var numbers$2 = {
UNSET_INDEX: -1,
TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS: 300
};
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var cssClasses$1 = {
ANCHOR: 'mdc-menu-surface--anchor',
ANIMATING_CLOSED: 'mdc-menu-surface--animating-closed',
ANIMATING_OPEN: 'mdc-menu-surface--animating-open',
FIXED: 'mdc-menu-surface--fixed',
IS_OPEN_BELOW: 'mdc-menu-surface--is-open-below',
OPEN: 'mdc-menu-surface--open',
ROOT: 'mdc-menu-surface'
};
var strings$1 = {
CLOSED_EVENT: 'MDCMenuSurface:closed',
CLOSING_EVENT: 'MDCMenuSurface:closing',
OPENED_EVENT: 'MDCMenuSurface:opened',
OPENING_EVENT: 'MDCMenuSurface:opening',
FOCUSABLE_ELEMENTS: ['button:not(:disabled)', '[href]:not([aria-disabled="true"])', 'input:not(:disabled)', 'select:not(:disabled)', 'textarea:not(:disabled)', '[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])'].join(', ')
};
var numbers$1 = {
TRANSITION_OPEN_DURATION: 120,
TRANSITION_CLOSE_DURATION: 75,
MARGIN_TO_EDGE: 32,
ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO: 0.67,
TOUCH_EVENT_WAIT_MS: 30
};
var CornerBit;
(function (CornerBit) {
CornerBit[CornerBit["BOTTOM"] = 1] = "BOTTOM";
CornerBit[CornerBit["CENTER"] = 2] = "CENTER";
CornerBit[CornerBit["RIGHT"] = 4] = "RIGHT";
CornerBit[CornerBit["FLIP_RTL"] = 8] = "FLIP_RTL";
})(CornerBit || (CornerBit = {}));
var Corner;
(function (Corner) {
Corner[Corner["TOP_LEFT"] = 0] = "TOP_LEFT";
Corner[Corner["TOP_RIGHT"] = 4] = "TOP_RIGHT";
Corner[Corner["BOTTOM_LEFT"] = 1] = "BOTTOM_LEFT";
Corner[Corner["BOTTOM_RIGHT"] = 5] = "BOTTOM_RIGHT";
Corner[Corner["TOP_START"] = 8] = "TOP_START";
Corner[Corner["TOP_END"] = 12] = "TOP_END";
Corner[Corner["BOTTOM_START"] = 9] = "BOTTOM_START";
Corner[Corner["BOTTOM_END"] = 13] = "BOTTOM_END";
})(Corner || (Corner = {}));
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var MDCMenuSurfaceFoundation = function (_super) {
__extends(MDCMenuSurfaceFoundation, _super);
function MDCMenuSurfaceFoundation(adapter) {
var _this = _super.call(this, _assign(_assign({}, MDCMenuSurfaceFoundation.defaultAdapter), adapter)) || this;
_this.isSurfaceOpen = false;
_this.isQuickOpen = false;
_this.isHoistedElement = false;
_this.isFixedPosition = false;
_this.isHorizontallyCenteredOnViewport = false;
_this.maxHeight = 0;
_this.openBottomBias = 0;
_this.openAnimationEndTimerId = 0;
_this.closeAnimationEndTimerId = 0;
_this.animationRequestId = 0;
_this.anchorCorner = Corner.TOP_START;
_this.originCorner = Corner.TOP_START;
_this.anchorMargin = {
top: 0,
right: 0,
bottom: 0,
left: 0
};
_this.position = {
x: 0,
y: 0
};
return _this;
}
Object.defineProperty(MDCMenuSurfaceFoundation, "cssClasses", {
get() {
return cssClasses$1;
},
enumerable: false,
configurable: true
});
Object.defineProperty(MDCMenuSurfaceFoundation, "strings", {
get() {
return strings$1;
},
enumerable: false,
configurable: true
});
Object.defineProperty(MDCMenuSurfaceFoundation, "numbers", {
get() {
return numbers$1;
},
enumerable: false,
configurable: true
});
Object.defineProperty(MDCMenuSurfaceFoundation, "Corner", {
get() {
return Corner;
},
enumerable: false,
configurable: true
});
Object.defineProperty(MDCMenuSurfaceFoundation, "defaultAdapter", {
get() {
return {
addClass() {
return undefined;
},
removeClass() {
return undefined;
},
hasClass() {
return false;
},
hasAnchor() {
return false;
},
isElementInContainer() {
return false;
},
isFocused() {
return false;
},
isRtl() {
return false;
},
getInnerDimensions() {
return {
height: 0,
width: 0
};
},
getAnchorDimensions() {
return null;
},
getWindowDimensions() {
return {
height: 0,
width: 0
};
},
getBodyDimensions() {
return {
height: 0,
width: 0
};
},
getWindowScroll() {
return {
x: 0,
y: 0
};
},
setPosition() {
return undefined;
},
setMaxHeight() {
return undefined;
},
setTransformOrigin() {
return undefined;
},
saveFocus() {
return undefined;
},
restoreFocus() {
return undefined;
},
notifyClose() {
return undefined;
},
notifyClosing() {
return undefined;
},
notifyOpen() {
return undefined;
},
notifyOpening() {
return undefined;
}
};
},
enumerable: false,
configurable: true
});
MDCMenuSurfaceFoundation.prototype.init = function () {
var _a = MDCMenuSurfaceFoundation.cssClasses;
var ROOT = _a.ROOT;
var OPEN = _a.OPEN;
if (!this.adapter.hasClass(ROOT)) {
throw new Error(ROOT + " class required in root element.");
}
if (this.adapter.hasClass(OPEN)) {
this.isSurfaceOpen = true;
}
};
MDCMenuSurfaceFoundation.prototype.destroy = function () {
clearTimeout(this.openAnimationEndTimerId);
clearTimeout(this.closeAnimationEndTimerId);
cancelAnimationFrame(this.animationRequestId);
};
MDCMenuSurfaceFoundation.prototype.setAnchorCorner = function (corner) {
this.anchorCorner = corner;
};
MDCMenuSurfaceFoundation.prototype.flipCornerHorizontally = function () {
this.originCorner = this.originCorner ^ CornerBit.RIGHT;
};
MDCMenuSurfaceFoundation.prototype.setAnchorMargin = function (margin) {
this.anchorMargin.top = margin.top || 0;
this.anchorMargin.right = margin.right || 0;
this.anchorMargin.bottom = margin.bottom || 0;
this.anchorMargin.left = margin.left || 0;
};
MDCMenuSurfaceFoundation.prototype.setIsHoisted = function (isHoisted) {
this.isHoistedElement = isHoisted;
};
MDCMenuSurfaceFoundation.prototype.setFixedPosition = function (isFixedPosition) {
this.isFixedPosition = isFixedPosition;
};
MDCMenuSurfaceFoundation.prototype.isFixed = function () {
return this.isFixedPosition;
};
MDCMenuSurfaceFoundation.prototype.setAbsolutePosition = function (x, y) {
if (this.isFinite(x)) {
this.position.x = x;
} else {
this.position.x = 0;
}
if (this.isFinite(y)) {
this.position.y = y;
} else {
this.position.y = 0;
}
};
MDCMenuSurfaceFoundation.prototype.setIsHorizontallyCenteredOnViewport = function (isCentered) {
this.isHorizontallyCenteredOnViewport = isCentered;
};
MDCMenuSurfaceFoundation.prototype.setQuickOpen = function (quickOpen) {
this.isQuickOpen = quickOpen;
};
MDCMenuSurfaceFoundation.prototype.setMaxHeight = function (maxHeight) {
this.maxHeight = maxHeight;
};
MDCMenuSurfaceFoundation.prototype.setOpenBottomBias = function (bias) {
this.openBottomBias = bias;
};
MDCMenuSurfaceFoundation.prototype.isOpen = function () {
return this.isSurfaceOpen;
};
MDCMenuSurfaceFoundation.prototype.open = function () {
var _this = this;
if (this.isSurfaceOpen) {
return;
}
this.adapter.notifyOpening();
this.adapter.saveFocus();
if (this.isQuickOpen) {
this.isSurfaceOpen = true;
this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
this.dimensions = this.adapter.getInnerDimensions();
this.autoposition();
this.adapter.notifyOpen();
} else {
this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
this.animationRequestId = requestAnimationFrame(function () {
_this.dimensions = _this.adapter.getInnerDimensions();
_this.autoposition();
_this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
_this.openAnimationEndTimerId = setTimeout(function () {
_this.openAnimationEndTimerId = 0;
_this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_OPEN);
_this.adapter.notifyOpen();
}, numbers$1.TRANSITION_OPEN_DURATION);
});
this.isSurfaceOpen = true;
}
};
MDCMenuSurfaceFoundation.prototype.close = function (skipRestoreFocus) {
var _this = this;
if (skipRestoreFocus === void 0) {
skipRestoreFocus = false;
}
if (!this.isSurfaceOpen) {
return;
}
this.adapter.notifyClosing();
if (this.isQuickOpen) {
this.isSurfaceOpen = false;
if (!skipRestoreFocus) {
this.maybeRestoreFocus();
}
this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);
this.adapter.notifyClose();
return;
}
this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
requestAnimationFrame(function () {
_this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.OPEN);
_this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);
_this.closeAnimationEndTimerId = setTimeout(function () {
_this.closeAnimationEndTimerId = 0;
_this.adapter.removeClass(MDCMenuSurfaceFoundation.cssClasses.ANIMATING_CLOSED);
_this.adapter.notifyClose();
}, numbers$1.TRANSITION_CLOSE_DURATION);
});
this.isSurfaceOpen = false;
if (!skipRestoreFocus) {
this.maybeRestoreFocus();
}
};
MDCMenuSurfaceFoundation.prototype.handleBodyClick = function (evt) {
var el = evt.target;
if (this.adapter.isElementInContainer(el)) {
return;
}
this.close();
};
MDCMenuSurfaceFoundation.prototype.handleKeydown = function (evt) {
var keyCode = evt.keyCode;
var key = evt.key;
var isEscape = key === 'Escape' || keyCode === 27;
if (isEscape) {
this.close();
}
};
MDCMenuSurfaceFoundation.prototype.autoposition = function () {
var _a;
this.measurements = this.getAutoLayoutmeasurements();
var corner = this.getoriginCorner();
var maxMenuSurfaceHeight = this.getMenuSurfaceMaxHeight(corner);
var verticalAlignment = this.hasBit(corner, CornerBit.BOTTOM) ? 'bottom' : 'top';
var horizontalAlignment = this.hasBit(corner, CornerBit.RIGHT) ? 'right' : 'left';
var horizontalOffset = this.getHorizontalOriginOffset(corner);
var verticalOffset = this.getVerticalOriginOffset(corner);
var _b = this.measurements;
var anchorSize = _b.anchorSize;
var surfaceSize = _b.surfaceSize;
var position = (_a = {}, _a[horizontalAlignment] = horizontalOffset, _a[verticalAlignment] = verticalOffset, _a);
if (anchorSize.width / surfaceSize.width > numbers$1.ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO) {
horizontalAlignment = 'center';
}
if (this.isHoistedElement || this.isFixedPosition) {
this.adjustPositionForHoistedElement(position);
}
this.adapter.setTransformOrigin(horizontalAlignment + " " + verticalAlignment);
this.adapter.setPosition(position);
this.adapter.setMaxHeight(maxMenuSurfaceHeight ? maxMenuSurfaceHeight + 'px' : '');
if (!this.hasBit(corner, CornerBit.BOTTOM)) {
this.adapter.addClass(MDCMenuSurfaceFoundation.cssClasses.IS_OPEN_BELOW);
}
};
MDCMenuSurfaceFoundation.prototype.getAutoLayoutmeasurements = function () {
var anchorRect = this.adapter.getAnchorDimensions();
var bodySize = this.adapter.getBodyDimensions();
var viewportSize = this.adapter.getWindowDimensions();
var windowScroll = this.adapter.getWindowScroll();
if (!anchorRect) {
anchorRect = {
top: this.position.y,
right: this.position.x,
bottom: this.position.y,
left: this.position.x,
width: 0,
height: 0
};
}
return {
anchorSize: anchorRect,
bodySize: bodySize,
surfaceSize: this.dimensions,
viewportDistance: {
top: anchorRect.top,
right: viewportSize.width - anchorRect.right,
bottom: viewportSize.height - anchorRect.bottom,
left: anchorRect.left
},
viewportSize: viewportSize,
windowScroll: windowScroll
};
};
MDCMenuSurfaceFoundation.prototype.getoriginCorner = function () {
var corner = this.originCorner;
var _a = this.measurements;
var viewportDistance = _a.viewportDistance;
var anchorSize = _a.anchorSize;
var surfaceSize = _a.surfaceSize;
var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE;
var isAnchoredToBottom = this.hasBit(this.anchorCorner, CornerBit.BOTTOM);
var availableTop;
var availableBottom;
if (isAnchoredToBottom) {
availableTop = viewportDistance.top - MARGIN_TO_EDGE + this.anchorMargin.bottom;
availableBottom = viewportDistance.bottom - MARGIN_TO_EDGE - this.anchorMargin.bottom;
} else {
availableTop = viewportDistance.top - MARGIN_TO_EDGE + this.anchorMargin.top;
availableBottom = viewportDistance.bottom - MARGIN_TO_EDGE + anchorSize.height - this.anchorMargin.top;
}
var isAvailableBottom = availableBottom - surfaceSize.height > 0;
if (!isAvailableBottom && availableTop > availableBottom + this.openBottomBias) {
corner = this.setBit(corner, CornerBit.BOTTOM);
}
var isRtl = this.adapter.isRtl();
var isFlipRtl = this.hasBit(this.anchorCorner, CornerBit.FLIP_RTL);
var hasRightBit = this.hasBit(this.anchorCorner, CornerBit.RIGHT) || this.hasBit(corner, CornerBit.RIGHT);
var isAnchoredToRight = false;
if (isRtl && isFlipRtl) {
isAnchoredToRight = !hasRightBit;
} else {
isAnchoredToRight = hasRightBit;
}
var availableLeft;
var availableRight;
if (isAnchoredToRight) {
availableLeft = viewportDistance.left + anchorSize.width + this.anchorMargin.right;
availableRight = viewportDistance.right - this.anchorMargin.right;
} else {
availableLeft = viewportDistance.left + this.anchorMargin.left;
availableRight = viewportDistance.right + anchorSize.width - this.anchorMargin.left;
}
var isAvailableLeft = availableLeft - surfaceSize.width > 0;
var isAvailableRight = availableRight - surfaceSize.width > 0;
var isOriginCornerAlignedToEnd = this.hasBit(corner, CornerBit.FLIP_RTL) && this.hasBit(corner, CornerBit.RIGHT);
if (isAvailableRight && isOriginCornerAlignedToEnd && isRtl || !isAvailableLeft && isOriginCornerAlignedToEnd) {
corner = this.unsetBit(corner, CornerBit.RIGHT);
} else if (isAvailableLeft && isAnchoredToRight && isRtl || isAvailableLeft && !isAnchoredToRight && hasRightBit || !isAvailableRight && availableLeft >= availableRight) {
corner = this.setBit(corner, CornerBit.RIGHT);
}
return corner;
};
MDCMenuSurfaceFoundation.prototype.getMenuSurfaceMaxHeight = function (corner) {
if (this.maxHeight > 0) {
return this.maxHeight;
}
var viewportDistance = this.measurements.viewportDistance;
var maxHeight = 0;
var isBottomAligned = this.hasBit(corner, CornerBit.BOTTOM);
var isBottomAnchored = this.hasBit(this.anchorCorner, CornerBit.BOTTOM);
var MARGIN_TO_EDGE = MDCMenuSurfaceFoundation.numbers.MARGIN_TO_EDGE;
if (isBottomAligned) {
maxHeight = viewportDistance.top + this.anchorMargin.top - MARGIN_TO_EDGE;
if (!isBottomAnchored) {
maxHeight += this.measurements.anchorSize.height;
}
} else {
maxHeight = viewportDistance.bottom - this.anchorMargin.bottom + this.measurements.anchorSize.height - MARGIN_TO_EDGE;
if (isBottomAnchored) {
maxHeight -= this.measurements.anchorSize.height;
}
}
return maxHeight;
};
MDCMenuSurfaceFoundation.prototype.getHorizontalOriginOffset = function (corner) {
var anchorSize = this.measurements.anchorSize;
var isRightAligned = this.hasBit(corner, CornerBit.RIGHT);
var avoidHorizontalOverlap = this.hasBit(this.anchorCorner, CornerBit.RIGHT);
if (isRightAligned) {
var rightOffset = avoidHorizontalOverlap ? anchorSize.width - this.anchorMargin.left : this.anchorMargin.right;
if (this.isHoistedElement || this.isFixedPosition) {
return rightOffset - (this.measurements.viewportSize.width - this.measurements.bodySize.width);
}
return rightOffset;
}
if (avoidHorizontalOverlap) {
return anchorSize.width - this.anchorMargin.right;
} else {
return this.anchorMargin.left;
}
};
MDCMenuSurfaceFoundation.prototype.getVerticalOriginOffset = function (corner) {
var anchorSize = this.measurements.anchorSize;
var isBottomAligned = this.hasBit(corner, CornerBit.BOTTOM);
var avoidVerticalOverlap = this.hasBit(this.anchorCorner, CornerBit.BOTTOM);
var y = 0;
if (isBottomAligned) {
if (avoidVerticalOverlap) {
y = anchorSize.height - this.anchorMargin.top;
} else {
y = -this.anchorMargin.bottom;
}
} else {
if (avoidVerticalOverlap) {
y = anchorSize.height + this.anchorMargin.bottom;
} else {
y = this.anchorMargin.top;
}
}
return y;
};
MDCMenuSurfaceFoundation.prototype.adjustPositionForHoistedElement = function (position) {
var e_1, _a;
var _b = this.measurements;
var windowScroll = _b.windowScroll;
var viewportDistance = _b.viewportDistance;
var surfaceSize = _b.surfaceSize;
var viewportSize = _b.viewportSize;
var props = Object.keys(position);
try {
for (var props_1 = __values(props), props_1_1 = props_1.next(); !props_1_1.done; props_1_1 = props_1.next()) {
var prop = props_1_1.value;
var value = position[prop] || 0;
if (this.isHorizontallyCenteredOnViewport && (prop === 'left' || prop === 'right')) {
position[prop] = (viewportSize.width - surfaceSize.width) / 2;
continue;
}
value += viewportDistance[prop];
if (!this.isFixedPosition) {
if (prop === 'top') {
value += windowScroll.y;
} else if (prop === 'bottom') {
value -= windowScroll.y;
} else if (prop === 'left') {
value += windowScroll.x;
} else {
value -= windowScroll.x;
}
}
position[prop] = value;
}
} catch (e_1_1) {
e_1 = {
error: e_1_1
};
} finally {
try {
if (props_1_1 && !props_1_1.done && (_a = props_1.return)) {
_a.call(props_1);
}
} finally {
if (e_1) {
throw e_1.error;
}
}
}
};
MDCMenuSurfaceFoundation.prototype.maybeRestoreFocus = function () {
var _this = this;
var isRootFocused = this.adapter.isFocused();
var ownerDocument = this.adapter.getOwnerDocument ? this.adapter.getOwnerDocument() : document;
var childHasFocus = ownerDocument.activeElement && this.adapter.isElementInContainer(ownerDocument.activeElement);
if (isRootFocused || childHasFocus) {
setTimeout(function () {
_this.adapter.restoreFocus();
}, numbers$1.TOUCH_EVENT_WAIT_MS);
}
};
MDCMenuSurfaceFoundation.prototype.hasBit = function (corner, bit) {
return Boolean(corner & bit);
};
MDCMenuSurfaceFoundation.prototype.setBit = function (corner, bit) {
return corner | bit;
};
MDCMenuSurfaceFoundation.prototype.unsetBit = function (corner, bit) {
return corner ^ bit;
};
MDCMenuSurfaceFoundation.prototype.isFinite = function (num) {
return typeof num === 'number' && isFinite(num);
};
return MDCMenuSurfaceFoundation;
}(MDCFoundation);
var MDCMenuSurfaceFoundation$1 = MDCMenuSurfaceFoundation;
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var MDCMenuFoundation = function (_super) {
__extends(MDCMenuFoundation, _super);
function MDCMenuFoundation(adapter) {
var _this = _super.call(this, _assign(_assign({}, MDCMenuFoundation.defaultAdapter), adapter)) || this;
_this.closeAnimationEndTimerId = 0;
_this.defaultFocusState = DefaultFocusState.LIST_ROOT;
_this.selectedIndex = -1;
return _this;
}
Object.defineProperty(MDCMenuFoundation, "cssClasses", {
get() {
return cssClasses$3;
},
enumerable: false,
configurable: true
});
Object.defineProperty(MDCMenuFoundation, "strings", {
get() {
return strings$3;
},
enumerable: false,
configurable: true
});
Object.defineProperty(MDCMenuFoundation, "numbers", {
get() {
return numbers$3;
},
enumerable: false,
configurable: true
});
Object.defineProperty(MDCMenuFoundation, "defaultAdapter", {
get() {
return {
addClassToElementAtIndex() {
return undefined;
},
removeClassFromElementAtIndex() {
return undefined;
},
addAttributeToElementAtIndex() {
return undefined;
},
removeAttributeFromElementAtIndex() {
return undefined;
},
getAttributeFromElementAtIndex() {
return null;
},
elementContainsClass() {
return false;
},
closeSurface() {
return undefined;
},
getElementIndex() {
return -1;
},
notifySelected() {
return undefined;
},
getMenuItemCount() {
return 0;
},
focusItemAtIndex() {
return undefined;
},
focusListRoot() {
return undefined;
},
getSelectedSiblingOfItemAtIndex() {
return -1;
},
isSelectableItemAtIndex() {
return false;
}
};
},
enumerable: false,
configurable: true
});
MDCMenuFoundation.prototype.destroy = function () {
if (this.closeAnimationEndTimerId) {
clearTimeout(this.closeAnimationEndTimerId);
}
this.adapter.closeSurface();
};
MDCMenuFoundation.prototype.handleKeydown = function (evt) {
var key = evt.key;
var keyCode = evt.keyCode;
var isTab = key === 'Tab' || keyCode === 9;
if (isTab) {
this.adapter.closeSurface(true);
}
};
MDCMenuFoundation.prototype.handleItemAction = function (listItem) {
var _this = this;
var index = this.adapter.getElementIndex(listItem);
if (index < 0) {
return;
}
this.adapter.notifySelected({
index: index
});
var skipRestoreFocus = this.adapter.getAttributeFromElementAtIndex(index, strings$3.SKIP_RESTORE_FOCUS) === 'true';
this.adapter.closeSurface(skipRestoreFocus);
this.closeAnimationEndTimerId = setTimeout(function () {
var recomputedIndex = _this.adapter.getElementIndex(listItem);
if (recomputedIndex >= 0 && _this.adapter.isSelectableItemAtIndex(recomputedIndex)) {
_this.setSelectedIndex(recomputedIndex);
}
}, MDCMenuSurfaceFoundation.numbers.TRANSITION_CLOSE_DURATION);
};
MDCMenuFoundation.prototype.handleMenuSurfaceOpened = function () {
switch (this.defaultFocusState) {
case DefaultFocusState.FIRST_ITEM:
this.adapter.focusItemAtIndex(0);
break;
case DefaultFocusState.LAST_ITEM:
this.adapter.focusItemAtIndex(this.adapter.getMenuItemCount() - 1);
break;
case DefaultFocusState.NONE:
break;
default:
this.adapter.focusListRoot();
break;
}
};
MDCMenuFoundation.prototype.setDefaultFocusState = function (focusState) {
this.defaultFocusState = focusState;
};
MDCMenuFoundation.prototype.getSelectedIndex = function () {
return this.selectedIndex;
};
MDCMenuFoundation.prototype.setSelectedIndex = function (index) {
this.validatedIndex(index);
if (!this.adapter.isSelectableItemAtIndex(index)) {
throw new Error('MDCMenuFoundation: No selection group at specified index.');
}
var prevSelectedIndex = this.adapter.getSelectedSiblingOfItemAtIndex(index);
if (prevSelectedIndex >= 0) {
this.adapter.removeAttributeFromElementAtIndex(prevSelectedIndex, strings$3.ARIA_CHECKED_ATTR);
this.adapter.removeClassFromElementAtIndex(prevSelectedIndex, cssClasses$3.MENU_SELECTED_LIST_ITEM);
}
this.adapter.addClassToElementAtIndex(index, cssClasses$3.MENU_SELECTED_LIST_ITEM);
this.adapter.addAttributeToElementAtIndex(index, strings$3.ARIA_CHECKED_ATTR, 'true');
this.selectedIndex = index;
};
MDCMenuFoundation.prototype.setEnabled = function (index, isEnabled) {
this.validatedIndex(index);
if (isEnabled) {
this.adapter.removeClassFromElementAtIndex(index, cssClasses$2.LIST_ITEM_DISABLED_CLASS);
this.adapter.addAttributeToElementAtIndex(index, strings$3.ARIA_DISABLED_ATTR, 'false');
} else {
this.adapter.addClassToElementAtIndex(index, cssClasses$2.LIST_ITEM_DISABLED_CLASS);
this.adapter.addAttributeToElementAtIndex(index, strings$3.ARIA_DISABLED_ATTR, 'true');
}
};
MDCMenuFoundation.prototype.validatedIndex = function (index) {
var menuSize = this.adapter.getMenuItemCount();
var isIndexInRange = index >= 0 && index < menuSize;
if (!isIndexInRange) {
throw new Error('MDCMenuFoundation: No list item at specified index.');
}
};
return MDCMenuFoundation;
}(MDCFoundation);
var MDCMenuFoundation$1 = MDCMenuFoundation;
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var NODE_MODE$3 = false;
var global$f = window;
var supportsAdoptingStyleSheets$3 = global$f.ShadowRoot && (global$f.ShadyCSS === undefined || global$f.ShadyCSS.nativeShadow) && 'adoptedStyleSheets' in Document.prototype && 'replace' in CSSStyleSheet.prototype;
var constructionToken$3 = Symbol();
var cssTagCache$3 = new WeakMap();
class CSSResult$3 {
constructor(cssText, strings, safeToken) {
this['_$cssResult$'] = true;
if (safeToken !== constructionToken$3) {
throw new Error('CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');
}
this.cssText = cssText;
this._strings = strings;
}
get styleSheet() {
var styleSheet = this._styleSheet;
var strings = this._strings;
if (supportsAdoptingStyleSheets$3 && styleSheet === undefined) {
var cacheable = strings !== undefined && strings.length === 1;
if (cacheable) {
styleSheet = cssTagCache$3.get(strings);
}
if (styleSheet === undefined) {
(this._styleSheet = styleSheet = new CSSStyleSheet()).replaceSync(this.cssText);
if (cacheable) {
cssTagCache$3.set(strings, styleSheet);
}
}
}
return styleSheet;
}
toString() {
return this.cssText;
}
}
var unsafeCSS$3 = value => new CSSResult$3(typeof value === 'string' ? value : String(value), undefined, constructionToken$3);
var adoptStyles$3 = (renderRoot, styles) => {
if (supportsAdoptingStyleSheets$3) {
renderRoot.adoptedStyleSheets = styles.map(s => s instanceof CSSStyleSheet ? s : s.styleSheet);
} else {
styles.forEach(s => {
var style = document.createElement('style');
var nonce = global$f['litNonce'];
if (nonce !== undefined) {
style.setAttribute('nonce', nonce);
}
style.textContent = s.cssText;
renderRoot.appendChild(style);
});
}
};
var cssResultFromStyleSheet$3 = sheet => {
var cssText = '';
for (var rule of sheet.cssRules) {
cssText += rule.cssText;
}
return unsafeCSS$3(cssText);
};
var getCompatibleStyle$3 = supportsAdoptingStyleSheets$3 || NODE_MODE$3 ? s => s : s => s instanceof CSSStyleSheet ? cssResultFromStyleSheet$3(s) : s;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var _b$b, _c$b, _d$7;
var _e$3;
var global$e = window;
var requestUpdateThenable$3;
var issueWarning$b;
var trustedTypes$7 = global$e.trustedTypes;
var emptyStringForBooleanAttribute$7 = trustedTypes$7 ? trustedTypes$7.emptyScript : '';
var polyfillSupport$b = global$e.reactiveElementPolyfillSupportDevMode;
{
var _issuedWarnings2 = (_b$b = global$e.litIssuedWarnings) !== null && _b$b !== void 0 ? _b$b : global$e.litIssuedWarnings = new Set();
issueWarning$b = (code, warning) => {
warning += " See https://lit.dev/msg/".concat(code, " for more information.");
if (!_issuedWarnings2.has(warning)) {
console.warn(warning);
_issuedWarnings2.add(warning);
}
};
issueWarning$b('dev-mode', "Lit is in dev mode. Not recommended for production!");
if (((_c$b = global$e.ShadyDOM) === null || _c$b === void 0 ? void 0 : _c$b.inUse) && polyfillSupport$b === undefined) {
issueWarning$b('polyfill-support-missing', "Shadow DOM is being polyfilled via `ShadyDOM` but " + "the `polyfill-support` module has not been loaded.");
}
requestUpdateThenable$3 = name => ({
then: (onfulfilled, _onrejected) => {
issueWarning$b('request-update-promise', "The `requestUpdate` method should no longer return a Promise but " + "does so on `".concat(name, "`. Use `updateComplete` instead."));
if (onfulfilled !== undefined) {
onfulfilled(false);
}
}
});
}
var debugLogEvent$7 = event => {
var shouldEmit = global$e.emitLitDebugLogEvents;
if (!shouldEmit) {
return;
}
global$e.dispatchEvent(new CustomEvent('lit-debug', {
detail: event
}));
};
var JSCompiler_renameProperty$3 = (prop, _obj) => prop;
var defaultConverter$3 = {
toAttribute(value, type) {
switch (type) {
case Boolean:
if (value) {
value = emptyStringForBooleanAttribute$7;
} else {
value = null;
}
break;
case Object:
case Array:
if (value == null) {
value = value;
} else {
value = JSON.stringify(value);
}
break;
}
return value;
},
fromAttribute(value, type) {
var fromValue = value;
switch (type) {
case Boolean:
fromValue = value !== null;
break;
case Number:
if (value === null) {
fromValue = null;
} else {
fromValue = Number(value);
}
break;
case Object:
case Array:
try {
fromValue = JSON.parse(value);
} catch (e) {
fromValue = null;
}
break;
}
return fromValue;
}
};
var notEqual$3 = (value, old) => {
return old !== value && (old === old || value === value);
};
var defaultPropertyDeclaration$3 = {
attribute: true,
type: String,
converter: defaultConverter$3,
reflect: false,
hasChanged: notEqual$3
};
var finalized$3 = 'finalized';
class ReactiveElement$3 extends HTMLElement {
constructor() {
super();
this.__instanceProperties = new Map();
this.isUpdatePending = false;
this.hasUpdated = false;
this.__reflectingProperty = null;
this.__initialize();
}
static addInitializer(initializer) {
var _a;
this.finalize();
((_a = this._initializers) !== null && _a !== void 0 ? _a : this._initializers = []).push(initializer);
}
static get observedAttributes() {
this.finalize();
var attributes = [];
this.elementProperties.forEach((v, p) => {
var attr = this.__attributeNameForProperty(p, v);
if (attr !== undefined) {
this.__attributeToPropertyMap.set(attr, p);
attributes.push(attr);
}
});
return attributes;
}
static createProperty(name) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultPropertyDeclaration$3;
var _a;
if (options.state) {
options.attribute = false;
}
this.finalize();
this.elementProperties.set(name, options);
if (!options.noAccessor && !this.prototype.hasOwnProperty(name)) {
var key = typeof name === 'symbol' ? Symbol() : "__".concat(name);
var descriptor = this.getPropertyDescriptor(name, key, options);
if (descriptor !== undefined) {
Object.defineProperty(this.prototype, name, descriptor);
{
if (!this.hasOwnProperty('__reactivePropertyKeys')) {
this.__reactivePropertyKeys = new Set((_a = this.__reactivePropertyKeys) !== null && _a !== void 0 ? _a : []);
}
this.__reactivePropertyKeys.add(name);
}
}
}
}
static getPropertyDescriptor(name, key, options) {
return {
get() {
return this[key];
},
set(value) {
var oldValue = this[name];
this[key] = value;
this.requestUpdate(name, oldValue, options);
},
configurable: true,
enumerable: true
};
}
static getPropertyOptions(name) {
return this.elementProperties.get(name) || defaultPropertyDeclaration$3;
}
static finalize() {
var _this3 = this;
if (this.hasOwnProperty(finalized$3)) {
return false;
}
this[finalized$3] = true;
var superCtor = Object.getPrototypeOf(this);
superCtor.finalize();
if (superCtor._initializers !== undefined) {
this._initializers = [...superCtor._initializers];
}
this.elementProperties = new Map(superCtor.elementProperties);
this.__attributeToPropertyMap = new Map();
if (this.hasOwnProperty(JSCompiler_renameProperty$3('properties'))) {
var props = this.properties;
var propKeys = [...Object.getOwnPropertyNames(props), ...Object.getOwnPropertySymbols(props)];
for (var p of propKeys) {
this.createProperty(p, props[p]);
}
}
this.elementStyles = this.finalizeStyles(this.styles);
{
var warnRemovedOrRenamed = function warnRemovedOrRenamed(name) {
var renamed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (_this3.prototype.hasOwnProperty(name)) {
issueWarning$b(renamed ? 'renamed-api' : 'removed-api', "`".concat(name, "` is implemented on class ").concat(_this3.name, ". It ") + "has been ".concat(renamed ? 'renamed' : 'removed', " ") + "in this version of LitElement.");
}
};
warnRemovedOrRenamed('initialize');
warnRemovedOrRenamed('requestUpdateInternal');
warnRemovedOrRenamed('_getUpdateComplete', true);
}
return true;
}
static finalizeStyles(styles) {
var elementStyles = [];
if (Array.isArray(styles)) {
var set = new Set(styles.flat(Infinity).reverse());
for (var s of set) {
elementStyles.unshift(getCompatibleStyle$3(s));
}
} else if (styles !== undefined) {
elementStyles.push(getCompatibleStyle$3(styles));
}
return elementStyles;
}
static __attributeNameForProperty(name, options) {
var attribute = options.attribute;
if (attribute === false) {
return undefined;
} else {
if (typeof attribute === 'string') {
return attribute;
} else {
if (typeof name === 'string') {
return name.toLowerCase();
} else {
return undefined;
}
}
}
}
__initialize() {
var _a;
this.__updatePromise = new Promise(res => this.enableUpdating = res);
this._$changedProperties = new Map();
this.__saveInstanceProperties();
this.requestUpdate();
if ((_a = this.constructor._initializers) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(i => i(this));
}
}
addController(controller) {
var _a, _b;
((_a = this.__controllers) !== null && _a !== void 0 ? _a : this.__controllers = []).push(controller);
if (this.renderRoot !== undefined && this.isConnected) {
if ((_b = controller.hostConnected) === null || _b === void 0) {
0;
undefined;
} else {
_b.call(controller);
}
}
}
removeController(controller) {
var _a;
if ((_a = this.__controllers) === null || _a === void 0) {
0;
undefined;
} else {
_a.splice(this.__controllers.indexOf(controller) >>> 0, 1);
}
}
__saveInstanceProperties() {
this.constructor.elementProperties.forEach((_v, p) => {
if (this.hasOwnProperty(p)) {
this.__instanceProperties.set(p, this[p]);
delete this[p];
}
});
}
createRenderRoot() {
var _a;
var renderRoot = (_a = this.shadowRoot) !== null && _a !== void 0 ? _a : this.attachShadow(this.constructor.shadowRootOptions);
adoptStyles$3(renderRoot, this.constructor.elementStyles);
return renderRoot;
}
connectedCallback() {
var _a;
if (this.renderRoot === undefined) {
this.renderRoot = this.createRenderRoot();
}
this.enableUpdating(true);
if ((_a = this.__controllers) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(c => {
var _a;
if ((_a = c.hostConnected) === null || _a === void 0) {
0;
return;
} else {
return _a.call(c);
}
});
}
}
enableUpdating(_requestedUpdate) {}
disconnectedCallback() {
var _a;
if ((_a = this.__controllers) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(c => {
var _a;
if ((_a = c.hostDisconnected) === null || _a === void 0) {
0;
return;
} else {
return _a.call(c);
}
});
}
}
attributeChangedCallback(name, _old, value) {
this._$attributeToProperty(name, value);
}
__propertyToAttribute(name, value) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultPropertyDeclaration$3;
var _a;
var attr = this.constructor.__attributeNameForProperty(name, options);
if (attr !== undefined && options.reflect === true) {
var converter = ((_a = options.converter) === null || _a === void 0 ? void 0 : _a.toAttribute) !== undefined ? options.converter : defaultConverter$3;
var attrValue = converter.toAttribute(value, options.type);
if (this.constructor.enabledWarnings.indexOf('migration') >= 0 && attrValue === undefined) {
issueWarning$b('undefined-attribute-value', "The attribute value for the ".concat(name, " property is ") + "undefined on element ".concat(this.localName, ". The attribute will be ") + "removed, but in the previous version of `ReactiveElement`, " + "the attribute would not have changed.");
}
this.__reflectingProperty = name;
if (attrValue == null) {
this.removeAttribute(attr);
} else {
this.setAttribute(attr, attrValue);
}
this.__reflectingProperty = null;
}
}
_$attributeToProperty(name, value) {
var _a;
var ctor = this.constructor;
var propName = ctor.__attributeToPropertyMap.get(name);
if (propName !== undefined && this.__reflectingProperty !== propName) {
var options = ctor.getPropertyOptions(propName);
var converter = typeof options.converter === 'function' ? {
fromAttribute: options.converter
} : ((_a = options.converter) === null || _a === void 0 ? void 0 : _a.fromAttribute) !== undefined ? options.converter : defaultConverter$3;
this.__reflectingProperty = propName;
this[propName] = converter.fromAttribute(value, options.type);
this.__reflectingProperty = null;
}
}
requestUpdate(name, oldValue, options) {
var shouldRequestUpdate = true;
if (name !== undefined) {
options = options || this.constructor.getPropertyOptions(name);
var hasChanged = options.hasChanged || notEqual$3;
if (hasChanged(this[name], oldValue)) {
if (!this._$changedProperties.has(name)) {
this._$changedProperties.set(name, oldValue);
}
if (options.reflect === true && this.__reflectingProperty !== name) {
if (this.__reflectingProperties === undefined) {
this.__reflectingProperties = new Map();
}
this.__reflectingProperties.set(name, options);
}
} else {
shouldRequestUpdate = false;
}
}
if (!this.isUpdatePending && shouldRequestUpdate) {
this.__updatePromise = this.__enqueueUpdate();
}
return requestUpdateThenable$3(this.localName);
}
__enqueueUpdate() {
var _this4 = this;
return _asyncToGenerator(function* () {
_this4.isUpdatePending = true;
try {
yield _this4.__updatePromise;
} catch (e) {
Promise.reject(e);
}
var result = _this4.scheduleUpdate();
if (result != null) {
yield result;
}
return !_this4.isUpdatePending;
})();
}
scheduleUpdate() {
return this.performUpdate();
}
performUpdate() {
var _a, _b;
if (!this.isUpdatePending) {
return;
}
if (debugLogEvent$7 === null || debugLogEvent$7 === void 0) {
0;
undefined;
} else {
debugLogEvent$7({
kind: 'update'
});
}
if (!this.hasUpdated) {
{
var shadowedProperties = [];
if ((_a = this.constructor.__reactivePropertyKeys) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(p => {
var _a;
if (this.hasOwnProperty(p) && !((_a = this.__instanceProperties) === null || _a === void 0 ? void 0 : _a.has(p))) {
shadowedProperties.push(p);
}
});
}
if (shadowedProperties.length) {
throw new Error("The following properties on element ".concat(this.localName, " will not ") + "trigger updates as expected because they are set using class " + "fields: ".concat(shadowedProperties.join(', '), ". ") + "Native class fields and some compiled output will overwrite " + "accessors used for detecting changes. See " + "https://lit.dev/msg/class-field-shadowing " + "for more information.");
}
}
}
if (this.__instanceProperties) {
this.__instanceProperties.forEach((v, p) => this[p] = v);
this.__instanceProperties = undefined;
}
var shouldUpdate = false;
var changedProperties = this._$changedProperties;
try {
shouldUpdate = this.shouldUpdate(changedProperties);
if (shouldUpdate) {
this.willUpdate(changedProperties);
if ((_b = this.__controllers) === null || _b === void 0) {
0;
undefined;
} else {
_b.forEach(c => {
var _a;
if ((_a = c.hostUpdate) === null || _a === void 0) {
0;
return;
} else {
return _a.call(c);
}
});
}
this.update(changedProperties);
} else {
this.__markUpdated();
}
} catch (e) {
shouldUpdate = false;
this.__markUpdated();
throw e;
}
if (shouldUpdate) {
this._$didUpdate(changedProperties);
}
}
willUpdate(_changedProperties) {}
_$didUpdate(changedProperties) {
var _a;
if ((_a = this.__controllers) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(c => {
var _a;
if ((_a = c.hostUpdated) === null || _a === void 0) {
0;
return;
} else {
return _a.call(c);
}
});
}
if (!this.hasUpdated) {
this.hasUpdated = true;
this.firstUpdated(changedProperties);
}
this.updated(changedProperties);
if (this.isUpdatePending && this.constructor.enabledWarnings.indexOf('change-in-update') >= 0) {
issueWarning$b('change-in-update', "Element ".concat(this.localName, " scheduled an update ") + "(generally because a property was set) " + "after an update completed, causing a new update to be scheduled. " + "This is inefficient and should be avoided unless the next update " + "can only be scheduled as a side effect of the previous update.");
}
}
__markUpdated() {
this._$changedProperties = new Map();
this.isUpdatePending = false;
}
get updateComplete() {
return this.getUpdateComplete();
}
getUpdateComplete() {
return this.__updatePromise;
}
shouldUpdate(_changedProperties) {
return true;
}
update(_changedProperties) {
if (this.__reflectingProperties !== undefined) {
this.__reflectingProperties.forEach((v, k) => this.__propertyToAttribute(k, this[k], v));
this.__reflectingProperties = undefined;
}
this.__markUpdated();
}
updated(_changedProperties) {}
firstUpdated(_changedProperties) {}
}
_e$3 = finalized$3;
ReactiveElement$3[_e$3] = true;
ReactiveElement$3.elementProperties = new Map();
ReactiveElement$3.elementStyles = [];
ReactiveElement$3.shadowRootOptions = {
mode: 'open'
};
if (polyfillSupport$b === null || polyfillSupport$b === void 0) {
0;
undefined;
} else {
polyfillSupport$b({
ReactiveElement: ReactiveElement$3
});
}
{
ReactiveElement$3.enabledWarnings = ['change-in-update'];
var _ensureOwnWarnings = function _ensureOwnWarnings(ctor) {
if (!ctor.hasOwnProperty(JSCompiler_renameProperty$3('enabledWarnings'))) {
ctor.enabledWarnings = ctor.enabledWarnings.slice();
}
};
ReactiveElement$3.enableWarning = function (warning) {
_ensureOwnWarnings(this);
if (this.enabledWarnings.indexOf(warning) < 0) {
this.enabledWarnings.push(warning);
}
};
ReactiveElement$3.disableWarning = function (warning) {
_ensureOwnWarnings(this);
var i = this.enabledWarnings.indexOf(warning);
if (i >= 0) {
this.enabledWarnings.splice(i, 1);
}
};
}
((_d$7 = global$e.reactiveElementVersions) !== null && _d$7 !== void 0 ? _d$7 : global$e.reactiveElementVersions = []).push('1.6.3');
if (global$e.reactiveElementVersions.length > 1) {
issueWarning$b('multiple-versions', "Multiple versions of Lit loaded. Loading multiple versions " + "is not recommended.");
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var _a$a, _b$a, _c$a, _d$6;
var global$d = window;
var debugLogEvent$6 = event => {
var shouldEmit = global$d.emitLitDebugLogEvents;
if (!shouldEmit) {
return;
}
global$d.dispatchEvent(new CustomEvent('lit-debug', {
detail: event
}));
};
var debugLogRenderId$3 = 0;
var issueWarning$a;
{
if ((_a$a = global$d.litIssuedWarnings) !== null && _a$a !== void 0) {
_a$a;
} else {
global$d.litIssuedWarnings = new Set();
}
issueWarning$a = (code, warning) => {
if (code) {
warning += " See https://lit.dev/msg/".concat(code, " for more information.");
} else {
warning += '';
}
if (!global$d.litIssuedWarnings.has(warning)) {
console.warn(warning);
global$d.litIssuedWarnings.add(warning);
}
};
issueWarning$a('dev-mode', "Lit is in dev mode. Not recommended for production!");
}
var wrap$3 = ((_b$a = global$d.ShadyDOM) === null || _b$a === void 0 ? void 0 : _b$a.inUse) && ((_c$a = global$d.ShadyDOM) === null || _c$a === void 0 ? void 0 : _c$a.noPatch) === true ? global$d.ShadyDOM.wrap : node => node;
var trustedTypes$6 = global$d.trustedTypes;
var policy$3 = trustedTypes$6 ? trustedTypes$6.createPolicy('lit-html', {
createHTML: s => s
}) : undefined;
var identityFunction$3 = value => value;
var noopSanitizer$3 = (_node, _name, _type) => identityFunction$3;
var setSanitizer$3 = newSanitizer => {
if (sanitizerFactoryInternal$3 !== noopSanitizer$3) {
throw new Error("Attempted to overwrite existing lit-html security policy." + " setSanitizeDOMValueFactory should be called at most once.");
}
sanitizerFactoryInternal$3 = newSanitizer;
};
var _testOnlyClearSanitizerFactoryDoNotCallOrElse$3 = () => {
sanitizerFactoryInternal$3 = noopSanitizer$3;
};
var createSanitizer$3 = (node, name, type) => {
return sanitizerFactoryInternal$3(node, name, type);
};
var boundAttributeSuffix$3 = '$lit$';
var marker$3 = "lit$".concat(String(Math.random()).slice(9), "$");
var markerMatch$3 = '?' + marker$3;
var nodeMarker$3 = "<".concat(markerMatch$3, ">");
var d$3 = document;
var createMarker$3 = () => d$3.createComment('');
var isPrimitive$3 = value => value === null || typeof value != 'object' && typeof value != 'function';
var isArray$3 = Array.isArray;
var isIterable$3 = value => isArray$3(value) || typeof (value === null || value === void 0 ? void 0 : value[Symbol.iterator]) === 'function';
var SPACE_CHAR$3 = "[ \t\n\f\r]";
var ATTR_VALUE_CHAR$3 = "[^ \t\n\f\r\"'`<>=]";
var NAME_CHAR$3 = "[^\\s\"'>=/]";
var textEndRegex$3 = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g;
var COMMENT_START$3 = 1;
var TAG_NAME$3 = 2;
var DYNAMIC_TAG_NAME$3 = 3;
var commentEndRegex$3 = /-->/g;
var comment2EndRegex$3 = />/g;
var tagEndRegex$3 = new RegExp(">|".concat(SPACE_CHAR$3, "(?:(").concat(NAME_CHAR$3, "+)(").concat(SPACE_CHAR$3, "*=").concat(SPACE_CHAR$3, "*(?:").concat(ATTR_VALUE_CHAR$3, "|(\"|')|))|$)"), 'g');
var ENTIRE_MATCH$3 = 0;
var ATTRIBUTE_NAME$3 = 1;
var SPACES_AND_EQUALS$3 = 2;
var QUOTE_CHAR$3 = 3;
var singleQuoteAttrEndRegex$3 = /'/g;
var doubleQuoteAttrEndRegex$3 = /"/g;
var rawTextElement$3 = /^(?:script|style|textarea|title)$/i;
var SVG_RESULT$3 = 2;
var ATTRIBUTE_PART$3 = 1;
var CHILD_PART$3 = 2;
var PROPERTY_PART$3 = 3;
var BOOLEAN_ATTRIBUTE_PART$3 = 4;
var EVENT_PART$3 = 5;
var ELEMENT_PART$3 = 6;
var COMMENT_PART$3 = 7;
var noChange$3 = Symbol.for('lit-noChange');
var nothing$3 = Symbol.for('lit-nothing');
var templateCache$3 = new WeakMap();
var walker$3 = d$3.createTreeWalker(d$3, 129, null, false);
var sanitizerFactoryInternal$3 = noopSanitizer$3;
function trustFromTemplateString$3(tsa, stringFromTSA) {
if (!Array.isArray(tsa) || !tsa.hasOwnProperty('raw')) {
var message = 'invalid template strings array';
{
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 ".trim().replace(/\n */g, '\n');
}
throw new Error(message);
}
if (policy$3 !== undefined) {
return policy$3.createHTML(stringFromTSA);
} else {
return stringFromTSA;
}
}
var getTemplateHtml$3 = (strings, type) => {
var l = strings.length - 1;
var attrNames = [];
var html = type === SVG_RESULT$3 ? '<svg>' : '';
var rawTextEndRegex;
var regex = textEndRegex$3;
for (var i = 0; i < l; i++) {
var s = strings[i];
var attrNameEndIndex = -1;
var attrName = void 0;
var lastIndex = 0;
var match = void 0;
while (lastIndex < s.length) {
regex.lastIndex = lastIndex;
match = regex.exec(s);
if (match === null) {
break;
}
lastIndex = regex.lastIndex;
if (regex === textEndRegex$3) {
if (match[COMMENT_START$3] === '!--') {
regex = commentEndRegex$3;
} else if (match[COMMENT_START$3] !== undefined) {
regex = comment2EndRegex$3;
} else if (match[TAG_NAME$3] !== undefined) {
if (rawTextElement$3.test(match[TAG_NAME$3])) {
rawTextEndRegex = new RegExp("</".concat(match[TAG_NAME$3]), 'g');
}
regex = tagEndRegex$3;
} else if (match[DYNAMIC_TAG_NAME$3] !== undefined) {
{
throw new Error('Bindings in tag names are not supported. Please use static templates instead. ' + 'See https://lit.dev/docs/templates/expressions/#static-expressions');
}
}
} else if (regex === tagEndRegex$3) {
if (match[ENTIRE_MATCH$3] === '>') {
if (rawTextEndRegex !== null && rawTextEndRegex !== void 0) {
regex = rawTextEndRegex;
} else {
regex = textEndRegex$3;
}
attrNameEndIndex = -1;
} else if (match[ATTRIBUTE_NAME$3] === undefined) {
attrNameEndIndex = -2;
} else {
attrNameEndIndex = regex.lastIndex - match[SPACES_AND_EQUALS$3].length;
attrName = match[ATTRIBUTE_NAME$3];
if (match[QUOTE_CHAR$3] === undefined) {
regex = tagEndRegex$3;
} else if (match[QUOTE_CHAR$3] === '"') {
regex = doubleQuoteAttrEndRegex$3;
} else {
regex = singleQuoteAttrEndRegex$3;
}
}
} else if (regex === doubleQuoteAttrEndRegex$3 || regex === singleQuoteAttrEndRegex$3) {
regex = tagEndRegex$3;
} else if (regex === commentEndRegex$3 || regex === comment2EndRegex$3) {
regex = textEndRegex$3;
} else {
regex = tagEndRegex$3;
rawTextEndRegex = undefined;
}
}
{
console.assert(attrNameEndIndex === -1 || regex === tagEndRegex$3 || regex === singleQuoteAttrEndRegex$3 || regex === doubleQuoteAttrEndRegex$3, 'unexpected parse state B');
}
var end = regex === tagEndRegex$3 && strings[i + 1].startsWith('/>') ? ' ' : '';
if (regex === textEndRegex$3) {
html += s + nodeMarker$3;
} else if (attrNameEndIndex >= 0) {
html += (attrNames.push(attrName), s.slice(0, attrNameEndIndex) + boundAttributeSuffix$3 + s.slice(attrNameEndIndex)) + marker$3 + end;
} else {
html += s + marker$3 + (attrNameEndIndex === -2 ? (attrNames.push(undefined), i) : end);
}
}
var htmlResult = html + (strings[l] || '<?>') + (type === SVG_RESULT$3 ? '</svg>' : '');
return [trustFromTemplateString$3(strings, htmlResult), attrNames];
};
class Template$3 {
constructor(_ref9, options) {
var {
strings,
['_$litType$']: type
} = _ref9;
this.parts = [];
var node;
var nodeIndex = 0;
var attrNameIndex = 0;
var partCount = strings.length - 1;
var parts = this.parts;
var [html, attrNames] = getTemplateHtml$3(strings, type);
this.el = Template$3.createElement(html, options);
walker$3.currentNode = this.el.content;
if (type === SVG_RESULT$3) {
var content = this.el.content;
var svgElement = content.firstChild;
svgElement.remove();
content.append(...svgElement.childNodes);
}
while ((node = walker$3.nextNode()) !== null && parts.length < partCount) {
if (node.nodeType === 1) {
{
var _tag2 = node.localName;
if (/^(?:textarea|template)$/i.test(_tag2) && node.innerHTML.includes(marker$3)) {
var m = "Expressions are not supported inside `".concat(_tag2, "` ") + "elements. See https://lit.dev/msg/expression-in-".concat(_tag2, " for more ") + "information.";
if (_tag2 === 'template') {
throw new Error(m);
} else {
issueWarning$a('', m);
}
}
}
if (node.hasAttributes()) {
var attrsToRemove = [];
for (var name of node.getAttributeNames()) {
if (name.endsWith(boundAttributeSuffix$3) || name.startsWith(marker$3)) {
var realName = attrNames[attrNameIndex++];
attrsToRemove.push(name);
if (realName !== undefined) {
var value = node.getAttribute(realName.toLowerCase() + boundAttributeSuffix$3);
var statics = value.split(marker$3);
var _m2 = /([.?@])?(.*)/.exec(realName);
parts.push({
type: ATTRIBUTE_PART$3,
index: nodeIndex,
name: _m2[2],
strings: statics,
ctor: _m2[1] === '.' ? PropertyPart$3 : _m2[1] === '?' ? BooleanAttributePart$3 : _m2[1] === '@' ? EventPart$3 : AttributePart$3
});
} else {
parts.push({
type: ELEMENT_PART$3,
index: nodeIndex
});
}
}
}
for (var _name5 of attrsToRemove) {
node.removeAttribute(_name5);
}
}
if (rawTextElement$3.test(node.tagName)) {
var _strings2 = node.textContent.split(marker$3);
var lastIndex = _strings2.length - 1;
if (lastIndex > 0) {
if (trustedTypes$6) {
node.textContent = trustedTypes$6.emptyScript;
} else {
node.textContent = '';
}
for (var i = 0; i < lastIndex; i++) {
node.append(_strings2[i], createMarker$3());
walker$3.nextNode();
parts.push({
type: CHILD_PART$3,
index: ++nodeIndex
});
}
node.append(_strings2[lastIndex], createMarker$3());
}
}
} else if (node.nodeType === 8) {
var data = node.data;
if (data === markerMatch$3) {
parts.push({
type: CHILD_PART$3,
index: nodeIndex
});
} else {
var _i3 = -1;
while ((_i3 = node.data.indexOf(marker$3, _i3 + 1)) !== -1) {
parts.push({
type: COMMENT_PART$3,
index: nodeIndex
});
_i3 += marker$3.length - 1;
}
}
}
nodeIndex++;
}
if (debugLogEvent$6 === null || debugLogEvent$6 === void 0) {
0;
undefined;
} else {
debugLogEvent$6({
kind: 'template prep',
template: this,
clonableTemplate: this.el,
parts: this.parts,
strings
});
}
}
static createElement(html, _options) {
var el = d$3.createElement('template');
el.innerHTML = html;
return el;
}
}
function resolveDirective$3(part, value) {
var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : part;
var attributeIndex = arguments.length > 3 ? arguments[3] : undefined;
var _a, _b, _c;
var _d;
if (value === noChange$3) {
return value;
}
var currentDirective = attributeIndex !== undefined ? (_a = parent.__directives) === null || _a === void 0 ? void 0 : _a[attributeIndex] : parent.__directive;
var nextDirectiveConstructor = isPrimitive$3(value) ? undefined : value['_$litDirective$'];
if ((currentDirective === null || currentDirective === void 0 ? void 0 : currentDirective.constructor) !== nextDirectiveConstructor) {
if ((_b = currentDirective === null || currentDirective === void 0 ? void 0 : currentDirective['_$notifyDirectiveConnectionChanged']) === null || _b === void 0) {
0;
undefined;
} else {
_b.call(currentDirective, false);
}
if (nextDirectiveConstructor === undefined) {
currentDirective = undefined;
} else {
currentDirective = new nextDirectiveConstructor(part);
currentDirective._$initialize(part, parent, attributeIndex);
}
if (attributeIndex !== undefined) {
((_c = (_d = parent).__directives) !== null && _c !== void 0 ? _c : _d.__directives = [])[attributeIndex] = currentDirective;
} else {
parent.__directive = currentDirective;
}
}
if (currentDirective !== undefined) {
value = resolveDirective$3(part, currentDirective._$resolve(part, value.values), currentDirective, attributeIndex);
}
return value;
}
class TemplateInstance$3 {
constructor(template, parent) {
this._$parts = [];
this._$disconnectableChildren = undefined;
this._$template = template;
this._$parent = parent;
}
get parentNode() {
return this._$parent.parentNode;
}
get _$isConnected() {
return this._$parent._$isConnected;
}
_clone(options) {
var _a;
var {
el: {
content
},
parts: parts
} = this._$template;
var fragment = ((_a = options === null || options === void 0 ? void 0 : options.creationScope) !== null && _a !== void 0 ? _a : d$3).importNode(content, true);
walker$3.currentNode = fragment;
var node = walker$3.nextNode();
var nodeIndex = 0;
var partIndex = 0;
var templatePart = parts[0];
while (templatePart !== undefined) {
if (nodeIndex === templatePart.index) {
var part = void 0;
if (templatePart.type === CHILD_PART$3) {
part = new ChildPart$3(node, node.nextSibling, this, options);
} else if (templatePart.type === ATTRIBUTE_PART$3) {
part = new templatePart.ctor(node, templatePart.name, templatePart.strings, this, options);
} else if (templatePart.type === ELEMENT_PART$3) {
part = new ElementPart$3(node, this, options);
}
this._$parts.push(part);
templatePart = parts[++partIndex];
}
if (nodeIndex !== (templatePart === null || templatePart === void 0 ? void 0 : templatePart.index)) {
node = walker$3.nextNode();
nodeIndex++;
}
}
walker$3.currentNode = d$3;
return fragment;
}
_update(values) {
var i = 0;
for (var part of this._$parts) {
if (part !== undefined) {
if (debugLogEvent$6 === null || debugLogEvent$6 === void 0) {
0;
undefined;
} else {
debugLogEvent$6({
kind: 'set part',
part,
value: values[i],
valueIndex: i,
values,
templateInstance: this
});
}
if (part.strings !== undefined) {
part._$setValue(values, part, i);
i += part.strings.length - 2;
} else {
part._$setValue(values[i]);
}
}
i++;
}
}
}
class ChildPart$3 {
constructor(startNode, endNode, parent, options) {
var _a;
this.type = CHILD_PART$3;
this._$committedValue = nothing$3;
this._$disconnectableChildren = undefined;
this._$startNode = startNode;
this._$endNode = endNode;
this._$parent = parent;
this.options = options;
if ((_a = options === null || options === void 0 ? void 0 : options.isConnected) !== null && _a !== void 0) {
this.__isConnected = _a;
} else {
this.__isConnected = true;
}
{
this._textSanitizer = undefined;
}
}
get _$isConnected() {
var _a, _b;
if ((_b = (_a = this._$parent) === null || _a === void 0 ? void 0 : _a._$isConnected) !== null && _b !== void 0) {
return _b;
} else {
return this.__isConnected;
}
}
get parentNode() {
var parentNode = wrap$3(this._$startNode).parentNode;
var parent = this._$parent;
if (parent !== undefined && (parentNode === null || parentNode === void 0 ? void 0 : parentNode.nodeType) === 11) {
parentNode = parent.parentNode;
}
return parentNode;
}
get startNode() {
return this._$startNode;
}
get endNode() {
return this._$endNode;
}
_$setValue(value) {
var directiveParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
var _a;
if (this.parentNode === null) {
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.");
}
value = resolveDirective$3(this, value, directiveParent);
if (isPrimitive$3(value)) {
if (value === nothing$3 || value == null || value === '') {
if (this._$committedValue !== nothing$3) {
if (debugLogEvent$6 === null || debugLogEvent$6 === void 0) {
0;
undefined;
} else {
debugLogEvent$6({
kind: 'commit nothing to child',
start: this._$startNode,
end: this._$endNode,
parent: this._$parent,
options: this.options
});
}
this._$clear();
}
this._$committedValue = nothing$3;
} else if (value !== this._$committedValue && value !== noChange$3) {
this._commitText(value);
}
} else if (value['_$litType$'] !== undefined) {
this._commitTemplateResult(value);
} else if (value.nodeType !== undefined) {
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.host) === value) {
this._commitText("[probable mistake: rendered a template's host in itself " + "(commonly caused by writing ${this} in a template]");
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.");
return;
}
this._commitNode(value);
} else if (isIterable$3(value)) {
this._commitIterable(value);
} else {
this._commitText(value);
}
}
_insert(node) {
return wrap$3(wrap$3(this._$startNode).parentNode).insertBefore(node, this._$endNode);
}
_commitNode(value) {
var _a;
if (this._$committedValue !== value) {
this._$clear();
if (sanitizerFactoryInternal$3 !== noopSanitizer$3) {
var parentNodeName = (_a = this._$startNode.parentNode) === null || _a === void 0 ? void 0 : _a.nodeName;
if (parentNodeName === 'STYLE' || parentNodeName === 'SCRIPT') {
var message = 'Forbidden';
{
if (parentNodeName === 'STYLE') {
message = "Lit does not support binding inside style nodes. " + "This is a security risk, as style injection attacks can " + "exfiltrate data and spoof UIs. " + "Consider instead using css`...` literals " + "to compose styles, and make do dynamic styling with " + "css custom properties, ::parts, <slot>s, " + "and by mutating the DOM rather than stylesheets.";
} else {
message = "Lit does not support binding inside script nodes. " + "This is a security risk, as it could allow arbitrary " + "code execution.";
}
}
throw new Error(message);
}
}
if (debugLogEvent$6 === null || debugLogEvent$6 === void 0) {
0;
undefined;
} else {
debugLogEvent$6({
kind: 'commit node',
start: this._$startNode,
parent: this._$parent,
value: value,
options: this.options
});
}
this._$committedValue = this._insert(value);
}
}
_commitText(value) {
if (this._$committedValue !== nothing$3 && isPrimitive$3(this._$committedValue)) {
var node = wrap$3(this._$startNode).nextSibling;
{
if (this._textSanitizer === undefined) {
this._textSanitizer = createSanitizer$3(node, 'data', 'property');
}
value = this._textSanitizer(value);
}
if (debugLogEvent$6 === null || debugLogEvent$6 === void 0) {
0;
undefined;
} else {
debugLogEvent$6({
kind: 'commit text',
node,
value,
options: this.options
});
}
node.data = value;
} else {
{
var textNode = d$3.createTextNode('');
this._commitNode(textNode);
if (this._textSanitizer === undefined) {
this._textSanitizer = createSanitizer$3(textNode, 'data', 'property');
}
value = this._textSanitizer(value);
if (debugLogEvent$6 === null || debugLogEvent$6 === void 0) {
0;
undefined;
} else {
debugLogEvent$6({
kind: 'commit text',
node: textNode,
value,
options: this.options
});
}
textNode.data = value;
}
}
this._$committedValue = value;
}
_commitTemplateResult(result) {
var _a;
var {
values,
['_$litType$']: type
} = result;
var template = typeof type === 'number' ? this._$getTemplate(result) : (type.el === undefined && (type.el = Template$3.createElement(trustFromTemplateString$3(type.h, type.h[0]), this.options)), type);
if (((_a = this._$committedValue) === null || _a === void 0 ? void 0 : _a._$template) === template) {
if (debugLogEvent$6 === null || debugLogEvent$6 === void 0) {
0;
undefined;
} else {
debugLogEvent$6({
kind: 'template updating',
template,
instance: this._$committedValue,
parts: this._$committedValue._$parts,
options: this.options,
values
});
}
this._$committedValue._update(values);
} else {
var instance = new TemplateInstance$3(template, this);
var fragment = instance._clone(this.options);
if (debugLogEvent$6 === null || debugLogEvent$6 === void 0) {
0;
undefined;
} else {
debugLogEvent$6({
kind: 'template instantiated',
template,
instance,
parts: instance._$parts,
options: this.options,
fragment,
values
});
}
instance._update(values);
if (debugLogEvent$6 === null || debugLogEvent$6 === void 0) {
0;
undefined;
} else {
debugLogEvent$6({
kind: 'template instantiated and updated',
template,
instance,
parts: instance._$parts,
options: this.options,
fragment,
values
});
}
this._commitNode(fragment);
this._$committedValue = instance;
}
}
_$getTemplate(result) {
var template = templateCache$3.get(result.strings);
if (template === undefined) {
templateCache$3.set(result.strings, template = new Template$3(result));
}
return template;
}
_commitIterable(value) {
if (!isArray$3(this._$committedValue)) {
this._$committedValue = [];
this._$clear();
}
var itemParts = this._$committedValue;
var partIndex = 0;
var itemPart;
for (var item of value) {
if (partIndex === itemParts.length) {
itemParts.push(itemPart = new ChildPart$3(this._insert(createMarker$3()), this._insert(createMarker$3()), this, this.options));
} else {
itemPart = itemParts[partIndex];
}
itemPart._$setValue(item);
partIndex++;
}
if (partIndex < itemParts.length) {
this._$clear(itemPart && wrap$3(itemPart._$endNode).nextSibling, partIndex);
itemParts.length = partIndex;
}
}
_$clear() {
var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : wrap$3(this._$startNode).nextSibling;
var from = arguments.length > 1 ? arguments[1] : undefined;
var _a;
if ((_a = this._$notifyConnectionChanged) === null || _a === void 0) {
0;
undefined;
} else {
_a.call(this, false, true, from);
}
while (start && start !== this._$endNode) {
var n = wrap$3(start).nextSibling;
wrap$3(start).remove();
start = n;
}
}
setConnected(isConnected) {
var _a;
if (this._$parent === undefined) {
this.__isConnected = isConnected;
if ((_a = this._$notifyConnectionChanged) === null || _a === void 0) {
0;
undefined;
} else {
_a.call(this, isConnected);
}
} else {
throw new Error('part.setConnected() may only be called on a ' + 'RootPart returned from render().');
}
}
}
class AttributePart$3 {
constructor(element, name, strings, parent, options) {
this.type = ATTRIBUTE_PART$3;
this._$committedValue = nothing$3;
this._$disconnectableChildren = undefined;
this.element = element;
this.name = name;
this._$parent = parent;
this.options = options;
if (strings.length > 2 || strings[0] !== '' || strings[1] !== '') {
this._$committedValue = new Array(strings.length - 1).fill(new String());
this.strings = strings;
} else {
this._$committedValue = nothing$3;
}
{
this._sanitizer = undefined;
}
}
get tagName() {
return this.element.tagName;
}
get _$isConnected() {
return this._$parent._$isConnected;
}
_$setValue(value) {
var directiveParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
var valueIndex = arguments.length > 2 ? arguments[2] : undefined;
var noCommit = arguments.length > 3 ? arguments[3] : undefined;
var strings = this.strings;
var change = false;
if (strings === undefined) {
value = resolveDirective$3(this, value, directiveParent, 0);
change = !isPrimitive$3(value) || value !== this._$committedValue && value !== noChange$3;
if (change) {
this._$committedValue = value;
}
} else {
var values = value;
value = strings[0];
var i, v;
for (i = 0; i < strings.length - 1; i++) {
v = resolveDirective$3(this, values[valueIndex + i], directiveParent, i);
if (v === noChange$3) {
v = this._$committedValue[i];
}
if (!change) {
change = !isPrimitive$3(v) || v !== this._$committedValue[i];
}
if (v === nothing$3) {
value = nothing$3;
} else if (value !== nothing$3) {
value += (v !== null && v !== void 0 ? v : '') + strings[i + 1];
}
this._$committedValue[i] = v;
}
}
if (change && !noCommit) {
this._commitValue(value);
}
}
_commitValue(value) {
if (value === nothing$3) {
wrap$3(this.element).removeAttribute(this.name);
} else {
{
if (this._sanitizer === undefined) {
this._sanitizer = sanitizerFactoryInternal$3(this.element, this.name, 'attribute');
}
value = this._sanitizer(value !== null && value !== void 0 ? value : '');
}
if (debugLogEvent$6 === null || debugLogEvent$6 === void 0) {
0;
undefined;
} else {
debugLogEvent$6({
kind: 'commit attribute',
element: this.element,
name: this.name,
value,
options: this.options
});
}
wrap$3(this.element).setAttribute(this.name, value !== null && value !== void 0 ? value : '');
}
}
}
class PropertyPart$3 extends AttributePart$3 {
constructor() {
super(...arguments);
this.type = PROPERTY_PART$3;
}
_commitValue(value) {
{
if (this._sanitizer === undefined) {
this._sanitizer = sanitizerFactoryInternal$3(this.element, this.name, 'property');
}
value = this._sanitizer(value);
}
if (debugLogEvent$6 === null || debugLogEvent$6 === void 0) {
0;
undefined;
} else {
debugLogEvent$6({
kind: 'commit property',
element: this.element,
name: this.name,
value,
options: this.options
});
}
if (value === nothing$3) {
this.element[this.name] = undefined;
} else {
this.element[this.name] = value;
}
}
}
var emptyStringForBooleanAttribute$6 = trustedTypes$6 ? trustedTypes$6.emptyScript : '';
class BooleanAttributePart$3 extends AttributePart$3 {
constructor() {
super(...arguments);
this.type = BOOLEAN_ATTRIBUTE_PART$3;
}
_commitValue(value) {
if (debugLogEvent$6 === null || debugLogEvent$6 === void 0) {
0;
undefined;
} else {
debugLogEvent$6({
kind: 'commit boolean attribute',
element: this.element,
name: this.name,
value: !!(value && value !== nothing$3),
options: this.options
});
}
if (value && value !== nothing$3) {
wrap$3(this.element).setAttribute(this.name, emptyStringForBooleanAttribute$6);
} else {
wrap$3(this.element).removeAttribute(this.name);
}
}
}
class EventPart$3 extends AttributePart$3 {
constructor(element, name, strings, parent, options) {
super(element, name, strings, parent, options);
this.type = EVENT_PART$3;
if (this.strings !== undefined) {
throw new Error("A `<".concat(element.localName, ">` has a `@").concat(name, "=...` listener with ") + 'invalid content. Event listeners in templates must have exactly ' + 'one expression and no surrounding text.');
}
}
_$setValue(newListener) {
var directiveParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
var _a;
if ((_a = resolveDirective$3(this, newListener, directiveParent, 0)) !== null && _a !== void 0) {
newListener = _a;
} else {
newListener = nothing$3;
}
if (newListener === noChange$3) {
return;
}
var oldListener = this._$committedValue;
var shouldRemoveListener = newListener === nothing$3 && oldListener !== nothing$3 || newListener.capture !== oldListener.capture || newListener.once !== oldListener.once || newListener.passive !== oldListener.passive;
var shouldAddListener = newListener !== nothing$3 && (oldListener === nothing$3 || shouldRemoveListener);
if (debugLogEvent$6 === null || debugLogEvent$6 === void 0) {
0;
undefined;
} else {
debugLogEvent$6({
kind: 'commit event listener',
element: this.element,
name: this.name,
value: newListener,
options: this.options,
removeListener: shouldRemoveListener,
addListener: shouldAddListener,
oldListener
});
}
if (shouldRemoveListener) {
this.element.removeEventListener(this.name, this, oldListener);
}
if (shouldAddListener) {
this.element.addEventListener(this.name, this, newListener);
}
this._$committedValue = newListener;
}
handleEvent(event) {
var _a, _b;
if (typeof this._$committedValue === 'function') {
this._$committedValue.call((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.host) !== null && _b !== void 0 ? _b : this.element, event);
} else {
this._$committedValue.handleEvent(event);
}
}
}
class ElementPart$3 {
constructor(element, parent, options) {
this.element = element;
this.type = ELEMENT_PART$3;
this._$disconnectableChildren = undefined;
this._$parent = parent;
this.options = options;
}
get _$isConnected() {
return this._$parent._$isConnected;
}
_$setValue(value) {
if (debugLogEvent$6 === null || debugLogEvent$6 === void 0) {
0;
undefined;
} else {
debugLogEvent$6({
kind: 'commit to element binding',
element: this.element,
value,
options: this.options
});
}
resolveDirective$3(this, value);
}
}
var polyfillSupport$a = global$d.litHtmlPolyfillSupportDevMode;
if (polyfillSupport$a === null || polyfillSupport$a === void 0) {
0;
undefined;
} else {
polyfillSupport$a(Template$3, ChildPart$3);
}
((_d$6 = global$d.litHtmlVersions) !== null && _d$6 !== void 0 ? _d$6 : global$d.litHtmlVersions = []).push('2.8.0');
if (global$d.litHtmlVersions.length > 1) {
issueWarning$a('multiple-versions', "Multiple versions of Lit loaded. " + "Loading multiple versions is not recommended.");
}
var render$3 = (value, container, options) => {
var _a, _b;
if (container == null) {
throw new TypeError("The container to render into may not be ".concat(container));
}
var renderId = debugLogRenderId$3++;
var partOwnerNode = (_a = options === null || options === void 0 ? void 0 : options.renderBefore) !== null && _a !== void 0 ? _a : container;
var part = partOwnerNode['_$litPart$'];
if (debugLogEvent$6 === null || debugLogEvent$6 === void 0) {
0;
undefined;
} else {
debugLogEvent$6({
kind: 'begin render',
id: renderId,
value,
container,
options,
part
});
}
if (part === undefined) {
var endNode = (_b = options === null || options === void 0 ? void 0 : options.renderBefore) !== null && _b !== void 0 ? _b : null;
partOwnerNode['_$litPart$'] = part = new ChildPart$3(container.insertBefore(createMarker$3(), endNode), endNode, undefined, options !== null && options !== void 0 ? options : {});
}
part._$setValue(value);
if (debugLogEvent$6 === null || debugLogEvent$6 === void 0) {
0;
undefined;
} else {
debugLogEvent$6({
kind: 'end render',
id: renderId,
value,
container,
options,
part
});
}
return part;
};
{
render$3.setSanitizer = setSanitizer$3;
render$3.createSanitizer = createSanitizer$3;
{
render$3._testOnlyClearSanitizerFactoryDoNotCallOrElse = _testOnlyClearSanitizerFactoryDoNotCallOrElse$3;
}
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var _a$9, _b$9, _c$9;
var issueWarning$9;
{
var _issuedWarnings3 = (_a$9 = globalThis.litIssuedWarnings) !== null && _a$9 !== void 0 ? _a$9 : globalThis.litIssuedWarnings = new Set();
issueWarning$9 = (code, warning) => {
warning += " See https://lit.dev/msg/".concat(code, " for more information.");
if (!_issuedWarnings3.has(warning)) {
console.warn(warning);
_issuedWarnings3.add(warning);
}
};
}
class LitElement$3 extends ReactiveElement$3 {
constructor() {
super(...arguments);
this.renderOptions = {
host: this
};
this.__childPart = undefined;
}
createRenderRoot() {
var _a;
var _b;
var renderRoot = super.createRenderRoot();
if ((_a = (_b = this.renderOptions).renderBefore) !== null && _a !== void 0) {
_a;
} else {
_b.renderBefore = renderRoot.firstChild;
}
return renderRoot;
}
update(changedProperties) {
var value = this.render();
if (!this.hasUpdated) {
this.renderOptions.isConnected = this.isConnected;
}
super.update(changedProperties);
this.__childPart = render$3(value, this.renderRoot, this.renderOptions);
}
connectedCallback() {
var _a;
super.connectedCallback();
if ((_a = this.__childPart) === null || _a === void 0) {
0;
undefined;
} else {
_a.setConnected(true);
}
}
disconnectedCallback() {
var _a;
super.disconnectedCallback();
if ((_a = this.__childPart) === null || _a === void 0) {
0;
undefined;
} else {
_a.setConnected(false);
}
}
render() {
return noChange$3;
}
}
LitElement$3['finalized'] = true;
LitElement$3['_$litElement$'] = true;
if ((_b$9 = globalThis.litElementHydrateSupport) === null || _b$9 === void 0) {
0;
undefined;
} else {
_b$9.call(globalThis, {
LitElement: LitElement$3
});
}
var polyfillSupport$9 = globalThis.litElementPolyfillSupportDevMode;
if (polyfillSupport$9 === null || polyfillSupport$9 === void 0) {
0;
undefined;
} else {
polyfillSupport$9({
LitElement: LitElement$3
});
}
{
LitElement$3['finalize'] = function () {
var finalized = ReactiveElement$3.finalize.call(this);
if (!finalized) {
return false;
}
var warnRemovedOrRenamed = function warnRemovedOrRenamed(obj, name) {
var renamed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (obj.hasOwnProperty(name)) {
var ctorName = (typeof obj === 'function' ? obj : obj.constructor).name;
issueWarning$9(renamed ? 'renamed-api' : 'removed-api', "`".concat(name, "` is implemented on class ").concat(ctorName, ". It ") + "has been ".concat(renamed ? 'renamed' : 'removed', " ") + "in this version of LitElement.");
}
};
warnRemovedOrRenamed(this, 'render');
warnRemovedOrRenamed(this, 'getStyles', true);
warnRemovedOrRenamed(this.prototype, 'adoptStyles');
return true;
};
}
((_c$9 = globalThis.litElementVersions) !== null && _c$9 !== void 0 ? _c$9 : globalThis.litElementVersions = []).push('3.3.3');
if (globalThis.litElementVersions.length > 1) {
issueWarning$9('multiple-versions', "Multiple versions of Lit loaded. Loading multiple versions " + "is not recommended.");
}
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
var isNodeElement = node => {
return node.nodeType === Node.ELEMENT_NODE;
};
function addHasRemoveClass(element) {
return {
addClass: className => {
element.classList.add(className);
},
removeClass: className => {
element.classList.remove(className);
},
hasClass: className => element.classList.contains(className)
};
}
var fn = () => {};
var optionsBlock = {
get passive() {
return false;
}
};
document.addEventListener('x', fn, optionsBlock);
document.removeEventListener('x', fn);
var deepActiveElementPath = function deepActiveElementPath() {
var doc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.document;
var activeElement = doc.activeElement;
var path = [];
if (!activeElement) {
return path;
}
while (activeElement) {
path.push(activeElement);
if (activeElement.shadowRoot) {
activeElement = activeElement.shadowRoot.activeElement;
} else {
break;
}
}
return path;
};
var doesElementContainFocus = element => {
var activePath = deepActiveElementPath();
if (!activePath.length) {
return false;
}
var deepActiveElement = activePath[activePath.length - 1];
var focusEv = new Event('check-if-focused', {
bubbles: true,
composed: true
});
var composedPath = [];
var listener = ev => {
composedPath = ev.composedPath();
};
document.body.addEventListener('check-if-focused', listener);
deepActiveElement.dispatchEvent(focusEv);
document.body.removeEventListener('check-if-focused', listener);
return composedPath.indexOf(element) !== -1;
};
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
class BaseElement extends LitElement$3 {
click() {
if (this.mdcRoot) {
this.mdcRoot.focus();
this.mdcRoot.click();
return;
}
super.click();
}
createFoundation() {
if (this.mdcFoundation !== undefined) {
this.mdcFoundation.destroy();
}
if (this.mdcFoundationClass) {
this.mdcFoundation = new this.mdcFoundationClass(this.createAdapter());
this.mdcFoundation.init();
}
}
firstUpdated() {
this.createFoundation();
}
}
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
var observer = observer => (proto, propName) => {
if (!proto.constructor._observers) {
proto.constructor._observers = new Map();
var userUpdated = proto.updated;
proto.updated = function (changedProperties) {
userUpdated.call(this, changedProperties);
changedProperties.forEach((v, k) => {
var observers = this.constructor._observers;
var observer = observers.get(k);
if (observer !== undefined) {
observer.call(this, this[k], v);
}
});
};
} else if (!proto.constructor.hasOwnProperty('_observers')) {
var _observers = proto.constructor._observers;
proto.constructor._observers = new Map();
_observers.forEach((v, k) => proto.constructor._observers.set(k, v));
}
proto.constructor._observers.set(propName, observer);
};
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var NODE_MODE$2 = false;
var global$c = window;
var supportsAdoptingStyleSheets$2 = global$c.ShadowRoot && (global$c.ShadyCSS === undefined || global$c.ShadyCSS.nativeShadow) && 'adoptedStyleSheets' in Document.prototype && 'replace' in CSSStyleSheet.prototype;
var constructionToken$2 = Symbol();
var cssTagCache$2 = new WeakMap();
class CSSResult$2 {
constructor(cssText, strings, safeToken) {
this['_$cssResult$'] = true;
if (safeToken !== constructionToken$2) {
throw new Error('CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');
}
this.cssText = cssText;
this._strings = strings;
}
get styleSheet() {
var styleSheet = this._styleSheet;
var strings = this._strings;
if (supportsAdoptingStyleSheets$2 && styleSheet === undefined) {
var cacheable = strings !== undefined && strings.length === 1;
if (cacheable) {
styleSheet = cssTagCache$2.get(strings);
}
if (styleSheet === undefined) {
(this._styleSheet = styleSheet = new CSSStyleSheet()).replaceSync(this.cssText);
if (cacheable) {
cssTagCache$2.set(strings, styleSheet);
}
}
}
return styleSheet;
}
toString() {
return this.cssText;
}
}
var textFromCSSResult$2 = value => {
if (value['_$cssResult$'] === true) {
return value.cssText;
} else if (typeof value === 'number') {
return value;
} else {
throw new Error("Value passed to 'css' function must be a 'css' function result: " + "".concat(value, ". Use 'unsafeCSS' to pass non-literal values, but take care ") + "to ensure page security.");
}
};
var unsafeCSS$2 = value => new CSSResult$2(typeof value === 'string' ? value : String(value), undefined, constructionToken$2);
var css$2 = function css$2(strings) {
for (var _len4 = arguments.length, values = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
values[_key4 - 1] = arguments[_key4];
}
var cssText = strings.length === 1 ? strings[0] : values.reduce((acc, v, idx) => acc + textFromCSSResult$2(v) + strings[idx + 1], strings[0]);
return new CSSResult$2(cssText, strings, constructionToken$2);
};
var adoptStyles$2 = (renderRoot, styles) => {
if (supportsAdoptingStyleSheets$2) {
renderRoot.adoptedStyleSheets = styles.map(s => s instanceof CSSStyleSheet ? s : s.styleSheet);
} else {
styles.forEach(s => {
var style = document.createElement('style');
var nonce = global$c['litNonce'];
if (nonce !== undefined) {
style.setAttribute('nonce', nonce);
}
style.textContent = s.cssText;
renderRoot.appendChild(style);
});
}
};
var cssResultFromStyleSheet$2 = sheet => {
var cssText = '';
for (var rule of sheet.cssRules) {
cssText += rule.cssText;
}
return unsafeCSS$2(cssText);
};
var getCompatibleStyle$2 = supportsAdoptingStyleSheets$2 || NODE_MODE$2 ? s => s : s => s instanceof CSSStyleSheet ? cssResultFromStyleSheet$2(s) : s;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var _b$8, _c$8, _d$5;
var _e$2;
var global$b = window;
var requestUpdateThenable$2;
var issueWarning$8;
var trustedTypes$5 = global$b.trustedTypes;
var emptyStringForBooleanAttribute$5 = trustedTypes$5 ? trustedTypes$5.emptyScript : '';
var polyfillSupport$8 = global$b.reactiveElementPolyfillSupportDevMode;
{
var _issuedWarnings4 = (_b$8 = global$b.litIssuedWarnings) !== null && _b$8 !== void 0 ? _b$8 : global$b.litIssuedWarnings = new Set();
issueWarning$8 = (code, warning) => {
warning += " See https://lit.dev/msg/".concat(code, " for more information.");
if (!_issuedWarnings4.has(warning)) {
console.warn(warning);
_issuedWarnings4.add(warning);
}
};
issueWarning$8('dev-mode', "Lit is in dev mode. Not recommended for production!");
if (((_c$8 = global$b.ShadyDOM) === null || _c$8 === void 0 ? void 0 : _c$8.inUse) && polyfillSupport$8 === undefined) {
issueWarning$8('polyfill-support-missing', "Shadow DOM is being polyfilled via `ShadyDOM` but " + "the `polyfill-support` module has not been loaded.");
}
requestUpdateThenable$2 = name => ({
then: (onfulfilled, _onrejected) => {
issueWarning$8('request-update-promise', "The `requestUpdate` method should no longer return a Promise but " + "does so on `".concat(name, "`. Use `updateComplete` instead."));
if (onfulfilled !== undefined) {
onfulfilled(false);
}
}
});
}
var debugLogEvent$5 = event => {
var shouldEmit = global$b.emitLitDebugLogEvents;
if (!shouldEmit) {
return;
}
global$b.dispatchEvent(new CustomEvent('lit-debug', {
detail: event
}));
};
var JSCompiler_renameProperty$2 = (prop, _obj) => prop;
var defaultConverter$2 = {
toAttribute(value, type) {
switch (type) {
case Boolean:
if (value) {
value = emptyStringForBooleanAttribute$5;
} else {
value = null;
}
break;
case Object:
case Array:
if (value == null) {
value = value;
} else {
value = JSON.stringify(value);
}
break;
}
return value;
},
fromAttribute(value, type) {
var fromValue = value;
switch (type) {
case Boolean:
fromValue = value !== null;
break;
case Number:
if (value === null) {
fromValue = null;
} else {
fromValue = Number(value);
}
break;
case Object:
case Array:
try {
fromValue = JSON.parse(value);
} catch (e) {
fromValue = null;
}
break;
}
return fromValue;
}
};
var notEqual$2 = (value, old) => {
return old !== value && (old === old || value === value);
};
var defaultPropertyDeclaration$2 = {
attribute: true,
type: String,
converter: defaultConverter$2,
reflect: false,
hasChanged: notEqual$2
};
var finalized$2 = 'finalized';
class ReactiveElement$2 extends HTMLElement {
constructor() {
super();
this.__instanceProperties = new Map();
this.isUpdatePending = false;
this.hasUpdated = false;
this.__reflectingProperty = null;
this.__initialize();
}
static addInitializer(initializer) {
var _a;
this.finalize();
((_a = this._initializers) !== null && _a !== void 0 ? _a : this._initializers = []).push(initializer);
}
static get observedAttributes() {
this.finalize();
var attributes = [];
this.elementProperties.forEach((v, p) => {
var attr = this.__attributeNameForProperty(p, v);
if (attr !== undefined) {
this.__attributeToPropertyMap.set(attr, p);
attributes.push(attr);
}
});
return attributes;
}
static createProperty(name) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultPropertyDeclaration$2;
var _a;
if (options.state) {
options.attribute = false;
}
this.finalize();
this.elementProperties.set(name, options);
if (!options.noAccessor && !this.prototype.hasOwnProperty(name)) {
var key = typeof name === 'symbol' ? Symbol() : "__".concat(name);
var descriptor = this.getPropertyDescriptor(name, key, options);
if (descriptor !== undefined) {
Object.defineProperty(this.prototype, name, descriptor);
{
if (!this.hasOwnProperty('__reactivePropertyKeys')) {
this.__reactivePropertyKeys = new Set((_a = this.__reactivePropertyKeys) !== null && _a !== void 0 ? _a : []);
}
this.__reactivePropertyKeys.add(name);
}
}
}
}
static getPropertyDescriptor(name, key, options) {
return {
get() {
return this[key];
},
set(value) {
var oldValue = this[name];
this[key] = value;
this.requestUpdate(name, oldValue, options);
},
configurable: true,
enumerable: true
};
}
static getPropertyOptions(name) {
return this.elementProperties.get(name) || defaultPropertyDeclaration$2;
}
static finalize() {
var _this5 = this;
if (this.hasOwnProperty(finalized$2)) {
return false;
}
this[finalized$2] = true;
var superCtor = Object.getPrototypeOf(this);
superCtor.finalize();
if (superCtor._initializers !== undefined) {
this._initializers = [...superCtor._initializers];
}
this.elementProperties = new Map(superCtor.elementProperties);
this.__attributeToPropertyMap = new Map();
if (this.hasOwnProperty(JSCompiler_renameProperty$2('properties'))) {
var props = this.properties;
var propKeys = [...Object.getOwnPropertyNames(props), ...Object.getOwnPropertySymbols(props)];
for (var p of propKeys) {
this.createProperty(p, props[p]);
}
}
this.elementStyles = this.finalizeStyles(this.styles);
{
var warnRemovedOrRenamed = function warnRemovedOrRenamed(name) {
var renamed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (_this5.prototype.hasOwnProperty(name)) {
issueWarning$8(renamed ? 'renamed-api' : 'removed-api', "`".concat(name, "` is implemented on class ").concat(_this5.name, ". It ") + "has been ".concat(renamed ? 'renamed' : 'removed', " ") + "in this version of LitElement.");
}
};
warnRemovedOrRenamed('initialize');
warnRemovedOrRenamed('requestUpdateInternal');
warnRemovedOrRenamed('_getUpdateComplete', true);
}
return true;
}
static finalizeStyles(styles) {
var elementStyles = [];
if (Array.isArray(styles)) {
var set = new Set(styles.flat(Infinity).reverse());
for (var s of set) {
elementStyles.unshift(getCompatibleStyle$2(s));
}
} else if (styles !== undefined) {
elementStyles.push(getCompatibleStyle$2(styles));
}
return elementStyles;
}
static __attributeNameForProperty(name, options) {
var attribute = options.attribute;
if (attribute === false) {
return undefined;
} else {
if (typeof attribute === 'string') {
return attribute;
} else {
if (typeof name === 'string') {
return name.toLowerCase();
} else {
return undefined;
}
}
}
}
__initialize() {
var _a;
this.__updatePromise = new Promise(res => this.enableUpdating = res);
this._$changedProperties = new Map();
this.__saveInstanceProperties();
this.requestUpdate();
if ((_a = this.constructor._initializers) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(i => i(this));
}
}
addController(controller) {
var _a, _b;
((_a = this.__controllers) !== null && _a !== void 0 ? _a : this.__controllers = []).push(controller);
if (this.renderRoot !== undefined && this.isConnected) {
if ((_b = controller.hostConnected) === null || _b === void 0) {
0;
undefined;
} else {
_b.call(controller);
}
}
}
removeController(controller) {
var _a;
if ((_a = this.__controllers) === null || _a === void 0) {
0;
undefined;
} else {
_a.splice(this.__controllers.indexOf(controller) >>> 0, 1);
}
}
__saveInstanceProperties() {
this.constructor.elementProperties.forEach((_v, p) => {
if (this.hasOwnProperty(p)) {
this.__instanceProperties.set(p, this[p]);
delete this[p];
}
});
}
createRenderRoot() {
var _a;
var renderRoot = (_a = this.shadowRoot) !== null && _a !== void 0 ? _a : this.attachShadow(this.constructor.shadowRootOptions);
adoptStyles$2(renderRoot, this.constructor.elementStyles);
return renderRoot;
}
connectedCallback() {
var _a;
if (this.renderRoot === undefined) {
this.renderRoot = this.createRenderRoot();
}
this.enableUpdating(true);
if ((_a = this.__controllers) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(c => {
var _a;
if ((_a = c.hostConnected) === null || _a === void 0) {
0;
return;
} else {
return _a.call(c);
}
});
}
}
enableUpdating(_requestedUpdate) {}
disconnectedCallback() {
var _a;
if ((_a = this.__controllers) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(c => {
var _a;
if ((_a = c.hostDisconnected) === null || _a === void 0) {
0;
return;
} else {
return _a.call(c);
}
});
}
}
attributeChangedCallback(name, _old, value) {
this._$attributeToProperty(name, value);
}
__propertyToAttribute(name, value) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultPropertyDeclaration$2;
var _a;
var attr = this.constructor.__attributeNameForProperty(name, options);
if (attr !== undefined && options.reflect === true) {
var converter = ((_a = options.converter) === null || _a === void 0 ? void 0 : _a.toAttribute) !== undefined ? options.converter : defaultConverter$2;
var attrValue = converter.toAttribute(value, options.type);
if (this.constructor.enabledWarnings.indexOf('migration') >= 0 && attrValue === undefined) {
issueWarning$8('undefined-attribute-value', "The attribute value for the ".concat(name, " property is ") + "undefined on element ".concat(this.localName, ". The attribute will be ") + "removed, but in the previous version of `ReactiveElement`, " + "the attribute would not have changed.");
}
this.__reflectingProperty = name;
if (attrValue == null) {
this.removeAttribute(attr);
} else {
this.setAttribute(attr, attrValue);
}
this.__reflectingProperty = null;
}
}
_$attributeToProperty(name, value) {
var _a;
var ctor = this.constructor;
var propName = ctor.__attributeToPropertyMap.get(name);
if (propName !== undefined && this.__reflectingProperty !== propName) {
var options = ctor.getPropertyOptions(propName);
var converter = typeof options.converter === 'function' ? {
fromAttribute: options.converter
} : ((_a = options.converter) === null || _a === void 0 ? void 0 : _a.fromAttribute) !== undefined ? options.converter : defaultConverter$2;
this.__reflectingProperty = propName;
this[propName] = converter.fromAttribute(value, options.type);
this.__reflectingProperty = null;
}
}
requestUpdate(name, oldValue, options) {
var shouldRequestUpdate = true;
if (name !== undefined) {
options = options || this.constructor.getPropertyOptions(name);
var hasChanged = options.hasChanged || notEqual$2;
if (hasChanged(this[name], oldValue)) {
if (!this._$changedProperties.has(name)) {
this._$changedProperties.set(name, oldValue);
}
if (options.reflect === true && this.__reflectingProperty !== name) {
if (this.__reflectingProperties === undefined) {
this.__reflectingProperties = new Map();
}
this.__reflectingProperties.set(name, options);
}
} else {
shouldRequestUpdate = false;
}
}
if (!this.isUpdatePending && shouldRequestUpdate) {
this.__updatePromise = this.__enqueueUpdate();
}
return requestUpdateThenable$2(this.localName);
}
__enqueueUpdate() {
var _this6 = this;
return _asyncToGenerator(function* () {
_this6.isUpdatePending = true;
try {
yield _this6.__updatePromise;
} catch (e) {
Promise.reject(e);
}
var result = _this6.scheduleUpdate();
if (result != null) {
yield result;
}
return !_this6.isUpdatePending;
})();
}
scheduleUpdate() {
return this.performUpdate();
}
performUpdate() {
var _a, _b;
if (!this.isUpdatePending) {
return;
}
if (debugLogEvent$5 === null || debugLogEvent$5 === void 0) {
0;
undefined;
} else {
debugLogEvent$5({
kind: 'update'
});
}
if (!this.hasUpdated) {
{
var shadowedProperties = [];
if ((_a = this.constructor.__reactivePropertyKeys) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(p => {
var _a;
if (this.hasOwnProperty(p) && !((_a = this.__instanceProperties) === null || _a === void 0 ? void 0 : _a.has(p))) {
shadowedProperties.push(p);
}
});
}
if (shadowedProperties.length) {
throw new Error("The following properties on element ".concat(this.localName, " will not ") + "trigger updates as expected because they are set using class " + "fields: ".concat(shadowedProperties.join(', '), ". ") + "Native class fields and some compiled output will overwrite " + "accessors used for detecting changes. See " + "https://lit.dev/msg/class-field-shadowing " + "for more information.");
}
}
}
if (this.__instanceProperties) {
this.__instanceProperties.forEach((v, p) => this[p] = v);
this.__instanceProperties = undefined;
}
var shouldUpdate = false;
var changedProperties = this._$changedProperties;
try {
shouldUpdate = this.shouldUpdate(changedProperties);
if (shouldUpdate) {
this.willUpdate(changedProperties);
if ((_b = this.__controllers) === null || _b === void 0) {
0;
undefined;
} else {
_b.forEach(c => {
var _a;
if ((_a = c.hostUpdate) === null || _a === void 0) {
0;
return;
} else {
return _a.call(c);
}
});
}
this.update(changedProperties);
} else {
this.__markUpdated();
}
} catch (e) {
shouldUpdate = false;
this.__markUpdated();
throw e;
}
if (shouldUpdate) {
this._$didUpdate(changedProperties);
}
}
willUpdate(_changedProperties) {}
_$didUpdate(changedProperties) {
var _a;
if ((_a = this.__controllers) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(c => {
var _a;
if ((_a = c.hostUpdated) === null || _a === void 0) {
0;
return;
} else {
return _a.call(c);
}
});
}
if (!this.hasUpdated) {
this.hasUpdated = true;
this.firstUpdated(changedProperties);
}
this.updated(changedProperties);
if (this.isUpdatePending && this.constructor.enabledWarnings.indexOf('change-in-update') >= 0) {
issueWarning$8('change-in-update', "Element ".concat(this.localName, " scheduled an update ") + "(generally because a property was set) " + "after an update completed, causing a new update to be scheduled. " + "This is inefficient and should be avoided unless the next update " + "can only be scheduled as a side effect of the previous update.");
}
}
__markUpdated() {
this._$changedProperties = new Map();
this.isUpdatePending = false;
}
get updateComplete() {
return this.getUpdateComplete();
}
getUpdateComplete() {
return this.__updatePromise;
}
shouldUpdate(_changedProperties) {
return true;
}
update(_changedProperties) {
if (this.__reflectingProperties !== undefined) {
this.__reflectingProperties.forEach((v, k) => this.__propertyToAttribute(k, this[k], v));
this.__reflectingProperties = undefined;
}
this.__markUpdated();
}
updated(_changedProperties) {}
firstUpdated(_changedProperties) {}
}
_e$2 = finalized$2;
ReactiveElement$2[_e$2] = true;
ReactiveElement$2.elementProperties = new Map();
ReactiveElement$2.elementStyles = [];
ReactiveElement$2.shadowRootOptions = {
mode: 'open'
};
if (polyfillSupport$8 === null || polyfillSupport$8 === void 0) {
0;
undefined;
} else {
polyfillSupport$8({
ReactiveElement: ReactiveElement$2
});
}
{
ReactiveElement$2.enabledWarnings = ['change-in-update'];
var _ensureOwnWarnings2 = function _ensureOwnWarnings2(ctor) {
if (!ctor.hasOwnProperty(JSCompiler_renameProperty$2('enabledWarnings'))) {
ctor.enabledWarnings = ctor.enabledWarnings.slice();
}
};
ReactiveElement$2.enableWarning = function (warning) {
_ensureOwnWarnings2(this);
if (this.enabledWarnings.indexOf(warning) < 0) {
this.enabledWarnings.push(warning);
}
};
ReactiveElement$2.disableWarning = function (warning) {
_ensureOwnWarnings2(this);
var i = this.enabledWarnings.indexOf(warning);
if (i >= 0) {
this.enabledWarnings.splice(i, 1);
}
};
}
((_d$5 = global$b.reactiveElementVersions) !== null && _d$5 !== void 0 ? _d$5 : global$b.reactiveElementVersions = []).push('1.6.3');
if (global$b.reactiveElementVersions.length > 1) {
issueWarning$8('multiple-versions', "Multiple versions of Lit loaded. Loading multiple versions " + "is not recommended.");
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var _a$8, _b$7, _c$7, _d$4;
var global$a = window;
var debugLogEvent$4 = event => {
var shouldEmit = global$a.emitLitDebugLogEvents;
if (!shouldEmit) {
return;
}
global$a.dispatchEvent(new CustomEvent('lit-debug', {
detail: event
}));
};
var debugLogRenderId$2 = 0;
var issueWarning$7;
{
if ((_a$8 = global$a.litIssuedWarnings) !== null && _a$8 !== void 0) {
_a$8;
} else {
global$a.litIssuedWarnings = new Set();
}
issueWarning$7 = (code, warning) => {
if (code) {
warning += " See https://lit.dev/msg/".concat(code, " for more information.");
} else {
warning += '';
}
if (!global$a.litIssuedWarnings.has(warning)) {
console.warn(warning);
global$a.litIssuedWarnings.add(warning);
}
};
issueWarning$7('dev-mode', "Lit is in dev mode. Not recommended for production!");
}
var wrap$2 = ((_b$7 = global$a.ShadyDOM) === null || _b$7 === void 0 ? void 0 : _b$7.inUse) && ((_c$7 = global$a.ShadyDOM) === null || _c$7 === void 0 ? void 0 : _c$7.noPatch) === true ? global$a.ShadyDOM.wrap : node => node;
var trustedTypes$4 = global$a.trustedTypes;
var policy$2 = trustedTypes$4 ? trustedTypes$4.createPolicy('lit-html', {
createHTML: s => s
}) : undefined;
var identityFunction$2 = value => value;
var noopSanitizer$2 = (_node, _name, _type) => identityFunction$2;
var setSanitizer$2 = newSanitizer => {
if (sanitizerFactoryInternal$2 !== noopSanitizer$2) {
throw new Error("Attempted to overwrite existing lit-html security policy." + " setSanitizeDOMValueFactory should be called at most once.");
}
sanitizerFactoryInternal$2 = newSanitizer;
};
var _testOnlyClearSanitizerFactoryDoNotCallOrElse$2 = () => {
sanitizerFactoryInternal$2 = noopSanitizer$2;
};
var createSanitizer$2 = (node, name, type) => {
return sanitizerFactoryInternal$2(node, name, type);
};
var boundAttributeSuffix$2 = '$lit$';
var marker$2 = "lit$".concat(String(Math.random()).slice(9), "$");
var markerMatch$2 = '?' + marker$2;
var nodeMarker$2 = "<".concat(markerMatch$2, ">");
var d$2 = document;
var createMarker$2 = () => d$2.createComment('');
var isPrimitive$2 = value => value === null || typeof value != 'object' && typeof value != 'function';
var isArray$2 = Array.isArray;
var isIterable$2 = value => isArray$2(value) || typeof (value === null || value === void 0 ? void 0 : value[Symbol.iterator]) === 'function';
var SPACE_CHAR$2 = "[ \t\n\f\r]";
var ATTR_VALUE_CHAR$2 = "[^ \t\n\f\r\"'`<>=]";
var NAME_CHAR$2 = "[^\\s\"'>=/]";
var textEndRegex$2 = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g;
var COMMENT_START$2 = 1;
var TAG_NAME$2 = 2;
var DYNAMIC_TAG_NAME$2 = 3;
var commentEndRegex$2 = /-->/g;
var comment2EndRegex$2 = />/g;
var tagEndRegex$2 = new RegExp(">|".concat(SPACE_CHAR$2, "(?:(").concat(NAME_CHAR$2, "+)(").concat(SPACE_CHAR$2, "*=").concat(SPACE_CHAR$2, "*(?:").concat(ATTR_VALUE_CHAR$2, "|(\"|')|))|$)"), 'g');
var ENTIRE_MATCH$2 = 0;
var ATTRIBUTE_NAME$2 = 1;
var SPACES_AND_EQUALS$2 = 2;
var QUOTE_CHAR$2 = 3;
var singleQuoteAttrEndRegex$2 = /'/g;
var doubleQuoteAttrEndRegex$2 = /"/g;
var rawTextElement$2 = /^(?:script|style|textarea|title)$/i;
var HTML_RESULT$2 = 1;
var SVG_RESULT$2 = 2;
var ATTRIBUTE_PART$2 = 1;
var CHILD_PART$2 = 2;
var PROPERTY_PART$2 = 3;
var BOOLEAN_ATTRIBUTE_PART$2 = 4;
var EVENT_PART$2 = 5;
var ELEMENT_PART$2 = 6;
var COMMENT_PART$2 = 7;
var tag$2 = type => function (strings) {
if (strings.some(s => s === undefined)) {
console.warn('Some template strings are undefined.\n' + 'This is probably caused by illegal octal escape sequences.');
}
for (var _len5 = arguments.length, values = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
values[_key5 - 1] = arguments[_key5];
}
return {
['_$litType$']: type,
strings,
values
};
};
var html$2 = tag$2(HTML_RESULT$2);
var noChange$2 = Symbol.for('lit-noChange');
var nothing$2 = Symbol.for('lit-nothing');
var templateCache$2 = new WeakMap();
var walker$2 = d$2.createTreeWalker(d$2, 129, null, false);
var sanitizerFactoryInternal$2 = noopSanitizer$2;
function trustFromTemplateString$2(tsa, stringFromTSA) {
if (!Array.isArray(tsa) || !tsa.hasOwnProperty('raw')) {
var message = 'invalid template strings array';
{
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 ".trim().replace(/\n */g, '\n');
}
throw new Error(message);
}
if (policy$2 !== undefined) {
return policy$2.createHTML(stringFromTSA);
} else {
return stringFromTSA;
}
}
var getTemplateHtml$2 = (strings, type) => {
var l = strings.length - 1;
var attrNames = [];
var html = type === SVG_RESULT$2 ? '<svg>' : '';
var rawTextEndRegex;
var regex = textEndRegex$2;
for (var i = 0; i < l; i++) {
var s = strings[i];
var attrNameEndIndex = -1;
var attrName = void 0;
var lastIndex = 0;
var match = void 0;
while (lastIndex < s.length) {
regex.lastIndex = lastIndex;
match = regex.exec(s);
if (match === null) {
break;
}
lastIndex = regex.lastIndex;
if (regex === textEndRegex$2) {
if (match[COMMENT_START$2] === '!--') {
regex = commentEndRegex$2;
} else if (match[COMMENT_START$2] !== undefined) {
regex = comment2EndRegex$2;
} else if (match[TAG_NAME$2] !== undefined) {
if (rawTextElement$2.test(match[TAG_NAME$2])) {
rawTextEndRegex = new RegExp("</".concat(match[TAG_NAME$2]), 'g');
}
regex = tagEndRegex$2;
} else if (match[DYNAMIC_TAG_NAME$2] !== undefined) {
{
throw new Error('Bindings in tag names are not supported. Please use static templates instead. ' + 'See https://lit.dev/docs/templates/expressions/#static-expressions');
}
}
} else if (regex === tagEndRegex$2) {
if (match[ENTIRE_MATCH$2] === '>') {
if (rawTextEndRegex !== null && rawTextEndRegex !== void 0) {
regex = rawTextEndRegex;
} else {
regex = textEndRegex$2;
}
attrNameEndIndex = -1;
} else if (match[ATTRIBUTE_NAME$2] === undefined) {
attrNameEndIndex = -2;
} else {
attrNameEndIndex = regex.lastIndex - match[SPACES_AND_EQUALS$2].length;
attrName = match[ATTRIBUTE_NAME$2];
if (match[QUOTE_CHAR$2] === undefined) {
regex = tagEndRegex$2;
} else if (match[QUOTE_CHAR$2] === '"') {
regex = doubleQuoteAttrEndRegex$2;
} else {
regex = singleQuoteAttrEndRegex$2;
}
}
} else if (regex === doubleQuoteAttrEndRegex$2 || regex === singleQuoteAttrEndRegex$2) {
regex = tagEndRegex$2;
} else if (regex === commentEndRegex$2 || regex === comment2EndRegex$2) {
regex = textEndRegex$2;
} else {
regex = tagEndRegex$2;
rawTextEndRegex = undefined;
}
}
{
console.assert(attrNameEndIndex === -1 || regex === tagEndRegex$2 || regex === singleQuoteAttrEndRegex$2 || regex === doubleQuoteAttrEndRegex$2, 'unexpected parse state B');
}
var end = regex === tagEndRegex$2 && strings[i + 1].startsWith('/>') ? ' ' : '';
if (regex === textEndRegex$2) {
html += s + nodeMarker$2;
} else if (attrNameEndIndex >= 0) {
html += (attrNames.push(attrName), s.slice(0, attrNameEndIndex) + boundAttributeSuffix$2 + s.slice(attrNameEndIndex)) + marker$2 + end;
} else {
html += s + marker$2 + (attrNameEndIndex === -2 ? (attrNames.push(undefined), i) : end);
}
}
var htmlResult = html + (strings[l] || '<?>') + (type === SVG_RESULT$2 ? '</svg>' : '');
return [trustFromTemplateString$2(strings, htmlResult), attrNames];
};
class Template$2 {
constructor(_ref10, options) {
var {
strings,
['_$litType$']: type
} = _ref10;
this.parts = [];
var node;
var nodeIndex = 0;
var attrNameIndex = 0;
var partCount = strings.length - 1;
var parts = this.parts;
var [html, attrNames] = getTemplateHtml$2(strings, type);
this.el = Template$2.createElement(html, options);
walker$2.currentNode = this.el.content;
if (type === SVG_RESULT$2) {
var content = this.el.content;
var svgElement = content.firstChild;
svgElement.remove();
content.append(...svgElement.childNodes);
}
while ((node = walker$2.nextNode()) !== null && parts.length < partCount) {
if (node.nodeType === 1) {
{
var _tag3 = node.localName;
if (/^(?:textarea|template)$/i.test(_tag3) && node.innerHTML.includes(marker$2)) {
var m = "Expressions are not supported inside `".concat(_tag3, "` ") + "elements. See https://lit.dev/msg/expression-in-".concat(_tag3, " for more ") + "information.";
if (_tag3 === 'template') {
throw new Error(m);
} else {
issueWarning$7('', m);
}
}
}
if (node.hasAttributes()) {
var attrsToRemove = [];
for (var name of node.getAttributeNames()) {
if (name.endsWith(boundAttributeSuffix$2) || name.startsWith(marker$2)) {
var realName = attrNames[attrNameIndex++];
attrsToRemove.push(name);
if (realName !== undefined) {
var value = node.getAttribute(realName.toLowerCase() + boundAttributeSuffix$2);
var statics = value.split(marker$2);
var _m3 = /([.?@])?(.*)/.exec(realName);
parts.push({
type: ATTRIBUTE_PART$2,
index: nodeIndex,
name: _m3[2],
strings: statics,
ctor: _m3[1] === '.' ? PropertyPart$2 : _m3[1] === '?' ? BooleanAttributePart$2 : _m3[1] === '@' ? EventPart$2 : AttributePart$2
});
} else {
parts.push({
type: ELEMENT_PART$2,
index: nodeIndex
});
}
}
}
for (var _name6 of attrsToRemove) {
node.removeAttribute(_name6);
}
}
if (rawTextElement$2.test(node.tagName)) {
var _strings3 = node.textContent.split(marker$2);
var lastIndex = _strings3.length - 1;
if (lastIndex > 0) {
if (trustedTypes$4) {
node.textContent = trustedTypes$4.emptyScript;
} else {
node.textContent = '';
}
for (var i = 0; i < lastIndex; i++) {
node.append(_strings3[i], createMarker$2());
walker$2.nextNode();
parts.push({
type: CHILD_PART$2,
index: ++nodeIndex
});
}
node.append(_strings3[lastIndex], createMarker$2());
}
}
} else if (node.nodeType === 8) {
var data = node.data;
if (data === markerMatch$2) {
parts.push({
type: CHILD_PART$2,
index: nodeIndex
});
} else {
var _i4 = -1;
while ((_i4 = node.data.indexOf(marker$2, _i4 + 1)) !== -1) {
parts.push({
type: COMMENT_PART$2,
index: nodeIndex
});
_i4 += marker$2.length - 1;
}
}
}
nodeIndex++;
}
if (debugLogEvent$4 === null || debugLogEvent$4 === void 0) {
0;
undefined;
} else {
debugLogEvent$4({
kind: 'template prep',
template: this,
clonableTemplate: this.el,
parts: this.parts,
strings
});
}
}
static createElement(html, _options) {
var el = d$2.createElement('template');
el.innerHTML = html;
return el;
}
}
function resolveDirective$2(part, value) {
var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : part;
var attributeIndex = arguments.length > 3 ? arguments[3] : undefined;
var _a, _b, _c;
var _d;
if (value === noChange$2) {
return value;
}
var currentDirective = attributeIndex !== undefined ? (_a = parent.__directives) === null || _a === void 0 ? void 0 : _a[attributeIndex] : parent.__directive;
var nextDirectiveConstructor = isPrimitive$2(value) ? undefined : value['_$litDirective$'];
if ((currentDirective === null || currentDirective === void 0 ? void 0 : currentDirective.constructor) !== nextDirectiveConstructor) {
if ((_b = currentDirective === null || currentDirective === void 0 ? void 0 : currentDirective['_$notifyDirectiveConnectionChanged']) === null || _b === void 0) {
0;
undefined;
} else {
_b.call(currentDirective, false);
}
if (nextDirectiveConstructor === undefined) {
currentDirective = undefined;
} else {
currentDirective = new nextDirectiveConstructor(part);
currentDirective._$initialize(part, parent, attributeIndex);
}
if (attributeIndex !== undefined) {
((_c = (_d = parent).__directives) !== null && _c !== void 0 ? _c : _d.__directives = [])[attributeIndex] = currentDirective;
} else {
parent.__directive = currentDirective;
}
}
if (currentDirective !== undefined) {
value = resolveDirective$2(part, currentDirective._$resolve(part, value.values), currentDirective, attributeIndex);
}
return value;
}
class TemplateInstance$2 {
constructor(template, parent) {
this._$parts = [];
this._$disconnectableChildren = undefined;
this._$template = template;
this._$parent = parent;
}
get parentNode() {
return this._$parent.parentNode;
}
get _$isConnected() {
return this._$parent._$isConnected;
}
_clone(options) {
var _a;
var {
el: {
content
},
parts: parts
} = this._$template;
var fragment = ((_a = options === null || options === void 0 ? void 0 : options.creationScope) !== null && _a !== void 0 ? _a : d$2).importNode(content, true);
walker$2.currentNode = fragment;
var node = walker$2.nextNode();
var nodeIndex = 0;
var partIndex = 0;
var templatePart = parts[0];
while (templatePart !== undefined) {
if (nodeIndex === templatePart.index) {
var part = void 0;
if (templatePart.type === CHILD_PART$2) {
part = new ChildPart$2(node, node.nextSibling, this, options);
} else if (templatePart.type === ATTRIBUTE_PART$2) {
part = new templatePart.ctor(node, templatePart.name, templatePart.strings, this, options);
} else if (templatePart.type === ELEMENT_PART$2) {
part = new ElementPart$2(node, this, options);
}
this._$parts.push(part);
templatePart = parts[++partIndex];
}
if (nodeIndex !== (templatePart === null || templatePart === void 0 ? void 0 : templatePart.index)) {
node = walker$2.nextNode();
nodeIndex++;
}
}
walker$2.currentNode = d$2;
return fragment;
}
_update(values) {
var i = 0;
for (var part of this._$parts) {
if (part !== undefined) {
if (debugLogEvent$4 === null || debugLogEvent$4 === void 0) {
0;
undefined;
} else {
debugLogEvent$4({
kind: 'set part',
part,
value: values[i],
valueIndex: i,
values,
templateInstance: this
});
}
if (part.strings !== undefined) {
part._$setValue(values, part, i);
i += part.strings.length - 2;
} else {
part._$setValue(values[i]);
}
}
i++;
}
}
}
class ChildPart$2 {
constructor(startNode, endNode, parent, options) {
var _a;
this.type = CHILD_PART$2;
this._$committedValue = nothing$2;
this._$disconnectableChildren = undefined;
this._$startNode = startNode;
this._$endNode = endNode;
this._$parent = parent;
this.options = options;
if ((_a = options === null || options === void 0 ? void 0 : options.isConnected) !== null && _a !== void 0) {
this.__isConnected = _a;
} else {
this.__isConnected = true;
}
{
this._textSanitizer = undefined;
}
}
get _$isConnected() {
var _a, _b;
if ((_b = (_a = this._$parent) === null || _a === void 0 ? void 0 : _a._$isConnected) !== null && _b !== void 0) {
return _b;
} else {
return this.__isConnected;
}
}
get parentNode() {
var parentNode = wrap$2(this._$startNode).parentNode;
var parent = this._$parent;
if (parent !== undefined && (parentNode === null || parentNode === void 0 ? void 0 : parentNode.nodeType) === 11) {
parentNode = parent.parentNode;
}
return parentNode;
}
get startNode() {
return this._$startNode;
}
get endNode() {
return this._$endNode;
}
_$setValue(value) {
var directiveParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
var _a;
if (this.parentNode === null) {
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.");
}
value = resolveDirective$2(this, value, directiveParent);
if (isPrimitive$2(value)) {
if (value === nothing$2 || value == null || value === '') {
if (this._$committedValue !== nothing$2) {
if (debugLogEvent$4 === null || debugLogEvent$4 === void 0) {
0;
undefined;
} else {
debugLogEvent$4({
kind: 'commit nothing to child',
start: this._$startNode,
end: this._$endNode,
parent: this._$parent,
options: this.options
});
}
this._$clear();
}
this._$committedValue = nothing$2;
} else if (value !== this._$committedValue && value !== noChange$2) {
this._commitText(value);
}
} else if (value['_$litType$'] !== undefined) {
this._commitTemplateResult(value);
} else if (value.nodeType !== undefined) {
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.host) === value) {
this._commitText("[probable mistake: rendered a template's host in itself " + "(commonly caused by writing ${this} in a template]");
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.");
return;
}
this._commitNode(value);
} else if (isIterable$2(value)) {
this._commitIterable(value);
} else {
this._commitText(value);
}
}
_insert(node) {
return wrap$2(wrap$2(this._$startNode).parentNode).insertBefore(node, this._$endNode);
}
_commitNode(value) {
var _a;
if (this._$committedValue !== value) {
this._$clear();
if (sanitizerFactoryInternal$2 !== noopSanitizer$2) {
var parentNodeName = (_a = this._$startNode.parentNode) === null || _a === void 0 ? void 0 : _a.nodeName;
if (parentNodeName === 'STYLE' || parentNodeName === 'SCRIPT') {
var message = 'Forbidden';
{
if (parentNodeName === 'STYLE') {
message = "Lit does not support binding inside style nodes. " + "This is a security risk, as style injection attacks can " + "exfiltrate data and spoof UIs. " + "Consider instead using css`...` literals " + "to compose styles, and make do dynamic styling with " + "css custom properties, ::parts, <slot>s, " + "and by mutating the DOM rather than stylesheets.";
} else {
message = "Lit does not support binding inside script nodes. " + "This is a security risk, as it could allow arbitrary " + "code execution.";
}
}
throw new Error(message);
}
}
if (debugLogEvent$4 === null || debugLogEvent$4 === void 0) {
0;
undefined;
} else {
debugLogEvent$4({
kind: 'commit node',
start: this._$startNode,
parent: this._$parent,
value: value,
options: this.options
});
}
this._$committedValue = this._insert(value);
}
}
_commitText(value) {
if (this._$committedValue !== nothing$2 && isPrimitive$2(this._$committedValue)) {
var node = wrap$2(this._$startNode).nextSibling;
{
if (this._textSanitizer === undefined) {
this._textSanitizer = createSanitizer$2(node, 'data', 'property');
}
value = this._textSanitizer(value);
}
if (debugLogEvent$4 === null || debugLogEvent$4 === void 0) {
0;
undefined;
} else {
debugLogEvent$4({
kind: 'commit text',
node,
value,
options: this.options
});
}
node.data = value;
} else {
{
var textNode = d$2.createTextNode('');
this._commitNode(textNode);
if (this._textSanitizer === undefined) {
this._textSanitizer = createSanitizer$2(textNode, 'data', 'property');
}
value = this._textSanitizer(value);
if (debugLogEvent$4 === null || debugLogEvent$4 === void 0) {
0;
undefined;
} else {
debugLogEvent$4({
kind: 'commit text',
node: textNode,
value,
options: this.options
});
}
textNode.data = value;
}
}
this._$committedValue = value;
}
_commitTemplateResult(result) {
var _a;
var {
values,
['_$litType$']: type
} = result;
var template = typeof type === 'number' ? this._$getTemplate(result) : (type.el === undefined && (type.el = Template$2.createElement(trustFromTemplateString$2(type.h, type.h[0]), this.options)), type);
if (((_a = this._$committedValue) === null || _a === void 0 ? void 0 : _a._$template) === template) {
if (debugLogEvent$4 === null || debugLogEvent$4 === void 0) {
0;
undefined;
} else {
debugLogEvent$4({
kind: 'template updating',
template,
instance: this._$committedValue,
parts: this._$committedValue._$parts,
options: this.options,
values
});
}
this._$committedValue._update(values);
} else {
var instance = new TemplateInstance$2(template, this);
var fragment = instance._clone(this.options);
if (debugLogEvent$4 === null || debugLogEvent$4 === void 0) {
0;
undefined;
} else {
debugLogEvent$4({
kind: 'template instantiated',
template,
instance,
parts: instance._$parts,
options: this.options,
fragment,
values
});
}
instance._update(values);
if (debugLogEvent$4 === null || debugLogEvent$4 === void 0) {
0;
undefined;
} else {
debugLogEvent$4({
kind: 'template instantiated and updated',
template,
instance,
parts: instance._$parts,
options: this.options,
fragment,
values
});
}
this._commitNode(fragment);
this._$committedValue = instance;
}
}
_$getTemplate(result) {
var template = templateCache$2.get(result.strings);
if (template === undefined) {
templateCache$2.set(result.strings, template = new Template$2(result));
}
return template;
}
_commitIterable(value) {
if (!isArray$2(this._$committedValue)) {
this._$committedValue = [];
this._$clear();
}
var itemParts = this._$committedValue;
var partIndex = 0;
var itemPart;
for (var item of value) {
if (partIndex === itemParts.length) {
itemParts.push(itemPart = new ChildPart$2(this._insert(createMarker$2()), this._insert(createMarker$2()), this, this.options));
} else {
itemPart = itemParts[partIndex];
}
itemPart._$setValue(item);
partIndex++;
}
if (partIndex < itemParts.length) {
this._$clear(itemPart && wrap$2(itemPart._$endNode).nextSibling, partIndex);
itemParts.length = partIndex;
}
}
_$clear() {
var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : wrap$2(this._$startNode).nextSibling;
var from = arguments.length > 1 ? arguments[1] : undefined;
var _a;
if ((_a = this._$notifyConnectionChanged) === null || _a === void 0) {
0;
undefined;
} else {
_a.call(this, false, true, from);
}
while (start && start !== this._$endNode) {
var n = wrap$2(start).nextSibling;
wrap$2(start).remove();
start = n;
}
}
setConnected(isConnected) {
var _a;
if (this._$parent === undefined) {
this.__isConnected = isConnected;
if ((_a = this._$notifyConnectionChanged) === null || _a === void 0) {
0;
undefined;
} else {
_a.call(this, isConnected);
}
} else {
throw new Error('part.setConnected() may only be called on a ' + 'RootPart returned from render().');
}
}
}
class AttributePart$2 {
constructor(element, name, strings, parent, options) {
this.type = ATTRIBUTE_PART$2;
this._$committedValue = nothing$2;
this._$disconnectableChildren = undefined;
this.element = element;
this.name = name;
this._$parent = parent;
this.options = options;
if (strings.length > 2 || strings[0] !== '' || strings[1] !== '') {
this._$committedValue = new Array(strings.length - 1).fill(new String());
this.strings = strings;
} else {
this._$committedValue = nothing$2;
}
{
this._sanitizer = undefined;
}
}
get tagName() {
return this.element.tagName;
}
get _$isConnected() {
return this._$parent._$isConnected;
}
_$setValue(value) {
var directiveParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
var valueIndex = arguments.length > 2 ? arguments[2] : undefined;
var noCommit = arguments.length > 3 ? arguments[3] : undefined;
var strings = this.strings;
var change = false;
if (strings === undefined) {
value = resolveDirective$2(this, value, directiveParent, 0);
change = !isPrimitive$2(value) || value !== this._$committedValue && value !== noChange$2;
if (change) {
this._$committedValue = value;
}
} else {
var values = value;
value = strings[0];
var i, v;
for (i = 0; i < strings.length - 1; i++) {
v = resolveDirective$2(this, values[valueIndex + i], directiveParent, i);
if (v === noChange$2) {
v = this._$committedValue[i];
}
if (!change) {
change = !isPrimitive$2(v) || v !== this._$committedValue[i];
}
if (v === nothing$2) {
value = nothing$2;
} else if (value !== nothing$2) {
value += (v !== null && v !== void 0 ? v : '') + strings[i + 1];
}
this._$committedValue[i] = v;
}
}
if (change && !noCommit) {
this._commitValue(value);
}
}
_commitValue(value) {
if (value === nothing$2) {
wrap$2(this.element).removeAttribute(this.name);
} else {
{
if (this._sanitizer === undefined) {
this._sanitizer = sanitizerFactoryInternal$2(this.element, this.name, 'attribute');
}
value = this._sanitizer(value !== null && value !== void 0 ? value : '');
}
if (debugLogEvent$4 === null || debugLogEvent$4 === void 0) {
0;
undefined;
} else {
debugLogEvent$4({
kind: 'commit attribute',
element: this.element,
name: this.name,
value,
options: this.options
});
}
wrap$2(this.element).setAttribute(this.name, value !== null && value !== void 0 ? value : '');
}
}
}
class PropertyPart$2 extends AttributePart$2 {
constructor() {
super(...arguments);
this.type = PROPERTY_PART$2;
}
_commitValue(value) {
{
if (this._sanitizer === undefined) {
this._sanitizer = sanitizerFactoryInternal$2(this.element, this.name, 'property');
}
value = this._sanitizer(value);
}
if (debugLogEvent$4 === null || debugLogEvent$4 === void 0) {
0;
undefined;
} else {
debugLogEvent$4({
kind: 'commit property',
element: this.element,
name: this.name,
value,
options: this.options
});
}
if (value === nothing$2) {
this.element[this.name] = undefined;
} else {
this.element[this.name] = value;
}
}
}
var emptyStringForBooleanAttribute$4 = trustedTypes$4 ? trustedTypes$4.emptyScript : '';
class BooleanAttributePart$2 extends AttributePart$2 {
constructor() {
super(...arguments);
this.type = BOOLEAN_ATTRIBUTE_PART$2;
}
_commitValue(value) {
if (debugLogEvent$4 === null || debugLogEvent$4 === void 0) {
0;
undefined;
} else {
debugLogEvent$4({
kind: 'commit boolean attribute',
element: this.element,
name: this.name,
value: !!(value && value !== nothing$2),
options: this.options
});
}
if (value && value !== nothing$2) {
wrap$2(this.element).setAttribute(this.name, emptyStringForBooleanAttribute$4);
} else {
wrap$2(this.element).removeAttribute(this.name);
}
}
}
class EventPart$2 extends AttributePart$2 {
constructor(element, name, strings, parent, options) {
super(element, name, strings, parent, options);
this.type = EVENT_PART$2;
if (this.strings !== undefined) {
throw new Error("A `<".concat(element.localName, ">` has a `@").concat(name, "=...` listener with ") + 'invalid content. Event listeners in templates must have exactly ' + 'one expression and no surrounding text.');
}
}
_$setValue(newListener) {
var directiveParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
var _a;
if ((_a = resolveDirective$2(this, newListener, directiveParent, 0)) !== null && _a !== void 0) {
newListener = _a;
} else {
newListener = nothing$2;
}
if (newListener === noChange$2) {
return;
}
var oldListener = this._$committedValue;
var shouldRemoveListener = newListener === nothing$2 && oldListener !== nothing$2 || newListener.capture !== oldListener.capture || newListener.once !== oldListener.once || newListener.passive !== oldListener.passive;
var shouldAddListener = newListener !== nothing$2 && (oldListener === nothing$2 || shouldRemoveListener);
if (debugLogEvent$4 === null || debugLogEvent$4 === void 0) {
0;
undefined;
} else {
debugLogEvent$4({
kind: 'commit event listener',
element: this.element,
name: this.name,
value: newListener,
options: this.options,
removeListener: shouldRemoveListener,
addListener: shouldAddListener,
oldListener
});
}
if (shouldRemoveListener) {
this.element.removeEventListener(this.name, this, oldListener);
}
if (shouldAddListener) {
this.element.addEventListener(this.name, this, newListener);
}
this._$committedValue = newListener;
}
handleEvent(event) {
var _a, _b;
if (typeof this._$committedValue === 'function') {
this._$committedValue.call((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.host) !== null && _b !== void 0 ? _b : this.element, event);
} else {
this._$committedValue.handleEvent(event);
}
}
}
class ElementPart$2 {
constructor(element, parent, options) {
this.element = element;
this.type = ELEMENT_PART$2;
this._$disconnectableChildren = undefined;
this._$parent = parent;
this.options = options;
}
get _$isConnected() {
return this._$parent._$isConnected;
}
_$setValue(value) {
if (debugLogEvent$4 === null || debugLogEvent$4 === void 0) {
0;
undefined;
} else {
debugLogEvent$4({
kind: 'commit to element binding',
element: this.element,
value,
options: this.options
});
}
resolveDirective$2(this, value);
}
}
var polyfillSupport$7 = global$a.litHtmlPolyfillSupportDevMode;
if (polyfillSupport$7 === null || polyfillSupport$7 === void 0) {
0;
undefined;
} else {
polyfillSupport$7(Template$2, ChildPart$2);
}
((_d$4 = global$a.litHtmlVersions) !== null && _d$4 !== void 0 ? _d$4 : global$a.litHtmlVersions = []).push('2.8.0');
if (global$a.litHtmlVersions.length > 1) {
issueWarning$7('multiple-versions', "Multiple versions of Lit loaded. " + "Loading multiple versions is not recommended.");
}
var render$2 = (value, container, options) => {
var _a, _b;
if (container == null) {
throw new TypeError("The container to render into may not be ".concat(container));
}
var renderId = debugLogRenderId$2++;
var partOwnerNode = (_a = options === null || options === void 0 ? void 0 : options.renderBefore) !== null && _a !== void 0 ? _a : container;
var part = partOwnerNode['_$litPart$'];
if (debugLogEvent$4 === null || debugLogEvent$4 === void 0) {
0;
undefined;
} else {
debugLogEvent$4({
kind: 'begin render',
id: renderId,
value,
container,
options,
part
});
}
if (part === undefined) {
var endNode = (_b = options === null || options === void 0 ? void 0 : options.renderBefore) !== null && _b !== void 0 ? _b : null;
partOwnerNode['_$litPart$'] = part = new ChildPart$2(container.insertBefore(createMarker$2(), endNode), endNode, undefined, options !== null && options !== void 0 ? options : {});
}
part._$setValue(value);
if (debugLogEvent$4 === null || debugLogEvent$4 === void 0) {
0;
undefined;
} else {
debugLogEvent$4({
kind: 'end render',
id: renderId,
value,
container,
options,
part
});
}
return part;
};
{
render$2.setSanitizer = setSanitizer$2;
render$2.createSanitizer = createSanitizer$2;
{
render$2._testOnlyClearSanitizerFactoryDoNotCallOrElse = _testOnlyClearSanitizerFactoryDoNotCallOrElse$2;
}
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var _a$7, _b$6, _c$6;
var issueWarning$6;
{
var _issuedWarnings5 = (_a$7 = globalThis.litIssuedWarnings) !== null && _a$7 !== void 0 ? _a$7 : globalThis.litIssuedWarnings = new Set();
issueWarning$6 = (code, warning) => {
warning += " See https://lit.dev/msg/".concat(code, " for more information.");
if (!_issuedWarnings5.has(warning)) {
console.warn(warning);
_issuedWarnings5.add(warning);
}
};
}
class LitElement$2 extends ReactiveElement$2 {
constructor() {
super(...arguments);
this.renderOptions = {
host: this
};
this.__childPart = undefined;
}
createRenderRoot() {
var _a;
var _b;
var renderRoot = super.createRenderRoot();
if ((_a = (_b = this.renderOptions).renderBefore) !== null && _a !== void 0) {
_a;
} else {
_b.renderBefore = renderRoot.firstChild;
}
return renderRoot;
}
update(changedProperties) {
var value = this.render();
if (!this.hasUpdated) {
this.renderOptions.isConnected = this.isConnected;
}
super.update(changedProperties);
this.__childPart = render$2(value, this.renderRoot, this.renderOptions);
}
connectedCallback() {
var _a;
super.connectedCallback();
if ((_a = this.__childPart) === null || _a === void 0) {
0;
undefined;
} else {
_a.setConnected(true);
}
}
disconnectedCallback() {
var _a;
super.disconnectedCallback();
if ((_a = this.__childPart) === null || _a === void 0) {
0;
undefined;
} else {
_a.setConnected(false);
}
}
render() {
return noChange$2;
}
}
LitElement$2['finalized'] = true;
LitElement$2['_$litElement$'] = true;
if ((_b$6 = globalThis.litElementHydrateSupport) === null || _b$6 === void 0) {
0;
undefined;
} else {
_b$6.call(globalThis, {
LitElement: LitElement$2
});
}
var polyfillSupport$6 = globalThis.litElementPolyfillSupportDevMode;
if (polyfillSupport$6 === null || polyfillSupport$6 === void 0) {
0;
undefined;
} else {
polyfillSupport$6({
LitElement: LitElement$2
});
}
{
LitElement$2['finalize'] = function () {
var finalized = ReactiveElement$2.finalize.call(this);
if (!finalized) {
return false;
}
var warnRemovedOrRenamed = function warnRemovedOrRenamed(obj, name) {
var renamed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (obj.hasOwnProperty(name)) {
var ctorName = (typeof obj === 'function' ? obj : obj.constructor).name;
issueWarning$6(renamed ? 'renamed-api' : 'removed-api', "`".concat(name, "` is implemented on class ").concat(ctorName, ". It ") + "has been ".concat(renamed ? 'renamed' : 'removed', " ") + "in this version of LitElement.");
}
};
warnRemovedOrRenamed(this, 'render');
warnRemovedOrRenamed(this, 'getStyles', true);
warnRemovedOrRenamed(this.prototype, 'adoptStyles');
return true;
};
}
((_c$6 = globalThis.litElementVersions) !== null && _c$6 !== void 0 ? _c$6 : globalThis.litElementVersions = []).push('3.3.3');
if (globalThis.litElementVersions.length > 1) {
issueWarning$6('multiple-versions', "Multiple versions of Lit loaded. Loading multiple versions " + "is not recommended.");
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var standardProperty$2 = (options, element) => {
if (element.kind === 'method' && element.descriptor && !('value' in element.descriptor)) {
return _objectSpread(_objectSpread({}, element), {}, {
finisher(clazz) {
clazz.createProperty(element.key, options);
}
});
} else {
return {
kind: 'field',
key: Symbol(),
placement: 'own',
descriptor: {},
originalKey: element.key,
initializer() {
if (typeof element.initializer === 'function') {
this[element.key] = element.initializer.call(this);
}
},
finisher(clazz) {
clazz.createProperty(element.key, options);
}
};
}
};
var legacyProperty$2 = (options, proto, name) => {
proto.constructor.createProperty(name, options);
};
function property$2(options) {
return (protoOrDescriptor, name) => name !== undefined ? legacyProperty$2(options, protoOrDescriptor, name) : standardProperty$2(options, protoOrDescriptor);
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function state$2(options) {
return property$2(_objectSpread(_objectSpread({}, options), {}, {
state: true
}));
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var decorateProperty$2 = _ref11 => {
var {
finisher,
descriptor
} = _ref11;
return (protoOrDescriptor, name) => {
var _a;
if (name !== undefined) {
var ctor = protoOrDescriptor.constructor;
if (descriptor !== undefined) {
Object.defineProperty(protoOrDescriptor, name, descriptor(name));
}
if (finisher === null || finisher === void 0) {
0;
undefined;
} else {
finisher(ctor, name);
}
} else {
var key = (_a = protoOrDescriptor.originalKey) !== null && _a !== void 0 ? _a : protoOrDescriptor.key;
var info = descriptor != undefined ? {
kind: 'method',
placement: 'prototype',
key,
descriptor: descriptor(protoOrDescriptor.key)
} : _objectSpread(_objectSpread({}, protoOrDescriptor), {}, {
key
});
if (finisher != undefined) {
info.finisher = function (ctor) {
finisher(ctor, key);
};
}
return info;
}
};
};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function query$2(selector, cache) {
return decorateProperty$2({
descriptor: name => {
var descriptor = {
get() {
var _a, _b;
if ((_b = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(selector)) !== null && _b !== void 0) {
return _b;
} else {
return null;
}
},
enumerable: true,
configurable: true
};
if (cache) {
var key = typeof name === 'symbol' ? Symbol() : "__".concat(name);
descriptor.get = function () {
var _a, _b;
if (this[key] === undefined) {
if ((_b = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(selector)) !== null && _b !== void 0) {
this[key] = _b;
} else {
this[key] = null;
}
}
return this[key];
};
}
return descriptor;
}
});
}
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var _a$6;
var global$9 = window;
if (((_a$6 = global$9.HTMLSlotElement) === null || _a$6 === void 0 ? void 0 : _a$6.prototype.assignedElements) != null) {
(slot, opts) => slot.assignedElements(opts);
} else {
(slot, opts) => slot.assignedNodes(opts).filter(node => node.nodeType === Node.ELEMENT_NODE);
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var PartType$2 = {
ATTRIBUTE: 1,
CHILD: 2,
PROPERTY: 3,
BOOLEAN_ATTRIBUTE: 4,
EVENT: 5,
ELEMENT: 6
};
var directive$2 = c => function () {
for (var _len6 = arguments.length, values = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
values[_key6] = arguments[_key6];
}
return {
['_$litDirective$']: c,
values
};
};
class Directive$2 {
constructor(_partInfo) {}
get _$isConnected() {
return this._$parent._$isConnected;
}
_$initialize(part, parent, attributeIndex) {
this.__part = part;
this._$parent = parent;
this.__attributeIndex = attributeIndex;
}
_$resolve(part, props) {
return this.update(part, props);
}
update(_part, props) {
return this.render(...props);
}
}
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
class ClassMapDirective$2 extends Directive$2 {
constructor(partInfo) {
var _a;
super(partInfo);
if (partInfo.type !== PartType$2.ATTRIBUTE || partInfo.name !== 'class' || ((_a = partInfo.strings) === null || _a === void 0 ? void 0 : _a.length) > 2) {
throw new Error('`classMap()` can only be used in the `class` attribute ' + 'and must be the only part in the attribute.');
}
}
render(classInfo) {
return ' ' + Object.keys(classInfo).filter(key => classInfo[key]).join(' ') + ' ';
}
update(part, _ref12) {
var [classInfo] = _ref12;
var _a, _b;
if (this._previousClasses === undefined) {
this._previousClasses = new Set();
if (part.strings !== undefined) {
this._staticClasses = new Set(part.strings.join(' ').split(/\s/).filter(s => s !== ''));
}
for (var name in classInfo) {
if (classInfo[name] && !((_a = this._staticClasses) === null || _a === void 0 ? void 0 : _a.has(name))) {
this._previousClasses.add(name);
}
}
return this.render(classInfo);
}
var classList = part.element.classList;
this._previousClasses.forEach(name => {
if (!(name in classInfo)) {
classList.remove(name);
this._previousClasses.delete(name);
}
});
for (var _name7 in classInfo) {
var value = !!classInfo[_name7];
if (value !== this._previousClasses.has(_name7) && !((_b = this._staticClasses) === null || _b === void 0 ? void 0 : _b.has(_name7))) {
if (value) {
classList.add(_name7);
this._previousClasses.add(_name7);
} else {
classList.remove(_name7);
this._previousClasses.delete(_name7);
}
}
}
return noChange$2;
}
}
var classMap$2 = directive$2(ClassMapDirective$2);
/**
* @license
* Copyright 2020 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var KEY = {
UNKNOWN: 'Unknown',
BACKSPACE: 'Backspace',
ENTER: 'Enter',
SPACEBAR: 'Spacebar',
PAGE_UP: 'PageUp',
PAGE_DOWN: 'PageDown',
END: 'End',
HOME: 'Home',
ARROW_LEFT: 'ArrowLeft',
ARROW_UP: 'ArrowUp',
ARROW_RIGHT: 'ArrowRight',
ARROW_DOWN: 'ArrowDown',
DELETE: 'Delete',
ESCAPE: 'Escape',
TAB: 'Tab'
};
var normalizedKeys = new Set();
normalizedKeys.add(KEY.BACKSPACE);
normalizedKeys.add(KEY.ENTER);
normalizedKeys.add(KEY.SPACEBAR);
normalizedKeys.add(KEY.PAGE_UP);
normalizedKeys.add(KEY.PAGE_DOWN);
normalizedKeys.add(KEY.END);
normalizedKeys.add(KEY.HOME);
normalizedKeys.add(KEY.ARROW_LEFT);
normalizedKeys.add(KEY.ARROW_UP);
normalizedKeys.add(KEY.ARROW_RIGHT);
normalizedKeys.add(KEY.ARROW_DOWN);
normalizedKeys.add(KEY.DELETE);
normalizedKeys.add(KEY.ESCAPE);
normalizedKeys.add(KEY.TAB);
var KEY_CODE = {
BACKSPACE: 8,
ENTER: 13,
SPACEBAR: 32,
PAGE_UP: 33,
PAGE_DOWN: 34,
END: 35,
HOME: 36,
ARROW_LEFT: 37,
ARROW_UP: 38,
ARROW_RIGHT: 39,
ARROW_DOWN: 40,
DELETE: 46,
ESCAPE: 27,
TAB: 9
};
var mappedKeyCodes = new Map();
mappedKeyCodes.set(KEY_CODE.BACKSPACE, KEY.BACKSPACE);
mappedKeyCodes.set(KEY_CODE.ENTER, KEY.ENTER);
mappedKeyCodes.set(KEY_CODE.SPACEBAR, KEY.SPACEBAR);
mappedKeyCodes.set(KEY_CODE.PAGE_UP, KEY.PAGE_UP);
mappedKeyCodes.set(KEY_CODE.PAGE_DOWN, KEY.PAGE_DOWN);
mappedKeyCodes.set(KEY_CODE.END, KEY.END);
mappedKeyCodes.set(KEY_CODE.HOME, KEY.HOME);
mappedKeyCodes.set(KEY_CODE.ARROW_LEFT, KEY.ARROW_LEFT);
mappedKeyCodes.set(KEY_CODE.ARROW_UP, KEY.ARROW_UP);
mappedKeyCodes.set(KEY_CODE.ARROW_RIGHT, KEY.ARROW_RIGHT);
mappedKeyCodes.set(KEY_CODE.ARROW_DOWN, KEY.ARROW_DOWN);
mappedKeyCodes.set(KEY_CODE.DELETE, KEY.DELETE);
mappedKeyCodes.set(KEY_CODE.ESCAPE, KEY.ESCAPE);
mappedKeyCodes.set(KEY_CODE.TAB, KEY.TAB);
var navigationKeys = new Set();
navigationKeys.add(KEY.PAGE_UP);
navigationKeys.add(KEY.PAGE_DOWN);
navigationKeys.add(KEY.END);
navigationKeys.add(KEY.HOME);
navigationKeys.add(KEY.ARROW_LEFT);
navigationKeys.add(KEY.ARROW_UP);
navigationKeys.add(KEY.ARROW_RIGHT);
navigationKeys.add(KEY.ARROW_DOWN);
function normalizeKey(evt) {
var key = evt.key;
if (normalizedKeys.has(key)) {
return key;
}
var mappedKey = mappedKeyCodes.get(evt.keyCode);
if (mappedKey) {
return mappedKey;
}
return KEY.UNKNOWN;
}
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
var integerSort = (a, b) => {
return a - b;
};
var findIndexDiff = (oldSet, newSet) => {
var oldArr = Array.from(oldSet);
var newArr = Array.from(newSet);
var diff = {
added: [],
removed: []
};
var oldSorted = oldArr.sort(integerSort);
var newSorted = newArr.sort(integerSort);
var i = 0;
var j = 0;
while (i < oldSorted.length || j < newSorted.length) {
var oldVal = oldSorted[i];
var newVal = newSorted[j];
if (oldVal === newVal) {
i++;
j++;
continue;
}
if (oldVal !== undefined && (newVal === undefined || oldVal < newVal)) {
diff.removed.push(oldVal);
i++;
continue;
}
if (newVal !== undefined && (oldVal === undefined || newVal < oldVal)) {
diff.added.push(newVal);
j++;
continue;
}
}
return diff;
};
var ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select'];
function isIndexSet(selectedIndex) {
return selectedIndex instanceof Set;
}
var createSetFromIndex = index => {
var entry = index === numbers$2.UNSET_INDEX ? new Set() : index;
if (isIndexSet(entry)) {
return new Set(entry);
} else {
return new Set([entry]);
}
};
class MDCListFoundation extends MDCFoundation {
constructor(adapter) {
super(Object.assign(Object.assign({}, MDCListFoundation.defaultAdapter), adapter));
this.isMulti_ = false;
this.wrapFocus_ = false;
this.isVertical_ = true;
this.selectedIndex_ = numbers$2.UNSET_INDEX;
this.focusedItemIndex_ = numbers$2.UNSET_INDEX;
this.useActivatedClass_ = false;
this.ariaCurrentAttrValue_ = null;
}
static get strings() {
return strings$2;
}
static get numbers() {
return numbers$2;
}
static get defaultAdapter() {
return {
focusItemAtIndex: () => undefined,
getFocusedElementIndex: () => 0,
getListItemCount: () => 0,
isFocusInsideList: () => false,
isRootFocused: () => false,
notifyAction: () => undefined,
notifySelected: () => undefined,
getSelectedStateForElementIndex: () => false,
setDisabledStateForElementIndex: () => undefined,
getDisabledStateForElementIndex: () => false,
setSelectedStateForElementIndex: () => undefined,
setActivatedStateForElementIndex: () => undefined,
setTabIndexForElementIndex: () => undefined,
setAttributeForElementIndex: () => undefined,
getAttributeForElementIndex: () => null
};
}
setWrapFocus(value) {
this.wrapFocus_ = value;
}
setMulti(value) {
this.isMulti_ = value;
var currentIndex = this.selectedIndex_;
if (value) {
if (!isIndexSet(currentIndex)) {
var isUnset = currentIndex === numbers$2.UNSET_INDEX;
if (isUnset) {
this.selectedIndex_ = new Set();
} else {
this.selectedIndex_ = new Set([currentIndex]);
}
}
} else {
if (isIndexSet(currentIndex)) {
if (currentIndex.size) {
var vals = Array.from(currentIndex).sort(integerSort);
this.selectedIndex_ = vals[0];
} else {
this.selectedIndex_ = numbers$2.UNSET_INDEX;
}
}
}
}
setVerticalOrientation(value) {
this.isVertical_ = value;
}
setUseActivatedClass(useActivated) {
this.useActivatedClass_ = useActivated;
}
getSelectedIndex() {
return this.selectedIndex_;
}
setSelectedIndex(index) {
if (!this.isIndexValid_(index)) {
return;
}
if (this.isMulti_) {
this.setMultiSelectionAtIndex_(createSetFromIndex(index));
} else {
this.setSingleSelectionAtIndex_(index);
}
}
handleFocusIn(_, listItemIndex) {
if (listItemIndex >= 0) {
this.adapter.setTabIndexForElementIndex(listItemIndex, 0);
}
}
handleFocusOut(_, listItemIndex) {
if (listItemIndex >= 0) {
this.adapter.setTabIndexForElementIndex(listItemIndex, -1);
}
setTimeout(() => {
if (!this.adapter.isFocusInsideList()) {
this.setTabindexToFirstSelectedItem_();
}
}, 0);
}
handleKeydown(event, isRootListItem, listItemIndex) {
var isArrowLeft = normalizeKey(event) === 'ArrowLeft';
var isArrowUp = normalizeKey(event) === 'ArrowUp';
var isArrowRight = normalizeKey(event) === 'ArrowRight';
var isArrowDown = normalizeKey(event) === 'ArrowDown';
var isHome = normalizeKey(event) === 'Home';
var isEnd = normalizeKey(event) === 'End';
var isEnter = normalizeKey(event) === 'Enter';
var isSpace = normalizeKey(event) === 'Spacebar';
if (this.adapter.isRootFocused()) {
if (isArrowUp || isEnd) {
event.preventDefault();
this.focusLastElement();
} else if (isArrowDown || isHome) {
event.preventDefault();
this.focusFirstElement();
}
return;
}
var currentIndex = this.adapter.getFocusedElementIndex();
if (currentIndex === -1) {
currentIndex = listItemIndex;
if (currentIndex < 0) {
return;
}
}
var nextIndex;
if (this.isVertical_ && isArrowDown || !this.isVertical_ && isArrowRight) {
this.preventDefaultEvent(event);
nextIndex = this.focusNextElement(currentIndex);
} else if (this.isVertical_ && isArrowUp || !this.isVertical_ && isArrowLeft) {
this.preventDefaultEvent(event);
nextIndex = this.focusPrevElement(currentIndex);
} else if (isHome) {
this.preventDefaultEvent(event);
nextIndex = this.focusFirstElement();
} else if (isEnd) {
this.preventDefaultEvent(event);
nextIndex = this.focusLastElement();
} else if (isEnter || isSpace) {
if (isRootListItem) {
var target = event.target;
if (target && target.tagName === 'A' && isEnter) {
return;
}
this.preventDefaultEvent(event);
this.setSelectedIndexOnAction_(currentIndex, true);
}
}
this.focusedItemIndex_ = currentIndex;
if (nextIndex !== undefined) {
this.setTabindexAtIndex_(nextIndex);
this.focusedItemIndex_ = nextIndex;
}
}
handleSingleSelection(index, isInteraction, force) {
if (index === numbers$2.UNSET_INDEX) {
return;
}
this.setSelectedIndexOnAction_(index, isInteraction, force);
this.setTabindexAtIndex_(index);
this.focusedItemIndex_ = index;
}
focusNextElement(index) {
var count = this.adapter.getListItemCount();
var nextIndex = index + 1;
if (nextIndex >= count) {
if (this.wrapFocus_) {
nextIndex = 0;
} else {
return index;
}
}
this.adapter.focusItemAtIndex(nextIndex);
return nextIndex;
}
focusPrevElement(index) {
var prevIndex = index - 1;
if (prevIndex < 0) {
if (this.wrapFocus_) {
prevIndex = this.adapter.getListItemCount() - 1;
} else {
return index;
}
}
this.adapter.focusItemAtIndex(prevIndex);
return prevIndex;
}
focusFirstElement() {
this.adapter.focusItemAtIndex(0);
return 0;
}
focusLastElement() {
var lastIndex = this.adapter.getListItemCount() - 1;
this.adapter.focusItemAtIndex(lastIndex);
return lastIndex;
}
setEnabled(itemIndex, isEnabled) {
if (!this.isIndexValid_(itemIndex)) {
return;
}
this.adapter.setDisabledStateForElementIndex(itemIndex, !isEnabled);
}
preventDefaultEvent(evt) {
var target = evt.target;
var tagName = "".concat(target.tagName).toLowerCase();
if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) {
evt.preventDefault();
}
}
setSingleSelectionAtIndex_(index) {
var isInteraction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
if (this.selectedIndex_ === index) {
return;
}
if (this.selectedIndex_ !== numbers$2.UNSET_INDEX) {
this.adapter.setSelectedStateForElementIndex(this.selectedIndex_, false);
if (this.useActivatedClass_) {
this.adapter.setActivatedStateForElementIndex(this.selectedIndex_, false);
}
}
if (isInteraction) {
this.adapter.setSelectedStateForElementIndex(index, true);
}
if (this.useActivatedClass_) {
this.adapter.setActivatedStateForElementIndex(index, true);
}
this.setAriaForSingleSelectionAtIndex_(index);
this.selectedIndex_ = index;
this.adapter.notifySelected(index);
}
setMultiSelectionAtIndex_(newIndex) {
var isInteraction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var oldIndex = createSetFromIndex(this.selectedIndex_);
var diff = findIndexDiff(oldIndex, newIndex);
if (!diff.removed.length && !diff.added.length) {
return;
}
for (var removed of diff.removed) {
if (isInteraction) {
this.adapter.setSelectedStateForElementIndex(removed, false);
}
if (this.useActivatedClass_) {
this.adapter.setActivatedStateForElementIndex(removed, false);
}
}
for (var added of diff.added) {
if (isInteraction) {
this.adapter.setSelectedStateForElementIndex(added, true);
}
if (this.useActivatedClass_) {
this.adapter.setActivatedStateForElementIndex(added, true);
}
}
this.selectedIndex_ = newIndex;
this.adapter.notifySelected(newIndex, diff);
}
setAriaForSingleSelectionAtIndex_(index) {
if (this.selectedIndex_ === numbers$2.UNSET_INDEX) {
this.ariaCurrentAttrValue_ = this.adapter.getAttributeForElementIndex(index, strings$2.ARIA_CURRENT);
}
var isAriaCurrent = this.ariaCurrentAttrValue_ !== null;
var ariaAttribute = isAriaCurrent ? strings$2.ARIA_CURRENT : strings$2.ARIA_SELECTED;
if (this.selectedIndex_ !== numbers$2.UNSET_INDEX) {
this.adapter.setAttributeForElementIndex(this.selectedIndex_, ariaAttribute, 'false');
}
var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue_ : 'true';
this.adapter.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue);
}
setTabindexAtIndex_(index) {
if (this.focusedItemIndex_ === numbers$2.UNSET_INDEX && index !== 0) {
this.adapter.setTabIndexForElementIndex(0, -1);
} else if (this.focusedItemIndex_ >= 0 && this.focusedItemIndex_ !== index) {
this.adapter.setTabIndexForElementIndex(this.focusedItemIndex_, -1);
}
this.adapter.setTabIndexForElementIndex(index, 0);
}
setTabindexToFirstSelectedItem_() {
var targetIndex = 0;
if (typeof this.selectedIndex_ === 'number' && this.selectedIndex_ !== numbers$2.UNSET_INDEX) {
targetIndex = this.selectedIndex_;
} else if (isIndexSet(this.selectedIndex_) && this.selectedIndex_.size > 0) {
targetIndex = Math.min(...this.selectedIndex_);
}
this.setTabindexAtIndex_(targetIndex);
}
isIndexValid_(index) {
if (index instanceof Set) {
if (!this.isMulti_) {
throw new Error('MDCListFoundation: Array of index is only supported for checkbox based list');
}
if (index.size === 0) {
return true;
} else {
var isOneInRange = false;
for (var entry of index) {
isOneInRange = this.isIndexInRange_(entry);
if (isOneInRange) {
break;
}
}
return isOneInRange;
}
} else if (typeof index === 'number') {
if (this.isMulti_) {
throw new Error('MDCListFoundation: Expected array of index for checkbox based list but got number: ' + index);
}
return index === numbers$2.UNSET_INDEX || this.isIndexInRange_(index);
} else {
return false;
}
}
isIndexInRange_(index) {
var listSize = this.adapter.getListItemCount();
return index >= 0 && index < listSize;
}
setSelectedIndexOnAction_(index, isInteraction, force) {
if (this.adapter.getDisabledStateForElementIndex(index)) {
return;
}
var checkedIndex = index;
if (this.isMulti_) {
checkedIndex = new Set([index]);
}
if (!this.isIndexValid_(checkedIndex)) {
return;
}
if (this.isMulti_) {
this.toggleMultiAtIndex(index, force, isInteraction);
} else {
if (isInteraction || force) {
this.setSingleSelectionAtIndex_(index, isInteraction);
} else {
var isDeselection = this.selectedIndex_ === index;
if (isDeselection) {
this.setSingleSelectionAtIndex_(numbers$2.UNSET_INDEX);
}
}
}
if (isInteraction) {
this.adapter.notifyAction(index);
}
}
toggleMultiAtIndex(index, force) {
var isInteraction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
var newSelectionValue = false;
if (force === undefined) {
newSelectionValue = !this.adapter.getSelectedStateForElementIndex(index);
} else {
newSelectionValue = force;
}
var newSet = createSetFromIndex(this.selectedIndex_);
if (newSelectionValue) {
newSet.add(index);
} else {
newSet.delete(index);
}
this.setMultiSelectionAtIndex_(newSet, isInteraction);
}
}
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
class MenuBase extends BaseElement {
constructor() {
super(...arguments);
this.mdcFoundationClass = MDCMenuFoundation$1;
this.listElement_ = null;
this.anchor = null;
this.open = false;
this.quick = false;
this.wrapFocus = false;
this.innerRole = 'menu';
this.innerAriaLabel = null;
this.corner = 'TOP_START';
this.x = null;
this.y = null;
this.absolute = false;
this.multi = false;
this.activatable = false;
this.fixed = false;
this.forceGroupSelection = false;
this.fullwidth = false;
this.menuCorner = 'START';
this.stayOpenOnBodyClick = false;
this.defaultFocus = 'LIST_ROOT';
this._listUpdateComplete = null;
}
get listElement() {
if (!this.listElement_) {
this.listElement_ = this.renderRoot.querySelector('mwc-list');
return this.listElement_;
}
return this.listElement_;
}
get items() {
var listElement = this.listElement;
if (listElement) {
return listElement.items;
}
return [];
}
get index() {
var listElement = this.listElement;
if (listElement) {
return listElement.index;
}
return -1;
}
get selected() {
var listElement = this.listElement;
if (listElement) {
return listElement.selected;
}
return null;
}
render() {
return this.renderSurface();
}
renderSurface() {
var classes = this.getSurfaceClasses();
return html$2(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n <mwc-menu-surface\n ?hidden=", "\n .anchor=", "\n .open=", "\n .quick=", "\n .corner=", "\n .x=", "\n .y=", "\n .absolute=", "\n .fixed=", "\n .fullwidth=", "\n .menuCorner=", "\n ?stayOpenOnBodyClick=", "\n class=", "\n @closed=", "\n @opened=", "\n @keydown=", ">\n ", "\n </mwc-menu-surface>"])), !this.open, this.anchor, this.open, this.quick, this.corner, this.x, this.y, this.absolute, this.fixed, this.fullwidth, this.menuCorner, this.stayOpenOnBodyClick, classMap$2(classes), this.onClosed, this.onOpened, this.onKeydown, this.renderList());
}
getSurfaceClasses() {
return {
'mdc-menu': true,
'mdc-menu-surface': true
};
}
renderList() {
var itemRoles = this.innerRole === 'menu' ? 'menuitem' : 'option';
var classes = this.renderListClasses();
return html$2(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n <mwc-list\n rootTabbable\n .innerAriaLabel=", "\n .innerRole=", "\n .multi=", "\n class=", "\n .itemRoles=", "\n .wrapFocus=", "\n .activatable=", "\n @action=", ">\n <slot></slot>\n </mwc-list>"])), this.innerAriaLabel, this.innerRole, this.multi, classMap$2(classes), itemRoles, this.wrapFocus, this.activatable, this.onAction);
}
renderListClasses() {
return {
'mdc-deprecated-list': true
};
}
createAdapter() {
return {
addClassToElementAtIndex: (index, className) => {
var listElement = this.listElement;
if (!listElement) {
return;
}
var element = listElement.items[index];
if (!element) {
return;
}
if (className === 'mdc-menu-item--selected') {
if (this.forceGroupSelection && !element.selected) {
listElement.toggle(index, true);
}
} else {
element.classList.add(className);
}
},
removeClassFromElementAtIndex: (index, className) => {
var listElement = this.listElement;
if (!listElement) {
return;
}
var element = listElement.items[index];
if (!element) {
return;
}
if (className === 'mdc-menu-item--selected') {
if (element.selected) {
listElement.toggle(index, false);
}
} else {
element.classList.remove(className);
}
},
addAttributeToElementAtIndex: (index, attr, value) => {
var listElement = this.listElement;
if (!listElement) {
return;
}
var element = listElement.items[index];
if (!element) {
return;
}
element.setAttribute(attr, value);
},
removeAttributeFromElementAtIndex: (index, attr) => {
var listElement = this.listElement;
if (!listElement) {
return;
}
var element = listElement.items[index];
if (!element) {
return;
}
element.removeAttribute(attr);
},
getAttributeFromElementAtIndex: (index, attr) => {
var listElement = this.listElement;
if (!listElement) {
return null;
}
var element = listElement.items[index];
if (!element) {
return null;
}
return element.getAttribute(attr);
},
elementContainsClass: (element, className) => element.classList.contains(className),
closeSurface: () => {
this.open = false;
},
getElementIndex: element => {
var listElement = this.listElement;
if (listElement) {
return listElement.items.indexOf(element);
}
return -1;
},
notifySelected: () => {},
getMenuItemCount: () => {
var listElement = this.listElement;
if (!listElement) {
return 0;
}
return listElement.items.length;
},
focusItemAtIndex: index => {
var listElement = this.listElement;
if (!listElement) {
return;
}
var element = listElement.items[index];
if (element) {
element.focus();
}
},
focusListRoot: () => {
if (this.listElement) {
this.listElement.focus();
}
},
getSelectedSiblingOfItemAtIndex: index => {
var listElement = this.listElement;
if (!listElement) {
return -1;
}
var elementAtIndex = listElement.items[index];
if (!elementAtIndex || !elementAtIndex.group) {
return -1;
}
for (var i = 0; i < listElement.items.length; i++) {
if (i === index) {
continue;
}
var current = listElement.items[i];
if (current.selected && current.group === elementAtIndex.group) {
return i;
}
}
return -1;
},
isSelectableItemAtIndex: index => {
var listElement = this.listElement;
if (!listElement) {
return false;
}
var elementAtIndex = listElement.items[index];
if (!elementAtIndex) {
return false;
}
return elementAtIndex.hasAttribute('group');
}
};
}
onKeydown(evt) {
if (this.mdcFoundation) {
this.mdcFoundation.handleKeydown(evt);
}
}
onAction(evt) {
var listElement = this.listElement;
if (this.mdcFoundation && listElement) {
var _index = evt.detail.index;
var el = listElement.items[_index];
if (el) {
this.mdcFoundation.handleItemAction(el);
}
}
}
onOpened() {
this.open = true;
if (this.mdcFoundation) {
this.mdcFoundation.handleMenuSurfaceOpened();
}
}
onClosed() {
this.open = false;
}
getUpdateComplete() {
var _superprop_getGetUpdateComplete = () => super.getUpdateComplete;
var _this7 = this;
return _asyncToGenerator(function* () {
yield _this7._listUpdateComplete;
var result = yield _superprop_getGetUpdateComplete().call(_this7);
return result;
})();
}
firstUpdated() {
var _superprop_getFirstUpdated = () => super.firstUpdated;
var _this8 = this;
return _asyncToGenerator(function* () {
_superprop_getFirstUpdated().call(_this8);
var listElement = _this8.listElement;
if (listElement) {
_this8._listUpdateComplete = listElement.updateComplete;
yield _this8._listUpdateComplete;
}
})();
}
select(index) {
var listElement = this.listElement;
if (listElement) {
listElement.select(index);
}
}
close() {
this.open = false;
}
show() {
this.open = true;
}
getFocusedItemIndex() {
var listElement = this.listElement;
if (listElement) {
return listElement.getFocusedItemIndex();
}
return -1;
}
focusItemAtIndex(index) {
var listElement = this.listElement;
if (listElement) {
listElement.focusItemAtIndex(index);
}
}
layout() {
var updateItems = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
var listElement = this.listElement;
if (listElement) {
listElement.layout(updateItems);
}
}
}
__decorate([query$2('.mdc-menu')], MenuBase.prototype, "mdcRoot", void 0);
__decorate([query$2('slot')], MenuBase.prototype, "slotElement", void 0);
__decorate([property$2({
type: Object
})], MenuBase.prototype, "anchor", void 0);
__decorate([property$2({
type: Boolean,
reflect: true
})], MenuBase.prototype, "open", void 0);
__decorate([property$2({
type: Boolean
})], MenuBase.prototype, "quick", void 0);
__decorate([property$2({
type: Boolean
})], MenuBase.prototype, "wrapFocus", void 0);
__decorate([property$2({
type: String
})], MenuBase.prototype, "innerRole", void 0);
__decorate([property$2({
type: String
})], MenuBase.prototype, "innerAriaLabel", void 0);
__decorate([property$2({
type: String
})], MenuBase.prototype, "corner", void 0);
__decorate([property$2({
type: Number
})], MenuBase.prototype, "x", void 0);
__decorate([property$2({
type: Number
})], MenuBase.prototype, "y", void 0);
__decorate([property$2({
type: Boolean
})], MenuBase.prototype, "absolute", void 0);
__decorate([property$2({
type: Boolean
})], MenuBase.prototype, "multi", void 0);
__decorate([property$2({
type: Boolean
})], MenuBase.prototype, "activatable", void 0);
__decorate([property$2({
type: Boolean
})], MenuBase.prototype, "fixed", void 0);
__decorate([property$2({
type: Boolean
})], MenuBase.prototype, "forceGroupSelection", void 0);
__decorate([property$2({
type: Boolean
})], MenuBase.prototype, "fullwidth", void 0);
__decorate([property$2({
type: String
})], MenuBase.prototype, "menuCorner", void 0);
__decorate([property$2({
type: Boolean
})], MenuBase.prototype, "stayOpenOnBodyClick", void 0);
__decorate([property$2({
type: String
}), observer(function (value) {
if (this.mdcFoundation) {
this.mdcFoundation.setDefaultFocusState(DefaultFocusState[value]);
}
})], MenuBase.prototype, "defaultFocus", void 0);
/**
* @license
* Copyright 2021 Google LLC
* SPDX-LIcense-Identifier: Apache-2.0
*/
var styles$4 = css$2(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["mwc-list ::slotted([mwc-list-item]:not([twoline])),mwc-list ::slotted([noninteractive]:not([twoline])){height:var(--mdc-menu-item-height, 48px)}"])));
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var important$1 = 'important';
var importantFlag$1 = ' !' + important$1;
var flagTrim$1 = 0 - importantFlag$1.length;
class StyleMapDirective$1 extends Directive$2 {
constructor(partInfo) {
var _a;
super(partInfo);
if (partInfo.type !== PartType$2.ATTRIBUTE || partInfo.name !== 'style' || ((_a = partInfo.strings) === null || _a === void 0 ? void 0 : _a.length) > 2) {
throw new Error('The `styleMap` directive must be used in the `style` attribute ' + 'and must be the only part in the attribute.');
}
}
render(styleInfo) {
return Object.keys(styleInfo).reduce((style, prop) => {
var value = styleInfo[prop];
if (value == null) {
return style;
}
if (prop.includes('-')) {
prop = prop;
} else {
prop = prop.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, '-$&').toLowerCase();
}
return style + "".concat(prop, ":").concat(value, ";");
}, '');
}
update(part, _ref13) {
var [styleInfo] = _ref13;
var {
style
} = part.element;
if (this._previousStyleProperties === undefined) {
this._previousStyleProperties = new Set();
for (var name in styleInfo) {
this._previousStyleProperties.add(name);
}
return this.render(styleInfo);
}
this._previousStyleProperties.forEach(name => {
if (styleInfo[name] == null) {
this._previousStyleProperties.delete(name);
if (name.includes('-')) {
style.removeProperty(name);
} else {
style[name] = '';
}
}
});
for (var _name8 in styleInfo) {
var value = styleInfo[_name8];
if (value != null) {
this._previousStyleProperties.add(_name8);
var isImportant = typeof value === 'string' && value.endsWith(importantFlag$1);
if (_name8.includes('-') || isImportant) {
style.setProperty(_name8, isImportant ? value.slice(0, flagTrim$1) : value, isImportant ? important$1 : '');
} else {
style[_name8] = value;
}
}
}
return noChange$2;
}
}
var styleMap$1 = directive$2(StyleMapDirective$1);
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
var stringToCorner = {
'TOP_LEFT': Corner.TOP_LEFT,
'TOP_RIGHT': Corner.TOP_RIGHT,
'BOTTOM_LEFT': Corner.BOTTOM_LEFT,
'BOTTOM_RIGHT': Corner.BOTTOM_RIGHT,
'TOP_START': Corner.TOP_START,
'TOP_END': Corner.TOP_END,
'BOTTOM_START': Corner.BOTTOM_START,
'BOTTOM_END': Corner.BOTTOM_END
};
class MenuSurfaceBase extends BaseElement {
constructor() {
super(...arguments);
this.mdcFoundationClass = MDCMenuSurfaceFoundation$1;
this.absolute = false;
this.fullwidth = false;
this.fixed = false;
this.x = null;
this.y = null;
this.quick = false;
this.open = false;
this.stayOpenOnBodyClick = false;
this.bitwiseCorner = Corner.TOP_START;
this.previousMenuCorner = null;
this.menuCorner = 'START';
this.corner = 'TOP_START';
this.styleTop = '';
this.styleLeft = '';
this.styleRight = '';
this.styleBottom = '';
this.styleMaxHeight = '';
this.styleTransformOrigin = '';
this.anchor = null;
this.previouslyFocused = null;
this.previousAnchor = null;
this.onBodyClickBound = () => undefined;
}
render() {
return this.renderSurface();
}
renderSurface() {
var classes = this.getRootClasses();
var styles = this.getRootStyles();
return html$2(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n <div\n class=", "\n style=\"", "\"\n @keydown=", "\n @opened=", "\n @closed=", ">\n ", "\n </div>"])), classMap$2(classes), styleMap$1(styles), this.onKeydown, this.registerBodyClick, this.deregisterBodyClick, this.renderContent());
}
getRootClasses() {
return {
'mdc-menu-surface': true,
'mdc-menu-surface--fixed': this.fixed,
'mdc-menu-surface--fullwidth': this.fullwidth
};
}
getRootStyles() {
return {
'top': this.styleTop,
'left': this.styleLeft,
'right': this.styleRight,
'bottom': this.styleBottom,
'max-height': this.styleMaxHeight,
'transform-origin': this.styleTransformOrigin
};
}
renderContent() {
return html$2(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["<slot></slot>"])));
}
createAdapter() {
var _this9 = this;
return Object.assign(Object.assign({}, addHasRemoveClass(this.mdcRoot)), {
hasAnchor: () => {
return !!this.anchor;
},
notifyClose: () => {
var init = {
bubbles: true,
composed: true
};
var ev = new CustomEvent('closed', init);
this.open = false;
this.mdcRoot.dispatchEvent(ev);
},
notifyClosing: () => {
var init = {
bubbles: true,
composed: true
};
var ev = new CustomEvent('closing', init);
this.mdcRoot.dispatchEvent(ev);
},
notifyOpen: () => {
var init = {
bubbles: true,
composed: true
};
var ev = new CustomEvent('opened', init);
this.open = true;
this.mdcRoot.dispatchEvent(ev);
},
notifyOpening: () => {
var init = {
bubbles: true,
composed: true
};
var ev = new CustomEvent('opening', init);
this.mdcRoot.dispatchEvent(ev);
},
isElementInContainer: () => false,
isRtl: () => {
if (this.mdcRoot) {
return getComputedStyle(this.mdcRoot).direction === 'rtl';
}
return false;
},
setTransformOrigin: origin => {
var root = this.mdcRoot;
if (!root) {
return;
}
this.styleTransformOrigin = origin;
},
isFocused: () => {
return doesElementContainFocus(this);
},
saveFocus: () => {
var activeElementPath = deepActiveElementPath();
var pathLength = activeElementPath.length;
if (!pathLength) {
this.previouslyFocused = null;
}
this.previouslyFocused = activeElementPath[pathLength - 1];
},
restoreFocus: () => {
if (!this.previouslyFocused) {
return;
}
if ('focus' in this.previouslyFocused) {
this.previouslyFocused.focus();
}
},
getInnerDimensions: () => {
var mdcRoot = this.mdcRoot;
if (!mdcRoot) {
return {
width: 0,
height: 0
};
}
return {
width: mdcRoot.offsetWidth,
height: mdcRoot.offsetHeight
};
},
getAnchorDimensions: () => {
var anchorElement = this.anchor;
if (anchorElement) {
return anchorElement.getBoundingClientRect();
} else {
return null;
}
},
getBodyDimensions: () => {
return {
width: document.body.clientWidth,
height: document.body.clientHeight
};
},
getWindowDimensions: () => {
return {
width: window.innerWidth,
height: window.innerHeight
};
},
getWindowScroll: () => {
return {
x: window.pageXOffset,
y: window.pageYOffset
};
},
setPosition: position => {
var mdcRoot = this.mdcRoot;
if (!mdcRoot) {
return;
}
if ('left' in position) {
this.styleLeft = "".concat(position.left, "px");
} else {
this.styleLeft = '';
}
if ('right' in position) {
this.styleRight = "".concat(position.right, "px");
} else {
this.styleRight = '';
}
if ('top' in position) {
this.styleTop = "".concat(position.top, "px");
} else {
this.styleTop = '';
}
if ('bottom' in position) {
this.styleBottom = "".concat(position.bottom, "px");
} else {
this.styleBottom = '';
}
},
setMaxHeight: function () {
var _setMaxHeight = _asyncToGenerator(function* (height) {
var mdcRoot = _this9.mdcRoot;
if (!mdcRoot) {
return;
}
_this9.styleMaxHeight = height;
yield _this9.updateComplete;
_this9.styleMaxHeight = "var(--mdc-menu-max-height, ".concat(height, ")");
});
function setMaxHeight(_x) {
return _setMaxHeight.apply(this, arguments);
}
return setMaxHeight;
}()
});
}
onKeydown(evt) {
if (this.mdcFoundation) {
this.mdcFoundation.handleKeydown(evt);
}
}
onBodyClick(evt) {
if (this.stayOpenOnBodyClick) {
return;
}
var path = evt.composedPath();
if (path.indexOf(this) === -1) {
this.close();
}
}
registerBodyClick() {
this.onBodyClickBound = this.onBodyClick.bind(this);
document.body.addEventListener('click', this.onBodyClickBound, {
passive: true,
capture: true
});
}
deregisterBodyClick() {
document.body.removeEventListener('click', this.onBodyClickBound, {
capture: true
});
}
onOpenChanged(isOpen, wasOpen) {
if (this.mdcFoundation) {
if (isOpen) {
this.mdcFoundation.open();
} else if (wasOpen !== undefined) {
this.mdcFoundation.close();
}
}
}
close() {
this.open = false;
}
show() {
this.open = true;
}
}
__decorate([query$2('.mdc-menu-surface')], MenuSurfaceBase.prototype, "mdcRoot", void 0);
__decorate([query$2('slot')], MenuSurfaceBase.prototype, "slotElement", void 0);
__decorate([property$2({
type: Boolean
}), observer(function (isAbsolute) {
if (this.mdcFoundation && !this.fixed) {
this.mdcFoundation.setIsHoisted(isAbsolute);
}
})], MenuSurfaceBase.prototype, "absolute", void 0);
__decorate([property$2({
type: Boolean
})], MenuSurfaceBase.prototype, "fullwidth", void 0);
__decorate([property$2({
type: Boolean
}), observer(function (isFixed) {
if (this.mdcFoundation && !this.absolute) {
this.mdcFoundation.setFixedPosition(isFixed);
}
})], MenuSurfaceBase.prototype, "fixed", void 0);
__decorate([property$2({
type: Number
}), observer(function (value) {
if (this.mdcFoundation && this.y !== null && value !== null) {
this.mdcFoundation.setAbsolutePosition(value, this.y);
this.mdcFoundation.setAnchorMargin({
left: value,
top: this.y,
right: -value,
bottom: this.y
});
}
})], MenuSurfaceBase.prototype, "x", void 0);
__decorate([property$2({
type: Number
}), observer(function (value) {
if (this.mdcFoundation && this.x !== null && value !== null) {
this.mdcFoundation.setAbsolutePosition(this.x, value);
this.mdcFoundation.setAnchorMargin({
left: this.x,
top: value,
right: -this.x,
bottom: value
});
}
})], MenuSurfaceBase.prototype, "y", void 0);
__decorate([property$2({
type: Boolean
}), observer(function (value) {
if (this.mdcFoundation) {
this.mdcFoundation.setQuickOpen(value);
}
})], MenuSurfaceBase.prototype, "quick", void 0);
__decorate([property$2({
type: Boolean,
reflect: true
}), observer(function (isOpen, wasOpen) {
this.onOpenChanged(isOpen, wasOpen);
})], MenuSurfaceBase.prototype, "open", void 0);
__decorate([property$2({
type: Boolean
})], MenuSurfaceBase.prototype, "stayOpenOnBodyClick", void 0);
__decorate([state$2(), observer(function (value) {
if (this.mdcFoundation) {
if (value) {
this.mdcFoundation.setAnchorCorner(value);
} else {
this.mdcFoundation.setAnchorCorner(value);
}
}
})], MenuSurfaceBase.prototype, "bitwiseCorner", void 0);
__decorate([property$2({
type: String
}), observer(function (value) {
if (this.mdcFoundation) {
var isValidValue = value === 'START' || value === 'END';
var isFirstTimeSet = this.previousMenuCorner === null;
var cornerChanged = !isFirstTimeSet && value !== this.previousMenuCorner;
var initiallySetToEnd = isFirstTimeSet && value === 'END';
if (isValidValue && (cornerChanged || initiallySetToEnd)) {
this.bitwiseCorner = this.bitwiseCorner ^ CornerBit.RIGHT;
this.mdcFoundation.flipCornerHorizontally();
this.previousMenuCorner = value;
}
}
})], MenuSurfaceBase.prototype, "menuCorner", void 0);
__decorate([property$2({
type: String
}), observer(function (value) {
if (this.mdcFoundation) {
if (value) {
var newCorner = stringToCorner[value];
if (this.menuCorner === 'END') {
newCorner = newCorner ^ CornerBit.RIGHT;
}
this.bitwiseCorner = newCorner;
}
}
})], MenuSurfaceBase.prototype, "corner", void 0);
__decorate([state$2()], MenuSurfaceBase.prototype, "styleTop", void 0);
__decorate([state$2()], MenuSurfaceBase.prototype, "styleLeft", void 0);
__decorate([state$2()], MenuSurfaceBase.prototype, "styleRight", void 0);
__decorate([state$2()], MenuSurfaceBase.prototype, "styleBottom", void 0);
__decorate([state$2()], MenuSurfaceBase.prototype, "styleMaxHeight", void 0);
__decorate([state$2()], MenuSurfaceBase.prototype, "styleTransformOrigin", void 0);
/**
* @license
* Copyright 2021 Google LLC
* SPDX-LIcense-Identifier: Apache-2.0
*/
var styles$3 = css$2(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral([".mdc-menu-surface{display:none;position:absolute;box-sizing:border-box;max-width:calc(100vw - 32px);max-width:var(--mdc-menu-max-width, calc(100vw - 32px));max-height:calc(100vh - 32px);max-height:var(--mdc-menu-max-height, calc(100vh - 32px));margin:0;padding:0;transform:scale(1);transform-origin:top left;opacity:0;overflow:auto;will-change:transform,opacity;z-index:8;transition:opacity .03s linear,transform .12s cubic-bezier(0, 0, 0.2, 1),height 250ms cubic-bezier(0, 0, 0.2, 1);box-shadow:0px 5px 5px -3px rgba(0, 0, 0, 0.2),0px 8px 10px 1px rgba(0, 0, 0, 0.14),0px 3px 14px 2px rgba(0,0,0,.12);background-color:#fff;background-color:var(--mdc-theme-surface, #fff);color:#000;color:var(--mdc-theme-on-surface, #000);border-radius:4px;border-radius:var(--mdc-shape-medium, 4px);transform-origin-left:top left;transform-origin-right:top right}.mdc-menu-surface:focus{outline:none}.mdc-menu-surface--animating-open{display:inline-block;transform:scale(0.8);opacity:0}.mdc-menu-surface--open{display:inline-block;transform:scale(1);opacity:1}.mdc-menu-surface--animating-closed{display:inline-block;opacity:0;transition:opacity .075s linear}[dir=rtl] .mdc-menu-surface,.mdc-menu-surface[dir=rtl]{transform-origin-left:top right;transform-origin-right:top left}.mdc-menu-surface--anchor{position:relative;overflow:visible}.mdc-menu-surface--fixed{position:fixed}.mdc-menu-surface--fullwidth{width:100%}:host(:not([open])){display:none}.mdc-menu-surface{z-index:8;z-index:var(--mdc-menu-z-index, 8);min-width:112px;min-width:var(--mdc-menu-min-width, 112px)}"])));
class ClimateMenuSurface extends ScopedRegistryHost(MenuSurfaceBase) {
static get defineId() {
return 'mwc-menu-surface';
}
static get elementDefinitions() {
return buildElementDefinitions([], ClimateMenuSurface);
}
static get styles() {
return styles$3;
}
}
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var NODE_MODE$1 = false;
var global$8 = window;
var supportsAdoptingStyleSheets$1 = global$8.ShadowRoot && (global$8.ShadyCSS === undefined || global$8.ShadyCSS.nativeShadow) && 'adoptedStyleSheets' in Document.prototype && 'replace' in CSSStyleSheet.prototype;
var constructionToken$1 = Symbol();
var cssTagCache$1 = new WeakMap();
class CSSResult$1 {
constructor(cssText, strings, safeToken) {
this['_$cssResult$'] = true;
if (safeToken !== constructionToken$1) {
throw new Error('CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');
}
this.cssText = cssText;
this._strings = strings;
}
get styleSheet() {
var styleSheet = this._styleSheet;
var strings = this._strings;
if (supportsAdoptingStyleSheets$1 && styleSheet === undefined) {
var cacheable = strings !== undefined && strings.length === 1;
if (cacheable) {
styleSheet = cssTagCache$1.get(strings);
}
if (styleSheet === undefined) {
(this._styleSheet = styleSheet = new CSSStyleSheet()).replaceSync(this.cssText);
if (cacheable) {
cssTagCache$1.set(strings, styleSheet);
}
}
}
return styleSheet;
}
toString() {
return this.cssText;
}
}
var textFromCSSResult$1 = value => {
if (value['_$cssResult$'] === true) {
return value.cssText;
} else if (typeof value === 'number') {
return value;
} else {
throw new Error("Value passed to 'css' function must be a 'css' function result: " + "".concat(value, ". Use 'unsafeCSS' to pass non-literal values, but take care ") + "to ensure page security.");
}
};
var unsafeCSS$1 = value => new CSSResult$1(typeof value === 'string' ? value : String(value), undefined, constructionToken$1);
var css$1 = function css$1(strings) {
for (var _len7 = arguments.length, values = new Array(_len7 > 1 ? _len7 - 1 : 0), _key7 = 1; _key7 < _len7; _key7++) {
values[_key7 - 1] = arguments[_key7];
}
var cssText = strings.length === 1 ? strings[0] : values.reduce((acc, v, idx) => acc + textFromCSSResult$1(v) + strings[idx + 1], strings[0]);
return new CSSResult$1(cssText, strings, constructionToken$1);
};
var adoptStyles$1 = (renderRoot, styles) => {
if (supportsAdoptingStyleSheets$1) {
renderRoot.adoptedStyleSheets = styles.map(s => s instanceof CSSStyleSheet ? s : s.styleSheet);
} else {
styles.forEach(s => {
var style = document.createElement('style');
var nonce = global$8['litNonce'];
if (nonce !== undefined) {
style.setAttribute('nonce', nonce);
}
style.textContent = s.cssText;
renderRoot.appendChild(style);
});
}
};
var cssResultFromStyleSheet$1 = sheet => {
var cssText = '';
for (var rule of sheet.cssRules) {
cssText += rule.cssText;
}
return unsafeCSS$1(cssText);
};
var getCompatibleStyle$1 = supportsAdoptingStyleSheets$1 || NODE_MODE$1 ? s => s : s => s instanceof CSSStyleSheet ? cssResultFromStyleSheet$1(s) : s;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var _b$5, _c$5, _d$3;
var _e$1;
var global$7 = window;
var requestUpdateThenable$1;
var issueWarning$5;
var trustedTypes$3 = global$7.trustedTypes;
var emptyStringForBooleanAttribute$3 = trustedTypes$3 ? trustedTypes$3.emptyScript : '';
var polyfillSupport$5 = global$7.reactiveElementPolyfillSupportDevMode;
{
var _issuedWarnings6 = (_b$5 = global$7.litIssuedWarnings) !== null && _b$5 !== void 0 ? _b$5 : global$7.litIssuedWarnings = new Set();
issueWarning$5 = (code, warning) => {
warning += " See https://lit.dev/msg/".concat(code, " for more information.");
if (!_issuedWarnings6.has(warning)) {
console.warn(warning);
_issuedWarnings6.add(warning);
}
};
issueWarning$5('dev-mode', "Lit is in dev mode. Not recommended for production!");
if (((_c$5 = global$7.ShadyDOM) === null || _c$5 === void 0 ? void 0 : _c$5.inUse) && polyfillSupport$5 === undefined) {
issueWarning$5('polyfill-support-missing', "Shadow DOM is being polyfilled via `ShadyDOM` but " + "the `polyfill-support` module has not been loaded.");
}
requestUpdateThenable$1 = name => ({
then: (onfulfilled, _onrejected) => {
issueWarning$5('request-update-promise', "The `requestUpdate` method should no longer return a Promise but " + "does so on `".concat(name, "`. Use `updateComplete` instead."));
if (onfulfilled !== undefined) {
onfulfilled(false);
}
}
});
}
var debugLogEvent$3 = event => {
var shouldEmit = global$7.emitLitDebugLogEvents;
if (!shouldEmit) {
return;
}
global$7.dispatchEvent(new CustomEvent('lit-debug', {
detail: event
}));
};
var JSCompiler_renameProperty$1 = (prop, _obj) => prop;
var defaultConverter$1 = {
toAttribute(value, type) {
switch (type) {
case Boolean:
if (value) {
value = emptyStringForBooleanAttribute$3;
} else {
value = null;
}
break;
case Object:
case Array:
if (value == null) {
value = value;
} else {
value = JSON.stringify(value);
}
break;
}
return value;
},
fromAttribute(value, type) {
var fromValue = value;
switch (type) {
case Boolean:
fromValue = value !== null;
break;
case Number:
if (value === null) {
fromValue = null;
} else {
fromValue = Number(value);
}
break;
case Object:
case Array:
try {
fromValue = JSON.parse(value);
} catch (e) {
fromValue = null;
}
break;
}
return fromValue;
}
};
var notEqual$1 = (value, old) => {
return old !== value && (old === old || value === value);
};
var defaultPropertyDeclaration$1 = {
attribute: true,
type: String,
converter: defaultConverter$1,
reflect: false,
hasChanged: notEqual$1
};
var finalized$1 = 'finalized';
class ReactiveElement$1 extends HTMLElement {
constructor() {
super();
this.__instanceProperties = new Map();
this.isUpdatePending = false;
this.hasUpdated = false;
this.__reflectingProperty = null;
this.__initialize();
}
static addInitializer(initializer) {
var _a;
this.finalize();
((_a = this._initializers) !== null && _a !== void 0 ? _a : this._initializers = []).push(initializer);
}
static get observedAttributes() {
this.finalize();
var attributes = [];
this.elementProperties.forEach((v, p) => {
var attr = this.__attributeNameForProperty(p, v);
if (attr !== undefined) {
this.__attributeToPropertyMap.set(attr, p);
attributes.push(attr);
}
});
return attributes;
}
static createProperty(name) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultPropertyDeclaration$1;
var _a;
if (options.state) {
options.attribute = false;
}
this.finalize();
this.elementProperties.set(name, options);
if (!options.noAccessor && !this.prototype.hasOwnProperty(name)) {
var key = typeof name === 'symbol' ? Symbol() : "__".concat(name);
var descriptor = this.getPropertyDescriptor(name, key, options);
if (descriptor !== undefined) {
Object.defineProperty(this.prototype, name, descriptor);
{
if (!this.hasOwnProperty('__reactivePropertyKeys')) {
this.__reactivePropertyKeys = new Set((_a = this.__reactivePropertyKeys) !== null && _a !== void 0 ? _a : []);
}
this.__reactivePropertyKeys.add(name);
}
}
}
}
static getPropertyDescriptor(name, key, options) {
return {
get() {
return this[key];
},
set(value) {
var oldValue = this[name];
this[key] = value;
this.requestUpdate(name, oldValue, options);
},
configurable: true,
enumerable: true
};
}
static getPropertyOptions(name) {
return this.elementProperties.get(name) || defaultPropertyDeclaration$1;
}
static finalize() {
var _this10 = this;
if (this.hasOwnProperty(finalized$1)) {
return false;
}
this[finalized$1] = true;
var superCtor = Object.getPrototypeOf(this);
superCtor.finalize();
if (superCtor._initializers !== undefined) {
this._initializers = [...superCtor._initializers];
}
this.elementProperties = new Map(superCtor.elementProperties);
this.__attributeToPropertyMap = new Map();
if (this.hasOwnProperty(JSCompiler_renameProperty$1('properties'))) {
var props = this.properties;
var propKeys = [...Object.getOwnPropertyNames(props), ...Object.getOwnPropertySymbols(props)];
for (var p of propKeys) {
this.createProperty(p, props[p]);
}
}
this.elementStyles = this.finalizeStyles(this.styles);
{
var warnRemovedOrRenamed = function warnRemovedOrRenamed(name) {
var renamed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (_this10.prototype.hasOwnProperty(name)) {
issueWarning$5(renamed ? 'renamed-api' : 'removed-api', "`".concat(name, "` is implemented on class ").concat(_this10.name, ". It ") + "has been ".concat(renamed ? 'renamed' : 'removed', " ") + "in this version of LitElement.");
}
};
warnRemovedOrRenamed('initialize');
warnRemovedOrRenamed('requestUpdateInternal');
warnRemovedOrRenamed('_getUpdateComplete', true);
}
return true;
}
static finalizeStyles(styles) {
var elementStyles = [];
if (Array.isArray(styles)) {
var set = new Set(styles.flat(Infinity).reverse());
for (var s of set) {
elementStyles.unshift(getCompatibleStyle$1(s));
}
} else if (styles !== undefined) {
elementStyles.push(getCompatibleStyle$1(styles));
}
return elementStyles;
}
static __attributeNameForProperty(name, options) {
var attribute = options.attribute;
if (attribute === false) {
return undefined;
} else {
if (typeof attribute === 'string') {
return attribute;
} else {
if (typeof name === 'string') {
return name.toLowerCase();
} else {
return undefined;
}
}
}
}
__initialize() {
var _a;
this.__updatePromise = new Promise(res => this.enableUpdating = res);
this._$changedProperties = new Map();
this.__saveInstanceProperties();
this.requestUpdate();
if ((_a = this.constructor._initializers) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(i => i(this));
}
}
addController(controller) {
var _a, _b;
((_a = this.__controllers) !== null && _a !== void 0 ? _a : this.__controllers = []).push(controller);
if (this.renderRoot !== undefined && this.isConnected) {
if ((_b = controller.hostConnected) === null || _b === void 0) {
0;
undefined;
} else {
_b.call(controller);
}
}
}
removeController(controller) {
var _a;
if ((_a = this.__controllers) === null || _a === void 0) {
0;
undefined;
} else {
_a.splice(this.__controllers.indexOf(controller) >>> 0, 1);
}
}
__saveInstanceProperties() {
this.constructor.elementProperties.forEach((_v, p) => {
if (this.hasOwnProperty(p)) {
this.__instanceProperties.set(p, this[p]);
delete this[p];
}
});
}
createRenderRoot() {
var _a;
var renderRoot = (_a = this.shadowRoot) !== null && _a !== void 0 ? _a : this.attachShadow(this.constructor.shadowRootOptions);
adoptStyles$1(renderRoot, this.constructor.elementStyles);
return renderRoot;
}
connectedCallback() {
var _a;
if (this.renderRoot === undefined) {
this.renderRoot = this.createRenderRoot();
}
this.enableUpdating(true);
if ((_a = this.__controllers) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(c => {
var _a;
if ((_a = c.hostConnected) === null || _a === void 0) {
0;
return;
} else {
return _a.call(c);
}
});
}
}
enableUpdating(_requestedUpdate) {}
disconnectedCallback() {
var _a;
if ((_a = this.__controllers) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(c => {
var _a;
if ((_a = c.hostDisconnected) === null || _a === void 0) {
0;
return;
} else {
return _a.call(c);
}
});
}
}
attributeChangedCallback(name, _old, value) {
this._$attributeToProperty(name, value);
}
__propertyToAttribute(name, value) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultPropertyDeclaration$1;
var _a;
var attr = this.constructor.__attributeNameForProperty(name, options);
if (attr !== undefined && options.reflect === true) {
var converter = ((_a = options.converter) === null || _a === void 0 ? void 0 : _a.toAttribute) !== undefined ? options.converter : defaultConverter$1;
var attrValue = converter.toAttribute(value, options.type);
if (this.constructor.enabledWarnings.indexOf('migration') >= 0 && attrValue === undefined) {
issueWarning$5('undefined-attribute-value', "The attribute value for the ".concat(name, " property is ") + "undefined on element ".concat(this.localName, ". The attribute will be ") + "removed, but in the previous version of `ReactiveElement`, " + "the attribute would not have changed.");
}
this.__reflectingProperty = name;
if (attrValue == null) {
this.removeAttribute(attr);
} else {
this.setAttribute(attr, attrValue);
}
this.__reflectingProperty = null;
}
}
_$attributeToProperty(name, value) {
var _a;
var ctor = this.constructor;
var propName = ctor.__attributeToPropertyMap.get(name);
if (propName !== undefined && this.__reflectingProperty !== propName) {
var options = ctor.getPropertyOptions(propName);
var converter = typeof options.converter === 'function' ? {
fromAttribute: options.converter
} : ((_a = options.converter) === null || _a === void 0 ? void 0 : _a.fromAttribute) !== undefined ? options.converter : defaultConverter$1;
this.__reflectingProperty = propName;
this[propName] = converter.fromAttribute(value, options.type);
this.__reflectingProperty = null;
}
}
requestUpdate(name, oldValue, options) {
var shouldRequestUpdate = true;
if (name !== undefined) {
options = options || this.constructor.getPropertyOptions(name);
var hasChanged = options.hasChanged || notEqual$1;
if (hasChanged(this[name], oldValue)) {
if (!this._$changedProperties.has(name)) {
this._$changedProperties.set(name, oldValue);
}
if (options.reflect === true && this.__reflectingProperty !== name) {
if (this.__reflectingProperties === undefined) {
this.__reflectingProperties = new Map();
}
this.__reflectingProperties.set(name, options);
}
} else {
shouldRequestUpdate = false;
}
}
if (!this.isUpdatePending && shouldRequestUpdate) {
this.__updatePromise = this.__enqueueUpdate();
}
return requestUpdateThenable$1(this.localName);
}
__enqueueUpdate() {
var _this11 = this;
return _asyncToGenerator(function* () {
_this11.isUpdatePending = true;
try {
yield _this11.__updatePromise;
} catch (e) {
Promise.reject(e);
}
var result = _this11.scheduleUpdate();
if (result != null) {
yield result;
}
return !_this11.isUpdatePending;
})();
}
scheduleUpdate() {
return this.performUpdate();
}
performUpdate() {
var _a, _b;
if (!this.isUpdatePending) {
return;
}
if (debugLogEvent$3 === null || debugLogEvent$3 === void 0) {
0;
undefined;
} else {
debugLogEvent$3({
kind: 'update'
});
}
if (!this.hasUpdated) {
{
var shadowedProperties = [];
if ((_a = this.constructor.__reactivePropertyKeys) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(p => {
var _a;
if (this.hasOwnProperty(p) && !((_a = this.__instanceProperties) === null || _a === void 0 ? void 0 : _a.has(p))) {
shadowedProperties.push(p);
}
});
}
if (shadowedProperties.length) {
throw new Error("The following properties on element ".concat(this.localName, " will not ") + "trigger updates as expected because they are set using class " + "fields: ".concat(shadowedProperties.join(', '), ". ") + "Native class fields and some compiled output will overwrite " + "accessors used for detecting changes. See " + "https://lit.dev/msg/class-field-shadowing " + "for more information.");
}
}
}
if (this.__instanceProperties) {
this.__instanceProperties.forEach((v, p) => this[p] = v);
this.__instanceProperties = undefined;
}
var shouldUpdate = false;
var changedProperties = this._$changedProperties;
try {
shouldUpdate = this.shouldUpdate(changedProperties);
if (shouldUpdate) {
this.willUpdate(changedProperties);
if ((_b = this.__controllers) === null || _b === void 0) {
0;
undefined;
} else {
_b.forEach(c => {
var _a;
if ((_a = c.hostUpdate) === null || _a === void 0) {
0;
return;
} else {
return _a.call(c);
}
});
}
this.update(changedProperties);
} else {
this.__markUpdated();
}
} catch (e) {
shouldUpdate = false;
this.__markUpdated();
throw e;
}
if (shouldUpdate) {
this._$didUpdate(changedProperties);
}
}
willUpdate(_changedProperties) {}
_$didUpdate(changedProperties) {
var _a;
if ((_a = this.__controllers) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(c => {
var _a;
if ((_a = c.hostUpdated) === null || _a === void 0) {
0;
return;
} else {
return _a.call(c);
}
});
}
if (!this.hasUpdated) {
this.hasUpdated = true;
this.firstUpdated(changedProperties);
}
this.updated(changedProperties);
if (this.isUpdatePending && this.constructor.enabledWarnings.indexOf('change-in-update') >= 0) {
issueWarning$5('change-in-update', "Element ".concat(this.localName, " scheduled an update ") + "(generally because a property was set) " + "after an update completed, causing a new update to be scheduled. " + "This is inefficient and should be avoided unless the next update " + "can only be scheduled as a side effect of the previous update.");
}
}
__markUpdated() {
this._$changedProperties = new Map();
this.isUpdatePending = false;
}
get updateComplete() {
return this.getUpdateComplete();
}
getUpdateComplete() {
return this.__updatePromise;
}
shouldUpdate(_changedProperties) {
return true;
}
update(_changedProperties) {
if (this.__reflectingProperties !== undefined) {
this.__reflectingProperties.forEach((v, k) => this.__propertyToAttribute(k, this[k], v));
this.__reflectingProperties = undefined;
}
this.__markUpdated();
}
updated(_changedProperties) {}
firstUpdated(_changedProperties) {}
}
_e$1 = finalized$1;
ReactiveElement$1[_e$1] = true;
ReactiveElement$1.elementProperties = new Map();
ReactiveElement$1.elementStyles = [];
ReactiveElement$1.shadowRootOptions = {
mode: 'open'
};
if (polyfillSupport$5 === null || polyfillSupport$5 === void 0) {
0;
undefined;
} else {
polyfillSupport$5({
ReactiveElement: ReactiveElement$1
});
}
{
ReactiveElement$1.enabledWarnings = ['change-in-update'];
var _ensureOwnWarnings3 = function _ensureOwnWarnings3(ctor) {
if (!ctor.hasOwnProperty(JSCompiler_renameProperty$1('enabledWarnings'))) {
ctor.enabledWarnings = ctor.enabledWarnings.slice();
}
};
ReactiveElement$1.enableWarning = function (warning) {
_ensureOwnWarnings3(this);
if (this.enabledWarnings.indexOf(warning) < 0) {
this.enabledWarnings.push(warning);
}
};
ReactiveElement$1.disableWarning = function (warning) {
_ensureOwnWarnings3(this);
var i = this.enabledWarnings.indexOf(warning);
if (i >= 0) {
this.enabledWarnings.splice(i, 1);
}
};
}
((_d$3 = global$7.reactiveElementVersions) !== null && _d$3 !== void 0 ? _d$3 : global$7.reactiveElementVersions = []).push('1.6.3');
if (global$7.reactiveElementVersions.length > 1) {
issueWarning$5('multiple-versions', "Multiple versions of Lit loaded. Loading multiple versions " + "is not recommended.");
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var _a$5, _b$4, _c$4, _d$2;
var global$6 = window;
var debugLogEvent$2 = event => {
var shouldEmit = global$6.emitLitDebugLogEvents;
if (!shouldEmit) {
return;
}
global$6.dispatchEvent(new CustomEvent('lit-debug', {
detail: event
}));
};
var debugLogRenderId$1 = 0;
var issueWarning$4;
{
if ((_a$5 = global$6.litIssuedWarnings) !== null && _a$5 !== void 0) {
_a$5;
} else {
global$6.litIssuedWarnings = new Set();
}
issueWarning$4 = (code, warning) => {
if (code) {
warning += " See https://lit.dev/msg/".concat(code, " for more information.");
} else {
warning += '';
}
if (!global$6.litIssuedWarnings.has(warning)) {
console.warn(warning);
global$6.litIssuedWarnings.add(warning);
}
};
issueWarning$4('dev-mode', "Lit is in dev mode. Not recommended for production!");
}
var wrap$1 = ((_b$4 = global$6.ShadyDOM) === null || _b$4 === void 0 ? void 0 : _b$4.inUse) && ((_c$4 = global$6.ShadyDOM) === null || _c$4 === void 0 ? void 0 : _c$4.noPatch) === true ? global$6.ShadyDOM.wrap : node => node;
var trustedTypes$2 = global$6.trustedTypes;
var policy$1 = trustedTypes$2 ? trustedTypes$2.createPolicy('lit-html', {
createHTML: s => s
}) : undefined;
var identityFunction$1 = value => value;
var noopSanitizer$1 = (_node, _name, _type) => identityFunction$1;
var setSanitizer$1 = newSanitizer => {
if (sanitizerFactoryInternal$1 !== noopSanitizer$1) {
throw new Error("Attempted to overwrite existing lit-html security policy." + " setSanitizeDOMValueFactory should be called at most once.");
}
sanitizerFactoryInternal$1 = newSanitizer;
};
var _testOnlyClearSanitizerFactoryDoNotCallOrElse$1 = () => {
sanitizerFactoryInternal$1 = noopSanitizer$1;
};
var createSanitizer$1 = (node, name, type) => {
return sanitizerFactoryInternal$1(node, name, type);
};
var boundAttributeSuffix$1 = '$lit$';
var marker$1 = "lit$".concat(String(Math.random()).slice(9), "$");
var markerMatch$1 = '?' + marker$1;
var nodeMarker$1 = "<".concat(markerMatch$1, ">");
var d$1 = document;
var createMarker$1 = () => d$1.createComment('');
var isPrimitive$1 = value => value === null || typeof value != 'object' && typeof value != 'function';
var isArray$1 = Array.isArray;
var isIterable$1 = value => isArray$1(value) || typeof (value === null || value === void 0 ? void 0 : value[Symbol.iterator]) === 'function';
var SPACE_CHAR$1 = "[ \t\n\f\r]";
var ATTR_VALUE_CHAR$1 = "[^ \t\n\f\r\"'`<>=]";
var NAME_CHAR$1 = "[^\\s\"'>=/]";
var textEndRegex$1 = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g;
var COMMENT_START$1 = 1;
var TAG_NAME$1 = 2;
var DYNAMIC_TAG_NAME$1 = 3;
var commentEndRegex$1 = /-->/g;
var comment2EndRegex$1 = />/g;
var tagEndRegex$1 = new RegExp(">|".concat(SPACE_CHAR$1, "(?:(").concat(NAME_CHAR$1, "+)(").concat(SPACE_CHAR$1, "*=").concat(SPACE_CHAR$1, "*(?:").concat(ATTR_VALUE_CHAR$1, "|(\"|')|))|$)"), 'g');
var ENTIRE_MATCH$1 = 0;
var ATTRIBUTE_NAME$1 = 1;
var SPACES_AND_EQUALS$1 = 2;
var QUOTE_CHAR$1 = 3;
var singleQuoteAttrEndRegex$1 = /'/g;
var doubleQuoteAttrEndRegex$1 = /"/g;
var rawTextElement$1 = /^(?:script|style|textarea|title)$/i;
var HTML_RESULT$1 = 1;
var SVG_RESULT$1 = 2;
var ATTRIBUTE_PART$1 = 1;
var CHILD_PART$1 = 2;
var PROPERTY_PART$1 = 3;
var BOOLEAN_ATTRIBUTE_PART$1 = 4;
var EVENT_PART$1 = 5;
var ELEMENT_PART$1 = 6;
var COMMENT_PART$1 = 7;
var tag$1 = type => function (strings) {
if (strings.some(s => s === undefined)) {
console.warn('Some template strings are undefined.\n' + 'This is probably caused by illegal octal escape sequences.');
}
for (var _len8 = arguments.length, values = new Array(_len8 > 1 ? _len8 - 1 : 0), _key8 = 1; _key8 < _len8; _key8++) {
values[_key8 - 1] = arguments[_key8];
}
return {
['_$litType$']: type,
strings,
values
};
};
var html$1 = tag$1(HTML_RESULT$1);
var noChange$1 = Symbol.for('lit-noChange');
var nothing$1 = Symbol.for('lit-nothing');
var templateCache$1 = new WeakMap();
var walker$1 = d$1.createTreeWalker(d$1, 129, null, false);
var sanitizerFactoryInternal$1 = noopSanitizer$1;
function trustFromTemplateString$1(tsa, stringFromTSA) {
if (!Array.isArray(tsa) || !tsa.hasOwnProperty('raw')) {
var message = 'invalid template strings array';
{
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 ".trim().replace(/\n */g, '\n');
}
throw new Error(message);
}
if (policy$1 !== undefined) {
return policy$1.createHTML(stringFromTSA);
} else {
return stringFromTSA;
}
}
var getTemplateHtml$1 = (strings, type) => {
var l = strings.length - 1;
var attrNames = [];
var html = type === SVG_RESULT$1 ? '<svg>' : '';
var rawTextEndRegex;
var regex = textEndRegex$1;
for (var i = 0; i < l; i++) {
var s = strings[i];
var attrNameEndIndex = -1;
var attrName = void 0;
var lastIndex = 0;
var match = void 0;
while (lastIndex < s.length) {
regex.lastIndex = lastIndex;
match = regex.exec(s);
if (match === null) {
break;
}
lastIndex = regex.lastIndex;
if (regex === textEndRegex$1) {
if (match[COMMENT_START$1] === '!--') {
regex = commentEndRegex$1;
} else if (match[COMMENT_START$1] !== undefined) {
regex = comment2EndRegex$1;
} else if (match[TAG_NAME$1] !== undefined) {
if (rawTextElement$1.test(match[TAG_NAME$1])) {
rawTextEndRegex = new RegExp("</".concat(match[TAG_NAME$1]), 'g');
}
regex = tagEndRegex$1;
} else if (match[DYNAMIC_TAG_NAME$1] !== undefined) {
{
throw new Error('Bindings in tag names are not supported. Please use static templates instead. ' + 'See https://lit.dev/docs/templates/expressions/#static-expressions');
}
}
} else if (regex === tagEndRegex$1) {
if (match[ENTIRE_MATCH$1] === '>') {
if (rawTextEndRegex !== null && rawTextEndRegex !== void 0) {
regex = rawTextEndRegex;
} else {
regex = textEndRegex$1;
}
attrNameEndIndex = -1;
} else if (match[ATTRIBUTE_NAME$1] === undefined) {
attrNameEndIndex = -2;
} else {
attrNameEndIndex = regex.lastIndex - match[SPACES_AND_EQUALS$1].length;
attrName = match[ATTRIBUTE_NAME$1];
if (match[QUOTE_CHAR$1] === undefined) {
regex = tagEndRegex$1;
} else if (match[QUOTE_CHAR$1] === '"') {
regex = doubleQuoteAttrEndRegex$1;
} else {
regex = singleQuoteAttrEndRegex$1;
}
}
} else if (regex === doubleQuoteAttrEndRegex$1 || regex === singleQuoteAttrEndRegex$1) {
regex = tagEndRegex$1;
} else if (regex === commentEndRegex$1 || regex === comment2EndRegex$1) {
regex = textEndRegex$1;
} else {
regex = tagEndRegex$1;
rawTextEndRegex = undefined;
}
}
{
console.assert(attrNameEndIndex === -1 || regex === tagEndRegex$1 || regex === singleQuoteAttrEndRegex$1 || regex === doubleQuoteAttrEndRegex$1, 'unexpected parse state B');
}
var end = regex === tagEndRegex$1 && strings[i + 1].startsWith('/>') ? ' ' : '';
if (regex === textEndRegex$1) {
html += s + nodeMarker$1;
} else if (attrNameEndIndex >= 0) {
html += (attrNames.push(attrName), s.slice(0, attrNameEndIndex) + boundAttributeSuffix$1 + s.slice(attrNameEndIndex)) + marker$1 + end;
} else {
html += s + marker$1 + (attrNameEndIndex === -2 ? (attrNames.push(undefined), i) : end);
}
}
var htmlResult = html + (strings[l] || '<?>') + (type === SVG_RESULT$1 ? '</svg>' : '');
return [trustFromTemplateString$1(strings, htmlResult), attrNames];
};
class Template$1 {
constructor(_ref14, options) {
var {
strings,
['_$litType$']: type
} = _ref14;
this.parts = [];
var node;
var nodeIndex = 0;
var attrNameIndex = 0;
var partCount = strings.length - 1;
var parts = this.parts;
var [html, attrNames] = getTemplateHtml$1(strings, type);
this.el = Template$1.createElement(html, options);
walker$1.currentNode = this.el.content;
if (type === SVG_RESULT$1) {
var content = this.el.content;
var svgElement = content.firstChild;
svgElement.remove();
content.append(...svgElement.childNodes);
}
while ((node = walker$1.nextNode()) !== null && parts.length < partCount) {
if (node.nodeType === 1) {
{
var _tag4 = node.localName;
if (/^(?:textarea|template)$/i.test(_tag4) && node.innerHTML.includes(marker$1)) {
var m = "Expressions are not supported inside `".concat(_tag4, "` ") + "elements. See https://lit.dev/msg/expression-in-".concat(_tag4, " for more ") + "information.";
if (_tag4 === 'template') {
throw new Error(m);
} else {
issueWarning$4('', m);
}
}
}
if (node.hasAttributes()) {
var attrsToRemove = [];
for (var name of node.getAttributeNames()) {
if (name.endsWith(boundAttributeSuffix$1) || name.startsWith(marker$1)) {
var realName = attrNames[attrNameIndex++];
attrsToRemove.push(name);
if (realName !== undefined) {
var value = node.getAttribute(realName.toLowerCase() + boundAttributeSuffix$1);
var statics = value.split(marker$1);
var _m4 = /([.?@])?(.*)/.exec(realName);
parts.push({
type: ATTRIBUTE_PART$1,
index: nodeIndex,
name: _m4[2],
strings: statics,
ctor: _m4[1] === '.' ? PropertyPart$1 : _m4[1] === '?' ? BooleanAttributePart$1 : _m4[1] === '@' ? EventPart$1 : AttributePart$1
});
} else {
parts.push({
type: ELEMENT_PART$1,
index: nodeIndex
});
}
}
}
for (var _name9 of attrsToRemove) {
node.removeAttribute(_name9);
}
}
if (rawTextElement$1.test(node.tagName)) {
var _strings4 = node.textContent.split(marker$1);
var lastIndex = _strings4.length - 1;
if (lastIndex > 0) {
if (trustedTypes$2) {
node.textContent = trustedTypes$2.emptyScript;
} else {
node.textContent = '';
}
for (var i = 0; i < lastIndex; i++) {
node.append(_strings4[i], createMarker$1());
walker$1.nextNode();
parts.push({
type: CHILD_PART$1,
index: ++nodeIndex
});
}
node.append(_strings4[lastIndex], createMarker$1());
}
}
} else if (node.nodeType === 8) {
var data = node.data;
if (data === markerMatch$1) {
parts.push({
type: CHILD_PART$1,
index: nodeIndex
});
} else {
var _i5 = -1;
while ((_i5 = node.data.indexOf(marker$1, _i5 + 1)) !== -1) {
parts.push({
type: COMMENT_PART$1,
index: nodeIndex
});
_i5 += marker$1.length - 1;
}
}
}
nodeIndex++;
}
if (debugLogEvent$2 === null || debugLogEvent$2 === void 0) {
0;
undefined;
} else {
debugLogEvent$2({
kind: 'template prep',
template: this,
clonableTemplate: this.el,
parts: this.parts,
strings
});
}
}
static createElement(html, _options) {
var el = d$1.createElement('template');
el.innerHTML = html;
return el;
}
}
function resolveDirective$1(part, value) {
var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : part;
var attributeIndex = arguments.length > 3 ? arguments[3] : undefined;
var _a, _b, _c;
var _d;
if (value === noChange$1) {
return value;
}
var currentDirective = attributeIndex !== undefined ? (_a = parent.__directives) === null || _a === void 0 ? void 0 : _a[attributeIndex] : parent.__directive;
var nextDirectiveConstructor = isPrimitive$1(value) ? undefined : value['_$litDirective$'];
if ((currentDirective === null || currentDirective === void 0 ? void 0 : currentDirective.constructor) !== nextDirectiveConstructor) {
if ((_b = currentDirective === null || currentDirective === void 0 ? void 0 : currentDirective['_$notifyDirectiveConnectionChanged']) === null || _b === void 0) {
0;
undefined;
} else {
_b.call(currentDirective, false);
}
if (nextDirectiveConstructor === undefined) {
currentDirective = undefined;
} else {
currentDirective = new nextDirectiveConstructor(part);
currentDirective._$initialize(part, parent, attributeIndex);
}
if (attributeIndex !== undefined) {
((_c = (_d = parent).__directives) !== null && _c !== void 0 ? _c : _d.__directives = [])[attributeIndex] = currentDirective;
} else {
parent.__directive = currentDirective;
}
}
if (currentDirective !== undefined) {
value = resolveDirective$1(part, currentDirective._$resolve(part, value.values), currentDirective, attributeIndex);
}
return value;
}
class TemplateInstance$1 {
constructor(template, parent) {
this._$parts = [];
this._$disconnectableChildren = undefined;
this._$template = template;
this._$parent = parent;
}
get parentNode() {
return this._$parent.parentNode;
}
get _$isConnected() {
return this._$parent._$isConnected;
}
_clone(options) {
var _a;
var {
el: {
content
},
parts: parts
} = this._$template;
var fragment = ((_a = options === null || options === void 0 ? void 0 : options.creationScope) !== null && _a !== void 0 ? _a : d$1).importNode(content, true);
walker$1.currentNode = fragment;
var node = walker$1.nextNode();
var nodeIndex = 0;
var partIndex = 0;
var templatePart = parts[0];
while (templatePart !== undefined) {
if (nodeIndex === templatePart.index) {
var part = void 0;
if (templatePart.type === CHILD_PART$1) {
part = new ChildPart$1(node, node.nextSibling, this, options);
} else if (templatePart.type === ATTRIBUTE_PART$1) {
part = new templatePart.ctor(node, templatePart.name, templatePart.strings, this, options);
} else if (templatePart.type === ELEMENT_PART$1) {
part = new ElementPart$1(node, this, options);
}
this._$parts.push(part);
templatePart = parts[++partIndex];
}
if (nodeIndex !== (templatePart === null || templatePart === void 0 ? void 0 : templatePart.index)) {
node = walker$1.nextNode();
nodeIndex++;
}
}
walker$1.currentNode = d$1;
return fragment;
}
_update(values) {
var i = 0;
for (var part of this._$parts) {
if (part !== undefined) {
if (debugLogEvent$2 === null || debugLogEvent$2 === void 0) {
0;
undefined;
} else {
debugLogEvent$2({
kind: 'set part',
part,
value: values[i],
valueIndex: i,
values,
templateInstance: this
});
}
if (part.strings !== undefined) {
part._$setValue(values, part, i);
i += part.strings.length - 2;
} else {
part._$setValue(values[i]);
}
}
i++;
}
}
}
class ChildPart$1 {
constructor(startNode, endNode, parent, options) {
var _a;
this.type = CHILD_PART$1;
this._$committedValue = nothing$1;
this._$disconnectableChildren = undefined;
this._$startNode = startNode;
this._$endNode = endNode;
this._$parent = parent;
this.options = options;
if ((_a = options === null || options === void 0 ? void 0 : options.isConnected) !== null && _a !== void 0) {
this.__isConnected = _a;
} else {
this.__isConnected = true;
}
{
this._textSanitizer = undefined;
}
}
get _$isConnected() {
var _a, _b;
if ((_b = (_a = this._$parent) === null || _a === void 0 ? void 0 : _a._$isConnected) !== null && _b !== void 0) {
return _b;
} else {
return this.__isConnected;
}
}
get parentNode() {
var parentNode = wrap$1(this._$startNode).parentNode;
var parent = this._$parent;
if (parent !== undefined && (parentNode === null || parentNode === void 0 ? void 0 : parentNode.nodeType) === 11) {
parentNode = parent.parentNode;
}
return parentNode;
}
get startNode() {
return this._$startNode;
}
get endNode() {
return this._$endNode;
}
_$setValue(value) {
var directiveParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
var _a;
if (this.parentNode === null) {
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.");
}
value = resolveDirective$1(this, value, directiveParent);
if (isPrimitive$1(value)) {
if (value === nothing$1 || value == null || value === '') {
if (this._$committedValue !== nothing$1) {
if (debugLogEvent$2 === null || debugLogEvent$2 === void 0) {
0;
undefined;
} else {
debugLogEvent$2({
kind: 'commit nothing to child',
start: this._$startNode,
end: this._$endNode,
parent: this._$parent,
options: this.options
});
}
this._$clear();
}
this._$committedValue = nothing$1;
} else if (value !== this._$committedValue && value !== noChange$1) {
this._commitText(value);
}
} else if (value['_$litType$'] !== undefined) {
this._commitTemplateResult(value);
} else if (value.nodeType !== undefined) {
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.host) === value) {
this._commitText("[probable mistake: rendered a template's host in itself " + "(commonly caused by writing ${this} in a template]");
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.");
return;
}
this._commitNode(value);
} else if (isIterable$1(value)) {
this._commitIterable(value);
} else {
this._commitText(value);
}
}
_insert(node) {
return wrap$1(wrap$1(this._$startNode).parentNode).insertBefore(node, this._$endNode);
}
_commitNode(value) {
var _a;
if (this._$committedValue !== value) {
this._$clear();
if (sanitizerFactoryInternal$1 !== noopSanitizer$1) {
var parentNodeName = (_a = this._$startNode.parentNode) === null || _a === void 0 ? void 0 : _a.nodeName;
if (parentNodeName === 'STYLE' || parentNodeName === 'SCRIPT') {
var message = 'Forbidden';
{
if (parentNodeName === 'STYLE') {
message = "Lit does not support binding inside style nodes. " + "This is a security risk, as style injection attacks can " + "exfiltrate data and spoof UIs. " + "Consider instead using css`...` literals " + "to compose styles, and make do dynamic styling with " + "css custom properties, ::parts, <slot>s, " + "and by mutating the DOM rather than stylesheets.";
} else {
message = "Lit does not support binding inside script nodes. " + "This is a security risk, as it could allow arbitrary " + "code execution.";
}
}
throw new Error(message);
}
}
if (debugLogEvent$2 === null || debugLogEvent$2 === void 0) {
0;
undefined;
} else {
debugLogEvent$2({
kind: 'commit node',
start: this._$startNode,
parent: this._$parent,
value: value,
options: this.options
});
}
this._$committedValue = this._insert(value);
}
}
_commitText(value) {
if (this._$committedValue !== nothing$1 && isPrimitive$1(this._$committedValue)) {
var node = wrap$1(this._$startNode).nextSibling;
{
if (this._textSanitizer === undefined) {
this._textSanitizer = createSanitizer$1(node, 'data', 'property');
}
value = this._textSanitizer(value);
}
if (debugLogEvent$2 === null || debugLogEvent$2 === void 0) {
0;
undefined;
} else {
debugLogEvent$2({
kind: 'commit text',
node,
value,
options: this.options
});
}
node.data = value;
} else {
{
var textNode = d$1.createTextNode('');
this._commitNode(textNode);
if (this._textSanitizer === undefined) {
this._textSanitizer = createSanitizer$1(textNode, 'data', 'property');
}
value = this._textSanitizer(value);
if (debugLogEvent$2 === null || debugLogEvent$2 === void 0) {
0;
undefined;
} else {
debugLogEvent$2({
kind: 'commit text',
node: textNode,
value,
options: this.options
});
}
textNode.data = value;
}
}
this._$committedValue = value;
}
_commitTemplateResult(result) {
var _a;
var {
values,
['_$litType$']: type
} = result;
var template = typeof type === 'number' ? this._$getTemplate(result) : (type.el === undefined && (type.el = Template$1.createElement(trustFromTemplateString$1(type.h, type.h[0]), this.options)), type);
if (((_a = this._$committedValue) === null || _a === void 0 ? void 0 : _a._$template) === template) {
if (debugLogEvent$2 === null || debugLogEvent$2 === void 0) {
0;
undefined;
} else {
debugLogEvent$2({
kind: 'template updating',
template,
instance: this._$committedValue,
parts: this._$committedValue._$parts,
options: this.options,
values
});
}
this._$committedValue._update(values);
} else {
var instance = new TemplateInstance$1(template, this);
var fragment = instance._clone(this.options);
if (debugLogEvent$2 === null || debugLogEvent$2 === void 0) {
0;
undefined;
} else {
debugLogEvent$2({
kind: 'template instantiated',
template,
instance,
parts: instance._$parts,
options: this.options,
fragment,
values
});
}
instance._update(values);
if (debugLogEvent$2 === null || debugLogEvent$2 === void 0) {
0;
undefined;
} else {
debugLogEvent$2({
kind: 'template instantiated and updated',
template,
instance,
parts: instance._$parts,
options: this.options,
fragment,
values
});
}
this._commitNode(fragment);
this._$committedValue = instance;
}
}
_$getTemplate(result) {
var template = templateCache$1.get(result.strings);
if (template === undefined) {
templateCache$1.set(result.strings, template = new Template$1(result));
}
return template;
}
_commitIterable(value) {
if (!isArray$1(this._$committedValue)) {
this._$committedValue = [];
this._$clear();
}
var itemParts = this._$committedValue;
var partIndex = 0;
var itemPart;
for (var item of value) {
if (partIndex === itemParts.length) {
itemParts.push(itemPart = new ChildPart$1(this._insert(createMarker$1()), this._insert(createMarker$1()), this, this.options));
} else {
itemPart = itemParts[partIndex];
}
itemPart._$setValue(item);
partIndex++;
}
if (partIndex < itemParts.length) {
this._$clear(itemPart && wrap$1(itemPart._$endNode).nextSibling, partIndex);
itemParts.length = partIndex;
}
}
_$clear() {
var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : wrap$1(this._$startNode).nextSibling;
var from = arguments.length > 1 ? arguments[1] : undefined;
var _a;
if ((_a = this._$notifyConnectionChanged) === null || _a === void 0) {
0;
undefined;
} else {
_a.call(this, false, true, from);
}
while (start && start !== this._$endNode) {
var n = wrap$1(start).nextSibling;
wrap$1(start).remove();
start = n;
}
}
setConnected(isConnected) {
var _a;
if (this._$parent === undefined) {
this.__isConnected = isConnected;
if ((_a = this._$notifyConnectionChanged) === null || _a === void 0) {
0;
undefined;
} else {
_a.call(this, isConnected);
}
} else {
throw new Error('part.setConnected() may only be called on a ' + 'RootPart returned from render().');
}
}
}
class AttributePart$1 {
constructor(element, name, strings, parent, options) {
this.type = ATTRIBUTE_PART$1;
this._$committedValue = nothing$1;
this._$disconnectableChildren = undefined;
this.element = element;
this.name = name;
this._$parent = parent;
this.options = options;
if (strings.length > 2 || strings[0] !== '' || strings[1] !== '') {
this._$committedValue = new Array(strings.length - 1).fill(new String());
this.strings = strings;
} else {
this._$committedValue = nothing$1;
}
{
this._sanitizer = undefined;
}
}
get tagName() {
return this.element.tagName;
}
get _$isConnected() {
return this._$parent._$isConnected;
}
_$setValue(value) {
var directiveParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
var valueIndex = arguments.length > 2 ? arguments[2] : undefined;
var noCommit = arguments.length > 3 ? arguments[3] : undefined;
var strings = this.strings;
var change = false;
if (strings === undefined) {
value = resolveDirective$1(this, value, directiveParent, 0);
change = !isPrimitive$1(value) || value !== this._$committedValue && value !== noChange$1;
if (change) {
this._$committedValue = value;
}
} else {
var values = value;
value = strings[0];
var i, v;
for (i = 0; i < strings.length - 1; i++) {
v = resolveDirective$1(this, values[valueIndex + i], directiveParent, i);
if (v === noChange$1) {
v = this._$committedValue[i];
}
if (!change) {
change = !isPrimitive$1(v) || v !== this._$committedValue[i];
}
if (v === nothing$1) {
value = nothing$1;
} else if (value !== nothing$1) {
value += (v !== null && v !== void 0 ? v : '') + strings[i + 1];
}
this._$committedValue[i] = v;
}
}
if (change && !noCommit) {
this._commitValue(value);
}
}
_commitValue(value) {
if (value === nothing$1) {
wrap$1(this.element).removeAttribute(this.name);
} else {
{
if (this._sanitizer === undefined) {
this._sanitizer = sanitizerFactoryInternal$1(this.element, this.name, 'attribute');
}
value = this._sanitizer(value !== null && value !== void 0 ? value : '');
}
if (debugLogEvent$2 === null || debugLogEvent$2 === void 0) {
0;
undefined;
} else {
debugLogEvent$2({
kind: 'commit attribute',
element: this.element,
name: this.name,
value,
options: this.options
});
}
wrap$1(this.element).setAttribute(this.name, value !== null && value !== void 0 ? value : '');
}
}
}
class PropertyPart$1 extends AttributePart$1 {
constructor() {
super(...arguments);
this.type = PROPERTY_PART$1;
}
_commitValue(value) {
{
if (this._sanitizer === undefined) {
this._sanitizer = sanitizerFactoryInternal$1(this.element, this.name, 'property');
}
value = this._sanitizer(value);
}
if (debugLogEvent$2 === null || debugLogEvent$2 === void 0) {
0;
undefined;
} else {
debugLogEvent$2({
kind: 'commit property',
element: this.element,
name: this.name,
value,
options: this.options
});
}
if (value === nothing$1) {
this.element[this.name] = undefined;
} else {
this.element[this.name] = value;
}
}
}
var emptyStringForBooleanAttribute$2 = trustedTypes$2 ? trustedTypes$2.emptyScript : '';
class BooleanAttributePart$1 extends AttributePart$1 {
constructor() {
super(...arguments);
this.type = BOOLEAN_ATTRIBUTE_PART$1;
}
_commitValue(value) {
if (debugLogEvent$2 === null || debugLogEvent$2 === void 0) {
0;
undefined;
} else {
debugLogEvent$2({
kind: 'commit boolean attribute',
element: this.element,
name: this.name,
value: !!(value && value !== nothing$1),
options: this.options
});
}
if (value && value !== nothing$1) {
wrap$1(this.element).setAttribute(this.name, emptyStringForBooleanAttribute$2);
} else {
wrap$1(this.element).removeAttribute(this.name);
}
}
}
class EventPart$1 extends AttributePart$1 {
constructor(element, name, strings, parent, options) {
super(element, name, strings, parent, options);
this.type = EVENT_PART$1;
if (this.strings !== undefined) {
throw new Error("A `<".concat(element.localName, ">` has a `@").concat(name, "=...` listener with ") + 'invalid content. Event listeners in templates must have exactly ' + 'one expression and no surrounding text.');
}
}
_$setValue(newListener) {
var directiveParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
var _a;
if ((_a = resolveDirective$1(this, newListener, directiveParent, 0)) !== null && _a !== void 0) {
newListener = _a;
} else {
newListener = nothing$1;
}
if (newListener === noChange$1) {
return;
}
var oldListener = this._$committedValue;
var shouldRemoveListener = newListener === nothing$1 && oldListener !== nothing$1 || newListener.capture !== oldListener.capture || newListener.once !== oldListener.once || newListener.passive !== oldListener.passive;
var shouldAddListener = newListener !== nothing$1 && (oldListener === nothing$1 || shouldRemoveListener);
if (debugLogEvent$2 === null || debugLogEvent$2 === void 0) {
0;
undefined;
} else {
debugLogEvent$2({
kind: 'commit event listener',
element: this.element,
name: this.name,
value: newListener,
options: this.options,
removeListener: shouldRemoveListener,
addListener: shouldAddListener,
oldListener
});
}
if (shouldRemoveListener) {
this.element.removeEventListener(this.name, this, oldListener);
}
if (shouldAddListener) {
this.element.addEventListener(this.name, this, newListener);
}
this._$committedValue = newListener;
}
handleEvent(event) {
var _a, _b;
if (typeof this._$committedValue === 'function') {
this._$committedValue.call((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.host) !== null && _b !== void 0 ? _b : this.element, event);
} else {
this._$committedValue.handleEvent(event);
}
}
}
class ElementPart$1 {
constructor(element, parent, options) {
this.element = element;
this.type = ELEMENT_PART$1;
this._$disconnectableChildren = undefined;
this._$parent = parent;
this.options = options;
}
get _$isConnected() {
return this._$parent._$isConnected;
}
_$setValue(value) {
if (debugLogEvent$2 === null || debugLogEvent$2 === void 0) {
0;
undefined;
} else {
debugLogEvent$2({
kind: 'commit to element binding',
element: this.element,
value,
options: this.options
});
}
resolveDirective$1(this, value);
}
}
var polyfillSupport$4 = global$6.litHtmlPolyfillSupportDevMode;
if (polyfillSupport$4 === null || polyfillSupport$4 === void 0) {
0;
undefined;
} else {
polyfillSupport$4(Template$1, ChildPart$1);
}
((_d$2 = global$6.litHtmlVersions) !== null && _d$2 !== void 0 ? _d$2 : global$6.litHtmlVersions = []).push('2.8.0');
if (global$6.litHtmlVersions.length > 1) {
issueWarning$4('multiple-versions', "Multiple versions of Lit loaded. " + "Loading multiple versions is not recommended.");
}
var render$1 = (value, container, options) => {
var _a, _b;
if (container == null) {
throw new TypeError("The container to render into may not be ".concat(container));
}
var renderId = debugLogRenderId$1++;
var partOwnerNode = (_a = options === null || options === void 0 ? void 0 : options.renderBefore) !== null && _a !== void 0 ? _a : container;
var part = partOwnerNode['_$litPart$'];
if (debugLogEvent$2 === null || debugLogEvent$2 === void 0) {
0;
undefined;
} else {
debugLogEvent$2({
kind: 'begin render',
id: renderId,
value,
container,
options,
part
});
}
if (part === undefined) {
var endNode = (_b = options === null || options === void 0 ? void 0 : options.renderBefore) !== null && _b !== void 0 ? _b : null;
partOwnerNode['_$litPart$'] = part = new ChildPart$1(container.insertBefore(createMarker$1(), endNode), endNode, undefined, options !== null && options !== void 0 ? options : {});
}
part._$setValue(value);
if (debugLogEvent$2 === null || debugLogEvent$2 === void 0) {
0;
undefined;
} else {
debugLogEvent$2({
kind: 'end render',
id: renderId,
value,
container,
options,
part
});
}
return part;
};
{
render$1.setSanitizer = setSanitizer$1;
render$1.createSanitizer = createSanitizer$1;
{
render$1._testOnlyClearSanitizerFactoryDoNotCallOrElse = _testOnlyClearSanitizerFactoryDoNotCallOrElse$1;
}
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var _a$4, _b$3, _c$3;
var issueWarning$3;
{
var _issuedWarnings7 = (_a$4 = globalThis.litIssuedWarnings) !== null && _a$4 !== void 0 ? _a$4 : globalThis.litIssuedWarnings = new Set();
issueWarning$3 = (code, warning) => {
warning += " See https://lit.dev/msg/".concat(code, " for more information.");
if (!_issuedWarnings7.has(warning)) {
console.warn(warning);
_issuedWarnings7.add(warning);
}
};
}
class LitElement$1 extends ReactiveElement$1 {
constructor() {
super(...arguments);
this.renderOptions = {
host: this
};
this.__childPart = undefined;
}
createRenderRoot() {
var _a;
var _b;
var renderRoot = super.createRenderRoot();
if ((_a = (_b = this.renderOptions).renderBefore) !== null && _a !== void 0) {
_a;
} else {
_b.renderBefore = renderRoot.firstChild;
}
return renderRoot;
}
update(changedProperties) {
var value = this.render();
if (!this.hasUpdated) {
this.renderOptions.isConnected = this.isConnected;
}
super.update(changedProperties);
this.__childPart = render$1(value, this.renderRoot, this.renderOptions);
}
connectedCallback() {
var _a;
super.connectedCallback();
if ((_a = this.__childPart) === null || _a === void 0) {
0;
undefined;
} else {
_a.setConnected(true);
}
}
disconnectedCallback() {
var _a;
super.disconnectedCallback();
if ((_a = this.__childPart) === null || _a === void 0) {
0;
undefined;
} else {
_a.setConnected(false);
}
}
render() {
return noChange$1;
}
}
LitElement$1['finalized'] = true;
LitElement$1['_$litElement$'] = true;
if ((_b$3 = globalThis.litElementHydrateSupport) === null || _b$3 === void 0) {
0;
undefined;
} else {
_b$3.call(globalThis, {
LitElement: LitElement$1
});
}
var polyfillSupport$3 = globalThis.litElementPolyfillSupportDevMode;
if (polyfillSupport$3 === null || polyfillSupport$3 === void 0) {
0;
undefined;
} else {
polyfillSupport$3({
LitElement: LitElement$1
});
}
{
LitElement$1['finalize'] = function () {
var finalized = ReactiveElement$1.finalize.call(this);
if (!finalized) {
return false;
}
var warnRemovedOrRenamed = function warnRemovedOrRenamed(obj, name) {
var renamed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (obj.hasOwnProperty(name)) {
var ctorName = (typeof obj === 'function' ? obj : obj.constructor).name;
issueWarning$3(renamed ? 'renamed-api' : 'removed-api', "`".concat(name, "` is implemented on class ").concat(ctorName, ". It ") + "has been ".concat(renamed ? 'renamed' : 'removed', " ") + "in this version of LitElement.");
}
};
warnRemovedOrRenamed(this, 'render');
warnRemovedOrRenamed(this, 'getStyles', true);
warnRemovedOrRenamed(this.prototype, 'adoptStyles');
return true;
};
}
((_c$3 = globalThis.litElementVersions) !== null && _c$3 !== void 0 ? _c$3 : globalThis.litElementVersions = []).push('3.3.3');
if (globalThis.litElementVersions.length > 1) {
issueWarning$3('multiple-versions', "Multiple versions of Lit loaded. Loading multiple versions " + "is not recommended.");
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var standardProperty$1 = (options, element) => {
if (element.kind === 'method' && element.descriptor && !('value' in element.descriptor)) {
return _objectSpread(_objectSpread({}, element), {}, {
finisher(clazz) {
clazz.createProperty(element.key, options);
}
});
} else {
return {
kind: 'field',
key: Symbol(),
placement: 'own',
descriptor: {},
originalKey: element.key,
initializer() {
if (typeof element.initializer === 'function') {
this[element.key] = element.initializer.call(this);
}
},
finisher(clazz) {
clazz.createProperty(element.key, options);
}
};
}
};
var legacyProperty$1 = (options, proto, name) => {
proto.constructor.createProperty(name, options);
};
function property$1(options) {
return (protoOrDescriptor, name) => name !== undefined ? legacyProperty$1(options, protoOrDescriptor, name) : standardProperty$1(options, protoOrDescriptor);
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function state$1(options) {
return property$1(_objectSpread(_objectSpread({}, options), {}, {
state: true
}));
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var decorateProperty$1 = _ref15 => {
var {
finisher,
descriptor
} = _ref15;
return (protoOrDescriptor, name) => {
var _a;
if (name !== undefined) {
var ctor = protoOrDescriptor.constructor;
if (descriptor !== undefined) {
Object.defineProperty(protoOrDescriptor, name, descriptor(name));
}
if (finisher === null || finisher === void 0) {
0;
undefined;
} else {
finisher(ctor, name);
}
} else {
var key = (_a = protoOrDescriptor.originalKey) !== null && _a !== void 0 ? _a : protoOrDescriptor.key;
var info = descriptor != undefined ? {
kind: 'method',
placement: 'prototype',
key,
descriptor: descriptor(protoOrDescriptor.key)
} : _objectSpread(_objectSpread({}, protoOrDescriptor), {}, {
key
});
if (finisher != undefined) {
info.finisher = function (ctor) {
finisher(ctor, key);
};
}
return info;
}
};
};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function query$1(selector, cache) {
return decorateProperty$1({
descriptor: name => {
var descriptor = {
get() {
var _a, _b;
if ((_b = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(selector)) !== null && _b !== void 0) {
return _b;
} else {
return null;
}
},
enumerable: true,
configurable: true
};
if (cache) {
var key = typeof name === 'symbol' ? Symbol() : "__".concat(name);
descriptor.get = function () {
var _a, _b;
if (this[key] === undefined) {
if ((_b = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(selector)) !== null && _b !== void 0) {
this[key] = _b;
} else {
this[key] = null;
}
}
return this[key];
};
}
return descriptor;
}
});
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function queryAsync(selector) {
return decorateProperty$1({
descriptor: _name => ({
get() {
var _this12 = this;
return _asyncToGenerator(function* () {
var _a;
yield _this12.updateComplete;
if ((_a = _this12.renderRoot) === null || _a === void 0) {
0;
return;
} else {
return _a.querySelector(selector);
}
})();
},
enumerable: true,
configurable: true
})
});
}
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var _a$3;
var global$5 = window;
var slotAssignedElements = ((_a$3 = global$5.HTMLSlotElement) === null || _a$3 === void 0 ? void 0 : _a$3.prototype.assignedElements) != null ? (slot, opts) => slot.assignedElements(opts) : (slot, opts) => slot.assignedNodes(opts).filter(node => node.nodeType === Node.ELEMENT_NODE);
function queryAssignedElements(options) {
var {
slot,
selector
} = options !== null && options !== void 0 ? options : {};
return decorateProperty$1({
descriptor: _name => ({
get() {
var _a;
var slotSelector = "slot".concat(slot ? "[name=".concat(slot, "]") : ':not([name])');
var slotEl = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(slotSelector);
var elements = slotEl != null ? slotAssignedElements(slotEl, options) : [];
if (selector) {
return elements.filter(node => node.matches(selector));
}
return elements;
},
enumerable: true,
configurable: true
})
});
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function queryAssignedNodes(slotOrOptions, flatten, selector) {
var slot = slotOrOptions;
var assignedNodesOptions;
if (typeof slotOrOptions === 'object') {
slot = slotOrOptions.slot;
assignedNodesOptions = slotOrOptions;
} else {
assignedNodesOptions = {
flatten
};
}
if (selector) {
return queryAssignedElements({
slot: slot,
flatten,
selector
});
}
return decorateProperty$1({
descriptor: _name => ({
get() {
var _a, _b;
var slotSelector = "slot".concat(slot ? "[name=".concat(slot, "]") : ':not([name])');
var slotEl = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(slotSelector);
if ((_b = slotEl === null || slotEl === void 0 ? void 0 : slotEl.assignedNodes(assignedNodesOptions)) !== null && _b !== void 0) {
return _b;
} else {
return [];
}
},
enumerable: true,
configurable: true
})
});
}
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var ifDefined = value => value !== null && value !== void 0 ? value : nothing$1;
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
function debounceLayout(callback) {
var waitInMS = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 50;
var timeoutId;
return function () {
var updateItems = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
clearTimeout(timeoutId);
timeoutId = setTimeout(() => {
callback(updateItems);
}, waitInMS);
};
}
var isListItem = element => {
return element.hasAttribute('mwc-list-item');
};
function clearAndCreateItemsReadyPromise() {
var oldResolver = this.itemsReadyResolver;
this.itemsReady = new Promise(res => {
return this.itemsReadyResolver = res;
});
oldResolver();
}
class ListBase extends BaseElement {
constructor() {
var _this13;
super();
_this13 = this;
this.mdcAdapter = null;
this.mdcFoundationClass = MDCListFoundation;
this.activatable = false;
this.multi = false;
this.wrapFocus = false;
this.itemRoles = null;
this.innerRole = null;
this.innerAriaLabel = null;
this.rootTabbable = false;
this.previousTabindex = null;
this.noninteractive = false;
this.itemsReadyResolver = () => {};
this.itemsReady = Promise.resolve([]);
this.items_ = [];
var debouncedFunction = debounceLayout(this.layout.bind(this));
this.debouncedLayout = function () {
var updateItems = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
clearAndCreateItemsReadyPromise.call(_this13);
debouncedFunction(updateItems);
};
}
getUpdateComplete() {
var _superprop_getGetUpdateComplete2 = () => super.getUpdateComplete;
var _this14 = this;
return _asyncToGenerator(function* () {
var result = yield _superprop_getGetUpdateComplete2().call(_this14);
yield _this14.itemsReady;
return result;
})();
}
get items() {
return this.items_;
}
updateItems() {
var _a;
var nodes = (_a = this.assignedElements) !== null && _a !== void 0 ? _a : [];
var listItems = [];
for (var node of nodes) {
if (isListItem(node)) {
listItems.push(node);
node._managingList = this;
}
if (node.hasAttribute('divider') && !node.hasAttribute('role')) {
node.setAttribute('role', 'separator');
}
}
this.items_ = listItems;
var selectedIndices = new Set();
this.items_.forEach((item, index) => {
if (this.itemRoles) {
item.setAttribute('role', this.itemRoles);
} else {
item.removeAttribute('role');
}
if (item.selected) {
selectedIndices.add(index);
}
});
if (this.multi) {
this.select(selectedIndices);
} else {
var _index2 = selectedIndices.size ? selectedIndices.entries().next().value[1] : -1;
this.select(_index2);
}
var itemsUpdatedEv = new Event('items-updated', {
bubbles: true,
composed: true
});
this.dispatchEvent(itemsUpdatedEv);
}
get selected() {
var index = this.index;
if (!isIndexSet(index)) {
if (index === -1) {
return null;
}
return this.items[index];
}
var selected = [];
for (var entry of index) {
selected.push(this.items[entry]);
}
return selected;
}
get index() {
if (this.mdcFoundation) {
return this.mdcFoundation.getSelectedIndex();
}
return -1;
}
render() {
var role = this.innerRole === null ? undefined : this.innerRole;
var ariaLabel = this.innerAriaLabel === null ? undefined : this.innerAriaLabel;
var tabindex = this.rootTabbable ? '0' : '-1';
return html$1(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n <!-- @ts-ignore -->\n <ul\n tabindex=", "\n role=\"", "\"\n aria-label=\"", "\"\n class=\"mdc-deprecated-list\"\n @keydown=", "\n @focusin=", "\n @focusout=", "\n @request-selected=", "\n @list-item-rendered=", ">\n <slot></slot>\n ", "\n </ul>\n "])), tabindex, ifDefined(role), ifDefined(ariaLabel), this.onKeydown, this.onFocusIn, this.onFocusOut, this.onRequestSelected, this.onListItemConnected, this.renderPlaceholder());
}
renderPlaceholder() {
var _a;
var nodes = (_a = this.assignedElements) !== null && _a !== void 0 ? _a : [];
if (this.emptyMessage !== undefined && nodes.length === 0) {
return html$1(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n <mwc-list-item noninteractive>", "</mwc-list-item>\n "])), this.emptyMessage);
}
return null;
}
firstUpdated() {
super.firstUpdated();
if (!this.items.length) {
this.mdcFoundation.setMulti(this.multi);
this.layout();
}
}
onFocusIn(evt) {
if (this.mdcFoundation && this.mdcRoot) {
var _index3 = this.getIndexOfTarget(evt);
this.mdcFoundation.handleFocusIn(evt, _index3);
}
}
onFocusOut(evt) {
if (this.mdcFoundation && this.mdcRoot) {
var _index4 = this.getIndexOfTarget(evt);
this.mdcFoundation.handleFocusOut(evt, _index4);
}
}
onKeydown(evt) {
if (this.mdcFoundation && this.mdcRoot) {
var _index5 = this.getIndexOfTarget(evt);
var target = evt.target;
var isRootListItem = isListItem(target);
this.mdcFoundation.handleKeydown(evt, isRootListItem, _index5);
}
}
onRequestSelected(evt) {
if (this.mdcFoundation) {
var _index6 = this.getIndexOfTarget(evt);
if (_index6 === -1) {
this.layout();
_index6 = this.getIndexOfTarget(evt);
if (_index6 === -1) {
return;
}
}
var element = this.items[_index6];
if (element.disabled) {
return;
}
var selected = evt.detail.selected;
var source = evt.detail.source;
this.mdcFoundation.handleSingleSelection(_index6, source === 'interaction', selected);
evt.stopPropagation();
}
}
getIndexOfTarget(evt) {
var elements = this.items;
var path = evt.composedPath();
for (var pathItem of path) {
var _index7 = -1;
if (isNodeElement(pathItem) && isListItem(pathItem)) {
_index7 = elements.indexOf(pathItem);
}
if (_index7 !== -1) {
return _index7;
}
}
return -1;
}
createAdapter() {
this.mdcAdapter = {
getListItemCount: () => {
if (this.mdcRoot) {
return this.items.length;
}
return 0;
},
getFocusedElementIndex: this.getFocusedItemIndex,
getAttributeForElementIndex: (index, attr) => {
var listElement = this.mdcRoot;
if (!listElement) {
return '';
}
var element = this.items[index];
if (element) {
return element.getAttribute(attr);
} else {
return '';
}
},
setAttributeForElementIndex: (index, attr, val) => {
if (!this.mdcRoot) {
return;
}
var element = this.items[index];
if (element) {
element.setAttribute(attr, val);
}
},
focusItemAtIndex: index => {
var element = this.items[index];
if (element) {
element.focus();
}
},
setTabIndexForElementIndex: (index, value) => {
var item = this.items[index];
if (item) {
item.tabindex = value;
}
},
notifyAction: index => {
var init = {
bubbles: true,
composed: true
};
init.detail = {
index
};
var ev = new CustomEvent('action', init);
this.dispatchEvent(ev);
},
notifySelected: (index, diff) => {
var init = {
bubbles: true,
composed: true
};
init.detail = {
index,
diff
};
var ev = new CustomEvent('selected', init);
this.dispatchEvent(ev);
},
isFocusInsideList: () => {
return doesElementContainFocus(this);
},
isRootFocused: () => {
var mdcRoot = this.mdcRoot;
var root = mdcRoot.getRootNode();
return root.activeElement === mdcRoot;
},
setDisabledStateForElementIndex: (index, value) => {
var item = this.items[index];
if (!item) {
return;
}
item.disabled = value;
},
getDisabledStateForElementIndex: index => {
var item = this.items[index];
if (!item) {
return false;
}
return item.disabled;
},
setSelectedStateForElementIndex: (index, value) => {
var item = this.items[index];
if (!item) {
return;
}
item.selected = value;
},
getSelectedStateForElementIndex: index => {
var item = this.items[index];
if (!item) {
return false;
}
return item.selected;
},
setActivatedStateForElementIndex: (index, value) => {
var item = this.items[index];
if (!item) {
return;
}
item.activated = value;
}
};
return this.mdcAdapter;
}
selectUi(index) {
var activate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var item = this.items[index];
if (item) {
item.selected = true;
item.activated = activate;
}
}
deselectUi(index) {
var item = this.items[index];
if (item) {
item.selected = false;
item.activated = false;
}
}
select(index) {
if (!this.mdcFoundation) {
return;
}
this.mdcFoundation.setSelectedIndex(index);
}
toggle(index, force) {
if (this.multi) {
this.mdcFoundation.toggleMultiAtIndex(index, force);
}
}
onListItemConnected(e) {
var target = e.target;
this.layout(this.items.indexOf(target) === -1);
}
layout() {
var updateItems = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
if (updateItems) {
this.updateItems();
}
var first = this.items[0];
for (var item of this.items) {
item.tabindex = -1;
}
if (first) {
if (this.noninteractive) {
if (!this.previousTabindex) {
this.previousTabindex = first;
}
} else {
first.tabindex = 0;
}
}
this.itemsReadyResolver();
}
getFocusedItemIndex() {
if (!this.mdcRoot) {
return -1;
}
if (!this.items.length) {
return -1;
}
var activeElementPath = deepActiveElementPath();
if (!activeElementPath.length) {
return -1;
}
for (var i = activeElementPath.length - 1; i >= 0; i--) {
var activeItem = activeElementPath[i];
if (isListItem(activeItem)) {
return this.items.indexOf(activeItem);
}
}
return -1;
}
focusItemAtIndex(index) {
for (var item of this.items) {
if (item.tabindex === 0) {
item.tabindex = -1;
break;
}
}
this.items[index].tabindex = 0;
this.items[index].focus();
}
focus() {
var root = this.mdcRoot;
if (root) {
root.focus();
}
}
blur() {
var root = this.mdcRoot;
if (root) {
root.blur();
}
}
}
__decorate([property$1({
type: String
})], ListBase.prototype, "emptyMessage", void 0);
__decorate([query$1('.mdc-deprecated-list')], ListBase.prototype, "mdcRoot", void 0);
__decorate([queryAssignedNodes('', true, '*')], ListBase.prototype, "assignedElements", void 0);
__decorate([queryAssignedNodes('', true, '[tabindex="0"]')], ListBase.prototype, "tabbableElements", void 0);
__decorate([property$1({
type: Boolean
}), observer(function (value) {
if (this.mdcFoundation) {
this.mdcFoundation.setUseActivatedClass(value);
}
})], ListBase.prototype, "activatable", void 0);
__decorate([property$1({
type: Boolean
}), observer(function (newValue, oldValue) {
if (this.mdcFoundation) {
this.mdcFoundation.setMulti(newValue);
}
if (oldValue !== undefined) {
this.layout();
}
})], ListBase.prototype, "multi", void 0);
__decorate([property$1({
type: Boolean
}), observer(function (value) {
if (this.mdcFoundation) {
this.mdcFoundation.setWrapFocus(value);
}
})], ListBase.prototype, "wrapFocus", void 0);
__decorate([property$1({
type: String
}), observer(function (_newValue, oldValue) {
if (oldValue !== undefined) {
this.updateItems();
}
})], ListBase.prototype, "itemRoles", void 0);
__decorate([property$1({
type: String
})], ListBase.prototype, "innerRole", void 0);
__decorate([property$1({
type: String
})], ListBase.prototype, "innerAriaLabel", void 0);
__decorate([property$1({
type: Boolean
})], ListBase.prototype, "rootTabbable", void 0);
__decorate([property$1({
type: Boolean,
reflect: true
}), observer(function (value) {
var _a, _b;
if (value) {
var tabbable = (_b = (_a = this.tabbableElements) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : null;
this.previousTabindex = tabbable;
if (tabbable) {
tabbable.setAttribute('tabindex', '-1');
}
} else if (!value && this.previousTabindex) {
this.previousTabindex.setAttribute('tabindex', '0');
this.previousTabindex = null;
}
})], ListBase.prototype, "noninteractive", void 0);
/**
* @license
* Copyright 2021 Google LLC
* SPDX-LIcense-Identifier: Apache-2.0
*/
var styles$2 = css$1(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}:host{display:block}.mdc-deprecated-list{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-subtitle1-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:1rem;font-size:var(--mdc-typography-subtitle1-font-size, 1rem);line-height:1.75rem;line-height:var(--mdc-typography-subtitle1-line-height, 1.75rem);font-weight:400;font-weight:var(--mdc-typography-subtitle1-font-weight, 400);letter-spacing:0.009375em;letter-spacing:var(--mdc-typography-subtitle1-letter-spacing, 0.009375em);text-decoration:inherit;text-decoration:var(--mdc-typography-subtitle1-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-subtitle1-text-transform, inherit);line-height:1.5rem;margin:0;padding:8px 0;list-style-type:none;color:rgba(0, 0, 0, 0.87);color:var(--mdc-theme-text-primary-on-background, rgba(0, 0, 0, 0.87));padding:var(--mdc-list-vertical-padding, 8px) 0}.mdc-deprecated-list:focus{outline:none}.mdc-deprecated-list-item{height:48px}.mdc-deprecated-list--dense{padding-top:4px;padding-bottom:4px;font-size:.812rem}.mdc-deprecated-list ::slotted([divider]){height:0;margin:0;border:none;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgba(0, 0, 0, 0.12)}.mdc-deprecated-list ::slotted([divider][padded]){margin:0 var(--mdc-list-side-padding, 16px)}.mdc-deprecated-list ::slotted([divider][inset]){margin-left:var(--mdc-list-inset-margin, 72px);margin-right:0;width:calc( 100% - var(--mdc-list-inset-margin, 72px) )}[dir=rtl] .mdc-deprecated-list ::slotted([divider][inset]),.mdc-deprecated-list ::slotted([divider][inset][dir=rtl]){margin-left:0;margin-right:var(--mdc-list-inset-margin, 72px)}.mdc-deprecated-list ::slotted([divider][inset][padded]){width:calc( 100% - var(--mdc-list-inset-margin, 72px) - var(--mdc-list-side-padding, 16px) )}.mdc-deprecated-list--dense ::slotted([mwc-list-item]){height:40px}.mdc-deprecated-list--dense ::slotted([mwc-list]){--mdc-list-item-graphic-size: 20px}.mdc-deprecated-list--two-line.mdc-deprecated-list--dense ::slotted([mwc-list-item]),.mdc-deprecated-list--avatar-list.mdc-deprecated-list--dense ::slotted([mwc-list-item]){height:60px}.mdc-deprecated-list--avatar-list.mdc-deprecated-list--dense ::slotted([mwc-list]){--mdc-list-item-graphic-size: 36px}:host([noninteractive]){pointer-events:none;cursor:default}.mdc-deprecated-list--dense ::slotted(.mdc-deprecated-list-item__primary-text){display:block;margin-top:0;line-height:normal;margin-bottom:-20px}.mdc-deprecated-list--dense ::slotted(.mdc-deprecated-list-item__primary-text)::before{display:inline-block;width:0;height:24px;content:\"\";vertical-align:0}.mdc-deprecated-list--dense ::slotted(.mdc-deprecated-list-item__primary-text)::after{display:inline-block;width:0;height:20px;content:\"\";vertical-align:-20px}"])));
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
class RippleHandlers {
constructor(rippleFn) {
this.startPress = ev => {
rippleFn().then(r => {
if (r) {
r.startPress(ev);
}
});
};
this.endPress = () => {
rippleFn().then(r => {
if (r) {
r.endPress();
}
});
};
this.startFocus = () => {
rippleFn().then(r => {
if (r) {
r.startFocus();
}
});
};
this.endFocus = () => {
rippleFn().then(r => {
if (r) {
r.endFocus();
}
});
};
this.startHover = () => {
rippleFn().then(r => {
if (r) {
r.startHover();
}
});
};
this.endHover = () => {
rippleFn().then(r => {
if (r) {
r.endHover();
}
});
};
}
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var PartType$1 = {
ATTRIBUTE: 1,
CHILD: 2,
PROPERTY: 3,
BOOLEAN_ATTRIBUTE: 4,
EVENT: 5,
ELEMENT: 6
};
var directive$1 = c => function () {
for (var _len9 = arguments.length, values = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
values[_key9] = arguments[_key9];
}
return {
['_$litDirective$']: c,
values
};
};
class Directive$1 {
constructor(_partInfo) {}
get _$isConnected() {
return this._$parent._$isConnected;
}
_$initialize(part, parent, attributeIndex) {
this.__part = part;
this._$parent = parent;
this.__attributeIndex = attributeIndex;
}
_$resolve(part, props) {
return this.update(part, props);
}
update(_part, props) {
return this.render(...props);
}
}
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
class ClassMapDirective$1 extends Directive$1 {
constructor(partInfo) {
var _a;
super(partInfo);
if (partInfo.type !== PartType$1.ATTRIBUTE || partInfo.name !== 'class' || ((_a = partInfo.strings) === null || _a === void 0 ? void 0 : _a.length) > 2) {
throw new Error('`classMap()` can only be used in the `class` attribute ' + 'and must be the only part in the attribute.');
}
}
render(classInfo) {
return ' ' + Object.keys(classInfo).filter(key => classInfo[key]).join(' ') + ' ';
}
update(part, _ref16) {
var [classInfo] = _ref16;
var _a, _b;
if (this._previousClasses === undefined) {
this._previousClasses = new Set();
if (part.strings !== undefined) {
this._staticClasses = new Set(part.strings.join(' ').split(/\s/).filter(s => s !== ''));
}
for (var name in classInfo) {
if (classInfo[name] && !((_a = this._staticClasses) === null || _a === void 0 ? void 0 : _a.has(name))) {
this._previousClasses.add(name);
}
}
return this.render(classInfo);
}
var classList = part.element.classList;
this._previousClasses.forEach(name => {
if (!(name in classInfo)) {
classList.remove(name);
this._previousClasses.delete(name);
}
});
for (var _name10 in classInfo) {
var value = !!classInfo[_name10];
if (value !== this._previousClasses.has(_name10) && !((_b = this._staticClasses) === null || _b === void 0 ? void 0 : _b.has(_name10))) {
if (value) {
classList.add(_name10);
this._previousClasses.add(_name10);
} else {
classList.remove(_name10);
this._previousClasses.delete(_name10);
}
}
}
return noChange$1;
}
}
var classMap$1 = directive$1(ClassMapDirective$1);
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
class ListItemBase extends LitElement$1 {
constructor() {
super(...arguments);
this.value = '';
this.group = null;
this.tabindex = -1;
this.disabled = false;
this.twoline = false;
this.activated = false;
this.graphic = null;
this.multipleGraphics = false;
this.hasMeta = false;
this.noninteractive = false;
this.selected = false;
this.shouldRenderRipple = false;
this._managingList = null;
this.boundOnClick = this.onClick.bind(this);
this._firstChanged = true;
this._skipPropRequest = false;
this.rippleHandlers = new RippleHandlers(() => {
this.shouldRenderRipple = true;
return this.ripple;
});
this.listeners = [{
target: this,
eventNames: ['click'],
cb: () => {
this.onClick();
}
}, {
target: this,
eventNames: ['mouseenter'],
cb: this.rippleHandlers.startHover
}, {
target: this,
eventNames: ['mouseleave'],
cb: this.rippleHandlers.endHover
}, {
target: this,
eventNames: ['focus'],
cb: this.rippleHandlers.startFocus
}, {
target: this,
eventNames: ['blur'],
cb: this.rippleHandlers.endFocus
}, {
target: this,
eventNames: ['mousedown', 'touchstart'],
cb: e => {
var name = e.type;
this.onDown(name === 'mousedown' ? 'mouseup' : 'touchend', e);
}
}];
}
get text() {
var textContent = this.textContent;
if (textContent) {
return textContent.trim();
} else {
return '';
}
}
render() {
var text = this.renderText();
var graphic = this.graphic ? this.renderGraphic() : html$1(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral([""])));
var meta = this.hasMeta ? this.renderMeta() : html$1(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral([""])));
return html$1(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["\n ", "\n ", "\n ", "\n ", ""])), this.renderRipple(), graphic, text, meta);
}
renderRipple() {
if (this.shouldRenderRipple) {
return html$1(_templateObject25 || (_templateObject25 = _taggedTemplateLiteral(["\n <mwc-ripple\n .activated=", ">\n </mwc-ripple>"])), this.activated);
} else if (this.activated) {
return html$1(_templateObject26 || (_templateObject26 = _taggedTemplateLiteral(["<div class=\"fake-activated-ripple\"></div>"])));
} else {
return '';
}
}
renderGraphic() {
var graphicClasses = {
multi: this.multipleGraphics
};
return html$1(_templateObject27 || (_templateObject27 = _taggedTemplateLiteral(["\n <span class=\"mdc-deprecated-list-item__graphic material-icons ", "\">\n <slot name=\"graphic\"></slot>\n </span>"])), classMap$1(graphicClasses));
}
renderMeta() {
return html$1(_templateObject28 || (_templateObject28 = _taggedTemplateLiteral(["\n <span class=\"mdc-deprecated-list-item__meta material-icons\">\n <slot name=\"meta\"></slot>\n </span>"])));
}
renderText() {
var inner = this.twoline ? this.renderTwoline() : this.renderSingleLine();
return html$1(_templateObject29 || (_templateObject29 = _taggedTemplateLiteral(["\n <span class=\"mdc-deprecated-list-item__text\">\n ", "\n </span>"])), inner);
}
renderSingleLine() {
return html$1(_templateObject30 || (_templateObject30 = _taggedTemplateLiteral(["<slot></slot>"])));
}
renderTwoline() {
return html$1(_templateObject31 || (_templateObject31 = _taggedTemplateLiteral(["\n <span class=\"mdc-deprecated-list-item__primary-text\">\n <slot></slot>\n </span>\n <span class=\"mdc-deprecated-list-item__secondary-text\">\n <slot name=\"secondary\"></slot>\n </span>\n "])));
}
onClick() {
this.fireRequestSelected(!this.selected, 'interaction');
}
onDown(upName, evt) {
var onUp = () => {
window.removeEventListener(upName, onUp);
this.rippleHandlers.endPress();
};
window.addEventListener(upName, onUp);
this.rippleHandlers.startPress(evt);
}
fireRequestSelected(selected, source) {
if (this.noninteractive) {
return;
}
var customEv = new CustomEvent('request-selected', {
bubbles: true,
composed: true,
detail: {
source,
selected
}
});
this.dispatchEvent(customEv);
}
connectedCallback() {
super.connectedCallback();
if (!this.noninteractive) {
this.setAttribute('mwc-list-item', '');
}
for (var listener of this.listeners) {
for (var eventName of listener.eventNames) {
listener.target.addEventListener(eventName, listener.cb, {
passive: true
});
}
}
}
disconnectedCallback() {
super.disconnectedCallback();
for (var listener of this.listeners) {
for (var eventName of listener.eventNames) {
listener.target.removeEventListener(eventName, listener.cb);
}
}
if (this._managingList) {
if (this._managingList.debouncedLayout) {
this._managingList.debouncedLayout(true);
} else {
this._managingList.layout(true);
}
}
}
firstUpdated() {
var ev = new Event('list-item-rendered', {
bubbles: true,
composed: true
});
this.dispatchEvent(ev);
}
}
__decorate([query$1('slot')], ListItemBase.prototype, "slotElement", void 0);
__decorate([queryAsync('mwc-ripple')], ListItemBase.prototype, "ripple", void 0);
__decorate([property$1({
type: String
})], ListItemBase.prototype, "value", void 0);
__decorate([property$1({
type: String,
reflect: true
})], ListItemBase.prototype, "group", void 0);
__decorate([property$1({
type: Number,
reflect: true
})], ListItemBase.prototype, "tabindex", void 0);
__decorate([property$1({
type: Boolean,
reflect: true
}), observer(function (value) {
if (value) {
this.setAttribute('aria-disabled', 'true');
} else {
this.setAttribute('aria-disabled', 'false');
}
})], ListItemBase.prototype, "disabled", void 0);
__decorate([property$1({
type: Boolean,
reflect: true
})], ListItemBase.prototype, "twoline", void 0);
__decorate([property$1({
type: Boolean,
reflect: true
})], ListItemBase.prototype, "activated", void 0);
__decorate([property$1({
type: String,
reflect: true
})], ListItemBase.prototype, "graphic", void 0);
__decorate([property$1({
type: Boolean
})], ListItemBase.prototype, "multipleGraphics", void 0);
__decorate([property$1({
type: Boolean
})], ListItemBase.prototype, "hasMeta", void 0);
__decorate([property$1({
type: Boolean,
reflect: true
}), observer(function (value) {
if (value) {
this.removeAttribute('aria-checked');
this.removeAttribute('mwc-list-item');
this.selected = false;
this.activated = false;
this.tabIndex = -1;
} else {
this.setAttribute('mwc-list-item', '');
}
})], ListItemBase.prototype, "noninteractive", void 0);
__decorate([property$1({
type: Boolean,
reflect: true
}), observer(function (value) {
var role = this.getAttribute('role');
var isAriaSelectable = role === 'gridcell' || role === 'option' || role === 'row' || role === 'tab';
if (isAriaSelectable && value) {
this.setAttribute('aria-selected', 'true');
} else if (isAriaSelectable) {
this.setAttribute('aria-selected', 'false');
}
if (this._firstChanged) {
this._firstChanged = false;
return;
}
if (this._skipPropRequest) {
return;
}
this.fireRequestSelected(value, 'property');
})], ListItemBase.prototype, "selected", void 0);
__decorate([state$1()], ListItemBase.prototype, "shouldRenderRipple", void 0);
__decorate([state$1()], ListItemBase.prototype, "_managingList", void 0);
/**
* @license
* Copyright 2021 Google LLC
* SPDX-LIcense-Identifier: Apache-2.0
*/
var styles$1 = css$1(_templateObject32 || (_templateObject32 = _taggedTemplateLiteral([":host{cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent;height:48px;display:flex;position:relative;align-items:center;justify-content:flex-start;overflow:hidden;padding:0;padding-left:var(--mdc-list-side-padding, 16px);padding-right:var(--mdc-list-side-padding, 16px);outline:none;height:48px;color:rgba(0,0,0,.87);color:var(--mdc-theme-text-primary-on-background, rgba(0, 0, 0, 0.87))}:host:focus{outline:none}:host([activated]){color:#6200ee;color:var(--mdc-theme-primary, #6200ee);--mdc-ripple-color: var( --mdc-theme-primary, #6200ee )}:host([activated]) .mdc-deprecated-list-item__graphic{color:#6200ee;color:var(--mdc-theme-primary, #6200ee)}:host([activated]) .fake-activated-ripple::before{position:absolute;display:block;top:0;bottom:0;left:0;right:0;width:100%;height:100%;pointer-events:none;z-index:1;content:\"\";opacity:0.12;opacity:var(--mdc-ripple-activated-opacity, 0.12);background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-deprecated-list-item__graphic{flex-shrink:0;align-items:center;justify-content:center;fill:currentColor;display:inline-flex}.mdc-deprecated-list-item__graphic ::slotted(*){flex-shrink:0;align-items:center;justify-content:center;fill:currentColor;width:100%;height:100%;text-align:center}.mdc-deprecated-list-item__meta{width:var(--mdc-list-item-meta-size, 24px);height:var(--mdc-list-item-meta-size, 24px);margin-left:auto;margin-right:0;color:rgba(0, 0, 0, 0.38);color:var(--mdc-theme-text-hint-on-background, rgba(0, 0, 0, 0.38))}.mdc-deprecated-list-item__meta.multi{width:auto}.mdc-deprecated-list-item__meta ::slotted(*){width:var(--mdc-list-item-meta-size, 24px);line-height:var(--mdc-list-item-meta-size, 24px)}.mdc-deprecated-list-item__meta ::slotted(.material-icons),.mdc-deprecated-list-item__meta ::slotted(mwc-icon){line-height:var(--mdc-list-item-meta-size, 24px) !important}.mdc-deprecated-list-item__meta ::slotted(:not(.material-icons):not(mwc-icon)){-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-caption-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.75rem;font-size:var(--mdc-typography-caption-font-size, 0.75rem);line-height:1.25rem;line-height:var(--mdc-typography-caption-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-caption-font-weight, 400);letter-spacing:0.0333333333em;letter-spacing:var(--mdc-typography-caption-letter-spacing, 0.0333333333em);text-decoration:inherit;text-decoration:var(--mdc-typography-caption-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-caption-text-transform, inherit)}[dir=rtl] .mdc-deprecated-list-item__meta,.mdc-deprecated-list-item__meta[dir=rtl]{margin-left:0;margin-right:auto}.mdc-deprecated-list-item__meta ::slotted(*){width:100%;height:100%}.mdc-deprecated-list-item__text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.mdc-deprecated-list-item__text ::slotted([for]),.mdc-deprecated-list-item__text[for]{pointer-events:none}.mdc-deprecated-list-item__primary-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;margin-top:0;line-height:normal;margin-bottom:-20px;display:block}.mdc-deprecated-list-item__primary-text::before{display:inline-block;width:0;height:32px;content:\"\";vertical-align:0}.mdc-deprecated-list-item__primary-text::after{display:inline-block;width:0;height:20px;content:\"\";vertical-align:-20px}.mdc-deprecated-list-item__secondary-text{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-body2-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.875rem;font-size:var(--mdc-typography-body2-font-size, 0.875rem);line-height:1.25rem;line-height:var(--mdc-typography-body2-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-body2-font-weight, 400);letter-spacing:0.0178571429em;letter-spacing:var(--mdc-typography-body2-letter-spacing, 0.0178571429em);text-decoration:inherit;text-decoration:var(--mdc-typography-body2-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-body2-text-transform, inherit);text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:block;margin-top:0;line-height:normal;display:block}.mdc-deprecated-list-item__secondary-text::before{display:inline-block;width:0;height:20px;content:\"\";vertical-align:0}.mdc-deprecated-list--dense .mdc-deprecated-list-item__secondary-text{font-size:inherit}* ::slotted(a),a{color:inherit;text-decoration:none}:host([twoline]){height:72px}:host([twoline]) .mdc-deprecated-list-item__text{align-self:flex-start}:host([disabled]),:host([noninteractive]){cursor:default;pointer-events:none}:host([disabled]) .mdc-deprecated-list-item__text ::slotted(*){opacity:.38}:host([disabled]) .mdc-deprecated-list-item__text ::slotted(*),:host([disabled]) .mdc-deprecated-list-item__primary-text ::slotted(*),:host([disabled]) .mdc-deprecated-list-item__secondary-text ::slotted(*){color:#000;color:var(--mdc-theme-on-surface, #000)}.mdc-deprecated-list-item__secondary-text ::slotted(*){color:rgba(0, 0, 0, 0.54);color:var(--mdc-theme-text-secondary-on-background, rgba(0, 0, 0, 0.54))}.mdc-deprecated-list-item__graphic ::slotted(*){background-color:transparent;color:rgba(0, 0, 0, 0.38);color:var(--mdc-theme-text-icon-on-background, rgba(0, 0, 0, 0.38))}.mdc-deprecated-list-group__subheader ::slotted(*){color:rgba(0, 0, 0, 0.87);color:var(--mdc-theme-text-primary-on-background, rgba(0, 0, 0, 0.87))}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic{width:var(--mdc-list-item-graphic-size, 40px);height:var(--mdc-list-item-graphic-size, 40px)}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic.multi{width:auto}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic ::slotted(*){width:var(--mdc-list-item-graphic-size, 40px);line-height:var(--mdc-list-item-graphic-size, 40px)}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic ::slotted(.material-icons),:host([graphic=avatar]) .mdc-deprecated-list-item__graphic ::slotted(mwc-icon){line-height:var(--mdc-list-item-graphic-size, 40px) !important}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic ::slotted(*){border-radius:50%}:host([graphic=avatar]) .mdc-deprecated-list-item__graphic,:host([graphic=medium]) .mdc-deprecated-list-item__graphic,:host([graphic=large]) .mdc-deprecated-list-item__graphic,:host([graphic=control]) .mdc-deprecated-list-item__graphic{margin-left:0;margin-right:var(--mdc-list-item-graphic-margin, 16px)}[dir=rtl] :host([graphic=avatar]) .mdc-deprecated-list-item__graphic,[dir=rtl] :host([graphic=medium]) .mdc-deprecated-list-item__graphic,[dir=rtl] :host([graphic=large]) .mdc-deprecated-list-item__graphic,[dir=rtl] :host([graphic=control]) .mdc-deprecated-list-item__graphic,:host([graphic=avatar]) .mdc-deprecated-list-item__graphic[dir=rtl],:host([graphic=medium]) .mdc-deprecated-list-item__graphic[dir=rtl],:host([graphic=large]) .mdc-deprecated-list-item__graphic[dir=rtl],:host([graphic=control]) .mdc-deprecated-list-item__graphic[dir=rtl]{margin-left:var(--mdc-list-item-graphic-margin, 16px);margin-right:0}:host([graphic=icon]) .mdc-deprecated-list-item__graphic{width:var(--mdc-list-item-graphic-size, 24px);height:var(--mdc-list-item-graphic-size, 24px);margin-left:0;margin-right:var(--mdc-list-item-graphic-margin, 32px)}:host([graphic=icon]) .mdc-deprecated-list-item__graphic.multi{width:auto}:host([graphic=icon]) .mdc-deprecated-list-item__graphic ::slotted(*){width:var(--mdc-list-item-graphic-size, 24px);line-height:var(--mdc-list-item-graphic-size, 24px)}:host([graphic=icon]) .mdc-deprecated-list-item__graphic ::slotted(.material-icons),:host([graphic=icon]) .mdc-deprecated-list-item__graphic ::slotted(mwc-icon){line-height:var(--mdc-list-item-graphic-size, 24px) !important}[dir=rtl] :host([graphic=icon]) .mdc-deprecated-list-item__graphic,:host([graphic=icon]) .mdc-deprecated-list-item__graphic[dir=rtl]{margin-left:var(--mdc-list-item-graphic-margin, 32px);margin-right:0}:host([graphic=avatar]:not([twoLine])),:host([graphic=icon]:not([twoLine])){height:56px}:host([graphic=medium]:not([twoLine])),:host([graphic=large]:not([twoLine])){height:72px}:host([graphic=medium]) .mdc-deprecated-list-item__graphic,:host([graphic=large]) .mdc-deprecated-list-item__graphic{width:var(--mdc-list-item-graphic-size, 56px);height:var(--mdc-list-item-graphic-size, 56px)}:host([graphic=medium]) .mdc-deprecated-list-item__graphic.multi,:host([graphic=large]) .mdc-deprecated-list-item__graphic.multi{width:auto}:host([graphic=medium]) .mdc-deprecated-list-item__graphic ::slotted(*),:host([graphic=large]) .mdc-deprecated-list-item__graphic ::slotted(*){width:var(--mdc-list-item-graphic-size, 56px);line-height:var(--mdc-list-item-graphic-size, 56px)}:host([graphic=medium]) .mdc-deprecated-list-item__graphic ::slotted(.material-icons),:host([graphic=medium]) .mdc-deprecated-list-item__graphic ::slotted(mwc-icon),:host([graphic=large]) .mdc-deprecated-list-item__graphic ::slotted(.material-icons),:host([graphic=large]) .mdc-deprecated-list-item__graphic ::slotted(mwc-icon){line-height:var(--mdc-list-item-graphic-size, 56px) !important}:host([graphic=large]){padding-left:0px}"])));
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
function matches(element, selector) {
var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector;
return nativeMatches.call(element, selector);
}
/**
* @license
* Copyright 2016 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var cssClasses = {
BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
ROOT: 'mdc-ripple-upgraded',
UNBOUNDED: 'mdc-ripple-upgraded--unbounded'
};
var strings = {
VAR_FG_SCALE: '--mdc-ripple-fg-scale',
VAR_FG_SIZE: '--mdc-ripple-fg-size',
VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
VAR_LEFT: '--mdc-ripple-left',
VAR_TOP: '--mdc-ripple-top'
};
var numbers = {
DEACTIVATION_TIMEOUT_MS: 225,
FG_DEACTIVATION_MS: 150,
INITIAL_ORIGIN_SCALE: 0.6,
PADDING: 10,
TAP_DELAY_MS: 300
};
function getNormalizedEventCoords(evt, pageOffset, clientRect) {
if (!evt) {
return {
x: 0,
y: 0
};
}
var x = pageOffset.x;
var y = pageOffset.y;
var documentX = x + clientRect.left;
var documentY = y + clientRect.top;
var normalizedX;
var normalizedY;
if (evt.type === 'touchstart') {
var touchEvent = evt;
normalizedX = touchEvent.changedTouches[0].pageX - documentX;
normalizedY = touchEvent.changedTouches[0].pageY - documentY;
} else {
var mouseEvent = evt;
normalizedX = mouseEvent.pageX - documentX;
normalizedY = mouseEvent.pageY - documentY;
}
return {
x: normalizedX,
y: normalizedY
};
}
/**
* @license
* Copyright 2016 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu'];
var activatedTargets = [];
var MDCRippleFoundation = function (_super) {
__extends(MDCRippleFoundation, _super);
function MDCRippleFoundation(adapter) {
var _this = _super.call(this, _assign(_assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this;
_this.activationAnimationHasEnded = false;
_this.activationTimer = 0;
_this.fgDeactivationRemovalTimer = 0;
_this.fgScale = '0';
_this.frame = {
width: 0,
height: 0
};
_this.initialSize = 0;
_this.layoutFrame = 0;
_this.maxRadius = 0;
_this.unboundedCoords = {
left: 0,
top: 0
};
_this.activationState = _this.defaultActivationState();
_this.activationTimerCallback = function () {
_this.activationAnimationHasEnded = true;
_this.runDeactivationUXLogicIfReady();
};
_this.activateHandler = function (e) {
_this.activateImpl(e);
};
_this.deactivateHandler = function () {
_this.deactivateImpl();
};
_this.focusHandler = function () {
_this.handleFocus();
};
_this.blurHandler = function () {
_this.handleBlur();
};
_this.resizeHandler = function () {
_this.layout();
};
return _this;
}
Object.defineProperty(MDCRippleFoundation, "cssClasses", {
get() {
return cssClasses;
},
enumerable: false,
configurable: true
});
Object.defineProperty(MDCRippleFoundation, "strings", {
get() {
return strings;
},
enumerable: false,
configurable: true
});
Object.defineProperty(MDCRippleFoundation, "numbers", {
get() {
return numbers;
},
enumerable: false,
configurable: true
});
Object.defineProperty(MDCRippleFoundation, "defaultAdapter", {
get() {
return {
addClass() {
return undefined;
},
browserSupportsCssVars() {
return true;
},
computeBoundingRect() {
return {
top: 0,
right: 0,
bottom: 0,
left: 0,
width: 0,
height: 0
};
},
containsEventTarget() {
return true;
},
deregisterDocumentInteractionHandler() {
return undefined;
},
deregisterInteractionHandler() {
return undefined;
},
deregisterResizeHandler() {
return undefined;
},
getWindowPageOffset() {
return {
x: 0,
y: 0
};
},
isSurfaceActive() {
return true;
},
isSurfaceDisabled() {
return true;
},
isUnbounded() {
return true;
},
registerDocumentInteractionHandler() {
return undefined;
},
registerInteractionHandler() {
return undefined;
},
registerResizeHandler() {
return undefined;
},
removeClass() {
return undefined;
},
updateCssVariable() {
return undefined;
}
};
},
enumerable: false,
configurable: true
});
MDCRippleFoundation.prototype.init = function () {
var _this = this;
var supportsPressRipple = this.supportsPressRipple();
this.registerRootHandlers(supportsPressRipple);
if (supportsPressRipple) {
var _a = MDCRippleFoundation.cssClasses;
var ROOT_1 = _a.ROOT;
var UNBOUNDED_1 = _a.UNBOUNDED;
requestAnimationFrame(function () {
_this.adapter.addClass(ROOT_1);
if (_this.adapter.isUnbounded()) {
_this.adapter.addClass(UNBOUNDED_1);
_this.layoutInternal();
}
});
}
};
MDCRippleFoundation.prototype.destroy = function () {
var _this = this;
if (this.supportsPressRipple()) {
if (this.activationTimer) {
clearTimeout(this.activationTimer);
this.activationTimer = 0;
this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
}
if (this.fgDeactivationRemovalTimer) {
clearTimeout(this.fgDeactivationRemovalTimer);
this.fgDeactivationRemovalTimer = 0;
this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
}
var _a = MDCRippleFoundation.cssClasses;
var ROOT_2 = _a.ROOT;
var UNBOUNDED_2 = _a.UNBOUNDED;
requestAnimationFrame(function () {
_this.adapter.removeClass(ROOT_2);
_this.adapter.removeClass(UNBOUNDED_2);
_this.removeCssVars();
});
}
this.deregisterRootHandlers();
this.deregisterDeactivationHandlers();
};
MDCRippleFoundation.prototype.activate = function (evt) {
this.activateImpl(evt);
};
MDCRippleFoundation.prototype.deactivate = function () {
this.deactivateImpl();
};
MDCRippleFoundation.prototype.layout = function () {
var _this = this;
if (this.layoutFrame) {
cancelAnimationFrame(this.layoutFrame);
}
this.layoutFrame = requestAnimationFrame(function () {
_this.layoutInternal();
_this.layoutFrame = 0;
});
};
MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {
var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
if (unbounded) {
this.adapter.addClass(UNBOUNDED);
} else {
this.adapter.removeClass(UNBOUNDED);
}
};
MDCRippleFoundation.prototype.handleFocus = function () {
var _this = this;
requestAnimationFrame(function () {
return _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
});
};
MDCRippleFoundation.prototype.handleBlur = function () {
var _this = this;
requestAnimationFrame(function () {
return _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
});
};
MDCRippleFoundation.prototype.supportsPressRipple = function () {
return this.adapter.browserSupportsCssVars();
};
MDCRippleFoundation.prototype.defaultActivationState = function () {
return {
activationEvent: undefined,
hasDeactivationUXRun: false,
isActivated: false,
isProgrammatic: false,
wasActivatedByPointer: false,
wasElementMadeActive: false
};
};
MDCRippleFoundation.prototype.registerRootHandlers = function (supportsPressRipple) {
var e_1, _a;
if (supportsPressRipple) {
try {
for (var ACTIVATION_EVENT_TYPES_1 = __values(ACTIVATION_EVENT_TYPES), ACTIVATION_EVENT_TYPES_1_1 = ACTIVATION_EVENT_TYPES_1.next(); !ACTIVATION_EVENT_TYPES_1_1.done; ACTIVATION_EVENT_TYPES_1_1 = ACTIVATION_EVENT_TYPES_1.next()) {
var evtType = ACTIVATION_EVENT_TYPES_1_1.value;
this.adapter.registerInteractionHandler(evtType, this.activateHandler);
}
} catch (e_1_1) {
e_1 = {
error: e_1_1
};
} finally {
try {
if (ACTIVATION_EVENT_TYPES_1_1 && !ACTIVATION_EVENT_TYPES_1_1.done && (_a = ACTIVATION_EVENT_TYPES_1.return)) {
_a.call(ACTIVATION_EVENT_TYPES_1);
}
} finally {
if (e_1) {
throw e_1.error;
}
}
}
if (this.adapter.isUnbounded()) {
this.adapter.registerResizeHandler(this.resizeHandler);
}
}
this.adapter.registerInteractionHandler('focus', this.focusHandler);
this.adapter.registerInteractionHandler('blur', this.blurHandler);
};
MDCRippleFoundation.prototype.registerDeactivationHandlers = function (evt) {
var e_2, _a;
if (evt.type === 'keydown') {
this.adapter.registerInteractionHandler('keyup', this.deactivateHandler);
} else {
try {
for (var POINTER_DEACTIVATION_EVENT_TYPES_1 = __values(POINTER_DEACTIVATION_EVENT_TYPES), POINTER_DEACTIVATION_EVENT_TYPES_1_1 = POINTER_DEACTIVATION_EVENT_TYPES_1.next(); !POINTER_DEACTIVATION_EVENT_TYPES_1_1.done; POINTER_DEACTIVATION_EVENT_TYPES_1_1 = POINTER_DEACTIVATION_EVENT_TYPES_1.next()) {
var evtType = POINTER_DEACTIVATION_EVENT_TYPES_1_1.value;
this.adapter.registerDocumentInteractionHandler(evtType, this.deactivateHandler);
}
} catch (e_2_1) {
e_2 = {
error: e_2_1
};
} finally {
try {
if (POINTER_DEACTIVATION_EVENT_TYPES_1_1 && !POINTER_DEACTIVATION_EVENT_TYPES_1_1.done && (_a = POINTER_DEACTIVATION_EVENT_TYPES_1.return)) {
_a.call(POINTER_DEACTIVATION_EVENT_TYPES_1);
}
} finally {
if (e_2) {
throw e_2.error;
}
}
}
}
};
MDCRippleFoundation.prototype.deregisterRootHandlers = function () {
var e_3, _a;
try {
for (var ACTIVATION_EVENT_TYPES_2 = __values(ACTIVATION_EVENT_TYPES), ACTIVATION_EVENT_TYPES_2_1 = ACTIVATION_EVENT_TYPES_2.next(); !ACTIVATION_EVENT_TYPES_2_1.done; ACTIVATION_EVENT_TYPES_2_1 = ACTIVATION_EVENT_TYPES_2.next()) {
var evtType = ACTIVATION_EVENT_TYPES_2_1.value;
this.adapter.deregisterInteractionHandler(evtType, this.activateHandler);
}
} catch (e_3_1) {
e_3 = {
error: e_3_1
};
} finally {
try {
if (ACTIVATION_EVENT_TYPES_2_1 && !ACTIVATION_EVENT_TYPES_2_1.done && (_a = ACTIVATION_EVENT_TYPES_2.return)) {
_a.call(ACTIVATION_EVENT_TYPES_2);
}
} finally {
if (e_3) {
throw e_3.error;
}
}
}
this.adapter.deregisterInteractionHandler('focus', this.focusHandler);
this.adapter.deregisterInteractionHandler('blur', this.blurHandler);
if (this.adapter.isUnbounded()) {
this.adapter.deregisterResizeHandler(this.resizeHandler);
}
};
MDCRippleFoundation.prototype.deregisterDeactivationHandlers = function () {
var e_4, _a;
this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler);
try {
for (var POINTER_DEACTIVATION_EVENT_TYPES_2 = __values(POINTER_DEACTIVATION_EVENT_TYPES), POINTER_DEACTIVATION_EVENT_TYPES_2_1 = POINTER_DEACTIVATION_EVENT_TYPES_2.next(); !POINTER_DEACTIVATION_EVENT_TYPES_2_1.done; POINTER_DEACTIVATION_EVENT_TYPES_2_1 = POINTER_DEACTIVATION_EVENT_TYPES_2.next()) {
var evtType = POINTER_DEACTIVATION_EVENT_TYPES_2_1.value;
this.adapter.deregisterDocumentInteractionHandler(evtType, this.deactivateHandler);
}
} catch (e_4_1) {
e_4 = {
error: e_4_1
};
} finally {
try {
if (POINTER_DEACTIVATION_EVENT_TYPES_2_1 && !POINTER_DEACTIVATION_EVENT_TYPES_2_1.done && (_a = POINTER_DEACTIVATION_EVENT_TYPES_2.return)) {
_a.call(POINTER_DEACTIVATION_EVENT_TYPES_2);
}
} finally {
if (e_4) {
throw e_4.error;
}
}
}
};
MDCRippleFoundation.prototype.removeCssVars = function () {
var _this = this;
var rippleStrings = MDCRippleFoundation.strings;
var keys = Object.keys(rippleStrings);
keys.forEach(function (key) {
if (key.indexOf('VAR_') === 0) {
_this.adapter.updateCssVariable(rippleStrings[key], null);
}
});
};
MDCRippleFoundation.prototype.activateImpl = function (evt) {
var _this = this;
if (this.adapter.isSurfaceDisabled()) {
return;
}
var activationState = this.activationState;
if (activationState.isActivated) {
return;
}
var previousActivationEvent = this.previousActivationEvent;
var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;
if (isSameInteraction) {
return;
}
activationState.isActivated = true;
activationState.isProgrammatic = evt === undefined;
activationState.activationEvent = evt;
if (activationState.isProgrammatic) {
activationState.wasActivatedByPointer = false;
} else {
activationState.wasActivatedByPointer = evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');
}
var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) {
return _this.adapter.containsEventTarget(target);
});
if (hasActivatedChild) {
this.resetActivationState();
return;
}
if (evt !== undefined) {
activatedTargets.push(evt.target);
this.registerDeactivationHandlers(evt);
}
activationState.wasElementMadeActive = this.checkElementMadeActive(evt);
if (activationState.wasElementMadeActive) {
this.animateActivation();
}
requestAnimationFrame(function () {
activatedTargets = [];
if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) {
activationState.wasElementMadeActive = _this.checkElementMadeActive(evt);
if (activationState.wasElementMadeActive) {
_this.animateActivation();
}
}
if (!activationState.wasElementMadeActive) {
_this.activationState = _this.defaultActivationState();
}
});
};
MDCRippleFoundation.prototype.checkElementMadeActive = function (evt) {
if (evt !== undefined && evt.type === 'keydown') {
return this.adapter.isSurfaceActive();
} else {
return true;
}
};
MDCRippleFoundation.prototype.animateActivation = function () {
var _this = this;
var _a = MDCRippleFoundation.strings;
var VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START;
var VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;
var _b = MDCRippleFoundation.cssClasses;
var FG_DEACTIVATION = _b.FG_DEACTIVATION;
var FG_ACTIVATION = _b.FG_ACTIVATION;
var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
this.layoutInternal();
var translateStart = '';
var translateEnd = '';
if (!this.adapter.isUnbounded()) {
var _c = this.getFgTranslationCoordinates();
var startPoint = _c.startPoint;
var endPoint = _c.endPoint;
translateStart = startPoint.x + "px, " + startPoint.y + "px";
translateEnd = endPoint.x + "px, " + endPoint.y + "px";
}
this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
clearTimeout(this.activationTimer);
clearTimeout(this.fgDeactivationRemovalTimer);
this.rmBoundedActivationClasses();
this.adapter.removeClass(FG_DEACTIVATION);
this.adapter.computeBoundingRect();
this.adapter.addClass(FG_ACTIVATION);
this.activationTimer = setTimeout(function () {
_this.activationTimerCallback();
}, DEACTIVATION_TIMEOUT_MS);
};
MDCRippleFoundation.prototype.getFgTranslationCoordinates = function () {
var _a = this.activationState;
var activationEvent = _a.activationEvent;
var wasActivatedByPointer = _a.wasActivatedByPointer;
var startPoint;
if (wasActivatedByPointer) {
startPoint = getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect());
} else {
startPoint = {
x: this.frame.width / 2,
y: this.frame.height / 2
};
}
startPoint = {
x: startPoint.x - this.initialSize / 2,
y: startPoint.y - this.initialSize / 2
};
var endPoint = {
x: this.frame.width / 2 - this.initialSize / 2,
y: this.frame.height / 2 - this.initialSize / 2
};
return {
startPoint: startPoint,
endPoint: endPoint
};
};
MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady = function () {
var _this = this;
var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
var _a = this.activationState;
var hasDeactivationUXRun = _a.hasDeactivationUXRun;
var isActivated = _a.isActivated;
var activationHasEnded = hasDeactivationUXRun || !isActivated;
if (activationHasEnded && this.activationAnimationHasEnded) {
this.rmBoundedActivationClasses();
this.adapter.addClass(FG_DEACTIVATION);
this.fgDeactivationRemovalTimer = setTimeout(function () {
_this.adapter.removeClass(FG_DEACTIVATION);
}, numbers.FG_DEACTIVATION_MS);
}
};
MDCRippleFoundation.prototype.rmBoundedActivationClasses = function () {
var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
this.adapter.removeClass(FG_ACTIVATION);
this.activationAnimationHasEnded = false;
this.adapter.computeBoundingRect();
};
MDCRippleFoundation.prototype.resetActivationState = function () {
var _this = this;
this.previousActivationEvent = this.activationState.activationEvent;
this.activationState = this.defaultActivationState();
setTimeout(function () {
return _this.previousActivationEvent = undefined;
}, MDCRippleFoundation.numbers.TAP_DELAY_MS);
};
MDCRippleFoundation.prototype.deactivateImpl = function () {
var _this = this;
var activationState = this.activationState;
if (!activationState.isActivated) {
return;
}
var state = _assign({}, activationState);
if (activationState.isProgrammatic) {
requestAnimationFrame(function () {
_this.animateDeactivation(state);
});
this.resetActivationState();
} else {
this.deregisterDeactivationHandlers();
requestAnimationFrame(function () {
_this.activationState.hasDeactivationUXRun = true;
_this.animateDeactivation(state);
_this.resetActivationState();
});
}
};
MDCRippleFoundation.prototype.animateDeactivation = function (_a) {
var wasActivatedByPointer = _a.wasActivatedByPointer;
var wasElementMadeActive = _a.wasElementMadeActive;
if (wasActivatedByPointer || wasElementMadeActive) {
this.runDeactivationUXLogicIfReady();
}
};
MDCRippleFoundation.prototype.layoutInternal = function () {
var _this = this;
this.frame = this.adapter.computeBoundingRect();
var maxDim = Math.max(this.frame.height, this.frame.width);
var getBoundedRadius = function getBoundedRadius() {
var hypotenuse = Math.sqrt(Math.pow(_this.frame.width, 2) + Math.pow(_this.frame.height, 2));
return hypotenuse + MDCRippleFoundation.numbers.PADDING;
};
if (this.adapter.isUnbounded()) {
this.maxRadius = maxDim;
} else {
this.maxRadius = getBoundedRadius();
}
var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
if (this.adapter.isUnbounded() && initialSize % 2 !== 0) {
this.initialSize = initialSize - 1;
} else {
this.initialSize = initialSize;
}
this.fgScale = "" + this.maxRadius / this.initialSize;
this.updateLayoutCssVars();
};
MDCRippleFoundation.prototype.updateLayoutCssVars = function () {
var _a = MDCRippleFoundation.strings;
var VAR_FG_SIZE = _a.VAR_FG_SIZE;
var VAR_LEFT = _a.VAR_LEFT;
var VAR_TOP = _a.VAR_TOP;
var VAR_FG_SCALE = _a.VAR_FG_SCALE;
this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize + "px");
this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale);
if (this.adapter.isUnbounded()) {
this.unboundedCoords = {
left: Math.round(this.frame.width / 2 - this.initialSize / 2),
top: Math.round(this.frame.height / 2 - this.initialSize / 2)
};
this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords.left + "px");
this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords.top + "px");
}
};
return MDCRippleFoundation;
}(MDCFoundation);
var MDCRippleFoundation$1 = MDCRippleFoundation;
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var NODE_MODE = false;
var global$4 = window;
var supportsAdoptingStyleSheets = global$4.ShadowRoot && (global$4.ShadyCSS === undefined || global$4.ShadyCSS.nativeShadow) && 'adoptedStyleSheets' in Document.prototype && 'replace' in CSSStyleSheet.prototype;
var constructionToken = Symbol();
var cssTagCache = new WeakMap();
class CSSResult {
constructor(cssText, strings, safeToken) {
this['_$cssResult$'] = true;
if (safeToken !== constructionToken) {
throw new Error('CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');
}
this.cssText = cssText;
this._strings = strings;
}
get styleSheet() {
var styleSheet = this._styleSheet;
var strings = this._strings;
if (supportsAdoptingStyleSheets && styleSheet === undefined) {
var cacheable = strings !== undefined && strings.length === 1;
if (cacheable) {
styleSheet = cssTagCache.get(strings);
}
if (styleSheet === undefined) {
(this._styleSheet = styleSheet = new CSSStyleSheet()).replaceSync(this.cssText);
if (cacheable) {
cssTagCache.set(strings, styleSheet);
}
}
}
return styleSheet;
}
toString() {
return this.cssText;
}
}
var textFromCSSResult = value => {
if (value['_$cssResult$'] === true) {
return value.cssText;
} else if (typeof value === 'number') {
return value;
} else {
throw new Error("Value passed to 'css' function must be a 'css' function result: " + "".concat(value, ". Use 'unsafeCSS' to pass non-literal values, but take care ") + "to ensure page security.");
}
};
var unsafeCSS = value => new CSSResult(typeof value === 'string' ? value : String(value), undefined, constructionToken);
var css = function css(strings) {
for (var _len10 = arguments.length, values = new Array(_len10 > 1 ? _len10 - 1 : 0), _key10 = 1; _key10 < _len10; _key10++) {
values[_key10 - 1] = arguments[_key10];
}
var cssText = strings.length === 1 ? strings[0] : values.reduce((acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1], strings[0]);
return new CSSResult(cssText, strings, constructionToken);
};
var adoptStyles = (renderRoot, styles) => {
if (supportsAdoptingStyleSheets) {
renderRoot.adoptedStyleSheets = styles.map(s => s instanceof CSSStyleSheet ? s : s.styleSheet);
} else {
styles.forEach(s => {
var style = document.createElement('style');
var nonce = global$4['litNonce'];
if (nonce !== undefined) {
style.setAttribute('nonce', nonce);
}
style.textContent = s.cssText;
renderRoot.appendChild(style);
});
}
};
var cssResultFromStyleSheet = sheet => {
var cssText = '';
for (var rule of sheet.cssRules) {
cssText += rule.cssText;
}
return unsafeCSS(cssText);
};
var getCompatibleStyle = supportsAdoptingStyleSheets || NODE_MODE ? s => s : s => s instanceof CSSStyleSheet ? cssResultFromStyleSheet(s) : s;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var _b$2, _c$2, _d$1;
var _e;
var global$3 = window;
var requestUpdateThenable;
var issueWarning$2;
var trustedTypes$1 = global$3.trustedTypes;
var emptyStringForBooleanAttribute$1 = trustedTypes$1 ? trustedTypes$1.emptyScript : '';
var polyfillSupport$2 = global$3.reactiveElementPolyfillSupportDevMode;
{
var _issuedWarnings8 = (_b$2 = global$3.litIssuedWarnings) !== null && _b$2 !== void 0 ? _b$2 : global$3.litIssuedWarnings = new Set();
issueWarning$2 = (code, warning) => {
warning += " See https://lit.dev/msg/".concat(code, " for more information.");
if (!_issuedWarnings8.has(warning)) {
console.warn(warning);
_issuedWarnings8.add(warning);
}
};
issueWarning$2('dev-mode', "Lit is in dev mode. Not recommended for production!");
if (((_c$2 = global$3.ShadyDOM) === null || _c$2 === void 0 ? void 0 : _c$2.inUse) && polyfillSupport$2 === undefined) {
issueWarning$2('polyfill-support-missing', "Shadow DOM is being polyfilled via `ShadyDOM` but " + "the `polyfill-support` module has not been loaded.");
}
requestUpdateThenable = name => ({
then: (onfulfilled, _onrejected) => {
issueWarning$2('request-update-promise', "The `requestUpdate` method should no longer return a Promise but " + "does so on `".concat(name, "`. Use `updateComplete` instead."));
if (onfulfilled !== undefined) {
onfulfilled(false);
}
}
});
}
var debugLogEvent$1 = event => {
var shouldEmit = global$3.emitLitDebugLogEvents;
if (!shouldEmit) {
return;
}
global$3.dispatchEvent(new CustomEvent('lit-debug', {
detail: event
}));
};
var JSCompiler_renameProperty = (prop, _obj) => prop;
var defaultConverter = {
toAttribute(value, type) {
switch (type) {
case Boolean:
if (value) {
value = emptyStringForBooleanAttribute$1;
} else {
value = null;
}
break;
case Object:
case Array:
if (value == null) {
value = value;
} else {
value = JSON.stringify(value);
}
break;
}
return value;
},
fromAttribute(value, type) {
var fromValue = value;
switch (type) {
case Boolean:
fromValue = value !== null;
break;
case Number:
if (value === null) {
fromValue = null;
} else {
fromValue = Number(value);
}
break;
case Object:
case Array:
try {
fromValue = JSON.parse(value);
} catch (e) {
fromValue = null;
}
break;
}
return fromValue;
}
};
var notEqual = (value, old) => {
return old !== value && (old === old || value === value);
};
var defaultPropertyDeclaration = {
attribute: true,
type: String,
converter: defaultConverter,
reflect: false,
hasChanged: notEqual
};
var finalized = 'finalized';
class ReactiveElement extends HTMLElement {
constructor() {
super();
this.__instanceProperties = new Map();
this.isUpdatePending = false;
this.hasUpdated = false;
this.__reflectingProperty = null;
this.__initialize();
}
static addInitializer(initializer) {
var _a;
this.finalize();
((_a = this._initializers) !== null && _a !== void 0 ? _a : this._initializers = []).push(initializer);
}
static get observedAttributes() {
this.finalize();
var attributes = [];
this.elementProperties.forEach((v, p) => {
var attr = this.__attributeNameForProperty(p, v);
if (attr !== undefined) {
this.__attributeToPropertyMap.set(attr, p);
attributes.push(attr);
}
});
return attributes;
}
static createProperty(name) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultPropertyDeclaration;
var _a;
if (options.state) {
options.attribute = false;
}
this.finalize();
this.elementProperties.set(name, options);
if (!options.noAccessor && !this.prototype.hasOwnProperty(name)) {
var key = typeof name === 'symbol' ? Symbol() : "__".concat(name);
var descriptor = this.getPropertyDescriptor(name, key, options);
if (descriptor !== undefined) {
Object.defineProperty(this.prototype, name, descriptor);
{
if (!this.hasOwnProperty('__reactivePropertyKeys')) {
this.__reactivePropertyKeys = new Set((_a = this.__reactivePropertyKeys) !== null && _a !== void 0 ? _a : []);
}
this.__reactivePropertyKeys.add(name);
}
}
}
}
static getPropertyDescriptor(name, key, options) {
return {
get() {
return this[key];
},
set(value) {
var oldValue = this[name];
this[key] = value;
this.requestUpdate(name, oldValue, options);
},
configurable: true,
enumerable: true
};
}
static getPropertyOptions(name) {
return this.elementProperties.get(name) || defaultPropertyDeclaration;
}
static finalize() {
var _this15 = this;
if (this.hasOwnProperty(finalized)) {
return false;
}
this[finalized] = true;
var superCtor = Object.getPrototypeOf(this);
superCtor.finalize();
if (superCtor._initializers !== undefined) {
this._initializers = [...superCtor._initializers];
}
this.elementProperties = new Map(superCtor.elementProperties);
this.__attributeToPropertyMap = new Map();
if (this.hasOwnProperty(JSCompiler_renameProperty('properties'))) {
var props = this.properties;
var propKeys = [...Object.getOwnPropertyNames(props), ...Object.getOwnPropertySymbols(props)];
for (var p of propKeys) {
this.createProperty(p, props[p]);
}
}
this.elementStyles = this.finalizeStyles(this.styles);
{
var warnRemovedOrRenamed = function warnRemovedOrRenamed(name) {
var renamed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (_this15.prototype.hasOwnProperty(name)) {
issueWarning$2(renamed ? 'renamed-api' : 'removed-api', "`".concat(name, "` is implemented on class ").concat(_this15.name, ". It ") + "has been ".concat(renamed ? 'renamed' : 'removed', " ") + "in this version of LitElement.");
}
};
warnRemovedOrRenamed('initialize');
warnRemovedOrRenamed('requestUpdateInternal');
warnRemovedOrRenamed('_getUpdateComplete', true);
}
return true;
}
static finalizeStyles(styles) {
var elementStyles = [];
if (Array.isArray(styles)) {
var set = new Set(styles.flat(Infinity).reverse());
for (var s of set) {
elementStyles.unshift(getCompatibleStyle(s));
}
} else if (styles !== undefined) {
elementStyles.push(getCompatibleStyle(styles));
}
return elementStyles;
}
static __attributeNameForProperty(name, options) {
var attribute = options.attribute;
if (attribute === false) {
return undefined;
} else {
if (typeof attribute === 'string') {
return attribute;
} else {
if (typeof name === 'string') {
return name.toLowerCase();
} else {
return undefined;
}
}
}
}
__initialize() {
var _a;
this.__updatePromise = new Promise(res => this.enableUpdating = res);
this._$changedProperties = new Map();
this.__saveInstanceProperties();
this.requestUpdate();
if ((_a = this.constructor._initializers) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(i => i(this));
}
}
addController(controller) {
var _a, _b;
((_a = this.__controllers) !== null && _a !== void 0 ? _a : this.__controllers = []).push(controller);
if (this.renderRoot !== undefined && this.isConnected) {
if ((_b = controller.hostConnected) === null || _b === void 0) {
0;
undefined;
} else {
_b.call(controller);
}
}
}
removeController(controller) {
var _a;
if ((_a = this.__controllers) === null || _a === void 0) {
0;
undefined;
} else {
_a.splice(this.__controllers.indexOf(controller) >>> 0, 1);
}
}
__saveInstanceProperties() {
this.constructor.elementProperties.forEach((_v, p) => {
if (this.hasOwnProperty(p)) {
this.__instanceProperties.set(p, this[p]);
delete this[p];
}
});
}
createRenderRoot() {
var _a;
var renderRoot = (_a = this.shadowRoot) !== null && _a !== void 0 ? _a : this.attachShadow(this.constructor.shadowRootOptions);
adoptStyles(renderRoot, this.constructor.elementStyles);
return renderRoot;
}
connectedCallback() {
var _a;
if (this.renderRoot === undefined) {
this.renderRoot = this.createRenderRoot();
}
this.enableUpdating(true);
if ((_a = this.__controllers) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(c => {
var _a;
if ((_a = c.hostConnected) === null || _a === void 0) {
0;
return;
} else {
return _a.call(c);
}
});
}
}
enableUpdating(_requestedUpdate) {}
disconnectedCallback() {
var _a;
if ((_a = this.__controllers) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(c => {
var _a;
if ((_a = c.hostDisconnected) === null || _a === void 0) {
0;
return;
} else {
return _a.call(c);
}
});
}
}
attributeChangedCallback(name, _old, value) {
this._$attributeToProperty(name, value);
}
__propertyToAttribute(name, value) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultPropertyDeclaration;
var _a;
var attr = this.constructor.__attributeNameForProperty(name, options);
if (attr !== undefined && options.reflect === true) {
var converter = ((_a = options.converter) === null || _a === void 0 ? void 0 : _a.toAttribute) !== undefined ? options.converter : defaultConverter;
var attrValue = converter.toAttribute(value, options.type);
if (this.constructor.enabledWarnings.indexOf('migration') >= 0 && attrValue === undefined) {
issueWarning$2('undefined-attribute-value', "The attribute value for the ".concat(name, " property is ") + "undefined on element ".concat(this.localName, ". The attribute will be ") + "removed, but in the previous version of `ReactiveElement`, " + "the attribute would not have changed.");
}
this.__reflectingProperty = name;
if (attrValue == null) {
this.removeAttribute(attr);
} else {
this.setAttribute(attr, attrValue);
}
this.__reflectingProperty = null;
}
}
_$attributeToProperty(name, value) {
var _a;
var ctor = this.constructor;
var propName = ctor.__attributeToPropertyMap.get(name);
if (propName !== undefined && this.__reflectingProperty !== propName) {
var options = ctor.getPropertyOptions(propName);
var converter = typeof options.converter === 'function' ? {
fromAttribute: options.converter
} : ((_a = options.converter) === null || _a === void 0 ? void 0 : _a.fromAttribute) !== undefined ? options.converter : defaultConverter;
this.__reflectingProperty = propName;
this[propName] = converter.fromAttribute(value, options.type);
this.__reflectingProperty = null;
}
}
requestUpdate(name, oldValue, options) {
var shouldRequestUpdate = true;
if (name !== undefined) {
options = options || this.constructor.getPropertyOptions(name);
var hasChanged = options.hasChanged || notEqual;
if (hasChanged(this[name], oldValue)) {
if (!this._$changedProperties.has(name)) {
this._$changedProperties.set(name, oldValue);
}
if (options.reflect === true && this.__reflectingProperty !== name) {
if (this.__reflectingProperties === undefined) {
this.__reflectingProperties = new Map();
}
this.__reflectingProperties.set(name, options);
}
} else {
shouldRequestUpdate = false;
}
}
if (!this.isUpdatePending && shouldRequestUpdate) {
this.__updatePromise = this.__enqueueUpdate();
}
return requestUpdateThenable(this.localName);
}
__enqueueUpdate() {
var _this16 = this;
return _asyncToGenerator(function* () {
_this16.isUpdatePending = true;
try {
yield _this16.__updatePromise;
} catch (e) {
Promise.reject(e);
}
var result = _this16.scheduleUpdate();
if (result != null) {
yield result;
}
return !_this16.isUpdatePending;
})();
}
scheduleUpdate() {
return this.performUpdate();
}
performUpdate() {
var _a, _b;
if (!this.isUpdatePending) {
return;
}
if (debugLogEvent$1 === null || debugLogEvent$1 === void 0) {
0;
undefined;
} else {
debugLogEvent$1({
kind: 'update'
});
}
if (!this.hasUpdated) {
{
var shadowedProperties = [];
if ((_a = this.constructor.__reactivePropertyKeys) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(p => {
var _a;
if (this.hasOwnProperty(p) && !((_a = this.__instanceProperties) === null || _a === void 0 ? void 0 : _a.has(p))) {
shadowedProperties.push(p);
}
});
}
if (shadowedProperties.length) {
throw new Error("The following properties on element ".concat(this.localName, " will not ") + "trigger updates as expected because they are set using class " + "fields: ".concat(shadowedProperties.join(', '), ". ") + "Native class fields and some compiled output will overwrite " + "accessors used for detecting changes. See " + "https://lit.dev/msg/class-field-shadowing " + "for more information.");
}
}
}
if (this.__instanceProperties) {
this.__instanceProperties.forEach((v, p) => this[p] = v);
this.__instanceProperties = undefined;
}
var shouldUpdate = false;
var changedProperties = this._$changedProperties;
try {
shouldUpdate = this.shouldUpdate(changedProperties);
if (shouldUpdate) {
this.willUpdate(changedProperties);
if ((_b = this.__controllers) === null || _b === void 0) {
0;
undefined;
} else {
_b.forEach(c => {
var _a;
if ((_a = c.hostUpdate) === null || _a === void 0) {
0;
return;
} else {
return _a.call(c);
}
});
}
this.update(changedProperties);
} else {
this.__markUpdated();
}
} catch (e) {
shouldUpdate = false;
this.__markUpdated();
throw e;
}
if (shouldUpdate) {
this._$didUpdate(changedProperties);
}
}
willUpdate(_changedProperties) {}
_$didUpdate(changedProperties) {
var _a;
if ((_a = this.__controllers) === null || _a === void 0) {
0;
undefined;
} else {
_a.forEach(c => {
var _a;
if ((_a = c.hostUpdated) === null || _a === void 0) {
0;
return;
} else {
return _a.call(c);
}
});
}
if (!this.hasUpdated) {
this.hasUpdated = true;
this.firstUpdated(changedProperties);
}
this.updated(changedProperties);
if (this.isUpdatePending && this.constructor.enabledWarnings.indexOf('change-in-update') >= 0) {
issueWarning$2('change-in-update', "Element ".concat(this.localName, " scheduled an update ") + "(generally because a property was set) " + "after an update completed, causing a new update to be scheduled. " + "This is inefficient and should be avoided unless the next update " + "can only be scheduled as a side effect of the previous update.");
}
}
__markUpdated() {
this._$changedProperties = new Map();
this.isUpdatePending = false;
}
get updateComplete() {
return this.getUpdateComplete();
}
getUpdateComplete() {
return this.__updatePromise;
}
shouldUpdate(_changedProperties) {
return true;
}
update(_changedProperties) {
if (this.__reflectingProperties !== undefined) {
this.__reflectingProperties.forEach((v, k) => this.__propertyToAttribute(k, this[k], v));
this.__reflectingProperties = undefined;
}
this.__markUpdated();
}
updated(_changedProperties) {}
firstUpdated(_changedProperties) {}
}
_e = finalized;
ReactiveElement[_e] = true;
ReactiveElement.elementProperties = new Map();
ReactiveElement.elementStyles = [];
ReactiveElement.shadowRootOptions = {
mode: 'open'
};
if (polyfillSupport$2 === null || polyfillSupport$2 === void 0) {
0;
undefined;
} else {
polyfillSupport$2({
ReactiveElement
});
}
{
ReactiveElement.enabledWarnings = ['change-in-update'];
var _ensureOwnWarnings4 = function _ensureOwnWarnings4(ctor) {
if (!ctor.hasOwnProperty(JSCompiler_renameProperty('enabledWarnings'))) {
ctor.enabledWarnings = ctor.enabledWarnings.slice();
}
};
ReactiveElement.enableWarning = function (warning) {
_ensureOwnWarnings4(this);
if (this.enabledWarnings.indexOf(warning) < 0) {
this.enabledWarnings.push(warning);
}
};
ReactiveElement.disableWarning = function (warning) {
_ensureOwnWarnings4(this);
var i = this.enabledWarnings.indexOf(warning);
if (i >= 0) {
this.enabledWarnings.splice(i, 1);
}
};
}
((_d$1 = global$3.reactiveElementVersions) !== null && _d$1 !== void 0 ? _d$1 : global$3.reactiveElementVersions = []).push('1.6.3');
if (global$3.reactiveElementVersions.length > 1) {
issueWarning$2('multiple-versions', "Multiple versions of Lit loaded. Loading multiple versions " + "is not recommended.");
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var _a$2, _b$1, _c$1, _d;
var global$2 = window;
var debugLogEvent = event => {
var shouldEmit = global$2.emitLitDebugLogEvents;
if (!shouldEmit) {
return;
}
global$2.dispatchEvent(new CustomEvent('lit-debug', {
detail: event
}));
};
var debugLogRenderId = 0;
var issueWarning$1;
{
if ((_a$2 = global$2.litIssuedWarnings) !== null && _a$2 !== void 0) {
_a$2;
} else {
global$2.litIssuedWarnings = new Set();
}
issueWarning$1 = (code, warning) => {
if (code) {
warning += " See https://lit.dev/msg/".concat(code, " for more information.");
} else {
warning += '';
}
if (!global$2.litIssuedWarnings.has(warning)) {
console.warn(warning);
global$2.litIssuedWarnings.add(warning);
}
};
issueWarning$1('dev-mode', "Lit is in dev mode. Not recommended for production!");
}
var wrap = ((_b$1 = global$2.ShadyDOM) === null || _b$1 === void 0 ? void 0 : _b$1.inUse) && ((_c$1 = global$2.ShadyDOM) === null || _c$1 === void 0 ? void 0 : _c$1.noPatch) === true ? global$2.ShadyDOM.wrap : node => node;
var trustedTypes = global$2.trustedTypes;
var policy = trustedTypes ? trustedTypes.createPolicy('lit-html', {
createHTML: s => s
}) : undefined;
var identityFunction = value => value;
var noopSanitizer = (_node, _name, _type) => identityFunction;
var setSanitizer = newSanitizer => {
if (sanitizerFactoryInternal !== noopSanitizer) {
throw new Error("Attempted to overwrite existing lit-html security policy." + " setSanitizeDOMValueFactory should be called at most once.");
}
sanitizerFactoryInternal = newSanitizer;
};
var _testOnlyClearSanitizerFactoryDoNotCallOrElse = () => {
sanitizerFactoryInternal = noopSanitizer;
};
var createSanitizer = (node, name, type) => {
return sanitizerFactoryInternal(node, name, type);
};
var boundAttributeSuffix = '$lit$';
var marker = "lit$".concat(String(Math.random()).slice(9), "$");
var markerMatch = '?' + marker;
var nodeMarker = "<".concat(markerMatch, ">");
var d = document;
var createMarker = () => d.createComment('');
var isPrimitive = value => value === null || typeof value != 'object' && typeof value != 'function';
var isArray = Array.isArray;
var isIterable = value => isArray(value) || typeof (value === null || value === void 0 ? void 0 : value[Symbol.iterator]) === 'function';
var SPACE_CHAR = "[ \t\n\f\r]";
var ATTR_VALUE_CHAR = "[^ \t\n\f\r\"'`<>=]";
var NAME_CHAR = "[^\\s\"'>=/]";
var textEndRegex = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g;
var COMMENT_START = 1;
var TAG_NAME = 2;
var DYNAMIC_TAG_NAME = 3;
var commentEndRegex = /-->/g;
var comment2EndRegex = />/g;
var tagEndRegex = new RegExp(">|".concat(SPACE_CHAR, "(?:(").concat(NAME_CHAR, "+)(").concat(SPACE_CHAR, "*=").concat(SPACE_CHAR, "*(?:").concat(ATTR_VALUE_CHAR, "|(\"|')|))|$)"), 'g');
var ENTIRE_MATCH = 0;
var ATTRIBUTE_NAME = 1;
var SPACES_AND_EQUALS = 2;
var QUOTE_CHAR = 3;
var singleQuoteAttrEndRegex = /'/g;
var doubleQuoteAttrEndRegex = /"/g;
var rawTextElement = /^(?:script|style|textarea|title)$/i;
var HTML_RESULT = 1;
var SVG_RESULT = 2;
var ATTRIBUTE_PART = 1;
var CHILD_PART = 2;
var PROPERTY_PART = 3;
var BOOLEAN_ATTRIBUTE_PART = 4;
var EVENT_PART = 5;
var ELEMENT_PART = 6;
var COMMENT_PART = 7;
var tag = type => function (strings) {
if (strings.some(s => s === undefined)) {
console.warn('Some template strings are undefined.\n' + 'This is probably caused by illegal octal escape sequences.');
}
for (var _len11 = arguments.length, values = new Array(_len11 > 1 ? _len11 - 1 : 0), _key11 = 1; _key11 < _len11; _key11++) {
values[_key11 - 1] = arguments[_key11];
}
return {
['_$litType$']: type,
strings,
values
};
};
var html = tag(HTML_RESULT);
var noChange = Symbol.for('lit-noChange');
var nothing = Symbol.for('lit-nothing');
var templateCache = new WeakMap();
var walker = d.createTreeWalker(d, 129, null, false);
var sanitizerFactoryInternal = noopSanitizer;
function trustFromTemplateString(tsa, stringFromTSA) {
if (!Array.isArray(tsa) || !tsa.hasOwnProperty('raw')) {
var message = 'invalid template strings array';
{
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 ".trim().replace(/\n */g, '\n');
}
throw new Error(message);
}
if (policy !== undefined) {
return policy.createHTML(stringFromTSA);
} else {
return stringFromTSA;
}
}
var getTemplateHtml = (strings, type) => {
var l = strings.length - 1;
var attrNames = [];
var html = type === SVG_RESULT ? '<svg>' : '';
var rawTextEndRegex;
var regex = textEndRegex;
for (var i = 0; i < l; i++) {
var s = strings[i];
var attrNameEndIndex = -1;
var attrName = void 0;
var lastIndex = 0;
var match = void 0;
while (lastIndex < s.length) {
regex.lastIndex = lastIndex;
match = regex.exec(s);
if (match === null) {
break;
}
lastIndex = regex.lastIndex;
if (regex === textEndRegex) {
if (match[COMMENT_START] === '!--') {
regex = commentEndRegex;
} else if (match[COMMENT_START] !== undefined) {
regex = comment2EndRegex;
} else if (match[TAG_NAME] !== undefined) {
if (rawTextElement.test(match[TAG_NAME])) {
rawTextEndRegex = new RegExp("</".concat(match[TAG_NAME]), 'g');
}
regex = tagEndRegex;
} else if (match[DYNAMIC_TAG_NAME] !== undefined) {
{
throw new Error('Bindings in tag names are not supported. Please use static templates instead. ' + 'See https://lit.dev/docs/templates/expressions/#static-expressions');
}
}
} else if (regex === tagEndRegex) {
if (match[ENTIRE_MATCH] === '>') {
if (rawTextEndRegex !== null && rawTextEndRegex !== void 0) {
regex = rawTextEndRegex;
} else {
regex = textEndRegex;
}
attrNameEndIndex = -1;
} else if (match[ATTRIBUTE_NAME] === undefined) {
attrNameEndIndex = -2;
} else {
attrNameEndIndex = regex.lastIndex - match[SPACES_AND_EQUALS].length;
attrName = match[ATTRIBUTE_NAME];
if (match[QUOTE_CHAR] === undefined) {
regex = tagEndRegex;
} else if (match[QUOTE_CHAR] === '"') {
regex = doubleQuoteAttrEndRegex;
} else {
regex = singleQuoteAttrEndRegex;
}
}
} else if (regex === doubleQuoteAttrEndRegex || regex === singleQuoteAttrEndRegex) {
regex = tagEndRegex;
} else if (regex === commentEndRegex || regex === comment2EndRegex) {
regex = textEndRegex;
} else {
regex = tagEndRegex;
rawTextEndRegex = undefined;
}
}
{
console.assert(attrNameEndIndex === -1 || regex === tagEndRegex || regex === singleQuoteAttrEndRegex || regex === doubleQuoteAttrEndRegex, 'unexpected parse state B');
}
var end = regex === tagEndRegex && strings[i + 1].startsWith('/>') ? ' ' : '';
if (regex === textEndRegex) {
html += s + nodeMarker;
} else if (attrNameEndIndex >= 0) {
html += (attrNames.push(attrName), s.slice(0, attrNameEndIndex) + boundAttributeSuffix + s.slice(attrNameEndIndex)) + marker + end;
} else {
html += s + marker + (attrNameEndIndex === -2 ? (attrNames.push(undefined), i) : end);
}
}
var htmlResult = html + (strings[l] || '<?>') + (type === SVG_RESULT ? '</svg>' : '');
return [trustFromTemplateString(strings, htmlResult), attrNames];
};
class Template {
constructor(_ref17, options) {
var {
strings,
['_$litType$']: type
} = _ref17;
this.parts = [];
var node;
var nodeIndex = 0;
var attrNameIndex = 0;
var partCount = strings.length - 1;
var parts = this.parts;
var [html, attrNames] = getTemplateHtml(strings, type);
this.el = Template.createElement(html, options);
walker.currentNode = this.el.content;
if (type === SVG_RESULT) {
var content = this.el.content;
var svgElement = content.firstChild;
svgElement.remove();
content.append(...svgElement.childNodes);
}
while ((node = walker.nextNode()) !== null && parts.length < partCount) {
if (node.nodeType === 1) {
{
var _tag5 = node.localName;
if (/^(?:textarea|template)$/i.test(_tag5) && node.innerHTML.includes(marker)) {
var m = "Expressions are not supported inside `".concat(_tag5, "` ") + "elements. See https://lit.dev/msg/expression-in-".concat(_tag5, " for more ") + "information.";
if (_tag5 === 'template') {
throw new Error(m);
} else {
issueWarning$1('', m);
}
}
}
if (node.hasAttributes()) {
var attrsToRemove = [];
for (var name of node.getAttributeNames()) {
if (name.endsWith(boundAttributeSuffix) || name.startsWith(marker)) {
var realName = attrNames[attrNameIndex++];
attrsToRemove.push(name);
if (realName !== undefined) {
var value = node.getAttribute(realName.toLowerCase() + boundAttributeSuffix);
var statics = value.split(marker);
var _m5 = /([.?@])?(.*)/.exec(realName);
parts.push({
type: ATTRIBUTE_PART,
index: nodeIndex,
name: _m5[2],
strings: statics,
ctor: _m5[1] === '.' ? PropertyPart : _m5[1] === '?' ? BooleanAttributePart : _m5[1] === '@' ? EventPart : AttributePart
});
} else {
parts.push({
type: ELEMENT_PART,
index: nodeIndex
});
}
}
}
for (var _name11 of attrsToRemove) {
node.removeAttribute(_name11);
}
}
if (rawTextElement.test(node.tagName)) {
var _strings5 = node.textContent.split(marker);
var lastIndex = _strings5.length - 1;
if (lastIndex > 0) {
if (trustedTypes) {
node.textContent = trustedTypes.emptyScript;
} else {
node.textContent = '';
}
for (var i = 0; i < lastIndex; i++) {
node.append(_strings5[i], createMarker());
walker.nextNode();
parts.push({
type: CHILD_PART,
index: ++nodeIndex
});
}
node.append(_strings5[lastIndex], createMarker());
}
}
} else if (node.nodeType === 8) {
var data = node.data;
if (data === markerMatch) {
parts.push({
type: CHILD_PART,
index: nodeIndex
});
} else {
var _i6 = -1;
while ((_i6 = node.data.indexOf(marker, _i6 + 1)) !== -1) {
parts.push({
type: COMMENT_PART,
index: nodeIndex
});
_i6 += marker.length - 1;
}
}
}
nodeIndex++;
}
if (debugLogEvent === null || debugLogEvent === void 0) {
0;
undefined;
} else {
debugLogEvent({
kind: 'template prep',
template: this,
clonableTemplate: this.el,
parts: this.parts,
strings
});
}
}
static createElement(html, _options) {
var el = d.createElement('template');
el.innerHTML = html;
return el;
}
}
function resolveDirective(part, value) {
var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : part;
var attributeIndex = arguments.length > 3 ? arguments[3] : undefined;
var _a, _b, _c;
var _d;
if (value === noChange) {
return value;
}
var currentDirective = attributeIndex !== undefined ? (_a = parent.__directives) === null || _a === void 0 ? void 0 : _a[attributeIndex] : parent.__directive;
var nextDirectiveConstructor = isPrimitive(value) ? undefined : value['_$litDirective$'];
if ((currentDirective === null || currentDirective === void 0 ? void 0 : currentDirective.constructor) !== nextDirectiveConstructor) {
if ((_b = currentDirective === null || currentDirective === void 0 ? void 0 : currentDirective['_$notifyDirectiveConnectionChanged']) === null || _b === void 0) {
0;
undefined;
} else {
_b.call(currentDirective, false);
}
if (nextDirectiveConstructor === undefined) {
currentDirective = undefined;
} else {
currentDirective = new nextDirectiveConstructor(part);
currentDirective._$initialize(part, parent, attributeIndex);
}
if (attributeIndex !== undefined) {
((_c = (_d = parent).__directives) !== null && _c !== void 0 ? _c : _d.__directives = [])[attributeIndex] = currentDirective;
} else {
parent.__directive = currentDirective;
}
}
if (currentDirective !== undefined) {
value = resolveDirective(part, currentDirective._$resolve(part, value.values), currentDirective, attributeIndex);
}
return value;
}
class TemplateInstance {
constructor(template, parent) {
this._$parts = [];
this._$disconnectableChildren = undefined;
this._$template = template;
this._$parent = parent;
}
get parentNode() {
return this._$parent.parentNode;
}
get _$isConnected() {
return this._$parent._$isConnected;
}
_clone(options) {
var _a;
var {
el: {
content
},
parts: parts
} = this._$template;
var fragment = ((_a = options === null || options === void 0 ? void 0 : options.creationScope) !== null && _a !== void 0 ? _a : d).importNode(content, true);
walker.currentNode = fragment;
var node = walker.nextNode();
var nodeIndex = 0;
var partIndex = 0;
var templatePart = parts[0];
while (templatePart !== undefined) {
if (nodeIndex === templatePart.index) {
var part = void 0;
if (templatePart.type === CHILD_PART) {
part = new ChildPart(node, node.nextSibling, this, options);
} else if (templatePart.type === ATTRIBUTE_PART) {
part = new templatePart.ctor(node, templatePart.name, templatePart.strings, this, options);
} else if (templatePart.type === ELEMENT_PART) {
part = new ElementPart(node, this, options);
}
this._$parts.push(part);
templatePart = parts[++partIndex];
}
if (nodeIndex !== (templatePart === null || templatePart === void 0 ? void 0 : templatePart.index)) {
node = walker.nextNode();
nodeIndex++;
}
}
walker.currentNode = d;
return fragment;
}
_update(values) {
var i = 0;
for (var part of this._$parts) {
if (part !== undefined) {
if (debugLogEvent === null || debugLogEvent === void 0) {
0;
undefined;
} else {
debugLogEvent({
kind: 'set part',
part,
value: values[i],
valueIndex: i,
values,
templateInstance: this
});
}
if (part.strings !== undefined) {
part._$setValue(values, part, i);
i += part.strings.length - 2;
} else {
part._$setValue(values[i]);
}
}
i++;
}
}
}
class ChildPart {
constructor(startNode, endNode, parent, options) {
var _a;
this.type = CHILD_PART;
this._$committedValue = nothing;
this._$disconnectableChildren = undefined;
this._$startNode = startNode;
this._$endNode = endNode;
this._$parent = parent;
this.options = options;
if ((_a = options === null || options === void 0 ? void 0 : options.isConnected) !== null && _a !== void 0) {
this.__isConnected = _a;
} else {
this.__isConnected = true;
}
{
this._textSanitizer = undefined;
}
}
get _$isConnected() {
var _a, _b;
if ((_b = (_a = this._$parent) === null || _a === void 0 ? void 0 : _a._$isConnected) !== null && _b !== void 0) {
return _b;
} else {
return this.__isConnected;
}
}
get parentNode() {
var parentNode = wrap(this._$startNode).parentNode;
var parent = this._$parent;
if (parent !== undefined && (parentNode === null || parentNode === void 0 ? void 0 : parentNode.nodeType) === 11) {
parentNode = parent.parentNode;
}
return parentNode;
}
get startNode() {
return this._$startNode;
}
get endNode() {
return this._$endNode;
}
_$setValue(value) {
var directiveParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
var _a;
if (this.parentNode === null) {
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.");
}
value = resolveDirective(this, value, directiveParent);
if (isPrimitive(value)) {
if (value === nothing || value == null || value === '') {
if (this._$committedValue !== nothing) {
if (debugLogEvent === null || debugLogEvent === void 0) {
0;
undefined;
} else {
debugLogEvent({
kind: 'commit nothing to child',
start: this._$startNode,
end: this._$endNode,
parent: this._$parent,
options: this.options
});
}
this._$clear();
}
this._$committedValue = nothing;
} else if (value !== this._$committedValue && value !== noChange) {
this._commitText(value);
}
} else if (value['_$litType$'] !== undefined) {
this._commitTemplateResult(value);
} else if (value.nodeType !== undefined) {
if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.host) === value) {
this._commitText("[probable mistake: rendered a template's host in itself " + "(commonly caused by writing ${this} in a template]");
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.");
return;
}
this._commitNode(value);
} else if (isIterable(value)) {
this._commitIterable(value);
} else {
this._commitText(value);
}
}
_insert(node) {
return wrap(wrap(this._$startNode).parentNode).insertBefore(node, this._$endNode);
}
_commitNode(value) {
var _a;
if (this._$committedValue !== value) {
this._$clear();
if (sanitizerFactoryInternal !== noopSanitizer) {
var parentNodeName = (_a = this._$startNode.parentNode) === null || _a === void 0 ? void 0 : _a.nodeName;
if (parentNodeName === 'STYLE' || parentNodeName === 'SCRIPT') {
var message = 'Forbidden';
{
if (parentNodeName === 'STYLE') {
message = "Lit does not support binding inside style nodes. " + "This is a security risk, as style injection attacks can " + "exfiltrate data and spoof UIs. " + "Consider instead using css`...` literals " + "to compose styles, and make do dynamic styling with " + "css custom properties, ::parts, <slot>s, " + "and by mutating the DOM rather than stylesheets.";
} else {
message = "Lit does not support binding inside script nodes. " + "This is a security risk, as it could allow arbitrary " + "code execution.";
}
}
throw new Error(message);
}
}
if (debugLogEvent === null || debugLogEvent === void 0) {
0;
undefined;
} else {
debugLogEvent({
kind: 'commit node',
start: this._$startNode,
parent: this._$parent,
value: value,
options: this.options
});
}
this._$committedValue = this._insert(value);
}
}
_commitText(value) {
if (this._$committedValue !== nothing && isPrimitive(this._$committedValue)) {
var node = wrap(this._$startNode).nextSibling;
{
if (this._textSanitizer === undefined) {
this._textSanitizer = createSanitizer(node, 'data', 'property');
}
value = this._textSanitizer(value);
}
if (debugLogEvent === null || debugLogEvent === void 0) {
0;
undefined;
} else {
debugLogEvent({
kind: 'commit text',
node,
value,
options: this.options
});
}
node.data = value;
} else {
{
var textNode = d.createTextNode('');
this._commitNode(textNode);
if (this._textSanitizer === undefined) {
this._textSanitizer = createSanitizer(textNode, 'data', 'property');
}
value = this._textSanitizer(value);
if (debugLogEvent === null || debugLogEvent === void 0) {
0;
undefined;
} else {
debugLogEvent({
kind: 'commit text',
node: textNode,
value,
options: this.options
});
}
textNode.data = value;
}
}
this._$committedValue = value;
}
_commitTemplateResult(result) {
var _a;
var {
values,
['_$litType$']: type
} = result;
var template = typeof type === 'number' ? this._$getTemplate(result) : (type.el === undefined && (type.el = Template.createElement(trustFromTemplateString(type.h, type.h[0]), this.options)), type);
if (((_a = this._$committedValue) === null || _a === void 0 ? void 0 : _a._$template) === template) {
if (debugLogEvent === null || debugLogEvent === void 0) {
0;
undefined;
} else {
debugLogEvent({
kind: 'template updating',
template,
instance: this._$committedValue,
parts: this._$committedValue._$parts,
options: this.options,
values
});
}
this._$committedValue._update(values);
} else {
var instance = new TemplateInstance(template, this);
var fragment = instance._clone(this.options);
if (debugLogEvent === null || debugLogEvent === void 0) {
0;
undefined;
} else {
debugLogEvent({
kind: 'template instantiated',
template,
instance,
parts: instance._$parts,
options: this.options,
fragment,
values
});
}
instance._update(values);
if (debugLogEvent === null || debugLogEvent === void 0) {
0;
undefined;
} else {
debugLogEvent({
kind: 'template instantiated and updated',
template,
instance,
parts: instance._$parts,
options: this.options,
fragment,
values
});
}
this._commitNode(fragment);
this._$committedValue = instance;
}
}
_$getTemplate(result) {
var template = templateCache.get(result.strings);
if (template === undefined) {
templateCache.set(result.strings, template = new Template(result));
}
return template;
}
_commitIterable(value) {
if (!isArray(this._$committedValue)) {
this._$committedValue = [];
this._$clear();
}
var itemParts = this._$committedValue;
var partIndex = 0;
var itemPart;
for (var item of value) {
if (partIndex === itemParts.length) {
itemParts.push(itemPart = new ChildPart(this._insert(createMarker()), this._insert(createMarker()), this, this.options));
} else {
itemPart = itemParts[partIndex];
}
itemPart._$setValue(item);
partIndex++;
}
if (partIndex < itemParts.length) {
this._$clear(itemPart && wrap(itemPart._$endNode).nextSibling, partIndex);
itemParts.length = partIndex;
}
}
_$clear() {
var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : wrap(this._$startNode).nextSibling;
var from = arguments.length > 1 ? arguments[1] : undefined;
var _a;
if ((_a = this._$notifyConnectionChanged) === null || _a === void 0) {
0;
undefined;
} else {
_a.call(this, false, true, from);
}
while (start && start !== this._$endNode) {
var n = wrap(start).nextSibling;
wrap(start).remove();
start = n;
}
}
setConnected(isConnected) {
var _a;
if (this._$parent === undefined) {
this.__isConnected = isConnected;
if ((_a = this._$notifyConnectionChanged) === null || _a === void 0) {
0;
undefined;
} else {
_a.call(this, isConnected);
}
} else {
throw new Error('part.setConnected() may only be called on a ' + 'RootPart returned from render().');
}
}
}
class AttributePart {
constructor(element, name, strings, parent, options) {
this.type = ATTRIBUTE_PART;
this._$committedValue = nothing;
this._$disconnectableChildren = undefined;
this.element = element;
this.name = name;
this._$parent = parent;
this.options = options;
if (strings.length > 2 || strings[0] !== '' || strings[1] !== '') {
this._$committedValue = new Array(strings.length - 1).fill(new String());
this.strings = strings;
} else {
this._$committedValue = nothing;
}
{
this._sanitizer = undefined;
}
}
get tagName() {
return this.element.tagName;
}
get _$isConnected() {
return this._$parent._$isConnected;
}
_$setValue(value) {
var directiveParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
var valueIndex = arguments.length > 2 ? arguments[2] : undefined;
var noCommit = arguments.length > 3 ? arguments[3] : undefined;
var strings = this.strings;
var change = false;
if (strings === undefined) {
value = resolveDirective(this, value, directiveParent, 0);
change = !isPrimitive(value) || value !== this._$committedValue && value !== noChange;
if (change) {
this._$committedValue = value;
}
} else {
var values = value;
value = strings[0];
var i, v;
for (i = 0; i < strings.length - 1; i++) {
v = resolveDirective(this, values[valueIndex + i], directiveParent, i);
if (v === noChange) {
v = this._$committedValue[i];
}
if (!change) {
change = !isPrimitive(v) || v !== this._$committedValue[i];
}
if (v === nothing) {
value = nothing;
} else if (value !== nothing) {
value += (v !== null && v !== void 0 ? v : '') + strings[i + 1];
}
this._$committedValue[i] = v;
}
}
if (change && !noCommit) {
this._commitValue(value);
}
}
_commitValue(value) {
if (value === nothing) {
wrap(this.element).removeAttribute(this.name);
} else {
{
if (this._sanitizer === undefined) {
this._sanitizer = sanitizerFactoryInternal(this.element, this.name, 'attribute');
}
value = this._sanitizer(value !== null && value !== void 0 ? value : '');
}
if (debugLogEvent === null || debugLogEvent === void 0) {
0;
undefined;
} else {
debugLogEvent({
kind: 'commit attribute',
element: this.element,
name: this.name,
value,
options: this.options
});
}
wrap(this.element).setAttribute(this.name, value !== null && value !== void 0 ? value : '');
}
}
}
class PropertyPart extends AttributePart {
constructor() {
super(...arguments);
this.type = PROPERTY_PART;
}
_commitValue(value) {
{
if (this._sanitizer === undefined) {
this._sanitizer = sanitizerFactoryInternal(this.element, this.name, 'property');
}
value = this._sanitizer(value);
}
if (debugLogEvent === null || debugLogEvent === void 0) {
0;
undefined;
} else {
debugLogEvent({
kind: 'commit property',
element: this.element,
name: this.name,
value,
options: this.options
});
}
if (value === nothing) {
this.element[this.name] = undefined;
} else {
this.element[this.name] = value;
}
}
}
var emptyStringForBooleanAttribute = trustedTypes ? trustedTypes.emptyScript : '';
class BooleanAttributePart extends AttributePart {
constructor() {
super(...arguments);
this.type = BOOLEAN_ATTRIBUTE_PART;
}
_commitValue(value) {
if (debugLogEvent === null || debugLogEvent === void 0) {
0;
undefined;
} else {
debugLogEvent({
kind: 'commit boolean attribute',
element: this.element,
name: this.name,
value: !!(value && value !== nothing),
options: this.options
});
}
if (value && value !== nothing) {
wrap(this.element).setAttribute(this.name, emptyStringForBooleanAttribute);
} else {
wrap(this.element).removeAttribute(this.name);
}
}
}
class EventPart extends AttributePart {
constructor(element, name, strings, parent, options) {
super(element, name, strings, parent, options);
this.type = EVENT_PART;
if (this.strings !== undefined) {
throw new Error("A `<".concat(element.localName, ">` has a `@").concat(name, "=...` listener with ") + 'invalid content. Event listeners in templates must have exactly ' + 'one expression and no surrounding text.');
}
}
_$setValue(newListener) {
var directiveParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this;
var _a;
if ((_a = resolveDirective(this, newListener, directiveParent, 0)) !== null && _a !== void 0) {
newListener = _a;
} else {
newListener = nothing;
}
if (newListener === noChange) {
return;
}
var oldListener = this._$committedValue;
var shouldRemoveListener = newListener === nothing && oldListener !== nothing || newListener.capture !== oldListener.capture || newListener.once !== oldListener.once || newListener.passive !== oldListener.passive;
var shouldAddListener = newListener !== nothing && (oldListener === nothing || shouldRemoveListener);
if (debugLogEvent === null || debugLogEvent === void 0) {
0;
undefined;
} else {
debugLogEvent({
kind: 'commit event listener',
element: this.element,
name: this.name,
value: newListener,
options: this.options,
removeListener: shouldRemoveListener,
addListener: shouldAddListener,
oldListener
});
}
if (shouldRemoveListener) {
this.element.removeEventListener(this.name, this, oldListener);
}
if (shouldAddListener) {
this.element.addEventListener(this.name, this, newListener);
}
this._$committedValue = newListener;
}
handleEvent(event) {
var _a, _b;
if (typeof this._$committedValue === 'function') {
this._$committedValue.call((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.host) !== null && _b !== void 0 ? _b : this.element, event);
} else {
this._$committedValue.handleEvent(event);
}
}
}
class ElementPart {
constructor(element, parent, options) {
this.element = element;
this.type = ELEMENT_PART;
this._$disconnectableChildren = undefined;
this._$parent = parent;
this.options = options;
}
get _$isConnected() {
return this._$parent._$isConnected;
}
_$setValue(value) {
if (debugLogEvent === null || debugLogEvent === void 0) {
0;
undefined;
} else {
debugLogEvent({
kind: 'commit to element binding',
element: this.element,
value,
options: this.options
});
}
resolveDirective(this, value);
}
}
var polyfillSupport$1 = global$2.litHtmlPolyfillSupportDevMode;
if (polyfillSupport$1 === null || polyfillSupport$1 === void 0) {
0;
undefined;
} else {
polyfillSupport$1(Template, ChildPart);
}
((_d = global$2.litHtmlVersions) !== null && _d !== void 0 ? _d : global$2.litHtmlVersions = []).push('2.8.0');
if (global$2.litHtmlVersions.length > 1) {
issueWarning$1('multiple-versions', "Multiple versions of Lit loaded. " + "Loading multiple versions is not recommended.");
}
var render = (value, container, options) => {
var _a, _b;
if (container == null) {
throw new TypeError("The container to render into may not be ".concat(container));
}
var renderId = debugLogRenderId++;
var partOwnerNode = (_a = options === null || options === void 0 ? void 0 : options.renderBefore) !== null && _a !== void 0 ? _a : container;
var part = partOwnerNode['_$litPart$'];
if (debugLogEvent === null || debugLogEvent === void 0) {
0;
undefined;
} else {
debugLogEvent({
kind: 'begin render',
id: renderId,
value,
container,
options,
part
});
}
if (part === undefined) {
var endNode = (_b = options === null || options === void 0 ? void 0 : options.renderBefore) !== null && _b !== void 0 ? _b : null;
partOwnerNode['_$litPart$'] = part = new ChildPart(container.insertBefore(createMarker(), endNode), endNode, undefined, options !== null && options !== void 0 ? options : {});
}
part._$setValue(value);
if (debugLogEvent === null || debugLogEvent === void 0) {
0;
undefined;
} else {
debugLogEvent({
kind: 'end render',
id: renderId,
value,
container,
options,
part
});
}
return part;
};
{
render.setSanitizer = setSanitizer;
render.createSanitizer = createSanitizer;
{
render._testOnlyClearSanitizerFactoryDoNotCallOrElse = _testOnlyClearSanitizerFactoryDoNotCallOrElse;
}
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var _a$1, _b, _c;
var issueWarning;
{
var _issuedWarnings9 = (_a$1 = globalThis.litIssuedWarnings) !== null && _a$1 !== void 0 ? _a$1 : globalThis.litIssuedWarnings = new Set();
issueWarning = (code, warning) => {
warning += " See https://lit.dev/msg/".concat(code, " for more information.");
if (!_issuedWarnings9.has(warning)) {
console.warn(warning);
_issuedWarnings9.add(warning);
}
};
}
class LitElement extends ReactiveElement {
constructor() {
super(...arguments);
this.renderOptions = {
host: this
};
this.__childPart = undefined;
}
createRenderRoot() {
var _a;
var _b;
var renderRoot = super.createRenderRoot();
if ((_a = (_b = this.renderOptions).renderBefore) !== null && _a !== void 0) {
_a;
} else {
_b.renderBefore = renderRoot.firstChild;
}
return renderRoot;
}
update(changedProperties) {
var value = this.render();
if (!this.hasUpdated) {
this.renderOptions.isConnected = this.isConnected;
}
super.update(changedProperties);
this.__childPart = render(value, this.renderRoot, this.renderOptions);
}
connectedCallback() {
var _a;
super.connectedCallback();
if ((_a = this.__childPart) === null || _a === void 0) {
0;
undefined;
} else {
_a.setConnected(true);
}
}
disconnectedCallback() {
var _a;
super.disconnectedCallback();
if ((_a = this.__childPart) === null || _a === void 0) {
0;
undefined;
} else {
_a.setConnected(false);
}
}
render() {
return noChange;
}
}
LitElement['finalized'] = true;
LitElement['_$litElement$'] = true;
if ((_b = globalThis.litElementHydrateSupport) === null || _b === void 0) {
0;
undefined;
} else {
_b.call(globalThis, {
LitElement
});
}
var polyfillSupport = globalThis.litElementPolyfillSupportDevMode;
if (polyfillSupport === null || polyfillSupport === void 0) {
0;
undefined;
} else {
polyfillSupport({
LitElement
});
}
{
LitElement['finalize'] = function () {
var finalized = ReactiveElement.finalize.call(this);
if (!finalized) {
return false;
}
var warnRemovedOrRenamed = function warnRemovedOrRenamed(obj, name) {
var renamed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (obj.hasOwnProperty(name)) {
var ctorName = (typeof obj === 'function' ? obj : obj.constructor).name;
issueWarning(renamed ? 'renamed-api' : 'removed-api', "`".concat(name, "` is implemented on class ").concat(ctorName, ". It ") + "has been ".concat(renamed ? 'renamed' : 'removed', " ") + "in this version of LitElement.");
}
};
warnRemovedOrRenamed(this, 'render');
warnRemovedOrRenamed(this, 'getStyles', true);
warnRemovedOrRenamed(this.prototype, 'adoptStyles');
return true;
};
}
((_c = globalThis.litElementVersions) !== null && _c !== void 0 ? _c : globalThis.litElementVersions = []).push('3.3.3');
if (globalThis.litElementVersions.length > 1) {
issueWarning('multiple-versions', "Multiple versions of Lit loaded. Loading multiple versions " + "is not recommended.");
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var standardProperty = (options, element) => {
if (element.kind === 'method' && element.descriptor && !('value' in element.descriptor)) {
return _objectSpread(_objectSpread({}, element), {}, {
finisher(clazz) {
clazz.createProperty(element.key, options);
}
});
} else {
return {
kind: 'field',
key: Symbol(),
placement: 'own',
descriptor: {},
originalKey: element.key,
initializer() {
if (typeof element.initializer === 'function') {
this[element.key] = element.initializer.call(this);
}
},
finisher(clazz) {
clazz.createProperty(element.key, options);
}
};
}
};
var legacyProperty = (options, proto, name) => {
proto.constructor.createProperty(name, options);
};
function property(options) {
return (protoOrDescriptor, name) => name !== undefined ? legacyProperty(options, protoOrDescriptor, name) : standardProperty(options, protoOrDescriptor);
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function state(options) {
return property(_objectSpread(_objectSpread({}, options), {}, {
state: true
}));
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var decorateProperty = _ref18 => {
var {
finisher,
descriptor
} = _ref18;
return (protoOrDescriptor, name) => {
var _a;
if (name !== undefined) {
var ctor = protoOrDescriptor.constructor;
if (descriptor !== undefined) {
Object.defineProperty(protoOrDescriptor, name, descriptor(name));
}
if (finisher === null || finisher === void 0) {
0;
undefined;
} else {
finisher(ctor, name);
}
} else {
var key = (_a = protoOrDescriptor.originalKey) !== null && _a !== void 0 ? _a : protoOrDescriptor.key;
var info = descriptor != undefined ? {
kind: 'method',
placement: 'prototype',
key,
descriptor: descriptor(protoOrDescriptor.key)
} : _objectSpread(_objectSpread({}, protoOrDescriptor), {}, {
key
});
if (finisher != undefined) {
info.finisher = function (ctor) {
finisher(ctor, key);
};
}
return info;
}
};
};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function query(selector, cache) {
return decorateProperty({
descriptor: name => {
var descriptor = {
get() {
var _a, _b;
if ((_b = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(selector)) !== null && _b !== void 0) {
return _b;
} else {
return null;
}
},
enumerable: true,
configurable: true
};
if (cache) {
var key = typeof name === 'symbol' ? Symbol() : "__".concat(name);
descriptor.get = function () {
var _a, _b;
if (this[key] === undefined) {
if ((_b = (_a = this.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(selector)) !== null && _b !== void 0) {
this[key] = _b;
} else {
this[key] = null;
}
}
return this[key];
};
}
return descriptor;
}
});
}
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var _a;
var global$1 = window;
if (((_a = global$1.HTMLSlotElement) === null || _a === void 0 ? void 0 : _a.prototype.assignedElements) != null) {
(slot, opts) => slot.assignedElements(opts);
} else {
(slot, opts) => slot.assignedNodes(opts).filter(node => node.nodeType === Node.ELEMENT_NODE);
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var PartType = {
ATTRIBUTE: 1,
CHILD: 2,
PROPERTY: 3,
BOOLEAN_ATTRIBUTE: 4,
EVENT: 5,
ELEMENT: 6
};
var directive = c => function () {
for (var _len12 = arguments.length, values = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
values[_key12] = arguments[_key12];
}
return {
['_$litDirective$']: c,
values
};
};
class Directive {
constructor(_partInfo) {}
get _$isConnected() {
return this._$parent._$isConnected;
}
_$initialize(part, parent, attributeIndex) {
this.__part = part;
this._$parent = parent;
this.__attributeIndex = attributeIndex;
}
_$resolve(part, props) {
return this.update(part, props);
}
update(_part, props) {
return this.render(...props);
}
}
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
class ClassMapDirective extends Directive {
constructor(partInfo) {
var _a;
super(partInfo);
if (partInfo.type !== PartType.ATTRIBUTE || partInfo.name !== 'class' || ((_a = partInfo.strings) === null || _a === void 0 ? void 0 : _a.length) > 2) {
throw new Error('`classMap()` can only be used in the `class` attribute ' + 'and must be the only part in the attribute.');
}
}
render(classInfo) {
return ' ' + Object.keys(classInfo).filter(key => classInfo[key]).join(' ') + ' ';
}
update(part, _ref19) {
var [classInfo] = _ref19;
var _a, _b;
if (this._previousClasses === undefined) {
this._previousClasses = new Set();
if (part.strings !== undefined) {
this._staticClasses = new Set(part.strings.join(' ').split(/\s/).filter(s => s !== ''));
}
for (var name in classInfo) {
if (classInfo[name] && !((_a = this._staticClasses) === null || _a === void 0 ? void 0 : _a.has(name))) {
this._previousClasses.add(name);
}
}
return this.render(classInfo);
}
var classList = part.element.classList;
this._previousClasses.forEach(name => {
if (!(name in classInfo)) {
classList.remove(name);
this._previousClasses.delete(name);
}
});
for (var _name12 in classInfo) {
var value = !!classInfo[_name12];
if (value !== this._previousClasses.has(_name12) && !((_b = this._staticClasses) === null || _b === void 0 ? void 0 : _b.has(_name12))) {
if (value) {
classList.add(_name12);
this._previousClasses.add(_name12);
} else {
classList.remove(_name12);
this._previousClasses.delete(_name12);
}
}
}
return noChange;
}
}
var classMap = directive(ClassMapDirective);
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
var important = 'important';
var importantFlag = ' !' + important;
var flagTrim = 0 - importantFlag.length;
class StyleMapDirective extends Directive {
constructor(partInfo) {
var _a;
super(partInfo);
if (partInfo.type !== PartType.ATTRIBUTE || partInfo.name !== 'style' || ((_a = partInfo.strings) === null || _a === void 0 ? void 0 : _a.length) > 2) {
throw new Error('The `styleMap` directive must be used in the `style` attribute ' + 'and must be the only part in the attribute.');
}
}
render(styleInfo) {
return Object.keys(styleInfo).reduce((style, prop) => {
var value = styleInfo[prop];
if (value == null) {
return style;
}
if (prop.includes('-')) {
prop = prop;
} else {
prop = prop.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, '-$&').toLowerCase();
}
return style + "".concat(prop, ":").concat(value, ";");
}, '');
}
update(part, _ref20) {
var [styleInfo] = _ref20;
var {
style
} = part.element;
if (this._previousStyleProperties === undefined) {
this._previousStyleProperties = new Set();
for (var name in styleInfo) {
this._previousStyleProperties.add(name);
}
return this.render(styleInfo);
}
this._previousStyleProperties.forEach(name => {
if (styleInfo[name] == null) {
this._previousStyleProperties.delete(name);
if (name.includes('-')) {
style.removeProperty(name);
} else {
style[name] = '';
}
}
});
for (var _name13 in styleInfo) {
var value = styleInfo[_name13];
if (value != null) {
this._previousStyleProperties.add(_name13);
var isImportant = typeof value === 'string' && value.endsWith(importantFlag);
if (_name13.includes('-') || isImportant) {
style.setProperty(_name13, isImportant ? value.slice(0, flagTrim) : value, isImportant ? important : '');
} else {
style[_name13] = value;
}
}
}
return noChange;
}
}
var styleMap = directive(StyleMapDirective);
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
class RippleBase extends BaseElement {
constructor() {
super(...arguments);
this.primary = false;
this.accent = false;
this.unbounded = false;
this.disabled = false;
this.activated = false;
this.selected = false;
this.internalUseStateLayerCustomProperties = false;
this.hovering = false;
this.bgFocused = false;
this.fgActivation = false;
this.fgDeactivation = false;
this.fgScale = '';
this.fgSize = '';
this.translateStart = '';
this.translateEnd = '';
this.leftPos = '';
this.topPos = '';
this.mdcFoundationClass = MDCRippleFoundation$1;
}
get isActive() {
return matches(this.parentElement || this, ':active');
}
createAdapter() {
return {
browserSupportsCssVars: () => true,
isUnbounded: () => this.unbounded,
isSurfaceActive: () => this.isActive,
isSurfaceDisabled: () => this.disabled,
addClass: className => {
switch (className) {
case 'mdc-ripple-upgraded--background-focused':
this.bgFocused = true;
break;
case 'mdc-ripple-upgraded--foreground-activation':
this.fgActivation = true;
break;
case 'mdc-ripple-upgraded--foreground-deactivation':
this.fgDeactivation = true;
break;
}
},
removeClass: className => {
switch (className) {
case 'mdc-ripple-upgraded--background-focused':
this.bgFocused = false;
break;
case 'mdc-ripple-upgraded--foreground-activation':
this.fgActivation = false;
break;
case 'mdc-ripple-upgraded--foreground-deactivation':
this.fgDeactivation = false;
break;
}
},
containsEventTarget: () => true,
registerInteractionHandler: () => undefined,
deregisterInteractionHandler: () => undefined,
registerDocumentInteractionHandler: () => undefined,
deregisterDocumentInteractionHandler: () => undefined,
registerResizeHandler: () => undefined,
deregisterResizeHandler: () => undefined,
updateCssVariable: (varName, value) => {
switch (varName) {
case '--mdc-ripple-fg-scale':
this.fgScale = value;
break;
case '--mdc-ripple-fg-size':
this.fgSize = value;
break;
case '--mdc-ripple-fg-translate-end':
this.translateEnd = value;
break;
case '--mdc-ripple-fg-translate-start':
this.translateStart = value;
break;
case '--mdc-ripple-left':
this.leftPos = value;
break;
case '--mdc-ripple-top':
this.topPos = value;
break;
}
},
computeBoundingRect: () => (this.parentElement || this).getBoundingClientRect(),
getWindowPageOffset: () => ({
x: window.pageXOffset,
y: window.pageYOffset
})
};
}
startPress(ev) {
this.waitForFoundation(() => {
this.mdcFoundation.activate(ev);
});
}
endPress() {
this.waitForFoundation(() => {
this.mdcFoundation.deactivate();
});
}
startFocus() {
this.waitForFoundation(() => {
this.mdcFoundation.handleFocus();
});
}
endFocus() {
this.waitForFoundation(() => {
this.mdcFoundation.handleBlur();
});
}
startHover() {
this.hovering = true;
}
endHover() {
this.hovering = false;
}
waitForFoundation(fn) {
if (this.mdcFoundation) {
fn();
} else {
this.updateComplete.then(fn);
}
}
update(changedProperties) {
if (changedProperties.has('disabled')) {
if (this.disabled) {
this.endHover();
}
}
super.update(changedProperties);
}
render() {
var shouldActivateInPrimary = this.activated && (this.primary || !this.accent);
var shouldSelectInPrimary = this.selected && (this.primary || !this.accent);
var classes = {
'mdc-ripple-surface--accent': this.accent,
'mdc-ripple-surface--primary--activated': shouldActivateInPrimary,
'mdc-ripple-surface--accent--activated': this.accent && this.activated,
'mdc-ripple-surface--primary--selected': shouldSelectInPrimary,
'mdc-ripple-surface--accent--selected': this.accent && this.selected,
'mdc-ripple-surface--disabled': this.disabled,
'mdc-ripple-surface--hover': this.hovering,
'mdc-ripple-surface--primary': this.primary,
'mdc-ripple-surface--selected': this.selected,
'mdc-ripple-upgraded--background-focused': this.bgFocused,
'mdc-ripple-upgraded--foreground-activation': this.fgActivation,
'mdc-ripple-upgraded--foreground-deactivation': this.fgDeactivation,
'mdc-ripple-upgraded--unbounded': this.unbounded,
'mdc-ripple-surface--internal-use-state-layer-custom-properties': this.internalUseStateLayerCustomProperties
};
return html(_templateObject33 || (_templateObject33 = _taggedTemplateLiteral(["\n <div class=\"mdc-ripple-surface mdc-ripple-upgraded ", "\"\n style=\"", "\"></div>"])), classMap(classes), styleMap({
'--mdc-ripple-fg-scale': this.fgScale,
'--mdc-ripple-fg-size': this.fgSize,
'--mdc-ripple-fg-translate-end': this.translateEnd,
'--mdc-ripple-fg-translate-start': this.translateStart,
'--mdc-ripple-left': this.leftPos,
'--mdc-ripple-top': this.topPos
}));
}
}
__decorate([query('.mdc-ripple-surface')], RippleBase.prototype, "mdcRoot", void 0);
__decorate([property({
type: Boolean
})], RippleBase.prototype, "primary", void 0);
__decorate([property({
type: Boolean
})], RippleBase.prototype, "accent", void 0);
__decorate([property({
type: Boolean
})], RippleBase.prototype, "unbounded", void 0);
__decorate([property({
type: Boolean
})], RippleBase.prototype, "disabled", void 0);
__decorate([property({
type: Boolean
})], RippleBase.prototype, "activated", void 0);
__decorate([property({
type: Boolean
})], RippleBase.prototype, "selected", void 0);
__decorate([property({
type: Boolean
})], RippleBase.prototype, "internalUseStateLayerCustomProperties", void 0);
__decorate([state()], RippleBase.prototype, "hovering", void 0);
__decorate([state()], RippleBase.prototype, "bgFocused", void 0);
__decorate([state()], RippleBase.prototype, "fgActivation", void 0);
__decorate([state()], RippleBase.prototype, "fgDeactivation", void 0);
__decorate([state()], RippleBase.prototype, "fgScale", void 0);
__decorate([state()], RippleBase.prototype, "fgSize", void 0);
__decorate([state()], RippleBase.prototype, "translateStart", void 0);
__decorate([state()], RippleBase.prototype, "translateEnd", void 0);
__decorate([state()], RippleBase.prototype, "leftPos", void 0);
__decorate([state()], RippleBase.prototype, "topPos", void 0);
/**
* @license
* Copyright 2021 Google LLC
* SPDX-LIcense-Identifier: Apache-2.0
*/
var styles = css(_templateObject34 || (_templateObject34 = _taggedTemplateLiteral([".mdc-ripple-surface{--mdc-ripple-fg-size: 0;--mdc-ripple-left: 0;--mdc-ripple-top: 0;--mdc-ripple-fg-scale: 1;--mdc-ripple-fg-translate-end: 0;--mdc-ripple-fg-translate-start: 0;-webkit-tap-highlight-color:rgba(0,0,0,0);will-change:transform,opacity;position:relative;outline:none;overflow:hidden}.mdc-ripple-surface::before,.mdc-ripple-surface::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:\"\"}.mdc-ripple-surface::before{transition:opacity 15ms linear,background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}.mdc-ripple-surface::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}.mdc-ripple-surface.mdc-ripple-upgraded::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface.mdc-ripple-upgraded::after{top:0;left:0;transform:scale(0);transform-origin:center center}.mdc-ripple-surface.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-activation::after{animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-deactivation::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface::before,.mdc-ripple-surface::after{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}.mdc-ripple-surface.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded],.mdc-ripple-upgraded--unbounded{overflow:visible}.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::after,.mdc-ripple-upgraded--unbounded::before,.mdc-ripple-upgraded--unbounded::after{top:calc(50% - 50%);left:calc(50% - 50%);width:100%;height:100%}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::before,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{top:var(--mdc-ripple-top, calc(50% - 50%));left:var(--mdc-ripple-left, calc(50% - 50%));width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface::before,.mdc-ripple-surface::after{background-color:#000;background-color:var(--mdc-ripple-color, #000)}.mdc-ripple-surface:hover::before,.mdc-ripple-surface.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}:host{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;display:block}:host .mdc-ripple-surface{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;will-change:unset}.mdc-ripple-surface--primary::before,.mdc-ripple-surface--primary::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-ripple-surface--primary:hover::before,.mdc-ripple-surface--primary.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface--primary.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--primary.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--primary--activated::before{opacity:0.12;opacity:var(--mdc-ripple-activated-opacity, 0.12)}.mdc-ripple-surface--primary--activated::before,.mdc-ripple-surface--primary--activated::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-ripple-surface--primary--activated:hover::before,.mdc-ripple-surface--primary--activated.mdc-ripple-surface--hover::before{opacity:0.16;opacity:var(--mdc-ripple-hover-opacity, 0.16)}.mdc-ripple-surface--primary--activated.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--primary--activated:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-focus-opacity, 0.24)}.mdc-ripple-surface--primary--activated:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--primary--activated:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--primary--activated.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--primary--selected::before{opacity:0.08;opacity:var(--mdc-ripple-selected-opacity, 0.08)}.mdc-ripple-surface--primary--selected::before,.mdc-ripple-surface--primary--selected::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-ripple-surface--primary--selected:hover::before,.mdc-ripple-surface--primary--selected.mdc-ripple-surface--hover::before{opacity:0.12;opacity:var(--mdc-ripple-hover-opacity, 0.12)}.mdc-ripple-surface--primary--selected.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--primary--selected:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-focus-opacity, 0.2)}.mdc-ripple-surface--primary--selected:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--primary--selected:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--primary--selected.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--accent::before,.mdc-ripple-surface--accent::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-ripple-surface--accent:hover::before,.mdc-ripple-surface--accent.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface--accent.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--accent.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--accent--activated::before{opacity:0.12;opacity:var(--mdc-ripple-activated-opacity, 0.12)}.mdc-ripple-surface--accent--activated::before,.mdc-ripple-surface--accent--activated::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-ripple-surface--accent--activated:hover::before,.mdc-ripple-surface--accent--activated.mdc-ripple-surface--hover::before{opacity:0.16;opacity:var(--mdc-ripple-hover-opacity, 0.16)}.mdc-ripple-surface--accent--activated.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--accent--activated:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-focus-opacity, 0.24)}.mdc-ripple-surface--accent--activated:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--accent--activated:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--accent--activated.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--accent--selected::before{opacity:0.08;opacity:var(--mdc-ripple-selected-opacity, 0.08)}.mdc-ripple-surface--accent--selected::before,.mdc-ripple-surface--accent--selected::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-ripple-surface--accent--selected:hover::before,.mdc-ripple-surface--accent--selected.mdc-ripple-surface--hover::before{opacity:0.12;opacity:var(--mdc-ripple-hover-opacity, 0.12)}.mdc-ripple-surface--accent--selected.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--accent--selected:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-focus-opacity, 0.2)}.mdc-ripple-surface--accent--selected:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--accent--selected:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--accent--selected.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--disabled{opacity:0}.mdc-ripple-surface--internal-use-state-layer-custom-properties::before,.mdc-ripple-surface--internal-use-state-layer-custom-properties::after{background-color:#000;background-color:var(--mdc-ripple-hover-state-layer-color, #000)}.mdc-ripple-surface--internal-use-state-layer-custom-properties:hover::before,.mdc-ripple-surface--internal-use-state-layer-custom-properties.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-state-layer-opacity, 0.04)}.mdc-ripple-surface--internal-use-state-layer-custom-properties.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--internal-use-state-layer-custom-properties:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-state-layer-opacity, 0.12)}.mdc-ripple-surface--internal-use-state-layer-custom-properties:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--internal-use-state-layer-custom-properties:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-pressed-state-layer-opacity, 0.12)}.mdc-ripple-surface--internal-use-state-layer-custom-properties.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-pressed-state-layer-opacity, 0.12)}"])));
class ClimateRipple extends ScopedRegistryHost(RippleBase) {
static get defineId() {
return 'mwc-ripple';
}
static get elementDefinitions() {
return buildElementDefinitions([], ClimateRipple);
}
static get styles() {
return styles;
}
}
class ClimateListItem extends ScopedRegistryHost(ListItemBase) {
static get defineId() {
return 'mwc-list-item';
}
static get elementDefinitions() {
return buildElementDefinitions([ClimateRipple], ClimateListItem);
}
static get styles() {
return styles$1;
}
}
class ClimateList extends ScopedRegistryHost(ListBase) {
static get defineId() {
return 'mwc-list';
}
static get elementDefinitions() {
return buildElementDefinitions([ClimateListItem], ClimateList);
}
static get styles() {
return styles$2;
}
}
class ClimateMenu extends ScopedRegistryHost(MenuBase) {
static get defineId() {
return 'mwc-menu';
}
static get elementDefinitions() {
return buildElementDefinitions([ClimateMenuSurface, ClimateList], ClimateMenu);
}
static get styles() {
return styles$4;
}
}
class ClimateDropdownBase extends ScopedRegistryHost(LitElement$4) {
static get defineId() {
return 'mc-dropdown-base';
}
static get elementDefinitions() {
return buildElementDefinitions(['ha-icon', 'ha-icon-button', ClimateMenu, ClimateListItem], ClimateDropdownBase);
}
static get properties() {
return {
items: [],
label: String,
selected: String,
icon: String,
active: Boolean,
disabled: Boolean,
iconStyle: {
type: Object
}
};
}
constructor() {
super();
this.iconStyle = {};
}
get selectedId() {
return this.items.map(item => item.id).indexOf(this.selected);
}
onChange(e) {
var {
index
} = e.detail;
if (index !== this.selectedId && this.items[index]) {
this.dispatchEvent(new CustomEvent('change', {
detail: this.items[index]
}));
e.detail.index = -1;
}
}
handleClick() {
var menu = this.shadowRoot.querySelector('#menu');
menu.anchor = this.shadowRoot.querySelector('#button');
menu.show();
}
render() {
if (!ClimateDropdownBase.elementDefinitionsLoaded) {
return html$3(_templateObject35 || (_templateObject35 = _taggedTemplateLiteral([""])));
}
return html$3(_templateObject36 || (_templateObject36 = _taggedTemplateLiteral(["\n <div class='mc-dropdown'>\n <ha-icon-button class='mc-dropdown__button icon'\n style=", "\n id=", "\n @click=", "\n ?disabled=", "\n ?color=", ">\n <ha-icon .icon=", "></ha-icon>\n </ha-icon-button>\n <mwc-menu fixed activatable\n id=", "\n ?quick=", "\n .menuCorner=", "\n .corner=", "\n @selected=", ">\n ", "\n </mwc-menu>\n </div>\n "])), styleMap$2(this.iconStyle), 'button', this.handleClick, this.disabled, this.active, this.icon, 'menu', true, 'END', 'TOP_RIGHT', this.onChange, this.items.map(item => html$3(_templateObject37 || (_templateObject37 = _taggedTemplateLiteral(["\n <mwc-list-item value=", " ?selected=", " .activated=", ">\n <span class='mc-dropdown__item__label'>", "</span>\n </mwc-list-item>"])), item.id || item.name, this.selected === item.id, this.selected === item.id, item.name)));
}
static get styles() {
return [sharedStyle, css$3(_templateObject38 || (_templateObject38 = _taggedTemplateLiteral(["\n :host {\n position: relative;\n overflow: hidden;\n }\n .mc-dropdown\n :host([disabled]) {\n opacity: .25;\n pointer-events: none;\n }\n :host([faded]) {\n opacity: .75;\n }\n .mc-dropdown {\n padding: 0;\n }\n ha-icon-button[disabled] {\n opacity: .25;\n pointer-events: none;\n }\n .mc-dropdown__button.icon {\n margin: 0;\n }\n ha-icon-button {\n width: calc(var(--mc-dropdown-unit));\n height: calc(var(--mc-dropdown-unit));\n --mdc-icon-button-size: calc(var(--mc-dropdown-unit));\n }\n mwc-item > *:nth-child(2) {\n margin-left: 4px;\n }\n .mc-dropdown[focused] ha-icon-button {\n color: var(--mc-accent-color);\n }\n .mc-dropdown[focused] ha-icon-button[focused] {\n color: var(--mc-text-color);\n transform: rotate(0deg);\n }\n "])))];
}
}
class ClimateModeMenu extends ScopedRegistryHost(LitElement$4) {
static get defineId() {
return 'mc-mode-menu';
}
static get elementDefinitions() {
return buildElementDefinitions([ClimateDropdownBase], ClimateModeMenu);
}
constructor() {
super();
this.mode = {};
}
static get properties() {
return {
mode: {
type: Object
}
};
}
get calcIcon() {
if (this.selected) {
if (this.selected.icon) {
return this.selected.icon;
}
if (this.selected.id !== undefined && this.selected.id !== null) {
var id = this.selected.id.toString().toUpperCase();
if (id in ICON) {
return ICON[id];
}
}
}
return '';
}
get selected() {
return this.mode.source.find(i => i.id === this.mode.state) || {};
}
get sources() {
return this.mode.source.filter(s => !s.hide).map(s => ({
name: s.name,
id: s.id,
type: 'source'
}));
}
handleChange(e) {
e.stopPropagation();
var selected = e.detail.id;
this.mode.handleChange(selected);
}
render() {
if (!ClimateModeMenu.elementDefinitionsLoaded) {
return html$3(_templateObject39 || (_templateObject39 = _taggedTemplateLiteral([""])));
}
return html$3(_templateObject40 || (_templateObject40 = _taggedTemplateLiteral(["\n <mc-dropdown-base\n @change=", "\n .items=", "\n .icon=", "\n .iconStyle=", "\n .active=", "\n .selected=", ">\n </mc-dropdown-base>\n "])), this.handleChange, this.sources, this.calcIcon, this.mode.style, this.mode.isActive(this.mode.state), this.selected.id);
}
static get styles() {
return css$3(_templateObject41 || (_templateObject41 = _taggedTemplateLiteral(["\n :host {\n min-width: calc(var(--mc-unit) * .85);\n --mc-dropdown-unit: calc(var(--mc-unit) * .75);\n --paper-item-min-height: var(--mc-unit);\n }\n "])));
}
}
class ClimateIndicators extends ScopedRegistryHost(LitElement$4) {
static get defineId() {
return 'mc-indicators';
}
static get elementDefinitions() {
return buildElementDefinitions(['ha-icon'], ClimateIndicators);
}
static get properties() {
return {
indicators: {
type: Object
}
};
}
handlePopup(e, indicator) {
e.stopPropagation();
handleClick(this, indicator.hass, indicator.config.tap_action, indicator.entity.entity_id);
}
renderIcon(indicator) {
var {
icon
} = indicator;
if (!icon) {
return '';
}
return html$3(_templateObject42 || (_templateObject42 = _taggedTemplateLiteral(["<ha-icon style=", " class='state__value_icon' .icon=", "></ha-icon>"])), styleMap$2(indicator.iconStyle), icon);
}
renderUnit(indicator) {
if (!indicator.unit) {
return '';
}
return html$3(_templateObject43 || (_templateObject43 = _taggedTemplateLiteral(["<span class='state__uom' style=", ">", "</span>"])), styleMap$2(indicator.valueStyle), indicator.unit);
}
renderIndicator(indicator) {
if (!indicator) {
return '';
}
var action = indicator.config && indicator.config.tap_action && indicator.config.tap_action.action;
var cls = action && TAP_ACTIONS.includes(action) ? 'pointer' : '';
return html$3(_templateObject44 || (_templateObject44 = _taggedTemplateLiteral(["\n <div class='state ", "' @click=", ">\n ", "\n <span class='state__value' style=", ">", "</span>\n ", "\n </div>\n "])), cls, e => this.handlePopup(e, indicator), this.renderIcon(indicator), styleMap$2(indicator.valueStyle), indicator.value, this.renderUnit(indicator));
}
render() {
if (!ClimateIndicators.elementDefinitionsLoaded) {
return html$3(_templateObject45 || (_templateObject45 = _taggedTemplateLiteral([""])));
}
var indicatorsToShow = Object.entries(this.indicators).map(entry => entry[1]).filter(indicator => !indicator.hide);
var context = this;
return html$3(_templateObject46 || (_templateObject46 = _taggedTemplateLiteral(["\n <div class='mc-indicators__container'>\n ", "\n </div>\n "])), indicatorsToShow.map(i => context.renderIndicator(i)));
}
static get styles() {
return css$3(_templateObject47 || (_templateObject47 = _taggedTemplateLiteral(["\n :host {\n position: relative;\n box-sizing: border-box;\n font-size: calc(var(--mc-unit) * .35);\n line-height: calc(var(--mc-unit) * .35);\n }\n .mc-indicators__container {\n display: flex;\n flex-wrap: wrap;\n margin-right: calc(var(--mc-unit) * .075);\n }\n .state {\n position: relative;\n display: flex;\n flex-wrap: nowrap;\n margin-right: calc(var(--mc-unit) * .1);\n }\n .pointer {\n cursor: pointer\n }\n .state__value_icon {\n height: calc(var(--mc-unit) * .475);\n width: calc(var(--mc-unit) * .5);\n color: var(--mc-icon-color);\n --mdc-icon-size: calc(var(--mc-unit) * 0.5);\n }\n .state__value {\n margin: 0 1px;\n font-weight: var(--mc-info-font-weight);\n line-height: calc(var(--mc-unit) * .475);\n }\n .state__uom {\n font-size: calc(var(--mc-unit) * .275);\n line-height: calc(var(--mc-unit) * .525);\n margin-left: 1px;\n height: calc(var(--mc-unit) * .475);\n opacity: 0.8;\n }\n "])));
}
}
class ClimateDropDown extends ScopedRegistryHost(LitElement$4) {
static get defineId() {
return 'mc-dropdown';
}
static get elementDefinitions() {
return buildElementDefinitions([ClimateDropdownBase], ClimateDropDown);
}
constructor() {
super();
this.dropdown = {};
this.timer = undefined;
this._state = undefined;
}
static get properties() {
return {
dropdown: {
type: Object
}
};
}
handleChange(e) {
var _this17 = this;
e.stopPropagation();
var selected = e.detail.id;
var {
entity
} = this.dropdown;
this._state = selected;
this.dropdown.handleChange(selected);
if (this.timer) {
clearTimeout(this.timer);
}
this.timer = setTimeout(_asyncToGenerator(function* () {
if (_this17.dropdown.entity === entity) {
if (_this17.dropdown.state !== undefined && _this17.dropdown.state !== null) {
_this17._state = _this17.dropdown.state.toString();
} else {
_this17._state = '';
}
_this17.requestUpdate('_state');
}
}), this.dropdown.actionTimeout);
this.requestUpdate('_state');
}
render() {
if (!ClimateDropDown.elementDefinitionsLoaded) {
return html$3(_templateObject48 || (_templateObject48 = _taggedTemplateLiteral([""])));
}
return html$3(_templateObject49 || (_templateObject49 = _taggedTemplateLiteral(["\n <mc-dropdown-base\n .iconStyle=", "\n @change=", "\n .items=", "\n .icon=", "\n .disabled=\"", "\"\n .active=", "\n .selected=", ">\n </mc-dropdown-base>\n "])), this.dropdown.style, e => this.handleChange(e), this.dropdown.source, this.dropdown.icon, this.dropdown.disabled, this.dropdown.isActive(this._state), this._state);
}
updated(changedProps) {
if (changedProps.has('dropdown')) {
if (this.dropdown.state !== undefined && this.dropdown.state !== null) {
this._state = this.dropdown.state.toString();
} else {
this._state = '';
}
if (this.timer) {
clearTimeout(this.timer);
}
this.requestUpdate('_state');
}
}
static get styles() {
return [sharedStyle, css$3(_templateObject50 || (_templateObject50 = _taggedTemplateLiteral(["\n :host {\n position: relative;\n box-sizing: border-box;\n margin: 0;\n overflow: hidden;\n transition: background .5s;\n }\n :host([color]) {\n background: var(--mc-active-color);\n transition: background .25s;\n opacity: 1;\n }\n :host([disabled]) {\n opacity: .25;\n pointer-events: none;\n }\n "])))];
}
}
class ClimateButton extends ScopedRegistryHost(LitElement$4) {
static get defineId() {
return 'mc-button';
}
static get elementDefinitions() {
return buildElementDefinitions(['ha-icon', 'ha-icon-button'], ClimateButton);
}
constructor() {
super();
this._isOn = false;
this.timer = undefined;
}
static get properties() {
return {
button: {
type: Object
}
};
}
handleToggle(e) {
var _this18 = this;
e.stopPropagation();
var {
entity
} = this.button;
this._isOn = !this._isOn;
this.button.handleToggle();
if (this.timer) {
clearTimeout(this.timer);
}
this.timer = setTimeout(_asyncToGenerator(function* () {
if (_this18.button.entity === entity) {
_this18._isOn = _this18.button.isOn;
_this18.requestUpdate('_isOn');
}
}), this.button.actionTimeout);
this.requestUpdate('_isOn');
}
render() {
if (!ClimateButton.elementDefinitionsLoaded) {
return html$3(_templateObject51 || (_templateObject51 = _taggedTemplateLiteral([""])));
}
return html$3(_templateObject52 || (_templateObject52 = _taggedTemplateLiteral(["\n <ha-icon-button\n style=", "\n .icon=", "\n @click=", "\n ?disabled=\"", "\"\n ?color=", ">\n <ha-icon .icon=", "></ha-icon>\n </ha-icon-button>\n "])), styleMap$2(this.button.style), this.button.icon, e => this.handleToggle(e), this.button.disabled || this.button.isUnavailable, this._isOn, this.button.icon);
}
updated(changedProps) {
if (changedProps.has('button')) {
this._isOn = this.button.isOn;
if (this.timer) {
clearTimeout(this.timer);
}
this.requestUpdate('_isOn');
}
}
static get styles() {
return [sharedStyle, css$3(_templateObject53 || (_templateObject53 = _taggedTemplateLiteral(["\n :host {\n position: relative;\n box-sizing: border-box;\n margin: 0;\n overflow: hidden;\n transition: background .5s;\n }\n :host([color]) {\n background: var(--mc-active-color);\n transition: background .25s;\n opacity: 1;\n }\n :host([disabled]) {\n opacity: .25;\n pointer-events: none;\n }\n "])))];
}
}
class ClimateButtons extends ScopedRegistryHost(LitElement$4) {
static get defineId() {
return 'mc-buttons';
}
static get elementDefinitions() {
return buildElementDefinitions([ClimateDropDown, ClimateButton], ClimateButtons);
}
static get properties() {
return {
buttons: {}
};
}
renderButton(button) {
if (button.isUnavailable) {
return '';
}
return html$3(_templateObject54 || (_templateObject54 = _taggedTemplateLiteral(["\n <mc-button\n class=\"custom-button\"\n .button=", ">\n </mc-button>\n "])), button);
}
renderDropdown(dropdown) {
return html$3(_templateObject55 || (_templateObject55 = _taggedTemplateLiteral(["\n <mc-dropdown\n .dropdown=", ">\n </mc-dropdown>\n "])), dropdown);
}
renderInternal(button) {
if (button.type === 'dropdown') {
return this.renderDropdown(button);
}
return this.renderButton(button);
}
render() {
if (!ClimateButtons.elementDefinitionsLoaded) {
return html$3(_templateObject56 || (_templateObject56 = _taggedTemplateLiteral([""])));
}
var context = this;
return html$3(_templateObject57 || (_templateObject57 = _taggedTemplateLiteral(["", ""])), Object.entries(this.buttons).map(b => b[1]).filter(b => b.location !== 'main' && !b.hide).sort((a, b) => a.order > b.order ? 1 : b.order > a.order ? -1 : 0).map(button => context.renderInternal(button)));
}
static get styles() {
return [sharedStyle, css$3(_templateObject58 || (_templateObject58 = _taggedTemplateLiteral(["\n :host {\n position: relative;\n box-sizing: border-box;\n margin: 0;\n overflow: hidden;\n transition: background .5s;\n --paper-item-min-height: var(--mc-unit);\n --mc-dropdown-unit: var(--mc-unit);\n --mdc-icon-button-size: calc(var(--mc-unit));\n }\n :host([color]) {\n background: var(--mc-active-color);\n transition: background .25s;\n opacity: 1;\n }\n :host([disabled]) {\n opacity: .25;\n pointer-events: none;\n }\n mc-button {\n width: calc(var(--mc-unit));\n height: calc(var(--mc-unit));\n }\n "])))];
}
}
class ClimateFanModeSecondary extends ScopedRegistryHost(LitElement$4) {
static get defineId() {
return 'mc-fan-mode-secondary';
}
static get elementDefinitions() {
return buildElementDefinitions(['ha-icon', ClimateMenu, ClimateListItem], ClimateFanModeSecondary);
}
constructor() {
super();
this.fanMode = {};
this.config = {};
this.timer = undefined;
this._selected = {};
this.source = {};
}
static get properties() {
return {
fanMode: {
type: Object
},
config: {
type: Object
}
};
}
get selectedIndex() {
return this.fanMode.source.map(item => item.id).indexOf(this._selected.id);
}
handleChange(e) {
var _this19 = this;
var {
index
} = e.detail;
if (index === this.selectedIndex || !this.fanMode.source[index]) {
return;
}
clearTimeout(this.timer);
var selected = this.fanMode.source[index];
var {
entity
} = this.fanMode;
var oldSelected = this._selected;
this._selected = selected;
this.timer = setTimeout(_asyncToGenerator(function* () {
if (_this19.fanMode.entity === entity) {
_this19._selected = oldSelected;
_this19.requestUpdate('_selected');
}
}), this.fanMode.actionTimeout);
this.fanMode.handleChange(selected.id);
this.requestUpdate('_selected');
}
renderFanMode() {
var label = this._selected ? this._selected.name : this.fanMode.state;
var icon = this.config.secondary_info.icon ? this.config.secondary_info.icon : this.fanMode.icon;
return html$3(_templateObject59 || (_templateObject59 = _taggedTemplateLiteral(["\n <ha-icon class='icon' .icon=", "></ha-icon>\n <span class='name'>", "</span>\n "])), icon, label);
}
handleClick() {
var menu = this.shadowRoot.querySelector('#menu');
menu.anchor = this.shadowRoot.querySelector('#button');
menu.show();
}
renderFanModeDropdown() {
return html$3(_templateObject60 || (_templateObject60 = _taggedTemplateLiteral(["\n <div class='mc-dropdown'>\n <ha-icon-button class='mc-dropdown__button icon'\n id=", "\n @click=", "\n ?disabled=", "\n >\n ", "\n </ha-icon-button>\n <mwc-menu fixed activatable\n id=", "\n ?quick=", "\n .menuCorner=", "\n .corner=", "\n @selected=", ">\n ", "\n </mwc-menu>\n </div>\n "])), 'button', this.handleClick, this.fanMode.disabled, this.renderFanMode(), 'menu', true, 'END', 'TOP_RIGHT', this.handleChange, this.fanMode.source.map(item => html$3(_templateObject61 || (_templateObject61 = _taggedTemplateLiteral(["\n <mwc-list-item value=", " ?selected=", " .activated=", ">\n <span class='mc-dropdown__item__label'>", "</span>\n </mwc-list-item>"])), item.id || item.name, this._selected.id && this._selected.id === item.id, this._selected.id && this._selected.id === item.id, item.name)));
}
render() {
if (!ClimateFanModeSecondary.elementDefinitionsLoaded) {
return html$3(_templateObject62 || (_templateObject62 = _taggedTemplateLiteral([""])));
}
var {
type
} = this.config.secondary_info;
if (type === 'fan-mode-dropdown') {
return this.renderFanModeDropdown();
}
return this.renderFanMode();
}
updated(changedProps) {
if (changedProps.has('fanMode')) {
clearTimeout(this.timer);
this._selected = this.fanMode.selected;
this.requestUpdate('_selected');
}
}
static get styles() {
return [sharedStyle, css$3(_templateObject63 || (_templateObject63 = _taggedTemplateLiteral(["\n .mc-dropdown {\n padding: 0;\n }\n .name {\n font-size: calc(var(--mc-unit) * .35);\n font-weight: var(--mc-info-font-weight);\n line-height: calc(var(--mc-unit) * .5);\n vertical-align: middle;\n display: inline-block;\n }\n .icon {\n color: var(--mc-icon-color);\n height: calc(var(--mc-unit) * .475);\n width: calc(var(--mc-unit) * .5);\n min-width: calc(var(--mc-unit) * .5);\n --mdc-icon-size: calc(var(--mc-unit) * 0.5);\n }\n "])))];
}
}
class ClimateSecondaryInfo extends ScopedRegistryHost(LitElement$4) {
static get defineId() {
return 'mc-secondary-info';
}
static get elementDefinitions() {
return buildElementDefinitions(['ha-icon', 'ha-relative-time', ClimateFanModeSecondary], ClimateSecondaryInfo);
}
constructor() {
super();
this.fanMode = {};
this.hvacMode = {};
this.config = {};
this.climate = {};
}
static get properties() {
return {
fanMode: {
type: Object
},
config: {
type: Object
},
hvacMode: {
type: Object
},
climate: {
type: Object
}
};
}
renderHvacAction() {
var action = this.climate.hvacAction;
if (!action) {
return '';
}
var icon = action.icon ? action.icon : this.config.secondary_info.icon;
var cls = icon ? '' : 'gray';
return html$3(_templateObject64 || (_templateObject64 = _taggedTemplateLiteral(["\n ", "\n <span class='name ", "'>", "</span>\n "])), icon ? html$3(_templateObject65 || (_templateObject65 = _taggedTemplateLiteral(["<ha-icon class='icon' .icon=", "></ha-icon>"])), icon) : '', cls, action.name);
}
renderHvacMode() {
var {
hvacMode
} = this;
var mode = hvacMode.selected || {};
var icon = mode.icon ? mode.icon : this.config.secondary_info.icon;
return html$3(_templateObject66 || (_templateObject66 = _taggedTemplateLiteral(["\n ", "\n <span class='name'>", "</span>\n "])), icon ? html$3(_templateObject67 || (_templateObject67 = _taggedTemplateLiteral(["<ha-icon class='icon' .icon=", "></ha-icon>"])), icon) : '', mode.name);
}
render() {
if (!ClimateSecondaryInfo.elementDefinitionsLoaded) {
return html$3(_templateObject68 || (_templateObject68 = _taggedTemplateLiteral([""])));
}
var {
type
} = this.config.secondary_info;
switch (type) {
case 'hvac-mode':
return this.renderHvacMode();
case 'hvac-action':
return this.renderHvacAction();
case 'last-changed':
return html$3(_templateObject69 || (_templateObject69 = _taggedTemplateLiteral(["<ha-relative-time .hass=", " .datetime=", "></ha-relative-time>"])), this.climate.hass, this.climate.lastChanged);
case 'last-updated':
return html$3(_templateObject70 || (_templateObject70 = _taggedTemplateLiteral(["<ha-relative-time .hass=", " .datetime=", "></ha-relative-time>"])), this.climate.hass, this.climate.lastUpdated);
default:
return html$3(_templateObject71 || (_templateObject71 = _taggedTemplateLiteral(["<mc-fan-mode-secondary .fanMode=", " .config=", "></mc-fan-mode-secondary>"])), this.fanMode, this.config);
}
}
static get styles() {
return [sharedStyle, css$3(_templateObject72 || (_templateObject72 = _taggedTemplateLiteral(["\n ha-relative-time, .gray {\n color: #727272;\n }\n .name {\n font-size: calc(var(--mc-unit) * .35);\n font-weight: var(--mc-info-font-weight);\n line-height: calc(var(--mc-unit) * .5);\n vertical-align: middle;\n display: inline-block;\n }\n .icon {\n color: var(--mc-icon-color);\n height: calc(var(--mc-unit) * .475);\n width: calc(var(--mc-unit) * .5);\n min-width: calc(var(--mc-unit) * .5);\n --mdc-icon-size: calc(var(--mc-unit) * 0.5);\n }\n "])))];
}
}
class MiniClimate extends ScopedRegistryHost(LitElement$4) {
static get elementDefinitions() {
return buildElementDefinitions(['ha-card', 'ha-icon', 'ha-icon-button', ClimateButton, ClimateButtons, ClimateDropDown, ClimateIndicators, ClimateModeMenu, ClimateSecondaryInfo, ClimateTargetTemperature, ClimateTemperature], MiniClimate);
}
static getStubConfig(hass, unusedEntities, allEntities) {
var entity = unusedEntities.find(eid => eid.split('.')[0] === 'climate');
if (!entity) {
entity = allEntities.find(eid => eid.split('.')[0] === 'climate');
}
return {
entity
};
}
constructor() {
super();
this.initial = true;
this.toggle = false;
this.temperature = {};
this.targetTemperature = {};
this.swapTemperatures = false;
this.buttons = {};
this.indicators = {};
this.hvacMode = {};
this.targetTemperatureChanging = false;
this.climate = {};
this.targetTemperatureValue = 0;
this.width = 0;
}
static get properties() {
return {
_hass: {
type: Object
},
config: {
type: Object
},
entity: {
type: Object
},
climate: {
type: Object
},
initial: {
type: Boolean
},
toggle: {
type: Boolean
}
};
}
static get styles() {
return [sharedStyle, style];
}
set hass(hass) {
if (!hass) {
return;
}
var entity = hass.states[this.config.entity];
this._hass = hass;
var force = false;
if (entity && this.entity !== entity) {
this.entity = entity;
this.climate = new ClimateObject(hass, this.config, entity);
force = true;
}
this.updateIndicators(force);
this.updateButtons(force);
this.updateTemperature(force);
this.updateTargetTemperature(force);
this.updateHvacMode(force);
this.climate.mode = this.hvacMode.selected;
}
get hass() {
return this._hass;
}
get name() {
return this.config.name || this.climate.name;
}
updateIndicators(force) {
var indicators = {};
var changed = false;
for (var i = 0; i < this.config.indicators.length; i += 1) {
var config = this.config.indicators[i];
var {
id
} = config;
var entityId = config.source.entity || this.climate.id;
var entity = this.hass.states[entityId];
if (entity) {
indicators[id] = new IndicatorObject(entity, config, this.climate, this.hass);
}
if (entity !== (this.indicators[id] && this.indicators[id].entity)) {
changed = true;
}
}
if (changed || force) {
this.indicators = indicators;
}
}
updateTemperature(force) {
if (this.targetTemperatureChanging) {
return;
}
var temperatureEntityId = this.config.temperature.source.entity || this.config.entity;
var temperatureEntity = this.hass.states[temperatureEntityId];
var targetTemperatureEntityId = this.config.target_temperature.source && this.config.target_temperature.source.entity || this.config.entity;
var targetTemperatureEntity = this.hass.states[targetTemperatureEntityId];
var temperature = new TemperatureObject(temperatureEntity, targetTemperatureEntity, this.config, this.climate);
if (this.temperature.rawValue !== temperature.rawValue || this.temperature.target !== temperature.target || force) {
this.temperature = temperature;
}
}
updateTargetTemperature(force) {
if (this.targetTemperatureChanging) {
return;
}
var entityId = this.config.target_temperature.source && this.config.target_temperature.source.entity || this.config.entity;
var entity = this.hass.states[entityId];
if (this.targetTemperature.entity !== entity || force) {
this.targetTemperature = new TargetTemperatureObject(entity, this.config, this.hass);
this.targetTemperatureValue = this.targetTemperature.value;
}
}
updateHvacMode(force) {
var config = this.config.hvac_mode;
var entityId = config.state && config.state.entity || this.climate.id;
var entity = this.hass.states[entityId];
if (entity && entity !== (this.hvacMode && this.hvacMode.entity) || force) {
this.hvacMode = new HvacModeObject(entity, config, this.climate);
}
}
updateButtons(force) {
var buttons = {};
var changed = false;
for (var i = 0; i < this.config.buttons.length; i += 1) {
var config = this.config.buttons[i];
var {
id
} = config;
var entityId = config.state && config.state.entity || this.climate.id;
var entity = this.hass.states[entityId];
if (entity) {
buttons[id] = new ButtonObject(entity, config, this.climate, this.hass);
}
if (entity !== (this.buttons[id] && this.buttons[id].entity)) {
changed = true;
}
}
if (changed || force) {
this.buttons = buttons;
}
}
getButtonsConfig(config) {
var data = Object.entries(config.buttons || {});
var buttons = [];
for (var i = 0; i < data.length; i += 1) {
var [key, value] = data[i];
var button = this.getButtonConfig(value, config);
button.id = key;
if (!('order' in button)) {
button.order = i + 1;
}
buttons.push(button);
}
return buttons;
}
getButtonConfig(value, config) {
var item = _objectSpread({
icon: 'mdi:radiobox-marked',
type: 'button',
toggle_action: undefined
}, value);
item.functions = {};
var context = _objectSpread({}, value);
context.call_service = (domain, service, options) => this.hass.callService(domain, service, options);
context.entity_config = config;
context.toggle_state = toggleState;
if (item.disabled) {
item.functions.disabled = compileTemplate(item.disabled, context);
}
if (item.state && item.state.mapper) {
item.functions.state = {
mapper: compileTemplate(item.state.mapper, context)
};
}
if (item.active) {
item.functions.active = compileTemplate(item.active, context);
}
if (item.source && item.source.__filter) {
item.functions.source = {
filter: compileTemplate(item.source.__filter, context)
};
}
if (item.toggle_action) {
item.functions.toggle_action = compileTemplate(item.toggle_action, context);
}
if (item.change_action) {
item.functions.change_action = compileTemplate(item.change_action, context);
}
if (item.style) {
item.functions.style = compileTemplate(item.style, context);
}
if (item.hide) {
if (typeof item.hide === 'boolean') {
item.functions.hide = () => true;
} else {
item.functions.hide = compileTemplate(item.hide, context);
}
}
return item;
}
getFanModeConfig(config) {
var fanModeConfig = _objectSpread({
id: 'fan_mode',
icon: 'mdi:fan',
type: 'dropdown',
order: 0,
state: {
attribute: 'fan_mode'
},
change_action: (selected, state, entity) => {
var options = {
fan_mode: selected,
entity_id: entity.entity_id
};
return this.call_service('climate', 'set_fan_mode', options);
}
}, config.fan_mode || {});
fanModeConfig = this.getButtonConfig(fanModeConfig, config);
var {
functions
} = fanModeConfig;
if (!functions.active) {
functions.active = () => this.climate.isOn;
}
return fanModeConfig;
}
getIndicatorConfig(key, value, config) {
var item = _objectSpread({
id: key,
source: {
enitity: undefined,
attribute: undefined,
mapper: undefined
},
icon: ''
}, value);
if (typeof value.tap_action === 'string') {
item.tap_action = {
action: value.tap_action
};
} else {
item.tap_action = _objectSpread({
action: 'none'
}, item.tap_action || {});
}
item.functions = item.functions || {};
var context = _objectSpread({}, value);
context.entity_config = config;
context.toggle_state = toggleState;
if (item.source.mapper) {
item.functions.mapper = compileTemplate(item.source.mapper, context);
}
if (typeof item.icon === 'object') {
item.functions.icon = {};
if (item.icon.template) {
item.functions.icon.template = compileTemplate(item.icon.template, context);
}
if (item.icon.style) {
item.functions.icon.style = compileTemplate(item.icon.style, context);
}
}
if (typeof item.value === 'object') {
item.functions.value = {};
if (item.value.style) {
item.functions.value.style = compileTemplate(item.value.style, context);
}
}
if (item.hide) {
if (typeof item.hide === 'boolean') {
item.functions.hide = () => true;
} else {
item.functions.hide = compileTemplate(item.hide, context);
}
}
return item;
}
getSecondaryInfoConfig(config) {
var item = _objectSpread({}, config);
item.functions = item.functions || {};
var context = _objectSpread({}, config);
if (item.hide) {
if (typeof item.hide === 'boolean') {
item.functions.hide = () => true;
} else {
item.functions.hide = compileTemplate(item.hide, context);
}
}
return item;
}
getToggleConfig(config) {
var item = _objectSpread({}, config);
item.functions = item.functions || {};
var context = _objectSpread({}, config);
if (item.hide) {
if (typeof item.hide === 'boolean') {
item.functions.hide = () => true;
} else {
item.functions.hide = compileTemplate(item.hide, context);
}
}
return item;
}
getIndicatorsConfig(config) {
return Object.entries(config.indicators || {}).map(i => this.getIndicatorConfig(i[0], i[1] || {}, config));
}
getTargetTemperatureConfig(config) {
var item = _objectSpread({
unit: '°C',
source: {
entity: undefined,
attribute: 'temperature'
}
}, config.target_temperature || {});
item.icons = _objectSpread({
up: ICON.UP,
down: ICON.DOWN
}, item.icons || {});
item.functions = {};
var context = _objectSpread({}, config.target_temperature || {});
context.call_service = (domain, service, options) => this.hass.callService(domain, service, options);
context.entity_config = config;
context.toggle_state = toggleState;
if (item.change_action) {
item.functions.change_action = compileTemplate(item.change_action, context);
}
return item;
}
getHvacModeConfig(config) {
var mode = _objectSpread({
type: 'dropdown',
change_action: (selected, entity) => {
var options = {
hvac_mode: selected,
entity_id: entity.entity_id
};
return this.call_service('climate', 'set_hvac_mode', options);
}
}, config.hvac_mode || {});
mode = this.getButtonConfig(mode, this.config);
var {
functions
} = mode;
if (!functions.active) {
functions.active = () => this.climate.isOn;
}
return mode;
}
setConfig(config) {
var supportedDomains = ['climate', 'fan'];
if (!config.entity || supportedDomains.includes(config.entity.split('.')[0]) === false) {
throw new Error("Specify an entity from within domains: [".concat(supportedDomains.join(', '), "]."));
}
this.config = _objectSpread({
tap_action: {
action: 'more-info',
navigation_path: '',
url: '',
entity: '',
service: '',
service_data: {}
}
}, config);
this.config.indicators = this.getIndicatorsConfig(config);
this.config.buttons = this.getButtonsConfig(config);
this.fanModeConfig = this.getFanModeConfig(config);
this.config.buttons.push(this.fanModeConfig);
this.config.target_temperature = this.getTargetTemperatureConfig(config);
this.config.temperature = _objectSpread({
round: 1,
unit: '°C',
source: {
entity: undefined,
attribute: 'current_temperature'
}
}, config.temperature || {});
this.config.hvac_mode = this.getHvacModeConfig(this.config);
this.config.toggle = this.getToggleConfig(_objectSpread({
icon: ICON.TOGGLE,
hide: false,
default: false
}, config.toggle || {}));
if (typeof config.secondary_info === 'string') {
this.config.secondary_info = {
type: config.secondary_info
};
} else {
this.config.secondary_info = _objectSpread({
type: 'fan_mode'
}, config.secondary_info || {});
}
this.config.secondary_info = this.getSecondaryInfoConfig(this.config.secondary_info);
this.toggle = this.config.toggle.default;
this.swapTemperatures = !!this.config.swap_temperatures;
}
renderCtlWrap() {
if (this.climate.isUnavailable) {
return html$3(_templateObject73 || (_templateObject73 = _taggedTemplateLiteral(["\n <span class=\"label ellipsis\"> \n ", "\n </span>\n "])), getLabel(this.hass, ['state.default.unavailable'], 'Unavailable'));
}
var buttons = Object.entries(this.buttons).map(b => b[1]).filter(b => b.location === 'main' && !b.hide).sort((a, b) => a.order > b.order ? 1 : b.order > a.order ? -1 : 0);
return html$3(_templateObject74 || (_templateObject74 = _taggedTemplateLiteral(["\n ", "\n ", "\n <mc-temperature\n .temperature=", "\n .target=", "\n .changing=", "\n .swapTemperatures=", ">\n </mc-temperature>\n "])), buttons.map(button => button.type === 'dropdown' ? html$3(_templateObject75 || (_templateObject75 = _taggedTemplateLiteral(["<mc-dropdown .dropdown=", "></mc-dropdown>"])), button) : html$3(_templateObject76 || (_templateObject76 = _taggedTemplateLiteral(["<mc-button .button=", "></mc-button>"])), button)), this.hvacMode.hide ? '' : html$3(_templateObject77 || (_templateObject77 = _taggedTemplateLiteral(["<mc-mode-menu .mode=", "></mc-mode-menu>"])), this.hvacMode), this.temperature, this.targetTemperatureValue, this.targetTemperatureChanging, this.swapTemperatures);
}
renderEntityControls() {
if (this.climate.isUnavailable) {
return '';
}
return html$3(_templateObject78 || (_templateObject78 = _taggedTemplateLiteral(["\n <div class=\"entity__controls\">\n <mc-target-temperature\n .targetTemperature=", "\n @changing=\"", "\">\n </mc-target-temperature>\n </div>\n "])), this.targetTemperature, e => this.handleChangingTargetTemperature(e));
}
render() {
if (!MiniClimate.elementDefinitionsLoaded) {
return html$3(_templateObject79 || (_templateObject79 = _taggedTemplateLiteral([""])));
}
var handle = this.config.secondary_info.type !== 'fan-mode-dropdown';
return html$3(_templateObject80 || (_templateObject80 = _taggedTemplateLiteral(["\n <ha-card\n class=", "\n style=", ">\n <div class='mc__bg'></div>\n <div class='mc-climate'>\n <div class='mc-climate__core flex'>\n ", "\n <div class='entity__info'>\n <div class=\"wrap\">\n <div class=\"entity__info__name_wrap\" @click=", ">\n ", "\n </div>\n <div class=\"ctl-wrap ellipsis\">\n ", "\n </div>\n </div>\n ", "\n </div>\n ", "\n </div>\n ", "\n </div>\n </ha-card>\n "])), this.computeClasses(), this.computeStyles(), this.renderIcon(), e => this.handlePopup(e, handle), this.renderEntityName(), this.renderCtlWrap(), this.renderBottomPanel(), this.renderEntityControls(), this.renderTogglePanel());
}
handleChangingTargetTemperature(e) {
this.targetTemperatureValue = this.targetTemperature.value;
this.targetTemperatureChanging = e.detail.changing;
this.requestUpdate('targetTemperatureChanging');
}
handlePopup(e, handle) {
if (!handle) {
return;
}
e.stopPropagation();
handleClick(this, this.hass, this.config.tap_action, this.climate.id);
}
handleToggle(e) {
e.stopPropagation();
this.toggle = !this.toggle;
}
toggleButtonCls() {
if (this.toggle) {
return 'open';
} else {
return '';
}
}
renderIcon() {
var state = this.climate.isActive;
return html$3(_templateObject81 || (_templateObject81 = _taggedTemplateLiteral(["\n <div class='entity__icon' ?color=", ">\n <ha-icon .icon=", " ></ha-icon>\n </div>"])), state, this.computeIcon());
}
renderTogglePanel() {
if (!this.toggle) {
return '';
}
return html$3(_templateObject82 || (_templateObject82 = _taggedTemplateLiteral(["\n <div class=\"mc-toggle_content\">\n <mc-buttons\n .buttons=", ">\n </mc-buttons>\n </div>\n "])), this.buttons);
}
renderBottomPanel() {
if (this.climate.isUnavailable) {
return '';
}
return html$3(_templateObject83 || (_templateObject83 = _taggedTemplateLiteral(["\n <div class='bottom flex'>\n <mc-indicators\n .indicators=", ">\n </mc-indicators>\n ", "\n </div>\n "])), this.indicators, this.renderToggleButton());
}
renderToggleButton() {
if (Object.entries(this.buttons).map(entry => entry[1]).filter(button => !button.hide && button.location !== 'main').length === 0) {
return html$3(_templateObject84 || (_templateObject84 = _taggedTemplateLiteral([""])));
}
if (this.config.toggle.functions.hide && this.config.toggle.functions.hide(this.climate.entity, this.climate.mode)) {
return html$3(_templateObject85 || (_templateObject85 = _taggedTemplateLiteral([""])));
}
return html$3(_templateObject86 || (_templateObject86 = _taggedTemplateLiteral(["\n <ha-icon-button class='toggle-button ", "'\n .icon=", "\n @click=", ">\n <ha-icon .icon=", "></ha-icon>\n </ha-icon-button>\n "])), this.toggleButtonCls(), this.config.toggle.icon, e => this.handleToggle(e), this.config.toggle.icon);
}
renderEntityName() {
return html$3(_templateObject87 || (_templateObject87 = _taggedTemplateLiteral(["\n <div class='entity__info__name' @click=", ">\n ", "\n </div>\n ", "\n "])), e => this.handlePopup(e, true), this.name, this.renderSecondaryInfo());
}
renderSecondaryInfo() {
if (this.climate.isUnavailable) {
return html$3(_templateObject88 || (_templateObject88 = _taggedTemplateLiteral([""])));
}
if (this.config.secondary_info.functions.hide && this.config.secondary_info.functions.hide(this.climate.entity, this.climate.mode)) {
return html$3(_templateObject89 || (_templateObject89 = _taggedTemplateLiteral([""])));
}
return html$3(_templateObject90 || (_templateObject90 = _taggedTemplateLiteral(["\n <div class='entity__secondary_info ellipsis'>\n <mc-secondary-info\n .climate=", "\n .config=", "\n .hvacMode=", "\n .fanMode=", ">\n </mc-secondary-info>\n </div>"])), this.climate, this.config, this.hvacMode, this.buttons.fan_mode);
}
computeIcon() {
if (this.config.icon) {
return this.config.icon;
} else {
return this.climate.icon || ICON.DEFAULT;
}
}
computeClasses() {
var {
config
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this;
return classMap$3({
'--initial': this.initial,
'--collapse': config.collapse,
'--group': config.group,
'--more-info': config.tap_action !== 'none',
'--inactive': !this.climate.isActive,
'--unavailable': this.climate.isUnavailable
});
}
computeStyles() {
var {
scale
} = this.config;
return styleMap$2(_objectSpread(_objectSpread({}, scale && {
'--mc-unit': "".concat(40 * scale, "px")
}), {
'--mc-card-width': "".concat(this.width, "px")
}));
}
initDefaultFanModeSource() {
var fanMode = this.fanModeConfig;
var entries = Object.entries(fanMode.source || {}).filter(s => s[0] !== '__filter');
var {
entity
} = this.climate;
if (entity && entries.length === 0 && entity.attributes && entity.attributes.fan_modes) {
fanMode.source = _objectSpread(_objectSpread({}, this.climate.defaultFanModes), fanMode.source || {});
}
}
initDefaultHvacModeSource() {
var hvacMode = this.config.hvac_mode;
var entries = Object.entries(hvacMode.source || {}).filter(s => s[0] !== '__filter');
var {
entity
} = this.climate;
if (entity && entries.length === 0) {
hvacMode.source = _objectSpread(_objectSpread({}, this.climate.defaultHvacModes), hvacMode.source || {});
}
}
firstUpdated(changedProps) {
super.firstUpdated(changedProps);
if (changedProps.has('climate')) {
this.initDefaultFanModeSource();
this.initDefaultHvacModeSource();
this.requestUpdate('climate');
}
if (changedProps.has('targetTemperature')) {
this.targetTemperatureValue = this.targetTemperature.value;
this.requestUpdate('targetTemperatureValue');
}
var ro = new index(entries => {
var item = entries.find(e => e.target === this);
if (item && item.contentRect && this.width !== item.contentRect.width) {
this.width = item.contentRect.width;
this.requestUpdate('width');
}
});
ro.observe(this);
}
}
customElements.define('mini-climate', MiniClimate);
window.customCards = window.customCards || [];
window.customCards.push({
type: 'mini-climate',
name: 'Mini Climate',
preview: true,
description: 'A custom climate card',
documentationURL: 'https://github.com/artem-sedykh/mini-climate-card'
});
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment