@revealbi/ui
Version:
859 lines (838 loc) • 30.7 kB
JavaScript
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const R = globalThis, I = R.ShadowRoot && (R.ShadyCSS === void 0 || R.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, D = Symbol(), q = /* @__PURE__ */ new WeakMap();
let st = class {
constructor(t, e, s) {
if (this._$cssResult$ = !0, s !== D) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
this.cssText = t, this.t = e;
}
get styleSheet() {
let t = this.o;
const e = this.t;
if (I && t === void 0) {
const s = e !== void 0 && e.length === 1;
s && (t = q.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && q.set(e, t));
}
return t;
}
toString() {
return this.cssText;
}
};
const dt = (r) => new st(typeof r == "string" ? r : r + "", void 0, D), it = (r, ...t) => {
const e = r.length === 1 ? r[0] : t.reduce((s, i, o) => s + ((n) => {
if (n._$cssResult$ === !0) return n.cssText;
if (typeof n == "number") return n;
throw Error("Value passed to 'css' function must be a 'css' function result: " + n + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
})(i) + r[o + 1], r[0]);
return new st(e, r, D);
}, pt = (r, t) => {
if (I) r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
else for (const e of t) {
const s = document.createElement("style"), i = R.litNonce;
i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, r.appendChild(s);
}
}, J = I ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
let e = "";
for (const s of t.cssRules) e += s.cssText;
return dt(e);
})(r) : r;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const { is: ut, defineProperty: gt, getOwnPropertyDescriptor: $t, getOwnPropertyNames: _t, getOwnPropertySymbols: ft, getPrototypeOf: vt } = Object, _ = globalThis, K = _.trustedTypes, mt = K ? K.emptyScript : "", L = _.reactiveElementPolyfillSupport, E = (r, t) => r, H = { toAttribute(r, t) {
switch (t) {
case Boolean:
r = r ? mt : null;
break;
case Object:
case Array:
r = r == null ? r : JSON.stringify(r);
}
return r;
}, fromAttribute(r, t) {
let e = r;
switch (t) {
case Boolean:
e = r !== null;
break;
case Number:
e = r === null ? null : Number(r);
break;
case Object:
case Array:
try {
e = JSON.parse(r);
} catch {
e = null;
}
}
return e;
} }, V = (r, t) => !ut(r, t), Z = { attribute: !0, type: String, converter: H, reflect: !1, hasChanged: V };
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), _.litPropertyMetadata ?? (_.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
class A extends HTMLElement {
static addInitializer(t) {
this._$Ei(), (this.l ?? (this.l = [])).push(t);
}
static get observedAttributes() {
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
}
static createProperty(t, e = Z) {
if (e.state && (e.attribute = !1), this._$Ei(), this.elementProperties.set(t, e), !e.noAccessor) {
const s = Symbol(), i = this.getPropertyDescriptor(t, s, e);
i !== void 0 && gt(this.prototype, t, i);
}
}
static getPropertyDescriptor(t, e, s) {
const { get: i, set: o } = $t(this.prototype, t) ?? { get() {
return this[e];
}, set(n) {
this[e] = n;
} };
return { get() {
return i == null ? void 0 : i.call(this);
}, set(n) {
const l = i == null ? void 0 : i.call(this);
o.call(this, n), this.requestUpdate(t, l, s);
}, configurable: !0, enumerable: !0 };
}
static getPropertyOptions(t) {
return this.elementProperties.get(t) ?? Z;
}
static _$Ei() {
if (this.hasOwnProperty(E("elementProperties"))) return;
const t = vt(this);
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
}
static finalize() {
if (this.hasOwnProperty(E("finalized"))) return;
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(E("properties"))) {
const e = this.properties, s = [..._t(e), ...ft(e)];
for (const i of s) this.createProperty(i, e[i]);
}
const t = this[Symbol.metadata];
if (t !== null) {
const e = litPropertyMetadata.get(t);
if (e !== void 0) for (const [s, i] of e) this.elementProperties.set(s, i);
}
this._$Eh = /* @__PURE__ */ new Map();
for (const [e, s] of this.elementProperties) {
const i = this._$Eu(e, s);
i !== void 0 && this._$Eh.set(i, e);
}
this.elementStyles = this.finalizeStyles(this.styles);
}
static finalizeStyles(t) {
const e = [];
if (Array.isArray(t)) {
const s = new Set(t.flat(1 / 0).reverse());
for (const i of s) e.unshift(J(i));
} else t !== void 0 && e.push(J(t));
return e;
}
static _$Eu(t, e) {
const s = e.attribute;
return s === !1 ? void 0 : typeof s == "string" ? s : typeof t == "string" ? t.toLowerCase() : void 0;
}
constructor() {
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
}
_$Ev() {
var t;
this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (t = this.constructor.l) == null || t.forEach((e) => e(this));
}
addController(t) {
var e;
(this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(t), this.renderRoot !== void 0 && this.isConnected && ((e = t.hostConnected) == null || e.call(t));
}
removeController(t) {
var e;
(e = this._$EO) == null || e.delete(t);
}
_$E_() {
const t = /* @__PURE__ */ new Map(), e = this.constructor.elementProperties;
for (const s of e.keys()) this.hasOwnProperty(s) && (t.set(s, this[s]), delete this[s]);
t.size > 0 && (this._$Ep = t);
}
createRenderRoot() {
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
return pt(t, this.constructor.elementStyles), t;
}
connectedCallback() {
var t;
this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (t = this._$EO) == null || t.forEach((e) => {
var s;
return (s = e.hostConnected) == null ? void 0 : s.call(e);
});
}
enableUpdating(t) {
}
disconnectedCallback() {
var t;
(t = this._$EO) == null || t.forEach((e) => {
var s;
return (s = e.hostDisconnected) == null ? void 0 : s.call(e);
});
}
attributeChangedCallback(t, e, s) {
this._$AK(t, s);
}
_$EC(t, e) {
var o;
const s = this.constructor.elementProperties.get(t), i = this.constructor._$Eu(t, s);
if (i !== void 0 && s.reflect === !0) {
const n = (((o = s.converter) == null ? void 0 : o.toAttribute) !== void 0 ? s.converter : H).toAttribute(e, s.type);
this._$Em = t, n == null ? this.removeAttribute(i) : this.setAttribute(i, n), this._$Em = null;
}
}
_$AK(t, e) {
var o;
const s = this.constructor, i = s._$Eh.get(t);
if (i !== void 0 && this._$Em !== i) {
const n = s.getPropertyOptions(i), l = typeof n.converter == "function" ? { fromAttribute: n.converter } : ((o = n.converter) == null ? void 0 : o.fromAttribute) !== void 0 ? n.converter : H;
this._$Em = i, this[i] = l.fromAttribute(e, n.type), this._$Em = null;
}
}
requestUpdate(t, e, s) {
if (t !== void 0) {
if (s ?? (s = this.constructor.getPropertyOptions(t)), !(s.hasChanged ?? V)(this[t], e)) return;
this.P(t, e, s);
}
this.isUpdatePending === !1 && (this._$ES = this._$ET());
}
P(t, e, s) {
this._$AL.has(t) || this._$AL.set(t, e), s.reflect === !0 && this._$Em !== t && (this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Set())).add(t);
}
async _$ET() {
this.isUpdatePending = !0;
try {
await this._$ES;
} catch (e) {
Promise.reject(e);
}
const t = this.scheduleUpdate();
return t != null && await t, !this.isUpdatePending;
}
scheduleUpdate() {
return this.performUpdate();
}
performUpdate() {
var s;
if (!this.isUpdatePending) return;
if (!this.hasUpdated) {
if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
for (const [o, n] of this._$Ep) this[o] = n;
this._$Ep = void 0;
}
const i = this.constructor.elementProperties;
if (i.size > 0) for (const [o, n] of i) n.wrapped !== !0 || this._$AL.has(o) || this[o] === void 0 || this.P(o, this[o], n);
}
let t = !1;
const e = this._$AL;
try {
t = this.shouldUpdate(e), t ? (this.willUpdate(e), (s = this._$EO) == null || s.forEach((i) => {
var o;
return (o = i.hostUpdate) == null ? void 0 : o.call(i);
}), this.update(e)) : this._$EU();
} catch (i) {
throw t = !1, this._$EU(), i;
}
t && this._$AE(e);
}
willUpdate(t) {
}
_$AE(t) {
var e;
(e = this._$EO) == null || e.forEach((s) => {
var i;
return (i = s.hostUpdated) == null ? void 0 : i.call(s);
}), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
}
_$EU() {
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
}
get updateComplete() {
return this.getUpdateComplete();
}
getUpdateComplete() {
return this._$ES;
}
shouldUpdate(t) {
return !0;
}
update(t) {
this._$Ej && (this._$Ej = this._$Ej.forEach((e) => this._$EC(e, this[e]))), this._$EU();
}
updated(t) {
}
firstUpdated(t) {
}
}
A.elementStyles = [], A.shadowRootOptions = { mode: "open" }, A[E("elementProperties")] = /* @__PURE__ */ new Map(), A[E("finalized")] = /* @__PURE__ */ new Map(), L == null || L({ ReactiveElement: A }), (_.reactiveElementVersions ?? (_.reactiveElementVersions = [])).push("2.0.4");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const S = globalThis, M = S.trustedTypes, F = M ? M.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, rt = "$lit$", $ = `lit$${Math.random().toFixed(9).slice(2)}$`, ot = "?" + $, yt = `<${ot}>`, m = document, C = () => m.createComment(""), P = (r) => r === null || typeof r != "object" && typeof r != "function", nt = Array.isArray, At = (r) => nt(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", j = `[
\f\r]`, x = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Y = /-->/g, G = />/g, f = RegExp(`>|${j}(?:([^\\s"'>=/]+)(${j}*=${j}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`, "g"), Q = /'/g, X = /"/g, at = /^(?:script|style|textarea|title)$/i, bt = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), xt = bt(1), y = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), tt = /* @__PURE__ */ new WeakMap(), v = m.createTreeWalker(m, 129);
function lt(r, t) {
if (!Array.isArray(r) || !r.hasOwnProperty("raw")) throw Error("invalid template strings array");
return F !== void 0 ? F.createHTML(t) : t;
}
const Et = (r, t) => {
const e = r.length - 1, s = [];
let i, o = t === 2 ? "<svg>" : "", n = x;
for (let l = 0; l < e; l++) {
const a = r[l];
let c, p, h = -1, u = 0;
for (; u < a.length && (n.lastIndex = u, p = n.exec(a), p !== null); ) u = n.lastIndex, n === x ? p[1] === "!--" ? n = Y : p[1] !== void 0 ? n = G : p[2] !== void 0 ? (at.test(p[2]) && (i = RegExp("</" + p[2], "g")), n = f) : p[3] !== void 0 && (n = f) : n === f ? p[0] === ">" ? (n = i ?? x, h = -1) : p[1] === void 0 ? h = -2 : (h = n.lastIndex - p[2].length, c = p[1], n = p[3] === void 0 ? f : p[3] === '"' ? X : Q) : n === X || n === Q ? n = f : n === Y || n === G ? n = x : (n = f, i = void 0);
const g = n === f && r[l + 1].startsWith("/>") ? " " : "";
o += n === x ? a + yt : h >= 0 ? (s.push(c), a.slice(0, h) + rt + a.slice(h) + $ + g) : a + $ + (h === -2 ? l : g);
}
return [lt(r, o + (r[e] || "<?>") + (t === 2 ? "</svg>" : "")), s];
};
class U {
constructor({ strings: t, _$litType$: e }, s) {
let i;
this.parts = [];
let o = 0, n = 0;
const l = t.length - 1, a = this.parts, [c, p] = Et(t, e);
if (this.el = U.createElement(c, s), v.currentNode = this.el.content, e === 2) {
const h = this.el.content.firstChild;
h.replaceWith(...h.childNodes);
}
for (; (i = v.nextNode()) !== null && a.length < l; ) {
if (i.nodeType === 1) {
if (i.hasAttributes()) for (const h of i.getAttributeNames()) if (h.endsWith(rt)) {
const u = p[n++], g = i.getAttribute(h).split($), O = /([.?@])?(.*)/.exec(u);
a.push({ type: 1, index: o, name: O[2], strings: g, ctor: O[1] === "." ? wt : O[1] === "?" ? Ct : O[1] === "@" ? Pt : N }), i.removeAttribute(h);
} else h.startsWith($) && (a.push({ type: 6, index: o }), i.removeAttribute(h));
if (at.test(i.tagName)) {
const h = i.textContent.split($), u = h.length - 1;
if (u > 0) {
i.textContent = M ? M.emptyScript : "";
for (let g = 0; g < u; g++) i.append(h[g], C()), v.nextNode(), a.push({ type: 2, index: ++o });
i.append(h[u], C());
}
}
} else if (i.nodeType === 8) if (i.data === ot) a.push({ type: 2, index: o });
else {
let h = -1;
for (; (h = i.data.indexOf($, h + 1)) !== -1; ) a.push({ type: 7, index: o }), h += $.length - 1;
}
o++;
}
}
static createElement(t, e) {
const s = m.createElement("template");
return s.innerHTML = t, s;
}
}
function b(r, t, e = r, s) {
var n, l;
if (t === y) return t;
let i = s !== void 0 ? (n = e._$Co) == null ? void 0 : n[s] : e._$Cl;
const o = P(t) ? void 0 : t._$litDirective$;
return (i == null ? void 0 : i.constructor) !== o && ((l = i == null ? void 0 : i._$AO) == null || l.call(i, !1), o === void 0 ? i = void 0 : (i = new o(r), i._$AT(r, e, s)), s !== void 0 ? (e._$Co ?? (e._$Co = []))[s] = i : e._$Cl = i), i !== void 0 && (t = b(r, i._$AS(r, t.values), i, s)), t;
}
class St {
constructor(t, e) {
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
}
get parentNode() {
return this._$AM.parentNode;
}
get _$AU() {
return this._$AM._$AU;
}
u(t) {
const { el: { content: e }, parts: s } = this._$AD, i = ((t == null ? void 0 : t.creationScope) ?? m).importNode(e, !0);
v.currentNode = i;
let o = v.nextNode(), n = 0, l = 0, a = s[0];
for (; a !== void 0; ) {
if (n === a.index) {
let c;
a.type === 2 ? c = new k(o, o.nextSibling, this, t) : a.type === 1 ? c = new a.ctor(o, a.name, a.strings, this, t) : a.type === 6 && (c = new Ut(o, this, t)), this._$AV.push(c), a = s[++l];
}
n !== (a == null ? void 0 : a.index) && (o = v.nextNode(), n++);
}
return v.currentNode = m, i;
}
p(t) {
let e = 0;
for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++;
}
}
class k {
get _$AU() {
var t;
return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
}
constructor(t, e, s, i) {
this.type = 2, this._$AH = d, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = i, this._$Cv = (i == null ? void 0 : i.isConnected) ?? !0;
}
get parentNode() {
let t = this._$AA.parentNode;
const e = this._$AM;
return e !== void 0 && (t == null ? void 0 : t.nodeType) === 11 && (t = e.parentNode), t;
}
get startNode() {
return this._$AA;
}
get endNode() {
return this._$AB;
}
_$AI(t, e = this) {
t = b(this, t, e), P(t) ? t === d || t == null || t === "" ? (this._$AH !== d && this._$AR(), this._$AH = d) : t !== this._$AH && t !== y && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : At(t) ? this.k(t) : this._(t);
}
S(t) {
return this._$AA.parentNode.insertBefore(t, this._$AB);
}
T(t) {
this._$AH !== t && (this._$AR(), this._$AH = this.S(t));
}
_(t) {
this._$AH !== d && P(this._$AH) ? this._$AA.nextSibling.data = t : this.T(m.createTextNode(t)), this._$AH = t;
}
$(t) {
var o;
const { values: e, _$litType$: s } = t, i = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = U.createElement(lt(s.h, s.h[0]), this.options)), s);
if (((o = this._$AH) == null ? void 0 : o._$AD) === i) this._$AH.p(e);
else {
const n = new St(i, this), l = n.u(this.options);
n.p(e), this.T(l), this._$AH = n;
}
}
_$AC(t) {
let e = tt.get(t.strings);
return e === void 0 && tt.set(t.strings, e = new U(t)), e;
}
k(t) {
nt(this._$AH) || (this._$AH = [], this._$AR());
const e = this._$AH;
let s, i = 0;
for (const o of t) i === e.length ? e.push(s = new k(this.S(C()), this.S(C()), this, this.options)) : s = e[i], s._$AI(o), i++;
i < e.length && (this._$AR(s && s._$AB.nextSibling, i), e.length = i);
}
_$AR(t = this._$AA.nextSibling, e) {
var s;
for ((s = this._$AP) == null ? void 0 : s.call(this, !1, !0, e); t && t !== this._$AB; ) {
const i = t.nextSibling;
t.remove(), t = i;
}
}
setConnected(t) {
var e;
this._$AM === void 0 && (this._$Cv = t, (e = this._$AP) == null || e.call(this, t));
}
}
class N {
get tagName() {
return this.element.tagName;
}
get _$AU() {
return this._$AM._$AU;
}
constructor(t, e, s, i, o) {
this.type = 1, this._$AH = d, this._$AN = void 0, this.element = t, this.name = e, this._$AM = i, this.options = o, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = d;
}
_$AI(t, e = this, s, i) {
const o = this.strings;
let n = !1;
if (o === void 0) t = b(this, t, e, 0), n = !P(t) || t !== this._$AH && t !== y, n && (this._$AH = t);
else {
const l = t;
let a, c;
for (t = o[0], a = 0; a < o.length - 1; a++) c = b(this, l[s + a], e, a), c === y && (c = this._$AH[a]), n || (n = !P(c) || c !== this._$AH[a]), c === d ? t = d : t !== d && (t += (c ?? "") + o[a + 1]), this._$AH[a] = c;
}
n && !i && this.j(t);
}
j(t) {
t === d ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
}
}
class wt extends N {
constructor() {
super(...arguments), this.type = 3;
}
j(t) {
this.element[this.name] = t === d ? void 0 : t;
}
}
class Ct extends N {
constructor() {
super(...arguments), this.type = 4;
}
j(t) {
this.element.toggleAttribute(this.name, !!t && t !== d);
}
}
class Pt extends N {
constructor(t, e, s, i, o) {
super(t, e, s, i, o), this.type = 5;
}
_$AI(t, e = this) {
if ((t = b(this, t, e, 0) ?? d) === y) return;
const s = this._$AH, i = t === d && s !== d || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, o = t !== d && (s === d || i);
i && this.element.removeEventListener(this.name, this, s), o && this.element.addEventListener(this.name, this, t), this._$AH = t;
}
handleEvent(t) {
var e;
typeof this._$AH == "function" ? this._$AH.call(((e = this.options) == null ? void 0 : e.host) ?? this.element, t) : this._$AH.handleEvent(t);
}
}
class Ut {
constructor(t, e, s) {
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
}
get _$AU() {
return this._$AM._$AU;
}
_$AI(t) {
b(this, t);
}
}
const z = S.litHtmlPolyfillSupport;
z == null || z(U, k), (S.litHtmlVersions ?? (S.litHtmlVersions = [])).push("3.1.4");
const Tt = (r, t, e) => {
const s = (e == null ? void 0 : e.renderBefore) ?? t;
let i = s._$litPart$;
if (i === void 0) {
const o = (e == null ? void 0 : e.renderBefore) ?? null;
s._$litPart$ = i = new k(t.insertBefore(C(), o), o, void 0, e ?? {});
}
return i._$AI(r), i;
};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
class w extends A {
constructor() {
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
}
createRenderRoot() {
var e;
const t = super.createRenderRoot();
return (e = this.renderOptions).renderBefore ?? (e.renderBefore = t.firstChild), t;
}
update(t) {
const e = this.render();
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Tt(e, this.renderRoot, this.renderOptions);
}
connectedCallback() {
var t;
super.connectedCallback(), (t = this._$Do) == null || t.setConnected(!0);
}
disconnectedCallback() {
var t;
super.disconnectedCallback(), (t = this._$Do) == null || t.setConnected(!1);
}
render() {
return y;
}
}
var et;
w._$litElement$ = !0, w.finalized = !0, (et = globalThis.litElementHydrateSupport) == null || et.call(globalThis, { LitElement: w });
const B = globalThis.litElementPolyfillSupport;
B == null || B({ LitElement: w });
(globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.0.6");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const kt = { attribute: !0, type: String, converter: H, reflect: !1, hasChanged: V }, Ot = (r = kt, t, e) => {
const { kind: s, metadata: i } = e;
let o = globalThis.litPropertyMetadata.get(i);
if (o === void 0 && globalThis.litPropertyMetadata.set(i, o = /* @__PURE__ */ new Map()), o.set(e.name, r), s === "accessor") {
const { name: n } = e;
return { set(l) {
const a = t.get.call(this);
t.set.call(this, l), this.requestUpdate(n, a, r);
}, init(l) {
return l !== void 0 && this.P(n, void 0, r), l;
} };
}
if (s === "setter") {
const { name: n } = e;
return function(l) {
const a = this[n];
t.call(this, l), this.requestUpdate(n, a, r);
};
}
throw Error("Unsupported decorator location: " + s);
};
function ht(r) {
return (t, e) => typeof e == "object" ? Ot(r, t, e) : ((s, i, o) => {
const n = i.hasOwnProperty(o);
return i.constructor.createProperty(o, n ? { ...s, wrapped: !0 } : s), n ? Object.getOwnPropertyDescriptor(i, o) : void 0;
})(r, t, e);
}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const Rt = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, Ht = (r) => (...t) => ({ _$litDirective$: r, values: t });
class Mt {
constructor(t) {
}
get _$AU() {
return this._$AM._$AU;
}
_$AT(t, e, s) {
this._$Ct = t, this._$AM = e, this._$Ci = s;
}
_$AS(t, e) {
return this.update(t, e);
}
update(t, e) {
return this.render(...e);
}
}
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const Nt = Ht(class extends Mt {
constructor(r) {
var t;
if (super(r), r.type !== Rt.ATTRIBUTE || r.name !== "class" || ((t = r.strings) == null ? void 0 : t.length) > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.");
}
render(r) {
return " " + Object.keys(r).filter((t) => r[t]).join(" ") + " ";
}
update(r, [t]) {
var s, i;
if (this.st === void 0) {
this.st = /* @__PURE__ */ new Set(), r.strings !== void 0 && (this.nt = new Set(r.strings.join(" ").split(/\s/).filter((o) => o !== "")));
for (const o in t) t[o] && !((s = this.nt) != null && s.has(o)) && this.st.add(o);
return this.render(t);
}
const e = r.element.classList;
for (const o of this.st) o in t || (e.remove(o), this.st.delete(o));
for (const o in t) {
const n = !!t[o];
n === this.st.has(o) || (i = this.nt) != null && i.has(o) || (n ? (e.add(o), this.st.add(o)) : (e.remove(o), this.st.delete(o)));
}
return y;
}
}), Lt = it`
:host {
box-sizing: border-box;
font-family: var(--rv-font-family);
}
:host *,
:host *::before,
:host *::after {
box-sizing: inherit;
}
[hidden] {
display: none !important;
}
`, jt = it`
${Lt}
:host {
--header-spacing: var(--rv-spacing-large);
--body-spacing: var(--rv-spacing-large);
--footer-spacing: var(--rv-spacing-large);
--width: 31rem;
display: none;
}
:host([open]) {
display: contents;
}
.dialog__overlay {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: var(--rv-dialog-background-color-overlay);
}
.dialog {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.dialog--open .dialog__panel {
display: flex;
opacity: 1;
}
.dialog__panel {
display: flex;
flex-direction: column;
z-index: 2;
width: var(--width);
max-width: calc(100% - var(--rv-spacing-2x-large));
max-height: calc(100% - var(--rv-spacing-2x-large));
background-color: var(--rv-dialog-background-color);
border-radius: var(--rv-border-radius-large);
box-shadow: var(--rv-shadow-x-large);
}
.dialog__panel:focus {
outline: none;
}
.dialog__header {
flex: 0 0 auto;
display: flex;
background-color: var(--rv-dialog-background-color-header);
height: 44px;
font-size: 1.125rem; /* 18px */
line-height: 1.4;
border-radius: var(--rv-border-radius-large) var(--rv-border-radius-large) 0 0;
}
.dialog__header-actions {
flex-shrink: 0;
display: flex;
flex-wrap: wrap;
justify-content: end;
gap: var(--rv-spacing-2x-small);
}
.dialog__title {
flex: 1 1 auto;
margin: 0;
font-weight: 600;
text-overflow: ellipsis;
padding: 0.75rem;
}
.dialog__close {
background-color: transparent;
border: none;
border-radius: var(--rv-border-radius-circle);
width: 36px;
height: 36px;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: background-color 0.3s;
margin: 0.25rem;
}
.dialog__close:hover {
background-color: hsl(0 0% 80% / 50%);
}
.dialog__content {
flex: 1 1 auto;
display: block;
min-height: 250px;
padding: var(--body-spacing);
overflow: auto;
-webkit-overflow-scrolling: touch;
}
.dialog__footer {
flex: 0 0 auto;
height: 64px;
text-align: right;
background-color: var(--rv-dialog-background-color-footer);
padding: var(--rv-spacing-small);
border-radius: 0 0 var(--rv-border-radius-large) var(--rv-border-radius-large);
box-shadow: 0 -4px 8px -1px rgba(0, 0, 0, 0.1);
}
.rv-button {
background-color: var(--rv-button-background-color);
border: none;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px; /* Adjust font size as needed */
cursor: pointer;
border-radius: 20px;
transition: background-color 0.3s, box-shadow 0.3s; /* Smooth transition for hover effects */
}
.rv-button:hover {
background-color: var(--rv-button-background-color-hover);
}
`;
var zt = Object.defineProperty, ct = (r, t, e, s) => {
for (var i = void 0, o = r.length - 1, n; o >= 0; o--)
(n = r[o]) && (i = n(t, e, i) || i);
return i && zt(t, e, i), i;
};
const W = class W extends w {
constructor() {
super(...arguments), this.title = "", this.open = !1;
}
/**
* Shows the dialog.
* @returns {Promise<any>} Promise that resolves when the dialog is closed. The resolved value is the source of the close action.
*/
show() {
return this.open = !0, new Promise((t) => {
this._closeResolver = t;
});
}
/**
* Hides the dialog.
* @param {any | "close-button" | "overlay"} source The source of the close action. This can be a string or an object. The resolved value of the promise returned by `show()` will be this value.
* @returns {void}
*/
close(t) {
this._closeResolver && (this._closeResolver(t), this._closeResolver = void 0), this.open = !1;
}
//todo: hide header
//todo: hide close button
//todo: hide footer
render() {
return xt`
<div id="dialog" class="${Nt({
dialog: !0,
"dialog--open": this.open
})}">
<div part="overlay" class="dialog__overlay" @click="${() => this.close("overlay")}" tabindex="-1"></div>
<div part="panel" class="dialog__panel" role="dialog"
aria-modal="true"
aria-hidden=${this.open ? "false" : "true"}
tabindex="-1">
<header part="header" class="dialog__header">
<div part="title" class="dialog__title"> ${this.title.length > 0 ? this.title : "\uFEFF"} </div>
<div part="header-actions" class="dialog__header-actions">
<slot name="header-actions"></slot>
<div part="close-button" class="dialog__close" @click="${() => this.close("close-button")}">
<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 16 16" fill="currentColor" >
<path d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z"/>
</svg>
</div>
</div>
</header>
<slot part="content" class="dialog__content"></slot>
<footer part="footer" class="dialog__footer">
<slot name="footer">
<button class="rv-button" @click="${() => this.close("close-button")}">Ok</button>
</slot>
</footer>
</div>
</div>
`;
}
};
W.styles = jt;
let T = W;
ct([
ht()
], T.prototype, "title");
ct([
ht({ type: Boolean, reflect: !0 })
], T.prototype, "open");
customElements.get("rv-dialog") || customElements.define("rv-dialog", T);
export {
T as RvDialog
};