/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const K = globalThis, se = K.ShadowRoot && (K.ShadyCSS === void 0 || K.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ie = Symbol(), ae = /* @__PURE__ */ new WeakMap(); let ye = class { constructor(e, t, i) { if (this._$cssResult$ = !0, i !== ie) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); this.cssText = e, this.t = t; } get styleSheet() { let e = this.o; const t = this.t; if (se && e === void 0) { const i = t !== void 0 && t.length === 1; i && (e = ae.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), i && ae.set(t, e)); } return e; } toString() { return this.cssText; } }; const Ae = (s) => new ye(typeof s == "string" ? s : s + "", void 0, ie), q = (s, ...e) => { const t = s.length === 1 ? s[0] : e.reduce((i, o, n) => i + ((r) => { if (r._$cssResult$ === !0) return r.cssText; if (typeof r == "number") return r; throw Error("Value passed to 'css' function must be a 'css' function result: " + r + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security."); })(o) + s[n + 1], s[0]); return new ye(t, s, ie); }, ke = (s, e) => { if (se) s.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet); else for (const t of e) { const i = document.createElement("style"), o = K.litNonce; o !== void 0 && i.setAttribute("nonce", o), i.textContent = t.cssText, s.appendChild(i); } }, le = se ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((e) => { let t = ""; for (const i of e.cssRules) t += i.cssText; return Ae(t); })(s) : s; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const { is: Se, defineProperty: Pe, getOwnPropertyDescriptor: Ce, getOwnPropertyNames: Ee, getOwnPropertySymbols: Ue, getPrototypeOf: Oe } = Object, A = globalThis, ce = A.trustedTypes, ze = ce ? ce.emptyScript : "", X = A.reactiveElementPolyfillSupport, j = (s, e) => s, J = { toAttribute(s, e) { switch (e) { case Boolean: s = s ? ze : null; break; case Object: case Array: s = s == null ? s : JSON.stringify(s); } return s; }, fromAttribute(s, e) { let t = s; switch (e) { case Boolean: t = s !== null; break; case Number: t = s === null ? null : Number(s); break; case Object: case Array: try { t = JSON.parse(s); } catch { t = null; } } return t; } }, oe = (s, e) => !Se(s, e), de = { attribute: !0, type: String, converter: J, reflect: !1, useDefault: !1, hasChanged: oe }; Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), A.litPropertyMetadata ?? (A.litPropertyMetadata = /* @__PURE__ */ new WeakMap()); let D = class extends HTMLElement { static addInitializer(e) { this._$Ei(), (this.l ?? (this.l = [])).push(e); } static get observedAttributes() { return this.finalize(), this._$Eh && [...this._$Eh.keys()]; } static createProperty(e, t = de) { if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) { const i = Symbol(), o = this.getPropertyDescriptor(e, i, t); o !== void 0 && Pe(this.prototype, e, o); } } static getPropertyDescriptor(e, t, i) { const { get: o, set: n } = Ce(this.prototype, e) ?? { get() { return this[t]; }, set(r) { this[t] = r; } }; return { get: o, set(r) { const l = o == null ? void 0 : o.call(this); n == null || n.call(this, r), this.requestUpdate(e, l, i); }, configurable: !0, enumerable: !0 }; } static getPropertyOptions(e) { return this.elementProperties.get(e) ?? de; } static _$Ei() { if (this.hasOwnProperty(j("elementProperties"))) return; const e = Oe(this); e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties); } static finalize() { if (this.hasOwnProperty(j("finalized"))) return; if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(j("properties"))) { const t = this.properties, i = [...Ee(t), ...Ue(t)]; for (const o of i) this.createProperty(o, t[o]); } const e = this[Symbol.metadata]; if (e !== null) { const t = litPropertyMetadata.get(e); if (t !== void 0) for (const [i, o] of t) this.elementProperties.set(i, o); } this._$Eh = /* @__PURE__ */ new Map(); for (const [t, i] of this.elementProperties) { const o = this._$Eu(t, i); o !== void 0 && this._$Eh.set(o, t); } this.elementStyles = this.finalizeStyles(this.styles); } static finalizeStyles(e) { const t = []; if (Array.isArray(e)) { const i = new Set(e.flat(1 / 0).reverse()); for (const o of i) t.unshift(le(o)); } else e !== void 0 && t.push(le(e)); return t; } static _$Eu(e, t) { const i = t.attribute; return i === !1 ? void 0 : typeof i == "string" ? i : typeof e == "string" ? e.toLowerCase() : void 0; } constructor() { super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev(); } _$Ev() { var e; this._$ES = new Promise((t) => this.enableUpdating = t), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (e = this.constructor.l) == null || e.forEach((t) => t(this)); } addController(e) { var t; (this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(e), this.renderRoot !== void 0 && this.isConnected && ((t = e.hostConnected) == null || t.call(e)); } removeController(e) { var t; (t = this._$EO) == null || t.delete(e); } _$E_() { const e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties; for (const i of t.keys()) this.hasOwnProperty(i) && (e.set(i, this[i]), delete this[i]); e.size > 0 && (this._$Ep = e); } createRenderRoot() { const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions); return ke(e, this.constructor.elementStyles), e; } connectedCallback() { var e; this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (e = this._$EO) == null || e.forEach((t) => { var i; return (i = t.hostConnected) == null ? void 0 : i.call(t); }); } enableUpdating(e) { } disconnectedCallback() { var e; (e = this._$EO) == null || e.forEach((t) => { var i; return (i = t.hostDisconnected) == null ? void 0 : i.call(t); }); } attributeChangedCallback(e, t, i) { this._$AK(e, i); } _$ET(e, t) { var n; const i = this.constructor.elementProperties.get(e), o = this.constructor._$Eu(e, i); if (o !== void 0 && i.reflect === !0) { const r = (((n = i.converter) == null ? void 0 : n.toAttribute) !== void 0 ? i.converter : J).toAttribute(t, i.type); this._$Em = e, r == null ? this.removeAttribute(o) : this.setAttribute(o, r), this._$Em = null; } } _$AK(e, t) { var n, r; const i = this.constructor, o = i._$Eh.get(e); if (o !== void 0 && this._$Em !== o) { const l = i.getPropertyOptions(o), a = typeof l.converter == "function" ? { fromAttribute: l.converter } : ((n = l.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? l.converter : J; this._$Em = o; const p = a.fromAttribute(t, l.type); this[o] = p ?? ((r = this._$Ej) == null ? void 0 : r.get(o)) ?? p, this._$Em = null; } } requestUpdate(e, t, i, o = !1, n) { var r; if (e !== void 0) { const l = this.constructor; if (o === !1 && (n = this[e]), i ?? (i = l.getPropertyOptions(e)), !((i.hasChanged ?? oe)(n, t) || i.useDefault && i.reflect && n === ((r = this._$Ej) == null ? void 0 : r.get(e)) && !this.hasAttribute(l._$Eu(e, i)))) return; this.C(e, t, i); } this.isUpdatePending === !1 && (this._$ES = this._$EP()); } C(e, t, { useDefault: i, reflect: o, wrapped: n }, r) { i && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(e) && (this._$Ej.set(e, r ?? t ?? this[e]), n !== !0 || r !== void 0) || (this._$AL.has(e) || (this.hasUpdated || i || (t = void 0), this._$AL.set(e, t)), o === !0 && this._$Em !== e && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(e)); } async _$EP() { this.isUpdatePending = !0; try { await this._$ES; } catch (t) { Promise.reject(t); } const e = this.scheduleUpdate(); return e != null && await e, !this.isUpdatePending; } scheduleUpdate() { return this.performUpdate(); } performUpdate() { var i; if (!this.isUpdatePending) return; if (!this.hasUpdated) { if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) { for (const [n, r] of this._$Ep) this[n] = r; this._$Ep = void 0; } const o = this.constructor.elementProperties; if (o.size > 0) for (const [n, r] of o) { const { wrapped: l } = r, a = this[n]; l !== !0 || this._$AL.has(n) || a === void 0 || this.C(n, void 0, r, a); } } let e = !1; const t = this._$AL; try { e = this.shouldUpdate(t), e ? (this.willUpdate(t), (i = this._$EO) == null || i.forEach((o) => { var n; return (n = o.hostUpdate) == null ? void 0 : n.call(o); }), this.update(t)) : this._$EM(); } catch (o) { throw e = !1, this._$EM(), o; } e && this._$AE(t); } willUpdate(e) { } _$AE(e) { var t; (t = this._$EO) == null || t.forEach((i) => { var o; return (o = i.hostUpdated) == null ? void 0 : o.call(i); }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e); } _$EM() { this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1; } get updateComplete() { return this.getUpdateComplete(); } getUpdateComplete() { return this._$ES; } shouldUpdate(e) { return !0; } update(e) { this._$Eq && (this._$Eq = this._$Eq.forEach((t) => this._$ET(t, this[t]))), this._$EM(); } updated(e) { } firstUpdated(e) { } }; D.elementStyles = [], D.shadowRootOptions = { mode: "open" }, D[j("elementProperties")] = /* @__PURE__ */ new Map(), D[j("finalized")] = /* @__PURE__ */ new Map(), X == null || X({ ReactiveElement: D }), (A.reactiveElementVersions ?? (A.reactiveElementVersions = [])).push("2.1.2"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const N = globalThis, he = (s) => s, Z = N.trustedTypes, pe = Z ? Z.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, ve = "$lit$", x = `lit$${Math.random().toFixed(9).slice(2)}$`, we = "?" + x, De = `<${we}>`, U = document, I = () => U.createComment(""), L = (s) => s === null || typeof s != "object" && typeof s != "function", re = Array.isArray, Te = (s) => re(s) || typeof (s == null ? void 0 : s[Symbol.iterator]) == "function", Y = `[ \f\r]`, H = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ue = /-->/g, me = />/g, P = RegExp(`>|${Y}(?:([^\\s"'>=/]+)(${Y}*=${Y}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`, "g"), fe = /'/g, ge = /"/g, _e = /^(?:script|style|textarea|title)$/i, Me = (s) => (e, ...t) => ({ _$litType$: s, strings: e, values: t }), c = Me(1), T = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), be = /* @__PURE__ */ new WeakMap(), C = U.createTreeWalker(U, 129); function xe(s, e) { if (!re(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array"); return pe !== void 0 ? pe.createHTML(e) : e; } const Re = (s, e) => { const t = s.length - 1, i = []; let o, n = e === 2 ? "" : e === 3 ? "" : "")), i]; }; class W { constructor({ strings: e, _$litType$: t }, i) { let o; this.parts = []; let n = 0, r = 0; const l = e.length - 1, a = this.parts, [p, m] = Re(e, t); if (this.el = W.createElement(p, i), C.currentNode = this.el.content, t === 2 || t === 3) { const h = this.el.content.firstChild; h.replaceWith(...h.childNodes); } for (; (o = C.nextNode()) !== null && a.length < l; ) { if (o.nodeType === 1) { if (o.hasAttributes()) for (const h of o.getAttributeNames()) if (h.endsWith(ve)) { const $ = m[r++], _ = o.getAttribute(h).split(x), V = /([.?@])?(.*)/.exec($); a.push({ type: 1, index: n, name: V[2], strings: _, ctor: V[1] === "." ? je : V[1] === "?" ? Ne : V[1] === "@" ? Ie : G }), o.removeAttribute(h); } else h.startsWith(x) && (a.push({ type: 6, index: n }), o.removeAttribute(h)); if (_e.test(o.tagName)) { const h = o.textContent.split(x), $ = h.length - 1; if ($ > 0) { o.textContent = Z ? Z.emptyScript : ""; for (let _ = 0; _ < $; _++) o.append(h[_], I()), C.nextNode(), a.push({ type: 2, index: ++n }); o.append(h[$], I()); } } } else if (o.nodeType === 8) if (o.data === we) a.push({ type: 2, index: n }); else { let h = -1; for (; (h = o.data.indexOf(x, h + 1)) !== -1; ) a.push({ type: 7, index: n }), h += x.length - 1; } n++; } } static createElement(e, t) { const i = U.createElement("template"); return i.innerHTML = e, i; } } function M(s, e, t = s, i) { var r, l; if (e === T) return e; let o = i !== void 0 ? (r = t._$Co) == null ? void 0 : r[i] : t._$Cl; const n = L(e) ? void 0 : e._$litDirective$; return (o == null ? void 0 : o.constructor) !== n && ((l = o == null ? void 0 : o._$AO) == null || l.call(o, !1), n === void 0 ? o = void 0 : (o = new n(s), o._$AT(s, t, i)), i !== void 0 ? (t._$Co ?? (t._$Co = []))[i] = o : t._$Cl = o), o !== void 0 && (e = M(s, o._$AS(s, e.values), o, i)), e; } class He { constructor(e, t) { this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t; } get parentNode() { return this._$AM.parentNode; } get _$AU() { return this._$AM._$AU; } u(e) { const { el: { content: t }, parts: i } = this._$AD, o = ((e == null ? void 0 : e.creationScope) ?? U).importNode(t, !0); C.currentNode = o; let n = C.nextNode(), r = 0, l = 0, a = i[0]; for (; a !== void 0; ) { if (r === a.index) { let p; a.type === 2 ? p = new B(n, n.nextSibling, this, e) : a.type === 1 ? p = new a.ctor(n, a.name, a.strings, this, e) : a.type === 6 && (p = new Le(n, this, e)), this._$AV.push(p), a = i[++l]; } r !== (a == null ? void 0 : a.index) && (n = C.nextNode(), r++); } return C.currentNode = U, o; } p(e) { let t = 0; for (const i of this._$AV) i !== void 0 && (i.strings !== void 0 ? (i._$AI(e, i, t), t += i.strings.length - 2) : i._$AI(e[t])), t++; } } class B { get _$AU() { var e; return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this._$Cv; } constructor(e, t, i, o) { this.type = 2, this._$AH = d, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = i, this.options = o, this._$Cv = (o == null ? void 0 : o.isConnected) ?? !0; } get parentNode() { let e = this._$AA.parentNode; const t = this._$AM; return t !== void 0 && (e == null ? void 0 : e.nodeType) === 11 && (e = t.parentNode), e; } get startNode() { return this._$AA; } get endNode() { return this._$AB; } _$AI(e, t = this) { e = M(this, e, t), L(e) ? e === d || e == null || e === "" ? (this._$AH !== d && this._$AR(), this._$AH = d) : e !== this._$AH && e !== T && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Te(e) ? this.k(e) : this._(e); } O(e) { return this._$AA.parentNode.insertBefore(e, this._$AB); } T(e) { this._$AH !== e && (this._$AR(), this._$AH = this.O(e)); } _(e) { this._$AH !== d && L(this._$AH) ? this._$AA.nextSibling.data = e : this.T(U.createTextNode(e)), this._$AH = e; } $(e) { var n; const { values: t, _$litType$: i } = e, o = typeof i == "number" ? this._$AC(e) : (i.el === void 0 && (i.el = W.createElement(xe(i.h, i.h[0]), this.options)), i); if (((n = this._$AH) == null ? void 0 : n._$AD) === o) this._$AH.p(t); else { const r = new He(o, this), l = r.u(this.options); r.p(t), this.T(l), this._$AH = r; } } _$AC(e) { let t = be.get(e.strings); return t === void 0 && be.set(e.strings, t = new W(e)), t; } k(e) { re(this._$AH) || (this._$AH = [], this._$AR()); const t = this._$AH; let i, o = 0; for (const n of e) o === t.length ? t.push(i = new B(this.O(I()), this.O(I()), this, this.options)) : i = t[o], i._$AI(n), o++; o < t.length && (this._$AR(i && i._$AB.nextSibling, o), t.length = o); } _$AR(e = this._$AA.nextSibling, t) { var i; for ((i = this._$AP) == null ? void 0 : i.call(this, !1, !0, t); e !== this._$AB; ) { const o = he(e).nextSibling; he(e).remove(), e = o; } } setConnected(e) { var t; this._$AM === void 0 && (this._$Cv = e, (t = this._$AP) == null || t.call(this, e)); } } class G { get tagName() { return this.element.tagName; } get _$AU() { return this._$AM._$AU; } constructor(e, t, i, o, n) { this.type = 1, this._$AH = d, this._$AN = void 0, this.element = e, this.name = t, this._$AM = o, this.options = n, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = d; } _$AI(e, t = this, i, o) { const n = this.strings; let r = !1; if (n === void 0) e = M(this, e, t, 0), r = !L(e) || e !== this._$AH && e !== T, r && (this._$AH = e); else { const l = e; let a, p; for (e = n[0], a = 0; a < n.length - 1; a++) p = M(this, l[i + a], t, a), p === T && (p = this._$AH[a]), r || (r = !L(p) || p !== this._$AH[a]), p === d ? e = d : e !== d && (e += (p ?? "") + n[a + 1]), this._$AH[a] = p; } r && !o && this.j(e); } j(e) { e === d ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? ""); } } class je extends G { constructor() { super(...arguments), this.type = 3; } j(e) { this.element[this.name] = e === d ? void 0 : e; } } class Ne extends G { constructor() { super(...arguments), this.type = 4; } j(e) { this.element.toggleAttribute(this.name, !!e && e !== d); } } class Ie extends G { constructor(e, t, i, o, n) { super(e, t, i, o, n), this.type = 5; } _$AI(e, t = this) { if ((e = M(this, e, t, 0) ?? d) === T) return; const i = this._$AH, o = e === d && i !== d || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, n = e !== d && (i === d || o); o && this.element.removeEventListener(this.name, this, i), n && this.element.addEventListener(this.name, this, e), this._$AH = e; } handleEvent(e) { var t; typeof this._$AH == "function" ? this._$AH.call(((t = this.options) == null ? void 0 : t.host) ?? this.element, e) : this._$AH.handleEvent(e); } } class Le { constructor(e, t, i) { this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = i; } get _$AU() { return this._$AM._$AU; } _$AI(e) { M(this, e); } } const ee = N.litHtmlPolyfillSupport; ee == null || ee(W, B), (N.litHtmlVersions ?? (N.litHtmlVersions = [])).push("3.3.2"); const We = (s, e, t) => { const i = (t == null ? void 0 : t.renderBefore) ?? e; let o = i._$litPart$; if (o === void 0) { const n = (t == null ? void 0 : t.renderBefore) ?? null; i._$litPart$ = o = new B(e.insertBefore(I(), n), n, void 0, t ?? {}); } return o._$AI(s), o; }; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const E = globalThis; class y extends D { constructor() { super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0; } createRenderRoot() { var t; const e = super.createRenderRoot(); return (t = this.renderOptions).renderBefore ?? (t.renderBefore = e.firstChild), e; } update(e) { const t = this.render(); this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = We(t, this.renderRoot, this.renderOptions); } connectedCallback() { var e; super.connectedCallback(), (e = this._$Do) == null || e.setConnected(!0); } disconnectedCallback() { var e; super.disconnectedCallback(), (e = this._$Do) == null || e.setConnected(!1); } render() { return T; } } var $e; y._$litElement$ = !0, y.finalized = !0, ($e = E.litElementHydrateSupport) == null || $e.call(E, { LitElement: y }); const te = E.litElementPolyfillSupport; te == null || te({ LitElement: y }); (E.litElementVersions ?? (E.litElementVersions = [])).push("4.2.2"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const F = (s) => (e, t) => { t !== void 0 ? t.addInitializer(() => { customElements.define(s, e); }) : customElements.define(s, e); }; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const qe = { attribute: !0, type: String, converter: J, reflect: !1, hasChanged: oe }, Be = (s = qe, e, t) => { const { kind: i, metadata: o } = t; let n = globalThis.litPropertyMetadata.get(o); if (n === void 0 && globalThis.litPropertyMetadata.set(o, n = /* @__PURE__ */ new Map()), i === "setter" && ((s = Object.create(s)).wrapped = !0), n.set(t.name, s), i === "accessor") { const { name: r } = t; return { set(l) { const a = e.get.call(this); e.set.call(this, l), this.requestUpdate(r, a, s, !0, l); }, init(l) { return l !== void 0 && this.C(r, void 0, s, l), l; } }; } if (i === "setter") { const { name: r } = t; return function(l) { const a = this[r]; e.call(this, l), this.requestUpdate(r, a, s, !0, l); }; } throw Error("Unsupported decorator location: " + i); }; function f(s) { return (e, t) => typeof t == "object" ? Be(s, e, t) : ((i, o, n) => { const r = o.hasOwnProperty(n); return o.constructor.createProperty(n, i), r ? Object.getOwnPropertyDescriptor(o, n) : void 0; })(s, e, t); } /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ function u(s) { return f({ ...s, state: !0, attribute: !1 }); } function ne(s, e) { const t = new WebSocket(s); return t.onmessage = (i) => { var o, n, r, l; try { const a = JSON.parse(i.data); ((n = (o = a.type) == null ? void 0 : o.startsWith) != null && n.call(o, "process.") || (l = (r = a.channel) == null ? void 0 : r.startsWith) != null && l.call(r, "process.")) && e(a); } catch { } }, t; } class Fe { constructor(e = "") { this.baseUrl = e; } get base() { return `${this.baseUrl}/api/process`; } async request(e, t) { var n; const o = await (await fetch(`${this.base}${e}`, t)).json(); if (!o.success) throw new Error(((n = o.error) == null ? void 0 : n.message) ?? "Request failed"); return o.data; } /** List all alive daemons from the registry. */ listDaemons() { return this.request("/daemons"); } /** Get a single daemon entry by code and daemon name. */ getDaemon(e, t) { return this.request(`/daemons/${e}/${t}`); } /** Stop a daemon (SIGTERM + unregister). */ stopDaemon(e, t) { return this.request(`/daemons/${e}/${t}/stop`, { method: "POST" }); } /** Check daemon health endpoint. */ healthCheck(e, t) { return this.request(`/daemons/${e}/${t}/health`); } } var Ve = Object.defineProperty, Ke = Object.getOwnPropertyDescriptor, k = (s, e, t, i) => { for (var o = i > 1 ? void 0 : i ? Ke(e, t) : e, n = s.length - 1, r; n >= 0; n--) (r = s[n]) && (o = (i ? r(e, t, o) : r(o)) || o); return i && o && Ve(e, t, o), o; }; let g = class extends y { constructor() { super(...arguments), this.apiUrl = "", this.daemons = [], this.loading = !0, this.error = "", this.stopping = /* @__PURE__ */ new Set(), this.checking = /* @__PURE__ */ new Set(), this.healthResults = /* @__PURE__ */ new Map(); } connectedCallback() { super.connectedCallback(), this.api = new Fe(this.apiUrl), this.loadDaemons(); } async loadDaemons() { this.loading = !0, this.error = ""; try { this.daemons = await this.api.listDaemons(); } catch (s) { this.error = s.message ?? "Failed to load daemons"; } finally { this.loading = !1; } } daemonKey(s) { return `${s.code}/${s.daemon}`; } async handleStop(s) { const e = this.daemonKey(s); this.stopping = /* @__PURE__ */ new Set([...this.stopping, e]); try { await this.api.stopDaemon(s.code, s.daemon), this.dispatchEvent( new CustomEvent("daemon-stopped", { detail: { code: s.code, daemon: s.daemon }, bubbles: !0 }) ), await this.loadDaemons(); } catch (t) { this.error = t.message ?? "Failed to stop daemon"; } finally { const t = new Set(this.stopping); t.delete(e), this.stopping = t; } } async handleHealthCheck(s) { const e = this.daemonKey(s); this.checking = /* @__PURE__ */ new Set([...this.checking, e]); try { const t = await this.api.healthCheck(s.code, s.daemon), i = new Map(this.healthResults); i.set(e, t), this.healthResults = i; } catch (t) { this.error = t.message ?? "Health check failed"; } finally { const t = new Set(this.checking); t.delete(e), this.checking = t; } } formatDate(s) { try { return new Date(s).toLocaleDateString("en-GB", { day: "numeric", month: "short", year: "numeric", hour: "2-digit", minute: "2-digit" }); } catch { return s; } } renderHealthBadge(s) { const e = this.daemonKey(s); if (this.checking.has(e)) return c`Checking\u2026`; const t = this.healthResults.get(e); return t ? c` ${t.healthy ? "Healthy" : "Unhealthy"} ` : s.health ? c`Unchecked` : c`No health endpoint`; } render() { return this.loading ? c`
result property, or results will appear here once the REST
API for pipeline execution is available.