@jfdevelops/react-multi-step-form 1.0.0-alpha.11 → 1.0.0-alpha.14

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.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  import { jsx as Te, jsxs as ie } from "react/jsx-runtime";
2
2
  import R from "react";
3
3
  function M(o, e, t) {
4
- const r = [], s = new Set(o), n = t ? t.format(o.map((u) => `${u}`)) : `[${o.join(", ")}]`;
5
- for (let u = 0; u < e.length; u++) {
6
- const S = e[u];
4
+ const r = [], s = new Set(o), n = t ? t.format(o.map((c) => `${c}`)) : `[${o.join(", ")}]`;
5
+ for (let c = 0; c < e.length; c++) {
6
+ const S = e[c];
7
7
  s.has(S) || r.push(
8
- `Extra element at index ${u}: "${S}" is not in ${n}`
8
+ `Extra element at index ${c}: "${S}" is not in ${n}`
9
9
  );
10
10
  }
11
- return e.some((u) => s.has(u)) || r.push(
11
+ return e.some((c) => s.has(c)) || r.push(
12
12
  `Array must contain at least one valid element from ${n}`
13
13
  ), r.length > 0 ? { status: "error", errors: r } : { status: "success" };
14
14
  }
@@ -23,7 +23,7 @@ function ae(o) {
23
23
  function Ae(o, ...e) {
24
24
  return () => String.raw({ raw: o }, ...e);
25
25
  }
26
- function E(o, e, t = Error) {
26
+ function _(o, e, t = Error) {
27
27
  if (!o) {
28
28
  const r = new Intl.ListFormat("en", {
29
29
  style: "long",
@@ -33,9 +33,9 @@ function E(o, e, t = Error) {
33
33
  }
34
34
  }
35
35
  function q(o) {
36
- E(o.includes("step"), "Can't extract a valid step number since");
36
+ _(o.includes("step"), "Can't extract a valid step number since");
37
37
  const e = o.replace("step", "");
38
- return E(/^\d+$/.test(e), `Invalid step format: "${o}"`), Number.parseInt(e, 10);
38
+ return _(/^\d+$/.test(e), `Invalid step format: "${o}"`), Number.parseInt(e, 10);
39
39
  }
40
40
  function ee(o) {
41
41
  return function(e) {
@@ -48,12 +48,12 @@ function K(o, e) {
48
48
  const s = q(r), { data: n } = ee(o)({
49
49
  step: s
50
50
  });
51
- for (const [a, u] of Object.entries(n))
52
- typeof u == "function" && a !== "update" || (n[a] = u);
51
+ for (const [a, c] of Object.entries(n))
52
+ typeof c == "function" && a !== "update" || (n[a] = c);
53
53
  return t[r] = n, t;
54
54
  }, {});
55
55
  }
56
- function L(o, e) {
56
+ function k(o, e) {
57
57
  const t = new Intl.ListFormat("en", {
58
58
  style: "long",
59
59
  type: "disjunction"
@@ -75,7 +75,7 @@ function L(o, e) {
75
75
  );
76
76
  }
77
77
  if (Array.isArray(e))
78
- return E(
78
+ return _(
79
79
  e.every((n) => r.includes(n)),
80
80
  () => {
81
81
  const n = M(
@@ -94,7 +94,7 @@ function L(o, e) {
94
94
  );
95
95
  if (typeof e == "object") {
96
96
  const n = Object.keys(e);
97
- return E(
97
+ return _(
98
98
  n.every((a) => r.includes(a)),
99
99
  () => {
100
100
  const a = M(
@@ -170,10 +170,10 @@ class te {
170
170
  includeTimestamp: s = this.includeTimestamp,
171
171
  prefix: n,
172
172
  logLevelOptions: a
173
- } = r ?? {}, u = this.formatPrefix(n), S = this.wrapValue(
173
+ } = r ?? {}, c = this.formatPrefix(n), S = this.wrapValue(
174
174
  a?.wrapWith ?? "[]",
175
175
  (a?.level ?? e).toUpperCase()
176
- ), g = `${u} ${S} ${t}`;
176
+ ), g = `${c} ${S} ${t}`;
177
177
  return s ? `[${(/* @__PURE__ */ new Date()).toISOString()}] ${g}` : g;
178
178
  }
179
179
  info(e, t) {
@@ -193,47 +193,53 @@ class te {
193
193
  var V;
194
194
  ((o) => {
195
195
  function e(i, l) {
196
- return l.split(".").reduce((d, c) => d?.[c], i);
197
- }
198
- function t(i, l, d) {
199
- const c = l.split(".");
200
- let m = i;
201
- for (let _ = 0; _ < c.length; _++) {
202
- const $ = c[_];
203
- _ === c.length - 1 ? m[$] !== void 0 && typeof m[$] == "object" && typeof d == "object" && d !== null ? Object.assign(m[$], d) : m[$] = d : ((typeof m[$] != "object" || m[$] === null) && (m[$] = {}), m = m[$]);
196
+ return l.split(".").reduce((h, u) => h?.[u], i);
197
+ }
198
+ function t(i, l, h) {
199
+ const u = l.split(".");
200
+ let d = i;
201
+ for (let E = 0; E < u.length; E++) {
202
+ const $ = u[E];
203
+ E === u.length - 1 ? d[$] !== void 0 && typeof d[$] == "object" && typeof h == "object" && h !== null ? Object.assign(d[$], h) : d[$] = h : ((typeof d[$] != "object" || d[$] === null) && (d[$] = {}), d = d[$]);
204
204
  }
205
- return m;
205
+ return d;
206
206
  }
207
207
  o.setBy = t;
208
- function r(i) {
209
- return i.filter((l) => !i.some((d) => d !== l && l.startsWith(d + ".")));
210
- }
208
+ function r(...i) {
209
+ const l = [...i].sort(
210
+ (u, d) => d.split(".").length - u.split(".").length
211
+ ), h = [];
212
+ for (const u of l)
213
+ h.some((E) => E.startsWith(u + ".")) || h.push(u);
214
+ return h.reverse();
215
+ }
216
+ o.normalizePaths = r;
211
217
  function s(i, ...l) {
212
- const d = r(l);
213
- if (d.length === 1)
214
- return e(i, d[0]);
215
- const c = {};
216
- for (const m of d) {
217
- const _ = e(i, m);
218
- t(c, m, _);
218
+ const h = r(...l);
219
+ if (h.length === 1)
220
+ return e(i, h[0]);
221
+ const u = {};
222
+ for (const d of h) {
223
+ const E = e(i, d);
224
+ t(u, d, E);
219
225
  }
220
- return c;
226
+ return u;
221
227
  }
222
228
  o.pickBy = s;
223
229
  function n(i) {
224
230
  const l = [];
225
- function d(c, m = "") {
226
- if (c == null || typeof c != "object" || Array.isArray(c))
231
+ function h(u, d = "") {
232
+ if (u == null || typeof u != "object" || Array.isArray(u))
227
233
  return;
228
- const _ = Object.keys(c);
229
- for (const $ of _) {
230
- const A = m ? `${m}.${$}` : $;
234
+ const E = Object.keys(u);
235
+ for (const $ of E) {
236
+ const A = d ? `${d}.${$}` : $;
231
237
  l.push(A);
232
- const T = c[$];
233
- T != null && typeof T == "object" && !Array.isArray(T) && d(T, A);
238
+ const T = u[$];
239
+ T != null && typeof T == "object" && !Array.isArray(T) && h(T, A);
234
240
  }
235
241
  }
236
- return d(i), l;
242
+ return h(i), l;
237
243
  }
238
244
  o.createDeep = n;
239
245
  function a(i) {
@@ -241,124 +247,124 @@ var V;
241
247
  if (Array.isArray(i)) return "Array";
242
248
  const l = typeof i;
243
249
  if (l !== "object") return l;
244
- const d = i?.constructor?.name;
245
- return d && d !== "Object" ? d : "object";
250
+ const h = i?.constructor?.name;
251
+ return h && h !== "Object" ? h : "object";
246
252
  }
247
- function u(i) {
253
+ function c(i) {
248
254
  if (!i) return [];
249
- const l = [], d = /[^.[\]]+|\[(\d+)\]/g;
250
- let c;
251
- for (; c = d.exec(i); )
252
- l.push(c[1] ?? c[0]);
255
+ const l = [], h = /[^.[\]]+|\[(\d+)\]/g;
256
+ let u;
257
+ for (; u = h.exec(i); )
258
+ l.push(u[1] ?? u[0]);
253
259
  return l;
254
260
  }
255
261
  function S(i, l) {
256
262
  if (!i) return;
257
263
  if (typeof i == "function")
258
264
  return i;
259
- const d = u(l);
260
- let c = i, m;
261
- for (const _ of d) {
262
- if (!c) break;
263
- if (typeof c == "function") {
264
- m = c;
265
+ const h = c(l);
266
+ let u = i, d;
267
+ for (const E of h) {
268
+ if (!u) break;
269
+ if (typeof u == "function") {
270
+ d = u;
265
271
  break;
266
272
  }
267
- if (c = c[_], typeof c == "function") {
268
- m = c;
273
+ if (u = u[E], typeof u == "function") {
274
+ d = u;
269
275
  break;
270
276
  }
271
277
  }
272
- return m;
278
+ return d;
273
279
  }
274
- function g(i, l, d) {
275
- const c = S(d, l);
276
- return c ? c(i, l) : a(i);
280
+ function g(i, l, h) {
281
+ const u = S(h, l);
282
+ return u ? u(i, l) : a(i);
277
283
  }
278
284
  function p(i) {
279
285
  return typeof i == "object" && i !== null;
280
286
  }
281
- function f(i, l, d, c, m) {
287
+ function f(i, l, h, u, d) {
282
288
  if (i === l)
283
- return c;
289
+ return u;
284
290
  if (i === null || l === null || typeof i != "object" || typeof l != "object") {
285
- const $ = d || "(root)";
286
- return typeof i != typeof l ? (c.push({
291
+ const $ = h || "(root)";
292
+ return typeof i != typeof l ? (u.push({
287
293
  path: $,
288
- expected: g(i, $, m.transformExpected),
294
+ expected: g(i, $, d.transformExpected),
289
295
  actual: l,
290
296
  reason: "type-mismatch"
291
- }), c) : (m.includeValueMismatch && c.push({
297
+ }), u) : (d.includeValueMismatch && u.push({
292
298
  path: $,
293
- expected: g(i, $, m.transformExpected),
299
+ expected: g(i, $, d.transformExpected),
294
300
  actual: l,
295
301
  reason: "value-mismatch"
296
- }), c);
302
+ }), u);
297
303
  }
298
304
  if (Array.isArray(i) || Array.isArray(l)) {
299
305
  if (!Array.isArray(i) || !Array.isArray(l)) {
300
- const A = d || "(root)";
301
- return c.push({
306
+ const A = h || "(root)";
307
+ return u.push({
302
308
  path: A,
303
- expected: g(i, A, m.transformExpected),
309
+ expected: g(i, A, d.transformExpected),
304
310
  actual: l,
305
311
  reason: "type-mismatch"
306
- }), c;
312
+ }), u;
307
313
  }
308
314
  const $ = i.length;
309
315
  for (let A = 0; A < $; A++) {
310
- const T = i[A], C = l[A], N = d === "" ? `[${A}]` : `${d}[${A}]`;
311
- f(T, C, N, c, m);
316
+ const T = i[A], C = l[A], N = h === "" ? `[${A}]` : `${h}[${A}]`;
317
+ f(T, C, N, u, d);
312
318
  }
313
- return c;
319
+ return u;
314
320
  }
315
321
  if (p(i) && p(l)) {
316
322
  const $ = Object.keys(i), A = Object.keys(l);
317
323
  for (const T of $) {
318
- const C = i[T], N = l[T], F = d ? `${d}.${T}` : T;
324
+ const C = i[T], N = l[T], F = h ? `${h}.${T}` : T;
319
325
  if (!(T in l)) {
320
- c.push({
326
+ u.push({
321
327
  path: F,
322
- expected: g(C, F, m.transformExpected),
328
+ expected: g(C, F, d.transformExpected),
323
329
  actual: void 0,
324
330
  reason: "missing-key"
325
331
  });
326
332
  continue;
327
333
  }
328
- f(C, N, F, c, m);
334
+ f(C, N, F, u, d);
329
335
  }
330
336
  for (const T of A)
331
337
  if (!(T in i)) {
332
- const C = d ? `${d}.${T}` : T;
333
- c.push({
338
+ const C = h ? `${h}.${T}` : T;
339
+ u.push({
334
340
  path: C,
335
341
  expected: void 0,
336
342
  actual: l[T],
337
343
  reason: "extra-key"
338
344
  });
339
345
  }
340
- return c;
346
+ return u;
341
347
  }
342
- const _ = d || "(root)";
343
- return typeof i != typeof l ? c.push({
344
- path: _,
345
- expected: g(i, _, m.transformExpected),
348
+ const E = h || "(root)";
349
+ return typeof i != typeof l ? u.push({
350
+ path: E,
351
+ expected: g(i, E, d.transformExpected),
346
352
  actual: l,
347
353
  reason: "type-mismatch"
348
- }) : m.includeValueMismatch && c.push({
349
- path: _,
350
- expected: g(i, _, m.transformExpected),
354
+ }) : d.includeValueMismatch && u.push({
355
+ path: E,
356
+ expected: g(i, E, d.transformExpected),
351
357
  actual: l,
352
358
  reason: "value-mismatch"
353
- }), c;
359
+ }), u;
354
360
  }
355
- function v(i, l, d, c) {
356
- const m = s(i, ...l), _ = [], $ = l.length === 1 ? l[0] : "";
357
- return f(m, d, $, _, {
358
- transformExpected: c?.transformExpected
361
+ function v(i, l, h, u) {
362
+ const d = s(i, ...l), E = [], $ = l.length === 1 ? l[0] : "";
363
+ return f(d, h, $, E, {
364
+ transformExpected: u?.transformExpected
359
365
  }), {
360
- ok: _.length === 0,
361
- mismatches: _
366
+ ok: E.length === 0,
367
+ mismatches: E
362
368
  };
363
369
  }
364
370
  o.equalsAtPaths = v;
@@ -371,7 +377,7 @@ var V;
371
377
  return String(i);
372
378
  }
373
379
  }
374
- function h(i) {
380
+ function m(i) {
375
381
  switch (i.reason) {
376
382
  case "missing-key":
377
383
  return "Missing key";
@@ -389,12 +395,12 @@ var V;
389
395
  if (i.ok || i.mismatches.length === 0)
390
396
  return "No mismatches.";
391
397
  const l = [];
392
- for (const d of i.mismatches)
398
+ for (const h of i.mismatches)
393
399
  l.push(
394
400
  `
395
- ● ${h(d)} at "${d.path}":`,
396
- ` expected: ${y(d.expected)}`,
397
- ` actual: ${y(d.actual)}`,
401
+ ● ${m(h)} at "${h.path}":`,
402
+ ` expected: ${y(h.expected)}`,
403
+ ` actual: ${y(h.actual)}`,
398
404
  ""
399
405
  // blank line between entries
400
406
  );
@@ -407,39 +413,39 @@ var V;
407
413
  l !== "No mismatches." && console.error(l);
408
414
  }
409
415
  o.printMismatches = O;
410
- function w(i, l, d) {
411
- const c = l.split(".");
412
- function m(_, $) {
413
- const A = c[$], T = Array.isArray(_) ? [..._] : { ..._ };
414
- if ($ === c.length - 1) {
415
- let P = _ && typeof _ == "object" ? T : {};
416
+ function w(i, l, h) {
417
+ const u = l.split(".");
418
+ function d(E, $) {
419
+ const A = u[$], T = Array.isArray(E) ? [...E] : { ...E };
420
+ if ($ === u.length - 1) {
421
+ let P = E && typeof E == "object" ? T : {};
416
422
  return P = {
417
423
  ...P,
418
- [A]: d
424
+ [A]: h
419
425
  }, P;
420
426
  }
421
- const C = _ && typeof _ == "object" ? _[A] : void 0, N = m(C ?? {}, $ + 1);
422
- let F = _ && typeof _ == "object" ? T : {};
427
+ const C = E && typeof E == "object" ? E[A] : void 0, N = d(C ?? {}, $ + 1);
428
+ let F = E && typeof E == "object" ? T : {};
423
429
  return F = {
424
430
  ...F,
425
431
  [A]: N
426
432
  }, F;
427
433
  }
428
- return m(i, 0);
429
- }
430
- function j(i, l, d) {
431
- const c = r(l);
432
- if (c.length === 0) return i;
433
- let m = i;
434
- if (c.length === 1) {
435
- const _ = c[0];
436
- return m = w(m, _, d), m;
434
+ return d(i, 0);
435
+ }
436
+ function j(i, l, h) {
437
+ const u = r(...l);
438
+ if (u.length === 0) return i;
439
+ let d = i;
440
+ if (u.length === 1) {
441
+ const E = u[0];
442
+ return d = w(d, E, h), d;
437
443
  }
438
- for (const _ of c) {
439
- const $ = e(d, _);
440
- m = w(m, _, $);
444
+ for (const E of u) {
445
+ const $ = e(h, E);
446
+ d = w(d, E, $);
441
447
  }
442
- return m;
448
+ return d;
443
449
  }
444
450
  o.updateAt = j;
445
451
  })(V || (V = {}));
@@ -470,51 +476,51 @@ class re {
470
476
  this.#t(this.enrichValues(e));
471
477
  }
472
478
  createStepUpdaterFnImpl(e) {
473
- const { targetStep: t, updater: r, ctxData: s, fields: n = "all", debug: a } = e, u = new te({
479
+ const { targetStep: t, updater: r, ctxData: s, fields: n = "all", debug: a } = e, c = new te({
474
480
  debug: a,
475
- prefix: (h) => `${h}:update${t}`
481
+ prefix: (m) => `${m}:update${t}`
476
482
  });
477
- u.info(`${t} will be updated`), E(
483
+ c.info(`${t} will be updated`), _(
478
484
  be(this.value, t),
479
485
  `[update]: The target step ${t} isn't a valid step. Please select a valid step`
480
486
  );
481
487
  const { [t]: S, ...g } = this.value;
482
- let p = { ...this.value }, f = L(p, [t]);
488
+ let p = { ...this.value }, f = k(p, [t]);
483
489
  if (s) {
484
- E(
490
+ _(
485
491
  typeof s == "function",
486
492
  '[update]: "ctxData" must be a function'
487
- ), u.info('Custom "ctx" will be used');
488
- const h = s({ ctx: g });
489
- E(
490
- typeof h == "object" && Object.keys(h).length > 0,
493
+ ), c.info('Custom "ctx" will be used');
494
+ const m = s({ ctx: g });
495
+ _(
496
+ typeof m == "object" && Object.keys(m).length > 0,
491
497
  '[update]: "ctxData" must return an object with keys'
492
- ), u.info(
498
+ ), c.info(
493
499
  `Custom "ctx" consists of the following keys: ${new Intl.ListFormat(
494
500
  "en",
495
501
  {
496
502
  style: "long",
497
503
  type: "conjunction"
498
504
  }
499
- ).format(Object.keys(h))}`
505
+ ).format(Object.keys(m))}`
500
506
  ), f = {
501
507
  ...f,
502
- ...h
508
+ ...m
503
509
  };
504
510
  }
505
511
  const v = Ve(r, {
506
512
  ctx: f,
507
513
  update: this.createHelperFnInputUpdate([t])
508
514
  });
509
- if (u.info(`The updated data is ${JSON.stringify(v, null, 2)}`), !n) {
510
- E(
515
+ if (c.info(`The updated data is ${JSON.stringify(v, null, 2)}`), !n) {
516
+ _(
511
517
  typeof v == "object",
512
518
  '[update]: "updater" must be an object or a function that returns an object'
513
519
  );
514
- const h = Object.keys(this.value), b = Object.keys(v);
515
- E(b.length === h.length, () => {
516
- const i = h.filter(
517
- (d) => !b.includes(d)
520
+ const m = Object.keys(this.value), b = Object.keys(v);
521
+ _(b.length === m.length, () => {
522
+ const i = m.filter(
523
+ (h) => !b.includes(h)
518
524
  );
519
525
  return `[update]: "updater" is missing keys ${new Intl.ListFormat("en", {
520
526
  style: "long",
@@ -528,38 +534,38 @@ class re {
528
534
  O,
529
535
  v
530
536
  );
531
- E(
537
+ _(
532
538
  j && w.length === 0,
533
539
  `[update]: found value mismatches in ${V.printMismatches({
534
540
  mismatches: w,
535
541
  ok: j
536
542
  })}`
537
- ), u.info("The entire step will be updated"), p = {
543
+ ), c.info("The entire step will be updated"), p = {
538
544
  ...p,
539
545
  [t]: V.updateAt(p, O, v)
540
- }, this.handlePostUpdate(p), u.info(`The new value is: ${JSON.stringify(p, null, 2)}`);
546
+ }, this.handlePostUpdate(p), c.info(`The new value is: ${JSON.stringify(p, null, 2)}`);
541
547
  return;
542
548
  }
543
549
  const y = V.createDeep(S);
544
550
  if (Array.isArray(n)) {
545
- const h = M(y, n);
546
- E(
547
- h.status === "success",
551
+ const m = M(y, n);
552
+ _(
553
+ m.status === "success",
548
554
  `[update]: Found errors with the provided fields
549
- ${h.status === "error" ? U(h.errors) : ""}`
555
+ ${m.status === "error" ? U(m.errors) : ""}`
550
556
  );
551
557
  const { mismatches: b, ok: O } = V.equalsAtPaths(
552
558
  S,
553
559
  n,
554
560
  v
555
561
  );
556
- E(
562
+ _(
557
563
  O && b.length === 0,
558
564
  `[update]: found value mismatches in ${V.printMismatches({
559
565
  ok: O,
560
566
  mismatches: b
561
567
  })}`
562
- ), u.info(
568
+ ), c.info(
563
569
  `The following fields will be updated: ${new Intl.ListFormat("en", {
564
570
  type: "conjunction",
565
571
  style: "long"
@@ -567,25 +573,25 @@ ${h.status === "error" ? U(h.errors) : ""}`
567
573
  ), p = {
568
574
  ...p,
569
575
  [t]: V.updateAt(S, n, v)
570
- }, this.handlePostUpdate(p), u.info(`The new value is: ${JSON.stringify(p, null, 2)}`);
576
+ }, this.handlePostUpdate(p), c.info(`The new value is: ${JSON.stringify(p, null, 2)}`);
571
577
  return;
572
578
  }
573
579
  if (typeof n == "object" && Object.keys(n).length > 0) {
574
- const h = V.createDeep(n), b = M(
580
+ const m = V.createDeep(n), b = M(
575
581
  y,
576
- h
582
+ m
577
583
  );
578
- E(
584
+ _(
579
585
  b.status === "success",
580
586
  `[update]: Found errors with the provided fields
581
587
  ${b.status === "error" ? U(b.errors) : ""}`
582
588
  );
583
589
  const { mismatches: O, ok: w } = V.equalsAtPaths(
584
590
  S,
585
- h,
591
+ m,
586
592
  v
587
593
  );
588
- E(
594
+ _(
589
595
  w && O.length === 0,
590
596
  `[update]: found value mismatches in ${V.printMismatches({
591
597
  ok: w,
@@ -595,18 +601,18 @@ ${b.status === "error" ? U(b.errors) : ""}`
595
601
  ...p,
596
602
  [t]: V.updateAt(
597
603
  S,
598
- h,
604
+ m,
599
605
  v
600
606
  )
601
- }, u.info(
607
+ }, c.info(
602
608
  `The following fields will be updated: ${new Intl.ListFormat("en", {
603
609
  type: "conjunction",
604
610
  style: "long"
605
611
  }).format(Object.keys(n))}`
606
- ), this.handlePostUpdate(p), u.info(`The new value is: ${JSON.stringify(p, null, 2)}`);
612
+ ), this.handlePostUpdate(p), c.info(`The new value is: ${JSON.stringify(p, null, 2)}`);
607
613
  return;
608
614
  }
609
- throw u.error('Unsupported value for the "fields" option'), new TypeError(
615
+ throw c.error('Unsupported value for the "fields" option'), new TypeError(
610
616
  `[update]: property "fields" must be set to one of the following: "all", an array of deep paths to update, or an object of paths. Was ${typeof r}`,
611
617
  { cause: r }
612
618
  );
@@ -620,7 +626,7 @@ ${b.status === "error" ? U(b.errors) : ""}`
620
626
  return this.createStepUpdaterFnImpl(e);
621
627
  }
622
628
  createHelperFnInputUpdate(e) {
623
- if (k.isAll(e)) {
629
+ if (x.isAll(e)) {
624
630
  const r = ae(this.value).reduce((n, a) => (n[a] = this.createStepUpdaterFn(a), n), {});
625
631
  return Object.assign(
626
632
  this.update,
@@ -628,62 +634,69 @@ ${b.status === "error" ? U(b.errors) : ""}`
628
634
  );
629
635
  }
630
636
  const t = Object.keys(this.value);
631
- if (k.isTuple(e, t)) {
637
+ if (x.isTuple(e, t)) {
632
638
  const r = e.reduce((n, a) => (n[a] = this.createStepUpdaterFn(a), n), {});
633
639
  return Object.assign(
634
640
  this.update,
635
641
  r
636
642
  );
637
643
  }
638
- if (k.isObject(e, t)) {
644
+ if (x.isObject(e, t)) {
639
645
  const r = ae(e).reduce((n, a) => (n[a] = this.createStepUpdaterFn(a), n), {});
640
646
  return Object.assign(
641
647
  this.update,
642
648
  r
643
649
  );
644
650
  }
645
- throw new TypeError(`[update]: ${k.CATCH_ALL_MESSAGE}`);
651
+ throw new TypeError(`[update]: ${x.CATCH_ALL_MESSAGE}`);
646
652
  }
647
653
  createStepHelperFn(e) {
648
654
  return (t, r) => {
649
- const s = L(
650
- this.value,
651
- e
652
- ), n = this.createHelperFnInputUpdate(
655
+ const s = this.createHelperFnInputUpdate(
653
656
  e
654
657
  );
655
658
  if (typeof t == "function")
656
- return () => t({
657
- ctx: s,
658
- update: n
659
- });
659
+ return () => {
660
+ const n = k(
661
+ this.value,
662
+ e
663
+ );
664
+ return t({
665
+ ctx: n,
666
+ update: s
667
+ });
668
+ };
660
669
  if (typeof t == "object")
661
- return (a) => {
670
+ return (n) => {
671
+ const a = k(
672
+ this.value,
673
+ e
674
+ );
662
675
  if ("validator" in t) {
663
- E(
664
- typeof a == "object",
676
+ _(
677
+ typeof n == "object",
665
678
  "An input is expected since you provided a validator"
666
679
  ), Se(
667
680
  t.validator,
668
- a.data
681
+ n.data
669
682
  );
670
- let u = s;
683
+ let c = a;
671
684
  if (t.ctxData) {
672
685
  const S = e[0], { [S]: g, ...p } = this.value;
673
- u = {
674
- ...u,
686
+ c = {
687
+ ...c,
675
688
  ...t.ctxData({ ctx: p })
676
689
  };
677
690
  }
678
691
  return r({
679
- ctx: u,
680
- update: n,
681
- ...a
692
+ ctx: c,
693
+ update: s,
694
+ ...n
682
695
  });
683
696
  }
684
697
  return r({
685
- ctx: s,
686
- update: n
698
+ ctx: a,
699
+ update: s
687
700
  });
688
701
  };
689
702
  throw new Error(
@@ -694,14 +707,14 @@ ${b.status === "error" ? U(b.errors) : ""}`
694
707
  enrichValues(e, t) {
695
708
  let r = { ...e };
696
709
  for (const [s, n] of Object.entries(r)) {
697
- const [a] = [s], u = Number.parseInt(
710
+ const [a] = [s], c = Number.parseInt(
698
711
  a.replace("step", "")
699
712
  );
700
713
  r[a] = {
701
714
  ...n,
702
715
  update: this.createStepUpdaterFn(a),
703
716
  createHelperFn: this.createStepHelperFn([a]),
704
- ...t?.(u)
717
+ ...t?.(c)
705
718
  };
706
719
  }
707
720
  return r;
@@ -710,12 +723,12 @@ ${b.status === "error" ? U(b.errors) : ""}`
710
723
  var Y;
711
724
  ((o) => {
712
725
  function e(t, r, s = "defaultValue") {
713
- const [n, ...a] = t.split("."), u = `${n}.${s}`, S = a.length === 0 ? u : `${u}.${a.join(".")}`;
726
+ const [n, ...a] = t.split("."), c = `${n}.${s}`, S = a.length === 0 ? c : `${c}.${a.join(".")}`;
714
727
  return V.pickBy(r, S);
715
728
  }
716
729
  o.resolvedDeepPath = e;
717
730
  })(Y || (Y = {}));
718
- var k;
731
+ var x;
719
732
  ((o) => {
720
733
  o.CATCH_ALL_MESSAGE = 'The chosen steps must either be set to on of the following: "all", an array of steps (["step1", "step2", ...]), or an object containing the steps to chose ({ step1: true, step2: true, ...})';
721
734
  function e(s) {
@@ -730,10 +743,10 @@ var k;
730
743
  if (!s)
731
744
  return !1;
732
745
  const a = Object.keys(s);
733
- return a.length === 0 || n && !a.every((u) => n.includes(u)) ? !1 : Object.entries(s).every(([u, S]) => S === !0);
746
+ return a.length === 0 || n && !a.every((c) => n.includes(c)) ? !1 : Object.entries(s).every(([c, S]) => S === !0);
734
747
  }
735
748
  o.isObject = r;
736
- })(k || (k = {}));
749
+ })(x || (x = {}));
737
750
  const Ce = [
738
751
  "sentence",
739
752
  "title",
@@ -808,7 +821,7 @@ class Ee {
808
821
  }), this.key = t, this.data = r, this.throwWhenUndefined = n, s ? (this.store = s, this.shouldRunActions = !0, typeof window > "u" && (this.shouldRunActions = !1, this.log.warn(W))) : typeof window < "u" ? (this.store = window.localStorage, this.shouldRunActions = !0) : (this.shouldRunActions = !1, this.log.warn(W));
809
822
  }
810
823
  throwOnEmptyStore() {
811
- this.throwWhenUndefined && E(this.store, () => this.shouldRunActions ? W : "No storage available");
824
+ this.throwWhenUndefined && _(this.store, () => this.shouldRunActions ? W : "No storage available");
812
825
  }
813
826
  resolveValue(e) {
814
827
  if (typeof e == "object")
@@ -879,28 +892,28 @@ function le(o, e, t) {
879
892
  function Ne(o) {
880
893
  const e = {}, { fields: t, defaultCasing: r, validateFields: s } = o;
881
894
  for (const [n, a] of Object.entries(t)) {
882
- E(
895
+ _(
883
896
  typeof n == "string",
884
897
  `Each key for the "fields" option must be a string. Key ${n} was a ${typeof n}`
885
- ), E(
898
+ ), _(
886
899
  typeof a == "object",
887
900
  `The value for key ${n} must be an object. Was ${typeof a}`
888
901
  );
889
902
  const {
890
- defaultValue: u,
903
+ defaultValue: c,
891
904
  label: S,
892
905
  nameTransformCasing: g,
893
906
  type: p = ue
894
907
  } = a;
895
908
  if (s)
896
- e[n] = u;
909
+ e[n] = c;
897
910
  else {
898
911
  const f = g ?? r;
899
912
  e[n] = {
900
913
  ...e[n],
901
914
  nameTransformCasing: f,
902
915
  type: p,
903
- defaultValue: u,
916
+ defaultValue: c,
904
917
  label: le(S, n, f)
905
918
  // TODO add more fields here
906
919
  };
@@ -911,16 +924,16 @@ function Ne(o) {
911
924
  s,
912
925
  e
913
926
  );
914
- E(
927
+ _(
915
928
  typeof n == "object",
916
929
  `The result of the validated fields must be an object, was (${typeof n}). This is probably an internal error, so open up an issue about it`
917
- ), E(
930
+ ), _(
918
931
  !!n,
919
932
  "The result of the validated fields must be defined. This is probably an internal error, so open up an issue about it"
920
933
  );
921
- for (const [a, u] of Object.entries(n)) {
934
+ for (const [a, c] of Object.entries(n)) {
922
935
  const S = t[a];
923
- E(
936
+ _(
924
937
  S,
925
938
  `No field found in the fields config for "${a}"`
926
939
  );
@@ -933,7 +946,7 @@ function Ne(o) {
933
946
  ...e[a],
934
947
  nameTransformCasing: v,
935
948
  type: p,
936
- defaultValue: u,
949
+ defaultValue: c,
937
950
  label: le(g, a, v)
938
951
  };
939
952
  }
@@ -942,53 +955,53 @@ function Ne(o) {
942
955
  }
943
956
  function Oe(o) {
944
957
  const e = {};
945
- E(!!o, "The steps config must be defined", TypeError), E(
958
+ _(!!o, "The steps config must be defined", TypeError), _(
946
959
  typeof o == "object",
947
960
  `The steps config must be an object, was (${typeof o})`,
948
961
  TypeError
949
962
  );
950
963
  for (const [t, r] of Object.entries(o)) {
951
- E(
964
+ _(
952
965
  typeof t == "string",
953
966
  `Each key for the step config must be a string. Key "${t}" was ${typeof t} `,
954
967
  TypeError
955
- ), E(
968
+ ), _(
956
969
  we.test(t),
957
970
  `The key "${t}" isn't formatted properly. Each key in the step config must be the following format: "step{number}"`
958
971
  );
959
972
  const s = t, {
960
973
  fields: n,
961
974
  title: a,
962
- nameTransformCasing: u = ne,
975
+ nameTransformCasing: c = ne,
963
976
  description: S,
964
977
  validateFields: g
965
978
  } = r, p = s.toString().replace("step", "");
966
- E(
979
+ _(
967
980
  n,
968
981
  `Missing fields for step ${p} (${String(s)})`,
969
982
  TypeError
970
- ), E(
983
+ ), _(
971
984
  typeof n == "object",
972
985
  "Fields must be an object",
973
986
  TypeError
974
- ), E(
987
+ ), _(
975
988
  Object.keys(n).length > 0,
976
989
  `The fields config for step ${p} (${String(
977
990
  s
978
991
  )}) is empty. Please add a field`
979
- ), E(
992
+ ), _(
980
993
  typeof n == "object",
981
994
  `The "fields" property must be an object. Was ${typeof n}`
982
995
  );
983
996
  const f = Ne({
984
- defaultCasing: u,
997
+ defaultCasing: c,
985
998
  fields: n,
986
999
  validateFields: g
987
1000
  });
988
1001
  e[s] = {
989
1002
  ...e[s],
990
1003
  title: a,
991
- nameTransformCasing: u,
1004
+ nameTransformCasing: c,
992
1005
  // Only add the description if it's defined
993
1006
  ...typeof S == "string" ? { description: S } : {},
994
1007
  fields: f
@@ -1033,7 +1046,7 @@ let oe = class extends _e {
1033
1046
  last: this.lastStep.step,
1034
1047
  value: this.stepNumbers,
1035
1048
  as: (n) => {
1036
- if (E(
1049
+ if (_(
1037
1050
  typeof n == "string",
1038
1051
  `The type of the target transformation type must be a string, was ${typeof n}`
1039
1052
  ), n === "string")
@@ -1130,8 +1143,8 @@ let oe = class extends _e {
1130
1143
  return !1;
1131
1144
  const n = r[s];
1132
1145
  if (n === null || typeof n != "object" || !ce(n, {
1133
- defaultValue: (u) => u !== "undefined" && u !== null,
1134
- label: (u) => typeof u == "string" || typeof u == "boolean" && !u,
1146
+ defaultValue: (c) => c !== "undefined" && c !== null,
1147
+ label: (c) => typeof c == "string" || typeof c == "boolean" && !c,
1135
1148
  nameTransformCasing: X,
1136
1149
  type: xe
1137
1150
  }))
@@ -1156,7 +1169,7 @@ let oe = class extends _e {
1156
1169
  const r = this.value[e], s = `Unable to get the value for "${String(
1157
1170
  e
1158
1171
  )}.fields.${String(t)}"`;
1159
- E("fields" in r, s), E(
1172
+ _("fields" in r, s), _(
1160
1173
  typeof r.fields == "object",
1161
1174
  `${s} because "fields" is not an object. This shouldn't be the case, so please open an issue`
1162
1175
  );
@@ -1221,7 +1234,7 @@ function Ie(o) {
1221
1234
  return r(n);
1222
1235
  };
1223
1236
  }
1224
- var x;
1237
+ var L;
1225
1238
  ((o) => {
1226
1239
  o.DEFAULT_FORM_ALIAS = "Form";
1227
1240
  function e(r, s) {
@@ -1242,18 +1255,18 @@ var x;
1242
1255
  return (s) => /* @__PURE__ */ Te("form", { id: r, ...s });
1243
1256
  }
1244
1257
  o.createDefaultForm = t;
1245
- })(x || (x = {}));
1258
+ })(L || (L = {}));
1246
1259
  var Z;
1247
1260
  ((o) => {
1248
1261
  o.DEFAULT_FORM_INSTANCE_ALIAS = "form";
1249
1262
  })(Z || (Z = {}));
1250
1263
  function Me(o, e) {
1251
- E(
1264
+ _(
1252
1265
  e in o,
1253
1266
  `The target step ${e} is not a valid step key`
1254
1267
  );
1255
1268
  const t = o[e];
1256
- E("fields" in t, `No "fields" were found for ${e}`);
1269
+ _("fields" in t, `No "fields" were found for ${e}`);
1257
1270
  let r = {};
1258
1271
  for (const [s, n] of Object.entries(
1259
1272
  t.fields
@@ -1274,13 +1287,13 @@ class Ue extends oe {
1274
1287
  getValue: () => this.value,
1275
1288
  setValue: (s) => this.handlePostUpdate(s)
1276
1289
  }), this.sync(), this.value = this.#e.enrichValues(this.value, (s) => {
1277
- const n = `step${s}`, a = [n], u = t?.id ?? n, S = L(this.value, a);
1290
+ const n = `step${s}`, a = [n], c = t?.id ?? n, S = k(this.value, a);
1278
1291
  return {
1279
1292
  createComponent: this.createStepSpecificComponentFactory(
1280
1293
  a,
1281
1294
  {
1282
1295
  isStepSpecific: !0,
1283
- defaultId: u,
1296
+ defaultId: c,
1284
1297
  form: t
1285
1298
  },
1286
1299
  S
@@ -1291,18 +1304,18 @@ class Ue extends oe {
1291
1304
  createFormComponent(e, t) {
1292
1305
  const { render: r, enabledForSteps: s = "all", id: n = t } = e, a = {
1293
1306
  id: n,
1294
- steps: L(this.value, s)
1307
+ steps: k(this.value, s)
1295
1308
  };
1296
- return (u) => r(a, u);
1309
+ return (c) => r(a, c);
1297
1310
  }
1298
1311
  createStepSpecificComponentImpl(e, t, r, s = {}) {
1299
1312
  return (n) => ((a) => {
1300
- const u = {};
1313
+ const c = {};
1301
1314
  for (const [w, j] of Object.entries(s))
1302
1315
  if (typeof j == "function")
1303
1316
  try {
1304
1317
  const i = j();
1305
- u[w] = i;
1318
+ c[w] = i;
1306
1319
  } catch (i) {
1307
1320
  const l = i instanceof Error ? i.message : String(i);
1308
1321
  throw new Error(
@@ -1318,53 +1331,61 @@ Original error: ${l}`,
1318
1331
  );
1319
1332
  }
1320
1333
  else
1321
- u[w] = j;
1334
+ c[w] = j;
1322
1335
  const { defaultId: S, form: g } = t, { ctx: p } = r, [f] = e;
1323
- E(
1336
+ _(
1324
1337
  this.steps.isValidStepKey(f),
1325
1338
  `[createComponent]: the target step ${f} is invalid. Note, this error shouldn't appear as the target step should always be valid. If you see this error, please open an issue.`
1326
1339
  );
1327
1340
  const v = Number.parseInt(f.replace("step", ""));
1328
- E(
1341
+ _(
1329
1342
  !Number.isNaN(v),
1330
1343
  `[${f}:"createComponent"]: an error occurred while extracting the number`
1331
1344
  );
1332
1345
  const y = this.value[f];
1333
- E(
1346
+ _(
1334
1347
  "fields" in y,
1335
1348
  `[${f}:createComponent]: unable to find the "fields" for the current step`
1336
- ), E(
1349
+ ), _(
1337
1350
  typeof y.fields == "object",
1338
1351
  `[${f}:createComponent]: the "fields" property must be an object, was ${typeof y.fields}`
1339
1352
  );
1340
- const h = this.#e.createStepUpdaterFn(f), b = Ie((w) => {
1341
- E(typeof w == "string", () => {
1342
- const c = new Intl.ListFormat("en", {
1353
+ const m = this.#e.createStepUpdaterFn(f), b = Ie((w) => {
1354
+ _(typeof w == "string", () => {
1355
+ const u = new Intl.ListFormat("en", {
1343
1356
  style: "long",
1344
1357
  type: "disjunction"
1345
1358
  });
1346
- return `[${f}:Field]: the "name" prop must be a string and a valid field for ${f}. Available fields include ${c.format(
1359
+ return `[${f}:Field]: the "name" prop must be a string and a valid field for ${f}. Available fields include ${u.format(
1347
1360
  Object.keys(y.fields)
1348
1361
  )}`;
1349
- }), E(
1362
+ }), _(
1350
1363
  w in y.fields,
1351
1364
  `[${f}:Field]: the field "${w}" doesn't exist for the current step`
1352
- ), E(
1365
+ ), _(
1353
1366
  "update" in y,
1354
1367
  `[${f}:Field]: No "update" function was found`
1355
1368
  );
1356
- const j = this.getValue(f, w), { label: i, nameTransformCasing: l, type: d } = y.fields[w];
1369
+ const j = this.getValue(f, w), { label: i, nameTransformCasing: l, type: h } = y.fields[w];
1357
1370
  return {
1358
1371
  defaultValue: j,
1359
1372
  label: i,
1360
1373
  nameTransformCasing: l,
1361
- type: d,
1374
+ type: h,
1362
1375
  name: w,
1363
- onInputChange: (c) => {
1364
- const m = typeof c == "function" ? c(j) : c;
1376
+ onInputChange: (u) => {
1377
+ let d;
1378
+ if (typeof u == "function") {
1379
+ const E = this.getValue(
1380
+ f,
1381
+ w
1382
+ );
1383
+ d = u(E);
1384
+ } else
1385
+ d = u;
1365
1386
  this.update({
1366
1387
  targetStep: f,
1367
- updater: m,
1388
+ updater: d,
1368
1389
  fields: [`fields.${w}.defaultValue`]
1369
1390
  });
1370
1391
  }
@@ -1372,16 +1393,16 @@ Original error: ${l}`,
1372
1393
  });
1373
1394
  let O = {
1374
1395
  ctx: p,
1375
- onInputChange: h,
1396
+ onInputChange: m,
1376
1397
  Field: b,
1377
- ...u
1398
+ ...c
1378
1399
  };
1379
1400
  if (g) {
1380
1401
  const {
1381
- alias: w = x.DEFAULT_FORM_ALIAS,
1402
+ alias: w = L.DEFAULT_FORM_ALIAS,
1382
1403
  ...j
1383
1404
  } = g, i = j.enabledForSteps ?? "all";
1384
- return x.isFormAvailable(
1405
+ return L.isFormAvailable(
1385
1406
  e,
1386
1407
  i
1387
1408
  ) && (O = {
@@ -1392,7 +1413,7 @@ Original error: ${l}`,
1392
1413
  return n(
1393
1414
  {
1394
1415
  ...O,
1395
- [x.DEFAULT_FORM_ALIAS]: x.createDefaultForm(S)
1416
+ [L.DEFAULT_FORM_ALIAS]: L.createDefaultForm(S)
1396
1417
  },
1397
1418
  a
1398
1419
  );
@@ -1401,13 +1422,13 @@ Original error: ${l}`,
1401
1422
  createStepSpecificComponentFactory(e, t, r) {
1402
1423
  const s = this.createStepSpecificComponentImpl.bind(this), n = this.createDefaultValues.bind(this);
1403
1424
  debugger;
1404
- const a = this.value, u = e[0], S = this.#e.createStepUpdaterFn(u).bind(this.#e);
1425
+ const a = this.value, c = e[0], S = this.#e.createStepUpdaterFn(c).bind(this.#e);
1405
1426
  function g(p, f) {
1406
- function v(h) {
1407
- return h ? { ctx: { ...r, ...h } } : { ctx: r };
1427
+ function v(m) {
1428
+ return m ? { ctx: { ...r, ...m } } : { ctx: r };
1408
1429
  }
1409
1430
  function y() {
1410
- return E(
1431
+ return _(
1411
1432
  typeof p == "function",
1412
1433
  "The first argument must be a function"
1413
1434
  ), s(
@@ -1417,36 +1438,36 @@ Original error: ${l}`,
1417
1438
  )(p);
1418
1439
  }
1419
1440
  if (typeof p == "object") {
1420
- const { useFormInstance: h, ctxData: b, debug: O } = p, w = new te({
1441
+ const { useFormInstance: m, ctxData: b, debug: O } = p, w = new te({
1421
1442
  debug: O,
1422
1443
  prefix(l) {
1423
- return `${l}-${u}-createComponent`;
1444
+ return `${l}-${c}-createComponent`;
1424
1445
  }
1425
1446
  });
1426
1447
  w.info("First argument is an object");
1427
- const { [u]: j, ...i } = a;
1428
- if (E(
1448
+ const { [c]: j, ...i } = a;
1449
+ if (_(
1429
1450
  typeof f == "function",
1430
1451
  "The second argument must be a function"
1431
- ), h) {
1452
+ ), m) {
1432
1453
  const {
1433
1454
  render: l,
1434
- alias: d = Z.DEFAULT_FORM_INSTANCE_ALIAS
1435
- } = h, [c] = e, m = n(c), _ = b ? {
1455
+ alias: h = Z.DEFAULT_FORM_INSTANCE_ALIAS
1456
+ } = m, [u] = e, d = n(u), E = b ? {
1436
1457
  ...r,
1437
1458
  ...b({ ctx: i })
1438
- } : r, $ = { ctx: _, defaultValues: m };
1459
+ } : r, $ = { ctx: E, defaultValues: d };
1439
1460
  return s(
1440
1461
  e,
1441
1462
  t,
1442
- _,
1463
+ E,
1443
1464
  {
1444
- [d]: () => l($)
1465
+ [h]: () => l($)
1445
1466
  }
1446
1467
  )(f);
1447
1468
  }
1448
1469
  if (b) {
1449
- w.info('Option "ctxData" is defined'), E(
1470
+ w.info('Option "ctxData" is defined'), _(
1450
1471
  typeof b == "function",
1451
1472
  'Option "ctxData" must be a function'
1452
1473
  );
@@ -1454,14 +1475,14 @@ Original error: ${l}`,
1454
1475
  w.info(
1455
1476
  `Addition context is: ${JSON.stringify(l, null, 2)}`
1456
1477
  );
1457
- const d = {
1478
+ const h = {
1458
1479
  ...r,
1459
1480
  ...l
1460
1481
  };
1461
1482
  return w.info(
1462
- `Resolved context is: ${JSON.stringify(d, null, 2)}`
1483
+ `Resolved context is: ${JSON.stringify(h, null, 2)}`
1463
1484
  ), s(e, t, {
1464
- ctx: d,
1485
+ ctx: h,
1465
1486
  update: S
1466
1487
  })(f);
1467
1488
  }
@@ -1479,7 +1500,7 @@ Original error: ${l}`,
1479
1500
  * @returns The created component for the step.
1480
1501
  */
1481
1502
  createComponent(e, t) {
1482
- const { stepData: r } = e, s = L(
1503
+ const { stepData: r } = e, s = k(
1483
1504
  this.value,
1484
1505
  r
1485
1506
  );
@@ -1503,7 +1524,7 @@ class Re extends De {
1503
1524
  });
1504
1525
  }
1505
1526
  createComponent(e, t) {
1506
- const { stepData: r } = e, s = L(
1527
+ const { stepData: r } = e, s = k(
1507
1528
  this.stepSchema.value,
1508
1529
  r
1509
1530
  );
@@ -1538,8 +1559,8 @@ function Pe() {
1538
1559
  return f === v && (f !== 0 || 1 / f === 1 / v) || f !== f && v !== v;
1539
1560
  }
1540
1561
  var t = typeof Object.is == "function" ? Object.is : e, r = o.useState, s = o.useEffect, n = o.useLayoutEffect, a = o.useDebugValue;
1541
- function u(f, v) {
1542
- var y = v(), h = r({ inst: { value: y, getSnapshot: v } }), b = h[0].inst, O = h[1];
1562
+ function c(f, v) {
1563
+ var y = v(), m = r({ inst: { value: y, getSnapshot: v } }), b = m[0].inst, O = m[1];
1543
1564
  return n(
1544
1565
  function() {
1545
1566
  b.value = y, b.getSnapshot = v, S(b) && O({ inst: b });
@@ -1567,10 +1588,10 @@ function Pe() {
1567
1588
  function g(f, v) {
1568
1589
  return v();
1569
1590
  }
1570
- var p = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? g : u;
1591
+ var p = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? g : c;
1571
1592
  return B.useSyncExternalStore = o.useSyncExternalStore !== void 0 ? o.useSyncExternalStore : p, B;
1572
1593
  }
1573
- var J = {};
1594
+ var z = {};
1574
1595
  /**
1575
1596
  * @license React
1576
1597
  * use-sync-external-store-shim.development.js
@@ -1583,30 +1604,30 @@ var J = {};
1583
1604
  var pe;
1584
1605
  function Ke() {
1585
1606
  return pe || (pe = 1, process.env.NODE_ENV !== "production" && (function() {
1586
- function o(y, h) {
1587
- return y === h && (y !== 0 || 1 / y === 1 / h) || y !== y && h !== h;
1607
+ function o(y, m) {
1608
+ return y === m && (y !== 0 || 1 / y === 1 / m) || y !== y && m !== m;
1588
1609
  }
1589
- function e(y, h) {
1610
+ function e(y, m) {
1590
1611
  p || s.startTransition === void 0 || (p = !0, console.error(
1591
1612
  "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."
1592
1613
  ));
1593
- var b = h();
1614
+ var b = m();
1594
1615
  if (!f) {
1595
- var O = h();
1616
+ var O = m();
1596
1617
  n(b, O) || (console.error(
1597
1618
  "The result of getSnapshot should be cached to avoid an infinite loop"
1598
1619
  ), f = !0);
1599
1620
  }
1600
1621
  O = a({
1601
- inst: { value: b, getSnapshot: h }
1622
+ inst: { value: b, getSnapshot: m }
1602
1623
  });
1603
1624
  var w = O[0].inst, j = O[1];
1604
1625
  return S(
1605
1626
  function() {
1606
- w.value = b, w.getSnapshot = h, t(w) && j({ inst: w });
1627
+ w.value = b, w.getSnapshot = m, t(w) && j({ inst: w });
1607
1628
  },
1608
- [y, b, h]
1609
- ), u(
1629
+ [y, b, m]
1630
+ ), c(
1610
1631
  function() {
1611
1632
  return t(w) && j({ inst: w }), y(function() {
1612
1633
  t(w) && j({ inst: w });
@@ -1616,22 +1637,22 @@ function Ke() {
1616
1637
  ), g(b), b;
1617
1638
  }
1618
1639
  function t(y) {
1619
- var h = y.getSnapshot;
1640
+ var m = y.getSnapshot;
1620
1641
  y = y.value;
1621
1642
  try {
1622
- var b = h();
1643
+ var b = m();
1623
1644
  return !n(y, b);
1624
1645
  } catch {
1625
1646
  return !0;
1626
1647
  }
1627
1648
  }
1628
- function r(y, h) {
1629
- return h();
1649
+ function r(y, m) {
1650
+ return m();
1630
1651
  }
1631
1652
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
1632
- var s = R, n = typeof Object.is == "function" ? Object.is : o, a = s.useState, u = s.useEffect, S = s.useLayoutEffect, g = s.useDebugValue, p = !1, f = !1, v = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? r : e;
1633
- J.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : v, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
1634
- })()), J;
1653
+ var s = R, n = typeof Object.is == "function" ? Object.is : o, a = s.useState, c = s.useEffect, S = s.useLayoutEffect, g = s.useDebugValue, p = !1, f = !1, v = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? r : e;
1654
+ z.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : v, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
1655
+ })()), z;
1635
1656
  }
1636
1657
  var de;
1637
1658
  function $e() {
@@ -1654,41 +1675,41 @@ function Ge() {
1654
1675
  function t(g, p) {
1655
1676
  return g === p && (g !== 0 || 1 / g === 1 / p) || g !== g && p !== p;
1656
1677
  }
1657
- var r = typeof Object.is == "function" ? Object.is : t, s = e.useSyncExternalStore, n = o.useRef, a = o.useEffect, u = o.useMemo, S = o.useDebugValue;
1678
+ var r = typeof Object.is == "function" ? Object.is : t, s = e.useSyncExternalStore, n = o.useRef, a = o.useEffect, c = o.useMemo, S = o.useDebugValue;
1658
1679
  return H.useSyncExternalStoreWithSelector = function(g, p, f, v, y) {
1659
- var h = n(null);
1660
- if (h.current === null) {
1680
+ var m = n(null);
1681
+ if (m.current === null) {
1661
1682
  var b = { hasValue: !1, value: null };
1662
- h.current = b;
1663
- } else b = h.current;
1664
- h = u(
1683
+ m.current = b;
1684
+ } else b = m.current;
1685
+ m = c(
1665
1686
  function() {
1666
- function w(c) {
1687
+ function w(u) {
1667
1688
  if (!j) {
1668
- if (j = !0, i = c, c = v(c), y !== void 0 && b.hasValue) {
1669
- var m = b.value;
1670
- if (y(m, c))
1671
- return l = m;
1689
+ if (j = !0, i = u, u = v(u), y !== void 0 && b.hasValue) {
1690
+ var d = b.value;
1691
+ if (y(d, u))
1692
+ return l = d;
1672
1693
  }
1673
- return l = c;
1694
+ return l = u;
1674
1695
  }
1675
- if (m = l, r(i, c)) return m;
1676
- var _ = v(c);
1677
- return y !== void 0 && y(m, _) ? (i = c, m) : (i = c, l = _);
1696
+ if (d = l, r(i, u)) return d;
1697
+ var E = v(u);
1698
+ return y !== void 0 && y(d, E) ? (i = u, d) : (i = u, l = E);
1678
1699
  }
1679
- var j = !1, i, l, d = f === void 0 ? null : f;
1700
+ var j = !1, i, l, h = f === void 0 ? null : f;
1680
1701
  return [
1681
1702
  function() {
1682
1703
  return w(p());
1683
1704
  },
1684
- d === null ? void 0 : function() {
1685
- return w(d());
1705
+ h === null ? void 0 : function() {
1706
+ return w(h());
1686
1707
  }
1687
1708
  ];
1688
1709
  },
1689
1710
  [p, f, v, y]
1690
1711
  );
1691
- var O = s(g, h[0], h[1]);
1712
+ var O = s(g, m[0], m[1]);
1692
1713
  return a(
1693
1714
  function() {
1694
1715
  b.hasValue = !0, b.value = O;
@@ -1697,7 +1718,7 @@ function Ge() {
1697
1718
  ), S(O), O;
1698
1719
  }, H;
1699
1720
  }
1700
- var z = {};
1721
+ var J = {};
1701
1722
  /**
1702
1723
  * @license React
1703
1724
  * use-sync-external-store-shim/with-selector.development.js
@@ -1714,42 +1735,42 @@ function We() {
1714
1735
  return g === p && (g !== 0 || 1 / g === 1 / p) || g !== g && p !== p;
1715
1736
  }
1716
1737
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
1717
- var e = R, t = $e(), r = typeof Object.is == "function" ? Object.is : o, s = t.useSyncExternalStore, n = e.useRef, a = e.useEffect, u = e.useMemo, S = e.useDebugValue;
1718
- z.useSyncExternalStoreWithSelector = function(g, p, f, v, y) {
1719
- var h = n(null);
1720
- if (h.current === null) {
1738
+ var e = R, t = $e(), r = typeof Object.is == "function" ? Object.is : o, s = t.useSyncExternalStore, n = e.useRef, a = e.useEffect, c = e.useMemo, S = e.useDebugValue;
1739
+ J.useSyncExternalStoreWithSelector = function(g, p, f, v, y) {
1740
+ var m = n(null);
1741
+ if (m.current === null) {
1721
1742
  var b = { hasValue: !1, value: null };
1722
- h.current = b;
1723
- } else b = h.current;
1724
- h = u(
1743
+ m.current = b;
1744
+ } else b = m.current;
1745
+ m = c(
1725
1746
  function() {
1726
- function w(c) {
1747
+ function w(u) {
1727
1748
  if (!j) {
1728
- if (j = !0, i = c, c = v(c), y !== void 0 && b.hasValue) {
1729
- var m = b.value;
1730
- if (y(m, c))
1731
- return l = m;
1749
+ if (j = !0, i = u, u = v(u), y !== void 0 && b.hasValue) {
1750
+ var d = b.value;
1751
+ if (y(d, u))
1752
+ return l = d;
1732
1753
  }
1733
- return l = c;
1754
+ return l = u;
1734
1755
  }
1735
- if (m = l, r(i, c))
1736
- return m;
1737
- var _ = v(c);
1738
- return y !== void 0 && y(m, _) ? (i = c, m) : (i = c, l = _);
1756
+ if (d = l, r(i, u))
1757
+ return d;
1758
+ var E = v(u);
1759
+ return y !== void 0 && y(d, E) ? (i = u, d) : (i = u, l = E);
1739
1760
  }
1740
- var j = !1, i, l, d = f === void 0 ? null : f;
1761
+ var j = !1, i, l, h = f === void 0 ? null : f;
1741
1762
  return [
1742
1763
  function() {
1743
1764
  return w(p());
1744
1765
  },
1745
- d === null ? void 0 : function() {
1746
- return w(d());
1766
+ h === null ? void 0 : function() {
1767
+ return w(h());
1747
1768
  }
1748
1769
  ];
1749
1770
  },
1750
1771
  [p, f, v, y]
1751
1772
  );
1752
- var O = s(g, h[0], h[1]);
1773
+ var O = s(g, m[0], m[1]);
1753
1774
  return a(
1754
1775
  function() {
1755
1776
  b.hasValue = !0, b.value = O;
@@ -1757,7 +1778,7 @@ function We() {
1757
1778
  [O]
1758
1779
  ), S(O), O;
1759
1780
  }, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
1760
- })()), z;
1781
+ })()), J;
1761
1782
  }
1762
1783
  var ye;
1763
1784
  function He() {
@@ -1765,7 +1786,7 @@ function He() {
1765
1786
  }
1766
1787
  var Be = He();
1767
1788
  function Q(o, e) {
1768
- E(
1789
+ _(
1769
1790
  typeof e == "string",
1770
1791
  `The target step must be a string, was ${typeof e}`
1771
1792
  );
@@ -1773,12 +1794,12 @@ function Q(o, e) {
1773
1794
  type: "disjunction",
1774
1795
  style: "long"
1775
1796
  }).format(t("array.string.untyped"));
1776
- E(
1797
+ _(
1777
1798
  we.test(e),
1778
1799
  `The target step must match the following format: "step{number}". Available steps are ${n}`
1779
1800
  );
1780
1801
  const a = Number.parseInt(e.replace("step", ""));
1781
- return E(
1802
+ return _(
1782
1803
  r(a),
1783
1804
  `The step number "${a}" is not a valid step number. Valid step numbers include ${n}`,
1784
1805
  TypeError
@@ -1815,8 +1836,8 @@ function ge(o) {
1815
1836
  }
1816
1837
  function Qe(o) {
1817
1838
  const e = je(o);
1818
- function t(u) {
1819
- const { targetStep: S, notFoundMessage: g, isDataGuaranteed: p } = u, f = e({
1839
+ function t(c) {
1840
+ const { targetStep: S, notFoundMessage: g, isDataGuaranteed: p } = c, f = e({
1820
1841
  targetStep: S
1821
1842
  }), v = g ? a({ targetStep: S }, g) : (y) => /* @__PURE__ */ ie("div", { ...y, children: [
1822
1843
  "No data found for step ",
@@ -1835,7 +1856,7 @@ function Qe(o) {
1835
1856
  NoCurrentData: v
1836
1857
  };
1837
1858
  }
1838
- function r(u) {
1859
+ function r(c) {
1839
1860
  const S = e(
1840
1861
  (O) => O.stepSchema.steps.value.length
1841
1862
  ), {
@@ -1843,7 +1864,7 @@ function Qe(o) {
1843
1864
  maxProgressValue: p = 100,
1844
1865
  totalSteps: f = S,
1845
1866
  progressTextTransformer: v
1846
- } = u, y = Q(o, g), h = y / f * p, b = v ? n(
1867
+ } = c, y = Q(o, g), m = y / f * p, b = v ? n(
1847
1868
  { targetStep: g, maxProgressValue: p, totalSteps: f },
1848
1869
  v
1849
1870
  ) : (O) => /* @__PURE__ */ ie("div", { ...O, children: [
@@ -1853,21 +1874,21 @@ function Qe(o) {
1853
1874
  f
1854
1875
  ] });
1855
1876
  return {
1856
- value: h,
1877
+ value: m,
1857
1878
  maxProgressValue: p,
1858
1879
  ProgressText: b
1859
1880
  };
1860
1881
  }
1861
- function s(u) {
1882
+ function s(c) {
1862
1883
  const g = e((f) => f.storage).get(), p = !!(g && typeof g == "object" && Object.keys(g).length > 0);
1863
- return u ? u(p) : p;
1884
+ return c ? c(p) : p;
1864
1885
  }
1865
- function n(u, S) {
1866
- const g = o.getSnapshot().stepSchema.steps.value.length, { targetStep: p, maxProgressValue: f = 100, totalSteps: v = g } = u;
1886
+ function n(c, S) {
1887
+ const g = o.getSnapshot().stepSchema.steps.value.length, { targetStep: p, maxProgressValue: f = 100, totalSteps: v = g } = c;
1867
1888
  return ge({ targetStep: p, maxProgressValue: f, totalSteps: v })(S);
1868
1889
  }
1869
- function a(u, S) {
1870
- return Q(o, u.targetStep), ge(u)(S);
1890
+ function a(c, S) {
1891
+ return Q(o, c.targetStep), ge(c)(S);
1871
1892
  }
1872
1893
  return {
1873
1894
  // MultiStepFormContext: Context,