ccusage bundle diff mcp.json
735 linhas
import { __commonJSMin, __toESM, require_usingCtx } from "./pricing-fetcher-DY7VmWUQ.js";
import { __commonJSMin, __toESM, require_usingCtx } from "./pricing-fetcher-xnsbMNgh.js";
import { getTotalTokens } from "./_token-utils-WjkbrjKv.js";
import { getTotalTokens } from "./_token-utils-WjkbrjKv.js";
import { arrayType, booleanType, enumType, filterDateSchema, numberType, objectType, stringType, unknownType } from "./_types-JGkS5R6S.js";
import { arrayType, booleanType, enumType, filterDateSchema, numberType, objectType, stringType, unknownType } from "./_types-BHjwjsF8.js";
import { calculateTotals, createTotalsObject } from "./calculate-cost-BDqO4yWA.js";
import { calculateTotals, createTotalsObject } from "./calculate-cost-BDqO4yWA.js";
import { getClaudePaths, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData } from "./data-loader-C046j6DW.js";
import { getClaudePaths, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData } from "./data-loader-BMQbUxlj.js";
import { name, version } from "./logger-DXFyCJD4.js";
import { name, version } from "./logger-CZz4EFfC.js";
import process from "node:process";
import process from "node:process";
var util$5;
var util$5;
(function(util$6) {
(function(util$6) {
util$6.assertEqual = (_) => {};
util$6.assertEqual = (_) => {};
function assertIs(_arg) {}
function assertIs(_arg) {}
util$6.assertIs = assertIs;
util$6.assertIs = assertIs;
function assertNever(_x) {
function assertNever(_x) {
throw new Error();
throw new Error();
}
}
util$6.assertNever = assertNever;
util$6.assertNever = assertNever, util$6.arrayToEnum = (items) => {
util$6.arrayToEnum = (items) => {
const obj = {};
const obj = {};
for (const item of items) obj[item] = item;
for (const item of items) obj[item] = item;
return obj;
return obj;
};
}, util$6.getValidEnumValues = (obj) => {
util$6.getValidEnumValues = (obj) => {
const validKeys = util$6.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number"), filtered = {};
const validKeys = util$6.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
const filtered = {};
for (const k of validKeys) filtered[k] = obj[k];
for (const k of validKeys) filtered[k] = obj[k];
return util$6.objectValues(filtered);
return util$6.objectValues(filtered);
};
}, util$6.objectValues = (obj) => {
util$6.objectValues = (obj) => {
return util$6.objectKeys(obj).map(function(e) {
return util$6.objectKeys(obj).map(function(e) {
return obj[e];
return obj[e];
});
});
};
}, util$6.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
util$6.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
const keys = [];
const keys = [];
for (const key in object) if (Object.prototype.hasOwnProperty.call(object, key)) keys.push(key);
for (const key in object) if (Object.prototype.hasOwnProperty.call(object, key)) keys.push(key);
return keys;
return keys;
};
}, util$6.find = (arr, checker) => {
util$6.find = (arr, checker) => {
for (const item of arr) if (checker(item)) return item;
for (const item of arr) if (checker(item)) return item;
return void 0;
return void 0;
};
}, util$6.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
util$6.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
function joinValues(array, separator = " | ") {
function joinValues(array, separator = " | ") {
return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
}
}
util$6.joinValues = joinValues;
util$6.joinValues = joinValues, util$6.jsonStringifyReplacer = (_, value) => {
util$6.jsonStringifyReplacer = (_, value) => {
return typeof value === "bigint" ? value.toString() : value;
if (typeof value === "bigint") return value.toString();
return value;
};
};
})(util$5 || (util$5 = {}));
})(util$5 || (util$5 = {}));
var objectUtil;
var objectUtil;
(function(objectUtil$1) {
(function(objectUtil$1) {
objectUtil$1.mergeShapes = (first, second) => {
objectUtil$1.mergeShapes = (first, second) => {
return {
return {
...first,
...first,
...second
...second
};
};
};
};
})(objectUtil || (objectUtil = {}));
})(objectUtil || (objectUtil = {}));
const ZodParsedType = util$5.arrayToEnum([
const ZodParsedType = util$5.arrayToEnum([
"string",
"string",
"nan",
"nan",
"number",
"number",
"integer",
"integer",
"float",
"float",
"boolean",
"boolean",
"date",
"date",
"bigint",
"bigint",
"symbol",
"symbol",
"function",
"function",
"undefined",
"undefined",
"null",
"null",
"array",
"array",
"object",
"object",
"unknown",
"unknown",
"promise",
"promise",
"void",
"void",
"never",
"never",
"map",
"map",
"set"
"set"
]);
]), getParsedType = (data) => {
const getParsedType = (data) => {
const t = typeof data;
const t = typeof data;
switch (t) {
switch (t) {
case "undefined": return ZodParsedType.undefined;
case "undefined": return ZodParsedType.undefined;
case "string": return ZodParsedType.string;
case "string": return ZodParsedType.string;
case "number": return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
case "number": return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
case "boolean": return ZodParsedType.boolean;
case "boolean": return ZodParsedType.boolean;
case "function": return ZodParsedType.function;
case "function": return ZodParsedType.function;
case "bigint": return ZodParsedType.bigint;
case "bigint": return ZodParsedType.bigint;
case "symbol": return ZodParsedType.symbol;
case "symbol": return ZodParsedType.symbol;
case "object":
case "object": return Array.isArray(data) ? ZodParsedType.array : data === null ? ZodParsedType.null : data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function" ? ZodParsedType.promise : typeof Map !== "undefined" && data instanceof Map ? ZodParsedType.map : typeof Set !== "undefined" && data instanceof Set ? ZodParsedType.set : typeof Date !== "undefined" && data instanceof Date ? ZodParsedType.date : ZodParsedType.object;
if (Array.isArray(data)) return ZodParsedType.array;
if (data === null) return ZodParsedType.null;
if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") return ZodParsedType.promise;
if (typeof Map !== "undefined" && data instanceof Map) return ZodParsedType.map;
if (typeof Set !== "undefined" && data instanceof Set) return ZodParsedType.set;
if (typeof Date !== "undefined" && data instanceof Date) return ZodParsedType.date;
return ZodParsedType.object;
default: return ZodParsedType.unknown;
default: return ZodParsedType.unknown;
}
}
};
}, ZodIssueCode = util$5.arrayToEnum([
const ZodIssueCode = util$5.arrayToEnum([
"invalid_type",
"invalid_type",
"invalid_literal",
"invalid_literal",
"custom",
"custom",
"invalid_union",
"invalid_union",
"invalid_union_discriminator",
"invalid_union_discriminator",
"invalid_enum_value",
"invalid_enum_value",
"unrecognized_keys",
"unrecognized_keys",
"invalid_arguments",
"invalid_arguments",
"invalid_return_type",
"invalid_return_type",
"invalid_date",
"invalid_date",
"invalid_string",
"invalid_string",
"too_small",
"too_small",
"too_big",
"too_big",
"invalid_intersection_types",
"invalid_intersection_types",
"not_multiple_of",
"not_multiple_of",
"not_finite"
"not_finite"
]);
]);
var ZodError = class ZodError extends Error {
var ZodError = class ZodError extends Error {
get errors() {
get errors() {
return this.issues;
return this.issues;
}
}
constructor(issues) {
constructor(issues) {
super();
super(), this.issues = [], this.addIssue = (sub) => {
this.issues = [];
this.addIssue = (sub) => {
this.issues = [...this.issues, sub];
this.issues = [...this.issues, sub];
};
}, this.addIssues = (subs = []) => {
this.addIssues = (subs = []) => {
this.issues = [...this.issues, ...subs];
this.issues = [...this.issues, ...subs];
};
};
const actualProto = new.target.prototype;
const actualProto = new.target.prototype;
if (Object.setPrototypeOf) Object.setPrototypeOf(this, actualProto);
if (Object.setPrototypeOf) Object.setPrototypeOf(this, actualProto);
else this.__proto__ = actualProto;
else this.__proto__ = actualProto;
this.name = "ZodError";
this.name = "ZodError", this.issues = issues;
this.issues = issues;
}
}
format(_mapper) {
format(_mapper) {
const mapper = _mapper || function(issue) {
const mapper = _mapper || function(issue) {
return issue.message;
return issue.message;
};
}, fieldErrors = { _errors: [] }, processError = (error) => {
const fieldErrors = { _errors: [] };
const processError = (error) => {
for (const issue of error.issues) if (issue.code === "invalid_union") issue.unionErrors.map(processError);
for (const issue of error.issues) if (issue.code === "invalid_union") issue.unionErrors.map(processError);
else if (issue.code === "invalid_return_type") processError(issue.returnTypeError);
else if (issue.code === "invalid_return_type") processError(issue.returnTypeError);
else if (issue.code === "invalid_arguments") processError(issue.argumentsError);
else if (issue.code === "invalid_arguments") processError(issue.argumentsError);
else if (issue.path.length === 0) fieldErrors._errors.push(mapper(issue));
else if (issue.path.length === 0) fieldErrors._errors.push(mapper(issue));
else {
else {
let curr = fieldErrors;
let curr = fieldErrors, i = 0;
let i = 0;
while (i < issue.path.length) {
while (i < issue.path.length) {
const el = issue.path[i];
const el = issue.path[i], terminal = i === issue.path.length - 1;
const terminal = i === issue.path.length - 1;
if (!terminal) curr[el] = curr[el] || { _errors: [] };
if (!terminal) curr[el] = curr[el] || { _errors: [] };
else {
else curr[el] = curr[el] || { _errors: [] }, curr[el]._errors.push(mapper(issue));
curr[el] = curr[el] || { _errors: [] };
curr = curr[el], i++;
curr[el]._errors.push(mapper(issue));
}
curr = curr[el];
i++;
}
}
}
}
};
};
processError(this);
return processError(this), fieldErrors;
return fieldErrors;
}
}
static assert(value) {
static assert(value) {
if (!(value instanceof ZodError)) throw new Error(`Not a ZodError: ${value}`);
if (!(value instanceof ZodError)) throw new Error(`Not a ZodError: ${value}`);
}
}
toString() {
toString() {
return this.message;
return this.message;
}
}
get message() {
get message() {
return JSON.stringify(this.issues, util$5.jsonStringifyReplacer, 2);
return JSON.stringify(this.issues, util$5.jsonStringifyReplacer, 2);
}
}
get isEmpty() {
get isEmpty() {
return this.issues.length === 0;
return this.issues.length === 0;
}
}
flatten(mapper = (issue) => issue.message) {
flatten(mapper = (issue) => issue.message) {
const fieldErrors = {};
const fieldErrors = {}, formErrors = [];
const formErrors = [];
for (const sub of this.issues) if (sub.path.length > 0) {
for (const sub of this.issues) if (sub.path.length > 0) {
const firstEl = sub.path[0];
const firstEl = sub.path[0];
fieldErrors[firstEl] = fieldErrors[firstEl] || [];
fieldErrors[firstEl] = fieldErrors[firstEl] || [], fieldErrors[firstEl].push(mapper(sub));
fieldErrors[firstEl].push(mapper(sub));
} else formErrors.push(mapper(sub));
} else formErrors.push(mapper(sub));
return {
return {
formErrors,
formErrors,
fieldErrors
fieldErrors
};
};
}
}
get formErrors() {
get formErrors() {
return this.flatten();
return this.flatten();
}
}
};
};
ZodError.create = (issues) => {
ZodError.create = (issues) => {
const error = new ZodError(issues);
const error = new ZodError(issues);
return error;
return error;
};
};
const errorMap = (issue, _ctx) => {
const errorMap = (issue, _ctx) => {
let message;
let message;
switch (issue.code) {
switch (issue.code) {
case ZodIssueCode.invalid_type:
case ZodIssueCode.invalid_type:
if (issue.received === ZodParsedType.undefined) message = "Required";
if (issue.received === ZodParsedType.undefined) message = "Required";
else message = `Expected ${issue.expected}, received ${issue.received}`;
else message = `Expected ${issue.expected}, received ${issue.received}`;
break;
break;
case ZodIssueCode.invalid_literal:
case ZodIssueCode.invalid_literal:
message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util$5.jsonStringifyReplacer)}`;
message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util$5.jsonStringifyReplacer)}`;
break;
break;
case ZodIssueCode.unrecognized_keys:
case ZodIssueCode.unrecognized_keys:
message = `Unrecognized key(s) in object: ${util$5.joinValues(issue.keys, ", ")}`;
message = `Unrecognized key(s) in object: ${util$5.joinValues(issue.keys, ", ")}`;
break;
break;
case ZodIssueCode.invalid_union:
case ZodIssueCode.invalid_union:
message = `Invalid input`;
message = `Invalid input`;
break;
break;
case ZodIssueCode.invalid_union_discriminator:
case ZodIssueCode.invalid_union_discriminator:
message = `Invalid discriminator value. Expected ${util$5.joinValues(issue.options)}`;
message = `Invalid discriminator value. Expected ${util$5.joinValues(issue.options)}`;
break;
break;
case ZodIssueCode.invalid_enum_value:
case ZodIssueCode.invalid_enum_value:
message = `Invalid enum value. Expected ${util$5.joinValues(issue.options)}, received '${issue.received}'`;
message = `Invalid enum value. Expected ${util$5.joinValues(issue.options)}, received '${issue.received}'`;
break;
break;
case ZodIssueCode.invalid_arguments:
case ZodIssueCode.invalid_arguments:
message = `Invalid function arguments`;
message = `Invalid function arguments`;
break;
break;
case ZodIssueCode.invalid_return_type:
case ZodIssueCode.invalid_return_type:
message = `Invalid function return type`;
message = `Invalid function return type`;
break;
break;
case ZodIssueCode.invalid_date:
case ZodIssueCode.invalid_date:
message = `Invalid date`;
message = `Invalid date`;
break;
break;
case ZodIssueCode.invalid_string:
case ZodIssueCode.invalid_string:
if (typeof issue.validation === "object") if ("includes" in issue.validation) {
if (typeof issue.validation === "object") if ("includes" in issue.validation) {
message = `Invalid input: must include "${issue.validation.includes}"`;
if (message = `Invalid input: must include "${issue.validation.includes}"`, typeof issue.validation.position === "number") message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
if (typeof issue.validation.position === "number") message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
} else if ("startsWith" in issue.validation) message = `Invalid input: must start with "${issue.validation.startsWith}"`;
} else if ("startsWith" in issue.validation) message = `Invalid input: must start with "${issue.validation.startsWith}"`;
else if ("endsWith" in issue.validation) message = `Invalid input: must end with "${issue.validation.endsWith}"`;
else if ("endsWith" in issue.validation) message = `Invalid input: must end with "${issue.validation.endsWith}"`;
else util$5.assertNever(issue.validation);
else util$5.assertNever(issue.validation);
else if (issue.validation !== "regex") message = `Invalid ${issue.validation}`;
else if (issue.validation !== "regex") message = `Invalid ${issue.validation}`;
else message = "Invalid";
else message = "Invalid";
break;
break;
case ZodIssueCode.too_small:
case ZodIssueCode.too_small:
if (issue.type === "array") message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
if (issue.type === "array") message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
else if (issue.type === "string") message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
else if (issue.type === "string") message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
else if (issue.type === "number") message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
else if (issue.type === "number") message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
else if (issue.type === "bigint") message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
else if (issue.type === "bigint") message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
else if (issue.type === "date") message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
else if (issue.type === "date") message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
else message = "Invalid input";
else message = "Invalid input";
break;
break;
case ZodIssueCode.too_big:
case ZodIssueCode.too_big:
if (issue.type === "array") message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
if (issue.type === "array") message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
else if (issue.type === "string") message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
else if (issue.type === "string") message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
else if (issue.type === "number") message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
else if (issue.type === "number") message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
else if (issue.type === "bigint") message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
else if (issue.type === "bigint") message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
else if (issue.type === "date") message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
else if (issue.type === "date") message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
else message = "Invalid input";
else message = "Invalid input";
break;
break;
case ZodIssueCode.custom:
case ZodIssueCode.custom:
message = `Invalid input`;
message = `Invalid input`;
break;
break;
case ZodIssueCode.invalid_intersection_types:
case ZodIssueCode.invalid_intersection_types:
message = `Intersection results could not be merged`;
message = `Intersection results could not be merged`;
break;
break;
case ZodIssueCode.not_multiple_of:
case ZodIssueCode.not_multiple_of:
message = `Number must be a multiple of ${issue.multipleOf}`;
message = `Number must be a multiple of ${issue.multipleOf}`;
break;
break;
case ZodIssueCode.not_finite:
case ZodIssueCode.not_finite:
message = "Number must be finite";
message = "Number must be finite";
break;
break;
default:
default: message = _ctx.defaultError, util$5.assertNever(issue);
message = _ctx.defaultError;
util$5.assertNever(issue);
}
}
return { message };
return { message };
};
};
var en_default = errorMap;
var en_default = errorMap;
let overrideErrorMap = en_default;
let overrideErrorMap = en_default;
function getErrorMap() {
function getErrorMap() {
return overrideErrorMap;
return overrideErrorMap;
}
}
const makeIssue = (params) => {
const makeIssue = (params) => {
const { data, path, errorMaps, issueData } = params;
const { data, path, errorMaps, issueData } = params, fullPath = [...path, ...issueData.path || []], fullIssue = {
const fullPath = [...path, ...issueData.path || []];
const fullIssue = {
...issueData,
...issueData,
path: fullPath
path: fullPath
};
};
if (issueData.message !== void 0) return {
if (issueData.message !== void 0) return {
...issueData,
...issueData,
path: fullPath,
path: fullPath,
message: issueData.message
message: issueData.message
};
};
let errorMessage = "";
let errorMessage = "";
const maps = errorMaps.filter((m) => !!m).slice().reverse();
const maps = errorMaps.filter((m) => !!m).slice().reverse();
for (const map of maps) errorMessage = map(fullIssue, {
for (const map of maps) errorMessage = map(fullIssue, {
data,
data,
defaultError: errorMessage
defaultError: errorMessage
}).message;
}).message;
return {
return {
...issueData,
...issueData,
path: fullPath,
path: fullPath,
message: errorMessage
message: errorMessage
};
};
};
};
function addIssueToContext(ctx, issueData) {
function addIssueToContext(ctx, issueData) {
const overrideMap = getErrorMap();
const overrideMap = getErrorMap(), issue = makeIssue({
const issue = makeIssue({
issueData,
issueData,
data: ctx.data,
data: ctx.data,
path: ctx.path,
path: ctx.path,
errorMaps: [
errorMaps: [
ctx.common.contextualErrorMap,
ctx.common.contextualErrorMap,
ctx.schemaErrorMap,
ctx.schemaErrorMap,
overrideMap,
overrideMap,
overrideMap === en_default ? void 0 : en_default
overrideMap === en_default ? void 0 : en_default
].filter((x) => !!x)
].filter((x) => !!x)
});
});
ctx.common.issues.push(issue);
ctx.common.issues.push(issue);
}
}
var ParseStatus = class ParseStatus {
var ParseStatus = class ParseStatus {
constructor() {
constructor() {
this.value = "valid";
this.value = "valid";
}
}
dirty() {
dirty() {
if (this.value === "valid") this.value = "dirty";
if (this.value === "valid") this.value = "dirty";
}
}
abort() {
abort() {
if (this.value !== "aborted") this.value = "aborted";
if (this.value !== "aborted") this.value = "aborted";
}
}
static mergeArray(status, results) {
static mergeArray(status, results) {
const arrayValue = [];
const arrayValue = [];
for (const s of results) {
for (const s of results) {
if (s.status === "aborted") return INVALID;
if (s.status === "aborted") return INVALID;
if (s.status === "dirty") status.dirty();
if (s.status === "dirty") status.dirty();
arrayValue.push(s.value);
arrayValue.push(s.value);
}
}
return {
return {
status: status.value,
status: status.value,
value: arrayValue
value: arrayValue
};
};
}
}
static async mergeObjectAsync(status, pairs) {
static async mergeObjectAsync(status, pairs) {
const syncPairs = [];
const syncPairs = [];
for (const pair of pairs) {
for (const pair of pairs) {
const key = await pair.key;
const key = await pair.key, value = await pair.value;
const value = await pair.value;
syncPairs.push({
syncPairs.push({
key,
key,
value
value
});
});
}
}
return ParseStatus.mergeObjectSync(status, syncPairs);
return ParseStatus.mergeObjectSync(status, syncPairs);
}
}
static mergeObjectSync(status, pairs) {
static mergeObjectSync(status, pairs) {
const finalObject = {};
const finalObject = {};
for (const pair of pairs) {
for (const pair of pairs) {
const { key, value } = pair;
const { key, value } = pair;
if (key.status === "aborted") return INVALID;
if (key.status === "aborted" || value.status === "aborted") return INVALID;
if (value.status === "aborted") return INVALID;
if (key.status === "dirty") status.dirty();
if (key.status === "dirty") status.dirty();
if (value.status === "dirty") status.dirty();
if (value.status === "dirty") status.dirty();
if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) finalObject[key.value] = value.value;
if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) finalObject[key.value] = value.value;
}
}
return {
return {
status: status.value,
status: status.value,
value: finalObject
value: finalObject
};
};
}
}
};
};
const INVALID = Object.freeze({ status: "aborted" });
const INVALID = Object.freeze({ status: "aborted" }), DIRTY = (value) => ({
const DIRTY = (value) => ({
status: "dirty",
status: "dirty",
value
value
});
}), OK = (value) => ({
const OK = (value) => ({
status: "valid",
status: "valid",
value
value
});
}), isAborted = (x) => x.status === "aborted", isDirty = (x) => x.status === "dirty", isValid = (x) => x.status === "valid", isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
const isAborted = (x) => x.status === "aborted";
const isDirty = (x) => x.status === "dirty";
const isValid = (x) => x.status === "valid";
const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
var errorUtil;
var errorUtil;
(function(errorUtil$1) {
(function(errorUtil$1) {
errorUtil$1.errToObj = (message) => typeof message === "string" ? { message } : message || {};
errorUtil$1.errToObj = (message) => typeof message === "string" ? { message } : message || {}, errorUtil$1.toString = (message) => typeof message === "string" ? message : message?.message;
errorUtil$1.toString = (message) => typeof message === "string" ? message : message?.message;
})(errorUtil || (errorUtil = {}));
})(errorUtil || (errorUtil = {}));
var ParseInputLazyPath = class {
var ParseInputLazyPath = class {
constructor(parent, value, path, key) {
constructor(parent, value, path, key) {
this._cachedPath = [];
this._cachedPath = [], this.parent = parent, this.data = value, this._path = path, this._key = key;
this.parent = parent;
this.data = value;
this._path = path;
this._key = key;
}
}
get path() {
get path() {
if (!this._cachedPath.length) if (Array.isArray(this._key)) this._cachedPath.push(...this._path, ...this._key);
if (!this._cachedPath.length) if (Array.isArray(this._key)) this._cachedPath.push(...this._path, ...this._key);
else this._cachedPath.push(...this._path, this._key);
else this._cachedPath.push(...this._path, this._key);
return this._cachedPath;
return this._cachedPath;
}
}
};
};
const handleResult = (ctx, result) => {
const handleResult = (ctx, result) => {
if (isValid(result)) return {
if (isValid(result)) return {
success: true,
success: true,
data: result.value
data: result.value
};
};
else {
if (!ctx.common.issues.length) throw new Error("Validation failed but no issues detected.");
if (!ctx.common.issues.length) throw new Error("Validation failed but no issues detected.");
return {
return {
success: false,
success: false,
get error() {
get error() {
if (this._error) return this._error;
if (this._error) return this._error;
const error = new ZodError(ctx.common.issues);
const error = new ZodError(ctx.common.issues);
return this._error = error, this._error;
this._error = error;
}
return this._error;
};
}
};
}
};
};
function processCreateParams$1(params) {
function processCreateParams$1(params) {
if (!params) return {};
if (!params) return {};
const { errorMap: errorMap$1, invalid_type_error, required_error, description } = params;
const { errorMap: errorMap$1, invalid_type_error, required_error, description } = params;
if (errorMap$1 && (invalid_type_error || required_error)) throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
if (errorMap$1 && (invalid_type_error || required_error)) throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
if (errorMap$1) return {
if (errorMap$1) return {
errorMap: errorMap$1,
errorMap: errorMap$1,
description
description
};
};
const customMap = (iss, ctx) => {
const customMap = (iss, ctx) => {
const { message } = params;
const { message } = params;
if (iss.code === "invalid_enum_value") return { message: message ?? ctx.defaultError };
return iss.code === "invalid_enum_value" ? { message: message ?? ctx.defaultError } : typeof ctx.data === "undefined" ? { message: message ?? required_error ?? ctx.defaultError } : iss.code === "invalid_type" ? { message: message ?? invalid_type_error ?? ctx.defaultError } : { message: ctx.defaultError };
if (typeof ctx.data === "undefined") return { message: message ?? required_error ?? ctx.defaultError };
if (iss.code !== "invalid_type") return { message: ctx.defaultError };
return { message: message ?? invalid_type_error ?? ctx.defaultError };
};
};
return {
return {
errorMap: customMap,
errorMap: customMap,
description
description
};
};
}
}
var ZodType = class {
var ZodType = class {
get description() {
get description() {
return this._def.description;
return this._def.description;
}
}
_getType(input) {
_getType(input) {
return getParsedType(input.data);
return getParsedType(input.data);
}
}
_getOrReturnCtx(input, ctx) {
_getOrReturnCtx(input, ctx) {
return ctx || {
return ctx || {
common: input.parent.common,
common: input.parent.common,
data: input.data,
data: input.data,
parsedType: getParsedType(input.data),
parsedType: getParsedType(input.data),
schemaErrorMap: this._def.errorMap,
schemaErrorMap: this._def.errorMap,
path: input.path,
path: input.path,
parent: input.parent
parent: input.parent
};
};
}
}
_processInputParams(input) {
_processInputParams(input) {
return {
return {
status: new ParseStatus(),
status: new ParseStatus(),
ctx: {
ctx: {
common: input.parent.common,
common: input.parent.common,
data: input.data,
data: input.data,
parsedType: getParsedType(input.data),
parsedType: getParsedType(input.data),
schemaErrorMap: this._def.errorMap,
schemaErrorMap: this._def.errorMap,
path: input.path,
path: input.path,
parent: input.parent
parent: input.parent
}
}
};
};
}
}
_parseSync(input) {
_parseSync(input) {
const result = this._parse(input);
const result = this._parse(input);
if (isAsync(result)) throw new Error("Synchronous parse encountered promise.");
if (isAsync(result)) throw new Error("Synchronous parse encountered promise.");
return result;
return result;
}
}
_parseAsync(input) {
_parseAsync(input) {
const result = this._parse(input);
const result = this._parse(input);
return Promise.resolve(result);
return Promise.resolve(result);
}
}
parse(data, params) {
parse(data, params) {
const result = this.safeParse(data, params);
const result = this.safeParse(data, params);
if (result.success) return result.data;
if (result.success) return result.data;
throw result.error;
throw result.error;
}
}
safeParse(data, params) {
safeParse(data, params) {
const ctx = {
const ctx = {
common: {
common: {
issues: [],
issues: [],
async: params?.async ?? false,
async: params?.async ?? false,
contextualErrorMap: params?.errorMap
contextualErrorMap: params?.errorMap
},
},
path: params?.path || [],
path: params?.path || [],
schemaErrorMap: this._def.errorMap,
schemaErrorMap: this._def.errorMap,
parent: null,
parent: null,
data,
data,
parsedType: getParsedType(data)
parsedType: getParsedType(data)
};
}, result = this._parseSync({
const result = this._parseSync({
data,
data,
path: ctx.path,
path: ctx.path,
parent: ctx
parent: ctx
});
});
return handleResult(ctx, result);
return handleResult(ctx, result);
}
}
"~validate"(data) {
"~validate"(data) {
const ctx = {
const ctx = {
common: {
common: {
issues: [],
issues: [],
async: !!this["~standard"].async
async: !!this["~standard"].async
},
},
path: [],
path: [],
schemaErrorMap: this._def.errorMap,
schemaErrorMap: this._def.errorMap,
parent: null,
parent: null,
data,
data,
parsedType: getParsedType(data)
parsedType: getParsedType(data)
};
};
if (!this["~standard"].async) try {
if (!this["~standard"].async) try {
const result = this._parseSync({
const result = this._parseSync({
data,
data,
path: [],
path: [],
parent: ctx
parent: ctx
});
});
return isValid(result) ? { value: result.value } : { issues: ctx.common.issues };
return isValid(result) ? { value: result.value } : { issues: ctx.common.issues };
} catch (err) {
} catch (err) {
if (err?.message?.toLowerCase()?.includes("encountered")) this["~standard"].async = true;
if (err?.message?.toLowerCase()?.includes("encountered")) this["~standard"].async = true;
ctx.common = {
ctx.common = {
issues: [],
issues: [],
async: true
async: true
};
};
}
}
return this._parseAsync({
return this._parseAsync({
data,
data,
path: [],
path: [],
parent: ctx
parent: ctx
}).then((result) => isValid(result) ? { value: result.value } : { issues: ctx.common.issues });
}).then((result) => isValid(result) ? { value: result.value } : { issues: ctx.common.issues });
}
}
async parseAsync(data, params) {
async parseAsync(data, params) {
const result = await this.safeParseAsync(data, params);
const result = await this.safeParseAsync(data, params);
if (result.success) return result.data;
if (result.success) return result.data;
throw result.error;
throw result.error;
}
}
async safeParseAsync(data, params) {
async safeParseAsync(data, params) {
const ctx = {
const ctx = {
common: {
common: {
issues: [],
issues: [],
contextualErrorMap: params?.errorMap,
contextualErrorMap: params?.errorMap,
async: true
async: true
},
},
path: params?.path || [],
path: params?.path || [],
schemaErrorMap: this._def.errorMap,
schemaErrorMap: this._def.errorMap,
parent: null,
parent: null,
data,
data,
parsedType: getParsedType(data)
parsedType: getParsedType(data)
};
}, maybeAsyncResult = this._parse({
const maybeAsyncResult = this._parse({
data,
data,
path: ctx.path,
path: ctx.path,
parent: ctx
parent: ctx
});
}), result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
return handleResult(ctx, result);
return handleResult(ctx, result);
}
}
refine(check, message) {
refine(check, message) {
const getIssueProperties = (val) => {
const getIssueProperties = (val) => {
if (typeof message === "string" || typeof message === "undefined") return { message };
return typeof message === "string" || typeof message === "undefined" ? { message } : typeof message === "function" ? message(val) : message;
else if (typeof message === "function") return message(val);
else return message;
};
};
return this._refinement((val, ctx) => {
return this._refinement((val, ctx) => {
const result = check(val);
const result = check(val), setError = () => ctx.addIssue({
const setError = () => ctx.addIssue({
code: ZodIssueCode.custom,
code: ZodIssueCode.custom,
...getIssueProperties(val)
...getIssueProperties(val)
});
});
if (typeof Promise !== "undefined" && result instanceof Promise) return result.then((data) => {
return typeof Promise !== "undefined" && result instanceof Promise ? result.then((data) => {
if (!data) {
return data ? true : (setError(), false);
setError();
}) : result ? true : (setError(), false);
return false;
} else return true;
});
if (!result) {
setError();
return false;
} else return true;
});
});
}
}
refinement(check, refinementData) {
refinement(check, refinementData) {
return this._refinement((val, ctx) => {
return this._refinement((val, ctx) => {
if (!check(val)) {
return check(val) ? true : (ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData), false);
ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
return false;
} else return true;
});
});
}
}
_refinement(refinement) {
_refinement(refinement) {
return new ZodEffects({
return new ZodEffects({
schema: this,
schema: this,
typeName: ZodFirstPartyTypeKind.ZodEffects,
typeName: ZodFirstPartyTypeKind.ZodEffects,
effect: {
effect: {
type: "refinement",
type: "refinement",
refinement
refinement
}
}
});
});
}
}
superRefine(refinement) {
superRefine(refinement) {
return this._refinement(refinement);
return this._refinement(refinement);
}
}
constructor(def) {
constructor(def) {
/** Alias of safeParseAsync */
this.spa = this.safeParseAsync, this._def = def, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
this.spa = this.safeParseAsync;
this._def = def;
this.parse = this.parse.bind(this);
this.safeParse = this.safeParse.bind(this);
this.parseAsync = this.parseAsync.bind(this);
this.safeParseAsync = this.safeParseAsync.bind(this);
this.spa = this.spa.bind(this);
this.refine = this.refine.bind(this);
this.refinement = this.refinement.bind(this);
this.superRefine = this.superRefine.bind(this);
this.optional = this.optional.bind(this);
this.nullable = this.nullable.bind(this);
this.nullish = this.nullish.bind(this);
this.array = this.array.bind(this);
this.promise = this.promise.bind(this);
this.or = this.or.bind(this);
this.and = this.and.bind(this);
this.transform = this.transform.bind(this);
this.brand = this.brand.bind(this);
this.default = this.default.bind(this);
this.catch = this.catch.bind(this);
this.describe = this.describe.bind(this);
this.pipe = this.pipe.bind(this);
this.readonly = this.readonly.bind(this);
this.isNullable = this.isNullable.bind(this);
this.isOptional = this.isOptional.bind(this);
this["~standard"] = {
version: 1,
version: 1,
vendor: "zod",
vendor: "zod",
validate: (data) => this["~validate"](data)
validate: (data) => this["~validate"](data)
};
};
}
}
optional() {
optional() {
return ZodOptional.create(this, this._def);
return ZodOptional.create(this, this._def);
}
}
nullable() {
nullable() {
return ZodNullable.create(this, this._def);
return ZodNullable.create(this, this._def);
}
}
nullish() {
nullish() {
return this.nullable().optional();
return this.nullable().optional();
}
}
array() {
array() {
return ZodArray.create(this);
return ZodArray.create(this);
}
}
promise() {
promise() {
return ZodPromise.create(this, this._def);
return ZodPromise.create(this, this._def);
}
}
or(option) {
or(option) {
return ZodUnion.create([this, option], this._def);
return ZodUnion.create([this, option], this._def);
}
}
and(incoming) {
and(incoming) {
return ZodIntersection.create(this, incoming, this._def);
return ZodIntersection.create(this, incoming, this._def);
}
}
transform(transform) {
transform(transform) {
return new ZodEffects({
return new ZodEffects({
...processCreateParams$1(this._def),
...processCreateParams$1(this._def),
schema: this,
schema: this,
typeName: ZodFirstPartyTypeKind.ZodEffects,
typeName: ZodFirstPartyTypeKind.ZodEffects,
effect: {
effect: {
type: "transform",
type: "transform",
transform
transform
}
}
});
});
}
}
default(def) {
default(def) {
const defaultValueFunc = typeof def === "function" ? def : () => def;
const defaultValueFunc = typeof def === "function" ? def : () => def;
return new ZodDefault({
return new ZodDefault({
...processCreateParams$1(this._def),
...processCreateParams$1(this._def),
innerType: this,
innerType: this,
defaultValue: defaultValueFunc,
defaultValue: defaultValueFunc,
typeName: ZodFirstPartyTypeKind.ZodDefault
typeName: ZodFirstPartyTypeKind.ZodDefault
});
});
}
}
brand() {
brand() {
return new ZodBranded({
return new ZodBranded({
typeName: ZodFirstPartyTypeKind.ZodBranded,
typeName: ZodFirstPartyTypeKind.ZodBranded,
type: this,
type: this,
...processCreateParams$1(this._def)
...processCreateParams$1(this._def)
});
});
}
}
catch(def) {
catch(def) {
const catchValueFunc = typeof def === "function" ? def : () => def;
const catchValueFunc = typeof def === "function" ? def : () => def;
return new ZodCatch({
return new ZodCatch({
...processCreateParams$1(this._def),
...processCreateParams$1(this._def),
innerType: this,
innerType: this,
catchValue: catchValueFunc,
catchValue: catchValueFunc,
typeName: ZodFirstPartyTypeKind.ZodCatch
typeName: ZodFirstPartyTypeKind.ZodCatch
});
});
}
}
describe(description) {
describe(description) {
const This = this.constructor;
const This = this.constructor;
return new This({
return new This({
...this._def,
...this._def,
description
description
});
});
}
}
pipe(target) {
pipe(target) {
return ZodPipeline.create(this, target);
return ZodPipeline.create(this, target);
}
}
readonly() {
readonly() {
return ZodReadonly.create(this);
return ZodReadonly.create(this);
}
}
isOptional() {
isOptional() {
return this.safeParse(void 0).success;
return this.safeParse(void 0).success;
}
}
isNullable() {
isNullable() {
return this.safeParse(null).success;
return this.safeParse(null).success;
}
}
};
};
const cuidRegex = /^c[^\s-]{8,}$/i;
const cuidRegex = /^c[^\s-]{8,}$/i, cuid2Regex = /^[0-9a-z]+$/, ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i, uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, nanoidRegex = /^[a-z0-9_-]{21}$/i, jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, durationRegex = /^[-+]?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)?)??$/, emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
const cuid2Regex = /^[0-9a-z]+$/;
const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
const uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
const nanoidRegex = /^[a-z0-9_-]{21}$/i;
const jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
const durationRegex = /^[-+]?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)?)??$/;
const emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
const _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
let emojiRegex$1;
let emojiRegex$1;
const ipv4Regex = /^(?:(?: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])$/;
const ipv4Regex = /^(?:(?: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])$/, ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, dateRegexSource = `((\\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])))`, dateRegex = /* @__PURE__ */ new RegExp(`^${dateRegexSource}$`);
const ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
function timeRegexSource(args) {
const ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
let secondsRegexSource = `[0-5]\\d`;
const ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
if (args.precision) secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
const base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
else if (args.precision == null) secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
const base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{
const secondsQuantifier = args.precision ? "+" : "?";
return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${sec