@tempots/beatui 0.77.0 → 0.78.2

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 (96) hide show
  1. package/dist/{ar-CefikVG3.cjs → ar-DNoFBb9J.cjs} +1 -1
  2. package/dist/{ar-BbgpGwJp.js → ar-D__6gR_P.js} +1 -1
  3. package/dist/auth/index.cjs.js +1 -1
  4. package/dist/auth/index.es.js +5 -5
  5. package/dist/{colors-B9fcMxa_.cjs → colors-B2yrgHSW.cjs} +1 -1
  6. package/dist/{colors-pQZlNrwM.js → colors-DPo9GEJR.js} +6 -6
  7. package/dist/{de-ZRnkggf5.cjs → de-AwUkK0rS.cjs} +1 -1
  8. package/dist/{de-R7lPfyZ4.js → de-DmKpCTuQ.js} +1 -1
  9. package/dist/{deep-merge-E6b9KE6l.js → deep-merge-Bsqkvp9-.js} +5 -5
  10. package/dist/{deep-merge-DBUbjJYt.cjs → deep-merge-cQgRrtGF.cjs} +1 -1
  11. package/dist/{duration-input-j7bVks-S.js → duration-input-DcZf0Dyd.js} +3 -3
  12. package/dist/{duration-input-CsygvJJ_.cjs → duration-input-Dt6riwzu.cjs} +1 -1
  13. package/dist/{es-DV0Jr_BZ.js → es-BDZ5UJLS.js} +1 -1
  14. package/dist/{es-IkNtVSp2.cjs → es-D-d2AIlX.cjs} +1 -1
  15. package/dist/{fa-DXvHejs9.js → fa-CuPgy1cj.js} +1 -1
  16. package/dist/{fa-B-byOhgU.cjs → fa-D7rRdG8c.cjs} +1 -1
  17. package/dist/{fr-F0ZegdR2.cjs → fr-0er_BWMt.cjs} +1 -1
  18. package/dist/{fr-D8FOMX0o.js → fr-DmyMO3lB.js} +1 -1
  19. package/dist/{he-B19Qsx-u.js → he-C3RHfs6R.js} +1 -1
  20. package/dist/{he-BcEFNuYz.cjs → he-R2veUyP3.cjs} +1 -1
  21. package/dist/{hi-CarXvOJD.cjs → hi-C9UP7NGG.cjs} +1 -1
  22. package/dist/{hi-DozFnE3b.js → hi-YnvrXBht.js} +1 -1
  23. package/dist/hls.light.min-Bhrf47iR.cjs +27 -0
  24. package/dist/{hls.light.min-BHW1Af0w.js → hls.light.min-C6VwviEa.js} +1095 -1087
  25. package/dist/{index-B7lXSIXm.cjs → index-BGwNJNop.cjs} +19 -19
  26. package/dist/{index-DKl26ILa.js → index-CCMjK4fD.js} +1 -1
  27. package/dist/{index-gSTSk9KZ.cjs → index-CdVc1Y2V.cjs} +1 -1
  28. package/dist/{index-CyyNsVT9.cjs → index-DE2tjivA.cjs} +1 -1
  29. package/dist/{index-DdpYvBeh.js → index-Dbu1ZPpw.js} +1095 -1044
  30. package/dist/{index-wPyoqxuj.js → index-DiEcd7ZV.js} +2 -6
  31. package/dist/{index-CpZh_Snx.js → index-DklKfzD4.js} +1 -1
  32. package/dist/{index-CYb1YxDX.js → index-mPVib4v9.js} +1 -1
  33. package/dist/index.cjs.js +2 -2
  34. package/dist/index.es.js +21 -21
  35. package/dist/index.esm-C6lZ02yY.cjs +1 -0
  36. package/dist/{index.esm-DPNh6inz.js → index.esm-ChUrm4xR.js} +80 -80
  37. package/dist/{it-But8uzNi.js → it-CWLwlDXe.js} +1 -1
  38. package/dist/{it-ops3Czzi.cjs → it-Cxt1_D4h.cjs} +1 -1
  39. package/dist/{ja-2dzONSkh.cjs → ja-CpDovHPb.cjs} +1 -1
  40. package/dist/{ja-DkwTnFdU.js → ja-DthjgDtM.js} +1 -1
  41. package/dist/json-schema/index.cjs.js +8 -8
  42. package/dist/json-schema/index.es.js +3970 -3923
  43. package/dist/json-structure/index.cjs.js +1 -1
  44. package/dist/json-structure/index.es.js +5 -5
  45. package/dist/{ko-uVJEhtyQ.cjs → ko-M_MCTNuN.cjs} +1 -1
  46. package/dist/{ko-Cqv-IjhX.js → ko-joDK7ONT.js} +1 -1
  47. package/dist/markdown/index.es.js +1 -1
  48. package/dist/{modal-rLbLQYhb.cjs → modal-D3NQ6ZgO.cjs} +1 -1
  49. package/dist/{modal--5-j6x0s.js → modal-oWbT46Rc.js} +28 -28
  50. package/dist/monaco/index.cjs.js +2 -2
  51. package/dist/monaco/index.es.js +11 -11
  52. package/dist/{nl-DXnbYulJ.cjs → nl-DGhIOGxN.cjs} +1 -1
  53. package/dist/{nl-YSiU3rFI.js → nl-DmoWeXUt.js} +1 -1
  54. package/dist/{notice-BvS1_9Va.js → notice-C0Brmeyi.js} +2 -2
  55. package/dist/{notice-BGaJ4k0O.cjs → notice-DYBLXglS.cjs} +1 -1
  56. package/dist/{pl-DXmHc2Nh.js → pl-8hl5VXnm.js} +1 -1
  57. package/dist/{pl-RbiIBA3C.cjs → pl-DocnXix_.cjs} +1 -1
  58. package/dist/prosemirror/index.cjs.js +1 -1
  59. package/dist/prosemirror/index.es.js +1 -1
  60. package/dist/{pt-Bf3z_-26.js → pt-BfYK9Rl3.js} +1 -1
  61. package/dist/{pt-BAecyAv-.cjs → pt-DO2Zcuqv.cjs} +1 -1
  62. package/dist/{ru-DZ4gJ6yr.cjs → ru-D9KCOBqN.cjs} +1 -1
  63. package/dist/{ru-Sy00qUeG.js → ru-eA_dNkJz.js} +1 -1
  64. package/dist/tailwind/index.cjs.js +1 -1
  65. package/dist/tailwind/index.es.js +1 -1
  66. package/dist/tailwind/preset.cjs.js +1 -1
  67. package/dist/tailwind/preset.es.js +2 -2
  68. package/dist/tailwind/vite-plugin.cjs.js +1 -1
  69. package/dist/tailwind/vite-plugin.es.js +1 -1
  70. package/dist/timer-BJHOsuS6.cjs +1 -0
  71. package/dist/timer-Rd2sKnvH.js +65 -0
  72. package/dist/{toolbar-C_Ec0_XC.js → toolbar-CdY5huSG.js} +1 -1
  73. package/dist/{toolbar-wEm8iNet.cjs → toolbar-DoRPrs-s.cjs} +1 -1
  74. package/dist/{tr-7jGF_acJ.cjs → tr-BBmQvRSa.cjs} +1 -1
  75. package/dist/{tr-BDxG3qd6.js → tr-CdqbnopM.js} +1 -1
  76. package/dist/{translations-DQxouiBG.js → translations-BEMKy6-W.js} +19 -19
  77. package/dist/{translations-BmsRhth7.js → translations-CVfr2JXG.js} +1 -1
  78. package/dist/{translations-C7HVMcOQ.cjs → translations-D_Vu2mbd.cjs} +1 -1
  79. package/dist/{translations-hMQlZmD4.cjs → translations-eUtMHN9s.cjs} +1 -1
  80. package/dist/{ur-55zdT2TQ.js → ur-D9sr_I1M.js} +1 -1
  81. package/dist/{ur-ZT6fZFId.cjs → ur-u5qjZsKM.cjs} +1 -1
  82. package/dist/use-form-DMiCxK26.js +1731 -0
  83. package/dist/use-form-pSErMD6z.cjs +2 -0
  84. package/dist/{vi-C7K7W0hM.js → vi-0f97dtZb.js} +1 -1
  85. package/dist/{vi-tNs62pgs.cjs → vi-_w5RE8el.cjs} +1 -1
  86. package/dist/{widget-customization-DKlfR6Qb.cjs → widget-customization-WNWmH_gX.cjs} +1 -1
  87. package/dist/{widget-customization-DfBf7gGp.js → widget-customization-nxbAoCx5.js} +4 -4
  88. package/dist/{zh-CBnP8_Lf.cjs → zh-6cQcHbf6.cjs} +1 -1
  89. package/dist/{zh-DvJBV9D8.js → zh-C7HcUKhE.js} +1 -1
  90. package/package.json +7 -4
  91. package/dist/hls.light.min-D3hUMpII.cjs +0 -27
  92. package/dist/index.esm-DJRz9AE-.cjs +0 -1
  93. package/dist/timer-DK_yKNwE.cjs +0 -1
  94. package/dist/timer-DzWb416P.js +0 -51
  95. package/dist/use-form-B4D58mxd.cjs +0 -2
  96. package/dist/use-form-DzA1RSrN.js +0 -1325
@@ -1,1325 +0,0 @@
1
- import { Use as X, coalesce as Y, aria as F, attr as o, html as b, on as I, Value as E, Empty as T, computedOf as w, When as x, dataAttr as B, TextNode as Z, prop as S, Fragment as q, emitValue as ee, emitValueAsNumber as se } from "@tempots/dom";
2
- import { a as te, B as ne, c as R, b as re } from "./translations-DQxouiBG.js";
3
- const H = /* @__PURE__ */ new Map();
4
- function N(e) {
5
- const s = H.get(e) ?? 0;
6
- return H.set(e, s + 1), `${e}-${s}`;
7
- }
8
- const m = {
9
- /**
10
- * Creates a loading state.
11
- * @param previousValue - The previous value.
12
- * @returns A loading state.
13
- * @public
14
- */
15
- notAsked: { type: "NotAsked" },
16
- /**
17
- * Creates a loading state.
18
- * @param previousValue - The previous value.
19
- * @returns A loading state.
20
- * @public
21
- */
22
- loading(e = void 0) {
23
- return { type: "Loading", previousValue: e };
24
- },
25
- /**
26
- * Creates a successful state.
27
- * @param value - The value.
28
- * @returns A successful state.
29
- * @public
30
- */
31
- success(e) {
32
- return { type: "AsyncSuccess", value: e };
33
- },
34
- /**
35
- * Creates a failure state.
36
- * @param error - The error.
37
- * @returns A failure state.
38
- * @public
39
- */
40
- failure(e) {
41
- return { type: "AsyncFailure", error: e };
42
- },
43
- /**
44
- * Checks if the result is a success.
45
- * @param r - The result.
46
- * @returns `true` if the result is a success; otherwise, `false`.
47
- * @public
48
- */
49
- isSuccess(e) {
50
- return e.type === "AsyncSuccess";
51
- },
52
- /**
53
- * Checks if the result is a failure.
54
- * @param r - The result.
55
- * @returns `true` if the result is a failure; otherwise, `false`.
56
- * @public
57
- */
58
- isFailure(e) {
59
- return e.type === "AsyncFailure";
60
- },
61
- /**
62
- * Checks if the result is a not-asked.
63
- * @param r - The result.
64
- * @returns `true` if the result is not-asked; otherwise, `false`.
65
- * @public
66
- */
67
- isNotAsked(e) {
68
- return e.type === "NotAsked";
69
- },
70
- /**
71
- * Checks if the result is a loading.
72
- * @param r - The result.
73
- * @returns `true` if the result is loading; otherwise, `false`.
74
- * @public
75
- */
76
- isLoading(e) {
77
- return e.type === "Loading";
78
- },
79
- /**
80
- * Gets the value if the result is a success; otherwise, returns the alternative value.
81
- * @param r - The result.
82
- * @param alt - The alternative value.
83
- * @returns The value if the result is a success; otherwise, the alternative value.
84
- * @public
85
- */
86
- getOrElse(e, s) {
87
- return m.isSuccess(e) ? e.value : s;
88
- },
89
- /**
90
- * Gets the value if the result is a success; otherwise, returns the value from the alternative function.
91
- * @param r - The result.
92
- * @param altf - The alternative function.
93
- * @returns The value if the result is a success; otherwise, the value from the alternative
94
- * @public
95
- * function.
96
- */
97
- getOrElseLazy(e, s) {
98
- return m.isSuccess(e) ? e.value : s();
99
- },
100
- /**
101
- * Gets the value if the result is a success; otherwise, returns `null`.
102
- * @param r - The result.
103
- * @returns The value if the result is a success; otherwise, `null`.
104
- * @public
105
- */
106
- getOrNull(e) {
107
- return m.isSuccess(e) ? e.value : null;
108
- },
109
- /**
110
- * Gets the value if the result is a success; otherwise, returns `undefined`.
111
- * @param r - The result.
112
- * @returns The value if the result is a success; otherwise, `undefined`.
113
- * @public
114
- */
115
- getOrUndefined(e) {
116
- return m.isSuccess(e) ? e.value : void 0;
117
- },
118
- /**
119
- * Gets the value of a `AsyncResult` if it is a `Success`, otherwise it throws the error contained in the `Failure`.
120
- * @param r - The `AsyncResult` to get the value from.
121
- * @returns The value of the `AsyncResult` if it is a `Success`.
122
- */
123
- getUnsafe: (e) => {
124
- if (m.isSuccess(e))
125
- return e.value;
126
- throw m.isFailure(e) ? e.error : new Error("Cannot get value from a not-asked or loading result");
127
- },
128
- /**
129
- * Based on the state of the result, it picks the appropriate function to call and returns the result.
130
- * @param success - The function to call if the result is a success.
131
- * @param failure - The function to call if the result is a failure.
132
- * @param loading - The function to call if the result is loading.
133
- * @param notAsked - The function to call if the result is not-asked.
134
- * @returns The result of calling the appropriate function based on the state of the result.
135
- * @public
136
- */
137
- match: (e, {
138
- success: s,
139
- failure: t,
140
- loading: n,
141
- notAsked: r = n
142
- }) => m.isSuccess(e) ? s(e.value) : m.isFailure(e) ? t(e.error) : m.isNotAsked(e) ? r() : n(e.previousValue),
143
- /**
144
- * When the result is a success, it applies the function to the value.
145
- *
146
- * @param r - The result.
147
- * @param apply - The function to apply.
148
- * @returns The result that was passed in.
149
- * @public
150
- */
151
- whenSuccess: (e, s) => (m.isSuccess(e) && s(e.value), e),
152
- /**
153
- * When the result is a failure, it applies the function to the error.
154
- *
155
- * @param r - The result.
156
- * @param apply - The function to apply.
157
- * @returns The result that was passed in.
158
- * @public
159
- */
160
- whenFailure: (e, s) => (m.isFailure(e) && s(e.error), e),
161
- /**
162
- * Compares two results for equality.
163
- * @param r1 - The first result.
164
- * @param r2 - The second result.
165
- * @param options - The options to use for comparison. By default, uses strict equality.
166
- * @returns `true` if the results are equal, `false` otherwise.
167
- */
168
- equals: (e, s, t = {
169
- valueEquals: (n, r) => n === r,
170
- errorEquals: (n, r) => n === r
171
- }) => e.type === "AsyncSuccess" && s.type === "AsyncSuccess" ? t.valueEquals(e.value, s.value) : e.type === "AsyncFailure" && s.type === "AsyncFailure" ? t.errorEquals(e.error, s.error) : e.type === "Loading" && s.type === "Loading" ? t.valueEquals(e.previousValue, s.previousValue) : e.type === "NotAsked" && s.type === "NotAsked",
172
- /**
173
- * Combines multiple results into a single result.
174
- * @param results - The results to combine.
175
- * @returns A single result that is a success if all the input results are successes, otherwise a failure.
176
- */
177
- all: (e) => {
178
- const s = [];
179
- for (const t of e)
180
- if (m.isSuccess(t))
181
- s.push(t.value);
182
- else
183
- return t;
184
- return m.success(s);
185
- },
186
- /**
187
- * Converts a Promise to an AsyncResult.
188
- * @param p - The Promise to convert.
189
- * @returns A Promise that resolves to an AsyncResult.
190
- */
191
- ofPromise: async (e) => {
192
- try {
193
- const s = await e;
194
- return m.success(s);
195
- } catch (s) {
196
- return m.failure(s instanceof Error ? s : new Error(String(s)));
197
- }
198
- }
199
- }, V = (e, s) => e === s || e !== e && s !== s, f = {
200
- /**
201
- * Creates a valid `Validation`.
202
- * @returns A `Validation` that is `Valid`.
203
- */
204
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
205
- valid: { type: "valid" },
206
- /**
207
- * Creates an invalid `Validation`.
208
- * @param error - The error associated with the invalid value.
209
- * @returns A `Validation` that is `Invalid`.
210
- */
211
- invalid(e) {
212
- return { type: "invalid", error: e };
213
- },
214
- /**
215
- * Checks if a `Validation` is `Valid`.
216
- * @param r - The `Validation` to check.
217
- * @returns `true` if the `Validation` is `Valid`, otherwise `false`.
218
- */
219
- isValid(e) {
220
- return e.type === "valid";
221
- },
222
- /**
223
- * Checks if a `Validation` is `Invalid`.
224
- * @param r - The `Validation` to check.
225
- * @returns `true` if the `Validation` is `Invalid`, otherwise `false`.
226
- */
227
- isInvalid(e) {
228
- return e.type === "invalid";
229
- },
230
- /**
231
- * Maps the value of a `Validation` to a new value.
232
- * @param r - The `Validation` to map.
233
- * @param valid - The mapping function for a valid value.
234
- * @param invalid - The mapping function for an invalid value.
235
- * @returns The mapped value.
236
- */
237
- match: (e, s, t) => f.isValid(e) ? s() : t(e.error),
238
- /**
239
- * Maps the value of a `Validation` to a new `Validation`.
240
- * @param validation - The `Validation` to map.
241
- * @param value - The value to map.
242
- * @returns A new `Validation` with the mapped value.
243
- */
244
- toResult: (e, s) => f.match(
245
- e,
246
- () => d.success(s),
247
- (t) => d.failure(t)
248
- ),
249
- /**
250
- * Execute a function when the `Validation` is valid.
251
- *
252
- * @param r - The `Validation` to check.
253
- * @param apply - The function to execute when the `Validation` is valid.
254
- * @returns The `Validation` object.
255
- */
256
- whenValid: (e, s) => (f.isValid(e) && s(), e),
257
- /**
258
- * Execute a function when the `Validation` is invalid.
259
- *
260
- * @param r - The `Validation` to check.
261
- * @param apply - The function to execute when the `Validation` is invalid.
262
- * @returns The `Validation` object.
263
- */
264
- whenInvalid: (e, s) => (f.isInvalid(e) && s(e.error), e)
265
- }, d = {
266
- /**
267
- * Creates a successful `Result`.
268
- * @param value - The value to wrap in a `Success` type.
269
- * @returns A `Result` that is a `Success`.
270
- * @public
271
- */
272
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
273
- success(e) {
274
- return { type: "Success", value: e };
275
- },
276
- /**
277
- * Creates a failure `Result`.
278
- * @param error - The error to wrap in a `Failure` type.
279
- * @returns A `Result` that is a `Failure`.
280
- * @public
281
- */
282
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
283
- failure(e) {
284
- return { type: "Failure", error: e };
285
- },
286
- /**
287
- * Maps the value of a `Result` to a new value.
288
- * @param r - The `Result` to map.
289
- * @param f - The mapping function.
290
- * @returns A new `Result` with the mapped value.
291
- * @public
292
- */
293
- map: (e, s) => e.type === "Success" ? d.success(s(e.value)) : e,
294
- /**
295
- * Maps the value of a `Result` to a new `Result`.
296
- * @param r - The `Result` to map.
297
- * @param f - The mapping function.
298
- * @returns A new `Result` with the mapped value.
299
- * @public
300
- */
301
- flatMap: (e, s) => e.type === "Success" ? s(e.value) : e,
302
- /**
303
- * Converts a `Result` to an `AsyncResult`.
304
- * @param r - The `Result` to convert.
305
- * @returns An `AsyncResult` that is equivalent to the input `Result`.
306
- * @public
307
- */
308
- toAsync(e) {
309
- return d.match(
310
- e,
311
- (s) => m.success(s),
312
- (s) => m.failure(s)
313
- );
314
- },
315
- /**
316
- * Converts a `Result` to a `Validation`.
317
- * @param r - The `Result` to convert.
318
- * @returns A `Validation` that is equivalent to the input `Result`.
319
- * @public
320
- */
321
- toValidation(e) {
322
- return d.match(
323
- e,
324
- () => f.valid,
325
- (s) => f.invalid(s)
326
- );
327
- },
328
- /**
329
- * Checks if a `Result` is a success.
330
- * @param r - The `Result` to check.
331
- * @returns `true` if the `Result` is a `Success`, `false` otherwise.
332
- * @public
333
- */
334
- isSuccess(e) {
335
- return e.type === "Success";
336
- },
337
- /**
338
- * Checks if a `Result` is a failure.
339
- * @param r - The `Result` to check.
340
- * @returns `true` if the `Result` is a `Failure`, `false` otherwise.
341
- * @public
342
- */
343
- isFailure(e) {
344
- return e.type === "Failure";
345
- },
346
- /**
347
- * Gets the value of a `Result` if it is a `Success`, otherwise returns the provided default value.
348
- * @param r - The `Result` to get the value from.
349
- * @param alt - The default value to return if the `Result` is a `Failure`.
350
- * @returns The value of the `Result` if it is a `Success`, otherwise the default value.
351
- * @public
352
- */
353
- getOrElse(e, s) {
354
- return d.isSuccess(e) ? e.value : s;
355
- },
356
- /**
357
- * Gets the value of a `Result` if it is a `Success`, otherwise returns the result of the provided function.
358
- * @param r - The `Result` to get the value from.
359
- * @param altf - The function to call if the `Result` is a `Failure`.
360
- * @returns The value of the `Result` if it is a `Success`, otherwise the result of the function.
361
- * @public
362
- */
363
- getOrElseLazy(e, s) {
364
- return d.isSuccess(e) ? e.value : s();
365
- },
366
- /**
367
- * Gets the value of a `Result` if it is a `Success`, otherwise returns `null`.
368
- * @param r - The `Result` to get the value from.
369
- * @returns The value of the `Result` if it is a `Success`, otherwise `null`.
370
- * @public
371
- */
372
- getOrNull(e) {
373
- return d.isSuccess(e) ? e.value : null;
374
- },
375
- /**
376
- * Gets the value of a `Result` if it is a `Success`, otherwise returns `undefined`.
377
- * @param r - The `Result` to get the value from.
378
- * @returns The value of the `Result` if it is a `Success`, otherwise `undefined`.
379
- * @public
380
- */
381
- getOrUndefined(e) {
382
- return d.isSuccess(e) ? e.value : void 0;
383
- },
384
- /**
385
- * Gets the value of a `Result` if it is a `Success`, otherwise it throws the error contained in the `Failure`.
386
- * @param r - The `Result` to get the value from.
387
- * @returns The value of the `Result` if it is a `Success`.
388
- */
389
- getUnsafe: (e) => {
390
- if (d.isSuccess(e))
391
- return e.value;
392
- throw e.error;
393
- },
394
- /**
395
- * Based on the state of the result, it picks the appropriate function to call and returns the result.
396
- * @param success - The function to call if the result is a success.
397
- * @param failure - The function to call if the result is a failure.
398
- * @returns The result of calling the appropriate function based on the state of the result.
399
- * @public
400
- */
401
- match: (e, s, t) => d.isSuccess(e) ? s(e.value) : t(e.error),
402
- /**
403
- * Calls the provided function if the result is a success.
404
- * @param apply - The function to call if the result is a success.
405
- * @returns A function that takes a `Result` and calls the provided function if the result is a success.
406
- * @public
407
- */
408
- whenSuccess: (e, s) => (d.isSuccess(e) && s(e.value), e),
409
- whenFailure: (e, s) => (d.isFailure(e) && s(e.error), e),
410
- /**
411
- * Combines two results into a single result.
412
- * @param r1 - The first result.
413
- * @param r2 - The second result.
414
- * @param combineV - The function to combine two values.
415
- * @param combineE - The function to combine two errors.
416
- * @returns The combined result.
417
- * @public
418
- */
419
- combine: (e, s, t, n) => d.match(
420
- e,
421
- (r) => d.match(
422
- s,
423
- (i) => d.success(t(r, i)),
424
- (i) => d.failure(i)
425
- ),
426
- (r) => d.match(
427
- s,
428
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
429
- (i) => d.failure(r),
430
- (i) => d.failure(n(r, i))
431
- )
432
- ),
433
- /**
434
- * Compares two results for equality.
435
- * @param r1 - The first result.
436
- * @param r2 - The second result.
437
- * @param options - The options to use for comparison. By default, uses strict equality.
438
- * @returns `true` if the results are equal, `false` otherwise.
439
- */
440
- equals: (e, s, t = {
441
- valueEquals: (n, r) => n === r,
442
- errorEquals: (n, r) => n === r
443
- }) => e.type === "Success" && s.type === "Success" ? t.valueEquals(e.value, s.value) : e.type === "Failure" && s.type === "Failure" ? t.errorEquals(e.error, s.error) : !1,
444
- /**
445
- * Combines multiple results into a single result.
446
- * @param results - The results to combine.
447
- * @returns A single result that is a success if all the input results are successes, otherwise a failure.
448
- */
449
- all: (e) => {
450
- const s = [];
451
- for (const t of e)
452
- if (d.isSuccess(t))
453
- s.push(t.value);
454
- else
455
- return t;
456
- return d.success(s);
457
- }
458
- };
459
- function Se({
460
- size: e = "sm",
461
- icon: s = "line-md:close",
462
- disabled: t,
463
- roundedness: n = "full",
464
- color: r = "base",
465
- onClick: i,
466
- label: l
467
- }, ...a) {
468
- return X(te, (c) => {
469
- const p = Y(l, c.$.closeModal);
470
- return ne(
471
- {
472
- variant: "text",
473
- size: e,
474
- roundedness: n,
475
- disabled: t,
476
- color: r,
477
- onClick: i
478
- },
479
- o.title(p),
480
- F.label(p),
481
- ...a,
482
- R({ icon: s, size: e ?? "sm" })
483
- );
484
- });
485
- }
486
- function $(e) {
487
- return `bc-label bc-label--${e}`;
488
- }
489
- const De = (...e) => b.span(o.class($("emphasis")), ...e), ie = (...e) => b.span(o.class($("default")), ...e), ae = (...e) => b.span(o.class($("muted")), ...e), Ce = (...e) => b.span(o.class($("danger")), ...e), Ee = (e) => {
490
- const {
491
- value: s,
492
- onBlur: t,
493
- onChange: n,
494
- placeholder: r,
495
- disabled: i,
496
- id: l,
497
- checkedIcon: a,
498
- uncheckedIcon: c,
499
- iconSize: p = "lg"
500
- } = e, u = l ?? N("checkbox"), v = `${u}-label`, k = () => {
501
- if (E.get(i ?? !1)) return;
502
- const h = E.get(s);
503
- n?.(!h);
504
- }, D = (h) => {
505
- E.get(i ?? !1) || (h.key === " " || h.key === "Enter") && (h.preventDefault(), k());
506
- };
507
- return re(
508
- {
509
- baseContainer: !0,
510
- growInput: !1,
511
- ...e,
512
- input: b.span(
513
- o.class("bc-checkbox-input"),
514
- b.span(
515
- o.class("bc-checkbox-input__checkbox"),
516
- o.class(
517
- E.map(
518
- s,
519
- (h) => h ? "bc-checkbox-input__checkbox--checked" : "bc-checkbox-input__checkbox--unchecked"
520
- )
521
- ),
522
- o.class(
523
- E.map(
524
- i ?? !1,
525
- (h) => h ? "bc-checkbox-input__checkbox--disabled" : ""
526
- )
527
- ),
528
- o.id(u),
529
- o.role("checkbox"),
530
- o.tabindex(
531
- E.map(
532
- i ?? !1,
533
- (h) => h ? -1 : 0
534
- )
535
- ),
536
- F.checked(s),
537
- F.disabled(i),
538
- r != null ? F.labelledby(v) : T,
539
- I.keydown(D),
540
- t != null ? I.blur(t) : T,
541
- R({
542
- icon: w(
543
- s,
544
- a,
545
- c
546
- )(
547
- (h, g, C) => h ? g ?? "akar-icons/check-box-fill" : C ?? "akar-icons/box"
548
- ),
549
- accessibility: "decorative",
550
- size: p
551
- })
552
- ),
553
- r != null ? b.label(
554
- o.class("bc-checkbox-input__label"),
555
- o.id(v),
556
- o.for(u),
557
- ae(r)
558
- ) : T
559
- )
560
- },
561
- I.click(k)
562
- );
563
- }, le = b.span(
564
- o.class("bc-input-wrapper__required"),
565
- " *"
566
- );
567
- function ce(e) {
568
- const s = ["bc-input-wrapper"];
569
- return e !== "vertical" && s.push(`bc-input-wrapper--${e}`), s.join(" ");
570
- }
571
- function oe(e, s) {
572
- const t = ["bc-input-wrapper__label-text"];
573
- return e ? t.push("bc-input-wrapper__label-text--error") : s ? t.push("bc-input-wrapper__label-text--disabled") : t.push("bc-input-wrapper__label-text--default"), t.join(" ");
574
- }
575
- function ue(e, s) {
576
- if (e === "horizontal-fixed" && s != null)
577
- return `--input-wrapper-label-width: ${s}`;
578
- }
579
- const W = ({
580
- fullWidth: e = !1,
581
- required: s,
582
- label: t,
583
- labelChildren: n,
584
- context: r,
585
- description: i,
586
- content: l,
587
- error: a,
588
- labelFor: c,
589
- hasError: p,
590
- disabled: u,
591
- layout: v,
592
- labelWidth: k
593
- }, ...D) => {
594
- const h = p ?? a != null, g = u ?? !1, C = v ?? "vertical", M = N("input-wrapper"), O = i ? `${M}-description` : void 0, j = a != null ? `${M}-error` : void 0, P = w(C)((y) => y !== "vertical"), Q = w(
595
- C,
596
- k ?? void 0
597
- )((y, A) => ue(y, A));
598
- return b.div(
599
- o.class(E.map(C, (y) => ce(y))),
600
- o.class(
601
- E.map(
602
- e,
603
- (y) => y ? "bc-input-wrapper--full-width" : ""
604
- )
605
- ),
606
- o.style(Q),
607
- t != null || r != null ? b.div(
608
- o.class("bc-input-wrapper__header"),
609
- b.div(
610
- o.class("bc-input-wrapper__label-section"),
611
- b.label(
612
- o.class("bc-input-wrapper__label"),
613
- c != null ? o.for(c) : T,
614
- b.span(
615
- o.class(
616
- w(
617
- h,
618
- g
619
- )(
620
- (y, A) => oe(
621
- y ?? !1,
622
- A ?? !1
623
- )
624
- )
625
- ),
626
- t
627
- ),
628
- t != null && s ? le : T
629
- ),
630
- // Show description under label when horizontal
631
- x(
632
- w(
633
- P,
634
- i
635
- )((y, A) => y && A != null),
636
- () => b.div(
637
- o.class(
638
- "bc-input-wrapper__description bc-input-wrapper__description--under-label"
639
- ),
640
- o.id(O),
641
- i
642
- )
643
- )
644
- ),
645
- r != null ? ie(r) : T,
646
- n
647
- ) : T,
648
- b.div(
649
- o.class("bc-input-wrapper__content"),
650
- // Add data attributes to help inputs inherit accessibility information
651
- [O, j].filter(Boolean).length > 0 ? B.describedby(
652
- [O, j].filter(Boolean).join(" ")
653
- ) : T,
654
- s ? B.required("true") : T,
655
- x(h, () => B.invalid("true")),
656
- l
657
- ),
658
- // Show description at bottom only when not horizontal
659
- x(
660
- w(P, i)((y, A) => !y && A != null),
661
- () => b.div(
662
- o.class("bc-input-wrapper__description"),
663
- o.id(O),
664
- i
665
- )
666
- ),
667
- x(
668
- h,
669
- () => b.div(
670
- o.class("bc-input-wrapper__error"),
671
- o.id(j),
672
- F.live("polite"),
673
- // Announce errors to screen readers
674
- o.role("alert"),
675
- // Mark as alert for immediate attention
676
- a
677
- )
678
- ),
679
- ...D
680
- );
681
- };
682
- function Te(...e) {
683
- return b.div(o.class("bc-stack"), ...e);
684
- }
685
- const he = (
686
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
687
- (e, s) => () => {
688
- e.markTouched(), s?.();
689
- }
690
- ), z = (e, s) => (t) => {
691
- e.change(t), s?.(t);
692
- };
693
- function K(e, s) {
694
- const { controller: t, onBlur: n, onChange: r, id: i, triggerOn: l, ...a } = s;
695
- return e({
696
- id: i ?? t.name,
697
- disabled: t.disabled,
698
- value: t.signal,
699
- hasError: t.errorVisible,
700
- name: t.name,
701
- ...a,
702
- onInput: l === "input" ? z(t, r) : void 0,
703
- onChange: l !== "input" ? z(t, r) : void 0,
704
- onBlur: he(t, n)
705
- });
706
- }
707
- function _e(e, { id: s, labelFor: t, ...n }, ...r) {
708
- const i = s ?? n.controller.name ?? N("control"), l = t ?? i;
709
- return W(
710
- {
711
- ...n,
712
- hasError: n.controller.errorVisible,
713
- error: Z(n.controller.error.map((a) => a ?? "")),
714
- labelFor: l,
715
- content: K(
716
- (a) => e({ ...a, id: i }),
717
- n
718
- )
719
- },
720
- ...r
721
- );
722
- }
723
- function de(e, s) {
724
- const { toInput: t, fromInput: n, controller: r, ...i } = s, l = r.transform(t, n);
725
- return K(e, {
726
- ...i,
727
- controller: l
728
- });
729
- }
730
- function Ae(e, {
731
- id: s,
732
- labelFor: t,
733
- ...n
734
- }, ...r) {
735
- const i = s ?? n.controller.name ?? N("control");
736
- return W(
737
- {
738
- ...n,
739
- labelFor: t ?? i,
740
- content: de(e, {
741
- ...n,
742
- id: i
743
- })
744
- },
745
- ...r
746
- );
747
- }
748
- function Ie(e) {
749
- return e.split(".").map((t) => {
750
- const n = t.match(/^\[(\d+)\]$/);
751
- return n ? Number(n[1]) : t;
752
- });
753
- }
754
- function pe(e) {
755
- return typeof e == "number" ? `[${e}]` : `.${e}`;
756
- }
757
- function fe(e) {
758
- if (e.length === 0) return "";
759
- const [s, ...t] = e;
760
- return [
761
- typeof s == "number" ? `[${s}]` : s,
762
- ...t.map(pe)
763
- ].join("");
764
- }
765
- const Ve = {
766
- /** A valid validation result */
767
- valid: f.valid,
768
- /**
769
- * Create an invalid validation with a message
770
- */
771
- invalid(e) {
772
- return f.invalid({ message: e });
773
- },
774
- /**
775
- * Create an invalid validation with field-specific errors.
776
- * Values can be error messages (strings) or full ControllerError objects.
777
- */
778
- invalidFields(e) {
779
- const s = {};
780
- for (const [t, n] of Object.entries(e))
781
- s[t] = typeof n == "string" ? { message: n } : n;
782
- return f.invalid({ dependencies: s });
783
- },
784
- /**
785
- * Create an invalid validation from a ControllerError object
786
- */
787
- fromError(e) {
788
- return f.invalid(e);
789
- }
790
- };
791
- function L(e) {
792
- return function(t) {
793
- if (t.type === "valid") return t;
794
- let n = t.error;
795
- for (const r of e)
796
- if (n = n?.dependencies?.[r], n == null) return f.valid;
797
- return f.invalid(n);
798
- };
799
- }
800
- class _ {
801
- path;
802
- change;
803
- signal;
804
- status;
805
- error;
806
- hasError;
807
- touched;
808
- errorVisible;
809
- dirty;
810
- dependencyErrors;
811
- #e = {
812
- disabled: S(!1),
813
- touched: S(!1)
814
- };
815
- #t;
816
- #s = S(void 0);
817
- parent;
818
- disabled;
819
- #n = [];
820
- disabledOrHasErrors;
821
- constructor(s, t, n, r, i, l = V) {
822
- this.path = s, this.change = t, this.signal = n, this.status = r, this.#t = l, this.#s.set(n.value), this.error = r.map(
823
- (a) => a?.type === "invalid" ? a.error?.message : void 0
824
- ), this.hasError = this.error.map((a) => a != null), this.touched = this.#e.touched, i.validationMode ? this.errorVisible = w(
825
- this.hasError,
826
- this.touched,
827
- i.validationMode
828
- )((a, c, p) => p === "eager" ? !!a : !!a && !!c) : this.errorVisible = w(
829
- this.hasError,
830
- this.touched
831
- )((a, c) => !!a && !!c), this.dirty = w(
832
- this.signal,
833
- this.#s
834
- )((a, c) => !this.#t(a, c)), this.dependencyErrors = r.map(
835
- (a) => a?.type === "invalid" ? a.error?.dependencies : void 0
836
- ), this.parent = i, this.disabled = w(
837
- this.#e.disabled,
838
- i.disabled
839
- )((a, c) => a || c), this.disabledOrHasErrors = w(
840
- this.disabled,
841
- this.hasError
842
- )((a, c) => a || c), this.onDispose(() => {
843
- this.#e.disabled.dispose(), this.#e.touched.dispose(), this.disabled.dispose(), this.error.dispose(), this.errorVisible.dispose(), this.dirty.dispose(), this.#s.dispose(), this.dependencyErrors.dispose(), this.disabledOrHasErrors.dispose();
844
- });
845
- }
846
- get name() {
847
- return fe(this.path);
848
- }
849
- onDispose = (s) => {
850
- this.#n.push(s);
851
- };
852
- dispose = () => {
853
- for (const s of this.#n)
854
- try {
855
- s();
856
- } catch (t) {
857
- console.error("Error in dispose callback:", t);
858
- }
859
- this.#n.length = 0;
860
- };
861
- setDisabled = (s) => {
862
- this.#e.disabled.set(s);
863
- };
864
- disable = () => this.setDisabled(!0);
865
- enable = () => this.setDisabled(!1);
866
- markTouched = () => {
867
- this.#e.touched.set(!0);
868
- };
869
- resetTouched = () => {
870
- this.#e.touched.set(!1);
871
- };
872
- markPristine = () => {
873
- this.#s.set(this.signal.value);
874
- };
875
- reset = () => {
876
- this.change(this.#s.value);
877
- };
878
- array = (s = V) => new me(
879
- this.path,
880
- this.change,
881
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
882
- this.signal,
883
- this.status,
884
- this.parent,
885
- s
886
- );
887
- object = (s = V) => new be(
888
- this.path,
889
- this.change,
890
- this.signal,
891
- this.status,
892
- this.parent,
893
- s
894
- );
895
- transform = (s, t, n = [], r = V) => new _(
896
- [...this.path, ...n],
897
- (i) => this.change(t(i)),
898
- this.signal.map(s, r),
899
- this.status.map(L(n)),
900
- this.parent,
901
- r
902
- );
903
- asyncTransform = (s, t, n, r = [], i = V) => new _(
904
- [...this.path, ...r],
905
- (l) => {
906
- t(l).then((a) => this.change(a));
907
- },
908
- this.signal.mapAsync(s, n, void 0, i),
909
- this.status.map(L(r)),
910
- this.parent,
911
- i
912
- );
913
- }
914
- class be extends _ {
915
- #e = /* @__PURE__ */ new Map();
916
- #t = /* @__PURE__ */ new Map();
917
- #s = /* @__PURE__ */ new Map();
918
- #n = S(!1);
919
- touchedDeep = this.#n;
920
- #i = /* @__PURE__ */ new Map();
921
- #r = /* @__PURE__ */ new Map();
922
- #l = S(!1);
923
- dirtyDeep = this.#l;
924
- #o;
925
- #u;
926
- #c = () => {
927
- let s = !1;
928
- for (const t of this.#t.values())
929
- if (t) {
930
- s = !0;
931
- break;
932
- }
933
- this.#n.set(this.touched.value || s);
934
- };
935
- constructor(s, t, n, r, i, l) {
936
- super(
937
- s,
938
- t,
939
- n.map((c) => c ?? {}, l),
940
- r,
941
- i,
942
- l
943
- ), this.#o = this.touched.on(() => {
944
- this.#c();
945
- }), this.#u = this.dirty.on(() => {
946
- this.#a();
947
- });
948
- const a = this.signal.on(() => this.#a());
949
- this.onDispose(() => {
950
- for (const c of this.#e.values())
951
- c.dispose();
952
- this.#e.clear();
953
- for (const c of this.#s.values()) c();
954
- this.#s.clear(), this.#t.clear(), this.#n.dispose();
955
- for (const c of this.#r.values()) c();
956
- this.#r.clear(), this.#i.clear(), this.#l.dispose(), this.#o(), this.#u(), a();
957
- });
958
- }
959
- field = (s) => {
960
- if (this.#e.has(s))
961
- return this.#e.get(s);
962
- const t = async (l) => {
963
- this.change({
964
- ...this.signal.value,
965
- [s]: l
966
- });
967
- }, n = new _(
968
- [...this.path, s],
969
- t,
970
- this.signal.map((l) => l[s]),
971
- this.status.map(L([s])),
972
- {
973
- disabled: this.disabled,
974
- // propagate validationMode to children if present
975
- validationMode: this.parent.validationMode
976
- }
977
- );
978
- this.#e.set(s, n);
979
- const r = n.touched.on((l) => {
980
- this.#t.set(s, l), this.#c();
981
- });
982
- this.#s.set(s, r);
983
- const i = n.dirty.on((l) => {
984
- this.#i.set(s, l), this.#a();
985
- });
986
- return this.#r.set(s, i), n;
987
- };
988
- markAllTouched = () => {
989
- this.markTouched();
990
- const s = this.signal.value;
991
- for (const t of Object.keys(s))
992
- this.field(t).markTouched();
993
- for (const t of this.#e.values())
994
- t.markTouched();
995
- };
996
- markAllPristine = () => {
997
- this.markPristine();
998
- const s = this.signal.value;
999
- for (const t of Object.keys(s))
1000
- this.field(t).markPristine?.();
1001
- for (const t of this.#e.values())
1002
- t.markPristine?.();
1003
- };
1004
- #a = () => {
1005
- let s = !1;
1006
- for (const t of this.#i.values())
1007
- if (t) {
1008
- s = !0;
1009
- break;
1010
- }
1011
- this.#l.set(this.dirty.value || s);
1012
- };
1013
- }
1014
- class me extends _ {
1015
- #e = new Array();
1016
- length;
1017
- #t = /* @__PURE__ */ new Map();
1018
- #s = /* @__PURE__ */ new Map();
1019
- #n = S(!1);
1020
- touchedDeep = this.#n;
1021
- #i = /* @__PURE__ */ new Map();
1022
- #r = /* @__PURE__ */ new Map();
1023
- #l = S(!1);
1024
- dirtyDeep = this.#l;
1025
- #o;
1026
- #u;
1027
- #c = () => {
1028
- let s = !1;
1029
- for (const t of this.#t.values())
1030
- if (t) {
1031
- s = !0;
1032
- break;
1033
- }
1034
- this.#n.set(this.touched.value || s);
1035
- };
1036
- constructor(s, t, n, r, i, l) {
1037
- const a = n.map((u) => u ?? [], l);
1038
- super(s, t, a, r, i, l);
1039
- const c = a.on((u) => {
1040
- const v = this.#e.length - u.length;
1041
- v > 0 && (this.#e.splice(u.length, v).forEach((k, D) => {
1042
- const h = u.length + D;
1043
- k.dispose(), this.#s.get(h)?.(), this.#s.delete(h), this.#t.delete(h), this.#r.get(h)?.(), this.#r.delete(h), this.#i.delete(h);
1044
- }), this.#c(), this.#a());
1045
- });
1046
- this.length = a.map((u) => u.length), this.#o = this.touched.on(() => {
1047
- this.#c();
1048
- }), this.#u = this.dirty.on(() => {
1049
- this.#a();
1050
- });
1051
- const p = this.signal.on(() => this.#a());
1052
- this.onDispose(() => {
1053
- for (const u of this.#e)
1054
- u.dispose();
1055
- this.length.dispose(), this.#e.length = 0, c(), a.dispose();
1056
- for (const u of this.#s.values()) u();
1057
- this.#s.clear(), this.#t.clear(), this.#n.dispose();
1058
- for (const u of this.#r.values()) u();
1059
- this.#r.clear(), this.#i.clear(), this.#l.dispose(), this.#o(), this.#u(), p();
1060
- });
1061
- }
1062
- item = (s) => {
1063
- if (this.#e[s])
1064
- return this.#e[s];
1065
- const t = async (l) => {
1066
- const a = this.signal.value.slice();
1067
- a[s] = l, this.change(a);
1068
- }, n = new _(
1069
- [...this.path, s],
1070
- t,
1071
- this.signal.map((l) => l[s]),
1072
- this.status.map(L([s])),
1073
- {
1074
- disabled: this.disabled,
1075
- validationMode: this.parent.validationMode
1076
- }
1077
- );
1078
- this.#e[s] = n;
1079
- const r = n.touched.on((l) => {
1080
- this.#t.set(s, l), this.#c();
1081
- });
1082
- this.#s.set(s, r);
1083
- const i = n.dirty.on((l) => {
1084
- this.#i.set(s, l), this.#a();
1085
- });
1086
- return this.#r.set(s, i), n;
1087
- };
1088
- push = (...s) => {
1089
- this.change([...this.signal.value, ...s]);
1090
- };
1091
- pop = () => {
1092
- this.splice(this.signal.value.length - 1, 1);
1093
- };
1094
- shift = () => {
1095
- this.splice(0, 1);
1096
- };
1097
- unshift = (...s) => {
1098
- this.change([...s, ...this.signal.value]);
1099
- };
1100
- removeAt = (s) => {
1101
- this.splice(s, 1);
1102
- };
1103
- splice = (s, t) => {
1104
- const n = this.signal.value.slice();
1105
- n.splice(s, t), this.change(n);
1106
- };
1107
- move = (s, t, n = 1) => {
1108
- if (n < 1 || s === t) return;
1109
- const r = this.signal.value.slice(), i = r.splice(s, n);
1110
- r.splice(t, 0, ...i), this.change(r);
1111
- };
1112
- markAllTouched = () => {
1113
- this.markTouched();
1114
- const s = this.signal.value.length;
1115
- for (let t = 0; t < s; t++)
1116
- this.item(t).markTouched();
1117
- };
1118
- markAllPristine = () => {
1119
- this.markPristine();
1120
- const s = this.signal.value.length;
1121
- for (let t = 0; t < s; t++)
1122
- this.item(t).markPristine?.();
1123
- };
1124
- #a = () => {
1125
- let s = !1;
1126
- for (const t of this.#i.values())
1127
- if (t) {
1128
- s = !0;
1129
- break;
1130
- }
1131
- this.#l.set(this.dirty.value || s);
1132
- };
1133
- }
1134
- function ve(e) {
1135
- function s(t) {
1136
- return typeof t == "number" ? t : t.toString();
1137
- }
1138
- return e.map(
1139
- (t) => typeof t == "object" && t.key != null ? s(t.key) : s(t)
1140
- );
1141
- }
1142
- function ge(e) {
1143
- const s = e.filter((r) => r.path == null || r.path.length === 0).map((r) => r.message), t = e.filter((r) => r.path != null && r.path.length > 0).reduce((r, i) => {
1144
- const l = ve(i.path), a = l.pop();
1145
- let c = r;
1146
- for (const p of l)
1147
- c.dependencies == null && (c.dependencies = {}), c.dependencies[p] == null && (c.dependencies[p] = {}), c = c.dependencies[p];
1148
- return c.dependencies == null && (c.dependencies = {}), c.dependencies[a] = { message: i.message }, r;
1149
- }, {}), n = s.join(`
1150
- `);
1151
- return {
1152
- ...t,
1153
- message: n != "" ? n : void 0
1154
- };
1155
- }
1156
- function ye({
1157
- initialValue: e,
1158
- onChange: s,
1159
- validate: t,
1160
- equals: n,
1161
- validationMode: r,
1162
- validateDebounceMs: i
1163
- }) {
1164
- const l = E.deriveProp(e), a = S(f.valid), c = S(!1), p = S(r ?? "onTouched"), u = (g) => {
1165
- a.set(g);
1166
- };
1167
- let v;
1168
- const k = async (g) => {
1169
- if (t != null) {
1170
- const C = await t(g);
1171
- u(C);
1172
- }
1173
- }, D = async (g) => {
1174
- l.set(g), s?.(g);
1175
- const C = p.value;
1176
- if (t != null) {
1177
- if (C === "onSubmit")
1178
- return;
1179
- const M = i ?? 0;
1180
- M > 0 ? (v && clearTimeout(v), v = setTimeout(() => {
1181
- k(g);
1182
- }, M)) : await k(g);
1183
- }
1184
- }, h = new _(
1185
- [],
1186
- D,
1187
- l,
1188
- a,
1189
- {
1190
- disabled: c,
1191
- validationMode: p
1192
- },
1193
- n ?? V
1194
- );
1195
- return h.onDispose(() => {
1196
- c.dispose(), l.dispose(), a.dispose(), p.dispose(), v && clearTimeout(v);
1197
- }), { controller: h, setStatus: u };
1198
- }
1199
- function G(e) {
1200
- return q(o.disabled(e.disabled), o.name(e.name));
1201
- }
1202
- function Me(e, {
1203
- triggerOn: s = "change"
1204
- } = {}) {
1205
- return q(
1206
- G(e),
1207
- o.value(e.signal),
1208
- (s === "input" ? I.input : I.change)(ee(e.change))
1209
- );
1210
- }
1211
- function Fe(e, {
1212
- triggerOn: s = "change"
1213
- } = {}) {
1214
- return q(
1215
- G(e),
1216
- o.valueAsNumber(e.signal),
1217
- (s === "input" ? I.input : I.change)(
1218
- se(e.change)
1219
- )
1220
- );
1221
- }
1222
- function U(e) {
1223
- return e.issues != null ? f.invalid(ge(e.issues)) : f.valid;
1224
- }
1225
- async function Oe({
1226
- task: e,
1227
- errorMessage: s,
1228
- errorPath: t = ["root"],
1229
- validation: n
1230
- }) {
1231
- try {
1232
- const r = await e();
1233
- return n != null ? n(r) : f.valid;
1234
- } catch (r) {
1235
- const i = s ?? (r instanceof Error ? r.message : "Operation failed");
1236
- return t.length === 1 && t[0] === "root" ? f.invalid({
1237
- message: i
1238
- }) : f.invalid({
1239
- dependencies: J(t, i)
1240
- });
1241
- }
1242
- }
1243
- function J(e, s) {
1244
- if (e.length === 1)
1245
- return {
1246
- [e[0]]: { message: s }
1247
- };
1248
- const [t, ...n] = e;
1249
- return {
1250
- [t]: {
1251
- dependencies: J(n, s)
1252
- }
1253
- };
1254
- }
1255
- function xe({
1256
- initialValue: e = {},
1257
- schema: s,
1258
- onSubmit: t = async () => f.valid,
1259
- validationMode: n,
1260
- validateDebounceMs: r
1261
- }) {
1262
- const { controller: i, setStatus: l } = ye({
1263
- initialValue: e,
1264
- validationMode: n ?? "onTouched",
1265
- validateDebounceMs: r,
1266
- validate: (n ?? "onTouched") === "onSubmit" || s == null ? void 0 : async (u) => U(
1267
- await s["~standard"].validate(u)
1268
- )
1269
- }), a = S(!1), c = i.object();
1270
- return c.onDispose(a.dispose), {
1271
- controller: c,
1272
- setStatus: l,
1273
- submit: async (u) => {
1274
- if (a.set(!0), u?.preventDefault(), c.markAllTouched(), s != null) {
1275
- const k = c.signal.value, D = U(
1276
- await s["~standard"].validate(k)
1277
- );
1278
- if (l(D), D.type === "invalid") {
1279
- a.set(!1);
1280
- return;
1281
- }
1282
- }
1283
- const v = await t(c.signal.value);
1284
- a.set(!1), v.type === "invalid" && l(v);
1285
- },
1286
- submitting: a
1287
- };
1288
- }
1289
- export {
1290
- me as A,
1291
- K as B,
1292
- Se as C,
1293
- Ce as D,
1294
- De as E,
1295
- W as I,
1296
- ie as L,
1297
- ae as M,
1298
- V as O,
1299
- le as R,
1300
- Te as S,
1301
- f as a,
1302
- Ee as b,
1303
- _e as c,
1304
- z as d,
1305
- _ as e,
1306
- L as f,
1307
- be as g,
1308
- ye as h,
1309
- de as i,
1310
- Ae as j,
1311
- fe as k,
1312
- Ve as l,
1313
- he as m,
1314
- ve as n,
1315
- ge as o,
1316
- Ie as p,
1317
- G as q,
1318
- Me as r,
1319
- N as s,
1320
- Oe as t,
1321
- xe as u,
1322
- Fe as v,
1323
- pe as w,
1324
- U as x
1325
- };