UNPKG

@abyrd9/zod-form-data

Version:

Type-safe Zod v4 utilities to flatten and unflatten data, parse FormData, and collect schema-aligned errors.

1,568 lines (1,559 loc) 431 kB
var __defProp = Object.defineProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true, configurable: true, set: (newValue) => all[name] = () => newValue }); }; // node_modules/zod/v4/classic/external.js var exports_external = {}; __export(exports_external, { xid: () => xid2, void: () => _void2, uuidv7: () => uuidv7, uuidv6: () => uuidv6, uuidv4: () => uuidv4, uuid: () => uuid2, util: () => exports_util, url: () => url, uppercase: () => _uppercase, unknown: () => unknown, union: () => union, undefined: () => _undefined3, ulid: () => ulid2, uint64: () => uint64, uint32: () => uint32, tuple: () => tuple, trim: () => _trim, treeifyError: () => treeifyError, transform: () => transform, toUpperCase: () => _toUpperCase, toLowerCase: () => _toLowerCase, toJSONSchema: () => toJSONSchema, templateLiteral: () => templateLiteral, symbol: () => symbol, superRefine: () => superRefine, success: () => success, stringbool: () => stringbool, stringFormat: () => stringFormat, string: () => string2, strictObject: () => strictObject, startsWith: () => _startsWith, size: () => _size, setErrorMap: () => setErrorMap, set: () => set, safeParseAsync: () => safeParseAsync2, safeParse: () => safeParse2, safeEncodeAsync: () => safeEncodeAsync2, safeEncode: () => safeEncode2, safeDecodeAsync: () => safeDecodeAsync2, safeDecode: () => safeDecode2, registry: () => registry, regexes: () => exports_regexes, regex: () => _regex, refine: () => refine, record: () => record, readonly: () => readonly, property: () => _property, promise: () => promise, prettifyError: () => prettifyError, preprocess: () => preprocess, prefault: () => prefault, positive: () => _positive, pipe: () => pipe, partialRecord: () => partialRecord, parseAsync: () => parseAsync2, parse: () => parse3, overwrite: () => _overwrite, optional: () => optional, object: () => object, number: () => number2, nullish: () => nullish2, nullable: () => nullable, null: () => _null3, normalize: () => _normalize, nonpositive: () => _nonpositive, nonoptional: () => nonoptional, nonnegative: () => _nonnegative, never: () => never, negative: () => _negative, nativeEnum: () => nativeEnum, nanoid: () => nanoid2, nan: () => nan, multipleOf: () => _multipleOf, minSize: () => _minSize, minLength: () => _minLength, mime: () => _mime, maxSize: () => _maxSize, maxLength: () => _maxLength, map: () => map, lte: () => _lte, lt: () => _lt, lowercase: () => _lowercase, looseObject: () => looseObject, locales: () => exports_locales, literal: () => literal, length: () => _length, lazy: () => lazy, ksuid: () => ksuid2, keyof: () => keyof, jwt: () => jwt, json: () => json, iso: () => exports_iso, ipv6: () => ipv62, ipv4: () => ipv42, intersection: () => intersection, int64: () => int64, int32: () => int32, int: () => int, instanceof: () => _instanceof, includes: () => _includes, httpUrl: () => httpUrl, hostname: () => hostname2, hex: () => hex2, hash: () => hash, guid: () => guid2, gte: () => _gte, gt: () => _gt, globalRegistry: () => globalRegistry, getErrorMap: () => getErrorMap, function: () => _function, formatError: () => formatError, float64: () => float64, float32: () => float32, flattenError: () => flattenError, file: () => file, enum: () => _enum2, endsWith: () => _endsWith, encodeAsync: () => encodeAsync2, encode: () => encode2, emoji: () => emoji2, email: () => email2, e164: () => e1642, discriminatedUnion: () => discriminatedUnion, decodeAsync: () => decodeAsync2, decode: () => decode2, date: () => date3, custom: () => custom, cuid2: () => cuid22, cuid: () => cuid3, core: () => exports_core2, config: () => config, coerce: () => exports_coerce, codec: () => codec, clone: () => clone, cidrv6: () => cidrv62, cidrv4: () => cidrv42, check: () => check, catch: () => _catch2, boolean: () => boolean2, bigint: () => bigint2, base64url: () => base64url2, base64: () => base642, array: () => array, any: () => any, _function: () => _function, _default: () => _default2, _ZodString: () => _ZodString, ZodXID: () => ZodXID, ZodVoid: () => ZodVoid, ZodUnknown: () => ZodUnknown, ZodUnion: () => ZodUnion, ZodUndefined: () => ZodUndefined, ZodUUID: () => ZodUUID, ZodURL: () => ZodURL, ZodULID: () => ZodULID, ZodType: () => ZodType, ZodTuple: () => ZodTuple, ZodTransform: () => ZodTransform, ZodTemplateLiteral: () => ZodTemplateLiteral, ZodSymbol: () => ZodSymbol, ZodSuccess: () => ZodSuccess, ZodStringFormat: () => ZodStringFormat, ZodString: () => ZodString, ZodSet: () => ZodSet, ZodRecord: () => ZodRecord, ZodRealError: () => ZodRealError, ZodReadonly: () => ZodReadonly, ZodPromise: () => ZodPromise, ZodPrefault: () => ZodPrefault, ZodPipe: () => ZodPipe, ZodOptional: () => ZodOptional, ZodObject: () => ZodObject, ZodNumberFormat: () => ZodNumberFormat, ZodNumber: () => ZodNumber, ZodNullable: () => ZodNullable, ZodNull: () => ZodNull, ZodNonOptional: () => ZodNonOptional, ZodNever: () => ZodNever, ZodNanoID: () => ZodNanoID, ZodNaN: () => ZodNaN, ZodMap: () => ZodMap, ZodLiteral: () => ZodLiteral, ZodLazy: () => ZodLazy, ZodKSUID: () => ZodKSUID, ZodJWT: () => ZodJWT, ZodIssueCode: () => ZodIssueCode, ZodIntersection: () => ZodIntersection, ZodISOTime: () => ZodISOTime, ZodISODuration: () => ZodISODuration, ZodISODateTime: () => ZodISODateTime, ZodISODate: () => ZodISODate, ZodIPv6: () => ZodIPv6, ZodIPv4: () => ZodIPv4, ZodGUID: () => ZodGUID, ZodFunction: () => ZodFunction, ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind, ZodFile: () => ZodFile, ZodError: () => ZodError, ZodEnum: () => ZodEnum, ZodEmoji: () => ZodEmoji, ZodEmail: () => ZodEmail, ZodE164: () => ZodE164, ZodDiscriminatedUnion: () => ZodDiscriminatedUnion, ZodDefault: () => ZodDefault, ZodDate: () => ZodDate, ZodCustomStringFormat: () => ZodCustomStringFormat, ZodCustom: () => ZodCustom, ZodCodec: () => ZodCodec, ZodCatch: () => ZodCatch, ZodCUID2: () => ZodCUID2, ZodCUID: () => ZodCUID, ZodCIDRv6: () => ZodCIDRv6, ZodCIDRv4: () => ZodCIDRv4, ZodBoolean: () => ZodBoolean, ZodBigIntFormat: () => ZodBigIntFormat, ZodBigInt: () => ZodBigInt, ZodBase64URL: () => ZodBase64URL, ZodBase64: () => ZodBase64, ZodArray: () => ZodArray, ZodAny: () => ZodAny, TimePrecision: () => TimePrecision, NEVER: () => NEVER, $output: () => $output, $input: () => $input, $brand: () => $brand }); // node_modules/zod/v4/core/index.js var exports_core2 = {}; __export(exports_core2, { version: () => version, util: () => exports_util, treeifyError: () => treeifyError, toJSONSchema: () => toJSONSchema, toDotPath: () => toDotPath, safeParseAsync: () => safeParseAsync, safeParse: () => safeParse, safeEncodeAsync: () => safeEncodeAsync, safeEncode: () => safeEncode, safeDecodeAsync: () => safeDecodeAsync, safeDecode: () => safeDecode, registry: () => registry, regexes: () => exports_regexes, prettifyError: () => prettifyError, parseAsync: () => parseAsync, parse: () => parse, locales: () => exports_locales, isValidJWT: () => isValidJWT, isValidBase64URL: () => isValidBase64URL, isValidBase64: () => isValidBase64, globalRegistry: () => globalRegistry, globalConfig: () => globalConfig, formatError: () => formatError, flattenError: () => flattenError, encodeAsync: () => encodeAsync, encode: () => encode, decodeAsync: () => decodeAsync, decode: () => decode, config: () => config, clone: () => clone, _xid: () => _xid, _void: () => _void, _uuidv7: () => _uuidv7, _uuidv6: () => _uuidv6, _uuidv4: () => _uuidv4, _uuid: () => _uuid, _url: () => _url, _uppercase: () => _uppercase, _unknown: () => _unknown, _union: () => _union, _undefined: () => _undefined2, _ulid: () => _ulid, _uint64: () => _uint64, _uint32: () => _uint32, _tuple: () => _tuple, _trim: () => _trim, _transform: () => _transform, _toUpperCase: () => _toUpperCase, _toLowerCase: () => _toLowerCase, _templateLiteral: () => _templateLiteral, _symbol: () => _symbol, _superRefine: () => _superRefine, _success: () => _success, _stringbool: () => _stringbool, _stringFormat: () => _stringFormat, _string: () => _string, _startsWith: () => _startsWith, _size: () => _size, _set: () => _set, _safeParseAsync: () => _safeParseAsync, _safeParse: () => _safeParse, _safeEncodeAsync: () => _safeEncodeAsync, _safeEncode: () => _safeEncode, _safeDecodeAsync: () => _safeDecodeAsync, _safeDecode: () => _safeDecode, _regex: () => _regex, _refine: () => _refine, _record: () => _record, _readonly: () => _readonly, _property: () => _property, _promise: () => _promise, _positive: () => _positive, _pipe: () => _pipe, _parseAsync: () => _parseAsync, _parse: () => _parse, _overwrite: () => _overwrite, _optional: () => _optional, _number: () => _number, _nullable: () => _nullable, _null: () => _null2, _normalize: () => _normalize, _nonpositive: () => _nonpositive, _nonoptional: () => _nonoptional, _nonnegative: () => _nonnegative, _never: () => _never, _negative: () => _negative, _nativeEnum: () => _nativeEnum, _nanoid: () => _nanoid, _nan: () => _nan, _multipleOf: () => _multipleOf, _minSize: () => _minSize, _minLength: () => _minLength, _min: () => _gte, _mime: () => _mime, _maxSize: () => _maxSize, _maxLength: () => _maxLength, _max: () => _lte, _map: () => _map, _lte: () => _lte, _lt: () => _lt, _lowercase: () => _lowercase, _literal: () => _literal, _length: () => _length, _lazy: () => _lazy, _ksuid: () => _ksuid, _jwt: () => _jwt, _isoTime: () => _isoTime, _isoDuration: () => _isoDuration, _isoDateTime: () => _isoDateTime, _isoDate: () => _isoDate, _ipv6: () => _ipv6, _ipv4: () => _ipv4, _intersection: () => _intersection, _int64: () => _int64, _int32: () => _int32, _int: () => _int, _includes: () => _includes, _guid: () => _guid, _gte: () => _gte, _gt: () => _gt, _float64: () => _float64, _float32: () => _float32, _file: () => _file, _enum: () => _enum, _endsWith: () => _endsWith, _encodeAsync: () => _encodeAsync, _encode: () => _encode, _emoji: () => _emoji2, _email: () => _email, _e164: () => _e164, _discriminatedUnion: () => _discriminatedUnion, _default: () => _default, _decodeAsync: () => _decodeAsync, _decode: () => _decode, _date: () => _date, _custom: () => _custom, _cuid2: () => _cuid2, _cuid: () => _cuid, _coercedString: () => _coercedString, _coercedNumber: () => _coercedNumber, _coercedDate: () => _coercedDate, _coercedBoolean: () => _coercedBoolean, _coercedBigint: () => _coercedBigint, _cidrv6: () => _cidrv6, _cidrv4: () => _cidrv4, _check: () => _check, _catch: () => _catch, _boolean: () => _boolean, _bigint: () => _bigint, _base64url: () => _base64url, _base64: () => _base64, _array: () => _array, _any: () => _any, TimePrecision: () => TimePrecision, NEVER: () => NEVER, JSONSchemaGenerator: () => JSONSchemaGenerator, JSONSchema: () => exports_json_schema, Doc: () => Doc, $output: () => $output, $input: () => $input, $constructor: () => $constructor, $brand: () => $brand, $ZodXID: () => $ZodXID, $ZodVoid: () => $ZodVoid, $ZodUnknown: () => $ZodUnknown, $ZodUnion: () => $ZodUnion, $ZodUndefined: () => $ZodUndefined, $ZodUUID: () => $ZodUUID, $ZodURL: () => $ZodURL, $ZodULID: () => $ZodULID, $ZodType: () => $ZodType, $ZodTuple: () => $ZodTuple, $ZodTransform: () => $ZodTransform, $ZodTemplateLiteral: () => $ZodTemplateLiteral, $ZodSymbol: () => $ZodSymbol, $ZodSuccess: () => $ZodSuccess, $ZodStringFormat: () => $ZodStringFormat, $ZodString: () => $ZodString, $ZodSet: () => $ZodSet, $ZodRegistry: () => $ZodRegistry, $ZodRecord: () => $ZodRecord, $ZodRealError: () => $ZodRealError, $ZodReadonly: () => $ZodReadonly, $ZodPromise: () => $ZodPromise, $ZodPrefault: () => $ZodPrefault, $ZodPipe: () => $ZodPipe, $ZodOptional: () => $ZodOptional, $ZodObjectJIT: () => $ZodObjectJIT, $ZodObject: () => $ZodObject, $ZodNumberFormat: () => $ZodNumberFormat, $ZodNumber: () => $ZodNumber, $ZodNullable: () => $ZodNullable, $ZodNull: () => $ZodNull, $ZodNonOptional: () => $ZodNonOptional, $ZodNever: () => $ZodNever, $ZodNanoID: () => $ZodNanoID, $ZodNaN: () => $ZodNaN, $ZodMap: () => $ZodMap, $ZodLiteral: () => $ZodLiteral, $ZodLazy: () => $ZodLazy, $ZodKSUID: () => $ZodKSUID, $ZodJWT: () => $ZodJWT, $ZodIntersection: () => $ZodIntersection, $ZodISOTime: () => $ZodISOTime, $ZodISODuration: () => $ZodISODuration, $ZodISODateTime: () => $ZodISODateTime, $ZodISODate: () => $ZodISODate, $ZodIPv6: () => $ZodIPv6, $ZodIPv4: () => $ZodIPv4, $ZodGUID: () => $ZodGUID, $ZodFunction: () => $ZodFunction, $ZodFile: () => $ZodFile, $ZodError: () => $ZodError, $ZodEnum: () => $ZodEnum, $ZodEncodeError: () => $ZodEncodeError, $ZodEmoji: () => $ZodEmoji, $ZodEmail: () => $ZodEmail, $ZodE164: () => $ZodE164, $ZodDiscriminatedUnion: () => $ZodDiscriminatedUnion, $ZodDefault: () => $ZodDefault, $ZodDate: () => $ZodDate, $ZodCustomStringFormat: () => $ZodCustomStringFormat, $ZodCustom: () => $ZodCustom, $ZodCodec: () => $ZodCodec, $ZodCheckUpperCase: () => $ZodCheckUpperCase, $ZodCheckStringFormat: () => $ZodCheckStringFormat, $ZodCheckStartsWith: () => $ZodCheckStartsWith, $ZodCheckSizeEquals: () => $ZodCheckSizeEquals, $ZodCheckRegex: () => $ZodCheckRegex, $ZodCheckProperty: () => $ZodCheckProperty, $ZodCheckOverwrite: () => $ZodCheckOverwrite, $ZodCheckNumberFormat: () => $ZodCheckNumberFormat, $ZodCheckMultipleOf: () => $ZodCheckMultipleOf, $ZodCheckMinSize: () => $ZodCheckMinSize, $ZodCheckMinLength: () => $ZodCheckMinLength, $ZodCheckMimeType: () => $ZodCheckMimeType, $ZodCheckMaxSize: () => $ZodCheckMaxSize, $ZodCheckMaxLength: () => $ZodCheckMaxLength, $ZodCheckLowerCase: () => $ZodCheckLowerCase, $ZodCheckLessThan: () => $ZodCheckLessThan, $ZodCheckLengthEquals: () => $ZodCheckLengthEquals, $ZodCheckIncludes: () => $ZodCheckIncludes, $ZodCheckGreaterThan: () => $ZodCheckGreaterThan, $ZodCheckEndsWith: () => $ZodCheckEndsWith, $ZodCheckBigIntFormat: () => $ZodCheckBigIntFormat, $ZodCheck: () => $ZodCheck, $ZodCatch: () => $ZodCatch, $ZodCUID2: () => $ZodCUID2, $ZodCUID: () => $ZodCUID, $ZodCIDRv6: () => $ZodCIDRv6, $ZodCIDRv4: () => $ZodCIDRv4, $ZodBoolean: () => $ZodBoolean, $ZodBigIntFormat: () => $ZodBigIntFormat, $ZodBigInt: () => $ZodBigInt, $ZodBase64URL: () => $ZodBase64URL, $ZodBase64: () => $ZodBase64, $ZodAsyncError: () => $ZodAsyncError, $ZodArray: () => $ZodArray, $ZodAny: () => $ZodAny }); // node_modules/zod/v4/core/core.js var NEVER = Object.freeze({ status: "aborted" }); function $constructor(name, initializer, params) { function init(inst, def) { var _a; Object.defineProperty(inst, "_zod", { value: inst._zod ?? {}, enumerable: false }); (_a = inst._zod).traits ?? (_a.traits = new Set); inst._zod.traits.add(name); initializer(inst, def); for (const k in _.prototype) { if (!(k in inst)) Object.defineProperty(inst, k, { value: _.prototype[k].bind(inst) }); } inst._zod.constr = _; inst._zod.def = def; } const Parent = params?.Parent ?? Object; class Definition extends Parent { } Object.defineProperty(Definition, "name", { value: name }); function _(def) { var _a; const inst = params?.Parent ? new Definition : this; init(inst, def); (_a = inst._zod).deferred ?? (_a.deferred = []); for (const fn of inst._zod.deferred) { fn(); } return inst; } Object.defineProperty(_, "init", { value: init }); Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => { if (params?.Parent && inst instanceof params.Parent) return true; return inst?._zod?.traits?.has(name); } }); Object.defineProperty(_, "name", { value: name }); return _; } var $brand = Symbol("zod_brand"); class $ZodAsyncError extends Error { constructor() { super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`); } } class $ZodEncodeError extends Error { constructor(name) { super(`Encountered unidirectional transform during encode: ${name}`); this.name = "ZodEncodeError"; } } var globalConfig = {}; function config(newConfig) { if (newConfig) Object.assign(globalConfig, newConfig); return globalConfig; } // node_modules/zod/v4/core/util.js var exports_util = {}; __export(exports_util, { unwrapMessage: () => unwrapMessage, uint8ArrayToHex: () => uint8ArrayToHex, uint8ArrayToBase64url: () => uint8ArrayToBase64url, uint8ArrayToBase64: () => uint8ArrayToBase64, stringifyPrimitive: () => stringifyPrimitive, shallowClone: () => shallowClone, safeExtend: () => safeExtend, required: () => required, randomString: () => randomString, propertyKeyTypes: () => propertyKeyTypes, promiseAllObject: () => promiseAllObject, primitiveTypes: () => primitiveTypes, prefixIssues: () => prefixIssues, pick: () => pick, partial: () => partial, optionalKeys: () => optionalKeys, omit: () => omit, objectClone: () => objectClone, numKeys: () => numKeys, nullish: () => nullish, normalizeParams: () => normalizeParams, mergeDefs: () => mergeDefs, merge: () => merge, jsonStringifyReplacer: () => jsonStringifyReplacer, joinValues: () => joinValues, issue: () => issue, isPlainObject: () => isPlainObject, isObject: () => isObject, hexToUint8Array: () => hexToUint8Array, getSizableOrigin: () => getSizableOrigin, getParsedType: () => getParsedType, getLengthableOrigin: () => getLengthableOrigin, getEnumValues: () => getEnumValues, getElementAtPath: () => getElementAtPath, floatSafeRemainder: () => floatSafeRemainder, finalizeIssue: () => finalizeIssue, extend: () => extend, escapeRegex: () => escapeRegex, esc: () => esc, defineLazy: () => defineLazy, createTransparentProxy: () => createTransparentProxy, cloneDef: () => cloneDef, clone: () => clone, cleanRegex: () => cleanRegex, cleanEnum: () => cleanEnum, captureStackTrace: () => captureStackTrace, cached: () => cached, base64urlToUint8Array: () => base64urlToUint8Array, base64ToUint8Array: () => base64ToUint8Array, assignProp: () => assignProp, assertNotEqual: () => assertNotEqual, assertNever: () => assertNever, assertIs: () => assertIs, assertEqual: () => assertEqual, assert: () => assert, allowsEval: () => allowsEval, aborted: () => aborted, NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES, Class: () => Class, BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES }); function assertEqual(val) { return val; } function assertNotEqual(val) { return val; } function assertIs(_arg) {} function assertNever(_x) { throw new Error; } function assert(_) {} function getEnumValues(entries) { const numericValues = Object.values(entries).filter((v) => typeof v === "number"); const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v); return values; } function joinValues(array, separator = "|") { return array.map((val) => stringifyPrimitive(val)).join(separator); } function jsonStringifyReplacer(_, value) { if (typeof value === "bigint") return value.toString(); return value; } function cached(getter) { const set = false; return { get value() { if (!set) { const value = getter(); Object.defineProperty(this, "value", { value }); return value; } throw new Error("cached value already set"); } }; } function nullish(input) { return input === null || input === undefined; } function cleanRegex(source) { const start = source.startsWith("^") ? 1 : 0; const end = source.endsWith("$") ? source.length - 1 : source.length; return source.slice(start, end); } function floatSafeRemainder(val, step) { const valDecCount = (val.toString().split(".")[1] || "").length; const stepString = step.toString(); let stepDecCount = (stepString.split(".")[1] || "").length; if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) { const match = stepString.match(/\d?e-(\d?)/); if (match?.[1]) { stepDecCount = Number.parseInt(match[1]); } } const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount; const valInt = Number.parseInt(val.toFixed(decCount).replace(".", "")); const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", "")); return valInt % stepInt / 10 ** decCount; } var EVALUATING = Symbol("evaluating"); function defineLazy(object, key, getter) { let value = undefined; Object.defineProperty(object, key, { get() { if (value === EVALUATING) { return; } if (value === undefined) { value = EVALUATING; value = getter(); } return value; }, set(v) { Object.defineProperty(object, key, { value: v }); }, configurable: true }); } function objectClone(obj) { return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj)); } function assignProp(target, prop, value) { Object.defineProperty(target, prop, { value, writable: true, enumerable: true, configurable: true }); } function mergeDefs(...defs) { const mergedDescriptors = {}; for (const def of defs) { const descriptors = Object.getOwnPropertyDescriptors(def); Object.assign(mergedDescriptors, descriptors); } return Object.defineProperties({}, mergedDescriptors); } function cloneDef(schema) { return mergeDefs(schema._zod.def); } function getElementAtPath(obj, path) { if (!path) return obj; return path.reduce((acc, key) => acc?.[key], obj); } function promiseAllObject(promisesObj) { const keys = Object.keys(promisesObj); const promises = keys.map((key) => promisesObj[key]); return Promise.all(promises).then((results) => { const resolvedObj = {}; for (let i = 0;i < keys.length; i++) { resolvedObj[keys[i]] = results[i]; } return resolvedObj; }); } function randomString(length = 10) { const chars = "abcdefghijklmnopqrstuvwxyz"; let str = ""; for (let i = 0;i < length; i++) { str += chars[Math.floor(Math.random() * chars.length)]; } return str; } function esc(str) { return JSON.stringify(str); } var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {}; function isObject(data) { return typeof data === "object" && data !== null && !Array.isArray(data); } var allowsEval = cached(() => { if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) { return false; } try { const F = Function; new F(""); return true; } catch (_) { return false; } }); function isPlainObject(o) { if (isObject(o) === false) return false; const ctor = o.constructor; if (ctor === undefined) return true; const prot = ctor.prototype; if (isObject(prot) === false) return false; if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) { return false; } return true; } function shallowClone(o) { if (isPlainObject(o)) return { ...o }; if (Array.isArray(o)) return [...o]; return o; } function numKeys(data) { let keyCount = 0; for (const key in data) { if (Object.prototype.hasOwnProperty.call(data, key)) { keyCount++; } } return keyCount; } var getParsedType = (data) => { const t = typeof data; switch (t) { case "undefined": return "undefined"; case "string": return "string"; case "number": return Number.isNaN(data) ? "nan" : "number"; case "boolean": return "boolean"; case "function": return "function"; case "bigint": return "bigint"; case "symbol": return "symbol"; case "object": if (Array.isArray(data)) { return "array"; } if (data === null) { return "null"; } if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") { return "promise"; } if (typeof Map !== "undefined" && data instanceof Map) { return "map"; } if (typeof Set !== "undefined" && data instanceof Set) { return "set"; } if (typeof Date !== "undefined" && data instanceof Date) { return "date"; } if (typeof File !== "undefined" && data instanceof File) { return "file"; } return "object"; default: throw new Error(`Unknown data type: ${t}`); } }; var propertyKeyTypes = new Set(["string", "number", "symbol"]); var primitiveTypes = new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]); function escapeRegex(str) { return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); } function clone(inst, def, params) { const cl = new inst._zod.constr(def ?? inst._zod.def); if (!def || params?.parent) cl._zod.parent = inst; return cl; } function normalizeParams(_params) { const params = _params; if (!params) return {}; if (typeof params === "string") return { error: () => params }; if (params?.message !== undefined) { if (params?.error !== undefined) throw new Error("Cannot specify both `message` and `error` params"); params.error = params.message; } delete params.message; if (typeof params.error === "string") return { ...params, error: () => params.error }; return params; } function createTransparentProxy(getter) { let target; return new Proxy({}, { get(_, prop, receiver) { target ?? (target = getter()); return Reflect.get(target, prop, receiver); }, set(_, prop, value, receiver) { target ?? (target = getter()); return Reflect.set(target, prop, value, receiver); }, has(_, prop) { target ?? (target = getter()); return Reflect.has(target, prop); }, deleteProperty(_, prop) { target ?? (target = getter()); return Reflect.deleteProperty(target, prop); }, ownKeys(_) { target ?? (target = getter()); return Reflect.ownKeys(target); }, getOwnPropertyDescriptor(_, prop) { target ?? (target = getter()); return Reflect.getOwnPropertyDescriptor(target, prop); }, defineProperty(_, prop, descriptor) { target ?? (target = getter()); return Reflect.defineProperty(target, prop, descriptor); } }); } function stringifyPrimitive(value) { if (typeof value === "bigint") return value.toString() + "n"; if (typeof value === "string") return `"${value}"`; return `${value}`; } function optionalKeys(shape) { return Object.keys(shape).filter((k) => { return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional"; }); } var NUMBER_FORMAT_RANGES = { safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER], int32: [-2147483648, 2147483647], uint32: [0, 4294967295], float32: [-340282346638528860000000000000000000000, 340282346638528860000000000000000000000], float64: [-Number.MAX_VALUE, Number.MAX_VALUE] }; var BIGINT_FORMAT_RANGES = { int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")], uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")] }; function pick(schema, mask) { const currDef = schema._zod.def; const def = mergeDefs(schema._zod.def, { get shape() { const newShape = {}; for (const key in mask) { if (!(key in currDef.shape)) { throw new Error(`Unrecognized key: "${key}"`); } if (!mask[key]) continue; newShape[key] = currDef.shape[key]; } assignProp(this, "shape", newShape); return newShape; }, checks: [] }); return clone(schema, def); } function omit(schema, mask) { const currDef = schema._zod.def; const def = mergeDefs(schema._zod.def, { get shape() { const newShape = { ...schema._zod.def.shape }; for (const key in mask) { if (!(key in currDef.shape)) { throw new Error(`Unrecognized key: "${key}"`); } if (!mask[key]) continue; delete newShape[key]; } assignProp(this, "shape", newShape); return newShape; }, checks: [] }); return clone(schema, def); } function extend(schema, shape) { if (!isPlainObject(shape)) { throw new Error("Invalid input to extend: expected a plain object"); } const checks = schema._zod.def.checks; const hasChecks = checks && checks.length > 0; if (hasChecks) { throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead."); } const def = mergeDefs(schema._zod.def, { get shape() { const _shape = { ...schema._zod.def.shape, ...shape }; assignProp(this, "shape", _shape); return _shape; }, checks: [] }); return clone(schema, def); } function safeExtend(schema, shape) { if (!isPlainObject(shape)) { throw new Error("Invalid input to safeExtend: expected a plain object"); } const def = { ...schema._zod.def, get shape() { const _shape = { ...schema._zod.def.shape, ...shape }; assignProp(this, "shape", _shape); return _shape; }, checks: schema._zod.def.checks }; return clone(schema, def); } function merge(a, b) { const def = mergeDefs(a._zod.def, { get shape() { const _shape = { ...a._zod.def.shape, ...b._zod.def.shape }; assignProp(this, "shape", _shape); return _shape; }, get catchall() { return b._zod.def.catchall; }, checks: [] }); return clone(a, def); } function partial(Class, schema, mask) { const def = mergeDefs(schema._zod.def, { get shape() { const oldShape = schema._zod.def.shape; const shape = { ...oldShape }; if (mask) { for (const key in mask) { if (!(key in oldShape)) { throw new Error(`Unrecognized key: "${key}"`); } if (!mask[key]) continue; shape[key] = Class ? new Class({ type: "optional", innerType: oldShape[key] }) : oldShape[key]; } } else { for (const key in oldShape) { shape[key] = Class ? new Class({ type: "optional", innerType: oldShape[key] }) : oldShape[key]; } } assignProp(this, "shape", shape); return shape; }, checks: [] }); return clone(schema, def); } function required(Class, schema, mask) { const def = mergeDefs(schema._zod.def, { get shape() { const oldShape = schema._zod.def.shape; const shape = { ...oldShape }; if (mask) { for (const key in mask) { if (!(key in shape)) { throw new Error(`Unrecognized key: "${key}"`); } if (!mask[key]) continue; shape[key] = new Class({ type: "nonoptional", innerType: oldShape[key] }); } } else { for (const key in oldShape) { shape[key] = new Class({ type: "nonoptional", innerType: oldShape[key] }); } } assignProp(this, "shape", shape); return shape; }, checks: [] }); return clone(schema, def); } function aborted(x, startIndex = 0) { if (x.aborted === true) return true; for (let i = startIndex;i < x.issues.length; i++) { if (x.issues[i]?.continue !== true) { return true; } } return false; } function prefixIssues(path, issues) { return issues.map((iss) => { var _a; (_a = iss).path ?? (_a.path = []); iss.path.unshift(path); return iss; }); } function unwrapMessage(message) { return typeof message === "string" ? message : message?.message; } function finalizeIssue(iss, ctx, config2) { const full = { ...iss, path: iss.path ?? [] }; if (!iss.message) { const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input"; full.message = message; } delete full.inst; delete full.continue; if (!ctx?.reportInput) { delete full.input; } return full; } function getSizableOrigin(input) { if (input instanceof Set) return "set"; if (input instanceof Map) return "map"; if (input instanceof File) return "file"; return "unknown"; } function getLengthableOrigin(input) { if (Array.isArray(input)) return "array"; if (typeof input === "string") return "string"; return "unknown"; } function issue(...args) { const [iss, input, inst] = args; if (typeof iss === "string") { return { message: iss, code: "custom", input, inst }; } return { ...iss }; } function cleanEnum(obj) { return Object.entries(obj).filter(([k, _]) => { return Number.isNaN(Number.parseInt(k, 10)); }).map((el) => el[1]); } function base64ToUint8Array(base64) { const binaryString = atob(base64); const bytes = new Uint8Array(binaryString.length); for (let i = 0;i < binaryString.length; i++) { bytes[i] = binaryString.charCodeAt(i); } return bytes; } function uint8ArrayToBase64(bytes) { let binaryString = ""; for (let i = 0;i < bytes.length; i++) { binaryString += String.fromCharCode(bytes[i]); } return btoa(binaryString); } function base64urlToUint8Array(base64url) { const base64 = base64url.replace(/-/g, "+").replace(/_/g, "/"); const padding = "=".repeat((4 - base64.length % 4) % 4); return base64ToUint8Array(base64 + padding); } function uint8ArrayToBase64url(bytes) { return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, ""); } function hexToUint8Array(hex) { const cleanHex = hex.replace(/^0x/, ""); if (cleanHex.length % 2 !== 0) { throw new Error("Invalid hex string length"); } const bytes = new Uint8Array(cleanHex.length / 2); for (let i = 0;i < cleanHex.length; i += 2) { bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16); } return bytes; } function uint8ArrayToHex(bytes) { return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join(""); } class Class { constructor(..._args) {} } // node_modules/zod/v4/core/errors.js var initializer = (inst, def) => { inst.name = "$ZodError"; Object.defineProperty(inst, "_zod", { value: inst._zod, enumerable: false }); Object.defineProperty(inst, "issues", { value: def, enumerable: false }); inst.message = JSON.stringify(def, jsonStringifyReplacer, 2); Object.defineProperty(inst, "toString", { value: () => inst.message, enumerable: false }); }; var $ZodError = $constructor("$ZodError", initializer); var $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error }); function flattenError(error, mapper = (issue2) => issue2.message) { const fieldErrors = {}; const formErrors = []; for (const sub of error.issues) { if (sub.path.length > 0) { fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || []; fieldErrors[sub.path[0]].push(mapper(sub)); } else { formErrors.push(mapper(sub)); } } return { formErrors, fieldErrors }; } function formatError(error, _mapper) { const mapper = _mapper || function(issue2) { return issue2.message; }; const fieldErrors = { _errors: [] }; const processError = (error2) => { for (const issue2 of error2.issues) { if (issue2.code === "invalid_union" && issue2.errors.length) { issue2.errors.map((issues) => processError({ issues })); } else if (issue2.code === "invalid_key") { processError({ issues: issue2.issues }); } else if (issue2.code === "invalid_element") { processError({ issues: issue2.issues }); } else if (issue2.path.length === 0) { fieldErrors._errors.push(mapper(issue2)); } else { let curr = fieldErrors; let i = 0; while (i < issue2.path.length) { const el = issue2.path[i]; const terminal = i === issue2.path.length - 1; if (!terminal) { curr[el] = curr[el] || { _errors: [] }; } else { curr[el] = curr[el] || { _errors: [] }; curr[el]._errors.push(mapper(issue2)); } curr = curr[el]; i++; } } } }; processError(error); return fieldErrors; } function treeifyError(error, _mapper) { const mapper = _mapper || function(issue2) { return issue2.message; }; const result = { errors: [] }; const processError = (error2, path = []) => { var _a, _b; for (const issue2 of error2.issues) { if (issue2.code === "invalid_union" && issue2.errors.length) { issue2.errors.map((issues) => processError({ issues }, issue2.path)); } else if (issue2.code === "invalid_key") { processError({ issues: issue2.issues }, issue2.path); } else if (issue2.code === "invalid_element") { processError({ issues: issue2.issues }, issue2.path); } else { const fullpath = [...path, ...issue2.path]; if (fullpath.length === 0) { result.errors.push(mapper(issue2)); continue; } let curr = result; let i = 0; while (i < fullpath.length) { const el = fullpath[i]; const terminal = i === fullpath.length - 1; if (typeof el === "string") { curr.properties ?? (curr.properties = {}); (_a = curr.properties)[el] ?? (_a[el] = { errors: [] }); curr = curr.properties[el]; } else { curr.items ?? (curr.items = []); (_b = curr.items)[el] ?? (_b[el] = { errors: [] }); curr = curr.items[el]; } if (terminal) { curr.errors.push(mapper(issue2)); } i++; } } } }; processError(error); return result; } function toDotPath(_path) { const segs = []; const path = _path.map((seg) => typeof seg === "object" ? seg.key : seg); for (const seg of path) { if (typeof seg === "number") segs.push(`[${seg}]`); else if (typeof seg === "symbol") segs.push(`[${JSON.stringify(String(seg))}]`); else if (/[^\w$]/.test(seg)) segs.push(`[${JSON.stringify(seg)}]`); else { if (segs.length) segs.push("."); segs.push(seg); } } return segs.join(""); } function prettifyError(error) { const lines = []; const issues = [...error.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length); for (const issue2 of issues) { lines.push(`✖ ${issue2.message}`); if (issue2.path?.length) lines.push(` → at ${toDotPath(issue2.path)}`); } return lines.join(` `); } // node_modules/zod/v4/core/parse.js var _parse = (_Err) => (schema, value, _ctx, _params) => { const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false }; const result = schema._zod.run({ value, issues: [] }, ctx); if (result instanceof Promise) { throw new $ZodAsyncError; } if (result.issues.length) { const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))); captureStackTrace(e, _params?.callee); throw e; } return result.value; }; var parse = /* @__PURE__ */ _parse($ZodRealError); var _parseAsync = (_Err) => async (schema, value, _ctx, params) => { const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true }; let result = schema._zod.run({ value, issues: [] }, ctx); if (result instanceof Promise) result = await result; if (result.issues.length) { const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))); captureStackTrace(e, params?.callee); throw e; } return result.value; }; var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError); var _safeParse = (_Err) => (schema, value, _ctx) => { const ctx = _ctx ? { ..._ctx, async: false } : { async: false }; const result = schema._zod.run({ value, issues: [] }, ctx); if (result instanceof Promise) { throw new $ZodAsyncError; } return result.issues.length ? { success: false, error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))) } : { success: true, data: result.value }; }; var safeParse = /* @__PURE__ */ _safeParse($ZodRealError); var _safeParseAsync = (_Err) => async (schema, value, _ctx) => { const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true }; let result = schema._zod.run({ value, issues: [] }, ctx); if (result instanceof Promise) result = await result; return result.issues.length ? { success: false, error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))) } : { success: true, data: result.value }; }; var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError); var _encode = (_Err) => (schema, value, _ctx) => { const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" }; return _parse(_Err)(schema, value, ctx); }; var encode = /* @__PURE__ */ _encode($ZodRealError); var _decode = (_Err) => (schema, value, _ctx) => { return _parse(_Err)(schema, value, _ctx); }; var decode = /* @__PURE__ */ _decode($ZodRealError); var _encodeAsync = (_Err) => async (schema, value, _ctx) => { const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" }; return _parseAsync(_Err)(schema, value, ctx); }; var encodeAsync = /* @__PURE__ */ _encodeAsync($ZodRealError); var _decodeAsync = (_Err) => async (schema, value, _ctx) => { return _parseAsync(_Err)(schema, value, _ctx); }; var decodeAsync = /* @__PURE__ */ _decodeAsync($ZodRealError); var _safeEncode = (_Err) => (schema, value, _ctx) => { const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" }; return _safeParse(_Err)(schema, value, ctx); }; var safeEncode = /* @__PURE__ */ _safeEncode($ZodRealError); var _safeDecode = (_Err) => (schema, value, _ctx) => { return _safeParse(_Err)(schema, value, _ctx); }; var safeDecode = /* @__PURE__ */ _safeDecode($ZodRealError); var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => { const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" }; return _safeParseAsync(_Err)(schema, value, ctx); }; var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync($ZodRealError); var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => { return _safeParseAsync(_Err)(schema, value, _ctx); }; var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError); // node_modules/zod/v4/core/regexes.js var exports_regexes = {}; __export(exports_regexes, { xid: () => xid, uuid7: () => uuid7, uuid6: () => uuid6, uuid4: () => uuid4, uuid: () => uuid, uppercase: () => uppercase, unicodeEmail: () => unicodeEmail, undefined: () => _undefined, ulid: () => ulid, time: () => time, string: () => string, sha512_hex: () => sha512_hex, sha512_base64url: () => sha512_base64url, sha512_base64: () => sha512_base64, sha384_hex: () => sha384_hex, sha384_base64url: () => sha384_base64url, sha384_base64: () => sha384_base64, sha256_hex: () => sha256_hex, sha256_base64url: () => sha256_base64url, sha256_base64: () => sha256_base64, sha1_hex: () => sha1_hex, sha1_base64url: () => sha1_base64url, sha1_base64: () => sha1_base64, rfc5322Email: () => rfc5322Email, number: () => number, null: () => _null, nanoid: () => nanoid, md5_hex: () => md5_hex, md5_base64url: () => md5_base64url, md5_base64: () => md5_base64, lowercase: () => lowercase, ksuid: () => ksuid, ipv6: () => ipv6, ipv4: () => ipv4, integer: () => integer, idnEmail: () => idnEmail, html5Email: () => html5Email, hostname: () => hostname, hex: () => hex, guid: () => guid, extendedDuration: () => extendedDuration, emoji: () => emoji, email: () => email, e164: () => e164, duration: () => duration, domain: () => domain, datetime: () => datetime, date: () => date, cuid2: () => cuid2, cuid: () => cuid, cidrv6: () => cidrv6, cidrv4: () => cidrv4, browserEmail: () => browserEmail, boolean: () => boolean, bigint: () => bigint, base64url: () => base64url, base64: () => base64 }); var cuid = /^[cC][^\s-]{8,}$/; var cuid2 = /^[0-9a-z]+$/; var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/; var xid = /^[0-9a-vA-V]{20}$/; var ksuid = /^[A-Za-z0-9]{27}$/; var nanoid = /^[a-zA-Z0-9_-]{21}$/; var duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/; var extendedDuration = /^[-+]?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)?)??$/; var guid = /^([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})$/; var uuid = (version) => { if (!version) return /^([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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/; return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`); }; var uuid4 = /* @__PURE__ */ uuid(4); var uuid6 = /* @__PURE__ */ uuid(6); var uuid7 = /* @__PURE__ */ uuid(7); var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/; var html5Email = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; var rfc5322Email = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; var unicodeEmail = /^[^\s@"]{1,64}@[^\s@]{1,255}$/u; var idnEmail = unicodeEmail; var browserEmail = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; var _emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`; function emoji() { return new RegExp(_emoji, "u"); } var ipv4 = /^(?:(?: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])$/; var ipv6 = /^(([0-9a-fA-F]{1,4}:){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}|:))$/; var cidrv4 = /^((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])$/; var cidrv6 = /^(([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])$/; var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/; var base64url = /^[A-Za-z0-9_-]*$/; var hostname = /^(?=.{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])?)*\.?$/; var domain = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/; var e164 = /^\+(?:[0-9]){6,14}[0-9]$/; var dateSource = `(?:(?:\\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])))`; var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`); function timeSource(args) { const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`; const regex = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`; return regex; } function time(args) { return new RegExp(`^${timeSource(args)}$`); } function datetime(args) { const time2 = timeSource({ precision: args.precision }); const opts = ["Z"]; if (args.local) opts.push(""); if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`); const timeRegex = `${time2}(?:${opts.join("|")})`; return new RegExp(`^${dateSource}T(?:${timeRegex})$`); } var string = (params) => { const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`; return new RegExp(`^${regex}$`); }; var bigint = /^-?\d+n?$/; var integer = /^-?\d+$/; var number = /^-?\d+(?:\.\d+)?/; var boolean = /^(?:true|false)$/i; var _null = /^null$/i; var _undefined = /^undefined$/i; var lowercase = /^[^A-Z]*$/; var uppercase = /^[^a-z]*$/; var hex = /^[0-9a-fA-F]*$/; function fixedBase64(bodyLength, padding) { return new RegExp(`^[A-Za-z0-9+/]{${bodyLength}}${padding}$`); } function fixedBase64url(length) { return new RegExp(`^[A-Za-z0-9_-]{${length}}$`); } var md5_