@nonoun/native-ui 0.2.8 → 0.2.9

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.
Files changed (62) hide show
  1. package/dist/components-lean.css +119 -6
  2. package/dist/components.css +119 -6
  3. package/dist/containers/ui-layout-sidebar/ui-layout-sidebar-element.d.ts.map +1 -1
  4. package/dist/core/trait-runtime.d.ts.map +1 -1
  5. package/dist/custom-elements.json +1602 -1602
  6. package/dist/dialog-controller.js +38 -350
  7. package/dist/foundation.css +1 -15
  8. package/dist/{nav/inspector → inspector}/build-inspector.d.ts +2 -2
  9. package/dist/inspector/build-inspector.d.ts.map +1 -0
  10. package/dist/{nav/inspector → inspector}/ds-color-swatch-element.d.ts +1 -1
  11. package/dist/inspector/ds-color-swatch-element.d.ts.map +1 -0
  12. package/dist/inspector/ds-color-swatch.d.ts.map +1 -0
  13. package/dist/{nav/inspector → inspector}/ds-colors-element.d.ts +1 -1
  14. package/dist/inspector/ds-colors-element.d.ts.map +1 -0
  15. package/dist/inspector/ds-colors.d.ts.map +1 -0
  16. package/dist/inspector/ds-inspector-element.d.ts +15 -0
  17. package/dist/inspector/ds-inspector-element.d.ts.map +1 -0
  18. package/dist/inspector/ds-inspector.d.ts +3 -0
  19. package/dist/inspector/ds-inspector.d.ts.map +1 -0
  20. package/dist/{nav/inspector → inspector}/ds-themes-element.d.ts +1 -1
  21. package/dist/inspector/ds-themes-element.d.ts.map +1 -0
  22. package/dist/inspector/ds-themes.d.ts.map +1 -0
  23. package/dist/{nav/inspector → inspector}/ds-variable-element.d.ts +1 -1
  24. package/dist/inspector/ds-variable-element.d.ts.map +1 -0
  25. package/dist/inspector/ds-variable.d.ts.map +1 -0
  26. package/dist/{nav/inspector → inspector}/index.d.ts +1 -0
  27. package/dist/inspector/index.d.ts.map +1 -0
  28. package/dist/inspector.css +1 -1
  29. package/dist/inspector.d.ts +10 -6
  30. package/dist/inspector.d.ts.map +1 -1
  31. package/dist/inspector.js +94 -75
  32. package/dist/kernel.js +185 -186
  33. package/dist/list-navigate-controller.js +457 -0
  34. package/dist/native-ui-lean.css +120 -21
  35. package/dist/native-ui.css +120 -21
  36. package/dist/native-ui.js +7 -7
  37. package/dist/register-all.js +4 -3
  38. package/dist/register-all2.js +20 -19
  39. package/dist/traits/adapters/draggable-adapter.d.ts.map +1 -1
  40. package/dist/traits/drag-controller.d.ts +3 -0
  41. package/dist/traits/drag-controller.d.ts.map +1 -1
  42. package/dist/traits.js +5 -6
  43. package/dist/ui-icon-element.js +391 -4153
  44. package/dist/ui-layout-inspector-element.js +3777 -0
  45. package/dist/uid.js +63 -3
  46. package/package.json +1 -1
  47. package/dist/define.js +0 -62
  48. package/dist/nav/inspector/build-inspector.d.ts.map +0 -1
  49. package/dist/nav/inspector/ds-color-swatch-element.d.ts.map +0 -1
  50. package/dist/nav/inspector/ds-color-swatch.d.ts.map +0 -1
  51. package/dist/nav/inspector/ds-colors-element.d.ts.map +0 -1
  52. package/dist/nav/inspector/ds-colors.d.ts.map +0 -1
  53. package/dist/nav/inspector/ds-themes-element.d.ts.map +0 -1
  54. package/dist/nav/inspector/ds-themes.d.ts.map +0 -1
  55. package/dist/nav/inspector/ds-variable-element.d.ts.map +0 -1
  56. package/dist/nav/inspector/ds-variable.d.ts.map +0 -1
  57. package/dist/nav/inspector/index.d.ts.map +0 -1
  58. package/dist/ui-element.js +0 -133
  59. /package/dist/{nav/inspector → inspector}/ds-color-swatch.d.ts +0 -0
  60. /package/dist/{nav/inspector → inspector}/ds-colors.d.ts +0 -0
  61. /package/dist/{nav/inspector → inspector}/ds-themes.d.ts +0 -0
  62. /package/dist/{nav/inspector → inspector}/ds-variable.d.ts +0 -0
@@ -0,0 +1,3777 @@
1
+ import { a as e, o as t, r as n, t as r } from "./uid.js";
2
+ import { i, n as a, r as o, t as s } from "./dialog-controller.js";
3
+ import { a as c, d as l, f as u, h as d, i as f, m as p, n as m, p as h, t as g, u as _ } from "./list-navigate-controller.js";
4
+ import { _ as v, d as y, f as b, g as x, h as S, p as C, v as w } from "./ui-icon-element.js";
5
+ /**
6
+ * Single-line text input using contenteditable with form association.
7
+ * @attr {string} value - Current text value
8
+ * @attr {string} placeholder - Placeholder text shown when empty
9
+ * @attr {boolean} disabled - Disables interaction
10
+ * @attr {boolean} readonly - Prevents editing while remaining focusable
11
+ * @attr {boolean} required - Marks as required for form validation
12
+ * @attr {string} name - Form field name
13
+ * @fires ui-input - Fired on each keystroke with `{ value }` detail
14
+ * @fires ui-change - Fired on blur with `{ value }` detail
15
+ */
16
+ var ee = class extends S(_) {
17
+ static observedAttributes = [
18
+ "value",
19
+ "placeholder",
20
+ "disabled",
21
+ "readonly",
22
+ "required",
23
+ "pattern"
24
+ ];
25
+ #e;
26
+ #t = t(!1);
27
+ #n = t(!1);
28
+ #r = t("");
29
+ #i = "";
30
+ #a = null;
31
+ #o = [];
32
+ constructor() {
33
+ super(), this.#e = this.attachInternals(), this.#e.role = "textbox";
34
+ }
35
+ get value() {
36
+ return this.#s();
37
+ }
38
+ set value(e) {
39
+ this.#c(e), this.#r.value = e, this.#e.setFormValue(e), this.#l();
40
+ }
41
+ #s() {
42
+ let e = "";
43
+ for (let t of this.childNodes) t.nodeType === Node.TEXT_NODE && (e += t.textContent);
44
+ return e;
45
+ }
46
+ #c(e) {
47
+ for (let e of [...this.childNodes]) e.nodeType === Node.TEXT_NODE && e.remove();
48
+ e && this.append(e);
49
+ }
50
+ get placeholder() {
51
+ return this.getAttribute("placeholder") ?? "";
52
+ }
53
+ set placeholder(e) {
54
+ this.setAttribute("placeholder", e);
55
+ }
56
+ get name() {
57
+ return this.getAttribute("name") ?? "";
58
+ }
59
+ set name(e) {
60
+ this.setAttribute("name", e);
61
+ }
62
+ get disabled() {
63
+ return this.#t.value;
64
+ }
65
+ set disabled(e) {
66
+ this.#t.value = e, this.toggleAttribute("disabled", e);
67
+ }
68
+ get readOnly() {
69
+ return this.hasAttribute("readonly");
70
+ }
71
+ set readOnly(e) {
72
+ this.toggleAttribute("readonly", e), this.setAttribute("contenteditable", e ? "false" : "plaintext-only");
73
+ }
74
+ get required() {
75
+ return this.#n.value;
76
+ }
77
+ set required(e) {
78
+ this.#n.value = e, this.toggleAttribute("required", e);
79
+ }
80
+ attributeChangedCallback(e, t, n) {
81
+ if (t !== n) {
82
+ switch (e) {
83
+ case "value":
84
+ this.#c(n ?? ""), this.#r.value = n ?? "", this.#e.setFormValue(n ?? ""), this.#l();
85
+ break;
86
+ case "disabled":
87
+ this.#t.value = n !== null, this.setAttribute("contenteditable", n !== null || this.hasAttribute("readonly") ? "false" : "plaintext-only");
88
+ break;
89
+ case "readonly":
90
+ this.setAttribute("contenteditable", n !== null || this.#t.value ? "false" : "plaintext-only");
91
+ break;
92
+ case "required":
93
+ this.#n.value = n !== null;
94
+ break;
95
+ case "pattern":
96
+ this.#a = n;
97
+ break;
98
+ }
99
+ super.attributeChangedCallback?.(e, t, n);
100
+ }
101
+ }
102
+ setup() {
103
+ super.setup(), this.hasAttribute("contenteditable") || this.setAttribute("contenteditable", "plaintext-only"), this.#o = [...this.querySelectorAll(":scope > [slot]")];
104
+ for (let e of this.#o) e.setAttribute("contenteditable", "false");
105
+ this.#n.value = this.hasAttribute("required"), this.#a = this.getAttribute("pattern"), this.#i = this.getAttribute("value") ?? this.#s(), this.#r.value = this.#s(), this.#l(), this.addEffect(w(this, this.#t, this.#e, { manageTabindex: !0 })), this.addEffect(() => {
106
+ let e = this.#r.value;
107
+ this.#n.value && e === "" ? this.#e.setValidity({ valueMissing: !0 }, "Please fill out this field.", this) : this.#a !== null && e !== "" && !RegExp(`^(?:${this.#a})$`).test(e) ? this.#e.setValidity({ patternMismatch: !0 }, "Please match the requested format.", this) : this.#e.setValidity({});
108
+ }), this.addEventListener("input", this.#u), this.addEventListener("blur", this.#d);
109
+ }
110
+ teardown() {
111
+ this.removeEventListener("input", this.#u), this.removeEventListener("blur", this.#d), super.teardown();
112
+ }
113
+ select() {
114
+ let e = document.createRange();
115
+ e.selectNodeContents(this);
116
+ let t = window.getSelection();
117
+ t?.removeAllRanges(), t?.addRange(e);
118
+ }
119
+ onFormDisabled(e) {
120
+ this.#t.value = e, this.setAttribute("contenteditable", e || this.hasAttribute("readonly") ? "false" : "plaintext-only");
121
+ }
122
+ onFormReset() {
123
+ this.#c(this.#i), this.#r.value = this.#i, this.#e.setFormValue(this.#i), this.#l(), this.#t.value = this.hasAttribute("disabled"), this.setAttribute("contenteditable", this.#t.value || this.hasAttribute("readonly") ? "false" : "plaintext-only");
124
+ }
125
+ onFormStateRestore(e) {
126
+ this.value = typeof e == "string" ? e : "";
127
+ }
128
+ #l() {
129
+ this.#s().trim() === "" ? this.#e.states.add("empty") : this.#e.states.delete("empty");
130
+ }
131
+ #u = () => {
132
+ for (let e of this.#o) e.parentNode || this.appendChild(e);
133
+ let e = this.#s();
134
+ this.#r.value = e, this.#e.setFormValue(e), this.#l(), this.dispatchEvent(new CustomEvent("ui-input", {
135
+ bubbles: !0,
136
+ composed: !0,
137
+ detail: { value: e }
138
+ }));
139
+ };
140
+ #d = () => {
141
+ this.dispatchEvent(new CustomEvent("ui-change", {
142
+ bubbles: !0,
143
+ composed: !0,
144
+ detail: { value: this.#s() }
145
+ }));
146
+ };
147
+ }, te = class extends _ {
148
+ constructor() {
149
+ super();
150
+ let e = this.attachInternals();
151
+ e.role = "presentation";
152
+ }
153
+ setup() {
154
+ super.setup(), this.id ||= r("ogh");
155
+ let e = this.closest("ui-option-group");
156
+ e && e.setAttribute("aria-labelledby", this.id);
157
+ }
158
+ }, ne = class extends _ {
159
+ constructor() {
160
+ super();
161
+ let e = this.attachInternals();
162
+ e.role = "group";
163
+ }
164
+ }, re = class extends _ {
165
+ static observedAttributes = ["disabled"];
166
+ #e;
167
+ #t = new C({ initialActiveIndex: 0 });
168
+ #n = t(!1);
169
+ constructor() {
170
+ super(), this.#e = this.attachInternals(), this.#e.role = "search";
171
+ }
172
+ get store() {
173
+ return this.#t;
174
+ }
175
+ get disabled() {
176
+ return this.#n.value;
177
+ }
178
+ set disabled(e) {
179
+ this.#n.value = e, this.toggleAttribute("disabled", e);
180
+ }
181
+ attributeChangedCallback(e, t, n) {
182
+ t !== n && (e === "disabled" && (this.#n.value = n !== null), super.attributeChangedCallback?.(e, t, n));
183
+ }
184
+ setup() {
185
+ super.setup(), this.addEffect(w(this, this.#n, this.#e)), this.addEventListener("ui-input", this.#i), this.addEventListener("ui-select", this.#a), this.addEventListener("keydown", this.#o), this.deferChildren(() => {
186
+ this.addEffect(() => {
187
+ let e = this.#t.query.value.toLowerCase().trim(), t = this.querySelectorAll("ui-command-item");
188
+ for (let n of t) {
189
+ let t = !e || n.searchText.includes(e);
190
+ n.toggleAttribute("hidden", !t);
191
+ }
192
+ }), this.addEffect(() => {
193
+ this.#t.query.value;
194
+ let e = this.#t.activeIndex.value, t = this.#r(), n = this.querySelector("ui-command-list");
195
+ for (let n = 0; n < t.length; n++) t[n].toggleAttribute("active", n === e);
196
+ let i = t[e];
197
+ i && n ? (i.id ||= r("cmd"), n.setAttribute("aria-activedescendant", i.id), i.scrollIntoView({ block: "nearest" })) : n?.removeAttribute("aria-activedescendant");
198
+ }), this.addEffect(() => {
199
+ this.#t.query.value;
200
+ let e = this.#r(), t = this.querySelector("ui-command-empty");
201
+ t && t.toggleAttribute("hidden", e.length > 0);
202
+ });
203
+ });
204
+ }
205
+ teardown() {
206
+ this.removeEventListener("ui-input", this.#i), this.removeEventListener("ui-select", this.#a), this.removeEventListener("keydown", this.#o), super.teardown();
207
+ }
208
+ #r() {
209
+ return [...this.querySelectorAll("ui-command-item:not([hidden]):not([disabled])")];
210
+ }
211
+ #i = (e) => {
212
+ if (this.#n.value) return;
213
+ let t = e.detail;
214
+ this.#t.setQuery(t.value, 0);
215
+ };
216
+ #a = (e) => {
217
+ if (this.#n.value) return;
218
+ let t = e.detail;
219
+ this.dispatchEvent(new CustomEvent("ui-change", {
220
+ bubbles: !0,
221
+ composed: !0,
222
+ detail: t
223
+ }));
224
+ };
225
+ #o = (e) => {
226
+ if (this.#n.value) return;
227
+ let t = this.#r();
228
+ if (!(t.length === 0 && e.key !== "Escape")) switch (e.key) {
229
+ case "ArrowDown":
230
+ e.preventDefault(), this.#t.moveActive(1, t.length);
231
+ break;
232
+ case "ArrowUp":
233
+ e.preventDefault(), this.#t.moveActive(-1, t.length);
234
+ break;
235
+ case "Home":
236
+ e.preventDefault(), this.#t.activeIndex.value = 0;
237
+ break;
238
+ case "End":
239
+ e.preventDefault(), this.#t.activeIndex.value = Math.max(0, t.length - 1);
240
+ break;
241
+ case "Enter": {
242
+ e.preventDefault();
243
+ let n = t[this.#t.activeIndex.value];
244
+ n && n.click();
245
+ break;
246
+ }
247
+ case "Escape":
248
+ this.dispatchEvent(new CustomEvent("ui-dismiss", {
249
+ bubbles: !0,
250
+ composed: !0
251
+ }));
252
+ break;
253
+ }
254
+ };
255
+ }, ie = class extends _ {
256
+ #e = null;
257
+ setup() {
258
+ super.setup(), this.deferChildren(() => {
259
+ this.#e = this.querySelector("input"), this.#e && this.#e.addEventListener("input", this.#t);
260
+ });
261
+ }
262
+ teardown() {
263
+ this.#e && this.#e.removeEventListener("input", this.#t), this.#e = null, super.teardown();
264
+ }
265
+ get inputElement() {
266
+ return this.#e;
267
+ }
268
+ focus(e) {
269
+ this.#e?.focus(e);
270
+ }
271
+ clear() {
272
+ this.#e && (this.#e.value = "", this.#t());
273
+ }
274
+ #t = () => {
275
+ let e = this.#e?.value ?? "";
276
+ this.dispatchEvent(new CustomEvent("ui-input", {
277
+ bubbles: !0,
278
+ composed: !0,
279
+ detail: { value: e }
280
+ }));
281
+ };
282
+ }, T = class extends _ {
283
+ constructor() {
284
+ super();
285
+ let e = this.attachInternals();
286
+ e.role = "listbox";
287
+ }
288
+ }, E = class extends _ {
289
+ static observedAttributes = [
290
+ "value",
291
+ "disabled",
292
+ "keywords"
293
+ ];
294
+ #e;
295
+ #t = t("");
296
+ #n = t(!1);
297
+ #r = t("");
298
+ constructor() {
299
+ super(), this.#e = this.attachInternals(), this.#e.role = "option";
300
+ }
301
+ get value() {
302
+ return this.#t.value;
303
+ }
304
+ set value(e) {
305
+ this.#t.value = e, this.getAttribute("value") !== e && this.setAttribute("value", e);
306
+ }
307
+ get disabled() {
308
+ return this.#n.value;
309
+ }
310
+ set disabled(e) {
311
+ this.#n.value = e, this.toggleAttribute("disabled", e);
312
+ }
313
+ get keywords() {
314
+ return this.#r.value;
315
+ }
316
+ set keywords(e) {
317
+ this.#r.value = e, e ? this.getAttribute("keywords") !== e && this.setAttribute("keywords", e) : this.removeAttribute("keywords");
318
+ }
319
+ get label() {
320
+ return this.textContent?.trim() || "";
321
+ }
322
+ get searchText() {
323
+ return `${this.label} ${this.#t.value} ${this.#r.value}`.toLowerCase();
324
+ }
325
+ attributeChangedCallback(e, t, n) {
326
+ if (t !== n) {
327
+ switch (e) {
328
+ case "value":
329
+ this.#t.value = n ?? "";
330
+ break;
331
+ case "disabled":
332
+ this.#n.value = n !== null;
333
+ break;
334
+ case "keywords":
335
+ this.#r.value = n ?? "";
336
+ break;
337
+ }
338
+ super.attributeChangedCallback?.(e, t, n);
339
+ }
340
+ }
341
+ setup() {
342
+ super.setup(), this.addEffect(w(this, this.#n, this.#e)), this.addEventListener("click", this.#i);
343
+ }
344
+ teardown() {
345
+ this.removeEventListener("click", this.#i), super.teardown();
346
+ }
347
+ #i = () => {
348
+ this.#n.value || this.dispatchEvent(new CustomEvent("ui-select", {
349
+ bubbles: !0,
350
+ composed: !0,
351
+ detail: {
352
+ value: this.#t.value,
353
+ label: this.label
354
+ }
355
+ }));
356
+ };
357
+ }, D = class extends _ {
358
+ constructor() {
359
+ super();
360
+ let e = this.attachInternals();
361
+ e.role = "group";
362
+ }
363
+ setup() {
364
+ super.setup();
365
+ let e = this.querySelector("[slot=\"heading\"]");
366
+ e && (e.id ||= r("cg"), this.setAttribute("aria-labelledby", e.id));
367
+ }
368
+ }, O = class extends _ {}, k = class extends S(_) {
369
+ static observedAttributes = [
370
+ "checked",
371
+ "indeterminate",
372
+ "disabled",
373
+ "name",
374
+ "value",
375
+ "required"
376
+ ];
377
+ #e;
378
+ #t;
379
+ #n;
380
+ #r;
381
+ #i = t(!1);
382
+ #a = !1;
383
+ #o;
384
+ constructor() {
385
+ super(), this.#e = this.attachInternals(), this.#e.role = "checkbox", this.#t = x(this, "checked", { type: "boolean" }), this.#n = x(this, "indeterminate", { type: "boolean" }), this.#r = x(this, "disabled", { type: "boolean" });
386
+ }
387
+ get checked() {
388
+ return this.#t.value;
389
+ }
390
+ set checked(e) {
391
+ this.#t.set(e);
392
+ }
393
+ get indeterminate() {
394
+ return this.#n.value;
395
+ }
396
+ set indeterminate(e) {
397
+ this.#n.set(e);
398
+ }
399
+ get disabled() {
400
+ return this.#r.value;
401
+ }
402
+ set disabled(e) {
403
+ this.#r.set(e);
404
+ }
405
+ get name() {
406
+ return this.getAttribute("name") ?? "";
407
+ }
408
+ set name(e) {
409
+ this.setAttribute("name", e);
410
+ }
411
+ get value() {
412
+ return this.getAttribute("value") ?? "on";
413
+ }
414
+ set value(e) {
415
+ this.setAttribute("value", e);
416
+ }
417
+ get required() {
418
+ return this.#i.value;
419
+ }
420
+ set required(e) {
421
+ this.#i.value = e, this.toggleAttribute("required", e);
422
+ }
423
+ attributeChangedCallback(e, t, n) {
424
+ if (t !== n) {
425
+ if (v({
426
+ checked: this.#t,
427
+ indeterminate: this.#n,
428
+ disabled: this.#r
429
+ }, e, n)) {
430
+ super.attributeChangedCallback?.(e, t, n);
431
+ return;
432
+ }
433
+ e === "required" && (this.#i.value = n !== null), super.attributeChangedCallback?.(e, t, n);
434
+ }
435
+ }
436
+ setup() {
437
+ super.setup(), this.#o = new c(this, { disabled: () => this.disabled }), this.#a = this.hasAttribute("checked"), this.#i.value = this.hasAttribute("required"), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.addEffect(w(this, this.#r.signal, this.#e, { manageTabindex: !0 })), this.addEffect(() => {
438
+ let e = this.#t.value, t = this.#n.value ? "mixed" : e ? "true" : "false";
439
+ this.setAttribute("aria-checked", t), this.#e.setFormValue(e ? this.value : null);
440
+ }), this.addEffect(() => {
441
+ this.#i.value ? this.setAttribute("aria-required", "true") : this.removeAttribute("aria-required");
442
+ }), this.addEffect(() => {
443
+ this.#i.value && !this.#t.value ? this.#e.setValidity({ valueMissing: !0 }, "Please check this box if you want to proceed.", this) : this.#e.setValidity({});
444
+ }), this.addEventListener("ui-press", this.#s);
445
+ }
446
+ teardown() {
447
+ this.removeEventListener("ui-press", this.#s), this.#o.destroy(), super.teardown();
448
+ }
449
+ onFormDisabled(e) {
450
+ this.#r.signal.value = e;
451
+ }
452
+ onFormReset() {
453
+ this.#t.set(this.#a), this.#n.set(!1);
454
+ }
455
+ onFormStateRestore(e) {
456
+ this.checked = typeof e == "string" && e === this.value;
457
+ }
458
+ #s = () => {
459
+ this.#r.value || (this.#n.value ? (this.indeterminate = !1, this.checked = !0) : this.checked = !this.#t.value, this.dispatchEvent(new CustomEvent("ui-change", {
460
+ bubbles: !0,
461
+ composed: !0,
462
+ detail: {
463
+ checked: this.#t.value,
464
+ value: this.value
465
+ }
466
+ })));
467
+ };
468
+ }, A = class extends S(_) {
469
+ static observedAttributes = [
470
+ "checked",
471
+ "disabled",
472
+ "name",
473
+ "value",
474
+ "required"
475
+ ];
476
+ #e;
477
+ #t;
478
+ #n;
479
+ #r;
480
+ #i = !1;
481
+ #a;
482
+ constructor() {
483
+ super(), this.#e = this.attachInternals(), this.#e.role = "switch", this.#t = x(this, "checked", { type: "boolean" }), this.#n = x(this, "disabled", { type: "boolean" }), this.#r = x(this, "required", { type: "boolean" });
484
+ }
485
+ get checked() {
486
+ return this.#t.value;
487
+ }
488
+ set checked(e) {
489
+ this.#t.set(e);
490
+ }
491
+ get disabled() {
492
+ return this.#n.value;
493
+ }
494
+ set disabled(e) {
495
+ this.#n.set(e);
496
+ }
497
+ get name() {
498
+ return this.getAttribute("name") ?? "";
499
+ }
500
+ set name(e) {
501
+ this.setAttribute("name", e);
502
+ }
503
+ get value() {
504
+ return this.getAttribute("value") ?? "on";
505
+ }
506
+ set value(e) {
507
+ this.setAttribute("value", e);
508
+ }
509
+ get required() {
510
+ return this.#r.value;
511
+ }
512
+ set required(e) {
513
+ this.#r.set(e);
514
+ }
515
+ attributeChangedCallback(e, t, n) {
516
+ t !== n && (v({
517
+ checked: this.#t,
518
+ disabled: this.#n,
519
+ required: this.#r
520
+ }, e, n), super.attributeChangedCallback?.(e, t, n));
521
+ }
522
+ setup() {
523
+ super.setup(), this.#a = new c(this, { disabled: () => this.disabled }), this.#i = this.hasAttribute("checked"), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.addEffect(w(this, this.#n.signal, this.#e, { manageTabindex: !0 })), this.addEffect(() => {
524
+ let e = this.#t.value;
525
+ this.setAttribute("aria-checked", e ? "true" : "false"), this.#e.setFormValue(e ? this.value : null);
526
+ }), this.addEffect(() => {
527
+ this.#r.value && !this.#t.value ? this.#e.setValidity({ valueMissing: !0 }, "Please toggle this switch.", this) : this.#e.setValidity({});
528
+ }), this.addEventListener("ui-press", this.#o);
529
+ }
530
+ teardown() {
531
+ this.removeEventListener("ui-press", this.#o), this.#a.destroy(), super.teardown();
532
+ }
533
+ onFormDisabled(e) {
534
+ this.#n.signal.value = e;
535
+ }
536
+ onFormReset() {
537
+ this.#t.set(this.#i);
538
+ }
539
+ onFormStateRestore(e) {
540
+ this.checked = typeof e == "string" && e === this.value;
541
+ }
542
+ #o = () => {
543
+ this.#n.value || (this.checked = !this.#t.value, this.dispatchEvent(new CustomEvent("ui-change", {
544
+ bubbles: !0,
545
+ composed: !0,
546
+ detail: {
547
+ checked: this.#t.value,
548
+ value: this.value
549
+ }
550
+ })));
551
+ };
552
+ }, j = class extends _ {
553
+ static observedAttributes = ["disabled"];
554
+ #e;
555
+ #t;
556
+ #n;
557
+ constructor() {
558
+ super(), this.#e = this.attachInternals(), this.#e.role = "radio", this.#t = x(this, "disabled", { type: "boolean" });
559
+ }
560
+ get value() {
561
+ return this.getAttribute("value") ?? "";
562
+ }
563
+ set value(e) {
564
+ this.setAttribute("value", e);
565
+ }
566
+ get disabled() {
567
+ return this.#t.value;
568
+ }
569
+ set disabled(e) {
570
+ this.#t.set(e);
571
+ }
572
+ get label() {
573
+ return this.getAttribute("label") ?? this.textContent?.trim() ?? "";
574
+ }
575
+ attributeChangedCallback(e, t, n) {
576
+ t !== n && (v({ disabled: this.#t }, e, n), super.attributeChangedCallback?.(e, t, n));
577
+ }
578
+ setup() {
579
+ super.setup(), this.setAttribute("aria-checked", "false"), this.#n = new c(this, { disabled: () => this.disabled }), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "-1"), this.addEffect(w(this, this.#t.signal, this.#e)), this.addEventListener("click", this.#r), this.addEventListener("keydown", this.#i);
580
+ }
581
+ teardown() {
582
+ this.removeEventListener("click", this.#r), this.removeEventListener("keydown", this.#i), this.#n.destroy(), super.teardown();
583
+ }
584
+ #r = () => {
585
+ this.disabled || this.dispatchEvent(new CustomEvent("ui-select", {
586
+ bubbles: !0,
587
+ composed: !0,
588
+ detail: {
589
+ value: this.value,
590
+ label: this.label
591
+ }
592
+ }));
593
+ };
594
+ #i = (e) => {
595
+ e.key !== "Enter" && e.key !== " " || this.disabled || (e.preventDefault(), this.dispatchEvent(new CustomEvent("ui-select", {
596
+ bubbles: !0,
597
+ composed: !0,
598
+ detail: {
599
+ value: this.value,
600
+ label: this.label
601
+ }
602
+ })));
603
+ };
604
+ }, M = class extends S(_) {
605
+ static observedAttributes = [
606
+ "value",
607
+ "disabled",
608
+ "name",
609
+ "required",
610
+ "orientation"
611
+ ];
612
+ #e;
613
+ #t = t(!1);
614
+ #n = t(!1);
615
+ #r = null;
616
+ #i;
617
+ constructor() {
618
+ super(), this.#e = this.attachInternals(), this.#e.role = "radiogroup";
619
+ }
620
+ get value() {
621
+ return this.#i?.listValue.value ?? null;
622
+ }
623
+ set value(e) {
624
+ this.#i && (this.#i.listValue.value = e), e === null ? this.removeAttribute("value") : this.setAttribute("value", e);
625
+ }
626
+ get disabled() {
627
+ return this.#t.value;
628
+ }
629
+ set disabled(e) {
630
+ this.#t.value = e, this.toggleAttribute("disabled", e);
631
+ }
632
+ get name() {
633
+ return this.getAttribute("name") ?? "";
634
+ }
635
+ set name(e) {
636
+ this.setAttribute("name", e);
637
+ }
638
+ get required() {
639
+ return this.#n.value;
640
+ }
641
+ set required(e) {
642
+ this.#n.value = e, this.toggleAttribute("required", e);
643
+ }
644
+ attributeChangedCallback(e, t, n) {
645
+ if (t !== n) {
646
+ switch (e) {
647
+ case "value":
648
+ this.#i && (this.#i.listValue.value = n);
649
+ break;
650
+ case "disabled":
651
+ this.#t.value = n !== null;
652
+ break;
653
+ case "required":
654
+ this.#n.value = n !== null;
655
+ break;
656
+ case "orientation":
657
+ this.#i && (this.#i.rovingFocus.orientation = n ?? "vertical");
658
+ break;
659
+ }
660
+ super.attributeChangedCallback?.(e, t, n);
661
+ }
662
+ }
663
+ setup() {
664
+ super.setup(), this.#r = this.getAttribute("value"), this.#n.value = this.hasAttribute("required"), this.#i = new g(this, {
665
+ itemSelector: ":scope ui-radio:not([disabled])",
666
+ ariaAttr: "aria-checked",
667
+ orientation: "vertical",
668
+ onChildSelect: (e) => {
669
+ this.#i.listValue.value = e.value, this.setAttribute("value", e.value), this.dispatchEvent(new CustomEvent("ui-change", {
670
+ bubbles: !0,
671
+ composed: !0,
672
+ detail: e
673
+ }));
674
+ },
675
+ addEffect: (e) => this.addEffect(e),
676
+ deferChildren: (e) => this.deferChildren(e)
677
+ });
678
+ let e = this.getAttribute("value");
679
+ e !== null && (this.#i.listValue.value = e), this.addEffect(w(this, this.#t, this.#e)), this.addEffect(() => {
680
+ let e = this.#t.value, t = this.querySelectorAll("ui-radio");
681
+ for (let n of t) n.toggleAttribute("disabled", e);
682
+ }), this.addEffect(() => {
683
+ this.#n.value ? this.setAttribute("aria-required", "true") : this.removeAttribute("aria-required");
684
+ }), this.addEffect(() => {
685
+ let e = this.#i.listValue.value;
686
+ this.#e.setFormValue(e);
687
+ }), this.addEffect(() => {
688
+ let e = this.#i.listValue.value;
689
+ this.#n.value && (e === null || e === "") ? this.#e.setValidity({ valueMissing: !0 }, "Please select one of these options.", this) : this.#e.setValidity({});
690
+ });
691
+ }
692
+ teardown() {
693
+ this.#i.destroy(), super.teardown();
694
+ }
695
+ onFormDisabled(e) {
696
+ this.#t.value = e;
697
+ }
698
+ onFormReset() {
699
+ this.#i && (this.#i.listValue.value = this.#r), this.#r === null ? this.removeAttribute("value") : this.setAttribute("value", this.#r);
700
+ }
701
+ onFormStateRestore(e) {
702
+ typeof e == "string" && e && (this.value = e);
703
+ }
704
+ }, N = class extends S(_) {
705
+ static observedAttributes = [
706
+ "value",
707
+ "disabled",
708
+ "name",
709
+ "required"
710
+ ];
711
+ #e;
712
+ #t = t(!1);
713
+ #n = t(!1);
714
+ #r = null;
715
+ #i;
716
+ constructor() {
717
+ super(), this.#e = this.attachInternals(), this.#e.role = "radiogroup";
718
+ }
719
+ get value() {
720
+ return this.#i?.listValue.value ?? null;
721
+ }
722
+ set value(e) {
723
+ this.#i && (this.#i.listValue.value = e), e === null ? this.removeAttribute("value") : this.setAttribute("value", e);
724
+ }
725
+ get disabled() {
726
+ return this.#t.value;
727
+ }
728
+ set disabled(e) {
729
+ this.#t.value = e, this.toggleAttribute("disabled", e);
730
+ }
731
+ get name() {
732
+ return this.getAttribute("name") ?? "";
733
+ }
734
+ set name(e) {
735
+ this.setAttribute("name", e);
736
+ }
737
+ get required() {
738
+ return this.#n.value;
739
+ }
740
+ set required(e) {
741
+ this.#n.value = e, this.toggleAttribute("required", e);
742
+ }
743
+ attributeChangedCallback(e, t, n) {
744
+ if (t !== n) {
745
+ switch (e) {
746
+ case "value":
747
+ this.#i && (this.#i.listValue.value = n);
748
+ break;
749
+ case "disabled":
750
+ this.#t.value = n !== null;
751
+ break;
752
+ case "required":
753
+ this.#n.value = n !== null;
754
+ break;
755
+ }
756
+ super.attributeChangedCallback?.(e, t, n);
757
+ }
758
+ }
759
+ setup() {
760
+ super.setup(), this.#r = this.getAttribute("value"), this.#i = new g(this, {
761
+ itemSelector: ":scope > ui-segment:not([disabled])",
762
+ ariaAttr: "aria-checked",
763
+ orientation: "horizontal",
764
+ onChildSelect: (e) => {
765
+ this.#i.listValue.value = e.value, this.setAttribute("value", e.value), this.dispatchEvent(new CustomEvent("ui-change", {
766
+ bubbles: !0,
767
+ composed: !0,
768
+ detail: e
769
+ }));
770
+ },
771
+ addEffect: (e) => this.addEffect(e),
772
+ deferChildren: (e) => this.deferChildren(e)
773
+ });
774
+ let e = this.getAttribute("value");
775
+ e !== null && (this.#i.listValue.value = e), this.addEffect(w(this, this.#t, this.#e)), this.#n.value = this.hasAttribute("required"), this.addEffect(() => {
776
+ let e = this.#i.listValue.value;
777
+ this.#n.value && (e === null || e === "") ? this.#e.setValidity({ valueMissing: !0 }, "Please select one of these options.", this) : this.#e.setValidity({});
778
+ }), this.addEffect(() => {
779
+ let e = this.#i.listValue.value;
780
+ this.#e.setFormValue(e);
781
+ }), this.deferChildren(() => {
782
+ this.addEffect(() => {
783
+ let e = this.#i.listValue.value, t = this.querySelectorAll(":scope > ui-segment"), n = -1, r = 0;
784
+ for (let i of t) (i.getAttribute("value") ?? "") === e && (n = r), r++;
785
+ this.#a(n, r);
786
+ });
787
+ });
788
+ }
789
+ teardown() {
790
+ this.#i.destroy(), super.teardown();
791
+ }
792
+ onFormDisabled(e) {
793
+ this.#t.value = e;
794
+ }
795
+ onFormReset() {
796
+ this.#i && (this.#i.listValue.value = this.#r), this.#r === null ? this.removeAttribute("value") : this.setAttribute("value", this.#r);
797
+ }
798
+ onFormStateRestore(e) {
799
+ typeof e == "string" && e && (this.value = e);
800
+ }
801
+ #a(e, t) {
802
+ if (e < 0) {
803
+ this.#e.states.delete("ready");
804
+ return;
805
+ }
806
+ this.style.setProperty("--_indicator-index", `${e}`), this.style.setProperty("--_segment-count", `${t}`), this.#e.states.add("ready");
807
+ }
808
+ }, P = class extends _ {
809
+ static observedAttributes = ["disabled"];
810
+ #e;
811
+ #t;
812
+ #n;
813
+ constructor() {
814
+ super(), this.#e = this.attachInternals(), this.#e.role = "radio", this.#t = x(this, "disabled", { type: "boolean" }), this.setAttribute("aria-checked", "false");
815
+ }
816
+ get value() {
817
+ return this.getAttribute("value") ?? "";
818
+ }
819
+ set value(e) {
820
+ this.setAttribute("value", e);
821
+ }
822
+ get disabled() {
823
+ return this.#t.value;
824
+ }
825
+ set disabled(e) {
826
+ this.#t.set(e);
827
+ }
828
+ get label() {
829
+ return this.getAttribute("label") ?? this.textContent?.trim() ?? "";
830
+ }
831
+ attributeChangedCallback(e, t, n) {
832
+ t !== n && (v({ disabled: this.#t }, e, n), super.attributeChangedCallback?.(e, t, n));
833
+ }
834
+ setup() {
835
+ super.setup(), this.#n = new c(this, { disabled: () => this.disabled }), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "-1"), this.addEffect(w(this, this.#t.signal, this.#e)), this.addEventListener("ui-press", this.#r);
836
+ }
837
+ teardown() {
838
+ this.removeEventListener("ui-press", this.#r), this.#n.destroy(), super.teardown();
839
+ }
840
+ #r = () => {
841
+ this.#t.value || this.dispatchEvent(new CustomEvent("ui-select", {
842
+ bubbles: !0,
843
+ composed: !0,
844
+ detail: {
845
+ value: this.value,
846
+ label: this.label
847
+ }
848
+ }));
849
+ };
850
+ }, F = class extends _ {
851
+ static observedAttributes = [
852
+ "placement",
853
+ "delay",
854
+ "disabled"
855
+ ];
856
+ #e;
857
+ #t = t(!1);
858
+ #n = t(!1);
859
+ #r = null;
860
+ #i = null;
861
+ #a = "";
862
+ constructor() {
863
+ super(), this.#e = this.attachInternals();
864
+ }
865
+ get disabled() {
866
+ return this.#n.value;
867
+ }
868
+ set disabled(e) {
869
+ this.#n.value = e, this.toggleAttribute("disabled", e);
870
+ }
871
+ get placement() {
872
+ return this.getAttribute("placement") ?? "top";
873
+ }
874
+ set placement(e) {
875
+ this.setAttribute("placement", e);
876
+ }
877
+ get delay() {
878
+ return Number(this.getAttribute("delay") ?? 500);
879
+ }
880
+ set delay(e) {
881
+ this.setAttribute("delay", String(e));
882
+ }
883
+ attributeChangedCallback(e, t, n) {
884
+ t !== n && (e === "disabled" && (this.#n.value = n !== null), super.attributeChangedCallback?.(e, t, n));
885
+ }
886
+ setup() {
887
+ super.setup(), this.addEffect(w(this, this.#n, this.#e)), this.#i = this.parentElement, this.#i && (this.#a = r("tip"), this.#i.style.setProperty("anchor-name", `--${this.#a}`), this.style.setProperty("position-anchor", `--${this.#a}`), this.hasAttribute("popover") || this.setAttribute("popover", "manual"), this.id ||= r("tooltip"), this.#i.setAttribute("aria-describedby", this.id), this.#i.addEventListener("mouseenter", this.#o), this.#i.addEventListener("mouseleave", this.#s), this.#i.addEventListener("focusin", this.#o), this.#i.addEventListener("focusout", this.#s), this.#i.addEventListener("keydown", this.#c), this.addEffect(() => {
888
+ this.#n.value && this.#t.value && (this.#l(), this.#t.value = !1);
889
+ }), this.addEffect(() => {
890
+ if (this.#t.value) try {
891
+ this.showPopover();
892
+ } catch {}
893
+ else try {
894
+ this.hidePopover();
895
+ } catch {}
896
+ }));
897
+ }
898
+ teardown() {
899
+ this.#l(), this.#i &&= (this.#i.removeEventListener("mouseenter", this.#o), this.#i.removeEventListener("mouseleave", this.#s), this.#i.removeEventListener("focusin", this.#o), this.#i.removeEventListener("focusout", this.#s), this.#i.removeEventListener("keydown", this.#c), this.#i.removeAttribute("aria-describedby"), this.#i.style.removeProperty("anchor-name"), null), super.teardown();
900
+ }
901
+ #o = () => {
902
+ this.#n.value || (this.#l(), this.#r = setTimeout(() => {
903
+ this.#t.value = !0;
904
+ }, this.delay));
905
+ };
906
+ #s = () => {
907
+ this.#l(), this.#t.value = !1;
908
+ };
909
+ #c = (e) => {
910
+ e.key === "Escape" && this.#t.value && (this.#t.value = !1);
911
+ };
912
+ #l() {
913
+ this.#r !== null && (clearTimeout(this.#r), this.#r = null);
914
+ }
915
+ }, I = class extends _ {
916
+ static observedAttributes = ["multiple", "disabled"];
917
+ #e = t(!1);
918
+ get multiple() {
919
+ return this.hasAttribute("multiple");
920
+ }
921
+ set multiple(e) {
922
+ this.toggleAttribute("multiple", e);
923
+ }
924
+ get disabled() {
925
+ return this.#e.value;
926
+ }
927
+ set disabled(e) {
928
+ this.#e.value = e, this.toggleAttribute("disabled", e);
929
+ }
930
+ attributeChangedCallback(e, t, n) {
931
+ if (t !== n) {
932
+ switch (e) {
933
+ case "disabled":
934
+ this.#e.value = n !== null;
935
+ break;
936
+ case "multiple":
937
+ if (n === null && this.isConnected) {
938
+ let e = [...this.querySelectorAll(":scope > ui-accordion-item[open]")];
939
+ for (let t = 1; t < e.length; t++) e[t].open = !1;
940
+ }
941
+ break;
942
+ }
943
+ super.attributeChangedCallback?.(e, t, n);
944
+ }
945
+ }
946
+ setup() {
947
+ super.setup(), this.addEffect(w(this, this.#e)), this.addEventListener("toggle", this.#t, !0);
948
+ }
949
+ teardown() {
950
+ this.removeEventListener("toggle", this.#t, !0), super.teardown();
951
+ }
952
+ #t = (e) => {
953
+ if (this.multiple) return;
954
+ let t = e.target;
955
+ if (!t.open) return;
956
+ let n = t.closest("ui-accordion-item");
957
+ if (!n) return;
958
+ let r = this.querySelectorAll(":scope > ui-accordion-item[open]");
959
+ for (let e of r) e !== n && (e.open = !1);
960
+ };
961
+ }, L = class extends _ {
962
+ static observedAttributes = ["open", "disabled"];
963
+ #e = t(!1);
964
+ #t = t(!1);
965
+ #n = null;
966
+ get open() {
967
+ return this.#e.value;
968
+ }
969
+ set open(e) {
970
+ this.#e.value = e, this.toggleAttribute("open", e);
971
+ }
972
+ get disabled() {
973
+ return this.#t.value;
974
+ }
975
+ set disabled(e) {
976
+ this.#t.value = e, this.toggleAttribute("disabled", e);
977
+ }
978
+ attributeChangedCallback(e, t, n) {
979
+ if (t !== n) {
980
+ switch (e) {
981
+ case "open":
982
+ this.#e.value = n !== null;
983
+ break;
984
+ case "disabled":
985
+ this.#t.value = n !== null;
986
+ break;
987
+ }
988
+ super.attributeChangedCallback?.(e, t, n);
989
+ }
990
+ }
991
+ setup() {
992
+ super.setup();
993
+ let e = document.createElement("details"), t = document.createElement("summary"), n = this.querySelector(":scope > [slot=\"heading\"]");
994
+ n && (n.removeAttribute("slot"), t.appendChild(n));
995
+ let r = document.createElement("div");
996
+ for (r.setAttribute("part", "content"); this.firstChild;) r.appendChild(this.firstChild);
997
+ e.appendChild(t), e.appendChild(r), this.appendChild(e), this.#n = e, this.addEffect(() => {
998
+ let e = this.#e.value;
999
+ this.#n && (this.#n.open = e);
1000
+ }), this.addEffect(w(this, this.#t)), e.addEventListener("toggle", this.#r);
1001
+ }
1002
+ teardown() {
1003
+ this.#n?.removeEventListener("toggle", this.#r), this.#n = null, super.teardown();
1004
+ }
1005
+ #r = () => {
1006
+ if (!this.#n) return;
1007
+ let e = this.#n.open;
1008
+ this.#e.value = e, this.toggleAttribute("open", e);
1009
+ };
1010
+ }, R = class extends _ {
1011
+ #e;
1012
+ get open() {
1013
+ return this.#e.open;
1014
+ }
1015
+ showModal() {
1016
+ this.#e.showModal();
1017
+ }
1018
+ close() {
1019
+ this.#e.close();
1020
+ }
1021
+ setup() {
1022
+ super.setup(), this.#e = new s(this);
1023
+ }
1024
+ teardown() {
1025
+ this.#e.destroy(), super.teardown();
1026
+ }
1027
+ }, z = class extends _ {
1028
+ static observedAttributes = [
1029
+ "value",
1030
+ "disabled",
1031
+ "orientation"
1032
+ ];
1033
+ #e;
1034
+ #t = t(!1);
1035
+ #n;
1036
+ constructor() {
1037
+ super(), this.#e = this.attachInternals(), this.#e.role = "tablist";
1038
+ }
1039
+ get value() {
1040
+ return this.#n?.listValue.value ?? null;
1041
+ }
1042
+ set value(e) {
1043
+ this.#n && (this.#n.listValue.value = e), e === null ? this.removeAttribute("value") : this.setAttribute("value", e);
1044
+ }
1045
+ get disabled() {
1046
+ return this.#t.value;
1047
+ }
1048
+ set disabled(e) {
1049
+ this.#t.value = e, this.toggleAttribute("disabled", e);
1050
+ }
1051
+ attributeChangedCallback(e, t, n) {
1052
+ if (t !== n) {
1053
+ switch (e) {
1054
+ case "value":
1055
+ this.#n && (this.#n.listValue.value = n);
1056
+ break;
1057
+ case "disabled":
1058
+ this.#t.value = n !== null;
1059
+ break;
1060
+ case "orientation":
1061
+ this.#n && (this.#n.rovingFocus.orientation = n === "vertical" ? "vertical" : "horizontal");
1062
+ break;
1063
+ }
1064
+ super.attributeChangedCallback?.(e, t, n);
1065
+ }
1066
+ }
1067
+ setup() {
1068
+ super.setup(), this.#n = new g(this, {
1069
+ itemSelector: ":scope > ui-tab:not([disabled])",
1070
+ orientation: "horizontal",
1071
+ autoSync: !0,
1072
+ onChildSelect: (e) => {
1073
+ this.#n.listValue.value = e.value, this.setAttribute("value", e.value), this.dispatchEvent(new CustomEvent("ui-change", {
1074
+ bubbles: !0,
1075
+ composed: !0,
1076
+ detail: e
1077
+ }));
1078
+ },
1079
+ addEffect: (e) => this.addEffect(e),
1080
+ deferChildren: (e) => this.deferChildren(e)
1081
+ });
1082
+ let e = this.getAttribute("value");
1083
+ e !== null && (this.#n.listValue.value = e), this.hasAttribute("aria-label") || this.setAttribute("aria-label", "Tabs"), this.addEffect(w(this, this.#t, this.#e)), this.addEffect(() => {
1084
+ let e = this.#t.value, t = this.querySelectorAll(":scope > ui-tab");
1085
+ for (let n of t) n.toggleAttribute("disabled", e);
1086
+ }), this.deferChildren(() => {
1087
+ this.#r(), this.addEffect(() => {
1088
+ let e = this.#n.listValue.value, t = this.querySelectorAll(":scope > ui-tab"), n = this.querySelectorAll(":scope > ui-tab-panels > ui-tab-panel"), r = -1, i = 0;
1089
+ for (let n of t) (n.getAttribute("value") ?? "") === e && (r = i), i++;
1090
+ for (let t of n) {
1091
+ let n = (t.getAttribute("value") ?? "") === e;
1092
+ t.toggleAttribute("hidden", !n), t.setAttribute("tabindex", n ? "0" : "-1");
1093
+ }
1094
+ this.#i(r, i);
1095
+ });
1096
+ });
1097
+ }
1098
+ teardown() {
1099
+ this.#n.destroy(), super.teardown();
1100
+ }
1101
+ #r() {
1102
+ let e = this.querySelectorAll(":scope > ui-tab"), t = this.querySelectorAll(":scope > ui-tab-panels > ui-tab-panel"), n = /* @__PURE__ */ new Map();
1103
+ for (let e of t) e.id ||= r("tp"), n.set(e.getAttribute("value") ?? "", e);
1104
+ for (let t of e) {
1105
+ t.id ||= r("tab");
1106
+ let e = n.get(t.getAttribute("value") ?? "");
1107
+ e && (t.setAttribute("aria-controls", e.id), e.setAttribute("aria-labelledby", t.id));
1108
+ }
1109
+ }
1110
+ #i(e, t) {
1111
+ if (e < 0) {
1112
+ this.#e.states.delete("ready");
1113
+ return;
1114
+ }
1115
+ this.style.setProperty("--_indicator-index", `${e}`), this.style.setProperty("--_tab-count", `${t}`), this.#e.states.add("ready");
1116
+ }
1117
+ }, B = class extends _ {
1118
+ static observedAttributes = ["disabled"];
1119
+ #e;
1120
+ #t;
1121
+ #n;
1122
+ constructor() {
1123
+ super(), this.#e = this.attachInternals(), this.#e.role = "tab", this.#t = x(this, "disabled", { type: "boolean" });
1124
+ }
1125
+ get value() {
1126
+ return this.getAttribute("value") ?? "";
1127
+ }
1128
+ set value(e) {
1129
+ this.setAttribute("value", e);
1130
+ }
1131
+ get disabled() {
1132
+ return this.#t.value;
1133
+ }
1134
+ set disabled(e) {
1135
+ this.#t.set(e);
1136
+ }
1137
+ get label() {
1138
+ return this.getAttribute("label") ?? this.textContent?.trim() ?? "";
1139
+ }
1140
+ attributeChangedCallback(e, t, n) {
1141
+ t !== n && (v({ disabled: this.#t }, e, n), super.attributeChangedCallback?.(e, t, n));
1142
+ }
1143
+ setup() {
1144
+ super.setup(), this.#n = new c(this, { disabled: () => this.disabled }), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "-1"), this.addEffect(w(this, this.#t.signal, this.#e)), this.addEventListener("ui-press", this.#r);
1145
+ }
1146
+ teardown() {
1147
+ this.removeEventListener("ui-press", this.#r), this.#n.destroy(), super.teardown();
1148
+ }
1149
+ #r = () => {
1150
+ this.disabled || this.dispatchEvent(new CustomEvent("ui-select", {
1151
+ bubbles: !0,
1152
+ composed: !0,
1153
+ detail: {
1154
+ value: this.value,
1155
+ label: this.label
1156
+ }
1157
+ }));
1158
+ };
1159
+ }, V = class extends _ {
1160
+ static observedAttributes = ["value"];
1161
+ #e;
1162
+ constructor() {
1163
+ super(), this.#e = this.attachInternals(), this.#e.role = "tabpanel";
1164
+ }
1165
+ get value() {
1166
+ return this.getAttribute("value") ?? "";
1167
+ }
1168
+ set value(e) {
1169
+ this.setAttribute("value", e);
1170
+ }
1171
+ attributeChangedCallback(e, t, n) {
1172
+ t !== n && super.attributeChangedCallback?.(e, t, n);
1173
+ }
1174
+ }, H = class extends _ {
1175
+ #e;
1176
+ constructor() {
1177
+ super(), this.#e = this.attachInternals(), this.#e.role = "presentation";
1178
+ }
1179
+ }, U = class {
1180
+ sortColumn;
1181
+ sortDirection;
1182
+ selected;
1183
+ columnWidths;
1184
+ constructor(e = {}) {
1185
+ this.sortColumn = t(e.sortColumn ?? null), this.sortDirection = t(e.sortDirection ?? "none"), this.selected = t(/* @__PURE__ */ new Set()), this.columnWidths = t([]);
1186
+ }
1187
+ toggleSort(e) {
1188
+ n(() => {
1189
+ if (this.sortColumn.value === e) {
1190
+ let e = this.sortDirection.value;
1191
+ this.sortDirection.value = e === "asc" ? "desc" : e === "desc" ? "none" : "asc", this.sortDirection.value === "none" && (this.sortColumn.value = null);
1192
+ } else this.sortColumn.value = e, this.sortDirection.value = "asc";
1193
+ });
1194
+ }
1195
+ select(e) {
1196
+ let t = new Set(this.selected.value);
1197
+ t.add(e), this.selected.value = t;
1198
+ }
1199
+ deselect(e) {
1200
+ let t = new Set(this.selected.value);
1201
+ t.delete(e), this.selected.value = t;
1202
+ }
1203
+ toggle(e) {
1204
+ this.selected.value.has(e) ? this.deselect(e) : this.select(e);
1205
+ }
1206
+ selectAll(e) {
1207
+ this.selected.value = new Set(e);
1208
+ }
1209
+ clearSelection() {
1210
+ this.selected.value = /* @__PURE__ */ new Set();
1211
+ }
1212
+ isSelected(e) {
1213
+ return this.selected.value.has(e);
1214
+ }
1215
+ };
1216
+ function W(e = {}) {
1217
+ return new U(e);
1218
+ }
1219
+ var G = class {
1220
+ table;
1221
+ #e = [];
1222
+ #t = -1;
1223
+ #n = 0;
1224
+ #r = 0;
1225
+ #i = !1;
1226
+ #a;
1227
+ #o;
1228
+ constructor(e, t = {}) {
1229
+ this.table = e, this.#a = t.minWidth ?? 48, this.#o = t.maxWidth ?? Infinity;
1230
+ }
1231
+ /** Call after table is in DOM and has computed layout. */
1232
+ init() {
1233
+ this.table.addEventListener("pointerdown", this.#l);
1234
+ }
1235
+ destroy() {
1236
+ this.table.removeEventListener("pointerdown", this.#l), this.#m();
1237
+ }
1238
+ #s() {
1239
+ this.#e = getComputedStyle(this.table).gridTemplateColumns.split(/\s+/).map((e) => parseFloat(e));
1240
+ }
1241
+ #c() {
1242
+ this.table.style.gridTemplateColumns = this.#e.map((e) => `${e}px`).join(" ");
1243
+ }
1244
+ #l = (e) => {
1245
+ if (e.button !== 0) return;
1246
+ let t = e.target.closest?.(".table-resize-handle");
1247
+ if (!t || !this.table.contains(t)) return;
1248
+ let n = t.closest("ui-table-header");
1249
+ if (!n) return;
1250
+ let r = n.closest("ui-table-row");
1251
+ if (!r) return;
1252
+ let i = [...r.querySelectorAll("ui-table-header")];
1253
+ this.#s();
1254
+ let a = i.indexOf(n);
1255
+ a === -1 || a >= this.#e.length || (e.preventDefault(), e.stopPropagation(), this.table.style.width || (this.table.style.width = `${this.table.offsetWidth}px`), this.#i = !0, this.#t = a, this.#n = e.clientX, this.#r = this.#e[a], t.setPointerCapture(e.pointerId), this.table.setAttribute("resizing", ""), document.addEventListener("pointermove", this.#u), document.addEventListener("pointerup", this.#d), document.addEventListener("pointercancel", this.#f), document.addEventListener("keydown", this.#p), this.table.dispatchEvent(new CustomEvent("ui-table-resize-start", {
1256
+ bubbles: !0,
1257
+ composed: !0,
1258
+ detail: {
1259
+ column: a,
1260
+ width: this.#r
1261
+ }
1262
+ })));
1263
+ };
1264
+ #u = (e) => {
1265
+ if (!this.#i) return;
1266
+ let t = e.clientX - this.#n, n = Math.min(this.#o, Math.max(this.#a, this.#r + t));
1267
+ this.#e[this.#t] = n, this.#c(), this.table.dispatchEvent(new CustomEvent("ui-table-resize", {
1268
+ bubbles: !0,
1269
+ composed: !0,
1270
+ detail: {
1271
+ column: this.#t,
1272
+ width: n
1273
+ }
1274
+ }));
1275
+ };
1276
+ #d = (e) => {
1277
+ this.#i && (this.table.dispatchEvent(new CustomEvent("ui-table-resize-end", {
1278
+ bubbles: !0,
1279
+ composed: !0,
1280
+ detail: {
1281
+ column: this.#t,
1282
+ width: this.#e[this.#t],
1283
+ allWidths: [...this.#e]
1284
+ }
1285
+ })), this.#m());
1286
+ };
1287
+ #f = () => {
1288
+ this.#i && (this.#e[this.#t] = this.#r, this.#c(), this.#m());
1289
+ };
1290
+ #p = (e) => {
1291
+ e.key === "Escape" && this.#i && (e.preventDefault(), this.#e[this.#t] = this.#r, this.#c(), this.#m());
1292
+ };
1293
+ #m() {
1294
+ this.#i = !1, this.#t = -1, this.table.removeAttribute("resizing"), document.removeEventListener("pointermove", this.#u), document.removeEventListener("pointerup", this.#d), document.removeEventListener("pointercancel", this.#f), document.removeEventListener("keydown", this.#p);
1295
+ }
1296
+ }, K = class {
1297
+ #e;
1298
+ #t;
1299
+ #n;
1300
+ #r = !1;
1301
+ constructor(e, t) {
1302
+ this.#t = t, this.#n = e, this.#e = new o(e, {
1303
+ selector: "ui-table-row:not([colspan])",
1304
+ axis: "vertical",
1305
+ mode: "slot"
1306
+ }), e.addEventListener("ui-drag-start", this.#i), e.addEventListener("ui-drop", this.#a), e.addEventListener("click", this.#o, { capture: !0 });
1307
+ }
1308
+ #i = (e) => {
1309
+ this.#r = !0;
1310
+ let t = this.#n.querySelector(":scope > [popover][aria-hidden=\"true\"]");
1311
+ t && (t.style.gridTemplateColumns = getComputedStyle(this.#t).gridTemplateColumns, t.style.display = "grid", t.style.alignItems = "center");
1312
+ };
1313
+ #a = (e) => {
1314
+ let t = e.detail, n = new CustomEvent("ui-table-reorder", {
1315
+ bubbles: !0,
1316
+ composed: !0,
1317
+ cancelable: !0,
1318
+ detail: {
1319
+ row: t.item,
1320
+ fromIndex: t.fromIndex,
1321
+ toIndex: t.toIndex
1322
+ }
1323
+ });
1324
+ this.#t.dispatchEvent(n) && (t.insertBefore ? this.#n.insertBefore(t.item, t.insertBefore) : this.#n.appendChild(t.item));
1325
+ };
1326
+ #o = (e) => {
1327
+ this.#r &&= (e.stopPropagation(), !1);
1328
+ };
1329
+ destroy() {
1330
+ this.#n.removeEventListener("ui-drag-start", this.#i), this.#n.removeEventListener("ui-drop", this.#a), this.#n.removeEventListener("click", this.#o, { capture: !0 }), this.#e.destroy();
1331
+ }
1332
+ }, q = class extends _ {
1333
+ static observedAttributes = [
1334
+ "selectable",
1335
+ "resizable",
1336
+ "reorderable"
1337
+ ];
1338
+ #e;
1339
+ #t = new U();
1340
+ #n = null;
1341
+ #r = null;
1342
+ #i = null;
1343
+ constructor() {
1344
+ super(), this.#e = this.attachInternals(), this.#e.role = "table";
1345
+ }
1346
+ get store() {
1347
+ return this.#t;
1348
+ }
1349
+ set store(e) {
1350
+ this.#t = e;
1351
+ }
1352
+ get selectable() {
1353
+ return this.hasAttribute("selectable");
1354
+ }
1355
+ set selectable(e) {
1356
+ this.toggleAttribute("selectable", e);
1357
+ }
1358
+ attributeChangedCallback(e, t, n) {
1359
+ if (t !== n) {
1360
+ switch (e) {
1361
+ case "resizable":
1362
+ n !== null && !this.#n ? this.#a() : n === null && this.#n && (this.#n.destroy(), this.#n = null);
1363
+ break;
1364
+ case "reorderable":
1365
+ n !== null && !this.#i ? this.#s() : n === null && this.#i && (this.#i.destroy(), this.#i = null);
1366
+ break;
1367
+ }
1368
+ super.attributeChangedCallback?.(e, t, n);
1369
+ }
1370
+ }
1371
+ setup() {
1372
+ super.setup(), this.addEventListener("ui-sort", this.#c), this.addEventListener("ui-row-select", this.#l), this.deferChildren(() => {
1373
+ this.addEffect(() => {
1374
+ let e = this.#t.sortColumn.value, t = this.#t.sortDirection.value, n = this.querySelectorAll("ui-table-header[sortable]");
1375
+ for (let r of n) r.column === e ? (r.setAttribute("sort", t), r.setAttribute("aria-sort", t === "asc" ? "ascending" : t === "desc" ? "descending" : "none")) : (r.setAttribute("sort", "none"), r.removeAttribute("aria-sort"));
1376
+ }), this.addEffect(() => {
1377
+ let e = this.#t.selected.value, t = this.querySelectorAll("ui-table-body ui-table-row");
1378
+ for (let n of t) {
1379
+ let t = e.has(n.value);
1380
+ n.toggleAttribute("selected", t), n.setAttribute("aria-selected", t ? "true" : "false");
1381
+ }
1382
+ }), this.addEffect(() => {
1383
+ let e = this.#t.sortColumn.value, t = this.querySelectorAll("ui-table-body ui-table-row[colspan]");
1384
+ for (let n of t) n.toggleAttribute("hidden", e !== null);
1385
+ }), this.hasAttribute("resizable") && this.#a(), this.hasAttribute("sticky-header") && this.#o(), this.hasAttribute("reorderable") && this.#s();
1386
+ });
1387
+ }
1388
+ teardown() {
1389
+ this.#n?.destroy(), this.#n = null, this.#r?.disconnect(), this.#r = null, this.#i?.destroy(), this.#i = null, this.removeEventListener("ui-sort", this.#c), this.removeEventListener("ui-row-select", this.#l), super.teardown();
1390
+ }
1391
+ #a() {
1392
+ let e = this.querySelectorAll("ui-table-header");
1393
+ for (let t of e) {
1394
+ let e = document.createElement("div");
1395
+ e.className = "table-resize-handle", e.setAttribute("aria-hidden", "true"), e.addEventListener("click", (e) => e.stopPropagation()), t.appendChild(e);
1396
+ }
1397
+ this.#n = new G(this), this.#n.init();
1398
+ }
1399
+ #o() {
1400
+ let e = this.querySelector(":scope > ui-table-head > ui-table-row");
1401
+ e && (this.#r = new ResizeObserver((e) => {
1402
+ for (let t of e) {
1403
+ let e = t.borderBoxSize?.[0]?.blockSize ?? t.target.getBoundingClientRect().height;
1404
+ this.style.setProperty("--_header-height", `${e}px`);
1405
+ }
1406
+ }), this.#r.observe(e));
1407
+ }
1408
+ #s() {
1409
+ let e = this.querySelector(":scope > ui-table-body");
1410
+ e && (this.#i = new K(e, this));
1411
+ }
1412
+ #c = (e) => {
1413
+ let t = e.detail;
1414
+ this.#t.toggleSort(t.column), this.dispatchEvent(new CustomEvent("ui-table-sort", {
1415
+ bubbles: !0,
1416
+ composed: !0,
1417
+ detail: {
1418
+ column: this.#t.sortColumn.value,
1419
+ direction: this.#t.sortDirection.value
1420
+ }
1421
+ }));
1422
+ };
1423
+ #l = (e) => {
1424
+ if (!this.selectable) return;
1425
+ let t = e.detail;
1426
+ this.#t.toggle(t.value), this.dispatchEvent(new CustomEvent("ui-table-select", {
1427
+ bubbles: !0,
1428
+ composed: !0,
1429
+ detail: {
1430
+ value: t.value,
1431
+ selected: this.#t.isSelected(t.value),
1432
+ allSelected: [...this.#t.selected.value]
1433
+ }
1434
+ }));
1435
+ };
1436
+ }, J = class extends _ {
1437
+ #e;
1438
+ constructor() {
1439
+ super(), this.#e = this.attachInternals(), this.#e.role = "rowgroup";
1440
+ }
1441
+ }, Y = class extends _ {
1442
+ #e;
1443
+ constructor() {
1444
+ super(), this.#e = this.attachInternals(), this.#e.role = "rowgroup";
1445
+ }
1446
+ }, ae = class extends _ {
1447
+ static observedAttributes = ["value", "selected"];
1448
+ #e;
1449
+ constructor() {
1450
+ super(), this.#e = this.attachInternals(), this.#e.role = "row";
1451
+ }
1452
+ get value() {
1453
+ return this.getAttribute("value") ?? "";
1454
+ }
1455
+ set value(e) {
1456
+ this.setAttribute("value", e);
1457
+ }
1458
+ get selected() {
1459
+ return this.hasAttribute("selected");
1460
+ }
1461
+ set selected(e) {
1462
+ this.toggleAttribute("selected", e);
1463
+ }
1464
+ setup() {
1465
+ super.setup(), this.addEventListener("click", this.#t);
1466
+ }
1467
+ teardown() {
1468
+ this.removeEventListener("click", this.#t), super.teardown();
1469
+ }
1470
+ #t = () => {
1471
+ this.hasAttribute("colspan") || this.closest("ui-table")?.hasAttribute("selectable") && this.dispatchEvent(new CustomEvent("ui-row-select", {
1472
+ bubbles: !0,
1473
+ composed: !0,
1474
+ detail: { value: this.value }
1475
+ }));
1476
+ };
1477
+ }, oe = class extends _ {
1478
+ #e;
1479
+ constructor() {
1480
+ super(), this.#e = this.attachInternals(), this.#e.role = "cell";
1481
+ }
1482
+ }, se = class extends _ {
1483
+ static observedAttributes = ["sort", "sortable"];
1484
+ #e;
1485
+ constructor() {
1486
+ super(), this.#e = this.attachInternals(), this.#e.role = "columnheader";
1487
+ }
1488
+ get column() {
1489
+ return this.getAttribute("column") ?? "";
1490
+ }
1491
+ get sortable() {
1492
+ return this.hasAttribute("sortable");
1493
+ }
1494
+ get sort() {
1495
+ return this.getAttribute("sort") ?? "none";
1496
+ }
1497
+ set sort(e) {
1498
+ this.setAttribute("sort", e);
1499
+ }
1500
+ attributeChangedCallback(e, t, n) {
1501
+ if (t !== n) {
1502
+ switch (e) {
1503
+ case "sortable":
1504
+ n === null ? (this.removeAttribute("tabindex"), this.removeEventListener("click", this.#t), this.removeEventListener("keydown", this.#n)) : (this.setAttribute("tabindex", "0"), this.addEventListener("click", this.#t), this.addEventListener("keydown", this.#n));
1505
+ break;
1506
+ }
1507
+ super.attributeChangedCallback?.(e, t, n);
1508
+ }
1509
+ }
1510
+ setup() {
1511
+ super.setup(), this.sortable && (this.setAttribute("tabindex", "0"), this.addEventListener("click", this.#t), this.addEventListener("keydown", this.#n));
1512
+ }
1513
+ teardown() {
1514
+ this.removeEventListener("click", this.#t), this.removeEventListener("keydown", this.#n), super.teardown();
1515
+ }
1516
+ #t = () => {
1517
+ this.sortable && this.dispatchEvent(new CustomEvent("ui-sort", {
1518
+ bubbles: !0,
1519
+ composed: !0,
1520
+ detail: { column: this.column }
1521
+ }));
1522
+ };
1523
+ #n = (e) => {
1524
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.#t());
1525
+ };
1526
+ };
1527
+ function X(e) {
1528
+ if (!e) return null;
1529
+ let t = /* @__PURE__ */ new Date(e + "T00:00:00");
1530
+ return isNaN(t.getTime()) ? null : t;
1531
+ }
1532
+ function ce(e) {
1533
+ return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
1534
+ }
1535
+ function Z(e, t) {
1536
+ return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
1537
+ }
1538
+ var Q = class {
1539
+ view;
1540
+ focusedYear;
1541
+ focusedMonth;
1542
+ value;
1543
+ rangeStart;
1544
+ rangeEnd;
1545
+ min;
1546
+ max;
1547
+ days;
1548
+ months;
1549
+ years;
1550
+ title;
1551
+ constructor(n = {}) {
1552
+ let r = /* @__PURE__ */ new Date(), i = X(n.value ?? null) ?? r;
1553
+ this.view = t("day"), this.focusedYear = t(i.getFullYear()), this.focusedMonth = t(i.getMonth()), this.value = t(n.value ?? null), this.rangeStart = t(n.rangeStart ?? null), this.rangeEnd = t(n.rangeEnd ?? null), this.min = t(n.min ?? null), this.max = t(n.max ?? null), this.days = e(() => this.#e()), this.months = e(() => this.#t()), this.years = e(() => this.#n()), this.title = e(() => this.#r());
1554
+ }
1555
+ prevMonth() {
1556
+ n(() => {
1557
+ this.focusedMonth.value === 0 ? (this.focusedMonth.value = 11, this.focusedYear.value--) : this.focusedMonth.value--;
1558
+ });
1559
+ }
1560
+ nextMonth() {
1561
+ n(() => {
1562
+ this.focusedMonth.value === 11 ? (this.focusedMonth.value = 0, this.focusedYear.value++) : this.focusedMonth.value++;
1563
+ });
1564
+ }
1565
+ prevYear() {
1566
+ this.focusedYear.value--;
1567
+ }
1568
+ nextYear() {
1569
+ this.focusedYear.value++;
1570
+ }
1571
+ prevDecade() {
1572
+ this.focusedYear.value -= 10;
1573
+ }
1574
+ nextDecade() {
1575
+ this.focusedYear.value += 10;
1576
+ }
1577
+ selectDate(e) {
1578
+ this.value.value = e;
1579
+ }
1580
+ selectMonth(e) {
1581
+ n(() => {
1582
+ this.focusedMonth.value = e, this.view.value = "day";
1583
+ });
1584
+ }
1585
+ selectYear(e) {
1586
+ n(() => {
1587
+ this.focusedYear.value = e, this.view.value = "month";
1588
+ });
1589
+ }
1590
+ setRange(e, t) {
1591
+ n(() => {
1592
+ this.rangeStart.value = e, this.rangeEnd.value = t;
1593
+ });
1594
+ }
1595
+ isDateDisabled(e) {
1596
+ let t = X(this.min.value), n = X(this.max.value), r = X(e);
1597
+ return !!(!r || t && r < t || n && r > n);
1598
+ }
1599
+ #e() {
1600
+ let e = this.focusedYear.value, t = this.focusedMonth.value, n = X(this.value.value), r = /* @__PURE__ */ new Date(), i = X(this.rangeStart.value), a = X(this.rangeEnd.value), o = new Date(e, t, 1).getDay(), s = new Date(e, t, 1 - o), c = [];
1601
+ for (let e = 0; e < 42; e++) {
1602
+ let o = new Date(s.getFullYear(), s.getMonth(), s.getDate() + e), l = ce(o), u = o.getMonth() === t, d = Z(o, r), f = n ? Z(o, n) : !1, p = this.isDateDisabled(l), m = !1, h = !1, g = !1;
1603
+ if (i && a) {
1604
+ let e = i <= a ? i : a, t = i <= a ? a : i;
1605
+ m = o >= e && o <= t, h = Z(o, e), g = Z(o, t);
1606
+ }
1607
+ c.push({
1608
+ date: l,
1609
+ day: o.getDate(),
1610
+ inMonth: u,
1611
+ isToday: d,
1612
+ isSelected: f,
1613
+ isDisabled: p,
1614
+ inRange: m,
1615
+ isRangeStart: h,
1616
+ isRangeEnd: g
1617
+ });
1618
+ }
1619
+ return c;
1620
+ }
1621
+ #t() {
1622
+ let e = this.focusedYear.value, t = this.focusedMonth.value;
1623
+ return [
1624
+ "Jan",
1625
+ "Feb",
1626
+ "Mar",
1627
+ "Apr",
1628
+ "May",
1629
+ "Jun",
1630
+ "Jul",
1631
+ "Aug",
1632
+ "Sep",
1633
+ "Oct",
1634
+ "Nov",
1635
+ "Dec"
1636
+ ].map((n, r) => ({
1637
+ month: r,
1638
+ name: n,
1639
+ isCurrent: r === t && e === (/* @__PURE__ */ new Date()).getFullYear(),
1640
+ isSelected: r === t
1641
+ }));
1642
+ }
1643
+ #n() {
1644
+ let e = this.focusedYear.value, t = Math.floor(e / 10) * 10, n = (/* @__PURE__ */ new Date()).getFullYear(), r = [];
1645
+ for (let i = t - 1; i <= t + 10; i++) r.push({
1646
+ year: i,
1647
+ inDecade: i >= t && i < t + 10,
1648
+ isCurrent: i === n,
1649
+ isSelected: i === e
1650
+ });
1651
+ return r;
1652
+ }
1653
+ #r() {
1654
+ let e = [
1655
+ "January",
1656
+ "February",
1657
+ "March",
1658
+ "April",
1659
+ "May",
1660
+ "June",
1661
+ "July",
1662
+ "August",
1663
+ "September",
1664
+ "October",
1665
+ "November",
1666
+ "December"
1667
+ ];
1668
+ switch (this.view.value) {
1669
+ case "day": return `${e[this.focusedMonth.value]} ${this.focusedYear.value}`;
1670
+ case "month": return `${this.focusedYear.value}`;
1671
+ case "year": {
1672
+ let e = Math.floor(this.focusedYear.value / 10) * 10;
1673
+ return `${e}–${e + 9}`;
1674
+ }
1675
+ }
1676
+ }
1677
+ };
1678
+ function le(e = {}) {
1679
+ return new Q(e);
1680
+ }
1681
+ /**
1682
+ * Calendar date picker with day/month/year views and optional range selection.
1683
+ * @attr {string} value - Selected date in ISO format (YYYY-MM-DD)
1684
+ * @attr {string} min - Minimum selectable date in ISO format
1685
+ * @attr {string} max - Maximum selectable date in ISO format
1686
+ * @attr {boolean} disabled - Disables interaction
1687
+ * @attr {string} name - Form field name
1688
+ * @attr {boolean} range - Enables range selection mode
1689
+ * @fires ui-change - Fired on single date selection with `{ value }` detail
1690
+ * @fires ui-range-select - Fired on range commit with `{ start, end }` detail
1691
+ */
1692
+ var ue = class extends S(_) {
1693
+ static observedAttributes = [
1694
+ "value",
1695
+ "min",
1696
+ "max",
1697
+ "disabled",
1698
+ "name",
1699
+ "range",
1700
+ "required"
1701
+ ];
1702
+ #e;
1703
+ #t = new Q();
1704
+ #n = t(!1);
1705
+ #r = t(!1);
1706
+ #i = null;
1707
+ #a = t(0);
1708
+ #o = "idle";
1709
+ constructor() {
1710
+ super(), this.#e = this.attachInternals(), this.#e.role = "group";
1711
+ }
1712
+ get store() {
1713
+ return this.#t;
1714
+ }
1715
+ get value() {
1716
+ return this.#t.value.value;
1717
+ }
1718
+ set value(e) {
1719
+ this.#t.value.value = e, e ? this.setAttribute("value", e) : this.removeAttribute("value");
1720
+ }
1721
+ get disabled() {
1722
+ return this.#n.value;
1723
+ }
1724
+ set disabled(e) {
1725
+ this.#n.value = e, this.toggleAttribute("disabled", e);
1726
+ }
1727
+ get required() {
1728
+ return this.#r.value;
1729
+ }
1730
+ set required(e) {
1731
+ this.#r.value = e, this.toggleAttribute("required", e);
1732
+ }
1733
+ get range() {
1734
+ return this.hasAttribute("range");
1735
+ }
1736
+ attributeChangedCallback(e, t, n) {
1737
+ if (t !== n) {
1738
+ switch (e) {
1739
+ case "value":
1740
+ this.#t.value.value = n;
1741
+ break;
1742
+ case "min":
1743
+ this.#t.min.value = n;
1744
+ break;
1745
+ case "max":
1746
+ this.#t.max.value = n;
1747
+ break;
1748
+ case "disabled":
1749
+ this.#n.value = n !== null;
1750
+ break;
1751
+ case "required":
1752
+ this.#r.value = n !== null;
1753
+ break;
1754
+ case "range":
1755
+ this.#o = "idle", this.#t.setRange(null, null);
1756
+ break;
1757
+ case "name": break;
1758
+ }
1759
+ super.attributeChangedCallback?.(e, t, n);
1760
+ }
1761
+ }
1762
+ setup() {
1763
+ super.setup(), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.#i = this.getAttribute("value");
1764
+ let e = this.getAttribute("value"), t = this.getAttribute("min"), r = this.getAttribute("max");
1765
+ n(() => {
1766
+ e && (this.#t.value.value = e), t && (this.#t.min.value = t), r && (this.#t.max.value = r);
1767
+ }), this.#s(), this.addEventListener("keydown", this.#b), this.addEffect(() => this.#c()), this.addEffect(() => {
1768
+ this.#e.setFormValue(this.#t.value.value);
1769
+ }), this.addEffect(() => {
1770
+ this.setAttribute("aria-label", this.#t.title.value);
1771
+ }), this.addEffect(w(this, this.#n, this.#e, { manageTabindex: !0 })), this.#r.value = this.hasAttribute("required"), this.addEffect(() => {
1772
+ let e = this.#t.value.value;
1773
+ this.#r.value && (e === null || e === "") ? this.#e.setValidity({ valueMissing: !0 }, "Please select a date.", this) : this.#e.setValidity({});
1774
+ });
1775
+ }
1776
+ teardown() {
1777
+ this.querySelector(".cal-prev")?.removeEventListener("click", this.#l), this.querySelector(".cal-next")?.removeEventListener("click", this.#u), this.querySelector(".cal-title")?.removeEventListener("click", this.#d);
1778
+ let e = this.querySelector(".cal-grid");
1779
+ e?.removeEventListener("click", this.#f), e?.removeEventListener("pointermove", this.#p), this.removeEventListener("keydown", this.#b), super.teardown();
1780
+ }
1781
+ onFormDisabled(e) {
1782
+ this.#n.value = e;
1783
+ }
1784
+ onFormReset() {
1785
+ this.#t.value.value = this.#i, this.#i ? this.setAttribute("value", this.#i) : this.removeAttribute("value");
1786
+ }
1787
+ onFormStateRestore(e) {
1788
+ typeof e == "string" && e && (this.value = e);
1789
+ }
1790
+ #s() {
1791
+ this.innerHTML = "\n <div class=\"cal-header\">\n <button type=\"button\" class=\"cal-prev\" aria-label=\"Previous\" tabindex=\"-1\"></button>\n <button type=\"button\" class=\"cal-title\" tabindex=\"-1\"></button>\n <button type=\"button\" class=\"cal-next\" aria-label=\"Next\" tabindex=\"-1\"></button>\n </div>\n <div class=\"cal-weekdays\"></div>\n <div class=\"cal-grid\" role=\"grid\"></div>\n ";
1792
+ let e = this.querySelector(".cal-prev"), t = this.querySelector(".cal-next"), n = this.querySelector(".cal-title");
1793
+ e?.addEventListener("click", this.#l), t?.addEventListener("click", this.#u), n?.addEventListener("click", this.#d);
1794
+ let r = this.querySelector(".cal-grid");
1795
+ r?.addEventListener("click", this.#f), r?.addEventListener("pointermove", this.#p);
1796
+ }
1797
+ #c() {
1798
+ let e = this.#t.view.value, t = this.querySelector(".cal-title"), n = this.querySelector(".cal-weekdays"), r = this.querySelector(".cal-grid");
1799
+ !t || !n || !r || (t.textContent = this.#t.title.value, e === "day" ? (this.setAttribute("view", "day"), n.innerHTML = [
1800
+ "Su",
1801
+ "Mo",
1802
+ "Tu",
1803
+ "We",
1804
+ "Th",
1805
+ "Fr",
1806
+ "Sa"
1807
+ ].map((e) => `<span class="cal-weekday">${e}</span>`).join(""), r.innerHTML = this.#t.days.value.map((e, t) => {
1808
+ let n = `class="cal-cell" data-date="${e.date}" data-index="${t}" tabindex="-1"`;
1809
+ return e.inMonth || (n += " data-outside"), e.isToday && (n += " data-today"), e.isSelected && (n += " data-selected"), e.isDisabled && (n += " disabled"), e.inRange && (n += " data-in-range"), e.isRangeStart && (n += " data-range-start"), e.isRangeEnd && (n += " data-range-end"), `<button type="button" ${n}>${e.day}</button>`;
1810
+ }).join("")) : e === "month" ? (this.setAttribute("view", "month"), n.innerHTML = "", r.innerHTML = this.#t.months.value.map((e) => {
1811
+ let t = `class="cal-cell" data-month="${e.month}" tabindex="-1"`;
1812
+ return e.isCurrent && (t += " data-today"), e.isSelected && (t += " data-selected"), `<button type="button" ${t}>${e.name}</button>`;
1813
+ }).join("")) : (this.setAttribute("view", "year"), n.innerHTML = "", r.innerHTML = this.#t.years.value.map((e) => {
1814
+ let t = `class="cal-cell" data-year="${e.year}" tabindex="-1"`;
1815
+ return e.inDecade || (t += " data-outside"), e.isCurrent && (t += " data-today"), e.isSelected && (t += " data-selected"), `<button type="button" ${t}>${e.year}</button>`;
1816
+ }).join("")));
1817
+ }
1818
+ #l = () => {
1819
+ this.#m();
1820
+ };
1821
+ #u = () => {
1822
+ this.#h();
1823
+ };
1824
+ #d = () => {
1825
+ this.#g();
1826
+ };
1827
+ #f = (e) => {
1828
+ this.#_(e);
1829
+ };
1830
+ #p = (e) => {
1831
+ this.#y(e);
1832
+ };
1833
+ #m() {
1834
+ let e = this.#t.view.value;
1835
+ e === "day" ? this.#t.prevMonth() : e === "month" ? this.#t.prevYear() : this.#t.prevDecade();
1836
+ }
1837
+ #h() {
1838
+ let e = this.#t.view.value;
1839
+ e === "day" ? this.#t.nextMonth() : e === "month" ? this.#t.nextYear() : this.#t.nextDecade();
1840
+ }
1841
+ #g() {
1842
+ let e = this.#t.view.value;
1843
+ e === "day" ? this.#t.view.value = "month" : e === "month" && (this.#t.view.value = "year");
1844
+ }
1845
+ #_(e) {
1846
+ if (this.#n.value) return;
1847
+ let t = e.target.closest(".cal-cell");
1848
+ if (!t || t.hasAttribute("disabled")) return;
1849
+ let n = t.dataset.date, r = t.dataset.month, i = t.dataset.year;
1850
+ n ? this.#v(n) : r === void 0 ? i !== void 0 && this.#t.selectYear(Number(i)) : this.#t.selectMonth(Number(r));
1851
+ }
1852
+ #v(e) {
1853
+ if (this.range) if (this.#o === "idle") n(() => {
1854
+ this.#t.selectDate(e), this.#t.setRange(e, null);
1855
+ }), this.setAttribute("value", e), this.#o = "selecting";
1856
+ else if (this.#o === "selecting") {
1857
+ let t = this.#t.rangeStart.value;
1858
+ if (!t) return;
1859
+ this.#t.setRange(t, e), this.#o = "committed", this.dispatchEvent(new CustomEvent("ui-range-select", {
1860
+ bubbles: !0,
1861
+ composed: !0,
1862
+ detail: {
1863
+ start: this.#t.rangeStart.value,
1864
+ end: this.#t.rangeEnd.value
1865
+ }
1866
+ }));
1867
+ } else n(() => {
1868
+ this.#t.value.value = null, this.#t.setRange(null, null);
1869
+ }), this.removeAttribute("value"), this.#o = "idle";
1870
+ else this.#t.selectDate(e), this.setAttribute("value", e), this.dispatchEvent(new CustomEvent("ui-change", {
1871
+ bubbles: !0,
1872
+ composed: !0,
1873
+ detail: { value: e }
1874
+ }));
1875
+ }
1876
+ #y(e) {
1877
+ if (this.#n.value || !this.range || this.#o !== "selecting") return;
1878
+ let t = e.target.closest(".cal-cell");
1879
+ if (!t || t.hasAttribute("disabled")) return;
1880
+ let n = t.dataset.date;
1881
+ if (!n) return;
1882
+ let r = this.#t.rangeStart.value;
1883
+ r && this.#t.setRange(r, n);
1884
+ }
1885
+ #b = (e) => {
1886
+ if (this.#n.value || this.#t.view.value !== "day") return;
1887
+ let t = this.#t.days.value, n = this.#a.value, r = !0;
1888
+ switch (e.key) {
1889
+ case "ArrowRight":
1890
+ n += 1;
1891
+ break;
1892
+ case "ArrowLeft":
1893
+ --n;
1894
+ break;
1895
+ case "ArrowDown":
1896
+ n += 7;
1897
+ break;
1898
+ case "ArrowUp":
1899
+ n -= 7;
1900
+ break;
1901
+ case "Home":
1902
+ n -= n % 7;
1903
+ break;
1904
+ case "End":
1905
+ n = n - n % 7 + 6;
1906
+ break;
1907
+ case "PageDown":
1908
+ e.shiftKey ? this.#t.nextYear() : this.#t.nextMonth();
1909
+ break;
1910
+ case "PageUp":
1911
+ e.shiftKey ? this.#t.prevYear() : this.#t.prevMonth();
1912
+ break;
1913
+ case "Enter":
1914
+ case " ": {
1915
+ let e = t[n];
1916
+ e && !e.isDisabled && this.#v(e.date);
1917
+ break;
1918
+ }
1919
+ default: r = !1;
1920
+ }
1921
+ r && (e.preventDefault(), n = Math.max(0, Math.min(41, n)), this.#a.value = n, n < 0 && this.#t.prevMonth(), n > 41 && this.#t.nextMonth());
1922
+ };
1923
+ }, de = class extends S(_) {
1924
+ static observedAttributes = [
1925
+ "value",
1926
+ "disabled",
1927
+ "name",
1928
+ "options",
1929
+ "src",
1930
+ "placeholder",
1931
+ "required"
1932
+ ];
1933
+ #e;
1934
+ #t = new C();
1935
+ #n = t(!1);
1936
+ #r = t(!1);
1937
+ #i = t(!1);
1938
+ #a;
1939
+ #o = r("listbox");
1940
+ #s = null;
1941
+ #c = t([]);
1942
+ #l = t(null);
1943
+ #u = t("");
1944
+ #d = !1;
1945
+ #f = null;
1946
+ #p = null;
1947
+ #m = null;
1948
+ #h = "";
1949
+ constructor() {
1950
+ super(), this.#e = this.attachInternals();
1951
+ }
1952
+ get store() {
1953
+ return this.#t;
1954
+ }
1955
+ get value() {
1956
+ return this.#t.value.value;
1957
+ }
1958
+ set value(e) {
1959
+ if (e === null) {
1960
+ n(() => {
1961
+ this.#t.clearSelection(), this.#t.query.value = "", this.#t.activeIndex.value = -1, this.#n.value = !1;
1962
+ });
1963
+ return;
1964
+ }
1965
+ this.#t.select(e);
1966
+ }
1967
+ get name() {
1968
+ return this.getAttribute("name") ?? "";
1969
+ }
1970
+ set name(e) {
1971
+ this.setAttribute("name", e);
1972
+ }
1973
+ get disabled() {
1974
+ return this.#r.value;
1975
+ }
1976
+ set disabled(e) {
1977
+ this.#r.value = e, this.toggleAttribute("disabled", e);
1978
+ }
1979
+ get required() {
1980
+ return this.#i.value;
1981
+ }
1982
+ set required(e) {
1983
+ this.#i.value = e, this.toggleAttribute("required", e);
1984
+ }
1985
+ get options() {
1986
+ return this.#c.value;
1987
+ }
1988
+ set options(e) {
1989
+ this.#c.value = e, this.setAttribute("options", JSON.stringify(e));
1990
+ }
1991
+ get src() {
1992
+ return this.#l.value;
1993
+ }
1994
+ set src(e) {
1995
+ this.#l.value = e, e == null ? this.removeAttribute("src") : this.setAttribute("src", e);
1996
+ }
1997
+ get placeholder() {
1998
+ return this.#u.value;
1999
+ }
2000
+ set placeholder(e) {
2001
+ this.#u.value = e, e ? this.setAttribute("placeholder", e) : this.removeAttribute("placeholder");
2002
+ }
2003
+ #g(e) {
2004
+ return b(e, "ui-combobox");
2005
+ }
2006
+ async #_(e) {
2007
+ this.#f = await y(e, this.#f, this.#c, "ui-combobox");
2008
+ }
2009
+ #v() {
2010
+ let e = document.createElement("ui-input"), t = this.#u.value;
2011
+ t && e.setAttribute("placeholder", t);
2012
+ let n = this.getAttribute("size");
2013
+ n && e.setAttribute("size", n);
2014
+ let r = document.createElement("ui-listbox");
2015
+ r.setAttribute("popover", "manual"), this.appendChild(e), this.appendChild(r);
2016
+ }
2017
+ #y(e) {
2018
+ let t = this.#p;
2019
+ if (t) {
2020
+ for (; t.firstChild;) t.removeChild(t.firstChild);
2021
+ for (let n of e) {
2022
+ let e = document.createElement("ui-option");
2023
+ e.setAttribute("value", n.value), e.setAttribute("label", n.label), e.textContent = n.label, n.disabled && e.setAttribute("disabled", ""), t.appendChild(e);
2024
+ }
2025
+ this.#t.data.value = e;
2026
+ }
2027
+ }
2028
+ attributeChangedCallback(e, t, r) {
2029
+ if (t !== r) {
2030
+ switch (e) {
2031
+ case "value":
2032
+ if (r !== null) {
2033
+ let e = this.querySelector(`ui-option[value="${CSS.escape(r)}"]`), t = e?.getAttribute("label") ?? e?.textContent?.trim() ?? r;
2034
+ this.#t.select(r), this.#t.query.value = t, this.#s && "value" in this.#s && (this.#s.value = t);
2035
+ } else n(() => {
2036
+ this.#t.clearSelection(), this.#t.query.value = "";
2037
+ }), this.#s && "value" in this.#s && (this.#s.value = "");
2038
+ break;
2039
+ case "disabled":
2040
+ this.#r.value = r !== null;
2041
+ break;
2042
+ case "required":
2043
+ this.#i.value = r !== null;
2044
+ break;
2045
+ case "options":
2046
+ r ? this.#c.value = this.#g(r) : this.#c.value = [];
2047
+ break;
2048
+ case "src":
2049
+ this.#l.value = r;
2050
+ break;
2051
+ case "placeholder":
2052
+ this.#u.value = r ?? "";
2053
+ break;
2054
+ }
2055
+ super.attributeChangedCallback?.(e, t, r);
2056
+ }
2057
+ }
2058
+ setup() {
2059
+ if (super.setup(), this.#a = new m(this), this.#d = this.hasAttribute("options") || this.hasAttribute("src"), this.#d) {
2060
+ let e = this.getAttribute("options");
2061
+ e && (this.#c.value = this.#g(e)), this.#l.value = this.getAttribute("src"), this.#u.value = this.getAttribute("placeholder") ?? "", this.#v();
2062
+ }
2063
+ let e = this.querySelector(":scope > ui-input");
2064
+ this.#s = e;
2065
+ let t = this.querySelector(":scope > ui-listbox[popover]");
2066
+ this.#p = t, t?.setAttribute("popover", "manual"), t?.setAttribute("virtual-focus", ""), e && t && (this.#a.wirePopover(e, t), t.id ||= this.#o), e?.setAttribute("role", "combobox"), e?.setAttribute("aria-autocomplete", "list"), e?.setAttribute("aria-controls", t?.id ?? ""), e?.setAttribute("aria-expanded", "false"), this.#d && (this.addEffect(() => {
2067
+ let e = this.#c.value;
2068
+ this.#y(e);
2069
+ }), this.addEffect(() => {
2070
+ let e = this.#l.value;
2071
+ e && this.#_(e);
2072
+ }), this.addEffect(() => {
2073
+ let t = this.#u.value;
2074
+ e && (t ? e.setAttribute("placeholder", t) : e.removeAttribute("placeholder"));
2075
+ })), this.deferChildren(() => {
2076
+ if (!this.#d) {
2077
+ let e = t?.querySelectorAll("ui-option") ?? [];
2078
+ this.#t.data.value = [...e].map((e) => ({
2079
+ value: e.getAttribute("value") ?? "",
2080
+ label: e.getAttribute("label") ?? e.textContent?.trim() ?? ""
2081
+ }));
2082
+ }
2083
+ let n = this.getAttribute("value");
2084
+ if (n) {
2085
+ let e = this.querySelector(`ui-option[value="${CSS.escape(n)}"]`), t = e?.getAttribute("label") ?? e?.textContent?.trim() ?? n;
2086
+ this.#t.value.value = n, this.#t.query.value = t, this.#m = n, this.#h = t;
2087
+ }
2088
+ this.addEffect(() => {
2089
+ let e = this.#t.view.value, n = new Set(e.map((e) => e.value)), r = t?.querySelectorAll("ui-option") ?? [];
2090
+ for (let e of r) e.toggleAttribute("hidden", !n.has(e.getAttribute("value") ?? ""));
2091
+ }), this.addEffect(() => {
2092
+ this.#t.view.value;
2093
+ let n = this.#t.activeIndex.value, i = [...t?.querySelectorAll("ui-option:not([hidden]):not([disabled])") ?? []];
2094
+ for (let e = 0; e < i.length; e++) i[e].toggleAttribute("active", e === n);
2095
+ let a = i[n];
2096
+ a ? (a.scrollIntoView({ block: "nearest" }), a.id ||= r("opt"), e?.setAttribute("aria-activedescendant", a.id)) : e?.removeAttribute("aria-activedescendant");
2097
+ }), this.addEffect(() => {
2098
+ let e = this.#t.value.value, n = t?.querySelectorAll("ui-option") ?? [];
2099
+ for (let t of n) {
2100
+ let n = t.getAttribute("value") === e;
2101
+ t.setAttribute("aria-selected", String(n));
2102
+ }
2103
+ });
2104
+ }), this.addEffect(w(this, this.#r, this.#e)), this.addEffect(() => {
2105
+ let t = this.#r.value;
2106
+ e && e.toggleAttribute("disabled", t), t && this.#n.peek() && (this.#n.value = !1);
2107
+ }), this.#i.value = this.hasAttribute("required"), this.addEffect(() => {
2108
+ let e = this.#t.value.value;
2109
+ this.#i.value && (e === null || e === "") ? this.#e.setValidity({ valueMissing: !0 }, "Please select an option.", this) : this.#e.setValidity({});
2110
+ }), this.addEffect(() => {
2111
+ let t = this.#n.value;
2112
+ this.#a.syncPopover(t), e?.setAttribute("aria-expanded", String(t));
2113
+ }), this.addEffect(() => {
2114
+ let e = this.#t.value.value;
2115
+ this.#e.setFormValue(e ?? ""), e == null ? this.removeAttribute("value") : this.setAttribute("value", e);
2116
+ }), e?.addEventListener("focus", this.#b), this.addEventListener("ui-input", this.#x), this.addEventListener("ui-change", this.#S), this.addEventListener("ui-select", this.#C), this.addEventListener("ui-dismiss", this.#w), e?.addEventListener("keydown", this.#T);
2117
+ }
2118
+ #b = () => {
2119
+ !this.#r.value && !this.#n.value && (this.#n.value = !0);
2120
+ };
2121
+ #x = (e) => {
2122
+ this.#t.setQuery(e.detail.value), this.#n.value = !0;
2123
+ };
2124
+ #S = (e) => {
2125
+ e.target !== this && e.stopImmediatePropagation();
2126
+ };
2127
+ #C = (e) => {
2128
+ let t = e.detail;
2129
+ n(() => {
2130
+ this.#t.select(t.value), this.#t.query.value = t.label, this.#t.activeIndex.value = -1, this.#n.value = !1;
2131
+ });
2132
+ let r = this.#s;
2133
+ r && "value" in r && (r.value = t.label), this.dispatchEvent(new CustomEvent("ui-change", {
2134
+ bubbles: !0,
2135
+ composed: !0,
2136
+ detail: t
2137
+ }));
2138
+ };
2139
+ #w = () => {
2140
+ this.#n.value = !1;
2141
+ };
2142
+ #T = (e) => {
2143
+ if (this.#r.value) return;
2144
+ let t = this.#s;
2145
+ switch (e.key) {
2146
+ case "ArrowDown":
2147
+ e.preventDefault(), this.#n.value || (this.#n.value = !0), this.#t.moveActive(1);
2148
+ break;
2149
+ case "ArrowUp":
2150
+ e.preventDefault(), this.#n.value || (this.#n.value = !0), this.#t.moveActive(-1);
2151
+ break;
2152
+ case "Enter":
2153
+ if (this.#n.value) {
2154
+ e.preventDefault();
2155
+ let n = this.#t.activeItem.value;
2156
+ this.#t.selectActive(), n && t && "value" in t && (this.#t.query.value = n.label, t.value = n.label), this.#t.activeIndex.value = -1, this.#n.value = !1;
2157
+ }
2158
+ break;
2159
+ case "Escape":
2160
+ this.#n.value && (e.preventDefault(), this.#n.value = !1);
2161
+ break;
2162
+ case "Home":
2163
+ this.#n.value && (e.preventDefault(), this.#t.activeIndex.value = 0);
2164
+ break;
2165
+ case "End":
2166
+ if (this.#n.value) {
2167
+ e.preventDefault();
2168
+ let t = this.#t.view.value.length;
2169
+ this.#t.activeIndex.value = Math.max(0, t - 1);
2170
+ }
2171
+ break;
2172
+ }
2173
+ };
2174
+ teardown() {
2175
+ this.#s?.removeEventListener("focus", this.#b), this.#s?.removeEventListener("keydown", this.#T), this.removeEventListener("ui-input", this.#x), this.removeEventListener("ui-change", this.#S), this.removeEventListener("ui-select", this.#C), this.removeEventListener("ui-dismiss", this.#w), this.#s = null, this.#p = null, this.#f?.abort(), this.#f = null, this.#a.destroy(), super.teardown();
2176
+ }
2177
+ onFormReset() {
2178
+ n(() => {
2179
+ this.#m === null ? (this.#t.clearSelection(), this.#t.query.value = "") : (this.#t.select(this.#m), this.#t.query.value = this.#h), this.#t.activeIndex.value = -1, this.#n.value = !1;
2180
+ });
2181
+ let e = this.querySelector(":scope > ui-input");
2182
+ e && (e.value = this.#h);
2183
+ }
2184
+ onFormStateRestore(e) {
2185
+ typeof e == "string" && e && (this.value = e);
2186
+ }
2187
+ onFormDisabled(e) {
2188
+ this.#r.value = e;
2189
+ }
2190
+ }, fe = class extends _ {
2191
+ static observedAttributes = ["disabled", "required"];
2192
+ #e = r("field-label");
2193
+ #t = r("field-desc");
2194
+ #n = r("field-err");
2195
+ #r = null;
2196
+ setup() {
2197
+ super.setup(), this.deferChildren(() => {
2198
+ this.#i(), this.#a(), this.#o(), this.#s(), this.#c();
2199
+ }), this.addEventListener("ui-invalid", this.#l), this.addEventListener("ui-valid", this.#u);
2200
+ }
2201
+ teardown() {
2202
+ this.removeEventListener("ui-invalid", this.#l), this.removeEventListener("ui-valid", this.#u), super.teardown();
2203
+ }
2204
+ attributeChangedCallback(e, t, n) {
2205
+ if (t !== n) {
2206
+ switch (e) {
2207
+ case "disabled":
2208
+ this.#s();
2209
+ break;
2210
+ case "required":
2211
+ this.#c();
2212
+ break;
2213
+ }
2214
+ super.attributeChangedCallback(e, t, n);
2215
+ }
2216
+ }
2217
+ #i() {
2218
+ let e = this.querySelectorAll("ui-input, ui-select, ui-combobox, ui-checkbox, ui-switch, ui-radio, ui-range, ui-textarea, ui-input-otp, input, select, textarea");
2219
+ for (let t of e) if (!t.hasAttribute("slot")) {
2220
+ this.#r = t;
2221
+ break;
2222
+ }
2223
+ }
2224
+ #a() {
2225
+ let e = this.querySelector("[slot=\"label\"]"), t = this.querySelector("[slot=\"description\"]"), n = this.querySelector("[slot=\"error\"]");
2226
+ e && !e.id && (e.id = this.#e), t && !t.id && (t.id = this.#t), n && !n.id && (n.id = this.#n);
2227
+ }
2228
+ #o() {
2229
+ if (!this.#r) return;
2230
+ let e = this.querySelector("[slot=\"label\"]"), t = this.querySelector("[slot=\"description\"]");
2231
+ e && this.#r.setAttribute("aria-labelledby", e.id), t && this.#r.setAttribute("aria-describedby", t.id);
2232
+ }
2233
+ #s() {
2234
+ let e = this.hasAttribute("disabled");
2235
+ e ? this.setAttribute("aria-disabled", "true") : this.removeAttribute("aria-disabled"), this.#r && (e ? this.#r.setAttribute("disabled", "") : this.#r.removeAttribute("disabled"));
2236
+ }
2237
+ #c() {
2238
+ this.#r && (this.hasAttribute("required") ? this.#r.setAttribute("required", "") : this.#r.removeAttribute("required"));
2239
+ }
2240
+ #l = (e) => {
2241
+ let t = e;
2242
+ this.setAttribute("invalid", "");
2243
+ let n = this.querySelector("[slot=\"error\"]");
2244
+ n && t.detail?.message && (n.textContent = t.detail.message), this.#d(!0);
2245
+ };
2246
+ #u = () => {
2247
+ this.removeAttribute("invalid"), this.#d(!1);
2248
+ };
2249
+ #d(e) {
2250
+ if (!this.#r) return;
2251
+ let t = this.querySelector("[slot=\"description\"]"), n = this.querySelector("[slot=\"error\"]"), r = [];
2252
+ t && r.push(t.id), e && n && r.push(n.id), r.length ? this.#r.setAttribute("aria-describedby", r.join(" ")) : this.#r.removeAttribute("aria-describedby");
2253
+ }
2254
+ }, pe = class extends S(_) {
2255
+ static observedAttributes = [
2256
+ "value",
2257
+ "placeholder",
2258
+ "disabled",
2259
+ "readonly",
2260
+ "required",
2261
+ "rows",
2262
+ "maxlength",
2263
+ "autogrow",
2264
+ "pattern"
2265
+ ];
2266
+ #e;
2267
+ #t = t(!1);
2268
+ #n = t(!1);
2269
+ #r = t(NaN);
2270
+ #i = t("");
2271
+ #a = "";
2272
+ #o = 0;
2273
+ #s = null;
2274
+ constructor() {
2275
+ super(), this.#e = this.attachInternals(), this.#e.role = "textbox", this.#e.ariaMultiLine = "true";
2276
+ }
2277
+ get value() {
2278
+ return this.textContent ?? "";
2279
+ }
2280
+ set value(e) {
2281
+ this.textContent = e, this.#i.value = e, this.#e.setFormValue(e), this.#c(), this.#l();
2282
+ }
2283
+ get placeholder() {
2284
+ return this.getAttribute("placeholder") ?? "";
2285
+ }
2286
+ set placeholder(e) {
2287
+ this.setAttribute("placeholder", e);
2288
+ }
2289
+ get name() {
2290
+ return this.getAttribute("name") ?? "";
2291
+ }
2292
+ set name(e) {
2293
+ this.setAttribute("name", e);
2294
+ }
2295
+ get disabled() {
2296
+ return this.#t.value;
2297
+ }
2298
+ set disabled(e) {
2299
+ this.#t.value = e, this.toggleAttribute("disabled", e);
2300
+ }
2301
+ get readOnly() {
2302
+ return this.hasAttribute("readonly");
2303
+ }
2304
+ set readOnly(e) {
2305
+ this.toggleAttribute("readonly", e), this.setAttribute("contenteditable", e ? "false" : "plaintext-only");
2306
+ }
2307
+ get required() {
2308
+ return this.#n.value;
2309
+ }
2310
+ set required(e) {
2311
+ this.#n.value = e, this.toggleAttribute("required", e);
2312
+ }
2313
+ attributeChangedCallback(e, t, n) {
2314
+ if (t !== n) {
2315
+ switch (e) {
2316
+ case "value":
2317
+ this.textContent = n ?? "", this.#i.value = n ?? "", this.#e.setFormValue(n ?? ""), this.#c(), this.#l();
2318
+ break;
2319
+ case "disabled":
2320
+ this.#t.value = n !== null, this.setAttribute("contenteditable", n !== null || this.hasAttribute("readonly") ? "false" : "plaintext-only");
2321
+ break;
2322
+ case "readonly":
2323
+ this.setAttribute("contenteditable", n !== null || this.#t.value ? "false" : "plaintext-only");
2324
+ break;
2325
+ case "required":
2326
+ this.#n.value = n !== null;
2327
+ break;
2328
+ case "maxlength":
2329
+ this.#r.value = n === null ? NaN : parseInt(n, 10);
2330
+ break;
2331
+ case "autogrow":
2332
+ this.#l();
2333
+ break;
2334
+ case "pattern":
2335
+ this.#s = n;
2336
+ break;
2337
+ }
2338
+ super.attributeChangedCallback?.(e, t, n);
2339
+ }
2340
+ }
2341
+ setup() {
2342
+ super.setup(), this.setAttribute("aria-multiline", "true"), this.hasAttribute("contenteditable") || this.setAttribute("contenteditable", "plaintext-only"), this.#n.value = this.hasAttribute("required");
2343
+ let e = this.getAttribute("maxlength");
2344
+ this.#r.value = e === null ? NaN : parseInt(e, 10), this.#s = this.getAttribute("pattern"), this.#a = this.getAttribute("value") ?? this.textContent ?? "", this.#i.value = this.textContent ?? "", this.#c(), this.#l(), this.addEffect(w(this, this.#t, this.#e, { manageTabindex: !0 })), this.addEffect(() => {
2345
+ let e = this.#i.value, t = this.#r.value;
2346
+ this.#n.value && e === "" ? this.#e.setValidity({ valueMissing: !0 }, "Please fill out this field.", this) : !isNaN(t) && e.length > t ? this.#e.setValidity({ tooLong: !0 }, `Please shorten this text to ${t} characters or less.`, this) : this.#s !== null && e !== "" && !RegExp(`^(?:${this.#s})$`).test(e) ? this.#e.setValidity({ patternMismatch: !0 }, "Please match the requested format.", this) : this.#e.setValidity({});
2347
+ }), this.addEventListener("input", this.#u), this.addEventListener("blur", this.#d);
2348
+ }
2349
+ teardown() {
2350
+ cancelAnimationFrame(this.#o), this.removeEventListener("input", this.#u), this.removeEventListener("blur", this.#d), super.teardown();
2351
+ }
2352
+ onFormDisabled(e) {
2353
+ this.#t.value = e, this.setAttribute("contenteditable", e || this.hasAttribute("readonly") ? "false" : "plaintext-only");
2354
+ }
2355
+ onFormReset() {
2356
+ this.textContent = this.#a, this.#i.value = this.#a, this.#e.setFormValue(this.#a), this.#c(), this.#l(), this.#t.value = this.hasAttribute("disabled"), this.setAttribute("contenteditable", this.#t.value || this.hasAttribute("readonly") ? "false" : "plaintext-only");
2357
+ }
2358
+ onFormStateRestore(e) {
2359
+ this.value = typeof e == "string" ? e : "";
2360
+ }
2361
+ #c() {
2362
+ (this.textContent ?? "").trim() === "" ? this.#e.states.add("empty") : this.#e.states.delete("empty");
2363
+ }
2364
+ #l() {
2365
+ !this.hasAttribute("autogrow") || !this.isConnected || (this.style.setProperty("--_autogrow-height", "auto"), cancelAnimationFrame(this.#o), this.#o = requestAnimationFrame(() => {
2366
+ this.style.setProperty("--_autogrow-height", `${this.scrollHeight}px`);
2367
+ }));
2368
+ }
2369
+ #u = () => {
2370
+ let e = this.textContent ?? "";
2371
+ this.#i.value = e, this.#e.setFormValue(e), this.#c(), this.#l(), this.dispatchEvent(new CustomEvent("ui-input", {
2372
+ bubbles: !0,
2373
+ composed: !0,
2374
+ detail: { value: e }
2375
+ }));
2376
+ };
2377
+ #d = () => {
2378
+ this.dispatchEvent(new CustomEvent("ui-change", {
2379
+ bubbles: !0,
2380
+ composed: !0,
2381
+ detail: { value: this.textContent ?? "" }
2382
+ }));
2383
+ };
2384
+ }, me = class extends S(_) {
2385
+ static observedAttributes = [
2386
+ "value",
2387
+ "length",
2388
+ "disabled",
2389
+ "name",
2390
+ "pattern",
2391
+ "mask",
2392
+ "required"
2393
+ ];
2394
+ #e;
2395
+ #t = t(!1);
2396
+ #n;
2397
+ #r = [];
2398
+ #i = [];
2399
+ #a = 6;
2400
+ #o = /[0-9]/;
2401
+ #s = null;
2402
+ #c = "";
2403
+ constructor() {
2404
+ super(), this.#e = this.attachInternals(), this.#e.role = "group", this.#n = x(this, "disabled", { type: "boolean" });
2405
+ }
2406
+ get value() {
2407
+ return this.#i.join("");
2408
+ }
2409
+ set value(e) {
2410
+ this.#i = e.split("").slice(0, this.#a), this.#u(), this.#d();
2411
+ }
2412
+ get name() {
2413
+ return this.getAttribute("name") ?? "";
2414
+ }
2415
+ set name(e) {
2416
+ this.setAttribute("name", e);
2417
+ }
2418
+ get disabled() {
2419
+ return this.#n.value;
2420
+ }
2421
+ set disabled(e) {
2422
+ this.#n.set(e);
2423
+ }
2424
+ get required() {
2425
+ return this.#t.value;
2426
+ }
2427
+ set required(e) {
2428
+ this.#t.value = e, this.toggleAttribute("required", e);
2429
+ }
2430
+ attributeChangedCallback(e, t, n) {
2431
+ if (t !== n) {
2432
+ if (v({ disabled: this.#n }, e, n)) {
2433
+ super.attributeChangedCallback(e, t, n);
2434
+ return;
2435
+ }
2436
+ switch (e) {
2437
+ case "value":
2438
+ this.value = n ?? "";
2439
+ break;
2440
+ case "length": {
2441
+ let e = parseInt(n ?? "6", 10);
2442
+ !isNaN(e) && e >= 1 && e <= 12 && (this.#a = e, this.isConnected && this.#l());
2443
+ break;
2444
+ }
2445
+ case "pattern":
2446
+ try {
2447
+ this.#o = new RegExp(n ?? "[0-9]");
2448
+ } catch {}
2449
+ break;
2450
+ case "mask":
2451
+ this.#s = n, this.isConnected && this.#u();
2452
+ break;
2453
+ case "required":
2454
+ this.#t.value = n !== null, this.isConnected && this.#d();
2455
+ break;
2456
+ }
2457
+ super.attributeChangedCallback(e, t, n);
2458
+ }
2459
+ }
2460
+ setup() {
2461
+ super.setup();
2462
+ let e = this.getAttribute("length");
2463
+ if (e) {
2464
+ let t = parseInt(e, 10);
2465
+ !isNaN(t) && t >= 1 && t <= 12 && (this.#a = t);
2466
+ }
2467
+ let t = this.getAttribute("pattern");
2468
+ if (t) try {
2469
+ this.#o = new RegExp(t);
2470
+ } catch {}
2471
+ this.#s = this.getAttribute("mask"), this.#l(), this.addEffect(w(this, this.#n.signal, this.#e, { manageTabindex: !1 })), this.addEffect(() => {
2472
+ let e = this.#n.value;
2473
+ for (let t of this.#r) t.setAttribute("contenteditable", e ? "false" : "plaintext-only");
2474
+ }), this.#t.value = this.hasAttribute("required");
2475
+ let n = this.getAttribute("value");
2476
+ this.#c = n ?? "", n && (this.value = n), this.addEventListener("paste", this.#g);
2477
+ }
2478
+ teardown() {
2479
+ for (let e of this.#r) e.removeEventListener("input", this.#p), e.removeEventListener("keydown", this.#m), e.removeEventListener("focus", this.#h);
2480
+ this.removeEventListener("paste", this.#g), super.teardown();
2481
+ }
2482
+ #l() {
2483
+ for (let e of this.#r) e.removeEventListener("input", this.#p), e.removeEventListener("keydown", this.#m), e.removeEventListener("focus", this.#h), e.remove();
2484
+ this.#r = [], this.#i = [];
2485
+ for (let e = 0; e < this.#a; e++) {
2486
+ let e = document.createElement("div");
2487
+ e.classList.add("ui-otp-cell"), e.setAttribute("data-empty", ""), e.setAttribute("contenteditable", "plaintext-only"), e.setAttribute("inputmode", "numeric"), e.addEventListener("input", this.#p), e.addEventListener("keydown", this.#m), e.addEventListener("focus", this.#h), this.appendChild(e), this.#r.push(e), this.#i.push("");
2488
+ }
2489
+ }
2490
+ #u() {
2491
+ for (let e = 0; e < this.#a; e++) {
2492
+ let t = this.#r[e];
2493
+ if (!t) continue;
2494
+ let n = this.#i[e] ?? "";
2495
+ t.textContent = n ? this.#s ?? n : "", n ? t.removeAttribute("data-empty") : t.setAttribute("data-empty", "");
2496
+ }
2497
+ }
2498
+ #d() {
2499
+ let e = this.value;
2500
+ this.#e.setFormValue(e), this.#t.value && e.length === 0 ? this.#e.setValidity({ valueMissing: !0 }, "Please fill out this field.", this) : this.#t.value && e.length < this.#a ? this.#e.setValidity({ tooShort: !0 }, `Please enter ${this.#a} characters.`, this) : this.#e.setValidity({});
2501
+ }
2502
+ #f(e) {
2503
+ let t = this.#r[e];
2504
+ if (t) {
2505
+ t.focus();
2506
+ let e = window.getSelection();
2507
+ e && (e.selectAllChildren(t), e.collapseToEnd());
2508
+ }
2509
+ }
2510
+ #p = (e) => {
2511
+ if (this.disabled) return;
2512
+ let t = e.target, n = this.#r.indexOf(t);
2513
+ if (n === -1) return;
2514
+ let r = t.textContent ?? "";
2515
+ if (r.length > 0) {
2516
+ let e = r[r.length - 1];
2517
+ if (this.#o.test(e)) this.#i[n] = e, t.textContent = this.#s ?? e, t.removeAttribute("data-empty"), this.#d(), this.#_(), n < this.#a - 1 && this.#f(n + 1), this.value.length === this.#a && this.#v();
2518
+ else {
2519
+ let e = this.#i[n] || "";
2520
+ t.textContent = e ? this.#s ?? e : "";
2521
+ }
2522
+ } else this.#i[n] = "", t.setAttribute("data-empty", ""), this.#d(), this.#_();
2523
+ };
2524
+ #m = (e) => {
2525
+ if (this.disabled) return;
2526
+ let t = e.target, n = this.#r.indexOf(t);
2527
+ n !== -1 && (e.key === "Backspace" ? (this.#i[n] ? (this.#i[n] = "", t.textContent = "", t.setAttribute("data-empty", ""), this.#d(), this.#_()) : n > 0 && this.#f(n - 1), e.preventDefault()) : e.key === "ArrowLeft" && n > 0 ? (this.#f(n - 1), e.preventDefault()) : e.key === "ArrowRight" && n < this.#a - 1 ? (this.#f(n + 1), e.preventDefault()) : e.key === "Delete" && (this.#i[n] = "", t.textContent = "", t.setAttribute("data-empty", ""), this.#d(), this.#_(), e.preventDefault()));
2528
+ };
2529
+ #h = (e) => {
2530
+ let t = e.target, n = window.getSelection();
2531
+ n && (n.selectAllChildren(t), n.collapseToEnd());
2532
+ };
2533
+ #g = (e) => {
2534
+ if (this.disabled) {
2535
+ e.preventDefault();
2536
+ return;
2537
+ }
2538
+ e.preventDefault();
2539
+ let t = (e.clipboardData?.getData("text") ?? "").split("").filter((e) => this.#o.test(e)).slice(0, this.#a);
2540
+ for (let e = 0; e < this.#a; e++) this.#i[e] = t[e] ?? "";
2541
+ this.#u(), this.#d(), this.#_();
2542
+ let n = this.#i.findIndex((e) => !e);
2543
+ this.#f(n >= 0 ? n : this.#a - 1), t.length === this.#a && this.#v();
2544
+ };
2545
+ onFormDisabled(e) {
2546
+ this.#n.signal.value = e;
2547
+ for (let t of this.#r) t.setAttribute("contenteditable", e ? "false" : "plaintext-only");
2548
+ }
2549
+ onFormReset() {
2550
+ this.value = this.#c, this.#n.signal.value = this.hasAttribute("disabled");
2551
+ }
2552
+ onFormStateRestore(e) {
2553
+ this.value = typeof e == "string" ? e : "";
2554
+ }
2555
+ #_() {
2556
+ this.dispatchEvent(new CustomEvent("ui-input", {
2557
+ bubbles: !0,
2558
+ composed: !0,
2559
+ detail: { value: this.value }
2560
+ }));
2561
+ }
2562
+ #v() {
2563
+ this.dispatchEvent(new CustomEvent("ui-change", {
2564
+ bubbles: !0,
2565
+ composed: !0,
2566
+ detail: { value: this.value }
2567
+ }));
2568
+ }
2569
+ }, he = class extends _ {
2570
+ static observedAttributes = [
2571
+ "src",
2572
+ "name",
2573
+ "alt"
2574
+ ];
2575
+ #e;
2576
+ #t = null;
2577
+ constructor() {
2578
+ super(), this.#e = this.attachInternals(), this.#e.role = "img";
2579
+ }
2580
+ get src() {
2581
+ return this.getAttribute("src") ?? "";
2582
+ }
2583
+ set src(e) {
2584
+ this.setAttribute("src", e);
2585
+ }
2586
+ get name() {
2587
+ return this.getAttribute("name") ?? "";
2588
+ }
2589
+ set name(e) {
2590
+ this.setAttribute("name", e);
2591
+ }
2592
+ get alt() {
2593
+ return this.getAttribute("alt") ?? "";
2594
+ }
2595
+ set alt(e) {
2596
+ this.setAttribute("alt", e);
2597
+ }
2598
+ attributeChangedCallback(e, t, n) {
2599
+ t !== n && (this.isConnected && this.#n(), super.attributeChangedCallback(e, t, n));
2600
+ }
2601
+ setup() {
2602
+ super.setup(), this.#n();
2603
+ }
2604
+ teardown() {
2605
+ this.#t &&= (this.#t.removeEventListener("error", this.#i), null), super.teardown();
2606
+ }
2607
+ #n() {
2608
+ this.textContent = "", this.#t = null;
2609
+ let e = this.getAttribute("src"), t = this.getAttribute("name"), n = this.getAttribute("alt") ?? t ?? "";
2610
+ this.#e.ariaLabel = n, this.setAttribute("aria-label", n), e ? (this.#t = document.createElement("img"), this.#t.src = e, this.#t.alt = n, this.#t.addEventListener("error", this.#i), this.appendChild(this.#t)) : t ? this.textContent = this.#r(t) : this.textContent = "?";
2611
+ }
2612
+ #r(e) {
2613
+ let t = e.trim().split(/\s+/);
2614
+ return t.length === 0 ? "?" : t.length === 1 ? t[0][0].toUpperCase() : (t[0][0] + t[t.length - 1][0]).toUpperCase();
2615
+ }
2616
+ #i = () => {
2617
+ this.#t &&= (this.#t.removeEventListener("error", this.#i), this.#t.remove(), null);
2618
+ let e = this.getAttribute("name");
2619
+ e ? this.textContent = this.#r(e) : this.textContent = "?";
2620
+ };
2621
+ }, ge = class extends _ {
2622
+ static observedAttributes = ["max"];
2623
+ #e;
2624
+ #t = "";
2625
+ constructor() {
2626
+ super(), this.#e = this.attachInternals(), this.#e.role = "status";
2627
+ }
2628
+ attributeChangedCallback(e, t, n) {
2629
+ t !== n && (e === "max" && this.isConnected && this.#n(), super.attributeChangedCallback(e, t, n));
2630
+ }
2631
+ setup() {
2632
+ super.setup(), this.#t = this.textContent?.trim() ?? "", this.#n();
2633
+ }
2634
+ #n() {
2635
+ let e = this.getAttribute("max");
2636
+ if (!e) return;
2637
+ let t = parseInt(e, 10);
2638
+ if (isNaN(t)) return;
2639
+ let n = parseInt(this.#t, 10);
2640
+ isNaN(n) || (n > t ? this.textContent = `${t}+` : this.textContent = this.#t);
2641
+ }
2642
+ }, _e = class extends _ {}, ve = class extends _ {
2643
+ #e;
2644
+ constructor() {
2645
+ super(), this.#e = this.attachInternals(), this.#e.role = "navigation";
2646
+ }
2647
+ setup() {
2648
+ super.setup();
2649
+ let e = this.getAttribute("aria-label") ?? "Breadcrumb";
2650
+ this.#e.ariaLabel = e, this.hasAttribute("aria-label") || this.setAttribute("aria-label", e);
2651
+ }
2652
+ }, ye = class extends _ {
2653
+ static observedAttributes = ["href", "current"];
2654
+ #e;
2655
+ constructor() {
2656
+ super(), this.#e = this.attachInternals(), this.#e.role = "link";
2657
+ }
2658
+ setup() {
2659
+ super.setup(), this.#t(), !this.hasAttribute("current") && !this.hasAttribute("tabindex") && this.setAttribute("tabindex", "0"), this.addEventListener("click", this.#n), this.addEventListener("keydown", this.#r);
2660
+ }
2661
+ teardown() {
2662
+ this.removeEventListener("click", this.#n), this.removeEventListener("keydown", this.#r), super.teardown();
2663
+ }
2664
+ attributeChangedCallback(e, t, n) {
2665
+ t !== n && (this.isConnected && this.#t(), super.attributeChangedCallback(e, t, n));
2666
+ }
2667
+ #t() {
2668
+ this.hasAttribute("current") ? (this.setAttribute("aria-disabled", "true"), this.setAttribute("aria-current", "page"), this.removeAttribute("tabindex")) : (this.removeAttribute("aria-disabled"), this.removeAttribute("aria-current"), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"));
2669
+ }
2670
+ #n = () => {
2671
+ if (this.hasAttribute("current")) return;
2672
+ let e = this.getAttribute("href");
2673
+ e && (window.location.href = e);
2674
+ };
2675
+ #r = (e) => {
2676
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.#n());
2677
+ };
2678
+ }, be = class extends _ {
2679
+ static observedAttributes = [
2680
+ "total",
2681
+ "value",
2682
+ "siblings",
2683
+ "boundaries",
2684
+ "disabled"
2685
+ ];
2686
+ #e;
2687
+ #t = t(1);
2688
+ #n = t(1);
2689
+ #r = t(1);
2690
+ #i = t(1);
2691
+ #a = t(!1);
2692
+ constructor() {
2693
+ super(), this.#e = this.attachInternals(), this.#e.role = "navigation";
2694
+ }
2695
+ get total() {
2696
+ return this.#t.value;
2697
+ }
2698
+ set total(e) {
2699
+ this.#t.value = Math.max(1, e);
2700
+ }
2701
+ get value() {
2702
+ return this.#n.value;
2703
+ }
2704
+ set value(e) {
2705
+ this.#n.value = Math.min(Math.max(1, e), this.#t.value);
2706
+ }
2707
+ get siblings() {
2708
+ return this.#r.value;
2709
+ }
2710
+ set siblings(e) {
2711
+ this.#r.value = Math.max(0, e);
2712
+ }
2713
+ get boundaries() {
2714
+ return this.#i.value;
2715
+ }
2716
+ set boundaries(e) {
2717
+ this.#i.value = Math.max(0, e);
2718
+ }
2719
+ get disabled() {
2720
+ return this.#a.value;
2721
+ }
2722
+ set disabled(e) {
2723
+ this.#a.value = e, this.toggleAttribute("disabled", e);
2724
+ }
2725
+ attributeChangedCallback(e, t, n) {
2726
+ if (t === n) return;
2727
+ let r = parseInt(n ?? "", 10);
2728
+ switch (e) {
2729
+ case "total":
2730
+ this.#t.value = Math.max(1, isNaN(r) ? 1 : r);
2731
+ break;
2732
+ case "value":
2733
+ this.#n.value = Math.min(Math.max(1, isNaN(r) ? 1 : r), this.#t.value);
2734
+ break;
2735
+ case "siblings":
2736
+ this.#r.value = Math.max(0, isNaN(r) ? 1 : r);
2737
+ break;
2738
+ case "boundaries":
2739
+ this.#i.value = Math.max(0, isNaN(r) ? 1 : r);
2740
+ break;
2741
+ case "disabled":
2742
+ this.#a.value = n !== null;
2743
+ break;
2744
+ }
2745
+ super.attributeChangedCallback(e, t, n);
2746
+ }
2747
+ setup() {
2748
+ super.setup();
2749
+ let e = this.getAttribute("aria-label") ?? "Pagination";
2750
+ this.#e.ariaLabel = e, this.hasAttribute("aria-label") || this.setAttribute("aria-label", e), this.addEffect(w(this, this.#a, this.#e)), this.addEffect(() => {
2751
+ this.#l();
2752
+ }), this.addEffect(() => {
2753
+ let e = this.#a.value, t = i(() => this.#n.value), n = i(() => this.#t.value);
2754
+ for (let r of this.querySelectorAll("ui-button")) {
2755
+ let i = r.getAttribute("aria-label") ?? "";
2756
+ i === "Previous page" ? r.toggleAttribute("disabled", e || t <= 1) : i === "Next page" ? r.toggleAttribute("disabled", e || t >= n) : r.toggleAttribute("disabled", e);
2757
+ }
2758
+ });
2759
+ }
2760
+ teardown() {
2761
+ this.textContent = "", super.teardown();
2762
+ }
2763
+ #o() {
2764
+ let e = this.#t.value, t = this.#n.value, n = this.#r.value, r = this.#i.value;
2765
+ if (e <= r * 2 + n * 2 + 3) return Array.from({ length: e }, (e, t) => t + 1);
2766
+ let i = [];
2767
+ for (let e = 1; e <= r; e++) i.push(e);
2768
+ let a = Math.max(r + 1, t - n);
2769
+ a > r + 1 && i.push("ellipsis");
2770
+ let o = Math.min(e - r, t + n);
2771
+ for (let e = a; e <= o; e++) i.includes(e) || i.push(e);
2772
+ o < e - r && i.push("ellipsis");
2773
+ for (let t = e - r + 1; t <= e; t++) i.includes(t) || i.push(t);
2774
+ return i;
2775
+ }
2776
+ #s(e, t, n, r) {
2777
+ let i = document.createElement("ui-button");
2778
+ return i.setAttribute("variant", "ghost"), i.setAttribute("aria-label", t), n && i.setAttribute("disabled", ""), i.textContent = e, i.addEventListener("ui-press", r), i;
2779
+ }
2780
+ #c(e, t, n, r) {
2781
+ let i = document.createElement("ui-button");
2782
+ i.setAttribute("variant", "ghost"), i.setAttribute("aria-label", t), n && i.setAttribute("disabled", "");
2783
+ let a = document.createElement("ui-icon");
2784
+ return a.setAttribute("name", e), i.appendChild(a), i.addEventListener("ui-press", r), i;
2785
+ }
2786
+ #l() {
2787
+ let e = this.#t.value, t = this.#n.value, n = i(() => this.#a.value), r = this.#o();
2788
+ this.textContent = "", this.appendChild(this.#c("caret-left", "Previous page", n || t <= 1, () => this.#u(t - 1)));
2789
+ for (let e of r) if (e === "ellipsis") {
2790
+ let e = document.createElement("span");
2791
+ e.classList.add("ui-pagination-ellipsis"), e.textContent = "…", this.appendChild(e);
2792
+ } else {
2793
+ let r = this.#s(String(e), `Page ${e}`, n, () => this.#u(e));
2794
+ e === t && r.setAttribute("aria-current", "page"), this.appendChild(r);
2795
+ }
2796
+ this.appendChild(this.#c("caret-right", "Next page", n || t >= e, () => this.#u(t + 1)));
2797
+ }
2798
+ #u(e) {
2799
+ if (this.#a.value) return;
2800
+ let t = Math.min(Math.max(1, e), this.#t.value);
2801
+ t !== this.#n.value && (this.#n.value = t, this.setAttribute("value", String(t)), this.dispatchEvent(new CustomEvent("ui-change", {
2802
+ bubbles: !0,
2803
+ composed: !0,
2804
+ detail: { value: t }
2805
+ })));
2806
+ }
2807
+ }, xe = class extends _ {
2808
+ #e;
2809
+ get open() {
2810
+ return this.#e.open;
2811
+ }
2812
+ showModal() {
2813
+ this.#e.showModal();
2814
+ }
2815
+ close() {
2816
+ this.#e.close();
2817
+ }
2818
+ setup() {
2819
+ super.setup(), this.#e = new s(this, { contentTarget: () => document.createElement("ui-drawer-panel") });
2820
+ }
2821
+ teardown() {
2822
+ this.#e.destroy(), super.teardown();
2823
+ }
2824
+ }, Se = class extends _ {
2825
+ static observedAttributes = ["disabled"];
2826
+ #e;
2827
+ #t = t(!1);
2828
+ #n;
2829
+ constructor() {
2830
+ super(), this.#e = this.attachInternals(), this.#e.role = "tree";
2831
+ }
2832
+ get disabled() {
2833
+ return this.#t.value;
2834
+ }
2835
+ set disabled(e) {
2836
+ this.#t.value = e, this.toggleAttribute("disabled", e);
2837
+ }
2838
+ attributeChangedCallback(e, t, n) {
2839
+ t !== n && (e === "disabled" && (this.#t.value = n !== null), super.attributeChangedCallback?.(e, t, n));
2840
+ }
2841
+ setup() {
2842
+ super.setup(), this.#n = new f(this, {
2843
+ selector: ":scope ui-tree-item > [slot=\"label\"]",
2844
+ orientation: "vertical"
2845
+ });
2846
+ let e = this.getAttribute("aria-label") ?? "Tree";
2847
+ this.#e.ariaLabel = e, this.hasAttribute("aria-label") || this.setAttribute("aria-label", e), this.addEffect(w(this, this.#t, this.#e));
2848
+ }
2849
+ teardown() {
2850
+ this.#n.destroy(), super.teardown();
2851
+ }
2852
+ }, Ce = class extends _ {
2853
+ static observedAttributes = [
2854
+ "expanded",
2855
+ "selected",
2856
+ "disabled"
2857
+ ];
2858
+ #e;
2859
+ #t = null;
2860
+ #n = null;
2861
+ #r = t(!1);
2862
+ constructor() {
2863
+ super(), this.#e = this.attachInternals(), this.#e.role = "treeitem";
2864
+ }
2865
+ get expanded() {
2866
+ return this.hasAttribute("expanded");
2867
+ }
2868
+ set expanded(e) {
2869
+ this.toggleAttribute("expanded", e), this.isConnected && this.#a();
2870
+ }
2871
+ get selected() {
2872
+ return this.hasAttribute("selected");
2873
+ }
2874
+ set selected(e) {
2875
+ this.toggleAttribute("selected", e), this.isConnected && this.#a();
2876
+ }
2877
+ get disabled() {
2878
+ return this.#r.value;
2879
+ }
2880
+ set disabled(e) {
2881
+ this.#r.value = e, this.toggleAttribute("disabled", e);
2882
+ }
2883
+ setup() {
2884
+ super.setup(), this.addEffect(w(this, this.#r, this.#e)), this.deferChildren(() => {
2885
+ this.#i(), this.#a();
2886
+ }), this.addEventListener("click", this.#o), this.addEventListener("keydown", this.#s);
2887
+ }
2888
+ teardown() {
2889
+ this.removeEventListener("click", this.#o), this.removeEventListener("keydown", this.#s), super.teardown();
2890
+ }
2891
+ attributeChangedCallback(e, t, n) {
2892
+ t !== n && (e === "disabled" && (this.#r.value = n !== null), this.isConnected && this.#a(), super.attributeChangedCallback(e, t, n));
2893
+ }
2894
+ #i() {
2895
+ let e = this.querySelectorAll(":scope > ui-tree-item");
2896
+ if (e.length > 0) {
2897
+ this.setAttribute("expandable", "");
2898
+ let t = this.querySelector(":scope > [slot=\"label\"]");
2899
+ t && (this.#n = document.createElement("ui-icon"), this.#n.setAttribute("name", this.hasAttribute("expanded") ? "caret-down" : "caret-right"), this.#n.classList.add("ui-tree-caret"), t.prepend(this.#n)), this.#t = document.createElement("div"), this.#t.classList.add("ui-tree-children");
2900
+ for (let t of e) this.#t.appendChild(t);
2901
+ this.appendChild(this.#t);
2902
+ }
2903
+ let t = 0, n = this.parentElement;
2904
+ for (; n;) {
2905
+ if (n.tagName === "UI-TREE-ITEM") t++;
2906
+ else if (!n.classList?.contains("ui-tree-children")) break;
2907
+ n = n.parentElement;
2908
+ }
2909
+ if (t > 0) {
2910
+ let e = this.querySelector(":scope > [slot=\"label\"]");
2911
+ e instanceof HTMLElement && e.style.setProperty("--_tree-depth", String(t));
2912
+ }
2913
+ let r = this.querySelector(":scope > [slot=\"label\"]");
2914
+ r instanceof HTMLElement && !r.hasAttribute("tabindex") && r.setAttribute("tabindex", "-1");
2915
+ }
2916
+ #a() {
2917
+ let e = this.hasAttribute("expanded"), t = this.hasAttribute("selected");
2918
+ this.hasAttribute("expandable") ? this.setAttribute("aria-expanded", String(e)) : this.removeAttribute("aria-expanded"), this.setAttribute("aria-selected", String(t)), this.#n && this.#n.setAttribute("name", e ? "caret-down" : "caret-right");
2919
+ }
2920
+ #o = (e) => {
2921
+ let t = e.target, n = this.querySelector(":scope > [slot=\"label\"]");
2922
+ t !== n && !n?.contains(t) || (e.stopPropagation(), !this.#r.value && (this.hasAttribute("expandable") && this.toggleAttribute("expanded"), this.toggleAttribute("selected", !0)));
2923
+ };
2924
+ #s = (e) => {
2925
+ if (e.target === this.querySelector(":scope > [slot=\"label\"]") && !this.#r.value) switch (e.key) {
2926
+ case "ArrowRight":
2927
+ if (this.hasAttribute("expandable") && !this.hasAttribute("expanded")) this.setAttribute("expanded", ""), e.preventDefault(), e.stopPropagation();
2928
+ else if (this.hasAttribute("expanded")) {
2929
+ let t = this.querySelector(":scope > .ui-tree-children > ui-tree-item > [slot=\"label\"]");
2930
+ t && (t.focus(), e.preventDefault(), e.stopPropagation());
2931
+ }
2932
+ break;
2933
+ case "ArrowLeft":
2934
+ if (this.hasAttribute("expanded")) this.removeAttribute("expanded"), e.preventDefault(), e.stopPropagation();
2935
+ else {
2936
+ let t = (this.parentElement?.closest("ui-tree-item"))?.querySelector(":scope > [slot=\"label\"]");
2937
+ t && (t.focus(), e.preventDefault(), e.stopPropagation());
2938
+ }
2939
+ break;
2940
+ case "Enter":
2941
+ case " ":
2942
+ e.preventDefault(), e.stopPropagation(), this.toggleAttribute("selected", !0), this.hasAttribute("expandable") && this.toggleAttribute("expanded");
2943
+ break;
2944
+ }
2945
+ };
2946
+ }, we = class extends _ {
2947
+ static observedAttributes = [
2948
+ "direction",
2949
+ "controls",
2950
+ "indicators",
2951
+ "autoplay",
2952
+ "interval",
2953
+ "loop",
2954
+ "peek",
2955
+ "per-view",
2956
+ "gap",
2957
+ "disabled"
2958
+ ];
2959
+ #e = null;
2960
+ #t = null;
2961
+ #n = null;
2962
+ #r = null;
2963
+ #i = null;
2964
+ #a = t(0);
2965
+ #o = t(0);
2966
+ #s = t(!1);
2967
+ #c = null;
2968
+ #l = null;
2969
+ #u = null;
2970
+ #d = [];
2971
+ #f = !1;
2972
+ #p = 0;
2973
+ #m = 0;
2974
+ #h = 0;
2975
+ #g = 0;
2976
+ #_;
2977
+ constructor() {
2978
+ super(), this.#_ = this.attachInternals(), this.#_.role = "region";
2979
+ }
2980
+ get index() {
2981
+ return this.#a.value;
2982
+ }
2983
+ goTo(e) {
2984
+ let t = this.#d.length;
2985
+ if (t === 0) return;
2986
+ let n = e;
2987
+ n = this.hasAttribute("loop") ? (e % t + t) % t : Math.max(0, Math.min(e, t - 1));
2988
+ let r = this.#d[n];
2989
+ if (!r) return;
2990
+ let i = this.getAttribute("direction") === "vertical";
2991
+ r.scrollIntoView({
2992
+ block: i ? "start" : "nearest",
2993
+ inline: i ? "nearest" : "start"
2994
+ });
2995
+ }
2996
+ next() {
2997
+ this.goTo(this.#a.value + 1);
2998
+ }
2999
+ prev() {
3000
+ this.goTo(this.#a.value - 1);
3001
+ }
3002
+ attributeChangedCallback(e, t, n) {
3003
+ if (t !== n) {
3004
+ switch (e) {
3005
+ case "disabled":
3006
+ this.#s.value = n !== null;
3007
+ break;
3008
+ case "per-view":
3009
+ this.#v(n);
3010
+ break;
3011
+ case "autoplay":
3012
+ n === null ? this.#E() : this.#T();
3013
+ break;
3014
+ case "interval":
3015
+ this.hasAttribute("autoplay") && (this.#E(), this.#T());
3016
+ break;
3017
+ case "loop":
3018
+ this.#w(this.#a.value, this.#o.value);
3019
+ break;
3020
+ }
3021
+ super.attributeChangedCallback?.(e, t, n);
3022
+ }
3023
+ }
3024
+ setup() {
3025
+ super.setup(), this.#l = window.matchMedia("(prefers-reduced-motion: reduce)");
3026
+ let e = document.createElement("div");
3027
+ e.setAttribute("part", "track"), e.id = r("ss-track"), e.setAttribute("tabindex", "0");
3028
+ let t = [];
3029
+ for (; this.firstChild;) {
3030
+ let n = this.firstChild;
3031
+ e.appendChild(n), n instanceof HTMLElement && n.tagName.toLowerCase() === "ui-slide" && t.push(n);
3032
+ }
3033
+ this.appendChild(e), this.#e = e, this.#d = t;
3034
+ let n = document.createElement("div");
3035
+ n.setAttribute("part", "controls");
3036
+ let i = document.createElement("button");
3037
+ i.setAttribute("part", "prev"), i.setAttribute("aria-label", "Previous slide"), i.setAttribute("type", "button"), i.innerHTML = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 256 256\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z\" fill=\"currentColor\"/></svg>";
3038
+ let a = document.createElement("button");
3039
+ a.setAttribute("part", "next"), a.setAttribute("aria-label", "Next slide"), a.setAttribute("type", "button"), a.innerHTML = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 256 256\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z\" fill=\"currentColor\"/></svg>", n.appendChild(i), n.appendChild(a), this.appendChild(n), this.#n = i, this.#r = a;
3040
+ let o = document.createElement("div");
3041
+ o.setAttribute("part", "indicators"), o.setAttribute("aria-hidden", "true"), this.appendChild(o), this.#t = o;
3042
+ let s = document.createElement("div");
3043
+ s.id = r("ss-live"), s.setAttribute("aria-live", "polite"), s.setAttribute("aria-atomic", "true"), s.setAttribute("data-visually-hidden", ""), this.appendChild(s), this.#i = s, this.setAttribute("aria-roledescription", "carousel"), this.hasAttribute("aria-label") || this.setAttribute("aria-label", "Slideshow"), this.#v(this.getAttribute("per-view")), this.#o.value = t.length, this.#y(t), this.#b(t.length), this.#S(t), t.length > 0 && t[0].toggleAttribute("active", !0), this.addEffect(() => {
3044
+ let e = this.#a.value, t = this.#o.value;
3045
+ this.#C(e), this.#w(e, t), this.#i && (this.#i.textContent = `Slide ${e + 1} of ${t}`);
3046
+ }), this.addEffect(w(this, this.#s, this.#_)), i.addEventListener("click", this.#D), a.addEventListener("click", this.#O), e.addEventListener("keydown", this.#P), e.addEventListener("pointerdown", this.#j), this.addEventListener("mouseenter", this.#k), this.addEventListener("mouseleave", this.#A), this.addEventListener("focusin", this.#k), this.addEventListener("focusout", this.#A), this.hasAttribute("autoplay") && this.#T();
3047
+ }
3048
+ teardown() {
3049
+ this.#E(), this.#u?.disconnect(), this.#u = null, this.#n?.removeEventListener("click", this.#D), this.#r?.removeEventListener("click", this.#O), this.#e?.removeEventListener("keydown", this.#P), this.#e?.removeEventListener("pointerdown", this.#j), this.removeEventListener("mouseenter", this.#k), this.removeEventListener("mouseleave", this.#A), this.removeEventListener("focusin", this.#k), this.removeEventListener("focusout", this.#A), this.#e = null, this.#t?.removeEventListener("click", this.#x), this.#t && (this.#t.innerHTML = ""), this.#t = null, this.#n = null, this.#r = null, this.#i = null, this.#d = [], super.teardown();
3050
+ }
3051
+ #v(e) {
3052
+ let t = Math.max(1, parseInt(e ?? "1", 10) || 1);
3053
+ this.style.setProperty("--_per-view", String(t));
3054
+ }
3055
+ #y(e) {
3056
+ let t = e.length;
3057
+ for (let n = 0; n < t; n++) {
3058
+ let i = e[n];
3059
+ i.setAttribute("role", "group"), i.setAttribute("aria-roledescription", "slide"), i.setAttribute("aria-label", `${n + 1} of ${t}`), i.id ||= r("slide");
3060
+ }
3061
+ }
3062
+ #b(e) {
3063
+ let t = this.#t;
3064
+ if (t) {
3065
+ t.addEventListener("click", this.#x);
3066
+ for (let n = 0; n < e; n++) {
3067
+ let e = document.createElement("button");
3068
+ e.setAttribute("part", "dot"), e.setAttribute("type", "button"), e.setAttribute("aria-label", `Go to slide ${n + 1}`), e.setAttribute("data-index", String(n)), n === 0 && e.toggleAttribute("active", !0), t.appendChild(e);
3069
+ }
3070
+ }
3071
+ }
3072
+ #x = (e) => {
3073
+ let t = e.target.closest("[data-index]");
3074
+ if (!t) return;
3075
+ let n = parseInt(t.dataset.index ?? "", 10);
3076
+ isNaN(n) || (this.#E(), this.goTo(n));
3077
+ };
3078
+ #S(e) {
3079
+ let t = this.#e;
3080
+ if (!(!t || e.length === 0)) {
3081
+ this.#u = new IntersectionObserver((e) => {
3082
+ for (let t of e) if (t.isIntersecting && t.intersectionRatio >= .5) {
3083
+ let e = t.target, n = this.#d.indexOf(e);
3084
+ n !== -1 && n !== this.#a.value && (this.#a.value = n, this.#d.forEach((e, t) => e.toggleAttribute("active", t === n)), this.dispatchEvent(new CustomEvent("ui-slide-change", {
3085
+ bubbles: !0,
3086
+ composed: !0,
3087
+ detail: {
3088
+ index: n,
3089
+ slide: e
3090
+ }
3091
+ })));
3092
+ }
3093
+ }, {
3094
+ root: t,
3095
+ threshold: .5
3096
+ });
3097
+ for (let t of e) this.#u.observe(t);
3098
+ }
3099
+ }
3100
+ #C(e) {
3101
+ let t = this.#t?.querySelectorAll("[part=\"dot\"]");
3102
+ t && t.forEach((t, n) => t.toggleAttribute("active", n === e));
3103
+ }
3104
+ #w(e, t) {
3105
+ if (!this.#n || !this.#r) return;
3106
+ let n = this.hasAttribute("loop");
3107
+ this.#n.disabled = !n && e === 0, this.#r.disabled = !n && e === t - 1;
3108
+ }
3109
+ #T() {
3110
+ if (this.#l?.matches) return;
3111
+ this.#E();
3112
+ let e = parseInt(this.getAttribute("interval") ?? "5000", 10) || 5e3;
3113
+ this.#c = setInterval(() => this.next(), e);
3114
+ }
3115
+ #E() {
3116
+ this.#c !== null && (clearInterval(this.#c), this.#c = null);
3117
+ }
3118
+ #D = () => {
3119
+ this.#E(), this.prev();
3120
+ };
3121
+ #O = () => {
3122
+ this.#E(), this.next();
3123
+ };
3124
+ #k = () => {
3125
+ this.#c !== null && (clearInterval(this.#c), this.#c = null);
3126
+ };
3127
+ #A = () => {
3128
+ this.hasAttribute("autoplay") && !this.#l?.matches && this.#c === null && this.#T();
3129
+ };
3130
+ #j = (e) => {
3131
+ if (e.button !== 0 || e.pointerType === "touch") return;
3132
+ let t = this.#e;
3133
+ t && (this.#f = !0, this.#p = e.clientX, this.#m = e.clientY, this.#h = t.scrollLeft, this.#g = t.scrollTop, t.style.scrollBehavior = "auto", t.style.scrollSnapType = "none", t.setPointerCapture(e.pointerId), t.setAttribute("data-dragging", ""), t.addEventListener("pointermove", this.#M), t.addEventListener("pointerup", this.#N), t.addEventListener("pointercancel", this.#N));
3134
+ };
3135
+ #M = (e) => {
3136
+ if (!(!this.#f || !this.#e)) if (e.preventDefault(), this.getAttribute("direction") === "vertical") {
3137
+ let t = e.clientY - this.#m;
3138
+ this.#e.scrollTop = this.#g - t;
3139
+ } else {
3140
+ let t = e.clientX - this.#p;
3141
+ this.#e.scrollLeft = this.#h - t;
3142
+ }
3143
+ };
3144
+ #N = (e) => {
3145
+ !this.#f || !this.#e || (this.#f = !1, this.#e.releasePointerCapture(e.pointerId), this.#e.removeAttribute("data-dragging"), this.#e.removeEventListener("pointermove", this.#M), this.#e.removeEventListener("pointerup", this.#N), this.#e.removeEventListener("pointercancel", this.#N), this.#e.style.scrollBehavior = "", this.#e.style.scrollSnapType = "");
3146
+ };
3147
+ #P = (e) => {
3148
+ if (this.#s.value) return;
3149
+ let t = this.getAttribute("direction") === "vertical";
3150
+ switch (e.key) {
3151
+ case t ? "ArrowDown" : "ArrowRight":
3152
+ e.preventDefault(), this.next();
3153
+ break;
3154
+ case t ? "ArrowUp" : "ArrowLeft":
3155
+ e.preventDefault(), this.prev();
3156
+ break;
3157
+ case "Home":
3158
+ e.preventDefault(), this.goTo(0);
3159
+ break;
3160
+ case "End":
3161
+ e.preventDefault(), this.goTo(this.#o.value - 1);
3162
+ break;
3163
+ }
3164
+ };
3165
+ }, Te = class extends _ {
3166
+ setup() {
3167
+ super.setup(), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "-1");
3168
+ }
3169
+ }, Ee = class extends _ {
3170
+ static observedAttributes = ["value", "disabled"];
3171
+ #e;
3172
+ #t;
3173
+ #n;
3174
+ constructor() {
3175
+ super(), this.#e = this.attachInternals(), this.#e.role = "navigation", this.#t = x(this, "disabled", { type: "boolean" });
3176
+ }
3177
+ get value() {
3178
+ return this.#n?.listValue.value ?? null;
3179
+ }
3180
+ set value(e) {
3181
+ this.#n && (this.#n.listValue.value = e), e === null ? this.removeAttribute("value") : this.setAttribute("value", e);
3182
+ }
3183
+ get disabled() {
3184
+ return this.#t.value;
3185
+ }
3186
+ set disabled(e) {
3187
+ this.#t.set(e);
3188
+ }
3189
+ attributeChangedCallback(e, t, n) {
3190
+ if (t !== n) {
3191
+ if (v({ disabled: this.#t }, e, n)) {
3192
+ super.attributeChangedCallback?.(e, t, n);
3193
+ return;
3194
+ }
3195
+ e === "value" && this.#n && (this.#n.listValue.value = n), super.attributeChangedCallback?.(e, t, n);
3196
+ }
3197
+ }
3198
+ setup() {
3199
+ super.setup(), this.#n = new g(this, {
3200
+ itemSelector: ":scope ui-nav-item:not([disabled])",
3201
+ orientation: "vertical",
3202
+ ariaAttr: "aria-current",
3203
+ onChildSelect: (e) => {
3204
+ this.#n.listValue.value = e.value, this.setAttribute("value", e.value), this.dispatchEvent(new CustomEvent("ui-change", {
3205
+ bubbles: !0,
3206
+ composed: !0,
3207
+ cancelable: !0,
3208
+ detail: e
3209
+ }));
3210
+ },
3211
+ addEffect: (e) => this.addEffect(e),
3212
+ deferChildren: (e) => this.deferChildren(e)
3213
+ });
3214
+ let e = this.getAttribute("value");
3215
+ e !== null && (this.#n.listValue.value = e), this.addEffect(w(this, this.#t.signal, this.#e));
3216
+ }
3217
+ teardown() {
3218
+ this.#n.destroy(), super.teardown();
3219
+ }
3220
+ }, De = class extends _ {
3221
+ static observedAttributes = [
3222
+ "value",
3223
+ "disabled",
3224
+ "label"
3225
+ ];
3226
+ #e;
3227
+ #t = t("");
3228
+ #n;
3229
+ #r = t("");
3230
+ constructor() {
3231
+ super(), this.#e = this.attachInternals(), this.#e.role = "link", this.#n = x(this, "disabled", { type: "boolean" });
3232
+ }
3233
+ get value() {
3234
+ return this.#t.value;
3235
+ }
3236
+ set value(e) {
3237
+ this.#t.value = e, this.getAttribute("value") !== e && this.setAttribute("value", e);
3238
+ }
3239
+ get disabled() {
3240
+ return this.#n.value;
3241
+ }
3242
+ set disabled(e) {
3243
+ this.#n.set(e);
3244
+ }
3245
+ get label() {
3246
+ return this.#r.value || this.textContent?.trim() || "";
3247
+ }
3248
+ set label(e) {
3249
+ this.#r.value = e, e ? this.getAttribute("label") !== e && this.setAttribute("label", e) : this.removeAttribute("label");
3250
+ }
3251
+ attributeChangedCallback(e, t, n) {
3252
+ if (t !== n) {
3253
+ if (v({ disabled: this.#n }, e, n)) {
3254
+ super.attributeChangedCallback?.(e, t, n);
3255
+ return;
3256
+ }
3257
+ switch (e) {
3258
+ case "value":
3259
+ this.#t.value = n ?? "";
3260
+ break;
3261
+ case "label":
3262
+ this.#r.value = n ?? "";
3263
+ break;
3264
+ }
3265
+ super.attributeChangedCallback?.(e, t, n);
3266
+ }
3267
+ }
3268
+ setup() {
3269
+ super.setup(), this.addEffect(w(this, this.#n.signal, this.#e)), this.addEventListener("click", this.#i);
3270
+ }
3271
+ teardown() {
3272
+ this.removeEventListener("click", this.#i), super.teardown();
3273
+ }
3274
+ #i = () => {
3275
+ this.disabled || this.dispatchEvent(new CustomEvent("ui-select", {
3276
+ bubbles: !0,
3277
+ composed: !0,
3278
+ detail: {
3279
+ value: this.#t.value,
3280
+ label: this.label
3281
+ }
3282
+ }));
3283
+ };
3284
+ }, $ = class extends _ {
3285
+ static observedAttributes = ["open"];
3286
+ #e = t(!1);
3287
+ #t = null;
3288
+ #n;
3289
+ #r = null;
3290
+ #i = null;
3291
+ #a = null;
3292
+ #o = !1;
3293
+ constructor() {
3294
+ super(), this.#n = this.attachInternals(), this.#n.role = "group";
3295
+ }
3296
+ /** Whether the flyout popover is currently open. */
3297
+ get flyoutOpen() {
3298
+ return this.#o;
3299
+ }
3300
+ get open() {
3301
+ return this.#e.value;
3302
+ }
3303
+ set open(e) {
3304
+ this.#e.value = e, this.toggleAttribute("open", e);
3305
+ }
3306
+ attributeChangedCallback(e, t, n) {
3307
+ t !== n && (e === "open" && (this.#e.value = n !== null), super.attributeChangedCallback?.(e, t, n));
3308
+ }
3309
+ setup() {
3310
+ super.setup();
3311
+ let e = document.createElement("details"), t = document.createElement("summary"), n = this.querySelector(":scope > ui-nav-group-header");
3312
+ for (n && t.appendChild(n); this.firstChild;) e.appendChild(this.firstChild);
3313
+ e.insertBefore(t, e.firstChild), this.appendChild(e), this.#t = e, this.addEffect(() => {
3314
+ let e = this.#e.value;
3315
+ this.#t && (this.#t.open = e);
3316
+ }), e.addEventListener("toggle", this.#c), this.#r = new MutationObserver(() => this.#s()), this.#r.observe(e, {
3317
+ subtree: !0,
3318
+ attributes: !0,
3319
+ attributeFilter: ["aria-current"]
3320
+ }), this.#s();
3321
+ let r = document.createElement("ui-listbox");
3322
+ r.setAttribute("popover", "manual"), r.className = "nav-group-flyout", this.appendChild(r), this.#i = r, this.#a = new m(this), this.#a.wirePopover(this, r), r.addEventListener("ui-select", this.#u), r.addEventListener("ui-change", this.#d), this.addEventListener("ui-dismiss", this.#l);
3323
+ }
3324
+ teardown() {
3325
+ this.closeFlyout(), this.#a?.destroy(), this.#a = null, this.#i?.remove(), this.#i = null, this.#r?.disconnect(), this.#r = null, this.#t?.removeEventListener("toggle", this.#c), this.#t = null, super.teardown();
3326
+ }
3327
+ #s() {
3328
+ if (!this.#t) return;
3329
+ let e = this.#t.querySelectorAll(":scope > ui-nav-item"), t = -1;
3330
+ for (let n = 0; n < e.length; n++) if (e[n].hasAttribute("aria-current")) {
3331
+ t = n;
3332
+ break;
3333
+ }
3334
+ if (t < 0) {
3335
+ this.#n.states.delete("has-selection");
3336
+ return;
3337
+ }
3338
+ this.style.setProperty("--_indicator-index", `${t}`), this.#n.states.add("has-selection");
3339
+ }
3340
+ #c = () => {
3341
+ if (!this.#t) return;
3342
+ let e = this.#t.open;
3343
+ this.#e.value = e, this.toggleAttribute("open", e);
3344
+ };
3345
+ /** Stamp ui-option elements from child nav-items, open the flyout popover. */
3346
+ openFlyout() {
3347
+ if (!this.#t || !this.#i) return;
3348
+ this.#i.innerHTML = "";
3349
+ let e = this.#t.querySelectorAll(":scope > ui-nav-item"), t = !0;
3350
+ for (let n of e) {
3351
+ let e = n.getAttribute("value") ?? "", r = n.getAttribute("label") || n.textContent?.trim() || "", i = n.hasAttribute("aria-disabled"), a = document.createElement("ui-option");
3352
+ a.setAttribute("value", e), a.textContent = r, n.hasAttribute("aria-current") && a.setAttribute("selected", ""), i && a.setAttribute("disabled", ""), i || (a.setAttribute("tabindex", t ? "0" : "-1"), t = !1), this.#i.appendChild(a);
3353
+ }
3354
+ this.#o = !0, this.#a?.syncPopover(!0), queueMicrotask(() => {
3355
+ (this.#i?.querySelector("ui-option:not([disabled])"))?.focus();
3356
+ });
3357
+ }
3358
+ /** Clear the flyout and close the popover. Returns focus to the summary. */
3359
+ closeFlyout() {
3360
+ this.#i && (this.#i.innerHTML = "", this.#o = !1, this.#a?.syncPopover(!1), (this.#t?.querySelector("summary"))?.focus());
3361
+ }
3362
+ #l = () => {
3363
+ this.closeFlyout();
3364
+ };
3365
+ #u = () => {
3366
+ queueMicrotask(() => this.closeFlyout());
3367
+ };
3368
+ #d = (e) => {
3369
+ e.stopPropagation();
3370
+ };
3371
+ }, Oe = class extends _ {
3372
+ constructor() {
3373
+ super();
3374
+ let e = this.attachInternals();
3375
+ e.role = "presentation";
3376
+ }
3377
+ setup() {
3378
+ super.setup(), this.id ||= r("ngh");
3379
+ let e = this.closest("ui-nav-group");
3380
+ e && e.setAttribute("aria-labelledby", this.id);
3381
+ let t = this.querySelector(":scope > ui-icon");
3382
+ if (t) {
3383
+ let e = document.createElement("span");
3384
+ e.className = "icon-well", this.insertBefore(e, t), e.appendChild(t);
3385
+ }
3386
+ }
3387
+ }, ke = class extends _ {
3388
+ static observedAttributes = [
3389
+ "traits",
3390
+ "for",
3391
+ "provides"
3392
+ ];
3393
+ /** Per-target controller instances: target → Map<traitName, instance> */
3394
+ #e = /* @__PURE__ */ new Map();
3395
+ /** Watches for child additions/removals in selector mode, or first-child changes in wrapper mode */
3396
+ #t = null;
3397
+ /** Watches for trait option attribute changes on this element */
3398
+ #n = null;
3399
+ /** Traits requested but not yet registered — retried on registration */
3400
+ #r = /* @__PURE__ */ new Set();
3401
+ #i = null;
3402
+ #a = !1;
3403
+ connectedCallback() {
3404
+ this.#a || (this.#a = !0, this.setup());
3405
+ }
3406
+ disconnectedCallback() {
3407
+ this.#a = !1, super.disconnectedCallback();
3408
+ }
3409
+ setup() {
3410
+ super.setup(), this.#o(), this.#m();
3411
+ }
3412
+ teardown() {
3413
+ this.#p(), this.#t?.disconnect(), this.#t = null, this.#n?.disconnect(), this.#n = null, this.#i?.(), this.#i = null, this.#r.clear(), super.teardown();
3414
+ }
3415
+ attributeChangedCallback(e, t, n) {
3416
+ super.attributeChangedCallback(e, t, n), this.isConnected && (e === "traits" || e === "for" || e === "provides") && (this.#p(), this.#t?.disconnect(), this.#t = null, this.#o());
3417
+ }
3418
+ #o() {
3419
+ if (this.getAttribute("provides") !== null) return;
3420
+ let e = this.getAttribute("traits");
3421
+ if (!e) return;
3422
+ let t = this.getAttribute("for");
3423
+ t === null ? this.#s(e) : this.#c(e, t), this.#r.size > 0 && !this.#i && (this.#i = d((e) => {
3424
+ this.#r.has(e) && (this.#r.delete(e), this.#o(), this.#r.size === 0 && (this.#i?.(), this.#i = null));
3425
+ }));
3426
+ }
3427
+ #s(e) {
3428
+ let t = this.#d();
3429
+ t && this.#u(t, e), this.#t = new MutationObserver((t) => {
3430
+ for (let n of t) {
3431
+ if (n.type !== "childList") continue;
3432
+ for (let e of n.removedNodes) if (e instanceof HTMLElement) {
3433
+ let t = this.#e.get(e);
3434
+ t && (this.#f(e, t), this.#e.delete(e));
3435
+ }
3436
+ let t = this.#d();
3437
+ t && !this.#e.has(t) && this.#u(t, e);
3438
+ }
3439
+ }), this.#t.observe(this, { childList: !0 });
3440
+ }
3441
+ #c(e, t) {
3442
+ let n = this.querySelectorAll(t);
3443
+ for (let t of n) this.#u(t, e);
3444
+ this.#t = new MutationObserver(() => {
3445
+ this.#l(e, t);
3446
+ }), this.#t.observe(this, {
3447
+ childList: !0,
3448
+ subtree: !0
3449
+ });
3450
+ }
3451
+ #l(e, t) {
3452
+ let n = new Set(this.querySelectorAll(t));
3453
+ for (let [e, t] of this.#e) n.has(e) || (this.#f(e, t), this.#e.delete(e));
3454
+ for (let t of n) this.#e.has(t) || this.#u(t, e);
3455
+ }
3456
+ #u(e, t) {
3457
+ let n = t.split(/\s+/).filter(Boolean), r = this.#e.get(e) ?? /* @__PURE__ */ new Map();
3458
+ for (let t of n) {
3459
+ if (r.has(t)) continue;
3460
+ let n = p(t);
3461
+ if (!n) {
3462
+ this.#r.add(t);
3463
+ continue;
3464
+ }
3465
+ for (let [e] of r) if (p(e)?.conflicts?.includes(t) || n.conflicts?.includes(e)) {
3466
+ let n = `[native-ui] Trait conflict: "${t}" and "${e}" are incompatible.`;
3467
+ console.warn(n);
3468
+ }
3469
+ let i = l(this, t), a = n.create(e, i);
3470
+ r.set(t, a);
3471
+ }
3472
+ this.#e.set(e, r);
3473
+ }
3474
+ #d() {
3475
+ for (let e of this.children) if (e instanceof HTMLElement) return e;
3476
+ return null;
3477
+ }
3478
+ #f(e, t) {
3479
+ for (let [e, n] of t) {
3480
+ let t = p(e);
3481
+ t && t.destroy(n);
3482
+ }
3483
+ t.clear();
3484
+ }
3485
+ #p() {
3486
+ for (let [e, t] of this.#e) this.#f(e, t);
3487
+ this.#e.clear();
3488
+ }
3489
+ /** Watch trait option attributes (e.g. draggable-axis) on this element */
3490
+ #m() {
3491
+ this.#n = new MutationObserver((e) => {
3492
+ for (let t of e) {
3493
+ if (!t.attributeName) continue;
3494
+ let e = u(t.attributeName);
3495
+ if (!e) continue;
3496
+ let n = p(e.trait);
3497
+ if (!n?.update) continue;
3498
+ let r = l(this, e.trait);
3499
+ for (let [, t] of this.#e) {
3500
+ let i = t.get(e.trait);
3501
+ i && n.update(i, r);
3502
+ }
3503
+ }
3504
+ });
3505
+ let e = this.#h();
3506
+ e.length > 0 ? this.#n.observe(this, {
3507
+ attributes: !0,
3508
+ attributeFilter: e
3509
+ }) : this.#n.observe(this, { attributes: !0 });
3510
+ }
3511
+ /** Collect all attributes on this element that match any registered trait prefix. */
3512
+ #h() {
3513
+ let e = h(), t = [];
3514
+ for (let n of this.attributes) for (let r of e) if (n.name.startsWith(r + "-")) {
3515
+ t.push(n.name);
3516
+ break;
3517
+ }
3518
+ return t;
3519
+ }
3520
+ }, Ae = class extends _ {
3521
+ static observedAttributes = ["disabled"];
3522
+ #e;
3523
+ #t = t(!1);
3524
+ #n = null;
3525
+ #r = null;
3526
+ constructor() {
3527
+ super(), this.#e = this.attachInternals();
3528
+ }
3529
+ get value() {
3530
+ return this.#n?.value ?? "";
3531
+ }
3532
+ set value(e) {
3533
+ this.#n && (this.#n.value = e);
3534
+ }
3535
+ get disabled() {
3536
+ return this.#t.value;
3537
+ }
3538
+ set disabled(e) {
3539
+ this.#t.value = e, this.toggleAttribute("disabled", e);
3540
+ }
3541
+ attributeChangedCallback(e, t, n) {
3542
+ if (t !== n) {
3543
+ switch (e) {
3544
+ case "disabled":
3545
+ this.#t.value = n !== null;
3546
+ break;
3547
+ }
3548
+ super.attributeChangedCallback(e, t, n);
3549
+ }
3550
+ }
3551
+ setup() {
3552
+ super.setup(), this.addEffect(w(this, this.#t, this.#e)), this.deferChildren(() => {
3553
+ this.#i(), this.addEffect(() => {
3554
+ let e = this.#t.value;
3555
+ this.#n && this.#n.toggleAttribute("disabled", e), this.#r && (e ? this.#r.setAttribute("disabled", "") : this.#o());
3556
+ });
3557
+ }), this.addEventListener("ui-input", this.#s), this.addEventListener("ui-press", this.#c), this.addEventListener("keydown", this.#l);
3558
+ }
3559
+ teardown() {
3560
+ this.removeEventListener("ui-input", this.#s), this.removeEventListener("ui-press", this.#c), this.removeEventListener("keydown", this.#l), this.#n = null, this.#r = null, super.teardown();
3561
+ }
3562
+ #i() {
3563
+ this.#n = this.querySelector(":scope > ui-textarea"), this.#r = this.querySelector("[data-submit]") ?? this.#a();
3564
+ }
3565
+ #a() {
3566
+ let e = this.querySelector(":scope > ui-chat-input-actions");
3567
+ if (!e) return null;
3568
+ let t = e.querySelectorAll("ui-button[variant=\"primary\"]");
3569
+ return t.length ? t[t.length - 1] : null;
3570
+ }
3571
+ #o() {
3572
+ !this.#r || this.#t.value || (this.value.trim() ? this.#r.removeAttribute("disabled") : this.#r.setAttribute("disabled", ""));
3573
+ }
3574
+ #s = (e) => {
3575
+ this.#t.value || this.#o();
3576
+ };
3577
+ #c = (e) => {
3578
+ this.#t.value || e.target === this.#r && this.#u();
3579
+ };
3580
+ #l = (e) => {
3581
+ if (this.#t.value || this.hasAttribute("no-enter-submit")) return;
3582
+ let t = e;
3583
+ if (t.isComposing) return;
3584
+ let n = t.target;
3585
+ !this.#n?.contains(n) && n !== this.#n || t.key === "Enter" && !t.shiftKey && !t.ctrlKey && !t.metaKey && (t.preventDefault(), this.value.trim() && this.#u());
3586
+ };
3587
+ #u() {
3588
+ let e = this.value.trim();
3589
+ e && this.dispatchEvent(new CustomEvent("ui-send", {
3590
+ bubbles: !0,
3591
+ composed: !0,
3592
+ cancelable: !0,
3593
+ detail: { value: e }
3594
+ })) && !this.hasAttribute("no-auto-clear") && (this.value = "", this.#r?.setAttribute("disabled", ""));
3595
+ }
3596
+ }, je = class extends _ {
3597
+ static observedAttributes = ["interactive", "href"];
3598
+ setup() {
3599
+ super.setup(), this.hasAttribute("interactive") && (this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.addEventListener("click", this.#e), this.addEventListener("keydown", this.#t));
3600
+ }
3601
+ teardown() {
3602
+ this.removeEventListener("click", this.#e), this.removeEventListener("keydown", this.#t), super.teardown();
3603
+ }
3604
+ #e = () => {
3605
+ let e = this.getAttribute("href");
3606
+ e && (window.location.href = e);
3607
+ };
3608
+ #t = (e) => {
3609
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.#e());
3610
+ };
3611
+ }, Me = class extends _ {
3612
+ static observedAttributes = [
3613
+ "collapsible",
3614
+ "collapsed",
3615
+ "divider"
3616
+ ];
3617
+ setup() {
3618
+ if (super.setup(), this.hasAttribute("collapsible")) {
3619
+ let e = this.querySelector("[slot=\"heading\"]");
3620
+ e && e.addEventListener("click", this.#e);
3621
+ }
3622
+ }
3623
+ teardown() {
3624
+ let e = this.querySelector("[slot=\"heading\"]");
3625
+ e && e.removeEventListener("click", this.#e), super.teardown();
3626
+ }
3627
+ #e = () => {
3628
+ this.hasAttribute("collapsible") && this.toggleAttribute("collapsed");
3629
+ };
3630
+ }, Ne = class extends _ {
3631
+ #e;
3632
+ #t;
3633
+ constructor() {
3634
+ super(), this.#e = this.attachInternals(), this.#e.role = "toolbar";
3635
+ }
3636
+ setup() {
3637
+ super.setup(), this.#t = new f(this, {
3638
+ selector: ":scope > ui-button:not([disabled]), :scope > button:not([disabled])",
3639
+ orientation: "horizontal"
3640
+ }), this.hasAttribute("aria-label") || this.setAttribute("aria-label", "Toolbar");
3641
+ }
3642
+ teardown() {
3643
+ this.#t.destroy(), super.teardown();
3644
+ }
3645
+ }, Pe = class extends _ {
3646
+ static observedAttributes = ["collapsed"];
3647
+ #e = null;
3648
+ #t = null;
3649
+ #n = null;
3650
+ #r = [];
3651
+ attributeChangedCallback(e, t, n) {
3652
+ t !== n && (e === "collapsed" && this.dataset.ready !== void 0 && this.#i(), super.attributeChangedCallback?.(e, t, n));
3653
+ }
3654
+ setup() {
3655
+ super.setup();
3656
+ let e = this.querySelector(":scope > [slot=\"sidebar\"]");
3657
+ e?.querySelector(".layout-resize-handle") && (this.#e = new a(e, {
3658
+ handleSelector: ".layout-resize-handle",
3659
+ axis: "horizontal",
3660
+ min: 160,
3661
+ max: 400
3662
+ })), e && this.#s(e), queueMicrotask(() => this.#i()), this.addEventListener("ui-dismiss", this.#o), this.dataset.ready = "";
3663
+ }
3664
+ teardown() {
3665
+ this.removeEventListener("ui-dismiss", this.#o), this.#a(), this.#n = null, this.#t?.disconnect(), this.#t = null, this.#e?.destroy(), this.#e = null, super.teardown();
3666
+ }
3667
+ /** Attach or detach summary click interception based on collapsed state. */
3668
+ #i() {
3669
+ if (this.#a(), !this.hasAttribute("collapsed")) {
3670
+ this.#n?.flyoutOpen && this.#n.closeFlyout(), this.#n = null;
3671
+ return;
3672
+ }
3673
+ let e = this.querySelectorAll("ui-nav-group");
3674
+ for (let t of e) {
3675
+ let e = t.querySelector(":scope > details > summary");
3676
+ if (!e) continue;
3677
+ let n = (e) => {
3678
+ e.preventDefault(), this.#n === t && t.flyoutOpen ? (t.closeFlyout(), this.#n = null) : (this.#n?.flyoutOpen && this.#n.closeFlyout(), t.openFlyout(), this.#n = t);
3679
+ };
3680
+ e.addEventListener("click", n), this.#r.push({
3681
+ summary: e,
3682
+ handler: n
3683
+ });
3684
+ }
3685
+ }
3686
+ /** Remove all summary click listeners. */
3687
+ #a() {
3688
+ for (let { summary: e, handler: t } of this.#r) e.removeEventListener("click", t);
3689
+ this.#r = [];
3690
+ }
3691
+ /** When a group closes its flyout internally (dismiss, option select),
3692
+ * clear our active reference so we stay in sync. */
3693
+ #o = (e) => {
3694
+ let t = e.target?.closest?.("ui-nav-group");
3695
+ t && t === this.#n && (this.#n = null);
3696
+ };
3697
+ /** Watch header/footer size changes and sync CSS custom properties + data
3698
+ * attributes so content gets correct padding offsets and fade masks. */
3699
+ #s(e) {
3700
+ let t = e.querySelector("ui-layout-sidebar-header"), n = e.querySelector("ui-layout-sidebar-footer"), r = e.querySelector("ui-layout-sidebar-content");
3701
+ if (!r) return;
3702
+ let i = () => {
3703
+ let i = t ? t.offsetHeight : 0, a = n ? n.offsetHeight : 0;
3704
+ e.style.setProperty("--_sidebar-header-height", `${i}px`), e.style.setProperty("--_sidebar-footer-height", `${a}px`), t ? r.dataset.hasHeader = "" : delete r.dataset.hasHeader, n ? r.dataset.hasFooter = "" : delete r.dataset.hasFooter;
3705
+ };
3706
+ i();
3707
+ let a = [];
3708
+ if (t && a.push(t), n && a.push(n), a.length > 0) {
3709
+ this.#t = new ResizeObserver(i);
3710
+ for (let e of a) this.#t.observe(e);
3711
+ }
3712
+ }
3713
+ }, Fe = class extends _ {
3714
+ #e = null;
3715
+ #t = !1;
3716
+ setup() {
3717
+ super.setup();
3718
+ let e = this.querySelector(":scope > ui-listbox[popover]");
3719
+ e && (this.#e = new m(this), this.#e.wirePopover(this, e), this.addEventListener("click", this.#n), this.addEventListener("ui-dismiss", this.#r));
3720
+ }
3721
+ teardown() {
3722
+ this.removeEventListener("click", this.#n), this.removeEventListener("ui-dismiss", this.#r), this.#e?.destroy(), this.#e = null, this.#t = !1, super.teardown();
3723
+ }
3724
+ #n = (e) => {
3725
+ e.target.closest("ui-listbox") || (this.#t = !this.#t, this.#e?.syncPopover(this.#t));
3726
+ };
3727
+ #r = () => {
3728
+ this.#t = !1, this.#e?.syncPopover(!1);
3729
+ };
3730
+ }, Ie = class extends _ {
3731
+ #e = null;
3732
+ get open() {
3733
+ return this.hasAttribute("open");
3734
+ }
3735
+ set open(e) {
3736
+ this.toggleAttribute("open", e);
3737
+ }
3738
+ toggle() {
3739
+ this.open = !this.open;
3740
+ }
3741
+ setup() {
3742
+ super.setup(), this.querySelector(".layout-resize-handle") && (this.#e = new a(this, {
3743
+ handleSelector: ".layout-resize-handle",
3744
+ axis: "horizontal",
3745
+ min: 280,
3746
+ max: 480,
3747
+ reverse: !0
3748
+ }));
3749
+ }
3750
+ teardown() {
3751
+ this.#e?.destroy(), this.#e = null, super.teardown();
3752
+ }
3753
+ }, Le = class extends _ {
3754
+ #e = null;
3755
+ get open() {
3756
+ return this.hasAttribute("open");
3757
+ }
3758
+ set open(e) {
3759
+ this.toggleAttribute("open", e);
3760
+ }
3761
+ toggle() {
3762
+ this.open = !this.open;
3763
+ }
3764
+ setup() {
3765
+ super.setup(), this.querySelector(".layout-resize-handle") && (this.#e = new a(this, {
3766
+ handleSelector: ".layout-resize-handle",
3767
+ axis: "horizontal",
3768
+ min: 280,
3769
+ max: 480,
3770
+ reverse: !0
3771
+ }));
3772
+ }
3773
+ teardown() {
3774
+ this.#e?.destroy(), this.#e = null, super.teardown();
3775
+ }
3776
+ };
3777
+ export { A as $, Q as A, W as B, ge as C, fe as D, pe as E, Y as F, R as G, V as H, J as I, F as J, L as K, q as L, se as M, oe as N, de as O, ae as P, j as Q, G as R, _e as S, me as T, B as U, H as V, z as W, N as X, P as Y, M as Z, Se as _, Ne as a, ie as at, ye as b, Ae as c, te as ct, $ as d, k as et, De as f, Ce as g, we as h, Pe as i, T as it, le as j, ue as k, ke as l, ee as lt, Te as m, Ie as n, D as nt, Me as o, re as ot, Ee as p, I as q, Fe as r, E as rt, je as s, ne as st, Le as t, O as tt, Oe as u, xe as v, he as w, ve as x, be as y, U as z };