

import { ZodValidationError } from "../error/ZodValidationError.mjs";
import "../error/index.mjs";
import { z } from "zod";

//#region src/utils/zod.ts
function zParseWithErrorHandling(schema, data, customErrorMessage) {
	const parseResult = schema.safeParse(data);
	if (!parseResult.success) throw new ZodValidationError(customErrorMessage ?? `Error validating schema with data ${JSON.stringify(data)}`, parseResult.error);
	return parseResult.data;
}
const zUniqueArray = (item) => z.array(item).refine((a) => new Set(a).size === a.length, "Array must have unique values");
const zOptionalToUndefined = (item) => z.optional(item.transform(() => void 0));
const zBase64Url = z.string().regex(/[a-zA-Z0-9_-]+/, "Must be a base64url string");

//#endregion
export { zBase64Url, zOptionalToUndefined, zParseWithErrorHandling, zUniqueArray };
//# sourceMappingURL=zod.mjs.map