@reformer/core 9.0.0-beta.2 → 9.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dist/behaviors-node-BMOI2JJF.js +26 -0
  2. package/dist/behaviors-value-lCpqicfa.js +148 -0
  3. package/dist/behaviors.d.ts +2 -133
  4. package/dist/behaviors.js +29 -28
  5. package/dist/{core/utils → form}/aggregate-signals.d.ts +2 -2
  6. package/dist/form/behaviors-node.d.ts +55 -0
  7. package/dist/form/behaviors.d.ts +133 -0
  8. package/dist/{core/utils → form}/create-form.d.ts +5 -4
  9. package/dist/{core/utils → form}/error-handler.d.ts +1 -1
  10. package/dist/{core → form}/factories/node-factory.d.ts +1 -1
  11. package/dist/{core/utils → form}/form-proxy-builder.d.ts +2 -2
  12. package/dist/{hooks → form/hooks}/types.d.ts +1 -1
  13. package/dist/{hooks → form/hooks}/useArrayLength.d.ts +1 -1
  14. package/dist/{hooks → form/hooks}/useFormControl.d.ts +3 -3
  15. package/dist/{hooks → form/hooks}/useFormControlValue.d.ts +2 -2
  16. package/dist/form/index.d.ts +36 -0
  17. package/dist/{core → form}/nodes/array-node.d.ts +1 -1
  18. package/dist/{core → form}/nodes/field-node.d.ts +1 -1
  19. package/dist/{core → form}/nodes/form-node.d.ts +1 -1
  20. package/dist/{core → form}/nodes/group-node.d.ts +2 -2
  21. package/dist/{core → form}/nodes/model-array-node.d.ts +2 -2
  22. package/dist/{core/utils → form}/signal-node-registry.d.ts +1 -1
  23. package/dist/{core/utils → form}/status-machine.d.ts +1 -1
  24. package/dist/{core/utils → form}/type-guards.d.ts +5 -5
  25. package/dist/{core/types/index.d.ts → form/types/contracts.d.ts} +11 -90
  26. package/dist/form/types/index.d.ts +91 -0
  27. package/dist/{core → form}/types/schema-node.d.ts +1 -1
  28. package/dist/{core → form}/types/validation-schema.d.ts +1 -1
  29. package/dist/{core/model/validate-model.d.ts → form/validate-model-core.d.ts} +25 -25
  30. package/dist/form/validate-model.d.ts +27 -0
  31. package/dist/form/validators.d.ts +6 -0
  32. package/dist/form-model-C8Fi83k4.js +439 -0
  33. package/dist/index.d.ts +11 -16
  34. package/dist/index.js +663 -1016
  35. package/dist/{core/model/behaviors.d.ts → state/behaviors-value.d.ts} +0 -53
  36. package/dist/state/form-model.d.ts +26 -0
  37. package/dist/state/index.d.ts +31 -0
  38. package/dist/{core/utils → state}/safe-effect.d.ts +4 -4
  39. package/dist/{core/model → state}/types.d.ts +14 -11
  40. package/dist/state.d.ts +2 -0
  41. package/dist/state.js +19 -0
  42. package/dist/validators/email.d.ts +1 -1
  43. package/dist/validators/future-date.d.ts +1 -1
  44. package/dist/validators/integer.d.ts +1 -1
  45. package/dist/validators/is-date.d.ts +1 -1
  46. package/dist/validators/is-number.d.ts +1 -1
  47. package/dist/validators/max-age.d.ts +1 -1
  48. package/dist/validators/max-date.d.ts +1 -1
  49. package/dist/validators/max-length.d.ts +1 -1
  50. package/dist/validators/max.d.ts +1 -1
  51. package/dist/validators/min-age.d.ts +1 -1
  52. package/dist/validators/min-date.d.ts +1 -1
  53. package/dist/validators/min-length.d.ts +1 -1
  54. package/dist/validators/min.d.ts +1 -1
  55. package/dist/validators/multiple-of.d.ts +1 -1
  56. package/dist/validators/non-negative.d.ts +1 -1
  57. package/dist/validators/non-zero.d.ts +1 -1
  58. package/dist/validators/past-date.d.ts +1 -1
  59. package/dist/validators/pattern.d.ts +1 -1
  60. package/dist/validators/phone.d.ts +1 -1
  61. package/dist/validators/required.d.ts +1 -1
  62. package/dist/validators/url.d.ts +1 -1
  63. package/dist/validators.d.ts +6 -6
  64. package/llms.txt +161 -147
  65. package/package.json +5 -1
  66. package/dist/behaviors-Br4Im38V.js +0 -263
  67. package/dist/core/model/form-model.d.ts +0 -18
  68. package/dist/core/model/index.d.ts +0 -12
  69. package/dist/core/utils/index.d.ts +0 -18
  70. /package/dist/{core → form}/factories/index.d.ts +0 -0
  71. /package/dist/{core/utils → form}/form-submitter.d.ts +0 -0
  72. /package/dist/{hooks → form/hooks}/useSignalSubscription.d.ts +0 -0
  73. /package/dist/{core → form}/types/deep-schema.d.ts +0 -0
  74. /package/dist/{core → form}/types/form-proxy.d.ts +0 -0
  75. /package/dist/{core/utils → form}/unique-id.d.ts +0 -0
  76. /package/dist/{core → form}/validation/index.d.ts +0 -0
  77. /package/dist/{core → form}/validation/validators/date-utils.d.ts +0 -0
  78. /package/dist/{core → form}/validation/validators/email.d.ts +0 -0
  79. /package/dist/{core → form}/validation/validators/future-date.d.ts +0 -0
  80. /package/dist/{core → form}/validation/validators/index.d.ts +0 -0
  81. /package/dist/{core → form}/validation/validators/integer.d.ts +0 -0
  82. /package/dist/{core → form}/validation/validators/is-date.d.ts +0 -0
  83. /package/dist/{core → form}/validation/validators/is-number.d.ts +0 -0
  84. /package/dist/{core → form}/validation/validators/max-age.d.ts +0 -0
  85. /package/dist/{core → form}/validation/validators/max-date.d.ts +0 -0
  86. /package/dist/{core → form}/validation/validators/max-length.d.ts +0 -0
  87. /package/dist/{core → form}/validation/validators/max.d.ts +0 -0
  88. /package/dist/{core → form}/validation/validators/min-age.d.ts +0 -0
  89. /package/dist/{core → form}/validation/validators/min-date.d.ts +0 -0
  90. /package/dist/{core → form}/validation/validators/min-length.d.ts +0 -0
  91. /package/dist/{core → form}/validation/validators/min.d.ts +0 -0
  92. /package/dist/{core → form}/validation/validators/multiple-of.d.ts +0 -0
  93. /package/dist/{core → form}/validation/validators/non-negative.d.ts +0 -0
  94. /package/dist/{core → form}/validation/validators/non-zero.d.ts +0 -0
  95. /package/dist/{core → form}/validation/validators/past-date.d.ts +0 -0
  96. /package/dist/{core → form}/validation/validators/pattern.d.ts +0 -0
  97. /package/dist/{core → form}/validation/validators/phone.d.ts +0 -0
  98. /package/dist/{core → form}/validation/validators/required.d.ts +0 -0
  99. /package/dist/{core → form}/validation/validators/url.d.ts +0 -0
  100. /package/dist/{core/utils → state}/derived-registry.d.ts +0 -0
  101. /package/dist/{core/utils → state}/subscription-manager.d.ts +0 -0
package/dist/index.js CHANGED
@@ -1,9 +1,13 @@
1
- import { signal as y, computed as f, effect as _, batch as be, Signal as oe } from "@preact/signals-core";
2
- import { F as N, E as O, i as G, g as X, d as _e } from "./behaviors-Br4Im38V.js";
3
- import { j as ot, c as lt, k as ut, e as ct, m as ht, a as dt, b as ft, r as pt, f as vt, h as mt, s as yt, t as gt, u as bt, w as _t } from "./behaviors-Br4Im38V.js";
4
- import le, { useRef as M, useCallback as E } from "react";
5
- import { default as At } from "./validators.js";
6
- class L {
1
+ import { S as I } from "./form-model-C8Fi83k4.js";
2
+ import { c as Ge } from "./form-model-C8Fi83k4.js";
3
+ import { i as G } from "./behaviors-value-lCpqicfa.js";
4
+ import { c as We, a as qe, m as He, r as Ke, b as Je, d as Ye, e as ze, f as Qe, s as Xe, t as Ze, u as et, w as tt } from "./behaviors-value-lCpqicfa.js";
5
+ import { default as rt } from "./validators.js";
6
+ import { signal as g, computed as f, effect as b, batch as ie, Signal as z } from "@preact/signals-core";
7
+ import { g as U, r as ne } from "./behaviors-node-BMOI2JJF.js";
8
+ import { d as nt, e as at } from "./behaviors-node-BMOI2JJF.js";
9
+ import Q, { useRef as N, useCallback as E } from "react";
10
+ class C {
7
11
  // ============================================================================
8
12
  // Protected состояние (для Template Method паттерна)
9
13
  // ============================================================================
@@ -11,17 +15,17 @@ class L {
11
15
  * Пользователь взаимодействовал с узлом (touched)
12
16
  * Protected: наследники могут читать/изменять через методы
13
17
  */
14
- _touched = y(!1);
18
+ _touched = g(!1);
15
19
  /**
16
20
  * Значение узла было изменено (dirty)
17
21
  * Protected: наследники могут читать/изменять через методы
18
22
  */
19
- _dirty = y(!1);
23
+ _dirty = g(!1);
20
24
  /**
21
25
  * Текущий статус узла
22
26
  * Protected: наследники могут читать/изменять через методы
23
27
  */
24
- _status = y("valid");
28
+ _status = g("valid");
25
29
  // ============================================================================
26
30
  // Публичные computed signals (readonly для внешнего мира)
27
31
  // ============================================================================
@@ -97,17 +101,17 @@ class L {
97
101
  */
98
102
  getErrors(e) {
99
103
  const t = this.errors.value;
100
- return e ? t.filter((i) => {
101
- 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()))
104
+ return e ? t.filter((s) => {
105
+ if (e.code !== void 0 && !(Array.isArray(e.code) ? e.code : [e.code]).includes(s.code) || e.message !== void 0 && !s.message.toLowerCase().includes(e.message.toLowerCase()))
102
106
  return !1;
103
107
  if (e.params !== void 0) {
104
- if (!i.params)
108
+ if (!s.params)
105
109
  return !1;
106
- for (const [r, n] of Object.entries(e.params))
107
- if (i.params[r] !== n)
110
+ for (const [i, n] of Object.entries(e.params))
111
+ if (s.params[i] !== n)
108
112
  return !1;
109
113
  }
110
- return !(e.predicate !== void 0 && !e.predicate(i));
114
+ return !(e.predicate !== void 0 && !e.predicate(s));
111
115
  }) : t;
112
116
  }
113
117
  // ============================================================================
@@ -280,193 +284,119 @@ class L {
280
284
  onEnable() {
281
285
  }
282
286
  }
283
- class K {
284
- /**
285
- * Хранилище подписок
286
- * Ключ: уникальный идентификатор подписки
287
- * Значение: функция отписки (dispose)
288
- */
289
- subscriptions = /* @__PURE__ */ new Map();
290
- /**
291
- * Добавляет подписку
292
- *
293
- * Если подписка с таким ключом уже существует, отписывается от неё
294
- * и заменяет новой. Это предотвращает утечки памяти при повторной
295
- * регистрации подписки с тем же ключом.
296
- *
297
- * @param key Уникальный ключ подписки
298
- * @param dispose Функция отписки (обычно возвращаемая из effect())
299
- * @returns Функция для отписки от этой конкретной подписки
300
- *
301
- * @example
302
- * ```typescript
303
- * const manager = new SubscriptionManager();
304
- *
305
- * // Добавление подписки
306
- * const unsubscribe = manager.add('mySubscription', () => {
307
- * console.log('Disposing subscription');
308
- * });
309
- *
310
- * // Отписка через возвращаемую функцию
311
- * unsubscribe();
312
- *
313
- * // Или через manager.remove()
314
- * manager.add('anotherSub', disposeFn);
315
- * manager.remove('anotherSub');
316
- * ```
317
- */
318
- add(e, t) {
319
- 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);
287
+ const w = {
288
+ /** FieldNode.watch() */
289
+ Watch: "watch",
290
+ /** FieldNode.computeFrom() */
291
+ ComputeFrom: "computeFrom",
292
+ /** GroupNode.linkFields() */
293
+ LinkFields: "linkFields",
294
+ /** GroupNode.watchField() */
295
+ WatchField: "watchField",
296
+ /** ArrayNode.watchItems() */
297
+ WatchItems: "watchItems",
298
+ /** ArrayNode.watchLength() */
299
+ WatchLength: "watchLength"
300
+ };
301
+ let ae = 0;
302
+ function V(r) {
303
+ return `${r}-${++ae}`;
304
+ }
305
+ var A = /* @__PURE__ */ ((r) => (r.THROW = "throw", r.LOG = "log", r.CONVERT = "convert", r))(A || {});
306
+ class O {
307
+ static handle(e, t, s = "throw") {
308
+ const i = this.extractMessage(e);
309
+ switch (process.env.NODE_ENV !== "production" && console.error(`[${t}]`, e), s) {
310
+ case "throw":
311
+ throw e;
312
+ case "log":
313
+ return;
314
+ case "convert":
315
+ return {
316
+ code: "validator_error",
317
+ message: i,
318
+ params: { field: t }
319
+ };
320
+ }
320
321
  }
321
322
  /**
322
- * Удаляет подписку по ключу
323
+ * Извлечь сообщение из ошибки
323
324
  *
324
- * Вызывает функцию отписки и удаляет подписку из хранилища.
325
- * Если подписка с таким ключом не найдена, ничего не делает.
325
+ * Обрабатывает различные типы ошибок:
326
+ * - Error объекты → error.message
327
+ * - Строки → возвращает как есть
328
+ * - Объекты с message → извлекает message
329
+ * - Другое → String(error)
326
330
  *
327
- * @param key Ключ подписки
328
- * @returns true, если подписка была удалена, false если не найдена
331
+ * @param error Ошибка для извлечения сообщения
332
+ * @returns Сообщение ошибки
333
+ * @private
329
334
  *
330
335
  * @example
331
336
  * ```typescript
332
- * const manager = new SubscriptionManager();
333
- * manager.add('mySub', disposeFn);
334
- *
335
- * // Удаление подписки
336
- * const removed = manager.remove('mySub'); // true
337
- *
338
- * // Попытка удалить несуществующую подписку
339
- * const removed2 = manager.remove('nonExistent'); // false
340
- * ```
341
- */
342
- remove(e) {
343
- const t = this.subscriptions.get(e);
344
- return t ? (t(), this.subscriptions.delete(e), !0) : !1;
345
- }
346
- /**
347
- * Очищает все подписки
337
+ * FormErrorHandler.extractMessage(new Error('Test'));
338
+ * // 'Test'
348
339
  *
349
- * Вызывает функции отписки для всех активных подписок
350
- * и очищает хранилище. Обычно используется при dispose узла формы.
340
+ * FormErrorHandler.extractMessage('String error');
341
+ * // 'String error'
351
342
  *
352
- * @example
353
- * ```typescript
354
- * class FieldNode {
355
- * private subscriptions = new SubscriptionManager();
343
+ * FormErrorHandler.extractMessage({ message: 'Object error' });
344
+ * // 'Object error'
356
345
  *
357
- * dispose() {
358
- * // Отписываемся от всех effect
359
- * this.subscriptions.clear();
360
- * }
361
- * }
346
+ * FormErrorHandler.extractMessage(null);
347
+ * // 'null'
362
348
  * ```
363
349
  */
364
- clear() {
365
- this.subscriptions.forEach((e) => {
366
- e();
367
- }), this.subscriptions.clear();
350
+ static extractMessage(e) {
351
+ return e instanceof Error ? e.message : typeof e == "string" ? e : typeof e == "object" && e !== null && "message" in e ? String(e.message) : String(e);
368
352
  }
369
353
  /**
370
- * Возвращает количество активных подписок
371
- *
372
- * Полезно для отладки утечек памяти. Если количество подписок
373
- * растет без ограничений, это может указывать на то, что
374
- * компоненты не отписываются должным образом.
375
- *
376
- * @returns Количество активных подписок
377
- *
378
- * @example
379
- * ```typescript
380
- * const manager = new SubscriptionManager();
381
- * console.log(manager.size()); // 0
382
- *
383
- * manager.add('sub1', disposeFn1);
384
- * manager.add('sub2', disposeFn2);
385
- * console.log(manager.size()); // 2
354
+ * Создать ValidationError с заданными параметрами
386
355
  *
387
- * manager.clear();
388
- * console.log(manager.size()); // 0
389
- * ```
390
- */
391
- size() {
392
- return this.subscriptions.size;
393
- }
394
- /**
395
- * Проверяет, есть ли подписка с данным ключом
356
+ * Утилитная функция для создания ValidationError объектов
396
357
  *
397
- * @param key Ключ подписки
398
- * @returns true, если подписка существует
358
+ * @param code Код ошибки
359
+ * @param message Сообщение ошибки
360
+ * @param field Поле (опционально)
361
+ * @returns ValidationError объект
399
362
  *
400
363
  * @example
401
364
  * ```typescript
402
- * const manager = new SubscriptionManager();
403
- * manager.add('mySub', disposeFn);
404
- *
405
- * console.log(manager.has('mySub')); // true
406
- * console.log(manager.has('nonExistent')); // false
365
+ * const error = FormErrorHandler.createValidationError(
366
+ * 'required',
367
+ * 'This field is required',
368
+ * 'email'
369
+ * );
370
+ * // { code: 'required', message: 'This field is required', field: 'email' }
407
371
  * ```
408
372
  */
409
- has(e) {
410
- return this.subscriptions.has(e);
373
+ static createValidationError(e, t, s) {
374
+ return {
375
+ code: e,
376
+ message: t,
377
+ params: s ? { field: s } : void 0
378
+ };
411
379
  }
412
380
  /**
413
- * Возвращает список всех ключей активных подписок
381
+ * Проверить, является ли объект ValidationError
414
382
  *
415
- * Полезно для отладки: можно увидеть, какие подписки активны.
383
+ * Type guard для ValidationError
416
384
  *
417
- * @returns Массив ключей всех активных подписок
385
+ * @param value Значение для проверки
386
+ * @returns true если value является ValidationError
418
387
  *
419
388
  * @example
420
389
  * ```typescript
421
- * const manager = new SubscriptionManager();
422
- * manager.add('watch-value', disposeFn1);
423
- * manager.add('watch-errors', disposeFn2);
424
- *
425
- * console.log(manager.getKeys()); // ['watch-value', 'watch-errors']
426
- * ```
427
- */
428
- getKeys() {
429
- return Array.from(this.subscriptions.keys());
430
- }
431
- /**
432
- * Отписывается от всех подписок (алиас для clear())
433
- *
434
- * Используется при dispose() узла формы для совместимости с ожидаемым API.
435
- *
436
- * @example
437
- * ```typescript
438
- * class FieldNode {
439
- * private subscriptions = new SubscriptionManager();
440
- *
441
- * dispose() {
442
- * this.subscriptions.dispose();
443
- * }
390
+ * if (FormErrorHandler.isValidationError(result)) {
391
+ * console.log(result.code); // OK, типобезопасно
444
392
  * }
445
393
  * ```
446
394
  */
447
- dispose() {
448
- this.clear();
395
+ static isValidationError(e) {
396
+ return typeof e == "object" && e !== null && "code" in e && "message" in e && typeof e.code == "string" && typeof e.message == "string";
449
397
  }
450
398
  }
451
- const w = {
452
- /** FieldNode.watch() */
453
- Watch: "watch",
454
- /** FieldNode.computeFrom() */
455
- ComputeFrom: "computeFrom",
456
- /** GroupNode.linkFields() */
457
- LinkFields: "linkFields",
458
- /** GroupNode.watchField() */
459
- WatchField: "watchField",
460
- /** ArrayNode.watchItems() */
461
- WatchItems: "watchItems",
462
- /** ArrayNode.watchLength() */
463
- WatchLength: "watchLength"
464
- };
465
- let Ee = 0;
466
- function k(s) {
467
- return `${s}-${++Ee}`;
468
- }
469
- class Ae {
399
+ class oe {
470
400
  /** Внутренний сигнал статуса */
471
401
  _status;
472
402
  /** Публичный read-only сигнал статуса */
@@ -483,7 +413,7 @@ class Ae {
483
413
  * @param initial - Начальный статус (по умолчанию 'valid')
484
414
  */
485
415
  constructor(e = "valid") {
486
- this._status = y(e), this.status = f(() => this._status.value), this.valid = f(() => this._status.value === "valid"), this.invalid = f(() => this._status.value === "invalid"), this.pending = f(() => this._status.value === "pending"), this.disabled = f(() => this._status.value === "disabled");
416
+ this._status = g(e), this.status = f(() => this._status.value), this.valid = f(() => this._status.value === "valid"), this.invalid = f(() => this._status.value === "invalid"), this.pending = f(() => this._status.value === "pending"), this.disabled = f(() => this._status.value === "disabled");
487
417
  }
488
418
  /**
489
419
  * Начать валидацию
@@ -611,7 +541,7 @@ class Ae {
611
541
  return this._status.value !== "disabled";
612
542
  }
613
543
  }
614
- class Se extends L {
544
+ class le extends C {
615
545
  // ============================================================================
616
546
  // Приватные сигналы
617
547
  // ============================================================================
@@ -663,13 +593,13 @@ class Se extends L {
663
593
  * Менеджер подписок для централизованного cleanup
664
594
  * Использует SubscriptionManager вместо массива для управления подписками
665
595
  */
666
- disposers = new K();
596
+ disposers = new I();
667
597
  component;
668
598
  // ============================================================================
669
599
  // Конструктор
670
600
  // ============================================================================
671
601
  constructor(e) {
672
- 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 ?? y(e.value), this.initialValue = this._value.peek(), this._errors = y([]), this._componentProps = y(e.componentProps || {}), this.statusMachine = new Ae(e.disabled ? "disabled" : "valid"), this.value = f(() => this._value.value), this.valid = f(() => this.statusMachine.valid.value), this.invalid = f(() => this.statusMachine.invalid.value), this.pending = f(() => this.statusMachine.pending.value), this.status = f(() => this.statusMachine.status.value), this.disabled = f(() => this.statusMachine.disabled.value), this.errors = f(() => this._errors.value), this.componentProps = f(() => this._componentProps.value), this.shouldShowError = f(
602
+ 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 oe(e.disabled ? "disabled" : "valid"), this.value = f(() => this._value.value), this.valid = f(() => this.statusMachine.valid.value), this.invalid = f(() => this.statusMachine.invalid.value), this.pending = f(() => this.statusMachine.pending.value), this.status = f(() => this.statusMachine.status.value), this.disabled = f(() => this.statusMachine.disabled.value), this.errors = f(() => this._errors.value), this.componentProps = f(() => this._componentProps.value), this.shouldShowError = f(
673
603
  () => this.statusMachine.invalid.value && (this._touched.value || this._dirty.value)
674
604
  );
675
605
  }
@@ -682,12 +612,12 @@ class Se extends L {
682
612
  setValue(e, t) {
683
613
  if (this._value.value = e, this._dirty.value = !0, t?.emitEvent === !1)
684
614
  return;
685
- const i = this.validators.length > 0 || this.asyncValidators.length > 0, r = this._errors.value.length > 0;
615
+ const s = this.validators.length > 0 || this.asyncValidators.length > 0, i = this._errors.value.length > 0;
686
616
  if (this.updateOn === "change") {
687
617
  this.validate();
688
618
  return;
689
619
  }
690
- r && i && this.validate();
620
+ i && s && this.validate();
691
621
  }
692
622
  patchValue(e) {
693
623
  this.setValue(e);
@@ -780,20 +710,20 @@ class Se extends L {
780
710
  const t = e?.debounce ?? this.debounceMs;
781
711
  if (this.cancelPendingValidation(), t <= 0 || this.asyncValidators.length === 0)
782
712
  return this.validateImmediate();
783
- const i = new AbortController();
784
- return new Promise((r) => {
785
- this.pendingValidation = { resolve: r, abortController: i }, this.validateDebounceTimer = setTimeout(async () => {
786
- if (this.validateDebounceTimer = void 0, i.signal.aborted) {
787
- r(!1);
713
+ const s = new AbortController();
714
+ return new Promise((i) => {
715
+ this.pendingValidation = { resolve: i, abortController: s }, this.validateDebounceTimer = setTimeout(async () => {
716
+ if (this.validateDebounceTimer = void 0, s.signal.aborted) {
717
+ i(!1);
788
718
  return;
789
719
  }
790
720
  this.pendingValidation = void 0;
791
- const n = await this.validateImmediate(i);
792
- r(n);
793
- }, t), i.signal.addEventListener(
721
+ const n = await this.validateImmediate(s);
722
+ i(n);
723
+ }, t), s.signal.addEventListener(
794
724
  "abort",
795
725
  () => {
796
- this.validateDebounceTimer && (clearTimeout(this.validateDebounceTimer), this.validateDebounceTimer = void 0), r(!1);
726
+ this.validateDebounceTimer && (clearTimeout(this.validateDebounceTimer), this.validateDebounceTimer = void 0), i(!1);
797
727
  },
798
728
  { once: !0 }
799
729
  );
@@ -812,51 +742,51 @@ class Se extends L {
812
742
  async validateImmediate(e) {
813
743
  const t = e ?? new AbortController();
814
744
  e || this.currentAbortController?.abort(), this.currentAbortController = t;
815
- const { signal: i } = t, r = [];
745
+ const { signal: s } = t, i = [];
816
746
  for (const a of this.validators) {
817
747
  const l = a(this._value.value);
818
- l && r.push(l);
748
+ l && i.push(l);
819
749
  }
820
- if (i.aborted)
750
+ if (s.aborted)
821
751
  return !1;
822
- if (r.length > 0) {
823
- this._errors.value = r;
824
- const a = r.some((l) => l.severity !== "warning");
752
+ if (i.length > 0) {
753
+ this._errors.value = i;
754
+ const a = i.some((l) => l.severity !== "warning");
825
755
  if (this.statusMachine.setErrors(a), a)
826
756
  return !1;
827
757
  }
828
758
  if (this.asyncValidators.length > 0) {
829
- if (i.aborted)
759
+ if (s.aborted)
830
760
  return !1;
831
761
  this.statusMachine.startValidation();
832
762
  try {
833
763
  const a = await Promise.all(
834
- this.asyncValidators.map(async (c) => {
835
- if (i.aborted)
764
+ this.asyncValidators.map(async (d) => {
765
+ if (s.aborted)
836
766
  throw new DOMException("Validation aborted", "AbortError");
837
767
  try {
838
- const u = await c(this._value.value, { signal: i });
839
- if (i.aborted)
768
+ const u = await d(this._value.value, { signal: s });
769
+ if (s.aborted)
840
770
  throw new DOMException("Validation aborted", "AbortError");
841
771
  return u;
842
772
  } catch (u) {
843
773
  if (u instanceof DOMException && u.name === "AbortError")
844
774
  throw u;
845
- return N.handle(
775
+ return O.handle(
846
776
  u,
847
777
  "FieldNode AsyncValidator",
848
- O.CONVERT
778
+ A.CONVERT
849
779
  );
850
780
  }
851
781
  })
852
782
  );
853
- if (i.aborted)
783
+ if (s.aborted)
854
784
  return !1;
855
- const l = a.filter((c) => c !== null);
785
+ const l = a.filter((d) => d !== null);
856
786
  if (l.length > 0) {
857
787
  this._errors.value = l;
858
- const c = l.some((u) => u.severity !== "warning");
859
- if (this.statusMachine.completeValidation(c), c)
788
+ const d = l.some((u) => u.severity !== "warning");
789
+ if (this.statusMachine.completeValidation(d), d)
860
790
  return !1;
861
791
  }
862
792
  } catch (a) {
@@ -865,11 +795,11 @@ class Se extends L {
865
795
  throw a;
866
796
  }
867
797
  }
868
- 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"));
798
+ return s.aborted ? !1 : ((this.validators.length > 0 || this.asyncValidators.length > 0) && (this._errors.value = [], this.statusMachine.completeValidation(!1)), !this._errors.value.some((a) => a.severity !== "warning"));
869
799
  }
870
800
  setErrors(e) {
871
801
  this._errors.value = e;
872
- const t = e.some((i) => i.severity !== "warning");
802
+ const t = e.some((s) => s.severity !== "warning");
873
803
  this.statusMachine.setErrors(t);
874
804
  }
875
805
  clearErrors() {
@@ -986,12 +916,12 @@ class Se extends L {
986
916
  * ```
987
917
  */
988
918
  watch(e) {
989
- const t = new AbortController(), i = _(() => {
919
+ const t = new AbortController(), s = b(() => {
990
920
  const n = this.value.value;
991
921
  e(n, t.signal);
992
- }), r = k(w.Watch);
993
- return this.disposers.add(r, () => {
994
- t.abort(), i();
922
+ }), i = V(w.Watch);
923
+ return this.disposers.add(i, () => {
924
+ t.abort(), s();
995
925
  });
996
926
  }
997
927
  /**
@@ -1017,11 +947,11 @@ class Se extends L {
1017
947
  * ```
1018
948
  */
1019
949
  computeFrom(e, t) {
1020
- const i = _(() => {
950
+ const s = b(() => {
1021
951
  const n = e.map((l) => l.value), a = t(...n);
1022
952
  this.setValue(a, { emitEvent: !1 });
1023
- }), r = k(w.ComputeFrom);
1024
- return this.disposers.add(r, i);
953
+ }), i = V(w.ComputeFrom);
954
+ return this.disposers.add(i, s);
1025
955
  }
1026
956
  /**
1027
957
  * Очистить все ресурсы и таймеры
@@ -1051,59 +981,59 @@ class Se extends L {
1051
981
  }
1052
982
  }
1053
983
  }
1054
- function H(s) {
1055
- const { getChildren: e, ownErrors: t, disabled: i } = s, r = f(() => t.value.length > 0 ? !1 : e().every((o) => o.disabled.value || o.valid.value)), n = f(() => !r.value), a = f(() => e().some((o) => o.pending.value)), l = f(() => e().some((o) => o.touched.value)), c = f(() => e().some((o) => o.dirty.value)), u = f(() => {
984
+ function L(r) {
985
+ const { getChildren: e, ownErrors: t, disabled: s } = r, i = f(() => t.value.length > 0 ? !1 : e().every((o) => o.disabled.value || o.valid.value)), n = f(() => !i.value), a = f(() => e().some((o) => o.pending.value)), l = f(() => e().some((o) => o.touched.value)), d = f(() => e().some((o) => o.dirty.value)), u = f(() => {
1056
986
  const o = [...t.value];
1057
- for (const v of e())
1058
- o.push(...v.errors.value);
987
+ for (const p of e())
988
+ o.push(...p.errors.value);
1059
989
  return o;
1060
- }), d = f(() => i?.value ? "disabled" : a.value ? "pending" : n.value ? "invalid" : "valid");
990
+ }), h = f(() => s?.value ? "disabled" : a.value ? "pending" : n.value ? "invalid" : "valid");
1061
991
  return {
1062
- valid: r,
992
+ valid: i,
1063
993
  invalid: n,
1064
994
  pending: a,
1065
995
  touched: l,
1066
- dirty: c,
996
+ dirty: d,
1067
997
  errors: u,
1068
- status: d
998
+ status: h
1069
999
  };
1070
1000
  }
1071
- function Z(s) {
1072
- return typeof s == "object" && s !== null && "getProxy" in s && typeof s.getProxy == "function";
1001
+ function W(r) {
1002
+ return typeof r == "object" && r !== null && "getProxy" in r && typeof r.getProxy == "function";
1073
1003
  }
1074
- const ee = "$";
1075
- function we(s, e) {
1004
+ const q = "$";
1005
+ function ue(r, e) {
1076
1006
  let t;
1077
- const i = () => {
1007
+ const s = () => {
1078
1008
  if (!t) {
1079
- const r = {};
1009
+ const i = {};
1080
1010
  e.forEach((n, a) => {
1081
- r[a] = n && Z(n) ? n.getProxy() : n;
1082
- }), t = r;
1011
+ i[a] = n && W(n) ? n.getProxy() : n;
1012
+ }), t = i;
1083
1013
  }
1084
1014
  return t;
1085
1015
  };
1086
- return new Proxy(s, {
1087
- get: (r, n) => {
1088
- if (n === ee)
1089
- return i();
1090
- if (n in r)
1091
- return r[n];
1016
+ return new Proxy(r, {
1017
+ get: (i, n) => {
1018
+ if (n === q)
1019
+ return s();
1020
+ if (n in i)
1021
+ return i[n];
1092
1022
  if (typeof n == "string" && e.has(n)) {
1093
1023
  const a = e.get(n);
1094
- return a && Z(a) ? a.getProxy() : a;
1024
+ return a && W(a) ? a.getProxy() : a;
1095
1025
  }
1096
1026
  },
1097
- set: (r, n, a) => typeof n == "string" && e.has(n) ? !1 : (r[n] = a, !0),
1098
- has: (r, n) => n === ee || typeof n == "string" && e.has(n) ? !0 : n in r,
1099
- ownKeys: (r) => {
1100
- const n = Reflect.ownKeys(r), a = Array.from(e.keys());
1027
+ set: (i, n, a) => typeof n == "string" && e.has(n) ? !1 : (i[n] = a, !0),
1028
+ has: (i, n) => n === q || typeof n == "string" && e.has(n) ? !0 : n in i,
1029
+ ownKeys: (i) => {
1030
+ const n = Reflect.ownKeys(i), a = Array.from(e.keys());
1101
1031
  return [.../* @__PURE__ */ new Set([...n, ...a])];
1102
1032
  },
1103
- getOwnPropertyDescriptor: (r, n) => typeof n == "string" && e.has(n) ? { enumerable: !0, configurable: !0 } : Reflect.getOwnPropertyDescriptor(r, n)
1033
+ getOwnPropertyDescriptor: (i, n) => typeof n == "string" && e.has(n) ? { enumerable: !0, configurable: !0 } : Reflect.getOwnPropertyDescriptor(i, n)
1104
1034
  });
1105
1035
  }
1106
- class ke {
1036
+ class de {
1107
1037
  /**
1108
1038
  * @param form - Форма для отправки
1109
1039
  */
@@ -1111,7 +1041,7 @@ class ke {
1111
1041
  this.form = e;
1112
1042
  }
1113
1043
  /** Внутренний сигнал состояния отправки */
1114
- _submitting = y(!1);
1044
+ _submitting = g(!1);
1115
1045
  /** Публичный read-only сигнал состояния отправки */
1116
1046
  submitting = f(() => this._submitting.value);
1117
1047
  /**
@@ -1148,8 +1078,8 @@ class ke {
1148
1078
  * ```
1149
1079
  */
1150
1080
  async submit(e, t) {
1151
- const { skipValidation: i = !1, skipTouch: r = !1 } = t || {};
1152
- if (r || this.form.markAsTouched(), !i && !await this.form.validate())
1081
+ const { skipValidation: s = !1, skipTouch: i = !1 } = t || {};
1082
+ if (i || this.form.markAsTouched(), !s && !await this.form.validate())
1153
1083
  return null;
1154
1084
  this._submitting.value = !0;
1155
1085
  try {
@@ -1183,8 +1113,8 @@ class ke {
1183
1113
  * ```
1184
1114
  */
1185
1115
  async submitWithResult(e, t) {
1186
- const { skipValidation: i = !1, skipTouch: r = !1 } = t || {};
1187
- if (r || this.form.markAsTouched(), !i && !await this.form.validate())
1116
+ const { skipValidation: s = !1, skipTouch: i = !1 } = t || {};
1117
+ if (i || this.form.markAsTouched(), !s && !await this.form.validate())
1188
1118
  return { success: !1, data: null };
1189
1119
  this._submitting.value = !0;
1190
1120
  try {
@@ -1206,16 +1136,16 @@ class ke {
1206
1136
  return this._submitting.value;
1207
1137
  }
1208
1138
  }
1209
- function Ve(s) {
1139
+ function ce(r) {
1210
1140
  const e = [];
1211
- for (const t of s.split(".")) {
1212
- const i = /^([^[\]]+)(?:\[(\d+)\])?$/.exec(t);
1213
- if (!i) return [];
1214
- e.push(i[2] !== void 0 ? { key: i[1], index: Number(i[2]) } : { key: i[1] });
1141
+ for (const t of r.split(".")) {
1142
+ const s = /^([^[\]]+)(?:\[(\d+)\])?$/.exec(t);
1143
+ if (!s) return [];
1144
+ e.push(s[2] !== void 0 ? { key: s[1], index: Number(s[2]) } : { key: s[1] });
1215
1145
  }
1216
1146
  return e;
1217
1147
  }
1218
- let P = class ue extends L {
1148
+ class S extends C {
1219
1149
  // ============================================================================
1220
1150
  // Приватные поля
1221
1151
  // ============================================================================
@@ -1228,7 +1158,7 @@ let P = class ue extends L {
1228
1158
  /**
1229
1159
  * Менеджер подписок для централизованного cleanup
1230
1160
  */
1231
- disposers = new K();
1161
+ disposers = new I();
1232
1162
  /**
1233
1163
  * Ссылка на Proxy-инстанс
1234
1164
  */
@@ -1240,7 +1170,7 @@ let P = class ue extends L {
1240
1170
  /**
1241
1171
  * Фабрика для создания узлов формы
1242
1172
  */
1243
- nodeFactory = new Ne();
1173
+ nodeFactory = new he();
1244
1174
  // ============================================================================
1245
1175
  // Приватные сигналы состояния (inline из StateManager)
1246
1176
  // ============================================================================
@@ -1248,9 +1178,9 @@ let P = class ue extends L {
1248
1178
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1249
1179
  formSubmitter;
1250
1180
  /** Флаг disabled состояния */
1251
- _disabled = y(!1);
1181
+ _disabled = g(!1);
1252
1182
  /** Form-level validation errors */
1253
- _formErrors = y([]);
1183
+ _formErrors = g([]);
1254
1184
  /**
1255
1185
  * M1: валидация уровня модели/схемы (`validateFormModel(model, schema)`). Привязывается
1256
1186
  * `createForm({ model, schema })`, т.к. под M1 валидаторы срезаны с FieldNode и живут на слое
@@ -1277,19 +1207,19 @@ let P = class ue extends L {
1277
1207
  status;
1278
1208
  submitting;
1279
1209
  constructor(e) {
1280
- super(), this.formSubmitter = new ke(this);
1281
- const t = e.form, i = t != null && typeof t == "object" && ("valueSignal" in t || "value" in t), n = "form" in e && !i ? e.form : e;
1282
- for (const [l, c] of Object.entries(n)) {
1283
- const u = this.createNode(c);
1210
+ super(), this.formSubmitter = new de(this);
1211
+ const t = e.form, s = t != null && typeof t == "object" && ("valueSignal" in t || "value" in t), n = "form" in e && !s ? e.form : e;
1212
+ for (const [l, d] of Object.entries(n)) {
1213
+ const u = this.createNode(d);
1284
1214
  this._fields.set(l, u);
1285
1215
  }
1286
1216
  this.value = f(() => {
1287
1217
  const l = {};
1288
- return this._fields.forEach((c, u) => {
1289
- l[u] = c.value.value;
1218
+ return this._fields.forEach((d, u) => {
1219
+ l[u] = d.value.value;
1290
1220
  }), l;
1291
1221
  });
1292
- const a = H({
1222
+ const a = L({
1293
1223
  getChildren: () => Array.from(this._fields.values()),
1294
1224
  ownErrors: this._formErrors,
1295
1225
  disabled: this._disabled
@@ -1304,35 +1234,35 @@ let P = class ue extends L {
1304
1234
  * @see buildFormProxy
1305
1235
  */
1306
1236
  buildProxy() {
1307
- return we(this, this._fields);
1237
+ return ue(this, this._fields);
1308
1238
  }
1309
1239
  // ============================================================================
1310
1240
  // Реализация абстрактных методов FormNode
1311
1241
  // ============================================================================
1312
1242
  getValue() {
1313
1243
  const e = {};
1314
- return this._fields.forEach((t, i) => {
1315
- e[i] = t.getValue();
1244
+ return this._fields.forEach((t, s) => {
1245
+ e[s] = t.getValue();
1316
1246
  }), e;
1317
1247
  }
1318
1248
  setValue(e, t) {
1319
- for (const [i, r] of Object.entries(e)) {
1320
- const n = this._fields.get(i);
1249
+ for (const [s, i] of Object.entries(e)) {
1250
+ const n = this._fields.get(s);
1321
1251
  if (n) {
1322
1252
  const a = this._fieldSignals.get(n) ?? n.value;
1323
1253
  if (G(a)) continue;
1324
- n.setValue(r, t);
1254
+ n.setValue(i, t);
1325
1255
  }
1326
1256
  }
1327
1257
  }
1328
1258
  patchValue(e) {
1329
- be(() => {
1330
- for (const [t, i] of Object.entries(e)) {
1331
- const r = this._fields.get(t);
1332
- if (r && i !== void 0) {
1333
- const n = this._fieldSignals.get(r) ?? r.value;
1259
+ ie(() => {
1260
+ for (const [t, s] of Object.entries(e)) {
1261
+ const i = this._fields.get(t);
1262
+ if (i && s !== void 0) {
1263
+ const n = this._fieldSignals.get(i) ?? i.value;
1334
1264
  if (G(n)) continue;
1335
- r.setValue(i, { emitEvent: !1 });
1265
+ i.setValue(s, { emitEvent: !1 });
1336
1266
  }
1337
1267
  }
1338
1268
  });
@@ -1355,9 +1285,9 @@ let P = class ue extends L {
1355
1285
  * ```
1356
1286
  */
1357
1287
  reset(e) {
1358
- this._formErrors.value = [], this._fields.forEach((t, i) => {
1359
- const r = e?.[i];
1360
- t.reset(r);
1288
+ this._formErrors.value = [], this._fields.forEach((t, s) => {
1289
+ const i = e?.[s];
1290
+ t.reset(i);
1361
1291
  });
1362
1292
  }
1363
1293
  /**
@@ -1369,9 +1299,9 @@ let P = class ue extends L {
1369
1299
  });
1370
1300
  }
1371
1301
  async validate() {
1372
- this.clearErrors(), await Promise.all(Array.from(this._fields.values()).map((i) => i.validate()));
1302
+ this.clearErrors(), await Promise.all(Array.from(this._fields.values()).map((s) => s.validate()));
1373
1303
  const e = this._modelValidate ? await this._modelValidate() : !0, t = Array.from(this._fields.values()).every(
1374
- (i) => i.valid.value || i.disabled.value
1304
+ (s) => s.valid.value || s.disabled.value
1375
1305
  );
1376
1306
  return e && t;
1377
1307
  }
@@ -1507,21 +1437,21 @@ let P = class ue extends L {
1507
1437
  getFieldByPath(e) {
1508
1438
  if (e.startsWith(".") || e.endsWith("."))
1509
1439
  return;
1510
- const t = Ve(e);
1440
+ const t = ce(e);
1511
1441
  if (t.length === 0)
1512
1442
  return;
1513
- let i = this;
1514
- for (const r of t) {
1515
- if (!(i instanceof ue) || (i = i.getField(r.key), !i)) return;
1516
- if (r.index !== void 0)
1517
- if ("at" in i && "length" in i && typeof i.at == "function") {
1518
- const n = i.at(r.index);
1443
+ let s = this;
1444
+ for (const i of t) {
1445
+ if (!(s instanceof S) || (s = s.getField(i.key), !s)) return;
1446
+ if (i.index !== void 0)
1447
+ if ("at" in s && "length" in s && typeof s.at == "function") {
1448
+ const n = s.at(i.index);
1519
1449
  if (!n) return;
1520
- i = n;
1450
+ s = n;
1521
1451
  } else
1522
1452
  return;
1523
1453
  }
1524
- return i;
1454
+ return s;
1525
1455
  }
1526
1456
  // ============================================================================
1527
1457
  // Private методы для создания узлов
@@ -1550,16 +1480,16 @@ let P = class ue extends L {
1550
1480
  /**
1551
1481
  * Связывает два поля: при изменении source автоматически обновляется target
1552
1482
  */
1553
- linkFields(e, t, i) {
1554
- const r = this._fields.get(e), n = this._fields.get(t);
1555
- if (!r || !n) {
1556
- const c = r ? t : e;
1557
- throw new Error(`GroupNode.linkFields: field "${String(c)}" not found`);
1483
+ linkFields(e, t, s) {
1484
+ const i = this._fields.get(e), n = this._fields.get(t);
1485
+ if (!i || !n) {
1486
+ const d = i ? t : e;
1487
+ throw new Error(`GroupNode.linkFields: field "${String(d)}" not found`);
1558
1488
  }
1559
- const a = _(() => {
1560
- const c = r.value.value, u = i ? i(c) : c;
1489
+ const a = b(() => {
1490
+ const d = i.value.value, u = s ? s(d) : d;
1561
1491
  n.setValue(u, { emitEvent: !1 });
1562
- }), l = k(w.LinkFields);
1492
+ }), l = V(w.LinkFields);
1563
1493
  return this.disposers.add(l, a);
1564
1494
  }
1565
1495
  /**
@@ -1591,26 +1521,26 @@ let P = class ue extends L {
1591
1521
  */
1592
1522
  /** Подписка на top-level поле — value типизирован как `T[K]`. */
1593
1523
  watchField(e, t) {
1594
- const i = this.getFieldByPath(e);
1595
- if (!i)
1524
+ const s = this.getFieldByPath(e);
1525
+ if (!s)
1596
1526
  throw new Error(`GroupNode.watchField: field "${e}" not found`);
1597
- const r = _(() => {
1598
- t(i.value.value);
1599
- }), n = k(w.WatchField);
1600
- return this.disposers.add(n, r);
1527
+ const i = b(() => {
1528
+ t(s.value.value);
1529
+ }), n = V(w.WatchField);
1530
+ return this.disposers.add(n, i);
1601
1531
  }
1602
1532
  /**
1603
1533
  * Подписка на вложенное поле по строковому пути ("address.city").
1604
1534
  * Путь нельзя выразить в типах узла → value честно `unknown`, потребитель сужает.
1605
1535
  */
1606
1536
  watchFieldByPath(e, t) {
1607
- const i = this.getFieldByPath(e);
1608
- if (!i)
1537
+ const s = this.getFieldByPath(e);
1538
+ if (!s)
1609
1539
  throw new Error(`GroupNode.watchFieldByPath: field "${e}" not found`);
1610
- const r = _(() => {
1611
- t(i.value.value);
1612
- }), n = k(w.WatchField);
1613
- return this.disposers.add(n, r);
1540
+ const i = b(() => {
1541
+ t(s.value.value);
1542
+ }), n = V(w.WatchField);
1543
+ return this.disposers.add(n, i);
1614
1544
  }
1615
1545
  /**
1616
1546
  * Hook: вызывается после disable()
@@ -1657,7 +1587,8 @@ let P = class ue extends L {
1657
1587
  "dispose" in e && typeof e.dispose == "function" && e.dispose();
1658
1588
  });
1659
1589
  }
1660
- }, te = class extends L {
1590
+ }
1591
+ class H extends C {
1661
1592
  // ============================================================================
1662
1593
  // Приватные поля
1663
1594
  // ============================================================================
@@ -1668,9 +1599,9 @@ let P = class ue extends L {
1668
1599
  * Менеджер подписок для централизованного cleanup
1669
1600
  * Использует SubscriptionManager вместо массива для управления подписками
1670
1601
  */
1671
- disposers = new K();
1602
+ disposers = new I();
1672
1603
  /** Array-level validation errors (e.g., "минимум 1 элемент") */
1673
- _arrayErrors = y([]);
1604
+ _arrayErrors = g([]);
1674
1605
  // ============================================================================
1675
1606
  // Приватные поля для сохранения схем
1676
1607
  // ============================================================================
@@ -1692,15 +1623,15 @@ let P = class ue extends L {
1692
1623
  // Конструктор
1693
1624
  // ============================================================================
1694
1625
  constructor(e, t = []) {
1695
- super(), this.itemSchema = e, this.initialItems = t, this.items = y([]);
1696
- for (const r of t)
1697
- this.push(r);
1698
- this.length = f(() => this.items.value.length), this.value = f(() => this.items.value.map((r) => r.value.value));
1699
- const i = H({
1626
+ super(), this.itemSchema = e, this.initialItems = t, this.items = g([]);
1627
+ for (const i of t)
1628
+ this.push(i);
1629
+ this.length = f(() => this.items.value.length), this.value = f(() => this.items.value.map((i) => i.value.value));
1630
+ const s = L({
1700
1631
  getChildren: () => this.items.value,
1701
1632
  ownErrors: this._arrayErrors
1702
1633
  });
1703
- 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;
1634
+ this.valid = s.valid, this.invalid = s.invalid, this.pending = s.pending, this.touched = s.touched, this.dirty = s.dirty, this.errors = s.errors, this.status = s.status;
1704
1635
  }
1705
1636
  // ============================================================================
1706
1637
  // CRUD операции
@@ -1722,17 +1653,17 @@ let P = class ue extends L {
1722
1653
  */
1723
1654
  removeAt(e) {
1724
1655
  if (e < 0 || e >= this.items.value.length) {
1725
- N.handle(
1656
+ O.handle(
1726
1657
  new Error(
1727
1658
  `ArrayNode.removeAt: index ${e} out of bounds (length: ${this.items.value.length})`
1728
1659
  ),
1729
1660
  "ArrayNode.removeAt",
1730
- O.LOG
1661
+ A.LOG
1731
1662
  );
1732
1663
  return;
1733
1664
  }
1734
1665
  const t = this.items.value[e];
1735
- this.items.value = this.items.value.filter((i, r) => r !== e), t && "dispose" in t && typeof t.dispose == "function" && t.dispose();
1666
+ this.items.value = this.items.value.filter((s, i) => i !== e), t && "dispose" in t && typeof t.dispose == "function" && t.dispose();
1736
1667
  }
1737
1668
  /**
1738
1669
  * Вставить элемент в массив
@@ -1741,17 +1672,17 @@ let P = class ue extends L {
1741
1672
  */
1742
1673
  insert(e, t) {
1743
1674
  if (e < 0 || e > this.items.value.length) {
1744
- N.handle(
1675
+ O.handle(
1745
1676
  new Error(
1746
1677
  `ArrayNode.insert: index ${e} out of bounds (length: ${this.items.value.length})`
1747
1678
  ),
1748
1679
  "ArrayNode.insert",
1749
- O.LOG
1680
+ A.LOG
1750
1681
  );
1751
1682
  return;
1752
1683
  }
1753
- const i = this.createItem(t), r = [...this.items.value];
1754
- r.splice(e, 0, i), this.items.value = r;
1684
+ const s = this.createItem(t), i = [...this.items.value];
1685
+ i.splice(e, 0, s), this.items.value = i;
1755
1686
  }
1756
1687
  /**
1757
1688
  * Переместить элемент массива с позиции `from` на позицию `to`
@@ -1770,18 +1701,18 @@ let P = class ue extends L {
1770
1701
  * ```
1771
1702
  */
1772
1703
  move(e, t) {
1773
- const i = this.items.value.length;
1774
- if (e < 0 || e >= i || t < 0 || t >= i) {
1775
- N.handle(
1776
- new Error(`ArrayNode.move: index out of bounds (from=${e}, to=${t}, length=${i})`),
1704
+ const s = this.items.value.length;
1705
+ if (e < 0 || e >= s || t < 0 || t >= s) {
1706
+ O.handle(
1707
+ new Error(`ArrayNode.move: index out of bounds (from=${e}, to=${t}, length=${s})`),
1777
1708
  "ArrayNode.move",
1778
- O.LOG
1709
+ A.LOG
1779
1710
  );
1780
1711
  return;
1781
1712
  }
1782
1713
  if (e === t) return;
1783
- const r = [...this.items.value], [n] = r.splice(e, 1);
1784
- r.splice(t, 0, n), this.items.value = r;
1714
+ const i = [...this.items.value], [n] = i.splice(e, 1);
1715
+ i.splice(t, 0, n), this.items.value = i;
1785
1716
  }
1786
1717
  /**
1787
1718
  * Поменять местами два элемента массива
@@ -1798,18 +1729,18 @@ let P = class ue extends L {
1798
1729
  * ```
1799
1730
  */
1800
1731
  swap(e, t) {
1801
- const i = this.items.value.length;
1802
- if (e < 0 || e >= i || t < 0 || t >= i) {
1803
- N.handle(
1804
- new Error(`ArrayNode.swap: index out of bounds (a=${e}, b=${t}, length=${i})`),
1732
+ const s = this.items.value.length;
1733
+ if (e < 0 || e >= s || t < 0 || t >= s) {
1734
+ O.handle(
1735
+ new Error(`ArrayNode.swap: index out of bounds (a=${e}, b=${t}, length=${s})`),
1805
1736
  "ArrayNode.swap",
1806
- O.LOG
1737
+ A.LOG
1807
1738
  );
1808
1739
  return;
1809
1740
  }
1810
1741
  if (e === t) return;
1811
- const r = [...this.items.value];
1812
- [r[e], r[t]] = [r[t], r[e]], this.items.value = r;
1742
+ const i = [...this.items.value];
1743
+ [i[e], i[t]] = [i[t], i[e]], this.items.value = i;
1813
1744
  }
1814
1745
  /**
1815
1746
  * Удалить все элементы массива
@@ -1840,13 +1771,13 @@ let P = class ue extends L {
1840
1771
  return this.items.value.map((e) => e.getValue());
1841
1772
  }
1842
1773
  setValue(e, t) {
1843
- this.clear(), e.forEach((i) => this.push(i)), t?.emitEvent !== !1 && this.validate().catch((i) => {
1844
- N.handle(i, "ArrayNode.setValue", O.LOG);
1774
+ this.clear(), e.forEach((s) => this.push(s)), t?.emitEvent !== !1 && this.validate().catch((s) => {
1775
+ O.handle(s, "ArrayNode.setValue", A.LOG);
1845
1776
  });
1846
1777
  }
1847
1778
  patchValue(e) {
1848
- e.forEach((t, i) => {
1849
- this.items.value[i] && t !== void 0 && this.items.value[i].patchValue(t);
1779
+ e.forEach((t, s) => {
1780
+ this.items.value[s] && t !== void 0 && this.items.value[s].patchValue(t);
1850
1781
  });
1851
1782
  }
1852
1783
  /**
@@ -1974,9 +1905,9 @@ let P = class ue extends L {
1974
1905
  * @param callback - Функция, вызываемая для каждого элемента с типизированным GroupNode proxy
1975
1906
  */
1976
1907
  forEach(e) {
1977
- this.items.value.forEach((t, i) => {
1978
- const r = t.getProxy();
1979
- e(r, i);
1908
+ this.items.value.forEach((t, s) => {
1909
+ const i = t.getProxy();
1910
+ e(i, s);
1980
1911
  });
1981
1912
  }
1982
1913
  /**
@@ -1985,9 +1916,9 @@ let P = class ue extends L {
1985
1916
  * @returns Новый массив результатов
1986
1917
  */
1987
1918
  map(e) {
1988
- return this.items.value.map((t, i) => {
1989
- const r = t.getProxy();
1990
- return e(r, i);
1919
+ return this.items.value.map((t, s) => {
1920
+ const i = t.getProxy();
1921
+ return e(i, s);
1991
1922
  });
1992
1923
  }
1993
1924
  // ============================================================================
@@ -1999,7 +1930,7 @@ let P = class ue extends L {
1999
1930
  */
2000
1931
  createItem(e) {
2001
1932
  if (this.isGroupSchema(this.itemSchema)) {
2002
- const t = new P(this.itemSchema);
1933
+ const t = new S(this.itemSchema);
2003
1934
  return e && t.patchValue(e), this.validationSchemaFn && "applyValidationSchema" in t && t.applyValidationSchema(this.validationSchemaFn), this.behaviorSchemaFn && "applyBehaviorSchema" in t && t.applyBehaviorSchema(this.behaviorSchemaFn), t;
2004
1935
  }
2005
1936
  throw new Error(
@@ -2086,14 +2017,14 @@ let P = class ue extends L {
2086
2017
  * ```
2087
2018
  */
2088
2019
  watchItems(e, t) {
2089
- const i = _(() => {
2020
+ const s = b(() => {
2090
2021
  const n = this.items.value.map((a) => {
2091
- if (a instanceof P)
2022
+ if (a instanceof S)
2092
2023
  return a.getFieldByPath(e)?.value.value;
2093
2024
  });
2094
2025
  t(n);
2095
- }), r = k(w.WatchItems);
2096
- return this.disposers.add(r, i);
2026
+ }), i = V(w.WatchItems);
2027
+ return this.disposers.add(i, s);
2097
2028
  }
2098
2029
  /**
2099
2030
  * Подписка на изменение длины массива
@@ -2118,11 +2049,11 @@ let P = class ue extends L {
2118
2049
  * ```
2119
2050
  */
2120
2051
  watchLength(e) {
2121
- const t = _(() => {
2122
- const r = this.length.value;
2123
- e(r);
2124
- }), i = k(w.WatchLength);
2125
- return this.disposers.add(i, t);
2052
+ const t = b(() => {
2053
+ const i = this.length.value;
2054
+ e(i);
2055
+ }), s = V(w.WatchLength);
2056
+ return this.disposers.add(s, t);
2126
2057
  }
2127
2058
  /**
2128
2059
  * Очистить все ресурсы узла
@@ -2184,8 +2115,8 @@ let P = class ue extends L {
2184
2115
  e.enable();
2185
2116
  });
2186
2117
  }
2187
- };
2188
- class Ne {
2118
+ }
2119
+ class he {
2189
2120
  /**
2190
2121
  * Создает узел формы на основе конфигурации
2191
2122
  *
@@ -2235,14 +2166,14 @@ class Ne {
2235
2166
  if (Array.isArray(e) && e.length >= 1)
2236
2167
  return this.createArrayNodeFromArray(e);
2237
2168
  if (this.isFieldConfig(e))
2238
- return new Se(e);
2169
+ return new le(e);
2239
2170
  if (this.isArrayConfig(e))
2240
- return new te(
2171
+ return new H(
2241
2172
  e.schema,
2242
2173
  e.initialItems
2243
2174
  );
2244
2175
  if (this.isGroupConfig(e))
2245
- return new P(e);
2176
+ return new S(e);
2246
2177
  throw new Error(
2247
2178
  `NodeFactory: Unknown node config. Expected FieldConfig, GroupConfig, or ArrayConfig, but got: ${JSON.stringify(
2248
2179
  e
@@ -2276,11 +2207,11 @@ class Ne {
2276
2207
  */
2277
2208
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2278
2209
  createArrayNodeFromArray(e) {
2279
- const [t, ...i] = e, r = [];
2280
- this.isGroupConfig(t) && r.push(this.extractValues(t));
2281
- for (const n of i)
2282
- this.isGroupConfig(n) ? r.push(this.extractValues(n)) : r.push(n);
2283
- return new te(t, r);
2210
+ const [t, ...s] = e, i = [];
2211
+ this.isGroupConfig(t) && i.push(this.extractValues(t));
2212
+ for (const n of s)
2213
+ this.isGroupConfig(n) ? i.push(this.extractValues(n)) : i.push(n);
2214
+ return new H(t, i);
2284
2215
  }
2285
2216
  /**
2286
2217
  * Извлечь значения из схемы (рекурсивно)
@@ -2318,8 +2249,8 @@ class Ne {
2318
2249
  return e.map((t) => this.extractValues(t));
2319
2250
  if (this.isGroupConfig(e)) {
2320
2251
  const t = {};
2321
- for (const [i, r] of Object.entries(e))
2322
- t[i] = this.extractValues(r);
2252
+ for (const [s, i] of Object.entries(e))
2253
+ t[s] = this.extractValues(i);
2323
2254
  return t;
2324
2255
  }
2325
2256
  return e;
@@ -2399,64 +2330,43 @@ class Ne {
2399
2330
  return e != null && typeof e == "object" && !this.isFieldConfig(e) && !this.isArrayConfig(e);
2400
2331
  }
2401
2332
  }
2402
- function R(s) {
2403
- return s == null ? !1 : typeof s == "object" && "value" in s && "setValue" in s && "getValue" in s && "validate" in s;
2404
- }
2405
- function Oe(s) {
2406
- return s == null ? !1 : R(s) && "validators" in s && "asyncValidators" in s && // FieldNode имеет markAsTouched метод
2407
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2408
- typeof s.markAsTouched == "function" && // У FieldNode нет fields или items
2409
- !("fields" in s) && !("items" in s);
2410
- }
2411
- function Fe(s) {
2412
- return s == null ? !1 : R(s) && "getFieldByPath" in s && "fields" in s && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode/ModelArrayNode)
2413
- !("items" in s) && !("push" in s) && !("removeAt" in s);
2414
- }
2415
- function Me(s) {
2416
- return s == null ? !1 : R(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
2417
- typeof s.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2418
- typeof s.removeAt == "function";
2419
- }
2420
- function Qe(s) {
2421
- return Oe(s) ? "FieldNode" : Fe(s) ? "GroupNode" : Me(s) ? "ArrayNode" : R(s) ? "FormNode" : "Unknown";
2422
- }
2423
- class Pe extends L {
2333
+ class fe extends C {
2424
2334
  /**
2425
2335
  * @param control Реактивный массив модели (`model.<path>`).
2426
2336
  * @param buildItem Строитель формы элемента по его под-модели (инъекция, чтобы избежать цикла
2427
2337
  * импорта с `create-form`). Обычно `(item) => createForm({ model: item, schema: itemSchema(item) })`.
2428
2338
  */
2429
2339
  constructor(e, t) {
2430
- super(), this.control = e, this.buildItem = t, this.initial = e.toArray(), this.disposeSync = _(() => {
2431
- const r = e.length, n = [], a = [];
2432
- for (let u = 0; u < r; u++) {
2433
- const d = e.at(u);
2434
- if (!d) continue;
2435
- let o = this.cache.get(d);
2436
- o || (o = t(d), this.cache.set(d, o)), n.push(d), a.push(o);
2340
+ super(), this.control = e, this.buildItem = t, this.initial = e.toArray(), this.disposeSync = b(() => {
2341
+ const i = e.length, n = [], a = [];
2342
+ for (let u = 0; u < i; u++) {
2343
+ const h = e.at(u);
2344
+ if (!h) continue;
2345
+ let o = this.cache.get(h);
2346
+ o || (o = t(h), this.cache.set(h, o)), n.push(h), a.push(o);
2437
2347
  }
2438
- const l = new Set(n), c = [];
2348
+ const l = new Set(n), d = [];
2439
2349
  for (const u of this.mountedModels) {
2440
2350
  if (l.has(u)) continue;
2441
- const d = this.cache.get(u);
2442
- this.cache.delete(u), d && c.push(d);
2351
+ const h = this.cache.get(u);
2352
+ this.cache.delete(u), h && d.push(h);
2443
2353
  }
2444
- this.mountedModels = n, this.itemNodes.value = a, c.forEach((u) => this.disposeItemNode(u));
2445
- }), this.length = f(() => this.itemNodes.value.length), this.value = f(() => this.itemNodes.value.map((r) => r.value.value));
2446
- const i = H({
2354
+ this.mountedModels = n, this.itemNodes.value = a, d.forEach((u) => this.disposeItemNode(u));
2355
+ }), this.length = f(() => this.itemNodes.value.length), this.value = f(() => this.itemNodes.value.map((i) => i.value.value));
2356
+ const s = L({
2447
2357
  getChildren: () => this.itemNodes.value,
2448
2358
  ownErrors: this._arrayErrors
2449
2359
  });
2450
- 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;
2360
+ this.valid = s.valid, this.invalid = s.invalid, this.pending = s.pending, this.touched = s.touched, this.dirty = s.dirty, this.errors = s.errors, this.status = s.status;
2451
2361
  }
2452
- itemNodes = y([]);
2362
+ itemNodes = g([]);
2453
2363
  // Кэш per-item формы по идентичности фасада под-модели (фасады кэшируются в core).
2454
2364
  cache = /* @__PURE__ */ new WeakMap();
2455
2365
  // Фасады под-моделей, для которых сейчас смонтированы формы — «предыдущий» набор для
2456
2366
  // реконсиляции в disposeSync. Выпавшие из массива элементы диспозятся и вытесняются из кэша.
2457
2367
  mountedModels = [];
2458
2368
  initial;
2459
- _arrayErrors = y([]);
2369
+ _arrayErrors = g([]);
2460
2370
  disposeSync;
2461
2371
  /**
2462
2372
  * Сигнал per-item форм. Публичен в т.ч. чтобы `isArrayNode` распознавал узел как массив
@@ -2479,10 +2389,10 @@ class Pe extends L {
2479
2389
  return this.itemNodes.value[e];
2480
2390
  }
2481
2391
  map(e) {
2482
- return this.itemNodes.value.map((t, i) => e(t, i));
2392
+ return this.itemNodes.value.map((t, s) => e(t, s));
2483
2393
  }
2484
2394
  forEach(e) {
2485
- this.itemNodes.value.forEach((t, i) => e(t, i));
2395
+ this.itemNodes.value.forEach((t, s) => e(t, s));
2486
2396
  }
2487
2397
  // ── Мутации (делегируют массиву модели; effect пересоберёт itemNodes) ──────
2488
2398
  push(e) {
@@ -2582,621 +2492,358 @@ class Pe extends L {
2582
2492
  this.disposeSync(), this.itemNodes.value.forEach((e) => this.disposeItemNode(e)), this.mountedModels = [];
2583
2493
  }
2584
2494
  }
2585
- const xe = (s) => {
2586
- const e = s.componentProps;
2495
+ const ve = (r) => {
2496
+ const e = r.componentProps;
2587
2497
  return e != null && typeof e == "object" && typeof e.itemComponent == "function" && e.control != null && typeof e.control.at == "function" && typeof e.control.length == "number";
2588
- }, Ce = (s) => typeof s.when == "function" && Array.isArray(s.children);
2589
- function F(s, e, t, i, r) {
2590
- if (s == null || typeof s != "object") return;
2591
- if (Array.isArray(s)) {
2592
- for (const a of s) F(a, e, t, i, r);
2498
+ }, pe = (r) => typeof r.when == "function" && Array.isArray(r.children);
2499
+ function F(r, e, t, s, i) {
2500
+ if (r == null || typeof r != "object") return;
2501
+ if (Array.isArray(r)) {
2502
+ for (const a of r) F(a, e, t, s, i);
2593
2503
  return;
2594
2504
  }
2595
- const n = s;
2596
- if (Ce(n)) {
2597
- const a = i && !!n.when(e, t);
2598
- for (const l of n.children) F(l, e, t, a, r);
2505
+ const n = r;
2506
+ if (pe(n)) {
2507
+ const a = s && !!n.when(e, t);
2508
+ for (const l of n.children) F(l, e, t, a, i);
2599
2509
  return;
2600
2510
  }
2601
- if (xe(n)) {
2602
- const a = n.componentProps.control, l = n.componentProps.itemComponent, c = a.length;
2603
- for (let u = 0; u < c; u++) {
2604
- const d = a.at(u);
2605
- F(l(d), d, t, i, r);
2511
+ if (ve(n)) {
2512
+ const a = n.componentProps.control, l = n.componentProps.itemComponent, d = a.length;
2513
+ for (let u = 0; u < d; u++) {
2514
+ const h = a.at(u);
2515
+ F(l(h), h, t, s, i);
2606
2516
  }
2607
2517
  return;
2608
2518
  }
2609
- if (n.value instanceof oe) {
2610
- const a = n.validators ?? [], l = n.asyncValidators ?? [], c = l.length ? [...a, ...l] : a;
2611
- c.length > 0 && (i ? r.tasks.push({ signal: n.value, validators: c, scope: e }) : r.clearSignals.push(n.value));
2612
- for (const [u, d] of Object.entries(n))
2613
- u === "value" || u === "validators" || u === "asyncValidators" || F(d, e, t, i, r);
2519
+ if (n.value instanceof z) {
2520
+ const a = n.validators ?? [], l = n.asyncValidators ?? [], d = l.length ? [...a, ...l] : a;
2521
+ d.length > 0 && (s ? i.tasks.push({ signal: n.value, validators: d, scope: e }) : i.clearSignals.push(n.value));
2522
+ for (const [u, h] of Object.entries(n))
2523
+ u === "value" || u === "validators" || u === "asyncValidators" || F(h, e, t, s, i);
2614
2524
  return;
2615
2525
  }
2616
- for (const a of Object.values(n)) F(a, e, t, i, r);
2526
+ for (const a of Object.values(n)) F(a, e, t, s, i);
2617
2527
  }
2618
- function z(s, e) {
2528
+ function R(r, e) {
2619
2529
  const t = { tasks: [], clearSignals: [] };
2620
- return F(e, s, s, !0, t), t;
2530
+ return F(e, r, r, !0, t), t;
2621
2531
  }
2622
- const ce = (s, e, t) => {
2623
- (s[e] ??= []).push(t);
2624
- }, J = (s) => {
2625
- for (const e of Object.values(s))
2532
+ const X = (r, e, t) => {
2533
+ (r[e] ??= []).push(t);
2534
+ }, B = (r) => {
2535
+ for (const e of Object.values(r))
2626
2536
  for (const t of e) if (t.severity !== "warning") return !0;
2627
2537
  return !1;
2628
2538
  };
2629
- function Xe(s, e) {
2630
- const { tasks: t } = z(s, e), i = {};
2631
- for (const { signal: r, validators: n, scope: a } of t) {
2632
- const l = r.peek();
2633
- for (const c of n) {
2634
- const u = c(l, a, s);
2635
- u && typeof u.then == "function" || u && ce(i, r.__path, u);
2539
+ function Pe(r, e) {
2540
+ const { tasks: t } = R(r, e), s = {};
2541
+ for (const { signal: i, validators: n, scope: a } of t) {
2542
+ const l = i.peek();
2543
+ for (const d of n) {
2544
+ const u = d(l, a, r);
2545
+ u && typeof u.then == "function" || u && X(s, i.__path, u);
2636
2546
  }
2637
2547
  }
2638
- return { valid: !J(i), errors: i };
2548
+ return { valid: !B(s), errors: s };
2639
2549
  }
2640
- async function Ze(s, e) {
2641
- const { tasks: t } = z(s, e), i = await he(t, s);
2642
- return { valid: !J(i), errors: i };
2550
+ async function Te(r, e) {
2551
+ const { tasks: t } = R(r, e), s = await Z(t, r);
2552
+ return { valid: !B(s), errors: s };
2643
2553
  }
2644
- async function he(s, e) {
2554
+ async function Z(r, e) {
2645
2555
  const t = {};
2646
2556
  return await Promise.all(
2647
- s.map(async ({ signal: i, validators: r, scope: n }) => {
2648
- const a = i.peek();
2649
- for (const l of r) {
2650
- const c = await l(a, n, e);
2651
- c && ce(t, i.__path, c);
2557
+ r.map(async ({ signal: s, validators: i, scope: n }) => {
2558
+ const a = s.peek();
2559
+ for (const l of i) {
2560
+ const d = await l(a, n, e);
2561
+ d && X(t, s.__path, d);
2652
2562
  }
2653
2563
  })
2654
2564
  ), t;
2655
2565
  }
2656
- async function Te(s, e) {
2657
- const { tasks: t, clearSignals: i } = z(s, e), r = await he(t, s);
2566
+ async function me(r, e) {
2567
+ const { tasks: t, clearSignals: s } = R(r, e), i = await Z(t, r);
2658
2568
  for (const { signal: n } of t)
2659
- X(n)?.setErrors(r[n.__path] ?? []);
2660
- for (const n of i)
2661
- X(n)?.setErrors([]);
2662
- return { valid: !J(r), errors: r };
2569
+ U(n)?.setErrors(i[n.__path] ?? []);
2570
+ for (const n of s)
2571
+ U(n)?.setErrors([]);
2572
+ return { valid: !B(i), errors: i };
2663
2573
  }
2664
- const de = (s) => s !== null && typeof s == "object" && !Array.isArray(s) && !(s instanceof Date) && !(typeof Blob < "u" && s instanceof Blob) && !(typeof File < "u" && s instanceof File);
2665
- function U(s, e, t) {
2666
- if (s == null || typeof s != "object") return;
2667
- if (Array.isArray(s)) {
2668
- for (const n of s) U(n, e, t);
2574
+ const ee = (r) => r !== null && typeof r == "object" && !Array.isArray(r) && !(r instanceof Date) && !(typeof Blob < "u" && r instanceof Blob) && !(typeof File < "u" && r instanceof File);
2575
+ function D(r, e, t) {
2576
+ if (r == null || typeof r != "object") return;
2577
+ if (Array.isArray(r)) {
2578
+ for (const n of r) D(n, e, t);
2669
2579
  return;
2670
2580
  }
2671
- const i = s, r = i.array;
2672
- if (r && typeof r.__path == "string" && typeof i.item == "function") {
2673
- t.set(r.__path, i.item);
2581
+ const s = r, i = s.array;
2582
+ if (i && typeof i.__path == "string" && typeof s.item == "function") {
2583
+ t.set(i.__path, s.item);
2674
2584
  return;
2675
2585
  }
2676
- i.value instanceof oe ? e.set(i.value, {
2677
- component: i.component,
2678
- componentProps: i.componentProps,
2679
- validators: i.validators,
2680
- asyncValidators: i.asyncValidators,
2681
- updateOn: i.updateOn,
2682
- disabled: i.disabled,
2683
- debounce: i.debounce
2684
- }) : process.env.NODE_ENV !== "production" && i.component !== void 0 && ("valueSignal" in i || i.value != null) && console.warn(
2586
+ s.value instanceof z ? e.set(s.value, {
2587
+ component: s.component,
2588
+ componentProps: s.componentProps,
2589
+ validators: s.validators,
2590
+ asyncValidators: s.asyncValidators,
2591
+ updateOn: s.updateOn,
2592
+ disabled: s.disabled,
2593
+ debounce: s.debounce
2594
+ }) : process.env.NODE_ENV !== "production" && s.component !== void 0 && ("valueSignal" in s || s.value != null) && console.warn(
2685
2595
  "[reformer] createForm({ schema }): узел с `component` не распознан как поле — `value` не является сигналом модели. Ожидается `value: model.$.<path>`; проверьте, что не передан `value: model.<path>` (value-прокси) или `valueSignal:`."
2686
2596
  );
2687
- for (const [n, a] of Object.entries(i))
2688
- n !== "value" && U(a, e, t);
2597
+ for (const [n, a] of Object.entries(s))
2598
+ n !== "value" && D(a, e, t);
2689
2599
  }
2690
- function fe(s, e, t, i) {
2691
- const r = {};
2600
+ function te(r, e, t, s) {
2601
+ const i = {};
2692
2602
  for (const [n, a] of Object.entries(e)) {
2693
2603
  const l = t === "" ? n : `${t}.${n}`;
2694
2604
  if (Array.isArray(a))
2695
2605
  continue;
2696
- if (de(a)) {
2697
- r[n] = fe(s, a, l, i);
2606
+ if (ee(a)) {
2607
+ i[n] = te(r, a, l, s);
2698
2608
  continue;
2699
2609
  }
2700
- const c = s.signalAt(l);
2701
- if (!c) throw new Error(`createForm({ model }): не найден сигнал для пути "${l}"`);
2702
- const u = i.get(c) ?? {}, { validators: d, asyncValidators: o, ...v } = u;
2703
- r[n] = { ...v, valueSignal: c };
2610
+ const d = r.signalAt(l);
2611
+ if (!d) throw new Error(`createForm({ model }): не найден сигнал для пути "${l}"`);
2612
+ const u = s.get(d) ?? {}, { validators: h, asyncValidators: o, ...p } = u;
2613
+ i[n] = { ...p, valueSignal: d };
2704
2614
  }
2705
- return r;
2615
+ return i;
2706
2616
  }
2707
- function pe(s, e, t) {
2708
- for (const [i, r] of Object.entries(s)) {
2709
- const n = e === "" ? i : `${e}.${i}`;
2710
- Array.isArray(r) || (de(r) ? pe(r, n, t) : t.push(n));
2617
+ function se(r, e, t) {
2618
+ for (const [s, i] of Object.entries(r)) {
2619
+ const n = e === "" ? s : `${e}.${s}`;
2620
+ Array.isArray(i) || (ee(i) ? se(i, n, t) : t.push(n));
2711
2621
  }
2712
2622
  }
2713
- function ve(s) {
2714
- const { model: e, schema: t, behavior: i } = s, r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
2715
- t !== void 0 && U(t, r, n);
2716
- const a = fe(e, e.get(), "", r), l = new P(a), c = e.get();
2717
- for (const [o, v] of Object.entries(c)) {
2718
- if (!Array.isArray(v)) continue;
2719
- const h = n.get(o);
2720
- if (!h) continue;
2721
- const p = e[o], m = (g) => ve({ model: g, schema: h(g) }), b = new Pe(p, m);
2722
- l.fields.set(o, b);
2723
- }
2724
- const u = l.getProxy(), d = [];
2725
- pe(e.get(), "", d);
2726
- for (const o of d) {
2727
- const v = e.signalAt(o), h = l.getFieldByPath(o);
2728
- if (v && h) {
2729
- _e(v, h);
2730
- const p = o.lastIndexOf("."), m = p === -1 ? l : l.getFieldByPath(o.slice(0, p));
2731
- m instanceof P && m.registerFieldSignal(h, v);
2623
+ function re(r) {
2624
+ const { model: e, schema: t, behavior: s } = r, i = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
2625
+ t !== void 0 && D(t, i, n);
2626
+ const a = te(e, e.get(), "", i), l = new S(a), d = e.get();
2627
+ for (const [o, p] of Object.entries(d)) {
2628
+ if (!Array.isArray(p)) continue;
2629
+ const c = n.get(o);
2630
+ if (!c) continue;
2631
+ const v = e[o], m = (y) => re({ model: y, schema: c(y) }), _ = new fe(v, m);
2632
+ l.fields.set(o, _);
2633
+ }
2634
+ const u = l.getProxy(), h = [];
2635
+ se(e.get(), "", h);
2636
+ for (const o of h) {
2637
+ const p = e.signalAt(o), c = l.getFieldByPath(o);
2638
+ if (p && c) {
2639
+ ne(p, c);
2640
+ const v = o.lastIndexOf("."), m = v === -1 ? l : l.getFieldByPath(o.slice(0, v));
2641
+ m instanceof S && m.registerFieldSignal(c, p);
2732
2642
  }
2733
2643
  }
2734
2644
  if (t !== void 0) {
2735
2645
  const o = t;
2736
- l.attachModelValidator(async () => (await Te(e, o)).valid);
2646
+ l.attachModelValidator(async () => (await me(e, o)).valid);
2737
2647
  }
2738
- return i && l.attachBehaviorCleanup(i.__run(e, u)), u;
2648
+ return s && l.attachBehaviorCleanup(s.__run(e, u)), u;
2739
2649
  }
2740
- const Ie = (s) => s != null && typeof s == "object" && "model" in s && typeof s.model?.signalAt == "function";
2741
- function et(s) {
2742
- return Ie(s) ? ve(s) : new P(s).getProxy();
2650
+ const ye = (r) => r != null && typeof r == "object" && "model" in r && typeof r.model?.signalAt == "function";
2651
+ function De(r) {
2652
+ return ye(r) ? re(r) : new S(r).getProxy();
2743
2653
  }
2744
- const T = (s) => !(s === null || typeof s != "object" || Array.isArray(s) || s instanceof Date || typeof Blob < "u" && s instanceof Blob || typeof File < "u" && s instanceof File), A = (s, e) => s === "" ? String(e) : `${s}.${e}`, W = (s) => /^\d+$/.test(s), S = (s) => {
2745
- if (Array.isArray(s)) return s.map(S);
2746
- if (T(s)) {
2747
- const e = {};
2748
- for (const t of Object.keys(s)) e[t] = S(s[t]);
2749
- return e;
2750
- }
2751
- return s;
2752
- }, I = (s, e) => {
2753
- if (s === e) return !0;
2754
- if (Array.isArray(s) && Array.isArray(e))
2755
- return s.length !== e.length ? !1 : s.every((t, i) => I(t, e[i]));
2756
- if (T(s) && T(e)) {
2757
- const t = Object.keys(s), i = Object.keys(e);
2758
- return t.length !== i.length ? !1 : t.every((r) => I(s[r], e[r]));
2759
- }
2760
- return !1;
2761
- };
2762
- class De {
2763
- constructor(e, t) {
2764
- this.path = t;
2765
- const i = y(e);
2766
- i.__path = t, this.signal = i, this.initial = S(e);
2767
- }
2768
- kind = "leaf";
2769
- signal;
2770
- initial;
2771
- rebase(e) {
2772
- this.path = e, this.signal.__path = e;
2773
- }
2774
- /** Реактивное чтение (внутри effect/computed создаёт зависимость). */
2775
- read() {
2776
- return this.signal.value;
2777
- }
2778
- /** Нереактивный снимок. */
2779
- peek() {
2780
- return this.signal.peek();
2781
- }
2782
- set(e) {
2783
- this.signal.value = e;
2784
- }
2785
- resetToInitial() {
2786
- this.signal.value = S(this.initial);
2787
- }
2788
- captureInitial() {
2789
- this.initial = S(this.signal.peek());
2790
- }
2791
- dirty() {
2792
- return !I(this.signal.peek(), this.initial);
2793
- }
2654
+ function x(r) {
2655
+ return r == null ? !1 : typeof r == "object" && "value" in r && "setValue" in r && "getValue" in r && "validate" in r;
2794
2656
  }
2795
- class me {
2796
- constructor(e, t) {
2797
- this.path = t;
2798
- for (const i of Object.keys(e))
2799
- this.children.set(i, x(e[i], A(t, i)));
2800
- }
2801
- kind = "group";
2802
- children = /* @__PURE__ */ new Map();
2803
- rebase(e) {
2804
- this.path = e;
2805
- for (const [t, i] of this.children) i.rebase(A(e, t));
2806
- }
2807
- peek() {
2808
- const e = {};
2809
- for (const [t, i] of this.children) e[t] = i.peek();
2810
- return e;
2811
- }
2812
- set(e) {
2813
- if (e == null || typeof e != "object") return;
2814
- const t = e;
2815
- for (const [i, r] of this.children)
2816
- i in t && (r.kind === "leaf" && G(r.signal) || r.set(t[i]));
2817
- }
2818
- resetToInitial() {
2819
- for (const e of this.children.values()) e.resetToInitial();
2820
- }
2821
- captureInitial() {
2822
- for (const e of this.children.values()) e.captureInitial();
2823
- }
2824
- dirty() {
2825
- for (const e of this.children.values()) if (e.dirty()) return !0;
2826
- return !1;
2827
- }
2828
- }
2829
- class Le {
2830
- constructor(e, t) {
2831
- this.path = t, this.items = y(e.map((i, r) => x(i, A(t, r)))), this.initial = S(e);
2832
- }
2833
- kind = "array";
2834
- items;
2835
- initial;
2836
- rebase(e) {
2837
- this.path = e, this.items.peek().forEach((t, i) => t.rebase(A(e, i)));
2838
- }
2839
- reindex() {
2840
- this.items.peek().forEach((e, t) => e.rebase(A(this.path, t)));
2841
- }
2842
- push(e) {
2843
- const t = this.items.peek();
2844
- this.items.value = [...t, x(e, A(this.path, t.length))];
2845
- }
2846
- insertAt(e, t) {
2847
- const i = [...this.items.peek()];
2848
- i.splice(e, 0, x(t, A(this.path, e))), this.items.value = i, this.reindex();
2849
- }
2850
- removeAt(e) {
2851
- const t = [...this.items.peek()];
2852
- t.splice(e, 1), this.items.value = t, this.reindex();
2853
- }
2854
- move(e, t) {
2855
- const i = [...this.items.peek()], [r] = i.splice(e, 1);
2856
- r && i.splice(t, 0, r), this.items.value = i, this.reindex();
2857
- }
2858
- swap(e, t) {
2859
- const i = [...this.items.peek()];
2860
- e < 0 || t < 0 || e >= i.length || t >= i.length || e === t || ([i[e], i[t]] = [i[t], i[e]], this.items.value = i, this.reindex());
2861
- }
2862
- clear() {
2863
- this.items.value = [];
2864
- }
2865
- peek() {
2866
- return this.items.peek().map((e) => e.peek());
2867
- }
2868
- set(e) {
2869
- const t = Array.isArray(e) ? e : [];
2870
- this.items.value = t.map((i, r) => x(i, A(this.path, r)));
2871
- }
2872
- resetToInitial() {
2873
- this.set(S(this.initial));
2874
- }
2875
- captureInitial() {
2876
- this.initial = S(this.peek());
2877
- }
2878
- dirty() {
2879
- return !I(this.peek(), this.initial);
2880
- }
2881
- }
2882
- function x(s, e) {
2883
- return Array.isArray(s) ? new Le(s, e) : T(s) ? new me(s, e) : new De(s, e);
2884
- }
2885
- function D(s) {
2886
- if (s)
2887
- return s.kind === "leaf" ? s.read() : s.kind === "group" ? Re(s) : ye(s);
2888
- }
2889
- function Re(s) {
2890
- return new Proxy(
2891
- {},
2892
- {
2893
- get: (e, t) => t === "__path" ? s.path : typeof t == "string" ? D(s.children.get(t)) : void 0,
2894
- set: (e, t, i) => {
2895
- if (typeof t != "string") return !1;
2896
- const r = s.children.get(t);
2897
- return r && r.set(i), !0;
2898
- },
2899
- has: (e, t) => typeof t == "string" && s.children.has(t),
2900
- ownKeys: () => [...s.children.keys()],
2901
- getOwnPropertyDescriptor: (e, t) => typeof t == "string" && s.children.has(t) ? { enumerable: !0, configurable: !0 } : void 0
2902
- }
2903
- );
2904
- }
2905
- function $(s) {
2906
- if (s)
2907
- return s.kind === "group" ? ge(s) : s.kind === "array" ? ye(s) : s.read();
2908
- }
2909
- function ye(s) {
2910
- const e = {
2911
- get length() {
2912
- return s.items.value.length;
2913
- },
2914
- push: (t) => s.push(t),
2915
- insertAt: (t, i) => s.insertAt(t, i),
2916
- removeAt: (t) => s.removeAt(t),
2917
- move: (t, i) => s.move(t, i),
2918
- swap: (t, i) => s.swap(t, i),
2919
- clear: () => s.clear(),
2920
- at: (t) => $(s.items.value[t]),
2921
- map: (t) => s.items.value.map((i, r) => t($(i), r)),
2922
- forEach: (t) => s.items.value.forEach((i, r) => t($(i), r)),
2923
- toArray: () => s.peek(),
2924
- [Symbol.iterator]: function* () {
2925
- const t = s.items.value;
2926
- for (let i = 0; i < t.length; i++) yield D(t[i]);
2927
- }
2928
- };
2929
- return new Proxy(e, {
2930
- get: (t, i, r) => i === "__path" ? s.path : typeof i == "string" && W(i) ? D(s.items.value[Number(i)]) : Reflect.get(t, i, r),
2931
- has: (t, i) => typeof i == "string" && W(i) ? Number(i) < s.items.value.length : Reflect.has(t, i)
2932
- });
2933
- }
2934
- function q(s) {
2935
- if (s.kind === "leaf") return s.signal;
2936
- if (s.kind === "group")
2937
- return new Proxy(
2938
- {},
2939
- {
2940
- get: (t, i) => {
2941
- if (i === "__path") return s.path;
2942
- if (typeof i != "string") return;
2943
- const r = s.children.get(i);
2944
- return r ? q(r) : void 0;
2945
- },
2946
- has: (t, i) => typeof i == "string" && s.children.has(i),
2947
- ownKeys: () => [...s.children.keys()],
2948
- getOwnPropertyDescriptor: (t, i) => typeof i == "string" && s.children.has(i) ? { enumerable: !0, configurable: !0 } : void 0
2949
- }
2950
- );
2951
- const e = s;
2952
- return new Proxy(
2953
- {
2954
- get length() {
2955
- return e.items.value.length;
2956
- }
2957
- },
2958
- {
2959
- get: (t, i, r) => {
2960
- if (i === "__path") return e.path;
2961
- if (typeof i == "string" && W(i)) {
2962
- const n = e.items.value[Number(i)];
2963
- return n ? q(n) : void 0;
2964
- }
2965
- return Reflect.get(t, i, r);
2966
- }
2967
- }
2968
- );
2657
+ function ge(r) {
2658
+ return r == null ? !1 : x(r) && "validators" in r && "asyncValidators" in r && // FieldNode имеет markAsTouched метод
2659
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2660
+ typeof r.markAsTouched == "function" && // У FieldNode нет fields или items
2661
+ !("fields" in r) && !("items" in r);
2969
2662
  }
2970
- function $e(s, e) {
2971
- if (!e) return;
2972
- let t = s;
2973
- for (const i of e.split(".")) {
2974
- if (!t) return;
2975
- if (t.kind === "group") t = t.children.get(i);
2976
- else if (t.kind === "array") t = t.items.peek()[Number(i)];
2977
- else return;
2978
- }
2979
- return t && t.kind === "leaf" ? t.signal : void 0;
2663
+ function _e(r) {
2664
+ return r == null ? !1 : x(r) && "getFieldByPath" in r && "fields" in r && // GroupNode НЕ имеет items/push/removeAt (это ArrayNode/ModelArrayNode)
2665
+ !("items" in r) && !("push" in r) && !("removeAt" in r);
2980
2666
  }
2981
- const se = /* @__PURE__ */ new Set([
2982
- "$",
2983
- "get",
2984
- "set",
2985
- "patch",
2986
- "isDirty",
2987
- "reset",
2988
- "captureInitial",
2989
- "signalAt"
2990
- ]), ie = /* @__PURE__ */ new WeakMap();
2991
- function ge(s) {
2992
- const e = ie.get(s);
2993
- if (e) return e;
2994
- const t = {
2995
- $: q(s),
2996
- get: () => s.peek(),
2997
- set: (r) => s.set(r),
2998
- patch: (r) => s.set(r),
2999
- isDirty: () => s.dirty(),
3000
- reset: () => s.resetToInitial(),
3001
- captureInitial: () => s.captureInitial(),
3002
- signalAt: (r) => $e(s, r)
3003
- }, i = new Proxy(
3004
- {},
3005
- {
3006
- get: (r, n) => {
3007
- if (typeof n != "string") return;
3008
- const a = s.children.get(n);
3009
- if (a) return D(a);
3010
- if (se.has(n)) return t[n];
3011
- },
3012
- set: (r, n, a) => {
3013
- if (typeof n != "string") return !1;
3014
- const l = s.children.get(n);
3015
- return l ? (l.set(a), !0) : !1;
3016
- },
3017
- has: (r, n) => typeof n == "string" && (s.children.has(n) || se.has(n)),
3018
- ownKeys: () => [...s.children.keys()],
3019
- getOwnPropertyDescriptor: (r, n) => typeof n == "string" && s.children.has(n) ? { enumerable: !0, configurable: !0 } : void 0
3020
- }
3021
- );
3022
- return ie.set(s, i), i;
2667
+ function be(r) {
2668
+ return r == null ? !1 : x(r) && "items" in r && "length" in r && "push" in r && "removeAt" in r && "at" in r && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2669
+ typeof r.push == "function" && // eslint-disable-next-line @typescript-eslint/no-explicit-any
2670
+ typeof r.removeAt == "function";
3023
2671
  }
3024
- function tt(s) {
3025
- const e = new me(s, "");
3026
- return ge(e);
2672
+ function Ie(r) {
2673
+ return ge(r) ? "FieldNode" : _e(r) ? "GroupNode" : be(r) ? "ArrayNode" : x(r) ? "FormNode" : "Unknown";
3027
2674
  }
3028
- var C = { exports: {} }, j = {};
3029
- var re;
3030
- function je() {
3031
- if (re) return j;
3032
- re = 1;
3033
- var s = le;
3034
- function e(o, v) {
3035
- return o === v && (o !== 0 || 1 / o === 1 / v) || o !== o && v !== v;
3036
- }
3037
- var t = typeof Object.is == "function" ? Object.is : e, i = s.useState, r = s.useEffect, n = s.useLayoutEffect, a = s.useDebugValue;
3038
- function l(o, v) {
3039
- var h = v(), p = i({ inst: { value: h, getSnapshot: v } }), m = p[0].inst, b = p[1];
2675
+ var M = { exports: {} }, P = {};
2676
+ var K;
2677
+ function Ee() {
2678
+ if (K) return P;
2679
+ K = 1;
2680
+ var r = Q;
2681
+ function e(o, p) {
2682
+ return o === p && (o !== 0 || 1 / o === 1 / p) || o !== o && p !== p;
2683
+ }
2684
+ var t = typeof Object.is == "function" ? Object.is : e, s = r.useState, i = r.useEffect, n = r.useLayoutEffect, a = r.useDebugValue;
2685
+ function l(o, p) {
2686
+ var c = p(), v = s({ inst: { value: c, getSnapshot: p } }), m = v[0].inst, _ = v[1];
3040
2687
  return n(
3041
2688
  function() {
3042
- m.value = h, m.getSnapshot = v, c(m) && b({ inst: m });
2689
+ m.value = c, m.getSnapshot = p, d(m) && _({ inst: m });
3043
2690
  },
3044
- [o, h, v]
3045
- ), r(
2691
+ [o, c, p]
2692
+ ), i(
3046
2693
  function() {
3047
- return c(m) && b({ inst: m }), o(function() {
3048
- c(m) && b({ inst: m });
2694
+ return d(m) && _({ inst: m }), o(function() {
2695
+ d(m) && _({ inst: m });
3049
2696
  });
3050
2697
  },
3051
2698
  [o]
3052
- ), a(h), h;
2699
+ ), a(c), c;
3053
2700
  }
3054
- function c(o) {
3055
- var v = o.getSnapshot;
2701
+ function d(o) {
2702
+ var p = o.getSnapshot;
3056
2703
  o = o.value;
3057
2704
  try {
3058
- var h = v();
3059
- return !t(o, h);
2705
+ var c = p();
2706
+ return !t(o, c);
3060
2707
  } catch {
3061
2708
  return !0;
3062
2709
  }
3063
2710
  }
3064
- function u(o, v) {
3065
- return v();
2711
+ function u(o, p) {
2712
+ return p();
3066
2713
  }
3067
- var d = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : l;
3068
- return j.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : d, j;
2714
+ var h = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? u : l;
2715
+ return P.useSyncExternalStore = r.useSyncExternalStore !== void 0 ? r.useSyncExternalStore : h, P;
3069
2716
  }
3070
- var B = {};
3071
- var ne;
3072
- function Be() {
3073
- return ne || (ne = 1, process.env.NODE_ENV !== "production" && (function() {
3074
- function s(h, p) {
3075
- return h === p && (h !== 0 || 1 / h === 1 / p) || h !== h && p !== p;
2717
+ var T = {};
2718
+ var J;
2719
+ function Se() {
2720
+ return J || (J = 1, process.env.NODE_ENV !== "production" && (function() {
2721
+ function r(c, v) {
2722
+ return c === v && (c !== 0 || 1 / c === 1 / v) || c !== c && v !== v;
3076
2723
  }
3077
- function e(h, p) {
3078
- d || r.startTransition === void 0 || (d = !0, console.error(
2724
+ function e(c, v) {
2725
+ h || i.startTransition === void 0 || (h = !0, console.error(
3079
2726
  "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."
3080
2727
  ));
3081
- var m = p();
2728
+ var m = v();
3082
2729
  if (!o) {
3083
- var b = p();
3084
- n(m, b) || (console.error(
2730
+ var _ = v();
2731
+ n(m, _) || (console.error(
3085
2732
  "The result of getSnapshot should be cached to avoid an infinite loop"
3086
2733
  ), o = !0);
3087
2734
  }
3088
- b = a({
3089
- inst: { value: m, getSnapshot: p }
2735
+ _ = a({
2736
+ inst: { value: m, getSnapshot: v }
3090
2737
  });
3091
- var g = b[0].inst, V = b[1];
3092
- return c(
2738
+ var y = _[0].inst, k = _[1];
2739
+ return d(
3093
2740
  function() {
3094
- g.value = m, g.getSnapshot = p, t(g) && V({ inst: g });
2741
+ y.value = m, y.getSnapshot = v, t(y) && k({ inst: y });
3095
2742
  },
3096
- [h, m, p]
2743
+ [c, m, v]
3097
2744
  ), l(
3098
2745
  function() {
3099
- return t(g) && V({ inst: g }), h(function() {
3100
- t(g) && V({ inst: g });
2746
+ return t(y) && k({ inst: y }), c(function() {
2747
+ t(y) && k({ inst: y });
3101
2748
  });
3102
2749
  },
3103
- [h]
2750
+ [c]
3104
2751
  ), u(m), m;
3105
2752
  }
3106
- function t(h) {
3107
- var p = h.getSnapshot;
3108
- h = h.value;
2753
+ function t(c) {
2754
+ var v = c.getSnapshot;
2755
+ c = c.value;
3109
2756
  try {
3110
- var m = p();
3111
- return !n(h, m);
2757
+ var m = v();
2758
+ return !n(c, m);
3112
2759
  } catch {
3113
2760
  return !0;
3114
2761
  }
3115
2762
  }
3116
- function i(h, p) {
3117
- return p();
2763
+ function s(c, v) {
2764
+ return v();
3118
2765
  }
3119
2766
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
3120
- var r = le, n = typeof Object.is == "function" ? Object.is : s, a = r.useState, l = r.useEffect, c = r.useLayoutEffect, u = r.useDebugValue, d = !1, o = !1, v = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? i : e;
3121
- B.useSyncExternalStore = r.useSyncExternalStore !== void 0 ? r.useSyncExternalStore : v, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
3122
- })()), B;
2767
+ var i = Q, n = typeof Object.is == "function" ? Object.is : r, a = i.useState, l = i.useEffect, d = i.useLayoutEffect, u = i.useDebugValue, h = !1, o = !1, p = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? s : e;
2768
+ T.useSyncExternalStore = i.useSyncExternalStore !== void 0 ? i.useSyncExternalStore : p, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
2769
+ })()), T;
3123
2770
  }
3124
- var ae;
3125
- function Ge() {
3126
- return ae || (ae = 1, process.env.NODE_ENV === "production" ? C.exports = je() : C.exports = Be()), C.exports;
2771
+ var Y;
2772
+ function Ae() {
2773
+ return Y || (Y = 1, process.env.NODE_ENV === "production" ? M.exports = Ee() : M.exports = Se()), M.exports;
3127
2774
  }
3128
- var Y = Ge();
3129
- function Ue(s, e) {
3130
- if (s === e) return !0;
3131
- if (s.length !== e.length) return !1;
3132
- for (let t = 0; t < s.length; t++)
3133
- if (s[t] !== e[t]) return !1;
2775
+ var $ = Ae();
2776
+ function we(r, e) {
2777
+ if (r === e) return !0;
2778
+ if (r.length !== e.length) return !1;
2779
+ for (let t = 0; t < r.length; t++)
2780
+ if (r[t] !== e[t]) return !1;
3134
2781
  return !0;
3135
2782
  }
3136
- function Q(s, e, t, i) {
3137
- const r = M(null), n = M(s);
3138
- n.current = s;
3139
- const a = M(e);
2783
+ function j(r, e, t, s) {
2784
+ const i = N(null), n = N(r);
2785
+ n.current = r;
2786
+ const a = N(e);
3140
2787
  a.current = e;
3141
- const l = M(t);
3142
- if (l.current = t, r.current === null) {
3143
- const d = {};
3144
- for (const o in s)
3145
- d[o] = s[o].value;
3146
- r.current = { ...d, __snapshot: null };
3147
- }
3148
- const c = E(
3149
- (d) => {
2788
+ const l = N(t);
2789
+ if (l.current = t, i.current === null) {
2790
+ const h = {};
2791
+ for (const o in r)
2792
+ h[o] = r[o].value;
2793
+ i.current = { ...h, __snapshot: null };
2794
+ }
2795
+ const d = E(
2796
+ (h) => {
3150
2797
  let o = !0;
3151
- return _(() => {
3152
- const h = n.current;
3153
- for (const p in h)
3154
- h[p].value;
2798
+ return b(() => {
2799
+ const c = n.current;
2800
+ for (const v in c)
2801
+ c[v].value;
3155
2802
  if (o) {
3156
2803
  o = !1;
3157
2804
  return;
3158
2805
  }
3159
- d();
2806
+ h();
3160
2807
  });
3161
2808
  },
3162
- [i]
2809
+ [s]
3163
2810
  ), u = E(() => {
3164
- const d = r.current, o = n.current, v = {};
3165
- for (const p in o)
3166
- v[p] = o[p].value;
3167
- let h = !1;
3168
- for (const p of a.current) {
3169
- const { key: m, useShallowArrayEqual: b } = p, g = v[m], V = d[m];
3170
- if (b) {
3171
- if (!Ue(V, g)) {
3172
- h = !0;
2811
+ const h = i.current, o = n.current, p = {};
2812
+ for (const v in o)
2813
+ p[v] = o[v].value;
2814
+ let c = !1;
2815
+ for (const v of a.current) {
2816
+ const { key: m, useShallowArrayEqual: _ } = v, y = p[m], k = h[m];
2817
+ if (_) {
2818
+ if (!we(k, y)) {
2819
+ c = !0;
3173
2820
  break;
3174
2821
  }
3175
- } else if (V !== g) {
3176
- h = !0;
2822
+ } else if (k !== y) {
2823
+ c = !0;
3177
2824
  break;
3178
2825
  }
3179
2826
  }
3180
- if (!h && d.__snapshot)
3181
- return d.__snapshot;
3182
- for (const p in o)
3183
- d[p] = v[p];
3184
- return d.__snapshot = l.current(v), d.__snapshot;
3185
- }, [i]);
3186
- return Y.useSyncExternalStore(c, u, u);
2827
+ if (!c && h.__snapshot)
2828
+ return h.__snapshot;
2829
+ for (const v in o)
2830
+ h[v] = p[v];
2831
+ return h.__snapshot = l.current(p), h.__snapshot;
2832
+ }, [s]);
2833
+ return $.useSyncExternalStore(d, u, u);
3187
2834
  }
3188
- function We(s) {
2835
+ function Ve(r) {
3189
2836
  const e = {
3190
- value: s.value,
3191
- disabled: s.disabled,
3192
- errors: s.errors,
3193
- pending: s.pending,
3194
- valid: s.valid,
3195
- invalid: s.invalid,
3196
- touched: s.touched,
3197
- dirty: s.dirty,
3198
- shouldShowError: s.shouldShowError,
3199
- componentProps: s.componentProps
2837
+ value: r.value,
2838
+ disabled: r.disabled,
2839
+ errors: r.errors,
2840
+ pending: r.pending,
2841
+ valid: r.valid,
2842
+ invalid: r.invalid,
2843
+ touched: r.touched,
2844
+ dirty: r.dirty,
2845
+ shouldShowError: r.shouldShowError,
2846
+ componentProps: r.componentProps
3200
2847
  }, t = [
3201
2848
  { key: "value" },
3202
2849
  { key: "disabled" },
@@ -3208,34 +2855,34 @@ function We(s) {
3208
2855
  { key: "dirty" },
3209
2856
  { key: "shouldShowError" },
3210
2857
  { key: "componentProps" }
3211
- ], i = E(
3212
- (r) => ({
3213
- value: r.value,
3214
- pending: r.pending,
3215
- disabled: r.disabled,
3216
- errors: r.errors,
3217
- valid: r.valid,
3218
- invalid: r.invalid,
3219
- touched: r.touched,
3220
- dirty: r.dirty,
3221
- shouldShowError: r.shouldShowError,
3222
- componentProps: r.componentProps
2858
+ ], s = E(
2859
+ (i) => ({
2860
+ value: i.value,
2861
+ pending: i.pending,
2862
+ disabled: i.disabled,
2863
+ errors: i.errors,
2864
+ valid: i.valid,
2865
+ invalid: i.invalid,
2866
+ touched: i.touched,
2867
+ dirty: i.dirty,
2868
+ shouldShowError: i.shouldShowError,
2869
+ componentProps: i.componentProps
3223
2870
  }),
3224
2871
  []
3225
2872
  );
3226
- return Q(e, t, i, s);
2873
+ return j(e, t, s, r);
3227
2874
  }
3228
- function qe(s) {
2875
+ function ke(r) {
3229
2876
  const e = {
3230
- value: s.value,
3231
- length: s.length,
3232
- errors: s.errors,
3233
- pending: s.pending,
3234
- valid: s.valid,
3235
- invalid: s.invalid,
3236
- touched: s.touched,
3237
- dirty: s.dirty,
3238
- disabled: s.disabled
2877
+ value: r.value,
2878
+ length: r.length,
2879
+ errors: r.errors,
2880
+ pending: r.pending,
2881
+ valid: r.valid,
2882
+ invalid: r.invalid,
2883
+ touched: r.touched,
2884
+ dirty: r.dirty,
2885
+ disabled: r.disabled
3239
2886
  }, t = [
3240
2887
  { key: "value" },
3241
2888
  { key: "length" },
@@ -3246,24 +2893,24 @@ function qe(s) {
3246
2893
  { key: "touched" },
3247
2894
  { key: "dirty" },
3248
2895
  { key: "disabled" }
3249
- ], i = E(
3250
- (r) => ({
3251
- value: r.value,
3252
- length: r.length,
3253
- pending: r.pending,
3254
- errors: r.errors,
3255
- valid: r.valid,
3256
- invalid: r.invalid,
3257
- touched: r.touched,
3258
- dirty: r.dirty,
3259
- disabled: r.disabled
2896
+ ], s = E(
2897
+ (i) => ({
2898
+ value: i.value,
2899
+ length: i.length,
2900
+ pending: i.pending,
2901
+ errors: i.errors,
2902
+ valid: i.valid,
2903
+ invalid: i.invalid,
2904
+ touched: i.touched,
2905
+ dirty: i.dirty,
2906
+ disabled: i.disabled
3260
2907
  }),
3261
2908
  []
3262
2909
  );
3263
- return Q(e, t, i, s);
2910
+ return j(e, t, s, r);
3264
2911
  }
3265
- function Ke() {
3266
- const s = E(
2912
+ function Oe() {
2913
+ const r = E(
3267
2914
  () => ({
3268
2915
  value: [],
3269
2916
  length: 0,
@@ -3277,93 +2924,93 @@ function Ke() {
3277
2924
  }),
3278
2925
  []
3279
2926
  );
3280
- return Q({}, [], s);
2927
+ return j({}, [], r);
3281
2928
  }
3282
- function st(s) {
3283
- const e = s && "length" in s && "map" in s;
3284
- return s ? e ? qe(s) : We(s) : Ke();
2929
+ function Le(r) {
2930
+ const e = r && "length" in r && "map" in r;
2931
+ return r ? e ? ke(r) : Ve(r) : Oe();
3285
2932
  }
3286
- function it(s) {
3287
- const e = M({ value: s.value.value }), t = E(
3288
- (r) => {
2933
+ function Re(r) {
2934
+ const e = N({ value: r.value.value }), t = E(
2935
+ (i) => {
3289
2936
  let n = !0;
3290
- return _(() => {
3291
- if (s.value.value, n) {
2937
+ return b(() => {
2938
+ if (r.value.value, n) {
3292
2939
  n = !1;
3293
2940
  return;
3294
2941
  }
3295
- r();
2942
+ i();
3296
2943
  });
3297
2944
  },
3298
- [s]
3299
- ), i = E(() => {
3300
- const r = s.value.value;
3301
- return e.current.value === r ? e.current.value : (e.current.value = r, r);
3302
- }, [s]);
3303
- return Y.useSyncExternalStore(t, i, i);
2945
+ [r]
2946
+ ), s = E(() => {
2947
+ const i = r.value.value;
2948
+ return e.current.value === i ? e.current.value : (e.current.value = i, i);
2949
+ }, [r]);
2950
+ return $.useSyncExternalStore(t, s, s);
3304
2951
  }
3305
- function rt(s) {
3306
- const e = M({ length: s.length.value }), t = E(
3307
- (r) => {
2952
+ function Be(r) {
2953
+ const e = N({ length: r.length.value }), t = E(
2954
+ (i) => {
3308
2955
  let n = !0;
3309
- return _(() => {
3310
- if (s.length.value, n) {
2956
+ return b(() => {
2957
+ if (r.length.value, n) {
3311
2958
  n = !1;
3312
2959
  return;
3313
2960
  }
3314
- r();
2961
+ i();
3315
2962
  });
3316
2963
  },
3317
- [s]
3318
- ), i = E(() => {
3319
- const r = s.length.value;
3320
- return e.current.length === r ? e.current.length : (e.current.length = r, r);
3321
- }, [s]);
3322
- return Y.useSyncExternalStore(t, i, i);
2964
+ [r]
2965
+ ), s = E(() => {
2966
+ const i = r.length.value;
2967
+ return e.current.length === i ? e.current.length : (e.current.length = i, i);
2968
+ }, [r]);
2969
+ return $.useSyncExternalStore(t, s, s);
3323
2970
  }
3324
2971
  export {
3325
- te as ArrayNode,
3326
- O as ErrorStrategy,
3327
- Se as FieldNode,
3328
- N as FormErrorHandler,
3329
- L as FormNode,
3330
- Ae as FormStatusMachine,
3331
- ke as FormSubmitter,
3332
- P as GroupNode,
3333
- Pe as ModelArrayNode,
3334
- Ne as NodeFactory,
3335
- K as SubscriptionManager,
3336
- ot as computeFrom,
3337
- lt as copyFrom,
3338
- et as createForm,
3339
- ve as createFormFromModel,
3340
- tt as createModel,
3341
- ut as disableWhen,
3342
- ct as enableWhen,
3343
- X as getNodeForSignal,
3344
- Qe as getNodeType,
3345
- Me as isArrayNode,
2972
+ H as ArrayNode,
2973
+ A as ErrorStrategy,
2974
+ le as FieldNode,
2975
+ O as FormErrorHandler,
2976
+ C as FormNode,
2977
+ oe as FormStatusMachine,
2978
+ de as FormSubmitter,
2979
+ S as GroupNode,
2980
+ fe as ModelArrayNode,
2981
+ he as NodeFactory,
2982
+ I as SubscriptionManager,
2983
+ We as computeFrom,
2984
+ qe as copyFrom,
2985
+ De as createForm,
2986
+ re as createFormFromModel,
2987
+ Ge as createModel,
2988
+ nt as disableWhen,
2989
+ at as enableWhen,
2990
+ U as getNodeForSignal,
2991
+ Ie as getNodeType,
2992
+ be as isArrayNode,
3346
2993
  G as isDerived,
3347
- Oe as isFieldNode,
3348
- R as isFormNode,
3349
- Fe as isGroupNode,
3350
- ht as markDerived,
3351
- _e as registerSignalNode,
3352
- dt as resetWhen,
3353
- ft as revalidateWhen,
3354
- pt as runOutsideEffect,
3355
- vt as safeCallback,
3356
- mt as safeDebouncedCallback,
3357
- yt as syncFields,
3358
- gt as transformValue,
3359
- k as uniqueId,
3360
- bt as unmarkDerived,
3361
- rt as useArrayLength,
3362
- st as useFormControl,
3363
- it as useFormControlValue,
3364
- Te as validateFormModel,
3365
- Ze as validateModel,
3366
- Xe as validateModelSync,
3367
- At as validators,
3368
- _t as watchField
2994
+ ge as isFieldNode,
2995
+ x as isFormNode,
2996
+ _e as isGroupNode,
2997
+ He as markDerived,
2998
+ ne as registerSignalNode,
2999
+ Ke as resetWhen,
3000
+ Je as revalidateWhen,
3001
+ Ye as runOutsideEffect,
3002
+ ze as safeCallback,
3003
+ Qe as safeDebouncedCallback,
3004
+ Xe as syncFields,
3005
+ Ze as transformValue,
3006
+ V as uniqueId,
3007
+ et as unmarkDerived,
3008
+ Be as useArrayLength,
3009
+ Le as useFormControl,
3010
+ Re as useFormControlValue,
3011
+ me as validateFormModel,
3012
+ Te as validateModel,
3013
+ Pe as validateModelSync,
3014
+ rt as validators,
3015
+ tt as watchField
3369
3016
  };