@tempots/beatui 0.40.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +11 -11
  2. package/dist/{2019-nWH_nAwT.cjs → 2019-BFDr925O.cjs} +1 -1
  3. package/dist/{2019-sCKLAY8c.js → 2019-DnG5Y5sm.js} +2 -2
  4. package/dist/{2020-B4xCW_nu.js → 2020-D0-tZTo7.js} +2 -2
  5. package/dist/{2020-D7RWX09D.cjs → 2020-gUs7l1CJ.cjs} +1 -1
  6. package/dist/{ar-D_4BfIJO.cjs → ar-BLgxAefV.cjs} +1 -1
  7. package/dist/{ar-i2uHmy8P.js → ar-DpQo8C31.js} +1 -1
  8. package/dist/auth/index.cjs.js +1 -1
  9. package/dist/auth/index.es.js +4 -4
  10. package/dist/beatui.css +35 -22
  11. package/dist/beatui.tailwind.css +35 -22
  12. package/dist/{de-C0PZz9sE.cjs → de-Bv-qs--J.cjs} +1 -1
  13. package/dist/{de-CeLwmVZz.js → de-D1MQ4wen.js} +1 -1
  14. package/dist/{es-C8qT1ins.cjs → es-3r8Ko5Dn.cjs} +1 -1
  15. package/dist/{es-DxOgARww.js → es-DwPjonS7.js} +1 -1
  16. package/dist/{fa-BFV9MxMX.cjs → fa-Qw6uVZeX.cjs} +1 -1
  17. package/dist/{fa-B9pEff8A.js → fa-fxf_lWjh.js} +1 -1
  18. package/dist/{fr-Caeevx56.js → fr-BDDsMHRZ.js} +1 -1
  19. package/dist/{fr-BBx5IJ7G.cjs → fr-pVhG9qik.cjs} +1 -1
  20. package/dist/{he-DeN-WW3u.js → he-B4deK_wE.js} +1 -1
  21. package/dist/{he-CMOvd4Dr.cjs → he-D-fvzfe1.cjs} +1 -1
  22. package/dist/{hi-Dey2HxiD.js → hi-CxQT8nRD.js} +1 -1
  23. package/dist/{hi-IOU_PzvH.cjs → hi-DKgxHzmH.cjs} +1 -1
  24. package/dist/{index-HqWBd-jW.js → index-Acyxme63.js} +3 -3
  25. package/dist/{index-B0ff5lT-.cjs → index-BZ2AX5sk.cjs} +2 -2
  26. package/dist/{index-DJqo6Guq.js → index-BwEJlbG2.js} +1 -1
  27. package/dist/{index-BTZqW3-b.js → index-CWq36UAJ.js} +710 -710
  28. package/dist/{index-IQ3lRaL0.js → index-Clw0AwwJ.js} +1 -1
  29. package/dist/{index-C2VAPX2b.cjs → index-DRDJFYRb.cjs} +1 -1
  30. package/dist/{index-D8fg48Fv.cjs → index-Lj0QS2po.cjs} +1 -1
  31. package/dist/{index-Dtka01mK.cjs → index-nVVPqgLq.cjs} +1 -1
  32. package/dist/index.cjs.js +4 -4
  33. package/dist/index.es.js +1862 -1865
  34. package/dist/{it-DghnQdZa.js → it-6QS5PWzQ.js} +1 -1
  35. package/dist/{it-uQF0jkDT.cjs → it-Ck0r9TO3.cjs} +1 -1
  36. package/dist/{ja-Kb7rxmFg.js → ja-D2VvVGEN.js} +1 -1
  37. package/dist/{ja-BJD6uPbl.cjs → ja-D6b9suYB.cjs} +1 -1
  38. package/dist/json-schema/index.cjs.js +1 -1
  39. package/dist/json-schema/index.es.js +1 -1
  40. package/dist/{ko-53o5WJ-v.js → ko-CP_WopWz.js} +1 -1
  41. package/dist/{ko-B7bLdRnp.cjs → ko-CzvM2Bjv.cjs} +1 -1
  42. package/dist/{modal-BRUgTJG9.cjs → modal-BmSRMdY9.cjs} +1 -1
  43. package/dist/{modal-_2B8vIo0.js → modal-DMc-R2VT.js} +2 -2
  44. package/dist/{nl-DvUVT7xd.js → nl-DZ4dFolZ.js} +1 -1
  45. package/dist/{nl-CJE0fC8g.cjs → nl-_9vJc8JD.cjs} +1 -1
  46. package/dist/{notice-C4n5jXi6.js → notice-B5Yn_3Ay.js} +89 -89
  47. package/dist/{notice-CncwkUTy.cjs → notice-D3P0lewM.cjs} +2 -2
  48. package/dist/{pl-C3oYeTwf.js → pl-BE81iFSF.js} +1 -1
  49. package/dist/{pl-DUaY5slY.cjs → pl-DKcVCojx.cjs} +1 -1
  50. package/dist/prosemirror/index.cjs.js +1 -1
  51. package/dist/prosemirror/index.es.js +1 -1
  52. package/dist/{pt-BJGeScun.js → pt-BcCdXUA2.js} +1 -1
  53. package/dist/{pt-BAqNKCuy.cjs → pt-DNVS1_MF.cjs} +1 -1
  54. package/dist/{ru-2irv1YXp.js → ru-Bo_jc3s1.js} +1 -1
  55. package/dist/{ru-CAlgJm3K.cjs → ru-DTn9Rssv.cjs} +1 -1
  56. package/dist/{toolbar-CVDXVnje.js → toolbar-DhD5GmMa.js} +1 -1
  57. package/dist/{toolbar-B7HrL0vD.cjs → toolbar-jPGzdJGi.cjs} +1 -1
  58. package/dist/{tr-DMiXAhok.cjs → tr-BhTJYHQ3.cjs} +1 -1
  59. package/dist/{tr-CkHLE5u7.js → tr-CBw3FlOg.js} +1 -1
  60. package/dist/{translations-Q5C5LyIi.js → translations-B0HuWYIz.js} +1 -1
  61. package/dist/{translations-DRNj0YIi.cjs → translations-B7_3phoA.cjs} +1 -1
  62. package/dist/translations-C21osktO.cjs +1 -0
  63. package/dist/{translations-DEEflRUY.js → translations-D-fMB_IO.js} +195 -167
  64. package/dist/types/components/form/controller/color-controller.d.ts +1 -1
  65. package/dist/types/components/form/input/color-input.d.ts +2 -5
  66. package/dist/types/components/form/input/color-swatch-input.d.ts +9 -0
  67. package/dist/types/components/form/input/index.d.ts +1 -0
  68. package/dist/types/components/form/input/input-container.d.ts +7 -0
  69. package/dist/types/utils/{color-validation.d.ts → color.d.ts} +13 -0
  70. package/dist/types/utils/index.d.ts +1 -1
  71. package/dist/{ur-BjiNs3SL.cjs → ur-BjuXyU8Z.cjs} +1 -1
  72. package/dist/{ur-bxBR_9Z-.js → ur-BsXnPgxd.js} +1 -1
  73. package/dist/utils-BOEQMy82.js +2512 -0
  74. package/dist/utils-DH-SYrQg.cjs +1 -0
  75. package/dist/{vi-CByOZvV2.cjs → vi-CvsTHMkK.cjs} +1 -1
  76. package/dist/{vi-CKknZqol.js → vi-D1rLo6MX.js} +1 -1
  77. package/dist/{zh-CmUgcP9o.js → zh-BoLsjdfz.js} +1 -1
  78. package/dist/{zh-C0QOebEA.cjs → zh-zh1FJ4Ud.cjs} +1 -1
  79. package/package.json +2 -2
  80. package/dist/translations-Dw1oO6Dh.cjs +0 -1
  81. package/dist/utils-BCbc19N0.js +0 -2427
  82. package/dist/utils-BJZipnfW.cjs +0 -1
@@ -0,0 +1,2512 @@
1
+ import { Use as W, Value as p, prop as et, html as C, OnDispose as z, attr as i, on as k, WithElement as ut, aria as U, bind as $t, computedOf as L, style as ft, When as E, NotEmpty as Qt, Fragment as B, ForEach as mt, svg as At, svgAttr as gt, Empty as T, emitValue as j, coalesce as Jt, Ensure as Kt, OneOfType as te, Repeat as Pt, signal as Ft, input as K, emitValueAsNullableDate as ee, emitValueAsNullableDateTime as ne, emitValueAsNumber as G, emit as se, Task as Bt } from "@tempots/dom";
2
+ import { f as re } from "./colors-WfmhQ5e1.js";
3
+ import { g as ae } from "./timer-DzWb416P.js";
4
+ import { ElementRect as jt, AutoSelect as le } from "@tempots/ui";
5
+ import { a as X, b as P, f as oe, I as O, C as H, c as ce, d as yt, T as ie, g as ue, L as pe, e as Vt, h as de, B as bt } from "./translations-D-fMB_IO.js";
6
+ import { C as It, m as fe, d as me, I as Ht, E as he, P as ge, S as ct, s as be, e as vt, O as at, f as Lt } from "./notice-B5Yn_3Ay.js";
7
+ function Wt(t) {
8
+ if (typeof t != "string") return !1;
9
+ const e = t.startsWith("#") ? t.slice(1) : t;
10
+ return /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(e);
11
+ }
12
+ function ve(t) {
13
+ if (typeof t != "string") return !1;
14
+ const e = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i, s = t.match(e);
15
+ if (!s) return !1;
16
+ const [, n, r, o] = s, a = parseInt(n, 10), u = parseInt(r, 10), l = parseInt(o, 10);
17
+ return a >= 0 && a <= 255 && u >= 0 && u <= 255 && l >= 0 && l <= 255;
18
+ }
19
+ function xe(t) {
20
+ if (typeof t != "string") return !1;
21
+ const e = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i, s = t.match(e);
22
+ if (!s) return !1;
23
+ const [, n, r, o, a] = s, u = parseInt(n, 10), l = parseInt(r, 10), c = parseInt(o, 10), f = parseFloat(a);
24
+ return u >= 0 && u <= 255 && l >= 0 && l <= 255 && c >= 0 && c <= 255 && f >= 0 && f <= 1;
25
+ }
26
+ function we(t) {
27
+ if (typeof t != "string") return !1;
28
+ const e = /^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/i, s = t.match(e);
29
+ if (!s) return !1;
30
+ const [, n, r, o] = s, a = parseInt(n, 10), u = parseInt(r, 10), l = parseInt(o, 10);
31
+ return a >= 0 && a <= 360 && u >= 0 && u <= 100 && l >= 0 && l <= 100;
32
+ }
33
+ function bn(t) {
34
+ return Wt(t) || ve(t) || xe(t) || we(t);
35
+ }
36
+ function _e(t) {
37
+ if (!Wt(t)) return null;
38
+ let e = t.startsWith("#") ? t.slice(1) : t;
39
+ return e.length === 3 && (e = e.split("").map((s) => s + s).join("")), `#${e.toLowerCase()}`;
40
+ }
41
+ function Ct(t, e, s) {
42
+ const n = (r) => {
43
+ const o = Math.round(Math.max(0, Math.min(255, r))).toString(16);
44
+ return o.length === 1 ? "0" + o : o;
45
+ };
46
+ return `#${n(t)}${n(e)}${n(s)}`;
47
+ }
48
+ function it(t) {
49
+ const e = _e(t);
50
+ if (!e) return null;
51
+ const s = /^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
52
+ return s ? {
53
+ r: parseInt(s[1], 16),
54
+ g: parseInt(s[2], 16),
55
+ b: parseInt(s[3], 16)
56
+ } : null;
57
+ }
58
+ function vn(t, e) {
59
+ const s = it(t), n = it(e);
60
+ if (!s || !n) return null;
61
+ const r = (c, f, b) => {
62
+ const [h, d, x] = [c, f, b].map((m) => (m = m / 255, m <= 0.03928 ? m / 12.92 : Math.pow((m + 0.055) / 1.055, 2.4)));
63
+ return 0.2126 * h + 0.7152 * d + 0.0722 * x;
64
+ }, o = r(s.r, s.g, s.b), a = r(n.r, n.g, n.b), u = Math.max(o, a), l = Math.min(o, a);
65
+ return (u + 0.05) / (l + 0.05);
66
+ }
67
+ function $e(t) {
68
+ if (!t) return [0, 0, 0, 1];
69
+ const s = t.trim().match(
70
+ /^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/
71
+ );
72
+ if (s) {
73
+ const c = s[1];
74
+ if (c.length === 8) {
75
+ const f = parseInt(c.slice(0, 2), 16), b = parseInt(c.slice(2, 4), 16), h = parseInt(c.slice(4, 6), 16), d = parseInt(c.slice(6, 8), 16) / 255;
76
+ return [f, b, h, d];
77
+ }
78
+ if (c.length === 6)
79
+ return [
80
+ parseInt(c.slice(0, 2), 16),
81
+ parseInt(c.slice(2, 4), 16),
82
+ parseInt(c.slice(4, 6), 16),
83
+ 1
84
+ ];
85
+ if (c.length === 4) {
86
+ const f = parseInt(c[0] + c[0], 16), b = parseInt(c[1] + c[1], 16), h = parseInt(c[2] + c[2], 16), d = parseInt(c[3] + c[3], 16) / 255;
87
+ return [f, b, h, d];
88
+ }
89
+ if (c.length === 3) {
90
+ const f = parseInt(c[0] + c[0], 16), b = parseInt(c[1] + c[1], 16), h = parseInt(c[2] + c[2], 16);
91
+ return [f, b, h, 1];
92
+ }
93
+ }
94
+ const n = t.match(
95
+ /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i
96
+ );
97
+ if (n)
98
+ return [
99
+ parseInt(n[1], 10),
100
+ parseInt(n[2], 10),
101
+ parseInt(n[3], 10),
102
+ parseFloat(n[4])
103
+ ];
104
+ const r = t.match(
105
+ /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i
106
+ );
107
+ if (r)
108
+ return [parseInt(r[1], 10), parseInt(r[2], 10), parseInt(r[3], 10), 1];
109
+ const o = t.match(
110
+ /^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i
111
+ );
112
+ if (o) {
113
+ const c = parseFloat(o[1]), f = parseFloat(o[2]), b = parseFloat(o[3]), h = o[4] != null ? parseFloat(o[4]) : 1, [d, x, m] = Zt(c, f / 100, b / 100);
114
+ return [d, x, m, h];
115
+ }
116
+ const a = t.match(
117
+ /^hwb\(\s*([+-]?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%\s*(?:[/]\s*(\d?(?:\.\d+)?))?\s*\)$/i
118
+ );
119
+ if (a) {
120
+ const c = parseFloat(a[1]), f = parseFloat(a[2]) / 100, b = parseFloat(a[3]) / 100, h = a[4] != null ? parseFloat(a[4]) : 1, [d, x, m] = Ce(c, f, b);
121
+ return [d, x, m, h];
122
+ }
123
+ const u = t.match(
124
+ /^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i
125
+ );
126
+ if (u) {
127
+ const c = u[1], f = parseFloat(u[2]), b = parseFloat(u[3]), h = u[4] != null ? parseFloat(u[4]) : 1, d = c.endsWith("%") ? Math.max(0, Math.min(1, parseFloat(c) / 100)) : Math.max(0, Math.min(1, parseFloat(c))), [x, m, $] = Me(d, f, b);
128
+ return [x, m, $, h];
129
+ }
130
+ const l = it(t);
131
+ return l ? [l.r, l.g, l.b, 1] : [0, 0, 0, 1];
132
+ }
133
+ function ye(t, e, s, n) {
134
+ return `rgba(${Math.round(t)}, ${Math.round(e)}, ${Math.round(s)}, ${Math.max(
135
+ 0,
136
+ Math.min(1, Math.round(n * 100) / 100)
137
+ )})`;
138
+ }
139
+ function Ie(t) {
140
+ let e = t + 1831565813;
141
+ return function() {
142
+ return e = Math.imul(e ^ e >>> 15, e | 1), e ^= e + Math.imul(e ^ e >>> 7, e | 61), ((e ^ e >>> 14) >>> 0) / 4294967296;
143
+ };
144
+ }
145
+ function Zt(t, e, s) {
146
+ t = (t % 360 + 360) % 360;
147
+ const n = (1 - Math.abs(2 * s - 1)) * e, r = n * (1 - Math.abs(t / 60 % 2 - 1)), o = s - n / 2;
148
+ let a = 0, u = 0, l = 0;
149
+ return 0 <= t && t < 60 ? [a, u, l] = [n, r, 0] : 60 <= t && t < 120 ? [a, u, l] = [r, n, 0] : 120 <= t && t < 180 ? [a, u, l] = [0, n, r] : 180 <= t && t < 240 ? [a, u, l] = [0, r, n] : 240 <= t && t < 300 ? [a, u, l] = [r, 0, n] : [a, u, l] = [n, 0, r], [
150
+ Math.round((a + o) * 255),
151
+ Math.round((u + o) * 255),
152
+ Math.round((l + o) * 255)
153
+ ];
154
+ }
155
+ function Ce(t, e, s) {
156
+ t = (t % 360 + 360) % 360;
157
+ const n = e + s;
158
+ n > 1 && (e /= n, s /= n);
159
+ const [r, o, a] = Zt(t, 1, 0.5).map((b) => b / 255), u = 1 - e - s, l = r * u + e, c = o * u + e, f = a * u + e;
160
+ return [Math.round(l * 255), Math.round(c * 255), Math.round(f * 255)];
161
+ }
162
+ function kt(t, e, s) {
163
+ t /= 255, e /= 255, s /= 255;
164
+ const n = Math.max(t, e, s), r = Math.min(t, e, s);
165
+ let o = 0, a = 0;
166
+ const u = (n + r) / 2, l = n - r;
167
+ if (l !== 0) {
168
+ switch (a = u > 0.5 ? l / (2 - n - r) : l / (n + r), n) {
169
+ case t:
170
+ o = (e - s) / l + (e < s ? 6 : 0);
171
+ break;
172
+ case e:
173
+ o = (s - t) / l + 2;
174
+ break;
175
+ default:
176
+ o = (t - e) / l + 4;
177
+ }
178
+ o *= 60;
179
+ }
180
+ return [Math.round(o), Math.round(a * 100), Math.round(u * 100)];
181
+ }
182
+ function ke(t, e, s) {
183
+ const [n] = kt(t, e, s), r = t / 255, o = e / 255, a = s / 255, u = Math.min(r, o, a), l = 1 - Math.max(r, o, a);
184
+ return [n, Math.round(u * 100), Math.round(l * 100)];
185
+ }
186
+ function xt(t) {
187
+ const e = t / 255;
188
+ return e <= 0.04045 ? e / 12.92 : Math.pow((e + 0.055) / 1.055, 2.4);
189
+ }
190
+ function wt(t) {
191
+ const e = t <= 31308e-7 ? 12.92 * t : 1.055 * Math.pow(t, 0.4166666666666667) - 0.055;
192
+ return Math.round(Math.max(0, Math.min(1, e)) * 255);
193
+ }
194
+ function Me(t, e, s) {
195
+ const n = s * Math.PI / 180, r = Math.cos(n) * e, o = Math.sin(n) * e, a = t + 0.3963377774 * r + 0.2158037573 * o, u = t - 0.1055613458 * r - 0.0638541728 * o, l = t - 0.0894841775 * r - 1.291485548 * o, c = a * a * a, f = u * u * u, b = l * l * l, h = 4.0767416621 * c - 3.3077115913 * f + 0.2309699292 * b, d = -1.2684380046 * c + 2.6097574011 * f - 0.3413193965 * b, x = -0.0041960863 * c - 0.7034186147 * f + 1.707614701 * b;
196
+ return [wt(h), wt(d), wt(x)];
197
+ }
198
+ function De(t, e, s) {
199
+ const n = xt(t), r = xt(e), o = xt(s), a = 0.4122214708 * n + 0.5363325363 * r + 0.0514459929 * o, u = 0.2119034982 * n + 0.6806995451 * r + 0.1073969566 * o, l = 0.0883024619 * n + 0.2817188376 * r + 0.6299787005 * o, c = Math.cbrt(a), f = Math.cbrt(u), b = Math.cbrt(l), h = 0.2104542553 * c + 0.793617785 * f - 0.0040720468 * b, d = 1.9779984951 * c - 2.428592205 * f + 0.4505937099 * b, x = 0.0259040371 * c + 0.7827717662 * f - 0.808675766 * b, m = Math.sqrt(d * d + x * x);
200
+ let $ = Math.atan2(x, d) * 180 / Math.PI;
201
+ return $ < 0 && ($ += 360), [h, m, $];
202
+ }
203
+ function lt(t, e, s, n, r, o) {
204
+ switch (r) {
205
+ case "hex":
206
+ if (o) {
207
+ const a = (l) => l.toString(16).padStart(2, "0"), u = Math.max(0, Math.min(255, Math.round(n * 255)));
208
+ return `#${a(t)}${a(e)}${a(s)}${a(u)}`;
209
+ }
210
+ return Ct(t, e, s);
211
+ case "rgb":
212
+ return `rgb(${t}, ${e}, ${s})`;
213
+ case "rgba":
214
+ return `rgba(${t}, ${e}, ${s}, ${Math.round(n * 100) / 100})`;
215
+ case "hsl": {
216
+ const [a, u, l] = kt(t, e, s);
217
+ return `hsl(${a}, ${u}%, ${l}%)`;
218
+ }
219
+ case "hsla": {
220
+ const [a, u, l] = kt(t, e, s);
221
+ return `hsla(${a}, ${u}%, ${l}%, ${Math.round(n * 100) / 100})`;
222
+ }
223
+ case "hwb": {
224
+ const [a, u, l] = ke(t, e, s);
225
+ return n < 1 ? `hwb(${a} ${u}% ${l}% / ${Math.round(n * 100) / 100})` : `hwb(${a} ${u}% ${l}%)`;
226
+ }
227
+ case "oklch": {
228
+ const [a, u, l] = De(t, e, s), c = (Math.round(a * 1e3) / 1e3).toFixed(3), f = (Math.round(u * 1e3) / 1e3).toFixed(3), b = (Math.round(l * 10) / 10).toFixed(1), h = Math.round(n * 100) / 100;
229
+ return o || n < 1 ? `oklch(${c} ${f} ${b} / ${h})` : `oklch(${c} ${f} ${b})`;
230
+ }
231
+ }
232
+ }
233
+ function ot(t, e) {
234
+ return e ? t === "rgb" ? "rgba" : t === "hsl" ? "hsla" : t : t === "rgba" ? "rgb" : t === "hsla" ? "hsl" : t;
235
+ }
236
+ class Se extends Error {
237
+ constructor(e = "Missing implementation") {
238
+ super(e), this.name = "MissingImplementationError";
239
+ }
240
+ }
241
+ const xn = (t) => Te(t).split("_").join(" "), Te = (t) => (t = t.replace(/::/g, "/"), t = t.replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2"), t = t.replace(/([a-z\d])([A-Z])/g, "$1_$2"), t = t.replace(/-/g, "_"), t.toLowerCase()), wn = (t) => t.substring(0, 1).toUpperCase() + t.substring(1), Ae = (t) => {
242
+ if (typeof Buffer < "u")
243
+ return Buffer.from(t, "base64").toString("utf8");
244
+ if (typeof atob < "u")
245
+ return atob(t);
246
+ throw new Se(
247
+ "No implementation found for base64 decoding"
248
+ );
249
+ };
250
+ function Et({
251
+ onChange: t,
252
+ value: e,
253
+ accept: s = "*/*",
254
+ enableClick: n = !0,
255
+ content: r,
256
+ disabled: o = !1,
257
+ allowMultiple: a
258
+ }) {
259
+ return W(X, (u) => {
260
+ const l = p.deriveProp(e ?? []), c = et(!1), f = (v) => {
261
+ v.preventDefault(), v.stopPropagation(), c.value = !0;
262
+ }, b = (v) => {
263
+ v.preventDefault(), v.stopPropagation(), (!v.currentTarget || !v.currentTarget.contains(v.relatedTarget)) && (c.value = !1);
264
+ }, h = (v) => {
265
+ v.preventDefault(), v.stopPropagation(), c.value = !1;
266
+ const g = Array.from(v.dataTransfer?.files || []);
267
+ g.length > 0 && (l.value = g, t(g));
268
+ }, d = (v) => {
269
+ p.get(n) && v.currentTarget.querySelector(
270
+ 'input[type="file"]'
271
+ )?.click();
272
+ };
273
+ let x = null;
274
+ const m = () => {
275
+ if (x == null) return;
276
+ const v = Array.from(x.files ?? []);
277
+ v.length > 0 && (l.value = v, t(v)), x.value = "";
278
+ }, $ = (v) => {
279
+ p.get(n) && (v.key === "Enter" || v.key === " ") && (v.preventDefault(), d(v));
280
+ };
281
+ return C.div(
282
+ z(() => p.dispose(l), c),
283
+ i.role("button"),
284
+ i.tabindex(
285
+ p.map(n, (v) => v ? 0 : -1)
286
+ ),
287
+ i.style("position: relative;"),
288
+ k.dragover(f),
289
+ k.dragleave(b),
290
+ k.drop(h),
291
+ k.click(d),
292
+ k.keydown($),
293
+ // Hidden file input
294
+ C.input(
295
+ i.type("file"),
296
+ i.disabled(o),
297
+ i.accept(s),
298
+ i.multiple(a),
299
+ i.style(
300
+ "position: absolute; left: -9999px; opacity: 0; pointer-events: none;"
301
+ ),
302
+ k.change(m),
303
+ ut((v) => (x = v, z(
304
+ l.on((g) => {
305
+ const D = globalThis.DataTransfer;
306
+ if (D != null) {
307
+ const I = new D();
308
+ g.forEach((_) => I.items.add(_)), v.files = I.files;
309
+ }
310
+ })
311
+ )))
312
+ ),
313
+ // Screen reader instructions
314
+ U.label($t(u.$.dropZoneInstructions)(n)),
315
+ // Content
316
+ r({ files: l, clear: () => l.value = [], change: l.set })
317
+ );
318
+ });
319
+ }
320
+ function Fe(t, e) {
321
+ return t.length === e.length && t.every((s, n) => s === e[n]);
322
+ }
323
+ function Be(t, e) {
324
+ const s = ["bc-segmented-control", `bc-segmented-control--size-${t}`];
325
+ return e && s.push("bc-segmented-control--disabled"), s.join(" ");
326
+ }
327
+ function _n({
328
+ options: t,
329
+ value: e,
330
+ onChange: s,
331
+ size: n = "md",
332
+ disabled: r = !1
333
+ }, ...o) {
334
+ const a = re(t).map(([u, l]) => ({
335
+ key: u,
336
+ label: l
337
+ }));
338
+ return ut(() => {
339
+ const u = Object.fromEntries(
340
+ a.map((c, f) => [c.key, f])
341
+ ), l = et(
342
+ a.map(() => ({ left: 0, width: 0 })),
343
+ Fe
344
+ );
345
+ return C.div(
346
+ z(l),
347
+ i.class(
348
+ L(
349
+ n,
350
+ r
351
+ )(
352
+ (c, f) => Be(c ?? "md", f ?? !1)
353
+ )
354
+ ),
355
+ C.div(
356
+ i.class("bc-segmented-control__container"),
357
+ C.div(
358
+ i.class("bc-segmented-control__indicator"),
359
+ ft.width(
360
+ L(
361
+ e,
362
+ l
363
+ )((c, f) => {
364
+ const { width: b } = f[u[c] ?? 0];
365
+ return `${b}px`;
366
+ })
367
+ ),
368
+ ft.left(
369
+ L(
370
+ e,
371
+ l
372
+ )((c, f) => {
373
+ const { left: b } = f[u[c] ?? 0];
374
+ return `${b}px`;
375
+ })
376
+ )
377
+ ),
378
+ // clickable buttons
379
+ a.map(({ label: c, key: f }, b) => C.button(
380
+ i.type("button"),
381
+ k.click((h) => {
382
+ h.preventDefault(), p.get(r) || s?.(f);
383
+ }),
384
+ i.disabled(r),
385
+ i.class("bc-segmented-control__segment"),
386
+ i.class(
387
+ p.map(e, (h) => h === f ? "bc-segmented-control__segment--active" : "bc-segmented-control__segment--inactive")
388
+ ),
389
+ jt((h) => {
390
+ function d() {
391
+ l.update((m) => {
392
+ const $ = [...m];
393
+ return $[b] = {
394
+ width: h.value.width,
395
+ left: h.value.localLeft
396
+ }, $;
397
+ });
398
+ }
399
+ const x = ae(d);
400
+ return z(x, h.on(d));
401
+ }),
402
+ c
403
+ ))
404
+ ),
405
+ ...o
406
+ );
407
+ });
408
+ }
409
+ function Ve(t) {
410
+ const e = t.type.toLowerCase();
411
+ return e.startsWith("image/") && (e.includes("jpeg") || e.includes("jpg") || e.includes("png") || e.includes("gif") || e.includes("webp") || e.includes("svg"));
412
+ }
413
+ function Le(t) {
414
+ const e = t.type.toLowerCase();
415
+ return e.startsWith("image/") ? "vscode-icons:file-type-image" : e.startsWith("video/") ? "vscode-icons:file-type-video" : e.startsWith("audio/") ? "vscode-icons:file-type-audio" : e.includes("pdf") ? "vscode-icons:file-type-pdf2" : e.includes("word") || e.includes("document") ? "vscode-icons:file-type-word" : e.includes("excel") || e.includes("spreadsheet") ? "vscode-icons:file-type-excel" : e.includes("powerpoint") || e.includes("presentation") ? "vscode-icons:file-type-powerpoint" : e.includes("zip") || e.includes("archive") ? "vscode-icons:file-type-zip" : e.includes("text") ? "vscode-icons:file-type-text" : e.includes("json") ? "vscode-icons:file-type-json-official" : e.includes("csv") ? "vscode-icons:file-type-csv" : e.includes("xml") ? "vscode-icons:file-type-xml" : e.includes("yaml") ? "vscode-icons:file-type-yaml-official" : "vscode-icons:file-type-binary";
416
+ }
417
+ function Rt(t) {
418
+ return E(
419
+ t.map(Ve),
420
+ () => {
421
+ const e = et(null);
422
+ return t.on((s) => {
423
+ e.value && URL.revokeObjectURL(e.value);
424
+ const n = URL.createObjectURL(s);
425
+ e.value = n;
426
+ }), C.div(
427
+ z(e, () => {
428
+ e.value && URL.revokeObjectURL(e.value);
429
+ }),
430
+ i.class("bc-file-input__thumbnail-container"),
431
+ C.img(
432
+ i.src(e),
433
+ i.alt(t.map((s) => s.name)),
434
+ i.class("bc-file-input__thumbnail")
435
+ )
436
+ );
437
+ },
438
+ () => O({ icon: t.map(Le) })
439
+ );
440
+ }
441
+ const Ee = (t, ...e) => {
442
+ const {
443
+ value: s = et([]),
444
+ accept: n = "*/*",
445
+ maxFiles: r,
446
+ maxFileSize: o,
447
+ onChange: a,
448
+ onBlur: u,
449
+ disabled: l,
450
+ hasError: c,
451
+ mode: f = "default",
452
+ showFileList: b = !0,
453
+ ...h
454
+ } = t, d = s, x = p.map(f, (I) => I === "compact"), m = (I) => {
455
+ let _ = I;
456
+ if (r != null) {
457
+ const w = p.get(r);
458
+ _ = _.slice(0, w);
459
+ }
460
+ if (o) {
461
+ const w = p.get(o);
462
+ _ = _.filter((y) => y.size <= w);
463
+ }
464
+ a?.(_);
465
+ }, $ = (I) => {
466
+ const w = d.value.filter((y, M) => M !== I);
467
+ a?.(w);
468
+ }, v = () => {
469
+ a?.([]);
470
+ }, g = ({
471
+ files: I,
472
+ clear: _,
473
+ change: w
474
+ }) => W(
475
+ X,
476
+ (y) => C.div(
477
+ i.class("bc-file-input__drop-zone"),
478
+ C.div(
479
+ i.class(
480
+ "bc-file-input__drop-zone-content bc-file-input__drop-zone-content--empty"
481
+ ),
482
+ O({ icon: "mdi:cloud-upload-outline", size: "xl" }),
483
+ C.div(
484
+ i.class("bc-file-input__drop-zone-text"),
485
+ $t(y.$.filesInputInstructions)(
486
+ r,
487
+ o,
488
+ y.$.fileSizeUnits.value
489
+ )
490
+ )
491
+ )
492
+ )
493
+ ), D = ({
494
+ files: I
495
+ }) => W(
496
+ X,
497
+ (_) => C.div(
498
+ i.class("bc-file-input__compact-input"),
499
+ E(
500
+ I.map((w) => w.length > 0),
501
+ () => C.span(
502
+ i.class("bc-file-input__compact-value"),
503
+ mt(
504
+ I,
505
+ (w) => C.span(
506
+ i.class("bc-file-input__compact-value-item"),
507
+ Rt(w),
508
+ C.span(
509
+ i.class("bc-file-input__compact-value-item-name"),
510
+ w.$.name
511
+ )
512
+ )
513
+ )
514
+ ),
515
+ () => C.span(
516
+ i.class("bc-file-input__compact-placeholder"),
517
+ O({ icon: "mdi:cloud-upload-outline", size: "md" }),
518
+ " ",
519
+ $t(_.$.filesInputInstructions)(
520
+ r,
521
+ o,
522
+ _.$.fileSizeUnits.value
523
+ )
524
+ )
525
+ )
526
+ )
527
+ );
528
+ return W(
529
+ X,
530
+ (I) => P(
531
+ {
532
+ baseContainer: p.map(x, (_) => !_),
533
+ disabled: l,
534
+ hasError: c,
535
+ after: E(
536
+ x,
537
+ () => E(
538
+ d.map(({ length: _ }) => _ > 0),
539
+ () => It(
540
+ {
541
+ size: "sm",
542
+ label: I.$.clearAllFiles,
543
+ disabled: l,
544
+ onClick: v
545
+ },
546
+ i.class("bc-file-input__compact-clear")
547
+ )
548
+ )
549
+ ),
550
+ ...h,
551
+ input: E(
552
+ x,
553
+ () => C.div(
554
+ i.class("bc-file-input bc-file-input--compact"),
555
+ Et({
556
+ value: d,
557
+ accept: n,
558
+ enableClick: !0,
559
+ allowMultiple: p.map(r ?? 1 / 0, (_) => _ > 1),
560
+ disabled: l,
561
+ onChange: m,
562
+ content: D
563
+ })
564
+ ),
565
+ () => C.div(
566
+ i.class("bc-file-input"),
567
+ Et({
568
+ value: d,
569
+ accept: n,
570
+ enableClick: !0,
571
+ allowMultiple: p.map(r ?? 1 / 0, (_) => _ > 1),
572
+ disabled: l,
573
+ onChange: m,
574
+ content: g
575
+ }),
576
+ E(
577
+ b,
578
+ () => Qt(
579
+ d,
580
+ () => B(
581
+ C.div(
582
+ i.class("bc-file-input__file-list"),
583
+ mt(d, (_, w) => {
584
+ const y = w.index;
585
+ return C.div(
586
+ i.class("bc-file-input__file-item"),
587
+ C.div(
588
+ i.class("bc-file-input__file-icon"),
589
+ Rt(_)
590
+ ),
591
+ C.div(
592
+ i.class("bc-file-input__file-info"),
593
+ C.div(
594
+ i.class("bc-file-input__file-name"),
595
+ i.title(_.$.name),
596
+ _.$.name
597
+ ),
598
+ C.div(
599
+ i.class("bc-file-input__file-meta"),
600
+ L(
601
+ _.$.size,
602
+ I.$.fileSizeUnits
603
+ )(
604
+ (M, A) => oe(M, { units: A })
605
+ ),
606
+ " • ",
607
+ L(
608
+ _.$.type,
609
+ I.$.unknownType
610
+ )((M, A) => M || A)
611
+ )
612
+ ),
613
+ It(
614
+ {
615
+ size: "sm",
616
+ label: I.$.removeFile,
617
+ disabled: l,
618
+ onClick: () => $(y)
619
+ },
620
+ i.class("bc-file-input__remove-button")
621
+ )
622
+ );
623
+ })
624
+ ),
625
+ E(
626
+ d.map(({ length: _ }) => _ > 1),
627
+ () => C.div(
628
+ i.class(
629
+ "bc-file-input__clear-all-button-container"
630
+ ),
631
+ C.button(
632
+ i.type("button"),
633
+ i.class("bc-file-input__clear-all-button"),
634
+ i.disabled(l),
635
+ I.$.clearAllFiles,
636
+ k.click((_) => {
637
+ _.preventDefault(), _.stopPropagation(), v();
638
+ })
639
+ )
640
+ )
641
+ )
642
+ )
643
+ )
644
+ )
645
+ )
646
+ )
647
+ },
648
+ ...e
649
+ )
650
+ );
651
+ };
652
+ async function Re(t) {
653
+ return new Promise((e, s) => {
654
+ const n = new FileReader();
655
+ n.readAsDataURL(t), n.onload = () => {
656
+ const r = n.result;
657
+ e(r.split(",")[1]);
658
+ }, n.onerror = (r) => s(r);
659
+ });
660
+ }
661
+ function ze(t) {
662
+ return Promise.all(t.map(Re));
663
+ }
664
+ function Ue(t) {
665
+ if (t.length >= 4) {
666
+ if (t[0] === 137 && t[1] === 80 && t[2] === 78 && t[3] === 71)
667
+ return "image/png";
668
+ if (t[0] === 255 && t[1] === 216) return "image/jpeg";
669
+ if (t[0] === 71 && t[1] === 73 && t[2] === 70)
670
+ return "image/gif";
671
+ if (t[0] === 82 && t[1] === 73 && t[2] === 70 && t[3] === 70 && t.length >= 12 && t[8] === 87 && t[9] === 69 && t[10] === 66 && t[11] === 80)
672
+ return "image/webp";
673
+ }
674
+ try {
675
+ if (new TextDecoder("utf-8").decode(t.slice(0, 256)).includes("<svg")) return "image/svg+xml";
676
+ } catch {
677
+ }
678
+ return "application/octet-stream";
679
+ }
680
+ function Ne(t) {
681
+ const e = Ae(t ?? ""), s = e.length, n = new Uint8Array(s);
682
+ for (let r = 0; r < s; r++) n[r] = e.charCodeAt(r);
683
+ return n;
684
+ }
685
+ function Oe(t) {
686
+ const {
687
+ value: e,
688
+ onChange: s,
689
+ onInput: n,
690
+ ...r
691
+ } = t, o = /* @__PURE__ */ new Map(), a = p.toSignal(e).map((f) => f.map((b, h) => {
692
+ const d = o.get(b), x = Ne(b ?? ""), m = d?.type || Ue(x), $ = d?.name ?? `file-${h}`, v = x.buffer.slice(
693
+ x.byteOffset,
694
+ x.byteOffset + x.byteLength
695
+ ), g = new Blob([v], { type: m });
696
+ return new File([g], $, { type: m });
697
+ })), u = (f) => (b) => {
698
+ f && ze(b).then((h) => {
699
+ for (const [d, x] of h.entries())
700
+ o.set(x, { name: b[d].name, type: b[d].type });
701
+ f(h);
702
+ });
703
+ }, l = u(s), c = u(n);
704
+ return Ee({
705
+ ...r,
706
+ value: a,
707
+ onChange: l,
708
+ onInput: c
709
+ });
710
+ }
711
+ function $n(t) {
712
+ const {
713
+ value: e,
714
+ onInput: s,
715
+ onChange: n,
716
+ ...r
717
+ } = t;
718
+ return Oe({
719
+ ...r,
720
+ maxFiles: 1,
721
+ value: p.map(e, (o) => o == null ? [] : [o]),
722
+ onChange: (o) => {
723
+ n?.(o[0]);
724
+ },
725
+ onInput: (o) => {
726
+ s?.(o[0]);
727
+ }
728
+ });
729
+ }
730
+ function Pe(t, e) {
731
+ const [s, n, r] = t, o = s << 16 ^ n << 8 ^ r, a = Ie(o), u = 6 + Math.floor(a() * 5), l = 0.18 + a() * 0.06, c = [];
732
+ for (let d = 0; d < u; d++) {
733
+ const x = d / u * Math.PI * 2, m = e * (1 + (a() * 2 - 1) * l), $ = Math.cos(x) * m, v = Math.sin(x) * m;
734
+ c.push({ x: $, y: v });
735
+ }
736
+ const f = (c[0].x + c[u - 1].x) / 2, b = (c[0].y + c[u - 1].y) / 2;
737
+ let h = `M ${f.toFixed(3)} ${b.toFixed(3)}`;
738
+ for (let d = 0; d < u; d++) {
739
+ const x = c[d], m = c[(d + 1) % u], $ = (x.x + m.x) / 2, v = (x.y + m.y) / 2;
740
+ h += ` Q ${x.x.toFixed(3)} ${x.y.toFixed(3)} ${$.toFixed(3)} ${v.toFixed(3)}`;
741
+ }
742
+ return h += " Z", h;
743
+ }
744
+ const yn = (t) => {
745
+ const { value: e, onBlur: s, onChange: n, onInput: r, displayValue: o, size: a, withAlpha: u } = t, l = p.map(a ?? 32, (w) => w), c = p.map(e, (w) => $e(w ?? "#000000")), f = p.map(
746
+ c,
747
+ ([w, y, M]) => [w, y, M]
748
+ ), b = p.map(c, ([, , , w]) => w), h = et(p.get(b) ?? 1), d = p.map(u ?? !1, (w) => w), x = p.map(
749
+ t.colorTextFormat ?? "rgb",
750
+ (w) => w
751
+ ), m = L(
752
+ f,
753
+ h,
754
+ x,
755
+ d
756
+ )(
757
+ ([w, y, M], A, F, S) => lt(w, y, M, A ?? 1, ot(F, S), S)
758
+ ), $ = p.map(
759
+ t.colorTextFormat ?? "hex",
760
+ (w) => w
761
+ ), v = p.map(l, (w) => `${-w / 2} ${-w / 2} ${w} ${w}`), g = L(
762
+ f,
763
+ l
764
+ )((w, y) => Pe(w, y / 2)), D = L(
765
+ f,
766
+ h,
767
+ d
768
+ )(
769
+ ([w, y, M], A, F) => F || A < 1 ? ye(w, y, M, A) : Ct(w, y, M)
770
+ ), I = C.div(
771
+ i.class("bc-color-swatch-input__control"),
772
+ i.class(
773
+ p.map(
774
+ d,
775
+ (w) => w ? "bc-color-swatch-input__control--alpha" : ""
776
+ )
777
+ ),
778
+ i.style(
779
+ L(l)((w) => `min-width:${w + 2}px;height:${w + 2}px`)
780
+ ),
781
+ // The SVG blob preview
782
+ At.svg(
783
+ i.class("bc-color-swatch-input__svg"),
784
+ gt.viewBox(v),
785
+ At.path(gt.d(g), gt.fill(D))
786
+ ),
787
+ // Invisible native input overlays the blob for picker and accessibility
788
+ C.input(
789
+ i.type("color"),
790
+ H(t),
791
+ // Native color input needs hex without alpha
792
+ i.value(p.map(f, ([w, y, M]) => Ct(w, y, M))),
793
+ i.class(
794
+ "bc-input bc-color-swatch-input bc-color-swatch-input__native"
795
+ ),
796
+ s != null ? k.blur(s) : T,
797
+ n != null ? k.change((w) => {
798
+ const y = w.target.value;
799
+ if (!n) return;
800
+ const { r: M, g: A, b: F } = it(y) ?? { r: 0, g: 0, b: 0 }, S = p.get(h) ?? 1, V = ot(
801
+ p.get($),
802
+ p.get(d)
803
+ ), N = lt(M, A, F, S, V, p.get(d));
804
+ n(N);
805
+ }) : T,
806
+ r != null ? k.input((w) => {
807
+ const y = w.target.value;
808
+ if (!r) return;
809
+ const { r: M, g: A, b: F } = it(y) ?? { r: 0, g: 0, b: 0 }, S = p.get(h) ?? 1, V = ot(
810
+ p.get($),
811
+ p.get(d)
812
+ ), N = lt(M, A, F, S, V, p.get(d));
813
+ r(N);
814
+ }) : T
815
+ )
816
+ ), _ = E(
817
+ d,
818
+ () => C.input(
819
+ i.type("range"),
820
+ i.class("bc-color-swatch-input__alpha"),
821
+ i.min(0),
822
+ i.max(1),
823
+ i.step(0.01),
824
+ i.value(p.map(h, (w) => String(w ?? 1))),
825
+ i.disabled(t.disabled),
826
+ k.input((w) => {
827
+ const y = parseFloat(w.target.value);
828
+ h.set(y);
829
+ const [M, A, F] = p.get(f), S = ot(
830
+ p.get($),
831
+ p.get(d)
832
+ ), V = lt(M, A, F, y, S, p.get(d));
833
+ r?.(V);
834
+ }),
835
+ k.change((w) => {
836
+ const y = parseFloat(w.target.value);
837
+ h.set(y);
838
+ const [M, A, F] = p.get(f), S = ot(
839
+ p.get($),
840
+ p.get(d)
841
+ ), V = lt(M, A, F, y, S, p.get(d));
842
+ n?.(V);
843
+ })
844
+ )
845
+ );
846
+ return P({
847
+ baseContainer: !0,
848
+ ...t,
849
+ // ensure our control does not try to grow
850
+ growInput: !1,
851
+ input: I,
852
+ // If caller provided an `after`, append RGB before it
853
+ after: B(
854
+ E(
855
+ o ?? !1,
856
+ () => C.span(i.class("bc-color-swatch-input__rgb"), m)
857
+ ),
858
+ _,
859
+ t.after
860
+ )
861
+ });
862
+ }, Dt = "$$tts-exp-", je = (t, e) => ut((s) => {
863
+ const n = `${Dt}${t}`;
864
+ return z(p.on(e, (r) => Reflect.set(s, n, r)));
865
+ }), In = (t, e) => {
866
+ const s = `${Dt}${t}`;
867
+ return (n) => {
868
+ e(Reflect.get(n.target, s));
869
+ };
870
+ }, He = (t, e) => {
871
+ const s = `${Dt}${t}`;
872
+ return (n) => {
873
+ const r = n.target, o = r.selectedIndex, a = r.options[o];
874
+ e(Reflect.get(a, s));
875
+ };
876
+ };
877
+ function We(t, e, s) {
878
+ const n = ["bc-card"];
879
+ return t !== "default" && n.push(`bc-card--${t}`), e !== "md" && n.push(`bc-card--padding-${e}`), s !== "lg" && n.push(`bc-card--rounded-${s}`), n.join(" ");
880
+ }
881
+ function Cn({ variant: t = "default", size: e = "md", roundedness: s = "lg" } = {}, ...n) {
882
+ return C.div(
883
+ i.class(
884
+ L(
885
+ t,
886
+ e,
887
+ s
888
+ )(
889
+ (r, o, a) => We(
890
+ r ?? "default",
891
+ o ?? "md",
892
+ a ?? "lg"
893
+ )
894
+ )
895
+ ),
896
+ ...n
897
+ );
898
+ }
899
+ function dt(...t) {
900
+ return C.div(i.class("bc-group"), ...t);
901
+ }
902
+ const kn = ({
903
+ startEditing: t,
904
+ value: e,
905
+ onChange: s,
906
+ placeholder: n,
907
+ disabled: r
908
+ }) => {
909
+ const o = p.deriveProp(t ?? !1), a = et(!1), u = p.map(r ?? !1, (l) => l);
910
+ return C.div(
911
+ z(o, a, () => p.dispose(u)),
912
+ i.class("bc-editable-text"),
913
+ i.class(
914
+ p.map(
915
+ u,
916
+ (l) => l ? "bc-editable-text--disabled" : ""
917
+ )
918
+ ),
919
+ U.disabled(u),
920
+ E(
921
+ o,
922
+ () => C.input(
923
+ i.placeholder(n),
924
+ i.value(e),
925
+ i.class("bc-editable-text__input"),
926
+ le(),
927
+ k.keydown((l) => {
928
+ l.key === "Enter" ? o.set(!1) : l.key === "Escape" && (a.set(!0), o.set(!1));
929
+ }),
930
+ k.blur(
931
+ j((l) => {
932
+ if (o.set(!1), a.value) {
933
+ a.set(!1);
934
+ return;
935
+ }
936
+ s(l);
937
+ })
938
+ )
939
+ ),
940
+ () => C.span(
941
+ k.click(() => {
942
+ p.get(u) || o.set(!0);
943
+ }),
944
+ i.class("bc-editable-text__display"),
945
+ E(
946
+ p.map(e, (l) => l != null && l.trim() !== ""),
947
+ () => C.span(i.class("bc-editable-text__text"), e),
948
+ () => C.span(
949
+ i.class("bc-editable-text__placeholder"),
950
+ n
951
+ )
952
+ ),
953
+ E(
954
+ p.map(u, (l) => !l),
955
+ () => C.button(
956
+ i.type("button"),
957
+ i.class("bc-editable-text__edit-button"),
958
+ W(X, (l) => U.label(l.$.editLabel)),
959
+ k.click(() => o.set(!0)),
960
+ O({ icon: "line-md/pencil", color: "neutral" })
961
+ )
962
+ )
963
+ )
964
+ )
965
+ );
966
+ }, Yt = (t, e, s) => Kt(
967
+ t,
968
+ (n) => te(n, {
969
+ value: (r) => {
970
+ const o = L(
971
+ r,
972
+ s
973
+ )((a, u) => e(a.value, u));
974
+ return C.option(
975
+ z(o.dispose),
976
+ i.selected(o),
977
+ je("value", r.$.value),
978
+ r.$.label
979
+ );
980
+ },
981
+ group: (r) => C.optgroup(
982
+ i.label(r.$.group),
983
+ mt(
984
+ r.$.options,
985
+ (o) => Yt(
986
+ o,
987
+ e,
988
+ s
989
+ )
990
+ )
991
+ ),
992
+ break: () => C.hr()
993
+ })
994
+ ), Ze = (t) => {
995
+ const {
996
+ value: e,
997
+ onBlur: s,
998
+ onChange: n,
999
+ options: r,
1000
+ unselectedLabel: o,
1001
+ equality: a = (c, f) => c === f,
1002
+ after: u
1003
+ } = t;
1004
+ let l;
1005
+ return P(
1006
+ {
1007
+ ...t,
1008
+ after: B(
1009
+ ce({
1010
+ icon: "ph:caret-down-bold",
1011
+ color: "neutral",
1012
+ size: "sm"
1013
+ }),
1014
+ u
1015
+ ),
1016
+ input: C.select(
1017
+ ut((c) => {
1018
+ l = c;
1019
+ const f = new MutationObserver((b) => {
1020
+ const { removedNodes: h } = b[0];
1021
+ h.length > 0 && (l.selectedIndex = 0);
1022
+ });
1023
+ return f.observe(c, { childList: !0 }), z(() => f.disconnect());
1024
+ }),
1025
+ H(t),
1026
+ i.class("bc-native-select bc-input"),
1027
+ W(
1028
+ X,
1029
+ (c) => C.option(
1030
+ i.hidden("hidden"),
1031
+ Jt(o, c.$.selectOne)
1032
+ )
1033
+ ),
1034
+ mt(r, (c) => Yt(c, a, e)),
1035
+ s != null ? k.blur(s) : T,
1036
+ n != null ? k.change(He("value", (c) => n(c))) : T
1037
+ )
1038
+ },
1039
+ k.click(() => {
1040
+ l?.focus(), typeof l?.showPicker == "function" && l.showPicker();
1041
+ })
1042
+ );
1043
+ };
1044
+ function Ye(t) {
1045
+ const { controller: e, onChange: s, onBlur: n, ...r } = t;
1046
+ return Ze({
1047
+ ...r,
1048
+ value: e.signal,
1049
+ onChange: me(e, s),
1050
+ onBlur: fe(e, n)
1051
+ });
1052
+ }
1053
+ function Mn(t) {
1054
+ return Ht({
1055
+ ...t,
1056
+ content: Ye(t)
1057
+ });
1058
+ }
1059
+ function Xe(t, e, s) {
1060
+ const n = t.length.map((r) => r);
1061
+ return B(
1062
+ z(() => n.dispose()),
1063
+ Pt(
1064
+ n,
1065
+ (r) => {
1066
+ const o = t.item(r.index), a = [];
1067
+ return B(
1068
+ z(() => {
1069
+ o.dispose(), a.forEach((u) => u());
1070
+ }),
1071
+ e({
1072
+ list: t,
1073
+ item: o,
1074
+ position: r,
1075
+ remove: () => t.removeAt(r.index),
1076
+ move: (u) => {
1077
+ switch (u) {
1078
+ case "up":
1079
+ if (r.index === 0) return;
1080
+ t.move(r.index, r.index - 1);
1081
+ break;
1082
+ case "down":
1083
+ if (r.index === t.length.value - 1) return;
1084
+ t.move(r.index, r.index + 1);
1085
+ break;
1086
+ case "first":
1087
+ t.move(r.index, 0);
1088
+ break;
1089
+ case "last":
1090
+ t.move(r.index, t.length.value - 1);
1091
+ }
1092
+ },
1093
+ canMove: (u) => {
1094
+ const l = (() => {
1095
+ switch (u) {
1096
+ case "up":
1097
+ return Ft(r.index > 0);
1098
+ case "down":
1099
+ return t.length.map((c) => r.index < c - 1);
1100
+ }
1101
+ })();
1102
+ return a.push(() => l.dispose()), l;
1103
+ },
1104
+ cannotMove: (u) => {
1105
+ const l = (() => {
1106
+ switch (u) {
1107
+ case "up":
1108
+ return Ft(r.index === 0);
1109
+ case "down":
1110
+ return t.length.map((c) => r.index === c - 1);
1111
+ }
1112
+ })();
1113
+ return a.push(() => l.dispose()), l;
1114
+ }
1115
+ })
1116
+ );
1117
+ },
1118
+ s
1119
+ )
1120
+ );
1121
+ }
1122
+ const zt = {
1123
+ 9: { pattern: /^[0-9]$/ },
1124
+ A: { pattern: /^[A-Za-z]$/, transform: (t) => t.toUpperCase() },
1125
+ "*": { pattern: /^.$/ }
1126
+ }, qe = (t) => t instanceof RegExp;
1127
+ function Xt(t, e, s) {
1128
+ if (t == null) return [];
1129
+ const n = s ? { ...zt, ...e } : e ?? zt, r = (a, u) => {
1130
+ const l = n[u];
1131
+ l ? a.push({ type: "pattern", name: u, ...l }) : a.push({ type: "literal", char: u });
1132
+ }, o = [];
1133
+ if (typeof t == "string") {
1134
+ for (const a of t) r(o, a);
1135
+ return o;
1136
+ }
1137
+ for (const a of t)
1138
+ if (typeof a == "string")
1139
+ if (a.length <= 1) r(o, a);
1140
+ else for (const u of a) r(o, u);
1141
+ else qe(a) ? o.push({ type: "pattern", pattern: a }) : typeof a == "object" && a && o.push(a);
1142
+ return o;
1143
+ }
1144
+ function Ge(t, e) {
1145
+ return (s) => {
1146
+ switch (t) {
1147
+ case "digits":
1148
+ return /[0-9]/.test(s);
1149
+ case "letters":
1150
+ return /[A-Za-z]/.test(s);
1151
+ case "alphanumeric":
1152
+ return /[A-Za-z0-9]/.test(s);
1153
+ case "custom":
1154
+ return e?.(s) ?? !0;
1155
+ default:
1156
+ return !0;
1157
+ }
1158
+ };
1159
+ }
1160
+ function Ut(t, e, s, n, r, o) {
1161
+ const a = {
1162
+ raw: t,
1163
+ previousConformed: e,
1164
+ cursor: r ?? t.length,
1165
+ completed: !1
1166
+ }, u = n.definitions ?? {}, l = typeof s == "function" ? s(t, a) : s, c = Xt(
1167
+ l,
1168
+ u,
1169
+ n.useDefaultDefinitions ?? !0
1170
+ ), f = Ge(n.allowMode, n.allow), b = /* @__PURE__ */ new Set();
1171
+ for (const S of c) S.type === "literal" && b.add(S.char);
1172
+ if (n.prefix) for (const S of n.prefix) b.add(S);
1173
+ if (n.suffix) for (const S of n.suffix) b.add(S);
1174
+ const h = Array.from(t).filter((S) => f(S) && !b.has(S));
1175
+ if (h.length === 0) return { value: "", cursor: 0, completed: !1 };
1176
+ const d = [], x = [];
1177
+ let m = 0, $ = 0, v = 0, g = -1;
1178
+ for (const S of c) {
1179
+ if (S.type === "literal") {
1180
+ d.push(S.char), x.push({ kind: "literal", filled: !0 });
1181
+ continue;
1182
+ }
1183
+ $ += S.optional ? 0 : 1;
1184
+ const V = h[m];
1185
+ if (V == null)
1186
+ break;
1187
+ if (S.type === "any") {
1188
+ v++, d.push(S.transform ? S.transform(V) : V), x.push({ kind: "slot", filled: !0 }), g = x.length - 1, m++;
1189
+ continue;
1190
+ }
1191
+ if (S.type === "pattern")
1192
+ if (S.pattern.test(V)) {
1193
+ v++;
1194
+ const N = S.transform ? S.transform(V) : V;
1195
+ d.push(N), x.push({ kind: "slot", filled: !0 }), g = x.length - 1, m++;
1196
+ } else {
1197
+ m++;
1198
+ continue;
1199
+ }
1200
+ }
1201
+ const D = d.join(""), I = (n.prefix ?? "") + D + (n.suffix ?? "");
1202
+ let w = (n.prefix ?? "").length;
1203
+ if (g >= 0) {
1204
+ let S = g + 1;
1205
+ if ((o?.policy ?? "smart") !== "sticky")
1206
+ for (; S < x.length && x[S].kind === "literal"; ) S++;
1207
+ w += S;
1208
+ }
1209
+ const y = n.completion?.mode === "min" ? (n.completion.minChars ?? 0) <= v : n.completion?.mode === "custom" ? !!n.completion.isComplete?.(I) : $ > 0 && v >= $, M = n.pipe?.(I, { ...a, completed: y });
1210
+ let A, F = w;
1211
+ return M === !1 ? (A = e, F = e.length) : typeof M == "string" ? (A = M, F = M.length) : typeof M == "object" && M ? (A = M.value, F = M.cursor ?? M.value.length) : A = I, { value: A, cursor: F, completed: y };
1212
+ }
1213
+ function Qe(t, e) {
1214
+ const s = e?.strategy ?? "none";
1215
+ return s === "custom" && e?.unmask ? e.unmask(t) : s === "strip" ? t.replace(/[^A-Za-z0-9]/g, "") : t;
1216
+ }
1217
+ const qt = (t) => {
1218
+ const {
1219
+ value: e,
1220
+ onBlur: s,
1221
+ onChange: n,
1222
+ onInput: r,
1223
+ onAccept: o,
1224
+ onComplete: a,
1225
+ mask: u,
1226
+ definitions: l,
1227
+ useDefaultDefinitions: c,
1228
+ extraLiterals: f,
1229
+ prefix: b,
1230
+ suffix: h,
1231
+ autofix: d,
1232
+ pipe: x,
1233
+ completion: m,
1234
+ unmask: $,
1235
+ allowMode: v,
1236
+ allow: g,
1237
+ placeholder: D,
1238
+ placeholderOptions: I
1239
+ } = t, _ = L(
1240
+ e,
1241
+ u,
1242
+ l,
1243
+ c,
1244
+ f,
1245
+ b,
1246
+ h,
1247
+ d,
1248
+ m,
1249
+ $,
1250
+ v,
1251
+ D,
1252
+ I
1253
+ )((y, M, A, F, S, V, N, st, rt, tt, Q, pt, q) => M ? Ut(y ?? "", "", M, {
1254
+ definitions: A ?? {},
1255
+ useDefaultDefinitions: F ?? !0,
1256
+ extraLiterals: S ?? [],
1257
+ autofix: st ?? "none",
1258
+ completion: rt ?? { mode: "mask" },
1259
+ pipe: x ?? ((R) => R),
1260
+ unmask: tt ?? { strategy: "none" },
1261
+ allowMode: Q ?? "all",
1262
+ allow: g,
1263
+ prefix: V,
1264
+ suffix: N
1265
+ }).value : y ?? ""), w = (y, M) => {
1266
+ const A = y.value ?? "", F = p.get(e) ?? "", S = u != null ? p.get(u) : null, V = l != null ? p.get(l) : void 0, N = c != null ? p.get(c) : void 0, st = f != null ? p.get(f) : void 0, rt = d != null ? p.get(d) : void 0, tt = m != null ? p.get(m) : void 0, Q = $ != null ? p.get($) : void 0, pt = v != null ? p.get(v) : void 0, q = b != null ? p.get(b) : void 0, R = h != null ? p.get(h) : void 0, {
1267
+ value: J,
1268
+ cursor: ht,
1269
+ completed: St
1270
+ } = S ? Ut(
1271
+ A,
1272
+ F,
1273
+ S,
1274
+ {
1275
+ definitions: V ?? {},
1276
+ useDefaultDefinitions: N ?? !0,
1277
+ extraLiterals: st ?? [],
1278
+ autofix: rt ?? "none",
1279
+ completion: tt ?? { mode: "mask" },
1280
+ pipe: x ?? ((Gt) => Gt),
1281
+ unmask: Q ?? { strategy: "none" },
1282
+ allowMode: pt ?? "all",
1283
+ allow: g,
1284
+ prefix: q,
1285
+ suffix: R
1286
+ },
1287
+ y.selectionStart ?? A.length,
1288
+ t.cursor ? p.get(t.cursor) : void 0
1289
+ ) : { value: A, cursor: A.length, completed: !0 };
1290
+ if (J !== A) {
1291
+ y.value = J;
1292
+ try {
1293
+ y.setSelectionRange(ht, ht);
1294
+ } catch {
1295
+ }
1296
+ }
1297
+ const Tt = Qe(J, Q);
1298
+ o?.({
1299
+ raw: Tt,
1300
+ conformed: J,
1301
+ completed: St,
1302
+ cursor: ht
1303
+ }), M === "input" ? r?.(J) : (n?.(J), St && a?.({ raw: Tt, conformed: J }));
1304
+ };
1305
+ return B(
1306
+ z(_),
1307
+ P({
1308
+ ...t,
1309
+ input: K.text(
1310
+ H(t),
1311
+ i.value(_),
1312
+ i.class("bc-input"),
1313
+ s != null ? k.blur(s) : T,
1314
+ ut(
1315
+ (y) => y instanceof HTMLInputElement ? B(
1316
+ k.input(() => w(y, "input")),
1317
+ k.change(() => w(y, "change")),
1318
+ k.keydown((M) => {
1319
+ if (M.key !== "Backspace" || !(t.cursor ? p.get(t.cursor)?.backspaceRubberBand ?? !0 : !0)) return;
1320
+ const F = y.selectionStart ?? 0, S = y.selectionEnd ?? F;
1321
+ if (F !== S || F <= 0) return;
1322
+ const V = y.value ?? "", N = u != null ? p.get(u) : null;
1323
+ if (!N) return;
1324
+ const st = l != null ? p.get(l) : void 0, rt = c != null ? p.get(c) : !0, tt = b != null ? p.get(b) : void 0, Q = h != null ? p.get(h) : void 0, pt = Xt(
1325
+ typeof N == "function" ? N(V, {
1326
+ raw: V,
1327
+ previousConformed: V,
1328
+ cursor: F,
1329
+ completed: !1
1330
+ }) : N,
1331
+ st ?? {},
1332
+ rt ?? !0
1333
+ ), q = /* @__PURE__ */ new Set();
1334
+ for (const R of pt)
1335
+ R.type === "literal" && q.add(R.char);
1336
+ if (tt) for (const R of tt) q.add(R);
1337
+ if (Q) for (const R of Q) q.add(R);
1338
+ if (q.has(V[F - 1])) {
1339
+ let R = F - 1;
1340
+ for (; R >= 0 && q.has(V[R]); ) R--;
1341
+ R >= 0 && (M.preventDefault(), M.stopPropagation(), y.value = V.slice(0, R) + V.slice(R + 1), w(y, "input"));
1342
+ }
1343
+ })
1344
+ ) : T
1345
+ )
1346
+ )
1347
+ })
1348
+ );
1349
+ };
1350
+ function Y(t, e, s) {
1351
+ const n = p.map(t, (o) => o != null), r = yt.clearValue;
1352
+ return B(
1353
+ z(() => p.dispose(n)),
1354
+ E(
1355
+ n,
1356
+ () => C.button(
1357
+ i.type("button"),
1358
+ i.class("bc-input-container__reset"),
1359
+ U.label(r),
1360
+ i.title(r),
1361
+ i.disabled(e ?? !1),
1362
+ O({ icon: "mdi:close", size: "sm" }),
1363
+ k.click((o) => {
1364
+ o.preventDefault(), o.stopPropagation(), s?.(null);
1365
+ })
1366
+ )
1367
+ )
1368
+ );
1369
+ }
1370
+ const Dn = (t) => {
1371
+ const { value: e, onBlur: s, onChange: n, after: r, disabled: o } = t, a = Y(e, o, n);
1372
+ return P({
1373
+ ...t,
1374
+ input: K.date(
1375
+ H(t),
1376
+ i.valueAsDate(e),
1377
+ i.class("bc-input"),
1378
+ s != null ? k.blur(j(s)) : T,
1379
+ n != null ? k.change(ee(n)) : T
1380
+ ),
1381
+ after: r != null ? B(a, r) : a
1382
+ });
1383
+ }, Je = (t) => {
1384
+ const e = t.getFullYear(), s = t.getMonth() + 1, n = t.getDate(), r = t.getHours(), o = t.getMinutes(), a = t.getSeconds();
1385
+ return `${e}-${s.toString().padStart(2, "0")}-${n.toString().padStart(2, "0")}T${r.toString().padStart(2, "0")}:${o.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}`;
1386
+ }, Sn = (t) => {
1387
+ const { value: e, onBlur: s, onChange: n, after: r, disabled: o } = t, a = p.map(e, (l) => l != null ? Je(l) : null), u = Y(e, o, n);
1388
+ return P({
1389
+ ...t,
1390
+ input: K["datetime-local"](
1391
+ H(t),
1392
+ i.value(p.map(a, (l) => l ?? null)),
1393
+ i.class("bc-input"),
1394
+ s != null ? k.blur(j(s)) : T,
1395
+ n != null ? k.change(ne(n)) : T
1396
+ ),
1397
+ after: r != null ? B(u, r) : u
1398
+ });
1399
+ }, Z = (t) => typeof t == "string" && t.trim() === "" ? null : t, nt = (t) => t ?? "", Tn = (t) => {
1400
+ const { value: e, onBlur: s, onChange: n, onInput: r, after: o, disabled: a, ...u } = t, l = Y(e, a, n);
1401
+ return ie({
1402
+ ...u,
1403
+ value: p.map(e, nt),
1404
+ onChange: n != null ? (c) => n(Z(c)) : void 0,
1405
+ onInput: r != null ? (c) => r(Z(c)) : void 0,
1406
+ onBlur: s,
1407
+ after: o != null ? B(l, o) : l
1408
+ });
1409
+ }, An = (t) => {
1410
+ const { value: e, onBlur: s, onChange: n, onInput: r, after: o, disabled: a, ...u } = t, l = Y(e, a, n);
1411
+ return he({
1412
+ ...u,
1413
+ value: p.map(e, nt),
1414
+ onChange: n != null ? (c) => n(Z(c)) : void 0,
1415
+ onInput: r != null ? (c) => r(Z(c)) : void 0,
1416
+ onBlur: s,
1417
+ after: o != null ? B(l, o) : l
1418
+ });
1419
+ }, Fn = (t) => {
1420
+ const { value: e, onBlur: s, onChange: n, onInput: r, after: o, disabled: a, ...u } = t, l = Y(e, a, n);
1421
+ return ge({
1422
+ ...u,
1423
+ value: p.map(e, nt),
1424
+ onChange: n != null ? (c) => n(Z(c)) : void 0,
1425
+ onInput: r != null ? (c) => r(Z(c)) : void 0,
1426
+ onBlur: s,
1427
+ after: o != null ? B(l, o) : l
1428
+ });
1429
+ }, Ke = (t) => {
1430
+ const { value: e, onBlur: s, onChange: n, onInput: r, rows: o } = t;
1431
+ return P({
1432
+ baseContainer: !0,
1433
+ ...t,
1434
+ input: C.textarea(
1435
+ i.class(
1436
+ L(t.size ?? "md")(
1437
+ (a) => ue(
1438
+ !1,
1439
+ a ?? "md"
1440
+ )
1441
+ )
1442
+ ),
1443
+ H(t),
1444
+ i.rows(o ?? 3),
1445
+ i.value(e),
1446
+ i.class("bc-input"),
1447
+ s != null ? k.blur(j(s)) : T,
1448
+ n != null ? k.change(j(n)) : T,
1449
+ r != null ? k.input(j(r)) : T
1450
+ )
1451
+ });
1452
+ }, Bn = (t) => {
1453
+ const { value: e, onBlur: s, onChange: n, onInput: r, after: o, disabled: a, ...u } = t, l = Y(e, a, n);
1454
+ return Ke({
1455
+ ...u,
1456
+ value: p.map(e, nt),
1457
+ onChange: n != null ? (c) => n(Z(c)) : void 0,
1458
+ onInput: r != null ? (c) => r(Z(c)) : void 0,
1459
+ onBlur: s,
1460
+ after: o != null ? B(l, o) : l
1461
+ });
1462
+ }, Vn = (t) => {
1463
+ const { value: e, step: s, min: n, max: r, onBlur: o, onChange: a, onInput: u, after: l } = t, c = (h) => {
1464
+ const d = n != null ? p.get(n) : void 0, x = r != null ? p.get(r) : void 0;
1465
+ return d != null && h < d ? d : x != null && h > x ? x : h;
1466
+ }, f = s != null ? W(X, (h) => {
1467
+ const d = L(
1468
+ e,
1469
+ n
1470
+ )((v, g) => g == null ? !0 : (v ?? 0) > g), x = L(
1471
+ e,
1472
+ r
1473
+ )((v, g) => g == null ? !0 : (v ?? 0) < g), m = (v) => {
1474
+ const g = p.get(e) ?? 0, D = p.get(s), I = v?.shiftKey ? 10 : 1, _ = g - D * I, w = n != null ? p.get(n) : void 0;
1475
+ if (w != null && _ < w)
1476
+ return;
1477
+ const y = c(_);
1478
+ y !== g && a && a(y);
1479
+ }, $ = (v) => {
1480
+ const g = p.get(e) ?? 0, D = p.get(s), I = v?.shiftKey ? 10 : 1, _ = g + D * I, w = r != null ? p.get(r) : void 0;
1481
+ if (w != null && _ > w)
1482
+ return;
1483
+ const y = c(_);
1484
+ y !== g && a && a(y);
1485
+ };
1486
+ return ct(
1487
+ i.class("bc-number-input-steppers"),
1488
+ // Increment second
1489
+ C.button(
1490
+ i.type("button"),
1491
+ i.class(
1492
+ "bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"
1493
+ ),
1494
+ i.disabled(
1495
+ L(
1496
+ x,
1497
+ t.disabled ?? !1
1498
+ )((v, g) => !v || g)
1499
+ ),
1500
+ k.click((v) => $(v)),
1501
+ U.label(h.$.incrementValue),
1502
+ O({ icon: "line-md:plus", size: "xs" })
1503
+ ),
1504
+ // Decrement first (matches tests expecting first button to be decrement)
1505
+ C.button(
1506
+ i.type("button"),
1507
+ i.class(
1508
+ "bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"
1509
+ ),
1510
+ i.disabled(
1511
+ L(
1512
+ d,
1513
+ t.disabled ?? !1
1514
+ )((v, g) => !v || g)
1515
+ ),
1516
+ k.click((v) => m(v)),
1517
+ U.label(h.$.decrementValue),
1518
+ O({ icon: "line-md:minus", size: "xs" })
1519
+ )
1520
+ );
1521
+ }) : null, b = l != null && f != null ? B(f, l) : l ?? f;
1522
+ return P({
1523
+ ...t,
1524
+ input: K.number(
1525
+ n != null ? B(
1526
+ i.min(n),
1527
+ z(
1528
+ p.on(n, (h) => {
1529
+ h < p.get(e);
1530
+ })
1531
+ )
1532
+ ) : T,
1533
+ r != null ? B(
1534
+ i.max(r),
1535
+ z(
1536
+ p.on(r, (h) => {
1537
+ h > p.get(e);
1538
+ })
1539
+ )
1540
+ ) : T,
1541
+ H(t),
1542
+ i.valueAsNumber(e),
1543
+ i.step(s),
1544
+ i.class("bc-input bc-number-input"),
1545
+ o != null ? k.blur(j(o)) : T,
1546
+ a != null ? k.change(G(a)) : T,
1547
+ u != null ? k.input(G(u)) : T,
1548
+ // Add wheel event support when step is defined
1549
+ s != null ? k.wheel((h) => {
1550
+ h.preventDefault();
1551
+ const d = p.get(e) ?? 0, x = p.get(s), m = h.shiftKey ? 10 : 1, $ = h.deltaY < 0 ? x * m : -x * m, v = c(d + $);
1552
+ v !== d && a && a(v);
1553
+ }) : T
1554
+ ),
1555
+ after: b
1556
+ });
1557
+ }, Nt = (t) => {
1558
+ if (t == null || t === "") return null;
1559
+ const e = Number(t);
1560
+ return Number.isNaN(e) ? null : e;
1561
+ }, Ln = (t) => {
1562
+ const { value: e, step: s, min: n, max: r, onBlur: o, onChange: a, onInput: u, after: l } = t, c = (d) => {
1563
+ const x = n != null ? p.get(n) : void 0, m = r != null ? p.get(r) : void 0;
1564
+ return x != null && d < x ? x : m != null && d > m ? m : d;
1565
+ }, f = (() => {
1566
+ if (s == null) return null;
1567
+ const d = L(
1568
+ e,
1569
+ n
1570
+ )((g, D) => {
1571
+ const I = g ?? 0;
1572
+ return D == null ? !0 : I > D;
1573
+ }), x = L(
1574
+ e,
1575
+ r
1576
+ )((g, D) => {
1577
+ const I = g ?? 0;
1578
+ return D == null ? !0 : I < D;
1579
+ }), m = (g) => {
1580
+ const D = p.get(e) ?? 0, I = p.get(s), _ = g?.shiftKey ? 10 : 1, w = D - I * _, y = n != null ? p.get(n) : void 0;
1581
+ if (y != null && w < y) return;
1582
+ const M = c(w);
1583
+ M !== D && a && a(M);
1584
+ }, $ = (g) => {
1585
+ const D = p.get(e) ?? 0, I = p.get(s), _ = g?.shiftKey ? 10 : 1, w = D + I * _, y = r != null ? p.get(r) : void 0;
1586
+ if (y != null && w > y) return;
1587
+ const M = c(w);
1588
+ M !== D && a && a(M);
1589
+ };
1590
+ return ((g, D) => ct(
1591
+ i.class("bc-number-input-steppers"),
1592
+ C.button(
1593
+ i.type("button"),
1594
+ i.class(
1595
+ "bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"
1596
+ ),
1597
+ i.disabled(
1598
+ L(
1599
+ x,
1600
+ t.disabled ?? !1
1601
+ )((I, _) => !I || _)
1602
+ ),
1603
+ k.click((I) => $(I)),
1604
+ U.label(g),
1605
+ O({ icon: "line-md:plus", size: "xs" })
1606
+ ),
1607
+ C.button(
1608
+ i.type("button"),
1609
+ i.class(
1610
+ "bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"
1611
+ ),
1612
+ i.disabled(
1613
+ L(
1614
+ d,
1615
+ t.disabled ?? !1
1616
+ )((I, _) => !I || _)
1617
+ ),
1618
+ k.click((I) => m(I)),
1619
+ U.label(D),
1620
+ O({ icon: "line-md:minus", size: "xs" })
1621
+ )
1622
+ ))(
1623
+ yt.incrementValue,
1624
+ yt.decrementValue
1625
+ );
1626
+ })(), b = Y(e, t.disabled, a), h = l != null && f != null ? B(f, b, l) : l != null ? B(b, l) : f != null ? B(f, b) : b;
1627
+ return P({
1628
+ ...t,
1629
+ input: K.number(
1630
+ // min/max attributes and reactive watchers (no forced correction)
1631
+ n != null ? B(
1632
+ i.min(n),
1633
+ z(
1634
+ p.on(n, (d) => {
1635
+ })
1636
+ )
1637
+ ) : T,
1638
+ r != null ? B(
1639
+ i.max(r),
1640
+ z(
1641
+ p.on(r, (d) => {
1642
+ })
1643
+ )
1644
+ ) : T,
1645
+ H(t),
1646
+ // Represent null as empty string so the field can be cleared
1647
+ i.value(p.map(e, (d) => d == null ? "" : String(d))),
1648
+ i.step(s),
1649
+ i.class("bc-input bc-number-input"),
1650
+ o != null ? k.blur(j(o)) : T,
1651
+ a != null ? k.change(
1652
+ j((d) => {
1653
+ const x = Nt(d);
1654
+ a(x);
1655
+ })
1656
+ ) : T,
1657
+ u != null ? k.input(
1658
+ j((d) => {
1659
+ const x = Nt(d);
1660
+ u(x);
1661
+ })
1662
+ ) : T,
1663
+ // Wheel support when step is defined
1664
+ s != null ? k.wheel((d) => {
1665
+ d.preventDefault();
1666
+ const x = p.get(e) ?? 0, m = p.get(s), $ = d.shiftKey ? 10 : 1, v = d.deltaY < 0 ? m * $ : -m * $, g = c(x + v);
1667
+ g !== x && a && a(g);
1668
+ }) : T
1669
+ ),
1670
+ after: h
1671
+ });
1672
+ }, En = ({
1673
+ value: t,
1674
+ onChange: e,
1675
+ onInput: s,
1676
+ onBlur: n,
1677
+ offLabel: r,
1678
+ onLabel: o,
1679
+ disabled: a = !1,
1680
+ size: u = "md",
1681
+ id: l,
1682
+ color: c = "primary"
1683
+ }) => {
1684
+ const f = l ?? be("switch");
1685
+ function b(m, $) {
1686
+ const v = [
1687
+ "bc-switch",
1688
+ `bc-switch--size-${$}`,
1689
+ `bc-switch--${$}`
1690
+ ];
1691
+ return m && v.push("bc-switch--disabled"), v.join(" ");
1692
+ }
1693
+ function h(m) {
1694
+ const $ = m ?? "primary", v = /* @__PURE__ */ new Map(), g = Vt($, "solid", "light"), D = Vt($, "solid", "dark");
1695
+ return v.set("--switch-track-on-bg", g.backgroundColor), v.set("--switch-track-on-label", g.textColor), v.set("--switch-track-on-bg-dark", D.backgroundColor), v.set("--switch-track-on-label-dark", D.textColor), v.set(
1696
+ "--switch-track-on-border-dark",
1697
+ de($, "dark")
1698
+ ), Array.from(v.entries()).map(([I, _]) => `${I}: ${_}`).join("; ");
1699
+ }
1700
+ const d = () => {
1701
+ p.get(a) || (e?.(!p.get(t)), s?.(!p.get(t)));
1702
+ }, x = (m) => {
1703
+ p.get(a) || (m.key === " " || m.key === "Enter") && (m.preventDefault(), d());
1704
+ };
1705
+ return C.div(
1706
+ i.class(
1707
+ L(
1708
+ a ?? !1,
1709
+ u
1710
+ )(
1711
+ (m, $) => b(m ?? !1, $ ?? "md")
1712
+ )
1713
+ ),
1714
+ i.style(
1715
+ L(c)(
1716
+ (m) => h(m)
1717
+ )
1718
+ ),
1719
+ i.id(f),
1720
+ i.role("switch"),
1721
+ i.tabindex(
1722
+ p.map(a, (m) => m ? -1 : 0)
1723
+ ),
1724
+ U.checked(t),
1725
+ U.disabled(a),
1726
+ k.click(d),
1727
+ k.keydown(x),
1728
+ n != null ? k.blur(n) : null,
1729
+ C.div(
1730
+ i.class("bc-switch__track"),
1731
+ i.class(
1732
+ p.map(
1733
+ t,
1734
+ (m) => m ? "bc-switch__track--on" : "bc-switch__track--off"
1735
+ )
1736
+ ),
1737
+ r != null ? C.div(
1738
+ U.hidden(!0),
1739
+ i.class("bc-switch__track-label bc-switch__track-label--off"),
1740
+ i.class(
1741
+ p.map(
1742
+ t,
1743
+ (m) => m ? "bc-switch__track-label--hidden" : "bc-switch__track-label--visible"
1744
+ )
1745
+ ),
1746
+ r
1747
+ ) : null,
1748
+ o != null ? C.div(
1749
+ i.class("bc-switch__track-label bc-switch__track-label--on"),
1750
+ i.class(
1751
+ p.map(
1752
+ t,
1753
+ (m) => m ? "bc-switch__track-label--visible" : "bc-switch__track-label--hidden"
1754
+ )
1755
+ ),
1756
+ o
1757
+ ) : null,
1758
+ jt(
1759
+ (m) => W(
1760
+ pe,
1761
+ ({ direction: $ }) => C.div(
1762
+ i.class("bc-switch__thumb"),
1763
+ i.class(
1764
+ p.map(
1765
+ t,
1766
+ (v) => v ? "bc-switch__thumb--on" : "bc-switch__thumb--off"
1767
+ )
1768
+ ),
1769
+ ft.transform(
1770
+ L(
1771
+ t,
1772
+ m,
1773
+ u,
1774
+ $
1775
+ )((v, { width: g }, D, I) => {
1776
+ const _ = (() => {
1777
+ switch (D) {
1778
+ case "xs":
1779
+ return 5;
1780
+ case "sm":
1781
+ return 5.5;
1782
+ case "md":
1783
+ return 6;
1784
+ case "lg":
1785
+ return 7;
1786
+ case "xl":
1787
+ return 8;
1788
+ }
1789
+ })(), w = I === "rtl" ? `calc((var(--spacing-base) * ${_}) - ${g}px)` : `calc(${g}px - (var(--spacing-base) * ${_}))`;
1790
+ return v ? `translateX(${w})` : "translateX(0)";
1791
+ })
1792
+ )
1793
+ )
1794
+ )
1795
+ )
1796
+ )
1797
+ );
1798
+ }, tn = (t) => {
1799
+ const e = {
1800
+ type: "pattern",
1801
+ pattern: /[0-9A-Fa-f]/,
1802
+ transform: (n) => n.toLowerCase()
1803
+ };
1804
+ return qt({
1805
+ ...t,
1806
+ mask: [
1807
+ e,
1808
+ e,
1809
+ e,
1810
+ e,
1811
+ e,
1812
+ e,
1813
+ e,
1814
+ e,
1815
+ "-",
1816
+ e,
1817
+ e,
1818
+ e,
1819
+ e,
1820
+ "-",
1821
+ e,
1822
+ e,
1823
+ e,
1824
+ e,
1825
+ "-",
1826
+ e,
1827
+ e,
1828
+ e,
1829
+ e,
1830
+ "-",
1831
+ e,
1832
+ e,
1833
+ e,
1834
+ e,
1835
+ e,
1836
+ e,
1837
+ e,
1838
+ e,
1839
+ e,
1840
+ e,
1841
+ e,
1842
+ e
1843
+ ],
1844
+ // Sensible default placeholder; can be overridden via options.placeholder
1845
+ placeholder: t.placeholder ?? "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
1846
+ });
1847
+ }, Rn = (t) => {
1848
+ const { value: e, onBlur: s, onChange: n, onInput: r, after: o, disabled: a, ...u } = t, l = Y(e, a, n);
1849
+ return tn({
1850
+ ...u,
1851
+ value: p.map(e, nt),
1852
+ onChange: n != null ? (c) => n(Z(c)) : void 0,
1853
+ onInput: r != null ? (c) => r(Z(c)) : void 0,
1854
+ onBlur: s,
1855
+ after: o != null ? B(l, o) : l
1856
+ });
1857
+ }, en = "line-md:star-alt-filled", nn = "line-md:star-alt", sn = (t) => {
1858
+ const {
1859
+ value: e,
1860
+ onChange: s,
1861
+ disabled: n,
1862
+ max: r = 5,
1863
+ fullColor: o = "yellow",
1864
+ emptyColor: a = "neutral",
1865
+ fullIcon: u = en,
1866
+ emptyIcon: l = nn,
1867
+ size: c = "md",
1868
+ onBlur: f,
1869
+ rounding: b = 1
1870
+ } = t, h = () => {
1871
+ const g = p.get(b);
1872
+ return g > 0 ? g : 1;
1873
+ }, d = (g) => Math.min(Math.max(g, 0), p.get(r)), x = (g, D) => {
1874
+ if (p.get(n ?? !1)) return;
1875
+ const _ = g.currentTarget.getBoundingClientRect(), w = (g.clientX - _.left) / _.width, y = D - 1 + w, M = h(), A = Math.ceil(y / M) * M, F = d(A);
1876
+ s?.(F);
1877
+ }, m = (g) => {
1878
+ if (p.get(n ?? !1)) return;
1879
+ const D = h(), I = p.get(e) ?? 0;
1880
+ let _;
1881
+ switch (g.key) {
1882
+ case "ArrowRight":
1883
+ case "ArrowUp":
1884
+ _ = d(I + D);
1885
+ break;
1886
+ case "ArrowLeft":
1887
+ case "ArrowDown":
1888
+ _ = d(I - D);
1889
+ break;
1890
+ case "Home":
1891
+ _ = 0;
1892
+ break;
1893
+ case "End":
1894
+ _ = p.get(r);
1895
+ break;
1896
+ default:
1897
+ return;
1898
+ }
1899
+ g.preventDefault(), s?.(_);
1900
+ }, $ = p.map(c, (g) => `bc-icon--${g}`), v = ({ index: g, counter: D }) => C.span(
1901
+ i.class("bc-rating-input__icon-container"),
1902
+ i.class($),
1903
+ O(
1904
+ { icon: l, size: c, color: a, tone: "soft" },
1905
+ i.class("bc-rating-input__icon-empty")
1906
+ ),
1907
+ C.span(
1908
+ i.class("bc-rating-input__icon-clipper"),
1909
+ i.class($),
1910
+ ft.width(
1911
+ p.map(e, (I) => {
1912
+ const _ = Math.floor(I);
1913
+ return _ > g ? "100%" : _ < g ? "0%" : `${(I - g) * 100}%`;
1914
+ })
1915
+ ),
1916
+ O(
1917
+ { icon: u, size: c, color: o, tone: "soft" },
1918
+ i.class("bc-rating-input__icon-full")
1919
+ )
1920
+ ),
1921
+ k.click(
1922
+ se((I) => x(I, D), {
1923
+ preventDefault: !0,
1924
+ stopPropagation: !0
1925
+ })
1926
+ )
1927
+ );
1928
+ return P({
1929
+ baseContainer: !0,
1930
+ growInput: !1,
1931
+ focusableSelector: '[role="slider"]',
1932
+ ...t,
1933
+ input: C.div(
1934
+ // Common input attributes (id, required, invalid, custom classes, etc.)
1935
+ H(t),
1936
+ i.class("bc-rating-input"),
1937
+ // ARIA slider semantics
1938
+ i.role("slider"),
1939
+ i.tabindex(p.map(n ?? !1, (g) => g ? -1 : 0)),
1940
+ U.disabled(n ?? !1),
1941
+ U.valuemin(0),
1942
+ U.valuemax(p.map(r, (g) => g ?? 0)),
1943
+ U.valuenow(p.map(e, (g) => g ?? 0)),
1944
+ U.valuetext(
1945
+ L(
1946
+ e,
1947
+ r
1948
+ )((g, D) => {
1949
+ const I = g ?? 0, _ = D ?? 0;
1950
+ return `${String(I)} / ${String(_)}`;
1951
+ })
1952
+ ),
1953
+ // Keyboard & focus handlers
1954
+ k.keydown(m),
1955
+ f != null ? k.blur(f) : null,
1956
+ Pt(r, v)
1957
+ )
1958
+ });
1959
+ }, zn = (t) => {
1960
+ const { value: e, onChange: s, onBlur: n, after: r, disabled: o, ...a } = t, u = Y(e, o, s);
1961
+ return sn({
1962
+ ...a,
1963
+ // Map null -> 0 for display so the control shows as empty when null
1964
+ value: p.map(e, (l) => l ?? 0),
1965
+ // Pass through numeric changes; clear button will call onChange(null)
1966
+ onChange: s,
1967
+ onBlur: n,
1968
+ after: r != null ? B(u, r) : u
1969
+ });
1970
+ }, Un = (t) => {
1971
+ const { value: e, step: s, min: n, max: r, onBlur: o, onChange: a, onInput: u } = t;
1972
+ return P({
1973
+ ...t,
1974
+ // Make sure clicks anywhere focus the range input
1975
+ focusableSelector: 'input[type="range"]',
1976
+ input: C.input(
1977
+ i.type("range"),
1978
+ H(t),
1979
+ i.min(n),
1980
+ i.max(r),
1981
+ i.step(s),
1982
+ // Using value as number to keep it in sync
1983
+ i.valueAsNumber(e),
1984
+ i.class("bc-input bc-slider-input"),
1985
+ o != null ? k.blur(G(o)) : T,
1986
+ a != null ? k.change(G(a)) : T,
1987
+ u != null ? k.input(G(u)) : T
1988
+ )
1989
+ });
1990
+ }, Nn = (t) => {
1991
+ const { value: e, step: s, min: n, max: r, onBlur: o, onChange: a, onInput: u } = t, l = p.map(e, (f) => {
1992
+ if (f != null) return f;
1993
+ const b = n != null ? p.get(n) : void 0;
1994
+ return typeof b == "number" ? b : 0;
1995
+ }), c = Y(e, t.disabled, (f) => {
1996
+ a?.(f);
1997
+ });
1998
+ return P(
1999
+ {
2000
+ ...t,
2001
+ focusableSelector: 'input[type="range"]',
2002
+ after: c,
2003
+ input: C.input(
2004
+ i.type("range"),
2005
+ H(t),
2006
+ i.min(n),
2007
+ i.max(r),
2008
+ i.step(s),
2009
+ i.valueAsNumber(l),
2010
+ i.class("bc-input bc-slider-input"),
2011
+ o != null ? k.blur(G(o)) : T,
2012
+ a != null ? k.change(
2013
+ G((f) => {
2014
+ a(f);
2015
+ })
2016
+ ) : T,
2017
+ u != null ? k.input(
2018
+ G((f) => {
2019
+ u(f);
2020
+ })
2021
+ ) : T
2022
+ )
2023
+ },
2024
+ // Ensure container grows input naturally
2025
+ B()
2026
+ );
2027
+ };
2028
+ let _t = null;
2029
+ async function Mt() {
2030
+ const t = globalThis;
2031
+ return t.Temporal ? t.Temporal : (_t || (_t = import("./index.esm-DPNh6inz.js").then((e) => {
2032
+ const s = e.Temporal;
2033
+ return t.Temporal || (t.Temporal = s), s;
2034
+ })), _t);
2035
+ }
2036
+ const rn = (t, e) => e ? Bt(Mt, {
2037
+ then: t,
2038
+ pending: e.pending,
2039
+ error: e.error
2040
+ }) : Bt(Mt, t), an = /^P(\d+([YMWD]|$)){0,4}(T(\d+([HMS]|$)){0,3})?$/i, ln = /^P(?:(\d+Y)?(\d+M)?(\d+W)?(\d+D)?)(T(\d+H)?(\d+M)?(\d+S)?)?$/i;
2041
+ function on(t) {
2042
+ return {
2043
+ mask: null,
2044
+ allowMode: "custom",
2045
+ allow: (e) => /[0-9ptwdhms]/i.test(e),
2046
+ pipe: (e) => {
2047
+ const s = e.toUpperCase();
2048
+ return s.length === 0 ? s : !s.startsWith("P") || !an.test(s) ? !1 : s;
2049
+ },
2050
+ completion: {
2051
+ mode: "custom",
2052
+ isComplete: (e) => {
2053
+ const s = e.toUpperCase();
2054
+ if (!ln.test(s)) return !1;
2055
+ try {
2056
+ return t(s), !0;
2057
+ } catch {
2058
+ return !1;
2059
+ }
2060
+ }
2061
+ }
2062
+ };
2063
+ }
2064
+ const Ot = (t, e) => {
2065
+ if (t == null) return null;
2066
+ try {
2067
+ return t.Duration.from(e);
2068
+ } catch {
2069
+ return null;
2070
+ }
2071
+ }, On = (t) => {
2072
+ const { value: e, onChange: s, after: n, disabled: r, onBlur: o } = t, a = () => {
2073
+ const c = Y(e, r, s);
2074
+ return n != null ? B(c, n) : c;
2075
+ }, u = t.placeholder != null ? T : i.placeholder("P0DT0H0M0S");
2076
+ return rn(
2077
+ (c) => qt({
2078
+ ...t,
2079
+ value: p.map(e, (f) => f?.toString() ?? ""),
2080
+ onChange: s ? (f) => s(f === "" ? null : c.Duration.from(f)) : void 0,
2081
+ onInput: void 0,
2082
+ ...on(c.Duration.from),
2083
+ placeholder: "P0DT0H0M0S",
2084
+ after: a()
2085
+ }),
2086
+ { pending: () => P({
2087
+ ...t,
2088
+ input: K.text(
2089
+ H(t),
2090
+ i.value(p.map(e, (c) => c?.toString() ?? "")),
2091
+ i.class("bc-input"),
2092
+ u,
2093
+ o != null ? k.blur(() => o()) : T,
2094
+ s != null ? k.change((c) => {
2095
+ const b = c.currentTarget?.value ?? "";
2096
+ if (b === "") {
2097
+ s(null);
2098
+ return;
2099
+ }
2100
+ const h = globalThis.Temporal, d = Ot(h, b);
2101
+ if (d != null) {
2102
+ s(d);
2103
+ return;
2104
+ }
2105
+ Mt().then((x) => {
2106
+ const m = Ot(x, b);
2107
+ m != null && s(m);
2108
+ }).catch(() => {
2109
+ });
2110
+ }) : T
2111
+ ),
2112
+ after: a()
2113
+ }) }
2114
+ );
2115
+ }, cn = (t) => {
2116
+ const { value: e, onBlur: s, onChange: n, onInput: r } = t;
2117
+ return P({
2118
+ ...t,
2119
+ input: K.url(
2120
+ H(t),
2121
+ i.value(e),
2122
+ i.class("bc-input"),
2123
+ s != null ? k.blur(j(s)) : T,
2124
+ n != null ? k.change(j(n)) : T,
2125
+ r != null ? k.input(j(r)) : T
2126
+ )
2127
+ });
2128
+ }, Pn = (t) => {
2129
+ const { value: e, onBlur: s, onChange: n, onInput: r, after: o, disabled: a, ...u } = t, l = Y(e, a, n);
2130
+ return cn({
2131
+ ...u,
2132
+ value: p.map(e, nt),
2133
+ onChange: n != null ? (c) => n(Z(c)) : void 0,
2134
+ onInput: r != null ? (c) => r(Z(c)) : void 0,
2135
+ onBlur: s,
2136
+ after: o != null ? B(l, o) : l
2137
+ });
2138
+ }, un = (t) => {
2139
+ const {
2140
+ controller: e,
2141
+ element: s,
2142
+ separator: n,
2143
+ showMove: r = !0,
2144
+ showRemove: o = !0,
2145
+ showAdd: a = !0,
2146
+ createItem: u,
2147
+ addLabel: l,
2148
+ controlsLayout: c = "aside",
2149
+ removeDisabled: f,
2150
+ addDisabled: b
2151
+ } = t, h = p.toSignal(c).map((m) => m === "aside"), d = (m) => {
2152
+ const $ = E(
2153
+ r ?? !1,
2154
+ () => C.div(
2155
+ i.class("bc-group--align-center"),
2156
+ i.class(
2157
+ h.map(
2158
+ (g) => g ? "bc-group--direction-column bc-group--gap-1" : "bc-group--direction-row bc-group--gap-1"
2159
+ )
2160
+ ),
2161
+ bt(
2162
+ {
2163
+ size: "xs",
2164
+ roundedness: "full",
2165
+ variant: "text",
2166
+ onClick: () => m.move("up"),
2167
+ disabled: m.cannotMove("up")
2168
+ },
2169
+ W(
2170
+ X,
2171
+ (g) => O({
2172
+ size: "xs",
2173
+ icon: "line-md:arrow-up",
2174
+ title: g.$.incrementValue
2175
+ })
2176
+ )
2177
+ ),
2178
+ bt(
2179
+ {
2180
+ size: "xs",
2181
+ roundedness: "full",
2182
+ variant: "text",
2183
+ onClick: () => m.move("down"),
2184
+ disabled: m.cannotMove("down")
2185
+ },
2186
+ W(
2187
+ X,
2188
+ (g) => O({
2189
+ size: "xs",
2190
+ icon: "line-md:arrow-down",
2191
+ title: g.$.decrementValue
2192
+ })
2193
+ )
2194
+ )
2195
+ )
2196
+ ), v = E(
2197
+ o,
2198
+ () => W(
2199
+ X,
2200
+ (g) => It({
2201
+ size: "xs",
2202
+ // Use a lowercase label to satisfy tests that query with [aria-label*="remove"]
2203
+ label: p.map(g.$.removeItem, (D) => D.toLowerCase()),
2204
+ color: "danger",
2205
+ disabled: f,
2206
+ onClick: m.remove
2207
+ })
2208
+ )
2209
+ );
2210
+ return (g) => E(
2211
+ h,
2212
+ () => dt(
2213
+ i.class("bc-group--gap-1 bc-group--align-center"),
2214
+ ct(i.class("bc-stack--grow"), g),
2215
+ ct(
2216
+ i.class("bc-stack--align-center"),
2217
+ E(
2218
+ e.signal.map((D) => D.length > 1),
2219
+ () => $
2220
+ ),
2221
+ v
2222
+ )
2223
+ ),
2224
+ () => ct(
2225
+ i.class("bc-stack--gap-2"),
2226
+ g,
2227
+ dt(
2228
+ i.class("bc-group--gap-2 bc-group--justify-between"),
2229
+ E(
2230
+ e.signal.map((D) => D.length > 1),
2231
+ () => $,
2232
+ () => C.div()
2233
+ ),
2234
+ v
2235
+ )
2236
+ )
2237
+ );
2238
+ }, x = E(
2239
+ L(a, u)((m, $) => m && $ != null),
2240
+ () => dt(
2241
+ i.class(
2242
+ "bc-group--gap-2 bc-group--align-center bc-group--justify-center"
2243
+ ),
2244
+ bt(
2245
+ {
2246
+ size: "sm",
2247
+ variant: "filled",
2248
+ onClick: () => e.push(u()),
2249
+ disabled: L(
2250
+ e.disabled,
2251
+ b ?? !1
2252
+ )(
2253
+ (m, $) => m || $
2254
+ )
2255
+ },
2256
+ W(
2257
+ X,
2258
+ (m) => dt(
2259
+ i.class("bc-group--gap-2"),
2260
+ O({ icon: "line-md:plus" }),
2261
+ l ?? m.$.addLabel
2262
+ )
2263
+ )
2264
+ )
2265
+ )
2266
+ );
2267
+ return B(
2268
+ Xe(
2269
+ e,
2270
+ (m) => d(m)(s(m)),
2271
+ n
2272
+ ),
2273
+ x
2274
+ );
2275
+ }, jn = (t, ...e) => {
2276
+ const {
2277
+ controller: s,
2278
+ element: n,
2279
+ separator: r,
2280
+ showMove: o,
2281
+ showRemove: a,
2282
+ showAdd: u,
2283
+ createItem: l,
2284
+ addLabel: c,
2285
+ controlsLayout: f,
2286
+ removeDisabled: b,
2287
+ addDisabled: h,
2288
+ ...d
2289
+ } = t;
2290
+ return Ht(
2291
+ {
2292
+ ...d,
2293
+ content: un({
2294
+ controller: s,
2295
+ element: n,
2296
+ separator: r,
2297
+ showMove: o,
2298
+ showRemove: a,
2299
+ showAdd: u,
2300
+ createItem: l,
2301
+ addLabel: c,
2302
+ controlsLayout: f,
2303
+ removeDisabled: b,
2304
+ addDisabled: h
2305
+ })
2306
+ },
2307
+ ...e
2308
+ );
2309
+ };
2310
+ class Hn extends vt {
2311
+ branches;
2312
+ activeBranch;
2313
+ #e;
2314
+ #t = /* @__PURE__ */ new Map();
2315
+ constructor(e, s, n, r, o, a, u = at) {
2316
+ super(e, s, n, r, o, u), this.branches = a;
2317
+ const l = (f) => {
2318
+ for (const b of a)
2319
+ if (b.detect(f))
2320
+ return b.key;
2321
+ return a[0]?.key ?? "unknown";
2322
+ };
2323
+ this.activeBranch = n.map(l, at);
2324
+ const c = (f) => {
2325
+ if (this.#t.has(f))
2326
+ return this.#t.get(f);
2327
+ const b = a.find((d) => d.key === f);
2328
+ if (!b)
2329
+ throw new Error(`Unknown branch: ${f}`);
2330
+ const h = new vt(
2331
+ [...e, f],
2332
+ (d) => {
2333
+ this.change(d);
2334
+ },
2335
+ this.signal.map(
2336
+ (d) => b.detect(d) ? d : b.defaultValue(),
2337
+ u
2338
+ ),
2339
+ r.map(Lt([f])),
2340
+ {
2341
+ disabled: this.disabled,
2342
+ validationMode: this.parent.validationMode
2343
+ },
2344
+ u
2345
+ );
2346
+ return this.#t.set(f, h), h;
2347
+ };
2348
+ this.#e = this.activeBranch.map(
2349
+ (f) => c(f),
2350
+ at
2351
+ ), this.onDispose(() => {
2352
+ for (const f of this.#t.values())
2353
+ f.dispose();
2354
+ this.#t.clear(), this.activeBranch.dispose(), this.#e.dispose();
2355
+ });
2356
+ }
2357
+ /**
2358
+ * Get the controller for the currently active branch
2359
+ */
2360
+ get activeController() {
2361
+ return p.get(this.#e);
2362
+ }
2363
+ /**
2364
+ * Get a controller for a specific branch
2365
+ */
2366
+ getBranchController(e) {
2367
+ const s = this.branches.find((r) => r.key === e);
2368
+ if (!s)
2369
+ throw new Error(`Unknown branch: ${e}`);
2370
+ if (this.#t.has(e))
2371
+ return this.#t.get(e);
2372
+ const n = new vt(
2373
+ [...this.path, e],
2374
+ (r) => {
2375
+ this.change(r);
2376
+ },
2377
+ this.signal.map(
2378
+ (r) => s.detect(r) ? r : s.defaultValue(),
2379
+ at
2380
+ ),
2381
+ this.status.map(Lt([e])),
2382
+ {
2383
+ disabled: this.disabled,
2384
+ validationMode: this.parent.validationMode
2385
+ },
2386
+ at
2387
+ );
2388
+ return this.#t.set(e, n), n;
2389
+ }
2390
+ /**
2391
+ * Switch to a different branch
2392
+ */
2393
+ switchToBranch(e, s = !1) {
2394
+ const n = this.branches.find((a) => a.key === e);
2395
+ if (!n)
2396
+ throw new Error(`Unknown branch: ${e}`);
2397
+ const r = p.get(this.signal);
2398
+ if (n.detect(r))
2399
+ return !0;
2400
+ if (n.convert) {
2401
+ const a = n.convert(r);
2402
+ if (a.ok)
2403
+ return this.change(a.value), !0;
2404
+ }
2405
+ if (s && typeof window == "object" && typeof window.confirm == "function" && !window.confirm(
2406
+ "Changing type will clear the current value. Continue?"
2407
+ ))
2408
+ return !1;
2409
+ const o = n.defaultValue();
2410
+ return this.change(o), !0;
2411
+ }
2412
+ /**
2413
+ * Get the current active branch definition
2414
+ */
2415
+ get activeBranchDefinition() {
2416
+ const e = p.get(this.activeBranch);
2417
+ return this.branches.find((s) => s.key === e);
2418
+ }
2419
+ }
2420
+ function Wn(t) {
2421
+ return t.transform(
2422
+ (e) => e ?? null,
2423
+ (e) => e ?? void 0
2424
+ );
2425
+ }
2426
+ function Zn(t) {
2427
+ return t.transform(
2428
+ (e) => e ?? "",
2429
+ (e) => e === "" ? void 0 : e
2430
+ );
2431
+ }
2432
+ function Yn(t) {
2433
+ return t.transform(
2434
+ (e) => e ?? void 0,
2435
+ (e) => e ?? null
2436
+ );
2437
+ }
2438
+ export {
2439
+ we as $,
2440
+ En as A,
2441
+ un as B,
2442
+ yn as C,
2443
+ tn as D,
2444
+ je as E,
2445
+ Ee as F,
2446
+ dt as G,
2447
+ Rn as H,
2448
+ zn as I,
2449
+ Un as J,
2450
+ Nn as K,
2451
+ jn as L,
2452
+ qt as M,
2453
+ Ze as N,
2454
+ On as O,
2455
+ cn as P,
2456
+ Pn as Q,
2457
+ sn as R,
2458
+ _n as S,
2459
+ Ke as T,
2460
+ Et as U,
2461
+ Cn as V,
2462
+ rn as W,
2463
+ In as X,
2464
+ He as Y,
2465
+ ve as Z,
2466
+ xe as _,
2467
+ Y as a,
2468
+ Ct as a0,
2469
+ it as a1,
2470
+ vn as a2,
2471
+ $e as a3,
2472
+ ye as a4,
2473
+ Ie as a5,
2474
+ Zt as a6,
2475
+ Ce as a7,
2476
+ kt as a8,
2477
+ ke as a9,
2478
+ xt as aa,
2479
+ wt as ab,
2480
+ Me as ac,
2481
+ De as ad,
2482
+ lt as ae,
2483
+ ot as af,
2484
+ Mt as ag,
2485
+ wn as ah,
2486
+ xn as ai,
2487
+ Wt as b,
2488
+ _e as c,
2489
+ on as d,
2490
+ Z as e,
2491
+ Hn as f,
2492
+ Zn as g,
2493
+ Yn as h,
2494
+ bn as i,
2495
+ $n as j,
2496
+ Re as k,
2497
+ Oe as l,
2498
+ kn as m,
2499
+ nt as n,
2500
+ Xe as o,
2501
+ Ye as p,
2502
+ Mn as q,
2503
+ Dn as r,
2504
+ Sn as s,
2505
+ Wn as t,
2506
+ An as u,
2507
+ Fn as v,
2508
+ Bn as w,
2509
+ Tn as x,
2510
+ Vn as y,
2511
+ Ln as z
2512
+ };