task-pigeon
Version:
Small SQLite task queue CLI for people and coding agents.
19,721 lines • 670 kB
JavaScript
var __defProp = Object.defineProperty;
var __returnValue = (v) => v;
function __exportSetter(name, newValue) {
this[name] = __returnValue.bind(null, newValue);
}
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: __exportSetter.bind(all, name)
});
};
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/entity.js
var entityKind = Symbol.for("drizzle:entityKind");
var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
function is(value, type) {
if (!value || typeof value !== "object") {
return false;
}
if (value instanceof type) {
return true;
}
if (!Object.prototype.hasOwnProperty.call(type, entityKind)) {
throw new Error(`Class "${type.name ?? "<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);
}
let cls = Object.getPrototypeOf(value).constructor;
if (cls) {
while (cls) {
if (entityKind in cls && cls[entityKind] === type[entityKind]) {
return true;
}
cls = Object.getPrototypeOf(cls);
}
}
return false;
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/column.js
class Column {
constructor(table, config) {
this.table = table;
this.config = config;
this.name = config.name;
this.keyAsName = config.keyAsName;
this.notNull = config.notNull;
this.default = config.default;
this.defaultFn = config.defaultFn;
this.onUpdateFn = config.onUpdateFn;
this.hasDefault = config.hasDefault;
this.primary = config.primaryKey;
this.isUnique = config.isUnique;
this.uniqueName = config.uniqueName;
this.uniqueType = config.uniqueType;
this.dataType = config.dataType;
this.columnType = config.columnType;
this.generated = config.generated;
this.generatedIdentity = config.generatedIdentity;
}
static [entityKind] = "Column";
name;
keyAsName;
primary;
notNull;
default;
defaultFn;
onUpdateFn;
hasDefault;
isUnique;
uniqueName;
uniqueType;
dataType;
columnType;
enumValues = undefined;
generated = undefined;
generatedIdentity = undefined;
config;
mapFromDriverValue(value) {
return value;
}
mapToDriverValue(value) {
return value;
}
shouldDisableInsert() {
return this.config.generated !== undefined && this.config.generated.type !== "byDefault";
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/column-builder.js
class ColumnBuilder {
static [entityKind] = "ColumnBuilder";
config;
constructor(name, dataType, columnType) {
this.config = {
name,
keyAsName: name === "",
notNull: false,
default: undefined,
hasDefault: false,
primaryKey: false,
isUnique: false,
uniqueName: undefined,
uniqueType: undefined,
dataType,
columnType,
generated: undefined
};
}
$type() {
return this;
}
notNull() {
this.config.notNull = true;
return this;
}
default(value) {
this.config.default = value;
this.config.hasDefault = true;
return this;
}
$defaultFn(fn) {
this.config.defaultFn = fn;
this.config.hasDefault = true;
return this;
}
$default = this.$defaultFn;
$onUpdateFn(fn) {
this.config.onUpdateFn = fn;
this.config.hasDefault = true;
return this;
}
$onUpdate = this.$onUpdateFn;
primaryKey() {
this.config.primaryKey = true;
this.config.notNull = true;
return this;
}
setName(name) {
if (this.config.name !== "")
return;
this.config.name = name;
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/table.utils.js
var TableName = Symbol.for("drizzle:Name");
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/tracing-utils.js
function iife(fn, ...args) {
return fn(...args);
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/pg-core/unique-constraint.js
function uniqueKeyName(table, columns) {
return `${table[TableName]}_${columns.join("_")}_unique`;
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/pg-core/columns/common.js
class PgColumn extends Column {
constructor(table, config) {
if (!config.uniqueName) {
config.uniqueName = uniqueKeyName(table, [config.name]);
}
super(table, config);
this.table = table;
}
static [entityKind] = "PgColumn";
}
class ExtraConfigColumn extends PgColumn {
static [entityKind] = "ExtraConfigColumn";
getSQLType() {
return this.getSQLType();
}
indexConfig = {
order: this.config.order ?? "asc",
nulls: this.config.nulls ?? "last",
opClass: this.config.opClass
};
defaultConfig = {
order: "asc",
nulls: "last",
opClass: undefined
};
asc() {
this.indexConfig.order = "asc";
return this;
}
desc() {
this.indexConfig.order = "desc";
return this;
}
nullsFirst() {
this.indexConfig.nulls = "first";
return this;
}
nullsLast() {
this.indexConfig.nulls = "last";
return this;
}
op(opClass) {
this.indexConfig.opClass = opClass;
return this;
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/pg-core/columns/enum.js
class PgEnumObjectColumn extends PgColumn {
static [entityKind] = "PgEnumObjectColumn";
enum;
enumValues = this.config.enum.enumValues;
constructor(table, config) {
super(table, config);
this.enum = config.enum;
}
getSQLType() {
return this.enum.enumName;
}
}
var isPgEnumSym = Symbol.for("drizzle:isPgEnum");
function isPgEnum(obj) {
return !!obj && typeof obj === "function" && isPgEnumSym in obj && obj[isPgEnumSym] === true;
}
class PgEnumColumn extends PgColumn {
static [entityKind] = "PgEnumColumn";
enum = this.config.enum;
enumValues = this.config.enum.enumValues;
constructor(table, config) {
super(table, config);
this.enum = config.enum;
}
getSQLType() {
return this.enum.enumName;
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/subquery.js
class Subquery {
static [entityKind] = "Subquery";
constructor(sql, fields, alias, isWith = false, usedTables = []) {
this._ = {
brand: "Subquery",
sql,
selectedFields: fields,
alias,
isWith,
usedTables
};
}
}
class WithSubquery extends Subquery {
static [entityKind] = "WithSubquery";
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/version.js
var version = "0.45.2";
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/tracing.js
var otel;
var rawTracer;
var tracer = {
startActiveSpan(name, fn) {
if (!otel) {
return fn();
}
if (!rawTracer) {
rawTracer = otel.trace.getTracer("drizzle-orm", version);
}
return iife((otel2, rawTracer2) => rawTracer2.startActiveSpan(name, (span) => {
try {
return fn(span);
} catch (e) {
span.setStatus({
code: otel2.SpanStatusCode.ERROR,
message: e instanceof Error ? e.message : "Unknown error"
});
throw e;
} finally {
span.end();
}
}), otel, rawTracer);
}
};
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/view-common.js
var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/table.js
var Schema = Symbol.for("drizzle:Schema");
var Columns = Symbol.for("drizzle:Columns");
var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
var OriginalName = Symbol.for("drizzle:OriginalName");
var BaseName = Symbol.for("drizzle:BaseName");
var IsAlias = Symbol.for("drizzle:IsAlias");
var ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
var IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
class Table {
static [entityKind] = "Table";
static Symbol = {
Name: TableName,
Schema,
OriginalName,
Columns,
ExtraConfigColumns,
BaseName,
IsAlias,
ExtraConfigBuilder
};
[TableName];
[OriginalName];
[Schema];
[Columns];
[ExtraConfigColumns];
[BaseName];
[IsAlias] = false;
[IsDrizzleTable] = true;
[ExtraConfigBuilder] = undefined;
constructor(name, schema, baseName) {
this[TableName] = this[OriginalName] = name;
this[Schema] = schema;
this[BaseName] = baseName;
}
}
function getTableName(table) {
return table[TableName];
}
function getTableUniqueName(table) {
return `${table[Schema] ?? "public"}.${table[TableName]}`;
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sql/sql.js
function isSQLWrapper(value) {
return value !== null && value !== undefined && typeof value.getSQL === "function";
}
function mergeQueries(queries) {
const result = { sql: "", params: [] };
for (const query of queries) {
result.sql += query.sql;
result.params.push(...query.params);
if (query.typings?.length) {
if (!result.typings) {
result.typings = [];
}
result.typings.push(...query.typings);
}
}
return result;
}
class StringChunk {
static [entityKind] = "StringChunk";
value;
constructor(value) {
this.value = Array.isArray(value) ? value : [value];
}
getSQL() {
return new SQL([this]);
}
}
class SQL {
constructor(queryChunks) {
this.queryChunks = queryChunks;
for (const chunk of queryChunks) {
if (is(chunk, Table)) {
const schemaName = chunk[Table.Symbol.Schema];
this.usedTables.push(schemaName === undefined ? chunk[Table.Symbol.Name] : schemaName + "." + chunk[Table.Symbol.Name]);
}
}
}
static [entityKind] = "SQL";
decoder = noopDecoder;
shouldInlineParams = false;
usedTables = [];
append(query) {
this.queryChunks.push(...query.queryChunks);
return this;
}
toQuery(config) {
return tracer.startActiveSpan("drizzle.buildSQL", (span) => {
const query = this.buildQueryFromSourceParams(this.queryChunks, config);
span?.setAttributes({
"drizzle.query.text": query.sql,
"drizzle.query.params": JSON.stringify(query.params)
});
return query;
});
}
buildQueryFromSourceParams(chunks, _config) {
const config = Object.assign({}, _config, {
inlineParams: _config.inlineParams || this.shouldInlineParams,
paramStartIndex: _config.paramStartIndex || { value: 0 }
});
const {
casing,
escapeName,
escapeParam,
prepareTyping,
inlineParams,
paramStartIndex
} = config;
return mergeQueries(chunks.map((chunk) => {
if (is(chunk, StringChunk)) {
return { sql: chunk.value.join(""), params: [] };
}
if (is(chunk, Name)) {
return { sql: escapeName(chunk.value), params: [] };
}
if (chunk === undefined) {
return { sql: "", params: [] };
}
if (Array.isArray(chunk)) {
const result = [new StringChunk("(")];
for (const [i, p] of chunk.entries()) {
result.push(p);
if (i < chunk.length - 1) {
result.push(new StringChunk(", "));
}
}
result.push(new StringChunk(")"));
return this.buildQueryFromSourceParams(result, config);
}
if (is(chunk, SQL)) {
return this.buildQueryFromSourceParams(chunk.queryChunks, {
...config,
inlineParams: inlineParams || chunk.shouldInlineParams
});
}
if (is(chunk, Table)) {
const schemaName = chunk[Table.Symbol.Schema];
const tableName = chunk[Table.Symbol.Name];
return {
sql: schemaName === undefined || chunk[IsAlias] ? escapeName(tableName) : escapeName(schemaName) + "." + escapeName(tableName),
params: []
};
}
if (is(chunk, Column)) {
const columnName = casing.getColumnCasing(chunk);
if (_config.invokeSource === "indexes") {
return { sql: escapeName(columnName), params: [] };
}
const schemaName = chunk.table[Table.Symbol.Schema];
return {
sql: chunk.table[IsAlias] || schemaName === undefined ? escapeName(chunk.table[Table.Symbol.Name]) + "." + escapeName(columnName) : escapeName(schemaName) + "." + escapeName(chunk.table[Table.Symbol.Name]) + "." + escapeName(columnName),
params: []
};
}
if (is(chunk, View)) {
const schemaName = chunk[ViewBaseConfig].schema;
const viewName = chunk[ViewBaseConfig].name;
return {
sql: schemaName === undefined || chunk[ViewBaseConfig].isAlias ? escapeName(viewName) : escapeName(schemaName) + "." + escapeName(viewName),
params: []
};
}
if (is(chunk, Param)) {
if (is(chunk.value, Placeholder)) {
return { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk], typings: ["none"] };
}
const mappedValue = chunk.value === null ? null : chunk.encoder.mapToDriverValue(chunk.value);
if (is(mappedValue, SQL)) {
return this.buildQueryFromSourceParams([mappedValue], config);
}
if (inlineParams) {
return { sql: this.mapInlineParam(mappedValue, config), params: [] };
}
let typings = ["none"];
if (prepareTyping) {
typings = [prepareTyping(chunk.encoder)];
}
return { sql: escapeParam(paramStartIndex.value++, mappedValue), params: [mappedValue], typings };
}
if (is(chunk, Placeholder)) {
return { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk], typings: ["none"] };
}
if (is(chunk, SQL.Aliased) && chunk.fieldAlias !== undefined) {
return { sql: escapeName(chunk.fieldAlias), params: [] };
}
if (is(chunk, Subquery)) {
if (chunk._.isWith) {
return { sql: escapeName(chunk._.alias), params: [] };
}
return this.buildQueryFromSourceParams([
new StringChunk("("),
chunk._.sql,
new StringChunk(") "),
new Name(chunk._.alias)
], config);
}
if (isPgEnum(chunk)) {
if (chunk.schema) {
return { sql: escapeName(chunk.schema) + "." + escapeName(chunk.enumName), params: [] };
}
return { sql: escapeName(chunk.enumName), params: [] };
}
if (isSQLWrapper(chunk)) {
if (chunk.shouldOmitSQLParens?.()) {
return this.buildQueryFromSourceParams([chunk.getSQL()], config);
}
return this.buildQueryFromSourceParams([
new StringChunk("("),
chunk.getSQL(),
new StringChunk(")")
], config);
}
if (inlineParams) {
return { sql: this.mapInlineParam(chunk, config), params: [] };
}
return { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk], typings: ["none"] };
}));
}
mapInlineParam(chunk, { escapeString }) {
if (chunk === null) {
return "null";
}
if (typeof chunk === "number" || typeof chunk === "boolean") {
return chunk.toString();
}
if (typeof chunk === "string") {
return escapeString(chunk);
}
if (typeof chunk === "object") {
const mappedValueAsString = chunk.toString();
if (mappedValueAsString === "[object Object]") {
return escapeString(JSON.stringify(chunk));
}
return escapeString(mappedValueAsString);
}
throw new Error("Unexpected param value: " + chunk);
}
getSQL() {
return this;
}
as(alias) {
if (alias === undefined) {
return this;
}
return new SQL.Aliased(this, alias);
}
mapWith(decoder) {
this.decoder = typeof decoder === "function" ? { mapFromDriverValue: decoder } : decoder;
return this;
}
inlineParams() {
this.shouldInlineParams = true;
return this;
}
if(condition) {
return condition ? this : undefined;
}
}
class Name {
constructor(value) {
this.value = value;
}
static [entityKind] = "Name";
brand;
getSQL() {
return new SQL([this]);
}
}
function isDriverValueEncoder(value) {
return typeof value === "object" && value !== null && "mapToDriverValue" in value && typeof value.mapToDriverValue === "function";
}
var noopDecoder = {
mapFromDriverValue: (value) => value
};
var noopEncoder = {
mapToDriverValue: (value) => value
};
var noopMapper = {
...noopDecoder,
...noopEncoder
};
class Param {
constructor(value, encoder = noopEncoder) {
this.value = value;
this.encoder = encoder;
}
static [entityKind] = "Param";
brand;
getSQL() {
return new SQL([this]);
}
}
function sql(strings, ...params) {
const queryChunks = [];
if (params.length > 0 || strings.length > 0 && strings[0] !== "") {
queryChunks.push(new StringChunk(strings[0]));
}
for (const [paramIndex, param2] of params.entries()) {
queryChunks.push(param2, new StringChunk(strings[paramIndex + 1]));
}
return new SQL(queryChunks);
}
((sql2) => {
function empty() {
return new SQL([]);
}
sql2.empty = empty;
function fromList(list) {
return new SQL(list);
}
sql2.fromList = fromList;
function raw(str) {
return new SQL([new StringChunk(str)]);
}
sql2.raw = raw;
function join(chunks, separator) {
const result = [];
for (const [i, chunk] of chunks.entries()) {
if (i > 0 && separator !== undefined) {
result.push(separator);
}
result.push(chunk);
}
return new SQL(result);
}
sql2.join = join;
function identifier(value) {
return new Name(value);
}
sql2.identifier = identifier;
function placeholder2(name2) {
return new Placeholder(name2);
}
sql2.placeholder = placeholder2;
function param2(value, encoder) {
return new Param(value, encoder);
}
sql2.param = param2;
})(sql || (sql = {}));
((SQL2) => {
class Aliased {
constructor(sql2, fieldAlias) {
this.sql = sql2;
this.fieldAlias = fieldAlias;
}
static [entityKind] = "SQL.Aliased";
isSelectionField = false;
getSQL() {
return this.sql;
}
clone() {
return new Aliased(this.sql, this.fieldAlias);
}
}
SQL2.Aliased = Aliased;
})(SQL || (SQL = {}));
class Placeholder {
constructor(name2) {
this.name = name2;
}
static [entityKind] = "Placeholder";
getSQL() {
return new SQL([this]);
}
}
function fillPlaceholders(params, values) {
return params.map((p) => {
if (is(p, Placeholder)) {
if (!(p.name in values)) {
throw new Error(`No value for placeholder "${p.name}" was provided`);
}
return values[p.name];
}
if (is(p, Param) && is(p.value, Placeholder)) {
if (!(p.value.name in values)) {
throw new Error(`No value for placeholder "${p.value.name}" was provided`);
}
return p.encoder.mapToDriverValue(values[p.value.name]);
}
return p;
});
}
var IsDrizzleView = Symbol.for("drizzle:IsDrizzleView");
class View {
static [entityKind] = "View";
[ViewBaseConfig];
[IsDrizzleView] = true;
constructor({ name: name2, schema, selectedFields, query }) {
this[ViewBaseConfig] = {
name: name2,
originalName: name2,
schema,
selectedFields,
query,
isExisting: !query,
isAlias: false
};
}
getSQL() {
return new SQL([this]);
}
}
Column.prototype.getSQL = function() {
return new SQL([this]);
};
Table.prototype.getSQL = function() {
return new SQL([this]);
};
Subquery.prototype.getSQL = function() {
return new SQL([this]);
};
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/alias.js
class ColumnAliasProxyHandler {
constructor(table) {
this.table = table;
}
static [entityKind] = "ColumnAliasProxyHandler";
get(columnObj, prop) {
if (prop === "table") {
return this.table;
}
return columnObj[prop];
}
}
class TableAliasProxyHandler {
constructor(alias, replaceOriginalName) {
this.alias = alias;
this.replaceOriginalName = replaceOriginalName;
}
static [entityKind] = "TableAliasProxyHandler";
get(target, prop) {
if (prop === Table.Symbol.IsAlias) {
return true;
}
if (prop === Table.Symbol.Name) {
return this.alias;
}
if (this.replaceOriginalName && prop === Table.Symbol.OriginalName) {
return this.alias;
}
if (prop === ViewBaseConfig) {
return {
...target[ViewBaseConfig],
name: this.alias,
isAlias: true
};
}
if (prop === Table.Symbol.Columns) {
const columns = target[Table.Symbol.Columns];
if (!columns) {
return columns;
}
const proxiedColumns = {};
Object.keys(columns).map((key) => {
proxiedColumns[key] = new Proxy(columns[key], new ColumnAliasProxyHandler(new Proxy(target, this)));
});
return proxiedColumns;
}
const value = target[prop];
if (is(value, Column)) {
return new Proxy(value, new ColumnAliasProxyHandler(new Proxy(target, this)));
}
return value;
}
}
function aliasedTable(table, tableAlias) {
return new Proxy(table, new TableAliasProxyHandler(tableAlias, false));
}
function aliasedTableColumn(column, tableAlias) {
return new Proxy(column, new ColumnAliasProxyHandler(new Proxy(column.table, new TableAliasProxyHandler(tableAlias, false))));
}
function mapColumnsInAliasedSQLToAlias(query, alias) {
return new SQL.Aliased(mapColumnsInSQLToAlias(query.sql, alias), query.fieldAlias);
}
function mapColumnsInSQLToAlias(query, alias) {
return sql.join(query.queryChunks.map((c) => {
if (is(c, Column)) {
return aliasedTableColumn(c, alias);
}
if (is(c, SQL)) {
return mapColumnsInSQLToAlias(c, alias);
}
if (is(c, SQL.Aliased)) {
return mapColumnsInAliasedSQLToAlias(c, alias);
}
return c;
}));
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/errors.js
class DrizzleError extends Error {
static [entityKind] = "DrizzleError";
constructor({ message, cause }) {
super(message);
this.name = "DrizzleError";
this.cause = cause;
}
}
class DrizzleQueryError extends Error {
constructor(query, params, cause) {
super(`Failed query: ${query}
params: ${params}`);
this.query = query;
this.params = params;
this.cause = cause;
Error.captureStackTrace(this, DrizzleQueryError);
if (cause)
this.cause = cause;
}
}
class TransactionRollbackError extends DrizzleError {
static [entityKind] = "TransactionRollbackError";
constructor() {
super({ message: "Rollback" });
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/logger.js
class ConsoleLogWriter {
static [entityKind] = "ConsoleLogWriter";
write(message) {
console.log(message);
}
}
class DefaultLogger {
static [entityKind] = "DefaultLogger";
writer;
constructor(config) {
this.writer = config?.writer ?? new ConsoleLogWriter;
}
logQuery(query, params) {
const stringifiedParams = params.map((p) => {
try {
return JSON.stringify(p);
} catch {
return String(p);
}
});
const paramsStr = stringifiedParams.length ? ` -- params: [${stringifiedParams.join(", ")}]` : "";
this.writer.write(`Query: ${query}${paramsStr}`);
}
}
class NoopLogger {
static [entityKind] = "NoopLogger";
logQuery() {}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/query-promise.js
class QueryPromise {
static [entityKind] = "QueryPromise";
[Symbol.toStringTag] = "QueryPromise";
catch(onRejected) {
return this.then(undefined, onRejected);
}
finally(onFinally) {
return this.then((value) => {
onFinally?.();
return value;
}, (reason) => {
onFinally?.();
throw reason;
});
}
then(onFulfilled, onRejected) {
return this.execute().then(onFulfilled, onRejected);
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/utils.js
function mapResultRow(columns, row, joinsNotNullableMap) {
const nullifyMap = {};
const result = columns.reduce((result2, { path, field }, columnIndex) => {
let decoder;
if (is(field, Column)) {
decoder = field;
} else if (is(field, SQL)) {
decoder = field.decoder;
} else if (is(field, Subquery)) {
decoder = field._.sql.decoder;
} else {
decoder = field.sql.decoder;
}
let node = result2;
for (const [pathChunkIndex, pathChunk] of path.entries()) {
if (pathChunkIndex < path.length - 1) {
if (!(pathChunk in node)) {
node[pathChunk] = {};
}
node = node[pathChunk];
} else {
const rawValue = row[columnIndex];
const value = node[pathChunk] = rawValue === null ? null : decoder.mapFromDriverValue(rawValue);
if (joinsNotNullableMap && is(field, Column) && path.length === 2) {
const objectName = path[0];
if (!(objectName in nullifyMap)) {
nullifyMap[objectName] = value === null ? getTableName(field.table) : false;
} else if (typeof nullifyMap[objectName] === "string" && nullifyMap[objectName] !== getTableName(field.table)) {
nullifyMap[objectName] = false;
}
}
}
}
return result2;
}, {});
if (joinsNotNullableMap && Object.keys(nullifyMap).length > 0) {
for (const [objectName, tableName] of Object.entries(nullifyMap)) {
if (typeof tableName === "string" && !joinsNotNullableMap[tableName]) {
result[objectName] = null;
}
}
}
return result;
}
function orderSelectedFields(fields, pathPrefix) {
return Object.entries(fields).reduce((result, [name, field]) => {
if (typeof name !== "string") {
return result;
}
const newPath = pathPrefix ? [...pathPrefix, name] : [name];
if (is(field, Column) || is(field, SQL) || is(field, SQL.Aliased) || is(field, Subquery)) {
result.push({ path: newPath, field });
} else if (is(field, Table)) {
result.push(...orderSelectedFields(field[Table.Symbol.Columns], newPath));
} else {
result.push(...orderSelectedFields(field, newPath));
}
return result;
}, []);
}
function haveSameKeys(left, right) {
const leftKeys = Object.keys(left);
const rightKeys = Object.keys(right);
if (leftKeys.length !== rightKeys.length) {
return false;
}
for (const [index, key] of leftKeys.entries()) {
if (key !== rightKeys[index]) {
return false;
}
}
return true;
}
function mapUpdateSet(table, values) {
const entries = Object.entries(values).filter(([, value]) => value !== undefined).map(([key, value]) => {
if (is(value, SQL) || is(value, Column)) {
return [key, value];
} else {
return [key, new Param(value, table[Table.Symbol.Columns][key])];
}
});
if (entries.length === 0) {
throw new Error("No values to set");
}
return Object.fromEntries(entries);
}
function applyMixins(baseClass, extendedClasses) {
for (const extendedClass of extendedClasses) {
for (const name of Object.getOwnPropertyNames(extendedClass.prototype)) {
if (name === "constructor")
continue;
Object.defineProperty(baseClass.prototype, name, Object.getOwnPropertyDescriptor(extendedClass.prototype, name) || /* @__PURE__ */ Object.create(null));
}
}
}
function getTableColumns(table) {
return table[Table.Symbol.Columns];
}
function getTableLikeName(table) {
return is(table, Subquery) ? table._.alias : is(table, View) ? table[ViewBaseConfig].name : is(table, SQL) ? undefined : table[Table.Symbol.IsAlias] ? table[Table.Symbol.Name] : table[Table.Symbol.BaseName];
}
function getColumnNameAndConfig(a, b) {
return {
name: typeof a === "string" && a.length > 0 ? a : "",
config: typeof a === "object" ? a : b
};
}
var textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder;
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/pg-core/table.js
var InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
var EnableRLS = Symbol.for("drizzle:EnableRLS");
class PgTable extends Table {
static [entityKind] = "PgTable";
static Symbol = Object.assign({}, Table.Symbol, {
InlineForeignKeys,
EnableRLS
});
[InlineForeignKeys] = [];
[EnableRLS] = false;
[Table.Symbol.ExtraConfigBuilder] = undefined;
[Table.Symbol.ExtraConfigColumns] = {};
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/pg-core/primary-keys.js
class PrimaryKeyBuilder {
static [entityKind] = "PgPrimaryKeyBuilder";
columns;
name;
constructor(columns, name) {
this.columns = columns;
this.name = name;
}
build(table) {
return new PrimaryKey(table, this.columns, this.name);
}
}
class PrimaryKey {
constructor(table, columns, name) {
this.table = table;
this.columns = columns;
this.name = name;
}
static [entityKind] = "PgPrimaryKey";
columns;
name;
getName() {
return this.name ?? `${this.table[PgTable.Symbol.Name]}_${this.columns.map((column) => column.name).join("_")}_pk`;
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sql/expressions/conditions.js
function bindIfParam(value, column) {
if (isDriverValueEncoder(column) && !isSQLWrapper(value) && !is(value, Param) && !is(value, Placeholder) && !is(value, Column) && !is(value, Table) && !is(value, View)) {
return new Param(value, column);
}
return value;
}
var eq = (left, right) => {
return sql`${left} = ${bindIfParam(right, left)}`;
};
var ne = (left, right) => {
return sql`${left} <> ${bindIfParam(right, left)}`;
};
function and(...unfilteredConditions) {
const conditions = unfilteredConditions.filter((c) => c !== undefined);
if (conditions.length === 0) {
return;
}
if (conditions.length === 1) {
return new SQL(conditions);
}
return new SQL([
new StringChunk("("),
sql.join(conditions, new StringChunk(" and ")),
new StringChunk(")")
]);
}
function or(...unfilteredConditions) {
const conditions = unfilteredConditions.filter((c) => c !== undefined);
if (conditions.length === 0) {
return;
}
if (conditions.length === 1) {
return new SQL(conditions);
}
return new SQL([
new StringChunk("("),
sql.join(conditions, new StringChunk(" or ")),
new StringChunk(")")
]);
}
function not(condition) {
return sql`not ${condition}`;
}
var gt = (left, right) => {
return sql`${left} > ${bindIfParam(right, left)}`;
};
var gte = (left, right) => {
return sql`${left} >= ${bindIfParam(right, left)}`;
};
var lt = (left, right) => {
return sql`${left} < ${bindIfParam(right, left)}`;
};
var lte = (left, right) => {
return sql`${left} <= ${bindIfParam(right, left)}`;
};
function inArray(column, values) {
if (Array.isArray(values)) {
if (values.length === 0) {
return sql`false`;
}
return sql`${column} in ${values.map((v) => bindIfParam(v, column))}`;
}
return sql`${column} in ${bindIfParam(values, column)}`;
}
function notInArray(column, values) {
if (Array.isArray(values)) {
if (values.length === 0) {
return sql`true`;
}
return sql`${column} not in ${values.map((v) => bindIfParam(v, column))}`;
}
return sql`${column} not in ${bindIfParam(values, column)}`;
}
function isNull(value) {
return sql`${value} is null`;
}
function isNotNull(value) {
return sql`${value} is not null`;
}
function exists(subquery) {
return sql`exists ${subquery}`;
}
function notExists(subquery) {
return sql`not exists ${subquery}`;
}
function between(column, min, max) {
return sql`${column} between ${bindIfParam(min, column)} and ${bindIfParam(max, column)}`;
}
function notBetween(column, min, max) {
return sql`${column} not between ${bindIfParam(min, column)} and ${bindIfParam(max, column)}`;
}
function like(column, value) {
return sql`${column} like ${value}`;
}
function notLike(column, value) {
return sql`${column} not like ${value}`;
}
function ilike(column, value) {
return sql`${column} ilike ${value}`;
}
function notIlike(column, value) {
return sql`${column} not ilike ${value}`;
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sql/expressions/select.js
function asc(column) {
return sql`${column} asc`;
}
function desc(column) {
return sql`${column} desc`;
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/relations.js
class Relation {
constructor(sourceTable, referencedTable, relationName) {
this.sourceTable = sourceTable;
this.referencedTable = referencedTable;
this.relationName = relationName;
this.referencedTableName = referencedTable[Table.Symbol.Name];
}
static [entityKind] = "Relation";
referencedTableName;
fieldName;
}
class Relations {
constructor(table, config) {
this.table = table;
this.config = config;
}
static [entityKind] = "Relations";
}
class One extends Relation {
constructor(sourceTable, referencedTable, config, isNullable) {
super(sourceTable, referencedTable, config?.relationName);
this.config = config;
this.isNullable = isNullable;
}
static [entityKind] = "One";
withFieldName(fieldName) {
const relation = new One(this.sourceTable, this.referencedTable, this.config, this.isNullable);
relation.fieldName = fieldName;
return relation;
}
}
class Many extends Relation {
constructor(sourceTable, referencedTable, config) {
super(sourceTable, referencedTable, config?.relationName);
this.config = config;
}
static [entityKind] = "Many";
withFieldName(fieldName) {
const relation = new Many(this.sourceTable, this.referencedTable, this.config);
relation.fieldName = fieldName;
return relation;
}
}
function getOperators() {
return {
and,
between,
eq,
exists,
gt,
gte,
ilike,
inArray,
isNull,
isNotNull,
like,
lt,
lte,
ne,
not,
notBetween,
notExists,
notLike,
notIlike,
notInArray,
or,
sql
};
}
function getOrderByOperators() {
return {
sql,
asc,
desc
};
}
function extractTablesRelationalConfig(schema, configHelpers) {
if (Object.keys(schema).length === 1 && "default" in schema && !is(schema["default"], Table)) {
schema = schema["default"];
}
const tableNamesMap = {};
const relationsBuffer = {};
const tablesConfig = {};
for (const [key, value] of Object.entries(schema)) {
if (is(value, Table)) {
const dbName = getTableUniqueName(value);
const bufferedRelations = relationsBuffer[dbName];
tableNamesMap[dbName] = key;
tablesConfig[key] = {
tsName: key,
dbName: value[Table.Symbol.Name],
schema: value[Table.Symbol.Schema],
columns: value[Table.Symbol.Columns],
relations: bufferedRelations?.relations ?? {},
primaryKey: bufferedRelations?.primaryKey ?? []
};
for (const column of Object.values(value[Table.Symbol.Columns])) {
if (column.primary) {
tablesConfig[key].primaryKey.push(column);
}
}
const extraConfig = value[Table.Symbol.ExtraConfigBuilder]?.(value[Table.Symbol.ExtraConfigColumns]);
if (extraConfig) {
for (const configEntry of Object.values(extraConfig)) {
if (is(configEntry, PrimaryKeyBuilder)) {
tablesConfig[key].primaryKey.push(...configEntry.columns);
}
}
}
} else if (is(value, Relations)) {
const dbName = getTableUniqueName(value.table);
const tableName = tableNamesMap[dbName];
const relations2 = value.config(configHelpers(value.table));
let primaryKey;
for (const [relationName, relation] of Object.entries(relations2)) {
if (tableName) {
const tableConfig = tablesConfig[tableName];
tableConfig.relations[relationName] = relation;
if (primaryKey) {
tableConfig.primaryKey.push(...primaryKey);
}
} else {
if (!(dbName in relationsBuffer)) {
relationsBuffer[dbName] = {
relations: {},
primaryKey
};
}
relationsBuffer[dbName].relations[relationName] = relation;
}
}
}
}
return { tables: tablesConfig, tableNamesMap };
}
function createOne(sourceTable) {
return function one(table, config) {
return new One(sourceTable, table, config, config?.fields.reduce((res, f) => res && f.notNull, true) ?? false);
};
}
function createMany(sourceTable) {
return function many(referencedTable, config) {
return new Many(sourceTable, referencedTable, config);
};
}
function normalizeRelation(schema, tableNamesMap, relation) {
if (is(relation, One) && relation.config) {
return {
fields: relation.config.fields,
references: relation.config.references
};
}
const referencedTableTsName = tableNamesMap[getTableUniqueName(relation.referencedTable)];
if (!referencedTableTsName) {
throw new Error(`Table "${relation.referencedTable[Table.Symbol.Name]}" not found in schema`);
}
const referencedTableConfig = schema[referencedTableTsName];
if (!referencedTableConfig) {
throw new Error(`Table "${referencedTableTsName}" not found in schema`);
}
const sourceTable = relation.sourceTable;
const sourceTableTsName = tableNamesMap[getTableUniqueName(sourceTable)];
if (!sourceTableTsName) {
throw new Error(`Table "${sourceTable[Table.Symbol.Name]}" not found in schema`);
}
const reverseRelations = [];
for (const referencedTableRelation of Object.values(referencedTableConfig.relations)) {
if (relation.relationName && relation !== referencedTableRelation && referencedTableRelation.relationName === relation.relationName || !relation.relationName && referencedTableRelation.referencedTable === relation.sourceTable) {
reverseRelations.push(referencedTableRelation);
}
}
if (reverseRelations.length > 1) {
throw relation.relationName ? new Error(`There are multiple relations with name "${relation.relationName}" in table "${referencedTableTsName}"`) : new Error(`There are multiple relations between "${referencedTableTsName}" and "${relation.sourceTable[Table.Symbol.Name]}". Please specify relation name`);
}
if (reverseRelations[0] && is(reverseRelations[0], One) && reverseRelations[0].config) {
return {
fields: reverseRelations[0].config.references,
references: reverseRelations[0].config.fields
};
}
throw new Error(`There is not enough information to infer relation "${sourceTableTsName}.${relation.fieldName}"`);
}
function createTableRelationsHelpers(sourceTable) {
return {
one: createOne(sourceTable),
many: createMany(sourceTable)
};
}
function mapRelationalRow(tablesConfig, tableConfig, row, buildQueryResultSelection, mapColumnValue = (value) => value) {
const result = {};
for (const [
selectionItemIndex,
selectionItem
] of buildQueryResultSelection.entries()) {
if (selectionItem.isJson) {
const relation = tableConfig.relations[selectionItem.tsKey];
const rawSubRows = row[selectionItemIndex];
const subRows = typeof rawSubRows === "string" ? JSON.parse(rawSubRows) : rawSubRows;
result[selectionItem.tsKey] = is(relation, One) ? subRows && mapRelationalRow(tablesConfig, tablesConfig[selectionItem.relationTableTsKey], subRows, selectionItem.selection, mapColumnValue) : subRows.map((subRow) => mapRelationalRow(tablesConfig, tablesConfig[selectionItem.relationTableTsKey], subRow, selectionItem.selection, mapColumnValue));
} else {
const value = mapColumnValue(row[selectionItemIndex]);
const field = selectionItem.field;
let decoder;
if (is(field, Column)) {
decoder = field;
} else if (is(field, SQL)) {
decoder = field.decoder;
} else {
decoder = field.sql.decoder;
}
result[selectionItem.tsKey] = value === null ? null : decoder.mapFromDriverValue(value);
}
}
return result;
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sql/functions/aggregate.js
function count(expression) {
return sql`count(${expression || sql.raw("*")})`.mapWith(Number);
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/external.js
var exports_external = {};
__export(exports_external, {
xor: () => xor,
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,
slugify: () => _slugify,
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,
meta: () => meta2,
maxSize: () => _maxSize,
maxLength: () => _maxLength,
map: () => map,
mac: () => mac2,
lte: () => _lte,
lt: () => _lt,
lowercase: () => _lowercase,
looseRecord: () => looseRecord,
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,
invertCodec: () => invertCodec,
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,
fromJSONSchema: () => fromJSONSchema,
formatError: () => formatError,
float64: () => float64,
float32: () => float32,
flattenError: () => flattenError,
file: () => file,
exactOptional: () => exactOptional,
enum: () => _enum2,
endsWith: () => _endsWith,
encodeAsync: () => encodeAsync2,
encode: () => encode2,
emoji: () => emoji2,
email: () => email2,
e164: () => e1642,
discriminatedUnion: () => discriminatedUnion,
describe: () => describe2,
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,
ZodXor: () => ZodXor,
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,
ZodPreprocess: () => ZodPreprocess,
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,
ZodMAC: () => ZodMAC,
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,
ZodExactOptional: () => ZodExactOptional,
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/.bun/zod@4.4.3/node_modules/zod/v4/core/index.js
var exports_core2 = {};
__export(exports_core2, {
version: () => version2,
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,
process: () => process,
prettifyError: () => prettifyError,
parseAsync: () => parseAsync,
parse: () => parse,
meta: () => meta,
locales: () => exports_locales,
isValidJWT: () => isValidJWT,
isValidBase64URL: () => isValidBase64URL,
isValidBase64: () => isValidBase64,
initializeContext: () => initializeContext,
globalRegistry: () => globalRegistry,
globalConfig: () => globalConfig,
formatError: () => formatError,
flattenError: () => flattenError,
finalize: () => finalize,
extractDefs: () => extractDefs,
encodeAsync: () => encodeAsync,
encode: () => encode,
describe: () => describe,
decodeAsync: () => decodeAsync,
decode: () => decode,
createToJSONSchemaMethod: () => createToJSONSchemaMethod,
createStandardJSONSchemaMethod: () => createStandardJSONSchemaMethod,
config: () => config,
clone: () => clone,
_xor: () => _xor,
_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,
_slugify: () => _slugify,
_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,
_mac: () => _mac,
_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,
$ZodXor: () => $ZodXor,
$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,
$ZodPreprocess: () => $ZodPreprocess,
$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,
$ZodMAC: () => $ZodMAC,
$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,
$ZodExactOptional: () => $ZodExactOptional,
$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/.bun/zod@4.4.3/node_modules/zod/v4/core/core.js
var _a;
var NEVER = /* @__PURE__ */ Object.freeze({
status: "aborted"
});
function $constructor(name, initializer, params) {
function init(inst, def) {
if (!inst._zod) {
Object.defineProperty(inst, "_zod", {
value: {
def,
constr: _,
traits: new Set
},
enumerable: false
});
}
if (inst._zod.traits.has(name)) {
return;
}
inst._zod.traits.add(name);
initializer(inst, def);
const proto = _.prototype;
const keys = Object.keys(proto);
for (let i = 0;i < keys.length; i++) {
const k = keys[i];
if (!(k in inst)) {
inst[k] = proto[k].bind(inst);
}
}
}
const Parent = params?.Parent ?? Object;
class Definition extends Parent {
}
Object.defineProperty(Definition, "name", { value: name });
function _(def) {
var _a2;
const inst = params?.Parent ? new Definition : this;
init(inst, def);
(_a2 = inst._zod).deferred ?? (_a2.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";
}
}
(_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
var globalConfig = globalThis.__zod_globalConfig;
function config(newConfig) {
if (newConfig)
Object.assign(globalConfig, newConfig);
return globalConfig;
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/util.js
var exports_util = {};
__export(exports_util, {
unwrapMessage: () => unwrapMessage,
uint8ArrayToHex: () => uint8ArrayToHex,
uint8ArrayToBase64url: () => uint8ArrayToBase64url,
uint8ArrayToBase64: () => uint8ArrayToBase64,
stringifyPrimitive: () => stringifyPrimitive,
slugify: () => slugify,
shallowClone: () => shallowClone,
safeExtend: () => safeExtend,
required: () => required,
randomString: () => randomString,
propertyKeyTypes: () => propertyKeyTypes,
promiseAllObject: () => promiseAllObject,
primitiveTypes: () => primitiveTypes,
prefixIssues: () => prefixIssues,
pick: () => pick,
partial: () => partial,
parsedType: () => parsedType,
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,
explicitlyAborted: () => explicitlyAborted,
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("Unexpected value in exhaustive check");
}
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 ratio = val / step;
const roundedRatio = Math.round(ratio);
const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
if (Math.abs(ratio - roundedRatio) < tolerance)
return 0;
return ratio - roundedRatio;
}
var EVALUATING = /* @__PURE__ */ 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);
}
function slugify(input) {
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
}
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
function isObject(data) {
return typeof data === "object" && data !== null && !Array.isArray(data);
}
var allowsEval = /* @__PURE__ */ cached(() => {
if (globalConfig.jitless) {
return false;
}
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;
if (typeof ctor !== "function")
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];
if (o instanceof Map)
return new Map(o);
if (o instanceof Set)
return new Set(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 = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
var primitiveTypes = /* @__PURE__ */ 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 checks = currDef.checks;
const hasChecks = checks && checks.length > 0;
if (hasChecks) {
throw new Error(".pick() cannot be used on object schemas containing refinements");
}
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 checks = currDef.checks;
const hasChecks = checks && checks.length > 0;
if (hasChecks) {
throw new Error(".omit() cannot be used on object schemas containing refinements");
}
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) {
const existingShape = schema._zod.def.shape;
for (const key in shape) {
if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
}
}
}
const def = mergeDefs(schema._zod.def, {
get shape() {
const _shape = { ...schema._zod.def.shape, ...shape };
assignProp(this, "shape", _shape);
return _shape;
}
});
return clone(schema, def);
}
function safeExtend(schema, shape) {
if (!isPlainObject(shape)) {
throw new Error("Invalid input to safeExtend: expected a plain object");
}
const def = mergeDefs(schema._zod.def, {
get shape() {
const _shape = { ...schema._zod.def.shape, ...shape };
assignProp(this, "shape", _shape);
return _shape;
}
});
return clone(schema, def);
}
function merge(a, b) {
if (a._zod.def.checks?.length) {
throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
}
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: b._zod.def.checks ?? []
});
return clone(a, def);
}
function partial(Class, schema, mask) {
const currDef = schema._zod.def;
const checks = currDef.checks;
const hasChecks = checks && checks.length > 0;
if (hasChecks) {
throw new Error(".partial() cannot be used on object schemas containing refinements");
}
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;
}
});
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 explicitlyAborted(x, startIndex = 0) {
if (x.aborted === true)
return true;
for (let i = startIndex;i < x.issues.length; i++) {
if (x.issues[i]?.continue === false) {
return true;
}
}
return false;
}
function prefixIssues(path, issues) {
return issues.map((iss) => {
var _a2;
(_a2 = iss).path ?? (_a2.path = []);
iss.path.unshift(path);
return iss;
});
}
function unwrapMessage(message) {
return typeof message === "string" ? message : message?.message;
}
function finalizeIssue(iss, ctx, config2) {
const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
rest.path ?? (rest.path = []);
rest.message = message;
if (ctx?.reportInput) {
rest.input = _input;
}
return rest;
}
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 parsedType(data) {
const t = typeof data;
switch (t) {
case "number": {
return Number.isNaN(data) ? "nan" : "number";
}
case "object": {
if (data === null) {
return "null";
}
if (Array.isArray(data)) {
return "array";
}
const obj = data;
if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) {
return obj.constructor.name;
}
}
}
return t;
}
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/.bun/zod@4.4.3/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 = (issue2) => issue2.message) {
const fieldErrors = { _errors: [] };
const processError = (error2, path = []) => {
for (const issue2 of error2.issues) {
if (issue2.code === "invalid_union" && issue2.errors.length) {
issue2.errors.map((issues) => processError({ issues }, [...path, ...issue2.path]));
} else if (issue2.code === "invalid_key") {
processError({ issues: issue2.issues }, [...path, ...issue2.path]);
} else if (issue2.code === "invalid_element") {
processError({ issues: issue2.issues }, [...path, ...issue2.path]);
} else {
const fullpath = [...path, ...issue2.path];
if (fullpath.length === 0) {
fieldErrors._errors.push(mapper(issue2));
} else {
let curr = fieldErrors;
let i = 0;
while (i < fullpath.length) {
const el = fullpath[i];
const terminal = i === fullpath.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 = (issue2) => issue2.message) {
const result = { errors: [] };
const processError = (error2, path = []) => {
var _a2, _b;
for (const issue2 of error2.issues) {
if (issue2.code === "invalid_union" && issue2.errors.length) {
issue2.errors.map((issues) => processError({ issues }, [...path, ...issue2.path]));
} else if (issue2.code === "invalid_key") {
processError({ issues: issue2.issues }, [...path, ...issue2.path]);
} else if (issue2.code === "invalid_element") {
processError({ issues: issue2.issues }, [...path, ...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 = {});
(_a2 = curr.properties)[el] ?? (_a2[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/.bun/zod@4.4.3/node_modules/zod/v4/core/parse.js
var _parse = (_Err) => (schema, value, _ctx, _params) => {
const ctx = _ctx ? { ..._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 ? { ..._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 ? { ..._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 ? { ..._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 ? { ..._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 ? { ..._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 ? { ..._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/.bun/zod@4.4.3/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,
mac: () => mac,
lowercase: () => lowercase,
ksuid: () => ksuid,
ipv6: () => ipv6,
ipv4: () => ipv4,
integer: () => integer,
idnEmail: () => idnEmail,
httpProtocol: () => httpProtocol,
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][0-9a-z]{6,}$/;
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 = (version2) => {
if (!version2)
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}-${version2}[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 mac = (delimiter) => {
const escapedDelim = escapeRegex(delimiter ?? ":");
return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`);
};
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 httpProtocol = /^https?$/;
var e164 = /^\+[1-9]\d{6,14}$/;
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_hex = /^[0-9a-fA-F]{32}$/;
var md5_base64 = /* @__PURE__ */ fixedBase64(22, "==");
var md5_base64url = /* @__PURE__ */ fixedBase64url(22);
var sha1_hex = /^[0-9a-fA-F]{40}$/;
var sha1_base64 = /* @__PURE__ */ fixedBase64(27, "=");
var sha1_base64url = /* @__PURE__ */ fixedBase64url(27);
var sha256_hex = /^[0-9a-fA-F]{64}$/;
var sha256_base64 = /* @__PURE__ */ fixedBase64(43, "=");
var sha256_base64url = /* @__PURE__ */ fixedBase64url(43);
var sha384_hex = /^[0-9a-fA-F]{96}$/;
var sha384_base64 = /* @__PURE__ */ fixedBase64(64, "");
var sha384_base64url = /* @__PURE__ */ fixedBase64url(64);
var sha512_hex = /^[0-9a-fA-F]{128}$/;
var sha512_base64 = /* @__PURE__ */ fixedBase64(86, "==");
var sha512_base64url = /* @__PURE__ */ fixedBase64url(86);
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/checks.js
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
var _a2;
inst._zod ?? (inst._zod = {});
inst._zod.def = def;
(_a2 = inst._zod).onattach ?? (_a2.onattach = []);
});
var numericOriginMap = {
number: "number",
bigint: "bigint",
object: "date"
};
var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
$ZodCheck.init(inst, def);
const origin = numericOriginMap[typeof def.value];
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
if (def.value < curr) {
if (def.inclusive)
bag.maximum = def.value;
else
bag.exclusiveMaximum = def.value;
}
});
inst._zod.check = (payload) => {
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
return;
}
payload.issues.push({
origin,
code: "too_big",
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
input: payload.value,
inclusive: def.inclusive,
inst,
continue: !def.abort
});
};
});
var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
$ZodCheck.init(inst, def);
const origin = numericOriginMap[typeof def.value];
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
if (def.value > curr) {
if (def.inclusive)
bag.minimum = def.value;
else
bag.exclusiveMinimum = def.value;
}
});
inst._zod.check = (payload) => {
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
return;
}
payload.issues.push({
origin,
code: "too_small",
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
input: payload.value,
inclusive: def.inclusive,
inst,
continue: !def.abort
});
};
});
var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
$ZodCheck.init(inst, def);
inst._zod.onattach.push((inst2) => {
var _a2;
(_a2 = inst2._zod.bag).multipleOf ?? (_a2.multipleOf = def.value);
});
inst._zod.check = (payload) => {
if (typeof payload.value !== typeof def.value)
throw new Error("Cannot mix number and bigint in multiple_of check.");
const isMultiple = typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0;
if (isMultiple)
return;
payload.issues.push({
origin: typeof payload.value,
code: "not_multiple_of",
divisor: def.value,
input: payload.value,
inst,
continue: !def.abort
});
};
});
var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat", (inst, def) => {
$ZodCheck.init(inst, def);
def.format = def.format || "float64";
const isInt = def.format?.includes("int");
const origin = isInt ? "int" : "number";
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
bag.format = def.format;
bag.minimum = minimum;
bag.maximum = maximum;
if (isInt)
bag.pattern = integer;
});
inst._zod.check = (payload) => {
const input = payload.value;
if (isInt) {
if (!Number.isInteger(input)) {
payload.issues.push({
expected: origin,
format: def.format,
code: "invalid_type",
continue: false,
input,
inst
});
return;
}
if (!Number.isSafeInteger(input)) {
if (input > 0) {
payload.issues.push({
input,
code: "too_big",
maximum: Number.MAX_SAFE_INTEGER,
note: "Integers must be within the safe integer range.",
inst,
origin,
inclusive: true,
continue: !def.abort
});
} else {
payload.issues.push({
input,
code: "too_small",
minimum: Number.MIN_SAFE_INTEGER,
note: "Integers must be within the safe integer range.",
inst,
origin,
inclusive: true,
continue: !def.abort
});
}
return;
}
}
if (input < minimum) {
payload.issues.push({
origin: "number",
input,
code: "too_small",
minimum,
inclusive: true,
inst,
continue: !def.abort
});
}
if (input > maximum) {
payload.issues.push({
origin: "number",
input,
code: "too_big",
maximum,
inclusive: true,
inst,
continue: !def.abort
});
}
};
});
var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat", (inst, def) => {
$ZodCheck.init(inst, def);
const [minimum, maximum] = BIGINT_FORMAT_RANGES[def.format];
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
bag.format = def.format;
bag.minimum = minimum;
bag.maximum = maximum;
});
inst._zod.check = (payload) => {
const input = payload.value;
if (input < minimum) {
payload.issues.push({
origin: "bigint",
input,
code: "too_small",
minimum,
inclusive: true,
inst,
continue: !def.abort
});
}
if (input > maximum) {
payload.issues.push({
origin: "bigint",
input,
code: "too_big",
maximum,
inclusive: true,
inst,
continue: !def.abort
});
}
};
});
var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, def) => {
var _a2;
$ZodCheck.init(inst, def);
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
const val = payload.value;
return !nullish(val) && val.size !== undefined;
});
inst._zod.onattach.push((inst2) => {
const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
if (def.maximum < curr)
inst2._zod.bag.maximum = def.maximum;
});
inst._zod.check = (payload) => {
const input = payload.value;
const size = input.size;
if (size <= def.maximum)
return;
payload.issues.push({
origin: getSizableOrigin(input),
code: "too_big",
maximum: def.maximum,
inclusive: true,
input,
inst,
continue: !def.abort
});
};
});
var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, def) => {
var _a2;
$ZodCheck.init(inst, def);
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
const val = payload.value;
return !nullish(val) && val.size !== undefined;
});
inst._zod.onattach.push((inst2) => {
const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
if (def.minimum > curr)
inst2._zod.bag.minimum = def.minimum;
});
inst._zod.check = (payload) => {
const input = payload.value;
const size = input.size;
if (size >= def.minimum)
return;
payload.issues.push({
origin: getSizableOrigin(input),
code: "too_small",
minimum: def.minimum,
inclusive: true,
input,
inst,
continue: !def.abort
});
};
});
var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (inst, def) => {
var _a2;
$ZodCheck.init(inst, def);
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
const val = payload.value;
return !nullish(val) && val.size !== undefined;
});
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
bag.minimum = def.size;
bag.maximum = def.size;
bag.size = def.size;
});
inst._zod.check = (payload) => {
const input = payload.value;
const size = input.size;
if (size === def.size)
return;
const tooBig = size > def.size;
payload.issues.push({
origin: getSizableOrigin(input),
...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },
inclusive: true,
exact: true,
input: payload.value,
inst,
continue: !def.abort
});
};
});
var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
var _a2;
$ZodCheck.init(inst, def);
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
const val = payload.value;
return !nullish(val) && val.length !== undefined;
});
inst._zod.onattach.push((inst2) => {
const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
if (def.maximum < curr)
inst2._zod.bag.maximum = def.maximum;
});
inst._zod.check = (payload) => {
const input = payload.value;
const length = input.length;
if (length <= def.maximum)
return;
const origin = getLengthableOrigin(input);
payload.issues.push({
origin,
code: "too_big",
maximum: def.maximum,
inclusive: true,
input,
inst,
continue: !def.abort
});
};
});
var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
var _a2;
$ZodCheck.init(inst, def);
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
const val = payload.value;
return !nullish(val) && val.length !== undefined;
});
inst._zod.onattach.push((inst2) => {
const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
if (def.minimum > curr)
inst2._zod.bag.minimum = def.minimum;
});
inst._zod.check = (payload) => {
const input = payload.value;
const length = input.length;
if (length >= def.minimum)
return;
const origin = getLengthableOrigin(input);
payload.issues.push({
origin,
code: "too_small",
minimum: def.minimum,
inclusive: true,
input,
inst,
continue: !def.abort
});
};
});
var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
var _a2;
$ZodCheck.init(inst, def);
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
const val = payload.value;
return !nullish(val) && val.length !== undefined;
});
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
bag.minimum = def.length;
bag.maximum = def.length;
bag.length = def.length;
});
inst._zod.check = (payload) => {
const input = payload.value;
const length = input.length;
if (length === def.length)
return;
const origin = getLengthableOrigin(input);
const tooBig = length > def.length;
payload.issues.push({
origin,
...tooBig ? { code: "too_big", maximum: def.length } : { code: "too_small", minimum: def.length },
inclusive: true,
exact: true,
input: payload.value,
inst,
continue: !def.abort
});
};
});
var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
var _a2, _b;
$ZodCheck.init(inst, def);
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
bag.format = def.format;
if (def.pattern) {
bag.patterns ?? (bag.patterns = new Set);
bag.patterns.add(def.pattern);
}
});
if (def.pattern)
(_a2 = inst._zod).check ?? (_a2.check = (payload) => {
def.pattern.lastIndex = 0;
if (def.pattern.test(payload.value))
return;
payload.issues.push({
origin: "string",
code: "invalid_format",
format: def.format,
input: payload.value,
...def.pattern ? { pattern: def.pattern.toString() } : {},
inst,
continue: !def.abort
});
});
else
(_b = inst._zod).check ?? (_b.check = () => {});
});
var $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
$ZodCheckStringFormat.init(inst, def);
inst._zod.check = (payload) => {
def.pattern.lastIndex = 0;
if (def.pattern.test(payload.value))
return;
payload.issues.push({
origin: "string",
code: "invalid_format",
format: "regex",
input: payload.value,
pattern: def.pattern.toString(),
inst,
continue: !def.abort
});
};
});
var $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
def.pattern ?? (def.pattern = lowercase);
$ZodCheckStringFormat.init(inst, def);
});
var $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
def.pattern ?? (def.pattern = uppercase);
$ZodCheckStringFormat.init(inst, def);
});
var $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
$ZodCheck.init(inst, def);
const escapedRegex = escapeRegex(def.includes);
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
def.pattern = pattern;
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
bag.patterns ?? (bag.patterns = new Set);
bag.patterns.add(pattern);
});
inst._zod.check = (payload) => {
if (payload.value.includes(def.includes, def.position))
return;
payload.issues.push({
origin: "string",
code: "invalid_format",
format: "includes",
includes: def.includes,
input: payload.value,
inst,
continue: !def.abort
});
};
});
var $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
$ZodCheck.init(inst, def);
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
def.pattern ?? (def.pattern = pattern);
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
bag.patterns ?? (bag.patterns = new Set);
bag.patterns.add(pattern);
});
inst._zod.check = (payload) => {
if (payload.value.startsWith(def.prefix))
return;
payload.issues.push({
origin: "string",
code: "invalid_format",
format: "starts_with",
prefix: def.prefix,
input: payload.value,
inst,
continue: !def.abort
});
};
});
var $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
$ZodCheck.init(inst, def);
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
def.pattern ?? (def.pattern = pattern);
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
bag.patterns ?? (bag.patterns = new Set);
bag.patterns.add(pattern);
});
inst._zod.check = (payload) => {
if (payload.value.endsWith(def.suffix))
return;
payload.issues.push({
origin: "string",
code: "invalid_format",
format: "ends_with",
suffix: def.suffix,
input: payload.value,
inst,
continue: !def.abort
});
};
});
function handleCheckPropertyResult(result, payload, property) {
if (result.issues.length) {
payload.issues.push(...prefixIssues(property, result.issues));
}
}
var $ZodCheckProperty = /* @__PURE__ */ $constructor("$ZodCheckProperty", (inst, def) => {
$ZodCheck.init(inst, def);
inst._zod.check = (payload) => {
const result = def.schema._zod.run({
value: payload.value[def.property],
issues: []
}, {});
if (result instanceof Promise) {
return result.then((result2) => handleCheckPropertyResult(result2, payload, def.property));
}
handleCheckPropertyResult(result, payload, def.property);
return;
};
});
var $ZodCheckMimeType = /* @__PURE__ */ $constructor("$ZodCheckMimeType", (inst, def) => {
$ZodCheck.init(inst, def);
const mimeSet = new Set(def.mime);
inst._zod.onattach.push((inst2) => {
inst2._zod.bag.mime = def.mime;
});
inst._zod.check = (payload) => {
if (mimeSet.has(payload.value.type))
return;
payload.issues.push({
code: "invalid_value",
values: def.mime,
input: payload.value.type,
inst,
continue: !def.abort
});
};
});
var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
$ZodCheck.init(inst, def);
inst._zod.check = (payload) => {
payload.value = def.tx(payload.value);
};
});
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/doc.js
class Doc {
constructor(args = []) {
this.content = [];
this.indent = 0;
if (this)
this.args = args;
}
indented(fn) {
this.indent += 1;
fn(this);
this.indent -= 1;
}
write(arg) {
if (typeof arg === "function") {
arg(this, { execution: "sync" });
arg(this, { execution: "async" });
return;
}
const content = arg;
const lines = content.split(`
`).filter((x) => x);
const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
for (const line of dedented) {
this.content.push(line);
}
}
compile() {
const F = Function;
const args = this?.args;
const content = this?.content ?? [``];
const lines = [...content.map((x) => ` ${x}`)];
return new F(...args, lines.join(`
`));
}
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/versions.js
var version2 = {
major: 4,
minor: 4,
patch: 3
};
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/schemas.js
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
var _a2;
inst ?? (inst = {});
inst._zod.def = def;
inst._zod.bag = inst._zod.bag || {};
inst._zod.version = version2;
const checks = [...inst._zod.def.checks ?? []];
if (inst._zod.traits.has("$ZodCheck")) {
checks.unshift(inst);
}
for (const ch of checks) {
for (const fn of ch._zod.onattach) {
fn(inst);
}
}
if (checks.length === 0) {
(_a2 = inst._zod).deferred ?? (_a2.deferred = []);
inst._zod.deferred?.push(() => {
inst._zod.run = inst._zod.parse;
});
} else {
const runChecks = (payload, checks2, ctx) => {
let isAborted = aborted(payload);
let asyncResult;
for (const ch of checks2) {
if (ch._zod.def.when) {
if (explicitlyAborted(payload))
continue;
const shouldRun = ch._zod.def.when(payload);
if (!shouldRun)
continue;
} else if (isAborted) {
continue;
}
const currLen = payload.issues.length;
const _ = ch._zod.check(payload);
if (_ instanceof Promise && ctx?.async === false) {
throw new $ZodAsyncError;
}
if (asyncResult || _ instanceof Promise) {
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
await _;
const nextLen = payload.issues.length;
if (nextLen === currLen)
return;
if (!isAborted)
isAborted = aborted(payload, currLen);
});
} else {
const nextLen = payload.issues.length;
if (nextLen === currLen)
continue;
if (!isAborted)
isAborted = aborted(payload, currLen);
}
}
if (asyncResult) {
return asyncResult.then(() => {
return payload;
});
}
return payload;
};
const handleCanaryResult = (canary, payload, ctx) => {
if (aborted(canary)) {
canary.aborted = true;
return canary;
}
const checkResult = runChecks(payload, checks, ctx);
if (checkResult instanceof Promise) {
if (ctx.async === false)
throw new $ZodAsyncError;
return checkResult.then((checkResult2) => inst._zod.parse(checkResult2, ctx));
}
return inst._zod.parse(checkResult, ctx);
};
inst._zod.run = (payload, ctx) => {
if (ctx.skipChecks) {
return inst._zod.parse(payload, ctx);
}
if (ctx.direction === "backward") {
const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
if (canary instanceof Promise) {
return canary.then((canary2) => {
return handleCanaryResult(canary2, payload, ctx);
});
}
return handleCanaryResult(canary, payload, ctx);
}
const result = inst._zod.parse(payload, ctx);
if (result instanceof Promise) {
if (ctx.async === false)
throw new $ZodAsyncError;
return result.then((result2) => runChecks(result2, checks, ctx));
}
return runChecks(result, checks, ctx);
};
}
defineLazy(inst, "~standard", () => ({
validate: (value) => {
try {
const r = safeParse(inst, value);
return r.success ? { value: r.data } : { issues: r.error?.issues };
} catch (_) {
return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
}
},
vendor: "zod",
version: 1
}));
});
var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
inst._zod.parse = (payload, _) => {
if (def.coerce)
try {
payload.value = String(payload.value);
} catch (_2) {}
if (typeof payload.value === "string")
return payload;
payload.issues.push({
expected: "string",
code: "invalid_type",
input: payload.value,
inst
});
return payload;
};
});
var $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
$ZodCheckStringFormat.init(inst, def);
$ZodString.init(inst, def);
});
var $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
def.pattern ?? (def.pattern = guid);
$ZodStringFormat.init(inst, def);
});
var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
if (def.version) {
const versionMap = {
v1: 1,
v2: 2,
v3: 3,
v4: 4,
v5: 5,
v6: 6,
v7: 7,
v8: 8
};
const v = versionMap[def.version];
if (v === undefined)
throw new Error(`Invalid UUID version: "${def.version}"`);
def.pattern ?? (def.pattern = uuid(v));
} else
def.pattern ?? (def.pattern = uuid());
$ZodStringFormat.init(inst, def);
});
var $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
def.pattern ?? (def.pattern = email);
$ZodStringFormat.init(inst, def);
});
var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
$ZodStringFormat.init(inst, def);
inst._zod.check = (payload) => {
try {
const trimmed = payload.value.trim();
if (!def.normalize && def.protocol?.source === httpProtocol.source) {
if (!/^https?:\/\//i.test(trimmed)) {
payload.issues.push({
code: "invalid_format",
format: "url",
note: "Invalid URL format",
input: payload.value,
inst,
continue: !def.abort
});
return;
}
}
const url = new URL(trimmed);
if (def.hostname) {
def.hostname.lastIndex = 0;
if (!def.hostname.test(url.hostname)) {
payload.issues.push({
code: "invalid_format",
format: "url",
note: "Invalid hostname",
pattern: def.hostname.source,
input: payload.value,
inst,
continue: !def.abort
});
}
}
if (def.protocol) {
def.protocol.lastIndex = 0;
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
payload.issues.push({
code: "invalid_format",
format: "url",
note: "Invalid protocol",
pattern: def.protocol.source,
input: payload.value,
inst,
continue: !def.abort
});
}
}
if (def.normalize) {
payload.value = url.href;
} else {
payload.value = trimmed;
}
return;
} catch (_) {
payload.issues.push({
code: "invalid_format",
format: "url",
input: payload.value,
inst,
continue: !def.abort
});
}
};
});
var $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
def.pattern ?? (def.pattern = emoji());
$ZodStringFormat.init(inst, def);
});
var $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
def.pattern ?? (def.pattern = nanoid);
$ZodStringFormat.init(inst, def);
});
var $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
def.pattern ?? (def.pattern = cuid);
$ZodStringFormat.init(inst, def);
});
var $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
def.pattern ?? (def.pattern = cuid2);
$ZodStringFormat.init(inst, def);
});
var $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
def.pattern ?? (def.pattern = ulid);
$ZodStringFormat.init(inst, def);
});
var $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
def.pattern ?? (def.pattern = xid);
$ZodStringFormat.init(inst, def);
});
var $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
def.pattern ?? (def.pattern = ksuid);
$ZodStringFormat.init(inst, def);
});
var $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
def.pattern ?? (def.pattern = datetime(def));
$ZodStringFormat.init(inst, def);
});
var $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
def.pattern ?? (def.pattern = date);
$ZodStringFormat.init(inst, def);
});
var $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
def.pattern ?? (def.pattern = time(def));
$ZodStringFormat.init(inst, def);
});
var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
def.pattern ?? (def.pattern = duration);
$ZodStringFormat.init(inst, def);
});
var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
def.pattern ?? (def.pattern = ipv4);
$ZodStringFormat.init(inst, def);
inst._zod.bag.format = `ipv4`;
});
var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
def.pattern ?? (def.pattern = ipv6);
$ZodStringFormat.init(inst, def);
inst._zod.bag.format = `ipv6`;
inst._zod.check = (payload) => {
try {
new URL(`http://[${payload.value}]`);
} catch {
payload.issues.push({
code: "invalid_format",
format: "ipv6",
input: payload.value,
inst,
continue: !def.abort
});
}
};
});
var $ZodMAC = /* @__PURE__ */ $constructor("$ZodMAC", (inst, def) => {
def.pattern ?? (def.pattern = mac(def.delimiter));
$ZodStringFormat.init(inst, def);
inst._zod.bag.format = `mac`;
});
var $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
def.pattern ?? (def.pattern = cidrv4);
$ZodStringFormat.init(inst, def);
});
var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
def.pattern ?? (def.pattern = cidrv6);
$ZodStringFormat.init(inst, def);
inst._zod.check = (payload) => {
const parts = payload.value.split("/");
try {
if (parts.length !== 2)
throw new Error;
const [address, prefix] = parts;
if (!prefix)
throw new Error;
const prefixNum = Number(prefix);
if (`${prefixNum}` !== prefix)
throw new Error;
if (prefixNum < 0 || prefixNum > 128)
throw new Error;
new URL(`http://[${address}]`);
} catch {
payload.issues.push({
code: "invalid_format",
format: "cidrv6",
input: payload.value,
inst,
continue: !def.abort
});
}
};
});
function isValidBase64(data) {
if (data === "")
return true;
if (/\s/.test(data))
return false;
if (data.length % 4 !== 0)
return false;
try {
atob(data);
return true;
} catch {
return false;
}
}
var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
def.pattern ?? (def.pattern = base64);
$ZodStringFormat.init(inst, def);
inst._zod.bag.contentEncoding = "base64";
inst._zod.check = (payload) => {
if (isValidBase64(payload.value))
return;
payload.issues.push({
code: "invalid_format",
format: "base64",
input: payload.value,
inst,
continue: !def.abort
});
};
});
function isValidBase64URL(data) {
if (!base64url.test(data))
return false;
const base642 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
const padded = base642.padEnd(Math.ceil(base642.length / 4) * 4, "=");
return isValidBase64(padded);
}
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
def.pattern ?? (def.pattern = base64url);
$ZodStringFormat.init(inst, def);
inst._zod.bag.contentEncoding = "base64url";
inst._zod.check = (payload) => {
if (isValidBase64URL(payload.value))
return;
payload.issues.push({
code: "invalid_format",
format: "base64url",
input: payload.value,
inst,
continue: !def.abort
});
};
});
var $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
def.pattern ?? (def.pattern = e164);
$ZodStringFormat.init(inst, def);
});
function isValidJWT(token, algorithm = null) {
try {
const tokensParts = token.split(".");
if (tokensParts.length !== 3)
return false;
const [header] = tokensParts;
if (!header)
return false;
const parsedHeader = JSON.parse(atob(header));
if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
return false;
if (!parsedHeader.alg)
return false;
if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm))
return false;
return true;
} catch {
return false;
}
}
var $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
$ZodStringFormat.init(inst, def);
inst._zod.check = (payload) => {
if (isValidJWT(payload.value, def.alg))
return;
payload.issues.push({
code: "invalid_format",
format: "jwt",
input: payload.value,
inst,
continue: !def.abort
});
};
});
var $ZodCustomStringFormat = /* @__PURE__ */ $constructor("$ZodCustomStringFormat", (inst, def) => {
$ZodStringFormat.init(inst, def);
inst._zod.check = (payload) => {
if (def.fn(payload.value))
return;
payload.issues.push({
code: "invalid_format",
format: def.format,
input: payload.value,
inst,
continue: !def.abort
});
};
});
var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.pattern = inst._zod.bag.pattern ?? number;
inst._zod.parse = (payload, _ctx) => {
if (def.coerce)
try {
payload.value = Number(payload.value);
} catch (_) {}
const input = payload.value;
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
return payload;
}
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : undefined : undefined;
payload.issues.push({
expected: "number",
code: "invalid_type",
input,
inst,
...received ? { received } : {}
});
return payload;
};
});
var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
$ZodCheckNumberFormat.init(inst, def);
$ZodNumber.init(inst, def);
});
var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.pattern = boolean;
inst._zod.parse = (payload, _ctx) => {
if (def.coerce)
try {
payload.value = Boolean(payload.value);
} catch (_) {}
const input = payload.value;
if (typeof input === "boolean")
return payload;
payload.issues.push({
expected: "boolean",
code: "invalid_type",
input,
inst
});
return payload;
};
});
var $ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.pattern = bigint;
inst._zod.parse = (payload, _ctx) => {
if (def.coerce)
try {
payload.value = BigInt(payload.value);
} catch (_) {}
if (typeof payload.value === "bigint")
return payload;
payload.issues.push({
expected: "bigint",
code: "invalid_type",
input: payload.value,
inst
});
return payload;
};
});
var $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigIntFormat", (inst, def) => {
$ZodCheckBigIntFormat.init(inst, def);
$ZodBigInt.init(inst, def);
});
var $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, _ctx) => {
const input = payload.value;
if (typeof input === "symbol")
return payload;
payload.issues.push({
expected: "symbol",
code: "invalid_type",
input,
inst
});
return payload;
};
});
var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.pattern = _undefined;
inst._zod.values = new Set([undefined]);
inst._zod.parse = (payload, _ctx) => {
const input = payload.value;
if (typeof input === "undefined")
return payload;
payload.issues.push({
expected: "undefined",
code: "invalid_type",
input,
inst
});
return payload;
};
});
var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.pattern = _null;
inst._zod.values = new Set([null]);
inst._zod.parse = (payload, _ctx) => {
const input = payload.value;
if (input === null)
return payload;
payload.issues.push({
expected: "null",
code: "invalid_type",
input,
inst
});
return payload;
};
});
var $ZodAny = /* @__PURE__ */ $constructor("$ZodAny", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload) => payload;
});
var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload) => payload;
});
var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, _ctx) => {
payload.issues.push({
expected: "never",
code: "invalid_type",
input: payload.value,
inst
});
return payload;
};
});
var $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, _ctx) => {
const input = payload.value;
if (typeof input === "undefined")
return payload;
payload.issues.push({
expected: "void",
code: "invalid_type",
input,
inst
});
return payload;
};
});
var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, _ctx) => {
if (def.coerce) {
try {
payload.value = new Date(payload.value);
} catch (_err) {}
}
const input = payload.value;
const isDate = input instanceof Date;
const isValidDate = isDate && !Number.isNaN(input.getTime());
if (isValidDate)
return payload;
payload.issues.push({
expected: "date",
code: "invalid_type",
input,
...isDate ? { received: "Invalid Date" } : {},
inst
});
return payload;
};
});
function handleArrayResult(result, final, index) {
if (result.issues.length) {
final.issues.push(...prefixIssues(index, result.issues));
}
final.value[index] = result.value;
}
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, ctx) => {
const input = payload.value;
if (!Array.isArray(input)) {
payload.issues.push({
expected: "array",
code: "invalid_type",
input,
inst
});
return payload;
}
payload.value = Array(input.length);
const proms = [];
for (let i = 0;i < input.length; i++) {
const item = input[i];
const result = def.element._zod.run({
value: item,
issues: []
}, ctx);
if (result instanceof Promise) {
proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
} else {
handleArrayResult(result, payload, i);
}
}
if (proms.length) {
return Promise.all(proms).then(() => payload);
}
return payload;
};
});
function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
const isPresent = key in input;
if (result.issues.length) {
if (isOptionalIn && isOptionalOut && !isPresent) {
return;
}
final.issues.push(...prefixIssues(key, result.issues));
}
if (!isPresent && !isOptionalIn) {
if (!result.issues.length) {
final.issues.push({
code: "invalid_type",
expected: "nonoptional",
input: undefined,
path: [key]
});
}
return;
}
if (result.value === undefined) {
if (isPresent) {
final.value[key] = undefined;
}
} else {
final.value[key] = result.value;
}
}
function normalizeDef(def) {
const keys = Object.keys(def.shape);
for (const k of keys) {
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
}
}
const okeys = optionalKeys(def.shape);
return {
...def,
keys,
keySet: new Set(keys),
numKeys: keys.length,
optionalKeys: new Set(okeys)
};
}
function handleCatchall(proms, input, payload, ctx, def, inst) {
const unrecognized = [];
const keySet = def.keySet;
const _catchall = def.catchall._zod;
const t = _catchall.def.type;
const isOptionalIn = _catchall.optin === "optional";
const isOptionalOut = _catchall.optout === "optional";
for (const key in input) {
if (key === "__proto__")
continue;
if (keySet.has(key))
continue;
if (t === "never") {
unrecognized.push(key);
continue;
}
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
if (r instanceof Promise) {
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
} else {
handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
}
}
if (unrecognized.length) {
payload.issues.push({
code: "unrecognized_keys",
keys: unrecognized,
input,
inst
});
}
if (!proms.length)
return payload;
return Promise.all(proms).then(() => {
return payload;
});
}
var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
$ZodType.init(inst, def);
const desc2 = Object.getOwnPropertyDescriptor(def, "shape");
if (!desc2?.get) {
const sh = def.shape;
Object.defineProperty(def, "shape", {
get: () => {
const newSh = { ...sh };
Object.defineProperty(def, "shape", {
value: newSh
});
return newSh;
}
});
}
const _normalized = cached(() => normalizeDef(def));
defineLazy(inst._zod, "propValues", () => {
const shape = def.shape;
const propValues = {};
for (const key in shape) {
const field = shape[key]._zod;
if (field.values) {
propValues[key] ?? (propValues[key] = new Set);
for (const v of field.values)
propValues[key].add(v);
}
}
return propValues;
});
const isObject2 = isObject;
const catchall = def.catchall;
let value;
inst._zod.parse = (payload, ctx) => {
value ?? (value = _normalized.value);
const input = payload.value;
if (!isObject2(input)) {
payload.issues.push({
expected: "object",
code: "invalid_type",
input,
inst
});
return payload;
}
payload.value = {};
const proms = [];
const shape = value.shape;
for (const key of value.keys) {
const el = shape[key];
const isOptionalIn = el._zod.optin === "optional";
const isOptionalOut = el._zod.optout === "optional";
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
if (r instanceof Promise) {
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
} else {
handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
}
}
if (!catchall) {
return proms.length ? Promise.all(proms).then(() => payload) : payload;
}
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
};
});
var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
$ZodObject.init(inst, def);
const superParse = inst._zod.parse;
const _normalized = cached(() => normalizeDef(def));
const generateFastpass = (shape) => {
const doc = new Doc(["shape", "payload", "ctx"]);
const normalized = _normalized.value;
const parseStr = (key) => {
const k = esc(key);
return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
};
doc.write(`const input = payload.value;`);
const ids = Object.create(null);
let counter = 0;
for (const key of normalized.keys) {
ids[key] = `key_${counter++}`;
}
doc.write(`const newResult = {};`);
for (const key of normalized.keys) {
const id = ids[key];
const k = esc(key);
const schema = shape[key];
const isOptionalIn = schema?._zod?.optin === "optional";
const isOptionalOut = schema?._zod?.optout === "optional";
doc.write(`const ${id} = ${parseStr(key)};`);
if (isOptionalIn && isOptionalOut) {
doc.write(`
if (${id}.issues.length) {
if (${k} in input) {
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
...iss,
path: iss.path ? [${k}, ...iss.path] : [${k}]
})));
}
}
if (${id}.value === undefined) {
if (${k} in input) {
newResult[${k}] = undefined;
}
} else {
newResult[${k}] = ${id}.value;
}
`);
} else if (!isOptionalIn) {
doc.write(`
const ${id}_present = ${k} in input;
if (${id}.issues.length) {
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
...iss,
path: iss.path ? [${k}, ...iss.path] : [${k}]
})));
}
if (!${id}_present && !${id}.issues.length) {
payload.issues.push({
code: "invalid_type",
expected: "nonoptional",
input: undefined,
path: [${k}]
});
}
if (${id}_present) {
if (${id}.value === undefined) {
newResult[${k}] = undefined;
} else {
newResult[${k}] = ${id}.value;
}
}
`);
} else {
doc.write(`
if (${id}.issues.length) {
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
...iss,
path: iss.path ? [${k}, ...iss.path] : [${k}]
})));
}
if (${id}.value === undefined) {
if (${k} in input) {
newResult[${k}] = undefined;
}
} else {
newResult[${k}] = ${id}.value;
}
`);
}
}
doc.write(`payload.value = newResult;`);
doc.write(`return payload;`);
const fn = doc.compile();
return (payload, ctx) => fn(shape, payload, ctx);
};
let fastpass;
const isObject2 = isObject;
const jit = !globalConfig.jitless;
const allowsEval2 = allowsEval;
const fastEnabled = jit && allowsEval2.value;
const catchall = def.catchall;
let value;
inst._zod.parse = (payload, ctx) => {
value ?? (value = _normalized.value);
const input = payload.value;
if (!isObject2(input)) {
payload.issues.push({
expected: "object",
code: "invalid_type",
input,
inst
});
return payload;
}
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
if (!fastpass)
fastpass = generateFastpass(def.shape);
payload = fastpass(payload, ctx);
if (!catchall)
return payload;
return handleCatchall([], input, payload, ctx, value, inst);
}
return superParse(payload, ctx);
};
});
function handleUnionResults(results, final, inst, ctx) {
for (const result of results) {
if (result.issues.length === 0) {
final.value = result.value;
return final;
}
}
const nonaborted = results.filter((r) => !aborted(r));
if (nonaborted.length === 1) {
final.value = nonaborted[0].value;
return nonaborted[0];
}
final.issues.push({
code: "invalid_union",
input: final.value,
inst,
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
});
return final;
}
var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
$ZodType.init(inst, def);
defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : undefined);
defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined);
defineLazy(inst._zod, "values", () => {
if (def.options.every((o) => o._zod.values)) {
return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
}
return;
});
defineLazy(inst._zod, "pattern", () => {
if (def.options.every((o) => o._zod.pattern)) {
const patterns = def.options.map((o) => o._zod.pattern);
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
}
return;
});
const first = def.options.length === 1 ? def.options[0]._zod.run : null;
inst._zod.parse = (payload, ctx) => {
if (first) {
return first(payload, ctx);
}
let async = false;
const results = [];
for (const option of def.options) {
const result = option._zod.run({
value: payload.value,
issues: []
}, ctx);
if (result instanceof Promise) {
results.push(result);
async = true;
} else {
if (result.issues.length === 0)
return result;
results.push(result);
}
}
if (!async)
return handleUnionResults(results, payload, inst, ctx);
return Promise.all(results).then((results2) => {
return handleUnionResults(results2, payload, inst, ctx);
});
};
});
function handleExclusiveUnionResults(results, final, inst, ctx) {
const successes = results.filter((r) => r.issues.length === 0);
if (successes.length === 1) {
final.value = successes[0].value;
return final;
}
if (successes.length === 0) {
final.issues.push({
code: "invalid_union",
input: final.value,
inst,
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
});
} else {
final.issues.push({
code: "invalid_union",
input: final.value,
inst,
errors: [],
inclusive: false
});
}
return final;
}
var $ZodXor = /* @__PURE__ */ $constructor("$ZodXor", (inst, def) => {
$ZodUnion.init(inst, def);
def.inclusive = false;
const first = def.options.length === 1 ? def.options[0]._zod.run : null;
inst._zod.parse = (payload, ctx) => {
if (first) {
return first(payload, ctx);
}
let async = false;
const results = [];
for (const option of def.options) {
const result = option._zod.run({
value: payload.value,
issues: []
}, ctx);
if (result instanceof Promise) {
results.push(result);
async = true;
} else {
results.push(result);
}
}
if (!async)
return handleExclusiveUnionResults(results, payload, inst, ctx);
return Promise.all(results).then((results2) => {
return handleExclusiveUnionResults(results2, payload, inst, ctx);
});
};
});
var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
def.inclusive = false;
$ZodUnion.init(inst, def);
const _super = inst._zod.parse;
defineLazy(inst._zod, "propValues", () => {
const propValues = {};
for (const option of def.options) {
const pv = option._zod.propValues;
if (!pv || Object.keys(pv).length === 0)
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
for (const [k, v] of Object.entries(pv)) {
if (!propValues[k])
propValues[k] = new Set;
for (const val of v) {
propValues[k].add(val);
}
}
}
return propValues;
});
const disc = cached(() => {
const opts = def.options;
const map = new Map;
for (const o of opts) {
const values = o._zod.propValues?.[def.discriminator];
if (!values || values.size === 0)
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
for (const v of values) {
if (map.has(v)) {
throw new Error(`Duplicate discriminator value "${String(v)}"`);
}
map.set(v, o);
}
}
return map;
});
inst._zod.parse = (payload, ctx) => {
const input = payload.value;
if (!isObject(input)) {
payload.issues.push({
code: "invalid_type",
expected: "object",
input,
inst
});
return payload;
}
const opt = disc.value.get(input?.[def.discriminator]);
if (opt) {
return opt._zod.run(payload, ctx);
}
if (def.unionFallback || ctx.direction === "backward") {
return _super(payload, ctx);
}
payload.issues.push({
code: "invalid_union",
errors: [],
note: "No matching discriminator",
discriminator: def.discriminator,
options: Array.from(disc.value.keys()),
input,
path: [def.discriminator],
inst
});
return payload;
};
});
var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, ctx) => {
const input = payload.value;
const left = def.left._zod.run({ value: input, issues: [] }, ctx);
const right = def.right._zod.run({ value: input, issues: [] }, ctx);
const async = left instanceof Promise || right instanceof Promise;
if (async) {
return Promise.all([left, right]).then(([left2, right2]) => {
return handleIntersectionResults(payload, left2, right2);
});
}
return handleIntersectionResults(payload, left, right);
};
});
function mergeValues(a, b) {
if (a === b) {
return { valid: true, data: a };
}
if (a instanceof Date && b instanceof Date && +a === +b) {
return { valid: true, data: a };
}
if (isPlainObject(a) && isPlainObject(b)) {
const bKeys = Object.keys(b);
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
const newObj = { ...a, ...b };
for (const key of sharedKeys) {
const sharedValue = mergeValues(a[key], b[key]);
if (!sharedValue.valid) {
return {
valid: false,
mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
};
}
newObj[key] = sharedValue.data;
}
return { valid: true, data: newObj };
}
if (Array.isArray(a) && Array.isArray(b)) {
if (a.length !== b.length) {
return { valid: false, mergeErrorPath: [] };
}
const newArray = [];
for (let index = 0;index < a.length; index++) {
const itemA = a[index];
const itemB = b[index];
const sharedValue = mergeValues(itemA, itemB);
if (!sharedValue.valid) {
return {
valid: false,
mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
};
}
newArray.push(sharedValue.data);
}
return { valid: true, data: newArray };
}
return { valid: false, mergeErrorPath: [] };
}
function handleIntersectionResults(result, left, right) {
const unrecKeys = new Map;
let unrecIssue;
for (const iss of left.issues) {
if (iss.code === "unrecognized_keys") {
unrecIssue ?? (unrecIssue = iss);
for (const k of iss.keys) {
if (!unrecKeys.has(k))
unrecKeys.set(k, {});
unrecKeys.get(k).l = true;
}
} else {
result.issues.push(iss);
}
}
for (const iss of right.issues) {
if (iss.code === "unrecognized_keys") {
for (const k of iss.keys) {
if (!unrecKeys.has(k))
unrecKeys.set(k, {});
unrecKeys.get(k).r = true;
}
} else {
result.issues.push(iss);
}
}
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
if (bothKeys.length && unrecIssue) {
result.issues.push({ ...unrecIssue, keys: bothKeys });
}
if (aborted(result))
return result;
const merged = mergeValues(left.value, right.value);
if (!merged.valid) {
throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
}
result.value = merged.data;
return result;
}
var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
$ZodType.init(inst, def);
const items = def.items;
inst._zod.parse = (payload, ctx) => {
const input = payload.value;
if (!Array.isArray(input)) {
payload.issues.push({
input,
inst,
expected: "tuple",
code: "invalid_type"
});
return payload;
}
payload.value = [];
const proms = [];
const optinStart = getTupleOptStart(items, "optin");
const optoutStart = getTupleOptStart(items, "optout");
if (!def.rest) {
if (input.length < optinStart) {
payload.issues.push({
code: "too_small",
minimum: optinStart,
inclusive: true,
input,
inst,
origin: "array"
});
return payload;
}
if (input.length > items.length) {
payload.issues.push({
code: "too_big",
maximum: items.length,
inclusive: true,
input,
inst,
origin: "array"
});
}
}
const itemResults = new Array(items.length);
for (let i = 0;i < items.length; i++) {
const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
if (r instanceof Promise) {
proms.push(r.then((rr) => {
itemResults[i] = rr;
}));
} else {
itemResults[i] = r;
}
}
if (def.rest) {
let i = items.length - 1;
const rest = input.slice(items.length);
for (const el of rest) {
i++;
const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
if (result instanceof Promise) {
proms.push(result.then((r) => handleTupleResult(r, payload, i)));
} else {
handleTupleResult(result, payload, i);
}
}
}
if (proms.length) {
return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));
}
return handleTupleResults(itemResults, payload, items, input, optoutStart);
};
});
function getTupleOptStart(items, key) {
for (let i = items.length - 1;i >= 0; i--) {
if (items[i]._zod[key] !== "optional")
return i + 1;
}
return 0;
}
function handleTupleResult(result, final, index) {
if (result.issues.length) {
final.issues.push(...prefixIssues(index, result.issues));
}
final.value[index] = result.value;
}
function handleTupleResults(itemResults, final, items, input, optoutStart) {
for (let i = 0;i < items.length; i++) {
const r = itemResults[i];
const isPresent = i < input.length;
if (r.issues.length) {
if (!isPresent && i >= optoutStart) {
final.value.length = i;
break;
}
final.issues.push(...prefixIssues(i, r.issues));
}
final.value[i] = r.value;
}
for (let i = final.value.length - 1;i >= input.length; i--) {
if (items[i]._zod.optout === "optional" && final.value[i] === undefined) {
final.value.length = i;
} else {
break;
}
}
return final;
}
var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, ctx) => {
const input = payload.value;
if (!isPlainObject(input)) {
payload.issues.push({
expected: "record",
code: "invalid_type",
input,
inst
});
return payload;
}
const proms = [];
const values = def.keyType._zod.values;
if (values) {
payload.value = {};
const recordKeys = new Set;
for (const key of values) {
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
recordKeys.add(typeof key === "number" ? key.toString() : key);
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
if (keyResult instanceof Promise) {
throw new Error("Async schemas not supported in object keys currently");
}
if (keyResult.issues.length) {
payload.issues.push({
code: "invalid_key",
origin: "record",
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
input: key,
path: [key],
inst
});
continue;
}
const outKey = keyResult.value;
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
if (result instanceof Promise) {
proms.push(result.then((result2) => {
if (result2.issues.length) {
payload.issues.push(...prefixIssues(key, result2.issues));
}
payload.value[outKey] = result2.value;
}));
} else {
if (result.issues.length) {
payload.issues.push(...prefixIssues(key, result.issues));
}
payload.value[outKey] = result.value;
}
}
}
let unrecognized;
for (const key in input) {
if (!recordKeys.has(key)) {
unrecognized = unrecognized ?? [];
unrecognized.push(key);
}
}
if (unrecognized && unrecognized.length > 0) {
payload.issues.push({
code: "unrecognized_keys",
input,
inst,
keys: unrecognized
});
}
} else {
payload.value = {};
for (const key of Reflect.ownKeys(input)) {
if (key === "__proto__")
continue;
if (!Object.prototype.propertyIsEnumerable.call(input, key))
continue;
let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
if (keyResult instanceof Promise) {
throw new Error("Async schemas not supported in object keys currently");
}
const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
if (checkNumericKey) {
const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
if (retryResult instanceof Promise) {
throw new Error("Async schemas not supported in object keys currently");
}
if (retryResult.issues.length === 0) {
keyResult = retryResult;
}
}
if (keyResult.issues.length) {
if (def.mode === "loose") {
payload.value[key] = input[key];
} else {
payload.issues.push({
code: "invalid_key",
origin: "record",
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
input: key,
path: [key],
inst
});
}
continue;
}
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
if (result instanceof Promise) {
proms.push(result.then((result2) => {
if (result2.issues.length) {
payload.issues.push(...prefixIssues(key, result2.issues));
}
payload.value[keyResult.value] = result2.value;
}));
} else {
if (result.issues.length) {
payload.issues.push(...prefixIssues(key, result.issues));
}
payload.value[keyResult.value] = result.value;
}
}
}
if (proms.length) {
return Promise.all(proms).then(() => payload);
}
return payload;
};
});
var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, ctx) => {
const input = payload.value;
if (!(input instanceof Map)) {
payload.issues.push({
expected: "map",
code: "invalid_type",
input,
inst
});
return payload;
}
const proms = [];
payload.value = new Map;
for (const [key, value] of input) {
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
if (keyResult instanceof Promise || valueResult instanceof Promise) {
proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {
handleMapResult(keyResult2, valueResult2, payload, key, input, inst, ctx);
}));
} else {
handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
}
}
if (proms.length)
return Promise.all(proms).then(() => payload);
return payload;
};
});
function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
if (keyResult.issues.length) {
if (propertyKeyTypes.has(typeof key)) {
final.issues.push(...prefixIssues(key, keyResult.issues));
} else {
final.issues.push({
code: "invalid_key",
origin: "map",
input,
inst,
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
});
}
}
if (valueResult.issues.length) {
if (propertyKeyTypes.has(typeof key)) {
final.issues.push(...prefixIssues(key, valueResult.issues));
} else {
final.issues.push({
origin: "map",
code: "invalid_element",
input,
inst,
key,
issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
});
}
}
final.value.set(keyResult.value, valueResult.value);
}
var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, ctx) => {
const input = payload.value;
if (!(input instanceof Set)) {
payload.issues.push({
input,
inst,
expected: "set",
code: "invalid_type"
});
return payload;
}
const proms = [];
payload.value = new Set;
for (const item of input) {
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
if (result instanceof Promise) {
proms.push(result.then((result2) => handleSetResult(result2, payload)));
} else
handleSetResult(result, payload);
}
if (proms.length)
return Promise.all(proms).then(() => payload);
return payload;
};
});
function handleSetResult(result, final) {
if (result.issues.length) {
final.issues.push(...result.issues);
}
final.value.add(result.value);
}
var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
$ZodType.init(inst, def);
const values = getEnumValues(def.entries);
const valuesSet = new Set(values);
inst._zod.values = valuesSet;
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
inst._zod.parse = (payload, _ctx) => {
const input = payload.value;
if (valuesSet.has(input)) {
return payload;
}
payload.issues.push({
code: "invalid_value",
values,
input,
inst
});
return payload;
};
});
var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
$ZodType.init(inst, def);
if (def.values.length === 0) {
throw new Error("Cannot create literal schema with no valid values");
}
const values = new Set(def.values);
inst._zod.values = values;
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
inst._zod.parse = (payload, _ctx) => {
const input = payload.value;
if (values.has(input)) {
return payload;
}
payload.issues.push({
code: "invalid_value",
values: def.values,
input,
inst
});
return payload;
};
});
var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, _ctx) => {
const input = payload.value;
if (input instanceof File)
return payload;
payload.issues.push({
expected: "file",
code: "invalid_type",
input,
inst
});
return payload;
};
});
var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.optin = "optional";
inst._zod.parse = (payload, ctx) => {
if (ctx.direction === "backward") {
throw new $ZodEncodeError(inst.constructor.name);
}
const _out = def.transform(payload.value, payload);
if (ctx.async) {
const output = _out instanceof Promise ? _out : Promise.resolve(_out);
return output.then((output2) => {
payload.value = output2;
payload.fallback = true;
return payload;
});
}
if (_out instanceof Promise) {
throw new $ZodAsyncError;
}
payload.value = _out;
payload.fallback = true;
return payload;
};
});
function handleOptionalResult(result, input) {
if (input === undefined && (result.issues.length || result.fallback)) {
return { issues: [], value: undefined };
}
return result;
}
var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.optin = "optional";
inst._zod.optout = "optional";
defineLazy(inst._zod, "values", () => {
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;
});
defineLazy(inst._zod, "pattern", () => {
const pattern = def.innerType._zod.pattern;
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : undefined;
});
inst._zod.parse = (payload, ctx) => {
if (def.innerType._zod.optin === "optional") {
const input = payload.value;
const result = def.innerType._zod.run(payload, ctx);
if (result instanceof Promise)
return result.then((r) => handleOptionalResult(r, input));
return handleOptionalResult(result, input);
}
if (payload.value === undefined) {
return payload;
}
return def.innerType._zod.run(payload, ctx);
};
});
var $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
$ZodOptional.init(inst, def);
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
inst._zod.parse = (payload, ctx) => {
return def.innerType._zod.run(payload, ctx);
};
});
var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
$ZodType.init(inst, def);
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
defineLazy(inst._zod, "pattern", () => {
const pattern = def.innerType._zod.pattern;
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : undefined;
});
defineLazy(inst._zod, "values", () => {
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
});
inst._zod.parse = (payload, ctx) => {
if (payload.value === null)
return payload;
return def.innerType._zod.run(payload, ctx);
};
});
var $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.optin = "optional";
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
inst._zod.parse = (payload, ctx) => {
if (ctx.direction === "backward") {
return def.innerType._zod.run(payload, ctx);
}
if (payload.value === undefined) {
payload.value = def.defaultValue;
return payload;
}
const result = def.innerType._zod.run(payload, ctx);
if (result instanceof Promise) {
return result.then((result2) => handleDefaultResult(result2, def));
}
return handleDefaultResult(result, def);
};
});
function handleDefaultResult(payload, def) {
if (payload.value === undefined) {
payload.value = def.defaultValue;
}
return payload;
}
var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.optin = "optional";
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
inst._zod.parse = (payload, ctx) => {
if (ctx.direction === "backward") {
return def.innerType._zod.run(payload, ctx);
}
if (payload.value === undefined) {
payload.value = def.defaultValue;
}
return def.innerType._zod.run(payload, ctx);
};
});
var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
$ZodType.init(inst, def);
defineLazy(inst._zod, "values", () => {
const v = def.innerType._zod.values;
return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
});
inst._zod.parse = (payload, ctx) => {
const result = def.innerType._zod.run(payload, ctx);
if (result instanceof Promise) {
return result.then((result2) => handleNonOptionalResult(result2, inst));
}
return handleNonOptionalResult(result, inst);
};
});
function handleNonOptionalResult(payload, inst) {
if (!payload.issues.length && payload.value === undefined) {
payload.issues.push({
code: "invalid_type",
expected: "nonoptional",
input: payload.value,
inst
});
}
return payload;
}
var $ZodSuccess = /* @__PURE__ */ $constructor("$ZodSuccess", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, ctx) => {
if (ctx.direction === "backward") {
throw new $ZodEncodeError("ZodSuccess");
}
const result = def.innerType._zod.run(payload, ctx);
if (result instanceof Promise) {
return result.then((result2) => {
payload.value = result2.issues.length === 0;
return payload;
});
}
payload.value = result.issues.length === 0;
return payload;
};
});
var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.optin = "optional";
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
inst._zod.parse = (payload, ctx) => {
if (ctx.direction === "backward") {
return def.innerType._zod.run(payload, ctx);
}
const result = def.innerType._zod.run(payload, ctx);
if (result instanceof Promise) {
return result.then((result2) => {
payload.value = result2.value;
if (result2.issues.length) {
payload.value = def.catchValue({
...payload,
error: {
issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config()))
},
input: payload.value
});
payload.issues = [];
payload.fallback = true;
}
return payload;
});
}
payload.value = result.value;
if (result.issues.length) {
payload.value = def.catchValue({
...payload,
error: {
issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
},
input: payload.value
});
payload.issues = [];
payload.fallback = true;
}
return payload;
};
});
var $ZodNaN = /* @__PURE__ */ $constructor("$ZodNaN", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, _ctx) => {
if (typeof payload.value !== "number" || !Number.isNaN(payload.value)) {
payload.issues.push({
input: payload.value,
inst,
expected: "nan",
code: "invalid_type"
});
return payload;
}
return payload;
};
});
var $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
$ZodType.init(inst, def);
defineLazy(inst._zod, "values", () => def.in._zod.values);
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
inst._zod.parse = (payload, ctx) => {
if (ctx.direction === "backward") {
const right = def.out._zod.run(payload, ctx);
if (right instanceof Promise) {
return right.then((right2) => handlePipeResult(right2, def.in, ctx));
}
return handlePipeResult(right, def.in, ctx);
}
const left = def.in._zod.run(payload, ctx);
if (left instanceof Promise) {
return left.then((left2) => handlePipeResult(left2, def.out, ctx));
}
return handlePipeResult(left, def.out, ctx);
};
});
function handlePipeResult(left, next, ctx) {
if (left.issues.length) {
left.aborted = true;
return left;
}
return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);
}
var $ZodCodec = /* @__PURE__ */ $constructor("$ZodCodec", (inst, def) => {
$ZodType.init(inst, def);
defineLazy(inst._zod, "values", () => def.in._zod.values);
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
inst._zod.parse = (payload, ctx) => {
const direction = ctx.direction || "forward";
if (direction === "forward") {
const left = def.in._zod.run(payload, ctx);
if (left instanceof Promise) {
return left.then((left2) => handleCodecAResult(left2, def, ctx));
}
return handleCodecAResult(left, def, ctx);
} else {
const right = def.out._zod.run(payload, ctx);
if (right instanceof Promise) {
return right.then((right2) => handleCodecAResult(right2, def, ctx));
}
return handleCodecAResult(right, def, ctx);
}
};
});
function handleCodecAResult(result, def, ctx) {
if (result.issues.length) {
result.aborted = true;
return result;
}
const direction = ctx.direction || "forward";
if (direction === "forward") {
const transformed = def.transform(result.value, result);
if (transformed instanceof Promise) {
return transformed.then((value) => handleCodecTxResult(result, value, def.out, ctx));
}
return handleCodecTxResult(result, transformed, def.out, ctx);
} else {
const transformed = def.reverseTransform(result.value, result);
if (transformed instanceof Promise) {
return transformed.then((value) => handleCodecTxResult(result, value, def.in, ctx));
}
return handleCodecTxResult(result, transformed, def.in, ctx);
}
}
function handleCodecTxResult(left, value, nextSchema, ctx) {
if (left.issues.length) {
left.aborted = true;
return left;
}
return nextSchema._zod.run({ value, issues: left.issues }, ctx);
}
var $ZodPreprocess = /* @__PURE__ */ $constructor("$ZodPreprocess", (inst, def) => {
$ZodPipe.init(inst, def);
});
var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
$ZodType.init(inst, def);
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
inst._zod.parse = (payload, ctx) => {
if (ctx.direction === "backward") {
return def.innerType._zod.run(payload, ctx);
}
const result = def.innerType._zod.run(payload, ctx);
if (result instanceof Promise) {
return result.then(handleReadonlyResult);
}
return handleReadonlyResult(result);
};
});
function handleReadonlyResult(payload) {
payload.value = Object.freeze(payload.value);
return payload;
}
var $ZodTemplateLiteral = /* @__PURE__ */ $constructor("$ZodTemplateLiteral", (inst, def) => {
$ZodType.init(inst, def);
const regexParts = [];
for (const part of def.parts) {
if (typeof part === "object" && part !== null) {
if (!part._zod.pattern) {
throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
}
const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
if (!source)
throw new Error(`Invalid template literal part: ${part._zod.traits}`);
const start = source.startsWith("^") ? 1 : 0;
const end = source.endsWith("$") ? source.length - 1 : source.length;
regexParts.push(source.slice(start, end));
} else if (part === null || primitiveTypes.has(typeof part)) {
regexParts.push(escapeRegex(`${part}`));
} else {
throw new Error(`Invalid template literal part: ${part}`);
}
}
inst._zod.pattern = new RegExp(`^${regexParts.join("")}$`);
inst._zod.parse = (payload, _ctx) => {
if (typeof payload.value !== "string") {
payload.issues.push({
input: payload.value,
inst,
expected: "string",
code: "invalid_type"
});
return payload;
}
inst._zod.pattern.lastIndex = 0;
if (!inst._zod.pattern.test(payload.value)) {
payload.issues.push({
input: payload.value,
inst,
code: "invalid_format",
format: def.format ?? "template_literal",
pattern: inst._zod.pattern.source
});
return payload;
}
return payload;
};
});
var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
$ZodType.init(inst, def);
inst._def = def;
inst._zod.def = def;
inst.implement = (func) => {
if (typeof func !== "function") {
throw new Error("implement() must be called with a function");
}
return function(...args) {
const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;
const result = Reflect.apply(func, this, parsedArgs);
if (inst._def.output) {
return parse(inst._def.output, result);
}
return result;
};
};
inst.implementAsync = (func) => {
if (typeof func !== "function") {
throw new Error("implementAsync() must be called with a function");
}
return async function(...args) {
const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args;
const result = await Reflect.apply(func, this, parsedArgs);
if (inst._def.output) {
return await parseAsync(inst._def.output, result);
}
return result;
};
};
inst._zod.parse = (payload, _ctx) => {
if (typeof payload.value !== "function") {
payload.issues.push({
code: "invalid_type",
expected: "function",
input: payload.value,
inst
});
return payload;
}
const hasPromiseOutput = inst._def.output && inst._def.output._zod.def.type === "promise";
if (hasPromiseOutput) {
payload.value = inst.implementAsync(payload.value);
} else {
payload.value = inst.implement(payload.value);
}
return payload;
};
inst.input = (...args) => {
const F = inst.constructor;
if (Array.isArray(args[0])) {
return new F({
type: "function",
input: new $ZodTuple({
type: "tuple",
items: args[0],
rest: args[1]
}),
output: inst._def.output
});
}
return new F({
type: "function",
input: args[0],
output: inst._def.output
});
};
inst.output = (output) => {
const F = inst.constructor;
return new F({
type: "function",
input: inst._def.input,
output
});
};
return inst;
});
var $ZodPromise = /* @__PURE__ */ $constructor("$ZodPromise", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, ctx) => {
return Promise.resolve(payload.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx));
};
});
var $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
$ZodType.init(inst, def);
defineLazy(inst._zod, "innerType", () => {
const d = def;
if (!d._cachedInner)
d._cachedInner = def.getter();
return d._cachedInner;
});
defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern);
defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? undefined);
defineLazy(inst._zod, "optout", () => inst._zod.innerType?._zod?.optout ?? undefined);
inst._zod.parse = (payload, ctx) => {
const inner = inst._zod.innerType;
return inner._zod.run(payload, ctx);
};
});
var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
$ZodCheck.init(inst, def);
$ZodType.init(inst, def);
inst._zod.parse = (payload, _) => {
return payload;
};
inst._zod.check = (payload) => {
const input = payload.value;
const r = def.fn(input);
if (r instanceof Promise) {
return r.then((r2) => handleRefineResult(r2, payload, input, inst));
}
handleRefineResult(r, payload, input, inst);
return;
};
});
function handleRefineResult(result, payload, input, inst) {
if (!result) {
const _iss = {
code: "custom",
input,
inst,
path: [...inst._zod.def.path ?? []],
continue: !inst._zod.def.abort
};
if (inst._zod.def.params)
_iss.params = inst._zod.def.params;
payload.issues.push(issue(_iss));
}
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/index.js
var exports_locales = {};
__export(exports_locales, {
zhTW: () => zh_TW_default,
zhCN: () => zh_CN_default,
yo: () => yo_default,
vi: () => vi_default,
uz: () => uz_default,
ur: () => ur_default,
uk: () => uk_default,
ua: () => ua_default,
tr: () => tr_default,
th: () => th_default,
ta: () => ta_default,
sv: () => sv_default,
sl: () => sl_default,
ru: () => ru_default,
ro: () => ro_default,
pt: () => pt_default,
ps: () => ps_default,
pl: () => pl_default,
ota: () => ota_default,
no: () => no_default,
nl: () => nl_default,
ms: () => ms_default,
mk: () => mk_default,
lt: () => lt_default,
ko: () => ko_default,
km: () => km_default,
kh: () => kh_default,
ka: () => ka_default,
ja: () => ja_default,
it: () => it_default,
is: () => is_default,
id: () => id_default,
hy: () => hy_default,
hu: () => hu_default,
hr: () => hr_default,
he: () => he_default,
frCA: () => fr_CA_default,
fr: () => fr_default,
fi: () => fi_default,
fa: () => fa_default,
es: () => es_default,
eo: () => eo_default,
en: () => en_default,
el: () => el_default,
de: () => de_default,
da: () => da_default,
cs: () => cs_default,
ca: () => ca_default,
bg: () => bg_default,
be: () => be_default,
az: () => az_default,
ar: () => ar_default
});
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/ar.js
var error = () => {
const Sizable = {
string: { unit: "حرف", verb: "أن يحوي" },
file: { unit: "بايت", verb: "أن يحوي" },
array: { unit: "عنصر", verb: "أن يحوي" },
set: { unit: "عنصر", verb: "أن يحوي" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "مدخل",
email: "بريد إلكتروني",
url: "رابط",
emoji: "إيموجي",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "تاريخ ووقت بمعيار ISO",
date: "تاريخ بمعيار ISO",
time: "وقت بمعيار ISO",
duration: "مدة بمعيار ISO",
ipv4: "عنوان IPv4",
ipv6: "عنوان IPv6",
cidrv4: "مدى عناوين بصيغة IPv4",
cidrv6: "مدى عناوين بصيغة IPv6",
base64: "نَص بترميز base64-encoded",
base64url: "نَص بترميز base64url-encoded",
json_string: "نَص على هيئة JSON",
e164: "رقم هاتف بمعيار E.164",
jwt: "JWT",
template_literal: "مدخل"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `مدخلات غير مقبولة: يفترض إدخال instanceof ${issue2.expected}، ولكن تم إدخال ${received}`;
}
return `مدخلات غير مقبولة: يفترض إدخال ${expected}، ولكن تم إدخال ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `مدخلات غير مقبولة: يفترض إدخال ${stringifyPrimitive(issue2.values[0])}`;
return `اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return ` أكبر من اللازم: يفترض أن تكون ${issue2.origin ?? "القيمة"} ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "عنصر"}`;
return `أكبر من اللازم: يفترض أن تكون ${issue2.origin ?? "القيمة"} ${adj} ${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `أصغر من اللازم: يفترض لـ ${issue2.origin} أن يكون ${adj} ${issue2.minimum.toString()} ${sizing.unit}`;
}
return `أصغر من اللازم: يفترض لـ ${issue2.origin} أن يكون ${adj} ${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `نَص غير مقبول: يجب أن يبدأ بـ "${issue2.prefix}"`;
if (_issue.format === "ends_with")
return `نَص غير مقبول: يجب أن ينتهي بـ "${_issue.suffix}"`;
if (_issue.format === "includes")
return `نَص غير مقبول: يجب أن يتضمَّن "${_issue.includes}"`;
if (_issue.format === "regex")
return `نَص غير مقبول: يجب أن يطابق النمط ${_issue.pattern}`;
return `${FormatDictionary[_issue.format] ?? issue2.format} غير مقبول`;
}
case "not_multiple_of":
return `رقم غير مقبول: يجب أن يكون من مضاعفات ${issue2.divisor}`;
case "unrecognized_keys":
return `معرف${issue2.keys.length > 1 ? "ات" : ""} غريب${issue2.keys.length > 1 ? "ة" : ""}: ${joinValues(issue2.keys, "، ")}`;
case "invalid_key":
return `معرف غير مقبول في ${issue2.origin}`;
case "invalid_union":
return "مدخل غير مقبول";
case "invalid_element":
return `مدخل غير مقبول في ${issue2.origin}`;
default:
return "مدخل غير مقبول";
}
};
};
function ar_default() {
return {
localeError: error()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/az.js
var error2 = () => {
const Sizable = {
string: { unit: "simvol", verb: "olmalıdır" },
file: { unit: "bayt", verb: "olmalıdır" },
array: { unit: "element", verb: "olmalıdır" },
set: { unit: "element", verb: "olmalıdır" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "input",
email: "email address",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO datetime",
date: "ISO date",
time: "ISO time",
duration: "ISO duration",
ipv4: "IPv4 address",
ipv6: "IPv6 address",
cidrv4: "IPv4 range",
cidrv6: "IPv6 range",
base64: "base64-encoded string",
base64url: "base64url-encoded string",
json_string: "JSON string",
e164: "E.164 number",
jwt: "JWT",
template_literal: "input"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Yanlış dəyər: gözlənilən instanceof ${issue2.expected}, daxil olan ${received}`;
}
return `Yanlış dəyər: gözlənilən ${expected}, daxil olan ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Yanlış dəyər: gözlənilən ${stringifyPrimitive(issue2.values[0])}`;
return `Yanlış seçim: aşağıdakılardan biri olmalıdır: ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Çox böyük: gözlənilən ${issue2.origin ?? "dəyər"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "element"}`;
return `Çox böyük: gözlənilən ${issue2.origin ?? "dəyər"} ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Çox kiçik: gözlənilən ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
return `Çox kiçik: gözlənilən ${issue2.origin} ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Yanlış mətn: "${_issue.prefix}" ilə başlamalıdır`;
if (_issue.format === "ends_with")
return `Yanlış mətn: "${_issue.suffix}" ilə bitməlidir`;
if (_issue.format === "includes")
return `Yanlış mətn: "${_issue.includes}" daxil olmalıdır`;
if (_issue.format === "regex")
return `Yanlış mətn: ${_issue.pattern} şablonuna uyğun olmalıdır`;
return `Yanlış ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Yanlış ədəd: ${issue2.divisor} ilə bölünə bilən olmalıdır`;
case "unrecognized_keys":
return `Tanınmayan açar${issue2.keys.length > 1 ? "lar" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `${issue2.origin} daxilində yanlış açar`;
case "invalid_union":
return "Yanlış dəyər";
case "invalid_element":
return `${issue2.origin} daxilində yanlış dəyər`;
default:
return `Yanlış dəyər`;
}
};
};
function az_default() {
return {
localeError: error2()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/be.js
function getBelarusianPlural(count2, one, few, many) {
const absCount = Math.abs(count2);
const lastDigit = absCount % 10;
const lastTwoDigits = absCount % 100;
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
return many;
}
if (lastDigit === 1) {
return one;
}
if (lastDigit >= 2 && lastDigit <= 4) {
return few;
}
return many;
}
var error3 = () => {
const Sizable = {
string: {
unit: {
one: "сімвал",
few: "сімвалы",
many: "сімвалаў"
},
verb: "мець"
},
array: {
unit: {
one: "элемент",
few: "элементы",
many: "элементаў"
},
verb: "мець"
},
set: {
unit: {
one: "элемент",
few: "элементы",
many: "элементаў"
},
verb: "мець"
},
file: {
unit: {
one: "байт",
few: "байты",
many: "байтаў"
},
verb: "мець"
}
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "увод",
email: "email адрас",
url: "URL",
emoji: "эмодзі",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO дата і час",
date: "ISO дата",
time: "ISO час",
duration: "ISO працягласць",
ipv4: "IPv4 адрас",
ipv6: "IPv6 адрас",
cidrv4: "IPv4 дыяпазон",
cidrv6: "IPv6 дыяпазон",
base64: "радок у фармаце base64",
base64url: "радок у фармаце base64url",
json_string: "JSON радок",
e164: "нумар E.164",
jwt: "JWT",
template_literal: "увод"
};
const TypeDictionary = {
nan: "NaN",
number: "лік",
array: "масіў"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Няправільны ўвод: чакаўся instanceof ${issue2.expected}, атрымана ${received}`;
}
return `Няправільны ўвод: чакаўся ${expected}, атрымана ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Няправільны ўвод: чакалася ${stringifyPrimitive(issue2.values[0])}`;
return `Няправільны варыянт: чакаўся адзін з ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
const maxValue = Number(issue2.maximum);
const unit = getBelarusianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
return `Занадта вялікі: чакалася, што ${issue2.origin ?? "значэнне"} павінна ${sizing.verb} ${adj}${issue2.maximum.toString()} ${unit}`;
}
return `Занадта вялікі: чакалася, што ${issue2.origin ?? "значэнне"} павінна быць ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
const minValue = Number(issue2.minimum);
const unit = getBelarusianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
return `Занадта малы: чакалася, што ${issue2.origin} павінна ${sizing.verb} ${adj}${issue2.minimum.toString()} ${unit}`;
}
return `Занадта малы: чакалася, што ${issue2.origin} павінна быць ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Няправільны радок: павінен пачынацца з "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Няправільны радок: павінен заканчвацца на "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Няправільны радок: павінен змяшчаць "${_issue.includes}"`;
if (_issue.format === "regex")
return `Няправільны радок: павінен адпавядаць шаблону ${_issue.pattern}`;
return `Няправільны ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Няправільны лік: павінен быць кратным ${issue2.divisor}`;
case "unrecognized_keys":
return `Нераспазнаны ${issue2.keys.length > 1 ? "ключы" : "ключ"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Няправільны ключ у ${issue2.origin}`;
case "invalid_union":
return "Няправільны ўвод";
case "invalid_element":
return `Няправільнае значэнне ў ${issue2.origin}`;
default:
return `Няправільны ўвод`;
}
};
};
function be_default() {
return {
localeError: error3()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/bg.js
var error4 = () => {
const Sizable = {
string: { unit: "символа", verb: "да съдържа" },
file: { unit: "байта", verb: "да съдържа" },
array: { unit: "елемента", verb: "да съдържа" },
set: { unit: "елемента", verb: "да съдържа" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "вход",
email: "имейл адрес",
url: "URL",
emoji: "емоджи",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO време",
date: "ISO дата",
time: "ISO време",
duration: "ISO продължителност",
ipv4: "IPv4 адрес",
ipv6: "IPv6 адрес",
cidrv4: "IPv4 диапазон",
cidrv6: "IPv6 диапазон",
base64: "base64-кодиран низ",
base64url: "base64url-кодиран низ",
json_string: "JSON низ",
e164: "E.164 номер",
jwt: "JWT",
template_literal: "вход"
};
const TypeDictionary = {
nan: "NaN",
number: "число",
array: "масив"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Невалиден вход: очакван instanceof ${issue2.expected}, получен ${received}`;
}
return `Невалиден вход: очакван ${expected}, получен ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Невалиден вход: очакван ${stringifyPrimitive(issue2.values[0])}`;
return `Невалидна опция: очаквано едно от ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Твърде голямо: очаква се ${issue2.origin ?? "стойност"} да съдържа ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "елемента"}`;
return `Твърде голямо: очаква се ${issue2.origin ?? "стойност"} да бъде ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Твърде малко: очаква се ${issue2.origin} да съдържа ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Твърде малко: очаква се ${issue2.origin} да бъде ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `Невалиден низ: трябва да започва с "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Невалиден низ: трябва да завършва с "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Невалиден низ: трябва да включва "${_issue.includes}"`;
if (_issue.format === "regex")
return `Невалиден низ: трябва да съвпада с ${_issue.pattern}`;
let invalid_adj = "Невалиден";
if (_issue.format === "emoji")
invalid_adj = "Невалидно";
if (_issue.format === "datetime")
invalid_adj = "Невалидно";
if (_issue.format === "date")
invalid_adj = "Невалидна";
if (_issue.format === "time")
invalid_adj = "Невалидно";
if (_issue.format === "duration")
invalid_adj = "Невалидна";
return `${invalid_adj} ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Невалидно число: трябва да бъде кратно на ${issue2.divisor}`;
case "unrecognized_keys":
return `Неразпознат${issue2.keys.length > 1 ? "и" : ""} ключ${issue2.keys.length > 1 ? "ове" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Невалиден ключ в ${issue2.origin}`;
case "invalid_union":
return "Невалиден вход";
case "invalid_element":
return `Невалидна стойност в ${issue2.origin}`;
default:
return `Невалиден вход`;
}
};
};
function bg_default() {
return {
localeError: error4()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/ca.js
var error5 = () => {
const Sizable = {
string: { unit: "caràcters", verb: "contenir" },
file: { unit: "bytes", verb: "contenir" },
array: { unit: "elements", verb: "contenir" },
set: { unit: "elements", verb: "contenir" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "entrada",
email: "adreça electrònica",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "data i hora ISO",
date: "data ISO",
time: "hora ISO",
duration: "durada ISO",
ipv4: "adreça IPv4",
ipv6: "adreça IPv6",
cidrv4: "rang IPv4",
cidrv6: "rang IPv6",
base64: "cadena codificada en base64",
base64url: "cadena codificada en base64url",
json_string: "cadena JSON",
e164: "número E.164",
jwt: "JWT",
template_literal: "entrada"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Tipus invàlid: s'esperava instanceof ${issue2.expected}, s'ha rebut ${received}`;
}
return `Tipus invàlid: s'esperava ${expected}, s'ha rebut ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Valor invàlid: s'esperava ${stringifyPrimitive(issue2.values[0])}`;
return `Opció invàlida: s'esperava una de ${joinValues(issue2.values, " o ")}`;
case "too_big": {
const adj = issue2.inclusive ? "com a màxim" : "menys de";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Massa gran: s'esperava que ${issue2.origin ?? "el valor"} contingués ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "elements"}`;
return `Massa gran: s'esperava que ${issue2.origin ?? "el valor"} fos ${adj} ${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? "com a mínim" : "més de";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Massa petit: s'esperava que ${issue2.origin} contingués ${adj} ${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Massa petit: s'esperava que ${issue2.origin} fos ${adj} ${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `Format invàlid: ha de començar amb "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Format invàlid: ha d'acabar amb "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Format invàlid: ha d'incloure "${_issue.includes}"`;
if (_issue.format === "regex")
return `Format invàlid: ha de coincidir amb el patró ${_issue.pattern}`;
return `Format invàlid per a ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Número invàlid: ha de ser múltiple de ${issue2.divisor}`;
case "unrecognized_keys":
return `Clau${issue2.keys.length > 1 ? "s" : ""} no reconeguda${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Clau invàlida a ${issue2.origin}`;
case "invalid_union":
return "Entrada invàlida";
case "invalid_element":
return `Element invàlid a ${issue2.origin}`;
default:
return `Entrada invàlida`;
}
};
};
function ca_default() {
return {
localeError: error5()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/cs.js
var error6 = () => {
const Sizable = {
string: { unit: "znaků", verb: "mít" },
file: { unit: "bajtů", verb: "mít" },
array: { unit: "prvků", verb: "mít" },
set: { unit: "prvků", verb: "mít" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "regulární výraz",
email: "e-mailová adresa",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "datum a čas ve formátu ISO",
date: "datum ve formátu ISO",
time: "čas ve formátu ISO",
duration: "doba trvání ISO",
ipv4: "IPv4 adresa",
ipv6: "IPv6 adresa",
cidrv4: "rozsah IPv4",
cidrv6: "rozsah IPv6",
base64: "řetězec zakódovaný ve formátu base64",
base64url: "řetězec zakódovaný ve formátu base64url",
json_string: "řetězec ve formátu JSON",
e164: "číslo E.164",
jwt: "JWT",
template_literal: "vstup"
};
const TypeDictionary = {
nan: "NaN",
number: "číslo",
string: "řetězec",
function: "funkce",
array: "pole"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Neplatný vstup: očekáváno instanceof ${issue2.expected}, obdrženo ${received}`;
}
return `Neplatný vstup: očekáváno ${expected}, obdrženo ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Neplatný vstup: očekáváno ${stringifyPrimitive(issue2.values[0])}`;
return `Neplatná možnost: očekávána jedna z hodnot ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Hodnota je příliš velká: ${issue2.origin ?? "hodnota"} musí mít ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "prvků"}`;
}
return `Hodnota je příliš velká: ${issue2.origin ?? "hodnota"} musí být ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Hodnota je příliš malá: ${issue2.origin ?? "hodnota"} musí mít ${adj}${issue2.minimum.toString()} ${sizing.unit ?? "prvků"}`;
}
return `Hodnota je příliš malá: ${issue2.origin ?? "hodnota"} musí být ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Neplatný řetězec: musí začínat na "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Neplatný řetězec: musí končit na "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Neplatný řetězec: musí obsahovat "${_issue.includes}"`;
if (_issue.format === "regex")
return `Neplatný řetězec: musí odpovídat vzoru ${_issue.pattern}`;
return `Neplatný formát ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Neplatné číslo: musí být násobkem ${issue2.divisor}`;
case "unrecognized_keys":
return `Neznámé klíče: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Neplatný klíč v ${issue2.origin}`;
case "invalid_union":
return "Neplatný vstup";
case "invalid_element":
return `Neplatná hodnota v ${issue2.origin}`;
default:
return `Neplatný vstup`;
}
};
};
function cs_default() {
return {
localeError: error6()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/da.js
var error7 = () => {
const Sizable = {
string: { unit: "tegn", verb: "havde" },
file: { unit: "bytes", verb: "havde" },
array: { unit: "elementer", verb: "indeholdt" },
set: { unit: "elementer", verb: "indeholdt" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "input",
email: "e-mailadresse",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO dato- og klokkeslæt",
date: "ISO-dato",
time: "ISO-klokkeslæt",
duration: "ISO-varighed",
ipv4: "IPv4-område",
ipv6: "IPv6-område",
cidrv4: "IPv4-spektrum",
cidrv6: "IPv6-spektrum",
base64: "base64-kodet streng",
base64url: "base64url-kodet streng",
json_string: "JSON-streng",
e164: "E.164-nummer",
jwt: "JWT",
template_literal: "input"
};
const TypeDictionary = {
nan: "NaN",
string: "streng",
number: "tal",
boolean: "boolean",
array: "liste",
object: "objekt",
set: "sæt",
file: "fil"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Ugyldigt input: forventede instanceof ${issue2.expected}, fik ${received}`;
}
return `Ugyldigt input: forventede ${expected}, fik ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Ugyldig værdi: forventede ${stringifyPrimitive(issue2.values[0])}`;
return `Ugyldigt valg: forventede en af følgende ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
const origin = TypeDictionary[issue2.origin] ?? issue2.origin;
if (sizing)
return `For stor: forventede ${origin ?? "value"} ${sizing.verb} ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "elementer"}`;
return `For stor: forventede ${origin ?? "value"} havde ${adj} ${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
const origin = TypeDictionary[issue2.origin] ?? issue2.origin;
if (sizing) {
return `For lille: forventede ${origin} ${sizing.verb} ${adj} ${issue2.minimum.toString()} ${sizing.unit}`;
}
return `For lille: forventede ${origin} havde ${adj} ${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Ugyldig streng: skal starte med "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Ugyldig streng: skal ende med "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Ugyldig streng: skal indeholde "${_issue.includes}"`;
if (_issue.format === "regex")
return `Ugyldig streng: skal matche mønsteret ${_issue.pattern}`;
return `Ugyldig ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Ugyldigt tal: skal være deleligt med ${issue2.divisor}`;
case "unrecognized_keys":
return `${issue2.keys.length > 1 ? "Ukendte nøgler" : "Ukendt nøgle"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Ugyldig nøgle i ${issue2.origin}`;
case "invalid_union":
return "Ugyldigt input: matcher ingen af de tilladte typer";
case "invalid_element":
return `Ugyldig værdi i ${issue2.origin}`;
default:
return `Ugyldigt input`;
}
};
};
function da_default() {
return {
localeError: error7()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/de.js
var error8 = () => {
const Sizable = {
string: { unit: "Zeichen", verb: "zu haben" },
file: { unit: "Bytes", verb: "zu haben" },
array: { unit: "Elemente", verb: "zu haben" },
set: { unit: "Elemente", verb: "zu haben" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "Eingabe",
email: "E-Mail-Adresse",
url: "URL",
emoji: "Emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO-Datum und -Uhrzeit",
date: "ISO-Datum",
time: "ISO-Uhrzeit",
duration: "ISO-Dauer",
ipv4: "IPv4-Adresse",
ipv6: "IPv6-Adresse",
cidrv4: "IPv4-Bereich",
cidrv6: "IPv6-Bereich",
base64: "Base64-codierter String",
base64url: "Base64-URL-codierter String",
json_string: "JSON-String",
e164: "E.164-Nummer",
jwt: "JWT",
template_literal: "Eingabe"
};
const TypeDictionary = {
nan: "NaN",
number: "Zahl",
array: "Array"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Ungültige Eingabe: erwartet instanceof ${issue2.expected}, erhalten ${received}`;
}
return `Ungültige Eingabe: erwartet ${expected}, erhalten ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Ungültige Eingabe: erwartet ${stringifyPrimitive(issue2.values[0])}`;
return `Ungültige Option: erwartet eine von ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Zu groß: erwartet, dass ${issue2.origin ?? "Wert"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "Elemente"} hat`;
return `Zu groß: erwartet, dass ${issue2.origin ?? "Wert"} ${adj}${issue2.maximum.toString()} ist`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Zu klein: erwartet, dass ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} hat`;
}
return `Zu klein: erwartet, dass ${issue2.origin} ${adj}${issue2.minimum.toString()} ist`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Ungültiger String: muss mit "${_issue.prefix}" beginnen`;
if (_issue.format === "ends_with")
return `Ungültiger String: muss mit "${_issue.suffix}" enden`;
if (_issue.format === "includes")
return `Ungültiger String: muss "${_issue.includes}" enthalten`;
if (_issue.format === "regex")
return `Ungültiger String: muss dem Muster ${_issue.pattern} entsprechen`;
return `Ungültig: ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Ungültige Zahl: muss ein Vielfaches von ${issue2.divisor} sein`;
case "unrecognized_keys":
return `${issue2.keys.length > 1 ? "Unbekannte Schlüssel" : "Unbekannter Schlüssel"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Ungültiger Schlüssel in ${issue2.origin}`;
case "invalid_union":
return "Ungültige Eingabe";
case "invalid_element":
return `Ungültiger Wert in ${issue2.origin}`;
default:
return `Ungültige Eingabe`;
}
};
};
function de_default() {
return {
localeError: error8()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/el.js
var error9 = () => {
const Sizable = {
string: { unit: "χαρακτήρες", verb: "να έχει" },
file: { unit: "bytes", verb: "να έχει" },
array: { unit: "στοιχεία", verb: "να έχει" },
set: { unit: "στοιχεία", verb: "να έχει" },
map: { unit: "καταχωρήσεις", verb: "να έχει" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "είσοδος",
email: "διεύθυνση email",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO ημερομηνία και ώρα",
date: "ISO ημερομηνία",
time: "ISO ώρα",
duration: "ISO διάρκεια",
ipv4: "διεύθυνση IPv4",
ipv6: "διεύθυνση IPv6",
mac: "διεύθυνση MAC",
cidrv4: "εύρος IPv4",
cidrv6: "εύρος IPv6",
base64: "συμβολοσειρά κωδικοποιημένη σε base64",
base64url: "συμβολοσειρά κωδικοποιημένη σε base64url",
json_string: "συμβολοσειρά JSON",
e164: "αριθμός E.164",
jwt: "JWT",
template_literal: "είσοδος"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (typeof issue2.expected === "string" && /^[A-Z]/.test(issue2.expected)) {
return `Μη έγκυρη είσοδος: αναμενόταν instanceof ${issue2.expected}, λήφθηκε ${received}`;
}
return `Μη έγκυρη είσοδος: αναμενόταν ${expected}, λήφθηκε ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Μη έγκυρη είσοδος: αναμενόταν ${stringifyPrimitive(issue2.values[0])}`;
return `Μη έγκυρη επιλογή: αναμενόταν ένα από ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Πολύ μεγάλο: αναμενόταν ${issue2.origin ?? "τιμή"} να έχει ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "στοιχεία"}`;
return `Πολύ μεγάλο: αναμενόταν ${issue2.origin ?? "τιμή"} να είναι ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Πολύ μικρό: αναμενόταν ${issue2.origin} να έχει ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Πολύ μικρό: αναμενόταν ${issue2.origin} να είναι ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `Μη έγκυρη συμβολοσειρά: πρέπει να ξεκινά με "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Μη έγκυρη συμβολοσειρά: πρέπει να τελειώνει με "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Μη έγκυρη συμβολοσειρά: πρέπει να περιέχει "${_issue.includes}"`;
if (_issue.format === "regex")
return `Μη έγκυρη συμβολοσειρά: πρέπει να ταιριάζει με το μοτίβο ${_issue.pattern}`;
return `Μη έγκυρο: ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Μη έγκυρος αριθμός: πρέπει να είναι πολλαπλάσιο του ${issue2.divisor}`;
case "unrecognized_keys":
return `Άγνωστ${issue2.keys.length > 1 ? "α" : "ο"} κλειδ${issue2.keys.length > 1 ? "ιά" : "ί"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Μη έγκυρο κλειδί στο ${issue2.origin}`;
case "invalid_union":
return "Μη έγκυρη είσοδος";
case "invalid_element":
return `Μη έγκυρη τιμή στο ${issue2.origin}`;
default:
return `Μη έγκυρη είσοδος`;
}
};
};
function el_default() {
return {
localeError: error9()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/en.js
var error10 = () => {
const Sizable = {
string: { unit: "characters", verb: "to have" },
file: { unit: "bytes", verb: "to have" },
array: { unit: "items", verb: "to have" },
set: { unit: "items", verb: "to have" },
map: { unit: "entries", verb: "to have" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "input",
email: "email address",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO datetime",
date: "ISO date",
time: "ISO time",
duration: "ISO duration",
ipv4: "IPv4 address",
ipv6: "IPv6 address",
mac: "MAC address",
cidrv4: "IPv4 range",
cidrv6: "IPv6 range",
base64: "base64-encoded string",
base64url: "base64url-encoded string",
json_string: "JSON string",
e164: "E.164 number",
jwt: "JWT",
template_literal: "input"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
return `Invalid input: expected ${expected}, received ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Invalid input: expected ${stringifyPrimitive(issue2.values[0])}`;
return `Invalid option: expected one of ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Too big: expected ${issue2.origin ?? "value"} to have ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elements"}`;
return `Too big: expected ${issue2.origin ?? "value"} to be ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Too small: expected ${issue2.origin} to have ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Too small: expected ${issue2.origin} to be ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `Invalid string: must start with "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Invalid string: must end with "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Invalid string: must include "${_issue.includes}"`;
if (_issue.format === "regex")
return `Invalid string: must match pattern ${_issue.pattern}`;
return `Invalid ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Invalid number: must be a multiple of ${issue2.divisor}`;
case "unrecognized_keys":
return `Unrecognized key${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Invalid key in ${issue2.origin}`;
case "invalid_union":
if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) {
const opts = issue2.options.map((o) => `'${o}'`).join(" | ");
return `Invalid discriminator value. Expected ${opts}`;
}
return "Invalid input";
case "invalid_element":
return `Invalid value in ${issue2.origin}`;
default:
return `Invalid input`;
}
};
};
function en_default() {
return {
localeError: error10()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/eo.js
var error11 = () => {
const Sizable = {
string: { unit: "karaktrojn", verb: "havi" },
file: { unit: "bajtojn", verb: "havi" },
array: { unit: "elementojn", verb: "havi" },
set: { unit: "elementojn", verb: "havi" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "enigo",
email: "retadreso",
url: "URL",
emoji: "emoĝio",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO-datotempo",
date: "ISO-dato",
time: "ISO-tempo",
duration: "ISO-daŭro",
ipv4: "IPv4-adreso",
ipv6: "IPv6-adreso",
cidrv4: "IPv4-rango",
cidrv6: "IPv6-rango",
base64: "64-ume kodita karaktraro",
base64url: "URL-64-ume kodita karaktraro",
json_string: "JSON-karaktraro",
e164: "E.164-nombro",
jwt: "JWT",
template_literal: "enigo"
};
const TypeDictionary = {
nan: "NaN",
number: "nombro",
array: "tabelo",
null: "senvalora"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Nevalida enigo: atendiĝis instanceof ${issue2.expected}, riceviĝis ${received}`;
}
return `Nevalida enigo: atendiĝis ${expected}, riceviĝis ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Nevalida enigo: atendiĝis ${stringifyPrimitive(issue2.values[0])}`;
return `Nevalida opcio: atendiĝis unu el ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Tro granda: atendiĝis ke ${issue2.origin ?? "valoro"} havu ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementojn"}`;
return `Tro granda: atendiĝis ke ${issue2.origin ?? "valoro"} havu ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Tro malgranda: atendiĝis ke ${issue2.origin} havu ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Tro malgranda: atendiĝis ke ${issue2.origin} estu ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Nevalida karaktraro: devas komenciĝi per "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Nevalida karaktraro: devas finiĝi per "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Nevalida karaktraro: devas inkluzivi "${_issue.includes}"`;
if (_issue.format === "regex")
return `Nevalida karaktraro: devas kongrui kun la modelo ${_issue.pattern}`;
return `Nevalida ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Nevalida nombro: devas esti oblo de ${issue2.divisor}`;
case "unrecognized_keys":
return `Nekonata${issue2.keys.length > 1 ? "j" : ""} ŝlosilo${issue2.keys.length > 1 ? "j" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Nevalida ŝlosilo en ${issue2.origin}`;
case "invalid_union":
return "Nevalida enigo";
case "invalid_element":
return `Nevalida valoro en ${issue2.origin}`;
default:
return `Nevalida enigo`;
}
};
};
function eo_default() {
return {
localeError: error11()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/es.js
var error12 = () => {
const Sizable = {
string: { unit: "caracteres", verb: "tener" },
file: { unit: "bytes", verb: "tener" },
array: { unit: "elementos", verb: "tener" },
set: { unit: "elementos", verb: "tener" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "entrada",
email: "dirección de correo electrónico",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "fecha y hora ISO",
date: "fecha ISO",
time: "hora ISO",
duration: "duración ISO",
ipv4: "dirección IPv4",
ipv6: "dirección IPv6",
cidrv4: "rango IPv4",
cidrv6: "rango IPv6",
base64: "cadena codificada en base64",
base64url: "URL codificada en base64",
json_string: "cadena JSON",
e164: "número E.164",
jwt: "JWT",
template_literal: "entrada"
};
const TypeDictionary = {
nan: "NaN",
string: "texto",
number: "número",
boolean: "booleano",
array: "arreglo",
object: "objeto",
set: "conjunto",
file: "archivo",
date: "fecha",
bigint: "número grande",
symbol: "símbolo",
undefined: "indefinido",
null: "nulo",
function: "función",
map: "mapa",
record: "registro",
tuple: "tupla",
enum: "enumeración",
union: "unión",
literal: "literal",
promise: "promesa",
void: "vacío",
never: "nunca",
unknown: "desconocido",
any: "cualquiera"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Entrada inválida: se esperaba instanceof ${issue2.expected}, recibido ${received}`;
}
return `Entrada inválida: se esperaba ${expected}, recibido ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Entrada inválida: se esperaba ${stringifyPrimitive(issue2.values[0])}`;
return `Opción inválida: se esperaba una de ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
const origin = TypeDictionary[issue2.origin] ?? issue2.origin;
if (sizing)
return `Demasiado grande: se esperaba que ${origin ?? "valor"} tuviera ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementos"}`;
return `Demasiado grande: se esperaba que ${origin ?? "valor"} fuera ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
const origin = TypeDictionary[issue2.origin] ?? issue2.origin;
if (sizing) {
return `Demasiado pequeño: se esperaba que ${origin} tuviera ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Demasiado pequeño: se esperaba que ${origin} fuera ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Cadena inválida: debe comenzar con "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Cadena inválida: debe terminar en "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Cadena inválida: debe incluir "${_issue.includes}"`;
if (_issue.format === "regex")
return `Cadena inválida: debe coincidir con el patrón ${_issue.pattern}`;
return `Inválido ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Número inválido: debe ser múltiplo de ${issue2.divisor}`;
case "unrecognized_keys":
return `Llave${issue2.keys.length > 1 ? "s" : ""} desconocida${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Llave inválida en ${TypeDictionary[issue2.origin] ?? issue2.origin}`;
case "invalid_union":
return "Entrada inválida";
case "invalid_element":
return `Valor inválido en ${TypeDictionary[issue2.origin] ?? issue2.origin}`;
default:
return `Entrada inválida`;
}
};
};
function es_default() {
return {
localeError: error12()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/fa.js
var error13 = () => {
const Sizable = {
string: { unit: "کاراکتر", verb: "داشته باشد" },
file: { unit: "بایت", verb: "داشته باشد" },
array: { unit: "آیتم", verb: "داشته باشد" },
set: { unit: "آیتم", verb: "داشته باشد" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "ورودی",
email: "آدرس ایمیل",
url: "URL",
emoji: "ایموجی",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "تاریخ و زمان ایزو",
date: "تاریخ ایزو",
time: "زمان ایزو",
duration: "مدت زمان ایزو",
ipv4: "IPv4 آدرس",
ipv6: "IPv6 آدرس",
cidrv4: "IPv4 دامنه",
cidrv6: "IPv6 دامنه",
base64: "base64-encoded رشته",
base64url: "base64url-encoded رشته",
json_string: "JSON رشته",
e164: "E.164 عدد",
jwt: "JWT",
template_literal: "ورودی"
};
const TypeDictionary = {
nan: "NaN",
number: "عدد",
array: "آرایه"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `ورودی نامعتبر: میبایست instanceof ${issue2.expected} میبود، ${received} دریافت شد`;
}
return `ورودی نامعتبر: میبایست ${expected} میبود، ${received} دریافت شد`;
}
case "invalid_value":
if (issue2.values.length === 1) {
return `ورودی نامعتبر: میبایست ${stringifyPrimitive(issue2.values[0])} میبود`;
}
return `گزینه نامعتبر: میبایست یکی از ${joinValues(issue2.values, "|")} میبود`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `خیلی بزرگ: ${issue2.origin ?? "مقدار"} باید ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "عنصر"} باشد`;
}
return `خیلی بزرگ: ${issue2.origin ?? "مقدار"} باید ${adj}${issue2.maximum.toString()} باشد`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `خیلی کوچک: ${issue2.origin} باید ${adj}${issue2.minimum.toString()} ${sizing.unit} باشد`;
}
return `خیلی کوچک: ${issue2.origin} باید ${adj}${issue2.minimum.toString()} باشد`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `رشته نامعتبر: باید با "${_issue.prefix}" شروع شود`;
}
if (_issue.format === "ends_with") {
return `رشته نامعتبر: باید با "${_issue.suffix}" تمام شود`;
}
if (_issue.format === "includes") {
return `رشته نامعتبر: باید شامل "${_issue.includes}" باشد`;
}
if (_issue.format === "regex") {
return `رشته نامعتبر: باید با الگوی ${_issue.pattern} مطابقت داشته باشد`;
}
return `${FormatDictionary[_issue.format] ?? issue2.format} نامعتبر`;
}
case "not_multiple_of":
return `عدد نامعتبر: باید مضرب ${issue2.divisor} باشد`;
case "unrecognized_keys":
return `کلید${issue2.keys.length > 1 ? "های" : ""} ناشناس: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `کلید ناشناس در ${issue2.origin}`;
case "invalid_union":
return `ورودی نامعتبر`;
case "invalid_element":
return `مقدار نامعتبر در ${issue2.origin}`;
default:
return `ورودی نامعتبر`;
}
};
};
function fa_default() {
return {
localeError: error13()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/fi.js
var error14 = () => {
const Sizable = {
string: { unit: "merkkiä", subject: "merkkijonon" },
file: { unit: "tavua", subject: "tiedoston" },
array: { unit: "alkiota", subject: "listan" },
set: { unit: "alkiota", subject: "joukon" },
number: { unit: "", subject: "luvun" },
bigint: { unit: "", subject: "suuren kokonaisluvun" },
int: { unit: "", subject: "kokonaisluvun" },
date: { unit: "", subject: "päivämäärän" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "säännöllinen lauseke",
email: "sähköpostiosoite",
url: "URL-osoite",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO-aikaleima",
date: "ISO-päivämäärä",
time: "ISO-aika",
duration: "ISO-kesto",
ipv4: "IPv4-osoite",
ipv6: "IPv6-osoite",
cidrv4: "IPv4-alue",
cidrv6: "IPv6-alue",
base64: "base64-koodattu merkkijono",
base64url: "base64url-koodattu merkkijono",
json_string: "JSON-merkkijono",
e164: "E.164-luku",
jwt: "JWT",
template_literal: "templaattimerkkijono"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Virheellinen tyyppi: odotettiin instanceof ${issue2.expected}, oli ${received}`;
}
return `Virheellinen tyyppi: odotettiin ${expected}, oli ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Virheellinen syöte: täytyy olla ${stringifyPrimitive(issue2.values[0])}`;
return `Virheellinen valinta: täytyy olla yksi seuraavista: ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Liian suuri: ${sizing.subject} täytyy olla ${adj}${issue2.maximum.toString()} ${sizing.unit}`.trim();
}
return `Liian suuri: arvon täytyy olla ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Liian pieni: ${sizing.subject} täytyy olla ${adj}${issue2.minimum.toString()} ${sizing.unit}`.trim();
}
return `Liian pieni: arvon täytyy olla ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Virheellinen syöte: täytyy alkaa "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Virheellinen syöte: täytyy loppua "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Virheellinen syöte: täytyy sisältää "${_issue.includes}"`;
if (_issue.format === "regex") {
return `Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${_issue.pattern}`;
}
return `Virheellinen ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Virheellinen luku: täytyy olla luvun ${issue2.divisor} monikerta`;
case "unrecognized_keys":
return `${issue2.keys.length > 1 ? "Tuntemattomat avaimet" : "Tuntematon avain"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return "Virheellinen avain tietueessa";
case "invalid_union":
return "Virheellinen unioni";
case "invalid_element":
return "Virheellinen arvo joukossa";
default:
return `Virheellinen syöte`;
}
};
};
function fi_default() {
return {
localeError: error14()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/fr.js
var error15 = () => {
const Sizable = {
string: { unit: "caractères", verb: "avoir" },
file: { unit: "octets", verb: "avoir" },
array: { unit: "éléments", verb: "avoir" },
set: { unit: "éléments", verb: "avoir" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "entrée",
email: "adresse e-mail",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "date et heure ISO",
date: "date ISO",
time: "heure ISO",
duration: "durée ISO",
ipv4: "adresse IPv4",
ipv6: "adresse IPv6",
cidrv4: "plage IPv4",
cidrv6: "plage IPv6",
base64: "chaîne encodée en base64",
base64url: "chaîne encodée en base64url",
json_string: "chaîne JSON",
e164: "numéro E.164",
jwt: "JWT",
template_literal: "entrée"
};
const TypeDictionary = {
string: "chaîne",
number: "nombre",
int: "entier",
boolean: "booléen",
bigint: "grand entier",
symbol: "symbole",
undefined: "indéfini",
null: "null",
never: "jamais",
void: "vide",
date: "date",
array: "tableau",
object: "objet",
tuple: "tuple",
record: "enregistrement",
map: "carte",
set: "ensemble",
file: "fichier",
nonoptional: "non-optionnel",
nan: "NaN",
function: "fonction"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Entrée invalide : instanceof ${issue2.expected} attendu, ${received} reçu`;
}
return `Entrée invalide : ${expected} attendu, ${received} reçu`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Entrée invalide : ${stringifyPrimitive(issue2.values[0])} attendu`;
return `Option invalide : une valeur parmi ${joinValues(issue2.values, "|")} attendue`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Trop grand : ${TypeDictionary[issue2.origin] ?? "valeur"} doit ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "élément(s)"}`;
return `Trop grand : ${TypeDictionary[issue2.origin] ?? "valeur"} doit être ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Trop petit : ${TypeDictionary[issue2.origin] ?? "valeur"} doit ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
return `Trop petit : ${TypeDictionary[issue2.origin] ?? "valeur"} doit être ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Chaîne invalide : doit commencer par "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Chaîne invalide : doit se terminer par "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Chaîne invalide : doit inclure "${_issue.includes}"`;
if (_issue.format === "regex")
return `Chaîne invalide : doit correspondre au modèle ${_issue.pattern}`;
return `${FormatDictionary[_issue.format] ?? issue2.format} invalide`;
}
case "not_multiple_of":
return `Nombre invalide : doit être un multiple de ${issue2.divisor}`;
case "unrecognized_keys":
return `Clé${issue2.keys.length > 1 ? "s" : ""} non reconnue${issue2.keys.length > 1 ? "s" : ""} : ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Clé invalide dans ${issue2.origin}`;
case "invalid_union":
return "Entrée invalide";
case "invalid_element":
return `Valeur invalide dans ${issue2.origin}`;
default:
return `Entrée invalide`;
}
};
};
function fr_default() {
return {
localeError: error15()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/fr-CA.js
var error16 = () => {
const Sizable = {
string: { unit: "caractères", verb: "avoir" },
file: { unit: "octets", verb: "avoir" },
array: { unit: "éléments", verb: "avoir" },
set: { unit: "éléments", verb: "avoir" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "entrée",
email: "adresse courriel",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "date-heure ISO",
date: "date ISO",
time: "heure ISO",
duration: "durée ISO",
ipv4: "adresse IPv4",
ipv6: "adresse IPv6",
cidrv4: "plage IPv4",
cidrv6: "plage IPv6",
base64: "chaîne encodée en base64",
base64url: "chaîne encodée en base64url",
json_string: "chaîne JSON",
e164: "numéro E.164",
jwt: "JWT",
template_literal: "entrée"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Entrée invalide : attendu instanceof ${issue2.expected}, reçu ${received}`;
}
return `Entrée invalide : attendu ${expected}, reçu ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Entrée invalide : attendu ${stringifyPrimitive(issue2.values[0])}`;
return `Option invalide : attendu l'une des valeurs suivantes ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "≤" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Trop grand : attendu que ${issue2.origin ?? "la valeur"} ait ${adj}${issue2.maximum.toString()} ${sizing.unit}`;
return `Trop grand : attendu que ${issue2.origin ?? "la valeur"} soit ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? "≥" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Trop petit : attendu que ${issue2.origin} ait ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Trop petit : attendu que ${issue2.origin} soit ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `Chaîne invalide : doit commencer par "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Chaîne invalide : doit se terminer par "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Chaîne invalide : doit inclure "${_issue.includes}"`;
if (_issue.format === "regex")
return `Chaîne invalide : doit correspondre au motif ${_issue.pattern}`;
return `${FormatDictionary[_issue.format] ?? issue2.format} invalide`;
}
case "not_multiple_of":
return `Nombre invalide : doit être un multiple de ${issue2.divisor}`;
case "unrecognized_keys":
return `Clé${issue2.keys.length > 1 ? "s" : ""} non reconnue${issue2.keys.length > 1 ? "s" : ""} : ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Clé invalide dans ${issue2.origin}`;
case "invalid_union":
return "Entrée invalide";
case "invalid_element":
return `Valeur invalide dans ${issue2.origin}`;
default:
return `Entrée invalide`;
}
};
};
function fr_CA_default() {
return {
localeError: error16()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/he.js
var error17 = () => {
const TypeNames = {
string: { label: "מחרוזת", gender: "f" },
number: { label: "מספר", gender: "m" },
boolean: { label: "ערך בוליאני", gender: "m" },
bigint: { label: "BigInt", gender: "m" },
date: { label: "תאריך", gender: "m" },
array: { label: "מערך", gender: "m" },
object: { label: "אובייקט", gender: "m" },
null: { label: "ערך ריק (null)", gender: "m" },
undefined: { label: "ערך לא מוגדר (undefined)", gender: "m" },
symbol: { label: "סימבול (Symbol)", gender: "m" },
function: { label: "פונקציה", gender: "f" },
map: { label: "מפה (Map)", gender: "f" },
set: { label: "קבוצה (Set)", gender: "f" },
file: { label: "קובץ", gender: "m" },
promise: { label: "Promise", gender: "m" },
NaN: { label: "NaN", gender: "m" },
unknown: { label: "ערך לא ידוע", gender: "m" },
value: { label: "ערך", gender: "m" }
};
const Sizable = {
string: { unit: "תווים", shortLabel: "קצר", longLabel: "ארוך" },
file: { unit: "בייטים", shortLabel: "קטן", longLabel: "גדול" },
array: { unit: "פריטים", shortLabel: "קטן", longLabel: "גדול" },
set: { unit: "פריטים", shortLabel: "קטן", longLabel: "גדול" },
number: { unit: "", shortLabel: "קטן", longLabel: "גדול" }
};
const typeEntry = (t) => t ? TypeNames[t] : undefined;
const typeLabel = (t) => {
const e = typeEntry(t);
if (e)
return e.label;
return t ?? TypeNames.unknown.label;
};
const withDefinite = (t) => `ה${typeLabel(t)}`;
const verbFor = (t) => {
const e = typeEntry(t);
const gender = e?.gender ?? "m";
return gender === "f" ? "צריכה להיות" : "צריך להיות";
};
const getSizing = (origin) => {
if (!origin)
return null;
return Sizable[origin] ?? null;
};
const FormatDictionary = {
regex: { label: "קלט", gender: "m" },
email: { label: "כתובת אימייל", gender: "f" },
url: { label: "כתובת רשת", gender: "f" },
emoji: { label: "אימוג'י", gender: "m" },
uuid: { label: "UUID", gender: "m" },
nanoid: { label: "nanoid", gender: "m" },
guid: { label: "GUID", gender: "m" },
cuid: { label: "cuid", gender: "m" },
cuid2: { label: "cuid2", gender: "m" },
ulid: { label: "ULID", gender: "m" },
xid: { label: "XID", gender: "m" },
ksuid: { label: "KSUID", gender: "m" },
datetime: { label: "תאריך וזמן ISO", gender: "m" },
date: { label: "תאריך ISO", gender: "m" },
time: { label: "זמן ISO", gender: "m" },
duration: { label: "משך זמן ISO", gender: "m" },
ipv4: { label: "כתובת IPv4", gender: "f" },
ipv6: { label: "כתובת IPv6", gender: "f" },
cidrv4: { label: "טווח IPv4", gender: "m" },
cidrv6: { label: "טווח IPv6", gender: "m" },
base64: { label: "מחרוזת בבסיס 64", gender: "f" },
base64url: { label: "מחרוזת בבסיס 64 לכתובות רשת", gender: "f" },
json_string: { label: "מחרוזת JSON", gender: "f" },
e164: { label: "מספר E.164", gender: "m" },
jwt: { label: "JWT", gender: "m" },
ends_with: { label: "קלט", gender: "m" },
includes: { label: "קלט", gender: "m" },
lowercase: { label: "קלט", gender: "m" },
starts_with: { label: "קלט", gender: "m" },
uppercase: { label: "קלט", gender: "m" }
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expectedKey = issue2.expected;
const expected = TypeDictionary[expectedKey ?? ""] ?? typeLabel(expectedKey);
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? TypeNames[receivedType]?.label ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `קלט לא תקין: צריך להיות instanceof ${issue2.expected}, התקבל ${received}`;
}
return `קלט לא תקין: צריך להיות ${expected}, התקבל ${received}`;
}
case "invalid_value": {
if (issue2.values.length === 1) {
return `ערך לא תקין: הערך חייב להיות ${stringifyPrimitive(issue2.values[0])}`;
}
const stringified = issue2.values.map((v) => stringifyPrimitive(v));
if (issue2.values.length === 2) {
return `ערך לא תקין: האפשרויות המתאימות הן ${stringified[0]} או ${stringified[1]}`;
}
const lastValue = stringified[stringified.length - 1];
const restValues = stringified.slice(0, -1).join(", ");
return `ערך לא תקין: האפשרויות המתאימות הן ${restValues} או ${lastValue}`;
}
case "too_big": {
const sizing = getSizing(issue2.origin);
const subject = withDefinite(issue2.origin ?? "value");
if (issue2.origin === "string") {
return `${sizing?.longLabel ?? "ארוך"} מדי: ${subject} צריכה להכיל ${issue2.maximum.toString()} ${sizing?.unit ?? ""} ${issue2.inclusive ? "או פחות" : "לכל היותר"}`.trim();
}
if (issue2.origin === "number") {
const comparison = issue2.inclusive ? `קטן או שווה ל-${issue2.maximum}` : `קטן מ-${issue2.maximum}`;
return `גדול מדי: ${subject} צריך להיות ${comparison}`;
}
if (issue2.origin === "array" || issue2.origin === "set") {
const verb = issue2.origin === "set" ? "צריכה" : "צריך";
const comparison = issue2.inclusive ? `${issue2.maximum} ${sizing?.unit ?? ""} או פחות` : `פחות מ-${issue2.maximum} ${sizing?.unit ?? ""}`;
return `גדול מדי: ${subject} ${verb} להכיל ${comparison}`.trim();
}
const adj = issue2.inclusive ? "<=" : "<";
const be = verbFor(issue2.origin ?? "value");
if (sizing?.unit) {
return `${sizing.longLabel} מדי: ${subject} ${be} ${adj}${issue2.maximum.toString()} ${sizing.unit}`;
}
return `${sizing?.longLabel ?? "גדול"} מדי: ${subject} ${be} ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const sizing = getSizing(issue2.origin);
const subject = withDefinite(issue2.origin ?? "value");
if (issue2.origin === "string") {
return `${sizing?.shortLabel ?? "קצר"} מדי: ${subject} צריכה להכיל ${issue2.minimum.toString()} ${sizing?.unit ?? ""} ${issue2.inclusive ? "או יותר" : "לפחות"}`.trim();
}
if (issue2.origin === "number") {
const comparison = issue2.inclusive ? `גדול או שווה ל-${issue2.minimum}` : `גדול מ-${issue2.minimum}`;
return `קטן מדי: ${subject} צריך להיות ${comparison}`;
}
if (issue2.origin === "array" || issue2.origin === "set") {
const verb = issue2.origin === "set" ? "צריכה" : "צריך";
if (issue2.minimum === 1 && issue2.inclusive) {
const singularPhrase = issue2.origin === "set" ? "לפחות פריט אחד" : "לפחות פריט אחד";
return `קטן מדי: ${subject} ${verb} להכיל ${singularPhrase}`;
}
const comparison = issue2.inclusive ? `${issue2.minimum} ${sizing?.unit ?? ""} או יותר` : `יותר מ-${issue2.minimum} ${sizing?.unit ?? ""}`;
return `קטן מדי: ${subject} ${verb} להכיל ${comparison}`.trim();
}
const adj = issue2.inclusive ? ">=" : ">";
const be = verbFor(issue2.origin ?? "value");
if (sizing?.unit) {
return `${sizing.shortLabel} מדי: ${subject} ${be} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `${sizing?.shortLabel ?? "קטן"} מדי: ${subject} ${be} ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `המחרוזת חייבת להתחיל ב "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `המחרוזת חייבת להסתיים ב "${_issue.suffix}"`;
if (_issue.format === "includes")
return `המחרוזת חייבת לכלול "${_issue.includes}"`;
if (_issue.format === "regex")
return `המחרוזת חייבת להתאים לתבנית ${_issue.pattern}`;
const nounEntry = FormatDictionary[_issue.format];
const noun = nounEntry?.label ?? _issue.format;
const gender = nounEntry?.gender ?? "m";
const adjective = gender === "f" ? "תקינה" : "תקין";
return `${noun} לא ${adjective}`;
}
case "not_multiple_of":
return `מספר לא תקין: חייב להיות מכפלה של ${issue2.divisor}`;
case "unrecognized_keys":
return `מפתח${issue2.keys.length > 1 ? "ות" : ""} לא מזוה${issue2.keys.length > 1 ? "ים" : "ה"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key": {
return `שדה לא תקין באובייקט`;
}
case "invalid_union":
return "קלט לא תקין";
case "invalid_element": {
const place = withDefinite(issue2.origin ?? "array");
return `ערך לא תקין ב${place}`;
}
default:
return `קלט לא תקין`;
}
};
};
function he_default() {
return {
localeError: error17()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/hr.js
var error18 = () => {
const Sizable = {
string: { unit: "znakova", verb: "imati" },
file: { unit: "bajtova", verb: "imati" },
array: { unit: "stavki", verb: "imati" },
set: { unit: "stavki", verb: "imati" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "unos",
email: "email adresa",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO datum i vrijeme",
date: "ISO datum",
time: "ISO vrijeme",
duration: "ISO trajanje",
ipv4: "IPv4 adresa",
ipv6: "IPv6 adresa",
cidrv4: "IPv4 raspon",
cidrv6: "IPv6 raspon",
base64: "base64 kodirani tekst",
base64url: "base64url kodirani tekst",
json_string: "JSON tekst",
e164: "E.164 broj",
jwt: "JWT",
template_literal: "unos"
};
const TypeDictionary = {
nan: "NaN",
string: "tekst",
number: "broj",
boolean: "boolean",
array: "niz",
object: "objekt",
set: "skup",
file: "datoteka",
date: "datum",
bigint: "bigint",
symbol: "simbol",
undefined: "undefined",
null: "null",
function: "funkcija",
map: "mapa"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Neispravan unos: očekuje se instanceof ${issue2.expected}, a primljeno je ${received}`;
}
return `Neispravan unos: očekuje se ${expected}, a primljeno je ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Neispravna vrijednost: očekivano ${stringifyPrimitive(issue2.values[0])}`;
return `Neispravna opcija: očekivano jedno od ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
const origin = TypeDictionary[issue2.origin] ?? issue2.origin;
if (sizing)
return `Preveliko: očekivano da ${origin ?? "vrijednost"} ima ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elemenata"}`;
return `Preveliko: očekivano da ${origin ?? "vrijednost"} bude ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
const origin = TypeDictionary[issue2.origin] ?? issue2.origin;
if (sizing) {
return `Premalo: očekivano da ${origin} ima ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Premalo: očekivano da ${origin} bude ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Neispravan tekst: mora započinjati s "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Neispravan tekst: mora završavati s "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Neispravan tekst: mora sadržavati "${_issue.includes}"`;
if (_issue.format === "regex")
return `Neispravan tekst: mora odgovarati uzorku ${_issue.pattern}`;
return `Neispravna ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Neispravan broj: mora biti višekratnik od ${issue2.divisor}`;
case "unrecognized_keys":
return `Neprepoznat${issue2.keys.length > 1 ? "i ključevi" : " ključ"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Neispravan ključ u ${TypeDictionary[issue2.origin] ?? issue2.origin}`;
case "invalid_union":
return "Neispravan unos";
case "invalid_element":
return `Neispravna vrijednost u ${TypeDictionary[issue2.origin] ?? issue2.origin}`;
default:
return `Neispravan unos`;
}
};
};
function hr_default() {
return {
localeError: error18()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/hu.js
var error19 = () => {
const Sizable = {
string: { unit: "karakter", verb: "legyen" },
file: { unit: "byte", verb: "legyen" },
array: { unit: "elem", verb: "legyen" },
set: { unit: "elem", verb: "legyen" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "bemenet",
email: "email cím",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO időbélyeg",
date: "ISO dátum",
time: "ISO idő",
duration: "ISO időintervallum",
ipv4: "IPv4 cím",
ipv6: "IPv6 cím",
cidrv4: "IPv4 tartomány",
cidrv6: "IPv6 tartomány",
base64: "base64-kódolt string",
base64url: "base64url-kódolt string",
json_string: "JSON string",
e164: "E.164 szám",
jwt: "JWT",
template_literal: "bemenet"
};
const TypeDictionary = {
nan: "NaN",
number: "szám",
array: "tömb"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Érvénytelen bemenet: a várt érték instanceof ${issue2.expected}, a kapott érték ${received}`;
}
return `Érvénytelen bemenet: a várt érték ${expected}, a kapott érték ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Érvénytelen bemenet: a várt érték ${stringifyPrimitive(issue2.values[0])}`;
return `Érvénytelen opció: valamelyik érték várt ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Túl nagy: ${issue2.origin ?? "érték"} mérete túl nagy ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elem"}`;
return `Túl nagy: a bemeneti érték ${issue2.origin ?? "érték"} túl nagy: ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Túl kicsi: a bemeneti érték ${issue2.origin} mérete túl kicsi ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Túl kicsi: a bemeneti érték ${issue2.origin} túl kicsi ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Érvénytelen string: "${_issue.prefix}" értékkel kell kezdődnie`;
if (_issue.format === "ends_with")
return `Érvénytelen string: "${_issue.suffix}" értékkel kell végződnie`;
if (_issue.format === "includes")
return `Érvénytelen string: "${_issue.includes}" értéket kell tartalmaznia`;
if (_issue.format === "regex")
return `Érvénytelen string: ${_issue.pattern} mintának kell megfelelnie`;
return `Érvénytelen ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Érvénytelen szám: ${issue2.divisor} többszörösének kell lennie`;
case "unrecognized_keys":
return `Ismeretlen kulcs${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Érvénytelen kulcs ${issue2.origin}`;
case "invalid_union":
return "Érvénytelen bemenet";
case "invalid_element":
return `Érvénytelen érték: ${issue2.origin}`;
default:
return `Érvénytelen bemenet`;
}
};
};
function hu_default() {
return {
localeError: error19()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/hy.js
function getArmenianPlural(count2, one, many) {
return Math.abs(count2) === 1 ? one : many;
}
function withDefiniteArticle(word) {
if (!word)
return "";
const vowels = ["ա", "ե", "ը", "ի", "ո", "ու", "օ"];
const lastChar = word[word.length - 1];
return word + (vowels.includes(lastChar) ? "ն" : "ը");
}
var error20 = () => {
const Sizable = {
string: {
unit: {
one: "նշան",
many: "նշաններ"
},
verb: "ունենալ"
},
file: {
unit: {
one: "բայթ",
many: "բայթեր"
},
verb: "ունենալ"
},
array: {
unit: {
one: "տարր",
many: "տարրեր"
},
verb: "ունենալ"
},
set: {
unit: {
one: "տարր",
many: "տարրեր"
},
verb: "ունենալ"
}
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "մուտք",
email: "էլ. հասցե",
url: "URL",
emoji: "էմոջի",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO ամսաթիվ և ժամ",
date: "ISO ամսաթիվ",
time: "ISO ժամ",
duration: "ISO տևողություն",
ipv4: "IPv4 հասցե",
ipv6: "IPv6 հասցե",
cidrv4: "IPv4 միջակայք",
cidrv6: "IPv6 միջակայք",
base64: "base64 ձևաչափով տող",
base64url: "base64url ձևաչափով տող",
json_string: "JSON տող",
e164: "E.164 համար",
jwt: "JWT",
template_literal: "մուտք"
};
const TypeDictionary = {
nan: "NaN",
number: "թիվ",
array: "զանգված"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Սխալ մուտքագրում․ սպասվում էր instanceof ${issue2.expected}, ստացվել է ${received}`;
}
return `Սխալ մուտքագրում․ սպասվում էր ${expected}, ստացվել է ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Սխալ մուտքագրում․ սպասվում էր ${stringifyPrimitive(issue2.values[1])}`;
return `Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
const maxValue = Number(issue2.maximum);
const unit = getArmenianPlural(maxValue, sizing.unit.one, sizing.unit.many);
return `Չափազանց մեծ արժեք․ սպասվում է, որ ${withDefiniteArticle(issue2.origin ?? "արժեք")} կունենա ${adj}${issue2.maximum.toString()} ${unit}`;
}
return `Չափազանց մեծ արժեք․ սպասվում է, որ ${withDefiniteArticle(issue2.origin ?? "արժեք")} լինի ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
const minValue = Number(issue2.minimum);
const unit = getArmenianPlural(minValue, sizing.unit.one, sizing.unit.many);
return `Չափազանց փոքր արժեք․ սպասվում է, որ ${withDefiniteArticle(issue2.origin)} կունենա ${adj}${issue2.minimum.toString()} ${unit}`;
}
return `Չափազանց փոքր արժեք․ սպասվում է, որ ${withDefiniteArticle(issue2.origin)} լինի ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Սխալ տող․ պետք է սկսվի "${_issue.prefix}"-ով`;
if (_issue.format === "ends_with")
return `Սխալ տող․ պետք է ավարտվի "${_issue.suffix}"-ով`;
if (_issue.format === "includes")
return `Սխալ տող․ պետք է պարունակի "${_issue.includes}"`;
if (_issue.format === "regex")
return `Սխալ տող․ պետք է համապատասխանի ${_issue.pattern} ձևաչափին`;
return `Սխալ ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Սխալ թիվ․ պետք է բազմապատիկ լինի ${issue2.divisor}-ի`;
case "unrecognized_keys":
return `Չճանաչված բանալի${issue2.keys.length > 1 ? "ներ" : ""}. ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Սխալ բանալի ${withDefiniteArticle(issue2.origin)}-ում`;
case "invalid_union":
return "Սխալ մուտքագրում";
case "invalid_element":
return `Սխալ արժեք ${withDefiniteArticle(issue2.origin)}-ում`;
default:
return `Սխալ մուտքագրում`;
}
};
};
function hy_default() {
return {
localeError: error20()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/id.js
var error21 = () => {
const Sizable = {
string: { unit: "karakter", verb: "memiliki" },
file: { unit: "byte", verb: "memiliki" },
array: { unit: "item", verb: "memiliki" },
set: { unit: "item", verb: "memiliki" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "input",
email: "alamat email",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "tanggal dan waktu format ISO",
date: "tanggal format ISO",
time: "jam format ISO",
duration: "durasi format ISO",
ipv4: "alamat IPv4",
ipv6: "alamat IPv6",
cidrv4: "rentang alamat IPv4",
cidrv6: "rentang alamat IPv6",
base64: "string dengan enkode base64",
base64url: "string dengan enkode base64url",
json_string: "string JSON",
e164: "angka E.164",
jwt: "JWT",
template_literal: "input"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Input tidak valid: diharapkan instanceof ${issue2.expected}, diterima ${received}`;
}
return `Input tidak valid: diharapkan ${expected}, diterima ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Input tidak valid: diharapkan ${stringifyPrimitive(issue2.values[0])}`;
return `Pilihan tidak valid: diharapkan salah satu dari ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Terlalu besar: diharapkan ${issue2.origin ?? "value"} memiliki ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elemen"}`;
return `Terlalu besar: diharapkan ${issue2.origin ?? "value"} menjadi ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Terlalu kecil: diharapkan ${issue2.origin} memiliki ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Terlalu kecil: diharapkan ${issue2.origin} menjadi ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `String tidak valid: harus dimulai dengan "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `String tidak valid: harus berakhir dengan "${_issue.suffix}"`;
if (_issue.format === "includes")
return `String tidak valid: harus menyertakan "${_issue.includes}"`;
if (_issue.format === "regex")
return `String tidak valid: harus sesuai pola ${_issue.pattern}`;
return `${FormatDictionary[_issue.format] ?? issue2.format} tidak valid`;
}
case "not_multiple_of":
return `Angka tidak valid: harus kelipatan dari ${issue2.divisor}`;
case "unrecognized_keys":
return `Kunci tidak dikenali ${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Kunci tidak valid di ${issue2.origin}`;
case "invalid_union":
return "Input tidak valid";
case "invalid_element":
return `Nilai tidak valid di ${issue2.origin}`;
default:
return `Input tidak valid`;
}
};
};
function id_default() {
return {
localeError: error21()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/is.js
var error22 = () => {
const Sizable = {
string: { unit: "stafi", verb: "að hafa" },
file: { unit: "bæti", verb: "að hafa" },
array: { unit: "hluti", verb: "að hafa" },
set: { unit: "hluti", verb: "að hafa" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "gildi",
email: "netfang",
url: "vefslóð",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO dagsetning og tími",
date: "ISO dagsetning",
time: "ISO tími",
duration: "ISO tímalengd",
ipv4: "IPv4 address",
ipv6: "IPv6 address",
cidrv4: "IPv4 range",
cidrv6: "IPv6 range",
base64: "base64-encoded strengur",
base64url: "base64url-encoded strengur",
json_string: "JSON strengur",
e164: "E.164 tölugildi",
jwt: "JWT",
template_literal: "gildi"
};
const TypeDictionary = {
nan: "NaN",
number: "númer",
array: "fylki"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Rangt gildi: Þú slóst inn ${received} þar sem á að vera instanceof ${issue2.expected}`;
}
return `Rangt gildi: Þú slóst inn ${received} þar sem á að vera ${expected}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Rangt gildi: gert ráð fyrir ${stringifyPrimitive(issue2.values[0])}`;
return `Ógilt val: má vera eitt af eftirfarandi ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Of stórt: gert er ráð fyrir að ${issue2.origin ?? "gildi"} hafi ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "hluti"}`;
return `Of stórt: gert er ráð fyrir að ${issue2.origin ?? "gildi"} sé ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Of lítið: gert er ráð fyrir að ${issue2.origin} hafi ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Of lítið: gert er ráð fyrir að ${issue2.origin} sé ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `Ógildur strengur: verður að byrja á "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Ógildur strengur: verður að enda á "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Ógildur strengur: verður að innihalda "${_issue.includes}"`;
if (_issue.format === "regex")
return `Ógildur strengur: verður að fylgja mynstri ${_issue.pattern}`;
return `Rangt ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Röng tala: verður að vera margfeldi af ${issue2.divisor}`;
case "unrecognized_keys":
return `Óþekkt ${issue2.keys.length > 1 ? "ir lyklar" : "ur lykill"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Rangur lykill í ${issue2.origin}`;
case "invalid_union":
return "Rangt gildi";
case "invalid_element":
return `Rangt gildi í ${issue2.origin}`;
default:
return `Rangt gildi`;
}
};
};
function is_default() {
return {
localeError: error22()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/it.js
var error23 = () => {
const Sizable = {
string: { unit: "caratteri", verb: "avere" },
file: { unit: "byte", verb: "avere" },
array: { unit: "elementi", verb: "avere" },
set: { unit: "elementi", verb: "avere" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "input",
email: "indirizzo email",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "data e ora ISO",
date: "data ISO",
time: "ora ISO",
duration: "durata ISO",
ipv4: "indirizzo IPv4",
ipv6: "indirizzo IPv6",
cidrv4: "intervallo IPv4",
cidrv6: "intervallo IPv6",
base64: "stringa codificata in base64",
base64url: "URL codificata in base64",
json_string: "stringa JSON",
e164: "numero E.164",
jwt: "JWT",
template_literal: "input"
};
const TypeDictionary = {
nan: "NaN",
number: "numero",
array: "vettore"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Input non valido: atteso instanceof ${issue2.expected}, ricevuto ${received}`;
}
return `Input non valido: atteso ${expected}, ricevuto ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Input non valido: atteso ${stringifyPrimitive(issue2.values[0])}`;
return `Opzione non valida: atteso uno tra ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Troppo grande: ${issue2.origin ?? "valore"} deve avere ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementi"}`;
return `Troppo grande: ${issue2.origin ?? "valore"} deve essere ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Troppo piccolo: ${issue2.origin} deve avere ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Troppo piccolo: ${issue2.origin} deve essere ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Stringa non valida: deve iniziare con "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Stringa non valida: deve terminare con "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Stringa non valida: deve includere "${_issue.includes}"`;
if (_issue.format === "regex")
return `Stringa non valida: deve corrispondere al pattern ${_issue.pattern}`;
return `Input non valido: ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Numero non valido: deve essere un multiplo di ${issue2.divisor}`;
case "unrecognized_keys":
return `Chiav${issue2.keys.length > 1 ? "i" : "e"} non riconosciut${issue2.keys.length > 1 ? "e" : "a"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Chiave non valida in ${issue2.origin}`;
case "invalid_union":
return "Input non valido";
case "invalid_element":
return `Valore non valido in ${issue2.origin}`;
default:
return `Input non valido`;
}
};
};
function it_default() {
return {
localeError: error23()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/ja.js
var error24 = () => {
const Sizable = {
string: { unit: "文字", verb: "である" },
file: { unit: "バイト", verb: "である" },
array: { unit: "要素", verb: "である" },
set: { unit: "要素", verb: "である" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "入力値",
email: "メールアドレス",
url: "URL",
emoji: "絵文字",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO日時",
date: "ISO日付",
time: "ISO時刻",
duration: "ISO期間",
ipv4: "IPv4アドレス",
ipv6: "IPv6アドレス",
cidrv4: "IPv4範囲",
cidrv6: "IPv6範囲",
base64: "base64エンコード文字列",
base64url: "base64urlエンコード文字列",
json_string: "JSON文字列",
e164: "E.164番号",
jwt: "JWT",
template_literal: "入力値"
};
const TypeDictionary = {
nan: "NaN",
number: "数値",
array: "配列"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `無効な入力: instanceof ${issue2.expected}が期待されましたが、${received}が入力されました`;
}
return `無効な入力: ${expected}が期待されましたが、${received}が入力されました`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `無効な入力: ${stringifyPrimitive(issue2.values[0])}が期待されました`;
return `無効な選択: ${joinValues(issue2.values, "、")}のいずれかである必要があります`;
case "too_big": {
const adj = issue2.inclusive ? "以下である" : "より小さい";
const sizing = getSizing(issue2.origin);
if (sizing)
return `大きすぎる値: ${issue2.origin ?? "値"}は${issue2.maximum.toString()}${sizing.unit ?? "要素"}${adj}必要があります`;
return `大きすぎる値: ${issue2.origin ?? "値"}は${issue2.maximum.toString()}${adj}必要があります`;
}
case "too_small": {
const adj = issue2.inclusive ? "以上である" : "より大きい";
const sizing = getSizing(issue2.origin);
if (sizing)
return `小さすぎる値: ${issue2.origin}は${issue2.minimum.toString()}${sizing.unit}${adj}必要があります`;
return `小さすぎる値: ${issue2.origin}は${issue2.minimum.toString()}${adj}必要があります`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `無効な文字列: "${_issue.prefix}"で始まる必要があります`;
if (_issue.format === "ends_with")
return `無効な文字列: "${_issue.suffix}"で終わる必要があります`;
if (_issue.format === "includes")
return `無効な文字列: "${_issue.includes}"を含む必要があります`;
if (_issue.format === "regex")
return `無効な文字列: パターン${_issue.pattern}に一致する必要があります`;
return `無効な${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `無効な数値: ${issue2.divisor}の倍数である必要があります`;
case "unrecognized_keys":
return `認識されていないキー${issue2.keys.length > 1 ? "群" : ""}: ${joinValues(issue2.keys, "、")}`;
case "invalid_key":
return `${issue2.origin}内の無効なキー`;
case "invalid_union":
return "無効な入力";
case "invalid_element":
return `${issue2.origin}内の無効な値`;
default:
return `無効な入力`;
}
};
};
function ja_default() {
return {
localeError: error24()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/ka.js
var error25 = () => {
const Sizable = {
string: { unit: "სიმბოლო", verb: "უნდა შეიცავდეს" },
file: { unit: "ბაიტი", verb: "უნდა შეიცავდეს" },
array: { unit: "ელემენტი", verb: "უნდა შეიცავდეს" },
set: { unit: "ელემენტი", verb: "უნდა შეიცავდეს" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "შეყვანა",
email: "ელ-ფოსტის მისამართი",
url: "URL",
emoji: "ემოჯი",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "თარიღი-დრო",
date: "თარიღი",
time: "დრო",
duration: "ხანგრძლივობა",
ipv4: "IPv4 მისამართი",
ipv6: "IPv6 მისამართი",
cidrv4: "IPv4 დიაპაზონი",
cidrv6: "IPv6 დიაპაზონი",
base64: "base64-კოდირებული ველი",
base64url: "base64url-კოდირებული ველი",
json_string: "JSON ველი",
e164: "E.164 ნომერი",
jwt: "JWT",
template_literal: "შეყვანა"
};
const TypeDictionary = {
nan: "NaN",
number: "რიცხვი",
string: "ველი",
boolean: "ბულეანი",
function: "ფუნქცია",
array: "მასივი"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `არასწორი შეყვანა: მოსალოდნელი instanceof ${issue2.expected}, მიღებული ${received}`;
}
return `არასწორი შეყვანა: მოსალოდნელი ${expected}, მიღებული ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `არასწორი შეყვანა: მოსალოდნელი ${stringifyPrimitive(issue2.values[0])}`;
return `არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${joinValues(issue2.values, "|")}-დან`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `ზედმეტად დიდი: მოსალოდნელი ${issue2.origin ?? "მნიშვნელობა"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit}`;
return `ზედმეტად დიდი: მოსალოდნელი ${issue2.origin ?? "მნიშვნელობა"} იყოს ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `ზედმეტად პატარა: მოსალოდნელი ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `ზედმეტად პატარა: მოსალოდნელი ${issue2.origin} იყოს ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `არასწორი ველი: უნდა იწყებოდეს "${_issue.prefix}"-ით`;
}
if (_issue.format === "ends_with")
return `არასწორი ველი: უნდა მთავრდებოდეს "${_issue.suffix}"-ით`;
if (_issue.format === "includes")
return `არასწორი ველი: უნდა შეიცავდეს "${_issue.includes}"-ს`;
if (_issue.format === "regex")
return `არასწორი ველი: უნდა შეესაბამებოდეს შაბლონს ${_issue.pattern}`;
return `არასწორი ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `არასწორი რიცხვი: უნდა იყოს ${issue2.divisor}-ის ჯერადი`;
case "unrecognized_keys":
return `უცნობი გასაღებ${issue2.keys.length > 1 ? "ები" : "ი"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `არასწორი გასაღები ${issue2.origin}-ში`;
case "invalid_union":
return "არასწორი შეყვანა";
case "invalid_element":
return `არასწორი მნიშვნელობა ${issue2.origin}-ში`;
default:
return `არასწორი შეყვანა`;
}
};
};
function ka_default() {
return {
localeError: error25()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/km.js
var error26 = () => {
const Sizable = {
string: { unit: "តួអក្សរ", verb: "គួរមាន" },
file: { unit: "បៃ", verb: "គួរមាន" },
array: { unit: "ធាតុ", verb: "គួរមាន" },
set: { unit: "ធាតុ", verb: "គួរមាន" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "ទិន្នន័យបញ្ចូល",
email: "អាសយដ្ឋានអ៊ីមែល",
url: "URL",
emoji: "សញ្ញាអារម្មណ៍",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "កាលបរិច្ឆេទ និងម៉ោង ISO",
date: "កាលបរិច្ឆេទ ISO",
time: "ម៉ោង ISO",
duration: "រយៈពេល ISO",
ipv4: "អាសយដ្ឋាន IPv4",
ipv6: "អាសយដ្ឋាន IPv6",
cidrv4: "ដែនអាសយដ្ឋាន IPv4",
cidrv6: "ដែនអាសយដ្ឋាន IPv6",
base64: "ខ្សែអក្សរអ៊ិកូដ base64",
base64url: "ខ្សែអក្សរអ៊ិកូដ base64url",
json_string: "ខ្សែអក្សរ JSON",
e164: "លេខ E.164",
jwt: "JWT",
template_literal: "ទិន្នន័យបញ្ចូល"
};
const TypeDictionary = {
nan: "NaN",
number: "លេខ",
array: "អារេ (Array)",
null: "គ្មានតម្លៃ (null)"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${issue2.expected} ប៉ុន្តែទទួលបាន ${received}`;
}
return `ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${expected} ប៉ុន្តែទទួលបាន ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${stringifyPrimitive(issue2.values[0])}`;
return `ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `ធំពេក៖ ត្រូវការ ${issue2.origin ?? "តម្លៃ"} ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "ធាតុ"}`;
return `ធំពេក៖ ត្រូវការ ${issue2.origin ?? "តម្លៃ"} ${adj} ${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `តូចពេក៖ ត្រូវការ ${issue2.origin} ${adj} ${issue2.minimum.toString()} ${sizing.unit}`;
}
return `តូចពេក៖ ត្រូវការ ${issue2.origin} ${adj} ${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${_issue.suffix}"`;
if (_issue.format === "includes")
return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${_issue.includes}"`;
if (_issue.format === "regex")
return `ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${_issue.pattern}`;
return `មិនត្រឹមត្រូវ៖ ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${issue2.divisor}`;
case "unrecognized_keys":
return `រកឃើញសោមិនស្គាល់៖ ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `សោមិនត្រឹមត្រូវនៅក្នុង ${issue2.origin}`;
case "invalid_union":
return `ទិន្នន័យមិនត្រឹមត្រូវ`;
case "invalid_element":
return `ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${issue2.origin}`;
default:
return `ទិន្នន័យមិនត្រឹមត្រូវ`;
}
};
};
function km_default() {
return {
localeError: error26()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/kh.js
function kh_default() {
return km_default();
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/ko.js
var error27 = () => {
const Sizable = {
string: { unit: "문자", verb: "to have" },
file: { unit: "바이트", verb: "to have" },
array: { unit: "개", verb: "to have" },
set: { unit: "개", verb: "to have" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "입력",
email: "이메일 주소",
url: "URL",
emoji: "이모지",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO 날짜시간",
date: "ISO 날짜",
time: "ISO 시간",
duration: "ISO 기간",
ipv4: "IPv4 주소",
ipv6: "IPv6 주소",
cidrv4: "IPv4 범위",
cidrv6: "IPv6 범위",
base64: "base64 인코딩 문자열",
base64url: "base64url 인코딩 문자열",
json_string: "JSON 문자열",
e164: "E.164 번호",
jwt: "JWT",
template_literal: "입력"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `잘못된 입력: 예상 타입은 instanceof ${issue2.expected}, 받은 타입은 ${received}입니다`;
}
return `잘못된 입력: 예상 타입은 ${expected}, 받은 타입은 ${received}입니다`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `잘못된 입력: 값은 ${stringifyPrimitive(issue2.values[0])} 이어야 합니다`;
return `잘못된 옵션: ${joinValues(issue2.values, "또는 ")} 중 하나여야 합니다`;
case "too_big": {
const adj = issue2.inclusive ? "이하" : "미만";
const suffix = adj === "미만" ? "이어야 합니다" : "여야 합니다";
const sizing = getSizing(issue2.origin);
const unit = sizing?.unit ?? "요소";
if (sizing)
return `${issue2.origin ?? "값"}이 너무 큽니다: ${issue2.maximum.toString()}${unit} ${adj}${suffix}`;
return `${issue2.origin ?? "값"}이 너무 큽니다: ${issue2.maximum.toString()} ${adj}${suffix}`;
}
case "too_small": {
const adj = issue2.inclusive ? "이상" : "초과";
const suffix = adj === "이상" ? "이어야 합니다" : "여야 합니다";
const sizing = getSizing(issue2.origin);
const unit = sizing?.unit ?? "요소";
if (sizing) {
return `${issue2.origin ?? "값"}이 너무 작습니다: ${issue2.minimum.toString()}${unit} ${adj}${suffix}`;
}
return `${issue2.origin ?? "값"}이 너무 작습니다: ${issue2.minimum.toString()} ${adj}${suffix}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `잘못된 문자열: "${_issue.prefix}"(으)로 시작해야 합니다`;
}
if (_issue.format === "ends_with")
return `잘못된 문자열: "${_issue.suffix}"(으)로 끝나야 합니다`;
if (_issue.format === "includes")
return `잘못된 문자열: "${_issue.includes}"을(를) 포함해야 합니다`;
if (_issue.format === "regex")
return `잘못된 문자열: 정규식 ${_issue.pattern} 패턴과 일치해야 합니다`;
return `잘못된 ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `잘못된 숫자: ${issue2.divisor}의 배수여야 합니다`;
case "unrecognized_keys":
return `인식할 수 없는 키: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `잘못된 키: ${issue2.origin}`;
case "invalid_union":
return `잘못된 입력`;
case "invalid_element":
return `잘못된 값: ${issue2.origin}`;
default:
return `잘못된 입력`;
}
};
};
function ko_default() {
return {
localeError: error27()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/lt.js
var capitalizeFirstCharacter = (text) => {
return text.charAt(0).toUpperCase() + text.slice(1);
};
function getUnitTypeFromNumber(number2) {
const abs = Math.abs(number2);
const last = abs % 10;
const last2 = abs % 100;
if (last2 >= 11 && last2 <= 19 || last === 0)
return "many";
if (last === 1)
return "one";
return "few";
}
var error28 = () => {
const Sizable = {
string: {
unit: {
one: "simbolis",
few: "simboliai",
many: "simbolių"
},
verb: {
smaller: {
inclusive: "turi būti ne ilgesnė kaip",
notInclusive: "turi būti trumpesnė kaip"
},
bigger: {
inclusive: "turi būti ne trumpesnė kaip",
notInclusive: "turi būti ilgesnė kaip"
}
}
},
file: {
unit: {
one: "baitas",
few: "baitai",
many: "baitų"
},
verb: {
smaller: {
inclusive: "turi būti ne didesnis kaip",
notInclusive: "turi būti mažesnis kaip"
},
bigger: {
inclusive: "turi būti ne mažesnis kaip",
notInclusive: "turi būti didesnis kaip"
}
}
},
array: {
unit: {
one: "elementą",
few: "elementus",
many: "elementų"
},
verb: {
smaller: {
inclusive: "turi turėti ne daugiau kaip",
notInclusive: "turi turėti mažiau kaip"
},
bigger: {
inclusive: "turi turėti ne mažiau kaip",
notInclusive: "turi turėti daugiau kaip"
}
}
},
set: {
unit: {
one: "elementą",
few: "elementus",
many: "elementų"
},
verb: {
smaller: {
inclusive: "turi turėti ne daugiau kaip",
notInclusive: "turi turėti mažiau kaip"
},
bigger: {
inclusive: "turi turėti ne mažiau kaip",
notInclusive: "turi turėti daugiau kaip"
}
}
}
};
function getSizing(origin, unitType, inclusive, targetShouldBe) {
const result = Sizable[origin] ?? null;
if (result === null)
return result;
return {
unit: result.unit[unitType],
verb: result.verb[targetShouldBe][inclusive ? "inclusive" : "notInclusive"]
};
}
const FormatDictionary = {
regex: "įvestis",
email: "el. pašto adresas",
url: "URL",
emoji: "jaustukas",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO data ir laikas",
date: "ISO data",
time: "ISO laikas",
duration: "ISO trukmė",
ipv4: "IPv4 adresas",
ipv6: "IPv6 adresas",
cidrv4: "IPv4 tinklo prefiksas (CIDR)",
cidrv6: "IPv6 tinklo prefiksas (CIDR)",
base64: "base64 užkoduota eilutė",
base64url: "base64url užkoduota eilutė",
json_string: "JSON eilutė",
e164: "E.164 numeris",
jwt: "JWT",
template_literal: "įvestis"
};
const TypeDictionary = {
nan: "NaN",
number: "skaičius",
bigint: "sveikasis skaičius",
string: "eilutė",
boolean: "loginė reikšmė",
undefined: "neapibrėžta reikšmė",
function: "funkcija",
symbol: "simbolis",
array: "masyvas",
object: "objektas",
null: "nulinė reikšmė"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Gautas tipas ${received}, o tikėtasi - instanceof ${issue2.expected}`;
}
return `Gautas tipas ${received}, o tikėtasi - ${expected}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Privalo būti ${stringifyPrimitive(issue2.values[0])}`;
return `Privalo būti vienas iš ${joinValues(issue2.values, "|")} pasirinkimų`;
case "too_big": {
const origin = TypeDictionary[issue2.origin] ?? issue2.origin;
const sizing = getSizing(issue2.origin, getUnitTypeFromNumber(Number(issue2.maximum)), issue2.inclusive ?? false, "smaller");
if (sizing?.verb)
return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reikšmė")} ${sizing.verb} ${issue2.maximum.toString()} ${sizing.unit ?? "elementų"}`;
const adj = issue2.inclusive ? "ne didesnis kaip" : "mažesnis kaip";
return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reikšmė")} turi būti ${adj} ${issue2.maximum.toString()} ${sizing?.unit}`;
}
case "too_small": {
const origin = TypeDictionary[issue2.origin] ?? issue2.origin;
const sizing = getSizing(issue2.origin, getUnitTypeFromNumber(Number(issue2.minimum)), issue2.inclusive ?? false, "bigger");
if (sizing?.verb)
return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reikšmė")} ${sizing.verb} ${issue2.minimum.toString()} ${sizing.unit ?? "elementų"}`;
const adj = issue2.inclusive ? "ne mažesnis kaip" : "didesnis kaip";
return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reikšmė")} turi būti ${adj} ${issue2.minimum.toString()} ${sizing?.unit}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `Eilutė privalo prasidėti "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Eilutė privalo pasibaigti "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Eilutė privalo įtraukti "${_issue.includes}"`;
if (_issue.format === "regex")
return `Eilutė privalo atitikti ${_issue.pattern}`;
return `Neteisingas ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Skaičius privalo būti ${issue2.divisor} kartotinis.`;
case "unrecognized_keys":
return `Neatpažint${issue2.keys.length > 1 ? "i" : "as"} rakt${issue2.keys.length > 1 ? "ai" : "as"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return "Rastas klaidingas raktas";
case "invalid_union":
return "Klaidinga įvestis";
case "invalid_element": {
const origin = TypeDictionary[issue2.origin] ?? issue2.origin;
return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reikšmė")} turi klaidingą įvestį`;
}
default:
return "Klaidinga įvestis";
}
};
};
function lt_default() {
return {
localeError: error28()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/mk.js
var error29 = () => {
const Sizable = {
string: { unit: "знаци", verb: "да имаат" },
file: { unit: "бајти", verb: "да имаат" },
array: { unit: "ставки", verb: "да имаат" },
set: { unit: "ставки", verb: "да имаат" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "внес",
email: "адреса на е-пошта",
url: "URL",
emoji: "емоџи",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO датум и време",
date: "ISO датум",
time: "ISO време",
duration: "ISO времетраење",
ipv4: "IPv4 адреса",
ipv6: "IPv6 адреса",
cidrv4: "IPv4 опсег",
cidrv6: "IPv6 опсег",
base64: "base64-енкодирана низа",
base64url: "base64url-енкодирана низа",
json_string: "JSON низа",
e164: "E.164 број",
jwt: "JWT",
template_literal: "внес"
};
const TypeDictionary = {
nan: "NaN",
number: "број",
array: "низа"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Грешен внес: се очекува instanceof ${issue2.expected}, примено ${received}`;
}
return `Грешен внес: се очекува ${expected}, примено ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Invalid input: expected ${stringifyPrimitive(issue2.values[0])}`;
return `Грешана опција: се очекува една ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Премногу голем: се очекува ${issue2.origin ?? "вредноста"} да има ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "елементи"}`;
return `Премногу голем: се очекува ${issue2.origin ?? "вредноста"} да биде ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Премногу мал: се очекува ${issue2.origin} да има ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Премногу мал: се очекува ${issue2.origin} да биде ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `Неважечка низа: мора да започнува со "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Неважечка низа: мора да завршува со "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Неважечка низа: мора да вклучува "${_issue.includes}"`;
if (_issue.format === "regex")
return `Неважечка низа: мора да одгоара на патернот ${_issue.pattern}`;
return `Invalid ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Грешен број: мора да биде делив со ${issue2.divisor}`;
case "unrecognized_keys":
return `${issue2.keys.length > 1 ? "Непрепознаени клучеви" : "Непрепознаен клуч"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Грешен клуч во ${issue2.origin}`;
case "invalid_union":
return "Грешен внес";
case "invalid_element":
return `Грешна вредност во ${issue2.origin}`;
default:
return `Грешен внес`;
}
};
};
function mk_default() {
return {
localeError: error29()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/ms.js
var error30 = () => {
const Sizable = {
string: { unit: "aksara", verb: "mempunyai" },
file: { unit: "bait", verb: "mempunyai" },
array: { unit: "elemen", verb: "mempunyai" },
set: { unit: "elemen", verb: "mempunyai" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "input",
email: "alamat e-mel",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "tarikh masa ISO",
date: "tarikh ISO",
time: "masa ISO",
duration: "tempoh ISO",
ipv4: "alamat IPv4",
ipv6: "alamat IPv6",
cidrv4: "julat IPv4",
cidrv6: "julat IPv6",
base64: "string dikodkan base64",
base64url: "string dikodkan base64url",
json_string: "string JSON",
e164: "nombor E.164",
jwt: "JWT",
template_literal: "input"
};
const TypeDictionary = {
nan: "NaN",
number: "nombor"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Input tidak sah: dijangka instanceof ${issue2.expected}, diterima ${received}`;
}
return `Input tidak sah: dijangka ${expected}, diterima ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Input tidak sah: dijangka ${stringifyPrimitive(issue2.values[0])}`;
return `Pilihan tidak sah: dijangka salah satu daripada ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Terlalu besar: dijangka ${issue2.origin ?? "nilai"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elemen"}`;
return `Terlalu besar: dijangka ${issue2.origin ?? "nilai"} adalah ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Terlalu kecil: dijangka ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Terlalu kecil: dijangka ${issue2.origin} adalah ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `String tidak sah: mesti bermula dengan "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `String tidak sah: mesti berakhir dengan "${_issue.suffix}"`;
if (_issue.format === "includes")
return `String tidak sah: mesti mengandungi "${_issue.includes}"`;
if (_issue.format === "regex")
return `String tidak sah: mesti sepadan dengan corak ${_issue.pattern}`;
return `${FormatDictionary[_issue.format] ?? issue2.format} tidak sah`;
}
case "not_multiple_of":
return `Nombor tidak sah: perlu gandaan ${issue2.divisor}`;
case "unrecognized_keys":
return `Kunci tidak dikenali: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Kunci tidak sah dalam ${issue2.origin}`;
case "invalid_union":
return "Input tidak sah";
case "invalid_element":
return `Nilai tidak sah dalam ${issue2.origin}`;
default:
return `Input tidak sah`;
}
};
};
function ms_default() {
return {
localeError: error30()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/nl.js
var error31 = () => {
const Sizable = {
string: { unit: "tekens", verb: "heeft" },
file: { unit: "bytes", verb: "heeft" },
array: { unit: "elementen", verb: "heeft" },
set: { unit: "elementen", verb: "heeft" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "invoer",
email: "emailadres",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO datum en tijd",
date: "ISO datum",
time: "ISO tijd",
duration: "ISO duur",
ipv4: "IPv4-adres",
ipv6: "IPv6-adres",
cidrv4: "IPv4-bereik",
cidrv6: "IPv6-bereik",
base64: "base64-gecodeerde tekst",
base64url: "base64 URL-gecodeerde tekst",
json_string: "JSON string",
e164: "E.164-nummer",
jwt: "JWT",
template_literal: "invoer"
};
const TypeDictionary = {
nan: "NaN",
number: "getal"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Ongeldige invoer: verwacht instanceof ${issue2.expected}, ontving ${received}`;
}
return `Ongeldige invoer: verwacht ${expected}, ontving ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Ongeldige invoer: verwacht ${stringifyPrimitive(issue2.values[0])}`;
return `Ongeldige optie: verwacht één van ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
const longName = issue2.origin === "date" ? "laat" : issue2.origin === "string" ? "lang" : "groot";
if (sizing)
return `Te ${longName}: verwacht dat ${issue2.origin ?? "waarde"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementen"} ${sizing.verb}`;
return `Te ${longName}: verwacht dat ${issue2.origin ?? "waarde"} ${adj}${issue2.maximum.toString()} is`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
const shortName = issue2.origin === "date" ? "vroeg" : issue2.origin === "string" ? "kort" : "klein";
if (sizing) {
return `Te ${shortName}: verwacht dat ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} ${sizing.verb}`;
}
return `Te ${shortName}: verwacht dat ${issue2.origin} ${adj}${issue2.minimum.toString()} is`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `Ongeldige tekst: moet met "${_issue.prefix}" beginnen`;
}
if (_issue.format === "ends_with")
return `Ongeldige tekst: moet op "${_issue.suffix}" eindigen`;
if (_issue.format === "includes")
return `Ongeldige tekst: moet "${_issue.includes}" bevatten`;
if (_issue.format === "regex")
return `Ongeldige tekst: moet overeenkomen met patroon ${_issue.pattern}`;
return `Ongeldig: ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Ongeldig getal: moet een veelvoud van ${issue2.divisor} zijn`;
case "unrecognized_keys":
return `Onbekende key${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Ongeldige key in ${issue2.origin}`;
case "invalid_union":
return "Ongeldige invoer";
case "invalid_element":
return `Ongeldige waarde in ${issue2.origin}`;
default:
return `Ongeldige invoer`;
}
};
};
function nl_default() {
return {
localeError: error31()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/no.js
var error32 = () => {
const Sizable = {
string: { unit: "tegn", verb: "å ha" },
file: { unit: "bytes", verb: "å ha" },
array: { unit: "elementer", verb: "å inneholde" },
set: { unit: "elementer", verb: "å inneholde" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "input",
email: "e-postadresse",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO dato- og klokkeslett",
date: "ISO-dato",
time: "ISO-klokkeslett",
duration: "ISO-varighet",
ipv4: "IPv4-område",
ipv6: "IPv6-område",
cidrv4: "IPv4-spekter",
cidrv6: "IPv6-spekter",
base64: "base64-enkodet streng",
base64url: "base64url-enkodet streng",
json_string: "JSON-streng",
e164: "E.164-nummer",
jwt: "JWT",
template_literal: "input"
};
const TypeDictionary = {
nan: "NaN",
number: "tall",
array: "liste"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Ugyldig input: forventet instanceof ${issue2.expected}, fikk ${received}`;
}
return `Ugyldig input: forventet ${expected}, fikk ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Ugyldig verdi: forventet ${stringifyPrimitive(issue2.values[0])}`;
return `Ugyldig valg: forventet en av ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `For stor(t): forventet ${issue2.origin ?? "value"} til å ha ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementer"}`;
return `For stor(t): forventet ${issue2.origin ?? "value"} til å ha ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `For lite(n): forventet ${issue2.origin} til å ha ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `For lite(n): forventet ${issue2.origin} til å ha ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Ugyldig streng: må starte med "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Ugyldig streng: må ende med "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Ugyldig streng: må inneholde "${_issue.includes}"`;
if (_issue.format === "regex")
return `Ugyldig streng: må matche mønsteret ${_issue.pattern}`;
return `Ugyldig ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Ugyldig tall: må være et multiplum av ${issue2.divisor}`;
case "unrecognized_keys":
return `${issue2.keys.length > 1 ? "Ukjente nøkler" : "Ukjent nøkkel"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Ugyldig nøkkel i ${issue2.origin}`;
case "invalid_union":
return "Ugyldig input";
case "invalid_element":
return `Ugyldig verdi i ${issue2.origin}`;
default:
return `Ugyldig input`;
}
};
};
function no_default() {
return {
localeError: error32()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/ota.js
var error33 = () => {
const Sizable = {
string: { unit: "harf", verb: "olmalıdır" },
file: { unit: "bayt", verb: "olmalıdır" },
array: { unit: "unsur", verb: "olmalıdır" },
set: { unit: "unsur", verb: "olmalıdır" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "giren",
email: "epostagâh",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO hengâmı",
date: "ISO tarihi",
time: "ISO zamanı",
duration: "ISO müddeti",
ipv4: "IPv4 nişânı",
ipv6: "IPv6 nişânı",
cidrv4: "IPv4 menzili",
cidrv6: "IPv6 menzili",
base64: "base64-şifreli metin",
base64url: "base64url-şifreli metin",
json_string: "JSON metin",
e164: "E.164 sayısı",
jwt: "JWT",
template_literal: "giren"
};
const TypeDictionary = {
nan: "NaN",
number: "numara",
array: "saf",
null: "gayb"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Fâsit giren: umulan instanceof ${issue2.expected}, alınan ${received}`;
}
return `Fâsit giren: umulan ${expected}, alınan ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Fâsit giren: umulan ${stringifyPrimitive(issue2.values[0])}`;
return `Fâsit tercih: mûteberler ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Fazla büyük: ${issue2.origin ?? "value"}, ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elements"} sahip olmalıydı.`;
return `Fazla büyük: ${issue2.origin ?? "value"}, ${adj}${issue2.maximum.toString()} olmalıydı.`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Fazla küçük: ${issue2.origin}, ${adj}${issue2.minimum.toString()} ${sizing.unit} sahip olmalıydı.`;
}
return `Fazla küçük: ${issue2.origin}, ${adj}${issue2.minimum.toString()} olmalıydı.`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Fâsit metin: "${_issue.prefix}" ile başlamalı.`;
if (_issue.format === "ends_with")
return `Fâsit metin: "${_issue.suffix}" ile bitmeli.`;
if (_issue.format === "includes")
return `Fâsit metin: "${_issue.includes}" ihtivâ etmeli.`;
if (_issue.format === "regex")
return `Fâsit metin: ${_issue.pattern} nakşına uymalı.`;
return `Fâsit ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Fâsit sayı: ${issue2.divisor} katı olmalıydı.`;
case "unrecognized_keys":
return `Tanınmayan anahtar ${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `${issue2.origin} için tanınmayan anahtar var.`;
case "invalid_union":
return "Giren tanınamadı.";
case "invalid_element":
return `${issue2.origin} için tanınmayan kıymet var.`;
default:
return `Kıymet tanınamadı.`;
}
};
};
function ota_default() {
return {
localeError: error33()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/ps.js
var error34 = () => {
const Sizable = {
string: { unit: "توکي", verb: "ولري" },
file: { unit: "بایټس", verb: "ولري" },
array: { unit: "توکي", verb: "ولري" },
set: { unit: "توکي", verb: "ولري" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "ورودي",
email: "بریښنالیک",
url: "یو آر ال",
emoji: "ایموجي",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "نیټه او وخت",
date: "نېټه",
time: "وخت",
duration: "موده",
ipv4: "د IPv4 پته",
ipv6: "د IPv6 پته",
cidrv4: "د IPv4 ساحه",
cidrv6: "د IPv6 ساحه",
base64: "base64-encoded متن",
base64url: "base64url-encoded متن",
json_string: "JSON متن",
e164: "د E.164 شمېره",
jwt: "JWT",
template_literal: "ورودي"
};
const TypeDictionary = {
nan: "NaN",
number: "عدد",
array: "ارې"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `ناسم ورودي: باید instanceof ${issue2.expected} وای, مګر ${received} ترلاسه شو`;
}
return `ناسم ورودي: باید ${expected} وای, مګر ${received} ترلاسه شو`;
}
case "invalid_value":
if (issue2.values.length === 1) {
return `ناسم ورودي: باید ${stringifyPrimitive(issue2.values[0])} وای`;
}
return `ناسم انتخاب: باید یو له ${joinValues(issue2.values, "|")} څخه وای`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `ډیر لوی: ${issue2.origin ?? "ارزښت"} باید ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "عنصرونه"} ولري`;
}
return `ډیر لوی: ${issue2.origin ?? "ارزښت"} باید ${adj}${issue2.maximum.toString()} وي`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `ډیر کوچنی: ${issue2.origin} باید ${adj}${issue2.minimum.toString()} ${sizing.unit} ولري`;
}
return `ډیر کوچنی: ${issue2.origin} باید ${adj}${issue2.minimum.toString()} وي`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `ناسم متن: باید د "${_issue.prefix}" سره پیل شي`;
}
if (_issue.format === "ends_with") {
return `ناسم متن: باید د "${_issue.suffix}" سره پای ته ورسيږي`;
}
if (_issue.format === "includes") {
return `ناسم متن: باید "${_issue.includes}" ولري`;
}
if (_issue.format === "regex") {
return `ناسم متن: باید د ${_issue.pattern} سره مطابقت ولري`;
}
return `${FormatDictionary[_issue.format] ?? issue2.format} ناسم دی`;
}
case "not_multiple_of":
return `ناسم عدد: باید د ${issue2.divisor} مضرب وي`;
case "unrecognized_keys":
return `ناسم ${issue2.keys.length > 1 ? "کلیډونه" : "کلیډ"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `ناسم کلیډ په ${issue2.origin} کې`;
case "invalid_union":
return `ناسمه ورودي`;
case "invalid_element":
return `ناسم عنصر په ${issue2.origin} کې`;
default:
return `ناسمه ورودي`;
}
};
};
function ps_default() {
return {
localeError: error34()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/pl.js
var error35 = () => {
const Sizable = {
string: { unit: "znaków", verb: "mieć" },
file: { unit: "bajtów", verb: "mieć" },
array: { unit: "elementów", verb: "mieć" },
set: { unit: "elementów", verb: "mieć" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "wyrażenie",
email: "adres email",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "data i godzina w formacie ISO",
date: "data w formacie ISO",
time: "godzina w formacie ISO",
duration: "czas trwania ISO",
ipv4: "adres IPv4",
ipv6: "adres IPv6",
cidrv4: "zakres IPv4",
cidrv6: "zakres IPv6",
base64: "ciąg znaków zakodowany w formacie base64",
base64url: "ciąg znaków zakodowany w formacie base64url",
json_string: "ciąg znaków w formacie JSON",
e164: "liczba E.164",
jwt: "JWT",
template_literal: "wejście"
};
const TypeDictionary = {
nan: "NaN",
number: "liczba",
array: "tablica"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Nieprawidłowe dane wejściowe: oczekiwano instanceof ${issue2.expected}, otrzymano ${received}`;
}
return `Nieprawidłowe dane wejściowe: oczekiwano ${expected}, otrzymano ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Nieprawidłowe dane wejściowe: oczekiwano ${stringifyPrimitive(issue2.values[0])}`;
return `Nieprawidłowa opcja: oczekiwano jednej z wartości ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Za duża wartość: oczekiwano, że ${issue2.origin ?? "wartość"} będzie mieć ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementów"}`;
}
return `Zbyt duż(y/a/e): oczekiwano, że ${issue2.origin ?? "wartość"} będzie wynosić ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Za mała wartość: oczekiwano, że ${issue2.origin ?? "wartość"} będzie mieć ${adj}${issue2.minimum.toString()} ${sizing.unit ?? "elementów"}`;
}
return `Zbyt mał(y/a/e): oczekiwano, że ${issue2.origin ?? "wartość"} będzie wynosić ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Nieprawidłowy ciąg znaków: musi zaczynać się od "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Nieprawidłowy ciąg znaków: musi kończyć się na "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Nieprawidłowy ciąg znaków: musi zawierać "${_issue.includes}"`;
if (_issue.format === "regex")
return `Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${_issue.pattern}`;
return `Nieprawidłow(y/a/e) ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Nieprawidłowa liczba: musi być wielokrotnością ${issue2.divisor}`;
case "unrecognized_keys":
return `Nierozpoznane klucze${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Nieprawidłowy klucz w ${issue2.origin}`;
case "invalid_union":
return "Nieprawidłowe dane wejściowe";
case "invalid_element":
return `Nieprawidłowa wartość w ${issue2.origin}`;
default:
return `Nieprawidłowe dane wejściowe`;
}
};
};
function pl_default() {
return {
localeError: error35()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/pt.js
var error36 = () => {
const Sizable = {
string: { unit: "caracteres", verb: "ter" },
file: { unit: "bytes", verb: "ter" },
array: { unit: "itens", verb: "ter" },
set: { unit: "itens", verb: "ter" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "padrão",
email: "endereço de e-mail",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "data e hora ISO",
date: "data ISO",
time: "hora ISO",
duration: "duração ISO",
ipv4: "endereço IPv4",
ipv6: "endereço IPv6",
cidrv4: "faixa de IPv4",
cidrv6: "faixa de IPv6",
base64: "texto codificado em base64",
base64url: "URL codificada em base64",
json_string: "texto JSON",
e164: "número E.164",
jwt: "JWT",
template_literal: "entrada"
};
const TypeDictionary = {
nan: "NaN",
number: "número",
null: "nulo"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Tipo inválido: esperado instanceof ${issue2.expected}, recebido ${received}`;
}
return `Tipo inválido: esperado ${expected}, recebido ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Entrada inválida: esperado ${stringifyPrimitive(issue2.values[0])}`;
return `Opção inválida: esperada uma das ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Muito grande: esperado que ${issue2.origin ?? "valor"} tivesse ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementos"}`;
return `Muito grande: esperado que ${issue2.origin ?? "valor"} fosse ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Muito pequeno: esperado que ${issue2.origin} tivesse ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Muito pequeno: esperado que ${issue2.origin} fosse ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Texto inválido: deve começar com "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Texto inválido: deve terminar com "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Texto inválido: deve incluir "${_issue.includes}"`;
if (_issue.format === "regex")
return `Texto inválido: deve corresponder ao padrão ${_issue.pattern}`;
return `${FormatDictionary[_issue.format] ?? issue2.format} inválido`;
}
case "not_multiple_of":
return `Número inválido: deve ser múltiplo de ${issue2.divisor}`;
case "unrecognized_keys":
return `Chave${issue2.keys.length > 1 ? "s" : ""} desconhecida${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Chave inválida em ${issue2.origin}`;
case "invalid_union":
return "Entrada inválida";
case "invalid_element":
return `Valor inválido em ${issue2.origin}`;
default:
return `Campo inválido`;
}
};
};
function pt_default() {
return {
localeError: error36()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/ro.js
var error37 = () => {
const Sizable = {
string: { unit: "caractere", verb: "să aibă" },
file: { unit: "octeți", verb: "să aibă" },
array: { unit: "elemente", verb: "să aibă" },
set: { unit: "elemente", verb: "să aibă" },
map: { unit: "intrări", verb: "să aibă" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "intrare",
email: "adresă de email",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "dată și oră ISO",
date: "dată ISO",
time: "oră ISO",
duration: "durată ISO",
ipv4: "adresă IPv4",
ipv6: "adresă IPv6",
mac: "adresă MAC",
cidrv4: "interval IPv4",
cidrv6: "interval IPv6",
base64: "șir codat base64",
base64url: "șir codat base64url",
json_string: "șir JSON",
e164: "număr E.164",
jwt: "JWT",
template_literal: "intrare"
};
const TypeDictionary = {
nan: "NaN",
string: "șir",
number: "număr",
boolean: "boolean",
function: "funcție",
array: "matrice",
object: "obiect",
undefined: "nedefinit",
symbol: "simbol",
bigint: "număr mare",
void: "void",
never: "never",
map: "hartă",
set: "set"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
return `Intrare invalidă: așteptat ${expected}, primit ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Intrare invalidă: așteptat ${stringifyPrimitive(issue2.values[0])}`;
return `Opțiune invalidă: așteptat una dintre ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Prea mare: așteptat ca ${issue2.origin ?? "valoarea"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elemente"}`;
return `Prea mare: așteptat ca ${issue2.origin ?? "valoarea"} să fie ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Prea mic: așteptat ca ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Prea mic: așteptat ca ${issue2.origin} să fie ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `Șir invalid: trebuie să înceapă cu "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Șir invalid: trebuie să se termine cu "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Șir invalid: trebuie să includă "${_issue.includes}"`;
if (_issue.format === "regex")
return `Șir invalid: trebuie să se potrivească cu modelul ${_issue.pattern}`;
return `Format invalid: ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Număr invalid: trebuie să fie multiplu de ${issue2.divisor}`;
case "unrecognized_keys":
return `Chei nerecunoscute: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Cheie invalidă în ${issue2.origin}`;
case "invalid_union":
return "Intrare invalidă";
case "invalid_element":
return `Valoare invalidă în ${issue2.origin}`;
default:
return `Intrare invalidă`;
}
};
};
function ro_default() {
return {
localeError: error37()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/ru.js
function getRussianPlural(count2, one, few, many) {
const absCount = Math.abs(count2);
const lastDigit = absCount % 10;
const lastTwoDigits = absCount % 100;
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
return many;
}
if (lastDigit === 1) {
return one;
}
if (lastDigit >= 2 && lastDigit <= 4) {
return few;
}
return many;
}
var error38 = () => {
const Sizable = {
string: {
unit: {
one: "символ",
few: "символа",
many: "символов"
},
verb: "иметь"
},
file: {
unit: {
one: "байт",
few: "байта",
many: "байт"
},
verb: "иметь"
},
array: {
unit: {
one: "элемент",
few: "элемента",
many: "элементов"
},
verb: "иметь"
},
set: {
unit: {
one: "элемент",
few: "элемента",
many: "элементов"
},
verb: "иметь"
}
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "ввод",
email: "email адрес",
url: "URL",
emoji: "эмодзи",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO дата и время",
date: "ISO дата",
time: "ISO время",
duration: "ISO длительность",
ipv4: "IPv4 адрес",
ipv6: "IPv6 адрес",
cidrv4: "IPv4 диапазон",
cidrv6: "IPv6 диапазон",
base64: "строка в формате base64",
base64url: "строка в формате base64url",
json_string: "JSON строка",
e164: "номер E.164",
jwt: "JWT",
template_literal: "ввод"
};
const TypeDictionary = {
nan: "NaN",
number: "число",
array: "массив"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Неверный ввод: ожидалось instanceof ${issue2.expected}, получено ${received}`;
}
return `Неверный ввод: ожидалось ${expected}, получено ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Неверный ввод: ожидалось ${stringifyPrimitive(issue2.values[0])}`;
return `Неверный вариант: ожидалось одно из ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
const maxValue = Number(issue2.maximum);
const unit = getRussianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
return `Слишком большое значение: ожидалось, что ${issue2.origin ?? "значение"} будет иметь ${adj}${issue2.maximum.toString()} ${unit}`;
}
return `Слишком большое значение: ожидалось, что ${issue2.origin ?? "значение"} будет ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
const minValue = Number(issue2.minimum);
const unit = getRussianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
return `Слишком маленькое значение: ожидалось, что ${issue2.origin} будет иметь ${adj}${issue2.minimum.toString()} ${unit}`;
}
return `Слишком маленькое значение: ожидалось, что ${issue2.origin} будет ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Неверная строка: должна начинаться с "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Неверная строка: должна заканчиваться на "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Неверная строка: должна содержать "${_issue.includes}"`;
if (_issue.format === "regex")
return `Неверная строка: должна соответствовать шаблону ${_issue.pattern}`;
return `Неверный ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Неверное число: должно быть кратным ${issue2.divisor}`;
case "unrecognized_keys":
return `Нераспознанн${issue2.keys.length > 1 ? "ые" : "ый"} ключ${issue2.keys.length > 1 ? "и" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Неверный ключ в ${issue2.origin}`;
case "invalid_union":
return "Неверные входные данные";
case "invalid_element":
return `Неверное значение в ${issue2.origin}`;
default:
return `Неверные входные данные`;
}
};
};
function ru_default() {
return {
localeError: error38()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/sl.js
var error39 = () => {
const Sizable = {
string: { unit: "znakov", verb: "imeti" },
file: { unit: "bajtov", verb: "imeti" },
array: { unit: "elementov", verb: "imeti" },
set: { unit: "elementov", verb: "imeti" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "vnos",
email: "e-poštni naslov",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO datum in čas",
date: "ISO datum",
time: "ISO čas",
duration: "ISO trajanje",
ipv4: "IPv4 naslov",
ipv6: "IPv6 naslov",
cidrv4: "obseg IPv4",
cidrv6: "obseg IPv6",
base64: "base64 kodiran niz",
base64url: "base64url kodiran niz",
json_string: "JSON niz",
e164: "E.164 številka",
jwt: "JWT",
template_literal: "vnos"
};
const TypeDictionary = {
nan: "NaN",
number: "število",
array: "tabela"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Neveljaven vnos: pričakovano instanceof ${issue2.expected}, prejeto ${received}`;
}
return `Neveljaven vnos: pričakovano ${expected}, prejeto ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Neveljaven vnos: pričakovano ${stringifyPrimitive(issue2.values[0])}`;
return `Neveljavna možnost: pričakovano eno izmed ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Preveliko: pričakovano, da bo ${issue2.origin ?? "vrednost"} imelo ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementov"}`;
return `Preveliko: pričakovano, da bo ${issue2.origin ?? "vrednost"} ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Premajhno: pričakovano, da bo ${issue2.origin} imelo ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Premajhno: pričakovano, da bo ${issue2.origin} ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `Neveljaven niz: mora se začeti z "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Neveljaven niz: mora se končati z "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Neveljaven niz: mora vsebovati "${_issue.includes}"`;
if (_issue.format === "regex")
return `Neveljaven niz: mora ustrezati vzorcu ${_issue.pattern}`;
return `Neveljaven ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Neveljavno število: mora biti večkratnik ${issue2.divisor}`;
case "unrecognized_keys":
return `Neprepoznan${issue2.keys.length > 1 ? "i ključi" : " ključ"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Neveljaven ključ v ${issue2.origin}`;
case "invalid_union":
return "Neveljaven vnos";
case "invalid_element":
return `Neveljavna vrednost v ${issue2.origin}`;
default:
return "Neveljaven vnos";
}
};
};
function sl_default() {
return {
localeError: error39()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/sv.js
var error40 = () => {
const Sizable = {
string: { unit: "tecken", verb: "att ha" },
file: { unit: "bytes", verb: "att ha" },
array: { unit: "objekt", verb: "att innehålla" },
set: { unit: "objekt", verb: "att innehålla" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "reguljärt uttryck",
email: "e-postadress",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO-datum och tid",
date: "ISO-datum",
time: "ISO-tid",
duration: "ISO-varaktighet",
ipv4: "IPv4-intervall",
ipv6: "IPv6-intervall",
cidrv4: "IPv4-spektrum",
cidrv6: "IPv6-spektrum",
base64: "base64-kodad sträng",
base64url: "base64url-kodad sträng",
json_string: "JSON-sträng",
e164: "E.164-nummer",
jwt: "JWT",
template_literal: "mall-literal"
};
const TypeDictionary = {
nan: "NaN",
number: "antal",
array: "lista"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Ogiltig inmatning: förväntat instanceof ${issue2.expected}, fick ${received}`;
}
return `Ogiltig inmatning: förväntat ${expected}, fick ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Ogiltig inmatning: förväntat ${stringifyPrimitive(issue2.values[0])}`;
return `Ogiltigt val: förväntade en av ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `För stor(t): förväntade ${issue2.origin ?? "värdet"} att ha ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "element"}`;
}
return `För stor(t): förväntat ${issue2.origin ?? "värdet"} att ha ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `För lite(t): förväntade ${issue2.origin ?? "värdet"} att ha ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `För lite(t): förväntade ${issue2.origin ?? "värdet"} att ha ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `Ogiltig sträng: måste börja med "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Ogiltig sträng: måste sluta med "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Ogiltig sträng: måste innehålla "${_issue.includes}"`;
if (_issue.format === "regex")
return `Ogiltig sträng: måste matcha mönstret "${_issue.pattern}"`;
return `Ogiltig(t) ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Ogiltigt tal: måste vara en multipel av ${issue2.divisor}`;
case "unrecognized_keys":
return `${issue2.keys.length > 1 ? "Okända nycklar" : "Okänd nyckel"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Ogiltig nyckel i ${issue2.origin ?? "värdet"}`;
case "invalid_union":
return "Ogiltig input";
case "invalid_element":
return `Ogiltigt värde i ${issue2.origin ?? "värdet"}`;
default:
return `Ogiltig input`;
}
};
};
function sv_default() {
return {
localeError: error40()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/ta.js
var error41 = () => {
const Sizable = {
string: { unit: "எழுத்துக்கள்", verb: "கொண்டிருக்க வேண்டும்" },
file: { unit: "பைட்டுகள்", verb: "கொண்டிருக்க வேண்டும்" },
array: { unit: "உறுப்புகள்", verb: "கொண்டிருக்க வேண்டும்" },
set: { unit: "உறுப்புகள்", verb: "கொண்டிருக்க வேண்டும்" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "உள்ளீடு",
email: "மின்னஞ்சல் முகவரி",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO தேதி நேரம்",
date: "ISO தேதி",
time: "ISO நேரம்",
duration: "ISO கால அளவு",
ipv4: "IPv4 முகவரி",
ipv6: "IPv6 முகவரி",
cidrv4: "IPv4 வரம்பு",
cidrv6: "IPv6 வரம்பு",
base64: "base64-encoded சரம்",
base64url: "base64url-encoded சரம்",
json_string: "JSON சரம்",
e164: "E.164 எண்",
jwt: "JWT",
template_literal: "input"
};
const TypeDictionary = {
nan: "NaN",
number: "எண்",
array: "அணி",
null: "வெறுமை"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${issue2.expected}, பெறப்பட்டது ${received}`;
}
return `தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${expected}, பெறப்பட்டது ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${stringifyPrimitive(issue2.values[0])}`;
return `தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${joinValues(issue2.values, "|")} இல் ஒன்று`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `மிக பெரியது: எதிர்பார்க்கப்பட்டது ${issue2.origin ?? "மதிப்பு"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "உறுப்புகள்"} ஆக இருக்க வேண்டும்`;
}
return `மிக பெரியது: எதிர்பார்க்கப்பட்டது ${issue2.origin ?? "மதிப்பு"} ${adj}${issue2.maximum.toString()} ஆக இருக்க வேண்டும்`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} ஆக இருக்க வேண்டும்`;
}
return `மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${issue2.origin} ${adj}${issue2.minimum.toString()} ஆக இருக்க வேண்டும்`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `தவறான சரம்: "${_issue.prefix}" இல் தொடங்க வேண்டும்`;
if (_issue.format === "ends_with")
return `தவறான சரம்: "${_issue.suffix}" இல் முடிவடைய வேண்டும்`;
if (_issue.format === "includes")
return `தவறான சரம்: "${_issue.includes}" ஐ உள்ளடக்க வேண்டும்`;
if (_issue.format === "regex")
return `தவறான சரம்: ${_issue.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;
return `தவறான ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `தவறான எண்: ${issue2.divisor} இன் பலமாக இருக்க வேண்டும்`;
case "unrecognized_keys":
return `அடையாளம் தெரியாத விசை${issue2.keys.length > 1 ? "கள்" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `${issue2.origin} இல் தவறான விசை`;
case "invalid_union":
return "தவறான உள்ளீடு";
case "invalid_element":
return `${issue2.origin} இல் தவறான மதிப்பு`;
default:
return `தவறான உள்ளீடு`;
}
};
};
function ta_default() {
return {
localeError: error41()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/th.js
var error42 = () => {
const Sizable = {
string: { unit: "ตัวอักษร", verb: "ควรมี" },
file: { unit: "ไบต์", verb: "ควรมี" },
array: { unit: "รายการ", verb: "ควรมี" },
set: { unit: "รายการ", verb: "ควรมี" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "ข้อมูลที่ป้อน",
email: "ที่อยู่อีเมล",
url: "URL",
emoji: "อิโมจิ",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "วันที่เวลาแบบ ISO",
date: "วันที่แบบ ISO",
time: "เวลาแบบ ISO",
duration: "ช่วงเวลาแบบ ISO",
ipv4: "ที่อยู่ IPv4",
ipv6: "ที่อยู่ IPv6",
cidrv4: "ช่วง IP แบบ IPv4",
cidrv6: "ช่วง IP แบบ IPv6",
base64: "ข้อความแบบ Base64",
base64url: "ข้อความแบบ Base64 สำหรับ URL",
json_string: "ข้อความแบบ JSON",
e164: "เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",
jwt: "โทเคน JWT",
template_literal: "ข้อมูลที่ป้อน"
};
const TypeDictionary = {
nan: "NaN",
number: "ตัวเลข",
array: "อาร์เรย์ (Array)",
null: "ไม่มีค่า (null)"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${issue2.expected} แต่ได้รับ ${received}`;
}
return `ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${expected} แต่ได้รับ ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `ค่าไม่ถูกต้อง: ควรเป็น ${stringifyPrimitive(issue2.values[0])}`;
return `ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "ไม่เกิน" : "น้อยกว่า";
const sizing = getSizing(issue2.origin);
if (sizing)
return `เกินกำหนด: ${issue2.origin ?? "ค่า"} ควรมี${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "รายการ"}`;
return `เกินกำหนด: ${issue2.origin ?? "ค่า"} ควรมี${adj} ${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? "อย่างน้อย" : "มากกว่า";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `น้อยกว่ากำหนด: ${issue2.origin} ควรมี${adj} ${issue2.minimum.toString()} ${sizing.unit}`;
}
return `น้อยกว่ากำหนด: ${issue2.origin} ควรมี${adj} ${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${_issue.suffix}"`;
if (_issue.format === "includes")
return `รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${_issue.includes}" อยู่ในข้อความ`;
if (_issue.format === "regex")
return `รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${_issue.pattern}`;
return `รูปแบบไม่ถูกต้อง: ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${issue2.divisor} ได้ลงตัว`;
case "unrecognized_keys":
return `พบคีย์ที่ไม่รู้จัก: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `คีย์ไม่ถูกต้องใน ${issue2.origin}`;
case "invalid_union":
return "ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";
case "invalid_element":
return `ข้อมูลไม่ถูกต้องใน ${issue2.origin}`;
default:
return `ข้อมูลไม่ถูกต้อง`;
}
};
};
function th_default() {
return {
localeError: error42()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/tr.js
var error43 = () => {
const Sizable = {
string: { unit: "karakter", verb: "olmalı" },
file: { unit: "bayt", verb: "olmalı" },
array: { unit: "öğe", verb: "olmalı" },
set: { unit: "öğe", verb: "olmalı" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "girdi",
email: "e-posta adresi",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO tarih ve saat",
date: "ISO tarih",
time: "ISO saat",
duration: "ISO süre",
ipv4: "IPv4 adresi",
ipv6: "IPv6 adresi",
cidrv4: "IPv4 aralığı",
cidrv6: "IPv6 aralığı",
base64: "base64 ile şifrelenmiş metin",
base64url: "base64url ile şifrelenmiş metin",
json_string: "JSON dizesi",
e164: "E.164 sayısı",
jwt: "JWT",
template_literal: "Şablon dizesi"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Geçersiz değer: beklenen instanceof ${issue2.expected}, alınan ${received}`;
}
return `Geçersiz değer: beklenen ${expected}, alınan ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Geçersiz değer: beklenen ${stringifyPrimitive(issue2.values[0])}`;
return `Geçersiz seçenek: aşağıdakilerden biri olmalı: ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Çok büyük: beklenen ${issue2.origin ?? "değer"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "öğe"}`;
return `Çok büyük: beklenen ${issue2.origin ?? "değer"} ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Çok küçük: beklenen ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
return `Çok küçük: beklenen ${issue2.origin} ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Geçersiz metin: "${_issue.prefix}" ile başlamalı`;
if (_issue.format === "ends_with")
return `Geçersiz metin: "${_issue.suffix}" ile bitmeli`;
if (_issue.format === "includes")
return `Geçersiz metin: "${_issue.includes}" içermeli`;
if (_issue.format === "regex")
return `Geçersiz metin: ${_issue.pattern} desenine uymalı`;
return `Geçersiz ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Geçersiz sayı: ${issue2.divisor} ile tam bölünebilmeli`;
case "unrecognized_keys":
return `Tanınmayan anahtar${issue2.keys.length > 1 ? "lar" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `${issue2.origin} içinde geçersiz anahtar`;
case "invalid_union":
return "Geçersiz değer";
case "invalid_element":
return `${issue2.origin} içinde geçersiz değer`;
default:
return `Geçersiz değer`;
}
};
};
function tr_default() {
return {
localeError: error43()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/uk.js
var error44 = () => {
const Sizable = {
string: { unit: "символів", verb: "матиме" },
file: { unit: "байтів", verb: "матиме" },
array: { unit: "елементів", verb: "матиме" },
set: { unit: "елементів", verb: "матиме" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "вхідні дані",
email: "адреса електронної пошти",
url: "URL",
emoji: "емодзі",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "дата та час ISO",
date: "дата ISO",
time: "час ISO",
duration: "тривалість ISO",
ipv4: "адреса IPv4",
ipv6: "адреса IPv6",
cidrv4: "діапазон IPv4",
cidrv6: "діапазон IPv6",
base64: "рядок у кодуванні base64",
base64url: "рядок у кодуванні base64url",
json_string: "рядок JSON",
e164: "номер E.164",
jwt: "JWT",
template_literal: "вхідні дані"
};
const TypeDictionary = {
nan: "NaN",
number: "число",
array: "масив"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Неправильні вхідні дані: очікується instanceof ${issue2.expected}, отримано ${received}`;
}
return `Неправильні вхідні дані: очікується ${expected}, отримано ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Неправильні вхідні дані: очікується ${stringifyPrimitive(issue2.values[0])}`;
return `Неправильна опція: очікується одне з ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Занадто велике: очікується, що ${issue2.origin ?? "значення"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "елементів"}`;
return `Занадто велике: очікується, що ${issue2.origin ?? "значення"} буде ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Занадто мале: очікується, що ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Занадто мале: очікується, що ${issue2.origin} буде ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Неправильний рядок: повинен починатися з "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Неправильний рядок: повинен закінчуватися на "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Неправильний рядок: повинен містити "${_issue.includes}"`;
if (_issue.format === "regex")
return `Неправильний рядок: повинен відповідати шаблону ${_issue.pattern}`;
return `Неправильний ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Неправильне число: повинно бути кратним ${issue2.divisor}`;
case "unrecognized_keys":
return `Нерозпізнаний ключ${issue2.keys.length > 1 ? "і" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Неправильний ключ у ${issue2.origin}`;
case "invalid_union":
return "Неправильні вхідні дані";
case "invalid_element":
return `Неправильне значення у ${issue2.origin}`;
default:
return `Неправильні вхідні дані`;
}
};
};
function uk_default() {
return {
localeError: error44()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/ua.js
function ua_default() {
return uk_default();
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/ur.js
var error45 = () => {
const Sizable = {
string: { unit: "حروف", verb: "ہونا" },
file: { unit: "بائٹس", verb: "ہونا" },
array: { unit: "آئٹمز", verb: "ہونا" },
set: { unit: "آئٹمز", verb: "ہونا" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "ان پٹ",
email: "ای میل ایڈریس",
url: "یو آر ایل",
emoji: "ایموجی",
uuid: "یو یو آئی ڈی",
uuidv4: "یو یو آئی ڈی وی 4",
uuidv6: "یو یو آئی ڈی وی 6",
nanoid: "نینو آئی ڈی",
guid: "جی یو آئی ڈی",
cuid: "سی یو آئی ڈی",
cuid2: "سی یو آئی ڈی 2",
ulid: "یو ایل آئی ڈی",
xid: "ایکس آئی ڈی",
ksuid: "کے ایس یو آئی ڈی",
datetime: "آئی ایس او ڈیٹ ٹائم",
date: "آئی ایس او تاریخ",
time: "آئی ایس او وقت",
duration: "آئی ایس او مدت",
ipv4: "آئی پی وی 4 ایڈریس",
ipv6: "آئی پی وی 6 ایڈریس",
cidrv4: "آئی پی وی 4 رینج",
cidrv6: "آئی پی وی 6 رینج",
base64: "بیس 64 ان کوڈڈ سٹرنگ",
base64url: "بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",
json_string: "جے ایس او این سٹرنگ",
e164: "ای 164 نمبر",
jwt: "جے ڈبلیو ٹی",
template_literal: "ان پٹ"
};
const TypeDictionary = {
nan: "NaN",
number: "نمبر",
array: "آرے",
null: "نل"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `غلط ان پٹ: instanceof ${issue2.expected} متوقع تھا، ${received} موصول ہوا`;
}
return `غلط ان پٹ: ${expected} متوقع تھا، ${received} موصول ہوا`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `غلط ان پٹ: ${stringifyPrimitive(issue2.values[0])} متوقع تھا`;
return `غلط آپشن: ${joinValues(issue2.values, "|")} میں سے ایک متوقع تھا`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `بہت بڑا: ${issue2.origin ?? "ویلیو"} کے ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "عناصر"} ہونے متوقع تھے`;
return `بہت بڑا: ${issue2.origin ?? "ویلیو"} کا ${adj}${issue2.maximum.toString()} ہونا متوقع تھا`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `بہت چھوٹا: ${issue2.origin} کے ${adj}${issue2.minimum.toString()} ${sizing.unit} ہونے متوقع تھے`;
}
return `بہت چھوٹا: ${issue2.origin} کا ${adj}${issue2.minimum.toString()} ہونا متوقع تھا`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `غلط سٹرنگ: "${_issue.prefix}" سے شروع ہونا چاہیے`;
}
if (_issue.format === "ends_with")
return `غلط سٹرنگ: "${_issue.suffix}" پر ختم ہونا چاہیے`;
if (_issue.format === "includes")
return `غلط سٹرنگ: "${_issue.includes}" شامل ہونا چاہیے`;
if (_issue.format === "regex")
return `غلط سٹرنگ: پیٹرن ${_issue.pattern} سے میچ ہونا چاہیے`;
return `غلط ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `غلط نمبر: ${issue2.divisor} کا مضاعف ہونا چاہیے`;
case "unrecognized_keys":
return `غیر تسلیم شدہ کی${issue2.keys.length > 1 ? "ز" : ""}: ${joinValues(issue2.keys, "، ")}`;
case "invalid_key":
return `${issue2.origin} میں غلط کی`;
case "invalid_union":
return "غلط ان پٹ";
case "invalid_element":
return `${issue2.origin} میں غلط ویلیو`;
default:
return `غلط ان پٹ`;
}
};
};
function ur_default() {
return {
localeError: error45()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/uz.js
var error46 = () => {
const Sizable = {
string: { unit: "belgi", verb: "bo‘lishi kerak" },
file: { unit: "bayt", verb: "bo‘lishi kerak" },
array: { unit: "element", verb: "bo‘lishi kerak" },
set: { unit: "element", verb: "bo‘lishi kerak" },
map: { unit: "yozuv", verb: "bo‘lishi kerak" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "kirish",
email: "elektron pochta manzili",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO sana va vaqti",
date: "ISO sana",
time: "ISO vaqt",
duration: "ISO davomiylik",
ipv4: "IPv4 manzil",
ipv6: "IPv6 manzil",
mac: "MAC manzil",
cidrv4: "IPv4 diapazon",
cidrv6: "IPv6 diapazon",
base64: "base64 kodlangan satr",
base64url: "base64url kodlangan satr",
json_string: "JSON satr",
e164: "E.164 raqam",
jwt: "JWT",
template_literal: "kirish"
};
const TypeDictionary = {
nan: "NaN",
number: "raqam",
array: "massiv"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Noto‘g‘ri kirish: kutilgan instanceof ${issue2.expected}, qabul qilingan ${received}`;
}
return `Noto‘g‘ri kirish: kutilgan ${expected}, qabul qilingan ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Noto‘g‘ri kirish: kutilgan ${stringifyPrimitive(issue2.values[0])}`;
return `Noto‘g‘ri variant: quyidagilardan biri kutilgan ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Juda katta: kutilgan ${issue2.origin ?? "qiymat"} ${adj}${issue2.maximum.toString()} ${sizing.unit} ${sizing.verb}`;
return `Juda katta: kutilgan ${issue2.origin ?? "qiymat"} ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Juda kichik: kutilgan ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} ${sizing.verb}`;
}
return `Juda kichik: kutilgan ${issue2.origin} ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Noto‘g‘ri satr: "${_issue.prefix}" bilan boshlanishi kerak`;
if (_issue.format === "ends_with")
return `Noto‘g‘ri satr: "${_issue.suffix}" bilan tugashi kerak`;
if (_issue.format === "includes")
return `Noto‘g‘ri satr: "${_issue.includes}" ni o‘z ichiga olishi kerak`;
if (_issue.format === "regex")
return `Noto‘g‘ri satr: ${_issue.pattern} shabloniga mos kelishi kerak`;
return `Noto‘g‘ri ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Noto‘g‘ri raqam: ${issue2.divisor} ning karralisi bo‘lishi kerak`;
case "unrecognized_keys":
return `Noma’lum kalit${issue2.keys.length > 1 ? "lar" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `${issue2.origin} dagi kalit noto‘g‘ri`;
case "invalid_union":
return "Noto‘g‘ri kirish";
case "invalid_element":
return `${issue2.origin} da noto‘g‘ri qiymat`;
default:
return `Noto‘g‘ri kirish`;
}
};
};
function uz_default() {
return {
localeError: error46()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/vi.js
var error47 = () => {
const Sizable = {
string: { unit: "ký tự", verb: "có" },
file: { unit: "byte", verb: "có" },
array: { unit: "phần tử", verb: "có" },
set: { unit: "phần tử", verb: "có" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "đầu vào",
email: "địa chỉ email",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ngày giờ ISO",
date: "ngày ISO",
time: "giờ ISO",
duration: "khoảng thời gian ISO",
ipv4: "địa chỉ IPv4",
ipv6: "địa chỉ IPv6",
cidrv4: "dải IPv4",
cidrv6: "dải IPv6",
base64: "chuỗi mã hóa base64",
base64url: "chuỗi mã hóa base64url",
json_string: "chuỗi JSON",
e164: "số E.164",
jwt: "JWT",
template_literal: "đầu vào"
};
const TypeDictionary = {
nan: "NaN",
number: "số",
array: "mảng"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Đầu vào không hợp lệ: mong đợi instanceof ${issue2.expected}, nhận được ${received}`;
}
return `Đầu vào không hợp lệ: mong đợi ${expected}, nhận được ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Đầu vào không hợp lệ: mong đợi ${stringifyPrimitive(issue2.values[0])}`;
return `Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Quá lớn: mong đợi ${issue2.origin ?? "giá trị"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "phần tử"}`;
return `Quá lớn: mong đợi ${issue2.origin ?? "giá trị"} ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Quá nhỏ: mong đợi ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Quá nhỏ: mong đợi ${issue2.origin} ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Chuỗi không hợp lệ: phải bắt đầu bằng "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Chuỗi không hợp lệ: phải kết thúc bằng "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Chuỗi không hợp lệ: phải bao gồm "${_issue.includes}"`;
if (_issue.format === "regex")
return `Chuỗi không hợp lệ: phải khớp với mẫu ${_issue.pattern}`;
return `${FormatDictionary[_issue.format] ?? issue2.format} không hợp lệ`;
}
case "not_multiple_of":
return `Số không hợp lệ: phải là bội số của ${issue2.divisor}`;
case "unrecognized_keys":
return `Khóa không được nhận dạng: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Khóa không hợp lệ trong ${issue2.origin}`;
case "invalid_union":
return "Đầu vào không hợp lệ";
case "invalid_element":
return `Giá trị không hợp lệ trong ${issue2.origin}`;
default:
return `Đầu vào không hợp lệ`;
}
};
};
function vi_default() {
return {
localeError: error47()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/zh-CN.js
var error48 = () => {
const Sizable = {
string: { unit: "字符", verb: "包含" },
file: { unit: "字节", verb: "包含" },
array: { unit: "项", verb: "包含" },
set: { unit: "项", verb: "包含" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "输入",
email: "电子邮件",
url: "URL",
emoji: "表情符号",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO日期时间",
date: "ISO日期",
time: "ISO时间",
duration: "ISO时长",
ipv4: "IPv4地址",
ipv6: "IPv6地址",
cidrv4: "IPv4网段",
cidrv6: "IPv6网段",
base64: "base64编码字符串",
base64url: "base64url编码字符串",
json_string: "JSON字符串",
e164: "E.164号码",
jwt: "JWT",
template_literal: "输入"
};
const TypeDictionary = {
nan: "NaN",
number: "数字",
array: "数组",
null: "空值(null)"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `无效输入:期望 instanceof ${issue2.expected},实际接收 ${received}`;
}
return `无效输入:期望 ${expected},实际接收 ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `无效输入:期望 ${stringifyPrimitive(issue2.values[0])}`;
return `无效选项:期望以下之一 ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `数值过大:期望 ${issue2.origin ?? "值"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "个元素"}`;
return `数值过大:期望 ${issue2.origin ?? "值"} ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `数值过小:期望 ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `数值过小:期望 ${issue2.origin} ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `无效字符串:必须以 "${_issue.prefix}" 开头`;
if (_issue.format === "ends_with")
return `无效字符串:必须以 "${_issue.suffix}" 结尾`;
if (_issue.format === "includes")
return `无效字符串:必须包含 "${_issue.includes}"`;
if (_issue.format === "regex")
return `无效字符串:必须满足正则表达式 ${_issue.pattern}`;
return `无效${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `无效数字:必须是 ${issue2.divisor} 的倍数`;
case "unrecognized_keys":
return `出现未知的键(key): ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `${issue2.origin} 中的键(key)无效`;
case "invalid_union":
return "无效输入";
case "invalid_element":
return `${issue2.origin} 中包含无效值(value)`;
default:
return `无效输入`;
}
};
};
function zh_CN_default() {
return {
localeError: error48()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/zh-TW.js
var error49 = () => {
const Sizable = {
string: { unit: "字元", verb: "擁有" },
file: { unit: "位元組", verb: "擁有" },
array: { unit: "項目", verb: "擁有" },
set: { unit: "項目", verb: "擁有" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "輸入",
email: "郵件地址",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO 日期時間",
date: "ISO 日期",
time: "ISO 時間",
duration: "ISO 期間",
ipv4: "IPv4 位址",
ipv6: "IPv6 位址",
cidrv4: "IPv4 範圍",
cidrv6: "IPv6 範圍",
base64: "base64 編碼字串",
base64url: "base64url 編碼字串",
json_string: "JSON 字串",
e164: "E.164 數值",
jwt: "JWT",
template_literal: "輸入"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `無效的輸入值:預期為 instanceof ${issue2.expected},但收到 ${received}`;
}
return `無效的輸入值:預期為 ${expected},但收到 ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `無效的輸入值:預期為 ${stringifyPrimitive(issue2.values[0])}`;
return `無效的選項:預期為以下其中之一 ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `數值過大:預期 ${issue2.origin ?? "值"} 應為 ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "個元素"}`;
return `數值過大:預期 ${issue2.origin ?? "值"} 應為 ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `數值過小:預期 ${issue2.origin} 應為 ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `數值過小:預期 ${issue2.origin} 應為 ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `無效的字串:必須以 "${_issue.prefix}" 開頭`;
}
if (_issue.format === "ends_with")
return `無效的字串:必須以 "${_issue.suffix}" 結尾`;
if (_issue.format === "includes")
return `無效的字串:必須包含 "${_issue.includes}"`;
if (_issue.format === "regex")
return `無效的字串:必須符合格式 ${_issue.pattern}`;
return `無效的 ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `無效的數字:必須為 ${issue2.divisor} 的倍數`;
case "unrecognized_keys":
return `無法識別的鍵值${issue2.keys.length > 1 ? "們" : ""}:${joinValues(issue2.keys, "、")}`;
case "invalid_key":
return `${issue2.origin} 中有無效的鍵值`;
case "invalid_union":
return "無效的輸入值";
case "invalid_element":
return `${issue2.origin} 中有無效的值`;
default:
return `無效的輸入值`;
}
};
};
function zh_TW_default() {
return {
localeError: error49()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/yo.js
var error50 = () => {
const Sizable = {
string: { unit: "àmi", verb: "ní" },
file: { unit: "bytes", verb: "ní" },
array: { unit: "nkan", verb: "ní" },
set: { unit: "nkan", verb: "ní" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "ẹ̀rọ ìbáwọlé",
email: "àdírẹ́sì ìmẹ́lì",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "àkókò ISO",
date: "ọjọ́ ISO",
time: "àkókò ISO",
duration: "àkókò tó pé ISO",
ipv4: "àdírẹ́sì IPv4",
ipv6: "àdírẹ́sì IPv6",
cidrv4: "àgbègbè IPv4",
cidrv6: "àgbègbè IPv6",
base64: "ọ̀rọ̀ tí a kọ́ ní base64",
base64url: "ọ̀rọ̀ base64url",
json_string: "ọ̀rọ̀ JSON",
e164: "nọ́mbà E.164",
jwt: "JWT",
template_literal: "ẹ̀rọ ìbáwọlé"
};
const TypeDictionary = {
nan: "NaN",
number: "nọ́mbà",
array: "akopọ"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${issue2.expected}, àmọ̀ a rí ${received}`;
}
return `Ìbáwọlé aṣìṣe: a ní láti fi ${expected}, àmọ̀ a rí ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Ìbáwọlé aṣìṣe: a ní láti fi ${stringifyPrimitive(issue2.values[0])}`;
return `Àṣàyàn aṣìṣe: yan ọ̀kan lára ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Tó pọ̀ jù: a ní láti jẹ́ pé ${issue2.origin ?? "iye"} ${sizing.verb} ${adj}${issue2.maximum} ${sizing.unit}`;
return `Tó pọ̀ jù: a ní láti jẹ́ ${adj}${issue2.maximum}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Kéré ju: a ní láti jẹ́ pé ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum} ${sizing.unit}`;
return `Kéré ju: a ní láti jẹ́ ${adj}${issue2.minimum}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${_issue.includes}"`;
if (_issue.format === "regex")
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${_issue.pattern}`;
return `Aṣìṣe: ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${issue2.divisor}`;
case "unrecognized_keys":
return `Bọtìnì àìmọ̀: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Bọtìnì aṣìṣe nínú ${issue2.origin}`;
case "invalid_union":
return "Ìbáwọlé aṣìṣe";
case "invalid_element":
return `Iye aṣìṣe nínú ${issue2.origin}`;
default:
return "Ìbáwọlé aṣìṣe";
}
};
};
function yo_default() {
return {
localeError: error50()
};
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/registries.js
var _a2;
var $output = Symbol("ZodOutput");
var $input = Symbol("ZodInput");
class $ZodRegistry {
constructor() {
this._map = new WeakMap;
this._idmap = new Map;
}
add(schema, ..._meta) {
const meta = _meta[0];
this._map.set(schema, meta);
if (meta && typeof meta === "object" && "id" in meta) {
this._idmap.set(meta.id, schema);
}
return this;
}
clear() {
this._map = new WeakMap;
this._idmap = new Map;
return this;
}
remove(schema) {
const meta = this._map.get(schema);
if (meta && typeof meta === "object" && "id" in meta) {
this._idmap.delete(meta.id);
}
this._map.delete(schema);
return this;
}
get(schema) {
const p = schema._zod.parent;
if (p) {
const pm = { ...this.get(p) ?? {} };
delete pm.id;
const f = { ...pm, ...this._map.get(schema) };
return Object.keys(f).length ? f : undefined;
}
return this._map.get(schema);
}
has(schema) {
return this._map.has(schema);
}
}
function registry() {
return new $ZodRegistry;
}
(_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
var globalRegistry = globalThis.__zod_globalRegistry;
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/api.js
function _string(Class2, params) {
return new Class2({
type: "string",
...normalizeParams(params)
});
}
function _coercedString(Class2, params) {
return new Class2({
type: "string",
coerce: true,
...normalizeParams(params)
});
}
function _email(Class2, params) {
return new Class2({
type: "string",
format: "email",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _guid(Class2, params) {
return new Class2({
type: "string",
format: "guid",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _uuid(Class2, params) {
return new Class2({
type: "string",
format: "uuid",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _uuidv4(Class2, params) {
return new Class2({
type: "string",
format: "uuid",
check: "string_format",
abort: false,
version: "v4",
...normalizeParams(params)
});
}
function _uuidv6(Class2, params) {
return new Class2({
type: "string",
format: "uuid",
check: "string_format",
abort: false,
version: "v6",
...normalizeParams(params)
});
}
function _uuidv7(Class2, params) {
return new Class2({
type: "string",
format: "uuid",
check: "string_format",
abort: false,
version: "v7",
...normalizeParams(params)
});
}
function _url(Class2, params) {
return new Class2({
type: "string",
format: "url",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _emoji2(Class2, params) {
return new Class2({
type: "string",
format: "emoji",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _nanoid(Class2, params) {
return new Class2({
type: "string",
format: "nanoid",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _cuid(Class2, params) {
return new Class2({
type: "string",
format: "cuid",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _cuid2(Class2, params) {
return new Class2({
type: "string",
format: "cuid2",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _ulid(Class2, params) {
return new Class2({
type: "string",
format: "ulid",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _xid(Class2, params) {
return new Class2({
type: "string",
format: "xid",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _ksuid(Class2, params) {
return new Class2({
type: "string",
format: "ksuid",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _ipv4(Class2, params) {
return new Class2({
type: "string",
format: "ipv4",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _ipv6(Class2, params) {
return new Class2({
type: "string",
format: "ipv6",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _mac(Class2, params) {
return new Class2({
type: "string",
format: "mac",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _cidrv4(Class2, params) {
return new Class2({
type: "string",
format: "cidrv4",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _cidrv6(Class2, params) {
return new Class2({
type: "string",
format: "cidrv6",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _base64(Class2, params) {
return new Class2({
type: "string",
format: "base64",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _base64url(Class2, params) {
return new Class2({
type: "string",
format: "base64url",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _e164(Class2, params) {
return new Class2({
type: "string",
format: "e164",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _jwt(Class2, params) {
return new Class2({
type: "string",
format: "jwt",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
var TimePrecision = {
Any: null,
Minute: -1,
Second: 0,
Millisecond: 3,
Microsecond: 6
};
function _isoDateTime(Class2, params) {
return new Class2({
type: "string",
format: "datetime",
check: "string_format",
offset: false,
local: false,
precision: null,
...normalizeParams(params)
});
}
function _isoDate(Class2, params) {
return new Class2({
type: "string",
format: "date",
check: "string_format",
...normalizeParams(params)
});
}
function _isoTime(Class2, params) {
return new Class2({
type: "string",
format: "time",
check: "string_format",
precision: null,
...normalizeParams(params)
});
}
function _isoDuration(Class2, params) {
return new Class2({
type: "string",
format: "duration",
check: "string_format",
...normalizeParams(params)
});
}
function _number(Class2, params) {
return new Class2({
type: "number",
checks: [],
...normalizeParams(params)
});
}
function _coercedNumber(Class2, params) {
return new Class2({
type: "number",
coerce: true,
checks: [],
...normalizeParams(params)
});
}
function _int(Class2, params) {
return new Class2({
type: "number",
check: "number_format",
abort: false,
format: "safeint",
...normalizeParams(params)
});
}
function _float32(Class2, params) {
return new Class2({
type: "number",
check: "number_format",
abort: false,
format: "float32",
...normalizeParams(params)
});
}
function _float64(Class2, params) {
return new Class2({
type: "number",
check: "number_format",
abort: false,
format: "float64",
...normalizeParams(params)
});
}
function _int32(Class2, params) {
return new Class2({
type: "number",
check: "number_format",
abort: false,
format: "int32",
...normalizeParams(params)
});
}
function _uint32(Class2, params) {
return new Class2({
type: "number",
check: "number_format",
abort: false,
format: "uint32",
...normalizeParams(params)
});
}
function _boolean(Class2, params) {
return new Class2({
type: "boolean",
...normalizeParams(params)
});
}
function _coercedBoolean(Class2, params) {
return new Class2({
type: "boolean",
coerce: true,
...normalizeParams(params)
});
}
function _bigint(Class2, params) {
return new Class2({
type: "bigint",
...normalizeParams(params)
});
}
function _coercedBigint(Class2, params) {
return new Class2({
type: "bigint",
coerce: true,
...normalizeParams(params)
});
}
function _int64(Class2, params) {
return new Class2({
type: "bigint",
check: "bigint_format",
abort: false,
format: "int64",
...normalizeParams(params)
});
}
function _uint64(Class2, params) {
return new Class2({
type: "bigint",
check: "bigint_format",
abort: false,
format: "uint64",
...normalizeParams(params)
});
}
function _symbol(Class2, params) {
return new Class2({
type: "symbol",
...normalizeParams(params)
});
}
function _undefined2(Class2, params) {
return new Class2({
type: "undefined",
...normalizeParams(params)
});
}
function _null2(Class2, params) {
return new Class2({
type: "null",
...normalizeParams(params)
});
}
function _any(Class2) {
return new Class2({
type: "any"
});
}
function _unknown(Class2) {
return new Class2({
type: "unknown"
});
}
function _never(Class2, params) {
return new Class2({
type: "never",
...normalizeParams(params)
});
}
function _void(Class2, params) {
return new Class2({
type: "void",
...normalizeParams(params)
});
}
function _date(Class2, params) {
return new Class2({
type: "date",
...normalizeParams(params)
});
}
function _coercedDate(Class2, params) {
return new Class2({
type: "date",
coerce: true,
...normalizeParams(params)
});
}
function _nan(Class2, params) {
return new Class2({
type: "nan",
...normalizeParams(params)
});
}
function _lt(value, params) {
return new $ZodCheckLessThan({
check: "less_than",
...normalizeParams(params),
value,
inclusive: false
});
}
function _lte(value, params) {
return new $ZodCheckLessThan({
check: "less_than",
...normalizeParams(params),
value,
inclusive: true
});
}
function _gt(value, params) {
return new $ZodCheckGreaterThan({
check: "greater_than",
...normalizeParams(params),
value,
inclusive: false
});
}
function _gte(value, params) {
return new $ZodCheckGreaterThan({
check: "greater_than",
...normalizeParams(params),
value,
inclusive: true
});
}
function _positive(params) {
return _gt(0, params);
}
function _negative(params) {
return _lt(0, params);
}
function _nonpositive(params) {
return _lte(0, params);
}
function _nonnegative(params) {
return _gte(0, params);
}
function _multipleOf(value, params) {
return new $ZodCheckMultipleOf({
check: "multiple_of",
...normalizeParams(params),
value
});
}
function _maxSize(maximum, params) {
return new $ZodCheckMaxSize({
check: "max_size",
...normalizeParams(params),
maximum
});
}
function _minSize(minimum, params) {
return new $ZodCheckMinSize({
check: "min_size",
...normalizeParams(params),
minimum
});
}
function _size(size, params) {
return new $ZodCheckSizeEquals({
check: "size_equals",
...normalizeParams(params),
size
});
}
function _maxLength(maximum, params) {
const ch = new $ZodCheckMaxLength({
check: "max_length",
...normalizeParams(params),
maximum
});
return ch;
}
function _minLength(minimum, params) {
return new $ZodCheckMinLength({
check: "min_length",
...normalizeParams(params),
minimum
});
}
function _length(length, params) {
return new $ZodCheckLengthEquals({
check: "length_equals",
...normalizeParams(params),
length
});
}
function _regex(pattern, params) {
return new $ZodCheckRegex({
check: "string_format",
format: "regex",
...normalizeParams(params),
pattern
});
}
function _lowercase(params) {
return new $ZodCheckLowerCase({
check: "string_format",
format: "lowercase",
...normalizeParams(params)
});
}
function _uppercase(params) {
return new $ZodCheckUpperCase({
check: "string_format",
format: "uppercase",
...normalizeParams(params)
});
}
function _includes(includes, params) {
return new $ZodCheckIncludes({
check: "string_format",
format: "includes",
...normalizeParams(params),
includes
});
}
function _startsWith(prefix, params) {
return new $ZodCheckStartsWith({
check: "string_format",
format: "starts_with",
...normalizeParams(params),
prefix
});
}
function _endsWith(suffix, params) {
return new $ZodCheckEndsWith({
check: "string_format",
format: "ends_with",
...normalizeParams(params),
suffix
});
}
function _property(property, schema, params) {
return new $ZodCheckProperty({
check: "property",
property,
schema,
...normalizeParams(params)
});
}
function _mime(types, params) {
return new $ZodCheckMimeType({
check: "mime_type",
mime: types,
...normalizeParams(params)
});
}
function _overwrite(tx) {
return new $ZodCheckOverwrite({
check: "overwrite",
tx
});
}
function _normalize(form) {
return _overwrite((input) => input.normalize(form));
}
function _trim() {
return _overwrite((input) => input.trim());
}
function _toLowerCase() {
return _overwrite((input) => input.toLowerCase());
}
function _toUpperCase() {
return _overwrite((input) => input.toUpperCase());
}
function _slugify() {
return _overwrite((input) => slugify(input));
}
function _array(Class2, element, params) {
return new Class2({
type: "array",
element,
...normalizeParams(params)
});
}
function _union(Class2, options, params) {
return new Class2({
type: "union",
options,
...normalizeParams(params)
});
}
function _xor(Class2, options, params) {
return new Class2({
type: "union",
options,
inclusive: false,
...normalizeParams(params)
});
}
function _discriminatedUnion(Class2, discriminator, options, params) {
return new Class2({
type: "union",
options,
discriminator,
...normalizeParams(params)
});
}
function _intersection(Class2, left, right) {
return new Class2({
type: "intersection",
left,
right
});
}
function _tuple(Class2, items, _paramsOrRest, _params) {
const hasRest = _paramsOrRest instanceof $ZodType;
const params = hasRest ? _params : _paramsOrRest;
const rest = hasRest ? _paramsOrRest : null;
return new Class2({
type: "tuple",
items,
rest,
...normalizeParams(params)
});
}
function _record(Class2, keyType, valueType, params) {
return new Class2({
type: "record",
keyType,
valueType,
...normalizeParams(params)
});
}
function _map(Class2, keyType, valueType, params) {
return new Class2({
type: "map",
keyType,
valueType,
...normalizeParams(params)
});
}
function _set(Class2, valueType, params) {
return new Class2({
type: "set",
valueType,
...normalizeParams(params)
});
}
function _enum(Class2, values, params) {
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
return new Class2({
type: "enum",
entries,
...normalizeParams(params)
});
}
function _nativeEnum(Class2, entries, params) {
return new Class2({
type: "enum",
entries,
...normalizeParams(params)
});
}
function _literal(Class2, value, params) {
return new Class2({
type: "literal",
values: Array.isArray(value) ? value : [value],
...normalizeParams(params)
});
}
function _file(Class2, params) {
return new Class2({
type: "file",
...normalizeParams(params)
});
}
function _transform(Class2, fn) {
return new Class2({
type: "transform",
transform: fn
});
}
function _optional(Class2, innerType) {
return new Class2({
type: "optional",
innerType
});
}
function _nullable(Class2, innerType) {
return new Class2({
type: "nullable",
innerType
});
}
function _default(Class2, innerType, defaultValue) {
return new Class2({
type: "default",
innerType,
get defaultValue() {
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
}
});
}
function _nonoptional(Class2, innerType, params) {
return new Class2({
type: "nonoptional",
innerType,
...normalizeParams(params)
});
}
function _success(Class2, innerType) {
return new Class2({
type: "success",
innerType
});
}
function _catch(Class2, innerType, catchValue) {
return new Class2({
type: "catch",
innerType,
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
});
}
function _pipe(Class2, in_, out) {
return new Class2({
type: "pipe",
in: in_,
out
});
}
function _readonly(Class2, innerType) {
return new Class2({
type: "readonly",
innerType
});
}
function _templateLiteral(Class2, parts, params) {
return new Class2({
type: "template_literal",
parts,
...normalizeParams(params)
});
}
function _lazy(Class2, getter) {
return new Class2({
type: "lazy",
getter
});
}
function _promise(Class2, innerType) {
return new Class2({
type: "promise",
innerType
});
}
function _custom(Class2, fn, _params) {
const norm = normalizeParams(_params);
norm.abort ?? (norm.abort = true);
const schema = new Class2({
type: "custom",
check: "custom",
fn,
...norm
});
return schema;
}
function _refine(Class2, fn, _params) {
const schema = new Class2({
type: "custom",
check: "custom",
fn,
...normalizeParams(_params)
});
return schema;
}
function _superRefine(fn, params) {
const ch = _check((payload) => {
payload.addIssue = (issue2) => {
if (typeof issue2 === "string") {
payload.issues.push(issue(issue2, payload.value, ch._zod.def));
} else {
const _issue = issue2;
if (_issue.fatal)
_issue.continue = false;
_issue.code ?? (_issue.code = "custom");
_issue.input ?? (_issue.input = payload.value);
_issue.inst ?? (_issue.inst = ch);
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
payload.issues.push(issue(_issue));
}
};
return fn(payload.value, payload);
}, params);
return ch;
}
function _check(fn, params) {
const ch = new $ZodCheck({
check: "custom",
...normalizeParams(params)
});
ch._zod.check = fn;
return ch;
}
function describe(description) {
const ch = new $ZodCheck({ check: "describe" });
ch._zod.onattach = [
(inst) => {
const existing = globalRegistry.get(inst) ?? {};
globalRegistry.add(inst, { ...existing, description });
}
];
ch._zod.check = () => {};
return ch;
}
function meta(metadata) {
const ch = new $ZodCheck({ check: "meta" });
ch._zod.onattach = [
(inst) => {
const existing = globalRegistry.get(inst) ?? {};
globalRegistry.add(inst, { ...existing, ...metadata });
}
];
ch._zod.check = () => {};
return ch;
}
function _stringbool(Classes, _params) {
const params = normalizeParams(_params);
let truthyArray = params.truthy ?? ["true", "1", "yes", "on", "y", "enabled"];
let falsyArray = params.falsy ?? ["false", "0", "no", "off", "n", "disabled"];
if (params.case !== "sensitive") {
truthyArray = truthyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v);
falsyArray = falsyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v);
}
const truthySet = new Set(truthyArray);
const falsySet = new Set(falsyArray);
const _Codec = Classes.Codec ?? $ZodCodec;
const _Boolean = Classes.Boolean ?? $ZodBoolean;
const _String = Classes.String ?? $ZodString;
const stringSchema = new _String({ type: "string", error: params.error });
const booleanSchema = new _Boolean({ type: "boolean", error: params.error });
const codec = new _Codec({
type: "pipe",
in: stringSchema,
out: booleanSchema,
transform: (input, payload) => {
let data = input;
if (params.case !== "sensitive")
data = data.toLowerCase();
if (truthySet.has(data)) {
return true;
} else if (falsySet.has(data)) {
return false;
} else {
payload.issues.push({
code: "invalid_value",
expected: "stringbool",
values: [...truthySet, ...falsySet],
input: payload.value,
inst: codec,
continue: false
});
return {};
}
},
reverseTransform: (input, _payload) => {
if (input === true) {
return truthyArray[0] || "true";
} else {
return falsyArray[0] || "false";
}
},
error: params.error
});
return codec;
}
function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
const params = normalizeParams(_params);
const def = {
...normalizeParams(_params),
check: "string_format",
type: "string",
format,
fn: typeof fnOrRegex === "function" ? fnOrRegex : (val) => fnOrRegex.test(val),
...params
};
if (fnOrRegex instanceof RegExp) {
def.pattern = fnOrRegex;
}
const inst = new Class2(def);
return inst;
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js
function initializeContext(params) {
let target = params?.target ?? "draft-2020-12";
if (target === "draft-4")
target = "draft-04";
if (target === "draft-7")
target = "draft-07";
return {
processors: params.processors ?? {},
metadataRegistry: params?.metadata ?? globalRegistry,
target,
unrepresentable: params?.unrepresentable ?? "throw",
override: params?.override ?? (() => {}),
io: params?.io ?? "output",
counter: 0,
seen: new Map,
cycles: params?.cycles ?? "ref",
reused: params?.reused ?? "inline",
external: params?.external ?? undefined
};
}
function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
var _a3;
const def = schema._zod.def;
const seen = ctx.seen.get(schema);
if (seen) {
seen.count++;
const isCycle = _params.schemaPath.includes(schema);
if (isCycle) {
seen.cycle = _params.path;
}
return seen.schema;
}
const result = { schema: {}, count: 1, cycle: undefined, path: _params.path };
ctx.seen.set(schema, result);
const overrideSchema = schema._zod.toJSONSchema?.();
if (overrideSchema) {
result.schema = overrideSchema;
} else {
const params = {
..._params,
schemaPath: [..._params.schemaPath, schema],
path: _params.path
};
if (schema._zod.processJSONSchema) {
schema._zod.processJSONSchema(ctx, result.schema, params);
} else {
const _json = result.schema;
const processor = ctx.processors[def.type];
if (!processor) {
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
}
processor(schema, ctx, _json, params);
}
const parent = schema._zod.parent;
if (parent) {
if (!result.ref)
result.ref = parent;
process(parent, ctx, params);
ctx.seen.get(parent).isParent = true;
}
}
const meta2 = ctx.metadataRegistry.get(schema);
if (meta2)
Object.assign(result.schema, meta2);
if (ctx.io === "input" && isTransforming(schema)) {
delete result.schema.examples;
delete result.schema.default;
}
if (ctx.io === "input" && "_prefault" in result.schema)
(_a3 = result.schema).default ?? (_a3.default = result.schema._prefault);
delete result.schema._prefault;
const _result = ctx.seen.get(schema);
return _result.schema;
}
function extractDefs(ctx, schema) {
const root = ctx.seen.get(schema);
if (!root)
throw new Error("Unprocessed schema. This is a bug in Zod.");
const idToSchema = new Map;
for (const entry of ctx.seen.entries()) {
const id = ctx.metadataRegistry.get(entry[0])?.id;
if (id) {
const existing = idToSchema.get(id);
if (existing && existing !== entry[0]) {
throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
}
idToSchema.set(id, entry[0]);
}
}
const makeURI = (entry) => {
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
if (ctx.external) {
const externalId = ctx.external.registry.get(entry[0])?.id;
const uriGenerator = ctx.external.uri ?? ((id2) => id2);
if (externalId) {
return { ref: uriGenerator(externalId) };
}
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
entry[1].defId = id;
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
}
if (entry[1] === root) {
return { ref: "#" };
}
const uriPrefix = `#`;
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
return { defId, ref: defUriPrefix + defId };
};
const extractToDef = (entry) => {
if (entry[1].schema.$ref) {
return;
}
const seen = entry[1];
const { ref, defId } = makeURI(entry);
seen.def = { ...seen.schema };
if (defId)
seen.defId = defId;
const schema2 = seen.schema;
for (const key in schema2) {
delete schema2[key];
}
schema2.$ref = ref;
};
if (ctx.cycles === "throw") {
for (const entry of ctx.seen.entries()) {
const seen = entry[1];
if (seen.cycle) {
throw new Error("Cycle detected: " + `#/${seen.cycle?.join("/")}/<root>` + '\n\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.');
}
}
}
for (const entry of ctx.seen.entries()) {
const seen = entry[1];
if (schema === entry[0]) {
extractToDef(entry);
continue;
}
if (ctx.external) {
const ext = ctx.external.registry.get(entry[0])?.id;
if (schema !== entry[0] && ext) {
extractToDef(entry);
continue;
}
}
const id = ctx.metadataRegistry.get(entry[0])?.id;
if (id) {
extractToDef(entry);
continue;
}
if (seen.cycle) {
extractToDef(entry);
continue;
}
if (seen.count > 1) {
if (ctx.reused === "ref") {
extractToDef(entry);
continue;
}
}
}
}
function finalize(ctx, schema) {
const root = ctx.seen.get(schema);
if (!root)
throw new Error("Unprocessed schema. This is a bug in Zod.");
const flattenRef = (zodSchema) => {
const seen = ctx.seen.get(zodSchema);
if (seen.ref === null)
return;
const schema2 = seen.def ?? seen.schema;
const _cached = { ...schema2 };
const ref = seen.ref;
seen.ref = null;
if (ref) {
flattenRef(ref);
const refSeen = ctx.seen.get(ref);
const refSchema = refSeen.schema;
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
schema2.allOf = schema2.allOf ?? [];
schema2.allOf.push(refSchema);
} else {
Object.assign(schema2, refSchema);
}
Object.assign(schema2, _cached);
const isParentRef = zodSchema._zod.parent === ref;
if (isParentRef) {
for (const key in schema2) {
if (key === "$ref" || key === "allOf")
continue;
if (!(key in _cached)) {
delete schema2[key];
}
}
}
if (refSchema.$ref && refSeen.def) {
for (const key in schema2) {
if (key === "$ref" || key === "allOf")
continue;
if (key in refSeen.def && JSON.stringify(schema2[key]) === JSON.stringify(refSeen.def[key])) {
delete schema2[key];
}
}
}
}
const parent = zodSchema._zod.parent;
if (parent && parent !== ref) {
flattenRef(parent);
const parentSeen = ctx.seen.get(parent);
if (parentSeen?.schema.$ref) {
schema2.$ref = parentSeen.schema.$ref;
if (parentSeen.def) {
for (const key in schema2) {
if (key === "$ref" || key === "allOf")
continue;
if (key in parentSeen.def && JSON.stringify(schema2[key]) === JSON.stringify(parentSeen.def[key])) {
delete schema2[key];
}
}
}
}
}
ctx.override({
zodSchema,
jsonSchema: schema2,
path: seen.path ?? []
});
};
for (const entry of [...ctx.seen.entries()].reverse()) {
flattenRef(entry[0]);
}
const result = {};
if (ctx.target === "draft-2020-12") {
result.$schema = "https://json-schema.org/draft/2020-12/schema";
} else if (ctx.target === "draft-07") {
result.$schema = "http://json-schema.org/draft-07/schema#";
} else if (ctx.target === "draft-04") {
result.$schema = "http://json-schema.org/draft-04/schema#";
} else if (ctx.target === "openapi-3.0") {}
if (ctx.external?.uri) {
const id = ctx.external.registry.get(schema)?.id;
if (!id)
throw new Error("Schema is missing an `id` property");
result.$id = ctx.external.uri(id);
}
Object.assign(result, root.def ?? root.schema);
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
if (rootMetaId !== undefined && result.id === rootMetaId)
delete result.id;
const defs = ctx.external?.defs ?? {};
for (const entry of ctx.seen.entries()) {
const seen = entry[1];
if (seen.def && seen.defId) {
if (seen.def.id === seen.defId)
delete seen.def.id;
defs[seen.defId] = seen.def;
}
}
if (ctx.external) {} else {
if (Object.keys(defs).length > 0) {
if (ctx.target === "draft-2020-12") {
result.$defs = defs;
} else {
result.definitions = defs;
}
}
}
try {
const finalized = JSON.parse(JSON.stringify(result));
Object.defineProperty(finalized, "~standard", {
value: {
...schema["~standard"],
jsonSchema: {
input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
}
},
enumerable: false,
writable: false
});
return finalized;
} catch (_err) {
throw new Error("Error converting schema to JSON.");
}
}
function isTransforming(_schema, _ctx) {
const ctx = _ctx ?? { seen: new Set };
if (ctx.seen.has(_schema))
return false;
ctx.seen.add(_schema);
const def = _schema._zod.def;
if (def.type === "transform")
return true;
if (def.type === "array")
return isTransforming(def.element, ctx);
if (def.type === "set")
return isTransforming(def.valueType, ctx);
if (def.type === "lazy")
return isTransforming(def.getter(), ctx);
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") {
return isTransforming(def.innerType, ctx);
}
if (def.type === "intersection") {
return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
}
if (def.type === "record" || def.type === "map") {
return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
}
if (def.type === "pipe") {
if (_schema._zod.traits.has("$ZodCodec"))
return true;
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
}
if (def.type === "object") {
for (const key in def.shape) {
if (isTransforming(def.shape[key], ctx))
return true;
}
return false;
}
if (def.type === "union") {
for (const option of def.options) {
if (isTransforming(option, ctx))
return true;
}
return false;
}
if (def.type === "tuple") {
for (const item of def.items) {
if (isTransforming(item, ctx))
return true;
}
if (def.rest && isTransforming(def.rest, ctx))
return true;
return false;
}
return false;
}
var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
const ctx = initializeContext({ ...params, processors });
process(schema, ctx);
extractDefs(ctx, schema);
return finalize(ctx, schema);
};
var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
const { libraryOptions, target } = params ?? {};
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
process(schema, ctx);
extractDefs(ctx, schema);
return finalize(ctx, schema);
};
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js
var formatMap = {
guid: "uuid",
url: "uri",
datetime: "date-time",
json_string: "json-string",
regex: ""
};
var stringProcessor = (schema, ctx, _json, _params) => {
const json = _json;
json.type = "string";
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
if (typeof minimum === "number")
json.minLength = minimum;
if (typeof maximum === "number")
json.maxLength = maximum;
if (format) {
json.format = formatMap[format] ?? format;
if (json.format === "")
delete json.format;
if (format === "time") {
delete json.format;
}
}
if (contentEncoding)
json.contentEncoding = contentEncoding;
if (patterns && patterns.size > 0) {
const regexes = [...patterns];
if (regexes.length === 1)
json.pattern = regexes[0].source;
else if (regexes.length > 1) {
json.allOf = [
...regexes.map((regex) => ({
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
pattern: regex.source
}))
];
}
}
};
var numberProcessor = (schema, ctx, _json, _params) => {
const json = _json;
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
if (typeof format === "string" && format.includes("int"))
json.type = "integer";
else
json.type = "number";
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
if (exMin) {
if (legacy) {
json.minimum = exclusiveMinimum;
json.exclusiveMinimum = true;
} else {
json.exclusiveMinimum = exclusiveMinimum;
}
} else if (typeof minimum === "number") {
json.minimum = minimum;
}
if (exMax) {
if (legacy) {
json.maximum = exclusiveMaximum;
json.exclusiveMaximum = true;
} else {
json.exclusiveMaximum = exclusiveMaximum;
}
} else if (typeof maximum === "number") {
json.maximum = maximum;
}
if (typeof multipleOf === "number")
json.multipleOf = multipleOf;
};
var booleanProcessor = (_schema, _ctx, json, _params) => {
json.type = "boolean";
};
var bigintProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("BigInt cannot be represented in JSON Schema");
}
};
var symbolProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("Symbols cannot be represented in JSON Schema");
}
};
var nullProcessor = (_schema, ctx, json, _params) => {
if (ctx.target === "openapi-3.0") {
json.type = "string";
json.nullable = true;
json.enum = [null];
} else {
json.type = "null";
}
};
var undefinedProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("Undefined cannot be represented in JSON Schema");
}
};
var voidProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("Void cannot be represented in JSON Schema");
}
};
var neverProcessor = (_schema, _ctx, json, _params) => {
json.not = {};
};
var anyProcessor = (_schema, _ctx, _json, _params) => {};
var unknownProcessor = (_schema, _ctx, _json, _params) => {};
var dateProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("Date cannot be represented in JSON Schema");
}
};
var enumProcessor = (schema, _ctx, json, _params) => {
const def = schema._zod.def;
const values = getEnumValues(def.entries);
if (values.every((v) => typeof v === "number"))
json.type = "number";
if (values.every((v) => typeof v === "string"))
json.type = "string";
json.enum = values;
};
var literalProcessor = (schema, ctx, json, _params) => {
const def = schema._zod.def;
const vals = [];
for (const val of def.values) {
if (val === undefined) {
if (ctx.unrepresentable === "throw") {
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
}
} else if (typeof val === "bigint") {
if (ctx.unrepresentable === "throw") {
throw new Error("BigInt literals cannot be represented in JSON Schema");
} else {
vals.push(Number(val));
}
} else {
vals.push(val);
}
}
if (vals.length === 0) {} else if (vals.length === 1) {
const val = vals[0];
json.type = val === null ? "null" : typeof val;
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
json.enum = [val];
} else {
json.const = val;
}
} else {
if (vals.every((v) => typeof v === "number"))
json.type = "number";
if (vals.every((v) => typeof v === "string"))
json.type = "string";
if (vals.every((v) => typeof v === "boolean"))
json.type = "boolean";
if (vals.every((v) => v === null))
json.type = "null";
json.enum = vals;
}
};
var nanProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("NaN cannot be represented in JSON Schema");
}
};
var templateLiteralProcessor = (schema, _ctx, json, _params) => {
const _json = json;
const pattern = schema._zod.pattern;
if (!pattern)
throw new Error("Pattern not found in template literal");
_json.type = "string";
_json.pattern = pattern.source;
};
var fileProcessor = (schema, _ctx, json, _params) => {
const _json = json;
const file = {
type: "string",
format: "binary",
contentEncoding: "binary"
};
const { minimum, maximum, mime } = schema._zod.bag;
if (minimum !== undefined)
file.minLength = minimum;
if (maximum !== undefined)
file.maxLength = maximum;
if (mime) {
if (mime.length === 1) {
file.contentMediaType = mime[0];
Object.assign(_json, file);
} else {
Object.assign(_json, file);
_json.anyOf = mime.map((m) => ({ contentMediaType: m }));
}
} else {
Object.assign(_json, file);
}
};
var successProcessor = (_schema, _ctx, json, _params) => {
json.type = "boolean";
};
var customProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("Custom types cannot be represented in JSON Schema");
}
};
var functionProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("Function types cannot be represented in JSON Schema");
}
};
var transformProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("Transforms cannot be represented in JSON Schema");
}
};
var mapProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("Map cannot be represented in JSON Schema");
}
};
var setProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("Set cannot be represented in JSON Schema");
}
};
var arrayProcessor = (schema, ctx, _json, params) => {
const json = _json;
const def = schema._zod.def;
const { minimum, maximum } = schema._zod.bag;
if (typeof minimum === "number")
json.minItems = minimum;
if (typeof maximum === "number")
json.maxItems = maximum;
json.type = "array";
json.items = process(def.element, ctx, {
...params,
path: [...params.path, "items"]
});
};
var objectProcessor = (schema, ctx, _json, params) => {
const json = _json;
const def = schema._zod.def;
json.type = "object";
json.properties = {};
const shape = def.shape;
for (const key in shape) {
json.properties[key] = process(shape[key], ctx, {
...params,
path: [...params.path, "properties", key]
});
}
const allKeys = new Set(Object.keys(shape));
const requiredKeys = new Set([...allKeys].filter((key) => {
const v = def.shape[key]._zod;
if (ctx.io === "input") {
return v.optin === undefined;
} else {
return v.optout === undefined;
}
}));
if (requiredKeys.size > 0) {
json.required = Array.from(requiredKeys);
}
if (def.catchall?._zod.def.type === "never") {
json.additionalProperties = false;
} else if (!def.catchall) {
if (ctx.io === "output")
json.additionalProperties = false;
} else if (def.catchall) {
json.additionalProperties = process(def.catchall, ctx, {
...params,
path: [...params.path, "additionalProperties"]
});
}
};
var unionProcessor = (schema, ctx, json, params) => {
const def = schema._zod.def;
const isExclusive = def.inclusive === false;
const options = def.options.map((x, i) => process(x, ctx, {
...params,
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
}));
if (isExclusive) {
json.oneOf = options;
} else {
json.anyOf = options;
}
};
var intersectionProcessor = (schema, ctx, json, params) => {
const def = schema._zod.def;
const a = process(def.left, ctx, {
...params,
path: [...params.path, "allOf", 0]
});
const b = process(def.right, ctx, {
...params,
path: [...params.path, "allOf", 1]
});
const isSimpleIntersection = (val) => ("allOf" in val) && Object.keys(val).length === 1;
const allOf = [
...isSimpleIntersection(a) ? a.allOf : [a],
...isSimpleIntersection(b) ? b.allOf : [b]
];
json.allOf = allOf;
};
var tupleProcessor = (schema, ctx, _json, params) => {
const json = _json;
const def = schema._zod.def;
json.type = "array";
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
const prefixItems = def.items.map((x, i) => process(x, ctx, {
...params,
path: [...params.path, prefixPath, i]
}));
const rest = def.rest ? process(def.rest, ctx, {
...params,
path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
}) : null;
if (ctx.target === "draft-2020-12") {
json.prefixItems = prefixItems;
if (rest) {
json.items = rest;
}
} else if (ctx.target === "openapi-3.0") {
json.items = {
anyOf: prefixItems
};
if (rest) {
json.items.anyOf.push(rest);
}
json.minItems = prefixItems.length;
if (!rest) {
json.maxItems = prefixItems.length;
}
} else {
json.items = prefixItems;
if (rest) {
json.additionalItems = rest;
}
}
const { minimum, maximum } = schema._zod.bag;
if (typeof minimum === "number")
json.minItems = minimum;
if (typeof maximum === "number")
json.maxItems = maximum;
};
var recordProcessor = (schema, ctx, _json, params) => {
const json = _json;
const def = schema._zod.def;
json.type = "object";
const keyType = def.keyType;
const keyBag = keyType._zod.bag;
const patterns = keyBag?.patterns;
if (def.mode === "loose" && patterns && patterns.size > 0) {
const valueSchema = process(def.valueType, ctx, {
...params,
path: [...params.path, "patternProperties", "*"]
});
json.patternProperties = {};
for (const pattern of patterns) {
json.patternProperties[pattern.source] = valueSchema;
}
} else {
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
json.propertyNames = process(def.keyType, ctx, {
...params,
path: [...params.path, "propertyNames"]
});
}
json.additionalProperties = process(def.valueType, ctx, {
...params,
path: [...params.path, "additionalProperties"]
});
}
const keyValues = keyType._zod.values;
if (keyValues) {
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
if (validKeyValues.length > 0) {
json.required = validKeyValues;
}
}
};
var nullableProcessor = (schema, ctx, json, params) => {
const def = schema._zod.def;
const inner = process(def.innerType, ctx, params);
const seen = ctx.seen.get(schema);
if (ctx.target === "openapi-3.0") {
seen.ref = def.innerType;
json.nullable = true;
} else {
json.anyOf = [inner, { type: "null" }];
}
};
var nonoptionalProcessor = (schema, ctx, _json, params) => {
const def = schema._zod.def;
process(def.innerType, ctx, params);
const seen = ctx.seen.get(schema);
seen.ref = def.innerType;
};
var defaultProcessor = (schema, ctx, json, params) => {
const def = schema._zod.def;
process(def.innerType, ctx, params);
const seen = ctx.seen.get(schema);
seen.ref = def.innerType;
json.default = JSON.parse(JSON.stringify(def.defaultValue));
};
var prefaultProcessor = (schema, ctx, json, params) => {
const def = schema._zod.def;
process(def.innerType, ctx, params);
const seen = ctx.seen.get(schema);
seen.ref = def.innerType;
if (ctx.io === "input")
json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
};
var catchProcessor = (schema, ctx, json, params) => {
const def = schema._zod.def;
process(def.innerType, ctx, params);
const seen = ctx.seen.get(schema);
seen.ref = def.innerType;
let catchValue;
try {
catchValue = def.catchValue(undefined);
} catch {
throw new Error("Dynamic catch values are not supported in JSON Schema");
}
json.default = catchValue;
};
var pipeProcessor = (schema, ctx, _json, params) => {
const def = schema._zod.def;
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
process(innerType, ctx, params);
const seen = ctx.seen.get(schema);
seen.ref = innerType;
};
var readonlyProcessor = (schema, ctx, json, params) => {
const def = schema._zod.def;
process(def.innerType, ctx, params);
const seen = ctx.seen.get(schema);
seen.ref = def.innerType;
json.readOnly = true;
};
var promiseProcessor = (schema, ctx, _json, params) => {
const def = schema._zod.def;
process(def.innerType, ctx, params);
const seen = ctx.seen.get(schema);
seen.ref = def.innerType;
};
var optionalProcessor = (schema, ctx, _json, params) => {
const def = schema._zod.def;
process(def.innerType, ctx, params);
const seen = ctx.seen.get(schema);
seen.ref = def.innerType;
};
var lazyProcessor = (schema, ctx, _json, params) => {
const innerType = schema._zod.innerType;
process(innerType, ctx, params);
const seen = ctx.seen.get(schema);
seen.ref = innerType;
};
var allProcessors = {
string: stringProcessor,
number: numberProcessor,
boolean: booleanProcessor,
bigint: bigintProcessor,
symbol: symbolProcessor,
null: nullProcessor,
undefined: undefinedProcessor,
void: voidProcessor,
never: neverProcessor,
any: anyProcessor,
unknown: unknownProcessor,
date: dateProcessor,
enum: enumProcessor,
literal: literalProcessor,
nan: nanProcessor,
template_literal: templateLiteralProcessor,
file: fileProcessor,
success: successProcessor,
custom: customProcessor,
function: functionProcessor,
transform: transformProcessor,
map: mapProcessor,
set: setProcessor,
array: arrayProcessor,
object: objectProcessor,
union: unionProcessor,
intersection: intersectionProcessor,
tuple: tupleProcessor,
record: recordProcessor,
nullable: nullableProcessor,
nonoptional: nonoptionalProcessor,
default: defaultProcessor,
prefault: prefaultProcessor,
catch: catchProcessor,
pipe: pipeProcessor,
readonly: readonlyProcessor,
promise: promiseProcessor,
optional: optionalProcessor,
lazy: lazyProcessor
};
function toJSONSchema(input, params) {
if ("_idmap" in input) {
const registry2 = input;
const ctx2 = initializeContext({ ...params, processors: allProcessors });
const defs = {};
for (const entry of registry2._idmap.entries()) {
const [_, schema] = entry;
process(schema, ctx2);
}
const schemas = {};
const external = {
registry: registry2,
uri: params?.uri,
defs
};
ctx2.external = external;
for (const entry of registry2._idmap.entries()) {
const [key, schema] = entry;
extractDefs(ctx2, schema);
schemas[key] = finalize(ctx2, schema);
}
if (Object.keys(defs).length > 0) {
const defsSegment = ctx2.target === "draft-2020-12" ? "$defs" : "definitions";
schemas.__shared = {
[defsSegment]: defs
};
}
return { schemas };
}
const ctx = initializeContext({ ...params, processors: allProcessors });
process(input, ctx);
extractDefs(ctx, input);
return finalize(ctx, input);
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/json-schema-generator.js
class JSONSchemaGenerator {
get metadataRegistry() {
return this.ctx.metadataRegistry;
}
get target() {
return this.ctx.target;
}
get unrepresentable() {
return this.ctx.unrepresentable;
}
get override() {
return this.ctx.override;
}
get io() {
return this.ctx.io;
}
get counter() {
return this.ctx.counter;
}
set counter(value) {
this.ctx.counter = value;
}
get seen() {
return this.ctx.seen;
}
constructor(params) {
let normalizedTarget = params?.target ?? "draft-2020-12";
if (normalizedTarget === "draft-4")
normalizedTarget = "draft-04";
if (normalizedTarget === "draft-7")
normalizedTarget = "draft-07";
this.ctx = initializeContext({
processors: allProcessors,
target: normalizedTarget,
...params?.metadata && { metadata: params.metadata },
...params?.unrepresentable && { unrepresentable: params.unrepresentable },
...params?.override && { override: params.override },
...params?.io && { io: params.io }
});
}
process(schema, _params = { path: [], schemaPath: [] }) {
return process(schema, this.ctx, _params);
}
emit(schema, _params) {
if (_params) {
if (_params.cycles)
this.ctx.cycles = _params.cycles;
if (_params.reused)
this.ctx.reused = _params.reused;
if (_params.external)
this.ctx.external = _params.external;
}
extractDefs(this.ctx, schema);
const result = finalize(this.ctx, schema);
const { "~standard": _, ...plainResult } = result;
return plainResult;
}
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/json-schema.js
var exports_json_schema = {};
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
var exports_schemas2 = {};
__export(exports_schemas2, {
xor: () => xor,
xid: () => xid2,
void: () => _void2,
uuidv7: () => uuidv7,
uuidv6: () => uuidv6,
uuidv4: () => uuidv4,
uuid: () => uuid2,
url: () => url,
unknown: () => unknown,
union: () => union,
undefined: () => _undefined3,
ulid: () => ulid2,
uint64: () => uint64,
uint32: () => uint32,
tuple: () => tuple,
transform: () => transform,
templateLiteral: () => templateLiteral,
symbol: () => symbol,
superRefine: () => superRefine,
success: () => success,
stringbool: () => stringbool,
stringFormat: () => stringFormat,
string: () => string2,
strictObject: () => strictObject,
set: () => set,
refine: () => refine,
record: () => record,
readonly: () => readonly,
promise: () => promise,
preprocess: () => preprocess,
prefault: () => prefault,
pipe: () => pipe,
partialRecord: () => partialRecord,
optional: () => optional,
object: () => object,
number: () => number2,
nullish: () => nullish2,
nullable: () => nullable,
null: () => _null3,
nonoptional: () => nonoptional,
never: () => never,
nativeEnum: () => nativeEnum,
nanoid: () => nanoid2,
nan: () => nan,
meta: () => meta2,
map: () => map,
mac: () => mac2,
looseRecord: () => looseRecord,
looseObject: () => looseObject,
literal: () => literal,
lazy: () => lazy,
ksuid: () => ksuid2,
keyof: () => keyof,
jwt: () => jwt,
json: () => json,
ipv6: () => ipv62,
ipv4: () => ipv42,
invertCodec: () => invertCodec,
intersection: () => intersection,
int64: () => int64,
int32: () => int32,
int: () => int,
instanceof: () => _instanceof,
httpUrl: () => httpUrl,
hostname: () => hostname2,
hex: () => hex2,
hash: () => hash,
guid: () => guid2,
function: () => _function,
float64: () => float64,
float32: () => float32,
file: () => file,
exactOptional: () => exactOptional,
enum: () => _enum2,
emoji: () => emoji2,
email: () => email2,
e164: () => e1642,
discriminatedUnion: () => discriminatedUnion,
describe: () => describe2,
date: () => date3,
custom: () => custom,
cuid2: () => cuid22,
cuid: () => cuid3,
codec: () => codec,
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,
ZodXor: () => ZodXor,
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,
ZodReadonly: () => ZodReadonly,
ZodPromise: () => ZodPromise,
ZodPreprocess: () => ZodPreprocess,
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,
ZodMAC: () => ZodMAC,
ZodLiteral: () => ZodLiteral,
ZodLazy: () => ZodLazy,
ZodKSUID: () => ZodKSUID,
ZodJWT: () => ZodJWT,
ZodIntersection: () => ZodIntersection,
ZodIPv6: () => ZodIPv6,
ZodIPv4: () => ZodIPv4,
ZodGUID: () => ZodGUID,
ZodFunction: () => ZodFunction,
ZodFile: () => ZodFile,
ZodExactOptional: () => ZodExactOptional,
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
});
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/checks.js
var exports_checks2 = {};
__export(exports_checks2, {
uppercase: () => _uppercase,
trim: () => _trim,
toUpperCase: () => _toUpperCase,
toLowerCase: () => _toLowerCase,
startsWith: () => _startsWith,
slugify: () => _slugify,
size: () => _size,
regex: () => _regex,
property: () => _property,
positive: () => _positive,
overwrite: () => _overwrite,
normalize: () => _normalize,
nonpositive: () => _nonpositive,
nonnegative: () => _nonnegative,
negative: () => _negative,
multipleOf: () => _multipleOf,
minSize: () => _minSize,
minLength: () => _minLength,
mime: () => _mime,
maxSize: () => _maxSize,
maxLength: () => _maxLength,
lte: () => _lte,
lt: () => _lt,
lowercase: () => _lowercase,
length: () => _length,
includes: () => _includes,
gte: () => _gte,
gt: () => _gt,
endsWith: () => _endsWith
});
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/iso.js
var exports_iso = {};
__export(exports_iso, {
time: () => time2,
duration: () => duration2,
datetime: () => datetime2,
date: () => date2,
ZodISOTime: () => ZodISOTime,
ZodISODuration: () => ZodISODuration,
ZodISODateTime: () => ZodISODateTime,
ZodISODate: () => ZodISODate
});
var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
$ZodISODateTime.init(inst, def);
ZodStringFormat.init(inst, def);
});
function datetime2(params) {
return _isoDateTime(ZodISODateTime, params);
}
var ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
$ZodISODate.init(inst, def);
ZodStringFormat.init(inst, def);
});
function date2(params) {
return _isoDate(ZodISODate, params);
}
var ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
$ZodISOTime.init(inst, def);
ZodStringFormat.init(inst, def);
});
function time2(params) {
return _isoTime(ZodISOTime, params);
}
var ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
$ZodISODuration.init(inst, def);
ZodStringFormat.init(inst, def);
});
function duration2(params) {
return _isoDuration(ZodISODuration, params);
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/errors.js
var initializer2 = (inst, issues) => {
$ZodError.init(inst, issues);
inst.name = "ZodError";
Object.defineProperties(inst, {
format: {
value: (mapper) => formatError(inst, mapper)
},
flatten: {
value: (mapper) => flattenError(inst, mapper)
},
addIssue: {
value: (issue2) => {
inst.issues.push(issue2);
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
}
},
addIssues: {
value: (issues2) => {
inst.issues.push(...issues2);
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
}
},
isEmpty: {
get() {
return inst.issues.length === 0;
}
}
});
};
var ZodError = /* @__PURE__ */ $constructor("ZodError", initializer2);
var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, {
Parent: Error
});
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/parse.js
var parse3 = /* @__PURE__ */ _parse(ZodRealError);
var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
var encode2 = /* @__PURE__ */ _encode(ZodRealError);
var decode2 = /* @__PURE__ */ _decode(ZodRealError);
var encodeAsync2 = /* @__PURE__ */ _encodeAsync(ZodRealError);
var decodeAsync2 = /* @__PURE__ */ _decodeAsync(ZodRealError);
var safeEncode2 = /* @__PURE__ */ _safeEncode(ZodRealError);
var safeDecode2 = /* @__PURE__ */ _safeDecode(ZodRealError);
var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
var _installedGroups = /* @__PURE__ */ new WeakMap;
function _installLazyMethods(inst, group, methods) {
const proto = Object.getPrototypeOf(inst);
let installed = _installedGroups.get(proto);
if (!installed) {
installed = new Set;
_installedGroups.set(proto, installed);
}
if (installed.has(group))
return;
installed.add(group);
for (const key in methods) {
const fn = methods[key];
Object.defineProperty(proto, key, {
configurable: true,
enumerable: false,
get() {
const bound = fn.bind(this);
Object.defineProperty(this, key, {
configurable: true,
writable: true,
enumerable: true,
value: bound
});
return bound;
},
set(v) {
Object.defineProperty(this, key, {
configurable: true,
writable: true,
enumerable: true,
value: v
});
}
});
}
}
var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
$ZodType.init(inst, def);
Object.assign(inst["~standard"], {
jsonSchema: {
input: createStandardJSONSchemaMethod(inst, "input"),
output: createStandardJSONSchemaMethod(inst, "output")
}
});
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
inst.def = def;
inst.type = def.type;
Object.defineProperty(inst, "_def", { value: def });
inst.parse = (data, params) => parse3(inst, data, params, { callee: inst.parse });
inst.safeParse = (data, params) => safeParse2(inst, data, params);
inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
inst.spa = inst.safeParseAsync;
inst.encode = (data, params) => encode2(inst, data, params);
inst.decode = (data, params) => decode2(inst, data, params);
inst.encodeAsync = async (data, params) => encodeAsync2(inst, data, params);
inst.decodeAsync = async (data, params) => decodeAsync2(inst, data, params);
inst.safeEncode = (data, params) => safeEncode2(inst, data, params);
inst.safeDecode = (data, params) => safeDecode2(inst, data, params);
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync2(inst, data, params);
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync2(inst, data, params);
_installLazyMethods(inst, "ZodType", {
check(...chks) {
const def2 = this.def;
return this.clone(exports_util.mergeDefs(def2, {
checks: [
...def2.checks ?? [],
...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
]
}), { parent: true });
},
with(...chks) {
return this.check(...chks);
},
clone(def2, params) {
return clone(this, def2, params);
},
brand() {
return this;
},
register(reg, meta2) {
reg.add(this, meta2);
return this;
},
refine(check, params) {
return this.check(refine(check, params));
},
superRefine(refinement, params) {
return this.check(superRefine(refinement, params));
},
overwrite(fn) {
return this.check(_overwrite(fn));
},
optional() {
return optional(this);
},
exactOptional() {
return exactOptional(this);
},
nullable() {
return nullable(this);
},
nullish() {
return optional(nullable(this));
},
nonoptional(params) {
return nonoptional(this, params);
},
array() {
return array(this);
},
or(arg) {
return union([this, arg]);
},
and(arg) {
return intersection(this, arg);
},
transform(tx) {
return pipe(this, transform(tx));
},
default(d) {
return _default2(this, d);
},
prefault(d) {
return prefault(this, d);
},
catch(params) {
return _catch2(this, params);
},
pipe(target) {
return pipe(this, target);
},
readonly() {
return readonly(this);
},
describe(description) {
const cl = this.clone();
globalRegistry.add(cl, { description });
return cl;
},
meta(...args) {
if (args.length === 0)
return globalRegistry.get(this);
const cl = this.clone();
globalRegistry.add(cl, args[0]);
return cl;
},
isOptional() {
return this.safeParse(undefined).success;
},
isNullable() {
return this.safeParse(null).success;
},
apply(fn) {
return fn(this);
}
});
Object.defineProperty(inst, "description", {
get() {
return globalRegistry.get(inst)?.description;
},
configurable: true
});
return inst;
});
var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
$ZodString.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
const bag = inst._zod.bag;
inst.format = bag.format ?? null;
inst.minLength = bag.minimum ?? null;
inst.maxLength = bag.maximum ?? null;
_installLazyMethods(inst, "_ZodString", {
regex(...args) {
return this.check(_regex(...args));
},
includes(...args) {
return this.check(_includes(...args));
},
startsWith(...args) {
return this.check(_startsWith(...args));
},
endsWith(...args) {
return this.check(_endsWith(...args));
},
min(...args) {
return this.check(_minLength(...args));
},
max(...args) {
return this.check(_maxLength(...args));
},
length(...args) {
return this.check(_length(...args));
},
nonempty(...args) {
return this.check(_minLength(1, ...args));
},
lowercase(params) {
return this.check(_lowercase(params));
},
uppercase(params) {
return this.check(_uppercase(params));
},
trim() {
return this.check(_trim());
},
normalize(...args) {
return this.check(_normalize(...args));
},
toLowerCase() {
return this.check(_toLowerCase());
},
toUpperCase() {
return this.check(_toUpperCase());
},
slugify() {
return this.check(_slugify());
}
});
});
var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
$ZodString.init(inst, def);
_ZodString.init(inst, def);
inst.email = (params) => inst.check(_email(ZodEmail, params));
inst.url = (params) => inst.check(_url(ZodURL, params));
inst.jwt = (params) => inst.check(_jwt(ZodJWT, params));
inst.emoji = (params) => inst.check(_emoji2(ZodEmoji, params));
inst.guid = (params) => inst.check(_guid(ZodGUID, params));
inst.uuid = (params) => inst.check(_uuid(ZodUUID, params));
inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params));
inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params));
inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params));
inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params));
inst.guid = (params) => inst.check(_guid(ZodGUID, params));
inst.cuid = (params) => inst.check(_cuid(ZodCUID, params));
inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params));
inst.ulid = (params) => inst.check(_ulid(ZodULID, params));
inst.base64 = (params) => inst.check(_base64(ZodBase64, params));
inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params));
inst.xid = (params) => inst.check(_xid(ZodXID, params));
inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params));
inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params));
inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params));
inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params));
inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));
inst.e164 = (params) => inst.check(_e164(ZodE164, params));
inst.datetime = (params) => inst.check(datetime2(params));
inst.date = (params) => inst.check(date2(params));
inst.time = (params) => inst.check(time2(params));
inst.duration = (params) => inst.check(duration2(params));
});
function string2(params) {
return _string(ZodString, params);
}
var ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
$ZodStringFormat.init(inst, def);
_ZodString.init(inst, def);
});
var ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
$ZodEmail.init(inst, def);
ZodStringFormat.init(inst, def);
});
function email2(params) {
return _email(ZodEmail, params);
}
var ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
$ZodGUID.init(inst, def);
ZodStringFormat.init(inst, def);
});
function guid2(params) {
return _guid(ZodGUID, params);
}
var ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
$ZodUUID.init(inst, def);
ZodStringFormat.init(inst, def);
});
function uuid2(params) {
return _uuid(ZodUUID, params);
}
function uuidv4(params) {
return _uuidv4(ZodUUID, params);
}
function uuidv6(params) {
return _uuidv6(ZodUUID, params);
}
function uuidv7(params) {
return _uuidv7(ZodUUID, params);
}
var ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
$ZodURL.init(inst, def);
ZodStringFormat.init(inst, def);
});
function url(params) {
return _url(ZodURL, params);
}
function httpUrl(params) {
return _url(ZodURL, {
protocol: exports_regexes.httpProtocol,
hostname: exports_regexes.domain,
...exports_util.normalizeParams(params)
});
}
var ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
$ZodEmoji.init(inst, def);
ZodStringFormat.init(inst, def);
});
function emoji2(params) {
return _emoji2(ZodEmoji, params);
}
var ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
$ZodNanoID.init(inst, def);
ZodStringFormat.init(inst, def);
});
function nanoid2(params) {
return _nanoid(ZodNanoID, params);
}
var ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
$ZodCUID.init(inst, def);
ZodStringFormat.init(inst, def);
});
function cuid3(params) {
return _cuid(ZodCUID, params);
}
var ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
$ZodCUID2.init(inst, def);
ZodStringFormat.init(inst, def);
});
function cuid22(params) {
return _cuid2(ZodCUID2, params);
}
var ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
$ZodULID.init(inst, def);
ZodStringFormat.init(inst, def);
});
function ulid2(params) {
return _ulid(ZodULID, params);
}
var ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
$ZodXID.init(inst, def);
ZodStringFormat.init(inst, def);
});
function xid2(params) {
return _xid(ZodXID, params);
}
var ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
$ZodKSUID.init(inst, def);
ZodStringFormat.init(inst, def);
});
function ksuid2(params) {
return _ksuid(ZodKSUID, params);
}
var ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
$ZodIPv4.init(inst, def);
ZodStringFormat.init(inst, def);
});
function ipv42(params) {
return _ipv4(ZodIPv4, params);
}
var ZodMAC = /* @__PURE__ */ $constructor("ZodMAC", (inst, def) => {
$ZodMAC.init(inst, def);
ZodStringFormat.init(inst, def);
});
function mac2(params) {
return _mac(ZodMAC, params);
}
var ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
$ZodIPv6.init(inst, def);
ZodStringFormat.init(inst, def);
});
function ipv62(params) {
return _ipv6(ZodIPv6, params);
}
var ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
$ZodCIDRv4.init(inst, def);
ZodStringFormat.init(inst, def);
});
function cidrv42(params) {
return _cidrv4(ZodCIDRv4, params);
}
var ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
$ZodCIDRv6.init(inst, def);
ZodStringFormat.init(inst, def);
});
function cidrv62(params) {
return _cidrv6(ZodCIDRv6, params);
}
var ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
$ZodBase64.init(inst, def);
ZodStringFormat.init(inst, def);
});
function base642(params) {
return _base64(ZodBase64, params);
}
var ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
$ZodBase64URL.init(inst, def);
ZodStringFormat.init(inst, def);
});
function base64url2(params) {
return _base64url(ZodBase64URL, params);
}
var ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
$ZodE164.init(inst, def);
ZodStringFormat.init(inst, def);
});
function e1642(params) {
return _e164(ZodE164, params);
}
var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
$ZodJWT.init(inst, def);
ZodStringFormat.init(inst, def);
});
function jwt(params) {
return _jwt(ZodJWT, params);
}
var ZodCustomStringFormat = /* @__PURE__ */ $constructor("ZodCustomStringFormat", (inst, def) => {
$ZodCustomStringFormat.init(inst, def);
ZodStringFormat.init(inst, def);
});
function stringFormat(format, fnOrRegex, _params = {}) {
return _stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
}
function hostname2(_params) {
return _stringFormat(ZodCustomStringFormat, "hostname", exports_regexes.hostname, _params);
}
function hex2(_params) {
return _stringFormat(ZodCustomStringFormat, "hex", exports_regexes.hex, _params);
}
function hash(alg, params) {
const enc = params?.enc ?? "hex";
const format = `${alg}_${enc}`;
const regex = exports_regexes[format];
if (!regex)
throw new Error(`Unrecognized hash format: ${format}`);
return _stringFormat(ZodCustomStringFormat, format, regex, params);
}
var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
$ZodNumber.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
_installLazyMethods(inst, "ZodNumber", {
gt(value, params) {
return this.check(_gt(value, params));
},
gte(value, params) {
return this.check(_gte(value, params));
},
min(value, params) {
return this.check(_gte(value, params));
},
lt(value, params) {
return this.check(_lt(value, params));
},
lte(value, params) {
return this.check(_lte(value, params));
},
max(value, params) {
return this.check(_lte(value, params));
},
int(params) {
return this.check(int(params));
},
safe(params) {
return this.check(int(params));
},
positive(params) {
return this.check(_gt(0, params));
},
nonnegative(params) {
return this.check(_gte(0, params));
},
negative(params) {
return this.check(_lt(0, params));
},
nonpositive(params) {
return this.check(_lte(0, params));
},
multipleOf(value, params) {
return this.check(_multipleOf(value, params));
},
step(value, params) {
return this.check(_multipleOf(value, params));
},
finite() {
return this;
}
});
const bag = inst._zod.bag;
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
inst.isFinite = true;
inst.format = bag.format ?? null;
});
function number2(params) {
return _number(ZodNumber, params);
}
var ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {
$ZodNumberFormat.init(inst, def);
ZodNumber.init(inst, def);
});
function int(params) {
return _int(ZodNumberFormat, params);
}
function float32(params) {
return _float32(ZodNumberFormat, params);
}
function float64(params) {
return _float64(ZodNumberFormat, params);
}
function int32(params) {
return _int32(ZodNumberFormat, params);
}
function uint32(params) {
return _uint32(ZodNumberFormat, params);
}
var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
$ZodBoolean.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
});
function boolean2(params) {
return _boolean(ZodBoolean, params);
}
var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
$ZodBigInt.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => bigintProcessor(inst, ctx, json, params);
inst.gte = (value, params) => inst.check(_gte(value, params));
inst.min = (value, params) => inst.check(_gte(value, params));
inst.gt = (value, params) => inst.check(_gt(value, params));
inst.gte = (value, params) => inst.check(_gte(value, params));
inst.min = (value, params) => inst.check(_gte(value, params));
inst.lt = (value, params) => inst.check(_lt(value, params));
inst.lte = (value, params) => inst.check(_lte(value, params));
inst.max = (value, params) => inst.check(_lte(value, params));
inst.positive = (params) => inst.check(_gt(BigInt(0), params));
inst.negative = (params) => inst.check(_lt(BigInt(0), params));
inst.nonpositive = (params) => inst.check(_lte(BigInt(0), params));
inst.nonnegative = (params) => inst.check(_gte(BigInt(0), params));
inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));
const bag = inst._zod.bag;
inst.minValue = bag.minimum ?? null;
inst.maxValue = bag.maximum ?? null;
inst.format = bag.format ?? null;
});
function bigint2(params) {
return _bigint(ZodBigInt, params);
}
var ZodBigIntFormat = /* @__PURE__ */ $constructor("ZodBigIntFormat", (inst, def) => {
$ZodBigIntFormat.init(inst, def);
ZodBigInt.init(inst, def);
});
function int64(params) {
return _int64(ZodBigIntFormat, params);
}
function uint64(params) {
return _uint64(ZodBigIntFormat, params);
}
var ZodSymbol = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => {
$ZodSymbol.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => symbolProcessor(inst, ctx, json, params);
});
function symbol(params) {
return _symbol(ZodSymbol, params);
}
var ZodUndefined = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => {
$ZodUndefined.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => undefinedProcessor(inst, ctx, json, params);
});
function _undefined3(params) {
return _undefined2(ZodUndefined, params);
}
var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
$ZodNull.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json, params);
});
function _null3(params) {
return _null2(ZodNull, params);
}
var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
$ZodAny.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => anyProcessor(inst, ctx, json, params);
});
function any() {
return _any(ZodAny);
}
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
$ZodUnknown.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
});
function unknown() {
return _unknown(ZodUnknown);
}
var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
$ZodNever.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
});
function never(params) {
return _never(ZodNever, params);
}
var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
$ZodVoid.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => voidProcessor(inst, ctx, json, params);
});
function _void2(params) {
return _void(ZodVoid, params);
}
var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
$ZodDate.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => dateProcessor(inst, ctx, json, params);
inst.min = (value, params) => inst.check(_gte(value, params));
inst.max = (value, params) => inst.check(_lte(value, params));
const c = inst._zod.bag;
inst.minDate = c.minimum ? new Date(c.minimum) : null;
inst.maxDate = c.maximum ? new Date(c.maximum) : null;
});
function date3(params) {
return _date(ZodDate, params);
}
var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
$ZodArray.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
inst.element = def.element;
_installLazyMethods(inst, "ZodArray", {
min(n, params) {
return this.check(_minLength(n, params));
},
nonempty(params) {
return this.check(_minLength(1, params));
},
max(n, params) {
return this.check(_maxLength(n, params));
},
length(n, params) {
return this.check(_length(n, params));
},
unwrap() {
return this.element;
}
});
});
function array(element, params) {
return _array(ZodArray, element, params);
}
function keyof(schema) {
const shape = schema._zod.def.shape;
return _enum2(Object.keys(shape));
}
var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
$ZodObjectJIT.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
exports_util.defineLazy(inst, "shape", () => {
return def.shape;
});
_installLazyMethods(inst, "ZodObject", {
keyof() {
return _enum2(Object.keys(this._zod.def.shape));
},
catchall(catchall) {
return this.clone({ ...this._zod.def, catchall });
},
passthrough() {
return this.clone({ ...this._zod.def, catchall: unknown() });
},
loose() {
return this.clone({ ...this._zod.def, catchall: unknown() });
},
strict() {
return this.clone({ ...this._zod.def, catchall: never() });
},
strip() {
return this.clone({ ...this._zod.def, catchall: undefined });
},
extend(incoming) {
return exports_util.extend(this, incoming);
},
safeExtend(incoming) {
return exports_util.safeExtend(this, incoming);
},
merge(other) {
return exports_util.merge(this, other);
},
pick(mask) {
return exports_util.pick(this, mask);
},
omit(mask) {
return exports_util.omit(this, mask);
},
partial(...args) {
return exports_util.partial(ZodOptional, this, args[0]);
},
required(...args) {
return exports_util.required(ZodNonOptional, this, args[0]);
}
});
});
function object(shape, params) {
const def = {
type: "object",
shape: shape ?? {},
...exports_util.normalizeParams(params)
};
return new ZodObject(def);
}
function strictObject(shape, params) {
return new ZodObject({
type: "object",
shape,
catchall: never(),
...exports_util.normalizeParams(params)
});
}
function looseObject(shape, params) {
return new ZodObject({
type: "object",
shape,
catchall: unknown(),
...exports_util.normalizeParams(params)
});
}
var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
$ZodUnion.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
inst.options = def.options;
});
function union(options, params) {
return new ZodUnion({
type: "union",
options,
...exports_util.normalizeParams(params)
});
}
var ZodXor = /* @__PURE__ */ $constructor("ZodXor", (inst, def) => {
ZodUnion.init(inst, def);
$ZodXor.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
inst.options = def.options;
});
function xor(options, params) {
return new ZodXor({
type: "union",
options,
inclusive: false,
...exports_util.normalizeParams(params)
});
}
var ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => {
ZodUnion.init(inst, def);
$ZodDiscriminatedUnion.init(inst, def);
});
function discriminatedUnion(discriminator, options, params) {
return new ZodDiscriminatedUnion({
type: "union",
options,
discriminator,
...exports_util.normalizeParams(params)
});
}
var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
$ZodIntersection.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
});
function intersection(left, right) {
return new ZodIntersection({
type: "intersection",
left,
right
});
}
var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
$ZodTuple.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
inst.rest = (rest) => inst.clone({
...inst._zod.def,
rest
});
});
function tuple(items, _paramsOrRest, _params) {
const hasRest = _paramsOrRest instanceof $ZodType;
const params = hasRest ? _params : _paramsOrRest;
const rest = hasRest ? _paramsOrRest : null;
return new ZodTuple({
type: "tuple",
items,
rest,
...exports_util.normalizeParams(params)
});
}
var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
$ZodRecord.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
inst.keyType = def.keyType;
inst.valueType = def.valueType;
});
function record(keyType, valueType, params) {
if (!valueType || !valueType._zod) {
return new ZodRecord({
type: "record",
keyType: string2(),
valueType: keyType,
...exports_util.normalizeParams(valueType)
});
}
return new ZodRecord({
type: "record",
keyType,
valueType,
...exports_util.normalizeParams(params)
});
}
function partialRecord(keyType, valueType, params) {
const k = clone(keyType);
k._zod.values = undefined;
return new ZodRecord({
type: "record",
keyType: k,
valueType,
...exports_util.normalizeParams(params)
});
}
function looseRecord(keyType, valueType, params) {
return new ZodRecord({
type: "record",
keyType,
valueType,
mode: "loose",
...exports_util.normalizeParams(params)
});
}
var ZodMap = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => {
$ZodMap.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => mapProcessor(inst, ctx, json, params);
inst.keyType = def.keyType;
inst.valueType = def.valueType;
inst.min = (...args) => inst.check(_minSize(...args));
inst.nonempty = (params) => inst.check(_minSize(1, params));
inst.max = (...args) => inst.check(_maxSize(...args));
inst.size = (...args) => inst.check(_size(...args));
});
function map(keyType, valueType, params) {
return new ZodMap({
type: "map",
keyType,
valueType,
...exports_util.normalizeParams(params)
});
}
var ZodSet = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => {
$ZodSet.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => setProcessor(inst, ctx, json, params);
inst.min = (...args) => inst.check(_minSize(...args));
inst.nonempty = (params) => inst.check(_minSize(1, params));
inst.max = (...args) => inst.check(_maxSize(...args));
inst.size = (...args) => inst.check(_size(...args));
});
function set(valueType, params) {
return new ZodSet({
type: "set",
valueType,
...exports_util.normalizeParams(params)
});
}
var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
$ZodEnum.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
inst.enum = def.entries;
inst.options = Object.values(def.entries);
const keys = new Set(Object.keys(def.entries));
inst.extract = (values, params) => {
const newEntries = {};
for (const value of values) {
if (keys.has(value)) {
newEntries[value] = def.entries[value];
} else
throw new Error(`Key ${value} not found in enum`);
}
return new ZodEnum({
...def,
checks: [],
...exports_util.normalizeParams(params),
entries: newEntries
});
};
inst.exclude = (values, params) => {
const newEntries = { ...def.entries };
for (const value of values) {
if (keys.has(value)) {
delete newEntries[value];
} else
throw new Error(`Key ${value} not found in enum`);
}
return new ZodEnum({
...def,
checks: [],
...exports_util.normalizeParams(params),
entries: newEntries
});
};
});
function _enum2(values, params) {
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
return new ZodEnum({
type: "enum",
entries,
...exports_util.normalizeParams(params)
});
}
function nativeEnum(entries, params) {
return new ZodEnum({
type: "enum",
entries,
...exports_util.normalizeParams(params)
});
}
var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
$ZodLiteral.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
inst.values = new Set(def.values);
Object.defineProperty(inst, "value", {
get() {
if (def.values.length > 1) {
throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
}
return def.values[0];
}
});
});
function literal(value, params) {
return new ZodLiteral({
type: "literal",
values: Array.isArray(value) ? value : [value],
...exports_util.normalizeParams(params)
});
}
var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {
$ZodFile.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => fileProcessor(inst, ctx, json, params);
inst.min = (size, params) => inst.check(_minSize(size, params));
inst.max = (size, params) => inst.check(_maxSize(size, params));
inst.mime = (types, params) => inst.check(_mime(Array.isArray(types) ? types : [types], params));
});
function file(params) {
return _file(ZodFile, params);
}
var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
$ZodTransform.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
inst._zod.parse = (payload, _ctx) => {
if (_ctx.direction === "backward") {
throw new $ZodEncodeError(inst.constructor.name);
}
payload.addIssue = (issue2) => {
if (typeof issue2 === "string") {
payload.issues.push(exports_util.issue(issue2, payload.value, def));
} else {
const _issue = issue2;
if (_issue.fatal)
_issue.continue = false;
_issue.code ?? (_issue.code = "custom");
_issue.input ?? (_issue.input = payload.value);
_issue.inst ?? (_issue.inst = inst);
payload.issues.push(exports_util.issue(_issue));
}
};
const output = def.transform(payload.value, payload);
if (output instanceof Promise) {
return output.then((output2) => {
payload.value = output2;
payload.fallback = true;
return payload;
});
}
payload.value = output;
payload.fallback = true;
return payload;
};
});
function transform(fn) {
return new ZodTransform({
type: "transform",
transform: fn
});
}
var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
$ZodOptional.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
inst.unwrap = () => inst._zod.def.innerType;
});
function optional(innerType) {
return new ZodOptional({
type: "optional",
innerType
});
}
var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
$ZodExactOptional.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
inst.unwrap = () => inst._zod.def.innerType;
});
function exactOptional(innerType) {
return new ZodExactOptional({
type: "optional",
innerType
});
}
var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
$ZodNullable.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
inst.unwrap = () => inst._zod.def.innerType;
});
function nullable(innerType) {
return new ZodNullable({
type: "nullable",
innerType
});
}
function nullish2(innerType) {
return optional(nullable(innerType));
}
var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
$ZodDefault.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
inst.unwrap = () => inst._zod.def.innerType;
inst.removeDefault = inst.unwrap;
});
function _default2(innerType, defaultValue) {
return new ZodDefault({
type: "default",
innerType,
get defaultValue() {
return typeof defaultValue === "function" ? defaultValue() : exports_util.shallowClone(defaultValue);
}
});
}
var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
$ZodPrefault.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
inst.unwrap = () => inst._zod.def.innerType;
});
function prefault(innerType, defaultValue) {
return new ZodPrefault({
type: "prefault",
innerType,
get defaultValue() {
return typeof defaultValue === "function" ? defaultValue() : exports_util.shallowClone(defaultValue);
}
});
}
var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
$ZodNonOptional.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
inst.unwrap = () => inst._zod.def.innerType;
});
function nonoptional(innerType, params) {
return new ZodNonOptional({
type: "nonoptional",
innerType,
...exports_util.normalizeParams(params)
});
}
var ZodSuccess = /* @__PURE__ */ $constructor("ZodSuccess", (inst, def) => {
$ZodSuccess.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => successProcessor(inst, ctx, json, params);
inst.unwrap = () => inst._zod.def.innerType;
});
function success(innerType) {
return new ZodSuccess({
type: "success",
innerType
});
}
var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
$ZodCatch.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
inst.unwrap = () => inst._zod.def.innerType;
inst.removeCatch = inst.unwrap;
});
function _catch2(innerType, catchValue) {
return new ZodCatch({
type: "catch",
innerType,
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
});
}
var ZodNaN = /* @__PURE__ */ $constructor("ZodNaN", (inst, def) => {
$ZodNaN.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => nanProcessor(inst, ctx, json, params);
});
function nan(params) {
return _nan(ZodNaN, params);
}
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
$ZodPipe.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
inst.in = def.in;
inst.out = def.out;
});
function pipe(in_, out) {
return new ZodPipe({
type: "pipe",
in: in_,
out
});
}
var ZodCodec = /* @__PURE__ */ $constructor("ZodCodec", (inst, def) => {
ZodPipe.init(inst, def);
$ZodCodec.init(inst, def);
});
function codec(in_, out, params) {
return new ZodCodec({
type: "pipe",
in: in_,
out,
transform: params.decode,
reverseTransform: params.encode
});
}
function invertCodec(codec2) {
const def = codec2._zod.def;
return new ZodCodec({
type: "pipe",
in: def.out,
out: def.in,
transform: def.reverseTransform,
reverseTransform: def.transform
});
}
var ZodPreprocess = /* @__PURE__ */ $constructor("ZodPreprocess", (inst, def) => {
ZodPipe.init(inst, def);
$ZodPreprocess.init(inst, def);
});
var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
$ZodReadonly.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
inst.unwrap = () => inst._zod.def.innerType;
});
function readonly(innerType) {
return new ZodReadonly({
type: "readonly",
innerType
});
}
var ZodTemplateLiteral = /* @__PURE__ */ $constructor("ZodTemplateLiteral", (inst, def) => {
$ZodTemplateLiteral.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => templateLiteralProcessor(inst, ctx, json, params);
});
function templateLiteral(parts, params) {
return new ZodTemplateLiteral({
type: "template_literal",
parts,
...exports_util.normalizeParams(params)
});
}
var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
$ZodLazy.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => lazyProcessor(inst, ctx, json, params);
inst.unwrap = () => inst._zod.def.getter();
});
function lazy(getter) {
return new ZodLazy({
type: "lazy",
getter
});
}
var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
$ZodPromise.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => promiseProcessor(inst, ctx, json, params);
inst.unwrap = () => inst._zod.def.innerType;
});
function promise(innerType) {
return new ZodPromise({
type: "promise",
innerType
});
}
var ZodFunction = /* @__PURE__ */ $constructor("ZodFunction", (inst, def) => {
$ZodFunction.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => functionProcessor(inst, ctx, json, params);
});
function _function(params) {
return new ZodFunction({
type: "function",
input: Array.isArray(params?.input) ? tuple(params?.input) : params?.input ?? array(unknown()),
output: params?.output ?? unknown()
});
}
var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
$ZodCustom.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
});
function check(fn) {
const ch = new $ZodCheck({
check: "custom"
});
ch._zod.check = fn;
return ch;
}
function custom(fn, _params) {
return _custom(ZodCustom, fn ?? (() => true), _params);
}
function refine(fn, _params = {}) {
return _refine(ZodCustom, fn, _params);
}
function superRefine(fn, params) {
return _superRefine(fn, params);
}
var describe2 = describe;
var meta2 = meta;
function _instanceof(cls, params = {}) {
const inst = new ZodCustom({
type: "custom",
check: "custom",
fn: (data) => data instanceof cls,
abort: true,
...exports_util.normalizeParams(params)
});
inst._zod.bag.Class = cls;
inst._zod.check = (payload) => {
if (!(payload.value instanceof cls)) {
payload.issues.push({
code: "invalid_type",
expected: cls.name,
input: payload.value,
inst,
path: [...inst._zod.def.path ?? []]
});
}
};
return inst;
}
var stringbool = (...args) => _stringbool({
Codec: ZodCodec,
Boolean: ZodBoolean,
String: ZodString
}, ...args);
function json(params) {
const jsonSchema = lazy(() => {
return union([string2(params), number2(), boolean2(), _null3(), array(jsonSchema), record(string2(), jsonSchema)]);
});
return jsonSchema;
}
function preprocess(fn, schema) {
return new ZodPreprocess({
type: "pipe",
in: transform(fn),
out: schema
});
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/compat.js
var ZodIssueCode = {
invalid_type: "invalid_type",
too_big: "too_big",
too_small: "too_small",
invalid_format: "invalid_format",
not_multiple_of: "not_multiple_of",
unrecognized_keys: "unrecognized_keys",
invalid_union: "invalid_union",
invalid_key: "invalid_key",
invalid_element: "invalid_element",
invalid_value: "invalid_value",
custom: "custom"
};
function setErrorMap(map2) {
config({
customError: map2
});
}
function getErrorMap() {
return config().customError;
}
var ZodFirstPartyTypeKind;
(function(ZodFirstPartyTypeKind2) {})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/from-json-schema.js
var z = {
...exports_schemas2,
...exports_checks2,
iso: exports_iso
};
var RECOGNIZED_KEYS = /* @__PURE__ */ new Set([
"$schema",
"$ref",
"$defs",
"definitions",
"$id",
"id",
"$comment",
"$anchor",
"$vocabulary",
"$dynamicRef",
"$dynamicAnchor",
"type",
"enum",
"const",
"anyOf",
"oneOf",
"allOf",
"not",
"properties",
"required",
"additionalProperties",
"patternProperties",
"propertyNames",
"minProperties",
"maxProperties",
"items",
"prefixItems",
"additionalItems",
"minItems",
"maxItems",
"uniqueItems",
"contains",
"minContains",
"maxContains",
"minLength",
"maxLength",
"pattern",
"format",
"minimum",
"maximum",
"exclusiveMinimum",
"exclusiveMaximum",
"multipleOf",
"description",
"default",
"contentEncoding",
"contentMediaType",
"contentSchema",
"unevaluatedItems",
"unevaluatedProperties",
"if",
"then",
"else",
"dependentSchemas",
"dependentRequired",
"nullable",
"readOnly"
]);
function detectVersion(schema, defaultTarget) {
const $schema = schema.$schema;
if ($schema === "https://json-schema.org/draft/2020-12/schema") {
return "draft-2020-12";
}
if ($schema === "http://json-schema.org/draft-07/schema#") {
return "draft-7";
}
if ($schema === "http://json-schema.org/draft-04/schema#") {
return "draft-4";
}
return defaultTarget ?? "draft-2020-12";
}
function resolveRef(ref, ctx) {
if (!ref.startsWith("#")) {
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
}
const path = ref.slice(1).split("/").filter(Boolean);
if (path.length === 0) {
return ctx.rootSchema;
}
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
if (path[0] === defsKey) {
const key = path[1];
if (!key || !ctx.defs[key]) {
throw new Error(`Reference not found: ${ref}`);
}
return ctx.defs[key];
}
throw new Error(`Reference not found: ${ref}`);
}
function convertBaseSchema(schema, ctx) {
if (schema.not !== undefined) {
if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
return z.never();
}
throw new Error("not is not supported in Zod (except { not: {} } for never)");
}
if (schema.unevaluatedItems !== undefined) {
throw new Error("unevaluatedItems is not supported");
}
if (schema.unevaluatedProperties !== undefined) {
throw new Error("unevaluatedProperties is not supported");
}
if (schema.if !== undefined || schema.then !== undefined || schema.else !== undefined) {
throw new Error("Conditional schemas (if/then/else) are not supported");
}
if (schema.dependentSchemas !== undefined || schema.dependentRequired !== undefined) {
throw new Error("dependentSchemas and dependentRequired are not supported");
}
if (schema.$ref) {
const refPath = schema.$ref;
if (ctx.refs.has(refPath)) {
return ctx.refs.get(refPath);
}
if (ctx.processing.has(refPath)) {
return z.lazy(() => {
if (!ctx.refs.has(refPath)) {
throw new Error(`Circular reference not resolved: ${refPath}`);
}
return ctx.refs.get(refPath);
});
}
ctx.processing.add(refPath);
const resolved = resolveRef(refPath, ctx);
const zodSchema2 = convertSchema(resolved, ctx);
ctx.refs.set(refPath, zodSchema2);
ctx.processing.delete(refPath);
return zodSchema2;
}
if (schema.enum !== undefined) {
const enumValues = schema.enum;
if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
return z.null();
}
if (enumValues.length === 0) {
return z.never();
}
if (enumValues.length === 1) {
return z.literal(enumValues[0]);
}
if (enumValues.every((v) => typeof v === "string")) {
return z.enum(enumValues);
}
const literalSchemas = enumValues.map((v) => z.literal(v));
if (literalSchemas.length < 2) {
return literalSchemas[0];
}
return z.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
}
if (schema.const !== undefined) {
return z.literal(schema.const);
}
const type = schema.type;
if (Array.isArray(type)) {
const typeSchemas = type.map((t) => {
const typeSchema = { ...schema, type: t };
return convertBaseSchema(typeSchema, ctx);
});
if (typeSchemas.length === 0) {
return z.never();
}
if (typeSchemas.length === 1) {
return typeSchemas[0];
}
return z.union(typeSchemas);
}
if (!type) {
return z.any();
}
let zodSchema;
switch (type) {
case "string": {
let stringSchema = z.string();
if (schema.format) {
const format = schema.format;
if (format === "email") {
stringSchema = stringSchema.check(z.email());
} else if (format === "uri" || format === "uri-reference") {
stringSchema = stringSchema.check(z.url());
} else if (format === "uuid" || format === "guid") {
stringSchema = stringSchema.check(z.uuid());
} else if (format === "date-time") {
stringSchema = stringSchema.check(z.iso.datetime());
} else if (format === "date") {
stringSchema = stringSchema.check(z.iso.date());
} else if (format === "time") {
stringSchema = stringSchema.check(z.iso.time());
} else if (format === "duration") {
stringSchema = stringSchema.check(z.iso.duration());
} else if (format === "ipv4") {
stringSchema = stringSchema.check(z.ipv4());
} else if (format === "ipv6") {
stringSchema = stringSchema.check(z.ipv6());
} else if (format === "mac") {
stringSchema = stringSchema.check(z.mac());
} else if (format === "cidr") {
stringSchema = stringSchema.check(z.cidrv4());
} else if (format === "cidr-v6") {
stringSchema = stringSchema.check(z.cidrv6());
} else if (format === "base64") {
stringSchema = stringSchema.check(z.base64());
} else if (format === "base64url") {
stringSchema = stringSchema.check(z.base64url());
} else if (format === "e164") {
stringSchema = stringSchema.check(z.e164());
} else if (format === "jwt") {
stringSchema = stringSchema.check(z.jwt());
} else if (format === "emoji") {
stringSchema = stringSchema.check(z.emoji());
} else if (format === "nanoid") {
stringSchema = stringSchema.check(z.nanoid());
} else if (format === "cuid") {
stringSchema = stringSchema.check(z.cuid());
} else if (format === "cuid2") {
stringSchema = stringSchema.check(z.cuid2());
} else if (format === "ulid") {
stringSchema = stringSchema.check(z.ulid());
} else if (format === "xid") {
stringSchema = stringSchema.check(z.xid());
} else if (format === "ksuid") {
stringSchema = stringSchema.check(z.ksuid());
}
}
if (typeof schema.minLength === "number") {
stringSchema = stringSchema.min(schema.minLength);
}
if (typeof schema.maxLength === "number") {
stringSchema = stringSchema.max(schema.maxLength);
}
if (schema.pattern) {
stringSchema = stringSchema.regex(new RegExp(schema.pattern));
}
zodSchema = stringSchema;
break;
}
case "number":
case "integer": {
let numberSchema = type === "integer" ? z.number().int() : z.number();
if (typeof schema.minimum === "number") {
numberSchema = numberSchema.min(schema.minimum);
}
if (typeof schema.maximum === "number") {
numberSchema = numberSchema.max(schema.maximum);
}
if (typeof schema.exclusiveMinimum === "number") {
numberSchema = numberSchema.gt(schema.exclusiveMinimum);
} else if (schema.exclusiveMinimum === true && typeof schema.minimum === "number") {
numberSchema = numberSchema.gt(schema.minimum);
}
if (typeof schema.exclusiveMaximum === "number") {
numberSchema = numberSchema.lt(schema.exclusiveMaximum);
} else if (schema.exclusiveMaximum === true && typeof schema.maximum === "number") {
numberSchema = numberSchema.lt(schema.maximum);
}
if (typeof schema.multipleOf === "number") {
numberSchema = numberSchema.multipleOf(schema.multipleOf);
}
zodSchema = numberSchema;
break;
}
case "boolean": {
zodSchema = z.boolean();
break;
}
case "null": {
zodSchema = z.null();
break;
}
case "object": {
const shape = {};
const properties = schema.properties || {};
const requiredSet = new Set(schema.required || []);
for (const [key, propSchema] of Object.entries(properties)) {
const propZodSchema = convertSchema(propSchema, ctx);
shape[key] = requiredSet.has(key) ? propZodSchema : propZodSchema.optional();
}
if (schema.propertyNames) {
const keySchema = convertSchema(schema.propertyNames, ctx);
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z.any();
if (Object.keys(shape).length === 0) {
zodSchema = z.record(keySchema, valueSchema);
break;
}
const objectSchema2 = z.object(shape).passthrough();
const recordSchema = z.looseRecord(keySchema, valueSchema);
zodSchema = z.intersection(objectSchema2, recordSchema);
break;
}
if (schema.patternProperties) {
const patternProps = schema.patternProperties;
const patternKeys = Object.keys(patternProps);
const looseRecords = [];
for (const pattern of patternKeys) {
const patternValue = convertSchema(patternProps[pattern], ctx);
const keySchema = z.string().regex(new RegExp(pattern));
looseRecords.push(z.looseRecord(keySchema, patternValue));
}
const schemasToIntersect = [];
if (Object.keys(shape).length > 0) {
schemasToIntersect.push(z.object(shape).passthrough());
}
schemasToIntersect.push(...looseRecords);
if (schemasToIntersect.length === 0) {
zodSchema = z.object({}).passthrough();
} else if (schemasToIntersect.length === 1) {
zodSchema = schemasToIntersect[0];
} else {
let result = z.intersection(schemasToIntersect[0], schemasToIntersect[1]);
for (let i = 2;i < schemasToIntersect.length; i++) {
result = z.intersection(result, schemasToIntersect[i]);
}
zodSchema = result;
}
break;
}
const objectSchema = z.object(shape);
if (schema.additionalProperties === false) {
zodSchema = objectSchema.strict();
} else if (typeof schema.additionalProperties === "object") {
zodSchema = objectSchema.catchall(convertSchema(schema.additionalProperties, ctx));
} else {
zodSchema = objectSchema.passthrough();
}
break;
}
case "array": {
const prefixItems = schema.prefixItems;
const items = schema.items;
if (prefixItems && Array.isArray(prefixItems)) {
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : undefined;
if (rest) {
zodSchema = z.tuple(tupleItems).rest(rest);
} else {
zodSchema = z.tuple(tupleItems);
}
if (typeof schema.minItems === "number") {
zodSchema = zodSchema.check(z.minLength(schema.minItems));
}
if (typeof schema.maxItems === "number") {
zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
}
} else if (Array.isArray(items)) {
const tupleItems = items.map((item) => convertSchema(item, ctx));
const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : undefined;
if (rest) {
zodSchema = z.tuple(tupleItems).rest(rest);
} else {
zodSchema = z.tuple(tupleItems);
}
if (typeof schema.minItems === "number") {
zodSchema = zodSchema.check(z.minLength(schema.minItems));
}
if (typeof schema.maxItems === "number") {
zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
}
} else if (items !== undefined) {
const element = convertSchema(items, ctx);
let arraySchema = z.array(element);
if (typeof schema.minItems === "number") {
arraySchema = arraySchema.min(schema.minItems);
}
if (typeof schema.maxItems === "number") {
arraySchema = arraySchema.max(schema.maxItems);
}
zodSchema = arraySchema;
} else {
zodSchema = z.array(z.any());
}
break;
}
default:
throw new Error(`Unsupported type: ${type}`);
}
return zodSchema;
}
function convertSchema(schema, ctx) {
if (typeof schema === "boolean") {
return schema ? z.any() : z.never();
}
let baseSchema = convertBaseSchema(schema, ctx);
const hasExplicitType = schema.type || schema.enum !== undefined || schema.const !== undefined;
if (schema.anyOf && Array.isArray(schema.anyOf)) {
const options = schema.anyOf.map((s) => convertSchema(s, ctx));
const anyOfUnion = z.union(options);
baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
}
if (schema.oneOf && Array.isArray(schema.oneOf)) {
const options = schema.oneOf.map((s) => convertSchema(s, ctx));
const oneOfUnion = z.xor(options);
baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
}
if (schema.allOf && Array.isArray(schema.allOf)) {
if (schema.allOf.length === 0) {
baseSchema = hasExplicitType ? baseSchema : z.any();
} else {
let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
const startIdx = hasExplicitType ? 0 : 1;
for (let i = startIdx;i < schema.allOf.length; i++) {
result = z.intersection(result, convertSchema(schema.allOf[i], ctx));
}
baseSchema = result;
}
}
if (schema.nullable === true && ctx.version === "openapi-3.0") {
baseSchema = z.nullable(baseSchema);
}
if (schema.readOnly === true) {
baseSchema = z.readonly(baseSchema);
}
if (schema.default !== undefined) {
baseSchema = baseSchema.default(schema.default);
}
const extraMeta = {};
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
for (const key of coreMetadataKeys) {
if (key in schema) {
extraMeta[key] = schema[key];
}
}
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
for (const key of contentMetadataKeys) {
if (key in schema) {
extraMeta[key] = schema[key];
}
}
for (const key of Object.keys(schema)) {
if (!RECOGNIZED_KEYS.has(key)) {
extraMeta[key] = schema[key];
}
}
if (Object.keys(extraMeta).length > 0) {
ctx.registry.add(baseSchema, extraMeta);
}
if (schema.description) {
baseSchema = baseSchema.describe(schema.description);
}
return baseSchema;
}
function fromJSONSchema(schema, params) {
if (typeof schema === "boolean") {
return schema ? z.any() : z.never();
}
let normalized;
try {
normalized = JSON.parse(JSON.stringify(schema));
} catch {
throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
}
const version3 = detectVersion(normalized, params?.defaultTarget);
const defs = normalized.$defs || normalized.definitions || {};
const ctx = {
version: version3,
defs,
refs: new Map,
processing: new Set,
rootSchema: normalized,
registry: params?.registry ?? globalRegistry
};
return convertSchema(normalized, ctx);
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/coerce.js
var exports_coerce = {};
__export(exports_coerce, {
string: () => string3,
number: () => number3,
date: () => date4,
boolean: () => boolean3,
bigint: () => bigint3
});
function string3(params) {
return _coercedString(ZodString, params);
}
function number3(params) {
return _coercedNumber(ZodNumber, params);
}
function boolean3(params) {
return _coercedBoolean(ZodBoolean, params);
}
function bigint3(params) {
return _coercedBigint(ZodBigInt, params);
}
function date4(params) {
return _coercedDate(ZodDate, params);
}
// node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/external.js
config(en_default());
// packages/core/src/constants.ts
var configSourceSchema = exports_external.enum(["default", "user", "project", "env"]);
var configScopeSchema = exports_external.enum(["user", "project"]);
var databaseProviderSchema = exports_external.enum(["bun-sqlite", "turso"]);
var outputFormatSchema = exports_external.enum(["auto", "table", "normal"]);
var messageModeSchema = exports_external.enum(["all", "unread", "none"]);
var requirementKeySchema = exports_external.enum(["add.url", "add.note", "claim.by"]);
var pigeonOperationSchema = exports_external.enum([
"initPigeon",
"getPigeonStatus",
"addTask",
"listTasks",
"addMessage",
"listMessages",
"ackMessage",
"ackMessages",
"resolveMessage",
"claimTask",
"claimTaskById",
"releaseTask",
"updateTask",
"blockTask",
"completeTask"
]);
var configSource = Object.freeze({
default: "default",
user: "user",
project: "project",
env: "env"
});
var configSources = configSourceSchema.options;
var configScopeValues = configScopeSchema.options;
var configScope = Object.freeze({
user: "user",
project: "project"
});
var databaseProvider = Object.freeze({
bunSqlite: "bun-sqlite",
turso: "turso"
});
var databaseProviders = Object.freeze(databaseProviderSchema.options);
var envVar = Object.freeze({
db: "PIGEON_DB",
by: "PIGEON_BY",
url: "PIGEON_URL",
token: "PIGEON_TOKEN",
databaseProvider: "PIGEON_DATABASE_PROVIDER",
databaseUrl: "PIGEON_DATABASE_URL",
databaseToken: "PIGEON_DATABASE_TOKEN",
localOnly: "PIGEON_LOCAL_ONLY",
worktreeLocal: "PIGEON_WORKTREE_LOCAL",
columns: "PIGEON_COLUMNS",
output: "PIGEON_OUTPUT",
require: "PIGEON_REQUIRE"
});
var outputFormat = Object.freeze({
auto: "auto",
table: "table",
normal: "normal"
});
var outputFormats = Object.freeze(outputFormatSchema.options);
var outputFormatValues = outputFormatSchema.options;
var messageMode = Object.freeze({
all: "all",
unread: "unread",
none: "none"
});
var messageModes = Object.freeze(messageModeSchema.options);
var messageModeValues = messageModeSchema.options;
var requirementKeys = Object.freeze(requirementKeySchema.options);
var httpRoute = Object.freeze({
health: "/health",
rpc: "/rpc"
});
var httpHeader = Object.freeze({
authorization: "authorization",
pigeonToken: "x-pigeon-token"
});
var httpMethod = Object.freeze({
get: "GET",
post: "POST"
});
var pigeonRpcProtocol = Object.freeze({
version: 2
});
var httpStatus = Object.freeze({
ok: 200,
badRequest: 400,
unauthorized: 401,
notFound: 404,
methodNotAllowed: 405
});
var pigeonOperation = Object.freeze({
initPigeon: "initPigeon",
getPigeonStatus: "getPigeonStatus",
addTask: "addTask",
listTasks: "listTasks",
addMessage: "addMessage",
listMessages: "listMessages",
ackMessage: "ackMessage",
ackMessages: "ackMessages",
resolveMessage: "resolveMessage",
claimTask: "claimTask",
claimTaskById: "claimTaskById",
releaseTask: "releaseTask",
updateTask: "updateTask",
blockTask: "blockTask",
completeTask: "completeTask"
});
var pigeonOperations = Object.freeze(pigeonOperationSchema.options);
var pigeonOperationValues = pigeonOperationSchema.options;
var serverDefault = Object.freeze({
hostname: "127.0.0.1",
port: 8787
});
var dbPragma = Object.freeze({
busyTimeoutMs: 5000,
journalMode: "WAL",
foreignKeys: "ON"
});
var cliValue = Object.freeze({
zero: 0,
one: 1,
defaultIntervalMs: 1000,
minimumWatchIntervalMs: 100,
minimumMonitorIntervalMs: 100,
minimumWaitIntervalMs: 10,
maxPort: 65535
});
var outputLayout = Object.freeze({
compactTableWidth: 72,
defaultTableWidth: 100,
minimumTerminalWidth: 40,
minimumWrappedValueWidth: 20,
compactDateLength: 16,
preferredWidthGrowthMultiplier: 1.6
});
// node_modules/.bun/es-toolkit@1.50.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
function isPlainObject2(value) {
if (!value || typeof value !== "object")
return false;
const proto = Object.getPrototypeOf(value);
if (!(proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null))
return false;
return Object.prototype.toString.call(value) === "[object Object]";
}
// node_modules/.bun/es-toolkit@1.50.0/node_modules/es-toolkit/dist/predicate/isError.mjs
function isError(value) {
return value instanceof Error;
}
// node_modules/.bun/es-toolkit@1.50.0/node_modules/es-toolkit/dist/predicate/isString.mjs
function isString(value) {
return typeof value === "string";
}
// packages/core/src/guards.ts
function isNonNullableString(value) {
return isString(value);
}
function isNonBlankString(value) {
return isNonNullableString(value) && value.trim().length > 0;
}
function isRecordObject(value) {
return isPlainObject2(value);
}
function hasProperties(value) {
return isRecordObject(value);
}
function isError2(value) {
return isError(value);
}
// node_modules/.bun/nanoid@5.1.16/node_modules/nanoid/url-alphabet/index.js
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
// node_modules/.bun/nanoid@5.1.16/node_modules/nanoid/index.browser.js
var nanoid3 = (size = 21) => {
let id = "";
let bytes = crypto.getRandomValues(new Uint8Array(size |= 0));
while (size--) {
id += urlAlphabet[bytes[size] & 63];
}
return id;
};
// packages/core/src/ids.ts
var pigeonIdLength = 16;
function createPigeonId() {
return nanoid3(pigeonIdLength);
}
// packages/core/src/parsing.ts
var trimmedStringSchema = exports_external.string().trim();
var optionalTrimmedStringSchema = exports_external.string().trim().transform((value) => value.length > 0 ? value : undefined).optional();
var nullableTrimmedStringSchema = exports_external.string().trim().transform((value) => value.length > 0 ? value : null).optional();
function splitCsv(value) {
return value.split(",").map((item) => item.trim()).filter((item) => item.length > 0);
}
var csvTextSchema = exports_external.string().transform(splitCsv);
var listValuesSchema = exports_external.union([exports_external.string(), exports_external.array(exports_external.unknown())]).transform((value) => {
if (isNonNullableString(value)) {
return splitCsv(value);
}
return value.filter(isNonNullableString).map((item) => item.trim()).filter((item) => item.length > 0);
});
function uniqueStrings(values) {
return [...new Set(values)];
}
var mentionNameSchema = exports_external.string().trim().transform((value, ctx) => {
const normalized = value.replace(/^@+/, "").toLowerCase();
if (!/^[a-z0-9_.-]+$/.test(normalized)) {
ctx.addIssue({
code: exports_external.ZodIssueCode.custom,
message: "Mention names may contain letters, numbers, dots, underscores, and dashes."
});
return exports_external.NEVER;
}
return normalized;
});
function parseMentionValues(value) {
if (!value) {
return [];
}
return uniqueStrings(splitCsv(value).map((item) => mentionNameSchema.parse(item)));
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/foreign-keys.js
class ForeignKeyBuilder {
static [entityKind] = "SQLiteForeignKeyBuilder";
reference;
_onUpdate;
_onDelete;
constructor(config2, actions) {
this.reference = () => {
const { name, columns, foreignColumns } = config2();
return { name, columns, foreignTable: foreignColumns[0].table, foreignColumns };
};
if (actions) {
this._onUpdate = actions.onUpdate;
this._onDelete = actions.onDelete;
}
}
onUpdate(action) {
this._onUpdate = action;
return this;
}
onDelete(action) {
this._onDelete = action;
return this;
}
build(table) {
return new ForeignKey(table, this);
}
}
class ForeignKey {
constructor(table, builder) {
this.table = table;
this.reference = builder.reference;
this.onUpdate = builder._onUpdate;
this.onDelete = builder._onDelete;
}
static [entityKind] = "SQLiteForeignKey";
reference;
onUpdate;
onDelete;
getName() {
const { name, columns, foreignColumns } = this.reference();
const columnNames = columns.map((column) => column.name);
const foreignColumnNames = foreignColumns.map((column) => column.name);
const chunks = [
this.table[TableName],
...columnNames,
foreignColumns[0].table[TableName],
...foreignColumnNames
];
return name ?? `${chunks.join("_")}_fk`;
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/unique-constraint.js
function uniqueKeyName2(table, columns) {
return `${table[TableName]}_${columns.join("_")}_unique`;
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/columns/common.js
class SQLiteColumnBuilder extends ColumnBuilder {
static [entityKind] = "SQLiteColumnBuilder";
foreignKeyConfigs = [];
references(ref, actions = {}) {
this.foreignKeyConfigs.push({ ref, actions });
return this;
}
unique(name) {
this.config.isUnique = true;
this.config.uniqueName = name;
return this;
}
generatedAlwaysAs(as, config2) {
this.config.generated = {
as,
type: "always",
mode: config2?.mode ?? "virtual"
};
return this;
}
buildForeignKeys(column, table) {
return this.foreignKeyConfigs.map(({ ref, actions }) => {
return ((ref2, actions2) => {
const builder = new ForeignKeyBuilder(() => {
const foreignColumn = ref2();
return { columns: [column], foreignColumns: [foreignColumn] };
});
if (actions2.onUpdate) {
builder.onUpdate(actions2.onUpdate);
}
if (actions2.onDelete) {
builder.onDelete(actions2.onDelete);
}
return builder.build(table);
})(ref, actions);
});
}
}
class SQLiteColumn extends Column {
constructor(table, config2) {
if (!config2.uniqueName) {
config2.uniqueName = uniqueKeyName2(table, [config2.name]);
}
super(table, config2);
this.table = table;
}
static [entityKind] = "SQLiteColumn";
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/columns/blob.js
class SQLiteBigIntBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteBigIntBuilder";
constructor(name) {
super(name, "bigint", "SQLiteBigInt");
}
build(table) {
return new SQLiteBigInt(table, this.config);
}
}
class SQLiteBigInt extends SQLiteColumn {
static [entityKind] = "SQLiteBigInt";
getSQLType() {
return "blob";
}
mapFromDriverValue(value) {
if (typeof Buffer !== "undefined" && Buffer.from) {
const buf = Buffer.isBuffer(value) ? value : value instanceof ArrayBuffer ? Buffer.from(value) : value.buffer ? Buffer.from(value.buffer, value.byteOffset, value.byteLength) : Buffer.from(value);
return BigInt(buf.toString("utf8"));
}
return BigInt(textDecoder.decode(value));
}
mapToDriverValue(value) {
return Buffer.from(value.toString());
}
}
class SQLiteBlobJsonBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteBlobJsonBuilder";
constructor(name) {
super(name, "json", "SQLiteBlobJson");
}
build(table) {
return new SQLiteBlobJson(table, this.config);
}
}
class SQLiteBlobJson extends SQLiteColumn {
static [entityKind] = "SQLiteBlobJson";
getSQLType() {
return "blob";
}
mapFromDriverValue(value) {
if (typeof Buffer !== "undefined" && Buffer.from) {
const buf = Buffer.isBuffer(value) ? value : value instanceof ArrayBuffer ? Buffer.from(value) : value.buffer ? Buffer.from(value.buffer, value.byteOffset, value.byteLength) : Buffer.from(value);
return JSON.parse(buf.toString("utf8"));
}
return JSON.parse(textDecoder.decode(value));
}
mapToDriverValue(value) {
return Buffer.from(JSON.stringify(value));
}
}
class SQLiteBlobBufferBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteBlobBufferBuilder";
constructor(name) {
super(name, "buffer", "SQLiteBlobBuffer");
}
build(table) {
return new SQLiteBlobBuffer(table, this.config);
}
}
class SQLiteBlobBuffer extends SQLiteColumn {
static [entityKind] = "SQLiteBlobBuffer";
mapFromDriverValue(value) {
if (Buffer.isBuffer(value)) {
return value;
}
return Buffer.from(value);
}
getSQLType() {
return "blob";
}
}
function blob(a, b) {
const { name, config: config2 } = getColumnNameAndConfig(a, b);
if (config2?.mode === "json") {
return new SQLiteBlobJsonBuilder(name);
}
if (config2?.mode === "bigint") {
return new SQLiteBigIntBuilder(name);
}
return new SQLiteBlobBufferBuilder(name);
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/columns/custom.js
class SQLiteCustomColumnBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteCustomColumnBuilder";
constructor(name, fieldConfig, customTypeParams) {
super(name, "custom", "SQLiteCustomColumn");
this.config.fieldConfig = fieldConfig;
this.config.customTypeParams = customTypeParams;
}
build(table) {
return new SQLiteCustomColumn(table, this.config);
}
}
class SQLiteCustomColumn extends SQLiteColumn {
static [entityKind] = "SQLiteCustomColumn";
sqlName;
mapTo;
mapFrom;
constructor(table, config2) {
super(table, config2);
this.sqlName = config2.customTypeParams.dataType(config2.fieldConfig);
this.mapTo = config2.customTypeParams.toDriver;
this.mapFrom = config2.customTypeParams.fromDriver;
}
getSQLType() {
return this.sqlName;
}
mapFromDriverValue(value) {
return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
}
mapToDriverValue(value) {
return typeof this.mapTo === "function" ? this.mapTo(value) : value;
}
}
function customType(customTypeParams) {
return (a, b) => {
const { name, config: config2 } = getColumnNameAndConfig(a, b);
return new SQLiteCustomColumnBuilder(name, config2, customTypeParams);
};
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/columns/integer.js
class SQLiteBaseIntegerBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteBaseIntegerBuilder";
constructor(name, dataType, columnType) {
super(name, dataType, columnType);
this.config.autoIncrement = false;
}
primaryKey(config2) {
if (config2?.autoIncrement) {
this.config.autoIncrement = true;
}
this.config.hasDefault = true;
return super.primaryKey();
}
}
class SQLiteBaseInteger extends SQLiteColumn {
static [entityKind] = "SQLiteBaseInteger";
autoIncrement = this.config.autoIncrement;
getSQLType() {
return "integer";
}
}
class SQLiteIntegerBuilder extends SQLiteBaseIntegerBuilder {
static [entityKind] = "SQLiteIntegerBuilder";
constructor(name) {
super(name, "number", "SQLiteInteger");
}
build(table) {
return new SQLiteInteger(table, this.config);
}
}
class SQLiteInteger extends SQLiteBaseInteger {
static [entityKind] = "SQLiteInteger";
}
class SQLiteTimestampBuilder extends SQLiteBaseIntegerBuilder {
static [entityKind] = "SQLiteTimestampBuilder";
constructor(name, mode) {
super(name, "date", "SQLiteTimestamp");
this.config.mode = mode;
}
defaultNow() {
return this.default(sql`(cast((julianday('now') - 2440587.5)*86400000 as integer))`);
}
build(table) {
return new SQLiteTimestamp(table, this.config);
}
}
class SQLiteTimestamp extends SQLiteBaseInteger {
static [entityKind] = "SQLiteTimestamp";
mode = this.config.mode;
mapFromDriverValue(value) {
if (this.config.mode === "timestamp") {
return new Date(value * 1000);
}
return new Date(value);
}
mapToDriverValue(value) {
const unix = value.getTime();
if (this.config.mode === "timestamp") {
return Math.floor(unix / 1000);
}
return unix;
}
}
class SQLiteBooleanBuilder extends SQLiteBaseIntegerBuilder {
static [entityKind] = "SQLiteBooleanBuilder";
constructor(name, mode) {
super(name, "boolean", "SQLiteBoolean");
this.config.mode = mode;
}
build(table) {
return new SQLiteBoolean(table, this.config);
}
}
class SQLiteBoolean extends SQLiteBaseInteger {
static [entityKind] = "SQLiteBoolean";
mode = this.config.mode;
mapFromDriverValue(value) {
return Number(value) === 1;
}
mapToDriverValue(value) {
return value ? 1 : 0;
}
}
function integer2(a, b) {
const { name, config: config2 } = getColumnNameAndConfig(a, b);
if (config2?.mode === "timestamp" || config2?.mode === "timestamp_ms") {
return new SQLiteTimestampBuilder(name, config2.mode);
}
if (config2?.mode === "boolean") {
return new SQLiteBooleanBuilder(name, config2.mode);
}
return new SQLiteIntegerBuilder(name);
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/columns/numeric.js
class SQLiteNumericBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteNumericBuilder";
constructor(name) {
super(name, "string", "SQLiteNumeric");
}
build(table) {
return new SQLiteNumeric(table, this.config);
}
}
class SQLiteNumeric extends SQLiteColumn {
static [entityKind] = "SQLiteNumeric";
mapFromDriverValue(value) {
if (typeof value === "string")
return value;
return String(value);
}
getSQLType() {
return "numeric";
}
}
class SQLiteNumericNumberBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteNumericNumberBuilder";
constructor(name) {
super(name, "number", "SQLiteNumericNumber");
}
build(table) {
return new SQLiteNumericNumber(table, this.config);
}
}
class SQLiteNumericNumber extends SQLiteColumn {
static [entityKind] = "SQLiteNumericNumber";
mapFromDriverValue(value) {
if (typeof value === "number")
return value;
return Number(value);
}
mapToDriverValue = String;
getSQLType() {
return "numeric";
}
}
class SQLiteNumericBigIntBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteNumericBigIntBuilder";
constructor(name) {
super(name, "bigint", "SQLiteNumericBigInt");
}
build(table) {
return new SQLiteNumericBigInt(table, this.config);
}
}
class SQLiteNumericBigInt extends SQLiteColumn {
static [entityKind] = "SQLiteNumericBigInt";
mapFromDriverValue = BigInt;
mapToDriverValue = String;
getSQLType() {
return "numeric";
}
}
function numeric(a, b) {
const { name, config: config2 } = getColumnNameAndConfig(a, b);
const mode = config2?.mode;
return mode === "number" ? new SQLiteNumericNumberBuilder(name) : mode === "bigint" ? new SQLiteNumericBigIntBuilder(name) : new SQLiteNumericBuilder(name);
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/columns/real.js
class SQLiteRealBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteRealBuilder";
constructor(name) {
super(name, "number", "SQLiteReal");
}
build(table) {
return new SQLiteReal(table, this.config);
}
}
class SQLiteReal extends SQLiteColumn {
static [entityKind] = "SQLiteReal";
getSQLType() {
return "real";
}
}
function real(name) {
return new SQLiteRealBuilder(name ?? "");
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/columns/text.js
class SQLiteTextBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteTextBuilder";
constructor(name, config2) {
super(name, "string", "SQLiteText");
this.config.enumValues = config2.enum;
this.config.length = config2.length;
}
build(table) {
return new SQLiteText(table, this.config);
}
}
class SQLiteText extends SQLiteColumn {
static [entityKind] = "SQLiteText";
enumValues = this.config.enumValues;
length = this.config.length;
constructor(table, config2) {
super(table, config2);
}
getSQLType() {
return `text${this.config.length ? `(${this.config.length})` : ""}`;
}
}
class SQLiteTextJsonBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteTextJsonBuilder";
constructor(name) {
super(name, "json", "SQLiteTextJson");
}
build(table) {
return new SQLiteTextJson(table, this.config);
}
}
class SQLiteTextJson extends SQLiteColumn {
static [entityKind] = "SQLiteTextJson";
getSQLType() {
return "text";
}
mapFromDriverValue(value) {
return JSON.parse(value);
}
mapToDriverValue(value) {
return JSON.stringify(value);
}
}
function text(a, b = {}) {
const { name, config: config2 } = getColumnNameAndConfig(a, b);
if (config2.mode === "json") {
return new SQLiteTextJsonBuilder(name);
}
return new SQLiteTextBuilder(name, config2);
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/selection-proxy.js
class SelectionProxyHandler {
static [entityKind] = "SelectionProxyHandler";
config;
constructor(config2) {
this.config = { ...config2 };
}
get(subquery, prop) {
if (prop === "_") {
return {
...subquery["_"],
selectedFields: new Proxy(subquery._.selectedFields, this)
};
}
if (prop === ViewBaseConfig) {
return {
...subquery[ViewBaseConfig],
selectedFields: new Proxy(subquery[ViewBaseConfig].selectedFields, this)
};
}
if (typeof prop === "symbol") {
return subquery[prop];
}
const columns = is(subquery, Subquery) ? subquery._.selectedFields : is(subquery, View) ? subquery[ViewBaseConfig].selectedFields : subquery;
const value = columns[prop];
if (is(value, SQL.Aliased)) {
if (this.config.sqlAliasedBehavior === "sql" && !value.isSelectionField) {
return value.sql;
}
const newValue = value.clone();
newValue.isSelectionField = true;
return newValue;
}
if (is(value, SQL)) {
if (this.config.sqlBehavior === "sql") {
return value;
}
throw new Error(`You tried to reference "${prop}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`);
}
if (is(value, Column)) {
if (this.config.alias) {
return new Proxy(value, new ColumnAliasProxyHandler(new Proxy(value.table, new TableAliasProxyHandler(this.config.alias, this.config.replaceOriginalName ?? false))));
}
return value;
}
if (typeof value !== "object" || value === null) {
return value;
}
return new Proxy(value, new SelectionProxyHandler(this.config));
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/columns/all.js
function getSQLiteColumnBuilders() {
return {
blob,
customType,
integer: integer2,
numeric,
real,
text
};
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/table.js
var InlineForeignKeys2 = Symbol.for("drizzle:SQLiteInlineForeignKeys");
class SQLiteTable extends Table {
static [entityKind] = "SQLiteTable";
static Symbol = Object.assign({}, Table.Symbol, {
InlineForeignKeys: InlineForeignKeys2
});
[Table.Symbol.Columns];
[InlineForeignKeys2] = [];
[Table.Symbol.ExtraConfigBuilder] = undefined;
}
function sqliteTableBase(name, columns, extraConfig, schema, baseName = name) {
const rawTable = new SQLiteTable(name, schema, baseName);
const parsedColumns = typeof columns === "function" ? columns(getSQLiteColumnBuilders()) : columns;
const builtColumns = Object.fromEntries(Object.entries(parsedColumns).map(([name2, colBuilderBase]) => {
const colBuilder = colBuilderBase;
colBuilder.setName(name2);
const column = colBuilder.build(rawTable);
rawTable[InlineForeignKeys2].push(...colBuilder.buildForeignKeys(column, rawTable));
return [name2, column];
}));
const table = Object.assign(rawTable, builtColumns);
table[Table.Symbol.Columns] = builtColumns;
table[Table.Symbol.ExtraConfigColumns] = builtColumns;
if (extraConfig) {
table[SQLiteTable.Symbol.ExtraConfigBuilder] = extraConfig;
}
return table;
}
var sqliteTable = (name, columns, extraConfig) => {
return sqliteTableBase(name, columns, extraConfig);
};
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/indexes.js
class IndexBuilderOn {
constructor(name, unique) {
this.name = name;
this.unique = unique;
}
static [entityKind] = "SQLiteIndexBuilderOn";
on(...columns) {
return new IndexBuilder(this.name, columns, this.unique);
}
}
class IndexBuilder {
static [entityKind] = "SQLiteIndexBuilder";
config;
constructor(name, columns, unique) {
this.config = {
name,
columns,
unique,
where: undefined
};
}
where(condition) {
this.config.where = condition;
return this;
}
build(table) {
return new Index(this.config, table);
}
}
class Index {
static [entityKind] = "SQLiteIndex";
config;
constructor(config2, table) {
this.config = { ...config2, table };
}
}
function index(name) {
return new IndexBuilderOn(name, false);
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/primary-keys.js
function primaryKey(...config2) {
if (config2[0].columns) {
return new PrimaryKeyBuilder2(config2[0].columns, config2[0].name);
}
return new PrimaryKeyBuilder2(config2);
}
class PrimaryKeyBuilder2 {
static [entityKind] = "SQLitePrimaryKeyBuilder";
columns;
name;
constructor(columns, name) {
this.columns = columns;
this.name = name;
}
build(table) {
return new PrimaryKey2(table, this.columns, this.name);
}
}
class PrimaryKey2 {
constructor(table, columns, name) {
this.table = table;
this.columns = columns;
this.name = name;
}
static [entityKind] = "SQLitePrimaryKey";
columns;
name;
getName() {
return this.name ?? `${this.table[SQLiteTable.Symbol.Name]}_${this.columns.map((column) => column.name).join("_")}_pk`;
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/utils.js
function extractUsedTable(table) {
if (is(table, SQLiteTable)) {
return [`${table[Table.Symbol.BaseName]}`];
}
if (is(table, Subquery)) {
return table._.usedTables ?? [];
}
if (is(table, SQL)) {
return table.usedTables ?? [];
}
return [];
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/query-builders/delete.js
class SQLiteDeleteBase extends QueryPromise {
constructor(table, session, dialect, withList) {
super();
this.table = table;
this.session = session;
this.dialect = dialect;
this.config = { table, withList };
}
static [entityKind] = "SQLiteDelete";
config;
where(where) {
this.config.where = where;
return this;
}
orderBy(...columns) {
if (typeof columns[0] === "function") {
const orderBy = columns[0](new Proxy(this.config.table[Table.Symbol.Columns], new SelectionProxyHandler({ sqlAliasedBehavior: "alias", sqlBehavior: "sql" })));
const orderByArray = Array.isArray(orderBy) ? orderBy : [orderBy];
this.config.orderBy = orderByArray;
} else {
const orderByArray = columns;
this.config.orderBy = orderByArray;
}
return this;
}
limit(limit) {
this.config.limit = limit;
return this;
}
returning(fields = this.table[SQLiteTable.Symbol.Columns]) {
this.config.returning = orderSelectedFields(fields);
return this;
}
getSQL() {
return this.dialect.buildDeleteQuery(this.config);
}
toSQL() {
const { typings: _typings, ...rest } = this.dialect.sqlToQuery(this.getSQL());
return rest;
}
_prepare(isOneTimeQuery = true) {
return this.session[isOneTimeQuery ? "prepareOneTimeQuery" : "prepareQuery"](this.dialect.sqlToQuery(this.getSQL()), this.config.returning, this.config.returning ? "all" : "run", true, undefined, {
type: "delete",
tables: extractUsedTable(this.config.table)
});
}
prepare() {
return this._prepare(false);
}
run = (placeholderValues) => {
return this._prepare().run(placeholderValues);
};
all = (placeholderValues) => {
return this._prepare().all(placeholderValues);
};
get = (placeholderValues) => {
return this._prepare().get(placeholderValues);
};
values = (placeholderValues) => {
return this._prepare().values(placeholderValues);
};
async execute(placeholderValues) {
return this._prepare().execute(placeholderValues);
}
$dynamic() {
return this;
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/casing.js
function toSnakeCase(input) {
const words = input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? [];
return words.map((word) => word.toLowerCase()).join("_");
}
function toCamelCase(input) {
const words = input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? [];
return words.reduce((acc, word, i) => {
const formattedWord = i === 0 ? word.toLowerCase() : `${word[0].toUpperCase()}${word.slice(1)}`;
return acc + formattedWord;
}, "");
}
function noopCase(input) {
return input;
}
class CasingCache {
static [entityKind] = "CasingCache";
cache = {};
cachedTables = {};
convert;
constructor(casing) {
this.convert = casing === "snake_case" ? toSnakeCase : casing === "camelCase" ? toCamelCase : noopCase;
}
getColumnCasing(column) {
if (!column.keyAsName)
return column.name;
const schema = column.table[Table.Symbol.Schema] ?? "public";
const tableName = column.table[Table.Symbol.OriginalName];
const key = `${schema}.${tableName}.${column.name}`;
if (!this.cache[key]) {
this.cacheTable(column.table);
}
return this.cache[key];
}
cacheTable(table) {
const schema = table[Table.Symbol.Schema] ?? "public";
const tableName = table[Table.Symbol.OriginalName];
const tableKey = `${schema}.${tableName}`;
if (!this.cachedTables[tableKey]) {
for (const column of Object.values(table[Table.Symbol.Columns])) {
const columnKey = `${tableKey}.${column.name}`;
this.cache[columnKey] = this.convert(column.name);
}
this.cachedTables[tableKey] = true;
}
}
clearCache() {
this.cache = {};
this.cachedTables = {};
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/view-base.js
class SQLiteViewBase extends View {
static [entityKind] = "SQLiteViewBase";
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/dialect.js
class SQLiteDialect {
static [entityKind] = "SQLiteDialect";
casing;
constructor(config2) {
this.casing = new CasingCache(config2?.casing);
}
escapeName(name) {
return `"${name.replace(/"/g, '""')}"`;
}
escapeParam(_num) {
return "?";
}
escapeString(str) {
return `'${str.replace(/'/g, "''")}'`;
}
buildWithCTE(queries) {
if (!queries?.length)
return;
const withSqlChunks = [sql`with `];
for (const [i, w] of queries.entries()) {
withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
if (i < queries.length - 1) {
withSqlChunks.push(sql`, `);
}
}
withSqlChunks.push(sql` `);
return sql.join(withSqlChunks);
}
buildDeleteQuery({
table,
where,
returning,
withList,
limit,
orderBy
}) {
const withSql = this.buildWithCTE(withList);
const returningSql = returning ? sql` returning ${this.buildSelection(returning, { isSingleTable: true })}` : undefined;
const whereSql = where ? sql` where ${where}` : undefined;
const orderBySql = this.buildOrderBy(orderBy);
const limitSql = this.buildLimit(limit);
return sql`${withSql}delete from ${table}${whereSql}${returningSql}${orderBySql}${limitSql}`;
}
buildUpdateSet(table, set2) {
const tableColumns = table[Table.Symbol.Columns];
const columnNames = Object.keys(tableColumns).filter((colName) => set2[colName] !== undefined || tableColumns[colName]?.onUpdateFn !== undefined);
const setSize = columnNames.length;
return sql.join(columnNames.flatMap((colName, i) => {
const col = tableColumns[colName];
const onUpdateFnResult = col.onUpdateFn?.();
const value = set2[colName] ?? (is(onUpdateFnResult, SQL) ? onUpdateFnResult : sql.param(onUpdateFnResult, col));
const res = sql`${sql.identifier(this.casing.getColumnCasing(col))} = ${value}`;
if (i < setSize - 1) {
return [res, sql.raw(", ")];
}
return [res];
}));
}
buildUpdateQuery({
table,
set: set2,
where,
returning,
withList,
joins,
from,
limit,
orderBy
}) {
const withSql = this.buildWithCTE(withList);
const setSql = this.buildUpdateSet(table, set2);
const fromSql = from && sql.join([sql.raw(" from "), this.buildFromTable(from)]);
const joinsSql = this.buildJoins(joins);
const returningSql = returning ? sql` returning ${this.buildSelection(returning, { isSingleTable: true })}` : undefined;
const whereSql = where ? sql` where ${where}` : undefined;
const orderBySql = this.buildOrderBy(orderBy);
const limitSql = this.buildLimit(limit);
return sql`${withSql}update ${table} set ${setSql}${fromSql}${joinsSql}${whereSql}${returningSql}${orderBySql}${limitSql}`;
}
buildSelection(fields, { isSingleTable = false } = {}) {
const columnsLen = fields.length;
const chunks = fields.flatMap(({ field }, i) => {
const chunk = [];
if (is(field, SQL.Aliased) && field.isSelectionField) {
chunk.push(sql.identifier(field.fieldAlias));
} else if (is(field, SQL.Aliased) || is(field, SQL)) {
const query = is(field, SQL.Aliased) ? field.sql : field;
if (isSingleTable) {
chunk.push(new SQL(query.queryChunks.map((c) => {
if (is(c, Column)) {
return sql.identifier(this.casing.getColumnCasing(c));
}
return c;
})));
} else {
chunk.push(query);
}
if (is(field, SQL.Aliased)) {
chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
}
} else if (is(field, Column)) {
const tableName = field.table[Table.Symbol.Name];
if (field.columnType === "SQLiteNumericBigInt") {
if (isSingleTable) {
chunk.push(sql`cast(${sql.identifier(this.casing.getColumnCasing(field))} as text)`);
} else {
chunk.push(sql`cast(${sql.identifier(tableName)}.${sql.identifier(this.casing.getColumnCasing(field))} as text)`);
}
} else {
if (isSingleTable) {
chunk.push(sql.identifier(this.casing.getColumnCasing(field)));
} else {
chunk.push(sql`${sql.identifier(tableName)}.${sql.identifier(this.casing.getColumnCasing(field))}`);
}
}
} else if (is(field, Subquery)) {
const entries = Object.entries(field._.selectedFields);
if (entries.length === 1) {
const entry = entries[0][1];
const fieldDecoder = is(entry, SQL) ? entry.decoder : is(entry, Column) ? { mapFromDriverValue: (v) => entry.mapFromDriverValue(v) } : entry.sql.decoder;
if (fieldDecoder)
field._.sql.decoder = fieldDecoder;
}
chunk.push(field);
}
if (i < columnsLen - 1) {
chunk.push(sql`, `);
}
return chunk;
});
return sql.join(chunks);
}
buildJoins(joins) {
if (!joins || joins.length === 0) {
return;
}
const joinsArray = [];
if (joins) {
for (const [index2, joinMeta] of joins.entries()) {
if (index2 === 0) {
joinsArray.push(sql` `);
}
const table = joinMeta.table;
const onSql = joinMeta.on ? sql` on ${joinMeta.on}` : undefined;
if (is(table, SQLiteTable)) {
const tableName = table[SQLiteTable.Symbol.Name];
const tableSchema = table[SQLiteTable.Symbol.Schema];
const origTableName = table[SQLiteTable.Symbol.OriginalName];
const alias = tableName === origTableName ? undefined : joinMeta.alias;
joinsArray.push(sql`${sql.raw(joinMeta.joinType)} join ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : undefined}${sql.identifier(origTableName)}${alias && sql` ${sql.identifier(alias)}`}${onSql}`);
} else {
joinsArray.push(sql`${sql.raw(joinMeta.joinType)} join ${table}${onSql}`);
}
if (index2 < joins.length - 1) {
joinsArray.push(sql` `);
}
}
}
return sql.join(joinsArray);
}
buildLimit(limit) {
return typeof limit === "object" || typeof limit === "number" && limit >= 0 ? sql` limit ${limit}` : undefined;
}
buildOrderBy(orderBy) {
const orderByList = [];
if (orderBy) {
for (const [index2, orderByValue] of orderBy.entries()) {
orderByList.push(orderByValue);
if (index2 < orderBy.length - 1) {
orderByList.push(sql`, `);
}
}
}
return orderByList.length > 0 ? sql` order by ${sql.join(orderByList)}` : undefined;
}
buildFromTable(table) {
if (is(table, Table) && table[Table.Symbol.IsAlias]) {
return sql`${sql`${sql.identifier(table[Table.Symbol.Schema] ?? "")}.`.if(table[Table.Symbol.Schema])}${sql.identifier(table[Table.Symbol.OriginalName])} ${sql.identifier(table[Table.Symbol.Name])}`;
}
return table;
}
buildSelectQuery({
withList,
fields,
fieldsFlat,
where,
having,
table,
joins,
orderBy,
groupBy,
limit,
offset,
distinct,
setOperators
}) {
const fieldsList = fieldsFlat ?? orderSelectedFields(fields);
for (const f of fieldsList) {
if (is(f.field, Column) && getTableName(f.field.table) !== (is(table, Subquery) ? table._.alias : is(table, SQLiteViewBase) ? table[ViewBaseConfig].name : is(table, SQL) ? undefined : getTableName(table)) && !((table2) => joins?.some(({ alias }) => alias === (table2[Table.Symbol.IsAlias] ? getTableName(table2) : table2[Table.Symbol.BaseName])))(f.field.table)) {
const tableName = getTableName(f.field.table);
throw new Error(`Your "${f.path.join("->")}" field references a column "${tableName}"."${f.field.name}", but the table "${tableName}" is not part of the query! Did you forget to join it?`);
}
}
const isSingleTable = !joins || joins.length === 0;
const withSql = this.buildWithCTE(withList);
const distinctSql = distinct ? sql` distinct` : undefined;
const selection = this.buildSelection(fieldsList, { isSingleTable });
const tableSql = this.buildFromTable(table);
const joinsSql = this.buildJoins(joins);
const whereSql = where ? sql` where ${where}` : undefined;
const havingSql = having ? sql` having ${having}` : undefined;
const groupByList = [];
if (groupBy) {
for (const [index2, groupByValue] of groupBy.entries()) {
groupByList.push(groupByValue);
if (index2 < groupBy.length - 1) {
groupByList.push(sql`, `);
}
}
}
const groupBySql = groupByList.length > 0 ? sql` group by ${sql.join(groupByList)}` : undefined;
const orderBySql = this.buildOrderBy(orderBy);
const limitSql = this.buildLimit(limit);
const offsetSql = offset ? sql` offset ${offset}` : undefined;
const finalQuery = sql`${withSql}select${distinctSql} ${selection} from ${tableSql}${joinsSql}${whereSql}${groupBySql}${havingSql}${orderBySql}${limitSql}${offsetSql}`;
if (setOperators.length > 0) {
return this.buildSetOperations(finalQuery, setOperators);
}
return finalQuery;
}
buildSetOperations(leftSelect, setOperators) {
const [setOperator, ...rest] = setOperators;
if (!setOperator) {
throw new Error("Cannot pass undefined values to any set operator");
}
if (rest.length === 0) {
return this.buildSetOperationQuery({ leftSelect, setOperator });
}
return this.buildSetOperations(this.buildSetOperationQuery({ leftSelect, setOperator }), rest);
}
buildSetOperationQuery({
leftSelect,
setOperator: { type, isAll, rightSelect, limit, orderBy, offset }
}) {
const leftChunk = sql`${leftSelect.getSQL()} `;
const rightChunk = sql`${rightSelect.getSQL()}`;
let orderBySql;
if (orderBy && orderBy.length > 0) {
const orderByValues = [];
for (const singleOrderBy of orderBy) {
if (is(singleOrderBy, SQLiteColumn)) {
orderByValues.push(sql.identifier(singleOrderBy.name));
} else if (is(singleOrderBy, SQL)) {
for (let i = 0;i < singleOrderBy.queryChunks.length; i++) {
const chunk = singleOrderBy.queryChunks[i];
if (is(chunk, SQLiteColumn)) {
singleOrderBy.queryChunks[i] = sql.identifier(this.casing.getColumnCasing(chunk));
}
}
orderByValues.push(sql`${singleOrderBy}`);
} else {
orderByValues.push(sql`${singleOrderBy}`);
}
}
orderBySql = sql` order by ${sql.join(orderByValues, sql`, `)}`;
}
const limitSql = typeof limit === "object" || typeof limit === "number" && limit >= 0 ? sql` limit ${limit}` : undefined;
const operatorChunk = sql.raw(`${type} ${isAll ? "all " : ""}`);
const offsetSql = offset ? sql` offset ${offset}` : undefined;
return sql`${leftChunk}${operatorChunk}${rightChunk}${orderBySql}${limitSql}${offsetSql}`;
}
buildInsertQuery({
table,
values: valuesOrSelect,
onConflict,
returning,
withList,
select
}) {
const valuesSqlList = [];
const columns = table[Table.Symbol.Columns];
const colEntries = Object.entries(columns).filter(([_, col]) => !col.shouldDisableInsert());
const insertOrder = colEntries.map(([, column]) => sql.identifier(this.casing.getColumnCasing(column)));
if (select) {
const select2 = valuesOrSelect;
if (is(select2, SQL)) {
valuesSqlList.push(select2);
} else {
valuesSqlList.push(select2.getSQL());
}
} else {
const values = valuesOrSelect;
valuesSqlList.push(sql.raw("values "));
for (const [valueIndex, value] of values.entries()) {
const valueList = [];
for (const [fieldName, col] of colEntries) {
const colValue = value[fieldName];
if (colValue === undefined || is(colValue, Param) && colValue.value === undefined) {
let defaultValue;
if (col.default !== null && col.default !== undefined) {
defaultValue = is(col.default, SQL) ? col.default : sql.param(col.default, col);
} else if (col.defaultFn !== undefined) {
const defaultFnResult = col.defaultFn();
defaultValue = is(defaultFnResult, SQL) ? defaultFnResult : sql.param(defaultFnResult, col);
} else if (!col.default && col.onUpdateFn !== undefined) {
const onUpdateFnResult = col.onUpdateFn();
defaultValue = is(onUpdateFnResult, SQL) ? onUpdateFnResult : sql.param(onUpdateFnResult, col);
} else {
defaultValue = sql`null`;
}
valueList.push(defaultValue);
} else {
valueList.push(colValue);
}
}
valuesSqlList.push(valueList);
if (valueIndex < values.length - 1) {
valuesSqlList.push(sql`, `);
}
}
}
const withSql = this.buildWithCTE(withList);
const valuesSql = sql.join(valuesSqlList);
const returningSql = returning ? sql` returning ${this.buildSelection(returning, { isSingleTable: true })}` : undefined;
const onConflictSql = onConflict?.length ? sql.join(onConflict) : undefined;
return sql`${withSql}insert into ${table} ${insertOrder} ${valuesSql}${onConflictSql}${returningSql}`;
}
sqlToQuery(sql2, invokeSource) {
return sql2.toQuery({
casing: this.casing,
escapeName: this.escapeName,
escapeParam: this.escapeParam,
escapeString: this.escapeString,
invokeSource
});
}
buildRelationalQuery({
fullSchema,
schema,
tableNamesMap,
table,
tableConfig,
queryConfig: config2,
tableAlias,
nestedQueryRelation,
joinOn
}) {
let selection = [];
let limit, offset, orderBy = [], where;
const joins = [];
if (config2 === true) {
const selectionEntries = Object.entries(tableConfig.columns);
selection = selectionEntries.map(([key, value]) => ({
dbKey: value.name,
tsKey: key,
field: aliasedTableColumn(value, tableAlias),
relationTableTsKey: undefined,
isJson: false,
selection: []
}));
} else {
const aliasedColumns = Object.fromEntries(Object.entries(tableConfig.columns).map(([key, value]) => [
key,
aliasedTableColumn(value, tableAlias)
]));
if (config2.where) {
const whereSql = typeof config2.where === "function" ? config2.where(aliasedColumns, getOperators()) : config2.where;
where = whereSql && mapColumnsInSQLToAlias(whereSql, tableAlias);
}
const fieldsSelection = [];
let selectedColumns = [];
if (config2.columns) {
let isIncludeMode = false;
for (const [field, value] of Object.entries(config2.columns)) {
if (value === undefined) {
continue;
}
if (field in tableConfig.columns) {
if (!isIncludeMode && value === true) {
isIncludeMode = true;
}
selectedColumns.push(field);
}
}
if (selectedColumns.length > 0) {
selectedColumns = isIncludeMode ? selectedColumns.filter((c) => config2.columns?.[c] === true) : Object.keys(tableConfig.columns).filter((key) => !selectedColumns.includes(key));
}
} else {
selectedColumns = Object.keys(tableConfig.columns);
}
for (const field of selectedColumns) {
const column = tableConfig.columns[field];
fieldsSelection.push({ tsKey: field, value: column });
}
let selectedRelations = [];
if (config2.with) {
selectedRelations = Object.entries(config2.with).filter((entry) => !!entry[1]).map(([tsKey, queryConfig]) => ({
tsKey,
queryConfig,
relation: tableConfig.relations[tsKey]
}));
}
let extras;
if (config2.extras) {
extras = typeof config2.extras === "function" ? config2.extras(aliasedColumns, { sql }) : config2.extras;
for (const [tsKey, value] of Object.entries(extras)) {
fieldsSelection.push({
tsKey,
value: mapColumnsInAliasedSQLToAlias(value, tableAlias)
});
}
}
for (const { tsKey, value } of fieldsSelection) {
selection.push({
dbKey: is(value, SQL.Aliased) ? value.fieldAlias : tableConfig.columns[tsKey].name,
tsKey,
field: is(value, Column) ? aliasedTableColumn(value, tableAlias) : value,
relationTableTsKey: undefined,
isJson: false,
selection: []
});
}
let orderByOrig = typeof config2.orderBy === "function" ? config2.orderBy(aliasedColumns, getOrderByOperators()) : config2.orderBy ?? [];
if (!Array.isArray(orderByOrig)) {
orderByOrig = [orderByOrig];
}
orderBy = orderByOrig.map((orderByValue) => {
if (is(orderByValue, Column)) {
return aliasedTableColumn(orderByValue, tableAlias);
}
return mapColumnsInSQLToAlias(orderByValue, tableAlias);
});
limit = config2.limit;
offset = config2.offset;
for (const {
tsKey: selectedRelationTsKey,
queryConfig: selectedRelationConfigValue,
relation
} of selectedRelations) {
const normalizedRelation = normalizeRelation(schema, tableNamesMap, relation);
const relationTableName = getTableUniqueName(relation.referencedTable);
const relationTableTsName = tableNamesMap[relationTableName];
const relationTableAlias = `${tableAlias}_${selectedRelationTsKey}`;
const joinOn2 = and(...normalizedRelation.fields.map((field2, i) => eq(aliasedTableColumn(normalizedRelation.references[i], relationTableAlias), aliasedTableColumn(field2, tableAlias))));
const builtRelation = this.buildRelationalQuery({
fullSchema,
schema,
tableNamesMap,
table: fullSchema[relationTableTsName],
tableConfig: schema[relationTableTsName],
queryConfig: is(relation, One) ? selectedRelationConfigValue === true ? { limit: 1 } : { ...selectedRelationConfigValue, limit: 1 } : selectedRelationConfigValue,
tableAlias: relationTableAlias,
joinOn: joinOn2,
nestedQueryRelation: relation
});
const field = sql`(${builtRelation.sql})`.as(selectedRelationTsKey);
selection.push({
dbKey: selectedRelationTsKey,
tsKey: selectedRelationTsKey,
field,
relationTableTsKey: relationTableTsName,
isJson: true,
selection: builtRelation.selection
});
}
}
if (selection.length === 0) {
throw new DrizzleError({
message: `No fields selected for table "${tableConfig.tsName}" ("${tableAlias}"). You need to have at least one item in "columns", "with" or "extras". If you need to select all columns, omit the "columns" key or set it to undefined.`
});
}
let result;
where = and(joinOn, where);
if (nestedQueryRelation) {
let field = sql`json_array(${sql.join(selection.map(({ field: field2 }) => is(field2, SQLiteColumn) ? sql.identifier(this.casing.getColumnCasing(field2)) : is(field2, SQL.Aliased) ? field2.sql : field2), sql`, `)})`;
if (is(nestedQueryRelation, Many)) {
field = sql`coalesce(json_group_array(${field}), json_array())`;
}
const nestedSelection = [
{
dbKey: "data",
tsKey: "data",
field: field.as("data"),
isJson: true,
relationTableTsKey: tableConfig.tsName,
selection
}
];
const needsSubquery = limit !== undefined || offset !== undefined || orderBy.length > 0;
if (needsSubquery) {
result = this.buildSelectQuery({
table: aliasedTable(table, tableAlias),
fields: {},
fieldsFlat: [
{
path: [],
field: sql.raw("*")
}
],
where,
limit,
offset,
orderBy,
setOperators: []
});
where = undefined;
limit = undefined;
offset = undefined;
orderBy = undefined;
} else {
result = aliasedTable(table, tableAlias);
}
result = this.buildSelectQuery({
table: is(result, SQLiteTable) ? result : new Subquery(result, {}, tableAlias),
fields: {},
fieldsFlat: nestedSelection.map(({ field: field2 }) => ({
path: [],
field: is(field2, Column) ? aliasedTableColumn(field2, tableAlias) : field2
})),
joins,
where,
limit,
offset,
orderBy,
setOperators: []
});
} else {
result = this.buildSelectQuery({
table: aliasedTable(table, tableAlias),
fields: {},
fieldsFlat: selection.map(({ field }) => ({
path: [],
field: is(field, Column) ? aliasedTableColumn(field, tableAlias) : field
})),
joins,
where,
limit,
offset,
orderBy,
setOperators: []
});
}
return {
tableTsKey: tableConfig.tsName,
sql: result,
selection
};
}
}
class SQLiteSyncDialect extends SQLiteDialect {
static [entityKind] = "SQLiteSyncDialect";
migrate(migrations, session, config2) {
const migrationsTable = config2 === undefined ? "__drizzle_migrations" : typeof config2 === "string" ? "__drizzle_migrations" : config2.migrationsTable ?? "__drizzle_migrations";
const migrationTableCreate = sql`
CREATE TABLE IF NOT EXISTS ${sql.identifier(migrationsTable)} (
id SERIAL PRIMARY KEY,
hash text NOT NULL,
created_at numeric
)
`;
session.run(migrationTableCreate);
const dbMigrations = session.values(sql`SELECT id, hash, created_at FROM ${sql.identifier(migrationsTable)} ORDER BY created_at DESC LIMIT 1`);
const lastDbMigration = dbMigrations[0] ?? undefined;
session.run(sql`BEGIN`);
try {
for (const migration of migrations) {
if (!lastDbMigration || Number(lastDbMigration[2]) < migration.folderMillis) {
for (const stmt of migration.sql) {
session.run(sql.raw(stmt));
}
session.run(sql`INSERT INTO ${sql.identifier(migrationsTable)} ("hash", "created_at") VALUES(${migration.hash}, ${migration.folderMillis})`);
}
}
session.run(sql`COMMIT`);
} catch (e) {
session.run(sql`ROLLBACK`);
throw e;
}
}
}
class SQLiteAsyncDialect extends SQLiteDialect {
static [entityKind] = "SQLiteAsyncDialect";
async migrate(migrations, session, config2) {
const migrationsTable = config2 === undefined ? "__drizzle_migrations" : typeof config2 === "string" ? "__drizzle_migrations" : config2.migrationsTable ?? "__drizzle_migrations";
const migrationTableCreate = sql`
CREATE TABLE IF NOT EXISTS ${sql.identifier(migrationsTable)} (
id SERIAL PRIMARY KEY,
hash text NOT NULL,
created_at numeric
)
`;
await session.run(migrationTableCreate);
const dbMigrations = await session.values(sql`SELECT id, hash, created_at FROM ${sql.identifier(migrationsTable)} ORDER BY created_at DESC LIMIT 1`);
const lastDbMigration = dbMigrations[0] ?? undefined;
await session.transaction(async (tx) => {
for (const migration of migrations) {
if (!lastDbMigration || Number(lastDbMigration[2]) < migration.folderMillis) {
for (const stmt of migration.sql) {
await tx.run(sql.raw(stmt));
}
await tx.run(sql`INSERT INTO ${sql.identifier(migrationsTable)} ("hash", "created_at") VALUES(${migration.hash}, ${migration.folderMillis})`);
}
}
});
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/query-builders/query-builder.js
class TypedQueryBuilder {
static [entityKind] = "TypedQueryBuilder";
getSelectedFields() {
return this._.selectedFields;
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/query-builders/select.js
class SQLiteSelectBuilder {
static [entityKind] = "SQLiteSelectBuilder";
fields;
session;
dialect;
withList;
distinct;
constructor(config2) {
this.fields = config2.fields;
this.session = config2.session;
this.dialect = config2.dialect;
this.withList = config2.withList;
this.distinct = config2.distinct;
}
from(source) {
const isPartialSelect = !!this.fields;
let fields;
if (this.fields) {
fields = this.fields;
} else if (is(source, Subquery)) {
fields = Object.fromEntries(Object.keys(source._.selectedFields).map((key) => [key, source[key]]));
} else if (is(source, SQLiteViewBase)) {
fields = source[ViewBaseConfig].selectedFields;
} else if (is(source, SQL)) {
fields = {};
} else {
fields = getTableColumns(source);
}
return new SQLiteSelectBase({
table: source,
fields,
isPartialSelect,
session: this.session,
dialect: this.dialect,
withList: this.withList,
distinct: this.distinct
});
}
}
class SQLiteSelectQueryBuilderBase extends TypedQueryBuilder {
static [entityKind] = "SQLiteSelectQueryBuilder";
_;
config;
joinsNotNullableMap;
tableName;
isPartialSelect;
session;
dialect;
cacheConfig = undefined;
usedTables = /* @__PURE__ */ new Set;
constructor({ table, fields, isPartialSelect, session, dialect, withList, distinct }) {
super();
this.config = {
withList,
table,
fields: { ...fields },
distinct,
setOperators: []
};
this.isPartialSelect = isPartialSelect;
this.session = session;
this.dialect = dialect;
this._ = {
selectedFields: fields,
config: this.config
};
this.tableName = getTableLikeName(table);
this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
for (const item of extractUsedTable(table))
this.usedTables.add(item);
}
getUsedTables() {
return [...this.usedTables];
}
createJoin(joinType) {
return (table, on) => {
const baseTableName = this.tableName;
const tableName = getTableLikeName(table);
for (const item of extractUsedTable(table))
this.usedTables.add(item);
if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
throw new Error(`Alias "${tableName}" is already used in this query`);
}
if (!this.isPartialSelect) {
if (Object.keys(this.joinsNotNullableMap).length === 1 && typeof baseTableName === "string") {
this.config.fields = {
[baseTableName]: this.config.fields
};
}
if (typeof tableName === "string" && !is(table, SQL)) {
const selection = is(table, Subquery) ? table._.selectedFields : is(table, View) ? table[ViewBaseConfig].selectedFields : table[Table.Symbol.Columns];
this.config.fields[tableName] = selection;
}
}
if (typeof on === "function") {
on = on(new Proxy(this.config.fields, new SelectionProxyHandler({ sqlAliasedBehavior: "sql", sqlBehavior: "sql" })));
}
if (!this.config.joins) {
this.config.joins = [];
}
this.config.joins.push({ on, table, joinType, alias: tableName });
if (typeof tableName === "string") {
switch (joinType) {
case "left": {
this.joinsNotNullableMap[tableName] = false;
break;
}
case "right": {
this.joinsNotNullableMap = Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([key]) => [key, false]));
this.joinsNotNullableMap[tableName] = true;
break;
}
case "cross":
case "inner": {
this.joinsNotNullableMap[tableName] = true;
break;
}
case "full": {
this.joinsNotNullableMap = Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([key]) => [key, false]));
this.joinsNotNullableMap[tableName] = false;
break;
}
}
}
return this;
};
}
leftJoin = this.createJoin("left");
rightJoin = this.createJoin("right");
innerJoin = this.createJoin("inner");
fullJoin = this.createJoin("full");
crossJoin = this.createJoin("cross");
createSetOperator(type, isAll) {
return (rightSelection) => {
const rightSelect = typeof rightSelection === "function" ? rightSelection(getSQLiteSetOperators()) : rightSelection;
if (!haveSameKeys(this.getSelectedFields(), rightSelect.getSelectedFields())) {
throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");
}
this.config.setOperators.push({ type, isAll, rightSelect });
return this;
};
}
union = this.createSetOperator("union", false);
unionAll = this.createSetOperator("union", true);
intersect = this.createSetOperator("intersect", false);
except = this.createSetOperator("except", false);
addSetOperators(setOperators) {
this.config.setOperators.push(...setOperators);
return this;
}
where(where) {
if (typeof where === "function") {
where = where(new Proxy(this.config.fields, new SelectionProxyHandler({ sqlAliasedBehavior: "sql", sqlBehavior: "sql" })));
}
this.config.where = where;
return this;
}
having(having) {
if (typeof having === "function") {
having = having(new Proxy(this.config.fields, new SelectionProxyHandler({ sqlAliasedBehavior: "sql", sqlBehavior: "sql" })));
}
this.config.having = having;
return this;
}
groupBy(...columns) {
if (typeof columns[0] === "function") {
const groupBy = columns[0](new Proxy(this.config.fields, new SelectionProxyHandler({ sqlAliasedBehavior: "alias", sqlBehavior: "sql" })));
this.config.groupBy = Array.isArray(groupBy) ? groupBy : [groupBy];
} else {
this.config.groupBy = columns;
}
return this;
}
orderBy(...columns) {
if (typeof columns[0] === "function") {
const orderBy = columns[0](new Proxy(this.config.fields, new SelectionProxyHandler({ sqlAliasedBehavior: "alias", sqlBehavior: "sql" })));
const orderByArray = Array.isArray(orderBy) ? orderBy : [orderBy];
if (this.config.setOperators.length > 0) {
this.config.setOperators.at(-1).orderBy = orderByArray;
} else {
this.config.orderBy = orderByArray;
}
} else {
const orderByArray = columns;
if (this.config.setOperators.length > 0) {
this.config.setOperators.at(-1).orderBy = orderByArray;
} else {
this.config.orderBy = orderByArray;
}
}
return this;
}
limit(limit) {
if (this.config.setOperators.length > 0) {
this.config.setOperators.at(-1).limit = limit;
} else {
this.config.limit = limit;
}
return this;
}
offset(offset) {
if (this.config.setOperators.length > 0) {
this.config.setOperators.at(-1).offset = offset;
} else {
this.config.offset = offset;
}
return this;
}
getSQL() {
return this.dialect.buildSelectQuery(this.config);
}
toSQL() {
const { typings: _typings, ...rest } = this.dialect.sqlToQuery(this.getSQL());
return rest;
}
as(alias) {
const usedTables = [];
usedTables.push(...extractUsedTable(this.config.table));
if (this.config.joins) {
for (const it of this.config.joins)
usedTables.push(...extractUsedTable(it.table));
}
return new Proxy(new Subquery(this.getSQL(), this.config.fields, alias, false, [...new Set(usedTables)]), new SelectionProxyHandler({ alias, sqlAliasedBehavior: "alias", sqlBehavior: "error" }));
}
getSelectedFields() {
return new Proxy(this.config.fields, new SelectionProxyHandler({ alias: this.tableName, sqlAliasedBehavior: "alias", sqlBehavior: "error" }));
}
$dynamic() {
return this;
}
}
class SQLiteSelectBase extends SQLiteSelectQueryBuilderBase {
static [entityKind] = "SQLiteSelect";
_prepare(isOneTimeQuery = true) {
if (!this.session) {
throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");
}
const fieldsList = orderSelectedFields(this.config.fields);
const query = this.session[isOneTimeQuery ? "prepareOneTimeQuery" : "prepareQuery"](this.dialect.sqlToQuery(this.getSQL()), fieldsList, "all", true, undefined, {
type: "select",
tables: [...this.usedTables]
}, this.cacheConfig);
query.joinsNotNullableMap = this.joinsNotNullableMap;
return query;
}
$withCache(config2) {
this.cacheConfig = config2 === undefined ? { config: {}, enable: true, autoInvalidate: true } : config2 === false ? { enable: false } : { enable: true, autoInvalidate: true, ...config2 };
return this;
}
prepare() {
return this._prepare(false);
}
run = (placeholderValues) => {
return this._prepare().run(placeholderValues);
};
all = (placeholderValues) => {
return this._prepare().all(placeholderValues);
};
get = (placeholderValues) => {
return this._prepare().get(placeholderValues);
};
values = (placeholderValues) => {
return this._prepare().values(placeholderValues);
};
async execute() {
return this.all();
}
}
applyMixins(SQLiteSelectBase, [QueryPromise]);
function createSetOperator(type, isAll) {
return (leftSelect, rightSelect, ...restSelects) => {
const setOperators = [rightSelect, ...restSelects].map((select) => ({
type,
isAll,
rightSelect: select
}));
for (const setOperator of setOperators) {
if (!haveSameKeys(leftSelect.getSelectedFields(), setOperator.rightSelect.getSelectedFields())) {
throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");
}
}
return leftSelect.addSetOperators(setOperators);
};
}
var getSQLiteSetOperators = () => ({
union: union2,
unionAll,
intersect,
except
});
var union2 = createSetOperator("union", false);
var unionAll = createSetOperator("union", true);
var intersect = createSetOperator("intersect", false);
var except = createSetOperator("except", false);
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/query-builders/query-builder.js
class QueryBuilder {
static [entityKind] = "SQLiteQueryBuilder";
dialect;
dialectConfig;
constructor(dialect) {
this.dialect = is(dialect, SQLiteDialect) ? dialect : undefined;
this.dialectConfig = is(dialect, SQLiteDialect) ? undefined : dialect;
}
$with = (alias, selection) => {
const queryBuilder = this;
const as = (qb) => {
if (typeof qb === "function") {
qb = qb(queryBuilder);
}
return new Proxy(new WithSubquery(qb.getSQL(), selection ?? ("getSelectedFields" in qb ? qb.getSelectedFields() ?? {} : {}), alias, true), new SelectionProxyHandler({ alias, sqlAliasedBehavior: "alias", sqlBehavior: "error" }));
};
return { as };
};
with(...queries) {
const self = this;
function select(fields) {
return new SQLiteSelectBuilder({
fields: fields ?? undefined,
session: undefined,
dialect: self.getDialect(),
withList: queries
});
}
function selectDistinct(fields) {
return new SQLiteSelectBuilder({
fields: fields ?? undefined,
session: undefined,
dialect: self.getDialect(),
withList: queries,
distinct: true
});
}
return { select, selectDistinct };
}
select(fields) {
return new SQLiteSelectBuilder({ fields: fields ?? undefined, session: undefined, dialect: this.getDialect() });
}
selectDistinct(fields) {
return new SQLiteSelectBuilder({
fields: fields ?? undefined,
session: undefined,
dialect: this.getDialect(),
distinct: true
});
}
getDialect() {
if (!this.dialect) {
this.dialect = new SQLiteSyncDialect(this.dialectConfig);
}
return this.dialect;
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/query-builders/insert.js
class SQLiteInsertBuilder {
constructor(table, session, dialect, withList) {
this.table = table;
this.session = session;
this.dialect = dialect;
this.withList = withList;
}
static [entityKind] = "SQLiteInsertBuilder";
values(values) {
values = Array.isArray(values) ? values : [values];
if (values.length === 0) {
throw new Error("values() must be called with at least one value");
}
const mappedValues = values.map((entry) => {
const result = {};
const cols = this.table[Table.Symbol.Columns];
for (const colKey of Object.keys(entry)) {
const colValue = entry[colKey];
result[colKey] = is(colValue, SQL) ? colValue : new Param(colValue, cols[colKey]);
}
return result;
});
return new SQLiteInsertBase(this.table, mappedValues, this.session, this.dialect, this.withList);
}
select(selectQuery) {
const select = typeof selectQuery === "function" ? selectQuery(new QueryBuilder) : selectQuery;
if (!is(select, SQL) && !haveSameKeys(this.table[Columns], select._.selectedFields)) {
throw new Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");
}
return new SQLiteInsertBase(this.table, select, this.session, this.dialect, this.withList, true);
}
}
class SQLiteInsertBase extends QueryPromise {
constructor(table, values, session, dialect, withList, select) {
super();
this.session = session;
this.dialect = dialect;
this.config = { table, values, withList, select };
}
static [entityKind] = "SQLiteInsert";
config;
returning(fields = this.config.table[SQLiteTable.Symbol.Columns]) {
this.config.returning = orderSelectedFields(fields);
return this;
}
onConflictDoNothing(config2 = {}) {
if (!this.config.onConflict)
this.config.onConflict = [];
if (config2.target === undefined) {
this.config.onConflict.push(sql` on conflict do nothing`);
} else {
const targetSql = Array.isArray(config2.target) ? sql`${config2.target}` : sql`${[config2.target]}`;
const whereSql = config2.where ? sql` where ${config2.where}` : sql``;
this.config.onConflict.push(sql` on conflict ${targetSql} do nothing${whereSql}`);
}
return this;
}
onConflictDoUpdate(config2) {
if (config2.where && (config2.targetWhere || config2.setWhere)) {
throw new Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');
}
if (!this.config.onConflict)
this.config.onConflict = [];
const whereSql = config2.where ? sql` where ${config2.where}` : undefined;
const targetWhereSql = config2.targetWhere ? sql` where ${config2.targetWhere}` : undefined;
const setWhereSql = config2.setWhere ? sql` where ${config2.setWhere}` : undefined;
const targetSql = Array.isArray(config2.target) ? sql`${config2.target}` : sql`${[config2.target]}`;
const setSql = this.dialect.buildUpdateSet(this.config.table, mapUpdateSet(this.config.table, config2.set));
this.config.onConflict.push(sql` on conflict ${targetSql}${targetWhereSql} do update set ${setSql}${whereSql}${setWhereSql}`);
return this;
}
getSQL() {
return this.dialect.buildInsertQuery(this.config);
}
toSQL() {
const { typings: _typings, ...rest } = this.dialect.sqlToQuery(this.getSQL());
return rest;
}
_prepare(isOneTimeQuery = true) {
return this.session[isOneTimeQuery ? "prepareOneTimeQuery" : "prepareQuery"](this.dialect.sqlToQuery(this.getSQL()), this.config.returning, this.config.returning ? "all" : "run", true, undefined, {
type: "insert",
tables: extractUsedTable(this.config.table)
});
}
prepare() {
return this._prepare(false);
}
run = (placeholderValues) => {
return this._prepare().run(placeholderValues);
};
all = (placeholderValues) => {
return this._prepare().all(placeholderValues);
};
get = (placeholderValues) => {
return this._prepare().get(placeholderValues);
};
values = (placeholderValues) => {
return this._prepare().values(placeholderValues);
};
async execute() {
return this.config.returning ? this.all() : this.run();
}
$dynamic() {
return this;
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/query-builders/update.js
class SQLiteUpdateBuilder {
constructor(table, session, dialect, withList) {
this.table = table;
this.session = session;
this.dialect = dialect;
this.withList = withList;
}
static [entityKind] = "SQLiteUpdateBuilder";
set(values) {
return new SQLiteUpdateBase(this.table, mapUpdateSet(this.table, values), this.session, this.dialect, this.withList);
}
}
class SQLiteUpdateBase extends QueryPromise {
constructor(table, set2, session, dialect, withList) {
super();
this.session = session;
this.dialect = dialect;
this.config = { set: set2, table, withList, joins: [] };
}
static [entityKind] = "SQLiteUpdate";
config;
from(source) {
this.config.from = source;
return this;
}
createJoin(joinType) {
return (table, on) => {
const tableName = getTableLikeName(table);
if (typeof tableName === "string" && this.config.joins.some((join) => join.alias === tableName)) {
throw new Error(`Alias "${tableName}" is already used in this query`);
}
if (typeof on === "function") {
const from = this.config.from ? is(table, SQLiteTable) ? table[Table.Symbol.Columns] : is(table, Subquery) ? table._.selectedFields : is(table, SQLiteViewBase) ? table[ViewBaseConfig].selectedFields : undefined : undefined;
on = on(new Proxy(this.config.table[Table.Symbol.Columns], new SelectionProxyHandler({ sqlAliasedBehavior: "sql", sqlBehavior: "sql" })), from && new Proxy(from, new SelectionProxyHandler({ sqlAliasedBehavior: "sql", sqlBehavior: "sql" })));
}
this.config.joins.push({ on, table, joinType, alias: tableName });
return this;
};
}
leftJoin = this.createJoin("left");
rightJoin = this.createJoin("right");
innerJoin = this.createJoin("inner");
fullJoin = this.createJoin("full");
where(where) {
this.config.where = where;
return this;
}
orderBy(...columns) {
if (typeof columns[0] === "function") {
const orderBy = columns[0](new Proxy(this.config.table[Table.Symbol.Columns], new SelectionProxyHandler({ sqlAliasedBehavior: "alias", sqlBehavior: "sql" })));
const orderByArray = Array.isArray(orderBy) ? orderBy : [orderBy];
this.config.orderBy = orderByArray;
} else {
const orderByArray = columns;
this.config.orderBy = orderByArray;
}
return this;
}
limit(limit) {
this.config.limit = limit;
return this;
}
returning(fields = this.config.table[SQLiteTable.Symbol.Columns]) {
this.config.returning = orderSelectedFields(fields);
return this;
}
getSQL() {
return this.dialect.buildUpdateQuery(this.config);
}
toSQL() {
const { typings: _typings, ...rest } = this.dialect.sqlToQuery(this.getSQL());
return rest;
}
_prepare(isOneTimeQuery = true) {
return this.session[isOneTimeQuery ? "prepareOneTimeQuery" : "prepareQuery"](this.dialect.sqlToQuery(this.getSQL()), this.config.returning, this.config.returning ? "all" : "run", true, undefined, {
type: "insert",
tables: extractUsedTable(this.config.table)
});
}
prepare() {
return this._prepare(false);
}
run = (placeholderValues) => {
return this._prepare().run(placeholderValues);
};
all = (placeholderValues) => {
return this._prepare().all(placeholderValues);
};
get = (placeholderValues) => {
return this._prepare().get(placeholderValues);
};
values = (placeholderValues) => {
return this._prepare().values(placeholderValues);
};
async execute() {
return this.config.returning ? this.all() : this.run();
}
$dynamic() {
return this;
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/query-builders/count.js
class SQLiteCountBuilder extends SQL {
constructor(params) {
super(SQLiteCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
this.params = params;
this.session = params.session;
this.sql = SQLiteCountBuilder.buildCount(params.source, params.filters);
}
sql;
static [entityKind] = "SQLiteCountBuilderAsync";
[Symbol.toStringTag] = "SQLiteCountBuilderAsync";
session;
static buildEmbeddedCount(source, filters) {
return sql`(select count(*) from ${source}${sql.raw(" where ").if(filters)}${filters})`;
}
static buildCount(source, filters) {
return sql`select count(*) from ${source}${sql.raw(" where ").if(filters)}${filters}`;
}
then(onfulfilled, onrejected) {
return Promise.resolve(this.session.count(this.sql)).then(onfulfilled, onrejected);
}
catch(onRejected) {
return this.then(undefined, onRejected);
}
finally(onFinally) {
return this.then((value) => {
onFinally?.();
return value;
}, (reason) => {
onFinally?.();
throw reason;
});
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/query-builders/query.js
class RelationalQueryBuilder {
constructor(mode, fullSchema, schema, tableNamesMap, table, tableConfig, dialect, session) {
this.mode = mode;
this.fullSchema = fullSchema;
this.schema = schema;
this.tableNamesMap = tableNamesMap;
this.table = table;
this.tableConfig = tableConfig;
this.dialect = dialect;
this.session = session;
}
static [entityKind] = "SQLiteAsyncRelationalQueryBuilder";
findMany(config2) {
return this.mode === "sync" ? new SQLiteSyncRelationalQuery(this.fullSchema, this.schema, this.tableNamesMap, this.table, this.tableConfig, this.dialect, this.session, config2 ? config2 : {}, "many") : new SQLiteRelationalQuery(this.fullSchema, this.schema, this.tableNamesMap, this.table, this.tableConfig, this.dialect, this.session, config2 ? config2 : {}, "many");
}
findFirst(config2) {
return this.mode === "sync" ? new SQLiteSyncRelationalQuery(this.fullSchema, this.schema, this.tableNamesMap, this.table, this.tableConfig, this.dialect, this.session, config2 ? { ...config2, limit: 1 } : { limit: 1 }, "first") : new SQLiteRelationalQuery(this.fullSchema, this.schema, this.tableNamesMap, this.table, this.tableConfig, this.dialect, this.session, config2 ? { ...config2, limit: 1 } : { limit: 1 }, "first");
}
}
class SQLiteRelationalQuery extends QueryPromise {
constructor(fullSchema, schema, tableNamesMap, table, tableConfig, dialect, session, config2, mode) {
super();
this.fullSchema = fullSchema;
this.schema = schema;
this.tableNamesMap = tableNamesMap;
this.table = table;
this.tableConfig = tableConfig;
this.dialect = dialect;
this.session = session;
this.config = config2;
this.mode = mode;
}
static [entityKind] = "SQLiteAsyncRelationalQuery";
mode;
getSQL() {
return this.dialect.buildRelationalQuery({
fullSchema: this.fullSchema,
schema: this.schema,
tableNamesMap: this.tableNamesMap,
table: this.table,
tableConfig: this.tableConfig,
queryConfig: this.config,
tableAlias: this.tableConfig.tsName
}).sql;
}
_prepare(isOneTimeQuery = false) {
const { query, builtQuery } = this._toSQL();
return this.session[isOneTimeQuery ? "prepareOneTimeQuery" : "prepareQuery"](builtQuery, undefined, this.mode === "first" ? "get" : "all", true, (rawRows, mapColumnValue) => {
const rows = rawRows.map((row) => mapRelationalRow(this.schema, this.tableConfig, row, query.selection, mapColumnValue));
if (this.mode === "first") {
return rows[0];
}
return rows;
});
}
prepare() {
return this._prepare(false);
}
_toSQL() {
const query = this.dialect.buildRelationalQuery({
fullSchema: this.fullSchema,
schema: this.schema,
tableNamesMap: this.tableNamesMap,
table: this.table,
tableConfig: this.tableConfig,
queryConfig: this.config,
tableAlias: this.tableConfig.tsName
});
const builtQuery = this.dialect.sqlToQuery(query.sql);
return { query, builtQuery };
}
toSQL() {
return this._toSQL().builtQuery;
}
executeRaw() {
if (this.mode === "first") {
return this._prepare(false).get();
}
return this._prepare(false).all();
}
async execute() {
return this.executeRaw();
}
}
class SQLiteSyncRelationalQuery extends SQLiteRelationalQuery {
static [entityKind] = "SQLiteSyncRelationalQuery";
sync() {
return this.executeRaw();
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/query-builders/raw.js
class SQLiteRaw extends QueryPromise {
constructor(execute, getSQL, action, dialect, mapBatchResult) {
super();
this.execute = execute;
this.getSQL = getSQL;
this.dialect = dialect;
this.mapBatchResult = mapBatchResult;
this.config = { action };
}
static [entityKind] = "SQLiteRaw";
config;
getQuery() {
return { ...this.dialect.sqlToQuery(this.getSQL()), method: this.config.action };
}
mapResult(result, isFromBatch) {
return isFromBatch ? this.mapBatchResult(result) : result;
}
_prepare() {
return this;
}
isResponseInArrayMode() {
return false;
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/db.js
class BaseSQLiteDatabase {
constructor(resultKind, dialect, session, schema) {
this.resultKind = resultKind;
this.dialect = dialect;
this.session = session;
this._ = schema ? {
schema: schema.schema,
fullSchema: schema.fullSchema,
tableNamesMap: schema.tableNamesMap
} : {
schema: undefined,
fullSchema: {},
tableNamesMap: {}
};
this.query = {};
const query = this.query;
if (this._.schema) {
for (const [tableName, columns] of Object.entries(this._.schema)) {
query[tableName] = new RelationalQueryBuilder(resultKind, schema.fullSchema, this._.schema, this._.tableNamesMap, schema.fullSchema[tableName], columns, dialect, session);
}
}
this.$cache = { invalidate: async (_params) => {} };
}
static [entityKind] = "BaseSQLiteDatabase";
query;
$with = (alias, selection) => {
const self = this;
const as = (qb) => {
if (typeof qb === "function") {
qb = qb(new QueryBuilder(self.dialect));
}
return new Proxy(new WithSubquery(qb.getSQL(), selection ?? ("getSelectedFields" in qb ? qb.getSelectedFields() ?? {} : {}), alias, true), new SelectionProxyHandler({ alias, sqlAliasedBehavior: "alias", sqlBehavior: "error" }));
};
return { as };
};
$count(source, filters) {
return new SQLiteCountBuilder({ source, filters, session: this.session });
}
with(...queries) {
const self = this;
function select(fields) {
return new SQLiteSelectBuilder({
fields: fields ?? undefined,
session: self.session,
dialect: self.dialect,
withList: queries
});
}
function selectDistinct(fields) {
return new SQLiteSelectBuilder({
fields: fields ?? undefined,
session: self.session,
dialect: self.dialect,
withList: queries,
distinct: true
});
}
function update(table) {
return new SQLiteUpdateBuilder(table, self.session, self.dialect, queries);
}
function insert(into) {
return new SQLiteInsertBuilder(into, self.session, self.dialect, queries);
}
function delete_(from) {
return new SQLiteDeleteBase(from, self.session, self.dialect, queries);
}
return { select, selectDistinct, update, insert, delete: delete_ };
}
select(fields) {
return new SQLiteSelectBuilder({ fields: fields ?? undefined, session: this.session, dialect: this.dialect });
}
selectDistinct(fields) {
return new SQLiteSelectBuilder({
fields: fields ?? undefined,
session: this.session,
dialect: this.dialect,
distinct: true
});
}
update(table) {
return new SQLiteUpdateBuilder(table, this.session, this.dialect);
}
$cache;
insert(into) {
return new SQLiteInsertBuilder(into, this.session, this.dialect);
}
delete(from) {
return new SQLiteDeleteBase(from, this.session, this.dialect);
}
run(query) {
const sequel = typeof query === "string" ? sql.raw(query) : query.getSQL();
if (this.resultKind === "async") {
return new SQLiteRaw(async () => this.session.run(sequel), () => sequel, "run", this.dialect, this.session.extractRawRunValueFromBatchResult.bind(this.session));
}
return this.session.run(sequel);
}
all(query) {
const sequel = typeof query === "string" ? sql.raw(query) : query.getSQL();
if (this.resultKind === "async") {
return new SQLiteRaw(async () => this.session.all(sequel), () => sequel, "all", this.dialect, this.session.extractRawAllValueFromBatchResult.bind(this.session));
}
return this.session.all(sequel);
}
get(query) {
const sequel = typeof query === "string" ? sql.raw(query) : query.getSQL();
if (this.resultKind === "async") {
return new SQLiteRaw(async () => this.session.get(sequel), () => sequel, "get", this.dialect, this.session.extractRawGetValueFromBatchResult.bind(this.session));
}
return this.session.get(sequel);
}
values(query) {
const sequel = typeof query === "string" ? sql.raw(query) : query.getSQL();
if (this.resultKind === "async") {
return new SQLiteRaw(async () => this.session.values(sequel), () => sequel, "values", this.dialect, this.session.extractRawValuesValueFromBatchResult.bind(this.session));
}
return this.session.values(sequel);
}
transaction(transaction, config2) {
return this.session.transaction(transaction, config2);
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/cache/core/cache.js
class Cache {
static [entityKind] = "Cache";
}
class NoopCache extends Cache {
strategy() {
return "all";
}
static [entityKind] = "NoopCache";
async get(_key) {
return;
}
async put(_hashedQuery, _response, _tables, _config) {}
async onMutate(_params) {}
}
async function hashQuery(sql2, params) {
const dataToHash = `${sql2}-${JSON.stringify(params)}`;
const encoder = new TextEncoder;
const data = encoder.encode(dataToHash);
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
const hashArray = [...new Uint8Array(hashBuffer)];
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
return hashHex;
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/sqlite-core/session.js
class ExecuteResultSync extends QueryPromise {
constructor(resultCb) {
super();
this.resultCb = resultCb;
}
static [entityKind] = "ExecuteResultSync";
async execute() {
return this.resultCb();
}
sync() {
return this.resultCb();
}
}
class SQLitePreparedQuery {
constructor(mode, executeMethod, query, cache, queryMetadata, cacheConfig) {
this.mode = mode;
this.executeMethod = executeMethod;
this.query = query;
this.cache = cache;
this.queryMetadata = queryMetadata;
this.cacheConfig = cacheConfig;
if (cache && cache.strategy() === "all" && cacheConfig === undefined) {
this.cacheConfig = { enable: true, autoInvalidate: true };
}
if (!this.cacheConfig?.enable) {
this.cacheConfig = undefined;
}
}
static [entityKind] = "PreparedQuery";
joinsNotNullableMap;
async queryWithCache(queryString, params, query) {
if (this.cache === undefined || is(this.cache, NoopCache) || this.queryMetadata === undefined) {
try {
return await query();
} catch (e) {
throw new DrizzleQueryError(queryString, params, e);
}
}
if (this.cacheConfig && !this.cacheConfig.enable) {
try {
return await query();
} catch (e) {
throw new DrizzleQueryError(queryString, params, e);
}
}
if ((this.queryMetadata.type === "insert" || this.queryMetadata.type === "update" || this.queryMetadata.type === "delete") && this.queryMetadata.tables.length > 0) {
try {
const [res] = await Promise.all([
query(),
this.cache.onMutate({ tables: this.queryMetadata.tables })
]);
return res;
} catch (e) {
throw new DrizzleQueryError(queryString, params, e);
}
}
if (!this.cacheConfig) {
try {
return await query();
} catch (e) {
throw new DrizzleQueryError(queryString, params, e);
}
}
if (this.queryMetadata.type === "select") {
const fromCache = await this.cache.get(this.cacheConfig.tag ?? await hashQuery(queryString, params), this.queryMetadata.tables, this.cacheConfig.tag !== undefined, this.cacheConfig.autoInvalidate);
if (fromCache === undefined) {
let result;
try {
result = await query();
} catch (e) {
throw new DrizzleQueryError(queryString, params, e);
}
await this.cache.put(this.cacheConfig.tag ?? await hashQuery(queryString, params), result, this.cacheConfig.autoInvalidate ? this.queryMetadata.tables : [], this.cacheConfig.tag !== undefined, this.cacheConfig.config);
return result;
}
return fromCache;
}
try {
return await query();
} catch (e) {
throw new DrizzleQueryError(queryString, params, e);
}
}
getQuery() {
return this.query;
}
mapRunResult(result, _isFromBatch) {
return result;
}
mapAllResult(_result, _isFromBatch) {
throw new Error("Not implemented");
}
mapGetResult(_result, _isFromBatch) {
throw new Error("Not implemented");
}
execute(placeholderValues) {
if (this.mode === "async") {
return this[this.executeMethod](placeholderValues);
}
return new ExecuteResultSync(() => this[this.executeMethod](placeholderValues));
}
mapResult(response, isFromBatch) {
switch (this.executeMethod) {
case "run": {
return this.mapRunResult(response, isFromBatch);
}
case "all": {
return this.mapAllResult(response, isFromBatch);
}
case "get": {
return this.mapGetResult(response, isFromBatch);
}
}
}
}
class SQLiteSession {
constructor(dialect) {
this.dialect = dialect;
}
static [entityKind] = "SQLiteSession";
prepareOneTimeQuery(query, fields, executeMethod, isResponseInArrayMode, customResultMapper, queryMetadata, cacheConfig) {
return this.prepareQuery(query, fields, executeMethod, isResponseInArrayMode, customResultMapper, queryMetadata, cacheConfig);
}
run(query) {
const staticQuery = this.dialect.sqlToQuery(query);
try {
return this.prepareOneTimeQuery(staticQuery, undefined, "run", false).run();
} catch (err) {
throw new DrizzleError({ cause: err, message: `Failed to run the query '${staticQuery.sql}'` });
}
}
extractRawRunValueFromBatchResult(result) {
return result;
}
all(query) {
return this.prepareOneTimeQuery(this.dialect.sqlToQuery(query), undefined, "run", false).all();
}
extractRawAllValueFromBatchResult(_result) {
throw new Error("Not implemented");
}
get(query) {
return this.prepareOneTimeQuery(this.dialect.sqlToQuery(query), undefined, "run", false).get();
}
extractRawGetValueFromBatchResult(_result) {
throw new Error("Not implemented");
}
values(query) {
return this.prepareOneTimeQuery(this.dialect.sqlToQuery(query), undefined, "run", false).values();
}
async count(sql2) {
const result = await this.values(sql2);
return result[0][0];
}
extractRawValuesValueFromBatchResult(_result) {
throw new Error("Not implemented");
}
}
class SQLiteTransaction extends BaseSQLiteDatabase {
constructor(resultType, dialect, session, schema, nestedIndex = 0) {
super(resultType, dialect, session, schema);
this.schema = schema;
this.nestedIndex = nestedIndex;
}
static [entityKind] = "SQLiteTransaction";
rollback() {
throw new TransactionRollbackError;
}
}
// packages/core/src/schema.ts
var taskStatusSchema = exports_external.enum([
"pending",
"claimed",
"blocked",
"done"
]);
var taskPrioritySchema = exports_external.enum(["low", "normal", "high", "urgent"]);
var taskStatus = Object.freeze({
pending: "pending",
claimed: "claimed",
blocked: "blocked",
done: "done"
});
var taskPriority = Object.freeze({
low: "low",
normal: "normal",
high: "high",
urgent: "urgent"
});
var taskStatusValues = [
taskStatus.pending,
taskStatus.claimed,
taskStatus.blocked,
taskStatus.done
];
var taskStatuses = Object.freeze(taskStatusValues);
var taskPriorityValues = [
taskPriority.low,
taskPriority.normal,
taskPriority.high,
taskPriority.urgent
];
var taskPriorities = Object.freeze(taskPriorityValues);
var tasks = sqliteTable("tasks", {
id: integer2("id").primaryKey({ autoIncrement: true }),
uid: text("uid").notNull().unique(),
title: text("title").notNull(),
url: text("url"),
status: text("status", { enum: taskStatuses }).notNull().default(taskStatus.pending),
priority: text("priority", { enum: taskPriorities }),
claimedBy: text("claimed_by"),
blockedBy: text("blocked_by"),
labels: text("labels"),
note: text("note"),
createdAt: text("created_at").notNull(),
updatedAt: text("updated_at").notNull(),
claimedAt: text("claimed_at"),
blockedAt: text("blocked_at"),
doneAt: text("done_at")
}, (table) => [
index("tasks_status_created_idx").on(table.status, table.createdAt, table.id)
]);
var messages = sqliteTable("messages", {
id: integer2("id").primaryKey({ autoIncrement: true }),
uid: text("uid").notNull().unique(),
body: text("body").notNull(),
author: text("author"),
mentions: text("mentions"),
createdAt: text("created_at").notNull(),
resolvedAt: text("resolved_at")
}, (table) => [index("messages_created_idx").on(table.createdAt, table.id)]);
var messageReads = sqliteTable("message_reads", {
messageId: integer2("message_id").notNull().references(() => messages.id, { onDelete: "cascade" }),
reader: text("reader").notNull(),
readAt: text("read_at").notNull()
}, (table) => [
primaryKey({ columns: [table.messageId, table.reader] }),
index("message_reads_reader_idx").on(table.reader, table.readAt)
]);
var pigeonSchema = Object.freeze({
messageReads,
messages,
tasks
});
// packages/core/src/snapshot.ts
var pigeonSnapshotVersion = 2;
var snapshotTaskSchema = exports_external.object({
id: exports_external.number().int().positive(),
uid: exports_external.string().min(1).optional(),
title: exports_external.string(),
url: exports_external.string().nullable(),
status: taskStatusSchema,
priority: taskPrioritySchema.nullable(),
claimedBy: exports_external.string().nullable(),
blockedBy: exports_external.string().nullable(),
labels: exports_external.string().nullable(),
note: exports_external.string().nullable(),
createdAt: exports_external.string(),
updatedAt: exports_external.string(),
claimedAt: exports_external.string().nullable(),
blockedAt: exports_external.string().nullable(),
doneAt: exports_external.string().nullable()
}).strict();
var snapshotMessageSchema = exports_external.object({
id: exports_external.number().int().positive(),
uid: exports_external.string().min(1).optional(),
body: exports_external.string(),
author: exports_external.string().nullable(),
mentions: exports_external.string().nullable(),
createdAt: exports_external.string(),
resolvedAt: exports_external.string().nullable()
}).strict();
var snapshotMessageReadSchema = exports_external.object({
messageId: exports_external.number().int().positive(),
reader: exports_external.string(),
readAt: exports_external.string()
}).strict();
var snapshotTaskWithIdSchema = snapshotTaskSchema.extend({
uid: exports_external.string().min(1)
});
var snapshotMessageWithIdSchema = snapshotMessageSchema.extend({
uid: exports_external.string().min(1)
});
var pigeonSnapshotWithIdsSchema = exports_external.object({
version: exports_external.literal(pigeonSnapshotVersion),
generatedAt: exports_external.string(),
tasks: exports_external.array(snapshotTaskWithIdSchema),
messages: exports_external.array(snapshotMessageWithIdSchema),
messageReads: exports_external.array(snapshotMessageReadSchema)
}).strict();
var pigeonSnapshotSchema = exports_external.object({
version: exports_external.union([exports_external.literal(1), exports_external.literal(pigeonSnapshotVersion)]),
generatedAt: exports_external.string(),
tasks: exports_external.array(snapshotTaskSchema),
messages: exports_external.array(snapshotMessageSchema),
messageReads: exports_external.array(snapshotMessageReadSchema)
}).strict();
function addSnapshotIds(options) {
return pigeonSnapshotWithIdsSchema.parse({
...options.snapshot,
version: pigeonSnapshotVersion,
tasks: options.snapshot.tasks.map((task) => ({
...task,
uid: task.uid ?? createPigeonId()
})),
messages: options.snapshot.messages.map((message) => ({
...message,
uid: message.uid ?? createPigeonId()
}))
});
}
var pigeonMergeResultSchema = exports_external.object({
tasksAdded: exports_external.number().int().nonnegative(),
tasksSkipped: exports_external.number().int().nonnegative(),
messagesAdded: exports_external.number().int().nonnegative(),
messagesSkipped: exports_external.number().int().nonnegative(),
messageReadsAdded: exports_external.number().int().nonnegative()
});
function taskIdentity(options) {
if (options.task.uid) {
return `uid:${options.task.uid}`;
}
const { id: _id, ...identity } = options.task;
return `legacy:${JSON.stringify(identity)}`;
}
function messageIdentity(options) {
if (options.message.uid) {
return `uid:${options.message.uid}`;
}
const { id: _id, ...identity } = options.message;
return `legacy:${JSON.stringify(identity)}`;
}
function allocateId(options) {
let id = options.preferredId;
let nextId = options.nextId;
if (options.usedIds.has(id)) {
id = nextId;
while (options.usedIds.has(id)) {
id += 1;
}
nextId = id + 1;
} else if (id >= nextId) {
nextId = id + 1;
}
options.usedIds.add(id);
return { id, nextId };
}
function mergePigeonSnapshots(options) {
const tasks2 = [...options.destination.tasks];
const messages2 = [...options.destination.messages];
const messageReads2 = [...options.destination.messageReads];
const taskIdentities = new Set(tasks2.map((task) => taskIdentity({ task })));
const messageIdentities = new Map(messages2.map((message) => [messageIdentity({ message }), message.id]));
const usedTaskIds = new Set(tasks2.map((task) => task.id));
const usedMessageIds = new Set(messages2.map((message) => message.id));
const messageIdMap = new Map;
const existingReadKeys = new Set(messageReads2.map((read) => JSON.stringify([read.messageId, read.reader])));
let nextTaskId = Math.max(0, ...usedTaskIds) + 1;
let nextMessageId = Math.max(0, ...usedMessageIds) + 1;
let tasksAdded = 0;
let tasksSkipped = 0;
let messagesAdded = 0;
let messagesSkipped = 0;
let messageReadsAdded = 0;
for (const task of options.source.tasks) {
const identity = taskIdentity({ task });
if (taskIdentities.has(identity)) {
tasksSkipped += 1;
continue;
}
const allocation = allocateId({
preferredId: task.id,
nextId: nextTaskId,
usedIds: usedTaskIds
});
nextTaskId = allocation.nextId;
tasks2.push({
...task,
id: allocation.id,
uid: task.uid ?? createPigeonId()
});
taskIdentities.add(identity);
tasksAdded += 1;
}
for (const message of options.source.messages) {
const identity = messageIdentity({ message });
const existingId = messageIdentities.get(identity);
if (existingId !== undefined) {
messageIdMap.set(message.id, existingId);
messagesSkipped += 1;
continue;
}
const allocation = allocateId({
preferredId: message.id,
nextId: nextMessageId,
usedIds: usedMessageIds
});
nextMessageId = allocation.nextId;
messages2.push({
...message,
id: allocation.id,
uid: message.uid ?? createPigeonId()
});
messageIdentities.set(identity, allocation.id);
messageIdMap.set(message.id, allocation.id);
messagesAdded += 1;
}
for (const read of options.source.messageReads) {
const messageId = messageIdMap.get(read.messageId);
if (messageId === undefined) {
continue;
}
const key = JSON.stringify([messageId, read.reader]);
if (existingReadKeys.has(key)) {
continue;
}
messageReads2.push({ ...read, messageId });
existingReadKeys.add(key);
messageReadsAdded += 1;
}
return {
snapshot: pigeonSnapshotWithIdsSchema.parse({
...options.destination,
generatedAt: new Date().toISOString(),
tasks: tasks2,
messages: messages2,
messageReads: messageReads2
}),
result: pigeonMergeResultSchema.parse({
tasksAdded,
tasksSkipped,
messagesAdded,
messagesSkipped,
messageReadsAdded
})
};
}
// packages/core/src/time.ts
function nowIso() {
return new Date().toISOString();
}
// packages/core/src/validation.ts
var optionalDbSchema = optionalTrimmedStringSchema;
var requiredText = (message) => trimmedStringSchema.min(1, message);
var optionalText = nullableTrimmedStringSchema;
var optionalUrl = exports_external.string().trim().refine((value) => value.length === 0 || URL.canParse(value), "Task URL must be a valid URL.").transform((value) => value.length > 0 ? value : null).optional();
var optionalPriority = exports_external.enum(taskPriorities, {
error: `Task priority must be one of: ${taskPriorities.join(", ")}.`
}).nullable().optional();
var optionalLabels = csvTextSchema.transform((labels) => uniqueStrings(labels)).transform((labels) => labels.length > 0 ? labels.join(",") : null).optional();
var positiveIntSchema = exports_external.number().int().positive({
message: "ID must be a positive integer."
});
var optionalActorSchema = optionalTrimmedStringSchema;
var addTaskInputSchema = exports_external.object({
title: requiredText("Task title is required."),
url: optionalUrl,
note: optionalText,
priority: optionalPriority,
labels: optionalLabels
});
var updateTaskInputSchema = exports_external.object({
title: requiredText("Task title is required.").optional(),
url: optionalUrl,
note: optionalText,
priority: optionalPriority,
labels: optionalLabels
}).refine((value) => value.title !== undefined || value.url !== undefined || value.note !== undefined || value.priority !== undefined || value.labels !== undefined, "Pass at least one field to update.");
var blockTaskInputSchema = exports_external.object({
blockedBy: optionalText,
note: exports_external.preprocess((value) => value ?? "", requiredText("Blocker note is required."))
});
var addMessageInputSchema = exports_external.object({
body: requiredText("Message body is required."),
by: optionalText,
to: optionalText
});
var messageReaderInputSchema = exports_external.object({
by: exports_external.preprocess((value) => value ?? "", requiredText("Reader name is required. Pass --by <name>."))
});
var parseInput = (schema, value) => {
const result = schema.safeParse(value);
if (result.success) {
return result.data;
}
throw new Error(result.error.issues.map((issue2) => issue2.message).join(" "));
};
function parseAddTaskInput(value) {
return parseInput(addTaskInputSchema, value);
}
function parseUpdateTaskInput(value) {
return parseInput(updateTaskInputSchema, value);
}
function parseBlockTaskInput(value) {
return parseInput(blockTaskInputSchema, value);
}
function parseAddMessageInput(value) {
return parseInput(addMessageInputSchema, value);
}
function parseMessageReaderInput(value) {
return parseInput(messageReaderInputSchema, value);
}
var rpcInput = exports_external.object({
db: optionalDbSchema
});
var rpcAddTaskInputSchema = addTaskInputSchema.extend({
db: optionalDbSchema
});
var rpcUpdateTaskInputSchema = updateTaskInputSchema.extend({
id: positiveIntSchema,
db: optionalDbSchema
});
var rpcBlockTaskInputSchema = blockTaskInputSchema.extend({
id: positiveIntSchema,
db: optionalDbSchema
});
var rpcMessageInputSchema = addMessageInputSchema.extend({
db: optionalDbSchema
});
var rpcMessageListInputSchema = rpcInput.extend({
by: optionalActorSchema,
unread: exports_external.boolean().optional(),
all: exports_external.boolean().optional(),
resolvedOnly: exports_external.boolean().optional(),
mentioned: optionalActorSchema
});
var rpcTaskListInputSchema = rpcInput.extend({
all: exports_external.boolean().optional(),
status: taskStatusSchema.optional(),
statuses: exports_external.array(taskStatusSchema).optional()
});
var rpcStatusInputSchema = rpcInput.extend({ by: optionalActorSchema });
var rpcClaimTaskByIdInputSchema = rpcInput.extend({
id: positiveIntSchema,
by: optionalActorSchema
});
var rpcClaimTaskInputSchema = rpcInput.extend({ by: optionalActorSchema });
var rpcIdInputSchema = rpcInput.extend({ id: positiveIntSchema });
var rpcAckMessageInputSchema = rpcIdInputSchema.extend({
by: optionalActorSchema
});
var rpcAckMessagesInputSchema = rpcInput.extend({
by: optionalActorSchema
});
function asTuple(value) {
return value;
}
var rpcOperationSchemas = asTuple([
exports_external.object({
operation: exports_external.literal(pigeonOperation.initPigeon),
input: rpcInput.default({})
}),
exports_external.object({
operation: exports_external.literal(pigeonOperation.getPigeonStatus),
input: rpcStatusInputSchema.default({})
}),
exports_external.object({
operation: exports_external.literal(pigeonOperation.addTask),
input: rpcAddTaskInputSchema
}),
exports_external.object({
operation: exports_external.literal(pigeonOperation.listTasks),
input: rpcTaskListInputSchema.default({})
}),
exports_external.object({
operation: exports_external.literal(pigeonOperation.addMessage),
input: rpcMessageInputSchema
}),
exports_external.object({
operation: exports_external.literal(pigeonOperation.listMessages),
input: rpcMessageListInputSchema.default({})
}),
exports_external.object({
operation: exports_external.literal(pigeonOperation.ackMessage),
input: rpcAckMessageInputSchema
}),
exports_external.object({
operation: exports_external.literal(pigeonOperation.ackMessages),
input: rpcAckMessagesInputSchema
}),
exports_external.object({
operation: exports_external.literal(pigeonOperation.resolveMessage),
input: rpcIdInputSchema
}),
exports_external.object({
operation: exports_external.literal(pigeonOperation.claimTask),
input: rpcClaimTaskInputSchema.default({})
}),
exports_external.object({
operation: exports_external.literal(pigeonOperation.claimTaskById),
input: rpcClaimTaskByIdInputSchema
}),
exports_external.object({
operation: exports_external.literal(pigeonOperation.releaseTask),
input: rpcIdInputSchema
}),
exports_external.object({
operation: exports_external.literal(pigeonOperation.updateTask),
input: rpcUpdateTaskInputSchema
}),
exports_external.object({
operation: exports_external.literal(pigeonOperation.blockTask),
input: rpcBlockTaskInputSchema
}),
exports_external.object({
operation: exports_external.literal(pigeonOperation.completeTask),
input: rpcIdInputSchema
})
]);
var rpcRequestSchema = exports_external.discriminatedUnion("operation", rpcOperationSchemas);
function parsePigeonRpcRequest(value) {
const result = rpcRequestSchema.safeParse(value);
if (result.success) {
return result.data;
}
throw new Error(result.error.issues.map((issue2) => issue2.message).join(" "));
}
var rpcResponseSuccessSchema = exports_external.object({
protocol: exports_external.literal(pigeonRpcProtocol.version),
ok: exports_external.literal(true),
data: exports_external.unknown()
});
var rpcResponseErrorSchema = exports_external.object({
protocol: exports_external.literal(pigeonRpcProtocol.version),
ok: exports_external.literal(false),
error: exports_external.string()
});
var rpcResponseSchema = exports_external.union([
rpcResponseSuccessSchema,
rpcResponseErrorSchema
]);
var rpcProtocolSchema = exports_external.object({
protocol: exports_external.literal(pigeonRpcProtocol.version)
});
function createPigeonRpcSuccess(options) {
return {
protocol: pigeonRpcProtocol.version,
ok: true,
data: options.data
};
}
function createPigeonRpcError(options) {
return {
protocol: pigeonRpcProtocol.version,
ok: false,
error: options.error
};
}
var rpcTaskOutputSchema = exports_external.object({
id: positiveIntSchema,
uid: exports_external.string().min(1),
title: exports_external.string(),
url: exports_external.string().nullable(),
status: taskStatusSchema,
priority: exports_external.enum(taskPriorities, {
error: `Task priority must be one of: ${taskPriorities.join(", ")}.`
}).nullable(),
claimedBy: exports_external.string().nullable(),
blockedBy: exports_external.string().nullable(),
labels: exports_external.string().nullable(),
note: exports_external.string().nullable(),
createdAt: exports_external.string(),
updatedAt: exports_external.string(),
claimedAt: exports_external.string().nullable(),
blockedAt: exports_external.string().nullable(),
doneAt: exports_external.string().nullable()
});
var rpcMessageSchema = exports_external.object({
id: positiveIntSchema,
uid: exports_external.string().min(1),
body: exports_external.string(),
author: exports_external.string().nullable(),
mentions: exports_external.string().nullable(),
createdAt: exports_external.string(),
resolvedAt: exports_external.string().nullable()
}).passthrough();
var rpcMessageListItemSchema = rpcMessageSchema.extend({
readAt: exports_external.string().nullable()
});
var rpcPigeonStatusSchema = exports_external.object({
path: exports_external.string(),
total: exports_external.number().int().nonnegative(),
counts: exports_external.record(taskStatusSchema, exports_external.number().int().nonnegative()),
unreadMessages: exports_external.number().int().nonnegative().optional()
});
var rpcTaskSchema = rpcTaskOutputSchema.passthrough();
var rpcTaskListSchema = exports_external.array(rpcTaskSchema);
var rpcMessageListSchema = exports_external.array(rpcMessageListItemSchema);
// packages/core/src/commands.ts
var activeTaskStatuses = Object.freeze([
taskStatus.pending,
taskStatus.claimed,
taskStatus.blocked
]);
function normalizeMentions(options) {
const bodyMentions = parseMentionValues(options.body.match(/(?:^|\s)@([a-zA-Z0-9_.-]+)/g)?.map((value) => value.replace(/^.*@/, "")).join(","));
const explicitMentions = parseMentionValues(options.to);
const mentions = [...new Set([...bodyMentions, ...explicitMentions])];
return mentions.length > 0 ? mentions.join(",") : null;
}
function createPigeonCommands(definition) {
async function withDb(options) {
if (!isNonNullableString(options.input) && options.input) {
return options.run(options.input);
}
const connection = await definition.provider.open({ path: options.input });
try {
return await options.run(connection);
} finally {
await connection.close();
}
}
async function initPigeon(options = {}) {
return withDb({
input: options.db,
run: async (connection) => connection.path
});
}
async function addTask(options) {
const input = parseAddTaskInput(options);
return withDb({
input: options.db,
run: async (connection) => {
const now = nowIso();
const [task] = await connection.db.insert(tasks).values({
uid: createPigeonId(),
title: input.title,
url: input.url,
note: input.note,
priority: input.priority,
labels: input.labels,
createdAt: now,
updatedAt: now
}).returning();
return task;
}
});
}
async function listTasks(options = {}) {
return withDb({
input: options.db,
run: async (connection) => {
const where = [];
const statuses = options.statuses ?? (options.status ? [options.status] : undefined);
if (statuses && statuses.length > 0) {
where.push(inArray(tasks.status, statuses));
} else if (!options.all) {
where.push(inArray(tasks.status, activeTaskStatuses));
}
return await connection.db.select().from(tasks).where(where.length > 0 ? and(...where) : undefined).orderBy(asc(tasks.createdAt), asc(tasks.id));
}
});
}
async function getPigeonStatus(options = {}) {
const reader = options.by?.trim();
return withDb({
input: options.db,
run: async (connection) => {
const counts = {
[taskStatus.pending]: 0,
[taskStatus.claimed]: 0,
[taskStatus.blocked]: 0,
[taskStatus.done]: 0
};
const rows = await connection.db.select({
status: tasks.status,
count: sql`count(*)`
}).from(tasks).groupBy(tasks.status);
for (const row of rows) {
const status = taskStatusSchema.parse(row.status);
counts[status] = row.count;
}
return {
path: connection.path,
total: Object.values(counts).reduce((sum, count2) => sum + count2, 0),
counts,
...reader ? {
unreadMessages: await countUnreadMessages({
db: connection,
by: reader
})
} : {}
};
}
});
}
async function addMessage(options) {
const input = parseAddMessageInput(options);
const mentions = normalizeMentions({ body: input.body, to: input.to });
return withDb({
input: options.db,
run: async (connection) => {
const [message] = await connection.db.insert(messages).values({
uid: createPigeonId(),
body: input.body,
author: input.by,
mentions,
createdAt: nowIso()
}).returning();
return message;
}
});
}
async function listMessages(options = {}) {
const reader = options.by?.trim();
const mentioned = options.mentioned ? parseMentionValues(options.mentioned)[0] : undefined;
return withDb({
input: options.db,
run: async (connection) => {
const resolvedFilter = options.resolvedOnly ? isNotNull(messages.resolvedAt) : options.all ? null : isNull(messages.resolvedAt);
if (!reader) {
const where2 = [
...resolvedFilter ? [resolvedFilter] : [],
...mentioned ? [
sql`(',' || coalesce(${messages.mentions}, '') || ',') LIKE ${`%,${mentioned},%`}`
] : []
];
const rows2 = await connection.db.select().from(messages).where(where2.length > 0 ? and(...where2) : undefined).orderBy(asc(messages.createdAt), asc(messages.id));
return rows2.map((message) => ({ ...message, readAt: null }));
}
const readJoin = and(eq(messageReads.messageId, messages.id), eq(messageReads.reader, reader));
const where = [
...resolvedFilter ? [resolvedFilter] : [],
...options.unread ? [isNull(messageReads.readAt)] : [],
...mentioned ? [
sql`(',' || coalesce(${messages.mentions}, '') || ',') LIKE ${`%,${mentioned},%`}`
] : []
];
const rows = await connection.db.select({
id: messages.id,
uid: messages.uid,
body: messages.body,
author: messages.author,
mentions: messages.mentions,
createdAt: messages.createdAt,
resolvedAt: messages.resolvedAt,
readAt: messageReads.readAt
}).from(messages).leftJoin(messageReads, readJoin).where(where.length > 0 ? and(...where) : undefined).orderBy(asc(messages.createdAt), asc(messages.id));
return rows;
}
});
}
async function ackMessage(options) {
const input = parseMessageReaderInput(options);
return withDb({
input: options.db,
run: async (connection) => {
const [message] = await connection.db.select().from(messages).where(eq(messages.id, options.id)).limit(cliValue.one);
if (!message) {
return null;
}
await connection.db.insert(messageReads).values({
messageId: options.id,
reader: input.by,
readAt: nowIso()
}).onConflictDoUpdate({
target: [messageReads.messageId, messageReads.reader],
set: { readAt: nowIso() }
}).run();
return message;
}
});
}
async function ackAllMessages(options) {
const input = parseMessageReaderInput(options);
return withDb({
input: options.db,
run: async (connection) => {
const now = nowIso();
const messagesToAck = (await connection.db.select({ id: messages.id }).from(messages).leftJoin(messageReads, and(eq(messageReads.messageId, messages.id), eq(messageReads.reader, input.by))).where(isNull(messageReads.readAt))).map((message) => message.id);
for (const id of messagesToAck) {
await connection.db.insert(messageReads).values({
messageId: id,
reader: input.by,
readAt: now
}).onConflictDoUpdate({
target: [messageReads.messageId, messageReads.reader],
set: { readAt: now }
}).run();
}
return messagesToAck.length;
}
});
}
async function resolveMessage(options) {
return withDb({
input: options.db,
run: async (connection) => {
const [message] = await connection.db.update(messages).set({ resolvedAt: nowIso() }).where(eq(messages.id, options.id)).returning();
return message ?? null;
}
});
}
async function countUnreadMessages(options) {
const input = parseMessageReaderInput(options);
return withDb({
input: options.db,
run: async (connection) => {
const [row] = await connection.db.select({ value: count() }).from(messages).leftJoin(messageReads, and(eq(messageReads.messageId, messages.id), eq(messageReads.reader, input.by))).where(and(isNull(messages.resolvedAt), isNull(messageReads.readAt)));
return row?.value ?? 0;
}
});
}
async function getBoardSnapshot(options = {}) {
return withDb({
input: options.db,
run: async (connection) => {
const activeMessageMode = options.messageMode ?? (options.by?.trim() ? messageMode.unread : messageMode.all);
return JSON.stringify({
tasks: await listTasks({
db: connection,
all: options.all,
statuses: options.statuses
}),
messages: activeMessageMode === messageMode.none ? [] : await listMessages({
db: connection,
by: options.by,
unread: activeMessageMode === messageMode.unread,
all: options.allMessages,
mentioned: options.mentioned
})
});
}
});
}
async function exportSnapshot(options = {}) {
return withDb({
input: options.db,
run: async (connection) => {
const taskRows = await connection.db.select().from(tasks).orderBy(asc(tasks.createdAt), asc(tasks.id));
const messageRows = await connection.db.select().from(messages).orderBy(asc(messages.createdAt), asc(messages.id));
const messageReadRows = await connection.db.select().from(messageReads).orderBy(asc(messageReads.messageId), asc(messageReads.reader));
const snapshot = {
version: pigeonSnapshotVersion,
generatedAt: nowIso(),
tasks: taskRows,
messages: messageRows,
messageReads: messageReadRows
};
return pigeonSnapshotSchema.parse(snapshot);
}
});
}
async function importSnapshot(options) {
const snapshot = addSnapshotIds({
snapshot: pigeonSnapshotSchema.parse(options.snapshot)
});
return withDb({
input: options.db,
run: async (connection) => connection.db.transaction(async (transaction) => {
await transaction.delete(messageReads).run();
await transaction.delete(messages).run();
await transaction.delete(tasks).run();
if (snapshot.tasks.length > 0) {
await transaction.insert(tasks).values(snapshot.tasks).run();
}
if (snapshot.messages.length > 0) {
await transaction.insert(messages).values(snapshot.messages).run();
}
if (snapshot.messageReads.length > 0) {
await transaction.insert(messageReads).values(snapshot.messageReads).run();
}
return {
tasks: snapshot.tasks.length,
messages: snapshot.messages.length,
messageReads: snapshot.messageReads.length
};
})
});
}
async function mergeSnapshot(options) {
const source = pigeonSnapshotSchema.parse(options.snapshot);
return withDb({
input: options.db,
run: async (connection) => {
const destination = pigeonSnapshotSchema.parse({
version: pigeonSnapshotVersion,
generatedAt: nowIso(),
tasks: await connection.db.select().from(tasks),
messages: await connection.db.select().from(messages),
messageReads: await connection.db.select().from(messageReads)
});
const merged = mergePigeonSnapshots({ destination, source });
const destinationTaskIds = new Set(destination.tasks.map((task) => task.id));
const destinationMessageIds = new Set(destination.messages.map((message) => message.id));
const destinationReadKeys = new Set(destination.messageReads.map((read) => JSON.stringify([read.messageId, read.reader])));
return connection.db.transaction(async (transaction) => {
const tasksToInsert = merged.snapshot.tasks.filter((task) => !destinationTaskIds.has(task.id));
const messagesToInsert = merged.snapshot.messages.filter((message) => !destinationMessageIds.has(message.id));
const readsToInsert = merged.snapshot.messageReads.filter((read) => !destinationReadKeys.has(JSON.stringify([read.messageId, read.reader])));
if (tasksToInsert.length > 0) {
await transaction.insert(tasks).values(tasksToInsert).run();
}
if (messagesToInsert.length > 0) {
await transaction.insert(messages).values(messagesToInsert).run();
}
if (readsToInsert.length > 0) {
await transaction.insert(messageReads).values(readsToInsert).run();
}
return merged.result;
});
}
});
}
async function waitForBoardChange(options) {
const intervalMs = options.intervalMs ?? cliValue.defaultIntervalMs;
const startedAt = Date.now();
const initialSnapshot = await getBoardSnapshot(options);
options.onReady?.();
while (!options.signal?.aborted) {
if (options.timeoutMs !== undefined && Date.now() - startedAt >= options.timeoutMs) {
return { changed: false, snapshot: initialSnapshot };
}
await new Promise((resolve) => setTimeout(resolve, intervalMs));
const snapshot = await getBoardSnapshot(options);
if (snapshot !== initialSnapshot) {
return { changed: true, snapshot };
}
}
return { changed: false, snapshot: initialSnapshot };
}
async function claimTask(options = {}) {
return withDb({
input: options.db,
run: async (connection) => {
const now = nowIso();
const claimedBy = options.by?.trim() || null;
const nextPendingTask = connection.db.select({ id: tasks.id }).from(tasks).where(eq(tasks.status, taskStatus.pending)).orderBy(asc(tasks.createdAt), asc(tasks.id)).limit(cliValue.one);
const [task] = await connection.db.update(tasks).set({
status: taskStatus.claimed,
claimedBy,
claimedAt: now,
updatedAt: now
}).where(and(eq(tasks.status, taskStatus.pending), inArray(tasks.id, nextPendingTask))).returning();
return task ?? null;
}
});
}
async function claimTaskById(options) {
return withDb({
input: options.db,
run: async (connection) => {
const now = nowIso();
const [task] = await connection.db.update(tasks).set({
status: taskStatus.claimed,
claimedBy: options.by?.trim() || null,
claimedAt: now,
updatedAt: now
}).where(and(eq(tasks.id, options.id), eq(tasks.status, taskStatus.pending))).returning();
return task ?? null;
}
});
}
async function releaseTask(options) {
return withDb({
input: options.db,
run: async (connection) => {
const [task] = await connection.db.update(tasks).set({
status: taskStatus.pending,
claimedBy: null,
claimedAt: null,
updatedAt: nowIso()
}).where(and(eq(tasks.id, options.id), eq(tasks.status, taskStatus.claimed))).returning();
return task ?? null;
}
});
}
async function updateTask(options) {
const input = parseUpdateTaskInput(options);
return withDb({
input: options.db,
run: async (connection) => {
const [task] = await connection.db.update(tasks).set({
...input.title !== undefined ? { title: input.title } : {},
...input.url !== undefined ? { url: input.url } : {},
...input.note !== undefined ? { note: input.note } : {},
...input.priority !== undefined ? { priority: input.priority } : {},
...input.labels !== undefined ? { labels: input.labels } : {},
updatedAt: nowIso()
}).where(eq(tasks.id, options.id)).returning();
return task ?? null;
}
});
}
async function blockTask(options) {
const input = parseBlockTaskInput(options);
return setTaskStatus({
db: options.db,
id: options.id,
status: taskStatus.blocked,
note: input.note,
blockedBy: input.blockedBy,
blockedAt: nowIso()
});
}
async function completeTask(options) {
return setTaskStatus({
db: options.db,
id: options.id,
status: taskStatus.done,
doneAt: nowIso()
});
}
async function setTaskStatus(options) {
return withDb({
input: options.db,
run: async (connection) => {
const [task] = await connection.db.update(tasks).set({
status: options.status,
...options.note !== undefined ? { note: options.note || null } : {},
...options.blockedBy !== undefined ? { blockedBy: options.blockedBy || null } : {},
...options.blockedAt ? { blockedAt: options.blockedAt } : {},
...options.doneAt ? { doneAt: options.doneAt } : {},
updatedAt: nowIso()
}).where(eq(tasks.id, options.id)).returning();
return task ?? null;
}
});
}
async function watchTasks(options) {
const intervalMs = options.intervalMs ?? cliValue.defaultIntervalMs;
let lastSnapshot = "";
const renderIfChanged = async () => {
const rows = await listTasks({
db: options.db,
all: options.all,
status: options.status,
statuses: options.statuses
});
const snapshot = JSON.stringify(rows);
if (snapshot !== lastSnapshot) {
lastSnapshot = snapshot;
await options.onChange(rows);
}
};
await renderIfChanged();
while (!options.signal.aborted) {
await new Promise((resolve) => setTimeout(resolve, intervalMs));
if (!options.signal.aborted) {
await renderIfChanged();
}
}
}
return Object.freeze({
ackAllMessages,
ackMessage,
addMessage,
addTask,
blockTask,
claimTask,
claimTaskById,
completeTask,
countUnreadMessages,
exportSnapshot,
getBoardSnapshot,
getPigeonStatus,
importSnapshot,
initPigeon,
listMessages,
listTasks,
mergeSnapshot,
releaseTask,
resolveMessage,
updateTask,
waitForBoardChange,
watchTasks
});
}
// packages/core/src/rpc.ts
function createPigeonRpcRunner(options) {
async function runPigeonOperation(request) {
const payload = parsePigeonRpcRequest({
operation: request.operation,
input: request.db ? {
...hasProperties(request.input) ? request.input : {},
db: request.db
} : request.input
});
switch (payload.operation) {
case pigeonOperation.initPigeon:
return options.commands.initPigeon(payload.input);
case pigeonOperation.getPigeonStatus:
return options.commands.getPigeonStatus(payload.input);
case pigeonOperation.addTask:
return options.commands.addTask(payload.input);
case pigeonOperation.listTasks:
return options.commands.listTasks(payload.input);
case pigeonOperation.addMessage:
return options.commands.addMessage(payload.input);
case pigeonOperation.listMessages:
return options.commands.listMessages(payload.input);
case pigeonOperation.ackMessage:
return options.commands.ackMessage(payload.input);
case pigeonOperation.ackMessages:
return options.commands.ackAllMessages(payload.input);
case pigeonOperation.resolveMessage:
return options.commands.resolveMessage(payload.input);
case pigeonOperation.claimTask:
return options.commands.claimTask(payload.input);
case pigeonOperation.claimTaskById:
return options.commands.claimTaskById(payload.input);
case pigeonOperation.releaseTask:
return options.commands.releaseTask(payload.input);
case pigeonOperation.updateTask:
return options.commands.updateTask(payload.input);
case pigeonOperation.blockTask:
return options.commands.blockTask(payload.input);
case pigeonOperation.completeTask:
return options.commands.completeTask(payload.input);
}
}
return Object.freeze({ runPigeonOperation });
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/d1/session.js
class SQLiteD1Session extends SQLiteSession {
constructor(client, dialect, schema, options = {}) {
super(dialect);
this.client = client;
this.schema = schema;
this.options = options;
this.logger = options.logger ?? new NoopLogger;
this.cache = options.cache ?? new NoopCache;
}
static [entityKind] = "SQLiteD1Session";
logger;
cache;
prepareQuery(query, fields, executeMethod, isResponseInArrayMode, customResultMapper, queryMetadata, cacheConfig) {
const stmt = this.client.prepare(query.sql);
return new D1PreparedQuery(stmt, query, this.logger, this.cache, queryMetadata, cacheConfig, fields, executeMethod, isResponseInArrayMode, customResultMapper);
}
async batch(queries) {
const preparedQueries = [];
const builtQueries = [];
for (const query of queries) {
const preparedQuery = query._prepare();
const builtQuery = preparedQuery.getQuery();
preparedQueries.push(preparedQuery);
if (builtQuery.params.length > 0) {
builtQueries.push(preparedQuery.stmt.bind(...builtQuery.params));
} else {
const builtQuery2 = preparedQuery.getQuery();
builtQueries.push(this.client.prepare(builtQuery2.sql).bind(...builtQuery2.params));
}
}
const batchResults = await this.client.batch(builtQueries);
return batchResults.map((result, i) => preparedQueries[i].mapResult(result, true));
}
extractRawAllValueFromBatchResult(result) {
return result.results;
}
extractRawGetValueFromBatchResult(result) {
return result.results[0];
}
extractRawValuesValueFromBatchResult(result) {
return d1ToRawMapping(result.results);
}
async transaction(transaction, config2) {
const tx = new D1Transaction("async", this.dialect, this, this.schema);
await this.run(sql.raw(`begin${config2?.behavior ? " " + config2.behavior : ""}`));
try {
const result = await transaction(tx);
await this.run(sql`commit`);
return result;
} catch (err) {
await this.run(sql`rollback`);
throw err;
}
}
}
class D1Transaction extends SQLiteTransaction {
static [entityKind] = "D1Transaction";
async transaction(transaction) {
const savepointName = `sp${this.nestedIndex}`;
const tx = new D1Transaction("async", this.dialect, this.session, this.schema, this.nestedIndex + 1);
await this.session.run(sql.raw(`savepoint ${savepointName}`));
try {
const result = await transaction(tx);
await this.session.run(sql.raw(`release savepoint ${savepointName}`));
return result;
} catch (err) {
await this.session.run(sql.raw(`rollback to savepoint ${savepointName}`));
throw err;
}
}
}
function d1ToRawMapping(results) {
const rows = [];
for (const row of results) {
const entry = Object.keys(row).map((k) => row[k]);
rows.push(entry);
}
return rows;
}
class D1PreparedQuery extends SQLitePreparedQuery {
constructor(stmt, query, logger, cache, queryMetadata, cacheConfig, fields, executeMethod, _isResponseInArrayMode, customResultMapper) {
super("async", executeMethod, query, cache, queryMetadata, cacheConfig);
this.logger = logger;
this._isResponseInArrayMode = _isResponseInArrayMode;
this.customResultMapper = customResultMapper;
this.fields = fields;
this.stmt = stmt;
}
static [entityKind] = "D1PreparedQuery";
customResultMapper;
fields;
stmt;
async run(placeholderValues) {
const params = fillPlaceholders(this.query.params, placeholderValues ?? {});
this.logger.logQuery(this.query.sql, params);
return await this.queryWithCache(this.query.sql, params, async () => {
return this.stmt.bind(...params).run();
});
}
async all(placeholderValues) {
const { fields, query, logger, stmt, customResultMapper } = this;
if (!fields && !customResultMapper) {
const params = fillPlaceholders(query.params, placeholderValues ?? {});
logger.logQuery(query.sql, params);
return await this.queryWithCache(query.sql, params, async () => {
return stmt.bind(...params).all().then(({ results }) => this.mapAllResult(results));
});
}
const rows = await this.values(placeholderValues);
return this.mapAllResult(rows);
}
mapAllResult(rows, isFromBatch) {
if (isFromBatch) {
rows = d1ToRawMapping(rows.results);
}
if (!this.fields && !this.customResultMapper) {
return rows;
}
if (this.customResultMapper) {
return this.customResultMapper(rows);
}
return rows.map((row) => mapResultRow(this.fields, row, this.joinsNotNullableMap));
}
async get(placeholderValues) {
const { fields, joinsNotNullableMap, query, logger, stmt, customResultMapper } = this;
if (!fields && !customResultMapper) {
const params = fillPlaceholders(query.params, placeholderValues ?? {});
logger.logQuery(query.sql, params);
return await this.queryWithCache(query.sql, params, async () => {
return stmt.bind(...params).all().then(({ results }) => results[0]);
});
}
const rows = await this.values(placeholderValues);
if (!rows[0]) {
return;
}
if (customResultMapper) {
return customResultMapper(rows);
}
return mapResultRow(fields, rows[0], joinsNotNullableMap);
}
mapGetResult(result, isFromBatch) {
if (isFromBatch) {
result = d1ToRawMapping(result.results)[0];
}
if (!this.fields && !this.customResultMapper) {
return result;
}
if (this.customResultMapper) {
return this.customResultMapper([result]);
}
return mapResultRow(this.fields, result, this.joinsNotNullableMap);
}
async values(placeholderValues) {
const params = fillPlaceholders(this.query.params, placeholderValues ?? {});
this.logger.logQuery(this.query.sql, params);
return await this.queryWithCache(this.query.sql, params, async () => {
return this.stmt.bind(...params).raw();
});
}
isResponseInArrayMode() {
return this._isResponseInArrayMode;
}
}
// node_modules/.bun/drizzle-orm@0.45.2+7588c1257f757c79/node_modules/drizzle-orm/d1/driver.js
class DrizzleD1Database extends BaseSQLiteDatabase {
static [entityKind] = "D1Database";
async batch(batch) {
return this.session.batch(batch);
}
}
function drizzle(client, config2 = {}) {
const dialect = new SQLiteAsyncDialect({ casing: config2.casing });
let logger;
if (config2.logger === true) {
logger = new DefaultLogger;
} else if (config2.logger !== false) {
logger = config2.logger;
}
let schema;
if (config2.schema) {
const tablesConfig = extractTablesRelationalConfig(config2.schema, createTableRelationsHelpers);
schema = {
fullSchema: config2.schema,
schema: tablesConfig.tables,
tableNamesMap: tablesConfig.tableNamesMap
};
}
const session = new SQLiteD1Session(client, dialect, schema, { logger, cache: config2.cache });
const db = new DrizzleD1Database("async", dialect, session, schema);
db.$client = client;
db.$cache = config2.cache;
if (db.$cache) {
db.$cache["invalidate"] = config2.cache?.onMutate;
}
return db;
}
// packages/worker-d1/src/index.ts
var workerValue = Object.freeze({
databasePath: "Cloudflare D1 binding PIGEON_DB",
dbOverrideError: "Pigeon D1 does not support per-request database paths.",
invalidRequestError: "Invalid Pigeon RPC request.",
methodError: "Method not allowed.",
notFoundError: "Not found.",
unauthorizedError: "Unauthorized.",
unknownError: "Unknown error."
});
var d1DatabaseSchema = exports_external.custom((value) => value !== null && value !== undefined, "PIGEON_DB D1 binding is required.");
var pigeonD1EnvironmentSchema = exports_external.object({
PIGEON_DB: d1DatabaseSchema,
PIGEON_TOKEN: exports_external.string().trim().min(1).optional()
});
function createD1Provider(options) {
const db = drizzle(options.env.PIGEON_DB, { schema: pigeonSchema });
return Object.freeze({
async open() {
return {
close: () => {
return;
},
db,
path: workerValue.databasePath
};
}
});
}
function requestToken(options) {
const authorization = options.request.headers.get(httpHeader.authorization);
if (!authorization?.startsWith("Bearer ")) {
return options.request.headers.get(httpHeader.pigeonToken);
}
return authorization.slice("Bearer ".length);
}
function hasDatabasePathOverride(value) {
return hasProperties(value) && isNonBlankString(value.db);
}
function jsonResponse(options) {
return Response.json(options.body, { status: options.status });
}
async function handleRpc(options) {
if (options.env.PIGEON_TOKEN && requestToken({ request: options.request }) !== options.env.PIGEON_TOKEN) {
return jsonResponse({
body: createPigeonRpcError({ error: workerValue.unauthorizedError }),
status: httpStatus.unauthorized
});
}
let requestBody;
try {
requestBody = await options.request.json();
} catch {
return jsonResponse({
body: createPigeonRpcError({ error: workerValue.invalidRequestError }),
status: httpStatus.badRequest
});
}
let request;
try {
request = parsePigeonRpcRequest(requestBody);
} catch {
return jsonResponse({
body: createPigeonRpcError({ error: workerValue.invalidRequestError }),
status: httpStatus.badRequest
});
}
if (hasDatabasePathOverride(request.input)) {
return jsonResponse({
body: createPigeonRpcError({ error: workerValue.dbOverrideError }),
status: httpStatus.badRequest
});
}
const commands = createPigeonCommands({
provider: createD1Provider({ env: options.env })
});
const rpc = createPigeonRpcRunner({ commands });
try {
return jsonResponse({
body: createPigeonRpcSuccess({
data: await rpc.runPigeonOperation({
input: request.input,
operation: request.operation
})
}),
status: httpStatus.ok
});
} catch (error51) {
return jsonResponse({
body: createPigeonRpcError({
error: isError2(error51) ? error51.message : workerValue.unknownError
}),
status: httpStatus.badRequest
});
}
}
async function handlePigeonD1Request(options) {
const parsedEnv = pigeonD1EnvironmentSchema.parse(options.env);
const url2 = new URL(options.request.url);
if (url2.pathname === httpRoute.health && options.request.method === httpMethod.get) {
return jsonResponse({
body: createPigeonRpcSuccess({ data: { health: true } }),
status: httpStatus.ok
});
}
if (url2.pathname !== httpRoute.rpc) {
return jsonResponse({
body: createPigeonRpcError({ error: workerValue.notFoundError }),
status: httpStatus.notFound
});
}
if (options.request.method !== httpMethod.post) {
return jsonResponse({
body: createPigeonRpcError({ error: workerValue.methodError }),
status: httpStatus.methodNotAllowed
});
}
return handleRpc({ env: parsedEnv, request: options.request });
}
var worker = Object.freeze({
async fetch(request, env) {
return handlePigeonD1Request({ env, request });
}
});
var src_default = worker;
export {
handlePigeonD1Request,
src_default as default
};