@paragrav/rhf-utils 0.0.23 → 0.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/_virtual/_commonjsHelpers.mjs +8 -0
  2. package/dist/_virtual/index.mjs +4 -0
  3. package/dist/devtool/LazyDevTool.d.ts +11 -0
  4. package/dist/devtool/LazyDevTool.mjs +16 -0
  5. package/dist/errors/getFlatFieldErrors.mjs +11 -11
  6. package/dist/errors/isFieldError.d.ts +7 -0
  7. package/dist/errors/isFieldError.mjs +4 -0
  8. package/dist/errors/message/FormErrorMessage.d.ts +8 -0
  9. package/dist/errors/message/FormErrorMessage.mjs +14 -0
  10. package/dist/errors/message/FormErrorMessageByPath.d.ts +9 -0
  11. package/dist/errors/message/FormErrorMessageByPath.mjs +17 -0
  12. package/dist/errors/nonfield/{utils.d.ts → isNonFieldError.d.ts} +3 -2
  13. package/dist/errors/nonfield/isNonFieldError.mjs +5 -0
  14. package/dist/errors/orphan/getOrphanFlatFieldErrors.d.ts +5 -0
  15. package/dist/errors/orphan/{utils.mjs → getOrphanFlatFieldErrors.mjs} +7 -7
  16. package/dist/errors/orphan/useFormHasOrphanAndNoFieldErrors.d.ts +9 -0
  17. package/dist/errors/orphan/useFormHasOrphanAndNoFieldErrors.mjs +10 -0
  18. package/dist/errors/orphan/useOrphanFormErrors.mjs +2 -2
  19. package/dist/errors/orphan/useOrphanFormErrorsToConsoleError.d.ts +4 -3
  20. package/dist/errors/orphan/useOrphanFormErrorsToConsoleError.mjs +22 -14
  21. package/dist/errors/useFormErrorsEffect.mjs +2 -2
  22. package/dist/errors/useFormErrorsIfAny.mjs +1 -1
  23. package/dist/errors/useFormErrorsOnChange.mjs +5 -5
  24. package/dist/errors/useFormFieldErrors.d.ts +6 -0
  25. package/dist/errors/useFormFieldErrors.mjs +13 -0
  26. package/dist/isEmptyObject.d.ts +2 -0
  27. package/dist/isEmptyObject.mjs +4 -0
  28. package/dist/main.d.ts +4 -1
  29. package/dist/main.mjs +34 -28
  30. package/dist/node_modules/@babel/runtime/helpers/esm/extends.mjs +13 -0
  31. package/dist/node_modules/@emotion/cache/dist/emotion-cache.browser.esm.mjs +305 -0
  32. package/dist/node_modules/@emotion/hash/dist/emotion-hash.esm.mjs +22 -0
  33. package/dist/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.mjs +10 -0
  34. package/dist/node_modules/@emotion/memoize/dist/emotion-memoize.esm.mjs +9 -0
  35. package/dist/node_modules/@emotion/react/dist/emotion-element-43c6fea0.browser.esm.mjs +57 -0
  36. package/dist/node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.mjs +167 -0
  37. package/dist/node_modules/@emotion/sheet/dist/emotion-sheet.browser.esm.mjs +49 -0
  38. package/dist/node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.mjs +82 -0
  39. package/dist/node_modules/@emotion/styled/dist/emotion-styled.browser.esm.mjs +146 -0
  40. package/dist/node_modules/@emotion/unitless/dist/emotion-unitless.esm.mjs +52 -0
  41. package/dist/node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.mjs +7 -0
  42. package/dist/node_modules/@emotion/utils/dist/emotion-utils.browser.esm.mjs +34 -0
  43. package/dist/node_modules/@hookform/devtools/dist/index.esm.mjs +1402 -0
  44. package/dist/node_modules/dequal/dist/index.mjs +64 -0
  45. package/dist/node_modules/little-state-machine/dist/little-state-machine.es.mjs +67 -0
  46. package/dist/node_modules/lodash/_Hash.mjs +22 -0
  47. package/dist/node_modules/lodash/_ListCache.mjs +22 -0
  48. package/dist/node_modules/lodash/_Map.mjs +6 -0
  49. package/dist/node_modules/lodash/_MapCache.mjs +22 -0
  50. package/dist/node_modules/lodash/_Symbol.mjs +5 -0
  51. package/dist/node_modules/lodash/_arrayMap.mjs +9 -0
  52. package/dist/node_modules/lodash/_assocIndexOf.mjs +12 -0
  53. package/dist/node_modules/lodash/_baseGet.mjs +13 -0
  54. package/dist/node_modules/lodash/_baseGetTag.mjs +11 -0
  55. package/dist/node_modules/lodash/_baseIsNative.mjs +17 -0
  56. package/dist/node_modules/lodash/_baseToString.mjs +19 -0
  57. package/dist/node_modules/lodash/_castPath.mjs +12 -0
  58. package/dist/node_modules/lodash/_coreJsData.mjs +5 -0
  59. package/dist/node_modules/lodash/_freeGlobal.mjs +5 -0
  60. package/dist/node_modules/lodash/_getMapData.mjs +10 -0
  61. package/dist/node_modules/lodash/_getNative.mjs +11 -0
  62. package/dist/node_modules/lodash/_getRawTag.mjs +16 -0
  63. package/dist/node_modules/lodash/_getValue.mjs +7 -0
  64. package/dist/node_modules/lodash/_hashClear.mjs +9 -0
  65. package/dist/node_modules/lodash/_hashDelete.mjs +8 -0
  66. package/dist/node_modules/lodash/_hashGet.mjs +14 -0
  67. package/dist/node_modules/lodash/_hashHas.mjs +10 -0
  68. package/dist/node_modules/lodash/_hashSet.mjs +10 -0
  69. package/dist/node_modules/lodash/_isKey.mjs +13 -0
  70. package/dist/node_modules/lodash/_isKeyable.mjs +8 -0
  71. package/dist/node_modules/lodash/_isMasked.mjs +12 -0
  72. package/dist/node_modules/lodash/_listCacheClear.mjs +7 -0
  73. package/dist/node_modules/lodash/_listCacheDelete.mjs +13 -0
  74. package/dist/node_modules/lodash/_listCacheGet.mjs +10 -0
  75. package/dist/node_modules/lodash/_listCacheHas.mjs +9 -0
  76. package/dist/node_modules/lodash/_listCacheSet.mjs +10 -0
  77. package/dist/node_modules/lodash/_mapCacheClear.mjs +15 -0
  78. package/dist/node_modules/lodash/_mapCacheDelete.mjs +10 -0
  79. package/dist/node_modules/lodash/_mapCacheGet.mjs +9 -0
  80. package/dist/node_modules/lodash/_mapCacheHas.mjs +9 -0
  81. package/dist/node_modules/lodash/_mapCacheSet.mjs +10 -0
  82. package/dist/node_modules/lodash/_memoizeCapped.mjs +12 -0
  83. package/dist/node_modules/lodash/_nativeCreate.mjs +5 -0
  84. package/dist/node_modules/lodash/_objectToString.mjs +8 -0
  85. package/dist/node_modules/lodash/_root.mjs +5 -0
  86. package/dist/node_modules/lodash/_stringToPath.mjs +10 -0
  87. package/dist/node_modules/lodash/_toKey.mjs +12 -0
  88. package/dist/node_modules/lodash/_toSource.mjs +18 -0
  89. package/dist/node_modules/lodash/eq.mjs +7 -0
  90. package/dist/node_modules/lodash/get.mjs +12 -0
  91. package/dist/node_modules/lodash/isArray.mjs +4 -0
  92. package/dist/node_modules/lodash/isFunction.mjs +13 -0
  93. package/dist/node_modules/lodash/isObject.mjs +11 -0
  94. package/dist/node_modules/lodash/isObjectLike.mjs +7 -0
  95. package/dist/node_modules/lodash/isSymbol.mjs +10 -0
  96. package/dist/node_modules/lodash/isUndefined.mjs +9 -0
  97. package/dist/node_modules/lodash/memoize.mjs +19 -0
  98. package/dist/node_modules/lodash/toString.mjs +9 -0
  99. package/dist/node_modules/react-simple-animate/dist/index.mjs +257 -0
  100. package/dist/node_modules/stylis/src/Enum.mjs +12 -0
  101. package/dist/node_modules/stylis/src/Middleware.mjs +18 -0
  102. package/dist/node_modules/stylis/src/Parser.mjs +114 -0
  103. package/dist/node_modules/stylis/src/Serializer.mjs +28 -0
  104. package/dist/node_modules/stylis/src/Tokenizer.mjs +131 -0
  105. package/dist/node_modules/stylis/src/Utility.mjs +50 -0
  106. package/dist/node_modules/use-deep-compare-effect/dist/use-deep-compare-effect.esm.mjs +24 -0
  107. package/dist/node_modules/uuid/dist/esm-browser/regex.mjs +4 -0
  108. package/dist/node_modules/uuid/dist/esm-browser/rng.mjs +9 -0
  109. package/dist/node_modules/uuid/dist/esm-browser/stringify.mjs +13 -0
  110. package/dist/node_modules/uuid/dist/esm-browser/v4.mjs +16 -0
  111. package/dist/node_modules/uuid/dist/esm-browser/validate.mjs +7 -0
  112. package/dist/submit/useFormOnSubmitSuccessful.mjs +7 -7
  113. package/dist/submit/useFormOnSubmitSuccessfulAndReset.mjs +7 -7
  114. package/package.json +14 -1
  115. package/dist/errors/nonfield/utils.mjs +0 -4
  116. package/dist/errors/orphan/useFormErrorsHasOnlyOrphans.d.ts +0 -2
  117. package/dist/errors/orphan/useFormErrorsHasOnlyOrphans.mjs +0 -10
  118. package/dist/errors/orphan/utils.d.ts +0 -4
  119. package/dist/errors/useFormFlatFieldErrors.mjs +0 -6
  120. package/dist/utils.d.ts +0 -1
  121. package/dist/utils.mjs +0 -4
@@ -0,0 +1,1402 @@
1
+ import { createStore as Rt, StateMachineProvider as Lt, useStateMachine as lt } from "../../../little-state-machine/dist/little-state-machine.es.mjs";
2
+ import * as c from "react";
3
+ import B, { useState as Pt, useEffect as at } from "react";
4
+ import { Animate as ot } from "../../../react-simple-animate/dist/index.mjs";
5
+ import Oe from "../../../@emotion/styled/dist/emotion-styled.browser.esm.mjs";
6
+ import Xe from "../../../lodash/isUndefined.mjs";
7
+ import Mt from "../../../lodash/isObject.mjs";
8
+ import ct from "../../../lodash/get.mjs";
9
+ import Bt from "../../../use-deep-compare-effect/dist/use-deep-compare-effect.esm.mjs";
10
+ import Ht from "../../../uuid/dist/esm-browser/v4.mjs";
11
+ var ye = (e) => e.type === "checkbox", oe = (e) => e instanceof Date, I = (e) => e == null;
12
+ const ut = (e) => typeof e == "object";
13
+ var L = (e) => !I(e) && !Array.isArray(e) && ut(e) && !oe(e), It = (e) => L(e) && e.target ? ye(e.target) ? e.target.checked : e.target.value : e, Ut = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Nt = (e, i) => e.has(Ut(i)), Wt = (e) => {
14
+ const i = e.constructor && e.constructor.prototype;
15
+ return L(i) && i.hasOwnProperty("isPrototypeOf");
16
+ }, Re = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
17
+ function ee(e) {
18
+ let i;
19
+ const r = Array.isArray(e);
20
+ if (e instanceof Date)
21
+ i = new Date(e);
22
+ else if (e instanceof Set)
23
+ i = new Set(e);
24
+ else if (!(Re && (e instanceof Blob || e instanceof FileList)) && (r || L(e)))
25
+ if (i = r ? [] : {}, !Array.isArray(e) && !Wt(e))
26
+ i = e;
27
+ else
28
+ for (const t in e)
29
+ i[t] = ee(e[t]);
30
+ else
31
+ return e;
32
+ return i;
33
+ }
34
+ var he = (e) => Array.isArray(e) ? e.filter(Boolean) : [], R = (e) => e === void 0, g = (e, i, r) => {
35
+ if (!i || !L(e))
36
+ return r;
37
+ const t = he(i.split(/[,[\].]+?/)).reduce((n, o) => I(n) ? n : n[o], e);
38
+ return R(t) || t === e ? R(e[i]) ? r : e[i] : t;
39
+ };
40
+ const Ke = {
41
+ BLUR: "blur",
42
+ FOCUS_OUT: "focusout",
43
+ CHANGE: "change"
44
+ }, z = {
45
+ onBlur: "onBlur",
46
+ onChange: "onChange",
47
+ onSubmit: "onSubmit",
48
+ onTouched: "onTouched",
49
+ all: "all"
50
+ }, J = {
51
+ max: "max",
52
+ min: "min",
53
+ maxLength: "maxLength",
54
+ minLength: "minLength",
55
+ pattern: "pattern",
56
+ required: "required",
57
+ validate: "validate"
58
+ }, $t = B.createContext(null), Le = () => B.useContext($t);
59
+ var dt = (e, i, r, t = !0) => {
60
+ const n = {
61
+ defaultValues: i._defaultValues
62
+ };
63
+ for (const o in e)
64
+ Object.defineProperty(n, o, {
65
+ get: () => {
66
+ const d = o;
67
+ return i._proxyFormState[d] !== z.all && (i._proxyFormState[d] = !t || z.all), r && (r[d] = !0), e[d];
68
+ }
69
+ });
70
+ return n;
71
+ }, $ = (e) => L(e) && !Object.keys(e).length, ft = (e, i, r, t) => {
72
+ r(e);
73
+ const { name: n, ...o } = e;
74
+ return $(o) || Object.keys(o).length >= Object.keys(i).length || Object.keys(o).find((d) => i[d] === (!t || z.all));
75
+ }, be = (e) => Array.isArray(e) ? e : [e], gt = (e, i, r) => r && i ? e === i : !e || !i || e === i || be(e).some((t) => t && (t.startsWith(i) || i.startsWith(t)));
76
+ function Pe(e) {
77
+ const i = B.useRef(e);
78
+ i.current = e, B.useEffect(() => {
79
+ const r = !e.disabled && i.current.subject && i.current.subject.subscribe({
80
+ next: i.current.next
81
+ });
82
+ return () => {
83
+ r && r.unsubscribe();
84
+ };
85
+ }, [e.disabled]);
86
+ }
87
+ function Me(e) {
88
+ const i = Le(), { control: r = i.control, disabled: t, name: n, exact: o } = e || {}, [d, b] = B.useState(r._formState), y = B.useRef(!0), w = B.useRef({
89
+ isDirty: !1,
90
+ isLoading: !1,
91
+ dirtyFields: !1,
92
+ touchedFields: !1,
93
+ isValidating: !1,
94
+ isValid: !1,
95
+ errors: !1
96
+ }), A = B.useRef(n);
97
+ return A.current = n, Pe({
98
+ disabled: t,
99
+ next: (E) => y.current && gt(A.current, E.name, o) && ft(E, w.current, r._updateFormState) && b({
100
+ ...r._formState,
101
+ ...E
102
+ }),
103
+ subject: r._subjects.state
104
+ }), B.useEffect(() => {
105
+ y.current = !0;
106
+ const E = r._proxyFormState.isDirty && r._getDirty();
107
+ return E !== r._formState.isDirty && r._subjects.state.next({
108
+ isDirty: E
109
+ }), w.current.isValid && r._updateValid(!0), () => {
110
+ y.current = !1;
111
+ };
112
+ }, [r]), dt(d, r, w.current, !1);
113
+ }
114
+ var X = (e) => typeof e == "string", yt = (e, i, r, t, n) => X(e) ? (t && i.watch.add(e), g(r, e, n)) : Array.isArray(e) ? e.map((o) => (t && i.watch.add(o), g(r, o))) : (t && (i.watchAll = !0), r);
115
+ function ht(e) {
116
+ const i = Le(), { control: r = i.control, name: t, defaultValue: n, disabled: o, exact: d } = e || {}, b = B.useRef(t);
117
+ b.current = t, Pe({
118
+ disabled: o,
119
+ subject: r._subjects.values,
120
+ next: (A) => {
121
+ gt(b.current, A.name, d) && w(ee(yt(b.current, r._names, A.values || r._formValues, !1, n)));
122
+ }
123
+ });
124
+ const [y, w] = B.useState(r._getWatch(t, n));
125
+ return B.useEffect(() => r._removeUnmounted()), y;
126
+ }
127
+ var Be = (e) => /^\w*$/.test(e), mt = (e) => he(e.replace(/["|']|\]/g, "").split(/\.|\[/));
128
+ function S(e, i, r) {
129
+ let t = -1;
130
+ const n = Be(i) ? [i] : mt(i), o = n.length, d = o - 1;
131
+ for (; ++t < o; ) {
132
+ const b = n[t];
133
+ let y = r;
134
+ if (t !== d) {
135
+ const w = e[b];
136
+ y = L(w) || Array.isArray(w) ? w : isNaN(+n[t + 1]) ? {} : [];
137
+ }
138
+ e[b] = y, e = e[b];
139
+ }
140
+ return e;
141
+ }
142
+ var zt = (e, i, r, t, n) => i ? {
143
+ ...r[e],
144
+ types: {
145
+ ...r[e] && r[e].types ? r[e].types : {},
146
+ [t]: n || !0
147
+ }
148
+ } : {};
149
+ const Te = (e, i, r) => {
150
+ for (const t of r || Object.keys(e)) {
151
+ const n = g(e, t);
152
+ if (n) {
153
+ const { _f: o, ...d } = n;
154
+ if (o && i(o.name)) {
155
+ if (o.ref.focus) {
156
+ o.ref.focus();
157
+ break;
158
+ } else if (o.refs && o.refs[0].focus) {
159
+ o.refs[0].focus();
160
+ break;
161
+ }
162
+ } else
163
+ L(d) && Te(d, i);
164
+ }
165
+ }
166
+ };
167
+ var Ge = (e) => ({
168
+ isOnSubmit: !e || e === z.onSubmit,
169
+ isOnBlur: e === z.onBlur,
170
+ isOnChange: e === z.onChange,
171
+ isOnAll: e === z.all,
172
+ isOnTouch: e === z.onTouched
173
+ }), Je = (e, i, r) => !r && (i.watchAll || i.watch.has(e) || [...i.watch].some((t) => e.startsWith(t) && /^\.\w+/.test(e.slice(t.length)))), qt = (e, i, r) => {
174
+ const t = he(g(e, r));
175
+ return S(t, "root", i[r]), S(e, r, t), e;
176
+ }, ce = (e) => typeof e == "boolean", He = (e) => e.type === "file", ue = (e) => typeof e == "function", ve = (e) => {
177
+ if (!Re)
178
+ return !1;
179
+ const i = e ? e.ownerDocument : 0;
180
+ return e instanceof (i && i.defaultView ? i.defaultView.HTMLElement : HTMLElement);
181
+ }, pe = (e) => X(e), Ie = (e) => e.type === "radio", Ee = (e) => e instanceof RegExp;
182
+ const Qe = {
183
+ value: !1,
184
+ isValid: !1
185
+ }, Ye = { value: !0, isValid: !0 };
186
+ var bt = (e) => {
187
+ if (Array.isArray(e)) {
188
+ if (e.length > 1) {
189
+ const i = e.filter((r) => r && r.checked && !r.disabled).map((r) => r.value);
190
+ return { value: i, isValid: !!i.length };
191
+ }
192
+ return e[0].checked && !e[0].disabled ? (
193
+ // @ts-expect-error expected to work in the browser
194
+ e[0].attributes && !R(e[0].attributes.value) ? R(e[0].value) || e[0].value === "" ? Ye : { value: e[0].value, isValid: !0 } : Ye
195
+ ) : Qe;
196
+ }
197
+ return Qe;
198
+ };
199
+ const et = {
200
+ isValid: !1,
201
+ value: null
202
+ };
203
+ var pt = (e) => Array.isArray(e) ? e.reduce((i, r) => r && r.checked && !r.disabled ? {
204
+ isValid: !0,
205
+ value: r.value
206
+ } : i, et) : et;
207
+ function tt(e, i, r = "validate") {
208
+ if (pe(e) || Array.isArray(e) && e.every(pe) || ce(e) && !e)
209
+ return {
210
+ type: r,
211
+ message: pe(e) ? e : "",
212
+ ref: i
213
+ };
214
+ }
215
+ var ae = (e) => L(e) && !Ee(e) ? e : {
216
+ value: e,
217
+ message: ""
218
+ }, rt = async (e, i, r, t, n) => {
219
+ const { ref: o, refs: d, required: b, maxLength: y, minLength: w, min: A, max: E, pattern: p, validate: V, name: D, valueAsNumber: Q, mount: Y, disabled: re } = e._f, v = g(i, D);
220
+ if (!Y || re)
221
+ return {};
222
+ const N = d ? d[0] : o, H = (O) => {
223
+ t && N.reportValidity && (N.setCustomValidity(ce(O) ? "" : O || ""), N.reportValidity());
224
+ }, F = {}, M = Ie(o), K = ye(o), se = M || K, q = (Q || He(o)) && R(o.value) && R(v) || ve(o) && o.value === "" || v === "" || Array.isArray(v) && !v.length, ie = zt.bind(null, D, r, F), G = (O, x, C, U = J.maxLength, W = J.minLength) => {
225
+ const Z = O ? x : C;
226
+ F[D] = {
227
+ type: O ? U : W,
228
+ message: Z,
229
+ ref: o,
230
+ ...ie(O ? U : W, Z)
231
+ };
232
+ };
233
+ if (n ? !Array.isArray(v) || !v.length : b && (!se && (q || I(v)) || ce(v) && !v || K && !bt(d).isValid || M && !pt(d).isValid)) {
234
+ const { value: O, message: x } = pe(b) ? { value: !!b, message: b } : ae(b);
235
+ if (O && (F[D] = {
236
+ type: J.required,
237
+ message: x,
238
+ ref: N,
239
+ ...ie(J.required, x)
240
+ }, !r))
241
+ return H(x), F;
242
+ }
243
+ if (!q && (!I(A) || !I(E))) {
244
+ let O, x;
245
+ const C = ae(E), U = ae(A);
246
+ if (!I(v) && !isNaN(v)) {
247
+ const W = o.valueAsNumber || v && +v;
248
+ I(C.value) || (O = W > C.value), I(U.value) || (x = W < U.value);
249
+ } else {
250
+ const W = o.valueAsDate || new Date(v), Z = (fe) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + fe), ne = o.type == "time", de = o.type == "week";
251
+ X(C.value) && v && (O = ne ? Z(v) > Z(C.value) : de ? v > C.value : W > new Date(C.value)), X(U.value) && v && (x = ne ? Z(v) < Z(U.value) : de ? v < U.value : W < new Date(U.value));
252
+ }
253
+ if ((O || x) && (G(!!O, C.message, U.message, J.max, J.min), !r))
254
+ return H(F[D].message), F;
255
+ }
256
+ if ((y || w) && !q && (X(v) || n && Array.isArray(v))) {
257
+ const O = ae(y), x = ae(w), C = !I(O.value) && v.length > O.value, U = !I(x.value) && v.length < x.value;
258
+ if ((C || U) && (G(C, O.message, x.message), !r))
259
+ return H(F[D].message), F;
260
+ }
261
+ if (p && !q && X(v)) {
262
+ const { value: O, message: x } = ae(p);
263
+ if (Ee(O) && !v.match(O) && (F[D] = {
264
+ type: J.pattern,
265
+ message: x,
266
+ ref: o,
267
+ ...ie(J.pattern, x)
268
+ }, !r))
269
+ return H(x), F;
270
+ }
271
+ if (V) {
272
+ if (ue(V)) {
273
+ const O = await V(v, i), x = tt(O, N);
274
+ if (x && (F[D] = {
275
+ ...x,
276
+ ...ie(J.validate, x.message)
277
+ }, !r))
278
+ return H(x.message), F;
279
+ } else if (L(V)) {
280
+ let O = {};
281
+ for (const x in V) {
282
+ if (!$(O) && !r)
283
+ break;
284
+ const C = tt(await V[x](v, i), N, x);
285
+ C && (O = {
286
+ ...C,
287
+ ...ie(x, C.message)
288
+ }, H(C.message), r && (F[D] = O));
289
+ }
290
+ if (!$(O) && (F[D] = {
291
+ ref: N,
292
+ ...O
293
+ }, !r))
294
+ return F;
295
+ }
296
+ }
297
+ return H(!0), F;
298
+ };
299
+ function Zt(e, i) {
300
+ const r = i.slice(0, -1).length;
301
+ let t = 0;
302
+ for (; t < r; )
303
+ e = R(e) ? t++ : e[i[t++]];
304
+ return e;
305
+ }
306
+ function Xt(e) {
307
+ for (const i in e)
308
+ if (!R(e[i]))
309
+ return !1;
310
+ return !0;
311
+ }
312
+ function P(e, i) {
313
+ const r = Array.isArray(i) ? i : Be(i) ? [i] : mt(i), t = r.length === 1 ? e : Zt(e, r), n = r.length - 1, o = r[n];
314
+ return t && delete t[o], n !== 0 && (L(t) && $(t) || Array.isArray(t) && Xt(t)) && P(e, r.slice(0, -1)), e;
315
+ }
316
+ function Ae() {
317
+ let e = [];
318
+ return {
319
+ get observers() {
320
+ return e;
321
+ },
322
+ next: (n) => {
323
+ for (const o of e)
324
+ o.next && o.next(n);
325
+ },
326
+ subscribe: (n) => (e.push(n), {
327
+ unsubscribe: () => {
328
+ e = e.filter((o) => o !== n);
329
+ }
330
+ }),
331
+ unsubscribe: () => {
332
+ e = [];
333
+ }
334
+ };
335
+ }
336
+ var xe = (e) => I(e) || !ut(e);
337
+ function le(e, i) {
338
+ if (xe(e) || xe(i))
339
+ return e === i;
340
+ if (oe(e) && oe(i))
341
+ return e.getTime() === i.getTime();
342
+ const r = Object.keys(e), t = Object.keys(i);
343
+ if (r.length !== t.length)
344
+ return !1;
345
+ for (const n of r) {
346
+ const o = e[n];
347
+ if (!t.includes(n))
348
+ return !1;
349
+ if (n !== "ref") {
350
+ const d = i[n];
351
+ if (oe(o) && oe(d) || L(o) && L(d) || Array.isArray(o) && Array.isArray(d) ? !le(o, d) : o !== d)
352
+ return !1;
353
+ }
354
+ }
355
+ return !0;
356
+ }
357
+ var vt = (e) => e.type === "select-multiple", Kt = (e) => Ie(e) || ye(e), Fe = (e) => ve(e) && e.isConnected, Et = (e) => {
358
+ for (const i in e)
359
+ if (ue(e[i]))
360
+ return !0;
361
+ return !1;
362
+ };
363
+ function _e(e, i = {}) {
364
+ const r = Array.isArray(e);
365
+ if (L(e) || r)
366
+ for (const t in e)
367
+ Array.isArray(e[t]) || L(e[t]) && !Et(e[t]) ? (i[t] = Array.isArray(e[t]) ? [] : {}, _e(e[t], i[t])) : I(e[t]) || (i[t] = !0);
368
+ return i;
369
+ }
370
+ function xt(e, i, r) {
371
+ const t = Array.isArray(e);
372
+ if (L(e) || t)
373
+ for (const n in e)
374
+ Array.isArray(e[n]) || L(e[n]) && !Et(e[n]) ? R(i) || xe(r[n]) ? r[n] = Array.isArray(e[n]) ? _e(e[n], []) : { ..._e(e[n]) } : xt(e[n], I(i) ? {} : i[n], r[n]) : r[n] = !le(e[n], i[n]);
375
+ return r;
376
+ }
377
+ var De = (e, i) => xt(e, i, _e(i)), _t = (e, { valueAsNumber: i, valueAsDate: r, setValueAs: t }) => R(e) ? e : i ? e === "" ? NaN : e && +e : r && X(e) ? new Date(e) : t ? t(e) : e;
378
+ function je(e) {
379
+ const i = e.ref;
380
+ if (!(e.refs ? e.refs.every((r) => r.disabled) : i.disabled))
381
+ return He(i) ? i.files : Ie(i) ? pt(e.refs).value : vt(i) ? [...i.selectedOptions].map(({ value: r }) => r) : ye(i) ? bt(e.refs).value : _t(R(i.value) ? e.ref.value : i.value, e);
382
+ }
383
+ var Gt = (e, i, r, t) => {
384
+ const n = {};
385
+ for (const o of e) {
386
+ const d = g(i, o);
387
+ d && S(n, o, d._f);
388
+ }
389
+ return {
390
+ criteriaMode: r,
391
+ names: [...e],
392
+ fields: n,
393
+ shouldUseNativeValidation: t
394
+ };
395
+ }, ge = (e) => R(e) ? e : Ee(e) ? e.source : L(e) ? Ee(e.value) ? e.value.source : e.value : e, Jt = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
396
+ function st(e, i, r) {
397
+ const t = g(e, r);
398
+ if (t || Be(r))
399
+ return {
400
+ error: t,
401
+ name: r
402
+ };
403
+ const n = r.split(".");
404
+ for (; n.length; ) {
405
+ const o = n.join("."), d = g(i, o), b = g(e, o);
406
+ if (d && !Array.isArray(d) && r !== o)
407
+ return { name: r };
408
+ if (b && b.type)
409
+ return {
410
+ name: o,
411
+ error: b
412
+ };
413
+ n.pop();
414
+ }
415
+ return {
416
+ name: r
417
+ };
418
+ }
419
+ var Qt = (e, i, r, t, n) => n.isOnAll ? !1 : !r && n.isOnTouch ? !(i || e) : (r ? t.isOnBlur : n.isOnBlur) ? !e : (r ? t.isOnChange : n.isOnChange) ? e : !0, Yt = (e, i) => !he(g(e, i)).length && P(e, i);
420
+ const er = {
421
+ mode: z.onSubmit,
422
+ reValidateMode: z.onChange,
423
+ shouldFocusError: !0
424
+ };
425
+ function tr(e = {}, i) {
426
+ let r = {
427
+ ...er,
428
+ ...e
429
+ }, t = {
430
+ submitCount: 0,
431
+ isDirty: !1,
432
+ isLoading: !0,
433
+ isValidating: !1,
434
+ isSubmitted: !1,
435
+ isSubmitting: !1,
436
+ isSubmitSuccessful: !1,
437
+ isValid: !1,
438
+ touchedFields: {},
439
+ dirtyFields: {},
440
+ errors: {}
441
+ }, n = {}, o = L(r.defaultValues) || L(r.values) ? ee(r.defaultValues || r.values) || {} : {}, d = r.shouldUnregister ? {} : ee(o), b = {
442
+ action: !1,
443
+ mount: !1,
444
+ watch: !1
445
+ }, y = {
446
+ mount: /* @__PURE__ */ new Set(),
447
+ unMount: /* @__PURE__ */ new Set(),
448
+ array: /* @__PURE__ */ new Set(),
449
+ watch: /* @__PURE__ */ new Set()
450
+ }, w, A = 0;
451
+ const E = {
452
+ isDirty: !1,
453
+ dirtyFields: !1,
454
+ touchedFields: !1,
455
+ isValidating: !1,
456
+ isValid: !1,
457
+ errors: !1
458
+ }, p = {
459
+ values: Ae(),
460
+ array: Ae(),
461
+ state: Ae()
462
+ }, V = e.resetOptions && e.resetOptions.keepDirtyValues, D = Ge(r.mode), Q = Ge(r.reValidateMode), Y = r.criteriaMode === z.all, re = (s) => (l) => {
463
+ clearTimeout(A), A = setTimeout(s, l);
464
+ }, v = async (s) => {
465
+ if (E.isValid || s) {
466
+ const l = r.resolver ? $((await q()).errors) : await G(n, !0);
467
+ l !== t.isValid && p.state.next({
468
+ isValid: l
469
+ });
470
+ }
471
+ }, N = (s) => E.isValidating && p.state.next({
472
+ isValidating: s
473
+ }), H = (s, l = [], a, f, h = !0, u = !0) => {
474
+ if (f && a) {
475
+ if (b.action = !0, u && Array.isArray(g(n, s))) {
476
+ const m = a(g(n, s), f.argA, f.argB);
477
+ h && S(n, s, m);
478
+ }
479
+ if (u && Array.isArray(g(t.errors, s))) {
480
+ const m = a(g(t.errors, s), f.argA, f.argB);
481
+ h && S(t.errors, s, m), Yt(t.errors, s);
482
+ }
483
+ if (E.touchedFields && u && Array.isArray(g(t.touchedFields, s))) {
484
+ const m = a(g(t.touchedFields, s), f.argA, f.argB);
485
+ h && S(t.touchedFields, s, m);
486
+ }
487
+ E.dirtyFields && (t.dirtyFields = De(o, d)), p.state.next({
488
+ name: s,
489
+ isDirty: x(s, l),
490
+ dirtyFields: t.dirtyFields,
491
+ errors: t.errors,
492
+ isValid: t.isValid
493
+ });
494
+ } else
495
+ S(d, s, l);
496
+ }, F = (s, l) => {
497
+ S(t.errors, s, l), p.state.next({
498
+ errors: t.errors
499
+ });
500
+ }, M = (s, l, a, f) => {
501
+ const h = g(n, s);
502
+ if (h) {
503
+ const u = g(d, s, R(a) ? g(o, s) : a);
504
+ R(u) || f && f.defaultChecked || l ? S(d, s, l ? u : je(h._f)) : W(s, u), b.mount && v();
505
+ }
506
+ }, K = (s, l, a, f, h) => {
507
+ let u = !1, m = !1;
508
+ const T = {
509
+ name: s
510
+ };
511
+ if (!a || f) {
512
+ E.isDirty && (m = t.isDirty, t.isDirty = T.isDirty = x(), u = m !== T.isDirty);
513
+ const j = le(g(o, s), l);
514
+ m = g(t.dirtyFields, s), j ? P(t.dirtyFields, s) : S(t.dirtyFields, s, !0), T.dirtyFields = t.dirtyFields, u = u || E.dirtyFields && m !== !j;
515
+ }
516
+ if (a) {
517
+ const j = g(t.touchedFields, s);
518
+ j || (S(t.touchedFields, s, a), T.touchedFields = t.touchedFields, u = u || E.touchedFields && j !== a);
519
+ }
520
+ return u && h && p.state.next(T), u ? T : {};
521
+ }, se = (s, l, a, f) => {
522
+ const h = g(t.errors, s), u = E.isValid && ce(l) && t.isValid !== l;
523
+ if (e.delayError && a ? (w = re(() => F(s, a)), w(e.delayError)) : (clearTimeout(A), w = null, a ? S(t.errors, s, a) : P(t.errors, s)), (a ? !le(h, a) : h) || !$(f) || u) {
524
+ const m = {
525
+ ...f,
526
+ ...u && ce(l) ? { isValid: l } : {},
527
+ errors: t.errors,
528
+ name: s
529
+ };
530
+ t = {
531
+ ...t,
532
+ ...m
533
+ }, p.state.next(m);
534
+ }
535
+ N(!1);
536
+ }, q = async (s) => r.resolver(d, r.context, Gt(s || y.mount, n, r.criteriaMode, r.shouldUseNativeValidation)), ie = async (s) => {
537
+ const { errors: l } = await q();
538
+ if (s)
539
+ for (const a of s) {
540
+ const f = g(l, a);
541
+ f ? S(t.errors, a, f) : P(t.errors, a);
542
+ }
543
+ else
544
+ t.errors = l;
545
+ return l;
546
+ }, G = async (s, l, a = {
547
+ valid: !0
548
+ }) => {
549
+ for (const f in s) {
550
+ const h = s[f];
551
+ if (h) {
552
+ const { _f: u, ...m } = h;
553
+ if (u) {
554
+ const T = y.array.has(u.name), j = await rt(h, d, Y, r.shouldUseNativeValidation, T);
555
+ if (j[u.name] && (a.valid = !1, l))
556
+ break;
557
+ !l && (g(j, u.name) ? T ? qt(t.errors, j, u.name) : S(t.errors, u.name, j[u.name]) : P(t.errors, u.name));
558
+ }
559
+ m && await G(m, l, a);
560
+ }
561
+ }
562
+ return a.valid;
563
+ }, O = () => {
564
+ for (const s of y.unMount) {
565
+ const l = g(n, s);
566
+ l && (l._f.refs ? l._f.refs.every((a) => !Fe(a)) : !Fe(l._f.ref)) && we(s);
567
+ }
568
+ y.unMount = /* @__PURE__ */ new Set();
569
+ }, x = (s, l) => (s && l && S(d, s, l), !le(Ue(), o)), C = (s, l, a) => yt(s, y, {
570
+ ...b.mount ? d : R(l) ? o : X(s) ? { [s]: l } : l
571
+ }, a, l), U = (s) => he(g(b.mount ? d : o, s, e.shouldUnregister ? g(o, s, []) : [])), W = (s, l, a = {}) => {
572
+ const f = g(n, s);
573
+ let h = l;
574
+ if (f) {
575
+ const u = f._f;
576
+ u && (!u.disabled && S(d, s, _t(l, u)), h = ve(u.ref) && I(l) ? "" : l, vt(u.ref) ? [...u.ref.options].forEach((m) => m.selected = h.includes(m.value)) : u.refs ? ye(u.ref) ? u.refs.length > 1 ? u.refs.forEach((m) => (!m.defaultChecked || !m.disabled) && (m.checked = Array.isArray(h) ? !!h.find((T) => T === m.value) : h === m.value)) : u.refs[0] && (u.refs[0].checked = !!h) : u.refs.forEach((m) => m.checked = m.value === h) : He(u.ref) ? u.ref.value = "" : (u.ref.value = h, u.ref.type || p.values.next({
577
+ name: s,
578
+ values: { ...d }
579
+ })));
580
+ }
581
+ (a.shouldDirty || a.shouldTouch) && K(s, h, a.shouldTouch, a.shouldDirty, !0), a.shouldValidate && fe(s);
582
+ }, Z = (s, l, a) => {
583
+ for (const f in l) {
584
+ const h = l[f], u = `${s}.${f}`, m = g(n, u);
585
+ (y.array.has(s) || !xe(h) || m && !m._f) && !oe(h) ? Z(u, h, a) : W(u, h, a);
586
+ }
587
+ }, ne = (s, l, a = {}) => {
588
+ const f = g(n, s), h = y.array.has(s), u = ee(l);
589
+ S(d, s, u), h ? (p.array.next({
590
+ name: s,
591
+ values: { ...d }
592
+ }), (E.isDirty || E.dirtyFields) && a.shouldDirty && p.state.next({
593
+ name: s,
594
+ dirtyFields: De(o, d),
595
+ isDirty: x(s, u)
596
+ })) : f && !f._f && !I(u) ? Z(s, u, a) : W(s, u, a), Je(s, y) && p.state.next({ ...t }), p.values.next({
597
+ name: s,
598
+ values: { ...d }
599
+ }), !b.mount && i();
600
+ }, de = async (s) => {
601
+ const l = s.target;
602
+ let a = l.name;
603
+ const f = g(n, a), h = () => l.type ? je(f._f) : It(s);
604
+ if (f) {
605
+ let u, m;
606
+ const T = h(), j = s.type === Ke.BLUR || s.type === Ke.FOCUS_OUT, jt = !Jt(f._f) && !r.resolver && !g(t.errors, a) && !f._f.deps || Qt(j, g(t.touchedFields, a), t.isSubmitted, Q, D), ke = Je(a, y, j);
607
+ S(d, a, T), j ? (f._f.onBlur && f._f.onBlur(s), w && w(0)) : f._f.onChange && f._f.onChange(s);
608
+ const Se = K(a, T, j, !1), Ct = !$(Se) || ke;
609
+ if (!j && p.values.next({
610
+ name: a,
611
+ type: s.type,
612
+ values: { ...d }
613
+ }), jt)
614
+ return E.isValid && v(), Ct && p.state.next({ name: a, ...ke ? {} : Se });
615
+ if (!j && ke && p.state.next({ ...t }), N(!0), r.resolver) {
616
+ const { errors: qe } = await q([a]), Tt = st(t.errors, n, a), Ze = st(qe, n, Tt.name || a);
617
+ u = Ze.error, a = Ze.name, m = $(qe);
618
+ } else
619
+ u = (await rt(f, d, Y, r.shouldUseNativeValidation))[a], u ? m = !1 : E.isValid && (m = await G(n, !0));
620
+ f._f.deps && fe(f._f.deps), se(a, m, u, Se);
621
+ }
622
+ }, fe = async (s, l = {}) => {
623
+ let a, f;
624
+ const h = be(s);
625
+ if (N(!0), r.resolver) {
626
+ const u = await ie(R(s) ? s : h);
627
+ a = $(u), f = s ? !h.some((m) => g(u, m)) : a;
628
+ } else
629
+ s ? (f = (await Promise.all(h.map(async (u) => {
630
+ const m = g(n, u);
631
+ return await G(m && m._f ? { [u]: m } : m);
632
+ }))).every(Boolean), !(!f && !t.isValid) && v()) : f = a = await G(n);
633
+ return p.state.next({
634
+ ...!X(s) || E.isValid && a !== t.isValid ? {} : { name: s },
635
+ ...r.resolver || !s ? { isValid: a } : {},
636
+ errors: t.errors,
637
+ isValidating: !1
638
+ }), l.shouldFocus && !f && Te(n, (u) => u && g(t.errors, u), s ? h : y.mount), f;
639
+ }, Ue = (s) => {
640
+ const l = {
641
+ ...o,
642
+ ...b.mount ? d : {}
643
+ };
644
+ return R(s) ? l : X(s) ? g(l, s) : s.map((a) => g(l, a));
645
+ }, Ne = (s, l) => ({
646
+ invalid: !!g((l || t).errors, s),
647
+ isDirty: !!g((l || t).dirtyFields, s),
648
+ isTouched: !!g((l || t).touchedFields, s),
649
+ error: g((l || t).errors, s)
650
+ }), wt = (s) => {
651
+ s && be(s).forEach((l) => P(t.errors, l)), p.state.next({
652
+ errors: s ? t.errors : {}
653
+ });
654
+ }, Vt = (s, l, a) => {
655
+ const f = (g(n, s, { _f: {} })._f || {}).ref;
656
+ S(t.errors, s, {
657
+ ...l,
658
+ ref: f
659
+ }), p.state.next({
660
+ name: s,
661
+ errors: t.errors,
662
+ isValid: !1
663
+ }), a && a.shouldFocus && f && f.focus && f.focus();
664
+ }, kt = (s, l) => ue(s) ? p.values.subscribe({
665
+ next: (a) => s(C(void 0, l), a)
666
+ }) : C(s, l, !0), we = (s, l = {}) => {
667
+ for (const a of s ? be(s) : y.mount)
668
+ y.mount.delete(a), y.array.delete(a), g(n, a) && (l.keepValue || (P(n, a), P(d, a)), !l.keepError && P(t.errors, a), !l.keepDirty && P(t.dirtyFields, a), !l.keepTouched && P(t.touchedFields, a), !r.shouldUnregister && !l.keepDefaultValue && P(o, a));
669
+ p.values.next({
670
+ values: { ...d }
671
+ }), p.state.next({
672
+ ...t,
673
+ ...l.keepDirty ? { isDirty: x() } : {}
674
+ }), !l.keepIsValid && v();
675
+ }, Ve = (s, l = {}) => {
676
+ let a = g(n, s);
677
+ const f = ce(l.disabled);
678
+ return S(n, s, {
679
+ ...a || {},
680
+ _f: {
681
+ ...a && a._f ? a._f : { ref: { name: s } },
682
+ name: s,
683
+ mount: !0,
684
+ ...l
685
+ }
686
+ }), y.mount.add(s), a ? f && S(d, s, l.disabled ? void 0 : g(d, s, je(a._f))) : M(s, !0, l.value), {
687
+ ...f ? { disabled: l.disabled } : {},
688
+ ...r.shouldUseNativeValidation ? {
689
+ required: !!l.required,
690
+ min: ge(l.min),
691
+ max: ge(l.max),
692
+ minLength: ge(l.minLength),
693
+ maxLength: ge(l.maxLength),
694
+ pattern: ge(l.pattern)
695
+ } : {},
696
+ name: s,
697
+ onChange: de,
698
+ onBlur: de,
699
+ ref: (h) => {
700
+ if (h) {
701
+ Ve(s, l), a = g(n, s);
702
+ const u = R(h.value) && h.querySelectorAll && h.querySelectorAll("input,select,textarea")[0] || h, m = Kt(u), T = a._f.refs || [];
703
+ if (m ? T.find((j) => j === u) : u === a._f.ref)
704
+ return;
705
+ S(n, s, {
706
+ _f: {
707
+ ...a._f,
708
+ ...m ? {
709
+ refs: [
710
+ ...T.filter(Fe),
711
+ u,
712
+ ...Array.isArray(g(o, s)) ? [{}] : []
713
+ ],
714
+ ref: { type: u.type, name: s }
715
+ } : { ref: u }
716
+ }
717
+ }), M(s, !1, void 0, u);
718
+ } else
719
+ a = g(n, s, {}), a._f && (a._f.mount = !1), (r.shouldUnregister || l.shouldUnregister) && !(Nt(y.array, s) && b.action) && y.unMount.add(s);
720
+ }
721
+ };
722
+ }, We = () => r.shouldFocusError && Te(n, (s) => s && g(t.errors, s), y.mount), St = (s, l) => async (a) => {
723
+ a && (a.preventDefault && a.preventDefault(), a.persist && a.persist());
724
+ let f = ee(d);
725
+ if (p.state.next({
726
+ isSubmitting: !0
727
+ }), r.resolver) {
728
+ const { errors: h, values: u } = await q();
729
+ t.errors = h, f = u;
730
+ } else
731
+ await G(n);
732
+ P(t.errors, "root"), $(t.errors) ? (p.state.next({
733
+ errors: {}
734
+ }), await s(f, a)) : (l && await l({ ...t.errors }, a), We(), setTimeout(We)), p.state.next({
735
+ isSubmitted: !0,
736
+ isSubmitting: !1,
737
+ isSubmitSuccessful: $(t.errors),
738
+ submitCount: t.submitCount + 1,
739
+ errors: t.errors
740
+ });
741
+ }, At = (s, l = {}) => {
742
+ g(n, s) && (R(l.defaultValue) ? ne(s, g(o, s)) : (ne(s, l.defaultValue), S(o, s, l.defaultValue)), l.keepTouched || P(t.touchedFields, s), l.keepDirty || (P(t.dirtyFields, s), t.isDirty = l.defaultValue ? x(s, g(o, s)) : x()), l.keepError || (P(t.errors, s), E.isValid && v()), p.state.next({ ...t }));
743
+ }, $e = (s, l = {}) => {
744
+ const a = s || o, f = ee(a), h = s && !$(s) ? f : o;
745
+ if (l.keepDefaultValues || (o = a), !l.keepValues) {
746
+ if (l.keepDirtyValues || V)
747
+ for (const u of y.mount)
748
+ g(t.dirtyFields, u) ? S(h, u, g(d, u)) : ne(u, g(h, u));
749
+ else {
750
+ if (Re && R(s))
751
+ for (const u of y.mount) {
752
+ const m = g(n, u);
753
+ if (m && m._f) {
754
+ const T = Array.isArray(m._f.refs) ? m._f.refs[0] : m._f.ref;
755
+ if (ve(T)) {
756
+ const j = T.closest("form");
757
+ if (j) {
758
+ j.reset();
759
+ break;
760
+ }
761
+ }
762
+ }
763
+ }
764
+ n = {};
765
+ }
766
+ d = e.shouldUnregister ? l.keepDefaultValues ? ee(o) : {} : f, p.array.next({
767
+ values: { ...h }
768
+ }), p.values.next({
769
+ values: { ...h }
770
+ });
771
+ }
772
+ y = {
773
+ mount: /* @__PURE__ */ new Set(),
774
+ unMount: /* @__PURE__ */ new Set(),
775
+ array: /* @__PURE__ */ new Set(),
776
+ watch: /* @__PURE__ */ new Set(),
777
+ watchAll: !1,
778
+ focus: ""
779
+ }, !b.mount && i(), b.mount = !E.isValid || !!l.keepIsValid, b.watch = !!e.shouldUnregister, p.state.next({
780
+ submitCount: l.keepSubmitCount ? t.submitCount : 0,
781
+ isDirty: l.keepDirty ? t.isDirty : !!(l.keepDefaultValues && !le(s, o)),
782
+ isSubmitted: l.keepIsSubmitted ? t.isSubmitted : !1,
783
+ dirtyFields: l.keepDirtyValues ? t.dirtyFields : l.keepDefaultValues && s ? De(o, s) : {},
784
+ touchedFields: l.keepTouched ? t.touchedFields : {},
785
+ errors: l.keepErrors ? t.errors : {},
786
+ isSubmitting: !1,
787
+ isSubmitSuccessful: !1
788
+ });
789
+ }, ze = (s, l) => $e(ue(s) ? s(d) : s, l), Ft = (s, l = {}) => {
790
+ const a = g(n, s), f = a && a._f;
791
+ if (f) {
792
+ const h = f.refs ? f.refs[0] : f.ref;
793
+ h.focus && (h.focus(), l.shouldSelect && h.select());
794
+ }
795
+ }, Dt = (s) => {
796
+ t = {
797
+ ...t,
798
+ ...s
799
+ };
800
+ };
801
+ return ue(r.defaultValues) && r.defaultValues().then((s) => {
802
+ ze(s, r.resetOptions), p.state.next({
803
+ isLoading: !1
804
+ });
805
+ }), {
806
+ control: {
807
+ register: Ve,
808
+ unregister: we,
809
+ getFieldState: Ne,
810
+ _executeSchema: q,
811
+ _getWatch: C,
812
+ _getDirty: x,
813
+ _updateValid: v,
814
+ _removeUnmounted: O,
815
+ _updateFieldArray: H,
816
+ _getFieldArray: U,
817
+ _reset: $e,
818
+ _updateFormState: Dt,
819
+ _subjects: p,
820
+ _proxyFormState: E,
821
+ get _fields() {
822
+ return n;
823
+ },
824
+ get _formValues() {
825
+ return d;
826
+ },
827
+ get _state() {
828
+ return b;
829
+ },
830
+ set _state(s) {
831
+ b = s;
832
+ },
833
+ get _defaultValues() {
834
+ return o;
835
+ },
836
+ get _names() {
837
+ return y;
838
+ },
839
+ set _names(s) {
840
+ y = s;
841
+ },
842
+ get _formState() {
843
+ return t;
844
+ },
845
+ set _formState(s) {
846
+ t = s;
847
+ },
848
+ get _options() {
849
+ return r;
850
+ },
851
+ set _options(s) {
852
+ r = {
853
+ ...r,
854
+ ...s
855
+ };
856
+ }
857
+ },
858
+ trigger: fe,
859
+ register: Ve,
860
+ handleSubmit: St,
861
+ watch: kt,
862
+ setValue: ne,
863
+ getValues: Ue,
864
+ reset: ze,
865
+ resetField: At,
866
+ clearErrors: wt,
867
+ unregister: we,
868
+ setError: Vt,
869
+ setFocus: Ft,
870
+ getFieldState: Ne
871
+ };
872
+ }
873
+ function rr(e = {}) {
874
+ const i = B.useRef(), [r, t] = B.useState({
875
+ isDirty: !1,
876
+ isValidating: !1,
877
+ isLoading: !0,
878
+ isSubmitted: !1,
879
+ isSubmitting: !1,
880
+ isSubmitSuccessful: !1,
881
+ isValid: !1,
882
+ submitCount: 0,
883
+ dirtyFields: {},
884
+ touchedFields: {},
885
+ errors: {},
886
+ defaultValues: ue(e.defaultValues) ? void 0 : e.defaultValues
887
+ });
888
+ i.current || (i.current = {
889
+ ...tr(e, () => t((o) => ({ ...o }))),
890
+ formState: r
891
+ });
892
+ const n = i.current.control;
893
+ return n._options = e, Pe({
894
+ subject: n._subjects.state,
895
+ next: (o) => {
896
+ ft(o, n._proxyFormState, n._updateFormState, !0) && t({ ...n._formState });
897
+ }
898
+ }), B.useEffect(() => {
899
+ e.values && !le(e.values, n._defaultValues) && n._reset(e.values, n._options.resetOptions);
900
+ }, [e.values, n]), B.useEffect(() => {
901
+ n._state.mount || (n._updateValid(), n._state.mount = !0), n._state.watch && (n._state.watch = !1, n._subjects.state.next({ ...n._formState })), n._removeUnmounted();
902
+ }), i.current.formState = dt(r, n), i.current;
903
+ }
904
+ var _ = {
905
+ primary: "#0e101c",
906
+ secondary: "#bf1650",
907
+ lightBlue: "#516391",
908
+ blue: "#1e2a4a",
909
+ lightPink: "#ec5990",
910
+ errorPink: "#fbecf2",
911
+ buttonBlue: "#191d3a",
912
+ link: "#ff7aa8",
913
+ green: "#1bda2b"
914
+ };
915
+ const k = {
916
+ fontSize: 13,
917
+ lineHeight: "20px"
918
+ }, te = Oe.button`
919
+ appearance: none;
920
+ margin: 0;
921
+ border: 0;
922
+ color: white;
923
+ padding: 5px !important;
924
+ border-radius: 0 !important;
925
+ background: ${(e) => e.hideBackground ? "" : `${_.blue} !important`};
926
+ transition: 0.2s all;
927
+
928
+ &:hover {
929
+ background: ${_.lightBlue};
930
+ }
931
+ `;
932
+ te.defaultProps = { type: "button" };
933
+ const sr = Oe(te)`
934
+ font-size: 14px;
935
+ font-weight: bold;
936
+ margin: 0 4px 0 auto;
937
+ background: none !important;
938
+ display: flex;
939
+ width: 25px;
940
+ height: 25px;
941
+ justify-content: center;
942
+ line-height: 14px !important;
943
+ border-radius: 50% !important;
944
+ padding: 0 !important;
945
+ transition: 0.2s all;
946
+
947
+ &:hover {
948
+ background: ${_.lightBlue};
949
+ }
950
+
951
+ &:active {
952
+ background: black;
953
+ }
954
+ `, ir = Oe.input`
955
+ &::placeholder {
956
+ color: #b3b3b3;
957
+ }
958
+
959
+ &:focus::placeholder {
960
+ color: white;
961
+ }
962
+ `, nr = Oe.table`
963
+ transition: 0.3s all;
964
+
965
+ &:hover {
966
+ background: ${_.primary};
967
+ }
968
+ `, lr = ({ setVisible: e, control: i }) => {
969
+ const { isValid: r } = Me({
970
+ control: i
971
+ });
972
+ return c.createElement(
973
+ "header",
974
+ { style: {
975
+ display: "flex",
976
+ alignItems: "center",
977
+ paddingLeft: 10,
978
+ backgroundColor: "transparent"
979
+ } },
980
+ c.createElement(
981
+ "p",
982
+ { style: Object.assign(Object.assign({}, k), { margin: 0, padding: 0, fontWeight: 400, fontSize: 12 }) },
983
+ c.createElement("span", { style: {
984
+ transition: "0.5s all",
985
+ color: r ? _.green : _.lightPink
986
+ } }, "■"),
987
+ " ",
988
+ "React Hook Form"
989
+ ),
990
+ c.createElement(sr, { title: "Close dev panel", onClick: () => e(!1) }, "✕")
991
+ );
992
+ }, ar = ({ refObject: e, hasError: i, isDirty: r, fieldsValues: t, isNative: n, errorMessage: o, errorType: d, type: b, isTouched: y, name: w, collapseAll: A }) => {
993
+ const [E, p] = c.useState(!1);
994
+ c.useEffect(() => {
995
+ p(!A);
996
+ }, [A]);
997
+ let V = t ? g(t, w) : "", D = !1;
998
+ if (!Xe(V))
999
+ if (Mt(V))
1000
+ try {
1001
+ V = c.createElement(
1002
+ "pre",
1003
+ { style: { margin: 0 } },
1004
+ c.createElement("code", { style: { fontSize: 12 } }, JSON.stringify(V, null, 2))
1005
+ ), D = !0;
1006
+ } catch {
1007
+ V = c.createElement("span", null, "[Nested Object]");
1008
+ }
1009
+ else
1010
+ typeof V != "string" && (V = String(V));
1011
+ return c.createElement(
1012
+ nr,
1013
+ { style: {
1014
+ padding: "5px 8px",
1015
+ width: "100%",
1016
+ transition: ".3s all",
1017
+ borderLeft: `2px solid ${i ? _.secondary : _.buttonBlue}`,
1018
+ background: "none"
1019
+ } },
1020
+ c.createElement(
1021
+ "thead",
1022
+ null,
1023
+ c.createElement(
1024
+ "tr",
1025
+ null,
1026
+ c.createElement(
1027
+ "td",
1028
+ { valign: "top", style: { width: 85, lineHeight: "22px" } },
1029
+ c.createElement(te, { onClick: () => p(!E), title: "Toggle field table", style: {
1030
+ border: `1px solid ${_.lightBlue}`,
1031
+ borderRadius: 2,
1032
+ padding: "3px 5px",
1033
+ display: "inline-block",
1034
+ fontSize: 9,
1035
+ lineHeight: "13px",
1036
+ width: 20,
1037
+ textAlign: "center",
1038
+ marginRight: 8
1039
+ } }, E ? "+" : "-"),
1040
+ c.createElement(te, { onClick: () => {
1041
+ e.scrollIntoView && e.scrollIntoView({ behavior: "smooth" });
1042
+ }, title: "Scroll into view", style: Object.assign({ border: `1px solid ${_.lightBlue}`, borderRadius: 2, padding: "3px 5px", display: "inline-block", fontSize: 9, lineHeight: "13px", textAlign: "center", width: "calc(100% - 30px)" }, n ? {} : { cursor: "not-allowed", background: _.lightBlue }) }, n ? "Native" : "Custom")
1043
+ ),
1044
+ c.createElement(
1045
+ "td",
1046
+ { style: {
1047
+ display: "block",
1048
+ maxWidth: 140
1049
+ } },
1050
+ c.createElement("p", { style: Object.assign(Object.assign({ margin: 0, padding: 0, top: 0, position: "relative", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, k), { lineHeight: "24px" }), title: w }, w)
1051
+ )
1052
+ )
1053
+ ),
1054
+ !E && c.createElement(
1055
+ "tbody",
1056
+ null,
1057
+ b && c.createElement(
1058
+ "tr",
1059
+ null,
1060
+ c.createElement("td", { align: "right", style: Object.assign({ paddingRight: 5, fontWeight: 500, verticalAlign: "top" }, k) }, "Type:"),
1061
+ c.createElement("td", { style: Object.assign({ display: "block", maxWidth: 100 }, k) }, b)
1062
+ ),
1063
+ d && c.createElement(
1064
+ "tr",
1065
+ null,
1066
+ c.createElement("td", { align: "right", style: Object.assign({ paddingRight: 5, fontWeight: 500, verticalAlign: "top" }, k) }, "ERROR Type:"),
1067
+ c.createElement("td", { style: Object.assign({ display: "block", maxWidth: 100 }, k) }, d)
1068
+ ),
1069
+ o && c.createElement(
1070
+ "tr",
1071
+ null,
1072
+ c.createElement("td", { align: "right", style: Object.assign({ paddingRight: 5, fontWeight: 500, verticalAlign: "top" }, k) }, "MESSAGE:"),
1073
+ c.createElement("td", { style: Object.assign({ display: "block", maxWidth: 100 }, k) }, typeof o == "string" ? o.trim() : JSON.stringify(o))
1074
+ ),
1075
+ !Xe(V) && c.createElement(
1076
+ "tr",
1077
+ null,
1078
+ c.createElement("td", { align: "right", style: Object.assign({ paddingRight: 5, fontWeight: 500, verticalAlign: "top" }, k) }, "Value:"),
1079
+ c.createElement(
1080
+ "td",
1081
+ { "data-testid": `${w}-field-value`, style: Object.assign({ display: "block", maxWidth: 100 }, k) },
1082
+ !D && c.createElement("p", { title: V, style: Object.assign(Object.assign({}, k), { margin: 0, padding: 0 }) }, V),
1083
+ D && c.createElement("div", { style: Object.assign(Object.assign({}, k), { margin: 0, padding: 0 }) }, V)
1084
+ )
1085
+ ),
1086
+ c.createElement(
1087
+ "tr",
1088
+ null,
1089
+ c.createElement("td", { align: "right", style: Object.assign({ paddingRight: 5, fontWeight: 500, verticalAlign: "top" }, k) }, "Touched:"),
1090
+ c.createElement(
1091
+ "td",
1092
+ null,
1093
+ c.createElement("code", { style: Object.assign(Object.assign({ color: y ? _.green : _.lightPink }, k), { fontSize: 12 }) }, y ? "true" : "false")
1094
+ )
1095
+ ),
1096
+ c.createElement(
1097
+ "tr",
1098
+ null,
1099
+ c.createElement("td", { align: "right", style: Object.assign({ paddingRight: 5, fontWeight: 500, verticalAlign: "top" }, k) }, "Dirty:"),
1100
+ c.createElement(
1101
+ "td",
1102
+ null,
1103
+ c.createElement("code", { style: Object.assign(Object.assign({ color: r ? _.green : _.lightPink }, k), { fontSize: 12 }) }, r ? "true" : "false")
1104
+ )
1105
+ )
1106
+ )
1107
+ );
1108
+ }, or = ({ formState: e, showFormState: i, setShowFormState: r }) => c.createElement(
1109
+ "div",
1110
+ { style: {
1111
+ alignSelf: "end"
1112
+ } },
1113
+ c.createElement(ot, { play: i, start: { opacity: 0 }, end: { opacity: 1 }, render: ({ style: t }) => c.createElement(
1114
+ "table",
1115
+ { style: Object.assign({ padding: "5px 10px", display: "block", background: "black", borderTop: `1px solid ${_.lightPink}`, pointerEvents: "none" }, t) },
1116
+ c.createElement(
1117
+ "tbody",
1118
+ null,
1119
+ c.createElement(
1120
+ "tr",
1121
+ null,
1122
+ c.createElement("td", { align: "right", style: Object.assign({ width: 90 }, k) }, "Valid:"),
1123
+ c.createElement("td", { style: Object.assign({ color: e.isValid ? _.green : _.lightPink }, k) }, e.isValid ? "true" : "false")
1124
+ ),
1125
+ c.createElement(
1126
+ "tr",
1127
+ null,
1128
+ c.createElement("td", { align: "right", style: Object.assign({}, k) }, "Dirty:"),
1129
+ c.createElement("td", { style: Object.assign({ color: e.isDirty ? _.green : _.lightPink }, k) }, e.isDirty ? "true" : "false")
1130
+ ),
1131
+ c.createElement(
1132
+ "tr",
1133
+ null,
1134
+ c.createElement("td", { align: "right", style: Object.assign({}, k) }, "Submitted:"),
1135
+ c.createElement("td", { style: Object.assign({ color: e.isSubmitted ? _.green : _.lightPink }, k) }, e.isSubmitted ? "true" : "false")
1136
+ ),
1137
+ c.createElement(
1138
+ "tr",
1139
+ null,
1140
+ c.createElement("td", { align: "right", style: Object.assign({}, k) }, "Count:"),
1141
+ c.createElement("td", { style: Object.assign({ color: e.submitCount ? _.green : _.lightPink }, k) }, e.submitCount)
1142
+ ),
1143
+ c.createElement(
1144
+ "tr",
1145
+ null,
1146
+ c.createElement("td", { align: "right", style: Object.assign({}, k) }, "Submitting:"),
1147
+ c.createElement("td", { style: Object.assign({ color: e.isSubmitting ? _.green : _.lightPink }, k) }, e.isSubmitting ? "true" : "false")
1148
+ )
1149
+ )
1150
+ ) }),
1151
+ c.createElement(
1152
+ te,
1153
+ { style: {
1154
+ margin: 0,
1155
+ width: "100%",
1156
+ padding: "8px 10px",
1157
+ textTransform: "none",
1158
+ fontSize: 12,
1159
+ lineHeight: "14px",
1160
+ cursor: "pointer"
1161
+ }, title: "Toggle form state panel", onClick: () => {
1162
+ r(!i);
1163
+ } },
1164
+ c.createElement("span", { style: {
1165
+ transition: "0.5s all",
1166
+ color: e.isValid ? _.green : _.lightPink
1167
+ } }, "■"),
1168
+ " ",
1169
+ "Form State: ",
1170
+ i ? "OFF" : "ON"
1171
+ )
1172
+ );
1173
+ function cr(e, i) {
1174
+ return Object.assign(Object.assign({}, e), { visible: i });
1175
+ }
1176
+ function ur(e, i) {
1177
+ return Object.assign(Object.assign({}, e), { isCollapse: i });
1178
+ }
1179
+ let Ce = 0;
1180
+ function Ot({ fields: e, searchTerm: i, touchedFields: r, errors: t, dirtyFields: n, state: o, fieldsValues: d }) {
1181
+ return c.createElement(c.Fragment, null, e && Object.entries(e).filter(([b]) => (b && b.toLowerCase && b.toLowerCase().includes(i) || !b && !i || i === "") && b).map(([b, y], w) => {
1182
+ if (Ce++, y != null && y._f) {
1183
+ const A = g(t, y._f.name), E = g(A, "message", void 0), p = g(A, "type", void 0), V = g(y, "ref.type", void 0), D = !!g(r, y._f.name), Q = !!(y && y._f.ref.type), Y = !!g(n, y._f.name), re = !!A, v = g(y, "_f.ref");
1184
+ return c.createElement(
1185
+ "section",
1186
+ { key: (y == null ? void 0 : y._f.name) + Ce, style: {
1187
+ borderBottom: `1px dashed ${_.secondary}`,
1188
+ margin: 0
1189
+ } },
1190
+ c.createElement(ar, { refObject: v, index: w, collapseAll: o.isCollapse, name: y == null ? void 0 : y._f.name, isTouched: D, type: V, hasError: re, isNative: Q, errorMessage: E, errorType: p, isDirty: Y, fieldsValues: d })
1191
+ );
1192
+ } else
1193
+ return c.createElement(Ot, Object.assign({ key: b + Ce }, {
1194
+ fields: y,
1195
+ searchTerm: i,
1196
+ touchedFields: r,
1197
+ errors: t,
1198
+ dirtyFields: n,
1199
+ state: o,
1200
+ fieldsValues: d
1201
+ }));
1202
+ }));
1203
+ }
1204
+ const dr = ({ control: e, control: { _fields: i } }) => {
1205
+ const r = Me({
1206
+ control: e
1207
+ }), { dirtyFields: t, touchedFields: n, errors: o } = r;
1208
+ r.isDirty;
1209
+ const { state: d, actions: b } = lt({
1210
+ setCollapse: ur
1211
+ }), [, y] = c.useState({}), [w, A] = c.useState(!1), E = ht({
1212
+ control: e
1213
+ }), { register: p, watch: V } = rr(), D = V("search", "");
1214
+ return at(() => {
1215
+ y({});
1216
+ }, []), c.createElement(
1217
+ "div",
1218
+ { style: {
1219
+ display: "grid",
1220
+ gridTemplateRows: "56px auto",
1221
+ height: process.env.NODE_ENV === "test" ? "100vh" : "calc(100vh - 40px)"
1222
+ } },
1223
+ c.createElement(
1224
+ "div",
1225
+ { style: {
1226
+ display: "grid",
1227
+ gridTemplateColumns: "1fr 1fr",
1228
+ gridTemplateRows: "28px 28px"
1229
+ } },
1230
+ c.createElement(te, { style: {
1231
+ borderRight: `1px solid ${_.primary}`,
1232
+ textTransform: "none",
1233
+ fontSize: 11,
1234
+ lineHeight: 1
1235
+ }, title: "Update values and state the form", onClick: () => y({}) }, "♺ REFRESH"),
1236
+ c.createElement(te, { style: {
1237
+ borderRight: `1px solid ${_.primary}`,
1238
+ textTransform: "none",
1239
+ fontSize: 11,
1240
+ lineHeight: 1
1241
+ }, title: "Toggle entire fields", onClick: () => {
1242
+ b.setCollapse(!d.isCollapse);
1243
+ } }, d.isCollapse ? "[-] COLLAPSE" : "[+] EXPAND"),
1244
+ c.createElement(ir, Object.assign({ style: {
1245
+ display: "inline-block",
1246
+ borderRadius: 0,
1247
+ width: "100%",
1248
+ margin: 0,
1249
+ padding: "5px 10px",
1250
+ WebkitAppearance: "none",
1251
+ appearance: "none",
1252
+ fontSize: 14,
1253
+ border: 0,
1254
+ color: "white",
1255
+ gridColumnStart: 1,
1256
+ gridColumnEnd: 4,
1257
+ background: "black"
1258
+ } }, p("search"), { placeholder: "Filter name...", type: "search" }))
1259
+ ),
1260
+ c.createElement(
1261
+ "div",
1262
+ { style: {
1263
+ overflow: "auto"
1264
+ } },
1265
+ c.createElement(Ot, { fields: i, searchTerm: D, errors: o, touchedFields: n, dirtyFields: t, fieldsValues: E, state: d })
1266
+ ),
1267
+ c.createElement(or, { formState: r, showFormState: w, setShowFormState: A })
1268
+ );
1269
+ }, fr = ({ style: e, actions: i }) => c.createElement(
1270
+ "svg",
1271
+ { fill: "white", viewBox: "0 0 100 100", style: Object.assign({ height: 14, padding: 3, borderRadius: 2, background: _.lightPink }, e), onClick: () => {
1272
+ i.setVisible(!0);
1273
+ }, "aria-label": "React Hook Form Logo" },
1274
+ c.createElement("path", { d: "M73.56,13.32H58.14a8.54,8.54,0,0,0-16.27,0H26.44a11,11,0,0,0-11,11V81.63a11,11,0,0,0,11,11H73.56a11,11,0,0,0,11-11V24.32A11,11,0,0,0,73.56,13.32Zm-30.92,2a1,1,0,0,0,1-.79,6.54,6.54,0,0,1,12.78,0,1,1,0,0,0,1,.79h5.38v6.55a3,3,0,0,1-3,3H40.25a3,3,0,0,1-3-3V15.32ZM82.56,81.63a9,9,0,0,1-9,9H26.44a9,9,0,0,1-9-9V24.32a9,9,0,0,1,9-9h8.81v6.55a5,5,0,0,0,5,5h19.5a5,5,0,0,0,5-5V15.32h8.81a9,9,0,0,1,9,9Z" }),
1275
+ c.createElement("path", { style: { transform: "translateX(-25px)" }, d: "M71.6,45.92H54a1,1,0,0,0,0,2H71.6a1,1,0,0,0,0-2Z" }),
1276
+ c.createElement("path", { d: "M71.6,45.92H54a1,1,0,0,0,0,2H71.6a1,1,0,0,0,0-2Z" }),
1277
+ c.createElement("path", { style: { transform: "translateX(-25px)" }, d: "M71.1,69.49H53.45a1,1,0,1,0,0,2H71.1a1,1,0,0,0,0-2Z" }),
1278
+ c.createElement("path", { d: "M71.1,69.49H53.45a1,1,0,1,0,0,2H71.1a1,1,0,0,0,0-2Z" })
1279
+ );
1280
+ function it(e, i = 0, r = 0) {
1281
+ const [t, n] = e.split("-");
1282
+ return {
1283
+ [t]: i,
1284
+ [n]: r
1285
+ };
1286
+ }
1287
+ const gr = ({ control: e, placement: i = "top-right", styles: r }) => {
1288
+ const { state: t, actions: n } = lt({
1289
+ setVisible: cr
1290
+ }), o = it(i, 0, 0);
1291
+ return c.createElement(
1292
+ c.Fragment,
1293
+ null,
1294
+ c.createElement(
1295
+ ot,
1296
+ { play: t.visible, duration: 0.2, start: Object.assign(Object.assign({}, o), { position: "fixed", transform: i.includes("right") ? "translateX(280px)" : "translateX(-280px)", zIndex: 99999 }), end: Object.assign(Object.assign({}, o), { position: "fixed", transform: "translateX(0)", zIndex: 99999 }) },
1297
+ c.createElement(
1298
+ "div",
1299
+ { style: Object.assign(Object.assign(Object.assign({}, o), { position: "fixed", height: "100vh", width: 250, zIndex: 99999, background: _.buttonBlue, display: "grid", textAlign: "left", color: "white", fontSize: 14, gridTemplateRows: "40px auto", fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif" }), r == null ? void 0 : r.panel) },
1300
+ c.createElement(lr, { setVisible: n.setVisible, control: e }),
1301
+ c.createElement(dr, { control: e })
1302
+ )
1303
+ ),
1304
+ !t.visible && c.createElement(
1305
+ te,
1306
+ { title: "Show dev panel", hideBackground: !0, style: Object.assign(Object.assign(Object.assign({ position: "fixed", zIndex: 99999 }, it(i, 3, 3)), { padding: 3, margin: 0, background: "none" }), r == null ? void 0 : r.button) },
1307
+ c.createElement(fr, { actions: n })
1308
+ )
1309
+ );
1310
+ };
1311
+ /*! *****************************************************************************
1312
+ Copyright (c) Microsoft Corporation.
1313
+
1314
+ Permission to use, copy, modify, and/or distribute this software for any
1315
+ purpose with or without fee is hereby granted.
1316
+
1317
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1318
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1319
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1320
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1321
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1322
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1323
+ PERFORMANCE OF THIS SOFTWARE.
1324
+ ***************************************************************************** */
1325
+ function yr(e, i) {
1326
+ var r = {};
1327
+ for (var t in e)
1328
+ Object.prototype.hasOwnProperty.call(e, t) && i.indexOf(t) < 0 && (r[t] = e[t]);
1329
+ if (e != null && typeof Object.getOwnPropertySymbols == "function")
1330
+ for (var n = 0, t = Object.getOwnPropertySymbols(e); n < t.length; n++)
1331
+ i.indexOf(t[n]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[n]) && (r[t[n]] = e[t[n]]);
1332
+ return r;
1333
+ }
1334
+ function nt(e) {
1335
+ return Reflect.ownKeys(e).reduce((i, r) => (i[r] = e[r], i), {});
1336
+ }
1337
+ function me(e, i, r) {
1338
+ return e.reduce((t, n) => (t[n] = ct(i, n) || r, t), {});
1339
+ }
1340
+ function hr({ id: e, control: i }) {
1341
+ const r = ht({ control: i }), t = Me({ control: i }), [n, o] = Pt(!1), d = (b) => {
1342
+ b.data.source !== "react-hook-form-bridge" || b.data.type !== "INIT" || (window.postMessage({
1343
+ source: "react-hook-form-bridge",
1344
+ type: "WELCOME"
1345
+ }), o(!0));
1346
+ };
1347
+ return at(() => (window.addEventListener("message", d), () => window.removeEventListener("message", d)), []), Bt(() => {
1348
+ if (!n)
1349
+ return;
1350
+ const b = nt(t), { errors: y, dirtyFields: w, touchedFields: A } = b, E = yr(b, ["errors", "dirtyFields", "touchedFields"]), p = [...i._names.mount], V = me(p, r, ""), D = me(p, w, !1), Q = me(p, A, !1), Y = me(p, y), re = Object.entries(Y).reduce((H, [F, M]) => (H[F] = {
1351
+ type: M == null ? void 0 : M.type,
1352
+ message: M == null ? void 0 : M.message
1353
+ }, H), {}), v = p.reduce((H, F) => {
1354
+ var M, K, se;
1355
+ return H[F] = !!(!((se = (K = (M = ct(i._fields, F)) === null || M === void 0 ? void 0 : M._f) === null || K === void 0 ? void 0 : K.ref) === null || se === void 0) && se.type), H;
1356
+ }, {}), N = {
1357
+ id: e,
1358
+ data: {
1359
+ formValues: V,
1360
+ formState: Object.assign({
1361
+ errors: re,
1362
+ dirtyFields: D,
1363
+ touchedFields: Q,
1364
+ nativeFields: v
1365
+ }, E)
1366
+ }
1367
+ };
1368
+ window.postMessage({
1369
+ source: "react-hook-form-bridge",
1370
+ type: "UPDATE",
1371
+ payload: N
1372
+ });
1373
+ }, [n, r, nt(t)]), { isExtensionEnabled: n };
1374
+ }
1375
+ typeof window < "u" && Rt({
1376
+ visible: !1,
1377
+ isCollapse: !1,
1378
+ filterName: ""
1379
+ }, {
1380
+ name: "__REACT_HOOK_FORM_DEVTOOLS__",
1381
+ middleWares: [],
1382
+ storageType: window.localStorage
1383
+ });
1384
+ const Vr = (e) => {
1385
+ var i, r, t;
1386
+ const n = Le(), o = c.useRef("");
1387
+ c.useEffect(() => {
1388
+ o.current = Ht();
1389
+ }, []);
1390
+ const { isExtensionEnabled: d } = hr({
1391
+ id: (i = e == null ? void 0 : e.id) !== null && i !== void 0 ? i : o.current,
1392
+ control: (r = e == null ? void 0 : e.control) !== null && r !== void 0 ? r : n.control
1393
+ });
1394
+ return d ? null : c.createElement(
1395
+ Lt,
1396
+ null,
1397
+ c.createElement(gr, { control: (t = e == null ? void 0 : e.control) !== null && t !== void 0 ? t : n.control, placement: e == null ? void 0 : e.placement, styles: e == null ? void 0 : e.styles })
1398
+ );
1399
+ };
1400
+ export {
1401
+ Vr as DevTool
1402
+ };