@harnessio/forms 0.13.0 → 0.14.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.
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
- var we = Object.defineProperty;
2
- var Ie = (r, e, n) => e in r ? we(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
1
+ var Ce = Object.defineProperty;
2
+ var Ie = (r, e, n) => e in r ? Ce(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
3
3
  var D = (r, e, n) => Ie(r, typeof e != "symbol" ? e + "" : e, n);
4
- import { isEmpty as k, set as S, get as _, forOwn as me, isArray as j, isObject as he, merge as M, isUndefined as B, cloneDeep as H, unset as ye, pick as Oe, isPlainObject as je, isNull as pe, omitBy as ge, isNil as Ve, isString as xe, capitalize as Fe } from "lodash-es";
5
- import Pe, { createContext as qe, useContext as Ae, Component as ke, memo as Ne, useMemo as $, useRef as O, useEffect as I, useCallback as De, forwardRef as Me, Fragment as $e } from "react";
6
- import { useFormContext as Ze, get as Be, useForm as We, FormProvider as Je, appendErrors as Ue, useController as Le } from "react-hook-form";
7
- import { Controller as Ur, Form as Lr, FormProvider as Hr, get as Gr, set as Kr, useFieldArray as Qr, useForm as Xr, useFormContext as Yr, useFormState as zr, useWatch as et } from "react-hook-form";
4
+ import { isEmpty as k, set as S, get as v, forOwn as me, isArray as j, isObject as he, merge as M, isUndefined as W, cloneDeep as B, unset as pe, isPlainObject as we, isNull as ye, omitBy as ge, isNil as je, isString as Ve, capitalize as xe } from "lodash-es";
5
+ import Fe, { createContext as Pe, useContext as qe, Component as Ae, memo as ke, useMemo as $, useRef as w, useEffect as I, useCallback as Ne, forwardRef as De, Fragment as Me } from "react";
6
+ import { useFormContext as $e, get as Ze, useForm as Be, FormProvider as We, appendErrors as Je, useController as Le } from "react-hook-form";
7
+ import { Controller as Ur, Form as Hr, FormProvider as Gr, get as Kr, set as Qr, useFieldArray as Xr, useForm as Yr, useFormContext as zr, useFormState as et, useWatch as rt } from "react-hook-form";
8
8
  import * as d from "zod";
9
- import { toNestErrors as He } from "@hookform/resolvers";
10
- class Ge extends Error {
9
+ import { toNestErrors as Ue } from "@hookform/resolvers";
10
+ class He extends Error {
11
11
  constructor(e) {
12
12
  super(`Input component '${e}' is already registered.`);
13
13
  }
@@ -26,7 +26,7 @@ class be {
26
26
  */
27
27
  registerComponent(e) {
28
28
  if (!this.allowOverride && this.getComponent(e.internalType))
29
- throw new Ge(e.internalType);
29
+ throw new He(e.internalType);
30
30
  this.componentBank.set(e.internalType, e);
31
31
  }
32
32
  getComponent(e) {
@@ -55,15 +55,15 @@ class be {
55
55
  }), e;
56
56
  }
57
57
  }
58
- var W = { exports: {} }, V = {};
58
+ var J = { exports: {} }, V = {};
59
59
  /*
60
60
  object-assign
61
61
  (c) Sindre Sorhus
62
62
  @license MIT
63
63
  */
64
- var J, oe;
65
- function Ke() {
66
- if (oe) return J;
64
+ var L, oe;
65
+ function Ge() {
66
+ if (oe) return L;
67
67
  oe = 1;
68
68
  var r = Object.getOwnPropertySymbols, e = Object.prototype.hasOwnProperty, n = Object.prototype.propertyIsEnumerable;
69
69
  function t(s) {
@@ -71,41 +71,41 @@ function Ke() {
71
71
  throw new TypeError("Object.assign cannot be called with null or undefined");
72
72
  return Object(s);
73
73
  }
74
- function a() {
74
+ function o() {
75
75
  try {
76
76
  if (!Object.assign)
77
77
  return !1;
78
78
  var s = new String("abc");
79
79
  if (s[5] = "de", Object.getOwnPropertyNames(s)[0] === "5")
80
80
  return !1;
81
- for (var o = {}, i = 0; i < 10; i++)
82
- o["_" + String.fromCharCode(i)] = i;
83
- var u = Object.getOwnPropertyNames(o).map(function(f) {
84
- return o[f];
81
+ for (var a = {}, u = 0; u < 10; u++)
82
+ a["_" + String.fromCharCode(u)] = u;
83
+ var i = Object.getOwnPropertyNames(a).map(function(c) {
84
+ return a[c];
85
85
  });
86
- if (u.join("") !== "0123456789")
86
+ if (i.join("") !== "0123456789")
87
87
  return !1;
88
- var c = {};
89
- return "abcdefghijklmnopqrst".split("").forEach(function(f) {
90
- c[f] = f;
91
- }), Object.keys(Object.assign({}, c)).join("") === "abcdefghijklmnopqrst";
88
+ var f = {};
89
+ return "abcdefghijklmnopqrst".split("").forEach(function(c) {
90
+ f[c] = c;
91
+ }), Object.keys(Object.assign({}, f)).join("") === "abcdefghijklmnopqrst";
92
92
  } catch {
93
93
  return !1;
94
94
  }
95
95
  }
96
- return J = a() ? Object.assign : function(s, o) {
97
- for (var i, u = t(s), c, f = 1; f < arguments.length; f++) {
98
- i = Object(arguments[f]);
99
- for (var m in i)
100
- e.call(i, m) && (u[m] = i[m]);
96
+ return L = o() ? Object.assign : function(s, a) {
97
+ for (var u, i = t(s), f, c = 1; c < arguments.length; c++) {
98
+ u = Object(arguments[c]);
99
+ for (var m in u)
100
+ e.call(u, m) && (i[m] = u[m]);
101
101
  if (r) {
102
- c = r(i);
103
- for (var l = 0; l < c.length; l++)
104
- n.call(i, c[l]) && (u[c[l]] = i[c[l]]);
102
+ f = r(u);
103
+ for (var l = 0; l < f.length; l++)
104
+ n.call(u, f[l]) && (i[f[l]] = u[f[l]]);
105
105
  }
106
106
  }
107
- return u;
108
- }, J;
107
+ return i;
108
+ }, L;
109
109
  }
110
110
  /** @license React v17.0.2
111
111
  * react-jsx-runtime.production.min.js
@@ -115,38 +115,38 @@ function Ke() {
115
115
  * This source code is licensed under the MIT license found in the
116
116
  * LICENSE file in the root directory of this source tree.
117
117
  */
118
- var ie;
119
- function Qe() {
120
- if (ie) return V;
121
- ie = 1, Ke();
122
- var r = Pe, e = 60103;
118
+ var ue;
119
+ function Ke() {
120
+ if (ue) return V;
121
+ ue = 1, Ge();
122
+ var r = Fe, e = 60103;
123
123
  if (V.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
124
124
  var n = Symbol.for;
125
125
  e = n("react.element"), V.Fragment = n("react.fragment");
126
126
  }
127
- var t = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, a = Object.prototype.hasOwnProperty, s = { key: !0, ref: !0, __self: !0, __source: !0 };
128
- function o(i, u, c) {
129
- var f, m = {}, l = null, h = null;
130
- c !== void 0 && (l = "" + c), u.key !== void 0 && (l = "" + u.key), u.ref !== void 0 && (h = u.ref);
131
- for (f in u) a.call(u, f) && !s.hasOwnProperty(f) && (m[f] = u[f]);
132
- if (i && i.defaultProps) for (f in u = i.defaultProps, u) m[f] === void 0 && (m[f] = u[f]);
133
- return { $$typeof: e, type: i, key: l, ref: h, props: m, _owner: t.current };
127
+ var t = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = Object.prototype.hasOwnProperty, s = { key: !0, ref: !0, __self: !0, __source: !0 };
128
+ function a(u, i, f) {
129
+ var c, m = {}, l = null, h = null;
130
+ f !== void 0 && (l = "" + f), i.key !== void 0 && (l = "" + i.key), i.ref !== void 0 && (h = i.ref);
131
+ for (c in i) o.call(i, c) && !s.hasOwnProperty(c) && (m[c] = i[c]);
132
+ if (u && u.defaultProps) for (c in i = u.defaultProps, i) m[c] === void 0 && (m[c] = i[c]);
133
+ return { $$typeof: e, type: u, key: l, ref: h, props: m, _owner: t.current };
134
134
  }
135
- return V.jsx = o, V.jsxs = o, V;
135
+ return V.jsx = a, V.jsxs = a, V;
136
136
  }
137
- var ue;
138
- function Xe() {
139
- return ue || (ue = 1, W.exports = Qe()), W.exports;
137
+ var ie;
138
+ function Qe() {
139
+ return ie || (ie = 1, J.exports = Ke()), J.exports;
140
140
  }
141
- var y = Xe();
142
- const ve = qe({});
143
- function Ye({
141
+ var p = Qe();
142
+ const ve = Pe({});
143
+ function Xe({
144
144
  children: r,
145
145
  metadata: e,
146
146
  inputErrorHandler: n,
147
147
  readonly: t
148
148
  }) {
149
- return /* @__PURE__ */ y.jsx(
149
+ return /* @__PURE__ */ p.jsx(
150
150
  ve.Provider,
151
151
  {
152
152
  value: {
@@ -158,11 +158,11 @@ function Ye({
158
158
  }
159
159
  );
160
160
  }
161
- function ze() {
162
- const r = Ae(ve);
161
+ function Ye() {
162
+ const r = qe(ve);
163
163
  return r || console.warn("useRootFormContext must be used within RootFormProvider"), r;
164
164
  }
165
- class er extends ke {
165
+ class ze extends Ae {
166
166
  constructor() {
167
167
  super(...arguments);
168
168
  D(this, "state", {
@@ -173,64 +173,64 @@ class er extends ke {
173
173
  return { hasError: !0 };
174
174
  }
175
175
  componentDidCatch(n, t) {
176
- var s, o;
176
+ var s, a;
177
177
  console.error(n, t);
178
- const a = new Error(
178
+ const o = new Error(
179
179
  `Form input [${this.props.inputType}] has failed at path [${this.props.path}]. Error: ${n}, Error info: ${t}`
180
180
  );
181
- (o = (s = this.props).inputErrorHandler) == null || o.call(s, a);
181
+ (a = (s = this.props).inputErrorHandler) == null || a.call(s, o);
182
182
  }
183
183
  render() {
184
- return this.state.hasError ? /* @__PURE__ */ y.jsx(y.Fragment, {}) : this.props.children;
184
+ return this.state.hasError ? /* @__PURE__ */ p.jsx(p.Fragment, {}) : this.props.children;
185
185
  }
186
186
  }
187
187
  const ce = ({
188
188
  children: r,
189
189
  withoutWrapper: e = !1
190
- }) => e || !r ? r : /* @__PURE__ */ y.jsx("div", { children: r }), rr = Ne(function({
190
+ }) => e || !r ? r : /* @__PURE__ */ p.jsx("div", { children: r }), er = ke(function({
191
191
  path: e,
192
192
  factory: n,
193
193
  onUpdate: t,
194
- onChange: a,
194
+ onChange: o,
195
195
  initialValues: s,
196
- input: o,
197
- withoutWrapper: i = !1
196
+ input: a,
197
+ withoutWrapper: u = !1
198
198
  }) {
199
199
  var Y, z, ee, re, te;
200
- const u = Ze(), { formState: c } = u, { fixedValues: f = {} } = {}, { metadata: m, readonly: l, inputErrorHandler: h } = ze(), p = n == null ? void 0 : n.getComponent(o.inputType), g = !!(o.isVisible || typeof o.disabled == "function" || typeof ((Y = o.validation) == null ? void 0 : Y.schema) == "function" || typeof ((z = o.warning) == null ? void 0 : z.schema) == "function"), x = !!((ee = o.warning) != null && ee.schema || (re = o.validation) != null && re.schema), E = g ? u.watch() : {}, T = x ? g ? Be(E, o.path) : u.watch(o.path) : void 0, C = $(() => {
200
+ const i = $e(), { formState: f } = i, { fixedValues: c = {} } = {}, { metadata: m, readonly: l, inputErrorHandler: h } = Ye(), y = n == null ? void 0 : n.getComponent(a.inputType), g = !!(a.isVisible || typeof a.disabled == "function" || typeof ((Y = a.validation) == null ? void 0 : Y.schema) == "function" || typeof ((z = a.warning) == null ? void 0 : z.schema) == "function"), x = !!((ee = a.warning) != null && ee.schema || (re = a.validation) != null && re.schema), E = g ? i.watch() : {}, O = x ? g ? Ze(E, a.path) : i.watch(a.path) : void 0, R = $(() => {
201
201
  if (!g) return {};
202
202
  let F = E;
203
- return f && Object.keys(f).forEach((N) => {
204
- const P = f[N];
203
+ return c && Object.keys(c).forEach((N) => {
204
+ const P = c[N];
205
205
  F = S(F, N, P);
206
206
  }), F;
207
- }, [g, E, f]), w = !o.isVisible || o.isVisible(C, m), b = l || o.readonly, R = typeof o.disabled == "function" ? o.disabled(C, m) : o.disabled, v = (te = o.warning) == null ? void 0 : te.schema, Q = $(() => {
207
+ }, [g, E, c]), C = !a.isVisible || a.isVisible(R, m), b = l || a.readonly, _ = typeof a.disabled == "function" ? a.disabled(R, m) : a.disabled, T = (te = a.warning) == null ? void 0 : te.schema, Q = $(() => {
208
208
  var se, ae;
209
- if (!w || typeof v > "u") return;
210
- const F = typeof v == "function" ? v(C, m) : v, { success: N, error: P } = F.safeParse(T), ne = (ae = (se = P == null ? void 0 : P.errors) == null ? void 0 : se[0]) == null ? void 0 : ae.message;
209
+ if (!C || typeof T > "u") return;
210
+ const F = typeof T == "function" ? T(R, m) : T, { success: N, error: P } = F.safeParse(O), ne = (ae = (se = P == null ? void 0 : P.errors) == null ? void 0 : se[0]) == null ? void 0 : ae.message;
211
211
  return !N && ne ? ne : void 0;
212
- }, [o.path, T, v, w, m]), X = $(
212
+ }, [a.path, O, T, C, m]), X = $(
213
213
  () => ({
214
214
  path: e,
215
215
  key: e,
216
216
  initialValues: s,
217
217
  onUpdate: t,
218
- onChange: a,
218
+ onChange: o,
219
219
  factory: n,
220
220
  readonly: b,
221
- input: o,
222
- disabled: R,
221
+ input: a,
222
+ disabled: _,
223
223
  warning: Q
224
224
  }),
225
- [n, s, o, a, t, e, b, c.errors, R, Q]
226
- ), Ce = $(() => w ? /* @__PURE__ */ y.jsxs(y.Fragment, { children: [
227
- o.before ? o.before : null,
228
- /* @__PURE__ */ y.jsx(er, { path: e, inputType: o.inputType, inputErrorHandler: h, children: p == null ? void 0 : p.renderComponent(X) }),
229
- o.after ? o.after : null
230
- ] }) : null, [w, o.before, o.inputType, o.after, e, p, X, c.errors]);
231
- return p ? /* @__PURE__ */ y.jsx(ce, { withoutWrapper: i, children: Ce }) : /* @__PURE__ */ y.jsx(ce, { withoutWrapper: i, children: /* @__PURE__ */ y.jsxs("p", { children: [
225
+ [n, s, a, o, t, e, b, f.errors, _, Q]
226
+ ), Re = $(() => C ? /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
227
+ a.before ? a.before : null,
228
+ /* @__PURE__ */ p.jsx(ze, { path: e, inputType: a.inputType, inputErrorHandler: h, children: y == null ? void 0 : y.renderComponent(X) }),
229
+ a.after ? a.after : null
230
+ ] }) : null, [C, a.before, a.inputType, a.after, e, y, X, f.errors]);
231
+ return y ? /* @__PURE__ */ p.jsx(ce, { withoutWrapper: u, children: Re }) : /* @__PURE__ */ p.jsx(ce, { withoutWrapper: u, children: /* @__PURE__ */ p.jsxs("p", { children: [
232
232
  "Input component not found (internal type: ",
233
- o.inputType,
233
+ a.inputType,
234
234
  ")"
235
235
  ] }) });
236
236
  });
@@ -255,36 +255,36 @@ function fe() {
255
255
  function le() {
256
256
  return typeof window < "u" && "cancelIdleCallback" in window ? window.cancelIdleCallback : clearTimeout;
257
257
  }
258
- function Rr(r) {
258
+ function Or(r) {
259
259
  const {
260
260
  mode: e = "onSubmit",
261
261
  resolver: n,
262
262
  defaultValues: t,
263
- shouldFocusError: a,
263
+ shouldFocusError: o,
264
264
  // validateAfterFirstSubmit,
265
265
  onValuesChange: s,
266
- onValidationChange: o,
267
- onSubmit: i,
268
- onInputRenderError: u,
266
+ onValidationChange: a,
267
+ onSubmit: u,
268
+ onInputRenderError: i,
269
269
  // validate,
270
270
  // validateDebounceInterval,
271
271
  // validationConfig,
272
- metadata: c,
273
- children: f,
272
+ metadata: f,
273
+ children: c,
274
274
  // fixedValues
275
275
  autoFocusPath: m,
276
276
  readonly: l
277
- } = r, h = We({
277
+ } = r, h = Be({
278
278
  mode: e,
279
279
  reValidateMode: "onChange",
280
280
  defaultValues: t,
281
- shouldFocusError: a,
281
+ shouldFocusError: o,
282
282
  resolver: n
283
- }), p = O(!1), g = O(JSON.stringify(t ?? {}));
283
+ }), y = w(!1), g = w(JSON.stringify(t ?? {}));
284
284
  I(() => {
285
285
  g.current = JSON.stringify(t ?? {}), h.reset(t, {});
286
286
  }, [h.reset, t]), I(() => {
287
- const b = fe(), R = le(), v = b(() => {
287
+ const b = fe(), _ = le(), T = b(() => {
288
288
  h.reset({}, {
289
289
  keepErrors: !0,
290
290
  keepDirty: !0,
@@ -298,79 +298,79 @@ function Rr(r) {
298
298
  keepSubmitCount: !0
299
299
  });
300
300
  });
301
- return () => R(v);
301
+ return () => _(T);
302
302
  }, []);
303
- const { handleSubmit: x } = h, E = O(s);
303
+ const { handleSubmit: x } = h, E = w(s);
304
304
  I(() => {
305
305
  E.current = s;
306
306
  }, [s]);
307
- const T = O(o);
307
+ const O = w(a);
308
308
  I(() => {
309
- T.current = o;
310
- }, [o]);
311
- const C = O(!1);
309
+ O.current = a;
310
+ }, [a]);
311
+ const R = w(!1);
312
312
  I(() => {
313
- const b = h.watch((R) => {
314
- var v;
315
- C.current || JSON.stringify(R ?? {}) !== g.current && ((v = E.current) == null || v.call(E, { ...R }), p.current === !0 && (C.current = !0, h.trigger().finally(() => {
316
- C.current = !1;
313
+ const b = h.watch((_) => {
314
+ var T;
315
+ R.current || JSON.stringify(_ ?? {}) !== g.current && ((T = E.current) == null || T.call(E, { ..._ }), y.current === !0 && (R.current = !0, h.trigger().finally(() => {
316
+ R.current = !1;
317
317
  })));
318
318
  });
319
319
  return () => {
320
320
  b.unsubscribe();
321
321
  };
322
322
  }, [h]);
323
- const w = O(!0);
323
+ const C = w(!0);
324
324
  return I(() => {
325
325
  var b;
326
- if (w.current) {
327
- w.current = !1;
326
+ if (C.current) {
327
+ C.current = !1;
328
328
  return;
329
329
  }
330
- (b = T.current) == null || b.call(T, { isValid: h.formState.isValid, isSubmitted: h.formState.isSubmitted });
330
+ (b = O.current) == null || b.call(O, { isValid: h.formState.isValid, isSubmitted: h.formState.isSubmitted });
331
331
  }, [h.formState.isValid, h.formState.isSubmitted]), I(() => {
332
332
  if (m) {
333
- const b = fe(), R = le(), v = b(() => {
333
+ const b = fe(), _ = le(), T = b(() => {
334
334
  h.setFocus(m);
335
335
  });
336
- return () => R(v);
336
+ return () => _(T);
337
337
  }
338
- }, [h, m]), /* @__PURE__ */ y.jsx(Ye, { metadata: c, readonly: l, inputErrorHandler: u, children: /* @__PURE__ */ y.jsx(Je, { ...h, children: typeof f == "function" ? f({
338
+ }, [h, m]), /* @__PURE__ */ p.jsx(Xe, { metadata: f, readonly: l, inputErrorHandler: i, children: /* @__PURE__ */ p.jsx(We, { ...h, children: typeof c == "function" ? c({
339
339
  ...h,
340
340
  submitForm: async () => {
341
- i && (p.current = !0, x((b) => {
342
- i(b);
341
+ u && (y.current = !0, x((b) => {
342
+ u(b);
343
343
  })());
344
344
  }
345
- }) : f }) });
345
+ }) : c }) });
346
346
  }
347
- const Tr = (r) => {
347
+ const Rr = (r) => {
348
348
  const e = {}, n = (t) => {
349
- t.forEach((a) => {
350
- const { path: s, default: o, inputs: i } = a;
351
- Array.isArray(i) ? n(i) : _(e, s) === void 0 && S(e, s, o);
349
+ t.forEach((o) => {
350
+ const { path: s, default: a, inputs: u } = o;
351
+ Array.isArray(u) ? n(u) : v(e, s) === void 0 && S(e, s, a);
352
352
  });
353
353
  };
354
354
  return Array.isArray(r.inputs) && n(r.inputs), e;
355
355
  };
356
356
  function Cr(r, e) {
357
357
  const n = r.inputs.map((t) => {
358
- const a = tr(e, t.path);
359
- return a || t;
358
+ const o = rr(e, t.path);
359
+ return o || t;
360
360
  });
361
361
  return { ...r, inputs: n };
362
362
  }
363
- function tr(r, e) {
363
+ function rr(r, e) {
364
364
  return r.inputs.find((n) => n.path === e);
365
365
  }
366
- const Ee = "__temp_", wr = (r) => Ee + r.split(".").join("__");
367
- function nr(r) {
366
+ const Te = "__temp_", Ir = (r) => Te + r.split(".").join("__");
367
+ function tr(r) {
368
368
  const e = { ...r };
369
369
  return me(e, (n, t) => {
370
- t.startsWith(Ee) && delete e[t];
370
+ t.startsWith(Te) && delete e[t];
371
371
  }), e;
372
372
  }
373
- const sr = "Required field";
373
+ const nr = "Required field";
374
374
  function q(r) {
375
375
  let e;
376
376
  if (typeof r == "string")
@@ -388,7 +388,7 @@ function q(r) {
388
388
  const n = e;
389
389
  return he(n) && (n != null && n.message) ? e == null ? void 0 : e.message : "Unknown error";
390
390
  }
391
- function ar(r, e, n) {
391
+ function sr(r, e, n) {
392
392
  let t = {};
393
393
  if (Z(t, r.inputs, e, n), n != null && n.prefix) {
394
394
  const s = n == null ? void 0 : n.prefix.replace(/.$/, "");
@@ -396,57 +396,57 @@ function ar(r, e, n) {
396
396
  }
397
397
  return d.object(A(t, e, n));
398
398
  }
399
- function or(r, e, n) {
400
- const t = Object.keys(r).filter((o) => /^\d+$/.test(o) && !o.startsWith("_")).map((o) => parseInt(o, 10)).sort((o, i) => o - i);
399
+ function ar(r, e, n) {
400
+ const t = Object.keys(r).filter((a) => /^\d+$/.test(a) && !a.startsWith("_")).map((a) => parseInt(a, 10)).sort((a, u) => a - u);
401
401
  if (t.length === 0) return null;
402
- const a = Math.max(...t), s = [];
403
- for (let o = 0; o <= a; o++)
404
- if (t.includes(o)) {
405
- const i = r[o], u = A({ item: i }, e, n);
406
- s.push(u.item || d.any().optional());
402
+ const o = Math.max(...t), s = [];
403
+ for (let a = 0; a <= o; a++)
404
+ if (t.includes(a)) {
405
+ const u = r[a], i = A({ item: u }, e, n);
406
+ s.push(i.item || d.any().optional());
407
407
  } else
408
408
  s.push(d.any().optional());
409
409
  return d.tuple(s).rest(d.any()).optional();
410
410
  }
411
411
  function A(r, e, n) {
412
412
  const t = {};
413
- return Object.keys(r).forEach((a) => {
413
+ return Object.keys(r).forEach((o) => {
414
414
  const {
415
415
  _requiredOnly: s,
416
- _schemaObj: o,
417
- _input: i,
418
- _isList: u,
419
- _isArrayItem: c,
420
- _isTuple: f,
416
+ _schemaObj: a,
417
+ _input: u,
418
+ _isList: i,
419
+ _isArrayItem: f,
420
+ _isTuple: c,
421
421
  _schema: m
422
422
  /*...nestedSchemaObj*/
423
- } = r[a];
424
- if (f && !u && !c) {
425
- const l = or(r[a], e, n);
423
+ } = r[o];
424
+ if (c && !i && !f) {
425
+ const l = ar(r[o], e, n);
426
426
  if (l) {
427
- t[a] = l;
427
+ t[o] = l;
428
428
  return;
429
429
  }
430
430
  }
431
- if (u && o && i) {
432
- const l = d.object(A(o, e, n)), h = d.union([
431
+ if (i && a && u) {
432
+ const l = d.object(A(a, e, n)), h = d.union([
433
433
  d.array(l).optional(),
434
- Se(i, n)
435
- ]), p = de(m, i, e, n, h);
436
- t[a] = p;
437
- } else if (c && i) {
438
- const l = o != null && o.___array ? A({ ___array: o.___array }, e, n) : { ___array: d.any() }, h = ir(l, i, n), p = de(m, i, e, n, h);
439
- t[a] = p;
440
- } else if (m && i) {
441
- const l = ur(m, i, e, n);
442
- t[a] = l;
443
- } else s && i ? t[a] = G(i, n) : t[a] = d.object(A(r[a], e, n)).optional();
434
+ Ee(u, n)
435
+ ]), y = de(m, u, e, n, h);
436
+ t[o] = y;
437
+ } else if (f && u) {
438
+ const l = a != null && a.___array ? A({ ___array: a.___array }, e, n) : { ___array: d.any() }, h = or(l, u, n), y = de(m, u, e, n, h);
439
+ t[o] = y;
440
+ } else if (m && u) {
441
+ const l = ur(m, u, e, n);
442
+ t[o] = l;
443
+ } else s && u ? t[o] = G(u, n) : t[o] = d.object(A(r[o], e, n)).optional();
444
444
  }), t;
445
445
  }
446
- function Se(r, e) {
446
+ function Ee(r, e) {
447
447
  return d.string().superRefine((n, t) => {
448
- var a;
449
- if ((a = e == null ? void 0 : e.validationConfig) != null && a.globalValidation) {
448
+ var o;
449
+ if ((o = e == null ? void 0 : e.validationConfig) != null && o.globalValidation) {
450
450
  const s = e.validationConfig.globalValidation(n, r, e.metadata);
451
451
  if (s.error)
452
452
  return t.addIssue({
@@ -459,32 +459,32 @@ function Se(r, e) {
459
459
  return !0;
460
460
  });
461
461
  }
462
- function ir(r, e, n) {
463
- return d.union([d.array(r.___array).optional(), Se(e, n)]);
462
+ function or(r, e, n) {
463
+ return d.union([d.array(r.___array).optional(), Ee(e, n)]);
464
464
  }
465
465
  function ur(r, e, n, t) {
466
- return d.any().optional().superRefine(async (a, s) => {
467
- var i, u;
468
- if (e.required && !(await G(e, t).safeParseAsync(a)).success)
466
+ return d.any().optional().superRefine(async (o, s) => {
467
+ var u, i;
468
+ if (e.required && !(await G(e, t).safeParseAsync(o)).success)
469
469
  return s.addIssue({
470
470
  code: d.ZodIssueCode.custom,
471
471
  message: U(e, t)
472
472
  }), d.NEVER;
473
- if ((i = t == null ? void 0 : t.validationConfig) != null && i.globalValidation) {
474
- const c = (u = t == null ? void 0 : t.validationConfig) == null ? void 0 : u.globalValidation(a, e, t.metadata);
475
- if (c.error)
473
+ if ((u = t == null ? void 0 : t.validationConfig) != null && u.globalValidation) {
474
+ const f = (i = t == null ? void 0 : t.validationConfig) == null ? void 0 : i.globalValidation(o, e, t.metadata);
475
+ if (f.error)
476
476
  return s.addIssue({
477
477
  code: d.ZodIssueCode.custom,
478
- message: c.error
478
+ message: f.error
479
479
  }), d.NEVER;
480
- if (!c.continue)
480
+ if (!f.continue)
481
481
  return !0;
482
482
  }
483
- const o = _e(r, n);
484
- if (o) {
485
- const c = await o.safeParseAsync(a);
486
- if (!c.success) {
487
- const f = q(c == null ? void 0 : c.error.message), m = f === "Required" ? U(e, t) : f;
483
+ const a = Se(r, n);
484
+ if (a) {
485
+ const f = await a.safeParseAsync(o);
486
+ if (!f.success) {
487
+ const c = q(f == null ? void 0 : f.error.message), m = c === "Required" ? U(e, t) : c;
488
488
  s.addIssue({
489
489
  code: d.ZodIssueCode.custom,
490
490
  message: m
@@ -493,20 +493,20 @@ function ur(r, e, n, t) {
493
493
  }
494
494
  });
495
495
  }
496
- function de(r, e, n, t, a) {
497
- return d.any().optional().superRefine(async (s, o) => {
498
- var f, m;
499
- const u = await G(e, t).safeParseAsync(s);
500
- if (e.required && !u.success) {
501
- const l = q(u.error.message);
502
- return o.addIssue({ code: d.ZodIssueCode.custom, message: l, fatal: !0 }), d.NEVER;
496
+ function de(r, e, n, t, o) {
497
+ return d.any().optional().superRefine(async (s, a) => {
498
+ var c, m;
499
+ const i = await G(e, t).safeParseAsync(s);
500
+ if (e.required && !i.success) {
501
+ const l = q(i.error.message);
502
+ return a.addIssue({ code: d.ZodIssueCode.custom, message: l, fatal: !0 }), d.NEVER;
503
503
  }
504
- if (!e.required && !u.success)
504
+ if (!e.required && !i.success)
505
505
  return d.NEVER;
506
- if ((f = t == null ? void 0 : t.validationConfig) != null && f.globalValidation) {
506
+ if ((c = t == null ? void 0 : t.validationConfig) != null && c.globalValidation) {
507
507
  const l = (m = t == null ? void 0 : t.validationConfig) == null ? void 0 : m.globalValidation(s, e, t.metadata);
508
508
  if (l.error)
509
- return o.addIssue({
509
+ return a.addIssue({
510
510
  code: d.ZodIssueCode.custom,
511
511
  message: q(l.error)
512
512
  }), d.NEVER;
@@ -514,46 +514,46 @@ function de(r, e, n, t, a) {
514
514
  return !0;
515
515
  }
516
516
  if (!j(s))
517
- return o.addIssue({
517
+ return a.addIssue({
518
518
  code: d.ZodIssueCode.custom,
519
519
  message: "'Value is not array'"
520
520
  }), d.NEVER;
521
- const c = _e(r, n);
522
- if (c) {
523
- const l = await c.safeParseAsync(s);
521
+ const f = Se(r, n);
522
+ if (f) {
523
+ const l = await f.safeParseAsync(s);
524
524
  if (!l.success)
525
- return o.addIssue({
525
+ return a.addIssue({
526
526
  code: d.ZodIssueCode.custom,
527
527
  message: q(l.error.message)
528
528
  }), d.NEVER;
529
529
  }
530
- }).pipe(a ?? d.any());
530
+ }).pipe(o ?? d.any());
531
531
  }
532
- function Z(r, e, n, t, a) {
532
+ function Z(r, e, n, t, o) {
533
533
  e.forEach((s) => {
534
- var i, u, c, f, m, l, h;
535
- const o = n;
536
- if (!s.isVisible || (i = s.isVisible) != null && i.call(s, o, t == null ? void 0 : t.metadata)) {
537
- const p = _(r, s.path);
538
- if ((u = s.validation) != null && u.schema ? S(
534
+ var u, i, f, c, m, l, h;
535
+ const a = n;
536
+ if (!s.isVisible || (u = s.isVisible) != null && u.call(s, a, t == null ? void 0 : t.metadata)) {
537
+ const y = v(r, s.path);
538
+ if ((i = s.validation) != null && i.schema ? S(
539
539
  r,
540
540
  s.path,
541
- M(p, {
542
- _schema: (c = s.validation) == null ? void 0 : c.schema,
541
+ M(y, {
542
+ _schema: (f = s.validation) == null ? void 0 : f.schema,
543
543
  _input: s
544
544
  })
545
- ) : s.required && S(r, s.path, M(p, { _requiredOnly: !0, _input: s })), s.inputs && Z(r, s.inputs, n, t), s.inputType === "list") {
545
+ ) : s.required && S(r, s.path, M(y, { _requiredOnly: !0, _input: s })), s.inputs && Z(r, s.inputs, n, t), s.inputType === "list") {
546
546
  const g = {};
547
547
  Z(
548
548
  g,
549
- (m = (f = s.inputConfig) == null ? void 0 : f.inputs) == null ? void 0 : m.map((E) => ({
549
+ (m = (c = s.inputConfig) == null ? void 0 : c.inputs) == null ? void 0 : m.map((E) => ({
550
550
  ...E,
551
551
  path: E.relativePath
552
552
  })),
553
553
  n,
554
554
  t
555
555
  );
556
- const x = _(r, s.path);
556
+ const x = v(r, s.path);
557
557
  S(r, s.path, M(x, { _schemaObj: g, _isList: !0, _input: s }));
558
558
  }
559
559
  if (!((l = s.validation) != null && l.schema) && s.inputType === "array") {
@@ -566,7 +566,7 @@ function Z(r, e, n, t, a) {
566
566
  ), S(
567
567
  r,
568
568
  s.path,
569
- M(p, {
569
+ M(y, {
570
570
  _schemaObj: g,
571
571
  _schema: (h = s.validation) == null ? void 0 : h.schema,
572
572
  _isArrayItem: !0,
@@ -576,13 +576,13 @@ function Z(r, e, n, t, a) {
576
576
  }
577
577
  }
578
578
  }), e.forEach((s) => {
579
- var i;
580
- const o = n;
581
- if ((!s.isVisible || (i = s.isVisible) != null && i.call(s, o, t == null ? void 0 : t.metadata)) && s.path) {
582
- const u = s.path.split(".");
583
- u.forEach((c, f) => {
584
- if (f > 0 && /^\d+$/.test(c)) {
585
- const m = u.slice(0, f).join("."), l = m ? _(r, m) : r;
579
+ var u;
580
+ const a = n;
581
+ if ((!s.isVisible || (u = s.isVisible) != null && u.call(s, a, t == null ? void 0 : t.metadata)) && s.path) {
582
+ const i = s.path.split(".");
583
+ i.forEach((f, c) => {
584
+ if (c > 0 && /^\d+$/.test(f)) {
585
+ const m = i.slice(0, c).join("."), l = m ? v(r, m) : r;
586
586
  l && typeof l == "object" && (l._isTuple = !0);
587
587
  }
588
588
  });
@@ -590,73 +590,73 @@ function Z(r, e, n, t, a) {
590
590
  });
591
591
  }
592
592
  function U(r, e) {
593
- var n, t, a;
594
- return ((t = (n = e == null ? void 0 : e.validationConfig) == null ? void 0 : n.requiredMessagePerInput) == null ? void 0 : t[r.inputType]) ?? ((a = e == null ? void 0 : e.validationConfig) == null ? void 0 : a.requiredMessage) ?? sr;
593
+ var n, t, o;
594
+ return ((t = (n = e == null ? void 0 : e.validationConfig) == null ? void 0 : n.requiredMessagePerInput) == null ? void 0 : t[r.inputType]) ?? ((o = e == null ? void 0 : e.validationConfig) == null ? void 0 : o.requiredMessage) ?? nr;
595
595
  }
596
596
  function G(r, e) {
597
- var t, a, s, o, i, u;
598
- if ((a = (t = e == null ? void 0 : e.validationConfig) == null ? void 0 : t.requiredSchemaPerInput) != null && a[r.inputType])
599
- return (o = (s = e == null ? void 0 : e.validationConfig) == null ? void 0 : s.requiredSchemaPerInput) == null ? void 0 : o[r.inputType];
600
- if ((i = e == null ? void 0 : e.validationConfig) != null && i.requiredSchema)
601
- return (u = e == null ? void 0 : e.validationConfig) == null ? void 0 : u.requiredSchema;
597
+ var t, o, s, a, u, i;
598
+ if ((o = (t = e == null ? void 0 : e.validationConfig) == null ? void 0 : t.requiredSchemaPerInput) != null && o[r.inputType])
599
+ return (a = (s = e == null ? void 0 : e.validationConfig) == null ? void 0 : s.requiredSchemaPerInput) == null ? void 0 : a[r.inputType];
600
+ if ((u = e == null ? void 0 : e.validationConfig) != null && u.requiredSchema)
601
+ return (i = e == null ? void 0 : e.validationConfig) == null ? void 0 : i.requiredSchema;
602
602
  const n = U(r, e);
603
- return d.any().optional().superRefine((c, f) => {
604
- typeof c == "object" && k(c) && f.addIssue({
603
+ return d.any().optional().superRefine((f, c) => {
604
+ typeof f == "object" && k(f) && c.addIssue({
605
605
  code: d.ZodIssueCode.custom,
606
606
  message: n
607
- }), (B(c) || c === "") && f.addIssue({
607
+ }), (W(f) || f === "") && c.addIssue({
608
608
  code: d.ZodIssueCode.custom,
609
609
  message: n
610
610
  });
611
611
  });
612
612
  }
613
- function _e(r, e) {
613
+ function Se(r, e) {
614
614
  if (r instanceof d.ZodType)
615
615
  return r;
616
616
  if (typeof r == "function")
617
617
  return r(e);
618
618
  }
619
- const cr = (r) => Array.isArray(r == null ? void 0 : r.errors), fr = (r, e) => {
619
+ const ir = (r) => Array.isArray(r == null ? void 0 : r.errors), cr = (r, e) => {
620
620
  const n = {};
621
621
  for (; r.length; ) {
622
- const t = r[0], { code: a, message: s, path: o } = t, i = o.join(".");
623
- if (!n[i])
622
+ const t = r[0], { code: o, message: s, path: a } = t, u = a.join(".");
623
+ if (!n[u])
624
624
  if ("unionErrors" in t) {
625
- const u = t.unionErrors[0].errors[0];
626
- n[i] = {
627
- message: u.message,
628
- type: u.code
625
+ const i = t.unionErrors[0].errors[0];
626
+ n[u] = {
627
+ message: i.message,
628
+ type: i.code
629
629
  };
630
630
  } else
631
- n[i] = { message: s, type: a };
632
- "unionErrors" in t && t.unionErrors.forEach((u) => u.errors.forEach((c) => r.push(c)));
631
+ n[u] = { message: s, type: o };
632
+ "unionErrors" in t && t.unionErrors.forEach((i) => i.errors.forEach((f) => r.push(f)));
633
633
  {
634
- const u = n[i].types, c = u && u[t.code];
635
- n[i] = Ue(
636
- i,
634
+ const i = n[u].types, f = i && i[t.code];
635
+ n[u] = Je(
636
+ u,
637
637
  e,
638
638
  n,
639
- a,
640
- c ? [].concat(c, t.message) : t.message
639
+ o,
640
+ f ? [].concat(f, t.message) : t.message
641
641
  );
642
642
  }
643
643
  r.shift();
644
644
  }
645
645
  return n;
646
646
  };
647
- function Ir(r, e) {
648
- return De(
649
- async (n, t, a) => {
647
+ function wr(r, e) {
648
+ return Ne(
649
+ async (n, t, o) => {
650
650
  try {
651
- return await ar(r, n, e).parseAsync(n), {
651
+ return await sr(r, n, e).parseAsync(n), {
652
652
  values: n,
653
653
  errors: {}
654
654
  };
655
655
  } catch (s) {
656
- if (cr(s))
656
+ if (ir(s))
657
657
  return {
658
658
  values: {},
659
- errors: He(fr(s.errors, !0), a)
659
+ errors: Ue(cr(s.errors, !0), o)
660
660
  };
661
661
  throw s;
662
662
  }
@@ -664,249 +664,279 @@ function Ir(r, e) {
664
664
  [r, e]
665
665
  );
666
666
  }
667
- function lr(r, e) {
668
- const n = H(r);
667
+ function fr(r, e) {
668
+ const n = B(r);
669
669
  return e.forEach((t) => {
670
670
  t.inputTransform && (j(t.inputTransform) ? t.inputTransform : [t.inputTransform]).forEach((s) => {
671
- const o = _(n, t.path), i = s(o, n);
671
+ let a;
672
+ const u = t.path.split(".");
673
+ if (u.length > 1) {
674
+ const f = u.slice(0, -1).join("."), c = v(n, f);
675
+ typeof c == "string" || typeof c == "number" || typeof c == "boolean" ? a = void 0 : a = v(n, t.path);
676
+ } else
677
+ a = v(n, t.path);
678
+ const i = s(a, n);
672
679
  i && S(n, i.path ?? t.path, i.value);
673
680
  });
674
681
  }), n;
675
682
  }
676
- function dr(r, e) {
677
- const n = [], t = H(r);
683
+ function lr(r, e, n) {
684
+ const t = [];
685
+ let o = {};
686
+ n || (o = B(r));
687
+ const s = B(r);
678
688
  return e.forEach((a) => {
679
- a.outputTransform && (j(a.outputTransform) ? a.outputTransform : [a.outputTransform]).forEach((o) => {
680
- const i = _(t, a.path), u = o(i, t);
681
- u && (u.path ? (S(t, u.path, u.value), u.unset && n.push(a.path)) : S(t, a.path, u.value));
689
+ a.outputTransform && (j(a.outputTransform) ? a.outputTransform : [a.outputTransform]).forEach((i) => {
690
+ const f = v(s, a.path), c = i(f, s);
691
+ c && (c.path ? (S(o, c.path, c.value), c.unset && t.push(a.path)) : S(o, a.path, c.value));
682
692
  });
683
- }), n.forEach((a) => {
684
- ye(t, a);
685
- }), t;
693
+ }), t.forEach((a) => {
694
+ pe(o, a);
695
+ }), o;
686
696
  }
687
697
  function K(r) {
688
698
  return r.reduce((n, t) => Array.isArray(t.inputs) ? [...n, t, ...K(t.inputs)] : [...n, t], []);
689
699
  }
690
- function Re(r) {
691
- const n = K(r.inputs).reduce((t, a) => {
692
- const s = a.inputType === "text" || a.inputType === "boolean" || a.inputType === "number" || a.inputType === "textarea" || a.inputType === "select";
693
- return (a.inputTransform || a.outputTransform) && t.push({
694
- ...Oe(a, "path", "inputTransform", "outputTransform"),
695
- level: a.path.split(".").length,
696
- isPrimitive: s
697
- }), t;
700
+ const dr = (r) => {
701
+ if (r !== void 0)
702
+ return { value: r };
703
+ }, mr = (r) => {
704
+ if (r !== void 0)
705
+ return { value: r };
706
+ };
707
+ function _e(r, e) {
708
+ const t = K(r.inputs).reduce((o, s) => {
709
+ const a = s.inputType === "text" || s.inputType === "boolean" || s.inputType === "number" || s.inputType === "textarea" || s.inputType === "select", u = !!s.inputTransform, i = !!s.outputTransform, f = Array.isArray(s.inputs) && s.inputs.length > 0, c = s.inputType === "list" || s.inputType === "array";
710
+ return u || i ? o.push({
711
+ path: s.path,
712
+ inputTransform: s.inputTransform,
713
+ outputTransform: s.outputTransform,
714
+ level: s.path.split(".").length,
715
+ isPrimitive: a
716
+ }) : e && !(f || c) && o.push({
717
+ path: s.path,
718
+ inputTransform: dr,
719
+ outputTransform: mr,
720
+ level: s.path.split(".").length,
721
+ isPrimitive: a
722
+ }), o;
698
723
  }, []);
699
- return n.sort((t, a) => t.level === a.level ? t.isPrimitive ? 1 : -1 : t.level > a.level ? -1 : 1), n;
724
+ return t.sort((o, s) => o.level === s.level ? o.isPrimitive ? 1 : -1 : o.level < s.level ? -1 : 1), t;
700
725
  }
701
- function mr(r, e, n, t = {}) {
702
- const { preserve: a } = t, s = K(r.inputs), o = H(e);
703
- return s.forEach((i) => {
704
- a && a.includes(i.path) || i.isVisible && !i.isVisible(e, n) && ye(o, i.path);
705
- }), o;
726
+ function hr(r, e, n, t = {}) {
727
+ const { preserve: o } = t, s = K(r.inputs), a = B(e);
728
+ return s.forEach((u) => {
729
+ o && o.includes(u.path) || u.isVisible && !u.isVisible(e, n) && pe(a, u.path);
730
+ }), a;
706
731
  }
707
- function Or(r, e) {
708
- const n = Re(e);
709
- return lr(r, n);
732
+ function jr(r, e) {
733
+ const n = _e(e);
734
+ return fr(r, n);
710
735
  }
711
- function jr(r, e, n, t = {}) {
712
- const a = Re(e);
713
- let s = mr(e, r, n, t);
714
- return s = dr(s, a), s = nr(s), s;
736
+ function Vr(r, e, n, t = {}) {
737
+ const o = t.cleanOutput, s = _e(e, o);
738
+ let a = hr(e, r, n, t);
739
+ return a = lr(a, s, t.cleanOutput), a = tr(a), a;
715
740
  }
716
- function Vr(r) {
741
+ function xr(r) {
717
742
  const e = {}, n = (t) => {
718
- t.forEach((a) => {
719
- const { default: s, path: o, inputs: i } = a;
720
- Array.isArray(i) ? n(i) : s !== void 0 && S(e, o, s);
743
+ t.forEach((o) => {
744
+ const { default: s, path: a, inputs: u } = o;
745
+ Array.isArray(u) ? n(u) : s !== void 0 && S(e, a, s);
721
746
  });
722
747
  };
723
748
  return Array.isArray(r.inputs) && n(r.inputs), e;
724
749
  }
725
- function xr() {
750
+ function Fr() {
726
751
  return function(r, e) {
727
752
  if (!(typeof r > "u"))
728
- return !r || !je(r) ? { value: r } : {
753
+ return !r || !we(r) ? { value: r } : {
729
754
  value: Object.getOwnPropertyNames(r).map((n) => ({ key: n, value: r[n] }))
730
755
  };
731
756
  };
732
757
  }
733
- function Fr(r) {
758
+ function Pr(r) {
734
759
  return function(e, n) {
735
760
  if (typeof e > "u") return;
736
761
  if (!e || !j(e)) return { value: e };
737
762
  const t = {
738
- value: e.reduce((a, s) => ({
739
- ...a,
763
+ value: e.reduce((o, s) => ({
764
+ ...o,
740
765
  [s.key]: r != null && r.assignKeyToValue ? s.key : s.value ?? (r == null ? void 0 : r.fallbackValue)
741
766
  }), {})
742
767
  };
743
768
  return r != null && r.unsetIfEmpty && Object.getOwnPropertyNames(t.value).length === 0 ? { value: void 0 } : t;
744
769
  };
745
770
  }
746
- function Pr() {
771
+ function qr() {
747
772
  return function(r, e) {
748
773
  if (!(typeof r > "u"))
749
774
  return j(r) && k(r) ? { value: void 0 } : { value: r };
750
775
  };
751
776
  }
752
- function qr(r) {
777
+ function Ar(r) {
753
778
  return function(e, n) {
754
- const t = r ? _(n, r) : e;
779
+ const t = r ? v(n, r) : e;
755
780
  if (!(typeof t > "u")) {
756
- if (pe(t)) return { value: void 0, path: r };
781
+ if (ye(t)) return { value: void 0, path: r };
757
782
  if (he(t)) {
758
- const a = ge(t, Ve);
759
- if (k(a))
783
+ const o = ge(t, je);
784
+ if (k(o))
760
785
  return { value: void 0, path: r };
761
786
  }
762
787
  return { value: t, path: r };
763
788
  }
764
789
  };
765
790
  }
766
- function Ar() {
791
+ function kr() {
767
792
  return function(r, e) {
768
793
  if (!(typeof r > "u"))
769
- return xe(r) && k(r) ? { value: void 0 } : { value: r };
794
+ return Ve(r) && k(r) ? { value: void 0 } : { value: r };
770
795
  };
771
796
  }
772
- function kr(r) {
797
+ function Nr(r) {
773
798
  return function(e, n) {
774
- const t = _(n, r);
775
- return typeof t == "string" ? { value: t } : { value: e };
799
+ const t = v(n, r);
800
+ if (typeof t == "string")
801
+ return { value: t };
802
+ if (!(typeof t == "number" || typeof t == "boolean") && e !== void 0)
803
+ return { value: e };
776
804
  };
777
805
  }
778
- function Nr(r) {
806
+ function Dr(r) {
779
807
  return function(e, n) {
780
808
  if (typeof e > "u") return;
781
809
  if (!e) return { value: e };
782
- const t = _(n, r);
810
+ const t = v(n, r);
783
811
  if (typeof t == "object") {
784
- const a = hr(t);
785
- if (Object.getOwnPropertyNames(a).length === 1)
812
+ const o = pr(t);
813
+ if (Object.getOwnPropertyNames(o).length === 1)
786
814
  return { value: e, path: r };
787
815
  }
788
816
  return { value: e };
789
817
  };
790
818
  }
791
- function Dr(r) {
819
+ function Mr(r) {
792
820
  return function(e, n) {
793
- if (typeof e > "u") return;
794
- const t = _(n, r);
795
- return typeof t == "string" ? { value: [t] } : { value: e };
821
+ const t = v(n, r);
822
+ if (typeof t == "string")
823
+ return { value: [t] };
824
+ if (!(typeof t == "number" || typeof t == "boolean") && e !== void 0)
825
+ return { value: e };
796
826
  };
797
827
  }
798
- function Mr(r, e) {
828
+ function $r(r, e) {
799
829
  return function(n, t) {
800
830
  if (typeof n > "u") return;
801
831
  if (!n) return { value: n };
802
- const a = _(t, r);
803
- if (j(a)) {
804
- if (a.length === 1)
805
- return { value: a[0], path: r };
806
- if (a.length === 0 && e != null && e.unsetIfEmpty)
832
+ const o = v(t, r);
833
+ if (j(o)) {
834
+ if (o.length === 1)
835
+ return { value: o[0], path: r };
836
+ if (o.length === 0 && e != null && e.unsetIfEmpty)
807
837
  return { value: void 0, path: r };
808
838
  }
809
839
  return { value: n };
810
840
  };
811
841
  }
812
- function Te(r) {
813
- return typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !Te(r[e])) : B(r);
842
+ function Oe(r) {
843
+ return typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !Oe(r[e])) : W(r);
814
844
  }
815
- function hr(r) {
816
- return ge(r, (e) => typeof e == "object" ? Te(e) : B(e));
845
+ function pr(r) {
846
+ return ge(r, (e) => typeof e == "object" ? Oe(e) : W(e));
817
847
  }
818
- function L(r) {
819
- const { items: e, className: n, withoutWrapper: t = !0, ...a } = r, s = e.map((o) => /* @__PURE__ */ y.jsx(rr, { input: o, path: o.path, ...a }, `${o.inputType}_${o.path}`));
820
- return t ? /* @__PURE__ */ y.jsx(y.Fragment, { children: s }) : /* @__PURE__ */ y.jsx("div", { className: n, children: s });
848
+ function H(r) {
849
+ const { items: e, className: n, withoutWrapper: t = !0, ...o } = r, s = e.map((a) => /* @__PURE__ */ p.jsx(er, { input: a, path: a.path, ...o }, `${a.inputType}_${a.path}`));
850
+ return t ? /* @__PURE__ */ p.jsx(p.Fragment, { children: s }) : /* @__PURE__ */ p.jsx("div", { className: n, children: s });
821
851
  }
822
- L.displayName = "RenderInputs";
823
- const yr = Me((r, e) => {
824
- const { inputs: n, className: t, factory: a, withoutWrapper: s } = r;
825
- return s ? /* @__PURE__ */ y.jsxs($e, { children: [
852
+ H.displayName = "RenderInputs";
853
+ const yr = De((r, e) => {
854
+ const { inputs: n, className: t, factory: o, withoutWrapper: s } = r;
855
+ return s ? /* @__PURE__ */ p.jsxs(Me, { children: [
826
856
  n.hero,
827
- /* @__PURE__ */ y.jsx(L, { items: n.inputs, factory: a })
828
- ] }) : /* @__PURE__ */ y.jsxs("div", { className: t, ref: e, children: [
857
+ /* @__PURE__ */ p.jsx(H, { items: n.inputs, factory: o })
858
+ ] }) : /* @__PURE__ */ p.jsxs("div", { className: t, ref: e, children: [
829
859
  n.hero,
830
- /* @__PURE__ */ y.jsx(L, { items: n.inputs, factory: a })
860
+ /* @__PURE__ */ p.jsx(H, { items: n.inputs, factory: o })
831
861
  ] });
832
862
  });
833
863
  yr.displayName = "RenderForm";
834
- function $r(r) {
864
+ function Zr(r) {
835
865
  let e = !0;
836
866
  return me(r, (n) => {
837
- e = e && (n === "" || pe(n) || B(n));
867
+ e = e && (n === "" || ye(n) || W(n));
838
868
  }), e;
839
869
  }
840
- const Zr = (r = "") => Fe(r.split("_").join(" ")), pr = (r, e = 2, n, t = 1e3) => {
841
- let a = !1;
870
+ const Br = (r = "") => xe(r.split("_").join(" ")), gr = (r, e = 2, n, t = 1e3) => {
871
+ let o = !1;
842
872
  const s = () => {
843
873
  requestAnimationFrame(() => {
844
- a || (e -= 1, e <= 0 ? r() : s());
874
+ o || (e -= 1, e <= 0 ? r() : s());
845
875
  });
846
876
  };
847
877
  return n && Date.now() - n <= t ? (r(), () => {
848
878
  }) : (s(), () => {
849
- a = !0;
879
+ o = !0;
850
880
  });
851
881
  };
852
- function Br(r) {
882
+ function Wr(r) {
853
883
  const {
854
884
  field: { onBlur: e, ...n },
855
885
  ...t
856
- } = Le(r), a = O(Date.now());
886
+ } = Le(r), o = w(Date.now());
857
887
  return {
858
888
  ...t,
859
889
  field: {
860
890
  ...n,
861
- onBlur: pr(e, 2, a.current)
891
+ onBlur: gr(e, 2, o.current)
862
892
  }
863
893
  };
864
894
  }
865
895
  export {
866
896
  Ur as Controller,
867
- Lr as Form,
868
- Hr as FormProvider,
897
+ Hr as Form,
898
+ Gr as FormProvider,
869
899
  _r as InputComponent,
870
- rr as InputComponentRenderer,
900
+ er as InputComponentRenderer,
871
901
  be as InputFactory,
872
- Ge as InputOverrideError,
902
+ He as InputOverrideError,
873
903
  yr as RenderForm,
874
- L as RenderInputs,
875
- Rr as RootForm,
876
- pr as afterFrames,
877
- Fr as arrayToObjectOutputTransformer,
878
- Vr as collectDefaultValues,
879
- Or as convertDataToFormModel,
880
- jr as convertFormModelToData,
881
- Zr as generateReadableLabel,
882
- Gr as get,
883
- Tr as getDefaultValuesFromFormDefinition,
884
- wr as getTemporaryPath,
885
- Re as getTransformers,
886
- ar as getValidationSchema,
887
- lr as inputTransformValues,
888
- $r as isChildrenEmpty,
889
- xr as objectToArrayInputTransformer,
890
- dr as outputTransformValues,
904
+ H as RenderInputs,
905
+ Or as RootForm,
906
+ gr as afterFrames,
907
+ Pr as arrayToObjectOutputTransformer,
908
+ xr as collectDefaultValues,
909
+ jr as convertDataToFormModel,
910
+ Vr as convertFormModelToData,
911
+ Br as generateReadableLabel,
912
+ Kr as get,
913
+ Rr as getDefaultValuesFromFormDefinition,
914
+ Ir as getTemporaryPath,
915
+ _e as getTransformers,
916
+ sr as getValidationSchema,
917
+ fr as inputTransformValues,
918
+ Zr as isChildrenEmpty,
919
+ Fr as objectToArrayInputTransformer,
920
+ lr as outputTransformValues,
891
921
  Cr as overrideFormDefinition,
892
922
  q as processValidationParseResponse,
893
- nr as removeTemporaryFieldsValue,
894
- Kr as set,
895
- Dr as shorthandArrayInputTransformer,
896
- Mr as shorthandArrayOutputTransformer,
897
- kr as shorthandObjectInputTransformer,
898
- Nr as shorthandObjectOutputTransformer,
899
- Pr as unsetEmptyArrayOutputTransformer,
900
- qr as unsetEmptyObjectOutputTransformer,
901
- Ar as unsetEmptyStringOutputTransformer,
902
- mr as unsetHiddenInputsValues,
903
- Br as useController,
904
- Qr as useFieldArray,
905
- Xr as useForm,
906
- Yr as useFormContext,
907
- zr as useFormState,
908
- ze as useRootFormContext,
909
- et as useWatch,
910
- Ir as useZodValidationResolver
923
+ tr as removeTemporaryFieldsValue,
924
+ Qr as set,
925
+ Mr as shorthandArrayInputTransformer,
926
+ $r as shorthandArrayOutputTransformer,
927
+ Nr as shorthandObjectInputTransformer,
928
+ Dr as shorthandObjectOutputTransformer,
929
+ qr as unsetEmptyArrayOutputTransformer,
930
+ Ar as unsetEmptyObjectOutputTransformer,
931
+ kr as unsetEmptyStringOutputTransformer,
932
+ hr as unsetHiddenInputsValues,
933
+ Wr as useController,
934
+ Xr as useFieldArray,
935
+ Yr as useForm,
936
+ zr as useFormContext,
937
+ et as useFormState,
938
+ Ye as useRootFormContext,
939
+ rt as useWatch,
940
+ wr as useZodValidationResolver
911
941
  };
912
942
  //# sourceMappingURL=index.js.map