/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/ const t =
"undefined" != typeof window &&
null != window.customElements &&
void 0 !== window.customElements.polyfillWrapFlushCallback,
e = (t, e, s = null) => {
for (; e !== s; ) {
const s = e.nextSibling;
t.removeChild(e), (e = s);
}
},
s = `{{lit-${String(Math.random()).slice(2)}}}`,
i = `\x3c!--${s}--\x3e`,
n = new RegExp(`${s}|${i}`);
class r {
constructor(t, e) {
(this.parts = []), (this.element = e);
const i = [],
r = [],
a = document.createTreeWalker(e.content, 133, null, !1);
let d = 0,
c = -1,
u = 0;
const {
strings: p,
values: { length: _ },
} = t;
for (; u < _; ) {
const t = a.nextNode();
if (null !== t) {
if ((c++, 1 === t.nodeType)) {
if (t.hasAttributes()) {
const e = t.attributes,
{ length: s } = e;
let i = 0;
for (let t = 0; t < s; t++) o(e[t].name, "$lit$") && i++;
for (; i-- > 0; ) {
const e = p[u],
s = l.exec(e)[2],
i = s.toLowerCase() + "$lit$",
r = t.getAttribute(i);
t.removeAttribute(i);
const o = r.split(n);
this.parts.push({
type: "attribute",
index: c,
name: s,
strings: o,
}),
(u += o.length - 1);
}
}
"TEMPLATE" === t.tagName && (r.push(t), (a.currentNode = t.content));
} else if (3 === t.nodeType) {
const e = t.data;
if (e.indexOf(s) >= 0) {
const s = t.parentNode,
r = e.split(n),
a = r.length - 1;
for (let e = 0; e < a; e++) {
let i,
n = r[e];
if ("" === n) i = h();
else {
const t = l.exec(n);
null !== t &&
o(t[2], "$lit$") &&
(n =
n.slice(0, t.index) +
t[1] +
t[2].slice(0, -"$lit$".length) +
t[3]),
(i = document.createTextNode(n));
}
s.insertBefore(i, t),
this.parts.push({ type: "node", index: ++c });
}
"" === r[a] ? (s.insertBefore(h(), t), i.push(t)) : (t.data = r[a]),
(u += a);
}
} else if (8 === t.nodeType)
if (t.data === s) {
const e = t.parentNode;
(null !== t.previousSibling && c !== d) ||
(c++, e.insertBefore(h(), t)),
(d = c),
this.parts.push({ type: "node", index: c }),
null === t.nextSibling ? (t.data = "") : (i.push(t), c--),
u++;
} else {
let e = -1;
for (; -1 !== (e = t.data.indexOf(s, e + 1)); )
this.parts.push({ type: "node", index: -1 }), u++;
}
} else a.currentNode = r.pop();
}
for (const t of i) t.parentNode.removeChild(t);
}
}
const o = (t, e) => {
const s = t.length - e.length;
return s >= 0 && t.slice(s) === e;
},
a = (t) => -1 !== t.index,
h = () => document.createComment(""),
l =
/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;
function d(t, e) {
const {
element: { content: s },
parts: i,
} = t,
n = document.createTreeWalker(s, 133, null, !1);
let r = u(i),
o = i[r],
a = -1,
h = 0;
const l = [];
let d = null;
for (; n.nextNode(); ) {
a++;
const t = n.currentNode;
for (
t.previousSibling === d && (d = null),
e.has(t) && (l.push(t), null === d && (d = t)),
null !== d && h++;
void 0 !== o && o.index === a;
)
(o.index = null !== d ? -1 : o.index - h), (r = u(i, r)), (o = i[r]);
}
l.forEach((t) => t.parentNode.removeChild(t));
}
const c = (t) => {
let e = 11 === t.nodeType ? 0 : 1;
const s = document.createTreeWalker(t, 133, null, !1);
for (; s.nextNode(); ) e++;
return e;
},
u = (t, e = -1) => {
for (let s = e + 1; s < t.length; s++) {
const e = t[s];
if (a(e)) return s;
}
return -1;
};
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
const p = new WeakMap(),
_ = (t) => "function" == typeof t && p.has(t),
g = {},
mg = {};
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
class y {
constructor(t, e, s) {
(this.__parts = []),
(this.template = t),
(this.processor = e),
(this.options = s);
}
update(t) {
let e = 0;
for (const s of this.__parts) void 0 !== s && s.setValue(t[e]), e++;
for (const t of this.__parts) void 0 !== t && t.commit();
}
_clone() {
const e = t
? this.template.element.content.cloneNode(!0)
: document.importNode(this.template.element.content, !0),
s = [],
i = this.template.parts,
n = document.createTreeWalker(e, 133, null, !1);
let r,
o = 0,
h = 0,
l = n.nextNode();
for (; o < i.length; )
if (((r = i[o]), a(r))) {
for (; h < r.index; )
h++,
"TEMPLATE" === l.nodeName &&
(s.push(l), (n.currentNode = l.content)),
null === (l = n.nextNode()) &&
((n.currentNode = s.pop()), (l = n.nextNode()));
if ("node" === r.type) {
const t = this.processor.handleTextExpression(this.options);
t.insertAfterNode(l.previousSibling), this.__parts.push(t);
} else
this.__parts.push(
...this.processor.handleAttributeExpressions(
l,
r.name,
r.strings,
this.options
)
);
o++;
} else this.__parts.push(void 0), o++;
return t && (document.adoptNode(e), customElements.upgrade(e)), e;
}
}
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/ const f = ` ${s} `;
class v {
constructor(t, e, s, i) {
(this.strings = t),
(this.values = e),
(this.type = s),
(this.processor = i);
}
getHTML() {
const t = this.strings.length - 1;
let e = "",
n = !1;
for (let r = 0; r < t; r++) {
const t = this.strings[r],
o = t.lastIndexOf("\x3c!--");
n = (o > -1 || n) && -1 === t.indexOf("--\x3e", o + 1);
const a = l.exec(t);
e +=
null === a
? t + (n ? f : i)
: t.substr(0, a.index) + a[1] + a[2] + "$lit$" + a[3] + s;
}
return (e += this.strings[t]), e;
}
getTemplateElement() {
const t = document.createElement("template");
return (t.innerHTML = this.getHTML()), t;
}
}
class w extends v {
getHTML() {
return ``;
}
getTemplateElement() {
const t = super.getTemplateElement(),
e = t.content,
s = e.firstChild;
return (
e.removeChild(s),
((t, e, s = null, i = null) => {
for (; e !== s; ) {
const s = e.nextSibling;
t.insertBefore(e, i), (e = s);
}
})(e, s.firstChild),
t
);
}
}
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/ const S = (t) =>
null === t || !("object" == typeof t || "function" == typeof t),
b = (t) => Array.isArray(t) || !(!t || !t[Symbol.iterator]);
class x {
constructor(t, e, s) {
(this.dirty = !0),
(this.element = t),
(this.name = e),
(this.strings = s),
(this.parts = []);
for (let t = 0; t < s.length - 1; t++) this.parts[t] = this._createPart();
}
_createPart() {
return new P(this);
}
_getValue() {
const t = this.strings,
e = t.length - 1;
let s = "";
for (let i = 0; i < e; i++) {
s += t[i];
const e = this.parts[i];
if (void 0 !== e) {
const t = e.value;
if (S(t) || !b(t)) s += "string" == typeof t ? t : String(t);
else for (const e of t) s += "string" == typeof e ? e : String(e);
}
}
return (s += t[e]), s;
}
commit() {
this.dirty &&
((this.dirty = !1),
this.element.setAttribute(this.name, this._getValue()));
}
}
class P {
constructor(t) {
(this.value = void 0), (this.committer = t);
}
setValue(t) {
t === g ||
(S(t) && t === this.value) ||
((this.value = t), _(t) || (this.committer.dirty = !0));
}
commit() {
for (; _(this.value); ) {
const t = this.value;
(this.value = g), t(this);
}
this.value !== g && this.committer.commit();
}
}
class N {
constructor(t) {
(this.value = void 0), (this.__pendingValue = void 0), (this.options = t);
}
appendInto(t) {
(this.startNode = t.appendChild(h())), (this.endNode = t.appendChild(h()));
}
insertAfterNode(t) {
(this.startNode = t), (this.endNode = t.nextSibling);
}
appendIntoPart(t) {
t.__insert((this.startNode = h())), t.__insert((this.endNode = h()));
}
insertAfterPart(t) {
t.__insert((this.startNode = h())),
(this.endNode = t.endNode),
(t.endNode = this.startNode);
}
setValue(t) {
this.__pendingValue = t;
}
commit() {
if (null === this.startNode.parentNode) return;
for (; _(this.__pendingValue); ) {
const t = this.__pendingValue;
(this.__pendingValue = g), t(this);
}
const t = this.__pendingValue;
t !== g &&
(S(t)
? t !== this.value && this.__commitText(t)
: t instanceof v
? this.__commitTemplateResult(t)
: t instanceof Node
? this.__commitNode(t)
: b(t)
? this.__commitIterable(t)
: t === m
? ((this.value = m), this.clear())
: this.__commitText(t));
}
__insert(t) {
this.endNode.parentNode.insertBefore(t, this.endNode);
}
__commitNode(t) {
this.value !== t && (this.clear(), this.__insert(t), (this.value = t));
}
__commitText(t) {
const e = this.startNode.nextSibling,
s = "string" == typeof (t = null == t ? "" : t) ? t : String(t);
e === this.endNode.previousSibling && 3 === e.nodeType
? (e.data = s)
: this.__commitNode(document.createTextNode(s)),
(this.value = t);
}
__commitTemplateResult(t) {
const e = this.options.templateFactory(t);
if (this.value instanceof y && this.value.template === e)
this.value.update(t.values);
else {
const s = new y(e, t.processor, this.options),
i = s._clone();
s.update(t.values), this.__commitNode(i), (this.value = s);
}
}
__commitIterable(t) {
Array.isArray(this.value) || ((this.value = []), this.clear());
const e = this.value;
let s,
i = 0;
for (const n of t)
(s = e[i]),
void 0 === s &&
((s = new N(this.options)),
e.push(s),
0 === i ? s.appendIntoPart(this) : s.insertAfterPart(e[i - 1])),
s.setValue(n),
s.commit(),
i++;
i < e.length && ((e.length = i), this.clear(s && s.endNode));
}
clear(t = this.startNode) {
e(this.startNode.parentNode, t.nextSibling, this.endNode);
}
}
class C {
constructor(t, e, s) {
if (
((this.value = void 0),
(this.__pendingValue = void 0),
2 !== s.length || "" !== s[0] || "" !== s[1])
)
throw new Error(
"Boolean attributes can only contain a single expression"
);
(this.element = t), (this.name = e), (this.strings = s);
}
setValue(t) {
this.__pendingValue = t;
}
commit() {
for (; _(this.__pendingValue); ) {
const t = this.__pendingValue;
(this.__pendingValue = g), t(this);
}
if (this.__pendingValue === g) return;
const t = !!this.__pendingValue;
this.value !== t &&
(t
? this.element.setAttribute(this.name, "")
: this.element.removeAttribute(this.name),
(this.value = t)),
(this.__pendingValue = g);
}
}
class k extends x {
constructor(t, e, s) {
super(t, e, s),
(this.single = 2 === s.length && "" === s[0] && "" === s[1]);
}
_createPart() {
return new A(this);
}
_getValue() {
return this.single ? this.parts[0].value : super._getValue();
}
commit() {
this.dirty &&
((this.dirty = !1), (this.element[this.name] = this._getValue()));
}
}
class A extends P {}
let E = !1;
(() => {
try {
const t = {
get capture() {
return (E = !0), !1;
},
};
window.addEventListener("test", t, t),
window.removeEventListener("test", t, t);
} catch (t) {}
})();
class $ {
constructor(t, e, s) {
(this.value = void 0),
(this.__pendingValue = void 0),
(this.element = t),
(this.eventName = e),
(this.eventContext = s),
(this.__boundHandleEvent = (t) => this.handleEvent(t));
}
setValue(t) {
this.__pendingValue = t;
}
commit() {
for (; _(this.__pendingValue); ) {
const t = this.__pendingValue;
(this.__pendingValue = g), t(this);
}
if (this.__pendingValue === g) return;
const t = this.__pendingValue,
e = this.value,
s =
null == t ||
(null != e &&
(t.capture !== e.capture ||
t.once !== e.once ||
t.passive !== e.passive)),
i = null != t && (null == e || s);
s &&
this.element.removeEventListener(
this.eventName,
this.__boundHandleEvent,
this.__options
),
i &&
((this.__options = T(t)),
this.element.addEventListener(
this.eventName,
this.__boundHandleEvent,
this.__options
)),
(this.value = t),
(this.__pendingValue = g);
}
handleEvent(t) {
"function" == typeof this.value
? this.value.call(this.eventContext || this.element, t)
: this.value.handleEvent(t);
}
}
const T = (t) =>
t &&
(E ? { capture: t.capture, passive: t.passive, once: t.once } : t.capture);
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/ function M(t) {
let e = V.get(t.type);
void 0 === e &&
((e = { stringsArray: new WeakMap(), keyString: new Map() }),
V.set(t.type, e));
let i = e.stringsArray.get(t.strings);
if (void 0 !== i) return i;
const n = t.strings.join(s);
return (
(i = e.keyString.get(n)),
void 0 === i &&
((i = new r(t, t.getTemplateElement())), e.keyString.set(n, i)),
e.stringsArray.set(t.strings, i),
i
);
}
const V = new Map(),
R = new WeakMap();
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/ const L = new /**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
(class {
handleAttributeExpressions(t, e, s, i) {
const n = e[0];
if ("." === n) {
return new k(t, e.slice(1), s).parts;
}
if ("@" === n) return [new $(t, e.slice(1), i.eventContext)];
if ("?" === n) return [new C(t, e.slice(1), s)];
return new x(t, e, s).parts;
}
handleTextExpression(t) {
return new N(t);
}
})();
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/ "undefined" != typeof window &&
(window.litHtmlVersions || (window.litHtmlVersions = [])).push("1.2.1");
const U = (t, ...e) => new v(t, e, "html", L),
O = (t, ...e) => new w(t, e, "svg", L),
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/ q = (t, e) => `${t}--${e}`;
let H = !0;
void 0 === window.ShadyCSS
? (H = !1)
: void 0 === window.ShadyCSS.prepareTemplateDom &&
(console.warn(
"Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."
),
(H = !1));
const I = (t) => (e) => {
const i = q(e.type, t);
let n = V.get(i);
void 0 === n &&
((n = { stringsArray: new WeakMap(), keyString: new Map() }),
V.set(i, n));
let o = n.stringsArray.get(e.strings);
if (void 0 !== o) return o;
const a = e.strings.join(s);
if (((o = n.keyString.get(a)), void 0 === o)) {
const s = e.getTemplateElement();
H && window.ShadyCSS.prepareTemplateDom(s, t),
(o = new r(e, s)),
n.keyString.set(a, o);
}
return n.stringsArray.set(e.strings, o), o;
},
z = ["html", "svg"],
B = new Set(),
j = (t, e, s) => {
B.add(t);
const i = s ? s.element : document.createElement("template"),
n = e.querySelectorAll("style"),
{ length: r } = n;
if (0 === r) return void window.ShadyCSS.prepareTemplateStyles(i, t);
const o = document.createElement("style");
for (let t = 0; t < r; t++) {
const e = n[t];
e.parentNode.removeChild(e), (o.textContent += e.textContent);
}
((t) => {
z.forEach((e) => {
const s = V.get(q(e, t));
void 0 !== s &&
s.keyString.forEach((t) => {
const {
element: { content: e },
} = t,
s = new Set();
Array.from(e.querySelectorAll("style")).forEach((t) => {
s.add(t);
}),
d(t, s);
});
});
})(t);
const a = i.content;
s
? (function (t, e, s = null) {
const {
element: { content: i },
parts: n,
} = t;
if (null == s) return void i.appendChild(e);
const r = document.createTreeWalker(i, 133, null, !1);
let o = u(n),
a = 0,
h = -1;
for (; r.nextNode(); ) {
h++;
for (
r.currentNode === s &&
((a = c(e)), s.parentNode.insertBefore(e, s));
-1 !== o && n[o].index === h;
) {
if (a > 0) {
for (; -1 !== o; ) (n[o].index += a), (o = u(n, o));
return;
}
o = u(n, o);
}
}
})(s, o, a.firstChild)
: a.insertBefore(o, a.firstChild),
window.ShadyCSS.prepareTemplateStyles(i, t);
const h = a.querySelector("style");
if (window.ShadyCSS.nativeShadow && null !== h)
e.insertBefore(h.cloneNode(!0), e.firstChild);
else if (s) {
a.insertBefore(o, a.firstChild);
const t = new Set();
t.add(o), d(s, t);
}
};
window.JSCompiler_renameProperty = (t, e) => t;
const F = {
toAttribute(t, e) {
switch (e) {
case Boolean:
return t ? "" : null;
case Object:
case Array:
return null == t ? t : JSON.stringify(t);
}
return t;
},
fromAttribute(t, e) {
switch (e) {
case Boolean:
return null !== t;
case Number:
return null === t ? null : Number(t);
case Object:
case Array:
return JSON.parse(t);
}
return t;
},
},
W = (t, e) => e !== t && (e == e || t == t),
D = { attribute: !0, type: String, converter: F, reflect: !1, hasChanged: W };
class J extends HTMLElement {
constructor() {
super(),
(this._updateState = 0),
(this._instanceProperties = void 0),
(this._updatePromise = new Promise(
(t) => (this._enableUpdatingResolver = t)
)),
(this._changedProperties = new Map()),
(this._reflectingProperties = void 0),
this.initialize();
}
static get observedAttributes() {
this.finalize();
const t = [];
return (
this._classProperties.forEach((e, s) => {
const i = this._attributeNameForProperty(s, e);
void 0 !== i && (this._attributeToPropertyMap.set(i, s), t.push(i));
}),
t
);
}
static _ensureClassProperties() {
if (
!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties", this))
) {
this._classProperties = new Map();
const t = Object.getPrototypeOf(this)._classProperties;
void 0 !== t && t.forEach((t, e) => this._classProperties.set(e, t));
}
}
static createProperty(t, e = D) {
if (
(this._ensureClassProperties(),
this._classProperties.set(t, e),
e.noAccessor || this.prototype.hasOwnProperty(t))
)
return;
const s = "symbol" == typeof t ? Symbol() : "__" + t,
i = this.getPropertyDescriptor(t, s, e);
void 0 !== i && Object.defineProperty(this.prototype, t, i);
}
static getPropertyDescriptor(t, e, s) {
return {
get() {
return this[e];
},
set(s) {
const i = this[t];
(this[e] = s), this._requestUpdate(t, i);
},
configurable: !0,
enumerable: !0,
};
}
static getPropertyOptions(t) {
return (this._classProperties && this._classProperties.get(t)) || D;
}
static finalize() {
const t = Object.getPrototypeOf(this);
if (
(t.hasOwnProperty("finalized") || t.finalize(),
(this.finalized = !0),
this._ensureClassProperties(),
(this._attributeToPropertyMap = new Map()),
this.hasOwnProperty(JSCompiler_renameProperty("properties", this)))
) {
const t = this.properties,
e = [
...Object.getOwnPropertyNames(t),
...("function" == typeof Object.getOwnPropertySymbols
? Object.getOwnPropertySymbols(t)
: []),
];
for (const s of e) this.createProperty(s, t[s]);
}
}
static _attributeNameForProperty(t, e) {
const s = e.attribute;
return !1 === s
? void 0
: "string" == typeof s
? s
: "string" == typeof t
? t.toLowerCase()
: void 0;
}
static _valueHasChanged(t, e, s = W) {
return s(t, e);
}
static _propertyValueFromAttribute(t, e) {
const s = e.type,
i = e.converter || F,
n = "function" == typeof i ? i : i.fromAttribute;
return n ? n(t, s) : t;
}
static _propertyValueToAttribute(t, e) {
if (void 0 === e.reflect) return;
const s = e.type,
i = e.converter;
return ((i && i.toAttribute) || F.toAttribute)(t, s);
}
initialize() {
this._saveInstanceProperties(), this._requestUpdate();
}
_saveInstanceProperties() {
this.constructor._classProperties.forEach((t, e) => {
if (this.hasOwnProperty(e)) {
const t = this[e];
delete this[e],
this._instanceProperties || (this._instanceProperties = new Map()),
this._instanceProperties.set(e, t);
}
});
}
_applyInstanceProperties() {
this._instanceProperties.forEach((t, e) => (this[e] = t)),
(this._instanceProperties = void 0);
}
connectedCallback() {
this.enableUpdating();
}
enableUpdating() {
void 0 !== this._enableUpdatingResolver &&
(this._enableUpdatingResolver(), (this._enableUpdatingResolver = void 0));
}
disconnectedCallback() {}
attributeChangedCallback(t, e, s) {
e !== s && this._attributeToProperty(t, s);
}
_propertyToAttribute(t, e, s = D) {
const i = this.constructor,
n = i._attributeNameForProperty(t, s);
if (void 0 !== n) {
const t = i._propertyValueToAttribute(e, s);
if (void 0 === t) return;
(this._updateState = 8 | this._updateState),
null == t ? this.removeAttribute(n) : this.setAttribute(n, t),
(this._updateState = -9 & this._updateState);
}
}
_attributeToProperty(t, e) {
if (8 & this._updateState) return;
const s = this.constructor,
i = s._attributeToPropertyMap.get(t);
if (void 0 !== i) {
const t = s.getPropertyOptions(i);
(this._updateState = 16 | this._updateState),
(this[i] = s._propertyValueFromAttribute(e, t)),
(this._updateState = -17 & this._updateState);
}
}
_requestUpdate(t, e) {
let s = !0;
if (void 0 !== t) {
const i = this.constructor,
n = i.getPropertyOptions(t);
i._valueHasChanged(this[t], e, n.hasChanged)
? (this._changedProperties.has(t) || this._changedProperties.set(t, e),
!0 !== n.reflect ||
16 & this._updateState ||
(void 0 === this._reflectingProperties &&
(this._reflectingProperties = new Map()),
this._reflectingProperties.set(t, n)))
: (s = !1);
}
!this._hasRequestedUpdate &&
s &&
(this._updatePromise = this._enqueueUpdate());
}
requestUpdate(t, e) {
return this._requestUpdate(t, e), this.updateComplete;
}
async _enqueueUpdate() {
this._updateState = 4 | this._updateState;
try {
await this._updatePromise;
} catch (t) {}
const t = this.performUpdate();
return null != t && (await t), !this._hasRequestedUpdate;
}
get _hasRequestedUpdate() {
return 4 & this._updateState;
}
get hasUpdated() {
return 1 & this._updateState;
}
performUpdate() {
this._instanceProperties && this._applyInstanceProperties();
let t = !1;
const e = this._changedProperties;
try {
(t = this.shouldUpdate(e)), t ? this.update(e) : this._markUpdated();
} catch (e) {
throw ((t = !1), this._markUpdated(), e);
}
t &&
(1 & this._updateState ||
((this._updateState = 1 | this._updateState), this.firstUpdated(e)),
this.updated(e));
}
_markUpdated() {
(this._changedProperties = new Map()),
(this._updateState = -5 & this._updateState);
}
get updateComplete() {
return this._getUpdateComplete();
}
_getUpdateComplete() {
return this._updatePromise;
}
shouldUpdate(t) {
return !0;
}
update(t) {
void 0 !== this._reflectingProperties &&
this._reflectingProperties.size > 0 &&
(this._reflectingProperties.forEach((t, e) =>
this._propertyToAttribute(e, this[e], t)
),
(this._reflectingProperties = void 0)),
this._markUpdated();
}
updated(t) {}
firstUpdated(t) {}
}
J.finalized = !0;
/**
@license
Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
part of the polymer project is also subject to an additional IP rights grant
found at http://polymer.github.io/PATENTS.txt
*/
const Z =
"adoptedStyleSheets" in Document.prototype &&
"replace" in CSSStyleSheet.prototype,
X = Symbol();
class Y {
constructor(t, e) {
if (e !== X)
throw new Error(
"CSSResult is not constructable. Use `unsafeCSS` or `css` instead."
);
this.cssText = t;
}
get styleSheet() {
return (
void 0 === this._styleSheet &&
(Z
? ((this._styleSheet = new CSSStyleSheet()),
this._styleSheet.replaceSync(this.cssText))
: (this._styleSheet = null)),
this._styleSheet
);
}
toString() {
return this.cssText;
}
}
const G = (t, ...e) => {
const s = e.reduce(
(e, s, i) =>
e +
((t) => {
if (t instanceof Y) return t.cssText;
if ("number" == typeof t) return t;
throw new Error(
`Value passed to 'css' function must be a 'css' function result: ${t}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`
);
})(s) +
t[i + 1],
t[0]
);
return new Y(s, X);
};
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at
* http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at
* http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
(window.litElementVersions || (window.litElementVersions = [])).push("2.3.1");
const K = {};
class Q extends J {
static getStyles() {
return this.styles;
}
static _getUniqueStyles() {
if (this.hasOwnProperty(JSCompiler_renameProperty("_styles", this))) return;
const t = this.getStyles();
if (void 0 === t) this._styles = [];
else if (Array.isArray(t)) {
const e = (t, s) =>
t.reduceRight(
(t, s) => (Array.isArray(s) ? e(s, t) : (t.add(s), t)),
s
),
s = e(t, new Set()),
i = [];
s.forEach((t) => i.unshift(t)), (this._styles = i);
} else this._styles = [t];
}
initialize() {
super.initialize(),
this.constructor._getUniqueStyles(),
(this.renderRoot = this.createRenderRoot()),
window.ShadowRoot &&
this.renderRoot instanceof window.ShadowRoot &&
this.adoptStyles();
}
createRenderRoot() {
return this.attachShadow({ mode: "open" });
}
adoptStyles() {
const t = this.constructor._styles;
0 !== t.length &&
(void 0 === window.ShadyCSS || window.ShadyCSS.nativeShadow
? Z
? (this.renderRoot.adoptedStyleSheets = t.map((t) => t.styleSheet))
: (this._needsShimAdoptedStyleSheets = !0)
: window.ShadyCSS.ScopingShim.prepareAdoptedCssText(
t.map((t) => t.cssText),
this.localName
));
}
connectedCallback() {
super.connectedCallback(),
this.hasUpdated &&
void 0 !== window.ShadyCSS &&
window.ShadyCSS.styleElement(this);
}
update(t) {
const e = this.render();
super.update(t),
e !== K &&
this.constructor.render(e, this.renderRoot, {
scopeName: this.localName,
eventContext: this,
}),
this._needsShimAdoptedStyleSheets &&
((this._needsShimAdoptedStyleSheets = !1),
this.constructor._styles.forEach((t) => {
const e = document.createElement("style");
(e.textContent = t.cssText), this.renderRoot.appendChild(e);
}));
}
render() {
return K;
}
}
(Q.finalized = !0),
(Q.render = (t, s, i) => {
if (!i || "object" != typeof i || !i.scopeName)
throw new Error("The `scopeName` option is required.");
const n = i.scopeName,
r = R.has(s),
o = H && 11 === s.nodeType && !!s.host,
a = o && !B.has(n),
h = a ? document.createDocumentFragment() : s;
if (
(((t, s, i) => {
let n = R.get(s);
void 0 === n &&
(e(s, s.firstChild),
R.set(s, (n = new N(Object.assign({ templateFactory: M }, i)))),
n.appendInto(s)),
n.setValue(t),
n.commit();
})(t, h, Object.assign({ templateFactory: I(n) }, i)),
a)
) {
const t = R.get(h);
R.delete(h);
const i = t.value instanceof y ? t.value.template : void 0;
j(n, h, i), e(s, s.firstChild), s.appendChild(h), R.set(s, t);
}
!r && o && window.ShadyCSS.styleElement(s.host);
});
customElements.define(
"round-slider",
class extends Q {
static get properties() {
return {
value: { type: Number },
high: { type: Number },
low: { type: Number },
min: { type: Number },
max: { type: Number },
step: { type: Number },
startAngle: { type: Number },
arcLength: { type: Number },
handleSize: { type: Number },
handleZoom: { type: Number },
readonly: { type: Boolean },
disabled: { type: Boolean },
dragging: { type: Boolean, reflect: !0 },
rtl: { type: Boolean },
_scale: { type: Number },
valueLabel: { type: String },
lowLabel: { type: String },
highLabel: { type: String },
};
}
constructor() {
super(),
(this.min = 16),
(this.max = 38),
(this.step = 1),
(this.startAngle = 135),
(this.arcLength = 270),
(this.handleSize = 6),
(this.handleZoom = 1.5),
(this.readonly = !1),
(this.disabled = !1),
(this.dragging = !1),
(this.rtl = !1),
(this._scale = 1),
(this.attachedListeners = !1);
}
get _start() {
return (this.startAngle * Math.PI) / 180;
}
get _len() {
return Math.min((this.arcLength * Math.PI) / 180, 2 * Math.PI - 0.01);
}
get _end() {
return this._start + this._len;
}
get _showHandle() {
return (
!this.readonly &&
(null != this.value || (null != this.high && null != this.low))
);
}
_angleInside(t) {
let e =
((this.startAngle + this.arcLength / 2 - t + 180 + 360) % 360) - 180;
return e < this.arcLength / 2 && e > -this.arcLength / 2;
}
_angle2xy(t) {
return this.rtl
? { x: -Math.cos(t), y: Math.sin(t) }
: { x: Math.cos(t), y: Math.sin(t) };
}
_xy2angle(t, e) {
return (
this.rtl && (t = -t),
(Math.atan2(e, t) - this._start + 2 * Math.PI) % (2 * Math.PI)
);
}
_value2angle(t) {
const e =
((t = Math.min(this.max, Math.max(this.min, t))) - this.min) /
(this.max - this.min);
return this._start + e * this._len;
}
_angle2value(t) {
return (
Math.round(
((t / this._len) * (this.max - this.min) + this.min) / this.step
) * this.step
);
}
get _boundaries() {
const t = this._angle2xy(this._start),
e = this._angle2xy(this._end);
let s = 1;
this._angleInside(270) || (s = Math.max(-t.y, -e.y));
let i = 1;
this._angleInside(90) || (i = Math.max(t.y, e.y));
let n = 1;
this._angleInside(180) || (n = Math.max(-t.x, -e.x));
let r = 1;
return (
this._angleInside(0) || (r = Math.max(t.x, e.x)),
{ up: s, down: i, left: n, right: r, height: s + i, width: n + r }
);
}
_mouse2value(t) {
const e = t.type.startsWith("touch") ? t.touches[0].clientX : t.clientX,
s = t.type.startsWith("touch") ? t.touches[0].clientY : t.clientY,
i = this.shadowRoot.querySelector("svg").getBoundingClientRect(),
n = this._boundaries,
r = e - (i.left + (n.left * i.width) / n.width),
o = s - (i.top + (n.up * i.height) / n.height),
a = this._xy2angle(r, o);
return this._angle2value(a);
}
dragStart(t) {
if (!this._showHandle || this.disabled) return;
let e = t.target,
s = void 0;
if (this._rotation && "focus" !== this._rotation.type) return;
if (e.classList.contains("shadowpath"))
if (
("touchstart" === t.type &&
(s = window.setTimeout(() => {
this._rotation && (this._rotation.cooldown = void 0);
}, 200)),
null == this.low)
)
e = this.shadowRoot.querySelector("#value");
else {
const s = this._mouse2value(t);
e =
Math.abs(s - this.low) < Math.abs(s - this.high)
? this.shadowRoot.querySelector("#low")
: this.shadowRoot.querySelector("#high");
}
if (
(e.classList.contains("overflow") && (e = e.nextElementSibling),
!e.classList.contains("handle"))
)
return;
e.setAttribute(
"stroke-width",
2 * this.handleSize * this.handleZoom * this._scale
);
const i = "high" === e.id ? this.low : this.min,
n = "low" === e.id ? this.high : this.max;
(this._rotation = {
handle: e,
min: i,
max: n,
start: this[e.id],
type: t.type,
cooldown: s,
}),
(this.dragging = !0);
}
_cleanupRotation() {
const t = this._rotation.handle;
t.setAttribute("stroke-width", 2 * this.handleSize * this._scale),
(this._rotation = !1),
(this.dragging = !1),
t.blur();
}
dragEnd(t) {
if (!this._showHandle || this.disabled) return;
if (!this._rotation) return;
const e = this._rotation.handle;
this._cleanupRotation();
let s = new CustomEvent("value-changed", {
detail: { [e.id]: this[e.id] },
bubbles: !0,
composed: !0,
});
this.dispatchEvent(s),
this.low && this.low >= 0.99 * this.max
? (this._reverseOrder = !0)
: (this._reverseOrder = !1);
}
drag(t) {
if (!this._showHandle || this.disabled) return;
if (!this._rotation) return;
if (this._rotation.cooldown)
return (
window.clearTimeout(this._rotation.coldown),
void this._cleanupRotation()
);
if ("focus" === this._rotation.type) return;
t.preventDefault();
const e = this._mouse2value(t);
this._dragpos(e);
}
_dragpos(t) {
if (t < this._rotation.min || t > this._rotation.max) return;
const e = this._rotation.handle;
this[e.id] = t;
let s = new CustomEvent("value-changing", {
detail: { [e.id]: t },
bubbles: !0,
composed: !0,
});
this.dispatchEvent(s);
}
_keyStep(t) {
if (!this._showHandle || this.disabled) return;
if (!this._rotation) return;
const e = this._rotation.handle;
("ArrowLeft" !== t.key && "ArrowDown" !== t.key) ||
(t.preventDefault(),
this.rtl
? this._dragpos(this[e.id] + this.step)
: this._dragpos(this[e.id] - this.step)),
("ArrowRight" !== t.key && "ArrowUp" !== t.key) ||
(t.preventDefault(),
this.rtl
? this._dragpos(this[e.id] - this.step)
: this._dragpos(this[e.id] + this.step)),
"Home" === t.key && (t.preventDefault(), this._dragpos(this.min)),
"End" === t.key && (t.preventDefault(), this._dragpos(this.max));
}
firstUpdated() {
document.addEventListener("mouseup", this.dragEnd.bind(this)),
document.addEventListener("touchend", this.dragEnd.bind(this), {
passive: !1,
}),
document.addEventListener("mousemove", this.drag.bind(this)),
document.addEventListener("touchmove", this.drag.bind(this), {
passive: !1,
}),
document.addEventListener("keydown", this._keyStep.bind(this));
}
updated(t) {
if (this.shadowRoot.querySelector(".slider")) {
const t = window.getComputedStyle(
this.shadowRoot.querySelector(".slider")
);
if (t && t.strokeWidth) {
const e = parseFloat(t.strokeWidth);
if (e > this.handleSize * this.handleZoom) {
const t = this._boundaries,
s = `\n ${(e / 2) * Math.abs(t.up)}px\n ${
(e / 2) * Math.abs(t.right)
}px\n ${(e / 2) * Math.abs(t.down)}px\n ${
(e / 2) * Math.abs(t.left)
}px`;
this.shadowRoot.querySelector("svg").style.margin = s;
}
}
}
if (
this.shadowRoot.querySelector("svg") &&
void 0 === this.shadowRoot.querySelector("svg").style.vectorEffect
) {
t.has("_scale") &&
1 != this._scale &&
this.shadowRoot
.querySelector("svg")
.querySelectorAll("path")
.forEach((t) => {
if (t.getAttribute("stroke-width")) return;
const e = parseFloat(
getComputedStyle(t).getPropertyValue("stroke-width")
);
t.style.strokeWidth = e * this._scale + "px";
});
const e = this.shadowRoot.querySelector("svg").getBoundingClientRect(),
s = Math.max(e.width, e.height);
this._scale = 2 / s;
}
}
_renderArc(t, e) {
const s = e - t;
return (
(t = this._angle2xy(t)),
(e = this._angle2xy(e + 0.001)),
`\n M ${t.x} ${t.y}\n A 1 1,\n 0,\n ${
s > Math.PI ? "1" : "0"
} ${this.rtl ? "0" : "1"},\n ${e.x} ${e.y}\n `
);
}
_renderHandle(t) {
const e = this._value2angle(this[t]),
s = this._angle2xy(e),
i =
{ value: this.valueLabel, low: this.lowLabel, high: this.highLabel }[
t
] || "";
return O`
`;
}
render() {
const t = this._boundaries;
return U`
`;
}
static get styles() {
return G`
:host {
display: inline-block;
width: 100%;
}
svg {
overflow: visible;
display: block;
}
path {
transition: stroke 1s ease-out, stroke-width 200ms ease-out;
}
.slider {
fill: none;
stroke-width: 5px;
stroke-linecap: var(--round-slider-linecap, round);
}
.path {
stroke: var(--round-slider-path-color, lightgray);
}
.bar {
stroke: var(--round-slider-bar-color, #e3306d);
}
svg[disabled] .bar {
stroke: var(--round-slider-disabled-bar-color, darkgray);
}
g.handles {
stroke: var(--round-slider-handle-color, var(--round-slider-bar-color, #e3306d));
stroke-linecap: round;
cursor: var(--round-slider-handle-cursor, pointer);
stroke-width: 18px;
}
g.low.handle {
stroke: var(--round-slider-low-handle-color);
}
g.high.handle {
stroke: var(--round-slider-high-handle-color);
}
svg[disabled] g.handles {
stroke: var(--round-slider-disabled-bar-color, darkgray);
}
.handle:focus {
outline: unset;
}
`;
}
}
);