bank20baht-ui 0.4.0 → 0.4.1

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.
@@ -1,20 +1,20 @@
1
1
  import { nothing as h, html as n, svg as A } from "lit";
2
- import { property as l, customElement as u, state as y, query as Et } from "lit/decorators.js";
3
- import { B as $, b as ne, h as q, a as W } from "./base-CajA2aCO.js";
4
- import { t as v } from "./i18n-BcPL9_Jh.js";
5
- import { n as ve, k as Lt, o as ps, i as Rt, p as ds, d as se, a as as, m as Me, v as Ae, c as us, g as bs, l as fs } from "./display-DQRcvsn7.js";
6
- import { repeat as Oe } from "lit/directives/repeat.js";
7
- import { html as ee, unsafeStatic as is } from "lit/static-html.js";
8
- import { c as ms, r as U } from "./baht-toast-CD1WrOYr.js";
9
- import { live as rt } from "lit/directives/live.js";
2
+ import { property as l, customElement as b, state as $, query as Bt } from "lit/decorators.js";
3
+ import { B as y, b as ne, h as S, a as J } from "./base-CajA2aCO.js";
4
+ import { t as m } from "./i18n-BcPL9_Jh.js";
5
+ import { n as $e, k as Lt, o as ds, i as Rt, p as us, d as se, a as rs, m as Ae, v as Le, c as bs, g as fs, l as ms } from "./display-DQRcvsn7.js";
6
+ import { repeat as Ce } from "lit/directives/repeat.js";
7
+ import { html as ee, unsafeStatic as os } from "lit/static-html.js";
8
+ import { c as vs, r as H } from "./baht-toast-CD1WrOYr.js";
9
+ import { live as ot } from "lit/directives/live.js";
10
10
  import { ifDefined as L } from "lit/directives/if-defined.js";
11
- import vs from "flatpickr";
12
- var $s = Object.defineProperty, ys = Object.getOwnPropertyDescriptor, he = (t, e, i, a) => {
13
- for (var s = a > 1 ? void 0 : a ? ys(e, i) : e, r = t.length - 1, o; r >= 0; r--)
11
+ import $s from "flatpickr";
12
+ var ys = Object.defineProperty, gs = Object.getOwnPropertyDescriptor, he = (t, e, i, a) => {
13
+ for (var s = a > 1 ? void 0 : a ? gs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
14
14
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
15
- return a && s && $s(e, i, s), s;
15
+ return a && s && ys(e, i, s), s;
16
16
  };
17
- let zt = class extends $ {
17
+ let zt = class extends y {
18
18
  constructor() {
19
19
  super(...arguments), this.tone = "neutral", this.label = "", this.dot = null;
20
20
  }
@@ -38,14 +38,14 @@ he([
38
38
  l({ attribute: !1 })
39
39
  ], zt.prototype, "dot", 2);
40
40
  zt = he([
41
- u("baht-badge")
41
+ b("baht-badge")
42
42
  ], zt);
43
- var gs = Object.defineProperty, ws = Object.getOwnPropertyDescriptor, Ie = (t, e, i, a) => {
44
- for (var s = a > 1 ? void 0 : a ? ws(e, i) : e, r = t.length - 1, o; r >= 0; r--)
43
+ var ws = Object.defineProperty, xs = Object.getOwnPropertyDescriptor, je = (t, e, i, a) => {
44
+ for (var s = a > 1 ? void 0 : a ? xs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
45
45
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
46
- return a && s && gs(e, i, s), s;
46
+ return a && s && ws(e, i, s), s;
47
47
  };
48
- let ae = class extends $ {
48
+ let ae = class extends y {
49
49
  constructor() {
50
50
  super(...arguments), this.variant = "inline", this.code = "";
51
51
  }
@@ -57,21 +57,21 @@ let ae = class extends $ {
57
57
  return this.variant === "block" ? n`<pre class="baht-code baht-code--block" tabindex="0">${this.code}</pre>` : n`<code class="baht-code">${this.code}</code>`;
58
58
  }
59
59
  };
60
- Ie([
60
+ je([
61
61
  l()
62
62
  ], ae.prototype, "variant", 2);
63
- Ie([
63
+ je([
64
64
  l()
65
65
  ], ae.prototype, "code", 2);
66
- ae = Ie([
67
- u("baht-code")
66
+ ae = je([
67
+ b("baht-code")
68
68
  ], ae);
69
- var xs = Object.defineProperty, _s = Object.getOwnPropertyDescriptor, $t = (t, e, i, a) => {
70
- for (var s = a > 1 ? void 0 : a ? _s(e, i) : e, r = t.length - 1, o; r >= 0; r--)
69
+ var _s = Object.defineProperty, ks = Object.getOwnPropertyDescriptor, yt = (t, e, i, a) => {
70
+ for (var s = a > 1 ? void 0 : a ? ks(e, i) : e, r = t.length - 1, o; r >= 0; r--)
71
71
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
72
- return a && s && xs(e, i, s), s;
72
+ return a && s && _s(e, i, s), s;
73
73
  };
74
- let nt = class extends $ {
74
+ let ht = class extends y {
75
75
  constructor() {
76
76
  super(...arguments), this.page = 1, this.totalPages = 1, this.variant = "numbered", this.siblings = 1, this.hasNext = !1, this.hasPrev = !1;
77
77
  }
@@ -99,7 +99,7 @@ let nt = class extends $ {
99
99
  const { page: t, totalPages: e, siblings: i } = this, a = /* @__PURE__ */ new Set([1, e]);
100
100
  for (let c = t - i; c <= t + i; c++)
101
101
  c >= 1 && c <= e && a.add(c);
102
- const s = [...a].sort((c, m) => c - m), r = [];
102
+ const s = [...a].sort((c, f) => c - f), r = [];
103
103
  let o = 0;
104
104
  for (const c of s)
105
105
  o && c - o === 2 ? r.push(o + 1) : o && c - o > 2 && r.push(null), r.push(c), o = c;
@@ -126,34 +126,34 @@ let nt = class extends $ {
126
126
  </nav>`;
127
127
  }
128
128
  };
129
- $t([
129
+ yt([
130
130
  l({ type: Number })
131
- ], nt.prototype, "page", 2);
132
- $t([
131
+ ], ht.prototype, "page", 2);
132
+ yt([
133
133
  l({ type: Number, attribute: "total-pages" })
134
- ], nt.prototype, "totalPages", 2);
135
- $t([
134
+ ], ht.prototype, "totalPages", 2);
135
+ yt([
136
136
  l()
137
- ], nt.prototype, "variant", 2);
138
- $t([
137
+ ], ht.prototype, "variant", 2);
138
+ yt([
139
139
  l({ type: Number })
140
- ], nt.prototype, "siblings", 2);
141
- $t([
140
+ ], ht.prototype, "siblings", 2);
141
+ yt([
142
142
  l({ type: Boolean, attribute: "has-next" })
143
- ], nt.prototype, "hasNext", 2);
144
- $t([
143
+ ], ht.prototype, "hasNext", 2);
144
+ yt([
145
145
  l({ type: Boolean, attribute: "has-prev" })
146
- ], nt.prototype, "hasPrev", 2);
147
- nt = $t([
148
- u("baht-pagination")
149
- ], nt);
150
- var ks = Object.defineProperty, Ps = Object.getOwnPropertyDescriptor, C = (t, e, i, a) => {
151
- for (var s = a > 1 ? void 0 : a ? Ps(e, i) : e, r = t.length - 1, o; r >= 0; r--)
146
+ ], ht.prototype, "hasPrev", 2);
147
+ ht = yt([
148
+ b("baht-pagination")
149
+ ], ht);
150
+ var Ps = Object.defineProperty, Os = Object.getOwnPropertyDescriptor, O = (t, e, i, a) => {
151
+ for (var s = a > 1 ? void 0 : a ? Os(e, i) : e, r = t.length - 1, o; r >= 0; r--)
152
152
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
153
- return a && s && ks(e, i, s), s;
153
+ return a && s && Ps(e, i, s), s;
154
154
  };
155
- const Os = " › ", $e = (t) => t !== null && typeof t == "object" && !Array.isArray(t) && !(t instanceof Date), te = (t) => t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
156
- let P = class extends $ {
155
+ const Cs = " › ", ye = (t) => t !== null && typeof t == "object" && !Array.isArray(t) && !(t instanceof Date), te = (t) => t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
156
+ let k = class extends y {
157
157
  constructor() {
158
158
  super(...arguments), this.items = [], this.columns = {}, this.loading = !1, this.error = !1, this.errorMessage = "Couldn't load data. Try again.", this.emptyMessage = "No records yet.", this.showIndex = !0, this.indexOffset = 0, this.skeletonRows = 10, this.rowKey = "", this.clickable = !0, this.renderers = {}, this.visibleColumns = [], this.columnPicker = !0, this.page = 1, this.totalPages = 1, this.cursorMode = !1, this.hasNext = !1, this.hasPrev = !1, this.pickerOpen = !1, this.pickedColumns = null, this.draftColumns = [], this.pickAvail = [], this.pickSel = [], this.expanded = [], this.pickerPreviousFocus = null, this.onPickerKeydown = (t) => {
159
159
  t.key === "Escape" ? this.closePicker() : t.key === "Tab" && this.trapPickerFocus(t);
@@ -178,7 +178,7 @@ let P = class extends $ {
178
178
  r != null && r.contains(s) ? t.shiftKey && s === i ? (a.focus(), t.preventDefault()) : !t.shiftKey && s === a && (i.focus(), t.preventDefault()) : (i.focus(), t.preventDefault());
179
179
  }
180
180
  disconnectedCallback() {
181
- super.disconnectedCallback(), q() && document.removeEventListener("keydown", this.onPickerKeydown);
181
+ super.disconnectedCallback(), S() && document.removeEventListener("keydown", this.onPickerKeydown);
182
182
  }
183
183
  willUpdate(t) {
184
184
  t.has("visibleColumns") && !t.has("columns") && (this.pickedColumns = null);
@@ -191,7 +191,7 @@ let P = class extends $ {
191
191
  if (!t) return {};
192
192
  const e = {};
193
193
  for (const [i, a] of Object.entries(t))
194
- e[i] = $e(a) ? {
194
+ e[i] = ye(a) ? {
195
195
  label: te(i),
196
196
  fields: Object.fromEntries(Object.keys(a).map((s) => [s, te(s)]))
197
197
  } : te(i);
@@ -238,20 +238,20 @@ let P = class extends $ {
238
238
  }
239
239
  e.push(typeof s == "string" ? s : s.label), i = typeof s == "string" ? void 0 : s.fields;
240
240
  }
241
- return e.join(Os);
241
+ return e.join(Cs);
242
242
  }
243
243
  /** The row's value at a dotted key (`requester.department`). */
244
244
  static valueAt(t, e) {
245
245
  let i = t;
246
246
  for (const a of e.split(".")) {
247
- if (!$e(i)) return;
247
+ if (!ye(i)) return;
248
248
  i = i[a];
249
249
  }
250
250
  return i;
251
251
  }
252
252
  // ---- picker -----------------------------------------------------------
253
253
  openPicker() {
254
- this.draftColumns = this.columnKeys.slice(), this.pickAvail = [], this.pickSel = [], this.pickerOpen = !0, this.pickerPreviousFocus = document.activeElement, q() && document.addEventListener("keydown", this.onPickerKeydown), this.updateComplete.then(() => {
254
+ this.draftColumns = this.columnKeys.slice(), this.pickAvail = [], this.pickSel = [], this.pickerOpen = !0, this.pickerPreviousFocus = document.activeElement, S() && document.addEventListener("keydown", this.onPickerKeydown), this.updateComplete.then(() => {
255
255
  var t;
256
256
  this.pickerOpen && ((t = this.pickerFocusables()[0]) == null || t.focus());
257
257
  });
@@ -259,7 +259,7 @@ let P = class extends $ {
259
259
  closePicker() {
260
260
  var e;
261
261
  if (!this.pickerOpen) return;
262
- this.pickerOpen = !1, q() && document.removeEventListener("keydown", this.onPickerKeydown);
262
+ this.pickerOpen = !1, S() && document.removeEventListener("keydown", this.onPickerKeydown);
263
263
  const t = this.pickerPreviousFocus;
264
264
  this.pickerPreviousFocus = null, t != null && t.isConnected && ((e = t.focus) == null || e.call(t));
265
265
  }
@@ -309,9 +309,9 @@ let P = class extends $ {
309
309
  );
310
310
  }
311
311
  cell(t, e) {
312
- const i = this.renderers[e], a = P.valueAt(t, e);
312
+ const i = this.renderers[e], a = k.valueAt(t, e);
313
313
  if (i) return i(a, t);
314
- if ($e(a)) {
314
+ if (ye(a)) {
315
315
  const s = a.name ?? a.label ?? a.title ?? a.id;
316
316
  return s == null ? "" : String(s);
317
317
  }
@@ -380,7 +380,7 @@ let P = class extends $ {
380
380
  </li>`;
381
381
  }
382
382
  renderColumnModal() {
383
- const t = this.allColumnKeys, e = this.allPaths().filter((a) => !this.draftColumns.includes(a)).length, i = (a) => (s) => a(P.selectedValues(s));
383
+ const t = this.allColumnKeys, e = this.allPaths().filter((a) => !this.draftColumns.includes(a)).length, i = (a) => (s) => a(k.selectedValues(s));
384
384
  return n`<div
385
385
  class="baht-table-picker-scrim"
386
386
  @click=${(a) => a.target === a.currentTarget && this.closePicker()}
@@ -456,90 +456,90 @@ let P = class extends $ {
456
456
  </div>`;
457
457
  }
458
458
  };
459
- C([
459
+ O([
460
460
  l({ attribute: !1 })
461
- ], P.prototype, "items", 2);
462
- C([
461
+ ], k.prototype, "items", 2);
462
+ O([
463
463
  l({ attribute: !1 })
464
- ], P.prototype, "columns", 2);
465
- C([
464
+ ], k.prototype, "columns", 2);
465
+ O([
466
466
  l({ type: Boolean })
467
- ], P.prototype, "loading", 2);
468
- C([
467
+ ], k.prototype, "loading", 2);
468
+ O([
469
469
  l({ type: Boolean })
470
- ], P.prototype, "error", 2);
471
- C([
470
+ ], k.prototype, "error", 2);
471
+ O([
472
472
  l({ attribute: "error-message" })
473
- ], P.prototype, "errorMessage", 2);
474
- C([
473
+ ], k.prototype, "errorMessage", 2);
474
+ O([
475
475
  l({ attribute: "empty-message" })
476
- ], P.prototype, "emptyMessage", 2);
477
- C([
476
+ ], k.prototype, "emptyMessage", 2);
477
+ O([
478
478
  l({ type: Boolean, attribute: "show-index" })
479
- ], P.prototype, "showIndex", 2);
480
- C([
479
+ ], k.prototype, "showIndex", 2);
480
+ O([
481
481
  l({ type: Number, attribute: "index-offset" })
482
- ], P.prototype, "indexOffset", 2);
483
- C([
482
+ ], k.prototype, "indexOffset", 2);
483
+ O([
484
484
  l({ type: Number, attribute: "skeleton-rows" })
485
- ], P.prototype, "skeletonRows", 2);
486
- C([
485
+ ], k.prototype, "skeletonRows", 2);
486
+ O([
487
487
  l({ attribute: "row-key" })
488
- ], P.prototype, "rowKey", 2);
489
- C([
488
+ ], k.prototype, "rowKey", 2);
489
+ O([
490
490
  l({ type: Boolean })
491
- ], P.prototype, "clickable", 2);
492
- C([
491
+ ], k.prototype, "clickable", 2);
492
+ O([
493
493
  l({ attribute: !1 })
494
- ], P.prototype, "renderers", 2);
495
- C([
494
+ ], k.prototype, "renderers", 2);
495
+ O([
496
496
  l({ attribute: !1 })
497
- ], P.prototype, "visibleColumns", 2);
498
- C([
497
+ ], k.prototype, "visibleColumns", 2);
498
+ O([
499
499
  l({ type: Boolean, attribute: "column-picker" })
500
- ], P.prototype, "columnPicker", 2);
501
- C([
500
+ ], k.prototype, "columnPicker", 2);
501
+ O([
502
502
  l({ type: Number })
503
- ], P.prototype, "page", 2);
504
- C([
503
+ ], k.prototype, "page", 2);
504
+ O([
505
505
  l({ type: Number, attribute: "total-pages" })
506
- ], P.prototype, "totalPages", 2);
507
- C([
506
+ ], k.prototype, "totalPages", 2);
507
+ O([
508
508
  l({ type: Boolean, attribute: "cursor-mode" })
509
- ], P.prototype, "cursorMode", 2);
510
- C([
509
+ ], k.prototype, "cursorMode", 2);
510
+ O([
511
511
  l({ type: Boolean, attribute: "has-next" })
512
- ], P.prototype, "hasNext", 2);
513
- C([
512
+ ], k.prototype, "hasNext", 2);
513
+ O([
514
514
  l({ type: Boolean, attribute: "has-prev" })
515
- ], P.prototype, "hasPrev", 2);
516
- C([
517
- y()
518
- ], P.prototype, "pickerOpen", 2);
519
- C([
520
- y()
521
- ], P.prototype, "pickedColumns", 2);
522
- C([
523
- y()
524
- ], P.prototype, "draftColumns", 2);
525
- C([
526
- y()
527
- ], P.prototype, "pickAvail", 2);
528
- C([
529
- y()
530
- ], P.prototype, "pickSel", 2);
531
- C([
532
- y()
533
- ], P.prototype, "expanded", 2);
534
- P = C([
535
- u("baht-table")
536
- ], P);
537
- var Cs = Object.defineProperty, Ds = Object.getOwnPropertyDescriptor, dt = (t, e, i, a) => {
538
- for (var s = a > 1 ? void 0 : a ? Ds(e, i) : e, r = t.length - 1, o; r >= 0; r--)
515
+ ], k.prototype, "hasPrev", 2);
516
+ O([
517
+ $()
518
+ ], k.prototype, "pickerOpen", 2);
519
+ O([
520
+ $()
521
+ ], k.prototype, "pickedColumns", 2);
522
+ O([
523
+ $()
524
+ ], k.prototype, "draftColumns", 2);
525
+ O([
526
+ $()
527
+ ], k.prototype, "pickAvail", 2);
528
+ O([
529
+ $()
530
+ ], k.prototype, "pickSel", 2);
531
+ O([
532
+ $()
533
+ ], k.prototype, "expanded", 2);
534
+ k = O([
535
+ b("baht-table")
536
+ ], k);
537
+ var Ds = Object.defineProperty, Fs = Object.getOwnPropertyDescriptor, ut = (t, e, i, a) => {
538
+ for (var s = a > 1 ? void 0 : a ? Fs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
539
539
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
540
- return a && s && Cs(e, i, s), s;
540
+ return a && s && Ds(e, i, s), s;
541
541
  };
542
- let at = class extends $ {
542
+ let it = class extends y {
543
543
  constructor() {
544
544
  super(...arguments), this.items = [], this.loading = !1, this.error = !1, this.errorMessage = "Couldn't load data. Try again.", this.emptyMessage = "Nothing here yet.", this.skeletonRows = 5, this.clickable = !0;
545
545
  }
@@ -585,36 +585,36 @@ let at = class extends $ {
585
585
  return n`<div class="baht-list" role=${t ? "list" : h}>${this.renderRows()}</div>`;
586
586
  }
587
587
  };
588
- dt([
588
+ ut([
589
589
  l({ attribute: !1 })
590
- ], at.prototype, "items", 2);
591
- dt([
590
+ ], it.prototype, "items", 2);
591
+ ut([
592
592
  l({ type: Boolean })
593
- ], at.prototype, "loading", 2);
594
- dt([
593
+ ], it.prototype, "loading", 2);
594
+ ut([
595
595
  l({ type: Boolean })
596
- ], at.prototype, "error", 2);
597
- dt([
596
+ ], it.prototype, "error", 2);
597
+ ut([
598
598
  l({ attribute: "error-message" })
599
- ], at.prototype, "errorMessage", 2);
600
- dt([
599
+ ], it.prototype, "errorMessage", 2);
600
+ ut([
601
601
  l({ attribute: "empty-message" })
602
- ], at.prototype, "emptyMessage", 2);
603
- dt([
602
+ ], it.prototype, "emptyMessage", 2);
603
+ ut([
604
604
  l({ type: Number, attribute: "skeleton-rows" })
605
- ], at.prototype, "skeletonRows", 2);
606
- dt([
605
+ ], it.prototype, "skeletonRows", 2);
606
+ ut([
607
607
  l({ type: Boolean })
608
- ], at.prototype, "clickable", 2);
609
- at = dt([
610
- u("baht-list")
611
- ], at);
612
- var Fs = Object.defineProperty, Es = Object.getOwnPropertyDescriptor, Wt = (t, e, i, a) => {
613
- for (var s = a > 1 ? void 0 : a ? Es(e, i) : e, r = t.length - 1, o; r >= 0; r--)
608
+ ], it.prototype, "clickable", 2);
609
+ it = ut([
610
+ b("baht-list")
611
+ ], it);
612
+ var Es = Object.defineProperty, Bs = Object.getOwnPropertyDescriptor, Wt = (t, e, i, a) => {
613
+ for (var s = a > 1 ? void 0 : a ? Bs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
614
614
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
615
- return a && s && Fs(e, i, s), s;
615
+ return a && s && Es(e, i, s), s;
616
616
  };
617
- let _t = class extends $ {
617
+ let kt = class extends y {
618
618
  constructor() {
619
619
  super(...arguments), this.text = "", this.position = "top", this.dismissed = !1;
620
620
  }
@@ -655,25 +655,25 @@ let _t = class extends $ {
655
655
  };
656
656
  Wt([
657
657
  l()
658
- ], _t.prototype, "text", 2);
658
+ ], kt.prototype, "text", 2);
659
659
  Wt([
660
660
  l()
661
- ], _t.prototype, "position", 2);
661
+ ], kt.prototype, "position", 2);
662
662
  Wt([
663
- Et(".baht-tooltip-anchor")
664
- ], _t.prototype, "anchorEl", 2);
663
+ Bt(".baht-tooltip-anchor")
664
+ ], kt.prototype, "anchorEl", 2);
665
665
  Wt([
666
- y()
667
- ], _t.prototype, "dismissed", 2);
668
- _t = Wt([
669
- u("baht-tooltip")
670
- ], _t);
671
- var Bs = Object.defineProperty, Is = Object.getOwnPropertyDescriptor, Bt = (t, e, i, a) => {
672
- for (var s = a > 1 ? void 0 : a ? Is(e, i) : e, r = t.length - 1, o; r >= 0; r--)
666
+ $()
667
+ ], kt.prototype, "dismissed", 2);
668
+ kt = Wt([
669
+ b("baht-tooltip")
670
+ ], kt);
671
+ var Is = Object.defineProperty, js = Object.getOwnPropertyDescriptor, It = (t, e, i, a) => {
672
+ for (var s = a > 1 ? void 0 : a ? js(e, i) : e, r = t.length - 1, o; r >= 0; r--)
673
673
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
674
- return a && s && Bs(e, i, s), s;
674
+ return a && s && Is(e, i, s), s;
675
675
  };
676
- let bt = class extends $ {
676
+ let ft = class extends y {
677
677
  constructor() {
678
678
  super(...arguments), this.tone = "info", this.heading = "", this.message = "", this.dismissible = !1, this.dismissed = !1, this.generation = 0;
679
679
  }
@@ -689,7 +689,7 @@ let bt = class extends $ {
689
689
  e();
690
690
  return;
691
691
  }
692
- i.classList.add("baht-alert--leaving"), ms(i, e);
692
+ i.classList.add("baht-alert--leaving"), vs(i, e);
693
693
  }
694
694
  render() {
695
695
  return this.dismissed ? h : n`<div class="baht-alert baht-alert--${this.tone}" role="alert">
@@ -697,34 +697,34 @@ let bt = class extends $ {
697
697
  ${this.heading ? n`<div class="baht-alert-title">${this.heading}</div>` : h}
698
698
  ${this.message ? n`<div class="baht-alert-message">${this.message}</div>` : h}
699
699
  </div>
700
- ${this.dismissible ? n`<button type="button" class="baht-alert-dismiss" aria-label=${v("dismiss")} @click=${() => this.dismiss()}>×</button>` : h}
700
+ ${this.dismissible ? n`<button type="button" class="baht-alert-dismiss" aria-label=${m("dismiss")} @click=${() => this.dismiss()}>×</button>` : h}
701
701
  </div>`;
702
702
  }
703
703
  };
704
- Bt([
704
+ It([
705
705
  l()
706
- ], bt.prototype, "tone", 2);
707
- Bt([
706
+ ], ft.prototype, "tone", 2);
707
+ It([
708
708
  l()
709
- ], bt.prototype, "heading", 2);
710
- Bt([
709
+ ], ft.prototype, "heading", 2);
710
+ It([
711
711
  l()
712
- ], bt.prototype, "message", 2);
713
- Bt([
712
+ ], ft.prototype, "message", 2);
713
+ It([
714
714
  l({ type: Boolean })
715
- ], bt.prototype, "dismissible", 2);
716
- Bt([
717
- y()
718
- ], bt.prototype, "dismissed", 2);
719
- bt = Bt([
720
- u("baht-alert")
721
- ], bt);
722
- var js = Object.defineProperty, Ss = Object.getOwnPropertyDescriptor, It = (t, e, i, a) => {
723
- for (var s = a > 1 ? void 0 : a ? Ss(e, i) : e, r = t.length - 1, o; r >= 0; r--)
715
+ ], ft.prototype, "dismissible", 2);
716
+ It([
717
+ $()
718
+ ], ft.prototype, "dismissed", 2);
719
+ ft = It([
720
+ b("baht-alert")
721
+ ], ft);
722
+ var Ss = Object.defineProperty, Ms = Object.getOwnPropertyDescriptor, jt = (t, e, i, a) => {
723
+ for (var s = a > 1 ? void 0 : a ? Ms(e, i) : e, r = t.length - 1, o; r >= 0; r--)
724
724
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
725
- return a && s && js(e, i, s), s;
725
+ return a && s && Ss(e, i, s), s;
726
726
  };
727
- let ft = class extends $ {
727
+ let mt = class extends y {
728
728
  constructor() {
729
729
  super(...arguments), this.value = 0, this.max = 5, this.readonly = !1, this.label = "Rating", this.hover = 0;
730
730
  }
@@ -777,30 +777,30 @@ let ft = class extends $ {
777
777
  </div>`;
778
778
  }
779
779
  };
780
- It([
780
+ jt([
781
781
  l({ type: Number })
782
- ], ft.prototype, "value", 2);
783
- It([
782
+ ], mt.prototype, "value", 2);
783
+ jt([
784
784
  l({ type: Number })
785
- ], ft.prototype, "max", 2);
786
- It([
785
+ ], mt.prototype, "max", 2);
786
+ jt([
787
787
  l({ type: Boolean })
788
- ], ft.prototype, "readonly", 2);
789
- It([
788
+ ], mt.prototype, "readonly", 2);
789
+ jt([
790
790
  l()
791
- ], ft.prototype, "label", 2);
792
- It([
793
- y()
794
- ], ft.prototype, "hover", 2);
795
- ft = It([
796
- u("baht-rating")
797
- ], ft);
798
- var Ts = Object.defineProperty, Ms = Object.getOwnPropertyDescriptor, ut = (t, e, i, a) => {
799
- for (var s = a > 1 ? void 0 : a ? Ms(e, i) : e, r = t.length - 1, o; r >= 0; r--)
791
+ ], mt.prototype, "label", 2);
792
+ jt([
793
+ $()
794
+ ], mt.prototype, "hover", 2);
795
+ mt = jt([
796
+ b("baht-rating")
797
+ ], mt);
798
+ var Ts = Object.defineProperty, As = Object.getOwnPropertyDescriptor, bt = (t, e, i, a) => {
799
+ for (var s = a > 1 ? void 0 : a ? As(e, i) : e, r = t.length - 1, o; r >= 0; r--)
800
800
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
801
801
  return a && s && Ts(e, i, s), s;
802
802
  };
803
- let it = class extends $ {
803
+ let rt = class extends y {
804
804
  constructor() {
805
805
  super(...arguments), this.value = 0, this.min = 0, this.max = 100, this.step = 1, this.label = "", this.disabled = !1, this.showValue = !0;
806
806
  }
@@ -821,7 +821,7 @@ let it = class extends $ {
821
821
  type="range"
822
822
  id=${this.inputId}
823
823
  aria-label=${this.label ? h : "Value"}
824
- .value=${rt(String(this.value))}
824
+ .value=${ot(String(this.value))}
825
825
  min=${this.min}
826
826
  max=${this.max}
827
827
  step=${this.step}
@@ -833,36 +833,36 @@ let it = class extends $ {
833
833
  </div>`;
834
834
  }
835
835
  };
836
- ut([
836
+ bt([
837
837
  l({ type: Number })
838
- ], it.prototype, "value", 2);
839
- ut([
838
+ ], rt.prototype, "value", 2);
839
+ bt([
840
840
  l({ type: Number })
841
- ], it.prototype, "min", 2);
842
- ut([
841
+ ], rt.prototype, "min", 2);
842
+ bt([
843
843
  l({ type: Number })
844
- ], it.prototype, "max", 2);
845
- ut([
844
+ ], rt.prototype, "max", 2);
845
+ bt([
846
846
  l({ type: Number })
847
- ], it.prototype, "step", 2);
848
- ut([
847
+ ], rt.prototype, "step", 2);
848
+ bt([
849
849
  l()
850
- ], it.prototype, "label", 2);
851
- ut([
850
+ ], rt.prototype, "label", 2);
851
+ bt([
852
852
  l({ type: Boolean })
853
- ], it.prototype, "disabled", 2);
854
- ut([
853
+ ], rt.prototype, "disabled", 2);
854
+ bt([
855
855
  l({ type: Boolean, attribute: "show-value" })
856
- ], it.prototype, "showValue", 2);
857
- it = ut([
858
- u("baht-range")
859
- ], it);
860
- var As = Object.defineProperty, Ls = Object.getOwnPropertyDescriptor, jt = (t, e, i, a) => {
861
- for (var s = a > 1 ? void 0 : a ? Ls(e, i) : e, r = t.length - 1, o; r >= 0; r--)
856
+ ], rt.prototype, "showValue", 2);
857
+ rt = bt([
858
+ b("baht-range")
859
+ ], rt);
860
+ var Ls = Object.defineProperty, Ns = Object.getOwnPropertyDescriptor, St = (t, e, i, a) => {
861
+ for (var s = a > 1 ? void 0 : a ? Ns(e, i) : e, r = t.length - 1, o; r >= 0; r--)
862
862
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
863
- return a && s && As(e, i, s), s;
863
+ return a && s && Ls(e, i, s), s;
864
864
  };
865
- let mt = class extends $ {
865
+ let vt = class extends y {
866
866
  constructor() {
867
867
  super(...arguments), this.length = 6, this.value = "", this.disabled = !1, this.mode = "numeric", this.label = "One-time code", this._chars = [], this._lastValue = "", this._wasFull = !1;
868
868
  }
@@ -936,7 +936,7 @@ let mt = class extends $ {
936
936
  inputmode=${this.mode === "numeric" ? "numeric" : "text"}
937
937
  maxlength="1"
938
938
  autocomplete=${e === 0 ? "one-time-code" : "off"}
939
- aria-label=${v("otpCharacter", { i: e + 1, n: this.length })}
939
+ aria-label=${m("otpCharacter", { i: e + 1, n: this.length })}
940
940
  .value=${t}
941
941
  ?disabled=${this.disabled}
942
942
  @input=${(i) => this.onInput(e, i)}
@@ -946,30 +946,30 @@ let mt = class extends $ {
946
946
  </div>`;
947
947
  }
948
948
  };
949
- jt([
949
+ St([
950
950
  l({ type: Number })
951
- ], mt.prototype, "length", 2);
952
- jt([
951
+ ], vt.prototype, "length", 2);
952
+ St([
953
953
  l()
954
- ], mt.prototype, "value", 2);
955
- jt([
954
+ ], vt.prototype, "value", 2);
955
+ St([
956
956
  l({ type: Boolean })
957
- ], mt.prototype, "disabled", 2);
958
- jt([
957
+ ], vt.prototype, "disabled", 2);
958
+ St([
959
959
  l()
960
- ], mt.prototype, "mode", 2);
961
- jt([
960
+ ], vt.prototype, "mode", 2);
961
+ St([
962
962
  l()
963
- ], mt.prototype, "label", 2);
964
- mt = jt([
965
- u("baht-otp")
966
- ], mt);
967
- var Ns = Object.defineProperty, qs = Object.getOwnPropertyDescriptor, St = (t, e, i, a) => {
968
- for (var s = a > 1 ? void 0 : a ? qs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
963
+ ], vt.prototype, "label", 2);
964
+ vt = St([
965
+ b("baht-otp")
966
+ ], vt);
967
+ var qs = Object.defineProperty, Rs = Object.getOwnPropertyDescriptor, Mt = (t, e, i, a) => {
968
+ for (var s = a > 1 ? void 0 : a ? Rs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
969
969
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
970
- return a && s && Ns(e, i, s), s;
970
+ return a && s && qs(e, i, s), s;
971
971
  };
972
- let vt = class extends $ {
972
+ let $t = class extends y {
973
973
  constructor() {
974
974
  super(...arguments), this.options = [], this.selected = [], this.multiple = !0, this.disabled = !1, this.label = "Filters";
975
975
  }
@@ -993,30 +993,30 @@ let vt = class extends $ {
993
993
  </div>`;
994
994
  }
995
995
  };
996
- St([
996
+ Mt([
997
997
  l({ attribute: !1 })
998
- ], vt.prototype, "options", 2);
999
- St([
998
+ ], $t.prototype, "options", 2);
999
+ Mt([
1000
1000
  l({ attribute: !1 })
1001
- ], vt.prototype, "selected", 2);
1002
- St([
1001
+ ], $t.prototype, "selected", 2);
1002
+ Mt([
1003
1003
  l({ type: Boolean })
1004
- ], vt.prototype, "multiple", 2);
1005
- St([
1004
+ ], $t.prototype, "multiple", 2);
1005
+ Mt([
1006
1006
  l({ type: Boolean })
1007
- ], vt.prototype, "disabled", 2);
1008
- St([
1007
+ ], $t.prototype, "disabled", 2);
1008
+ Mt([
1009
1009
  l()
1010
- ], vt.prototype, "label", 2);
1011
- vt = St([
1012
- u("baht-filter")
1013
- ], vt);
1014
- var Rs = Object.defineProperty, zs = Object.getOwnPropertyDescriptor, ce = (t, e, i, a) => {
1015
- for (var s = a > 1 ? void 0 : a ? zs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1010
+ ], $t.prototype, "label", 2);
1011
+ $t = Mt([
1012
+ b("baht-filter")
1013
+ ], $t);
1014
+ var zs = Object.defineProperty, Vs = Object.getOwnPropertyDescriptor, ce = (t, e, i, a) => {
1015
+ for (var s = a > 1 ? void 0 : a ? Vs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1016
1016
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1017
- return a && s && Rs(e, i, s), s;
1017
+ return a && s && zs(e, i, s), s;
1018
1018
  };
1019
- let Vt = class extends $ {
1019
+ let Vt = class extends y {
1020
1020
  constructor() {
1021
1021
  super(...arguments), this.variant = "rect", this.width = "100%", this.height = "";
1022
1022
  }
@@ -1039,14 +1039,14 @@ ce([
1039
1039
  l()
1040
1040
  ], Vt.prototype, "height", 2);
1041
1041
  Vt = ce([
1042
- u("baht-skeleton")
1042
+ b("baht-skeleton")
1043
1043
  ], Vt);
1044
- var Vs = Object.defineProperty, Ks = Object.getOwnPropertyDescriptor, Jt = (t, e, i, a) => {
1045
- for (var s = a > 1 ? void 0 : a ? Ks(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1044
+ var Ks = Object.defineProperty, Us = Object.getOwnPropertyDescriptor, Jt = (t, e, i, a) => {
1045
+ for (var s = a > 1 ? void 0 : a ? Us(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1046
1046
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1047
- return a && s && Vs(e, i, s), s;
1047
+ return a && s && Ks(e, i, s), s;
1048
1048
  };
1049
- let kt = class extends $ {
1049
+ let Pt = class extends y {
1050
1050
  constructor() {
1051
1051
  super(...arguments), this.value = null, this.tone = "primary", this.showLabel = !1, this.label = "Progress";
1052
1052
  }
@@ -1069,25 +1069,25 @@ let kt = class extends $ {
1069
1069
  };
1070
1070
  Jt([
1071
1071
  l({ type: Number })
1072
- ], kt.prototype, "value", 2);
1072
+ ], Pt.prototype, "value", 2);
1073
1073
  Jt([
1074
1074
  l()
1075
- ], kt.prototype, "tone", 2);
1075
+ ], Pt.prototype, "tone", 2);
1076
1076
  Jt([
1077
1077
  l({ type: Boolean, attribute: "show-label" })
1078
- ], kt.prototype, "showLabel", 2);
1078
+ ], Pt.prototype, "showLabel", 2);
1079
1079
  Jt([
1080
1080
  l()
1081
- ], kt.prototype, "label", 2);
1082
- kt = Jt([
1083
- u("baht-progress")
1084
- ], kt);
1085
- var Us = Object.defineProperty, Hs = Object.getOwnPropertyDescriptor, je = (t, e, i, a) => {
1086
- for (var s = a > 1 ? void 0 : a ? Hs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1081
+ ], Pt.prototype, "label", 2);
1082
+ Pt = Jt([
1083
+ b("baht-progress")
1084
+ ], Pt);
1085
+ var Hs = Object.defineProperty, Gs = Object.getOwnPropertyDescriptor, Se = (t, e, i, a) => {
1086
+ for (var s = a > 1 ? void 0 : a ? Gs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1087
1087
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1088
- return a && s && Us(e, i, s), s;
1088
+ return a && s && Hs(e, i, s), s;
1089
1089
  };
1090
- let ie = class extends $ {
1090
+ let ie = class extends y {
1091
1091
  constructor() {
1092
1092
  super(...arguments), this.size = "md", this.label = "Loading";
1093
1093
  }
@@ -1096,21 +1096,21 @@ let ie = class extends $ {
1096
1096
  return n`<span class="baht-spinner${t}" role="status" aria-label=${this.label}></span>`;
1097
1097
  }
1098
1098
  };
1099
- je([
1099
+ Se([
1100
1100
  l()
1101
1101
  ], ie.prototype, "size", 2);
1102
- je([
1102
+ Se([
1103
1103
  l()
1104
1104
  ], ie.prototype, "label", 2);
1105
- ie = je([
1106
- u("baht-spinner")
1105
+ ie = Se([
1106
+ b("baht-spinner")
1107
1107
  ], ie);
1108
- var Gs = Object.defineProperty, Ws = Object.getOwnPropertyDescriptor, Yt = (t, e, i, a) => {
1109
- for (var s = a > 1 ? void 0 : a ? Ws(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1108
+ var Ws = Object.defineProperty, Js = Object.getOwnPropertyDescriptor, Yt = (t, e, i, a) => {
1109
+ for (var s = a > 1 ? void 0 : a ? Js(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1110
1110
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1111
- return a && s && Gs(e, i, s), s;
1111
+ return a && s && Ws(e, i, s), s;
1112
1112
  };
1113
- let Pt = class extends $ {
1113
+ let Ot = class extends y {
1114
1114
  constructor() {
1115
1115
  super(...arguments), this.heading = "", this.subtitle = "", this.hero = !1;
1116
1116
  }
@@ -1127,25 +1127,25 @@ let Pt = class extends $ {
1127
1127
  };
1128
1128
  Yt([
1129
1129
  l()
1130
- ], Pt.prototype, "heading", 2);
1130
+ ], Ot.prototype, "heading", 2);
1131
1131
  Yt([
1132
1132
  l()
1133
- ], Pt.prototype, "subtitle", 2);
1133
+ ], Ot.prototype, "subtitle", 2);
1134
1134
  Yt([
1135
1135
  l({ type: Boolean })
1136
- ], Pt.prototype, "hero", 2);
1136
+ ], Ot.prototype, "hero", 2);
1137
1137
  Yt([
1138
- Et(".baht-card-body")
1139
- ], Pt.prototype, "bodyEl", 2);
1140
- Pt = Yt([
1141
- u("baht-card")
1142
- ], Pt);
1143
- var Js = Object.defineProperty, Ys = Object.getOwnPropertyDescriptor, pe = (t, e, i, a) => {
1144
- for (var s = a > 1 ? void 0 : a ? Ys(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1138
+ Bt(".baht-card-body")
1139
+ ], Ot.prototype, "bodyEl", 2);
1140
+ Ot = Yt([
1141
+ b("baht-card")
1142
+ ], Ot);
1143
+ var Ys = Object.defineProperty, Xs = Object.getOwnPropertyDescriptor, pe = (t, e, i, a) => {
1144
+ for (var s = a > 1 ? void 0 : a ? Xs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1145
1145
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1146
- return a && s && Js(e, i, s), s;
1146
+ return a && s && Ys(e, i, s), s;
1147
1147
  };
1148
- let Kt = class extends $ {
1148
+ let Kt = class extends y {
1149
1149
  constructor() {
1150
1150
  super(...arguments), this.legend = "", this.disabled = !1;
1151
1151
  }
@@ -1166,17 +1166,17 @@ pe([
1166
1166
  l({ type: Boolean })
1167
1167
  ], Kt.prototype, "disabled", 2);
1168
1168
  pe([
1169
- Et(".baht-fieldset-body")
1169
+ Bt(".baht-fieldset-body")
1170
1170
  ], Kt.prototype, "bodyEl", 2);
1171
1171
  Kt = pe([
1172
- u("baht-fieldset")
1172
+ b("baht-fieldset")
1173
1173
  ], Kt);
1174
- var Xs = Object.defineProperty, Zs = Object.getOwnPropertyDescriptor, rs = (t, e, i, a) => {
1175
- for (var s = a > 1 ? void 0 : a ? Zs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1174
+ var Zs = Object.defineProperty, Qs = Object.getOwnPropertyDescriptor, ls = (t, e, i, a) => {
1175
+ for (var s = a > 1 ? void 0 : a ? Qs(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1176
1176
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1177
- return a && s && Xs(e, i, s), s;
1177
+ return a && s && Zs(e, i, s), s;
1178
1178
  };
1179
- let Ce = class extends $ {
1179
+ let De = class extends y {
1180
1180
  constructor() {
1181
1181
  super(...arguments), this.items = [];
1182
1182
  }
@@ -1200,18 +1200,18 @@ let Ce = class extends $ {
1200
1200
  </div>`;
1201
1201
  }
1202
1202
  };
1203
- rs([
1203
+ ls([
1204
1204
  l({ attribute: !1 })
1205
- ], Ce.prototype, "items", 2);
1206
- Ce = rs([
1207
- u("baht-timeline")
1208
- ], Ce);
1209
- var Qs = Object.defineProperty, ta = Object.getOwnPropertyDescriptor, de = (t, e, i, a) => {
1210
- for (var s = a > 1 ? void 0 : a ? ta(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1205
+ ], De.prototype, "items", 2);
1206
+ De = ls([
1207
+ b("baht-timeline")
1208
+ ], De);
1209
+ var ta = Object.defineProperty, ea = Object.getOwnPropertyDescriptor, de = (t, e, i, a) => {
1210
+ for (var s = a > 1 ? void 0 : a ? ea(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1211
1211
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1212
- return a && s && Qs(e, i, s), s;
1212
+ return a && s && ta(e, i, s), s;
1213
1213
  };
1214
- let Ot = class extends $ {
1214
+ let Ct = class extends y {
1215
1215
  constructor() {
1216
1216
  super(...arguments), this.items = [], this.multiple = !1, this.openSet = /* @__PURE__ */ new Set(), this.itemsFingerprint = "";
1217
1217
  }
@@ -1220,7 +1220,7 @@ let Ot = class extends $ {
1220
1220
  }
1221
1221
  willUpdate(t) {
1222
1222
  if (t.has("items")) {
1223
- const e = Ot.fingerprint(this.items);
1223
+ const e = Ct.fingerprint(this.items);
1224
1224
  e !== this.itemsFingerprint && (this.itemsFingerprint = e, this.openSet = new Set(this.items.flatMap((i, a) => i.open ? [a] : [])));
1225
1225
  }
1226
1226
  }
@@ -1254,22 +1254,22 @@ let Ot = class extends $ {
1254
1254
  };
1255
1255
  de([
1256
1256
  l({ attribute: !1 })
1257
- ], Ot.prototype, "items", 2);
1257
+ ], Ct.prototype, "items", 2);
1258
1258
  de([
1259
1259
  l({ type: Boolean })
1260
- ], Ot.prototype, "multiple", 2);
1260
+ ], Ct.prototype, "multiple", 2);
1261
1261
  de([
1262
- y()
1263
- ], Ot.prototype, "openSet", 2);
1264
- Ot = de([
1265
- u("baht-accordion")
1266
- ], Ot);
1267
- var ea = Object.defineProperty, sa = Object.getOwnPropertyDescriptor, Xt = (t, e, i, a) => {
1268
- for (var s = a > 1 ? void 0 : a ? sa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1262
+ $()
1263
+ ], Ct.prototype, "openSet", 2);
1264
+ Ct = de([
1265
+ b("baht-accordion")
1266
+ ], Ct);
1267
+ var sa = Object.defineProperty, aa = Object.getOwnPropertyDescriptor, Xt = (t, e, i, a) => {
1268
+ for (var s = a > 1 ? void 0 : a ? aa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1269
1269
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1270
- return a && s && ea(e, i, s), s;
1270
+ return a && s && sa(e, i, s), s;
1271
1271
  };
1272
- let Ct = class extends $ {
1272
+ let Dt = class extends y {
1273
1273
  constructor() {
1274
1274
  super(...arguments), this.href = "", this.label = "", this.external = !1, this.externalHint = "opens in new tab";
1275
1275
  }
@@ -1284,25 +1284,25 @@ let Ct = class extends $ {
1284
1284
  };
1285
1285
  Xt([
1286
1286
  l()
1287
- ], Ct.prototype, "href", 2);
1287
+ ], Dt.prototype, "href", 2);
1288
1288
  Xt([
1289
1289
  l()
1290
- ], Ct.prototype, "label", 2);
1290
+ ], Dt.prototype, "label", 2);
1291
1291
  Xt([
1292
1292
  l({ type: Boolean })
1293
- ], Ct.prototype, "external", 2);
1293
+ ], Dt.prototype, "external", 2);
1294
1294
  Xt([
1295
1295
  l({ attribute: "external-hint" })
1296
- ], Ct.prototype, "externalHint", 2);
1297
- Ct = Xt([
1298
- u("baht-link")
1299
- ], Ct);
1300
- var aa = Object.defineProperty, ia = Object.getOwnPropertyDescriptor, Se = (t, e, i, a) => {
1301
- for (var s = a > 1 ? void 0 : a ? ia(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1296
+ ], Dt.prototype, "externalHint", 2);
1297
+ Dt = Xt([
1298
+ b("baht-link")
1299
+ ], Dt);
1300
+ var ia = Object.defineProperty, ra = Object.getOwnPropertyDescriptor, Me = (t, e, i, a) => {
1301
+ for (var s = a > 1 ? void 0 : a ? ra(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1302
1302
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1303
- return a && s && aa(e, i, s), s;
1303
+ return a && s && ia(e, i, s), s;
1304
1304
  };
1305
- let re = class extends $ {
1305
+ let re = class extends y {
1306
1306
  constructor() {
1307
1307
  super(...arguments), this.items = [], this.separator = "›";
1308
1308
  }
@@ -1327,27 +1327,27 @@ let re = class extends $ {
1327
1327
  </nav>`;
1328
1328
  }
1329
1329
  };
1330
- Se([
1330
+ Me([
1331
1331
  l({ attribute: !1 })
1332
1332
  ], re.prototype, "items", 2);
1333
- Se([
1333
+ Me([
1334
1334
  l()
1335
1335
  ], re.prototype, "separator", 2);
1336
- re = Se([
1337
- u("baht-breadcrumbs")
1336
+ re = Me([
1337
+ b("baht-breadcrumbs")
1338
1338
  ], re);
1339
- var ra = Object.getOwnPropertyDescriptor, oa = (t, e, i, a) => {
1340
- for (var s = a > 1 ? void 0 : a ? ra(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1339
+ var oa = Object.getOwnPropertyDescriptor, la = (t, e, i, a) => {
1340
+ for (var s = a > 1 ? void 0 : a ? oa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1341
1341
  (o = t[r]) && (s = o(s) || s);
1342
1342
  return s;
1343
1343
  };
1344
- let Le = class extends W {
1344
+ let Ne = class extends J {
1345
1345
  renderControl() {
1346
1346
  return n`<input
1347
1347
  class="baht-control baht-control--text"
1348
1348
  id=${this.controlId}
1349
1349
  type=${this.field.type === "email" ? "email" : this.field.type === "password" ? "password" : "text"}
1350
- .value=${rt(this.shownValue == null ? "" : String(this.shownValue))}
1350
+ .value=${ot(this.shownValue == null ? "" : String(this.shownValue))}
1351
1351
  placeholder=${L(this.field.placeholder)}
1352
1352
  maxlength=${L(this.field.max_length)}
1353
1353
  autocomplete=${L(this.field.autocomplete)}
@@ -1360,20 +1360,20 @@ let Le = class extends W {
1360
1360
  />`;
1361
1361
  }
1362
1362
  };
1363
- Le = oa([
1364
- u("baht-input")
1365
- ], Le);
1366
- var la = Object.getOwnPropertyDescriptor, na = (t, e, i, a) => {
1367
- for (var s = a > 1 ? void 0 : a ? la(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1363
+ Ne = la([
1364
+ b("baht-input")
1365
+ ], Ne);
1366
+ var na = Object.getOwnPropertyDescriptor, ha = (t, e, i, a) => {
1367
+ for (var s = a > 1 ? void 0 : a ? na(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1368
1368
  (o = t[r]) && (s = o(s) || s);
1369
1369
  return s;
1370
1370
  };
1371
- let Ne = class extends W {
1371
+ let qe = class extends J {
1372
1372
  renderControl() {
1373
1373
  return n`<textarea
1374
1374
  class="baht-control baht-control--textarea"
1375
1375
  id=${this.controlId}
1376
- .value=${rt(this.shownValue == null ? "" : String(this.shownValue))}
1376
+ .value=${ot(this.shownValue == null ? "" : String(this.shownValue))}
1377
1377
  placeholder=${L(this.field.placeholder)}
1378
1378
  maxlength=${L(this.field.max_length)}
1379
1379
  rows=${this.field.rows ?? 3}
@@ -1387,21 +1387,21 @@ let Ne = class extends W {
1387
1387
  ></textarea>`;
1388
1388
  }
1389
1389
  };
1390
- Ne = na([
1391
- u("baht-textarea")
1392
- ], Ne);
1393
- var ha = Object.getOwnPropertyDescriptor, ca = (t, e, i, a) => {
1394
- for (var s = a > 1 ? void 0 : a ? ha(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1390
+ qe = ha([
1391
+ b("baht-textarea")
1392
+ ], qe);
1393
+ var ca = Object.getOwnPropertyDescriptor, pa = (t, e, i, a) => {
1394
+ for (var s = a > 1 ? void 0 : a ? ca(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1395
1395
  (o = t[r]) && (s = o(s) || s);
1396
1396
  return s;
1397
1397
  };
1398
- let qe = class extends W {
1398
+ let Re = class extends J {
1399
1399
  renderControl() {
1400
1400
  return n`<input
1401
1401
  class="baht-control baht-control--number"
1402
1402
  id=${this.controlId}
1403
1403
  type="number"
1404
- .value=${rt(this.shownValue == null ? "" : String(this.shownValue))}
1404
+ .value=${ot(this.shownValue == null ? "" : String(this.shownValue))}
1405
1405
  placeholder=${L(this.field.placeholder)}
1406
1406
  min=${L(this.field.min)}
1407
1407
  max=${L(this.field.max)}
@@ -1418,23 +1418,23 @@ let qe = class extends W {
1418
1418
  />`;
1419
1419
  }
1420
1420
  };
1421
- qe = ca([
1422
- u("baht-number")
1423
- ], qe);
1424
- var pa = Object.defineProperty, da = Object.getOwnPropertyDescriptor, Te = (t, e, i, a) => {
1425
- for (var s = a > 1 ? void 0 : a ? da(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1421
+ Re = pa([
1422
+ b("baht-number")
1423
+ ], Re);
1424
+ var da = Object.defineProperty, ua = Object.getOwnPropertyDescriptor, Te = (t, e, i, a) => {
1425
+ for (var s = a > 1 ? void 0 : a ? ua(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1426
1426
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1427
- return a && s && pa(e, i, s), s;
1427
+ return a && s && da(e, i, s), s;
1428
1428
  };
1429
- const ua = 500;
1430
- let oe = class extends W {
1429
+ const ba = 500;
1430
+ let oe = class extends J {
1431
1431
  constructor() {
1432
1432
  super(...arguments), this.open = !1, this.active = 0, this.typeBuffer = "", this.onDocMousedown = (t) => {
1433
1433
  this.contains(t.target) || this.close();
1434
1434
  };
1435
1435
  }
1436
1436
  disconnectedCallback() {
1437
- super.disconnectedCallback(), clearTimeout(this.typeTimer), q() && document.removeEventListener("mousedown", this.onDocMousedown);
1437
+ super.disconnectedCallback(), clearTimeout(this.typeTimer), S() && document.removeEventListener("mousedown", this.onDocMousedown);
1438
1438
  }
1439
1439
  get listId() {
1440
1440
  return `${this.controlId}-list`;
@@ -1445,7 +1445,7 @@ let oe = class extends W {
1445
1445
  /** Placeholder row first (picks `null`), then the field's options. */
1446
1446
  get rows() {
1447
1447
  return [
1448
- { key: "", label: this.field.placeholder ?? v("choose") },
1448
+ { key: "", label: this.field.placeholder ?? m("choose") },
1449
1449
  ...this.field.options ?? []
1450
1450
  ];
1451
1451
  }
@@ -1469,10 +1469,10 @@ let oe = class extends W {
1469
1469
  (e = t == null ? void 0 : t.scrollIntoView) == null || e.call(t, { block: "nearest" });
1470
1470
  }
1471
1471
  openList() {
1472
- !this.interactive || this.open || (this.active = this.selectedIndex, this.open = !0, q() && document.addEventListener("mousedown", this.onDocMousedown));
1472
+ !this.interactive || this.open || (this.active = this.selectedIndex, this.open = !0, S() && document.addEventListener("mousedown", this.onDocMousedown));
1473
1473
  }
1474
1474
  close() {
1475
- this.open && (this.open = !1, q() && document.removeEventListener("mousedown", this.onDocMousedown));
1475
+ this.open && (this.open = !1, S() && document.removeEventListener("mousedown", this.onDocMousedown));
1476
1476
  }
1477
1477
  toggle() {
1478
1478
  this.open ? this.close() : this.openList();
@@ -1490,7 +1490,7 @@ let oe = class extends W {
1490
1490
  }
1491
1491
  /** Type-to-select: first option (after the highlighted one) starting with the buffer. */
1492
1492
  typeahead(t) {
1493
- clearTimeout(this.typeTimer), this.typeBuffer += t.toLowerCase(), this.typeTimer = setTimeout(() => this.typeBuffer = "", ua);
1493
+ clearTimeout(this.typeTimer), this.typeBuffer += t.toLowerCase(), this.typeTimer = setTimeout(() => this.typeBuffer = "", ba);
1494
1494
  const e = this.rows, i = this.typeBuffer.length === 1 ? this.active + 1 : this.active;
1495
1495
  for (let a = 0; a < e.length; a++) {
1496
1496
  const s = (i + a) % e.length;
@@ -1585,20 +1585,20 @@ let oe = class extends W {
1585
1585
  }
1586
1586
  };
1587
1587
  Te([
1588
- y()
1588
+ $()
1589
1589
  ], oe.prototype, "open", 2);
1590
1590
  Te([
1591
- y()
1591
+ $()
1592
1592
  ], oe.prototype, "active", 2);
1593
1593
  oe = Te([
1594
- u("baht-select")
1594
+ b("baht-select")
1595
1595
  ], oe);
1596
- var ba = Object.getOwnPropertyDescriptor, fa = (t, e, i, a) => {
1597
- for (var s = a > 1 ? void 0 : a ? ba(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1596
+ var fa = Object.getOwnPropertyDescriptor, ma = (t, e, i, a) => {
1597
+ for (var s = a > 1 ? void 0 : a ? fa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1598
1598
  (o = t[r]) && (s = o(s) || s);
1599
1599
  return s;
1600
1600
  };
1601
- let Re = class extends W {
1601
+ let ze = class extends J {
1602
1602
  get selected() {
1603
1603
  return Array.isArray(this.value) ? this.value : [];
1604
1604
  }
@@ -1618,7 +1618,7 @@ let Re = class extends W {
1618
1618
  <input
1619
1619
  type="checkbox"
1620
1620
  value=${t.key}
1621
- .checked=${rt(this.selected.includes(t.key))}
1621
+ .checked=${ot(this.selected.includes(t.key))}
1622
1622
  ?disabled=${this.disabled || this.readonly}
1623
1623
  @change=${(e) => this.toggle(t.key, e.target.checked)}
1624
1624
  />
@@ -1628,15 +1628,15 @@ let Re = class extends W {
1628
1628
  </div>`;
1629
1629
  }
1630
1630
  };
1631
- Re = fa([
1632
- u("baht-multiselect")
1633
- ], Re);
1634
- var ma = Object.getOwnPropertyDescriptor, va = (t, e, i, a) => {
1635
- for (var s = a > 1 ? void 0 : a ? ma(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1631
+ ze = ma([
1632
+ b("baht-multiselect")
1633
+ ], ze);
1634
+ var va = Object.getOwnPropertyDescriptor, $a = (t, e, i, a) => {
1635
+ for (var s = a > 1 ? void 0 : a ? va(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1636
1636
  (o = t[r]) && (s = o(s) || s);
1637
1637
  return s;
1638
1638
  };
1639
- let ze = class extends W {
1639
+ let Ve = class extends J {
1640
1640
  /** Label sits beside the box, so suppress the block label. */
1641
1641
  renderLabel() {
1642
1642
  return h;
@@ -1646,7 +1646,7 @@ let ze = class extends W {
1646
1646
  <input
1647
1647
  type="checkbox"
1648
1648
  id=${this.controlId}
1649
- .checked=${rt(this.value === !0)}
1649
+ .checked=${ot(this.value === !0)}
1650
1650
  ?disabled=${this.disabled || this.readonly}
1651
1651
  ?required=${this.required}
1652
1652
  aria-invalid=${this.invalid}
@@ -1659,15 +1659,15 @@ let ze = class extends W {
1659
1659
  </label>`;
1660
1660
  }
1661
1661
  };
1662
- ze = va([
1663
- u("baht-checkbox")
1664
- ], ze);
1665
- var $a = Object.getOwnPropertyDescriptor, ya = (t, e, i, a) => {
1666
- for (var s = a > 1 ? void 0 : a ? $a(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1662
+ Ve = $a([
1663
+ b("baht-checkbox")
1664
+ ], Ve);
1665
+ var ya = Object.getOwnPropertyDescriptor, ga = (t, e, i, a) => {
1666
+ for (var s = a > 1 ? void 0 : a ? ya(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1667
1667
  (o = t[r]) && (s = o(s) || s);
1668
1668
  return s;
1669
1669
  };
1670
- let Ve = class extends W {
1670
+ let Ke = class extends J {
1671
1671
  renderControl() {
1672
1672
  return n`<div
1673
1673
  class="baht-control baht-control--radio"
@@ -1683,7 +1683,7 @@ let Ve = class extends W {
1683
1683
  type="radio"
1684
1684
  name=${this.controlId}
1685
1685
  value=${t.key}
1686
- .checked=${rt(this.value === t.key)}
1686
+ .checked=${ot(this.value === t.key)}
1687
1687
  ?disabled=${this.disabled || this.readonly}
1688
1688
  @change=${() => this.emitInput(t.key)}
1689
1689
  />
@@ -1693,15 +1693,15 @@ let Ve = class extends W {
1693
1693
  </div>`;
1694
1694
  }
1695
1695
  };
1696
- Ve = ya([
1697
- u("baht-radio")
1698
- ], Ve);
1699
- var ga = Object.getOwnPropertyDescriptor, wa = (t, e, i, a) => {
1700
- for (var s = a > 1 ? void 0 : a ? ga(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1696
+ Ke = ga([
1697
+ b("baht-radio")
1698
+ ], Ke);
1699
+ var wa = Object.getOwnPropertyDescriptor, xa = (t, e, i, a) => {
1700
+ for (var s = a > 1 ? void 0 : a ? wa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1701
1701
  (o = t[r]) && (s = o(s) || s);
1702
1702
  return s;
1703
1703
  };
1704
- let Ke = class extends W {
1704
+ let Ue = class extends J {
1705
1705
  renderLabel() {
1706
1706
  return h;
1707
1707
  }
@@ -1712,7 +1712,7 @@ let Ke = class extends W {
1712
1712
  role="switch"
1713
1713
  id=${this.controlId}
1714
1714
  aria-checked=${this.value === !0 ? "true" : "false"}
1715
- .checked=${rt(this.value === !0)}
1715
+ .checked=${ot(this.value === !0)}
1716
1716
  ?disabled=${this.disabled || this.readonly}
1717
1717
  ?required=${this.required}
1718
1718
  aria-invalid=${this.invalid}
@@ -1726,15 +1726,15 @@ let Ke = class extends W {
1726
1726
  </label>`;
1727
1727
  }
1728
1728
  };
1729
- Ke = wa([
1730
- u("baht-toggle")
1731
- ], Ke);
1732
- var xa = Object.getOwnPropertyDescriptor, _a = (t, e, i, a) => {
1733
- for (var s = a > 1 ? void 0 : a ? xa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1729
+ Ue = xa([
1730
+ b("baht-toggle")
1731
+ ], Ue);
1732
+ var _a = Object.getOwnPropertyDescriptor, ka = (t, e, i, a) => {
1733
+ for (var s = a > 1 ? void 0 : a ? _a(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1734
1734
  (o = t[r]) && (s = o(s) || s);
1735
1735
  return s;
1736
1736
  };
1737
- let Ue = class extends W {
1737
+ let He = class extends J {
1738
1738
  constructor() {
1739
1739
  super(...arguments), this.lastEmitted = null;
1740
1740
  }
@@ -1765,7 +1765,7 @@ let Ue = class extends W {
1765
1765
  return;
1766
1766
  }
1767
1767
  if (!this.fp || this.fp.input !== e || t.has("field") || t.has("disabled") || t.has("readonly")) {
1768
- this.teardown(), this.fp = vs(e, this.options());
1768
+ this.teardown(), this.fp = $s(e, this.options());
1769
1769
  return;
1770
1770
  }
1771
1771
  t.has("value") && (this.lastEmitted = null, this.syncValue());
@@ -1778,10 +1778,10 @@ let Ue = class extends W {
1778
1778
  syncValue() {
1779
1779
  if (!this.fp) return;
1780
1780
  const t = this.datesOf(this.value);
1781
- Ge(this.fp.selectedDates, t) || (t.length === 0 ? this.fp.clear(!1) : this.fp.setDate(t, !1));
1781
+ We(this.fp.selectedDates, t) || (t.length === 0 ? this.fp.clear(!1) : this.fp.setDate(t, !1));
1782
1782
  }
1783
1783
  options() {
1784
- const t = this.field, e = ve(t), i = Lt(t.min), a = Lt(t.max);
1784
+ const t = this.field, e = $e(t), i = Lt(t.min), a = Lt(t.max);
1785
1785
  return {
1786
1786
  static: !0,
1787
1787
  disableMobile: !0,
@@ -1793,7 +1793,7 @@ let Ue = class extends W {
1793
1793
  defaultDate: this.datesOf(this.value),
1794
1794
  ...i ? { minDate: i } : {},
1795
1795
  ...a ? { maxDate: a } : {},
1796
- disable: We(t),
1796
+ disable: Je(t),
1797
1797
  onReady: (s, r, o) => this.mountFooter(o),
1798
1798
  onOpen: () => this.refreshFooter(),
1799
1799
  onChange: (s) => {
@@ -1810,9 +1810,9 @@ let Ue = class extends W {
1810
1810
  const e = document.createElement("div");
1811
1811
  e.className = "baht-datepicker-footer";
1812
1812
  const i = document.createElement("button");
1813
- i.type = "button", i.className = "baht-button baht-button--sm baht-datepicker-today", i.textContent = v("today"), i.addEventListener("click", () => this.pickToday());
1813
+ i.type = "button", i.className = "baht-button baht-button--sm baht-datepicker-today", i.textContent = m("today"), i.addEventListener("click", () => this.pickToday());
1814
1814
  const a = document.createElement("button");
1815
- a.type = "button", a.className = "baht-button baht-button--danger baht-button--sm baht-datepicker-clear", a.textContent = v("clear"), a.addEventListener("click", () => {
1815
+ a.type = "button", a.className = "baht-button baht-button--danger baht-button--sm baht-datepicker-clear", a.textContent = m("clear"), a.addEventListener("click", () => {
1816
1816
  var s, r;
1817
1817
  (s = this.fp) == null || s.clear(), (r = this.fp) == null || r.close();
1818
1818
  }), e.append(i, a), t.calendarContainer.appendChild(e), this.todayBtn = i, this.clearBtn = a, this.refreshFooter(t);
@@ -1824,15 +1824,15 @@ let Ue = class extends W {
1824
1824
  t && (this.todayBtn && (this.todayBtn.disabled = !this.todayAllowed()), this.clearBtn && (this.clearBtn.disabled = t.selectedDates.length === 0));
1825
1825
  }
1826
1826
  todayAllowed() {
1827
- const t = xt(/* @__PURE__ */ new Date()), e = Lt(this.field.min), i = Lt(this.field.max);
1828
- if (e && t < xt(e) || i && t > xt(i)) return !1;
1829
- for (const a of We(this.field) ?? [])
1827
+ const t = _t(/* @__PURE__ */ new Date()), e = Lt(this.field.min), i = Lt(this.field.max);
1828
+ if (e && t < _t(e) || i && t > _t(i)) return !1;
1829
+ for (const a of Je(this.field) ?? [])
1830
1830
  if (a instanceof Date) {
1831
- if (He(a, t)) return !1;
1831
+ if (Ge(a, t)) return !1;
1832
1832
  } else if (typeof a == "function") {
1833
1833
  if (a(t)) return !1;
1834
1834
  } else if (typeof a == "object" && "from" in a) {
1835
- const s = xt(new Date(a.from)), r = xt(new Date(a.to));
1835
+ const s = _t(new Date(a.from)), r = _t(new Date(a.to));
1836
1836
  if (t >= s && t <= r) return !1;
1837
1837
  }
1838
1838
  return !0;
@@ -1840,13 +1840,13 @@ let Ue = class extends W {
1840
1840
  pickToday() {
1841
1841
  const t = this.fp;
1842
1842
  if (!t || !this.todayAllowed()) return;
1843
- const e = xt(/* @__PURE__ */ new Date());
1844
- switch (ve(this.field)) {
1843
+ const e = _t(/* @__PURE__ */ new Date());
1844
+ switch ($e(this.field)) {
1845
1845
  case "range":
1846
1846
  t.setDate([e, e], !0);
1847
1847
  break;
1848
1848
  case "multiple": {
1849
- t.selectedDates.some((a) => He(a, e)) || t.setDate([...t.selectedDates, e], !0);
1849
+ t.selectedDates.some((a) => Ge(a, e)) || t.setDate([...t.selectedDates, e], !0);
1850
1850
  break;
1851
1851
  }
1852
1852
  default:
@@ -1856,16 +1856,16 @@ let Ue = class extends W {
1856
1856
  }
1857
1857
  emitIfChanged(t) {
1858
1858
  const e = this.lastEmitted ?? this.datesOf(this.value);
1859
- Ge(t, e) || (this.lastEmitted = [...t], this.emitInput(this.toValue(t)));
1859
+ We(t, e) || (this.lastEmitted = [...t], this.emitInput(this.toValue(t)));
1860
1860
  }
1861
1861
  /** Host value (any mode) -> the Date list flatpickr works with. */
1862
1862
  datesOf(t) {
1863
- return ps(t).map(Lt).filter((e) => e !== null);
1863
+ return ds(t).map(Lt).filter((e) => e !== null);
1864
1864
  }
1865
1865
  /** flatpickr's selection -> the value shape of the field's mode. */
1866
1866
  toValue(t) {
1867
1867
  const e = t.map(Rt);
1868
- switch (ve(this.field)) {
1868
+ switch ($e(this.field)) {
1869
1869
  case "range":
1870
1870
  return e.length === 2 ? [e[0], e[1]] : null;
1871
1871
  case "multiple":
@@ -1875,44 +1875,44 @@ let Ue = class extends W {
1875
1875
  }
1876
1876
  }
1877
1877
  };
1878
- Ue = _a([
1879
- u("baht-datepicker")
1880
- ], Ue);
1881
- function xt(t) {
1878
+ He = ka([
1879
+ b("baht-datepicker")
1880
+ ], He);
1881
+ function _t(t) {
1882
1882
  return new Date(t.getFullYear(), t.getMonth(), t.getDate());
1883
1883
  }
1884
- function He(t, e) {
1884
+ function Ge(t, e) {
1885
1885
  return Rt(t) === Rt(e);
1886
1886
  }
1887
- function Ge(t, e) {
1887
+ function We(t, e) {
1888
1888
  return t.length !== e.length ? !1 : t.every((i, a) => Rt(i) === Rt(e[a]));
1889
1889
  }
1890
- function We(t) {
1890
+ function Je(t) {
1891
1891
  const e = [];
1892
1892
  for (const a of t.disabled_dates ?? []) {
1893
- const s = ds(a);
1893
+ const s = us(a);
1894
1894
  s && e.push(s[0].getTime() === s[1].getTime() ? s[0] : { from: s[0], to: s[1] });
1895
1895
  }
1896
1896
  const i = t.disabled_weekdays;
1897
1897
  return i != null && i.length && e.push((a) => i.includes(a.getDay())), e;
1898
1898
  }
1899
- var ka = Object.defineProperty, Pa = Object.getOwnPropertyDescriptor, Zt = (t, e, i, a) => {
1900
- for (var s = a > 1 ? void 0 : a ? Pa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1899
+ var Pa = Object.defineProperty, Oa = Object.getOwnPropertyDescriptor, Zt = (t, e, i, a) => {
1900
+ for (var s = a > 1 ? void 0 : a ? Oa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
1901
1901
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
1902
- return a && s && ka(e, i, s), s;
1902
+ return a && s && Pa(e, i, s), s;
1903
1903
  };
1904
- function Je(t) {
1904
+ function Ye(t) {
1905
1905
  return t !== null && typeof t == "object" && typeof t.url == "string";
1906
1906
  }
1907
- function ye(t) {
1907
+ function ge(t) {
1908
1908
  return t >= 1024 * 1024 ? `${(t / 1024 / 1024).toFixed(1)} MB` : t >= 1024 ? `${Math.round(t / 1024)} KB` : `${t} B`;
1909
1909
  }
1910
- let Dt = class extends W {
1910
+ let Ft = class extends J {
1911
1911
  constructor() {
1912
1912
  super(...arguments), this.uploadingCount = 0, this.uploadError = null, this.rejectedNames = [];
1913
1913
  }
1914
1914
  get refs() {
1915
- return Array.isArray(this.value) ? this.value.filter(Je) : Je(this.value) ? [this.value] : [];
1915
+ return Array.isArray(this.value) ? this.value.filter(Ye) : Ye(this.value) ? [this.value] : [];
1916
1916
  }
1917
1917
  emitRefs(t) {
1918
1918
  this.emitInput(this.field.multiple ? t : t[0] ?? null);
@@ -1925,7 +1925,7 @@ let Dt = class extends W {
1925
1925
  try {
1926
1926
  e.push(await this.uploader(i));
1927
1927
  } catch {
1928
- this.uploadError = v("uploadFailed");
1928
+ this.uploadError = m("uploadFailed");
1929
1929
  } finally {
1930
1930
  this.uploadingCount -= 1;
1931
1931
  }
@@ -1950,7 +1950,7 @@ let Dt = class extends W {
1950
1950
  const t = [];
1951
1951
  return this.field.accept && t.push(
1952
1952
  this.field.accept.split(",").map((e) => e.trim()).join(", ")
1953
- ), this.field.max_size && t.push(v("uploadMaxSize", { size: ye(this.field.max_size) })), t.join(" · ");
1953
+ ), this.field.max_size && t.push(m("uploadMaxSize", { size: ge(this.field.max_size) })), t.join(" · ");
1954
1954
  }
1955
1955
  renderControl() {
1956
1956
  const t = this.disabled || this.readonly || this.uploadingCount > 0, e = this.hintText(), i = [
@@ -1981,40 +1981,40 @@ let Dt = class extends W {
1981
1981
  aria-describedby=${this.describedBy}
1982
1982
  @change=${(a) => this.onPick(a)}
1983
1983
  />
1984
- <span class="baht-dropzone-icon" aria-hidden="true">${U("upload")}</span>
1984
+ <span class="baht-dropzone-icon" aria-hidden="true">${H("upload")}</span>
1985
1985
  <span class="baht-dropzone-text">
1986
1986
  <label class="baht-dropzone-action" for=${this.controlId}
1987
- >${this.field.multiple ? v("chooseFiles") : v("chooseFile")}</label
1987
+ >${this.field.multiple ? m("chooseFiles") : m("chooseFile")}</label
1988
1988
  >
1989
- <span class="baht-dropzone-or">${v("orDropHere")}</span>
1989
+ <span class="baht-dropzone-or">${m("orDropHere")}</span>
1990
1990
  </span>
1991
1991
  ${e ? n`<span class="baht-dropzone-hint">${e}</span>` : h}
1992
1992
  </div>
1993
- ${this.uploadingCount > 0 ? n`<p class="baht-file-status" role="status">${v("uploading")}</p>` : h}
1993
+ ${this.uploadingCount > 0 ? n`<p class="baht-file-status" role="status">${m("uploading")}</p>` : h}
1994
1994
  ${this.uploadError ? n`<p class="baht-error" role="alert">${this.uploadError}</p>` : h}
1995
1995
  ${this.rejectedNames.length > 0 ? n`<p class="baht-error baht-file-rejected" role="alert">
1996
- ${v("fileRejectedTooLarge", { names: this.rejectedNames.join(", ") })}
1996
+ ${m("fileRejectedTooLarge", { names: this.rejectedNames.join(", ") })}
1997
1997
  </p>` : h}
1998
1998
  ${this.captured.map(
1999
1999
  (a) => n`<span class="baht-file-chip">
2000
2000
  <span class="baht-file-name">${a.name}</span>
2001
- <span class="baht-file-size">${ye(a.size)}</span>
2001
+ <span class="baht-file-size">${ge(a.size)}</span>
2002
2002
  </span>`
2003
2003
  )}
2004
2004
  ${this.refs.map(
2005
2005
  (a) => n`<span class="baht-file-chip">
2006
2006
  <a href=${a.url} target="_blank" rel="noreferrer"
2007
- >${a.name}<span class="baht-visually-hidden"> (${v("opensInNewTab")})</span></a
2007
+ >${a.name}<span class="baht-visually-hidden"> (${m("opensInNewTab")})</span></a
2008
2008
  >
2009
- <span class="baht-file-size">${ye(a.size)}</span>
2009
+ <span class="baht-file-size">${ge(a.size)}</span>
2010
2010
  ${this.disabled || this.readonly ? h : n`<button
2011
2011
  type="button"
2012
2012
  class="baht-file-remove"
2013
- aria-label=${v("removeFile")}
2014
- title=${v("removeFile")}
2013
+ aria-label=${m("removeFile")}
2014
+ title=${m("removeFile")}
2015
2015
  @click=${() => this.emitRefs(this.refs.filter((s) => s !== a))}
2016
2016
  >
2017
- ${U("close")}
2017
+ ${H("close")}
2018
2018
  </button>`}
2019
2019
  </span>`
2020
2020
  )}`;
@@ -2022,42 +2022,42 @@ let Dt = class extends W {
2022
2022
  };
2023
2023
  Zt([
2024
2024
  l({ attribute: !1 })
2025
- ], Dt.prototype, "uploader", 2);
2025
+ ], Ft.prototype, "uploader", 2);
2026
2026
  Zt([
2027
- y()
2028
- ], Dt.prototype, "uploadingCount", 2);
2027
+ $()
2028
+ ], Ft.prototype, "uploadingCount", 2);
2029
2029
  Zt([
2030
- y()
2031
- ], Dt.prototype, "uploadError", 2);
2030
+ $()
2031
+ ], Ft.prototype, "uploadError", 2);
2032
2032
  Zt([
2033
- y()
2034
- ], Dt.prototype, "rejectedNames", 2);
2035
- Dt = Zt([
2036
- u("baht-file")
2037
- ], Dt);
2038
- var Oa = Object.defineProperty, Ca = Object.getOwnPropertyDescriptor, I = (t, e, i, a) => {
2039
- for (var s = a > 1 ? void 0 : a ? Ca(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2033
+ $()
2034
+ ], Ft.prototype, "rejectedNames", 2);
2035
+ Ft = Zt([
2036
+ b("baht-file")
2037
+ ], Ft);
2038
+ var Ca = Object.defineProperty, Da = Object.getOwnPropertyDescriptor, B = (t, e, i, a) => {
2039
+ for (var s = a > 1 ? void 0 : a ? Da(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2040
2040
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
2041
- return a && s && Oa(e, i, s), s;
2041
+ return a && s && Ca(e, i, s), s;
2042
2042
  };
2043
- function Da(t, e) {
2043
+ function Fa(t, e) {
2044
2044
  return e.split(".").reduce((i, a) => {
2045
2045
  if (i !== null && typeof i == "object") return i[a];
2046
2046
  }, t);
2047
2047
  }
2048
- function Fa(t, e) {
2048
+ function Ea(t, e) {
2049
2049
  const i = t.trim();
2050
2050
  if (!i) return null;
2051
2051
  try {
2052
2052
  const a = JSON.parse(i);
2053
2053
  if (typeof a == "string") return a;
2054
- const s = e ? Da(a, e) : a;
2054
+ const s = e ? Fa(a, e) : a;
2055
2055
  return typeof s == "string" && s ? s : null;
2056
2056
  } catch {
2057
2057
  return /^(https?:\/\/|\/|data:|blob:)/.test(i) ? i : null;
2058
2058
  }
2059
2059
  }
2060
- function Ea(t) {
2060
+ function Ba(t) {
2061
2061
  const i = (t.split(/[?#]/)[0] ?? t).split("/").filter(Boolean).pop() ?? t;
2062
2062
  try {
2063
2063
  return decodeURIComponent(i);
@@ -2065,10 +2065,10 @@ function Ea(t) {
2065
2065
  return i;
2066
2066
  }
2067
2067
  }
2068
- function ge(t) {
2068
+ function we(t) {
2069
2069
  return t >= 1024 * 1024 ? `${(t / 1024 / 1024).toFixed(1)} MB` : t >= 1024 ? `${Math.round(t / 1024)} KB` : `${t} B`;
2070
2070
  }
2071
- let F = class extends $ {
2071
+ let D = class extends y {
2072
2072
  constructor() {
2073
2073
  super(...arguments), this.url = "", this.method = "POST", this.fieldName = "file", this.responseKey = "url", this.headers = {}, this.withCredentials = !1, this.value = null, this.label = "", this.hint = "", this.multiple = !1, this.disabled = !1, this.required = !1, this.error = null, this.pending = [], this.rejectedNames = [], this.dragging = !1, this.known = /* @__PURE__ */ new Map(), this.seq = 0;
2074
2074
  }
@@ -2079,7 +2079,7 @@ let F = class extends $ {
2079
2079
  return `baht-upload-${this.uid}`;
2080
2080
  }
2081
2081
  fileFor(t) {
2082
- return this.known.get(t) ?? { name: Ea(t), size: 0, url: t };
2082
+ return this.known.get(t) ?? { name: Ba(t), size: 0, url: t };
2083
2083
  }
2084
2084
  /** Empty the value (does not delete anything on the server). */
2085
2085
  clear() {
@@ -2139,7 +2139,7 @@ let F = class extends $ {
2139
2139
  })
2140
2140
  );
2141
2141
  }, e.onload = () => {
2142
- const a = e.status >= 200 && e.status < 300, s = a ? Fa(e.responseText, this.responseKey) : null;
2142
+ const a = e.status >= 200 && e.status < 300, s = a ? Ea(e.responseText, this.responseKey) : null;
2143
2143
  if (!a || !s) return this.failed(t, a ? 0 : e.status);
2144
2144
  this.known.set(s, {
2145
2145
  name: t.file.name,
@@ -2152,7 +2152,7 @@ let F = class extends $ {
2152
2152
  i.append(this.fieldName || "file", t.file, t.file.name), e.send(i);
2153
2153
  }
2154
2154
  failed(t, e) {
2155
- const i = v("uploadFailed");
2155
+ const i = m("uploadFailed");
2156
2156
  this.patch(t.id, { error: i, percent: 0 }), this.dispatchEvent(
2157
2157
  new CustomEvent("baht-upload-error", {
2158
2158
  detail: { file: t.file, status: e, message: i },
@@ -2171,7 +2171,7 @@ let F = class extends $ {
2171
2171
  const t = [];
2172
2172
  return this.accept && t.push(
2173
2173
  this.accept.split(",").map((e) => e.trim()).join(", ")
2174
- ), this.maxSize && t.push(v("uploadMaxSize", { size: ge(this.maxSize) })), t.join(" · ");
2174
+ ), this.maxSize && t.push(m("uploadMaxSize", { size: we(this.maxSize) })), t.join(" · ");
2175
2175
  }
2176
2176
  render() {
2177
2177
  const t = this.pending.some((c) => !c.error), e = !!this.error, i = this.hint || this.defaultHint(), a = i ? `${this.inputId}-hint` : void 0, s = this.error ? `${this.inputId}-error` : void 0, r = [a, s].filter(Boolean).join(" ") || void 0, o = [
@@ -2202,12 +2202,12 @@ let F = class extends $ {
2202
2202
  aria-describedby=${L(r)}
2203
2203
  @change=${(c) => this.onPick(c)}
2204
2204
  />
2205
- <span class="baht-dropzone-icon" aria-hidden="true">${U("upload")}</span>
2205
+ <span class="baht-dropzone-icon" aria-hidden="true">${H("upload")}</span>
2206
2206
  <span class="baht-dropzone-text">
2207
2207
  <label class="baht-dropzone-action" for=${this.inputId}
2208
- >${this.multiple ? v("chooseFiles") : v("chooseFile")}</label
2208
+ >${this.multiple ? m("chooseFiles") : m("chooseFile")}</label
2209
2209
  >
2210
- <span class="baht-dropzone-or">${v("orDropHere")}</span>
2210
+ <span class="baht-dropzone-or">${m("orDropHere")}</span>
2211
2211
  </span>
2212
2212
  ${i ? n`<span class="baht-dropzone-hint" id=${L(a)}>${i}</span>` : h}
2213
2213
  </div>
@@ -2217,7 +2217,7 @@ let F = class extends $ {
2217
2217
  ${this.pending.map((c) => this.renderPending(c))}
2218
2218
  </ul>` : h}
2219
2219
  ${this.rejectedNames.length > 0 ? n`<p class="baht-error" role="alert">
2220
- ${v("fileRejectedTooLarge", { names: this.rejectedNames.join(", ") })}
2220
+ ${m("fileRejectedTooLarge", { names: this.rejectedNames.join(", ") })}
2221
2221
  </p>` : h}
2222
2222
  ${this.error ? n`<p class="baht-error" id=${L(s)} role="alert">${this.error}</p>` : h}
2223
2223
  </div>`;
@@ -2225,42 +2225,42 @@ let F = class extends $ {
2225
2225
  renderStored(t) {
2226
2226
  const e = this.fileFor(t);
2227
2227
  return n`<li class="baht-file-chip baht-file-chip--done">
2228
- <span class="baht-file-chip-icon" aria-hidden="true">${U("check")}</span>
2228
+ <span class="baht-file-chip-icon" aria-hidden="true">${H("check")}</span>
2229
2229
  <a class="baht-file-name" href=${t} target="_blank" rel="noreferrer"
2230
- >${e.name}<span class="baht-visually-hidden"> (${v("opensInNewTab")})</span></a
2230
+ >${e.name}<span class="baht-visually-hidden"> (${m("opensInNewTab")})</span></a
2231
2231
  >
2232
- ${e.size > 0 ? n`<span class="baht-file-size">${ge(e.size)}</span>` : h}
2232
+ ${e.size > 0 ? n`<span class="baht-file-size">${we(e.size)}</span>` : h}
2233
2233
  ${this.disabled ? h : n`<button
2234
2234
  type="button"
2235
2235
  class="baht-file-remove"
2236
- aria-label=${v("removeFile")}
2237
- title=${v("removeFile")}
2236
+ aria-label=${m("removeFile")}
2237
+ title=${m("removeFile")}
2238
2238
  @click=${() => this.emitValue(this.urls.filter((i) => i !== t))}
2239
2239
  >
2240
- ${U("close")}
2240
+ ${H("close")}
2241
2241
  </button>`}
2242
2242
  </li>`;
2243
2243
  }
2244
2244
  renderPending(t) {
2245
2245
  return n`<li class="baht-file-chip ${t.error ? "baht-file-chip--error" : "baht-file-chip--busy"}">
2246
2246
  <span class="baht-file-name">${t.file.name}</span>
2247
- <span class="baht-file-size">${ge(t.file.size)}</span>
2247
+ <span class="baht-file-size">${we(t.file.size)}</span>
2248
2248
  ${t.error ? n`<span class="baht-file-status baht-file-status--error" role="alert">${t.error}</span>
2249
2249
  <button type="button" class="baht-upload-retry" @click=${() => this.retry(t)}>
2250
- ${v("retry")}
2250
+ ${m("retry")}
2251
2251
  </button>
2252
2252
  <button
2253
2253
  type="button"
2254
2254
  class="baht-file-remove"
2255
- aria-label=${v("removeFile")}
2256
- title=${v("removeFile")}
2255
+ aria-label=${m("removeFile")}
2256
+ title=${m("removeFile")}
2257
2257
  @click=${() => this.dismiss(t)}
2258
2258
  >
2259
- ${U("close")}
2259
+ ${H("close")}
2260
2260
  </button>` : n`<span
2261
2261
  class="baht-upload-bar"
2262
2262
  role="progressbar"
2263
- aria-label=${v("uploading")}
2263
+ aria-label=${m("uploading")}
2264
2264
  aria-valuemin="0"
2265
2265
  aria-valuemax="100"
2266
2266
  aria-valuenow=${String(t.percent)}
@@ -2269,105 +2269,105 @@ let F = class extends $ {
2269
2269
  </li>`;
2270
2270
  }
2271
2271
  };
2272
- I([
2272
+ B([
2273
2273
  l()
2274
- ], F.prototype, "url", 2);
2275
- I([
2274
+ ], D.prototype, "url", 2);
2275
+ B([
2276
2276
  l()
2277
- ], F.prototype, "method", 2);
2278
- I([
2277
+ ], D.prototype, "method", 2);
2278
+ B([
2279
2279
  l({ attribute: "field-name" })
2280
- ], F.prototype, "fieldName", 2);
2281
- I([
2280
+ ], D.prototype, "fieldName", 2);
2281
+ B([
2282
2282
  l({ attribute: "response-key" })
2283
- ], F.prototype, "responseKey", 2);
2284
- I([
2283
+ ], D.prototype, "responseKey", 2);
2284
+ B([
2285
2285
  l({ attribute: !1 })
2286
- ], F.prototype, "headers", 2);
2287
- I([
2286
+ ], D.prototype, "headers", 2);
2287
+ B([
2288
2288
  l({ type: Boolean, attribute: "with-credentials" })
2289
- ], F.prototype, "withCredentials", 2);
2290
- I([
2289
+ ], D.prototype, "withCredentials", 2);
2290
+ B([
2291
2291
  l({ attribute: !1 })
2292
- ], F.prototype, "value", 2);
2293
- I([
2292
+ ], D.prototype, "value", 2);
2293
+ B([
2294
2294
  l()
2295
- ], F.prototype, "label", 2);
2296
- I([
2295
+ ], D.prototype, "label", 2);
2296
+ B([
2297
2297
  l()
2298
- ], F.prototype, "hint", 2);
2299
- I([
2298
+ ], D.prototype, "hint", 2);
2299
+ B([
2300
2300
  l()
2301
- ], F.prototype, "accept", 2);
2302
- I([
2301
+ ], D.prototype, "accept", 2);
2302
+ B([
2303
2303
  l({ type: Boolean })
2304
- ], F.prototype, "multiple", 2);
2305
- I([
2304
+ ], D.prototype, "multiple", 2);
2305
+ B([
2306
2306
  l({ type: Number, attribute: "max-size" })
2307
- ], F.prototype, "maxSize", 2);
2308
- I([
2307
+ ], D.prototype, "maxSize", 2);
2308
+ B([
2309
2309
  l({ type: Boolean })
2310
- ], F.prototype, "disabled", 2);
2311
- I([
2310
+ ], D.prototype, "disabled", 2);
2311
+ B([
2312
2312
  l({ type: Boolean })
2313
- ], F.prototype, "required", 2);
2314
- I([
2313
+ ], D.prototype, "required", 2);
2314
+ B([
2315
2315
  l()
2316
- ], F.prototype, "error", 2);
2317
- I([
2318
- y()
2319
- ], F.prototype, "pending", 2);
2320
- I([
2321
- y()
2322
- ], F.prototype, "rejectedNames", 2);
2323
- I([
2324
- y()
2325
- ], F.prototype, "dragging", 2);
2326
- F = I([
2327
- u("baht-upload")
2328
- ], F);
2329
- var Ba = Object.defineProperty, Ia = Object.getOwnPropertyDescriptor, os = (t, e, i, a) => {
2330
- for (var s = a > 1 ? void 0 : a ? Ia(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2316
+ ], D.prototype, "error", 2);
2317
+ B([
2318
+ $()
2319
+ ], D.prototype, "pending", 2);
2320
+ B([
2321
+ $()
2322
+ ], D.prototype, "rejectedNames", 2);
2323
+ B([
2324
+ $()
2325
+ ], D.prototype, "dragging", 2);
2326
+ D = B([
2327
+ b("baht-upload")
2328
+ ], D);
2329
+ var Ia = Object.defineProperty, ja = Object.getOwnPropertyDescriptor, ns = (t, e, i, a) => {
2330
+ for (var s = a > 1 ? void 0 : a ? ja(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2331
2331
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
2332
- return a && s && Ba(e, i, s), s;
2332
+ return a && s && Ia(e, i, s), s;
2333
2333
  };
2334
- let De = class extends $ {
2334
+ let Fe = class extends y {
2335
2335
  render() {
2336
2336
  if (!this.field) return h;
2337
2337
  const t = this.field.variant ?? "body";
2338
2338
  return n`<div class="baht-text baht-text--${t}">${this.field.text ?? this.field.label ?? ""}</div>`;
2339
2339
  }
2340
2340
  };
2341
- os([
2341
+ ns([
2342
2342
  l({ attribute: !1 })
2343
- ], De.prototype, "field", 2);
2344
- De = os([
2345
- u("baht-text")
2346
- ], De);
2347
- var ja = Object.defineProperty, Sa = Object.getOwnPropertyDescriptor, ls = (t, e, i, a) => {
2348
- for (var s = a > 1 ? void 0 : a ? Sa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2343
+ ], Fe.prototype, "field", 2);
2344
+ Fe = ns([
2345
+ b("baht-text")
2346
+ ], Fe);
2347
+ var Sa = Object.defineProperty, Ma = Object.getOwnPropertyDescriptor, hs = (t, e, i, a) => {
2348
+ for (var s = a > 1 ? void 0 : a ? Ma(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2349
2349
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
2350
- return a && s && ja(e, i, s), s;
2350
+ return a && s && Sa(e, i, s), s;
2351
2351
  };
2352
- let Fe = class extends $ {
2352
+ let Ee = class extends y {
2353
2353
  render() {
2354
2354
  return this.field ? n`<div class="baht-section">
2355
2355
  <span class="baht-section-label">${this.field.text ?? this.field.label ?? ""}</span>
2356
2356
  </div>` : h;
2357
2357
  }
2358
2358
  };
2359
- ls([
2359
+ hs([
2360
2360
  l({ attribute: !1 })
2361
- ], Fe.prototype, "field", 2);
2362
- Fe = ls([
2363
- u("baht-section")
2364
- ], Fe);
2365
- var Ta = Object.defineProperty, Ma = Object.getOwnPropertyDescriptor, ue = (t, e, i, a) => {
2366
- for (var s = a > 1 ? void 0 : a ? Ma(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2361
+ ], Ee.prototype, "field", 2);
2362
+ Ee = hs([
2363
+ b("baht-section")
2364
+ ], Ee);
2365
+ var Ta = Object.defineProperty, Aa = Object.getOwnPropertyDescriptor, ue = (t, e, i, a) => {
2366
+ for (var s = a > 1 ? void 0 : a ? Aa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2367
2367
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
2368
2368
  return a && s && Ta(e, i, s), s;
2369
2369
  };
2370
- let Ut = class extends $ {
2370
+ let Ut = class extends y {
2371
2371
  constructor() {
2372
2372
  super(...arguments), this.total = 0, this.label = "", this.color = "";
2373
2373
  }
@@ -2391,18 +2391,18 @@ ue([
2391
2391
  l()
2392
2392
  ], Ut.prototype, "color", 2);
2393
2393
  Ut = ue([
2394
- u("baht-stat-chart")
2394
+ b("baht-stat-chart")
2395
2395
  ], Ut);
2396
- var Aa = Object.defineProperty, Tt = (t, e, i, a) => {
2396
+ var La = Object.defineProperty, Tt = (t, e, i, a) => {
2397
2397
  for (var s = void 0, r = t.length - 1, o; r >= 0; r--)
2398
2398
  (o = t[r]) && (s = o(e, i, s) || s);
2399
- return s && Aa(e, i, s), s;
2399
+ return s && La(e, i, s), s;
2400
2400
  };
2401
- const La = 10;
2402
- function lt(t, e) {
2403
- return e && t === 0 ? e : `var(--baht-chart-${t % La + 1})`;
2401
+ const Na = 10;
2402
+ function nt(t, e) {
2403
+ return e && t === 0 ? e : `var(--baht-chart-${t % Na + 1})`;
2404
2404
  }
2405
- function Ye(t, e = 5) {
2405
+ function Xe(t, e = 5) {
2406
2406
  return `var(--baht-chart-seq-${Math.min(e - 1, Math.max(0, t)) + 1})`;
2407
2407
  }
2408
2408
  function qt(t, e = "number", i = "THB") {
@@ -2429,7 +2429,7 @@ function qt(t, e = "number", i = "THB") {
2429
2429
  return new Intl.NumberFormat("en-US", { maximumFractionDigits: 0 }).format(t);
2430
2430
  }
2431
2431
  }
2432
- function Ee(t, e = 4) {
2432
+ function Be(t, e = 4) {
2433
2433
  if (!Number.isFinite(t) || t <= 0) return [0, 1];
2434
2434
  const i = t / (Math.max(1, e) + 1), a = 10 ** Math.floor(Math.log10(i)), s = [1, 2, 2.5, 5, 10].map((c) => c * a).find((c) => c >= i - 1e-9) ?? 10 * a, r = Math.ceil(t / s) * s, o = [];
2435
2435
  for (let c = 0; c <= r + s / 1e3; c += s) o.push(Number(c.toFixed(10)));
@@ -2439,7 +2439,7 @@ function le(t, e) {
2439
2439
  const [i, a] = t, [s, r] = e, o = a - i;
2440
2440
  return !Number.isFinite(o) || o === 0 ? () => s : (c) => s + (c - i) / o * (r - s);
2441
2441
  }
2442
- function Na(t, e, i = "Other") {
2442
+ function qa(t, e, i = "Other") {
2443
2443
  if (t.length <= e) return t;
2444
2444
  const a = t.slice(0, e - 1), s = t.slice(e - 1).reduce((r, o) => r + o.count, 0);
2445
2445
  return [...a, { label: i, count: s }];
@@ -2466,7 +2466,7 @@ function be(t, e, i, a = "View as table") {
2466
2466
  </table>
2467
2467
  </details>`;
2468
2468
  }
2469
- class Q extends $ {
2469
+ class tt extends y {
2470
2470
  constructor() {
2471
2471
  super(...arguments), this.emptyMessage = "No data to chart", this.loading = !1, this.showTable = !0, this.format = "number", this.currency = "THB", this.held = null;
2472
2472
  }
@@ -2502,14 +2502,14 @@ class Q extends $ {
2502
2502
  const s = this.querySelector(".baht-chart");
2503
2503
  if (!s || typeof s.getBoundingClientRect != "function") return;
2504
2504
  const r = s.getBoundingClientRect(), o = e;
2505
- let c, m;
2505
+ let c, f;
2506
2506
  if (typeof o.clientX == "number" && (o.clientX !== 0 || o.clientY !== 0))
2507
- c = o.clientX - r.left, m = o.clientY - r.top;
2507
+ c = o.clientX - r.left, f = o.clientY - r.top;
2508
2508
  else {
2509
2509
  const _ = e.currentTarget, p = (g = _ == null ? void 0 : _.getBoundingClientRect) == null ? void 0 : g.call(_);
2510
- c = p ? p.left + p.width / 2 - r.left : 0, m = p ? p.top - r.top : 0;
2510
+ c = p ? p.left + p.width / 2 - r.left : 0, f = p ? p.top - r.top : 0;
2511
2511
  }
2512
- a.style.left = `${Math.round(c)}px`, a.style.top = `${Math.round(m)}px`;
2512
+ a.style.left = `${Math.round(c)}px`, a.style.top = `${Math.round(f)}px`;
2513
2513
  }
2514
2514
  /** Hide the tooltip (pointerleave / blur). */
2515
2515
  hideTip() {
@@ -2540,76 +2540,76 @@ class Q extends $ {
2540
2540
  }
2541
2541
  Tt([
2542
2542
  l({ attribute: "empty-message" })
2543
- ], Q.prototype, "emptyMessage");
2543
+ ], tt.prototype, "emptyMessage");
2544
2544
  Tt([
2545
2545
  l({ type: Boolean, reflect: !0 })
2546
- ], Q.prototype, "loading");
2546
+ ], tt.prototype, "loading");
2547
2547
  Tt([
2548
2548
  l({ type: Boolean, attribute: "show-table" })
2549
- ], Q.prototype, "showTable");
2549
+ ], tt.prototype, "showTable");
2550
2550
  Tt([
2551
2551
  l()
2552
- ], Q.prototype, "format");
2552
+ ], tt.prototype, "format");
2553
2553
  Tt([
2554
2554
  l()
2555
- ], Q.prototype, "currency");
2555
+ ], tt.prototype, "currency");
2556
2556
  Tt([
2557
- Et(".baht-chart-tooltip")
2558
- ], Q.prototype, "tipEl");
2559
- var qa = Object.defineProperty, Ra = Object.getOwnPropertyDescriptor, yt = (t, e, i, a) => {
2560
- for (var s = a > 1 ? void 0 : a ? Ra(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2557
+ Bt(".baht-chart-tooltip")
2558
+ ], tt.prototype, "tipEl");
2559
+ var Ra = Object.defineProperty, za = Object.getOwnPropertyDescriptor, gt = (t, e, i, a) => {
2560
+ for (var s = a > 1 ? void 0 : a ? za(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2561
2561
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
2562
- return a && s && qa(e, i, s), s;
2562
+ return a && s && Ra(e, i, s), s;
2563
2563
  };
2564
- let ht = class extends $ {
2564
+ let ct = class extends y {
2565
2565
  constructor() {
2566
2566
  super(...arguments), this.values = [], this.width = 96, this.height = 24, this.accentLast = !0, this.color = "", this.label = "";
2567
2567
  }
2568
2568
  render() {
2569
- const t = (this.values ?? []).filter((k) => Number.isFinite(k));
2569
+ const t = (this.values ?? []).filter((C) => Number.isFinite(C));
2570
2570
  if (t.length < 2) return h;
2571
- const e = Math.max(16, this.width), i = Math.max(8, this.height), a = 3, s = Math.min(...t), r = Math.max(...t), o = le([0, t.length - 1], [a, e - a]), c = le([s, r === s ? s + 1 : r], [i - a, a]), m = t.map((k, b) => `${o(b).toFixed(2)},${c(k).toFixed(2)}`).join(" "), g = o(t.length - 1), _ = c(t[t.length - 1]), p = this.color || "var(--baht-chart-muted)", f = this.label || `Trend of ${t.length} points`;
2571
+ const e = Math.max(16, this.width), i = Math.max(8, this.height), a = 3, s = Math.min(...t), r = Math.max(...t), o = le([0, t.length - 1], [a, e - a]), c = le([s, r === s ? s + 1 : r], [i - a, a]), f = t.map((C, d) => `${o(d).toFixed(2)},${c(C).toFixed(2)}`).join(" "), g = o(t.length - 1), _ = c(t[t.length - 1]), p = this.color || "var(--baht-chart-muted)", w = this.label || `Trend of ${t.length} points`;
2572
2572
  return n`<svg
2573
2573
  class="baht-sparkline"
2574
2574
  width=${e}
2575
2575
  height=${i}
2576
2576
  viewBox="0 0 ${e} ${i}"
2577
2577
  role="img"
2578
- aria-label=${f}
2578
+ aria-label=${w}
2579
2579
  >
2580
- ${A`<polyline class="baht-sparkline-line" points=${m} fill="none" stroke=${p}/>`}
2580
+ ${A`<polyline class="baht-sparkline-line" points=${f} fill="none" stroke=${p}/>`}
2581
2581
  ${this.accentLast ? A`<circle class="baht-sparkline-dot" cx=${g.toFixed(2)} cy=${_.toFixed(2)} r="3"
2582
2582
  fill="var(--baht-chart-1)"/>` : h}
2583
2583
  </svg>`;
2584
2584
  }
2585
2585
  };
2586
- yt([
2586
+ gt([
2587
2587
  l({ type: Array })
2588
- ], ht.prototype, "values", 2);
2589
- yt([
2588
+ ], ct.prototype, "values", 2);
2589
+ gt([
2590
2590
  l({ type: Number })
2591
- ], ht.prototype, "width", 2);
2592
- yt([
2591
+ ], ct.prototype, "width", 2);
2592
+ gt([
2593
2593
  l({ type: Number })
2594
- ], ht.prototype, "height", 2);
2595
- yt([
2594
+ ], ct.prototype, "height", 2);
2595
+ gt([
2596
2596
  l({ type: Boolean, attribute: "accent-last" })
2597
- ], ht.prototype, "accentLast", 2);
2598
- yt([
2597
+ ], ct.prototype, "accentLast", 2);
2598
+ gt([
2599
2599
  l()
2600
- ], ht.prototype, "color", 2);
2601
- yt([
2600
+ ], ct.prototype, "color", 2);
2601
+ gt([
2602
2602
  l()
2603
- ], ht.prototype, "label", 2);
2604
- ht = yt([
2605
- u("baht-sparkline")
2606
- ], ht);
2607
- var za = Object.defineProperty, Va = Object.getOwnPropertyDescriptor, J = (t, e, i, a) => {
2608
- for (var s = a > 1 ? void 0 : a ? Va(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2603
+ ], ct.prototype, "label", 2);
2604
+ ct = gt([
2605
+ b("baht-sparkline")
2606
+ ], ct);
2607
+ var Va = Object.defineProperty, Ka = Object.getOwnPropertyDescriptor, Y = (t, e, i, a) => {
2608
+ for (var s = a > 1 ? void 0 : a ? Ka(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2609
2609
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
2610
- return a && s && za(e, i, s), s;
2610
+ return a && s && Va(e, i, s), s;
2611
2611
  };
2612
- let z = class extends $ {
2612
+ let K = class extends y {
2613
2613
  constructor() {
2614
2614
  super(...arguments), this.label = "", this.value = 0, this.format = "number", this.currency = "THB", this.delta = null, this.deltaKind = "pct", this.deltaLabel = "", this.upIsGood = !0, this.trend = [], this.size = "md";
2615
2615
  }
@@ -2645,46 +2645,46 @@ let z = class extends $ {
2645
2645
  </div>`;
2646
2646
  }
2647
2647
  };
2648
- J([
2648
+ Y([
2649
2649
  l()
2650
- ], z.prototype, "label", 2);
2651
- J([
2650
+ ], K.prototype, "label", 2);
2651
+ Y([
2652
2652
  l({ type: Number })
2653
- ], z.prototype, "value", 2);
2654
- J([
2653
+ ], K.prototype, "value", 2);
2654
+ Y([
2655
2655
  l()
2656
- ], z.prototype, "format", 2);
2657
- J([
2656
+ ], K.prototype, "format", 2);
2657
+ Y([
2658
2658
  l()
2659
- ], z.prototype, "currency", 2);
2660
- J([
2659
+ ], K.prototype, "currency", 2);
2660
+ Y([
2661
2661
  l({ type: Number })
2662
- ], z.prototype, "delta", 2);
2663
- J([
2662
+ ], K.prototype, "delta", 2);
2663
+ Y([
2664
2664
  l({ attribute: "delta-kind" })
2665
- ], z.prototype, "deltaKind", 2);
2666
- J([
2665
+ ], K.prototype, "deltaKind", 2);
2666
+ Y([
2667
2667
  l({ attribute: "delta-label" })
2668
- ], z.prototype, "deltaLabel", 2);
2669
- J([
2668
+ ], K.prototype, "deltaLabel", 2);
2669
+ Y([
2670
2670
  l({ type: Boolean, attribute: "up-is-good" })
2671
- ], z.prototype, "upIsGood", 2);
2672
- J([
2671
+ ], K.prototype, "upIsGood", 2);
2672
+ Y([
2673
2673
  l({ type: Array })
2674
- ], z.prototype, "trend", 2);
2675
- J([
2674
+ ], K.prototype, "trend", 2);
2675
+ Y([
2676
2676
  l()
2677
- ], z.prototype, "size", 2);
2678
- z = J([
2679
- u("baht-stat")
2680
- ], z);
2681
- var Ka = Object.defineProperty, Ua = Object.getOwnPropertyDescriptor, Mt = (t, e, i, a) => {
2682
- for (var s = a > 1 ? void 0 : a ? Ua(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2677
+ ], K.prototype, "size", 2);
2678
+ K = Y([
2679
+ b("baht-stat")
2680
+ ], K);
2681
+ var Ua = Object.defineProperty, Ha = Object.getOwnPropertyDescriptor, At = (t, e, i, a) => {
2682
+ for (var s = a > 1 ? void 0 : a ? Ha(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2683
2683
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
2684
- return a && s && Ka(e, i, s), s;
2684
+ return a && s && Ua(e, i, s), s;
2685
2685
  };
2686
- const Xe = 6;
2687
- let H = class extends Q {
2686
+ const Ze = 6;
2687
+ let G = class extends tt {
2688
2688
  constructor() {
2689
2689
  super(...arguments), this.groups = [], this.total = null, this.color = "", this.centerLabel = "records", this.otherLabel = "Other";
2690
2690
  }
@@ -2692,18 +2692,18 @@ let H = class extends Q {
2692
2692
  const t = this.hold(this.groups ?? []);
2693
2693
  if (t.length === 0)
2694
2694
  return n`<div class=${this.rootClass("baht-donut-chart")}>${this.renderEmpty()}</div>`;
2695
- const e = Na(t, Xe, this.otherLabel), i = e.reduce((p, f) => p + f.count, 0) || 1, a = this.total ?? t.reduce((p, f) => p + f.count, 0), s = H.R, r = 2 * Math.PI * s, o = e.length > 1 ? H.GAP : 0, c = t.length > Xe;
2696
- let m = 0;
2697
- const g = e.map((p, f) => {
2698
- const k = p.count / i, b = Math.max(0, k * r - o), w = {
2695
+ const e = qa(t, Ze, this.otherLabel), i = e.reduce((p, w) => p + w.count, 0) || 1, a = this.total ?? t.reduce((p, w) => p + w.count, 0), s = G.R, r = 2 * Math.PI * s, o = e.length > 1 ? G.GAP : 0, c = t.length > Ze;
2696
+ let f = 0;
2697
+ const g = e.map((p, w) => {
2698
+ const C = p.count / i, d = Math.max(0, C * r - o), v = {
2699
2699
  ...p,
2700
- frac: k,
2701
- dash: `${b} ${r - b}`,
2702
- offset: -m * r,
2700
+ frac: C,
2701
+ dash: `${d} ${r - d}`,
2702
+ offset: -f * r,
2703
2703
  // the folded tail is grey — never a generated ninth hue
2704
- color: c && f === e.length - 1 ? "var(--baht-chart-muted)" : lt(f, this.color || void 0)
2704
+ color: c && w === e.length - 1 ? "var(--baht-chart-muted)" : nt(w, this.color || void 0)
2705
2705
  };
2706
- return m += k, w;
2706
+ return f += C, v;
2707
2707
  }), _ = `${a} ${this.centerLabel}: ${g.map((p) => `${p.label || "(empty)"} ${p.count} (${Math.round(p.frac * 100)}%)`).join(", ")}`;
2708
2708
  return n`<div class=${this.rootClass("baht-donut-chart")}>
2709
2709
  <svg width="160" height="160" viewBox="0 0 160 160" role="img" aria-label=${_}>
@@ -2738,35 +2738,60 @@ let H = class extends Q {
2738
2738
  </div>`;
2739
2739
  }
2740
2740
  };
2741
- H.R = 54;
2742
- H.GAP = 2;
2743
- Mt([
2741
+ G.R = 54;
2742
+ G.GAP = 2;
2743
+ At([
2744
2744
  l({ attribute: !1 })
2745
- ], H.prototype, "groups", 2);
2746
- Mt([
2745
+ ], G.prototype, "groups", 2);
2746
+ At([
2747
2747
  l({ type: Number })
2748
- ], H.prototype, "total", 2);
2749
- Mt([
2748
+ ], G.prototype, "total", 2);
2749
+ At([
2750
2750
  l()
2751
- ], H.prototype, "color", 2);
2752
- Mt([
2751
+ ], G.prototype, "color", 2);
2752
+ At([
2753
2753
  l({ attribute: "center-label" })
2754
- ], H.prototype, "centerLabel", 2);
2755
- Mt([
2754
+ ], G.prototype, "centerLabel", 2);
2755
+ At([
2756
2756
  l({ attribute: "other-label" })
2757
- ], H.prototype, "otherLabel", 2);
2758
- H = Mt([
2759
- u("baht-donut-chart")
2760
- ], H);
2761
- var Ha = Object.defineProperty, Ga = Object.getOwnPropertyDescriptor, K = (t, e, i, a) => {
2762
- for (var s = a > 1 ? void 0 : a ? Ga(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2757
+ ], G.prototype, "otherLabel", 2);
2758
+ G = At([
2759
+ b("baht-donut-chart")
2760
+ ], G);
2761
+ var Ga = Object.defineProperty, Wa = Object.getOwnPropertyDescriptor, V = (t, e, i, a) => {
2762
+ for (var s = a > 1 ? void 0 : a ? Wa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2763
2763
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
2764
- return a && s && Ha(e, i, s), s;
2764
+ return a && s && Ga(e, i, s), s;
2765
2765
  };
2766
- const Ze = 24;
2767
- let R = class extends Q {
2766
+ const Qe = 24, ts = 2, Ja = 56, Ya = 26;
2767
+ let R = class extends tt {
2768
2768
  constructor() {
2769
- super(...arguments), this.groups = [], this.series = [], this.categories = [], this.orientation = "horizontal", this.stacked = !1, this.compare = [], this.markers = [], this.labelValues = "ends", this.emphasis = null, this.color = "", this.label = "";
2769
+ super(...arguments), this.groups = [], this.series = [], this.categories = [], this.orientation = "horizontal", this.stacked = !1, this.compare = [], this.markers = [], this.labelValues = "ends", this.emphasis = null, this.color = "", this.label = "", this.band = 0;
2770
+ }
2771
+ connectedCallback() {
2772
+ super.connectedCallback(), !(!S() || typeof ResizeObserver > "u") && (this.resizeObserver = new ResizeObserver(() => this.measure()), this.resizeObserver.observe(this));
2773
+ }
2774
+ disconnectedCallback() {
2775
+ var t;
2776
+ (t = this.resizeObserver) == null || t.disconnect(), this.resizeObserver = void 0, super.disconnectedCallback();
2777
+ }
2778
+ firstUpdated() {
2779
+ S() && queueMicrotask(() => this.measure());
2780
+ }
2781
+ /** Host width → px per category. Never runs on the server (`hasDom` guard). */
2782
+ measure() {
2783
+ var r;
2784
+ if (!S() || !this.isConnected || this.orientation !== "vertical") return;
2785
+ const t = this.columnCount;
2786
+ if (t === 0) return;
2787
+ const e = ((r = this.getBoundingClientRect) == null ? void 0 : r.call(this).width) ?? 0;
2788
+ if (!e) return;
2789
+ const a = (Math.max(0, e - Ja) - ts * (t - 1)) / t, s = a > 0 ? Math.floor(a * 100) / 100 : 0;
2790
+ Math.abs(s - this.band) > 0.01 && (this.band = s);
2791
+ }
2792
+ get columnCount() {
2793
+ const t = this.model.series;
2794
+ return t.length === 0 ? 0 : Math.max(...t.map((e) => e.values.length));
2770
2795
  }
2771
2796
  /** The series actually drawn — `groups` is normalised into one series. */
2772
2797
  get model() {
@@ -2782,7 +2807,7 @@ let R = class extends Q {
2782
2807
  }
2783
2808
  colorFor(t, e, i) {
2784
2809
  const a = this.model.series[t];
2785
- return this.emphasis != null && !(i ? t === this.emphasis : e === this.emphasis) ? "var(--baht-chart-muted)" : lt(i ? t : 0, this.color || (a == null ? void 0 : a.color) || void 0);
2810
+ return this.emphasis != null && !(i ? t === this.emphasis : e === this.emphasis) ? "var(--baht-chart-muted)" : nt(i ? t : 0, this.color || (a == null ? void 0 : a.color) || void 0);
2786
2811
  }
2787
2812
  render() {
2788
2813
  const t = this.hold(this.model);
@@ -2792,7 +2817,7 @@ let R = class extends Q {
2792
2817
  domainMax(t, e, i) {
2793
2818
  const a = Math.max(...t.map((c) => c.values.length)), s = Array.from(
2794
2819
  { length: a },
2795
- (c, m) => e ? t.reduce((g, _) => g + (_.values[m] ?? 0), 0) : Math.max(...t.map((g) => g.values[m] ?? 0))
2820
+ (c, f) => e ? t.reduce((g, _) => g + (_.values[f] ?? 0), 0) : Math.max(...t.map((g) => g.values[f] ?? 0))
2796
2821
  ), r = Math.max(
2797
2822
  1,
2798
2823
  ...s,
@@ -2800,7 +2825,7 @@ let R = class extends Q {
2800
2825
  ...(this.markers ?? []).map((c) => c.value)
2801
2826
  );
2802
2827
  if (i) return r;
2803
- const o = Ee(r, 4);
2828
+ const o = Be(r, 4);
2804
2829
  return o[o.length - 1] ?? r;
2805
2830
  }
2806
2831
  tableTwin(t, e, i) {
@@ -2811,12 +2836,12 @@ let R = class extends Q {
2811
2836
  this.label || "Bar chart data",
2812
2837
  a,
2813
2838
  Array.from({ length: i }, (r, o) => {
2814
- var m;
2839
+ var f;
2815
2840
  const c = [
2816
2841
  e[o] || "(empty)",
2817
2842
  ...t.map((g) => this.fmt(g.values[o] ?? 0))
2818
2843
  ];
2819
- return (m = this.compare) != null && m.length && c.push(this.fmt(this.compare[o] ?? 0)), c;
2844
+ return (f = this.compare) != null && f.length && c.push(this.fmt(this.compare[o] ?? 0)), c;
2820
2845
  })
2821
2846
  );
2822
2847
  }
@@ -2835,249 +2860,253 @@ let R = class extends Q {
2835
2860
  );
2836
2861
  }
2837
2862
  renderHorizontal(t) {
2838
- const { series: e, categories: i, legacy: a } = t, s = e.length > 1, r = Math.max(...e.map((p) => p.values.length)), o = this.domainMax(e, this.stacked, a), c = (this.compare ?? []).length > 0, m = (this.stacked ? 1 : e.length) + (c ? 1 : 0), g = Math.min(Ze, Math.max(6, Math.floor(48 / m))), _ = Array.from({ length: r }, (p, f) => {
2839
- const k = i[f] || "(empty)", b = e.reduce((O, At) => O + (At.values[f] ?? 0), 0), w = `${k}: ${e.map((O) => `${O.name ? `${O.name} ` : ""}${this.fmt(O.values[f] ?? 0)}`).join(", ")}${c ? `, previous ${this.fmt(this.compare[f] ?? 0)}` : ""}`, D = e.map((O, At) => ({
2840
- value: O.values[f] ?? 0,
2841
- color: this.colorFor(At, f, s),
2842
- name: O.name
2863
+ const { series: e, categories: i, legacy: a } = t, s = e.length > 1, r = Math.max(...e.map((p) => p.values.length)), o = this.domainMax(e, this.stacked, a), c = (this.compare ?? []).length > 0, f = (this.stacked ? 1 : e.length) + (c ? 1 : 0), g = Math.min(Qe, Math.max(6, Math.floor(48 / f))), _ = Array.from({ length: r }, (p, w) => {
2864
+ const C = i[w] || "(empty)", d = e.reduce((P, q) => P + (q.values[w] ?? 0), 0), v = `${C}: ${e.map((P) => `${P.name ? `${P.name} ` : ""}${this.fmt(P.values[w] ?? 0)}`).join(", ")}${c ? `, previous ${this.fmt(this.compare[w] ?? 0)}` : ""}`, z = e.map((P, q) => ({
2865
+ value: P.values[w] ?? 0,
2866
+ color: this.colorFor(q, w, s),
2867
+ name: P.name
2843
2868
  }));
2844
2869
  return n`<div class="baht-bar-chart-row">
2845
- <span class="baht-bar-chart-label" title=${k}>${k}</span>
2870
+ <span class="baht-bar-chart-label" title=${C}>${C}</span>
2846
2871
  <div
2847
2872
  class="baht-bar-chart-track${this.stacked ? " baht-bar-chart-track--stacked" : ""}"
2848
2873
  tabindex="0"
2849
2874
  role="button"
2850
- aria-label=${w}
2851
- @pointermove=${(O) => this.showTip(O, w)}
2875
+ aria-label=${v}
2876
+ @pointermove=${(P) => this.showTip(P, v)}
2852
2877
  @pointerleave=${() => this.hideTip()}
2853
- @focus=${(O) => this.showTip(O, w)}
2878
+ @focus=${(P) => this.showTip(P, v)}
2854
2879
  @blur=${() => this.hideTip()}
2855
2880
  >
2856
- ${this.markerOverlay(o, k)}
2881
+ ${this.markerOverlay(o, C)}
2857
2882
  <div class="baht-bar-chart-bars">
2858
2883
  ${this.stacked ? n`<div class="baht-bar-chart-stack" style=${`height:${g}px`}>
2859
- ${D.map(
2860
- (O) => n`<div
2884
+ ${z.map(
2885
+ (P) => n`<div
2861
2886
  class="baht-bar-chart-bar baht-bar-chart-bar--segment"
2862
- style=${`width:${Math.max(0, O.value / o * 100)}%;background:${O.color}`}
2887
+ style=${`width:${Math.max(0, P.value / o * 100)}%;background:${P.color}`}
2863
2888
  ></div>`
2864
2889
  )}
2865
- </div>` : D.map(
2866
- (O) => n`<div
2890
+ </div>` : z.map(
2891
+ (P) => n`<div
2867
2892
  class="baht-bar-chart-bar"
2868
- style=${`width:${Math.max(2, O.value / o * 100)}%;height:${g}px;background:${O.color}`}
2893
+ style=${`width:${Math.max(2, P.value / o * 100)}%;height:${g}px;background:${P.color}`}
2869
2894
  ></div>`
2870
2895
  )}
2871
2896
  ${c ? n`<div
2872
2897
  class="baht-bar-chart-bar baht-bar-chart-bar--compare"
2873
- style=${`width:${Math.max(2, (this.compare[f] ?? 0) / o * 100)}%;height:${Math.min(8, g)}px`}
2898
+ style=${`width:${Math.max(2, (this.compare[w] ?? 0) / o * 100)}%;height:${Math.min(8, g)}px`}
2874
2899
  ></div>` : h}
2875
2900
  </div>
2876
2901
  </div>
2877
2902
  ${this.labelValues === "ends" ? n`<span class="baht-bar-chart-count"
2878
- >${a ? e[0].values[f] ?? 0 : this.fmt(this.stacked ? b : e[0].values[f] ?? 0)}</span
2903
+ >${a ? e[0].values[w] ?? 0 : this.fmt(this.stacked ? d : e[0].values[w] ?? 0)}</span
2879
2904
  >` : h}
2880
2905
  </div>`;
2881
2906
  });
2882
2907
  return n`<div class=${this.rootClass("baht-bar-chart")}>
2883
2908
  ${_}
2884
2909
  ${this.renderTooltip()}
2885
- ${this.renderLegend(e.map((p, f) => ({ label: p.name, color: lt(f, p.color) })))}
2910
+ ${this.renderLegend(e.map((p, w) => ({ label: p.name, color: nt(w, p.color) })))}
2886
2911
  ${this.tableTwin(e, i, r)}
2887
2912
  </div>`;
2888
2913
  }
2889
2914
  renderVertical(t) {
2890
- const { series: e, categories: i, legacy: a } = t, s = e.length > 1, r = Math.max(...e.map((f) => f.values.length)), o = this.domainMax(e, this.stacked, a), c = Ee(o, 4), m = (this.compare ?? []).length > 0, g = (this.stacked ? 1 : e.length) + (m ? 1 : 0), _ = Math.min(Ze, Math.max(4, Math.floor(48 / g))), p = this.label || `Column chart, ${r} categories. ${i.map((f, k) => `${f} ${this.fmt(e[0].values[k] ?? 0)}`).join(", ")}`;
2915
+ const { series: e, categories: i, legacy: a } = t, s = e.length > 1, r = Math.max(...e.map((d) => d.values.length)), o = this.domainMax(e, this.stacked, a), c = Be(o, 4), f = (this.compare ?? []).length > 0, g = (this.stacked ? 1 : e.length) + (f ? 1 : 0), _ = this.band > 0 ? (this.band - ts) / g : 48 / g, p = Math.min(Qe, Math.max(2, Math.floor(_))), w = this.band > 0 ? Math.max(1, Math.ceil(Ya / Math.max(1, this.band))) : Math.max(1, Math.ceil(r / 12)), C = this.label || `Column chart, ${r} categories. ${i.map((d, v) => `${d} ${this.fmt(e[0].values[v] ?? 0)}`).join(", ")}`;
2891
2916
  return n`<div class=${this.rootClass("baht-bar-chart baht-bar-chart--vertical")}>
2892
- <div class="baht-bar-chart-plot" role="img" aria-label=${p}>
2917
+ <div class="baht-bar-chart-plot" role="img" aria-label=${C}>
2893
2918
  <div class="baht-bar-chart-yaxis" aria-hidden="true">
2894
- ${[...c].reverse().map((f) => n`<span class="baht-chart-tick-text">${this.fmt(f)}</span>`)}
2919
+ ${[...c].reverse().map((d) => n`<span class="baht-chart-tick-text">${this.fmt(d)}</span>`)}
2895
2920
  </div>
2896
2921
  <div class="baht-bar-chart-grid">
2897
- ${(this.markers ?? []).filter((f) => !f.category).map(
2898
- (f) => n`<span
2922
+ ${(this.markers ?? []).filter((d) => !d.category).map(
2923
+ (d) => n`<span
2899
2924
  class="baht-bar-chart-marker baht-bar-chart-marker--horizontal"
2900
- style=${`bottom:${Math.min(100, f.value / o * 100).toFixed(2)}%`}
2901
- title=${f.label ?? this.fmt(f.value)}
2925
+ style=${`bottom:${Math.min(100, d.value / o * 100).toFixed(2)}%`}
2926
+ title=${d.label ?? this.fmt(d.value)}
2902
2927
  aria-hidden="true"
2903
2928
  ></span>`
2904
2929
  )}
2905
2930
  ${[...c].reverse().map(() => n`<span class="baht-chart-grid-rule" aria-hidden="true"></span>`)}
2906
2931
  <div class="baht-bar-chart-columns">
2907
- ${Array.from({ length: r }, (f, k) => {
2908
- const b = i[k] || "(empty)", w = `${b}: ${e.map((D) => `${D.name ? `${D.name} ` : ""}${this.fmt(D.values[k] ?? 0)}`).join(", ")}`;
2932
+ ${Array.from({ length: r }, (d, v) => {
2933
+ const z = i[v] || "(empty)", P = `${z}: ${e.map((q) => `${q.name ? `${q.name} ` : ""}${this.fmt(q.values[v] ?? 0)}`).join(", ")}`;
2909
2934
  return n`<div
2910
2935
  class="baht-bar-chart-column"
2936
+ style=${this.band > 0 ? `flex:0 0 auto;width:${this.band}px` : h}
2911
2937
  tabindex="0"
2912
2938
  role="button"
2913
- aria-label=${w}
2914
- @pointermove=${(D) => this.showTip(D, w)}
2939
+ aria-label=${P}
2940
+ @pointermove=${(q) => this.showTip(q, P)}
2915
2941
  @pointerleave=${() => this.hideTip()}
2916
- @focus=${(D) => this.showTip(D, w)}
2942
+ @focus=${(q) => this.showTip(q, P)}
2917
2943
  @blur=${() => this.hideTip()}
2918
2944
  >
2919
2945
  <div class="baht-bar-chart-column-bars">
2920
2946
  ${e.map(
2921
- (D, O) => n`<div
2947
+ (q, ve) => n`<div
2922
2948
  class="baht-bar-chart-col"
2923
- style=${`height:${Math.max(1, (D.values[k] ?? 0) / o * 100)}%;width:${_}px;background:${this.colorFor(O, k, s)}`}
2949
+ style=${`height:${Math.max(1, (q.values[v] ?? 0) / o * 100)}%;width:${p}px;background:${this.colorFor(ve, v, s)}`}
2924
2950
  ></div>`
2925
2951
  )}
2926
- ${m ? n`<div
2952
+ ${f ? n`<div
2927
2953
  class="baht-bar-chart-col baht-bar-chart-col--compare"
2928
- style=${`height:${Math.max(1, (this.compare[k] ?? 0) / o * 100)}%;width:${Math.min(8, _)}px`}
2954
+ style=${`height:${Math.max(1, (this.compare[v] ?? 0) / o * 100)}%;width:${Math.min(8, p)}px`}
2929
2955
  ></div>` : h}
2930
2956
  </div>
2931
- <span class="baht-bar-chart-xlabel">${b}</span>
2957
+ ${v % w === 0 ? n`<span class="baht-bar-chart-xlabel">${z}</span>` : h}
2932
2958
  </div>`;
2933
2959
  })}
2934
2960
  </div>
2935
2961
  </div>
2936
2962
  </div>
2937
2963
  ${this.renderTooltip()}
2938
- ${this.renderLegend(e.map((f, k) => ({ label: f.name, color: lt(k, f.color) })))}
2964
+ ${this.renderLegend(e.map((d, v) => ({ label: d.name, color: nt(v, d.color) })))}
2939
2965
  ${this.tableTwin(e, i, r)}
2940
2966
  </div>`;
2941
2967
  }
2942
2968
  };
2943
- K([
2969
+ V([
2944
2970
  l({ attribute: !1 })
2945
2971
  ], R.prototype, "groups", 2);
2946
- K([
2972
+ V([
2947
2973
  l({ attribute: !1 })
2948
2974
  ], R.prototype, "series", 2);
2949
- K([
2975
+ V([
2950
2976
  l({ attribute: !1 })
2951
2977
  ], R.prototype, "categories", 2);
2952
- K([
2978
+ V([
2953
2979
  l()
2954
2980
  ], R.prototype, "orientation", 2);
2955
- K([
2981
+ V([
2956
2982
  l({ type: Boolean })
2957
2983
  ], R.prototype, "stacked", 2);
2958
- K([
2984
+ V([
2959
2985
  l({ attribute: !1 })
2960
2986
  ], R.prototype, "compare", 2);
2961
- K([
2987
+ V([
2962
2988
  l({ attribute: !1 })
2963
2989
  ], R.prototype, "markers", 2);
2964
- K([
2990
+ V([
2965
2991
  l({ attribute: "label-values" })
2966
2992
  ], R.prototype, "labelValues", 2);
2967
- K([
2993
+ V([
2968
2994
  l({ type: Number })
2969
2995
  ], R.prototype, "emphasis", 2);
2970
- K([
2996
+ V([
2971
2997
  l()
2972
2998
  ], R.prototype, "color", 2);
2973
- K([
2999
+ V([
2974
3000
  l()
2975
3001
  ], R.prototype, "label", 2);
2976
- R = K([
2977
- u("baht-bar-chart")
3002
+ V([
3003
+ $()
3004
+ ], R.prototype, "band", 2);
3005
+ R = V([
3006
+ b("baht-bar-chart")
2978
3007
  ], R);
2979
- var Wa = Object.defineProperty, Ja = Object.getOwnPropertyDescriptor, ot = (t, e, i, a) => {
2980
- for (var s = a > 1 ? void 0 : a ? Ja(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3008
+ var Xa = Object.defineProperty, Za = Object.getOwnPropertyDescriptor, lt = (t, e, i, a) => {
3009
+ for (var s = a > 1 ? void 0 : a ? Za(e, i) : e, r = t.length - 1, o; r >= 0; r--)
2981
3010
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
2982
- return a && s && Wa(e, i, s), s;
3011
+ return a && s && Xa(e, i, s), s;
2983
3012
  };
2984
- const Qe = 640, we = 260, B = { top: 14, right: 72, bottom: 30, left: 60 };
2985
- let Z = class extends Q {
3013
+ const es = 640, xe = 260, E = { top: 14, right: 72, bottom: 30, left: 60 };
3014
+ let Q = class extends tt {
2986
3015
  constructor() {
2987
3016
  super(...arguments), this.series = [], this.categories = [], this.area = !1, this.markers = [], this.forecast = 0, this.baseline = null, this.labelValues = "ends", this.label = "", this.crosshairAt = null;
2988
3017
  }
2989
3018
  get plot() {
2990
- return { w: Qe - B.left - B.right, h: we - B.top - B.bottom };
3019
+ return { w: es - E.left - E.right, h: xe - E.top - E.bottom };
2991
3020
  }
2992
3021
  render() {
2993
3022
  const t = this.hold({
2994
- series: (this.series ?? []).filter((d) => {
3023
+ series: (this.series ?? []).filter((u) => {
2995
3024
  var x;
2996
- return d && ((x = d.values) == null ? void 0 : x.length);
3025
+ return u && ((x = u.values) == null ? void 0 : x.length);
2997
3026
  }),
2998
3027
  categories: this.categories ?? []
2999
3028
  }), { series: e, categories: i } = t;
3000
3029
  if (e.length === 0)
3001
3030
  return n`<div class=${this.rootClass("baht-line-chart")}>${this.renderEmpty()}</div>`;
3002
- const a = Math.max(...e.map((d) => d.values.length)), s = e.flatMap((d) => d.values).filter((d) => Number.isFinite(d)), r = Math.max(0, ...s, ...(this.markers ?? []).map((d) => d.value)), o = Ee(r, 4), c = o[o.length - 1] ?? 1, { w: m, h: g } = this.plot, _ = le([0, Math.max(1, a - 1)], [B.left, B.left + m]), p = le([0, c], [B.top + g, B.top]), f = Math.max(0, a - 1 - Math.max(0, this.forecast)), k = (d, x, X) => d.slice(x, X + 1).map((et, st) => `${st === 0 ? "M" : "L"}${_(x + st).toFixed(2)},${p(et).toFixed(2)}`).join(" "), b = e.map((d, x) => ({
3031
+ const a = Math.max(...e.map((u) => u.values.length)), s = e.flatMap((u) => u.values).filter((u) => Number.isFinite(u)), r = Math.max(0, ...s, ...(this.markers ?? []).map((u) => u.value)), o = Be(r, 4), c = o[o.length - 1] ?? 1, { w: f, h: g } = this.plot, _ = le([0, Math.max(1, a - 1)], [E.left, E.left + f]), p = le([0, c], [E.top + g, E.top]), w = Math.max(0, a - 1 - Math.max(0, this.forecast)), C = (u, x, Z) => u.slice(x, Z + 1).map((st, at) => `${at === 0 ? "M" : "L"}${_(x + at).toFixed(2)},${p(st).toFixed(2)}`).join(" "), d = e.map((u, x) => ({
3003
3032
  i: x,
3004
- name: d.name,
3005
- value: d.values[d.values.length - 1] ?? 0,
3006
- yPos: p(d.values[d.values.length - 1] ?? 0),
3007
- color: lt(x, d.color)
3008
- })), w = [...b].sort((d, x) => d.yPos - x.yPos), D = w.some((d, x) => x > 0 && d.yPos - w[x - 1].yPos < 15), O = this.labelValues === "ends" && !D, At = Math.max(1, Math.ceil(a / 8)), cs = this.label || `Line chart, ${e.length} series over ${a} points. ${e.map((d, x) => `${d.name}: ${this.fmt(b[x].value)} at the end`).join(". ")}`;
3033
+ name: u.name,
3034
+ value: u.values[u.values.length - 1] ?? 0,
3035
+ yPos: p(u.values[u.values.length - 1] ?? 0),
3036
+ color: nt(x, u.color)
3037
+ })), v = [...d].sort((u, x) => u.yPos - x.yPos), z = v.some((u, x) => x > 0 && u.yPos - v[x - 1].yPos < 15), P = this.labelValues === "ends" && !z, q = Math.max(1, Math.ceil(a / 8)), ve = this.label || `Line chart, ${e.length} series over ${a} points. ${e.map((u, x) => `${u.name}: ${this.fmt(d[x].value)} at the end`).join(". ")}`;
3009
3038
  return n`<div class=${this.rootClass("baht-line-chart")}>
3010
3039
  <svg
3011
3040
  class="baht-chart-svg"
3012
- viewBox="0 0 ${Qe} ${we}"
3041
+ viewBox="0 0 ${es} ${xe}"
3013
3042
  preserveAspectRatio="xMidYMid meet"
3014
3043
  role="img"
3015
- aria-label=${cs}
3044
+ aria-label=${ve}
3016
3045
  >
3017
3046
  ${o.map(
3018
- (d) => A`
3019
- <line class="baht-chart-grid-line" x1=${B.left} x2=${B.left + m}
3020
- y1=${p(d).toFixed(2)} y2=${p(d).toFixed(2)}/>
3021
- <text class="baht-chart-tick" x=${B.left - 8} y=${(p(d) + 4).toFixed(2)}
3022
- text-anchor="end">${this.fmt(d)}</text>`
3047
+ (u) => A`
3048
+ <line class="baht-chart-grid-line" x1=${E.left} x2=${E.left + f}
3049
+ y1=${p(u).toFixed(2)} y2=${p(u).toFixed(2)}/>
3050
+ <text class="baht-chart-tick" x=${E.left - 8} y=${(p(u) + 4).toFixed(2)}
3051
+ text-anchor="end">${this.fmt(u)}</text>`
3023
3052
  )}
3024
3053
  ${this.baseline != null ? [
3025
- A`<line class="baht-chart-baseline" x1=${B.left} x2=${B.left + m}
3054
+ A`<line class="baht-chart-baseline" x1=${E.left} x2=${E.left + f}
3026
3055
  y1=${p(this.baseline).toFixed(2)} y2=${p(this.baseline).toFixed(2)}/>`
3027
3056
  ] : []}
3028
3057
  ${(this.markers ?? []).map(
3029
- (d) => A`
3030
- <line class="baht-chart-marker-line" x1=${B.left} x2=${B.left + m}
3031
- y1=${p(d.value).toFixed(2)} y2=${p(d.value).toFixed(2)}/>
3032
- <text class="baht-chart-marker-label" x=${B.left + m} y=${(p(d.value) - 5).toFixed(2)}
3033
- text-anchor="end">${d.label ?? this.fmt(d.value)}</text>`
3058
+ (u) => A`
3059
+ <line class="baht-chart-marker-line" x1=${E.left} x2=${E.left + f}
3060
+ y1=${p(u.value).toFixed(2)} y2=${p(u.value).toFixed(2)}/>
3061
+ <text class="baht-chart-marker-label" x=${E.left + f} y=${(p(u.value) - 5).toFixed(2)}
3062
+ text-anchor="end">${u.label ?? this.fmt(u.value)}</text>`
3034
3063
  )}
3035
- ${this.area && e.length === 1 ? A`<path class="baht-chart-area" fill=${lt(0, e[0].color)}
3036
- d=${`${k(e[0].values, 0, a - 1)} L${_(a - 1).toFixed(2)},${p(0).toFixed(2)} L${_(0).toFixed(2)},${p(0).toFixed(2)} Z`}/>` : h}
3037
- ${e.map((d, x) => {
3038
- const X = lt(x, d.color), et = [
3039
- A`<path class="baht-chart-line" d=${k(d.values, 0, f)} stroke=${X} fill="none"/>`
3064
+ ${this.area && e.length === 1 ? A`<path class="baht-chart-area" fill=${nt(0, e[0].color)}
3065
+ d=${`${C(e[0].values, 0, a - 1)} L${_(a - 1).toFixed(2)},${p(0).toFixed(2)} L${_(0).toFixed(2)},${p(0).toFixed(2)} Z`}/>` : h}
3066
+ ${e.map((u, x) => {
3067
+ const Z = nt(x, u.color), st = [
3068
+ A`<path class="baht-chart-line" d=${C(u.values, 0, w)} stroke=${Z} fill="none"/>`
3040
3069
  ];
3041
- return f < a - 1 && et.push(
3042
- A`<path class="baht-chart-line baht-chart-line--forecast" d=${k(d.values, f, a - 1)}
3043
- stroke=${X} fill="none"/>`
3044
- ), et.push(
3070
+ return w < a - 1 && st.push(
3071
+ A`<path class="baht-chart-line baht-chart-line--forecast" d=${C(u.values, w, a - 1)}
3072
+ stroke=${Z} fill="none"/>`
3073
+ ), st.push(
3045
3074
  A`<circle class="baht-chart-end-dot" cx=${_(a - 1).toFixed(2)}
3046
- cy=${p(d.values[d.values.length - 1] ?? 0).toFixed(2)} r="4" fill=${X}/>`
3047
- ), et;
3075
+ cy=${p(u.values[u.values.length - 1] ?? 0).toFixed(2)} r="4" fill=${Z}/>`
3076
+ ), st;
3048
3077
  })}
3049
- ${O ? b.map(
3050
- (d) => A`
3051
- <text class="baht-chart-end-label" x=${_(a - 1) + 10} y=${(d.yPos + 4).toFixed(2)}
3052
- text-anchor="start">${this.fmt(d.value)}</text>`
3078
+ ${P ? d.map(
3079
+ (u) => A`
3080
+ <text class="baht-chart-end-label" x=${_(a - 1) + 10} y=${(u.yPos + 4).toFixed(2)}
3081
+ text-anchor="start">${this.fmt(u.value)}</text>`
3053
3082
  ) : h}
3054
3083
  ${i.map(
3055
- (d, x) => x % At === 0 ? A`<text class="baht-chart-tick" x=${_(x).toFixed(2)} y=${we - 10} text-anchor="middle">${d}</text>` : h
3084
+ (u, x) => x % q === 0 ? A`<text class="baht-chart-tick" x=${_(x).toFixed(2)} y=${xe - 10} text-anchor="middle">${u}</text>` : h
3056
3085
  )}
3057
- ${Array.from({ length: a }, (d, x) => {
3058
- const X = m / Math.max(1, a - 1), et = `${i[x] ?? `Point ${x + 1}`}: ${e.map((st) => `${st.name} ${this.fmt(st.values[x] ?? 0)}`).join(", ")}`;
3059
- return A`<rect class="baht-chart-hit" x=${(_(x) - X / 2).toFixed(2)} y=${B.top}
3060
- width=${Math.max(24, X).toFixed(2)} height=${g} tabindex="0" role="button"
3061
- aria-label=${et}
3062
- @pointermove=${(st) => this.onHover(st, x, et)}
3086
+ ${Array.from({ length: a }, (u, x) => {
3087
+ const Z = f / Math.max(1, a - 1), st = `${i[x] ?? `Point ${x + 1}`}: ${e.map((at) => `${at.name} ${this.fmt(at.values[x] ?? 0)}`).join(", ")}`;
3088
+ return A`<rect class="baht-chart-hit" x=${(_(x) - Z / 2).toFixed(2)} y=${E.top}
3089
+ width=${Math.max(24, Z).toFixed(2)} height=${g} tabindex="0" role="button"
3090
+ aria-label=${st}
3091
+ @pointermove=${(at) => this.onHover(at, x, st)}
3063
3092
  @pointerleave=${() => this.onLeave()}
3064
- @focus=${(st) => this.onHover(st, x, et)}
3093
+ @focus=${(at) => this.onHover(at, x, st)}
3065
3094
  @blur=${() => this.onLeave()}/>`;
3066
3095
  })}
3067
3096
  ${this.crosshairAt != null ? A`<line class="baht-chart-crosshair" x1=${_(this.crosshairAt).toFixed(2)}
3068
- x2=${_(this.crosshairAt).toFixed(2)} y1=${B.top} y2=${B.top + g}/>` : h}
3097
+ x2=${_(this.crosshairAt).toFixed(2)} y1=${E.top} y2=${E.top + g}/>` : h}
3069
3098
  </svg>
3070
3099
  ${this.renderTooltip()}
3071
3100
  ${this.renderLegend(
3072
- e.map((d, x) => ({ label: d.name, color: lt(x, d.color) })),
3101
+ e.map((u, x) => ({ label: u.name, color: nt(x, u.color) })),
3073
3102
  "line"
3074
3103
  )}
3075
3104
  ${this.showTable ? be(
3076
3105
  this.label || "Line chart data",
3077
- ["Point", ...e.map((d) => d.name)],
3078
- Array.from({ length: a }, (d, x) => [
3106
+ ["Point", ...e.map((u) => u.name)],
3107
+ Array.from({ length: a }, (u, x) => [
3079
3108
  i[x] ?? `Point ${x + 1}`,
3080
- ...e.map((X) => this.fmt(X.values[x] ?? 0))
3109
+ ...e.map((Z) => this.fmt(Z.values[x] ?? 0))
3081
3110
  ])
3082
3111
  ) : h}
3083
3112
  </div>`;
@@ -3089,85 +3118,85 @@ let Z = class extends Q {
3089
3118
  this.crosshairAt = null, this.requestUpdate(), this.hideTip();
3090
3119
  }
3091
3120
  };
3092
- ot([
3121
+ lt([
3093
3122
  l({ attribute: !1 })
3094
- ], Z.prototype, "series", 2);
3095
- ot([
3123
+ ], Q.prototype, "series", 2);
3124
+ lt([
3096
3125
  l({ attribute: !1 })
3097
- ], Z.prototype, "categories", 2);
3098
- ot([
3126
+ ], Q.prototype, "categories", 2);
3127
+ lt([
3099
3128
  l({ type: Boolean })
3100
- ], Z.prototype, "area", 2);
3101
- ot([
3129
+ ], Q.prototype, "area", 2);
3130
+ lt([
3102
3131
  l({ attribute: !1 })
3103
- ], Z.prototype, "markers", 2);
3104
- ot([
3132
+ ], Q.prototype, "markers", 2);
3133
+ lt([
3105
3134
  l({ type: Number })
3106
- ], Z.prototype, "forecast", 2);
3107
- ot([
3135
+ ], Q.prototype, "forecast", 2);
3136
+ lt([
3108
3137
  l({ type: Number })
3109
- ], Z.prototype, "baseline", 2);
3110
- ot([
3138
+ ], Q.prototype, "baseline", 2);
3139
+ lt([
3111
3140
  l({ attribute: "label-values" })
3112
- ], Z.prototype, "labelValues", 2);
3113
- ot([
3141
+ ], Q.prototype, "labelValues", 2);
3142
+ lt([
3114
3143
  l()
3115
- ], Z.prototype, "label", 2);
3116
- Z = ot([
3117
- u("baht-line-chart")
3118
- ], Z);
3119
- var Ya = Object.defineProperty, Xa = Object.getOwnPropertyDescriptor, gt = (t, e, i, a) => {
3120
- for (var s = a > 1 ? void 0 : a ? Xa(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3144
+ ], Q.prototype, "label", 2);
3145
+ Q = lt([
3146
+ b("baht-line-chart")
3147
+ ], Q);
3148
+ var Qa = Object.defineProperty, ti = Object.getOwnPropertyDescriptor, wt = (t, e, i, a) => {
3149
+ for (var s = a > 1 ? void 0 : a ? ti(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3121
3150
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
3122
- return a && s && Ya(e, i, s), s;
3151
+ return a && s && Qa(e, i, s), s;
3123
3152
  };
3124
- const xe = 22, Nt = 24, ts = 34, _e = 18, Za = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
3125
- function ke(t) {
3153
+ const _e = 22, Nt = 24, ss = 34, ke = 18, ei = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
3154
+ function Pe(t) {
3126
3155
  const e = /^(\d{4})-(\d{2})-(\d{2})/.exec(t ?? "");
3127
3156
  return e ? new Date(Date.UTC(+e[1], +e[2] - 1, +e[3])) : null;
3128
3157
  }
3129
- function Pe(t) {
3158
+ function Oe(t) {
3130
3159
  return t.toISOString().slice(0, 10);
3131
3160
  }
3132
- let ct = class extends Q {
3161
+ let pt = class extends tt {
3133
3162
  constructor() {
3134
3163
  super(...arguments), this.values = [], this.from = "", this.to = "", this.lessLabel = "Less", this.moreLabel = "More", this.label = "";
3135
3164
  }
3136
3165
  get range() {
3137
- const t = (this.values ?? []).map((a) => ke(a.date)).filter((a) => !!a), e = ke(this.from) ?? (t.length ? new Date(Math.min(...t.map((a) => +a))) : null), i = ke(this.to) ?? (t.length ? new Date(Math.max(...t.map((a) => +a))) : null);
3166
+ const t = (this.values ?? []).map((a) => Pe(a.date)).filter((a) => !!a), e = Pe(this.from) ?? (t.length ? new Date(Math.min(...t.map((a) => +a))) : null), i = Pe(this.to) ?? (t.length ? new Date(Math.max(...t.map((a) => +a))) : null);
3138
3167
  return !e || !i || +i < +e ? null : { start: e, end: i };
3139
3168
  }
3140
3169
  render() {
3141
3170
  const t = this.hold({ values: this.values ?? [], range: this.range }), e = t.range;
3142
3171
  if (!e || t.values.length === 0)
3143
3172
  return n`<div class=${this.rootClass("baht-heatmap")}>${this.renderEmpty()}</div>`;
3144
- const i = new Map(t.values.map((b) => [b.date.slice(0, 10), b.value])), a = [], s = new Date(e.start), r = (e.start.getUTCDay() + 6) % 7;
3173
+ const i = new Map(t.values.map((d) => [d.date.slice(0, 10), d.value])), a = [], s = new Date(e.start), r = (e.start.getUTCDay() + 6) % 7;
3145
3174
  let o = 0;
3146
3175
  for (; +s <= +e.end; ) {
3147
- const b = Pe(s), w = (s.getUTCDay() + 6) % 7, D = Math.floor((r + o) / 7);
3148
- a.push({ iso: b, value: i.has(b) ? i.get(b) : null, col: D, row: w }), s.setUTCDate(s.getUTCDate() + 1), o += 1;
3176
+ const d = Oe(s), v = (s.getUTCDay() + 6) % 7, z = Math.floor((r + o) / 7);
3177
+ a.push({ iso: d, value: i.has(d) ? i.get(d) : null, col: z, row: v }), s.setUTCDate(s.getUTCDate() + 1), o += 1;
3149
3178
  }
3150
- const c = Math.max(1, ...a.map((b) => b.col + 1)), m = ts + c * Nt, g = _e + 7 * Nt + 4, _ = Math.max(1, ...a.map((b) => b.value ?? 0)), p = (b) => Math.min(4, Math.max(0, Math.ceil(b / _ * 5) - 1)), f = a.reduce((b, w) => b + (w.value ?? 0), 0), k = this.label || `Calendar heatmap, ${a.length} days from ${Pe(e.start)} to ${Pe(e.end)}, total ${this.fmt(f)}`;
3179
+ const c = Math.max(1, ...a.map((d) => d.col + 1)), f = ss + c * Nt, g = ke + 7 * Nt + 4, _ = Math.max(1, ...a.map((d) => d.value ?? 0)), p = (d) => Math.min(4, Math.max(0, Math.ceil(d / _ * 5) - 1)), w = a.reduce((d, v) => d + (v.value ?? 0), 0), C = this.label || `Calendar heatmap, ${a.length} days from ${Oe(e.start)} to ${Oe(e.end)}, total ${this.fmt(w)}`;
3151
3180
  return n`<div class=${this.rootClass("baht-heatmap")}>
3152
3181
  <svg
3153
3182
  class="baht-chart-svg baht-heatmap-svg"
3154
- width=${m}
3183
+ width=${f}
3155
3184
  height=${g}
3156
- viewBox="0 0 ${m} ${g}"
3185
+ viewBox="0 0 ${f} ${g}"
3157
3186
  preserveAspectRatio="xMinYMin meet"
3158
3187
  role="img"
3159
- aria-label=${k}
3188
+ aria-label=${C}
3160
3189
  >
3161
- ${Za.map(
3162
- (b, w) => w % 2 === 0 ? A`<text class="baht-chart-tick" x="0" y=${_e + w * Nt + xe / 2 + 4}>${b}</text>` : h
3190
+ ${ei.map(
3191
+ (d, v) => v % 2 === 0 ? A`<text class="baht-chart-tick" x="0" y=${ke + v * Nt + _e / 2 + 4}>${d}</text>` : h
3163
3192
  )}
3164
- ${a.map((b) => {
3165
- const w = b.value == null ? `${b.iso}: no activity` : `${b.iso}: ${this.fmt(b.value)}`, D = b.value == null || b.value <= 0 ? "var(--baht-chart-grid)" : Ye(p(b.value));
3166
- return A`<rect class="baht-heatmap-cell" x=${ts + b.col * Nt} y=${_e + b.row * Nt}
3167
- width=${xe} height=${xe} rx="3" fill=${D} tabindex="0" role="button" aria-label=${w}
3168
- @pointermove=${(O) => this.showTip(O, w)}
3193
+ ${a.map((d) => {
3194
+ const v = d.value == null ? `${d.iso}: no activity` : `${d.iso}: ${this.fmt(d.value)}`, z = d.value == null || d.value <= 0 ? "var(--baht-chart-grid)" : Xe(p(d.value));
3195
+ return A`<rect class="baht-heatmap-cell" x=${ss + d.col * Nt} y=${ke + d.row * Nt}
3196
+ width=${_e} height=${_e} rx="3" fill=${z} tabindex="0" role="button" aria-label=${v}
3197
+ @pointermove=${(P) => this.showTip(P, v)}
3169
3198
  @pointerleave=${() => this.hideTip()}
3170
- @focus=${(O) => this.showTip(O, w)}
3199
+ @focus=${(P) => this.showTip(P, v)}
3171
3200
  @blur=${() => this.hideTip()}/>`;
3172
3201
  })}
3173
3202
  </svg>
@@ -3175,9 +3204,9 @@ let ct = class extends Q {
3175
3204
  <div class="baht-heatmap-scale">
3176
3205
  <span class="baht-heatmap-scale-label">${this.lessLabel}</span>
3177
3206
  ${[0, 1, 2, 3, 4].map(
3178
- (b) => n`<span
3207
+ (d) => n`<span
3179
3208
  class="baht-chart-swatch"
3180
- style=${`background:${Ye(b)}`}
3209
+ style=${`background:${Xe(d)}`}
3181
3210
  aria-hidden="true"
3182
3211
  ></span>`
3183
3212
  )}
@@ -3186,38 +3215,38 @@ let ct = class extends Q {
3186
3215
  ${this.showTable ? be(
3187
3216
  this.label || "Calendar heatmap data",
3188
3217
  ["Date", "Value"],
3189
- a.map((b) => [b.iso, b.value == null ? "—" : this.fmt(b.value)])
3218
+ a.map((d) => [d.iso, d.value == null ? "—" : this.fmt(d.value)])
3190
3219
  ) : h}
3191
3220
  </div>`;
3192
3221
  }
3193
3222
  };
3194
- gt([
3223
+ wt([
3195
3224
  l({ attribute: !1 })
3196
- ], ct.prototype, "values", 2);
3197
- gt([
3225
+ ], pt.prototype, "values", 2);
3226
+ wt([
3198
3227
  l()
3199
- ], ct.prototype, "from", 2);
3200
- gt([
3228
+ ], pt.prototype, "from", 2);
3229
+ wt([
3201
3230
  l()
3202
- ], ct.prototype, "to", 2);
3203
- gt([
3231
+ ], pt.prototype, "to", 2);
3232
+ wt([
3204
3233
  l({ attribute: "less-label" })
3205
- ], ct.prototype, "lessLabel", 2);
3206
- gt([
3234
+ ], pt.prototype, "lessLabel", 2);
3235
+ wt([
3207
3236
  l({ attribute: "more-label" })
3208
- ], ct.prototype, "moreLabel", 2);
3209
- gt([
3237
+ ], pt.prototype, "moreLabel", 2);
3238
+ wt([
3210
3239
  l()
3211
- ], ct.prototype, "label", 2);
3212
- ct = gt([
3213
- u("baht-heatmap")
3214
- ], ct);
3215
- var Qa = Object.defineProperty, ti = Object.getOwnPropertyDescriptor, tt = (t, e, i, a) => {
3216
- for (var s = a > 1 ? void 0 : a ? ti(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3240
+ ], pt.prototype, "label", 2);
3241
+ pt = wt([
3242
+ b("baht-heatmap")
3243
+ ], pt);
3244
+ var si = Object.defineProperty, ai = Object.getOwnPropertyDescriptor, et = (t, e, i, a) => {
3245
+ for (var s = a > 1 ? void 0 : a ? ai(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3217
3246
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
3218
- return a && s && Qa(e, i, s), s;
3247
+ return a && s && si(e, i, s), s;
3219
3248
  };
3220
- let G = class extends $ {
3249
+ let W = class extends y {
3221
3250
  constructor() {
3222
3251
  super(...arguments), this.value = 0, this.max = 100, this.label = "", this.format = "number", this.currency = "THB", this.thresholds = { warning: 0.8, danger: 1 }, this.expected = null, this.overLabel = "Over budget", this.nearLabel = "Near limit";
3223
3252
  }
@@ -3265,42 +3294,42 @@ let G = class extends $ {
3265
3294
  </div>`;
3266
3295
  }
3267
3296
  };
3268
- tt([
3297
+ et([
3269
3298
  l({ type: Number })
3270
- ], G.prototype, "value", 2);
3271
- tt([
3299
+ ], W.prototype, "value", 2);
3300
+ et([
3272
3301
  l({ type: Number })
3273
- ], G.prototype, "max", 2);
3274
- tt([
3302
+ ], W.prototype, "max", 2);
3303
+ et([
3275
3304
  l()
3276
- ], G.prototype, "label", 2);
3277
- tt([
3305
+ ], W.prototype, "label", 2);
3306
+ et([
3278
3307
  l()
3279
- ], G.prototype, "format", 2);
3280
- tt([
3308
+ ], W.prototype, "format", 2);
3309
+ et([
3281
3310
  l()
3282
- ], G.prototype, "currency", 2);
3283
- tt([
3311
+ ], W.prototype, "currency", 2);
3312
+ et([
3284
3313
  l({ attribute: !1 })
3285
- ], G.prototype, "thresholds", 2);
3286
- tt([
3314
+ ], W.prototype, "thresholds", 2);
3315
+ et([
3287
3316
  l({ type: Number })
3288
- ], G.prototype, "expected", 2);
3289
- tt([
3317
+ ], W.prototype, "expected", 2);
3318
+ et([
3290
3319
  l({ attribute: "over-label" })
3291
- ], G.prototype, "overLabel", 2);
3292
- tt([
3320
+ ], W.prototype, "overLabel", 2);
3321
+ et([
3293
3322
  l({ attribute: "near-label" })
3294
- ], G.prototype, "nearLabel", 2);
3295
- G = tt([
3296
- u("baht-meter")
3297
- ], G);
3298
- var ei = Object.defineProperty, si = Object.getOwnPropertyDescriptor, fe = (t, e, i, a) => {
3299
- for (var s = a > 1 ? void 0 : a ? si(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3323
+ ], W.prototype, "nearLabel", 2);
3324
+ W = et([
3325
+ b("baht-meter")
3326
+ ], W);
3327
+ var ii = Object.defineProperty, ri = Object.getOwnPropertyDescriptor, fe = (t, e, i, a) => {
3328
+ for (var s = a > 1 ? void 0 : a ? ri(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3300
3329
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
3301
- return a && s && ei(e, i, s), s;
3330
+ return a && s && ii(e, i, s), s;
3302
3331
  };
3303
- let Ht = class extends $ {
3332
+ let Ht = class extends y {
3304
3333
  constructor() {
3305
3334
  super(...arguments), this.icon = "🗂️", this.message = "Nothing to display", this.hint = "";
3306
3335
  }
@@ -3322,14 +3351,14 @@ fe([
3322
3351
  l()
3323
3352
  ], Ht.prototype, "hint", 2);
3324
3353
  Ht = fe([
3325
- u("baht-empty-state")
3354
+ b("baht-empty-state")
3326
3355
  ], Ht);
3327
- var ai = Object.defineProperty, ii = Object.getOwnPropertyDescriptor, Qt = (t, e, i, a) => {
3328
- for (var s = a > 1 ? void 0 : a ? ii(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3356
+ var oi = Object.defineProperty, li = Object.getOwnPropertyDescriptor, Qt = (t, e, i, a) => {
3357
+ for (var s = a > 1 ? void 0 : a ? li(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3329
3358
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
3330
- return a && s && ai(e, i, s), s;
3359
+ return a && s && oi(e, i, s), s;
3331
3360
  };
3332
- let Ft = class extends $ {
3361
+ let Et = class extends y {
3333
3362
  constructor() {
3334
3363
  super(...arguments), this.icon = "⚠️", this.heading = "Something went wrong", this.message = "", this.retryLabel = "";
3335
3364
  }
@@ -3347,25 +3376,25 @@ let Ft = class extends $ {
3347
3376
  };
3348
3377
  Qt([
3349
3378
  l()
3350
- ], Ft.prototype, "icon", 2);
3379
+ ], Et.prototype, "icon", 2);
3351
3380
  Qt([
3352
3381
  l()
3353
- ], Ft.prototype, "heading", 2);
3382
+ ], Et.prototype, "heading", 2);
3354
3383
  Qt([
3355
3384
  l()
3356
- ], Ft.prototype, "message", 2);
3385
+ ], Et.prototype, "message", 2);
3357
3386
  Qt([
3358
3387
  l({ attribute: "retry-label" })
3359
- ], Ft.prototype, "retryLabel", 2);
3360
- Ft = Qt([
3361
- u("baht-error-state")
3362
- ], Ft);
3363
- var ri = Object.defineProperty, oi = Object.getOwnPropertyDescriptor, wt = (t, e, i, a) => {
3364
- for (var s = a > 1 ? void 0 : a ? oi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3388
+ ], Et.prototype, "retryLabel", 2);
3389
+ Et = Qt([
3390
+ b("baht-error-state")
3391
+ ], Et);
3392
+ var ni = Object.defineProperty, hi = Object.getOwnPropertyDescriptor, xt = (t, e, i, a) => {
3393
+ for (var s = a > 1 ? void 0 : a ? hi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3365
3394
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
3366
- return a && s && ri(e, i, s), s;
3395
+ return a && s && ni(e, i, s), s;
3367
3396
  };
3368
- let pt = class extends $ {
3397
+ let dt = class extends y {
3369
3398
  constructor() {
3370
3399
  super(...arguments), this.value = {}, this.keyPlaceholder = "key", this.valuePlaceholder = "value", this.add_label = "Add row", this.disabled = !1, this.rows = [{ k: "", v: "" }], this.syncedJson = "";
3371
3400
  }
@@ -3422,7 +3451,7 @@ let pt = class extends $ {
3422
3451
  aria-label="Remove row ${e + 1}"
3423
3452
  ?disabled=${this.disabled}
3424
3453
  @click=${() => this.commit(this.rows.filter((i, a) => a !== e))}
3425
- >${U("close")}</button>
3454
+ >${H("close")}</button>
3426
3455
  </div>`
3427
3456
  )}
3428
3457
  <button
@@ -3430,37 +3459,37 @@ let pt = class extends $ {
3430
3459
  class="baht-keyvalue-add"
3431
3460
  ?disabled=${this.disabled}
3432
3461
  @click=${this.addRow}
3433
- >${U("plus")}${this.add_label}</button>
3462
+ >${H("plus")}${this.add_label}</button>
3434
3463
  </div>`;
3435
3464
  }
3436
3465
  };
3437
- wt([
3466
+ xt([
3438
3467
  l({ attribute: !1 })
3439
- ], pt.prototype, "value", 2);
3440
- wt([
3468
+ ], dt.prototype, "value", 2);
3469
+ xt([
3441
3470
  l({ attribute: "key-placeholder" })
3442
- ], pt.prototype, "keyPlaceholder", 2);
3443
- wt([
3471
+ ], dt.prototype, "keyPlaceholder", 2);
3472
+ xt([
3444
3473
  l({ attribute: "value-placeholder" })
3445
- ], pt.prototype, "valuePlaceholder", 2);
3446
- wt([
3474
+ ], dt.prototype, "valuePlaceholder", 2);
3475
+ xt([
3447
3476
  l({ attribute: "add-label" })
3448
- ], pt.prototype, "add_label", 2);
3449
- wt([
3477
+ ], dt.prototype, "add_label", 2);
3478
+ xt([
3450
3479
  l({ type: Boolean })
3451
- ], pt.prototype, "disabled", 2);
3452
- wt([
3453
- y()
3454
- ], pt.prototype, "rows", 2);
3455
- pt = wt([
3456
- u("baht-keyvalue-editor")
3457
- ], pt);
3458
- var li = Object.defineProperty, ni = Object.getOwnPropertyDescriptor, M = (t, e, i, a) => {
3459
- for (var s = a > 1 ? void 0 : a ? ni(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3480
+ ], dt.prototype, "disabled", 2);
3481
+ xt([
3482
+ $()
3483
+ ], dt.prototype, "rows", 2);
3484
+ dt = xt([
3485
+ b("baht-keyvalue-editor")
3486
+ ], dt);
3487
+ var ci = Object.defineProperty, pi = Object.getOwnPropertyDescriptor, T = (t, e, i, a) => {
3488
+ for (var s = a > 1 ? void 0 : a ? pi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3460
3489
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
3461
- return a && s && li(e, i, s), s;
3490
+ return a && s && ci(e, i, s), s;
3462
3491
  };
3463
- let S = class extends $ {
3492
+ let j = class extends y {
3464
3493
  constructor() {
3465
3494
  super(...arguments), this.label = "Reference", this.value = "", this.display = "", this.placeholder = "", this.disabled = !1, this.invalid = !1, this.href = "", this.lookupLabel = "Look up records", this.debounce = 200, this.fetcher = null, this.open = !1, this.term = "", this.options = [], this.loading = !1, this.activeIndex = -1, this.fetchSeq = 0, this.onDocMousedown = (t) => {
3466
3495
  this.contains(t.target) || this.close();
@@ -3470,16 +3499,16 @@ let S = class extends $ {
3470
3499
  return `baht-refpicker-list-${this.uid}`;
3471
3500
  }
3472
3501
  disconnectedCallback() {
3473
- super.disconnectedCallback(), clearTimeout(this.timer), q() && document.removeEventListener("mousedown", this.onDocMousedown);
3502
+ super.disconnectedCallback(), clearTimeout(this.timer), S() && document.removeEventListener("mousedown", this.onDocMousedown);
3474
3503
  }
3475
3504
  openLookup() {
3476
- this.disabled || this.open || (this.open = !0, this.term = "", this.activeIndex = -1, q() && document.addEventListener("mousedown", this.onDocMousedown), this.search(""), this.updateComplete.then(() => {
3505
+ this.disabled || this.open || (this.open = !0, this.term = "", this.activeIndex = -1, S() && document.addEventListener("mousedown", this.onDocMousedown), this.search(""), this.updateComplete.then(() => {
3477
3506
  var t;
3478
3507
  return (t = this.inputEl) == null ? void 0 : t.focus();
3479
3508
  }));
3480
3509
  }
3481
3510
  close() {
3482
- this.open && (this.open = !1, this.loading = !1, clearTimeout(this.timer), q() && document.removeEventListener("mousedown", this.onDocMousedown));
3511
+ this.open && (this.open = !1, this.loading = !1, clearTimeout(this.timer), S() && document.removeEventListener("mousedown", this.onDocMousedown));
3483
3512
  }
3484
3513
  search(t) {
3485
3514
  clearTimeout(this.timer), this.timer = setTimeout(async () => {
@@ -3554,7 +3583,7 @@ let S = class extends $ {
3554
3583
  aria-label="Clear"
3555
3584
  @mousedown=${(e) => e.preventDefault()}
3556
3585
  @click=${() => this.clear()}
3557
- >${U("close")}</button>` : h}
3586
+ >${H("close")}</button>` : h}
3558
3587
  </div>
3559
3588
  <button
3560
3589
  type="button"
@@ -3563,13 +3592,13 @@ let S = class extends $ {
3563
3592
  title=${this.lookupLabel}
3564
3593
  ?disabled=${this.disabled}
3565
3594
  @click=${() => this.open ? this.close() : this.openLookup()}
3566
- >${U("search")}</button>
3595
+ >${H("search")}</button>
3567
3596
  ${this.value && this.href ? n`<a
3568
3597
  class="baht-refpicker-open"
3569
3598
  href=${this.href}
3570
3599
  aria-label="Open record"
3571
3600
  title="Open record"
3572
- >${U("external")}</a>` : h}
3601
+ >${H("external")}</a>` : h}
3573
3602
  <div
3574
3603
  class="baht-refpicker-list"
3575
3604
  id=${this.listboxId}
@@ -3596,63 +3625,63 @@ let S = class extends $ {
3596
3625
  </div>`;
3597
3626
  }
3598
3627
  };
3599
- M([
3628
+ T([
3600
3629
  l()
3601
- ], S.prototype, "label", 2);
3602
- M([
3630
+ ], j.prototype, "label", 2);
3631
+ T([
3603
3632
  l()
3604
- ], S.prototype, "value", 2);
3605
- M([
3633
+ ], j.prototype, "value", 2);
3634
+ T([
3606
3635
  l()
3607
- ], S.prototype, "display", 2);
3608
- M([
3636
+ ], j.prototype, "display", 2);
3637
+ T([
3609
3638
  l()
3610
- ], S.prototype, "placeholder", 2);
3611
- M([
3639
+ ], j.prototype, "placeholder", 2);
3640
+ T([
3612
3641
  l({ type: Boolean })
3613
- ], S.prototype, "disabled", 2);
3614
- M([
3642
+ ], j.prototype, "disabled", 2);
3643
+ T([
3615
3644
  l({ type: Boolean })
3616
- ], S.prototype, "invalid", 2);
3617
- M([
3645
+ ], j.prototype, "invalid", 2);
3646
+ T([
3618
3647
  l()
3619
- ], S.prototype, "href", 2);
3620
- M([
3648
+ ], j.prototype, "href", 2);
3649
+ T([
3621
3650
  l({ attribute: "lookup-label" })
3622
- ], S.prototype, "lookupLabel", 2);
3623
- M([
3651
+ ], j.prototype, "lookupLabel", 2);
3652
+ T([
3624
3653
  l({ type: Number })
3625
- ], S.prototype, "debounce", 2);
3626
- M([
3654
+ ], j.prototype, "debounce", 2);
3655
+ T([
3627
3656
  l({ attribute: !1 })
3628
- ], S.prototype, "fetcher", 2);
3629
- M([
3630
- y()
3631
- ], S.prototype, "open", 2);
3632
- M([
3633
- y()
3634
- ], S.prototype, "term", 2);
3635
- M([
3636
- y()
3637
- ], S.prototype, "options", 2);
3638
- M([
3639
- y()
3640
- ], S.prototype, "loading", 2);
3641
- M([
3642
- y()
3643
- ], S.prototype, "activeIndex", 2);
3644
- M([
3645
- Et("input")
3646
- ], S.prototype, "inputEl", 2);
3647
- S = M([
3648
- u("baht-reference-picker")
3649
- ], S);
3650
- var hi = Object.defineProperty, ci = Object.getOwnPropertyDescriptor, j = (t, e, i, a) => {
3651
- for (var s = a > 1 ? void 0 : a ? ci(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3657
+ ], j.prototype, "fetcher", 2);
3658
+ T([
3659
+ $()
3660
+ ], j.prototype, "open", 2);
3661
+ T([
3662
+ $()
3663
+ ], j.prototype, "term", 2);
3664
+ T([
3665
+ $()
3666
+ ], j.prototype, "options", 2);
3667
+ T([
3668
+ $()
3669
+ ], j.prototype, "loading", 2);
3670
+ T([
3671
+ $()
3672
+ ], j.prototype, "activeIndex", 2);
3673
+ T([
3674
+ Bt("input")
3675
+ ], j.prototype, "inputEl", 2);
3676
+ j = T([
3677
+ b("baht-reference-picker")
3678
+ ], j);
3679
+ var di = Object.defineProperty, ui = Object.getOwnPropertyDescriptor, I = (t, e, i, a) => {
3680
+ for (var s = a > 1 ? void 0 : a ? ui(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3652
3681
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
3653
- return a && s && hi(e, i, s), s;
3682
+ return a && s && di(e, i, s), s;
3654
3683
  };
3655
- let E = class extends $ {
3684
+ let F = class extends y {
3656
3685
  constructor() {
3657
3686
  super(...arguments), this.label = "Search", this.value = "", this.placeholder = "", this.disabled = !1, this.invalid = !1, this.options = [], this.fetcher = null, this.debounce = 150, this.minChars = 1, this.maxItems = 8, this.freeText = !0, this.autocomplete = "off", this.term = "", this.open = !1, this.results = [], this.loading = !1, this.activeIndex = -1, this.fetchSeq = 0, this.picked = null, this.lastPicked = null, this.onDocMousedown = (t) => {
3658
3687
  this.contains(t.target) || this.close();
@@ -3668,7 +3697,7 @@ let E = class extends $ {
3668
3697
  return `${this.listboxId}-${t}`;
3669
3698
  }
3670
3699
  disconnectedCallback() {
3671
- super.disconnectedCallback(), clearTimeout(this.timer), q() && document.removeEventListener("mousedown", this.onDocMousedown);
3700
+ super.disconnectedCallback(), clearTimeout(this.timer), S() && document.removeEventListener("mousedown", this.onDocMousedown);
3672
3701
  }
3673
3702
  willUpdate(t) {
3674
3703
  super.willUpdate(t), t.has("value") && this.timer === void 0 && (this.term = this.value);
@@ -3715,10 +3744,10 @@ let E = class extends $ {
3715
3744
  this.activeIndex !== t && (this.activeIndex = t);
3716
3745
  }
3717
3746
  listen() {
3718
- q() && document.addEventListener("mousedown", this.onDocMousedown);
3747
+ S() && document.addEventListener("mousedown", this.onDocMousedown);
3719
3748
  }
3720
3749
  close() {
3721
- q() && document.removeEventListener("mousedown", this.onDocMousedown), this.open && (this.open = !1, this.activeIndex = -1);
3750
+ S() && document.removeEventListener("mousedown", this.onDocMousedown), this.open && (this.open = !1, this.activeIndex = -1);
3722
3751
  }
3723
3752
  // ---- events ------------------------------------------------------------
3724
3753
  emitChange(t, e) {
@@ -3798,7 +3827,7 @@ let E = class extends $ {
3798
3827
  aria-invalid=${this.invalid ? "true" : h}
3799
3828
  autocomplete=${this.autocomplete}
3800
3829
  placeholder=${this.placeholder || h}
3801
- .value=${rt(this.term)}
3830
+ .value=${ot(this.term)}
3802
3831
  ?disabled=${this.disabled}
3803
3832
  @input=${(i) => this.onInput(i)}
3804
3833
  @keydown=${(i) => this.onKeydown(i)}
@@ -3835,64 +3864,64 @@ let E = class extends $ {
3835
3864
  </div>`;
3836
3865
  }
3837
3866
  };
3838
- j([
3867
+ I([
3839
3868
  l()
3840
- ], E.prototype, "label", 2);
3841
- j([
3869
+ ], F.prototype, "label", 2);
3870
+ I([
3842
3871
  l()
3843
- ], E.prototype, "value", 2);
3844
- j([
3872
+ ], F.prototype, "value", 2);
3873
+ I([
3845
3874
  l()
3846
- ], E.prototype, "placeholder", 2);
3847
- j([
3875
+ ], F.prototype, "placeholder", 2);
3876
+ I([
3848
3877
  l({ type: Boolean })
3849
- ], E.prototype, "disabled", 2);
3850
- j([
3878
+ ], F.prototype, "disabled", 2);
3879
+ I([
3851
3880
  l({ type: Boolean })
3852
- ], E.prototype, "invalid", 2);
3853
- j([
3881
+ ], F.prototype, "invalid", 2);
3882
+ I([
3854
3883
  l({ attribute: !1 })
3855
- ], E.prototype, "options", 2);
3856
- j([
3884
+ ], F.prototype, "options", 2);
3885
+ I([
3857
3886
  l({ attribute: !1 })
3858
- ], E.prototype, "fetcher", 2);
3859
- j([
3887
+ ], F.prototype, "fetcher", 2);
3888
+ I([
3860
3889
  l({ type: Number })
3861
- ], E.prototype, "debounce", 2);
3862
- j([
3890
+ ], F.prototype, "debounce", 2);
3891
+ I([
3863
3892
  l({ type: Number, attribute: "min-chars" })
3864
- ], E.prototype, "minChars", 2);
3865
- j([
3893
+ ], F.prototype, "minChars", 2);
3894
+ I([
3866
3895
  l({ type: Number, attribute: "max-items" })
3867
- ], E.prototype, "maxItems", 2);
3868
- j([
3896
+ ], F.prototype, "maxItems", 2);
3897
+ I([
3869
3898
  l({ attribute: "free-text", converter: (t) => t !== "false" })
3870
- ], E.prototype, "freeText", 2);
3871
- j([
3899
+ ], F.prototype, "freeText", 2);
3900
+ I([
3872
3901
  l()
3873
- ], E.prototype, "autocomplete", 2);
3874
- j([
3875
- y()
3876
- ], E.prototype, "term", 2);
3877
- j([
3878
- y()
3879
- ], E.prototype, "open", 2);
3880
- j([
3881
- y()
3882
- ], E.prototype, "results", 2);
3883
- j([
3884
- y()
3885
- ], E.prototype, "loading", 2);
3886
- j([
3887
- y()
3888
- ], E.prototype, "activeIndex", 2);
3889
- j([
3890
- Et("input")
3891
- ], E.prototype, "inputEl", 2);
3892
- E = j([
3893
- u("baht-typeahead")
3894
- ], E);
3895
- const ns = {
3902
+ ], F.prototype, "autocomplete", 2);
3903
+ I([
3904
+ $()
3905
+ ], F.prototype, "term", 2);
3906
+ I([
3907
+ $()
3908
+ ], F.prototype, "open", 2);
3909
+ I([
3910
+ $()
3911
+ ], F.prototype, "results", 2);
3912
+ I([
3913
+ $()
3914
+ ], F.prototype, "loading", 2);
3915
+ I([
3916
+ $()
3917
+ ], F.prototype, "activeIndex", 2);
3918
+ I([
3919
+ Bt("input")
3920
+ ], F.prototype, "inputEl", 2);
3921
+ F = I([
3922
+ b("baht-typeahead")
3923
+ ], F);
3924
+ const cs = {
3896
3925
  text: "baht-input",
3897
3926
  email: "baht-input",
3898
3927
  password: "baht-input",
@@ -3909,22 +3938,22 @@ const ns = {
3909
3938
  section: "baht-section",
3910
3939
  repeater: "baht-repeater"
3911
3940
  };
3912
- var pi = Object.defineProperty, di = Object.getOwnPropertyDescriptor, hs = (t, e, i, a) => {
3913
- for (var s = a > 1 ? void 0 : a ? di(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3941
+ var bi = Object.defineProperty, fi = Object.getOwnPropertyDescriptor, ps = (t, e, i, a) => {
3942
+ for (var s = a > 1 ? void 0 : a ? fi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
3914
3943
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
3915
- return a && s && pi(e, i, s), s;
3944
+ return a && s && bi(e, i, s), s;
3916
3945
  };
3917
- const ui = {
3946
+ const mi = {
3918
3947
  "1/4": "baht-field--w-1-4",
3919
3948
  "1/2": "baht-field--w-1-2",
3920
3949
  "3/4": "baht-field--w-3-4",
3921
3950
  full: "baht-field--w-full"
3922
- }, es = /* @__PURE__ */ new Map();
3923
- function bi(t) {
3924
- let e = es.get(t);
3925
- return e || (e = is(t), es.set(t, e)), e;
3951
+ }, as = /* @__PURE__ */ new Map();
3952
+ function vi(t) {
3953
+ let e = as.get(t);
3954
+ return e || (e = os(t), as.set(t, e)), e;
3926
3955
  }
3927
- let Be = class extends W {
3956
+ let Ie = class extends J {
3928
3957
  constructor() {
3929
3958
  super(...arguments), this.rowErrors = [];
3930
3959
  }
@@ -3953,7 +3982,7 @@ let Be = class extends W {
3953
3982
  /** Pending keystrokes in any row land in the array before the host reads it. */
3954
3983
  flushTyped() {
3955
3984
  var t;
3956
- if (!q()) return super.flushTyped();
3985
+ if (!S()) return super.flushTyped();
3957
3986
  for (const e of this.querySelectorAll(".baht-repeater-row > .baht-field > *"))
3958
3987
  (t = e.flushTyped) == null || t.call(e);
3959
3988
  super.flushTyped();
@@ -3969,12 +3998,12 @@ let Be = class extends W {
3969
3998
  * focus, same as <baht-form> — and the whole thing renders on the server.
3970
3999
  */
3971
4000
  renderSub(t, e, i) {
3972
- const a = ns[i.type];
4001
+ const a = cs[i.type];
3973
4002
  if (!a) return h;
3974
- const s = bi(a), r = ui[i.width ?? "full"] ?? "baht-field--w-full", o = (c) => {
4003
+ const s = vi(a), r = mi[i.width ?? "full"] ?? "baht-field--w-full", o = (c) => {
3975
4004
  c.stopPropagation();
3976
- const { value: m } = c.detail;
3977
- this.patchRow(e, i.key, m);
4005
+ const { value: f } = c.detail;
4006
+ this.patchRow(e, i.key, f);
3978
4007
  };
3979
4008
  return n`<div class="baht-field ${r}" data-key=${i.key} data-type=${i.type}>
3980
4009
  ${ee`<${s}
@@ -3998,16 +4027,16 @@ let Be = class extends W {
3998
4027
  aria-labelledby=${this.field.label ? this.labelId : h}
3999
4028
  aria-describedby=${this.describedBy}
4000
4029
  >
4001
- ${Oe(
4030
+ ${Ce(
4002
4031
  t,
4003
4032
  (a, s) => s,
4004
4033
  (a, s) => n`<div
4005
4034
  class="baht-repeater-row"
4006
4035
  data-row=${s}
4007
4036
  role="group"
4008
- aria-label=${v("row", { n: s + 1 })}
4037
+ aria-label=${m("row", { n: s + 1 })}
4009
4038
  >
4010
- ${Oe(
4039
+ ${Ce(
4011
4040
  this.subFields,
4012
4041
  (r) => r.key,
4013
4042
  (r) => this.renderSub(a, s, r)
@@ -4015,8 +4044,8 @@ let Be = class extends W {
4015
4044
  ${e ? n`<button
4016
4045
  type="button"
4017
4046
  class="baht-repeater-remove"
4018
- aria-label=${v("removeRowN", { n: s + 1 })}
4019
- title=${v("removeRowN", { n: s + 1 })}
4047
+ aria-label=${m("removeRowN", { n: s + 1 })}
4048
+ title=${m("removeRowN", { n: s + 1 })}
4020
4049
  @click=${() => this.removeRow(s)}
4021
4050
  >
4022
4051
  ✕
@@ -4029,23 +4058,23 @@ let Be = class extends W {
4029
4058
  ?disabled=${this.disabled || i}
4030
4059
  @click=${() => this.addRow()}
4031
4060
  >
4032
- + ${this.field.add_label ?? v("addRow")}
4061
+ + ${this.field.add_label ?? m("addRow")}
4033
4062
  </button>`}
4034
4063
  </div>`;
4035
4064
  }
4036
4065
  };
4037
- hs([
4066
+ ps([
4038
4067
  l({ attribute: !1 })
4039
- ], Be.prototype, "rowErrors", 2);
4040
- Be = hs([
4041
- u("baht-repeater")
4042
- ], Be);
4043
- var fi = Object.defineProperty, mi = Object.getOwnPropertyDescriptor, me = (t, e, i, a) => {
4044
- for (var s = a > 1 ? void 0 : a ? mi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
4068
+ ], Ie.prototype, "rowErrors", 2);
4069
+ Ie = ps([
4070
+ b("baht-repeater")
4071
+ ], Ie);
4072
+ var $i = Object.defineProperty, yi = Object.getOwnPropertyDescriptor, me = (t, e, i, a) => {
4073
+ for (var s = a > 1 ? void 0 : a ? yi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
4045
4074
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
4046
- return a && s && fi(e, i, s), s;
4075
+ return a && s && $i(e, i, s), s;
4047
4076
  };
4048
- let Gt = class extends $ {
4077
+ let Gt = class extends y {
4049
4078
  constructor() {
4050
4079
  super(...arguments), this.steps = [], this.current = 0, this.variant = "default";
4051
4080
  }
@@ -4053,7 +4082,7 @@ let Gt = class extends $ {
4053
4082
  const t = this.variant === "sidebar";
4054
4083
  return n`<ol
4055
4084
  class="baht-steps ${t ? "baht-steps--sidebar" : ""}"
4056
- aria-label=${v("step", { current: this.current + 1, total: this.steps.length })}
4085
+ aria-label=${m("step", { current: this.current + 1, total: this.steps.length })}
4057
4086
  >
4058
4087
  ${this.steps.map((e, i) => {
4059
4088
  const a = i < this.current ? "done" : i === this.current ? "current" : "todo";
@@ -4063,7 +4092,7 @@ let Gt = class extends $ {
4063
4092
  >
4064
4093
  ${t ? h : n`<span class="baht-step-marker" aria-hidden="true">${a === "done" ? "✓" : i + 1}</span>`}
4065
4094
  <span class="baht-step-label">${e}</span>
4066
- ${a === "done" ? n`<span class="baht-visually-hidden"> (${v("stepDone")})</span>` : a === "current" ? n`<span class="baht-visually-hidden"> (${v("stepCurrent")})</span>` : h}
4095
+ ${a === "done" ? n`<span class="baht-visually-hidden"> (${m("stepDone")})</span>` : a === "current" ? n`<span class="baht-visually-hidden"> (${m("stepCurrent")})</span>` : h}
4067
4096
  </li>`;
4068
4097
  })}
4069
4098
  </ol>`;
@@ -4079,24 +4108,24 @@ me([
4079
4108
  l()
4080
4109
  ], Gt.prototype, "variant", 2);
4081
4110
  Gt = me([
4082
- u("baht-steps")
4111
+ b("baht-steps")
4083
4112
  ], Gt);
4084
- var vi = Object.defineProperty, $i = Object.getOwnPropertyDescriptor, Y = (t, e, i, a) => {
4085
- for (var s = a > 1 ? void 0 : a ? $i(e, i) : e, r = t.length - 1, o; r >= 0; r--)
4113
+ var gi = Object.defineProperty, wi = Object.getOwnPropertyDescriptor, X = (t, e, i, a) => {
4114
+ for (var s = a > 1 ? void 0 : a ? wi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
4086
4115
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
4087
- return a && s && vi(e, i, s), s;
4116
+ return a && s && gi(e, i, s), s;
4088
4117
  };
4089
- const yi = {
4118
+ const xi = {
4090
4119
  "1/4": "baht-field--w-1-4",
4091
4120
  "1/2": "baht-field--w-1-2",
4092
4121
  "3/4": "baht-field--w-3-4",
4093
4122
  full: "baht-field--w-full"
4094
- }, ss = /* @__PURE__ */ new Map();
4095
- function gi(t) {
4096
- let e = ss.get(t);
4097
- return e || (e = is(t), ss.set(t, e)), e;
4123
+ }, is = /* @__PURE__ */ new Map();
4124
+ function _i(t) {
4125
+ let e = is.get(t);
4126
+ return e || (e = os(t), is.set(t, e)), e;
4098
4127
  }
4099
- let V = class extends $ {
4128
+ let U = class extends y {
4100
4129
  constructor() {
4101
4130
  super(...arguments), this.value = {}, this.registry = {}, this.options = {}, this.fieldStates = {}, this.flags = {}, this.readonly = !1, this.edits = {}, this.errors = [], this.dynamicOptions = /* @__PURE__ */ new Map(), this.optionsSnapshots = /* @__PURE__ */ new Map(), this.optionsEpoch = /* @__PURE__ */ new Map(), this.warnedViews = /* @__PURE__ */ new Set(), this.flagCache = {};
4102
4131
  }
@@ -4104,7 +4133,7 @@ let V = class extends $ {
4104
4133
  return this.form ? ((this.flagCache.form !== this.form || this.flagCache.flags !== this.flags) && (this.flagCache = {
4105
4134
  form: this.form,
4106
4135
  flags: this.flags,
4107
- out: as(this.form, this.flags)
4136
+ out: rs(this.form, this.flags)
4108
4137
  }), this.flagCache.out) : this.form;
4109
4138
  }
4110
4139
  willUpdate(t) {
@@ -4120,7 +4149,7 @@ let V = class extends $ {
4120
4149
  const t = this.getData();
4121
4150
  for (const a of ((e = this.effectiveForm) == null ? void 0 : e.fields) ?? []) {
4122
4151
  if (!a.options_from) continue;
4123
- const s = JSON.stringify((a.options_deps ?? []).map((m) => t[m] ?? null));
4152
+ const s = JSON.stringify((a.options_deps ?? []).map((f) => t[f] ?? null));
4124
4153
  if (this.optionsSnapshots.get(a.key) === s) continue;
4125
4154
  this.optionsSnapshots.set(a.key, s);
4126
4155
  const r = (this.optionsEpoch.get(a.key) ?? 0) + 1;
@@ -4131,10 +4160,10 @@ let V = class extends $ {
4131
4160
  continue;
4132
4161
  }
4133
4162
  const c = o(t);
4134
- c instanceof Promise ? c.then((m) => {
4135
- this.optionsEpoch.get(a.key) === r && (this.dynamicOptions.set(a.key, m), this.requestUpdate());
4136
- }).catch((m) => {
4137
- console.warn(`[bahtui] options fetcher "${a.options_from}" failed`, m), this.optionsEpoch.get(a.key) === r && this.optionsSnapshots.delete(a.key);
4163
+ c instanceof Promise ? c.then((f) => {
4164
+ this.optionsEpoch.get(a.key) === r && (this.dynamicOptions.set(a.key, f), this.requestUpdate());
4165
+ }).catch((f) => {
4166
+ console.warn(`[bahtui] options fetcher "${a.options_from}" failed`, f), this.optionsEpoch.get(a.key) === r && this.optionsSnapshots.delete(a.key);
4138
4167
  }) : this.dynamicOptions.set(a.key, c);
4139
4168
  }
4140
4169
  }
@@ -4154,8 +4183,8 @@ let V = class extends $ {
4154
4183
  }
4155
4184
  get sortedFields() {
4156
4185
  if (!this.form) return [];
4157
- const t = Me(this.effectiveForm, this.view);
4158
- return t || (this.view !== void 0 && !this.warnedViews.has(this.view) && (this.warnedViews.add(this.view), console.warn(`[bahtui] unknown view "${this.view}" — showing the full form`)), Me(this.effectiveForm) ?? []);
4186
+ const t = Ae(this.effectiveForm, this.view);
4187
+ return t || (this.view !== void 0 && !this.warnedViews.has(this.view) && (this.warnedViews.add(this.view), console.warn(`[bahtui] unknown view "${this.view}" — showing the full form`)), Ae(this.effectiveForm) ?? []);
4159
4188
  }
4160
4189
  stateFor(t) {
4161
4190
  return this.fieldStates[t.key] ?? {
@@ -4173,7 +4202,7 @@ let V = class extends $ {
4173
4202
  /** Debounced keystrokes still in a control land in `edits` before anyone reads them. */
4174
4203
  flushTyped() {
4175
4204
  var t;
4176
- if (q())
4205
+ if (S())
4177
4206
  for (const e of this.querySelectorAll(":scope > .baht-form > .baht-field > *"))
4178
4207
  (t = e.flushTyped) == null || t.call(e);
4179
4208
  }
@@ -4195,7 +4224,7 @@ let V = class extends $ {
4195
4224
  const s = this.stateFor(a);
4196
4225
  if (!s.visible) continue;
4197
4226
  const r = s.required === !!a.required ? a : { ...a, required: s.required };
4198
- t.push(...Ae(r, this.valueFor(a), this.registry, e));
4227
+ t.push(...Le(r, this.valueFor(a), this.registry, e));
4199
4228
  }
4200
4229
  this.errors = t;
4201
4230
  const i = { valid: t.length === 0, errors: t };
@@ -4225,7 +4254,7 @@ let V = class extends $ {
4225
4254
  const e = this.stateFor(t);
4226
4255
  if (!e.visible) return [];
4227
4256
  const i = this.getData(), a = e.required === !!t.required ? t : { ...t, required: e.required };
4228
- return Ae(a, this.valueFor(t), this.registry, i);
4257
+ return Le(a, this.valueFor(t), this.registry, i);
4229
4258
  }
4230
4259
  /** `validateOn: 'blur'` — validate just the field the user left, same as
4231
4260
  * how errors are shown elsewhere (merged into `this.errors`, painted by
@@ -4236,47 +4265,47 @@ let V = class extends $ {
4236
4265
  this.errors = [...i, ...e];
4237
4266
  }
4238
4267
  renderField(t) {
4239
- var k, b;
4240
- const e = ns[t.type];
4268
+ var C, d;
4269
+ const e = cs[t.type];
4241
4270
  if (!e)
4242
4271
  return console.warn(`[bahtui] unknown field type "${t.type}" — skipped`), h;
4243
- const i = this.stateFor(t), a = yi[t.width ?? "full"] ?? "baht-field--w-full", s = ((k = this.errors.find((w) => w.key === t.key)) == null ? void 0 : k.message) ?? null;
4272
+ const i = this.stateFor(t), a = xi[t.width ?? "full"] ?? "baht-field--w-full", s = ((C = this.errors.find((v) => v.key === t.key)) == null ? void 0 : C.message) ?? null;
4244
4273
  if (this.readonly && t.type !== "label" && t.type !== "section")
4245
4274
  return this.renderReadonlyField(t, a, i.visible);
4246
- const r = t.options_from ? { ...t, options: this.dynamicOptions.get(t.key) ?? t.options ?? [] } : t, o = this.valueFor(t), c = !i.enabled, m = this.readonly || i.readonly, g = this.options.inputDebounce, _ = (w) => this.onControlInput(t.key, w), p = gi(e);
4247
- let f;
4275
+ const r = t.options_from ? { ...t, options: this.dynamicOptions.get(t.key) ?? t.options ?? [] } : t, o = this.valueFor(t), c = !i.enabled, f = this.readonly || i.readonly, g = this.options.inputDebounce, _ = (v) => this.onControlInput(t.key, v), p = _i(e);
4276
+ let w;
4248
4277
  if (t.type === "repeater") {
4249
- const w = this.errors.filter((D) => D.key.startsWith(`${t.key}[`));
4250
- f = ee`<${p}
4278
+ const v = this.errors.filter((z) => z.key.startsWith(`${t.key}[`));
4279
+ w = ee`<${p}
4251
4280
  .field=${r}
4252
4281
  .value=${o}
4253
4282
  .disabled=${c}
4254
- .readonly=${m}
4283
+ .readonly=${f}
4255
4284
  .required=${i.required}
4256
4285
  .error=${s}
4257
4286
  .debounce=${g}
4258
- .rowErrors=${w}
4287
+ .rowErrors=${v}
4259
4288
  @baht-input=${_}
4260
4289
  ></${p}>`;
4261
4290
  } else if (t.type === "file") {
4262
- let w;
4263
- t.uploader && (w = (b = this.registry.uploaders) == null ? void 0 : b[t.uploader], w || console.warn(`[bahtui] unknown uploader "${t.uploader}" — capture only`)), f = ee`<${p}
4291
+ let v;
4292
+ t.uploader && (v = (d = this.registry.uploaders) == null ? void 0 : d[t.uploader], v || console.warn(`[bahtui] unknown uploader "${t.uploader}" — capture only`)), w = ee`<${p}
4264
4293
  .field=${r}
4265
4294
  .value=${o}
4266
4295
  .disabled=${c}
4267
- .readonly=${m}
4296
+ .readonly=${f}
4268
4297
  .required=${i.required}
4269
4298
  .error=${s}
4270
4299
  .debounce=${g}
4271
- .uploader=${w}
4300
+ .uploader=${v}
4272
4301
  @baht-input=${_}
4273
4302
  ></${p}>`;
4274
4303
  } else
4275
- f = ee`<${p}
4304
+ w = ee`<${p}
4276
4305
  .field=${r}
4277
4306
  .value=${o}
4278
4307
  .disabled=${c}
4279
- .readonly=${m}
4308
+ .readonly=${f}
4280
4309
  .required=${i.required}
4281
4310
  .error=${s}
4282
4311
  .debounce=${g}
@@ -4289,7 +4318,7 @@ let V = class extends $ {
4289
4318
  data-testid="${this.form.form_id}.${t.key}"
4290
4319
  @focusout=${() => this.onFieldBlur(t)}
4291
4320
  >
4292
- ${f}
4321
+ ${w}
4293
4322
  </div>`;
4294
4323
  }
4295
4324
  /**
@@ -4302,7 +4331,7 @@ let V = class extends $ {
4302
4331
  i && this.onFieldInput(i, e);
4303
4332
  }
4304
4333
  renderReadonlyField(t, e, i) {
4305
- const a = t.options_from ? this.dynamicOptions.get(t.key) ?? t.options ?? [] : t.options, s = us(t, this.valueFor(t), a), r = s.kind === "empty" ? n`<span class="baht-readonly-value baht-readonly-value--empty">${v("emptyValue")}</span>` : s.kind === "text" ? n`<span class="baht-readonly-value">${s.text}</span>` : s.kind === "chips" ? n`<span class="baht-readonly-value baht-readonly-chips"
4334
+ const a = t.options_from ? this.dynamicOptions.get(t.key) ?? t.options ?? [] : t.options, s = bs(t, this.valueFor(t), a), r = s.kind === "empty" ? n`<span class="baht-readonly-value baht-readonly-value--empty">${m("emptyValue")}</span>` : s.kind === "text" ? n`<span class="baht-readonly-value">${s.text}</span>` : s.kind === "chips" ? n`<span class="baht-readonly-value baht-readonly-chips"
4306
4335
  >${s.items.map((o) => n`<span class="baht-readonly-chip">${o}</span>`)}</span
4307
4336
  >` : n`<div class="baht-readonly-rows">
4308
4337
  ${s.rows.map(
@@ -4328,7 +4357,7 @@ let V = class extends $ {
4328
4357
  }
4329
4358
  render() {
4330
4359
  return n`<div class="baht-form ${this.readonly ? "baht-form--readonly" : ""}">
4331
- ${Oe(
4360
+ ${Ce(
4332
4361
  this.sortedFields,
4333
4362
  (t) => t.key,
4334
4363
  (t) => this.renderField(t)
@@ -4336,45 +4365,45 @@ let V = class extends $ {
4336
4365
  </div>`;
4337
4366
  }
4338
4367
  };
4339
- Y([
4368
+ X([
4340
4369
  l({ attribute: !1 })
4341
- ], V.prototype, "form", 2);
4342
- Y([
4370
+ ], U.prototype, "form", 2);
4371
+ X([
4343
4372
  l({ attribute: !1 })
4344
- ], V.prototype, "value", 2);
4345
- Y([
4373
+ ], U.prototype, "value", 2);
4374
+ X([
4346
4375
  l({ attribute: !1 })
4347
- ], V.prototype, "registry", 2);
4348
- Y([
4376
+ ], U.prototype, "registry", 2);
4377
+ X([
4349
4378
  l({ attribute: !1 })
4350
- ], V.prototype, "options", 2);
4351
- Y([
4379
+ ], U.prototype, "options", 2);
4380
+ X([
4352
4381
  l({ attribute: !1 })
4353
- ], V.prototype, "fieldStates", 2);
4354
- Y([
4382
+ ], U.prototype, "fieldStates", 2);
4383
+ X([
4355
4384
  l({ type: String })
4356
- ], V.prototype, "view", 2);
4357
- Y([
4385
+ ], U.prototype, "view", 2);
4386
+ X([
4358
4387
  l({ attribute: !1 })
4359
- ], V.prototype, "flags", 2);
4360
- Y([
4388
+ ], U.prototype, "flags", 2);
4389
+ X([
4361
4390
  l({ type: Boolean })
4362
- ], V.prototype, "readonly", 2);
4363
- Y([
4364
- y()
4365
- ], V.prototype, "edits", 2);
4366
- Y([
4367
- y()
4368
- ], V.prototype, "errors", 2);
4369
- V = Y([
4370
- u("baht-form")
4371
- ], V);
4372
- var wi = Object.defineProperty, xi = Object.getOwnPropertyDescriptor, N = (t, e, i, a) => {
4373
- for (var s = a > 1 ? void 0 : a ? xi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
4391
+ ], U.prototype, "readonly", 2);
4392
+ X([
4393
+ $()
4394
+ ], U.prototype, "edits", 2);
4395
+ X([
4396
+ $()
4397
+ ], U.prototype, "errors", 2);
4398
+ U = X([
4399
+ b("baht-form")
4400
+ ], U);
4401
+ var ki = Object.defineProperty, Pi = Object.getOwnPropertyDescriptor, N = (t, e, i, a) => {
4402
+ for (var s = a > 1 ? void 0 : a ? Pi(e, i) : e, r = t.length - 1, o; r >= 0; r--)
4374
4403
  (o = t[r]) && (s = (a ? o(e, i, s) : o(s)) || s);
4375
- return a && s && wi(e, i, s), s;
4404
+ return a && s && ki(e, i, s), s;
4376
4405
  };
4377
- let T = class extends $ {
4406
+ let M = class extends y {
4378
4407
  constructor() {
4379
4408
  super(...arguments), this.value = {}, this.registry = {}, this.validateGate = !0, this.showBack = !0, this.flags = {}, this.showSteps = !1, this.stepsVariant = "default", this.data = {}, this.derived = null, this.current = null, this.approvalError = null, this.history = [], this.flagCache = {};
4380
4409
  }
@@ -4385,7 +4414,7 @@ let T = class extends $ {
4385
4414
  return this.workflow ? ((this.flagCache.workflow !== this.workflow || this.flagCache.flags !== this.flags) && (this.flagCache = {
4386
4415
  workflow: this.workflow,
4387
4416
  flags: this.flags,
4388
- out: as(this.workflow, this.flags)
4417
+ out: rs(this.workflow, this.flags)
4389
4418
  }), this.flagCache.out) : this.workflow;
4390
4419
  }
4391
4420
  willUpdate(t) {
@@ -4393,7 +4422,7 @@ let T = class extends $ {
4393
4422
  t.has("workflow") || t.has("value") ? (this.data = structuredClone(this.value ?? {}), this.reevaluate(), this.history = [], this.current = ((e = this.visibleForms[0]) == null ? void 0 : e.form_name) ?? null, this.approvalError = null) : t.has("flags") && (this.reevaluate(), this.current && !this.visibleForms.some((a) => a.form_name === this.current) && (this.current = ((i = this.visibleForms[0]) == null ? void 0 : i.form_name) ?? null));
4394
4423
  }
4395
4424
  reevaluate() {
4396
- this.derived = bs(this.effectiveWorkflow, this.data), this.data = this.derived.data;
4425
+ this.derived = fs(this.effectiveWorkflow, this.data), this.data = this.derived.data;
4397
4426
  }
4398
4427
  /** Forms in ascending order whose derived visibility is true. */
4399
4428
  get visibleForms() {
@@ -4413,7 +4442,7 @@ let T = class extends $ {
4413
4442
  if (!this.current) return "end";
4414
4443
  const t = this.effectiveWorkflow;
4415
4444
  if (t.transitions && t.transitions.length > 0)
4416
- return fs(t, this.current, this.data);
4445
+ return ms(t, this.current, this.data);
4417
4446
  const e = this.visibleForms, i = e.findIndex((s) => s.form_name === this.current);
4418
4447
  return ((a = e[i + 1]) == null ? void 0 : a.form_name) ?? "end";
4419
4448
  }
@@ -4490,12 +4519,12 @@ let T = class extends $ {
4490
4519
  this.decide("rejected");
4491
4520
  }
4492
4521
  decide(t) {
4493
- var m;
4522
+ var f;
4494
4523
  const e = this.currentForm;
4495
4524
  if (!e || e.kind !== "approval") return;
4496
- const i = e.approval ?? {}, a = String(((m = this.data[e.form_name]) == null ? void 0 : m.comment) ?? ""), s = i.comment ?? "optional";
4525
+ const i = e.approval ?? {}, a = String(((f = this.data[e.form_name]) == null ? void 0 : f.comment) ?? ""), s = i.comment ?? "optional";
4497
4526
  if ((s === "required" || s === "requireOnReject" && t === "rejected") && a.trim() === "") {
4498
- this.approvalError = v("commentRequired");
4527
+ this.approvalError = m("commentRequired");
4499
4528
  return;
4500
4529
  }
4501
4530
  this.approvalError = null, this.data = {
@@ -4558,7 +4587,7 @@ let T = class extends $ {
4558
4587
  const e = ((a = t.approval) == null ? void 0 : a.comment) ?? "optional", i = this.summary_forms(t);
4559
4588
  return n`<div class="baht-approval">
4560
4589
  <div class="baht-approval-summary">
4561
- ${i.length === 0 ? n`<p class="baht-approval-empty">${v("nothingToReview")}</p>` : i.map(
4590
+ ${i.length === 0 ? n`<p class="baht-approval-empty">${m("nothingToReview")}</p>` : i.map(
4562
4591
  (r) => n`<section class="baht-approval-group">
4563
4592
  <h4 class="baht-approval-group-title">${r.form_name}</h4>
4564
4593
  <baht-form
@@ -4572,7 +4601,7 @@ let T = class extends $ {
4572
4601
  </div>
4573
4602
  ${e !== "hidden" ? n`<label class="baht-approval-comment">
4574
4603
  <span class="baht-approval-comment-label">
4575
- ${v("comment")}${e === "required" ? v("commentRequiredSuffix") : ""}
4604
+ ${m("comment")}${e === "required" ? m("commentRequiredSuffix") : ""}
4576
4605
  </span>
4577
4606
  <textarea
4578
4607
  rows="3"
@@ -4596,7 +4625,7 @@ let T = class extends $ {
4596
4625
  data-testid="${this.workflow.workflow_id}.${t.form_name}"
4597
4626
  >
4598
4627
  <div class="baht-visually-hidden" role="status">
4599
- ${v("step", { current: a + 1, total: i.length })}
4628
+ ${m("step", { current: a + 1, total: i.length })}
4600
4629
  </div>
4601
4630
  ${this.showSteps ? n`<baht-steps
4602
4631
  .steps=${i.map((o) => o.form_name)}
@@ -4616,7 +4645,7 @@ let T = class extends $ {
4616
4645
  data-testid="${this.workflow.workflow_id}.back"
4617
4646
  @click=${() => this.back()}
4618
4647
  >
4619
- ${this.backLabel ?? v("back")}
4648
+ ${this.backLabel ?? m("back")}
4620
4649
  </button>` : h}
4621
4650
  ${e ? n`<button
4622
4651
  type="button"
@@ -4624,7 +4653,7 @@ let T = class extends $ {
4624
4653
  data-testid="${this.workflow.workflow_id}.reject"
4625
4654
  @click=${() => this.decide("rejected")}
4626
4655
  >
4627
- ${((s = t.approval) == null ? void 0 : s.reject_label) ?? v("reject")}
4656
+ ${((s = t.approval) == null ? void 0 : s.reject_label) ?? m("reject")}
4628
4657
  </button>
4629
4658
  <button
4630
4659
  type="button"
@@ -4632,12 +4661,12 @@ let T = class extends $ {
4632
4661
  data-testid="${this.workflow.workflow_id}.approve"
4633
4662
  @click=${() => this.decide("approved")}
4634
4663
  >
4635
- ${((r = t.approval) == null ? void 0 : r.approve_label) ?? v("approve")}
4664
+ ${((r = t.approval) == null ? void 0 : r.approve_label) ?? m("approve")}
4636
4665
  </button>` : n`<button type="button" class="baht-button baht-button--next"
4637
4666
  data-testid="${this.workflow.workflow_id}.next"
4638
4667
  @click=${() => this.next()}
4639
4668
  >
4640
- ${this.isLast ? this.submitLabel ?? v("submit") : this.nextLabel ?? v("next")}
4669
+ ${this.isLast ? this.submitLabel ?? m("submit") : this.nextLabel ?? m("next")}
4641
4670
  </button>`}
4642
4671
  </div>
4643
4672
  </div>`;
@@ -4645,110 +4674,110 @@ let T = class extends $ {
4645
4674
  };
4646
4675
  N([
4647
4676
  l({ attribute: !1 })
4648
- ], T.prototype, "workflow", 2);
4677
+ ], M.prototype, "workflow", 2);
4649
4678
  N([
4650
4679
  l({ attribute: !1 })
4651
- ], T.prototype, "value", 2);
4680
+ ], M.prototype, "value", 2);
4652
4681
  N([
4653
4682
  l({ attribute: !1 })
4654
- ], T.prototype, "registry", 2);
4683
+ ], M.prototype, "registry", 2);
4655
4684
  N([
4656
4685
  l({ type: Boolean, attribute: "validate-gate" })
4657
- ], T.prototype, "validateGate", 2);
4686
+ ], M.prototype, "validateGate", 2);
4658
4687
  N([
4659
4688
  l({ attribute: "next-label" })
4660
- ], T.prototype, "nextLabel", 2);
4689
+ ], M.prototype, "nextLabel", 2);
4661
4690
  N([
4662
4691
  l({ attribute: "submit-label" })
4663
- ], T.prototype, "submitLabel", 2);
4692
+ ], M.prototype, "submitLabel", 2);
4664
4693
  N([
4665
4694
  l({ attribute: "back-label" })
4666
- ], T.prototype, "backLabel", 2);
4695
+ ], M.prototype, "backLabel", 2);
4667
4696
  N([
4668
4697
  l({ type: Boolean, attribute: "show-back" })
4669
- ], T.prototype, "showBack", 2);
4698
+ ], M.prototype, "showBack", 2);
4670
4699
  N([
4671
4700
  l({ attribute: !1 })
4672
- ], T.prototype, "flags", 2);
4701
+ ], M.prototype, "flags", 2);
4673
4702
  N([
4674
4703
  l({ type: Boolean, attribute: "show-steps" })
4675
- ], T.prototype, "showSteps", 2);
4704
+ ], M.prototype, "showSteps", 2);
4676
4705
  N([
4677
4706
  l({ attribute: "steps-variant" })
4678
- ], T.prototype, "stepsVariant", 2);
4707
+ ], M.prototype, "stepsVariant", 2);
4679
4708
  N([
4680
- y()
4681
- ], T.prototype, "data", 2);
4709
+ $()
4710
+ ], M.prototype, "data", 2);
4682
4711
  N([
4683
- y()
4684
- ], T.prototype, "derived", 2);
4712
+ $()
4713
+ ], M.prototype, "derived", 2);
4685
4714
  N([
4686
- y()
4687
- ], T.prototype, "current", 2);
4715
+ $()
4716
+ ], M.prototype, "current", 2);
4688
4717
  N([
4689
- y()
4690
- ], T.prototype, "approvalError", 2);
4691
- T = N([
4692
- u("baht-workflow")
4693
- ], T);
4718
+ $()
4719
+ ], M.prototype, "approvalError", 2);
4720
+ M = N([
4721
+ b("baht-workflow")
4722
+ ], M);
4694
4723
  export {
4695
- Ye as $,
4696
- nt as A,
4697
- Ot as B,
4698
- kt as C,
4699
- Ve as D,
4700
- it as E,
4701
- ft as F,
4702
- S as G,
4703
- Be as H,
4704
- Fe as I,
4724
+ Xe as $,
4725
+ ht as A,
4726
+ Ct as B,
4727
+ Pt as C,
4728
+ Ke as D,
4729
+ rt as E,
4730
+ mt as F,
4731
+ j as G,
4732
+ Ie as H,
4733
+ Ee as I,
4705
4734
  oe as J,
4706
4735
  Vt as K,
4707
- ht as L,
4736
+ ct as L,
4708
4737
  ie as M,
4709
- z as N,
4738
+ K as N,
4710
4739
  Ut as O,
4711
4740
  Gt as P,
4712
- P as Q,
4713
- De as R,
4714
- Ne as S,
4715
- Ce as T,
4716
- Ke as U,
4717
- _t as V,
4718
- E as W,
4719
- F as X,
4720
- T as Y,
4721
- ns as Z,
4722
- lt as _,
4723
- bt as a,
4724
- Na as a0,
4741
+ k as Q,
4742
+ Fe as R,
4743
+ qe as S,
4744
+ De as T,
4745
+ Ue as U,
4746
+ kt as V,
4747
+ F as W,
4748
+ D as X,
4749
+ M as Y,
4750
+ cs as Z,
4751
+ nt as _,
4752
+ ft as a,
4753
+ qa as a0,
4725
4754
  qt as a1,
4726
4755
  le as a2,
4727
- Ee as a3,
4756
+ Be as a3,
4728
4757
  be as a4,
4729
4758
  zt as b,
4730
4759
  R as c,
4731
4760
  re as d,
4732
- Pt as e,
4733
- Q as f,
4734
- ze as g,
4761
+ Ot as e,
4762
+ tt as f,
4763
+ Ve as g,
4735
4764
  ae as h,
4736
- Ue as i,
4737
- H as j,
4765
+ He as i,
4766
+ G as j,
4738
4767
  Ht as k,
4739
- Ft as l,
4768
+ Et as l,
4740
4769
  Kt as m,
4741
- Dt as n,
4742
- vt as o,
4743
- V as p,
4744
- ct as q,
4745
- Le as r,
4746
- pt as s,
4747
- Z as t,
4748
- Ct as u,
4749
- at as v,
4750
- G as w,
4751
- Re as x,
4752
- qe as y,
4753
- mt as z
4770
+ Ft as n,
4771
+ $t as o,
4772
+ U as p,
4773
+ pt as q,
4774
+ Ne as r,
4775
+ dt as s,
4776
+ Q as t,
4777
+ Dt as u,
4778
+ it as v,
4779
+ W as w,
4780
+ ze as x,
4781
+ Re as y,
4782
+ vt as z
4754
4783
  };