UNPKG

dgz-ui-shared

Version:

Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library

1,491 lines (1,488 loc) 108 kB
import { j as R } from "./jsx-runtime-DS1N_tNq.js"; import * as P from "react"; import j, { useMemo as ls, useState as Ze, useRef as he, useLayoutEffect as kt, useEffect as Ee, useSyncExternalStore as ds, isValidElement as Ae, cloneElement as qe } from "react"; import { u as bt } from "./useTranslation-dH-uwymc.js"; import { a as O, i as wt, j as cs, b as us, e as fs } from "./index-BL59b1Bz-C9bJE_xn.js"; import { D as Tt, x as hs, C as ms, R as ps, v as gs, h as ys, E as vs, y as Ct, P as _s, _ as xs } from "./index-C4qYhCZt-BZQduTld.js"; import { g as Nt } from "./button-CdZDBhmr-BT_j3ig5.js"; import { m as te } from "./utils-B6fNqzRf-B1_jG1K7.js"; import { b as ks } from "./input-mask-DBLFIvhN-BBxoZxnd.js"; import { M as bs } from "./MyInput-B-QCpehg.js"; import { g as Le, s as Se, a as ws, u as Ts } from "./index.esm-CQEA7FC8.js"; var Et = "AlertDialog", [Cs, ia] = cs(Et, [ Tt ]), X = Tt(), At = (t) => { const { __scopeAlertDialog: e, ...s } = t, r = X(e); return /* @__PURE__ */ O.jsx(hs, { ...r, ...s, modal: !0 }); }; At.displayName = Et; var Ns = "AlertDialogTrigger", It = P.forwardRef( (t, e) => { const { __scopeAlertDialog: s, ...r } = t, a = X(s); return /* @__PURE__ */ O.jsx(ms, { ...a, ...r, ref: e }); } ); It.displayName = Ns; var Es = "AlertDialogPortal", jt = (t) => { const { __scopeAlertDialog: e, ...s } = t, r = X(e); return /* @__PURE__ */ O.jsx(ps, { ...r, ...s }); }; jt.displayName = Es; var As = "AlertDialogOverlay", Ot = P.forwardRef( (t, e) => { const { __scopeAlertDialog: s, ...r } = t, a = X(s); return /* @__PURE__ */ O.jsx(xs, { ...a, ...r, ref: e }); } ); Ot.displayName = As; var oe = "AlertDialogContent", [Is, js] = Cs(oe), Os = fs("AlertDialogContent"), Rt = P.forwardRef( (t, e) => { const { __scopeAlertDialog: s, children: r, ...a } = t, n = X(s), i = P.useRef(null), o = wt(e, i), l = P.useRef(null); return /* @__PURE__ */ O.jsx( gs, { contentName: oe, titleName: St, docsSlug: "alert-dialog", children: /* @__PURE__ */ O.jsx(Is, { scope: s, cancelRef: l, children: /* @__PURE__ */ O.jsxs( ys, { role: "alertdialog", ...n, ...a, ref: o, onOpenAutoFocus: us(a.onOpenAutoFocus, (d) => { var f; d.preventDefault(), (f = l.current) == null || f.focus({ preventScroll: !0 }); }), onPointerDownOutside: (d) => d.preventDefault(), onInteractOutside: (d) => d.preventDefault(), children: [ /* @__PURE__ */ O.jsx(Os, { children: r }), /* @__PURE__ */ O.jsx(Ss, { contentRef: i }) ] } ) }) } ); } ); Rt.displayName = oe; var St = "AlertDialogTitle", $t = P.forwardRef( (t, e) => { const { __scopeAlertDialog: s, ...r } = t, a = X(s); return /* @__PURE__ */ O.jsx(vs, { ...a, ...r, ref: e }); } ); $t.displayName = St; var Zt = "AlertDialogDescription", Lt = P.forwardRef((t, e) => { const { __scopeAlertDialog: s, ...r } = t, a = X(s); return /* @__PURE__ */ O.jsx(_s, { ...a, ...r, ref: e }); }); Lt.displayName = Zt; var Rs = "AlertDialogAction", Pt = P.forwardRef( (t, e) => { const { __scopeAlertDialog: s, ...r } = t, a = X(s); return /* @__PURE__ */ O.jsx(Ct, { ...a, ...r, ref: e }); } ); Pt.displayName = Rs; var Dt = "AlertDialogCancel", Mt = P.forwardRef( (t, e) => { const { __scopeAlertDialog: s, ...r } = t, { cancelRef: a } = js(Dt, s), n = X(s), i = wt(e, a); return /* @__PURE__ */ O.jsx(Ct, { ...n, ...r, ref: i }); } ); Mt.displayName = Dt; var Ss = ({ contentRef: t }) => { const e = `\`${oe}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${oe}\` by passing a \`${Zt}\` component as a child, which also benefits sighted users by adding visible context to the dialog. Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${oe}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`; return P.useEffect(() => { var s; document.getElementById( (s = t.current) == null ? void 0 : s.getAttribute("aria-describedby") ) || console.warn(e); }, [e, t]), null; }, $s = At, Zs = It, Ls = jt, zt = Ot, Vt = Rt, Bt = Pt, Ft = Mt, Ut = $t, Wt = Lt; const qt = $s, Ht = Zs, Ps = Ls, Xt = P.forwardRef(({ className: t, ...e }, s) => /* @__PURE__ */ O.jsx( zt, { className: te( "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80", t ), ...e, ref: s } )); Xt.displayName = zt.displayName; const He = P.forwardRef(({ className: t, ...e }, s) => /* @__PURE__ */ O.jsxs(Ps, { children: [ /* @__PURE__ */ O.jsx(Xt, {}), /* @__PURE__ */ O.jsx( Vt, { ref: s, className: te( "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg", t ), ...e } ) ] })); He.displayName = Vt.displayName; const Xe = ({ className: t, ...e }) => /* @__PURE__ */ O.jsx( "div", { className: te( "flex flex-col space-y-2 text-center sm:text-left", t ), ...e } ); Xe.displayName = "AlertDialogHeader"; const Ye = ({ className: t, ...e }) => /* @__PURE__ */ O.jsx("div", { className: te("flex gap-2 sm:justify-end", t), ...e }); Ye.displayName = "AlertDialogFooter"; const Je = P.forwardRef(({ className: t, ...e }, s) => /* @__PURE__ */ O.jsx( Ut, { ref: s, className: te("text-lg font-semibold", t), ...e } )); Je.displayName = Ut.displayName; const Yt = P.forwardRef(({ className: t, ...e }, s) => /* @__PURE__ */ O.jsx( Wt, { ref: s, className: te("text-muted-foreground text-sm", t), ...e } )); Yt.displayName = Wt.displayName; const Qe = P.forwardRef(({ className: t, ...e }, s) => /* @__PURE__ */ O.jsx( Bt, { ref: s, className: te(Nt(), t), ...e } )); Qe.displayName = Bt.displayName; const Ge = P.forwardRef(({ className: t, ...e }, s) => /* @__PURE__ */ O.jsx( Ft, { ref: s, className: te(Nt({ variant: "tertiary" }), t), ...e } )); Ge.displayName = Ft.displayName; const oa = ({ title: t, description: e, children: s, onConfirm: r, ...a }) => { const { t: n } = bt(); return /* @__PURE__ */ R.jsxs(qt, { ...a, children: [ s && /* @__PURE__ */ R.jsx(Ht, { children: s }), /* @__PURE__ */ R.jsxs(He, { children: [ /* @__PURE__ */ R.jsxs(Xe, { children: [ /* @__PURE__ */ R.jsx(Je, { children: t || n("Are you absolutely sure?") }), /* @__PURE__ */ R.jsx(Yt, { children: e || n( "This action cannot be undone. This will permanently delete your data from our servers." ) }) ] }), /* @__PURE__ */ R.jsxs(Ye, { children: [ /* @__PURE__ */ R.jsx(Ge, { className: "mt-0", children: n("Cancel") }), /* @__PURE__ */ R.jsx(Qe, { onClick: r, children: n("Confirm") }) ] }) ] }) ] }); }, st = (t, e, s) => { if (t && "reportValidity" in t) { const r = Le(s, e); t.setCustomValidity(r && r.message || ""), t.reportValidity(); } }, Jt = (t, e) => { for (const s in e.fields) { const r = e.fields[s]; r && r.ref && "reportValidity" in r.ref ? st(r.ref, s, t) : r && r.refs && r.refs.forEach((a) => st(a, s, t)); } }, Ds = (t, e) => { e.shouldUseNativeValidation && Jt(t, e); const s = {}; for (const r in t) { const a = Le(e.fields, r), n = Object.assign(t[r] || {}, { ref: a && a.ref }); if (Ms(e.names || Object.keys(t), r)) { const i = Object.assign({}, Le(s, r)); Se(i, "root", n), Se(s, r, i); } else Se(s, r, n); } return s; }, Ms = (t, e) => { const s = rt(e); return t.some((r) => rt(r).match(`^${s}\\.\\d+`)); }; function rt(t) { return t.replace(/\]|\[/g, ""); } function zs(t, e) { for (var s = {}; t.length; ) { var r = t[0], a = r.code, n = r.message, i = r.path.join("."); if (!s[i]) if ("unionErrors" in r) { var o = r.unionErrors[0].errors[0]; s[i] = { message: o.message, type: o.code }; } else s[i] = { message: n, type: a }; if ("unionErrors" in r && r.unionErrors.forEach(function(f) { return f.errors.forEach(function(E) { return t.push(E); }); }), e) { var l = s[i].types, d = l && l[r.code]; s[i] = ws(i, e, s, a, d ? [].concat(d, r.message) : r.message); } t.shift(); } return s; } function Vs(t, e, s) { return s === void 0 && (s = {}), function(r, a, n) { try { return Promise.resolve(function(i, o) { try { var l = Promise.resolve(t[s.mode === "sync" ? "parse" : "parseAsync"](r, e)).then(function(d) { return n.shouldUseNativeValidation && Jt({}, n), { errors: {}, values: s.raw ? Object.assign({}, r) : d }; }); } catch (d) { return o(d); } return l && l.then ? l.then(void 0, o) : l; }(0, function(i) { if (function(o) { return Array.isArray(o == null ? void 0 : o.errors); }(i)) return { values: {}, errors: Ds(zs(i.errors, !n.shouldUseNativeValidation && n.criteriaMode === "all"), n) }; throw i; })); } catch (i) { return Promise.reject(i); } }; } var b; (function(t) { t.assertEqual = (a) => { }; function e(a) { } t.assertIs = e; function s(a) { throw new Error(); } t.assertNever = s, t.arrayToEnum = (a) => { const n = {}; for (const i of a) n[i] = i; return n; }, t.getValidEnumValues = (a) => { const n = t.objectKeys(a).filter((o) => typeof a[a[o]] != "number"), i = {}; for (const o of n) i[o] = a[o]; return t.objectValues(i); }, t.objectValues = (a) => t.objectKeys(a).map(function(n) { return a[n]; }), t.objectKeys = typeof Object.keys == "function" ? (a) => Object.keys(a) : (a) => { const n = []; for (const i in a) Object.prototype.hasOwnProperty.call(a, i) && n.push(i); return n; }, t.find = (a, n) => { for (const i of a) if (n(i)) return i; }, t.isInteger = typeof Number.isInteger == "function" ? (a) => Number.isInteger(a) : (a) => typeof a == "number" && Number.isFinite(a) && Math.floor(a) === a; function r(a, n = " | ") { return a.map((i) => typeof i == "string" ? `'${i}'` : i).join(n); } t.joinValues = r, t.jsonStringifyReplacer = (a, n) => typeof n == "bigint" ? n.toString() : n; })(b || (b = {})); var at; (function(t) { t.mergeShapes = (e, s) => ({ ...e, ...s // second overwrites first }); })(at || (at = {})); const h = b.arrayToEnum([ "string", "nan", "number", "integer", "float", "boolean", "date", "bigint", "symbol", "function", "undefined", "null", "array", "object", "unknown", "promise", "void", "never", "map", "set" ]), J = (t) => { switch (typeof t) { case "undefined": return h.undefined; case "string": return h.string; case "number": return Number.isNaN(t) ? h.nan : h.number; case "boolean": return h.boolean; case "function": return h.function; case "bigint": return h.bigint; case "symbol": return h.symbol; case "object": return Array.isArray(t) ? h.array : t === null ? h.null : t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? h.promise : typeof Map < "u" && t instanceof Map ? h.map : typeof Set < "u" && t instanceof Set ? h.set : typeof Date < "u" && t instanceof Date ? h.date : h.object; default: return h.unknown; } }, c = b.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" ]); class q extends Error { get errors() { return this.issues; } constructor(e) { super(), this.issues = [], this.addIssue = (r) => { this.issues = [...this.issues, r]; }, this.addIssues = (r = []) => { this.issues = [...this.issues, ...r]; }; const s = new.target.prototype; Object.setPrototypeOf ? Object.setPrototypeOf(this, s) : this.__proto__ = s, this.name = "ZodError", this.issues = e; } format(e) { const s = e || function(n) { return n.message; }, r = { _errors: [] }, a = (n) => { for (const i of n.issues) if (i.code === "invalid_union") i.unionErrors.map(a); else if (i.code === "invalid_return_type") a(i.returnTypeError); else if (i.code === "invalid_arguments") a(i.argumentsError); else if (i.path.length === 0) r._errors.push(s(i)); else { let o = r, l = 0; for (; l < i.path.length; ) { const d = i.path[l]; l === i.path.length - 1 ? (o[d] = o[d] || { _errors: [] }, o[d]._errors.push(s(i))) : o[d] = o[d] || { _errors: [] }, o = o[d], l++; } } }; return a(this), r; } static assert(e) { if (!(e instanceof q)) throw new Error(`Not a ZodError: ${e}`); } toString() { return this.message; } get message() { return JSON.stringify(this.issues, b.jsonStringifyReplacer, 2); } get isEmpty() { return this.issues.length === 0; } flatten(e = (s) => s.message) { const s = {}, r = []; for (const a of this.issues) a.path.length > 0 ? (s[a.path[0]] = s[a.path[0]] || [], s[a.path[0]].push(e(a))) : r.push(e(a)); return { formErrors: r, fieldErrors: s }; } get formErrors() { return this.flatten(); } } q.create = (t) => new q(t); const Pe = (t, e) => { let s; switch (t.code) { case c.invalid_type: t.received === h.undefined ? s = "Required" : s = `Expected ${t.expected}, received ${t.received}`; break; case c.invalid_literal: s = `Invalid literal value, expected ${JSON.stringify(t.expected, b.jsonStringifyReplacer)}`; break; case c.unrecognized_keys: s = `Unrecognized key(s) in object: ${b.joinValues(t.keys, ", ")}`; break; case c.invalid_union: s = "Invalid input"; break; case c.invalid_union_discriminator: s = `Invalid discriminator value. Expected ${b.joinValues(t.options)}`; break; case c.invalid_enum_value: s = `Invalid enum value. Expected ${b.joinValues(t.options)}, received '${t.received}'`; break; case c.invalid_arguments: s = "Invalid function arguments"; break; case c.invalid_return_type: s = "Invalid function return type"; break; case c.invalid_date: s = "Invalid date"; break; case c.invalid_string: typeof t.validation == "object" ? "includes" in t.validation ? (s = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (s = `${s} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? s = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? s = `Invalid input: must end with "${t.validation.endsWith}"` : b.assertNever(t.validation) : t.validation !== "regex" ? s = `Invalid ${t.validation}` : s = "Invalid"; break; case c.too_small: t.type === "array" ? s = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? s = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? s = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? s = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : s = "Invalid input"; break; case c.too_big: t.type === "array" ? s = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "less than"} ${t.maximum} element(s)` : t.type === "string" ? s = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "under"} ${t.maximum} character(s)` : t.type === "number" ? s = `Number must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "bigint" ? s = `BigInt must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "date" ? s = `Date must be ${t.exact ? "exactly" : t.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(t.maximum))}` : s = "Invalid input"; break; case c.custom: s = "Invalid input"; break; case c.invalid_intersection_types: s = "Intersection results could not be merged"; break; case c.not_multiple_of: s = `Number must be a multiple of ${t.multipleOf}`; break; case c.not_finite: s = "Number must be finite"; break; default: s = e.defaultError, b.assertNever(t); } return { message: s }; }; let Bs = Pe; function Fs() { return Bs; } const Us = (t) => { const { data: e, path: s, errorMaps: r, issueData: a } = t, n = [...s, ...a.path || []], i = { ...a, path: n }; if (a.message !== void 0) return { ...a, path: n, message: a.message }; let o = ""; const l = r.filter((d) => !!d).slice().reverse(); for (const d of l) o = d(i, { data: e, defaultError: o }).message; return { ...a, path: n, message: o }; }; function u(t, e) { const s = Fs(), r = Us({ 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 s, // then global override map s === Pe ? void 0 : Pe // then global default map ].filter((a) => !!a) }); t.common.issues.push(r); } class V { constructor() { this.value = "valid"; } dirty() { this.value === "valid" && (this.value = "dirty"); } abort() { this.value !== "aborted" && (this.value = "aborted"); } static mergeArray(e, s) { const r = []; for (const a of s) { if (a.status === "aborted") return y; a.status === "dirty" && e.dirty(), r.push(a.value); } return { status: e.value, value: r }; } static async mergeObjectAsync(e, s) { const r = []; for (const a of s) { const n = await a.key, i = await a.value; r.push({ key: n, value: i }); } return V.mergeObjectSync(e, r); } static mergeObjectSync(e, s) { const r = {}; for (const a of s) { const { key: n, value: i } = a; if (n.status === "aborted" || i.status === "aborted") return y; n.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), n.value !== "__proto__" && (typeof i.value < "u" || a.alwaysSet) && (r[n.value] = i.value); } return { status: e.value, value: r }; } } const y = Object.freeze({ status: "aborted" }), fe = (t) => ({ status: "dirty", value: t }), B = (t) => ({ status: "valid", value: t }), nt = (t) => t.status === "aborted", it = (t) => t.status === "dirty", le = (t) => t.status === "valid", be = (t) => typeof Promise < "u" && t instanceof Promise; var m; (function(t) { t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message; })(m || (m = {})); class K { constructor(e, s, r, a) { this._cachedPath = [], this.parent = e, this.data = s, this._path = r, this._key = a; } get path() { return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath; } } const ot = (t, e) => { if (le(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; const s = new q(t.common.issues); return this._error = s, this._error; } }; }; function _(t) { if (!t) return {}; const { errorMap: e, invalid_type_error: s, required_error: r, description: a } = t; if (e && (s || r)) throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`); return e ? { errorMap: e, description: a } : { errorMap: (i, o) => { const { message: l } = t; return i.code === "invalid_enum_value" ? { message: l ?? o.defaultError } : typeof o.data > "u" ? { message: l ?? r ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: l ?? s ?? o.defaultError }; }, description: a }; } class k { get description() { return this._def.description; } _getType(e) { return J(e.data); } _getOrReturnCtx(e, s) { return s || { common: e.parent.common, data: e.data, parsedType: J(e.data), schemaErrorMap: this._def.errorMap, path: e.path, parent: e.parent }; } _processInputParams(e) { return { status: new V(), ctx: { common: e.parent.common, data: e.data, parsedType: J(e.data), schemaErrorMap: this._def.errorMap, path: e.path, parent: e.parent } }; } _parseSync(e) { const s = this._parse(e); if (be(s)) throw new Error("Synchronous parse encountered promise."); return s; } _parseAsync(e) { const s = this._parse(e); return Promise.resolve(s); } parse(e, s) { const r = this.safeParse(e, s); if (r.success) return r.data; throw r.error; } safeParse(e, s) { const r = { common: { issues: [], async: (s == null ? void 0 : s.async) ?? !1, contextualErrorMap: s == null ? void 0 : s.errorMap }, path: (s == null ? void 0 : s.path) || [], schemaErrorMap: this._def.errorMap, parent: null, data: e, parsedType: J(e) }, a = this._parseSync({ data: e, path: r.path, parent: r }); return ot(r, a); } "~validate"(e) { var r, a; const s = { common: { issues: [], async: !!this["~standard"].async }, path: [], schemaErrorMap: this._def.errorMap, parent: null, data: e, parsedType: J(e) }; if (!this["~standard"].async) try { const n = this._parseSync({ data: e, path: [], parent: s }); return le(n) ? { value: n.value } : { issues: s.common.issues }; } catch (n) { (a = (r = n == null ? void 0 : n.message) == null ? void 0 : r.toLowerCase()) != null && a.includes("encountered") && (this["~standard"].async = !0), s.common = { issues: [], async: !0 }; } return this._parseAsync({ data: e, path: [], parent: s }).then((n) => le(n) ? { value: n.value } : { issues: s.common.issues }); } async parseAsync(e, s) { const r = await this.safeParseAsync(e, s); if (r.success) return r.data; throw r.error; } async safeParseAsync(e, s) { const r = { common: { issues: [], contextualErrorMap: s == null ? void 0 : s.errorMap, async: !0 }, path: (s == null ? void 0 : s.path) || [], schemaErrorMap: this._def.errorMap, parent: null, data: e, parsedType: J(e) }, a = this._parse({ data: e, path: r.path, parent: r }), n = await (be(a) ? a : Promise.resolve(a)); return ot(r, n); } refine(e, s) { const r = (a) => typeof s == "string" || typeof s > "u" ? { message: s } : typeof s == "function" ? s(a) : s; return this._refinement((a, n) => { const i = e(a), o = () => n.addIssue({ code: c.custom, ...r(a) }); return typeof Promise < "u" && i instanceof Promise ? i.then((l) => l ? !0 : (o(), !1)) : i ? !0 : (o(), !1); }); } refinement(e, s) { return this._refinement((r, a) => e(r) ? !0 : (a.addIssue(typeof s == "function" ? s(r, a) : s), !1)); } _refinement(e) { return new ce({ schema: this, typeName: v.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: (s) => this["~validate"](s) }; } optional() { return G.create(this, this._def); } nullable() { return ue.create(this, this._def); } nullish() { return this.nullable().optional(); } array() { return U.create(this); } promise() { return Ne.create(this, this._def); } or(e) { return Te.create([this, e], this._def); } and(e) { return Ce.create(this, e, this._def); } transform(e) { return new ce({ ..._(this._def), schema: this, typeName: v.ZodEffects, effect: { type: "transform", transform: e } }); } default(e) { const s = typeof e == "function" ? e : () => e; return new Me({ ..._(this._def), innerType: this, defaultValue: s, typeName: v.ZodDefault }); } brand() { return new hr({ typeName: v.ZodBranded, type: this, ..._(this._def) }); } catch(e) { const s = typeof e == "function" ? e : () => e; return new ze({ ..._(this._def), innerType: this, catchValue: s, typeName: v.ZodCatch }); } describe(e) { const s = this.constructor; return new s({ ...this._def, description: e }); } pipe(e) { return Ke.create(this, e); } readonly() { return Ve.create(this); } isOptional() { return this.safeParse(void 0).success; } isNullable() { return this.safeParse(null).success; } } const Ws = /^c[^\s-]{8,}$/i, qs = /^[0-9a-z]+$/, Hs = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Xs = /^[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, Ys = /^[a-z0-9_-]{21}$/i, Js = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Qs = /^[-+]?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)?)??$/, Gs = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ks = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$"; let $e; const er = /^(?:(?: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])$/, tr = /^(?:(?: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])$/, sr = /^(([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]))$/, rr = /^(([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])$/, ar = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, nr = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Qt = "((\\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])))", ir = new RegExp(`^${Qt}$`); function Gt(t) { let e = "[0-5]\\d"; t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`); const s = t.precision ? "+" : "?"; return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${s}`; } function or(t) { return new RegExp(`^${Gt(t)}$`); } function lr(t) { let e = `${Qt}T${Gt(t)}`; const s = []; return s.push(t.local ? "Z?" : "Z"), t.offset && s.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${s.join("|")})`, new RegExp(`^${e}$`); } function dr(t, e) { return !!((e === "v4" || !e) && er.test(t) || (e === "v6" || !e) && sr.test(t)); } function cr(t, e) { if (!Js.test(t)) return !1; try { const [s] = t.split("."), r = s.replace(/-/g, "+").replace(/_/g, "/").padEnd(s.length + (4 - s.length % 4) % 4, "="), a = JSON.parse(atob(r)); return !(typeof a != "object" || a === null || "typ" in a && (a == null ? void 0 : a.typ) !== "JWT" || !a.alg || e && a.alg !== e); } catch { return !1; } } function ur(t, e) { return !!((e === "v4" || !e) && tr.test(t) || (e === "v6" || !e) && rr.test(t)); } class Q extends k { _parse(e) { if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== h.string) { const n = this._getOrReturnCtx(e); return u(n, { code: c.invalid_type, expected: h.string, received: n.parsedType }), y; } const r = new V(); let a; for (const n of this._def.checks) if (n.kind === "min") e.data.length < n.value && (a = this._getOrReturnCtx(e, a), u(a, { code: c.too_small, minimum: n.value, type: "string", inclusive: !0, exact: !1, message: n.message }), r.dirty()); else if (n.kind === "max") e.data.length > n.value && (a = this._getOrReturnCtx(e, a), u(a, { code: c.too_big, maximum: n.value, type: "string", inclusive: !0, exact: !1, message: n.message }), r.dirty()); else if (n.kind === "length") { const i = e.data.length > n.value, o = e.data.length < n.value; (i || o) && (a = this._getOrReturnCtx(e, a), i ? u(a, { code: c.too_big, maximum: n.value, type: "string", inclusive: !0, exact: !0, message: n.message }) : o && u(a, { code: c.too_small, minimum: n.value, type: "string", inclusive: !0, exact: !0, message: n.message }), r.dirty()); } else if (n.kind === "email") Gs.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, { validation: "email", code: c.invalid_string, message: n.message }), r.dirty()); else if (n.kind === "emoji") $e || ($e = new RegExp(Ks, "u")), $e.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, { validation: "emoji", code: c.invalid_string, message: n.message }), r.dirty()); else if (n.kind === "uuid") Xs.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, { validation: "uuid", code: c.invalid_string, message: n.message }), r.dirty()); else if (n.kind === "nanoid") Ys.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, { validation: "nanoid", code: c.invalid_string, message: n.message }), r.dirty()); else if (n.kind === "cuid") Ws.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, { validation: "cuid", code: c.invalid_string, message: n.message }), r.dirty()); else if (n.kind === "cuid2") qs.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, { validation: "cuid2", code: c.invalid_string, message: n.message }), r.dirty()); else if (n.kind === "ulid") Hs.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, { validation: "ulid", code: c.invalid_string, message: n.message }), r.dirty()); else if (n.kind === "url") try { new URL(e.data); } catch { a = this._getOrReturnCtx(e, a), u(a, { validation: "url", code: c.invalid_string, message: n.message }), r.dirty(); } else n.kind === "regex" ? (n.regex.lastIndex = 0, n.regex.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, { validation: "regex", code: c.invalid_string, message: n.message }), r.dirty())) : n.kind === "trim" ? e.data = e.data.trim() : n.kind === "includes" ? e.data.includes(n.value, n.position) || (a = this._getOrReturnCtx(e, a), u(a, { code: c.invalid_string, validation: { includes: n.value, position: n.position }, message: n.message }), r.dirty()) : n.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : n.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : n.kind === "startsWith" ? e.data.startsWith(n.value) || (a = this._getOrReturnCtx(e, a), u(a, { code: c.invalid_string, validation: { startsWith: n.value }, message: n.message }), r.dirty()) : n.kind === "endsWith" ? e.data.endsWith(n.value) || (a = this._getOrReturnCtx(e, a), u(a, { code: c.invalid_string, validation: { endsWith: n.value }, message: n.message }), r.dirty()) : n.kind === "datetime" ? lr(n).test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, { code: c.invalid_string, validation: "datetime", message: n.message }), r.dirty()) : n.kind === "date" ? ir.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, { code: c.invalid_string, validation: "date", message: n.message }), r.dirty()) : n.kind === "time" ? or(n).test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, { code: c.invalid_string, validation: "time", message: n.message }), r.dirty()) : n.kind === "duration" ? Qs.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, { validation: "duration", code: c.invalid_string, message: n.message }), r.dirty()) : n.kind === "ip" ? dr(e.data, n.version) || (a = this._getOrReturnCtx(e, a), u(a, { validation: "ip", code: c.invalid_string, message: n.message }), r.dirty()) : n.kind === "jwt" ? cr(e.data, n.alg) || (a = this._getOrReturnCtx(e, a), u(a, { validation: "jwt", code: c.invalid_string, message: n.message }), r.dirty()) : n.kind === "cidr" ? ur(e.data, n.version) || (a = this._getOrReturnCtx(e, a), u(a, { validation: "cidr", code: c.invalid_string, message: n.message }), r.dirty()) : n.kind === "base64" ? ar.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, { validation: "base64", code: c.invalid_string, message: n.message }), r.dirty()) : n.kind === "base64url" ? nr.test(e.data) || (a = this._getOrReturnCtx(e, a), u(a, { validation: "base64url", code: c.invalid_string, message: n.message }), r.dirty()) : b.assertNever(n); return { status: r.value, value: e.data }; } _regex(e, s, r) { return this.refinement((a) => e.test(a), { validation: s, code: c.invalid_string, ...m.errToObj(r) }); } _addCheck(e) { return new Q({ ...this._def, checks: [...this._def.checks, e] }); } email(e) { return this._addCheck({ kind: "email", ...m.errToObj(e) }); } url(e) { return this._addCheck({ kind: "url", ...m.errToObj(e) }); } emoji(e) { return this._addCheck({ kind: "emoji", ...m.errToObj(e) }); } uuid(e) { return this._addCheck({ kind: "uuid", ...m.errToObj(e) }); } nanoid(e) { return this._addCheck({ kind: "nanoid", ...m.errToObj(e) }); } cuid(e) { return this._addCheck({ kind: "cuid", ...m.errToObj(e) }); } cuid2(e) { return this._addCheck({ kind: "cuid2", ...m.errToObj(e) }); } ulid(e) { return this._addCheck({ kind: "ulid", ...m.errToObj(e) }); } base64(e) { return this._addCheck({ kind: "base64", ...m.errToObj(e) }); } base64url(e) { return this._addCheck({ kind: "base64url", ...m.errToObj(e) }); } jwt(e) { return this._addCheck({ kind: "jwt", ...m.errToObj(e) }); } ip(e) { return this._addCheck({ kind: "ip", ...m.errToObj(e) }); } cidr(e) { return this._addCheck({ kind: "cidr", ...m.errToObj(e) }); } datetime(e) { return typeof e == "string" ? this._addCheck({ kind: "datetime", precision: null, offset: !1, local: !1, message: e }) : this._addCheck({ kind: "datetime", precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision, offset: (e == null ? void 0 : e.offset) ?? !1, local: (e == null ? void 0 : e.local) ?? !1, ...m.errToObj(e == null ? void 0 : 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 == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision, ...m.errToObj(e == null ? void 0 : e.message) }); } duration(e) { return this._addCheck({ kind: "duration", ...m.errToObj(e) }); } regex(e, s) { return this._addCheck({ kind: "regex", regex: e, ...m.errToObj(s) }); } includes(e, s) { return this._addCheck({ kind: "includes", value: e, position: s == null ? void 0 : s.position, ...m.errToObj(s == null ? void 0 : s.message) }); } startsWith(e, s) { return this._addCheck({ kind: "startsWith", value: e, ...m.errToObj(s) }); } endsWith(e, s) { return this._addCheck({ kind: "endsWith", value: e, ...m.errToObj(s) }); } min(e, s) { return this._addCheck({ kind: "min", value: e, ...m.errToObj(s) }); } max(e, s) { return this._addCheck({ kind: "max", value: e, ...m.errToObj(s) }); } length(e, s) { return this._addCheck({ kind: "length", value: e, ...m.errToObj(s) }); } /** * Equivalent to `.min(1)` */ nonempty(e) { return this.min(1, m.errToObj(e)); } trim() { return new Q({ ...this._def, checks: [...this._def.checks, { kind: "trim" }] }); } toLowerCase() { return new Q({ ...this._def, checks: [...this._def.checks, { kind: "toLowerCase" }] }); } toUpperCase() { return new Q({ ...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 (const s of this._def.checks) s.kind === "min" && (e === null || s.value > e) && (e = s.value); return e; } get maxLength() { let e = null; for (const s of this._def.checks) s.kind === "max" && (e === null || s.value < e) && (e = s.value); return e; } } Q.create = (t) => new Q({ checks: [], typeName: v.ZodString, coerce: (t == null ? void 0 : t.coerce) ?? !1, ..._(t) }); function fr(t, e) { const s = (t.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, a = s > r ? s : r, n = Number.parseInt(t.toFixed(a).replace(".", "")), i = Number.parseInt(e.toFixed(a).replace(".", "")); return n % i / 10 ** a; } class me extends k { 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.number) { const n = this._getOrReturnCtx(e); return u(n, { code: c.invalid_type, expected: h.number, received: n.parsedType }), y; } let r; const a = new V(); for (const n of this._def.checks) n.kind === "int" ? b.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), u(r, { code: c.invalid_type, expected: "integer", received: "float", message: n.message }), a.dirty()) : n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (r = this._getOrReturnCtx(e, r), u(r, { code: c.too_small, minimum: n.value, type: "number", inclusive: n.inclusive, exact: !1, message: n.message }), a.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (r = this._getOrReturnCtx(e, r), u(r, { code: c.too_big, maximum: n.value, type: "number", inclusive: n.inclusive, exact: !1, message: n.message }), a.dirty()) : n.kind === "multipleOf" ? fr(e.data, n.value) !== 0 && (r = this._getOrReturnCtx(e, r), u(r, { code: c.not_multiple_of, multipleOf: n.value, message: n.message }), a.dirty()) : n.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), u(r, { code: c.not_finite, message: n.message }), a.dirty()) : b.assertNever(n); return { status: a.value, value: e.data }; } gte(e, s) { return this.setLimit("min", e, !0, m.toString(s)); } gt(e, s) { return this.setLimit("min", e, !1, m.toString(s)); } lte(e, s) { return this.setLimit("max", e, !0, m.toString(s)); } lt(e, s) { return this.setLimit("max", e, !1, m.toString(s)); } setLimit(e, s, r, a) { return new me({ ...this._def, checks: [ ...this._def.checks, { kind: e, value: s, inclusive: r, message: m.toString(a) } ] }); } _addCheck(e) { return new me({ ...this._def, checks: [...this._def.checks, e] }); } int(e) { return this._addCheck({ kind: "int", message: m.toString(e) }); } positive(e) { return this._addCheck({ kind: "min", value: 0, inclusive: !1, message: m.toString(e) }); } negative(e) { return this._addCheck({ kind: "max", value: 0, inclusive: !1, message: m.toString(e) }); } nonpositive(e) { return this._addCheck({ kind: "max", value: 0, inclusive: !0, message: m.toString(e) }); } nonnegative(e) { return this._addCheck({ kind: "min", value: 0, inclusive: !0, message: m.toString(e) }); } multipleOf(e, s) { return this._addCheck({ kind: "multipleOf", value: e, message: m.toString(s) }); } finite(e) { return this._addCheck({ kind: "finite", message: m.toString(e) }); } safe(e) { return this._addCheck({ kind: "min", inclusive: !0, value: Number.MIN_SAFE_INTEGER, message: m.toString(e) })._addCheck({ kind: "max", inclusive: !0, value: Number.MAX_SAFE_INTEGER, message: m.toString(e) }); } get minValue() { let e = null; for (const s of this._def.checks) s.kind === "min" && (e === null || s.value > e) && (e = s.value); return e; } get maxValue() { let e = null; for (const s of this._def.checks) s.kind === "max" && (e === null || s.value < e) && (e = s.value); return e; } get isInt() { return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && b.isInteger(e.value)); } get isFinite() { let e = null, s = null; for (const r of this._def.checks) { if (r.kind === "finite" || r.kind === "int" || r.kind === "multipleOf") return !0; r.kind === "min" ? (s === null || r.value > s) && (s = r.value) : r.kind === "max" && (e === null || r.value < e) && (e = r.value); } return Number.isFinite(s) && Number.isFinite(e); } } me.create = (t) => new me({ checks: [], typeName: v.ZodNumber, coerce: (t == null ? void 0 : t.coerce) || !1, ..._(t) }); class pe extends k { constructor() { super(...arguments), this.min = this.gte, this.max = this.lte; } _parse(e) { if (this._def.coerce) try { e.data = BigInt(e.data); } catch { return this._getInvalidInput(e); } if (this._getType(e) !== h.bigint) return this._getInvalidInput(e); let r; const a = new V(); for (const n of this._def.checks) n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (r = this._getOrReturnCtx(e, r), u(r, { code: c.too_small, type: "bigint", minimum: n.value, inclusive: n.inclusive, message: n.message }), a.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (r = this._getOrReturnCtx(e, r), u(r, { code: c.too_big, type: "bigint", maximum: n.value, inclusive: n.inclusive, message: n.message }), a.dirty()) : n.kind === "multipleOf" ? e.data % n.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), u(r, { code: c.not_multiple_of, multipleOf: n.value, message: n.message }), a.dirty()) : b.assertNever(n); return { status: a.value, value: e.data }; } _getInvalidInput(e) { const s = this._getOrReturnCtx(e); return u(s, { code: c.invalid_type, expected: h.bigint, received: s.parsedType }), y; } gte(e, s) { return this.setLimit("min", e, !0, m.toString(s)); } gt(e, s) { return this.setLimit("min", e, !1, m.toString(