UNPKG

interface-forge

Version:

A TypeScript library for creating strongly typed mock data factories using Faker.js for test data generation

1,567 lines 112 kB
var en = Object.defineProperty; var tn = (e, t, n) => t in e ? en(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var A = (e, t, n) => tn(e, typeof t != "symbol" ? t + "" : t, n); import { F as nn, _ as ie, s as C, D as Y, C as de, m as Qe, S as Te, t as F, a as fe, g as d, x as xe, b as U, N as R, h as rn, c as on } from "./index-CE4wsrD-.mjs"; function c(e, t, n) { function r(u, a) { var l; Object.defineProperty(u, "_zod", { value: u._zod ?? {}, enumerable: !1 }), (l = u._zod).traits ?? (l.traits = /* @__PURE__ */ new Set()), u._zod.traits.add(e), t(u, a); for (const _ in s.prototype) _ in u || Object.defineProperty(u, _, { value: s.prototype[_].bind(u) }); u._zod.constr = s, u._zod.def = a; } const o = n?.Parent ?? Object; class i extends o { } Object.defineProperty(i, "name", { value: e }); function s(u) { var a; const l = n?.Parent ? new i() : this; r(l, u), (a = l._zod).deferred ?? (a.deferred = []); for (const _ of l._zod.deferred) _(); return l; } return Object.defineProperty(s, "init", { value: r }), 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 G extends Error { constructor() { super("Encountered Promise during synchronous parse. Use .parseAsync() instead."); } } const he = {}; function N(e) { return e && Object.assign(he, e), he; } function sn(e) { const t = Object.values(e).filter((r) => typeof r == "number"); return Object.entries(e).filter(([r, o]) => t.indexOf(+r) === -1).map(([r, o]) => o); } function Ie(e, t = "|") { return e.map((n) => rt(n)).join(t); } function un(e, t) { return typeof t == "bigint" ? t.toString() : t; } function ve(e) { return { get value() { { const t = e(); return Object.defineProperty(this, "value", { value: t }), t; } } }; } function j(e) { return e == null; } function _e(e) { const t = e.startsWith("^") ? 1 : 0, n = e.endsWith("$") ? e.length - 1 : e.length; return e.slice(t, n); } function cn(e, t) { const n = (e.toString().split(".")[1] || "").length, r = (t.toString().split(".")[1] || "").length, o = n > r ? n : r, i = Number.parseInt(e.toFixed(o).replace(".", "")), s = Number.parseInt(t.toFixed(o).replace(".", "")); return i % s / 10 ** o; } function Z(e, t, n) { Object.defineProperty(e, t, { get() { { const r = n(); return e[t] = r, r; } }, set(r) { Object.defineProperty(e, t, { value: r // configurable: true, }); }, configurable: !0 }); } function et(e, t, n) { Object.defineProperty(e, t, { value: n, writable: !0, enumerable: !0, configurable: !0 }); } function tt(e = 10) { const t = "abcdefghijklmnopqrstuvwxyz"; let n = ""; for (let r = 0; r < e; r++) n += t[Math.floor(Math.random() * t.length)]; return n; } function V(e) { return JSON.stringify(e); } const nt = Error.captureStackTrace ? Error.captureStackTrace : (...e) => { }; function se(e) { return typeof e == "object" && e !== null && !Array.isArray(e); } const an = ve(() => { if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare")) return !1; try { const e = Function; return new e(""), !0; } catch { return !1; } }); function me(e) { if (se(e) === !1) return !1; const t = e.constructor; if (t === void 0) return !0; const n = t.prototype; return !(se(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1); } const pe = /* @__PURE__ */ new Set(["string", "number", "symbol"]); function W(e) { return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); } function P(e, t, n) { const r = new e._zod.constr(t ?? e._zod.def); return (!t || n?.parent) && (r._zod.parent = e), r; } function f(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 rt(e) { return typeof e == "bigint" ? e.toString() + "n" : typeof e == "string" ? `"${e}"` : `${e}`; } function ln(e) { return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional"); } const dn = { 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 fn(e, t) { const n = {}, r = e._zod.def; for (const o in t) { if (!(o in r.shape)) throw new Error(`Unrecognized key: "${o}"`); t[o] && (n[o] = r.shape[o]); } return P(e, { ...e._zod.def, shape: n, checks: [] }); } function hn(e, t) { const n = { ...e._zod.def.shape }, r = e._zod.def; for (const o in t) { if (!(o in r.shape)) throw new Error(`Unrecognized key: "${o}"`); t[o] && delete n[o]; } return P(e, { ...e._zod.def, shape: n, checks: [] }); } function mn(e, t) { const n = { ...e._zod.def, get shape() { const r = { ...e._zod.def.shape, ...t }; return et(this, "shape", r), r; }, checks: [] // delete existing checks }; return P(e, n); } function pn(e, t) { return P(e, { ...e._zod.def, get shape() { const n = { ...e._zod.def.shape, ...t._zod.def.shape }; return et(this, "shape", n), n; }, catchall: t._zod.def.catchall, checks: [] // delete existing checks }); } function gn(e, t, n) { const r = t._zod.def.shape, o = { ...r }; if (n) for (const i in n) { if (!(i in r)) throw new Error(`Unrecognized key: "${i}"`); n[i] && (o[i] = e ? new e({ type: "optional", innerType: r[i] }) : r[i]); } else for (const i in r) o[i] = e ? new e({ type: "optional", innerType: r[i] }) : r[i]; return P(t, { ...t._zod.def, shape: o, checks: [] }); } function vn(e, t, n) { const r = t._zod.def.shape, o = { ...r }; if (n) for (const i in n) { if (!(i in o)) throw new Error(`Unrecognized key: "${i}"`); n[i] && (o[i] = new e({ type: "nonoptional", innerType: r[i] })); } else for (const i in r) o[i] = new e({ type: "nonoptional", innerType: r[i] }); return P(t, { ...t._zod.def, shape: o, // optional: [], checks: [] }); } function H(e, t = 0) { for (let n = t; n < e.issues.length; n++) if (e.issues[n].continue !== !0) return !0; return !1; } function O(e, t) { return t.map((n) => { var r; return (r = n).path ?? (r.path = []), n.path.unshift(e), n; }); } function Q(e) { return typeof e == "string" ? e : e?.message; } function D(e, t, n) { const r = { ...e, path: e.path ?? [] }; if (!e.message) { const o = Q(e.inst?._zod.def?.error?.(e)) ?? Q(t?.error?.(e)) ?? Q(n.customError?.(e)) ?? Q(n.localeError?.(e)) ?? "Invalid input"; r.message = o; } return delete r.inst, delete r.continue, t?.reportInput || delete r.input, r; } function ye(e) { return e instanceof Set ? "set" : e instanceof Map ? "map" : e instanceof File ? "file" : "unknown"; } function ze(e) { return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown"; } function K(...e) { const [t, n, r] = e; return typeof t == "string" ? { message: t, code: "custom", input: n, inst: r } : { ...t }; } const ot = (e, t) => { e.name = "$ZodError", Object.defineProperty(e, "_zod", { value: e._zod, enumerable: !1 }), Object.defineProperty(e, "issues", { value: t, enumerable: !1 }), Object.defineProperty(e, "message", { get() { return JSON.stringify(t, un, 2); }, enumerable: !0 // configurable: false, }); }, it = c("$ZodError", ot), st = c("$ZodError", ot, { Parent: Error }); function _n(e, t = (n) => n.message) { const n = {}, r = []; for (const o of e.issues) o.path.length > 0 ? (n[o.path[0]] = n[o.path[0]] || [], n[o.path[0]].push(t(o))) : r.push(t(o)); return { formErrors: r, fieldErrors: n }; } function yn(e, t) { const n = t || function(i) { return i.message; }, r = { _errors: [] }, o = (i) => { for (const s of i.issues) if (s.code === "invalid_union" && s.errors.length) s.errors.map((u) => o({ issues: u })); else if (s.code === "invalid_key") o({ issues: s.issues }); else if (s.code === "invalid_element") o({ issues: s.issues }); else if (s.path.length === 0) r._errors.push(n(s)); else { let u = r, a = 0; for (; a < s.path.length; ) { const l = s.path[a]; a === s.path.length - 1 ? (u[l] = u[l] || { _errors: [] }, u[l]._errors.push(n(s))) : u[l] = u[l] || { _errors: [] }, u = u[l], a++; } } }; return o(e), r; } const zn = (e) => (t, n, r, o) => { const i = r ? Object.assign(r, { async: !1 }) : { async: !1 }, s = t._zod.run({ value: n, issues: [] }, i); if (s instanceof Promise) throw new G(); if (s.issues.length) { const u = new (o?.Err ?? e)(s.issues.map((a) => D(a, i, N()))); throw nt(u, o?.callee), u; } return s.value; }, bn = (e) => async (t, n, r, o) => { const i = r ? Object.assign(r, { 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 (o?.Err ?? e)(s.issues.map((a) => D(a, i, N()))); throw nt(u, o?.callee), u; } return s.value; }, ut = (e) => (t, n, r) => { const o = r ? { ...r, async: !1 } : { async: !1 }, i = t._zod.run({ value: n, issues: [] }, o); if (i instanceof Promise) throw new G(); return i.issues.length ? { success: !1, error: new (e ?? it)(i.issues.map((s) => D(s, o, N()))) } : { success: !0, data: i.value }; }, Zn = /* @__PURE__ */ ut(st), ct = (e) => async (t, n, r) => { const o = r ? Object.assign(r, { async: !0 }) : { async: !0 }; let i = t._zod.run({ value: n, issues: [] }, o); return i instanceof Promise && (i = await i), i.issues.length ? { success: !1, error: new e(i.issues.map((s) => D(s, o, N()))) } : { success: !0, data: i.value }; }, kn = /* @__PURE__ */ ct(st), wn = /^[cC][^\s-]{8,}$/, $n = /^[0-9a-z]+$/, Sn = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, Tn = /^[0-9a-vA-V]{20}$/, xn = /^[A-Za-z0-9]{27}$/, In = /^[a-zA-Z0-9_-]{21}$/, En = /^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})$/, Ee = (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)$/, An = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, On = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$"; function Dn() { return new RegExp(On, "u"); } const Fn = /^(?:(?: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})$/, Pn = /^((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])$/, Un = /^(([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])$/, Rn = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, at = /^[A-Za-z0-9_-]*$/, jn = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/, Ln = /^\+(?:[0-9]){6,14}[0-9]$/, lt = "(?:(?:\\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])))", Mn = /* @__PURE__ */ new RegExp(`^${lt}$`); function dt(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 Vn(e) { return new RegExp(`^${dt(e)}$`); } function Bn(e) { const t = dt({ precision: e.precision }), n = ["Z"]; e.local && n.push(""), e.offset && n.push("([+-]\\d{2}:\\d{2})"); const r = `${t}(?:${n.join("|")})`; return new RegExp(`^${lt}T(?:${r})$`); } const Hn = (e) => { const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*"; return new RegExp(`^${t}$`); }, Gn = /^\d+$/, Kn = /^-?\d+(?:\.\d+)?/i, Wn = /true|false/i, Xn = /null/i, qn = /undefined/i, Jn = /^[^A-Z]*$/, Yn = /^[^a-z]*$/, I = /* @__PURE__ */ c("$ZodCheck", (e, t) => { var n; e._zod ?? (e._zod = {}), e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []); }), ft = { number: "number", bigint: "bigint", object: "date" }, ht = /* @__PURE__ */ c("$ZodCheckLessThan", (e, t) => { I.init(e, t); const n = ft[typeof t.value]; e._zod.onattach.push((r) => { const o = r._zod.bag, i = (t.inclusive ? o.maximum : o.exclusiveMaximum) ?? Number.POSITIVE_INFINITY; t.value < i && (t.inclusive ? o.maximum = t.value : o.exclusiveMaximum = t.value); }), e._zod.check = (r) => { (t.inclusive ? r.value <= t.value : r.value < t.value) || r.issues.push({ origin: n, code: "too_big", maximum: t.value, input: r.value, inclusive: t.inclusive, inst: e, continue: !t.abort }); }; }), mt = /* @__PURE__ */ c("$ZodCheckGreaterThan", (e, t) => { I.init(e, t); const n = ft[typeof t.value]; e._zod.onattach.push((r) => { const o = r._zod.bag, i = (t.inclusive ? o.minimum : o.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY; t.value > i && (t.inclusive ? o.minimum = t.value : o.exclusiveMinimum = t.value); }), e._zod.check = (r) => { (t.inclusive ? r.value >= t.value : r.value > t.value) || r.issues.push({ origin: n, code: "too_small", minimum: t.value, input: r.value, inclusive: t.inclusive, inst: e, continue: !t.abort }); }; }), Qn = /* @__PURE__ */ c("$ZodCheckMultipleOf", (e, t) => { I.init(e, t), e._zod.onattach.push((n) => { var r; (r = n._zod.bag).multipleOf ?? (r.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) : cn(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 }); }; }), er = /* @__PURE__ */ c("$ZodCheckNumberFormat", (e, t) => { I.init(e, t), t.format = t.format || "float64"; const n = t.format?.includes("int"), r = n ? "int" : "number", [o, i] = dn[t.format]; e._zod.onattach.push((s) => { const u = s._zod.bag; u.format = t.format, u.minimum = o, u.maximum = i, n && (u.pattern = Gn); }), e._zod.check = (s) => { const u = s.value; if (n) { if (!Number.isInteger(u)) { s.issues.push({ expected: r, format: t.format, code: "invalid_type", 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: r, 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: r, continue: !t.abort }); return; } } u < o && s.issues.push({ origin: "number", input: u, code: "too_small", minimum: o, inclusive: !0, inst: e, continue: !t.abort }), u > i && s.issues.push({ origin: "number", input: u, code: "too_big", maximum: i, inst: e }); }; }), tr = /* @__PURE__ */ c("$ZodCheckMaxSize", (e, t) => { I.init(e, t), e._zod.when = (n) => { const r = n.value; return !j(r) && r.size !== void 0; }, e._zod.onattach.push((n) => { const r = n._zod.bag.maximum ?? Number.POSITIVE_INFINITY; t.maximum < r && (n._zod.bag.maximum = t.maximum); }), e._zod.check = (n) => { const r = n.value; r.size <= t.maximum || n.issues.push({ origin: ye(r), code: "too_big", maximum: t.maximum, input: r, inst: e, continue: !t.abort }); }; }), nr = /* @__PURE__ */ c("$ZodCheckMinSize", (e, t) => { I.init(e, t), e._zod.when = (n) => { const r = n.value; return !j(r) && r.size !== void 0; }, e._zod.onattach.push((n) => { const r = n._zod.bag.minimum ?? Number.NEGATIVE_INFINITY; t.minimum > r && (n._zod.bag.minimum = t.minimum); }), e._zod.check = (n) => { const r = n.value; r.size >= t.minimum || n.issues.push({ origin: ye(r), code: "too_small", minimum: t.minimum, input: r, inst: e, continue: !t.abort }); }; }), rr = /* @__PURE__ */ c("$ZodCheckSizeEquals", (e, t) => { I.init(e, t), e._zod.when = (n) => { const r = n.value; return !j(r) && r.size !== void 0; }, e._zod.onattach.push((n) => { const r = n._zod.bag; r.minimum = t.size, r.maximum = t.size, r.size = t.size; }), e._zod.check = (n) => { const r = n.value, o = r.size; if (o === t.size) return; const i = o > t.size; n.issues.push({ origin: ye(r), ...i ? { code: "too_big", maximum: t.size } : { code: "too_small", minimum: t.size }, input: n.value, inst: e, continue: !t.abort }); }; }), or = /* @__PURE__ */ c("$ZodCheckMaxLength", (e, t) => { I.init(e, t), e._zod.when = (n) => { const r = n.value; return !j(r) && r.length !== void 0; }, e._zod.onattach.push((n) => { const r = n._zod.bag.maximum ?? Number.POSITIVE_INFINITY; t.maximum < r && (n._zod.bag.maximum = t.maximum); }), e._zod.check = (n) => { const r = n.value; if (r.length <= t.maximum) return; const i = ze(r); n.issues.push({ origin: i, code: "too_big", maximum: t.maximum, inclusive: !0, input: r, inst: e, continue: !t.abort }); }; }), ir = /* @__PURE__ */ c("$ZodCheckMinLength", (e, t) => { I.init(e, t), e._zod.when = (n) => { const r = n.value; return !j(r) && r.length !== void 0; }, e._zod.onattach.push((n) => { const r = n._zod.bag.minimum ?? Number.NEGATIVE_INFINITY; t.minimum > r && (n._zod.bag.minimum = t.minimum); }), e._zod.check = (n) => { const r = n.value; if (r.length >= t.minimum) return; const i = ze(r); n.issues.push({ origin: i, code: "too_small", minimum: t.minimum, inclusive: !0, input: r, inst: e, continue: !t.abort }); }; }), sr = /* @__PURE__ */ c("$ZodCheckLengthEquals", (e, t) => { I.init(e, t), e._zod.when = (n) => { const r = n.value; return !j(r) && r.length !== void 0; }, e._zod.onattach.push((n) => { const r = n._zod.bag; r.minimum = t.length, r.maximum = t.length, r.length = t.length; }), e._zod.check = (n) => { const r = n.value, o = r.length; if (o === t.length) return; const i = ze(r), s = o > t.length; n.issues.push({ origin: i, ...s ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length }, input: n.value, inst: e, continue: !t.abort }); }; }), ae = /* @__PURE__ */ c("$ZodCheckStringFormat", (e, t) => { var n; I.init(e, t), e._zod.onattach.push((r) => { const o = r._zod.bag; o.format = t.format, t.pattern && (o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(t.pattern)); }), (n = e._zod).check ?? (n.check = (r) => { if (!t.pattern) throw new Error("Not implemented."); 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 }); }); }), ur = /* @__PURE__ */ c("$ZodCheckRegex", (e, t) => { ae.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 }); }; }), cr = /* @__PURE__ */ c("$ZodCheckLowerCase", (e, t) => { t.pattern ?? (t.pattern = Jn), ae.init(e, t); }), ar = /* @__PURE__ */ c("$ZodCheckUpperCase", (e, t) => { t.pattern ?? (t.pattern = Yn), ae.init(e, t); }), lr = /* @__PURE__ */ c("$ZodCheckIncludes", (e, t) => { I.init(e, t); const n = W(t.includes), r = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n); t.pattern = r, e._zod.onattach.push((o) => { const i = o._zod.bag; i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(r); }), e._zod.check = (o) => { o.value.includes(t.includes, t.position) || o.issues.push({ origin: "string", code: "invalid_format", format: "includes", includes: t.includes, input: o.value, inst: e, continue: !t.abort }); }; }), dr = /* @__PURE__ */ c("$ZodCheckStartsWith", (e, t) => { I.init(e, t); const n = new RegExp(`^${W(t.prefix)}.*`); t.pattern ?? (t.pattern = n), e._zod.onattach.push((r) => { const o = r._zod.bag; o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(n); }), e._zod.check = (r) => { r.value.startsWith(t.prefix) || r.issues.push({ origin: "string", code: "invalid_format", format: "starts_with", prefix: t.prefix, input: r.value, inst: e, continue: !t.abort }); }; }), fr = /* @__PURE__ */ c("$ZodCheckEndsWith", (e, t) => { I.init(e, t); const n = new RegExp(`.*${W(t.suffix)}$`); t.pattern ?? (t.pattern = n), e._zod.onattach.push((r) => { const o = r._zod.bag; o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(n); }), e._zod.check = (r) => { r.value.endsWith(t.suffix) || r.issues.push({ origin: "string", code: "invalid_format", format: "ends_with", suffix: t.suffix, input: r.value, inst: e, continue: !t.abort }); }; }), hr = /* @__PURE__ */ c("$ZodCheckOverwrite", (e, t) => { I.init(e, t), e._zod.check = (n) => { n.value = t.tx(n.value); }; }); class mr { 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 r = t.split(` `).filter((s) => s), o = Math.min(...r.map((s) => s.length - s.trimStart().length)), i = r.map((s) => s.slice(o)).map((s) => " ".repeat(this.indent * 2) + s); for (const s of i) this.content.push(s); } compile() { const t = Function, n = this?.args, o = [...(this?.content ?? [""]).map((i) => ` ${i}`)]; return new t(...n, o.join(` `)); } } const pr = { major: 4, minor: 0, patch: 0 }, y = /* @__PURE__ */ c("$ZodType", (e, t) => { var n; e ?? (e = {}), Z(e._zod, "id", () => t.type + "_" + tt(10)), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = pr; const r = [...e._zod.def.checks ?? []]; e._zod.traits.has("$ZodCheck") && r.unshift(e); for (const o of r) for (const i of o._zod.onattach) i(e); if (r.length === 0) (n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => { e._zod.run = e._zod.parse; }); else { const o = (i, s, u) => { let a = H(i), l; for (const _ of s) { if (_._zod.when) { if (!_._zod.when(i)) continue; } else if (a) continue; const g = i.issues.length, p = _._zod.check(i); if (p instanceof Promise && u?.async === !1) throw new G(); if (l || p instanceof Promise) l = (l ?? Promise.resolve()).then(async () => { await p, i.issues.length !== g && (a || (a = H(i, g))); }); else { if (i.issues.length === g) continue; a || (a = H(i, g)); } } return l ? l.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 G(); return u.then((a) => o(a, r, s)); } return o(u, r, s); }; } e["~standard"] = { validate: (o) => { try { const i = Zn(e, o); return i.success ? { value: i.data } : { issues: i.error?.issues }; } catch { return kn(e, o).then((s) => s.success ? { value: s.data } : { issues: s.error?.issues }); } }, vendor: "zod", version: 1 }; }), be = /* @__PURE__ */ c("$ZodString", (e, t) => { y.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? Hn(e._zod.bag), e._zod.parse = (n, r) => { 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; }; }), k = /* @__PURE__ */ c("$ZodStringFormat", (e, t) => { ae.init(e, t), be.init(e, t); }), gr = /* @__PURE__ */ c("$ZodGUID", (e, t) => { t.pattern ?? (t.pattern = Nn), k.init(e, t); }), vr = /* @__PURE__ */ c("$ZodUUID", (e, t) => { if (t.version) { const r = { v1: 1, v2: 2, v3: 3, v4: 4, v5: 5, v6: 6, v7: 7, v8: 8 }[t.version]; if (r === void 0) throw new Error(`Invalid UUID version: "${t.version}"`); t.pattern ?? (t.pattern = Ee(r)); } else t.pattern ?? (t.pattern = Ee()); k.init(e, t); }), _r = /* @__PURE__ */ c("$ZodEmail", (e, t) => { t.pattern ?? (t.pattern = An), k.init(e, t); }), yr = /* @__PURE__ */ c("$ZodURL", (e, t) => { k.init(e, t), e._zod.check = (n) => { try { const r = new URL(n.value); t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(r.hostname) || n.issues.push({ code: "invalid_format", format: "url", note: "Invalid hostname", pattern: jn.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 })); return; } catch { n.issues.push({ code: "invalid_format", format: "url", input: n.value, inst: e, continue: !t.abort }); } }; }), zr = /* @__PURE__ */ c("$ZodEmoji", (e, t) => { t.pattern ?? (t.pattern = Dn()), k.init(e, t); }), br = /* @__PURE__ */ c("$ZodNanoID", (e, t) => { t.pattern ?? (t.pattern = In), k.init(e, t); }), Zr = /* @__PURE__ */ c("$ZodCUID", (e, t) => { t.pattern ?? (t.pattern = wn), k.init(e, t); }), kr = /* @__PURE__ */ c("$ZodCUID2", (e, t) => { t.pattern ?? (t.pattern = $n), k.init(e, t); }), wr = /* @__PURE__ */ c("$ZodULID", (e, t) => { t.pattern ?? (t.pattern = Sn), k.init(e, t); }), $r = /* @__PURE__ */ c("$ZodXID", (e, t) => { t.pattern ?? (t.pattern = Tn), k.init(e, t); }), Sr = /* @__PURE__ */ c("$ZodKSUID", (e, t) => { t.pattern ?? (t.pattern = xn), k.init(e, t); }), Tr = /* @__PURE__ */ c("$ZodISODateTime", (e, t) => { t.pattern ?? (t.pattern = Bn(t)), k.init(e, t), e._zod.check; }), xr = /* @__PURE__ */ c("$ZodISODate", (e, t) => { t.pattern ?? (t.pattern = Mn), k.init(e, t); }), Ir = /* @__PURE__ */ c("$ZodISOTime", (e, t) => { t.pattern ?? (t.pattern = Vn(t)), k.init(e, t), e._zod.check; }), Er = /* @__PURE__ */ c("$ZodISODuration", (e, t) => { t.pattern ?? (t.pattern = En), k.init(e, t); }), Nr = /* @__PURE__ */ c("$ZodIPv4", (e, t) => { t.pattern ?? (t.pattern = Fn), k.init(e, t), e._zod.onattach.push((n) => { const r = n._zod.bag; r.format = "ipv4"; }); }), Ar = /* @__PURE__ */ c("$ZodIPv6", (e, t) => { t.pattern ?? (t.pattern = Cn), k.init(e, t), e._zod.onattach.push((n) => { const r = n._zod.bag; r.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 }); } }; }), Or = /* @__PURE__ */ c("$ZodCIDRv4", (e, t) => { t.pattern ?? (t.pattern = Pn), k.init(e, t); }), Dr = /* @__PURE__ */ c("$ZodCIDRv6", (e, t) => { t.pattern ?? (t.pattern = Un), k.init(e, t), e._zod.check = (n) => { const [r, o] = n.value.split("/"); try { if (!o) throw new Error(); const i = Number(o); if (`${i}` !== o) throw new Error(); if (i < 0 || i > 128) throw new Error(); new URL(`http://[${r}]`); } 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 Fr = /* @__PURE__ */ c("$ZodBase64", (e, t) => { t.pattern ?? (t.pattern = Rn), k.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 Cr(e) { if (!at.test(e)) return !1; const t = e.replace(/[-_]/g, (r) => r === "-" ? "+" : "/"), n = t.padEnd(Math.ceil(t.length / 4) * 4, "="); return pt(n); } const Pr = /* @__PURE__ */ c("$ZodBase64URL", (e, t) => { t.pattern ?? (t.pattern = at), k.init(e, t), e._zod.onattach.push((n) => { n._zod.bag.contentEncoding = "base64url"; }), e._zod.check = (n) => { Cr(n.value) || n.issues.push({ code: "invalid_format", format: "base64url", input: n.value, inst: e, continue: !t.abort }); }; }), Ur = /* @__PURE__ */ c("$ZodE164", (e, t) => { t.pattern ?? (t.pattern = Ln), k.init(e, t); }); function Rr(e, t = null) { try { const n = e.split("."); if (n.length !== 3) return !1; const [r] = n, o = JSON.parse(atob(r)); return !("typ" in o && o?.typ !== "JWT" || !o.alg || t && (!("alg" in o) || o.alg !== t)); } catch { return !1; } } const jr = /* @__PURE__ */ c("$ZodJWT", (e, t) => { k.init(e, t), e._zod.check = (n) => { Rr(n.value, t.alg) || n.issues.push({ code: "invalid_format", format: "jwt", input: n.value, inst: e, continue: !t.abort }); }; }), gt = /* @__PURE__ */ c("$ZodNumber", (e, t) => { y.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? Kn, e._zod.parse = (n, r) => { if (t.coerce) try { n.value = Number(n.value); } catch { } const o = n.value; if (typeof o == "number" && !Number.isNaN(o) && Number.isFinite(o)) return n; const i = typeof o == "number" ? Number.isNaN(o) ? "NaN" : Number.isFinite(o) ? void 0 : "Infinity" : void 0; return n.issues.push({ expected: "number", code: "invalid_type", input: o, inst: e, ...i ? { received: i } : {} }), n; }; }), Lr = /* @__PURE__ */ c("$ZodNumber", (e, t) => { er.init(e, t), gt.init(e, t); }), Mr = /* @__PURE__ */ c("$ZodBoolean", (e, t) => { y.init(e, t), e._zod.pattern = Wn, e._zod.parse = (n, r) => { if (t.coerce) try { n.value = !!n.value; } catch { } const o = n.value; return typeof o == "boolean" || n.issues.push({ expected: "boolean", code: "invalid_type", input: o, inst: e }), n; }; }), Vr = /* @__PURE__ */ c("$ZodUndefined", (e, t) => { y.init(e, t), e._zod.pattern = qn, e._zod.values = /* @__PURE__ */ new Set([void 0]), e._zod.parse = (n, r) => { const { value: o } = n; return typeof o > "u" || n.issues.push({ expected: "undefined", code: "invalid_type", input: o, inst: e }), n; }; }), Br = /* @__PURE__ */ c("$ZodNull", (e, t) => { y.init(e, t), e._zod.pattern = Xn, e._zod.values = /* @__PURE__ */ new Set([null]), e._zod.parse = (n, r) => { const { value: o } = n; return o === null || n.issues.push({ expected: "null", code: "invalid_type", input: o, inst: e }), n; }; }), Hr = /* @__PURE__ */ c("$ZodAny", (e, t) => { y.init(e, t), e._zod.parse = (n) => n; }), Gr = /* @__PURE__ */ c("$ZodUnknown", (e, t) => { y.init(e, t), e._zod.parse = (n) => n; }), Kr = /* @__PURE__ */ c("$ZodNever", (e, t) => { y.init(e, t), e._zod.parse = (n, r) => (n.issues.push({ expected: "never", code: "invalid_type", input: n.value, inst: e }), n); }), Wr = /* @__PURE__ */ c("$ZodVoid", (e, t) => { y.init(e, t), e._zod.parse = (n, r) => { const { value: o } = n; return typeof o > "u" || n.issues.push({ expected: "void", code: "invalid_type", input: o, inst: e }), n; }; }), Xr = /* @__PURE__ */ c("$ZodDate", (e, t) => { y.init(e, t), e._zod.parse = (n, r) => { if (t.coerce) try { n.value = new Date(n.value); } catch { } const o = n.value, i = o instanceof Date; return i && !Number.isNaN(o.getTime()) || n.issues.push({ expected: "date", code: "invalid_type", input: o, ...i ? { received: "Invalid Date" } : {}, inst: e }), n; }; }); function Ne(e, t, n) { e.issues.length && t.issues.push(...O(n, e.issues)), t.value[n] = e.value; } const qr = /* @__PURE__ */ c("$ZodArray", (e, t) => { y.init(e, t), e._zod.parse = (n, r) => { const o = n.value; if (!Array.isArray(o)) return n.issues.push({ expected: "array", code: "invalid_type", input: o, inst: e }), n; n.value = Array(o.length); const i = []; for (let s = 0; s < o.length; s++) { const u = o[s], a = t.element._zod.run({ value: u, issues: [] }, r); a instanceof Promise ? i.push(a.then((l) => Ne(l, n, s))) : Ne(a, n, s); } return i.length ? Promise.all(i).then(() => n) : n; }; }); function ee(e, t, n) { e.issues.length && t.issues.push(...O(n, e.issues)), t.value[n] = e.value; } function Ae(e, t, n, r) { e.issues.length ? r[n] === void 0 ? n in r ? t.value[n] = void 0 : t.value[n] = e.value : t.issues.push(...O(n, e.issues)) : e.value === void 0 ? n in r && (t.value[n] = void 0) : t.value[n] = e.value; } const Jr = /* @__PURE__ */ c("$ZodObject", (e, t) => { y.init(e, t); const n = ve(() => { const g = Object.keys(t.shape); for (const v of g) if (!(t.shape[v] instanceof y)) throw new Error(`Invalid element at key "${v}": expected a Zod schema`); const p = ln(t.shape); return { shape: t.shape, keys: g, keySet: new Set(g), numKeys: g.length, optionalKeys: new Set(p) }; }); Z(e._zod, "propValues", () => { const g = t.shape, p = {}; for (const v in g) { const w = g[v]._zod; if (w.values) { p[v] ?? (p[v] = /* @__PURE__ */ new Set()); for (const E of w.values) p[v].add(E); } } return p; }); const r = (g) => { const p = new mr(["shape", "payload", "ctx"]), { keys: v, optionalKeys: w } = n.value, E = (x) => { const $ = V(x); return `shape[${$}]._zod.run({ value: input[${$}], issues: [] }, ctx)`; }; p.write("const input = payload.value;"); const L = /* @__PURE__ */ Object.create(null); for (const x of v) L[x] = tt(15); p.write("const newResult = {}"); for (const x of v) if (w.has(x)) { const $ = L[x]; p.write(`const ${$} = ${E(x)};`); const T = V(x); p.write(` if (${$}.issues.length) { if (input[${T}] === undefined) { if (${T} in input) { newResult[${T}] = undefined; } } else { payload.issues = payload.issues.concat( ${$}.issues.map((iss) => ({ ...iss, path: iss.path ? [${T}, ...iss.path] : [${T}], })) ); } } else if (${$}.value === undefined) { if (${T} in input) newResult[${T}] = undefined; } else { newResult[${T}] = ${$}.value; } `); } else { const $ = L[x]; p.write(`const ${$} = ${E(x)};`), p.write(` if (${$}.issues.length) payload.issues = payload.issues.concat(${$}.issues.map(iss => ({ ...iss, path: iss.path ? [${V(x)}, ...iss.path] : [${V(x)}] })));`), p.write(`newResult[${V(x)}] = ${$}.value`); } p.write("payload.value = newResult;"), p.write("return payload;"); const q = p.compile(); return (x, $) => q(g, x, $); }; let o; const i = se, s = !he.jitless, a = s && an.value, { catchall: l } = t; let _; e._zod.parse = (g, p) => { _ ?? (_ = n.value); const v = g.value; if (!i(v)) return g.issues.push({ expected: "object", code: "invalid_type", input: v, inst: e }), g; const w = []; if (s && a && p?.async === !1 && p.jitless !== !0) o || (o = r(t.shape)), g = o(g, p); else { g.value = {}; const $ = _.shape; for (const T of _.keys) { const M = $[T], J = M._zod.run({ value: v[T], issues: [] }, p), $e = M._zod.optin === "optional" && M._zod.optout === "optional"; J instanceof Promise ? w.push(J.then((Se) => $e ? Ae(Se, g, T, v) : ee(Se, g, T))) : $e ? Ae(J, g, T, v) : ee(J, g, T); } } if (!l) return w.length ? Promise.all(w).then(() => g) : g; const E = [], L = _.keySet, q = l._zod, x = q.def.type; for (const $ of Object.keys(v)) { if (L.has($)) continue; if (x === "never") { E.push($); continue; } const T = q.run({ value: v[$], issues: [] }, p); T instanceof Promise ? w.push(T.then((M) => ee(M, g, $))) : ee(T, g, $); } return E.length && g.issues.push({ code: "unrecognized_keys", keys: E, input: v, inst: e }), w.length ? Promise.all(w).then(() => g) : g; }; }); function Oe(e, t, n, r) { for (const o of e) if (o.issues.length === 0) return t.value = o.value, t; return t.issues.push({ code: "invalid_union", input: t.value, inst: n, errors: e.map((o) => o.issues.map((i) => D(i, r, N()))) }), t; } const vt = /* @__PURE__ */ c("$ZodUnion", (e, t) => { y.init(e, t), Z(e._zod, "values", () => { if (t.options.every((n) => n._zod.values)) return new Set(t.options.flatMap((n) => Array.from(n._zod.values))); }), Z(e._zod, "pattern", () => { if (t.options.every((n) => n._zod.pattern)) { const n = t.options.map((r) => r._zod.pattern); return new RegExp(`^(${n.map((r) => _e(r.source)).join("|")})$`); } }), e._zod.parse = (n, r) => { let o = !1; const i = []; for (const s of t.options) { const u = s._zod.run({ value: n.value, issues: [] }, r); if (u instanceof Promise) i.push(u), o = !0; else { if (u.issues.length === 0) return u; i.push(u); } } return o ? Promise.all(i).then((s) => Oe(s, n, e, r)) : Oe(i, n, e, r); }; }), Yr = /* @__PURE__ */ c("$ZodDiscriminatedUnion", (e, t) => { vt.init(e, t); const n = e._zod.parse; Z(e._zod, "propValues", () => { const o = {}; for (const i of t.options) { const s = i._zod.propValues; if (!s || Object.keys(s).length === 0) throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`); for (const [u, a] of Object.entries(s)) { o[u] || (o[u] = /* @__PURE__ */ new Set()); for (const l of a) o[u].add(l); } } return o; }); const r = ve(() => { const o = t.options, i = /* @__PURE__ */ new Map(); for (const s of o) { const u = s._zod.propValues[t.discriminator]; if (!u || u.size === 0) throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`); for (const a of u) { if (i.has(a)) throw new Error(`Duplicate discriminator value "${String(a)}"`); i.set(a, s); } } return i; }); e._zod.parse = (o, i) => { const s = o.value; if (!se(s)) return o.issues.push({ code: "invalid_type", expected: "object", input: s, inst: e }), o; const u = r.value.get(s?.[t.discriminator]); return u ? u._zod.run(o, i) : t.unionFallback ? n(o, i) : (o.issues.push({ code: "invalid_union", errors: [], note: "No matching discriminator", input: s, path: [t.discriminator], inst: e }), o); }; }), Qr = /* @__PURE__ */ c("$ZodIntersection", (e, t) => { y.init(e, t), e._zod.parse = (n, r) => { const { value: o } = n, i = t.left._zod.run({ value: o, issues: [] }, r), s = t.right._zod.run({ value: o, issues: [] }, r); return i instanceof Promise || s instanceof Promise ? Promise.all([i, s]).then(([a, l]) => De(n, a, l)) : De(n, i, s); }; }); function ge(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 (me(e) && me(t)) { const n = Object.keys(t), r = Object.keys(e).filter((i) => n.indexOf(i) !== -1), o = { ...e, ...t }; for (const i of r) { const s = ge(e[i], t[i]); if (!s.valid) return { valid: !1, mergeErrorPath: [i, ...s.mergeErrorPath] }; o[i] = s.data; } return { valid: !0, data: o }; } if (Array.isArray(e) && Array.isArray(t)) { if (e.length !== t.length) return { valid: !1, mergeErrorPath: [] }; const n = []; for (let r = 0; r < e.length; r++) { const o = e[r], i = t[r], s = ge(o, i); if (!s.valid) return { valid: !1, mergeErrorPath: [r, ...s.mergeErrorPath] }; n.push(s.data); } return { valid: !0, data: n }; } return { valid: !1, mergeErrorPath: [] }; } function De(e, t, n) { if (t.issues.length && e.issues.push(...t.issues), n.issues.length && e.issues.push(...n.issues), H(e)) return e; const r = ge(t.value, n.value); if (!r.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`); return e.value = r.data, e; } const eo = /* @__PURE__ */ c("$ZodTuple", (e, t) => { y.init(e, t); const n = t.items, r = n.length - [...n].reverse().findIndex((o) => o._zod.optin !== "optional"); e._zod.parse = (o, i) => { const s = o.value; if (!Array.isArray(s)) return o.issues.push({ input: s, inst: e, expected: "tuple", code: "invalid_type" }), o; o.value = []; const u = []; if (!t.rest) { const l = s.length > n.length, _ = s.length < r - 1; if (l || _) return o.issues.push({ input: s, inst: e, origin: "array", ...l ? { code: "too_big", maximum: n.length } : { code: "too_small", minimum: n.length } }), o; } let a = -1; for (const l of n) { if (a++, a >= s.length && a >= r) continue; const _ = l._zod.run({ value: s[a], issues: [] }, i); _ instanceof Promise ? u.push(_.then((g) => te(g, o, a))) : te(_, o, a); } if (t.rest) { const l = s.slice(n.length); for (const _ of l) { a++; const g = t.rest._zod.run({ value: _, issues: [] }, i); g instanceof Promise ? u.push(g.then((p) => te(p, o, a))) : te(g, o, a); } } return u.length ? Promise.all(u).then(() => o) : o; }; }); function te(e, t, n) { e.issues.length && t.issues.push(...O(n, e.issues)), t.value[n] = e.value; } const to = /* @__PURE__ */ c("$ZodRecord", (e, t) => { y.init(e, t), e._zod.parse = (n, r) => { const o = n.value; if (!me(o)) return n.issues.push({ expected: "record", code: "invalid_type", input: o, inst: e }), n; const i = []; if (t.keyType._zod.values) { const s = t.keyType._zod.values; n.value = {}; for (const a of s) if (typeof a == "string" || typeof a == "number" || typeof a == "symbol") { const l = t.valueType._zod.run({ value: o[a], issues: [] }, r); l instanceof Promise ? i.push(l.then((_) => { _.issues.length && n.issues.push(...O(a, _.issues)), n.value[a] = _.value; })) : (l.issues.length && n.issues.push(...O(a, l.issues)), n.value[a] = l.value); } let u; for (const a in o) s.has(a) || (u = u ?? [], u.push(a)); u && u.length > 0 && n.issues.push({ code: "unrecognized_keys", input: o, inst: e, keys: u }); } else { n.value = {}; for (const s of Reflect.ownKeys(o)) { if (s === "__proto__") continue; const u = t.keyType._zod.run({ value: s, issues: [] }, r); if (u instanceof Promise) throw new Error("Async schemas not supported in object keys currently"); if (u.issues.length) { n.issues.push({ origin: "record", code: "invalid_key", issues: u.issues.map((l) => D(l, r, N())), input: s, path: [s], inst: e }), n.value[u.value] = u.value; continue; } const a = t.valueType._zod.run({ value: o[s], issues: [] }, r); a instanceof Promise ? i.push(a.then((l) => { l.issues.length && n.issues.push(...O(s, l.issues)), n.value[u.value] = l.value; })) : (a.issues.length && n.issues.push(...O(s, a.issues)), n.value[u.value] = a.value); } } return i.length ? Promise.all(i).then(() => n) : n; }; }), no = /* @__PURE__ */ c("$ZodMap", (e, t) => { y.init(e, t), e._zod.parse = (n, r) => { const o = n.value; if (!(o instanceof Map)) return n.issues.push({ expected: "map", code: "invalid_type", input: o, inst: e }), n; const i = []; n.value = /* @__PURE__ */ new Map(); for (const [s, u] of o) { const a = t.keyType._zod.run({ value: s, issues: [] }, r), l = t.valueType._zod.run({ value: u, issues: [] }, r); a instanceof Promise || l instanceof Promise ? i.push(Promise.all([a, l]).then(([_, g]) => { Fe(_, g, n, s, o, e, r); })) : Fe(a, l, n, s, o, e, r); } return i.length ? Promise.all(i).then(() => n) : n; }; }); function Fe(e, t, n, r, o, i, s) { e.issues.length && (pe.has(typeof r) ? n.issues.push(...O(r, e.issues)) : n.issues.push({ origin: "map", code: "invalid_key", input: o, inst: i, issues: e.issues.map((u) => D(u, s, N())) })), t.issues.length && (pe.has(typeof r) ? n.issues.push(...O(r, t.issues)) : n.issues.push({ origin: "map", code: "invalid_element", input: o, inst: i, key: r, issues: t.issues.map((u) => D(u, s, N())) })), n.value.set(e.value, t.value); } const ro = /* @__PURE__ */ c("$ZodSet", (e, t) => { y.init(e, t), e._zod.parse = (n, r) => { const o = n.value; if (!(o instanceof Set)) return n.issues.push({ input: o, inst: e, expected: "set", code: "invalid_type" }), n; const i = []; n.value = /* @__PURE__ */ new Set(); for (const s of o) { const u = t.valueType._zod.run({ value: s, issues: [] }, r); u instanceof Promise ? i.push(u.then((a) => Ce(a, n))) : Ce(u, n); } return i.length ? Promise.all(i).then(() => n) : n; }; }); function Ce(e, t) { e.issues.length && t.issues.push(...e.issues), t.value.add(e.value); } const oo = /* @__PURE__ */ c("$ZodEnum", (e, t) => { y.init(e, t); const n = sn(t.entries); e._zod.values = new Set(n), e._zod.pattern = new RegExp(`^(${n.filter((r) => pe.has(typeof r)).map((r) => typeof r == "string" ? W(r) : r.toString()).join("|")})$`), e._zod.parse = (r, o) => { const i = r.value; return e._zod.values.has(i) || r.issues.push({ code: "invalid_value", values: n, input