UNPKG

expense-manager-react

Version:

A comprehensive expense tracking application built with React, TypeScript, and Supabase

1,447 lines (1,445 loc) 1.3 MB
import * as A from "react"; import E, { forwardRef as Ir, createElement as Ct, useLayoutEffect as a1, useEffect as Ut, useState as Re, createContext as zt, useContext as Rt, useRef as qs, useCallback as _s, isValidElement as Kr, Children as Za, PureComponent as Jr, useImperativeHandle as Bj, useMemo as i1, cloneElement as At, Component as o1 } from "react"; import * as Nc from "react-dom"; import Wj from "react-dom"; var Wt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function et(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } function Uj(e) { if (e.__esModule) return e; var t = e.default; if (typeof t == "function") { var r = function n() { return this instanceof n ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments); }; r.prototype = t.prototype; } else r = {}; return Object.defineProperty(r, "__esModule", { value: !0 }), Object.keys(e).forEach(function(n) { var a = Object.getOwnPropertyDescriptor(e, n); Object.defineProperty(r, n, a.get ? a : { enumerable: !0, get: function() { return e[n]; } }); }), r; } var Hh = { exports: {} }, ns = {}; /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Eg; function zj() { if (Eg) return ns; Eg = 1; var e = E, t = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, a = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, i = { key: !0, ref: !0, __self: !0, __source: !0 }; function o(s, c, l) { var u, f = {}, d = null, h = null; l !== void 0 && (d = "" + l), c.key !== void 0 && (d = "" + c.key), c.ref !== void 0 && (h = c.ref); for (u in c) n.call(c, u) && !i.hasOwnProperty(u) && (f[u] = c[u]); if (s && s.defaultProps) for (u in c = s.defaultProps, c) f[u] === void 0 && (f[u] = c[u]); return { $$typeof: t, type: s, key: d, ref: h, props: f, _owner: a.current }; } return ns.Fragment = r, ns.jsx = o, ns.jsxs = o, ns; } var as = {}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Tg; function Vj() { return Tg || (Tg = 1, process.env.NODE_ENV !== "production" && function() { var e = E, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), s = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), d = Symbol.for("react.lazy"), h = Symbol.for("react.offscreen"), m = Symbol.iterator, v = "@@iterator"; function p($) { if ($ === null || typeof $ != "object") return null; var Q = m && $[m] || $[v]; return typeof Q == "function" ? Q : null; } var b = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function x($) { { for (var Q = arguments.length, ue = new Array(Q > 1 ? Q - 1 : 0), Se = 1; Se < Q; Se++) ue[Se - 1] = arguments[Se]; w("error", $, ue); } } function w($, Q, ue) { { var Se = b.ReactDebugCurrentFrame, qe = Se.getStackAddendum(); qe !== "" && (Q += "%s", ue = ue.concat([qe])); var rt = ue.map(function(Fe) { return String(Fe); }); rt.unshift("Warning: " + Q), Function.prototype.apply.call(console[$], console, rt); } } var S = !1, g = !1, _ = !1, O = !1, P = !1, C; C = Symbol.for("react.module.reference"); function M($) { return !!(typeof $ == "string" || typeof $ == "function" || $ === n || $ === i || P || $ === a || $ === l || $ === u || O || $ === h || S || g || _ || typeof $ == "object" && $ !== null && ($.$$typeof === d || $.$$typeof === f || $.$$typeof === o || $.$$typeof === s || $.$$typeof === c || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. $.$$typeof === C || $.getModuleId !== void 0)); } function j($, Q, ue) { var Se = $.displayName; if (Se) return Se; var qe = Q.displayName || Q.name || ""; return qe !== "" ? ue + "(" + qe + ")" : ue; } function T($) { return $.displayName || "Context"; } function D($) { if ($ == null) return null; if (typeof $.tag == "number" && x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof $ == "function") return $.displayName || $.name || null; if (typeof $ == "string") return $; switch ($) { case n: return "Fragment"; case r: return "Portal"; case i: return "Profiler"; case a: return "StrictMode"; case l: return "Suspense"; case u: return "SuspenseList"; } if (typeof $ == "object") switch ($.$$typeof) { case s: var Q = $; return T(Q) + ".Consumer"; case o: var ue = $; return T(ue._context) + ".Provider"; case c: return j($, $.render, "ForwardRef"); case f: var Se = $.displayName || null; return Se !== null ? Se : D($.type) || "Memo"; case d: { var qe = $, rt = qe._payload, Fe = qe._init; try { return D(Fe(rt)); } catch { return null; } } } return null; } var L = Object.assign, I = 0, F, N, B, H, W, z, K; function Z() { } Z.__reactDisabledLog = !0; function oe() { { if (I === 0) { F = console.log, N = console.info, B = console.warn, H = console.error, W = console.group, z = console.groupCollapsed, K = console.groupEnd; var $ = { configurable: !0, enumerable: !0, value: Z, writable: !0 }; Object.defineProperties(console, { info: $, log: $, warn: $, error: $, group: $, groupCollapsed: $, groupEnd: $ }); } I++; } } function he() { { if (I--, I === 0) { var $ = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: L({}, $, { value: F }), info: L({}, $, { value: N }), warn: L({}, $, { value: B }), error: L({}, $, { value: H }), group: L({}, $, { value: W }), groupCollapsed: L({}, $, { value: z }), groupEnd: L({}, $, { value: K }) }); } I < 0 && x("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var fe = b.ReactCurrentDispatcher, J; function ae($, Q, ue) { { if (J === void 0) try { throw Error(); } catch (qe) { var Se = qe.stack.trim().match(/\n( *(at )?)/); J = Se && Se[1] || ""; } return ` ` + J + $; } } var q = !1, Y; { var re = typeof WeakMap == "function" ? WeakMap : Map; Y = new re(); } function R($, Q) { if (!$ || q) return ""; { var ue = Y.get($); if (ue !== void 0) return ue; } var Se; q = !0; var qe = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var rt; rt = fe.current, fe.current = null, oe(); try { if (Q) { var Fe = function() { throw Error(); }; if (Object.defineProperty(Fe.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(Fe, []); } catch (tr) { Se = tr; } Reflect.construct($, [], Fe); } else { try { Fe.call(); } catch (tr) { Se = tr; } $.call(Fe.prototype); } } else { try { throw Error(); } catch (tr) { Se = tr; } $(); } } catch (tr) { if (tr && Se && typeof tr.stack == "string") { for (var Ie = tr.stack.split(` `), Vt = Se.stack.split(` `), bt = Ie.length - 1, xt = Vt.length - 1; bt >= 1 && xt >= 0 && Ie[bt] !== Vt[xt]; ) xt--; for (; bt >= 1 && xt >= 0; bt--, xt--) if (Ie[bt] !== Vt[xt]) { if (bt !== 1 || xt !== 1) do if (bt--, xt--, xt < 0 || Ie[bt] !== Vt[xt]) { var Pr = ` ` + Ie[bt].replace(" at new ", " at "); return $.displayName && Pr.includes("<anonymous>") && (Pr = Pr.replace("<anonymous>", $.displayName)), typeof $ == "function" && Y.set($, Pr), Pr; } while (bt >= 1 && xt >= 0); break; } } } finally { q = !1, fe.current = rt, he(), Error.prepareStackTrace = qe; } var Si = $ ? $.displayName || $.name : "", ja = Si ? ae(Si) : ""; return typeof $ == "function" && Y.set($, ja), ja; } function ge($, Q, ue) { return R($, !1); } function X($) { var Q = $.prototype; return !!(Q && Q.isReactComponent); } function ke($, Q, ue) { if ($ == null) return ""; if (typeof $ == "function") return R($, X($)); if (typeof $ == "string") return ae($); switch ($) { case l: return ae("Suspense"); case u: return ae("SuspenseList"); } if (typeof $ == "object") switch ($.$$typeof) { case c: return ge($.render); case f: return ke($.type, Q, ue); case d: { var Se = $, qe = Se._payload, rt = Se._init; try { return ke(rt(qe), Q, ue); } catch { } } } return ""; } var Ne = Object.prototype.hasOwnProperty, tt = {}, k = b.ReactDebugCurrentFrame; function U($) { if ($) { var Q = $._owner, ue = ke($.type, $._source, Q ? Q.type : null); k.setExtraStackFrame(ue); } else k.setExtraStackFrame(null); } function V($, Q, ue, Se, qe) { { var rt = Function.call.bind(Ne); for (var Fe in $) if (rt($, Fe)) { var Ie = void 0; try { if (typeof $[Fe] != "function") { var Vt = Error((Se || "React class") + ": " + ue + " type `" + Fe + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof $[Fe] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw Vt.name = "Invariant Violation", Vt; } Ie = $[Fe](Q, Fe, Se, ue, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (bt) { Ie = bt; } Ie && !(Ie instanceof Error) && (U(qe), x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", Se || "React class", ue, Fe, typeof Ie), U(null)), Ie instanceof Error && !(Ie.message in tt) && (tt[Ie.message] = !0, U(qe), x("Failed %s type: %s", ue, Ie.message), U(null)); } } } var ce = Array.isArray; function ne($) { return ce($); } function te($) { { var Q = typeof Symbol == "function" && Symbol.toStringTag, ue = Q && $[Symbol.toStringTag] || $.constructor.name || "Object"; return ue; } } function ve($) { try { return Me($), !1; } catch { return !0; } } function Me($) { return "" + $; } function at($) { if (ve($)) return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", te($)), Me($); } var vt = b.ReactCurrentOwner, ra = { key: !0, ref: !0, __self: !0, __source: !0 }, nl, _i, Ca; Ca = {}; function $d($) { if (Ne.call($, "ref")) { var Q = Object.getOwnPropertyDescriptor($, "ref").get; if (Q && Q.isReactWarning) return !1; } return $.ref !== void 0; } function al($) { if (Ne.call($, "key")) { var Q = Object.getOwnPropertyDescriptor($, "key").get; if (Q && Q.isReactWarning) return !1; } return $.key !== void 0; } function Nd($, Q) { if (typeof $.ref == "string" && vt.current && Q && vt.current.stateNode !== Q) { var ue = D(vt.current.type); Ca[ue] || (x('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', D(vt.current.type), $.ref), Ca[ue] = !0); } } function il($, Q) { { var ue = function() { nl || (nl = !0, x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", Q)); }; ue.isReactWarning = !0, Object.defineProperty($, "key", { get: ue, configurable: !0 }); } } function Ej($, Q) { { var ue = function() { _i || (_i = !0, x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", Q)); }; ue.isReactWarning = !0, Object.defineProperty($, "ref", { get: ue, configurable: !0 }); } } var Tj = function($, Q, ue, Se, qe, rt, Fe) { var Ie = { // This tag allows us to uniquely identify this as a React Element $$typeof: t, // Built-in properties that belong on the element type: $, key: Q, ref: ue, props: Fe, // Record the component responsible for creating this element. _owner: rt }; return Ie._store = {}, Object.defineProperty(Ie._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: !1 }), Object.defineProperty(Ie, "_self", { configurable: !1, enumerable: !1, writable: !1, value: Se }), Object.defineProperty(Ie, "_source", { configurable: !1, enumerable: !1, writable: !1, value: qe }), Object.freeze && (Object.freeze(Ie.props), Object.freeze(Ie)), Ie; }; function Cj($, Q, ue, Se, qe) { { var rt, Fe = {}, Ie = null, Vt = null; ue !== void 0 && (at(ue), Ie = "" + ue), al(Q) && (at(Q.key), Ie = "" + Q.key), $d(Q) && (Vt = Q.ref, Nd(Q, qe)); for (rt in Q) Ne.call(Q, rt) && !ra.hasOwnProperty(rt) && (Fe[rt] = Q[rt]); if ($ && $.defaultProps) { var bt = $.defaultProps; for (rt in bt) Fe[rt] === void 0 && (Fe[rt] = bt[rt]); } if (Ie || Vt) { var xt = typeof $ == "function" ? $.displayName || $.name || "Unknown" : $; Ie && il(Fe, xt), Vt && Ej(Fe, xt); } return Tj($, Ie, Vt, qe, Se, vt.current, Fe); } } var Md = b.ReactCurrentOwner, xg = b.ReactDebugCurrentFrame; function Oi($) { if ($) { var Q = $._owner, ue = ke($.type, $._source, Q ? Q.type : null); xg.setExtraStackFrame(ue); } else xg.setExtraStackFrame(null); } var Rd; Rd = !1; function Dd($) { return typeof $ == "object" && $ !== null && $.$$typeof === t; } function wg() { { if (Md.current) { var $ = D(Md.current.type); if ($) return ` Check the render method of \`` + $ + "`."; } return ""; } } function jj($) { return ""; } var _g = {}; function kj($) { { var Q = wg(); if (!Q) { var ue = typeof $ == "string" ? $ : $.displayName || $.name; ue && (Q = ` Check the top-level render call using <` + ue + ">."); } return Q; } } function Og($, Q) { { if (!$._store || $._store.validated || $.key != null) return; $._store.validated = !0; var ue = kj(Q); if (_g[ue]) return; _g[ue] = !0; var Se = ""; $ && $._owner && $._owner !== Md.current && (Se = " It was passed a child from " + D($._owner.type) + "."), Oi($), x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', ue, Se), Oi(null); } } function Sg($, Q) { { if (typeof $ != "object") return; if (ne($)) for (var ue = 0; ue < $.length; ue++) { var Se = $[ue]; Dd(Se) && Og(Se, Q); } else if (Dd($)) $._store && ($._store.validated = !0); else if ($) { var qe = p($); if (typeof qe == "function" && qe !== $.entries) for (var rt = qe.call($), Fe; !(Fe = rt.next()).done; ) Dd(Fe.value) && Og(Fe.value, Q); } } } function $j($) { { var Q = $.type; if (Q == null || typeof Q == "string") return; var ue; if (typeof Q == "function") ue = Q.propTypes; else if (typeof Q == "object" && (Q.$$typeof === c || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. Q.$$typeof === f)) ue = Q.propTypes; else return; if (ue) { var Se = D(Q); V(ue, $.props, "prop", Se, $); } else if (Q.PropTypes !== void 0 && !Rd) { Rd = !0; var qe = D(Q); x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", qe || "Unknown"); } typeof Q.getDefaultProps == "function" && !Q.getDefaultProps.isReactClassApproved && x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function Nj($) { { for (var Q = Object.keys($.props), ue = 0; ue < Q.length; ue++) { var Se = Q[ue]; if (Se !== "children" && Se !== "key") { Oi($), x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", Se), Oi(null); break; } } $.ref !== null && (Oi($), x("Invalid attribute `ref` supplied to `React.Fragment`."), Oi(null)); } } var Ag = {}; function Pg($, Q, ue, Se, qe, rt) { { var Fe = M($); if (!Fe) { var Ie = ""; ($ === void 0 || typeof $ == "object" && $ !== null && Object.keys($).length === 0) && (Ie += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); var Vt = jj(); Vt ? Ie += Vt : Ie += wg(); var bt; $ === null ? bt = "null" : ne($) ? bt = "array" : $ !== void 0 && $.$$typeof === t ? (bt = "<" + (D($.type) || "Unknown") + " />", Ie = " Did you accidentally export a JSX literal instead of a component?") : bt = typeof $, x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", bt, Ie); } var xt = Cj($, Q, ue, qe, rt); if (xt == null) return xt; if (Fe) { var Pr = Q.children; if (Pr !== void 0) if (Se) if (ne(Pr)) { for (var Si = 0; Si < Pr.length; Si++) Sg(Pr[Si], $); Object.freeze && Object.freeze(Pr); } else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else Sg(Pr, $); } if (Ne.call(Q, "key")) { var ja = D($), tr = Object.keys(Q).filter(function(Fj) { return Fj !== "key"; }), Id = tr.length > 0 ? "{key: someKey, " + tr.join(": ..., ") + ": ...}" : "{key: someKey}"; if (!Ag[ja + Id]) { var Lj = tr.length > 0 ? "{" + tr.join(": ..., ") + ": ...}" : "{}"; x(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`, Id, ja, Lj, ja), Ag[ja + Id] = !0; } } return $ === n ? Nj(xt) : $j(xt), xt; } } function Mj($, Q, ue) { return Pg($, Q, ue, !0); } function Rj($, Q, ue) { return Pg($, Q, ue, !1); } var Dj = Rj, Ij = Mj; as.Fragment = n, as.jsx = Dj, as.jsxs = Ij; }()), as; } process.env.NODE_ENV === "production" ? Hh.exports = zj() : Hh.exports = Vj(); var y = Hh.exports, Mc = (e) => e.type === "checkbox", Li = (e) => e instanceof Date, Ht = (e) => e == null; const s1 = (e) => typeof e == "object"; var jt = (e) => !Ht(e) && !Array.isArray(e) && s1(e) && !Li(e), c1 = (e) => jt(e) && e.target ? Mc(e.target) ? e.target.checked : e.target.value : e, qj = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, l1 = (e, t) => e.has(qj(t)), Hj = (e) => { const t = e.constructor && e.constructor.prototype; return jt(t) && t.hasOwnProperty("isPrototypeOf"); }, om = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u"; function nr(e) { let t; const r = Array.isArray(e); if (e instanceof Date) t = new Date(e); else if (e instanceof Set) t = new Set(e); else if (!(om && (e instanceof Blob || e instanceof FileList)) && (r || jt(e))) if (t = r ? [] : {}, !r && !Hj(e)) t = e; else for (const n in e) e.hasOwnProperty(n) && (t[n] = nr(e[n])); else return e; return t; } var Rc = (e) => Array.isArray(e) ? e.filter(Boolean) : [], yt = (e) => e === void 0, se = (e, t, r) => { if (!t || !jt(e)) return r; const n = Rc(t.split(/[,[\].]+?/)).reduce((a, i) => Ht(a) ? a : a[i], e); return yt(n) || n === e ? yt(e[t]) ? r : e[t] : n; }, rn = (e) => typeof e == "boolean", sm = (e) => /^\w*$/.test(e), u1 = (e) => Rc(e.replace(/["|']|\]/g, "").split(/\.|\[/)), Ze = (e, t, r) => { let n = -1; const a = sm(t) ? [t] : u1(t), i = a.length, o = i - 1; for (; ++n < i; ) { const s = a[n]; let c = r; if (n !== o) { const l = e[s]; c = jt(l) || Array.isArray(l) ? l : isNaN(+a[n + 1]) ? {} : []; } if (s === "__proto__") return; e[s] = c, e = e[s]; } return e; }; const Hl = { BLUR: "blur", FOCUS_OUT: "focusout", CHANGE: "change" }, Vr = { onBlur: "onBlur", onChange: "onChange", onSubmit: "onSubmit", onTouched: "onTouched", all: "all" }, _n = { max: "max", min: "min", maxLength: "maxLength", minLength: "minLength", pattern: "pattern", required: "required", validate: "validate" }, f1 = E.createContext(null), Sf = () => E.useContext(f1), Gj = (e) => { const { children: t, ...r } = e; return E.createElement(f1.Provider, { value: r }, t); }; var d1 = (e, t, r, n = !0) => { const a = { defaultValues: t._defaultValues }; for (const i in e) Object.defineProperty(a, i, { get: () => { const o = i; return t._proxyFormState[o] !== Vr.all && (t._proxyFormState[o] = !n || Vr.all), r && (r[o] = !0), e[o]; } }); return a; }, vr = (e) => jt(e) && !Object.keys(e).length, h1 = (e, t, r, n) => { r(e); const { name: a, ...i } = e; return vr(i) || Object.keys(i).length >= Object.keys(t).length || Object.keys(i).find((o) => t[o] === (!n || Vr.all)); }, Rl = (e) => Array.isArray(e) ? e : [e], p1 = (e, t, r) => !e || !t || e === t || Rl(e).some((n) => n && (r ? n === t : n.startsWith(t) || t.startsWith(n))); function cm(e) { const t = E.useRef(e); t.current = e, E.useEffect(() => { const r = !e.disabled && t.current.subject && t.current.subject.subscribe({ next: t.current.next }); return () => { r && r.unsubscribe(); }; }, [e.disabled]); } function Kj(e) { const t = Sf(), { control: r = t.control, disabled: n, name: a, exact: i } = e || {}, [o, s] = E.useState(r._formState), c = E.useRef(!0), l = E.useRef({ isDirty: !1, isLoading: !1, dirtyFields: !1, touchedFields: !1, validatingFields: !1, isValidating: !1, isValid: !1, errors: !1 }), u = E.useRef(a); return u.current = a, cm({ disabled: n, next: (f) => c.current && p1(u.current, f.name, i) && h1(f, l.current, r._updateFormState) && s({ ...r._formState, ...f }), subject: r._subjects.state }), E.useEffect(() => (c.current = !0, l.current.isValid && r._updateValid(!0), () => { c.current = !1; }), [r]), d1(o, r, l.current, !1); } var an = (e) => typeof e == "string", v1 = (e, t, r, n, a) => an(e) ? (n && t.watch.add(e), se(r, e, a)) : Array.isArray(e) ? e.map((i) => (n && t.watch.add(i), se(r, i))) : (n && (t.watchAll = !0), r); function Yj(e) { const t = Sf(), { control: r = t.control, name: n, defaultValue: a, disabled: i, exact: o } = e || {}, s = E.useRef(n); s.current = n, cm({ disabled: i, subject: r._subjects.values, next: (u) => { p1(s.current, u.name, o) && l(nr(v1(s.current, r._names, u.values || r._formValues, !1, a))); } }); const [c, l] = E.useState(r._getWatch(n, a)); return E.useEffect(() => r._removeUnmounted()), c; } function Xj(e) { const t = Sf(), { name: r, disabled: n, control: a = t.control, shouldUnregister: i } = e, o = l1(a._names.array, r), s = Yj({ control: a, name: r, defaultValue: se(a._formValues, r, se(a._defaultValues, r, e.defaultValue)), exact: !0 }), c = Kj({ control: a, name: r }), l = E.useRef(a.register(r, { ...e.rules, value: s, ...rn(e.disabled) ? { disabled: e.disabled } : {} })); return E.useEffect(() => { const u = a._options.shouldUnregister || i, f = (d, h) => { const m = se(a._fields, d); m && m._f && (m._f.mount = h); }; if (f(r, !0), u) { const d = nr(se(a._options.defaultValues, r)); Ze(a._defaultValues, r, d), yt(se(a._formValues, r)) && Ze(a._formValues, r, d); } return () => { (o ? u && !a._state.action : u) ? a.unregister(r) : f(r, !1); }; }, [r, a, o, i]), E.useEffect(() => { se(a._fields, r) && a._updateDisabledField({ disabled: n, fields: a._fields, name: r, value: se(a._fields, r)._f.value }); }, [n, r, a]), { field: { name: r, value: s, ...rn(n) || c.disabled ? { disabled: c.disabled || n } : {}, onChange: E.useCallback((u) => l.current.onChange({ target: { value: c1(u), name: r }, type: Hl.CHANGE }), [r]), onBlur: E.useCallback(() => l.current.onBlur({ target: { value: se(a._formValues, r), name: r }, type: Hl.BLUR }), [r, a]), ref: (u) => { const f = se(a._fields, r); f && u && (f._f.ref = { focus: () => u.focus(), select: () => u.select(), setCustomValidity: (d) => u.setCustomValidity(d), reportValidity: () => u.reportValidity() }); } }, formState: c, fieldState: Object.defineProperties({}, { invalid: { enumerable: !0, get: () => !!se(c.errors, r) }, isDirty: { enumerable: !0, get: () => !!se(c.dirtyFields, r) }, isTouched: { enumerable: !0, get: () => !!se(c.touchedFields, r) }, isValidating: { enumerable: !0, get: () => !!se(c.validatingFields, r) }, error: { enumerable: !0, get: () => se(c.errors, r) } }) }; } const Zj = (e) => e.render(Xj(e)); var m1 = (e, t, r, n, a) => t ? { ...r[e], types: { ...r[e] && r[e].types ? r[e].types : {}, [n]: a || !0 } } : {}, Cg = (e) => ({ isOnSubmit: !e || e === Vr.onSubmit, isOnBlur: e === Vr.onBlur, isOnChange: e === Vr.onChange, isOnAll: e === Vr.all, isOnTouch: e === Vr.onTouched }), jg = (e, t, r) => !r && (t.watchAll || t.watch.has(e) || [...t.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length)))); const Ms = (e, t, r, n) => { for (const a of r || Object.keys(e)) { const i = se(e, a); if (i) { const { _f: o, ...s } = i; if (o) { if (o.refs && o.refs[0] && t(o.refs[0], a) && !n) break; if (o.ref && t(o.ref, o.name) && !n) break; Ms(s, t); } else jt(s) && Ms(s, t); } } }; var Jj = (e, t, r) => { const n = Rc(se(e, r)); return Ze(n, "root", t[r]), Ze(e, r, n), e; }, lm = (e) => e.type === "file", pa = (e) => typeof e == "function", Gl = (e) => { if (!om) return !1; const t = e ? e.ownerDocument : 0; return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement); }, Dl = (e) => an(e), um = (e) => e.type === "radio", Kl = (e) => e instanceof RegExp; const kg = { value: !1, isValid: !1 }, $g = { value: !0, isValid: !0 }; var y1 = (e) => { if (Array.isArray(e)) { if (e.length > 1) { const t = e.filter((r) => r && r.checked && !r.disabled).map((r) => r.value); return { value: t, isValid: !!t.length }; } return e[0].checked && !e[0].disabled ? ( // @ts-expect-error expected to work in the browser e[0].attributes && !yt(e[0].attributes.value) ? yt(e[0].value) || e[0].value === "" ? $g : { value: e[0].value, isValid: !0 } : $g ) : kg; } return kg; }; const Ng = { isValid: !1, value: null }; var g1 = (e) => Array.isArray(e) ? e.reduce((t, r) => r && r.checked && !r.disabled ? { isValid: !0, value: r.value } : t, Ng) : Ng; function Mg(e, t, r = "validate") { if (Dl(e) || Array.isArray(e) && e.every(Dl) || rn(e) && !e) return { type: r, message: Dl(e) ? e : "", ref: t }; } var Ai = (e) => jt(e) && !Kl(e) ? e : { value: e, message: "" }, Rg = async (e, t, r, n, a) => { const { ref: i, refs: o, required: s, maxLength: c, minLength: l, min: u, max: f, pattern: d, validate: h, name: m, valueAsNumber: v, mount: p, disabled: b } = e._f, x = se(t, m); if (!p || b) return {}; const w = o ? o[0] : i, S = (T) => { n && w.reportValidity && (w.setCustomValidity(rn(T) ? "" : T || ""), w.reportValidity()); }, g = {}, _ = um(i), O = Mc(i), P = _ || O, C = (v || lm(i)) && yt(i.value) && yt(x) || Gl(i) && i.value === "" || x === "" || Array.isArray(x) && !x.length, M = m1.bind(null, m, r, g), j = (T, D, L, I = _n.maxLength, F = _n.minLength) => { const N = T ? D : L; g[m] = { type: T ? I : F, message: N, ref: i, ...M(T ? I : F, N) }; }; if (a ? !Array.isArray(x) || !x.length : s && (!P && (C || Ht(x)) || rn(x) && !x || O && !y1(o).isValid || _ && !g1(o).isValid)) { const { value: T, message: D } = Dl(s) ? { value: !!s, message: s } : Ai(s); if (T && (g[m] = { type: _n.required, message: D, ref: w, ...M(_n.required, D) }, !r)) return S(D), g; } if (!C && (!Ht(u) || !Ht(f))) { let T, D; const L = Ai(f), I = Ai(u); if (!Ht(x) && !isNaN(x)) { const F = i.valueAsNumber || x && +x; Ht(L.value) || (T = F > L.value), Ht(I.value) || (D = F < I.value); } else { const F = i.valueAsDate || new Date(x), N = (W) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + W), B = i.type == "time", H = i.type == "week"; an(L.value) && x && (T = B ? N(x) > N(L.value) : H ? x > L.value : F > new Date(L.value)), an(I.value) && x && (D = B ? N(x) < N(I.value) : H ? x < I.value : F < new Date(I.value)); } if ((T || D) && (j(!!T, L.message, I.message, _n.max, _n.min), !r)) return S(g[m].message), g; } if ((c || l) && !C && (an(x) || a && Array.isArray(x))) { const T = Ai(c), D = Ai(l), L = !Ht(T.value) && x.length > +T.value, I = !Ht(D.value) && x.length < +D.value; if ((L || I) && (j(L, T.message, D.message), !r)) return S(g[m].message), g; } if (d && !C && an(x)) { const { value: T, message: D } = Ai(d); if (Kl(T) && !x.match(T) && (g[m] = { type: _n.pattern, message: D, ref: i, ...M(_n.pattern, D) }, !r)) return S(D), g; } if (h) { if (pa(h)) { const T = await h(x, t), D = Mg(T, w); if (D && (g[m] = { ...D, ...M(_n.validate, D.message) }, !r)) return S(D.message), g; } else if (jt(h)) { let T = {}; for (const D in h) { if (!vr(T) && !r) break; const L = Mg(await h[D](x, t), w, D); L && (T = { ...L, ...M(D, L.message) }, S(L.message), r && (g[m] = T)); } if (!vr(T) && (g[m] = { ref: w, ...T }, !r)) return g; } } return S(!0), g; }; function Qj(e, t) { const r = t.slice(0, -1).length; let n = 0; for (; n < r; ) e = yt(e) ? n++ : e[t[n++]]; return e; } function ek(e) { for (const t in e) if (e.hasOwnProperty(t) && !yt(e[t])) return !1; return !0; } function St(e, t) { const r = Array.isArray(t) ? t : sm(t) ? [t] : u1(t), n = r.length === 1 ? e : Qj(e, r), a = r.length - 1, i = r[a]; return n && delete n[i], a !== 0 && (jt(n) && vr(n) || Array.isArray(n) && ek(n)) && St(e, r.slice(0, -1)), e; } var Ld = () => { let e = []; return { get observers() { return e; }, next: (a) => { for (const i of e) i.next && i.next(a); }, subscribe: (a) => (e.push(a), { unsubscribe: () => { e = e.filter((i) => i !== a); } }), unsubscribe: () => { e = []; } }; }, Yl = (e) => Ht(e) || !s1(e); function za(e, t) { if (Yl(e) || Yl(t)) return e === t; if (Li(e) && Li(t)) return e.getTime() === t.getTime(); const r = Object.keys(e), n = Object.keys(t); if (r.length !== n.length) return !1; for (const a of r) { const i = e[a]; if (!n.includes(a)) return !1; if (a !== "ref") { const o = t[a]; if (Li(i) && Li(o) || jt(i) && jt(o) || Array.isArray(i) && Array.isArray(o) ? !za(i, o) : i !== o) return !1; } } return !0; } var b1 = (e) => e.type === "select-multiple", tk = (e) => um(e) || Mc(e), Fd = (e) => Gl(e) && e.isConnected, x1 = (e) => { for (const t in e) if (pa(e[t])) return !0; return !1; }; function Xl(e, t = {}) { const r = Array.isArray(e); if (jt(e) || r) for (const n in e) Array.isArray(e[n]) || jt(e[n]) && !x1(e[n]) ? (t[n] = Array.isArray(e[n]) ? [] : {}, Xl(e[n], t[n])) : Ht(e[n]) || (t[n] = !0); return t; } function w1(e, t, r) { const n = Array.isArray(e); if (jt(e) || n) for (const a in e) Array.isArray(e[a]) || jt(e[a]) && !x1(e[a]) ? yt(t) || Yl(r[a]) ? r[a] = Array.isArray(e[a]) ? Xl(e[a], []) : { ...Xl(e[a]) } : w1(e[a], Ht(t) ? {} : t[a], r[a]) : r[a] = !za(e[a], t[a]); return r; } var ol = (e, t) => w1(e, t, Xl(t)), _1 = (e, { valueAsNumber: t, valueAsDate: r, setValueAs: n }) => yt(e) ? e : t ? e === "" ? NaN : e && +e : r && an(e) ? new Date(e) : n ? n(e) : e; function Bd(e) { const t = e.ref; if (!(e.refs ? e.refs.every((r) => r.disabled) : t.disabled)) return lm(t) ? t.files : um(t) ? g1(e.refs).value : b1(t) ? [...t.selectedOptions].map(({ value: r }) => r) : Mc(t) ? y1(e.refs).value : _1(yt(t.value) ? e.ref.value : t.value, e); } var rk = (e, t, r, n) => { const a = {}; for (const i of e) { const o = se(t, i); o && Ze(a, i, o._f); } return { criteriaMode: r, names: [...e], fields: a, shouldUseNativeValidation: n }; }, is = (e) => yt(e) ? e : Kl(e) ? e.source : jt(e) ? Kl(e.value) ? e.value.source : e.value : e, nk = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate); function Dg(e, t, r) { const n = se(e, r); if (n || sm(r)) return { error: n, name: r }; const a = r.split("."); for (; a.length; ) { const i = a.join("."), o = se(t, i), s = se(e, i); if (o && !Array.isArray(o) && r !== i) return { name: r }; if (s && s.type) return { name: i, error: s }; a.pop(); } return { name: r }; } var ak = (e, t, r, n, a) => a.isOnAll ? !1 : !r && a.isOnTouch ? !(t || e) : (r ? n.isOnBlur : a.isOnBlur) ? !e : (r ? n.isOnChange : a.isOnChange) ? e : !0, ik = (e, t) => !Rc(se(e, t)).length && St(e, t); const ok = { mode: Vr.onSubmit, reValidateMode: Vr.onChange, shouldFocusError: !0 }; function sk(e = {}) { let t = { ...ok, ...e }, r = { submitCount: 0, isDirty: !1, isLoading: pa(t.defaultValues), isValidating: !1, isSubmitted: !1, isSubmitting: !1, isSubmitSuccessful: !1, isValid: !1, touchedFields: {}, dirtyFields: {}, validatingFields: {}, errors: t.errors || {}, disabled: t.disabled || !1 }, n = {}, a = jt(t.defaultValues) || jt(t.values) ? nr(t.defaultValues || t.values) || {} : {}, i = t.shouldUnregister ? {} : nr(a), o = { action: !1, mount: !1, watch: !1 }, s = { mount: /* @__PURE__ */ new Set(), unMount: /* @__PURE__ */ new Set(), array: /* @__PURE__ */ new Set(), watch: /* @__PURE__ */ new Set() }, c, l = 0; const u = { isDirty: !1, dirtyFields: !1, validatingFields: !1, touchedFields: !1, isValidating: !1, isValid: !1, errors: !1 }, f = { values: Ld(), array: Ld(), state: Ld() }, d = Cg(t.mode), h = Cg(t.reValidateMode), m = t.criteriaMode === Vr.all, v = (k) => (U) => { clearTimeout(l), l = setTimeout(k, U); }, p = async (k) => { if (u.isValid || k) { const U = t.resolver ? vr((await P()).errors) : await M(n, !0); U !== r.isValid && f.state.next({ isValid: U }); } }, b = (k, U) => { (u.isValidating || u.validatingFields) && ((k || Array.from(s.mount)).forEach((V) => { V && (U ? Ze(r.validatingFields, V, U) : St(r.validatingFields, V)); }), f.state.next({ validatingFields: r.validatingFields, isValidating: !vr(r.validatingFields) })); }, x = (k, U = [], V, ce, ne = !0, te = !0) => { if (ce && V) { if (o.action = !0, te && Array.isArray(se(n, k))) { const ve = V(se(n, k), ce.argA, ce.argB); ne && Ze(n, k, ve); } if (te && Array.isArray(se(r.errors, k))) { const ve = V(se(r.errors, k), ce.argA, ce.argB); ne && Ze(r.errors, k, ve), ik(r.errors, k); } if (u.touchedFields && te && Array.isArray(se(r.touchedFields, k))) { const ve = V(se(r.touchedFields, k), ce.argA, ce.argB); ne && Ze(r.touchedFields, k, ve); } u.dirtyFields && (r.dirtyFields = ol(a, i)), f.state.next({ name: k, isDirty: T(k, U), dirtyFields: r.dirtyFields, errors: r.errors, isValid: r.isValid }); } else Ze(i, k, U); }, w = (k, U) => { Ze(r.errors, k, U), f.state.next({ errors: r.errors }); }, S = (k) => { r.errors = k, f.state.next({ errors: r.errors, isValid: !1 }); }, g = (k, U, V, ce) => { const ne = se(n, k); if (ne) { const te = se(i, k, yt(V) ? se(a, k) : V); yt(te) || ce && ce.defaultChecked || U ? Ze(i, k, U ? te : Bd(ne._f)) : I(k, te), o.mount && p(); } }, _ = (k, U, V, ce, ne) => { let te = !1, ve = !1; const Me = { name: k }, at = !!(se(n, k) && se(n, k)._f && se(n, k)._f.disabled); if (!V || ce) { u.isDirty && (ve = r.isDirty, r.isDirty = Me.isDirty = T(), te = ve !== Me.isDirty); const vt = at || za(se(a, k), U); ve = !!(!at && se(r.dirtyFields, k)), vt || at ? St(r.dirtyFields, k) : Ze(r.dirtyFields, k, !0), Me.dirtyFields = r.dirtyFields, te = te || u.dirtyFields && ve !== !vt; } if (V) { const vt = se(r.touchedFields, k); vt || (Ze(r.touchedFields, k, V), Me.touchedFields = r.touchedFields, te = te || u.touchedFields && vt !== V); } return te && ne && f.state.next(Me), te ? Me : {}; }, O = (k, U, V, ce) => { const ne = se(r.errors, k), te = u.isValid && rn(U) && r.isValid !== U; if (e.delayError && V ? (c = v(() => w(k, V)), c(e.delayError)) : (clearTimeout(l), c = null, V ? Ze(r.errors, k, V) : St(r.errors, k)), (V ? !za(ne, V) : ne) || !vr(ce) || te) { const ve = { ...ce, ...te && rn(U) ? { isValid: U } : {}, errors: r.errors, name: k }; r = { ...r, ...ve }, f.state.next(ve); } }, P = async (k) => { b(k, !0); const U = await t.resolver(i, t.context, rk(k || s.mount, n, t.criteriaMode, t.shouldUseNativeValidation)); return b(k), U; }, C = async (k) => { const { errors: U } = await P(k); if (k) for (const V of k) { const ce = se(U, V); ce ? Ze(r.errors, V, ce) : St(r.errors, V); } else r.errors = U; return U; }, M = async (k, U, V = { valid: !0 }) => { for (const ce in k) { const ne = k[ce]; if (ne) { const { _f: te, ...ve } = ne; if (te) { const Me = s.array.has(te.name); b([ce], !0); const at = await Rg(ne, i, m, t.shouldUseNativeValidation && !U, Me); if (b([ce]), at[te.name] && (V.valid = !1, U)) break; !U && (se(at, te.name) ? Me ? Jj(r.errors, at, te.name) : Ze(r.errors, te.name, at[te.name]) : St(r.errors, te.name)); } ve && await M(ve, U, V); } } return V.valid; }, j = () => { for (const k of s.unMount) { const U = se(n, k); U && (U._f.refs ? U._f.refs.every((V) => !Fd(V)) : !Fd(U._f.ref)) && fe(k); } s.unMount = /* @__PURE__ */ new Set(); }, T = (k, U) => (k && U && Ze(i, k, U), !za(z(), a)), D = (k, U, V) => v1(k, s, { ...o.mount ? i : yt(U) ? a : an(k) ? { [k]: U } : U }, V, U), L = (k) => Rc(se(o.mount ? i : a, k, e.shouldUnregister ? se(a, k, []) : [])), I = (k, U, V = {}) => { const ce = se(n, k); let ne = U; if (ce) { const te = ce._f; te && (!te.disabled && Ze(i, k, _1(U, te)), ne = Gl(te.ref) && Ht(U) ? "" : U, b1(te.ref) ? [...te.ref.options].forEach((ve) => ve.selected = ne.includes(ve.value)) : te.refs ? Mc(te.ref) ? te.refs.length > 1 ? te.refs.forEach((ve) => (!ve.defaultChecked || !ve.disabled) && (ve.checked = Array.isArray(ne) ? !!ne.find((Me) => Me === ve.value) : ne === ve.value)) : te.refs[0] && (te.refs[0].checked = !!ne) : te.refs.forEach((ve) => ve.checked = ve.value === ne) : lm(te.ref) ? te.ref.value = "" : (te.ref.value = ne, te.ref.type || f.values.next({ name: k, values: { ...i } }))); } (V.shouldDirty || V.shouldTouch) && _(k, ne, V.shouldTouch, V.shouldDirty, !0), V.shouldValidate && W(k); }, F = (k, U, V) => { for (const ce in U) { const ne = U[ce], te = `${k}.${ce}`, ve = se(n, te); (s.array.has(k) || !Yl(ne) || ve && !ve._f) && !Li(ne) ? F(te, ne, V) : I(te, ne, V); } }, N = (k, U, V = {}) => { const ce = se(n, k), ne = s.array.has(k), te = nr(U); Ze(i, k, te), ne ? (f.array.next({ name: k, values: { ...i } }), (u.isDirty || u.dirtyFields) && V.shouldDirty && f.state.next({ name: k, dirtyFields: ol(a, i), isDirty: T(k, te) })) : ce && !ce._f && !Ht(te) ? F(k, te, V) : I(k, te, V), jg(k, s) && f.state.next({ ...r }), f.values.next({ name: o.mount ? k : void 0, values: { ...i } }); }, B = async (k) => { o.mount = !0; const U = k.target; let V = U.name, ce = !0; const ne = se(n, V), te = () => U.type ? Bd(ne._f) : c1(k), ve = (Me) => { ce = Number.isNaN(Me) || Me === se(i, V, Me); }; if (ne) { let Me, at; const vt = te(), ra = k.type === Hl.BLUR || k.type === Hl.FOCUS_OUT, nl = !nk(ne._f) && !t.resolver && !se(r.errors, V) && !ne._f.deps || ak(ra, se(r.touchedFields, V), r.isSubmitted, h, d), _i = jg(V, s, ra); Ze(i, V, vt), ra ? (ne._f.onBlur && ne._f.onBlur(k), c && c(0)) : ne._f.onChange && ne._f.onChange(k); const Ca = _(V, vt, ra, !1), $d = !vr(Ca) || _i; if (!ra && f.values.next({ name: V, type: k.type, values: { ...i } }), nl) return u.isValid && p(), $d && f.state.next({ name: V, ..._i ? {} : Ca }); if (!ra && _i && f.state.next({ ...r }), t.resolver) { const { errors: al } = await P([V]); if (ve(vt), ce) { const Nd = Dg(r.errors, n, V), il = Dg(al, n, Nd.name || V); Me = il.error, V = il.name, at = vr(al); } } else b([V], !0), Me = (await Rg(ne, i, m, t.shouldUseNativeValidation))[V], b([V]), ve(vt), ce && (Me ? at = !1 : u.isValid && (at = await M(n, !0))); ce && (ne._f.deps && W(ne._f.deps), O(V, at, Me, Ca)); } }, H = (k, U) => { if (se(r.errors, U) && k.focus) return k.focus(), 1; }, W = async (k, U = {}) => { let V, ce; const ne = Rl(k); if (t.resolver) { const te = await C(yt(k) ? k : ne); V = vr(te), ce = k ? !ne.some((ve) => se(te, ve)) : V; } else k ? (ce = (await Promise.all(ne.map(async (te) => { const ve = se(n, te); return await M(ve && ve._f ? { [te]: ve } : ve); }))).every(Boolean), !(!ce && !r.isValid) && p()) : ce = V = await M(n); return f.state.next({ ...!an(k) || u.isValid && V !== r.isValid ? {} : { name: k }, ...t.resolver || !k ? { isValid: V } : {}, errors: r.errors }), U.shouldFocus && !ce && Ms(n, H, k ? ne : s.mount), ce; }, z = (k) => { const U = { ...o.mount ? i : a }; return yt(k) ? U : an(k) ? se(U, k) : k.map((V) => se(U, V)); }, K = (k, U) => ({ invalid: !!se((U || r).errors, k), isDirty: !!se((U || r).dirtyFields, k), error: se((U || r).errors, k), isValidating: !!se(r.validatingFields, k), isTouched: !!se((U || r).touchedFields, k) }), Z = (k) => { k && Rl(k).forEach((U) => St(r.errors, U)), f.state.next({ errors: k ? r.errors : {} }); }, oe = (k, U, V) => { const ce = (se(n, k, { _f: {} })._f || {}).ref, ne = se(r.errors, k) || {}, { ref: te, message: ve, type: Me, ...at } = ne; Ze(r.errors, k, { ...at, ...U, ref: ce }), f.state.next({ name: k, errors: r.errors, isValid: !1 }), V && V.shouldFocus && ce && ce.focus && ce.focus(); }, he = (k, U) => pa(k) ? f.values.subscribe({ next: (V) => k(D(void 0, U), V) }) : D(k, U, !0), fe = (k, U = {}) => { for (const V of k ? Rl(k) : s.mount) s.mount.delete(V), s.array.delete(V), U.keepValue || (St(n, V), St(i, V)), !U.keepError && St(r.errors, V), !U.keepDirty && St(r.dirtyFields, V), !U.keepTouched && St(r.touchedFields, V), !U.keepIsValidating && St(r.validatingFields, V), !t.shouldUnregister && !U.keepDefaultValue && St(a, V); f.values.next({ values: { ...i } }), f.state.next({ ...r, ...U.keepDirty ? { isDirty: T() } : {} }), !U.keepIsValid && p(); }, J = ({ disabled: k, name: U, field: V, fields: ce, value: ne }) => { if (rn(k) && o.mount || k) { const te = k ? void 0 : yt(ne) ? Bd(V ? V._f : se(ce, U)._f) : ne; Ze(i, U, te), _(U, te, !1, !1, !0); } }, ae = (k, U = {}) => { let V = se(n, k); const ce = rn(U.disabled); return Ze(n, k, { ...V || {}, _f: { ...V && V._f ? V._f : { ref: { name: k } }, name: k, mount: !0, ...U } }), s.mount.add(k), V ? J({ field: V, disabled: U.disabled