@goodie-forms/core 1.2.6-alpha → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,107 +1,107 @@
1
1
  var h;
2
2
  ((t) => {
3
- function e(f) {
4
- const a = r(f);
3
+ function e(l) {
4
+ const o = r(l);
5
5
  let u = "";
6
- for (const y of a)
7
- typeof y == "number" ? u += `[${y}]` : (u.length > 0 && (u += "."), u += y.toString());
6
+ for (const _ of o)
7
+ typeof _ == "number" ? u += `[${_}]` : (u.length > 0 && (u += "."), u += _.toString());
8
8
  return u;
9
9
  }
10
10
  t.toStringPath = e;
11
- function i(f) {
12
- const a = [];
11
+ function i(l) {
12
+ const o = [];
13
13
  let u = 0;
14
- for (; u < f.length; ) {
15
- const y = f[u];
16
- if (y === ".") {
14
+ for (; u < l.length; ) {
15
+ const _ = l[u];
16
+ if (_ === ".") {
17
17
  u++;
18
18
  continue;
19
19
  }
20
- if (y === "[") {
20
+ if (_ === "[") {
21
21
  u++;
22
22
  let V = "";
23
- for (; u < f.length && f[u] !== "]"; )
24
- V += f[u], u++;
23
+ for (; u < l.length && l[u] !== "]"; )
24
+ V += l[u], u++;
25
25
  if (u++, !V || !/^\d+$/.test(V))
26
- throw new Error(`Invalid array index in path: ${f}`);
27
- a.push(Number(V));
26
+ throw new Error(`Invalid array index in path: ${l}`);
27
+ o.push(Number(V));
28
28
  continue;
29
29
  }
30
30
  let S = "";
31
- for (; u < f.length && /[^\.\[]/.test(f[u]); )
32
- S += f[u], u++;
33
- S && a.push(S);
31
+ for (; u < l.length && /[^\.\[]/.test(l[u]); )
32
+ S += l[u], u++;
33
+ S && o.push(S);
34
34
  }
35
- return a;
35
+ return o;
36
36
  }
37
37
  t.fromStringPath = i;
38
- function r(f) {
39
- return f?.map((a) => {
40
- if (typeof a == "string" || typeof a == "number" || typeof a == "symbol") return a;
41
- if (typeof a == "object" && "key" in a)
42
- return typeof a == "string" || typeof a == "number" || typeof a == "symbol" ? a : a.key;
38
+ function r(l) {
39
+ return l?.map((o) => {
40
+ if (typeof o == "string" || typeof o == "number" || typeof o == "symbol") return o;
41
+ if (typeof o == "object" && "key" in o)
42
+ return typeof o == "string" || typeof o == "number" || typeof o == "symbol" ? o : o.key;
43
43
  });
44
44
  }
45
45
  t.normalize = r;
46
- function n(f, a) {
47
- if (f === a) return !0;
48
- if (f == null || a == null || f.length !== a.length) return !1;
49
- for (let u = 0; u < f.length; u++)
50
- if (f[u] !== a[u]) return !1;
46
+ function n(l, o) {
47
+ if (l === o) return !0;
48
+ if (l == null || o == null || l.length !== o.length) return !1;
49
+ for (let u = 0; u < l.length; u++)
50
+ if (l[u] !== o[u]) return !1;
51
51
  return !0;
52
52
  }
53
53
  t.equals = n;
54
- function s(f, a) {
55
- if (f.length >= a.length) return !1;
56
- for (let u = 0; u < f.length; u++)
57
- if (f[u] !== a[u])
54
+ function s(l, o) {
55
+ if (l.length >= o.length) return !1;
56
+ for (let u = 0; u < l.length; u++)
57
+ if (l[u] !== o[u])
58
58
  return !1;
59
59
  return !0;
60
60
  }
61
61
  t.isDescendant = s;
62
- function o(f, a, u) {
63
- let y = f;
64
- for (let V = 0; V < a.length - 1; V++) {
65
- const Q = a[V], Ot = a[V + 1];
66
- if (y[Q] == null) {
62
+ function a(l, o, u) {
63
+ let _ = l;
64
+ for (let V = 0; V < o.length - 1; V++) {
65
+ const Q = o[V], Ot = o[V + 1];
66
+ if (_[Q] == null) {
67
67
  if (u?.returnOnEmptyBranch) return { target: null, key: null };
68
- y[Q] = typeof Ot == "number" ? [] : {};
68
+ _[Q] = typeof Ot == "number" ? [] : {};
69
69
  }
70
- y = y[Q];
70
+ _ = _[Q];
71
71
  }
72
- const S = a[a.length - 1];
72
+ const S = o[o.length - 1];
73
73
  return {
74
- target: y,
74
+ target: _,
75
75
  key: S
76
76
  };
77
77
  }
78
- t.walkPath = o;
79
- function l(f, a) {
80
- let u = f;
81
- for (const y of a) {
78
+ t.walkPath = a;
79
+ function f(l, o) {
80
+ let u = l;
81
+ for (const _ of o) {
82
82
  if (u == null) return;
83
- u = u[y];
83
+ u = u[_];
84
84
  }
85
85
  return u;
86
86
  }
87
- t.getValue = l;
88
- function d(f, a, u) {
89
- const { target: y, key: S } = o(f, a);
90
- y[S] = u;
87
+ t.getValue = f;
88
+ function d(l, o, u) {
89
+ const { target: _, key: S } = a(l, o);
90
+ _[S] = u;
91
91
  }
92
92
  t.setValue = d;
93
- function c(f, a, u) {
94
- const { target: y, key: S } = o(f, a);
95
- u(y[S]);
93
+ function c(l, o, u) {
94
+ const { target: _, key: S } = a(l, o);
95
+ u(_[S]);
96
96
  }
97
97
  t.modifyValue = c;
98
- function _(f, a) {
99
- const { target: u, key: y } = o(f, a, {
98
+ function y(l, o) {
99
+ const { target: u, key: _ } = a(l, o, {
100
100
  returnOnEmptyBranch: !0
101
101
  });
102
- y != null && delete u[y];
102
+ _ != null && delete u[_];
103
103
  }
104
- t.deleteValue = _;
104
+ t.deleteValue = y;
105
105
  })(h || (h = {}));
106
106
  const dt = /* @__PURE__ */ Symbol("PathResolver");
107
107
  class R {
@@ -154,24 +154,24 @@ var v;
154
154
  }
155
155
  if (Object.getPrototypeOf(r) !== Object.getPrototypeOf(n))
156
156
  return !1;
157
- const o = Object.keys(r), l = Object.keys(n);
158
- if (o.length !== l.length) return !1;
159
- for (const d of o)
157
+ const a = Object.keys(r), f = Object.keys(n);
158
+ if (a.length !== f.length) return !1;
159
+ for (const d of a)
160
160
  if (!Object.prototype.hasOwnProperty.call(n, d) || !e(r[d], n[d])) return !1;
161
161
  return !0;
162
162
  }
163
163
  t.deepEqual = e;
164
- function i(r, n, s, o) {
165
- const l = [], d = [], c = [];
166
- for (const _ of n)
167
- r.some((f) => s(f, _)) ? (o?.(_) ?? !0) && c.push(_) : (o?.(_) ?? !0) && l.push(_);
168
- for (const _ of r)
169
- n.some((f) => s(_, f)) || (o?.(_) ?? !0) && d.push(_);
170
- return { added: l, removed: d, unchanged: c };
164
+ function i(r, n, s) {
165
+ const a = [], f = [], d = [], c = (l, o) => s?.equals ? s.equals(l, o) : l === o, y = (l) => s?.include ? s.include(l) : !0;
166
+ for (const l of n)
167
+ r.some((o) => c(o, l)) ? y(l) && d.push(l) : y(l) && a.push(l);
168
+ for (const l of r)
169
+ n.some((o) => c(l, o)) || y(l) && f.push(l);
170
+ return { added: a, removed: f, unchanged: d };
171
171
  }
172
172
  t.arrayDiff = i;
173
173
  })(v || (v = {}));
174
- var Vt = /* @__PURE__ */ Symbol.for("immer-nothing"), x = /* @__PURE__ */ Symbol.for("immer-draftable"), g = /* @__PURE__ */ Symbol.for("immer-state"), It = process.env.NODE_ENV !== "production" ? [
174
+ var Vt = /* @__PURE__ */ Symbol.for("immer-nothing"), q = /* @__PURE__ */ Symbol.for("immer-draftable"), g = /* @__PURE__ */ Symbol.for("immer-state"), It = process.env.NODE_ENV !== "production" ? [
175
175
  // All error codes, starting by 0:
176
176
  function(t) {
177
177
  return `The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`;
@@ -211,18 +211,18 @@ function m(t, ...e) {
211
211
  `[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`
212
212
  );
213
213
  }
214
- var p = Object, F = p.getPrototypeOf, U = "constructor", W = "prototype", et = "configurable", q = "enumerable", A = "writable", z = "value", w = (t) => !!t && !!t[g];
214
+ var p = Object, b = p.getPrototypeOf, x = "constructor", W = "prototype", et = "configurable", U = "enumerable", A = "writable", z = "value", w = (t) => !!t && !!t[g];
215
215
  function P(t) {
216
- return t ? Dt(t) || K(t) || !!t[x] || !!t[U]?.[x] || H(t) || Y(t) : !1;
216
+ return t ? Dt(t) || K(t) || !!t[q] || !!t[x]?.[q] || H(t) || Y(t) : !1;
217
217
  }
218
- var Tt = p[W][U].toString(), ht = /* @__PURE__ */ new WeakMap();
218
+ var Tt = p[W][x].toString(), ht = /* @__PURE__ */ new WeakMap();
219
219
  function Dt(t) {
220
- if (!t || !lt(t))
220
+ if (!t || !ut(t))
221
221
  return !1;
222
- const e = F(t);
222
+ const e = b(t);
223
223
  if (e === null || e === p[W])
224
224
  return !0;
225
- const i = p.hasOwnProperty.call(e, U) && e[U];
225
+ const i = p.hasOwnProperty.call(e, x) && e[x];
226
226
  if (i === Object)
227
227
  return !0;
228
228
  if (!E(i))
@@ -248,7 +248,7 @@ var _t = (t, e, i = I(t)) => i === 2 ? t.has(e) : p[W].hasOwnProperty.call(t, e)
248
248
  function At(t, e) {
249
249
  return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
250
250
  }
251
- var K = Array.isArray, H = (t) => t instanceof Map, Y = (t) => t instanceof Set, lt = (t) => typeof t == "object", E = (t) => typeof t == "function", Z = (t) => typeof t == "boolean";
251
+ var K = Array.isArray, H = (t) => t instanceof Map, Y = (t) => t instanceof Set, ut = (t) => typeof t == "object", E = (t) => typeof t == "function", Z = (t) => typeof t == "boolean";
252
252
  function Mt(t) {
253
253
  const e = +t;
254
254
  return Number.isInteger(e) && String(e) === t;
@@ -267,18 +267,18 @@ function rt(t, e) {
267
267
  delete r[g];
268
268
  let n = Reflect.ownKeys(r);
269
269
  for (let s = 0; s < n.length; s++) {
270
- const o = n[s], l = r[o];
271
- l[A] === !1 && (l[A] = !0, l[et] = !0), (l.get || l.set) && (r[o] = {
270
+ const a = n[s], f = r[a];
271
+ f[A] === !1 && (f[A] = !0, f[et] = !0), (f.get || f.set) && (r[a] = {
272
272
  [et]: !0,
273
273
  [A]: !0,
274
274
  // could live with !!desc.set as well here...
275
- [q]: l[q],
276
- [z]: t[o]
275
+ [U]: f[U],
276
+ [z]: t[a]
277
277
  });
278
278
  }
279
- return p.create(F(t), r);
279
+ return p.create(b(t), r);
280
280
  } else {
281
- const r = F(t);
281
+ const r = b(t);
282
282
  if (r !== null && i)
283
283
  return { ...t };
284
284
  const n = p.create(r);
@@ -306,7 +306,7 @@ var T = {
306
306
  [z]: Nt
307
307
  };
308
308
  function X(t) {
309
- return t === null || !lt(t) ? !0 : p.isFrozen(t);
309
+ return t === null || !ut(t) ? !0 : p.isFrozen(t);
310
310
  }
311
311
  var j = "MapSet", nt = "Patches", yt = "ArrayMethods", Pt = {};
312
312
  function k(t) {
@@ -330,13 +330,13 @@ function mt(t, e) {
330
330
  e && (t.patchPlugin_ = k(nt), t.patches_ = [], t.inversePatches_ = [], t.patchListener_ = e);
331
331
  }
332
332
  function st(t) {
333
- ot(t), t.drafts_.forEach(xt), t.drafts_ = null;
333
+ at(t), t.drafts_.forEach(qt), t.drafts_ = null;
334
334
  }
335
- function ot(t) {
335
+ function at(t) {
336
336
  t === C && (C = t.parent_);
337
337
  }
338
338
  var pt = (t) => C = Rt(C, t);
339
- function xt(t) {
339
+ function qt(t) {
340
340
  const e = t[g];
341
341
  e.type_ === 0 || e.type_ === 1 ? e.revoke_() : e.revoked_ = !0;
342
342
  }
@@ -353,7 +353,7 @@ function vt(t, e) {
353
353
  );
354
354
  } else
355
355
  t = St(e, i);
356
- return Ut(e, t, !0), st(e), e.patches_ && e.patchListener_(e.patches_, e.inversePatches_), t !== Vt ? t : void 0;
356
+ return xt(e, t, !0), st(e), e.patches_ && e.patchListener_(e.patches_, e.inversePatches_), t !== Vt ? t : void 0;
357
357
  }
358
358
  function St(t, e) {
359
359
  if (X(e))
@@ -370,17 +370,17 @@ function St(t, e) {
370
370
  if (r)
371
371
  for (; r.length > 0; )
372
372
  r.pop()(t);
373
- bt(i, t);
373
+ Ft(i, t);
374
374
  }
375
375
  return i.copy_;
376
376
  }
377
- function Ut(t, e, i = !1) {
377
+ function xt(t, e, i = !1) {
378
378
  !t.parent_ && t.immer_.autoFreeze_ && t.canAutoFreeze_ && ct(e, i);
379
379
  }
380
380
  function Et(t) {
381
381
  t.finalized_ = !0, t.scope_.unfinalizedDrafts_--;
382
382
  }
383
- var J = (t, e) => t.scope_ === e, qt = [];
383
+ var J = (t, e) => t.scope_ === e, Ut = [];
384
384
  function kt(t, e, i, r) {
385
385
  const n = D(t), s = t.type_;
386
386
  if (r !== void 0 && it(n, r, s) === e) {
@@ -388,17 +388,17 @@ function kt(t, e, i, r) {
388
388
  return;
389
389
  }
390
390
  if (!t.draftLocations_) {
391
- const l = t.draftLocations_ = /* @__PURE__ */ new Map();
391
+ const f = t.draftLocations_ = /* @__PURE__ */ new Map();
392
392
  G(n, (d, c) => {
393
393
  if (w(c)) {
394
- const _ = l.get(c) || [];
395
- _.push(d), l.set(c, _);
394
+ const y = f.get(c) || [];
395
+ y.push(d), f.set(c, y);
396
396
  }
397
397
  });
398
398
  }
399
- const o = t.draftLocations_.get(e) ?? qt;
400
- for (const l of o)
401
- B(n, l, i, s);
399
+ const a = t.draftLocations_.get(e) ?? Ut;
400
+ for (const f of a)
401
+ B(n, f, i, s);
402
402
  }
403
403
  function Bt(t, e, i) {
404
404
  t.callbacks_.push(function(n) {
@@ -406,11 +406,11 @@ function Bt(t, e, i) {
406
406
  if (!s || !J(s, n))
407
407
  return;
408
408
  n.mapSetPlugin_?.fixSetContents(s);
409
- const o = ft(s);
410
- kt(t, s.draft_ ?? s, o, i), bt(s, n);
409
+ const a = ft(s);
410
+ kt(t, s.draft_ ?? s, a, i), Ft(s, n);
411
411
  });
412
412
  }
413
- function bt(t, e) {
413
+ function Ft(t, e) {
414
414
  if (t.modified_ && !t.finalized_ && (t.type_ === 3 || t.type_ === 1 && t.allIndicesReassigned_ || (t.assigned_?.size ?? 0) > 0)) {
415
415
  const { patchPlugin_: r } = e;
416
416
  if (r) {
@@ -426,8 +426,8 @@ function jt(t, e, i) {
426
426
  const n = i[g];
427
427
  J(n, r) && n.callbacks_.push(function() {
428
428
  M(t);
429
- const o = ft(n);
430
- kt(t, i, o, e);
429
+ const a = ft(n);
430
+ kt(t, i, a, e);
431
431
  });
432
432
  } else P(i) && t.callbacks_.push(function() {
433
433
  const s = D(t);
@@ -443,8 +443,8 @@ function $(t, e, i) {
443
443
  if (w(n)) {
444
444
  const s = n[g];
445
445
  if (J(s, i)) {
446
- const o = ft(s);
447
- B(t, r, o, t.type_), Et(s);
446
+ const a = ft(s);
447
+ B(t, r, a, t.type_), Et(s);
448
448
  }
449
449
  } else P(n) && $(n, e, i);
450
450
  })), t;
@@ -478,8 +478,8 @@ function $t(t, e) {
478
478
  };
479
479
  let n = r, s = L;
480
480
  i && (n = [r], s = O);
481
- const { revoke: o, proxy: l } = Proxy.revocable(n, s);
482
- return r.draft_ = l, r.revoke_ = o, [l, r];
481
+ const { revoke: a, proxy: f } = Proxy.revocable(n, s);
482
+ return r.draft_ = f, r.revoke_ = a, [f, r];
483
483
  }
484
484
  var L = {
485
485
  get(t, e) {
@@ -499,8 +499,8 @@ var L = {
499
499
  return s;
500
500
  if (s === tt(t.base_, e)) {
501
501
  M(t);
502
- const o = t.type_ === 1 ? +e : e, l = ut(t.scope_, s, t, o);
503
- return t.copy_[o] = l;
502
+ const a = t.type_ === 1 ? +e : e, f = lt(t.scope_, s, t, a);
503
+ return t.copy_[a] = f;
504
504
  }
505
505
  return s;
506
506
  },
@@ -511,7 +511,7 @@ var L = {
511
511
  return Reflect.ownKeys(D(t));
512
512
  },
513
513
  set(t, e, i) {
514
- const r = Ft(D(t), e);
514
+ const r = bt(D(t), e);
515
515
  if (r?.set)
516
516
  return r.set.call(t.draft_, i), !0;
517
517
  if (!t.modified_) {
@@ -520,14 +520,14 @@ var L = {
520
520
  return t.copy_[e] = i, t.assigned_.set(e, !1), !0;
521
521
  if (At(i, n) && (i !== void 0 || _t(t.base_, e, t.type_)))
522
522
  return !0;
523
- M(t), at(t);
523
+ M(t), ot(t);
524
524
  }
525
525
  return t.copy_[e] === i && // special case: handle new props with value 'undefined'
526
526
  (i !== void 0 || e in t.copy_) || // special case: NaN
527
527
  Number.isNaN(i) && Number.isNaN(t.copy_[e]) || (t.copy_[e] = i, t.assigned_.set(e, !0), jt(t, e, i)), !0;
528
528
  },
529
529
  deleteProperty(t, e) {
530
- return M(t), tt(t.base_, e) !== void 0 || e in t.base_ ? (t.assigned_.set(e, !1), at(t)) : t.assigned_.delete(e), t.copy_ && delete t.copy_[e], !0;
530
+ return M(t), tt(t.base_, e) !== void 0 || e in t.base_ ? (t.assigned_.set(e, !1), ot(t)) : t.assigned_.delete(e), t.copy_ && delete t.copy_[e], !0;
531
531
  },
532
532
  // Note: We never coerce `desc.value` into an Immer draft, because we can't make
533
533
  // the same guarantee in ES5 mode.
@@ -536,7 +536,7 @@ var L = {
536
536
  return r && {
537
537
  [A]: !0,
538
538
  [et]: t.type_ !== 1 || e !== "length",
539
- [q]: r[q],
539
+ [U]: r[U],
540
540
  [z]: i[e]
541
541
  };
542
542
  },
@@ -544,7 +544,7 @@ var L = {
544
544
  m(11);
545
545
  },
546
546
  getPrototypeOf(t) {
547
- return F(t.base_);
547
+ return b(t.base_);
548
548
  },
549
549
  setPrototypeOf() {
550
550
  m(12);
@@ -568,26 +568,26 @@ function tt(t, e) {
568
568
  return (i ? D(i) : t)[e];
569
569
  }
570
570
  function Lt(t, e, i) {
571
- const r = Ft(e, i);
571
+ const r = bt(e, i);
572
572
  return r ? z in r ? r[z] : (
573
573
  // This is a very special case, if the prop is a getter defined by the
574
574
  // prototype, we should invoke it with the draft as context!
575
575
  r.get?.call(t.draft_)
576
576
  ) : void 0;
577
577
  }
578
- function Ft(t, e) {
578
+ function bt(t, e) {
579
579
  if (!(e in t))
580
580
  return;
581
- let i = F(t);
581
+ let i = b(t);
582
582
  for (; i; ) {
583
583
  const r = Object.getOwnPropertyDescriptor(i, e);
584
584
  if (r)
585
585
  return r;
586
- i = F(i);
586
+ i = b(i);
587
587
  }
588
588
  }
589
- function at(t) {
590
- t.modified_ || (t.modified_ = !0, t.parent_ && at(t.parent_));
589
+ function ot(t) {
590
+ t.modified_ || (t.modified_ = !0, t.parent_ && ot(t.parent_));
591
591
  }
592
592
  function M(t) {
593
593
  t.copy_ || (t.assigned_ = /* @__PURE__ */ new Map(), t.copy_ = rt(
@@ -601,46 +601,46 @@ var Wt = class {
601
601
  if (E(e) && !E(i)) {
602
602
  const s = i;
603
603
  i = e;
604
- const o = this;
604
+ const a = this;
605
605
  return function(d = s, ...c) {
606
- return o.produce(d, (_) => i.call(this, _, ...c));
606
+ return a.produce(d, (y) => i.call(this, y, ...c));
607
607
  };
608
608
  }
609
609
  E(i) || m(6), r !== void 0 && !E(r) && m(7);
610
610
  let n;
611
611
  if (P(e)) {
612
- const s = pt(this), o = ut(s, e, void 0);
613
- let l = !0;
612
+ const s = pt(this), a = lt(s, e, void 0);
613
+ let f = !0;
614
614
  try {
615
- n = i(o), l = !1;
615
+ n = i(a), f = !1;
616
616
  } finally {
617
- l ? st(s) : ot(s);
617
+ f ? st(s) : at(s);
618
618
  }
619
619
  return mt(s, r), vt(n, s);
620
- } else if (!e || !lt(e)) {
620
+ } else if (!e || !ut(e)) {
621
621
  if (n = i(e), n === void 0 && (n = e), n === Vt && (n = void 0), this.autoFreeze_ && ct(n, !0), r) {
622
- const s = [], o = [];
622
+ const s = [], a = [];
623
623
  k(nt).generateReplacementPatches_(e, n, {
624
624
  patches_: s,
625
- inversePatches_: o
626
- }), r(s, o);
625
+ inversePatches_: a
626
+ }), r(s, a);
627
627
  }
628
628
  return n;
629
629
  } else
630
630
  m(1, e);
631
631
  }, this.produceWithPatches = (e, i) => {
632
632
  if (E(e))
633
- return (o, ...l) => this.produceWithPatches(o, (d) => e(d, ...l));
633
+ return (a, ...f) => this.produceWithPatches(a, (d) => e(d, ...f));
634
634
  let r, n;
635
- return [this.produce(e, i, (o, l) => {
636
- r = o, n = l;
635
+ return [this.produce(e, i, (a, f) => {
636
+ r = a, n = f;
637
637
  }), r, n];
638
638
  }, Z(t?.autoFreeze) && this.setAutoFreeze(t.autoFreeze), Z(t?.useStrictShallowCopy) && this.setUseStrictShallowCopy(t.useStrictShallowCopy), Z(t?.useStrictIteration) && this.setUseStrictIteration(t.useStrictIteration);
639
639
  }
640
640
  createDraft(t) {
641
641
  P(t) || m(8), w(t) && (t = Gt(t));
642
- const e = pt(this), i = ut(e, t, void 0);
643
- return i[g].isManual_ = !0, ot(e), i;
642
+ const e = pt(this), i = lt(e, t, void 0);
643
+ return i[g].isManual_ = !0, at(e), i;
644
644
  }
645
645
  finishDraft(t, e) {
646
646
  const i = t && t[g];
@@ -693,7 +693,7 @@ var Wt = class {
693
693
  );
694
694
  }
695
695
  };
696
- function ut(t, e, i, r) {
696
+ function lt(t, e, i, r) {
697
697
  const [n, s] = H(e) ? k(j).proxyMap_(e, i) : Y(e) ? k(j).proxySet_(e, i) : $t(e, i);
698
698
  return (i?.scope_ ?? wt()).drafts_.push(n), s.callbacks_ = i?.callbacks_ ?? [], s.key_ = r, i && r !== void 0 ? Bt(i, s, r) : s.callbacks_.push(function(d) {
699
699
  d.mapSetPlugin_?.fixSetContents(s);
@@ -723,7 +723,7 @@ function zt(t) {
723
723
  r
724
724
  ), e && (e.finalized_ = !1), i;
725
725
  }
726
- var Kt = new Wt(), b = Kt.produce;
726
+ var Kt = new Wt(), F = Kt.produce;
727
727
  let Ht = () => ({
728
728
  emit(t, ...e) {
729
729
  for (let i = this.events[t] || [], r = 0, n = i.length; r < n; r++)
@@ -744,7 +744,7 @@ function N(t) {
744
744
  const e = Object.getPrototypeOf(t);
745
745
  if (e === Object.prototype || e === null) return;
746
746
  const i = e.constructor;
747
- typeof i == "function" && (t instanceof Date || t instanceof RegExp || t instanceof Map || t instanceof Set || t instanceof WeakMap || t instanceof WeakSet || ArrayBuffer.isView(t) || i[x] !== !0 && (i[x] = !0));
747
+ typeof i == "function" && (t instanceof Date || t instanceof RegExp || t instanceof Map || t instanceof Set || t instanceof WeakMap || t instanceof WeakSet || ArrayBuffer.isView(t) || i[q] !== !0 && (i[q] = !0));
748
748
  }
749
749
  let Yt = 0;
750
750
  function Xt() {
@@ -821,38 +821,40 @@ class Jt {
821
821
  const r = this.controller.getAscendantFields(this.path), n = r.map((c) => c?.initialValue);
822
822
  n.forEach((c) => N(c));
823
823
  const s = r.map((c) => c?.value);
824
- s.forEach((c) => N(c)), this.controller._data = b(this.controller._data, e);
825
- const o = r.map((c) => c?.value);
826
- o.forEach((c) => N(c));
827
- const l = (c, _) => {
828
- if (typeof c != "object" || typeof _ != "object") return;
829
- const f = c.constructor, a = _.constructor;
830
- if (f === a)
831
- return this.controller.equalityComparators?.get(f)?.(c, _);
824
+ s.forEach((c) => N(c)), this.controller._data = F(this.controller._data, e);
825
+ const a = r.map((c) => c?.value);
826
+ a.forEach((c) => N(c));
827
+ const f = (c, y) => {
828
+ if (typeof c != "object" || typeof y != "object") return;
829
+ const l = c.constructor, o = y.constructor;
830
+ if (l === o)
831
+ return this.controller.equalityComparators?.get(l)?.(c, y);
832
832
  };
833
833
  if (!v.deepEqual(
834
834
  s[s.length - 1],
835
- o[o.length - 1],
836
- l
835
+ a[a.length - 1],
836
+ f
837
837
  ))
838
838
  for (let c = r.length - 1; c >= 0; c--) {
839
- const _ = r[c];
839
+ const y = r[c];
840
840
  this.controller.events.emit(
841
841
  "fieldValueChanged",
842
- _.path,
843
- o[c],
842
+ y.path,
843
+ a[c],
844
844
  s[c]
845
845
  );
846
846
  }
847
847
  if (i?.shouldMarkDirty == null || i?.shouldMarkDirty) {
848
848
  const c = !v.deepEqual(
849
849
  n[n.length - 1],
850
- o[o.length - 1],
851
- l
850
+ a[a.length - 1],
851
+ f
852
852
  );
853
853
  this._setDirty(c);
854
854
  }
855
855
  }
856
+ // TODO: impl
857
+ // private modifyInitialData() {}
856
858
  setValue(e, i) {
857
859
  return this.modifyData((r) => {
858
860
  h.setValue(r, this.path, e);
@@ -891,7 +893,7 @@ function Qt(t, e) {
891
893
  }
892
894
  class Zt {
893
895
  constructor(e) {
894
- this._isValidating = !1, this._isSubmitting = !1, this._triedSubmitting = !1, this.pathBuilder = new R(), this._fields = /* @__PURE__ */ new Map(), this._issues = [], this.events = Ht(), this.validationSchema = e.validationSchema, this.equalityComparators = e.equalityComparators, this._initialData = e.initialData ?? {}, this._data = b(this._initialData, () => {
896
+ this._isValidating = !1, this._isSubmitting = !1, this._triedSubmitting = !1, this.pathBuilder = new R(), this._fields = /* @__PURE__ */ new Map(), this._issues = [], this.events = Ht(), this.validationSchema = e.validationSchema, this.equalityComparators = e.equalityComparators, this._initialData = e.initialData ?? {}, this._data = F(this._initialData, () => {
895
897
  });
896
898
  }
897
899
  get data() {
@@ -912,7 +914,7 @@ class Zt {
912
914
  return !1;
913
915
  }
914
916
  get isValid() {
915
- return this._issues.length === 0;
917
+ return this.isValidating || this._issues.length === 0;
916
918
  }
917
919
  get isValidating() {
918
920
  return this._isValidating;
@@ -932,22 +934,22 @@ class Zt {
932
934
  registerField(e, i) {
933
935
  let r = h.getValue(this._data, e);
934
936
  if (r == null && i?.defaultValue != null) {
935
- const l = Ct(i.defaultValue);
936
- N(l), i?.overrideInitialValue === !0 && (this._initialData = b(this._initialData, (d) => {
937
- h.setValue(d, e, l);
938
- })), this._data = b(this._data, (d) => {
939
- h.setValue(d, e, l);
937
+ const f = Ct(i.defaultValue);
938
+ N(f), i?.overrideInitialValue === !0 && (this._initialData = F(this._initialData, (d) => {
939
+ h.setValue(d, e, f);
940
+ })), this._data = F(this._data, (d) => {
941
+ h.setValue(d, e, f);
940
942
  }), r = h.getValue(this._data, e);
941
943
  }
942
- const n = h.getValue(this._initialData, e), s = !v.deepEqual(r, n), o = new Jt(this, e, i?.defaultValue, {
944
+ const n = h.getValue(this._initialData, e), s = !v.deepEqual(r, n), a = new Jt(this, e, i?.defaultValue, {
943
945
  isDirty: s
944
946
  });
945
- return this._fields.set(o.stringPath, o), this.events.emit("fieldRegistered", o.path), s && this.events.emit(
947
+ return this._fields.set(a.stringPath, a), this.events.emit("fieldRegistered", a.path), s && this.events.emit(
946
948
  "fieldValueChanged",
947
- o.path,
949
+ a.path,
948
950
  r,
949
951
  n
950
- ), o;
952
+ ), a;
951
953
  }
952
954
  unregisterField(e) {
953
955
  const i = h.toStringPath(e);
@@ -956,13 +958,13 @@ class Zt {
956
958
  reset(e) {
957
959
  const i = e ?? this._initialData, r = [];
958
960
  for (const n of this._fields.values()) {
959
- const s = h.getValue(this._data, n.path), o = h.getValue(i, n.path);
960
- v.deepEqual(s, o) || r.push([n.path, o, s]), n.reset();
961
+ const s = h.getValue(this._data, n.path), a = h.getValue(i, n.path);
962
+ v.deepEqual(s, a) || r.push([n.path, a, s]), n.reset();
961
963
  }
962
- e != null && (this._initialData = b(e, () => {
963
- })), this._data = b(i, () => {
964
- }), this._issues = [], this._triedSubmitting = !1, r.forEach(([n, s, o]) => {
965
- this.events.emit("fieldValueChanged", n, s, o);
964
+ e != null && (this._initialData = F(e, () => {
965
+ })), this._data = F(i, () => {
966
+ }), this._issues = [], this._triedSubmitting = !1, r.forEach(([n, s, a]) => {
967
+ this.events.emit("fieldValueChanged", n, s, a);
966
968
  });
967
969
  }
968
970
  // TODO: resetGracefully(newInitialData?: DeepPartial<TOutput>)
@@ -981,16 +983,14 @@ class Zt {
981
983
  this._issues = this._issues.filter((i) => !h.equals(h.normalize(i.path), e));
982
984
  }
983
985
  async applyValidation(e, i) {
984
- const r = v.arrayDiff(
985
- this._issues,
986
- e.issues ?? [],
987
- v.deepEqual,
988
- (n) => {
986
+ const r = v.arrayDiff(this._issues, e.issues ?? [], {
987
+ equals: v.deepEqual,
988
+ include: (n) => {
989
989
  if (n.path == null) return !1;
990
990
  const s = h.normalize(n.path);
991
991
  return h.equals(s, i) || h.isDescendant(i, s);
992
992
  }
993
- );
993
+ });
994
994
  Qt(this._issues, (n) => r.removed.includes(n)), r.added.forEach((n) => this._issues.push(n)), (r.added.length !== 0 || r.removed.length !== 0) && this.events.emit("fieldIssuesUpdated", i);
995
995
  }
996
996
  async validateForm() {
@@ -1003,11 +1003,9 @@ class Zt {
1003
1003
  const n = h.fromStringPath(r);
1004
1004
  this.events.emit("fieldValidationTriggered", n), this.applyValidation(e, n);
1005
1005
  }
1006
- v.arrayDiff(
1007
- this._issues,
1008
- e.issues ?? [],
1009
- v.deepEqual
1010
- ).added.forEach((r) => this._issues.push(r)), this.setValidating(!1);
1006
+ v.arrayDiff(this._issues, e.issues ?? [], {
1007
+ equals: v.deepEqual
1008
+ }).added.forEach((r) => this._issues.push(r)), this.setValidating(!1);
1011
1009
  }
1012
1010
  async validateField(e) {
1013
1011
  if (this._isValidating || this.validationSchema == null) return;
@@ -1026,9 +1024,9 @@ class Zt {
1026
1024
  }
1027
1025
  for (const n of this._issues) {
1028
1026
  if (n.path == null) continue;
1029
- const s = h.normalize(n.path), o = this.getField(s);
1030
- if (o != null && o.boundElement != null) {
1031
- o.focus();
1027
+ const s = h.normalize(n.path), a = this.getField(s);
1028
+ if (a != null && a.boundElement != null) {
1029
+ a.focus();
1032
1030
  break;
1033
1031
  }
1034
1032
  }