From cfb36525abc984a987e4f33ca24113a388eb37a2 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 18 Dec 2025 10:44:50 +0100 Subject: [PATCH] Android: add canvas.a2ui push/reset --- .../main/assets/canvas_a2ui/a2ui.bundle.js | 18021 ++++++++++++++++ .../src/main/assets/canvas_a2ui/index.html | 23 + .../com/steipete/clawdis/node/NodeRuntime.kt | 161 +- .../clawdis/node/node/CanvasController.kt | 63 +- .../node/protocol/ClawdisProtocolConstants.kt | 11 + .../protocol/ClawdisProtocolConstantsTest.kt | 7 + docs/android/connect.md | 3 +- 7 files changed, 18248 insertions(+), 41 deletions(-) create mode 100644 apps/android/app/src/main/assets/canvas_a2ui/a2ui.bundle.js create mode 100644 apps/android/app/src/main/assets/canvas_a2ui/index.html diff --git a/apps/android/app/src/main/assets/canvas_a2ui/a2ui.bundle.js b/apps/android/app/src/main/assets/canvas_a2ui/a2ui.bundle.js new file mode 100644 index 000000000..43a94d58e --- /dev/null +++ b/apps/android/app/src/main/assets/canvas_a2ui/a2ui.bundle.js @@ -0,0 +1,18021 @@ +//#region rolldown:runtime +var __defProp$1 = Object.defineProperty; +var __export = (all, symbols) => { + let target = {}; + for (var name in all) { + __defProp$1(target, name, { + get: all[name], + enumerable: true + }); + } + if (symbols) { + __defProp$1(target, Symbol.toStringTag, { value: "Module" }); + } + return target; +}; + +//#endregion +//#region node_modules/@lit/reactive-element/css-tag.js +/** +* @license +* Copyright 2019 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ +const t$6 = globalThis, e$12 = t$6.ShadowRoot && (void 0 === t$6.ShadyCSS || t$6.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$8 = Symbol(), o$13 = new WeakMap(); +var n$9 = class { + constructor(t$7, e$14, o$14) { + if (this._$cssResult$ = !0, o$14 !== s$8) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); + this.cssText = t$7, this.t = e$14; + } + get styleSheet() { + let t$7 = this.o; + const s$9 = this.t; + if (e$12 && void 0 === t$7) { + const e$14 = void 0 !== s$9 && 1 === s$9.length; + e$14 && (t$7 = o$13.get(s$9)), void 0 === t$7 && ((this.o = t$7 = new CSSStyleSheet()).replaceSync(this.cssText), e$14 && o$13.set(s$9, t$7)); + } + return t$7; + } + toString() { + return this.cssText; + } +}; +const r$1 = (t$7) => new n$9("string" == typeof t$7 ? t$7 : t$7 + "", void 0, s$8), i = (t$7, ...e$14) => { + const o$14 = 1 === t$7.length ? t$7[0] : e$14.reduce(((e$15, s$9, o$15) => e$15 + ((t$8) => { + if (!0 === t$8._$cssResult$) return t$8.cssText; + if ("number" == typeof t$8) return t$8; + throw Error("Value passed to 'css' function must be a 'css' function result: " + t$8 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security."); + })(s$9) + t$7[o$15 + 1]), t$7[0]); + return new n$9(o$14, t$7, s$8); +}, S$1 = (s$9, o$14) => { + if (e$12) s$9.adoptedStyleSheets = o$14.map(((t$7) => t$7 instanceof CSSStyleSheet ? t$7 : t$7.styleSheet)); + else for (const e$14 of o$14) { + const o$15 = document.createElement("style"), n$11 = t$6.litNonce; + void 0 !== n$11 && o$15.setAttribute("nonce", n$11), o$15.textContent = e$14.cssText, s$9.appendChild(o$15); + } +}, c$5 = e$12 ? (t$7) => t$7 : (t$7) => t$7 instanceof CSSStyleSheet ? ((t$8) => { + let e$14 = ""; + for (const s$9 of t$8.cssRules) e$14 += s$9.cssText; + return r$1(e$14); +})(t$7) : t$7; + +//#endregion +//#region node_modules/@lit/reactive-element/reactive-element.js +/** +* @license +* Copyright 2017 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ const { is: i$9, defineProperty: e$13, getOwnPropertyDescriptor: h$6, getOwnPropertyNames: r$10, getOwnPropertySymbols: o$12, getPrototypeOf: n$10 } = Object, a$1 = globalThis, c$6 = a$1.trustedTypes, l$4 = c$6 ? c$6.emptyScript : "", p$2 = a$1.reactiveElementPolyfillSupport, d$2 = (t$7, s$9) => t$7, u = { + toAttribute(t$7, s$9) { + switch (s$9) { + case Boolean: + t$7 = t$7 ? l$4 : null; + break; + case Object: + case Array: t$7 = null == t$7 ? t$7 : JSON.stringify(t$7); + } + return t$7; + }, + fromAttribute(t$7, s$9) { + let i$10 = t$7; + switch (s$9) { + case Boolean: + i$10 = null !== t$7; + break; + case Number: + i$10 = null === t$7 ? null : Number(t$7); + break; + case Object: + case Array: try { + i$10 = JSON.parse(t$7); + } catch (t$8) { + i$10 = null; + } + } + return i$10; + } +}, f$2 = (t$7, s$9) => !i$9(t$7, s$9), b$1 = { + attribute: !0, + type: String, + converter: u, + reflect: !1, + useDefault: !1, + hasChanged: f$2 +}; +Symbol.metadata ??= Symbol("metadata"), a$1.litPropertyMetadata ??= new WeakMap(); +var y = class extends HTMLElement { + static addInitializer(t$7) { + this._$Ei(), (this.l ??= []).push(t$7); + } + static get observedAttributes() { + return this.finalize(), this._$Eh && [...this._$Eh.keys()]; + } + static createProperty(t$7, s$9 = b$1) { + if (s$9.state && (s$9.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t$7) && ((s$9 = Object.create(s$9)).wrapped = !0), this.elementProperties.set(t$7, s$9), !s$9.noAccessor) { + const i$10 = Symbol(), h$7 = this.getPropertyDescriptor(t$7, i$10, s$9); + void 0 !== h$7 && e$13(this.prototype, t$7, h$7); + } + } + static getPropertyDescriptor(t$7, s$9, i$10) { + const { get: e$14, set: r$11 } = h$6(this.prototype, t$7) ?? { + get() { + return this[s$9]; + }, + set(t$8) { + this[s$9] = t$8; + } + }; + return { + get: e$14, + set(s$10) { + const h$7 = e$14?.call(this); + r$11?.call(this, s$10), this.requestUpdate(t$7, h$7, i$10); + }, + configurable: !0, + enumerable: !0 + }; + } + static getPropertyOptions(t$7) { + return this.elementProperties.get(t$7) ?? b$1; + } + static _$Ei() { + if (this.hasOwnProperty(d$2("elementProperties"))) return; + const t$7 = n$10(this); + t$7.finalize(), void 0 !== t$7.l && (this.l = [...t$7.l]), this.elementProperties = new Map(t$7.elementProperties); + } + static finalize() { + if (this.hasOwnProperty(d$2("finalized"))) return; + if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(d$2("properties"))) { + const t$8 = this.properties, s$9 = [...r$10(t$8), ...o$12(t$8)]; + for (const i$10 of s$9) this.createProperty(i$10, t$8[i$10]); + } + const t$7 = this[Symbol.metadata]; + if (null !== t$7) { + const s$9 = litPropertyMetadata.get(t$7); + if (void 0 !== s$9) for (const [t$8, i$10] of s$9) this.elementProperties.set(t$8, i$10); + } + this._$Eh = new Map(); + for (const [t$8, s$9] of this.elementProperties) { + const i$10 = this._$Eu(t$8, s$9); + void 0 !== i$10 && this._$Eh.set(i$10, t$8); + } + this.elementStyles = this.finalizeStyles(this.styles); + } + static finalizeStyles(s$9) { + const i$10 = []; + if (Array.isArray(s$9)) { + const e$14 = new Set(s$9.flat(1 / 0).reverse()); + for (const s$10 of e$14) i$10.unshift(c$5(s$10)); + } else void 0 !== s$9 && i$10.push(c$5(s$9)); + return i$10; + } + static _$Eu(t$7, s$9) { + const i$10 = s$9.attribute; + return !1 === i$10 ? void 0 : "string" == typeof i$10 ? i$10 : "string" == typeof t$7 ? t$7.toLowerCase() : void 0; + } + constructor() { + super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev(); + } + _$Ev() { + this._$ES = new Promise(((t$7) => this.enableUpdating = t$7)), this._$AL = new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((t$7) => t$7(this))); + } + addController(t$7) { + (this._$EO ??= new Set()).add(t$7), void 0 !== this.renderRoot && this.isConnected && t$7.hostConnected?.(); + } + removeController(t$7) { + this._$EO?.delete(t$7); + } + _$E_() { + const t$7 = new Map(), s$9 = this.constructor.elementProperties; + for (const i$10 of s$9.keys()) this.hasOwnProperty(i$10) && (t$7.set(i$10, this[i$10]), delete this[i$10]); + t$7.size > 0 && (this._$Ep = t$7); + } + createRenderRoot() { + const t$7 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions); + return S$1(t$7, this.constructor.elementStyles), t$7; + } + connectedCallback() { + this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((t$7) => t$7.hostConnected?.())); + } + enableUpdating(t$7) {} + disconnectedCallback() { + this._$EO?.forEach(((t$7) => t$7.hostDisconnected?.())); + } + attributeChangedCallback(t$7, s$9, i$10) { + this._$AK(t$7, i$10); + } + _$ET(t$7, s$9) { + const i$10 = this.constructor.elementProperties.get(t$7), e$14 = this.constructor._$Eu(t$7, i$10); + if (void 0 !== e$14 && !0 === i$10.reflect) { + const h$7 = (void 0 !== i$10.converter?.toAttribute ? i$10.converter : u).toAttribute(s$9, i$10.type); + this._$Em = t$7, null == h$7 ? this.removeAttribute(e$14) : this.setAttribute(e$14, h$7), this._$Em = null; + } + } + _$AK(t$7, s$9) { + const i$10 = this.constructor, e$14 = i$10._$Eh.get(t$7); + if (void 0 !== e$14 && this._$Em !== e$14) { + const t$8 = i$10.getPropertyOptions(e$14), h$7 = "function" == typeof t$8.converter ? { fromAttribute: t$8.converter } : void 0 !== t$8.converter?.fromAttribute ? t$8.converter : u; + this._$Em = e$14; + const r$11 = h$7.fromAttribute(s$9, t$8.type); + this[e$14] = r$11 ?? this._$Ej?.get(e$14) ?? r$11, this._$Em = null; + } + } + requestUpdate(t$7, s$9, i$10) { + if (void 0 !== t$7) { + const e$14 = this.constructor, h$7 = this[t$7]; + if (i$10 ??= e$14.getPropertyOptions(t$7), !((i$10.hasChanged ?? f$2)(h$7, s$9) || i$10.useDefault && i$10.reflect && h$7 === this._$Ej?.get(t$7) && !this.hasAttribute(e$14._$Eu(t$7, i$10)))) return; + this.C(t$7, s$9, i$10); + } + !1 === this.isUpdatePending && (this._$ES = this._$EP()); + } + C(t$7, s$9, { useDefault: i$10, reflect: e$14, wrapped: h$7 }, r$11) { + i$10 && !(this._$Ej ??= new Map()).has(t$7) && (this._$Ej.set(t$7, r$11 ?? s$9 ?? this[t$7]), !0 !== h$7 || void 0 !== r$11) || (this._$AL.has(t$7) || (this.hasUpdated || i$10 || (s$9 = void 0), this._$AL.set(t$7, s$9)), !0 === e$14 && this._$Em !== t$7 && (this._$Eq ??= new Set()).add(t$7)); + } + async _$EP() { + this.isUpdatePending = !0; + try { + await this._$ES; + } catch (t$8) { + Promise.reject(t$8); + } + const t$7 = this.scheduleUpdate(); + return null != t$7 && await t$7, !this.isUpdatePending; + } + scheduleUpdate() { + return this.performUpdate(); + } + performUpdate() { + if (!this.isUpdatePending) return; + if (!this.hasUpdated) { + if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) { + for (const [t$9, s$10] of this._$Ep) this[t$9] = s$10; + this._$Ep = void 0; + } + const t$8 = this.constructor.elementProperties; + if (t$8.size > 0) for (const [s$10, i$10] of t$8) { + const { wrapped: t$9 } = i$10, e$14 = this[s$10]; + !0 !== t$9 || this._$AL.has(s$10) || void 0 === e$14 || this.C(s$10, void 0, i$10, e$14); + } + } + let t$7 = !1; + const s$9 = this._$AL; + try { + t$7 = this.shouldUpdate(s$9), t$7 ? (this.willUpdate(s$9), this._$EO?.forEach(((t$8) => t$8.hostUpdate?.())), this.update(s$9)) : this._$EM(); + } catch (s$10) { + throw t$7 = !1, this._$EM(), s$10; + } + t$7 && this._$AE(s$9); + } + willUpdate(t$7) {} + _$AE(t$7) { + this._$EO?.forEach(((t$8) => t$8.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t$7)), this.updated(t$7); + } + _$EM() { + this._$AL = new Map(), this.isUpdatePending = !1; + } + get updateComplete() { + return this.getUpdateComplete(); + } + getUpdateComplete() { + return this._$ES; + } + shouldUpdate(t$7) { + return !0; + } + update(t$7) { + this._$Eq &&= this._$Eq.forEach(((t$8) => this._$ET(t$8, this[t$8]))), this._$EM(); + } + updated(t$7) {} + firstUpdated(t$7) {} +}; +y.elementStyles = [], y.shadowRootOptions = { mode: "open" }, y[d$2("elementProperties")] = new Map(), y[d$2("finalized")] = new Map(), p$2?.({ ReactiveElement: y }), (a$1.reactiveElementVersions ??= []).push("2.1.1"); + +//#endregion +//#region node_modules/lit-html/lit-html.js +/** +* @license +* Copyright 2017 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ +const t$5 = globalThis, i$8 = t$5.trustedTypes, s$7 = i$8 ? i$8.createPolicy("lit-html", { createHTML: (t$7) => t$7 }) : void 0, e$11 = "$lit$", h$5 = `lit$${Math.random().toFixed(9).slice(2)}$`, o$11 = "?" + h$5, n$8 = `<${o$11}>`, r$9 = document, l$3 = () => r$9.createComment(""), c$4 = (t$7) => null === t$7 || "object" != typeof t$7 && "function" != typeof t$7, a = Array.isArray, u$3 = (t$7) => a(t$7) || "function" == typeof t$7?.[Symbol.iterator], d$1 = "[ \n\f\r]", f$3 = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v$1 = /-->/g, _ = />/g, m$2 = RegExp(`>|${d$1}(?:([^\\s"'>=/]+)(${d$1}*=${d$1}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"), p$1 = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y$1 = (t$7) => (i$10, ...s$9) => ({ + _$litType$: t$7, + strings: i$10, + values: s$9 +}), x = y$1(1), b = y$1(2), w = y$1(3), T = Symbol.for("lit-noChange"), E = Symbol.for("lit-nothing"), A = new WeakMap(), C = r$9.createTreeWalker(r$9, 129); +function P(t$7, i$10) { + if (!a(t$7) || !t$7.hasOwnProperty("raw")) throw Error("invalid template strings array"); + return void 0 !== s$7 ? s$7.createHTML(i$10) : i$10; +} +const V = (t$7, i$10) => { + const s$9 = t$7.length - 1, o$14 = []; + let r$11, l$5 = 2 === i$10 ? "" : 3 === i$10 ? "" : "", c$7 = f$3; + for (let i$11 = 0; i$11 < s$9; i$11++) { + const s$10 = t$7[i$11]; + let a$2, u$4, d$3 = -1, y$2 = 0; + for (; y$2 < s$10.length && (c$7.lastIndex = y$2, u$4 = c$7.exec(s$10), null !== u$4);) y$2 = c$7.lastIndex, c$7 === f$3 ? "!--" === u$4[1] ? c$7 = v$1 : void 0 !== u$4[1] ? c$7 = _ : void 0 !== u$4[2] ? ($.test(u$4[2]) && (r$11 = RegExp("" === u$4[0] ? (c$7 = r$11 ?? f$3, d$3 = -1) : void 0 === u$4[1] ? d$3 = -2 : (d$3 = c$7.lastIndex - u$4[2].length, a$2 = u$4[1], c$7 = void 0 === u$4[3] ? m$2 : "\"" === u$4[3] ? g : p$1) : c$7 === g || c$7 === p$1 ? c$7 = m$2 : c$7 === v$1 || c$7 === _ ? c$7 = f$3 : (c$7 = m$2, r$11 = void 0); + const x$1 = c$7 === m$2 && t$7[i$11 + 1].startsWith("/>") ? " " : ""; + l$5 += c$7 === f$3 ? s$10 + n$8 : d$3 >= 0 ? (o$14.push(a$2), s$10.slice(0, d$3) + e$11 + s$10.slice(d$3) + h$5 + x$1) : s$10 + h$5 + (-2 === d$3 ? i$11 : x$1); + } + return [P(t$7, l$5 + (t$7[s$9] || "") + (2 === i$10 ? "" : 3 === i$10 ? "" : "")), o$14]; +}; +var N = class N { + constructor({ strings: t$7, _$litType$: s$9 }, n$11) { + let r$11; + this.parts = []; + let c$7 = 0, a$2 = 0; + const u$4 = t$7.length - 1, d$3 = this.parts, [f$4, v$2] = V(t$7, s$9); + if (this.el = N.createElement(f$4, n$11), C.currentNode = this.el.content, 2 === s$9 || 3 === s$9) { + const t$8 = this.el.content.firstChild; + t$8.replaceWith(...t$8.childNodes); + } + for (; null !== (r$11 = C.nextNode()) && d$3.length < u$4;) { + if (1 === r$11.nodeType) { + if (r$11.hasAttributes()) for (const t$8 of r$11.getAttributeNames()) if (t$8.endsWith(e$11)) { + const i$10 = v$2[a$2++], s$10 = r$11.getAttribute(t$8).split(h$5), e$14 = /([.?@])?(.*)/.exec(i$10); + d$3.push({ + type: 1, + index: c$7, + name: e$14[2], + strings: s$10, + ctor: "." === e$14[1] ? H : "?" === e$14[1] ? I : "@" === e$14[1] ? L : k + }), r$11.removeAttribute(t$8); + } else t$8.startsWith(h$5) && (d$3.push({ + type: 6, + index: c$7 + }), r$11.removeAttribute(t$8)); + if ($.test(r$11.tagName)) { + const t$8 = r$11.textContent.split(h$5), s$10 = t$8.length - 1; + if (s$10 > 0) { + r$11.textContent = i$8 ? i$8.emptyScript : ""; + for (let i$10 = 0; i$10 < s$10; i$10++) r$11.append(t$8[i$10], l$3()), C.nextNode(), d$3.push({ + type: 2, + index: ++c$7 + }); + r$11.append(t$8[s$10], l$3()); + } + } + } else if (8 === r$11.nodeType) if (r$11.data === o$11) d$3.push({ + type: 2, + index: c$7 + }); + else { + let t$8 = -1; + for (; -1 !== (t$8 = r$11.data.indexOf(h$5, t$8 + 1));) d$3.push({ + type: 7, + index: c$7 + }), t$8 += h$5.length - 1; + } + c$7++; + } + } + static createElement(t$7, i$10) { + const s$9 = r$9.createElement("template"); + return s$9.innerHTML = t$7, s$9; + } +}; +function S(t$7, i$10, s$9 = t$7, e$14) { + if (i$10 === T) return i$10; + let h$7 = void 0 !== e$14 ? s$9._$Co?.[e$14] : s$9._$Cl; + const o$14 = c$4(i$10) ? void 0 : i$10._$litDirective$; + return h$7?.constructor !== o$14 && (h$7?._$AO?.(!1), void 0 === o$14 ? h$7 = void 0 : (h$7 = new o$14(t$7), h$7._$AT(t$7, s$9, e$14)), void 0 !== e$14 ? (s$9._$Co ??= [])[e$14] = h$7 : s$9._$Cl = h$7), void 0 !== h$7 && (i$10 = S(t$7, h$7._$AS(t$7, i$10.values), h$7, e$14)), i$10; +} +var M$1 = class { + constructor(t$7, i$10) { + this._$AV = [], this._$AN = void 0, this._$AD = t$7, this._$AM = i$10; + } + get parentNode() { + return this._$AM.parentNode; + } + get _$AU() { + return this._$AM._$AU; + } + u(t$7) { + const { el: { content: i$10 }, parts: s$9 } = this._$AD, e$14 = (t$7?.creationScope ?? r$9).importNode(i$10, !0); + C.currentNode = e$14; + let h$7 = C.nextNode(), o$14 = 0, n$11 = 0, l$5 = s$9[0]; + for (; void 0 !== l$5;) { + if (o$14 === l$5.index) { + let i$11; + 2 === l$5.type ? i$11 = new R(h$7, h$7.nextSibling, this, t$7) : 1 === l$5.type ? i$11 = new l$5.ctor(h$7, l$5.name, l$5.strings, this, t$7) : 6 === l$5.type && (i$11 = new z(h$7, this, t$7)), this._$AV.push(i$11), l$5 = s$9[++n$11]; + } + o$14 !== l$5?.index && (h$7 = C.nextNode(), o$14++); + } + return C.currentNode = r$9, e$14; + } + p(t$7) { + let i$10 = 0; + for (const s$9 of this._$AV) void 0 !== s$9 && (void 0 !== s$9.strings ? (s$9._$AI(t$7, s$9, i$10), i$10 += s$9.strings.length - 2) : s$9._$AI(t$7[i$10])), i$10++; + } +}; +var R = class R { + get _$AU() { + return this._$AM?._$AU ?? this._$Cv; + } + constructor(t$7, i$10, s$9, e$14) { + this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA = t$7, this._$AB = i$10, this._$AM = s$9, this.options = e$14, this._$Cv = e$14?.isConnected ?? !0; + } + get parentNode() { + let t$7 = this._$AA.parentNode; + const i$10 = this._$AM; + return void 0 !== i$10 && 11 === t$7?.nodeType && (t$7 = i$10.parentNode), t$7; + } + get startNode() { + return this._$AA; + } + get endNode() { + return this._$AB; + } + _$AI(t$7, i$10 = this) { + t$7 = S(this, t$7, i$10), c$4(t$7) ? t$7 === E || null == t$7 || "" === t$7 ? (this._$AH !== E && this._$AR(), this._$AH = E) : t$7 !== this._$AH && t$7 !== T && this._(t$7) : void 0 !== t$7._$litType$ ? this.$(t$7) : void 0 !== t$7.nodeType ? this.T(t$7) : u$3(t$7) ? this.k(t$7) : this._(t$7); + } + O(t$7) { + return this._$AA.parentNode.insertBefore(t$7, this._$AB); + } + T(t$7) { + this._$AH !== t$7 && (this._$AR(), this._$AH = this.O(t$7)); + } + _(t$7) { + this._$AH !== E && c$4(this._$AH) ? this._$AA.nextSibling.data = t$7 : this.T(r$9.createTextNode(t$7)), this._$AH = t$7; + } + $(t$7) { + const { values: i$10, _$litType$: s$9 } = t$7, e$14 = "number" == typeof s$9 ? this._$AC(t$7) : (void 0 === s$9.el && (s$9.el = N.createElement(P(s$9.h, s$9.h[0]), this.options)), s$9); + if (this._$AH?._$AD === e$14) this._$AH.p(i$10); + else { + const t$8 = new M$1(e$14, this), s$10 = t$8.u(this.options); + t$8.p(i$10), this.T(s$10), this._$AH = t$8; + } + } + _$AC(t$7) { + let i$10 = A.get(t$7.strings); + return void 0 === i$10 && A.set(t$7.strings, i$10 = new N(t$7)), i$10; + } + k(t$7) { + a(this._$AH) || (this._$AH = [], this._$AR()); + const i$10 = this._$AH; + let s$9, e$14 = 0; + for (const h$7 of t$7) e$14 === i$10.length ? i$10.push(s$9 = new R(this.O(l$3()), this.O(l$3()), this, this.options)) : s$9 = i$10[e$14], s$9._$AI(h$7), e$14++; + e$14 < i$10.length && (this._$AR(s$9 && s$9._$AB.nextSibling, e$14), i$10.length = e$14); + } + _$AR(t$7 = this._$AA.nextSibling, i$10) { + for (this._$AP?.(!1, !0, i$10); t$7 !== this._$AB;) { + const i$11 = t$7.nextSibling; + t$7.remove(), t$7 = i$11; + } + } + setConnected(t$7) { + void 0 === this._$AM && (this._$Cv = t$7, this._$AP?.(t$7)); + } +}; +var k = class { + get tagName() { + return this.element.tagName; + } + get _$AU() { + return this._$AM._$AU; + } + constructor(t$7, i$10, s$9, e$14, h$7) { + this.type = 1, this._$AH = E, this._$AN = void 0, this.element = t$7, this.name = i$10, this._$AM = e$14, this.options = h$7, s$9.length > 2 || "" !== s$9[0] || "" !== s$9[1] ? (this._$AH = Array(s$9.length - 1).fill(new String()), this.strings = s$9) : this._$AH = E; + } + _$AI(t$7, i$10 = this, s$9, e$14) { + const h$7 = this.strings; + let o$14 = !1; + if (void 0 === h$7) t$7 = S(this, t$7, i$10, 0), o$14 = !c$4(t$7) || t$7 !== this._$AH && t$7 !== T, o$14 && (this._$AH = t$7); + else { + const e$15 = t$7; + let n$11, r$11; + for (t$7 = h$7[0], n$11 = 0; n$11 < h$7.length - 1; n$11++) r$11 = S(this, e$15[s$9 + n$11], i$10, n$11), r$11 === T && (r$11 = this._$AH[n$11]), o$14 ||= !c$4(r$11) || r$11 !== this._$AH[n$11], r$11 === E ? t$7 = E : t$7 !== E && (t$7 += (r$11 ?? "") + h$7[n$11 + 1]), this._$AH[n$11] = r$11; + } + o$14 && !e$14 && this.j(t$7); + } + j(t$7) { + t$7 === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t$7 ?? ""); + } +}; +var H = class extends k { + constructor() { + super(...arguments), this.type = 3; + } + j(t$7) { + this.element[this.name] = t$7 === E ? void 0 : t$7; + } +}; +var I = class extends k { + constructor() { + super(...arguments), this.type = 4; + } + j(t$7) { + this.element.toggleAttribute(this.name, !!t$7 && t$7 !== E); + } +}; +var L = class extends k { + constructor(t$7, i$10, s$9, e$14, h$7) { + super(t$7, i$10, s$9, e$14, h$7), this.type = 5; + } + _$AI(t$7, i$10 = this) { + if ((t$7 = S(this, t$7, i$10, 0) ?? E) === T) return; + const s$9 = this._$AH, e$14 = t$7 === E && s$9 !== E || t$7.capture !== s$9.capture || t$7.once !== s$9.once || t$7.passive !== s$9.passive, h$7 = t$7 !== E && (s$9 === E || e$14); + e$14 && this.element.removeEventListener(this.name, this, s$9), h$7 && this.element.addEventListener(this.name, this, t$7), this._$AH = t$7; + } + handleEvent(t$7) { + "function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t$7) : this._$AH.handleEvent(t$7); + } +}; +var z = class { + constructor(t$7, i$10, s$9) { + this.element = t$7, this.type = 6, this._$AN = void 0, this._$AM = i$10, this.options = s$9; + } + get _$AU() { + return this._$AM._$AU; + } + _$AI(t$7) { + S(this, t$7); + } +}; +const Z = { + M: e$11, + P: h$5, + A: o$11, + C: 1, + L: V, + R: M$1, + D: u$3, + V: S, + I: R, + H: k, + N: I, + U: L, + B: H, + F: z +}, j = t$5.litHtmlPolyfillSupport; +j?.(N, R), (t$5.litHtmlVersions ??= []).push("3.3.1"); +const B = (t$7, i$10, s$9) => { + const e$14 = s$9?.renderBefore ?? i$10; + let h$7 = e$14._$litPart$; + if (void 0 === h$7) { + const t$8 = s$9?.renderBefore ?? null; + e$14._$litPart$ = h$7 = new R(i$10.insertBefore(l$3(), t$8), t$8, void 0, s$9 ?? {}); + } + return h$7._$AI(t$7), h$7; +}; + +//#endregion +//#region node_modules/lit-element/lit-element.js +/** +* @license +* Copyright 2017 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ const s$6 = globalThis; +var i$1 = class extends y { + constructor() { + super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0; + } + createRenderRoot() { + const t$7 = super.createRenderRoot(); + return this.renderOptions.renderBefore ??= t$7.firstChild, t$7; + } + update(t$7) { + const r$11 = this.render(); + this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t$7), this._$Do = B(r$11, this.renderRoot, this.renderOptions); + } + connectedCallback() { + super.connectedCallback(), this._$Do?.setConnected(!0); + } + disconnectedCallback() { + super.disconnectedCallback(), this._$Do?.setConnected(!1); + } + render() { + return T; + } +}; +i$1._$litElement$ = !0, i$1["finalized"] = !0, s$6.litElementHydrateSupport?.({ LitElement: i$1 }); +const o$10 = s$6.litElementPolyfillSupport; +o$10?.({ LitElement: i$1 }); +const n$7 = { + _$AK: (t$7, e$14, r$11) => { + t$7._$AK(e$14, r$11); + }, + _$AL: (t$7) => t$7._$AL +}; +(s$6.litElementVersions ??= []).push("4.2.1"); + +//#endregion +//#region node_modules/lit-html/is-server.js +/** +* @license +* Copyright 2022 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ +const o$9 = !1; + +//#endregion +//#region node_modules/lit-html/directive.js +/** +* @license +* Copyright 2017 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ +const t$1 = { + ATTRIBUTE: 1, + CHILD: 2, + PROPERTY: 3, + BOOLEAN_ATTRIBUTE: 4, + EVENT: 5, + ELEMENT: 6 +}, e$1 = (t$7) => (...e$14) => ({ + _$litDirective$: t$7, + values: e$14 +}); +var i$3 = class { + constructor(t$7) {} + get _$AU() { + return this._$AM._$AU; + } + _$AT(t$7, e$14, i$10) { + this._$Ct = t$7, this._$AM = e$14, this._$Ci = i$10; + } + _$AS(t$7, e$14) { + return this.update(t$7, e$14); + } + update(t$7, e$14) { + return this.render(...e$14); + } +}; + +//#endregion +//#region node_modules/lit-html/directive-helpers.js +/** +* @license +* Copyright 2020 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ const { I: t$4 } = Z, i$7 = (o$14) => null === o$14 || "object" != typeof o$14 && "function" != typeof o$14, n$6 = { + HTML: 1, + SVG: 2, + MATHML: 3 +}, e$10 = (o$14, t$7) => void 0 === t$7 ? void 0 !== o$14?._$litType$ : o$14?._$litType$ === t$7, l$2 = (o$14) => null != o$14?._$litType$?.h, d = (o$14) => void 0 !== o$14?._$litDirective$, c$3 = (o$14) => o$14?._$litDirective$, f$1 = (o$14) => void 0 === o$14.strings, r$8 = () => document.createComment(""), s$5 = (o$14, i$10, n$11) => { + const e$14 = o$14._$AA.parentNode, l$5 = void 0 === i$10 ? o$14._$AB : i$10._$AA; + if (void 0 === n$11) { + const i$11 = e$14.insertBefore(r$8(), l$5), d$3 = e$14.insertBefore(r$8(), l$5); + n$11 = new t$4(i$11, d$3, o$14, o$14.options); + } else { + const t$7 = n$11._$AB.nextSibling, i$11 = n$11._$AM, d$3 = i$11 !== o$14; + if (d$3) { + let t$8; + n$11._$AQ?.(o$14), n$11._$AM = o$14, void 0 !== n$11._$AP && (t$8 = o$14._$AU) !== i$11._$AU && n$11._$AP(t$8); + } + if (t$7 !== l$5 || d$3) { + let o$15 = n$11._$AA; + for (; o$15 !== t$7;) { + const t$8 = o$15.nextSibling; + e$14.insertBefore(o$15, l$5), o$15 = t$8; + } + } + } + return n$11; +}, v = (o$14, t$7, i$10 = o$14) => (o$14._$AI(t$7, i$10), o$14), u$2 = {}, m$1 = (o$14, t$7 = u$2) => o$14._$AH = t$7, p = (o$14) => o$14._$AH, M = (o$14) => { + o$14._$AR(), o$14._$AA.remove(); +}, h$4 = (o$14) => { + o$14._$AR(); +}; + +//#endregion +//#region node_modules/lit-html/directives/repeat.js +/** +* @license +* Copyright 2017 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ +const u$1 = (e$14, s$9, t$7) => { + const r$11 = new Map(); + for (let l$5 = s$9; l$5 <= t$7; l$5++) r$11.set(e$14[l$5], l$5); + return r$11; +}, c = e$1(class extends i$3 { + constructor(e$14) { + if (super(e$14), e$14.type !== t$1.CHILD) throw Error("repeat() can only be used in text expressions"); + } + dt(e$14, s$9, t$7) { + let r$11; + void 0 === t$7 ? t$7 = s$9 : void 0 !== s$9 && (r$11 = s$9); + const l$5 = [], o$14 = []; + let i$10 = 0; + for (const s$10 of e$14) l$5[i$10] = r$11 ? r$11(s$10, i$10) : i$10, o$14[i$10] = t$7(s$10, i$10), i$10++; + return { + values: o$14, + keys: l$5 + }; + } + render(e$14, s$9, t$7) { + return this.dt(e$14, s$9, t$7).values; + } + update(s$9, [t$7, r$11, c$7]) { + const d$3 = p(s$9), { values: p$3, keys: a$2 } = this.dt(t$7, r$11, c$7); + if (!Array.isArray(d$3)) return this.ut = a$2, p$3; + const h$7 = this.ut ??= [], v$2 = []; + let m$3, y$2, x$1 = 0, j$1 = d$3.length - 1, k$1 = 0, w$1 = p$3.length - 1; + for (; x$1 <= j$1 && k$1 <= w$1;) if (null === d$3[x$1]) x$1++; + else if (null === d$3[j$1]) j$1--; + else if (h$7[x$1] === a$2[k$1]) v$2[k$1] = v(d$3[x$1], p$3[k$1]), x$1++, k$1++; + else if (h$7[j$1] === a$2[w$1]) v$2[w$1] = v(d$3[j$1], p$3[w$1]), j$1--, w$1--; + else if (h$7[x$1] === a$2[w$1]) v$2[w$1] = v(d$3[x$1], p$3[w$1]), s$5(s$9, v$2[w$1 + 1], d$3[x$1]), x$1++, w$1--; + else if (h$7[j$1] === a$2[k$1]) v$2[k$1] = v(d$3[j$1], p$3[k$1]), s$5(s$9, d$3[x$1], d$3[j$1]), j$1--, k$1++; + else if (void 0 === m$3 && (m$3 = u$1(a$2, k$1, w$1), y$2 = u$1(h$7, x$1, j$1)), m$3.has(h$7[x$1])) if (m$3.has(h$7[j$1])) { + const e$14 = y$2.get(a$2[k$1]), t$8 = void 0 !== e$14 ? d$3[e$14] : null; + if (null === t$8) { + const e$15 = s$5(s$9, d$3[x$1]); + v(e$15, p$3[k$1]), v$2[k$1] = e$15; + } else v$2[k$1] = v(t$8, p$3[k$1]), s$5(s$9, d$3[x$1], t$8), d$3[e$14] = null; + k$1++; + } else M(d$3[j$1]), j$1--; + else M(d$3[x$1]), x$1++; + for (; k$1 <= w$1;) { + const e$14 = s$5(s$9, v$2[w$1 + 1]); + v(e$14, p$3[k$1]), v$2[k$1++] = e$14; + } + for (; x$1 <= j$1;) { + const e$14 = d$3[x$1++]; + null !== e$14 && M(e$14); + } + return this.ut = a$2, m$1(s$9, v$2), T; + } +}); + +//#endregion +//#region node_modules/@lit/context/lib/context-request-event.js +/** +* @license +* Copyright 2021 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ +var s$2 = class extends Event { + constructor(s$9, t$7, e$14, o$14) { + super("context-request", { + bubbles: !0, + composed: !0 + }), this.context = s$9, this.contextTarget = t$7, this.callback = e$14, this.subscribe = o$14 ?? !1; + } +}; + +//#endregion +//#region node_modules/@lit/context/lib/create-context.js +/** +* @license +* Copyright 2021 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ +function n$3(n$11) { + return n$11; +} + +//#endregion +//#region node_modules/@lit/context/lib/controllers/context-consumer.js +/** +* @license +* Copyright 2021 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ var s$3 = class { + constructor(t$7, s$9, i$10, h$7) { + if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (t$8, s$10) => { + this.unsubscribe && (this.unsubscribe !== s$10 && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = t$8, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(t$8, s$10)), this.unsubscribe = s$10; + }, this.host = t$7, void 0 !== s$9.context) { + const t$8 = s$9; + this.context = t$8.context, this.callback = t$8.callback, this.subscribe = t$8.subscribe ?? !1; + } else this.context = s$9, this.callback = i$10, this.subscribe = h$7 ?? !1; + this.host.addController(this); + } + hostConnected() { + this.dispatchRequest(); + } + hostDisconnected() { + this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0); + } + dispatchRequest() { + this.host.dispatchEvent(new s$2(this.context, this.host, this.t, this.subscribe)); + } +}; + +//#endregion +//#region node_modules/@lit/context/lib/value-notifier.js +/** +* @license +* Copyright 2021 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ +var s$4 = class { + get value() { + return this.o; + } + set value(s$9) { + this.setValue(s$9); + } + setValue(s$9, t$7 = !1) { + const i$10 = t$7 || !Object.is(s$9, this.o); + this.o = s$9, i$10 && this.updateObservers(); + } + constructor(s$9) { + this.subscriptions = new Map(), this.updateObservers = () => { + for (const [s$10, { disposer: t$7 }] of this.subscriptions) s$10(this.o, t$7); + }, void 0 !== s$9 && (this.value = s$9); + } + addCallback(s$9, t$7, i$10) { + if (!i$10) return void s$9(this.value); + this.subscriptions.has(s$9) || this.subscriptions.set(s$9, { + disposer: () => { + this.subscriptions.delete(s$9); + }, + consumerHost: t$7 + }); + const { disposer: h$7 } = this.subscriptions.get(s$9); + s$9(this.value, h$7); + } + clearCallbacks() { + this.subscriptions.clear(); + } +}; + +//#endregion +//#region node_modules/@lit/context/lib/controllers/context-provider.js +/** +* @license +* Copyright 2021 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ var e$9 = class extends Event { + constructor(t$7, s$9) { + super("context-provider", { + bubbles: !0, + composed: !0 + }), this.context = t$7, this.contextTarget = s$9; + } +}; +var i$2 = class extends s$4 { + constructor(s$9, e$14, i$10) { + super(void 0 !== e$14.context ? e$14.initialValue : i$10), this.onContextRequest = (t$7) => { + if (t$7.context !== this.context) return; + const s$10 = t$7.contextTarget ?? t$7.composedPath()[0]; + s$10 !== this.host && (t$7.stopPropagation(), this.addCallback(t$7.callback, s$10, t$7.subscribe)); + }, this.onProviderRequest = (s$10) => { + if (s$10.context !== this.context) return; + if ((s$10.contextTarget ?? s$10.composedPath()[0]) === this.host) return; + const e$15 = new Set(); + for (const [s$11, { consumerHost: i$11 }] of this.subscriptions) e$15.has(s$11) || (e$15.add(s$11), i$11.dispatchEvent(new s$2(this.context, i$11, s$11, !0))); + s$10.stopPropagation(); + }, this.host = s$9, void 0 !== e$14.context ? this.context = e$14.context : this.context = e$14, this.attachListeners(), this.host.addController?.(this); + } + attachListeners() { + this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest); + } + hostConnected() { + this.host.dispatchEvent(new e$9(this.context, this.host)); + } +}; + +//#endregion +//#region node_modules/@lit/context/lib/context-root.js +/** +* @license +* Copyright 2021 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ var t$3 = class { + constructor() { + this.pendingContextRequests = new Map(), this.onContextProvider = (t$7) => { + const s$9 = this.pendingContextRequests.get(t$7.context); + if (void 0 === s$9) return; + this.pendingContextRequests.delete(t$7.context); + const { requests: o$14 } = s$9; + for (const { elementRef: s$10, callbackRef: n$11 } of o$14) { + const o$15 = s$10.deref(), c$7 = n$11.deref(); + void 0 === o$15 || void 0 === c$7 || o$15.dispatchEvent(new s$2(t$7.context, o$15, c$7, !0)); + } + }, this.onContextRequest = (e$14) => { + if (!0 !== e$14.subscribe) return; + const t$7 = e$14.contextTarget ?? e$14.composedPath()[0], s$9 = e$14.callback; + let o$14 = this.pendingContextRequests.get(e$14.context); + void 0 === o$14 && this.pendingContextRequests.set(e$14.context, o$14 = { + callbacks: new WeakMap(), + requests: [] + }); + let n$11 = o$14.callbacks.get(t$7); + void 0 === n$11 && o$14.callbacks.set(t$7, n$11 = new WeakSet()), n$11.has(s$9) || (n$11.add(s$9), o$14.requests.push({ + elementRef: new WeakRef(t$7), + callbackRef: new WeakRef(s$9) + })); + }; + } + attach(e$14) { + e$14.addEventListener("context-request", this.onContextRequest), e$14.addEventListener("context-provider", this.onContextProvider); + } + detach(e$14) { + e$14.removeEventListener("context-request", this.onContextRequest), e$14.removeEventListener("context-provider", this.onContextProvider); + } +}; + +//#endregion +//#region node_modules/@lit/context/lib/decorators/provide.js +/** +* @license +* Copyright 2017 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ function e$8({ context: e$14 }) { + return (n$11, i$10) => { + const r$11 = new WeakMap(); + if ("object" == typeof i$10) return { + get() { + return n$11.get.call(this); + }, + set(t$7) { + return r$11.get(this).setValue(t$7), n$11.set.call(this, t$7); + }, + init(n$12) { + return r$11.set(this, new i$2(this, { + context: e$14, + initialValue: n$12 + })), n$12; + } + }; + { + n$11.constructor.addInitializer(((n$12) => { + r$11.set(n$12, new i$2(n$12, { context: e$14 })); + })); + const o$14 = Object.getOwnPropertyDescriptor(n$11, i$10); + let s$9; + if (void 0 === o$14) { + const t$7 = new WeakMap(); + s$9 = { + get() { + return t$7.get(this); + }, + set(e$15) { + r$11.get(this).setValue(e$15), t$7.set(this, e$15); + }, + configurable: !0, + enumerable: !0 + }; + } else { + const t$7 = o$14.set; + s$9 = { + ...o$14, + set(e$15) { + r$11.get(this).setValue(e$15), t$7?.call(this, e$15); + } + }; + } + return void Object.defineProperty(n$11, i$10, s$9); + } + }; +} + +//#endregion +//#region node_modules/@lit/context/lib/decorators/consume.js +/** +* @license +* Copyright 2022 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ function c$1({ context: c$7, subscribe: e$14 }) { + return (o$14, n$11) => { + "object" == typeof n$11 ? n$11.addInitializer((function() { + new s$3(this, { + context: c$7, + callback: (t$7) => { + o$14.set.call(this, t$7); + }, + subscribe: e$14 + }); + })) : o$14.constructor.addInitializer(((o$15) => { + new s$3(o$15, { + context: c$7, + callback: (t$7) => { + o$15[n$11] = t$7; + }, + subscribe: e$14 + }); + })); + }; +} + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/events/events.js +const eventInit = { + bubbles: true, + cancelable: true, + composed: true +}; +var StateEvent = class StateEvent extends CustomEvent { + static { + this.eventName = "a2uiaction"; + } + constructor(payload) { + super(StateEvent.eventName, { + detail: payload, + ...eventInit + }); + this.payload = payload; + } +}; + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/styles/behavior.js +const opacityBehavior = ` + &:not([disabled]) { + cursor: pointer; + opacity: var(--opacity, 0); + transition: opacity var(--speed, 0.2s) cubic-bezier(0, 0, 0.3, 1); + + &:hover, + &:focus { + opacity: 1; + } + }`; +const behavior = ` + ${new Array(21).fill(0).map((_$1, idx) => { + return `.behavior-ho-${idx * 5} { + --opacity: ${idx / 20}; + ${opacityBehavior} + }`; +}).join("\n")} + + .behavior-o-s { + overflow: scroll; + } + + .behavior-o-a { + overflow: auto; + } + + .behavior-o-h { + overflow: hidden; + } + + .behavior-sw-n { + scrollbar-width: none; + } +`; + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/styles/shared.js +const grid = 4; + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/styles/border.js +const border = ` + ${new Array(25).fill(0).map((_$1, idx) => { + return ` + .border-bw-${idx} { border-width: ${idx}px; } + .border-btw-${idx} { border-top-width: ${idx}px; } + .border-bbw-${idx} { border-bottom-width: ${idx}px; } + .border-blw-${idx} { border-left-width: ${idx}px; } + .border-brw-${idx} { border-right-width: ${idx}px; } + + .border-ow-${idx} { outline-width: ${idx}px; } + .border-br-${idx} { border-radius: ${idx * grid}px; overflow: hidden;}`; +}).join("\n")} + + .border-br-50pc { + border-radius: 50%; + } + + .border-bs-s { + border-style: solid; + } +`; + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/types/colors.js +const shades = [ + 0, + 5, + 10, + 15, + 20, + 25, + 30, + 35, + 40, + 50, + 60, + 70, + 80, + 90, + 95, + 98, + 99, + 100 +]; + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/styles/utils.js +function merge(...classes) { + const styles = {}; + for (const clazz of classes) { + for (const [key, val] of Object.entries(clazz)) { + const prefix = key.split("-").with(-1, "").join("-"); + const existingKeys = Object.keys(styles).filter((key$1) => key$1.startsWith(prefix)); + for (const existingKey of existingKeys) { + delete styles[existingKey]; + } + styles[key] = val; + } + } + return styles; +} +function appendToAll(target, exclusions, ...classes) { + const updatedTarget = structuredClone(target); + for (const clazz of classes) { + for (const key of Object.keys(clazz)) { + const prefix = key.split("-").with(-1, "").join("-"); + for (const [tagName, classesToAdd] of Object.entries(updatedTarget)) { + if (exclusions.includes(tagName)) { + continue; + } + let found = false; + for (let t$7 = 0; t$7 < classesToAdd.length; t$7++) { + if (classesToAdd[t$7].startsWith(prefix)) { + found = true; + classesToAdd[t$7] = key; + } + } + if (!found) { + classesToAdd.push(key); + } + } + } + } + return updatedTarget; +} +function createThemeStyles(palettes) { + const styles = {}; + for (const palette of Object.values(palettes)) { + for (const [key, val] of Object.entries(palette)) { + const prop = toProp(key); + styles[prop] = val; + } + } + return styles; +} +function toProp(key) { + if (key.startsWith("nv")) { + return `--nv-${key.slice(2)}`; + } + return `--${key[0]}-${key.slice(1)}`; +} + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/styles/colors.js +const color = (src) => ` + ${src.map((key) => { + const inverseKey = getInverseKey(key); + return `.color-bc-${key} { border-color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`; +}).join("\n")} + + ${src.map((key) => { + const inverseKey = getInverseKey(key); + const vals = [`.color-bgc-${key} { background-color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`, `.color-bbgc-${key}::backdrop { background-color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`]; + for (let o$14 = .1; o$14 < 1; o$14 += .1) { + vals.push(`.color-bbgc-${key}_${(o$14 * 100).toFixed(0)}::backdrop { + background-color: light-dark(oklch(from var(${toProp(key)}) l c h / calc(alpha * ${o$14.toFixed(1)})), oklch(from var(${toProp(inverseKey)}) l c h / calc(alpha * ${o$14.toFixed(1)})) ); + } + `); + } + return vals.join("\n"); +}).join("\n")} + + ${src.map((key) => { + const inverseKey = getInverseKey(key); + return `.color-c-${key} { color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`; +}).join("\n")} + `; +const getInverseKey = (key) => { + const match = key.match(/^([a-z]+)(\d+)$/); + if (!match) return key; + const [, prefix, shadeStr] = match; + const shade = parseInt(shadeStr, 10); + const target = 100 - shade; + const inverseShade = shades.reduce((prev, curr) => Math.abs(curr - target) < Math.abs(prev - target) ? curr : prev); + return `${prefix}${inverseShade}`; +}; +const keyFactory = (prefix) => { + return shades.map((v$2) => `${prefix}${v$2}`); +}; +const colors = [ + color(keyFactory("p")), + color(keyFactory("s")), + color(keyFactory("t")), + color(keyFactory("n")), + color(keyFactory("nv")), + color(keyFactory("e")), + ` + .color-bgc-transparent { + background-color: transparent; + } + + :host { + color-scheme: var(--color-scheme); + } + ` +]; + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/styles/icons.js +/** +* CSS classes for Google Symbols. +* +* Usage: +* +* ```html +* pen_spark +* ``` +*/ +const icons = ` + .g-icon { + font-family: "Material Symbols Outlined", "Google Symbols"; + font-weight: normal; + font-style: normal; + font-display: optional; + font-size: 20px; + width: 1em; + height: 1em; + user-select: none; + line-height: 1; + letter-spacing: normal; + text-transform: none; + display: inline-block; + white-space: nowrap; + word-wrap: normal; + direction: ltr; + -webkit-font-feature-settings: "liga"; + -webkit-font-smoothing: antialiased; + overflow: hidden; + + font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 48, + "ROND" 100; + + &.filled { + font-variation-settings: "FILL" 1, "wght" 300, "GRAD" 0, "opsz" 48, + "ROND" 100; + } + + &.filled-heavy { + font-variation-settings: "FILL" 1, "wght" 700, "GRAD" 0, "opsz" 48, + "ROND" 100; + } + } +`; + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/styles/layout.js +const layout = ` + :host { + ${new Array(16).fill(0).map((_$1, idx) => { + return `--g-${idx + 1}: ${(idx + 1) * grid}px;`; +}).join("\n")} + } + + ${new Array(49).fill(0).map((_$1, index) => { + const idx = index - 24; + const lbl = idx < 0 ? `n${Math.abs(idx)}` : idx.toString(); + return ` + .layout-p-${lbl} { --padding: ${idx * grid}px; padding: var(--padding); } + .layout-pt-${lbl} { padding-top: ${idx * grid}px; } + .layout-pr-${lbl} { padding-right: ${idx * grid}px; } + .layout-pb-${lbl} { padding-bottom: ${idx * grid}px; } + .layout-pl-${lbl} { padding-left: ${idx * grid}px; } + + .layout-m-${lbl} { --margin: ${idx * grid}px; margin: var(--margin); } + .layout-mt-${lbl} { margin-top: ${idx * grid}px; } + .layout-mr-${lbl} { margin-right: ${idx * grid}px; } + .layout-mb-${lbl} { margin-bottom: ${idx * grid}px; } + .layout-ml-${lbl} { margin-left: ${idx * grid}px; } + + .layout-t-${lbl} { top: ${idx * grid}px; } + .layout-r-${lbl} { right: ${idx * grid}px; } + .layout-b-${lbl} { bottom: ${idx * grid}px; } + .layout-l-${lbl} { left: ${idx * grid}px; }`; +}).join("\n")} + + ${new Array(25).fill(0).map((_$1, idx) => { + return ` + .layout-g-${idx} { gap: ${idx * grid}px; }`; +}).join("\n")} + + ${new Array(8).fill(0).map((_$1, idx) => { + return ` + .layout-grd-col${idx + 1} { grid-template-columns: ${"1fr ".repeat(idx + 1).trim()}; }`; +}).join("\n")} + + .layout-pos-a { + position: absolute; + } + + .layout-pos-rel { + position: relative; + } + + .layout-dsp-none { + display: none; + } + + .layout-dsp-block { + display: block; + } + + .layout-dsp-grid { + display: grid; + } + + .layout-dsp-iflex { + display: inline-flex; + } + + .layout-dsp-flexvert { + display: flex; + flex-direction: column; + } + + .layout-dsp-flexhor { + display: flex; + flex-direction: row; + } + + .layout-fw-w { + flex-wrap: wrap; + } + + .layout-al-fs { + align-items: start; + } + + .layout-al-fe { + align-items: end; + } + + .layout-al-c { + align-items: center; + } + + .layout-as-n { + align-self: normal; + } + + .layout-js-c { + justify-self: center; + } + + .layout-sp-c { + justify-content: center; + } + + .layout-sp-ev { + justify-content: space-evenly; + } + + .layout-sp-bt { + justify-content: space-between; + } + + .layout-sp-s { + justify-content: start; + } + + .layout-sp-e { + justify-content: end; + } + + .layout-ji-e { + justify-items: end; + } + + .layout-r-none { + resize: none; + } + + .layout-fs-c { + field-sizing: content; + } + + .layout-fs-n { + field-sizing: none; + } + + .layout-flx-0 { + flex: 0 0 auto; + } + + .layout-flx-1 { + flex: 1 0 auto; + } + + .layout-c-s { + contain: strict; + } + + /** Widths **/ + + ${new Array(10).fill(0).map((_$1, idx) => { + const weight = (idx + 1) * 10; + return `.layout-w-${weight} { width: ${weight}%; max-width: ${weight}%; }`; +}).join("\n")} + + ${new Array(16).fill(0).map((_$1, idx) => { + const weight = idx * grid; + return `.layout-wp-${idx} { width: ${weight}px; }`; +}).join("\n")} + + /** Heights **/ + + ${new Array(10).fill(0).map((_$1, idx) => { + const height = (idx + 1) * 10; + return `.layout-h-${height} { height: ${height}%; }`; +}).join("\n")} + + ${new Array(16).fill(0).map((_$1, idx) => { + const height = idx * grid; + return `.layout-hp-${idx} { height: ${height}px; }`; +}).join("\n")} + + .layout-el-cv { + & img, + & video { + width: 100%; + height: 100%; + object-fit: cover; + margin: 0; + } + } + + .layout-ar-sq { + aspect-ratio: 1 / 1; + } + + .layout-ex-fb { + margin: calc(var(--padding) * -1) 0 0 calc(var(--padding) * -1); + width: calc(100% + var(--padding) * 2); + height: calc(100% + var(--padding) * 2); + } +`; + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/styles/opacity.js +const opacity = ` + ${new Array(21).fill(0).map((_$1, idx) => { + return `.opacity-el-${idx * 5} { opacity: ${idx / 20}; }`; +}).join("\n")} +`; + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/styles/type.js +const type$1 = ` + :host { + --default-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + --default-font-family-mono: "Courier New", Courier, monospace; + } + + .typography-f-s { + font-family: var(--font-family, var(--default-font-family)); + font-optical-sizing: auto; + font-variation-settings: "slnt" 0, "wdth" 100, "GRAD" 0; + } + + .typography-f-sf { + font-family: var(--font-family-flex, var(--default-font-family)); + font-optical-sizing: auto; + } + + .typography-f-c { + font-family: var(--font-family-mono, var(--default-font-family)); + font-optical-sizing: auto; + font-variation-settings: "slnt" 0, "wdth" 100, "GRAD" 0; + } + + .typography-v-r { + font-variation-settings: "slnt" 0, "wdth" 100, "GRAD" 0, "ROND" 100; + } + + .typography-ta-s { + text-align: start; + } + + .typography-ta-c { + text-align: center; + } + + .typography-fs-n { + font-style: normal; + } + + .typography-fs-i { + font-style: italic; + } + + .typography-sz-ls { + font-size: 11px; + line-height: 16px; + } + + .typography-sz-lm { + font-size: 12px; + line-height: 16px; + } + + .typography-sz-ll { + font-size: 14px; + line-height: 20px; + } + + .typography-sz-bs { + font-size: 12px; + line-height: 16px; + } + + .typography-sz-bm { + font-size: 14px; + line-height: 20px; + } + + .typography-sz-bl { + font-size: 16px; + line-height: 24px; + } + + .typography-sz-ts { + font-size: 14px; + line-height: 20px; + } + + .typography-sz-tm { + font-size: 16px; + line-height: 24px; + } + + .typography-sz-tl { + font-size: 22px; + line-height: 28px; + } + + .typography-sz-hs { + font-size: 24px; + line-height: 32px; + } + + .typography-sz-hm { + font-size: 28px; + line-height: 36px; + } + + .typography-sz-hl { + font-size: 32px; + line-height: 40px; + } + + .typography-sz-ds { + font-size: 36px; + line-height: 44px; + } + + .typography-sz-dm { + font-size: 45px; + line-height: 52px; + } + + .typography-sz-dl { + font-size: 57px; + line-height: 64px; + } + + .typography-ws-p { + white-space: pre-line; + } + + .typography-ws-nw { + white-space: nowrap; + } + + .typography-td-none { + text-decoration: none; + } + + /** Weights **/ + + ${new Array(9).fill(0).map((_$1, idx) => { + const weight = (idx + 1) * 100; + return `.typography-w-${weight} { font-weight: ${weight}; }`; +}).join("\n")} +`; + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/styles/index.js +const structuralStyles$1 = [ + behavior, + border, + colors, + icons, + layout, + opacity, + type$1 +].flat(Infinity).join("\n"); + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/data/guards.js +var guards_exports = /* @__PURE__ */ __export({ + isComponentArrayReference: () => isComponentArrayReference, + isObject: () => isObject$1, + isPath: () => isPath, + isResolvedAudioPlayer: () => isResolvedAudioPlayer, + isResolvedButton: () => isResolvedButton, + isResolvedCard: () => isResolvedCard, + isResolvedCheckbox: () => isResolvedCheckbox, + isResolvedColumn: () => isResolvedColumn, + isResolvedDateTimeInput: () => isResolvedDateTimeInput, + isResolvedDivider: () => isResolvedDivider, + isResolvedIcon: () => isResolvedIcon, + isResolvedImage: () => isResolvedImage, + isResolvedList: () => isResolvedList, + isResolvedModal: () => isResolvedModal, + isResolvedMultipleChoice: () => isResolvedMultipleChoice, + isResolvedRow: () => isResolvedRow, + isResolvedSlider: () => isResolvedSlider, + isResolvedTabs: () => isResolvedTabs, + isResolvedText: () => isResolvedText, + isResolvedTextField: () => isResolvedTextField, + isResolvedVideo: () => isResolvedVideo, + isValueMap: () => isValueMap +}); +function isValueMap(value) { + return isObject$1(value) && "key" in value; +} +function isPath(key, value) { + return key === "path" && typeof value === "string"; +} +function isObject$1(value) { + return typeof value === "object" && value !== null && !Array.isArray(value); +} +function isComponentArrayReference(value) { + if (!isObject$1(value)) return false; + return "explicitList" in value || "template" in value; +} +function isStringValue(value) { + return isObject$1(value) && ("path" in value || "literal" in value && typeof value.literal === "string" || "literalString" in value); +} +function isNumberValue(value) { + return isObject$1(value) && ("path" in value || "literal" in value && typeof value.literal === "number" || "literalNumber" in value); +} +function isBooleanValue(value) { + return isObject$1(value) && ("path" in value || "literal" in value && typeof value.literal === "boolean" || "literalBoolean" in value); +} +function isAnyComponentNode(value) { + if (!isObject$1(value)) return false; + const hasBaseKeys = "id" in value && "type" in value && "properties" in value; + if (!hasBaseKeys) return false; + return true; +} +function isResolvedAudioPlayer(props) { + return isObject$1(props) && "url" in props && isStringValue(props.url); +} +function isResolvedButton(props) { + return isObject$1(props) && "child" in props && isAnyComponentNode(props.child) && "action" in props; +} +function isResolvedCard(props) { + if (!isObject$1(props)) return false; + if (!("child" in props)) { + if (!("children" in props)) { + return false; + } else { + return Array.isArray(props.children) && props.children.every(isAnyComponentNode); + } + } + return isAnyComponentNode(props.child); +} +function isResolvedCheckbox(props) { + return isObject$1(props) && "label" in props && isStringValue(props.label) && "value" in props && isBooleanValue(props.value); +} +function isResolvedColumn(props) { + return isObject$1(props) && "children" in props && Array.isArray(props.children) && props.children.every(isAnyComponentNode); +} +function isResolvedDateTimeInput(props) { + return isObject$1(props) && "value" in props && isStringValue(props.value); +} +function isResolvedDivider(props) { + return isObject$1(props); +} +function isResolvedImage(props) { + return isObject$1(props) && "url" in props && isStringValue(props.url); +} +function isResolvedIcon(props) { + return isObject$1(props) && "name" in props && isStringValue(props.name); +} +function isResolvedList(props) { + return isObject$1(props) && "children" in props && Array.isArray(props.children) && props.children.every(isAnyComponentNode); +} +function isResolvedModal(props) { + return isObject$1(props) && "entryPointChild" in props && isAnyComponentNode(props.entryPointChild) && "contentChild" in props && isAnyComponentNode(props.contentChild); +} +function isResolvedMultipleChoice(props) { + return isObject$1(props) && "selections" in props; +} +function isResolvedRow(props) { + return isObject$1(props) && "children" in props && Array.isArray(props.children) && props.children.every(isAnyComponentNode); +} +function isResolvedSlider(props) { + return isObject$1(props) && "value" in props && isNumberValue(props.value); +} +function isResolvedTabItem(item) { + return isObject$1(item) && "title" in item && isStringValue(item.title) && "child" in item && isAnyComponentNode(item.child); +} +function isResolvedTabs(props) { + return isObject$1(props) && "tabItems" in props && Array.isArray(props.tabItems) && props.tabItems.every(isResolvedTabItem); +} +function isResolvedText(props) { + return isObject$1(props) && "text" in props && isStringValue(props.text); +} +function isResolvedTextField(props) { + return isObject$1(props) && "label" in props && isStringValue(props.label); +} +function isResolvedVideo(props) { + return isObject$1(props) && "url" in props && isStringValue(props.url); +} + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/data/model-processor.js +/** +* Processes and consolidates A2UIProtocolMessage objects into a structured, +* hierarchical model of UI surfaces. +*/ +var A2uiMessageProcessor = class A2uiMessageProcessor { + static { + this.DEFAULT_SURFACE_ID = "@default"; + } + #mapCtor = Map; + #arrayCtor = Array; + #setCtor = Set; + #objCtor = Object; + #surfaces; + constructor(opts = { + mapCtor: Map, + arrayCtor: Array, + setCtor: Set, + objCtor: Object + }) { + this.opts = opts; + this.#arrayCtor = opts.arrayCtor; + this.#mapCtor = opts.mapCtor; + this.#setCtor = opts.setCtor; + this.#objCtor = opts.objCtor; + this.#surfaces = new opts.mapCtor(); + } + getSurfaces() { + return this.#surfaces; + } + clearSurfaces() { + this.#surfaces.clear(); + } + processMessages(messages) { + for (const message of messages) { + if (message.beginRendering) { + this.#handleBeginRendering(message.beginRendering, message.beginRendering.surfaceId); + } + if (message.surfaceUpdate) { + this.#handleSurfaceUpdate(message.surfaceUpdate, message.surfaceUpdate.surfaceId); + } + if (message.dataModelUpdate) { + this.#handleDataModelUpdate(message.dataModelUpdate, message.dataModelUpdate.surfaceId); + } + if (message.deleteSurface) { + this.#handleDeleteSurface(message.deleteSurface); + } + } + } + /** + * Retrieves the data for a given component node and a relative path string. + * This correctly handles the special `.` path, which refers to the node's + * own data context. + */ + getData(node, relativePath, surfaceId = A2uiMessageProcessor.DEFAULT_SURFACE_ID) { + const surface = this.#getOrCreateSurface(surfaceId); + if (!surface) return null; + let finalPath; + if (relativePath === "." || relativePath === "") { + finalPath = node.dataContextPath ?? "/"; + } else { + finalPath = this.resolvePath(relativePath, node.dataContextPath); + } + return this.#getDataByPath(surface.dataModel, finalPath); + } + setData(node, relativePath, value, surfaceId = A2uiMessageProcessor.DEFAULT_SURFACE_ID) { + if (!node) { + console.warn("No component node set"); + return; + } + const surface = this.#getOrCreateSurface(surfaceId); + if (!surface) return; + let finalPath; + if (relativePath === "." || relativePath === "") { + finalPath = node.dataContextPath ?? "/"; + } else { + finalPath = this.resolvePath(relativePath, node.dataContextPath); + } + this.#setDataByPath(surface.dataModel, finalPath, value); + } + resolvePath(path, dataContextPath) { + if (path.startsWith("/")) { + return path; + } + if (dataContextPath && dataContextPath !== "/") { + return dataContextPath.endsWith("/") ? `${dataContextPath}${path}` : `${dataContextPath}/${path}`; + } + return `/${path}`; + } + #parseIfJsonString(value) { + if (typeof value !== "string") { + return value; + } + const trimmedValue = value.trim(); + if (trimmedValue.startsWith("{") && trimmedValue.endsWith("}") || trimmedValue.startsWith("[") && trimmedValue.endsWith("]")) { + try { + return JSON.parse(value); + } catch (e$14) { + console.warn(`Failed to parse potential JSON string: "${value.substring(0, 50)}..."`, e$14); + return value; + } + } + return value; + } + /** + * Converts a specific array format [{key: "...", value_string: "..."}, ...] + * into a standard Map. It also attempts to parse any string values that + * appear to be stringified JSON. + */ + #convertKeyValueArrayToMap(arr) { + const map$1 = new this.#mapCtor(); + for (const item of arr) { + if (!isObject$1(item) || !("key" in item)) continue; + const key = item.key; + const valueKey = this.#findValueKey(item); + if (!valueKey) continue; + let value = item[valueKey]; + if (valueKey === "valueMap" && Array.isArray(value)) { + value = this.#convertKeyValueArrayToMap(value); + } else if (typeof value === "string") { + value = this.#parseIfJsonString(value); + } + this.#setDataByPath(map$1, key, value); + } + return map$1; + } + #setDataByPath(root, path, value) { + if (Array.isArray(value) && (value.length === 0 || isObject$1(value[0]) && "key" in value[0])) { + if (value.length === 1 && isObject$1(value[0]) && value[0].key === ".") { + const item = value[0]; + const valueKey = this.#findValueKey(item); + if (valueKey) { + value = item[valueKey]; + if (valueKey === "valueMap" && Array.isArray(value)) { + value = this.#convertKeyValueArrayToMap(value); + } else if (typeof value === "string") { + value = this.#parseIfJsonString(value); + } + } else { + value = this.#convertKeyValueArrayToMap(value); + } + } else { + value = this.#convertKeyValueArrayToMap(value); + } + } + const segments = this.#normalizePath(path).split("/").filter((s$9) => s$9); + if (segments.length === 0) { + if (value instanceof Map || isObject$1(value)) { + if (!(value instanceof Map) && isObject$1(value)) { + value = new this.#mapCtor(Object.entries(value)); + } + root.clear(); + for (const [key, v$2] of value.entries()) { + root.set(key, v$2); + } + } else { + console.error("Cannot set root of DataModel to a non-Map value."); + } + return; + } + let current = root; + for (let i$10 = 0; i$10 < segments.length - 1; i$10++) { + const segment = segments[i$10]; + let target; + if (current instanceof Map) { + target = current.get(segment); + } else if (Array.isArray(current) && /^\d+$/.test(segment)) { + target = current[parseInt(segment, 10)]; + } + if (target === undefined || typeof target !== "object" || target === null) { + target = new this.#mapCtor(); + if (current instanceof this.#mapCtor) { + current.set(segment, target); + } else if (Array.isArray(current)) { + current[parseInt(segment, 10)] = target; + } + } + current = target; + } + const finalSegment = segments[segments.length - 1]; + const storedValue = value; + if (current instanceof this.#mapCtor) { + current.set(finalSegment, storedValue); + } else if (Array.isArray(current) && /^\d+$/.test(finalSegment)) { + current[parseInt(finalSegment, 10)] = storedValue; + } + } + /** + * Normalizes a path string into a consistent, slash-delimited format. + * Converts bracket notation and dot notation in a two-pass. + * e.g., "bookRecommendations[0].title" -> "/bookRecommendations/0/title" + * e.g., "book.0.title" -> "/book/0/title" + */ + #normalizePath(path) { + const dotPath = path.replace(/\[(\d+)\]/g, ".$1"); + const segments = dotPath.split("."); + return "/" + segments.filter((s$9) => s$9.length > 0).join("/"); + } + #getDataByPath(root, path) { + const segments = this.#normalizePath(path).split("/").filter((s$9) => s$9); + let current = root; + for (const segment of segments) { + if (current === undefined || current === null) return null; + if (current instanceof Map) { + current = current.get(segment); + } else if (Array.isArray(current) && /^\d+$/.test(segment)) { + current = current[parseInt(segment, 10)]; + } else if (isObject$1(current)) { + current = current[segment]; + } else { + return null; + } + } + return current; + } + #getOrCreateSurface(surfaceId) { + let surface = this.#surfaces.get(surfaceId); + if (!surface) { + surface = new this.#objCtor({ + rootComponentId: null, + componentTree: null, + dataModel: new this.#mapCtor(), + components: new this.#mapCtor(), + styles: new this.#objCtor() + }); + this.#surfaces.set(surfaceId, surface); + } + return surface; + } + #handleBeginRendering(message, surfaceId) { + const surface = this.#getOrCreateSurface(surfaceId); + surface.rootComponentId = message.root; + surface.styles = message.styles ?? {}; + this.#rebuildComponentTree(surface); + } + #handleSurfaceUpdate(message, surfaceId) { + const surface = this.#getOrCreateSurface(surfaceId); + for (const component of message.components) { + surface.components.set(component.id, component); + } + this.#rebuildComponentTree(surface); + } + #handleDataModelUpdate(message, surfaceId) { + const surface = this.#getOrCreateSurface(surfaceId); + const path = message.path ?? "/"; + this.#setDataByPath(surface.dataModel, path, message.contents); + this.#rebuildComponentTree(surface); + } + #handleDeleteSurface(message) { + this.#surfaces.delete(message.surfaceId); + } + /** + * Starts at the root component of the surface and builds out the tree + * recursively. This process involves resolving all properties of the child + * components, and expanding on any explicit children lists or templates + * found in the structure. + * + * @param surface The surface to be built. + */ + #rebuildComponentTree(surface) { + if (!surface.rootComponentId) { + surface.componentTree = null; + return; + } + const visited = new this.#setCtor(); + surface.componentTree = this.#buildNodeRecursive(surface.rootComponentId, surface, visited, "/", ""); + } + /** Finds a value key in a map. */ + #findValueKey(value) { + return Object.keys(value).find((k$1) => k$1.startsWith("value")); + } + /** + * Builds out the nodes recursively. + */ + #buildNodeRecursive(baseComponentId, surface, visited, dataContextPath, idSuffix = "") { + const fullId = `${baseComponentId}${idSuffix}`; + const { components } = surface; + if (!components.has(baseComponentId)) { + return null; + } + if (visited.has(fullId)) { + throw new Error(`Circular dependency for component "${fullId}".`); + } + visited.add(fullId); + const componentData = components.get(baseComponentId); + const componentProps = componentData.component ?? {}; + const componentType = Object.keys(componentProps)[0]; + const unresolvedProperties = componentProps[componentType]; + const resolvedProperties = new this.#objCtor(); + if (isObject$1(unresolvedProperties)) { + for (const [key, value] of Object.entries(unresolvedProperties)) { + resolvedProperties[key] = this.#resolvePropertyValue(value, surface, visited, dataContextPath, idSuffix, key); + } + } + visited.delete(fullId); + const baseNode = { + id: fullId, + dataContextPath, + weight: componentData.weight ?? "initial" + }; + switch (componentType) { + case "Text": + if (!isResolvedText(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Text", + properties: resolvedProperties + }); + case "Image": + if (!isResolvedImage(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Image", + properties: resolvedProperties + }); + case "Icon": + if (!isResolvedIcon(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Icon", + properties: resolvedProperties + }); + case "Video": + if (!isResolvedVideo(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Video", + properties: resolvedProperties + }); + case "AudioPlayer": + if (!isResolvedAudioPlayer(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "AudioPlayer", + properties: resolvedProperties + }); + case "Row": + if (!isResolvedRow(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Row", + properties: resolvedProperties + }); + case "Column": + if (!isResolvedColumn(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Column", + properties: resolvedProperties + }); + case "List": + if (!isResolvedList(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "List", + properties: resolvedProperties + }); + case "Card": + if (!isResolvedCard(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Card", + properties: resolvedProperties + }); + case "Tabs": + if (!isResolvedTabs(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Tabs", + properties: resolvedProperties + }); + case "Divider": + if (!isResolvedDivider(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Divider", + properties: resolvedProperties + }); + case "Modal": + if (!isResolvedModal(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Modal", + properties: resolvedProperties + }); + case "Button": + if (!isResolvedButton(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Button", + properties: resolvedProperties + }); + case "CheckBox": + if (!isResolvedCheckbox(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "CheckBox", + properties: resolvedProperties + }); + case "TextField": + if (!isResolvedTextField(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "TextField", + properties: resolvedProperties + }); + case "DateTimeInput": + if (!isResolvedDateTimeInput(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "DateTimeInput", + properties: resolvedProperties + }); + case "MultipleChoice": + if (!isResolvedMultipleChoice(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "MultipleChoice", + properties: resolvedProperties + }); + case "Slider": + if (!isResolvedSlider(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Slider", + properties: resolvedProperties + }); + default: return new this.#objCtor({ + ...baseNode, + type: componentType, + properties: resolvedProperties + }); + } + } + /** + * Recursively resolves an individual property value. If a property indicates + * a child node (a string that matches a component ID), an explicitList of + * children, or a template, these will be built out here. + */ + #resolvePropertyValue(value, surface, visited, dataContextPath, idSuffix = "", propertyKey = null) { + const isComponentIdReferenceKey = (key) => key === "child" || key.endsWith("Child"); + if (typeof value === "string" && propertyKey && isComponentIdReferenceKey(propertyKey) && surface.components.has(value)) { + return this.#buildNodeRecursive(value, surface, visited, dataContextPath, idSuffix); + } + if (isComponentArrayReference(value)) { + if (value.explicitList) { + return value.explicitList.map((id) => this.#buildNodeRecursive(id, surface, visited, dataContextPath, idSuffix)); + } + if (value.template) { + const fullDataPath = this.resolvePath(value.template.dataBinding, dataContextPath); + const data = this.#getDataByPath(surface.dataModel, fullDataPath); + const template = value.template; + if (Array.isArray(data)) { + return data.map((_$1, index) => { + const parentIndices = dataContextPath.split("/").filter((segment) => /^\d+$/.test(segment)); + const newIndices = [...parentIndices, index]; + const newSuffix = `:${newIndices.join(":")}`; + const childDataContextPath = `${fullDataPath}/${index}`; + return this.#buildNodeRecursive(template.componentId, surface, visited, childDataContextPath, newSuffix); + }); + } + const mapCtor = this.#mapCtor; + if (data instanceof mapCtor) { + return Array.from(data.keys(), (key) => { + const newSuffix = `:${key}`; + const childDataContextPath = `${fullDataPath}/${key}`; + return this.#buildNodeRecursive(template.componentId, surface, visited, childDataContextPath, newSuffix); + }); + } + return new this.#arrayCtor(); + } + } + if (Array.isArray(value)) { + return value.map((item) => this.#resolvePropertyValue(item, surface, visited, dataContextPath, idSuffix, propertyKey)); + } + if (isObject$1(value)) { + const newObj = new this.#objCtor(); + for (const [key, propValue] of Object.entries(value)) { + let propertyValue = propValue; + if (isPath(key, propValue) && dataContextPath !== "/") { + propertyValue = propValue.replace(/^\.?\/item/, "").replace(/^\.?\/text/, "").replace(/^\.?\/label/, "").replace(/^\.?\//, ""); + newObj[key] = propertyValue; + continue; + } + newObj[key] = this.#resolvePropertyValue(propertyValue, surface, visited, dataContextPath, idSuffix, key); + } + return newObj; + } + return value; + } +}; + +//#endregion +//#region node_modules/signal-polyfill/dist/index.js +var __defProp = Object.defineProperty; +var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { + enumerable: true, + configurable: true, + writable: true, + value +}) : obj[key] = value; +var __publicField = (obj, key, value) => { + __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; +}; +var __accessCheck = (obj, member, msg) => { + if (!member.has(obj)) throw TypeError("Cannot " + msg); +}; +var __privateIn = (member, obj) => { + if (Object(obj) !== obj) throw TypeError("Cannot use the \"in\" operator on this value"); + return member.has(obj); +}; +var __privateAdd = (obj, member, value) => { + if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); + member instanceof WeakSet ? member.add(obj) : member.set(obj, value); +}; +var __privateMethod = (obj, member, method) => { + __accessCheck(obj, member, "access private method"); + return method; +}; +/** +* @license +* Copyright Google LLC All Rights Reserved. +* +* Use of this source code is governed by an MIT-style license that can be +* found in the LICENSE file at https://angular.io/license +*/ +function defaultEquals(a$2, b$2) { + return Object.is(a$2, b$2); +} +/** +* @license +* Copyright Google LLC All Rights Reserved. +* +* Use of this source code is governed by an MIT-style license that can be +* found in the LICENSE file at https://angular.io/license +*/ +let activeConsumer = null; +let inNotificationPhase = false; +let epoch = 1; +const SIGNAL = /* @__PURE__ */ Symbol("SIGNAL"); +function setActiveConsumer(consumer) { + const prev = activeConsumer; + activeConsumer = consumer; + return prev; +} +function getActiveConsumer() { + return activeConsumer; +} +function isInNotificationPhase() { + return inNotificationPhase; +} +const REACTIVE_NODE = { + version: 0, + lastCleanEpoch: 0, + dirty: false, + producerNode: void 0, + producerLastReadVersion: void 0, + producerIndexOfThis: void 0, + nextProducerIndex: 0, + liveConsumerNode: void 0, + liveConsumerIndexOfThis: void 0, + consumerAllowSignalWrites: false, + consumerIsAlwaysLive: false, + producerMustRecompute: () => false, + producerRecomputeValue: () => {}, + consumerMarkedDirty: () => {}, + consumerOnSignalRead: () => {} +}; +function producerAccessed(node) { + if (inNotificationPhase) { + throw new Error(typeof ngDevMode !== "undefined" && ngDevMode ? `Assertion error: signal read during notification phase` : ""); + } + if (activeConsumer === null) { + return; + } + activeConsumer.consumerOnSignalRead(node); + const idx = activeConsumer.nextProducerIndex++; + assertConsumerNode(activeConsumer); + if (idx < activeConsumer.producerNode.length && activeConsumer.producerNode[idx] !== node) { + if (consumerIsLive(activeConsumer)) { + const staleProducer = activeConsumer.producerNode[idx]; + producerRemoveLiveConsumerAtIndex(staleProducer, activeConsumer.producerIndexOfThis[idx]); + } + } + if (activeConsumer.producerNode[idx] !== node) { + activeConsumer.producerNode[idx] = node; + activeConsumer.producerIndexOfThis[idx] = consumerIsLive(activeConsumer) ? producerAddLiveConsumer(node, activeConsumer, idx) : 0; + } + activeConsumer.producerLastReadVersion[idx] = node.version; +} +function producerIncrementEpoch() { + epoch++; +} +function producerUpdateValueVersion(node) { + if (!node.dirty && node.lastCleanEpoch === epoch) { + return; + } + if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) { + node.dirty = false; + node.lastCleanEpoch = epoch; + return; + } + node.producerRecomputeValue(node); + node.dirty = false; + node.lastCleanEpoch = epoch; +} +function producerNotifyConsumers(node) { + if (node.liveConsumerNode === void 0) { + return; + } + const prev = inNotificationPhase; + inNotificationPhase = true; + try { + for (const consumer of node.liveConsumerNode) { + if (!consumer.dirty) { + consumerMarkDirty(consumer); + } + } + } finally { + inNotificationPhase = prev; + } +} +function producerUpdatesAllowed() { + return (activeConsumer == null ? void 0 : activeConsumer.consumerAllowSignalWrites) !== false; +} +function consumerMarkDirty(node) { + var _a$1; + node.dirty = true; + producerNotifyConsumers(node); + (_a$1 = node.consumerMarkedDirty) == null ? void 0 : _a$1.call(node.wrapper ?? node); +} +function consumerBeforeComputation(node) { + node && (node.nextProducerIndex = 0); + return setActiveConsumer(node); +} +function consumerAfterComputation(node, prevConsumer) { + setActiveConsumer(prevConsumer); + if (!node || node.producerNode === void 0 || node.producerIndexOfThis === void 0 || node.producerLastReadVersion === void 0) { + return; + } + if (consumerIsLive(node)) { + for (let i$10 = node.nextProducerIndex; i$10 < node.producerNode.length; i$10++) { + producerRemoveLiveConsumerAtIndex(node.producerNode[i$10], node.producerIndexOfThis[i$10]); + } + } + while (node.producerNode.length > node.nextProducerIndex) { + node.producerNode.pop(); + node.producerLastReadVersion.pop(); + node.producerIndexOfThis.pop(); + } +} +function consumerPollProducersForChange(node) { + assertConsumerNode(node); + for (let i$10 = 0; i$10 < node.producerNode.length; i$10++) { + const producer = node.producerNode[i$10]; + const seenVersion = node.producerLastReadVersion[i$10]; + if (seenVersion !== producer.version) { + return true; + } + producerUpdateValueVersion(producer); + if (seenVersion !== producer.version) { + return true; + } + } + return false; +} +function producerAddLiveConsumer(node, consumer, indexOfThis) { + var _a$1; + assertProducerNode(node); + assertConsumerNode(node); + if (node.liveConsumerNode.length === 0) { + (_a$1 = node.watched) == null ? void 0 : _a$1.call(node.wrapper); + for (let i$10 = 0; i$10 < node.producerNode.length; i$10++) { + node.producerIndexOfThis[i$10] = producerAddLiveConsumer(node.producerNode[i$10], node, i$10); + } + } + node.liveConsumerIndexOfThis.push(indexOfThis); + return node.liveConsumerNode.push(consumer) - 1; +} +function producerRemoveLiveConsumerAtIndex(node, idx) { + var _a$1; + assertProducerNode(node); + assertConsumerNode(node); + if (typeof ngDevMode !== "undefined" && ngDevMode && idx >= node.liveConsumerNode.length) { + throw new Error(`Assertion error: active consumer index ${idx} is out of bounds of ${node.liveConsumerNode.length} consumers)`); + } + if (node.liveConsumerNode.length === 1) { + (_a$1 = node.unwatched) == null ? void 0 : _a$1.call(node.wrapper); + for (let i$10 = 0; i$10 < node.producerNode.length; i$10++) { + producerRemoveLiveConsumerAtIndex(node.producerNode[i$10], node.producerIndexOfThis[i$10]); + } + } + const lastIdx = node.liveConsumerNode.length - 1; + node.liveConsumerNode[idx] = node.liveConsumerNode[lastIdx]; + node.liveConsumerIndexOfThis[idx] = node.liveConsumerIndexOfThis[lastIdx]; + node.liveConsumerNode.length--; + node.liveConsumerIndexOfThis.length--; + if (idx < node.liveConsumerNode.length) { + const idxProducer = node.liveConsumerIndexOfThis[idx]; + const consumer = node.liveConsumerNode[idx]; + assertConsumerNode(consumer); + consumer.producerIndexOfThis[idxProducer] = idx; + } +} +function consumerIsLive(node) { + var _a$1; + return node.consumerIsAlwaysLive || (((_a$1 = node == null ? void 0 : node.liveConsumerNode) == null ? void 0 : _a$1.length) ?? 0) > 0; +} +function assertConsumerNode(node) { + node.producerNode ?? (node.producerNode = []); + node.producerIndexOfThis ?? (node.producerIndexOfThis = []); + node.producerLastReadVersion ?? (node.producerLastReadVersion = []); +} +function assertProducerNode(node) { + node.liveConsumerNode ?? (node.liveConsumerNode = []); + node.liveConsumerIndexOfThis ?? (node.liveConsumerIndexOfThis = []); +} +/** +* @license +* Copyright Google LLC All Rights Reserved. +* +* Use of this source code is governed by an MIT-style license that can be +* found in the LICENSE file at https://angular.io/license +*/ +function computedGet(node) { + producerUpdateValueVersion(node); + producerAccessed(node); + if (node.value === ERRORED) { + throw node.error; + } + return node.value; +} +function createComputed(computation) { + const node = Object.create(COMPUTED_NODE); + node.computation = computation; + const computed = () => computedGet(node); + computed[SIGNAL] = node; + return computed; +} +const UNSET = /* @__PURE__ */ Symbol("UNSET"); +const COMPUTING = /* @__PURE__ */ Symbol("COMPUTING"); +const ERRORED = /* @__PURE__ */ Symbol("ERRORED"); +const COMPUTED_NODE = /* @__PURE__ */ (() => { + return { + ...REACTIVE_NODE, + value: UNSET, + dirty: true, + error: null, + equal: defaultEquals, + producerMustRecompute(node) { + return node.value === UNSET || node.value === COMPUTING; + }, + producerRecomputeValue(node) { + if (node.value === COMPUTING) { + throw new Error("Detected cycle in computations."); + } + const oldValue = node.value; + node.value = COMPUTING; + const prevConsumer = consumerBeforeComputation(node); + let newValue; + let wasEqual = false; + try { + newValue = node.computation.call(node.wrapper); + const oldOk = oldValue !== UNSET && oldValue !== ERRORED; + wasEqual = oldOk && node.equal.call(node.wrapper, oldValue, newValue); + } catch (err) { + newValue = ERRORED; + node.error = err; + } finally { + consumerAfterComputation(node, prevConsumer); + } + if (wasEqual) { + node.value = oldValue; + return; + } + node.value = newValue; + node.version++; + } + }; +})(); +/** +* @license +* Copyright Google LLC All Rights Reserved. +* +* Use of this source code is governed by an MIT-style license that can be +* found in the LICENSE file at https://angular.io/license +*/ +function defaultThrowError() { + throw new Error(); +} +let throwInvalidWriteToSignalErrorFn = defaultThrowError; +function throwInvalidWriteToSignalError() { + throwInvalidWriteToSignalErrorFn(); +} +/** +* @license +* Copyright Google LLC All Rights Reserved. +* +* Use of this source code is governed by an MIT-style license that can be +* found in the LICENSE file at https://angular.io/license +*/ +function createSignal(initialValue) { + const node = Object.create(SIGNAL_NODE); + node.value = initialValue; + const getter = () => { + producerAccessed(node); + return node.value; + }; + getter[SIGNAL] = node; + return getter; +} +function signalGetFn() { + producerAccessed(this); + return this.value; +} +function signalSetFn(node, newValue) { + if (!producerUpdatesAllowed()) { + throwInvalidWriteToSignalError(); + } + if (!node.equal.call(node.wrapper, node.value, newValue)) { + node.value = newValue; + signalValueChanged(node); + } +} +const SIGNAL_NODE = /* @__PURE__ */ (() => { + return { + ...REACTIVE_NODE, + equal: defaultEquals, + value: void 0 + }; +})(); +function signalValueChanged(node) { + node.version++; + producerIncrementEpoch(); + producerNotifyConsumers(node); +} +/** +* @license +* Copyright 2024 Bloomberg Finance L.P. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +const NODE = Symbol("node"); +var Signal; +((Signal2) => { + var _a$1, _brand, brand_fn, _b, _brand2, brand_fn2; + class State { + constructor(initialValue, options = {}) { + __privateAdd(this, _brand); + __publicField(this, _a$1); + const ref = createSignal(initialValue); + const node = ref[SIGNAL]; + this[NODE] = node; + node.wrapper = this; + if (options) { + const equals = options.equals; + if (equals) { + node.equal = equals; + } + node.watched = options[Signal2.subtle.watched]; + node.unwatched = options[Signal2.subtle.unwatched]; + } + } + get() { + if (!(0, Signal2.isState)(this)) throw new TypeError("Wrong receiver type for Signal.State.prototype.get"); + return signalGetFn.call(this[NODE]); + } + set(newValue) { + if (!(0, Signal2.isState)(this)) throw new TypeError("Wrong receiver type for Signal.State.prototype.set"); + if (isInNotificationPhase()) { + throw new Error("Writes to signals not permitted during Watcher callback"); + } + const ref = this[NODE]; + signalSetFn(ref, newValue); + } + } + _a$1 = NODE; + _brand = new WeakSet(); + brand_fn = function() {}; + Signal2.isState = (s$9) => typeof s$9 === "object" && __privateIn(_brand, s$9); + Signal2.State = State; + class Computed { + constructor(computation, options) { + __privateAdd(this, _brand2); + __publicField(this, _b); + const ref = createComputed(computation); + const node = ref[SIGNAL]; + node.consumerAllowSignalWrites = true; + this[NODE] = node; + node.wrapper = this; + if (options) { + const equals = options.equals; + if (equals) { + node.equal = equals; + } + node.watched = options[Signal2.subtle.watched]; + node.unwatched = options[Signal2.subtle.unwatched]; + } + } + get() { + if (!(0, Signal2.isComputed)(this)) throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get"); + return computedGet(this[NODE]); + } + } + _b = NODE; + _brand2 = new WeakSet(); + brand_fn2 = function() {}; + Signal2.isComputed = (c$7) => typeof c$7 === "object" && __privateIn(_brand2, c$7); + Signal2.Computed = Computed; + ((subtle2) => { + var _a2, _brand3, brand_fn3, _assertSignals, assertSignals_fn; + function untrack(cb) { + let output; + let prevActiveConsumer = null; + try { + prevActiveConsumer = setActiveConsumer(null); + output = cb(); + } finally { + setActiveConsumer(prevActiveConsumer); + } + return output; + } + subtle2.untrack = untrack; + function introspectSources(sink) { + var _a3; + if (!(0, Signal2.isComputed)(sink) && !(0, Signal2.isWatcher)(sink)) { + throw new TypeError("Called introspectSources without a Computed or Watcher argument"); + } + return ((_a3 = sink[NODE].producerNode) == null ? void 0 : _a3.map((n$11) => n$11.wrapper)) ?? []; + } + subtle2.introspectSources = introspectSources; + function introspectSinks(signal) { + var _a3; + if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) { + throw new TypeError("Called introspectSinks without a Signal argument"); + } + return ((_a3 = signal[NODE].liveConsumerNode) == null ? void 0 : _a3.map((n$11) => n$11.wrapper)) ?? []; + } + subtle2.introspectSinks = introspectSinks; + function hasSinks(signal) { + if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) { + throw new TypeError("Called hasSinks without a Signal argument"); + } + const liveConsumerNode = signal[NODE].liveConsumerNode; + if (!liveConsumerNode) return false; + return liveConsumerNode.length > 0; + } + subtle2.hasSinks = hasSinks; + function hasSources(signal) { + if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isWatcher)(signal)) { + throw new TypeError("Called hasSources without a Computed or Watcher argument"); + } + const producerNode = signal[NODE].producerNode; + if (!producerNode) return false; + return producerNode.length > 0; + } + subtle2.hasSources = hasSources; + class Watcher { + constructor(notify) { + __privateAdd(this, _brand3); + __privateAdd(this, _assertSignals); + __publicField(this, _a2); + let node = Object.create(REACTIVE_NODE); + node.wrapper = this; + node.consumerMarkedDirty = notify; + node.consumerIsAlwaysLive = true; + node.consumerAllowSignalWrites = false; + node.producerNode = []; + this[NODE] = node; + } + watch(...signals) { + if (!(0, Signal2.isWatcher)(this)) { + throw new TypeError("Called unwatch without Watcher receiver"); + } + __privateMethod(this, _assertSignals, assertSignals_fn).call(this, signals); + const node = this[NODE]; + node.dirty = false; + const prev = setActiveConsumer(node); + for (const signal of signals) { + producerAccessed(signal[NODE]); + } + setActiveConsumer(prev); + } + unwatch(...signals) { + if (!(0, Signal2.isWatcher)(this)) { + throw new TypeError("Called unwatch without Watcher receiver"); + } + __privateMethod(this, _assertSignals, assertSignals_fn).call(this, signals); + const node = this[NODE]; + assertConsumerNode(node); + for (let i$10 = node.producerNode.length - 1; i$10 >= 0; i$10--) { + if (signals.includes(node.producerNode[i$10].wrapper)) { + producerRemoveLiveConsumerAtIndex(node.producerNode[i$10], node.producerIndexOfThis[i$10]); + const lastIdx = node.producerNode.length - 1; + node.producerNode[i$10] = node.producerNode[lastIdx]; + node.producerIndexOfThis[i$10] = node.producerIndexOfThis[lastIdx]; + node.producerNode.length--; + node.producerIndexOfThis.length--; + node.nextProducerIndex--; + if (i$10 < node.producerNode.length) { + const idxConsumer = node.producerIndexOfThis[i$10]; + const producer = node.producerNode[i$10]; + assertProducerNode(producer); + producer.liveConsumerIndexOfThis[idxConsumer] = i$10; + } + } + } + } + getPending() { + if (!(0, Signal2.isWatcher)(this)) { + throw new TypeError("Called getPending without Watcher receiver"); + } + const node = this[NODE]; + return node.producerNode.filter((n$11) => n$11.dirty).map((n$11) => n$11.wrapper); + } + } + _a2 = NODE; + _brand3 = new WeakSet(); + brand_fn3 = function() {}; + _assertSignals = new WeakSet(); + assertSignals_fn = function(signals) { + for (const signal of signals) { + if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) { + throw new TypeError("Called watch/unwatch without a Computed or State argument"); + } + } + }; + Signal2.isWatcher = (w$1) => __privateIn(_brand3, w$1); + subtle2.Watcher = Watcher; + function currentComputed() { + var _a3; + return (_a3 = getActiveConsumer()) == null ? void 0 : _a3.wrapper; + } + subtle2.currentComputed = currentComputed; + subtle2.watched = Symbol("watched"); + subtle2.unwatched = Symbol("unwatched"); + })(Signal2.subtle || (Signal2.subtle = {})); +})(Signal || (Signal = {})); + +//#endregion +//#region node_modules/signal-utils/dist/-private/util.ts.js +/** +* equality check here is always false so that we can dirty the storage +* via setting to _anything_ +* +* +* This is for a pattern where we don't *directly* use signals to back the values used in collections +* so that instanceof checks and getters and other native features "just work" without having +* to do nested proxying. +* +* (though, see deep.ts for nested / deep behavior) +*/ +const createStorage = (initial = null) => new Signal.State(initial, { equals: () => false }); +/** +* Just an alias for brevity +*/ +const BOUND_FUNS = new WeakMap(); +function fnCacheFor(context) { + let fnCache = BOUND_FUNS.get(context); + if (!fnCache) { + fnCache = new Map(); + BOUND_FUNS.set(context, fnCache); + } + return fnCache; +} + +//#endregion +//#region node_modules/signal-utils/dist/array.ts.js +const ARRAY_GETTER_METHODS = new Set([ + Symbol.iterator, + "concat", + "entries", + "every", + "filter", + "find", + "findIndex", + "flat", + "flatMap", + "forEach", + "includes", + "indexOf", + "join", + "keys", + "lastIndexOf", + "map", + "reduce", + "reduceRight", + "slice", + "some", + "values" +]); +const ARRAY_WRITE_THEN_READ_METHODS = new Set([ + "fill", + "push", + "unshift" +]); +function convertToInt(prop) { + if (typeof prop === "symbol") return null; + const num = Number(prop); + if (isNaN(num)) return null; + return num % 1 === 0 ? num : null; +} +var SignalArray = class SignalArray { + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + static from(iterable, mapfn, thisArg) { + return mapfn ? new SignalArray(Array.from(iterable, mapfn, thisArg)) : new SignalArray(Array.from(iterable)); + } + static of(...arr) { + return new SignalArray(arr); + } + constructor(arr = []) { + let clone = arr.slice(); + let self = this; + let boundFns = new Map(); + /** + Flag to track whether we have *just* intercepted a call to `.push()` or + `.unshift()`, since in those cases (and only those cases!) the `Array` + itself checks `.length` to return from the function call. + */ + let nativelyAccessingLengthFromPushOrUnshift = false; + return new Proxy(clone, { + get(target, prop) { + let index = convertToInt(prop); + if (index !== null) { + self.#readStorageFor(index); + self.#collection.get(); + return target[index]; + } + if (prop === "length") { + if (nativelyAccessingLengthFromPushOrUnshift) { + nativelyAccessingLengthFromPushOrUnshift = false; + } else { + self.#collection.get(); + } + return target[prop]; + } + if (ARRAY_WRITE_THEN_READ_METHODS.has(prop)) { + nativelyAccessingLengthFromPushOrUnshift = true; + } + if (ARRAY_GETTER_METHODS.has(prop)) { + let fn = boundFns.get(prop); + if (fn === undefined) { + fn = (...args) => { + self.#collection.get(); + return target[prop](...args); + }; + boundFns.set(prop, fn); + } + return fn; + } + return target[prop]; + }, + set(target, prop, value) { + target[prop] = value; + let index = convertToInt(prop); + if (index !== null) { + self.#dirtyStorageFor(index); + self.#collection.set(null); + } else if (prop === "length") { + self.#collection.set(null); + } + return true; + }, + getPrototypeOf() { + return SignalArray.prototype; + } + }); + } + #collection = createStorage(); + #storages = new Map(); + #readStorageFor(index) { + let storage = this.#storages.get(index); + if (storage === undefined) { + storage = createStorage(); + this.#storages.set(index, storage); + } + storage.get(); + } + #dirtyStorageFor(index) { + const storage = this.#storages.get(index); + if (storage) { + storage.set(null); + } + } +}; +Object.setPrototypeOf(SignalArray.prototype, Array.prototype); +function signalArray(x$1) { + return new SignalArray(x$1); +} + +//#endregion +//#region node_modules/signal-utils/dist/map.ts.js +var SignalMap = class { + collection = createStorage(); + storages = new Map(); + vals; + readStorageFor(key) { + const { storages } = this; + let storage = storages.get(key); + if (storage === undefined) { + storage = createStorage(); + storages.set(key, storage); + } + storage.get(); + } + dirtyStorageFor(key) { + const storage = this.storages.get(key); + if (storage) { + storage.set(null); + } + } + constructor(existing) { + this.vals = existing ? new Map(existing) : new Map(); + } + get(key) { + this.readStorageFor(key); + return this.vals.get(key); + } + has(key) { + this.readStorageFor(key); + return this.vals.has(key); + } + entries() { + this.collection.get(); + return this.vals.entries(); + } + keys() { + this.collection.get(); + return this.vals.keys(); + } + values() { + this.collection.get(); + return this.vals.values(); + } + forEach(fn) { + this.collection.get(); + this.vals.forEach(fn); + } + get size() { + this.collection.get(); + return this.vals.size; + } + [Symbol.iterator]() { + this.collection.get(); + return this.vals[Symbol.iterator](); + } + get [Symbol.toStringTag]() { + return this.vals[Symbol.toStringTag]; + } + set(key, value) { + this.dirtyStorageFor(key); + this.collection.set(null); + this.vals.set(key, value); + return this; + } + delete(key) { + this.dirtyStorageFor(key); + this.collection.set(null); + return this.vals.delete(key); + } + clear() { + this.storages.forEach((s$9) => s$9.set(null)); + this.collection.set(null); + this.vals.clear(); + } +}; +Object.setPrototypeOf(SignalMap.prototype, Map.prototype); + +//#endregion +//#region node_modules/signal-utils/dist/object.ts.js +/** +* Implementation based of tracked-built-ins' TrackedObject +* https://github.com/tracked-tools/tracked-built-ins/blob/master/addon/src/-private/object.js +*/ +var SignalObjectImpl = class SignalObjectImpl { + static fromEntries(entries) { + return new SignalObjectImpl(Object.fromEntries(entries)); + } + #storages = new Map(); + #collection = createStorage(); + constructor(obj = {}) { + let proto = Object.getPrototypeOf(obj); + let descs = Object.getOwnPropertyDescriptors(obj); + let clone = Object.create(proto); + for (let prop in descs) { + Object.defineProperty(clone, prop, descs[prop]); + } + let self = this; + return new Proxy(clone, { + get(target, prop, receiver) { + self.#readStorageFor(prop); + return Reflect.get(target, prop, receiver); + }, + has(target, prop) { + self.#readStorageFor(prop); + return prop in target; + }, + ownKeys(target) { + self.#collection.get(); + return Reflect.ownKeys(target); + }, + set(target, prop, value, receiver) { + let result = Reflect.set(target, prop, value, receiver); + self.#dirtyStorageFor(prop); + self.#dirtyCollection(); + return result; + }, + deleteProperty(target, prop) { + if (prop in target) { + delete target[prop]; + self.#dirtyStorageFor(prop); + self.#dirtyCollection(); + } + return true; + }, + getPrototypeOf() { + return SignalObjectImpl.prototype; + } + }); + } + #readStorageFor(key) { + let storage = this.#storages.get(key); + if (storage === undefined) { + storage = createStorage(); + this.#storages.set(key, storage); + } + storage.get(); + } + #dirtyStorageFor(key) { + const storage = this.#storages.get(key); + if (storage) { + storage.set(null); + } + } + #dirtyCollection() { + this.#collection.set(null); + } +}; +/** +* Create a reactive Object, backed by Signals, using a Proxy. +* This allows dynamic creation and deletion of signals using the object primitive +* APIs that most folks are familiar with -- the only difference is instantiation. +* ```js +* const obj = new SignalObject({ foo: 123 }); +* +* obj.foo // 123 +* obj.foo = 456 +* obj.foo // 456 +* obj.bar = 2 +* obj.bar // 2 +* ``` +*/ +const SignalObject = SignalObjectImpl; +function signalObject(obj) { + return new SignalObject(obj); +} + +//#endregion +//#region node_modules/signal-utils/dist/set.ts.js +var SignalSet = class { + collection = createStorage(); + storages = new Map(); + vals; + storageFor(key) { + const storages = this.storages; + let storage = storages.get(key); + if (storage === undefined) { + storage = createStorage(); + storages.set(key, storage); + } + return storage; + } + dirtyStorageFor(key) { + const storage = this.storages.get(key); + if (storage) { + storage.set(null); + } + } + constructor(existing) { + this.vals = new Set(existing); + } + has(value) { + this.storageFor(value).get(); + return this.vals.has(value); + } + entries() { + this.collection.get(); + return this.vals.entries(); + } + keys() { + this.collection.get(); + return this.vals.keys(); + } + values() { + this.collection.get(); + return this.vals.values(); + } + forEach(fn) { + this.collection.get(); + this.vals.forEach(fn); + } + get size() { + this.collection.get(); + return this.vals.size; + } + [Symbol.iterator]() { + this.collection.get(); + return this.vals[Symbol.iterator](); + } + get [Symbol.toStringTag]() { + return this.vals[Symbol.toStringTag]; + } + add(value) { + this.dirtyStorageFor(value); + this.collection.set(null); + this.vals.add(value); + return this; + } + delete(value) { + this.dirtyStorageFor(value); + this.collection.set(null); + return this.vals.delete(value); + } + clear() { + this.storages.forEach((s$9) => s$9.set(null)); + this.collection.set(null); + this.vals.clear(); + } +}; +Object.setPrototypeOf(SignalSet.prototype, Set.prototype); + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/data/signal-model-processor.js +function create() { + return new A2uiMessageProcessor({ + arrayCtor: SignalArray, + mapCtor: SignalMap, + objCtor: SignalObject, + setCtor: SignalSet + }); +} + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/schemas/server_to_client_with_standard_catalog.json +var server_to_client_with_standard_catalog_default = { + title: "A2UI Message Schema", + description: "Describes a JSON payload for an A2UI (Agent to UI) message, which is used to dynamically construct and update user interfaces. A message MUST contain exactly ONE of the action properties: 'beginRendering', 'surfaceUpdate', 'dataModelUpdate', or 'deleteSurface'.", + type: "object", + additionalProperties: false, + properties: { + "beginRendering": { + "type": "object", + "description": "Signals the client to begin rendering a surface with a root component and specific styles.", + "additionalProperties": false, + "properties": { + "surfaceId": { + "type": "string", + "description": "The unique identifier for the UI surface to be rendered." + }, + "root": { + "type": "string", + "description": "The ID of the root component to render." + }, + "styles": { + "type": "object", + "description": "Styling information for the UI.", + "additionalProperties": false, + "properties": { + "font": { + "type": "string", + "description": "The primary font for the UI." + }, + "primaryColor": { + "type": "string", + "description": "The primary UI color as a hexadecimal code (e.g., '#00BFFF').", + "pattern": "^#[0-9a-fA-F]{6}$" + } + } + } + }, + "required": ["root", "surfaceId"] + }, + "surfaceUpdate": { + "type": "object", + "description": "Updates a surface with a new set of components.", + "additionalProperties": false, + "properties": { + "surfaceId": { + "type": "string", + "description": "The unique identifier for the UI surface to be updated. If you are adding a new surface this *must* be a new, unique identified that has never been used for any existing surfaces shown." + }, + "components": { + "type": "array", + "description": "A list containing all UI components for the surface.", + "minItems": 1, + "items": { + "type": "object", + "description": "Represents a *single* component in a UI widget tree. This component could be one of many supported types.", + "additionalProperties": false, + "properties": { + "id": { + "type": "string", + "description": "The unique identifier for this component." + }, + "weight": { + "type": "number", + "description": "The relative weight of this component within a Row or Column. This corresponds to the CSS 'flex-grow' property. Note: this may ONLY be set when the component is a direct descendant of a Row or Column." + }, + "component": { + "type": "object", + "description": "A wrapper object that MUST contain exactly one key, which is the name of the component type (e.g., 'Heading'). The value is an object containing the properties for that specific component.", + "additionalProperties": false, + "properties": { + "Text": { + "type": "object", + "additionalProperties": false, + "properties": { + "text": { + "type": "object", + "description": "The text content to display. This can be a literal string or a reference to a value in the data model ('path', e.g., '/doc/title'). While simple Markdown formatting is supported (i.e. without HTML, images, or links), utilizing dedicated UI components is generally preferred for a richer and more structured presentation.", + "additionalProperties": false, + "properties": { + "literalString": { "type": "string" }, + "path": { "type": "string" } + } + }, + "usageHint": { + "type": "string", + "description": "A hint for the base text style. One of:\n- `h1`: Largest heading.\n- `h2`: Second largest heading.\n- `h3`: Third largest heading.\n- `h4`: Fourth largest heading.\n- `h5`: Fifth largest heading.\n- `caption`: Small text for captions.\n- `body`: Standard body text.", + "enum": [ + "h1", + "h2", + "h3", + "h4", + "h5", + "caption", + "body" + ] + } + }, + "required": ["text"] + }, + "Image": { + "type": "object", + "additionalProperties": false, + "properties": { + "url": { + "type": "object", + "description": "The URL of the image to display. This can be a literal string ('literal') or a reference to a value in the data model ('path', e.g. '/thumbnail/url').", + "additionalProperties": false, + "properties": { + "literalString": { "type": "string" }, + "path": { "type": "string" } + } + }, + "fit": { + "type": "string", + "description": "Specifies how the image should be resized to fit its container. This corresponds to the CSS 'object-fit' property.", + "enum": [ + "contain", + "cover", + "fill", + "none", + "scale-down" + ] + }, + "usageHint": { + "type": "string", + "description": "A hint for the image size and style. One of:\n- `icon`: Small square icon.\n- `avatar`: Circular avatar image.\n- `smallFeature`: Small feature image.\n- `mediumFeature`: Medium feature image.\n- `largeFeature`: Large feature image.\n- `header`: Full-width, full bleed, header image.", + "enum": [ + "icon", + "avatar", + "smallFeature", + "mediumFeature", + "largeFeature", + "header" + ] + } + }, + "required": ["url"] + }, + "Icon": { + "type": "object", + "additionalProperties": false, + "properties": { "name": { + "type": "object", + "description": "The name of the icon to display. This can be a literal string or a reference to a value in the data model ('path', e.g. '/form/submit').", + "additionalProperties": false, + "properties": { + "literalString": { + "type": "string", + "enum": [ + "accountCircle", + "add", + "arrowBack", + "arrowForward", + "attachFile", + "calendarToday", + "call", + "camera", + "check", + "close", + "delete", + "download", + "edit", + "event", + "error", + "favorite", + "favoriteOff", + "folder", + "help", + "home", + "info", + "locationOn", + "lock", + "lockOpen", + "mail", + "menu", + "moreVert", + "moreHoriz", + "notificationsOff", + "notifications", + "payment", + "person", + "phone", + "photo", + "print", + "refresh", + "search", + "send", + "settings", + "share", + "shoppingCart", + "star", + "starHalf", + "starOff", + "upload", + "visibility", + "visibilityOff", + "warning" + ] + }, + "path": { "type": "string" } + } + } }, + "required": ["name"] + }, + "Video": { + "type": "object", + "additionalProperties": false, + "properties": { "url": { + "type": "object", + "description": "The URL of the video to display. This can be a literal string or a reference to a value in the data model ('path', e.g. '/video/url').", + "additionalProperties": false, + "properties": { + "literalString": { "type": "string" }, + "path": { "type": "string" } + } + } }, + "required": ["url"] + }, + "AudioPlayer": { + "type": "object", + "additionalProperties": false, + "properties": { + "url": { + "type": "object", + "description": "The URL of the audio to be played. This can be a literal string ('literal') or a reference to a value in the data model ('path', e.g. '/song/url').", + "additionalProperties": false, + "properties": { + "literalString": { "type": "string" }, + "path": { "type": "string" } + } + }, + "description": { + "type": "object", + "description": "A description of the audio, such as a title or summary. This can be a literal string or a reference to a value in the data model ('path', e.g. '/song/title').", + "additionalProperties": false, + "properties": { + "literalString": { "type": "string" }, + "path": { "type": "string" } + } + } + }, + "required": ["url"] + }, + "Row": { + "type": "object", + "additionalProperties": false, + "properties": { + "children": { + "type": "object", + "description": "Defines the children. Use 'explicitList' for a fixed set of children, or 'template' to generate children from a data list.", + "additionalProperties": false, + "properties": { + "explicitList": { + "type": "array", + "items": { "type": "string" } + }, + "template": { + "type": "object", + "description": "A template for generating a dynamic list of children from a data model list. `componentId` is the component to use as a template, and `dataBinding` is the path to the map of components in the data model. Values in the map will define the list of children.", + "additionalProperties": false, + "properties": { + "componentId": { "type": "string" }, + "dataBinding": { "type": "string" } + }, + "required": ["componentId", "dataBinding"] + } + } + }, + "distribution": { + "type": "string", + "description": "Defines the arrangement of children along the main axis (horizontally). This corresponds to the CSS 'justify-content' property.", + "enum": [ + "center", + "end", + "spaceAround", + "spaceBetween", + "spaceEvenly", + "start" + ] + }, + "alignment": { + "type": "string", + "description": "Defines the alignment of children along the cross axis (vertically). This corresponds to the CSS 'align-items' property.", + "enum": [ + "start", + "center", + "end", + "stretch" + ] + } + }, + "required": ["children"] + }, + "Column": { + "type": "object", + "additionalProperties": false, + "properties": { + "children": { + "type": "object", + "description": "Defines the children. Use 'explicitList' for a fixed set of children, or 'template' to generate children from a data list.", + "additionalProperties": false, + "properties": { + "explicitList": { + "type": "array", + "items": { "type": "string" } + }, + "template": { + "type": "object", + "description": "A template for generating a dynamic list of children from a data model list. `componentId` is the component to use as a template, and `dataBinding` is the path to the map of components in the data model. Values in the map will define the list of children.", + "additionalProperties": false, + "properties": { + "componentId": { "type": "string" }, + "dataBinding": { "type": "string" } + }, + "required": ["componentId", "dataBinding"] + } + } + }, + "distribution": { + "type": "string", + "description": "Defines the arrangement of children along the main axis (vertically). This corresponds to the CSS 'justify-content' property.", + "enum": [ + "start", + "center", + "end", + "spaceBetween", + "spaceAround", + "spaceEvenly" + ] + }, + "alignment": { + "type": "string", + "description": "Defines the alignment of children along the cross axis (horizontally). This corresponds to the CSS 'align-items' property.", + "enum": [ + "center", + "end", + "start", + "stretch" + ] + } + }, + "required": ["children"] + }, + "List": { + "type": "object", + "additionalProperties": false, + "properties": { + "children": { + "type": "object", + "description": "Defines the children. Use 'explicitList' for a fixed set of children, or 'template' to generate children from a data list.", + "additionalProperties": false, + "properties": { + "explicitList": { + "type": "array", + "items": { "type": "string" } + }, + "template": { + "type": "object", + "description": "A template for generating a dynamic list of children from a data model list. `componentId` is the component to use as a template, and `dataBinding` is the path to the map of components in the data model. Values in the map will define the list of children.", + "additionalProperties": false, + "properties": { + "componentId": { "type": "string" }, + "dataBinding": { "type": "string" } + }, + "required": ["componentId", "dataBinding"] + } + } + }, + "direction": { + "type": "string", + "description": "The direction in which the list items are laid out.", + "enum": ["vertical", "horizontal"] + }, + "alignment": { + "type": "string", + "description": "Defines the alignment of children along the cross axis.", + "enum": [ + "start", + "center", + "end", + "stretch" + ] + } + }, + "required": ["children"] + }, + "Card": { + "type": "object", + "additionalProperties": false, + "properties": { "child": { + "type": "string", + "description": "The ID of the component to be rendered inside the card." + } }, + "required": ["child"] + }, + "Tabs": { + "type": "object", + "additionalProperties": false, + "properties": { "tabItems": { + "type": "array", + "description": "An array of objects, where each object defines a tab with a title and a child component.", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "title": { + "type": "object", + "description": "The tab title. Defines the value as either a literal value or a path to data model value (e.g. '/options/title').", + "additionalProperties": false, + "properties": { + "literalString": { "type": "string" }, + "path": { "type": "string" } + } + }, + "child": { "type": "string" } + }, + "required": ["title", "child"] + } + } }, + "required": ["tabItems"] + }, + "Divider": { + "type": "object", + "additionalProperties": false, + "properties": { "axis": { + "type": "string", + "description": "The orientation of the divider.", + "enum": ["horizontal", "vertical"] + } } + }, + "Modal": { + "type": "object", + "additionalProperties": false, + "properties": { + "entryPointChild": { + "type": "string", + "description": "The ID of the component that opens the modal when interacted with (e.g., a button)." + }, + "contentChild": { + "type": "string", + "description": "The ID of the component to be displayed inside the modal." + } + }, + "required": ["entryPointChild", "contentChild"] + }, + "Button": { + "type": "object", + "additionalProperties": false, + "properties": { + "child": { + "type": "string", + "description": "The ID of the component to display in the button, typically a Text component." + }, + "primary": { + "type": "boolean", + "description": "Indicates if this button should be styled as the primary action." + }, + "action": { + "type": "object", + "description": "The client-side action to be dispatched when the button is clicked. It includes the action's name and an optional context payload.", + "additionalProperties": false, + "properties": { + "name": { "type": "string" }, + "context": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "key": { "type": "string" }, + "value": { + "type": "object", + "description": "Defines the value to be included in the context as either a literal value or a path to a data model value (e.g. '/user/name').", + "additionalProperties": false, + "properties": { + "path": { "type": "string" }, + "literalString": { "type": "string" }, + "literalNumber": { "type": "number" }, + "literalBoolean": { "type": "boolean" } + } + } + }, + "required": ["key", "value"] + } + } + }, + "required": ["name"] + } + }, + "required": ["child", "action"] + }, + "CheckBox": { + "type": "object", + "additionalProperties": false, + "properties": { + "label": { + "type": "object", + "description": "The text to display next to the checkbox. Defines the value as either a literal value or a path to data model ('path', e.g. '/option/label').", + "additionalProperties": false, + "properties": { + "literalString": { "type": "string" }, + "path": { "type": "string" } + } + }, + "value": { + "type": "object", + "description": "The current state of the checkbox (true for checked, false for unchecked). This can be a literal boolean ('literalBoolean') or a reference to a value in the data model ('path', e.g. '/filter/open').", + "additionalProperties": false, + "properties": { + "literalBoolean": { "type": "boolean" }, + "path": { "type": "string" } + } + } + }, + "required": ["label", "value"] + }, + "TextField": { + "type": "object", + "additionalProperties": false, + "properties": { + "label": { + "type": "object", + "description": "The text label for the input field. This can be a literal string or a reference to a value in the data model ('path, e.g. '/user/name').", + "additionalProperties": false, + "properties": { + "literalString": { "type": "string" }, + "path": { "type": "string" } + } + }, + "text": { + "type": "object", + "description": "The value of the text field. This can be a literal string or a reference to a value in the data model ('path', e.g. '/user/name').", + "additionalProperties": false, + "properties": { + "literalString": { "type": "string" }, + "path": { "type": "string" } + } + }, + "textFieldType": { + "type": "string", + "description": "The type of input field to display.", + "enum": [ + "date", + "longText", + "number", + "shortText", + "obscured" + ] + }, + "validationRegexp": { + "type": "string", + "description": "A regular expression used for client-side validation of the input." + } + }, + "required": ["label"] + }, + "DateTimeInput": { + "type": "object", + "additionalProperties": false, + "properties": { + "value": { + "type": "object", + "description": "The selected date and/or time value. This can be a literal string ('literalString') or a reference to a value in the data model ('path', e.g. '/user/dob').", + "additionalProperties": false, + "properties": { + "literalString": { "type": "string" }, + "path": { "type": "string" } + } + }, + "enableDate": { + "type": "boolean", + "description": "If true, allows the user to select a date." + }, + "enableTime": { + "type": "boolean", + "description": "If true, allows the user to select a time." + }, + "outputFormat": { + "type": "string", + "description": "The desired format for the output string after a date or time is selected." + } + }, + "required": ["value"] + }, + "MultipleChoice": { + "type": "object", + "additionalProperties": false, + "properties": { + "selections": { + "type": "object", + "description": "The currently selected values for the component. This can be a literal array of strings or a path to an array in the data model('path', e.g. '/hotel/options').", + "additionalProperties": false, + "properties": { + "literalArray": { + "type": "array", + "items": { "type": "string" } + }, + "path": { "type": "string" } + } + }, + "options": { + "type": "array", + "description": "An array of available options for the user to choose from.", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "label": { + "type": "object", + "description": "The text to display for this option. This can be a literal string or a reference to a value in the data model (e.g. '/option/label').", + "additionalProperties": false, + "properties": { + "literalString": { "type": "string" }, + "path": { "type": "string" } + } + }, + "value": { + "type": "string", + "description": "The value to be associated with this option when selected." + } + }, + "required": ["label", "value"] + } + }, + "maxAllowedSelections": { + "type": "integer", + "description": "The maximum number of options that the user is allowed to select." + } + }, + "required": ["selections", "options"] + }, + "Slider": { + "type": "object", + "additionalProperties": false, + "properties": { + "value": { + "type": "object", + "description": "The current value of the slider. This can be a literal number ('literalNumber') or a reference to a value in the data model ('path', e.g. '/restaurant/cost').", + "additionalProperties": false, + "properties": { + "literalNumber": { "type": "number" }, + "path": { "type": "string" } + } + }, + "minValue": { + "type": "number", + "description": "The minimum value of the slider." + }, + "maxValue": { + "type": "number", + "description": "The maximum value of the slider." + } + }, + "required": ["value"] + } + } + } + }, + "required": ["id", "component"] + } + } + }, + "required": ["surfaceId", "components"] + }, + "dataModelUpdate": { + "type": "object", + "description": "Updates the data model for a surface.", + "additionalProperties": false, + "properties": { + "surfaceId": { + "type": "string", + "description": "The unique identifier for the UI surface this data model update applies to." + }, + "path": { + "type": "string", + "description": "An optional path to a location within the data model (e.g., '/user/name'). If omitted, or set to '/', the entire data model will be replaced." + }, + "contents": { + "type": "array", + "description": "An array of data entries. Each entry must contain a 'key' and exactly one corresponding typed 'value*' property.", + "items": { + "type": "object", + "description": "A single data entry. Exactly one 'value*' property should be provided alongside the key.", + "additionalProperties": false, + "properties": { + "key": { + "type": "string", + "description": "The key for this data entry." + }, + "valueString": { "type": "string" }, + "valueNumber": { "type": "number" }, + "valueBoolean": { "type": "boolean" }, + "valueMap": { + "description": "Represents a map as an adjacency list.", + "type": "array", + "items": { + "type": "object", + "description": "One entry in the map. Exactly one 'value*' property should be provided alongside the key.", + "additionalProperties": false, + "properties": { + "key": { "type": "string" }, + "valueString": { "type": "string" }, + "valueNumber": { "type": "number" }, + "valueBoolean": { "type": "boolean" } + }, + "required": ["key"] + } + } + }, + "required": ["key"] + } + } + }, + "required": ["contents", "surfaceId"] + }, + "deleteSurface": { + "type": "object", + "description": "Signals the client to delete the surface identified by 'surfaceId'.", + "additionalProperties": false, + "properties": { "surfaceId": { + "type": "string", + "description": "The unique identifier for the UI surface to be deleted." + } }, + "required": ["surfaceId"] + } + } +}; + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/core.js +const Data = { + createSignalA2uiMessageProcessor: create, + A2uiMessageProcessor, + Guards: guards_exports +}; +const Schemas = { A2UIClientEventMessage: server_to_client_with_standard_catalog_default }; + +//#endregion +//#region node_modules/@lit/reactive-element/decorators/custom-element.js +/** +* @license +* Copyright 2017 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ +const t = (t$7) => (e$14, o$14) => { + void 0 !== o$14 ? o$14.addInitializer((() => { + customElements.define(t$7, e$14); + })) : customElements.define(t$7, e$14); +}; + +//#endregion +//#region node_modules/@lit/reactive-element/decorators/property.js +/** +* @license +* Copyright 2017 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ const o$8 = { + attribute: !0, + type: String, + converter: u, + reflect: !1, + hasChanged: f$2 +}, r$7 = (t$7 = o$8, e$14, r$11) => { + const { kind: n$11, metadata: i$10 } = r$11; + let s$9 = globalThis.litPropertyMetadata.get(i$10); + if (void 0 === s$9 && globalThis.litPropertyMetadata.set(i$10, s$9 = new Map()), "setter" === n$11 && ((t$7 = Object.create(t$7)).wrapped = !0), s$9.set(r$11.name, t$7), "accessor" === n$11) { + const { name: o$14 } = r$11; + return { + set(r$12) { + const n$12 = e$14.get.call(this); + e$14.set.call(this, r$12), this.requestUpdate(o$14, n$12, t$7); + }, + init(e$15) { + return void 0 !== e$15 && this.C(o$14, void 0, t$7, e$15), e$15; + } + }; + } + if ("setter" === n$11) { + const { name: o$14 } = r$11; + return function(r$12) { + const n$12 = this[o$14]; + e$14.call(this, r$12), this.requestUpdate(o$14, n$12, t$7); + }; + } + throw Error("Unsupported decorator location: " + n$11); +}; +function n(t$7) { + return (e$14, o$14) => "object" == typeof o$14 ? r$7(t$7, e$14, o$14) : ((t$8, e$15, o$15) => { + const r$11 = e$15.hasOwnProperty(o$15); + return e$15.constructor.createProperty(o$15, t$8), r$11 ? Object.getOwnPropertyDescriptor(e$15, o$15) : void 0; + })(t$7, e$14, o$14); +} + +//#endregion +//#region node_modules/@lit/reactive-element/decorators/state.js +/** +* @license +* Copyright 2017 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ function r(r$11) { + return n({ + ...r$11, + state: !0, + attribute: !1 + }); +} + +//#endregion +//#region node_modules/@lit/reactive-element/decorators/event-options.js +/** +* @license +* Copyright 2017 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ +function t$2(t$7) { + return (n$11, o$14) => { + const c$7 = "function" == typeof n$11 ? n$11 : n$11[o$14]; + Object.assign(c$7, t$7); + }; +} + +//#endregion +//#region node_modules/@lit/reactive-element/decorators/base.js +/** +* @license +* Copyright 2017 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ +const e$6 = (e$14, t$7, c$7) => (c$7.configurable = !0, c$7.enumerable = !0, Reflect.decorate && "object" != typeof t$7 && Object.defineProperty(e$14, t$7, c$7), c$7); + +//#endregion +//#region node_modules/@lit/reactive-element/decorators/query.js +/** +* @license +* Copyright 2017 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ function e$3(e$14, r$11) { + return (n$11, s$9, i$10) => { + const o$14 = (t$7) => t$7.renderRoot?.querySelector(e$14) ?? null; + if (r$11) { + const { get: e$15, set: r$12 } = "object" == typeof s$9 ? n$11 : i$10 ?? (() => { + const t$7 = Symbol(); + return { + get() { + return this[t$7]; + }, + set(e$16) { + this[t$7] = e$16; + } + }; + })(); + return e$6(n$11, s$9, { get() { + let t$7 = e$15.call(this); + return void 0 === t$7 && (t$7 = o$14(this), (null !== t$7 || this.hasUpdated) && r$12.call(this, t$7)), t$7; + } }); + } + return e$6(n$11, s$9, { get() { + return o$14(this); + } }); + }; +} + +//#endregion +//#region node_modules/@lit/reactive-element/decorators/query-all.js +/** +* @license +* Copyright 2017 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ +let e$7; +function r$6(r$11) { + return (n$11, o$14) => e$6(n$11, o$14, { get() { + return (this.renderRoot ?? (e$7 ??= document.createDocumentFragment())).querySelectorAll(r$11); + } }); +} + +//#endregion +//#region node_modules/@lit/reactive-element/decorators/query-async.js +/** +* @license +* Copyright 2017 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ +function r$5(r$11) { + return (n$11, e$14) => e$6(n$11, e$14, { async get() { + return await this.updateComplete, this.renderRoot?.querySelector(r$11) ?? null; + } }); +} + +//#endregion +//#region node_modules/@lit/reactive-element/decorators/query-assigned-elements.js +/** +* @license +* Copyright 2021 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ function o$7(o$14) { + return (e$14, n$11) => { + const { slot: r$11, selector: s$9 } = o$14 ?? {}, c$7 = "slot" + (r$11 ? `[name=${r$11}]` : ":not([name])"); + return e$6(e$14, n$11, { get() { + const t$7 = this.renderRoot?.querySelector(c$7), e$15 = t$7?.assignedElements(o$14) ?? []; + return void 0 === s$9 ? e$15 : e$15.filter(((t$8) => t$8.matches(s$9))); + } }); + }; +} + +//#endregion +//#region node_modules/@lit/reactive-element/decorators/query-assigned-nodes.js +/** +* @license +* Copyright 2017 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ function n$5(n$11) { + return (o$14, r$11) => { + const { slot: e$14 } = n$11 ?? {}, s$9 = "slot" + (e$14 ? `[name=${e$14}]` : ":not([name])"); + return e$6(o$14, r$11, { get() { + const t$7 = this.renderRoot?.querySelector(s$9); + return t$7?.assignedNodes(n$11) ?? []; + } }); + }; +} + +//#endregion +//#region node_modules/@lit-labs/signals/lib/signal-watcher.js +/** +* @license +* Copyright 2023 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ const i$6 = Symbol("SignalWatcherBrand"), s$1 = new FinalizationRegistry((({ watcher: t$7, signal: i$10 }) => { + t$7.unwatch(i$10); +})), h$3 = new WeakMap(); +function e$5(e$14) { + return !0 === e$14[i$6] ? (console.warn("SignalWatcher should not be applied to the same class more than once."), e$14) : class extends e$14 { + constructor() { + super(...arguments), this._$St = new Signal.State(0), this._$Si = !1, this._$So = !0, this._$Sh = new Set(); + } + _$Sl() { + if (void 0 !== this._$Su) return; + this._$Sv = new Signal.Computed((() => { + this._$St.get(), super.performUpdate(); + })); + const i$10 = this._$Su = new Signal.subtle.Watcher((function() { + const t$7 = h$3.get(this); + void 0 !== t$7 && (!1 === t$7._$Si && t$7.requestUpdate(), this.watch()); + })); + h$3.set(i$10, this), s$1.register(this, { + watcher: i$10, + signal: this._$Sv + }), i$10.watch(this._$Sv); + } + _$Sp() { + void 0 !== this._$Su && (this._$Su.unwatch(this._$Sv), this._$Sv = void 0, this._$Su = void 0); + } + performUpdate() { + this.isUpdatePending && (this._$Sl(), this._$Si = !0, this._$St.set(this._$St.get() + 1), this._$Si = !1, this._$Sv.get()); + } + update(t$7) { + try { + this._$So ? (this._$So = !1, super.update(t$7)) : this._$Sh.forEach(((t$8) => t$8.commit())); + } finally { + this.isUpdatePending = !1, this._$Sh.clear(); + } + } + requestUpdate(t$7, i$10, s$9) { + this._$So = !0, super.requestUpdate(t$7, i$10, s$9); + } + connectedCallback() { + super.connectedCallback(), this.requestUpdate(); + } + disconnectedCallback() { + super.disconnectedCallback(), queueMicrotask((() => { + !1 === this.isConnected && this._$Sp(); + })); + } + _(t$7) { + this._$Sh.add(t$7); + const i$10 = this._$So; + this.requestUpdate(), this._$So = i$10; + } + m(t$7) { + this._$Sh.delete(t$7); + } + }; +} + +//#endregion +//#region node_modules/lit-html/async-directive.js +/** +* @license +* Copyright 2017 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ const s = (i$10, t$7) => { + const e$14 = i$10._$AN; + if (void 0 === e$14) return !1; + for (const i$11 of e$14) i$11._$AO?.(t$7, !1), s(i$11, t$7); + return !0; +}, o$6 = (i$10) => { + let t$7, e$14; + do { + if (void 0 === (t$7 = i$10._$AM)) break; + e$14 = t$7._$AN, e$14.delete(i$10), i$10 = t$7; + } while (0 === e$14?.size); +}, r$4 = (i$10) => { + for (let t$7; t$7 = i$10._$AM; i$10 = t$7) { + let e$14 = t$7._$AN; + if (void 0 === e$14) t$7._$AN = e$14 = new Set(); + else if (e$14.has(i$10)) break; + e$14.add(i$10), c$2(t$7); + } +}; +function h$2(i$10) { + void 0 !== this._$AN ? (o$6(this), this._$AM = i$10, r$4(this)) : this._$AM = i$10; +} +function n$4(i$10, t$7 = !1, e$14 = 0) { + const r$11 = this._$AH, h$7 = this._$AN; + if (void 0 !== h$7 && 0 !== h$7.size) if (t$7) if (Array.isArray(r$11)) for (let i$11 = e$14; i$11 < r$11.length; i$11++) s(r$11[i$11], !1), o$6(r$11[i$11]); + else null != r$11 && (s(r$11, !1), o$6(r$11)); + else s(this, i$10); +} +const c$2 = (i$10) => { + i$10.type == t$1.CHILD && (i$10._$AP ??= n$4, i$10._$AQ ??= h$2); +}; +var f = class extends i$3 { + constructor() { + super(...arguments), this._$AN = void 0; + } + _$AT(i$10, t$7, e$14) { + super._$AT(i$10, t$7, e$14), r$4(this), this.isConnected = i$10._$AU; + } + _$AO(i$10, t$7 = !0) { + i$10 !== this.isConnected && (this.isConnected = i$10, i$10 ? this.reconnected?.() : this.disconnected?.()), t$7 && (s(this, i$10), o$6(this)); + } + setValue(t$7) { + if (f$1(this._$Ct)) this._$Ct._$AI(t$7, this); + else { + const i$10 = [...this._$Ct._$AH]; + i$10[this._$Ci] = t$7, this._$Ct._$AI(i$10, this, 0); + } + } + disconnected() {} + reconnected() {} +}; + +//#endregion +//#region node_modules/@lit-labs/signals/lib/watch.js +/** +* @license +* Copyright 2023 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ var h$1 = class extends f { + _$Sl() { + if (void 0 !== this._$Su) return; + this._$SW = new Signal.Computed((() => { + var i$11; + return null === (i$11 = this._$Sj) || void 0 === i$11 ? void 0 : i$11.get(); + })); + const i$10 = this._$Su = new Signal.subtle.Watcher((() => { + var t$7; + null === (t$7 = this._$SO) || void 0 === t$7 || t$7._(this), i$10.watch(); + })); + i$10.watch(this._$SW); + } + _$Sp() { + var i$10; + void 0 !== this._$Su && (this._$Su.unwatch(this._$SW), this._$SW = void 0, this._$Su = void 0, null === (i$10 = this._$SO) || void 0 === i$10 || i$10.m(this)); + } + commit() { + this.setValue(Signal.subtle.untrack((() => { + var i$10; + return null === (i$10 = this._$SW) || void 0 === i$10 ? void 0 : i$10.get(); + }))); + } + render(i$10) { + return Signal.subtle.untrack((() => i$10.get())); + } + update(i$10, [t$7]) { + var h$7, o$14; + return null !== (h$7 = this._$SO) && void 0 !== h$7 || (this._$SO = null === (o$14 = i$10.options) || void 0 === o$14 ? void 0 : o$14.host), t$7 !== this._$Sj && void 0 !== this._$Sj && this._$Sp(), this._$Sj = t$7, this._$Sl(), Signal.subtle.untrack((() => this._$SW.get())); + } + disconnected() { + this._$Sp(); + } + reconnected() { + this._$Sl(); + } +}; +const o$4 = e$1(h$1); + +//#endregion +//#region node_modules/@lit-labs/signals/lib/html-tag.js +/** +* @license +* Copyright 2023 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ const m = (o$14) => (t$7, ...m$3) => o$14(t$7, ...m$3.map(((o$15) => o$15 instanceof Signal.State || o$15 instanceof Signal.Computed ? o$4(o$15) : o$15))), l = m(x), r$2 = m(b); + +//#endregion +//#region node_modules/@lit-labs/signals/index.js +/** +* @license +* Copyright 2023 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ const l$1 = Signal.State, o$5 = Signal.Computed, r$3 = (l$5, o$14) => new Signal.State(l$5, o$14), i$5 = (l$5, o$14) => new Signal.Computed(l$5, o$14); + +//#endregion +//#region node_modules/lit-html/directives/map.js +/** +* @license +* Copyright 2021 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ +function* o$3(o$14, f$4) { + if (void 0 !== o$14) { + let i$10 = 0; + for (const t$7 of o$14) yield f$4(t$7, i$10++); + } +} + +//#endregion +//#region node_modules/signal-utils/dist/subtle/microtask-effect.ts.js +let pending = false; +let watcher = new Signal.subtle.Watcher(() => { + if (!pending) { + pending = true; + queueMicrotask(() => { + pending = false; + flushPending(); + }); + } +}); +function flushPending() { + for (const signal of watcher.getPending()) { + signal.get(); + } + watcher.watch(); +} +/** +* ⚠️ WARNING: Nothing unwatches ⚠️ +* This will produce a memory leak. +*/ +function effect(cb) { + let c$7 = new Signal.Computed(() => cb()); + watcher.watch(c$7); + c$7.get(); + return () => { + watcher.unwatch(c$7); + }; +} + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/ui/context/theme.js +const themeContext = n$3("A2UITheme"); + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/ui/styles.js +const structuralStyles = r$1(structuralStyles$1); + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/ui/component-registry.js +var ComponentRegistry = class { + constructor() { + this.registry = new Map(); + } + register(typeName, constructor, tagName) { + if (!/^[a-zA-Z0-9]+$/.test(typeName)) { + throw new Error(`[Registry] Invalid typeName '${typeName}'. Must be alphanumeric.`); + } + this.registry.set(typeName, constructor); + const actualTagName = tagName || `a2ui-custom-${typeName.toLowerCase()}`; + const existingName = customElements.getName(constructor); + if (existingName) { + if (existingName !== actualTagName) { + throw new Error(`Component ${typeName} is already registered as ${existingName}, but requested as ${actualTagName}.`); + } + return; + } + if (!customElements.get(actualTagName)) { + customElements.define(actualTagName, constructor); + } + } + get(typeName) { + return this.registry.get(typeName); + } +}; +const componentRegistry = new ComponentRegistry(); + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/ui/root.js +var __runInitializers$19 = void 0 && (void 0).__runInitializers || function(thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i$10 = 0; i$10 < initializers.length; i$10++) { + value = useValue ? initializers[i$10].call(thisArg, value) : initializers[i$10].call(thisArg); + } + return useValue ? value : void 0; +}; +var __esDecorate$19 = void 0 && (void 0).__esDecorate || function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f$4) { + if (f$4 !== void 0 && typeof f$4 !== "function") throw new TypeError("Function expected"); + return f$4; + } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _$1, done = false; + for (var i$10 = decorators.length - 1; i$10 >= 0; i$10--) { + var context = {}; + for (var p$3 in contextIn) context[p$3] = p$3 === "access" ? {} : contextIn[p$3]; + for (var p$3 in contextIn.access) context.access[p$3] = contextIn.access[p$3]; + context.addInitializer = function(f$4) { + if (done) throw new TypeError("Cannot add initializers after decoration has completed"); + extraInitializers.push(accept(f$4 || null)); + }; + var result = (0, decorators[i$10])(kind === "accessor" ? { + get: descriptor.get, + set: descriptor.set + } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_$1 = accept(result.get)) descriptor.get = _$1; + if (_$1 = accept(result.set)) descriptor.set = _$1; + if (_$1 = accept(result.init)) initializers.unshift(_$1); + } else if (_$1 = accept(result)) { + if (kind === "field") initializers.unshift(_$1); + else descriptor[key] = _$1; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; +}; +let Root = (() => { + let _classDecorators = [t("a2ui-root")]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _classSuper = e$5(i$1); + let _instanceExtraInitializers = []; + let _surfaceId_decorators; + let _surfaceId_initializers = []; + let _surfaceId_extraInitializers = []; + let _component_decorators; + let _component_initializers = []; + let _component_extraInitializers = []; + let _theme_decorators; + let _theme_initializers = []; + let _theme_extraInitializers = []; + let _childComponents_decorators; + let _childComponents_initializers = []; + let _childComponents_extraInitializers = []; + let _processor_decorators; + let _processor_initializers = []; + let _processor_extraInitializers = []; + let _dataContextPath_decorators; + let _dataContextPath_initializers = []; + let _dataContextPath_extraInitializers = []; + let _enableCustomElements_decorators; + let _enableCustomElements_initializers = []; + let _enableCustomElements_extraInitializers = []; + let _set_weight_decorators; + var Root$1 = class extends _classSuper { + static { + _classThis = this; + } + static { + const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0; + _surfaceId_decorators = [n()]; + _component_decorators = [n()]; + _theme_decorators = [c$1({ context: themeContext })]; + _childComponents_decorators = [n({ attribute: false })]; + _processor_decorators = [n({ attribute: false })]; + _dataContextPath_decorators = [n()]; + _enableCustomElements_decorators = [n()]; + _set_weight_decorators = [n()]; + __esDecorate$19(this, null, _surfaceId_decorators, { + kind: "accessor", + name: "surfaceId", + static: false, + private: false, + access: { + has: (obj) => "surfaceId" in obj, + get: (obj) => obj.surfaceId, + set: (obj, value) => { + obj.surfaceId = value; + } + }, + metadata: _metadata + }, _surfaceId_initializers, _surfaceId_extraInitializers); + __esDecorate$19(this, null, _component_decorators, { + kind: "accessor", + name: "component", + static: false, + private: false, + access: { + has: (obj) => "component" in obj, + get: (obj) => obj.component, + set: (obj, value) => { + obj.component = value; + } + }, + metadata: _metadata + }, _component_initializers, _component_extraInitializers); + __esDecorate$19(this, null, _theme_decorators, { + kind: "accessor", + name: "theme", + static: false, + private: false, + access: { + has: (obj) => "theme" in obj, + get: (obj) => obj.theme, + set: (obj, value) => { + obj.theme = value; + } + }, + metadata: _metadata + }, _theme_initializers, _theme_extraInitializers); + __esDecorate$19(this, null, _childComponents_decorators, { + kind: "accessor", + name: "childComponents", + static: false, + private: false, + access: { + has: (obj) => "childComponents" in obj, + get: (obj) => obj.childComponents, + set: (obj, value) => { + obj.childComponents = value; + } + }, + metadata: _metadata + }, _childComponents_initializers, _childComponents_extraInitializers); + __esDecorate$19(this, null, _processor_decorators, { + kind: "accessor", + name: "processor", + static: false, + private: false, + access: { + has: (obj) => "processor" in obj, + get: (obj) => obj.processor, + set: (obj, value) => { + obj.processor = value; + } + }, + metadata: _metadata + }, _processor_initializers, _processor_extraInitializers); + __esDecorate$19(this, null, _dataContextPath_decorators, { + kind: "accessor", + name: "dataContextPath", + static: false, + private: false, + access: { + has: (obj) => "dataContextPath" in obj, + get: (obj) => obj.dataContextPath, + set: (obj, value) => { + obj.dataContextPath = value; + } + }, + metadata: _metadata + }, _dataContextPath_initializers, _dataContextPath_extraInitializers); + __esDecorate$19(this, null, _enableCustomElements_decorators, { + kind: "accessor", + name: "enableCustomElements", + static: false, + private: false, + access: { + has: (obj) => "enableCustomElements" in obj, + get: (obj) => obj.enableCustomElements, + set: (obj, value) => { + obj.enableCustomElements = value; + } + }, + metadata: _metadata + }, _enableCustomElements_initializers, _enableCustomElements_extraInitializers); + __esDecorate$19(this, null, _set_weight_decorators, { + kind: "setter", + name: "weight", + static: false, + private: false, + access: { + has: (obj) => "weight" in obj, + set: (obj, value) => { + obj.weight = value; + } + }, + metadata: _metadata + }, null, _instanceExtraInitializers); + __esDecorate$19(null, _classDescriptor = { value: _classThis }, _classDecorators, { + kind: "class", + name: _classThis.name, + metadata: _metadata + }, null, _classExtraInitializers); + Root$1 = _classThis = _classDescriptor.value; + if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { + enumerable: true, + configurable: true, + writable: true, + value: _metadata + }); + } + #surfaceId_accessor_storage = (__runInitializers$19(this, _instanceExtraInitializers), __runInitializers$19(this, _surfaceId_initializers, null)); + get surfaceId() { + return this.#surfaceId_accessor_storage; + } + set surfaceId(value) { + this.#surfaceId_accessor_storage = value; + } + #component_accessor_storage = (__runInitializers$19(this, _surfaceId_extraInitializers), __runInitializers$19(this, _component_initializers, null)); + get component() { + return this.#component_accessor_storage; + } + set component(value) { + this.#component_accessor_storage = value; + } + #theme_accessor_storage = (__runInitializers$19(this, _component_extraInitializers), __runInitializers$19(this, _theme_initializers, void 0)); + get theme() { + return this.#theme_accessor_storage; + } + set theme(value) { + this.#theme_accessor_storage = value; + } + #childComponents_accessor_storage = (__runInitializers$19(this, _theme_extraInitializers), __runInitializers$19(this, _childComponents_initializers, null)); + get childComponents() { + return this.#childComponents_accessor_storage; + } + set childComponents(value) { + this.#childComponents_accessor_storage = value; + } + #processor_accessor_storage = (__runInitializers$19(this, _childComponents_extraInitializers), __runInitializers$19(this, _processor_initializers, null)); + get processor() { + return this.#processor_accessor_storage; + } + set processor(value) { + this.#processor_accessor_storage = value; + } + #dataContextPath_accessor_storage = (__runInitializers$19(this, _processor_extraInitializers), __runInitializers$19(this, _dataContextPath_initializers, "")); + get dataContextPath() { + return this.#dataContextPath_accessor_storage; + } + set dataContextPath(value) { + this.#dataContextPath_accessor_storage = value; + } + #enableCustomElements_accessor_storage = (__runInitializers$19(this, _dataContextPath_extraInitializers), __runInitializers$19(this, _enableCustomElements_initializers, false)); + get enableCustomElements() { + return this.#enableCustomElements_accessor_storage; + } + set enableCustomElements(value) { + this.#enableCustomElements_accessor_storage = value; + } + set weight(weight) { + this.#weight = weight; + this.style.setProperty("--weight", `${weight}`); + } + get weight() { + return this.#weight; + } + #weight = (__runInitializers$19(this, _enableCustomElements_extraInitializers), 1); + static { + this.styles = [structuralStyles, i` + :host { + display: flex; + flex-direction: column; + gap: 8px; + max-height: 80%; + } + `]; + } + /** + * Holds the cleanup function for our effect. + * We need this to stop the effect when the component is disconnected. + */ + #lightDomEffectDisposer = null; + willUpdate(changedProperties) { + if (changedProperties.has("childComponents")) { + if (this.#lightDomEffectDisposer) { + this.#lightDomEffectDisposer(); + } + this.#lightDomEffectDisposer = effect(() => { + const allChildren = this.childComponents ?? null; + const lightDomTemplate = this.renderComponentTree(allChildren); + B(lightDomTemplate, this, { host: this }); + }); + } + } + /** + * Clean up the effect when the component is removed from the DOM. + */ + disconnectedCallback() { + super.disconnectedCallback(); + if (this.#lightDomEffectDisposer) { + this.#lightDomEffectDisposer(); + } + } + /** + * Turns the SignalMap into a renderable TemplateResult for Lit. + */ + renderComponentTree(components) { + if (!components) { + return E; + } + if (!Array.isArray(components)) { + return E; + } + return x` ${o$3(components, (component) => { + if (this.enableCustomElements) { + const registeredCtor = componentRegistry.get(component.type); + const elCtor = registeredCtor || customElements.get(component.type); + if (elCtor) { + const node = component; + const el = new elCtor(); + el.id = node.id; + if (node.slotName) { + el.slot = node.slotName; + } + el.component = node; + el.weight = node.weight ?? "initial"; + el.processor = this.processor; + el.surfaceId = this.surfaceId; + el.dataContextPath = node.dataContextPath ?? "/"; + for (const [prop, val] of Object.entries(component.properties)) { + el[prop] = val; + } + return x`${el}`; + } + } + switch (component.type) { + case "List": { + const node = component; + const childComponents = node.properties.children; + return x``; + } + case "Card": { + const node = component; + let childComponents = node.properties.children; + if (!childComponents && node.properties.child) { + childComponents = [node.properties.child]; + } + return x``; + } + case "Column": { + const node = component; + return x``; + } + case "Row": { + const node = component; + return x``; + } + case "Image": { + const node = component; + return x``; + } + case "Icon": { + const node = component; + return x``; + } + case "AudioPlayer": { + const node = component; + return x``; + } + case "Button": { + const node = component; + return x``; + } + case "Text": { + const node = component; + return x``; + } + case "CheckBox": { + const node = component; + return x``; + } + case "DateTimeInput": { + const node = component; + return x``; + } + case "Divider": { + const node = component; + return x``; + } + case "MultipleChoice": { + const node = component; + return x``; + } + case "Slider": { + const node = component; + return x``; + } + case "TextField": { + const node = component; + return x``; + } + case "Video": { + const node = component; + return x``; + } + case "Tabs": { + const node = component; + const titles = []; + const childComponents = []; + if (node.properties.tabItems) { + for (const item of node.properties.tabItems) { + titles.push(item.title); + childComponents.push(item.child); + } + } + return x``; + } + case "Modal": { + const node = component; + const childComponents = [node.properties.entryPointChild, node.properties.contentChild]; + node.properties.entryPointChild.slotName = "entry"; + return x``; + } + default: { + return this.renderCustomComponent(component); + } + } + })}`; + } + renderCustomComponent(component) { + if (!this.enableCustomElements) { + return; + } + const node = component; + const registeredCtor = componentRegistry.get(component.type); + const elCtor = registeredCtor || customElements.get(component.type); + if (!elCtor) { + return x`Unknown element ${component.type}`; + } + const el = new elCtor(); + el.id = node.id; + if (node.slotName) { + el.slot = node.slotName; + } + el.component = node; + el.weight = node.weight ?? "initial"; + el.processor = this.processor; + el.surfaceId = this.surfaceId; + el.dataContextPath = node.dataContextPath ?? "/"; + for (const [prop, val] of Object.entries(component.properties)) { + el[prop] = val; + } + return x`${el}`; + } + render() { + return x``; + } + static { + __runInitializers$19(_classThis, _classExtraInitializers); + } + }; + return Root$1 = _classThis; +})(); + +//#endregion +//#region node_modules/lit-html/directives/class-map.js +/** +* @license +* Copyright 2018 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ const e = e$1(class extends i$3 { + constructor(t$7) { + if (super(t$7), t$7.type !== t$1.ATTRIBUTE || "class" !== t$7.name || t$7.strings?.length > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute."); + } + render(t$7) { + return " " + Object.keys(t$7).filter(((s$9) => t$7[s$9])).join(" ") + " "; + } + update(s$9, [i$10]) { + if (void 0 === this.st) { + this.st = new Set(), void 0 !== s$9.strings && (this.nt = new Set(s$9.strings.join(" ").split(/\s/).filter(((t$7) => "" !== t$7)))); + for (const t$7 in i$10) i$10[t$7] && !this.nt?.has(t$7) && this.st.add(t$7); + return this.render(i$10); + } + const r$11 = s$9.element.classList; + for (const t$7 of this.st) t$7 in i$10 || (r$11.remove(t$7), this.st.delete(t$7)); + for (const t$7 in i$10) { + const s$10 = !!i$10[t$7]; + s$10 === this.st.has(t$7) || this.nt?.has(t$7) || (s$10 ? (r$11.add(t$7), this.st.add(t$7)) : (r$11.remove(t$7), this.st.delete(t$7))); + } + return T; + } +}); + +//#endregion +//#region node_modules/lit-html/directives/style-map.js +/** +* @license +* Copyright 2018 Google LLC +* SPDX-License-Identifier: BSD-3-Clause +*/ const n$2 = "important", i$4 = " !" + n$2, o = e$1(class extends i$3 { + constructor(t$7) { + if (super(t$7), t$7.type !== t$1.ATTRIBUTE || "style" !== t$7.name || t$7.strings?.length > 2) throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute."); + } + render(t$7) { + return Object.keys(t$7).reduce(((e$14, r$11) => { + const s$9 = t$7[r$11]; + return null == s$9 ? e$14 : e$14 + `${r$11 = r$11.includes("-") ? r$11 : r$11.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${s$9};`; + }), ""); + } + update(e$14, [r$11]) { + const { style: s$9 } = e$14.element; + if (void 0 === this.ft) return this.ft = new Set(Object.keys(r$11)), this.render(r$11); + for (const t$7 of this.ft) null == r$11[t$7] && (this.ft.delete(t$7), t$7.includes("-") ? s$9.removeProperty(t$7) : s$9[t$7] = null); + for (const t$7 in r$11) { + const e$15 = r$11[t$7]; + if (null != e$15) { + this.ft.add(t$7); + const r$12 = "string" == typeof e$15 && e$15.endsWith(i$4); + t$7.includes("-") || r$12 ? s$9.setProperty(t$7, r$12 ? e$15.slice(0, -11) : e$15, r$12 ? n$2 : "") : s$9[t$7] = e$15; + } + } + return T; + } +}); + +//#endregion +//#region vendor/a2ui/renderers/lit/dist/src/0.8/ui/audio.js +var __esDecorate$18 = void 0 && (void 0).__esDecorate || function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f$4) { + if (f$4 !== void 0 && typeof f$4 !== "function") throw new TypeError("Function expected"); + return f$4; + } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _$1, done = false; + for (var i$10 = decorators.length - 1; i$10 >= 0; i$10--) { + var context = {}; + for (var p$3 in contextIn) context[p$3] = p$3 === "access" ? {} : contextIn[p$3]; + for (var p$3 in contextIn.access) context.access[p$3] = contextIn.access[p$3]; + context.addInitializer = function(f$4) { + if (done) throw new TypeError("Cannot add initializers after decoration has completed"); + extraInitializers.push(accept(f$4 || null)); + }; + var result = (0, decorators[i$10])(kind === "accessor" ? { + get: descriptor.get, + set: descriptor.set + } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_$1 = accept(result.get)) descriptor.get = _$1; + if (_$1 = accept(result.set)) descriptor.set = _$1; + if (_$1 = accept(result.init)) initializers.unshift(_$1); + } else if (_$1 = accept(result)) { + if (kind === "field") initializers.unshift(_$1); + else descriptor[key] = _$1; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; +}; +var __runInitializers$18 = void 0 && (void 0).__runInitializers || function(thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i$10 = 0; i$10 < initializers.length; i$10++) { + value = useValue ? initializers[i$10].call(thisArg, value) : initializers[i$10].call(thisArg); + } + return useValue ? value : void 0; +}; +let Audio = (() => { + let _classDecorators = [t("a2ui-audioplayer")]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _classSuper = Root; + let _url_decorators; + let _url_initializers = []; + let _url_extraInitializers = []; + var Audio$1 = class extends _classSuper { + static { + _classThis = this; + } + static { + const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0; + _url_decorators = [n()]; + __esDecorate$18(this, null, _url_decorators, { + kind: "accessor", + name: "url", + static: false, + private: false, + access: { + has: (obj) => "url" in obj, + get: (obj) => obj.url, + set: (obj, value) => { + obj.url = value; + } + }, + metadata: _metadata + }, _url_initializers, _url_extraInitializers); + __esDecorate$18(null, _classDescriptor = { value: _classThis }, _classDecorators, { + kind: "class", + name: _classThis.name, + metadata: _metadata + }, null, _classExtraInitializers); + Audio$1 = _classThis = _classDescriptor.value; + if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { + enumerable: true, + configurable: true, + writable: true, + value: _metadata + }); + } + #url_accessor_storage = __runInitializers$18(this, _url_initializers, null); + get url() { + return this.#url_accessor_storage; + } + set url(value) { + this.#url_accessor_storage = value; + } + static { + this.styles = [structuralStyles, i` + * { + box-sizing: border-box; + } + + :host { + display: block; + flex: var(--weight); + min-height: 0; + overflow: auto; + } + + audio { + display: block; + width: 100%; + } + `]; + } + #renderAudio() { + if (!this.url) { + return E; + } + if (this.url && typeof this.url === "object") { + if ("literalString" in this.url) { + return x`