UNPKG

wn-ts-node

Version:
1,569 lines (1,568 loc) 96.1 kB
import { parse as xe } from "smol-toml"; // @__NO_SIDE_EFFECTS__ function a(e, t, n) { function o(u, l) { var p; Object.defineProperty(u, "_zod", { value: u._zod ?? {}, enumerable: !1 }), (p = u._zod).traits ?? (p.traits = /* @__PURE__ */ new Set()), u._zod.traits.add(e), t(u, l); for (const $ in s.prototype) $ in u || Object.defineProperty(u, $, { value: s.prototype[$].bind(u) }); u._zod.constr = s, u._zod.def = l; } const r = n?.Parent ?? Object; class i extends r { } Object.defineProperty(i, "name", { value: e }); function s(u) { var l; const p = n?.Parent ? new i() : this; o(p, u), (l = p._zod).deferred ?? (l.deferred = []); for (const $ of p._zod.deferred) $(); return p; } return Object.defineProperty(s, "init", { value: o }), Object.defineProperty(s, Symbol.hasInstance, { value: (u) => n?.Parent && u instanceof n.Parent ? !0 : u?._zod?.traits?.has(e) }), Object.defineProperty(s, "name", { value: e }), s; } class V extends Error { constructor() { super("Encountered Promise during synchronous parse. Use .parseAsync() instead."); } } const Ye = {}; function N(e) { return Ye; } function Pt(e) { const t = Object.values(e).filter((o) => typeof o == "number"); return Object.entries(e).filter(([o, r]) => t.indexOf(+o) === -1).map(([o, r]) => r); } function he(e, t) { return typeof t == "bigint" ? t.toString() : t; } function Xe(e) { return { get value() { { const t = e(); return Object.defineProperty(this, "value", { value: t }), t; } } }; } function ye(e) { return e == null; } function we(e) { const t = e.startsWith("^") ? 1 : 0, n = e.endsWith("$") ? e.length - 1 : e.length; return e.slice(t, n); } function Lt(e, t) { const n = (e.toString().split(".")[1] || "").length, o = t.toString(); let r = (o.split(".")[1] || "").length; if (r === 0 && /\d?e-\d?/.test(o)) { const l = o.match(/\d?e-(\d?)/); l?.[1] && (r = Number.parseInt(l[1])); } const i = n > r ? n : r, s = Number.parseInt(e.toFixed(i).replace(".", "")), u = Number.parseInt(t.toFixed(i).replace(".", "")); return s % u / 10 ** i; } const Ee = Symbol("evaluating"); function _(e, t, n) { let o; Object.defineProperty(e, t, { get() { if (o !== Ee) return o === void 0 && (o = Ee, o = n()), o; }, set(r) { Object.defineProperty(e, t, { value: r // configurable: true, }); }, configurable: !0 }); } function At(e) { return Object.create(Object.getPrototypeOf(e), Object.getOwnPropertyDescriptors(e)); } function C(e, t, n) { Object.defineProperty(e, t, { value: n, writable: !0, enumerable: !0, configurable: !0 }); } function O(...e) { const t = {}; for (const n of e) { const o = Object.getOwnPropertyDescriptors(n); Object.assign(t, o); } return Object.defineProperties({}, t); } function Se(e) { return JSON.stringify(e); } const Qe = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => { }; function fe(e) { return typeof e == "object" && e !== null && !Array.isArray(e); } const Nt = Xe(() => { if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare")) return !1; try { const e = Function; return new e(""), !0; } catch { return !1; } }); function B(e) { if (fe(e) === !1) return !1; const t = e.constructor; if (t === void 0) return !0; const n = t.prototype; return !(fe(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1); } function et(e) { return B(e) ? { ...e } : e; } const Tt = /* @__PURE__ */ new Set(["string", "number", "symbol"]); function ie(e) { return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); } function j(e, t, n) { const o = new e._zod.constr(t ?? e._zod.def); return (!t || n?.parent) && (o._zod.parent = e), o; } function m(e) { const t = e; if (!t) return {}; if (typeof t == "string") return { error: () => t }; if (t?.message !== void 0) { if (t?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params"); t.error = t.message; } return delete t.message, typeof t.error == "string" ? { ...t, error: () => t.error } : t; } function Ct(e) { return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional"); } const jt = { safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER], int32: [-2147483648, 2147483647], uint32: [0, 4294967295], float32: [-34028234663852886e22, 34028234663852886e22], float64: [-Number.MAX_VALUE, Number.MAX_VALUE] }; function Dt(e, t) { const n = e._zod.def, o = O(e._zod.def, { get shape() { const r = {}; for (const i in t) { if (!(i in n.shape)) throw new Error(`Unrecognized key: "${i}"`); t[i] && (r[i] = n.shape[i]); } return C(this, "shape", r), r; }, checks: [] }); return j(e, o); } function Ot(e, t) { const n = e._zod.def, o = O(e._zod.def, { get shape() { const r = { ...e._zod.def.shape }; for (const i in t) { if (!(i in n.shape)) throw new Error(`Unrecognized key: "${i}"`); t[i] && delete r[i]; } return C(this, "shape", r), r; }, checks: [] }); return j(e, o); } function Rt(e, t) { if (!B(t)) throw new Error("Invalid input to extend: expected a plain object"); const n = O(e._zod.def, { get shape() { const o = { ...e._zod.def.shape, ...t }; return C(this, "shape", o), o; }, checks: [] }); return j(e, n); } function Ft(e, t) { const n = O(e._zod.def, { get shape() { const o = { ...e._zod.def.shape, ...t._zod.def.shape }; return C(this, "shape", o), o; }, get catchall() { return t._zod.def.catchall; }, checks: [] // delete existing checks }); return j(e, n); } function Ut(e, t, n) { const o = O(t._zod.def, { get shape() { const r = t._zod.def.shape, i = { ...r }; if (n) for (const s in n) { if (!(s in r)) throw new Error(`Unrecognized key: "${s}"`); n[s] && (i[s] = e ? new e({ type: "optional", innerType: r[s] }) : r[s]); } else for (const s in r) i[s] = e ? new e({ type: "optional", innerType: r[s] }) : r[s]; return C(this, "shape", i), i; }, checks: [] }); return j(t, o); } function Mt(e, t, n) { const o = O(t._zod.def, { get shape() { const r = t._zod.def.shape, i = { ...r }; if (n) for (const s in n) { if (!(s in i)) throw new Error(`Unrecognized key: "${s}"`); n[s] && (i[s] = new e({ type: "nonoptional", innerType: r[s] })); } else for (const s in r) i[s] = new e({ type: "nonoptional", innerType: r[s] }); return C(this, "shape", i), i; }, checks: [] }); return j(t, o); } function W(e, t = 0) { for (let n = t; n < e.issues.length; n++) if (e.issues[n]?.continue !== !0) return !0; return !1; } function D(e, t) { return t.map((n) => { var o; return (o = n).path ?? (o.path = []), n.path.unshift(e), n; }); } function Y(e) { return typeof e == "string" ? e : e?.message; } function T(e, t, n) { const o = { ...e, path: e.path ?? [] }; if (!e.message) { const r = Y(e.inst?._zod.def?.error?.(e)) ?? Y(t?.error?.(e)) ?? Y(n.customError?.(e)) ?? Y(n.localeError?.(e)) ?? "Invalid input"; o.message = r; } return delete o.inst, delete o.continue, t?.reportInput || delete o.input, o; } function ze(e) { return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown"; } function G(...e) { const [t, n, o] = e; return typeof t == "string" ? { message: t, code: "custom", input: n, inst: o } : { ...t }; } const tt = (e, t) => { e.name = "$ZodError", Object.defineProperty(e, "_zod", { value: e._zod, enumerable: !1 }), Object.defineProperty(e, "issues", { value: t, enumerable: !1 }), e.message = JSON.stringify(t, he, 2), Object.defineProperty(e, "toString", { value: () => e.message, enumerable: !1 }); }, nt = /* @__PURE__ */ a("$ZodError", tt), ot = /* @__PURE__ */ a("$ZodError", tt, { Parent: Error }); function Wt(e, t = (n) => n.message) { const n = {}, o = []; for (const r of e.issues) r.path.length > 0 ? (n[r.path[0]] = n[r.path[0]] || [], n[r.path[0]].push(t(r))) : o.push(t(r)); return { formErrors: o, fieldErrors: n }; } function Vt(e, t) { const n = t || function(i) { return i.message; }, o = { _errors: [] }, r = (i) => { for (const s of i.issues) if (s.code === "invalid_union" && s.errors.length) s.errors.map((u) => r({ issues: u })); else if (s.code === "invalid_key") r({ issues: s.issues }); else if (s.code === "invalid_element") r({ issues: s.issues }); else if (s.path.length === 0) o._errors.push(n(s)); else { let u = o, l = 0; for (; l < s.path.length; ) { const p = s.path[l]; l === s.path.length - 1 ? (u[p] = u[p] || { _errors: [] }, u[p]._errors.push(n(s))) : u[p] = u[p] || { _errors: [] }, u = u[p], l++; } } }; return r(e), o; } const Bt = (e) => (t, n, o, r) => { const i = o ? Object.assign(o, { async: !1 }) : { async: !1 }, s = t._zod.run({ value: n, issues: [] }, i); if (s instanceof Promise) throw new V(); if (s.issues.length) { const u = new (r?.Err ?? e)(s.issues.map((l) => T(l, i, N()))); throw Qe(u, r?.callee), u; } return s.value; }, Gt = (e) => async (t, n, o, r) => { const i = o ? Object.assign(o, { async: !0 }) : { async: !0 }; let s = t._zod.run({ value: n, issues: [] }, i); if (s instanceof Promise && (s = await s), s.issues.length) { const u = new (r?.Err ?? e)(s.issues.map((l) => T(l, i, N()))); throw Qe(u, r?.callee), u; } return s.value; }, rt = (e) => (t, n, o) => { const r = o ? { ...o, async: !1 } : { async: !1 }, i = t._zod.run({ value: n, issues: [] }, r); if (i instanceof Promise) throw new V(); return i.issues.length ? { success: !1, error: new (e ?? nt)(i.issues.map((s) => T(s, r, N()))) } : { success: !0, data: i.value }; }, qt = /* @__PURE__ */ rt(ot), it = (e) => async (t, n, o) => { const r = o ? Object.assign(o, { async: !0 }) : { async: !0 }; let i = t._zod.run({ value: n, issues: [] }, r); return i instanceof Promise && (i = await i), i.issues.length ? { success: !1, error: new e(i.issues.map((s) => T(s, r, N()))) } : { success: !0, data: i.value }; }, Kt = /* @__PURE__ */ it(ot), Ht = /^[cC][^\s-]{8,}$/, Jt = /^[0-9a-z]+$/, Yt = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, Xt = /^[0-9a-vA-V]{20}$/, Qt = /^[A-Za-z0-9]{27}$/, en = /^[a-zA-Z0-9_-]{21}$/, tn = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, nn = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, Pe = (e) => e ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/, on = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, rn = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$"; function sn() { return new RegExp(rn, "u"); } const an = /^(?:(?: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])$/, cn = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/, un = /^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/, ln = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, mn = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, st = /^[A-Za-z0-9_-]*$/, pn = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/, dn = /^\+(?:[0-9]){6,14}[0-9]$/, at = "(?:(?:\\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])))", hn = /* @__PURE__ */ new RegExp(`^${at}$`); function ct(e) { const t = "(?:[01]\\d|2[0-3]):[0-5]\\d"; return typeof e.precision == "number" ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`; } function fn(e) { return new RegExp(`^${ct(e)}$`); } function _n(e) { const t = ct({ precision: e.precision }), n = ["Z"]; e.local && n.push(""), e.offset && n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"); const o = `${t}(?:${n.join("|")})`; return new RegExp(`^${at}T(?:${o})$`); } const gn = (e) => { const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*"; return new RegExp(`^${t}$`); }, vn = /^\d+$/, bn = /^-?\d+(?:\.\d+)?/i, yn = /true|false/i, wn = /^[^A-Z]*$/, zn = /^[^a-z]*$/, x = /* @__PURE__ */ a("$ZodCheck", (e, t) => { var n; e._zod ?? (e._zod = {}), e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []); }), ut = { number: "number", bigint: "bigint", object: "date" }, lt = /* @__PURE__ */ a("$ZodCheckLessThan", (e, t) => { x.init(e, t); const n = ut[typeof t.value]; e._zod.onattach.push((o) => { const r = o._zod.bag, i = (t.inclusive ? r.maximum : r.exclusiveMaximum) ?? Number.POSITIVE_INFINITY; t.value < i && (t.inclusive ? r.maximum = t.value : r.exclusiveMaximum = t.value); }), e._zod.check = (o) => { (t.inclusive ? o.value <= t.value : o.value < t.value) || o.issues.push({ origin: n, code: "too_big", maximum: t.value, input: o.value, inclusive: t.inclusive, inst: e, continue: !t.abort }); }; }), mt = /* @__PURE__ */ a("$ZodCheckGreaterThan", (e, t) => { x.init(e, t); const n = ut[typeof t.value]; e._zod.onattach.push((o) => { const r = o._zod.bag, i = (t.inclusive ? r.minimum : r.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY; t.value > i && (t.inclusive ? r.minimum = t.value : r.exclusiveMinimum = t.value); }), e._zod.check = (o) => { (t.inclusive ? o.value >= t.value : o.value > t.value) || o.issues.push({ origin: n, code: "too_small", minimum: t.value, input: o.value, inclusive: t.inclusive, inst: e, continue: !t.abort }); }; }), Zn = /* @__PURE__ */ a("$ZodCheckMultipleOf", (e, t) => { x.init(e, t), e._zod.onattach.push((n) => { var o; (o = n._zod.bag).multipleOf ?? (o.multipleOf = t.value); }), e._zod.check = (n) => { if (typeof n.value != typeof t.value) throw new Error("Cannot mix number and bigint in multiple_of check."); (typeof n.value == "bigint" ? n.value % t.value === BigInt(0) : Lt(n.value, t.value) === 0) || n.issues.push({ origin: typeof n.value, code: "not_multiple_of", divisor: t.value, input: n.value, inst: e, continue: !t.abort }); }; }), $n = /* @__PURE__ */ a("$ZodCheckNumberFormat", (e, t) => { x.init(e, t), t.format = t.format || "float64"; const n = t.format?.includes("int"), o = n ? "int" : "number", [r, i] = jt[t.format]; e._zod.onattach.push((s) => { const u = s._zod.bag; u.format = t.format, u.minimum = r, u.maximum = i, n && (u.pattern = vn); }), e._zod.check = (s) => { const u = s.value; if (n) { if (!Number.isInteger(u)) { s.issues.push({ expected: o, format: t.format, code: "invalid_type", continue: !1, input: u, inst: e }); return; } if (!Number.isSafeInteger(u)) { u > 0 ? s.issues.push({ input: u, code: "too_big", maximum: Number.MAX_SAFE_INTEGER, note: "Integers must be within the safe integer range.", inst: e, origin: o, continue: !t.abort }) : s.issues.push({ input: u, code: "too_small", minimum: Number.MIN_SAFE_INTEGER, note: "Integers must be within the safe integer range.", inst: e, origin: o, continue: !t.abort }); return; } } u < r && s.issues.push({ origin: "number", input: u, code: "too_small", minimum: r, inclusive: !0, inst: e, continue: !t.abort }), u > i && s.issues.push({ origin: "number", input: u, code: "too_big", maximum: i, inst: e }); }; }), kn = /* @__PURE__ */ a("$ZodCheckMaxLength", (e, t) => { var n; x.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => { const r = o.value; return !ye(r) && r.length !== void 0; }), e._zod.onattach.push((o) => { const r = o._zod.bag.maximum ?? Number.POSITIVE_INFINITY; t.maximum < r && (o._zod.bag.maximum = t.maximum); }), e._zod.check = (o) => { const r = o.value; if (r.length <= t.maximum) return; const s = ze(r); o.issues.push({ origin: s, code: "too_big", maximum: t.maximum, inclusive: !0, input: r, inst: e, continue: !t.abort }); }; }), In = /* @__PURE__ */ a("$ZodCheckMinLength", (e, t) => { var n; x.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => { const r = o.value; return !ye(r) && r.length !== void 0; }), e._zod.onattach.push((o) => { const r = o._zod.bag.minimum ?? Number.NEGATIVE_INFINITY; t.minimum > r && (o._zod.bag.minimum = t.minimum); }), e._zod.check = (o) => { const r = o.value; if (r.length >= t.minimum) return; const s = ze(r); o.issues.push({ origin: s, code: "too_small", minimum: t.minimum, inclusive: !0, input: r, inst: e, continue: !t.abort }); }; }), xn = /* @__PURE__ */ a("$ZodCheckLengthEquals", (e, t) => { var n; x.init(e, t), (n = e._zod.def).when ?? (n.when = (o) => { const r = o.value; return !ye(r) && r.length !== void 0; }), e._zod.onattach.push((o) => { const r = o._zod.bag; r.minimum = t.length, r.maximum = t.length, r.length = t.length; }), e._zod.check = (o) => { const r = o.value, i = r.length; if (i === t.length) return; const s = ze(r), u = i > t.length; o.issues.push({ origin: s, ...u ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length }, inclusive: !0, exact: !0, input: o.value, inst: e, continue: !t.abort }); }; }), se = /* @__PURE__ */ a("$ZodCheckStringFormat", (e, t) => { var n, o; x.init(e, t), e._zod.onattach.push((r) => { const i = r._zod.bag; i.format = t.format, t.pattern && (i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(t.pattern)); }), t.pattern ? (n = e._zod).check ?? (n.check = (r) => { t.pattern.lastIndex = 0, !t.pattern.test(r.value) && r.issues.push({ origin: "string", code: "invalid_format", format: t.format, input: r.value, ...t.pattern ? { pattern: t.pattern.toString() } : {}, inst: e, continue: !t.abort }); }) : (o = e._zod).check ?? (o.check = () => { }); }), En = /* @__PURE__ */ a("$ZodCheckRegex", (e, t) => { se.init(e, t), e._zod.check = (n) => { t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({ origin: "string", code: "invalid_format", format: "regex", input: n.value, pattern: t.pattern.toString(), inst: e, continue: !t.abort }); }; }), Sn = /* @__PURE__ */ a("$ZodCheckLowerCase", (e, t) => { t.pattern ?? (t.pattern = wn), se.init(e, t); }), Pn = /* @__PURE__ */ a("$ZodCheckUpperCase", (e, t) => { t.pattern ?? (t.pattern = zn), se.init(e, t); }), Ln = /* @__PURE__ */ a("$ZodCheckIncludes", (e, t) => { x.init(e, t); const n = ie(t.includes), o = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n); t.pattern = o, e._zod.onattach.push((r) => { const i = r._zod.bag; i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(o); }), e._zod.check = (r) => { r.value.includes(t.includes, t.position) || r.issues.push({ origin: "string", code: "invalid_format", format: "includes", includes: t.includes, input: r.value, inst: e, continue: !t.abort }); }; }), An = /* @__PURE__ */ a("$ZodCheckStartsWith", (e, t) => { x.init(e, t); const n = new RegExp(`^${ie(t.prefix)}.*`); t.pattern ?? (t.pattern = n), e._zod.onattach.push((o) => { const r = o._zod.bag; r.patterns ?? (r.patterns = /* @__PURE__ */ new Set()), r.patterns.add(n); }), e._zod.check = (o) => { o.value.startsWith(t.prefix) || o.issues.push({ origin: "string", code: "invalid_format", format: "starts_with", prefix: t.prefix, input: o.value, inst: e, continue: !t.abort }); }; }), Nn = /* @__PURE__ */ a("$ZodCheckEndsWith", (e, t) => { x.init(e, t); const n = new RegExp(`.*${ie(t.suffix)}$`); t.pattern ?? (t.pattern = n), e._zod.onattach.push((o) => { const r = o._zod.bag; r.patterns ?? (r.patterns = /* @__PURE__ */ new Set()), r.patterns.add(n); }), e._zod.check = (o) => { o.value.endsWith(t.suffix) || o.issues.push({ origin: "string", code: "invalid_format", format: "ends_with", suffix: t.suffix, input: o.value, inst: e, continue: !t.abort }); }; }), Tn = /* @__PURE__ */ a("$ZodCheckOverwrite", (e, t) => { x.init(e, t), e._zod.check = (n) => { n.value = t.tx(n.value); }; }); class Cn { constructor(t = []) { this.content = [], this.indent = 0, this && (this.args = t); } indented(t) { this.indent += 1, t(this), this.indent -= 1; } write(t) { if (typeof t == "function") { t(this, { execution: "sync" }), t(this, { execution: "async" }); return; } const o = t.split(` `).filter((s) => s), r = Math.min(...o.map((s) => s.length - s.trimStart().length)), i = o.map((s) => s.slice(r)).map((s) => " ".repeat(this.indent * 2) + s); for (const s of i) this.content.push(s); } compile() { const t = Function, n = this?.args, r = [...(this?.content ?? [""]).map((i) => ` ${i}`)]; return new t(...n, r.join(` `)); } } const jn = { major: 4, minor: 0, patch: 17 }, y = /* @__PURE__ */ a("$ZodType", (e, t) => { var n; e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = jn; const o = [...e._zod.def.checks ?? []]; e._zod.traits.has("$ZodCheck") && o.unshift(e); for (const r of o) for (const i of r._zod.onattach) i(e); if (o.length === 0) (n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => { e._zod.run = e._zod.parse; }); else { const r = (i, s, u) => { let l = W(i), p; for (const $ of s) { if ($._zod.def.when) { if (!$._zod.def.when(i)) continue; } else if (l) continue; const h = i.issues.length, g = $._zod.check(i); if (g instanceof Promise && u?.async === !1) throw new V(); if (p || g instanceof Promise) p = (p ?? Promise.resolve()).then(async () => { await g, i.issues.length !== h && (l || (l = W(i, h))); }); else { if (i.issues.length === h) continue; l || (l = W(i, h)); } } return p ? p.then(() => i) : i; }; e._zod.run = (i, s) => { const u = e._zod.parse(i, s); if (u instanceof Promise) { if (s.async === !1) throw new V(); return u.then((l) => r(l, o, s)); } return r(u, o, s); }; } e["~standard"] = { validate: (r) => { try { const i = qt(e, r); return i.success ? { value: i.data } : { issues: i.error?.issues }; } catch { return Kt(e, r).then((s) => s.success ? { value: s.data } : { issues: s.error?.issues }); } }, vendor: "zod", version: 1 }; }), Ze = /* @__PURE__ */ a("$ZodString", (e, t) => { y.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? gn(e._zod.bag), e._zod.parse = (n, o) => { if (t.coerce) try { n.value = String(n.value); } catch { } return typeof n.value == "string" || n.issues.push({ expected: "string", code: "invalid_type", input: n.value, inst: e }), n; }; }), b = /* @__PURE__ */ a("$ZodStringFormat", (e, t) => { se.init(e, t), Ze.init(e, t); }), Dn = /* @__PURE__ */ a("$ZodGUID", (e, t) => { t.pattern ?? (t.pattern = nn), b.init(e, t); }), On = /* @__PURE__ */ a("$ZodUUID", (e, t) => { if (t.version) { const o = { v1: 1, v2: 2, v3: 3, v4: 4, v5: 5, v6: 6, v7: 7, v8: 8 }[t.version]; if (o === void 0) throw new Error(`Invalid UUID version: "${t.version}"`); t.pattern ?? (t.pattern = Pe(o)); } else t.pattern ?? (t.pattern = Pe()); b.init(e, t); }), Rn = /* @__PURE__ */ a("$ZodEmail", (e, t) => { t.pattern ?? (t.pattern = on), b.init(e, t); }), Fn = /* @__PURE__ */ a("$ZodURL", (e, t) => { b.init(e, t), e._zod.check = (n) => { try { const o = n.value.trim(), r = new URL(o); t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(r.hostname) || n.issues.push({ code: "invalid_format", format: "url", note: "Invalid hostname", pattern: pn.source, input: n.value, inst: e, continue: !t.abort })), t.protocol && (t.protocol.lastIndex = 0, t.protocol.test(r.protocol.endsWith(":") ? r.protocol.slice(0, -1) : r.protocol) || n.issues.push({ code: "invalid_format", format: "url", note: "Invalid protocol", pattern: t.protocol.source, input: n.value, inst: e, continue: !t.abort })), t.normalize ? n.value = r.href : n.value = o; return; } catch { n.issues.push({ code: "invalid_format", format: "url", input: n.value, inst: e, continue: !t.abort }); } }; }), Un = /* @__PURE__ */ a("$ZodEmoji", (e, t) => { t.pattern ?? (t.pattern = sn()), b.init(e, t); }), Mn = /* @__PURE__ */ a("$ZodNanoID", (e, t) => { t.pattern ?? (t.pattern = en), b.init(e, t); }), Wn = /* @__PURE__ */ a("$ZodCUID", (e, t) => { t.pattern ?? (t.pattern = Ht), b.init(e, t); }), Vn = /* @__PURE__ */ a("$ZodCUID2", (e, t) => { t.pattern ?? (t.pattern = Jt), b.init(e, t); }), Bn = /* @__PURE__ */ a("$ZodULID", (e, t) => { t.pattern ?? (t.pattern = Yt), b.init(e, t); }), Gn = /* @__PURE__ */ a("$ZodXID", (e, t) => { t.pattern ?? (t.pattern = Xt), b.init(e, t); }), qn = /* @__PURE__ */ a("$ZodKSUID", (e, t) => { t.pattern ?? (t.pattern = Qt), b.init(e, t); }), Kn = /* @__PURE__ */ a("$ZodISODateTime", (e, t) => { t.pattern ?? (t.pattern = _n(t)), b.init(e, t); }), Hn = /* @__PURE__ */ a("$ZodISODate", (e, t) => { t.pattern ?? (t.pattern = hn), b.init(e, t); }), Jn = /* @__PURE__ */ a("$ZodISOTime", (e, t) => { t.pattern ?? (t.pattern = fn(t)), b.init(e, t); }), Yn = /* @__PURE__ */ a("$ZodISODuration", (e, t) => { t.pattern ?? (t.pattern = tn), b.init(e, t); }), Xn = /* @__PURE__ */ a("$ZodIPv4", (e, t) => { t.pattern ?? (t.pattern = an), b.init(e, t), e._zod.onattach.push((n) => { const o = n._zod.bag; o.format = "ipv4"; }); }), Qn = /* @__PURE__ */ a("$ZodIPv6", (e, t) => { t.pattern ?? (t.pattern = cn), b.init(e, t), e._zod.onattach.push((n) => { const o = n._zod.bag; o.format = "ipv6"; }), e._zod.check = (n) => { try { new URL(`http://[${n.value}]`); } catch { n.issues.push({ code: "invalid_format", format: "ipv6", input: n.value, inst: e, continue: !t.abort }); } }; }), eo = /* @__PURE__ */ a("$ZodCIDRv4", (e, t) => { t.pattern ?? (t.pattern = un), b.init(e, t); }), to = /* @__PURE__ */ a("$ZodCIDRv6", (e, t) => { t.pattern ?? (t.pattern = ln), b.init(e, t), e._zod.check = (n) => { const [o, r] = n.value.split("/"); try { if (!r) throw new Error(); const i = Number(r); if (`${i}` !== r) throw new Error(); if (i < 0 || i > 128) throw new Error(); new URL(`http://[${o}]`); } catch { n.issues.push({ code: "invalid_format", format: "cidrv6", input: n.value, inst: e, continue: !t.abort }); } }; }); function pt(e) { if (e === "") return !0; if (e.length % 4 !== 0) return !1; try { return atob(e), !0; } catch { return !1; } } const no = /* @__PURE__ */ a("$ZodBase64", (e, t) => { t.pattern ?? (t.pattern = mn), b.init(e, t), e._zod.onattach.push((n) => { n._zod.bag.contentEncoding = "base64"; }), e._zod.check = (n) => { pt(n.value) || n.issues.push({ code: "invalid_format", format: "base64", input: n.value, inst: e, continue: !t.abort }); }; }); function oo(e) { if (!st.test(e)) return !1; const t = e.replace(/[-_]/g, (o) => o === "-" ? "+" : "/"), n = t.padEnd(Math.ceil(t.length / 4) * 4, "="); return pt(n); } const ro = /* @__PURE__ */ a("$ZodBase64URL", (e, t) => { t.pattern ?? (t.pattern = st), b.init(e, t), e._zod.onattach.push((n) => { n._zod.bag.contentEncoding = "base64url"; }), e._zod.check = (n) => { oo(n.value) || n.issues.push({ code: "invalid_format", format: "base64url", input: n.value, inst: e, continue: !t.abort }); }; }), io = /* @__PURE__ */ a("$ZodE164", (e, t) => { t.pattern ?? (t.pattern = dn), b.init(e, t); }); function so(e, t = null) { try { const n = e.split("."); if (n.length !== 3) return !1; const [o] = n; if (!o) return !1; const r = JSON.parse(atob(o)); return !("typ" in r && r?.typ !== "JWT" || !r.alg || t && (!("alg" in r) || r.alg !== t)); } catch { return !1; } } const ao = /* @__PURE__ */ a("$ZodJWT", (e, t) => { b.init(e, t), e._zod.check = (n) => { so(n.value, t.alg) || n.issues.push({ code: "invalid_format", format: "jwt", input: n.value, inst: e, continue: !t.abort }); }; }), dt = /* @__PURE__ */ a("$ZodNumber", (e, t) => { y.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? bn, e._zod.parse = (n, o) => { if (t.coerce) try { n.value = Number(n.value); } catch { } const r = n.value; if (typeof r == "number" && !Number.isNaN(r) && Number.isFinite(r)) return n; const i = typeof r == "number" ? Number.isNaN(r) ? "NaN" : Number.isFinite(r) ? void 0 : "Infinity" : void 0; return n.issues.push({ expected: "number", code: "invalid_type", input: r, inst: e, ...i ? { received: i } : {} }), n; }; }), co = /* @__PURE__ */ a("$ZodNumber", (e, t) => { $n.init(e, t), dt.init(e, t); }), uo = /* @__PURE__ */ a("$ZodBoolean", (e, t) => { y.init(e, t), e._zod.pattern = yn, e._zod.parse = (n, o) => { if (t.coerce) try { n.value = !!n.value; } catch { } const r = n.value; return typeof r == "boolean" || n.issues.push({ expected: "boolean", code: "invalid_type", input: r, inst: e }), n; }; }), lo = /* @__PURE__ */ a("$ZodAny", (e, t) => { y.init(e, t), e._zod.parse = (n) => n; }), mo = /* @__PURE__ */ a("$ZodUnknown", (e, t) => { y.init(e, t), e._zod.parse = (n) => n; }), po = /* @__PURE__ */ a("$ZodNever", (e, t) => { y.init(e, t), e._zod.parse = (n, o) => (n.issues.push({ expected: "never", code: "invalid_type", input: n.value, inst: e }), n); }); function Le(e, t, n) { e.issues.length && t.issues.push(...D(n, e.issues)), t.value[n] = e.value; } const ho = /* @__PURE__ */ a("$ZodArray", (e, t) => { y.init(e, t), e._zod.parse = (n, o) => { const r = n.value; if (!Array.isArray(r)) return n.issues.push({ expected: "array", code: "invalid_type", input: r, inst: e }), n; n.value = Array(r.length); const i = []; for (let s = 0; s < r.length; s++) { const u = r[s], l = t.element._zod.run({ value: u, issues: [] }, o); l instanceof Promise ? i.push(l.then((p) => Le(p, n, s))) : Le(l, n, s); } return i.length ? Promise.all(i).then(() => n) : n; }; }); function X(e, t, n, o) { e.issues.length && t.issues.push(...D(n, e.issues)), e.value === void 0 ? n in o && (t.value[n] = void 0) : t.value[n] = e.value; } const fo = /* @__PURE__ */ a("$ZodObject", (e, t) => { y.init(e, t); const n = Xe(() => { const h = Object.keys(t.shape); for (const v of h) if (!t.shape[v]._zod.traits.has("$ZodType")) throw new Error(`Invalid element at key "${v}": expected a Zod schema`); const g = Ct(t.shape); return { shape: t.shape, keys: h, keySet: new Set(h), numKeys: h.length, optionalKeys: new Set(g) }; }); _(e._zod, "propValues", () => { const h = t.shape, g = {}; for (const v in h) { const E = h[v]._zod; if (E.values) { g[v] ?? (g[v] = /* @__PURE__ */ new Set()); for (const A of E.values) g[v].add(A); } } return g; }); const o = (h) => { const g = new Cn(["shape", "payload", "ctx"]), v = n.value, E = (S) => { const k = Se(S); return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`; }; g.write("const input = payload.value;"); const A = /* @__PURE__ */ Object.create(null); let le = 0; for (const S of v.keys) A[S] = `key_${le++}`; g.write("const newResult = {}"); for (const S of v.keys) { const k = A[S], I = Se(S); g.write(`const ${k} = ${E(S)};`), g.write(` if (${k}.issues.length) { payload.issues = payload.issues.concat(${k}.issues.map(iss => ({ ...iss, path: iss.path ? [${I}, ...iss.path] : [${I}] }))); } if (${k}.value === undefined) { if (${I} in input) { newResult[${I}] = undefined; } } else { newResult[${I}] = ${k}.value; } `); } g.write("payload.value = newResult;"), g.write("return payload;"); const J = g.compile(); return (S, k) => J(h, S, k); }; let r; const i = fe, s = !Ye.jitless, l = s && Nt.value, p = t.catchall; let $; e._zod.parse = (h, g) => { $ ?? ($ = n.value); const v = h.value; if (!i(v)) return h.issues.push({ expected: "object", code: "invalid_type", input: v, inst: e }), h; const E = []; if (s && l && g?.async === !1 && g.jitless !== !0) r || (r = o(t.shape)), h = r(h, g); else { h.value = {}; const k = $.shape; for (const I of $.keys) { const me = k[I]._zod.run({ value: v[I], issues: [] }, g); me instanceof Promise ? E.push(me.then((St) => X(St, h, I, v))) : X(me, h, I, v); } } if (!p) return E.length ? Promise.all(E).then(() => h) : h; const A = [], le = $.keySet, J = p._zod, S = J.def.type; for (const k of Object.keys(v)) { if (le.has(k)) continue; if (S === "never") { A.push(k); continue; } const I = J.run({ value: v[k], issues: [] }, g); I instanceof Promise ? E.push(I.then((Ie) => X(Ie, h, k, v))) : X(I, h, k, v); } return A.length && h.issues.push({ code: "unrecognized_keys", keys: A, input: v, inst: e }), E.length ? Promise.all(E).then(() => h) : h; }; }); function Ae(e, t, n, o) { for (const i of e) if (i.issues.length === 0) return t.value = i.value, t; const r = e.filter((i) => !W(i)); return r.length === 1 ? (t.value = r[0].value, r[0]) : (t.issues.push({ code: "invalid_union", input: t.value, inst: n, errors: e.map((i) => i.issues.map((s) => T(s, o, N()))) }), t); } const _o = /* @__PURE__ */ a("$ZodUnion", (e, t) => { y.init(e, t), _(e._zod, "optin", () => t.options.some((r) => r._zod.optin === "optional") ? "optional" : void 0), _(e._zod, "optout", () => t.options.some((r) => r._zod.optout === "optional") ? "optional" : void 0), _(e._zod, "values", () => { if (t.options.every((r) => r._zod.values)) return new Set(t.options.flatMap((r) => Array.from(r._zod.values))); }), _(e._zod, "pattern", () => { if (t.options.every((r) => r._zod.pattern)) { const r = t.options.map((i) => i._zod.pattern); return new RegExp(`^(${r.map((i) => we(i.source)).join("|")})$`); } }); const n = t.options.length === 1, o = t.options[0]._zod.run; e._zod.parse = (r, i) => { if (n) return o(r, i); let s = !1; const u = []; for (const l of t.options) { const p = l._zod.run({ value: r.value, issues: [] }, i); if (p instanceof Promise) u.push(p), s = !0; else { if (p.issues.length === 0) return p; u.push(p); } } return s ? Promise.all(u).then((l) => Ae(l, r, e, i)) : Ae(u, r, e, i); }; }), go = /* @__PURE__ */ a("$ZodIntersection", (e, t) => { y.init(e, t), e._zod.parse = (n, o) => { const r = n.value, i = t.left._zod.run({ value: r, issues: [] }, o), s = t.right._zod.run({ value: r, issues: [] }, o); return i instanceof Promise || s instanceof Promise ? Promise.all([i, s]).then(([l, p]) => Ne(n, l, p)) : Ne(n, i, s); }; }); function _e(e, t) { if (e === t) return { valid: !0, data: e }; if (e instanceof Date && t instanceof Date && +e == +t) return { valid: !0, data: e }; if (B(e) && B(t)) { const n = Object.keys(t), o = Object.keys(e).filter((i) => n.indexOf(i) !== -1), r = { ...e, ...t }; for (const i of o) { const s = _e(e[i], t[i]); if (!s.valid) return { valid: !1, mergeErrorPath: [i, ...s.mergeErrorPath] }; r[i] = s.data; } return { valid: !0, data: r }; } if (Array.isArray(e) && Array.isArray(t)) { if (e.length !== t.length) return { valid: !1, mergeErrorPath: [] }; const n = []; for (let o = 0; o < e.length; o++) { const r = e[o], i = t[o], s = _e(r, i); if (!s.valid) return { valid: !1, mergeErrorPath: [o, ...s.mergeErrorPath] }; n.push(s.data); } return { valid: !0, data: n }; } return { valid: !1, mergeErrorPath: [] }; } function Ne(e, t, n) { if (t.issues.length && e.issues.push(...t.issues), n.issues.length && e.issues.push(...n.issues), W(e)) return e; const o = _e(t.value, n.value); if (!o.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`); return e.value = o.data, e; } const vo = /* @__PURE__ */ a("$ZodRecord", (e, t) => { y.init(e, t), e._zod.parse = (n, o) => { const r = n.value; if (!B(r)) return n.issues.push({ expected: "record", code: "invalid_type", input: r, inst: e }), n; const i = []; if (t.keyType._zod.values) { const s = t.keyType._zod.values; n.value = {}; for (const l of s) if (typeof l == "string" || typeof l == "number" || typeof l == "symbol") { const p = t.valueType._zod.run({ value: r[l], issues: [] }, o); p instanceof Promise ? i.push(p.then(($) => { $.issues.length && n.issues.push(...D(l, $.issues)), n.value[l] = $.value; })) : (p.issues.length && n.issues.push(...D(l, p.issues)), n.value[l] = p.value); } let u; for (const l in r) s.has(l) || (u = u ?? [], u.push(l)); u && u.length > 0 && n.issues.push({ code: "unrecognized_keys", input: r, inst: e, keys: u }); } else { n.value = {}; for (const s of Reflect.ownKeys(r)) { if (s === "__proto__") continue; const u = t.keyType._zod.run({ value: s, issues: [] }, o); if (u instanceof Promise) throw new Error("Async schemas not supported in object keys currently"); if (u.issues.length) { n.issues.push({ code: "invalid_key", origin: "record", issues: u.issues.map((p) => T(p, o, N())), input: s, path: [s], inst: e }), n.value[u.value] = u.value; continue; } const l = t.valueType._zod.run({ value: r[s], issues: [] }, o); l instanceof Promise ? i.push(l.then((p) => { p.issues.length && n.issues.push(...D(s, p.issues)), n.value[u.value] = p.value; })) : (l.issues.length && n.issues.push(...D(s, l.issues)), n.value[u.value] = l.value); } } return i.length ? Promise.all(i).then(() => n) : n; }; }), bo = /* @__PURE__ */ a("$ZodEnum", (e, t) => { y.init(e, t); const n = Pt(t.entries), o = new Set(n); e._zod.values = o, e._zod.pattern = new RegExp(`^(${n.filter((r) => Tt.has(typeof r)).map((r) => typeof r == "string" ? ie(r) : r.toString()).join("|")})$`), e._zod.parse = (r, i) => { const s = r.value; return o.has(s) || r.issues.push({ code: "invalid_value", values: n, input: s, inst: e }), r; }; }), yo = /* @__PURE__ */ a("$ZodTransform", (e, t) => { y.init(e, t), e._zod.parse = (n, o) => { const r = t.transform(n.value, n); if (o.async) return (r instanceof Promise ? r : Promise.resolve(r)).then((s) => (n.value = s, n)); if (r instanceof Promise) throw new V(); return n.value = r, n; }; }); function Te(e, t) { return e.issues.length && t === void 0 ? { issues: [], value: void 0 } : e; } const wo = /* @__PURE__ */ a("$ZodOptional", (e, t) => { y.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", _(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), _(e._zod, "pattern", () => { const n = t.innerType._zod.pattern; return n ? new RegExp(`^(${we(n.source)})?$`) : void 0; }), e._zod.parse = (n, o) => { if (t.innerType._zod.optin === "optional") { const r = t.innerType._zod.run(n, o); return r instanceof Promise ? r.then((i) => Te(i, n.value)) : Te(r, n.value); } return n.value === void 0 ? n : t.innerType._zod.run(n, o); }; }), zo = /* @__PURE__ */ a("$ZodNullable", (e, t) => { y.init(e, t), _(e._zod, "optin", () => t.innerType._zod.optin), _(e._zod, "optout", () => t.innerType._zod.optout), _(e._zod, "pattern", () => { const n = t.innerType._zod.pattern; return n ? new RegExp(`^(${we(n.source)}|null)$`) : void 0; }), _(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (n, o) => n.value === null ? n : t.innerType._zod.run(n, o); }), Zo = /* @__PURE__ */ a("$ZodDefault", (e, t) => { y.init(e, t), e._zod.optin = "optional", _(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => { if (n.value === void 0) return n.value = t.defaultValue, n; const r = t.innerType._zod.run(n, o); return r instanceof Promise ? r.then((i) => Ce(i, t)) : Ce(r, t); }; }); function Ce(e, t) { return e.value === void 0 && (e.value = t.defaultValue), e; } const $o = /* @__PURE__ */ a("$ZodPrefault", (e, t) => { y.init(e, t), e._zod.optin = "optional", _(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => (n.value === void 0 && (n.value = t.defaultValue), t.innerType._zod.run(n, o)); }), ko = /* @__PURE__ */ a("$ZodNonOptional", (e, t) => { y.init(e, t), _(e._zod, "values", () => { const n = t.innerType._zod.values; return n ? new Set([...n].filter((o) => o !== void 0)) : void 0; }), e._zod.parse = (n, o) => { const r = t.innerType._zod.run(n, o); return r instanceof Promise ? r.then((i) => je(i, e)) : je(r, e); }; }); function je(e, t) { return !e.issues.length && e.value === void 0 && e.issues.push({ code: "invalid_type", expected: "nonoptional", input: e.value, inst: t }), e; } const Io = /* @__PURE__ */ a("$ZodCatch", (e, t) => { y.init(e, t), _(e._zod, "optin", () => t.innerType._zod.optin), _(e._zod, "optout", () => t.innerType._zod.optout), _(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, o) => { const r = t.innerType._zod.run(n, o); return r instanceof Promise ? r.then((i) => (n.value = i.value, i.issues.length && (n.value = t.catchValue({ ...n, error: { issues: i.issues.map((s) => T(s, o, N())) }, input: n.value }), n.issues = []), n)) : (n.value = r.value, r.issues.length && (n.value = t.catchValue({ ...n, error: { issues: r.issues.map((i) => T(i, o, N())) }, input: n.value }), n.issues = []), n); }; }), xo = /* @__PURE__ */ a("$ZodPipe", (e, t) => { y.init(e, t), _(e._zod, "values", () => t.in._zod.values), _(e._zod, "optin", () => t.in._zod.optin), _(e._zod, "optout", () => t.out._zod.optout), _(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (n, o) => { const r = t.in._zod.run(n, o); return r instanceof Promise ? r.then((i) => De(i, t, o)) : De(r, t, o); }; }); function De(e, t, n) { return e.issues.length ? e : t.out._zod.run({ value: e.value, issues: e.issues }, n); } const Eo = /* @__PURE__ */ a("$ZodReadonly", (e, t) => { y.init(e, t), _(e._zod, "propValues", () => t.innerType._zod.propValues), _(e._zod, "values", () => t.innerType._zod.values), _(e._zod, "optin", () => t.innerType._zod.optin), _(e._zod, "optout", () => t.innerType._zod.optout), e._zod.parse = (n, o) => { const r = t.innerType._zod.run(n, o); return r instanceof Promise ? r.then(Oe) : Oe(r); }; }); function Oe(e) { return e.value = Object.freeze(e.value), e; } const So = /* @__PURE__ */ a("$ZodCustom", (e, t) => { x.init(e, t), y.init(e, t), e._zod.parse = (n, o) => n, e._zod.check = (n) => { const o = n.value, r = t.fn(o); if (r instanceof Promise) return r.then((i) => Re(i, n, o, e)); Re(r, n, o, e); }; }); function Re(e, t, n, o) { if (!e) { const r = { code: "custom", input: n, inst: o, // incorporates params.error into issue reporting path: [...o._zod.def.path ?? []], // incorporates params.error into issue reporting continue: !o._zod.def.abort // params: inst._zod.def.params, }; o._zod.def.params && (r.params = o._zod.def.params), t.issues.push(G(r)); } } class Po { constructor() { this._map = /* @__PURE__ */ new Map(), this._idmap = /* @__PURE__ */ new Map(); } add(t, ...n) { const o = n[0]; if (this._map.set(t, o), o && typeof o == "object" && "id" in o) { if (this._idmap.has(o.id)) throw new Error(`ID ${o.id} already exists in the registry`); this._idmap.set(o.id, t); } return this; } clear() { return this._map = /* @__PURE__ */ new Map(), this._idmap = /* @__PURE__ */ new Map(), this; } remove(t) { const n = this._map.get(t); return n && typeof n == "object" && "id" in n && this._idmap.delete(n.id), this._map.delete(t), this; } get(t) { const n = t._zod.parent; if (n) { const o = { ...this.get(n) ?? {} }; delete o.id; const r = { ...o, ...this._map.get(t) }; return Object.keys(r).length ? r : void 0; } return this._map.get(t); } has(t) { return this._map.has(t); } } function Lo() { return new Po(); } const Q = /* @__PURE__ */ Lo(); function Ao(e, t) { return new e({ type: "string", ...m(t) }); } function No(e, t) { return new e({ type: "string", format: "email", check: "string_format", abort: !1, ...m(t) }); } function Fe(e, t) { return new e({ type: "string", format: "guid", check: "string_format", abort: !1, ...m(t) }); } function To(e, t) { return new e({ type: "string", format: "uuid", check: "string_format", abort: !1, ...m(t) }); } function Co(e, t) { return new e({ type: "string", format: "uuid", check: "string_format", abort: !1, version: "v4", ...m(t) }); } function jo(e, t) { return new e({ type: "string", format: "uuid", check: "string_format", abort: !1, version: "v6", ...m(t) }); } function Do(e, t) { return new e({ type: "string", format: "uuid", check: "string_format", abort: !1, version: "v7", ...m(t) }); } function Oo(e, t) { return new e({ type: "string", format: "url", check: "string_format", abort: !1, ...m(t) }); } function Ro(e, t) { return new e({ type: "string", format: "emoji", check: "string_format", abort: !1, ...m(t) }); } function Fo(e, t) { return new e({ type: "string", format: "nanoid", check: "string_format", abort: !1, ...m(t) }); } function Uo(e, t) { return new e({ type: "string", format: "cuid", check: "string_format", abort: !1, ...m(t) }); } function Mo(e, t) { return n