@reformer/core 11.0.0-beta.6 → 11.0.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/README.md +7 -3
  2. package/dist/behaviors.js +216 -179
  3. package/dist/create-model-BBRHhHwK.js +30 -0
  4. package/dist/en-CjAqn7h0.js +41 -0
  5. package/dist/form/behaviors/collections.d.ts +14 -1
  6. package/dist/form/behaviors/context.d.ts +18 -2
  7. package/dist/form/behaviors/index.d.ts +3 -1
  8. package/dist/form/behaviors/internals.d.ts +9 -1
  9. package/dist/form/behaviors/schema-operators.d.ts +76 -0
  10. package/dist/form/behaviors/types.d.ts +15 -3
  11. package/dist/form/create-core-form.d.ts +5 -3
  12. package/dist/form/create-form.d.ts +28 -53
  13. package/dist/form/form-bundle.d.ts +136 -0
  14. package/dist/form/index.d.ts +6 -1
  15. package/dist/form/nodes/field-node.d.ts +2 -2
  16. package/dist/form/nodes/group-node.d.ts +1 -1
  17. package/dist/form/nodes/model-array-node.d.ts +10 -5
  18. package/dist/form/schema-controller.d.ts +137 -0
  19. package/dist/form/schema-subtree.d.ts +28 -0
  20. package/dist/form/signal-node-registry.d.ts +22 -16
  21. package/dist/form/types/contracts.d.ts +6 -0
  22. package/dist/form/types/deep-schema.d.ts +2 -2
  23. package/dist/form/types/form-proxy.d.ts +1 -1
  24. package/dist/form/types/schema-node.d.ts +37 -12
  25. package/dist/form/types/validation-schema.d.ts +13 -1
  26. package/dist/form/validation/context.d.ts +6 -1
  27. package/dist/form/validation/index.d.ts +1 -1
  28. package/dist/form/validation/operators.d.ts +74 -7
  29. package/dist/form/validation/types.d.ts +2 -1
  30. package/dist/form/validators/validation-error.d.ts +8 -0
  31. package/dist/i18n/descriptor.d.ts +54 -0
  32. package/dist/i18n/en.json.d.ts +45 -0
  33. package/dist/i18n/loader.d.ts +71 -0
  34. package/dist/i18n/locale-store.d.ts +39 -0
  35. package/dist/i18n/locale.d.ts +90 -0
  36. package/dist/i18n/message-format.d.ts +116 -0
  37. package/dist/i18n/resolve-localized.d.ts +17 -0
  38. package/dist/i18n/ru.json.d.ts +45 -0
  39. package/dist/i18n/translator.d.ts +50 -0
  40. package/dist/i18n/validation-message.d.ts +18 -0
  41. package/dist/i18n.d.ts +31 -0
  42. package/dist/i18n.js +303 -0
  43. package/dist/index-BrNkQj1y.js +105 -0
  44. package/dist/index.js +737 -743
  45. package/dist/loader-Dv_Hl7JC.js +216 -0
  46. package/dist/locale/en.d.ts +2 -0
  47. package/dist/locale/en.js +5 -0
  48. package/dist/locale/en.json +42 -0
  49. package/dist/locale/index.d.ts +18 -0
  50. package/dist/locale/ru.d.ts +2 -0
  51. package/dist/locale/ru.js +41 -0
  52. package/dist/locale/ru.json +42 -0
  53. package/dist/locale.d.ts +2 -0
  54. package/dist/locale.js +9 -0
  55. package/dist/model/create-model.d.ts +17 -3
  56. package/dist/model/index.d.ts +8 -3
  57. package/dist/model/model-nodes.d.ts +67 -4
  58. package/dist/model/model-signals-proxy.d.ts +33 -1
  59. package/dist/model/model-value-proxy.d.ts +76 -0
  60. package/dist/model/types.d.ts +26 -9
  61. package/dist/model-value-proxy-caTmAiUd.js +419 -0
  62. package/dist/model.js +21 -17
  63. package/dist/node-BeV_lV5i.js +100 -0
  64. package/dist/platforms/react/form-bundle-context.d.ts +27 -0
  65. package/dist/platforms/react/hooks/types.d.ts +6 -3
  66. package/dist/platforms/react/hooks/useFormControlValue.d.ts +2 -1
  67. package/dist/platforms/react/i18n/context.d.ts +13 -0
  68. package/dist/platforms/react/i18n/hooks.d.ts +59 -0
  69. package/dist/platforms/react/i18n/provider.d.ts +52 -0
  70. package/dist/platforms/react/index.d.ts +1 -0
  71. package/dist/strategy-DgzELWno.js +204 -0
  72. package/dist/validation-error-B-U3RsV0.js +11 -0
  73. package/dist/validation.js +7 -6
  74. package/dist/validators/email.js +5 -8
  75. package/dist/validators/future-date.js +8 -11
  76. package/dist/validators/integer.js +4 -7
  77. package/dist/validators/is-date.js +5 -8
  78. package/dist/validators/is-number.js +4 -7
  79. package/dist/validators/max-age.js +8 -11
  80. package/dist/validators/max-date.js +8 -11
  81. package/dist/validators/max-length.js +5 -8
  82. package/dist/validators/max.js +4 -7
  83. package/dist/validators/min-age.js +8 -11
  84. package/dist/validators/min-date.js +8 -11
  85. package/dist/validators/min-length.js +5 -8
  86. package/dist/validators/min.js +4 -7
  87. package/dist/validators/multiple-of.js +5 -8
  88. package/dist/validators/non-negative.js +4 -7
  89. package/dist/validators/non-zero.js +4 -7
  90. package/dist/validators/past-date.js +8 -11
  91. package/dist/validators/pattern.js +5 -8
  92. package/dist/validators/phone.js +6 -9
  93. package/dist/validators/required.js +4 -7
  94. package/dist/validators/url.js +9 -14
  95. package/dist/validators.js +84 -106
  96. package/docs/llms/03-api-signatures.md +10 -4
  97. package/docs/llms/09-formschema.md +5 -5
  98. package/docs/llms/10-arrays.md +52 -3
  99. package/docs/llms/16-ui-components.md +2 -2
  100. package/docs/llms/18-conditional-fields.md +1 -1
  101. package/docs/llms/21-array-operations.md +26 -0
  102. package/docs/llms/28-submit-and-reset.md +3 -3
  103. package/docs/llms/29-async-preload.md +4 -4
  104. package/docs/llms/33-validation-strategy.md +2 -2
  105. package/docs/llms/34-i18n.md +272 -0
  106. package/docs/llms/35-unified-contract.md +246 -0
  107. package/llms-index.json +1 -1
  108. package/llms.txt +2746 -229
  109. package/package.json +22 -3
  110. package/dist/create-model-Dxh9cfLp.js +0 -97
  111. package/dist/model-signals-proxy-mV3WGdlO.js +0 -233
  112. package/dist/node-DGEFMTQu.js +0 -18
  113. package/dist/strategy-DA3JwxsR.js +0 -170
package/dist/index.js CHANGED
@@ -1,15 +1,17 @@
1
- import { c as te } from "./create-model-Dxh9cfLp.js";
2
- import { e as tt } from "./create-model-Dxh9cfLp.js";
3
- import { a as B } from "./model-signals-proxy-mV3WGdlO.js";
4
- import { i as rt, m as it, u as nt } from "./model-signals-proxy-mV3WGdlO.js";
5
- import { c as ot, a as lt, r as ut, b as dt, d as ct, e as ht, f as ft, s as vt, t as mt, w as pt } from "./behaviors-value-C7dSEhCc.js";
6
- import { signal as g, computed as m, effect as _, batch as se, Signal as G } from "@preact/signals-core";
7
- import { r as re } from "./signal-node-registry-tiwel-TV.js";
8
- import { g as gt } from "./signal-node-registry-tiwel-TV.js";
9
- import { f as ie, h as D, g as ne, d as ae } from "./strategy-DA3JwxsR.js";
10
- import { d as Et, e as _t } from "./node-DGEFMTQu.js";
11
- import Y, { useRef as A, useCallback as E, useMemo as oe, useEffect as J, useState as le, useImperativeHandle as ue } from "react";
12
- class M {
1
+ import { c as te } from "./create-model-BBRHhHwK.js";
2
+ import { e as dt, a as ct } from "./create-model-BBRHhHwK.js";
3
+ import { d as G, m as Y, b as D, i as j, f as W, h as L, p as se, g as re, j as ie } from "./model-value-proxy-caTmAiUd.js";
4
+ import { a as ft, c as vt, u as mt } from "./model-value-proxy-caTmAiUd.js";
5
+ import { c as yt, a as gt, r as bt, b as Et, d as _t, e as wt, f as At, s as Vt, t as kt, w as St } from "./behaviors-value-C7dSEhCc.js";
6
+ import { signal as m, computed as h, effect as g, batch as ne, Signal as ae } from "@preact/signals-core";
7
+ import { r as N } from "./signal-node-registry-tiwel-TV.js";
8
+ import { g as Nt } from "./signal-node-registry-tiwel-TV.js";
9
+ import { c as oe, u as le } from "./node-BeV_lV5i.js";
10
+ import { b as Ct, a as Pt, d as xt, e as Ot } from "./node-BeV_lV5i.js";
11
+ import { g as ue, i as I, h as de, d as ce } from "./strategy-DgzELWno.js";
12
+ import { useRef as E, useCallback as y, useMemo as he, useEffect as Q, useState as fe, createContext as ve, useContext as me, useImperativeHandle as pe } from "react";
13
+ import { s as P } from "./index-BrNkQj1y.js";
14
+ class x {
13
15
  // ============================================================================
14
16
  // Protected состояние (для Template Method паттерна)
15
17
  // ============================================================================
@@ -17,17 +19,17 @@ class M {
17
19
  * Пользователь взаимодействовал с узлом (touched)
18
20
  * Protected: наследники могут читать/изменять через методы
19
21
  */
20
- _touched = g(!1);
22
+ _touched = m(!1);
21
23
  /**
22
24
  * Значение узла было изменено (dirty)
23
25
  * Protected: наследники могут читать/изменять через методы
24
26
  */
25
- _dirty = g(!1);
27
+ _dirty = m(!1);
26
28
  /**
27
29
  * Текущий статус узла
28
30
  * Protected: наследники могут читать/изменять через методы
29
31
  */
30
- _status = g("valid");
32
+ _status = m("valid");
31
33
  // ============================================================================
32
34
  // Публичные computed signals (readonly для внешнего мира)
33
35
  // ============================================================================
@@ -35,21 +37,21 @@ class M {
35
37
  * Пользователь взаимодействовал с узлом (touched)
36
38
  * Computed из _touched для предоставления readonly интерфейса
37
39
  */
38
- touched = m(() => this._touched.value);
40
+ touched = h(() => this._touched.value);
39
41
  /**
40
42
  * Значение узла было изменено (dirty)
41
43
  * Computed из _dirty для предоставления readonly интерфейса
42
44
  */
43
- dirty = m(() => this._dirty.value);
45
+ dirty = h(() => this._dirty.value);
44
46
  /**
45
47
  * Текущий статус узла
46
48
  * Computed из _status для предоставления readonly интерфейса
47
49
  */
48
- status = m(() => this._status.value);
50
+ status = h(() => this._status.value);
49
51
  /**
50
52
  * Узел отключен (disabled)
51
53
  */
52
- disabled = m(() => this._status.value === "disabled");
54
+ disabled = h(() => this._status.value === "disabled");
53
55
  /**
54
56
  * Получить ошибки валидации с фильтрацией
55
57
  *
@@ -90,19 +92,19 @@ class M {
90
92
  * ```
91
93
  */
92
94
  getErrors(e) {
93
- const s = this.errors.value;
94
- return e ? s.filter((r) => {
95
- 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
+ const t = this.errors.value;
96
+ return e ? t.filter((i) => {
97
+ 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()))
96
98
  return !1;
97
99
  if (e.params !== void 0) {
98
- if (!r.params)
100
+ if (!i.params)
99
101
  return !1;
100
- for (const [i, n] of Object.entries(e.params))
101
- if (r.params[i] !== n)
102
+ for (const [r, n] of Object.entries(e.params))
103
+ if (i.params[r] !== n)
102
104
  return !1;
103
105
  }
104
- return !(e.predicate !== void 0 && !e.predicate(r));
105
- }) : s;
106
+ return !(e.predicate !== void 0 && !e.predicate(i));
107
+ }) : t;
106
108
  }
107
109
  // ============================================================================
108
110
  // Методы управления состоянием (Template Method)
@@ -274,7 +276,7 @@ class M {
274
276
  onEnable() {
275
277
  }
276
278
  }
277
- class R {
279
+ class $ {
278
280
  /**
279
281
  * Хранилище подписок
280
282
  * Ключ: уникальный идентификатор подписки
@@ -309,8 +311,8 @@ class R {
309
311
  * manager.remove('anotherSub');
310
312
  * ```
311
313
  */
312
- add(e, s) {
313
- return this.subscriptions.has(e) && (process.env.NODE_ENV !== "production" && console.warn(`[SubscriptionManager] Subscription "${e}" already exists, replacing`), this.subscriptions.get(e)?.()), this.subscriptions.set(e, s), () => this.remove(e);
314
+ add(e, t) {
315
+ return this.subscriptions.has(e) && (process.env.NODE_ENV !== "production" && console.warn(`[SubscriptionManager] Subscription "${e}" already exists, replacing`), this.subscriptions.get(e)?.()), this.subscriptions.set(e, t), () => this.remove(e);
314
316
  }
315
317
  /**
316
318
  * Удаляет подписку по ключу
@@ -334,8 +336,8 @@ class R {
334
336
  * ```
335
337
  */
336
338
  remove(e) {
337
- const s = this.subscriptions.get(e);
338
- return s ? (s(), this.subscriptions.delete(e), !0) : !1;
339
+ const t = this.subscriptions.get(e);
340
+ return t ? (t(), this.subscriptions.delete(e), !0) : !1;
339
341
  }
340
342
  /**
341
343
  * Очищает все подписки
@@ -442,7 +444,7 @@ class R {
442
444
  this.clear();
443
445
  }
444
446
  }
445
- const F = {
447
+ const k = {
446
448
  /** FieldNode.watch() */
447
449
  Watch: "watch",
448
450
  /** FieldNode.computeFrom() */
@@ -452,15 +454,15 @@ const F = {
452
454
  /** GroupNode.watchField() */
453
455
  WatchField: "watchField"
454
456
  };
455
- let de = 0;
456
- function O(t) {
457
- return `${t}-${++de}`;
457
+ let ye = 0;
458
+ function S(s) {
459
+ return `${s}-${++ye}`;
458
460
  }
459
- var S = /* @__PURE__ */ ((t) => (t.THROW = "throw", t.LOG = "log", t.CONVERT = "convert", t))(S || {});
460
- class k {
461
- static handle(e, s, r = "throw") {
462
- const i = this.extractMessage(e);
463
- switch (process.env.NODE_ENV !== "production" && console.error(`[${s}]`, e), r) {
461
+ var b = /* @__PURE__ */ ((s) => (s.THROW = "throw", s.LOG = "log", s.CONVERT = "convert", s))(b || {});
462
+ class w {
463
+ static handle(e, t, i = "throw") {
464
+ const r = this.extractMessage(e);
465
+ switch (process.env.NODE_ENV !== "production" && console.error(`[${t}]`, e), i) {
464
466
  case "throw":
465
467
  throw e;
466
468
  case "log":
@@ -468,8 +470,8 @@ class k {
468
470
  case "convert":
469
471
  return {
470
472
  code: "validator_error",
471
- message: i,
472
- params: { field: s }
473
+ message: r,
474
+ params: { field: t }
473
475
  };
474
476
  }
475
477
  }
@@ -524,11 +526,11 @@ class k {
524
526
  * // { code: 'required', message: 'This field is required', field: 'email' }
525
527
  * ```
526
528
  */
527
- static createValidationError(e, s, r) {
529
+ static createValidationError(e, t, i) {
528
530
  return {
529
531
  code: e,
530
- message: s,
531
- params: r ? { field: r } : void 0
532
+ message: t,
533
+ params: i ? { field: i } : void 0
532
534
  };
533
535
  }
534
536
  /**
@@ -550,7 +552,7 @@ class k {
550
552
  return typeof e == "object" && e !== null && "code" in e && "message" in e && typeof e.code == "string" && typeof e.message == "string";
551
553
  }
552
554
  }
553
- class ce {
555
+ class ge {
554
556
  /** Внутренний сигнал статуса */
555
557
  _status;
556
558
  /** Публичный read-only сигнал статуса */
@@ -567,7 +569,7 @@ class ce {
567
569
  * @param initial - Начальный статус (по умолчанию 'valid')
568
570
  */
569
571
  constructor(e = "valid") {
570
- 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");
572
+ this._status = m(e), this.status = h(() => this._status.value), this.valid = h(() => this._status.value === "valid"), this.invalid = h(() => this._status.value === "invalid"), this.pending = h(() => this._status.value === "pending"), this.disabled = h(() => this._status.value === "disabled");
571
573
  }
572
574
  /**
573
575
  * Начать валидацию
@@ -650,7 +652,7 @@ class ce {
650
652
  this._status.value = e ? "invalid" : "valid";
651
653
  }
652
654
  }
653
- class he extends M {
655
+ class be extends x {
654
656
  // ============================================================================
655
657
  // Приватные сигналы
656
658
  // ============================================================================
@@ -702,13 +704,13 @@ class he extends M {
702
704
  * Менеджер подписок для централизованного cleanup
703
705
  * Использует SubscriptionManager вместо массива для управления подписками
704
706
  */
705
- disposers = new R();
707
+ disposers = new $();
706
708
  component;
707
709
  // ============================================================================
708
710
  // Конструктор
709
711
  // ============================================================================
710
712
  constructor(e) {
711
- 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 ce(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(
713
+ 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 ?? m(e.value), this.initialValue = this._value.peek(), this._errors = m([]), this._componentProps = m(e.componentProps || {}), this.statusMachine = new ge(e.disabled ? "disabled" : "valid"), this.value = h(() => this._value.value), this.valid = h(() => this.statusMachine.valid.value), this.invalid = h(() => this.statusMachine.invalid.value), this.pending = h(() => this.statusMachine.pending.value), this.status = h(() => this.statusMachine.status.value), this.disabled = h(() => this.statusMachine.disabled.value), this.errors = h(() => this._errors.value), this.componentProps = h(() => this._componentProps.value), this.shouldShowError = h(
712
714
  () => this.statusMachine.invalid.value && (this._touched.value || this._dirty.value)
713
715
  );
714
716
  }
@@ -718,15 +720,15 @@ class he extends M {
718
720
  getValue() {
719
721
  return this._value.peek();
720
722
  }
721
- setValue(e, s) {
722
- if (this._value.value = e, this._dirty.value = !0, s?.emitEvent === !1)
723
+ setValue(e, t) {
724
+ if (this._value.value = e, this._dirty.value = !0, t?.emitEvent === !1)
723
725
  return;
724
- const r = this.validators.length > 0 || this.asyncValidators.length > 0, i = this._errors.value.length > 0;
726
+ const i = this.validators.length > 0 || this.asyncValidators.length > 0, r = this._errors.value.length > 0;
725
727
  if (this.updateOn === "change") {
726
728
  this.validate();
727
729
  return;
728
730
  }
729
- i && r && this.validate();
731
+ r && i && this.validate();
730
732
  }
731
733
  patchValue(e) {
732
734
  this.setValue(e);
@@ -816,23 +818,23 @@ class he extends M {
816
818
  * ```
817
819
  */
818
820
  async validate(e) {
819
- const s = e?.debounce ?? this.debounceMs;
820
- if (this.cancelPendingValidation(), s <= 0 || this.asyncValidators.length === 0)
821
+ const t = e?.debounce ?? this.debounceMs;
822
+ if (this.cancelPendingValidation(), t <= 0 || this.asyncValidators.length === 0)
821
823
  return this.validateImmediate();
822
- const r = new AbortController();
823
- return new Promise((i) => {
824
- this.pendingValidation = { resolve: i, abortController: r }, this.validateDebounceTimer = setTimeout(async () => {
825
- if (this.validateDebounceTimer = void 0, r.signal.aborted) {
826
- i(!1);
824
+ const i = new AbortController();
825
+ return new Promise((r) => {
826
+ this.pendingValidation = { resolve: r, abortController: i }, this.validateDebounceTimer = setTimeout(async () => {
827
+ if (this.validateDebounceTimer = void 0, i.signal.aborted) {
828
+ r(!1);
827
829
  return;
828
830
  }
829
831
  this.pendingValidation = void 0;
830
- const n = await this.validateImmediate(r);
831
- i(n);
832
- }, s), r.signal.addEventListener(
832
+ const n = await this.validateImmediate(i);
833
+ r(n);
834
+ }, t), i.signal.addEventListener(
833
835
  "abort",
834
836
  () => {
835
- this.validateDebounceTimer && (clearTimeout(this.validateDebounceTimer), this.validateDebounceTimer = void 0), i(!1);
837
+ this.validateDebounceTimer && (clearTimeout(this.validateDebounceTimer), this.validateDebounceTimer = void 0), r(!1);
836
838
  },
837
839
  { once: !0 }
838
840
  );
@@ -849,52 +851,52 @@ class he extends M {
849
851
  * - Проверяет signal.aborted в ключевых точках
850
852
  */
851
853
  async validateImmediate(e) {
852
- const s = e ?? new AbortController();
853
- e || this.currentAbortController?.abort(), this.currentAbortController = s;
854
- const { signal: r } = s, i = [];
854
+ const t = e ?? new AbortController();
855
+ e || this.currentAbortController?.abort(), this.currentAbortController = t;
856
+ const { signal: i } = t, r = [];
855
857
  for (const a of this.validators) {
856
- const l = a(this._value.value);
857
- l && i.push(l);
858
+ const u = a(this._value.value);
859
+ u && r.push(u);
858
860
  }
859
- if (r.aborted)
861
+ if (i.aborted)
860
862
  return !1;
861
- if (i.length > 0) {
862
- this._errors.value = i;
863
- const a = i.some((l) => l.severity !== "warning");
863
+ if (r.length > 0) {
864
+ this._errors.value = r;
865
+ const a = r.some((u) => u.severity !== "warning");
864
866
  if (this.statusMachine.setErrors(a), a)
865
867
  return !1;
866
868
  }
867
869
  if (this.asyncValidators.length > 0) {
868
- if (r.aborted)
870
+ if (i.aborted)
869
871
  return !1;
870
872
  this.statusMachine.startValidation();
871
873
  try {
872
874
  const a = await Promise.all(
873
875
  this.asyncValidators.map(async (d) => {
874
- if (r.aborted)
876
+ if (i.aborted)
875
877
  throw new DOMException("Validation aborted", "AbortError");
876
878
  try {
877
- const u = await d(this._value.value, { signal: r });
878
- if (r.aborted)
879
+ const l = await d(this._value.value, { signal: i });
880
+ if (i.aborted)
879
881
  throw new DOMException("Validation aborted", "AbortError");
880
- return u;
881
- } catch (u) {
882
- if (u instanceof DOMException && u.name === "AbortError")
883
- throw u;
884
- return k.handle(
885
- u,
882
+ return l;
883
+ } catch (l) {
884
+ if (l instanceof DOMException && l.name === "AbortError")
885
+ throw l;
886
+ return w.handle(
887
+ l,
886
888
  "FieldNode AsyncValidator",
887
- S.CONVERT
889
+ b.CONVERT
888
890
  );
889
891
  }
890
892
  })
891
893
  );
892
- if (r.aborted)
894
+ if (i.aborted)
893
895
  return !1;
894
- const l = a.filter((d) => d !== null);
895
- if (l.length > 0) {
896
- this._errors.value = l;
897
- const d = l.some((u) => u.severity !== "warning");
896
+ const u = a.filter((d) => d !== null);
897
+ if (u.length > 0) {
898
+ this._errors.value = u;
899
+ const d = u.some((l) => l.severity !== "warning");
898
900
  if (this.statusMachine.completeValidation(d), d)
899
901
  return !1;
900
902
  }
@@ -904,12 +906,12 @@ class he extends M {
904
906
  throw a;
905
907
  }
906
908
  }
907
- 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"));
909
+ return i.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"));
908
910
  }
909
911
  setErrors(e) {
910
912
  this._errors.value = e;
911
- const s = e.some((r) => r.severity !== "warning");
912
- this.statusMachine.setErrors(s);
913
+ const t = e.some((i) => i.severity !== "warning");
914
+ this.statusMachine.setErrors(t);
913
915
  }
914
916
  clearErrors() {
915
917
  this._errors.value = [], this.statusMachine.setErrors(!1);
@@ -966,10 +968,10 @@ class he extends M {
966
968
  *
967
969
  * @example
968
970
  * Пример node-level: плоская схема с инлайн-значениями (back-compat путь до M1). В layout-схеме
969
- * `createForm({ model, schema })` поля `validators` нет — правила живут в `defineValidationSchema`.
971
+ * `createFormFromModel({ model, schema })` поля `validators` нет — правила живут в `defineValidationSchema`.
970
972
  * ```typescript
971
973
  * // Сценарий 1: Instant feedback после submit
972
- * const form = createForm({
974
+ * const form = createLegacyForm({
973
975
  * email: {
974
976
  * value: '',
975
977
  * component: Input,
@@ -1027,12 +1029,12 @@ class he extends M {
1027
1029
  * ```
1028
1030
  */
1029
1031
  watch(e) {
1030
- const s = new AbortController(), r = _(() => {
1032
+ const t = new AbortController(), i = g(() => {
1031
1033
  const n = this.value.value;
1032
- e(n, s.signal);
1033
- }), i = O(F.Watch);
1034
- return this.disposers.add(i, () => {
1035
- s.abort(), r();
1034
+ e(n, t.signal);
1035
+ }), r = S(k.Watch);
1036
+ return this.disposers.add(r, () => {
1037
+ t.abort(), i();
1036
1038
  });
1037
1039
  }
1038
1040
  /**
@@ -1057,12 +1059,12 @@ class he extends M {
1057
1059
  * useEffect(() => dispose, []);
1058
1060
  * ```
1059
1061
  */
1060
- computeFrom(e, s) {
1061
- const r = _(() => {
1062
- const n = e.map((l) => l.value), a = s(...n);
1062
+ computeFrom(e, t) {
1063
+ const i = g(() => {
1064
+ const n = e.map((u) => u.value), a = t(...n);
1063
1065
  this.setValue(a, { emitEvent: !1 });
1064
- }), i = O(F.ComputeFrom);
1065
- return this.disposers.add(i, r);
1066
+ }), r = S(k.ComputeFrom);
1067
+ return this.disposers.add(r, i);
1066
1068
  }
1067
1069
  /**
1068
1070
  * Очистить все ресурсы и таймеры
@@ -1092,59 +1094,59 @@ class he extends M {
1092
1094
  }
1093
1095
  }
1094
1096
  }
1095
- function L(t) {
1096
- const { getChildren: e, ownErrors: s, disabled: r } = t, i = m(() => s.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(() => {
1097
- const o = [...s.value];
1097
+ function R(s) {
1098
+ const { getChildren: e, ownErrors: t, disabled: i } = s, r = h(() => t.value.length > 0 ? !1 : e().every((o) => o.disabled.value || o.valid.value)), n = h(() => !r.value), a = h(() => e().some((o) => o.pending.value)), u = h(() => e().some((o) => o.touched.value)), d = h(() => e().some((o) => o.dirty.value)), l = h(() => {
1099
+ const o = [...t.value];
1098
1100
  for (const f of e())
1099
1101
  o.push(...f.errors.value);
1100
1102
  return o;
1101
- }), h = m(() => r?.value ? "disabled" : a.value ? "pending" : n.value ? "invalid" : "valid");
1103
+ }), c = h(() => i?.value ? "disabled" : a.value ? "pending" : n.value ? "invalid" : "valid");
1102
1104
  return {
1103
- valid: i,
1105
+ valid: r,
1104
1106
  invalid: n,
1105
1107
  pending: a,
1106
- touched: l,
1108
+ touched: u,
1107
1109
  dirty: d,
1108
- errors: u,
1109
- status: h
1110
+ errors: l,
1111
+ status: c
1110
1112
  };
1111
1113
  }
1112
- function j(t) {
1113
- return typeof t == "object" && t !== null && "getProxy" in t && typeof t.getProxy == "function";
1114
+ function U(s) {
1115
+ return typeof s == "object" && s !== null && "getProxy" in s && typeof s.getProxy == "function";
1114
1116
  }
1115
- const U = "$";
1116
- function fe(t, e) {
1117
- let s;
1118
- const r = () => {
1119
- if (!s) {
1120
- const i = {};
1117
+ const H = "$";
1118
+ function Ee(s, e) {
1119
+ let t;
1120
+ const i = () => {
1121
+ if (!t) {
1122
+ const r = {};
1121
1123
  e.forEach((n, a) => {
1122
- i[a] = n && j(n) ? n.getProxy() : n;
1123
- }), s = i;
1124
+ r[a] = n && U(n) ? n.getProxy() : n;
1125
+ }), t = r;
1124
1126
  }
1125
- return s;
1127
+ return t;
1126
1128
  };
1127
- return new Proxy(t, {
1128
- get: (i, n) => {
1129
- if (n === U)
1130
- return r();
1131
- if (n in i)
1132
- return i[n];
1129
+ return new Proxy(s, {
1130
+ get: (r, n) => {
1131
+ if (n === H)
1132
+ return i();
1133
+ if (n in r)
1134
+ return r[n];
1133
1135
  if (typeof n == "string" && e.has(n)) {
1134
1136
  const a = e.get(n);
1135
- return a && j(a) ? a.getProxy() : a;
1137
+ return a && U(a) ? a.getProxy() : a;
1136
1138
  }
1137
1139
  },
1138
- set: (i, n, a) => typeof n == "string" && e.has(n) ? !1 : (i[n] = a, !0),
1139
- has: (i, n) => n === U || typeof n == "string" && e.has(n) ? !0 : n in i,
1140
- ownKeys: (i) => {
1141
- const n = Reflect.ownKeys(i), a = Array.from(e.keys());
1140
+ set: (r, n, a) => typeof n == "string" && e.has(n) ? !1 : (r[n] = a, !0),
1141
+ has: (r, n) => n === H || typeof n == "string" && e.has(n) ? !0 : n in r,
1142
+ ownKeys: (r) => {
1143
+ const n = Reflect.ownKeys(r), a = Array.from(e.keys());
1142
1144
  return [.../* @__PURE__ */ new Set([...n, ...a])];
1143
1145
  },
1144
- getOwnPropertyDescriptor: (i, n) => typeof n == "string" && e.has(n) ? { enumerable: !0, configurable: !0 } : Reflect.getOwnPropertyDescriptor(i, n)
1146
+ getOwnPropertyDescriptor: (r, n) => typeof n == "string" && e.has(n) ? { enumerable: !0, configurable: !0 } : Reflect.getOwnPropertyDescriptor(r, n)
1145
1147
  });
1146
1148
  }
1147
- class ve {
1149
+ class _e {
1148
1150
  /**
1149
1151
  * @param form - Форма для отправки
1150
1152
  */
@@ -1152,9 +1154,9 @@ class ve {
1152
1154
  this.form = e;
1153
1155
  }
1154
1156
  /** Внутренний сигнал состояния отправки */
1155
- _submitting = g(!1);
1157
+ _submitting = m(!1);
1156
1158
  /** Публичный read-only сигнал состояния отправки */
1157
- submitting = m(() => this._submitting.value);
1159
+ submitting = h(() => this._submitting.value);
1158
1160
  /**
1159
1161
  * Отправить форму
1160
1162
  *
@@ -1188,9 +1190,9 @@ class ve {
1188
1190
  * }
1189
1191
  * ```
1190
1192
  */
1191
- async submit(e, s) {
1192
- const { skipValidation: r = !1, skipTouch: i = !1 } = s || {};
1193
- if (i || this.form.markAsTouched(), !r && !await this.form.validate())
1193
+ async submit(e, t) {
1194
+ const { skipValidation: i = !1, skipTouch: r = !1 } = t || {};
1195
+ if (r || this.form.markAsTouched(), !i && !await this.form.validate())
1194
1196
  return null;
1195
1197
  this._submitting.value = !0;
1196
1198
  try {
@@ -1223,9 +1225,9 @@ class ve {
1223
1225
  * }
1224
1226
  * ```
1225
1227
  */
1226
- async submitWithResult(e, s) {
1227
- const { skipValidation: r = !1, skipTouch: i = !1 } = s || {};
1228
- if (i || this.form.markAsTouched(), !r && !await this.form.validate())
1228
+ async submitWithResult(e, t) {
1229
+ const { skipValidation: i = !1, skipTouch: r = !1 } = t || {};
1230
+ if (r || this.form.markAsTouched(), !i && !await this.form.validate())
1229
1231
  return { success: !1, data: null };
1230
1232
  this._submitting.value = !0;
1231
1233
  try {
@@ -1241,16 +1243,16 @@ class ve {
1241
1243
  }
1242
1244
  }
1243
1245
  }
1244
- function me(t) {
1246
+ function we(s) {
1245
1247
  const e = [];
1246
- for (const s of t.split(".")) {
1247
- const r = /^([^[\]]+)(?:\[(\d+)\])?$/.exec(s);
1248
- if (!r) return [];
1249
- e.push(r[2] !== void 0 ? { key: r[1], index: Number(r[2]) } : { key: r[1] });
1248
+ for (const t of s.split(".")) {
1249
+ const i = /^([^[\]]+)(?:\[(\d+)\])?$/.exec(t);
1250
+ if (!i) return [];
1251
+ e.push(i[2] !== void 0 ? { key: i[1], index: Number(i[2]) } : { key: i[1] });
1250
1252
  }
1251
1253
  return e;
1252
1254
  }
1253
- class w extends M {
1255
+ class _ extends x {
1254
1256
  // ============================================================================
1255
1257
  // Приватные поля
1256
1258
  // ============================================================================
@@ -1263,7 +1265,7 @@ class w extends M {
1263
1265
  /**
1264
1266
  * Менеджер подписок для централизованного cleanup
1265
1267
  */
1266
- disposers = new R();
1268
+ disposers = new $();
1267
1269
  /**
1268
1270
  * Ссылка на Proxy-инстанс
1269
1271
  */
@@ -1275,7 +1277,7 @@ class w extends M {
1275
1277
  /**
1276
1278
  * Фабрика для создания узлов формы
1277
1279
  */
1278
- nodeFactory = new pe();
1280
+ nodeFactory = new Ae();
1279
1281
  // ============================================================================
1280
1282
  // Приватные сигналы состояния (inline из StateManager)
1281
1283
  // ============================================================================
@@ -1283,9 +1285,9 @@ class w extends M {
1283
1285
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1284
1286
  formSubmitter;
1285
1287
  /** Флаг disabled состояния */
1286
- _disabled = g(!1);
1288
+ _disabled = m(!1);
1287
1289
  /** Form-level validation errors */
1288
- _formErrors = g([]);
1290
+ _formErrors = m([]);
1289
1291
  /**
1290
1292
  * M1: связь листовой ноды-ребёнка → её сигнал модели (тот, что помечает `markDerived`).
1291
1293
  * Нужна bulk-сеттерам (`setValue`/`patchValue`), чтобы корректно определять derived-поля:
@@ -1306,19 +1308,19 @@ class w extends M {
1306
1308
  status;
1307
1309
  submitting;
1308
1310
  constructor(e) {
1309
- super(), this.formSubmitter = new ve(this);
1310
- const s = e.form, r = s != null && typeof s == "object" && ("valueSignal" in s || "value" in s), n = "form" in e && !r ? e.form : e;
1311
- for (const [l, d] of Object.entries(n)) {
1312
- const u = this.createNode(d);
1313
- this._fields.set(l, u);
1311
+ super(), this.formSubmitter = new _e(this);
1312
+ const t = e.form, i = t != null && typeof t == "object" && ("valueSignal" in t || "value" in t), n = "form" in e && !i ? e.form : e;
1313
+ for (const [u, d] of Object.entries(n)) {
1314
+ const l = this.createNode(d);
1315
+ this._fields.set(u, l);
1314
1316
  }
1315
- this.value = m(() => {
1316
- const l = {};
1317
- return this._fields.forEach((d, u) => {
1318
- l[u] = d.value.value;
1319
- }), l;
1317
+ this.value = h(() => {
1318
+ const u = {};
1319
+ return this._fields.forEach((d, l) => {
1320
+ u[l] = d.value.value;
1321
+ }), u;
1320
1322
  });
1321
- const a = L({
1323
+ const a = R({
1322
1324
  getChildren: () => Array.from(this._fields.values()),
1323
1325
  ownErrors: this._formErrors,
1324
1326
  disabled: this._disabled
@@ -1333,35 +1335,35 @@ class w extends M {
1333
1335
  * @see buildFormProxy
1334
1336
  */
1335
1337
  buildProxy() {
1336
- return fe(this, this._fields);
1338
+ return Ee(this, this._fields);
1337
1339
  }
1338
1340
  // ============================================================================
1339
1341
  // Реализация абстрактных методов FormNode
1340
1342
  // ============================================================================
1341
1343
  getValue() {
1342
1344
  const e = {};
1343
- return this._fields.forEach((s, r) => {
1344
- e[r] = s.getValue();
1345
+ return this._fields.forEach((t, i) => {
1346
+ e[i] = t.getValue();
1345
1347
  }), e;
1346
1348
  }
1347
- setValue(e, s) {
1348
- for (const [r, i] of Object.entries(e)) {
1349
- const n = this._fields.get(r);
1349
+ setValue(e, t) {
1350
+ for (const [i, r] of Object.entries(e)) {
1351
+ const n = this._fields.get(i);
1350
1352
  if (n) {
1351
1353
  const a = this._fieldSignals.get(n) ?? n.value;
1352
- if (B(a)) continue;
1353
- n.setValue(i, s);
1354
+ if (G(a)) continue;
1355
+ n.setValue(r, t);
1354
1356
  }
1355
1357
  }
1356
1358
  }
1357
1359
  patchValue(e) {
1358
- se(() => {
1359
- for (const [s, r] of Object.entries(e)) {
1360
- const i = this._fields.get(s);
1361
- if (i && r !== void 0) {
1362
- const n = this._fieldSignals.get(i) ?? i.value;
1363
- if (B(n)) continue;
1364
- i.setValue(r, { emitEvent: !1 });
1360
+ ne(() => {
1361
+ for (const [t, i] of Object.entries(e)) {
1362
+ const r = this._fields.get(t);
1363
+ if (r && i !== void 0) {
1364
+ const n = this._fieldSignals.get(r) ?? r.value;
1365
+ if (G(n)) continue;
1366
+ r.setValue(i, { emitEvent: !1 });
1365
1367
  }
1366
1368
  }
1367
1369
  });
@@ -1384,9 +1386,9 @@ class w extends M {
1384
1386
  * ```
1385
1387
  */
1386
1388
  reset(e) {
1387
- this._formErrors.value = [], this._fields.forEach((s, r) => {
1388
- const i = e?.[r];
1389
- s.reset(i);
1389
+ this._formErrors.value = [], this._fields.forEach((t, i) => {
1390
+ const r = e?.[i];
1391
+ t.reset(r);
1390
1392
  });
1391
1393
  }
1392
1394
  /**
@@ -1398,8 +1400,8 @@ class w extends M {
1398
1400
  });
1399
1401
  }
1400
1402
  async validate() {
1401
- return this.clearErrors(), await Promise.all(Array.from(this._fields.values()).map((s) => s.validate())), Array.from(this._fields.values()).every(
1402
- (s) => s.valid.value || s.disabled.value
1403
+ return this.clearErrors(), await Promise.all(Array.from(this._fields.values()).map((t) => t.validate())), Array.from(this._fields.values()).every(
1404
+ (t) => t.valid.value || t.disabled.value
1403
1405
  );
1404
1406
  }
1405
1407
  /**
@@ -1485,8 +1487,8 @@ class w extends M {
1485
1487
  * `onSubmit` (или void-обработчик). Если вызывающей стороне нужно различать эти случаи —
1486
1488
  * используйте {@link submitWithResult}, который возвращает явный флаг `success`.
1487
1489
  */
1488
- async submit(e, s) {
1489
- return this.formSubmitter.submit(e, s);
1490
+ async submit(e, t) {
1491
+ return this.formSubmitter.submit(e, t);
1490
1492
  }
1491
1493
  /**
1492
1494
  * Отправить форму с расширенным результатом
@@ -1495,8 +1497,8 @@ class w extends M {
1495
1497
  * @param options - Опции submit
1496
1498
  * @returns Объект SubmitResult с данными, статусом и возможной ошибкой
1497
1499
  */
1498
- async submitWithResult(e, s) {
1499
- return this.formSubmitter.submitWithResult(e, s);
1500
+ async submitWithResult(e, t) {
1501
+ return this.formSubmitter.submitWithResult(e, t);
1500
1502
  }
1501
1503
  /**
1502
1504
  * Получить вложенное поле по пути
@@ -1530,21 +1532,21 @@ class w extends M {
1530
1532
  getFieldByPath(e) {
1531
1533
  if (e.startsWith(".") || e.endsWith("."))
1532
1534
  return;
1533
- const s = me(e);
1534
- if (s.length === 0)
1535
+ const t = we(e);
1536
+ if (t.length === 0)
1535
1537
  return;
1536
- let r = this;
1537
- for (const i of s) {
1538
- if (!(r instanceof w) || (r = r.getField(i.key), !r)) return;
1539
- if (i.index !== void 0)
1540
- if ("at" in r && "length" in r && typeof r.at == "function") {
1541
- const n = r.at(i.index);
1538
+ let i = this;
1539
+ for (const r of t) {
1540
+ if (!(i instanceof _) || (i = i.getField(r.key), !i)) return;
1541
+ if (r.index !== void 0)
1542
+ if ("at" in i && "length" in i && typeof i.at == "function") {
1543
+ const n = i.at(r.index);
1542
1544
  if (!n) return;
1543
- r = n;
1545
+ i = n;
1544
1546
  } else
1545
1547
  return;
1546
1548
  }
1547
- return r;
1549
+ return i;
1548
1550
  }
1549
1551
  // ============================================================================
1550
1552
  // Private методы для создания узлов
@@ -1573,17 +1575,17 @@ class w extends M {
1573
1575
  /**
1574
1576
  * Связывает два поля: при изменении source автоматически обновляется target
1575
1577
  */
1576
- linkFields(e, s, r) {
1577
- const i = this._fields.get(e), n = this._fields.get(s);
1578
- if (!i || !n) {
1579
- const d = i ? s : e;
1578
+ linkFields(e, t, i) {
1579
+ const r = this._fields.get(e), n = this._fields.get(t);
1580
+ if (!r || !n) {
1581
+ const d = r ? t : e;
1580
1582
  throw new Error(`GroupNode.linkFields: field "${String(d)}" not found`);
1581
1583
  }
1582
- const a = _(() => {
1583
- const d = i.value.value, u = r ? r(d) : d;
1584
- n.setValue(u, { emitEvent: !1 });
1585
- }), l = O(F.LinkFields);
1586
- return this.disposers.add(l, a);
1584
+ const a = g(() => {
1585
+ const d = r.value.value, l = i ? i(d) : d;
1586
+ n.setValue(l, { emitEvent: !1 });
1587
+ }), u = S(k.LinkFields);
1588
+ return this.disposers.add(u, a);
1587
1589
  }
1588
1590
  /**
1589
1591
  * Подписка на изменения вложенного поля по строковому пути
@@ -1613,27 +1615,27 @@ class w extends M {
1613
1615
  * ```
1614
1616
  */
1615
1617
  /** Подписка на top-level поле — value типизирован как `T[K]`. */
1616
- watchField(e, s) {
1617
- const r = this.getFieldByPath(e);
1618
- if (!r)
1618
+ watchField(e, t) {
1619
+ const i = this.getFieldByPath(e);
1620
+ if (!i)
1619
1621
  throw new Error(`GroupNode.watchField: field "${e}" not found`);
1620
- const i = _(() => {
1621
- s(r.value.value);
1622
- }), n = O(F.WatchField);
1623
- return this.disposers.add(n, i);
1622
+ const r = g(() => {
1623
+ t(i.value.value);
1624
+ }), n = S(k.WatchField);
1625
+ return this.disposers.add(n, r);
1624
1626
  }
1625
1627
  /**
1626
1628
  * Подписка на вложенное поле по строковому пути ("address.city").
1627
1629
  * Путь нельзя выразить в типах узла → value честно `unknown`, потребитель сужает.
1628
1630
  */
1629
- watchFieldByPath(e, s) {
1630
- const r = this.getFieldByPath(e);
1631
- if (!r)
1631
+ watchFieldByPath(e, t) {
1632
+ const i = this.getFieldByPath(e);
1633
+ if (!i)
1632
1634
  throw new Error(`GroupNode.watchFieldByPath: field "${e}" not found`);
1633
- const i = _(() => {
1634
- s(r.value.value);
1635
- }), n = O(F.WatchField);
1636
- return this.disposers.add(n, i);
1635
+ const r = g(() => {
1636
+ t(i.value.value);
1637
+ }), n = S(k.WatchField);
1638
+ return this.disposers.add(n, r);
1637
1639
  }
1638
1640
  /**
1639
1641
  * Hook: вызывается после disable()
@@ -1660,8 +1662,8 @@ class w extends M {
1660
1662
  * @internal
1661
1663
  */
1662
1664
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1663
- registerFieldSignal(e, s) {
1664
- this._fieldSignals.set(e, s);
1665
+ registerFieldSignal(e, t) {
1666
+ this._fieldSignals.set(e, t);
1665
1667
  }
1666
1668
  /**
1667
1669
  * Очистить все ресурсы узла
@@ -1672,7 +1674,7 @@ class w extends M {
1672
1674
  });
1673
1675
  }
1674
1676
  }
1675
- class W extends M {
1677
+ class q extends x {
1676
1678
  // ============================================================================
1677
1679
  // Приватные поля
1678
1680
  // ============================================================================
@@ -1683,9 +1685,9 @@ class W extends M {
1683
1685
  * Менеджер подписок для централизованного cleanup
1684
1686
  * Использует SubscriptionManager вместо массива для управления подписками
1685
1687
  */
1686
- disposers = new R();
1688
+ disposers = new $();
1687
1689
  /** Array-level validation errors (e.g., "минимум 1 элемент") */
1688
- _arrayErrors = g([]);
1690
+ _arrayErrors = m([]);
1689
1691
  // ============================================================================
1690
1692
  // Публичные computed signals
1691
1693
  // ============================================================================
@@ -1701,16 +1703,16 @@ class W extends M {
1701
1703
  // ============================================================================
1702
1704
  // Конструктор
1703
1705
  // ============================================================================
1704
- constructor(e, s = []) {
1705
- super(), this.itemSchema = e, this.initialItems = s, this.items = g([]);
1706
- for (const i of s)
1707
- this.push(i);
1708
- this.length = m(() => this.items.value.length), this.value = m(() => this.items.value.map((i) => i.value.value));
1709
- const r = L({
1706
+ constructor(e, t = []) {
1707
+ super(), this.itemSchema = e, this.initialItems = t, this.items = m([]);
1708
+ for (const r of t)
1709
+ this.push(r);
1710
+ this.length = h(() => this.items.value.length), this.value = h(() => this.items.value.map((r) => r.value.value));
1711
+ const i = R({
1710
1712
  getChildren: () => this.items.value,
1711
1713
  ownErrors: this._arrayErrors
1712
1714
  });
1713
- 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;
1715
+ this.valid = i.valid, this.invalid = i.invalid, this.pending = i.pending, this.touched = i.touched, this.dirty = i.dirty, this.errors = i.errors, this.status = i.status;
1714
1716
  }
1715
1717
  // ============================================================================
1716
1718
  // CRUD операции
@@ -1720,8 +1722,8 @@ class W extends M {
1720
1722
  * @param initialValue - Начальные значения для нового элемента
1721
1723
  */
1722
1724
  push(e) {
1723
- const s = this.createItem(e);
1724
- this.items.value = [...this.items.value, s];
1725
+ const t = this.createItem(e);
1726
+ this.items.value = [...this.items.value, t];
1725
1727
  }
1726
1728
  /**
1727
1729
  * Удалить элемент по индексу
@@ -1732,36 +1734,36 @@ class W extends M {
1732
1734
  */
1733
1735
  removeAt(e) {
1734
1736
  if (e < 0 || e >= this.items.value.length) {
1735
- k.handle(
1737
+ w.handle(
1736
1738
  new Error(
1737
1739
  `ArrayNode.removeAt: index ${e} out of bounds (length: ${this.items.value.length})`
1738
1740
  ),
1739
1741
  "ArrayNode.removeAt",
1740
- S.LOG
1742
+ b.LOG
1741
1743
  );
1742
1744
  return;
1743
1745
  }
1744
- const s = this.items.value[e];
1745
- this.items.value = this.items.value.filter((r, i) => i !== e), s && "dispose" in s && typeof s.dispose == "function" && s.dispose();
1746
+ const t = this.items.value[e];
1747
+ this.items.value = this.items.value.filter((i, r) => r !== e), t && "dispose" in t && typeof t.dispose == "function" && t.dispose();
1746
1748
  }
1747
1749
  /**
1748
1750
  * Вставить элемент в массив
1749
1751
  * @param index - Индекс для вставки
1750
1752
  * @param initialValue - Начальные значения для нового элемента
1751
1753
  */
1752
- insert(e, s) {
1754
+ insert(e, t) {
1753
1755
  if (e < 0 || e > this.items.value.length) {
1754
- k.handle(
1756
+ w.handle(
1755
1757
  new Error(
1756
1758
  `ArrayNode.insert: index ${e} out of bounds (length: ${this.items.value.length})`
1757
1759
  ),
1758
1760
  "ArrayNode.insert",
1759
- S.LOG
1761
+ b.LOG
1760
1762
  );
1761
1763
  return;
1762
1764
  }
1763
- const r = this.createItem(s), i = [...this.items.value];
1764
- i.splice(e, 0, r), this.items.value = i;
1765
+ const i = this.createItem(t), r = [...this.items.value];
1766
+ r.splice(e, 0, i), this.items.value = r;
1765
1767
  }
1766
1768
  /**
1767
1769
  * Переместить элемент массива с позиции `from` на позицию `to`
@@ -1779,19 +1781,19 @@ class W extends M {
1779
1781
  * form.items.move(2, 1);
1780
1782
  * ```
1781
1783
  */
1782
- move(e, s) {
1783
- const r = this.items.value.length;
1784
- if (e < 0 || e >= r || s < 0 || s >= r) {
1785
- k.handle(
1786
- new Error(`ArrayNode.move: index out of bounds (from=${e}, to=${s}, length=${r})`),
1784
+ move(e, t) {
1785
+ const i = this.items.value.length;
1786
+ if (e < 0 || e >= i || t < 0 || t >= i) {
1787
+ w.handle(
1788
+ new Error(`ArrayNode.move: index out of bounds (from=${e}, to=${t}, length=${i})`),
1787
1789
  "ArrayNode.move",
1788
- S.LOG
1790
+ b.LOG
1789
1791
  );
1790
1792
  return;
1791
1793
  }
1792
- if (e === s) return;
1793
- const i = [...this.items.value], [n] = i.splice(e, 1);
1794
- i.splice(s, 0, n), this.items.value = i;
1794
+ if (e === t) return;
1795
+ const r = [...this.items.value], [n] = r.splice(e, 1);
1796
+ r.splice(t, 0, n), this.items.value = r;
1795
1797
  }
1796
1798
  /**
1797
1799
  * Поменять местами два элемента массива
@@ -1807,19 +1809,19 @@ class W extends M {
1807
1809
  * form.items.swap(0, 2);
1808
1810
  * ```
1809
1811
  */
1810
- swap(e, s) {
1811
- const r = this.items.value.length;
1812
- if (e < 0 || e >= r || s < 0 || s >= r) {
1813
- k.handle(
1814
- new Error(`ArrayNode.swap: index out of bounds (a=${e}, b=${s}, length=${r})`),
1812
+ swap(e, t) {
1813
+ const i = this.items.value.length;
1814
+ if (e < 0 || e >= i || t < 0 || t >= i) {
1815
+ w.handle(
1816
+ new Error(`ArrayNode.swap: index out of bounds (a=${e}, b=${t}, length=${i})`),
1815
1817
  "ArrayNode.swap",
1816
- S.LOG
1818
+ b.LOG
1817
1819
  );
1818
1820
  return;
1819
1821
  }
1820
- if (e === s) return;
1821
- const i = [...this.items.value];
1822
- [i[e], i[s]] = [i[s], i[e]], this.items.value = i;
1822
+ if (e === t) return;
1823
+ const r = [...this.items.value];
1824
+ [r[e], r[t]] = [r[t], r[e]], this.items.value = r;
1823
1825
  }
1824
1826
  /**
1825
1827
  * Удалить все элементы массива
@@ -1829,8 +1831,8 @@ class W extends M {
1829
1831
  */
1830
1832
  clear() {
1831
1833
  const e = [...this.items.value];
1832
- this.items.value = [], e.forEach((s) => {
1833
- "dispose" in s && typeof s.dispose == "function" && s.dispose();
1834
+ this.items.value = [], e.forEach((t) => {
1835
+ "dispose" in t && typeof t.dispose == "function" && t.dispose();
1834
1836
  });
1835
1837
  }
1836
1838
  /**
@@ -1839,9 +1841,9 @@ class W extends M {
1839
1841
  * @returns Типизированный GroupNode proxy или undefined если индекс вне границ
1840
1842
  */
1841
1843
  at(e) {
1842
- const s = this.items.value[e];
1843
- if (s)
1844
- return s.getProxy();
1844
+ const t = this.items.value[e];
1845
+ if (t)
1846
+ return t.getProxy();
1845
1847
  }
1846
1848
  // ============================================================================
1847
1849
  // Реализация абстрактных методов
@@ -1849,14 +1851,14 @@ class W extends M {
1849
1851
  getValue() {
1850
1852
  return this.items.value.map((e) => e.getValue());
1851
1853
  }
1852
- setValue(e, s) {
1853
- this.clear(), e.forEach((r) => this.push(r)), s?.emitEvent !== !1 && this.validate().catch((r) => {
1854
- k.handle(r, "ArrayNode.setValue", S.LOG);
1854
+ setValue(e, t) {
1855
+ this.clear(), e.forEach((i) => this.push(i)), t?.emitEvent !== !1 && this.validate().catch((i) => {
1856
+ w.handle(i, "ArrayNode.setValue", b.LOG);
1855
1857
  });
1856
1858
  }
1857
1859
  patchValue(e) {
1858
- e.forEach((s, r) => {
1859
- this.items.value[r] && s !== void 0 && this.items.value[r].patchValue(s);
1860
+ e.forEach((t, i) => {
1861
+ this.items.value[i] && t !== void 0 && this.items.value[i].patchValue(t);
1860
1862
  });
1861
1863
  }
1862
1864
  /**
@@ -1877,7 +1879,7 @@ class W extends M {
1877
1879
  * ```
1878
1880
  */
1879
1881
  reset(e) {
1880
- this._arrayErrors.value = [], this.clear(), e && e.forEach((s) => this.push(s));
1882
+ this._arrayErrors.value = [], this.clear(), e && e.forEach((t) => this.push(t));
1881
1883
  }
1882
1884
  /**
1883
1885
  * Сбросить массив к исходным значениям (initialItems)
@@ -1911,7 +1913,7 @@ class W extends M {
1911
1913
  this._arrayErrors.value = [], this.clear(), this.initialItems.forEach((e) => this.push(e));
1912
1914
  }
1913
1915
  async validate() {
1914
- return (await Promise.all(this.items.value.map((s) => s.validate()))).every(Boolean) && this._arrayErrors.value.length === 0;
1916
+ return (await Promise.all(this.items.value.map((t) => t.validate()))).every(Boolean) && this._arrayErrors.value.length === 0;
1915
1917
  }
1916
1918
  /**
1917
1919
  * Установить array-level validation errors
@@ -1984,9 +1986,9 @@ class W extends M {
1984
1986
  * @param callback - Функция, вызываемая для каждого элемента с типизированным GroupNode proxy
1985
1987
  */
1986
1988
  forEach(e) {
1987
- this.items.value.forEach((s, r) => {
1988
- const i = s.getProxy();
1989
- e(i, r);
1989
+ this.items.value.forEach((t, i) => {
1990
+ const r = t.getProxy();
1991
+ e(r, i);
1990
1992
  });
1991
1993
  }
1992
1994
  /**
@@ -1995,9 +1997,9 @@ class W extends M {
1995
1997
  * @returns Новый массив результатов
1996
1998
  */
1997
1999
  map(e) {
1998
- return this.items.value.map((s, r) => {
1999
- const i = s.getProxy();
2000
- return e(i, r);
2000
+ return this.items.value.map((t, i) => {
2001
+ const r = t.getProxy();
2002
+ return e(r, i);
2001
2003
  });
2002
2004
  }
2003
2005
  // ============================================================================
@@ -2009,8 +2011,8 @@ class W extends M {
2009
2011
  */
2010
2012
  createItem(e) {
2011
2013
  if (this.isGroupSchema(this.itemSchema)) {
2012
- const s = new w(this.itemSchema);
2013
- return e && s.patchValue(e), s;
2014
+ const t = new _(this.itemSchema);
2015
+ return e && t.patchValue(e), t;
2014
2016
  }
2015
2017
  throw new Error(
2016
2018
  "ArrayNode поддерживает только GroupNode элементы. Для массива примитивов используйте обычное поле с типом массива."
@@ -2087,7 +2089,7 @@ class W extends M {
2087
2089
  });
2088
2090
  }
2089
2091
  }
2090
- class pe {
2092
+ class Ae {
2091
2093
  /**
2092
2094
  * Создает узел формы на основе конфигурации
2093
2095
  *
@@ -2138,14 +2140,14 @@ class pe {
2138
2140
  if (Array.isArray(e) && e.length >= 1)
2139
2141
  return this.createArrayNodeFromArray(e);
2140
2142
  if (this.isFieldConfig(e))
2141
- return new he(e);
2143
+ return new be(e);
2142
2144
  if (this.isArrayConfig(e))
2143
- return new W(
2145
+ return new q(
2144
2146
  e.schema,
2145
2147
  e.initialItems
2146
2148
  );
2147
2149
  if (this.isGroupConfig(e))
2148
- return new w(e);
2150
+ return new _(e);
2149
2151
  throw new Error(
2150
2152
  `NodeFactory: Unknown node config. Expected FieldConfig, GroupConfig, or ArrayConfig, but got: ${JSON.stringify(
2151
2153
  e
@@ -2179,11 +2181,11 @@ class pe {
2179
2181
  */
2180
2182
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2181
2183
  createArrayNodeFromArray(e) {
2182
- const [s, ...r] = e, i = [];
2183
- this.isGroupConfig(s) && i.push(this.extractValues(s));
2184
- for (const n of r)
2185
- this.isGroupConfig(n) ? i.push(this.extractValues(n)) : i.push(n);
2186
- return new W(s, i);
2184
+ const [t, ...i] = e, r = [];
2185
+ this.isGroupConfig(t) && r.push(this.extractValues(t));
2186
+ for (const n of i)
2187
+ this.isGroupConfig(n) ? r.push(this.extractValues(n)) : r.push(n);
2188
+ return new q(t, r);
2187
2189
  }
2188
2190
  /**
2189
2191
  * Извлечь значения из схемы (рекурсивно)
@@ -2218,12 +2220,12 @@ class pe {
2218
2220
  if (this.isFieldConfig(e))
2219
2221
  return e.value;
2220
2222
  if (Array.isArray(e))
2221
- return e.map((s) => this.extractValues(s));
2223
+ return e.map((t) => this.extractValues(t));
2222
2224
  if (this.isGroupConfig(e)) {
2223
- const s = {};
2224
- for (const [r, i] of Object.entries(e))
2225
- s[r] = this.extractValues(i);
2226
- return s;
2225
+ const t = {};
2226
+ for (const [i, r] of Object.entries(e))
2227
+ t[i] = this.extractValues(r);
2228
+ return t;
2227
2229
  }
2228
2230
  return e;
2229
2231
  }
@@ -2302,43 +2304,43 @@ class pe {
2302
2304
  return e != null && typeof e == "object" && !this.isFieldConfig(e) && !this.isArrayConfig(e);
2303
2305
  }
2304
2306
  }
2305
- class ye extends M {
2307
+ class Ve extends x {
2306
2308
  /**
2307
2309
  * @param control Реактивный массив модели (`model.<path>`).
2308
2310
  * @param buildItem Строитель формы элемента по его под-модели (инъекция, чтобы избежать цикла
2309
- * импорта с `create-form`). Обычно `(item) => createForm({ model: item, schema: itemSchema(item) })`.
2310
- */
2311
- constructor(e, s) {
2312
- super(), this.control = e, this.buildItem = s, this.initial = e.toArray(), this.disposeSync = _(() => {
2313
- const i = e.length, n = [], a = [];
2314
- for (let u = 0; u < i; u++) {
2315
- const h = e.at(u);
2316
- if (!h) continue;
2317
- let o = this.cache.get(h);
2318
- o || (o = s(h), this.cache.set(h, o)), n.push(h), a.push(o);
2311
+ * импорта с `create-form`). Обычно `(item) => createFormFromModel({ model: item, schema: itemSchema(item) })`.
2312
+ */
2313
+ constructor(e, t) {
2314
+ super(), this.control = e, this.buildItem = t, this.initial = e.toArray(), this.disposeSync = g(() => {
2315
+ const r = e.length, n = [], a = [];
2316
+ for (let l = 0; l < r; l++) {
2317
+ const c = e.at(l);
2318
+ if (!c) continue;
2319
+ let o = this.cache.get(c);
2320
+ o || (o = t(c), this.cache.set(c, o)), n.push(c), a.push(o);
2319
2321
  }
2320
- const l = new Set(n), d = [];
2321
- for (const u of this.mountedModels) {
2322
- if (l.has(u)) continue;
2323
- const h = this.cache.get(u);
2324
- this.cache.delete(u), h && d.push(h);
2322
+ const u = new Set(n), d = [];
2323
+ for (const l of this.mountedModels) {
2324
+ if (u.has(l)) continue;
2325
+ const c = this.cache.get(l);
2326
+ this.cache.delete(l), c && d.push(c);
2325
2327
  }
2326
- this.mountedModels = n, this.itemNodes.value = a, d.forEach((u) => this.disposeItemNode(u));
2327
- }), this.length = m(() => this.itemNodes.value.length), this.value = m(() => this.itemNodes.value.map((i) => i.value.value));
2328
- const r = L({
2328
+ this.mountedModels = n, this.itemNodes.value = a, d.forEach((l) => this.disposeItemNode(l));
2329
+ }), this.length = h(() => this.itemNodes.value.length), this.value = h(() => this.itemNodes.value.map((r) => r.value.value));
2330
+ const i = R({
2329
2331
  getChildren: () => this.itemNodes.value,
2330
2332
  ownErrors: this._arrayErrors
2331
2333
  });
2332
- 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;
2334
+ this.valid = i.valid, this.invalid = i.invalid, this.pending = i.pending, this.touched = i.touched, this.dirty = i.dirty, this.errors = i.errors, this.status = i.status;
2333
2335
  }
2334
- itemNodes = g([]);
2336
+ itemNodes = m([]);
2335
2337
  // Кэш per-item формы по идентичности фасада под-модели (фасады кэшируются в core).
2336
2338
  cache = /* @__PURE__ */ new WeakMap();
2337
2339
  // Фасады под-моделей, для которых сейчас смонтированы формы — «предыдущий» набор для
2338
2340
  // реконсиляции в disposeSync. Выпавшие из массива элементы диспозятся и вытесняются из кэша.
2339
2341
  mountedModels = [];
2340
2342
  initial;
2341
- _arrayErrors = g([]);
2343
+ _arrayErrors = m([]);
2342
2344
  disposeSync;
2343
2345
  /**
2344
2346
  * Сигнал per-item форм. Публичен в т.ч. чтобы `isArrayNode` распознавал узел как массив
@@ -2361,17 +2363,22 @@ class ye extends M {
2361
2363
  return this.itemNodes.value[e];
2362
2364
  }
2363
2365
  map(e) {
2364
- return this.itemNodes.value.map((s, r) => e(s, r));
2366
+ return this.itemNodes.value.map((t, i) => e(t, i));
2365
2367
  }
2366
2368
  forEach(e) {
2367
- this.itemNodes.value.forEach((s, r) => e(s, r));
2369
+ this.itemNodes.value.forEach((t, i) => e(t, i));
2368
2370
  }
2369
2371
  // ── Мутации (делегируют массиву модели; effect пересоберёт itemNodes) ──────
2372
+ /**
2373
+ * Добавить элемент. Без значения — элемент по шаблону массива модели (`arrayOf(blank)` либо
2374
+ * `initialValue` узла-массива схемы); шаблона нет — ошибка модели.
2375
+ */
2370
2376
  push(e) {
2371
- this.control.push(e ?? {});
2377
+ this.control.push(e);
2372
2378
  }
2373
- insert(e, s) {
2374
- this.control.insertAt(e, s ?? {});
2379
+ /** Вставить элемент по индексу; без значения — по шаблону, как у {@link push}. */
2380
+ insert(e, t) {
2381
+ this.control.insertAt(e, t);
2375
2382
  }
2376
2383
  removeAt(e) {
2377
2384
  this.control.removeAt(e);
@@ -2380,12 +2387,12 @@ class ye extends M {
2380
2387
  * Переместить элемент модель-массива. Делегирует мутацию массиву модели; внутренний `effect`
2381
2388
  * пересоберёт `itemNodes` в новом порядке (per-item формы сохраняются по кешу идентичности).
2382
2389
  */
2383
- move(e, s) {
2384
- this.control.move(e, s);
2390
+ move(e, t) {
2391
+ this.control.move(e, t);
2385
2392
  }
2386
2393
  /** Поменять местами два элемента модель-массива (см. {@link move}). */
2387
- swap(e, s) {
2388
- this.control.swap(e, s);
2394
+ swap(e, t) {
2395
+ this.control.swap(e, t);
2389
2396
  }
2390
2397
  clear() {
2391
2398
  this.control.clear();
@@ -2395,7 +2402,7 @@ class ye extends M {
2395
2402
  return this.control.toArray();
2396
2403
  }
2397
2404
  setValue(e) {
2398
- this.control.clear(), (e ?? []).forEach((s) => this.control.push(s));
2405
+ this.control.clear(), (e ?? []).forEach((t) => this.control.push(t));
2399
2406
  }
2400
2407
  patchValue(e) {
2401
2408
  this.setValue(e);
@@ -2409,7 +2416,7 @@ class ye extends M {
2409
2416
  async validate() {
2410
2417
  return (await Promise.all(
2411
2418
  this.itemNodes.value.map(
2412
- (s) => s.validate()
2419
+ (t) => t.validate()
2413
2420
  )
2414
2421
  )).every(Boolean) && this._arrayErrors.value.length === 0;
2415
2422
  }
@@ -2464,280 +2471,251 @@ class ye extends M {
2464
2471
  this.disposeSync(), this.itemNodes.value.forEach((e) => this.disposeItemNode(e)), this.mountedModels = [];
2465
2472
  }
2466
2473
  }
2467
- const Q = (t) => t !== null && typeof t == "object" && !Array.isArray(t) && !(t instanceof Date) && !(typeof Blob < "u" && t instanceof Blob) && !(typeof File < "u" && t instanceof File);
2468
- function I(t, e, s) {
2469
- if (t == null || typeof t != "object" || t instanceof G) return;
2470
- if (typeof t.getProxy == "function") {
2474
+ const K = /* @__PURE__ */ new WeakMap();
2475
+ function X(s, e) {
2476
+ let t = K.get(e);
2477
+ return t || (t = /* @__PURE__ */ new Map(), K.set(e, t)), t.has(s) || t.set(s, s(e)), t.get(s);
2478
+ }
2479
+ function M(s, e, t, i) {
2480
+ if (s == null || typeof s != "object" || D(s) || j(s) || W(s) || s.$$typeof !== void 0 || i.has(s)) return;
2481
+ if (i.add(s), typeof s.getProxy == "function") {
2471
2482
  process.env.NODE_ENV !== "production" && console.warn(
2472
2483
  "[reformer] createForm({ schema }): в схему попал узел формы (FormProxy) — он пропущен. Стройте дерево для createForm БЕЗ формы, а форму донесите до узла вторым проходом (билдер `(model, form?) => …`) либо через render-behavior `patchProps({ form })`."
2473
2484
  );
2474
2485
  return;
2475
2486
  }
2476
- if (Array.isArray(t)) {
2477
- for (const n of t) I(n, e, s);
2487
+ if (Array.isArray(s)) {
2488
+ for (const a of s) M(a, e, t, i);
2478
2489
  return;
2479
2490
  }
2480
- const r = t, i = r.array;
2481
- if (i && typeof i.__path == "string" && typeof r.item == "function") {
2482
- s.set(i.__path, r.item);
2483
- return;
2491
+ const r = s;
2492
+ if (typeof r.item == "function") {
2493
+ const a = L(r.model) ?? L(r.array);
2494
+ if (a) {
2495
+ t.set(a, r.item), r.initialValue !== void 0 && se(a, r.initialValue);
2496
+ return;
2497
+ }
2498
+ if (r.array != null) {
2499
+ process.env.NODE_ENV !== "production" && console.warn(
2500
+ "[reformer] createForm({ schema }): у узла-массива `array` — не массив модели, узел пропущен. Ожидается `model: model.$.<массив>`."
2501
+ );
2502
+ return;
2503
+ }
2504
+ }
2505
+ if (typeof r.part == "function") {
2506
+ const a = re(r.model);
2507
+ if (a) {
2508
+ const u = Y(a), d = X(r.part, u);
2509
+ M(d, e, t, i);
2510
+ return;
2511
+ }
2484
2512
  }
2485
- r.value instanceof G ? e.set(r.value, {
2513
+ const n = D(r.model) ? r.model : r.value;
2514
+ D(n) ? e.set(n, {
2486
2515
  component: r.component,
2487
2516
  componentProps: r.componentProps,
2488
2517
  updateOn: r.updateOn,
2489
2518
  disabled: r.disabled,
2490
2519
  debounce: r.debounce
2491
- }) : process.env.NODE_ENV !== "production" && r.component !== void 0 && ("valueSignal" in r || r.value != null) && console.warn(
2492
- "[reformer] createForm({ schema }): узел с `component` не распознан как поле — `value` не является сигналом модели. Ожидается `value: model.$.<path>`; проверьте, что не передан `value: model.<path>` (value-прокси) или `valueSignal:`."
2520
+ }) : process.env.NODE_ENV !== "production" && r.component !== void 0 && ("valueSignal" in r || r.value != null || W(r.model) || j(r.model)) && console.warn(
2521
+ "[reformer] createForm({ schema }): узел с `component` не распознан как поле — привязка не является сигналом модели. Ожидается `model: model.$.<path>` (лист или массив); проверьте, что не передан `model: model.<path>` (value-прокси), группа без `part` или `valueSignal:`."
2493
2522
  );
2494
- for (const [n, a] of Object.entries(r))
2495
- n !== "value" && I(a, e, s);
2523
+ for (const a of Object.values(r)) M(a, e, t, i);
2496
2524
  }
2497
- function X(t, e, s, r) {
2498
- const i = {};
2499
- for (const [n, a] of Object.entries(e)) {
2500
- const l = s === "" ? n : `${s}.${n}`;
2501
- if (Array.isArray(a))
2525
+ function Z(s, e, t, i, r) {
2526
+ const n = {};
2527
+ for (const a of Object.keys(s)) {
2528
+ const u = e === "" ? a : `${e}.${a}`, d = s[a];
2529
+ if (ie(d)) {
2530
+ const l = i.get(d);
2531
+ if (l) {
2532
+ r.arrays.push({ path: u, handle: d, item: l });
2533
+ continue;
2534
+ }
2535
+ const c = t.get(d);
2536
+ if (c !== void 0) {
2537
+ const o = d;
2538
+ n[a] = { ...c, valueSignal: o }, r.fields.push({ path: u, signal: o });
2539
+ }
2502
2540
  continue;
2503
- if (Q(a)) {
2504
- i[n] = X(t, a, l, r);
2541
+ }
2542
+ if (d instanceof ae) {
2543
+ n[a] = { ...t.get(d) ?? {}, valueSignal: d }, r.fields.push({ path: u, signal: d });
2505
2544
  continue;
2506
2545
  }
2507
- const d = t.signalAt(l);
2508
- if (!d) throw new Error(`createForm({ model }): не найден сигнал для пути "${l}"`);
2509
- const u = r.get(d) ?? {};
2510
- i[n] = { ...u, valueSignal: d };
2546
+ r.groups.push({ path: u, handle: d }), n[a] = Z(
2547
+ d,
2548
+ u,
2549
+ t,
2550
+ i,
2551
+ r
2552
+ );
2511
2553
  }
2512
- return i;
2554
+ return n;
2513
2555
  }
2514
- function Z(t, e, s) {
2515
- for (const [r, i] of Object.entries(t)) {
2516
- const n = e === "" ? r : `${e}.${r}`;
2517
- Array.isArray(i) || (Q(i) ? Z(i, n, s) : s.push(n));
2518
- }
2556
+ function z(s, e) {
2557
+ const t = e.lastIndexOf(".");
2558
+ if (t === -1) return s;
2559
+ const i = s.getFieldByPath(e.slice(0, t));
2560
+ return i instanceof _ ? i : void 0;
2519
2561
  }
2520
- function ee(t) {
2521
- const { model: e, schema: s, behavior: r } = t, i = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
2522
- s !== void 0 && I(s, i, n);
2523
- const a = X(e, e.get(), "", i), l = new w(a), d = e.get();
2524
- for (const [o, f] of Object.entries(d)) {
2525
- if (!Array.isArray(f)) continue;
2526
- const c = n.get(o);
2527
- if (!c) continue;
2528
- const v = e[o], p = (y) => ee({ model: y, schema: c(y) }), b = new ye(v, p);
2529
- l.fields.set(o, b);
2530
- }
2531
- const u = l.getProxy(), h = [];
2532
- Z(e.get(), "", h);
2533
- for (const o of h) {
2534
- const f = e.signalAt(o), c = l.getFieldByPath(o);
2535
- if (f && c) {
2536
- re(f, c);
2537
- const v = o.lastIndexOf("."), p = v === -1 ? l : l.getFieldByPath(o.slice(0, v));
2538
- p instanceof w && p.registerFieldSignal(c, f);
2539
- }
2540
- }
2541
- return r && l.attachBehaviorCleanup(r.__run(e, u)), u;
2562
+ function ee(s) {
2563
+ const { model: e, schema: t, behavior: i } = s, r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
2564
+ t !== void 0 && M(t, r, n, /* @__PURE__ */ new WeakSet());
2565
+ const a = e.$, u = { fields: [], groups: [], arrays: [] }, d = Z(a, "", r, n, u), l = new _(d);
2566
+ for (const { path: o, handle: f, item: v } of u.arrays) {
2567
+ const p = z(l, o);
2568
+ if (!p) continue;
2569
+ const F = (V) => ee({ model: V, schema: X(v, V) }), T = Y(f), A = new Ve(T, F);
2570
+ p.fields.set(o.slice(o.lastIndexOf(".") + 1), A), N(f, A);
2571
+ }
2572
+ const c = l.getProxy();
2573
+ N(e.$, l);
2574
+ for (const { path: o, handle: f } of u.groups) {
2575
+ const v = l.getFieldByPath(o);
2576
+ v && N(f, v);
2577
+ }
2578
+ for (const { path: o, signal: f } of u.fields) {
2579
+ const v = l.getFieldByPath(o);
2580
+ v && (N(f, v), z(l, o)?.registerFieldSignal(v, f));
2581
+ }
2582
+ return i && l.attachBehaviorCleanup(i.__run(e, c, s.schemaController)), c;
2542
2583
  }
2543
- const ge = (t) => t != null && typeof t == "object" && "model" in t && typeof t.model?.signalAt == "function";
2544
- function be(t) {
2545
- return ge(t) ? ee(t) : new w(t).getProxy();
2584
+ function Je(s) {
2585
+ return new _(s).getProxy();
2546
2586
  }
2547
- const Ee = () => {
2587
+ const ke = () => {
2548
2588
  };
2549
- function _e(t, e) {
2589
+ function Se(s, e) {
2550
2590
  if (!e) return;
2551
- const s = typeof e == "function" ? { schema: e } : e, r = Object.keys(s.steps ?? {}), i = r.map((o) => s.steps?.[o]).filter((o) => o != null), n = s.schema ?? ie(
2552
- () => ae(...i, ...s.extras ? [s.extras] : [])
2591
+ const t = typeof e == "function" ? { schema: e } : e, i = Object.keys(t.steps ?? {}), r = i.map((o) => t.steps?.[o]).filter((o) => o != null), n = t.schema ?? ue(
2592
+ () => ce(...r, ...t.extras ? [t.extras] : [])
2553
2593
  ), a = (o) => {
2554
- const f = typeof o == "number" ? r[o - 1] : o;
2555
- return (f != null ? s.steps?.[f] : null) ?? null;
2556
- }, { strategy: l, debounce: d, liveAfterSubmit: u } = s, h = D(t, n, {
2557
- strategy: l,
2594
+ const f = typeof o == "number" ? i[o - 1] : o;
2595
+ return (f != null ? t.steps?.[f] : null) ?? null;
2596
+ }, { strategy: u, debounce: d, liveAfterSubmit: l } = t, c = I(s, n, {
2597
+ strategy: u,
2558
2598
  debounce: d,
2559
- liveAfterSubmit: u
2599
+ liveAfterSubmit: l
2560
2600
  });
2561
2601
  return {
2562
2602
  schema: n,
2563
- stepSelectors: r,
2564
- validate: () => h.validate(),
2565
- validateAll: () => h.validate(),
2566
- validateStep: (o) => ne(t, a(o) ?? Ee, { touch: !0 }),
2603
+ stepSelectors: i,
2604
+ validate: () => c.validate(),
2605
+ validateAll: () => c.validate(),
2606
+ validateStep: (o) => de(s, a(o) ?? ke, { touch: !0 }),
2567
2607
  createStepController: (o) => {
2568
- if (!l || l === "submit") return null;
2608
+ if (!u || u === "submit") return null;
2569
2609
  const f = a(o);
2570
- return f ? D(t, f, { strategy: l, debounce: d, liveAfterSubmit: u }) : null;
2610
+ return f ? I(s, f, { strategy: u, debounce: d, liveAfterSubmit: l }) : null;
2571
2611
  },
2572
- controller: h,
2573
- validating: h.validating
2612
+ controller: c,
2613
+ validating: c.validating
2574
2614
  };
2575
2615
  }
2576
- function je(t) {
2577
- if (!t.model && t.initial === void 0)
2578
- throw new Error("createCoreForm: provide either `initial` (to create a model) or `model`.");
2579
- const e = t.model ?? te(t.initial);
2580
- t.seed?.(e);
2581
- const s = be({
2582
- model: e,
2583
- ...t.schema ? { schema: t.schema(e) } : {},
2584
- ...t.behavior ? { behavior: t.behavior } : {}
2585
- }), r = _e(e, t.validation), i = { model: e, form: s, ...r ? { validation: r } : {} };
2586
- return t.setup?.(i), i;
2587
- }
2588
- function C(t) {
2589
- return t == null ? !1 : typeof t == "object" && "value" in t && "setValue" in t && "getValue" in t && "validate" in t;
2616
+ const C = "[@reformer/core] createForm";
2617
+ function Fe(s, e) {
2618
+ const { schema: t, registry: i } = s;
2619
+ if (t == null) return {};
2620
+ if (typeof t == "function")
2621
+ return { tree: t(e) };
2622
+ if (i == null)
2623
+ throw new Error(
2624
+ `${C}: \`schema\` — готовое дерево, а не билдер \`(model) => узел\`. Передайте билдер; документу схемы (JSON) нужен \`registry\`. Форму из модели и готового дерева без сборки собирает \`createFormFromModel({ model, schema })\`.`
2625
+ );
2626
+ if (typeof i.resolveSchema != "function")
2627
+ throw new Error(
2628
+ `${C}: \`registry\` не умеет собирать дерево из документа схемы — у него нет метода \`resolveSchema\`. Возьмите реестр \`@reformer/renderer-json\` (\`createComponentRegistry\`).`
2629
+ );
2630
+ return i.resolveSchema(t, e);
2590
2631
  }
2591
- function Se(t) {
2592
- return C(t) && "validators" in t && "asyncValidators" in t && // FieldNode имеет markAsTouched метод
2593
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2594
- typeof t.markAsTouched == "function" && // У FieldNode нет fields или items
2595
- !("fields" in t) && !("items" in t);
2632
+ function Ne(s) {
2633
+ if (typeof s?.model?.signalAt != "function" && s?.initial === void 0)
2634
+ throw new Error(
2635
+ `${C}: нужна модель — \`model\` либо \`initial\`. Форму без модели — из плоской схемы полей (\`{ email: { value: '', component } }\`) или конфига группы — собирает \`createLegacyForm(...)\`.`
2636
+ );
2637
+ const t = s.model ?? te(s.initial);
2638
+ s.seed?.(t);
2639
+ const { tree: i, fieldWrapper: r, errorBoundary: n } = Fe(s, t), a = oe(), u = a.scopeOf(t), d = ee({
2640
+ model: t,
2641
+ ...i !== void 0 ? { schema: i } : {},
2642
+ ...s.behavior ? { behavior: s.behavior, schemaController: a } : {}
2643
+ });
2644
+ if (process.env.NODE_ENV !== "production") {
2645
+ const o = le(u.__overrideMaps, i);
2646
+ o.length > 0 && console.warn(
2647
+ `${C}: поведение обращается к узлам схемы, которых нет в корневом дереве: ${o.map((f) => `"${f}"`).join(", ")}. Правило ничего не сделает. Узлы строки массива и подформы адресуются из их поведения — через \`applyEach\` / \`apply\`.`
2648
+ );
2649
+ }
2650
+ const l = Se(t, s.validation), c = {
2651
+ model: t,
2652
+ form: d,
2653
+ ...l ? { validation: l } : {},
2654
+ render: {
2655
+ tree: i,
2656
+ controller: a,
2657
+ node: (o) => u.node(o),
2658
+ ...r !== void 0 ? { fieldWrapper: r } : {},
2659
+ ...n !== void 0 ? { errorBoundary: n } : {}
2660
+ }
2661
+ };
2662
+ return s.setup?.(c), c;
2596
2663
  }
2597
- function Ae(t) {
2598
- return C(t) && "getFieldByPath" in t && "fields" in t && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode/ModelArrayNode)
2599
- !("items" in t) && !("push" in t) && !("removeAt" in t);
2664
+ function Ye(s) {
2665
+ return Ne(s);
2600
2666
  }
2601
- function we(t) {
2602
- return C(t) && "items" in t && "length" in t && "push" in t && "removeAt" in t && "at" in t && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2603
- typeof t.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2604
- typeof t.removeAt == "function";
2667
+ function O(s) {
2668
+ return s == null ? !1 : typeof s == "object" && "value" in s && "setValue" in s && "getValue" in s && "validate" in s;
2605
2669
  }
2606
- function Ue(t) {
2607
- return Se(t) ? "FieldNode" : Ae(t) ? "GroupNode" : we(t) ? "ArrayNode" : C(t) ? "FormNode" : "Unknown";
2670
+ function Me(s) {
2671
+ return O(s) && "validators" in s && "asyncValidators" in s && // FieldNode имеет markAsTouched метод
2672
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2673
+ typeof s.markAsTouched == "function" && // У FieldNode нет fields или items
2674
+ !("fields" in s) && !("items" in s);
2608
2675
  }
2609
- var N = { exports: {} }, P = {};
2610
- var q;
2611
- function Ve() {
2612
- if (q) return P;
2613
- q = 1;
2614
- var t = Y;
2615
- function e(o, f) {
2616
- return o === f && (o !== 0 || 1 / o === 1 / f) || o !== o && f !== f;
2617
- }
2618
- var s = typeof Object.is == "function" ? Object.is : e, r = t.useState, i = t.useEffect, n = t.useLayoutEffect, a = t.useDebugValue;
2619
- function l(o, f) {
2620
- var c = f(), v = r({ inst: { value: c, getSnapshot: f } }), p = v[0].inst, b = v[1];
2621
- return n(
2622
- function() {
2623
- p.value = c, p.getSnapshot = f, d(p) && b({ inst: p });
2624
- },
2625
- [o, c, f]
2626
- ), i(
2627
- function() {
2628
- return d(p) && b({ inst: p }), o(function() {
2629
- d(p) && b({ inst: p });
2630
- });
2631
- },
2632
- [o]
2633
- ), a(c), c;
2634
- }
2635
- function d(o) {
2636
- var f = o.getSnapshot;
2637
- o = o.value;
2638
- try {
2639
- var c = f();
2640
- return !s(o, c);
2641
- } catch {
2642
- return !0;
2643
- }
2644
- }
2645
- function u(o, f) {
2646
- return f();
2647
- }
2648
- var h = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : l;
2649
- return P.useSyncExternalStore = t.useSyncExternalStore !== void 0 ? t.useSyncExternalStore : h, P;
2676
+ function Ce(s) {
2677
+ return O(s) && "getFieldByPath" in s && "fields" in s && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode/ModelArrayNode)
2678
+ !("items" in s) && !("push" in s) && !("removeAt" in s);
2650
2679
  }
2651
- var T = {};
2652
- var H;
2653
- function ke() {
2654
- return H || (H = 1, process.env.NODE_ENV !== "production" && (function() {
2655
- function t(c, v) {
2656
- return c === v && (c !== 0 || 1 / c === 1 / v) || c !== c && v !== v;
2657
- }
2658
- function e(c, v) {
2659
- h || i.startTransition === void 0 || (h = !0, console.error(
2660
- "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."
2661
- ));
2662
- var p = v();
2663
- if (!o) {
2664
- var b = v();
2665
- n(p, b) || (console.error(
2666
- "The result of getSnapshot should be cached to avoid an infinite loop"
2667
- ), o = !0);
2668
- }
2669
- b = a({
2670
- inst: { value: p, getSnapshot: v }
2671
- });
2672
- var y = b[0].inst, V = b[1];
2673
- return d(
2674
- function() {
2675
- y.value = p, y.getSnapshot = v, s(y) && V({ inst: y });
2676
- },
2677
- [c, p, v]
2678
- ), l(
2679
- function() {
2680
- return s(y) && V({ inst: y }), c(function() {
2681
- s(y) && V({ inst: y });
2682
- });
2683
- },
2684
- [c]
2685
- ), u(p), p;
2686
- }
2687
- function s(c) {
2688
- var v = c.getSnapshot;
2689
- c = c.value;
2690
- try {
2691
- var p = v();
2692
- return !n(c, p);
2693
- } catch {
2694
- return !0;
2695
- }
2696
- }
2697
- function r(c, v) {
2698
- return v();
2699
- }
2700
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
2701
- var i = Y, n = typeof Object.is == "function" ? Object.is : t, 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;
2702
- 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());
2703
- })()), T;
2680
+ function Pe(s) {
2681
+ return O(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
2682
+ typeof s.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2683
+ typeof s.removeAt == "function";
2704
2684
  }
2705
- var K;
2706
- function Fe() {
2707
- return K || (K = 1, process.env.NODE_ENV === "production" ? N.exports = Ve() : N.exports = ke()), N.exports;
2685
+ function Qe(s) {
2686
+ return Me(s) ? "FieldNode" : Ce(s) ? "GroupNode" : Pe(s) ? "ArrayNode" : O(s) ? "FormNode" : "Unknown";
2708
2687
  }
2709
- var x = Fe();
2710
- function Oe(t, e) {
2711
- if (t === e) return !0;
2712
- if (t.length !== e.length) return !1;
2713
- for (let s = 0; s < t.length; s++)
2714
- if (t[s] !== e[s]) return !1;
2688
+ function xe(s, e) {
2689
+ if (s === e) return !0;
2690
+ if (s.length !== e.length) return !1;
2691
+ for (let t = 0; t < s.length; t++)
2692
+ if (s[t] !== e[t]) return !1;
2715
2693
  return !0;
2716
2694
  }
2717
- function $(t, e, s, r) {
2718
- const i = A(null), n = A(t);
2719
- n.current = t;
2720
- const a = A(e);
2695
+ function B(s, e, t, i) {
2696
+ const r = E(null), n = E(s);
2697
+ n.current = s;
2698
+ const a = E(e);
2721
2699
  a.current = e;
2722
- const l = A(s);
2723
- if (l.current = s, i.current === null) {
2724
- const h = {};
2725
- for (const o in t)
2726
- h[o] = t[o].value;
2727
- i.current = { ...h, __snapshot: null };
2728
- }
2729
- const d = E(
2730
- (h) => {
2700
+ const u = E(t);
2701
+ if (u.current = t, r.current === null) {
2702
+ const c = {};
2703
+ for (const o in s)
2704
+ c[o] = s[o].value;
2705
+ r.current = { ...c, __snapshot: null };
2706
+ }
2707
+ const d = y(
2708
+ (c) => {
2731
2709
  let o = !0;
2732
- return _(() => {
2733
- const c = n.current;
2734
- for (const v in c)
2735
- c[v].value;
2710
+ return g(() => {
2711
+ const v = n.current;
2712
+ for (const p in v)
2713
+ v[p].value;
2736
2714
  if (o) {
2737
2715
  o = !1;
2738
2716
  return;
2739
2717
  }
2740
- h();
2718
+ c();
2741
2719
  });
2742
2720
  },
2743
2721
  // subscriptionKey намеренно не читается в теле — он здесь КЛЮЧ ИДЕНТИЧНОСТИ подписки (см. JSDoc
@@ -2745,45 +2723,45 @@ function $(t, e, s, r) {
2745
2723
  // навсегда: подмена контрола на другой узел перестанет пересоздавать effect. Тот же приём ниже
2746
2724
  // у getSnapshot.
2747
2725
  // eslint-disable-next-line react-hooks/exhaustive-deps
2748
- [r]
2749
- ), u = E(() => {
2750
- const h = i.current, o = n.current, f = {};
2751
- for (const v in o)
2752
- f[v] = o[v].value;
2753
- let c = !1;
2754
- for (const v of a.current) {
2755
- const { key: p, useShallowArrayEqual: b } = v, y = f[p], V = h[p];
2756
- if (b) {
2757
- if (!Oe(V, y)) {
2758
- c = !0;
2726
+ [i]
2727
+ ), l = y(() => {
2728
+ const c = r.current, o = n.current, f = {};
2729
+ for (const p in o)
2730
+ f[p] = o[p].value;
2731
+ let v = !1;
2732
+ for (const p of a.current) {
2733
+ const { key: F, useShallowArrayEqual: T } = p, A = f[F], V = c[F];
2734
+ if (T) {
2735
+ if (!xe(V, A)) {
2736
+ v = !0;
2759
2737
  break;
2760
2738
  }
2761
- } else if (V !== y) {
2762
- c = !0;
2739
+ } else if (V !== A) {
2740
+ v = !0;
2763
2741
  break;
2764
2742
  }
2765
2743
  }
2766
- if (!c && h.__snapshot)
2767
- return h.__snapshot;
2768
- for (const v in o)
2769
- h[v] = f[v];
2770
- return h.__snapshot = l.current(f), h.__snapshot;
2771
- }, [r]);
2772
- return x.useSyncExternalStore(d, u, u);
2744
+ if (!v && c.__snapshot)
2745
+ return c.__snapshot;
2746
+ for (const p in o)
2747
+ c[p] = f[p];
2748
+ return c.__snapshot = u.current(f), c.__snapshot;
2749
+ }, [i]);
2750
+ return P.useSyncExternalStore(d, l, l);
2773
2751
  }
2774
- function Ne(t) {
2752
+ function Oe(s) {
2775
2753
  const e = {
2776
- value: t.value,
2777
- disabled: t.disabled,
2778
- errors: t.errors,
2779
- pending: t.pending,
2780
- valid: t.valid,
2781
- invalid: t.invalid,
2782
- touched: t.touched,
2783
- dirty: t.dirty,
2784
- shouldShowError: t.shouldShowError,
2785
- componentProps: t.componentProps
2786
- }, s = [
2754
+ value: s.value,
2755
+ disabled: s.disabled,
2756
+ errors: s.errors,
2757
+ pending: s.pending,
2758
+ valid: s.valid,
2759
+ invalid: s.invalid,
2760
+ touched: s.touched,
2761
+ dirty: s.dirty,
2762
+ shouldShowError: s.shouldShowError,
2763
+ componentProps: s.componentProps
2764
+ }, t = [
2787
2765
  { key: "value" },
2788
2766
  { key: "disabled" },
2789
2767
  { key: "errors", useShallowArrayEqual: !0 },
@@ -2794,35 +2772,35 @@ function Ne(t) {
2794
2772
  { key: "dirty" },
2795
2773
  { key: "shouldShowError" },
2796
2774
  { key: "componentProps" }
2797
- ], r = E(
2798
- (i) => ({
2799
- value: i.value,
2800
- pending: i.pending,
2801
- disabled: i.disabled,
2802
- errors: i.errors,
2803
- valid: i.valid,
2804
- invalid: i.invalid,
2805
- touched: i.touched,
2806
- dirty: i.dirty,
2807
- shouldShowError: i.shouldShowError,
2808
- componentProps: i.componentProps
2775
+ ], i = y(
2776
+ (r) => ({
2777
+ value: r.value,
2778
+ pending: r.pending,
2779
+ disabled: r.disabled,
2780
+ errors: r.errors,
2781
+ valid: r.valid,
2782
+ invalid: r.invalid,
2783
+ touched: r.touched,
2784
+ dirty: r.dirty,
2785
+ shouldShowError: r.shouldShowError,
2786
+ componentProps: r.componentProps
2809
2787
  }),
2810
2788
  []
2811
2789
  );
2812
- return $(e, s, r, t);
2790
+ return B(e, t, i, s);
2813
2791
  }
2814
- function Me(t) {
2792
+ function Te(s) {
2815
2793
  const e = {
2816
- value: t.value,
2817
- length: t.length,
2818
- errors: t.errors,
2819
- pending: t.pending,
2820
- valid: t.valid,
2821
- invalid: t.invalid,
2822
- touched: t.touched,
2823
- dirty: t.dirty,
2824
- disabled: t.disabled
2825
- }, s = [
2794
+ value: s.value,
2795
+ length: s.length,
2796
+ errors: s.errors,
2797
+ pending: s.pending,
2798
+ valid: s.valid,
2799
+ invalid: s.invalid,
2800
+ touched: s.touched,
2801
+ dirty: s.dirty,
2802
+ disabled: s.disabled
2803
+ }, t = [
2826
2804
  { key: "value" },
2827
2805
  { key: "length" },
2828
2806
  { key: "errors", useShallowArrayEqual: !0 },
@@ -2832,24 +2810,24 @@ function Me(t) {
2832
2810
  { key: "touched" },
2833
2811
  { key: "dirty" },
2834
2812
  { key: "disabled" }
2835
- ], r = E(
2836
- (i) => ({
2837
- value: i.value,
2838
- length: i.length,
2839
- pending: i.pending,
2840
- errors: i.errors,
2841
- valid: i.valid,
2842
- invalid: i.invalid,
2843
- touched: i.touched,
2844
- dirty: i.dirty,
2845
- disabled: i.disabled
2813
+ ], i = y(
2814
+ (r) => ({
2815
+ value: r.value,
2816
+ length: r.length,
2817
+ pending: r.pending,
2818
+ errors: r.errors,
2819
+ valid: r.valid,
2820
+ invalid: r.invalid,
2821
+ touched: r.touched,
2822
+ dirty: r.dirty,
2823
+ disabled: r.disabled
2846
2824
  }),
2847
2825
  []
2848
2826
  );
2849
- return $(e, s, r, t);
2827
+ return B(e, t, i, s);
2850
2828
  }
2851
- function Ce() {
2852
- const t = E(
2829
+ function De() {
2830
+ const s = y(
2853
2831
  () => ({
2854
2832
  value: [],
2855
2833
  length: 0,
@@ -2863,157 +2841,173 @@ function Ce() {
2863
2841
  }),
2864
2842
  []
2865
2843
  );
2866
- return $({}, [], t);
2844
+ return B({}, [], s);
2867
2845
  }
2868
- function We(t) {
2869
- const e = t && "length" in t && "map" in t;
2870
- return t ? e ? Me(t) : Ne(t) : Ce();
2846
+ function Xe(s) {
2847
+ const e = s && "length" in s && "map" in s;
2848
+ return s ? e ? Te(s) : Oe(s) : De();
2871
2849
  }
2872
- function qe(t) {
2873
- const e = A({ value: t.value.value }), s = E(
2874
- (i) => {
2850
+ function Ze(s) {
2851
+ const e = E({ value: s.value.value }), t = y(
2852
+ (r) => {
2875
2853
  let n = !0;
2876
- return _(() => {
2877
- if (t.value.value, n) {
2854
+ return g(() => {
2855
+ if (s.value.value, n) {
2878
2856
  n = !1;
2879
2857
  return;
2880
2858
  }
2881
- i();
2859
+ r();
2882
2860
  });
2883
2861
  },
2884
- [t]
2885
- ), r = E(() => {
2886
- const i = t.value.value;
2887
- return e.current.value === i ? e.current.value : (e.current.value = i, i);
2888
- }, [t]);
2889
- return x.useSyncExternalStore(s, r, r);
2862
+ [s]
2863
+ ), i = y(() => {
2864
+ const r = s.value.value;
2865
+ return e.current.value === r ? e.current.value : (e.current.value = r, r);
2866
+ }, [s]);
2867
+ return P.useSyncExternalStore(t, i, i);
2890
2868
  }
2891
- function He(t) {
2892
- const e = A({ length: t.length.value }), s = E(
2893
- (i) => {
2869
+ function et(s) {
2870
+ const e = E({ length: s.length.value }), t = y(
2871
+ (r) => {
2894
2872
  let n = !0;
2895
- return _(() => {
2896
- if (t.length.value, n) {
2873
+ return g(() => {
2874
+ if (s.length.value, n) {
2897
2875
  n = !1;
2898
2876
  return;
2899
2877
  }
2900
- i();
2878
+ r();
2901
2879
  });
2902
2880
  },
2903
- [t]
2904
- ), r = E(() => {
2905
- const i = t.length.value;
2906
- return e.current.length === i ? e.current.length : (e.current.length = i, i);
2907
- }, [t]);
2908
- return x.useSyncExternalStore(s, r, r);
2881
+ [s]
2882
+ ), i = y(() => {
2883
+ const r = s.length.value;
2884
+ return e.current.length === r ? e.current.length : (e.current.length = r, r);
2885
+ }, [s]);
2886
+ return P.useSyncExternalStore(t, i, i);
2909
2887
  }
2910
- function Ke(t) {
2911
- const { model: e, schema: s, strategy: r, debounce: i, liveAfterSubmit: n } = t, a = oe(
2912
- () => D(e, s, { strategy: r, debounce: i, liveAfterSubmit: n }),
2913
- [e, s, r, i, n]
2888
+ function tt(s) {
2889
+ const { model: e, schema: t, strategy: i, debounce: r, liveAfterSubmit: n } = s, a = he(
2890
+ () => I(e, t, { strategy: i, debounce: r, liveAfterSubmit: n }),
2891
+ [e, t, i, r, n]
2914
2892
  );
2915
- J(() => a.start(), [a]);
2916
- const l = x.useSyncExternalStore(
2917
- E((u) => a.validating.subscribe(u), [a]),
2893
+ Q(() => a.start(), [a]);
2894
+ const u = P.useSyncExternalStore(
2895
+ y((l) => a.validating.subscribe(l), [a]),
2918
2896
  () => a.validating.peek(),
2919
2897
  () => !1
2920
2898
  // SSR: прогон не идёт
2921
- ), d = E(() => a.validate(), [a]);
2922
- return { submit: d, validate: d, isValidating: l };
2899
+ ), d = y(() => a.validate(), [a]);
2900
+ return { submit: d, validate: d, isValidating: u };
2901
+ }
2902
+ function st(s) {
2903
+ const [e] = fe(s), t = e.validation?.controller;
2904
+ return Q(() => t?.start(), [t]), e;
2923
2905
  }
2924
- function ze(t) {
2925
- const [e] = le(t), s = e.validation?.controller;
2926
- return J(() => s?.start(), [s]), e;
2906
+ const Ie = ve(null);
2907
+ function rt() {
2908
+ return me(Ie);
2927
2909
  }
2928
- const xe = ["labelTooltip"];
2929
- function Ye(t) {
2930
- if (!(t == null || typeof t != "function" && typeof t != "object"))
2931
- return t.reformerAdapter;
2910
+ const $e = ["labelTooltip"];
2911
+ function it(s) {
2912
+ if (!(s == null || typeof s != "function" && typeof s != "object"))
2913
+ return s.reformerAdapter;
2932
2914
  }
2933
- const z = (t) => t;
2934
- function Je(t, e, s = {}) {
2935
- const r = { ...s };
2936
- for (const n of xe) delete r[n];
2937
- for (const n of t?.strip ?? []) delete r[n];
2938
- if (!t)
2939
- return { ...r, value: e.value, onChange: e.onChange, onBlur: e.onBlur };
2940
- const i = t.fromEmit ?? z;
2915
+ const J = (s) => s;
2916
+ function nt(s, e, t = {}) {
2917
+ const i = { ...t };
2918
+ for (const n of $e) delete i[n];
2919
+ for (const n of s?.strip ?? []) delete i[n];
2920
+ if (!s)
2921
+ return { ...i, value: e.value, onChange: e.onChange, onBlur: e.onBlur };
2922
+ const r = s.fromEmit ?? J;
2941
2923
  return {
2942
- ...r,
2943
- [t.valueProp ?? "value"]: (t.toValue ?? z)(e.value),
2944
- [t.changeProp ?? "onChange"]: (n) => e.onChange(i(n, r)),
2945
- ...t.bindBlur ? t.bindBlur(e.onBlur) : { onBlur: e.onBlur }
2924
+ ...i,
2925
+ [s.valueProp ?? "value"]: (s.toValue ?? J)(e.value),
2926
+ [s.changeProp ?? "onChange"]: (n) => e.onChange(r(n, i)),
2927
+ ...s.bindBlur ? s.bindBlur(e.onBlur) : { onBlur: e.onBlur }
2946
2928
  };
2947
2929
  }
2948
- function Pe(t) {
2930
+ function Re(s) {
2949
2931
  return {
2950
- focus: () => t.current?.focus(),
2951
- blur: () => t.current?.blur(),
2952
- scrollIntoView: (e) => t.current?.scrollIntoView(e),
2953
- getElement: () => t.current
2932
+ focus: () => s.current?.focus(),
2933
+ blur: () => s.current?.blur(),
2934
+ scrollIntoView: (e) => s.current?.scrollIntoView(e),
2935
+ getElement: () => s.current
2954
2936
  };
2955
2937
  }
2956
- function Te(t) {
2957
- return typeof t == "object" && t !== null && t.nodeType === 1;
2938
+ function Be(s) {
2939
+ return typeof s == "object" && s !== null && s.nodeType === 1;
2958
2940
  }
2959
- function Qe(t) {
2960
- const e = A(null);
2961
- return ue(t, () => De(e)), e;
2941
+ function at(s) {
2942
+ const e = E(null);
2943
+ return pe(s, () => Ge(e)), e;
2962
2944
  }
2963
- function De(t) {
2964
- const e = t.current;
2965
- return e == null || Te(e) ? Pe(t) : e;
2945
+ function Ge(s) {
2946
+ const e = s.current;
2947
+ return e == null || Be(e) ? Re(s) : e;
2966
2948
  }
2967
- const Xe = Object.freeze({ runtime: "reformer-core", v: 1 });
2949
+ const ot = Object.freeze({ runtime: "reformer-core", v: 1 });
2968
2950
  export {
2969
- W as ArrayNode,
2970
- Xe as CORE_RUNTIME_TOKEN,
2971
- S as ErrorStrategy,
2972
- xe as FIELD_WRAPPER_ONLY_PROPS,
2973
- he as FieldNode,
2974
- k as FormErrorHandler,
2975
- M as FormNode,
2976
- ve as FormSubmitter,
2977
- w as GroupNode,
2978
- ye as ModelArrayNode,
2979
- pe as NodeFactory,
2980
- R as SubscriptionManager,
2981
- Je as bindFieldProps,
2982
- _e as buildValidation,
2983
- ot as computeFrom,
2984
- lt as copyFrom,
2985
- je as createCoreForm,
2986
- be as createForm,
2951
+ q as ArrayNode,
2952
+ ot as CORE_RUNTIME_TOKEN,
2953
+ b as ErrorStrategy,
2954
+ $e as FIELD_WRAPPER_ONLY_PROPS,
2955
+ be as FieldNode,
2956
+ Ie as FormBundleContext,
2957
+ w as FormErrorHandler,
2958
+ x as FormNode,
2959
+ _e as FormSubmitter,
2960
+ _ as GroupNode,
2961
+ Ve as ModelArrayNode,
2962
+ Ae as NodeFactory,
2963
+ $ as SubscriptionManager,
2964
+ ft as arrayOf,
2965
+ nt as bindFieldProps,
2966
+ Se as buildValidation,
2967
+ yt as computeFrom,
2968
+ gt as copyFrom,
2969
+ Ye as createCoreForm,
2970
+ Ne as createForm,
2987
2971
  ee as createFormFromModel,
2972
+ Je as createLegacyForm,
2988
2973
  te as createModel,
2989
- Et as disableWhen,
2990
- tt as eachLeafSignal,
2991
- _t as enableWhen,
2992
- Ye as getFieldAdapter,
2993
- gt as getNodeForSignal,
2994
- Ue as getNodeType,
2995
- we as isArrayNode,
2996
- B as isDerived,
2997
- Se as isFieldNode,
2998
- C as isFormNode,
2999
- Ae as isGroupNode,
3000
- rt as isModelContainerSignal,
3001
- Pe as makeElementFieldHandle,
3002
- it as markDerived,
3003
- re as registerSignalNode,
3004
- ut as resetWhen,
3005
- dt as revalidateWhen,
3006
- ct as runOutsideEffect,
3007
- ht as safeCallback,
3008
- ft as safeDebouncedCallback,
3009
- vt as syncFields,
3010
- mt as transformValue,
3011
- nt as unmarkDerived,
3012
- He as useArrayLength,
3013
- Qe as useFieldHandleRef,
3014
- ze as useFormBundle,
3015
- We as useFormControl,
3016
- qe as useFormControlValue,
3017
- Ke as useFormValidation,
3018
- pt as watchField
2974
+ oe as createSchemaController,
2975
+ Ct as createSchemaOverrideMaps,
2976
+ Pt as createSchemaScope,
2977
+ xt as disableWhen,
2978
+ dt as eachLeafSignal,
2979
+ ct as eachValueSignal,
2980
+ Ot as enableWhen,
2981
+ it as getFieldAdapter,
2982
+ Nt as getNodeForSignal,
2983
+ Qe as getNodeType,
2984
+ Pe as isArrayNode,
2985
+ G as isDerived,
2986
+ Me as isFieldNode,
2987
+ O as isFormNode,
2988
+ Ce as isGroupNode,
2989
+ j as isModelContainerSignal,
2990
+ D as isValueSignal,
2991
+ Re as makeElementFieldHandle,
2992
+ vt as markDerived,
2993
+ Y as modelOf,
2994
+ N as registerSignalNode,
2995
+ bt as resetWhen,
2996
+ Et as revalidateWhen,
2997
+ _t as runOutsideEffect,
2998
+ wt as safeCallback,
2999
+ At as safeDebouncedCallback,
3000
+ X as schemaSubtree,
3001
+ Vt as syncFields,
3002
+ kt as transformValue,
3003
+ le as unknownSchemaSelectors,
3004
+ mt as unmarkDerived,
3005
+ et as useArrayLength,
3006
+ at as useFieldHandleRef,
3007
+ st as useFormBundle,
3008
+ rt as useFormBundleContext,
3009
+ Xe as useFormControl,
3010
+ Ze as useFormControlValue,
3011
+ tt as useFormValidation,
3012
+ St as watchField
3019
3013
  };