@reformer/core 2.0.0-beta.6 → 2.0.0-beta.7

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,11 +1,11 @@
1
- import { d as y, w as u, E, r as U } from "./behaviors-2HSqHPb4.js";
2
- import { i as Ee } from "./behaviors-2HSqHPb4.js";
3
- import { i as C, a as D, A as j, V as q, T as K } from "./validators-gXoHPdqM.js";
4
- import { g as Se, c as we, d as Ae, v as Ve, b as ke } from "./validators-gXoHPdqM.js";
5
- import { V as H, B as W, c as R } from "./registry-helpers-BRxAr6nG.js";
6
- import { R as Oe, a as Fe, e as Pe, b as Ce, g as De, t as Re } from "./registry-helpers-BRxAr6nG.js";
7
- import { v4 as z } from "uuid";
8
- import B, { useRef as L, useCallback as b } from "react";
1
+ import { d as y, w as u, E, r as j } from "./behaviors-DyPzh2-X.js";
2
+ import { i as Se } from "./behaviors-DyPzh2-X.js";
3
+ import { i as R, a as T, A as q, V as K, T as H } from "./validators-CWdzevnC.js";
4
+ import { g as Ae, c as Ve, d as ke, v as xe, b as Pe } from "./validators-CWdzevnC.js";
5
+ import { V as W, B as z, c as D } from "./registry-helpers--8-OogF8.js";
6
+ import { R as Fe, a as Ce, e as Re, b as Te, g as De, t as Ne } from "./registry-helpers--8-OogF8.js";
7
+ import { v4 as J } from "uuid";
8
+ import L, { useRef as G, useCallback as b } from "react";
9
9
  class F {
10
10
  // ============================================================================
11
11
  // Protected состояние (для Template Method паттерна)
@@ -100,17 +100,17 @@ class F {
100
100
  */
101
101
  getErrors(e) {
102
102
  const t = this.errors.value;
103
- return e ? t.filter((i) => {
104
- if (e.code !== void 0 && !(Array.isArray(e.code) ? e.code : [e.code]).includes(i.code) || e.message !== void 0 && !i.message.toLowerCase().includes(e.message.toLowerCase()))
103
+ return e ? t.filter((r) => {
104
+ 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()))
105
105
  return !1;
106
106
  if (e.params !== void 0) {
107
- if (!i.params)
107
+ if (!r.params)
108
108
  return !1;
109
- for (const [r, s] of Object.entries(e.params))
110
- if (i.params[r] !== s)
109
+ for (const [i, a] of Object.entries(e.params))
110
+ if (r.params[i] !== a)
111
111
  return !1;
112
112
  }
113
- return !(e.predicate !== void 0 && !e.predicate(i));
113
+ return !(e.predicate !== void 0 && !e.predicate(r));
114
114
  }) : t;
115
115
  }
116
116
  // ============================================================================
@@ -283,7 +283,7 @@ class F {
283
283
  onEnable() {
284
284
  }
285
285
  }
286
- class P {
286
+ class C {
287
287
  /**
288
288
  * Хранилище подписок
289
289
  * Ключ: уникальный идентификатор подписки
@@ -451,7 +451,11 @@ class P {
451
451
  this.clear();
452
452
  }
453
453
  }
454
- var A = /* @__PURE__ */ ((a) => (a.THROW = "throw", a.LOG = "log", a.CONVERT = "convert", a))(A || {});
454
+ let Y = 0;
455
+ function S(s) {
456
+ return `${s}-${++Y}`;
457
+ }
458
+ var V = /* @__PURE__ */ ((s) => (s.THROW = "throw", s.LOG = "log", s.CONVERT = "convert", s))(V || {});
455
459
  class O {
456
460
  /**
457
461
  * Обработать ошибку согласно заданной стратегии
@@ -492,9 +496,9 @@ class O {
492
496
  * }
493
497
  * ```
494
498
  */
495
- static handle(e, t, i = "throw") {
496
- const r = this.extractMessage(e);
497
- switch (i) {
499
+ static handle(e, t, r = "throw") {
500
+ const i = this.extractMessage(e);
501
+ switch (r) {
498
502
  case "throw":
499
503
  throw e;
500
504
  case "log":
@@ -502,7 +506,7 @@ class O {
502
506
  case "convert":
503
507
  return {
504
508
  code: "validator_error",
505
- message: r,
509
+ message: i,
506
510
  params: { field: t }
507
511
  };
508
512
  }
@@ -558,11 +562,11 @@ class O {
558
562
  * // { code: 'required', message: 'This field is required', field: 'email' }
559
563
  * ```
560
564
  */
561
- static createValidationError(e, t, i) {
565
+ static createValidationError(e, t, r) {
562
566
  return {
563
567
  code: e,
564
568
  message: t,
565
- params: i ? { field: i } : void 0
569
+ params: r ? { field: r } : void 0
566
570
  };
567
571
  }
568
572
  /**
@@ -584,7 +588,7 @@ class O {
584
588
  return typeof e == "object" && e !== null && "code" in e && "message" in e && typeof e.code == "string" && typeof e.message == "string";
585
589
  }
586
590
  }
587
- class J extends F {
591
+ class Q extends F {
588
592
  // ============================================================================
589
593
  // Приватные сигналы
590
594
  // ============================================================================
@@ -626,7 +630,7 @@ class J extends F {
626
630
  * Менеджер подписок для централизованного cleanup
627
631
  * Использует SubscriptionManager вместо массива для управления подписками
628
632
  */
629
- disposers = new P();
633
+ disposers = new C();
630
634
  component;
631
635
  // ============================================================================
632
636
  // Конструктор
@@ -645,12 +649,12 @@ class J extends F {
645
649
  setValue(e, t) {
646
650
  if (this._value.value = e, this._dirty.value = !0, t?.emitEvent === !1)
647
651
  return;
648
- const i = this.validators.length > 0 || this.asyncValidators.length > 0, r = this._errors.value.length > 0;
652
+ const r = this.validators.length > 0 || this.asyncValidators.length > 0, i = this._errors.value.length > 0;
649
653
  if (this.updateOn === "change") {
650
654
  this.validate();
651
655
  return;
652
656
  }
653
- r && i && this.validate();
657
+ i && r && this.validate();
654
658
  }
655
659
  patchValue(e) {
656
660
  this.setValue(e);
@@ -729,15 +733,15 @@ class J extends F {
729
733
  */
730
734
  async validate(e) {
731
735
  const t = e?.debounce ?? this.debounceMs;
732
- return t > 0 && this.asyncValidators.length > 0 ? new Promise((i) => {
733
- const r = this.currentValidationId;
734
- this.validateDebounceResolve && this.validateDebounceResolve(!1), this.validateDebounceTimer && clearTimeout(this.validateDebounceTimer), this.validateDebounceResolve = i, this.validateDebounceTimer = setTimeout(async () => {
735
- if (this.validateDebounceResolve = void 0, r !== this.currentValidationId) {
736
- i(!1);
736
+ return t > 0 && this.asyncValidators.length > 0 ? new Promise((r) => {
737
+ const i = this.currentValidationId;
738
+ this.validateDebounceResolve && this.validateDebounceResolve(!1), this.validateDebounceTimer && clearTimeout(this.validateDebounceTimer), this.validateDebounceResolve = r, this.validateDebounceTimer = setTimeout(async () => {
739
+ if (this.validateDebounceResolve = void 0, i !== this.currentValidationId) {
740
+ r(!1);
737
741
  return;
738
742
  }
739
- const s = await this.validateImmediate();
740
- i(s);
743
+ const a = await this.validateImmediate();
744
+ r(a);
741
745
  }, t);
742
746
  }) : this.validateImmediate();
743
747
  }
@@ -756,21 +760,21 @@ class J extends F {
756
760
  this.currentAbortController = e;
757
761
  const { signal: t } = e;
758
762
  ++this.currentValidationId;
759
- const i = [];
760
- for (const s of this.validators) {
761
- const n = s(this._value.value);
762
- n && i.push(n);
763
+ const r = [];
764
+ for (const a of this.validators) {
765
+ const n = a(this._value.value);
766
+ n && r.push(n);
763
767
  }
764
768
  if (t.aborted)
765
769
  return !1;
766
- if (i.length > 0)
767
- return this._errors.value = i, this._status.value = "invalid", !1;
770
+ if (r.length > 0)
771
+ return this._errors.value = r, this._status.value = "invalid", !1;
768
772
  if (this.asyncValidators.length > 0) {
769
773
  if (t.aborted)
770
774
  return !1;
771
775
  this._pending.value = !0, this._status.value = "pending";
772
776
  try {
773
- const s = await Promise.all(
777
+ const a = await Promise.all(
774
778
  this.asyncValidators.map(async (o) => {
775
779
  if (t.aborted)
776
780
  throw new DOMException("Validation aborted", "AbortError");
@@ -785,7 +789,7 @@ class J extends F {
785
789
  return O.handle(
786
790
  l,
787
791
  "FieldNode AsyncValidator",
788
- A.CONVERT
792
+ V.CONVERT
789
793
  );
790
794
  }
791
795
  })
@@ -793,13 +797,13 @@ class J extends F {
793
797
  if (t.aborted)
794
798
  return !1;
795
799
  this._pending.value = !1;
796
- const n = s.filter(Boolean);
800
+ const n = a.filter(Boolean);
797
801
  if (n.length > 0)
798
802
  return this._errors.value = n, this._status.value = "invalid", !1;
799
- } catch (s) {
800
- if (s instanceof DOMException && s.name === "AbortError")
803
+ } catch (a) {
804
+ if (a instanceof DOMException && a.name === "AbortError")
801
805
  return !1;
802
- throw s;
806
+ throw a;
803
807
  }
804
808
  }
805
809
  return t.aborted ? !1 : ((this.validators.length > 0 || this.asyncValidators.length > 0) && (this._errors.value = [], this._status.value = "valid"), this._errors.value.length === 0);
@@ -915,10 +919,10 @@ class J extends F {
915
919
  */
916
920
  watch(e) {
917
921
  const t = E(() => {
918
- const r = this.value.value;
919
- e(r);
920
- }), i = `watch-${Date.now()}-${Math.random()}`;
921
- return this.disposers.add(i, t);
922
+ const i = this.value.value;
923
+ e(i);
924
+ }), r = S("watch");
925
+ return this.disposers.add(r, t);
922
926
  }
923
927
  /**
924
928
  * Вычисляемое значение из других полей
@@ -943,11 +947,11 @@ class J extends F {
943
947
  * ```
944
948
  */
945
949
  computeFrom(e, t) {
946
- const i = E(() => {
947
- const s = e.map((o) => o.value), n = t(...s);
950
+ const r = E(() => {
951
+ const a = e.map((o) => o.value), n = t(...a);
948
952
  this.setValue(n, { emitEvent: !1 });
949
- }), r = `computeFrom-${Date.now()}-${Math.random()}`;
950
- return this.disposers.add(r, i);
953
+ }), i = S("computeFrom");
954
+ return this.disposers.add(i, r);
951
955
  }
952
956
  /**
953
957
  * Очистить все ресурсы и таймеры
@@ -973,7 +977,7 @@ class J extends F {
973
977
  this.disposers.dispose(), this.validateDebounceTimer && (clearTimeout(this.validateDebounceTimer), this.validateDebounceTimer = void 0), this.validateDebounceResolve && (this.validateDebounceResolve(!1), this.validateDebounceResolve = void 0), this.currentAbortController && (this.currentAbortController.abort(), this.currentAbortController = void 0);
974
978
  }
975
979
  }
976
- class Y {
980
+ class X {
977
981
  form;
978
982
  constructor(e) {
979
983
  this.form = e;
@@ -989,8 +993,8 @@ class Y {
989
993
  * @param validators Зарегистрированные валидаторы
990
994
  */
991
995
  async apply(e) {
992
- const { validatorsByField: t, treeValidators: i } = this.groupValidators(e);
993
- await this.applyFieldValidators(t), this.applyTreeValidators(i);
996
+ const { validatorsByField: t, treeValidators: r } = this.groupValidators(e);
997
+ await this.applyFieldValidators(t), this.applyTreeValidators(r);
994
998
  }
995
999
  /**
996
1000
  * Группировка валидаторов по типам
@@ -1003,15 +1007,15 @@ class Y {
1003
1007
  * @returns Сгруппированные валидаторы
1004
1008
  */
1005
1009
  groupValidators(e) {
1006
- const t = /* @__PURE__ */ new Map(), i = [];
1007
- for (const r of e)
1008
- if (r.type === "tree")
1009
- i.push(r);
1010
+ const t = /* @__PURE__ */ new Map(), r = [];
1011
+ for (const i of e)
1012
+ if (i.type === "tree")
1013
+ r.push(i);
1010
1014
  else {
1011
- const s = t.get(r.fieldPath) || [];
1012
- s.push(r), t.set(r.fieldPath, s);
1015
+ const a = t.get(i.fieldPath) || [];
1016
+ a.push(i), t.set(i.fieldPath, a);
1013
1017
  }
1014
- return { validatorsByField: t, treeValidators: i };
1018
+ return { validatorsByField: t, treeValidators: r };
1015
1019
  }
1016
1020
  /**
1017
1021
  * Применение field валидаторов к полям
@@ -1025,37 +1029,44 @@ class Y {
1025
1029
  * @param validatorsByField Валидаторы, сгруппированные по полям
1026
1030
  */
1027
1031
  async applyFieldValidators(e) {
1028
- for (const [t, i] of e) {
1029
- const r = this.form.getFieldByPath(t);
1030
- if (!r) {
1032
+ for (const [t, r] of e) {
1033
+ const i = this.form.getFieldByPath(t);
1034
+ if (!i) {
1031
1035
  console.warn(`Field ${t} not found in GroupNode`);
1032
1036
  continue;
1033
1037
  }
1034
- if (!C(r) && !D(r)) {
1038
+ if (!R(i) && !T(i)) {
1035
1039
  process.env.NODE_ENV !== "production" && console.warn(`Validation can only run on FieldNode or ArrayNode, skipping ${t}`);
1036
1040
  continue;
1037
1041
  }
1038
- const s = [];
1042
+ const a = [];
1039
1043
  let n;
1040
- if (D(r)) {
1041
- const o = r.getValue();
1042
- n = new j(this.form, t, o);
1044
+ if (T(i)) {
1045
+ const o = i.getValue();
1046
+ n = new q(this.form, t, o);
1043
1047
  } else
1044
- n = new q(this.form, t, r);
1045
- for (const o of i)
1048
+ n = new K(this.form, t, i);
1049
+ for (const o of r)
1046
1050
  if (!(o.condition && !this.checkCondition(o.condition)))
1047
1051
  try {
1048
1052
  let l = null;
1049
- const d = n.value(), m = o.validator;
1050
- o.type === "sync" ? l = m(d, n) : o.type === "async" && (l = await m(d, n)), l && s.push(l);
1053
+ const h = n.value();
1054
+ if (o.type === "sync") {
1055
+ const m = o.validator;
1056
+ l = m(h, n);
1057
+ } else if (o.type === "async") {
1058
+ const m = o.validator;
1059
+ l = await m(h, n);
1060
+ }
1061
+ l && a.push(l);
1051
1062
  } catch (l) {
1052
1063
  O.handle(
1053
1064
  l,
1054
1065
  `ValidationApplicator: validator for ${t}`,
1055
- A.LOG
1066
+ V.LOG
1056
1067
  );
1057
1068
  }
1058
- s.length > 0 ? r.setErrors(s) : r.clearErrors();
1069
+ a.length > 0 ? i.setErrors(a) : i.clearErrors();
1059
1070
  }
1060
1071
  }
1061
1072
  /**
@@ -1068,24 +1079,24 @@ class Y {
1068
1079
  */
1069
1080
  applyTreeValidators(e) {
1070
1081
  for (const t of e) {
1071
- const i = new K(this.form);
1082
+ const r = new H(this.form);
1072
1083
  if (!(t.condition && !this.checkCondition(t.condition)))
1073
1084
  try {
1074
1085
  if (t.type !== "tree")
1075
1086
  continue;
1076
- const r = t.validator(i);
1077
- if (r && t.options && "targetField" in t.options) {
1078
- const s = t.options.targetField;
1079
- if (s) {
1080
- const n = this.form.getFieldByPath(String(s));
1081
- if (n && C(n)) {
1082
- const o = n.errors.value;
1083
- n.setErrors([...o, r]);
1087
+ const i = t.validator, a = i(r);
1088
+ if (a && t.options && "targetField" in t.options) {
1089
+ const n = t.options.targetField;
1090
+ if (n) {
1091
+ const o = this.form.getFieldByPath(String(n));
1092
+ if (o && R(o)) {
1093
+ const l = o.errors.value;
1094
+ o.setErrors([...l, a]);
1084
1095
  }
1085
1096
  }
1086
1097
  }
1087
- } catch (r) {
1088
- O.handle(r, "ValidationApplicator: tree validator", A.LOG);
1098
+ } catch (i) {
1099
+ O.handle(i, "ValidationApplicator: tree validator", V.LOG);
1089
1100
  }
1090
1101
  }
1091
1102
  }
@@ -1102,11 +1113,11 @@ class Y {
1102
1113
  const t = this.form.getFieldByPath(e.fieldPath);
1103
1114
  if (!t)
1104
1115
  return !1;
1105
- const i = t.value.value;
1106
- return e.conditionFn(i);
1116
+ const r = t.value.value;
1117
+ return e.conditionFn(r);
1107
1118
  }
1108
1119
  }
1109
- class Q {
1120
+ class Z {
1110
1121
  /**
1111
1122
  * Парсит путь в массив сегментов
1112
1123
  *
@@ -1133,22 +1144,22 @@ class Q {
1133
1144
  */
1134
1145
  parsePath(e) {
1135
1146
  const t = [];
1136
- let i = "", r = !1;
1137
- for (let s = 0; s < e.length; s++) {
1138
- const n = e[s];
1139
- n === "[" ? (r = !0, i += n) : n === "]" ? (r = !1, i += n) : n === "." && !r ? i && (this.addSegment(t, i), i = "") : i += n;
1147
+ let r = "", i = !1;
1148
+ for (let a = 0; a < e.length; a++) {
1149
+ const n = e[a];
1150
+ n === "[" ? (i = !0, r += n) : n === "]" ? (i = !1, r += n) : n === "." && !i ? r && (this.addSegment(t, r), r = "") : r += n;
1140
1151
  }
1141
- return i && this.addSegment(t, i), t;
1152
+ return r && this.addSegment(t, r), t;
1142
1153
  }
1143
1154
  /**
1144
1155
  * Добавляет сегмент в массив, обрабатывая массивы
1145
1156
  * @private
1146
1157
  */
1147
1158
  addSegment(e, t) {
1148
- const i = t.match(/^(.+)\[(\d+)\]$/);
1149
- i ? e.push({
1150
- key: i[1],
1151
- index: parseInt(i[2], 10)
1159
+ const r = t.match(/^(.+)\[(\d+)\]$/);
1160
+ r ? e.push({
1161
+ key: r[1],
1162
+ index: parseInt(r[2], 10)
1152
1163
  }) : e.push({ key: t });
1153
1164
  }
1154
1165
  /**
@@ -1183,16 +1194,16 @@ class Q {
1183
1194
  * ```
1184
1195
  */
1185
1196
  getValueByPath(e, t) {
1186
- const i = this.parsePath(t);
1187
- let r = e;
1188
- for (const s of i) {
1189
- if (r == null) return;
1190
- if (r = r[s.key], s.index !== void 0) {
1191
- if (!Array.isArray(r)) return;
1192
- r = r[s.index];
1197
+ const r = this.parsePath(t);
1198
+ let i = e;
1199
+ for (const a of r) {
1200
+ if (i == null) return;
1201
+ if (i = i[a.key], a.index !== void 0) {
1202
+ if (!Array.isArray(i)) return;
1203
+ i = i[a.index];
1193
1204
  }
1194
1205
  }
1195
- return r;
1206
+ return i;
1196
1207
  }
1197
1208
  /**
1198
1209
  * Устанавливает значение по пути в объекте (мутирует объект)
@@ -1221,31 +1232,31 @@ class Q {
1221
1232
  * // obj3.items[0].title === 'New'
1222
1233
  * ```
1223
1234
  */
1224
- setValueByPath(e, t, i) {
1225
- const r = this.parsePath(t);
1226
- if (r.length === 0)
1235
+ setValueByPath(e, t, r) {
1236
+ const i = this.parsePath(t);
1237
+ if (i.length === 0)
1227
1238
  throw new Error("Cannot set value: empty path");
1228
- let s = e;
1229
- for (let o = 0; o < r.length - 1; o++) {
1230
- const l = r[o];
1231
- let d = s[l.key];
1239
+ let a = e;
1240
+ for (let o = 0; o < i.length - 1; o++) {
1241
+ const l = i[o];
1242
+ let h = a[l.key];
1232
1243
  if (l.index !== void 0) {
1233
- if (!Array.isArray(d))
1234
- throw new Error(`Expected array at path segment: ${l.key}, but got ${typeof d}`);
1235
- s = d[l.index];
1244
+ if (!Array.isArray(h))
1245
+ throw new Error(`Expected array at path segment: ${l.key}, but got ${typeof h}`);
1246
+ a = h[l.index];
1236
1247
  } else
1237
- d == null && (s[l.key] = {}, d = s[l.key]), s = d;
1248
+ h == null && (a[l.key] = {}, h = a[l.key]), a = h;
1238
1249
  }
1239
- const n = r[r.length - 1];
1250
+ const n = i[i.length - 1];
1240
1251
  if (n.index !== void 0) {
1241
- const o = s[n.key];
1252
+ const o = a[n.key];
1242
1253
  if (!Array.isArray(o))
1243
1254
  throw new Error(
1244
1255
  `Expected array at path segment: ${n.key}, but got ${typeof o}`
1245
1256
  );
1246
- o[n.index] = i;
1257
+ o[n.index] = r;
1247
1258
  } else
1248
- s[n.key] = i;
1259
+ a[n.key] = r;
1249
1260
  }
1250
1261
  /**
1251
1262
  * Получить значение из FormNode по пути
@@ -1282,9 +1293,9 @@ class Q {
1282
1293
  * ```
1283
1294
  */
1284
1295
  getFormNodeValue(e, t) {
1285
- const i = this.getNodeByPath(e, t);
1286
- if (i != null)
1287
- return this.isFormNode(i) ? i.value.value : i;
1296
+ const r = this.getNodeByPath(e, t);
1297
+ if (r != null)
1298
+ return this.isFormNode(r) ? r.value.value : r;
1288
1299
  }
1289
1300
  /**
1290
1301
  * Type guard для проверки, является ли объект FormNode
@@ -1342,40 +1353,40 @@ class Q {
1342
1353
  * ```
1343
1354
  */
1344
1355
  getNodeByPath(e, t) {
1345
- const i = this.parsePath(t);
1346
- let r = e;
1347
- for (const s of i) {
1348
- if (r == null) return null;
1349
- const n = r;
1356
+ const r = this.parsePath(t);
1357
+ let i = e;
1358
+ for (const a of r) {
1359
+ if (i == null) return null;
1360
+ const n = i;
1350
1361
  if (n.fields && n.fields instanceof Map) {
1351
- if (r = n.fields.get(s.key), s.index === void 0) {
1352
- if (r == null) return null;
1362
+ if (i = n.fields.get(a.key), a.index === void 0) {
1363
+ if (i == null) return null;
1353
1364
  continue;
1354
1365
  }
1355
- } else if (s.index !== void 0 && n.items) {
1366
+ } else if (a.index !== void 0 && n.items) {
1356
1367
  const o = n.items.value || n.items;
1357
- if (!Array.isArray(o) || (r = o[s.index], r == null)) return null;
1368
+ if (!Array.isArray(o) || (i = o[a.index], i == null)) return null;
1358
1369
  continue;
1359
- } else if (s.index === void 0) {
1360
- if (r = n[s.key], r == null) return null;
1370
+ } else if (a.index === void 0) {
1371
+ if (i = n[a.key], i == null) return null;
1361
1372
  continue;
1362
1373
  }
1363
- if (r && s.index !== void 0 && r.items) {
1364
- const o = r.items.value || r.items;
1374
+ if (i && a.index !== void 0 && i.items) {
1375
+ const o = i.items.value || i.items;
1365
1376
  if (!Array.isArray(o)) return null;
1366
- r = o[s.index];
1367
- } else if (r && s.index !== void 0 && !r.items)
1377
+ i = o[a.index];
1378
+ } else if (i && a.index !== void 0 && !i.items)
1368
1379
  return null;
1369
- if (r == null) return null;
1380
+ if (i == null) return null;
1370
1381
  }
1371
- return r;
1382
+ return i;
1372
1383
  }
1373
1384
  }
1374
- class S extends F {
1385
+ class w extends F {
1375
1386
  // ============================================================================
1376
1387
  // Приватные поля
1377
1388
  // ============================================================================
1378
- id = z();
1389
+ id = J();
1379
1390
  /**
1380
1391
  * Коллекция полей формы (упрощённый Map вместо FieldRegistry)
1381
1392
  */
@@ -1384,7 +1395,7 @@ class S extends F {
1384
1395
  /**
1385
1396
  * Менеджер подписок для централизованного cleanup
1386
1397
  */
1387
- disposers = new P();
1398
+ disposers = new C();
1388
1399
  /**
1389
1400
  * Ссылка на Proxy-инстанс для использования в BehaviorContext
1390
1401
  */
@@ -1392,23 +1403,23 @@ class S extends F {
1392
1403
  /**
1393
1404
  * Навигатор для работы с путями к полям
1394
1405
  */
1395
- pathNavigator = new Q();
1406
+ pathNavigator = new Z();
1396
1407
  /**
1397
1408
  * Фабрика для создания узлов формы
1398
1409
  */
1399
- nodeFactory = new X();
1410
+ nodeFactory = new ee();
1400
1411
  /**
1401
1412
  * Реестр валидаторов для этой формы
1402
1413
  */
1403
- validationRegistry = new H();
1414
+ validationRegistry = new W();
1404
1415
  /**
1405
1416
  * Реестр behaviors для этой формы
1406
1417
  */
1407
- behaviorRegistry = new W();
1418
+ behaviorRegistry = new z();
1408
1419
  /**
1409
1420
  * Аппликатор для применения валидаторов к форме
1410
1421
  */
1411
- validationApplicator = new Y(this);
1422
+ validationApplicator = new X(this);
1412
1423
  // ============================================================================
1413
1424
  // Приватные сигналы состояния (inline из StateManager)
1414
1425
  // ============================================================================
@@ -1432,30 +1443,28 @@ class S extends F {
1432
1443
  submitting;
1433
1444
  constructor(e) {
1434
1445
  super();
1435
- const t = "form" in e, i = t ? e.form : e, r = t ? e.behavior : void 0, s = t ? e.validation : void 0;
1436
- for (const [o, l] of Object.entries(i)) {
1437
- const d = this.createNode(l);
1438
- this._fields.set(o, d);
1446
+ const t = "form" in e, r = t ? e.form : e, i = t ? e.behavior : void 0, a = t ? e.validation : void 0;
1447
+ for (const [n, o] of Object.entries(r)) {
1448
+ const l = this.createNode(o);
1449
+ this._fields.set(n, l);
1439
1450
  }
1440
1451
  this.value = u(() => {
1441
- const o = {};
1442
- return this._fields.forEach((l, d) => {
1443
- o[d] = l.value.value;
1444
- }), o;
1445
- }), this.valid = u(() => this._formErrors.value.length > 0 ? !1 : Array.from(this._fields.values()).every((o) => o.valid.value)), this.invalid = u(() => !this.valid.value), this.pending = u(
1446
- () => Array.from(this._fields.values()).some((o) => o.pending.value)
1452
+ const n = {};
1453
+ return this._fields.forEach((o, l) => {
1454
+ n[l] = o.value.value;
1455
+ }), n;
1456
+ }), this.valid = u(() => this._formErrors.value.length > 0 ? !1 : Array.from(this._fields.values()).every((n) => n.valid.value)), this.invalid = u(() => !this.valid.value), this.pending = u(
1457
+ () => Array.from(this._fields.values()).some((n) => n.pending.value)
1447
1458
  ), this.touched = u(
1448
- () => Array.from(this._fields.values()).some((o) => o.touched.value)
1459
+ () => Array.from(this._fields.values()).some((n) => n.touched.value)
1449
1460
  ), this.dirty = u(
1450
- () => Array.from(this._fields.values()).some((o) => o.dirty.value)
1461
+ () => Array.from(this._fields.values()).some((n) => n.dirty.value)
1451
1462
  ), this.errors = u(() => {
1452
- const o = [...this._formErrors.value];
1453
- return this._fields.forEach((l) => {
1454
- o.push(...l.errors.value);
1455
- }), o;
1456
- }), this.status = u(() => this._disabled.value ? "disabled" : this.pending.value ? "pending" : this.invalid.value ? "invalid" : "valid"), this.submitting = u(() => this._submitting.value);
1457
- const n = this.buildProxy();
1458
- return this._proxyInstance = n, r && this.applyBehaviorSchema(r), s && this.applyValidationSchema(s), n;
1463
+ const n = [...this._formErrors.value];
1464
+ return this._fields.forEach((o) => {
1465
+ n.push(...o.errors.value);
1466
+ }), n;
1467
+ }), this.status = u(() => this._disabled.value ? "disabled" : this.pending.value ? "pending" : this.invalid.value ? "invalid" : "valid"), this.submitting = u(() => this._submitting.value), this._proxyInstance = this.buildProxy(), i && this.applyBehaviorSchema(i), a && this.applyValidationSchema(a);
1459
1468
  }
1460
1469
  // ============================================================================
1461
1470
  // Приватный метод для создания Proxy (inline из ProxyBuilder)
@@ -1466,19 +1475,21 @@ class S extends F {
1466
1475
  buildProxy() {
1467
1476
  const e = this;
1468
1477
  return new Proxy(this, {
1469
- get: (t, i) => {
1470
- if (i in t)
1471
- return t[i];
1472
- if (typeof i == "string" && e._fields.has(i))
1473
- return e._fields.get(i);
1478
+ get: (t, r) => {
1479
+ if (r in t)
1480
+ return t[r];
1481
+ if (typeof r == "string" && e._fields.has(r)) {
1482
+ const i = e._fields.get(r);
1483
+ return i && typeof i.getProxy == "function" ? i.getProxy() : i;
1484
+ }
1474
1485
  },
1475
- set: (t, i, r) => typeof i == "string" && e._fields.has(i) ? !1 : (t[i] = r, !0),
1476
- has: (t, i) => typeof i == "string" && e._fields.has(i) ? !0 : i in t,
1486
+ set: (t, r, i) => typeof r == "string" && e._fields.has(r) ? !1 : (t[r] = i, !0),
1487
+ has: (t, r) => typeof r == "string" && e._fields.has(r) ? !0 : r in t,
1477
1488
  ownKeys: (t) => {
1478
- const i = Reflect.ownKeys(t), r = Array.from(e._fields.keys());
1479
- return [.../* @__PURE__ */ new Set([...i, ...r])];
1489
+ const r = Reflect.ownKeys(t), i = Array.from(e._fields.keys());
1490
+ return [.../* @__PURE__ */ new Set([...r, ...i])];
1480
1491
  },
1481
- getOwnPropertyDescriptor: (t, i) => typeof i == "string" && e._fields.has(i) ? { enumerable: !0, configurable: !0 } : Reflect.getOwnPropertyDescriptor(t, i)
1492
+ getOwnPropertyDescriptor: (t, r) => typeof r == "string" && e._fields.has(r) ? { enumerable: !0, configurable: !0 } : Reflect.getOwnPropertyDescriptor(t, r)
1482
1493
  });
1483
1494
  }
1484
1495
  // ============================================================================
@@ -1486,21 +1497,21 @@ class S extends F {
1486
1497
  // ============================================================================
1487
1498
  getValue() {
1488
1499
  const e = {};
1489
- return this._fields.forEach((t, i) => {
1490
- e[i] = t.getValue();
1500
+ return this._fields.forEach((t, r) => {
1501
+ e[r] = t.getValue();
1491
1502
  }), e;
1492
1503
  }
1493
1504
  setValue(e, t) {
1494
- for (const [i, r] of Object.entries(e)) {
1495
- const s = this._fields.get(i);
1496
- s && s.setValue(r, t);
1505
+ for (const [r, i] of Object.entries(e)) {
1506
+ const a = this._fields.get(r);
1507
+ a && a.setValue(i, t);
1497
1508
  }
1498
1509
  }
1499
1510
  patchValue(e) {
1500
- U(() => {
1501
- for (const [t, i] of Object.entries(e)) {
1502
- const r = this._fields.get(t);
1503
- r && i !== void 0 && r.setValue(i);
1511
+ j(() => {
1512
+ for (const [t, r] of Object.entries(e)) {
1513
+ const i = this._fields.get(t);
1514
+ i && r !== void 0 && i.setValue(r, { emitEvent: !1 });
1504
1515
  }
1505
1516
  });
1506
1517
  }
@@ -1522,9 +1533,9 @@ class S extends F {
1522
1533
  * ```
1523
1534
  */
1524
1535
  reset(e) {
1525
- this._fields.forEach((t, i) => {
1526
- const r = e?.[i];
1527
- t.reset(r);
1536
+ this._fields.forEach((t, r) => {
1537
+ const i = e?.[r];
1538
+ t.reset(i);
1528
1539
  });
1529
1540
  }
1530
1541
  /**
@@ -1639,10 +1650,10 @@ class S extends F {
1639
1650
  applyValidationSchema(e) {
1640
1651
  this.validationRegistry.beginRegistration();
1641
1652
  try {
1642
- const t = R();
1653
+ const t = D();
1643
1654
  e(t);
1644
- const i = this.getProxy();
1645
- this.validationRegistry.endRegistration(i);
1655
+ const r = this.getProxy();
1656
+ this.validationRegistry.endRegistration(r);
1646
1657
  } catch (t) {
1647
1658
  throw console.error("Error applying validation schema:", t), t;
1648
1659
  }
@@ -1654,7 +1665,7 @@ class S extends F {
1654
1665
  applyBehaviorSchema(e) {
1655
1666
  this.behaviorRegistry.beginRegistration();
1656
1667
  try {
1657
- const t = R();
1668
+ const t = D();
1658
1669
  return e(t), this.behaviorRegistry.endRegistration(this.getProxy()).cleanup;
1659
1670
  } catch (t) {
1660
1671
  throw console.error("Error applying behavior schema:", t), t;
@@ -1695,18 +1706,18 @@ class S extends F {
1695
1706
  const t = this.pathNavigator.parsePath(e);
1696
1707
  if (t.length === 0)
1697
1708
  return;
1698
- let i = this;
1699
- for (const r of t) {
1700
- if (!(i instanceof S) || (i = i.getField(r.key), !i)) return;
1701
- if (r.index !== void 0)
1702
- if ("at" in i && "length" in i && typeof i.at == "function") {
1703
- const s = i.at(r.index);
1704
- if (!s) return;
1705
- i = s;
1709
+ let r = this;
1710
+ for (const i of t) {
1711
+ if (!(r instanceof w) || (r = r.getField(i.key), !r)) return;
1712
+ if (i.index !== void 0)
1713
+ if ("at" in r && "length" in r && typeof r.at == "function") {
1714
+ const a = r.at(i.index);
1715
+ if (!a) return;
1716
+ r = a;
1706
1717
  } else
1707
1718
  return;
1708
1719
  }
1709
- return i;
1720
+ return r;
1710
1721
  }
1711
1722
  /**
1712
1723
  * Применить contextual валидаторы к полям
@@ -1750,15 +1761,15 @@ class S extends F {
1750
1761
  /**
1751
1762
  * Связывает два поля: при изменении source автоматически обновляется target
1752
1763
  */
1753
- linkFields(e, t, i) {
1754
- const r = this._fields.get(e), s = this._fields.get(t);
1755
- if (!r || !s)
1764
+ linkFields(e, t, r) {
1765
+ const i = this._fields.get(e), a = this._fields.get(t);
1766
+ if (!i || !a)
1756
1767
  return () => {
1757
1768
  };
1758
1769
  const n = E(() => {
1759
- const l = r.value.value, d = i ? i(l) : l;
1760
- s.setValue(d, { emitEvent: !1 });
1761
- }), o = `linkFields-${Date.now()}-${Math.random()}`;
1770
+ const l = i.value.value, h = r ? r(l) : l;
1771
+ a.setValue(h, { emitEvent: !1 });
1772
+ }), o = S("linkFields");
1762
1773
  return this.disposers.add(o, n);
1763
1774
  }
1764
1775
  /**
@@ -1789,15 +1800,15 @@ class S extends F {
1789
1800
  * ```
1790
1801
  */
1791
1802
  watchField(e, t) {
1792
- const i = this.getFieldByPath(e);
1793
- if (!i)
1803
+ const r = this.getFieldByPath(e);
1804
+ if (!r)
1794
1805
  return () => {
1795
1806
  };
1796
- const r = E(() => {
1797
- const n = i.value.value;
1807
+ const i = E(() => {
1808
+ const n = r.value.value;
1798
1809
  t(n);
1799
- }), s = `watchField-${Date.now()}-${Math.random()}`;
1800
- return this.disposers.add(s, r);
1810
+ }), a = S("watchField");
1811
+ return this.disposers.add(a, i);
1801
1812
  }
1802
1813
  /**
1803
1814
  * Hook: вызывается после disable()
@@ -1820,7 +1831,7 @@ class S extends F {
1820
1831
  });
1821
1832
  }
1822
1833
  }
1823
- class T extends F {
1834
+ class N extends F {
1824
1835
  // ============================================================================
1825
1836
  // Приватные поля
1826
1837
  // ============================================================================
@@ -1831,7 +1842,9 @@ class T extends F {
1831
1842
  * Менеджер подписок для централизованного cleanup
1832
1843
  * Использует SubscriptionManager вместо массива для управления подписками
1833
1844
  */
1834
- disposers = new P();
1845
+ disposers = new C();
1846
+ /** Array-level validation errors (e.g., "минимум 1 элемент") */
1847
+ _arrayErrors = y([]);
1835
1848
  // ============================================================================
1836
1849
  // Приватные поля для сохранения схем
1837
1850
  // ============================================================================
@@ -1854,13 +1867,13 @@ class T extends F {
1854
1867
  // ============================================================================
1855
1868
  constructor(e, t = []) {
1856
1869
  super(), this.itemSchema = e, this.initialItems = t, this.items = y([]);
1857
- for (const i of t)
1858
- this.push(i);
1859
- this.length = u(() => this.items.value.length), this.value = u(() => this.items.value.map((i) => i.value.value)), this.valid = u(() => this.items.value.every((i) => i.valid.value)), this.invalid = u(() => !this.valid.value), this.pending = u(() => this.items.value.some((i) => i.pending.value)), this.touched = u(() => this.items.value.some((i) => i.touched.value)), this.dirty = u(() => this.items.value.some((i) => i.dirty.value)), this.errors = u(() => {
1860
- const i = [];
1861
- return this.items.value.forEach((r) => {
1862
- i.push(...r.errors.value);
1863
- }), i;
1870
+ for (const r of t)
1871
+ this.push(r);
1872
+ this.length = u(() => this.items.value.length), this.value = u(() => this.items.value.map((r) => r.value.value)), this.valid = u(() => this._arrayErrors.value.length > 0 ? !1 : this.items.value.every((r) => r.valid.value)), this.invalid = u(() => !this.valid.value), this.pending = u(() => this.items.value.some((r) => r.pending.value)), this.touched = u(() => this.items.value.some((r) => r.touched.value)), this.dirty = u(() => this.items.value.some((r) => r.dirty.value)), this.errors = u(() => {
1873
+ const r = [...this._arrayErrors.value];
1874
+ return this.items.value.forEach((i) => {
1875
+ r.push(...i.errors.value);
1876
+ }), r;
1864
1877
  }), this.status = u(() => this.pending.value ? "pending" : this.invalid.value ? "invalid" : "valid");
1865
1878
  }
1866
1879
  // ============================================================================
@@ -1879,7 +1892,7 @@ class T extends F {
1879
1892
  * @param index - Индекс элемента для удаления
1880
1893
  */
1881
1894
  removeAt(e) {
1882
- e < 0 || e >= this.items.value.length || (this.items.value = this.items.value.filter((t, i) => i !== e));
1895
+ e < 0 || e >= this.items.value.length || (this.items.value = this.items.value.filter((t, r) => r !== e));
1883
1896
  }
1884
1897
  /**
1885
1898
  * Вставить элемент в массив
@@ -1889,8 +1902,8 @@ class T extends F {
1889
1902
  insert(e, t) {
1890
1903
  if (e < 0 || e > this.items.value.length)
1891
1904
  return;
1892
- const i = this.createItem(t), r = [...this.items.value];
1893
- r.splice(e, 0, i), this.items.value = r;
1905
+ const r = this.createItem(t), i = [...this.items.value];
1906
+ i.splice(e, 0, r), this.items.value = i;
1894
1907
  }
1895
1908
  /**
1896
1909
  * Удалить все элементы массива
@@ -1901,10 +1914,12 @@ class T extends F {
1901
1914
  /**
1902
1915
  * Получить элемент по индексу
1903
1916
  * @param index - Индекс элемента
1904
- * @returns Типизированный GroupNode или undefined если индекс вне границ
1917
+ * @returns Типизированный GroupNode proxy или undefined если индекс вне границ
1905
1918
  */
1906
1919
  at(e) {
1907
- return this.items.value[e];
1920
+ const t = this.items.value[e];
1921
+ if (t)
1922
+ return t.getProxy();
1908
1923
  }
1909
1924
  // ============================================================================
1910
1925
  // Реализация абстрактных методов
@@ -1913,12 +1928,12 @@ class T extends F {
1913
1928
  return this.items.value.map((e) => e.getValue());
1914
1929
  }
1915
1930
  setValue(e, t) {
1916
- this.clear(), e.forEach((i) => this.push(i)), t?.emitEvent !== !1 && this.validate().catch(() => {
1931
+ this.clear(), e.forEach((r) => this.push(r)), t?.emitEvent !== !1 && this.validate().catch(() => {
1917
1932
  });
1918
1933
  }
1919
1934
  patchValue(e) {
1920
- e.forEach((t, i) => {
1921
- this.items.value[i] && t !== void 0 && this.items.value[i].patchValue(t);
1935
+ e.forEach((t, r) => {
1936
+ this.items.value[r] && t !== void 0 && this.items.value[r].patchValue(t);
1922
1937
  });
1923
1938
  }
1924
1939
  /**
@@ -1939,7 +1954,7 @@ class T extends F {
1939
1954
  * ```
1940
1955
  */
1941
1956
  reset(e) {
1942
- this.clear(), e && e.forEach((t) => this.push(t));
1957
+ this._arrayErrors.value = [], this.clear(), e && e.forEach((t) => this.push(t));
1943
1958
  }
1944
1959
  /**
1945
1960
  * Сбросить массив к исходным значениям (initialItems)
@@ -1970,15 +1985,38 @@ class T extends F {
1970
1985
  * ```
1971
1986
  */
1972
1987
  resetToInitial() {
1973
- this.clear(), this.initialItems.forEach((e) => this.push(e));
1988
+ this._arrayErrors.value = [], this.clear(), this.initialItems.forEach((e) => this.push(e));
1974
1989
  }
1975
1990
  async validate() {
1976
1991
  return (await Promise.all(this.items.value.map((t) => t.validate()))).every(Boolean);
1977
1992
  }
1993
+ /**
1994
+ * Установить array-level validation errors
1995
+ *
1996
+ * @param errors - Массив ошибок валидации уровня массива
1997
+ *
1998
+ * @example
1999
+ * ```typescript
2000
+ * arrayNode.setErrors([{
2001
+ * code: 'minItems',
2002
+ * message: 'Минимум 1 элемент обязателен',
2003
+ * }]);
2004
+ * ```
2005
+ */
1978
2006
  setErrors(e) {
2007
+ this._arrayErrors.value = e;
1979
2008
  }
2009
+ /**
2010
+ * Очистить все errors (array-level + item-level)
2011
+ *
2012
+ * @example
2013
+ * ```typescript
2014
+ * arrayNode.clearErrors();
2015
+ * console.log(arrayNode.errors.value); // []
2016
+ * ```
2017
+ */
1980
2018
  clearErrors() {
1981
- this.items.value.forEach((e) => e.clearErrors());
2019
+ this._arrayErrors.value = [], this.items.value.forEach((e) => e.clearErrors());
1982
2020
  }
1983
2021
  // ============================================================================
1984
2022
  // Protected hooks (Template Method pattern)
@@ -2020,20 +2058,24 @@ class T extends F {
2020
2058
  // ============================================================================
2021
2059
  /**
2022
2060
  * Итерировать по элементам массива
2023
- * @param callback - Функция, вызываемая для каждого элемента с типизированным GroupNode
2061
+ * @param callback - Функция, вызываемая для каждого элемента с типизированным GroupNode proxy
2024
2062
  */
2025
2063
  forEach(e) {
2026
- this.items.value.forEach((t, i) => {
2027
- e(t, i);
2064
+ this.items.value.forEach((t, r) => {
2065
+ const i = t.getProxy();
2066
+ e(i, r);
2028
2067
  });
2029
2068
  }
2030
2069
  /**
2031
2070
  * Маппинг элементов массива
2032
- * @param callback - Функция преобразования с типизированным GroupNode
2071
+ * @param callback - Функция преобразования с типизированным GroupNode proxy
2033
2072
  * @returns Новый массив результатов
2034
2073
  */
2035
2074
  map(e) {
2036
- return this.items.value.map((t, i) => e(t, i));
2075
+ return this.items.value.map((t, r) => {
2076
+ const i = t.getProxy();
2077
+ return e(i, r);
2078
+ });
2037
2079
  }
2038
2080
  // ============================================================================
2039
2081
  // Private методы
@@ -2044,7 +2086,7 @@ class T extends F {
2044
2086
  */
2045
2087
  createItem(e) {
2046
2088
  if (this.isGroupSchema(this.itemSchema)) {
2047
- const t = new S(this.itemSchema);
2089
+ const t = new w(this.itemSchema);
2048
2090
  return e && t.patchValue(e), this.validationSchemaFn && "applyValidationSchema" in t && t.applyValidationSchema(this.validationSchemaFn), this.behaviorSchemaFn && "applyBehaviorSchema" in t && t.applyBehaviorSchema(this.behaviorSchemaFn), t;
2049
2091
  }
2050
2092
  throw new Error(
@@ -2131,14 +2173,14 @@ class T extends F {
2131
2173
  * ```
2132
2174
  */
2133
2175
  watchItems(e, t) {
2134
- const i = E(() => {
2135
- const s = this.items.value.map((n) => {
2136
- if (n instanceof S)
2176
+ const r = E(() => {
2177
+ const a = this.items.value.map((n) => {
2178
+ if (n instanceof w)
2137
2179
  return n.getFieldByPath(e)?.value.value;
2138
2180
  });
2139
- t(s);
2140
- }), r = `watchItems-${Date.now()}-${Math.random()}`;
2141
- return this.disposers.add(r, i);
2181
+ t(a);
2182
+ }), i = S("watchItems");
2183
+ return this.disposers.add(i, r);
2142
2184
  }
2143
2185
  /**
2144
2186
  * Подписка на изменение длины массива
@@ -2164,10 +2206,10 @@ class T extends F {
2164
2206
  */
2165
2207
  watchLength(e) {
2166
2208
  const t = E(() => {
2167
- const r = this.length.value;
2168
- e(r);
2169
- }), i = `watchLength-${Date.now()}-${Math.random()}`;
2170
- return this.disposers.add(i, t);
2209
+ const i = this.length.value;
2210
+ e(i);
2211
+ }), r = S("watchLength");
2212
+ return this.disposers.add(r, t);
2171
2213
  }
2172
2214
  /**
2173
2215
  * Очистить все ресурсы узла
@@ -2230,7 +2272,7 @@ class T extends F {
2230
2272
  });
2231
2273
  }
2232
2274
  }
2233
- class X {
2275
+ class ee {
2234
2276
  /**
2235
2277
  * Создает узел формы на основе конфигурации
2236
2278
  *
@@ -2280,16 +2322,16 @@ class X {
2280
2322
  if (Array.isArray(e) && e.length >= 1)
2281
2323
  return this.createArrayNodeFromArray(e);
2282
2324
  if (this.isFieldConfig(e))
2283
- return new J(e);
2325
+ return new Q(e);
2284
2326
  if (this.isArrayConfig(e)) {
2285
2327
  const t = e;
2286
- return new T(
2328
+ return new N(
2287
2329
  t.schema,
2288
2330
  t.initialItems
2289
2331
  );
2290
2332
  }
2291
2333
  if (this.isGroupConfig(e))
2292
- return new S(e);
2334
+ return new w(e);
2293
2335
  throw new Error(
2294
2336
  `NodeFactory: Unknown node config. Expected FieldConfig, GroupConfig, or ArrayConfig, but got: ${JSON.stringify(
2295
2337
  e
@@ -2323,11 +2365,11 @@ class X {
2323
2365
  */
2324
2366
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2325
2367
  createArrayNodeFromArray(e) {
2326
- const [t, ...i] = e, r = [];
2327
- this.isGroupConfig(t) && r.push(this.extractValues(t));
2328
- for (const s of i)
2329
- this.isGroupConfig(s) ? r.push(this.extractValues(s)) : r.push(s);
2330
- return new T(t, r);
2368
+ const [t, ...r] = e, i = [];
2369
+ this.isGroupConfig(t) && i.push(this.extractValues(t));
2370
+ for (const a of r)
2371
+ this.isGroupConfig(a) ? i.push(this.extractValues(a)) : i.push(a);
2372
+ return new N(t, i);
2331
2373
  }
2332
2374
  /**
2333
2375
  * Извлечь значения из схемы (рекурсивно)
@@ -2365,8 +2407,8 @@ class X {
2365
2407
  return e.map((t) => this.extractValues(t));
2366
2408
  if (this.isGroupConfig(e)) {
2367
2409
  const t = {};
2368
- for (const [i, r] of Object.entries(e))
2369
- t[i] = this.extractValues(r);
2410
+ for (const [r, i] of Object.entries(e))
2411
+ t[r] = this.extractValues(i);
2370
2412
  return t;
2371
2413
  }
2372
2414
  return e;
@@ -2446,7 +2488,7 @@ class X {
2446
2488
  return e != null && typeof e == "object" && !this.isFieldConfig(e) && !this.isArrayConfig(e);
2447
2489
  }
2448
2490
  }
2449
- class fe {
2491
+ class pe {
2450
2492
  /**
2451
2493
  * Создать Debouncer с заданной задержкой
2452
2494
  *
@@ -2489,17 +2531,17 @@ class fe {
2489
2531
  * ```
2490
2532
  */
2491
2533
  async debounce(e) {
2492
- return new Promise((t, i) => {
2534
+ return new Promise((t, r) => {
2493
2535
  if (this.timer && clearTimeout(this.timer), this.delay === 0) {
2494
- Promise.resolve().then(() => e()).then(t).catch(i);
2536
+ Promise.resolve().then(() => e()).then(t).catch(r);
2495
2537
  return;
2496
2538
  }
2497
2539
  this.timer = setTimeout(async () => {
2498
2540
  try {
2499
- const r = await e();
2500
- t(r);
2501
- } catch (r) {
2502
- i(r);
2541
+ const i = await e();
2542
+ t(i);
2543
+ } catch (i) {
2544
+ r(i);
2503
2545
  }
2504
2546
  }, this.delay);
2505
2547
  });
@@ -2571,39 +2613,39 @@ class fe {
2571
2613
  return this.timer !== void 0;
2572
2614
  }
2573
2615
  }
2574
- function ve(a) {
2575
- return new S(a);
2616
+ function ye(s) {
2617
+ return new w(s).getProxy();
2576
2618
  }
2577
- function Z(a) {
2619
+ function te(s) {
2578
2620
  return {
2579
2621
  type: "static",
2580
2622
  load: async () => ({
2581
- items: a,
2582
- totalCount: a.length
2623
+ items: s,
2624
+ totalCount: s.length
2583
2625
  })
2584
2626
  };
2585
2627
  }
2586
- function ee(a) {
2628
+ function re(s) {
2587
2629
  let e = null;
2588
2630
  return {
2589
2631
  type: "preload",
2590
2632
  load: async (t) => {
2591
2633
  if (!e) {
2592
- const i = await a(t);
2634
+ const r = await s(t);
2593
2635
  e = {
2594
- items: i,
2595
- totalCount: i.length
2636
+ items: r,
2637
+ totalCount: r.length
2596
2638
  };
2597
2639
  }
2598
2640
  return e;
2599
2641
  }
2600
2642
  };
2601
2643
  }
2602
- function te(a) {
2644
+ function ie(s) {
2603
2645
  return {
2604
2646
  type: "partial",
2605
2647
  load: async (e) => {
2606
- const t = await a(e);
2648
+ const t = await s(e);
2607
2649
  return {
2608
2650
  items: t,
2609
2651
  totalCount: t.length
@@ -2612,133 +2654,133 @@ function te(a) {
2612
2654
  }
2613
2655
  };
2614
2656
  }
2615
- const pe = {
2616
- static: Z,
2617
- preload: ee,
2618
- partial: te
2657
+ const me = {
2658
+ static: te,
2659
+ preload: re,
2660
+ partial: ie
2619
2661
  };
2620
- var w = { exports: {} }, k = {};
2621
- var M;
2622
- function ie() {
2623
- if (M) return k;
2624
- M = 1;
2625
- var a = B;
2662
+ var A = { exports: {} }, x = {};
2663
+ var I;
2664
+ function se() {
2665
+ if (I) return x;
2666
+ I = 1;
2667
+ var s = L;
2626
2668
  function e(c, f) {
2627
2669
  return c === f && (c !== 0 || 1 / c === 1 / f) || c !== c && f !== f;
2628
2670
  }
2629
- var t = typeof Object.is == "function" ? Object.is : e, i = a.useState, r = a.useEffect, s = a.useLayoutEffect, n = a.useDebugValue;
2671
+ var t = typeof Object.is == "function" ? Object.is : e, r = s.useState, i = s.useEffect, a = s.useLayoutEffect, n = s.useDebugValue;
2630
2672
  function o(c, f) {
2631
- var h = f(), v = i({ inst: { value: h, getSnapshot: f } }), p = v[0].inst, g = v[1];
2632
- return s(
2673
+ var d = f(), v = r({ inst: { value: d, getSnapshot: f } }), p = v[0].inst, g = v[1];
2674
+ return a(
2633
2675
  function() {
2634
- p.value = h, p.getSnapshot = f, l(p) && g({ inst: p });
2676
+ p.value = d, p.getSnapshot = f, l(p) && g({ inst: p });
2635
2677
  },
2636
- [c, h, f]
2637
- ), r(
2678
+ [c, d, f]
2679
+ ), i(
2638
2680
  function() {
2639
2681
  return l(p) && g({ inst: p }), c(function() {
2640
2682
  l(p) && g({ inst: p });
2641
2683
  });
2642
2684
  },
2643
2685
  [c]
2644
- ), n(h), h;
2686
+ ), n(d), d;
2645
2687
  }
2646
2688
  function l(c) {
2647
2689
  var f = c.getSnapshot;
2648
2690
  c = c.value;
2649
2691
  try {
2650
- var h = f();
2651
- return !t(c, h);
2692
+ var d = f();
2693
+ return !t(c, d);
2652
2694
  } catch {
2653
2695
  return !0;
2654
2696
  }
2655
2697
  }
2656
- function d(c, f) {
2698
+ function h(c, f) {
2657
2699
  return f();
2658
2700
  }
2659
- var m = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? d : o;
2660
- return k.useSyncExternalStore = a.useSyncExternalStore !== void 0 ? a.useSyncExternalStore : m, k;
2701
+ var m = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? h : o;
2702
+ return x.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : m, x;
2661
2703
  }
2662
- var x = {};
2663
- var I;
2664
- function re() {
2665
- return I || (I = 1, process.env.NODE_ENV !== "production" && (function() {
2666
- function a(h, v) {
2667
- return h === v && (h !== 0 || 1 / h === 1 / v) || h !== h && v !== v;
2704
+ var P = {};
2705
+ var M;
2706
+ function ae() {
2707
+ return M || (M = 1, process.env.NODE_ENV !== "production" && (function() {
2708
+ function s(d, v) {
2709
+ return d === v && (d !== 0 || 1 / d === 1 / v) || d !== d && v !== v;
2668
2710
  }
2669
- function e(h, v) {
2670
- m || r.startTransition === void 0 || (m = !0, console.error(
2711
+ function e(d, v) {
2712
+ m || i.startTransition === void 0 || (m = !0, console.error(
2671
2713
  "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."
2672
2714
  ));
2673
2715
  var p = v();
2674
2716
  if (!c) {
2675
2717
  var g = v();
2676
- s(p, g) || (console.error(
2718
+ a(p, g) || (console.error(
2677
2719
  "The result of getSnapshot should be cached to avoid an infinite loop"
2678
2720
  ), c = !0);
2679
2721
  }
2680
2722
  g = n({
2681
2723
  inst: { value: p, getSnapshot: v }
2682
2724
  });
2683
- var _ = g[0].inst, V = g[1];
2725
+ var _ = g[0].inst, k = g[1];
2684
2726
  return l(
2685
2727
  function() {
2686
- _.value = p, _.getSnapshot = v, t(_) && V({ inst: _ });
2728
+ _.value = p, _.getSnapshot = v, t(_) && k({ inst: _ });
2687
2729
  },
2688
- [h, p, v]
2730
+ [d, p, v]
2689
2731
  ), o(
2690
2732
  function() {
2691
- return t(_) && V({ inst: _ }), h(function() {
2692
- t(_) && V({ inst: _ });
2733
+ return t(_) && k({ inst: _ }), d(function() {
2734
+ t(_) && k({ inst: _ });
2693
2735
  });
2694
2736
  },
2695
- [h]
2696
- ), d(p), p;
2737
+ [d]
2738
+ ), h(p), p;
2697
2739
  }
2698
- function t(h) {
2699
- var v = h.getSnapshot;
2700
- h = h.value;
2740
+ function t(d) {
2741
+ var v = d.getSnapshot;
2742
+ d = d.value;
2701
2743
  try {
2702
2744
  var p = v();
2703
- return !s(h, p);
2745
+ return !a(d, p);
2704
2746
  } catch {
2705
2747
  return !0;
2706
2748
  }
2707
2749
  }
2708
- function i(h, v) {
2750
+ function r(d, v) {
2709
2751
  return v();
2710
2752
  }
2711
2753
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
2712
- var r = B, s = typeof Object.is == "function" ? Object.is : a, n = r.useState, o = r.useEffect, l = r.useLayoutEffect, d = r.useDebugValue, m = !1, c = !1, f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? i : e;
2713
- x.useSyncExternalStore = r.useSyncExternalStore !== void 0 ? r.useSyncExternalStore : f, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
2714
- })()), x;
2754
+ var i = L, a = typeof Object.is == "function" ? Object.is : s, n = i.useState, o = i.useEffect, l = i.useLayoutEffect, h = i.useDebugValue, m = !1, c = !1, f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? r : e;
2755
+ P.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());
2756
+ })()), P;
2715
2757
  }
2716
- var N;
2717
- function se() {
2718
- return N || (N = 1, process.env.NODE_ENV === "production" ? w.exports = ie() : w.exports = re()), w.exports;
2758
+ var B;
2759
+ function ne() {
2760
+ return B || (B = 1, process.env.NODE_ENV === "production" ? A.exports = se() : A.exports = ae()), A.exports;
2719
2761
  }
2720
- var $ = se();
2721
- function ae(a, e) {
2722
- if (a === e) return !0;
2723
- if (a.length !== e.length) return !1;
2724
- for (let t = 0; t < a.length; t++)
2725
- if (a[t] !== e[t]) return !1;
2762
+ var U = ne();
2763
+ function oe(s, e) {
2764
+ if (s === e) return !0;
2765
+ if (s.length !== e.length) return !1;
2766
+ for (let t = 0; t < s.length; t++)
2767
+ if (s[t] !== e[t]) return !1;
2726
2768
  return !0;
2727
2769
  }
2728
- function G(a, e, t) {
2729
- const i = L(null);
2730
- if (i.current === null) {
2770
+ function $(s, e, t) {
2771
+ const r = G(null);
2772
+ if (r.current === null) {
2731
2773
  const n = {};
2732
- for (const o in a)
2733
- n[o] = a[o].value;
2734
- i.current = { ...n, __snapshot: null };
2774
+ for (const o in s)
2775
+ n[o] = s[o].value;
2776
+ r.current = { ...n, __snapshot: null };
2735
2777
  }
2736
- const r = b(
2778
+ const i = b(
2737
2779
  (n) => {
2738
2780
  let o = !0;
2739
2781
  return E(() => {
2740
- for (const d in a)
2741
- a[d].value;
2782
+ for (const h in s)
2783
+ s[h].value;
2742
2784
  if (o) {
2743
2785
  o = !1;
2744
2786
  return;
@@ -2746,43 +2788,43 @@ function G(a, e, t) {
2746
2788
  n();
2747
2789
  });
2748
2790
  },
2749
- [a]
2750
- ), s = b(() => {
2751
- const n = i.current, o = {};
2752
- for (const d in a)
2753
- o[d] = a[d].value;
2791
+ [s]
2792
+ ), a = b(() => {
2793
+ const n = r.current, o = {};
2794
+ for (const h in s)
2795
+ o[h] = s[h].value;
2754
2796
  let l = !1;
2755
- for (const d of e) {
2756
- const { key: m, useShallowArrayEqual: c } = d, f = o[m], h = n[m];
2797
+ for (const h of e) {
2798
+ const { key: m, useShallowArrayEqual: c } = h, f = o[m], d = n[m];
2757
2799
  if (c) {
2758
- if (!ae(h, f)) {
2800
+ if (!oe(d, f)) {
2759
2801
  l = !0;
2760
2802
  break;
2761
2803
  }
2762
- } else if (h !== f) {
2804
+ } else if (d !== f) {
2763
2805
  l = !0;
2764
2806
  break;
2765
2807
  }
2766
2808
  }
2767
2809
  if (!l && n.__snapshot)
2768
2810
  return n.__snapshot;
2769
- for (const d in a)
2770
- n[d] = o[d];
2811
+ for (const h in s)
2812
+ n[h] = o[h];
2771
2813
  return n.__snapshot = t(o), n.__snapshot;
2772
- }, [a, t]);
2773
- return $.useSyncExternalStore(r, s, s);
2814
+ }, [s, t]);
2815
+ return U.useSyncExternalStore(i, a, a);
2774
2816
  }
2775
- function ne(a) {
2817
+ function le(s) {
2776
2818
  const e = {
2777
- value: a.value,
2778
- disabled: a.disabled,
2779
- errors: a.errors,
2780
- pending: a.pending,
2781
- valid: a.valid,
2782
- invalid: a.invalid,
2783
- touched: a.touched,
2784
- shouldShowError: a.shouldShowError,
2785
- componentProps: a.componentProps
2819
+ value: s.value,
2820
+ disabled: s.disabled,
2821
+ errors: s.errors,
2822
+ pending: s.pending,
2823
+ valid: s.valid,
2824
+ invalid: s.invalid,
2825
+ touched: s.touched,
2826
+ shouldShowError: s.shouldShowError,
2827
+ componentProps: s.componentProps
2786
2828
  }, t = [
2787
2829
  { key: "value" },
2788
2830
  { key: "disabled" },
@@ -2793,32 +2835,32 @@ function ne(a) {
2793
2835
  { key: "touched" },
2794
2836
  { key: "shouldShowError" },
2795
2837
  { key: "componentProps" }
2796
- ], i = b(
2797
- (r) => ({
2798
- value: r.value,
2799
- pending: r.pending,
2800
- disabled: r.disabled,
2801
- errors: r.errors,
2802
- valid: r.valid,
2803
- invalid: r.invalid,
2804
- touched: r.touched,
2805
- shouldShowError: r.shouldShowError,
2806
- componentProps: r.componentProps
2838
+ ], r = b(
2839
+ (i) => ({
2840
+ value: i.value,
2841
+ pending: i.pending,
2842
+ disabled: i.disabled,
2843
+ errors: i.errors,
2844
+ valid: i.valid,
2845
+ invalid: i.invalid,
2846
+ touched: i.touched,
2847
+ shouldShowError: i.shouldShowError,
2848
+ componentProps: i.componentProps
2807
2849
  }),
2808
2850
  []
2809
2851
  );
2810
- return G(e, t, i);
2852
+ return $(e, t, r);
2811
2853
  }
2812
- function oe(a) {
2854
+ function ue(s) {
2813
2855
  const e = {
2814
- value: a.value,
2815
- length: a.length,
2816
- errors: a.errors,
2817
- pending: a.pending,
2818
- valid: a.valid,
2819
- invalid: a.invalid,
2820
- touched: a.touched,
2821
- dirty: a.dirty
2856
+ value: s.value,
2857
+ length: s.length,
2858
+ errors: s.errors,
2859
+ pending: s.pending,
2860
+ valid: s.valid,
2861
+ invalid: s.invalid,
2862
+ touched: s.touched,
2863
+ dirty: s.dirty
2822
2864
  }, t = [
2823
2865
  { key: "value" },
2824
2866
  { key: "length" },
@@ -2828,24 +2870,24 @@ function oe(a) {
2828
2870
  { key: "invalid" },
2829
2871
  { key: "touched" },
2830
2872
  { key: "dirty" }
2831
- ], i = b(
2832
- (r) => ({
2833
- value: r.value,
2834
- length: r.length,
2835
- pending: r.pending,
2836
- errors: r.errors,
2837
- valid: r.valid,
2838
- invalid: r.invalid,
2839
- touched: r.touched,
2840
- dirty: r.dirty
2873
+ ], r = b(
2874
+ (i) => ({
2875
+ value: i.value,
2876
+ length: i.length,
2877
+ pending: i.pending,
2878
+ errors: i.errors,
2879
+ valid: i.valid,
2880
+ invalid: i.invalid,
2881
+ touched: i.touched,
2882
+ dirty: i.dirty
2841
2883
  }),
2842
2884
  []
2843
2885
  );
2844
- return G(e, t, i);
2886
+ return $(e, t, r);
2845
2887
  }
2846
- function ye(a) {
2847
- const e = a && "length" in a && "map" in a;
2848
- return a ? e ? oe(a) : ne(a) : {
2888
+ function ge(s) {
2889
+ const e = s && "length" in s && "map" in s;
2890
+ return s ? e ? ue(s) : le(s) : {
2849
2891
  value: [],
2850
2892
  length: 0,
2851
2893
  pending: !1,
@@ -2856,56 +2898,57 @@ function ye(a) {
2856
2898
  dirty: !1
2857
2899
  };
2858
2900
  }
2859
- function me(a) {
2860
- const e = L({ value: a.value.value }), t = b(
2861
- (r) => {
2862
- let s = !0;
2901
+ function _e(s) {
2902
+ const e = G({ value: s.value.value }), t = b(
2903
+ (i) => {
2904
+ let a = !0;
2863
2905
  return E(() => {
2864
- if (a.value.value, s) {
2865
- s = !1;
2906
+ if (s.value.value, a) {
2907
+ a = !1;
2866
2908
  return;
2867
2909
  }
2868
- r();
2910
+ i();
2869
2911
  });
2870
2912
  },
2871
- [a]
2872
- ), i = b(() => {
2873
- const r = a.value.value;
2874
- return e.current.value === r ? e.current.value : (e.current.value = r, r);
2875
- }, [a]);
2876
- return $.useSyncExternalStore(t, i, i);
2913
+ [s]
2914
+ ), r = b(() => {
2915
+ const i = s.value.value;
2916
+ return e.current.value === i ? e.current.value : (e.current.value = i, i);
2917
+ }, [s]);
2918
+ return U.useSyncExternalStore(t, r, r);
2877
2919
  }
2878
2920
  export {
2879
- T as ArrayNode,
2880
- fe as Debouncer,
2881
- A as ErrorStrategy,
2882
- J as FieldNode,
2883
- Q as FieldPathNavigator,
2921
+ N as ArrayNode,
2922
+ pe as Debouncer,
2923
+ V as ErrorStrategy,
2924
+ Q as FieldNode,
2925
+ Z as FieldPathNavigator,
2884
2926
  O as FormErrorHandler,
2885
2927
  F as FormNode,
2886
- S as GroupNode,
2887
- X as NodeFactory,
2888
- Oe as RegistryStack,
2889
- pe as Resources,
2890
- P as SubscriptionManager,
2891
- Ee as behaviors,
2892
- R as createFieldPath,
2893
- ve as createForm,
2894
- Fe as extractKey,
2895
- Pe as extractPath,
2896
- Ce as getCurrentBehaviorRegistry,
2928
+ w as GroupNode,
2929
+ ee as NodeFactory,
2930
+ Fe as RegistryStack,
2931
+ me as Resources,
2932
+ C as SubscriptionManager,
2933
+ Se as behaviors,
2934
+ D as createFieldPath,
2935
+ ye as createForm,
2936
+ Ce as extractKey,
2937
+ Re as extractPath,
2938
+ Te as getCurrentBehaviorRegistry,
2897
2939
  De as getCurrentValidationRegistry,
2898
- Se as getNodeType,
2899
- D as isArrayNode,
2900
- C as isFieldNode,
2901
- we as isFormNode,
2902
- Ae as isGroupNode,
2903
- te as partialResource,
2904
- ee as preloadResource,
2905
- Z as staticResource,
2906
- Re as toFieldPath,
2907
- ye as useFormControl,
2908
- me as useFormControlValue,
2909
- Ve as validateForm,
2910
- ke as validators
2940
+ Ae as getNodeType,
2941
+ T as isArrayNode,
2942
+ R as isFieldNode,
2943
+ Ve as isFormNode,
2944
+ ke as isGroupNode,
2945
+ ie as partialResource,
2946
+ re as preloadResource,
2947
+ te as staticResource,
2948
+ Ne as toFieldPath,
2949
+ S as uniqueId,
2950
+ ge as useFormControl,
2951
+ _e as useFormControlValue,
2952
+ xe as validateForm,
2953
+ Pe as validators
2911
2954
  };