var e = Object.create,
t = Object.defineProperty,
n = Object.getOwnPropertyDescriptor,
r = Object.getOwnPropertyNames,
i = Object.getPrototypeOf,
a = Object.prototype.hasOwnProperty,
o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), (e = null)), t.exports),
s = (e, i, o, s) => {
if ((i && typeof i == `object`) || typeof i == `function`)
for (var c = r(i), l = 0, u = c.length, d; l < u; l++)
((d = c[l]),
!a.call(e, d) &&
d !== o &&
t(e, d, {
get: ((e) => i[e]).bind(null, d),
enumerable: !(s = n(i, d)) || s.enumerable,
}));
return e;
},
c = (n, r, a) => (
(a = n == null ? {} : e(i(n))),
s(r || !n || !n.__esModule ? t(a, `default`, { value: n, enumerable: !0 }) : a, n)
),
l = o((e, t) => {
t.exports = Array.isArray;
}),
u = o((e, t) => {
t.exports = typeof global == `object` && global && global.Object === Object && global;
}),
d = o((e, t) => {
var n = u(),
r = typeof self == `object` && self && self.Object === Object && self;
t.exports = n || r || Function(`return this`)();
}),
ee = o((e, t) => {
t.exports = d().Symbol;
}),
te = o((e, t) => {
var n = ee(),
r = Object.prototype,
i = r.hasOwnProperty,
a = r.toString,
o = n ? n.toStringTag : void 0;
function s(e) {
var t = i.call(e, o),
n = e[o];
try {
e[o] = void 0;
var r = !0;
} catch {}
var s = a.call(e);
return (r && (t ? (e[o] = n) : delete e[o]), s);
}
t.exports = s;
}),
f = o((e, t) => {
var n = Object.prototype.toString;
function r(e) {
return n.call(e);
}
t.exports = r;
}),
p = o((e, t) => {
var n = ee(),
r = te(),
i = f(),
a = `[object Null]`,
o = `[object Undefined]`,
s = n ? n.toStringTag : void 0;
function c(e) {
return e == null ? (e === void 0 ? o : a) : s && s in Object(e) ? r(e) : i(e);
}
t.exports = c;
}),
ne = o((e, t) => {
function n(e) {
return typeof e == `object` && !!e;
}
t.exports = n;
}),
m = o((e, t) => {
var n = p(),
r = ne(),
i = `[object Symbol]`;
function a(e) {
return typeof e == `symbol` || (r(e) && n(e) == i);
}
t.exports = a;
}),
h = o((e, t) => {
var n = l(),
r = m(),
i = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
a = /^\w*$/;
function o(e, t) {
if (n(e)) return !1;
var o = typeof e;
return o == `number` || o == `symbol` || o == `boolean` || e == null || r(e)
? !0
: a.test(e) || !i.test(e) || (t != null && e in Object(t));
}
t.exports = o;
}),
re = o((e, t) => {
function n(e) {
var t = typeof e;
return e != null && (t == `object` || t == `function`);
}
t.exports = n;
}),
ie = o((e, t) => {
var n = p(),
r = re(),
i = `[object AsyncFunction]`,
a = `[object Function]`,
o = `[object GeneratorFunction]`,
s = `[object Proxy]`;
function c(e) {
if (!r(e)) return !1;
var t = n(e);
return t == a || t == o || t == i || t == s;
}
t.exports = c;
}),
ae = o((e, t) => {
t.exports = d()[`__core-js_shared__`];
}),
oe = o((e, t) => {
var n = ae(),
r = (function () {
var e = /[^.]+$/.exec((n && n.keys && n.keys.IE_PROTO) || ``);
return e ? `Symbol(src)_1.` + e : ``;
})();
function i(e) {
return !!r && r in e;
}
t.exports = i;
}),
se = o((e, t) => {
var n = Function.prototype.toString;
function r(e) {
if (e != null) {
try {
return n.call(e);
} catch {}
try {
return e + ``;
} catch {}
}
return ``;
}
t.exports = r;
}),
ce = o((e, t) => {
var n = ie(),
r = oe(),
i = re(),
a = se(),
o = /[\\^$.*+?()[\]{}|]/g,
s = /^\[object .+?Constructor\]$/,
c = Function.prototype,
l = Object.prototype,
u = c.toString,
d = l.hasOwnProperty,
ee = RegExp(
`^` +
u
.call(d)
.replace(o, `\\$&`)
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, `$1.*?`) +
`$`,
);
function te(e) {
return !i(e) || r(e) ? !1 : (n(e) ? ee : s).test(a(e));
}
t.exports = te;
}),
le = o((e, t) => {
function n(e, t) {
return e?.[t];
}
t.exports = n;
}),
ue = o((e, t) => {
var n = ce(),
r = le();
function i(e, t) {
var i = r(e, t);
return n(i) ? i : void 0;
}
t.exports = i;
}),
de = o((e, t) => {
t.exports = ue()(Object, `create`);
}),
fe = o((e, t) => {
var n = de();
function r() {
((this.__data__ = n ? n(null) : {}), (this.size = 0));
}
t.exports = r;
}),
pe = o((e, t) => {
function n(e) {
var t = this.has(e) && delete this.__data__[e];
return ((this.size -= +!!t), t);
}
t.exports = n;
}),
me = o((e, t) => {
var n = de(),
r = `__lodash_hash_undefined__`,
i = Object.prototype.hasOwnProperty;
function a(e) {
var t = this.__data__;
if (n) {
var a = t[e];
return a === r ? void 0 : a;
}
return i.call(t, e) ? t[e] : void 0;
}
t.exports = a;
}),
he = o((e, t) => {
var n = de(),
r = Object.prototype.hasOwnProperty;
function i(e) {
var t = this.__data__;
return n ? t[e] !== void 0 : r.call(t, e);
}
t.exports = i;
}),
ge = o((e, t) => {
var n = de(),
r = `__lodash_hash_undefined__`;
function i(e, t) {
var i = this.__data__;
return ((this.size += +!this.has(e)), (i[e] = n && t === void 0 ? r : t), this);
}
t.exports = i;
}),
_e = o((e, t) => {
var n = fe(),
r = pe(),
i = me(),
a = he(),
o = ge();
function s(e) {
var t = -1,
n = e == null ? 0 : e.length;
for (this.clear(); ++t < n;) {
var r = e[t];
this.set(r[0], r[1]);
}
}
((s.prototype.clear = n),
(s.prototype.delete = r),
(s.prototype.get = i),
(s.prototype.has = a),
(s.prototype.set = o),
(t.exports = s));
}),
ve = o((e, t) => {
function n() {
((this.__data__ = []), (this.size = 0));
}
t.exports = n;
}),
ye = o((e, t) => {
function n(e, t) {
return e === t || (e !== e && t !== t);
}
t.exports = n;
}),
be = o((e, t) => {
var n = ye();
function r(e, t) {
for (var r = e.length; r--;) if (n(e[r][0], t)) return r;
return -1;
}
t.exports = r;
}),
xe = o((e, t) => {
var n = be(),
r = Array.prototype.splice;
function i(e) {
var t = this.__data__,
i = n(t, e);
return i < 0 ? !1 : (i == t.length - 1 ? t.pop() : r.call(t, i, 1), --this.size, !0);
}
t.exports = i;
}),
Se = o((e, t) => {
var n = be();
function r(e) {
var t = this.__data__,
r = n(t, e);
return r < 0 ? void 0 : t[r][1];
}
t.exports = r;
}),
Ce = o((e, t) => {
var n = be();
function r(e) {
return n(this.__data__, e) > -1;
}
t.exports = r;
}),
we = o((e, t) => {
var n = be();
function r(e, t) {
var r = this.__data__,
i = n(r, e);
return (i < 0 ? (++this.size, r.push([e, t])) : (r[i][1] = t), this);
}
t.exports = r;
}),
Te = o((e, t) => {
var n = ve(),
r = xe(),
i = Se(),
a = Ce(),
o = we();
function s(e) {
var t = -1,
n = e == null ? 0 : e.length;
for (this.clear(); ++t < n;) {
var r = e[t];
this.set(r[0], r[1]);
}
}
((s.prototype.clear = n),
(s.prototype.delete = r),
(s.prototype.get = i),
(s.prototype.has = a),
(s.prototype.set = o),
(t.exports = s));
}),
Ee = o((e, t) => {
t.exports = ue()(d(), `Map`);
}),
De = o((e, t) => {
var n = _e(),
r = Te(),
i = Ee();
function a() {
((this.size = 0), (this.__data__ = { hash: new n(), map: new (i || r)(), string: new n() }));
}
t.exports = a;
}),
Oe = o((e, t) => {
function n(e) {
var t = typeof e;
return t == `string` || t == `number` || t == `symbol` || t == `boolean`
? e !== `__proto__`
: e === null;
}
t.exports = n;
}),
ke = o((e, t) => {
var n = Oe();
function r(e, t) {
var r = e.__data__;
return n(t) ? r[typeof t == `string` ? `string` : `hash`] : r.map;
}
t.exports = r;
}),
Ae = o((e, t) => {
var n = ke();
function r(e) {
var t = n(this, e).delete(e);
return ((this.size -= +!!t), t);
}
t.exports = r;
}),
je = o((e, t) => {
var n = ke();
function r(e) {
return n(this, e).get(e);
}
t.exports = r;
}),
Me = o((e, t) => {
var n = ke();
function r(e) {
return n(this, e).has(e);
}
t.exports = r;
}),
Ne = o((e, t) => {
var n = ke();
function r(e, t) {
var r = n(this, e),
i = r.size;
return (r.set(e, t), (this.size += r.size == i ? 0 : 1), this);
}
t.exports = r;
}),
Pe = o((e, t) => {
var n = De(),
r = Ae(),
i = je(),
a = Me(),
o = Ne();
function s(e) {
var t = -1,
n = e == null ? 0 : e.length;
for (this.clear(); ++t < n;) {
var r = e[t];
this.set(r[0], r[1]);
}
}
((s.prototype.clear = n),
(s.prototype.delete = r),
(s.prototype.get = i),
(s.prototype.has = a),
(s.prototype.set = o),
(t.exports = s));
}),
Fe = o((e, t) => {
var n = Pe(),
r = `Expected a function`;
function i(e, t) {
if (typeof e != `function` || (t != null && typeof t != `function`)) throw TypeError(r);
var a = function () {
var n = arguments,
r = t ? t.apply(this, n) : n[0],
i = a.cache;
if (i.has(r)) return i.get(r);
var o = e.apply(this, n);
return ((a.cache = i.set(r, o) || i), o);
};
return ((a.cache = new (i.Cache || n)()), a);
}
((i.Cache = n), (t.exports = i));
}),
Ie = o((e, t) => {
var n = Fe(),
r = 500;
function i(e) {
var t = n(e, function (e) {
return (i.size === r && i.clear(), e);
}),
i = t.cache;
return t;
}
t.exports = i;
}),
Le = o((e, t) => {
var n = Ie(),
r =
/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,
i = /\\(\\)?/g;
t.exports = n(function (e) {
var t = [];
return (
e.charCodeAt(0) === 46 && t.push(``),
e.replace(r, function (e, n, r, a) {
t.push(r ? a.replace(i, `$1`) : n || e);
}),
t
);
});
}),
Re = o((e, t) => {
function n(e, t) {
for (var n = -1, r = e == null ? 0 : e.length, i = Array(r); ++n < r;) i[n] = t(e[n], n, e);
return i;
}
t.exports = n;
}),
ze = o((e, t) => {
var n = ee(),
r = Re(),
i = l(),
a = m(),
o = 1 / 0,
s = n ? n.prototype : void 0,
c = s ? s.toString : void 0;
function u(e) {
if (typeof e == `string`) return e;
if (i(e)) return r(e, u) + ``;
if (a(e)) return c ? c.call(e) : ``;
var t = e + ``;
return t == `0` && 1 / e == -o ? `-0` : t;
}
t.exports = u;
}),
Be = o((e, t) => {
var n = ze();
function r(e) {
return e == null ? `` : n(e);
}
t.exports = r;
}),
Ve = o((e, t) => {
var n = l(),
r = h(),
i = Le(),
a = Be();
function o(e, t) {
return n(e) ? e : r(e, t) ? [e] : i(a(e));
}
t.exports = o;
}),
He = o((e, t) => {
var n = m(),
r = 1 / 0;
function i(e) {
if (typeof e == `string` || n(e)) return e;
var t = e + ``;
return t == `0` && 1 / e == -r ? `-0` : t;
}
t.exports = i;
}),
Ue = o((e, t) => {
var n = Ve(),
r = He();
function i(e, t) {
t = n(t, e);
for (var i = 0, a = t.length; e != null && i < a;) e = e[r(t[i++])];
return i && i == a ? e : void 0;
}
t.exports = i;
}),
We = o((e, t) => {
var n = Ue();
function r(e, t, r) {
var i = e == null ? void 0 : n(e, t);
return i === void 0 ? r : i;
}
t.exports = r;
}),
Ge = o((e, t) => {
t.exports = function e(t, n) {
if (t === n) return !0;
if (t && n && typeof t == `object` && typeof n == `object`) {
if (t.constructor !== n.constructor) return !1;
var r, i, a;
if (Array.isArray(t)) {
if (((r = t.length), r != n.length)) return !1;
for (i = r; i-- !== 0;) if (!e(t[i], n[i])) return !1;
return !0;
}
if (t instanceof Map && n instanceof Map) {
if (t.size !== n.size) return !1;
for (i of t.entries()) if (!n.has(i[0])) return !1;
for (i of t.entries()) if (!e(i[1], n.get(i[0]))) return !1;
return !0;
}
if (t instanceof Set && n instanceof Set) {
if (t.size !== n.size) return !1;
for (i of t.entries()) if (!n.has(i[0])) return !1;
return !0;
}
if (ArrayBuffer.isView(t) && ArrayBuffer.isView(n)) {
if (((r = t.length), r != n.length)) return !1;
for (i = r; i-- !== 0;) if (t[i] !== n[i]) return !1;
return !0;
}
if (t.constructor === RegExp) return t.source === n.source && t.flags === n.flags;
if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === n.valueOf();
if (t.toString !== Object.prototype.toString) return t.toString() === n.toString();
if (((a = Object.keys(t)), (r = a.length), r !== Object.keys(n).length)) return !1;
for (i = r; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(n, a[i])) return !1;
for (i = r; i-- !== 0;) {
var o = a[i];
if (!e(t[o], n[o])) return !1;
}
return !0;
}
return t !== t && n !== n;
};
}),
Ke = o((e, t) => {
function n(e) {
return (this.__data__.set(e, `__lodash_hash_undefined__`), this);
}
t.exports = n;
}),
qe = o((e, t) => {
function n(e) {
return this.__data__.has(e);
}
t.exports = n;
}),
Je = o((e, t) => {
var n = Pe(),
r = Ke(),
i = qe();
function a(e) {
var t = -1,
r = e == null ? 0 : e.length;
for (this.__data__ = new n(); ++t < r;) this.add(e[t]);
}
((a.prototype.add = a.prototype.push = r), (a.prototype.has = i), (t.exports = a));
}),
Ye = o((e, t) => {
function n(e, t, n, r) {
for (var i = e.length, a = n + (r ? 1 : -1); r ? a-- : ++a < i;) if (t(e[a], a, e)) return a;
return -1;
}
t.exports = n;
}),
Xe = o((e, t) => {
function n(e) {
return e !== e;
}
t.exports = n;
}),
Ze = o((e, t) => {
function n(e, t, n) {
for (var r = n - 1, i = e.length; ++r < i;) if (e[r] === t) return r;
return -1;
}
t.exports = n;
}),
Qe = o((e, t) => {
var n = Ye(),
r = Xe(),
i = Ze();
function a(e, t, a) {
return t === t ? i(e, t, a) : n(e, r, a);
}
t.exports = a;
}),
$e = o((e, t) => {
var n = Qe();
function r(e, t) {
return !!(e != null && e.length) && n(e, t, 0) > -1;
}
t.exports = r;
}),
et = o((e, t) => {
function n(e, t, n) {
for (var r = -1, i = e == null ? 0 : e.length; ++r < i;) if (n(t, e[r])) return !0;
return !1;
}
t.exports = n;
}),
tt = o((e, t) => {
function n(e, t) {
return e.has(t);
}
t.exports = n;
}),
nt = o((e, t) => {
t.exports = ue()(d(), `Set`);
}),
rt = o((e, t) => {
function n() {}
t.exports = n;
}),
it = o((e, t) => {
function n(e) {
var t = -1,
n = Array(e.size);
return (
e.forEach(function (e) {
n[++t] = e;
}),
n
);
}
t.exports = n;
}),
at = o((e, t) => {
var n = nt(),
r = rt(),
i = it();
t.exports =
n && 1 / i(new n([, -0]))[1] == 1 / 0
? function (e) {
return new n(e);
}
: r;
}),
ot = o((e, t) => {
var n = Je(),
r = $e(),
i = et(),
a = tt(),
o = at(),
s = it(),
c = 200;
function l(e, t, l) {
var u = -1,
d = r,
ee = e.length,
te = !0,
f = [],
p = f;
if (l) ((te = !1), (d = i));
else if (ee >= c) {
var ne = t ? null : o(e);
if (ne) return s(ne);
((te = !1), (d = a), (p = new n()));
} else p = t ? [] : f;
outer: for (; ++u < ee;) {
var m = e[u],
h = t ? t(m) : m;
if (((m = l || m !== 0 ? m : 0), te && h === h)) {
for (var re = p.length; re--;) if (p[re] === h) continue outer;
(t && p.push(h), f.push(m));
} else d(p, h, l) || (p !== f && p.push(h), f.push(m));
}
return f;
}
t.exports = l;
}),
st = o((e, t) => {
var n = ot();
function r(e, t) {
return ((t = typeof t == `function` ? t : void 0), e && e.length ? n(e, void 0, t) : []);
}
t.exports = r;
}),
ct = c(We(), 1),
lt = c(Ge(), 1),
ut = c(st(), 1),
dt = Object.defineProperty,
g = (e, t) => dt(e, `name`, { value: t, configurable: !0 }),
ft,
_,
v,
pt = typeof globalThis < `u` ? globalThis : typeof self < `u` ? self : globalThis,
y = (ft = {});
function mt() {
throw Error(`setTimeout has not been defined`);
}
g(mt, `i`);
function ht() {
throw Error(`clearTimeout has not been defined`);
}
g(ht, `u`);
function gt(e) {
if (_ === setTimeout) return setTimeout(e, 0);
if ((_ === mt || !_) && setTimeout) return ((_ = setTimeout), setTimeout(e, 0));
try {
return _(e, 0);
} catch {
try {
return _.call(null, e, 0);
} catch {
return _.call(this || pt, e, 0);
}
}
}
(g(gt, `c`),
(function () {
try {
_ = typeof setTimeout == `function` ? setTimeout : mt;
} catch {
_ = mt;
}
try {
v = typeof clearTimeout == `function` ? clearTimeout : ht;
} catch {
v = ht;
}
})());
var b,
x = [],
_t = !1,
vt = -1;
function yt() {
_t && b && ((_t = !1), b.length ? (x = b.concat(x)) : (vt = -1), x.length && bt());
}
g(yt, `h`);
function bt() {
if (!_t) {
var e = gt(yt);
_t = !0;
for (var t = x.length; t;) {
for (b = x, x = []; ++vt < t;) b && b[vt].run();
((vt = -1), (t = x.length));
}
((b = null),
(_t = !1),
(function (e) {
if (v === clearTimeout) return clearTimeout(e);
if ((v === ht || !v) && clearTimeout) return ((v = clearTimeout), clearTimeout(e));
try {
v(e);
} catch {
try {
return v.call(null, e);
} catch {
return v.call(this || pt, e);
}
}
})(e));
}
}
g(bt, `d`);
function xt(e, t) {
(((this || pt).fun = e), ((this || pt).array = t));
}
g(xt, `m`);
function S() {}
(g(S, `p`),
(y.nextTick = function (e) {
var t = Array(arguments.length - 1);
if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
(x.push(new xt(e, t)), x.length !== 1 || _t || gt(bt));
}),
(xt.prototype.run = function () {
(this || pt).fun.apply(null, (this || pt).array);
}),
(y.title = `browser`),
(y.browser = !0),
(y.env = {}),
(y.argv = []),
(y.version = ``),
(y.versions = {}),
(y.on = S),
(y.addListener = S),
(y.once = S),
(y.off = S),
(y.removeListener = S),
(y.removeAllListeners = S),
(y.emit = S),
(y.prependListener = S),
(y.prependOnceListener = S),
(y.listeners = function (e) {
return [];
}),
(y.binding = function (e) {
throw Error(`process.binding is not supported`);
}),
(y.cwd = function () {
return `/`;
}),
(y.chdir = function (e) {
throw Error(`process.chdir is not supported`);
}),
(y.umask = function () {
return 0;
}));
var C = ft;
(C.addListener,
C.argv,
C.binding,
C.browser,
C.chdir,
C.cwd,
C.emit,
C.env,
C.listeners,
C.nextTick,
C.off,
C.on,
C.once,
C.prependListener,
C.prependOnceListener,
C.removeAllListeners,
C.removeListener,
C.title,
C.umask,
C.version,
C.versions);
var St = typeof Symbol == `function` && typeof Symbol.toStringTag == `symbol`,
Ct = Object.prototype.toString,
wt = g(function (e) {
return (
!(St && e && typeof e == `object` && Symbol.toStringTag in e) &&
Ct.call(e) === `[object Arguments]`
);
}, `o`),
Tt = g(function (e) {
return (
!!wt(e) ||
(typeof e == `object` &&
!!e &&
typeof e.length == `number` &&
e.length >= 0 &&
Ct.call(e) !== `[object Array]` &&
Ct.call(e.callee) === `[object Function]`)
);
}, `n`),
Et = (function () {
return wt(arguments);
})();
wt.isLegacyArguments = Tt;
var Dt = Et ? wt : Tt,
Ot = Object.prototype.toString,
kt = Function.prototype.toString,
At = /^\s*(?:function)?\*/,
jt = typeof Symbol == `function` && typeof Symbol.toStringTag == `symbol`,
Mt = Object.getPrototypeOf,
Nt = (function () {
if (!jt) return !1;
try {
return Function(`return function*() {}`)();
} catch {}
})(),
Pt = Nt ? Mt(Nt) : {},
Ft = g(function (e) {
return (
typeof e == `function` &&
(!!At.test(kt.call(e)) || (jt ? Mt(e) === Pt : Ot.call(e) === `[object GeneratorFunction]`))
);
}, `i`),
It =
typeof Object.create == `function`
? function (e, t) {
t &&
((e.super_ = t),
(e.prototype = Object.create(t.prototype, {
constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 },
})));
}
: function (e, t) {
if (t) {
e.super_ = t;
var n = g(function () {}, `o`);
((n.prototype = t.prototype), (e.prototype = new n()), (e.prototype.constructor = e));
}
},
Lt = g(function (e) {
return (
e &&
typeof e == `object` &&
typeof e.copy == `function` &&
typeof e.fill == `function` &&
typeof e.readUInt8 == `function`
);
}, `i$1`),
w = {},
Rt = Lt,
zt = Dt,
Bt = Ft;
function T(e) {
return e.call.bind(e);
}
g(T, `c$1`);
var Vt = typeof BigInt < `u`,
Ht = typeof Symbol < `u`,
E = Ht && Symbol.toStringTag !== void 0,
D = typeof Uint8Array < `u`,
Ut = typeof ArrayBuffer < `u`;
if (D && E)
var Wt = Object.getPrototypeOf(Uint8Array.prototype),
O = T(Object.getOwnPropertyDescriptor(Wt, Symbol.toStringTag).get);
var k = T(Object.prototype.toString),
Gt = T(Number.prototype.valueOf),
Kt = T(String.prototype.valueOf),
qt = T(Boolean.prototype.valueOf);
if (Vt) var Jt = T(BigInt.prototype.valueOf);
if (Ht) var Yt = T(Symbol.prototype.valueOf);
function Xt(e, t) {
if (typeof e != `object`) return !1;
try {
return (t(e), !0);
} catch {
return !1;
}
}
g(Xt, `O`);
function Zt(e) {
return D && E
? O(e) !== void 0
: Qt(e) ||
$t(e) ||
en(e) ||
tn(e) ||
nn(e) ||
rn(e) ||
an(e) ||
on(e) ||
sn(e) ||
cn(e) ||
ln(e);
}
g(Zt, `S`);
function Qt(e) {
return D && E
? O(e) === `Uint8Array`
: k(e) === `[object Uint8Array]` || (Rt(e) && e.buffer !== void 0);
}
g(Qt, `B`);
function $t(e) {
return D && E ? O(e) === `Uint8ClampedArray` : k(e) === `[object Uint8ClampedArray]`;
}
g($t, `k`);
function en(e) {
return D && E ? O(e) === `Uint16Array` : k(e) === `[object Uint16Array]`;
}
g(en, `E`);
function tn(e) {
return D && E ? O(e) === `Uint32Array` : k(e) === `[object Uint32Array]`;
}
g(tn, `D`);
function nn(e) {
return D && E ? O(e) === `Int8Array` : k(e) === `[object Int8Array]`;
}
g(nn, `U`);
function rn(e) {
return D && E ? O(e) === `Int16Array` : k(e) === `[object Int16Array]`;
}
g(rn, `P`);
function an(e) {
return D && E ? O(e) === `Int32Array` : k(e) === `[object Int32Array]`;
}
g(an, `x`);
function on(e) {
return D && E ? O(e) === `Float32Array` : k(e) === `[object Float32Array]`;
}
g(on, `I`);
function sn(e) {
return D && E ? O(e) === `Float64Array` : k(e) === `[object Float64Array]`;
}
g(sn, `M`);
function cn(e) {
return D && E ? O(e) === `BigInt64Array` : k(e) === `[object BigInt64Array]`;
}
g(cn, `z`);
function ln(e) {
return D && E ? O(e) === `BigUint64Array` : k(e) === `[object BigUint64Array]`;
}
g(ln, `F`);
function un(e) {
return k(e) === `[object Map]`;
}
g(un, `T`);
function dn(e) {
return k(e) === `[object Set]`;
}
g(dn, `N`);
function fn(e) {
return k(e) === `[object WeakMap]`;
}
g(fn, `W`);
function pn(e) {
return k(e) === `[object WeakSet]`;
}
g(pn, `$`);
function mn(e) {
return k(e) === `[object ArrayBuffer]`;
}
g(mn, `C`);
function hn(e) {
return typeof ArrayBuffer < `u` && (mn.working ? mn(e) : e instanceof ArrayBuffer);
}
g(hn, `V`);
function gn(e) {
return k(e) === `[object DataView]`;
}
g(gn, `G`);
function _n(e) {
return typeof DataView < `u` && (gn.working ? gn(e) : e instanceof DataView);
}
g(_n, `R`);
function vn(e) {
return k(e) === `[object SharedArrayBuffer]`;
}
g(vn, `J`);
function yn(e) {
return typeof SharedArrayBuffer < `u` && (vn.working ? vn(e) : e instanceof SharedArrayBuffer);
}
g(yn, `_`);
function bn(e) {
return Xt(e, Gt);
}
g(bn, `H`);
function xn(e) {
return Xt(e, Kt);
}
g(xn, `Z`);
function Sn(e) {
return Xt(e, qt);
}
g(Sn, `q`);
function Cn(e) {
return Vt && Xt(e, Jt);
}
g(Cn, `K`);
function wn(e) {
return Ht && Xt(e, Yt);
}
(g(wn, `L`),
(w.isArgumentsObject = zt),
(w.isGeneratorFunction = Bt),
(w.isPromise = function (e) {
return (
(typeof Promise < `u` && e instanceof Promise) ||
(typeof e == `object` && !!e && typeof e.then == `function` && typeof e.catch == `function`)
);
}),
(w.isArrayBufferView = function (e) {
return Ut && ArrayBuffer.isView ? ArrayBuffer.isView(e) : Zt(e) || _n(e);
}),
(w.isTypedArray = Zt),
(w.isUint8Array = Qt),
(w.isUint8ClampedArray = $t),
(w.isUint16Array = en),
(w.isUint32Array = tn),
(w.isInt8Array = nn),
(w.isInt16Array = rn),
(w.isInt32Array = an),
(w.isFloat32Array = on),
(w.isFloat64Array = sn),
(w.isBigInt64Array = cn),
(w.isBigUint64Array = ln),
(un.working = typeof Map < `u` && un(new Map())),
(w.isMap = function (e) {
return typeof Map < `u` && (un.working ? un(e) : e instanceof Map);
}),
(dn.working = typeof Set < `u` && dn(new Set())),
(w.isSet = function (e) {
return typeof Set < `u` && (dn.working ? dn(e) : e instanceof Set);
}),
(fn.working = typeof WeakMap < `u` && fn(new WeakMap())),
(w.isWeakMap = function (e) {
return typeof WeakMap < `u` && (fn.working ? fn(e) : e instanceof WeakMap);
}),
(pn.working = typeof WeakSet < `u` && pn(new WeakSet())),
(w.isWeakSet = function (e) {
return pn(e);
}),
(mn.working = typeof ArrayBuffer < `u` && mn(new ArrayBuffer())),
(w.isArrayBuffer = hn),
(gn.working =
typeof ArrayBuffer < `u` &&
typeof DataView < `u` &&
gn(new DataView(new ArrayBuffer(1), 0, 1))),
(w.isDataView = _n),
(vn.working = typeof SharedArrayBuffer < `u` && vn(new SharedArrayBuffer())),
(w.isSharedArrayBuffer = yn),
(w.isAsyncFunction = function (e) {
return k(e) === `[object AsyncFunction]`;
}),
(w.isMapIterator = function (e) {
return k(e) === `[object Map Iterator]`;
}),
(w.isSetIterator = function (e) {
return k(e) === `[object Set Iterator]`;
}),
(w.isGeneratorObject = function (e) {
return k(e) === `[object Generator]`;
}),
(w.isWebAssemblyCompiledModule = function (e) {
return k(e) === `[object WebAssembly.Module]`;
}),
(w.isNumberObject = bn),
(w.isStringObject = xn),
(w.isBooleanObject = Sn),
(w.isBigIntObject = Cn),
(w.isSymbolObject = wn),
(w.isBoxedPrimitive = function (e) {
return bn(e) || xn(e) || Sn(e) || Cn(e) || wn(e);
}),
(w.isAnyArrayBuffer = function (e) {
return D && (hn(e) || yn(e));
}),
[`isProxy`, `isExternal`, `isModuleNamespaceObject`].forEach(function (e) {
Object.defineProperty(w, e, {
enumerable: !1,
value: function () {
throw Error(e + ` is not supported in userland`);
},
});
}));
var Tn = typeof globalThis < `u` ? globalThis : typeof self < `u` ? self : globalThis,
A = {},
j = C,
En =
Object.getOwnPropertyDescriptors ||
function (e) {
for (var t = Object.keys(e), n = {}, r = 0; r < t.length; r++)
n[t[r]] = Object.getOwnPropertyDescriptor(e, t[r]);
return n;
},
Dn = /%[sdj%]/g;
((A.format = function (e) {
if (!Bn(e)) {
for (var t = [], n = 0; n < arguments.length; n++) t.push(M(arguments[n]));
return t.join(` `);
}
n = 1;
for (
var r = arguments,
i = r.length,
a = String(e).replace(Dn, function (e) {
if (e === `%%`) return `%`;
if (n >= i) return e;
switch (e) {
case `%s`:
return String(r[n++]);
case `%d`:
return Number(r[n++]);
case `%j`:
try {
return JSON.stringify(r[n++]);
} catch {
return `[Circular]`;
}
default:
return e;
}
}),
o = r[n];
n < i;
o = r[++n]
)
Rn(o) || !P(o) ? (a += ` ` + o) : (a += ` ` + M(o));
return a;
}),
(A.deprecate = function (e, t) {
if (j !== void 0 && !0 === j.noDeprecation) return e;
if (j === void 0)
return function () {
return A.deprecate(e, t).apply(this || Tn, arguments);
};
var n = !1;
return function () {
if (!n) {
if (j.throwDeprecation) throw Error(t);
(j.traceDeprecation ? console.trace(t) : console.error(t), (n = !0));
}
return e.apply(this || Tn, arguments);
};
}));
var On = {},
kn = /^$/;
j.env.NODE_DEBUG &&
((An = j.env.NODE_DEBUG),
(An = An.replace(/[|\\{}()[\]^$+?.]/g, `\\$&`)
.replace(/\*/g, `.*`)
.replace(/,/g, `$|^`)
.toUpperCase()),
(kn = RegExp(`^` + An + `$`, `i`)));
var An;
function M(e, t) {
var n = { seen: [], stylize: Mn };
return (
arguments.length >= 3 && (n.depth = arguments[2]),
arguments.length >= 4 && (n.colors = arguments[3]),
Ln(t) ? (n.showHidden = t) : t && A._extend(n, t),
N(n.showHidden) && (n.showHidden = !1),
N(n.depth) && (n.depth = 2),
N(n.colors) && (n.colors = !1),
N(n.customInspect) && (n.customInspect = !0),
n.colors && (n.stylize = jn),
Nn(n, e, n.depth)
);
}
g(M, `oe`);
function jn(e, t) {
var n = M.styles[t];
return n ? `\x1B[` + M.colors[n][0] + `m` + e + `\x1B[` + M.colors[n][1] + `m` : e;
}
g(jn, `ue`);
function Mn(e, t) {
return e;
}
g(Mn, `fe`);
function Nn(e, t, n) {
if (
e.customInspect &&
t &&
Wn(t.inspect) &&
t.inspect !== A.inspect &&
(!t.constructor || t.constructor.prototype !== t)
) {
var r = t.inspect(n, e);
return (Bn(r) || (r = Nn(e, r, n)), r);
}
var i = (function (e, t) {
if (N(t)) return e.stylize(`undefined`, `undefined`);
if (Bn(t)) {
var n =
`'` +
JSON.stringify(t).replace(/^"|"$/g, ``).replace(/'/g, `\\'`).replace(/\\"/g, `"`) +
`'`;
return e.stylize(n, `string`);
}
if (zn(t)) return e.stylize(`` + t, `number`);
if (Ln(t)) return e.stylize(`` + t, `boolean`);
if (Rn(t)) return e.stylize(`null`, `null`);
})(e, t);
if (i) return i;
var a = Object.keys(t),
o = (function (e) {
var t = {};
return (
e.forEach(function (e, n) {
t[e] = !0;
}),
t
);
})(a);
if (
(e.showHidden && (a = Object.getOwnPropertyNames(t)),
Un(t) && (a.indexOf(`message`) >= 0 || a.indexOf(`description`) >= 0))
)
return Pn(t);
if (a.length === 0) {
if (Wn(t)) {
var s = t.name ? `: ` + t.name : ``;
return e.stylize(`[Function` + s + `]`, `special`);
}
if (Vn(t)) return e.stylize(RegExp.prototype.toString.call(t), `regexp`);
if (Hn(t)) return e.stylize(Date.prototype.toString.call(t), `date`);
if (Un(t)) return Pn(t);
}
var c,
l = ``,
u = !1,
d = [`{`, `}`];
return (
In(t) && ((u = !0), (d = [`[`, `]`])),
Wn(t) && (l = ` [Function` + (t.name ? `: ` + t.name : ``) + `]`),
Vn(t) && (l = ` ` + RegExp.prototype.toString.call(t)),
Hn(t) && (l = ` ` + Date.prototype.toUTCString.call(t)),
Un(t) && (l = ` ` + Pn(t)),
a.length !== 0 || (u && t.length != 0)
? n < 0
? Vn(t)
? e.stylize(RegExp.prototype.toString.call(t), `regexp`)
: e.stylize(`[Object]`, `special`)
: (e.seen.push(t),
(c = u
? (function (e, t, n, r, i) {
for (var a = [], o = 0, s = t.length; o < s; ++o)
Yn(t, String(o)) ? a.push(Fn(e, t, n, r, String(o), !0)) : a.push(``);
return (
i.forEach(function (i) {
i.match(/^\d+$/) || a.push(Fn(e, t, n, r, i, !0));
}),
a
);
})(e, t, n, o, a)
: a.map(function (r) {
return Fn(e, t, n, o, r, u);
})),
e.seen.pop(),
(function (e, t, n) {
var r = 0;
return e.reduce(function (e, t) {
return (
r++,
t.indexOf(`
`) >= 0 && r++,
e + t.replace(/\u001b\[\d\d?m/g, ``).length + 1
);
}, 0) > 60
? n[0] +
(t === ``
? ``
: t +
`
`) +
` ` +
e.join(`,
`) +
` ` +
n[1]
: n[0] + t + ` ` + e.join(`, `) + ` ` + n[1];
})(c, l, d))
: d[0] + l + d[1]
);
}
g(Nn, `ae`);
function Pn(e) {
return `[` + Error.prototype.toString.call(e) + `]`;
}
g(Pn, `ce`);
function Fn(e, t, n, r, i, a) {
var o, s, c;
if (
((c = Object.getOwnPropertyDescriptor(t, i) || { value: t[i] }).get
? (s = c.set ? e.stylize(`[Getter/Setter]`, `special`) : e.stylize(`[Getter]`, `special`))
: c.set && (s = e.stylize(`[Setter]`, `special`)),
Yn(r, i) || (o = `[` + i + `]`),
s ||
(e.seen.indexOf(c.value) < 0
? (s = Rn(n) ? Nn(e, c.value, null) : Nn(e, c.value, n - 1)).indexOf(`
`) > -1 &&
(s = a
? s
.split(`
`)
.map(function (e) {
return ` ` + e;
})
.join(`
`)
.substr(2)
: `
` +
s
.split(`
`)
.map(function (e) {
return ` ` + e;
}).join(`
`))
: (s = e.stylize(`[Circular]`, `special`))),
N(o))
) {
if (a && i.match(/^\d+$/)) return s;
(o = JSON.stringify(`` + i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)
? ((o = o.substr(1, o.length - 2)), (o = e.stylize(o, `name`)))
: ((o = o
.replace(/'/g, `\\'`)
.replace(/\\"/g, `"`)
.replace(/(^"|"$)/g, `'`)),
(o = e.stylize(o, `string`)));
}
return o + `: ` + s;
}
g(Fn, `se`);
function In(e) {
return Array.isArray(e);
}
g(In, `pe`);
function Ln(e) {
return typeof e == `boolean`;
}
g(Ln, `ye`);
function Rn(e) {
return e === null;
}
g(Rn, `le`);
function zn(e) {
return typeof e == `number`;
}
g(zn, `de`);
function Bn(e) {
return typeof e == `string`;
}
g(Bn, `ge`);
function N(e) {
return e === void 0;
}
g(N, `be`);
function Vn(e) {
return P(e) && Gn(e) === `[object RegExp]`;
}
g(Vn, `me`);
function P(e) {
return typeof e == `object` && !!e;
}
g(P, `he`);
function Hn(e) {
return P(e) && Gn(e) === `[object Date]`;
}
g(Hn, `je`);
function Un(e) {
return P(e) && (Gn(e) === `[object Error]` || e instanceof Error);
}
g(Un, `Ae`);
function Wn(e) {
return typeof e == `function`;
}
g(Wn, `we`);
function Gn(e) {
return Object.prototype.toString.call(e);
}
g(Gn, `ve`);
function Kn(e) {
return e < 10 ? `0` + e.toString(10) : e.toString(10);
}
(g(Kn, `Oe`),
(A.debuglog = function (e) {
if (((e = e.toUpperCase()), !On[e]))
if (kn.test(e)) {
var t = j.pid;
On[e] = function () {
var n = A.format.apply(A, arguments);
console.error(`%s %d: %s`, e, t, n);
};
} else On[e] = function () {};
return On[e];
}),
(A.inspect = M),
(M.colors = {
bold: [1, 22],
italic: [3, 23],
underline: [4, 24],
inverse: [7, 27],
white: [37, 39],
grey: [90, 39],
black: [30, 39],
blue: [34, 39],
cyan: [36, 39],
green: [32, 39],
magenta: [35, 39],
red: [31, 39],
yellow: [33, 39],
}),
(M.styles = {
special: `cyan`,
number: `yellow`,
boolean: `yellow`,
undefined: `grey`,
null: `bold`,
string: `green`,
date: `magenta`,
regexp: `red`,
}),
(A.types = w),
(A.isArray = In),
(A.isBoolean = Ln),
(A.isNull = Rn),
(A.isNullOrUndefined = function (e) {
return e == null;
}),
(A.isNumber = zn),
(A.isString = Bn),
(A.isSymbol = function (e) {
return typeof e == `symbol`;
}),
(A.isUndefined = N),
(A.isRegExp = Vn),
(A.types.isRegExp = Vn),
(A.isObject = P),
(A.isDate = Hn),
(A.types.isDate = Hn),
(A.isError = Un),
(A.types.isNativeError = Un),
(A.isFunction = Wn),
(A.isPrimitive = function (e) {
return (
e === null ||
typeof e == `boolean` ||
typeof e == `number` ||
typeof e == `string` ||
typeof e == `symbol` ||
e === void 0
);
}),
(A.isBuffer = Lt));
var qn = [`Jan`, `Feb`, `Mar`, `Apr`, `May`, `Jun`, `Jul`, `Aug`, `Sep`, `Oct`, `Nov`, `Dec`];
function Jn() {
var e = new Date(),
t = [Kn(e.getHours()), Kn(e.getMinutes()), Kn(e.getSeconds())].join(`:`);
return [e.getDate(), qn[e.getMonth()], t].join(` `);
}
g(Jn, `Be`);
function Yn(e, t) {
return Object.prototype.hasOwnProperty.call(e, t);
}
(g(Yn, `ke`),
(A.log = function () {
console.log(`%s - %s`, Jn(), A.format.apply(A, arguments));
}),
(A.inherits = It),
(A._extend = function (e, t) {
if (!t || !P(t)) return e;
for (var n = Object.keys(t), r = n.length; r--;) e[n[r]] = t[n[r]];
return e;
}));
var F = typeof Symbol < `u` ? Symbol(`util.promisify.custom`) : void 0;
function Xn(e, t) {
if (!e) {
var n = Error(`Promise was rejected with a falsy value`);
((n.reason = e), (e = n));
}
return t(e);
}
(g(Xn, `De`),
(A.promisify = function (e) {
if (typeof e != `function`) throw TypeError(`The "original" argument must be of type Function`);
if (F && e[F]) {
var t;
if (typeof (t = e[F]) != `function`)
throw TypeError(`The "util.promisify.custom" argument must be of type Function`);
return (
Object.defineProperty(t, F, { value: t, enumerable: !1, writable: !1, configurable: !0 }), t
);
}
function t() {
for (
var t,
n,
r = new Promise(function (e, r) {
((t = e), (n = r));
}),
i = [],
a = 0;
a < arguments.length;
a++
)
i.push(arguments[a]);
i.push(function (e, r) {
e ? n(e) : t(r);
});
try {
e.apply(this || Tn, i);
} catch (e) {
n(e);
}
return r;
}
return (
g(t, `t`),
Object.setPrototypeOf(t, Object.getPrototypeOf(e)),
F &&
Object.defineProperty(t, F, { value: t, enumerable: !1, writable: !1, configurable: !0 }),
Object.defineProperties(t, En(e))
);
}),
(A.promisify.custom = F),
(A.callbackify = function (e) {
if (typeof e != `function`) throw TypeError(`The "original" argument must be of type Function`);
function t() {
for (var t = [], n = 0; n < arguments.length; n++) t.push(arguments[n]);
var r = t.pop();
if (typeof r != `function`) throw TypeError(`The last argument must be of type Function`);
var i = this || Tn,
a = g(function () {
return r.apply(i, arguments);
}, `o`);
e.apply(this || Tn, t).then(
function (e) {
j.nextTick(a.bind(null, null, e));
},
function (e) {
j.nextTick(Xn.bind(null, e, a));
},
);
}
return (
g(t, `t`),
Object.setPrototypeOf(t, Object.getPrototypeOf(e)),
Object.defineProperties(t, En(e)),
t
);
}),
A._extend,
A.callbackify,
A.debuglog,
A.deprecate,
A.format,
A.inherits,
A.inspect,
A.isArray,
A.isBoolean,
A.isBuffer,
A.isDate,
A.isError,
A.isFunction,
A.isNull,
A.isNullOrUndefined,
A.isNumber,
A.isObject,
A.isPrimitive,
A.isRegExp,
A.isString,
A.isSymbol,
A.isUndefined,
A.log,
A.promisify,
A._extend,
A.callbackify,
A.debuglog,
A.deprecate,
A.format,
A.inherits,
A.inspect,
A.isArray,
A.isBoolean,
A.isBuffer,
A.isDate,
A.isError,
A.isFunction,
A.isNull,
A.isNullOrUndefined,
A.isNumber,
A.isObject,
A.isPrimitive,
A.isRegExp,
A.isString,
A.isSymbol,
A.isUndefined,
A.log,
A.promisify,
A.types,
A._extend,
A.callbackify,
A.debuglog,
A.deprecate,
A.format,
A.inherits);
var Zn = A.inspect;
(A.isArray,
A.isBoolean,
A.isBuffer,
A.isDate,
A.isError,
A.isFunction,
A.isNull,
A.isNullOrUndefined,
A.isNumber,
A.isObject,
A.isPrimitive,
A.isRegExp,
A.isString,
A.isSymbol,
A.isUndefined,
A.log,
A.promisify,
A.types,
(A.TextEncoder = globalThis.TextEncoder),
(A.TextDecoder = globalThis.TextDecoder));
var Qn = Symbol.for(`nodejs.util.inspect.custom`),
I = Symbol.for(`nodejs.util.inspect.custom.stack-less`),
$n = class extends Error {
toJSON() {
return { name: this.name, message: this.message };
}
[Qn](e, t) {
return `${this[I](e, t)}
${this.stack.slice(
this.stack.indexOf(`
`),
)}`;
}
};
g($n, `BaseError`);
var er = $n,
tr = class extends er {
constructor(e, t, n) {
(super(t), (this.constraint = e), (this.given = n));
}
toJSON() {
return {
name: this.name,
constraint: this.constraint,
given: this.given,
message: this.message,
};
}
};
g(tr, `BaseConstraintError`);
var nr = tr,
rr = class extends nr {
constructor(e, t, n, r) {
(super(e, t, n), (this.expected = r));
}
toJSON() {
return {
name: this.name,
constraint: this.constraint,
given: this.given,
expected: this.expected,
message: this.message,
};
}
[I](e, t) {
let n = t.stylize(this.constraint, `string`);
if (e < 0) return t.stylize(`[ExpectedConstraintError: ${n}]`, `special`);
let r = { ...t, depth: t.depth === null ? null : t.depth - 1 },
i = `
${t.stylize(`|`, `undefined`)} `,
a = Zn(this.given, r).replace(/\n/g, i);
return `${`${t.stylize(`ExpectedConstraintError`, `special`)} > ${n}`}
${t.stylize(this.message, `regexp`)}
${`
${t.stylize(`Expected: `, `string`)}${t.stylize(this.expected, `boolean`)}`}
${`
${t.stylize(`Received:`, `regexp`)}${i}${a}`}`;
}
};
g(rr, `ExpectedConstraintError`);
var L = rr,
ir = class e {
constructor(e, t, n) {
((this.success = e), e ? (this.value = t) : (this.error = n));
}
isOk() {
return this.success;
}
isErr() {
return !this.success;
}
unwrap() {
if (this.isOk()) return this.value;
throw this.error;
}
static ok(t) {
return new e(!0, t);
}
static err(t) {
return new e(!1, void 0, t);
}
};
g(ir, `Result`);
var R = ir;
function ar(e, t, n, r) {
return {
run(i, a) {
if (!a)
return R.err(
new L(
`s.object(T.when)`,
r?.message ?? `Validator has no parent`,
a,
`Validator to have a parent`,
),
);
let o = Array.isArray(e),
s = or(t, o ? e.map((e) => (0, ct.default)(a, e)) : (0, ct.default)(a, e), o)
? t.then
: t.otherwise;
return s ? s(n).run(i) : R.ok(i);
},
};
}
g(ar, `whenConstraint`);
function or(e, t, n) {
return e.is === void 0
? n
? !t.some((e) => !e)
: !!t
: typeof e.is == `function`
? e.is(t)
: t === e.is;
}
g(or, `resolveBooleanIs`);
var sr = !0;
function cr(e) {
sr = e;
}
g(cr, `setGlobalValidationEnabled`);
function lr() {
return sr;
}
g(lr, `getGlobalValidationEnabled`);
function ur(e) {
return typeof e == `function` ? e() : e;
}
g(ur, `getValue`);
var dr = class {
constructor(e = {}, t = []) {
((this.constraints = []),
(this.isValidationEnabled = null),
(this.constraints = t),
(this.validatorOptions = e));
}
setParent(e) {
return ((this.parent = e), this);
}
optional(e = this.validatorOptions) {
return new ji([new J(void 0, e), this.clone()], e);
}
nullable(e = this.validatorOptions) {
return new ji([new J(null, e), this.clone()], e);
}
nullish(e = this.validatorOptions) {
return new ji([new Y(e), this.clone()], e);
}
array(e = this.validatorOptions) {
return new Dr(this.clone(), e);
}
set(e = this.validatorOptions) {
return new zi(this.clone(), e);
}
or(...e) {
return new ji([this.clone(), ...e], this.validatorOptions);
}
transform(e, t = this.validatorOptions) {
return this.addConstraint({ run: (t) => R.ok(e(t)) }, t);
}
reshape(e, t = this.validatorOptions) {
return this.addConstraint({ run: e }, t);
}
default(e, t = this.validatorOptions) {
return new Di(this.clone(), e, t);
}
when(e, t, n) {
return this.addConstraint(ar(e, t, this, n));
}
describe(e) {
let t = this.clone();
return ((t.description = e), t);
}
run(e) {
let t = this.handle(e);
if (t.isErr()) return t;
for (let e of this.constraints) if (((t = e.run(t.value, this.parent)), t.isErr())) break;
return t;
}
parse(e) {
return this.shouldRunConstraints
? this.constraints.reduce((e, t) => t.run(e).unwrap(), this.handle(e).unwrap())
: this.handle(e).unwrap();
}
is(e) {
return this.run(e).isOk();
}
setValidationEnabled(e) {
let t = this.clone();
return ((t.isValidationEnabled = e), t);
}
getValidationEnabled() {
return ur(this.isValidationEnabled);
}
get shouldRunConstraints() {
return ur(this.isValidationEnabled) ?? lr();
}
clone() {
let e = Reflect.construct(this.constructor, [this.validatorOptions, this.constraints]);
return ((e.isValidationEnabled = this.isValidationEnabled), e);
}
addConstraint(e, t = this.validatorOptions) {
let n = this.clone();
return ((n.validatorOptions = t), (n.constraints = n.constraints.concat(e)), n);
}
};
g(dr, `BaseValidator`);
var z = dr;
function fr(e) {
return e.length < 2 || (0, ut.default)(e, lt.default).length === e.length;
}
g(fr, `isUnique`);
function B(e, t) {
return e < t;
}
g(B, `lessThan`);
function V(e, t) {
return e <= t;
}
g(V, `lessThanOrEqual`);
function H(e, t) {
return e > t;
}
g(H, `greaterThan`);
function U(e, t) {
return e >= t;
}
g(U, `greaterThanOrEqual`);
function W(e, t) {
return e === t;
}
g(W, `equal`);
function G(e, t) {
return e !== t;
}
g(G, `notEqual`);
function K(e, t, n, r, i) {
return {
run(a) {
return e(a.length, r) ? R.ok(a) : R.err(new L(t, i?.message ?? `Invalid Array length`, a, n));
},
};
}
g(K, `arrayLengthComparator`);
function pr(e, t) {
return K(B, `s.array(T).lengthLessThan()`, `expected.length < ${e}`, e, t);
}
g(pr, `arrayLengthLessThan`);
function mr(e, t) {
return K(V, `s.array(T).lengthLessThanOrEqual()`, `expected.length <= ${e}`, e, t);
}
g(mr, `arrayLengthLessThanOrEqual`);
function hr(e, t) {
return K(H, `s.array(T).lengthGreaterThan()`, `expected.length > ${e}`, e, t);
}
g(hr, `arrayLengthGreaterThan`);
function gr(e, t) {
return K(U, `s.array(T).lengthGreaterThanOrEqual()`, `expected.length >= ${e}`, e, t);
}
g(gr, `arrayLengthGreaterThanOrEqual`);
function _r(e, t) {
return K(W, `s.array(T).lengthEqual()`, `expected.length === ${e}`, e, t);
}
g(_r, `arrayLengthEqual`);
function vr(e, t) {
return K(G, `s.array(T).lengthNotEqual()`, `expected.length !== ${e}`, e, t);
}
g(vr, `arrayLengthNotEqual`);
function yr(e, t, n) {
let r = `expected.length >= ${e} && expected.length < ${t}`;
return {
run(i) {
return i.length >= e && i.length < t
? R.ok(i)
: R.err(new L(`s.array(T).lengthRange()`, n?.message ?? `Invalid Array length`, i, r));
},
};
}
g(yr, `arrayLengthRange`);
function br(e, t, n) {
let r = `expected.length >= ${e} && expected.length <= ${t}`;
return {
run(i) {
return i.length >= e && i.length <= t
? R.ok(i)
: R.err(
new L(`s.array(T).lengthRangeInclusive()`, n?.message ?? `Invalid Array length`, i, r),
);
},
};
}
g(br, `arrayLengthRangeInclusive`);
function xr(e, t, n) {
let r = `expected.length > ${e} && expected.length < ${t}`;
return {
run(i) {
return i.length > e && i.length < t
? R.ok(i)
: R.err(
new L(`s.array(T).lengthRangeExclusive()`, n?.message ?? `Invalid Array length`, i, r),
);
},
};
}
g(xr, `arrayLengthRangeExclusive`);
function Sr(e) {
return {
run(t) {
return fr(t)
? R.ok(t)
: R.err(
new L(
`s.array(T).unique()`,
e?.message ?? `Array values are not unique`,
t,
`Expected all values to be unique`,
),
);
},
};
}
g(Sr, `uniqueArray`);
var Cr = class e extends er {
constructor(e, t) {
(super(t?.message ?? `Received one or more errors`), (this.errors = e));
}
[I](t, n) {
if (t < 0) return n.stylize(`[CombinedPropertyError]`, `special`);
let r = { ...n, depth: n.depth === null ? null : n.depth - 1, compact: !0 },
i = `
${n.stylize(`|`, `undefined`)} `;
return `${`${n.stylize(`CombinedPropertyError`, `special`)} (${n.stylize(this.errors.length.toString(), `number`)})`}
${n.stylize(this.message, `regexp`)}
${this.errors.map(([a, o]) => {
let s = e.formatProperty(a, n),
c = o[I](t - 1, r).replace(/\n/g, i);
return ` input${s}${i}${c}`;
}).join(`
`)}`;
}
static formatProperty(e, t) {
return typeof e == `string`
? t.stylize(`.${e}`, `symbol`)
: typeof e == `number`
? `[${t.stylize(e.toString(), `number`)}]`
: `[${t.stylize(`Symbol`, `symbol`)}(${e.description})]`;
}
};
g(Cr, `CombinedPropertyError`);
var wr = Cr,
Tr = class extends er {
constructor(e, t, n) {
(super(t), (this.validator = e), (this.given = n));
}
toJSON() {
return {
name: this.name,
message: `Unknown validation error occurred.`,
validator: this.validator,
given: this.given,
};
}
[I](e, t) {
let n = t.stylize(this.validator, `string`);
if (e < 0) return t.stylize(`[ValidationError: ${n}]`, `special`);
let r = { ...t, depth: t.depth === null ? null : t.depth - 1, compact: !0 },
i = `
${t.stylize(`|`, `undefined`)} `,
a = Zn(this.given, r).replace(/\n/g, i);
return `${`${t.stylize(`ValidationError`, `special`)} > ${n}`}
${t.stylize(this.message, `regexp`)}
${`
${t.stylize(`Received:`, `regexp`)}${i}${a}`}`;
}
};
g(Tr, `ValidationError`);
var q = Tr,
Er = class extends z {
constructor(e, t = {}, n = []) {
(super(t, n), (this.validator = e));
}
lengthLessThan(e, t = this.validatorOptions) {
return this.addConstraint(pr(e, t));
}
lengthLessThanOrEqual(e, t = this.validatorOptions) {
return this.addConstraint(mr(e, t));
}
lengthGreaterThan(e, t = this.validatorOptions) {
return this.addConstraint(hr(e, t));
}
lengthGreaterThanOrEqual(e, t = this.validatorOptions) {
return this.addConstraint(gr(e, t));
}
lengthEqual(e, t = this.validatorOptions) {
return this.addConstraint(_r(e, t));
}
lengthNotEqual(e, t = this.validatorOptions) {
return this.addConstraint(vr(e, t));
}
lengthRange(e, t, n = this.validatorOptions) {
return this.addConstraint(yr(e, t, n));
}
lengthRangeInclusive(e, t, n = this.validatorOptions) {
return this.addConstraint(br(e, t, n));
}
lengthRangeExclusive(e, t, n = this.validatorOptions) {
return this.addConstraint(xr(e, t, n));
}
unique(e = this.validatorOptions) {
return this.addConstraint(Sr(e));
}
clone() {
return Reflect.construct(this.constructor, [
this.validator,
this.validatorOptions,
this.constraints,
]);
}
handle(e) {
if (!Array.isArray(e))
return R.err(new q(`s.array(T)`, this.validatorOptions.message ?? `Expected an array`, e));
if (!this.shouldRunConstraints) return R.ok(e);
let t = [],
n = [];
for (let r = 0; r < e.length; r++) {
let i = this.validator.run(e[r]);
i.isOk() ? n.push(i.value) : t.push([r, i.error]);
}
return t.length === 0 ? R.ok(n) : R.err(new wr(t, this.validatorOptions));
}
};
g(Er, `ArrayValidator`);
var Dr = Er;
function Or(e, t, n, r, i) {
return {
run(a) {
return e(a, r) ? R.ok(a) : R.err(new L(t, i?.message ?? `Invalid bigint value`, a, n));
},
};
}
g(Or, `bigintComparator`);
function kr(e, t) {
return Or(B, `s.bigint().lessThan()`, `expected < ${e}n`, e, t);
}
g(kr, `bigintLessThan`);
function Ar(e, t) {
return Or(V, `s.bigint().lessThanOrEqual()`, `expected <= ${e}n`, e, t);
}
g(Ar, `bigintLessThanOrEqual`);
function jr(e, t) {
return Or(H, `s.bigint().greaterThan()`, `expected > ${e}n`, e, t);
}
g(jr, `bigintGreaterThan`);
function Mr(e, t) {
return Or(U, `s.bigint().greaterThanOrEqual()`, `expected >= ${e}n`, e, t);
}
g(Mr, `bigintGreaterThanOrEqual`);
function Nr(e, t) {
return Or(W, `s.bigint().equal()`, `expected === ${e}n`, e, t);
}
g(Nr, `bigintEqual`);
function Pr(e, t) {
return Or(G, `s.bigint().notEqual()`, `expected !== ${e}n`, e, t);
}
g(Pr, `bigintNotEqual`);
function Fr(e, t) {
let n = `expected % ${e}n === 0n`;
return {
run(r) {
return r % e === 0n
? R.ok(r)
: R.err(new L(`s.bigint().divisibleBy()`, t?.message ?? `BigInt is not divisible`, r, n));
},
};
}
g(Fr, `bigintDivisibleBy`);
var Ir = class extends z {
lessThan(e, t = this.validatorOptions) {
return this.addConstraint(kr(e, t));
}
lessThanOrEqual(e, t = this.validatorOptions) {
return this.addConstraint(Ar(e, t));
}
greaterThan(e, t = this.validatorOptions) {
return this.addConstraint(jr(e, t));
}
greaterThanOrEqual(e, t = this.validatorOptions) {
return this.addConstraint(Mr(e, t));
}
equal(e, t = this.validatorOptions) {
return this.addConstraint(Nr(e, t));
}
notEqual(e, t = this.validatorOptions) {
return this.addConstraint(Pr(e, t));
}
positive(e = this.validatorOptions) {
return this.greaterThanOrEqual(0n, e);
}
negative(e = this.validatorOptions) {
return this.lessThan(0n, e);
}
divisibleBy(e, t = this.validatorOptions) {
return this.addConstraint(Fr(e, t));
}
abs(e = this.validatorOptions) {
return this.transform((e) => (e < 0 ? -e : e), e);
}
intN(e, t = this.validatorOptions) {
return this.transform((t) => BigInt.asIntN(e, t), t);
}
uintN(e, t = this.validatorOptions) {
return this.transform((t) => BigInt.asUintN(e, t), t);
}
handle(e) {
return typeof e == `bigint`
? R.ok(e)
: R.err(
new q(`s.bigint()`, this.validatorOptions.message ?? `Expected a bigint primitive`, e),
);
}
};
g(Ir, `BigIntValidator`);
var Lr = Ir;
function Rr(e) {
return {
run(t) {
return t
? R.ok(t)
: R.err(new L(`s.boolean().true()`, e?.message ?? `Invalid boolean value`, t, `true`));
},
};
}
g(Rr, `booleanTrue`);
function zr(e) {
return {
run(t) {
return t
? R.err(new L(`s.boolean().false()`, e?.message ?? `Invalid boolean value`, t, `false`))
: R.ok(t);
},
};
}
g(zr, `booleanFalse`);
var Br = class extends z {
true(e = this.validatorOptions) {
return this.addConstraint(Rr(e));
}
false(e = this.validatorOptions) {
return this.addConstraint(zr(e));
}
equal(e, t = this.validatorOptions) {
return e ? this.true(t) : this.false(t);
}
notEqual(e, t = this.validatorOptions) {
return e ? this.false(t) : this.true(t);
}
handle(e) {
return typeof e == `boolean`
? R.ok(e)
: R.err(
new q(`s.boolean()`, this.validatorOptions.message ?? `Expected a boolean primitive`, e),
);
}
};
g(Br, `BooleanValidator`);
var Vr = Br;
function Hr(e, t, n, r, i) {
return {
run(a) {
return e(a.getTime(), r)
? R.ok(a)
: R.err(new L(t, i?.message ?? `Invalid Date value`, a, n));
},
};
}
g(Hr, `dateComparator`);
function Ur(e, t) {
return Hr(B, `s.date().lessThan()`, `expected < ${e.toISOString()}`, e.getTime(), t);
}
g(Ur, `dateLessThan`);
function Wr(e, t) {
return Hr(V, `s.date().lessThanOrEqual()`, `expected <= ${e.toISOString()}`, e.getTime(), t);
}
g(Wr, `dateLessThanOrEqual`);
function Gr(e, t) {
return Hr(H, `s.date().greaterThan()`, `expected > ${e.toISOString()}`, e.getTime(), t);
}
g(Gr, `dateGreaterThan`);
function Kr(e, t) {
return Hr(U, `s.date().greaterThanOrEqual()`, `expected >= ${e.toISOString()}`, e.getTime(), t);
}
g(Kr, `dateGreaterThanOrEqual`);
function qr(e, t) {
return Hr(W, `s.date().equal()`, `expected === ${e.toISOString()}`, e.getTime(), t);
}
g(qr, `dateEqual`);
function Jr(e, t) {
return Hr(G, `s.date().notEqual()`, `expected !== ${e.toISOString()}`, e.getTime(), t);
}
g(Jr, `dateNotEqual`);
function Yr(e) {
return {
run(t) {
return Number.isNaN(t.getTime())
? R.ok(t)
: R.err(
new L(`s.date().invalid()`, e?.message ?? `Invalid Date value`, t, `expected === NaN`),
);
},
};
}
g(Yr, `dateInvalid`);
function Xr(e) {
return {
run(t) {
return Number.isNaN(t.getTime())
? R.err(
new L(`s.date().valid()`, e?.message ?? `Invalid Date value`, t, `expected !== NaN`),
)
: R.ok(t);
},
};
}
g(Xr, `dateValid`);
var Zr = class extends z {
lessThan(e, t = this.validatorOptions) {
return this.addConstraint(Ur(new Date(e), t));
}
lessThanOrEqual(e, t = this.validatorOptions) {
return this.addConstraint(Wr(new Date(e), t));
}
greaterThan(e, t = this.validatorOptions) {
return this.addConstraint(Gr(new Date(e), t));
}
greaterThanOrEqual(e, t = this.validatorOptions) {
return this.addConstraint(Kr(new Date(e), t));
}
equal(e, t = this.validatorOptions) {
let n = new Date(e);
return Number.isNaN(n.getTime()) ? this.invalid(t) : this.addConstraint(qr(n, t));
}
notEqual(e, t = this.validatorOptions) {
let n = new Date(e);
return Number.isNaN(n.getTime()) ? this.valid(t) : this.addConstraint(Jr(n, t));
}
valid(e = this.validatorOptions) {
return this.addConstraint(Xr(e));
}
invalid(e = this.validatorOptions) {
return this.addConstraint(Yr(e));
}
handle(e) {
return e instanceof Date
? R.ok(e)
: R.err(new q(`s.date()`, this.validatorOptions.message ?? `Expected a Date`, e));
}
};
g(Zr, `DateValidator`);
var Qr = Zr,
$r = class extends q {
constructor(e, t, n, r) {
(super(e, t, n), (this.expected = r));
}
toJSON() {
return {
name: this.name,
validator: this.validator,
given: this.given,
expected: this.expected,
message: this.message,
};
}
[I](e, t) {
let n = t.stylize(this.validator, `string`);
if (e < 0) return t.stylize(`[ExpectedValidationError: ${n}]`, `special`);
let r = { ...t, depth: t.depth === null ? null : t.depth - 1 },
i = `
${t.stylize(`|`, `undefined`)} `,
a = Zn(this.expected, r).replace(/\n/g, i),
o = Zn(this.given, r).replace(/\n/g, i);
return `${`${t.stylize(`ExpectedValidationError`, `special`)} > ${n}`}
${t.stylize(this.message, `regexp`)}
${`
${t.stylize(`Expected:`, `string`)}${i}${a}`}
${`
${t.stylize(`Received:`, `regexp`)}${i}${o}`}`;
}
};
g($r, `ExpectedValidationError`);
var ei = $r,
ti = class extends z {
constructor(e, t = {}, n = []) {
(super(t, n), (this.expected = e));
}
handle(e) {
return e instanceof this.expected
? R.ok(e)
: R.err(
new ei(`s.instance(V)`, this.validatorOptions.message ?? `Expected`, e, this.expected),
);
}
clone() {
return Reflect.construct(this.constructor, [
this.expected,
this.validatorOptions,
this.constraints,
]);
}
};
g(ti, `InstanceValidator`);
var ni = ti,
ri = class extends z {
constructor(e, t = {}, n = []) {
(super(t, n), (this.expected = e));
}
handle(e) {
return Object.is(e, this.expected)
? R.ok(e)
: R.err(
new ei(
`s.literal(V)`,
this.validatorOptions.message ?? `Expected values to be equals`,
e,
this.expected,
),
);
}
clone() {
return Reflect.construct(this.constructor, [
this.expected,
this.validatorOptions,
this.constraints,
]);
}
};
g(ri, `LiteralValidator`);
var J = ri,
ii = class extends z {
handle(e) {
return R.err(
new q(`s.never()`, this.validatorOptions.message ?? `Expected a value to not be passed`, e),
);
}
};
g(ii, `NeverValidator`);
var ai = ii,
oi = class extends z {
handle(e) {
return e == null
? R.ok(e)
: R.err(
new q(`s.nullish()`, this.validatorOptions.message ?? `Expected undefined or null`, e),
);
}
};
g(oi, `NullishValidator`);
var Y = oi;
function si(e, t, n, r, i) {
return {
run(a) {
return e(a, r) ? R.ok(a) : R.err(new L(t, i?.message ?? `Invalid number value`, a, n));
},
};
}
g(si, `numberComparator`);
function ci(e, t) {
return si(B, `s.number().lessThan()`, `expected < ${e}`, e, t);
}
g(ci, `numberLessThan`);
function li(e, t) {
return si(V, `s.number().lessThanOrEqual()`, `expected <= ${e}`, e, t);
}
g(li, `numberLessThanOrEqual`);
function ui(e, t) {
return si(H, `s.number().greaterThan()`, `expected > ${e}`, e, t);
}
g(ui, `numberGreaterThan`);
function di(e, t) {
return si(U, `s.number().greaterThanOrEqual()`, `expected >= ${e}`, e, t);
}
g(di, `numberGreaterThanOrEqual`);
function fi(e, t) {
return si(W, `s.number().equal()`, `expected === ${e}`, e, t);
}
g(fi, `numberEqual`);
function pi(e, t) {
return si(G, `s.number().notEqual()`, `expected !== ${e}`, e, t);
}
g(pi, `numberNotEqual`);
function mi(e) {
return {
run(t) {
return Number.isInteger(t)
? R.ok(t)
: R.err(
new L(
`s.number().int()`,
e?.message ?? `Given value is not an integer`,
t,
`Number.isInteger(expected) to be true`,
),
);
},
};
}
g(mi, `numberInt`);
function hi(e) {
return {
run(t) {
return Number.isSafeInteger(t)
? R.ok(t)
: R.err(
new L(
`s.number().safeInt()`,
e?.message ?? `Given value is not a safe integer`,
t,
`Number.isSafeInteger(expected) to be true`,
),
);
},
};
}
g(hi, `numberSafeInt`);
function gi(e) {
return {
run(t) {
return Number.isFinite(t)
? R.ok(t)
: R.err(
new L(
`s.number().finite()`,
e?.message ?? `Given value is not finite`,
t,
`Number.isFinite(expected) to be true`,
),
);
},
};
}
g(gi, `numberFinite`);
function _i(e) {
return {
run(t) {
return Number.isNaN(t)
? R.ok(t)
: R.err(
new L(
`s.number().equal(NaN)`,
e?.message ?? `Invalid number value`,
t,
`expected === NaN`,
),
);
},
};
}
g(_i, `numberNaN`);
function vi(e) {
return {
run(t) {
return Number.isNaN(t)
? R.err(
new L(
`s.number().notEqual(NaN)`,
e?.message ?? `Invalid number value`,
t,
`expected !== NaN`,
),
)
: R.ok(t);
},
};
}
g(vi, `numberNotNaN`);
function yi(e, t) {
let n = `expected % ${e} === 0`;
return {
run(r) {
return r % e === 0
? R.ok(r)
: R.err(new L(`s.number().divisibleBy()`, t?.message ?? `Number is not divisible`, r, n));
},
};
}
g(yi, `numberDivisibleBy`);
var bi = class extends z {
lessThan(e, t = this.validatorOptions) {
return this.addConstraint(ci(e, t));
}
lessThanOrEqual(e, t = this.validatorOptions) {
return this.addConstraint(li(e, t));
}
greaterThan(e, t = this.validatorOptions) {
return this.addConstraint(ui(e, t));
}
greaterThanOrEqual(e, t = this.validatorOptions) {
return this.addConstraint(di(e, t));
}
equal(e, t = this.validatorOptions) {
return Number.isNaN(e) ? this.addConstraint(_i(t)) : this.addConstraint(fi(e, t));
}
notEqual(e, t = this.validatorOptions) {
return Number.isNaN(e) ? this.addConstraint(vi(t)) : this.addConstraint(pi(e, t));
}
int(e = this.validatorOptions) {
return this.addConstraint(mi(e));
}
safeInt(e = this.validatorOptions) {
return this.addConstraint(hi(e));
}
finite(e = this.validatorOptions) {
return this.addConstraint(gi(e));
}
positive(e = this.validatorOptions) {
return this.greaterThanOrEqual(0, e);
}
negative(e = this.validatorOptions) {
return this.lessThan(0, e);
}
divisibleBy(e, t = this.validatorOptions) {
return this.addConstraint(yi(e, t));
}
abs(e = this.validatorOptions) {
return this.transform(Math.abs, e);
}
sign(e = this.validatorOptions) {
return this.transform(Math.sign, e);
}
trunc(e = this.validatorOptions) {
return this.transform(Math.trunc, e);
}
floor(e = this.validatorOptions) {
return this.transform(Math.floor, e);
}
fround(e = this.validatorOptions) {
return this.transform(Math.fround, e);
}
round(e = this.validatorOptions) {
return this.transform(Math.round, e);
}
ceil(e = this.validatorOptions) {
return this.transform(Math.ceil, e);
}
handle(e) {
return typeof e == `number`
? R.ok(e)
: R.err(
new q(`s.number()`, this.validatorOptions.message ?? `Expected a number primitive`, e),
);
}
};
g(bi, `NumberValidator`);
var xi = bi,
Si = class extends er {
constructor(e, t) {
(super(t?.message ?? `A required property is missing`), (this.property = e));
}
toJSON() {
return { name: this.name, message: this.message, property: this.property };
}
[I](e, t) {
let n = t.stylize(this.property.toString(), `string`);
return e < 0
? t.stylize(`[MissingPropertyError: ${n}]`, `special`)
: `${`${t.stylize(`MissingPropertyError`, `special`)} > ${n}`}
${t.stylize(this.message, `regexp`)}`;
}
};
g(Si, `MissingPropertyError`);
var Ci = Si,
wi = class extends er {
constructor(e, t, n) {
(super(n?.message ?? `Received unexpected property`), (this.property = e), (this.value = t));
}
toJSON() {
return { name: this.name, message: this.message, property: this.property, value: this.value };
}
[I](e, t) {
let n = t.stylize(this.property.toString(), `string`);
if (e < 0) return t.stylize(`[UnknownPropertyError: ${n}]`, `special`);
let r = { ...t, depth: t.depth === null ? null : t.depth - 1, compact: !0 },
i = `
${t.stylize(`|`, `undefined`)} `,
a = Zn(this.value, r).replace(/\n/g, i);
return `${`${t.stylize(`UnknownPropertyError`, `special`)} > ${n}`}
${t.stylize(this.message, `regexp`)}
${`
${t.stylize(`Received:`, `regexp`)}${i}${a}`}`;
}
};
g(wi, `UnknownPropertyError`);
var Ti = wi,
Ei = class extends z {
constructor(e, t, n = {}, r = []) {
(super(n, r), (this.validator = e), (this.defaultValue = t));
}
default(e, t = this.validatorOptions) {
let n = this.clone();
return ((n.validatorOptions = t), (n.defaultValue = e), n);
}
handle(e) {
return e === void 0 ? R.ok(ur(this.defaultValue)) : this.validator.handle(e);
}
clone() {
return Reflect.construct(this.constructor, [
this.validator,
this.defaultValue,
this.validatorOptions,
this.constraints,
]);
}
};
g(Ei, `DefaultValidator`);
var Di = Ei,
Oi = class extends er {
constructor(e, t) {
(super(t?.message ?? `Received one or more errors`), (this.errors = e));
}
[I](e, t) {
if (e < 0) return t.stylize(`[CombinedError]`, `special`);
let n = { ...t, depth: t.depth === null ? null : t.depth - 1, compact: !0 },
r = `
${t.stylize(`|`, `undefined`)} `;
return `${`${t.stylize(`CombinedError`, `special`)} (${t.stylize(this.errors.length.toString(), `number`)})`}
${t.stylize(this.message, `regexp`)}
${this.errors.map(
(i, a) => ` ${t.stylize((a + 1).toString(), `number`)} ${i[I](e - 1, n).replace(/\n/g, r)}`,
).join(`
`)}`;
}
};
g(Oi, `CombinedError`);
var ki = Oi,
Ai = class e extends z {
constructor(e, t, n = []) {
(super(t, n), (this.validators = e));
}
optional(t = this.validatorOptions) {
if (this.validators.length === 0)
return new e([new J(void 0, t)], this.validatorOptions, this.constraints);
let [n] = this.validators;
if (n instanceof J) {
if (n.expected === void 0) return this.clone();
if (n.expected === null)
return new e(
[new Y(t), ...this.validators.slice(1)],
this.validatorOptions,
this.constraints,
);
} else if (n instanceof Y) return this.clone();
return new e([new J(void 0, t), ...this.validators], this.validatorOptions);
}
required(t = this.validatorOptions) {
if (this.validators.length === 0) return this.clone();
let [n] = this.validators;
if (n instanceof J) {
if (n.expected === void 0)
return new e(this.validators.slice(1), this.validatorOptions, this.constraints);
} else if (n instanceof Y)
return new e(
[new J(null, t), ...this.validators.slice(1)],
this.validatorOptions,
this.constraints,
);
return this.clone();
}
nullable(t = this.validatorOptions) {
if (this.validators.length === 0)
return new e([new J(null, t)], this.validatorOptions, this.constraints);
let [n] = this.validators;
if (n instanceof J) {
if (n.expected === null) return this.clone();
if (n.expected === void 0)
return new e(
[new Y(t), ...this.validators.slice(1)],
this.validatorOptions,
this.constraints,
);
} else if (n instanceof Y) return this.clone();
return new e([new J(null, t), ...this.validators], this.validatorOptions);
}
nullish(t = this.validatorOptions) {
if (this.validators.length === 0) return new e([new Y(t)], t, this.constraints);
let [n] = this.validators;
if (n instanceof J) {
if (n.expected === null || n.expected === void 0)
return new e([new Y(t), ...this.validators.slice(1)], t, this.constraints);
} else if (n instanceof Y) return this.clone();
return new e([new Y(t), ...this.validators], t);
}
or(...t) {
return new e([...this.validators, ...t], this.validatorOptions);
}
clone() {
return Reflect.construct(this.constructor, [
this.validators,
this.validatorOptions,
this.constraints,
]);
}
handle(e) {
let t = [];
for (let n of this.validators) {
let r = n.run(e);
if (r.isOk()) return r;
t.push(r.error);
}
return R.err(new ki(t, this.validatorOptions));
}
};
g(Ai, `UnionValidator`);
var ji = Ai,
Mi = class e extends z {
constructor(e, t = 0, n = {}, r = []) {
switch (
(super(n, r),
(this.keys = []),
(this.requiredKeys = new Map()),
(this.possiblyUndefinedKeys = new Map()),
(this.possiblyUndefinedKeysWithDefaults = new Map()),
(this.shape = e),
(this.strategy = t),
this.strategy)
) {
case 0:
this.handleStrategy = (e) => this.handleIgnoreStrategy(e);
break;
case 1:
this.handleStrategy = (e) => this.handleStrictStrategy(e);
break;
case 2:
this.handleStrategy = (e) => this.handlePassthroughStrategy(e);
break;
}
let i = Object.entries(e);
this.keys = i.map(([e]) => e);
for (let [e, t] of i)
if (t instanceof ji) {
let [n] = t.validators;
n instanceof Y
? this.possiblyUndefinedKeys.set(e, t)
: n instanceof J
? n.expected === void 0
? this.possiblyUndefinedKeys.set(e, t)
: this.requiredKeys.set(e, t)
: t instanceof Di
? this.possiblyUndefinedKeysWithDefaults.set(e, t)
: this.requiredKeys.set(e, t);
} else
t instanceof Y
? this.possiblyUndefinedKeys.set(e, t)
: t instanceof J
? t.expected === void 0
? this.possiblyUndefinedKeys.set(e, t)
: this.requiredKeys.set(e, t)
: t instanceof Di
? this.possiblyUndefinedKeysWithDefaults.set(e, t)
: this.requiredKeys.set(e, t);
}
strict(e = this.validatorOptions) {
return Reflect.construct(this.constructor, [this.shape, 1, e, this.constraints]);
}
ignore(e = this.validatorOptions) {
return Reflect.construct(this.constructor, [this.shape, 0, e, this.constraints]);
}
passthrough(e = this.validatorOptions) {
return Reflect.construct(this.constructor, [this.shape, 2, e, this.constraints]);
}
partial(e = this.validatorOptions) {
let t = Object.fromEntries(this.keys.map((t) => [t, this.shape[t].optional(e)]));
return Reflect.construct(this.constructor, [t, this.strategy, e, this.constraints]);
}
required(e = this.validatorOptions) {
let t = Object.fromEntries(
this.keys.map((t) => {
let n = this.shape[t];
return (n instanceof ji && (n = n.required(e)), [t, n]);
}),
);
return Reflect.construct(this.constructor, [t, this.strategy, e, this.constraints]);
}
extend(t, n = this.validatorOptions) {
let r = { ...this.shape, ...(t instanceof e ? t.shape : t) };
return Reflect.construct(this.constructor, [r, this.strategy, n, this.constraints]);
}
pick(e, t = this.validatorOptions) {
let n = Object.fromEntries(
e.filter((e) => this.keys.includes(e)).map((e) => [e, this.shape[e]]),
);
return Reflect.construct(this.constructor, [n, this.strategy, t, this.constraints]);
}
omit(e, t = this.validatorOptions) {
let n = Object.fromEntries(
this.keys.filter((t) => !e.includes(t)).map((e) => [e, this.shape[e]]),
);
return Reflect.construct(this.constructor, [n, this.strategy, t, this.constraints]);
}
handle(e) {
let t = typeof e;
if (t !== `object`)
return R.err(
new q(
`s.object(T)`,
this.validatorOptions.message ??
`Expected the value to be an object, but received ${t} instead`,
e,
),
);
if (e === null)
return R.err(
new q(
`s.object(T)`,
this.validatorOptions.message ?? `Expected the value to not be null`,
e,
),
);
if (Array.isArray(e))
return R.err(
new q(
`s.object(T)`,
this.validatorOptions.message ?? `Expected the value to not be an array`,
e,
),
);
if (!this.shouldRunConstraints) return R.ok(e);
for (let t of Object.values(this.shape)) t.setParent(this.parent ?? e);
return this.handleStrategy(e);
}
clone() {
return Reflect.construct(this.constructor, [
this.shape,
this.strategy,
this.validatorOptions,
this.constraints,
]);
}
handleIgnoreStrategy(e) {
let t = [],
n = {},
r = new Map(Object.entries(e)),
i = g((r, i) => {
let a = i.run(e[r]);
if (a.isOk()) n[r] = a.value;
else {
let e = a.error;
t.push([r, e]);
}
}, `runPredicate`);
for (let [e, n] of this.requiredKeys)
r.delete(e) ? i(e, n) : t.push([e, new Ci(e, this.validatorOptions)]);
for (let [e, t] of this.possiblyUndefinedKeysWithDefaults) (r.delete(e), i(e, t));
if (r.size === 0) return t.length === 0 ? R.ok(n) : R.err(new wr(t, this.validatorOptions));
if (this.possiblyUndefinedKeys.size > r.size)
for (let [e] of r) {
let t = this.possiblyUndefinedKeys.get(e);
t && i(e, t);
}
else for (let [e, t] of this.possiblyUndefinedKeys) r.delete(e) && i(e, t);
return t.length === 0 ? R.ok(n) : R.err(new wr(t, this.validatorOptions));
}
handleStrictStrategy(e) {
let t = [],
n = {},
r = new Map(Object.entries(e)),
i = g((r, i) => {
let a = i.run(e[r]);
if (a.isOk()) n[r] = a.value;
else {
let e = a.error;
t.push([r, e]);
}
}, `runPredicate`);
for (let [e, n] of this.requiredKeys)
r.delete(e) ? i(e, n) : t.push([e, new Ci(e, this.validatorOptions)]);
for (let [e, t] of this.possiblyUndefinedKeysWithDefaults) (r.delete(e), i(e, t));
for (let [e, t] of this.possiblyUndefinedKeys) {
if (r.size === 0) break;
r.delete(e) && i(e, t);
}
if (r.size !== 0)
for (let [e, n] of r.entries()) t.push([e, new Ti(e, n, this.validatorOptions)]);
return t.length === 0 ? R.ok(n) : R.err(new wr(t, this.validatorOptions));
}
handlePassthroughStrategy(e) {
let t = this.handleIgnoreStrategy(e);
return t.isErr() ? t : R.ok({ ...e, ...t.value });
}
};
g(Mi, `ObjectValidator`);
var Ni = Mi,
Pi = class extends z {
handle(e) {
return R.ok(e);
}
};
g(Pi, `PassthroughValidator`);
var Fi = Pi,
Ii = class extends z {
constructor(e, t = {}, n = []) {
(super(t, n), (this.validator = e));
}
clone() {
return Reflect.construct(this.constructor, [
this.validator,
this.validatorOptions,
this.constraints,
]);
}
handle(e) {
if (typeof e != `object`)
return R.err(
new q(`s.record(T)`, this.validatorOptions.message ?? `Expected an object`, e),
);
if (e === null)
return R.err(
new q(
`s.record(T)`,
this.validatorOptions.message ?? `Expected the value to not be null`,
e,
),
);
if (Array.isArray(e))
return R.err(
new q(
`s.record(T)`,
this.validatorOptions.message ?? `Expected the value to not be an array`,
e,
),
);
if (!this.shouldRunConstraints) return R.ok(e);
let t = [],
n = {};
for (let [r, i] of Object.entries(e)) {
let e = this.validator.run(i);
e.isOk() ? (n[r] = e.value) : t.push([r, e.error]);
}
return t.length === 0 ? R.ok(n) : R.err(new wr(t, this.validatorOptions));
}
};
g(Ii, `RecordValidator`);
var Li = Ii,
Ri = class extends z {
constructor(e, t, n = []) {
(super(t, n), (this.validator = e));
}
clone() {
return Reflect.construct(this.constructor, [
this.validator,
this.validatorOptions,
this.constraints,
]);
}
handle(e) {
if (!(e instanceof Set))
return R.err(new q(`s.set(T)`, this.validatorOptions.message ?? `Expected a set`, e));
if (!this.shouldRunConstraints) return R.ok(e);
let t = [],
n = new Set();
for (let r of e) {
let e = this.validator.run(r);
e.isOk() ? n.add(e.value) : t.push(e.error);
}
return t.length === 0 ? R.ok(n) : R.err(new ki(t, this.validatorOptions));
}
};
g(Ri, `SetValidator`);
var zi = Ri,
Bi = /^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]$/i;
function Vi(e) {
if (!e) return !1;
let t = e.indexOf(`@`);
if (t === -1 || t > 64) return !1;
let n = t + 1;
if (e.includes(`@`, n) || e.length - n > 255) return !1;
let r = e.indexOf(`.`, n);
if (r === -1) return !1;
let i = n;
do {
if (r - i > 63) return !1;
i = r + 1;
} while ((r = e.indexOf(`.`, i)) !== -1);
return e.length - i > 63 ? !1 : Bi.test(e.slice(0, t)) && Hi(e.slice(n));
}
g(Vi, `validateEmail`);
function Hi(e) {
try {
return new URL(`http://${e}`).hostname === e;
} catch {
return !1;
}
}
g(Hi, `validateEmailDomain`);
var Ui = `(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])`,
X = `(${Ui}[.]){3}${Ui}`,
Wi = RegExp(`^${X}$`),
Z = `(?:[0-9a-fA-F]{1,4})`,
Gi = RegExp(
`^((?:${Z}:){7}(?:${Z}|:)|(?:${Z}:){6}(?:${X}|:${Z}|:)|(?:${Z}:){5}(?::${X}|(:${Z}){1,2}|:)|(?:${Z}:){4}(?:(:${Z}){0,1}:${X}|(:${Z}){1,3}|:)|(?:${Z}:){3}(?:(:${Z}){0,2}:${X}|(:${Z}){1,4}|:)|(?:${Z}:){2}(?:(:${Z}){0,3}:${X}|(:${Z}){1,5}|:)|(?:${Z}:){1}(?:(:${Z}){0,4}:${X}|(:${Z}){1,6}|:)|(?::((?::${Z}){0,5}:${X}|(?::${Z}){1,7}|:)))(%[0-9a-zA-Z-.:]{1,})?$`,
);
function Ki(e) {
return Wi.test(e);
}
g(Ki, `isIPv4`);
function qi(e) {
return Gi.test(e);
}
g(qi, `isIPv6`);
function Ji(e) {
return Ki(e) ? 4 : qi(e) ? 6 : 0;
}
g(Ji, `isIP`);
var Yi = /^((?:\+|0{0,2})\d{1,2}\s?)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$/;
function Xi(e) {
return Yi.test(e);
}
g(Xi, `validatePhoneNumber`);
var Zi = class extends nr {
constructor(e, t, n, r) {
(super(e, t, n), (this.expected = r));
}
toJSON() {
return {
name: this.name,
message: this.message,
constraint: this.constraint,
given: this.given,
expected: this.expected,
};
}
[I](e, t) {
let n = t.stylize(this.constraint, `string`);
if (e < 0) return t.stylize(`[MultiplePossibilitiesConstraintError: ${n}]`, `special`);
let r = { ...t, depth: t.depth === null ? null : t.depth - 1 },
i = t.stylize(`|`, `undefined`),
a = `
${i} `,
o = Zn(this.given, r).replace(/\n/g, a),
s = `${t.stylize(`MultiplePossibilitiesConstraintError`, `special`)} > ${n}`,
c = t.stylize(this.message, `regexp`),
l = `
${i} - `;
return `${s}
${c}
${`
${t.stylize(`Expected any of the following:`, `string`)}${l}${this.expected.map((e) => t.stylize(e, `boolean`)).join(l)}`}
${`
${t.stylize(`Received:`, `regexp`)}${a}${o}`}`;
}
};
g(Zi, `MultiplePossibilitiesConstraintError`);
var Qi = Zi;
function $i(...e) {
switch (e.length) {
case 0:
return () => null;
case 1:
return e[0];
case 2: {
let [t, n] = e;
return (...e) => t(...e) || n(...e);
}
default:
return (...t) => {
for (let n of e) {
let e = n(...t);
if (e) return e;
}
return null;
};
}
}
g($i, `combinedErrorFn`);
function ea(e, t) {
let n = [];
return (
e?.allowedProtocols?.length && n.push(ta(e.allowedProtocols, t)),
e?.allowedDomains?.length && n.push(na(e.allowedDomains, t)),
$i(...n)
);
}
g(ea, `createUrlValidators`);
function ta(e, t) {
return (n, r) =>
e.includes(r.protocol)
? null
: new Qi(`s.string().url()`, t?.message ?? `Invalid URL protocol`, n, e);
}
g(ta, `allowedProtocolsFn`);
function na(e, t) {
return (n, r) =>
e.includes(r.hostname)
? null
: new Qi(`s.string().url()`, t?.message ?? `Invalid URL domain`, n, e);
}
g(na, `allowedDomainsFn`);
function ra(e, t, n, r, i) {
return {
run(a) {
return e(a.length, r)
? R.ok(a)
: R.err(new L(t, i?.message ?? `Invalid string length`, a, n));
},
};
}
g(ra, `stringLengthComparator`);
function ia(e, t) {
return ra(B, `s.string().lengthLessThan()`, `expected.length < ${e}`, e, t);
}
g(ia, `stringLengthLessThan`);
function aa(e, t) {
return ra(V, `s.string().lengthLessThanOrEqual()`, `expected.length <= ${e}`, e, t);
}
g(aa, `stringLengthLessThanOrEqual`);
function oa(e, t) {
return ra(H, `s.string().lengthGreaterThan()`, `expected.length > ${e}`, e, t);
}
g(oa, `stringLengthGreaterThan`);
function sa(e, t) {
return ra(U, `s.string().lengthGreaterThanOrEqual()`, `expected.length >= ${e}`, e, t);
}
g(sa, `stringLengthGreaterThanOrEqual`);
function ca(e, t) {
return ra(W, `s.string().lengthEqual()`, `expected.length === ${e}`, e, t);
}
g(ca, `stringLengthEqual`);
function la(e, t) {
return ra(G, `s.string().lengthNotEqual()`, `expected.length !== ${e}`, e, t);
}
g(la, `stringLengthNotEqual`);
function ua(e) {
return {
run(t) {
return Vi(t)
? R.ok(t)
: R.err(
new L(
`s.string().email()`,
e?.message ?? `Invalid email address`,
t,
`expected to be an email address`,
),
);
},
};
}
g(ua, `stringEmail`);
function da(e, t, n, r) {
return {
run(i) {
return n.test(i) ? R.ok(i) : R.err(new L(e, r?.message ?? `Invalid string format`, i, t));
},
};
}
g(da, `stringRegexValidator`);
function fa(e, t) {
let n = ea(e, t);
return {
run(e) {
let r;
try {
r = new URL(e);
} catch {
return R.err(
new L(`s.string().url()`, t?.message ?? `Invalid URL`, e, `expected to match a URL`),
);
}
let i = n(e, r);
return i === null ? R.ok(e) : R.err(i);
},
};
}
g(fa, `stringUrl`);
function pa(e, t) {
let n = e ? `v${e}` : ``,
r = e === 4 ? Ki : e === 6 ? qi : Ji,
i = `s.string().ip${n}()`,
a = `Invalid IP${n} address`,
o = `expected to be an IP${n} address`;
return {
run(e) {
return r(e) ? R.ok(e) : R.err(new L(i, t?.message ?? a, e, o));
},
};
}
g(pa, `stringIp`);
function ma(e, t) {
return da(`s.string().regex()`, `expected ${e}.test(expected) to be true`, e, t);
}
g(ma, `stringRegex`);
function ha({ version: e = 4, nullable: t = !1 } = {}, n) {
e ??= `1-5`;
let r = RegExp(
`^(?:[0-9A-F]{8}-[0-9A-F]{4}-[${e}][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}${t ? `|00000000-0000-0000-0000-000000000000` : ``})$`,
`i`,
);
return da(
`s.string().uuid()`,
`expected to match UUID${typeof e == `number` ? `v${e}` : ` in range of ${e}`}`,
r,
n,
);
}
g(ha, `stringUuid`);
function ga(e) {
return {
run(t) {
let n = Date.parse(t);
return Number.isNaN(n)
? R.err(
new L(
`s.string().date()`,
e?.message ?? `Invalid date string`,
t,
`expected to be a valid date string (in the ISO 8601 or ECMA-262 format)`,
),
)
: R.ok(t);
},
};
}
g(ga, `stringDate`);
function _a(e) {
return {
run(t) {
return Xi(t)
? R.ok(t)
: R.err(
new L(
`s.string().phone()`,
e?.message ?? `Invalid phone number`,
t,
`expected to be a phone number`,
),
);
},
};
}
g(_a, `stringPhone`);
var va = class extends z {
lengthLessThan(e, t = this.validatorOptions) {
return this.addConstraint(ia(e, t));
}
lengthLessThanOrEqual(e, t = this.validatorOptions) {
return this.addConstraint(aa(e, t));
}
lengthGreaterThan(e, t = this.validatorOptions) {
return this.addConstraint(oa(e, t));
}
lengthGreaterThanOrEqual(e, t = this.validatorOptions) {
return this.addConstraint(sa(e, t));
}
lengthEqual(e, t = this.validatorOptions) {
return this.addConstraint(ca(e, t));
}
lengthNotEqual(e, t = this.validatorOptions) {
return this.addConstraint(la(e, t));
}
email(e = this.validatorOptions) {
return this.addConstraint(ua(e));
}
url(e, t = this.validatorOptions) {
return this.isUrlOptions(e) ? this.addConstraint(fa(e, t)) : this.addConstraint(fa(void 0, t));
}
uuid(e, t = this.validatorOptions) {
return this.isStringUuidOptions(e)
? this.addConstraint(ha(e, t))
: this.addConstraint(ha(void 0, t));
}
regex(e, t = this.validatorOptions) {
return this.addConstraint(ma(e, t));
}
date(e = this.validatorOptions) {
return this.addConstraint(ga(e));
}
ipv4(e = this.validatorOptions) {
return this.ip(4, e);
}
ipv6(e = this.validatorOptions) {
return this.ip(6, e);
}
ip(e, t = this.validatorOptions) {
return this.addConstraint(pa(e, t));
}
phone(e = this.validatorOptions) {
return this.addConstraint(_a(e));
}
handle(e) {
return typeof e == `string`
? R.ok(e)
: R.err(
new q(`s.string()`, this.validatorOptions.message ?? `Expected a string primitive`, e),
);
}
isUrlOptions(e) {
return e?.message === void 0;
}
isStringUuidOptions(e) {
return e?.message === void 0;
}
};
g(va, `StringValidator`);
var ya = va,
ba = class extends z {
constructor(e, t = {}, n = []) {
(super(t, n), (this.validators = []), (this.validators = e));
}
clone() {
return Reflect.construct(this.constructor, [
this.validators,
this.validatorOptions,
this.constraints,
]);
}
handle(e) {
if (!Array.isArray(e))
return R.err(new q(`s.tuple(T)`, this.validatorOptions.message ?? `Expected an array`, e));
if (e.length !== this.validators.length)
return R.err(
new q(
`s.tuple(T)`,
this.validatorOptions.message ??
`Expected an array of length ${this.validators.length}`,
e,
),
);
if (!this.shouldRunConstraints) return R.ok(e);
let t = [],
n = [];
for (let r = 0; r < e.length; r++) {
let i = this.validators[r].run(e[r]);
i.isOk() ? n.push(i.value) : t.push([r, i.error]);
}
return t.length === 0 ? R.ok(n) : R.err(new wr(t, this.validatorOptions));
}
};
g(ba, `TupleValidator`);
var xa = ba,
Sa = class extends z {
constructor(e, t, n = {}, r = []) {
(super(n, r), (this.keyValidator = e), (this.valueValidator = t));
}
clone() {
return Reflect.construct(this.constructor, [
this.keyValidator,
this.valueValidator,
this.validatorOptions,
this.constraints,
]);
}
handle(e) {
if (!(e instanceof Map))
return R.err(new q(`s.map(K, V)`, this.validatorOptions.message ?? `Expected a map`, e));
if (!this.shouldRunConstraints) return R.ok(e);
let t = [],
n = new Map();
for (let [r, i] of e.entries()) {
let e = this.keyValidator.run(r),
a = this.valueValidator.run(i),
{ length: o } = t;
(e.isErr() && t.push([r, e.error]),
a.isErr() && t.push([r, a.error]),
t.length === o && n.set(e.value, a.value));
}
return t.length === 0 ? R.ok(n) : R.err(new wr(t, this.validatorOptions));
}
};
g(Sa, `MapValidator`);
var Ca = Sa,
wa = class extends z {
constructor(e, t = {}, n = []) {
(super(t, n), (this.validator = e));
}
clone() {
return Reflect.construct(this.constructor, [
this.validator,
this.validatorOptions,
this.constraints,
]);
}
handle(e) {
return this.validator(e).run(e);
}
};
g(wa, `LazyValidator`);
var Ta = wa,
Ea = class extends er {
constructor(e, t, n, r) {
(super(r?.message ?? `Expected the value to be one of the following enum values:`),
(this.value = e),
(this.enumKeys = t),
(this.enumMappings = n));
}
toJSON() {
return {
name: this.name,
message: this.message,
value: this.value,
enumKeys: this.enumKeys,
enumMappings: [...this.enumMappings.entries()],
};
}
[I](e, t) {
let n = t.stylize(this.value.toString(), `string`);
if (e < 0) return t.stylize(`[UnknownEnumValueError: ${n}]`, `special`);
let r = `
${t.stylize(`|`, `undefined`)} `,
i = this.enumKeys
.map((e) => {
let n = this.enumMappings.get(e);
return `${t.stylize(e, `string`)} or ${t.stylize(n.toString(), typeof n == `number` ? `number` : `string`)}`;
})
.join(r);
return `${`${t.stylize(`UnknownEnumValueError`, `special`)} > ${n}`}
${t.stylize(this.message, `regexp`)}
${`${r}${i}`}`;
}
};
g(Ea, `UnknownEnumValueError`);
var Da = Ea,
Oa = class extends z {
constructor(e, t = {}) {
(super(t),
(this.hasNumericElements = !1),
(this.enumMapping = new Map()),
(this.enumShape = e),
(this.enumKeys = Object.keys(e).filter((t) => typeof e[e[t]] != `number`)));
for (let t of this.enumKeys) {
let n = e[t];
(this.enumMapping.set(t, n),
this.enumMapping.set(n, n),
typeof n == `number` &&
((this.hasNumericElements = !0), this.enumMapping.set(`${n}`, n)));
}
}
handle(e) {
let t = typeof e;
if (t === `number`) {
if (!this.hasNumericElements)
return R.err(
new q(
`s.nativeEnum(T)`,
this.validatorOptions.message ?? `Expected the value to be a string`,
e,
),
);
} else if (t !== `string`)
return R.err(
new q(
`s.nativeEnum(T)`,
this.validatorOptions.message ?? `Expected the value to be a string or number`,
e,
),
);
let n = e,
r = this.enumMapping.get(n);
return r === void 0
? R.err(new Da(n, this.enumKeys, this.enumMapping, this.validatorOptions))
: R.ok(r);
}
clone() {
return Reflect.construct(this.constructor, [this.enumShape, this.validatorOptions]);
}
};
g(Oa, `NativeEnumValidator`);
var ka = Oa;
function Aa(e, t, n, r, i) {
return {
run(a) {
return e(a.byteLength, r)
? R.ok(a)
: R.err(new L(t, i?.message ?? `Invalid Typed Array byte length`, a, n));
},
};
}
g(Aa, `typedArrayByteLengthComparator`);
function ja(e, t) {
return Aa(B, `s.typedArray(T).byteLengthLessThan()`, `expected.byteLength < ${e}`, e, t);
}
g(ja, `typedArrayByteLengthLessThan`);
function Ma(e, t) {
return Aa(V, `s.typedArray(T).byteLengthLessThanOrEqual()`, `expected.byteLength <= ${e}`, e, t);
}
g(Ma, `typedArrayByteLengthLessThanOrEqual`);
function Na(e, t) {
return Aa(H, `s.typedArray(T).byteLengthGreaterThan()`, `expected.byteLength > ${e}`, e, t);
}
g(Na, `typedArrayByteLengthGreaterThan`);
function Pa(e, t) {
return Aa(
U,
`s.typedArray(T).byteLengthGreaterThanOrEqual()`,
`expected.byteLength >= ${e}`,
e,
t,
);
}
g(Pa, `typedArrayByteLengthGreaterThanOrEqual`);
function Fa(e, t) {
return Aa(W, `s.typedArray(T).byteLengthEqual()`, `expected.byteLength === ${e}`, e, t);
}
g(Fa, `typedArrayByteLengthEqual`);
function Ia(e, t) {
return Aa(G, `s.typedArray(T).byteLengthNotEqual()`, `expected.byteLength !== ${e}`, e, t);
}
g(Ia, `typedArrayByteLengthNotEqual`);
function La(e, t, n) {
let r = `expected.byteLength >= ${e} && expected.byteLength < ${t}`;
return {
run(i) {
return i.byteLength >= e && i.byteLength < t
? R.ok(i)
: R.err(
new L(
`s.typedArray(T).byteLengthRange()`,
n?.message ?? `Invalid Typed Array byte length`,
i,
r,
),
);
},
};
}
g(La, `typedArrayByteLengthRange`);
function Ra(e, t, n) {
let r = `expected.byteLength >= ${e} && expected.byteLength <= ${t}`;
return {
run(i) {
return i.byteLength >= e && i.byteLength <= t
? R.ok(i)
: R.err(
new L(
`s.typedArray(T).byteLengthRangeInclusive()`,
n?.message ?? `Invalid Typed Array byte length`,
i,
r,
),
);
},
};
}
g(Ra, `typedArrayByteLengthRangeInclusive`);
function za(e, t, n) {
let r = `expected.byteLength > ${e} && expected.byteLength < ${t}`;
return {
run(i) {
return i.byteLength > e && i.byteLength < t
? R.ok(i)
: R.err(
new L(
`s.typedArray(T).byteLengthRangeExclusive()`,
n?.message ?? `Invalid Typed Array byte length`,
i,
r,
),
);
},
};
}
g(za, `typedArrayByteLengthRangeExclusive`);
function Q(e, t, n, r, i) {
return {
run(a) {
return e(a.length, r)
? R.ok(a)
: R.err(new L(t, i?.message ?? `Invalid Typed Array length`, a, n));
},
};
}
g(Q, `typedArrayLengthComparator`);
function Ba(e, t) {
return Q(B, `s.typedArray(T).lengthLessThan()`, `expected.length < ${e}`, e, t);
}
g(Ba, `typedArrayLengthLessThan`);
function Va(e, t) {
return Q(V, `s.typedArray(T).lengthLessThanOrEqual()`, `expected.length <= ${e}`, e, t);
}
g(Va, `typedArrayLengthLessThanOrEqual`);
function Ha(e, t) {
return Q(H, `s.typedArray(T).lengthGreaterThan()`, `expected.length > ${e}`, e, t);
}
g(Ha, `typedArrayLengthGreaterThan`);
function Ua(e, t) {
return Q(U, `s.typedArray(T).lengthGreaterThanOrEqual()`, `expected.length >= ${e}`, e, t);
}
g(Ua, `typedArrayLengthGreaterThanOrEqual`);
function Wa(e, t) {
return Q(W, `s.typedArray(T).lengthEqual()`, `expected.length === ${e}`, e, t);
}
g(Wa, `typedArrayLengthEqual`);
function Ga(e, t) {
return Q(G, `s.typedArray(T).lengthNotEqual()`, `expected.length !== ${e}`, e, t);
}
g(Ga, `typedArrayLengthNotEqual`);
function Ka(e, t, n) {
let r = `expected.length >= ${e} && expected.length < ${t}`;
return {
run(i) {
return i.length >= e && i.length < t
? R.ok(i)
: R.err(
new L(
`s.typedArray(T).lengthRange()`,
n?.message ?? `Invalid Typed Array length`,
i,
r,
),
);
},
};
}
g(Ka, `typedArrayLengthRange`);
function qa(e, t, n) {
let r = `expected.length >= ${e} && expected.length <= ${t}`;
return {
run(i) {
return i.length >= e && i.length <= t
? R.ok(i)
: R.err(
new L(
`s.typedArray(T).lengthRangeInclusive()`,
n?.message ?? `Invalid Typed Array length`,
i,
r,
),
);
},
};
}
g(qa, `typedArrayLengthRangeInclusive`);
function Ja(e, t, n) {
let r = `expected.length > ${e} && expected.length < ${t}`;
return {
run(i) {
return i.length > e && i.length < t
? R.ok(i)
: R.err(
new L(
`s.typedArray(T).lengthRangeExclusive()`,
n?.message ?? `Invalid Typed Array length`,
i,
r,
),
);
},
};
}
g(Ja, `typedArrayLengthRangeExclusive`);
var Ya = [`a`, `e`, `i`, `o`, `u`],
Xa = g((e) => `${Ya.includes(e[0].toLowerCase()) ? `an` : `a`} ${e}`, `aOrAn`),
Za = {
Int8Array: (e) => e instanceof Int8Array,
Uint8Array: (e) => e instanceof Uint8Array,
Uint8ClampedArray: (e) => e instanceof Uint8ClampedArray,
Int16Array: (e) => e instanceof Int16Array,
Uint16Array: (e) => e instanceof Uint16Array,
Int32Array: (e) => e instanceof Int32Array,
Uint32Array: (e) => e instanceof Uint32Array,
Float32Array: (e) => e instanceof Float32Array,
Float64Array: (e) => e instanceof Float64Array,
BigInt64Array: (e) => e instanceof BigInt64Array,
BigUint64Array: (e) => e instanceof BigUint64Array,
TypedArray: (e) => ArrayBuffer.isView(e) && !(e instanceof DataView),
},
Qa = class extends z {
constructor(e, t = {}, n = []) {
(super(t, n), (this.type = e));
}
byteLengthLessThan(e, t = this.validatorOptions) {
return this.addConstraint(ja(e, t));
}
byteLengthLessThanOrEqual(e, t = this.validatorOptions) {
return this.addConstraint(Ma(e, t));
}
byteLengthGreaterThan(e, t = this.validatorOptions) {
return this.addConstraint(Na(e, t));
}
byteLengthGreaterThanOrEqual(e, t = this.validatorOptions) {
return this.addConstraint(Pa(e, t));
}
byteLengthEqual(e, t = this.validatorOptions) {
return this.addConstraint(Fa(e, t));
}
byteLengthNotEqual(e, t = this.validatorOptions) {
return this.addConstraint(Ia(e, t));
}
byteLengthRange(e, t, n = this.validatorOptions) {
return this.addConstraint(La(e, t, n));
}
byteLengthRangeInclusive(e, t, n = this.validatorOptions) {
return this.addConstraint(Ra(e, t, n));
}
byteLengthRangeExclusive(e, t, n = this.validatorOptions) {
return this.addConstraint(za(e, t, n));
}
lengthLessThan(e, t = this.validatorOptions) {
return this.addConstraint(Ba(e, t));
}
lengthLessThanOrEqual(e, t = this.validatorOptions) {
return this.addConstraint(Va(e, t));
}
lengthGreaterThan(e, t = this.validatorOptions) {
return this.addConstraint(Ha(e, t));
}
lengthGreaterThanOrEqual(e, t = this.validatorOptions) {
return this.addConstraint(Ua(e, t));
}
lengthEqual(e, t = this.validatorOptions) {
return this.addConstraint(Wa(e, t));
}
lengthNotEqual(e, t = this.validatorOptions) {
return this.addConstraint(Ga(e, t));
}
lengthRange(e, t, n = this.validatorOptions) {
return this.addConstraint(Ka(e, t, n));
}
lengthRangeInclusive(e, t, n = this.validatorOptions) {
return this.addConstraint(qa(e, t, n));
}
lengthRangeExclusive(e, t, n = this.validatorOptions) {
return this.addConstraint(Ja(e, t, n));
}
clone() {
return Reflect.construct(this.constructor, [
this.type,
this.validatorOptions,
this.constraints,
]);
}
handle(e) {
return Za[this.type](e)
? R.ok(e)
: R.err(
new q(
`s.typedArray()`,
this.validatorOptions.message ?? `Expected ${Xa(this.type)}`,
e,
),
);
}
};
g(Qa, `TypedArrayValidator`);
var $a = Qa,
eo = class {
string(e) {
return new ya(e);
}
number(e) {
return new xi(e);
}
bigint(e) {
return new Lr(e);
}
boolean(e) {
return new Vr(e);
}
date(e) {
return new Qr(e);
}
object(e, t) {
return new Ni(e, 0, t);
}
undefined(e) {
return this.literal(void 0, { equalsOptions: e });
}
null(e) {
return this.literal(null, { equalsOptions: e });
}
nullish(e) {
return new Y(e);
}
any(e) {
return new Fi(e);
}
unknown(e) {
return new Fi(e);
}
never(e) {
return new ai(e);
}
enum(e, t) {
return this.union(
e.map((e) => this.literal(e, { equalsOptions: t })),
t,
);
}
nativeEnum(e, t) {
return new ka(e, t);
}
literal(e, t) {
return e instanceof Date
? this.date(t?.dateOptions).equal(e, t?.equalsOptions)
: new J(e, t?.equalsOptions);
}
instance(e, t) {
return new ni(e, t);
}
union(e, t) {
return new ji(e, t);
}
array(e, t) {
return new Dr(e, t);
}
typedArray(e = `TypedArray`, t) {
return new $a(e, t);
}
int8Array(e) {
return this.typedArray(`Int8Array`, e);
}
uint8Array(e) {
return this.typedArray(`Uint8Array`, e);
}
uint8ClampedArray(e) {
return this.typedArray(`Uint8ClampedArray`, e);
}
int16Array(e) {
return this.typedArray(`Int16Array`, e);
}
uint16Array(e) {
return this.typedArray(`Uint16Array`, e);
}
int32Array(e) {
return this.typedArray(`Int32Array`, e);
}
uint32Array(e) {
return this.typedArray(`Uint32Array`, e);
}
float32Array(e) {
return this.typedArray(`Float32Array`, e);
}
float64Array(e) {
return this.typedArray(`Float64Array`, e);
}
bigInt64Array(e) {
return this.typedArray(`BigInt64Array`, e);
}
bigUint64Array(e) {
return this.typedArray(`BigUint64Array`, e);
}
tuple(e, t) {
return new xa(e, t);
}
set(e, t) {
return new zi(e, t);
}
record(e, t) {
return new Li(e, t);
}
map(e, t, n) {
return new Ca(e, t, n);
}
lazy(e, t) {
return new Ta(e, t);
}
};
g(eo, `Shapes`);
var $ = new eo();
/**
* @license MIT
* @copyright 2020 Colin McDonnell
* @see https://github.com/colinhacks/zod/blob/master/LICENSE
*/
const to = $.object({
id: $.number(),
created: $.date(),
title: $.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
type: $.enum([`jpg`, `png`]),
size: $.number(),
url: $.string().url(),
}),
no = $.object({
id: $.number(),
stars: $.number().greaterThanOrEqual(0).lessThanOrEqual(5),
title: $.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
text: $.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(1e3),
images: $.array(to),
});
$.object({
id: $.number(),
created: $.date(),
title: $.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
brand: $.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(30),
description: $.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(500),
price: $.number().greaterThanOrEqual(1).lessThanOrEqual(1e4),
discount: $.number().greaterThanOrEqual(1).lessThanOrEqual(100).nullable(),
quantity: $.number().greaterThanOrEqual(0).lessThanOrEqual(10),
tags: $.array($.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(30)),
images: $.array(to),
ratings: $.array(no),
}).parse({});