@userfrosting/sprinkle-admin
Version:
Admin Sprinkle for UserFrosting 6
1,433 lines • 88.2 kB
JavaScript
import { defineStore as ta } from "pinia";
import ee from "axios";
import { ref as b, shallowRef as Re, watch as le, effectScope as ce, computed as c, toValue as N, reactive as Ae, getCurrentInstance as lt, onMounted as Ht, watchEffect as Ie, getCurrentScope as pt, onScopeDispose as mt, isRef as ze, inject as Qt, triggerRef as aa, nextTick as ke, unref as Bt, toRef as k, version as ra } from "vue";
import { Severity as Ee } from "@userfrosting/sprinkle-core/interfaces";
import { useAlertsStore as ge } from "@userfrosting/sprinkle-core/stores";
import Jt from "limax";
import { useRuleSchemaAdapter as ht } from "@userfrosting/sprinkle-core/composables";
const la = {
counter: {
users: 0,
roles: 0,
groups: 0
},
users: []
}, Ba = ta("dashboardApi", {
state: () => ({
data: la
}),
actions: {
async load() {
return ee.get("/api/dashboard").then((e) => (this.data = e.data, this.data)).catch(() => {
});
}
}
});
function Ja() {
const e = b(!1), t = b();
async function a() {
return e.value = !0, t.value = null, ee.post("/api/config/clear-cache").then((r) => (ge().push({
title: r.data.title,
description: r.data.description,
style: Ee.Success
}), r.data)).catch((r) => {
t.value = r.response.data;
}).finally(() => {
e.value = !1;
});
}
return { clearCache: a, loading: e, error: t };
}
function Ya() {
const e = b(!1), t = b(), a = b({
frameworkVersion: "",
phpVersion: "",
database: {
connection: "",
name: "",
type: "",
version: ""
},
server: "",
projectPath: "",
sprinkles: {}
});
async function r() {
return e.value = !0, t.value = null, ee.get("/api/config/info").then((n) => {
a.value = n.data;
}).catch((n) => {
t.value = n.response.data;
}).finally(() => {
e.value = !1;
});
}
return { data: a, load: r, loading: e, error: t };
}
/**
* @regle/core v1.24.3
* (c) 2026 Victor Garcia
* @license MIT
*/
function ua(e) {
var t;
return ((t = e == null ? void 0 : e.constructor) == null ? void 0 : t.name) == "File";
}
function ie(e) {
return e && (e instanceof Date || e.constructor.name == "File" || e.constructor.name == "FileList") ? !1 : typeof e == "object" && e !== null && !Array.isArray(e);
}
function na(e) {
const t = {};
for (const a in e) {
if (!Object.prototype.hasOwnProperty.call(e, a)) continue;
const r = e[a], n = a.split(".");
let l = t;
for (let u = 0; u < n.length; u++) {
const i = n[u], d = u === n.length - 1, p = i.match(/^\d+$/) ? Number(i) : null;
if (p !== null) {
if (Array.isArray(l)) if (d) l[p] = r;
else {
if (typeof l[p] != "object" || l[p] === null) {
const $ = n[u + 1];
l[p] = $ && $.match(/^\d+$/) ? {
$each: [],
$self: []
} : {};
}
l = "$each" in l[p] ? l[p].$each : l[p];
}
} else if (d) if (Array.isArray(l[i])) {
let $ = l[i].slice();
l[i] = {}, l[i].$self = $;
} else typeof l[i] == "object" && l[i] !== null && "$each" in l[i] ? l[i].$self = r : l[i] = r;
else {
const $ = n[u + 1];
if (Array.isArray(l[i])) {
let v = l[i].slice();
l[i] = { $each: [] }, l[i].$self = v;
}
(typeof l[i] != "object" || l[i] === null || Array.isArray(l[i]) && !$.match(/^\d+$/)) && ($ && $.match(/^\d+$/) ? l[i] = {
$each: [],
$self: []
} : l[i] = {}), "$each" in l[i] ? l = l[i].$each : l = l[i];
}
}
}
return t;
}
function ia(e, t) {
return Object.prototype.hasOwnProperty.call(e, t);
}
function be(e, t = !0, a = !0) {
return e == null ? !0 : e instanceof Date ? isNaN(e.getTime()) : ua(e) ? e.size <= 0 : Array.isArray(e) ? t ? e.length === 0 : !1 : ie(e) ? e == null ? !0 : a ? Object.keys(e).length === 0 : !1 : !String(e).length;
}
function sa(e) {
let t = [];
return e.global && t.push("g"), e.ignoreCase && t.push("i"), e.multiline && t.push("m"), e.sticky && t.push("y"), e.unicode && t.push("u"), t.join("");
}
function Y(e, t = 0) {
if (t > 20) return e;
let a = e, r = {}.toString.call(e).slice(8, -1);
if (r == "Set" && (a = new Set([...e].map((n) => Y(n, t++)))), r == "Map" && (a = new Map([...e].map((n) => [Y(n[0]), Y(n[1])]))), r == "Date" && (a = new Date(e.getTime())), r == "RegExp" && (a = RegExp(e.source, sa(e))), r == "Array" || r == "Object") {
a = Array.isArray(e) ? [] : {};
for (let n in e) a[n] = Y(e[n], t++);
}
return a;
}
function Ut(e) {
const t = Object.prototype.toString.call(e);
return e == null ? /* @__PURE__ */ new Date(NaN) : e instanceof Date || typeof e == "object" && t === "[object Date]" ? new Date(e.getTime()) : typeof e == "number" || t === "[object Number]" ? new Date(e) : typeof e == "string" || t === "[object String]" ? new Date(e) : /* @__PURE__ */ new Date(NaN);
}
function Vt(e, t, { immediate: a = !1, trackDebounceRef: r } = {}) {
let n;
const l = (...u) => {
r && (r.value = !0);
function i() {
r && (r.value = !1);
}
return new Promise((d, p) => {
function $(v) {
d(v), i();
}
if (clearTimeout(n), n = setTimeout(() => {
if (i(), n = void 0, !a) try {
Promise.resolve(e.apply(this, [...u])).then($).catch((v) => p(v)).finally(i);
} catch (v) {
p(v);
}
}, t), a) {
i();
try {
Promise.resolve(e.apply(this, [...u])).then($).catch((v) => p(v)).finally(i);
} catch (v) {
p(v);
}
}
});
};
return l.cancel = () => {
clearTimeout(n), n = void 0, r && (r.value = !1);
}, l;
}
function dt(e, t, a = !1, r = !0) {
if (e === t) return !0;
if (e && t && typeof e == "object" && typeof t == "object") {
if (e.constructor !== t.constructor) return !1;
var n, l, u;
if (Array.isArray(e) && Array.isArray(t)) {
if (n = e.length, n != t.length) return !1;
if (r || !r && a) {
for (l = n; l-- !== 0; ) if (!dt(e[l], t[l], a, !1)) return !1;
}
return !0;
}
if (e.valueOf !== Object.prototype.valueOf) return e.valueOf() === t.valueOf();
if (e.toString !== Object.prototype.toString) return e.toString() === t.toString();
if (u = Object.keys(e), n = u.length, n !== Object.keys(t).length) return !1;
for (l = n; l-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(t, u[l])) return !1;
for (l = n; l-- !== 0; ) {
var i = u[l];
if (ie(e) && ie(t) && i && (r || !r && a) && !dt(e[i], t[i], a, !1))
return !1;
}
return !0;
}
return e !== e && t !== t;
}
var ot = class extends Error {
constructor(e = "Promise was aborted") {
super(e), this.name = "AbortError";
}
};
function ca(e) {
const t = new AbortController(), { signal: a } = t, r = new Promise((l, u) => {
function i() {
u(new ot());
}
a.addEventListener("abort", i), e.then((d) => {
a.removeEventListener("abort", i), a.aborted ? u(new ot()) : l(d);
}).catch((d) => {
a.removeEventListener("abort", i), a.aborted ? u(new ot()) : u(d);
});
});
function n(l) {
t.abort(l);
}
return {
promise: r,
abort: n,
signal: a
};
}
function fa(e, t, a) {
if (!ze(e))
return a == null || a(), Ae(e);
const r = b(!1);
return lt() && Ht(async () => {
await ke(), typeof window < "u" && window.requestAnimationFrame(() => {
r.value = !0;
});
}), Ae(new Proxy({}, {
get(n, l, u) {
if (a == null || a(), t.value && l !== "$value" && r.value) return Reflect.get(n, l, u);
if (e.value !== void 0)
return Bt(Reflect.get(e.value, l, u));
},
set(n, l, u) {
return a == null || a(), ze(e.value[l]) && !ze(u) ? e.value[l].value = u : e.value[l] = u, !0;
},
deleteProperty(n, l) {
return a == null || a(), Reflect.deleteProperty(e.value, l);
},
has(n, l) {
return a == null || a(), e.value === void 0 ? !1 : Reflect.has(e.value, l);
},
ownKeys() {
return a == null || a(), e.value === void 0 ? [] : Object.keys(e.value);
},
getOwnPropertyDescriptor() {
return a == null || a(), {
enumerable: !0,
configurable: !0
};
}
}));
}
function $t(e) {
try {
return e.map((t) => N(t));
} catch {
return [];
}
}
function Et(e) {
return ie(e.value);
}
function Wt(e, t, a) {
const r = ce();
let n;
return e instanceof Function ? n = r.run(() => e(t, a ?? 0)) : n = e, {
scope: r,
unwrapped: n
};
}
const Ye = {
LessThan: -1,
EqualTo: 0,
GreaterThan: 1
};
function oa(e, t) {
const a = String(e).split("."), r = String(t).split(".");
for (let n = 0; n < Math.min(a.length, r.length); n++) {
const l = Number(a[n]), u = Number(r[n]);
if (l > u) return Ye.GreaterThan;
if (u > l) return Ye.LessThan;
if (!isNaN(l) && isNaN(u)) return Ye.GreaterThan;
if (isNaN(l) && !isNaN(u)) return Ye.LessThan;
}
return Ye.EqualTo;
}
const gt = oa(ra, "3.5.0") !== -1;
function va() {
return Math.floor(Math.random() * Date.now()).toString();
}
function bt() {
return typeof window > "u" ? va() : window.crypto.getRandomValues(new Uint32Array(1))[0].toString(10);
}
function Ot(e) {
return pt() ? (mt(e), !0) : !1;
}
function da(e) {
let t = !1, a;
const r = ce(!0);
return ((...n) => (t || (a = r.run(() => e(...n)), t = !0), a));
}
function $a(e, t) {
return e.some((a) => t ? a == null ? void 0 : a[t] : !1);
}
function ya(e, t) {
return t ? e.reduce((a, r) => {
const n = (r == null ? void 0 : r[t]) || [];
return a.concat(n);
}, []) : [];
}
const Mt = {
INSPECTOR: "regle-inspector"
}, pa = Symbol("regle"), ma = Symbol("regle-config"), zt = { REGLE_STATIC: "__regle_static" };
function ha() {
const e = b(!1), t = Re(), a = Re(/* @__PURE__ */ new Map()), r = Re(/* @__PURE__ */ new Map()), n = Re(/* @__PURE__ */ new Map()), l = b(0);
function u(T) {
t.value = T;
}
function i(T, g) {
var w;
const P = (g == null ? void 0 : g.filePath) ?? "loose", U = n.value.get(P), C = U ? U + 1 : 1;
n.value.set(P, C);
const G = `${((w = g == null ? void 0 : g.uid) == null ? void 0 : w.toString()) ?? "regle"}#${++l.value}`, s = `r$ #${(g == null ? void 0 : g.name) ?? C}`;
a.value.set(G, {
id: G,
name: s,
r$: T,
componentName: g == null ? void 0 : g.componentName,
filePath: g == null ? void 0 : g.filePath
});
const R = le(() => T, () => d(), {
deep: !0,
flush: "post"
});
return Me.addWatcher(G, R), window.requestAnimationFrame(() => {
d();
}), G;
}
function d() {
t.value && Oa(t.value);
}
function p(T) {
const g = r.value.get(T);
g && (g(), r.value.delete(T)), a.value.delete(T), d();
}
function $() {
return Array.from(a.value.values());
}
function v(T) {
return a.value.get(T);
}
function h() {
r.value.forEach((T) => T()), r.value.clear(), a.value.clear(), d();
}
function E(T, g) {
r.value.set(T, g);
}
return {
devtoolsApi: t,
register: i,
unregister: p,
getAll: $,
get: v,
clear: h,
addWatcher: E,
setApi: u,
notifyDevtools: d,
loggedWarning: e
};
}
const Me = ha();
function Ea(e, t) {
var i, d;
if (typeof window > "u") return () => {
};
{
const p = typeof globalThis < "u" && ("__vitest_worker__" in globalThis || "__JEST_GLOBAL__" in globalThis || typeof window < "u" && "Cypress" in window || typeof process < "u" && process.env && (process.env.VITEST || process.env.JEST_WORKER_ID || process.env.NODE_ENV === "test" || process.env.PLAYWRIGHT_TEST));
if (p) return () => {
};
if (!Qt(pa, void 0) && !Me.loggedWarning.value && Me.devtoolsApi && !p)
return Me.loggedWarning.value = !0, console.warn("📏 Regle Devtools are not available. Install Regle plugin in your app to enable them. https://reglejs.dev/introduction/devtools"), () => {
};
}
const a = lt(), r = ((i = a == null ? void 0 : a.type) == null ? void 0 : i.name) || ((d = a == null ? void 0 : a.type) == null ? void 0 : d.__name);
let n;
a && a.type && typeof a.type == "object" && "__file" in a.type && (n = a.type.__file);
const l = Me.register(e, {
name: t == null ? void 0 : t.name,
componentName: r,
uid: a == null ? void 0 : a.uid,
filePath: n
});
function u() {
Me.unregister(l);
}
return Ot(u), u;
}
function Yt(e, t) {
return !xe(e.value) && (Et(e) || ie(t.value) && !be(t.value) && !Object.entries(t.value).some(([a, r]) => Ze(r) || typeof r == "function"));
}
function ga(e, t) {
return !!e.value && ie(e.value) && "$each" in e.value || Array.isArray(t.value);
}
function Xt(e) {
return !!e.value && (ie(e.value) || Et(e.value));
}
function Ze(e) {
return (ie(e) || typeof e == "function") && "_validator" in e;
}
function rt(e) {
return typeof e.value == "function" ? "_validator" in e.value : !0;
}
function xe(e) {
return ie(e) && ia(e, zt.REGLE_STATIC) && e[zt.REGLE_STATIC] === !0;
}
function ba(e) {
return ie(e) && "$fields" in e;
}
function xt(e) {
return !!e && "$rules" in e;
}
async function Oa(e) {
e.sendInspectorTree(Mt.INSPECTOR), e.sendInspectorState(Mt.INSPECTOR);
}
function Ra() {
const e = Re(/* @__PURE__ */ new Map()), t = Re(/* @__PURE__ */ new Map()), a = Re(/* @__PURE__ */ new Map()), r = Re(/* @__PURE__ */ new Map()), n = Re(/* @__PURE__ */ new Map()), l = Re(/* @__PURE__ */ new Map()), u = Re(/* @__PURE__ */ new Map());
function i(s) {
const R = t.value.get(s);
if (R) return R;
{
const w = b({});
return t.value.set(s, w), w;
}
}
function d(s) {
const R = a.value.get(s);
if (R) return R;
{
const w = b([]);
return a.value.set(s, w), w;
}
}
function p(s, R) {
l.value.set(s, R);
}
function $(s) {
return l.value.get(s);
}
function v(s, R, w) {
u.value.set(`${s}-${R}`, w);
}
function h(s, R) {
return u.value.get(`${s}-${R}`);
}
function E(s, R) {
s && R != null && u.value.delete(`${s}-${R}`);
}
function T(s, R) {
r.value.set(s, R);
}
function g(s) {
return r.value.get(s) ?? !1;
}
function P(s, R) {
e.value.set(s, R);
}
function U(s, R) {
const w = e.value.get(s);
if (w)
return C(R, w) ? { valid: !0 } : { valid: !1 };
}
function C(s, R) {
const w = Object.keys(R), B = Object.keys(s);
return B.length !== w.length || !B.every((D) => w.includes(D)) ? !1 : B.every((D) => {
var j;
const o = s[D], f = R[D];
if (!f || !o || typeof o == "function" || typeof f == "function" || typeof o == "number") return !1;
if (typeof o == "boolean") return !1;
if (typeof o == "string") return !1;
if ("_params" in o)
if (o._params) {
if (Array.isArray(o._params)) return (j = o._params) == null ? void 0 : j.every((J, X) => {
if (typeof f == "number" || typeof f == "boolean" || typeof f == "string") return !0;
{
const te = $t("_params" in f && Array.isArray(f._params) ? f._params : []), V = $t(o._params);
return (te == null ? void 0 : te[X]) === (V == null ? void 0 : V[X]);
}
});
} else return !0;
});
}
function G(s) {
const R = n.value.get(s);
if (R) return R;
{
const w = b(!1), B = b(!0), D = b({}), o = b(!1);
return n.value.set(s, {
$pending: w,
$valid: B,
$metadata: D,
$validating: o
}), {
$pending: w,
$valid: B,
$metadata: D,
$validating: o
};
}
}
return pt() && mt(() => {
e.value.clear(), t.value.clear(), a.value.clear(), r.value.clear(), n.value.clear(), u.value.clear();
}), {
addRuleDeclEntry: P,
setDirtyEntry: T,
checkRuleDeclEntry: U,
getDirtyState: g,
trySetRuleStatusRef: G,
getFieldsEntry: i,
getCollectionsEntry: d,
getArrayStatus: h,
addArrayStatus: v,
deleteArrayStatus: E,
arrayStatusStorage: u,
addAdditionalRulesEntry: p,
getAdditionalRulesEntry: $
};
}
function Ft({ field: e, silent: t = !1 }) {
const a = Object.entries(e.$rules ?? {}).map(([l, u]) => {
let i = "";
if (t && !u.$valid) i = u.$message;
else if (!u.$valid && e.$error && !u.$validating) i = u.$message;
else return null;
return {
$message: i,
$property: e.fieldName,
$rule: l,
$type: u.$type,
...typeof u.$metadata == "object" ? u.$metadata : {}
};
}).filter((l) => !!l).reduce((l, u) => (typeof u.$message == "string" ? l.push(u) : l.push(...u.$message.map((i) => ({
...u,
$message: i
}))), l), []), r = e.$error && e.$externalErrors && Array.isArray(e.$externalErrors) ? e.$externalErrors.map((l) => ({
$message: l,
$property: e.fieldName,
$rule: "external",
$type: void 0
})) : [];
let n = [];
return e.$schemaErrors && e.$error && (!Array.isArray(e.$schemaErrors) && "$self" in e.$schemaErrors ? n = e.$schemaErrors.$self ?? [] : n = e.$schemaErrors ?? []), [
...a,
...r,
...n
];
}
function Aa({ field: e }) {
const t = [];
for (const a of Object.values(e.$rules ?? {})) {
const r = a.$tooltip;
r && (typeof r == "string" ? t.push(r) : t.push(...r));
}
return t;
}
function Zt(e) {
return ie(e) && "$each" in e;
}
function Da(e, t) {
var r, n;
const { includePath: a = !1 } = t ?? {};
if (Array.isArray(e) && e.every((l) => !ie(l))) return e;
if (Zt(e)) {
const l = a ? ((r = e.$self) == null ? void 0 : r.map((i) => ({
message: i,
path: []
}))) ?? [] : e.$self ?? [], u = ((n = e.$each) == null ? void 0 : n.map((i) => ut(i, a))) ?? [];
return l == null ? void 0 : l.concat(u.flat());
} else return Object.entries(e).map(([l, u]) => ut(u, a, [l])).flat();
}
function ut(e, t = !1, a) {
var n, l;
const r = t && !a ? [] : a;
if (Array.isArray(e) && e.every((u) => !ie(u)))
return t ? e.map((u) => ({
message: u,
path: r ?? []
})) : e;
if (Zt(e)) {
const u = r != null && r.length ? ((n = e.$self) == null ? void 0 : n.map((d) => ({
message: d,
path: r ?? []
}))) ?? [] : e.$self ?? [], i = ((l = e.$each) == null ? void 0 : l.map((d, p) => ut(d, t, r == null ? void 0 : r.concat(p)))) ?? [];
return u == null ? void 0 : u.concat(i.flat());
} else return Object.entries(e).map(([u, i]) => ut(i, t, r == null ? void 0 : r.concat(u))).flat();
}
function Sa({ customMessages: e, rule: t, ruleKey: a, state: r, path: n, cachePath: l, storage: u, modifiers: i }) {
let d = ce(), p = {}, $;
const v = c(() => Ze(t.value) && t.value._async), h = b(!1), { $pending: E, $valid: T, $metadata: g, $validating: P } = u.trySetRuleStatusRef(`${l}.${a}`);
function U() {
d = ce(), p = d.run(() => {
const o = b(!1), f = b(!1), j = b(!0), J = b(!1), X = b(!1), te = c(() => ({
$value: r.value,
$error: f.value,
$dirty: o.value,
$pending: J.value,
$correct: X.value,
$invalid: j.value,
$rule: {
$valid: T.value,
$invalid: !T.value,
$pending: E.value
},
$params: Se.value,
...g.value
})), V = c(() => {
try {
return rt(t) ? typeof t.value.active == "function" ? t.value.active(te.value) : !!t.value.active : !0;
} catch (ne) {
return console.error(`Error in "active" function for "${n}.${a}" rule`, { cause: ne }), !0;
}
});
function fe(ne) {
var _e;
try {
let ye = "";
const he = e ? (_e = e[a]) == null ? void 0 : _e[ne] : void 0;
if (he && (typeof he == "function" ? ye = he(te.value) : ye = he), rt(t)) {
const F = `_${ne}_patched`;
he && !t.value[F] || (typeof t.value[ne] == "function" ? ye = t.value[ne](te.value) : ye = t.value[ne] ?? "");
}
return ye;
} catch (ye) {
return console.error(`Error in "${ne}" function for "${n}.${a}" rule`, { cause: ye }), "";
}
}
const me = c(() => {
let ne = fe("message");
return be(ne) && (ne = "This field is not valid"), ne;
}), Le = c(() => fe("tooltip")), je = c(() => rt(t) && t.value.type ? t.value.type : a), De = c(() => rt(t) ? t.value.validator : t.value), Se = c(() => typeof t.value == "function" ? [] : $t(t.value._params ?? []));
return {
$active: V,
$message: me,
$type: je,
$validator: De,
$params: Se,
$path: c(() => `${n}.${a}`),
$tooltip: Le,
$fieldCorrect: X,
$fieldError: f,
$fieldDirty: o,
$fieldPending: J,
$fieldInvalid: j
};
}), $ = le(p == null ? void 0 : p.$params, () => {
(!i.$silent.value || i.$rewardEarly.value && p.$fieldError.value) && R();
}, { deep: gt ? 1 : !0 });
}
U();
function C() {
T.value = !0, p.$fieldDirty.value && (E.value = !0);
}
async function G() {
let o = !1;
try {
const f = p.$validator.value;
if (typeof f != "function")
return console.error(`${n}: Incorrect rule format, it needs to be either a function or created with "createRule".`), !1;
const j = f(r.value, ...p.$params.value);
let J = r.value;
C();
let X;
if (j instanceof Promise ? X = await j : X = j, r.value !== J) return !0;
if (typeof X == "boolean") o = X;
else {
const { $valid: te, ...V } = X;
o = te, g.value = V;
}
} catch {
o = !1;
} finally {
E.value = !1;
}
return o;
}
function s(o, f = !0) {
if (Ze(t.value) && t.value._async) return !0;
const j = o(r.value, ...p.$params.value);
if (j instanceof Promise)
return f && console.warn('You used a async validator function on a non-async rule, please use "async await" or the "withAsync" helper'), !0;
if (j != null) {
if (typeof j == "boolean") return j;
{
const { $valid: J, ...X } = j;
return g.value = X, J;
}
}
return !0;
}
async function R() {
try {
P.value = !0;
let o = !1;
if (h.value = !0, Ze(t.value) && t.value._async) o = await G();
else {
const f = p.$validator.value;
o = s(f);
}
return T.value = o, o;
} catch {
return !1;
} finally {
P.value = !1, h.value = !1;
}
}
function w() {
try {
return P.value = !0, s(p.$validator.value);
} catch {
return !1;
} finally {
P.value = !1;
}
}
function B() {
T.value = !0, g.value = {}, E.value = !1, P.value = !1, U();
}
function D() {
$(), d.stop(), d = ce();
}
return Ae({
...p,
$pending: E,
$valid: T,
$metadata: g,
$haveAsync: v,
$maybePending: h,
$validating: P,
$parse: R,
$parseSync: w,
$unwatch: D,
$watch: U,
$reset: B
});
}
function Rt(e) {
return { "~standard": {
version: 1,
vendor: "regle",
validate: async (t) => {
const { valid: a, data: r, errors: n } = await e(t, !0);
return a ? {
value: r,
issues: []
} : { issues: Da(n, { includePath: !0 }) };
}
} };
}
function Ke(e) {
return e === !0 ? "eager" : e === !1 || e == null ? !1 : e;
}
function nt(e) {
return ie(e) && !xe(e) ? Object.values(e).some((t) => nt(t)) : Array.isArray(e) ? e.some((t) => nt(t)) : !be(e);
}
function wa(e, t, a) {
return e === "eager" ? !0 : e === "non-empty" ? nt(a) : e === "lazy-non-empty" ? nt(t) : !1;
}
function _a(e, t, a, r = !1) {
return e === "eager" ? !0 : e === "non-empty" ? r && !be(a) : e === "lazy-non-empty" ? !be(t) : !1;
}
const ja = 200;
function it({ state: e, rulesDef: t, customMessages: a, path: r, cachePath: n, fieldName: l, storage: u, options: i, externalErrors: d, schemaErrors: p, schemaMode: $, onUnwatch: v, $isArray: h, initialState: E, rootInitialState: T, originalState: g, shortcuts: P, overrides: U, onValidate: C }) {
let G = ce(), s, R = [], w, B, D, o, f = () => {
}, j, J = () => {
};
const X = b(!1), te = b(u.getAdditionalRulesEntry(n) ?? {});
function V(m) {
te.value = m ?? {}, u.addAdditionalRulesEntry(n, m ?? {}), me(), f();
}
function fe(m) {
V(m);
}
function me() {
const m = {
...t.value,
...te.value
}, H = [];
for (const L in m) {
if (L.startsWith("$") || L.startsWith("~")) continue;
const de = m[L];
if (!de) continue;
const I = k(() => de);
H.push([L, Sa({
modifiers: {
$silent: s.$silent,
$rewardEarly: s.$rewardEarly
},
customMessages: a,
rule: I,
ruleKey: L,
state: e,
path: r,
cachePath: n,
storage: u,
$debounce: q.value.$debounce
})]);
}
F.value = Object.fromEntries(H), u.addRuleDeclEntry(n, m);
}
function Le() {
const m = {
...t.value,
...te.value
}, H = u.checkRuleDeclEntry(n, m), L = {};
for (const de in m) de.startsWith("$") && (L[de] = m[de]);
return q.value = L, H;
}
function je() {
const m = Le();
_e(), me(), s.processShortcuts(), De(), Se(), (m == null ? void 0 : m.valid) != null && (s.$dirty.value = u.getDirtyState(n), (s.$dirty.value && !s.$silent.value || s.$rewardEarly.value && s.$error.value) && f()), u.addRuleDeclEntry(n, t.value);
}
function De() {
s.$debounce.value > 0 ? f = Vt(he, s.$debounce.value, { trackDebounceRef: X }) : f = he;
}
function Se() {
s.$debounce.value > 0 ? J = Vt(() => {
s.$dirty.value = !0;
}, s.$debounce.value) : J = () => {
s.$dirty.value = !0;
};
}
function ne() {
if (F.value) for (const m of Object.values(F.value)) m.$unwatch();
B(), o == null || o(), s.$dirty.value && u.setDirtyEntry(n, s.$dirty.value), w == null || w(), G.stop(), G = ce();
for (const m of R) m.stop();
R = [], v == null || v(), D == null || D();
}
function _e() {
if (F.value) for (const m of Object.values(F.value)) m.$watch();
s = G.run(() => {
const m = b(!1), H = b(!1), L = c(() => m.value), de = c(() => h || xe(e.value)), I = c(() => q.value.$debounce != null ? q.value.$debounce : s.$haveAnyAsyncRule.value ? ja : 0), W = c(() => q.value.$deepCompare != null ? q.value.$deepCompare : !1), M = c(() => q.value.$lazy != null ? q.value.$lazy : N(i.lazy) != null ? N(i.lazy) === !0 : !1), Z = c(() => q.value.$immediateDirty != null ? Ke(q.value.$immediateDirty) : N(i.immediateDirty) != null ? Ke(N(i.immediateDirty)) : !1), oe = c(() => q.value.$rewardEarly != null ? !!q.value.$rewardEarly : N(i.rewardEarly) != null ? N(i.rewardEarly) === !0 : !1), Te = c(() => q.value.$clearExternalErrorsOnChange != null ? !!q.value.$clearExternalErrorsOnChange : N(i.clearExternalErrorsOnChange) != null ? N(i.clearExternalErrorsOnChange) === !0 : !ct.value), $e = c(() => q.value.$clearExternalErrorsOnValidate != null ? !!q.value.$clearExternalErrorsOnValidate : N(i.clearExternalErrorsOnValidate) != null ? N(i.clearExternalErrorsOnValidate) === !0 : !1), ct = c(() => oe.value ? !0 : q.value.$silent != null ? q.value.$silent : N(i.silent) != null ? N(i.silent) === !0 : !1), At = c(() => q.value.$autoDirty != null ? q.value.$autoDirty : N(i.autoDirty) != null ? N(i.autoDirty) === !0 : !0), ft = c(() => {
if (q.value.$isEdited != null) return q.value.$isEdited;
if ((U == null ? void 0 : U.isEdited) != null) return U.isEdited;
}), Dt = c(() => {
for (const Q of Object.values(F.value)) if (Q.$validating) return !0;
return !1;
}), St = c({
get: () => e.value,
set(Q) {
w(), e.value = Q, ye();
}
}), et = c(() => X.value ? Je.value && m.value : Je.value && !Be.value && m.value), wt = c(() => Ft({ field: {
$rules: F.value,
$error: et.value,
$externalErrors: d == null ? void 0 : d.value,
$schemaErrors: p == null ? void 0 : p.value,
fieldName: tt.value
} })), _t = c(() => Ft({
field: {
$rules: F.value,
$error: et.value,
$externalErrors: d == null ? void 0 : d.value,
$schemaErrors: p == null ? void 0 : p.value,
fieldName: tt.value
},
silent: !0
})), jt = c(() => wt.value.map((Q) => Q.$message)), Tt = c(() => _t.value.map((Q) => Q.$message)), We = b(!1);
function Nt(Q, ve) {
return ve instanceof Date && Q instanceof Date ? Ut(ve).getTime() !== Ut(Q).getTime() : ve == null ? Q != null && Q !== "" : Array.isArray(Q) && Array.isArray(ve) ? !dt(Q, ve, q.value.$deepCompare) : ve !== Q;
}
Ie(() => {
m.value ? ft.value ? We.value = ft.value(e.value, E.value, Nt) : We.value = Nt(e.value, E.value) : We.value = !1;
});
const It = c(() => We.value), Lt = c(() => Aa({ field: { $rules: F.value } })), Ct = c(() => !(Je.value || Be.value)), Be = c(() => H.value || !oe.value ? Object.entries(F.value).some(([Q, ve]) => ve.$pending) : !1), Je = c(() => {
var Q, ve;
return (Q = d == null ? void 0 : d.value) != null && Q.length || (ve = p == null ? void 0 : p.value) != null && ve.length ? !0 : at.value ? !1 : Object.values(F.value).some((Ne) => !Ne.$valid || Ne.$maybePending);
}), tt = c(() => l ?? i.id ?? "root"), at = c(() => !$ && !Object.keys(F.value).some((Q) => !Q.startsWith("$"))), Pt = c(() => {
var Q, ve;
if ((Q = d == null ? void 0 : d.value) != null && Q.length) return !1;
if (at.value) return !1;
if (X.value) return !1;
if (m.value && !be(e.value) && !Dt.value && !Be.value) {
if ($) return !((ve = p == null ? void 0 : p.value) != null && ve.length);
{
const Ne = Object.values(F.value);
for (const Ue of Ne) if (Ue.$active && !Ue.$valid)
return !1;
return Ne.some((Ue) => Ue.$active);
}
}
return !1;
}), kt = c(() => Object.values(F.value).some((Q) => Q.$haveAsync)), Kt = c(() => ({
$debounce: I.value,
$lazy: M.value,
$rewardEarly: oe.value,
$autoDirty: At.value,
$silent: ct.value,
$clearExternalErrorsOnChange: Te.value,
$clearExternalErrorsOnValidate: $e.value,
$immediateDirty: Z.value,
$isEdited: ft.value,
$disabled: N(i.disabled) ?? !1
}));
function ea() {
P != null && P.fields && Object.entries(P.fields).forEach(([Q, ve]) => {
const Ne = ce();
Gt[Q] = Ne.run(() => {
const Ue = b();
return Ie(() => {
Ue.value = ve(Ae({
$dirty: m,
$externalErrors: (d == null ? void 0 : d.value) ?? [],
$value: e,
$silentValue: St,
$rules: F,
$error: et,
$pending: Be,
$invalid: Je,
$correct: Pt,
$errors: jt,
$ready: Ct,
$silentErrors: Tt,
$anyDirty: L,
$tooltips: Lt,
$name: tt,
$inactive: at,
$edited: We,
$anyEdited: It
}));
}), Ue;
}), R.push(Ne);
});
}
const Gt = {};
return {
$error: et,
$pending: Be,
$invalid: Je,
$correct: Pt,
$debounce: I,
$deepCompare: W,
$lazy: M,
$immediateDirty: Z,
$ready: Ct,
$issues: wt,
$silentIssues: _t,
$errors: jt,
$silentErrors: Tt,
$rewardEarly: oe,
$autoDirty: At,
$silent: ct,
$clearExternalErrorsOnChange: Te,
$clearExternalErrorsOnValidate: $e,
$anyDirty: L,
$edited: We,
$anyEdited: It,
$name: tt,
$haveAnyAsyncRule: kt,
$shortcuts: Gt,
$validating: Dt,
$tooltips: Lt,
$dirty: m,
processShortcuts: ea,
$silentValue: St,
$inactive: at,
$modifiers: Kt,
$isArrayOrRegleStatic: de
};
}), ye(), B = le(s.$dirty, (m) => {
u.setDirtyEntry(n, m), Object.values(F.value).forEach((H) => {
H.$fieldDirty = m;
});
}), o = le([
s.$error,
s.$correct,
s.$invalid,
s.$pending
], () => {
Object.values(F.value).forEach((m) => {
m.$fieldError = s.$error.value, m.$fieldInvalid = s.$invalid.value, m.$fieldPending = s.$pending.value, m.$fieldCorrect = s.$correct.value;
});
}), D = le(s.$haveAnyAsyncRule, De);
}
function ye() {
w = le(e, () => {
s.$autoDirty.value && !s.$silent.value && (s.$dirty.value || J()), t.value instanceof Function && je(), (!s.$silent.value || s.$rewardEarly.value && s.$error.value) && f(), s.$clearExternalErrorsOnChange.value && K();
}, { deep: s.$isArrayOrRegleStatic.value ? !0 : gt ? 1 : !0 });
}
async function he() {
try {
const { promise: m } = O(Promise.allSettled(Object.values(F.value).map((H) => H.$parse())));
await m;
} catch {
}
}
const F = b({}), q = b({});
je();
function A() {
_a(s.$immediateDirty.value, E.value, (T == null ? void 0 : T.value) ?? E.value, r === "") && (s.$dirty.value = !0);
}
function y(m, H) {
if (_(), K(), s.$dirty.value = !1, u.setDirtyEntry(n, !1), !H) if (m != null && m.toOriginalState)
e.value = Y(g), E.value = Y(g);
else if (m != null && m.toInitialState) e.value = Y(E.value);
else if (m != null && m.toState) {
let L;
typeof (m == null ? void 0 : m.toState) == "function" ? L = m == null ? void 0 : m.toState() : L = m == null ? void 0 : m.toState, E.value = Y(L), e.value = Y(L);
} else E.value = ie(e.value) && !xe(e.value) ? Y(e.value) : Array.isArray(e.value) ? [...e.value] : e.value;
if (m != null && m.clearExternalErrors && K(), !H && !(m != null && m.keepValidationState)) for (const L of Object.values(F.value)) L.$reset();
if (!s.$lazy.value && !s.$silent.value && !H) for (const L of Object.values(F.value)) L.$parse();
A();
}
function _() {
"cancel" in f && f.cancel();
}
function O(m) {
return j && j.abort(), j = ca(m), j;
}
function x() {
_(), j && j.abort();
}
function re(m = !0, H = !1) {
s.$dirty.value || J(), H && m ? (!s.$silent.value || s.$rewardEarly.value && s.$error.value) && (_(), f()) : m && (_(), f());
}
async function S(m) {
return m && (e.value = m), await ke(), z();
}
async function z(m) {
try {
if (m && (e.value = m), $) return C ? (re(!1), C()) : {
valid: !1,
data: e.value,
errors: s.$errors.value,
issues: s.$issues.value
};
const H = e.value;
if (s.$autoDirty.value && !s.$silent.value && s.$dirty.value && !s.$validating.value && !s.$pending.value && !X.value && !be(F.value)) return {
valid: !s.$invalid.value,
data: H,
errors: s.$errors.value,
issues: s.$issues.value
};
if (s.$dirty.value || (s.$dirty.value = !0), be(F.value)) return {
valid: !0,
data: H,
errors: s.$errors.value,
issues: s.$issues.value
};
x();
const { promise: L } = O(Promise.allSettled(Object.values(F.value).map((I) => I.$parse()))), de = await L;
return await ke(), {
valid: de.every((I) => I.status === "fulfilled" && I.value === !0),
data: H,
errors: s.$errors.value,
issues: s.$issues.value
};
} catch {
return {
valid: !1,
data: e.value,
errors: s.$errors.value,
issues: s.$issues.value
};
}
}
function ue(m) {
try {
return m && (e.value = m), s.$dirty.value || (s.$dirty.value = !0), $ ? !1 : Object.values(F.value).map((H) => H.$parseSync()).every((H) => !!H);
} catch {
return !1;
}
}
function se(m = !0) {
return s.$dirty.value ? e.value : m ? { _null: !0 } : null;
}
function ae(m) {
d && (d.value = m);
}
function K() {
var m;
(m = d == null ? void 0 : d.value) != null && m.length && (d.value = []);
}
!s.$lazy.value && !s.$dirty.value && !s.$silent.value && he(), A();
const { $shortcuts: Oe, $validating: pe, $autoDirty: we, $rewardEarly: Ve, $clearExternalErrorsOnChange: Ce, $clearExternalErrorsOnValidate: Fe, $haveAnyAsyncRule: qe, $debounce: He, $lazy: Qe, ...Pe } = s, Ge = Ae({
...Pe,
$externalErrors: d,
$value: e,
$initialValue: E,
$originalValue: g,
$rules: F,
...Oe,
$path: r,
$isDebouncing: X,
$reset: y,
$touch: re,
$validate: S,
$validateSync: ue,
$validateWithoutRaceconditions: z,
$unwatch: ne,
$watch: _e,
$extractDirtyFields: se,
$clearExternalErrors: K,
$abort: x,
$addRules: V,
addRules: fe,
$schemaMode: $,
"~modifiers": s.$modifiers,
$setExternalErrors: ae,
...Rt(S)
});
return Object.defineProperty(Ge, Symbol.for("regle:instance"), { value: !0 }), Ge;
}
function qt({ $id: e, path: t, cachePath: a, index: r, options: n, storage: l, stateValue: u, customMessages: i, rules: d, externalErrors: p, schemaErrors: $, initialState: v, originalState: h, shortcuts: E, fieldName: T, schemaMode: g, overrides: P, currentIndexes: U }) {
var o, f;
const C = ((o = u.value) == null ? void 0 : o.$id) ?? d.$key ?? bt();
let G = `${a}.${String(C)}`;
const s = b(r);
let R = `${t}.${r}`;
typeof u.value == "object" && u.value != null && (u.value.$id || Object.defineProperties(u.value, { $id: {
value: C,
enumerable: !1,
configurable: !1,
writable: !1
} }));
const w = k((p == null ? void 0 : p.value) ?? [], r), B = c(() => {
var j;
return (j = $ == null ? void 0 : $.value) == null ? void 0 : j[s.value];
}), D = Xe({
index: r,
state: u,
rulesDef: k(() => d),
customMessages: i,
path: R,
cachePath: G,
storage: l,
options: n,
externalErrors: w,
schemaErrors: B,
initialState: v,
originalState: h,
shortcuts: E,
fieldName: T,
schemaMode: g,
overrides: P
});
return D && (D.$id = ((f = u.value) == null ? void 0 : f.$id) ?? String(C), U == null || U.set(D.$id, s), l.addArrayStatus(e, D.$id, D)), u.value && (!ie(u.value) || xe(u.value)) && g && (D == null || D.$touch()), D;
}
function Ta({ state: e, rulesDef: t, customMessages: a, path: r, cachePath: n, storage: l, options: u, externalErrors: i, schemaErrors: d, schemaMode: p, initialState: $, originalState: v, shortcuts: h, fieldName: E, overrides: T }) {
let g = ce(), P, U = ce(), C, G = [];
if (!Array.isArray(e.value) && !t.value.$each) return;
const s = b(), R = b(e.value), w = b({});
let B, D;
const o = b({}), f = l.getCollectionsEntry(r), j = /* @__PURE__ */ new Map();
C = U.run(() => ({ isPrimitiveArray: c(() => {
var y;
return (y = e.value) != null && y.length ? Array.isArray(e.value) && e.value.length ? e.value.every((_) => typeof _ != "object") : t.value.$each && !(t.value.$each instanceof Function) ? Object.values(t.value.$each).every((_) => Ze(_) || typeof _ == "function") : !1 : !1;
}) })), J(), fe();
function J() {
var y, _;
w.value = Object.fromEntries(Object.entries(t.value).filter(([O]) => O.startsWith("$"))), typeof e.value == "object" && (e.value != null && !((y = e.value) != null && y.$id) && e.value !== null ? (s.value = bt(), Object.defineProperties(e.value, { $id: {
value: s.value,
enumerable: !1,
configurable: !1,
writable: !1
} })) : (_ = e.value) != null && _.$id && (s.value = e.value.$id)), R.value = o.value.$value, Array.isArray(e.value) && (!C.isPrimitiveArray.value || p) ? f.value = e.value.map((O, x) => {
const { scope: re, unwrapped: S } = Wt(t.value.$each, k(() => O), x);
re && G.push(re);
const z = k($.value ?? [], x), ue = k((i == null ? void 0 : i.value) ?? {}, "$each"), se = c(() => {
var K;
return (K = d == null ? void 0 : d.value) == null ? void 0 : K.$each;
}), ae = qt({
$id: s.value,
path: r,
cachePath: n,
customMessages: a,
rules: S ?? {},
stateValue: k(() => O),
index: x,
options: u,
storage: l,
externalErrors: ue,
schemaErrors: se,
initialState: z,
originalState: v,
shortcuts: h,
fieldName: E,
schemaMode: p,
overrides: T,
currentIndexes: j
});
return ae || null;
}).filter((O) => !!O) : (f.value = [], j.clear()), o.value = it({
state: e,
rulesDef: t,
customMessages: a,
path: r,
cachePath: r,
storage: l,
options: u,
externalErrors: k((i == null ? void 0 : i.value) ?? {}, "$self"),
schemaErrors: c(() => {
var O;
return (O = d == null ? void 0 : d.value) == null ? void 0 : O.$self;
}),
$isArray: !0,
initialState: $,
originalState: v,
shortcuts: h,
fieldName: E,
schemaMode: p,
overrides: T
});
}
function X() {
if (Array.isArray(e.value) && (!C.isPrimitiveArray.value || p)) {
const y = Y(f.value), _ = /* @__PURE__ */ new Set();
f.value = e.value.map((O, x) => {
const re = k(() => O);
if (O.$id && f.value.find((S) => S.$id === O.$id)) {
const S = l.getArrayStatus(s.value, O.$id);
if (S) {
const z = j.get(O.$id);
return z && (z.value = x), _.add(O.$id), S.$value = re, S;
}
return null;
} else {
const { scope: S, unwrapped: z } = Wt(t.value.$each, re, x);
S && G.push(S);
const ue = k((i == null ? void 0 : i.value) ?? {}, "$each"), se = c(() => {
var K;
return ((K = d == null ? void 0 : d.value) == null ? void 0 : K.$each) ?? [];
}), ae = qt({
$id: s.value,
path: r,
cachePath: r,
customMessages: a,
rules: z ?? {},
stateValue: re,
index: x,
options: u,
storage: l,
externalErrors: ue,
schemaErrors: se,
initialState: k($.value ?? [], x),
originalState: v,
shortcuts: h,
fieldName: E,
schemaMode: p,
overrides: T,
currentIndexes: j
});
return ae ? (ae.$id && _.add(ae.$id), ae) : null;
}
}).filter((O) => !!O), y.filter((O) => {
var x;
return !((x = e.value) != null && x.find((re) => O.$id === re.$id));
}).forEach((O, x) => {
l.deleteArrayStatus(s.value, x.toString());
});
for (const O of j.keys()) _.has(O) || j.delete(O);
} else
f.value = [], j.clear();
}
function te() {
B = le(e, () => {
D == null || D(), e.value != null && !Object.hasOwn(e.value, "$id") && !s.value ? J() : X(), V();
}, {
deep: gt ? 1 : !0,
flush: "pre"
}), V();
}
function V() {
D = le(e, () => {
P.$autoDirty.value && !P.$silent.value && o.value.$touch(!1, !0);
}, { flush: "post" });
}
function fe() {
te(), g = ce(), P = g.run(() => {
const y = c({
get: () => e.value,
set(L) {
B == null || B(), D == null || D(), e.value = L, te();
}
}), _ = c(() => o.value.$dirty && (!f.value.length || f.value.every((L) => L.$dirty))), O = c(() => o.value.$anyDirty || f.value.some((L) => L.$anyDirty)), x = c(() => o.value.$invalid || f.value.some((L) => L.$invalid)), re = c(() => (p ? o.value.$correct : be(o.value.$rules) ? !0 : o.value.$correct) && (!f.value.length || f.value.every((L) => L.$correct || L.$anyDirty && !L.$invalid))), S = c(() => o.value.$error || f.value.some((L) => L.$error)), z = c(() => !(x.value || ue.value)), ue = c(() => o.value.$pending || f.value.some((L) => L.$pending)), se = c(() => !!f.value.length && f.value.every((L) => L.$edited)), ae = c(() => o.value.$anyEdited || f.value.some((L) => L.$anyEdited)), K = c(() => ({
$self: o.value.$issues,
$each: f.value.map((L) => L.$issues)
})), Oe = c(() => ({
$self: o.value.$errors,
$each: f.value.map((L) => L.$errors)
})), pe = c(() => ({
$self: o.value.$silentErrors,
$each: f.value.map((L) => L.$silentErrors)
})), we = c(() => w.value.$rewardEarly != null ? w.value.$rewardEarly : N(u.rewardEarly) != null ? N(u.rewardEarly) === !0 : !1), Ve = c(() => we.value ? !0 : w.value.$silent != null ? w.value.$silent : N(u.silent) != null ? N(u.silent) === !0 : !1), Ce = c(() => w.value.$autoDirty != null ? w.value.$autoDirty : N(u.autoDirty) != null ? N(u.autoDirty) === !0 : !0), Fe = c(() => w.value.$immediateDirty != null ? Ke(w.value.$immediateDirty) : N(u.immediateDirty) != null ? Ke(N(u.immediateDirty)) : !1), qe = c(() => w.value.$clearExternalErrorsOnChange != null ? w.value.$clearExternalErrorsOnChange : N(u.clearExternalErrorsOnChange) != null ? N(u.clearExternalErrorsOnChange) === !0 : !0), He = c(() => w.value.$clearExternalErrorsOnValidate != null ? w.value.$clearExternalErrorsOnValidate : N(u.clearExternalErrorsOnValidate) != null ? N(u.clearExternalErrorsOnValidate) === !0 : !1), Qe = c(() => {
if (w.value.$isEdited != null) return w.value.$isEdited;
if ((T == null ? void 0 : T.isEdited) != null) return T.isEdited;
}), Pe = c(() => E ?? u.id ?? "root"), Ge = c(() => ({
$deepCompare: w.value.$deepCompare ?? !1,
$debounce: w.value.$debounce ?? 0,
$lazy: w.value.$lazy ?? !1,
$rewardEarly: we.value,
$autoDirty: Ce.value,
$silent: Ve.value,
$clearExternalErrorsOnChange: qe.value,
$clearExternalErrorsOnValidate: He.value,
$immediateDirty: Fe.value,
$isEdited: Qe.value,
$disabled: N(u.disabled) ?? !1
}));
function m() {
h != null && h.collections && Object.entries(h == null ? void 0 : h.collections).forEach(([L, de]) => {
const I = ce();
H[L] = I.run(() => {
const W = b();
return Ie(() => {
W.value = de(Ae({
$dirty: _,
$error: S,
$path: r,
$silentValue: y,
$pending: ue,
$invalid: x,
$correct: re,
$errors: Oe,
$silentErrors: pe,
$initialValue: $,
$originalValue: v,
$ready: z,
$anyDirty: O,
$name: Pe,
$each: f,
$self: o,
$value: e,
$edited: se,
$anyEdited: ae,
$issues: K
}));
}), W;
}), G.push(I);
});
}
const H = {};
return m(), {
$dirty: _,
$anyDirty: O,
$invalid: x,
$correct: re,
$error: S,
$pending: ue,
$errors: Oe,
$silentErrors: pe,
$ready: z,
$name: Pe,
$shortcuts: H,
$silentValue: y,
$edited: se,
$anyEdited: ae,
$rewardEarly: we,
$silent: Ve,
$autoDirty: Ce,
$issues: K,
$modifiers: Ge
};
}), C.isPrimitiveArray.value && t.value.$each && console.warn(`${r} is a Array of primitives. Tracking can be lost when reassigning the Array. We advise to use an Array of objects instead`);
}
function me() {
B == null || B(), o.value && o.value.$unwatch(), f.value && f.value.forEach((y) => {
"$dirty" in y && y.$unwatch();
}), g.stop(), g = ce(), U.stop(), U = ce(!0), G.forEach((y) => y.stop()), G = [];
}
function Le(y = !0, _ = !1) {
o.value.$touch(y, _), f.value.forEach((O) => {
O.$touch(y, _);
});
}
function je(y, _) {
if (me(), !_) if (y != null && y.toOriginalState)
e.value = Y(v), $.value = Y(v);
else if (y != null && y.toInitialState) e.value = Y($.value);
else if (y != null && y.toState) {
let O;
typeof (y == null ? void 0 : y.toState) == "function" ? O = y == null ? void 0 : y.toState() : O = y == null ? void 0 : y.toState, $.value = Y(O), e.value = Y(O);
} else $.value = Y(e.value);
y != null && y.clearExternalErrors && he(), y != null && y.keepValidationState || (o.value.$reset(y, _), f.value.forEach((O) => {
O.$reset(y, !0);
})), _ || J();
}
function De() {
o.value.$abort(), f.value.forEach((y) => {
y.$abort();
});
}
async function Se(y) {
return y && (e.value = y), ne();
}
async function ne(y) {
y && (e.value = y);
const _ = e.value;
try {
return De(), {
valid: (await Promise.allSettled([o.value.$validateWithoutRaceconditions(y), ...f.value.map((O) => O.$validateWithoutRaceconditions())])).every((O) => O.status === "fulfilled" ? O.value.valid === !0 : !1),
data: _,
errors: P.$errors.value,
issues: P.$issues.value
};
} catch {
return {
valid: !1,
data: _,
errors: P.$errors.value,
issues: P.$issues.value
};
}
}
function _e(y) {
y && (e.value = y);
try {
return [o.value.$validateSync(y), ...f.value.map((_) => _.$validateSync())].every((_) => !!_);
} catch {
return !1;
}
}
function ye(y) {
i != null && i.value && (i.value = y);
}
function he() {
o.value.$clearExternalErrors(), f.value.forEach((y) => {
y.$clearExternalErrors();
});
}
function F(y = !0) {
let _ = f.value.map((O) => {
if (ba(O)) return O.$extractDirtyFiel