@tempots/beatui 1.7.5 → 1.9.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 (159) hide show
  1. package/dist/{ar-Wr6gMs-M.cjs → ar-CEzAem0F.cjs} +1 -1
  2. package/dist/{ar-fdUqbCvM.js → ar-CQieaqsq.js} +1 -1
  3. package/dist/auth/index.cjs.js +1 -1
  4. package/dist/auth/index.es.js +1 -1
  5. package/dist/auth-divider-B8yr-E_b.cjs +1 -0
  6. package/dist/{auth-divider-D9KnNeyF.js → auth-divider-Byh5BWLc.js} +91 -88
  7. package/dist/better-auth/index.cjs.js +1 -1
  8. package/dist/better-auth/index.es.js +27 -26
  9. package/dist/card-BkA7Wvbh.cjs +1 -0
  10. package/dist/card-DX1DwGbL.js +62 -0
  11. package/dist/{colors-C2sgnzFH.js → colors-CyMhfbJi.js} +64 -58
  12. package/dist/{colors-DPCHjRMj.cjs → colors-IXZF9U-s.cjs} +1 -1
  13. package/dist/control-hqEuMzyI.js +343 -0
  14. package/dist/control-muup9GF1.cjs +1 -0
  15. package/dist/custom-validation-BA9iJWl_.cjs +1 -0
  16. package/dist/custom-validation-BOBoUwHY.js +181 -0
  17. package/dist/{de-C5-k5Eov.js → de-CBIwvkAH.js} +1 -1
  18. package/dist/{de-DZqdSEta.cjs → de-DdfxrlT3.cjs} +1 -1
  19. package/dist/deep-merge-8fwp1z4X.js +1346 -0
  20. package/dist/deep-merge-VDGE_HQD.cjs +1 -0
  21. package/dist/duration-input-DmsljXl3.cjs +1 -0
  22. package/dist/{duration-input-D4V_PHIg.js → duration-input-ZQlcqdXU.js} +32 -31
  23. package/dist/{editor-toolbar-group-FpOHrmtx.js → editor-toolbar-group-BNTBMJCe.js} +2 -2
  24. package/dist/{editor-toolbar-group-C_ft_T8D.cjs → editor-toolbar-group-DiMzqYgz.cjs} +1 -1
  25. package/dist/{es-h6jmoF4X.js → es--9HaEj2D.js} +1 -1
  26. package/dist/{es-CJgYfRap.cjs → es-DSdljxFJ.cjs} +1 -1
  27. package/dist/{fa-BuxK837l.js → fa-1Z-akcW7.js} +1 -1
  28. package/dist/{fa-BQ5PzwNY.cjs → fa-BolmeWRT.cjs} +1 -1
  29. package/dist/flyout-CuKFh_T7.js +151 -0
  30. package/dist/flyout-DC_tKaTG.cjs +1 -0
  31. package/dist/{fr-Bv3TG44U.cjs → fr-CODgUuoZ.cjs} +1 -1
  32. package/dist/{fr-BwILQ9G2.js → fr-DhHM9rou.js} +1 -1
  33. package/dist/{he-yC9Sc7JD.js → he-CBamXbGJ.js} +1 -1
  34. package/dist/{he-5LbvgMCC.cjs → he-Juw-dr28.cjs} +1 -1
  35. package/dist/{hi-Da7rcCpP.js → hi-DvvcX-Ra.js} +1 -1
  36. package/dist/{hi-YWhWcG_L.cjs → hi-R749jeg-.cjs} +1 -1
  37. package/dist/{index-CvU9E9wd.js → index-BfQaT5Jy.js} +104 -104
  38. package/dist/{index-XogEKwdt.cjs → index-Dv7nPuwA.cjs} +1 -1
  39. package/dist/index.cjs.js +4 -4
  40. package/dist/index.es.js +6713 -9831
  41. package/dist/{input-container-CyOgiiQD.cjs → input-container-BaWQLWB6.cjs} +1 -1
  42. package/dist/{input-container-8JFB11xN.js → input-container-DCS5oJ4S.js} +4 -4
  43. package/dist/{it-BxOIJE45.cjs → it-DT5oRZDH.cjs} +1 -1
  44. package/dist/{it-Yeklau78.js → it-aV6i8Qxz.js} +1 -1
  45. package/dist/{ja-Dxj9Q5Yd.js → ja-CuLhGnJX.js} +1 -1
  46. package/dist/{ja-CNhjK06P.cjs → ja-CwKaCYLB.cjs} +1 -1
  47. package/dist/json-schema/index.cjs.js +1 -1
  48. package/dist/json-schema/index.es.js +83 -79
  49. package/dist/json-schema-display/index.cjs.js +1 -1
  50. package/dist/json-schema-display/index.es.js +2 -2
  51. package/dist/json-structure/index.cjs.js +1 -1
  52. package/dist/json-structure/index.es.js +74 -72
  53. package/dist/{ko-DgkqcXTs.cjs → ko-Bucro9ID.cjs} +1 -1
  54. package/dist/{ko-gn_MsegK.js → ko-D-66BsEX.js} +1 -1
  55. package/dist/lexical/index.cjs.js +1 -1
  56. package/dist/lexical/index.es.js +5 -5
  57. package/dist/menu-BFLFKceF.cjs +1 -0
  58. package/dist/menu-BO6zqyfq.js +220 -0
  59. package/dist/modal-6Mq3vS5r.js +309 -0
  60. package/dist/modal-d77-TMc4.cjs +1 -0
  61. package/dist/{nl-vHNFtXXb.js → nl-CAny6wvm.js} +1 -1
  62. package/dist/{nl-Dy9lmbBO.cjs → nl-D7vHpehb.cjs} +1 -1
  63. package/dist/notice-BNGx86Yg.js +110 -0
  64. package/dist/notice-iF6zBMq9.cjs +1 -0
  65. package/dist/{oneof-branch-detection-Q_jxvJIA.js → oneof-branch-detection-Bm17RhC2.js} +27 -26
  66. package/dist/oneof-branch-detection-DZ4MrfBp.cjs +1 -0
  67. package/dist/openui/index.cjs.js +9 -0
  68. package/dist/openui/index.es.js +2174 -0
  69. package/dist/password-input-Bipt7Wsu.cjs +1 -0
  70. package/dist/password-input-mkRmrEPq.js +105 -0
  71. package/dist/{pl-BtYbtsmG.cjs → pl-CSiXoOKT.cjs} +1 -1
  72. package/dist/{pl-C0UdHla0.js → pl-rmZLgQ_V.js} +1 -1
  73. package/dist/prosemirror/index.cjs.js +1 -1
  74. package/dist/prosemirror/index.es.js +4 -4
  75. package/dist/{pt-CtNmqQ1X.cjs → pt-CJT-iq4y.cjs} +1 -1
  76. package/dist/{pt-DGKtfN0d.js → pt-DHnajqAi.js} +1 -1
  77. package/dist/{ru-CpXYLt-v.js → ru-C_E8OZNE.js} +1 -1
  78. package/dist/{ru-BaL_NPRU.cjs → ru-G3sr_ctV.cjs} +1 -1
  79. package/dist/slider-input-SLguFA0d.cjs +1 -0
  80. package/dist/slider-input-VYAMm7pE.js +285 -0
  81. package/dist/stepper-24p16Zsv.cjs +1 -0
  82. package/dist/stepper-TlzbfYWa.js +3222 -0
  83. package/dist/tailwind/preset.cjs.js +1 -1
  84. package/dist/tailwind/preset.es.js +38 -40
  85. package/dist/tailwind/vite-plugin.cjs.js +14 -12
  86. package/dist/tailwind/vite-plugin.es.js +317 -246
  87. package/dist/text-area-BdemKQ_w.cjs +1 -0
  88. package/dist/text-area-Br83-_PQ.js +431 -0
  89. package/dist/{text-input-NJypZSnE.js → text-input-ByuxdX8w.js} +5 -5
  90. package/dist/{text-input-DS5zlXb2.cjs → text-input-MjlUC_9u.cjs} +1 -1
  91. package/dist/{toolbar-BF2L6WKC.js → toolbar-CEBTTjHh.js} +1 -1
  92. package/dist/{toolbar-BBwfe8U9.cjs → toolbar-DWawYFFX.cjs} +1 -1
  93. package/dist/{tr-DwOd87oB.cjs → tr-DcxLHHTC.cjs} +1 -1
  94. package/dist/{tr-DIFZDFW_.js → tr-bVXwloKC.js} +1 -1
  95. package/dist/{translations-EwEmHe3v.cjs → translations-D3xqZUTA.cjs} +1 -1
  96. package/dist/{translations-BCMP-h52.js → translations-DU9wTV1y.js} +20 -19
  97. package/dist/{translations-5cXBrENb.js → translations-RT_UN8ny.js} +1 -1
  98. package/dist/{translations-BqWc0ZHz.cjs → translations-qljG2Chq.cjs} +1 -1
  99. package/dist/types/components/navigation/stepper.d.ts +4 -4
  100. package/dist/types/openui/index.d.ts +28 -0
  101. package/dist/types/openui/library/define-component.d.ts +15 -0
  102. package/dist/types/openui/library/library.d.ts +7 -0
  103. package/dist/types/openui/library/prompt-generator.d.ts +5 -0
  104. package/dist/types/openui/library/types.d.ts +33 -0
  105. package/dist/types/openui/parser/parser.d.ts +8 -0
  106. package/dist/types/openui/parser/streaming-parser.d.ts +14 -0
  107. package/dist/types/openui/parser/tokenizer.d.ts +9 -0
  108. package/dist/types/openui/parser/types.d.ts +46 -0
  109. package/dist/types/openui/registry/button.d.ts +148 -0
  110. package/dist/types/openui/registry/data.d.ts +177 -0
  111. package/dist/types/openui/registry/form.d.ts +65 -0
  112. package/dist/types/openui/registry/format.d.ts +67 -0
  113. package/dist/types/openui/registry/index.d.ts +9 -0
  114. package/dist/types/openui/registry/layout.d.ts +45 -0
  115. package/dist/types/openui/registry/navigation.d.ts +149 -0
  116. package/dist/types/openui/registry/overlay.d.ts +56 -0
  117. package/dist/types/openui/registry/typography.d.ts +17 -0
  118. package/dist/types/openui/renderer/action-context.d.ts +24 -0
  119. package/dist/types/openui/renderer/node-resolver.d.ts +9 -0
  120. package/dist/types/openui/renderer/openui-renderer.d.ts +32 -0
  121. package/dist/types/openui/renderer/skeleton.d.ts +2 -0
  122. package/dist/types/openui/streaming/from-fetch.d.ts +7 -0
  123. package/dist/types/openui/streaming/from-sse.d.ts +7 -0
  124. package/dist/types/openui/streaming/from-websocket.d.ts +10 -0
  125. package/dist/types/openui/streaming/types.d.ts +5 -0
  126. package/dist/types/tailwind/preset.d.ts +25 -4
  127. package/dist/types/tailwind/vite-plugin.d.ts +17 -5
  128. package/dist/types/tokens/colors.d.ts +87 -9
  129. package/dist/types/tokens/index.d.ts +7 -6
  130. package/dist/{ur-DBst-TXc.js → ur-Dls2qb4V.js} +1 -1
  131. package/dist/{ur-D9nLchps.cjs → ur-IRQoHh1E.cjs} +1 -1
  132. package/dist/use-form-BZ8vDYOv.cjs +2 -0
  133. package/dist/use-form-DsCzINfm.js +750 -0
  134. package/dist/utils-D3-NApSw.cjs +1 -0
  135. package/dist/utils-Nbh7yQ73.js +105 -0
  136. package/dist/{vi-Dg1aiMr5.cjs → vi-Bi9SvVCP.cjs} +1 -1
  137. package/dist/{vi-DQOJp32U.js → vi-C3mTzj50.js} +1 -1
  138. package/dist/widget-customization-BV6XB2v_.cjs +1 -0
  139. package/dist/widget-customization-Bso45ONQ.js +1198 -0
  140. package/dist/{zh-DPK4HXl2.js → zh-B4JRJBt2.js} +1 -1
  141. package/dist/{zh-tbwSTbmn.cjs → zh-BMU5rYu1.cjs} +1 -1
  142. package/package.json +31 -20
  143. package/dist/auth-divider-CjcrgXmq.cjs +0 -1
  144. package/dist/custom-validation-7por5nJN.js +0 -488
  145. package/dist/custom-validation-CLscGHY4.cjs +0 -1
  146. package/dist/deep-merge-D90SW1Ci.cjs +0 -1
  147. package/dist/deep-merge-DT2H9AGq.js +0 -1765
  148. package/dist/duration-input-4AQnQpyo.cjs +0 -1
  149. package/dist/menu-B60Q9j3-.cjs +0 -1
  150. package/dist/menu-BkqFGcXg.js +0 -366
  151. package/dist/notice-CQGJyZ8o.js +0 -211
  152. package/dist/notice-p2IqXS5-.cjs +0 -1
  153. package/dist/oneof-branch-detection-xDDDdYRk.cjs +0 -1
  154. package/dist/use-form-8NnZ-KHk.js +0 -1090
  155. package/dist/use-form-Dcra7GeE.cjs +0 -2
  156. package/dist/utils-DmEuG3Np.cjs +0 -1
  157. package/dist/utils-vUtP6iPG.js +0 -165
  158. package/dist/widget-customization-BIBva3f-.js +0 -1458
  159. package/dist/widget-customization-pqmtsraC.cjs +0 -1
@@ -0,0 +1,1346 @@
1
+ import { Task as be, Use as E, Value as f, prop as me, html as v, attr as s, on as U, WithElement as Ie, Empty as S, aria as ue, bind as K, When as B, NotEmpty as Se, Fragment as N, ForEach as se, computedOf as F, OnDispose as Te, Repeat as Be, signal as ge, input as te, emitValue as H } from "@tempots/dom";
2
+ import { a as q, B as fe } from "./input-container-DCS5oJ4S.js";
3
+ import { B as R, f as xe, I as O, d as pe } from "./translations-DU9wTV1y.js";
4
+ import { C as ee, F as Le } from "./control-hqEuMzyI.js";
5
+ import { C as ne, m as Fe } from "./text-input-ByuxdX8w.js";
6
+ import { N as $e, r as ie, G as ye } from "./text-area-Br83-_PQ.js";
7
+ import { S as Ve } from "./stack-BLMteGTn.js";
8
+ import { a as re, m as we } from "./use-form-DsCzINfm.js";
9
+ import { strictEqual as J } from "@tempots/std";
10
+ let oe = null;
11
+ async function de() {
12
+ const t = globalThis;
13
+ return t.Temporal ? t.Temporal : (oe || (oe = import("./index.esm-By0m3ki1.js").then((e) => {
14
+ const n = e.Temporal;
15
+ return t.Temporal || (t.Temporal = n), n;
16
+ })), oe);
17
+ }
18
+ const Ee = (t, e) => e ? be(de, {
19
+ then: t,
20
+ pending: e.pending,
21
+ error: e.error
22
+ }) : be(de, t);
23
+ function ce({
24
+ onChange: t,
25
+ value: e,
26
+ accept: n = "*/*",
27
+ enableClick: l = !0,
28
+ content: i,
29
+ disabled: x = !1,
30
+ allowMultiple: c
31
+ }) {
32
+ return E(R, (m) => {
33
+ const p = f.deriveProp(e ?? []), _ = me(!1), h = (d) => {
34
+ d.preventDefault(), d.stopPropagation(), _.value = !0;
35
+ }, b = (d) => {
36
+ d.preventDefault(), d.stopPropagation(), (!d.currentTarget || !d.currentTarget.contains(d.relatedTarget)) && (_.value = !1);
37
+ }, k = (d) => {
38
+ d.preventDefault(), d.stopPropagation(), _.value = !1;
39
+ const y = Array.from(d.dataTransfer?.files || []);
40
+ y.length > 0 && (p.value = y, t(y, "dragdrop"));
41
+ }, o = (d) => {
42
+ f.get(l) && d.currentTarget.querySelector(
43
+ 'input[type="file"]'
44
+ )?.click();
45
+ };
46
+ let a = null;
47
+ const D = () => {
48
+ if (a == null) return;
49
+ const d = Array.from(a.files ?? []);
50
+ d.length > 0 && (p.value = d, t(d, "click")), a.value = "";
51
+ }, z = (d) => {
52
+ f.get(l) && (d.key === "Enter" || d.key === " ") && (d.preventDefault(), o(d));
53
+ };
54
+ return v.div(
55
+ s.role("button"),
56
+ s.tabindex(
57
+ f.map(l, (d) => d ? 0 : -1)
58
+ ),
59
+ s.style("position: relative;"),
60
+ U.dragover(h),
61
+ U.dragleave(b),
62
+ U.drop(k),
63
+ U.click(o),
64
+ U.keydown(z),
65
+ // Hidden file input
66
+ v.input(
67
+ s.type("file"),
68
+ s.disabled(x),
69
+ s.accept(n),
70
+ s.multiple(c),
71
+ s.style(
72
+ "position: absolute; left: -9999px; opacity: 0; pointer-events: none;"
73
+ ),
74
+ U.change(D),
75
+ Ie((d) => (a = d, p.on((y) => {
76
+ const I = globalThis.DataTransfer;
77
+ if (I != null) {
78
+ const C = new I();
79
+ y.forEach((L) => C.items.add(L)), d.files = C.files;
80
+ }
81
+ }), S))
82
+ ),
83
+ // Screen reader instructions
84
+ ue.label(K(m.$.dropZoneInstructions)(l)),
85
+ // Content
86
+ i({
87
+ files: p,
88
+ clear: () => p.value = [],
89
+ change: (d) => p.set(d)
90
+ })
91
+ );
92
+ });
93
+ }
94
+ function Re(t) {
95
+ const e = t.type.toLowerCase();
96
+ return e.startsWith("image/") && (e.includes("jpeg") || e.includes("jpg") || e.includes("png") || e.includes("gif") || e.includes("webp") || e.includes("svg"));
97
+ }
98
+ function Oe(t) {
99
+ const e = t.type.toLowerCase();
100
+ 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";
101
+ }
102
+ function ae(t) {
103
+ return B(
104
+ t.map(Re),
105
+ () => {
106
+ const e = me(null);
107
+ return t.on((n) => {
108
+ e.value && URL.revokeObjectURL(e.value);
109
+ const l = URL.createObjectURL(n);
110
+ e.value = l;
111
+ }), v.div(
112
+ Te(() => {
113
+ e.value && URL.revokeObjectURL(e.value);
114
+ }),
115
+ s.class("bc-file-input__thumbnail-container"),
116
+ v.img(
117
+ s.src(e),
118
+ s.alt(t.map((n) => n.name)),
119
+ s.class("bc-file-input__thumbnail")
120
+ )
121
+ );
122
+ },
123
+ () => O({ icon: t.map(Oe) })
124
+ );
125
+ }
126
+ const rt = (t, ...e) => {
127
+ const {
128
+ value: n = me([]),
129
+ accept: l = "*/*",
130
+ maxFiles: i,
131
+ maxFileSize: x,
132
+ onChange: c,
133
+ onBlur: m,
134
+ disabled: p,
135
+ hasError: _,
136
+ mode: h = "default",
137
+ showFileList: b = !0,
138
+ ...k
139
+ } = t, o = n, a = f.map(h, (w) => w === "input"), D = f.map(h, (w) => w === "compact"), z = (w) => {
140
+ let r = w;
141
+ if (i != null) {
142
+ const u = f.get(i);
143
+ r = r.slice(0, u);
144
+ }
145
+ if (x) {
146
+ const u = f.get(x);
147
+ r = r.filter((M) => M.size <= u);
148
+ }
149
+ c?.(r);
150
+ }, d = (w) => {
151
+ const u = o.value.filter((M, T) => T !== w);
152
+ c?.(u);
153
+ }, y = () => {
154
+ c?.([]);
155
+ }, I = ({
156
+ files: w,
157
+ clear: r,
158
+ change: u
159
+ }) => E(
160
+ R,
161
+ (M) => v.div(
162
+ s.class("bc-file-input__drop-zone"),
163
+ v.div(
164
+ s.class(
165
+ "bc-file-input__drop-zone-content bc-file-input__drop-zone-content--empty"
166
+ ),
167
+ O({ icon: "mdi:cloud-upload-outline", size: "xl" }),
168
+ v.div(
169
+ s.class("bc-file-input__drop-zone-text"),
170
+ K(M.$.filesInputInstructions)(
171
+ i,
172
+ x,
173
+ M.$.fileSizeUnits.value
174
+ )
175
+ )
176
+ )
177
+ )
178
+ ), C = ({
179
+ files: w
180
+ }) => E(
181
+ R,
182
+ (r) => v.div(
183
+ s.class("bc-file-input__compact-drop-zone"),
184
+ B(
185
+ w.map((u) => u.length > 0),
186
+ () => v.div(
187
+ s.class("bc-file-input__compact-file-list"),
188
+ se(w, (u, M) => {
189
+ const T = M.index;
190
+ return v.div(
191
+ s.class("bc-file-input__compact-file-item"),
192
+ v.div(
193
+ s.class("bc-file-input__compact-file-icon"),
194
+ ae(u)
195
+ ),
196
+ v.div(
197
+ s.class("bc-file-input__compact-file-info"),
198
+ v.div(
199
+ s.class("bc-file-input__compact-file-name"),
200
+ s.title(u.$.name),
201
+ u.$.name
202
+ ),
203
+ v.div(
204
+ s.class("bc-file-input__compact-file-meta"),
205
+ F(
206
+ u.$.size,
207
+ r.$.fileSizeUnits
208
+ )((g, $) => xe(g, { units: $ })),
209
+ " • ",
210
+ F(
211
+ u.$.type,
212
+ r.$.unknownType
213
+ )((g, $) => g || $)
214
+ )
215
+ ),
216
+ ee(
217
+ {
218
+ size: "sm",
219
+ label: r.$.removeFile,
220
+ disabled: p,
221
+ onClick: () => d(T)
222
+ },
223
+ s.class("bc-file-input__compact-remove-button")
224
+ )
225
+ );
226
+ })
227
+ ),
228
+ () => v.div(
229
+ s.class("bc-file-input__compact-placeholder"),
230
+ O({ icon: "mdi:cloud-upload-outline", size: "lg" }),
231
+ v.div(
232
+ s.class("bc-file-input__compact-placeholder-text"),
233
+ K(r.$.filesInputInstructions)(
234
+ i,
235
+ x,
236
+ r.$.fileSizeUnits.value
237
+ )
238
+ )
239
+ )
240
+ )
241
+ )
242
+ ), L = ({
243
+ files: w
244
+ }) => E(
245
+ R,
246
+ (r) => v.div(
247
+ s.class("bc-file-input__compact-input"),
248
+ B(
249
+ w.map((u) => u.length > 0),
250
+ () => v.span(
251
+ s.class("bc-file-input__compact-value"),
252
+ se(
253
+ w,
254
+ (u) => v.span(
255
+ s.class("bc-file-input__compact-value-item"),
256
+ ae(u),
257
+ v.span(
258
+ s.class("bc-file-input__compact-value-item-name"),
259
+ u.$.name
260
+ )
261
+ )
262
+ )
263
+ ),
264
+ () => v.span(
265
+ s.class("bc-file-input__compact-placeholder"),
266
+ O({ icon: "mdi:cloud-upload-outline", size: "md" }),
267
+ " ",
268
+ K(r.$.filesInputInstructions)(
269
+ i,
270
+ x,
271
+ r.$.fileSizeUnits.value
272
+ )
273
+ )
274
+ )
275
+ )
276
+ );
277
+ return E(
278
+ R,
279
+ (w) => q(
280
+ {
281
+ baseContainer: f.map(a, (r) => !r),
282
+ disabled: p,
283
+ hasError: _,
284
+ after: B(
285
+ a,
286
+ () => B(
287
+ o.map(({ length: r }) => r > 0),
288
+ () => ee(
289
+ {
290
+ size: "sm",
291
+ label: w.$.clearAllFiles,
292
+ disabled: p,
293
+ onClick: y
294
+ },
295
+ s.class("bc-file-input__compact-clear")
296
+ )
297
+ )
298
+ ),
299
+ ...k,
300
+ input: B(
301
+ a,
302
+ () => v.div(
303
+ s.class("bc-file-input bc-file-input--input"),
304
+ ce({
305
+ value: o,
306
+ accept: l,
307
+ enableClick: !0,
308
+ allowMultiple: f.map(i ?? 1 / 0, (r) => r > 1),
309
+ disabled: p,
310
+ onChange: z,
311
+ content: L
312
+ })
313
+ ),
314
+ () => B(
315
+ D,
316
+ () => v.div(
317
+ s.class("bc-file-input bc-file-input--compact"),
318
+ ce({
319
+ value: o,
320
+ accept: l,
321
+ enableClick: !0,
322
+ allowMultiple: f.map(i ?? 1 / 0, (r) => r > 1),
323
+ disabled: p,
324
+ onChange: z,
325
+ content: C
326
+ })
327
+ ),
328
+ () => v.div(
329
+ s.class("bc-file-input"),
330
+ ce({
331
+ value: o,
332
+ accept: l,
333
+ enableClick: !0,
334
+ allowMultiple: f.map(i ?? 1 / 0, (r) => r > 1),
335
+ disabled: p,
336
+ onChange: z,
337
+ content: I
338
+ }),
339
+ B(
340
+ b,
341
+ () => Se(
342
+ o,
343
+ () => N(
344
+ v.div(
345
+ s.class("bc-file-input__file-list"),
346
+ se(o, (r, u) => {
347
+ const M = u.index;
348
+ return v.div(
349
+ s.class("bc-file-input__file-item"),
350
+ v.div(
351
+ s.class("bc-file-input__file-icon"),
352
+ ae(r)
353
+ ),
354
+ v.div(
355
+ s.class("bc-file-input__file-info"),
356
+ v.div(
357
+ s.class("bc-file-input__file-name"),
358
+ s.title(r.$.name),
359
+ r.$.name
360
+ ),
361
+ v.div(
362
+ s.class("bc-file-input__file-meta"),
363
+ F(
364
+ r.$.size,
365
+ w.$.fileSizeUnits
366
+ )(
367
+ (T, g) => xe(T, { units: g })
368
+ ),
369
+ " • ",
370
+ F(
371
+ r.$.type,
372
+ w.$.unknownType
373
+ )((T, g) => T || g)
374
+ )
375
+ ),
376
+ ee(
377
+ {
378
+ size: "sm",
379
+ label: w.$.removeFile,
380
+ disabled: p,
381
+ onClick: () => d(M)
382
+ },
383
+ s.class("bc-file-input__remove-button")
384
+ )
385
+ );
386
+ })
387
+ ),
388
+ B(
389
+ o.map(({ length: r }) => r > 1),
390
+ () => v.div(
391
+ s.class(
392
+ "bc-file-input__clear-all-button-container"
393
+ ),
394
+ v.button(
395
+ s.type("button"),
396
+ s.class("bc-file-input__clear-all-button"),
397
+ s.disabled(p),
398
+ w.$.clearAllFiles,
399
+ U.click((r) => {
400
+ r.preventDefault(), r.stopPropagation(), y();
401
+ })
402
+ )
403
+ )
404
+ )
405
+ )
406
+ )
407
+ )
408
+ )
409
+ )
410
+ )
411
+ },
412
+ ...e
413
+ )
414
+ );
415
+ };
416
+ function je(t, e, n) {
417
+ const l = t.length.map((i) => i);
418
+ return Be(
419
+ l,
420
+ (i) => {
421
+ const x = t.item(i.index), c = [];
422
+ return N(
423
+ Te(() => {
424
+ c.forEach((m) => m());
425
+ }),
426
+ e({
427
+ list: t,
428
+ item: x,
429
+ position: i,
430
+ remove: () => t.removeAt(i.index),
431
+ move: (m) => {
432
+ switch (m) {
433
+ case "up":
434
+ if (i.index === 0) return;
435
+ t.move(i.index, i.index - 1);
436
+ break;
437
+ case "down":
438
+ if (i.index === t.length.value - 1) return;
439
+ t.move(i.index, i.index + 1);
440
+ break;
441
+ case "first":
442
+ t.move(i.index, 0);
443
+ break;
444
+ case "last":
445
+ t.move(i.index, t.length.value - 1);
446
+ }
447
+ },
448
+ canMove: (m) => {
449
+ const p = (() => {
450
+ switch (m) {
451
+ case "up":
452
+ return ge(i.index > 0);
453
+ case "down":
454
+ return t.length.map((_) => i.index < _ - 1);
455
+ }
456
+ })();
457
+ return c.push(() => p.dispose()), p;
458
+ },
459
+ cannotMove: (m) => {
460
+ const p = (() => {
461
+ switch (m) {
462
+ case "up":
463
+ return ge(i.index === 0);
464
+ case "down":
465
+ return t.length.map((_) => i.index === _ - 1);
466
+ }
467
+ })();
468
+ return c.push(() => p.dispose()), p;
469
+ }
470
+ })
471
+ );
472
+ },
473
+ n
474
+ );
475
+ }
476
+ const _e = {
477
+ 9: { pattern: /^[0-9]$/ },
478
+ A: { pattern: /^[A-Za-z]$/, transform: (t) => t.toUpperCase() },
479
+ "*": { pattern: /^.$/ }
480
+ }, Ne = (t) => t instanceof RegExp;
481
+ function Ue(t, e, n) {
482
+ if (t == null) return [];
483
+ const l = n ? { ..._e, ...e } : e ?? _e, i = (c, m) => {
484
+ const p = l[m];
485
+ p ? c.push({ type: "pattern", name: m, ...p }) : c.push({ type: "literal", char: m });
486
+ }, x = [];
487
+ if (typeof t == "string") {
488
+ for (const c of t) i(x, c);
489
+ return x;
490
+ }
491
+ for (const c of t)
492
+ if (typeof c == "string")
493
+ if (c.length <= 1) i(x, c);
494
+ else for (const m of c) i(x, m);
495
+ else Ne(c) ? x.push({ type: "pattern", pattern: c }) : typeof c == "object" && c && x.push(c);
496
+ return x;
497
+ }
498
+ function Pe(t, e) {
499
+ return (n) => {
500
+ switch (t) {
501
+ case "digits":
502
+ return /[0-9]/.test(n);
503
+ case "letters":
504
+ return /[A-Za-z]/.test(n);
505
+ case "alphanumeric":
506
+ return /[A-Za-z0-9]/.test(n);
507
+ case "custom":
508
+ return e?.(n) ?? !0;
509
+ default:
510
+ return !0;
511
+ }
512
+ };
513
+ }
514
+ function ke(t, e, n, l, i, x) {
515
+ const c = {
516
+ raw: t,
517
+ previousConformed: e,
518
+ cursor: i ?? t.length,
519
+ completed: !1
520
+ }, m = l.definitions ?? {}, p = typeof n == "function" ? n(t, c) : n, _ = Ue(
521
+ p,
522
+ m,
523
+ l.useDefaultDefinitions ?? !0
524
+ ), h = Pe(l.allowMode, l.allow), b = /* @__PURE__ */ new Set();
525
+ for (const g of _) g.type === "literal" && b.add(g.char);
526
+ if (l.prefix) for (const g of l.prefix) b.add(g);
527
+ if (l.suffix) for (const g of l.suffix) b.add(g);
528
+ const k = Array.from(t).filter((g) => h(g) && !b.has(g));
529
+ if (k.length === 0) return { value: "", cursor: 0, completed: !1 };
530
+ const o = [], a = [];
531
+ let D = 0, z = 0, d = 0, y = -1;
532
+ for (const g of _) {
533
+ if (g.type === "literal") {
534
+ o.push(g.char), a.push({ kind: "literal", filled: !0 });
535
+ continue;
536
+ }
537
+ z += g.optional ? 0 : 1;
538
+ const $ = k[D];
539
+ if ($ == null)
540
+ break;
541
+ if (g.type === "any") {
542
+ d++, o.push(g.transform ? g.transform($) : $), a.push({ kind: "slot", filled: !0 }), y = a.length - 1, D++;
543
+ continue;
544
+ }
545
+ if (g.type === "pattern")
546
+ if (g.pattern.test($)) {
547
+ d++;
548
+ const V = g.transform ? g.transform($) : $;
549
+ o.push(V), a.push({ kind: "slot", filled: !0 }), y = a.length - 1, D++;
550
+ } else {
551
+ D++;
552
+ continue;
553
+ }
554
+ }
555
+ const I = o.join(""), C = (l.prefix ?? "") + I + (l.suffix ?? "");
556
+ let w = (l.prefix ?? "").length;
557
+ if (y >= 0) {
558
+ let g = y + 1;
559
+ if ((x?.policy ?? "smart") !== "sticky")
560
+ for (; g < a.length && a[g].kind === "literal"; ) g++;
561
+ w += g;
562
+ }
563
+ const r = l.completion?.mode === "min" ? (l.completion.minChars ?? 0) <= d : l.completion?.mode === "custom" ? !!l.completion.isComplete?.(C) : z > 0 && d >= z, u = l.pipe?.(C, { ...c, completed: r });
564
+ let M, T = w;
565
+ return u === !1 ? (M = e, T = e.length) : typeof u == "string" ? (M = u, T = u.length) : typeof u == "object" && u ? (M = u.value, T = u.cursor ?? u.value.length) : M = C, { value: M, cursor: T, completed: r };
566
+ }
567
+ function We(t, e) {
568
+ const n = e?.strategy ?? "none";
569
+ return n === "custom" && e?.unmask ? e.unmask(t) : n === "strip" ? t.replace(/[^A-Za-z0-9]/g, "") : t;
570
+ }
571
+ const ze = (t) => {
572
+ const {
573
+ value: e,
574
+ onBlur: n,
575
+ onChange: l,
576
+ onInput: i,
577
+ onAccept: x,
578
+ onComplete: c,
579
+ mask: m,
580
+ definitions: p,
581
+ useDefaultDefinitions: _,
582
+ extraLiterals: h,
583
+ prefix: b,
584
+ suffix: k,
585
+ autofix: o,
586
+ pipe: a,
587
+ completion: D,
588
+ unmask: z,
589
+ allowMode: d,
590
+ allow: y,
591
+ placeholder: I,
592
+ placeholderOptions: C
593
+ } = t, L = F(
594
+ e,
595
+ m,
596
+ p,
597
+ _,
598
+ h,
599
+ b,
600
+ k,
601
+ o,
602
+ D,
603
+ z,
604
+ d,
605
+ I,
606
+ C
607
+ )((r, u, M, T, g, $, V, Y, G, Z, P, Q, j) => u ? ke(r ?? "", "", u, {
608
+ definitions: M ?? {},
609
+ useDefaultDefinitions: T ?? !0,
610
+ extraLiterals: g ?? [],
611
+ autofix: Y ?? "none",
612
+ completion: G ?? { mode: "mask" },
613
+ pipe: a ?? ((A) => A),
614
+ unmask: Z ?? { strategy: "none" },
615
+ allowMode: P ?? "all",
616
+ allow: y,
617
+ prefix: $,
618
+ suffix: V
619
+ }).value : r ?? ""), w = (r, u) => {
620
+ const M = r.value ?? "", T = f.get(e) ?? "", g = m != null ? f.get(m) : null, $ = p != null ? f.get(p) : void 0, V = _ != null ? f.get(_) : void 0, Y = h != null ? f.get(h) : void 0, G = o != null ? f.get(o) : void 0, Z = D != null ? f.get(D) : void 0, P = z != null ? f.get(z) : void 0, Q = d != null ? f.get(d) : void 0, j = b != null ? f.get(b) : void 0, A = k != null ? f.get(k) : void 0, {
621
+ value: W,
622
+ cursor: le,
623
+ completed: he
624
+ } = g ? ke(
625
+ M,
626
+ T,
627
+ g,
628
+ {
629
+ definitions: $ ?? {},
630
+ useDefaultDefinitions: V ?? !0,
631
+ extraLiterals: Y ?? [],
632
+ autofix: G ?? "none",
633
+ completion: Z ?? { mode: "mask" },
634
+ pipe: a ?? ((Ae) => Ae),
635
+ unmask: P ?? { strategy: "none" },
636
+ allowMode: Q ?? "all",
637
+ allow: y,
638
+ prefix: j,
639
+ suffix: A
640
+ },
641
+ r.selectionStart ?? M.length,
642
+ t.cursor ? f.get(t.cursor) : void 0
643
+ ) : { value: M, cursor: M.length, completed: !0 };
644
+ if (W !== M) {
645
+ r.value = W;
646
+ try {
647
+ r.setSelectionRange(le, le);
648
+ } catch {
649
+ }
650
+ }
651
+ const ve = We(W, P);
652
+ x?.({
653
+ raw: ve,
654
+ conformed: W,
655
+ completed: he,
656
+ cursor: le
657
+ }), u === "input" ? i?.(W) : (l?.(W), he && c?.({ raw: ve, conformed: W }));
658
+ };
659
+ return q({
660
+ ...t,
661
+ input: te.text(
662
+ ne(t),
663
+ s.value(L),
664
+ s.class("bc-input"),
665
+ n != null ? U.blur(n) : S,
666
+ Ie(
667
+ (r) => r instanceof HTMLInputElement ? N(
668
+ U.input(() => w(r, "input")),
669
+ U.change(() => w(r, "change")),
670
+ U.keydown((u) => {
671
+ if (u.key !== "Backspace" || !(t.cursor ? f.get(t.cursor)?.backspaceRubberBand ?? !0 : !0)) return;
672
+ const T = r.selectionStart ?? 0, g = r.selectionEnd ?? T;
673
+ if (T !== g || T <= 0) return;
674
+ const $ = r.value ?? "", V = m != null ? f.get(m) : null;
675
+ if (!V) return;
676
+ const Y = p != null ? f.get(p) : void 0, G = _ != null ? f.get(_) : !0, Z = b != null ? f.get(b) : void 0, P = k != null ? f.get(k) : void 0, Q = Ue(
677
+ typeof V == "function" ? V($, {
678
+ raw: $,
679
+ previousConformed: $,
680
+ cursor: T,
681
+ completed: !1
682
+ }) : V,
683
+ Y ?? {},
684
+ G ?? !0
685
+ ), j = /* @__PURE__ */ new Set();
686
+ for (const A of Q)
687
+ A.type === "literal" && j.add(A.char);
688
+ if (Z) for (const A of Z) j.add(A);
689
+ if (P) for (const A of P) j.add(A);
690
+ if (j.has($[T - 1])) {
691
+ let A = T - 1;
692
+ for (; A >= 0 && j.has($[A]); ) A--;
693
+ A >= 0 && (u.preventDefault(), u.stopPropagation(), r.value = $.slice(0, A) + $.slice(A + 1), w(r, "input"));
694
+ }
695
+ })
696
+ ) : S
697
+ )
698
+ )
699
+ });
700
+ }, Ce = (t) => {
701
+ if (t == null || t === "") return null;
702
+ const e = Number(t);
703
+ return Number.isNaN(e) ? null : e;
704
+ }, ot = (t) => {
705
+ const { value: e, step: n, min: l, max: i, onBlur: x, onChange: c, onInput: m, after: p } = t, _ = (o) => {
706
+ const a = l != null ? f.get(l) : void 0, D = i != null ? f.get(i) : void 0;
707
+ return a != null && o < a ? a : D != null && o > D ? D : o;
708
+ }, h = (() => {
709
+ if (n == null) return null;
710
+ const o = F(
711
+ e,
712
+ l
713
+ )((y, I) => {
714
+ const C = y ?? 0;
715
+ return I == null ? !0 : C > I;
716
+ }), a = F(
717
+ e,
718
+ i
719
+ )((y, I) => {
720
+ const C = y ?? 0;
721
+ return I == null ? !0 : C < I;
722
+ }), D = (y) => {
723
+ const I = f.get(e) ?? 0, C = f.get(n), L = y?.shiftKey ? 10 : 1, w = ie(I - C * L, C), r = l != null ? f.get(l) : void 0;
724
+ if (r != null && w < r) return;
725
+ const u = _(w);
726
+ u !== I && (c?.(u), m?.(u));
727
+ }, z = (y) => {
728
+ const I = f.get(e) ?? 0, C = f.get(n), L = y?.shiftKey ? 10 : 1, w = ie(I + C * L, C), r = i != null ? f.get(i) : void 0;
729
+ if (r != null && w > r) return;
730
+ const u = _(w);
731
+ u !== I && (c?.(u), m?.(u));
732
+ };
733
+ return ((y, I) => Ve(
734
+ s.class("bc-number-input-steppers"),
735
+ v.button(
736
+ s.type("button"),
737
+ s.class(
738
+ "bc-button bc-number-input-steppers-button bc-number-input-steppers-button--increment"
739
+ ),
740
+ s.disabled(
741
+ F(
742
+ a,
743
+ t.disabled ?? !1
744
+ )((C, L) => !C || L)
745
+ ),
746
+ U.click((C) => z(C)),
747
+ ue.label(y),
748
+ O({ icon: "line-md:plus", size: "xs" })
749
+ ),
750
+ v.button(
751
+ s.type("button"),
752
+ s.class(
753
+ "bc-button bc-number-input-steppers-button bc-number-input-steppers-button--decrement"
754
+ ),
755
+ s.disabled(
756
+ F(
757
+ o,
758
+ t.disabled ?? !1
759
+ )((C, L) => !C || L)
760
+ ),
761
+ U.click((C) => D(C)),
762
+ ue.label(I),
763
+ O({ icon: "line-md:minus", size: "xs" })
764
+ )
765
+ ))(
766
+ pe.incrementValue,
767
+ pe.decrementValue
768
+ );
769
+ })(), b = $e(
770
+ e,
771
+ t.disabled,
772
+ c ?? m
773
+ ), k = p != null && h != null ? N(h, b, p) : p != null ? N(b, p) : h != null ? N(h, b) : b;
774
+ return q({
775
+ ...t,
776
+ input: te.number(
777
+ // min/max attributes and reactive watchers (no forced correction)
778
+ l != null ? s.min(l) : S,
779
+ i != null ? s.max(i) : S,
780
+ ne(t),
781
+ // Represent null as empty string so the field can be cleared
782
+ s.value(f.map(e, (o) => o == null ? "" : String(o))),
783
+ s.step(n),
784
+ s.class("bc-input bc-number-input"),
785
+ x != null ? U.blur(H(x)) : S,
786
+ c != null ? U.change(
787
+ H((o) => {
788
+ const a = Ce(o);
789
+ c(a);
790
+ })
791
+ ) : S,
792
+ m != null ? U.input(
793
+ H((o) => {
794
+ const a = Ce(o);
795
+ m(a);
796
+ })
797
+ ) : S,
798
+ // Wheel support when step is defined
799
+ n != null ? U.wheel((o) => {
800
+ o.preventDefault();
801
+ const a = f.get(e) ?? 0, D = f.get(n), z = o.shiftKey ? 10 : 1, d = o.deltaY < 0 ? D * z : -D * z, y = _(ie(a + d, D));
802
+ y !== a && (c?.(y), m?.(y));
803
+ }) : S
804
+ ),
805
+ after: k
806
+ });
807
+ }, ct = (t) => {
808
+ const e = {
809
+ type: "pattern",
810
+ pattern: /[0-9A-Fa-f]/,
811
+ transform: (i) => i.toLowerCase()
812
+ }, n = [
813
+ e,
814
+ e,
815
+ e,
816
+ e,
817
+ e,
818
+ e,
819
+ e,
820
+ e,
821
+ "-",
822
+ e,
823
+ e,
824
+ e,
825
+ e,
826
+ "-",
827
+ e,
828
+ e,
829
+ e,
830
+ e,
831
+ "-",
832
+ e,
833
+ e,
834
+ e,
835
+ e,
836
+ "-",
837
+ e,
838
+ e,
839
+ e,
840
+ e,
841
+ e,
842
+ e,
843
+ e,
844
+ e,
845
+ e,
846
+ e,
847
+ e,
848
+ e
849
+ ], l = t.class ? f.map(t.class, (i) => `bc-uuid-input ${i}`) : "bc-uuid-input";
850
+ return ze({
851
+ ...t,
852
+ class: l,
853
+ mask: n,
854
+ // Sensible default placeholder; can be overridden via options.placeholder
855
+ placeholder: t.placeholder ?? "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
856
+ });
857
+ }, Ze = /^P(\d+([YMWD]|$)){0,4}(T(\d+([HMS]|$)){0,3})?$/i, He = /^P(?:(\d+Y)?(\d+M)?(\d+W)?(\d+D)?)(T(\d+H)?(\d+M)?(\d+S)?)?$/i;
858
+ function Ye(t) {
859
+ return {
860
+ mask: null,
861
+ allowMode: "custom",
862
+ allow: (e) => /[0-9ptwdhms]/i.test(e),
863
+ pipe: (e) => {
864
+ const n = e.toUpperCase();
865
+ return n.length === 0 ? n : !n.startsWith("P") || !Ze.test(n) ? !1 : n;
866
+ },
867
+ completion: {
868
+ mode: "custom",
869
+ isComplete: (e) => {
870
+ const n = e.toUpperCase();
871
+ if (!He.test(n)) return !1;
872
+ try {
873
+ return t(n), !0;
874
+ } catch {
875
+ return !1;
876
+ }
877
+ }
878
+ }
879
+ };
880
+ }
881
+ const De = (t, e) => {
882
+ if (t == null) return null;
883
+ try {
884
+ return t.Duration.from(e);
885
+ } catch {
886
+ return null;
887
+ }
888
+ }, at = (t) => {
889
+ const { value: e, onChange: n, onInput: l, after: i, disabled: x, onBlur: c } = t, m = () => {
890
+ const h = $e(e, x, n ?? l);
891
+ return i != null ? N(h, i) : h;
892
+ }, p = t.placeholder != null ? S : s.placeholder("P0DT0H0M0S");
893
+ return Ee(
894
+ (h) => {
895
+ const b = Fe(
896
+ t,
897
+ (k) => k?.toString() ?? "",
898
+ (k) => k === "" ? null : h.Duration.from(k)
899
+ );
900
+ return ze({
901
+ ...b,
902
+ onInput: void 0,
903
+ ...Ye(h.Duration.from),
904
+ placeholder: "P0DT0H0M0S",
905
+ after: m()
906
+ });
907
+ },
908
+ { pending: () => {
909
+ const h = (b) => (k) => {
910
+ const a = k.currentTarget?.value ?? "";
911
+ if (a === "") {
912
+ b(null);
913
+ return;
914
+ }
915
+ const D = globalThis.Temporal, z = De(D, a);
916
+ if (z != null) {
917
+ b(z);
918
+ return;
919
+ }
920
+ de().then((d) => {
921
+ const y = De(d, a);
922
+ y != null && b(y);
923
+ }).catch(() => {
924
+ });
925
+ };
926
+ return q({
927
+ ...t,
928
+ input: te.text(
929
+ ne(t),
930
+ s.value(f.map(e, (b) => b?.toString() ?? "")),
931
+ s.class("bc-input"),
932
+ p,
933
+ c != null ? U.blur(() => c()) : S,
934
+ n != null ? U.change(h(n)) : S,
935
+ l != null ? U.input(h(l)) : S
936
+ ),
937
+ after: m()
938
+ });
939
+ } }
940
+ );
941
+ }, ut = (t) => {
942
+ const { value: e, onBlur: n, onChange: l, onInput: i } = t;
943
+ return q({
944
+ ...t,
945
+ input: te.url(
946
+ ne(t),
947
+ s.value(e),
948
+ s.class("bc-input"),
949
+ n != null ? U.blur(H(n)) : S,
950
+ l != null ? U.change(H(l)) : S,
951
+ i != null ? U.input(H(i)) : S
952
+ )
953
+ });
954
+ };
955
+ function Ge(t, e) {
956
+ const {
957
+ onMove: n,
958
+ cannotMoveUp: l,
959
+ cannotMoveDown: i,
960
+ onRemove: x,
961
+ showMove: c = !0,
962
+ showRemove: m = !0,
963
+ removeDisabled: p,
964
+ showMoveButtons: _ = !0,
965
+ layout: h = "aside"
966
+ } = t, b = f.toSignal(h).map((a) => a === "aside"), k = B(
967
+ c,
968
+ () => v.div(
969
+ s.class("bc-list-item-controls__move"),
970
+ fe(
971
+ {
972
+ size: "xs",
973
+ roundedness: "full",
974
+ variant: "text",
975
+ onClick: () => n("up"),
976
+ disabled: l
977
+ },
978
+ E(
979
+ R,
980
+ (a) => O({
981
+ size: "xs",
982
+ icon: "line-md:arrow-up",
983
+ title: a.$.incrementValue
984
+ })
985
+ )
986
+ ),
987
+ fe(
988
+ {
989
+ size: "xs",
990
+ roundedness: "full",
991
+ variant: "text",
992
+ onClick: () => n("down"),
993
+ disabled: i
994
+ },
995
+ E(
996
+ R,
997
+ (a) => O({
998
+ size: "xs",
999
+ icon: "line-md:arrow-down",
1000
+ title: a.$.decrementValue
1001
+ })
1002
+ )
1003
+ )
1004
+ )
1005
+ ), o = B(
1006
+ m,
1007
+ () => E(
1008
+ R,
1009
+ (a) => ee({
1010
+ size: "xs",
1011
+ label: f.map(a.$.removeItem, (D) => D.toLowerCase()),
1012
+ color: "danger",
1013
+ disabled: p,
1014
+ onClick: x
1015
+ })
1016
+ )
1017
+ );
1018
+ return B(
1019
+ b,
1020
+ () => v.div(
1021
+ s.class("bc-list-item-controls bc-list-item-controls--aside"),
1022
+ v.div(s.class("bc-list-item-controls__content"), e),
1023
+ v.div(
1024
+ s.class("bc-list-item-controls__actions"),
1025
+ B(_, () => k),
1026
+ o
1027
+ )
1028
+ ),
1029
+ () => v.div(
1030
+ s.class("bc-list-item-controls bc-list-item-controls--below"),
1031
+ v.div(s.class("bc-list-item-controls__content"), e),
1032
+ v.div(
1033
+ s.class("bc-list-item-controls__actions"),
1034
+ B(
1035
+ _,
1036
+ () => k,
1037
+ () => v.div()
1038
+ ),
1039
+ o
1040
+ )
1041
+ )
1042
+ );
1043
+ }
1044
+ const Je = (t) => {
1045
+ const {
1046
+ controller: e,
1047
+ element: n,
1048
+ separator: l,
1049
+ showMove: i = !0,
1050
+ showRemove: x = !0,
1051
+ showAdd: c = !0,
1052
+ createItem: m,
1053
+ addLabel: p,
1054
+ controlsLayout: _ = "aside",
1055
+ removeDisabled: h,
1056
+ addDisabled: b
1057
+ } = t, k = B(
1058
+ F(c, m)((o, a) => o && a != null),
1059
+ () => ye(
1060
+ s.class(
1061
+ "bc-group--gap-2 bc-group--align-center bc-group--justify-center"
1062
+ ),
1063
+ fe(
1064
+ {
1065
+ size: "sm",
1066
+ variant: "filled",
1067
+ onClick: () => e.push(m()),
1068
+ disabled: F(
1069
+ e.disabled,
1070
+ b ?? !1
1071
+ )(
1072
+ (o, a) => o || a
1073
+ )
1074
+ },
1075
+ E(
1076
+ R,
1077
+ (o) => ye(
1078
+ s.class("bc-group--gap-2"),
1079
+ O({ icon: "line-md:plus" }),
1080
+ p ?? o.$.addLabel
1081
+ )
1082
+ )
1083
+ )
1084
+ )
1085
+ );
1086
+ return N(
1087
+ je(
1088
+ e,
1089
+ (o) => Ge(
1090
+ {
1091
+ onMove: o.move,
1092
+ cannotMoveUp: o.cannotMove("up"),
1093
+ cannotMoveDown: o.cannotMove("down"),
1094
+ onRemove: o.remove,
1095
+ showMove: i,
1096
+ showRemove: x,
1097
+ removeDisabled: h,
1098
+ showMoveButtons: e.signal.map((a) => a.length > 1),
1099
+ layout: _
1100
+ },
1101
+ n(o)
1102
+ ),
1103
+ l
1104
+ ),
1105
+ k
1106
+ );
1107
+ }, ft = (t, ...e) => {
1108
+ const {
1109
+ controller: n,
1110
+ element: l,
1111
+ separator: i,
1112
+ showMove: x,
1113
+ showRemove: c,
1114
+ showAdd: m,
1115
+ createItem: p,
1116
+ addLabel: _,
1117
+ controlsLayout: h,
1118
+ removeDisabled: b,
1119
+ addDisabled: k,
1120
+ ...o
1121
+ } = t;
1122
+ return Le(
1123
+ {
1124
+ ...o,
1125
+ content: Je({
1126
+ controller: n,
1127
+ element: l,
1128
+ separator: i,
1129
+ showMove: x,
1130
+ showRemove: c,
1131
+ showAdd: m,
1132
+ createItem: p,
1133
+ addLabel: _,
1134
+ controlsLayout: h,
1135
+ removeDisabled: b,
1136
+ addDisabled: k
1137
+ })
1138
+ },
1139
+ ...e
1140
+ );
1141
+ };
1142
+ class pt extends re {
1143
+ /** The immutable list of branch definitions for this union */
1144
+ branches;
1145
+ /** Reactive signal containing the key of the currently active branch */
1146
+ activeBranch;
1147
+ /** @internal Reactive signal containing the controller for the active branch */
1148
+ #t;
1149
+ /** @internal Cache of lazily-created branch controllers */
1150
+ #e = /* @__PURE__ */ new Map();
1151
+ /**
1152
+ * Creates a new UnionController.
1153
+ *
1154
+ * @param path - The path segments identifying this controller in the form tree
1155
+ * @param change - Callback to propagate value changes to the parent
1156
+ * @param signal - Reactive signal holding the current union value
1157
+ * @param status - Reactive signal holding the current validation status
1158
+ * @param parent - Parent context providing disabled state and optional validation mode
1159
+ * @param branches - Array of branch definitions describing the possible value types
1160
+ * @param equals - Optional equality function for comparing values. Defaults to `strictEqual`.
1161
+ */
1162
+ constructor(e, n, l, i, x, c, m = J) {
1163
+ super(e, n, l, i, x, m), this.branches = c;
1164
+ const p = (h) => {
1165
+ for (const b of c)
1166
+ if (b.detect(h))
1167
+ return b.key;
1168
+ return c[0]?.key ?? "unknown";
1169
+ };
1170
+ this.activeBranch = l.map(p, J);
1171
+ const _ = (h) => {
1172
+ if (this.#e.has(h))
1173
+ return this.#e.get(h);
1174
+ const b = c.find((o) => o.key === h);
1175
+ if (!b)
1176
+ throw new Error(`Unknown branch: ${h}`);
1177
+ const k = new re(
1178
+ [...e, h],
1179
+ (o) => {
1180
+ this.change(o);
1181
+ },
1182
+ this.signal.map(
1183
+ (o) => b.detect(o) ? o : b.defaultValue(),
1184
+ m
1185
+ ),
1186
+ i.map(we([h])),
1187
+ {
1188
+ disabled: this.disabled,
1189
+ validationMode: this.parent.validationMode
1190
+ },
1191
+ m
1192
+ );
1193
+ return this.#e.set(h, k), k;
1194
+ };
1195
+ this.#t = this.activeBranch.map(
1196
+ (h) => _(h),
1197
+ J
1198
+ ), this.onDispose(() => {
1199
+ for (const h of this.#e.values())
1200
+ h.dispose();
1201
+ this.#e.clear(), this.activeBranch.dispose(), this.#t.dispose();
1202
+ });
1203
+ }
1204
+ /**
1205
+ * Gets the controller for the currently active branch.
1206
+ *
1207
+ * The returned controller's value and type correspond to the branch that
1208
+ * matches the current union value.
1209
+ *
1210
+ * @returns The `Controller<unknown>` for the active branch
1211
+ */
1212
+ get activeController() {
1213
+ return f.get(this.#t);
1214
+ }
1215
+ /**
1216
+ * Gets or creates a controller for a specific branch by key.
1217
+ *
1218
+ * Controllers are created lazily and cached for subsequent calls.
1219
+ *
1220
+ * @param branchKey - The unique key of the branch to get a controller for
1221
+ * @returns The `Controller<unknown>` for the specified branch
1222
+ * @throws Error if the branch key is not found in the branches array
1223
+ */
1224
+ getBranchController(e) {
1225
+ const n = this.branches.find((i) => i.key === e);
1226
+ if (!n)
1227
+ throw new Error(`Unknown branch: ${e}`);
1228
+ if (this.#e.has(e))
1229
+ return this.#e.get(e);
1230
+ const l = new re(
1231
+ [...this.path, e],
1232
+ (i) => {
1233
+ this.change(i);
1234
+ },
1235
+ this.signal.map(
1236
+ (i) => n.detect(i) ? i : n.defaultValue(),
1237
+ J
1238
+ ),
1239
+ this.status.map(we([e])),
1240
+ {
1241
+ disabled: this.disabled,
1242
+ validationMode: this.parent.validationMode
1243
+ },
1244
+ J
1245
+ );
1246
+ return this.#e.set(e, l), l;
1247
+ }
1248
+ /**
1249
+ * Switches the union value to a different branch.
1250
+ *
1251
+ * Attempts the following in order:
1252
+ * 1. If already on the target branch, returns `true` immediately
1253
+ * 2. If the branch has a `convert` function, tries to convert the current value
1254
+ * 3. If conversion fails and `confirmChange` is true, prompts the user with `window.confirm`
1255
+ * 4. Sets the value to the branch's default value
1256
+ *
1257
+ * @param branchKey - The key of the branch to switch to
1258
+ * @param confirmChange - If true, prompts the user before losing the current value when conversion fails
1259
+ * @returns `true` if the switch was successful, `false` if the user cancelled
1260
+ * @throws Error if the branch key is not found in the branches array
1261
+ */
1262
+ switchToBranch(e, n = !1) {
1263
+ const l = this.branches.find((c) => c.key === e);
1264
+ if (!l)
1265
+ throw new Error(`Unknown branch: ${e}`);
1266
+ const i = f.get(this.signal);
1267
+ if (l.detect(i))
1268
+ return !0;
1269
+ if (l.convert) {
1270
+ const c = l.convert(i);
1271
+ if (c.ok)
1272
+ return this.change(c.value), !0;
1273
+ }
1274
+ if (n && typeof window == "object" && typeof window.confirm == "function" && !window.confirm(pe.changeTypeConfirmation))
1275
+ return !1;
1276
+ const x = l.defaultValue();
1277
+ return this.change(x), !0;
1278
+ }
1279
+ /**
1280
+ * Gets the {@link UnionBranch} definition for the currently active branch.
1281
+ *
1282
+ * @returns The active branch definition, or `undefined` if no branch matches
1283
+ */
1284
+ get activeBranchDefinition() {
1285
+ const e = f.get(this.activeBranch);
1286
+ return this.branches.find((n) => n.key === e);
1287
+ }
1288
+ }
1289
+ function dt(t) {
1290
+ return t.transform(
1291
+ (e) => e ?? null,
1292
+ (e) => e ?? void 0
1293
+ );
1294
+ }
1295
+ function mt(t) {
1296
+ return t.transform(
1297
+ (e) => e ?? "",
1298
+ (e) => e === "" ? void 0 : e
1299
+ );
1300
+ }
1301
+ function ht(t) {
1302
+ return t.transform(
1303
+ (e) => e ?? void 0,
1304
+ (e) => e ?? null
1305
+ );
1306
+ }
1307
+ function X(t) {
1308
+ return t !== null && typeof t == "object" && !Array.isArray(t) && Object.prototype.toString.call(t) === "[object Object]";
1309
+ }
1310
+ function qe(t, e) {
1311
+ if (e == null)
1312
+ return Me(t);
1313
+ if (t == null)
1314
+ return e;
1315
+ if (X(t) && X(e)) {
1316
+ const n = { ...e };
1317
+ for (const l of Object.keys(t))
1318
+ n[l] === void 0 ? n[l] = Me(t[l]) : X(t[l]) && X(n[l]) && (n[l] = qe(t[l], n[l]));
1319
+ return n;
1320
+ }
1321
+ return e;
1322
+ }
1323
+ function Me(t) {
1324
+ return typeof structuredClone == "function" ? structuredClone(t) : JSON.parse(JSON.stringify(t));
1325
+ }
1326
+ export {
1327
+ Je as B,
1328
+ rt as F,
1329
+ ft as L,
1330
+ ze as M,
1331
+ at as N,
1332
+ ct as U,
1333
+ Ee as W,
1334
+ ut as a,
1335
+ mt as b,
1336
+ ot as c,
1337
+ Ye as d,
1338
+ pt as e,
1339
+ qe as f,
1340
+ je as g,
1341
+ Ge as h,
1342
+ ce as i,
1343
+ de as j,
1344
+ ht as k,
1345
+ dt as t
1346
+ };