UNPKG

@lanaco/lnc-react-ui

Version:

React component library

1,618 lines (1,571 loc) 129 kB
import { jsxs as ae, jsx as P } from "react/jsx-runtime"; import C, { forwardRef as Hn } from "react"; import Bn from "./CheckBoxInput.js"; import bt from "./TextInput.js"; import qn from "./TextAreaInput.js"; import yr from "./Icon.js"; import Kn from "./Button.js"; import { s as Wn } from "./emotion-styled.browser.esm-DfbrHHed.js"; import { d as Zn } from "./breakpoints-BubDitvo.js"; import { c as Ke, g as Ee } from "./_commonjsHelpers-BkfeUUK-.js"; import We from "./FormField.js"; var Ge = (e) => e.type === "checkbox", _e = (e) => e instanceof Date, Q = (e) => e == null; const ys = (e) => typeof e == "object"; var H = (e) => !Q(e) && !Array.isArray(e) && ys(e) && !_e(e), vs = (e) => H(e) && e.target ? Ge(e.target) ? e.target.checked : e.target.value : e, Jn = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, _s = (e, t) => e.has(Jn(t)), Yn = (e) => { const t = e.constructor && e.constructor.prototype; return H(t) && t.hasOwnProperty("isPrototypeOf"); }, Gt = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u"; function z(e) { if (e instanceof Date) return new Date(e); const t = typeof FileList < "u" && e instanceof FileList; if (Gt && (e instanceof Blob || t)) return e; const r = Array.isArray(e); if (!r && !(H(e) && Yn(e))) return e; const s = r ? [] : Object.create(Object.getPrototypeOf(e)); for (const n in e) Object.prototype.hasOwnProperty.call(e, n) && (s[n] = z(e[n])); return s; } var ot = (e) => /^\w*$/.test(e), U = (e) => e === void 0, Ht = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Bt = (e) => Ht(e.replace(/["|']|\]/g, "").split(/\.|\[/)), v = (e, t, r) => { if (!t || !H(e)) return r; const s = (ot(t) ? [t] : Bt(t)).reduce((n, a) => Q(n) ? n : n[a], e); return U(s) || s === e ? U(e[t]) ? r : e[t] : s; }, ee = (e) => typeof e == "boolean", X = (e) => typeof e == "function", k = (e, t, r) => { let s = -1; const n = ot(t) ? [t] : Bt(t), a = n.length, i = a - 1; for (; ++s < a; ) { const u = n[s]; let c = r; if (s !== i) { const h = e[u]; c = H(h) || Array.isArray(h) ? h : isNaN(+n[s + 1]) ? {} : []; } if (u === "__proto__" || u === "constructor" || u === "prototype") return; e[u] = c, e = e[u]; } }; const Xe = { BLUR: "blur", FOCUS_OUT: "focusout", CHANGE: "change" }, le = { onBlur: "onBlur", onChange: "onChange", onSubmit: "onSubmit", onTouched: "onTouched", all: "all" }, ce = { max: "max", min: "min", maxLength: "maxLength", minLength: "minLength", pattern: "pattern", required: "required", validate: "validate" }, bs = C.createContext(null); bs.displayName = "HookFormControlContext"; const qt = () => C.useContext(bs); var xs = (e, t, r, s = !0) => { const n = { defaultValues: t._defaultValues }; for (const a in e) Object.defineProperty(n, a, { get: () => { const i = a; return t._proxyFormState[i] !== le.all && (t._proxyFormState[i] = !s || le.all), r && (r[i] = !0), e[i]; } }); return n; }; const Kt = typeof window < "u" ? C.useLayoutEffect : C.useEffect; function Xn(e) { const t = qt(), { control: r = t, disabled: s, name: n, exact: a } = e || {}, [i, u] = C.useState(r._formState), c = C.useRef({ isDirty: !1, isLoading: !1, dirtyFields: !1, touchedFields: !1, validatingFields: !1, isValidating: !1, isValid: !1, errors: !1 }); return Kt(() => r._subscribe({ name: n, formState: c.current, exact: a, callback: (h) => { !s && u({ ...r._formState, ...h }); } }), [n, s, a]), C.useEffect(() => { c.current.isValid && r._setValid(!0); }, [r]), C.useMemo(() => xs(i, r, c.current, !1), [i, r]); } var te = (e) => typeof e == "string", At = (e, t, r, s, n) => te(e) ? (s && t.watch.add(e), v(r, e, n)) : Array.isArray(e) ? e.map((a) => (s && t.watch.add(a), v(r, a))) : (s && (t.watchAll = !0), r), Et = (e) => Q(e) || !ys(e); function fe(e, t, r = /* @__PURE__ */ new WeakSet()) { if (Et(e) || Et(t)) return Object.is(e, t); if (_e(e) && _e(t)) return Object.is(e.getTime(), t.getTime()); const s = Object.keys(e), n = Object.keys(t); if (s.length !== n.length) return !1; if (r.has(e) || r.has(t)) return !0; r.add(e), r.add(t); for (const a of s) { const i = e[a]; if (!n.includes(a)) return !1; if (a !== "ref") { const u = t[a]; if (_e(i) && _e(u) || H(i) && H(u) || Array.isArray(i) && Array.isArray(u) ? !fe(i, u, r) : !Object.is(i, u)) return !1; } } return !0; } function Qn(e) { const t = qt(), { control: r = t, name: s, defaultValue: n, disabled: a, exact: i, compute: u } = e || {}, c = C.useRef(n), h = C.useRef(u), m = C.useRef(void 0), d = C.useRef(r), y = C.useRef(s); h.current = u; const [_, E] = C.useState(() => { const w = r._getWatch(s, c.current); return h.current ? h.current(w) : w; }), F = C.useCallback((w) => { const S = At(s, r._names, w || r._formValues, !1, c.current); return h.current ? h.current(S) : S; }, [r._formValues, r._names, s]), T = C.useCallback((w) => { if (!a) { const S = At(s, r._names, w || r._formValues, !1, c.current); if (h.current) { const A = h.current(S); fe(A, m.current) || (E(A), m.current = A); } else E(S); } }, [r._formValues, r._names, a, s]); Kt(() => ((d.current !== r || !fe(y.current, s)) && (d.current = r, y.current = s, T()), r._subscribe({ name: s, formState: { values: !0 }, exact: i, callback: (w) => { T(w.values); } })), [r, i, s, T]), C.useEffect(() => r._removeUnmounted()); const D = d.current !== r, $ = y.current, M = C.useMemo(() => { if (a) return null; const w = !D && !fe($, s); return D || w ? F() : null; }, [a, D, s, $, F]); return M !== null ? M : _; } function ea(e) { const t = qt(), { name: r, disabled: s, control: n = t, shouldUnregister: a, defaultValue: i, exact: u = !0 } = e, c = _s(n._names.array, r), h = C.useMemo(() => v(n._formValues, r, v(n._defaultValues, r, i)), [n, r, i]), m = Qn({ control: n, name: r, defaultValue: h, exact: u }), d = Xn({ control: n, name: r, exact: u }), y = C.useRef(e), _ = C.useRef(void 0), E = C.useRef(n.register(r, { ...e.rules, value: m, ...ee(e.disabled) ? { disabled: e.disabled } : {} })); y.current = e; const F = C.useMemo(() => Object.defineProperties({}, { invalid: { enumerable: !0, get: () => !!v(d.errors, r) }, isDirty: { enumerable: !0, get: () => !!v(d.dirtyFields, r) }, isTouched: { enumerable: !0, get: () => !!v(d.touchedFields, r) }, isValidating: { enumerable: !0, get: () => !!v(d.validatingFields, r) }, error: { enumerable: !0, get: () => v(d.errors, r) } }), [d, r]), T = C.useCallback((w) => E.current.onChange({ target: { value: vs(w), name: r }, type: Xe.CHANGE }), [r]), D = C.useCallback(() => E.current.onBlur({ target: { value: v(n._formValues, r), name: r }, type: Xe.BLUR }), [r, n._formValues]), $ = C.useCallback((w) => { const S = v(n._fields, r); S && S._f && w && (S._f.ref = { focus: () => X(w.focus) && w.focus(), select: () => X(w.select) && w.select(), setCustomValidity: (A) => X(w.setCustomValidity) && w.setCustomValidity(A), reportValidity: () => X(w.reportValidity) && w.reportValidity() }); }, [n._fields, r]), M = C.useMemo(() => ({ name: r, value: m, ...ee(s) || d.disabled ? { disabled: d.disabled || s } : {}, onChange: T, onBlur: D, ref: $ }), [r, s, d.disabled, T, D, $, m]); return C.useEffect(() => { const w = n._options.shouldUnregister || a, S = _.current; S && S !== r && !c && n.unregister(S), n.register(r, { ...y.current.rules, ...ee(y.current.disabled) ? { disabled: y.current.disabled } : {} }); const A = (Z, q) => { const ne = v(n._fields, Z); ne && ne._f && (ne._f.mount = q); }; if (A(r, !0), w) { const Z = z(v(n._options.defaultValues, r, y.current.defaultValue)); k(n._defaultValues, r, Z), U(v(n._formValues, r)) && k(n._formValues, r, Z); } return !c && n.register(r), _.current = r, () => { (c ? w && !n._state.action : w) ? n.unregister(r) : A(r, !1); }; }, [r, n, c, a]), C.useEffect(() => { n._setDisabledField({ disabled: s, name: r }); }, [s, r, n]), C.useMemo(() => ({ field: M, formState: d, fieldState: F }), [M, d, F]); } const Ne = (e) => e.render(ea(e)), ta = C.createContext(null); ta.displayName = "HookFormContext"; var $s = (e, t, r, s, n) => t ? { ...r[e], types: { ...r[e] && r[e].types ? r[e].types : {}, [s]: n || !0 } } : {}, Ue = (e) => Array.isArray(e) ? e : [e], vr = () => { let e = []; return { get observers() { return e; }, next: (n) => { for (const a of e) a.next && a.next(n); }, subscribe: (n) => (e.push(n), { unsubscribe: () => { e = e.filter((a) => a !== n); } }), unsubscribe: () => { e = []; } }; }; function Fs(e, t) { const r = {}; for (const s in e) if (e.hasOwnProperty(s)) { const n = e[s], a = t[s]; if (n && H(n) && a) { const i = Fs(n, a); H(i) && (r[s] = i); } else e[s] && (r[s] = a); } return r; } var Y = (e) => H(e) && !Object.keys(e).length, Wt = (e) => e.type === "file", Qe = (e) => { if (!Gt) return !1; const t = e ? e.ownerDocument : 0; return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement); }, ws = (e) => e.type === "select-multiple", Zt = (e) => e.type === "radio", ra = (e) => Zt(e) || Ge(e), xt = (e) => Qe(e) && e.isConnected; function sa(e, t) { const r = t.slice(0, -1).length; let s = 0; for (; s < r; ) e = U(e) ? s++ : e[t[s++]]; return e; } function na(e) { for (const t in e) if (e.hasOwnProperty(t) && !U(e[t])) return !1; return !0; } function G(e, t) { const r = Array.isArray(t) ? t : ot(t) ? [t] : Bt(t), s = r.length === 1 ? e : sa(e, r), n = r.length - 1, a = r[n]; return s && delete s[a], n !== 0 && (H(s) && Y(s) || Array.isArray(s) && na(s)) && G(e, r.slice(0, -1)), e; } var aa = (e) => { for (const t in e) if (X(e[t])) return !0; return !1; }; function As(e) { return Array.isArray(e) || H(e) && !aa(e); } function St(e, t = {}) { for (const r in e) { const s = e[r]; As(s) ? (t[r] = Array.isArray(s) ? [] : {}, St(s, t[r])) : U(s) || (t[r] = !0); } return t; } function Fe(e, t, r) { r || (r = St(t)); for (const s in e) { const n = e[s]; if (As(n)) U(t) || Et(r[s]) ? r[s] = St(n, Array.isArray(n) ? [] : {}) : Fe(n, Q(t) ? {} : t[s], r[s]); else { const a = t[s]; r[s] = !fe(n, a); } } return r; } const _r = { value: !1, isValid: !1 }, br = { value: !0, isValid: !0 }; var Es = (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 && !U(e[0].attributes.value) ? U(e[0].value) || e[0].value === "" ? br : { value: e[0].value, isValid: !0 } : br ) : _r; } return _r; }, Ss = (e, { valueAsNumber: t, valueAsDate: r, setValueAs: s }) => U(e) ? e : t ? e === "" ? NaN : e && +e : r && te(e) ? new Date(e) : s ? s(e) : e; const xr = { isValid: !1, value: null }; var Cs = (e) => Array.isArray(e) ? e.reduce((t, r) => r && r.checked && !r.disabled ? { isValid: !0, value: r.value } : t, xr) : xr; function $r(e) { const t = e.ref; return Wt(t) ? t.files : Zt(t) ? Cs(e.refs).value : ws(t) ? [...t.selectedOptions].map(({ value: r }) => r) : Ge(t) ? Es(e.refs).value : Ss(U(t.value) ? e.ref.value : t.value, e); } var ia = (e, t, r, s) => { const n = {}; for (const a of e) { const i = v(t, a); i && k(n, a, i._f); } return { criteriaMode: r, names: [...e], fields: n, shouldUseNativeValidation: s }; }, et = (e) => e instanceof RegExp, ke = (e) => U(e) ? e : et(e) ? e.source : H(e) ? et(e.value) ? e.value.source : e.value : e, Fr = (e) => ({ isOnSubmit: !e || e === le.onSubmit, isOnBlur: e === le.onBlur, isOnChange: e === le.onChange, isOnAll: e === le.all, isOnTouch: e === le.onTouched }); const wr = "AsyncFunction"; var oa = (e) => !!e && !!e.validate && !!(X(e.validate) && e.validate.constructor.name === wr || H(e.validate) && Object.values(e.validate).find((t) => t.constructor.name === wr)), ua = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Ar = (e, t, r) => !r && (t.watchAll || t.watch.has(e) || [...t.watch].some((s) => e.startsWith(s) && /^\.\w+/.test(e.slice(s.length)))); const je = (e, t, r, s) => { for (const n of r || Object.keys(e)) { const a = v(e, n); if (a) { const { _f: i, ...u } = a; if (i) { if (i.refs && i.refs[0] && t(i.refs[0], n) && !s) return !0; if (i.ref && t(i.ref, i.name) && !s) return !0; if (je(u, t)) break; } else if (H(u) && je(u, t)) break; } } }; function Er(e, t, r) { const s = v(e, r); if (s || ot(r)) return { error: s, name: r }; const n = r.split("."); for (; n.length; ) { const a = n.join("."), i = v(t, a), u = v(e, a); if (i && !Array.isArray(i) && r !== a) return { name: r }; if (u && u.type) return { name: a, error: u }; if (u && u.root && u.root.type) return { name: `${a}.root`, error: u.root }; n.pop(); } return { name: r }; } var la = (e, t, r, s) => { r(e); const { name: n, ...a } = e; return Y(a) || Object.keys(a).length >= Object.keys(t).length || Object.keys(a).find((i) => t[i] === (!s || le.all)); }, fa = (e, t, r) => !e || !t || e === t || Ue(e).some((s) => s && (r ? s === t : s.startsWith(t) || t.startsWith(s))), ca = (e, t, r, s, n) => n.isOnAll ? !1 : !r && n.isOnTouch ? !(t || e) : (r ? s.isOnBlur : n.isOnBlur) ? !e : (r ? s.isOnChange : n.isOnChange) ? e : !0, da = (e, t) => !Ht(v(e, t)).length && G(e, t), ha = (e, t, r) => { const s = Ue(v(e, r)); return k(s, "root", t[r]), k(e, r, s), e; }; function Sr(e, t, r = "validate") { if (te(e) || Array.isArray(e) && e.every(te) || ee(e) && !e) return { type: r, message: te(e) ? e : "", ref: t }; } var $e = (e) => H(e) && !et(e) ? e : { value: e, message: "" }, Cr = async (e, t, r, s, n, a) => { const { ref: i, refs: u, required: c, maxLength: h, minLength: m, min: d, max: y, pattern: _, validate: E, name: F, valueAsNumber: T, mount: D } = e._f, $ = v(r, F); if (!D || t.has(F)) return {}; const M = u ? u[0] : i, w = (O) => { n && M.reportValidity && (M.setCustomValidity(ee(O) ? "" : O || ""), M.reportValidity()); }, S = {}, A = Zt(i), Z = Ge(i), q = A || Z, ne = (T || Wt(i)) && U(i.value) && U($) || Qe(i) && i.value === "" || $ === "" || Array.isArray($) && !$.length, W = $s.bind(null, F, s, S), xe = (O, V, j, B = ce.maxLength, R = ce.minLength) => { const K = O ? V : j; S[F] = { type: O ? B : R, message: K, ref: i, ...W(O ? B : R, K) }; }; if (a ? !Array.isArray($) || !$.length : c && (!q && (ne || Q($)) || ee($) && !$ || Z && !Es(u).isValid || A && !Cs(u).isValid)) { const { value: O, message: V } = te(c) ? { value: !!c, message: c } : $e(c); if (O && (S[F] = { type: ce.required, message: V, ref: M, ...W(ce.required, V) }, !s)) return w(V), S; } if (!ne && (!Q(d) || !Q(y))) { let O, V; const j = $e(y), B = $e(d); if (!Q($) && !isNaN($)) { const R = i.valueAsNumber || $ && +$; Q(j.value) || (O = R > j.value), Q(B.value) || (V = R < B.value); } else { const R = i.valueAsDate || new Date($), K = (Ie) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + Ie), Pe = i.type == "time", Re = i.type == "week"; te(j.value) && $ && (O = Pe ? K($) > K(j.value) : Re ? $ > j.value : R > new Date(j.value)), te(B.value) && $ && (V = Pe ? K($) < K(B.value) : Re ? $ < B.value : R < new Date(B.value)); } if ((O || V) && (xe(!!O, j.message, B.message, ce.max, ce.min), !s)) return w(S[F].message), S; } if ((h || m) && !ne && (te($) || a && Array.isArray($))) { const O = $e(h), V = $e(m), j = !Q(O.value) && $.length > +O.value, B = !Q(V.value) && $.length < +V.value; if ((j || B) && (xe(j, O.message, V.message), !s)) return w(S[F].message), S; } if (_ && !ne && te($)) { const { value: O, message: V } = $e(_); if (et(O) && !$.match(O) && (S[F] = { type: ce.pattern, message: V, ref: i, ...W(ce.pattern, V) }, !s)) return w(V), S; } if (E) { if (X(E)) { const O = await E($, r), V = Sr(O, M); if (V && (S[F] = { ...V, ...W(ce.validate, V.message) }, !s)) return w(V.message), S; } else if (H(E)) { let O = {}; for (const V in E) { if (!Y(O) && !s) break; const j = Sr(await E[V]($, r), M, V); j && (O = { ...j, ...W(V, j.message) }, w(j.message), s && (S[F] = O)); } if (!Y(O) && (S[F] = { ref: M, ...O }, !s)) return S; } } return w(!0), S; }; const pa = { mode: le.onSubmit, reValidateMode: le.onChange, shouldFocusError: !0 }; function ga(e = {}) { let t = { ...pa, ...e }, r = { submitCount: 0, isDirty: !1, isReady: !1, isLoading: X(t.defaultValues), isValidating: !1, isSubmitted: !1, isSubmitting: !1, isSubmitSuccessful: !1, isValid: !1, touchedFields: {}, dirtyFields: {}, validatingFields: {}, errors: t.errors || {}, disabled: t.disabled || !1 }, s = {}, n = H(t.defaultValues) || H(t.values) ? z(t.defaultValues || t.values) || {} : {}, a = t.shouldUnregister ? {} : z(n), i = { action: !1, mount: !1, watch: !1, keepIsValid: !1 }, u = { mount: /* @__PURE__ */ new Set(), disabled: /* @__PURE__ */ new Set(), unMount: /* @__PURE__ */ new Set(), array: /* @__PURE__ */ new Set(), watch: /* @__PURE__ */ new Set() }, c, h = 0; const m = { isDirty: !1, dirtyFields: !1, validatingFields: !1, touchedFields: !1, isValidating: !1, isValid: !1, errors: !1 }, d = { ...m }; let y = { ...d }; const _ = { array: vr(), state: vr() }, E = t.criteriaMode === le.all, F = (o) => (l) => { clearTimeout(h), h = setTimeout(o, l); }, T = async (o) => { if (!i.keepIsValid && !t.disabled && (d.isValid || y.isValid || o)) { let l; t.resolver ? (l = Y((await q()).errors), D()) : l = await W(s, !0), l !== r.isValid && _.state.next({ isValid: l }); } }, D = (o, l) => { !t.disabled && (d.isValidating || d.validatingFields || y.isValidating || y.validatingFields) && ((o || Array.from(u.mount)).forEach((f) => { f && (l ? k(r.validatingFields, f, l) : G(r.validatingFields, f)); }), _.state.next({ validatingFields: r.validatingFields, isValidating: !Y(r.validatingFields) })); }, $ = (o, l = [], f, b, g = !0, p = !0) => { if (b && f && !t.disabled) { if (i.action = !0, p && Array.isArray(v(s, o))) { const x = f(v(s, o), b.argA, b.argB); g && k(s, o, x); } if (p && Array.isArray(v(r.errors, o))) { const x = f(v(r.errors, o), b.argA, b.argB); g && k(r.errors, o, x), da(r.errors, o); } if ((d.touchedFields || y.touchedFields) && p && Array.isArray(v(r.touchedFields, o))) { const x = f(v(r.touchedFields, o), b.argA, b.argB); g && k(r.touchedFields, o, x); } (d.dirtyFields || y.dirtyFields) && (r.dirtyFields = Fe(n, a)), _.state.next({ name: o, isDirty: O(o, l), dirtyFields: r.dirtyFields, errors: r.errors, isValid: r.isValid }); } else k(a, o, l); }, M = (o, l) => { k(r.errors, o, l), _.state.next({ errors: r.errors }); }, w = (o) => { r.errors = o, _.state.next({ errors: r.errors, isValid: !1 }); }, S = (o, l, f, b) => { const g = v(s, o); if (g) { const p = v(a, o, U(f) ? v(n, o) : f); U(p) || b && b.defaultChecked || l ? k(a, o, l ? p : $r(g._f)) : B(o, p), i.mount && !i.action && T(); } }, A = (o, l, f, b, g) => { let p = !1, x = !1; const I = { name: o }; if (!t.disabled) { if (!f || b) { (d.isDirty || y.isDirty) && (x = r.isDirty, r.isDirty = I.isDirty = O(), p = x !== I.isDirty); const N = fe(v(n, o), l); x = !!v(r.dirtyFields, o), N ? G(r.dirtyFields, o) : k(r.dirtyFields, o, !0), I.dirtyFields = r.dirtyFields, p = p || (d.dirtyFields || y.dirtyFields) && x !== !N; } if (f) { const N = v(r.touchedFields, o); N || (k(r.touchedFields, o, f), I.touchedFields = r.touchedFields, p = p || (d.touchedFields || y.touchedFields) && N !== f); } p && g && _.state.next(I); } return p ? I : {}; }, Z = (o, l, f, b) => { const g = v(r.errors, o), p = (d.isValid || y.isValid) && ee(l) && r.isValid !== l; if (t.delayError && f ? (c = F(() => M(o, f)), c(t.delayError)) : (clearTimeout(h), c = null, f ? k(r.errors, o, f) : G(r.errors, o)), (f ? !fe(g, f) : g) || !Y(b) || p) { const x = { ...b, ...p && ee(l) ? { isValid: l } : {}, errors: r.errors, name: o }; r = { ...r, ...x }, _.state.next(x); } }, q = async (o) => (D(o, !0), await t.resolver(a, t.context, ia(o || u.mount, s, t.criteriaMode, t.shouldUseNativeValidation))), ne = async (o) => { const { errors: l } = await q(o); if (D(o), o) for (const f of o) { const b = v(l, f); b ? k(r.errors, f, b) : G(r.errors, f); } else r.errors = l; return l; }, W = async (o, l, f = { valid: !0 }) => { for (const b in o) { const g = o[b]; if (g) { const { _f: p, ...x } = g; if (p) { const I = u.array.has(p.name), N = g._f && oa(g._f); N && d.validatingFields && D([p.name], !0); const J = await Cr(g, u.disabled, a, E, t.shouldUseNativeValidation && !l, I); if (N && d.validatingFields && D([p.name]), J[p.name] && (f.valid = !1, l || e.shouldUseNativeValidation)) break; !l && (v(J, p.name) ? I ? ha(r.errors, J, p.name) : k(r.errors, p.name, J[p.name]) : G(r.errors, p.name)); } !Y(x) && await W(x, l, f); } } return f.valid; }, xe = () => { for (const o of u.unMount) { const l = v(s, o); l && (l._f.refs ? l._f.refs.every((f) => !xt(f)) : !xt(l._f.ref)) && gt(o); } u.unMount = /* @__PURE__ */ new Set(); }, O = (o, l) => !t.disabled && (o && l && k(a, o, l), !fe(ir(), n)), V = (o, l, f) => At(o, u, { ...i.mount ? a : U(l) ? n : te(o) ? { [o]: l } : l }, f, l), j = (o) => Ht(v(i.mount ? a : n, o, t.shouldUnregister ? v(n, o, []) : [])), B = (o, l, f = {}) => { const b = v(s, o); let g = l; if (b) { const p = b._f; p && (!p.disabled && k(a, o, Ss(l, p)), g = Qe(p.ref) && Q(l) ? "" : l, ws(p.ref) ? [...p.ref.options].forEach((x) => x.selected = g.includes(x.value)) : p.refs ? Ge(p.ref) ? p.refs.forEach((x) => { (!x.defaultChecked || !x.disabled) && (Array.isArray(g) ? x.checked = !!g.find((I) => I === x.value) : x.checked = g === x.value || !!g); }) : p.refs.forEach((x) => x.checked = x.value === g) : Wt(p.ref) ? p.ref.value = "" : (p.ref.value = g, p.ref.type || _.state.next({ name: o, values: z(a) }))); } (f.shouldDirty || f.shouldTouch) && A(o, g, f.shouldTouch, f.shouldDirty, !0), f.shouldValidate && Ie(o); }, R = (o, l, f) => { for (const b in l) { if (!l.hasOwnProperty(b)) return; const g = l[b], p = o + "." + b, x = v(s, p); (u.array.has(o) || H(g) || x && !x._f) && !_e(g) ? R(p, g, f) : B(p, g, f); } }, K = (o, l, f = {}) => { const b = v(s, o), g = u.array.has(o), p = z(l); k(a, o, p), g ? (_.array.next({ name: o, values: z(a) }), (d.isDirty || d.dirtyFields || y.isDirty || y.dirtyFields) && f.shouldDirty && _.state.next({ name: o, dirtyFields: Fe(n, a), isDirty: O(o, p) })) : b && !b._f && !Q(p) ? R(o, p, f) : B(o, p, f), Ar(o, u) ? _.state.next({ ...r, name: o, values: z(a) }) : _.state.next({ name: i.mount ? o : void 0, values: z(a) }); }, Pe = async (o) => { i.mount = !0; const l = o.target; let f = l.name, b = !0; const g = v(s, f), p = (N) => { b = Number.isNaN(N) || _e(N) && isNaN(N.getTime()) || fe(N, v(a, f, N)); }, x = Fr(t.mode), I = Fr(t.reValidateMode); if (g) { let N, J; const me = l.type ? $r(g._f) : vs(o), he = o.type === Xe.BLUR || o.type === Xe.FOCUS_OUT, jn = !ua(g._f) && !t.resolver && !v(r.errors, f) && !g._f.deps || ca(he, v(r.touchedFields, f), r.isSubmitted, I, x), vt = Ar(f, u, he); k(a, f, me), he ? (!l || !l.readOnly) && (g._f.onBlur && g._f.onBlur(o), c && c(0)) : g._f.onChange && g._f.onChange(o); const _t = A(f, me, he), zn = !Y(_t) || vt; if (!he && _.state.next({ name: f, type: o.type, values: z(a) }), jn) return (d.isValid || y.isValid) && (t.mode === "onBlur" ? he && T() : he || T()), zn && _.state.next({ name: f, ...vt ? {} : _t }); if (!he && vt && _.state.next({ ...r }), t.resolver) { const { errors: gr } = await q([f]); if (D([f]), p(me), b) { const Gn = Er(r.errors, s, f), mr = Er(gr, s, Gn.name || f); N = mr.error, f = mr.name, J = Y(gr); } } else D([f], !0), N = (await Cr(g, u.disabled, a, E, t.shouldUseNativeValidation))[f], D([f]), p(me), b && (N ? J = !1 : (d.isValid || y.isValid) && (J = await W(s, !0))); b && (g._f.deps && (!Array.isArray(g._f.deps) || g._f.deps.length > 0) && Ie(g._f.deps), Z(f, J, N, _t)); } }, Re = (o, l) => { if (v(r.errors, l) && o.focus) return o.focus(), 1; }, Ie = async (o, l = {}) => { let f, b; const g = Ue(o); if (t.resolver) { const p = await ne(U(o) ? o : g); f = Y(p), b = o ? !g.some((x) => v(p, x)) : f; } else o ? (b = (await Promise.all(g.map(async (p) => { const x = v(s, p); return await W(x && x._f ? { [p]: x } : x); }))).every(Boolean), !(!b && !r.isValid) && T()) : b = f = await W(s); return _.state.next({ ...!te(o) || (d.isValid || y.isValid) && f !== r.isValid ? {} : { name: o }, ...t.resolver || !o ? { isValid: f } : {}, errors: r.errors }), l.shouldFocus && !b && je(s, Re, o ? g : u.mount), b; }, ir = (o, l) => { let f = { ...i.mount ? a : n }; return l && (f = Fs(l.dirtyFields ? r.dirtyFields : r.touchedFields, f)), U(o) ? f : te(o) ? v(f, o) : o.map((b) => v(f, b)); }, or = (o, l) => ({ invalid: !!v((l || r).errors, o), isDirty: !!v((l || r).dirtyFields, o), error: v((l || r).errors, o), isValidating: !!v(r.validatingFields, o), isTouched: !!v((l || r).touchedFields, o) }), Rn = (o) => { const l = o ? Ue(o) : void 0; l == null || l.forEach((f) => G(r.errors, f)), l ? l.forEach((f) => { _.state.next({ name: f, errors: r.errors }); }) : _.state.next({ errors: {} }); }, ur = (o, l, f) => { const b = (v(s, o, { _f: {} })._f || {}).ref, g = v(r.errors, o) || {}, { ref: p, message: x, type: I, ...N } = g; k(r.errors, o, { ...N, ...l, ref: b }), _.state.next({ name: o, errors: r.errors, isValid: !1 }), f && f.shouldFocus && b && b.focus && b.focus(); }, In = (o, l) => X(o) ? _.state.subscribe({ next: (f) => "values" in f && o(V(void 0, l), f) }) : V(o, l, !0), lr = (o) => _.state.subscribe({ next: (l) => { fa(o.name, l.name, o.exact) && la(l, o.formState || d, Un, o.reRenderRoot) && o.callback({ values: { ...a }, ...r, ...l, defaultValues: n }); } }).unsubscribe, Nn = (o) => (i.mount = !0, y = { ...y, ...o.formState }, lr({ ...o, formState: { ...m, ...o.formState } })), gt = (o, l = {}) => { for (const f of o ? Ue(o) : u.mount) u.mount.delete(f), u.array.delete(f), l.keepValue || (G(s, f), G(a, f)), !l.keepError && G(r.errors, f), !l.keepDirty && G(r.dirtyFields, f), !l.keepTouched && G(r.touchedFields, f), !l.keepIsValidating && G(r.validatingFields, f), !t.shouldUnregister && !l.keepDefaultValue && G(n, f); _.state.next({ values: z(a) }), _.state.next({ ...r, ...l.keepDirty ? { isDirty: O() } : {} }), !l.keepIsValid && T(); }, fr = ({ disabled: o, name: l }) => { if (ee(o) && i.mount || o || u.disabled.has(l)) { const g = u.disabled.has(l) !== !!o; o ? u.disabled.add(l) : u.disabled.delete(l), g && i.mount && !i.action && T(); } }, mt = (o, l = {}) => { let f = v(s, o); const b = ee(l.disabled) || ee(t.disabled); return k(s, o, { ...f || {}, _f: { ...f && f._f ? f._f : { ref: { name: o } }, name: o, mount: !0, ...l } }), u.mount.add(o), f ? fr({ disabled: ee(l.disabled) ? l.disabled : t.disabled, name: o }) : S(o, !0, l.value), { ...b ? { disabled: l.disabled || t.disabled } : {}, ...t.progressive ? { required: !!l.required, min: ke(l.min), max: ke(l.max), minLength: ke(l.minLength), maxLength: ke(l.maxLength), pattern: ke(l.pattern) } : {}, name: o, onChange: Pe, onBlur: Pe, ref: (g) => { if (g) { mt(o, l), f = v(s, o); const p = U(g.value) && g.querySelectorAll && g.querySelectorAll("input,select,textarea")[0] || g, x = ra(p), I = f._f.refs || []; if (x ? I.find((N) => N === p) : p === f._f.ref) return; k(s, o, { _f: { ...f._f, ...x ? { refs: [ ...I.filter(xt), p, ...Array.isArray(v(n, o)) ? [{}] : [] ], ref: { type: p.type, name: o } } : { ref: p } } }), S(o, !1, void 0, p); } else f = v(s, o, {}), f._f && (f._f.mount = !1), (t.shouldUnregister || l.shouldUnregister) && !(_s(u.array, o) && i.action) && u.unMount.add(o); } }; }, yt = () => t.shouldFocusError && je(s, Re, u.mount), kn = (o) => { ee(o) && (_.state.next({ disabled: o }), je(s, (l, f) => { const b = v(s, f); b && (l.disabled = b._f.disabled || o, Array.isArray(b._f.refs) && b._f.refs.forEach((g) => { g.disabled = b._f.disabled || o; })); }, 0, !1)); }, cr = (o, l) => async (f) => { let b; f && (f.preventDefault && f.preventDefault(), f.persist && f.persist()); let g = z(a); if (_.state.next({ isSubmitting: !0 }), t.resolver) { const { errors: p, values: x } = await q(); D(), r.errors = p, g = z(x); } else await W(s); if (u.disabled.size) for (const p of u.disabled) G(g, p); if (G(r.errors, "root"), Y(r.errors)) { _.state.next({ errors: {} }); try { await o(g, f); } catch (p) { b = p; } } else l && await l({ ...r.errors }, f), yt(), setTimeout(yt); if (_.state.next({ isSubmitted: !0, isSubmitting: !1, isSubmitSuccessful: Y(r.errors) && !b, submitCount: r.submitCount + 1, errors: r.errors }), b) throw b; }, Mn = (o, l = {}) => { v(s, o) && (U(l.defaultValue) ? K(o, z(v(n, o))) : (K(o, l.defaultValue), k(n, o, z(l.defaultValue))), l.keepTouched || G(r.touchedFields, o), l.keepDirty || (G(r.dirtyFields, o), r.isDirty = l.defaultValue ? O(o, z(v(n, o))) : O()), l.keepError || (G(r.errors, o), d.isValid && T()), _.state.next({ ...r })); }, dr = (o, l = {}) => { const f = o ? z(o) : n, b = z(f), g = Y(o), p = g ? n : b; if (l.keepDefaultValues || (n = f), !l.keepValues) { if (l.keepDirtyValues) { const x = /* @__PURE__ */ new Set([ ...u.mount, ...Object.keys(Fe(n, a)) ]); for (const I of Array.from(x)) { const N = v(r.dirtyFields, I), J = v(a, I), me = v(p, I); N && !U(J) ? k(p, I, J) : !N && !U(me) && K(I, me); } } else { if (Gt && U(o)) for (const x of u.mount) { const I = v(s, x); if (I && I._f) { const N = Array.isArray(I._f.refs) ? I._f.refs[0] : I._f.ref; if (Qe(N)) { const J = N.closest("form"); if (J) { J.reset(); break; } } } } if (l.keepFieldsRef) for (const x of u.mount) K(x, v(p, x)); else s = {}; } a = t.shouldUnregister ? l.keepDefaultValues ? z(n) : {} : z(p), _.array.next({ values: { ...p } }), _.state.next({ values: { ...p } }); } u = { mount: l.keepDirtyValues ? u.mount : /* @__PURE__ */ new Set(), unMount: /* @__PURE__ */ new Set(), array: /* @__PURE__ */ new Set(), disabled: /* @__PURE__ */ new Set(), watch: /* @__PURE__ */ new Set(), watchAll: !1, focus: "" }, i.mount = !d.isValid || !!l.keepIsValid || !!l.keepDirtyValues || !t.shouldUnregister && !Y(p), i.watch = !!t.shouldUnregister, i.keepIsValid = !!l.keepIsValid, i.action = !1, l.keepErrors || (r.errors = {}), _.state.next({ submitCount: l.keepSubmitCount ? r.submitCount : 0, isDirty: g ? !1 : l.keepDirty ? r.isDirty : !!(l.keepDefaultValues && !fe(o, n)), isSubmitted: l.keepIsSubmitted ? r.isSubmitted : !1, dirtyFields: g ? {} : l.keepDirtyValues ? l.keepDefaultValues && a ? Fe(n, a) : r.dirtyFields : l.keepDefaultValues && o ? Fe(n, o) : l.keepDirty ? r.dirtyFields : {}, touchedFields: l.keepTouched ? r.touchedFields : {}, errors: l.keepErrors ? r.errors : {}, isSubmitSuccessful: l.keepIsSubmitSuccessful ? r.isSubmitSuccessful : !1, isSubmitting: !1, defaultValues: n }); }, hr = (o, l) => dr(X(o) ? o(a) : o, { ...t.resetOptions, ...l }), Ln = (o, l = {}) => { const f = v(s, o), b = f && f._f; if (b) { const g = b.refs ? b.refs[0] : b.ref; g.focus && setTimeout(() => { g.focus(), l.shouldSelect && X(g.select) && g.select(); }); } }, Un = (o) => { r = { ...r, ...o }; }, pr = { control: { register: mt, unregister: gt, getFieldState: or, handleSubmit: cr, setError: ur, _subscribe: lr, _runSchema: q, _updateIsValidating: D, _focusError: yt, _getWatch: V, _getDirty: O, _setValid: T, _setFieldArray: $, _setDisabledField: fr, _setErrors: w, _getFieldArray: j, _reset: dr, _resetDefaultValues: () => X(t.defaultValues) && t.defaultValues().then((o) => { hr(o, t.resetOptions), _.state.next({ isLoading: !1 }); }), _removeUnmounted: xe, _disableForm: kn, _subjects: _, _proxyFormState: d, get _fields() { return s; }, get _formValues() { return a; }, get _state() { return i; }, set _state(o) { i = o; }, get _defaultValues() { return n; }, get _names() { return u; }, set _names(o) { u = o; }, get _formState() { return r; }, get _options() { return t; }, set _options(o) { t = { ...t, ...o }; } }, subscribe: Nn, trigger: Ie, register: mt, handleSubmit: cr, watch: In, setValue: K, getValues: ir, reset: hr, resetField: Mn, clearErrors: Rn, unregister: gt, setError: ur, setFocus: Ln, getFieldState: or }; return { ...pr, formControl: pr }; } function ma(e = {}) { const t = C.useRef(void 0), r = C.useRef(void 0), [s, n] = C.useState({ isDirty: !1, isValidating: !1, isLoading: X(e.defaultValues), isSubmitted: !1, isSubmitting: !1, isSubmitSuccessful: !1, isValid: !1, submitCount: 0, dirtyFields: {}, touchedFields: {}, validatingFields: {}, errors: e.errors || {}, disabled: e.disabled || !1, isReady: !1, defaultValues: X(e.defaultValues) ? void 0 : e.defaultValues }); if (!t.current) if (e.formControl) t.current = { ...e.formControl, formState: s }, e.defaultValues && !X(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions); else { const { formControl: i, ...u } = ga(e); t.current = { ...u, formState: s }; } const a = t.current.control; return a._options = e, Kt(() => { const i = a._subscribe({ formState: a._proxyFormState, callback: () => n({ ...a._formState }), reRenderRoot: !0 }); return n((u) => ({ ...u, isReady: !0 })), a._formState.isReady = !0, i; }, [a]), C.useEffect(() => a._disableForm(e.disabled), [a, e.disabled]), C.useEffect(() => { e.mode && (a._options.mode = e.mode), e.reValidateMode && (a._options.reValidateMode = e.reValidateMode); }, [a, e.mode, e.reValidateMode]), C.useEffect(() => { e.errors && (a._setErrors(e.errors), a._focusError()); }, [a, e.errors]), C.useEffect(() => { e.shouldUnregister && a._subjects.state.next({ values: a._getWatch() }); }, [a, e.shouldUnregister]), C.useEffect(() => { if (a._proxyFormState.isDirty) { const i = a._getDirty(); i !== s.isDirty && a._subjects.state.next({ isDirty: i }); } }, [a, s.isDirty]), C.useEffect(() => { var i; e.values && !fe(e.values, r.current) ? (a._reset(e.values, { keepFieldsRef: !0, ...a._options.resetOptions }), !((i = a._options.resetOptions) === null || i === void 0) && i.keepIsValid || a._setValid(), r.current = e.values, n((u) => ({ ...u }))) : a._resetDefaultValues(); }, [a, e.values]), C.useEffect(() => { a._state.mount || (a._setValid(), a._state.mount = !0), a._state.watch && (a._state.watch = !1, a._subjects.state.next({ ...a._formState })), a._removeUnmounted(); }), t.current.formState = C.useMemo(() => xs(s, a), [a, s]), t.current; } const ya = Wn.div` display: flex; align-items: flex-start; gap: 2.5rem; & .lnc-ui-form-field { & span { font-size: 0.75rem; } } & .message-input * { resize: vertical; } & .section__card { display: flex; flex-direction: column; align-items: flex-start; border-radius: 0.75rem; border: 1px solid var(--gray-200, #e4e9f0); background: var(--white, #fff); box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); & .card__image { border-top-left-radius: 0.75rem; border-top-right-radius: 0.75rem; max-width: 23.5rem; max-height: 18rem; } & .card__content { display: flex; padding: 2rem 1.25rem; flex-direction: column; align-items: flex-start; gap: 1.5rem; & .card__tile { display: flex; align-items: flex-start; gap: 1rem; & .tile__image { display: flex; width: 2.5rem; height: 2.5rem; padding: 0.5rem; align-items: center; aspect-ratio: 1 / 1; border-radius: 999px; background: var(--primary-100, #dcf4f9); color: var(--primary-400, #27b4be); & i { &::before { margin-left: 0.1rem; } } } & .tile__content { display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; & .tile__title { color: var(--gray-900, #0c1520); font-size: 1rem; font-style: normal; font-weight: 500; line-height: 1.5rem; } & .tile__items { display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; & .tile__item { color: var(--gray-900, #0c1520); font-size: 0.875rem; font-style: normal; font-weight: 400; line-height: 1.25rem; letter-spacing: 0.0156rem; text-decoration: none; cursor: pointer; &:hover { text-decoration: underline; } } } } } } } & .section__form { display: flex; flex-direction: column; gap: 2rem; & .form__title { color: var(--gray-900, #0c1520); font-size: 1.5rem; font-style: normal; font-weight: 600; line-height: 2rem; } & .form__description { color: var(--gray-500, #7a8594); font-size: 1rem; font-style: normal; font-weight: 500; line-height: 1.5rem; } & .form__fields { display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; & .form__field { display: flex; align-items: center; gap: 0.75rem; width: 100%; &.right { justify-content: flex-end; } & .field__wrapper { display: flex; flex-direction: column; width: 100%; & .field__hint { color: var(--gray-400, #96a2b2); font-size: 0.75rem; font-style: normal; font-weight: 400; line-height: 1rem; letter-spacing: 0.01px; align-self: flex-end; } & .field__checkbox-input { & input { &:focus ~ .checkmark { outline: none; } &:checked ~ .checkmark { background: var(--primary-500, #ff7621); border: 1px solid var(--primary-400, #ff914d); } } & .checkbox-label { color: var(--gray-900, #0c1520); font-size: 0.875rem; font-style: normal; font-weight: 400; line-height: 1.25rem; letter-spacing: -0.09px; & a { font-weight: 500; color: var(--gray-900, #0c1520); &:hover { color: var(--gray-900, #0c1520); } } } } } & .form-field { width: 100%; min-height: 4.25rem; & span { margin-top: 0.25rem; } } & .field__text-input { height: 100%; border-radius: 0.75rem; border: 1px solid var(--gray-200, #e4e9f0); box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); width: 100%; outline: none; &.text-area { height: 100%; min-height: 100%; border: none; box-shadow: none; } & input::placeholder { color: var(--gray-500, #7a8594); font-size: 0.875rem; font-style: normal; font-weight: 400; line-height: 1.25rem; letter-spacing: 0.0156rem; } & textarea { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); &::placeholder { color: var(--gray-500, #7a8594); font-size: 0.875rem; font-style: normal; font-weight: 400; line-height: 1.25rem; letter-spacing: 0.0156rem; } &:focus { outline: none; } } } & button { min-width: 9rem; padding: 0.5rem; color: var(--white, #fff); font-size: 0.875rem; font-style: normal; font-weight: 600; line-height: 1.25rem; letter-spacing: 0.1px; background: var( --Linear-button, linear-gradient(0deg, #ff7621 0%, #ff9706 100%) ); &:hover { background: var( --Linear-button-switched, linear-gradient(0deg, #ff9706 0%, #ff7621 100%) ); } &:focus { outline: none; } } } } } & .section__divider { width: 100%; height: 1px; background: var(--gray-200, #e4e9f0); display: none; } @media ${Zn("S")} { flex-direction: column; & .section__divider { order: 1; display: block; } & .section__card { width: 100%; border: none; background: transparent; box-shadow: none; padding-bottom: 2.5rem; order: 2; & .card__image { display: none; } & .card__content { padding: 0; } } & .section__form { order: 0; & .form__title { font-size: 1rem; font-style: normal; font-weight: 500; line-height: 1.5rem; } & .form__description { color: var(--gray-500, #7a8594); font-size: 0.875rem; font-style: normal; font-weight: 400; line-height: 1.25rem; } & .form__fields { & .form__field { flex-direction: column; } & button { width: 100%; } } } } `, Or = (e, t, r) => { if (e && "reportValidity" in e) { const s = v(r, t); e.setCustomValidity(s && s.message || ""), e.reportValidity(); } }, Os = (e, t) => { for (const r in t.fields) { const s = t.fields[r]; s && s.ref && "reportValidity" in s.ref ? Or(s.ref, r, e) : s && s.refs && s.refs.forEach((n) => Or(n, r, e)); } }, va = (e, t) => { t.shouldUseNativeValidation && Os(e, t); const r = {}; for (const s in e) { const n = v(t.fields, s), a = Object.assign(e[s] || {}, { ref: n && n.ref }); if (_a(t.names || Object.keys(e), s)) { const i = Object.assign({}, v(r, s)); k(i, "root", a), k(r, s, i); } else k(r, s, a); } return r; }, _a = (e, t) => { const r = Tr(t); return e.some((s) => Tr(s).match(`^${r}\\.\\d+`)); }; function Tr(e) { return e.replace(/\]|\[/g, ""); } function ba(e, t, r) { return r === void 0 && (r = {}), function(s, n, a) { try { return Promise.resolve(function(i, u) { try { var c = (t != null && t.context && process.env.NODE_ENV === "development" && console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"), Promise.resolve(e[r.mode === "sync" ? "validateSync" : "validate"](s, Object.assign({ abortEarly: !1 }, t, { context: n }))).then(function(h) { return a.shouldUseNativeValidation && Os({}, a), { values: r.raw ? Object.assign({}, s) : h, errors: {} }; })); } catch (h) { return u(h); } return c && c.then ? c.then(void 0, u) : c; }(0, function(i) { if (!i.inner) throw i; return { values: {}, errors: va((u = i, c = !a.shouldUseNativeValidation && a.criteriaMode === "all", (u.inner || []).reduce(function(h, m) { if (h[m.path] || (h[m.path] = { message: m.message, type: m.type }), c) { var d = h[m.path].types, y = d && d[m.type]; h[m.path] = $s(m.path, c, h, m.type, y ? [].concat(y, m.message) : m.message); } return h; }, {})), a) }; var u, c; })); } catch (i) { return Promise.reject(i); } }; } var Ct; try { Ct = Map; } catch { } var Ot; try { Ot = Set; } catch { } function Ts(e, t, r) { if (!e || typeof e != "object" || typeof e == "function") return e; if (e.nodeType && "cloneNode" in e) return e.cloneNode(!0); if (e instanceof Date) return new Date(e.getTime()); if (e instanceof RegExp) return new RegExp(e); if (Array.isArray(e)) return e.map(Tt); if (Ct && e instanceof Ct) return new Map(Array.from(e.entries())); if (Ot && e instanceof Ot) return new Set(Array.from(e.values())); if (e instanceof Object) { t.push(e); var s = Object.create(e); r.push(s); for (var n in e) { var a = t.findIndex(function(i) { return i === e[n]; }); s[n] = a > -1 ? r[a] : Ts(e[n], t, r); } return s; } return e; } function Tt(e) { return Ts(e, [], []); } const xa = Object.prototype.toString, $a = Error.prototype.toString, Fa = RegExp.prototype.toString, wa = typeof Symbol < "u" ? Symbol.prototype.toString : () => "", Aa = /^Symbol\((.*)\)(.*)$/; function Ea(e) { return e != +e ? "NaN" : e === 0 && 1 / e < 0 ? "-0" : "" + e; } function Dr(e, t = !1) { if (e == null || e ==