@reformer/core 11.0.0-beta.2 → 11.0.0-beta.3

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.
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
- import { a as $ } from "./form-model-DhW2HZOB.js";
2
- import { c as Le, i as Re, m as $e, u as Ge } from "./form-model-DhW2HZOB.js";
3
- import { c as Ue, a as Be, r as We, b as qe, d as Ke, e as He, f as ze, s as Je, t as Ye, w as Qe } from "./behaviors-value-C7dSEhCc.js";
4
- import { S as I } from "./subscription-manager-705bls97.js";
5
- import { signal as g, computed as f, effect as _, batch as X, Signal as G } from "@preact/signals-core";
6
- import { r as Z } from "./signal-node-registry-tiwel-TV.js";
7
- import { g as Ze } from "./signal-node-registry-tiwel-TV.js";
8
- import { d as tt, e as st } from "./behaviors-node-DGEFMTQu.js";
9
- import H, { useRef as V, useCallback as b, useMemo as ee, useEffect as te } from "react";
10
- import { createFormValidation as se } from "./validation.js";
1
+ import { a as G, c as ee } from "./form-model-DhW2HZOB.js";
2
+ import { i as Ke, m as He, u as Ye } from "./form-model-DhW2HZOB.js";
3
+ import { c as Je, a as Qe, r as Xe, b as Ze, d as et, e as tt, f as st, s as rt, t as it, w as nt } from "./behaviors-value-C7dSEhCc.js";
4
+ import { S as L } from "./subscription-manager-705bls97.js";
5
+ import { signal as g, computed as m, effect as _, batch as te, Signal as j } from "@preact/signals-core";
6
+ import { r as se } from "./signal-node-registry-tiwel-TV.js";
7
+ import { g as ot } from "./signal-node-registry-tiwel-TV.js";
8
+ import { defineValidationSchema as re, createFormValidation as D, validateModel as ie, apply as ne } from "./validation.js";
9
+ import Y, { useState as ae, useEffect as z, useRef as V, useCallback as E, useMemo as oe } from "react";
10
+ import { d as ut, e as dt } from "./behaviors-node-DGEFMTQu.js";
11
11
  class M {
12
12
  // ============================================================================
13
13
  // Protected состояние (для Template Method паттерна)
@@ -34,21 +34,21 @@ class M {
34
34
  * Пользователь взаимодействовал с узлом (touched)
35
35
  * Computed из _touched для предоставления readonly интерфейса
36
36
  */
37
- touched = f(() => this._touched.value);
37
+ touched = m(() => this._touched.value);
38
38
  /**
39
39
  * Значение узла было изменено (dirty)
40
40
  * Computed из _dirty для предоставления readonly интерфейса
41
41
  */
42
- dirty = f(() => this._dirty.value);
42
+ dirty = m(() => this._dirty.value);
43
43
  /**
44
44
  * Текущий статус узла
45
45
  * Computed из _status для предоставления readonly интерфейса
46
46
  */
47
- status = f(() => this._status.value);
47
+ status = m(() => this._status.value);
48
48
  /**
49
49
  * Узел отключен (disabled)
50
50
  */
51
- disabled = f(() => this._status.value === "disabled");
51
+ disabled = m(() => this._status.value === "disabled");
52
52
  /**
53
53
  * Получить ошибки валидации с фильтрацией
54
54
  *
@@ -90,17 +90,17 @@ class M {
90
90
  */
91
91
  getErrors(e) {
92
92
  const t = this.errors.value;
93
- return e ? t.filter((s) => {
94
- if (e.code !== void 0 && !(Array.isArray(e.code) ? e.code : [e.code]).includes(s.code) || e.message !== void 0 && !s.message.toLowerCase().includes(e.message.toLowerCase()))
93
+ return e ? t.filter((r) => {
94
+ if (e.code !== void 0 && !(Array.isArray(e.code) ? e.code : [e.code]).includes(r.code) || e.message !== void 0 && !r.message.toLowerCase().includes(e.message.toLowerCase()))
95
95
  return !1;
96
96
  if (e.params !== void 0) {
97
- if (!s.params)
97
+ if (!r.params)
98
98
  return !1;
99
- for (const [r, n] of Object.entries(e.params))
100
- if (s.params[r] !== n)
99
+ for (const [i, n] of Object.entries(e.params))
100
+ if (r.params[i] !== n)
101
101
  return !1;
102
102
  }
103
- return !(e.predicate !== void 0 && !e.predicate(s));
103
+ return !(e.predicate !== void 0 && !e.predicate(r));
104
104
  }) : t;
105
105
  }
106
106
  // ============================================================================
@@ -283,15 +283,15 @@ const O = {
283
283
  /** GroupNode.watchField() */
284
284
  WatchField: "watchField"
285
285
  };
286
- let re = 0;
287
- function N(i) {
288
- return `${i}-${++re}`;
286
+ let le = 0;
287
+ function F(s) {
288
+ return `${s}-${++le}`;
289
289
  }
290
- var S = /* @__PURE__ */ ((i) => (i.THROW = "throw", i.LOG = "log", i.CONVERT = "convert", i))(S || {});
290
+ var S = /* @__PURE__ */ ((s) => (s.THROW = "throw", s.LOG = "log", s.CONVERT = "convert", s))(S || {});
291
291
  class k {
292
- static handle(e, t, s = "throw") {
293
- const r = this.extractMessage(e);
294
- switch (process.env.NODE_ENV !== "production" && console.error(`[${t}]`, e), s) {
292
+ static handle(e, t, r = "throw") {
293
+ const i = this.extractMessage(e);
294
+ switch (process.env.NODE_ENV !== "production" && console.error(`[${t}]`, e), r) {
295
295
  case "throw":
296
296
  throw e;
297
297
  case "log":
@@ -299,7 +299,7 @@ class k {
299
299
  case "convert":
300
300
  return {
301
301
  code: "validator_error",
302
- message: r,
302
+ message: i,
303
303
  params: { field: t }
304
304
  };
305
305
  }
@@ -355,11 +355,11 @@ class k {
355
355
  * // { code: 'required', message: 'This field is required', field: 'email' }
356
356
  * ```
357
357
  */
358
- static createValidationError(e, t, s) {
358
+ static createValidationError(e, t, r) {
359
359
  return {
360
360
  code: e,
361
361
  message: t,
362
- params: s ? { field: s } : void 0
362
+ params: r ? { field: r } : void 0
363
363
  };
364
364
  }
365
365
  /**
@@ -381,7 +381,7 @@ class k {
381
381
  return typeof e == "object" && e !== null && "code" in e && "message" in e && typeof e.code == "string" && typeof e.message == "string";
382
382
  }
383
383
  }
384
- class ie {
384
+ class ue {
385
385
  /** Внутренний сигнал статуса */
386
386
  _status;
387
387
  /** Публичный read-only сигнал статуса */
@@ -398,7 +398,7 @@ class ie {
398
398
  * @param initial - Начальный статус (по умолчанию 'valid')
399
399
  */
400
400
  constructor(e = "valid") {
401
- 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");
401
+ this._status = g(e), this.status = m(() => this._status.value), this.valid = m(() => this._status.value === "valid"), this.invalid = m(() => this._status.value === "invalid"), this.pending = m(() => this._status.value === "pending"), this.disabled = m(() => this._status.value === "disabled");
402
402
  }
403
403
  /**
404
404
  * Начать валидацию
@@ -481,7 +481,7 @@ class ie {
481
481
  this._status.value = e ? "invalid" : "valid";
482
482
  }
483
483
  }
484
- class ne extends M {
484
+ class de extends M {
485
485
  // ============================================================================
486
486
  // Приватные сигналы
487
487
  // ============================================================================
@@ -533,13 +533,13 @@ class ne extends M {
533
533
  * Менеджер подписок для централизованного cleanup
534
534
  * Использует SubscriptionManager вместо массива для управления подписками
535
535
  */
536
- disposers = new I();
536
+ disposers = new L();
537
537
  component;
538
538
  // ============================================================================
539
539
  // Конструктор
540
540
  // ============================================================================
541
541
  constructor(e) {
542
- 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(
542
+ 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 ue(e.disabled ? "disabled" : "valid"), this.value = m(() => this._value.value), this.valid = m(() => this.statusMachine.valid.value), this.invalid = m(() => this.statusMachine.invalid.value), this.pending = m(() => this.statusMachine.pending.value), this.status = m(() => this.statusMachine.status.value), this.disabled = m(() => this.statusMachine.disabled.value), this.errors = m(() => this._errors.value), this.componentProps = m(() => this._componentProps.value), this.shouldShowError = m(
543
543
  () => this.statusMachine.invalid.value && (this._touched.value || this._dirty.value)
544
544
  );
545
545
  }
@@ -552,12 +552,12 @@ class ne extends M {
552
552
  setValue(e, t) {
553
553
  if (this._value.value = e, this._dirty.value = !0, t?.emitEvent === !1)
554
554
  return;
555
- const s = this.validators.length > 0 || this.asyncValidators.length > 0, r = this._errors.value.length > 0;
555
+ const r = this.validators.length > 0 || this.asyncValidators.length > 0, i = this._errors.value.length > 0;
556
556
  if (this.updateOn === "change") {
557
557
  this.validate();
558
558
  return;
559
559
  }
560
- r && s && this.validate();
560
+ i && r && this.validate();
561
561
  }
562
562
  patchValue(e) {
563
563
  this.setValue(e);
@@ -650,20 +650,20 @@ class ne extends M {
650
650
  const t = e?.debounce ?? this.debounceMs;
651
651
  if (this.cancelPendingValidation(), t <= 0 || this.asyncValidators.length === 0)
652
652
  return this.validateImmediate();
653
- const s = new AbortController();
654
- return new Promise((r) => {
655
- this.pendingValidation = { resolve: r, abortController: s }, this.validateDebounceTimer = setTimeout(async () => {
656
- if (this.validateDebounceTimer = void 0, s.signal.aborted) {
657
- r(!1);
653
+ const r = new AbortController();
654
+ return new Promise((i) => {
655
+ this.pendingValidation = { resolve: i, abortController: r }, this.validateDebounceTimer = setTimeout(async () => {
656
+ if (this.validateDebounceTimer = void 0, r.signal.aborted) {
657
+ i(!1);
658
658
  return;
659
659
  }
660
660
  this.pendingValidation = void 0;
661
- const n = await this.validateImmediate(s);
662
- r(n);
663
- }, t), s.signal.addEventListener(
661
+ const n = await this.validateImmediate(r);
662
+ i(n);
663
+ }, t), r.signal.addEventListener(
664
664
  "abort",
665
665
  () => {
666
- this.validateDebounceTimer && (clearTimeout(this.validateDebounceTimer), this.validateDebounceTimer = void 0), r(!1);
666
+ this.validateDebounceTimer && (clearTimeout(this.validateDebounceTimer), this.validateDebounceTimer = void 0), i(!1);
667
667
  },
668
668
  { once: !0 }
669
669
  );
@@ -682,31 +682,31 @@ class ne extends M {
682
682
  async validateImmediate(e) {
683
683
  const t = e ?? new AbortController();
684
684
  e || this.currentAbortController?.abort(), this.currentAbortController = t;
685
- const { signal: s } = t, r = [];
685
+ const { signal: r } = t, i = [];
686
686
  for (const a of this.validators) {
687
687
  const l = a(this._value.value);
688
- l && r.push(l);
688
+ l && i.push(l);
689
689
  }
690
- if (s.aborted)
690
+ if (r.aborted)
691
691
  return !1;
692
- if (r.length > 0) {
693
- this._errors.value = r;
694
- const a = r.some((l) => l.severity !== "warning");
692
+ if (i.length > 0) {
693
+ this._errors.value = i;
694
+ const a = i.some((l) => l.severity !== "warning");
695
695
  if (this.statusMachine.setErrors(a), a)
696
696
  return !1;
697
697
  }
698
698
  if (this.asyncValidators.length > 0) {
699
- if (s.aborted)
699
+ if (r.aborted)
700
700
  return !1;
701
701
  this.statusMachine.startValidation();
702
702
  try {
703
703
  const a = await Promise.all(
704
704
  this.asyncValidators.map(async (d) => {
705
- if (s.aborted)
705
+ if (r.aborted)
706
706
  throw new DOMException("Validation aborted", "AbortError");
707
707
  try {
708
- const u = await d(this._value.value, { signal: s });
709
- if (s.aborted)
708
+ const u = await d(this._value.value, { signal: r });
709
+ if (r.aborted)
710
710
  throw new DOMException("Validation aborted", "AbortError");
711
711
  return u;
712
712
  } catch (u) {
@@ -720,7 +720,7 @@ class ne extends M {
720
720
  }
721
721
  })
722
722
  );
723
- if (s.aborted)
723
+ if (r.aborted)
724
724
  return !1;
725
725
  const l = a.filter((d) => d !== null);
726
726
  if (l.length > 0) {
@@ -735,11 +735,11 @@ class ne extends M {
735
735
  throw a;
736
736
  }
737
737
  }
738
- 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"));
738
+ return r.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"));
739
739
  }
740
740
  setErrors(e) {
741
741
  this._errors.value = e;
742
- const t = e.some((s) => s.severity !== "warning");
742
+ const t = e.some((r) => r.severity !== "warning");
743
743
  this.statusMachine.setErrors(t);
744
744
  }
745
745
  clearErrors() {
@@ -856,12 +856,12 @@ class ne extends M {
856
856
  * ```
857
857
  */
858
858
  watch(e) {
859
- const t = new AbortController(), s = _(() => {
859
+ const t = new AbortController(), r = _(() => {
860
860
  const n = this.value.value;
861
861
  e(n, t.signal);
862
- }), r = N(O.Watch);
863
- return this.disposers.add(r, () => {
864
- t.abort(), s();
862
+ }), i = F(O.Watch);
863
+ return this.disposers.add(i, () => {
864
+ t.abort(), r();
865
865
  });
866
866
  }
867
867
  /**
@@ -887,11 +887,11 @@ class ne extends M {
887
887
  * ```
888
888
  */
889
889
  computeFrom(e, t) {
890
- const s = _(() => {
890
+ const r = _(() => {
891
891
  const n = e.map((l) => l.value), a = t(...n);
892
892
  this.setValue(a, { emitEvent: !1 });
893
- }), r = N(O.ComputeFrom);
894
- return this.disposers.add(r, s);
893
+ }), i = F(O.ComputeFrom);
894
+ return this.disposers.add(i, r);
895
895
  }
896
896
  /**
897
897
  * Очистить все ресурсы и таймеры
@@ -921,59 +921,59 @@ class ne extends M {
921
921
  }
922
922
  }
923
923
  }
924
- function L(i) {
925
- 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(() => {
924
+ function R(s) {
925
+ const { getChildren: e, ownErrors: t, disabled: r } = s, i = m(() => t.value.length > 0 ? !1 : e().every((o) => o.disabled.value || o.valid.value)), n = m(() => !i.value), a = m(() => e().some((o) => o.pending.value)), l = m(() => e().some((o) => o.touched.value)), d = m(() => e().some((o) => o.dirty.value)), u = m(() => {
926
926
  const o = [...t.value];
927
- for (const m of e())
928
- o.push(...m.errors.value);
927
+ for (const f of e())
928
+ o.push(...f.errors.value);
929
929
  return o;
930
- }), v = f(() => s?.value ? "disabled" : a.value ? "pending" : n.value ? "invalid" : "valid");
930
+ }), h = m(() => r?.value ? "disabled" : a.value ? "pending" : n.value ? "invalid" : "valid");
931
931
  return {
932
- valid: r,
932
+ valid: i,
933
933
  invalid: n,
934
934
  pending: a,
935
935
  touched: l,
936
936
  dirty: d,
937
937
  errors: u,
938
- status: v
938
+ status: h
939
939
  };
940
940
  }
941
- function j(i) {
942
- return typeof i == "object" && i !== null && "getProxy" in i && typeof i.getProxy == "function";
941
+ function B(s) {
942
+ return typeof s == "object" && s !== null && "getProxy" in s && typeof s.getProxy == "function";
943
943
  }
944
944
  const U = "$";
945
- function ae(i, e) {
945
+ function ce(s, e) {
946
946
  let t;
947
- const s = () => {
947
+ const r = () => {
948
948
  if (!t) {
949
- const r = {};
949
+ const i = {};
950
950
  e.forEach((n, a) => {
951
- r[a] = n && j(n) ? n.getProxy() : n;
952
- }), t = r;
951
+ i[a] = n && B(n) ? n.getProxy() : n;
952
+ }), t = i;
953
953
  }
954
954
  return t;
955
955
  };
956
- return new Proxy(i, {
957
- get: (r, n) => {
956
+ return new Proxy(s, {
957
+ get: (i, n) => {
958
958
  if (n === U)
959
- return s();
960
- if (n in r)
961
- return r[n];
959
+ return r();
960
+ if (n in i)
961
+ return i[n];
962
962
  if (typeof n == "string" && e.has(n)) {
963
963
  const a = e.get(n);
964
- return a && j(a) ? a.getProxy() : a;
964
+ return a && B(a) ? a.getProxy() : a;
965
965
  }
966
966
  },
967
- set: (r, n, a) => typeof n == "string" && e.has(n) ? !1 : (r[n] = a, !0),
968
- has: (r, n) => n === U || typeof n == "string" && e.has(n) ? !0 : n in r,
969
- ownKeys: (r) => {
970
- const n = Reflect.ownKeys(r), a = Array.from(e.keys());
967
+ set: (i, n, a) => typeof n == "string" && e.has(n) ? !1 : (i[n] = a, !0),
968
+ has: (i, n) => n === U || typeof n == "string" && e.has(n) ? !0 : n in i,
969
+ ownKeys: (i) => {
970
+ const n = Reflect.ownKeys(i), a = Array.from(e.keys());
971
971
  return [.../* @__PURE__ */ new Set([...n, ...a])];
972
972
  },
973
- getOwnPropertyDescriptor: (r, n) => typeof n == "string" && e.has(n) ? { enumerable: !0, configurable: !0 } : Reflect.getOwnPropertyDescriptor(r, n)
973
+ getOwnPropertyDescriptor: (i, n) => typeof n == "string" && e.has(n) ? { enumerable: !0, configurable: !0 } : Reflect.getOwnPropertyDescriptor(i, n)
974
974
  });
975
975
  }
976
- class oe {
976
+ class he {
977
977
  /**
978
978
  * @param form - Форма для отправки
979
979
  */
@@ -983,7 +983,7 @@ class oe {
983
983
  /** Внутренний сигнал состояния отправки */
984
984
  _submitting = g(!1);
985
985
  /** Публичный read-only сигнал состояния отправки */
986
- submitting = f(() => this._submitting.value);
986
+ submitting = m(() => this._submitting.value);
987
987
  /**
988
988
  * Отправить форму
989
989
  *
@@ -1018,8 +1018,8 @@ class oe {
1018
1018
  * ```
1019
1019
  */
1020
1020
  async submit(e, t) {
1021
- const { skipValidation: s = !1, skipTouch: r = !1 } = t || {};
1022
- if (r || this.form.markAsTouched(), !s && !await this.form.validate())
1021
+ const { skipValidation: r = !1, skipTouch: i = !1 } = t || {};
1022
+ if (i || this.form.markAsTouched(), !r && !await this.form.validate())
1023
1023
  return null;
1024
1024
  this._submitting.value = !0;
1025
1025
  try {
@@ -1053,8 +1053,8 @@ class oe {
1053
1053
  * ```
1054
1054
  */
1055
1055
  async submitWithResult(e, t) {
1056
- const { skipValidation: s = !1, skipTouch: r = !1 } = t || {};
1057
- if (r || this.form.markAsTouched(), !s && !await this.form.validate())
1056
+ const { skipValidation: r = !1, skipTouch: i = !1 } = t || {};
1057
+ if (i || this.form.markAsTouched(), !r && !await this.form.validate())
1058
1058
  return { success: !1, data: null };
1059
1059
  this._submitting.value = !0;
1060
1060
  try {
@@ -1070,12 +1070,12 @@ class oe {
1070
1070
  }
1071
1071
  }
1072
1072
  }
1073
- function le(i) {
1073
+ function fe(s) {
1074
1074
  const e = [];
1075
- for (const t of i.split(".")) {
1076
- const s = /^([^[\]]+)(?:\[(\d+)\])?$/.exec(t);
1077
- if (!s) return [];
1078
- e.push(s[2] !== void 0 ? { key: s[1], index: Number(s[2]) } : { key: s[1] });
1075
+ for (const t of s.split(".")) {
1076
+ const r = /^([^[\]]+)(?:\[(\d+)\])?$/.exec(t);
1077
+ if (!r) return [];
1078
+ e.push(r[2] !== void 0 ? { key: r[1], index: Number(r[2]) } : { key: r[1] });
1079
1079
  }
1080
1080
  return e;
1081
1081
  }
@@ -1092,7 +1092,7 @@ class A extends M {
1092
1092
  /**
1093
1093
  * Менеджер подписок для централизованного cleanup
1094
1094
  */
1095
- disposers = new I();
1095
+ disposers = new L();
1096
1096
  /**
1097
1097
  * Ссылка на Proxy-инстанс
1098
1098
  */
@@ -1104,7 +1104,7 @@ class A extends M {
1104
1104
  /**
1105
1105
  * Фабрика для создания узлов формы
1106
1106
  */
1107
- nodeFactory = new ue();
1107
+ nodeFactory = new ve();
1108
1108
  // ============================================================================
1109
1109
  // Приватные сигналы состояния (inline из StateManager)
1110
1110
  // ============================================================================
@@ -1135,19 +1135,19 @@ class A extends M {
1135
1135
  status;
1136
1136
  submitting;
1137
1137
  constructor(e) {
1138
- super(), this.formSubmitter = new oe(this);
1139
- const t = e.form, s = t != null && typeof t == "object" && ("valueSignal" in t || "value" in t), n = "form" in e && !s ? e.form : e;
1138
+ super(), this.formSubmitter = new he(this);
1139
+ const t = e.form, r = t != null && typeof t == "object" && ("valueSignal" in t || "value" in t), n = "form" in e && !r ? e.form : e;
1140
1140
  for (const [l, d] of Object.entries(n)) {
1141
1141
  const u = this.createNode(d);
1142
1142
  this._fields.set(l, u);
1143
1143
  }
1144
- this.value = f(() => {
1144
+ this.value = m(() => {
1145
1145
  const l = {};
1146
1146
  return this._fields.forEach((d, u) => {
1147
1147
  l[u] = d.value.value;
1148
1148
  }), l;
1149
1149
  });
1150
- const a = L({
1150
+ const a = R({
1151
1151
  getChildren: () => Array.from(this._fields.values()),
1152
1152
  ownErrors: this._formErrors,
1153
1153
  disabled: this._disabled
@@ -1162,35 +1162,35 @@ class A extends M {
1162
1162
  * @see buildFormProxy
1163
1163
  */
1164
1164
  buildProxy() {
1165
- return ae(this, this._fields);
1165
+ return ce(this, this._fields);
1166
1166
  }
1167
1167
  // ============================================================================
1168
1168
  // Реализация абстрактных методов FormNode
1169
1169
  // ============================================================================
1170
1170
  getValue() {
1171
1171
  const e = {};
1172
- return this._fields.forEach((t, s) => {
1173
- e[s] = t.getValue();
1172
+ return this._fields.forEach((t, r) => {
1173
+ e[r] = t.getValue();
1174
1174
  }), e;
1175
1175
  }
1176
1176
  setValue(e, t) {
1177
- for (const [s, r] of Object.entries(e)) {
1178
- const n = this._fields.get(s);
1177
+ for (const [r, i] of Object.entries(e)) {
1178
+ const n = this._fields.get(r);
1179
1179
  if (n) {
1180
1180
  const a = this._fieldSignals.get(n) ?? n.value;
1181
- if ($(a)) continue;
1182
- n.setValue(r, t);
1181
+ if (G(a)) continue;
1182
+ n.setValue(i, t);
1183
1183
  }
1184
1184
  }
1185
1185
  }
1186
1186
  patchValue(e) {
1187
- X(() => {
1188
- for (const [t, s] of Object.entries(e)) {
1189
- const r = this._fields.get(t);
1190
- if (r && s !== void 0) {
1191
- const n = this._fieldSignals.get(r) ?? r.value;
1192
- if ($(n)) continue;
1193
- r.setValue(s, { emitEvent: !1 });
1187
+ te(() => {
1188
+ for (const [t, r] of Object.entries(e)) {
1189
+ const i = this._fields.get(t);
1190
+ if (i && r !== void 0) {
1191
+ const n = this._fieldSignals.get(i) ?? i.value;
1192
+ if (G(n)) continue;
1193
+ i.setValue(r, { emitEvent: !1 });
1194
1194
  }
1195
1195
  }
1196
1196
  });
@@ -1213,9 +1213,9 @@ class A extends M {
1213
1213
  * ```
1214
1214
  */
1215
1215
  reset(e) {
1216
- this._formErrors.value = [], this._fields.forEach((t, s) => {
1217
- const r = e?.[s];
1218
- t.reset(r);
1216
+ this._formErrors.value = [], this._fields.forEach((t, r) => {
1217
+ const i = e?.[r];
1218
+ t.reset(i);
1219
1219
  });
1220
1220
  }
1221
1221
  /**
@@ -1359,21 +1359,21 @@ class A extends M {
1359
1359
  getFieldByPath(e) {
1360
1360
  if (e.startsWith(".") || e.endsWith("."))
1361
1361
  return;
1362
- const t = le(e);
1362
+ const t = fe(e);
1363
1363
  if (t.length === 0)
1364
1364
  return;
1365
- let s = this;
1366
- for (const r of t) {
1367
- if (!(s instanceof A) || (s = s.getField(r.key), !s)) return;
1368
- if (r.index !== void 0)
1369
- if ("at" in s && "length" in s && typeof s.at == "function") {
1370
- const n = s.at(r.index);
1365
+ let r = this;
1366
+ for (const i of t) {
1367
+ if (!(r instanceof A) || (r = r.getField(i.key), !r)) return;
1368
+ if (i.index !== void 0)
1369
+ if ("at" in r && "length" in r && typeof r.at == "function") {
1370
+ const n = r.at(i.index);
1371
1371
  if (!n) return;
1372
- s = n;
1372
+ r = n;
1373
1373
  } else
1374
1374
  return;
1375
1375
  }
1376
- return s;
1376
+ return r;
1377
1377
  }
1378
1378
  // ============================================================================
1379
1379
  // Private методы для создания узлов
@@ -1402,16 +1402,16 @@ class A extends M {
1402
1402
  /**
1403
1403
  * Связывает два поля: при изменении source автоматически обновляется target
1404
1404
  */
1405
- linkFields(e, t, s) {
1406
- const r = this._fields.get(e), n = this._fields.get(t);
1407
- if (!r || !n) {
1408
- const d = r ? t : e;
1405
+ linkFields(e, t, r) {
1406
+ const i = this._fields.get(e), n = this._fields.get(t);
1407
+ if (!i || !n) {
1408
+ const d = i ? t : e;
1409
1409
  throw new Error(`GroupNode.linkFields: field "${String(d)}" not found`);
1410
1410
  }
1411
1411
  const a = _(() => {
1412
- const d = r.value.value, u = s ? s(d) : d;
1412
+ const d = i.value.value, u = r ? r(d) : d;
1413
1413
  n.setValue(u, { emitEvent: !1 });
1414
- }), l = N(O.LinkFields);
1414
+ }), l = F(O.LinkFields);
1415
1415
  return this.disposers.add(l, a);
1416
1416
  }
1417
1417
  /**
@@ -1443,26 +1443,26 @@ class A extends M {
1443
1443
  */
1444
1444
  /** Подписка на top-level поле — value типизирован как `T[K]`. */
1445
1445
  watchField(e, t) {
1446
- const s = this.getFieldByPath(e);
1447
- if (!s)
1446
+ const r = this.getFieldByPath(e);
1447
+ if (!r)
1448
1448
  throw new Error(`GroupNode.watchField: field "${e}" not found`);
1449
- const r = _(() => {
1450
- t(s.value.value);
1451
- }), n = N(O.WatchField);
1452
- return this.disposers.add(n, r);
1449
+ const i = _(() => {
1450
+ t(r.value.value);
1451
+ }), n = F(O.WatchField);
1452
+ return this.disposers.add(n, i);
1453
1453
  }
1454
1454
  /**
1455
1455
  * Подписка на вложенное поле по строковому пути ("address.city").
1456
1456
  * Путь нельзя выразить в типах узла → value честно `unknown`, потребитель сужает.
1457
1457
  */
1458
1458
  watchFieldByPath(e, t) {
1459
- const s = this.getFieldByPath(e);
1460
- if (!s)
1459
+ const r = this.getFieldByPath(e);
1460
+ if (!r)
1461
1461
  throw new Error(`GroupNode.watchFieldByPath: field "${e}" not found`);
1462
- const r = _(() => {
1463
- t(s.value.value);
1464
- }), n = N(O.WatchField);
1465
- return this.disposers.add(n, r);
1462
+ const i = _(() => {
1463
+ t(r.value.value);
1464
+ }), n = F(O.WatchField);
1465
+ return this.disposers.add(n, i);
1466
1466
  }
1467
1467
  /**
1468
1468
  * Hook: вызывается после disable()
@@ -1501,7 +1501,7 @@ class A extends M {
1501
1501
  });
1502
1502
  }
1503
1503
  }
1504
- class B extends M {
1504
+ class W extends M {
1505
1505
  // ============================================================================
1506
1506
  // Приватные поля
1507
1507
  // ============================================================================
@@ -1512,7 +1512,7 @@ class B extends M {
1512
1512
  * Менеджер подписок для централизованного cleanup
1513
1513
  * Использует SubscriptionManager вместо массива для управления подписками
1514
1514
  */
1515
- disposers = new I();
1515
+ disposers = new L();
1516
1516
  /** Array-level validation errors (e.g., "минимум 1 элемент") */
1517
1517
  _arrayErrors = g([]);
1518
1518
  // ============================================================================
@@ -1532,14 +1532,14 @@ class B extends M {
1532
1532
  // ============================================================================
1533
1533
  constructor(e, t = []) {
1534
1534
  super(), this.itemSchema = e, this.initialItems = t, this.items = g([]);
1535
- for (const r of t)
1536
- this.push(r);
1537
- this.length = f(() => this.items.value.length), this.value = f(() => this.items.value.map((r) => r.value.value));
1538
- const s = L({
1535
+ for (const i of t)
1536
+ this.push(i);
1537
+ this.length = m(() => this.items.value.length), this.value = m(() => this.items.value.map((i) => i.value.value));
1538
+ const r = R({
1539
1539
  getChildren: () => this.items.value,
1540
1540
  ownErrors: this._arrayErrors
1541
1541
  });
1542
- this.valid = s.valid, this.invalid = s.invalid, this.pending = s.pending, this.touched = s.touched, this.dirty = s.dirty, this.errors = s.errors, this.status = s.status;
1542
+ this.valid = r.valid, this.invalid = r.invalid, this.pending = r.pending, this.touched = r.touched, this.dirty = r.dirty, this.errors = r.errors, this.status = r.status;
1543
1543
  }
1544
1544
  // ============================================================================
1545
1545
  // CRUD операции
@@ -1571,7 +1571,7 @@ class B extends M {
1571
1571
  return;
1572
1572
  }
1573
1573
  const t = this.items.value[e];
1574
- this.items.value = this.items.value.filter((s, r) => r !== e), t && "dispose" in t && typeof t.dispose == "function" && t.dispose();
1574
+ this.items.value = this.items.value.filter((r, i) => i !== e), t && "dispose" in t && typeof t.dispose == "function" && t.dispose();
1575
1575
  }
1576
1576
  /**
1577
1577
  * Вставить элемент в массив
@@ -1589,8 +1589,8 @@ class B extends M {
1589
1589
  );
1590
1590
  return;
1591
1591
  }
1592
- const s = this.createItem(t), r = [...this.items.value];
1593
- r.splice(e, 0, s), this.items.value = r;
1592
+ const r = this.createItem(t), i = [...this.items.value];
1593
+ i.splice(e, 0, r), this.items.value = i;
1594
1594
  }
1595
1595
  /**
1596
1596
  * Переместить элемент массива с позиции `from` на позицию `to`
@@ -1609,18 +1609,18 @@ class B extends M {
1609
1609
  * ```
1610
1610
  */
1611
1611
  move(e, t) {
1612
- const s = this.items.value.length;
1613
- if (e < 0 || e >= s || t < 0 || t >= s) {
1612
+ const r = this.items.value.length;
1613
+ if (e < 0 || e >= r || t < 0 || t >= r) {
1614
1614
  k.handle(
1615
- new Error(`ArrayNode.move: index out of bounds (from=${e}, to=${t}, length=${s})`),
1615
+ new Error(`ArrayNode.move: index out of bounds (from=${e}, to=${t}, length=${r})`),
1616
1616
  "ArrayNode.move",
1617
1617
  S.LOG
1618
1618
  );
1619
1619
  return;
1620
1620
  }
1621
1621
  if (e === t) return;
1622
- const r = [...this.items.value], [n] = r.splice(e, 1);
1623
- r.splice(t, 0, n), this.items.value = r;
1622
+ const i = [...this.items.value], [n] = i.splice(e, 1);
1623
+ i.splice(t, 0, n), this.items.value = i;
1624
1624
  }
1625
1625
  /**
1626
1626
  * Поменять местами два элемента массива
@@ -1637,18 +1637,18 @@ class B extends M {
1637
1637
  * ```
1638
1638
  */
1639
1639
  swap(e, t) {
1640
- const s = this.items.value.length;
1641
- if (e < 0 || e >= s || t < 0 || t >= s) {
1640
+ const r = this.items.value.length;
1641
+ if (e < 0 || e >= r || t < 0 || t >= r) {
1642
1642
  k.handle(
1643
- new Error(`ArrayNode.swap: index out of bounds (a=${e}, b=${t}, length=${s})`),
1643
+ new Error(`ArrayNode.swap: index out of bounds (a=${e}, b=${t}, length=${r})`),
1644
1644
  "ArrayNode.swap",
1645
1645
  S.LOG
1646
1646
  );
1647
1647
  return;
1648
1648
  }
1649
1649
  if (e === t) return;
1650
- const r = [...this.items.value];
1651
- [r[e], r[t]] = [r[t], r[e]], this.items.value = r;
1650
+ const i = [...this.items.value];
1651
+ [i[e], i[t]] = [i[t], i[e]], this.items.value = i;
1652
1652
  }
1653
1653
  /**
1654
1654
  * Удалить все элементы массива
@@ -1679,13 +1679,13 @@ class B extends M {
1679
1679
  return this.items.value.map((e) => e.getValue());
1680
1680
  }
1681
1681
  setValue(e, t) {
1682
- this.clear(), e.forEach((s) => this.push(s)), t?.emitEvent !== !1 && this.validate().catch((s) => {
1683
- k.handle(s, "ArrayNode.setValue", S.LOG);
1682
+ this.clear(), e.forEach((r) => this.push(r)), t?.emitEvent !== !1 && this.validate().catch((r) => {
1683
+ k.handle(r, "ArrayNode.setValue", S.LOG);
1684
1684
  });
1685
1685
  }
1686
1686
  patchValue(e) {
1687
- e.forEach((t, s) => {
1688
- this.items.value[s] && t !== void 0 && this.items.value[s].patchValue(t);
1687
+ e.forEach((t, r) => {
1688
+ this.items.value[r] && t !== void 0 && this.items.value[r].patchValue(t);
1689
1689
  });
1690
1690
  }
1691
1691
  /**
@@ -1813,9 +1813,9 @@ class B extends M {
1813
1813
  * @param callback - Функция, вызываемая для каждого элемента с типизированным GroupNode proxy
1814
1814
  */
1815
1815
  forEach(e) {
1816
- this.items.value.forEach((t, s) => {
1817
- const r = t.getProxy();
1818
- e(r, s);
1816
+ this.items.value.forEach((t, r) => {
1817
+ const i = t.getProxy();
1818
+ e(i, r);
1819
1819
  });
1820
1820
  }
1821
1821
  /**
@@ -1824,9 +1824,9 @@ class B extends M {
1824
1824
  * @returns Новый массив результатов
1825
1825
  */
1826
1826
  map(e) {
1827
- return this.items.value.map((t, s) => {
1828
- const r = t.getProxy();
1829
- return e(r, s);
1827
+ return this.items.value.map((t, r) => {
1828
+ const i = t.getProxy();
1829
+ return e(i, r);
1830
1830
  });
1831
1831
  }
1832
1832
  // ============================================================================
@@ -1916,7 +1916,7 @@ class B extends M {
1916
1916
  });
1917
1917
  }
1918
1918
  }
1919
- class ue {
1919
+ class ve {
1920
1920
  /**
1921
1921
  * Создает узел формы на основе конфигурации
1922
1922
  *
@@ -1966,9 +1966,9 @@ class ue {
1966
1966
  if (Array.isArray(e) && e.length >= 1)
1967
1967
  return this.createArrayNodeFromArray(e);
1968
1968
  if (this.isFieldConfig(e))
1969
- return new ne(e);
1969
+ return new de(e);
1970
1970
  if (this.isArrayConfig(e))
1971
- return new B(
1971
+ return new W(
1972
1972
  e.schema,
1973
1973
  e.initialItems
1974
1974
  );
@@ -2007,11 +2007,11 @@ class ue {
2007
2007
  */
2008
2008
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2009
2009
  createArrayNodeFromArray(e) {
2010
- const [t, ...s] = e, r = [];
2011
- this.isGroupConfig(t) && r.push(this.extractValues(t));
2012
- for (const n of s)
2013
- this.isGroupConfig(n) ? r.push(this.extractValues(n)) : r.push(n);
2014
- return new B(t, r);
2010
+ const [t, ...r] = e, i = [];
2011
+ this.isGroupConfig(t) && i.push(this.extractValues(t));
2012
+ for (const n of r)
2013
+ this.isGroupConfig(n) ? i.push(this.extractValues(n)) : i.push(n);
2014
+ return new W(t, i);
2015
2015
  }
2016
2016
  /**
2017
2017
  * Извлечь значения из схемы (рекурсивно)
@@ -2049,8 +2049,8 @@ class ue {
2049
2049
  return e.map((t) => this.extractValues(t));
2050
2050
  if (this.isGroupConfig(e)) {
2051
2051
  const t = {};
2052
- for (const [s, r] of Object.entries(e))
2053
- t[s] = this.extractValues(r);
2052
+ for (const [r, i] of Object.entries(e))
2053
+ t[r] = this.extractValues(i);
2054
2054
  return t;
2055
2055
  }
2056
2056
  return e;
@@ -2130,7 +2130,7 @@ class ue {
2130
2130
  return e != null && typeof e == "object" && !this.isFieldConfig(e) && !this.isArrayConfig(e);
2131
2131
  }
2132
2132
  }
2133
- class de extends M {
2133
+ class me extends M {
2134
2134
  /**
2135
2135
  * @param control Реактивный массив модели (`model.<path>`).
2136
2136
  * @param buildItem Строитель формы элемента по его под-модели (инъекция, чтобы избежать цикла
@@ -2138,26 +2138,26 @@ class de extends M {
2138
2138
  */
2139
2139
  constructor(e, t) {
2140
2140
  super(), this.control = e, this.buildItem = t, this.initial = e.toArray(), this.disposeSync = _(() => {
2141
- const r = e.length, n = [], a = [];
2142
- for (let u = 0; u < r; u++) {
2143
- const v = e.at(u);
2144
- if (!v) continue;
2145
- let o = this.cache.get(v);
2146
- o || (o = t(v), this.cache.set(v, o)), n.push(v), a.push(o);
2141
+ const i = e.length, n = [], a = [];
2142
+ for (let u = 0; u < i; u++) {
2143
+ const h = e.at(u);
2144
+ if (!h) continue;
2145
+ let o = this.cache.get(h);
2146
+ o || (o = t(h), this.cache.set(h, o)), n.push(h), a.push(o);
2147
2147
  }
2148
2148
  const l = new Set(n), d = [];
2149
2149
  for (const u of this.mountedModels) {
2150
2150
  if (l.has(u)) continue;
2151
- const v = this.cache.get(u);
2152
- this.cache.delete(u), v && d.push(v);
2151
+ const h = this.cache.get(u);
2152
+ this.cache.delete(u), h && d.push(h);
2153
2153
  }
2154
2154
  this.mountedModels = n, this.itemNodes.value = a, d.forEach((u) => this.disposeItemNode(u));
2155
- }), this.length = f(() => this.itemNodes.value.length), this.value = f(() => this.itemNodes.value.map((r) => r.value.value));
2156
- const s = L({
2155
+ }), this.length = m(() => this.itemNodes.value.length), this.value = m(() => this.itemNodes.value.map((i) => i.value.value));
2156
+ const r = R({
2157
2157
  getChildren: () => this.itemNodes.value,
2158
2158
  ownErrors: this._arrayErrors
2159
2159
  });
2160
- this.valid = s.valid, this.invalid = s.invalid, this.pending = s.pending, this.touched = s.touched, this.dirty = s.dirty, this.errors = s.errors, this.status = s.status;
2160
+ this.valid = r.valid, this.invalid = r.invalid, this.pending = r.pending, this.touched = r.touched, this.dirty = r.dirty, this.errors = r.errors, this.status = r.status;
2161
2161
  }
2162
2162
  itemNodes = g([]);
2163
2163
  // Кэш per-item формы по идентичности фасада под-модели (фасады кэшируются в core).
@@ -2189,10 +2189,10 @@ class de extends M {
2189
2189
  return this.itemNodes.value[e];
2190
2190
  }
2191
2191
  map(e) {
2192
- return this.itemNodes.value.map((t, s) => e(t, s));
2192
+ return this.itemNodes.value.map((t, r) => e(t, r));
2193
2193
  }
2194
2194
  forEach(e) {
2195
- this.itemNodes.value.forEach((t, s) => e(t, s));
2195
+ this.itemNodes.value.forEach((t, r) => e(t, r));
2196
2196
  }
2197
2197
  // ── Мутации (делегируют массиву модели; effect пересоберёт itemNodes) ──────
2198
2198
  push(e) {
@@ -2292,170 +2292,221 @@ class de extends M {
2292
2292
  this.disposeSync(), this.itemNodes.value.forEach((e) => this.disposeItemNode(e)), this.mountedModels = [];
2293
2293
  }
2294
2294
  }
2295
- 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);
2296
- function D(i, e, t) {
2297
- if (i == null || typeof i != "object" || i instanceof G) return;
2298
- if (Array.isArray(i)) {
2299
- for (const n of i) D(n, e, t);
2295
+ const J = (s) => s !== null && typeof s == "object" && !Array.isArray(s) && !(s instanceof Date) && !(typeof Blob < "u" && s instanceof Blob) && !(typeof File < "u" && s instanceof File);
2296
+ function I(s, e, t) {
2297
+ if (s == null || typeof s != "object" || s instanceof j) return;
2298
+ if (typeof s.getProxy == "function") {
2299
+ process.env.NODE_ENV !== "production" && console.warn(
2300
+ "[reformer] createForm({ schema }): в схему попал узел формы (FormProxy) — он пропущен. Стройте дерево для createForm БЕЗ формы, а форму донесите до узла вторым проходом (билдер `(model, form?) => …`) либо через render-behavior `patchProps({ form })`."
2301
+ );
2300
2302
  return;
2301
2303
  }
2302
- const s = i, r = s.array;
2303
- if (r && typeof r.__path == "string" && typeof s.item == "function") {
2304
- t.set(r.__path, s.item);
2304
+ if (Array.isArray(s)) {
2305
+ for (const n of s) I(n, e, t);
2305
2306
  return;
2306
2307
  }
2307
- s.value instanceof G ? e.set(s.value, {
2308
- component: s.component,
2309
- componentProps: s.componentProps,
2310
- updateOn: s.updateOn,
2311
- disabled: s.disabled,
2312
- debounce: s.debounce
2313
- }) : process.env.NODE_ENV !== "production" && s.component !== void 0 && ("valueSignal" in s || s.value != null) && console.warn(
2308
+ const r = s, i = r.array;
2309
+ if (i && typeof i.__path == "string" && typeof r.item == "function") {
2310
+ t.set(i.__path, r.item);
2311
+ return;
2312
+ }
2313
+ r.value instanceof j ? e.set(r.value, {
2314
+ component: r.component,
2315
+ componentProps: r.componentProps,
2316
+ updateOn: r.updateOn,
2317
+ disabled: r.disabled,
2318
+ debounce: r.debounce
2319
+ }) : process.env.NODE_ENV !== "production" && r.component !== void 0 && ("valueSignal" in r || r.value != null) && console.warn(
2314
2320
  "[reformer] createForm({ schema }): узел с `component` не распознан как поле — `value` не является сигналом модели. Ожидается `value: model.$.<path>`; проверьте, что не передан `value: model.<path>` (value-прокси) или `valueSignal:`."
2315
2321
  );
2316
- for (const [n, a] of Object.entries(s))
2317
- n !== "value" && D(a, e, t);
2322
+ for (const [n, a] of Object.entries(r))
2323
+ n !== "value" && I(a, e, t);
2318
2324
  }
2319
- function J(i, e, t, s) {
2320
- const r = {};
2325
+ function Q(s, e, t, r) {
2326
+ const i = {};
2321
2327
  for (const [n, a] of Object.entries(e)) {
2322
2328
  const l = t === "" ? n : `${t}.${n}`;
2323
2329
  if (Array.isArray(a))
2324
2330
  continue;
2325
- if (z(a)) {
2326
- r[n] = J(i, a, l, s);
2331
+ if (J(a)) {
2332
+ i[n] = Q(s, a, l, r);
2327
2333
  continue;
2328
2334
  }
2329
- const d = i.signalAt(l);
2335
+ const d = s.signalAt(l);
2330
2336
  if (!d) throw new Error(`createForm({ model }): не найден сигнал для пути "${l}"`);
2331
- const u = s.get(d) ?? {};
2332
- r[n] = { ...u, valueSignal: d };
2337
+ const u = r.get(d) ?? {};
2338
+ i[n] = { ...u, valueSignal: d };
2333
2339
  }
2334
- return r;
2340
+ return i;
2335
2341
  }
2336
- function Y(i, e, t) {
2337
- for (const [s, r] of Object.entries(i)) {
2338
- const n = e === "" ? s : `${e}.${s}`;
2339
- Array.isArray(r) || (z(r) ? Y(r, n, t) : t.push(n));
2342
+ function X(s, e, t) {
2343
+ for (const [r, i] of Object.entries(s)) {
2344
+ const n = e === "" ? r : `${e}.${r}`;
2345
+ Array.isArray(i) || (J(i) ? X(i, n, t) : t.push(n));
2340
2346
  }
2341
2347
  }
2342
- function Q(i) {
2343
- const { model: e, schema: t, behavior: s } = i, r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
2344
- t !== void 0 && D(t, r, n);
2345
- const a = J(e, e.get(), "", r), l = new A(a), d = e.get();
2346
- for (const [o, m] of Object.entries(d)) {
2347
- if (!Array.isArray(m)) continue;
2348
+ function Z(s) {
2349
+ const { model: e, schema: t, behavior: r } = s, i = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
2350
+ t !== void 0 && I(t, i, n);
2351
+ const a = Q(e, e.get(), "", i), l = new A(a), d = e.get();
2352
+ for (const [o, f] of Object.entries(d)) {
2353
+ if (!Array.isArray(f)) continue;
2348
2354
  const c = n.get(o);
2349
2355
  if (!c) continue;
2350
- const h = e[o], p = (y) => Q({ model: y, schema: c(y) }), E = new de(h, p);
2351
- l.fields.set(o, E);
2352
- }
2353
- const u = l.getProxy(), v = [];
2354
- Y(e.get(), "", v);
2355
- for (const o of v) {
2356
- const m = e.signalAt(o), c = l.getFieldByPath(o);
2357
- if (m && c) {
2358
- Z(m, c);
2359
- const h = o.lastIndexOf("."), p = h === -1 ? l : l.getFieldByPath(o.slice(0, h));
2360
- p instanceof A && p.registerFieldSignal(c, m);
2356
+ const v = e[o], p = (y) => Z({ model: y, schema: c(y) }), b = new me(v, p);
2357
+ l.fields.set(o, b);
2358
+ }
2359
+ const u = l.getProxy(), h = [];
2360
+ X(e.get(), "", h);
2361
+ for (const o of h) {
2362
+ const f = e.signalAt(o), c = l.getFieldByPath(o);
2363
+ if (f && c) {
2364
+ se(f, c);
2365
+ const v = o.lastIndexOf("."), p = v === -1 ? l : l.getFieldByPath(o.slice(0, v));
2366
+ p instanceof A && p.registerFieldSignal(c, f);
2361
2367
  }
2362
2368
  }
2363
- return s && l.attachBehaviorCleanup(s.__run(e, u)), u;
2369
+ return r && l.attachBehaviorCleanup(r.__run(e, u)), u;
2370
+ }
2371
+ const pe = (s) => s != null && typeof s == "object" && "model" in s && typeof s.model?.signalAt == "function";
2372
+ function ye(s) {
2373
+ return pe(s) ? Z(s) : new A(s).getProxy();
2374
+ }
2375
+ const ge = () => {
2376
+ };
2377
+ function be(s, e) {
2378
+ if (!e) return;
2379
+ const t = typeof e == "function" ? { schema: e } : e, r = Object.keys(t.steps ?? {}), i = r.map((o) => t.steps?.[o]).filter((o) => o != null), n = t.schema ?? re(
2380
+ () => ne(...i, ...t.extras ? [t.extras] : [])
2381
+ ), a = (o) => {
2382
+ const f = typeof o == "number" ? r[o - 1] : o;
2383
+ return (f != null ? t.steps?.[f] : null) ?? null;
2384
+ }, { strategy: l, debounce: d, liveAfterSubmit: u } = t, h = D(s, n, {
2385
+ strategy: l,
2386
+ debounce: d,
2387
+ liveAfterSubmit: u
2388
+ });
2389
+ return {
2390
+ schema: n,
2391
+ stepSelectors: r,
2392
+ validate: () => h.validate(),
2393
+ validateAll: () => h.validate(),
2394
+ validateStep: (o) => ie(s, a(o) ?? ge, { touch: !0 }),
2395
+ createStepController: (o) => {
2396
+ if (!l || l === "submit") return null;
2397
+ const f = a(o);
2398
+ return f ? D(s, f, { strategy: l, debounce: d, liveAfterSubmit: u }) : null;
2399
+ },
2400
+ controller: h,
2401
+ validating: h.validating
2402
+ };
2403
+ }
2404
+ function Ie(s) {
2405
+ if (!s.model && s.initial === void 0)
2406
+ throw new Error("createCoreForm: provide either `initial` (to create a model) or `model`.");
2407
+ const e = s.model ?? ee(s.initial);
2408
+ s.seed?.(e);
2409
+ const t = ye({
2410
+ model: e,
2411
+ ...s.schema ? { schema: s.schema(e) } : {},
2412
+ ...s.behavior ? { behavior: s.behavior } : {}
2413
+ }), r = be(e, s.validation), i = { model: e, form: t, ...r ? { validation: r } : {} };
2414
+ return s.setup?.(i), i;
2364
2415
  }
2365
- const ce = (i) => i != null && typeof i == "object" && "model" in i && typeof i.model?.signalAt == "function";
2366
- function Ne(i) {
2367
- return ce(i) ? Q(i) : new A(i).getProxy();
2416
+ function Le(s) {
2417
+ const [e] = ae(s), t = e.validation?.controller;
2418
+ return z(() => t?.start(), [t]), e;
2368
2419
  }
2369
- function C(i) {
2370
- return i == null ? !1 : typeof i == "object" && "value" in i && "setValue" in i && "getValue" in i && "validate" in i;
2420
+ function x(s) {
2421
+ return s == null ? !1 : typeof s == "object" && "value" in s && "setValue" in s && "getValue" in s && "validate" in s;
2371
2422
  }
2372
- function he(i) {
2373
- return C(i) && "validators" in i && "asyncValidators" in i && // FieldNode имеет markAsTouched метод
2423
+ function Ee(s) {
2424
+ return x(s) && "validators" in s && "asyncValidators" in s && // FieldNode имеет markAsTouched метод
2374
2425
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2375
- typeof i.markAsTouched == "function" && // У FieldNode нет fields или items
2376
- !("fields" in i) && !("items" in i);
2426
+ typeof s.markAsTouched == "function" && // У FieldNode нет fields или items
2427
+ !("fields" in s) && !("items" in s);
2377
2428
  }
2378
- function fe(i) {
2379
- return C(i) && "getFieldByPath" in i && "fields" in i && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode/ModelArrayNode)
2380
- !("items" in i) && !("push" in i) && !("removeAt" in i);
2429
+ function _e(s) {
2430
+ return x(s) && "getFieldByPath" in s && "fields" in s && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode/ModelArrayNode)
2431
+ !("items" in s) && !("push" in s) && !("removeAt" in s);
2381
2432
  }
2382
- function ve(i) {
2383
- return C(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
2384
- typeof i.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2385
- typeof i.removeAt == "function";
2433
+ function Se(s) {
2434
+ return x(s) && "items" in s && "length" in s && "push" in s && "removeAt" in s && "at" in s && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2435
+ typeof s.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2436
+ typeof s.removeAt == "function";
2386
2437
  }
2387
- function Fe(i) {
2388
- return he(i) ? "FieldNode" : fe(i) ? "GroupNode" : ve(i) ? "ArrayNode" : C(i) ? "FormNode" : "Unknown";
2438
+ function Re(s) {
2439
+ return Ee(s) ? "FieldNode" : _e(s) ? "GroupNode" : Se(s) ? "ArrayNode" : x(s) ? "FormNode" : "Unknown";
2389
2440
  }
2390
- var F = { exports: {} }, P = {};
2391
- var W;
2392
- function me() {
2393
- if (W) return P;
2394
- W = 1;
2395
- var i = H;
2396
- function e(o, m) {
2397
- return o === m && (o !== 0 || 1 / o === 1 / m) || o !== o && m !== m;
2398
- }
2399
- var t = typeof Object.is == "function" ? Object.is : e, s = i.useState, r = i.useEffect, n = i.useLayoutEffect, a = i.useDebugValue;
2400
- function l(o, m) {
2401
- var c = m(), h = s({ inst: { value: c, getSnapshot: m } }), p = h[0].inst, E = h[1];
2441
+ var N = { exports: {} }, P = {};
2442
+ var q;
2443
+ function Ae() {
2444
+ if (q) return P;
2445
+ q = 1;
2446
+ var s = Y;
2447
+ function e(o, f) {
2448
+ return o === f && (o !== 0 || 1 / o === 1 / f) || o !== o && f !== f;
2449
+ }
2450
+ var t = typeof Object.is == "function" ? Object.is : e, r = s.useState, i = s.useEffect, n = s.useLayoutEffect, a = s.useDebugValue;
2451
+ function l(o, f) {
2452
+ var c = f(), v = r({ inst: { value: c, getSnapshot: f } }), p = v[0].inst, b = v[1];
2402
2453
  return n(
2403
2454
  function() {
2404
- p.value = c, p.getSnapshot = m, d(p) && E({ inst: p });
2455
+ p.value = c, p.getSnapshot = f, d(p) && b({ inst: p });
2405
2456
  },
2406
- [o, c, m]
2407
- ), r(
2457
+ [o, c, f]
2458
+ ), i(
2408
2459
  function() {
2409
- return d(p) && E({ inst: p }), o(function() {
2410
- d(p) && E({ inst: p });
2460
+ return d(p) && b({ inst: p }), o(function() {
2461
+ d(p) && b({ inst: p });
2411
2462
  });
2412
2463
  },
2413
2464
  [o]
2414
2465
  ), a(c), c;
2415
2466
  }
2416
2467
  function d(o) {
2417
- var m = o.getSnapshot;
2468
+ var f = o.getSnapshot;
2418
2469
  o = o.value;
2419
2470
  try {
2420
- var c = m();
2471
+ var c = f();
2421
2472
  return !t(o, c);
2422
2473
  } catch {
2423
2474
  return !0;
2424
2475
  }
2425
2476
  }
2426
- function u(o, m) {
2427
- return m();
2477
+ function u(o, f) {
2478
+ return f();
2428
2479
  }
2429
- var v = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : l;
2430
- return P.useSyncExternalStore = i.useSyncExternalStore !== void 0 ? i.useSyncExternalStore : v, P;
2480
+ var h = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : l;
2481
+ return P.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : h, P;
2431
2482
  }
2432
2483
  var T = {};
2433
- var q;
2434
- function pe() {
2435
- return q || (q = 1, process.env.NODE_ENV !== "production" && (function() {
2436
- function i(c, h) {
2437
- return c === h && (c !== 0 || 1 / c === 1 / h) || c !== c && h !== h;
2484
+ var K;
2485
+ function we() {
2486
+ return K || (K = 1, process.env.NODE_ENV !== "production" && (function() {
2487
+ function s(c, v) {
2488
+ return c === v && (c !== 0 || 1 / c === 1 / v) || c !== c && v !== v;
2438
2489
  }
2439
- function e(c, h) {
2440
- v || r.startTransition === void 0 || (v = !0, console.error(
2490
+ function e(c, v) {
2491
+ h || i.startTransition === void 0 || (h = !0, console.error(
2441
2492
  "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."
2442
2493
  ));
2443
- var p = h();
2494
+ var p = v();
2444
2495
  if (!o) {
2445
- var E = h();
2446
- n(p, E) || (console.error(
2496
+ var b = v();
2497
+ n(p, b) || (console.error(
2447
2498
  "The result of getSnapshot should be cached to avoid an infinite loop"
2448
2499
  ), o = !0);
2449
2500
  }
2450
- E = a({
2451
- inst: { value: p, getSnapshot: h }
2501
+ b = a({
2502
+ inst: { value: p, getSnapshot: v }
2452
2503
  });
2453
- var y = E[0].inst, w = E[1];
2504
+ var y = b[0].inst, w = b[1];
2454
2505
  return d(
2455
2506
  function() {
2456
- y.value = p, y.getSnapshot = h, t(y) && w({ inst: y });
2507
+ y.value = p, y.getSnapshot = v, t(y) && w({ inst: y });
2457
2508
  },
2458
- [c, p, h]
2509
+ [c, p, v]
2459
2510
  ), l(
2460
2511
  function() {
2461
2512
  return t(y) && w({ inst: y }), c(function() {
@@ -2466,71 +2517,71 @@ function pe() {
2466
2517
  ), u(p), p;
2467
2518
  }
2468
2519
  function t(c) {
2469
- var h = c.getSnapshot;
2520
+ var v = c.getSnapshot;
2470
2521
  c = c.value;
2471
2522
  try {
2472
- var p = h();
2523
+ var p = v();
2473
2524
  return !n(c, p);
2474
2525
  } catch {
2475
2526
  return !0;
2476
2527
  }
2477
2528
  }
2478
- function s(c, h) {
2479
- return h();
2529
+ function r(c, v) {
2530
+ return v();
2480
2531
  }
2481
2532
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
2482
- 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;
2483
- 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());
2533
+ var i = Y, n = typeof Object.is == "function" ? Object.is : s, a = i.useState, l = i.useEffect, d = i.useLayoutEffect, u = i.useDebugValue, h = !1, o = !1, f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? r : e;
2534
+ T.useSyncExternalStore = i.useSyncExternalStore !== void 0 ? i.useSyncExternalStore : f, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
2484
2535
  })()), T;
2485
2536
  }
2486
- var K;
2487
- function ye() {
2488
- return K || (K = 1, process.env.NODE_ENV === "production" ? F.exports = me() : F.exports = pe()), F.exports;
2537
+ var H;
2538
+ function ke() {
2539
+ return H || (H = 1, process.env.NODE_ENV === "production" ? N.exports = Ae() : N.exports = we()), N.exports;
2489
2540
  }
2490
- var x = ye();
2491
- function ge(i, e) {
2492
- if (i === e) return !0;
2493
- if (i.length !== e.length) return !1;
2494
- for (let t = 0; t < i.length; t++)
2495
- if (i[t] !== e[t]) return !1;
2541
+ var C = ke();
2542
+ function Ve(s, e) {
2543
+ if (s === e) return !0;
2544
+ if (s.length !== e.length) return !1;
2545
+ for (let t = 0; t < s.length; t++)
2546
+ if (s[t] !== e[t]) return !1;
2496
2547
  return !0;
2497
2548
  }
2498
- function R(i, e, t, s) {
2499
- const r = V(null), n = V(i);
2500
- n.current = i;
2549
+ function $(s, e, t, r) {
2550
+ const i = V(null), n = V(s);
2551
+ n.current = s;
2501
2552
  const a = V(e);
2502
2553
  a.current = e;
2503
2554
  const l = V(t);
2504
- if (l.current = t, r.current === null) {
2505
- const v = {};
2506
- for (const o in i)
2507
- v[o] = i[o].value;
2508
- r.current = { ...v, __snapshot: null };
2509
- }
2510
- const d = b(
2511
- (v) => {
2555
+ if (l.current = t, i.current === null) {
2556
+ const h = {};
2557
+ for (const o in s)
2558
+ h[o] = s[o].value;
2559
+ i.current = { ...h, __snapshot: null };
2560
+ }
2561
+ const d = E(
2562
+ (h) => {
2512
2563
  let o = !0;
2513
2564
  return _(() => {
2514
2565
  const c = n.current;
2515
- for (const h in c)
2516
- c[h].value;
2566
+ for (const v in c)
2567
+ c[v].value;
2517
2568
  if (o) {
2518
2569
  o = !1;
2519
2570
  return;
2520
2571
  }
2521
- v();
2572
+ h();
2522
2573
  });
2523
2574
  },
2524
- [s]
2525
- ), u = b(() => {
2526
- const v = r.current, o = n.current, m = {};
2527
- for (const h in o)
2528
- m[h] = o[h].value;
2575
+ [r]
2576
+ ), u = E(() => {
2577
+ const h = i.current, o = n.current, f = {};
2578
+ for (const v in o)
2579
+ f[v] = o[v].value;
2529
2580
  let c = !1;
2530
- for (const h of a.current) {
2531
- const { key: p, useShallowArrayEqual: E } = h, y = m[p], w = v[p];
2532
- if (E) {
2533
- if (!ge(w, y)) {
2581
+ for (const v of a.current) {
2582
+ const { key: p, useShallowArrayEqual: b } = v, y = f[p], w = h[p];
2583
+ if (b) {
2584
+ if (!Ve(w, y)) {
2534
2585
  c = !0;
2535
2586
  break;
2536
2587
  }
@@ -2539,26 +2590,26 @@ function R(i, e, t, s) {
2539
2590
  break;
2540
2591
  }
2541
2592
  }
2542
- if (!c && v.__snapshot)
2543
- return v.__snapshot;
2544
- for (const h in o)
2545
- v[h] = m[h];
2546
- return v.__snapshot = l.current(m), v.__snapshot;
2547
- }, [s]);
2548
- return x.useSyncExternalStore(d, u, u);
2593
+ if (!c && h.__snapshot)
2594
+ return h.__snapshot;
2595
+ for (const v in o)
2596
+ h[v] = f[v];
2597
+ return h.__snapshot = l.current(f), h.__snapshot;
2598
+ }, [r]);
2599
+ return C.useSyncExternalStore(d, u, u);
2549
2600
  }
2550
- function Ee(i) {
2601
+ function Oe(s) {
2551
2602
  const e = {
2552
- value: i.value,
2553
- disabled: i.disabled,
2554
- errors: i.errors,
2555
- pending: i.pending,
2556
- valid: i.valid,
2557
- invalid: i.invalid,
2558
- touched: i.touched,
2559
- dirty: i.dirty,
2560
- shouldShowError: i.shouldShowError,
2561
- componentProps: i.componentProps
2603
+ value: s.value,
2604
+ disabled: s.disabled,
2605
+ errors: s.errors,
2606
+ pending: s.pending,
2607
+ valid: s.valid,
2608
+ invalid: s.invalid,
2609
+ touched: s.touched,
2610
+ dirty: s.dirty,
2611
+ shouldShowError: s.shouldShowError,
2612
+ componentProps: s.componentProps
2562
2613
  }, t = [
2563
2614
  { key: "value" },
2564
2615
  { key: "disabled" },
@@ -2570,34 +2621,34 @@ function Ee(i) {
2570
2621
  { key: "dirty" },
2571
2622
  { key: "shouldShowError" },
2572
2623
  { key: "componentProps" }
2573
- ], s = b(
2574
- (r) => ({
2575
- value: r.value,
2576
- pending: r.pending,
2577
- disabled: r.disabled,
2578
- errors: r.errors,
2579
- valid: r.valid,
2580
- invalid: r.invalid,
2581
- touched: r.touched,
2582
- dirty: r.dirty,
2583
- shouldShowError: r.shouldShowError,
2584
- componentProps: r.componentProps
2624
+ ], r = E(
2625
+ (i) => ({
2626
+ value: i.value,
2627
+ pending: i.pending,
2628
+ disabled: i.disabled,
2629
+ errors: i.errors,
2630
+ valid: i.valid,
2631
+ invalid: i.invalid,
2632
+ touched: i.touched,
2633
+ dirty: i.dirty,
2634
+ shouldShowError: i.shouldShowError,
2635
+ componentProps: i.componentProps
2585
2636
  }),
2586
2637
  []
2587
2638
  );
2588
- return R(e, t, s, i);
2639
+ return $(e, t, r, s);
2589
2640
  }
2590
- function be(i) {
2641
+ function Fe(s) {
2591
2642
  const e = {
2592
- value: i.value,
2593
- length: i.length,
2594
- errors: i.errors,
2595
- pending: i.pending,
2596
- valid: i.valid,
2597
- invalid: i.invalid,
2598
- touched: i.touched,
2599
- dirty: i.dirty,
2600
- disabled: i.disabled
2643
+ value: s.value,
2644
+ length: s.length,
2645
+ errors: s.errors,
2646
+ pending: s.pending,
2647
+ valid: s.valid,
2648
+ invalid: s.invalid,
2649
+ touched: s.touched,
2650
+ dirty: s.dirty,
2651
+ disabled: s.disabled
2601
2652
  }, t = [
2602
2653
  { key: "value" },
2603
2654
  { key: "length" },
@@ -2608,24 +2659,24 @@ function be(i) {
2608
2659
  { key: "touched" },
2609
2660
  { key: "dirty" },
2610
2661
  { key: "disabled" }
2611
- ], s = b(
2612
- (r) => ({
2613
- value: r.value,
2614
- length: r.length,
2615
- pending: r.pending,
2616
- errors: r.errors,
2617
- valid: r.valid,
2618
- invalid: r.invalid,
2619
- touched: r.touched,
2620
- dirty: r.dirty,
2621
- disabled: r.disabled
2662
+ ], r = E(
2663
+ (i) => ({
2664
+ value: i.value,
2665
+ length: i.length,
2666
+ pending: i.pending,
2667
+ errors: i.errors,
2668
+ valid: i.valid,
2669
+ invalid: i.invalid,
2670
+ touched: i.touched,
2671
+ dirty: i.dirty,
2672
+ disabled: i.disabled
2622
2673
  }),
2623
2674
  []
2624
2675
  );
2625
- return R(e, t, s, i);
2676
+ return $(e, t, r, s);
2626
2677
  }
2627
- function _e() {
2628
- const i = b(
2678
+ function Ne() {
2679
+ const s = E(
2629
2680
  () => ({
2630
2681
  value: [],
2631
2682
  length: 0,
@@ -2639,105 +2690,108 @@ function _e() {
2639
2690
  }),
2640
2691
  []
2641
2692
  );
2642
- return R({}, [], i);
2693
+ return $({}, [], s);
2643
2694
  }
2644
- function Me(i) {
2645
- const e = i && "length" in i && "map" in i;
2646
- return i ? e ? be(i) : Ee(i) : _e();
2695
+ function $e(s) {
2696
+ const e = s && "length" in s && "map" in s;
2697
+ return s ? e ? Fe(s) : Oe(s) : Ne();
2647
2698
  }
2648
- function Ce(i) {
2649
- const e = V({ value: i.value.value }), t = b(
2650
- (r) => {
2699
+ function Ge(s) {
2700
+ const e = V({ value: s.value.value }), t = E(
2701
+ (i) => {
2651
2702
  let n = !0;
2652
2703
  return _(() => {
2653
- if (i.value.value, n) {
2704
+ if (s.value.value, n) {
2654
2705
  n = !1;
2655
2706
  return;
2656
2707
  }
2657
- r();
2708
+ i();
2658
2709
  });
2659
2710
  },
2660
- [i]
2661
- ), s = b(() => {
2662
- const r = i.value.value;
2663
- return e.current.value === r ? e.current.value : (e.current.value = r, r);
2664
- }, [i]);
2665
- return x.useSyncExternalStore(t, s, s);
2711
+ [s]
2712
+ ), r = E(() => {
2713
+ const i = s.value.value;
2714
+ return e.current.value === i ? e.current.value : (e.current.value = i, i);
2715
+ }, [s]);
2716
+ return C.useSyncExternalStore(t, r, r);
2666
2717
  }
2667
- function xe(i) {
2668
- const e = V({ length: i.length.value }), t = b(
2669
- (r) => {
2718
+ function je(s) {
2719
+ const e = V({ length: s.length.value }), t = E(
2720
+ (i) => {
2670
2721
  let n = !0;
2671
2722
  return _(() => {
2672
- if (i.length.value, n) {
2723
+ if (s.length.value, n) {
2673
2724
  n = !1;
2674
2725
  return;
2675
2726
  }
2676
- r();
2727
+ i();
2677
2728
  });
2678
2729
  },
2679
- [i]
2680
- ), s = b(() => {
2681
- const r = i.length.value;
2682
- return e.current.length === r ? e.current.length : (e.current.length = r, r);
2683
- }, [i]);
2684
- return x.useSyncExternalStore(t, s, s);
2730
+ [s]
2731
+ ), r = E(() => {
2732
+ const i = s.length.value;
2733
+ return e.current.length === i ? e.current.length : (e.current.length = i, i);
2734
+ }, [s]);
2735
+ return C.useSyncExternalStore(t, r, r);
2685
2736
  }
2686
- function Pe(i) {
2687
- const { model: e, schema: t, strategy: s, debounce: r, liveAfterSubmit: n } = i, a = ee(
2688
- () => se(e, t, { strategy: s, debounce: r, liveAfterSubmit: n }),
2689
- [e, t, s, r, n]
2737
+ function Be(s) {
2738
+ const { model: e, schema: t, strategy: r, debounce: i, liveAfterSubmit: n } = s, a = oe(
2739
+ () => D(e, t, { strategy: r, debounce: i, liveAfterSubmit: n }),
2740
+ [e, t, r, i, n]
2690
2741
  );
2691
- te(() => a.start(), [a]);
2692
- const l = x.useSyncExternalStore(
2693
- b((u) => a.validating.subscribe(u), [a]),
2742
+ z(() => a.start(), [a]);
2743
+ const l = C.useSyncExternalStore(
2744
+ E((u) => a.validating.subscribe(u), [a]),
2694
2745
  () => a.validating.peek(),
2695
2746
  () => !1
2696
2747
  // SSR: прогон не идёт
2697
- ), d = b(() => a.validate(), [a]);
2748
+ ), d = E(() => a.validate(), [a]);
2698
2749
  return { submit: d, validate: d, isValidating: l };
2699
2750
  }
2700
- const Te = Object.freeze({ runtime: "reformer-core", v: 1 });
2751
+ const Ue = Object.freeze({ runtime: "reformer-core", v: 1 });
2701
2752
  export {
2702
- B as ArrayNode,
2703
- Te as CORE_RUNTIME_TOKEN,
2753
+ W as ArrayNode,
2754
+ Ue as CORE_RUNTIME_TOKEN,
2704
2755
  S as ErrorStrategy,
2705
- ne as FieldNode,
2756
+ de as FieldNode,
2706
2757
  k as FormErrorHandler,
2707
2758
  M as FormNode,
2708
- oe as FormSubmitter,
2759
+ he as FormSubmitter,
2709
2760
  A as GroupNode,
2710
- de as ModelArrayNode,
2711
- ue as NodeFactory,
2712
- I as SubscriptionManager,
2713
- Ue as computeFrom,
2714
- Be as copyFrom,
2715
- Ne as createForm,
2716
- Q as createFormFromModel,
2717
- Le as createModel,
2718
- tt as disableWhen,
2719
- st as enableWhen,
2720
- Ze as getNodeForSignal,
2721
- Fe as getNodeType,
2722
- ve as isArrayNode,
2723
- $ as isDerived,
2724
- he as isFieldNode,
2725
- C as isFormNode,
2726
- fe as isGroupNode,
2727
- Re as isModelContainerSignal,
2728
- $e as markDerived,
2729
- Z as registerSignalNode,
2730
- We as resetWhen,
2731
- qe as revalidateWhen,
2732
- Ke as runOutsideEffect,
2733
- He as safeCallback,
2734
- ze as safeDebouncedCallback,
2735
- Je as syncFields,
2736
- Ye as transformValue,
2737
- Ge as unmarkDerived,
2738
- xe as useArrayLength,
2739
- Me as useFormControl,
2740
- Ce as useFormControlValue,
2741
- Pe as useFormValidation,
2742
- Qe as watchField
2761
+ me as ModelArrayNode,
2762
+ ve as NodeFactory,
2763
+ L as SubscriptionManager,
2764
+ be as buildValidation,
2765
+ Je as computeFrom,
2766
+ Qe as copyFrom,
2767
+ Ie as createCoreForm,
2768
+ ye as createForm,
2769
+ Z as createFormFromModel,
2770
+ ee as createModel,
2771
+ ut as disableWhen,
2772
+ dt as enableWhen,
2773
+ ot as getNodeForSignal,
2774
+ Re as getNodeType,
2775
+ Se as isArrayNode,
2776
+ G as isDerived,
2777
+ Ee as isFieldNode,
2778
+ x as isFormNode,
2779
+ _e as isGroupNode,
2780
+ Ke as isModelContainerSignal,
2781
+ He as markDerived,
2782
+ se as registerSignalNode,
2783
+ Xe as resetWhen,
2784
+ Ze as revalidateWhen,
2785
+ et as runOutsideEffect,
2786
+ tt as safeCallback,
2787
+ st as safeDebouncedCallback,
2788
+ rt as syncFields,
2789
+ it as transformValue,
2790
+ Ye as unmarkDerived,
2791
+ je as useArrayLength,
2792
+ Le as useFormBundle,
2793
+ $e as useFormControl,
2794
+ Ge as useFormControlValue,
2795
+ Be as useFormValidation,
2796
+ nt as watchField
2743
2797
  };