storybook
Version:
Storybook framework-agnostic API
1,324 lines (1,314 loc) • 199 kB
JavaScript
"use strict";
var ra = Object.create;
var $e = Object.defineProperty;
var na = Object.getOwnPropertyDescriptor;
var sa = Object.getOwnPropertyNames;
var oa = Object.getPrototypeOf, ia = Object.prototype.hasOwnProperty;
var i = (t, e) => $e(t, "name", { value: e, configurable: !0 });
var aa = (t, e) => () => (t && (e = t(t = 0)), e);
var S = (t, e) => () => (e || t((e = { exports: {} }).exports, e), e.exports), ca = (t, e) => {
for (var r in e)
$e(t, r, { get: e[r], enumerable: !0 });
}, gn = (t, e, r, n) => {
if (e && typeof e == "object" || typeof e == "function")
for (let s of sa(e))
!ia.call(t, s) && s !== r && $e(t, s, { get: () => e[s], enumerable: !(n = na(e, s)) || n.enumerable });
return t;
};
var T = (t, e, r) => (r = t != null ? ra(oa(t)) : {}, gn(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
e || !t || !t.__esModule ? $e(r, "default", { value: t, enumerable: !0 }) : r,
t
)), da = (t) => gn($e({}, "__esModule", { value: !0 }), t);
// ../node_modules/picocolors/picocolors.js
var vn = S((nl, tr) => {
var ut = process || {}, bn = ut.argv || [], dt = ut.env || {}, ua = !(dt.NO_COLOR || bn.includes("--no-color")) && (!!dt.FORCE_COLOR || bn.
includes("--color") || ut.platform === "win32" || (ut.stdout || {}).isTTY && dt.TERM !== "dumb" || !!dt.CI), la = /* @__PURE__ */ i((t, e, r = t) => (n) => {
let s = "" + n, o = s.indexOf(e, t.length);
return ~o ? t + pa(s, e, r, o) + e : t + s + e;
}, "formatter"), pa = /* @__PURE__ */ i((t, e, r, n) => {
let s = "", o = 0;
do
s += t.substring(o, n) + r, o = n + e.length, n = t.indexOf(e, o);
while (~n);
return s + t.substring(o);
}, "replaceClose"), xn = /* @__PURE__ */ i((t = ua) => {
let e = t ? la : () => String;
return {
isColorSupported: t,
reset: e("\x1B[0m", "\x1B[0m"),
bold: e("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
dim: e("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
italic: e("\x1B[3m", "\x1B[23m"),
underline: e("\x1B[4m", "\x1B[24m"),
inverse: e("\x1B[7m", "\x1B[27m"),
hidden: e("\x1B[8m", "\x1B[28m"),
strikethrough: e("\x1B[9m", "\x1B[29m"),
black: e("\x1B[30m", "\x1B[39m"),
red: e("\x1B[31m", "\x1B[39m"),
green: e("\x1B[32m", "\x1B[39m"),
yellow: e("\x1B[33m", "\x1B[39m"),
blue: e("\x1B[34m", "\x1B[39m"),
magenta: e("\x1B[35m", "\x1B[39m"),
cyan: e("\x1B[36m", "\x1B[39m"),
white: e("\x1B[37m", "\x1B[39m"),
gray: e("\x1B[90m", "\x1B[39m"),
bgBlack: e("\x1B[40m", "\x1B[49m"),
bgRed: e("\x1B[41m", "\x1B[49m"),
bgGreen: e("\x1B[42m", "\x1B[49m"),
bgYellow: e("\x1B[43m", "\x1B[49m"),
bgBlue: e("\x1B[44m", "\x1B[49m"),
bgMagenta: e("\x1B[45m", "\x1B[49m"),
bgCyan: e("\x1B[46m", "\x1B[49m"),
bgWhite: e("\x1B[47m", "\x1B[49m"),
blackBright: e("\x1B[90m", "\x1B[39m"),
redBright: e("\x1B[91m", "\x1B[39m"),
greenBright: e("\x1B[92m", "\x1B[39m"),
yellowBright: e("\x1B[93m", "\x1B[39m"),
blueBright: e("\x1B[94m", "\x1B[39m"),
magentaBright: e("\x1B[95m", "\x1B[39m"),
cyanBright: e("\x1B[96m", "\x1B[39m"),
whiteBright: e("\x1B[97m", "\x1B[39m"),
bgBlackBright: e("\x1B[100m", "\x1B[49m"),
bgRedBright: e("\x1B[101m", "\x1B[49m"),
bgGreenBright: e("\x1B[102m", "\x1B[49m"),
bgYellowBright: e("\x1B[103m", "\x1B[49m"),
bgBlueBright: e("\x1B[104m", "\x1B[49m"),
bgMagentaBright: e("\x1B[105m", "\x1B[49m"),
bgCyanBright: e("\x1B[106m", "\x1B[49m"),
bgWhiteBright: e("\x1B[107m", "\x1B[49m")
};
}, "createColors");
tr.exports = xn();
tr.exports.createColors = xn;
});
// ../node_modules/walk-up-path/dist/cjs/index.js
var Sn = S((lt) => {
"use strict";
Object.defineProperty(lt, "__esModule", { value: !0 });
lt.walkUp = void 0;
var In = require("path"), fa = /* @__PURE__ */ i(function* (t) {
for (t = (0, In.resolve)(t); t; ) {
yield t;
let e = (0, In.dirname)(t);
if (e === t)
break;
t = e;
}
}, "walkUp");
lt.walkUp = fa;
});
// ../node_modules/zod/lib/helpers/util.js
var Fe = S((C) => {
"use strict";
Object.defineProperty(C, "__esModule", { value: !0 });
C.getParsedType = C.ZodParsedType = C.objectUtil = C.util = void 0;
var lr;
(function(t) {
t.assertEqual = (s) => s;
function e(s) {
}
i(e, "assertIs"), t.assertIs = e;
function r(s) {
throw new Error();
}
i(r, "assertNever"), t.assertNever = r, t.arrayToEnum = (s) => {
let o = {};
for (let a of s)
o[a] = a;
return o;
}, t.getValidEnumValues = (s) => {
let o = t.objectKeys(s).filter((c) => typeof s[s[c]] != "number"), a = {};
for (let c of o)
a[c] = s[c];
return t.objectValues(a);
}, t.objectValues = (s) => t.objectKeys(s).map(function(o) {
return s[o];
}), t.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
let o = [];
for (let a in s)
Object.prototype.hasOwnProperty.call(s, a) && o.push(a);
return o;
}, t.find = (s, o) => {
for (let a of s)
if (o(a))
return a;
}, t.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.
floor(s) === s;
function n(s, o = " | ") {
return s.map((a) => typeof a == "string" ? `'${a}'` : a).join(o);
}
i(n, "joinValues"), t.joinValues = n, t.jsonStringifyReplacer = (s, o) => typeof o == "bigint" ? o.toString() : o;
})(lr || (C.util = lr = {}));
var Nn;
(function(t) {
t.mergeShapes = (e, r) => ({
...e,
...r
// second overwrites first
});
})(Nn || (C.objectUtil = Nn = {}));
C.ZodParsedType = lr.arrayToEnum([
"string",
"nan",
"number",
"integer",
"float",
"boolean",
"date",
"bigint",
"symbol",
"function",
"undefined",
"null",
"array",
"object",
"unknown",
"promise",
"void",
"never",
"map",
"set"
]);
var va = /* @__PURE__ */ i((t) => {
switch (typeof t) {
case "undefined":
return C.ZodParsedType.undefined;
case "string":
return C.ZodParsedType.string;
case "number":
return isNaN(t) ? C.ZodParsedType.nan : C.ZodParsedType.number;
case "boolean":
return C.ZodParsedType.boolean;
case "function":
return C.ZodParsedType.function;
case "bigint":
return C.ZodParsedType.bigint;
case "symbol":
return C.ZodParsedType.symbol;
case "object":
return Array.isArray(t) ? C.ZodParsedType.array : t === null ? C.ZodParsedType.null : t.then && typeof t.then == "function" && t.catch &&
typeof t.catch == "function" ? C.ZodParsedType.promise : typeof Map < "u" && t instanceof Map ? C.ZodParsedType.map : typeof Set < "\
u" && t instanceof Set ? C.ZodParsedType.set : typeof Date < "u" && t instanceof Date ? C.ZodParsedType.date : C.ZodParsedType.object;
default:
return C.ZodParsedType.unknown;
}
}, "getParsedType");
C.getParsedType = va;
});
// ../node_modules/zod/lib/ZodError.js
var mt = S((Y) => {
"use strict";
Object.defineProperty(Y, "__esModule", { value: !0 });
Y.ZodError = Y.quotelessJson = Y.ZodIssueCode = void 0;
var Zn = Fe();
Y.ZodIssueCode = Zn.util.arrayToEnum([
"invalid_type",
"invalid_literal",
"custom",
"invalid_union",
"invalid_union_discriminator",
"invalid_enum_value",
"unrecognized_keys",
"invalid_arguments",
"invalid_return_type",
"invalid_date",
"invalid_string",
"too_small",
"too_big",
"invalid_intersection_types",
"not_multiple_of",
"not_finite"
]);
var _a = /* @__PURE__ */ i((t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:"), "quotelessJson");
Y.quotelessJson = _a;
var Be = class t extends Error {
static {
i(this, "ZodError");
}
get errors() {
return this.issues;
}
constructor(e) {
super(), this.issues = [], this.addIssue = (n) => {
this.issues = [...this.issues, n];
}, this.addIssues = (n = []) => {
this.issues = [...this.issues, ...n];
};
let r = new.target.prototype;
Object.setPrototypeOf ? Object.setPrototypeOf(this, r) : this.__proto__ = r, this.name = "ZodError", this.issues = e;
}
format(e) {
let r = e || function(o) {
return o.message;
}, n = { _errors: [] }, s = /* @__PURE__ */ i((o) => {
for (let a of o.issues)
if (a.code === "invalid_union")
a.unionErrors.map(s);
else if (a.code === "invalid_return_type")
s(a.returnTypeError);
else if (a.code === "invalid_arguments")
s(a.argumentsError);
else if (a.path.length === 0)
n._errors.push(r(a));
else {
let c = n, l = 0;
for (; l < a.path.length; ) {
let p = a.path[l];
l === a.path.length - 1 ? (c[p] = c[p] || { _errors: [] }, c[p]._errors.push(r(a))) : c[p] = c[p] || { _errors: [] }, c = c[p],
l++;
}
}
}, "processError");
return s(this), n;
}
static assert(e) {
if (!(e instanceof t))
throw new Error(`Not a ZodError: ${e}`);
}
toString() {
return this.message;
}
get message() {
return JSON.stringify(this.issues, Zn.util.jsonStringifyReplacer, 2);
}
get isEmpty() {
return this.issues.length === 0;
}
flatten(e = (r) => r.message) {
let r = {}, n = [];
for (let s of this.issues)
s.path.length > 0 ? (r[s.path[0]] = r[s.path[0]] || [], r[s.path[0]].push(e(s))) : n.push(e(s));
return { formErrors: n, fieldErrors: r };
}
get formErrors() {
return this.flatten();
}
};
Y.ZodError = Be;
Be.create = (t) => new Be(t);
});
// ../node_modules/zod/lib/locales/en.js
var fr = S((pr) => {
"use strict";
Object.defineProperty(pr, "__esModule", { value: !0 });
var ne = Fe(), O = mt(), wa = /* @__PURE__ */ i((t, e) => {
let r;
switch (t.code) {
case O.ZodIssueCode.invalid_type:
t.received === ne.ZodParsedType.undefined ? r = "Required" : r = `Expected ${t.expected}, received ${t.received}`;
break;
case O.ZodIssueCode.invalid_literal:
r = `Invalid literal value, expected ${JSON.stringify(t.expected, ne.util.jsonStringifyReplacer)}`;
break;
case O.ZodIssueCode.unrecognized_keys:
r = `Unrecognized key(s) in object: ${ne.util.joinValues(t.keys, ", ")}`;
break;
case O.ZodIssueCode.invalid_union:
r = "Invalid input";
break;
case O.ZodIssueCode.invalid_union_discriminator:
r = `Invalid discriminator value. Expected ${ne.util.joinValues(t.options)}`;
break;
case O.ZodIssueCode.invalid_enum_value:
r = `Invalid enum value. Expected ${ne.util.joinValues(t.options)}, received '${t.received}'`;
break;
case O.ZodIssueCode.invalid_arguments:
r = "Invalid function arguments";
break;
case O.ZodIssueCode.invalid_return_type:
r = "Invalid function return type";
break;
case O.ZodIssueCode.invalid_date:
r = "Invalid date";
break;
case O.ZodIssueCode.invalid_string:
typeof t.validation == "object" ? "includes" in t.validation ? (r = `Invalid input: must include "${t.validation.includes}"`, typeof t.
validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${t.validation.position}`)) : "start\
sWith" in t.validation ? r = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? r = `Invalid input\
: must end with "${t.validation.endsWith}"` : ne.util.assertNever(t.validation) : t.validation !== "regex" ? r = `Invalid ${t.validation}` :
r = "Invalid";
break;
case O.ZodIssueCode.too_small:
t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` :
t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` :
t.type === "number" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater tha\
n "}${t.minimum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "gre\
ater than "}${new Date(Number(t.minimum))}` : r = "Invalid input";
break;
case O.ZodIssueCode.too_big:
t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "less than"} ${t.maximum} element(s)` :
t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "under"} ${t.maximum} character(s)` :
t.type === "number" ? r = `Number must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` :
t.type === "bigint" ? r = `BigInt must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` :
t.type === "date" ? r = `Date must be ${t.exact ? "exactly" : t.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(
Number(t.maximum))}` : r = "Invalid input";
break;
case O.ZodIssueCode.custom:
r = "Invalid input";
break;
case O.ZodIssueCode.invalid_intersection_types:
r = "Intersection results could not be merged";
break;
case O.ZodIssueCode.not_multiple_of:
r = `Number must be a multiple of ${t.multipleOf}`;
break;
case O.ZodIssueCode.not_finite:
r = "Number must be finite";
break;
default:
r = e.defaultError, ne.util.assertNever(t);
}
return { message: r };
}, "errorMap");
pr.default = wa;
});
// ../node_modules/zod/lib/errors.js
var ht = S((F) => {
"use strict";
var ka = F && F.__importDefault || function(t) {
return t && t.__esModule ? t : { default: t };
};
Object.defineProperty(F, "__esModule", { value: !0 });
F.getErrorMap = F.setErrorMap = F.defaultErrorMap = void 0;
var Mn = ka(fr());
F.defaultErrorMap = Mn.default;
var Dn = Mn.default;
function Ta(t) {
Dn = t;
}
i(Ta, "setErrorMap");
F.setErrorMap = Ta;
function Ia() {
return Dn;
}
i(Ia, "getErrorMap");
F.getErrorMap = Ia;
});
// ../node_modules/zod/lib/helpers/parseUtil.js
var hr = S((I) => {
"use strict";
var Sa = I && I.__importDefault || function(t) {
return t && t.__esModule ? t : { default: t };
};
Object.defineProperty(I, "__esModule", { value: !0 });
I.isAsync = I.isValid = I.isDirty = I.isAborted = I.OK = I.DIRTY = I.INVALID = I.ParseStatus = I.addIssueToContext = I.EMPTY_PATH = I.makeIssue =
void 0;
var Ea = ht(), Ln = Sa(fr()), Ca = /* @__PURE__ */ i((t) => {
let { data: e, path: r, errorMaps: n, issueData: s } = t, o = [...r, ...s.path || []], a = {
...s,
path: o
};
if (s.message !== void 0)
return {
...s,
path: o,
message: s.message
};
let c = "", l = n.filter((p) => !!p).slice().reverse();
for (let p of l)
c = p(a, { data: e, defaultError: c }).message;
return {
...s,
path: o,
message: c
};
}, "makeIssue");
I.makeIssue = Ca;
I.EMPTY_PATH = [];
function Pa(t, e) {
let r = (0, Ea.getErrorMap)(), n = (0, I.makeIssue)({
issueData: e,
data: t.data,
path: t.path,
errorMaps: [
t.common.contextualErrorMap,
// contextual error map is first priority
t.schemaErrorMap,
// then schema-bound map if available
r,
// then global override map
r === Ln.default ? void 0 : Ln.default
// then global default map
].filter((s) => !!s)
});
t.common.issues.push(n);
}
i(Pa, "addIssueToContext");
I.addIssueToContext = Pa;
var mr = class t {
static {
i(this, "ParseStatus");
}
constructor() {
this.value = "valid";
}
dirty() {
this.value === "valid" && (this.value = "dirty");
}
abort() {
this.value !== "aborted" && (this.value = "aborted");
}
static mergeArray(e, r) {
let n = [];
for (let s of r) {
if (s.status === "aborted")
return I.INVALID;
s.status === "dirty" && e.dirty(), n.push(s.value);
}
return { status: e.value, value: n };
}
static async mergeObjectAsync(e, r) {
let n = [];
for (let s of r) {
let o = await s.key, a = await s.value;
n.push({
key: o,
value: a
});
}
return t.mergeObjectSync(e, n);
}
static mergeObjectSync(e, r) {
let n = {};
for (let s of r) {
let { key: o, value: a } = s;
if (o.status === "aborted" || a.status === "aborted")
return I.INVALID;
o.status === "dirty" && e.dirty(), a.status === "dirty" && e.dirty(), o.value !== "__proto__" && (typeof a.value < "u" || s.alwaysSet) &&
(n[o.value] = a.value);
}
return { status: e.value, value: n };
}
};
I.ParseStatus = mr;
I.INVALID = Object.freeze({
status: "aborted"
});
var Aa = /* @__PURE__ */ i((t) => ({ status: "dirty", value: t }), "DIRTY");
I.DIRTY = Aa;
var Oa = /* @__PURE__ */ i((t) => ({ status: "valid", value: t }), "OK");
I.OK = Oa;
var ja = /* @__PURE__ */ i((t) => t.status === "aborted", "isAborted");
I.isAborted = ja;
var Ra = /* @__PURE__ */ i((t) => t.status === "dirty", "isDirty");
I.isDirty = Ra;
var Na = /* @__PURE__ */ i((t) => t.status === "valid", "isValid");
I.isValid = Na;
var Za = /* @__PURE__ */ i((t) => typeof Promise < "u" && t instanceof Promise, "isAsync");
I.isAsync = Za;
});
// ../node_modules/zod/lib/helpers/typeAliases.js
var $n = S((Un) => {
"use strict";
Object.defineProperty(Un, "__esModule", { value: !0 });
});
// ../node_modules/zod/lib/helpers/errorUtil.js
var Fn = S((yt) => {
"use strict";
Object.defineProperty(yt, "__esModule", { value: !0 });
yt.errorUtil = void 0;
var Vn;
(function(t) {
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e?.message;
})(Vn || (yt.errorUtil = Vn = {}));
});
// ../node_modules/zod/lib/types.js
var ts = S((d) => {
"use strict";
var bt = d && d.__classPrivateFieldGet || function(t, e, r, n) {
if (r === "a" && !n) throw new TypeError("Private accessor was defined without a getter");
if (typeof e == "function" ? t !== e || !n : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did n\
ot declare it");
return r === "m" ? n : r === "a" ? n.call(t) : n ? n.value : e.get(t);
}, qn = d && d.__classPrivateFieldSet || function(t, e, r, n, s) {
if (n === "m") throw new TypeError("Private method is not writable");
if (n === "a" && !s) throw new TypeError("Private accessor was defined without a setter");
if (typeof e == "function" ? t !== e || !s : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did no\
t declare it");
return n === "a" ? s.call(t, r) : s ? s.value = r : e.set(t, r), r;
}, We, qe;
Object.defineProperty(d, "__esModule", { value: !0 });
d.boolean = d.bigint = d.array = d.any = d.coerce = d.ZodFirstPartyTypeKind = d.late = d.ZodSchema = d.Schema = d.custom = d.ZodReadonly =
d.ZodPipeline = d.ZodBranded = d.BRAND = d.ZodNaN = d.ZodCatch = d.ZodDefault = d.ZodNullable = d.ZodOptional = d.ZodTransformer = d.ZodEffects =
d.ZodPromise = d.ZodNativeEnum = d.ZodEnum = d.ZodLiteral = d.ZodLazy = d.ZodFunction = d.ZodSet = d.ZodMap = d.ZodRecord = d.ZodTuple = d.
ZodIntersection = d.ZodDiscriminatedUnion = d.ZodUnion = d.ZodObject = d.ZodArray = d.ZodVoid = d.ZodNever = d.ZodUnknown = d.ZodAny = d.ZodNull =
d.ZodUndefined = d.ZodSymbol = d.ZodDate = d.ZodBoolean = d.ZodBigInt = d.ZodNumber = d.ZodString = d.datetimeRegex = d.ZodType = void 0;
d.NEVER = d.void = d.unknown = d.union = d.undefined = d.tuple = d.transformer = d.symbol = d.string = d.strictObject = d.set = d.record =
d.promise = d.preprocess = d.pipeline = d.ostring = d.optional = d.onumber = d.oboolean = d.object = d.number = d.nullable = d.null = d.never =
d.nativeEnum = d.nan = d.map = d.literal = d.lazy = d.intersection = d.instanceof = d.function = d.enum = d.effect = d.discriminatedUnion =
d.date = void 0;
var gt = ht(), y = Fn(), u = hr(), h = Fe(), m = mt(), L = class {
static {
i(this, "ParseInputLazyPath");
}
constructor(e, r, n, s) {
this._cachedPath = [], this.parent = e, this.data = r, this._path = n, this._key = s;
}
get path() {
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.
push(...this._path, this._key)), this._cachedPath;
}
}, Bn = /* @__PURE__ */ i((t, e) => {
if ((0, u.isValid)(e))
return { success: !0, data: e.value };
if (!t.common.issues.length)
throw new Error("Validation failed but no issues detected.");
return {
success: !1,
get error() {
if (this._error)
return this._error;
let r = new m.ZodError(t.common.issues);
return this._error = r, this._error;
}
};
}, "handleResult");
function x(t) {
if (!t)
return {};
let { errorMap: e, invalid_type_error: r, required_error: n, description: s } = t;
if (e && (r || n))
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
return e ? { errorMap: e, description: s } : { errorMap: /* @__PURE__ */ i((a, c) => {
var l, p;
let { message: f } = t;
return a.code === "invalid_enum_value" ? { message: f ?? c.defaultError } : typeof c.data > "u" ? { message: (l = f ?? n) !== null && l !==
void 0 ? l : c.defaultError } : a.code !== "invalid_type" ? { message: c.defaultError } : { message: (p = f ?? r) !== null && p !== void 0 ?
p : c.defaultError };
}, "customMap"), description: s };
}
i(x, "processCreateParams");
var v = class {
static {
i(this, "ZodType");
}
get description() {
return this._def.description;
}
_getType(e) {
return (0, h.getParsedType)(e.data);
}
_getOrReturnCtx(e, r) {
return r || {
common: e.parent.common,
data: e.data,
parsedType: (0, h.getParsedType)(e.data),
schemaErrorMap: this._def.errorMap,
path: e.path,
parent: e.parent
};
}
_processInputParams(e) {
return {
status: new u.ParseStatus(),
ctx: {
common: e.parent.common,
data: e.data,
parsedType: (0, h.getParsedType)(e.data),
schemaErrorMap: this._def.errorMap,
path: e.path,
parent: e.parent
}
};
}
_parseSync(e) {
let r = this._parse(e);
if ((0, u.isAsync)(r))
throw new Error("Synchronous parse encountered promise.");
return r;
}
_parseAsync(e) {
let r = this._parse(e);
return Promise.resolve(r);
}
parse(e, r) {
let n = this.safeParse(e, r);
if (n.success)
return n.data;
throw n.error;
}
safeParse(e, r) {
var n;
let s = {
common: {
issues: [],
async: (n = r?.async) !== null && n !== void 0 ? n : !1,
contextualErrorMap: r?.errorMap
},
path: r?.path || [],
schemaErrorMap: this._def.errorMap,
parent: null,
data: e,
parsedType: (0, h.getParsedType)(e)
}, o = this._parseSync({ data: e, path: s.path, parent: s });
return Bn(s, o);
}
"~validate"(e) {
var r, n;
let s = {
common: {
issues: [],
async: !!this["~standard"].async
},
path: [],
schemaErrorMap: this._def.errorMap,
parent: null,
data: e,
parsedType: (0, h.getParsedType)(e)
};
if (!this["~standard"].async)
try {
let o = this._parseSync({ data: e, path: [], parent: s });
return (0, u.isValid)(o) ? {
value: o.value
} : {
issues: s.common.issues
};
} catch (o) {
!((n = (r = o?.message) === null || r === void 0 ? void 0 : r.toLowerCase()) === null || n === void 0) && n.includes("encountered") &&
(this["~standard"].async = !0), s.common = {
issues: [],
async: !0
};
}
return this._parseAsync({ data: e, path: [], parent: s }).then((o) => (0, u.isValid)(o) ? {
value: o.value
} : {
issues: s.common.issues
});
}
async parseAsync(e, r) {
let n = await this.safeParseAsync(e, r);
if (n.success)
return n.data;
throw n.error;
}
async safeParseAsync(e, r) {
let n = {
common: {
issues: [],
contextualErrorMap: r?.errorMap,
async: !0
},
path: r?.path || [],
schemaErrorMap: this._def.errorMap,
parent: null,
data: e,
parsedType: (0, h.getParsedType)(e)
}, s = this._parse({ data: e, path: n.path, parent: n }), o = await ((0, u.isAsync)(s) ? s : Promise.resolve(s));
return Bn(n, o);
}
refine(e, r) {
let n = /* @__PURE__ */ i((s) => typeof r == "string" || typeof r > "u" ? { message: r } : typeof r == "function" ? r(s) : r, "getIssu\
eProperties");
return this._refinement((s, o) => {
let a = e(s), c = /* @__PURE__ */ i(() => o.addIssue({
code: m.ZodIssueCode.custom,
...n(s)
}), "setError");
return typeof Promise < "u" && a instanceof Promise ? a.then((l) => l ? !0 : (c(), !1)) : a ? !0 : (c(), !1);
});
}
refinement(e, r) {
return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof r == "function" ? r(n, s) : r), !1));
}
_refinement(e) {
return new Z({
schema: this,
typeName: g.ZodEffects,
effect: { type: "refinement", refinement: e }
});
}
superRefine(e) {
return this._refinement(e);
}
constructor(e) {
this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync =
this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.
bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.
bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.
promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(
this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe =
this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.
bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
version: 1,
vendor: "zod",
validate: /* @__PURE__ */ i((r) => this["~validate"](r), "validate")
};
}
optional() {
return D.create(this, this._def);
}
nullable() {
return W.create(this, this._def);
}
nullish() {
return this.nullable().optional();
}
array() {
return K.create(this);
}
promise() {
return ee.create(this, this._def);
}
or(e) {
return ue.create([this, e], this._def);
}
and(e) {
return le.create(this, e, this._def);
}
transform(e) {
return new Z({
...x(this._def),
schema: this,
typeName: g.ZodEffects,
effect: { type: "transform", transform: e }
});
}
default(e) {
let r = typeof e == "function" ? e : () => e;
return new ye({
...x(this._def),
innerType: this,
defaultValue: r,
typeName: g.ZodDefault
});
}
brand() {
return new Ge({
typeName: g.ZodBranded,
type: this,
...x(this._def)
});
}
catch(e) {
let r = typeof e == "function" ? e : () => e;
return new ge({
...x(this._def),
innerType: this,
catchValue: r,
typeName: g.ZodCatch
});
}
describe(e) {
let r = this.constructor;
return new r({
...this._def,
description: e
});
}
pipe(e) {
return ze.create(this, e);
}
readonly() {
return be.create(this);
}
isOptional() {
return this.safeParse(void 0).success;
}
isNullable() {
return this.safeParse(null).success;
}
};
d.ZodType = v;
d.Schema = v;
d.ZodSchema = v;
var Ma = /^c[^\s-]{8,}$/i, Da = /^[0-9a-z]+$/, La = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Ua = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,
$a = /^[a-z0-9_-]{21}$/i, Va = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Fa = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,
Ba = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Wa = "^(\\p{Extended_Pictographic}|\\p{Emoji_Comp\
onent})+$", yr, qa = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Ga = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
za = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,
Ka = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
Ja = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ha = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
Gn = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469\
]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Ya = new RegExp(`^${Gn}$`);
function zn(t) {
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
return t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`), e;
}
i(zn, "timeRegexSource");
function Xa(t) {
return new RegExp(`^${zn(t)}$`);
}
i(Xa, "timeRegex");
function Kn(t) {
let e = `${Gn}T${zn(t)}`, r = [];
return r.push(t.local ? "Z?" : "Z"), t.offset && r.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${r.join("|")})`, new RegExp(`^${e}$`);
}
i(Kn, "datetimeRegex");
d.datetimeRegex = Kn;
function Qa(t, e) {
return !!((e === "v4" || !e) && qa.test(t) || (e === "v6" || !e) && za.test(t));
}
i(Qa, "isValidIP");
function ec(t, e) {
if (!Va.test(t))
return !1;
try {
let [r] = t.split("."), n = r.replace(/-/g, "+").replace(/_/g, "/").padEnd(r.length + (4 - r.length % 4) % 4, "="), s = JSON.parse(atob(
n));
return !(typeof s != "object" || s === null || !s.typ || !s.alg || e && s.alg !== e);
} catch {
return !1;
}
}
i(ec, "isValidJWT");
function tc(t, e) {
return !!((e === "v4" || !e) && Ga.test(t) || (e === "v6" || !e) && Ka.test(t));
}
i(tc, "isValidCidr");
var X = class t extends v {
static {
i(this, "ZodString");
}
_parse(e) {
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== h.ZodParsedType.string) {
let o = this._getOrReturnCtx(e);
return (0, u.addIssueToContext)(o, {
code: m.ZodIssueCode.invalid_type,
expected: h.ZodParsedType.string,
received: o.parsedType
}), u.INVALID;
}
let n = new u.ParseStatus(), s;
for (let o of this._def.checks)
if (o.kind === "min")
e.data.length < o.value && (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.too_small,
minimum: o.value,
type: "string",
inclusive: !0,
exact: !1,
message: o.message
}), n.dirty());
else if (o.kind === "max")
e.data.length > o.value && (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.too_big,
maximum: o.value,
type: "string",
inclusive: !0,
exact: !1,
message: o.message
}), n.dirty());
else if (o.kind === "length") {
let a = e.data.length > o.value, c = e.data.length < o.value;
(a || c) && (s = this._getOrReturnCtx(e, s), a ? (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.too_big,
maximum: o.value,
type: "string",
inclusive: !0,
exact: !0,
message: o.message
}) : c && (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.too_small,
minimum: o.value,
type: "string",
inclusive: !0,
exact: !0,
message: o.message
}), n.dirty());
} else if (o.kind === "email")
Ba.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "email",
code: m.ZodIssueCode.invalid_string,
message: o.message
}), n.dirty());
else if (o.kind === "emoji")
yr || (yr = new RegExp(Wa, "u")), yr.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "emoji",
code: m.ZodIssueCode.invalid_string,
message: o.message
}), n.dirty());
else if (o.kind === "uuid")
Ua.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "uuid",
code: m.ZodIssueCode.invalid_string,
message: o.message
}), n.dirty());
else if (o.kind === "nanoid")
$a.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "nanoid",
code: m.ZodIssueCode.invalid_string,
message: o.message
}), n.dirty());
else if (o.kind === "cuid")
Ma.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "cuid",
code: m.ZodIssueCode.invalid_string,
message: o.message
}), n.dirty());
else if (o.kind === "cuid2")
Da.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "cuid2",
code: m.ZodIssueCode.invalid_string,
message: o.message
}), n.dirty());
else if (o.kind === "ulid")
La.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "ulid",
code: m.ZodIssueCode.invalid_string,
message: o.message
}), n.dirty());
else if (o.kind === "url")
try {
new URL(e.data);
} catch {
s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "url",
code: m.ZodIssueCode.invalid_string,
message: o.message
}), n.dirty();
}
else o.kind === "regex" ? (o.regex.lastIndex = 0, o.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(
s, {
validation: "regex",
code: m.ZodIssueCode.invalid_string,
message: o.message
}), n.dirty())) : o.kind === "trim" ? e.data = e.data.trim() : o.kind === "includes" ? e.data.includes(o.value, o.position) || (s = this.
_getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.invalid_string,
validation: { includes: o.value, position: o.position },
message: o.message
}), n.dirty()) : o.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : o.kind === "toUpperCase" ? e.data = e.data.toUpperCase() :
o.kind === "startsWith" ? e.data.startsWith(o.value) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.invalid_string,
validation: { startsWith: o.value },
message: o.message
}), n.dirty()) : o.kind === "endsWith" ? e.data.endsWith(o.value) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.invalid_string,
validation: { endsWith: o.value },
message: o.message
}), n.dirty()) : o.kind === "datetime" ? Kn(o).test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.invalid_string,
validation: "datetime",
message: o.message
}), n.dirty()) : o.kind === "date" ? Ya.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.invalid_string,
validation: "date",
message: o.message
}), n.dirty()) : o.kind === "time" ? Xa(o).test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
code: m.ZodIssueCode.invalid_string,
validation: "time",
message: o.message
}), n.dirty()) : o.kind === "duration" ? Fa.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "duration",
code: m.ZodIssueCode.invalid_string,
message: o.message
}), n.dirty()) : o.kind === "ip" ? Qa(e.data, o.version) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "ip",
code: m.ZodIssueCode.invalid_string,
message: o.message
}), n.dirty()) : o.kind === "jwt" ? ec(e.data, o.alg) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "jwt",
code: m.ZodIssueCode.invalid_string,
message: o.message
}), n.dirty()) : o.kind === "cidr" ? tc(e.data, o.version) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "cidr",
code: m.ZodIssueCode.invalid_string,
message: o.message
}), n.dirty()) : o.kind === "base64" ? Ja.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "base64",
code: m.ZodIssueCode.invalid_string,
message: o.message
}), n.dirty()) : o.kind === "base64url" ? Ha.test(e.data) || (s = this._getOrReturnCtx(e, s), (0, u.addIssueToContext)(s, {
validation: "base64url",
code: m.ZodIssueCode.invalid_string,
message: o.message
}), n.dirty()) : h.util.assertNever(o);
return { status: n.value, value: e.data };
}
_regex(e, r, n) {
return this.refinement((s) => e.test(s), {
validation: r,
code: m.ZodIssueCode.invalid_string,
...y.errorUtil.errToObj(n)
});
}
_addCheck(e) {
return new t({
...this._def,
checks: [...this._def.checks, e]
});
}
email(e) {
return this._addCheck({ kind: "email", ...y.errorUtil.errToObj(e) });
}
url(e) {
return this._addCheck({ kind: "url", ...y.errorUtil.errToObj(e) });
}
emoji(e) {
return this._addCheck({ kind: "emoji", ...y.errorUtil.errToObj(e) });
}
uuid(e) {
return this._addCheck({ kind: "uuid", ...y.errorUtil.errToObj(e) });
}
nanoid(e) {
return this._addCheck({ kind: "nanoid", ...y.errorUtil.errToObj(e) });
}
cuid(e) {
return this._addCheck({ kind: "cuid", ...y.errorUtil.errToObj(e) });
}
cuid2(e) {
return this._addCheck({ kind: "cuid2", ...y.errorUtil.errToObj(e) });
}
ulid(e) {
return this._addCheck({ kind: "ulid", ...y.errorUtil.errToObj(e) });
}
base64(e) {
return this._addCheck({ kind: "base64", ...y.errorUtil.errToObj(e) });
}
base64url(e) {
return this._addCheck({
kind: "base64url",
...y.errorUtil.errToObj(e)
});
}
jwt(e) {
return this._addCheck({ kind: "jwt", ...y.errorUtil.errToObj(e) });
}
ip(e) {
return this._addCheck({ kind: "ip", ...y.errorUtil.errToObj(e) });
}
cidr(e) {
return this._addCheck({ kind: "cidr", ...y.errorUtil.errToObj(e) });
}
datetime(e) {
var r, n;
return typeof e == "string" ? this._addCheck({
kind: "datetime",
precision: null,
offset: !1,
local: !1,
message: e
}) : this._addCheck({
kind: "datetime",
precision: typeof e?.precision > "u" ? null : e?.precision,
offset: (r = e?.offset) !== null && r !== void 0 ? r : !1,
local: (n = e?.local) !== null && n !== void 0 ? n : !1,
...y.errorUtil.errToObj(e?.message)
});
}
date(e) {
return this._addCheck({ kind: "date", message: e });
}
time(e) {
return typeof e == "string" ? this._addCheck({
kind: "time",
precision: null,
message: e
}) : this._addCheck({
kind: "time",
precision: typeof e?.precision > "u" ? null : e?.precision,
...y.errorUtil.errToObj(e?.message)
});
}
duration(e) {
return this._addCheck({ kind: "duration", ...y.errorUtil.errToObj(e) });
}
regex(e, r) {
return this._addCheck({
kind: "regex",
regex: e,
...y.errorUtil.errToObj(r)
});
}
includes(e, r) {
return this._addCheck({
kind: "includes",
value: e,
position: r?.position,
...y.errorUtil.errToObj(r?.message)
});
}
startsWith(e, r) {
return this._addCheck({
kind: "startsWith",
value: e,
...y.errorUtil.errToObj(r)
});
}
endsWith(e, r) {
return this._addCheck({
kind: "endsWith",
value: e,
...y.errorUtil.errToObj(r)
});
}
min(e, r) {
return this._addCheck({
kind: "min",
value: e,
...y.errorUtil.errToObj(r)
});
}
max(e, r) {
return this._addCheck({
kind: "max",
value: e,
...y.errorUtil.errToObj(r)
});
}
length(e, r) {
return this._addCheck({
kind: "length",
value: e,
...y.errorUtil.errToObj(r)
});
}
/**
* Equivalent to `.min(1)`
*/
nonempty(e) {
return this.min(1, y.errorUtil.errToObj(e));
}
trim() {
return new t({
...this._def,
checks: [...this._def.checks, { kind: "trim" }]
});
}
toLowerCase() {
return new t({
...this._def,
checks: [...this._def.checks, { kind: "toLowerCase" }]
});
}
toUpperCase() {
return new t({
...this._def,
checks: [...this._def.checks, { kind: "toUpperCase" }]
});
}
get isDatetime() {
return !!this._def.checks.find((e) => e.kind === "datetime");
}
get isDate() {
return !!this._def.checks.find((e) => e.kind === "date");
}
get isTime() {
return !!this._def.checks.find((e) => e.kind === "time");
}
get isDuration() {
return !!this._def.checks.find((e) => e.kind === "duration");
}
get isEmail() {
return !!this._def.checks.find((e) => e.kind === "email");
}
get isURL() {
return !!this._def.checks.find((e) => e.kind === "url");
}
get isEmoji() {
return !!this._def.checks.find((e) => e.kind === "emoji");
}
get isUUID() {
return !!this._def.checks.find((e) => e.kind === "uuid");
}
get isNANOID() {
return !!this._def.checks.find((e) => e.kind === "nanoid");
}
get isCUID() {
return !!this._def.checks.find((e) => e.kind === "cuid");
}
get isCUID2() {
return !!this._def.checks.find((e) => e.kind === "cuid2");
}
get isULID() {
return !!this._def.checks.find((e) => e.kind === "ulid");
}
get isIP() {
return !!this._def.checks.find((e) => e.kind === "ip");
}
get isCIDR() {
return !!this._def.checks.find((e) => e.kind === "cidr");
}
get isBase64() {
return !!this._def.checks.find((e) => e.kind === "base64");
}
get isBase64url() {
return !!this._def.checks.find((e) => e.kind === "base64url");
}
get minLength() {
let e = null;
for (let r of this._def.checks)
r.kind === "min" && (e === null || r.value > e) && (e = r.value);
return e;
}
get maxLength() {
let e = null;
for (let r of this._def.checks)
r.kind === "max" && (e === null || r.value < e) && (e = r.value);
return e;
}
};
d.ZodString = X;
X.create = (t) => {
var e;
return new X({
checks: [],
typeName: g.ZodString,
coerce: (e = t?.coerce) !== null && e !== void 0 ? e : !1,
...x(t)
});
};
function rc(t, e) {
let r = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = r > n ? r : n, o = parseInt(t.toFixed(
s).replace(".", "")), a = parseInt(e.toFixed(s).replace(".", ""));
return o % a / Math.pow(10, s);
}
i(rc, "floatSafeRemainder");
var se = class t extends v {
static {
i(this, "ZodNumber");
}
constructor() {
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
}
_parse(e) {
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== h.ZodParsedType.number) {
let o = this._getOrReturnCtx(e);
return (0, u.addIssueToContext)(o, {
code: m.ZodIssueCode.invalid_type,
expected: h.ZodParsedType.number,
received: o.parsedType
}), u.INVALID;
}
let n, s = new u.ParseStatus();
for (let o of this._def.checks)
o.kind === "int" ? h.util.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), (0, u.addIssueToContext)(n, {
code: m.ZodIssueCode.invalid_type,
expected: "integer",
received: "float",
message: o.message
}), s.dirty()) : o.kind === "min" ? (o.inclusive ? e.data < o.value : e.data <= o.value) && (n = this._getOrReturnCtx(e, n), (0, u.addIssueToContext)(
n, {
code: m.ZodIssueCode.too_small,
minimum: o.value,
type: "number",
inclusive: o.inclusive,
exact: !1,
message: o.message
}), s.dirty()) : o.kind === "max" ? (o.inclusive ? e.data > o.value : e.data >= o.value) && (n = this._getOrReturnCtx(e, n), (0, u.addIssueToContext)(
n, {
code: m.ZodIssueCode.too_big,
maximum: o.value,
type: "number",
inclusive: o.inclusive,
exact: !1,
message: o.message
}), s.dirty()) : o.kind === "multipleOf" ? rc(e.data, o.value) !== 0 && (n = this._getOrReturnCtx(e, n), (0, u.addIssueToContext)(n,
{
code: m.ZodIssueCode.not_multiple_of,
multipleOf: o.value,
message: o.message
}), s.dirty()) : o.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), (0, u.addIssueToContext)(n, {
code: m.ZodIssueCode.not_finite,
message: o.message
}), s.dirty()) : h.util.assertNever(o);
return { status: s.value, value: e.data };
}
gte(e, r) {
return this.setLimit("min", e, !0, y.errorUtil