@reformer/core 10.0.0-beta.2 → 10.0.0-beta.4

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 (67) hide show
  1. package/dist/{behaviors-node-DUrqAqp1.js → behaviors-node-DGEFMTQu.js} +1 -1
  2. package/dist/{behaviors-value-lCpqicfa.js → behaviors-value-C7dSEhCc.js} +43 -57
  3. package/dist/behaviors.js +108 -107
  4. package/dist/derived-registry-CluZCQ7U.js +16 -0
  5. package/dist/form/form-submitter.d.ts +0 -4
  6. package/dist/form/hooks/types.d.ts +3 -3
  7. package/dist/form/hooks/use-form-validation.d.ts +48 -0
  8. package/dist/form/index.d.ts +2 -3
  9. package/dist/form/nodes/array-node.d.ts +0 -84
  10. package/dist/form/nodes/form-node.d.ts +0 -14
  11. package/dist/form/nodes/group-node.d.ts +0 -4
  12. package/dist/form/status-machine.d.ts +0 -38
  13. package/dist/form/types/contracts.d.ts +0 -6
  14. package/dist/form/types/deep-schema.d.ts +0 -9
  15. package/dist/form/types/index.d.ts +4 -38
  16. package/dist/form/types/schema-node.d.ts +13 -16
  17. package/dist/form/types/validation-schema.d.ts +0 -25
  18. package/dist/form/unique-id.d.ts +3 -11
  19. package/dist/form/validation-schema.d.ts +16 -3
  20. package/dist/form/validation-strategy.d.ts +55 -0
  21. package/dist/form/validators.d.ts +8 -3
  22. package/dist/form-model-DYCzGGKF.js +286 -0
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +477 -648
  25. package/dist/runtime-token.d.ts +23 -0
  26. package/dist/state/form-model.d.ts +12 -1
  27. package/dist/state.js +17 -15
  28. package/dist/subscription-manager-705bls97.js +171 -0
  29. package/dist/validation.js +133 -81
  30. package/dist/validators.d.ts +0 -4
  31. package/dist/validators.js +88 -122
  32. package/docs/llms/01-api-reference.md +63 -0
  33. package/docs/llms/02-quick-start.md +143 -0
  34. package/docs/llms/03-api-signatures.md +273 -0
  35. package/docs/llms/04-common-patterns.md +202 -0
  36. package/docs/llms/05-common-mistakes.md +167 -0
  37. package/docs/llms/06-troubleshooting.md +11 -0
  38. package/docs/llms/07-complete-import.md +99 -0
  39. package/docs/llms/08-form-types.md +47 -0
  40. package/docs/llms/09-formschema.md +143 -0
  41. package/docs/llms/10-arrays.md +161 -0
  42. package/docs/llms/11-async-watchfield.md +53 -0
  43. package/docs/llms/12-array-cleanup.md +31 -0
  44. package/docs/llms/13-multi-step.md +91 -0
  45. package/docs/llms/14-extended-mistakes.md +98 -0
  46. package/docs/llms/15-project-structure.md +125 -0
  47. package/docs/llms/16-ui-components.md +189 -0
  48. package/docs/llms/17-nonexistent-api.md +93 -0
  49. package/docs/llms/18-conditional-fields.md +183 -0
  50. package/docs/llms/19-reading-values.md +59 -0
  51. package/docs/llms/20-compute-vs-watch.md +138 -0
  52. package/docs/llms/21-array-operations.md +113 -0
  53. package/docs/llms/22-cycle-detection.md +86 -0
  54. package/docs/llms/23-copy-from.md +141 -0
  55. package/docs/llms/24-sync-fields.md +114 -0
  56. package/docs/llms/25-reset-when.md +115 -0
  57. package/docs/llms/26-transform-value.md +136 -0
  58. package/docs/llms/27-revalidate-when.md +132 -0
  59. package/docs/llms/28-submit-and-reset.md +259 -0
  60. package/docs/llms/29-async-preload.md +193 -0
  61. package/docs/llms/30-type-safety-recipes.md +159 -0
  62. package/docs/llms/31-async-validator-debounce.md +135 -0
  63. package/docs/llms/32-async-options-loading.md +108 -0
  64. package/docs/llms/33-validation-strategy.md +193 -0
  65. package/llms.txt +435 -1580
  66. package/package.json +33 -10
  67. package/dist/form-model-C8Fi83k4.js +0 -439
package/dist/index.js CHANGED
@@ -1,13 +1,14 @@
1
- import { S as D } from "./form-model-C8Fi83k4.js";
2
- import { c as Ce } from "./form-model-C8Fi83k4.js";
3
- import { i as B } from "./behaviors-value-lCpqicfa.js";
4
- import { c as Pe, a as Te, m as De, r as Ie, b as Le, d as Re, e as Be, f as $e, s as Ge, t as je, u as Ue, w as We } from "./behaviors-value-lCpqicfa.js";
5
- import { default as He } from "./validators.js";
6
- import { signal as g, computed as c, effect as _, batch as X, Signal as $ } from "@preact/signals-core";
1
+ import { c as Le } from "./form-model-DYCzGGKF.js";
2
+ import { c as $e, a as Ge, r as je, b as Ue, d as Be, e as We, f as qe, s as Ke, t as He, w as ze } from "./behaviors-value-C7dSEhCc.js";
3
+ import { i as $ } from "./derived-registry-CluZCQ7U.js";
4
+ import { m as Ye, u as Qe } from "./derived-registry-CluZCQ7U.js";
5
+ import { S as I } from "./subscription-manager-705bls97.js";
6
+ import { signal as g, computed as f, effect as _, batch as X, Signal as G } from "@preact/signals-core";
7
7
  import { r as Z } from "./signal-node-registry-tiwel-TV.js";
8
- import { g as Je } from "./signal-node-registry-tiwel-TV.js";
9
- import { d as ze, e as Qe } from "./behaviors-node-DUrqAqp1.js";
10
- import K, { useRef as O, useCallback as E } from "react";
8
+ import { g as Ze } from "./signal-node-registry-tiwel-TV.js";
9
+ import { d as tt, e as st } from "./behaviors-node-DGEFMTQu.js";
10
+ import H, { useRef as V, useCallback as b, useMemo as ee, useEffect as te } from "react";
11
+ import { createFormValidation as se } from "./validation.js";
11
12
  class M {
12
13
  // ============================================================================
13
14
  // Protected состояние (для Template Method паттерна)
@@ -34,33 +35,21 @@ class M {
34
35
  * Пользователь взаимодействовал с узлом (touched)
35
36
  * Computed из _touched для предоставления readonly интерфейса
36
37
  */
37
- touched = c(() => this._touched.value);
38
- /**
39
- * Пользователь не взаимодействовал с узлом (untouched)
40
- */
41
- untouched = c(() => !this._touched.value);
38
+ touched = f(() => this._touched.value);
42
39
  /**
43
40
  * Значение узла было изменено (dirty)
44
41
  * Computed из _dirty для предоставления readonly интерфейса
45
42
  */
46
- dirty = c(() => this._dirty.value);
47
- /**
48
- * Значение узла не было изменено (pristine)
49
- */
50
- pristine = c(() => !this._dirty.value);
43
+ dirty = f(() => this._dirty.value);
51
44
  /**
52
45
  * Текущий статус узла
53
46
  * Computed из _status для предоставления readonly интерфейса
54
47
  */
55
- status = c(() => this._status.value);
48
+ status = f(() => this._status.value);
56
49
  /**
57
50
  * Узел отключен (disabled)
58
51
  */
59
- disabled = c(() => this._status.value === "disabled");
60
- /**
61
- * Узел включен (enabled)
62
- */
63
- enabled = c(() => this._status.value !== "disabled");
52
+ disabled = f(() => this._status.value === "disabled");
64
53
  /**
65
54
  * Получить ошибки валидации с фильтрацией
66
55
  *
@@ -108,8 +97,8 @@ class M {
108
97
  if (e.params !== void 0) {
109
98
  if (!s.params)
110
99
  return !1;
111
- for (const [i, a] of Object.entries(e.params))
112
- if (s.params[i] !== a)
100
+ for (const [r, n] of Object.entries(e.params))
101
+ if (s.params[r] !== n)
113
102
  return !1;
114
103
  }
115
104
  return !(e.predicate !== void 0 && !e.predicate(s));
@@ -285,7 +274,7 @@ class M {
285
274
  onEnable() {
286
275
  }
287
276
  }
288
- const w = {
277
+ const O = {
289
278
  /** FieldNode.watch() */
290
279
  Watch: "watch",
291
280
  /** FieldNode.computeFrom() */
@@ -293,20 +282,16 @@ const w = {
293
282
  /** GroupNode.linkFields() */
294
283
  LinkFields: "linkFields",
295
284
  /** GroupNode.watchField() */
296
- WatchField: "watchField",
297
- /** ArrayNode.watchItems() */
298
- WatchItems: "watchItems",
299
- /** ArrayNode.watchLength() */
300
- WatchLength: "watchLength"
285
+ WatchField: "watchField"
301
286
  };
302
- let ee = 0;
303
- function V(r) {
304
- return `${r}-${++ee}`;
287
+ let re = 0;
288
+ function N(i) {
289
+ return `${i}-${++re}`;
305
290
  }
306
- var A = /* @__PURE__ */ ((r) => (r.THROW = "throw", r.LOG = "log", r.CONVERT = "convert", r))(A || {});
307
- class F {
291
+ var A = /* @__PURE__ */ ((i) => (i.THROW = "throw", i.LOG = "log", i.CONVERT = "convert", i))(A || {});
292
+ class k {
308
293
  static handle(e, t, s = "throw") {
309
- const i = this.extractMessage(e);
294
+ const r = this.extractMessage(e);
310
295
  switch (process.env.NODE_ENV !== "production" && console.error(`[${t}]`, e), s) {
311
296
  case "throw":
312
297
  throw e;
@@ -315,7 +300,7 @@ class F {
315
300
  case "convert":
316
301
  return {
317
302
  code: "validator_error",
318
- message: i,
303
+ message: r,
319
304
  params: { field: t }
320
305
  };
321
306
  }
@@ -397,7 +382,7 @@ class F {
397
382
  return typeof e == "object" && e !== null && "code" in e && "message" in e && typeof e.code == "string" && typeof e.message == "string";
398
383
  }
399
384
  }
400
- class te {
385
+ class ie {
401
386
  /** Внутренний сигнал статуса */
402
387
  _status;
403
388
  /** Публичный read-only сигнал статуса */
@@ -414,7 +399,7 @@ class te {
414
399
  * @param initial - Начальный статус (по умолчанию 'valid')
415
400
  */
416
401
  constructor(e = "valid") {
417
- this._status = g(e), this.status = c(() => this._status.value), this.valid = c(() => this._status.value === "valid"), this.invalid = c(() => this._status.value === "invalid"), this.pending = c(() => this._status.value === "pending"), this.disabled = c(() => this._status.value === "disabled");
402
+ this._status = g(e), this.status = f(() => this._status.value), this.valid = f(() => this._status.value === "valid"), this.invalid = f(() => this._status.value === "invalid"), this.pending = f(() => this._status.value === "pending"), this.disabled = f(() => this._status.value === "disabled");
418
403
  }
419
404
  /**
420
405
  * Начать валидацию
@@ -496,53 +481,8 @@ class te {
496
481
  enable(e = !1) {
497
482
  this._status.value = e ? "invalid" : "valid";
498
483
  }
499
- /**
500
- * Обработать событие (альтернативный API)
501
- *
502
- * @param event - Событие для обработки
503
- *
504
- * @example
505
- * ```typescript
506
- * statusMachine.dispatch({ type: 'START_VALIDATION' });
507
- * statusMachine.dispatch({ type: 'VALIDATION_FAILURE' });
508
- * ```
509
- */
510
- dispatch(e) {
511
- switch (e.type) {
512
- case "START_VALIDATION":
513
- this.startValidation();
514
- break;
515
- case "VALIDATION_SUCCESS":
516
- this.completeValidation(!1);
517
- break;
518
- case "VALIDATION_FAILURE":
519
- this.completeValidation(!0);
520
- break;
521
- case "DISABLE":
522
- this.disable();
523
- break;
524
- case "ENABLE":
525
- this.enable(e.hasErrors);
526
- break;
527
- case "SET_ERRORS":
528
- this.setErrors(e.hasErrors);
529
- break;
530
- }
531
- }
532
- /**
533
- * Получить текущий статус
534
- */
535
- getStatus() {
536
- return this._status.value;
537
- }
538
- /**
539
- * Проверить, можно ли начать валидацию
540
- */
541
- canValidate() {
542
- return this._status.value !== "disabled";
543
- }
544
484
  }
545
- class se extends M {
485
+ class ne extends M {
546
486
  // ============================================================================
547
487
  // Приватные сигналы
548
488
  // ============================================================================
@@ -594,13 +534,13 @@ class se extends M {
594
534
  * Менеджер подписок для централизованного cleanup
595
535
  * Использует SubscriptionManager вместо массива для управления подписками
596
536
  */
597
- disposers = new D();
537
+ disposers = new I();
598
538
  component;
599
539
  // ============================================================================
600
540
  // Конструктор
601
541
  // ============================================================================
602
542
  constructor(e) {
603
- super(), this.validators = e.validators || [], this.asyncValidators = e.asyncValidators || [], this.updateOn = e.updateOn || "blur", this.debounceMs = e.debounce || 0, this.component = e.component, this._value = e.valueSignal ?? g(e.value), this.initialValue = this._value.peek(), this._errors = g([]), this._componentProps = g(e.componentProps || {}), this.statusMachine = new te(e.disabled ? "disabled" : "valid"), this.value = c(() => this._value.value), this.valid = c(() => this.statusMachine.valid.value), this.invalid = c(() => this.statusMachine.invalid.value), this.pending = c(() => this.statusMachine.pending.value), this.status = c(() => this.statusMachine.status.value), this.disabled = c(() => this.statusMachine.disabled.value), this.errors = c(() => this._errors.value), this.componentProps = c(() => this._componentProps.value), this.shouldShowError = c(
543
+ super(), this.validators = e.validators || [], this.asyncValidators = e.asyncValidators || [], this.updateOn = e.updateOn || "blur", this.debounceMs = e.debounce || 0, this.component = e.component, this._value = e.valueSignal ?? g(e.value), this.initialValue = this._value.peek(), this._errors = g([]), this._componentProps = g(e.componentProps || {}), this.statusMachine = new ie(e.disabled ? "disabled" : "valid"), this.value = f(() => this._value.value), this.valid = f(() => this.statusMachine.valid.value), this.invalid = f(() => this.statusMachine.invalid.value), this.pending = f(() => this.statusMachine.pending.value), this.status = f(() => this.statusMachine.status.value), this.disabled = f(() => this.statusMachine.disabled.value), this.errors = f(() => this._errors.value), this.componentProps = f(() => this._componentProps.value), this.shouldShowError = f(
604
544
  () => this.statusMachine.invalid.value && (this._touched.value || this._dirty.value)
605
545
  );
606
546
  }
@@ -613,12 +553,12 @@ class se extends M {
613
553
  setValue(e, t) {
614
554
  if (this._value.value = e, this._dirty.value = !0, t?.emitEvent === !1)
615
555
  return;
616
- const s = this.validators.length > 0 || this.asyncValidators.length > 0, i = this._errors.value.length > 0;
556
+ const s = this.validators.length > 0 || this.asyncValidators.length > 0, r = this._errors.value.length > 0;
617
557
  if (this.updateOn === "change") {
618
558
  this.validate();
619
559
  return;
620
560
  }
621
- i && s && this.validate();
561
+ r && s && this.validate();
622
562
  }
623
563
  patchValue(e) {
624
564
  this.setValue(e);
@@ -712,19 +652,19 @@ class se extends M {
712
652
  if (this.cancelPendingValidation(), t <= 0 || this.asyncValidators.length === 0)
713
653
  return this.validateImmediate();
714
654
  const s = new AbortController();
715
- return new Promise((i) => {
716
- this.pendingValidation = { resolve: i, abortController: s }, this.validateDebounceTimer = setTimeout(async () => {
655
+ return new Promise((r) => {
656
+ this.pendingValidation = { resolve: r, abortController: s }, this.validateDebounceTimer = setTimeout(async () => {
717
657
  if (this.validateDebounceTimer = void 0, s.signal.aborted) {
718
- i(!1);
658
+ r(!1);
719
659
  return;
720
660
  }
721
661
  this.pendingValidation = void 0;
722
- const a = await this.validateImmediate(s);
723
- i(a);
662
+ const n = await this.validateImmediate(s);
663
+ r(n);
724
664
  }, t), s.signal.addEventListener(
725
665
  "abort",
726
666
  () => {
727
- this.validateDebounceTimer && (clearTimeout(this.validateDebounceTimer), this.validateDebounceTimer = void 0), i(!1);
667
+ this.validateDebounceTimer && (clearTimeout(this.validateDebounceTimer), this.validateDebounceTimer = void 0), r(!1);
728
668
  },
729
669
  { once: !0 }
730
670
  );
@@ -743,17 +683,17 @@ class se extends M {
743
683
  async validateImmediate(e) {
744
684
  const t = e ?? new AbortController();
745
685
  e || this.currentAbortController?.abort(), this.currentAbortController = t;
746
- const { signal: s } = t, i = [];
747
- for (const n of this.validators) {
748
- const l = n(this._value.value);
749
- l && i.push(l);
686
+ const { signal: s } = t, r = [];
687
+ for (const a of this.validators) {
688
+ const l = a(this._value.value);
689
+ l && r.push(l);
750
690
  }
751
691
  if (s.aborted)
752
692
  return !1;
753
- if (i.length > 0) {
754
- this._errors.value = i;
755
- const n = i.some((l) => l.severity !== "warning");
756
- if (this.statusMachine.setErrors(n), n)
693
+ if (r.length > 0) {
694
+ this._errors.value = r;
695
+ const a = r.some((l) => l.severity !== "warning");
696
+ if (this.statusMachine.setErrors(a), a)
757
697
  return !1;
758
698
  }
759
699
  if (this.asyncValidators.length > 0) {
@@ -761,19 +701,19 @@ class se extends M {
761
701
  return !1;
762
702
  this.statusMachine.startValidation();
763
703
  try {
764
- const n = await Promise.all(
765
- this.asyncValidators.map(async (h) => {
704
+ const a = await Promise.all(
705
+ this.asyncValidators.map(async (d) => {
766
706
  if (s.aborted)
767
707
  throw new DOMException("Validation aborted", "AbortError");
768
708
  try {
769
- const u = await h(this._value.value, { signal: s });
709
+ const u = await d(this._value.value, { signal: s });
770
710
  if (s.aborted)
771
711
  throw new DOMException("Validation aborted", "AbortError");
772
712
  return u;
773
713
  } catch (u) {
774
714
  if (u instanceof DOMException && u.name === "AbortError")
775
715
  throw u;
776
- return F.handle(
716
+ return k.handle(
777
717
  u,
778
718
  "FieldNode AsyncValidator",
779
719
  A.CONVERT
@@ -783,20 +723,20 @@ class se extends M {
783
723
  );
784
724
  if (s.aborted)
785
725
  return !1;
786
- const l = n.filter((h) => h !== null);
726
+ const l = a.filter((d) => d !== null);
787
727
  if (l.length > 0) {
788
728
  this._errors.value = l;
789
- const h = l.some((u) => u.severity !== "warning");
790
- if (this.statusMachine.completeValidation(h), h)
729
+ const d = l.some((u) => u.severity !== "warning");
730
+ if (this.statusMachine.completeValidation(d), d)
791
731
  return !1;
792
732
  }
793
- } catch (n) {
794
- if (n instanceof DOMException && n.name === "AbortError")
733
+ } catch (a) {
734
+ if (a instanceof DOMException && a.name === "AbortError")
795
735
  return !1;
796
- throw n;
736
+ throw a;
797
737
  }
798
738
  }
799
- return s.aborted ? !1 : ((this.validators.length > 0 || this.asyncValidators.length > 0) && (this._errors.value = [], this.statusMachine.completeValidation(!1)), !this._errors.value.some((n) => n.severity !== "warning"));
739
+ return s.aborted ? !1 : ((this.validators.length > 0 || this.asyncValidators.length > 0) && (this._errors.value = [], this.statusMachine.completeValidation(!1)), !this._errors.value.some((a) => a.severity !== "warning"));
800
740
  }
801
741
  setErrors(e) {
802
742
  this._errors.value = e;
@@ -918,10 +858,10 @@ class se extends M {
918
858
  */
919
859
  watch(e) {
920
860
  const t = new AbortController(), s = _(() => {
921
- const a = this.value.value;
922
- e(a, t.signal);
923
- }), i = V(w.Watch);
924
- return this.disposers.add(i, () => {
861
+ const n = this.value.value;
862
+ e(n, t.signal);
863
+ }), r = N(O.Watch);
864
+ return this.disposers.add(r, () => {
925
865
  t.abort(), s();
926
866
  });
927
867
  }
@@ -949,10 +889,10 @@ class se extends M {
949
889
  */
950
890
  computeFrom(e, t) {
951
891
  const s = _(() => {
952
- const a = e.map((l) => l.value), n = t(...a);
953
- this.setValue(n, { emitEvent: !1 });
954
- }), i = V(w.ComputeFrom);
955
- return this.disposers.add(i, s);
892
+ const n = e.map((l) => l.value), a = t(...n);
893
+ this.setValue(a, { emitEvent: !1 });
894
+ }), r = N(O.ComputeFrom);
895
+ return this.disposers.add(r, s);
956
896
  }
957
897
  /**
958
898
  * Очистить все ресурсы и таймеры
@@ -982,59 +922,59 @@ class se extends M {
982
922
  }
983
923
  }
984
924
  }
985
- function I(r) {
986
- const { getChildren: e, ownErrors: t, disabled: s } = r, i = c(() => t.value.length > 0 ? !1 : e().every((o) => o.disabled.value || o.valid.value)), a = c(() => !i.value), n = c(() => e().some((o) => o.pending.value)), l = c(() => e().some((o) => o.touched.value)), h = c(() => e().some((o) => o.dirty.value)), u = c(() => {
925
+ function L(i) {
926
+ const { getChildren: e, ownErrors: t, disabled: s } = i, r = f(() => t.value.length > 0 ? !1 : e().every((o) => o.disabled.value || o.valid.value)), n = f(() => !r.value), a = f(() => e().some((o) => o.pending.value)), l = f(() => e().some((o) => o.touched.value)), d = f(() => e().some((o) => o.dirty.value)), u = f(() => {
987
927
  const o = [...t.value];
988
- for (const p of e())
989
- o.push(...p.errors.value);
928
+ for (const m of e())
929
+ o.push(...m.errors.value);
990
930
  return o;
991
- }), v = c(() => s?.value ? "disabled" : n.value ? "pending" : a.value ? "invalid" : "valid");
931
+ }), v = f(() => s?.value ? "disabled" : a.value ? "pending" : n.value ? "invalid" : "valid");
992
932
  return {
993
- valid: i,
994
- invalid: a,
995
- pending: n,
933
+ valid: r,
934
+ invalid: n,
935
+ pending: a,
996
936
  touched: l,
997
- dirty: h,
937
+ dirty: d,
998
938
  errors: u,
999
939
  status: v
1000
940
  };
1001
941
  }
1002
- function G(r) {
1003
- return typeof r == "object" && r !== null && "getProxy" in r && typeof r.getProxy == "function";
942
+ function j(i) {
943
+ return typeof i == "object" && i !== null && "getProxy" in i && typeof i.getProxy == "function";
1004
944
  }
1005
- const j = "$";
1006
- function ie(r, e) {
945
+ const U = "$";
946
+ function ae(i, e) {
1007
947
  let t;
1008
948
  const s = () => {
1009
949
  if (!t) {
1010
- const i = {};
1011
- e.forEach((a, n) => {
1012
- i[n] = a && G(a) ? a.getProxy() : a;
1013
- }), t = i;
950
+ const r = {};
951
+ e.forEach((n, a) => {
952
+ r[a] = n && j(n) ? n.getProxy() : n;
953
+ }), t = r;
1014
954
  }
1015
955
  return t;
1016
956
  };
1017
- return new Proxy(r, {
1018
- get: (i, a) => {
1019
- if (a === j)
957
+ return new Proxy(i, {
958
+ get: (r, n) => {
959
+ if (n === U)
1020
960
  return s();
1021
- if (a in i)
1022
- return i[a];
1023
- if (typeof a == "string" && e.has(a)) {
1024
- const n = e.get(a);
1025
- return n && G(n) ? n.getProxy() : n;
961
+ if (n in r)
962
+ return r[n];
963
+ if (typeof n == "string" && e.has(n)) {
964
+ const a = e.get(n);
965
+ return a && j(a) ? a.getProxy() : a;
1026
966
  }
1027
967
  },
1028
- set: (i, a, n) => typeof a == "string" && e.has(a) ? !1 : (i[a] = n, !0),
1029
- has: (i, a) => a === j || typeof a == "string" && e.has(a) ? !0 : a in i,
1030
- ownKeys: (i) => {
1031
- const a = Reflect.ownKeys(i), n = Array.from(e.keys());
1032
- return [.../* @__PURE__ */ new Set([...a, ...n])];
968
+ set: (r, n, a) => typeof n == "string" && e.has(n) ? !1 : (r[n] = a, !0),
969
+ has: (r, n) => n === U || typeof n == "string" && e.has(n) ? !0 : n in r,
970
+ ownKeys: (r) => {
971
+ const n = Reflect.ownKeys(r), a = Array.from(e.keys());
972
+ return [.../* @__PURE__ */ new Set([...n, ...a])];
1033
973
  },
1034
- getOwnPropertyDescriptor: (i, a) => typeof a == "string" && e.has(a) ? { enumerable: !0, configurable: !0 } : Reflect.getOwnPropertyDescriptor(i, a)
974
+ getOwnPropertyDescriptor: (r, n) => typeof n == "string" && e.has(n) ? { enumerable: !0, configurable: !0 } : Reflect.getOwnPropertyDescriptor(r, n)
1035
975
  });
1036
976
  }
1037
- class re {
977
+ class oe {
1038
978
  /**
1039
979
  * @param form - Форма для отправки
1040
980
  */
@@ -1044,7 +984,7 @@ class re {
1044
984
  /** Внутренний сигнал состояния отправки */
1045
985
  _submitting = g(!1);
1046
986
  /** Публичный read-only сигнал состояния отправки */
1047
- submitting = c(() => this._submitting.value);
987
+ submitting = f(() => this._submitting.value);
1048
988
  /**
1049
989
  * Отправить форму
1050
990
  *
@@ -1079,8 +1019,8 @@ class re {
1079
1019
  * ```
1080
1020
  */
1081
1021
  async submit(e, t) {
1082
- const { skipValidation: s = !1, skipTouch: i = !1 } = t || {};
1083
- if (i || this.form.markAsTouched(), !s && !await this.form.validate())
1022
+ const { skipValidation: s = !1, skipTouch: r = !1 } = t || {};
1023
+ if (r || this.form.markAsTouched(), !s && !await this.form.validate())
1084
1024
  return null;
1085
1025
  this._submitting.value = !0;
1086
1026
  try {
@@ -1114,32 +1054,26 @@ class re {
1114
1054
  * ```
1115
1055
  */
1116
1056
  async submitWithResult(e, t) {
1117
- const { skipValidation: s = !1, skipTouch: i = !1 } = t || {};
1118
- if (i || this.form.markAsTouched(), !s && !await this.form.validate())
1057
+ const { skipValidation: s = !1, skipTouch: r = !1 } = t || {};
1058
+ if (r || this.form.markAsTouched(), !s && !await this.form.validate())
1119
1059
  return { success: !1, data: null };
1120
1060
  this._submitting.value = !0;
1121
1061
  try {
1122
1062
  return { success: !0, data: await e(this.form.getValue()) };
1123
- } catch (a) {
1063
+ } catch (n) {
1124
1064
  return {
1125
1065
  success: !1,
1126
1066
  data: null,
1127
- error: a instanceof Error ? a : new Error(String(a))
1067
+ error: n instanceof Error ? n : new Error(String(n))
1128
1068
  };
1129
1069
  } finally {
1130
1070
  this._submitting.value = !1;
1131
1071
  }
1132
1072
  }
1133
- /**
1134
- * Проверить, идет ли отправка формы
1135
- */
1136
- isSubmitting() {
1137
- return this._submitting.value;
1138
- }
1139
1073
  }
1140
- function ae(r) {
1074
+ function le(i) {
1141
1075
  const e = [];
1142
- for (const t of r.split(".")) {
1076
+ for (const t of i.split(".")) {
1143
1077
  const s = /^([^[\]]+)(?:\[(\d+)\])?$/.exec(t);
1144
1078
  if (!s) return [];
1145
1079
  e.push(s[2] !== void 0 ? { key: s[1], index: Number(s[2]) } : { key: s[1] });
@@ -1159,7 +1093,7 @@ class S extends M {
1159
1093
  /**
1160
1094
  * Менеджер подписок для централизованного cleanup
1161
1095
  */
1162
- disposers = new D();
1096
+ disposers = new I();
1163
1097
  /**
1164
1098
  * Ссылка на Proxy-инстанс
1165
1099
  */
@@ -1171,7 +1105,7 @@ class S extends M {
1171
1105
  /**
1172
1106
  * Фабрика для создания узлов формы
1173
1107
  */
1174
- nodeFactory = new ne();
1108
+ nodeFactory = new ue();
1175
1109
  // ============================================================================
1176
1110
  // Приватные сигналы состояния (inline из StateManager)
1177
1111
  // ============================================================================
@@ -1202,24 +1136,24 @@ class S extends M {
1202
1136
  status;
1203
1137
  submitting;
1204
1138
  constructor(e) {
1205
- super(), this.formSubmitter = new re(this);
1206
- const t = e.form, s = t != null && typeof t == "object" && ("valueSignal" in t || "value" in t), a = "form" in e && !s ? e.form : e;
1207
- for (const [l, h] of Object.entries(a)) {
1208
- const u = this.createNode(h);
1139
+ super(), this.formSubmitter = new oe(this);
1140
+ const t = e.form, s = t != null && typeof t == "object" && ("valueSignal" in t || "value" in t), n = "form" in e && !s ? e.form : e;
1141
+ for (const [l, d] of Object.entries(n)) {
1142
+ const u = this.createNode(d);
1209
1143
  this._fields.set(l, u);
1210
1144
  }
1211
- this.value = c(() => {
1145
+ this.value = f(() => {
1212
1146
  const l = {};
1213
- return this._fields.forEach((h, u) => {
1214
- l[u] = h.value.value;
1147
+ return this._fields.forEach((d, u) => {
1148
+ l[u] = d.value.value;
1215
1149
  }), l;
1216
1150
  });
1217
- const n = I({
1151
+ const a = L({
1218
1152
  getChildren: () => Array.from(this._fields.values()),
1219
1153
  ownErrors: this._formErrors,
1220
1154
  disabled: this._disabled
1221
1155
  });
1222
- this.valid = n.valid, this.invalid = n.invalid, this.pending = n.pending, this.touched = n.touched, this.dirty = n.dirty, this.errors = n.errors, this.status = n.status, this.submitting = this.formSubmitter.submitting;
1156
+ this.valid = a.valid, this.invalid = a.invalid, this.pending = a.pending, this.touched = a.touched, this.dirty = a.dirty, this.errors = a.errors, this.status = a.status, this.submitting = this.formSubmitter.submitting;
1223
1157
  }
1224
1158
  // ============================================================================
1225
1159
  // Приватный метод для создания Proxy
@@ -1229,7 +1163,7 @@ class S extends M {
1229
1163
  * @see buildFormProxy
1230
1164
  */
1231
1165
  buildProxy() {
1232
- return ie(this, this._fields);
1166
+ return ae(this, this._fields);
1233
1167
  }
1234
1168
  // ============================================================================
1235
1169
  // Реализация абстрактных методов FormNode
@@ -1241,23 +1175,23 @@ class S extends M {
1241
1175
  }), e;
1242
1176
  }
1243
1177
  setValue(e, t) {
1244
- for (const [s, i] of Object.entries(e)) {
1245
- const a = this._fields.get(s);
1246
- if (a) {
1247
- const n = this._fieldSignals.get(a) ?? a.value;
1248
- if (B(n)) continue;
1249
- a.setValue(i, t);
1178
+ for (const [s, r] of Object.entries(e)) {
1179
+ const n = this._fields.get(s);
1180
+ if (n) {
1181
+ const a = this._fieldSignals.get(n) ?? n.value;
1182
+ if ($(a)) continue;
1183
+ n.setValue(r, t);
1250
1184
  }
1251
1185
  }
1252
1186
  }
1253
1187
  patchValue(e) {
1254
1188
  X(() => {
1255
1189
  for (const [t, s] of Object.entries(e)) {
1256
- const i = this._fields.get(t);
1257
- if (i && s !== void 0) {
1258
- const a = this._fieldSignals.get(i) ?? i.value;
1259
- if (B(a)) continue;
1260
- i.setValue(s, { emitEvent: !1 });
1190
+ const r = this._fields.get(t);
1191
+ if (r && s !== void 0) {
1192
+ const n = this._fieldSignals.get(r) ?? r.value;
1193
+ if ($(n)) continue;
1194
+ r.setValue(s, { emitEvent: !1 });
1261
1195
  }
1262
1196
  }
1263
1197
  });
@@ -1281,8 +1215,8 @@ class S extends M {
1281
1215
  */
1282
1216
  reset(e) {
1283
1217
  this._formErrors.value = [], this._fields.forEach((t, s) => {
1284
- const i = e?.[s];
1285
- t.reset(i);
1218
+ const r = e?.[s];
1219
+ t.reset(r);
1286
1220
  });
1287
1221
  }
1288
1222
  /**
@@ -1329,10 +1263,6 @@ class S extends M {
1329
1263
  * - form.email вместо form.fields.get('email')
1330
1264
  * - form.address.city вместо form.fields.get('address').fields.get('city')
1331
1265
  *
1332
- * Используется в:
1333
- * - BehaviorApplicator для доступа к полям в behavior functions
1334
- * - ValidationApplicator для доступа к форме в tree validators
1335
- *
1336
1266
  * @returns Proxy-инстанс с типобезопасным доступом к полям или сама форма, если proxy не доступен
1337
1267
  *
1338
1268
  * @example
@@ -1430,17 +1360,17 @@ class S extends M {
1430
1360
  getFieldByPath(e) {
1431
1361
  if (e.startsWith(".") || e.endsWith("."))
1432
1362
  return;
1433
- const t = ae(e);
1363
+ const t = le(e);
1434
1364
  if (t.length === 0)
1435
1365
  return;
1436
1366
  let s = this;
1437
- for (const i of t) {
1438
- if (!(s instanceof S) || (s = s.getField(i.key), !s)) return;
1439
- if (i.index !== void 0)
1367
+ for (const r of t) {
1368
+ if (!(s instanceof S) || (s = s.getField(r.key), !s)) return;
1369
+ if (r.index !== void 0)
1440
1370
  if ("at" in s && "length" in s && typeof s.at == "function") {
1441
- const a = s.at(i.index);
1442
- if (!a) return;
1443
- s = a;
1371
+ const n = s.at(r.index);
1372
+ if (!n) return;
1373
+ s = n;
1444
1374
  } else
1445
1375
  return;
1446
1376
  }
@@ -1474,16 +1404,16 @@ class S extends M {
1474
1404
  * Связывает два поля: при изменении source автоматически обновляется target
1475
1405
  */
1476
1406
  linkFields(e, t, s) {
1477
- const i = this._fields.get(e), a = this._fields.get(t);
1478
- if (!i || !a) {
1479
- const h = i ? t : e;
1480
- throw new Error(`GroupNode.linkFields: field "${String(h)}" not found`);
1407
+ const r = this._fields.get(e), n = this._fields.get(t);
1408
+ if (!r || !n) {
1409
+ const d = r ? t : e;
1410
+ throw new Error(`GroupNode.linkFields: field "${String(d)}" not found`);
1481
1411
  }
1482
- const n = _(() => {
1483
- const h = i.value.value, u = s ? s(h) : h;
1484
- a.setValue(u, { emitEvent: !1 });
1485
- }), l = V(w.LinkFields);
1486
- return this.disposers.add(l, n);
1412
+ const a = _(() => {
1413
+ const d = r.value.value, u = s ? s(d) : d;
1414
+ n.setValue(u, { emitEvent: !1 });
1415
+ }), l = N(O.LinkFields);
1416
+ return this.disposers.add(l, a);
1487
1417
  }
1488
1418
  /**
1489
1419
  * Подписка на изменения вложенного поля по строковому пути
@@ -1517,10 +1447,10 @@ class S extends M {
1517
1447
  const s = this.getFieldByPath(e);
1518
1448
  if (!s)
1519
1449
  throw new Error(`GroupNode.watchField: field "${e}" not found`);
1520
- const i = _(() => {
1450
+ const r = _(() => {
1521
1451
  t(s.value.value);
1522
- }), a = V(w.WatchField);
1523
- return this.disposers.add(a, i);
1452
+ }), n = N(O.WatchField);
1453
+ return this.disposers.add(n, r);
1524
1454
  }
1525
1455
  /**
1526
1456
  * Подписка на вложенное поле по строковому пути ("address.city").
@@ -1530,10 +1460,10 @@ class S extends M {
1530
1460
  const s = this.getFieldByPath(e);
1531
1461
  if (!s)
1532
1462
  throw new Error(`GroupNode.watchFieldByPath: field "${e}" not found`);
1533
- const i = _(() => {
1463
+ const r = _(() => {
1534
1464
  t(s.value.value);
1535
- }), a = V(w.WatchField);
1536
- return this.disposers.add(a, i);
1465
+ }), n = N(O.WatchField);
1466
+ return this.disposers.add(n, r);
1537
1467
  }
1538
1468
  /**
1539
1469
  * Hook: вызывается после disable()
@@ -1572,7 +1502,7 @@ class S extends M {
1572
1502
  });
1573
1503
  }
1574
1504
  }
1575
- class U extends M {
1505
+ class B extends M {
1576
1506
  // ============================================================================
1577
1507
  // Приватные поля
1578
1508
  // ============================================================================
@@ -1583,15 +1513,10 @@ class U extends M {
1583
1513
  * Менеджер подписок для централизованного cleanup
1584
1514
  * Использует SubscriptionManager вместо массива для управления подписками
1585
1515
  */
1586
- disposers = new D();
1516
+ disposers = new I();
1587
1517
  /** Array-level validation errors (e.g., "минимум 1 элемент") */
1588
1518
  _arrayErrors = g([]);
1589
1519
  // ============================================================================
1590
- // Приватные поля для сохранения схем
1591
- // ============================================================================
1592
- validationSchemaFn;
1593
- behaviorSchemaFn;
1594
- // ============================================================================
1595
1520
  // Публичные computed signals
1596
1521
  // ============================================================================
1597
1522
  value;
@@ -1608,10 +1533,10 @@ class U extends M {
1608
1533
  // ============================================================================
1609
1534
  constructor(e, t = []) {
1610
1535
  super(), this.itemSchema = e, this.initialItems = t, this.items = g([]);
1611
- for (const i of t)
1612
- this.push(i);
1613
- this.length = c(() => this.items.value.length), this.value = c(() => this.items.value.map((i) => i.value.value));
1614
- const s = I({
1536
+ for (const r of t)
1537
+ this.push(r);
1538
+ this.length = f(() => this.items.value.length), this.value = f(() => this.items.value.map((r) => r.value.value));
1539
+ const s = L({
1615
1540
  getChildren: () => this.items.value,
1616
1541
  ownErrors: this._arrayErrors
1617
1542
  });
@@ -1637,7 +1562,7 @@ class U extends M {
1637
1562
  */
1638
1563
  removeAt(e) {
1639
1564
  if (e < 0 || e >= this.items.value.length) {
1640
- F.handle(
1565
+ k.handle(
1641
1566
  new Error(
1642
1567
  `ArrayNode.removeAt: index ${e} out of bounds (length: ${this.items.value.length})`
1643
1568
  ),
@@ -1647,7 +1572,7 @@ class U extends M {
1647
1572
  return;
1648
1573
  }
1649
1574
  const t = this.items.value[e];
1650
- this.items.value = this.items.value.filter((s, i) => i !== e), t && "dispose" in t && typeof t.dispose == "function" && t.dispose();
1575
+ this.items.value = this.items.value.filter((s, r) => r !== e), t && "dispose" in t && typeof t.dispose == "function" && t.dispose();
1651
1576
  }
1652
1577
  /**
1653
1578
  * Вставить элемент в массив
@@ -1656,7 +1581,7 @@ class U extends M {
1656
1581
  */
1657
1582
  insert(e, t) {
1658
1583
  if (e < 0 || e > this.items.value.length) {
1659
- F.handle(
1584
+ k.handle(
1660
1585
  new Error(
1661
1586
  `ArrayNode.insert: index ${e} out of bounds (length: ${this.items.value.length})`
1662
1587
  ),
@@ -1665,8 +1590,8 @@ class U extends M {
1665
1590
  );
1666
1591
  return;
1667
1592
  }
1668
- const s = this.createItem(t), i = [...this.items.value];
1669
- i.splice(e, 0, s), this.items.value = i;
1593
+ const s = this.createItem(t), r = [...this.items.value];
1594
+ r.splice(e, 0, s), this.items.value = r;
1670
1595
  }
1671
1596
  /**
1672
1597
  * Переместить элемент массива с позиции `from` на позицию `to`
@@ -1687,7 +1612,7 @@ class U extends M {
1687
1612
  move(e, t) {
1688
1613
  const s = this.items.value.length;
1689
1614
  if (e < 0 || e >= s || t < 0 || t >= s) {
1690
- F.handle(
1615
+ k.handle(
1691
1616
  new Error(`ArrayNode.move: index out of bounds (from=${e}, to=${t}, length=${s})`),
1692
1617
  "ArrayNode.move",
1693
1618
  A.LOG
@@ -1695,8 +1620,8 @@ class U extends M {
1695
1620
  return;
1696
1621
  }
1697
1622
  if (e === t) return;
1698
- const i = [...this.items.value], [a] = i.splice(e, 1);
1699
- i.splice(t, 0, a), this.items.value = i;
1623
+ const r = [...this.items.value], [n] = r.splice(e, 1);
1624
+ r.splice(t, 0, n), this.items.value = r;
1700
1625
  }
1701
1626
  /**
1702
1627
  * Поменять местами два элемента массива
@@ -1715,7 +1640,7 @@ class U extends M {
1715
1640
  swap(e, t) {
1716
1641
  const s = this.items.value.length;
1717
1642
  if (e < 0 || e >= s || t < 0 || t >= s) {
1718
- F.handle(
1643
+ k.handle(
1719
1644
  new Error(`ArrayNode.swap: index out of bounds (a=${e}, b=${t}, length=${s})`),
1720
1645
  "ArrayNode.swap",
1721
1646
  A.LOG
@@ -1723,8 +1648,8 @@ class U extends M {
1723
1648
  return;
1724
1649
  }
1725
1650
  if (e === t) return;
1726
- const i = [...this.items.value];
1727
- [i[e], i[t]] = [i[t], i[e]], this.items.value = i;
1651
+ const r = [...this.items.value];
1652
+ [r[e], r[t]] = [r[t], r[e]], this.items.value = r;
1728
1653
  }
1729
1654
  /**
1730
1655
  * Удалить все элементы массива
@@ -1756,7 +1681,7 @@ class U extends M {
1756
1681
  }
1757
1682
  setValue(e, t) {
1758
1683
  this.clear(), e.forEach((s) => this.push(s)), t?.emitEvent !== !1 && this.validate().catch((s) => {
1759
- F.handle(s, "ArrayNode.setValue", A.LOG);
1684
+ k.handle(s, "ArrayNode.setValue", A.LOG);
1760
1685
  });
1761
1686
  }
1762
1687
  patchValue(e) {
@@ -1890,8 +1815,8 @@ class U extends M {
1890
1815
  */
1891
1816
  forEach(e) {
1892
1817
  this.items.value.forEach((t, s) => {
1893
- const i = t.getProxy();
1894
- e(i, s);
1818
+ const r = t.getProxy();
1819
+ e(r, s);
1895
1820
  });
1896
1821
  }
1897
1822
  /**
@@ -1901,8 +1826,8 @@ class U extends M {
1901
1826
  */
1902
1827
  map(e) {
1903
1828
  return this.items.value.map((t, s) => {
1904
- const i = t.getProxy();
1905
- return e(i, s);
1829
+ const r = t.getProxy();
1830
+ return e(r, s);
1906
1831
  });
1907
1832
  }
1908
1833
  // ============================================================================
@@ -1915,7 +1840,7 @@ class U extends M {
1915
1840
  createItem(e) {
1916
1841
  if (this.isGroupSchema(this.itemSchema)) {
1917
1842
  const t = new S(this.itemSchema);
1918
- return e && t.patchValue(e), this.validationSchemaFn && "applyValidationSchema" in t && t.applyValidationSchema(this.validationSchemaFn), this.behaviorSchemaFn && "applyBehaviorSchema" in t && t.applyBehaviorSchema(this.behaviorSchemaFn), t;
1843
+ return e && t.patchValue(e), t;
1919
1844
  }
1920
1845
  throw new Error(
1921
1846
  "ArrayNode поддерживает только GroupNode элементы. Для массива примитивов используйте обычное поле с типом массива."
@@ -1929,116 +1854,8 @@ class U extends M {
1929
1854
  return typeof e == "object" && e !== null && !("component" in e) && !Array.isArray(e);
1930
1855
  }
1931
1856
  // ============================================================================
1932
- // Validation Schema
1933
- // ============================================================================
1934
- /**
1935
- * Применить validation schema ко всем элементам массива
1936
- *
1937
- * Validation schema будет применена к:
1938
- * - Всем существующим элементам
1939
- * - Всем новым элементам, добавляемым через push/insert
1940
- *
1941
- * @param schemaFn - Функция валидации для элемента массива
1942
- *
1943
- * @example
1944
- * ```typescript
1945
- * import { propertyValidation } from './validation/property-validation';
1946
- *
1947
- * form.properties.applyValidationSchema(propertyValidation);
1948
- * ```
1949
- */
1950
- applyValidationSchema(e) {
1951
- this.validationSchemaFn = e, this.items.value.forEach((t) => {
1952
- "applyValidationSchema" in t && typeof t.applyValidationSchema == "function" && t.applyValidationSchema(e);
1953
- });
1954
- }
1955
- /**
1956
- * Применить behavior schema ко всем элементам ArrayNode
1957
- *
1958
- * Автоматически применяется к новым элементам при push/insert.
1959
- *
1960
- * @param schemaFn - Behavior schema функция
1961
- *
1962
- * @example
1963
- * ```typescript
1964
- * import { addressBehavior } from './behaviors/address-behavior';
1965
- *
1966
- * form.addresses.applyBehaviorSchema(addressBehavior);
1967
- * ```
1968
- */
1969
- applyBehaviorSchema(e) {
1970
- this.behaviorSchemaFn = e, this.items.value.forEach((t) => {
1971
- "applyBehaviorSchema" in t && typeof t.applyBehaviorSchema == "function" && t.applyBehaviorSchema(e);
1972
- });
1973
- }
1974
- // ============================================================================
1975
1857
  // Методы-помощники для реактивности (Фаза 1)
1976
1858
  // ============================================================================
1977
- /**
1978
- * Подписка на изменения конкретного поля во всех элементах массива
1979
- * Срабатывает при изменении значения поля в любом элементе
1980
- *
1981
- * @param fieldKey - Ключ поля для отслеживания
1982
- * @param callback - Функция, вызываемая при изменении, получает массив всех значений и индекс измененного элемента
1983
- * @returns Функция отписки для cleanup
1984
- *
1985
- * @example
1986
- * ```typescript
1987
- * // Автоматический пересчет общей стоимости при изменении цен
1988
- * const dispose = form.existingLoans.watchItems(
1989
- * 'remainingAmount',
1990
- * (amounts) => {
1991
- * const totalDebt = amounts.reduce((sum, amount) => sum + (amount || 0), 0);
1992
- * form.totalDebt.setValue(totalDebt);
1993
- * }
1994
- * );
1995
- *
1996
- * // При изменении любого remainingAmount → пересчитается totalDebt
1997
- * form.existingLoans.at(0)?.remainingAmount.setValue(500000);
1998
- *
1999
- * // Cleanup
2000
- * useEffect(() => dispose, []);
2001
- * ```
2002
- */
2003
- watchItems(e, t) {
2004
- const s = _(() => {
2005
- const a = this.items.value.map((n) => {
2006
- if (n instanceof S)
2007
- return n.getFieldByPath(e)?.value.value;
2008
- });
2009
- t(a);
2010
- }), i = V(w.WatchItems);
2011
- return this.disposers.add(i, s);
2012
- }
2013
- /**
2014
- * Подписка на изменение длины массива
2015
- * Срабатывает при добавлении/удалении элементов
2016
- *
2017
- * @param callback - Функция, вызываемая при изменении длины, получает новую длину
2018
- * @returns Функция отписки для cleanup
2019
- *
2020
- * @example
2021
- * ```typescript
2022
- * // Обновление счетчика элементов в UI
2023
- * const dispose = form.properties.watchLength((length) => {
2024
- * console.log(`Количество объектов недвижимости: ${length}`);
2025
- * form.propertyCount.setValue(length);
2026
- * });
2027
- *
2028
- * form.properties.push({ title: 'Квартира', value: 5000000 });
2029
- * // Выведет: "Количество объектов недвижимости: 1"
2030
- *
2031
- * // Cleanup
2032
- * useEffect(() => dispose, []);
2033
- * ```
2034
- */
2035
- watchLength(e) {
2036
- const t = _(() => {
2037
- const i = this.length.value;
2038
- e(i);
2039
- }), s = V(w.WatchLength);
2040
- return this.disposers.add(s, t);
2041
- }
2042
1859
  /**
2043
1860
  * Очистить все ресурсы узла
2044
1861
  * Рекурсивно очищает все subscriptions и элементы массива
@@ -2100,7 +1917,7 @@ class U extends M {
2100
1917
  });
2101
1918
  }
2102
1919
  }
2103
- class ne {
1920
+ class ue {
2104
1921
  /**
2105
1922
  * Создает узел формы на основе конфигурации
2106
1923
  *
@@ -2150,9 +1967,9 @@ class ne {
2150
1967
  if (Array.isArray(e) && e.length >= 1)
2151
1968
  return this.createArrayNodeFromArray(e);
2152
1969
  if (this.isFieldConfig(e))
2153
- return new se(e);
1970
+ return new ne(e);
2154
1971
  if (this.isArrayConfig(e))
2155
- return new U(
1972
+ return new B(
2156
1973
  e.schema,
2157
1974
  e.initialItems
2158
1975
  );
@@ -2191,11 +2008,11 @@ class ne {
2191
2008
  */
2192
2009
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2193
2010
  createArrayNodeFromArray(e) {
2194
- const [t, ...s] = e, i = [];
2195
- this.isGroupConfig(t) && i.push(this.extractValues(t));
2196
- for (const a of s)
2197
- this.isGroupConfig(a) ? i.push(this.extractValues(a)) : i.push(a);
2198
- return new U(t, i);
2011
+ const [t, ...s] = e, r = [];
2012
+ this.isGroupConfig(t) && r.push(this.extractValues(t));
2013
+ for (const n of s)
2014
+ this.isGroupConfig(n) ? r.push(this.extractValues(n)) : r.push(n);
2015
+ return new B(t, r);
2199
2016
  }
2200
2017
  /**
2201
2018
  * Извлечь значения из схемы (рекурсивно)
@@ -2233,8 +2050,8 @@ class ne {
2233
2050
  return e.map((t) => this.extractValues(t));
2234
2051
  if (this.isGroupConfig(e)) {
2235
2052
  const t = {};
2236
- for (const [s, i] of Object.entries(e))
2237
- t[s] = this.extractValues(i);
2053
+ for (const [s, r] of Object.entries(e))
2054
+ t[s] = this.extractValues(r);
2238
2055
  return t;
2239
2056
  }
2240
2057
  return e;
@@ -2314,7 +2131,7 @@ class ne {
2314
2131
  return e != null && typeof e == "object" && !this.isFieldConfig(e) && !this.isArrayConfig(e);
2315
2132
  }
2316
2133
  }
2317
- class oe extends M {
2134
+ class de extends M {
2318
2135
  /**
2319
2136
  * @param control Реактивный массив модели (`model.<path>`).
2320
2137
  * @param buildItem Строитель формы элемента по его под-модели (инъекция, чтобы избежать цикла
@@ -2322,22 +2139,22 @@ class oe extends M {
2322
2139
  */
2323
2140
  constructor(e, t) {
2324
2141
  super(), this.control = e, this.buildItem = t, this.initial = e.toArray(), this.disposeSync = _(() => {
2325
- const i = e.length, a = [], n = [];
2326
- for (let u = 0; u < i; u++) {
2142
+ const r = e.length, n = [], a = [];
2143
+ for (let u = 0; u < r; u++) {
2327
2144
  const v = e.at(u);
2328
2145
  if (!v) continue;
2329
2146
  let o = this.cache.get(v);
2330
- o || (o = t(v), this.cache.set(v, o)), a.push(v), n.push(o);
2147
+ o || (o = t(v), this.cache.set(v, o)), n.push(v), a.push(o);
2331
2148
  }
2332
- const l = new Set(a), h = [];
2149
+ const l = new Set(n), d = [];
2333
2150
  for (const u of this.mountedModels) {
2334
2151
  if (l.has(u)) continue;
2335
2152
  const v = this.cache.get(u);
2336
- this.cache.delete(u), v && h.push(v);
2153
+ this.cache.delete(u), v && d.push(v);
2337
2154
  }
2338
- this.mountedModels = a, this.itemNodes.value = n, h.forEach((u) => this.disposeItemNode(u));
2339
- }), this.length = c(() => this.itemNodes.value.length), this.value = c(() => this.itemNodes.value.map((i) => i.value.value));
2340
- const s = I({
2155
+ this.mountedModels = n, this.itemNodes.value = a, d.forEach((u) => this.disposeItemNode(u));
2156
+ }), this.length = f(() => this.itemNodes.value.length), this.value = f(() => this.itemNodes.value.map((r) => r.value.value));
2157
+ const s = L({
2341
2158
  getChildren: () => this.itemNodes.value,
2342
2159
  ownErrors: this._arrayErrors
2343
2160
  });
@@ -2476,230 +2293,228 @@ class oe extends M {
2476
2293
  this.disposeSync(), this.itemNodes.value.forEach((e) => this.disposeItemNode(e)), this.mountedModels = [];
2477
2294
  }
2478
2295
  }
2479
- const J = (r) => r !== null && typeof r == "object" && !Array.isArray(r) && !(r instanceof Date) && !(typeof Blob < "u" && r instanceof Blob) && !(typeof File < "u" && r instanceof File);
2480
- function T(r, e, t) {
2481
- if (r == null || typeof r != "object" || r instanceof $) return;
2482
- if (Array.isArray(r)) {
2483
- for (const a of r) T(a, e, t);
2296
+ const z = (i) => i !== null && typeof i == "object" && !Array.isArray(i) && !(i instanceof Date) && !(typeof Blob < "u" && i instanceof Blob) && !(typeof File < "u" && i instanceof File);
2297
+ function D(i, e, t) {
2298
+ if (i == null || typeof i != "object" || i instanceof G) return;
2299
+ if (Array.isArray(i)) {
2300
+ for (const n of i) D(n, e, t);
2484
2301
  return;
2485
2302
  }
2486
- const s = r, i = s.array;
2487
- if (i && typeof i.__path == "string" && typeof s.item == "function") {
2488
- t.set(i.__path, s.item);
2303
+ const s = i, r = s.array;
2304
+ if (r && typeof r.__path == "string" && typeof s.item == "function") {
2305
+ t.set(r.__path, s.item);
2489
2306
  return;
2490
2307
  }
2491
- s.value instanceof $ ? e.set(s.value, {
2308
+ s.value instanceof G ? e.set(s.value, {
2492
2309
  component: s.component,
2493
2310
  componentProps: s.componentProps,
2494
- validators: s.validators,
2495
- asyncValidators: s.asyncValidators,
2496
2311
  updateOn: s.updateOn,
2497
2312
  disabled: s.disabled,
2498
2313
  debounce: s.debounce
2499
2314
  }) : process.env.NODE_ENV !== "production" && s.component !== void 0 && ("valueSignal" in s || s.value != null) && console.warn(
2500
2315
  "[reformer] createForm({ schema }): узел с `component` не распознан как поле — `value` не является сигналом модели. Ожидается `value: model.$.<path>`; проверьте, что не передан `value: model.<path>` (value-прокси) или `valueSignal:`."
2501
2316
  );
2502
- for (const [a, n] of Object.entries(s))
2503
- a !== "value" && T(n, e, t);
2317
+ for (const [n, a] of Object.entries(s))
2318
+ n !== "value" && D(a, e, t);
2504
2319
  }
2505
- function Y(r, e, t, s) {
2506
- const i = {};
2507
- for (const [a, n] of Object.entries(e)) {
2508
- const l = t === "" ? a : `${t}.${a}`;
2509
- if (Array.isArray(n))
2320
+ function J(i, e, t, s) {
2321
+ const r = {};
2322
+ for (const [n, a] of Object.entries(e)) {
2323
+ const l = t === "" ? n : `${t}.${n}`;
2324
+ if (Array.isArray(a))
2510
2325
  continue;
2511
- if (J(n)) {
2512
- i[a] = Y(r, n, l, s);
2326
+ if (z(a)) {
2327
+ r[n] = J(i, a, l, s);
2513
2328
  continue;
2514
2329
  }
2515
- const h = r.signalAt(l);
2516
- if (!h) throw new Error(`createForm({ model }): не найден сигнал для пути "${l}"`);
2517
- const u = s.get(h) ?? {}, { validators: v, asyncValidators: o, ...p } = u;
2518
- i[a] = { ...p, valueSignal: h };
2330
+ const d = i.signalAt(l);
2331
+ if (!d) throw new Error(`createForm({ model }): не найден сигнал для пути "${l}"`);
2332
+ const u = s.get(d) ?? {};
2333
+ r[n] = { ...u, valueSignal: d };
2519
2334
  }
2520
- return i;
2335
+ return r;
2521
2336
  }
2522
- function z(r, e, t) {
2523
- for (const [s, i] of Object.entries(r)) {
2524
- const a = e === "" ? s : `${e}.${s}`;
2525
- Array.isArray(i) || (J(i) ? z(i, a, t) : t.push(a));
2337
+ function Y(i, e, t) {
2338
+ for (const [s, r] of Object.entries(i)) {
2339
+ const n = e === "" ? s : `${e}.${s}`;
2340
+ Array.isArray(r) || (z(r) ? Y(r, n, t) : t.push(n));
2526
2341
  }
2527
2342
  }
2528
- function Q(r) {
2529
- const { model: e, schema: t, behavior: s } = r, i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
2530
- t !== void 0 && T(t, i, a);
2531
- const n = Y(e, e.get(), "", i), l = new S(n), h = e.get();
2532
- for (const [o, p] of Object.entries(h)) {
2533
- if (!Array.isArray(p)) continue;
2534
- const d = a.get(o);
2535
- if (!d) continue;
2536
- const f = e[o], m = (y) => Q({ model: y, schema: d(y) }), b = new oe(f, m);
2537
- l.fields.set(o, b);
2343
+ function Q(i) {
2344
+ const { model: e, schema: t, behavior: s } = i, r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
2345
+ t !== void 0 && D(t, r, n);
2346
+ const a = J(e, e.get(), "", r), l = new S(a), d = e.get();
2347
+ for (const [o, m] of Object.entries(d)) {
2348
+ if (!Array.isArray(m)) continue;
2349
+ const c = n.get(o);
2350
+ if (!c) continue;
2351
+ const h = e[o], p = (y) => Q({ model: y, schema: c(y) }), E = new de(h, p);
2352
+ l.fields.set(o, E);
2538
2353
  }
2539
2354
  const u = l.getProxy(), v = [];
2540
- z(e.get(), "", v);
2355
+ Y(e.get(), "", v);
2541
2356
  for (const o of v) {
2542
- const p = e.signalAt(o), d = l.getFieldByPath(o);
2543
- if (p && d) {
2544
- Z(p, d);
2545
- const f = o.lastIndexOf("."), m = f === -1 ? l : l.getFieldByPath(o.slice(0, f));
2546
- m instanceof S && m.registerFieldSignal(d, p);
2357
+ const m = e.signalAt(o), c = l.getFieldByPath(o);
2358
+ if (m && c) {
2359
+ Z(m, c);
2360
+ const h = o.lastIndexOf("."), p = h === -1 ? l : l.getFieldByPath(o.slice(0, h));
2361
+ p instanceof S && p.registerFieldSignal(c, m);
2547
2362
  }
2548
2363
  }
2549
2364
  return s && l.attachBehaviorCleanup(s.__run(e, u)), u;
2550
2365
  }
2551
- const le = (r) => r != null && typeof r == "object" && "model" in r && typeof r.model?.signalAt == "function";
2552
- function we(r) {
2553
- return le(r) ? Q(r) : new S(r).getProxy();
2366
+ const ce = (i) => i != null && typeof i == "object" && "model" in i && typeof i.model?.signalAt == "function";
2367
+ function Ne(i) {
2368
+ return ce(i) ? Q(i) : new S(i).getProxy();
2554
2369
  }
2555
- function C(r) {
2556
- return r == null ? !1 : typeof r == "object" && "value" in r && "setValue" in r && "getValue" in r && "validate" in r;
2370
+ function x(i) {
2371
+ return i == null ? !1 : typeof i == "object" && "value" in i && "setValue" in i && "getValue" in i && "validate" in i;
2557
2372
  }
2558
- function ue(r) {
2559
- return r == null ? !1 : C(r) && "validators" in r && "asyncValidators" in r && // FieldNode имеет markAsTouched метод
2373
+ function he(i) {
2374
+ return x(i) && "validators" in i && "asyncValidators" in i && // FieldNode имеет markAsTouched метод
2560
2375
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2561
- typeof r.markAsTouched == "function" && // У FieldNode нет fields или items
2562
- !("fields" in r) && !("items" in r);
2376
+ typeof i.markAsTouched == "function" && // У FieldNode нет fields или items
2377
+ !("fields" in i) && !("items" in i);
2563
2378
  }
2564
- function de(r) {
2565
- return r == null ? !1 : C(r) && "getFieldByPath" in r && "fields" in r && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode/ModelArrayNode)
2566
- !("items" in r) && !("push" in r) && !("removeAt" in r);
2379
+ function fe(i) {
2380
+ return x(i) && "getFieldByPath" in i && "fields" in i && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode/ModelArrayNode)
2381
+ !("items" in i) && !("push" in i) && !("removeAt" in i);
2567
2382
  }
2568
- function he(r) {
2569
- return r == null ? !1 : C(r) && "items" in r && "length" in r && "push" in r && "removeAt" in r && "at" in r && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2570
- typeof r.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2571
- typeof r.removeAt == "function";
2383
+ function ve(i) {
2384
+ return x(i) && "items" in i && "length" in i && "push" in i && "removeAt" in i && "at" in i && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2385
+ typeof i.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2386
+ typeof i.removeAt == "function";
2572
2387
  }
2573
- function Ve(r) {
2574
- return ue(r) ? "FieldNode" : de(r) ? "GroupNode" : he(r) ? "ArrayNode" : C(r) ? "FormNode" : "Unknown";
2388
+ function Fe(i) {
2389
+ return he(i) ? "FieldNode" : fe(i) ? "GroupNode" : ve(i) ? "ArrayNode" : x(i) ? "FormNode" : "Unknown";
2575
2390
  }
2576
- var N = { exports: {} }, x = {};
2391
+ var F = { exports: {} }, P = {};
2577
2392
  var W;
2578
- function ce() {
2579
- if (W) return x;
2393
+ function me() {
2394
+ if (W) return P;
2580
2395
  W = 1;
2581
- var r = K;
2582
- function e(o, p) {
2583
- return o === p && (o !== 0 || 1 / o === 1 / p) || o !== o && p !== p;
2584
- }
2585
- var t = typeof Object.is == "function" ? Object.is : e, s = r.useState, i = r.useEffect, a = r.useLayoutEffect, n = r.useDebugValue;
2586
- function l(o, p) {
2587
- var d = p(), f = s({ inst: { value: d, getSnapshot: p } }), m = f[0].inst, b = f[1];
2588
- return a(
2396
+ var i = H;
2397
+ function e(o, m) {
2398
+ return o === m && (o !== 0 || 1 / o === 1 / m) || o !== o && m !== m;
2399
+ }
2400
+ var t = typeof Object.is == "function" ? Object.is : e, s = i.useState, r = i.useEffect, n = i.useLayoutEffect, a = i.useDebugValue;
2401
+ function l(o, m) {
2402
+ var c = m(), h = s({ inst: { value: c, getSnapshot: m } }), p = h[0].inst, E = h[1];
2403
+ return n(
2589
2404
  function() {
2590
- m.value = d, m.getSnapshot = p, h(m) && b({ inst: m });
2405
+ p.value = c, p.getSnapshot = m, d(p) && E({ inst: p });
2591
2406
  },
2592
- [o, d, p]
2593
- ), i(
2407
+ [o, c, m]
2408
+ ), r(
2594
2409
  function() {
2595
- return h(m) && b({ inst: m }), o(function() {
2596
- h(m) && b({ inst: m });
2410
+ return d(p) && E({ inst: p }), o(function() {
2411
+ d(p) && E({ inst: p });
2597
2412
  });
2598
2413
  },
2599
2414
  [o]
2600
- ), n(d), d;
2415
+ ), a(c), c;
2601
2416
  }
2602
- function h(o) {
2603
- var p = o.getSnapshot;
2417
+ function d(o) {
2418
+ var m = o.getSnapshot;
2604
2419
  o = o.value;
2605
2420
  try {
2606
- var d = p();
2607
- return !t(o, d);
2421
+ var c = m();
2422
+ return !t(o, c);
2608
2423
  } catch {
2609
2424
  return !0;
2610
2425
  }
2611
2426
  }
2612
- function u(o, p) {
2613
- return p();
2427
+ function u(o, m) {
2428
+ return m();
2614
2429
  }
2615
2430
  var v = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : l;
2616
- return x.useSyncExternalStore = r.useSyncExternalStore !== void 0 ? r.useSyncExternalStore : v, x;
2431
+ return P.useSyncExternalStore = i.useSyncExternalStore !== void 0 ? i.useSyncExternalStore : v, P;
2617
2432
  }
2618
- var P = {};
2433
+ var T = {};
2619
2434
  var q;
2620
- function fe() {
2435
+ function pe() {
2621
2436
  return q || (q = 1, process.env.NODE_ENV !== "production" && (function() {
2622
- function r(d, f) {
2623
- return d === f && (d !== 0 || 1 / d === 1 / f) || d !== d && f !== f;
2437
+ function i(c, h) {
2438
+ return c === h && (c !== 0 || 1 / c === 1 / h) || c !== c && h !== h;
2624
2439
  }
2625
- function e(d, f) {
2626
- v || i.startTransition === void 0 || (v = !0, console.error(
2440
+ function e(c, h) {
2441
+ v || r.startTransition === void 0 || (v = !0, console.error(
2627
2442
  "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
2628
2443
  ));
2629
- var m = f();
2444
+ var p = h();
2630
2445
  if (!o) {
2631
- var b = f();
2632
- a(m, b) || (console.error(
2446
+ var E = h();
2447
+ n(p, E) || (console.error(
2633
2448
  "The result of getSnapshot should be cached to avoid an infinite loop"
2634
2449
  ), o = !0);
2635
2450
  }
2636
- b = n({
2637
- inst: { value: m, getSnapshot: f }
2451
+ E = a({
2452
+ inst: { value: p, getSnapshot: h }
2638
2453
  });
2639
- var y = b[0].inst, k = b[1];
2640
- return h(
2454
+ var y = E[0].inst, w = E[1];
2455
+ return d(
2641
2456
  function() {
2642
- y.value = m, y.getSnapshot = f, t(y) && k({ inst: y });
2457
+ y.value = p, y.getSnapshot = h, t(y) && w({ inst: y });
2643
2458
  },
2644
- [d, m, f]
2459
+ [c, p, h]
2645
2460
  ), l(
2646
2461
  function() {
2647
- return t(y) && k({ inst: y }), d(function() {
2648
- t(y) && k({ inst: y });
2462
+ return t(y) && w({ inst: y }), c(function() {
2463
+ t(y) && w({ inst: y });
2649
2464
  });
2650
2465
  },
2651
- [d]
2652
- ), u(m), m;
2466
+ [c]
2467
+ ), u(p), p;
2653
2468
  }
2654
- function t(d) {
2655
- var f = d.getSnapshot;
2656
- d = d.value;
2469
+ function t(c) {
2470
+ var h = c.getSnapshot;
2471
+ c = c.value;
2657
2472
  try {
2658
- var m = f();
2659
- return !a(d, m);
2473
+ var p = h();
2474
+ return !n(c, p);
2660
2475
  } catch {
2661
2476
  return !0;
2662
2477
  }
2663
2478
  }
2664
- function s(d, f) {
2665
- return f();
2479
+ function s(c, h) {
2480
+ return h();
2666
2481
  }
2667
2482
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
2668
- var i = K, a = typeof Object.is == "function" ? Object.is : r, n = i.useState, l = i.useEffect, h = i.useLayoutEffect, u = i.useDebugValue, v = !1, o = !1, p = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? s : e;
2669
- P.useSyncExternalStore = i.useSyncExternalStore !== void 0 ? i.useSyncExternalStore : p, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
2670
- })()), P;
2483
+ var r = H, n = typeof Object.is == "function" ? Object.is : i, a = r.useState, l = r.useEffect, d = r.useLayoutEffect, u = r.useDebugValue, v = !1, o = !1, m = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? s : e;
2484
+ T.useSyncExternalStore = r.useSyncExternalStore !== void 0 ? r.useSyncExternalStore : m, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
2485
+ })()), T;
2671
2486
  }
2672
- var H;
2673
- function ve() {
2674
- return H || (H = 1, process.env.NODE_ENV === "production" ? N.exports = ce() : N.exports = fe()), N.exports;
2487
+ var K;
2488
+ function ye() {
2489
+ return K || (K = 1, process.env.NODE_ENV === "production" ? F.exports = me() : F.exports = pe()), F.exports;
2675
2490
  }
2676
- var L = ve();
2677
- function pe(r, e) {
2678
- if (r === e) return !0;
2679
- if (r.length !== e.length) return !1;
2680
- for (let t = 0; t < r.length; t++)
2681
- if (r[t] !== e[t]) return !1;
2491
+ var C = ye();
2492
+ function ge(i, e) {
2493
+ if (i === e) return !0;
2494
+ if (i.length !== e.length) return !1;
2495
+ for (let t = 0; t < i.length; t++)
2496
+ if (i[t] !== e[t]) return !1;
2682
2497
  return !0;
2683
2498
  }
2684
- function R(r, e, t, s) {
2685
- const i = O(null), a = O(r);
2686
- a.current = r;
2687
- const n = O(e);
2688
- n.current = e;
2689
- const l = O(t);
2690
- if (l.current = t, i.current === null) {
2499
+ function R(i, e, t, s) {
2500
+ const r = V(null), n = V(i);
2501
+ n.current = i;
2502
+ const a = V(e);
2503
+ a.current = e;
2504
+ const l = V(t);
2505
+ if (l.current = t, r.current === null) {
2691
2506
  const v = {};
2692
- for (const o in r)
2693
- v[o] = r[o].value;
2694
- i.current = { ...v, __snapshot: null };
2507
+ for (const o in i)
2508
+ v[o] = i[o].value;
2509
+ r.current = { ...v, __snapshot: null };
2695
2510
  }
2696
- const h = E(
2511
+ const d = b(
2697
2512
  (v) => {
2698
2513
  let o = !0;
2699
2514
  return _(() => {
2700
- const d = a.current;
2701
- for (const f in d)
2702
- d[f].value;
2515
+ const c = n.current;
2516
+ for (const h in c)
2517
+ c[h].value;
2703
2518
  if (o) {
2704
2519
  o = !1;
2705
2520
  return;
@@ -2708,43 +2523,43 @@ function R(r, e, t, s) {
2708
2523
  });
2709
2524
  },
2710
2525
  [s]
2711
- ), u = E(() => {
2712
- const v = i.current, o = a.current, p = {};
2713
- for (const f in o)
2714
- p[f] = o[f].value;
2715
- let d = !1;
2716
- for (const f of n.current) {
2717
- const { key: m, useShallowArrayEqual: b } = f, y = p[m], k = v[m];
2718
- if (b) {
2719
- if (!pe(k, y)) {
2720
- d = !0;
2526
+ ), u = b(() => {
2527
+ const v = r.current, o = n.current, m = {};
2528
+ for (const h in o)
2529
+ m[h] = o[h].value;
2530
+ let c = !1;
2531
+ for (const h of a.current) {
2532
+ const { key: p, useShallowArrayEqual: E } = h, y = m[p], w = v[p];
2533
+ if (E) {
2534
+ if (!ge(w, y)) {
2535
+ c = !0;
2721
2536
  break;
2722
2537
  }
2723
- } else if (k !== y) {
2724
- d = !0;
2538
+ } else if (w !== y) {
2539
+ c = !0;
2725
2540
  break;
2726
2541
  }
2727
2542
  }
2728
- if (!d && v.__snapshot)
2543
+ if (!c && v.__snapshot)
2729
2544
  return v.__snapshot;
2730
- for (const f in o)
2731
- v[f] = p[f];
2732
- return v.__snapshot = l.current(p), v.__snapshot;
2545
+ for (const h in o)
2546
+ v[h] = m[h];
2547
+ return v.__snapshot = l.current(m), v.__snapshot;
2733
2548
  }, [s]);
2734
- return L.useSyncExternalStore(h, u, u);
2549
+ return C.useSyncExternalStore(d, u, u);
2735
2550
  }
2736
- function me(r) {
2551
+ function Ee(i) {
2737
2552
  const e = {
2738
- value: r.value,
2739
- disabled: r.disabled,
2740
- errors: r.errors,
2741
- pending: r.pending,
2742
- valid: r.valid,
2743
- invalid: r.invalid,
2744
- touched: r.touched,
2745
- dirty: r.dirty,
2746
- shouldShowError: r.shouldShowError,
2747
- componentProps: r.componentProps
2553
+ value: i.value,
2554
+ disabled: i.disabled,
2555
+ errors: i.errors,
2556
+ pending: i.pending,
2557
+ valid: i.valid,
2558
+ invalid: i.invalid,
2559
+ touched: i.touched,
2560
+ dirty: i.dirty,
2561
+ shouldShowError: i.shouldShowError,
2562
+ componentProps: i.componentProps
2748
2563
  }, t = [
2749
2564
  { key: "value" },
2750
2565
  { key: "disabled" },
@@ -2756,34 +2571,34 @@ function me(r) {
2756
2571
  { key: "dirty" },
2757
2572
  { key: "shouldShowError" },
2758
2573
  { key: "componentProps" }
2759
- ], s = E(
2760
- (i) => ({
2761
- value: i.value,
2762
- pending: i.pending,
2763
- disabled: i.disabled,
2764
- errors: i.errors,
2765
- valid: i.valid,
2766
- invalid: i.invalid,
2767
- touched: i.touched,
2768
- dirty: i.dirty,
2769
- shouldShowError: i.shouldShowError,
2770
- componentProps: i.componentProps
2574
+ ], s = b(
2575
+ (r) => ({
2576
+ value: r.value,
2577
+ pending: r.pending,
2578
+ disabled: r.disabled,
2579
+ errors: r.errors,
2580
+ valid: r.valid,
2581
+ invalid: r.invalid,
2582
+ touched: r.touched,
2583
+ dirty: r.dirty,
2584
+ shouldShowError: r.shouldShowError,
2585
+ componentProps: r.componentProps
2771
2586
  }),
2772
2587
  []
2773
2588
  );
2774
- return R(e, t, s, r);
2589
+ return R(e, t, s, i);
2775
2590
  }
2776
- function ye(r) {
2591
+ function be(i) {
2777
2592
  const e = {
2778
- value: r.value,
2779
- length: r.length,
2780
- errors: r.errors,
2781
- pending: r.pending,
2782
- valid: r.valid,
2783
- invalid: r.invalid,
2784
- touched: r.touched,
2785
- dirty: r.dirty,
2786
- disabled: r.disabled
2593
+ value: i.value,
2594
+ length: i.length,
2595
+ errors: i.errors,
2596
+ pending: i.pending,
2597
+ valid: i.valid,
2598
+ invalid: i.invalid,
2599
+ touched: i.touched,
2600
+ dirty: i.dirty,
2601
+ disabled: i.disabled
2787
2602
  }, t = [
2788
2603
  { key: "value" },
2789
2604
  { key: "length" },
@@ -2794,24 +2609,24 @@ function ye(r) {
2794
2609
  { key: "touched" },
2795
2610
  { key: "dirty" },
2796
2611
  { key: "disabled" }
2797
- ], s = E(
2798
- (i) => ({
2799
- value: i.value,
2800
- length: i.length,
2801
- pending: i.pending,
2802
- errors: i.errors,
2803
- valid: i.valid,
2804
- invalid: i.invalid,
2805
- touched: i.touched,
2806
- dirty: i.dirty,
2807
- disabled: i.disabled
2612
+ ], s = b(
2613
+ (r) => ({
2614
+ value: r.value,
2615
+ length: r.length,
2616
+ pending: r.pending,
2617
+ errors: r.errors,
2618
+ valid: r.valid,
2619
+ invalid: r.invalid,
2620
+ touched: r.touched,
2621
+ dirty: r.dirty,
2622
+ disabled: r.disabled
2808
2623
  }),
2809
2624
  []
2810
2625
  );
2811
- return R(e, t, s, r);
2626
+ return R(e, t, s, i);
2812
2627
  }
2813
- function ge() {
2814
- const r = E(
2628
+ function _e() {
2629
+ const i = b(
2815
2630
  () => ({
2816
2631
  value: [],
2817
2632
  length: 0,
@@ -2825,90 +2640,104 @@ function ge() {
2825
2640
  }),
2826
2641
  []
2827
2642
  );
2828
- return R({}, [], r);
2643
+ return R({}, [], i);
2829
2644
  }
2830
- function ke(r) {
2831
- const e = r && "length" in r && "map" in r;
2832
- return r ? e ? ye(r) : me(r) : ge();
2645
+ function Me(i) {
2646
+ const e = i && "length" in i && "map" in i;
2647
+ return i ? e ? be(i) : Ee(i) : _e();
2833
2648
  }
2834
- function Fe(r) {
2835
- const e = O({ value: r.value.value }), t = E(
2836
- (i) => {
2837
- let a = !0;
2649
+ function xe(i) {
2650
+ const e = V({ value: i.value.value }), t = b(
2651
+ (r) => {
2652
+ let n = !0;
2838
2653
  return _(() => {
2839
- if (r.value.value, a) {
2840
- a = !1;
2654
+ if (i.value.value, n) {
2655
+ n = !1;
2841
2656
  return;
2842
2657
  }
2843
- i();
2658
+ r();
2844
2659
  });
2845
2660
  },
2846
- [r]
2847
- ), s = E(() => {
2848
- const i = r.value.value;
2849
- return e.current.value === i ? e.current.value : (e.current.value = i, i);
2850
- }, [r]);
2851
- return L.useSyncExternalStore(t, s, s);
2661
+ [i]
2662
+ ), s = b(() => {
2663
+ const r = i.value.value;
2664
+ return e.current.value === r ? e.current.value : (e.current.value = r, r);
2665
+ }, [i]);
2666
+ return C.useSyncExternalStore(t, s, s);
2852
2667
  }
2853
- function Oe(r) {
2854
- const e = O({ length: r.length.value }), t = E(
2855
- (i) => {
2856
- let a = !0;
2668
+ function Ce(i) {
2669
+ const e = V({ length: i.length.value }), t = b(
2670
+ (r) => {
2671
+ let n = !0;
2857
2672
  return _(() => {
2858
- if (r.length.value, a) {
2859
- a = !1;
2673
+ if (i.length.value, n) {
2674
+ n = !1;
2860
2675
  return;
2861
2676
  }
2862
- i();
2677
+ r();
2863
2678
  });
2864
2679
  },
2865
- [r]
2866
- ), s = E(() => {
2867
- const i = r.length.value;
2868
- return e.current.length === i ? e.current.length : (e.current.length = i, i);
2869
- }, [r]);
2870
- return L.useSyncExternalStore(t, s, s);
2680
+ [i]
2681
+ ), s = b(() => {
2682
+ const r = i.length.value;
2683
+ return e.current.length === r ? e.current.length : (e.current.length = r, r);
2684
+ }, [i]);
2685
+ return C.useSyncExternalStore(t, s, s);
2686
+ }
2687
+ function Pe(i) {
2688
+ const { model: e, schema: t, strategy: s, debounce: r, liveAfterSubmit: n } = i, a = ee(
2689
+ () => se(e, t, { strategy: s, debounce: r, liveAfterSubmit: n }),
2690
+ [e, t, s, r, n]
2691
+ );
2692
+ te(() => a.start(), [a]);
2693
+ const l = C.useSyncExternalStore(
2694
+ b((u) => a.validating.subscribe(u), [a]),
2695
+ () => a.validating.peek(),
2696
+ () => !1
2697
+ // SSR: прогон не идёт
2698
+ ), d = b(() => a.validate(), [a]);
2699
+ return { submit: d, validate: d, isValidating: l };
2871
2700
  }
2701
+ const Te = Object.freeze({ runtime: "reformer-core", v: 1 });
2872
2702
  export {
2873
- U as ArrayNode,
2703
+ B as ArrayNode,
2704
+ Te as CORE_RUNTIME_TOKEN,
2874
2705
  A as ErrorStrategy,
2875
- se as FieldNode,
2876
- F as FormErrorHandler,
2706
+ ne as FieldNode,
2707
+ k as FormErrorHandler,
2877
2708
  M as FormNode,
2878
- te as FormStatusMachine,
2879
- re as FormSubmitter,
2709
+ oe as FormSubmitter,
2880
2710
  S as GroupNode,
2881
- oe as ModelArrayNode,
2882
- ne as NodeFactory,
2883
- D as SubscriptionManager,
2884
- Pe as computeFrom,
2885
- Te as copyFrom,
2886
- we as createForm,
2711
+ de as ModelArrayNode,
2712
+ ue as NodeFactory,
2713
+ I as SubscriptionManager,
2714
+ $e as computeFrom,
2715
+ Ge as copyFrom,
2716
+ Ne as createForm,
2887
2717
  Q as createFormFromModel,
2888
- Ce as createModel,
2889
- ze as disableWhen,
2890
- Qe as enableWhen,
2891
- Je as getNodeForSignal,
2892
- Ve as getNodeType,
2893
- he as isArrayNode,
2894
- B as isDerived,
2895
- ue as isFieldNode,
2896
- C as isFormNode,
2897
- de as isGroupNode,
2898
- De as markDerived,
2718
+ Le as createModel,
2719
+ tt as disableWhen,
2720
+ st as enableWhen,
2721
+ Ze as getNodeForSignal,
2722
+ Fe as getNodeType,
2723
+ ve as isArrayNode,
2724
+ $ as isDerived,
2725
+ he as isFieldNode,
2726
+ x as isFormNode,
2727
+ fe as isGroupNode,
2728
+ Ye as markDerived,
2899
2729
  Z as registerSignalNode,
2900
- Ie as resetWhen,
2901
- Le as revalidateWhen,
2902
- Re as runOutsideEffect,
2903
- Be as safeCallback,
2904
- $e as safeDebouncedCallback,
2905
- Ge as syncFields,
2906
- je as transformValue,
2907
- V as uniqueId,
2908
- Ue as unmarkDerived,
2909
- Oe as useArrayLength,
2910
- ke as useFormControl,
2911
- Fe as useFormControlValue,
2912
- He as validators,
2913
- We as watchField
2730
+ je as resetWhen,
2731
+ Ue as revalidateWhen,
2732
+ Be as runOutsideEffect,
2733
+ We as safeCallback,
2734
+ qe as safeDebouncedCallback,
2735
+ Ke as syncFields,
2736
+ He as transformValue,
2737
+ Qe as unmarkDerived,
2738
+ Ce as useArrayLength,
2739
+ Me as useFormControl,
2740
+ xe as useFormControlValue,
2741
+ Pe as useFormValidation,
2742
+ ze as watchField
2914
2743
  };