@budibase/server
Version:
Budibase Web Server
1,658 lines (1,657 loc) • 414 kB
JavaScript
import { Q as te, R as tt, _ as gl, T as yl, U as Qi, V as Xi, W as Pr, X as _l, Y as bl, Z as vl, $ as wl, a0 as kl, a1 as Ol, a2 as Sl, a3 as Tl, a4 as El, a5 as Fl, a6 as Dl, S as Te, i as Ee, s as ve, e as I, t as le, b as T, f as C, g as j, j as ue, a7 as ea, a8 as ps, a9 as gs, o as L, F as Ft, a as Y, d as W, l as fe, G as Dt, H as Mt, J as Nt, k as _, z as X, n as w, A as ee, u as Gt, aa as ta, I as Pe, c as R, m as z, p as q, ab as cn, ac as Oe, ad as In, ae as Rr, y as $e, r as Ct, af as Ml, ag as Nl, B as Se, ah as Cl, ai as ct, h as He, q as Kt, aj as dt, ak as ys, al as Er, v as pe, am as ra, an as Bt, ao as na, ap as Fr, aq as Qr, ar as Ll, as as Vl, at as Il, au as Al, C as Wl, N as Dr, O as sa, av as An, aw as Wn, ax as Ul, ay as _s, az as ia, aA as St, aB as xl, aC as Pl, aD as Rl, aE as zl, aF as ql, aG as jl, aH as $l } from "./index-fc73233e.js";
import { M as Zl, I as vr } from "./Item-2e0d17f4.js";
import { S as qt } from "./datasources-2b52ffcb.js";
import { r as Hl } from "./___vite-browser-external_commonjs-proxy-5f1afbec.js";
import { U as Bl } from "./UserAvatar-efc69fb2.js";
import { h as Yl } from "./users-6f3c0433.js";
function Gl(r) {
return !!r.providerType;
}
const Qt = {
WORKSPACES: "/builder/workspaces",
SETTINGS_EMAIL: "/builder/settings/email",
SETTINGS_AUTH: "/builder/settings/auth",
SETTINGS_PEOPLE_USERS: "/builder/settings/people/users",
APPS: "/builder/apps"
}, Un = {
ACCOUNT: "/portal/account",
BILLING: "/portal/billing",
UPGRADE: "/portal/upgrade"
};
function Jl(r) {
return r === qt.GOOGLE_SHEETS;
}
function Kl(r) {
return !r || !r.source ? !1 : [
qt.POSTGRES,
qt.SQL_SERVER,
qt.MYSQL,
qt.ORACLE
].indexOf(r.source) !== -1 || r.isSQL === !0;
}
async function aa(r) {
return new Promise((e) => setTimeout(e, r));
}
async function Ql(r, e) {
const { times: t = 3 } = e || {};
if (t < 1)
throw new Error(`invalid retry count: ${t}`);
let n;
for (let s = 0; s < t; s++) {
const i = 1.5 ** s * 1e3 * (Math.random() + 0.5);
await aa(i);
try {
return await r();
} catch (a) {
n = a;
}
}
throw n;
}
var sr = { exports: {} }, Re = {};
(function(r) {
Object.defineProperty(r, "__esModule", { value: !0 }), r.Err = r.Valid = r.err = r.valid = void 0;
const e = (i) => new n(i);
r.valid = e;
const t = (i) => new s(i);
r.err = t;
class n {
constructor(a) {
this.value = a;
}
isValid() {
return !0;
}
isError() {
return !this.isValid();
}
getValue() {
return this.value;
}
getError() {
throw new Error("Tried to get error from a valid.");
}
map(a) {
return (0, r.valid)(a(this.value));
}
mapErr(a) {
return (0, r.valid)(this.value);
}
}
r.Valid = n;
class s {
constructor(a) {
this.error = a;
}
isError() {
return !0;
}
isValid() {
return !this.isError();
}
getValue() {
throw new Error("Tried to get success value from an error.");
}
getError() {
return this.error;
}
map(a) {
return (0, r.err)(this.error);
}
mapErr(a) {
return (0, r.err)(a(this.error));
}
}
r.Err = s;
})(Re);
var ir = {}, ar = {}, bs;
function ht() {
if (bs)
return ar;
bs = 1, Object.defineProperty(ar, "__esModule", { value: !0 }), Be();
const r = Re, e = [
"jan",
"feb",
"mar",
"apr",
"may",
"jun",
"jul",
"aug",
"sep",
"oct",
"nov",
"dec"
], t = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"], n = (u, d) => d[u].lowerLimit === d.preset[u].minValue && d[u].upperLimit === d.preset[u].maxValue, s = (u, d, h) => {
if (d === "months" && h.useAliases && e.indexOf(u.toLowerCase()) !== -1 || d === "daysOfWeek" && h.useAliases && t.indexOf(u.toLowerCase()) !== -1)
return (0, r.valid)(!0);
const c = Number(u);
if (isNaN(c))
return (0, r.err)(`Element '${u} of ${d} field is invalid.`);
const { lowerLimit: m } = h[d], { upperLimit: g } = h[d];
return m && c < m ? (0, r.err)(`Number ${c} of ${d} field is smaller than lower limit '${m}'`) : g && c > g ? (0, r.err)(`Number ${c} of ${d} field is bigger than upper limit '${g}'`) : (0, r.valid)(!0);
}, i = (u, d, h) => {
if (u === "*")
return n(d, h) ? (0, r.valid)(!0) : (0, r.err)(`Field ${d} uses wildcard '*', but is limited to ${h[d].lowerLimit}-${h[d].upperLimit}`);
if (u === "")
return (0, r.err)(`One of the elements is empty in ${d} field.`);
if (d === "daysOfMonth" && h.useLastDayOfMonth && u === "L")
return (0, r.valid)(!0);
if (d === "daysOfWeek" && h.useLastDayOfWeek && u.endsWith("L")) {
const c = u.slice(0, -1);
return c === "" ? (0, r.valid)(!0) : s(c, d, h);
}
if (d === "daysOfMonth" && h.useNearestWeekday && u.endsWith("W")) {
const c = u.slice(0, -1);
return c === "" ? (0, r.err)("The 'W' must be preceded by a day") : h.useLastDayOfMonth && c === "L" ? (0, r.valid)(!0) : s(c, d, h);
}
if (d === "daysOfWeek" && h.useNthWeekdayOfMonth && u.indexOf("#") !== -1) {
const [c, m, ...g] = u.split("#");
if (g.length !== 0)
return (0, r.err)(`Unexpected number of '#' in ${u}, can only be used once.`);
const p = Number(m);
return !m || isNaN(p) ? (0, r.err)(`Unexpected value following the '#' symbol, a positive number was expected but found ${m}.`) : p > 5 ? (0, r.err)("Number of occurrence of the day of the week cannot be greater than 5.") : s(c, d, h);
}
return s(u, d, h);
}, a = (u, d, h, c) => u === "*" ? (0, r.err)(`'*' can't be part of a range in ${d} field.`) : u === "" ? (0, r.err)(`One of the range elements is empty in ${d} field.`) : h.useLastDayOfMonth && d === "daysOfMonth" && u === "L" && c === 0 ? (0, r.valid)(!0) : s(u, d, h), l = (u, d, h) => {
const c = u.split("-");
if (c.length > 2)
return (0, r.err)(`List element '${u}' is not valid. (More than one '-')`);
if (c.length === 1)
return i(c[0], d, h);
if (c.length === 2) {
const m = a(c[0], d, h, 0), g = a(c[1], d, h, 1);
return m.isError() ? m : g.isError() ? g : Number(c[0]) > Number(c[1]) ? (0, r.err)(`Lower range end '${c[0]}' is bigger than upper range end '${c[1]}' of ${d} field.`) : (0, r.valid)(!0);
}
return (0, r.err)("Some other error in checkFirstStepElement (rangeArray less than 1)");
}, o = (u, d, h) => {
const c = u.split("/");
if (c.length > 2)
return (0, r.err)(`List element '${u}' is not valid. (More than one '/')`);
const m = l(c[0], d, h);
if (m.isError())
return m;
if (c.length === 2) {
const g = c[1];
if (!g)
return (0, r.err)(`Second step element '${g}' of '${u}' is not valid (doesnt exist).`);
if (isNaN(Number(g)))
return (0, r.err)(`Second step element '${g}' of '${u}' is not valid (not a number).`);
if (Number(g) === 0)
return (0, r.err)(`Second step element '${g}' of '${u}' cannot be zero.`);
}
return (0, r.valid)(!0);
}, f = (u, d, h) => {
if (![
"seconds",
"minutes",
"hours",
"daysOfMonth",
"months",
"daysOfWeek",
"years"
].includes(d))
return (0, r.err)([`Cron field type '${d}' does not exist.`]);
if (u === "?")
return d === "daysOfMonth" || d === "daysOfWeek" ? h.useBlankDay ? (0, r.valid)(!0) : (0, r.err)([
`useBlankDay is not enabled, but is used in ${d} field`
]) : (0, r.err)([`blank notation is not allowed in ${d} field`]);
const c = u.split(","), m = [];
if (c.forEach((p) => {
m.push(o(p, d, h));
}), m.every((p) => p.isValid()))
return (0, r.valid)(!0);
const g = [];
return m.forEach((p) => {
p.isError() && g.push(p.getError());
}), (0, r.err)(g);
};
return ar.default = f, ar;
}
var vs;
function Xl() {
if (vs)
return ir;
vs = 1;
var r = te && te.__importDefault || function(s) {
return s && s.__esModule ? s : { default: s };
};
Object.defineProperty(ir, "__esModule", { value: !0 }), Be();
const e = Re, t = r(ht()), n = (s, i) => {
if (!s.seconds)
return (0, e.err)([
"seconds field is undefined, but useSeconds options is enabled."
]);
const { seconds: a } = s;
return (0, t.default)(a, "seconds", i);
};
return ir.default = n, ir;
}
var or = {}, ws;
function eu() {
if (ws)
return or;
ws = 1;
var r = te && te.__importDefault || function(s) {
return s && s.__esModule ? s : { default: s };
};
Object.defineProperty(or, "__esModule", { value: !0 }), Be();
const e = Re, t = r(ht()), n = (s, i) => {
if (!s.minutes)
return (0, e.err)(["minutes field is undefined."]);
const { minutes: a } = s;
return (0, t.default)(a, "minutes", i);
};
return or.default = n, or;
}
var lr = {}, ks;
function tu() {
if (ks)
return lr;
ks = 1;
var r = te && te.__importDefault || function(s) {
return s && s.__esModule ? s : { default: s };
};
Object.defineProperty(lr, "__esModule", { value: !0 }), Be();
const e = Re, t = r(ht()), n = (s, i) => {
if (!s.hours)
return (0, e.err)(["hours field is undefined."]);
const { hours: a } = s;
return (0, t.default)(a, "hours", i);
};
return lr.default = n, lr;
}
var ur = {}, Os;
function ru() {
if (Os)
return ur;
Os = 1;
var r = te && te.__importDefault || function(s) {
return s && s.__esModule ? s : { default: s };
};
Object.defineProperty(ur, "__esModule", { value: !0 }), Be();
const e = Re, t = r(ht()), n = (s, i) => {
if (!s.daysOfMonth)
return (0, e.err)(["daysOfMonth field is undefined."]);
const { daysOfMonth: a } = s;
return i.allowOnlyOneBlankDayField && i.useBlankDay && s.daysOfMonth === "?" && s.daysOfWeek === "?" ? (0, e.err)([
"Cannot use blank value in daysOfMonth and daysOfWeek field when allowOnlyOneBlankDayField option is enabled."
]) : i.mustHaveBlankDayField && s.daysOfMonth !== "?" && s.daysOfWeek !== "?" ? (0, e.err)([
"Cannot specify both daysOfMonth and daysOfWeek field when mustHaveBlankDayField option is enabled."
]) : i.useLastDayOfMonth && s.daysOfMonth.indexOf("L") !== -1 && s.daysOfMonth.match(/[,/]/) ? (0, e.err)([
"Cannot specify last day of month with lists, or ranges (symbols ,/)."
]) : i.useNearestWeekday && s.daysOfMonth.indexOf("W") !== -1 && s.daysOfMonth.match(/[,/-]/) ? (0, e.err)([
"Cannot specify nearest weekday with lists, steps or ranges (symbols ,-/)."
]) : (0, t.default)(a, "daysOfMonth", i);
};
return ur.default = n, ur;
}
var fr = {}, Ss;
function nu() {
if (Ss)
return fr;
Ss = 1;
var r = te && te.__importDefault || function(s) {
return s && s.__esModule ? s : { default: s };
};
Object.defineProperty(fr, "__esModule", { value: !0 }), Be();
const e = Re, t = r(ht()), n = (s, i) => {
if (!s.months)
return (0, e.err)(["months field is undefined."]);
const { months: a } = s;
return (0, t.default)(a, "months", i);
};
return fr.default = n, fr;
}
var cr = {}, Ts;
function su() {
if (Ts)
return cr;
Ts = 1;
var r = te && te.__importDefault || function(s) {
return s && s.__esModule ? s : { default: s };
};
Object.defineProperty(cr, "__esModule", { value: !0 }), Be();
const e = Re, t = r(ht()), n = (s, i) => {
if (!s.daysOfWeek)
return (0, e.err)(["daysOfWeek field is undefined."]);
const { daysOfWeek: a } = s;
return i.allowOnlyOneBlankDayField && s.daysOfMonth === "?" && s.daysOfWeek === "?" ? (0, e.err)([
"Cannot use blank value in daysOfMonth and daysOfWeek field when allowOnlyOneBlankDayField option is enabled."
]) : i.mustHaveBlankDayField && s.daysOfMonth !== "?" && s.daysOfWeek !== "?" ? (0, e.err)([
"Cannot specify both daysOfMonth and daysOfWeek field when mustHaveBlankDayField option is enabled."
]) : i.useLastDayOfWeek && s.daysOfWeek.indexOf("L") !== -1 && s.daysOfWeek.match(/[,/-]/) ? (0, e.err)([
"Cannot specify last day of week with lists, steps or ranges (symbols ,-/)."
]) : i.useNthWeekdayOfMonth && s.daysOfWeek.indexOf("#") !== -1 && s.daysOfWeek.match(/[,/-]/) ? (0, e.err)([
"Cannot specify Nth weekday of month with lists, steps or ranges (symbols ,-/)."
]) : (0, t.default)(a, "daysOfWeek", i);
};
return cr.default = n, cr;
}
var dr = {}, Es;
function iu() {
if (Es)
return dr;
Es = 1;
var r = te && te.__importDefault || function(s) {
return s && s.__esModule ? s : { default: s };
};
Object.defineProperty(dr, "__esModule", { value: !0 }), Be();
const e = Re, t = r(ht()), n = (s, i) => {
if (!s.years)
return (0, e.err)(["years field is undefined, but useYears option is enabled."]);
const { years: a } = s;
return (0, t.default)(a, "years", i);
};
return dr.default = n, dr;
}
var Ve = {}, dn;
try {
dn = Map;
} catch {
}
var hn;
try {
hn = Set;
} catch {
}
function oa(r, e, t) {
if (!r || typeof r != "object" || typeof r == "function")
return r;
if (r.nodeType && "cloneNode" in r)
return r.cloneNode(!0);
if (r instanceof Date)
return new Date(r.getTime());
if (r instanceof RegExp)
return new RegExp(r);
if (Array.isArray(r))
return r.map(mn);
if (dn && r instanceof dn)
return new Map(Array.from(r.entries()));
if (hn && r instanceof hn)
return new Set(Array.from(r.values()));
if (r instanceof Object) {
e.push(r);
var n = Object.create(r);
t.push(n);
for (var s in r) {
var i = e.findIndex(function(a) {
return a === r[s];
});
n[s] = i > -1 ? t[i] : oa(r[s], e, t);
}
return n;
}
return r;
}
function mn(r) {
return oa(r, [], []);
}
const au = Object.prototype.toString, ou = Error.prototype.toString, lu = RegExp.prototype.toString, uu = typeof Symbol < "u" ? Symbol.prototype.toString : () => "", fu = /^Symbol\((.*)\)(.*)$/;
function cu(r) {
return r != +r ? "NaN" : r === 0 && 1 / r < 0 ? "-0" : "" + r;
}
function Fs(r, e = !1) {
if (r == null || r === !0 || r === !1)
return "" + r;
const t = typeof r;
if (t === "number")
return cu(r);
if (t === "string")
return e ? `"${r}"` : r;
if (t === "function")
return "[Function " + (r.name || "anonymous") + "]";
if (t === "symbol")
return uu.call(r).replace(fu, "Symbol($1)");
const n = au.call(r).slice(8, -1);
return n === "Date" ? isNaN(r.getTime()) ? "" + r : r.toISOString(r) : n === "Error" || r instanceof Error ? "[" + ou.call(r) + "]" : n === "RegExp" ? lu.call(r) : null;
}
function Tt(r, e) {
let t = Fs(r, e);
return t !== null ? t : JSON.stringify(r, function(n, s) {
let i = Fs(this[n], e);
return i !== null ? i : s;
}, 2);
}
let ot = {
default: "${path} is invalid",
required: "${path} is a required field",
oneOf: "${path} must be one of the following values: ${values}",
notOneOf: "${path} must not be one of the following values: ${values}",
notType: ({
path: r,
type: e,
value: t,
originalValue: n
}) => {
let s = n != null && n !== t, i = `${r} must be a \`${e}\` type, but the final value was: \`${Tt(t, !0)}\`` + (s ? ` (cast from the value \`${Tt(n, !0)}\`).` : ".");
return t === null && (i += '\n If "null" is intended as an empty value be sure to mark the schema as `.nullable()`'), i;
},
defined: "${path} must be defined"
}, We = {
length: "${path} must be exactly ${length} characters",
min: "${path} must be at least ${min} characters",
max: "${path} must be at most ${max} characters",
matches: '${path} must match the following: "${regex}"',
email: "${path} must be a valid email",
url: "${path} must be a valid URL",
uuid: "${path} must be a valid UUID",
trim: "${path} must be a trimmed string",
lowercase: "${path} must be a lowercase string",
uppercase: "${path} must be a upper case string"
}, Ge = {
min: "${path} must be greater than or equal to ${min}",
max: "${path} must be less than or equal to ${max}",
lessThan: "${path} must be less than ${less}",
moreThan: "${path} must be greater than ${more}",
positive: "${path} must be a positive number",
negative: "${path} must be a negative number",
integer: "${path} must be an integer"
}, pn = {
min: "${path} field must be later than ${min}",
max: "${path} field must be at earlier than ${max}"
}, gn = {
isValue: "${path} field must be ${value}"
}, yn = {
noUnknown: "${path} field has unspecified keys: ${unknown}"
}, wr = {
min: "${path} field must have at least ${min} items",
max: "${path} field must have less than or equal to ${max} items",
length: "${path} must be have ${length} items"
};
const du = Object.assign(/* @__PURE__ */ Object.create(null), {
mixed: ot,
string: We,
number: Ge,
date: pn,
object: yn,
array: wr,
boolean: gn
});
var hu = Object.prototype, mu = hu.hasOwnProperty;
function pu(r, e) {
return r != null && mu.call(r, e);
}
var gu = pu, yu = gu, _u = gl;
function bu(r, e) {
return r != null && _u(r, e, yu);
}
var vu = bu;
const Mr = /* @__PURE__ */ tt(vu), Lt = (r) => r && r.__isYupSchema__;
class wu {
constructor(e, t) {
if (this.refs = e, this.refs = e, typeof t == "function") {
this.fn = t;
return;
}
if (!Mr(t, "is"))
throw new TypeError("`is:` is required for `when()` conditions");
if (!t.then && !t.otherwise)
throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");
let {
is: n,
then: s,
otherwise: i
} = t, a = typeof n == "function" ? n : (...l) => l.every((o) => o === n);
this.fn = function(...l) {
let o = l.pop(), f = l.pop(), u = a(...l) ? s : i;
if (u)
return typeof u == "function" ? u(f) : f.concat(u.resolve(o));
};
}
resolve(e, t) {
let n = this.refs.map((i) => i.getValue(t == null ? void 0 : t.value, t == null ? void 0 : t.parent, t == null ? void 0 : t.context)), s = this.fn.apply(e, n.concat(e, t));
if (s === void 0 || s === e)
return e;
if (!Lt(s))
throw new TypeError("conditions must return a schema object");
return s.resolve(t);
}
}
function la(r) {
return r == null ? [] : [].concat(r);
}
function _n() {
return _n = Object.assign || function(r) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e];
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) && (r[n] = t[n]);
}
return r;
}, _n.apply(this, arguments);
}
let ku = /\$\{\s*(\w+)\s*\}/g;
class be extends Error {
static formatError(e, t) {
const n = t.label || t.path || "this";
return n !== t.path && (t = _n({}, t, {
path: n
})), typeof e == "string" ? e.replace(ku, (s, i) => Tt(t[i])) : typeof e == "function" ? e(t) : e;
}
static isError(e) {
return e && e.name === "ValidationError";
}
constructor(e, t, n, s) {
super(), this.name = "ValidationError", this.value = t, this.path = n, this.type = s, this.errors = [], this.inner = [], la(e).forEach((i) => {
be.isError(i) ? (this.errors.push(...i.errors), this.inner = this.inner.concat(i.inner.length ? i.inner : i)) : this.errors.push(i);
}), this.message = this.errors.length > 1 ? `${this.errors.length} errors occurred` : this.errors[0], Error.captureStackTrace && Error.captureStackTrace(this, be);
}
}
const Ou = (r) => {
let e = !1;
return (...t) => {
e || (e = !0, r(...t));
};
};
function Nr(r, e) {
let {
endEarly: t,
tests: n,
args: s,
value: i,
errors: a,
sort: l,
path: o
} = r, f = Ou(e), u = n.length;
const d = [];
if (a = a || [], !u)
return a.length ? f(new be(a, i, o)) : f(null, i);
for (let h = 0; h < n.length; h++) {
const c = n[h];
c(s, function(g) {
if (g) {
if (!be.isError(g))
return f(g, i);
if (t)
return g.value = i, f(g, i);
d.push(g);
}
if (--u <= 0) {
if (d.length && (l && d.sort(l), a.length && d.push(...a), a = d), a.length) {
f(new be(a, i, o), i);
return;
}
f(null, i);
}
});
}
}
function Su(r) {
return function(e, t, n) {
for (var s = -1, i = Object(e), a = n(e), l = a.length; l--; ) {
var o = a[r ? l : ++s];
if (t(i[o], o, i) === !1)
break;
}
return e;
};
}
var Tu = Su, Eu = Tu, Fu = Eu(), Du = Fu, Mu = Du, Nu = yl;
function Cu(r, e) {
return r && Mu(r, e, Nu);
}
var ua = Cu, Lu = Xi, Vu = ua, Iu = Qi;
function Au(r, e) {
var t = {};
return e = Iu(e), Vu(r, function(n, s, i) {
Lu(t, s, e(n, s, i));
}), t;
}
var Wu = Au;
const fa = /* @__PURE__ */ tt(Wu);
function mt(r) {
this._maxSize = r, this.clear();
}
mt.prototype.clear = function() {
this._size = 0, this._values = /* @__PURE__ */ Object.create(null);
};
mt.prototype.get = function(r) {
return this._values[r];
};
mt.prototype.set = function(r, e) {
return this._size >= this._maxSize && this.clear(), r in this._values || this._size++, this._values[r] = e;
};
var Uu = /[^.^\]^[]+|(?=\[\]|\.\.)/g, ca = /^\d+$/, xu = /^\d/, Pu = /[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g, Ru = /^\s*(['"]?)(.*?)(\1)\s*$/, xn = 512, Ds = new mt(xn), Ms = new mt(xn), Ns = new mt(xn), zr = {
Cache: mt,
split: bn,
normalizePath: Xr,
setter: function(r) {
var e = Xr(r);
return Ms.get(r) || Ms.set(r, function(n, s) {
for (var i = 0, a = e.length, l = n; i < a - 1; ) {
var o = e[i];
if (o === "__proto__" || o === "constructor" || o === "prototype")
return n;
l = l[e[i++]];
}
l[e[i]] = s;
});
},
getter: function(r, e) {
var t = Xr(r);
return Ns.get(r) || Ns.set(r, function(s) {
for (var i = 0, a = t.length; i < a; )
if (s != null || !e)
s = s[t[i++]];
else
return;
return s;
});
},
join: function(r) {
return r.reduce(function(e, t) {
return e + (Pn(t) || ca.test(t) ? "[" + t + "]" : (e ? "." : "") + t);
}, "");
},
forEach: function(r, e, t) {
zu(Array.isArray(r) ? r : bn(r), e, t);
}
};
function Xr(r) {
return Ds.get(r) || Ds.set(
r,
bn(r).map(function(e) {
return e.replace(Ru, "$2");
})
);
}
function bn(r) {
return r.match(Uu) || [""];
}
function zu(r, e, t) {
var n = r.length, s, i, a, l;
for (i = 0; i < n; i++)
s = r[i], s && ($u(s) && (s = '"' + s + '"'), l = Pn(s), a = !l && /^\d+$/.test(s), e.call(t, s, l, a, i, r));
}
function Pn(r) {
return typeof r == "string" && r && ["'", '"'].indexOf(r.charAt(0)) !== -1;
}
function qu(r) {
return r.match(xu) && !r.match(ca);
}
function ju(r) {
return Pu.test(r);
}
function $u(r) {
return !Pn(r) && (qu(r) || ju(r));
}
const hr = {
context: "$",
value: "."
};
function Zu(r, e) {
return new Xe(r, e);
}
class Xe {
constructor(e, t = {}) {
if (typeof e != "string")
throw new TypeError("ref must be a string, got: " + e);
if (this.key = e.trim(), e === "")
throw new TypeError("ref must be a non-empty string");
this.isContext = this.key[0] === hr.context, this.isValue = this.key[0] === hr.value, this.isSibling = !this.isContext && !this.isValue;
let n = this.isContext ? hr.context : this.isValue ? hr.value : "";
this.path = this.key.slice(n.length), this.getter = this.path && zr.getter(this.path, !0), this.map = t.map;
}
getValue(e, t, n) {
let s = this.isContext ? n : this.isValue ? e : t;
return this.getter && (s = this.getter(s || {})), this.map && (s = this.map(s)), s;
}
/**
*
* @param {*} value
* @param {Object} options
* @param {Object=} options.context
* @param {Object=} options.parent
*/
cast(e, t) {
return this.getValue(e, t == null ? void 0 : t.parent, t == null ? void 0 : t.context);
}
resolve() {
return this;
}
describe() {
return {
type: "ref",
key: this.key
};
}
toString() {
return `Ref(${this.key})`;
}
static isRef(e) {
return e && e.__isYupRef;
}
}
Xe.prototype.__isYupRef = !0;
function Cr() {
return Cr = Object.assign || function(r) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e];
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) && (r[n] = t[n]);
}
return r;
}, Cr.apply(this, arguments);
}
function Hu(r, e) {
if (r == null)
return {};
var t = {}, n = Object.keys(r), s, i;
for (i = 0; i < n.length; i++)
s = n[i], !(e.indexOf(s) >= 0) && (t[s] = r[s]);
return t;
}
function mr(r) {
function e(t, n) {
let {
value: s,
path: i = "",
label: a,
options: l,
originalValue: o,
sync: f
} = t, u = Hu(t, ["value", "path", "label", "options", "originalValue", "sync"]);
const {
name: d,
test: h,
params: c,
message: m
} = r;
let {
parent: g,
context: p
} = l;
function y(E) {
return Xe.isRef(E) ? E.getValue(s, g, p) : E;
}
function b(E = {}) {
const A = fa(Cr({
value: s,
originalValue: o,
label: a,
path: E.path || i
}, c, E.params), y), N = new be(be.formatError(E.message || m, A), s, A.path, E.type || d);
return N.params = A, N;
}
let v = Cr({
path: i,
parent: g,
type: d,
createError: b,
resolve: y,
options: l,
originalValue: o
}, u);
if (!f) {
try {
Promise.resolve(h.call(v, s, v)).then((E) => {
be.isError(E) ? n(E) : E ? n(null, E) : n(b());
});
} catch (E) {
n(E);
}
return;
}
let k;
try {
var S;
if (k = h.call(v, s, v), typeof ((S = k) == null ? void 0 : S.then) == "function")
throw new Error(`Validation test of type: "${v.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);
} catch (E) {
n(E);
return;
}
be.isError(k) ? n(k) : k ? n(null, k) : n(b());
}
return e.OPTIONS = r, e;
}
let Bu = (r) => r.substr(0, r.length - 1).substr(1);
function da(r, e, t, n = t) {
let s, i, a;
return e ? (zr.forEach(e, (l, o, f) => {
let u = o ? Bu(l) : l;
if (r = r.resolve({
context: n,
parent: s,
value: t
}), r.innerType) {
let d = f ? parseInt(u, 10) : 0;
if (t && d >= t.length)
throw new Error(`Yup.reach cannot resolve an array item at index: ${l}, in the path: ${e}. because there is no value at that index. `);
s = t, t = t && t[d], r = r.innerType;
}
if (!f) {
if (!r.fields || !r.fields[u])
throw new Error(`The schema does not contain the path: ${e}. (failed at: ${a} which is a type: "${r._type}")`);
s = t, t = t && t[u], r = r.fields[u];
}
i = u, a = o ? "[" + l + "]" : "." + l;
}), {
schema: r,
parent: s,
parentPath: i
}) : {
parent: s,
parentPath: e,
schema: r
};
}
const Yu = (r, e, t, n) => da(r, e, t, n).schema;
class Lr {
constructor() {
this.list = /* @__PURE__ */ new Set(), this.refs = /* @__PURE__ */ new Map();
}
get size() {
return this.list.size + this.refs.size;
}
describe() {
const e = [];
for (const t of this.list)
e.push(t);
for (const [, t] of this.refs)
e.push(t.describe());
return e;
}
toArray() {
return Array.from(this.list).concat(Array.from(this.refs.values()));
}
add(e) {
Xe.isRef(e) ? this.refs.set(e.key, e) : this.list.add(e);
}
delete(e) {
Xe.isRef(e) ? this.refs.delete(e.key) : this.list.delete(e);
}
has(e, t) {
if (this.list.has(e))
return !0;
let n, s = this.refs.values();
for (; n = s.next(), !n.done; )
if (t(n.value) === e)
return !0;
return !1;
}
clone() {
const e = new Lr();
return e.list = new Set(this.list), e.refs = new Map(this.refs), e;
}
merge(e, t) {
const n = this.clone();
return e.list.forEach((s) => n.add(s)), e.refs.forEach((s) => n.add(s)), t.list.forEach((s) => n.delete(s)), t.refs.forEach((s) => n.delete(s)), n;
}
}
function Ne() {
return Ne = Object.assign || function(r) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e];
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) && (r[n] = t[n]);
}
return r;
}, Ne.apply(this, arguments);
}
class ce {
constructor(e) {
this.deps = [], this.conditions = [], this._whitelist = new Lr(), this._blacklist = new Lr(), this.exclusiveTests = /* @__PURE__ */ Object.create(null), this.tests = [], this.transforms = [], this.withMutation(() => {
this.typeError(ot.notType);
}), this.type = (e == null ? void 0 : e.type) || "mixed", this.spec = Ne({
strip: !1,
strict: !1,
abortEarly: !0,
recursive: !0,
nullable: !1,
presence: "optional"
}, e == null ? void 0 : e.spec);
}
// TODO: remove
get _type() {
return this.type;
}
_typeCheck(e) {
return !0;
}
clone(e) {
if (this._mutate)
return e && Object.assign(this.spec, e), this;
const t = Object.create(Object.getPrototypeOf(this));
return t.type = this.type, t._typeError = this._typeError, t._whitelistError = this._whitelistError, t._blacklistError = this._blacklistError, t._whitelist = this._whitelist.clone(), t._blacklist = this._blacklist.clone(), t.exclusiveTests = Ne({}, this.exclusiveTests), t.deps = [...this.deps], t.conditions = [...this.conditions], t.tests = [...this.tests], t.transforms = [...this.transforms], t.spec = mn(Ne({}, this.spec, e)), t;
}
label(e) {
var t = this.clone();
return t.spec.label = e, t;
}
meta(...e) {
if (e.length === 0)
return this.spec.meta;
let t = this.clone();
return t.spec.meta = Object.assign(t.spec.meta || {}, e[0]), t;
}
// withContext<TContext extends AnyObject>(): BaseSchema<
// TCast,
// TContext,
// TOutput
// > {
// return this as any;
// }
withMutation(e) {
let t = this._mutate;
this._mutate = !0;
let n = e(this);
return this._mutate = t, n;
}
concat(e) {
if (!e || e === this)
return this;
if (e.type !== this.type && this.type !== "mixed")
throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);
let t = this, n = e.clone();
const s = Ne({}, t.spec, n.spec);
return n.spec = s, n._typeError || (n._typeError = t._typeError), n._whitelistError || (n._whitelistError = t._whitelistError), n._blacklistError || (n._blacklistError = t._blacklistError), n._whitelist = t._whitelist.merge(e._whitelist, e._blacklist), n._blacklist = t._blacklist.merge(e._blacklist, e._whitelist), n.tests = t.tests, n.exclusiveTests = t.exclusiveTests, n.withMutation((i) => {
e.tests.forEach((a) => {
i.test(a.OPTIONS);
});
}), n;
}
isType(e) {
return this.spec.nullable && e === null ? !0 : this._typeCheck(e);
}
resolve(e) {
let t = this;
if (t.conditions.length) {
let n = t.conditions;
t = t.clone(), t.conditions = [], t = n.reduce((s, i) => i.resolve(s, e), t), t = t.resolve(e);
}
return t;
}
/**
*
* @param {*} value
* @param {Object} options
* @param {*=} options.parent
* @param {*=} options.context
*/
cast(e, t = {}) {
let n = this.resolve(Ne({
value: e
}, t)), s = n._cast(e, t);
if (e !== void 0 && t.assert !== !1 && n.isType(s) !== !0) {
let i = Tt(e), a = Tt(s);
throw new TypeError(`The value of ${t.path || "field"} could not be cast to a value that satisfies the schema type: "${n._type}".
attempted value: ${i}
` + (a !== i ? `result of cast: ${a}` : ""));
}
return s;
}
_cast(e, t) {
let n = e === void 0 ? e : this.transforms.reduce((s, i) => i.call(this, s, e, this), e);
return n === void 0 && (n = this.getDefault()), n;
}
_validate(e, t = {}, n) {
let {
sync: s,
path: i,
from: a = [],
originalValue: l = e,
strict: o = this.spec.strict,
abortEarly: f = this.spec.abortEarly
} = t, u = e;
o || (u = this._cast(u, Ne({
assert: !1
}, t)));
let d = {
value: u,
path: i,
options: t,
originalValue: l,
schema: this,
label: this.spec.label,
sync: s,
from: a
}, h = [];
this._typeError && h.push(this._typeError), this._whitelistError && h.push(this._whitelistError), this._blacklistError && h.push(this._blacklistError), Nr({
args: d,
value: u,
path: i,
sync: s,
tests: h,
endEarly: f
}, (c) => {
if (c)
return void n(c, u);
Nr({
tests: this.tests,
args: d,
path: i,
sync: s,
value: u,
endEarly: f
}, n);
});
}
validate(e, t, n) {
let s = this.resolve(Ne({}, t, {
value: e
}));
return typeof n == "function" ? s._validate(e, t, n) : new Promise((i, a) => s._validate(e, t, (l, o) => {
l ? a(l) : i(o);
}));
}
validateSync(e, t) {
let n = this.resolve(Ne({}, t, {
value: e
})), s;
return n._validate(e, Ne({}, t, {
sync: !0
}), (i, a) => {
if (i)
throw i;
s = a;
}), s;
}
isValid(e, t) {
return this.validate(e, t).then(() => !0, (n) => {
if (be.isError(n))
return !1;
throw n;
});
}
isValidSync(e, t) {
try {
return this.validateSync(e, t), !0;
} catch (n) {
if (be.isError(n))
return !1;
throw n;
}
}
_getDefault() {
let e = this.spec.default;
return e == null ? e : typeof e == "function" ? e.call(this) : mn(e);
}
getDefault(e) {
return this.resolve(e || {})._getDefault();
}
default(e) {
return arguments.length === 0 ? this._getDefault() : this.clone({
default: e
});
}
strict(e = !0) {
var t = this.clone();
return t.spec.strict = e, t;
}
_isPresent(e) {
return e != null;
}
defined(e = ot.defined) {
return this.test({
message: e,
name: "defined",
exclusive: !0,
test(t) {
return t !== void 0;
}
});
}
required(e = ot.required) {
return this.clone({
presence: "required"
}).withMutation((t) => t.test({
message: e,
name: "required",
exclusive: !0,
test(n) {
return this.schema._isPresent(n);
}
}));
}
notRequired() {
var e = this.clone({
presence: "optional"
});
return e.tests = e.tests.filter((t) => t.OPTIONS.name !== "required"), e;
}
nullable(e = !0) {
var t = this.clone({
nullable: e !== !1
});
return t;
}
transform(e) {
var t = this.clone();
return t.transforms.push(e), t;
}
/**
* Adds a test function to the schema's queue of tests.
* tests can be exclusive or non-exclusive.
*
* - exclusive tests, will replace any existing tests of the same name.
* - non-exclusive: can be stacked
*
* If a non-exclusive test is added to a schema with an exclusive test of the same name
* the exclusive test is removed and further tests of the same name will be stacked.
*
* If an exclusive test is added to a schema with non-exclusive tests of the same name
* the previous tests are removed and further tests of the same name will replace each other.
*/
test(...e) {
let t;
if (e.length === 1 ? typeof e[0] == "function" ? t = {
test: e[0]
} : t = e[0] : e.length === 2 ? t = {
name: e[0],
test: e[1]
} : t = {
name: e[0],
message: e[1],
test: e[2]
}, t.message === void 0 && (t.message = ot.default), typeof t.test != "function")
throw new TypeError("`test` is a required parameters");
let n = this.clone(), s = mr(t), i = t.exclusive || t.name && n.exclusiveTests[t.name] === !0;
if (t.exclusive && !t.name)
throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");
return t.name && (n.exclusiveTests[t.name] = !!t.exclusive), n.tests = n.tests.filter((a) => !(a.OPTIONS.name === t.name && (i || a.OPTIONS.test === s.OPTIONS.test))), n.tests.push(s), n;
}
when(e, t) {
!Array.isArray(e) && typeof e != "string" && (t = e, e = ".");
let n = this.clone(), s = la(e).map((i) => new Xe(i));
return s.forEach((i) => {
i.isSibling && n.deps.push(i.key);
}), n.conditions.push(new wu(s, t)), n;
}
typeError(e) {
var t = this.clone();
return t._typeError = mr({
message: e,
name: "typeError",
test(n) {
return n !== void 0 && !this.schema.isType(n) ? this.createError({
params: {
type: this.schema._type
}
}) : !0;
}
}), t;
}
oneOf(e, t = ot.oneOf) {
var n = this.clone();
return e.forEach((s) => {
n._whitelist.add(s), n._blacklist.delete(s);
}), n._whitelistError = mr({
message: t,
name: "oneOf",
test(s) {
if (s === void 0)
return !0;
let i = this.schema._whitelist;
return i.has(s, this.resolve) ? !0 : this.createError({
params: {
values: i.toArray().join(", ")
}
});
}
}), n;
}
notOneOf(e, t = ot.notOneOf) {
var n = this.clone();
return e.forEach((s) => {
n._blacklist.add(s), n._whitelist.delete(s);
}), n._blacklistError = mr({
message: t,
name: "notOneOf",
test(s) {
let i = this.schema._blacklist;
return i.has(s, this.resolve) ? this.createError({
params: {
values: i.toArray().join(", ")
}
}) : !0;
}
}), n;
}
strip(e = !0) {
let t = this.clone();
return t.spec.strip = e, t;
}
describe() {
const e = this.clone(), {
label: t,
meta: n
} = e.spec;
return {
meta: n,
label: t,
type: e.type,
oneOf: e._whitelist.describe(),
notOneOf: e._blacklist.describe(),
tests: e.tests.map((i) => ({
name: i.OPTIONS.name,
params: i.OPTIONS.params
})).filter((i, a, l) => l.findIndex((o) => o.name === i.name) === a)
};
}
}
ce.prototype.__isYupSchema__ = !0;
for (const r of ["validate", "validateSync"])
ce.prototype[`${r}At`] = function(e, t, n = {}) {
const {
parent: s,
parentPath: i,
schema: a
} = da(this, e, t, n.context);
return a[r](s && s[i], Ne({}, n, {
parent: s,
path: e
}));
};
for (const r of ["equals", "is"])
ce.prototype[r] = ce.prototype.oneOf;
for (const r of ["not", "nope"])
ce.prototype[r] = ce.prototype.notOneOf;
ce.prototype.optional = ce.prototype.notRequired;
const Rn = ce;
function ha() {
return new Rn();
}
ha.prototype = Rn.prototype;
const se = (r) => r == null;
function vn() {
return new zn();
}
class zn extends ce {
constructor() {
super({
type: "boolean"
}), this.withMutation(() => {
this.transform(function(e) {
if (!this.isType(e)) {
if (/^(true|1)$/i.test(String(e)))
return !0;
if (/^(false|0)$/i.test(String(e)))
return !1;
}
return e;
});
});
}
_typeCheck(e) {
return e instanceof Boolean && (e = e.valueOf()), typeof e == "boolean";
}
isTrue(e = gn.isValue) {
return this.test({
message: e,
name: "is-value",
exclusive: !0,
params: {
value: "true"
},
test(t) {
return se(t) || t === !0;
}
});
}
isFalse(e = gn.isValue) {
return this.test({
message: e,
name: "is-value",
exclusive: !0,
params: {
value: "false"
},
test(t) {
return se(t) || t === !1;
}
});
}
}
vn.prototype = zn.prototype;
let Gu = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i, Ju = /^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i, Ku = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i, Qu = (r) => se(r) || r === r.trim(), Xu = {}.toString();
function ma() {
return new qn();
}
class qn extends ce {
constructor() {
super({
type: "string"
}), this.withMutation(() => {
this.transform(function(e) {
if (this.isType(e) || Array.isArray(e))
return e;
const t = e != null && e.toString ? e.toString() : e;
return t === Xu ? e : t;
});
});
}
_typeCheck(e) {
return e instanceof String && (e = e.valueOf()), typeof e == "string";
}
_isPresent(e) {
return super._isPresent(e) && !!e.length;
}
length(e, t = We.length) {
return this.test({
message: t,
name: "length",
exclusive: !0,
params: {
length: e
},
test(n) {
return se(n) || n.length === this.resolve(e);
}
});
}
min(e, t = We.min) {
return this.test({
message: t,
name: "min",
exclusive: !0,
params: {
min: e
},
test(n) {
return se(n) || n.length >= this.resolve(e);
}
});
}
max(e, t = We.max) {
return this.test({
name: "max",
exclusive: !0,
message: t,
params: {
max: e
},
test(n) {
return se(n) || n.length <= this.resolve(e);
}
});
}
matches(e, t) {
let n = !1, s, i;
return t && (typeof t == "object" ? {
excludeEmptyString: n = !1,
message: s,
name: i
} = t : s = t), this.test({
name: i || "matches",
message: s || We.matches,
params: {
regex: e
},
test: (a) => se(a) || a === "" && n || a.search(e) !== -1
});
}
email(e = We.email) {
return this.matches(Gu, {
name: "email",
message: e,
excludeEmptyString: !0
});
}
url(e = We.url) {
return this.matches(Ju, {
name: "url",
message: e,
excludeEmptyString: !0
});
}
uuid(e = We.uuid) {
return this.matches(Ku, {
name: "uuid",
message: e,
excludeEmptyString: !1
});
}
//-- transforms --
ensure() {
return this.default("").transform((e) => e === null ? "" : e);
}
trim(e = We.trim) {
return this.transform((t) => t != null ? t.trim() : t).test({
message: e,
name: "trim",
test: Qu
});
}
lowercase(e = We.lowercase) {
return this.transform((t) => se(t) ? t : t.toLowerCase()).test({
message: e,
name: "string_case",
exclusive: !0,
test: (t) => se(t) || t === t.toLowerCase()
});
}
uppercase(e = We.uppercase) {
return this.transform((t) => se(t) ? t : t.toUpperCase()).test({
message: e,
name: "string_case",
exclusive: !0,
test: (t) => se(t) || t === t.toUpperCase()
});
}
}
ma.prototype = qn.prototype;
let ef = (r) => r != +r;
function pa() {
return new jn();
}
class jn extends ce {
constructor() {
super({
type: "number"
}), this.withMutation(() => {
this.transform(function(e) {
let t = e;
if (typeof t == "string") {
if (t = t.replace(/\s/g, ""), t === "")
return NaN;
t = +t;
}
return this.isType(t) ? t : parseFloat(t);
});
});
}
_typeCheck(e) {
return e instanceof Number && (e = e.valueOf()), typeof e == "number" && !ef(e);
}
min(e, t = Ge.min) {
return this.test({
message: t,
name: "min",
exclusive: !0,
params: {
min: e
},
test(n) {
return se(n) || n >= this.resolve(e);
}
});
}
max(e, t = Ge.max) {
return this.test({
message: t,
name: "max",
exclusive: !0,
params: {
max: e
},
test(n) {
return se(n) || n <= this.resolve(e);
}
});
}
lessThan(e, t = Ge.lessThan) {
return this.test({
message: t,
name: "max",
exclusive: !0,
params: {
less: e
},
test(n) {
return se(n) || n < this.resolve(e);
}
});
}
moreThan(e, t = Ge.moreThan) {
return this.test({
message: t,
name: "min",
exclusive: !0,
params: {
more: e
},
test(n) {
return se(n) || n > this.resolve(e);
}
});
}
positive(e = Ge.positive) {
return this.moreThan(0, e);
}
negative(e = Ge.negative) {
return this.lessThan(0, e);
}
integer(e = Ge.integer) {
return this.test({
name: "integer",
message: e,
test: (t) => se(t) || Number.isInteger(t)
});
}
truncate() {
return this.transform((e) => se(e) ? e : e | 0);
}
round(e) {
var t, n = ["ceil", "floor", "round", "trunc"];
if (e = ((t = e) == null ? void 0 : t.toLowerCase()) || "round", e === "trunc")
return this.truncate();
if (n.indexOf(e.toLowerCase()) === -1)
throw new TypeError("Only valid options for round() are: " + n.join(", "));
return this.transform((s) => se(s) ? s : Math[e](s));
}
}
pa.prototype = jn.prototype;
var tf = /^(\d{4}|[+\-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;
function rf(r) {
var e = [1, 4, 5, 6, 7, 10, 11], t = 0, n, s;
if (s = tf.exec(r)) {
for (var i = 0, a; a = e[i]; ++i)
s[a] = +s[a] || 0;
s[2] = (+s[2] || 1) - 1, s[3] = +s[3] || 1, s[7] = s[7] ? String(s[7]).substr(0, 3) : 0, (s[8] === void 0 || s[8] === "") && (s[9] === void 0 || s[9] === "") ? n = +new Date(s[1], s[2], s[3], s[4], s[5], s[6], s[7]) : (s[8] !== "Z" && s[9] !== void 0 && (t = s[10] * 60 + s[11], s[9] === "+" && (t = 0 - t)), n = Date.UTC(s[1], s[2], s[3], s[4], s[5] + t, s[6], s[7]));
} else
n = Date.parse ? Date.parse(r) : NaN;
return n;
}
let $n = /* @__PURE__ */ new Date(""), nf = (r) => Object.prototype.toString.call(r) === "[object Date]";
function Zn() {
return new qr();
}
class qr extends ce {
constructor() {
super({
type: "date"
}), this.withMutation(() => {
this.transform(function(e) {
return this.isType(e) ? e : (e = rf(e), isNaN(e) ? $n : new Date(e));
});
});
}
_typeCheck(e) {
return nf(e) && !isNaN(e.getTime());
}
prepareParam(e, t) {
let n;
if (Xe.isRef(e))
n = e;
else {
let s = this.cast(e);
if (!this._typeCheck(s))
throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);
n = s;
}
return n;
}
min(e, t = pn.min) {
let n = this.prepareParam(e, "min");
return this.test({
message: t,
name: "min",
exclusive: !0,
params: {
min: e
},
test(s) {
return se(s) || s >= this.resolve(n);
}
});
}
max(e, t = pn.max) {
var n = this.prepareParam(e, "max");
return this.test({
message: t,
name: "max",
exclusive: !0,
params: {
max: e
},
test(s) {
return se(s) || s <= this.resolve(n);
}
});
}
}
qr.INVALID_DATE = $n;
Zn.prototype = qr.prototype;
Zn.INVALID_DATE = $n;
function sf(r, e, t, n) {
var s = -1, i = r == null ? 0 : r.length;
for (n && i && (t = r[++s]); ++s < i; )
t = e(t, r[s], s, r);
return t;
}
var af = sf;
function of(r) {
return function(e) {
return r == null ? void 0 : r[e];
};
}
var lf = of, uf = lf, ff = {
// Latin-1 Supplement block.
À: "A",
Á: "A",
Â: "A",
Ã: "A",
Ä: "A",
Å: "A",
à: "a",
á: "a",
â: "a",
ã: "a",
ä: "a",
å: "a",
Ç: "C",
ç: "c",
Ð: "D",
ð: "d",
È: "E",
É: "E",
Ê: "E",
Ë: "E",
è: "e",
é: "e",
ê: "e",
ë: "e",
Ì: "I",
Í: "I",
Î: "I",
Ï: "I",
ì: "i",
í: "i",
î: "i",
ï: "i",
Ñ: "N",
ñ: "n",
Ò: "O",
Ó: "O",