@tempots/beatui 0.80.0 → 0.82.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 (112) hide show
  1. package/dist/{ar-DwHLVgKj.cjs → ar-D7CXDmVZ.cjs} +1 -1
  2. package/dist/{ar-Bo_FZZi7.js → ar-nOSKXpIW.js} +1 -1
  3. package/dist/auth/index.cjs.js +1 -1
  4. package/dist/auth/index.es.js +101 -99
  5. package/dist/beatui.css +393 -0
  6. package/dist/beatui.tailwind.css +393 -0
  7. package/dist/{de-zI5mdV4M.cjs → de-WzsOu9Gn.cjs} +1 -1
  8. package/dist/{de-CCqwOkqN.js → de-f2xcEb34.js} +1 -1
  9. package/dist/{deep-merge-1uN6CG6K.js → deep-merge-CiOwVWn8.js} +269 -284
  10. package/dist/deep-merge-DxZqCkE5.cjs +1 -0
  11. package/dist/{duration-input-C9kpsw-t.js → duration-input-B3vnnwBZ.js} +30 -29
  12. package/dist/duration-input-Dg5SX3lM.cjs +1 -0
  13. package/dist/{es-BF02UrPL.js → es-CDqqzpCw.js} +1 -1
  14. package/dist/{es-Cw90CAbu.cjs → es-Ds2Xf3wV.cjs} +1 -1
  15. package/dist/{fa-DPQV4YB8.js → fa-C7tE_hR3.js} +1 -1
  16. package/dist/{fa-B4lssnzR.cjs → fa-Ct1UtDB7.cjs} +1 -1
  17. package/dist/{fr-1Kd6z1F-.cjs → fr-CzAkRFed.cjs} +1 -1
  18. package/dist/{fr-dmxPhwkD.js → fr-yOW_68YY.js} +1 -1
  19. package/dist/{he-BtQbrVt3.js → he-D2oUloCJ.js} +1 -1
  20. package/dist/{he-CJ3XnuPm.cjs → he-DlXALrK7.cjs} +1 -1
  21. package/dist/{hi-BpfnFKHp.cjs → hi-3dBhLwDs.cjs} +1 -1
  22. package/dist/{hi-D_Le4Yka.js → hi-D5ZlZoQq.js} +1 -1
  23. package/dist/{index-CfaWytS2.cjs → index-C5YCCgnn.cjs} +1 -1
  24. package/dist/{index-K6u33-GC.cjs → index-ChsRjiIp.cjs} +17 -17
  25. package/dist/{index-CGEzILlC.js → index-CiAVfKIZ.js} +1 -1
  26. package/dist/{index-YtW7SCWB.js → index-DT6-HMMz.js} +8 -7
  27. package/dist/index.cjs.js +4 -4
  28. package/dist/index.es.js +296 -291
  29. package/dist/{it-DyHjSuHN.js → it-6e6X-4BB.js} +1 -1
  30. package/dist/{it-COCZ9NyB.cjs → it-DohtcWi9.cjs} +1 -1
  31. package/dist/{ja-X43lABza.js → ja-BxNuNo2H.js} +1 -1
  32. package/dist/{ja--NdggLU9.cjs → ja-eyTArrgS.cjs} +1 -1
  33. package/dist/json-schema/index.cjs.js +1 -8
  34. package/dist/json-schema/index.es.js +1391 -7471
  35. package/dist/json-schema-display/index.cjs.js +1 -0
  36. package/dist/json-schema-display/index.es.js +846 -0
  37. package/dist/json-structure/index.cjs.js +1 -1
  38. package/dist/json-structure/index.es.js +89 -87
  39. package/dist/{ko-BUvb0ggK.cjs → ko-BFLCDMMs.cjs} +1 -1
  40. package/dist/{ko-B9g9iw99.js → ko-Ch0jFsBV.js} +1 -1
  41. package/dist/modal-D2xE47kr.cjs +1 -0
  42. package/dist/{modal-CSHIhHvI.js → modal-hkQD1bqZ.js} +22 -21
  43. package/dist/{nl-0S25Gsld.cjs → nl-Bx2ACvr4.cjs} +1 -1
  44. package/dist/{nl-Ew5jnSsT.js → nl-NuTdZO1s.js} +1 -1
  45. package/dist/notice-C0SmlheE.cjs +1 -0
  46. package/dist/{notice-C-964yaY.js → notice-CZHWWwOQ.js} +52 -51
  47. package/dist/oneof-branch-detection-BVNoKU9d.js +6281 -0
  48. package/dist/oneof-branch-detection-C8g3eWnx.cjs +8 -0
  49. package/dist/{pl-C9f6UBSe.js → pl-Bs4nLJ__.js} +1 -1
  50. package/dist/{pl-B3k-K3S4.cjs → pl-QHl6sl8f.cjs} +1 -1
  51. package/dist/prosemirror/index.cjs.js +1 -1
  52. package/dist/prosemirror/index.es.js +1 -1
  53. package/dist/{pt-DYtAvbrw.js → pt-BETjHZrL.js} +1 -1
  54. package/dist/{pt-CKoikRO5.cjs → pt-DZGw2Z-1.cjs} +1 -1
  55. package/dist/{ru-ZexN-b8V.js → ru-Bi1_DEKM.js} +1 -1
  56. package/dist/{ru-COb7RSDt.cjs → ru-D03IuLqh.cjs} +1 -1
  57. package/dist/stack-BJgsPJ9A.js +873 -0
  58. package/dist/stack-DcZ_u50f.cjs +1 -0
  59. package/dist/string-B9vVyfq3.cjs +1 -0
  60. package/dist/string-DYyMxBl-.js +19 -0
  61. package/dist/text-input-CByq5OIo.cjs +1 -0
  62. package/dist/text-input-CFJntP7G.js +287 -0
  63. package/dist/{toolbar-DNpBIoJo.js → toolbar-DR2Zd4Oo.js} +1 -1
  64. package/dist/toolbar-TPWYzoiF.cjs +1 -0
  65. package/dist/{tr-tO_EH-Y2.cjs → tr-B_-_1wua.cjs} +1 -1
  66. package/dist/{tr-BDvn05-H.js → tr-DiYB-FwX.js} +1 -1
  67. package/dist/translations-B4-Zd2LM.cjs +1 -0
  68. package/dist/translations-Cq8bUKJP.js +584 -0
  69. package/dist/{translations-DwGC_94w.cjs → translations-D62qqNV9.cjs} +1 -1
  70. package/dist/{translations-CfWR4loD.js → translations-DPr6c05Z.js} +1 -1
  71. package/dist/types/components/json-schema/schema-conditionals.d.ts +11 -0
  72. package/dist/types/components/json-schema/schema-context.d.ts +1 -1
  73. package/dist/types/components/json-schema-display/display-widget-customization.d.ts +61 -0
  74. package/dist/types/components/json-schema-display/display-wrapper.d.ts +14 -0
  75. package/dist/types/components/json-schema-display/displays/any-display.d.ts +14 -0
  76. package/dist/types/components/json-schema-display/displays/array-display.d.ts +13 -0
  77. package/dist/types/components/json-schema-display/displays/boolean-display.d.ts +13 -0
  78. package/dist/types/components/json-schema-display/displays/composition-display.d.ts +14 -0
  79. package/dist/types/components/json-schema-display/displays/enum-const-display.d.ts +13 -0
  80. package/dist/types/components/json-schema-display/displays/generic-display.d.ts +18 -0
  81. package/dist/types/components/json-schema-display/displays/null-display.d.ts +13 -0
  82. package/dist/types/components/json-schema-display/displays/number-display.d.ts +13 -0
  83. package/dist/types/components/json-schema-display/displays/object-display.d.ts +13 -0
  84. package/dist/types/components/json-schema-display/displays/string-display.d.ts +14 -0
  85. package/dist/types/components/json-schema-display/index.d.ts +14 -0
  86. package/dist/types/components/json-schema-display/json-schema-display.d.ts +25 -0
  87. package/dist/types/components/json-schema-display/mismatch.d.ts +14 -0
  88. package/dist/types/json-schema-display/index.d.ts +1 -0
  89. package/dist/{ur-DbEqQgS6.js → ur-B69X-xNs.js} +1 -1
  90. package/dist/{ur-BbnYJ3HS.cjs → ur-DyUSmIbo.cjs} +1 -1
  91. package/dist/use-form-CgZyrACX.js +864 -0
  92. package/dist/use-form-JjeKCINk.cjs +2 -0
  93. package/dist/utils-DEbsp9Q9.js +129 -0
  94. package/dist/utils-DIUEhA-Z.cjs +1 -0
  95. package/dist/{vi-CpZUeuSj.js → vi-BdzxA60L.js} +1 -1
  96. package/dist/{vi-ByBwvGQY.cjs → vi-CBmPaHxg.cjs} +1 -1
  97. package/dist/widget-customization-DRA7E9Zf.js +1072 -0
  98. package/dist/widget-customization-G-QLB1rw.cjs +1 -0
  99. package/dist/{zh-DnxK0ieB.cjs → zh-Cb1b8uik.cjs} +1 -1
  100. package/dist/{zh-DJyhKO0I.js → zh-Dn1UJiZa.js} +1 -1
  101. package/package.json +13 -7
  102. package/dist/deep-merge-CBIkQM4E.cjs +0 -1
  103. package/dist/duration-input-DHWhQJnn.cjs +0 -1
  104. package/dist/modal-cc8Ehngz.cjs +0 -1
  105. package/dist/notice-C_BWqu2K.cjs +0 -1
  106. package/dist/toolbar-D5FcnRju.cjs +0 -1
  107. package/dist/translations-0tLX4x7M.js +0 -866
  108. package/dist/translations-WPN3ibDg.cjs +0 -1
  109. package/dist/use-form-D4JFOcjo.cjs +0 -2
  110. package/dist/use-form-D4rqJkvG.js +0 -1731
  111. package/dist/widget-customization-BSjJz3_Y.js +0 -1195
  112. package/dist/widget-customization-CrFVrt4V.cjs +0 -1
@@ -0,0 +1,864 @@
1
+ import { Use as G, coalesce as J, aria as V, attr as c, on as M, html as m, Value as C, Empty as T, computedOf as y, When as A, dataAttr as $, TextNode as Q, prop as k, Fragment as P, emitValue as X, emitValueAsNumber as Y } from "@tempots/dom";
2
+ import { B as Z, I as L } from "./translations-Cq8bUKJP.js";
3
+ import { B as ee, a as te } from "./text-input-CFJntP7G.js";
4
+ import { M as se, L as ne, i as g } from "./stack-BJgsPJ9A.js";
5
+ const F = /* @__PURE__ */ new Map();
6
+ function j(s) {
7
+ const e = F.get(s) ?? 0;
8
+ return F.set(s, e + 1), `${s}-${e}`;
9
+ }
10
+ const E = (s, e) => s === e || s !== s && e !== e;
11
+ function we({
12
+ size: s = "sm",
13
+ icon: e = "line-md:close",
14
+ disabled: t,
15
+ roundedness: n = "full",
16
+ color: i = "base",
17
+ onClick: a,
18
+ label: o
19
+ }, ...r) {
20
+ return G(Z, (l) => {
21
+ const d = J(o, l.$.closeModal);
22
+ return ee(
23
+ {
24
+ variant: "text",
25
+ size: s,
26
+ roundedness: n,
27
+ disabled: t,
28
+ color: i,
29
+ onClick: a
30
+ },
31
+ c.title(d),
32
+ V.label(d),
33
+ ...r,
34
+ L({ icon: e, size: s ?? "sm" })
35
+ );
36
+ });
37
+ }
38
+ const De = (s) => {
39
+ const {
40
+ value: e,
41
+ onBlur: t,
42
+ onChange: n,
43
+ placeholder: i,
44
+ disabled: a,
45
+ id: o,
46
+ checkedIcon: r,
47
+ uncheckedIcon: l,
48
+ iconSize: d = "lg"
49
+ } = s, h = o ?? j("checkbox"), p = `${h}-label`, v = () => {
50
+ if (C.get(a ?? !1)) return;
51
+ const u = C.get(e);
52
+ n?.(!u);
53
+ }, w = (u) => {
54
+ C.get(a ?? !1) || (u.key === " " || u.key === "Enter") && (u.preventDefault(), v());
55
+ };
56
+ return te(
57
+ {
58
+ baseContainer: !0,
59
+ growInput: !1,
60
+ ...s,
61
+ input: m.span(
62
+ c.class("bc-checkbox-input"),
63
+ m.span(
64
+ c.class("bc-checkbox-input__checkbox"),
65
+ c.class(
66
+ C.map(
67
+ e,
68
+ (u) => u ? "bc-checkbox-input__checkbox--checked" : "bc-checkbox-input__checkbox--unchecked"
69
+ )
70
+ ),
71
+ c.class(
72
+ C.map(
73
+ a ?? !1,
74
+ (u) => u ? "bc-checkbox-input__checkbox--disabled" : ""
75
+ )
76
+ ),
77
+ c.id(h),
78
+ c.role("checkbox"),
79
+ c.tabindex(
80
+ C.map(
81
+ a ?? !1,
82
+ (u) => u ? -1 : 0
83
+ )
84
+ ),
85
+ V.checked(e),
86
+ V.disabled(a),
87
+ i != null ? V.labelledby(p) : T,
88
+ M.keydown(w),
89
+ t != null ? M.blur(t) : T,
90
+ L({
91
+ icon: y(
92
+ e,
93
+ r,
94
+ l
95
+ )(
96
+ (u, f, D) => u ? f ?? "akar-icons/check-box-fill" : D ?? "akar-icons/box"
97
+ ),
98
+ accessibility: "decorative",
99
+ size: d
100
+ })
101
+ ),
102
+ i != null ? m.label(
103
+ c.class("bc-checkbox-input__label"),
104
+ c.id(p),
105
+ c.for(h),
106
+ se(i)
107
+ ) : T
108
+ )
109
+ },
110
+ M.click(v)
111
+ );
112
+ }, ie = m.span(
113
+ c.class("bc-input-wrapper__required"),
114
+ " *"
115
+ );
116
+ function re(s) {
117
+ const e = ["bc-input-wrapper"];
118
+ return s !== "vertical" && e.push(`bc-input-wrapper--${s}`), e.join(" ");
119
+ }
120
+ function ae(s, e) {
121
+ const t = ["bc-input-wrapper__label-text"];
122
+ return s ? t.push("bc-input-wrapper__label-text--error") : e ? t.push("bc-input-wrapper__label-text--disabled") : t.push("bc-input-wrapper__label-text--default"), t.join(" ");
123
+ }
124
+ function oe(s, e) {
125
+ if (s === "horizontal-fixed" && e != null)
126
+ return `--input-wrapper-label-width: ${e}`;
127
+ }
128
+ const W = ({
129
+ fullWidth: s = !1,
130
+ required: e,
131
+ label: t,
132
+ labelChildren: n,
133
+ context: i,
134
+ description: a,
135
+ content: o,
136
+ error: r,
137
+ labelFor: l,
138
+ hasError: d,
139
+ disabled: h,
140
+ layout: p,
141
+ labelWidth: v
142
+ }, ...w) => {
143
+ const u = d ?? r != null, f = h ?? !1, D = p ?? "vertical", S = j("input-wrapper"), x = a ? `${S}-description` : void 0, O = r != null ? `${S}-error` : void 0, H = y(D)((b) => b !== "vertical"), q = y(
144
+ D,
145
+ v ?? void 0
146
+ )((b, I) => oe(b, I));
147
+ return m.div(
148
+ c.class(C.map(D, (b) => re(b))),
149
+ c.class(
150
+ C.map(
151
+ s,
152
+ (b) => b ? "bc-input-wrapper--full-width" : ""
153
+ )
154
+ ),
155
+ c.style(q),
156
+ t != null || i != null ? m.div(
157
+ c.class("bc-input-wrapper__header"),
158
+ m.div(
159
+ c.class("bc-input-wrapper__label-section"),
160
+ m.label(
161
+ c.class("bc-input-wrapper__label"),
162
+ l != null ? c.for(l) : T,
163
+ m.span(
164
+ c.class(
165
+ y(
166
+ u,
167
+ f
168
+ )(
169
+ (b, I) => ae(
170
+ b ?? !1,
171
+ I ?? !1
172
+ )
173
+ )
174
+ ),
175
+ t
176
+ ),
177
+ t != null && e ? ie : T
178
+ ),
179
+ // Show description under label when horizontal
180
+ A(
181
+ y(
182
+ H,
183
+ a
184
+ )((b, I) => b && I != null),
185
+ () => m.div(
186
+ c.class(
187
+ "bc-input-wrapper__description bc-input-wrapper__description--under-label"
188
+ ),
189
+ c.id(x),
190
+ a
191
+ )
192
+ )
193
+ ),
194
+ i != null ? ne(i) : T,
195
+ n
196
+ ) : T,
197
+ m.div(
198
+ c.class("bc-input-wrapper__content"),
199
+ // Add data attributes to help inputs inherit accessibility information
200
+ [x, O].filter(Boolean).length > 0 ? $.describedby(
201
+ [x, O].filter(Boolean).join(" ")
202
+ ) : T,
203
+ e ? $.required("true") : T,
204
+ A(u, () => $.invalid("true")),
205
+ o
206
+ ),
207
+ // Show description at bottom only when not horizontal
208
+ A(
209
+ y(H, a)((b, I) => !b && I != null),
210
+ () => m.div(
211
+ c.class("bc-input-wrapper__description"),
212
+ c.id(x),
213
+ a
214
+ )
215
+ ),
216
+ A(
217
+ u,
218
+ () => m.div(
219
+ c.class("bc-input-wrapper__error"),
220
+ c.id(O),
221
+ V.live("polite"),
222
+ // Announce errors to screen readers
223
+ c.role("alert"),
224
+ // Mark as alert for immediate attention
225
+ r
226
+ )
227
+ ),
228
+ ...w
229
+ );
230
+ }, le = (
231
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
232
+ ((s, e) => () => {
233
+ s.markTouched(), e?.();
234
+ })
235
+ ), N = (s, e) => (t) => {
236
+ s.change(t), e?.(t);
237
+ };
238
+ function R(s, e) {
239
+ const { controller: t, onBlur: n, onChange: i, id: a, triggerOn: o, ...r } = e;
240
+ return s({
241
+ id: a ?? t.name,
242
+ disabled: t.disabled,
243
+ value: t.signal,
244
+ hasError: t.errorVisible,
245
+ name: t.name,
246
+ ...r,
247
+ onInput: o === "input" ? N(t, i) : void 0,
248
+ onChange: o !== "input" ? N(t, i) : void 0,
249
+ onBlur: le(t, n)
250
+ });
251
+ }
252
+ function Ce(s, { id: e, labelFor: t, ...n }, ...i) {
253
+ const a = e ?? n.controller.name ?? j("control"), o = t ?? a;
254
+ return W(
255
+ {
256
+ ...n,
257
+ hasError: n.controller.errorVisible,
258
+ error: Q(n.controller.error.map((r) => r ?? "")),
259
+ labelFor: o,
260
+ content: R(
261
+ (r) => s({ ...r, id: a }),
262
+ n
263
+ )
264
+ },
265
+ ...i
266
+ );
267
+ }
268
+ function ce(s, e) {
269
+ const { toInput: t, fromInput: n, controller: i, ...a } = e, o = i.transform(t, n);
270
+ return R(s, {
271
+ ...a,
272
+ controller: o
273
+ });
274
+ }
275
+ function Te(s, {
276
+ id: e,
277
+ labelFor: t,
278
+ ...n
279
+ }, ...i) {
280
+ const a = e ?? n.controller.name ?? j("control");
281
+ return W(
282
+ {
283
+ ...n,
284
+ labelFor: t ?? a,
285
+ content: ce(s, {
286
+ ...n,
287
+ id: a
288
+ })
289
+ },
290
+ ...i
291
+ );
292
+ }
293
+ function _e(s) {
294
+ return s.split(".").map((t) => {
295
+ const n = t.match(/^\[(\d+)\]$/);
296
+ return n ? Number(n[1]) : t;
297
+ });
298
+ }
299
+ function he(s) {
300
+ return typeof s == "number" ? `[${s}]` : `.${s}`;
301
+ }
302
+ function ue(s) {
303
+ if (s.length === 0) return "";
304
+ const [e, ...t] = s;
305
+ return [
306
+ typeof e == "number" ? `[${e}]` : e,
307
+ ...t.map(he)
308
+ ].join("");
309
+ }
310
+ const Ie = {
311
+ /** A valid validation result */
312
+ valid: g.valid,
313
+ /**
314
+ * Create an invalid validation with a message
315
+ */
316
+ invalid(s) {
317
+ return g.invalid({ message: s });
318
+ },
319
+ /**
320
+ * Create an invalid validation with field-specific errors.
321
+ * Values can be error messages (strings) or full ControllerError objects.
322
+ */
323
+ invalidFields(s) {
324
+ const e = {};
325
+ for (const [t, n] of Object.entries(s))
326
+ e[t] = typeof n == "string" ? { message: n } : n;
327
+ return g.invalid({ dependencies: e });
328
+ },
329
+ /**
330
+ * Create an invalid validation from a ControllerError object
331
+ */
332
+ fromError(s) {
333
+ return g.invalid(s);
334
+ }
335
+ };
336
+ function B(s) {
337
+ return function(t) {
338
+ if (t.type === "valid") return t;
339
+ let n = t.error;
340
+ for (const i of s)
341
+ if (n = n?.dependencies?.[i], n == null) return g.valid;
342
+ return g.invalid(n);
343
+ };
344
+ }
345
+ class _ {
346
+ path;
347
+ change;
348
+ signal;
349
+ status;
350
+ error;
351
+ hasError;
352
+ touched;
353
+ errorVisible;
354
+ dirty;
355
+ dependencyErrors;
356
+ #e = {
357
+ disabled: k(!1),
358
+ touched: k(!1)
359
+ };
360
+ #s;
361
+ #t = k(void 0);
362
+ parent;
363
+ disabled;
364
+ #n = [];
365
+ disabledOrHasErrors;
366
+ constructor(e, t, n, i, a, o = E) {
367
+ this.path = e, this.change = t, this.signal = n, this.status = i, this.#s = o, this.#t.set(n.value), this.error = i.map(
368
+ (r) => r?.type === "invalid" ? r.error?.message : void 0
369
+ ), this.hasError = this.error.map((r) => r != null), this.touched = this.#e.touched, a.validationMode ? this.errorVisible = y(
370
+ this.hasError,
371
+ this.touched,
372
+ a.validationMode
373
+ )((r, l, d) => d === "eager" ? !!r : !!r && !!l) : this.errorVisible = y(
374
+ this.hasError,
375
+ this.touched
376
+ )((r, l) => !!r && !!l), this.dirty = y(
377
+ this.signal,
378
+ this.#t
379
+ )((r, l) => !this.#s(r, l)), this.dependencyErrors = i.map(
380
+ (r) => r?.type === "invalid" ? r.error?.dependencies : void 0
381
+ ), this.parent = a, this.disabled = y(
382
+ this.#e.disabled,
383
+ a.disabled
384
+ )((r, l) => r || l), this.disabledOrHasErrors = y(
385
+ this.disabled,
386
+ this.hasError
387
+ )((r, l) => r || l), this.onDispose(() => {
388
+ this.#e.disabled.dispose(), this.#e.touched.dispose(), this.disabled.dispose(), this.error.dispose(), this.errorVisible.dispose(), this.dirty.dispose(), this.#t.dispose(), this.dependencyErrors.dispose(), this.disabledOrHasErrors.dispose();
389
+ });
390
+ }
391
+ get name() {
392
+ return ue(this.path);
393
+ }
394
+ onDispose = (e) => {
395
+ this.#n.push(e);
396
+ };
397
+ dispose = () => {
398
+ for (const e of this.#n)
399
+ try {
400
+ e();
401
+ } catch (t) {
402
+ console.error("Error in dispose callback:", t);
403
+ }
404
+ this.#n.length = 0;
405
+ };
406
+ setDisabled = (e) => {
407
+ this.#e.disabled.set(e);
408
+ };
409
+ disable = () => this.setDisabled(!0);
410
+ enable = () => this.setDisabled(!1);
411
+ markTouched = () => {
412
+ this.#e.touched.set(!0);
413
+ };
414
+ resetTouched = () => {
415
+ this.#e.touched.set(!1);
416
+ };
417
+ markPristine = () => {
418
+ this.#t.set(this.signal.value);
419
+ };
420
+ reset = () => {
421
+ this.change(this.#t.value);
422
+ };
423
+ array = (e = E) => new pe(
424
+ this.path,
425
+ this.change,
426
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
427
+ this.signal,
428
+ this.status,
429
+ this.parent,
430
+ e
431
+ );
432
+ object = (e = E) => new de(
433
+ this.path,
434
+ this.change,
435
+ this.signal,
436
+ this.status,
437
+ this.parent,
438
+ e
439
+ );
440
+ transform = (e, t, n = [], i = E) => new _(
441
+ [...this.path, ...n],
442
+ (a) => this.change(t(a)),
443
+ this.signal.map(e, i),
444
+ this.status.map(B(n)),
445
+ this.parent,
446
+ i
447
+ );
448
+ asyncTransform = (e, t, n, i = [], a = E) => new _(
449
+ [...this.path, ...i],
450
+ (o) => {
451
+ t(o).then((r) => this.change(r));
452
+ },
453
+ this.signal.mapAsync(e, n, void 0, a),
454
+ this.status.map(B(i)),
455
+ this.parent,
456
+ a
457
+ );
458
+ }
459
+ class de extends _ {
460
+ #e = /* @__PURE__ */ new Map();
461
+ #s = /* @__PURE__ */ new Map();
462
+ #t = /* @__PURE__ */ new Map();
463
+ #n = k(!1);
464
+ touchedDeep = this.#n;
465
+ #r = /* @__PURE__ */ new Map();
466
+ #i = /* @__PURE__ */ new Map();
467
+ #o = k(!1);
468
+ dirtyDeep = this.#o;
469
+ #c;
470
+ #h;
471
+ #l = () => {
472
+ let e = !1;
473
+ for (const t of this.#s.values())
474
+ if (t) {
475
+ e = !0;
476
+ break;
477
+ }
478
+ this.#n.set(this.touched.value || e);
479
+ };
480
+ constructor(e, t, n, i, a, o) {
481
+ super(
482
+ e,
483
+ t,
484
+ n.map((l) => l ?? {}, o),
485
+ i,
486
+ a,
487
+ o
488
+ ), this.#c = this.touched.on(() => {
489
+ this.#l();
490
+ }), this.#h = this.dirty.on(() => {
491
+ this.#a();
492
+ });
493
+ const r = this.signal.on(() => this.#a());
494
+ this.onDispose(() => {
495
+ for (const l of this.#e.values())
496
+ l.dispose();
497
+ this.#e.clear();
498
+ for (const l of this.#t.values()) l();
499
+ this.#t.clear(), this.#s.clear(), this.#n.dispose();
500
+ for (const l of this.#i.values()) l();
501
+ this.#i.clear(), this.#r.clear(), this.#o.dispose(), this.#c(), this.#h(), r();
502
+ });
503
+ }
504
+ field = (e) => {
505
+ if (this.#e.has(e))
506
+ return this.#e.get(e);
507
+ const t = async (o) => {
508
+ this.change({
509
+ ...this.signal.value,
510
+ [e]: o
511
+ });
512
+ }, n = new _(
513
+ [...this.path, e],
514
+ t,
515
+ this.signal.map((o) => o[e]),
516
+ this.status.map(B([e])),
517
+ {
518
+ disabled: this.disabled,
519
+ // propagate validationMode to children if present
520
+ validationMode: this.parent.validationMode
521
+ }
522
+ );
523
+ this.#e.set(e, n);
524
+ const i = n.touched.on((o) => {
525
+ this.#s.set(e, o), this.#l();
526
+ });
527
+ this.#t.set(e, i);
528
+ const a = n.dirty.on((o) => {
529
+ this.#r.set(e, o), this.#a();
530
+ });
531
+ return this.#i.set(e, a), n;
532
+ };
533
+ markAllTouched = () => {
534
+ this.markTouched();
535
+ const e = this.signal.value;
536
+ for (const t of Object.keys(e))
537
+ this.field(t).markTouched();
538
+ for (const t of this.#e.values())
539
+ t.markTouched();
540
+ };
541
+ markAllPristine = () => {
542
+ this.markPristine();
543
+ const e = this.signal.value;
544
+ for (const t of Object.keys(e))
545
+ this.field(t).markPristine?.();
546
+ for (const t of this.#e.values())
547
+ t.markPristine?.();
548
+ };
549
+ #a = () => {
550
+ let e = !1;
551
+ for (const t of this.#r.values())
552
+ if (t) {
553
+ e = !0;
554
+ break;
555
+ }
556
+ this.#o.set(this.dirty.value || e);
557
+ };
558
+ }
559
+ class pe extends _ {
560
+ #e = new Array();
561
+ length;
562
+ #s = /* @__PURE__ */ new Map();
563
+ #t = /* @__PURE__ */ new Map();
564
+ #n = k(!1);
565
+ touchedDeep = this.#n;
566
+ #r = /* @__PURE__ */ new Map();
567
+ #i = /* @__PURE__ */ new Map();
568
+ #o = k(!1);
569
+ dirtyDeep = this.#o;
570
+ #c;
571
+ #h;
572
+ #l = () => {
573
+ let e = !1;
574
+ for (const t of this.#s.values())
575
+ if (t) {
576
+ e = !0;
577
+ break;
578
+ }
579
+ this.#n.set(this.touched.value || e);
580
+ };
581
+ constructor(e, t, n, i, a, o) {
582
+ const r = n.map((h) => h ?? [], o);
583
+ super(e, t, r, i, a, o);
584
+ const l = r.on((h) => {
585
+ const p = this.#e.length - h.length;
586
+ p > 0 && (this.#e.splice(h.length, p).forEach((v, w) => {
587
+ const u = h.length + w;
588
+ v.dispose(), this.#t.get(u)?.(), this.#t.delete(u), this.#s.delete(u), this.#i.get(u)?.(), this.#i.delete(u), this.#r.delete(u);
589
+ }), this.#l(), this.#a());
590
+ });
591
+ this.length = r.map((h) => h.length), this.#c = this.touched.on(() => {
592
+ this.#l();
593
+ }), this.#h = this.dirty.on(() => {
594
+ this.#a();
595
+ });
596
+ const d = this.signal.on(() => this.#a());
597
+ this.onDispose(() => {
598
+ for (const h of this.#e)
599
+ h.dispose();
600
+ this.length.dispose(), this.#e.length = 0, l(), r.dispose();
601
+ for (const h of this.#t.values()) h();
602
+ this.#t.clear(), this.#s.clear(), this.#n.dispose();
603
+ for (const h of this.#i.values()) h();
604
+ this.#i.clear(), this.#r.clear(), this.#o.dispose(), this.#c(), this.#h(), d();
605
+ });
606
+ }
607
+ item = (e) => {
608
+ if (this.#e[e])
609
+ return this.#e[e];
610
+ const t = async (o) => {
611
+ const r = this.signal.value.slice();
612
+ r[e] = o, this.change(r);
613
+ }, n = new _(
614
+ [...this.path, e],
615
+ t,
616
+ this.signal.map((o) => o[e]),
617
+ this.status.map(B([e])),
618
+ {
619
+ disabled: this.disabled,
620
+ validationMode: this.parent.validationMode
621
+ }
622
+ );
623
+ this.#e[e] = n;
624
+ const i = n.touched.on((o) => {
625
+ this.#s.set(e, o), this.#l();
626
+ });
627
+ this.#t.set(e, i);
628
+ const a = n.dirty.on((o) => {
629
+ this.#r.set(e, o), this.#a();
630
+ });
631
+ return this.#i.set(e, a), n;
632
+ };
633
+ push = (...e) => {
634
+ this.change([...this.signal.value, ...e]);
635
+ };
636
+ pop = () => {
637
+ this.splice(this.signal.value.length - 1, 1);
638
+ };
639
+ shift = () => {
640
+ this.splice(0, 1);
641
+ };
642
+ unshift = (...e) => {
643
+ this.change([...e, ...this.signal.value]);
644
+ };
645
+ removeAt = (e) => {
646
+ this.splice(e, 1);
647
+ };
648
+ splice = (e, t) => {
649
+ const n = this.signal.value.slice();
650
+ n.splice(e, t), this.change(n);
651
+ };
652
+ move = (e, t, n = 1) => {
653
+ if (n < 1 || e === t) return;
654
+ const i = this.signal.value.slice(), a = i.splice(e, n);
655
+ i.splice(t, 0, ...a), this.change(i);
656
+ };
657
+ markAllTouched = () => {
658
+ this.markTouched();
659
+ const e = this.signal.value.length;
660
+ for (let t = 0; t < e; t++)
661
+ this.item(t).markTouched();
662
+ };
663
+ markAllPristine = () => {
664
+ this.markPristine();
665
+ const e = this.signal.value.length;
666
+ for (let t = 0; t < e; t++)
667
+ this.item(t).markPristine?.();
668
+ };
669
+ #a = () => {
670
+ let e = !1;
671
+ for (const t of this.#r.values())
672
+ if (t) {
673
+ e = !0;
674
+ break;
675
+ }
676
+ this.#o.set(this.dirty.value || e);
677
+ };
678
+ }
679
+ function fe(s) {
680
+ function e(t) {
681
+ return typeof t == "number" ? t : t.toString();
682
+ }
683
+ return s.map(
684
+ (t) => typeof t == "object" && t.key != null ? e(t.key) : e(t)
685
+ );
686
+ }
687
+ function be(s) {
688
+ const e = s.filter((i) => i.path == null || i.path.length === 0).map((i) => i.message), t = s.filter((i) => i.path != null && i.path.length > 0).reduce((i, a) => {
689
+ const o = fe(a.path), r = o.pop();
690
+ let l = i;
691
+ for (const d of o)
692
+ l.dependencies == null && (l.dependencies = {}), l.dependencies[d] == null && (l.dependencies[d] = {}), l = l.dependencies[d];
693
+ return l.dependencies == null && (l.dependencies = {}), l.dependencies[r] = { message: a.message }, i;
694
+ }, {}), n = e.join(`
695
+ `);
696
+ return {
697
+ ...t,
698
+ message: n != "" ? n : void 0
699
+ };
700
+ }
701
+ function me({
702
+ initialValue: s,
703
+ onChange: e,
704
+ validate: t,
705
+ equals: n,
706
+ validationMode: i,
707
+ validateDebounceMs: a
708
+ }) {
709
+ const o = C.deriveProp(s), r = k(g.valid), l = k(!1), d = k(i ?? "onTouched"), h = (f) => {
710
+ r.set(f);
711
+ };
712
+ let p;
713
+ const v = async (f) => {
714
+ if (t != null) {
715
+ const D = await t(f);
716
+ h(D);
717
+ }
718
+ }, w = async (f) => {
719
+ o.set(f), e?.(f);
720
+ const D = d.value;
721
+ if (t != null) {
722
+ if (D === "onSubmit")
723
+ return;
724
+ const S = a ?? 0;
725
+ S > 0 ? (p && clearTimeout(p), p = setTimeout(() => {
726
+ v(f);
727
+ }, S)) : await v(f);
728
+ }
729
+ }, u = new _(
730
+ [],
731
+ w,
732
+ o,
733
+ r,
734
+ {
735
+ disabled: l,
736
+ validationMode: d
737
+ },
738
+ n ?? E
739
+ );
740
+ return u.onDispose(() => {
741
+ l.dispose(), o.dispose(), r.dispose(), d.dispose(), p && clearTimeout(p);
742
+ }), { controller: u, setStatus: h };
743
+ }
744
+ function U(s) {
745
+ return P(c.disabled(s.disabled), c.name(s.name));
746
+ }
747
+ function Me(s, {
748
+ triggerOn: e = "change"
749
+ } = {}) {
750
+ return P(
751
+ U(s),
752
+ c.value(s.signal),
753
+ (e === "input" ? M.input : M.change)(X(s.change))
754
+ );
755
+ }
756
+ function Ee(s, {
757
+ triggerOn: e = "change"
758
+ } = {}) {
759
+ return P(
760
+ U(s),
761
+ c.valueAsNumber(s.signal),
762
+ (e === "input" ? M.input : M.change)(
763
+ Y(s.change)
764
+ )
765
+ );
766
+ }
767
+ function z(s) {
768
+ return s.issues != null ? g.invalid(be(s.issues)) : g.valid;
769
+ }
770
+ async function Se({
771
+ task: s,
772
+ errorMessage: e,
773
+ errorPath: t = ["root"],
774
+ validation: n
775
+ }) {
776
+ try {
777
+ const i = await s();
778
+ return n != null ? n(i) : g.valid;
779
+ } catch (i) {
780
+ const a = e ?? (i instanceof Error ? i.message : "Operation failed");
781
+ return t.length === 1 && t[0] === "root" ? g.invalid({
782
+ message: a
783
+ }) : g.invalid({
784
+ dependencies: K(t, a)
785
+ });
786
+ }
787
+ }
788
+ function K(s, e) {
789
+ if (s.length === 1)
790
+ return {
791
+ [s[0]]: { message: e }
792
+ };
793
+ const [t, ...n] = s;
794
+ return {
795
+ [t]: {
796
+ dependencies: K(n, e)
797
+ }
798
+ };
799
+ }
800
+ function Ve({
801
+ initialValue: s = {},
802
+ schema: e,
803
+ onSubmit: t = async () => g.valid,
804
+ validationMode: n,
805
+ validateDebounceMs: i
806
+ }) {
807
+ const { controller: a, setStatus: o } = me({
808
+ initialValue: s,
809
+ validationMode: n ?? "onTouched",
810
+ validateDebounceMs: i,
811
+ validate: (n ?? "onTouched") === "onSubmit" || e == null ? void 0 : async (h) => z(
812
+ await e["~standard"].validate(h)
813
+ )
814
+ }), r = k(!1), l = a.object();
815
+ return l.onDispose(r.dispose), {
816
+ controller: l,
817
+ setStatus: o,
818
+ submit: async (h) => {
819
+ if (r.set(!0), h?.preventDefault(), l.markAllTouched(), e != null) {
820
+ const v = l.signal.value, w = z(
821
+ await e["~standard"].validate(v)
822
+ );
823
+ if (o(w), w.type === "invalid") {
824
+ r.set(!1);
825
+ return;
826
+ }
827
+ }
828
+ const p = await t(l.signal.value);
829
+ r.set(!1), p.type === "invalid" && o(p);
830
+ },
831
+ submitting: r
832
+ };
833
+ }
834
+ export {
835
+ pe as A,
836
+ R as B,
837
+ we as C,
838
+ W as I,
839
+ Te as M,
840
+ E as O,
841
+ ie as R,
842
+ De as a,
843
+ Ce as b,
844
+ N as c,
845
+ _ as d,
846
+ B as e,
847
+ de as f,
848
+ me as g,
849
+ ce as h,
850
+ ue as i,
851
+ Ie as j,
852
+ fe as k,
853
+ be as l,
854
+ le as m,
855
+ U as n,
856
+ Me as o,
857
+ _e as p,
858
+ Ee as q,
859
+ z as r,
860
+ j as s,
861
+ Se as t,
862
+ Ve as u,
863
+ he as w
864
+ };