@webskill/sdk 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1601 @@
1
+ import { dt as renderMiniMarkdown, et as A2UI_CHILDREN_PROP, ft as uiCatalog, it as WEBSKILL_A2UI_CATALOG_ID, ot as a2uiComponentShapes, ut as renderMiniChart } from "./dist-CtBLBbEz.js";
2
+ import { A2uiController, A2uiLitElement } from "@a2ui/lit/v0_9";
3
+ import { Catalog } from "@a2ui/web_core/v0_9";
4
+ import { z } from "zod/v3";
5
+
6
+ //#region ../../node_modules/.pnpm/@lit-labs+ssr-dom-shim@1.6.0/node_modules/@lit-labs/ssr-dom-shim/lib/element-internals.js
7
+ /**
8
+ * @license
9
+ * Copyright 2023 Google LLC
10
+ * SPDX-License-Identifier: BSD-3-Clause
11
+ */
12
+ const ElementInternalsShim = class ElementInternals {
13
+ get shadowRoot() {
14
+ return this.__host.__shadowRoot;
15
+ }
16
+ constructor(_host) {
17
+ this.ariaActiveDescendantElement = null;
18
+ this.ariaAtomic = "";
19
+ this.ariaAutoComplete = "";
20
+ this.ariaBrailleLabel = "";
21
+ this.ariaBrailleRoleDescription = "";
22
+ this.ariaBusy = "";
23
+ this.ariaChecked = "";
24
+ this.ariaColCount = "";
25
+ this.ariaColIndex = "";
26
+ this.ariaColIndexText = "";
27
+ this.ariaColSpan = "";
28
+ this.ariaControlsElements = null;
29
+ this.ariaCurrent = "";
30
+ this.ariaDescribedByElements = null;
31
+ this.ariaDescription = "";
32
+ this.ariaDetailsElements = null;
33
+ this.ariaDisabled = "";
34
+ this.ariaErrorMessageElements = null;
35
+ this.ariaExpanded = "";
36
+ this.ariaFlowToElements = null;
37
+ this.ariaHasPopup = "";
38
+ this.ariaHidden = "";
39
+ this.ariaInvalid = "";
40
+ this.ariaKeyShortcuts = "";
41
+ this.ariaLabel = "";
42
+ this.ariaLabelledByElements = null;
43
+ this.ariaLevel = "";
44
+ this.ariaLive = "";
45
+ this.ariaModal = "";
46
+ this.ariaMultiLine = "";
47
+ this.ariaMultiSelectable = "";
48
+ this.ariaOrientation = "";
49
+ this.ariaOwnsElements = null;
50
+ this.ariaPlaceholder = "";
51
+ this.ariaPosInSet = "";
52
+ this.ariaPressed = "";
53
+ this.ariaReadOnly = "";
54
+ this.ariaRelevant = "";
55
+ this.ariaRequired = "";
56
+ this.ariaRoleDescription = "";
57
+ this.ariaRowCount = "";
58
+ this.ariaRowIndex = "";
59
+ this.ariaRowIndexText = "";
60
+ this.ariaRowSpan = "";
61
+ this.ariaSelected = "";
62
+ this.ariaSetSize = "";
63
+ this.ariaSort = "";
64
+ this.ariaValueMax = "";
65
+ this.ariaValueMin = "";
66
+ this.ariaValueNow = "";
67
+ this.ariaValueText = "";
68
+ this.role = "";
69
+ this.form = null;
70
+ this.labels = [];
71
+ this.states = /* @__PURE__ */ new Set();
72
+ this.validationMessage = "";
73
+ this.validity = {};
74
+ this.willValidate = true;
75
+ this.__host = _host;
76
+ }
77
+ checkValidity() {
78
+ console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true.");
79
+ return true;
80
+ }
81
+ reportValidity() {
82
+ return true;
83
+ }
84
+ setFormValue() {}
85
+ setValidity() {}
86
+ };
87
+
88
+ //#endregion
89
+ //#region ../../node_modules/.pnpm/@lit-labs+ssr-dom-shim@1.6.0/node_modules/@lit-labs/ssr-dom-shim/lib/events.js
90
+ /**
91
+ * @license
92
+ * Copyright 2023 Google LLC
93
+ * SPDX-License-Identifier: BSD-3-Clause
94
+ */
95
+ var __classPrivateFieldSet = void 0 && (void 0).__classPrivateFieldSet || function(receiver, state, value, kind, f) {
96
+ if (kind === "m") throw new TypeError("Private method is not writable");
97
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
98
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
99
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
100
+ };
101
+ var __classPrivateFieldGet = void 0 && (void 0).__classPrivateFieldGet || function(receiver, state, kind, f) {
102
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
103
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
104
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
105
+ };
106
+ var _Event_cancelable;
107
+ var _Event_bubbles;
108
+ var _Event_composed;
109
+ var _Event_defaultPrevented;
110
+ var _Event_timestamp;
111
+ var _Event_propagationStopped;
112
+ var _Event_type;
113
+ var _Event_target;
114
+ var _Event_isBeingDispatched;
115
+ var _a$1;
116
+ var _CustomEvent_detail;
117
+ var _b;
118
+ const NONE = 0;
119
+ const CAPTURING_PHASE = 1;
120
+ const AT_TARGET = 2;
121
+ const BUBBLING_PHASE = 3;
122
+ const enumerableProperty$1 = { __proto__: null };
123
+ enumerableProperty$1.enumerable = true;
124
+ Object.freeze(enumerableProperty$1);
125
+ const EventShim = (_a$1 = class Event {
126
+ constructor(type, options = {}) {
127
+ _Event_cancelable.set(this, false);
128
+ _Event_bubbles.set(this, false);
129
+ _Event_composed.set(this, false);
130
+ _Event_defaultPrevented.set(this, false);
131
+ _Event_timestamp.set(this, Date.now());
132
+ _Event_propagationStopped.set(this, false);
133
+ _Event_type.set(this, void 0);
134
+ _Event_target.set(this, void 0);
135
+ _Event_isBeingDispatched.set(this, void 0);
136
+ this.NONE = NONE;
137
+ this.CAPTURING_PHASE = CAPTURING_PHASE;
138
+ this.AT_TARGET = AT_TARGET;
139
+ this.BUBBLING_PHASE = BUBBLING_PHASE;
140
+ if (arguments.length === 0) throw new Error(`The type argument must be specified`);
141
+ if (typeof options !== "object" || !options) throw new Error(`The "options" argument must be an object`);
142
+ const { bubbles, cancelable, composed } = options;
143
+ __classPrivateFieldSet(this, _Event_cancelable, !!cancelable, "f");
144
+ __classPrivateFieldSet(this, _Event_bubbles, !!bubbles, "f");
145
+ __classPrivateFieldSet(this, _Event_composed, !!composed, "f");
146
+ __classPrivateFieldSet(this, _Event_type, `${type}`, "f");
147
+ __classPrivateFieldSet(this, _Event_target, null, "f");
148
+ __classPrivateFieldSet(this, _Event_isBeingDispatched, false, "f");
149
+ }
150
+ initEvent(_type, _bubbles, _cancelable) {
151
+ throw new Error("Method not implemented.");
152
+ }
153
+ stopImmediatePropagation() {
154
+ this.stopPropagation();
155
+ }
156
+ preventDefault() {
157
+ __classPrivateFieldSet(this, _Event_defaultPrevented, true, "f");
158
+ }
159
+ get target() {
160
+ return __classPrivateFieldGet(this, _Event_target, "f");
161
+ }
162
+ get currentTarget() {
163
+ return __classPrivateFieldGet(this, _Event_target, "f");
164
+ }
165
+ get srcElement() {
166
+ return __classPrivateFieldGet(this, _Event_target, "f");
167
+ }
168
+ get type() {
169
+ return __classPrivateFieldGet(this, _Event_type, "f");
170
+ }
171
+ get cancelable() {
172
+ return __classPrivateFieldGet(this, _Event_cancelable, "f");
173
+ }
174
+ get defaultPrevented() {
175
+ return __classPrivateFieldGet(this, _Event_cancelable, "f") && __classPrivateFieldGet(this, _Event_defaultPrevented, "f");
176
+ }
177
+ get timeStamp() {
178
+ return __classPrivateFieldGet(this, _Event_timestamp, "f");
179
+ }
180
+ composedPath() {
181
+ return __classPrivateFieldGet(this, _Event_isBeingDispatched, "f") ? [__classPrivateFieldGet(this, _Event_target, "f")] : [];
182
+ }
183
+ get returnValue() {
184
+ return !__classPrivateFieldGet(this, _Event_cancelable, "f") || !__classPrivateFieldGet(this, _Event_defaultPrevented, "f");
185
+ }
186
+ get bubbles() {
187
+ return __classPrivateFieldGet(this, _Event_bubbles, "f");
188
+ }
189
+ get composed() {
190
+ return __classPrivateFieldGet(this, _Event_composed, "f");
191
+ }
192
+ get eventPhase() {
193
+ return __classPrivateFieldGet(this, _Event_isBeingDispatched, "f") ? _a$1.AT_TARGET : _a$1.NONE;
194
+ }
195
+ get cancelBubble() {
196
+ return __classPrivateFieldGet(this, _Event_propagationStopped, "f");
197
+ }
198
+ set cancelBubble(value) {
199
+ if (value) __classPrivateFieldSet(this, _Event_propagationStopped, true, "f");
200
+ }
201
+ stopPropagation() {
202
+ __classPrivateFieldSet(this, _Event_propagationStopped, true, "f");
203
+ }
204
+ get isTrusted() {
205
+ return false;
206
+ }
207
+ }, _Event_cancelable = /* @__PURE__ */ new WeakMap(), _Event_bubbles = /* @__PURE__ */ new WeakMap(), _Event_composed = /* @__PURE__ */ new WeakMap(), _Event_defaultPrevented = /* @__PURE__ */ new WeakMap(), _Event_timestamp = /* @__PURE__ */ new WeakMap(), _Event_propagationStopped = /* @__PURE__ */ new WeakMap(), _Event_type = /* @__PURE__ */ new WeakMap(), _Event_target = /* @__PURE__ */ new WeakMap(), _Event_isBeingDispatched = /* @__PURE__ */ new WeakMap(), _a$1.NONE = NONE, _a$1.CAPTURING_PHASE = CAPTURING_PHASE, _a$1.AT_TARGET = AT_TARGET, _a$1.BUBBLING_PHASE = BUBBLING_PHASE, _a$1);
208
+ Object.defineProperties(EventShim.prototype, {
209
+ initEvent: enumerableProperty$1,
210
+ stopImmediatePropagation: enumerableProperty$1,
211
+ preventDefault: enumerableProperty$1,
212
+ target: enumerableProperty$1,
213
+ currentTarget: enumerableProperty$1,
214
+ srcElement: enumerableProperty$1,
215
+ type: enumerableProperty$1,
216
+ cancelable: enumerableProperty$1,
217
+ defaultPrevented: enumerableProperty$1,
218
+ timeStamp: enumerableProperty$1,
219
+ composedPath: enumerableProperty$1,
220
+ returnValue: enumerableProperty$1,
221
+ bubbles: enumerableProperty$1,
222
+ composed: enumerableProperty$1,
223
+ eventPhase: enumerableProperty$1,
224
+ cancelBubble: enumerableProperty$1,
225
+ stopPropagation: enumerableProperty$1,
226
+ isTrusted: enumerableProperty$1
227
+ });
228
+ const CustomEventShim = (_b = class CustomEvent extends EventShim {
229
+ constructor(type, options = {}) {
230
+ super(type, options);
231
+ _CustomEvent_detail.set(this, void 0);
232
+ __classPrivateFieldSet(this, _CustomEvent_detail, options?.detail ?? null, "f");
233
+ }
234
+ initCustomEvent(_type, _bubbles, _cancelable, _detail) {
235
+ throw new Error("Method not implemented.");
236
+ }
237
+ get detail() {
238
+ return __classPrivateFieldGet(this, _CustomEvent_detail, "f");
239
+ }
240
+ }, _CustomEvent_detail = /* @__PURE__ */ new WeakMap(), _b);
241
+ Object.defineProperties(CustomEventShim.prototype, { detail: enumerableProperty$1 });
242
+ const EventShimWithRealType = EventShim;
243
+ const CustomEventShimWithRealType = CustomEventShim;
244
+
245
+ //#endregion
246
+ //#region ../../node_modules/.pnpm/@lit-labs+ssr-dom-shim@1.6.0/node_modules/@lit-labs/ssr-dom-shim/lib/css.js
247
+ /**
248
+ * @license
249
+ * Copyright 2024 Google LLC
250
+ * SPDX-License-Identifier: BSD-3-Clause
251
+ */
252
+ var _a;
253
+ const CSSRuleShim = (_a = class CSSRule {
254
+ constructor() {
255
+ this.STYLE_RULE = 1;
256
+ this.CHARSET_RULE = 2;
257
+ this.IMPORT_RULE = 3;
258
+ this.MEDIA_RULE = 4;
259
+ this.FONT_FACE_RULE = 5;
260
+ this.PAGE_RULE = 6;
261
+ this.NAMESPACE_RULE = 10;
262
+ this.KEYFRAMES_RULE = 7;
263
+ this.KEYFRAME_RULE = 8;
264
+ this.SUPPORTS_RULE = 12;
265
+ this.COUNTER_STYLE_RULE = 11;
266
+ this.FONT_FEATURE_VALUES_RULE = 14;
267
+ this.MARGIN_RULE = 9;
268
+ this.__parentStyleSheet = null;
269
+ this.cssText = "";
270
+ }
271
+ get parentRule() {
272
+ return null;
273
+ }
274
+ get parentStyleSheet() {
275
+ return this.__parentStyleSheet;
276
+ }
277
+ get type() {
278
+ return 0;
279
+ }
280
+ }, _a.STYLE_RULE = 1, _a.CHARSET_RULE = 2, _a.IMPORT_RULE = 3, _a.MEDIA_RULE = 4, _a.FONT_FACE_RULE = 5, _a.PAGE_RULE = 6, _a.NAMESPACE_RULE = 10, _a.KEYFRAMES_RULE = 7, _a.KEYFRAME_RULE = 8, _a.SUPPORTS_RULE = 12, _a.COUNTER_STYLE_RULE = 11, _a.FONT_FEATURE_VALUES_RULE = 14, _a.MARGIN_RULE = 9, _a);
281
+
282
+ //#endregion
283
+ //#region ../../node_modules/.pnpm/@lit-labs+ssr-dom-shim@1.6.0/node_modules/@lit-labs/ssr-dom-shim/index.js
284
+ /**
285
+ * @license
286
+ * Copyright 2019 Google LLC
287
+ * SPDX-License-Identifier: BSD-3-Clause
288
+ */
289
+ globalThis.Event ??= EventShimWithRealType;
290
+ globalThis.CustomEvent ??= CustomEventShimWithRealType;
291
+ const constructionToken = Symbol();
292
+ const isCaptureEventListener = (options) => typeof options === "boolean" ? options : options?.capture ?? false;
293
+ const enumerableProperty = { __proto__: null };
294
+ enumerableProperty.enumerable = true;
295
+ Object.freeze(enumerableProperty);
296
+ /**
297
+ * This is a basic implementation of an EventTarget.
298
+ *
299
+ * This is not fully spec compliant (e.g. validation),
300
+ * but should work well enough for our use cases.
301
+ *
302
+ * @see https://dom.spec.whatwg.org/#eventtarget
303
+ *
304
+ * Example Event Path
305
+ * ------------------
306
+ *
307
+ * Note that this depends on the logic in `packages/labs/ssr/src/lib/render-value.ts`.
308
+ * Any element that is not a custom element or a slot element is skipped in the chain.
309
+ *
310
+ * <main>
311
+ * <my-el1>
312
+ * #shadow-dom (open)
313
+ * <div>
314
+ * <slot></slot>
315
+ * <my-el2>
316
+ * #shadow-dom (closed)
317
+ * <slot></slot>
318
+ * <event-dispatcher3></event-dispatcher3>
319
+ * <slot name="nested"></slot>
320
+ * </my-el2>
321
+ * </div>
322
+ * <event-dispatcher1></event-dispatcher1>
323
+ * <event-dispatcher2 slot="nested"></event-dispatcher2>
324
+ * </my-el1>
325
+ * </main>
326
+ *
327
+ * Given the previous structure, the event path of this shim would be as follows,
328
+ * for the given dispatcher with an event that bubbles (document-fragment
329
+ * represents a ShadowRoot/#shadow-dom instance):
330
+ *
331
+ * <event-dispatcher1>:
332
+ * [event-dispatcher1, slot{my-el1}, document-fragment{my-el1}, my-el1, document]
333
+ *
334
+ * <event-dispatcher2>:
335
+ * [
336
+ * event-dispatcher2,
337
+ * slot[name="nested"]{my-el1},
338
+ * slot{my-el2},
339
+ * document-fragment{my-el2},
340
+ * my-el2,
341
+ * document-fragment{my-el1},
342
+ * my-el1,
343
+ * document
344
+ * ]
345
+ *
346
+ * <event-dispatcher3> (without composed):
347
+ * [event-dispatcher3, document-fragment{my-el2}]
348
+ *
349
+ * <event-dispatcher3> (composed):
350
+ * [
351
+ * event-dispatcher3,
352
+ * document-fragment{my-el2},
353
+ * my-el2,
354
+ * document-fragment{my-el1},
355
+ * my-el1,
356
+ * document
357
+ * ]
358
+ */
359
+ var EventTarget = class {
360
+ constructor() {
361
+ this.__eventListeners = /* @__PURE__ */ new Map();
362
+ this.__captureEventListeners = /* @__PURE__ */ new Map();
363
+ }
364
+ addEventListener(type, callback, options) {
365
+ if (callback === void 0 || callback === null) return;
366
+ const eventListenersMap = isCaptureEventListener(options) ? this.__captureEventListeners : this.__eventListeners;
367
+ let eventListeners = eventListenersMap.get(type);
368
+ if (eventListeners === void 0) {
369
+ eventListeners = /* @__PURE__ */ new Map();
370
+ eventListenersMap.set(type, eventListeners);
371
+ } else if (eventListeners.has(callback)) return;
372
+ const normalizedOptions = typeof options === "object" && options ? options : {};
373
+ normalizedOptions.signal?.addEventListener("abort", () => this.removeEventListener(type, callback, options));
374
+ eventListeners.set(callback, normalizedOptions ?? {});
375
+ }
376
+ removeEventListener(type, callback, options) {
377
+ if (callback === void 0 || callback === null) return;
378
+ const eventListenersMap = isCaptureEventListener(options) ? this.__captureEventListeners : this.__eventListeners;
379
+ const eventListeners = eventListenersMap.get(type);
380
+ if (eventListeners !== void 0) {
381
+ eventListeners.delete(callback);
382
+ if (!eventListeners.size) eventListenersMap.delete(type);
383
+ }
384
+ }
385
+ dispatchEvent(event) {
386
+ let composedPath = this.__resolveFullEventPath();
387
+ if (!event.composed && this.__host) composedPath = composedPath.slice(0, composedPath.indexOf(this.__host));
388
+ let stopPropagation = false;
389
+ let stopImmediatePropagation = false;
390
+ let eventPhase = EventShimWithRealType.NONE;
391
+ let target = null;
392
+ let tmpTarget = null;
393
+ let currentTarget = null;
394
+ const originalStopPropagation = event.stopPropagation;
395
+ const originalStopImmediatePropagation = event.stopImmediatePropagation;
396
+ Object.defineProperties(event, {
397
+ target: {
398
+ get() {
399
+ return target ?? tmpTarget;
400
+ },
401
+ ...enumerableProperty
402
+ },
403
+ srcElement: {
404
+ get() {
405
+ return event.target;
406
+ },
407
+ ...enumerableProperty
408
+ },
409
+ currentTarget: {
410
+ get() {
411
+ return currentTarget;
412
+ },
413
+ ...enumerableProperty
414
+ },
415
+ eventPhase: {
416
+ get() {
417
+ return eventPhase;
418
+ },
419
+ ...enumerableProperty
420
+ },
421
+ composedPath: {
422
+ value: () => composedPath,
423
+ ...enumerableProperty
424
+ },
425
+ stopPropagation: {
426
+ value: () => {
427
+ stopPropagation = true;
428
+ originalStopPropagation.call(event);
429
+ },
430
+ ...enumerableProperty
431
+ },
432
+ stopImmediatePropagation: {
433
+ value: () => {
434
+ stopImmediatePropagation = true;
435
+ originalStopImmediatePropagation.call(event);
436
+ },
437
+ ...enumerableProperty
438
+ }
439
+ });
440
+ const invokeEventListener = (listener, options, eventListenerMap) => {
441
+ if (typeof listener === "function") listener(event);
442
+ else if (typeof listener?.handleEvent === "function") listener.handleEvent(event);
443
+ if (options.once) eventListenerMap.delete(listener);
444
+ };
445
+ const finishDispatch = () => {
446
+ currentTarget = null;
447
+ eventPhase = EventShimWithRealType.NONE;
448
+ return !event.defaultPrevented;
449
+ };
450
+ const captureEventPath = composedPath.slice().reverse();
451
+ target = !this.__host || !event.composed ? this : null;
452
+ const retarget = (eventTargets) => {
453
+ tmpTarget = this;
454
+ while (tmpTarget.__host && eventTargets.includes(tmpTarget.__host)) tmpTarget = tmpTarget.__host;
455
+ };
456
+ for (const eventTarget of captureEventPath) {
457
+ if (!target && (!tmpTarget || tmpTarget === eventTarget.__host)) retarget(captureEventPath.slice(captureEventPath.indexOf(eventTarget)));
458
+ currentTarget = eventTarget;
459
+ eventPhase = eventTarget === event.target ? EventShimWithRealType.AT_TARGET : EventShimWithRealType.CAPTURING_PHASE;
460
+ const captureEventListeners = eventTarget.__captureEventListeners.get(event.type);
461
+ if (captureEventListeners) for (const [listener, options] of captureEventListeners) {
462
+ invokeEventListener(listener, options, captureEventListeners);
463
+ if (stopImmediatePropagation) return finishDispatch();
464
+ }
465
+ if (stopPropagation) return finishDispatch();
466
+ }
467
+ const bubbleEventPath = event.bubbles ? composedPath : [this];
468
+ tmpTarget = null;
469
+ for (const eventTarget of bubbleEventPath) {
470
+ if (!target && (!tmpTarget || eventTarget === tmpTarget.__host)) retarget(bubbleEventPath.slice(0, bubbleEventPath.indexOf(eventTarget) + 1));
471
+ currentTarget = eventTarget;
472
+ eventPhase = eventTarget === event.target ? EventShimWithRealType.AT_TARGET : EventShimWithRealType.BUBBLING_PHASE;
473
+ const eventListeners = eventTarget.__eventListeners.get(event.type);
474
+ if (eventListeners) for (const [listener, options] of eventListeners) {
475
+ invokeEventListener(listener, options, eventListeners);
476
+ if (stopImmediatePropagation) return finishDispatch();
477
+ }
478
+ if (stopPropagation) return finishDispatch();
479
+ }
480
+ return finishDispatch();
481
+ }
482
+ __resolveFullEventPath() {
483
+ if (this.__eventPathCache) return this.__eventPathCache;
484
+ else if (!this.__eventTargetParent) return this.__eventPathCache = [
485
+ this,
486
+ documentShim,
487
+ windowShim
488
+ ];
489
+ else return this.__eventPathCache = [this, ...this.__eventTargetParent.__resolveFullEventPath()];
490
+ }
491
+ };
492
+ const attributes = /* @__PURE__ */ new WeakMap();
493
+ const attributesForElement = (element) => {
494
+ let attrs = attributes.get(element);
495
+ if (attrs === void 0) attributes.set(element, attrs = /* @__PURE__ */ new Map());
496
+ return attrs;
497
+ };
498
+ const NodeShim = class Node extends EventTarget {
499
+ getRootNode(options) {
500
+ if (options?.composed) return document$1;
501
+ return this.__host?.__shadowRoot ?? document$1;
502
+ }
503
+ };
504
+ const DocumentShim = class Document extends NodeShim {
505
+ get adoptedStyleSheets() {
506
+ return [];
507
+ }
508
+ createTreeWalker() {
509
+ return {};
510
+ }
511
+ createTextNode() {
512
+ return {};
513
+ }
514
+ createElement() {
515
+ return {};
516
+ }
517
+ };
518
+ const documentShim = new DocumentShim();
519
+ const document$1 = documentShim;
520
+ const WindowShim = class Window extends NodeShim {
521
+ constructor(token) {
522
+ super();
523
+ if (token !== constructionToken) throw new TypeError("Illegal constructor");
524
+ Object.assign(this, globalThis, {
525
+ CustomElementRegistry,
526
+ customElements: customElements$1,
527
+ document: document$1,
528
+ Document: DocumentShim,
529
+ Element: ElementShim,
530
+ EventTarget,
531
+ HTMLElement: HTMLElementShim,
532
+ Node: NodeShim,
533
+ ShadowRoot: ShadowRootShim,
534
+ window: this,
535
+ Window: WindowShim
536
+ });
537
+ }
538
+ };
539
+ const ElementShim = class Element extends NodeShim {
540
+ constructor() {
541
+ super(...arguments);
542
+ this.__shadowRootMode = null;
543
+ this.__shadowRoot = null;
544
+ this.__internals = null;
545
+ }
546
+ get attributes() {
547
+ return Array.from(attributesForElement(this)).map(([name, value]) => ({
548
+ name,
549
+ value
550
+ }));
551
+ }
552
+ get shadowRoot() {
553
+ if (this.__shadowRootMode === "closed") return null;
554
+ return this.__shadowRoot;
555
+ }
556
+ get localName() {
557
+ return this.constructor.__localName;
558
+ }
559
+ get tagName() {
560
+ return this.localName?.toUpperCase();
561
+ }
562
+ setAttribute(name, value) {
563
+ attributesForElement(this).set(name, String(value));
564
+ }
565
+ removeAttribute(name) {
566
+ attributesForElement(this).delete(name);
567
+ }
568
+ toggleAttribute(name, force) {
569
+ if (this.hasAttribute(name)) {
570
+ if (force === void 0 || !force) {
571
+ this.removeAttribute(name);
572
+ return false;
573
+ }
574
+ } else if (force === void 0 || force) {
575
+ this.setAttribute(name, "");
576
+ return true;
577
+ } else return false;
578
+ return true;
579
+ }
580
+ hasAttribute(name) {
581
+ return attributesForElement(this).has(name);
582
+ }
583
+ attachShadow(init) {
584
+ this.__shadowRootMode = init.mode;
585
+ const shadowRoot = new ShadowRootShim(constructionToken, init);
586
+ shadowRoot.__eventTargetParent = this;
587
+ shadowRoot.__host = this;
588
+ return this.__shadowRoot = shadowRoot;
589
+ }
590
+ attachInternals() {
591
+ if (this.__internals !== null) throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");
592
+ const internals = new ElementInternalsShim(this);
593
+ this.__internals = internals;
594
+ return internals;
595
+ }
596
+ getAttribute(name) {
597
+ return attributesForElement(this).get(name) ?? null;
598
+ }
599
+ };
600
+ const HTMLElementShim = class HTMLElement extends ElementShim {};
601
+ const HTMLElementShimWithRealType = HTMLElementShim;
602
+ const ShadowRootShim = class ShadowRoot extends NodeShim {
603
+ get host() {
604
+ return this.__host;
605
+ }
606
+ constructor(constructionToken, init) {
607
+ super();
608
+ if (constructionToken !== constructionToken) throw new TypeError("Illegal constructor");
609
+ this.mode = init.mode;
610
+ }
611
+ };
612
+ globalThis.litServerRoot ??= Object.defineProperty(new HTMLElementShimWithRealType(), "localName", { get() {
613
+ return "lit-server-root";
614
+ } });
615
+ function promiseWithResolvers() {
616
+ let resolve;
617
+ let reject;
618
+ return {
619
+ promise: new Promise((res, rej) => {
620
+ resolve = res;
621
+ reject = rej;
622
+ }),
623
+ resolve,
624
+ reject
625
+ };
626
+ }
627
+ var CustomElementRegistry = class {
628
+ constructor() {
629
+ this.__definitions = /* @__PURE__ */ new Map();
630
+ this.__reverseDefinitions = /* @__PURE__ */ new Map();
631
+ this.__pendingWhenDefineds = /* @__PURE__ */ new Map();
632
+ }
633
+ define(name, ctor) {
634
+ if (this.__definitions.has(name)) if (process.env.NODE_ENV === "development") console.warn(`'CustomElementRegistry' already has "${name}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.\nMake sure to test your application with a production build as repeat registrations will throw in production.`);
635
+ else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${name}" has already been used with this registry`);
636
+ if (this.__reverseDefinitions.has(ctor)) throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(ctor)}`);
637
+ ctor.__localName = name;
638
+ this.__definitions.set(name, {
639
+ ctor,
640
+ observedAttributes: ctor.observedAttributes ?? []
641
+ });
642
+ this.__reverseDefinitions.set(ctor, name);
643
+ this.__pendingWhenDefineds.get(name)?.resolve(ctor);
644
+ this.__pendingWhenDefineds.delete(name);
645
+ }
646
+ get(name) {
647
+ return this.__definitions.get(name)?.ctor;
648
+ }
649
+ getName(ctor) {
650
+ return this.__reverseDefinitions.get(ctor) ?? null;
651
+ }
652
+ initialize(_root) {
653
+ throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.");
654
+ }
655
+ upgrade(_element) {
656
+ throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.");
657
+ }
658
+ async whenDefined(name) {
659
+ const definition = this.__definitions.get(name);
660
+ if (definition) return definition.ctor;
661
+ let withResolvers = this.__pendingWhenDefineds.get(name);
662
+ if (!withResolvers) {
663
+ withResolvers = promiseWithResolvers();
664
+ this.__pendingWhenDefineds.set(name, withResolvers);
665
+ }
666
+ return withResolvers.promise;
667
+ }
668
+ };
669
+ const CustomElementRegistryShimWithRealType = CustomElementRegistry;
670
+ const customElements$1 = new CustomElementRegistryShimWithRealType();
671
+ const windowShim = new WindowShim(constructionToken);
672
+
673
+ //#endregion
674
+ //#region ../../node_modules/.pnpm/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/node/css-tag.js
675
+ /**
676
+ * @license
677
+ * Copyright 2019 Google LLC
678
+ * SPDX-License-Identifier: BSD-3-Clause
679
+ */
680
+ const t$1 = globalThis;
681
+ const e$1 = t$1.ShadowRoot && (void 0 === t$1.ShadyCSS || t$1.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype;
682
+ const s$2 = Symbol();
683
+ const o$3 = /* @__PURE__ */ new WeakMap();
684
+ var n$2 = class {
685
+ constructor(t, e, o) {
686
+ if (this._$cssResult$ = !0, o !== s$2) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
687
+ this.cssText = t, this.t = e;
688
+ }
689
+ get styleSheet() {
690
+ let t = this.o;
691
+ const s = this.t;
692
+ if (e$1 && void 0 === t) {
693
+ const e = void 0 !== s && 1 === s.length;
694
+ e && (t = o$3.get(s)), void 0 === t && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), e && o$3.set(s, t));
695
+ }
696
+ return t;
697
+ }
698
+ toString() {
699
+ return this.cssText;
700
+ }
701
+ };
702
+ const r$2 = (t) => new n$2("string" == typeof t ? t : t + "", void 0, s$2);
703
+ const i$2 = (t, ...e) => {
704
+ const o = 1 === t.length ? t[0] : e.reduce((e, s, o) => e + ((t) => {
705
+ if (!0 === t._$cssResult$) return t.cssText;
706
+ if ("number" == typeof t) return t;
707
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + t + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
708
+ })(s) + t[o + 1], t[0]);
709
+ return new n$2(o, t, s$2);
710
+ };
711
+ const S$1 = (s, o) => {
712
+ if (e$1) s.adoptedStyleSheets = o.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
713
+ else for (const e of o) {
714
+ const o = document.createElement("style"), n = t$1.litNonce;
715
+ void 0 !== n && o.setAttribute("nonce", n), o.textContent = e.cssText, s.appendChild(o);
716
+ }
717
+ };
718
+ const c$2 = e$1 || void 0 === t$1.CSSStyleSheet ? (t) => t : (t) => t instanceof CSSStyleSheet ? ((t) => {
719
+ let e = "";
720
+ for (const s of t.cssRules) e += s.cssText;
721
+ return r$2(e);
722
+ })(t) : t;
723
+
724
+ //#endregion
725
+ //#region ../../node_modules/.pnpm/@lit+reactive-element@2.1.2/node_modules/@lit/reactive-element/node/reactive-element.js
726
+ const { is: h$1, defineProperty: r$1, getOwnPropertyDescriptor: o$2, getOwnPropertyNames: n$1, getOwnPropertySymbols: a$1, getPrototypeOf: c$1 } = Object, l$1 = globalThis;
727
+ l$1.customElements ??= customElements$1;
728
+ const p$1 = l$1.trustedTypes;
729
+ const d$1 = p$1 ? p$1.emptyScript : "";
730
+ const u$1 = l$1.reactiveElementPolyfillSupport;
731
+ const f$1 = (t, s) => t;
732
+ const b$1 = {
733
+ toAttribute(t, s) {
734
+ switch (s) {
735
+ case Boolean:
736
+ t = t ? d$1 : null;
737
+ break;
738
+ case Object:
739
+ case Array: t = null == t ? t : JSON.stringify(t);
740
+ }
741
+ return t;
742
+ },
743
+ fromAttribute(t, s) {
744
+ let i = t;
745
+ switch (s) {
746
+ case Boolean:
747
+ i = null !== t;
748
+ break;
749
+ case Number:
750
+ i = null === t ? null : Number(t);
751
+ break;
752
+ case Object:
753
+ case Array: try {
754
+ i = JSON.parse(t);
755
+ } catch (t) {
756
+ i = null;
757
+ }
758
+ }
759
+ return i;
760
+ }
761
+ };
762
+ const m$1 = (t, s) => !h$1(t, s);
763
+ const y$1 = {
764
+ attribute: !0,
765
+ type: String,
766
+ converter: b$1,
767
+ reflect: !1,
768
+ useDefault: !1,
769
+ hasChanged: m$1
770
+ };
771
+ Symbol.metadata ??= Symbol("metadata"), l$1.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
772
+ var g$1 = class extends (globalThis.HTMLElement ?? HTMLElementShimWithRealType) {
773
+ static addInitializer(t) {
774
+ this._$Ei(), (this.l ??= []).push(t);
775
+ }
776
+ static get observedAttributes() {
777
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
778
+ }
779
+ static createProperty(t, s = y$1) {
780
+ if (s.state && (s.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((s = Object.create(s)).wrapped = !0), this.elementProperties.set(t, s), !s.noAccessor) {
781
+ const i = Symbol(), e = this.getPropertyDescriptor(t, i, s);
782
+ void 0 !== e && r$1(this.prototype, t, e);
783
+ }
784
+ }
785
+ static getPropertyDescriptor(t, s, i) {
786
+ const { get: e, set: h } = o$2(this.prototype, t) ?? {
787
+ get() {
788
+ return this[s];
789
+ },
790
+ set(t) {
791
+ this[s] = t;
792
+ }
793
+ };
794
+ return {
795
+ get: e,
796
+ set(s) {
797
+ const r = e?.call(this);
798
+ h?.call(this, s), this.requestUpdate(t, r, i);
799
+ },
800
+ configurable: !0,
801
+ enumerable: !0
802
+ };
803
+ }
804
+ static getPropertyOptions(t) {
805
+ return this.elementProperties.get(t) ?? y$1;
806
+ }
807
+ static _$Ei() {
808
+ if (this.hasOwnProperty(f$1("elementProperties"))) return;
809
+ const t = c$1(this);
810
+ t.finalize(), void 0 !== t.l && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
811
+ }
812
+ static finalize() {
813
+ if (this.hasOwnProperty(f$1("finalized"))) return;
814
+ if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(f$1("properties"))) {
815
+ const t = this.properties, s = [...n$1(t), ...a$1(t)];
816
+ for (const i of s) this.createProperty(i, t[i]);
817
+ }
818
+ const t = this[Symbol.metadata];
819
+ if (null !== t) {
820
+ const s = litPropertyMetadata.get(t);
821
+ if (void 0 !== s) for (const [t, i] of s) this.elementProperties.set(t, i);
822
+ }
823
+ this._$Eh = /* @__PURE__ */ new Map();
824
+ for (const [t, s] of this.elementProperties) {
825
+ const i = this._$Eu(t, s);
826
+ void 0 !== i && this._$Eh.set(i, t);
827
+ }
828
+ this.elementStyles = this.finalizeStyles(this.styles);
829
+ }
830
+ static finalizeStyles(t) {
831
+ const s = [];
832
+ if (Array.isArray(t)) {
833
+ const e = new Set(t.flat(Infinity).reverse());
834
+ for (const t of e) s.unshift(c$2(t));
835
+ } else void 0 !== t && s.push(c$2(t));
836
+ return s;
837
+ }
838
+ static _$Eu(t, s) {
839
+ const i = s.attribute;
840
+ return !1 === i ? void 0 : "string" == typeof i ? i : "string" == typeof t ? t.toLowerCase() : void 0;
841
+ }
842
+ constructor() {
843
+ super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
844
+ }
845
+ _$Ev() {
846
+ this._$ES = new Promise((t) => this.enableUpdating = t), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((t) => t(this));
847
+ }
848
+ addController(t) {
849
+ (this._$EO ??= /* @__PURE__ */ new Set()).add(t), void 0 !== this.renderRoot && this.isConnected && t.hostConnected?.();
850
+ }
851
+ removeController(t) {
852
+ this._$EO?.delete(t);
853
+ }
854
+ _$E_() {
855
+ const t = /* @__PURE__ */ new Map(), s = this.constructor.elementProperties;
856
+ for (const i of s.keys()) this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
857
+ t.size > 0 && (this._$Ep = t);
858
+ }
859
+ createRenderRoot() {
860
+ const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
861
+ return S$1(t, this.constructor.elementStyles), t;
862
+ }
863
+ connectedCallback() {
864
+ this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((t) => t.hostConnected?.());
865
+ }
866
+ enableUpdating(t) {}
867
+ disconnectedCallback() {
868
+ this._$EO?.forEach((t) => t.hostDisconnected?.());
869
+ }
870
+ attributeChangedCallback(t, s, i) {
871
+ this._$AK(t, i);
872
+ }
873
+ _$ET(t, s) {
874
+ const i = this.constructor.elementProperties.get(t), e = this.constructor._$Eu(t, i);
875
+ if (void 0 !== e && !0 === i.reflect) {
876
+ const h = (void 0 !== i.converter?.toAttribute ? i.converter : b$1).toAttribute(s, i.type);
877
+ this._$Em = t, null == h ? this.removeAttribute(e) : this.setAttribute(e, h), this._$Em = null;
878
+ }
879
+ }
880
+ _$AK(t, s) {
881
+ const i = this.constructor, e = i._$Eh.get(t);
882
+ if (void 0 !== e && this._$Em !== e) {
883
+ const t = i.getPropertyOptions(e), h = "function" == typeof t.converter ? { fromAttribute: t.converter } : void 0 !== t.converter?.fromAttribute ? t.converter : b$1;
884
+ this._$Em = e;
885
+ const r = h.fromAttribute(s, t.type);
886
+ this[e] = r ?? this._$Ej?.get(e) ?? r, this._$Em = null;
887
+ }
888
+ }
889
+ requestUpdate(t, s, i, e = !1, h) {
890
+ if (void 0 !== t) {
891
+ const r = this.constructor;
892
+ if (!1 === e && (h = this[t]), i ??= r.getPropertyOptions(t), !((i.hasChanged ?? m$1)(h, s) || i.useDefault && i.reflect && h === this._$Ej?.get(t) && !this.hasAttribute(r._$Eu(t, i)))) return;
893
+ this.C(t, s, i);
894
+ }
895
+ !1 === this.isUpdatePending && (this._$ES = this._$EP());
896
+ }
897
+ C(t, s, { useDefault: i, reflect: e, wrapped: h }, r) {
898
+ i && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, r ?? s ?? this[t]), !0 !== h || void 0 !== r) || (this._$AL.has(t) || (this.hasUpdated || i || (s = void 0), this._$AL.set(t, s)), !0 === e && this._$Em !== t && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t));
899
+ }
900
+ async _$EP() {
901
+ this.isUpdatePending = !0;
902
+ try {
903
+ await this._$ES;
904
+ } catch (t) {
905
+ Promise.reject(t);
906
+ }
907
+ const t = this.scheduleUpdate();
908
+ return null != t && await t, !this.isUpdatePending;
909
+ }
910
+ scheduleUpdate() {
911
+ return this.performUpdate();
912
+ }
913
+ performUpdate() {
914
+ if (!this.isUpdatePending) return;
915
+ if (!this.hasUpdated) {
916
+ if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
917
+ for (const [t, s] of this._$Ep) this[t] = s;
918
+ this._$Ep = void 0;
919
+ }
920
+ const t = this.constructor.elementProperties;
921
+ if (t.size > 0) for (const [s, i] of t) {
922
+ const { wrapped: t } = i, e = this[s];
923
+ !0 !== t || this._$AL.has(s) || void 0 === e || this.C(s, void 0, i, e);
924
+ }
925
+ }
926
+ let t = !1;
927
+ const s = this._$AL;
928
+ try {
929
+ t = this.shouldUpdate(s), t ? (this.willUpdate(s), this._$EO?.forEach((t) => t.hostUpdate?.()), this.update(s)) : this._$EM();
930
+ } catch (s) {
931
+ throw t = !1, this._$EM(), s;
932
+ }
933
+ t && this._$AE(s);
934
+ }
935
+ willUpdate(t) {}
936
+ _$AE(t) {
937
+ this._$EO?.forEach((t) => t.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
938
+ }
939
+ _$EM() {
940
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
941
+ }
942
+ get updateComplete() {
943
+ return this.getUpdateComplete();
944
+ }
945
+ getUpdateComplete() {
946
+ return this._$ES;
947
+ }
948
+ shouldUpdate(t) {
949
+ return !0;
950
+ }
951
+ update(t) {
952
+ this._$Eq &&= this._$Eq.forEach((t) => this._$ET(t, this[t])), this._$EM();
953
+ }
954
+ updated(t) {}
955
+ firstUpdated(t) {}
956
+ };
957
+ g$1.elementStyles = [], g$1.shadowRootOptions = { mode: "open" }, g$1[f$1("elementProperties")] = /* @__PURE__ */ new Map(), g$1[f$1("finalized")] = /* @__PURE__ */ new Map(), u$1?.({ ReactiveElement: g$1 }), (l$1.reactiveElementVersions ??= []).push("2.1.2");
958
+
959
+ //#endregion
960
+ //#region ../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/node/lit-html.js
961
+ /**
962
+ * @license
963
+ * Copyright 2017 Google LLC
964
+ * SPDX-License-Identifier: BSD-3-Clause
965
+ */
966
+ const t = globalThis;
967
+ const i$1 = (t) => t;
968
+ const s$1 = t.trustedTypes;
969
+ const e = s$1 ? s$1.createPolicy("lit-html", { createHTML: (t) => t }) : void 0;
970
+ const h = "$lit$";
971
+ const o$1 = `lit$${Math.random().toFixed(9).slice(2)}$`;
972
+ const n = "?" + o$1;
973
+ const r = `<${n}>`;
974
+ const l = void 0 === t.document ? { createTreeWalker: () => ({}) } : document;
975
+ const c = () => l.createComment("");
976
+ const a = (t) => null === t || "object" != typeof t && "function" != typeof t;
977
+ const u = Array.isArray;
978
+ const d = (t) => u(t) || "function" == typeof t?.[Symbol.iterator];
979
+ const f = "[ \n\f\r]";
980
+ const v = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g;
981
+ const _ = /-->/g;
982
+ const m = />/g;
983
+ const p = RegExp(`>|${f}(?:([^\\s"'>=/]+)(${f}*=${f}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g");
984
+ const g = /'/g;
985
+ const $ = /"/g;
986
+ const y = /^(?:script|style|textarea|title)$/i;
987
+ const x = (t) => (i, ...s) => ({
988
+ _$litType$: t,
989
+ strings: i,
990
+ values: s
991
+ });
992
+ const T = x(1);
993
+ const b = x(2);
994
+ const w = x(3);
995
+ const E = Symbol.for("lit-noChange");
996
+ const A = Symbol.for("lit-nothing");
997
+ const C = /* @__PURE__ */ new WeakMap();
998
+ const P = l.createTreeWalker(l, 129);
999
+ function V(t, i) {
1000
+ if (!u(t) || !t.hasOwnProperty("raw")) throw Error("invalid template strings array");
1001
+ return void 0 !== e ? e.createHTML(i) : i;
1002
+ }
1003
+ const N = (t, i) => {
1004
+ const s = t.length - 1, e = [];
1005
+ let n, l = 2 === i ? "<svg>" : 3 === i ? "<math>" : "", c = v;
1006
+ for (let i = 0; i < s; i++) {
1007
+ const s = t[i];
1008
+ let a, u, d = -1, f = 0;
1009
+ for (; f < s.length && (c.lastIndex = f, u = c.exec(s), null !== u);) f = c.lastIndex, c === v ? "!--" === u[1] ? c = _ : void 0 !== u[1] ? c = m : void 0 !== u[2] ? (y.test(u[2]) && (n = RegExp("</" + u[2], "g")), c = p) : void 0 !== u[3] && (c = p) : c === p ? ">" === u[0] ? (c = n ?? v, d = -1) : void 0 === u[1] ? d = -2 : (d = c.lastIndex - u[2].length, a = u[1], c = void 0 === u[3] ? p : "\"" === u[3] ? $ : g) : c === $ || c === g ? c = p : c === _ || c === m ? c = v : (c = p, n = void 0);
1010
+ const x = c === p && t[i + 1].startsWith("/>") ? " " : "";
1011
+ l += c === v ? s + r : d >= 0 ? (e.push(a), s.slice(0, d) + h + s.slice(d) + o$1 + x) : s + o$1 + (-2 === d ? i : x);
1012
+ }
1013
+ return [V(t, l + (t[s] || "<?>") + (2 === i ? "</svg>" : 3 === i ? "</math>" : "")), e];
1014
+ };
1015
+ var S = class S {
1016
+ constructor({ strings: t, _$litType$: i }, e) {
1017
+ let r;
1018
+ this.parts = [];
1019
+ let l = 0, a = 0;
1020
+ const u = t.length - 1, d = this.parts, [f, v] = N(t, i);
1021
+ if (this.el = S.createElement(f, e), P.currentNode = this.el.content, 2 === i || 3 === i) {
1022
+ const t = this.el.content.firstChild;
1023
+ t.replaceWith(...t.childNodes);
1024
+ }
1025
+ for (; null !== (r = P.nextNode()) && d.length < u;) {
1026
+ if (1 === r.nodeType) {
1027
+ if (r.hasAttributes()) for (const t of r.getAttributeNames()) if (t.endsWith(h)) {
1028
+ const i = v[a++], s = r.getAttribute(t).split(o$1), e = /([.?@])?(.*)/.exec(i);
1029
+ d.push({
1030
+ type: 1,
1031
+ index: l,
1032
+ name: e[2],
1033
+ strings: s,
1034
+ ctor: "." === e[1] ? I : "?" === e[1] ? L : "@" === e[1] ? z$1 : H
1035
+ }), r.removeAttribute(t);
1036
+ } else t.startsWith(o$1) && (d.push({
1037
+ type: 6,
1038
+ index: l
1039
+ }), r.removeAttribute(t));
1040
+ if (y.test(r.tagName)) {
1041
+ const t = r.textContent.split(o$1), i = t.length - 1;
1042
+ if (i > 0) {
1043
+ r.textContent = s$1 ? s$1.emptyScript : "";
1044
+ for (let s = 0; s < i; s++) r.append(t[s], c()), P.nextNode(), d.push({
1045
+ type: 2,
1046
+ index: ++l
1047
+ });
1048
+ r.append(t[i], c());
1049
+ }
1050
+ }
1051
+ } else if (8 === r.nodeType) if (r.data === n) d.push({
1052
+ type: 2,
1053
+ index: l
1054
+ });
1055
+ else {
1056
+ let t = -1;
1057
+ for (; -1 !== (t = r.data.indexOf(o$1, t + 1));) d.push({
1058
+ type: 7,
1059
+ index: l
1060
+ }), t += o$1.length - 1;
1061
+ }
1062
+ l++;
1063
+ }
1064
+ }
1065
+ static createElement(t, i) {
1066
+ const s = l.createElement("template");
1067
+ return s.innerHTML = t, s;
1068
+ }
1069
+ };
1070
+ function M(t, i, s = t, e) {
1071
+ if (i === E) return i;
1072
+ let h = void 0 !== e ? s._$Co?.[e] : s._$Cl;
1073
+ const o = a(i) ? void 0 : i._$litDirective$;
1074
+ return h?.constructor !== o && (h?._$AO?.(!1), void 0 === o ? h = void 0 : (h = new o(t), h._$AT(t, s, e)), void 0 !== e ? (s._$Co ??= [])[e] = h : s._$Cl = h), void 0 !== h && (i = M(t, h._$AS(t, i.values), h, e)), i;
1075
+ }
1076
+ var k = class {
1077
+ constructor(t, i) {
1078
+ this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = i;
1079
+ }
1080
+ get parentNode() {
1081
+ return this._$AM.parentNode;
1082
+ }
1083
+ get _$AU() {
1084
+ return this._$AM._$AU;
1085
+ }
1086
+ u(t) {
1087
+ const { el: { content: i }, parts: s } = this._$AD, e = (t?.creationScope ?? l).importNode(i, !0);
1088
+ P.currentNode = e;
1089
+ let h = P.nextNode(), o = 0, n = 0, r = s[0];
1090
+ for (; void 0 !== r;) {
1091
+ if (o === r.index) {
1092
+ let i;
1093
+ 2 === r.type ? i = new R(h, h.nextSibling, this, t) : 1 === r.type ? i = new r.ctor(h, r.name, r.strings, this, t) : 6 === r.type && (i = new W(h, this, t)), this._$AV.push(i), r = s[++n];
1094
+ }
1095
+ o !== r?.index && (h = P.nextNode(), o++);
1096
+ }
1097
+ return P.currentNode = l, e;
1098
+ }
1099
+ p(t) {
1100
+ let i = 0;
1101
+ for (const s of this._$AV) void 0 !== s && (void 0 !== s.strings ? (s._$AI(t, s, i), i += s.strings.length - 2) : s._$AI(t[i])), i++;
1102
+ }
1103
+ };
1104
+ var R = class R {
1105
+ get _$AU() {
1106
+ return this._$AM?._$AU ?? this._$Cv;
1107
+ }
1108
+ constructor(t, i, s, e) {
1109
+ this.type = 2, this._$AH = A, this._$AN = void 0, this._$AA = t, this._$AB = i, this._$AM = s, this.options = e, this._$Cv = e?.isConnected ?? !0;
1110
+ }
1111
+ get parentNode() {
1112
+ let t = this._$AA.parentNode;
1113
+ const i = this._$AM;
1114
+ return void 0 !== i && 11 === t?.nodeType && (t = i.parentNode), t;
1115
+ }
1116
+ get startNode() {
1117
+ return this._$AA;
1118
+ }
1119
+ get endNode() {
1120
+ return this._$AB;
1121
+ }
1122
+ _$AI(t, i = this) {
1123
+ t = M(this, t, i), a(t) ? t === A || null == t || "" === t ? (this._$AH !== A && this._$AR(), this._$AH = A) : t !== this._$AH && t !== E && this._(t) : void 0 !== t._$litType$ ? this.$(t) : void 0 !== t.nodeType ? this.T(t) : d(t) ? this.k(t) : this._(t);
1124
+ }
1125
+ O(t) {
1126
+ return this._$AA.parentNode.insertBefore(t, this._$AB);
1127
+ }
1128
+ T(t) {
1129
+ this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
1130
+ }
1131
+ _(t) {
1132
+ this._$AH !== A && a(this._$AH) ? this._$AA.nextSibling.data = t : this.T(l.createTextNode(t)), this._$AH = t;
1133
+ }
1134
+ $(t) {
1135
+ const { values: i, _$litType$: s } = t, e = "number" == typeof s ? this._$AC(t) : (void 0 === s.el && (s.el = S.createElement(V(s.h, s.h[0]), this.options)), s);
1136
+ if (this._$AH?._$AD === e) this._$AH.p(i);
1137
+ else {
1138
+ const t = new k(e, this), s = t.u(this.options);
1139
+ t.p(i), this.T(s), this._$AH = t;
1140
+ }
1141
+ }
1142
+ _$AC(t) {
1143
+ let i = C.get(t.strings);
1144
+ return void 0 === i && C.set(t.strings, i = new S(t)), i;
1145
+ }
1146
+ k(t) {
1147
+ u(this._$AH) || (this._$AH = [], this._$AR());
1148
+ const i = this._$AH;
1149
+ let s, e = 0;
1150
+ for (const h of t) e === i.length ? i.push(s = new R(this.O(c()), this.O(c()), this, this.options)) : s = i[e], s._$AI(h), e++;
1151
+ e < i.length && (this._$AR(s && s._$AB.nextSibling, e), i.length = e);
1152
+ }
1153
+ _$AR(t = this._$AA.nextSibling, s) {
1154
+ for (this._$AP?.(!1, !0, s); t !== this._$AB;) {
1155
+ const s = i$1(t).nextSibling;
1156
+ i$1(t).remove(), t = s;
1157
+ }
1158
+ }
1159
+ setConnected(t) {
1160
+ void 0 === this._$AM && (this._$Cv = t, this._$AP?.(t));
1161
+ }
1162
+ };
1163
+ var H = class {
1164
+ get tagName() {
1165
+ return this.element.tagName;
1166
+ }
1167
+ get _$AU() {
1168
+ return this._$AM._$AU;
1169
+ }
1170
+ constructor(t, i, s, e, h) {
1171
+ this.type = 1, this._$AH = A, this._$AN = void 0, this.element = t, this.name = i, this._$AM = e, this.options = h, s.length > 2 || "" !== s[0] || "" !== s[1] ? (this._$AH = Array(s.length - 1).fill(/* @__PURE__ */ new String()), this.strings = s) : this._$AH = A;
1172
+ }
1173
+ _$AI(t, i = this, s, e) {
1174
+ const h = this.strings;
1175
+ let o = !1;
1176
+ if (void 0 === h) t = M(this, t, i, 0), o = !a(t) || t !== this._$AH && t !== E, o && (this._$AH = t);
1177
+ else {
1178
+ const e = t;
1179
+ let n, r;
1180
+ for (t = h[0], n = 0; n < h.length - 1; n++) r = M(this, e[s + n], i, n), r === E && (r = this._$AH[n]), o ||= !a(r) || r !== this._$AH[n], r === A ? t = A : t !== A && (t += (r ?? "") + h[n + 1]), this._$AH[n] = r;
1181
+ }
1182
+ o && !e && this.j(t);
1183
+ }
1184
+ j(t) {
1185
+ t === A ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
1186
+ }
1187
+ };
1188
+ var I = class extends H {
1189
+ constructor() {
1190
+ super(...arguments), this.type = 3;
1191
+ }
1192
+ j(t) {
1193
+ this.element[this.name] = t === A ? void 0 : t;
1194
+ }
1195
+ };
1196
+ var L = class extends H {
1197
+ constructor() {
1198
+ super(...arguments), this.type = 4;
1199
+ }
1200
+ j(t) {
1201
+ this.element.toggleAttribute(this.name, !!t && t !== A);
1202
+ }
1203
+ };
1204
+ var z$1 = class extends H {
1205
+ constructor(t, i, s, e, h) {
1206
+ super(t, i, s, e, h), this.type = 5;
1207
+ }
1208
+ _$AI(t, i = this) {
1209
+ if ((t = M(this, t, i, 0) ?? A) === E) return;
1210
+ const s = this._$AH, e = t === A && s !== A || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, h = t !== A && (s === A || e);
1211
+ e && this.element.removeEventListener(this.name, this, s), h && this.element.addEventListener(this.name, this, t), this._$AH = t;
1212
+ }
1213
+ handleEvent(t) {
1214
+ "function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t);
1215
+ }
1216
+ };
1217
+ var W = class {
1218
+ constructor(t, i, s) {
1219
+ this.element = t, this.type = 6, this._$AN = void 0, this._$AM = i, this.options = s;
1220
+ }
1221
+ get _$AU() {
1222
+ return this._$AM._$AU;
1223
+ }
1224
+ _$AI(t) {
1225
+ M(this, t);
1226
+ }
1227
+ };
1228
+ const j = t.litHtmlPolyfillSupport;
1229
+ j?.(S, R), (t.litHtmlVersions ??= []).push("3.3.3");
1230
+ const B = (t, i, s) => {
1231
+ const e = s?.renderBefore ?? i;
1232
+ let h = e._$litPart$;
1233
+ if (void 0 === h) {
1234
+ const t = s?.renderBefore ?? null;
1235
+ e._$litPart$ = h = new R(i.insertBefore(c(), t), t, void 0, s ?? {});
1236
+ }
1237
+ return h._$AI(t), h;
1238
+ };
1239
+
1240
+ //#endregion
1241
+ //#region ../../node_modules/.pnpm/lit-element@4.2.2/node_modules/lit-element/lit-element.js
1242
+ /**
1243
+ * @license
1244
+ * Copyright 2017 Google LLC
1245
+ * SPDX-License-Identifier: BSD-3-Clause
1246
+ */ const s = globalThis;
1247
+ var i = class extends g$1 {
1248
+ constructor() {
1249
+ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
1250
+ }
1251
+ createRenderRoot() {
1252
+ const t = super.createRenderRoot();
1253
+ return this.renderOptions.renderBefore ??= t.firstChild, t;
1254
+ }
1255
+ update(t) {
1256
+ const r = this.render();
1257
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = B(r, this.renderRoot, this.renderOptions);
1258
+ }
1259
+ connectedCallback() {
1260
+ super.connectedCallback(), this._$Do?.setConnected(!0);
1261
+ }
1262
+ disconnectedCallback() {
1263
+ super.disconnectedCallback(), this._$Do?.setConnected(!1);
1264
+ }
1265
+ render() {
1266
+ return E;
1267
+ }
1268
+ };
1269
+ i._$litElement$ = !0, i["finalized"] = !0, s.litElementHydrateSupport?.({ LitElement: i });
1270
+ const o = s.litElementPolyfillSupport;
1271
+ o?.({ LitElement: i });
1272
+ (s.litElementVersions ??= []).push("4.2.2");
1273
+
1274
+ //#endregion
1275
+ //#region ../ui/dist/webskillLitCatalog-CNaUpasU.js
1276
+ /** 自定义元素 tag 前缀(同一文档里与 A2UI Basic Catalog 的 `a2ui-basic-*` 互不冲突) */
1277
+ const WEBSKILL_A2UI_TAG_PREFIX = "webskill-a2ui";
1278
+ /**
1279
+ * ui-kit 设计 token 是 `:root` 上的 CSS 自定义属性,CSS 变量天然继承进 shadow root,
1280
+ * 因此这些元素直接消费 `var(--border)` 等 token,亮暗切换随宿主 `.dark` 生效。
1281
+ */
1282
+ const sharedStyles = i$2`
1283
+ :host {
1284
+ display: block;
1285
+ color: var(--foreground);
1286
+ font-size: 0.875rem;
1287
+ line-height: 1.5;
1288
+ }
1289
+ .stack {
1290
+ display: flex;
1291
+ gap: 0.75rem;
1292
+ }
1293
+ .stack[data-direction='vertical'] {
1294
+ flex-direction: column;
1295
+ }
1296
+ .stack[data-direction='horizontal'] {
1297
+ flex-direction: row;
1298
+ align-items: center;
1299
+ }
1300
+ section {
1301
+ display: flex;
1302
+ flex-direction: column;
1303
+ gap: 0.5rem;
1304
+ border: 1px solid var(--border);
1305
+ border-radius: var(--radius);
1306
+ background: var(--card);
1307
+ padding: 0.75rem;
1308
+ }
1309
+ h2,
1310
+ h3,
1311
+ h4 {
1312
+ margin: 0;
1313
+ font-size: 0.875rem;
1314
+ font-weight: 600;
1315
+ color: var(--foreground);
1316
+ }
1317
+ p {
1318
+ margin: 0;
1319
+ }
1320
+ p[data-tone='muted'],
1321
+ .muted {
1322
+ color: var(--muted-foreground);
1323
+ }
1324
+ hr {
1325
+ border: none;
1326
+ border-top: 1px solid var(--border);
1327
+ margin: 0;
1328
+ }
1329
+ .badge {
1330
+ display: inline-flex;
1331
+ align-items: center;
1332
+ border: 1px solid var(--border);
1333
+ border-radius: 999px;
1334
+ padding: 0.05rem 0.5rem;
1335
+ font-size: 0.75rem;
1336
+ }
1337
+ .metric {
1338
+ display: flex;
1339
+ flex-direction: column;
1340
+ gap: 0.125rem;
1341
+ }
1342
+ .metric strong {
1343
+ font-size: 1.125rem;
1344
+ }
1345
+ table {
1346
+ width: 100%;
1347
+ border-collapse: collapse;
1348
+ font-size: 0.8125rem;
1349
+ }
1350
+ th,
1351
+ td {
1352
+ border-bottom: 1px solid var(--border);
1353
+ padding: 0.375rem 0.5rem;
1354
+ text-align: left;
1355
+ }
1356
+ th {
1357
+ color: var(--muted-foreground);
1358
+ font-weight: 500;
1359
+ }
1360
+ form {
1361
+ display: flex;
1362
+ flex-direction: column;
1363
+ gap: 0.75rem;
1364
+ }
1365
+ label {
1366
+ display: flex;
1367
+ flex-direction: column;
1368
+ gap: 0.25rem;
1369
+ }
1370
+ input,
1371
+ textarea,
1372
+ select {
1373
+ border: 1px solid var(--border);
1374
+ border-radius: calc(var(--radius) - 2px);
1375
+ background: var(--background);
1376
+ color: var(--foreground);
1377
+ padding: 0.375rem 0.5rem;
1378
+ font: inherit;
1379
+ }
1380
+ button {
1381
+ border: 1px solid var(--border);
1382
+ border-radius: calc(var(--radius) - 2px);
1383
+ background: var(--secondary);
1384
+ color: var(--secondary-foreground);
1385
+ padding: 0.375rem 0.75rem;
1386
+ font: inherit;
1387
+ cursor: pointer;
1388
+ }
1389
+ button:disabled {
1390
+ cursor: not-allowed;
1391
+ opacity: 0.6;
1392
+ }
1393
+ [role='alert'] {
1394
+ border: 1px solid var(--border);
1395
+ border-radius: calc(var(--radius) - 2px);
1396
+ padding: 0.5rem;
1397
+ }
1398
+ .error {
1399
+ color: var(--destructive);
1400
+ }
1401
+ `;
1402
+ const str = (props, key, fallback = "") => typeof props[key] === "string" ? props[key] : fallback;
1403
+ const list = (value) => Array.isArray(value) ? value : [];
1404
+ function children(props, host) {
1405
+ return (props.children ?? []).map((ref) => host.renderChild(ref));
1406
+ }
1407
+ function chartSpec(props) {
1408
+ const series = list(props["series"]);
1409
+ return {
1410
+ kind: str(props, "type", "bar"),
1411
+ labels: list(props["labels"]),
1412
+ series: series.map((item) => ({
1413
+ name: item.name,
1414
+ data: item.values
1415
+ })),
1416
+ ...props["title"] ? { title: str(props, "title") } : {}
1417
+ };
1418
+ }
1419
+ /**
1420
+ * 16 个组件的 Lit 渲染实现。语义(标题层级、table/th/td、label、button、role=alert)
1421
+ * 与 React 三档共用的 `catalogComponentImpls` 对齐——像素可不同,语义不可不同。
1422
+ */
1423
+ const renderers = {
1424
+ Stack: (props, host) => T`<div class="stack" data-direction=${str(props, "direction", "vertical")}>${children(props, host)}</div>`,
1425
+ Card: (props, host) => T`
1426
+ <section>
1427
+ <h3>${str(props, "title")}</h3>
1428
+ ${props["description"] ? T`<p class="muted">${str(props, "description")}</p>` : A}
1429
+ ${children(props, host)}
1430
+ </section>
1431
+ `,
1432
+ Separator: () => T`<hr />`,
1433
+ Heading: (props) => {
1434
+ const text = str(props, "text");
1435
+ if (props["level"] === 2) return T`<h2>${text}</h2>`;
1436
+ if (props["level"] === 4) return T`<h4>${text}</h4>`;
1437
+ return T`<h3>${text}</h3>`;
1438
+ },
1439
+ Text: (props) => T`<p data-tone=${str(props, "tone", "default")}>${str(props, "text")}</p>`,
1440
+ Markdown: (props) => renderMiniMarkdown(str(props, "text"), document),
1441
+ Badge: (props) => T`<span class="badge">${str(props, "text")}</span>`,
1442
+ Metric: (props) => T`
1443
+ <div class="metric">
1444
+ <span class="muted">${str(props, "label")}</span>
1445
+ <strong>${String(props["value"] ?? "")}</strong>
1446
+ ${props["change"] ? T`<small class="muted">${str(props, "change")}</small>` : A}
1447
+ </div>
1448
+ `,
1449
+ Table: (props) => T`
1450
+ <table aria-label=${str(props, "title", "Data")}>
1451
+ <thead>
1452
+ <tr>
1453
+ ${list(props["columns"]).map((column) => T`<th scope="col">${column}</th>`)}
1454
+ </tr>
1455
+ </thead>
1456
+ <tbody>
1457
+ ${list(props["rows"]).map((row) => T`<tr>
1458
+ ${list(row).map((cell) => T`<td>${String(cell ?? "")}</td>`)}
1459
+ </tr>`)}
1460
+ </tbody>
1461
+ </table>
1462
+ `,
1463
+ Chart: (props) => renderMiniChart(chartSpec(props), document),
1464
+ FileLink: (props) => T`<p>${str(props, "label", str(props, "path"))}</p>`,
1465
+ Form: (props, host) => T`
1466
+ <form @submit=${(event) => event.preventDefault()}>
1467
+ ${props["title"] ? T`<h3>${str(props, "title")}</h3>` : A} ${children(props, host)}
1468
+ </form>
1469
+ `,
1470
+ Field: (props) => {
1471
+ const name = str(props, "name");
1472
+ const type = str(props, "type", "text");
1473
+ const value = props["value"];
1474
+ const commit = (next) => props.setValue?.(next);
1475
+ const options = list(props["options"]);
1476
+ const control = () => {
1477
+ if (type === "textarea") return T`<textarea
1478
+ id=${name}
1479
+ .value=${typeof value === "string" ? value : ""}
1480
+ @input=${(event) => commit(event.target.value)}
1481
+ ></textarea>`;
1482
+ if (type === "toggle") return T`<input
1483
+ id=${name}
1484
+ type="checkbox"
1485
+ .checked=${value === true}
1486
+ @change=${(event) => commit(event.target.checked)}
1487
+ />`;
1488
+ if (type === "select" || type === "multi-select") return T`<select
1489
+ id=${name}
1490
+ .value=${typeof value === "string" ? value : ""}
1491
+ @change=${(event) => commit(event.target.value)}
1492
+ >
1493
+ ${options.map((option) => T`<option value=${String(option.value)}>${option.label}</option>`)}
1494
+ </select>`;
1495
+ return T`<input
1496
+ id=${name}
1497
+ type=${type === "number" ? "number" : type === "date" ? "date" : "text"}
1498
+ .value=${typeof value === "string" || typeof value === "number" ? String(value) : ""}
1499
+ @input=${(event) => {
1500
+ const raw = event.target.value;
1501
+ commit(type === "number" ? Number(raw) : raw);
1502
+ }}
1503
+ />`;
1504
+ };
1505
+ return T`
1506
+ <label for=${name}>
1507
+ <span
1508
+ >${str(props, "label", name)}${props["required"] === true ? T`<span aria-hidden> *</span>` : A}</span
1509
+ >
1510
+ ${control()} ${props["description"] ? T`<span class="muted">${str(props, "description")}</span>` : A}
1511
+ </label>
1512
+ `;
1513
+ },
1514
+ Button: (props) => T`
1515
+ <button type="button" ?disabled=${props["disabled"] === true} @click=${() => props.action?.()}>
1516
+ ${str(props, "label")}
1517
+ </button>
1518
+ `,
1519
+ Alert: (props) => T`
1520
+ <div role="alert">
1521
+ <strong>${str(props, "title")}</strong>
1522
+ ${props["description"] ? T`<p class="muted">${str(props, "description")}</p>` : A}
1523
+ </div>
1524
+ `,
1525
+ Custom: (props) => T` <div role="alert" class="error">Unsupported registered surface: ${str(props, "name")}</div> `
1526
+ };
1527
+ /**
1528
+ * shape → A2UI 组件 API 的 zod schema。
1529
+ *
1530
+ * 用 `zod/v3` 而不是仓库其余部分的 zod 4:A2UI 的 `scrapeSchemaBehavior` 靠读
1531
+ * `_def.typeName` 判断字段行为,zod 4 的 schema 会整体退化成 STATIC —— 子节点、
1532
+ * action、双向绑定全部失效。zod 4.4.3 自带 `zod/v3` 子路径,无需新增依赖。
1533
+ *
1534
+ * 静态 props 用 `z.any()` 占位:binder 对 STATIC 字段原样透传,
1535
+ * 真正的取值校验在 `uiCatalog.validate()`(声明树入口)已经做过,这里不重复第二道。
1536
+ */
1537
+ function apiSchema(shape) {
1538
+ const dataBinding = z.object({ path: z.string() });
1539
+ const functionCall = z.object({
1540
+ call: z.string(),
1541
+ args: z.record(z.any())
1542
+ });
1543
+ const shapeFields = {};
1544
+ for (const key of shape.staticProps) shapeFields[key] = z.any().optional();
1545
+ for (const key of shape.actionProps) shapeFields[key] = z.union([z.object({ event: z.object({
1546
+ name: z.string(),
1547
+ context: z.record(z.any()).optional()
1548
+ }) }), z.object({ functionCall })]).optional();
1549
+ for (const key of shape.valueProps) shapeFields[key] = z.union([
1550
+ z.string(),
1551
+ z.number(),
1552
+ z.boolean(),
1553
+ dataBinding,
1554
+ functionCall
1555
+ ]).optional();
1556
+ if (shape.childList) shapeFields[A2UI_CHILDREN_PROP] = z.union([z.array(z.string()), z.object({
1557
+ componentId: z.string(),
1558
+ path: z.string()
1559
+ })]).optional();
1560
+ return z.object(shapeFields);
1561
+ }
1562
+ function defineElement(api, render) {
1563
+ class WebSkillA2uiElement extends A2uiLitElement {
1564
+ static styles = sharedStyles;
1565
+ createController() {
1566
+ return new A2uiController(this, api);
1567
+ }
1568
+ renderChild(ref) {
1569
+ return this.renderNode(ref);
1570
+ }
1571
+ render() {
1572
+ const props = this.controller?.props;
1573
+ return props ? render(props, this) : A;
1574
+ }
1575
+ }
1576
+ if (!customElements.get(api.tagName)) customElements.define(api.tagName, WebSkillA2uiElement);
1577
+ }
1578
+ let catalog;
1579
+ /**
1580
+ * WebSkill BYOC catalog 的 Lit 渲染器。
1581
+ * 组件 API 与 `buildA2uiCatalogDefinition` 派生自同一份 `a2uiComponentShapes`,
1582
+ * 因此协议里公布的词汇表与实际能渲染的元素永远一致。
1583
+ */
1584
+ function webskillLitCatalog() {
1585
+ if (catalog) return catalog;
1586
+ catalog = new Catalog(WEBSKILL_A2UI_CATALOG_ID, a2uiComponentShapes(uiCatalog).map((shape) => {
1587
+ const api = {
1588
+ name: shape.name,
1589
+ schema: apiSchema(shape),
1590
+ tagName: `${WEBSKILL_A2UI_TAG_PREFIX}-${shape.name.toLowerCase()}`
1591
+ };
1592
+ const render = renderers[shape.name];
1593
+ if (!render) throw new Error(`No A2UI Lit renderer for catalog component "${shape.name}"`);
1594
+ defineElement(api, render);
1595
+ return api;
1596
+ }));
1597
+ return catalog;
1598
+ }
1599
+
1600
+ //#endregion
1601
+ export { webskillLitCatalog };